commit 2f524481c15e2a91099bf0bb138b0ddb21451d92 Author: laurentgom Date: Wed Jan 28 16:18:34 2009 +0000 Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/ git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085 diff --git a/CSFML/Doxyfile b/CSFML/Doxyfile new file mode 100644 index 00000000..ac24aaa9 --- /dev/null +++ b/CSFML/Doxyfile @@ -0,0 +1,239 @@ +# Doxyfile 1.5.2 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = SFML +PROJECT_NUMBER = +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = include/SFML/ \ + Doxygen.hpp +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.h \ + *.hpp +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = .svn +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = NO +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .htm +HTML_HEADER = ../header.htm +HTML_FOOTER = ../footer.htm +HTML_STYLESHEET = ../doxygen.css +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +CHM_FILE = ../SFML.chm +HHC_LOCATION = "C:/Program Files/HTML Help Workshop/hhc.exe" +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 1 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +MSCGEN_PATH = D:/Programmes/mscgen +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/CSFML/Doxygen.hpp b/CSFML/Doxygen.hpp new file mode 100644 index 00000000..58cf6750 --- /dev/null +++ b/CSFML/Doxygen.hpp @@ -0,0 +1,95 @@ +//////////////////////////////////////////////////////////// +/// \mainpage +/// +/// \section welcome Welcome +/// Welcome to the official SFML documentation for C. Here you will find a detailed +/// view of all the SFML functions, as well as source +/// files.
+/// If you are looking for tutorials, you can visit the official website +/// at www.sfml-dev.org. +/// +/// \section example Short example +/// Here is a short example, to show you how simple it is to use SFML in C : +/// +/// \code +/// +/// #include +/// #include +/// +/// int main() +/// { +/// sfWindowSettings Settings = {24, 8, 0}; +/// sfVideoMode Mode = {800, 600, 32}; +/// sfRenderWindow* App; +/// sfImage* Image; +/// sfSprite* Sprite; +/// sfFont* Font; +/// sfString* Text; +/// sfMusic* Music; +/// sfEvent Event; +/// +/// /* Create the main window */ +/// App = sfRenderWindow_Create(Mode, "SFML window", sfResize | sfClose, Settings); +/// if (!App) +/// return EXIT_FAILURE; +/// +/// /* Load a sprite to display */ +/// Image = sfImage_CreateFromFile("cute_image.jpg"); +/// if (!Image) +/// return EXIT_FAILURE; +/// Sprite = sfSprite_Create(); +/// sfSprite_SetImage(Sprite, Image); +/// +/// /* Create a graphical string to display */ +/// Font = sfFont_CreateFromFile("arial.ttf", 50, NULL); +/// if (!Font) +/// return EXIT_FAILURE; +/// Text = sfString_Create(); +/// sfString_SetText(Text, "Hello SFML"); +/// sfString_SetFont(Text, Font); +/// sfString_SetSize(Text, 50); +/// +/// /* Load a music to play */ +/// Music = sfMusic_CreateFromFile("nice_music.ogg"); +/// if (!Music) +/// return EXIT_FAILURE; +/// +/// /* Play the music */ +/// sfMusic_Play(Music); +/// +/// /* Start the game loop */ +/// while (sfRenderWindow_IsOpened(App)) +/// { +/// /* Process events */ +/// while (sfRenderWindow_GetEvent(App, &Event)) +/// { +/// /* Close window : exit */ +/// if (Event.Type == sfEvtClosed) +/// sfRenderWindow_Close(App); +/// } +/// +/// /* Clear the screen */ +/// sfRenderWindow_Clear(App, sfBlack); +/// +/// /* Draw the sprite */ +/// sfRenderWindow_DrawSprite(App, Sprite); +/// +/// /* Draw the string */ +/// sfRenderWindow_DrawString(App, Text); +/// +/// /* Update the window */ +/// sfRenderWindow_Display(App); +/// } +/// +/// /* Cleanup resources */ +/// sfMusic_Destroy(Music); +/// sfString_Destroy(Text); +/// sfFont_Destroy(Font); +/// sfSprite_Destroy(Sprite); +/// sfImage_Destroy(Image); +/// sfRenderWindow_Destroy(App); +/// +/// return EXIT_SUCCESS; +/// } +/// \endcode +//////////////////////////////////////////////////////////// diff --git a/CSFML/Makefile b/CSFML/Makefile new file mode 100644 index 00000000..96ddc42d --- /dev/null +++ b/CSFML/Makefile @@ -0,0 +1,14 @@ + +all: csfml + +csfml: + @(cd ./src/SFML && $(MAKE)) + +install: + @(cd ./src/SFML && $(MAKE) $@) + +clean: + @(cd ./src/SFML && $(MAKE) $@) + +mrproper: + @(cd ./src/SFML && $(MAKE) $@) diff --git a/CSFML/VC2005/CSFML.sln b/CSFML/VC2005/CSFML.sln new file mode 100644 index 00000000..541717f3 --- /dev/null +++ b/CSFML/VC2005/CSFML.sln @@ -0,0 +1,98 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-audio", "csfml-audio.vcproj", "{B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-graphics", "csfml-graphics.vcproj", "{FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}" + ProjectSection(ProjectDependencies) = postProject + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-network", "csfml-network.vcproj", "{823DDC98-42D5-4A38-88CF-9DC06C788AE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-system", "csfml-system.vcproj", "{C061A27D-7CA0-4179-9869-672FA04A86A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-window", "csfml-window.vcproj", "{0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug static|Win32 = Debug static|Win32 + Debug|Win32 = Debug|Win32 + Release DLL|Win32 = Release DLL|Win32 + Release static|Win32 = Release static|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.Build.0 = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.Build.0 = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.Build.0 = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.Build.0 = Release static|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/CSFML/VC2005/csfml-audio-d.def b/CSFML/VC2005/csfml-audio-d.def new file mode 100644 index 00000000..5e2d700e --- /dev/null +++ b/CSFML/VC2005/csfml-audio-d.def @@ -0,0 +1,96 @@ +LIBRARY csfml-audio-d +EXPORTS + sfListener_SetGlobalVolume + sfListener_GetGlobalVolume + sfListener_SetPosition + sfListener_GetPosition + sfListener_SetTarget + sfListener_GetTarget + sfMusic_CreateFromFile + sfMusic_CreateFromMemory + sfMusic_Destroy + sfMusic_SetLoop + sfMusic_GetLoop + sfMusic_GetDuration + sfMusic_Play + sfMusic_Pause + sfMusic_Stop + sfMusic_GetChannelsCount + sfMusic_GetSampleRate + sfMusic_GetStatus + sfMusic_SetPitch + sfMusic_SetVolume + sfMusic_SetPosition + sfMusic_SetMinDistance + sfMusic_SetAttenuation + sfMusic_GetPitch + sfMusic_GetVolume + sfMusic_GetPosition + sfMusic_GetMinDistance + sfMusic_GetAttenuation + sfMusic_GetPlayingOffset + sfSound_Create + sfSound_Destroy + sfSound_Play + sfSound_Pause + sfSound_Stop + sfSound_SetBuffer + sfSound_GetBuffer + sfSound_SetLoop + sfSound_GetLoop + sfSound_GetStatus + sfSound_SetPitch + sfSound_SetVolume + sfSound_SetPosition + sfSound_SetMinDistance + sfSound_SetAttenuation + sfSound_SetPlayingOffset + sfSound_GetPitch + sfSound_GetVolume + sfSound_GetPosition + sfSound_GetPlayingOffset + sfSound_GetMinDistance + sfSound_GetAttenuation + sfSoundBuffer_CreateFromFile + sfSoundBuffer_CreateFromMemory + sfSoundBuffer_CreateFromSamples + sfSoundBuffer_Destroy + sfSoundBuffer_SaveToFile + sfSoundBuffer_GetSamples + sfSoundBuffer_GetSamplesCount + sfSoundBuffer_GetSampleRate + sfSoundBuffer_GetChannelsCount + sfSoundBuffer_GetDuration + sfSoundBufferRecorder_Create + sfSoundBufferRecorder_Destroy + sfSoundBufferRecorder_Start + sfSoundBufferRecorder_Stop + sfSoundBufferRecorder_GetSampleRate + sfSoundBufferRecorder_GetBuffer + sfSoundRecorder_Create + sfSoundRecorder_Destroy + sfSoundRecorder_Start + sfSoundRecorder_Stop + sfSoundRecorder_GetSampleRate + sfSoundRecorder_CanCapture + sfSoundStream_Create + sfSoundStream_Destroy + sfSoundStream_Play + sfSoundStream_Pause + sfSoundStream_Stop + sfSoundStream_GetStatus + sfSoundStream_GetChannelsCount + sfSoundStream_GetSampleRate + sfSoundStream_SetPitch + sfSoundStream_SetVolume + sfSoundStream_SetPosition + sfSoundStream_SetMinDistance + sfSoundStream_SetAttenuation + sfSoundStream_SetLoop + sfSoundStream_GetPitch + sfSoundStream_GetVolume + sfSoundStream_GetPosition + sfSoundStream_GetMinDistance + sfSoundStream_GetAttenuation + sfSoundStream_GetLoop + sfSoundStream_GetPlayingOffset diff --git a/CSFML/VC2005/csfml-audio.def b/CSFML/VC2005/csfml-audio.def new file mode 100644 index 00000000..fb211e82 --- /dev/null +++ b/CSFML/VC2005/csfml-audio.def @@ -0,0 +1,96 @@ +LIBRARY csfml-audio +EXPORTS + sfListener_SetGlobalVolume + sfListener_GetGlobalVolume + sfListener_SetPosition + sfListener_GetPosition + sfListener_SetTarget + sfListener_GetTarget + sfMusic_CreateFromFile + sfMusic_CreateFromMemory + sfMusic_Destroy + sfMusic_SetLoop + sfMusic_GetLoop + sfMusic_GetDuration + sfMusic_Play + sfMusic_Pause + sfMusic_Stop + sfMusic_GetChannelsCount + sfMusic_GetSampleRate + sfMusic_GetStatus + sfMusic_SetPitch + sfMusic_SetVolume + sfMusic_SetPosition + sfMusic_SetMinDistance + sfMusic_SetAttenuation + sfMusic_GetPitch + sfMusic_GetVolume + sfMusic_GetPosition + sfMusic_GetMinDistance + sfMusic_GetAttenuation + sfMusic_GetPlayingOffset + sfSound_Create + sfSound_Destroy + sfSound_Play + sfSound_Pause + sfSound_Stop + sfSound_SetBuffer + sfSound_GetBuffer + sfSound_SetLoop + sfSound_GetLoop + sfSound_GetStatus + sfSound_SetPitch + sfSound_SetVolume + sfSound_SetPosition + sfSound_SetMinDistance + sfSound_SetAttenuation + sfSound_SetPlayingOffset + sfSound_GetPitch + sfSound_GetVolume + sfSound_GetPosition + sfSound_GetPlayingOffset + sfSound_GetMinDistance + sfSound_GetAttenuation + sfSoundBuffer_CreateFromFile + sfSoundBuffer_CreateFromMemory + sfSoundBuffer_CreateFromSamples + sfSoundBuffer_Destroy + sfSoundBuffer_SaveToFile + sfSoundBuffer_GetSamples + sfSoundBuffer_GetSamplesCount + sfSoundBuffer_GetSampleRate + sfSoundBuffer_GetChannelsCount + sfSoundBuffer_GetDuration + sfSoundBufferRecorder_Create + sfSoundBufferRecorder_Destroy + sfSoundBufferRecorder_Start + sfSoundBufferRecorder_Stop + sfSoundBufferRecorder_GetSampleRate + sfSoundBufferRecorder_GetBuffer + sfSoundRecorder_Create + sfSoundRecorder_Destroy + sfSoundRecorder_Start + sfSoundRecorder_Stop + sfSoundRecorder_GetSampleRate + sfSoundRecorder_CanCapture + sfSoundStream_Create + sfSoundStream_Destroy + sfSoundStream_Play + sfSoundStream_Pause + sfSoundStream_Stop + sfSoundStream_GetStatus + sfSoundStream_GetChannelsCount + sfSoundStream_GetSampleRate + sfSoundStream_SetPitch + sfSoundStream_SetVolume + sfSoundStream_SetPosition + sfSoundStream_SetMinDistance + sfSoundStream_SetAttenuation + sfSoundStream_SetLoop + sfSoundStream_GetPitch + sfSoundStream_GetVolume + sfSoundStream_GetPosition + sfSoundStream_GetMinDistance + sfSoundStream_GetAttenuation + sfSoundStream_GetLoop + sfSoundStream_GetPlayingOffset diff --git a/CSFML/VC2005/csfml-audio.vcproj b/CSFML/VC2005/csfml-audio.vcproj new file mode 100644 index 00000000..89b49d4d --- /dev/null +++ b/CSFML/VC2005/csfml-audio.vcproj @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2005/csfml-graphics-d.def b/CSFML/VC2005/csfml-graphics-d.def new file mode 100644 index 00000000..ba05c6a0 --- /dev/null +++ b/CSFML/VC2005/csfml-graphics-d.def @@ -0,0 +1,215 @@ +LIBRARY csfml-graphics-d +EXPORTS + sfBlack + sfWhite + sfRed + sfGreen + sfBlue + sfYellow + sfMagenta + sfCyan + sfColor_FromRGB + sfColor_FromRGBA + sfColor_Add + sfColor_Modulate + sfImage_Create + sfImage_CreateFromColor + sfImage_CreateFromPixels + sfImage_CreateFromFile + sfImage_CreateFromMemory + sfImage_Destroy + sfImage_SaveToFile + sfImage_CreateMaskFromColor + sfImage_Copy + sfImage_CopyScreen + sfImage_SetPixel + sfImage_GetPixel + sfImage_GetPixelsPtr + sfImage_Bind + sfImage_SetSmooth + sfImage_GetWidth + sfImage_GetHeight + sfImage_IsSmooth + sfFloatRect_Offset + sfFloatRect_Contains + sfFloatRect_Intersects + sfIntRect_Offset + sfIntRect_Contains + sfIntRect_Intersects + sfPostFX_CreateFromFile + sfPostFX_CreateFromMemory + sfPostFX_Destroy + sfPostFX_SetParameter1 + sfPostFX_SetParameter2 + sfPostFX_SetParameter3 + sfPostFX_SetParameter4 + sfPostFX_SetTexture + sfPostFX_CanUsePostFX + sfShape_Create + sfShape_CreateLine + sfShape_CreateRectangle + sfShape_CreateCircle + sfShape_Destroy + sfShape_SetX + sfShape_SetY + sfShape_SetPosition + sfShape_SetScaleX + sfShape_SetScaleY + sfShape_SetScale + sfShape_SetRotation + sfShape_SetCenter + sfShape_SetColor + sfShape_SetBlendMode + sfShape_GetX + sfShape_GetY + sfShape_GetScaleX + sfShape_GetScaleY + sfShape_GetRotation + sfShape_GetCenterX + sfShape_GetCenterY + sfShape_GetColor + sfShape_GetBlendMode + sfShape_Move + sfShape_Scale + sfShape_Rotate + sfShape_TransformToLocal + sfShape_TransformToGlobal + sfShape_AddPoint + sfShape_EnableFill + sfShape_EnableOutline + sfShape_SetOutlineWidth + sfShape_GetOutlineWidth + sfShape_GetNbPoints + sfShape_GetPointPosition + sfShape_GetPointColor + sfShape_GetPointOutlineColor + sfShape_SetPointPosition + sfShape_SetPointColor + sfShape_SetPointOutlineColor + sfSprite_Create + sfSprite_Destroy + sfSprite_SetX + sfSprite_SetY + sfSprite_SetPosition + sfSprite_SetScaleX + sfSprite_SetScaleY + sfSprite_SetScale + sfSprite_SetRotation + sfSprite_SetCenter + sfSprite_SetColor + sfSprite_SetBlendMode + sfSprite_GetX + sfSprite_GetY + sfSprite_GetScaleX + sfSprite_GetScaleY + sfSprite_GetRotation + sfSprite_GetCenterX + sfSprite_GetCenterY + sfSprite_GetColor + sfSprite_GetBlendMode + sfSprite_Move + sfSprite_Scale + sfSprite_Rotate + sfSprite_TransformToLocal + sfSprite_TransformToGlobal + sfSprite_SetImage + sfSprite_SetSubRect + sfSprite_Resize + sfSprite_FlipX + sfSprite_FlipY + sfSprite_GetImage + sfSprite_GetSubRect + sfSprite_GetWidth + sfSprite_GetHeight + sfSprite_GetPixel + sfFont_Create + sfFont_CreateFromFile + sfFont_CreateFromMemory + sfFont_Destroy + sfFont_GetCharacterSize + sfFont_GetDefaultFont + sfString_Create + sfString_Destroy + sfString_SetX + sfString_SetY + sfString_SetPosition + sfString_SetScaleX + sfString_SetScaleY + sfString_SetScale + sfString_SetRotation + sfString_SetCenter + sfString_SetColor + sfString_SetBlendMode + sfString_GetX + sfString_GetY + sfString_GetScaleX + sfString_GetScaleY + sfString_GetRotation + sfString_GetCenterX + sfString_GetCenterY + sfString_GetColor + sfString_GetBlendMode + sfString_Move + sfString_Scale + sfString_Rotate + sfString_TransformToLocal + sfString_TransformToGlobal + sfString_SetText + sfString_SetUnicodeText + sfString_SetFont + sfString_SetSize + sfString_SetStyle + sfString_GetUnicodeText + sfString_GetText + sfString_GetFont + sfString_GetSize + sfString_GetStyle + sfString_GetCharacterPos + sfString_GetRect + sfRenderWindow_Create + sfRenderWindow_CreateFromHandle + sfRenderWindow_Destroy + sfRenderWindow_Close + sfRenderWindow_IsOpened + sfRenderWindow_GetWidth + sfRenderWindow_GetHeight + sfRenderWindow_GetSettings + sfRenderWindow_GetEvent + sfRenderWindow_UseVerticalSync + sfRenderWindow_ShowMouseCursor + sfRenderWindow_SetCursorPosition + sfRenderWindow_SetPosition + sfRenderWindow_SetSize + sfRenderWindow_Show + sfRenderWindow_EnableKeyRepeat + sfRenderWindow_SetIcon + sfRenderWindow_SetActive + sfRenderWindow_Display + sfRenderWindow_GetInput + sfRenderWindow_SetFramerateLimit + sfRenderWindow_GetFrameTime + sfRenderWindow_SetJoystickThreshold + sfRenderWindow_DrawPostFX + sfRenderWindow_DrawSprite + sfRenderWindow_DrawString + sfRenderWindow_DrawShape + sfRenderWindow_Capture + sfRenderWindow_Clear + sfRenderWindow_SetView + sfRenderWindow_GetView + sfRenderWindow_GetDefaultView + sfRenderWindow_ConvertCoords + sfRenderWindow_PreserveOpenGLStates + sfView_Create + sfView_CreateFromRect + sfView_Destroy + sfView_SetCenter + sfView_SetHalfSize + sfView_SetFromRect + sfView_GetCenterX + sfView_GetCenterY + sfView_GetHalfSizeX + sfView_GetHalfSizeY + sfView_GetRect + sfView_Move + sfView_Zoom diff --git a/CSFML/VC2005/csfml-graphics.def b/CSFML/VC2005/csfml-graphics.def new file mode 100644 index 00000000..678c053c --- /dev/null +++ b/CSFML/VC2005/csfml-graphics.def @@ -0,0 +1,215 @@ +LIBRARY csfml-graphics +EXPORTS + sfBlack + sfWhite + sfRed + sfGreen + sfBlue + sfYellow + sfMagenta + sfCyan + sfColor_FromRGB + sfColor_FromRGBA + sfColor_Add + sfColor_Modulate + sfImage_Create + sfImage_CreateFromColor + sfImage_CreateFromPixels + sfImage_CreateFromFile + sfImage_CreateFromMemory + sfImage_Destroy + sfImage_SaveToFile + sfImage_CreateMaskFromColor + sfImage_Copy + sfImage_CopyScreen + sfImage_SetPixel + sfImage_GetPixel + sfImage_GetPixelsPtr + sfImage_Bind + sfImage_SetSmooth + sfImage_GetWidth + sfImage_GetHeight + sfImage_IsSmooth + sfFloatRect_Offset + sfFloatRect_Contains + sfFloatRect_Intersects + sfIntRect_Offset + sfIntRect_Contains + sfIntRect_Intersects + sfPostFX_CreateFromFile + sfPostFX_CreateFromMemory + sfPostFX_Destroy + sfPostFX_SetParameter1 + sfPostFX_SetParameter2 + sfPostFX_SetParameter3 + sfPostFX_SetParameter4 + sfPostFX_SetTexture + sfPostFX_CanUsePostFX + sfShape_Create + sfShape_CreateLine + sfShape_CreateRectangle + sfShape_CreateCircle + sfShape_Destroy + sfShape_SetX + sfShape_SetY + sfShape_SetPosition + sfShape_SetScaleX + sfShape_SetScaleY + sfShape_SetScale + sfShape_SetRotation + sfShape_SetCenter + sfShape_SetColor + sfShape_SetBlendMode + sfShape_GetX + sfShape_GetY + sfShape_GetScaleX + sfShape_GetScaleY + sfShape_GetRotation + sfShape_GetCenterX + sfShape_GetCenterY + sfShape_GetColor + sfShape_GetBlendMode + sfShape_Move + sfShape_Scale + sfShape_Rotate + sfShape_TransformToLocal + sfShape_TransformToGlobal + sfShape_AddPoint + sfShape_EnableFill + sfShape_EnableOutline + sfShape_SetOutlineWidth + sfShape_GetOutlineWidth + sfShape_GetNbPoints + sfShape_GetPointPosition + sfShape_GetPointColor + sfShape_GetPointOutlineColor + sfShape_SetPointPosition + sfShape_SetPointColor + sfShape_SetPointOutlineColor + sfSprite_Create + sfSprite_Destroy + sfSprite_SetX + sfSprite_SetY + sfSprite_SetPosition + sfSprite_SetScaleX + sfSprite_SetScaleY + sfSprite_SetScale + sfSprite_SetRotation + sfSprite_SetCenter + sfSprite_SetColor + sfSprite_SetBlendMode + sfSprite_GetX + sfSprite_GetY + sfSprite_GetScaleX + sfSprite_GetScaleY + sfSprite_GetRotation + sfSprite_GetCenterX + sfSprite_GetCenterY + sfSprite_GetColor + sfSprite_GetBlendMode + sfSprite_Move + sfSprite_Scale + sfSprite_Rotate + sfSprite_TransformToLocal + sfSprite_TransformToGlobal + sfSprite_SetImage + sfSprite_SetSubRect + sfSprite_Resize + sfSprite_FlipX + sfSprite_FlipY + sfSprite_GetImage + sfSprite_GetSubRect + sfSprite_GetWidth + sfSprite_GetHeight + sfSprite_GetPixel + sfFont_Create + sfFont_CreateFromFile + sfFont_CreateFromMemory + sfFont_Destroy + sfFont_GetCharacterSize + sfFont_GetDefaultFont + sfString_Create + sfString_Destroy + sfString_SetX + sfString_SetY + sfString_SetPosition + sfString_SetScaleX + sfString_SetScaleY + sfString_SetScale + sfString_SetRotation + sfString_SetCenter + sfString_SetColor + sfString_SetBlendMode + sfString_GetX + sfString_GetY + sfString_GetScaleX + sfString_GetScaleY + sfString_GetRotation + sfString_GetCenterX + sfString_GetCenterY + sfString_GetColor + sfString_GetBlendMode + sfString_Move + sfString_Scale + sfString_Rotate + sfString_TransformToLocal + sfString_TransformToGlobal + sfString_SetText + sfString_SetUnicodeText + sfString_SetFont + sfString_SetSize + sfString_SetStyle + sfString_GetUnicodeText + sfString_GetText + sfString_GetFont + sfString_GetSize + sfString_GetStyle + sfString_GetCharacterPos + sfString_GetRect + sfRenderWindow_Create + sfRenderWindow_CreateFromHandle + sfRenderWindow_Destroy + sfRenderWindow_Close + sfRenderWindow_IsOpened + sfRenderWindow_GetWidth + sfRenderWindow_GetHeight + sfRenderWindow_GetSettings + sfRenderWindow_GetEvent + sfRenderWindow_UseVerticalSync + sfRenderWindow_ShowMouseCursor + sfRenderWindow_SetCursorPosition + sfRenderWindow_SetPosition + sfRenderWindow_SetSize + sfRenderWindow_Show + sfRenderWindow_EnableKeyRepeat + sfRenderWindow_SetIcon + sfRenderWindow_SetActive + sfRenderWindow_Display + sfRenderWindow_GetInput + sfRenderWindow_SetFramerateLimit + sfRenderWindow_GetFrameTime + sfRenderWindow_SetJoystickThreshold + sfRenderWindow_DrawPostFX + sfRenderWindow_DrawSprite + sfRenderWindow_DrawString + sfRenderWindow_DrawShape + sfRenderWindow_Capture + sfRenderWindow_Clear + sfRenderWindow_SetView + sfRenderWindow_GetView + sfRenderWindow_GetDefaultView + sfRenderWindow_ConvertCoords + sfRenderWindow_PreserveOpenGLStates + sfView_Create + sfView_CreateFromRect + sfView_Destroy + sfView_SetCenter + sfView_SetHalfSize + sfView_SetFromRect + sfView_GetCenterX + sfView_GetCenterY + sfView_GetHalfSizeX + sfView_GetHalfSizeY + sfView_GetRect + sfView_Move + sfView_Zoom diff --git a/CSFML/VC2005/csfml-graphics.vcproj b/CSFML/VC2005/csfml-graphics.vcproj new file mode 100644 index 00000000..de49140e --- /dev/null +++ b/CSFML/VC2005/csfml-graphics.vcproj @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2005/csfml-network-d.def b/CSFML/VC2005/csfml-network-d.def new file mode 100644 index 00000000..3235bbf3 --- /dev/null +++ b/CSFML/VC2005/csfml-network-d.def @@ -0,0 +1,125 @@ +LIBRARY csfml-network-d +EXPORTS + sfFtpListingResponse_Destroy + sfFtpListingResponse_IsOk + sfFtpListingResponse_GetStatus + sfFtpListingResponse_GetMessage + sfFtpListingResponse_GetCount + sfFtpListingResponse_GetFilename + sfFtpDirectoryResponse_Destroy + sfFtpDirectoryResponse_IsOk + sfFtpDirectoryResponse_GetStatus + sfFtpDirectoryResponse_GetMessage + sfFtpDirectoryResponse_GetDirectory + sfFtpResponse_Destroy + sfFtpResponse_IsOk + sfFtpResponse_GetStatus + sfFtpResponse_GetMessage + sfFtp_Create + sfFtp_Destroy + sfFtp_Connect + sfFtp_LoginAnonymous + sfFtp_Login + sfFtp_Disconnect + sfFtp_KeepAlive + sfFtp_GetWorkingDirectory + sfFtp_GetDirectoryListing + sfFtp_ChangeDirectory + sfFtp_ParentDirectory + sfFtp_MakeDirectory + sfFtp_DeleteDirectory + sfFtp_RenameFile + sfFtp_DeleteFile + sfFtp_Download + sfFtp_Upload + sfHttpRequest_Create + sfHttpRequest_Destroy + sfHttpRequest_SetField + sfHttpRequest_SetMethod + sfHttpRequest_SetURI + sfHttpRequest_SetHttpVersion + sfHttpRequest_SetBody + sfHttpResponse_Destroy + sfHttpResponse_GetField + sfHttpResponse_GetStatus + sfHttpResponse_GetMajorVersion + sfHttpResponse_GetMinorVersion + sfHttpResponse_GetBody + sfHttp_Create + sfHttp_Destroy + sfHttp_SetHost + sfHttp_SendRequest + sfIPAddress_FromString + sfIPAddress_FromBytes + sfIPAddress_FromInteger + sfIPAddress_IsValid + sfIPAddress_ToString + sfIPAddress_ToInteger + sfIPAddress_GetLocalAddress + sfIPAddress_GetPublicAddress + sfIPAddress_LocalHost + sfSocketTCP_Create + sfSocketTCP_Destroy + sfSocketTCP_SetBlocking + sfSocketTCP_Connect + sfSocketTCP_Listen + sfSocketTCP_Accept + sfSocketTCP_Send + sfSocketTCP_Receive + sfSocketTCP_SendPacket + sfSocketTCP_ReceivePacket + sfSocketTCP_IsValid + sfSocketUDP_Create + sfSocketUDP_Destroy + sfSocketUDP_SetBlocking + sfSocketUDP_Bind + sfSocketUDP_Unbind + sfSocketUDP_Send + sfSocketUDP_Receive + sfSocketUDP_SendPacket + sfSocketUDP_ReceivePacket + sfSocketUDP_IsValid + sfPacket_Create + sfPacket_Destroy + sfPacket_Append + sfPacket_Clear + sfPacket_GetData + sfPacket_GetDataSize + sfPacket_EndOfPacket + sfPacket_CanRead + sfPacket_ReadBool + sfPacket_ReadInt8 + sfPacket_ReadUint8 + sfPacket_ReadInt16 + sfPacket_ReadUint16 + sfPacket_ReadInt32 + sfPacket_ReadUint32 + sfPacket_ReadFloat + sfPacket_ReadDouble + sfPacket_ReadString + sfPacket_ReadWideString + sfPacket_WriteBool + sfPacket_WriteInt8 + sfPacket_WriteUint8 + sfPacket_WriteInt16 + sfPacket_WriteUint16 + sfPacket_WriteInt32 + sfPacket_WriteUint32 + sfPacket_WriteFloat + sfPacket_WriteDouble + sfPacket_WriteString + sfPacket_WriteWideString + sfSelectorTCP_Create + sfSelectorTCP_Destroy + sfSelectorTCP_Add + sfSelectorTCP_Remove + sfSelectorTCP_Clear + sfSelectorTCP_Wait + sfSelectorTCP_GetSocketReady + sfSelectorUDP_Create + sfSelectorUDP_Destroy + sfSelectorUDP_Add + sfSelectorUDP_Remove + sfSelectorUDP_Clear + sfSelectorUDP_Wait + sfSelectorUDP_GetSocketReady diff --git a/CSFML/VC2005/csfml-network.def b/CSFML/VC2005/csfml-network.def new file mode 100644 index 00000000..cdd067d7 --- /dev/null +++ b/CSFML/VC2005/csfml-network.def @@ -0,0 +1,125 @@ +LIBRARY csfml-network +EXPORTS + sfFtpListingResponse_Destroy + sfFtpListingResponse_IsOk + sfFtpListingResponse_GetStatus + sfFtpListingResponse_GetMessage + sfFtpListingResponse_GetCount + sfFtpListingResponse_GetFilename + sfFtpDirectoryResponse_Destroy + sfFtpDirectoryResponse_IsOk + sfFtpDirectoryResponse_GetStatus + sfFtpDirectoryResponse_GetMessage + sfFtpDirectoryResponse_GetDirectory + sfFtpResponse_Destroy + sfFtpResponse_IsOk + sfFtpResponse_GetStatus + sfFtpResponse_GetMessage + sfFtp_Create + sfFtp_Destroy + sfFtp_Connect + sfFtp_LoginAnonymous + sfFtp_Login + sfFtp_Disconnect + sfFtp_KeepAlive + sfFtp_GetWorkingDirectory + sfFtp_GetDirectoryListing + sfFtp_ChangeDirectory + sfFtp_ParentDirectory + sfFtp_MakeDirectory + sfFtp_DeleteDirectory + sfFtp_RenameFile + sfFtp_DeleteFile + sfFtp_Download + sfFtp_Upload + sfHttpRequest_Create + sfHttpRequest_Destroy + sfHttpRequest_SetField + sfHttpRequest_SetMethod + sfHttpRequest_SetURI + sfHttpRequest_SetHttpVersion + sfHttpRequest_SetBody + sfHttpResponse_Destroy + sfHttpResponse_GetField + sfHttpResponse_GetStatus + sfHttpResponse_GetMajorVersion + sfHttpResponse_GetMinorVersion + sfHttpResponse_GetBody + sfHttp_Create + sfHttp_Destroy + sfHttp_SetHost + sfHttp_SendRequest + sfIPAddress_FromString + sfIPAddress_FromBytes + sfIPAddress_FromInteger + sfIPAddress_IsValid + sfIPAddress_ToString + sfIPAddress_ToInteger + sfIPAddress_GetLocalAddress + sfIPAddress_GetPublicAddress + sfIPAddress_LocalHost + sfSocketTCP_Create + sfSocketTCP_Destroy + sfSocketTCP_SetBlocking + sfSocketTCP_Connect + sfSocketTCP_Listen + sfSocketTCP_Accept + sfSocketTCP_Send + sfSocketTCP_Receive + sfSocketTCP_SendPacket + sfSocketTCP_ReceivePacket + sfSocketTCP_IsValid + sfSocketUDP_Create + sfSocketUDP_Destroy + sfSocketUDP_SetBlocking + sfSocketUDP_Bind + sfSocketUDP_Unbind + sfSocketUDP_Send + sfSocketUDP_Receive + sfSocketUDP_SendPacket + sfSocketUDP_ReceivePacket + sfSocketUDP_IsValid + sfPacket_Create + sfPacket_Destroy + sfPacket_Append + sfPacket_Clear + sfPacket_GetData + sfPacket_GetDataSize + sfPacket_EndOfPacket + sfPacket_CanRead + sfPacket_ReadBool + sfPacket_ReadInt8 + sfPacket_ReadUint8 + sfPacket_ReadInt16 + sfPacket_ReadUint16 + sfPacket_ReadInt32 + sfPacket_ReadUint32 + sfPacket_ReadFloat + sfPacket_ReadDouble + sfPacket_ReadString + sfPacket_ReadWideString + sfPacket_WriteBool + sfPacket_WriteInt8 + sfPacket_WriteUint8 + sfPacket_WriteInt16 + sfPacket_WriteUint16 + sfPacket_WriteInt32 + sfPacket_WriteUint32 + sfPacket_WriteFloat + sfPacket_WriteDouble + sfPacket_WriteString + sfPacket_WriteWideString + sfSelectorTCP_Create + sfSelectorTCP_Destroy + sfSelectorTCP_Add + sfSelectorTCP_Remove + sfSelectorTCP_Clear + sfSelectorTCP_Wait + sfSelectorTCP_GetSocketReady + sfSelectorUDP_Create + sfSelectorUDP_Destroy + sfSelectorUDP_Add + sfSelectorUDP_Remove + sfSelectorUDP_Clear + sfSelectorUDP_Wait + sfSelectorUDP_GetSocketReady diff --git a/CSFML/VC2005/csfml-network.vcproj b/CSFML/VC2005/csfml-network.vcproj new file mode 100644 index 00000000..19623f49 --- /dev/null +++ b/CSFML/VC2005/csfml-network.vcproj @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2005/csfml-system-d.def b/CSFML/VC2005/csfml-system-d.def new file mode 100644 index 00000000..122a804c --- /dev/null +++ b/CSFML/VC2005/csfml-system-d.def @@ -0,0 +1,20 @@ +LIBRARY csfml-system-d +EXPORTS + sfClock_Create + sfClock_Destroy + sfClock_GetTime + sfClock_Reset + sfMutex_Create + sfMutex_Destroy + sfMutex_Lock + sfMutex_Unlock + sfRandom_SetSeed + sfRandom_GetSeed + sfRandom_Float + sfRandom_Int + sfSleep + sfThread_Create + sfThread_Destroy + sfThread_Launch + sfThread_Wait + sfThread_Terminate diff --git a/CSFML/VC2005/csfml-system.def b/CSFML/VC2005/csfml-system.def new file mode 100644 index 00000000..da7c4247 --- /dev/null +++ b/CSFML/VC2005/csfml-system.def @@ -0,0 +1,20 @@ +LIBRARY csfml-system +EXPORTS + sfClock_Create + sfClock_Destroy + sfClock_GetTime + sfClock_Reset + sfMutex_Create + sfMutex_Destroy + sfMutex_Lock + sfMutex_Unlock + sfRandom_SetSeed + sfRandom_GetSeed + sfRandom_Float + sfRandom_Int + sfSleep + sfThread_Create + sfThread_Destroy + sfThread_Launch + sfThread_Wait + sfThread_Terminate diff --git a/CSFML/VC2005/csfml-system.vcproj b/CSFML/VC2005/csfml-system.vcproj new file mode 100644 index 00000000..d12b4266 --- /dev/null +++ b/CSFML/VC2005/csfml-system.vcproj @@ -0,0 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2005/csfml-window-d.def b/CSFML/VC2005/csfml-window-d.def new file mode 100644 index 00000000..0003ae98 --- /dev/null +++ b/CSFML/VC2005/csfml-window-d.def @@ -0,0 +1,38 @@ +LIBRARY csfml-window-d +EXPORTS + sfInput_IsKeyDown + sfInput_IsMouseButtonDown + sfInput_IsJoystickButtonDown + sfInput_GetMouseX + sfInput_GetMouseY + sfInput_GetJoystickAxis + sfVideoMode_GetDesktopMode + sfVideoMode_GetMode + sfVideoMode_GetModesCount + sfVideoMode_IsValid + sfWindow_Create + sfWindow_CreateFromHandle + sfWindow_Close + sfWindow_IsOpened + sfWindow_Destroy + sfWindow_GetWidth + sfWindow_GetHeight + sfWindow_GetSettings + sfWindow_GetEvent + sfWindow_UseVerticalSync + sfWindow_ShowMouseCursor + sfWindow_SetCursorPosition + sfWindow_SetPosition + sfWindow_SetSize + sfWindow_Show + sfWindow_EnableKeyRepeat + sfWindow_SetIcon + sfWindow_SetActive + sfWindow_Display + sfWindow_GetInput + sfWindow_SetFramerateLimit + sfWindow_GetFrameTime + sfWindow_SetJoystickThreshold + sfContext_Create + sfContext_Destroy + sfContext_SetActive diff --git a/CSFML/VC2005/csfml-window.def b/CSFML/VC2005/csfml-window.def new file mode 100644 index 00000000..4e1c05c4 --- /dev/null +++ b/CSFML/VC2005/csfml-window.def @@ -0,0 +1,38 @@ +LIBRARY csfml-window +EXPORTS + sfInput_IsKeyDown + sfInput_IsMouseButtonDown + sfInput_IsJoystickButtonDown + sfInput_GetMouseX + sfInput_GetMouseY + sfInput_GetJoystickAxis + sfVideoMode_GetDesktopMode + sfVideoMode_GetMode + sfVideoMode_GetModesCount + sfVideoMode_IsValid + sfWindow_Create + sfWindow_CreateFromHandle + sfWindow_Close + sfWindow_IsOpened + sfWindow_Destroy + sfWindow_GetWidth + sfWindow_GetHeight + sfWindow_GetSettings + sfWindow_GetEvent + sfWindow_UseVerticalSync + sfWindow_ShowMouseCursor + sfWindow_SetCursorPosition + sfWindow_SetPosition + sfWindow_SetSize + sfWindow_Show + sfWindow_EnableKeyRepeat + sfWindow_SetIcon + sfWindow_SetActive + sfWindow_Display + sfWindow_GetInput + sfWindow_SetFramerateLimit + sfWindow_GetFrameTime + sfWindow_SetJoystickThreshold + sfContext_Create + sfContext_Destroy + sfContext_SetActive diff --git a/CSFML/VC2005/csfml-window.vcproj b/CSFML/VC2005/csfml-window.vcproj new file mode 100644 index 00000000..e6de9907 --- /dev/null +++ b/CSFML/VC2005/csfml-window.vcproj @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2008/CSFML.sln b/CSFML/VC2008/CSFML.sln new file mode 100644 index 00000000..6784834b --- /dev/null +++ b/CSFML/VC2008/CSFML.sln @@ -0,0 +1,98 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-audio", "csfml-audio.vcproj", "{B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-graphics", "csfml-graphics.vcproj", "{FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}" + ProjectSection(ProjectDependencies) = postProject + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-network", "csfml-network.vcproj", "{823DDC98-42D5-4A38-88CF-9DC06C788AE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-system", "csfml-system.vcproj", "{C061A27D-7CA0-4179-9869-672FA04A86A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csfml-window", "csfml-window.vcproj", "{0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug static|Win32 = Debug static|Win32 + Debug|Win32 = Debug|Win32 + Release DLL|Win32 = Release DLL|Win32 + Release static|Win32 = Release static|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.Build.0 = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.Build.0 = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.Build.0 = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.Build.0 = Release static|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/CSFML/VC2008/csfml-audio-d.def b/CSFML/VC2008/csfml-audio-d.def new file mode 100644 index 00000000..5e2d700e --- /dev/null +++ b/CSFML/VC2008/csfml-audio-d.def @@ -0,0 +1,96 @@ +LIBRARY csfml-audio-d +EXPORTS + sfListener_SetGlobalVolume + sfListener_GetGlobalVolume + sfListener_SetPosition + sfListener_GetPosition + sfListener_SetTarget + sfListener_GetTarget + sfMusic_CreateFromFile + sfMusic_CreateFromMemory + sfMusic_Destroy + sfMusic_SetLoop + sfMusic_GetLoop + sfMusic_GetDuration + sfMusic_Play + sfMusic_Pause + sfMusic_Stop + sfMusic_GetChannelsCount + sfMusic_GetSampleRate + sfMusic_GetStatus + sfMusic_SetPitch + sfMusic_SetVolume + sfMusic_SetPosition + sfMusic_SetMinDistance + sfMusic_SetAttenuation + sfMusic_GetPitch + sfMusic_GetVolume + sfMusic_GetPosition + sfMusic_GetMinDistance + sfMusic_GetAttenuation + sfMusic_GetPlayingOffset + sfSound_Create + sfSound_Destroy + sfSound_Play + sfSound_Pause + sfSound_Stop + sfSound_SetBuffer + sfSound_GetBuffer + sfSound_SetLoop + sfSound_GetLoop + sfSound_GetStatus + sfSound_SetPitch + sfSound_SetVolume + sfSound_SetPosition + sfSound_SetMinDistance + sfSound_SetAttenuation + sfSound_SetPlayingOffset + sfSound_GetPitch + sfSound_GetVolume + sfSound_GetPosition + sfSound_GetPlayingOffset + sfSound_GetMinDistance + sfSound_GetAttenuation + sfSoundBuffer_CreateFromFile + sfSoundBuffer_CreateFromMemory + sfSoundBuffer_CreateFromSamples + sfSoundBuffer_Destroy + sfSoundBuffer_SaveToFile + sfSoundBuffer_GetSamples + sfSoundBuffer_GetSamplesCount + sfSoundBuffer_GetSampleRate + sfSoundBuffer_GetChannelsCount + sfSoundBuffer_GetDuration + sfSoundBufferRecorder_Create + sfSoundBufferRecorder_Destroy + sfSoundBufferRecorder_Start + sfSoundBufferRecorder_Stop + sfSoundBufferRecorder_GetSampleRate + sfSoundBufferRecorder_GetBuffer + sfSoundRecorder_Create + sfSoundRecorder_Destroy + sfSoundRecorder_Start + sfSoundRecorder_Stop + sfSoundRecorder_GetSampleRate + sfSoundRecorder_CanCapture + sfSoundStream_Create + sfSoundStream_Destroy + sfSoundStream_Play + sfSoundStream_Pause + sfSoundStream_Stop + sfSoundStream_GetStatus + sfSoundStream_GetChannelsCount + sfSoundStream_GetSampleRate + sfSoundStream_SetPitch + sfSoundStream_SetVolume + sfSoundStream_SetPosition + sfSoundStream_SetMinDistance + sfSoundStream_SetAttenuation + sfSoundStream_SetLoop + sfSoundStream_GetPitch + sfSoundStream_GetVolume + sfSoundStream_GetPosition + sfSoundStream_GetMinDistance + sfSoundStream_GetAttenuation + sfSoundStream_GetLoop + sfSoundStream_GetPlayingOffset diff --git a/CSFML/VC2008/csfml-audio.def b/CSFML/VC2008/csfml-audio.def new file mode 100644 index 00000000..fb211e82 --- /dev/null +++ b/CSFML/VC2008/csfml-audio.def @@ -0,0 +1,96 @@ +LIBRARY csfml-audio +EXPORTS + sfListener_SetGlobalVolume + sfListener_GetGlobalVolume + sfListener_SetPosition + sfListener_GetPosition + sfListener_SetTarget + sfListener_GetTarget + sfMusic_CreateFromFile + sfMusic_CreateFromMemory + sfMusic_Destroy + sfMusic_SetLoop + sfMusic_GetLoop + sfMusic_GetDuration + sfMusic_Play + sfMusic_Pause + sfMusic_Stop + sfMusic_GetChannelsCount + sfMusic_GetSampleRate + sfMusic_GetStatus + sfMusic_SetPitch + sfMusic_SetVolume + sfMusic_SetPosition + sfMusic_SetMinDistance + sfMusic_SetAttenuation + sfMusic_GetPitch + sfMusic_GetVolume + sfMusic_GetPosition + sfMusic_GetMinDistance + sfMusic_GetAttenuation + sfMusic_GetPlayingOffset + sfSound_Create + sfSound_Destroy + sfSound_Play + sfSound_Pause + sfSound_Stop + sfSound_SetBuffer + sfSound_GetBuffer + sfSound_SetLoop + sfSound_GetLoop + sfSound_GetStatus + sfSound_SetPitch + sfSound_SetVolume + sfSound_SetPosition + sfSound_SetMinDistance + sfSound_SetAttenuation + sfSound_SetPlayingOffset + sfSound_GetPitch + sfSound_GetVolume + sfSound_GetPosition + sfSound_GetPlayingOffset + sfSound_GetMinDistance + sfSound_GetAttenuation + sfSoundBuffer_CreateFromFile + sfSoundBuffer_CreateFromMemory + sfSoundBuffer_CreateFromSamples + sfSoundBuffer_Destroy + sfSoundBuffer_SaveToFile + sfSoundBuffer_GetSamples + sfSoundBuffer_GetSamplesCount + sfSoundBuffer_GetSampleRate + sfSoundBuffer_GetChannelsCount + sfSoundBuffer_GetDuration + sfSoundBufferRecorder_Create + sfSoundBufferRecorder_Destroy + sfSoundBufferRecorder_Start + sfSoundBufferRecorder_Stop + sfSoundBufferRecorder_GetSampleRate + sfSoundBufferRecorder_GetBuffer + sfSoundRecorder_Create + sfSoundRecorder_Destroy + sfSoundRecorder_Start + sfSoundRecorder_Stop + sfSoundRecorder_GetSampleRate + sfSoundRecorder_CanCapture + sfSoundStream_Create + sfSoundStream_Destroy + sfSoundStream_Play + sfSoundStream_Pause + sfSoundStream_Stop + sfSoundStream_GetStatus + sfSoundStream_GetChannelsCount + sfSoundStream_GetSampleRate + sfSoundStream_SetPitch + sfSoundStream_SetVolume + sfSoundStream_SetPosition + sfSoundStream_SetMinDistance + sfSoundStream_SetAttenuation + sfSoundStream_SetLoop + sfSoundStream_GetPitch + sfSoundStream_GetVolume + sfSoundStream_GetPosition + sfSoundStream_GetMinDistance + sfSoundStream_GetAttenuation + sfSoundStream_GetLoop + sfSoundStream_GetPlayingOffset diff --git a/CSFML/VC2008/csfml-audio.vcproj b/CSFML/VC2008/csfml-audio.vcproj new file mode 100644 index 00000000..b9ea9607 --- /dev/null +++ b/CSFML/VC2008/csfml-audio.vcproj @@ -0,0 +1,406 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2008/csfml-graphics-d.def b/CSFML/VC2008/csfml-graphics-d.def new file mode 100644 index 00000000..ba05c6a0 --- /dev/null +++ b/CSFML/VC2008/csfml-graphics-d.def @@ -0,0 +1,215 @@ +LIBRARY csfml-graphics-d +EXPORTS + sfBlack + sfWhite + sfRed + sfGreen + sfBlue + sfYellow + sfMagenta + sfCyan + sfColor_FromRGB + sfColor_FromRGBA + sfColor_Add + sfColor_Modulate + sfImage_Create + sfImage_CreateFromColor + sfImage_CreateFromPixels + sfImage_CreateFromFile + sfImage_CreateFromMemory + sfImage_Destroy + sfImage_SaveToFile + sfImage_CreateMaskFromColor + sfImage_Copy + sfImage_CopyScreen + sfImage_SetPixel + sfImage_GetPixel + sfImage_GetPixelsPtr + sfImage_Bind + sfImage_SetSmooth + sfImage_GetWidth + sfImage_GetHeight + sfImage_IsSmooth + sfFloatRect_Offset + sfFloatRect_Contains + sfFloatRect_Intersects + sfIntRect_Offset + sfIntRect_Contains + sfIntRect_Intersects + sfPostFX_CreateFromFile + sfPostFX_CreateFromMemory + sfPostFX_Destroy + sfPostFX_SetParameter1 + sfPostFX_SetParameter2 + sfPostFX_SetParameter3 + sfPostFX_SetParameter4 + sfPostFX_SetTexture + sfPostFX_CanUsePostFX + sfShape_Create + sfShape_CreateLine + sfShape_CreateRectangle + sfShape_CreateCircle + sfShape_Destroy + sfShape_SetX + sfShape_SetY + sfShape_SetPosition + sfShape_SetScaleX + sfShape_SetScaleY + sfShape_SetScale + sfShape_SetRotation + sfShape_SetCenter + sfShape_SetColor + sfShape_SetBlendMode + sfShape_GetX + sfShape_GetY + sfShape_GetScaleX + sfShape_GetScaleY + sfShape_GetRotation + sfShape_GetCenterX + sfShape_GetCenterY + sfShape_GetColor + sfShape_GetBlendMode + sfShape_Move + sfShape_Scale + sfShape_Rotate + sfShape_TransformToLocal + sfShape_TransformToGlobal + sfShape_AddPoint + sfShape_EnableFill + sfShape_EnableOutline + sfShape_SetOutlineWidth + sfShape_GetOutlineWidth + sfShape_GetNbPoints + sfShape_GetPointPosition + sfShape_GetPointColor + sfShape_GetPointOutlineColor + sfShape_SetPointPosition + sfShape_SetPointColor + sfShape_SetPointOutlineColor + sfSprite_Create + sfSprite_Destroy + sfSprite_SetX + sfSprite_SetY + sfSprite_SetPosition + sfSprite_SetScaleX + sfSprite_SetScaleY + sfSprite_SetScale + sfSprite_SetRotation + sfSprite_SetCenter + sfSprite_SetColor + sfSprite_SetBlendMode + sfSprite_GetX + sfSprite_GetY + sfSprite_GetScaleX + sfSprite_GetScaleY + sfSprite_GetRotation + sfSprite_GetCenterX + sfSprite_GetCenterY + sfSprite_GetColor + sfSprite_GetBlendMode + sfSprite_Move + sfSprite_Scale + sfSprite_Rotate + sfSprite_TransformToLocal + sfSprite_TransformToGlobal + sfSprite_SetImage + sfSprite_SetSubRect + sfSprite_Resize + sfSprite_FlipX + sfSprite_FlipY + sfSprite_GetImage + sfSprite_GetSubRect + sfSprite_GetWidth + sfSprite_GetHeight + sfSprite_GetPixel + sfFont_Create + sfFont_CreateFromFile + sfFont_CreateFromMemory + sfFont_Destroy + sfFont_GetCharacterSize + sfFont_GetDefaultFont + sfString_Create + sfString_Destroy + sfString_SetX + sfString_SetY + sfString_SetPosition + sfString_SetScaleX + sfString_SetScaleY + sfString_SetScale + sfString_SetRotation + sfString_SetCenter + sfString_SetColor + sfString_SetBlendMode + sfString_GetX + sfString_GetY + sfString_GetScaleX + sfString_GetScaleY + sfString_GetRotation + sfString_GetCenterX + sfString_GetCenterY + sfString_GetColor + sfString_GetBlendMode + sfString_Move + sfString_Scale + sfString_Rotate + sfString_TransformToLocal + sfString_TransformToGlobal + sfString_SetText + sfString_SetUnicodeText + sfString_SetFont + sfString_SetSize + sfString_SetStyle + sfString_GetUnicodeText + sfString_GetText + sfString_GetFont + sfString_GetSize + sfString_GetStyle + sfString_GetCharacterPos + sfString_GetRect + sfRenderWindow_Create + sfRenderWindow_CreateFromHandle + sfRenderWindow_Destroy + sfRenderWindow_Close + sfRenderWindow_IsOpened + sfRenderWindow_GetWidth + sfRenderWindow_GetHeight + sfRenderWindow_GetSettings + sfRenderWindow_GetEvent + sfRenderWindow_UseVerticalSync + sfRenderWindow_ShowMouseCursor + sfRenderWindow_SetCursorPosition + sfRenderWindow_SetPosition + sfRenderWindow_SetSize + sfRenderWindow_Show + sfRenderWindow_EnableKeyRepeat + sfRenderWindow_SetIcon + sfRenderWindow_SetActive + sfRenderWindow_Display + sfRenderWindow_GetInput + sfRenderWindow_SetFramerateLimit + sfRenderWindow_GetFrameTime + sfRenderWindow_SetJoystickThreshold + sfRenderWindow_DrawPostFX + sfRenderWindow_DrawSprite + sfRenderWindow_DrawString + sfRenderWindow_DrawShape + sfRenderWindow_Capture + sfRenderWindow_Clear + sfRenderWindow_SetView + sfRenderWindow_GetView + sfRenderWindow_GetDefaultView + sfRenderWindow_ConvertCoords + sfRenderWindow_PreserveOpenGLStates + sfView_Create + sfView_CreateFromRect + sfView_Destroy + sfView_SetCenter + sfView_SetHalfSize + sfView_SetFromRect + sfView_GetCenterX + sfView_GetCenterY + sfView_GetHalfSizeX + sfView_GetHalfSizeY + sfView_GetRect + sfView_Move + sfView_Zoom diff --git a/CSFML/VC2008/csfml-graphics.def b/CSFML/VC2008/csfml-graphics.def new file mode 100644 index 00000000..678c053c --- /dev/null +++ b/CSFML/VC2008/csfml-graphics.def @@ -0,0 +1,215 @@ +LIBRARY csfml-graphics +EXPORTS + sfBlack + sfWhite + sfRed + sfGreen + sfBlue + sfYellow + sfMagenta + sfCyan + sfColor_FromRGB + sfColor_FromRGBA + sfColor_Add + sfColor_Modulate + sfImage_Create + sfImage_CreateFromColor + sfImage_CreateFromPixels + sfImage_CreateFromFile + sfImage_CreateFromMemory + sfImage_Destroy + sfImage_SaveToFile + sfImage_CreateMaskFromColor + sfImage_Copy + sfImage_CopyScreen + sfImage_SetPixel + sfImage_GetPixel + sfImage_GetPixelsPtr + sfImage_Bind + sfImage_SetSmooth + sfImage_GetWidth + sfImage_GetHeight + sfImage_IsSmooth + sfFloatRect_Offset + sfFloatRect_Contains + sfFloatRect_Intersects + sfIntRect_Offset + sfIntRect_Contains + sfIntRect_Intersects + sfPostFX_CreateFromFile + sfPostFX_CreateFromMemory + sfPostFX_Destroy + sfPostFX_SetParameter1 + sfPostFX_SetParameter2 + sfPostFX_SetParameter3 + sfPostFX_SetParameter4 + sfPostFX_SetTexture + sfPostFX_CanUsePostFX + sfShape_Create + sfShape_CreateLine + sfShape_CreateRectangle + sfShape_CreateCircle + sfShape_Destroy + sfShape_SetX + sfShape_SetY + sfShape_SetPosition + sfShape_SetScaleX + sfShape_SetScaleY + sfShape_SetScale + sfShape_SetRotation + sfShape_SetCenter + sfShape_SetColor + sfShape_SetBlendMode + sfShape_GetX + sfShape_GetY + sfShape_GetScaleX + sfShape_GetScaleY + sfShape_GetRotation + sfShape_GetCenterX + sfShape_GetCenterY + sfShape_GetColor + sfShape_GetBlendMode + sfShape_Move + sfShape_Scale + sfShape_Rotate + sfShape_TransformToLocal + sfShape_TransformToGlobal + sfShape_AddPoint + sfShape_EnableFill + sfShape_EnableOutline + sfShape_SetOutlineWidth + sfShape_GetOutlineWidth + sfShape_GetNbPoints + sfShape_GetPointPosition + sfShape_GetPointColor + sfShape_GetPointOutlineColor + sfShape_SetPointPosition + sfShape_SetPointColor + sfShape_SetPointOutlineColor + sfSprite_Create + sfSprite_Destroy + sfSprite_SetX + sfSprite_SetY + sfSprite_SetPosition + sfSprite_SetScaleX + sfSprite_SetScaleY + sfSprite_SetScale + sfSprite_SetRotation + sfSprite_SetCenter + sfSprite_SetColor + sfSprite_SetBlendMode + sfSprite_GetX + sfSprite_GetY + sfSprite_GetScaleX + sfSprite_GetScaleY + sfSprite_GetRotation + sfSprite_GetCenterX + sfSprite_GetCenterY + sfSprite_GetColor + sfSprite_GetBlendMode + sfSprite_Move + sfSprite_Scale + sfSprite_Rotate + sfSprite_TransformToLocal + sfSprite_TransformToGlobal + sfSprite_SetImage + sfSprite_SetSubRect + sfSprite_Resize + sfSprite_FlipX + sfSprite_FlipY + sfSprite_GetImage + sfSprite_GetSubRect + sfSprite_GetWidth + sfSprite_GetHeight + sfSprite_GetPixel + sfFont_Create + sfFont_CreateFromFile + sfFont_CreateFromMemory + sfFont_Destroy + sfFont_GetCharacterSize + sfFont_GetDefaultFont + sfString_Create + sfString_Destroy + sfString_SetX + sfString_SetY + sfString_SetPosition + sfString_SetScaleX + sfString_SetScaleY + sfString_SetScale + sfString_SetRotation + sfString_SetCenter + sfString_SetColor + sfString_SetBlendMode + sfString_GetX + sfString_GetY + sfString_GetScaleX + sfString_GetScaleY + sfString_GetRotation + sfString_GetCenterX + sfString_GetCenterY + sfString_GetColor + sfString_GetBlendMode + sfString_Move + sfString_Scale + sfString_Rotate + sfString_TransformToLocal + sfString_TransformToGlobal + sfString_SetText + sfString_SetUnicodeText + sfString_SetFont + sfString_SetSize + sfString_SetStyle + sfString_GetUnicodeText + sfString_GetText + sfString_GetFont + sfString_GetSize + sfString_GetStyle + sfString_GetCharacterPos + sfString_GetRect + sfRenderWindow_Create + sfRenderWindow_CreateFromHandle + sfRenderWindow_Destroy + sfRenderWindow_Close + sfRenderWindow_IsOpened + sfRenderWindow_GetWidth + sfRenderWindow_GetHeight + sfRenderWindow_GetSettings + sfRenderWindow_GetEvent + sfRenderWindow_UseVerticalSync + sfRenderWindow_ShowMouseCursor + sfRenderWindow_SetCursorPosition + sfRenderWindow_SetPosition + sfRenderWindow_SetSize + sfRenderWindow_Show + sfRenderWindow_EnableKeyRepeat + sfRenderWindow_SetIcon + sfRenderWindow_SetActive + sfRenderWindow_Display + sfRenderWindow_GetInput + sfRenderWindow_SetFramerateLimit + sfRenderWindow_GetFrameTime + sfRenderWindow_SetJoystickThreshold + sfRenderWindow_DrawPostFX + sfRenderWindow_DrawSprite + sfRenderWindow_DrawString + sfRenderWindow_DrawShape + sfRenderWindow_Capture + sfRenderWindow_Clear + sfRenderWindow_SetView + sfRenderWindow_GetView + sfRenderWindow_GetDefaultView + sfRenderWindow_ConvertCoords + sfRenderWindow_PreserveOpenGLStates + sfView_Create + sfView_CreateFromRect + sfView_Destroy + sfView_SetCenter + sfView_SetHalfSize + sfView_SetFromRect + sfView_GetCenterX + sfView_GetCenterY + sfView_GetHalfSizeX + sfView_GetHalfSizeY + sfView_GetRect + sfView_Move + sfView_Zoom diff --git a/CSFML/VC2008/csfml-graphics.vcproj b/CSFML/VC2008/csfml-graphics.vcproj new file mode 100644 index 00000000..891c51de --- /dev/null +++ b/CSFML/VC2008/csfml-graphics.vcproj @@ -0,0 +1,445 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2008/csfml-network-d.def b/CSFML/VC2008/csfml-network-d.def new file mode 100644 index 00000000..3235bbf3 --- /dev/null +++ b/CSFML/VC2008/csfml-network-d.def @@ -0,0 +1,125 @@ +LIBRARY csfml-network-d +EXPORTS + sfFtpListingResponse_Destroy + sfFtpListingResponse_IsOk + sfFtpListingResponse_GetStatus + sfFtpListingResponse_GetMessage + sfFtpListingResponse_GetCount + sfFtpListingResponse_GetFilename + sfFtpDirectoryResponse_Destroy + sfFtpDirectoryResponse_IsOk + sfFtpDirectoryResponse_GetStatus + sfFtpDirectoryResponse_GetMessage + sfFtpDirectoryResponse_GetDirectory + sfFtpResponse_Destroy + sfFtpResponse_IsOk + sfFtpResponse_GetStatus + sfFtpResponse_GetMessage + sfFtp_Create + sfFtp_Destroy + sfFtp_Connect + sfFtp_LoginAnonymous + sfFtp_Login + sfFtp_Disconnect + sfFtp_KeepAlive + sfFtp_GetWorkingDirectory + sfFtp_GetDirectoryListing + sfFtp_ChangeDirectory + sfFtp_ParentDirectory + sfFtp_MakeDirectory + sfFtp_DeleteDirectory + sfFtp_RenameFile + sfFtp_DeleteFile + sfFtp_Download + sfFtp_Upload + sfHttpRequest_Create + sfHttpRequest_Destroy + sfHttpRequest_SetField + sfHttpRequest_SetMethod + sfHttpRequest_SetURI + sfHttpRequest_SetHttpVersion + sfHttpRequest_SetBody + sfHttpResponse_Destroy + sfHttpResponse_GetField + sfHttpResponse_GetStatus + sfHttpResponse_GetMajorVersion + sfHttpResponse_GetMinorVersion + sfHttpResponse_GetBody + sfHttp_Create + sfHttp_Destroy + sfHttp_SetHost + sfHttp_SendRequest + sfIPAddress_FromString + sfIPAddress_FromBytes + sfIPAddress_FromInteger + sfIPAddress_IsValid + sfIPAddress_ToString + sfIPAddress_ToInteger + sfIPAddress_GetLocalAddress + sfIPAddress_GetPublicAddress + sfIPAddress_LocalHost + sfSocketTCP_Create + sfSocketTCP_Destroy + sfSocketTCP_SetBlocking + sfSocketTCP_Connect + sfSocketTCP_Listen + sfSocketTCP_Accept + sfSocketTCP_Send + sfSocketTCP_Receive + sfSocketTCP_SendPacket + sfSocketTCP_ReceivePacket + sfSocketTCP_IsValid + sfSocketUDP_Create + sfSocketUDP_Destroy + sfSocketUDP_SetBlocking + sfSocketUDP_Bind + sfSocketUDP_Unbind + sfSocketUDP_Send + sfSocketUDP_Receive + sfSocketUDP_SendPacket + sfSocketUDP_ReceivePacket + sfSocketUDP_IsValid + sfPacket_Create + sfPacket_Destroy + sfPacket_Append + sfPacket_Clear + sfPacket_GetData + sfPacket_GetDataSize + sfPacket_EndOfPacket + sfPacket_CanRead + sfPacket_ReadBool + sfPacket_ReadInt8 + sfPacket_ReadUint8 + sfPacket_ReadInt16 + sfPacket_ReadUint16 + sfPacket_ReadInt32 + sfPacket_ReadUint32 + sfPacket_ReadFloat + sfPacket_ReadDouble + sfPacket_ReadString + sfPacket_ReadWideString + sfPacket_WriteBool + sfPacket_WriteInt8 + sfPacket_WriteUint8 + sfPacket_WriteInt16 + sfPacket_WriteUint16 + sfPacket_WriteInt32 + sfPacket_WriteUint32 + sfPacket_WriteFloat + sfPacket_WriteDouble + sfPacket_WriteString + sfPacket_WriteWideString + sfSelectorTCP_Create + sfSelectorTCP_Destroy + sfSelectorTCP_Add + sfSelectorTCP_Remove + sfSelectorTCP_Clear + sfSelectorTCP_Wait + sfSelectorTCP_GetSocketReady + sfSelectorUDP_Create + sfSelectorUDP_Destroy + sfSelectorUDP_Add + sfSelectorUDP_Remove + sfSelectorUDP_Clear + sfSelectorUDP_Wait + sfSelectorUDP_GetSocketReady diff --git a/CSFML/VC2008/csfml-network.def b/CSFML/VC2008/csfml-network.def new file mode 100644 index 00000000..cdd067d7 --- /dev/null +++ b/CSFML/VC2008/csfml-network.def @@ -0,0 +1,125 @@ +LIBRARY csfml-network +EXPORTS + sfFtpListingResponse_Destroy + sfFtpListingResponse_IsOk + sfFtpListingResponse_GetStatus + sfFtpListingResponse_GetMessage + sfFtpListingResponse_GetCount + sfFtpListingResponse_GetFilename + sfFtpDirectoryResponse_Destroy + sfFtpDirectoryResponse_IsOk + sfFtpDirectoryResponse_GetStatus + sfFtpDirectoryResponse_GetMessage + sfFtpDirectoryResponse_GetDirectory + sfFtpResponse_Destroy + sfFtpResponse_IsOk + sfFtpResponse_GetStatus + sfFtpResponse_GetMessage + sfFtp_Create + sfFtp_Destroy + sfFtp_Connect + sfFtp_LoginAnonymous + sfFtp_Login + sfFtp_Disconnect + sfFtp_KeepAlive + sfFtp_GetWorkingDirectory + sfFtp_GetDirectoryListing + sfFtp_ChangeDirectory + sfFtp_ParentDirectory + sfFtp_MakeDirectory + sfFtp_DeleteDirectory + sfFtp_RenameFile + sfFtp_DeleteFile + sfFtp_Download + sfFtp_Upload + sfHttpRequest_Create + sfHttpRequest_Destroy + sfHttpRequest_SetField + sfHttpRequest_SetMethod + sfHttpRequest_SetURI + sfHttpRequest_SetHttpVersion + sfHttpRequest_SetBody + sfHttpResponse_Destroy + sfHttpResponse_GetField + sfHttpResponse_GetStatus + sfHttpResponse_GetMajorVersion + sfHttpResponse_GetMinorVersion + sfHttpResponse_GetBody + sfHttp_Create + sfHttp_Destroy + sfHttp_SetHost + sfHttp_SendRequest + sfIPAddress_FromString + sfIPAddress_FromBytes + sfIPAddress_FromInteger + sfIPAddress_IsValid + sfIPAddress_ToString + sfIPAddress_ToInteger + sfIPAddress_GetLocalAddress + sfIPAddress_GetPublicAddress + sfIPAddress_LocalHost + sfSocketTCP_Create + sfSocketTCP_Destroy + sfSocketTCP_SetBlocking + sfSocketTCP_Connect + sfSocketTCP_Listen + sfSocketTCP_Accept + sfSocketTCP_Send + sfSocketTCP_Receive + sfSocketTCP_SendPacket + sfSocketTCP_ReceivePacket + sfSocketTCP_IsValid + sfSocketUDP_Create + sfSocketUDP_Destroy + sfSocketUDP_SetBlocking + sfSocketUDP_Bind + sfSocketUDP_Unbind + sfSocketUDP_Send + sfSocketUDP_Receive + sfSocketUDP_SendPacket + sfSocketUDP_ReceivePacket + sfSocketUDP_IsValid + sfPacket_Create + sfPacket_Destroy + sfPacket_Append + sfPacket_Clear + sfPacket_GetData + sfPacket_GetDataSize + sfPacket_EndOfPacket + sfPacket_CanRead + sfPacket_ReadBool + sfPacket_ReadInt8 + sfPacket_ReadUint8 + sfPacket_ReadInt16 + sfPacket_ReadUint16 + sfPacket_ReadInt32 + sfPacket_ReadUint32 + sfPacket_ReadFloat + sfPacket_ReadDouble + sfPacket_ReadString + sfPacket_ReadWideString + sfPacket_WriteBool + sfPacket_WriteInt8 + sfPacket_WriteUint8 + sfPacket_WriteInt16 + sfPacket_WriteUint16 + sfPacket_WriteInt32 + sfPacket_WriteUint32 + sfPacket_WriteFloat + sfPacket_WriteDouble + sfPacket_WriteString + sfPacket_WriteWideString + sfSelectorTCP_Create + sfSelectorTCP_Destroy + sfSelectorTCP_Add + sfSelectorTCP_Remove + sfSelectorTCP_Clear + sfSelectorTCP_Wait + sfSelectorTCP_GetSocketReady + sfSelectorUDP_Create + sfSelectorUDP_Destroy + sfSelectorUDP_Add + sfSelectorUDP_Remove + sfSelectorUDP_Clear + sfSelectorUDP_Wait + sfSelectorUDP_GetSocketReady diff --git a/CSFML/VC2008/csfml-network.vcproj b/CSFML/VC2008/csfml-network.vcproj new file mode 100644 index 00000000..33de31d5 --- /dev/null +++ b/CSFML/VC2008/csfml-network.vcproj @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2008/csfml-system-d.def b/CSFML/VC2008/csfml-system-d.def new file mode 100644 index 00000000..122a804c --- /dev/null +++ b/CSFML/VC2008/csfml-system-d.def @@ -0,0 +1,20 @@ +LIBRARY csfml-system-d +EXPORTS + sfClock_Create + sfClock_Destroy + sfClock_GetTime + sfClock_Reset + sfMutex_Create + sfMutex_Destroy + sfMutex_Lock + sfMutex_Unlock + sfRandom_SetSeed + sfRandom_GetSeed + sfRandom_Float + sfRandom_Int + sfSleep + sfThread_Create + sfThread_Destroy + sfThread_Launch + sfThread_Wait + sfThread_Terminate diff --git a/CSFML/VC2008/csfml-system.def b/CSFML/VC2008/csfml-system.def new file mode 100644 index 00000000..da7c4247 --- /dev/null +++ b/CSFML/VC2008/csfml-system.def @@ -0,0 +1,20 @@ +LIBRARY csfml-system +EXPORTS + sfClock_Create + sfClock_Destroy + sfClock_GetTime + sfClock_Reset + sfMutex_Create + sfMutex_Destroy + sfMutex_Lock + sfMutex_Unlock + sfRandom_SetSeed + sfRandom_GetSeed + sfRandom_Float + sfRandom_Int + sfSleep + sfThread_Create + sfThread_Destroy + sfThread_Launch + sfThread_Wait + sfThread_Terminate diff --git a/CSFML/VC2008/csfml-system.vcproj b/CSFML/VC2008/csfml-system.vcproj new file mode 100644 index 00000000..ab2741fc --- /dev/null +++ b/CSFML/VC2008/csfml-system.vcproj @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/VC2008/csfml-window-d.def b/CSFML/VC2008/csfml-window-d.def new file mode 100644 index 00000000..0003ae98 --- /dev/null +++ b/CSFML/VC2008/csfml-window-d.def @@ -0,0 +1,38 @@ +LIBRARY csfml-window-d +EXPORTS + sfInput_IsKeyDown + sfInput_IsMouseButtonDown + sfInput_IsJoystickButtonDown + sfInput_GetMouseX + sfInput_GetMouseY + sfInput_GetJoystickAxis + sfVideoMode_GetDesktopMode + sfVideoMode_GetMode + sfVideoMode_GetModesCount + sfVideoMode_IsValid + sfWindow_Create + sfWindow_CreateFromHandle + sfWindow_Close + sfWindow_IsOpened + sfWindow_Destroy + sfWindow_GetWidth + sfWindow_GetHeight + sfWindow_GetSettings + sfWindow_GetEvent + sfWindow_UseVerticalSync + sfWindow_ShowMouseCursor + sfWindow_SetCursorPosition + sfWindow_SetPosition + sfWindow_SetSize + sfWindow_Show + sfWindow_EnableKeyRepeat + sfWindow_SetIcon + sfWindow_SetActive + sfWindow_Display + sfWindow_GetInput + sfWindow_SetFramerateLimit + sfWindow_GetFrameTime + sfWindow_SetJoystickThreshold + sfContext_Create + sfContext_Destroy + sfContext_SetActive diff --git a/CSFML/VC2008/csfml-window.def b/CSFML/VC2008/csfml-window.def new file mode 100644 index 00000000..4e1c05c4 --- /dev/null +++ b/CSFML/VC2008/csfml-window.def @@ -0,0 +1,38 @@ +LIBRARY csfml-window +EXPORTS + sfInput_IsKeyDown + sfInput_IsMouseButtonDown + sfInput_IsJoystickButtonDown + sfInput_GetMouseX + sfInput_GetMouseY + sfInput_GetJoystickAxis + sfVideoMode_GetDesktopMode + sfVideoMode_GetMode + sfVideoMode_GetModesCount + sfVideoMode_IsValid + sfWindow_Create + sfWindow_CreateFromHandle + sfWindow_Close + sfWindow_IsOpened + sfWindow_Destroy + sfWindow_GetWidth + sfWindow_GetHeight + sfWindow_GetSettings + sfWindow_GetEvent + sfWindow_UseVerticalSync + sfWindow_ShowMouseCursor + sfWindow_SetCursorPosition + sfWindow_SetPosition + sfWindow_SetSize + sfWindow_Show + sfWindow_EnableKeyRepeat + sfWindow_SetIcon + sfWindow_SetActive + sfWindow_Display + sfWindow_GetInput + sfWindow_SetFramerateLimit + sfWindow_GetFrameTime + sfWindow_SetJoystickThreshold + sfContext_Create + sfContext_Destroy + sfContext_SetActive diff --git a/CSFML/VC2008/csfml-window.vcproj b/CSFML/VC2008/csfml-window.vcproj new file mode 100644 index 00000000..68535ba3 --- /dev/null +++ b/CSFML/VC2008/csfml-window.vcproj @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSFML/codeblocks/CSFML.workspace b/CSFML/codeblocks/CSFML.workspace new file mode 100644 index 00000000..b3f47a2c --- /dev/null +++ b/CSFML/codeblocks/CSFML.workspace @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/CSFML/codeblocks/csfml-audio.cbp b/CSFML/codeblocks/csfml-audio.cbp new file mode 100644 index 00000000..2e5bcde2 --- /dev/null +++ b/CSFML/codeblocks/csfml-audio.cbp @@ -0,0 +1,137 @@ + + + + + + diff --git a/CSFML/codeblocks/csfml-graphics.cbp b/CSFML/codeblocks/csfml-graphics.cbp new file mode 100644 index 00000000..3f2e39ab --- /dev/null +++ b/CSFML/codeblocks/csfml-graphics.cbp @@ -0,0 +1,151 @@ + + + + + + diff --git a/CSFML/codeblocks/csfml-network.cbp b/CSFML/codeblocks/csfml-network.cbp new file mode 100644 index 00000000..c9a0f695 --- /dev/null +++ b/CSFML/codeblocks/csfml-network.cbp @@ -0,0 +1,128 @@ + + + + + + diff --git a/CSFML/codeblocks/csfml-system.cbp b/CSFML/codeblocks/csfml-system.cbp new file mode 100644 index 00000000..d25898c1 --- /dev/null +++ b/CSFML/codeblocks/csfml-system.cbp @@ -0,0 +1,116 @@ + + + + + + diff --git a/CSFML/codeblocks/csfml-window.cbp b/CSFML/codeblocks/csfml-window.cbp new file mode 100644 index 00000000..b6c8a389 --- /dev/null +++ b/CSFML/codeblocks/csfml-window.cbp @@ -0,0 +1,135 @@ + + + + + + diff --git a/CSFML/footer.htm b/CSFML/footer.htm new file mode 100644 index 00000000..a03c90eb --- /dev/null +++ b/CSFML/footer.htm @@ -0,0 +1,8 @@ + + + + + diff --git a/CSFML/header.htm b/CSFML/header.htm new file mode 100644 index 00000000..0ac39bc0 --- /dev/null +++ b/CSFML/header.htm @@ -0,0 +1,12 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + diff --git a/CSFML/include/SFML/Audio.h b/CSFML/include/SFML/Audio.h new file mode 100644 index 00000000..bfa70f4b --- /dev/null +++ b/CSFML/include/SFML/Audio.h @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_H +#define SFML_AUDIO_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_AUDIO_H diff --git a/CSFML/include/SFML/Audio/Listener.h b/CSFML/include/SFML/Audio/Listener.h new file mode 100644 index 00000000..3389a2aa --- /dev/null +++ b/CSFML/include/SFML/Audio/Listener.h @@ -0,0 +1,93 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LISTENER_H +#define SFML_LISTENER_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Change the global volume of all the sounds +/// +/// \param Volume : New global volume, in the range [0, 100] +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfListener_SetGlobalVolume(float Volume); + +//////////////////////////////////////////////////////////// +/// Get the current value of the global volume of all the sounds +/// +/// \return Current global volume, in the range [0, 100] +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfListener_GetGlobalVolume(); + +//////////////////////////////////////////////////////////// +/// Change the position of the listener +/// +/// \param PosX : X position of the listener in the world +/// \param PosY : Y position of the listener in the world +/// \param PosZ : Z position of the listener in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfListener_SetPosition(float PosX, float PosY, float PosZ); + +//////////////////////////////////////////////////////////// +/// Get the current position of the listener +/// +/// \param PosX : X position of the listener in the world +/// \param PosY : Y position of the listener in the world +/// \param PosZ : Z position of the listener in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfListener_GetPosition(float* PosX, float* PosY, float* PosZ); + +//////////////////////////////////////////////////////////// +/// Change the orientation of the listener (the point +/// he must look at) +/// +/// \param TargetX : X position of the point the listener must look at +/// \param TargetY : X position of the point the listener must look at +/// \param TargetZ : X position of the point the listener must look at +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ); + +//////////////////////////////////////////////////////////// +/// Get the current orientation of the listener (the point +/// he's looking at) +/// +/// \param TargetX : X position of the point the listener is looking at +/// \param TargetY : X position of the point the listener is looking at +/// \param TargetZ : X position of the point the listener is looking at +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfListener_GetTarget(float* TargetX, float* TargetY, float* TargetZ); + + +#endif // SFML_LISTENER_H diff --git a/CSFML/include/SFML/Audio/Music.h b/CSFML/include/SFML/Audio/Music.h new file mode 100644 index 00000000..256cfaf8 --- /dev/null +++ b/CSFML/include/SFML/Audio/Music.h @@ -0,0 +1,267 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUSIC_H +#define SFML_MUSIC_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfMusic defines a big sound played using streaming, +/// so usually what we call a music :) +//////////////////////////////////////////////////////////// +typedef struct sfMusic sfMusic; + + +//////////////////////////////////////////////////////////// +/// Create a new music and load it from a file +/// +/// \param Filename : Path of the music file to open +/// +/// \return A new sfMusic object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfMusic* sfMusic_CreateFromFile(const char* Filename); + +//////////////////////////////////////////////////////////// +/// Create a new music and load it from a file in memory +/// +/// \param Data : Pointer to the file data in memory +/// \param SizeInBytes : Size of the data to load, in bytes +/// +/// \return A new sfMusic object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfMusic* sfMusic_CreateFromMemory(const char* Data, size_t SizeInBytes); + +//////////////////////////////////////////////////////////// +/// Destroy an existing music +/// +/// \param Music : Music to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_Destroy(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Set a music loop state +/// +/// \param Music : Music to set the loop state +/// \param Loop : sfTrue to play in loop, sfFalse to play once +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_SetLoop(sfMusic* Music, sfBool Loop); + +//////////////////////////////////////////////////////////// +/// Tell whether or not a music is looping +/// +/// \param Music : Music to get the loop state from +/// +/// \return sfTrue if the music is looping, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfMusic_GetLoop(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get a music duration +/// +/// \param Music : Music to get the duration from +/// +/// \return Music duration, in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfMusic_GetDuration(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Start playing a music +/// +/// \param Music : Music to play +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_Play(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Pause a music +/// +/// \param Music : Music to pause +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_Pause(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Stop playing a music +/// +/// \param Music : Music to stop +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_Stop(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Return the number of channels of a music (1 = mono, 2 = stereo) +/// +/// \param Music : Music to get the channels count from +/// +/// \return Number of channels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfMusic_GetChannelsCount(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get the stream sample rate of a music +/// +/// \param Music : Music to get the sample rate from +/// +/// \return Stream frequency (number of samples per second) +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfMusic_GetSampleRate(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get the status of a music (stopped, paused, playing) +/// +/// \param Music : Music to get the status from +/// +/// \return Current status of the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundStatus sfMusic_GetStatus(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get the current playing position of a music +/// +/// \param Music : Music to get the position from +/// +/// \return Current playing position, expressed in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfMusic_GetPlayingOffset(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Set the pitch of a music +/// +/// \param Music : Music to modify +/// \param Pitch : New pitch +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_SetPitch(sfMusic* Music, float Pitch); + +//////////////////////////////////////////////////////////// +/// Set the volume of a music +/// +/// \param Music : Music to modify +/// \param Volume : Volume (in range [0, 100]) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_SetVolume(sfMusic* Music, float Volume); + +//////////////////////////////////////////////////////////// +/// Set the position of a music +/// +/// \param Music : Music to modify +/// \param X : X position of the sound in the world +/// \param Y : Y position of the sound in the world +/// \param Z : Z position of the sound in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z); + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the music at its maximum volume. +/// The default minimum distance is 1.0 +/// +/// \param Music : Music to modify +/// \param MinDistance : New minimum distance for the music +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_SetMinDistance(sfMusic* Music, float MinDistance); + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound will be attenuated with distance from listener. +/// The default attenuation factor 1.0 +/// +/// \param Sound : Sound to modify +/// \param Attenuation : New attenuation factor for the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_SetAttenuation(sfMusic* Music, float Attenuation); + +//////////////////////////////////////////////////////////// +/// Get the pitch of a music +/// +/// \param Music : Music to get the pitch from +/// +/// \return Pitch value +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfMusic_GetPitch(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get the volume of a music +/// +/// \param Music : Music to get the volume from +/// +/// \return Volume value (in range [1, 100]) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfMusic_GetVolume(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get the position of a music +/// +/// \param Music : Music to get the position from +/// \param X : X position of the sound in the world +/// \param Y : Y position of the sound in the world +/// \param Z : Z position of the sound in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z); + +//////////////////////////////////////////////////////////// +/// Get the minimum distance of a music +/// +/// \param Music : Music to get the minimum distance from +/// +/// \return Minimum distance for the music +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfMusic_GetMinDistance(sfMusic* Music); + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor of a music +/// +/// \param Music : Music to get the attenuation factor from +/// +/// \return Attenuation factor for the a music +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfMusic_GetAttenuation(sfMusic* Music); + + +#endif // SFML_MUSIC_H diff --git a/CSFML/include/SFML/Audio/Sound.h b/CSFML/include/SFML/Audio/Sound.h new file mode 100644 index 00000000..c749b59a --- /dev/null +++ b/CSFML/include/SFML/Audio/Sound.h @@ -0,0 +1,253 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUND_H +#define SFML_SOUND_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfSound defines the properties of the sound such as position, +/// volume, pitch, etc. +//////////////////////////////////////////////////////////// +typedef struct sfSound sfSound; + + +//////////////////////////////////////////////////////////// +/// Construct a new sound +/// +/// \return A new sfSound object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSound* sfSound_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound +/// +/// \param Sound : Sound to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_Destroy(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Start playing a sound +/// +/// \param Sound : Sound to play +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_Play(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Pause a sound +/// +/// \param Sound : Sound to pause +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_Pause(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Stop playing a sound +/// +/// \param Sound : Sound to stop +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_Stop(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Bind a sound buffer to a sound +/// +/// \param Sound : Sound to set the loop state +/// \param Buffer : Buffer to bind +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetBuffer(sfSound* Sound, sfSoundBuffer* Buffer); + +//////////////////////////////////////////////////////////// +/// Get the sound buffer bound to a sound +/// +/// \param Sound : Sound to get the buffer from +/// +/// \return Pointer to the sound's buffer +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundBuffer* sfSound_GetBuffer(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Set a sound loop state +/// +/// \param Sound : Sound to set the loop state +/// \param Loop : sfTrue to play in loop, sfFalse to play once +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetLoop(sfSound* Sound, sfBool Loop); + +//////////////////////////////////////////////////////////// +/// Tell whether or not a sound is looping +/// +/// \param Sound : Sound to get the loop state from +/// +/// \return sfTrue if the sound is looping, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSound_GetLoop(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Get the status of a sound (stopped, paused, playing) +/// +/// \param Sound : Sound to get the status from +/// +/// \return Current status of the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundStatus sfSound_GetStatus(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Set the pitch of a sound +/// +/// \param Sound : Sound to modify +/// \param Pitch : New pitch +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetPitch(sfSound* Sound, float Pitch); + +//////////////////////////////////////////////////////////// +/// Set the volume of a sound +/// +/// \param Sound : Sound to modify +/// \param Volume : Volume (in range [0, 100]) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetVolume(sfSound* Sound, float Volume); + +//////////////////////////////////////////////////////////// +/// Set the position of a sound +/// +/// \param Sound : Sound to modify +/// \param X : X position of the sound in the world +/// \param Y : Y position of the sound in the world +/// \param Z : Z position of the sound in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z); + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the sound at its maximum volume. +/// The default minimum distance is 1.0 +/// +/// \param Sound : Sound to modify +/// \param MinDistance : New minimum distance for the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetMinDistance(sfSound* Sound, float MinDistance); + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound will be attenuated with distance from listener. +/// The default attenuation factor is 1.0 +/// +/// \param Sound : Sound to modify +/// \param Attenuation : New attenuation factor for the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetAttenuation(sfSound* Sound, float Attenuation); + +//////////////////////////////////////////////////////////// +/// Set the current playing position of a sound +/// +/// \param Sound : Sound to modify +/// \param TimeOffset : New playing position, expressed in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_SetPlayingOffset(sfSound* Sound, float TimeOffset); + +//////////////////////////////////////////////////////////// +/// Get the pitch of a sound +/// +/// \param Sound : Sound to get the pitch from +/// +/// \return Pitch value +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSound_GetPitch(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Get the volume of a sound +/// +/// \param Sound : Sound to get the volume from +/// +/// \return Volume value (in range [1, 100]) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSound_GetVolume(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Get the position of a sound +/// +/// \param Sound : Sound to get the position from +/// \param X : X position of the sound in the world +/// \param Y : Y position of the sound in the world +/// \param Z : Z position of the sound in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z); + +//////////////////////////////////////////////////////////// +/// Get the minimum distance of a sound +/// +/// \param Sound : Sound to get the minimum distance from +/// +/// \return Minimum distance for the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSound_GetMinDistance(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor of a sound +/// +/// \param Sound : Sound to get the attenuation factor from +/// +/// \return Attenuation factor for the sound +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSound_GetAttenuation(sfSound* Sound); + +//////////////////////////////////////////////////////////// +/// Get the current playing position of a sound +/// +/// \param Sound : Sound to get the position from +/// +/// \return Current playing position, expressed in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSound_GetPlayingOffset(sfSound* Sound); + + +#endif // SFML_SOUND_H diff --git a/CSFML/include/SFML/Audio/SoundBuffer.h b/CSFML/include/SFML/Audio/SoundBuffer.h new file mode 100644 index 00000000..5c6c1685 --- /dev/null +++ b/CSFML/include/SFML/Audio/SoundBuffer.h @@ -0,0 +1,147 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFER_H +#define SFML_SOUNDBUFFER_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfSoundBuffer is the low-level for loading and manipulating +/// sound buffers +//////////////////////////////////////////////////////////// +typedef struct sfSoundBuffer sfSoundBuffer; + + +//////////////////////////////////////////////////////////// +/// Create a new sound buffer and load it from a file +/// +/// \param Filename : Path of the music file to open +/// +/// \return A new sfSoundBuffer object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* Filename); + +//////////////////////////////////////////////////////////// +/// Create a new sound buffer and load it from a file in memory +/// +/// \param Data : Pointer to the file data in memory +/// \param SizeInBytes : Size of the data to load, in bytes +/// +/// \return A new sfSoundBuffer object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* Data, size_t SizeInBytes); + +//////////////////////////////////////////////////////////// +/// Create a new sound buffer and load it from an array of +/// samples in memory - assumed format for samples is +/// 16 bits signed integer +/// +/// \param Samples : Pointer to the samples in memory +/// \param SamplesCount : Number of samples pointed by Samples +/// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...) +/// \param SampleRate : Frequency (number of samples to play per second) +/// +/// \return A new sfSoundBuffer object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* Samples, size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate); + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound buffer +/// +/// \param SoundBuffer : Sound buffer to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundBuffer_Destroy(sfSoundBuffer* SoundBuffer); + +//////////////////////////////////////////////////////////// +/// Save a sound buffer to a file +/// +/// \param SoundBuffer : Sound buffer to save +/// \param Filename : Path of the sound file to write +/// +/// \return sfTrue if saving has been successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* SoundBuffer, const char* Filename); + +//////////////////////////////////////////////////////////// +/// Return the samples contained in a sound buffer +/// +/// \param SoundBuffer : Sound buffer to get samples from +/// +/// \return Pointer to the array of sound samples, in 16 bits signed integer format +/// +//////////////////////////////////////////////////////////// +CSFML_API const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* SoundBuffer); + +//////////////////////////////////////////////////////////// +/// Return the number of samples contained in a sound buffer +/// +/// \param SoundBuffer : Sound buffer to get samples count from +/// +/// \return Number of samples +/// +//////////////////////////////////////////////////////////// +CSFML_API size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* SoundBuffer); + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound buffer +/// +/// \param SoundBuffer : Sound buffer to get sample rate from +/// +/// \return Sound frequency (number of samples per second) +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* SoundBuffer); + +//////////////////////////////////////////////////////////// +/// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...) +/// +/// \param SoundBuffer : Sound buffer to get channels count from +/// +/// \return Number of channels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* SoundBuffer); + +//////////////////////////////////////////////////////////// +/// Get the duration of a sound buffer +/// +/// \param SoundBuffer : Sound buffer to get duration from +/// +/// \return Sound duration, in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSoundBuffer_GetDuration(sfSoundBuffer* SoundBuffer); + + +#endif // SFML_SOUNDBUFFER_H diff --git a/CSFML/include/SFML/Audio/SoundBufferRecorder.h b/CSFML/include/SFML/Audio/SoundBufferRecorder.h new file mode 100644 index 00000000..ee94e041 --- /dev/null +++ b/CSFML/include/SFML/Audio/SoundBufferRecorder.h @@ -0,0 +1,98 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFERRECORDER_H +#define SFML_SOUNDBUFFERRECORDER_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Specialized sfSoundRecorder which saves the captured +/// audio data into a sound buffer +//////////////////////////////////////////////////////////// +typedef struct sfSoundBufferRecorder sfSoundBufferRecorder; + + +//////////////////////////////////////////////////////////// +/// Construct a new sound buffer recorder +/// +/// \return A new sfSoundBufferRecorder object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundBufferRecorder* sfSoundBufferRecorder_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound buffer recorder +/// +/// \param SoundBufferRecorder : Sound buffer recorder to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* SoundBufferRecorder); + +//////////////////////////////////////////////////////////// +/// Start the capture. +/// Warning : only one capture can happen at the same time +/// +/// \param SoundBufferRecorder : Sound bufferrecorder to start +/// \param SampleRate : Sound frequency (the more samples, the higher the quality) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* SoundBufferRecorder, unsigned int SampleRate); + +//////////////////////////////////////////////////////////// +/// Stop the capture +/// +/// \param SoundBufferRecorder : Sound buffer recorder to stop +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* SoundBufferRecorder); + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound buffer recorder +/// +/// \param SoundBufferRecorder : Sound buffer recorder to get sample rate from +/// +/// \return Frequency, in samples per second +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* SoundBufferRecorder); + +//////////////////////////////////////////////////////////// +/// Get the sound buffer containing the captured audio data +/// of a sound buffer recorder +/// +/// \param SoundBufferRecorder : Sound buffer recorder to get the sound buffer from +/// +/// \return Pointer to the sound buffer (you don't need to destroy it after use) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* SoundBufferRecorder); + + +#endif // SFML_SOUNDBUFFERRECORDER_H diff --git a/CSFML/include/SFML/Audio/SoundRecorder.h b/CSFML/include/SFML/Audio/SoundRecorder.h new file mode 100644 index 00000000..2e62c31e --- /dev/null +++ b/CSFML/include/SFML/Audio/SoundRecorder.h @@ -0,0 +1,108 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDRECORDER_H +#define SFML_SOUNDRECORDER_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfSoundRecorder is an interface for capturing sound data +//////////////////////////////////////////////////////////// +typedef struct sfSoundRecorder sfSoundRecorder; + +typedef sfBool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture +typedef sfBool (*sfSoundRecorderProcessCallback)(const sfInt16*, size_t, void*); ///< Type of the callback used to process audio data +typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture + + +//////////////////////////////////////////////////////////// +/// Construct a new sound recorder with callback functions +/// for processing captured samples +/// +/// \param OnStart : Callback function which will be called when a new capture starts (can be NULL) +/// \param OnProcess : Callback function which will be called each time there's audio data to process +/// \param OnStop : Callback function which will be called when the current capture stops (can be NULL) +/// \param UserData : Data to pass to the callback function (can be NULL) +/// +/// \return A new sfSoundRecorder object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback OnStart, + sfSoundRecorderProcessCallback OnProcess, + sfSoundRecorderStopCallback OnStop, + void* UserData); + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound recorder +/// +/// \param SoundRecorder : Sound recorder to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundRecorder_Destroy(sfSoundRecorder* SoundRecorder); + +//////////////////////////////////////////////////////////// +/// Start the capture. +/// Warning : only one capture can happen at the same time +/// +/// \param SoundRecorder : Sound recorder to start +/// \param SampleRate : Sound frequency (the more samples, the higher the quality) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundRecorder_Start(sfSoundRecorder* SoundRecorder, unsigned int SampleRate); + +//////////////////////////////////////////////////////////// +/// Stop the capture +/// +/// \param SoundRecorder : Sound recorder to stop +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundRecorder_Stop(sfSoundRecorder* SoundRecorder); + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound recorder +/// +/// \param SoundRecorder : Sound recorder to get sample rate from +/// +/// \return Frequency, in samples per second +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* SoundRecorder); + +//////////////////////////////////////////////////////////// +/// Tell if the system supports sound capture. +/// If not, this class won't be usable +/// +/// \return sfTrue if audio capture is supported +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSoundRecorder_CanCapture(); + + +#endif // SFML_SOUNDRECORDER_H diff --git a/CSFML/include/SFML/Audio/SoundStatus.h b/CSFML/include/SFML/Audio/SoundStatus.h new file mode 100644 index 00000000..0bfca191 --- /dev/null +++ b/CSFML/include/SFML/Audio/SoundStatus.h @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSTATUS_H +#define SFML_SOUNDSTATUS_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +typedef enum +{ + sfStopped, ///< Sound / music is not playing + sfPaused, ///< Sound / music is paused + sfPlaying ///< Sound / music is playing +} sfSoundStatus; + + +#endif // SFML_SOUNDSTATUS_H diff --git a/CSFML/include/SFML/Audio/SoundStream.h b/CSFML/include/SFML/Audio/SoundStream.h new file mode 100644 index 00000000..fa3b6163 --- /dev/null +++ b/CSFML/include/SFML/Audio/SoundStream.h @@ -0,0 +1,270 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSTREAM_H +#define SFML_SOUNDSTREAM_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfSoundStream is a streamed sound, ie samples are acquired +/// while the sound is playing. Use it for big sound that would +/// require hundreds of MB in memory (see sfMusic), +/// or for streaming sound from the network +//////////////////////////////////////////////////////////// +typedef struct sfSoundStream sfSoundStream; + +//////////////////////////////////////////////////////////// +/// sfSoundStreamChunk defines the data to fill by the +/// OnGetData callback +//////////////////////////////////////////////////////////// +typedef struct +{ + sfInt16* Samples; ///< Pointer to the audio samples + unsigned int NbSamples; ///< Number of samples pointed by Samples +} sfSoundStreamChunk; + +typedef sfBool (*sfSoundStreamStartCallback)(void*); ///< Type of the callback used to start a sound stream +typedef sfBool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data + + +//////////////////////////////////////////////////////////// +/// Construct a new sound stream +/// +/// \param OnStart : Function called when the stream starts (can be NULL) +/// \param OnGetData : Function called when the stream needs more data (can't be NULL) +/// \param ChannelsCount : Number of channels to use (1 = mono, 2 = stereo) +/// \param SampleRate : Sample rate of the sound (44100 = CD quality) +/// \param UserData : Data to pass to the callback functions +/// +/// \return A new sfSoundStream object (NULL if failed) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundStream* sfSoundStream_Create(sfSoundStreamStartCallback OnStart, + sfSoundStreamGetDataCallback OnGetData, + unsigned int ChannelsCount, + unsigned int SampleRate, + void* UserData); + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound stream +/// +/// \param SoundStream : Sound stream to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_Destroy(sfSoundStream* SoundStreamStream); + +//////////////////////////////////////////////////////////// +/// Start playing a sound stream +/// +/// \param SoundStream : Sound stream to play +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_Play(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Pause a sound stream +/// +/// \param SoundStream : Sound stream to pause +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_Pause(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Stop playing a sound stream +/// +/// \param SoundStream : Sound stream to stop +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_Stop(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Get the status of a sound stream (stopped, paused, playing) +/// +/// \param SoundStream : Sound stream to get the status from +/// +/// \return Current status of the sound stream +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Return the number of channels of a sound stream +/// (1 = mono, 2 = stereo) +/// +/// \param SoundStream : Sound stream to get the channels count from +/// +/// \return Number of channels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound stream +/// +/// \param SoundStream : Sound stream to get the sample rate from +/// +/// \return Stream frequency (number of samples per second) +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSoundStream_GetSampleRate(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Set the pitch of a sound stream +/// +/// \param SoundStream : Sound stream to modify +/// \param Pitch : New pitch +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_SetPitch(sfSoundStream* SoundStream, float Pitch); + +//////////////////////////////////////////////////////////// +/// Set the volume of a sound stream +/// +/// \param SoundStream : Sound stream to modify +/// \param Volume : Volume (in range [0, 100]) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume); + +//////////////////////////////////////////////////////////// +/// Set the position of a sound stream +/// +/// \param SoundStream : Sound stream to modify +/// \param X : X position of the sound stream in the world +/// \param Y : Y position of the sound stream in the world +/// \param Z : Z position of the sound stream in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z); + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the sound stream at its maximum volume. +/// The default minimum distance is 1.0 +/// +/// \param SoundStream : Sound stream to modify +/// \param MinDistance : New minimum distance for the sound stream +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_SetMinDistance(sfSoundStream* SoundStream, float MinDistance); + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound stream will be attenuated with distance from listener. +/// The default attenuation factor 1.0 +/// +/// \param SoundStream : Sound stream to modify +/// \param Attenuation : New attenuation factor for the sound stream +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_SetAttenuation(sfSoundStream* SoundStream, float Attenuation); + +//////////////////////////////////////////////////////////// +/// Set a stream loop state +/// +/// \param SoundStream : Stream to set the loop state +/// \param Loop : sfTrue to play in loop, sfFalse to play once +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_SetLoop(sfSoundStream* SoundStream, sfBool Loop); + +//////////////////////////////////////////////////////////// +/// Get the pitch of a sound stream +/// +/// \param SoundStream : Sound stream to get the pitch from +/// +/// \return Pitch value +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSoundStream_GetPitch(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Get the volume of a sound stream +/// +/// \param SoundStream : Sound stream to get the volume from +/// +/// \return Volume value (in range [1, 100]) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSoundStream_GetVolume(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Get the position of a sound stream +/// +/// \param SoundStream : Sound stream to get the position from +/// \param X : X position of the sound stream in the world +/// \param Y : Y position of the sound stream in the world +/// \param Z : Z position of the sound stream in the world +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z); + +//////////////////////////////////////////////////////////// +/// Get the minimum distance of a sound stream +/// +/// \param SoundStream : Sound stream to get the minimum distance from +/// +/// \return Minimum distance for the sound stream +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSoundStream_GetMinDistance(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor of a sound stream +/// +/// \param SoundStream : Sound stream to get the attenuation factor from +/// +/// \return Attenuation factor for the sound stream +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSoundStream_GetAttenuation(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Tell whether or not a stream is looping +/// +/// \param SoundStream : Soundstream to get the loop state from +/// +/// \return sfTrue if the stream is looping, sfFalse otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSoundStream_GetLoop(sfSoundStream* SoundStream); + +//////////////////////////////////////////////////////////// +/// Get the current playing position of a sound stream +/// +/// \param SoundStream : Sound stream to get the position from +/// +/// \return Current playing position, expressed in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSoundStream_GetPlayingOffset(sfSoundStream* SoundStream); + + +#endif // SFML_SOUNDSTREAM_H diff --git a/CSFML/include/SFML/Config.h b/CSFML/include/SFML/Config.h new file mode 100644 index 00000000..8869d74b --- /dev/null +++ b/CSFML/include/SFML/Config.h @@ -0,0 +1,120 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONFIG_H +#define SFML_CONFIG_H + + +//////////////////////////////////////////////////////////// +// Identify the operating system +//////////////////////////////////////////////////////////// +#if defined(_WIN32) || defined(__WIN32__) + + // Windows + #define CSFML_SYSTEM_WINDOWS + +#elif defined(linux) || defined(__linux) + + // Linux + #define CSFML_SYSTEM_LINUX + +#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) + + // MacOS + #define CSFML_SYSTEM_MACOS + +#else + + // Unsupported system + #error This operating system is not supported by SFML library + +#endif + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#ifdef CSFML_EXPORTS + + #define CSFML_API extern "C" + +#else + + #define CSFML_API extern + +#endif + + +//////////////////////////////////////////////////////////// +// Define a portable boolean type +//////////////////////////////////////////////////////////// +typedef int sfBool; +#define sfFalse 0 +#define sfTrue 1 + + +//////////////////////////////////////////////////////////// +// Define portable types +//////////////////////////////////////////////////////////// +#include +#include + +// 8 bits integer types +#if UCHAR_MAX == 0xFF + typedef signed char sfInt8; + typedef unsigned char sfUint8; +#else + #error No 8 bits integer type for this platform +#endif + +// 16 bits integer types +#if USHRT_MAX == 0xFFFF + typedef signed short sfInt16; + typedef unsigned short sfUint16; +#elif UINT_MAX == 0xFFFF + typedef signed int sfInt16; + typedef unsigned int sfUint16; +#elif ULONG_MAX == 0xFFFF + typedef signed long sfInt16; + typedef unsigned long sfUint16; +#else + #error No 16 bits integer type for this platform +#endif + +// 32 bits integer types +#if USHRT_MAX == 0xFFFFFFFF + typedef signed short sfInt32; + typedef unsigned short sfUint32; +#elif UINT_MAX == 0xFFFFFFFF + typedef signed int sfInt32; + typedef unsigned int sfUint32; +#elif ULONG_MAX == 0xFFFFFFFF + typedef signed long sfInt32; + typedef unsigned long sfUint32; +#else + #error No 32 bits integer type for this platform +#endif + + +#endif // SFML_CONFIG_H diff --git a/CSFML/include/SFML/Graphics.h b/CSFML/include/SFML/Graphics.h new file mode 100644 index 00000000..63afc6f4 --- /dev/null +++ b/CSFML/include/SFML/Graphics.h @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_H +#define SFML_GRAPHICS_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_GRAPHICS_H diff --git a/CSFML/include/SFML/Graphics/BlendMode.h b/CSFML/include/SFML/Graphics/BlendMode.h new file mode 100644 index 00000000..0e6a6590 --- /dev/null +++ b/CSFML/include/SFML/Graphics/BlendMode.h @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_BLENDMODE_H +#define SFML_BLENDMODE_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Enumerate the blending modes for drawable objects +//////////////////////////////////////////////////////////// +typedef enum +{ + sfBlendAlpha, ///< Pixel = Src * a + Dest * (1 - a) + sfBlendAdd, ///< Pixel = Src + Dest + sfBlendMultiply, ///< Pixel = Src * Dest + sfBlendNone ///< No blending +} sfBlendMode; + + +#endif // SFML_BLENDMODE_H diff --git a/CSFML/include/SFML/Graphics/Color.h b/CSFML/include/SFML/Graphics/Color.h new file mode 100644 index 00000000..2f7535fc --- /dev/null +++ b/CSFML/include/SFML/Graphics/Color.h @@ -0,0 +1,107 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_COLOR_H +#define SFML_COLOR_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfColor is an utility class for manipulating colors +//////////////////////////////////////////////////////////// +typedef struct +{ + sfUint8 r; + sfUint8 g; + sfUint8 b; + sfUint8 a; +} sfColor; + + +//////////////////////////////////////////////////////////// +/// Define some common colors +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfBlack; +CSFML_API sfColor sfWhite; +CSFML_API sfColor sfRed; +CSFML_API sfColor sfGreen; +CSFML_API sfColor sfBlue; +CSFML_API sfColor sfYellow; +CSFML_API sfColor sfMagenta; +CSFML_API sfColor sfCyan; + + +//////////////////////////////////////////////////////////// +/// Construct a color from its 3 RGB components +/// +/// \param R : Red component (0 .. 255) +/// \param G : Green component (0 .. 255) +/// \param B : Blue component (0 .. 255) +/// +/// \return sfColor constructed from the components +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfColor_FromRGB(sfUint8 R, sfUint8 G, sfUint8 B); + +//////////////////////////////////////////////////////////// +/// Construct a color from its 4 RGBA components +/// +/// \param R : Red component (0 .. 255) +/// \param G : Green component (0 .. 255) +/// \param B : Blue component (0 .. 255) +/// \param A : Alpha component (0 .. 255) +/// +/// \return sfColor constructed from the components +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfColor_FromRGBA(sfUint8 R, sfUint8 G, sfUint8 B, sfUint8 A); + +//////////////////////////////////////////////////////////// +/// Add two colors +/// +/// \param Color1 : First color +/// \param Color2 : Second color +/// +/// \return Component-wise saturated addition of the two colors +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfColor_Add(sfColor Color1, sfColor Color2); + +//////////////////////////////////////////////////////////// +/// Modulate two colors +/// +/// \param Color1 : First color +/// \param Color2 : Second color +/// +/// \return Component-wise multiplication of the two colors +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfColor_Modulate(sfColor Color1, sfColor Color2); + + +#endif // SFML_COLOR_H diff --git a/CSFML/include/SFML/Graphics/Font.h b/CSFML/include/SFML/Graphics/Font.h new file mode 100644 index 00000000..9235af18 --- /dev/null +++ b/CSFML/include/SFML/Graphics/Font.h @@ -0,0 +1,102 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FONT_H +#define SFML_FONT_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfFont is the low-level class for loading and +/// manipulating character fonts (see sfString) +//////////////////////////////////////////////////////////// +typedef struct sfFont sfFont; + + +//////////////////////////////////////////////////////////// +/// Create a new empty font +/// +/// \return A new sfFont object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFont* sfFont_Create(); + +//////////////////////////////////////////////////////////// +/// Create a new font from a file +/// +/// \param Filename : Path of the font file to load +/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality +/// \param Charset : Characters set to generate (just pass NULL to get the default charset) +/// +/// \return A new sfFont object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFont* sfFont_CreateFromFile(const char* Filename, unsigned int CharSize, const sfUint32* Charset); + +//////////////////////////////////////////////////////////// +/// Create a new image font a file in memory +/// +/// \param Data : Pointer to the file data in memory +/// \param SizeInBytes : Size of the data to load, in bytes +/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality +/// \param Charset : Characters set to generate (just pass NULL to get the default charset) +/// +/// \return A new sfFont object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFont* sfFont_CreateFromMemory(const char* Data, size_t SizeInBytes, unsigned int CharSize, const sfUint32* Charset); + +//////////////////////////////////////////////////////////// +/// Destroy an existing font +/// +/// \param Font : Font to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfFont_Destroy(sfFont* Font); + +//////////////////////////////////////////////////////////// +/// Get the base size of characters in a font; +/// All glyphs dimensions are based on this value +/// +/// \param Font : Font object +/// +/// \return Base size of characters +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfFont_GetCharacterSize(sfFont* Font); + +//////////////////////////////////////////////////////////// +/// Get the built-in default font (Arial) +/// +/// \return Pointer to the default font +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFont* sfFont_GetDefaultFont(); + + +#endif // SFML_IMAGE_H diff --git a/CSFML/include/SFML/Graphics/Glyph.h b/CSFML/include/SFML/Graphics/Glyph.h new file mode 100644 index 00000000..f79dee97 --- /dev/null +++ b/CSFML/include/SFML/Graphics/Glyph.h @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GLYPH_H +#define SFML_GLYPH_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfGlyph describes a glyph (a visual character) +//////////////////////////////////////////////////////////// +typedef struct +{ + int Advance; ///< Offset to move horizontically to the next character + sfIntRect Rectangle; ///< Bounding rectangle of the glyph, in relative coordinates + sfFloatRect TexCoords; ///< Texture coordinates of the glyph inside the bitmap font +} sfGlyph; + + +#endif // SFML_GLYPH_H diff --git a/CSFML/include/SFML/Graphics/Image.h b/CSFML/include/SFML/Graphics/Image.h new file mode 100644 index 00000000..5c96c740 --- /dev/null +++ b/CSFML/include/SFML/Graphics/Image.h @@ -0,0 +1,239 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IMAGE_H +#define SFML_IMAGE_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +typedef struct sfRenderWindow sfRenderWindow; + + +//////////////////////////////////////////////////////////// +/// sfImage is the low-level class for loading and +/// manipulating images +//////////////////////////////////////////////////////////// +typedef struct sfImage sfImage; + + +//////////////////////////////////////////////////////////// +/// Create a new empty image +/// +/// \return A new sfImage object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfImage_Create(); + +//////////////////////////////////////////////////////////// +/// Create a new image filled with a color +/// +/// \param Width : Image width +/// \param Height : Image height +/// \param Col : Image color +/// +/// \return A new sfImage object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfImage_CreateFromColor(unsigned int Width, unsigned int Height, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Create a new image from an array of pixels in memory +/// +/// \param Width : Image width +/// \param Height : Image height +/// \param Data : Pointer to the pixels in memory (assumed format is RGBA) +/// +/// \return A new sfImage object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfImage_CreateFromPixels(unsigned int Width, unsigned int Height, const sfUint8* Data); + +//////////////////////////////////////////////////////////// +/// Create a new image from a file +/// +/// \param Filename : Path of the image file to load +/// +/// \return A new sfImage object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfImage_CreateFromFile(const char* Filename); + +//////////////////////////////////////////////////////////// +/// Create a new image from a file in memory +/// +/// \param Data : Pointer to the file data in memory +/// \param SizeInBytes : Size of the data to load, in bytes +/// +/// \return A new sfImage object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfImage_CreateFromMemory(const char* Data, size_t SizeInBytes); + +//////////////////////////////////////////////////////////// +/// Destroy an existing image +/// +/// \param Image : Image to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfImage_Destroy(sfImage* Image); + +//////////////////////////////////////////////////////////// +/// Save the content of an image to a file +/// +/// \param Image : Image to save +/// \param Filename : Path of the file to save (overwritten if already exist) +/// +/// \return sfTrue if saving was successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfImage_SaveToFile(sfImage* Image, const char* Filename); + +//////////////////////////////////////////////////////////// +/// Create a transparency mask for an image from a specified colorkey +/// +/// \param Image : Image to modify +/// \param ColorKey : Color to become transparent +/// \param Alpha : Alpha value to use for transparent pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfImage_CreateMaskFromColor(sfImage* Image, sfColor ColorKey, sfUint8 Alpha); + +//////////////////////////////////////////////////////////// +/// Copy pixels from another image onto this one. +/// This function does a slow pixel copy and should only +/// be used at initialization time +/// +/// \param Image : Destination image +/// \param Source : Source image to copy +/// \param DestX : X coordinate of the destination position +/// \param DestY : Y coordinate of the destination position +/// \param SourceRect : Sub-rectangle of the source image to copy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfImage_Copy(sfImage* Image, sfImage* Source, unsigned int DestX, unsigned int DestY, sfIntRect SourceRect); + +//////////////////////////////////////////////////////////// +/// Create the image from the current contents of the +/// given window +/// +/// \param Image : Destination image +/// \param Window : Window to capture +/// \param SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image) +/// +/// \return True if creation was successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfImage_CopyScreen(sfImage* Image, sfRenderWindow* Window, sfIntRect SourceRect); + +//////////////////////////////////////////////////////////// +/// Change the color of a pixel of an image +/// Don't forget to call Update when you end modifying pixels +/// +/// \param Image : Image to modify +/// \param X : X coordinate of pixel in the image +/// \param Y : Y coordinate of pixel in the image +/// \param Col : New color for pixel (X, Y) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfImage_SetPixel(sfImage* Image, unsigned int X, unsigned int Y, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Get a pixel from an image +/// +/// \param Image : Image to read +/// \param X : X coordinate of pixel in the image +/// \param Y : Y coordinate of pixel in the image +/// +/// \return Color of pixel (x, y) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfImage_GetPixel(sfImage* Image, unsigned int X, unsigned int Y); + +//////////////////////////////////////////////////////////// +/// Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA) +/// Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4 +/// This pointer becomes invalid if you reload or resize the image +/// +/// \param Image : Image to read +/// +/// \return Pointer to the array of pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API const sfUint8* sfImage_GetPixelsPtr(sfImage* Image); + +//////////////////////////////////////////////////////////// +/// Bind the image for rendering +/// +/// \param Image : Image to bind +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfImage_Bind(sfImage* Image); + +//////////////////////////////////////////////////////////// +/// Enable or disable image smooth filter +/// +/// \param Image : Image to modify +/// \param Smooth : sfTrue to enable smoothing filter, false to disable it +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfImage_SetSmooth(sfImage* Image, sfBool Smooth); + +//////////////////////////////////////////////////////////// +/// Return the width of the image +/// +/// \param Image : Image to read +/// +/// \return Width in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfImage_GetWidth(sfImage* Image); + +//////////////////////////////////////////////////////////// +/// Return the height of the image +/// +/// \param Image : Image to read +/// +/// \return Height in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfImage_GetHeight(sfImage* Image); + +//////////////////////////////////////////////////////////// +/// Tells whether the smoothing filter is enabled or not on an image +/// +/// \param Image : Image to read +/// +/// \return sfTrue if the smoothing filter is enabled +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfImage_IsSmooth(sfImage* Image); + + +#endif // SFML_IMAGE_H diff --git a/CSFML/include/SFML/Graphics/PostFX.h b/CSFML/include/SFML/Graphics/PostFX.h new file mode 100644 index 00000000..53b7d558 --- /dev/null +++ b/CSFML/include/SFML/Graphics/PostFX.h @@ -0,0 +1,128 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_POSTFX_H +#define SFML_POSTFX_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// PostFX is used to apply a post effect to a window +//////////////////////////////////////////////////////////// +typedef struct sfPostFX sfPostFX; + + +//////////////////////////////////////////////////////////// +/// Create a new post-fx from a file +/// +/// \param Filename : File to load +/// +/// \return A new sfPostFX object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfPostFX* sfPostFX_CreateFromFile(const char* Filename); + +//////////////////////////////////////////////////////////// +/// Create a new post-fx from an effect source code +/// +/// \param Effect : Source code of the effect +/// +/// \return A new sfPostFX object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfPostFX* sfPostFX_CreateFromMemory(const char* Effect); + +//////////////////////////////////////////////////////////// +/// Destroy an existing post-fx +/// +/// \param PostFX : PostFX to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPostFX_Destroy(sfPostFX* PostFX); + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (1 float) +/// +/// \param PostFX : Post-effect to modify +/// \param Name : Parameter name in the effect +/// \param X : Value to assign +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPostFX_SetParameter1(sfPostFX* PostFX, const char* Name, float X); + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (2 floats) +/// +/// \param PostFX : Post-effect to modify +/// \param Name : Parameter name in the effect +/// \param X, Y : Values to assign +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPostFX_SetParameter2(sfPostFX* PostFX, const char* Name, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (3 floats) +/// +/// \param PostFX : Post-effect to modify +/// \param Name : Parameter name in the effect +/// \param X, Y, Z : Values to assign +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPostFX_SetParameter3(sfPostFX* PostFX, const char* Name, float X, float Y, float Z); + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (4 floats) +/// +/// \param PostFX : Post-effect to modify +/// \param Name : Parameter name in the effect +/// \param X, Y, Z, W : Values to assign +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPostFX_SetParameter4(sfPostFX* PostFX, const char* Name, float X, float Y, float Z, float W); + +//////////////////////////////////////////////////////////// +/// Set a texture parameter in a post-fx +/// +/// \param PostFX : Post-effect to modify +/// \param Name : Texture name in the effect +/// \param Texture : Image to set (pass NULL to use content of current framebuffer) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPostFX_SetTexture(sfPostFX* PostFX, const char* Name, sfImage* Texture); + +//////////////////////////////////////////////////////////// +/// Tell whether or not the system supports post-effects +/// +/// \return sfTrue if the system can use post-effects +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfPostFX_CanUsePostFX(); + + +#endif // SFML_POSTFX_H diff --git a/CSFML/include/SFML/Graphics/Rect.h b/CSFML/include/SFML/Graphics/Rect.h new file mode 100644 index 00000000..48416a89 --- /dev/null +++ b/CSFML/include/SFML/Graphics/Rect.h @@ -0,0 +1,93 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RECT_H +#define SFML_RECT_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfFloatRect and sfIntRect are utility classes for +/// manipulating rectangles. +//////////////////////////////////////////////////////////// +typedef struct +{ + float Left; + float Top; + float Right; + float Bottom; +} sfFloatRect; + +typedef struct +{ + int Left; + int Top; + int Right; + int Bottom; +} sfIntRect; + + +//////////////////////////////////////////////////////////// +/// Move a rectangle by the given offset +/// +/// \param Rect : Rectangle to move +/// \param OffsetX : Horizontal offset +/// \param OffsetY : Vertical offset +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfFloatRect_Offset(sfFloatRect* Rect, float OffsetX, float OffsetY); +CSFML_API void sfIntRect_Offset(sfIntRect* Rect, int OffsetX, int OffsetY); + +//////////////////////////////////////////////////////////// +/// Check if a point is inside a rectangle's area +/// +/// \param Rect : Rectangle to test +/// \param X : X coordinate of the point to test +/// \param Y : Y coordinate of the point to test +/// +/// \return sfTrue if the point is inside +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfFloatRect_Contains(sfFloatRect* Rect, float X, float Y); +CSFML_API sfBool sfIntRect_Contains(sfIntRect* Rect, int X, int Y); + +//////////////////////////////////////////////////////////// +/// Check intersection between two rectangles +/// +/// \param Rect1 : First rectangle to test +/// \param Rect2 : Second rectangle to test +/// \param OverlappingRect : Rectangle to be filled with overlapping rect (can be NULL) +/// +/// \return sfTrue if rectangles overlap +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfFloatRect_Intersects(sfFloatRect* Rect1, sfFloatRect* Rect2, sfFloatRect* OverlappingRect); +CSFML_API sfBool sfIntRect_Intersects(sfIntRect* Rect1, sfIntRect* Rect2, sfIntRect* OverlappingRect); + + +#endif // SFML_RECT_H diff --git a/CSFML/include/SFML/Graphics/RenderWindow.h b/CSFML/include/SFML/Graphics/RenderWindow.h new file mode 100644 index 00000000..2f97f57f --- /dev/null +++ b/CSFML/include/SFML/Graphics/RenderWindow.h @@ -0,0 +1,365 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERWINDOW_H +#define SFML_RENDERWINDOW_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfRenderWindow is a simple wrapper for sfWindow that +/// allows easy 2D rendering +//////////////////////////////////////////////////////////// +typedef struct sfRenderWindow sfRenderWindow; + + +//////////////////////////////////////////////////////////// +/// Construct a new renderwindow +/// +/// \param Mode : Video mode to use +/// \param Title : Title of the window +/// \param Style : Window style +/// \param Params : Creation settings +/// +//////////////////////////////////////////////////////////// +CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params); + +//////////////////////////////////////////////////////////// +/// Construct a renderwindow from an existing control +/// +/// \param Handle : Platform-specific handle of the control +/// \param Params : Creation settings +/// +//////////////////////////////////////////////////////////// +CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params); + +//////////////////////////////////////////////////////////// +/// Destroy an existing renderwindow +/// +/// \param RenderWindow : Renderwindow to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_Destroy(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Close a renderwindow (but doesn't destroy the internal data) +/// +/// \param RenderWindow : Renderwindow to close +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_Close(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Tell whether or not a renderwindow is opened +/// +/// \param RenderWindow : Renderwindow object +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfRenderWindow_IsOpened(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Get the width of the rendering region of a window +/// +/// \param RenderWindow : Renderwindow object +/// +/// \return Width in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfRenderWindow_GetWidth(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Get the height of the rendering region of a window +/// +/// \param RenderWindow : Renderwindow object +/// +/// \return Height in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfRenderWindow_GetHeight(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Get the creation settings of a window +/// +/// \param RenderWindow : Renderwindow object +/// +/// \return Settings used to create the window +/// +//////////////////////////////////////////////////////////// +CSFML_API sfWindowSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Get the event on top of events stack of a window, if any, and pop it +/// +/// \param RenderWindow : Renderwindow object +/// \param Event : Event to fill, if any +/// +/// \return sfTrue if an event was returned, sfFalse if events stack was empty +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfRenderWindow_GetEvent(sfRenderWindow* RenderWindow, sfEvent* Event); + +//////////////////////////////////////////////////////////// +/// Enable / disable vertical synchronization on a window +/// +/// \param RenderWindow : Renderwindow object +/// \param Enabled : sfTrue to enable v-sync, sfFalse to deactivate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_UseVerticalSync(sfRenderWindow* RenderWindow, sfBool Enabled); + +//////////////////////////////////////////////////////////// +/// Show or hide the mouse cursor on a window +/// +/// \param RenderWindow : RenderWindow object +/// \param Show : sfTrue to show, sfFalse to hide +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_ShowMouseCursor(sfRenderWindow* RenderWindow, sfBool Show); + +//////////////////////////////////////////////////////////// +/// Change the position of the mouse cursor on a window +/// +/// \param RenderWindow : Renderwindow object +/// \param Left : Left coordinate of the cursor, relative to the window +/// \param Top : Top coordinate of the cursor, relative to the window +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetCursorPosition(sfRenderWindow* RenderWindow, unsigned int Left, unsigned int Top); + +//////////////////////////////////////////////////////////// +/// Change the position of a window on screen. +/// Only works for top-level windows +/// +/// \param RenderWindow : Renderwindow object +/// \param Left : Left position +/// \param Top : Top position +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetPosition(sfRenderWindow* RenderWindow, int Left, int Top); + +//////////////////////////////////////////////////////////// +/// Change the size of the rendering region of a window +/// +/// \param RenderWindow : Renderwindow object +/// \param Width : New Width +/// \param Height : New Height +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetSize(sfRenderWindow* RenderWindow, unsigned int Width, unsigned int Height); + +//////////////////////////////////////////////////////////// +/// Show or hide a window +/// +/// \param RenderWindow : Renderwindow object +/// \param State : sfTrue to show, sfFalse to hide +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_Show(sfRenderWindow* RenderWindow, sfBool State); + +//////////////////////////////////////////////////////////// +/// Enable or disable automatic key-repeat for keydown events. +/// Automatic key-repeat is enabled by default +/// +/// \param RenderWindow : Renderwindow object +/// \param Enabled : sfTrue to enable, sfFalse to disable +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_EnableKeyRepeat(sfRenderWindow* RenderWindow, sfBool Enabled); + +//////////////////////////////////////////////////////////// +/// Change the window's icon +/// +/// \param RenderWindow : Renderwindow object +/// \param Width : Icon's width, in pixels +/// \param Height : Icon's height, in pixels +/// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetIcon(sfRenderWindow* RenderWindow, unsigned int Width, unsigned int Height, sfUint8* Pixels); + +//////////////////////////////////////////////////////////// +/// Activate or deactivate a window as the current target for rendering +/// +/// \param RenderWindow : Renderwindow object +/// \param Active : sfTrue to activate, sfFalse to deactivate +/// +/// \return True if operation was successful, false otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfRenderWindow_SetActive(sfRenderWindow* RenderWindow, sfBool Active); + +//////////////////////////////////////////////////////////// +/// Display a window on screen +/// +/// \param RenderWindow : Renderwindow object +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_Display(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Get the input manager of a window +/// +/// \param RenderWindow : Renderwindow object +/// +/// \return Reference to the input +/// +//////////////////////////////////////////////////////////// +CSFML_API sfInput* sfRenderWindow_GetInput(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Limit the framerate to a maximum fixed frequency for a window +/// +/// \param RenderWindow : Renderwindow object +/// +/// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetFramerateLimit(sfRenderWindow* RenderWindow, unsigned int Limit); + +//////////////////////////////////////////////////////////// +/// Get time elapsed since last frame of a window +/// +/// \param RenderWindow : Renderwindow object +/// +/// \return Time elapsed, in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfRenderWindow_GetFrameTime(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Change the joystick threshold, ie. the value below which +/// no move event will be generated +/// +/// \param RenderWindow : Renderwindow object +/// \param Threshold : New threshold, in range [0, 100] +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* RenderWindow, float Threshold); + +//////////////////////////////////////////////////////////// +/// Draw something on a renderwindow +/// +/// \param RenderWindow : Renderwindow to draw in +/// \param PostFX / Sprite / String / shape : Object to draw +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_DrawPostFX(sfRenderWindow* RenderWindow, sfPostFX* PostFX); +CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* RenderWindow, sfSprite* Sprite); +CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* RenderWindow, sfShape* Shape); +CSFML_API void sfRenderWindow_DrawString(sfRenderWindow* RenderWindow, sfString* String); + +//////////////////////////////////////////////////////////// +/// Save the content of a renderwindow to an image +/// +/// \param RenderWindow : Renderwindow to capture +/// +/// \return Image instance containing the contents of the screen +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfRenderWindow_Capture(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Clear the screen with the given color +/// +/// \param RenderWindow : Renderwindow to modify +/// \param Color : Fill color +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_Clear(sfRenderWindow* RenderWindow, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Change the current active view of a renderwindow +/// +/// \param RenderWindow : Renderwindow to modify +/// \param NewView : Pointer to the new view +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_SetView(sfRenderWindow* RenderWindow, sfView* View); + +//////////////////////////////////////////////////////////// +/// Get the current active view of a renderwindow +/// +/// \param RenderWindow : Renderwindow +/// +/// \return Current active view +/// +//////////////////////////////////////////////////////////// +CSFML_API const sfView* sfRenderWindow_GetView(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Get the default view of a renderwindow +/// +/// \param RenderWindow : Renderwindow +/// +/// \return Default view of the render window +/// +//////////////////////////////////////////////////////////// +CSFML_API sfView* sfRenderWindow_GetDefaultView(sfRenderWindow* RenderWindow); + +//////////////////////////////////////////////////////////// +/// Convert a point in window coordinates into view coordinates +/// +/// \param RenderWindow : Target Renderwindow +/// \param WindowX : X coordinate of the point to convert, relative to the window +/// \param WindowY : Y coordinate of the point to convert, relative to the window +/// \param ViewX : Pointer to fill with the X coordinate of the converted point +/// \param ViewY : Pointer to fill with the Y coordinate of the converted point +/// \param TargetView : Target view to convert the point to (pass NULL to use the current view) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_ConvertCoords(sfRenderWindow* RenderWindow, unsigned int WindowX, unsigned int WindowY, float* ViewX, float* ViewY, sfView* TargetView); + +//////////////////////////////////////////////////////////// +/// Tell SFML to preserve external OpenGL states, at the expense of +/// more CPU charge. Use this function if you don't want SFML +/// to mess up your own OpenGL states (if any). +/// Don't enable state preservation if not needed, as it will allow +/// SFML to do internal optimizations and improve performances. +/// This parameter is false by default +/// +/// \param RenderWindow : Target Renderwindow +/// \param Preserve : True to preserve OpenGL states, false to let SFML optimize +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRenderWindow_PreserveOpenGLStates(sfRenderWindow* RenderWindow, sfBool Preserve); + + +#endif // SFML_RENDERWINDOW_H diff --git a/CSFML/include/SFML/Graphics/Shape.h b/CSFML/include/SFML/Graphics/Shape.h new file mode 100644 index 00000000..a71d6852 --- /dev/null +++ b/CSFML/include/SFML/Graphics/Shape.h @@ -0,0 +1,460 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_Shape_H +#define SFML_Shape_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfShape defines a drawable convex Shape ; it also defines +/// helper functions to draw simple Shapes like +/// lines, rectangles, circles, etc. +//////////////////////////////////////////////////////////// +typedef struct sfShape sfShape; + + +//////////////////////////////////////////////////////////// +/// Create a new shape +/// +/// \return A new sfShape object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfShape* sfShape_Create(); + +//////////////////////////////////////////////////////////// +/// Create a new shape made of a single line +/// +/// \param P1X, P1Y : Position of the first point +/// \param P2X, P2Y : Position second point +/// \param Thickness : Line thickness +/// \param Col : Color used to draw the line +/// \param Outline : Outline width +/// \param OutlineCol : Color used to draw the outline +/// +//////////////////////////////////////////////////////////// +CSFML_API sfShape* sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, sfColor Col, float Outline, sfColor OutlineCol); + +//////////////////////////////////////////////////////////// +/// Create a new shape made of a single rectangle +/// +/// \param P1X, P1Y : Position of the first point +/// \param P2X, P2Y : Position second point +/// \param Col : Color used to fill the rectangle +/// \param Outline : Outline width +/// \param OutlineCol : Color used to draw the outline +/// +//////////////////////////////////////////////////////////// +CSFML_API sfShape* sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, sfColor Col, float Outline, sfColor OutlineCol); + +//////////////////////////////////////////////////////////// +/// Create a new shape made of a single circle +/// +/// \param X, Y : Position of the center +/// \param Radius : Radius +/// \param Col : Color used to fill the circle +/// \param Outline : Outline width +/// \param OutlineCol : Color used to draw the outline +/// +//////////////////////////////////////////////////////////// +CSFML_API sfShape* sfShape_CreateCircle(float X, float Y, float Radius, sfColor Col, float Outline, sfColor OutlineCol); + +//////////////////////////////////////////////////////////// +/// Destroy an existing Shape +/// +/// \param Shape : Shape to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_Destroy(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Set the X position of a shape +/// +/// \param Shape : Shape to modify +/// \param X : New X coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetX(sfShape* Shape, float X); + +//////////////////////////////////////////////////////////// +/// Set the Y position of a shape +/// +/// \param Shape : Shape to modify +/// \param Y : New Y coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetY(sfShape* Shape, float Y); + +//////////////////////////////////////////////////////////// +/// Set the position of a shape +/// +/// \param Shape : Shape to modify +/// \param X : New X coordinate +/// \param Y : New Y coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetPosition(sfShape* Shape, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Set the horizontal scale of a shape +/// +/// \param Shape : Shape to modify +/// \param Scale : New scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetScaleX(sfShape* Shape, float Scale); + +//////////////////////////////////////////////////////////// +/// Set the vertical scale of a shape +/// +/// \param Shape : Shape to modify +/// \param Scale : New scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetScaleY(sfShape* Shape, float Scale); + +//////////////////////////////////////////////////////////// +/// Set the scale of a shape +/// +/// \param Shape : Shape to modify +/// \param ScaleX : New horizontal scale (must be strictly positive) +/// \param ScaleY : New vertical scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetScale(sfShape* Shape, float ScaleX, float ScaleY); + +//////////////////////////////////////////////////////////// +/// Set the orientation of a shape +/// +/// \param Shape : Shape to modify +/// \param Rotation : Angle of rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetRotation(sfShape* Shape, float Rotation); + +//////////////////////////////////////////////////////////// +/// Set the center of a shape, in coordinates relative to +/// its left-top corner +/// +/// \param Shape : Shape to modify +/// \param X : X coordinate of the center +/// \param Y : Y coordinate of the center +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetCenter(sfShape* Shape, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Set the color of a shape +/// +/// \param Shape : Shape to modify +/// \param Color : New color +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetColor(sfShape* Shape, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Set the blending mode for a shape +/// +/// \param Shape : Shape to modify +/// \param Mode : New blending mode +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetBlendMode(sfShape* Shape, sfBlendMode Mode); + +//////////////////////////////////////////////////////////// +/// Get the X position of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current X position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetX(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the Y position of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current Y position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetY(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the horizontal scale of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current X scale factor (always positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetScaleX(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the vertical scale of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current Y scale factor (always positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetScaleY(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the orientation of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetRotation(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the X position of the center a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current X center +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetCenterX(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the Y position of the center a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current Y center +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetCenterY(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the color of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current color +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfShape_GetColor(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the current blending mode of a shape +/// +/// \param Shape : Shape to read +/// +/// \return Current blending mode +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBlendMode sfShape_GetBlendMode(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Move a shape +/// +/// \param Shape : Shape to modify +/// \param OffsetX : Offset on the X axis +/// \param OffsetY : Offset on the Y axis +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_Move(sfShape* Shape, float OffsetX, float OffsetY); + +//////////////////////////////////////////////////////////// +/// Scale a shape +/// +/// \param Shape : Shape to modify +/// \param FactorX : Horizontal scaling factor (must be strictly positive) +/// \param FactorY : Vertical scaling factor (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_Scale(sfShape* Shape, float FactorX, float FactorY); + +//////////////////////////////////////////////////////////// +/// Rotate a shape +/// +/// \param Shape : Shape to modify +/// \param Angle : Angle of rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_Rotate(sfShape* Shape, float Angle); + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into the shape's local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +/// +/// \param Shape : Shape object +/// \param PointX : X coordinate of the point to transform +/// \param PointY : Y coordinate of the point to transform +/// \param X : Value to fill with the X coordinate of the converted point +/// \param Y : Value to fill with the y coordinate of the converted point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Transform a point from the shape's local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +/// +/// \param Shape : Shape object +/// \param PointX : X coordinate of the point to transform +/// \param PointY : Y coordinate of the point to transform +/// \param X : Value to fill with the X coordinate of the converted point +/// \param Y : Value to fill with the y coordinate of the converted point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_TransformToGlobal(sfShape* Shape, float PointX, float PointY, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Add a point to a shape +/// +/// \param Shape : Shape to modify +/// \param X, Y : Position of the point +/// \param Col : Color of the point +/// \param OutlineCol : Outline color of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_AddPoint(sfShape* Shape, float X, float Y, sfColor Col, sfColor OutlineCol); + +//////////////////////////////////////////////////////////// +/// Enable or disable filling a shape. +/// Fill is enabled by default +/// +/// \param Enable : True to enable, false to disable +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_EnableFill(sfShape* Shape, sfBool Enable); + +//////////////////////////////////////////////////////////// +/// Enable or disable drawing a shape outline. +/// Outline is enabled by default +/// +/// \param Shape : Shape to modify +/// \param Enable : True to enable, false to disable +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_EnableOutline(sfShape* Shape, sfBool Enable); + +//////////////////////////////////////////////////////////// +/// Change the width of a shape outline +/// +/// \param Shape : Shape to modify +/// \param Width : New width +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetOutlineWidth(sfShape* Shape, float Width); + +//////////////////////////////////////////////////////////// +/// Get the width of a shape outline +/// +/// \param Shape : Shape to read +/// +/// \param return Current outline width +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfShape_GetOutlineWidth(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get the number of points composing a shape +/// +/// \param Shape : Shape to read +/// +/// \return Total number of points +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfShape_GetNbPoints(sfShape* Shape); + +//////////////////////////////////////////////////////////// +/// Get a the position of a shape's point +/// +/// \param Shape : Shape to read +/// \param Index : Index of the point to get +/// \param X : Variable to fill with the X coordinate of the point +/// \param Y : Variable to fill with the Y coordinate of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_GetPointPosition(sfShape* Shape, unsigned int Index, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Get a the color of a shape's point +/// +/// \param Shape : Shape to read +/// \param Index : Index of the point to get +/// +/// \return Color of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfShape_GetPointColor(sfShape* Shape, unsigned int Index); + +//////////////////////////////////////////////////////////// +/// Get a the outline color of a shape's point +/// +/// \param Shape : Shape to read +/// \param Index : Index of the point to get +/// +/// \return Outline color of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfShape_GetPointOutlineColor(sfShape* Shape, unsigned int Index); + +//////////////////////////////////////////////////////////// +/// Set a the position of a shape's point +/// +/// \param Shape : Shape to read +/// \param Index : Index of the point to get +/// \param X : X coordinate of the point +/// \param Y : Y coordinate of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetPointPosition(sfShape* Shape, unsigned int Index, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Set a the color of a shape's point +/// +/// \param Shape : Shape to read +/// \param Index : Index of the point to get +/// \param Color : Color of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetPointColor(sfShape* Shape, unsigned int Index, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Set a the outline color of a shape's point +/// +/// \param Shape : Shape to read +/// \param Index : Index of the point to get +/// \param Color : Outline color of the point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShape_SetPointOutlineColor(sfShape* Shape, unsigned int Index, sfColor Color); + + +#endif // SFML_Shape_H diff --git a/CSFML/include/SFML/Graphics/Sprite.h b/CSFML/include/SFML/Graphics/Sprite.h new file mode 100644 index 00000000..ae0bbfa7 --- /dev/null +++ b/CSFML/include/SFML/Graphics/Sprite.h @@ -0,0 +1,399 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SPRITE_H +#define SFML_SPRITE_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfSprite defines a sprite : texture, transformations, +/// color, and draw on screen +//////////////////////////////////////////////////////////// +typedef struct sfSprite sfSprite; + + +//////////////////////////////////////////////////////////// +/// Create a new sprite +/// +/// \return A new sfSprite object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSprite* sfSprite_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing sprite +/// +/// \param Sprite : Sprite to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_Destroy(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Set the X position of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param X : New X coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetX(sfSprite* Sprite, float X); + +//////////////////////////////////////////////////////////// +/// Set the T position of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Y : New Y coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetY(sfSprite* Sprite, float Y); + +//////////////////////////////////////////////////////////// +/// Set the position of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param X : New X coordinate +/// \param Y : New Y coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetPosition(sfSprite* Sprite, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Set the horizontal scale of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Scale : New scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetScaleX(sfSprite* Sprite, float Scale); + +//////////////////////////////////////////////////////////// +/// Set the vertical scale of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Scale : New scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetScaleY(sfSprite* Sprite, float Scale); + +//////////////////////////////////////////////////////////// +/// Set the scale of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param ScaleX : New horizontal scale (must be strictly positive) +/// \param ScaleY : New vertical scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetScale(sfSprite* Sprite, float ScaleX, float ScaleY); + +//////////////////////////////////////////////////////////// +/// Set the orientation of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Rotation : Angle of rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetRotation(sfSprite* Sprite, float Rotation); + +//////////////////////////////////////////////////////////// +/// Set the center of a sprite, in coordinates relative to +/// its left-top corner +/// +/// \param Sprite : Sprite to modify +/// \param X : X coordinate of the center +/// \param Y : Y coordinate of the center +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetCenter(sfSprite* Sprite, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Set the color of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Color : New color +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetColor(sfSprite* Sprite, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Set the blending mode for a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Mode : New blending mode +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetBlendMode(sfSprite* Sprite, sfBlendMode Mode); + +//////////////////////////////////////////////////////////// +/// Get the X position of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current X position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetX(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the Y position of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current Y position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetY(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the horizontal scale of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current X scale factor (always positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetScaleX(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the vertical scale of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current Y scale factor (always positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetScaleY(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the orientation of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetRotation(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the X position of the center a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current X center +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetCenterX(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the Y position of the center a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current Y center +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetCenterY(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the color of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current color +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfSprite_GetColor(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the current blending mode of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Current blending mode +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBlendMode sfSprite_GetBlendMode(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Move a sprite +/// +/// \param Sprite : Sprite to modify +/// \param OffsetX : Offset on the X axis +/// \param OffsetY : Offset on the Y axis +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_Move(sfSprite* Sprite, float OffsetX, float OffsetY); + +//////////////////////////////////////////////////////////// +/// Scale a sprite +/// +/// \param Sprite : Sprite to modify +/// \param FactorX : Horizontal scaling factor (must be strictly positive) +/// \param FactorY : Vertical scaling factor (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_Scale(sfSprite* Sprite, float FactorX, float FactorY); + +//////////////////////////////////////////////////////////// +/// Rotate a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Angle : Angle of rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_Rotate(sfSprite* Sprite, float Angle); + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into the sprite's local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +/// +/// \param Sprite : Sprite object +/// \param PointX : X coordinate of the point to transform +/// \param PointY : Y coordinate of the point to transform +/// \param X : Value to fill with the X coordinate of the converted point +/// \param Y : Value to fill with the y coordinate of the converted point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Transform a point from the sprite's local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +/// +/// \param Sprite : Sprite object +/// \param PointX : X coordinate of the point to transform +/// \param PointY : Y coordinate of the point to transform +/// \param X : Value to fill with the X coordinate of the converted point +/// \param Y : Value to fill with the y coordinate of the converted point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_TransformToGlobal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Change the image of a sprite +/// +/// \param Sprite : Sprite to modify +/// \param Image : New image +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetImage(sfSprite* Sprite, sfImage* Image); + +//////////////////////////////////////////////////////////// +/// Set the sub-rectangle of a sprite inside the source image +/// +/// \param Sprite : Sprite to modify +/// \param SubRect : New sub-rectangle +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_SetSubRect(sfSprite* Sprite, sfIntRect SubRect); + +//////////////////////////////////////////////////////////// +/// Resize a sprite (by changing its scale factors) +/// +/// \param Sprite : Sprite to modify +/// \param Width : New width (must be strictly positive) +/// \param Height : New height (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_Resize(sfSprite* Sprite, float Width, float Height); + +//////////////////////////////////////////////////////////// +/// Flip a sprite horizontally +/// +/// \param Sprite : Sprite to modify +/// \param Flipped : sfTrue to flip the sprite +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_FlipX(sfSprite* Sprite, sfBool Flipped); + +//////////////////////////////////////////////////////////// +/// Flip a sprite vertically +/// +/// \param Sprite : Sprite to modify +/// \param Flipped : sfTrue to flip the sprite +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSprite_FlipY(sfSprite* Sprite, sfBool Flipped); + +//////////////////////////////////////////////////////////// +/// Get the source image of a sprite +/// +/// \param Sprite : Sprite to read +/// +/// \return Pointer to the image (can be NULL) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfImage* sfSprite_GetImage(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the sub-rectangle of a sprite inside the source image +/// +/// \param Sprite : Sprite to read +/// +/// \return Sub-rectangle +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIntRect sfSprite_GetSubRect(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get a sprite width +/// +/// \param Sprite : Sprite to read +/// +/// \return Width of the sprite +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetWidth(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get a sprite height +/// +/// \param Sprite : Sprite to read +/// +/// \return Height of the sprite +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfSprite_GetHeight(sfSprite* Sprite); + +//////////////////////////////////////////////////////////// +/// Get the color of a given pixel in a sprite +/// +/// \param Sprite : Sprite to read +/// \param X : X coordinate of the pixel to get +/// \param Y : Y coordinate of the pixel to get +/// +/// \return Color of pixel (X, Y) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfSprite_GetPixel(sfSprite* Sprite, unsigned int X, unsigned int Y); + + +#endif // SFML_SPRITE_H diff --git a/CSFML/include/SFML/Graphics/String.h b/CSFML/include/SFML/Graphics/String.h new file mode 100644 index 00000000..41e5a115 --- /dev/null +++ b/CSFML/include/SFML/Graphics/String.h @@ -0,0 +1,430 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_STRING_H +#define SFML_STRING_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfString defines a graphical 2D text, that can be drawn on screen +//////////////////////////////////////////////////////////// +typedef struct sfString sfString; + + +//////////////////////////////////////////////////////////// +/// sfString styles +//////////////////////////////////////////////////////////// +typedef enum +{ + sfStringRegular = 0, ///< Regular characters, no style + sfStringBold = 1 << 0, ///< Characters are bold + sfStringItalic = 1 << 1, ///< Characters are in italic + sfStringUnderlined = 1 << 2 ///< Characters are underlined +} sfStringStyle; + + +//////////////////////////////////////////////////////////// +/// Create a new string +/// +/// \return A new sfString object, or NULL if it failed +/// +//////////////////////////////////////////////////////////// +CSFML_API sfString* sfString_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing string +/// +/// \param String : String to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_Destroy(sfString* String); + +//////////////////////////////////////////////////////////// +/// Set the X position of a string +/// +/// \param String : String to modify +/// \param X : New X coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetX(sfString* String, float X); + +//////////////////////////////////////////////////////////// +/// Set the Y position of a string +/// +/// \param String : String to modify +/// \param Y : New Y coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetY(sfString* String, float Y); + +//////////////////////////////////////////////////////////// +/// Set the position of a string +/// +/// \param String : String to modify +/// \param Left : New left coordinate +/// \param Top : New top coordinate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetPosition(sfString* String, float Left, float Top); + +//////////////////////////////////////////////////////////// +/// Set the horizontal scale of a string +/// +/// \param String : String to modify +/// \param Scale : New scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetScaleX(sfString* String, float Scale); + +//////////////////////////////////////////////////////////// +/// Set the vertical scale of a string +/// +/// \param String : String to modify +/// \param Scale : New scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetScaleY(sfString* String, float Scale); + +//////////////////////////////////////////////////////////// +/// Set the scale of a string +/// +/// \param String : String to modify +/// \param ScaleX : New horizontal scale (must be strictly positive) +/// \param ScaleY : New vertical scale (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetScale(sfString* String, float ScaleX, float ScaleY); + +//////////////////////////////////////////////////////////// +/// Set the orientation of a string +/// +/// \param String : String to modify +/// \param Rotation : Angle of rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetRotation(sfString* String, float Rotation); + +//////////////////////////////////////////////////////////// +/// Set the center of a string, in coordinates +/// relative to its left-top corner +/// +/// \param String : String to modify +/// \param X : X coordinate of the center +/// \param Y : Y coordinate of the center +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetCenter(sfString* String, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Set the color of a string +/// +/// \param String : String to modify +/// \param Color : New color +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetColor(sfString* String, sfColor Color); + +//////////////////////////////////////////////////////////// +/// Set the blending mode for a string +/// +/// \param String : String to modify +/// \param Mode : New blending mode +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetBlendMode(sfString* String, sfBlendMode Mode); + +//////////////////////////////////////////////////////////// +/// Get the X position of a string +/// +/// \param String : String to read +/// +/// \return Current X position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetX(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the top Y of a string +/// +/// \param String : String to read +/// +/// \return Current Y position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetY(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the horizontal scale of a string +/// +/// \param String : String to read +/// +/// \return Current X scale factor (always positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetScaleX(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the vertical scale of a string +/// +/// \param String : String to read +/// +/// \return Current Y scale factor (always positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetScaleY(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the orientation of a string +/// +/// \param String : String to read +/// +/// \return Current rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetRotation(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the X position of the center a string +/// +/// \param String : String to read +/// +/// \return Current X center position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetCenterX(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the top Y of the center of a string +/// +/// \param String : String to read +/// +/// \return Current Y center position +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetCenterY(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the color of a string +/// +/// \param String : String to read +/// +/// \return Current color +/// +//////////////////////////////////////////////////////////// +CSFML_API sfColor sfString_GetColor(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the current blending mode of a string +/// +/// \param String : String to read +/// +/// \return Current blending mode +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBlendMode sfString_GetBlendMode(sfString* String); + +//////////////////////////////////////////////////////////// +/// Move a string +/// +/// \param String : String to modify +/// \param OffsetX : Offset on the X axis +/// \param OffsetY : Offset on the Y axis +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_Move(sfString* String, float OffsetX, float OffsetY); + +//////////////////////////////////////////////////////////// +/// Scale a string +/// +/// \param String : String to modify +/// \param FactorX : Horizontal scaling factor (must be strictly positive) +/// \param FactorY : Vertical scaling factor (must be strictly positive) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_Scale(sfString* String, float FactorX, float FactorY); + +//////////////////////////////////////////////////////////// +/// Rotate a string +/// +/// \param String : String to modify +/// \param Angle : Angle of rotation, in degrees +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_Rotate(sfString* String, float Angle); + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into the string's local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +/// +/// \param String : String object +/// \param PointX : X coordinate of the point to transform +/// \param PointY : Y coordinate of the point to transform +/// \param X : Value to fill with the X coordinate of the converted point +/// \param Y : Value to fill with the y coordinate of the converted point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_TransformToLocal(sfString* String, float PointX, float PointY, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Transform a point from the string's local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +/// +/// \param String : String object +/// \param PointX : X coordinate of the point to transform +/// \param PointY : Y coordinate of the point to transform +/// \param X : Value to fill with the X coordinate of the converted point +/// \param Y : Value to fill with the y coordinate of the converted point +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_TransformToGlobal(sfString* String, float PointX, float PointY, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Set the text of a string (from a multibyte string) +/// +/// \param String : String to modify +/// \param Text : New text +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetText(sfString* String, const char* Text); + +//////////////////////////////////////////////////////////// +/// Set the text of a string (from a unicode string) +/// +/// \param String : String to modify +/// \param Text : New text +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetUnicodeText(sfString* String, const sfUint32* Text); + +//////////////////////////////////////////////////////////// +/// Set the font of a string +/// +/// \param String : String to modify +/// \param Font : Font to use +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetFont(sfString* String, sfFont* Font); + +//////////////////////////////////////////////////////////// +/// Set the size of a string +/// +/// \param String : String to modify +/// \param Size : New size, in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetSize(sfString* String, float Size); + +//////////////////////////////////////////////////////////// +/// Set the style of a string +/// +/// \param String : String to modify +/// \param Size : New style (see sfStringStyle enum) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_SetStyle(sfString* String, unsigned long Style); + +//////////////////////////////////////////////////////////// +/// Get the text of a string (returns a unicode string) +/// +/// \param String : String to read +/// +/// \return Text as UTF-32 +/// +//////////////////////////////////////////////////////////// +CSFML_API const sfUint32* sfString_GetUnicodeText(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the text of a string (returns an ANSI string) +/// +/// \param String : String to read +/// +/// \return Text an a locale-dependant ANSI string +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfString_GetText(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the font used by a string +/// +/// \param String : String to read +/// +/// \return Pointer to the font +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFont* sfString_GetFont(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the size of the characters of a string +/// +/// \param String : String to read +/// +/// \return Size of the characters +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfString_GetSize(sfString* String); + +//////////////////////////////////////////////////////////// +/// Get the style of a string +/// +/// \param String : String to read +/// +/// \return Current string style (see sfStringStyle enum) +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned long sfString_GetStyle(sfString* String); + +//////////////////////////////////////////////////////////// +/// Return the visual position of the Index-th character of the string, +/// in coordinates relative to the string +/// (note : translation, center, rotation and scale are not applied) +/// +/// \param String : String to read +/// \param Index : Index of the character +/// \param X : Value to fill with the X coordinate of the position +/// \param Y : Value to fill with the y coordinate of the position +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfString_GetCharacterPos(sfString* String, size_t Index, float* X, float* Y); + +//////////////////////////////////////////////////////////// +/// Get the bounding rectangle of a string on screen +/// +/// \param String : String to read +/// +/// \return Rectangle contaning the string in screen coordinates +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFloatRect sfString_GetRect(sfString* String); + + +#endif // SFML_STRING_H diff --git a/CSFML/include/SFML/Graphics/View.h b/CSFML/include/SFML/Graphics/View.h new file mode 100644 index 00000000..d648929d --- /dev/null +++ b/CSFML/include/SFML/Graphics/View.h @@ -0,0 +1,163 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIEW_H +#define SFML_VIEW_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// This class defines a view (position, size, etc.) ; +/// you can consider it as a 2D camera +//////////////////////////////////////////////////////////// +typedef struct sfView sfView; + + +//////////////////////////////////////////////////////////// +/// Construct a default view (1000x1000) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfView* sfView_Create(); + +//////////////////////////////////////////////////////////// +/// Construct a view from a rectangle +/// +/// \param Rect : Rectangle defining the bounds of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API sfView* sfView_CreateFromRect(sfFloatRect Rect); + +//////////////////////////////////////////////////////////// +/// Destroy an existing view +/// +/// \param View : View to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfView_Destroy(sfView* View); + +//////////////////////////////////////////////////////////// +/// Change the center of a view +/// +/// \param View : View to modify +/// \param X : X coordinate of the new center +/// \param Y : Y coordinate of the new center +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfView_SetCenter(sfView* View, float X, float Y); + +//////////////////////////////////////////////////////////// +/// Change the half-size of a view +/// +/// \param View : View to modify +/// \param HalfWidth : New half-width +/// \param HalfHeight : New half-height +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfView_SetHalfSize(sfView* View, float HalfWidth, float HalfHeight); + +//////////////////////////////////////////////////////////// +/// Rebuild a view from a rectangle +/// +/// \param View : View to modify +/// \param ViewRect : Rectangle defining the position and size of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfView_SetFromRect(sfView* View, sfFloatRect ViewRect); + +//////////////////////////////////////////////////////////// +/// Get the X coordinate of the center of a view +/// +/// \param View : View to read +/// +/// \return X coordinate of the center of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfView_GetCenterX(sfView* View); + +//////////////////////////////////////////////////////////// +/// Get the Y coordinate of the center of a view +/// +/// \param View : View to read +/// +/// \return Y coordinate of the center of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfView_GetCenterY(sfView* View); + +//////////////////////////////////////////////////////////// +/// Get the half-width of the view +/// +/// \param View : View to read +/// +/// \return Half-width of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfView_GetHalfSizeX(sfView* View); + +//////////////////////////////////////////////////////////// +/// Get the half-height of the view +/// +/// \param View : View to read +/// +/// \return Half-height of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfView_GetHalfSizeY(sfView* View); + +//////////////////////////////////////////////////////////// +/// Get the bounding rectangle of a view +/// +/// \param View : View to read +/// +/// \return Bounding rectangle of the view +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFloatRect sfView_GetRect(sfView* View); + +//////////////////////////////////////////////////////////// +/// Move a view +/// +/// \param View : View to move +/// \param OffsetX : Offset to move the view, on X axis +/// \param OffsetY : Offset to move the view, on Y axis +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfView_Move(sfView* View, float OffsetX, float OffsetY); + +//////////////////////////////////////////////////////////// +/// Resize a view rectangle to simulate a zoom / unzoom effect +/// +/// \param View : View to zoom +/// \param Factor : Zoom factor to apply, relative to the current zoom +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfView_Zoom(sfView* View, float Factor); + + +#endif // SFML_VIEW_H diff --git a/CSFML/include/SFML/Network.h b/CSFML/include/SFML/Network.h new file mode 100644 index 00000000..4a238822 --- /dev/null +++ b/CSFML/include/SFML/Network.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_H +#define SFML_NETWORK_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + + +#endif // SFML_NETWORK_H diff --git a/CSFML/include/SFML/Network/Ftp.h b/CSFML/include/SFML/Network/Ftp.h new file mode 100644 index 00000000..1122e1cb --- /dev/null +++ b/CSFML/include/SFML/Network/Ftp.h @@ -0,0 +1,486 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FTP_H +#define SFML_FTP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Enumerate all the FTP file transfer modes +//////////////////////////////////////////////////////////// +enum sfFtpTransferMode +{ + sfFtpBinary, ///< Binary mode (file is transfered as a sequence of bytes) + sfFtpAscii, ///< Text mode using ASCII encoding + sfFtpEbcdic ///< Text mode using EBCDIC encoding +}; + + +//////////////////////////////////////////////////////////// +/// Enumerate all the valid status codes returned in +/// a FTP response +//////////////////////////////////////////////////////////// +enum sfFtpStatus +{ + // 1xx: the requested action is being initiated, + // expect another reply before proceeding with a new command + sfFtpRestartMarkerReply = 110, ///< Restart marker reply + sfFtpServiceReadySoon = 120, ///< Service ready in N minutes + sfFtpDataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting + sfFtpOpeningDataConnection = 150, ///< File status ok, about to open data connection + + // 2xx: the requested action has been successfully completed + sfFtpOk = 200, ///< Command ok + sfFtpPointlessCommand = 202, ///< Command not implemented + sfFtpSystemStatus = 211, ///< System status, or system help reply + sfFtpDirectoryStatus = 212, ///< Directory status + sfFtpFileStatus = 213, ///< File status + sfFtpHelpMessage = 214, ///< Help message + sfFtpSystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document + sfFtpServiceReady = 220, ///< Service ready for new user + sfFtpClosingConnection = 221, ///< Service closing control connection + sfFtpDataConnectionOpened = 225, ///< Data connection open, no transfer in progress + sfFtpClosingDataConnection = 226, ///< Closing data connection, requested file action successful + sfFtpEnteringPassiveMode = 227, ///< Entering passive mode + sfFtpLoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate + sfFtpFileActionOk = 250, ///< Requested file action ok + sfFtpDirectoryOk = 257, ///< PATHNAME created + + // 3xx: the command has been accepted, but the requested action + // is dormant, pending receipt of further information + sfFtpNeedPassword = 331, ///< User name ok, need password + sfFtpNeedAccountToLogIn = 332, ///< Need account for login + sfFtpNeedInformation = 350, ///< Requested file action pending further information + + // 4xx: the command was not accepted and the requested action did not take place, + // but the error condition is temporary and the action may be requested again + sfFtpServiceUnavailable = 421, ///< Service not available, closing control connection + sfFtpDataConnectionUnavailable = 425, ///< Can't open data connection + sfFtpTransferAborted = 426, ///< Connection closed, transfer aborted + sfFtpFileActionAborted = 450, ///< Requested file action not taken + sfFtpLocalError = 451, ///< Requested action aborted, local error in processing + sfFtpInsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable + + // 5xx: the command was not accepted and + // the requested action did not take place + sfFtpCommandUnknown = 500, ///< Syntax error, command unrecognized + sfFtpParametersUnknown = 501, ///< Syntax error in parameters or arguments + sfFtpCommandNotImplemented = 502, ///< Command not implemented + sfFtpBadCommandSequence = 503, ///< Bad sequence of commands + sfFtpParameterNotImplemented = 504, ///< Command not implemented for that parameter + sfFtpNotLoggedIn = 530, ///< Not logged in + sfFtpNeedAccountToStore = 532, ///< Need account for storing files + sfFtpFileUnavailable = 550, ///< Requested action not taken, file unavailable + sfFtpPageTypeUnknown = 551, ///< Requested action aborted, page type unknown + sfFtpNotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation + sfFtpFilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed + + // 10xx: SFML custom codes + sfFtpInvalidResponse = 1000, ///< Response is not a valid FTP one + sfFtpConnectionFailed = 1001, ///< Connection with server failed + sfFtpConnectionClosed = 1002, ///< Connection with server closed + sfFtpInvalidFile = 1003 ///< Invalid file to upload / download +}; + + +//////////////////////////////////////////////////////////// +/// sfFtpListingResponse wraps a FTP directory listing response, +/// which is basically : +/// - a status code +/// - a message +/// - a list of directory and files +//////////////////////////////////////////////////////////// +typedef struct sfFtpListingResponse sfFtpListingResponse; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp listing response +/// +/// \param FtpResponse : Ftp listing response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfFtpListingResponse_Destroy(sfFtpListingResponse* FtpListingResponse); + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +/// +/// \param FtpListingResponse : Ftp listing response +/// +/// \return sfTrue if status is success (code < 400) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* FtpListingResponse); + +//////////////////////////////////////////////////////////// +/// Get the response status code +/// +/// \param FtpListingResponse : Ftp listing response +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* FtpListingResponse); + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +/// +/// \param FtpListingResponse : Ftp listing response +/// +/// \return The response message +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* FtpListingResponse); + +//////////////////////////////////////////////////////////// +/// Get the number of filenames in the listing +/// +/// \param FtpListingResponse : Ftp listing response +/// +/// \return Total number of filenames +/// +//////////////////////////////////////////////////////////// +CSFML_API size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* FtpListingResponse); + +//////////////////////////////////////////////////////////// +/// Get the Index-th filename in the directory +/// +/// \param FtpListingResponse : Ftp listing response +/// \param Index : Index of the filename to get +/// +/// \return Index-th filename +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* FtpListingResponse, size_t Index); + + +//////////////////////////////////////////////////////////// +/// sfFtpDirectoryResponse wraps a FTP directory response, which is basically : +/// - a status code +/// - a message +/// - a directory name +//////////////////////////////////////////////////////////// +typedef struct sfFtpDirectoryResponse sfFtpDirectoryResponse; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp directory response +/// +/// \param FtpDirectoryResponse : Ftp directory response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* FtpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +/// +/// \param FtpDirectoryResponse : Ftp directory response +/// +/// \return sfTrue if status is success (code < 400) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* FtpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// Get the response status code +/// +/// \param FtpDirectoryResponse : Ftp directory response +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* FtpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +/// +/// \param FtpDirectoryResponse : Ftp directory response +/// +/// \return The response message +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* FtpDirectoryResponse); + +//////////////////////////////////////////////////////////// +/// Get the directory returned in the response +/// +/// \param FtpDirectoryResponse : Ftp directory response +/// +/// \return Directory name +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* FtpDirectoryResponse); + + +//////////////////////////////////////////////////////////// +/// sfFtpResponse wraps a FTP response, which is basically : +/// - a status code +/// - a message +//////////////////////////////////////////////////////////// +typedef struct sfFtpResponse sfFtpResponse; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp response +/// +/// \param FtpResponse : Ftp response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfFtpResponse_Destroy(sfFtpResponse* FtpResponse); + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +/// +/// \param FtpResponse : Ftp response +/// +/// \return sfTrue if status is success (code < 400) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfFtpResponse_IsOk(sfFtpResponse* FtpResponse); + +//////////////////////////////////////////////////////////// +/// Get the response status code +/// +/// \param FtpResponse : Ftp response +/// +/// \return Status code +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* FtpResponse); + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +/// +/// \param FtpResponse : Ftp response +/// +/// \return The response message +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfFtpResponse_GetMessage(sfFtpResponse* FtpResponse); + + +//////////////////////////////////////////////////////////// +/// sfFtp provides methods for manipulating the FTP +/// protocol (described in RFC 959). +/// It provides easy access and transfers to remote +/// directories and files on a FTP server +//////////////////////////////////////////////////////////// +typedef struct sfFtp sfFtp; + + +//////////////////////////////////////////////////////////// +/// Construct a new Ftp +/// +/// \return Pointer to the new Ftp +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtp* sfFtp_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp +/// +/// \param Ftp : Ftp to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfFtp_Destroy(sfFtp* Ftp); + +//////////////////////////////////////////////////////////// +/// Connect to the specified FTP server +/// +/// \param Ftp : Ftp instance +/// \param Server : FTP server to connect to +/// \param Port : Port used for connection (21 by default, standard FTP port) +/// \param Timeout : Maximum time to wait (0 to use no timeout) +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_Connect(sfFtp* Ftp, sfIPAddress Server, unsigned short Port, float Timeout); + +//////////////////////////////////////////////////////////// +/// Log in using anonymous account +/// +/// \param Ftp : Ftp instance +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* Ftp); + +//////////////////////////////////////////////////////////// +/// Log in using a username and a password +/// +/// \param Ftp : Ftp instance +/// \param UserName : User name +/// \param Password : Password +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_Login(sfFtp* Ftp, const char* UserName, const char* Password); + +//////////////////////////////////////////////////////////// +/// Close the connection with FTP server +/// +/// \param Ftp : Ftp instance +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_Disconnect(sfFtp* Ftp); + +//////////////////////////////////////////////////////////// +/// Send a null command just to prevent from being disconnected +/// +/// \param Ftp : Ftp instance +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_KeepAlive(sfFtp* Ftp); + +//////////////////////////////////////////////////////////// +/// Get the current working directory +/// +/// \param Ftp : Ftp instance +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* Ftp); + +//////////////////////////////////////////////////////////// +/// Get the contents of the given directory +/// (subdirectories and files) +/// +/// \param Ftp : Ftp instance +/// \param Directory : Directory to list ("" by default, the current one) +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* Ftp, const char* Directory); + +//////////////////////////////////////////////////////////// +/// Change the current working directory +/// +/// \param Ftp : Ftp instance +/// \param Directory : New directory, relative to the current one +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* Ftp, const char* Directory); + +//////////////////////////////////////////////////////////// +/// Go to the parent directory of the current one +/// +/// \param Ftp : Ftp instance +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_ParentDirectory(sfFtp* Ftp); + +//////////////////////////////////////////////////////////// +/// Create a new directory +/// +/// \param Ftp : Ftp instance +/// \param Name : Name of the directory to create +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_MakeDirectory(sfFtp* Ftp, const char* Name); + +//////////////////////////////////////////////////////////// +/// Remove an existing directory +/// +/// \param Ftp : Ftp instance +/// \param Name : Name of the directory to remove +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* Ftp, const char* Name); + +//////////////////////////////////////////////////////////// +/// Rename a file +/// +/// \param Ftp : Ftp instance +/// \param File : File to rename +/// \param NewName : New name +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_RenameFile(sfFtp* Ftp, const char* File, const char* NewName); + +//////////////////////////////////////////////////////////// +/// Remove an existing file +/// +/// \param Ftp : Ftp instance +/// \param Name : File to remove +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_DeleteFile(sfFtp* Ftp, const char* Name); + +//////////////////////////////////////////////////////////// +/// Download a file from the server +/// +/// \param Ftp : Ftp instance +/// \param DistantFile : Path of the distant file to download +/// \param DestPath : Where to put to file on the local computer +/// \param Mode : Transfer mode (binary by default) +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_Download(sfFtp* Ftp, const char* DistantFile, const char* DestPath, sfFtpTransferMode Mode); + +//////////////////////////////////////////////////////////// +/// Upload a file to the server +/// +/// \param Ftp : Ftp instance +/// \param LocalFile : Path of the local file to upload +/// \param DestPath : Where to put to file on the server +/// \param Mode : Transfer mode (binary by default) +/// +/// \return Server response to the request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfFtpResponse* sfFtp_Upload(sfFtp* Ftp, const char* LocalFile, const char* DestPath, sfFtpTransferMode Mode); + + +#endif // SFML_FTP_H diff --git a/CSFML/include/SFML/Network/Http.h b/CSFML/include/SFML/Network/Http.h new file mode 100644 index 00000000..261b876d --- /dev/null +++ b/CSFML/include/SFML/Network/Http.h @@ -0,0 +1,282 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_HTTP_H +#define SFML_HTTP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Enumerate the available HTTP methods for a request +//////////////////////////////////////////////////////////// +enum sfHttpMethod +{ + sfHttpGet, ///< Request in get mode, standard method to retrieve a page + sfHttpPost, ///< Request in post mode, usually to send data to a page + sfHttpHead ///< Request a page's header only +}; + + +//////////////////////////////////////////////////////////// +/// Enumerate all the valid status codes returned in +/// a HTTP response +//////////////////////////////////////////////////////////// +enum sfHttpStatus +{ + // 2xx: success + sfHttpOk = 200, ///< Most common code returned when operation was successful + sfHttpCreated = 201, ///< The resource has successfully been created + sfHttpAccepted = 202, ///< The request has been accepted, but will be processed later by the server + sfHttpNoContent = 204, ///< Sent when the server didn't send any data in return + + // 3xx: redirection + sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations + sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location + sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location + sfHttpNotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed + + // 4xx: client error + sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error) + sfHttpUnauthorized = 401, ///< The requested page needs an authentification to be accessed + sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentification + sfHttpNotFound = 404, ///< The requested page doesn't exist + + // 5xx: server error + sfHttpInternalServerError = 500, ///< The server encountered an unexpected error + sfHttpNotImplemented = 501, ///< The server doesn't implement a requested feature + sfHttpBadGateway = 502, ///< The gateway server has received an error from the source server + sfHttpServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) + + // 10xx: SFML custom codes + sfHttpInvalidResponse = 1000, ///< Response is not a valid HTTP one + sfHttpConnectionFailed = 1001 ///< Connection with server failed +}; + + +//////////////////////////////////////////////////////////// +/// sfHttpRequest wraps an HTTP request, which is basically : +/// - a header with a method, a target URI, and a set of field/value pairs +/// - an optional body (for POST requests) +//////////////////////////////////////////////////////////// +typedef struct sfHttpRequest sfHttpRequest; + + +//////////////////////////////////////////////////////////// +/// Construct a new Http request +/// +/// \return Pointer to the new Http request +/// +//////////////////////////////////////////////////////////// +CSFML_API sfHttpRequest* sfHttpRequest_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing Http request +/// +/// \param HttpRequest : Http request to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpRequest_Destroy(sfHttpRequest* HttpRequest); + +//////////////////////////////////////////////////////////// +/// Set the value of a field; the field is added if it doesn't exist +/// +/// \param HttpRequest : Http request to modify +/// \param Field : Name of the field to set (case-insensitive) +/// \param Value : Value of the field +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpRequest_SetField(sfHttpRequest* HttpRequest, const char* Field, const char* Value); + +//////////////////////////////////////////////////////////// +/// Set the request method. +/// This parameter is sfHttpGet by default +/// +/// \param HttpRequest : Http request to modify +/// \param RequestMethod : Method to use for the request +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpRequest_SetMethod(sfHttpRequest* HttpRequest, sfHttpMethod Method); + +//////////////////////////////////////////////////////////// +/// Set the target URI of the request. +/// This parameter is "/" by default +/// +/// \param HttpRequest : Http request to modify +/// \param URI : URI to request, local to the host +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpRequest_SetURI(sfHttpRequest* HttpRequest, const char* URI); + +//////////////////////////////////////////////////////////// +/// Set the HTTP version of the request. +/// This parameter is 1.0 by default +/// +/// \param HttpRequest : Http request to modify +/// \param Major : Major version number +/// \param Minor : Minor version number +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpRequest_SetHttpVersion(sfHttpRequest* HttpRequest, unsigned int Major, unsigned int Minor); + +//////////////////////////////////////////////////////////// +/// Set the body of the request. This parameter is optional and +/// makes sense only for POST requests. +/// This parameter is empty by default +/// +/// \param HttpRequest : Http request to modify +/// \param Body : Content of the request body +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpRequest_SetBody(sfHttpRequest* HttpRequest, const char* Body); + + +//////////////////////////////////////////////////////////// +/// sfHttpResponse wraps an HTTP response, which is basically : +/// - a header with a status code and a set of field/value pairs +/// - a body (the content of the requested resource) +//////////////////////////////////////////////////////////// +typedef struct sfHttpResponse sfHttpResponse; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Http response +/// +/// \param HttpResponse : Http response to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttpResponse_Destroy(sfHttpResponse* HttpResponse); + +//////////////////////////////////////////////////////////// +/// Get the value of a field; returns NULL if the field doesn't exist +/// +/// \param HttpResponse : Http response +/// \param Field : Field to get +/// +/// \return Value of the field (NULL if it doesn't exist) +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfHttpResponse_GetField(sfHttpResponse* HttpResponse, const char* Field); + +//////////////////////////////////////////////////////////// +/// Get the status of a response +/// +/// \param HttpResponse : Http response +/// +/// \return Status of the response +/// +//////////////////////////////////////////////////////////// +CSFML_API sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* HttpResponse); + +//////////////////////////////////////////////////////////// +/// Get the major HTTP version of a response +/// +/// \param HttpResponse : Http response +/// +/// \return HTTP major version of the response +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* HttpResponse); + +//////////////////////////////////////////////////////////// +/// Get the minor HTTP version of a response +/// +/// \param HttpResponse : Http response +/// +/// \return HTTP minor version of the response +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpResponse); + +//////////////////////////////////////////////////////////// +/// Get the body of the response. The body can contain : +/// - the requested page (for GET requests) +/// - a response from the server (for POST requests) +/// - nothing (for HEAD requests) +/// - an error message (in case of an error) +/// +/// \param HttpResponse : Http response +/// +/// \return Body of the response (empty string if no body) +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfHttpResponse_GetBody(sfHttpResponse* HttpResponse); + + +//////////////////////////////////////////////////////////// +/// sfHttp provides methods for manipulating the HTTP +/// protocol (described in RFC 1945). +/// It can connect to a website, get its files, send requests, etc. +//////////////////////////////////////////////////////////// +typedef struct sfHttp sfHttp; + + +//////////////////////////////////////////////////////////// +/// Construct a new Http object +/// +/// \return Pointer to the new Http +/// +//////////////////////////////////////////////////////////// +CSFML_API sfHttp* sfHttp_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing Http object +/// +/// \param Http : Http to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttp_Destroy(sfHttp* Http); + +//////////////////////////////////////////////////////////// +/// Set the target host of a Http server +/// +/// \param Http : Http object +/// \param Host : Web server to connect to +/// \param Port : Port to use for connection (0 to use the standard port of the protocol used) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Port); + +//////////////////////////////////////////////////////////// +/// Send a HTTP request and return the server's response. +/// You must be connected to a host before sending requests. +/// Any missing mandatory header field will be added with an appropriate value. +/// Warning : this function waits for the server's response and may +/// not return instantly; use a thread if you don't want to block your +/// application. +/// +/// \param Http : Http object +/// \param Request : Request to send +/// \param Timeout : Maximum time to wait (0 to use no timeout) +/// +/// \return Server's response, or NULL if request is invalid +/// +//////////////////////////////////////////////////////////// +CSFML_API sfHttpResponse* sfHttp_SendRequest(sfHttp* Http, sfHttpRequest* Request, float Timeout); + + +#endif // SFML_HTTP_H diff --git a/CSFML/include/SFML/Network/IPAddress.h b/CSFML/include/SFML/Network/IPAddress.h new file mode 100644 index 00000000..1d9fcca3 --- /dev/null +++ b/CSFML/include/SFML/Network/IPAddress.h @@ -0,0 +1,133 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IPADDRESS_H +#define SFML_IPADDRESS_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfIPAddress provides easy manipulation of IP v4 addresses +//////////////////////////////////////////////////////////// +typedef struct +{ + char Address[16]; +} sfIPAddress; + + +//////////////////////////////////////////////////////////// +/// Construct an address from a string +/// +/// \param String : IP address ("xxx.xxx.xxx.xxx") or network name +/// +/// \return Resulting address +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIPAddress sfIPAddress_FromString(const char* String); + +//////////////////////////////////////////////////////////// +/// Construct an address from 4 bytes +/// +/// \param Byte0 : First byte of the address +/// \param Byte1 : Second byte of the address +/// \param Byte2 : Third byte of the address +/// \param Byte3 : Fourth byte of the address +/// +/// \return Resulting address +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIPAddress sfIPAddress_FromBytes(sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3); + +//////////////////////////////////////////////////////////// +/// Construct the address from a 32-bits integer +/// +/// \param Address : 4 bytes of the address packed into a 32-bits integer +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIPAddress sfIPAddress_FromInteger(sfUint32 Address); + +//////////////////////////////////////////////////////////// +/// Tell if an address is a valid one +/// +/// \param Address : Address to check +/// +/// \return sfTrue if address has a valid syntax +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfIPAddress_IsValid(sfIPAddress Address); + +//////////////////////////////////////////////////////////// +/// Get a string representation of an address +/// +/// \param Address : Address to convert +/// \param String : Char array to fill (size must be >= 16) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfIPAddress_ToString(sfIPAddress Address, char* String); + +//////////////////////////////////////////////////////////// +/// Get an integer representation of the address +/// +/// \param Address : Address to convert +/// +/// \return 32-bits integer containing the 4 bytes of the address, in system endianness +/// +//////////////////////////////////////////////////////////// +CSFML_API sfUint32 sfIPAddress_ToInteger(sfIPAddress Address); + +//////////////////////////////////////////////////////////// +/// Get the computer's local IP address (from the LAN point of view) +/// +/// \return Local IP address +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIPAddress sfIPAddress_GetLocalAddress(); + +//////////////////////////////////////////////////////////// +/// Get the computer's public IP address (from the web point of view). +/// The only way to get a public address is to ask it to a +/// distant website ; as a consequence, this function may be +/// very slow -- use it as few as possible ! +/// +/// \param Timeout : Maximum time to wait, in seconds (use 0 for no timeout) +/// +/// \return Public IP address +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIPAddress sfIPAddress_GetPublicAddress(float Timeout); + +//////////////////////////////////////////////////////////// +/// Get the computer's loopback address +/// +/// \return Local host IP address (127.0.0.1, or "localhost") +/// +//////////////////////////////////////////////////////////// +CSFML_API sfIPAddress sfIPAddress_LocalHost(); + + +#endif // SFML_IPADDRESS_H diff --git a/CSFML/include/SFML/Network/Packet.h b/CSFML/include/SFML/Network/Packet.h new file mode 100644 index 00000000..6d2a9bbd --- /dev/null +++ b/CSFML/include/SFML/Network/Packet.h @@ -0,0 +1,153 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PACKET_H +#define SFML_PACKET_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfPacket wraps data to send / to receive through the network +//////////////////////////////////////////////////////////// +typedef struct sfPacket sfPacket; + + +//////////////////////////////////////////////////////////// +/// Create a new empty packet +/// +/// \return A new sfPacket object +/// +//////////////////////////////////////////////////////////// +CSFML_API sfPacket* sfPacket_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing packet +/// +/// \param Packet : Packet to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPacket_Destroy(sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Append data to the end of a packet +/// +/// \param Packet : Packet to fill +/// \param Data : Pointer to the bytes to append +/// \param SizeInBytes : Number of bytes to append +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPacket_Append(sfPacket* Packet, void* Data, size_t SizeInBytes); + +//////////////////////////////////////////////////////////// +/// Clear all the data of a packet +/// +/// \param Packet : Packet to clear +/// +/////////////////////////////////////////////////////////// +CSFML_API void sfPacket_Clear(sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Get a pointer to the data contained in a packet +/// Warning : the returned pointer may be invalid after you +/// append data to the packet +/// +/// \param Packet : Packet to get data from +/// +/// \return Pointer to the data +/// +//////////////////////////////////////////////////////////// +CSFML_API const char* sfPacket_GetData(sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Get the size of the data contained in a packet +/// +/// \param Packet : Packet to get data size from +/// +/// \return Data size, in bytes +/// +//////////////////////////////////////////////////////////// +CSFML_API size_t sfPacket_GetDataSize(sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Tell if the reading position has reached the end of the packet +/// +/// \param Packet : Packet to check +/// +/// \return sfTrue if all data have been read into the packet +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfPacket_EndOfPacket(sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Return the validity of packet +/// +/// \param Packet : Packet to check +/// +/// \return sfTrue if last data extraction from packet was successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfPacket_CanRead(sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Functions to extract data from a packet +/// +/// \param Packet : Packet to read +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfPacket_ReadBool(sfPacket* Packet); +CSFML_API sfInt8 sfPacket_ReadInt8(sfPacket* Packet); +CSFML_API sfUint8 sfPacket_ReadUint8(sfPacket* Packet); +CSFML_API sfInt16 sfPacket_ReadInt16(sfPacket* Packet); +CSFML_API sfUint16 sfPacket_ReadUint16(sfPacket* Packet); +CSFML_API sfInt32 sfPacket_ReadInt32(sfPacket* Packet); +CSFML_API sfUint32 sfPacket_ReadUint32(sfPacket* Packet); +CSFML_API float sfPacket_ReadFloat(sfPacket* Packet); +CSFML_API double sfPacket_ReadDouble(sfPacket* Packet); +CSFML_API void sfPacket_ReadString(sfPacket* Packet, char* String); +CSFML_API void sfPacket_ReadWideString(sfPacket* Packet, wchar_t* String); + +//////////////////////////////////////////////////////////// +/// Functions to insert data into a packet +/// +/// \param Packet : Packet to write +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfPacket_WriteBool(sfPacket* Packet, sfBool); +CSFML_API void sfPacket_WriteInt8(sfPacket* Packet, sfInt8); +CSFML_API void sfPacket_WriteUint8(sfPacket* Packet, sfUint8); +CSFML_API void sfPacket_WriteInt16(sfPacket* Packet, sfInt16); +CSFML_API void sfPacket_WriteUint16(sfPacket* Packet, sfUint16); +CSFML_API void sfPacket_WriteInt32(sfPacket* Packet, sfInt32); +CSFML_API void sfPacket_WriteUint32(sfPacket* Packet, sfUint32); +CSFML_API void sfPacket_WriteFloat(sfPacket* Packet, float); +CSFML_API void sfPacket_WriteDouble(sfPacket* Packet, double); +CSFML_API void sfPacket_WriteString(sfPacket* Packet, const char* String); +CSFML_API void sfPacket_WriteWideString(sfPacket* Packet, const wchar_t* String); + + +#endif // SFML_PACKET_H diff --git a/CSFML/include/SFML/Network/Selector.h b/CSFML/include/SFML/Network/Selector.h new file mode 100644 index 00000000..7c74e543 --- /dev/null +++ b/CSFML/include/SFML/Network/Selector.h @@ -0,0 +1,120 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SELECTOR_H +#define SFML_SELECTOR_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfSelectorTCP and sfSelectorUDP allow reading from multiple sockets +/// without blocking. It's a kind of multiplexer +//////////////////////////////////////////////////////////// +typedef struct sfSelectorTCP sfSelectorTCP; +typedef struct sfSelectorUDP sfSelectorUDP; + + +//////////////////////////////////////////////////////////// +/// Create a new selector +/// +/// \return A new sfSelector object +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSelectorTCP* sfSelectorTCP_Create(); +CSFML_API sfSelectorUDP* sfSelectorUDP_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing selector +/// +/// \param Selector : Selector to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSelectorTCP_Destroy(sfSelectorTCP* Selector); +CSFML_API void sfSelectorUDP_Destroy(sfSelectorUDP* Selector); + +//////////////////////////////////////////////////////////// +/// Add a socket to watch to a selector +/// +/// \param Selector : Selector to add the socket to +/// \param Socket : Socket to add +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSelectorTCP_Add(sfSelectorTCP* Selector, sfSocketTCP* Socket); +CSFML_API void sfSelectorUDP_Add(sfSelectorUDP* Selector, sfSocketUDP* Socket); + +//////////////////////////////////////////////////////////// +/// Remove a socket from a selector +/// +/// \param Selector : Selector to remove the socket from +/// \param Socket : Socket to remove +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSelectorTCP_Remove(sfSelectorTCP* Selector, sfSocketTCP* Socket); +CSFML_API void sfSelectorUDP_Remove(sfSelectorUDP* Selector, sfSocketUDP* Socket); + +//////////////////////////////////////////////////////////// +/// Remove all sockets from a selector +/// +/// \param Selector : Selector to remove the socket from +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSelectorTCP_Clear(sfSelectorTCP* Selector); +CSFML_API void sfSelectorUDP_Clear(sfSelectorUDP* Selector); + +//////////////////////////////////////////////////////////// +/// Wait and collect sockets which are ready for reading. +/// This functions will return either when at least one socket +/// is ready, or when the given time is out +/// +/// \param Selector : Selector to check +/// \param Timeout : Maximum time to wait, in seconds (0 to disable timeout) +/// +/// \return Number of sockets ready +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfSelectorTCP_Wait(sfSelectorTCP* Selector, float Timeout); +CSFML_API unsigned int sfSelectorUDP_Wait(sfSelectorUDP* Selector, float Timeout); + +//////////////////////////////////////////////////////////// +/// After a call to Wait(), get the Index-th socket which is +/// ready for reading. The total number of sockets ready +/// is the integer returned by the previous call to Wait() +/// +/// \param Selector : Selector to check +/// \param Index : Index of the socket to get +/// +/// \return The Index-th socket +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* Selector, unsigned int Index); +CSFML_API sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* Selector, unsigned int Index); + + +#endif // SFML_SELECTOR_H diff --git a/CSFML/include/SFML/Network/SocketStatus.h b/CSFML/include/SFML/Network/SocketStatus.h new file mode 100644 index 00000000..8ca7a690 --- /dev/null +++ b/CSFML/include/SFML/Network/SocketStatus.h @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETSTATUS_H +#define SFML_SOCKETSTATUS_H + + +//////////////////////////////////////////////////////////// +/// Define the status that can be returned by the socket +/// functions +//////////////////////////////////////////////////////////// +typedef enum +{ + sfSocketDone, + sfSocketNotReady, + sfSocketDisconnected, + sfSocketError + +} sfSocketStatus; + + +#endif // SFML_SOCKETSTATUS_H diff --git a/CSFML/include/SFML/Network/SocketTCP.h b/CSFML/include/SFML/Network/SocketTCP.h new file mode 100644 index 00000000..a0912383 --- /dev/null +++ b/CSFML/include/SFML/Network/SocketTCP.h @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETTCP_H +#define SFML_SOCKETTCP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// SocketTCP wraps a socket using TCP protocol to +/// send data safely (but a bit slower) +//////////////////////////////////////////////////////////// +typedef struct sfSocketTCP sfSocketTCP; + + +//////////////////////////////////////////////////////////// +/// Construct a new TCP socket +/// +/// \return Pointer to the new socket +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketTCP* sfSocketTCP_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing TCP socket +/// +/// \param Socket : Socket to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSocketTCP_Destroy(sfSocketTCP* Socket); + +//////////////////////////////////////////////////////////// +/// Change the blocking state of a TCP socket. +/// The default behaviour of a socket is blocking +/// +/// \param Socket : Socket to modify +/// \param Blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSocketTCP_SetBlocking(sfSocketTCP* Socket, sfBool Blocking); + +//////////////////////////////////////////////////////////// +/// Connect a TCP socket to another computer on a specified port +/// +/// \param Socket : Socket to use for connecting +/// \param Port : Port to use for transfers (warning : ports < 1024 are reserved) +/// \param HostAddress : IP Address of the host to connect to +/// \param Timeout : Maximum time to wait (0 to use no timeout) +/// +/// \return sfTrue if operation has been successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* Socket, unsigned short Port, sfIPAddress HostAddress, float Timeout); + +//////////////////////////////////////////////////////////// +/// Listen to a specified port for incoming data or connections +/// +/// \param Socket : Socket to use for listening +/// \param Port : Port to listen to +/// +/// \return sfTrue if operation has been successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSocketTCP_Listen(sfSocketTCP* Socket, unsigned short Port); + +//////////////////////////////////////////////////////////// +/// Wait for a connection (must be listening to a port). +/// This function is blocking, ie. it won't return before +/// a connection has been accepted +/// +/// \param Socket : Socket to use for accepting +/// \param Connected : Pointer to a socket pointer that will be filled with the connected client +/// \param Address : Pointer to an address to fill with client infos +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* Socket, sfSocketTCP** Connected, sfIPAddress* Address); + +//////////////////////////////////////////////////////////// +/// Send an array of bytes to the host (must be connected first) +/// +/// \param Socket : Socket to use for sending +/// \param Data : Pointer to the bytes to send +/// \param Size : Number of bytes to send +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketTCP_Send(sfSocketTCP* Socket, const char* Data, size_t Size); + +//////////////////////////////////////////////////////////// +/// Receive an array of bytes from the host (must be connected first) +/// +/// \param Socket : Socket to use for receiving +/// \param Data : Pointer to a byte array to fill (make sure it is big enough) +/// \param MaxSize : Maximum number of bytes to read +/// \param SizeReceived : Number of bytes received +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived); + +//////////////////////////////////////////////////////////// +/// Send a packet of data to the host (must be connected first) +/// +/// \param Socket : Socket to use for sending +/// \param Packet : Packet to send +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* Socket, sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Receive a packet from the host (must be connected first) +/// +/// \param Socket : Socket to use for receiving +/// \param Packet : Packet to fill with received data +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* Socket, sfPacket* Packet); + +//////////////////////////////////////////////////////////// +/// Check if a socket is in a valid state ; this function +/// can be called any time to check if the socket is OK +/// +/// \param Socket : Socket to check +/// +/// \return True if the socket is valid +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSocketTCP_IsValid(sfSocketTCP* Socket); + + +#endif // SFML_SOCKETTCP_H diff --git a/CSFML/include/SFML/Network/SocketUDP.h b/CSFML/include/SFML/Network/SocketUDP.h new file mode 100644 index 00000000..a43f87fd --- /dev/null +++ b/CSFML/include/SFML/Network/SocketUDP.h @@ -0,0 +1,162 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETUDP_H +#define SFML_SOCKETUDP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfSocketUDP wraps a socket using UDP protocol to +/// send data fastly (but with less safety) +//////////////////////////////////////////////////////////// +typedef struct sfSocketUDP sfSocketUDP; + + +//////////////////////////////////////////////////////////// +/// Construct a new UDP socket +/// +/// \return Pointer to the new socket +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketUDP* sfSocketUDP_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing UDP socket +/// +/// \param Socket : Socket to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSocketUDP_Destroy(sfSocketUDP* Socket); + +//////////////////////////////////////////////////////////// +/// Change the blocking state of a UDP socket. +/// The default behaviour of a socket is blocking +/// +/// \param Socket : Socket to modify +/// \param Blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSocketUDP_SetBlocking(sfSocketUDP* Socket, sfBool Blocking); + +//////////////////////////////////////////////////////////// +/// Bind a socket to a specific port +/// +/// \param Socket : Socket to bind +/// \param Port : Port to bind the socket to +/// +/// \return True if operation has been successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSocketUDP_Bind(sfSocketUDP* Socket, unsigned short Port); + +//////////////////////////////////////////////////////////// +/// Unbind a socket from its previous port, if any +/// +/// \param Socket : Socket to unbind +/// +/// \return sfTrue if operation has been successful +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSocketUDP_Unbind(sfSocketUDP* Socket); + +//////////////////////////////////////////////////////////// +/// Send an array of bytes +/// +/// \param Socket : Socket to use for sending +/// \param Data : Pointer to the bytes to send +/// \param Size : Number of bytes to send +/// \param Address : Address of the computer to send the packet to +/// \param Port : Port to use for communication +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketUDP_Send(sfSocketUDP* Socket, const char* Data, size_t Size, sfIPAddress Address, unsigned short Port); + +//////////////////////////////////////////////////////////// +/// Receive an array of bytes. +/// This function is blocking, ie. it won't return before some +/// bytes have been received +/// +/// \param Socket : Socket to use for receiving +/// \param Data : Pointer to a byte array to fill (make sure it is big enough) +/// \param MaxSize : Maximum number of bytes to read +/// \param SizeReceived : Number of bytes received +/// \param Address : Address of the computer which sent the data +/// \param Port : Port on which the remote computer sent the data +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived, sfIPAddress* Address, unsigned short* Port); + +//////////////////////////////////////////////////////////// +/// Send a packet of data +/// +/// \param Socket : Socket to use for sending +/// \param Packet : Packet to send +/// \param Address : Address of the computer to send the packet to +/// \param Port : Port to use for communication +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress Address, unsigned short Port); + +//////////////////////////////////////////////////////////// +/// Receive a packet. +/// This function is blocking, ie. it won't return before a +/// packet is received +/// +/// \param Socket : Socket to use for receiving +/// \param Packet : Packet to fill with received data +/// \param Address : Address of the computer which sent the packet +/// \param Port : Port on which the remote computer sent the data +/// +/// \return Socket status +/// +//////////////////////////////////////////////////////////// +CSFML_API sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress* Address, unsigned short* Port); + +//////////////////////////////////////////////////////////// +/// Check if a socket is in a valid state ; this function +/// can be called any time to check if the socket is OK +/// +/// \param Socket : Socket to check +/// +/// \return sfTrue if the socket is valid +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfSocketUDP_IsValid(sfSocketUDP* Socket); + + +#endif // SFML_SOCKETUDP_H diff --git a/CSFML/include/SFML/System.h b/CSFML/include/SFML/System.h new file mode 100644 index 00000000..dcc87a01 --- /dev/null +++ b/CSFML/include/SFML/System.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_H +#define SFML_SYSTEM_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + + +#endif // SFML_SYSTEM_H diff --git a/CSFML/include/SFML/System/Clock.h b/CSFML/include/SFML/System/Clock.h new file mode 100644 index 00000000..dee4f06f --- /dev/null +++ b/CSFML/include/SFML/System/Clock.h @@ -0,0 +1,72 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CLOCK_H +#define SFML_CLOCK_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfClock is an utility structure for manipulating time +//////////////////////////////////////////////////////////// +typedef struct sfClock sfClock; + +//////////////////////////////////////////////////////////// +/// Create a new clock and start it +/// +/// \return A new sfClock object +/// +//////////////////////////////////////////////////////////// +CSFML_API sfClock* sfClock_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing clock +/// +/// \param Clock : Clock to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfClock_Destroy(sfClock* Clock); + +//////////////////////////////////////////////////////////// +/// Get the time elapsed for a clock +/// +/// \param Clock : Clock to get time from +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfClock_GetTime(sfClock* Clock); + +//////////////////////////////////////////////////////////// +/// Restart a clock +/// +/// \param Clock : Clock to restart +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfClock_Reset(sfClock* Clock); + + +#endif // SFML_CLOCK_H diff --git a/CSFML/include/SFML/System/Mutex.h b/CSFML/include/SFML/System/Mutex.h new file mode 100644 index 00000000..9aaddb6c --- /dev/null +++ b/CSFML/include/SFML/System/Mutex.h @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUTEX_H +#define SFML_MUTEX_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfMutex defines a mutex (MUTual EXclusion) object, +/// that allows a thread to lock critical instructions +/// to avoid simultaneous access with other threads. +//////////////////////////////////////////////////////////// +typedef struct sfMutex sfMutex; + +//////////////////////////////////////////////////////////// +/// Create a new mutex +/// +/// \return A new sfMutex object +/// +//////////////////////////////////////////////////////////// +CSFML_API sfMutex* sfMutex_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing mutex +/// +/// \param Mutex : Mutex to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMutex_Destroy(sfMutex* Mutex); + +//////////////////////////////////////////////////////////// +/// Lock a mutex +/// +/// \param Mutex : Mutex to lock +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMutex_Lock(sfMutex* Mutex); + +//////////////////////////////////////////////////////////// +/// Unlock a mutex +/// +/// \param Mutex : Mutex to unlock +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfMutex_Unlock(sfMutex* Mutex); + + +#endif // SFML_MUTEX_H diff --git a/CSFML/include/SFML/System/Randomizer.h b/CSFML/include/SFML/System/Randomizer.h new file mode 100644 index 00000000..652b8245 --- /dev/null +++ b/CSFML/include/SFML/System/Randomizer.h @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RANDOMIZER_H +#define SFML_RANDOMIZER_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Set the seed for the random numbers generator. Using a known seed +/// allows you to reproduce the same sequence of random numbers +/// +/// \param Seed : Number to use as the seed +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfRandom_SetSeed(unsigned int Seed); + +//////////////////////////////////////////////////////////// +/// Get the seed used to generate random numbers the generator +/// +/// \return Current seed +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfRandom_GetSeed(); + +//////////////////////////////////////////////////////////// +/// Get a random float number in a given range +/// +/// \return Start : Start of the range +/// \return End : End of the range +/// +/// \return Random number in [Begin, End] +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfRandom_Float(float Begin, float End); + +//////////////////////////////////////////////////////////// +/// Get a random integer number in a given range +/// +/// \return Start : Start of the range +/// \return End : End of the range +/// +/// \return Random number in [Begin, End] +/// +//////////////////////////////////////////////////////////// +CSFML_API int sfRandom_Int(int Begin, int End); + + +#endif // SFML_RANDOMIZER_H diff --git a/CSFML/include/SFML/System/Sleep.h b/CSFML/include/SFML/System/Sleep.h new file mode 100644 index 00000000..d106c432 --- /dev/null +++ b/CSFML/include/SFML/System/Sleep.h @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SLEEP_H +#define SFML_SLEEP_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Make the current thread sleep for a given time +/// +/// \param Duration : Time to sleep, in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfSleep(float Duration); + + +#endif // SFML_SLEEP_H diff --git a/CSFML/include/SFML/System/Thread.h b/CSFML/include/SFML/System/Thread.h new file mode 100644 index 00000000..ee765686 --- /dev/null +++ b/CSFML/include/SFML/System/Thread.h @@ -0,0 +1,85 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREAD_H +#define SFML_THREAD_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfThread defines an easy way to manipulate a thread +//////////////////////////////////////////////////////////// +typedef struct sfThread sfThread; + + +//////////////////////////////////////////////////////////// +/// Construct a new thread from a function pointer +/// +/// \param Function : Entry point of the thread +/// \param UserData : Data to pass to the thread function +/// +//////////////////////////////////////////////////////////// +CSFML_API sfThread* sfThread_Create(void (*Function)(void*), void* UserData); + +//////////////////////////////////////////////////////////// +/// Destroy an existing thread +/// +/// \param Thread : Thread to delete +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfThread_Destroy(sfThread* Thread); + +//////////////////////////////////////////////////////////// +/// Run a thread +/// +/// \param Thread : Thread to launch +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfThread_Launch(sfThread* Thread); + +//////////////////////////////////////////////////////////// +/// Wait until a thread finishes +/// +/// \param Thread : Thread to wait for +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfThread_Wait(sfThread* Thread); + +//////////////////////////////////////////////////////////// +/// Terminate a thread +/// Terminating a thread with this function is not safe, +/// you should rather try to make the thread function +/// terminate by itself +/// +/// \param Thread : Thread to terminate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfThread_Terminate(sfThread* Thread); + + +#endif // SFML_THREAD_H diff --git a/CSFML/include/SFML/Window.h b/CSFML/include/SFML/Window.h new file mode 100644 index 00000000..d989cddf --- /dev/null +++ b/CSFML/include/SFML/Window.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SFML_WINDOW_H +#define SFML_SFML_WINDOW_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + + +#endif // SFML_SFML_WINDOW_H diff --git a/CSFML/include/SFML/Window/Context.h b/CSFML/include/SFML/Window/Context.h new file mode 100644 index 00000000..52f22889 --- /dev/null +++ b/CSFML/include/SFML/Window/Context.h @@ -0,0 +1,68 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONTEXT_H +#define SFML_CONTEXT_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Class wrapping an OpenGL context with no window. +/// This class is for internal use mainly, it is required +/// to solve tricky problems involving multi-threading +//////////////////////////////////////////////////////////// +typedef struct sfContext sfContext; + + +//////////////////////////////////////////////////////////// +/// Construct a new context +/// +/// \return New context +/// +//////////////////////////////////////////////////////////// +CSFML_API sfContext* sfContext_Create(); + +//////////////////////////////////////////////////////////// +/// Destroy an existing context +/// +/// \param Context : Context to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfContext_Destroy(sfContext* Context); + +//////////////////////////////////////////////////////////// +/// Activate or deactivate a context +/// +/// \param Context : Context to activate or deactivate +/// \param Active : sfTrue to activate, sfFalse to deactivate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfContext_SetActive(sfContext* Context, sfBool Active); + + +#endif // SFML_CONTEXT_H diff --git a/CSFML/include/SFML/Window/Event.h b/CSFML/include/SFML/Window/Event.h new file mode 100644 index 00000000..222e650f --- /dev/null +++ b/CSFML/include/SFML/Window/Event.h @@ -0,0 +1,300 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_EVENT_H +#define SFML_EVENT_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Definition of key codes for keyboard events +//////////////////////////////////////////////////////////// +typedef enum +{ + sfKeyA = 'a', + sfKeyB = 'b', + sfKeyC = 'c', + sfKeyD = 'd', + sfKeyE = 'e', + sfKeyF = 'f', + sfKeyG = 'g', + sfKeyH = 'h', + sfKeyI = 'i', + sfKeyJ = 'j', + sfKeyK = 'k', + sfKeyL = 'l', + sfKeyM = 'm', + sfKeyN = 'n', + sfKeyO = 'o', + sfKeyP = 'p', + sfKeyQ = 'q', + sfKeyR = 'r', + sfKeyS = 's', + sfKeyT = 't', + sfKeyU = 'u', + sfKeyV = 'v', + sfKeyW = 'w', + sfKeyX = 'x', + sfKeyY = 'y', + sfKeyZ = 'z', + sfKeyNum0 = '0', + sfKeyNum1 = '1', + sfKeyNum2 = '2', + sfKeyNum3 = '3', + sfKeyNum4 = '4', + sfKeyNum5 = '5', + sfKeyNum6 = '6', + sfKeyNum7 = '7', + sfKeyNum8 = '8', + sfKeyNum9 = '9', + sfKeyEscape = 256, + sfKeyLControl, + sfKeyLShift, + sfKeyLAlt, + sfKeyLSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ... + sfKeyRControl, + sfKeyRShift, + sfKeyRAlt, + sfKeyRSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ... + sfKeyMenu, + sfKeyLBracket, ///< [ + sfKeyRBracket, ///< ] + sfKeySemiColon, ///< ; + sfKeyComma, ///< , + sfKeyPeriod, ///< . + sfKeyQuote, ///< ' + sfKeySlash, ///< / + sfKeyBackSlash, + sfKeyTilde, ///< ~ + sfKeyEqual, ///< = + sfKeyDash, ///< - + sfKeySpace, + sfKeyReturn, + sfKeyBack, + sfKeyTab, + sfKeyPageUp, + sfKeyPageDown, + sfKeyEnd, + sfKeyHome, + sfKeyInsert, + sfKeyDelete, + sfKeyAdd, ///< + + sfKeySubtract, ///< - + sfKeyMultiply, ///< * + sfKeyDivide, ///< / + sfKeyLeft, ///< Left arrow + sfKeyRight, ///< Right arrow + sfKeyUp, ///< Up arrow + sfKeyDown, ///< Down arrow + sfKeyNumpad0, + sfKeyNumpad1, + sfKeyNumpad2, + sfKeyNumpad3, + sfKeyNumpad4, + sfKeyNumpad5, + sfKeyNumpad6, + sfKeyNumpad7, + sfKeyNumpad8, + sfKeyNumpad9, + sfKeyF1, + sfKeyF2, + sfKeyF3, + sfKeyF4, + sfKeyF5, + sfKeyF6, + sfKeyF7, + sfKeyF8, + sfKeyF9, + sfKeyF10, + sfKeyF11, + sfKeyF12, + sfKeyF13, + sfKeyF14, + sfKeyF15, + sfKeyPause, + + sfKeyCount // For internal use +} sfKeyCode; + + +//////////////////////////////////////////////////////////// +/// Definition of button codes for mouse events +//////////////////////////////////////////////////////////// +typedef enum +{ + sfButtonLeft, + sfButtonRight, + sfButtonMiddle, + sfButtonX1, + sfButtonX2 +} sfMouseButton; + + +//////////////////////////////////////////////////////////// +/// Definition of joystick axis for joystick events +//////////////////////////////////////////////////////////// +typedef enum +{ + sfJoyAxisX, + sfJoyAxisY, + sfJoyAxisZ, + sfJoyAxisR, + sfJoyAxisU, + sfJoyAxisV, + sfJoyAxisPOV +} sfJoyAxis; + + +//////////////////////////////////////////////////////////// +/// Definition of all the event types +//////////////////////////////////////////////////////////// +typedef enum +{ + sfEvtClosed, + sfEvtResized, + sfEvtLostFocus, + sfEvtGainedFocus, + sfEvtTextEntered, + sfEvtKeyPressed, + sfEvtKeyReleased, + sfEvtMouseWheelMoved, + sfEvtMouseButtonPressed, + sfEvtMouseButtonReleased, + sfEvtMouseMoved, + sfEvtMouseEntered, + sfEvtMouseLeft, + sfEvtJoyButtonPressed, + sfEvtJoyButtonReleased, + sfEvtJoyMoved +} sfEventType; + + +//////////////////////////////////////////////////////////// +/// Keyboard event parameters +//////////////////////////////////////////////////////////// +struct sfKeyEvent +{ + sfEventType Type; + sfKeyCode Code; + sfBool Alt; + sfBool Control; + sfBool Shift; +}; + +//////////////////////////////////////////////////////////// +/// Text event parameters +//////////////////////////////////////////////////////////// +struct sfTextEvent +{ + sfEventType Type; + sfUint32 Unicode; +}; + +//////////////////////////////////////////////////////////// +/// Mouse move event parameters +//////////////////////////////////////////////////////////// +struct sfMouseMoveEvent +{ + sfEventType Type; + int X; + int Y; +}; + +//////////////////////////////////////////////////////////// +/// Mouse buttons events parameters +//////////////////////////////////////////////////////////// +struct sfMouseButtonEvent +{ + sfEventType Type; + sfMouseButton Button; + int X; + int Y; +}; + +//////////////////////////////////////////////////////////// +/// Mouse wheel events parameters +//////////////////////////////////////////////////////////// +struct sfMouseWheelEvent +{ + sfEventType Type; + int Delta; +}; + +//////////////////////////////////////////////////////////// +/// Joystick axis move event parameters +//////////////////////////////////////////////////////////// +struct sfJoyMoveEvent +{ + sfEventType Type; + unsigned int JoystickId; + sfJoyAxis Axis; + float Position; +}; + +//////////////////////////////////////////////////////////// +/// Joystick buttons events parameters +//////////////////////////////////////////////////////////// +struct sfJoyButtonEvent +{ + sfEventType Type; + unsigned int JoystickId; + unsigned int Button; +}; + +//////////////////////////////////////////////////////////// +/// Size events parameters +//////////////////////////////////////////////////////////// +struct sfSizeEvent +{ + sfEventType Type; + unsigned int Width; + unsigned int Height; +}; + + +//////////////////////////////////////////////////////////// +/// sfEvent defines a system event and its parameters +//////////////////////////////////////////////////////////// +typedef union +{ + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + sfEventType Type; ///< Type of the event + struct sfKeyEvent Key; + struct sfTextEvent Text; + struct sfMouseMoveEvent MouseMove; + struct sfMouseButtonEvent MouseButton; + struct sfMouseWheelEvent MouseWheel; + struct sfJoyMoveEvent JoyMove; + struct sfJoyButtonEvent JoyButton; + struct sfSizeEvent Size; +} sfEvent; + + +#endif // SFML_EVENT_H diff --git a/CSFML/include/SFML/Window/Input.h b/CSFML/include/SFML/Window/Input.h new file mode 100644 index 00000000..b57753ed --- /dev/null +++ b/CSFML/include/SFML/Window/Input.h @@ -0,0 +1,110 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_INPUT_H +#define SFML_INPUT_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfInput handles real-time input from keyboard and mouse. +/// Use it instead of events to handle continuous moves and more +/// game-friendly inputs +//////////////////////////////////////////////////////////// +typedef struct sfInput sfInput; + + +//////////////////////////////////////////////////////////// +/// Get the state of a key +/// +/// \param Input : Input object +/// \param KeyCode : Key to check +/// +/// \return sfTrue if key is down, sfFalse if key is up +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfInput_IsKeyDown(sfInput* Input, sfKeyCode KeyCode); + +//////////////////////////////////////////////////////////// +/// Get the state of a mouse button +/// +/// \param Input : Input object +/// \param Button : Button to check +/// +/// \return sfTrue if button is down, sfFalse if button is up +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfInput_IsMouseButtonDown(sfInput* Input, sfMouseButton Button); + +//////////////////////////////////////////////////////////// +/// Get the state of a joystick button +/// +/// \param Input : Input object +/// \param JoyId : Identifier of the joystick to check (0 or 1) +/// \param Button : Button to check +/// +/// \return sfTrue if button is down, sfFalse if button is up +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfInput_IsJoystickButtonDown(sfInput* Input, unsigned int JoyId, unsigned int Button); + +//////////////////////////////////////////////////////////// +/// Get the mouse X position +/// +/// \param Input : Input object +/// +/// \return Current mouse left position, relative to owner window +/// +//////////////////////////////////////////////////////////// +CSFML_API int sfInput_GetMouseX(sfInput* Input); + +//////////////////////////////////////////////////////////// +/// Get the mouse Y position +/// +/// \param Input : Input object +/// +/// \return Current mouse top position, relative to owner window +/// +//////////////////////////////////////////////////////////// +CSFML_API int sfInput_GetMouseY(sfInput* Input); + +//////////////////////////////////////////////////////////// +/// Get the joystick position on a given axis +/// +/// \param Input : Input object +/// \param JoyId : Identifier of the joystick to check (0 or 1) +/// \param Axis : Identifier of the axis to read +/// +/// \return Current joystick position, in the range [-100, 100] +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfInput_GetJoystickAxis(sfInput* Input, unsigned int JoyId, sfJoyAxis Axis); + + +#endif // SFML_INPUT_H diff --git a/CSFML/include/SFML/Window/VideoMode.h b/CSFML/include/SFML/Window/VideoMode.h new file mode 100644 index 00000000..270c108a --- /dev/null +++ b/CSFML/include/SFML/Window/VideoMode.h @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODE_H +#define SFML_VIDEOMODE_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// sfVideoMode defines a video mode (width, height, bpp, frequency) +/// and provides functions for getting modes supported +/// by the display device +//////////////////////////////////////////////////////////// +typedef struct +{ + unsigned int Width; ///< Video mode width, in pixels + unsigned int Height; ///< Video mode height, in pixels + unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels +} sfVideoMode; + + +//////////////////////////////////////////////////////////// +/// Get the current desktop video mode +/// +/// \return Current desktop video mode +/// +//////////////////////////////////////////////////////////// +CSFML_API sfVideoMode sfVideoMode_GetDesktopMode(); + +//////////////////////////////////////////////////////////// +/// Get a valid video mode +/// Index must be in range [0, GetModesCount()[ +/// Modes are sorted from best to worst +/// +/// \param Index : Index of video mode to get +/// +/// \return Corresponding video mode (invalid mode if index is out of range) +/// +//////////////////////////////////////////////////////////// +CSFML_API sfVideoMode sfVideoMode_GetMode(size_t Index); + +//////////////////////////////////////////////////////////// +/// Get valid video modes count +/// +/// \return Number of valid video modes available +/// +//////////////////////////////////////////////////////////// +CSFML_API size_t sfVideoMode_GetModesCount(); + +//////////////////////////////////////////////////////////// +/// Tell whether or not a video mode is supported +/// +/// \param Mode : Video mode to check +/// +/// +/// \return True if video mode is supported, false otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfVideoMode_IsValid(sfVideoMode Mode); + + +#endif // SFML_VIDEOMODE_H diff --git a/CSFML/include/SFML/Window/Window.h b/CSFML/include/SFML/Window/Window.h new file mode 100644 index 00000000..a8cc22f8 --- /dev/null +++ b/CSFML/include/SFML/Window/Window.h @@ -0,0 +1,294 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_H +#define SFML_WINDOW_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// sfWindow is a rendering window ; it can create a new window +/// or connect to an existing one +//////////////////////////////////////////////////////////// +typedef struct sfWindow sfWindow; + + +//////////////////////////////////////////////////////////// +/// Enumeration of window creation styles +/// +//////////////////////////////////////////////////////////// +enum +{ + sfNone = 0, ///< No border / title bar (this flag and all others are mutually exclusive) + sfTitlebar = 1 << 0, ///< Title bar + fixed border + sfResize = 1 << 1, ///< Titlebar + resizable border + maximize button + sfClose = 1 << 2, ///< Titlebar + close button + sfFullscreen = 1 << 3 ///< Fullscreen mode (this flag and all others are mutually exclusive) +}; + + +//////////////////////////////////////////////////////////// +/// Structure defining the window's creation settings +//////////////////////////////////////////////////////////// +typedef struct +{ + unsigned int DepthBits; ///< Bits of the depth buffer + unsigned int StencilBits; ///< Bits of the stencil buffer + unsigned int AntialiasingLevel; ///< Level of antialiasing +} sfWindowSettings; + + +//////////////////////////////////////////////////////////// +/// Construct a new window +/// +/// \param Mode : Video mode to use +/// \param Title : Title of the window +/// \param Style : Window style +/// \param Params : Creation settings +/// +//////////////////////////////////////////////////////////// +CSFML_API sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params); + +//////////////////////////////////////////////////////////// +/// Construct a window from an existing control +/// +/// \param Handle : Platform-specific handle of the control +/// \param Params : Creation settings +/// +//////////////////////////////////////////////////////////// +CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params); + +//////////////////////////////////////////////////////////// +/// Destroy an existing window +/// +/// \param Window : Window to destroy +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_Destroy(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Close a window (but doesn't destroy the internal data) +/// +/// \param Window : Window to close +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_Close(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Tell whether or not a window is opened +/// +/// \param Window : Window object +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfWindow_IsOpened(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Get the width of the rendering region of a window +/// +/// \param Window : Window object +/// +/// \return Width in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfWindow_GetWidth(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Get the height of the rendering region of a window +/// +/// \param Window : Window object +/// +/// \return Height in pixels +/// +//////////////////////////////////////////////////////////// +CSFML_API unsigned int sfWindow_GetHeight(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Get the creation settings of a window +/// +/// \param Window : Window object +/// +/// \return Settings used to create the window +/// +//////////////////////////////////////////////////////////// +CSFML_API sfWindowSettings sfWindow_GetSettings(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Get the event on top of events stack of a window, if any, and pop it +/// +/// \param Window : Window object +/// \param Event : Event to fill, if any +/// +/// \return sfTrue if an event was returned, sfFalse if events stack was empty +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfWindow_GetEvent(sfWindow* Window, sfEvent* Event); + +//////////////////////////////////////////////////////////// +/// Enable / disable vertical synchronization on a window +/// +/// \param Window : Window object +/// \param Enabled : sfTrue to enable v-sync, sfFalse to deactivate +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_UseVerticalSync(sfWindow* Window, sfBool Enabled); + +//////////////////////////////////////////////////////////// +/// Show or hide the mouse cursor on a window +/// +/// \param Window : Window object +/// \param Show : sfTrue to show, sfFalse to hide +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_ShowMouseCursor(sfWindow* Window, sfBool Show); + +//////////////////////////////////////////////////////////// +/// Change the position of the mouse cursor on a window +/// +/// \param Window : Window object +/// \param Left : Left coordinate of the cursor, relative to the window +/// \param Top : Top coordinate of the cursor, relative to the window +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned int Top); + +//////////////////////////////////////////////////////////// +/// Change the position of a window on screen. +/// Only works for top-level windows +/// +/// \param Window : Window object +/// \param Left : Left position +/// \param Top : Top position +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_SetPosition(sfWindow* Window, int Left, int Top); + +//////////////////////////////////////////////////////////// +/// Change the size of the rendering region of a window +/// +/// \param Window : Window object +/// \param Width : New Width +/// \param Height : New Height +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_SetSize(sfWindow* Window, unsigned int Width, unsigned int Height); + +//////////////////////////////////////////////////////////// +/// Show or hide a window +/// +/// \param Window : Window object +/// \param State : sfTrue to show, sfFalse to hide +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_Show(sfWindow* Window, sfBool State); + +//////////////////////////////////////////////////////////// +/// Enable or disable automatic key-repeat for keydown events. +/// Automatic key-repeat is enabled by default +/// +/// \param Window : Window object +/// \param Enabled : sfTrue to enable, sfFalse to disable +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_EnableKeyRepeat(sfWindow* Window, sfBool Enabled); + +//////////////////////////////////////////////////////////// +/// Change the window's icon +/// +/// \param Window : Window object +/// \param Width : Icon's width, in pixels +/// \param Height : Icon's height, in pixels +/// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_SetIcon(sfWindow* Window, unsigned int Width, unsigned int Height, sfUint8* Pixels); + +//////////////////////////////////////////////////////////// +/// Activate or deactivate a window as the current target for rendering +/// +/// \param Window : Window object +/// \param Active : sfTrue to activate, sfFalse to deactivate +/// +/// \return True if operation was successful, false otherwise +/// +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfWindow_SetActive(sfWindow* Window, sfBool Active); + +//////////////////////////////////////////////////////////// +/// Display a window on screen +/// +/// \param Window : Window object +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_Display(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Get the input manager of a window +/// +/// \param Window : Window object +/// +/// \return Reference to the input +/// +//////////////////////////////////////////////////////////// +CSFML_API sfInput* sfWindow_GetInput(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Limit the framerate to a maximum fixed frequency for a window +/// +/// \param Window : Window object +/// +/// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit) +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_SetFramerateLimit(sfWindow* Window, unsigned int Limit); + +//////////////////////////////////////////////////////////// +/// Get time elapsed since last frame of a window +/// +/// \param Window : Window object +/// +/// \return Time elapsed, in seconds +/// +//////////////////////////////////////////////////////////// +CSFML_API float sfWindow_GetFrameTime(sfWindow* Window); + +//////////////////////////////////////////////////////////// +/// Change the joystick threshold, ie. the value below which +/// no move event will be generated +/// +/// \param Window : Window object +/// \param Threshold : New threshold, in range [0, 100] +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfWindow_SetJoystickThreshold(sfWindow* Window, float Threshold); + + +#endif // SFML_WINDOW_H diff --git a/CSFML/include/SFML/Window/WindowHandle.h b/CSFML/include/SFML/Window/WindowHandle.h new file mode 100644 index 00000000..4851d0a9 --- /dev/null +++ b/CSFML/include/SFML/Window/WindowHandle.h @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWHANDLE_H +#define SFML_WINDOWHANDLE_H + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Define a low-level window handle type, specific to +/// each platform +//////////////////////////////////////////////////////////// +#if defined(CSFML_SYSTEM_WINDOWS) + + // Windows defines a void* handle (HWND) + typedef void* sfWindowHandle; + +#elif defined(CSFML_SYSTEM_LINUX) + + // Unix - X11 defines an unsigned integer handle (Window) + typedef unsigned long sfWindowHandle; + +#elif defined(CSFML_SYSTEM_MACOS) + + // Mac OS X defines a void* handle (NSWindow) + typedef void * sfWindowHandle; + +#endif + + +#endif // SFML_WINDOWHANDLE_H diff --git a/CSFML/src/SFML/Audio/Listener.cpp b/CSFML/src/SFML/Audio/Listener.cpp new file mode 100644 index 00000000..1d32d019 --- /dev/null +++ b/CSFML/src/SFML/Audio/Listener.cpp @@ -0,0 +1,98 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + + +//////////////////////////////////////////////////////////// +/// Change the global volume of all the sounds +//////////////////////////////////////////////////////////// +void sfListener_SetGlobalVolume(float Volume) +{ + sf::Listener::SetGlobalVolume(Volume); +} + + +//////////////////////////////////////////////////////////// +/// Get the current value of the global volume of all the sounds +//////////////////////////////////////////////////////////// +float sfListener_GetGlobalVolume() +{ + return sf::Listener::GetGlobalVolume(); +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the listener +//////////////////////////////////////////////////////////// +void sfListener_SetPosition(float PosX, float PosY, float PosZ) +{ + sf::Listener::SetPosition(sf::Vector3f(PosX, PosY, PosZ)); +} + + +//////////////////////////////////////////////////////////// +/// Get the current position of the listener +//////////////////////////////////////////////////////////// +void sfListener_GetPosition(float* PosX, float* PosY, float* PosZ) +{ + if (PosX && PosY && PosZ) + { + sf::Vector3f Position = sf::Listener::GetPosition(); + *PosX = Position.x; + *PosY = Position.y; + *PosZ = Position.z; + } +} + + +//////////////////////////////////////////////////////////// +/// Change the orientation of the listener (the point +/// he must look at) +//////////////////////////////////////////////////////////// +void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ) +{ + sf::Listener::SetTarget(sf::Vector3f(TargetX, TargetY, TargetZ)); +} + + +//////////////////////////////////////////////////////////// +/// Get the current orientation of the listener (the point +/// he's looking at) +//////////////////////////////////////////////////////////// +void sfListener_GetTarget(float* TargetX, float* TargetY, float* TargetZ) +{ + if (TargetX && TargetY && TargetZ) + { + sf::Vector3f Target = sf::Listener::GetTarget(); + *TargetX = Target.x; + *TargetY = Target.y; + *TargetZ = Target.z; + } +} diff --git a/CSFML/src/SFML/Audio/Makefile b/CSFML/src/SFML/Audio/Makefile new file mode 100644 index 00000000..08bfbce9 --- /dev/null +++ b/CSFML/src/SFML/Audio/Makefile @@ -0,0 +1,23 @@ +LIB = libcsfml-audio.so +SRC = $(wildcard *.cpp) +OBJ = $(SRC:.cpp=.o) +LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + +all: $(LIB) + +libcsfml-audio.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lsfml-audio + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB)) diff --git a/CSFML/src/SFML/Audio/Music.cpp b/CSFML/src/SFML/Audio/Music.cpp new file mode 100644 index 00000000..647e82ff --- /dev/null +++ b/CSFML/src/SFML/Audio/Music.cpp @@ -0,0 +1,273 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfMusic +{ + sf::Music This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new music and load it from a file +//////////////////////////////////////////////////////////// +sfMusic* sfMusic_CreateFromFile(const char* Filename) +{ + sfMusic* Music = new sfMusic; + + if (!Music->This.OpenFromFile(Filename)) + { + delete Music; + Music = NULL; + } + + return Music; +} + + +//////////////////////////////////////////////////////////// +/// Create a new music and load it from a file in memory +//////////////////////////////////////////////////////////// +sfMusic* sfMusic_CreateFromMemory(const char* Data, size_t SizeInBytes) +{ + sfMusic* Music = new sfMusic; + + if (!Music->This.OpenFromMemory(Data, SizeInBytes)) + { + delete Music; + Music = NULL; + } + + return Music; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing music +//////////////////////////////////////////////////////////// +void sfMusic_Destroy(sfMusic* Music) +{ + delete Music; +} + + +//////////////////////////////////////////////////////////// +/// Set a music loop state +//////////////////////////////////////////////////////////// +void sfMusic_SetLoop(sfMusic* Music, sfBool Loop) +{ + CSFML_CALL(Music, SetLoop(Loop != 0)); +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not a music is looping +//////////////////////////////////////////////////////////// +sfBool sfMusic_GetLoop(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetLoop(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get a music duration +//////////////////////////////////////////////////////////// +float sfMusic_GetDuration(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetDuration(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Start playing a music +//////////////////////////////////////////////////////////// +void sfMusic_Play(sfMusic* Music) +{ + CSFML_CALL(Music, Play()); +} + + +//////////////////////////////////////////////////////////// +/// Pause a music +//////////////////////////////////////////////////////////// +void sfMusic_Pause(sfMusic* Music) +{ + CSFML_CALL(Music, Pause()); +} + + +//////////////////////////////////////////////////////////// +/// Stop playing a music +//////////////////////////////////////////////////////////// +void sfMusic_Stop(sfMusic* Music) +{ + CSFML_CALL(Music, Stop()); +} + + +//////////////////////////////////////////////////////////// +/// Return the number of channels of a music (1 = mono, 2 = stereo) +//////////////////////////////////////////////////////////// +unsigned int sfMusic_GetChannelsCount(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetChannelsCount(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the stream sample rate of a music +//////////////////////////////////////////////////////////// +unsigned int sfMusic_GetSampleRate(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetSampleRate(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the status of a music (stopped, paused, playing) +//////////////////////////////////////////////////////////// +sfSoundStatus sfMusic_GetStatus(sfMusic* Music) +{ + CSFML_CHECK_RETURN(Music, sfStopped); + + return static_cast(Music->This.GetStatus()); +} + + +//////////////////////////////////////////////////////////// +/// Get the current playing position of a music +//////////////////////////////////////////////////////////// +float sfMusic_GetPlayingOffset(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetPlayingOffset(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Set the pitch of a music +//////////////////////////////////////////////////////////// +void sfMusic_SetPitch(sfMusic* Music, float Pitch) +{ + CSFML_CALL(Music, SetPitch(Pitch)); +} + + +//////////////////////////////////////////////////////////// +/// Set the volume of a music +//////////////////////////////////////////////////////////// +void sfMusic_SetVolume(sfMusic* Music, float Volume) +{ + CSFML_CALL(Music, SetVolume(Volume)); +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a music +//////////////////////////////////////////////////////////// +void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z) +{ + CSFML_CALL(Music, SetPosition(sf::Vector3f(X, Y, Z))); +} + + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the music at its maximum volume. +/// The default minimum distance is 1.0 +//////////////////////////////////////////////////////////// +void sfMusic_SetMinDistance(sfMusic* Music, float MinDistance) +{ + CSFML_CALL(Music, SetMinDistance(MinDistance)); +} + + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound will be attenuated with distance from listener. +/// The default attenuation factor 1.0 +//////////////////////////////////////////////////////////// +void sfMusic_SetAttenuation(sfMusic* Music, float Attenuation) +{ + CSFML_CALL(Music, SetAttenuation(Attenuation)); +} + + +//////////////////////////////////////////////////////////// +/// Get the pitch of a music +//////////////////////////////////////////////////////////// +float sfMusic_GetPitch(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetPitch(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the volume of a music +//////////////////////////////////////////////////////////// +float sfMusic_GetVolume(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetVolume(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the position of a music +//////////////////////////////////////////////////////////// +void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z) +{ + CSFML_CHECK(Music); + + if (X && Y && Z) + { + sf::Vector3f Position = Music->This.GetPosition(); + *X = Position.x; + *Y = Position.y; + *Z = Position.z; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the minimum distance of a music +//////////////////////////////////////////////////////////// +float sfMusic_GetMinDistance(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetMinDistance(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor of a a +//////////////////////////////////////////////////////////// +float sfMusic_GetAttenuation(sfMusic* Music) +{ + CSFML_CALL_RETURN(Music, GetAttenuation(), 0.f); +} diff --git a/CSFML/src/SFML/Audio/Sound.cpp b/CSFML/src/SFML/Audio/Sound.cpp new file mode 100644 index 00000000..2b6f22b6 --- /dev/null +++ b/CSFML/src/SFML/Audio/Sound.cpp @@ -0,0 +1,258 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Audio/SoundBuffer.h +struct sfSoundBuffer +{ + sf::SoundBuffer This; +}; +struct sfSound +{ + sf::Sound This; + sfSoundBuffer* Buffer; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new sound +//////////////////////////////////////////////////////////// +sfSound* sfSound_Create() +{ + return new sfSound; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound +//////////////////////////////////////////////////////////// +void sfSound_Destroy(sfSound* Sound) +{ + delete Sound; +} + + +//////////////////////////////////////////////////////////// +/// Start playing a sound +//////////////////////////////////////////////////////////// +void sfSound_Play(sfSound* Sound) +{ + CSFML_CALL(Sound, Play()) +} + + +//////////////////////////////////////////////////////////// +/// Pause a sound +//////////////////////////////////////////////////////////// +void sfSound_Pause(sfSound* Sound) +{ + CSFML_CALL(Sound, Pause()) +} + + +//////////////////////////////////////////////////////////// +/// Stop playing a sound +//////////////////////////////////////////////////////////// +void sfSound_Stop(sfSound* Sound) +{ + CSFML_CALL(Sound, Stop()) +} + + +//////////////////////////////////////////////////////////// +/// Bind a sound buffer to a sound +//////////////////////////////////////////////////////////// +void sfSound_SetBuffer(sfSound* Sound, sfSoundBuffer* Buffer) +{ + if (Buffer) + { + CSFML_CALL(Sound, SetBuffer(Buffer->This)) + Sound->Buffer = Buffer; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the sound buffer bound to a sound +//////////////////////////////////////////////////////////// +sfSoundBuffer* sfSound_GetBuffer(sfSound* Sound) +{ + CSFML_CHECK_RETURN(Sound, NULL) + + return Sound->Buffer; +} + + +//////////////////////////////////////////////////////////// +/// Set a sound loop state +//////////////////////////////////////////////////////////// +void sfSound_SetLoop(sfSound* Sound, sfBool Loop) +{ + CSFML_CALL(Sound, SetLoop(Loop == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not a sound is looping +//////////////////////////////////////////////////////////// +sfBool sfSound_GetLoop(sfSound* Sound) +{ + CSFML_CALL_RETURN(Sound, GetLoop(), sfFalse) +} + + +//////////////////////////////////////////////////////////// +/// Get the status of a sound (stopped, paused, playing) +//////////////////////////////////////////////////////////// +sfSoundStatus sfSound_GetStatus(sfSound* Sound) +{ + CSFML_CHECK_RETURN(Sound, sfStopped); + + return static_cast(Sound->This.GetStatus()); +} + + +//////////////////////////////////////////////////////////// +/// Set the pitch of a sound +//////////////////////////////////////////////////////////// +void sfSound_SetPitch(sfSound* Sound, float Pitch) +{ + CSFML_CALL(Sound, SetPitch(Pitch)) +} + + +//////////////////////////////////////////////////////////// +/// Set the volume of a sound +//////////////////////////////////////////////////////////// +void sfSound_SetVolume(sfSound* Sound, float Volume) +{ + CSFML_CALL(Sound, SetVolume(Volume)) +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a sound +//////////////////////////////////////////////////////////// +void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z) +{ + CSFML_CALL(Sound, SetPosition(sf::Vector3f(X, Y, Z))) +} + + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the sound at its maximum volume. +/// The default minimum distance is 1.0 +//////////////////////////////////////////////////////////// +void sfSound_SetMinDistance(sfSound* Sound, float MinDistance) +{ + CSFML_CALL(Sound, SetMinDistance(MinDistance)); +} + + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound will be attenuated with distance from listener. +/// The default attenuation factor is 1.0 +//////////////////////////////////////////////////////////// +void sfSound_SetAttenuation(sfSound* Sound, float Attenuation) +{ + CSFML_CALL(Sound, SetAttenuation(Attenuation)); +} + + +//////////////////////////////////////////////////////////// +/// Set the current playing position of a sound +//////////////////////////////////////////////////////////// +void sfSound_SetPlayingOffset(sfSound* Sound, float TimeOffset) +{ + CSFML_CALL(Sound, SetPlayingOffset(TimeOffset)); +} + + +//////////////////////////////////////////////////////////// +/// Get the pitch of a sound +//////////////////////////////////////////////////////////// +float sfSound_GetPitch(sfSound* Sound) +{ + CSFML_CALL_RETURN(Sound, GetPitch(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the volume of a sound +//////////////////////////////////////////////////////////// +float sfSound_GetVolume(sfSound* Sound) +{ + CSFML_CALL_RETURN(Sound, GetVolume(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the position of a sound +//////////////////////////////////////////////////////////// +void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z) +{ + CSFML_CHECK(Sound); + + sf::Vector3f Position = Sound->This.GetPosition(); + if (X) *X = Position.x; + if (Y) *Y = Position.y; + if (Z) *Z = Position.z; +} + + +//////////////////////////////////////////////////////////// +/// Get the minimum distance of a sound +//////////////////////////////////////////////////////////// +float sfSound_GetMinDistance(sfSound* Sound) +{ + CSFML_CALL_RETURN(Sound, GetMinDistance(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor of a sound +//////////////////////////////////////////////////////////// +float sfSound_GetAttenuation(sfSound* Sound) +{ + CSFML_CALL_RETURN(Sound, GetAttenuation(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the current playing position of a sound +//////////////////////////////////////////////////////////// +float sfSound_GetPlayingOffset(sfSound* Sound) +{ + CSFML_CALL_RETURN(Sound, GetPlayingOffset(), 0.f) +} diff --git a/CSFML/src/SFML/Audio/SoundBuffer.cpp b/CSFML/src/SFML/Audio/SoundBuffer.cpp new file mode 100644 index 00000000..c78b40d1 --- /dev/null +++ b/CSFML/src/SFML/Audio/SoundBuffer.cpp @@ -0,0 +1,152 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfSoundBuffer +{ + sf::SoundBuffer This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new sound buffer and load it from a file +//////////////////////////////////////////////////////////// +sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* Filename) +{ + sfSoundBuffer* Buffer = new sfSoundBuffer; + + if (!Buffer->This.LoadFromFile(Filename)) + { + delete Buffer; + Buffer = NULL; + } + + return Buffer; +} + + +//////////////////////////////////////////////////////////// +/// Create a new sound buffer and load it from a file in memory +//////////////////////////////////////////////////////////// +sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const char* Data, size_t SizeInBytes) +{ + sfSoundBuffer* Buffer = new sfSoundBuffer; + + if (!Buffer->This.LoadFromMemory(Data, SizeInBytes)) + { + delete Buffer; + Buffer = NULL; + } + + return Buffer; +} + + +//////////////////////////////////////////////////////////// +/// Create a new sound buffer and load it from an array of +/// samples in memory - assumed format for samples is +/// 16 bits signed integer +//////////////////////////////////////////////////////////// +sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* Samples, size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate) +{ + sfSoundBuffer* Buffer = new sfSoundBuffer; + + if (!Buffer->This.LoadFromSamples(Samples, SamplesCount, ChannelsCount, SampleRate)) + { + delete Buffer; + Buffer = NULL; + } + + return Buffer; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound buffer +//////////////////////////////////////////////////////////// +void sfSoundBuffer_Destroy(sfSoundBuffer* SoundBuffer) +{ + delete SoundBuffer; +} + + +//////////////////////////////////////////////////////////// +/// Save a sound buffer to a file +//////////////////////////////////////////////////////////// +sfBool sfSoundBuffer_SaveToFile(sfSoundBuffer* SoundBuffer, const char* Filename) +{ + CSFML_CALL_RETURN(SoundBuffer, SaveToFile(Filename), sfFalse) +} + + +//////////////////////////////////////////////////////////// +/// Return the samples contained in a sound buffer +//////////////////////////////////////////////////////////// +const sfInt16* sfSoundBuffer_GetSamples(sfSoundBuffer* SoundBuffer) +{ + CSFML_CALL_RETURN(SoundBuffer, GetSamples(), NULL) +} + + +//////////////////////////////////////////////////////////// +/// Return the number of samples contained in a sound buffer +//////////////////////////////////////////////////////////// +size_t sfSoundBuffer_GetSamplesCount(sfSoundBuffer* SoundBuffer) +{ + CSFML_CALL_RETURN(SoundBuffer, GetSamplesCount(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound buffer +//////////////////////////////////////////////////////////// +unsigned int sfSoundBuffer_GetSampleRate(sfSoundBuffer* SoundBuffer) +{ + CSFML_CALL_RETURN(SoundBuffer, GetSampleRate(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...) +//////////////////////////////////////////////////////////// +unsigned int sfSoundBuffer_GetChannelsCount(sfSoundBuffer* SoundBuffer) +{ + CSFML_CALL_RETURN(SoundBuffer, GetChannelsCount(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Get the duration of a sound buffer +//////////////////////////////////////////////////////////// +float sfSoundBuffer_GetDuration(sfSoundBuffer* SoundBuffer) +{ + CSFML_CALL_RETURN(SoundBuffer, GetDuration(), 0.f) +} diff --git a/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp b/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp new file mode 100644 index 00000000..7ad2ef90 --- /dev/null +++ b/CSFML/src/SFML/Audio/SoundBufferRecorder.cpp @@ -0,0 +1,104 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Audio/SoundBuffer.h +struct sfSoundBuffer +{ + sf::SoundBuffer This; +}; + +struct sfSoundBufferRecorder +{ + sf::SoundBufferRecorder This; + sfSoundBuffer SoundBuffer; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new sound buffer recorder +//////////////////////////////////////////////////////////// +sfSoundBufferRecorder* sfSoundBufferRecorder_Create() +{ + return new sfSoundBufferRecorder; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound buffer recorder +//////////////////////////////////////////////////////////// +void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* SoundBufferRecorder) +{ + delete SoundBufferRecorder; +} + + +//////////////////////////////////////////////////////////// +/// Start the capture. +/// Warning : only one capture can happen at the same time +//////////////////////////////////////////////////////////// +void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* SoundBufferRecorder, unsigned int SampleRate) +{ + CSFML_CALL(SoundBufferRecorder, Start(SampleRate)); +} + + +//////////////////////////////////////////////////////////// +/// Stop the capture +//////////////////////////////////////////////////////////// +void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* SoundBufferRecorder) +{ + CSFML_CALL(SoundBufferRecorder, Stop()); +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound buffer recorder +//////////////////////////////////////////////////////////// +unsigned int sfSoundBufferRecorder_GetSampleRate(sfSoundBufferRecorder* SoundBufferRecorder) +{ + CSFML_CALL_RETURN(SoundBufferRecorder, GetSampleRate(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the sound buffer containing the captured audio data +/// of a sound buffer recorder +//////////////////////////////////////////////////////////// +sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(sfSoundBufferRecorder* SoundBufferRecorder) +{ + CSFML_CHECK_RETURN(SoundBufferRecorder, NULL); + + SoundBufferRecorder->SoundBuffer.This = SoundBufferRecorder->This.GetBuffer(); + + return &SoundBufferRecorder->SoundBuffer; +} diff --git a/CSFML/src/SFML/Audio/SoundRecorder.cpp b/CSFML/src/SFML/Audio/SoundRecorder.cpp new file mode 100644 index 00000000..860c0ae8 --- /dev/null +++ b/CSFML/src/SFML/Audio/SoundRecorder.cpp @@ -0,0 +1,150 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +class sfSoundRecorderImpl : public sf::SoundRecorder +{ +public : + + sfSoundRecorderImpl(sfSoundRecorderStartCallback OnStart, + sfSoundRecorderProcessCallback OnProcess, + sfSoundRecorderStopCallback OnStop, + void* UserData) : + myStartCallback (OnStart), + myProcessCallback(OnProcess), + myStopCallback (OnStop), + myUserData (UserData) + { + } + +private : + + virtual bool OnStart() + { + if (myStartCallback) + return myStartCallback(myUserData) == sfTrue; + else + return true; + } + + virtual bool OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount) + { + if (myProcessCallback) + return myProcessCallback(Samples, SamplesCount, myUserData) == sfTrue; + else + return true; + } + + virtual void OnStop() + { + if (myStopCallback) + myStopCallback(myUserData); + } + + sfSoundRecorderStartCallback myStartCallback; + sfSoundRecorderProcessCallback myProcessCallback; + sfSoundRecorderStopCallback myStopCallback; + void* myUserData; +}; + + +struct sfSoundRecorder +{ + sfSoundRecorder(sfSoundRecorderStartCallback OnStart, + sfSoundRecorderProcessCallback OnProcess, + sfSoundRecorderStopCallback OnStop, + void* UserData) : + This(OnStart, OnProcess, OnStop, UserData) + { + } + + sfSoundRecorderImpl This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new sound recorder with callback functions +/// for processing captured samples +//////////////////////////////////////////////////////////// +sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback OnStart, + sfSoundRecorderProcessCallback OnProcess, + sfSoundRecorderStopCallback OnStop, + void* UserData) +{ + return new sfSoundRecorder(OnStart, OnProcess, OnStop, UserData); +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound recorder +//////////////////////////////////////////////////////////// +void sfSoundRecorder_Destroy(sfSoundRecorder* SoundRecorder) +{ + delete SoundRecorder; +} + + +//////////////////////////////////////////////////////////// +/// Start the capture. +/// Warning : only one capture can happen at the same time +//////////////////////////////////////////////////////////// +void sfSoundRecorder_Start(sfSoundRecorder* SoundRecorder, unsigned int SampleRate) +{ + CSFML_CALL(SoundRecorder, Start(SampleRate)); +} + + +//////////////////////////////////////////////////////////// +/// Stop the capture +//////////////////////////////////////////////////////////// +void sfSoundRecorder_Stop(sfSoundRecorder* SoundRecorder) +{ + CSFML_CALL(SoundRecorder, Stop()); +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound recorder +//////////////////////////////////////////////////////////// +unsigned int sfSoundRecorder_GetSampleRate(sfSoundRecorder* SoundRecorder) +{ + CSFML_CALL_RETURN(SoundRecorder, GetSampleRate(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Tell if the system supports sound capture. +/// If not, this class won't be usable +//////////////////////////////////////////////////////////// +sfBool sfSoundRecorder_CanCapture() +{ + return sf::SoundRecorder::CanCapture() ? sfTrue : sfFalse; +} diff --git a/CSFML/src/SFML/Audio/SoundStream.cpp b/CSFML/src/SFML/Audio/SoundStream.cpp new file mode 100644 index 00000000..d8919629 --- /dev/null +++ b/CSFML/src/SFML/Audio/SoundStream.cpp @@ -0,0 +1,294 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +class sfSoundStreamImpl : public sf::SoundStream +{ +public : + + sfSoundStreamImpl(sfSoundStreamStartCallback OnStart, + sfSoundStreamGetDataCallback OnGetData, + unsigned int ChannelsCount, + unsigned int SampleRate, + void* UserData) : + myStartCallback (OnStart), + myGetDataCallback(OnGetData), + myUserData (UserData) + { + Initialize(ChannelsCount, SampleRate); + } + +private : + + virtual bool OnStart() + { + if (myStartCallback) + return myStartCallback(myUserData) == sfTrue; + else + return true; + } + + virtual bool OnGetData(Chunk& Data) + { + sfSoundStreamChunk Chunk = {NULL, 0}; + bool Continue = (myGetDataCallback(&Chunk, myUserData) == sfTrue); + + Data.Samples = Chunk.Samples; + Data.NbSamples = Chunk.NbSamples; + + return Continue; + } + + sfSoundStreamStartCallback myStartCallback; + sfSoundStreamGetDataCallback myGetDataCallback; + void* myUserData; +}; + + +struct sfSoundStream +{ + + sfSoundStream(sfSoundStreamStartCallback OnStart, + sfSoundStreamGetDataCallback OnGetData, + unsigned int ChannelsCount, + unsigned int SampleRate, + void* UserData) : + This(OnStart, OnGetData, ChannelsCount, SampleRate, UserData) + { + } + + sfSoundStreamImpl This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new sound stream +//////////////////////////////////////////////////////////// +sfSoundStream* sfSoundStream_Create(sfSoundStreamStartCallback OnStart, + sfSoundStreamGetDataCallback OnGetData, + unsigned int ChannelsCount, + unsigned int SampleRate, + void* UserData) +{ + return new sfSoundStream(OnStart, OnGetData, ChannelsCount, SampleRate, UserData); +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_Destroy(sfSoundStream* SoundStream) +{ + delete SoundStream; +} + + +//////////////////////////////////////////////////////////// +/// Start playing a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_Play(sfSoundStream* SoundStream) +{ + CSFML_CALL(SoundStream, Play()); +} + + +//////////////////////////////////////////////////////////// +/// Pause a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_Pause(sfSoundStream* SoundStream) +{ + CSFML_CALL(SoundStream, Pause()); +} + + +//////////////////////////////////////////////////////////// +/// Stop playing a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_Stop(sfSoundStream* SoundStream) +{ + CSFML_CALL(SoundStream, Stop()); +} + + +//////////////////////////////////////////////////////////// +/// Get the status of a sound stream (stopped, paused, playing) +//////////////////////////////////////////////////////////// +sfSoundStatus sfSoundStream_GetStatus(sfSoundStream* SoundStream) +{ + CSFML_CHECK_RETURN(SoundStream, sfStopped); + + return static_cast(SoundStream->This.GetStatus()); +} + + +//////////////////////////////////////////////////////////// +/// Return the number of channels of a sound stream +/// (1 = mono, 2 = stereo) +//////////////////////////////////////////////////////////// +unsigned int sfSoundStream_GetChannelsCount(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetChannelsCount(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate of a sound stream +//////////////////////////////////////////////////////////// +unsigned int sfSoundStream_GetSampleRate(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetSampleRate(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Set the pitch of a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_SetPitch(sfSoundStream* SoundStream, float Pitch) +{ + CSFML_CALL(SoundStream, SetPitch(Pitch)); +} + + +//////////////////////////////////////////////////////////// +/// Set the volume of a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume) +{ + CSFML_CALL(SoundStream, SetVolume(Volume)); +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z) +{ + CSFML_CALL(SoundStream, SetPosition(X, Y, Z)); +} + + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the sound stream at its maximum volume. +/// The default minimum distance is 1.0 +//////////////////////////////////////////////////////////// +void sfSoundStream_SetMinDistance(sfSoundStream* SoundStream, float MinDistance) +{ + CSFML_CALL(SoundStream, SetMinDistance(MinDistance)); +} + + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound stream will be attenuated with distance from listener. +/// The default attenuation factor 1.0 +//////////////////////////////////////////////////////////// +void sfSoundStream_SetAttenuation(sfSoundStream* SoundStream, float Attenuation) +{ + CSFML_CALL(SoundStream, SetAttenuation(Attenuation)); +} + + +//////////////////////////////////////////////////////////// +/// Set a stream loop state +//////////////////////////////////////////////////////////// +void sfSoundStream_SetLoop(sfSoundStream* SoundStream, sfBool Loop) +{ + CSFML_CALL(SoundStream, SetLoop(Loop == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Get the pitch of a sound stream +//////////////////////////////////////////////////////////// +float sfSoundStream_GetPitch(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetPitch(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the volume of a sound stream +//////////////////////////////////////////////////////////// +float sfSoundStream_GetVolume(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetVolume(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the position of a sound stream +//////////////////////////////////////////////////////////// +void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z) +{ + CSFML_CHECK(SoundStream); + + sf::Vector3f Position = SoundStream->This.GetPosition(); + if (X) *X = Position.x; + if (Y) *Y = Position.y; + if (Z) *Z = Position.z; +} + + +//////////////////////////////////////////////////////////// +/// Get the minimum distance of a sound stream +//////////////////////////////////////////////////////////// +float sfSoundStream_GetMinDistance(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetMinDistance(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor of a sound stream +//////////////////////////////////////////////////////////// +float sfSoundStream_GetAttenuation(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetAttenuation(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not a stream is looping +//////////////////////////////////////////////////////////// +sfBool sfSoundStream_GetLoop(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetLoop(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the current playing position of a sound stream +//////////////////////////////////////////////////////////// +float sfSoundStream_GetPlayingOffset(sfSoundStream* SoundStream) +{ + CSFML_CALL_RETURN(SoundStream, GetPlayingOffset(), 0.f); +} diff --git a/CSFML/src/SFML/Graphics/Color.cpp b/CSFML/src/SFML/Graphics/Color.cpp new file mode 100644 index 00000000..3c716bac --- /dev/null +++ b/CSFML/src/SFML/Graphics/Color.cpp @@ -0,0 +1,96 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Define some common colors +//////////////////////////////////////////////////////////// +sfColor sfBlack = { 0, 0, 0, 255}; +sfColor sfWhite = {255, 255, 255, 255}; +sfColor sfRed = {255, 0, 0, 255}; +sfColor sfGreen = { 0, 255, 0, 255}; +sfColor sfBlue = { 0, 0, 255, 255}; +sfColor sfYellow = {255, 255, 0, 255}; +sfColor sfMagenta = {255, 0, 255, 255}; +sfColor sfCyan = { 0, 255, 255, 255}; + + +//////////////////////////////////////////////////////////// +/// Construct a color from its 3 RGB components +//////////////////////////////////////////////////////////// +sfColor sfColor_FromRGB(sfUint8 R, sfUint8 G, sfUint8 B) +{ + return sfColor_FromRGBA(R, G, B, 255); +} + + +//////////////////////////////////////////////////////////// +/// Construct a color from its 4 RGBA components +//////////////////////////////////////////////////////////// +sfColor sfColor_FromRGBA(sfUint8 R, sfUint8 G, sfUint8 B, sfUint8 A) +{ + sfColor Color; + + Color.r = R; + Color.g = G; + Color.b = B; + Color.a = A; + + return Color; +} + + +//////////////////////////////////////////////////////////// +/// Add two colors +//////////////////////////////////////////////////////////// +sfColor sfColor_Add(sfColor Color1, sfColor Color2) +{ + int R = std::min(Color1.r + Color2.r, 255); + int G = std::min(Color1.g + Color2.g, 255); + int B = std::min(Color1.b + Color2.b, 255); + int A = std::min(Color1.a + Color2.a, 255); + + return sfColor_FromRGBA(static_cast(R), static_cast(G), static_cast(B), static_cast(A)); +} + + +//////////////////////////////////////////////////////////// +/// Modulate two colors +//////////////////////////////////////////////////////////// +sfColor sfColor_Modulate(sfColor Color1, sfColor Color2) +{ + int R = Color1.r * Color2.r / 255; + int G = Color1.g * Color2.g / 255; + int B = Color1.b * Color2.b / 255; + int A = Color1.a * Color2.a / 255; + + return sfColor_FromRGBA(static_cast(R), static_cast(G), static_cast(B), static_cast(A)); +} diff --git a/CSFML/src/SFML/Graphics/Font.cpp b/CSFML/src/SFML/Graphics/Font.cpp new file mode 100644 index 00000000..1eee46e8 --- /dev/null +++ b/CSFML/src/SFML/Graphics/Font.cpp @@ -0,0 +1,121 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfFont +{ + sf::Font This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new empty font +//////////////////////////////////////////////////////////// +sfFont* sfFont_Create() +{ + return new sfFont; +} + + +//////////////////////////////////////////////////////////// +/// Create a new font from a file +//////////////////////////////////////////////////////////// +sfFont* sfFont_CreateFromFile(const char* Filename, unsigned int CharSize, const sfUint32* Charset) +{ + sfFont* Font = new sfFont; + + bool bSucceeded = false; + if (Charset) + bSucceeded = Font->This.LoadFromFile(Filename, CharSize, Charset); + else + bSucceeded = Font->This.LoadFromFile(Filename, CharSize); + + if (!bSucceeded) + { + delete Font; + Font = NULL; + } + + return Font; +} + + +//////////////////////////////////////////////////////////// +/// Create a new font from a file in memory +//////////////////////////////////////////////////////////// +sfFont* sfFont_CreateFromMemory(const char* Data, size_t SizeInBytes, unsigned int CharSize, const sfUint32* Charset) +{ + sfFont* Font = new sfFont; + + bool bSucceeded = false; + if (Charset) + bSucceeded = Font->This.LoadFromMemory(Data, SizeInBytes, CharSize, Charset); + else + bSucceeded = Font->This.LoadFromMemory(Data, SizeInBytes, CharSize); + + if (!bSucceeded) + { + delete Font; + Font = NULL; + } + + return Font; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing font +//////////////////////////////////////////////////////////// +void sfFont_Destroy(sfFont* Font) +{ + delete Font; +} + + +//////////////////////////////////////////////////////////// +/// Get the base size of characters in a font; +/// All glyphs dimensions are based on this value +//////////////////////////////////////////////////////////// +unsigned int sfFont_GetCharacterSize(sfFont* Font) +{ + CSFML_CALL_RETURN(Font, GetCharacterSize(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the built-in default font (Arial) +//////////////////////////////////////////////////////////// +sfFont* sfFont_GetDefaultFont() +{ + static sfFont DefaultFont = {sf::Font::GetDefaultFont()}; + + return &DefaultFont; +} diff --git a/CSFML/src/SFML/Graphics/Image.cpp b/CSFML/src/SFML/Graphics/Image.cpp new file mode 100644 index 00000000..06af943b --- /dev/null +++ b/CSFML/src/SFML/Graphics/Image.cpp @@ -0,0 +1,268 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Window/Input.h +struct sfInput +{ + const sf::Input* This; +}; +// WARNING : this structure must always be the SAME as in Graphics/View.h +struct sfView +{ + sf::View* This; +}; +// WARNING : this structure must always be the SAME as in Graphics/RenderWindow.h +struct sfRenderWindow +{ + sf::RenderWindow This; + sfInput Input; + sfView DefaultView; + sfView* CurrentView; +}; + +struct sfImage +{ + sf::Image This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new empty image +//////////////////////////////////////////////////////////// +sfImage* sfImage_Create() +{ + return new sfImage; +} + + +//////////////////////////////////////////////////////////// +/// Create a new image filled with a color +//////////////////////////////////////////////////////////// +sfImage* sfImage_CreateFromColor(unsigned int Width, unsigned int Height, sfColor Color) +{ + sfImage* Image = new sfImage; + + if (!Image->This.Create(Width, Height, sf::Color(Color.r, Color.g, Color.b, Color.a))) + { + delete Image; + Image = NULL; + } + + return Image; +} + + +//////////////////////////////////////////////////////////// +/// Create a new image from an array of pixels in memory +//////////////////////////////////////////////////////////// +sfImage* sfImage_CreateFromPixels(unsigned int Width, unsigned int Height, const sfUint8* Data) +{ + sfImage* Image = new sfImage; + + if (!Image->This.LoadFromPixels(Width, Height, Data)) + { + delete Image; + Image = NULL; + } + + return Image; +} + + +//////////////////////////////////////////////////////////// +/// Create a new image from a file +//////////////////////////////////////////////////////////// +sfImage* sfImage_CreateFromFile(const char* Filename) +{ + sfImage* Image = new sfImage; + + if (!Image->This.LoadFromFile(Filename)) + { + delete Image; + Image = NULL; + } + + return Image; +} + + +//////////////////////////////////////////////////////////// +/// Create a new image from a file in memory +//////////////////////////////////////////////////////////// +sfImage* sfImage_CreateFromMemory(const char* Data, size_t SizeInBytes) +{ + sfImage* Image = new sfImage; + + if (!Image->This.LoadFromMemory(Data, SizeInBytes)) + { + delete Image; + Image = NULL; + } + + return Image; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing image +//////////////////////////////////////////////////////////// +void sfImage_Destroy(sfImage* Image) +{ + delete Image; +} + + +//////////////////////////////////////////////////////////// +/// Save the content of an image to a file +//////////////////////////////////////////////////////////// +sfBool sfImage_SaveToFile(sfImage* Image, const char* Filename) +{ + CSFML_CALL_RETURN(Image, SaveToFile(Filename), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Create a transparency mask for an image from a specified colorkey +//////////////////////////////////////////////////////////// +void sfImage_CreateMaskFromColor(sfImage* Image, sfColor ColorKey, sfUint8 Alpha) +{ + sf::Color SFMLColor(ColorKey.r, ColorKey.g, ColorKey.b, ColorKey.a); + CSFML_CALL(Image, CreateMaskFromColor(SFMLColor, Alpha)); +} + + +//////////////////////////////////////////////////////////// +/// Copy pixels from another image onto this one. +/// This function does a slow pixel copy and should only +/// be used at initialization time +//////////////////////////////////////////////////////////// +void sfImage_Copy(sfImage* Image, sfImage* Source, unsigned int DestX, unsigned int DestY, sfIntRect SourceRect) +{ + CSFML_CHECK(Source); + sf::IntRect SFMLRect(SourceRect.Left, SourceRect.Top, SourceRect.Right, SourceRect.Bottom); + CSFML_CALL(Image, Copy(Source->This, DestX, DestY, SFMLRect)); +} + + +//////////////////////////////////////////////////////////// +/// Create the image from the current contents of the +/// given window +//////////////////////////////////////////////////////////// +CSFML_API sfBool sfImage_CopyScreen(sfImage* Image, sfRenderWindow* Window, sfIntRect SourceRect) +{ + CSFML_CHECK_RETURN(Window, sfFalse); + sf::IntRect SFMLRect(SourceRect.Left, SourceRect.Top, SourceRect.Right, SourceRect.Bottom); + CSFML_CALL_RETURN(Image, CopyScreen(Window->This, SFMLRect), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Change the color of a pixel of an image +/// Don't forget to call Update when you end modifying pixels +//////////////////////////////////////////////////////////// +void sfImage_SetPixel(sfImage* Image, unsigned int X, unsigned int Y, sfColor Color) +{ + sf::Color SFMLColor(Color.r, Color.g, Color.b, Color.a); + CSFML_CALL(Image, SetPixel(X, Y, SFMLColor)); +} + + +//////////////////////////////////////////////////////////// +/// Get a pixel from an image +//////////////////////////////////////////////////////////// +sfColor sfImage_GetPixel(sfImage* Image, unsigned int X, unsigned int Y) +{ + sfColor Color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(Image, Color); + + sf::Color SFMLColor = Image->This.GetPixel(X, Y); + + return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); +} + + +//////////////////////////////////////////////////////////// +/// Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA) +/// Array size is sfImage_GetWidth() x sfImage_GetHeight() x 4 +/// This pointer becomes invalid if you reload or resize the image +//////////////////////////////////////////////////////////// +const sfUint8* sfImage_GetPixelsPtr(sfImage* Image) +{ + CSFML_CALL_RETURN(Image, GetPixelsPtr(), NULL); +} + + +//////////////////////////////////////////////////////////// +/// Bind the image for rendering +//////////////////////////////////////////////////////////// +void sfImage_Bind(sfImage* Image) +{ + CSFML_CALL(Image, Bind()); +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable image smooth filter +//////////////////////////////////////////////////////////// +void sfImage_SetSmooth(sfImage* Image, sfBool Smooth) +{ + CSFML_CALL(Image, SetSmooth(Smooth == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Return the width of the image +//////////////////////////////////////////////////////////// +unsigned int sfImage_GetWidth(sfImage* Image) +{ + CSFML_CALL_RETURN(Image, GetWidth(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Return the height of the image +//////////////////////////////////////////////////////////// +unsigned int sfImage_GetHeight(sfImage* Image) +{ + CSFML_CALL_RETURN(Image, GetHeight(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Tells whether the smoothing filter is enabled or not on an image +//////////////////////////////////////////////////////////// +sfBool sfImage_IsSmooth(sfImage* Image) +{ + CSFML_CALL_RETURN(Image, IsSmooth(), sfFalse); +} diff --git a/CSFML/src/SFML/Graphics/Makefile b/CSFML/src/SFML/Graphics/Makefile new file mode 100644 index 00000000..d5e1c83d --- /dev/null +++ b/CSFML/src/SFML/Graphics/Makefile @@ -0,0 +1,23 @@ +LIB = libcsfml-graphics.so +SRC = $(wildcard *.cpp) +OBJ = $(SRC:.cpp=.o) +LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + +all: $(LIB) + +libcsfml-graphics.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lsfml-graphics -lsfml-window -lsfml-system + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB)) diff --git a/CSFML/src/SFML/Graphics/PostFX.cpp b/CSFML/src/SFML/Graphics/PostFX.cpp new file mode 100644 index 00000000..b5bdf6bb --- /dev/null +++ b/CSFML/src/SFML/Graphics/PostFX.cpp @@ -0,0 +1,138 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Graphics/Image.h +struct sfImage +{ + sf::Image This; +}; +struct sfPostFX +{ + sf::PostFX This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new post-fx from a file +//////////////////////////////////////////////////////////// +sfPostFX* sfPostFX_CreateFromFile(const char* Filename) +{ + sfPostFX* PostFX = new sfPostFX; + + if (!PostFX->This.LoadFromFile(Filename)) + { + delete PostFX; + PostFX = NULL; + } + + return PostFX; +} + + +//////////////////////////////////////////////////////////// +/// Create a new post-fx from an effect source code +//////////////////////////////////////////////////////////// +sfPostFX* sfPostFX_CreateFromMemory(const char* Effect) +{ + sfPostFX* PostFX = new sfPostFX; + + if (!PostFX->This.LoadFromMemory(Effect)) + { + delete PostFX; + PostFX = NULL; + } + + return PostFX; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing post-fx +//////////////////////////////////////////////////////////// +void sfPostFX_Destroy(sfPostFX* PostFX) +{ + delete PostFX; +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (1 float) +//////////////////////////////////////////////////////////// +void sfPostFX_SetParameter1(sfPostFX* PostFX, const char* Name, float X) +{ + CSFML_CALL(PostFX, SetParameter(Name, X)) +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (2 floats) +//////////////////////////////////////////////////////////// +void sfPostFX_SetParameter2(sfPostFX* PostFX, const char* Name, float X, float Y) +{ + CSFML_CALL(PostFX, SetParameter(Name, X, Y)) +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (3 floats) +//////////////////////////////////////////////////////////// +void sfPostFX_SetParameter3(sfPostFX* PostFX, const char* Name, float X, float Y, float Z) +{ + CSFML_CALL(PostFX, SetParameter(Name, X, Y, Z)) +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of a post-fx (4 floats) +//////////////////////////////////////////////////////////// +void sfPostFX_SetParameter4(sfPostFX* PostFX, const char* Name, float X, float Y, float Z, float W) +{ + CSFML_CALL(PostFX, SetParameter(Name, X, Y, Z, W)) +} + + +//////////////////////////////////////////////////////////// +/// Set a texture parameter in a post-fx +//////////////////////////////////////////////////////////// +void sfPostFX_SetTexture(sfPostFX* PostFX, const char* Name, sfImage* Texture) +{ + CSFML_CALL(PostFX, SetTexture(Name, Texture ? &Texture->This : NULL)) +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the system supports post-effects +//////////////////////////////////////////////////////////// +sfBool sfPostFX_CanUsePostFX() +{ + return sf::PostFX::CanUsePostFX() ? sfTrue : sfFalse; +} diff --git a/CSFML/src/SFML/Graphics/Rect.cpp b/CSFML/src/SFML/Graphics/Rect.cpp new file mode 100644 index 00000000..d1f364e8 --- /dev/null +++ b/CSFML/src/SFML/Graphics/Rect.cpp @@ -0,0 +1,121 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Move a rectangle by the given offset +//////////////////////////////////////////////////////////// +void sfFloatRect_Offset(sfFloatRect* Rect, float OffsetX, float OffsetY) +{ + CSFML_CHECK(Rect) + Rect->Left += OffsetX; + Rect->Right += OffsetX; + Rect->Top += OffsetY; + Rect->Bottom += OffsetY; +} +void sfIntRect_Offset(sfIntRect* Rect, int OffsetX, int OffsetY) +{ + CSFML_CHECK(Rect) + Rect->Left += OffsetX; + Rect->Right += OffsetX; + Rect->Top += OffsetY; + Rect->Bottom += OffsetY; +} + + +//////////////////////////////////////////////////////////// +/// Check if a point is inside a rectangle's area +//////////////////////////////////////////////////////////// +sfBool sfFloatRect_Contains(sfFloatRect* Rect, float X, float Y) +{ + CSFML_CHECK_RETURN(Rect, sfFalse) + return sf::FloatRect(Rect->Left, Rect->Top, Rect->Right, Rect->Bottom).Contains(X, Y); +} +sfBool sfIntRect_Contains(sfIntRect* Rect, int X, int Y) +{ + CSFML_CHECK_RETURN(Rect, sfFalse) + return sf::IntRect(Rect->Left, Rect->Top, Rect->Right, Rect->Bottom).Contains(X, Y); +} + + +//////////////////////////////////////////////////////////// +/// Check intersection between two rectangles +//////////////////////////////////////////////////////////// +sfBool sfFloatRect_Intersects(sfFloatRect* Rect1, sfFloatRect* Rect2, sfFloatRect* OverlappingRect) +{ + CSFML_CHECK_RETURN(Rect1, sfFalse) + CSFML_CHECK_RETURN(Rect2, sfFalse) + + sf::FloatRect SFMLRect1(Rect1->Left, Rect1->Top, Rect1->Right, Rect1->Bottom); + sf::FloatRect SFMLRect2(Rect2->Left, Rect2->Top, Rect2->Right, Rect2->Bottom); + + if (OverlappingRect) + { + sf::FloatRect Overlap; + bool Intersect = SFMLRect1.Intersects(SFMLRect2, &Overlap); + + OverlappingRect->Left = Overlap.Left; + OverlappingRect->Top = Overlap.Top; + OverlappingRect->Right = Overlap.Right; + OverlappingRect->Bottom = Overlap.Bottom; + + return Intersect; + } + else + { + return SFMLRect1.Intersects(SFMLRect2); + } +} +sfBool sfIntRect_Intersects(sfIntRect* Rect1, sfIntRect* Rect2, sfIntRect* OverlappingRect) +{ + CSFML_CHECK_RETURN(Rect1, sfFalse) + CSFML_CHECK_RETURN(Rect2, sfFalse) + + sf::IntRect SFMLRect1(Rect1->Left, Rect1->Top, Rect1->Right, Rect1->Bottom); + sf::IntRect SFMLRect2(Rect2->Left, Rect2->Top, Rect2->Right, Rect2->Bottom); + + if (OverlappingRect) + { + sf::IntRect Overlap; + bool Intersect = SFMLRect1.Intersects(SFMLRect2, &Overlap); + + OverlappingRect->Left = Overlap.Left; + OverlappingRect->Top = Overlap.Top; + OverlappingRect->Right = Overlap.Right; + OverlappingRect->Bottom = Overlap.Bottom; + + return Intersect; + } + else + { + return SFMLRect1.Intersects(SFMLRect2); + } +} diff --git a/CSFML/src/SFML/Graphics/RenderWindow.cpp b/CSFML/src/SFML/Graphics/RenderWindow.cpp new file mode 100644 index 00000000..73cdf1d5 --- /dev/null +++ b/CSFML/src/SFML/Graphics/RenderWindow.cpp @@ -0,0 +1,497 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Graphics/PostFX.h +struct sfPostFX +{ + sf::PostFX This; +}; +// WARNING : this structure must always be the SAME as in Graphics/Shape.h +struct sfShape +{ + sf::Shape This; +}; +// WARNING : this structure must always be the SAME as in Graphics/Sprite.h +struct sfSprite +{ + sf::Sprite This; + sfImage* Image; + sfIntRect SubRect; +}; +// WARNING : this structure must always be the SAME as in Graphics/String.h +struct sfString +{ + sf::String This; + std::string Text; +}; +// WARNING : this structure must always be the SAME as in Graphics/Image.h +struct sfImage +{ + sf::Image This; +}; +// WARNING : this structure must always be the SAME as in Window/Input.h +struct sfInput +{ + const sf::Input* This; +}; +// WARNING : this structure must always be the SAME as in Graphics/View.h +struct sfView +{ + sf::View* This; +}; +struct sfRenderWindow +{ + sf::RenderWindow This; + sfInput Input; + sfView DefaultView; + sfView* CurrentView; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new renderwindow +//////////////////////////////////////////////////////////// +sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params) +{ + // Convert video mode + sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel); + + // Create the window + sfRenderWindow* RenderWindow = new sfRenderWindow; + sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel); + RenderWindow->This.Create(VideoMode, Title, Style, Settings); + RenderWindow->Input.This = &RenderWindow->This.GetInput(); + RenderWindow->DefaultView.This = &RenderWindow->This.GetDefaultView(); + RenderWindow->CurrentView = &RenderWindow->DefaultView; + + return RenderWindow; +} + + +//////////////////////////////////////////////////////////// +/// Construct a renderwindow from an existing control +//////////////////////////////////////////////////////////// +sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params) +{ + sfRenderWindow* RenderWindow = new sfRenderWindow; + sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel); + RenderWindow->This.Create(Handle, Settings); + RenderWindow->Input.This = &RenderWindow->This.GetInput(); + RenderWindow->DefaultView.This = &RenderWindow->This.GetDefaultView(); + RenderWindow->CurrentView = &RenderWindow->DefaultView; + + return RenderWindow; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing renderwindow +//////////////////////////////////////////////////////////// +void sfRenderWindow_Destroy(sfRenderWindow* RenderWindow) +{ + delete RenderWindow; +} + +//////////////////////////////////////////////////////////// +/// Close a renderwindow (but doesn't destroy the internal data) +//////////////////////////////////////////////////////////// +void sfRenderWindow_Close(sfRenderWindow* RenderWindow) +{ + CSFML_CALL(RenderWindow, Close()); +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not a renderwindow is opened +//////////////////////////////////////////////////////////// +sfBool sfRenderWindow_IsOpened(sfRenderWindow* RenderWindow) +{ + CSFML_CALL_RETURN(RenderWindow, IsOpened(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the width of the rendering region of a window +//////////////////////////////////////////////////////////// +unsigned int sfRenderWindow_GetWidth(sfRenderWindow* RenderWindow) +{ + CSFML_CALL_RETURN(RenderWindow, GetWidth(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the height of the rendering region of a window +//////////////////////////////////////////////////////////// +unsigned int sfRenderWindow_GetHeight(sfRenderWindow* RenderWindow) +{ + CSFML_CALL_RETURN(RenderWindow, GetHeight(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the creation settings of a window +//////////////////////////////////////////////////////////// +sfWindowSettings sfRenderWindow_GetSettings(sfRenderWindow* RenderWindow) +{ + sfWindowSettings Settings = {0, 0, 0}; + CSFML_CHECK_RETURN(RenderWindow, Settings); + + const sf::WindowSettings& Params = RenderWindow->This.GetSettings(); + Settings.DepthBits = Params.DepthBits; + Settings.StencilBits = Params.StencilBits; + Settings.AntialiasingLevel = Params.AntialiasingLevel; + + return Settings; +} + + + +//////////////////////////////////////////////////////////// +/// Get the event on top of events stack of a window, if any, and pop it +//////////////////////////////////////////////////////////// +sfBool sfRenderWindow_GetEvent(sfRenderWindow* RenderWindow, sfEvent* Event) +{ + CSFML_CHECK_RETURN(RenderWindow, sfFalse); + CSFML_CHECK_RETURN(Event, sfFalse); + + // Get the event + sf::Event SFMLEvent; + sfBool Ret = RenderWindow->This.GetEvent(SFMLEvent); + + // No event, return + if (!Ret) + return sfFalse; + + // Convert its type + Event->Type = static_cast(SFMLEvent.Type); + + // Fill its fields + switch (Event->Type) + { + case sfEvtResized : + Event->Size.Width = SFMLEvent.Size.Width; + Event->Size.Height = SFMLEvent.Size.Height; + break; + + case sfEvtTextEntered : + Event->Text.Unicode = SFMLEvent.Text.Unicode; + break; + + case sfEvtKeyReleased : + case sfEvtKeyPressed : + Event->Key.Code = static_cast(SFMLEvent.Key.Code); + Event->Key.Alt = SFMLEvent.Key.Alt ? sfTrue : sfFalse; + Event->Key.Control = SFMLEvent.Key.Control ? sfTrue : sfFalse; + Event->Key.Shift = SFMLEvent.Key.Shift ? sfTrue : sfFalse; + break; + + case sfEvtMouseWheelMoved : + Event->MouseWheel.Delta = SFMLEvent.MouseWheel.Delta; + break; + + case sfEvtMouseButtonPressed : + case sfEvtMouseButtonReleased : + Event->MouseButton.Button = static_cast(SFMLEvent.MouseButton.Button); + Event->MouseButton.X = SFMLEvent.MouseButton.X; + Event->MouseButton.Y = SFMLEvent.MouseButton.Y; + break; + + case sfEvtMouseMoved : + Event->MouseMove.X = SFMLEvent.MouseMove.X; + Event->MouseMove.Y = SFMLEvent.MouseMove.Y; + break; + + case sfEvtJoyButtonPressed : + case sfEvtJoyButtonReleased : + Event->JoyButton.JoystickId = SFMLEvent.JoyButton.JoystickId; + Event->JoyButton.Button = SFMLEvent.JoyButton.Button; + break; + + case sfEvtJoyMoved : + Event->JoyMove.JoystickId = SFMLEvent.JoyMove.JoystickId; + Event->JoyMove.Axis = static_cast(SFMLEvent.JoyMove.Axis); + Event->JoyMove.Position = SFMLEvent.JoyMove.Position; + break; + + default : + break; + } + + return sfTrue; +} + + +//////////////////////////////////////////////////////////// +/// Enable / disable vertical synchronization on a window +//////////////////////////////////////////////////////////// +void sfRenderWindow_UseVerticalSync(sfRenderWindow* RenderWindow, sfBool Enabled) +{ + CSFML_CALL(RenderWindow, UseVerticalSync(Enabled == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Show or hide the mouse cursor on a window +//////////////////////////////////////////////////////////// +void sfRenderWindow_ShowMouseCursor(sfRenderWindow* RenderWindow, sfBool Show) +{ + CSFML_CALL(RenderWindow, ShowMouseCursor(Show == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the mouse cursor on a window +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetCursorPosition(sfRenderWindow* RenderWindow, unsigned int Left, unsigned int Top) +{ + CSFML_CALL(RenderWindow, SetCursorPosition(Left, Top)); +} + + +//////////////////////////////////////////////////////////// +/// Change the position of a window on screen. +/// Only works for top-level windows +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetPosition(sfRenderWindow* RenderWindow, int Left, int Top) +{ + CSFML_CALL(RenderWindow, SetPosition(Left, Top)); +} + + +//////////////////////////////////////////////////////////// +/// Change the size of the rendering region of a window +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetSize(sfRenderWindow* RenderWindow, unsigned int Width, unsigned int Height) +{ + CSFML_CALL(RenderWindow, SetSize(Width, Height)) +} + + +//////////////////////////////////////////////////////////// +/// Show or hide a window +//////////////////////////////////////////////////////////// +void sfRenderWindow_Show(sfRenderWindow* RenderWindow, sfBool State) +{ + CSFML_CALL(RenderWindow, Show(State == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable automatic key-repeat for keydown events. +/// Automatic key-repeat is enabled by default +//////////////////////////////////////////////////////////// +void sfRenderWindow_EnableKeyRepeat(sfRenderWindow* RenderWindow, sfBool Enabled) +{ + CSFML_CALL(RenderWindow, EnableKeyRepeat(Enabled == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Change the window's icon +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetIcon(sfRenderWindow* RenderWindow, unsigned int Width, unsigned int Height, sfUint8* Pixels) +{ + CSFML_CALL(RenderWindow, SetIcon(Width, Height, Pixels)) +} + + +//////////////////////////////////////////////////////////// +/// Set a window as the current target for rendering +//////////////////////////////////////////////////////////// +sfBool sfRenderWindow_SetActive(sfRenderWindow* RenderWindow, sfBool Active) +{ + CSFML_CALL_RETURN(RenderWindow, SetActive(Active == sfTrue), sfFalse) +} + + +//////////////////////////////////////////////////////////// +/// Display a window on screen +//////////////////////////////////////////////////////////// +void sfRenderWindow_Display(sfRenderWindow* RenderWindow) +{ + CSFML_CALL(RenderWindow, Display()); +} + + +//////////////////////////////////////////////////////////// +/// Get the input manager of a window +//////////////////////////////////////////////////////////// +sfInput* sfRenderWindow_GetInput(sfRenderWindow* RenderWindow) +{ + CSFML_CHECK_RETURN(RenderWindow, NULL); + + return &RenderWindow->Input; +} + + +//////////////////////////////////////////////////////////// +/// Limit the framerate to a maximum fixed frequency for a window +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetFramerateLimit(sfRenderWindow* RenderWindow, unsigned int Limit) +{ + CSFML_CALL(RenderWindow, SetFramerateLimit(Limit)); +} + + +//////////////////////////////////////////////////////////// +/// Get time elapsed since last frame of a window +//////////////////////////////////////////////////////////// +float sfRenderWindow_GetFrameTime(sfRenderWindow* RenderWindow) +{ + CSFML_CALL_RETURN(RenderWindow, GetFrameTime(), 0.f); +} + + +//////////////////////////////////////////////////////////// +/// Change the joystick threshold, ie. the value below which +/// no move event will be generated +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* RenderWindow, float Threshold) +{ + CSFML_CALL(RenderWindow, SetJoystickThreshold(Threshold)); +} + + +//////////////////////////////////////////////////////////// +/// Draw something on a renderwindow +//////////////////////////////////////////////////////////// +void sfRenderWindow_DrawPostFX(sfRenderWindow* RenderWindow, sfPostFX* PostFX) +{ + CSFML_CHECK(PostFX); + CSFML_CALL(RenderWindow, Draw(PostFX->This)); +} +void sfRenderWindow_DrawShape(sfRenderWindow* RenderWindow, sfShape* Shape) +{ + CSFML_CHECK(Shape); + CSFML_CALL(RenderWindow, Draw(Shape->This)); +} +void sfRenderWindow_DrawSprite(sfRenderWindow* RenderWindow, sfSprite* Sprite) +{ + CSFML_CHECK(Sprite); + CSFML_CALL(RenderWindow, Draw(Sprite->This)); +} +void sfRenderWindow_DrawString(sfRenderWindow* RenderWindow, sfString* String) +{ + CSFML_CHECK(String); + CSFML_CALL(RenderWindow, Draw(String->This)); +} + + +//////////////////////////////////////////////////////////// +/// Save the content of a renderwindow to an image +//////////////////////////////////////////////////////////// +sfImage* sfRenderWindow_Capture(sfRenderWindow* RenderWindow) +{ + CSFML_CHECK_RETURN(RenderWindow, NULL); + + sfImage* Image = new sfImage; + Image->This = RenderWindow->This.Capture(); + + return Image; +} + +//////////////////////////////////////////////////////////// +/// Clear the screen with the given color +//////////////////////////////////////////////////////////// +void sfRenderWindow_Clear(sfRenderWindow* RenderWindow, sfColor Color) +{ + sf::Color SFMLColor(Color.r, Color.g, Color.b, Color.a); + + CSFML_CALL(RenderWindow, Clear(SFMLColor)); +} + + +//////////////////////////////////////////////////////////// +/// Change the current active view of a renderwindow +//////////////////////////////////////////////////////////// +void sfRenderWindow_SetView(sfRenderWindow* RenderWindow, sfView* View) +{ + CSFML_CHECK(View); + CSFML_CALL(RenderWindow, SetView(*View->This)); + RenderWindow->CurrentView = View; +} + + +//////////////////////////////////////////////////////////// +/// Get the current active view of a renderwindow +//////////////////////////////////////////////////////////// +const sfView* sfRenderWindow_GetView(sfRenderWindow* RenderWindow) +{ + CSFML_CHECK_RETURN(RenderWindow, NULL); + + return RenderWindow->CurrentView; +} + + +//////////////////////////////////////////////////////////// +/// Get the default view of a renderwindow +//////////////////////////////////////////////////////////// +sfView* sfRenderWindow_GetDefaultView(sfRenderWindow* RenderWindow) +{ + CSFML_CHECK_RETURN(RenderWindow, NULL); + + return &RenderWindow->DefaultView; +} + + +//////////////////////////////////////////////////////////// +/// Convert a point in window coordinates into view coordinates +//////////////////////////////////////////////////////////// +void sfRenderWindow_ConvertCoords(sfRenderWindow* RenderWindow, unsigned int WindowX, unsigned int WindowY, float* ViewX, float* ViewY, sfView* TargetView) +{ + CSFML_CHECK(RenderWindow); + + sf::Vector2f Point = RenderWindow->This.ConvertCoords(WindowX, WindowY, TargetView ? TargetView->This : NULL); + + if (ViewX) *ViewX = Point.x; + if (ViewY) *ViewY = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Tell SFML to preserve external OpenGL states, at the expense of +/// more CPU charge. Use this function if you don't want SFML +/// to mess up your own OpenGL states (if any). +/// Don't enable state preservation if not needed, as it will allow +/// SFML to do internal optimizations and improve performances. +/// This parameter is false by default +//////////////////////////////////////////////////////////// +void sfRenderWindow_PreserveOpenGLStates(sfRenderWindow* RenderWindow, sfBool Preserve) +{ + CSFML_CALL(RenderWindow, PreserveOpenGLStates(Preserve == sfTrue)); +} diff --git a/CSFML/src/SFML/Graphics/Shape.cpp b/CSFML/src/SFML/Graphics/Shape.cpp new file mode 100644 index 00000000..1aafe41b --- /dev/null +++ b/CSFML/src/SFML/Graphics/Shape.cpp @@ -0,0 +1,464 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +struct sfShape +{ + sf::Shape This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new shape +//////////////////////////////////////////////////////////// +sfShape* sfShape_Create() +{ + return new sfShape; +} + +//////////////////////////////////////////////////////////// +/// Create a new shape made of a single line +//////////////////////////////////////////////////////////// +sfShape* sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, sfColor Col, float Outline, sfColor OutlineCol) +{ + sf::Color Color(Col.r, Col.g, Col.b, Col.a); + sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + + sfShape* Shape = new sfShape; + Shape->This = sf::Shape::Line(P1X, P1Y, P2X, P2Y, Thickness, Color, Outline, OutlineColor); + return Shape; +} + + +//////////////////////////////////////////////////////////// +/// Create a new shape made of a single rectangle +//////////////////////////////////////////////////////////// +sfShape* sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, sfColor Col, float Outline, sfColor OutlineCol) +{ + sf::Color Color(Col.r, Col.g, Col.b, Col.a); + sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + + sfShape* Shape = new sfShape; + Shape->This = sf::Shape::Rectangle(P1X, P1Y, P2X, P2Y, Color, Outline, OutlineColor); + return Shape; +} + + +//////////////////////////////////////////////////////////// +/// Create a new shape made of a single circle +//////////////////////////////////////////////////////////// +sfShape* sfShape_CreateCircle(float X, float Y, float Radius, sfColor Col, float Outline, sfColor OutlineCol) +{ + sf::Color Color(Col.r, Col.g, Col.b, Col.a); + sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + + sfShape* Shape = new sfShape; + Shape->This = sf::Shape::Circle(X, Y, Radius, Color, Outline, OutlineColor); + return Shape; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing shape +//////////////////////////////////////////////////////////// +void sfShape_Destroy(sfShape* Shape) +{ + delete Shape; +} + + +//////////////////////////////////////////////////////////// +/// Set the X position of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetX(sfShape* Shape, float X) +{ + CSFML_CALL(Shape, SetX(X)) +} + + +//////////////////////////////////////////////////////////// +/// Set the Y position of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetY(sfShape* Shape, float Y) +{ + CSFML_CALL(Shape, SetY(Y)) +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetPosition(sfShape* Shape, float X, float Y) +{ + CSFML_CALL(Shape, SetPosition(sf::Vector2f(X, Y))) +} + + +//////////////////////////////////////////////////////////// +/// Set the horizontal scale of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetScaleX(sfShape* Shape, float Scale) +{ + CSFML_CALL(Shape, SetScaleX(Scale)) +} + + +//////////////////////////////////////////////////////////// +/// Set the vertical scale of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetScaleY(sfShape* Shape, float Scale) +{ + CSFML_CALL(Shape, SetScaleY(Scale)) +} + + +//////////////////////////////////////////////////////////// +/// Set the scale of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetScale(sfShape* Shape, float ScaleX, float ScaleY) +{ + CSFML_CALL(Shape, SetScale(sf::Vector2f(ScaleX, ScaleY))) +} + + +//////////////////////////////////////////////////////////// +/// Set the orientation of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetRotation(sfShape* Shape, float Rotation) +{ + CSFML_CALL(Shape, SetRotation(Rotation)) +} + + +//////////////////////////////////////////////////////////// +/// Set the center of a shape, in coordinates +/// relative to its left-top corner +//////////////////////////////////////////////////////////// +void sfShape_SetCenter(sfShape* Shape, float X, float Y) +{ + CSFML_CALL(Shape, SetCenter(sf::Vector2f(X, Y))) +} + + +//////////////////////////////////////////////////////////// +/// Set the color of a shape +//////////////////////////////////////////////////////////// +void sfShape_SetColor(sfShape* Shape, sfColor Color) +{ + CSFML_CALL(Shape, SetColor(sf::Color(Color.r, Color.g, Color.b, Color.a))) +} + + +//////////////////////////////////////////////////////////// +/// Set the blending mode for a shape +//////////////////////////////////////////////////////////// +void sfShape_SetBlendMode(sfShape* Shape, sfBlendMode Mode) +{ + CSFML_CALL(Shape, SetBlendMode(static_cast(Mode))) +} + + +//////////////////////////////////////////////////////////// +/// Get the X position of a shape +//////////////////////////////////////////////////////////// +float sfShape_GetX(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetPosition().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the Y position of a shape +//////////////////////////////////////////////////////////// +float sfShape_GetY(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetPosition().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the horizontal scale of a shape +//////////////////////////////////////////////////////////// +float sfShape_GetScaleX(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetScale().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the vertical scale of a shape +//////////////////////////////////////////////////////////// +float sfShape_GetScaleY(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetScale().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the orientation of a shape +//////////////////////////////////////////////////////////// +float sfShape_GetRotation(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetRotation(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the X position of the center a shape +//////////////////////////////////////////////////////////// +float sfShape_GetCenterX(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetCenter().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the Y position of the center a shape +//////////////////////////////////////////////////////////// +float sfShape_GetCenterY(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetCenter().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the color of a shape +//////////////////////////////////////////////////////////// +sfColor sfShape_GetColor(sfShape* Shape) +{ + sfColor Color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(Shape, Color) + + sf::Color SFMLColor = Shape->This.GetColor(); + return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); +} + + +//////////////////////////////////////////////////////////// +/// Get the current blending mode of a shape +//////////////////////////////////////////////////////////// +sfBlendMode sfShape_GetBlendMode(sfShape* Shape) +{ + CSFML_CHECK_RETURN(Shape, sfBlendNone) + + return static_cast(Shape->This.GetBlendMode()); +} + + +//////////////////////////////////////////////////////////// +/// Move a shape +//////////////////////////////////////////////////////////// +void sfShape_Move(sfShape* Shape, float OffsetX, float OffsetY) +{ + CSFML_CALL(Shape, Move(sf::Vector2f(OffsetX, OffsetY))) +} + + +//////////////////////////////////////////////////////////// +/// Scale a shape +//////////////////////////////////////////////////////////// +void sfShape_Scale(sfShape* Shape, float FactorX, float FactorY) +{ + CSFML_CALL(Shape, Scale(sf::Vector2f(FactorX, FactorY))) +} + + +//////////////////////////////////////////////////////////// +/// Rotate a shape +//////////////////////////////////////////////////////////// +void sfShape_Rotate(sfShape* Shape, float Angle) +{ + CSFML_CALL(Shape, Rotate(Angle)) +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into the shape's local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float* X, float* Y) +{ + CSFML_CHECK(Shape) + + sf::Vector2f Point = Shape->This.TransformToLocal(sf::Vector2f(PointX, PointY)); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from the shape's local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +void sfShape_TransformToGlobal(sfShape* Shape, float PointX, float PointY, float* X, float* Y) +{ + CSFML_CHECK(Shape) + + sf::Vector2f Point = Shape->This.TransformToGlobal(sf::Vector2f(PointX, PointY)); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Add a point to a shape +//////////////////////////////////////////////////////////// +void sfShape_AddPoint(sfShape* Shape, float X, float Y, sfColor Col, sfColor OutlineCol) +{ + sf::Color Color(Col.r, Col.g, Col.b, Col.a); + sf::Color OutlineColor(OutlineCol.r, OutlineCol.g, OutlineCol.b, OutlineCol.a); + + CSFML_CALL(Shape, AddPoint(X, Y, Color, OutlineColor)) +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable filling a shape. +/// Fill is enabled by default +//////////////////////////////////////////////////////////// +void sfShape_EnableFill(sfShape* Shape, sfBool Enable) +{ + CSFML_CALL(Shape, EnableFill(Enable == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable drawing a shape outline. +/// Outline is enabled by default +//////////////////////////////////////////////////////////// +void sfShape_EnableOutline(sfShape* Shape, sfBool Enable) +{ + CSFML_CALL(Shape, EnableOutline(Enable == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Change the width of a shape outline +//////////////////////////////////////////////////////////// +void sfShape_SetOutlineWidth(sfShape* Shape, float Width) +{ + CSFML_CALL(Shape, SetOutlineWidth(Width)) +} + + +//////////////////////////////////////////////////////////// +/// Get the width of a shape outline +//////////////////////////////////////////////////////////// +float sfShape_GetOutlineWidth(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetOutlineWidth(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the number of points composing a shape +//////////////////////////////////////////////////////////// +unsigned int sfShape_GetNbPoints(sfShape* Shape) +{ + CSFML_CALL_RETURN(Shape, GetNbPoints(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Get a point of a shape +//////////////////////////////////////////////////////////// +void sfShape_GetPointPosition(sfShape* Shape, unsigned int Index, float* X, float* Y) +{ + CSFML_CHECK(Shape) + + sf::Vector2f Point = Shape->This.GetPointPosition(Index); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Get a the color of a shape's point +//////////////////////////////////////////////////////////// +sfColor sfShape_GetPointColor(sfShape* Shape, unsigned int Index) +{ + sfColor Color = {255, 255, 255, 255}; + CSFML_CHECK_RETURN(Shape, Color) + + const sf::Color& SFMLColor = Shape->This.GetPointColor(Index); + Color.r = SFMLColor.r; + Color.g = SFMLColor.g; + Color.b = SFMLColor.b; + Color.a = SFMLColor.a; + + return Color; +} + + +//////////////////////////////////////////////////////////// +/// Get a the outline color of a shape's point +//////////////////////////////////////////////////////////// +sfColor sfShape_GetPointOutlineColor(sfShape* Shape, unsigned int Index) +{ + sfColor Color = {255, 255, 255, 255}; + CSFML_CHECK_RETURN(Shape, Color) + + const sf::Color& SFMLColor = Shape->This.GetPointOutlineColor(Index); + Color.r = SFMLColor.r; + Color.g = SFMLColor.g; + Color.b = SFMLColor.b; + Color.a = SFMLColor.a; + + return Color; +} + +//////////////////////////////////////////////////////////// +/// Set a the position of a shape's point +//////////////////////////////////////////////////////////// +void sfShape_SetPointPosition(sfShape* Shape, unsigned int Index, float X, float Y) +{ + CSFML_CALL(Shape, SetPointPosition(Index, X, Y)); +} + + +//////////////////////////////////////////////////////////// +/// Set a the color of a shape's point +//////////////////////////////////////////////////////////// +void sfShape_SetPointColor(sfShape* Shape, unsigned int Index, sfColor Color) +{ + CSFML_CALL(Shape, SetPointColor(Index, sf::Color(Color.r, Color.g, Color.b, Color.a))); +} + + +//////////////////////////////////////////////////////////// +/// Set a the outline color of a shape's point +//////////////////////////////////////////////////////////// +void sfShape_SetPointOutlineColor(sfShape* Shape, unsigned int Index, sfColor Color) +{ + CSFML_CALL(Shape, SetPointOutlineColor(Index, sf::Color(Color.r, Color.g, Color.b, Color.a))); +} diff --git a/CSFML/src/SFML/Graphics/Sprite.cpp b/CSFML/src/SFML/Graphics/Sprite.cpp new file mode 100644 index 00000000..d53edbd8 --- /dev/null +++ b/CSFML/src/SFML/Graphics/Sprite.cpp @@ -0,0 +1,407 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Graphics/Image.h +struct sfImage +{ + sf::Image This; +}; +struct sfSprite +{ + sf::Sprite This; + sfImage* Image; + sfIntRect SubRect; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new sprite +//////////////////////////////////////////////////////////// +sfSprite* sfSprite_Create() +{ + sfSprite* Sprite = new sfSprite; + Sprite->Image = NULL; + Sprite->SubRect.Left = Sprite->This.GetSubRect().Left; + Sprite->SubRect.Top = Sprite->This.GetSubRect().Top; + Sprite->SubRect.Right = Sprite->This.GetSubRect().Right; + Sprite->SubRect.Bottom = Sprite->This.GetSubRect().Bottom; + + return Sprite; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing sprite +//////////////////////////////////////////////////////////// +void sfSprite_Destroy(sfSprite* Sprite) +{ + delete Sprite; +} + + +//////////////////////////////////////////////////////////// +/// Set the X position of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetX(sfSprite* Sprite, float X) +{ + CSFML_CALL(Sprite, SetX(X)) +} + + +//////////////////////////////////////////////////////////// +/// Set the Y position of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetY(sfSprite* Sprite, float Y) +{ + CSFML_CALL(Sprite, SetY(Y)) +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetPosition(sfSprite* Sprite, float X, float Y) +{ + CSFML_CALL(Sprite, SetPosition(sf::Vector2f(X, Y))) +} + + +//////////////////////////////////////////////////////////// +/// Set the horizontal scale of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetScaleX(sfSprite* Sprite, float Scale) +{ + CSFML_CALL(Sprite, SetScaleX(Scale)) +} + + +//////////////////////////////////////////////////////////// +/// Set the vertical scale of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetScaleY(sfSprite* Sprite, float Scale) +{ + CSFML_CALL(Sprite, SetScaleY(Scale)) +} + + +//////////////////////////////////////////////////////////// +/// Set the scale of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetScale(sfSprite* Sprite, float ScaleX, float ScaleY) +{ + CSFML_CALL(Sprite, SetScale(sf::Vector2f(ScaleX, ScaleY))) +} + + +//////////////////////////////////////////////////////////// +/// Set the orientation of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetRotation(sfSprite* Sprite, float Rotation) +{ + CSFML_CALL(Sprite, SetRotation(Rotation)) +} + + +//////////////////////////////////////////////////////////// +/// Set the center of a sprite, in coordinates +/// relative to its left-top corner +//////////////////////////////////////////////////////////// +void sfSprite_SetCenter(sfSprite* Sprite, float X, float Y) +{ + CSFML_CALL(Sprite, SetCenter(sf::Vector2f(X, Y))) +} + + +//////////////////////////////////////////////////////////// +/// Set the color of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetColor(sfSprite* Sprite, sfColor Color) +{ + CSFML_CALL(Sprite, SetColor(sf::Color(Color.r, Color.g, Color.b, Color.a))) +} + + +//////////////////////////////////////////////////////////// +/// Set the blending mode for a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetBlendMode(sfSprite* Sprite, sfBlendMode Mode) +{ + CSFML_CALL(Sprite, SetBlendMode(static_cast(Mode))) +} + + +//////////////////////////////////////////////////////////// +/// Get the X position of a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetX(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetPosition().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the Y position of a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetY(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetPosition().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the horizontal scale of a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetScaleX(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetScale().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the vertical scale of a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetScaleY(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetScale().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the orientation of a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetRotation(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetRotation(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the X position of the center a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetCenterX(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetCenter().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the Y position of the center a sprite +//////////////////////////////////////////////////////////// +float sfSprite_GetCenterY(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetCenter().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the color of a sprite +//////////////////////////////////////////////////////////// +sfColor sfSprite_GetColor(sfSprite* Sprite) +{ + sfColor Color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(Sprite, Color) + + sf::Color SFMLColor = Sprite->This.GetColor(); + return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); +} + + +//////////////////////////////////////////////////////////// +/// Get the current blending mode of a sprite +//////////////////////////////////////////////////////////// +sfBlendMode sfSprite_GetBlendMode(sfSprite* Sprite) +{ + CSFML_CHECK_RETURN(Sprite, sfBlendNone) + + return static_cast(Sprite->This.GetBlendMode()); +} + + +//////////////////////////////////////////////////////////// +/// Move a sprite +//////////////////////////////////////////////////////////// +void sfSprite_Move(sfSprite* Sprite, float OffsetX, float OffsetY) +{ + CSFML_CALL(Sprite, Move(sf::Vector2f(OffsetX, OffsetY))) +} + + +//////////////////////////////////////////////////////////// +/// Scale a sprite +//////////////////////////////////////////////////////////// +void sfSprite_Scale(sfSprite* Sprite, float FactorX, float FactorY) +{ + CSFML_CALL(Sprite, Scale(sf::Vector2f(FactorX, FactorY))) +} + + +//////////////////////////////////////////////////////////// +/// Rotate a sprite +//////////////////////////////////////////////////////////// +void sfSprite_Rotate(sfSprite* Sprite, float Angle) +{ + CSFML_CALL(Sprite, Rotate(Angle)) +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into the sprite's local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y) +{ + CSFML_CHECK(Sprite) + + sf::Vector2f Point = Sprite->This.TransformToLocal(sf::Vector2f(PointX, PointY)); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from the sprite's local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +void sfSprite_TransformToGlobal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y) +{ + CSFML_CHECK(Sprite) + + sf::Vector2f Point = Sprite->This.TransformToGlobal(sf::Vector2f(PointX, PointY)); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Change the image of a sprite +//////////////////////////////////////////////////////////// +void sfSprite_SetImage(sfSprite* Sprite, sfImage* Image) +{ + if (Image) + { + CSFML_CALL(Sprite, SetImage(Image->This)) + Sprite->Image = Image; + } +} + + +//////////////////////////////////////////////////////////// +/// Set the sub-rectangle of a sprite inside the source image +//////////////////////////////////////////////////////////// +void sfSprite_SetSubRect(sfSprite* Sprite, sfIntRect SubRect) +{ + CSFML_CALL(Sprite, SetSubRect(sf::IntRect(SubRect.Left, SubRect.Top, SubRect.Right, SubRect.Bottom))) + Sprite->SubRect = SubRect; +} + + +//////////////////////////////////////////////////////////// +/// Resize a sprite (by changing its scale factors) +//////////////////////////////////////////////////////////// +void sfSprite_Resize(sfSprite* Sprite, float Width, float Height) +{ + CSFML_CALL(Sprite, Resize(sf::Vector2f(Width, Height))) +} + + +//////////////////////////////////////////////////////////// +/// Flip a sprite horizontally +//////////////////////////////////////////////////////////// +void sfSprite_FlipX(sfSprite* Sprite, sfBool Flipped) +{ + CSFML_CALL(Sprite, FlipX(Flipped == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Flip a sprite vertically +//////////////////////////////////////////////////////////// +void sfSprite_FlipY(sfSprite* Sprite, sfBool Flipped) +{ + CSFML_CALL(Sprite, FlipY(Flipped == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Get the source image of a sprite +//////////////////////////////////////////////////////////// +sfImage* sfSprite_GetImage(sfSprite* Sprite) +{ + CSFML_CHECK_RETURN(Sprite, NULL) + + return Sprite->Image; +} + + +//////////////////////////////////////////////////////////// +/// Get the sub-rectangle of a sprite inside the source image +//////////////////////////////////////////////////////////// +sfIntRect sfSprite_GetSubRect(sfSprite* Sprite) +{ + sfIntRect Rect = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(Sprite, Rect) + + return Sprite->SubRect; +} + + +//////////////////////////////////////////////////////////// +/// Get a sprite width +//////////////////////////////////////////////////////////// +float sfSprite_GetWidth(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetSize().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get a sprite height +//////////////////////////////////////////////////////////// +float sfSprite_GetHeight(sfSprite* Sprite) +{ + CSFML_CALL_RETURN(Sprite, GetSize().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the color of a given pixel in a sprite +//////////////////////////////////////////////////////////// +sfColor sfSprite_GetPixel(sfSprite* Sprite, unsigned int X, unsigned int Y) +{ + sfColor Color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(Sprite, Color) + + sf::Color SFMLColor = Sprite->This.GetPixel(X, Y); + return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); +} diff --git a/CSFML/src/SFML/Graphics/String.cpp b/CSFML/src/SFML/Graphics/String.cpp new file mode 100644 index 00000000..a9f3db47 --- /dev/null +++ b/CSFML/src/SFML/Graphics/String.cpp @@ -0,0 +1,436 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Graphics/Font.h +struct sfFont +{ + sf::Font This; +}; + +struct sfString +{ + sf::String This; + std::string Text; + sfFont* Font; + sfFloatRect Rect; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new string +//////////////////////////////////////////////////////////// +sfString* sfString_Create() +{ + sfString* String = new sfString; + String->Font = sfFont_GetDefaultFont(); + + return String; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing string +//////////////////////////////////////////////////////////// +void sfString_Destroy(sfString* String) +{ + delete String; +} + + +//////////////////////////////////////////////////////////// +/// Set the X position of a string +//////////////////////////////////////////////////////////// +void sfString_SetX(sfString* String, float X) +{ + CSFML_CALL(String, SetX(X)) +} + + +//////////////////////////////////////////////////////////// +/// Set the Y position of a string +//////////////////////////////////////////////////////////// +void sfString_SetY(sfString* String, float Y) +{ + CSFML_CALL(String, SetY(Y)) +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a string +//////////////////////////////////////////////////////////// +void sfString_SetPosition(sfString* String, float X, float Y) +{ + CSFML_CALL(String, SetPosition(sf::Vector2f(X, Y))) +} + + +//////////////////////////////////////////////////////////// +/// Set the horizontal scale of a string +//////////////////////////////////////////////////////////// +void sfString_SetScaleX(sfString* String, float Scale) +{ + CSFML_CALL(String, SetScaleX(Scale)) +} + + +//////////////////////////////////////////////////////////// +/// Set the vertical scale of a string +//////////////////////////////////////////////////////////// +void sfString_SetScaleY(sfString* String, float Scale) +{ + CSFML_CALL(String, SetScaleY(Scale)) +} + + +//////////////////////////////////////////////////////////// +/// Set the scale of a string +//////////////////////////////////////////////////////////// +void sfString_SetScale(sfString* String, float ScaleX, float ScaleY) +{ + CSFML_CALL(String, SetScale(sf::Vector2f(ScaleX, ScaleY))) +} + + +//////////////////////////////////////////////////////////// +/// Set the orientation of a string +//////////////////////////////////////////////////////////// +void sfString_SetRotation(sfString* String, float Rotation) +{ + CSFML_CALL(String, SetRotation(Rotation)) +} + + +//////////////////////////////////////////////////////////// +/// Set the center of a string, in coordinates +/// relative to its left-top corner +//////////////////////////////////////////////////////////// +void sfString_SetCenter(sfString* String, float X, float Y) +{ + CSFML_CALL(String, SetCenter(sf::Vector2f(X, Y))) +} + + +//////////////////////////////////////////////////////////// +/// Set the color of a string +//////////////////////////////////////////////////////////// +void sfString_SetColor(sfString* String, sfColor Color) +{ + CSFML_CALL(String, SetColor(sf::Color(Color.r, Color.g, Color.b, Color.a))) +} + + +//////////////////////////////////////////////////////////// +/// Set the blending mode for a string +//////////////////////////////////////////////////////////// +void sfString_SetBlendMode(sfString* String, sfBlendMode Mode) +{ + CSFML_CALL(String, SetBlendMode(static_cast(Mode))) +} + + +//////////////////////////////////////////////////////////// +/// Get the X position of a string +//////////////////////////////////////////////////////////// +float sfString_GetX(sfString* String) +{ + CSFML_CALL_RETURN(String, GetPosition().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the Y position of a string +//////////////////////////////////////////////////////////// +float sfString_GetY(sfString* String) +{ + CSFML_CALL_RETURN(String, GetPosition().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the horizontal scale of a string +//////////////////////////////////////////////////////////// +float sfString_GetScaleX(sfString* String) +{ + CSFML_CALL_RETURN(String, GetScale().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the vertical scale of a string +//////////////////////////////////////////////////////////// +float sfString_GetScaleY(sfString* String) +{ + CSFML_CALL_RETURN(String, GetScale().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the orientation of a string +//////////////////////////////////////////////////////////// +float sfString_GetRotation(sfString* String) +{ + CSFML_CALL_RETURN(String, GetRotation(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the X position of the center a string +//////////////////////////////////////////////////////////// +float sfString_GetCenterX(sfString* String) +{ + CSFML_CALL_RETURN(String, GetCenter().x, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the top Y of the center of a string +//////////////////////////////////////////////////////////// +float sfString_GetCenterY(sfString* String) +{ + CSFML_CALL_RETURN(String, GetCenter().y, 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the color of a string +//////////////////////////////////////////////////////////// +sfColor sfString_GetColor(sfString* String) +{ + sfColor Color = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(String, Color) + + sf::Color SFMLColor = String->This.GetColor(); + return sfColor_FromRGBA(SFMLColor.r, SFMLColor.g, SFMLColor.b, SFMLColor.a); +} + + +//////////////////////////////////////////////////////////// +/// Get the current blending mode of a string +//////////////////////////////////////////////////////////// +sfBlendMode sfString_GetBlendMode(sfString* String) +{ + CSFML_CHECK_RETURN(String, sfBlendNone) + + return static_cast(String->This.GetBlendMode()); +} + + +//////////////////////////////////////////////////////////// +/// Move a string +//////////////////////////////////////////////////////////// +void sfString_Move(sfString* String, float OffsetX, float OffsetY) +{ + CSFML_CALL(String, Move(sf::Vector2f(OffsetX, OffsetY))) +} + + +//////////////////////////////////////////////////////////// +/// Scale a string +//////////////////////////////////////////////////////////// +void sfString_Scale(sfString* String, float FactorX, float FactorY) +{ + CSFML_CALL(String, Scale(sf::Vector2f(FactorX, FactorY))) +} + + +//////////////////////////////////////////////////////////// +/// Rotate a string +//////////////////////////////////////////////////////////// +void sfString_Rotate(sfString* String, float Angle) +{ + CSFML_CALL(String, Rotate(Angle)) +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into the string's local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +void sfString_TransformToLocal(sfString* String, float PointX, float PointY, float* X, float* Y) +{ + CSFML_CHECK(String) + + sf::Vector2f Point = String->This.TransformToLocal(sf::Vector2f(PointX, PointY)); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from the string's local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +void sfString_TransformToGlobal(sfString* String, float PointX, float PointY, float* X, float* Y) +{ + CSFML_CHECK(String) + + sf::Vector2f Point = String->This.TransformToGlobal(sf::Vector2f(PointX, PointY)); + if (X) *X = Point.x; + if (Y) *Y = Point.y; +} + + +//////////////////////////////////////////////////////////// +/// Set the text of a string (from a multibyte string) +//////////////////////////////////////////////////////////// +void sfString_SetText(sfString* String, const char* Text) +{ + CSFML_CALL(String, SetText(Text)) +} + + +//////////////////////////////////////////////////////////// +/// Set the text of a string (from a unicode string) +//////////////////////////////////////////////////////////// +void sfString_SetUnicodeText(sfString* String, const sfUint32* Text) +{ + sf::Unicode::UTF32String UTF32Text = Text; + CSFML_CALL(String, SetText(UTF32Text)) +} + + +//////////////////////////////////////////////////////////// +/// Set the font of a string +//////////////////////////////////////////////////////////// +void sfString_SetFont(sfString* String, sfFont* Font) +{ + CSFML_CHECK(Font); + + CSFML_CALL(String, SetFont(Font->This)) + String->Font = Font; +} + + +//////////////////////////////////////////////////////////// +/// Set the size of a string +//////////////////////////////////////////////////////////// +void sfString_SetSize(sfString* String, float Size) +{ + CSFML_CALL(String, SetSize(Size)) +} + + +//////////////////////////////////////////////////////////// +/// Set the style of a string +//////////////////////////////////////////////////////////// +void sfString_SetStyle(sfString* String, unsigned long Style) +{ + CSFML_CALL(String, SetStyle(Style)) +} + + +//////////////////////////////////////////////////////////// +/// Get the text of a string (returns a unicode string) +//////////////////////////////////////////////////////////// +const sfUint32* sfString_GetUnicodeText(sfString* String) +{ + CSFML_CHECK_RETURN(String, NULL) + + return static_cast(String->This.GetText()).c_str(); +} + + +//////////////////////////////////////////////////////////// +/// Get the text of a string (returns an ANSI string) +//////////////////////////////////////////////////////////// +const char* sfString_GetText(sfString* String) +{ + CSFML_CHECK_RETURN(String, NULL) + + String->Text = String->This.GetText(); + + return String->Text.c_str(); +} + + +//////////////////////////////////////////////////////////// +/// Get the font used by a string +//////////////////////////////////////////////////////////// +sfFont* sfString_GetFont(sfString* String) +{ + CSFML_CHECK_RETURN(String, NULL) + + return String->Font; +} + + +//////////////////////////////////////////////////////////// +/// Get the size of the characters of a string +//////////////////////////////////////////////////////////// +float sfString_GetSize(sfString* String) +{ + CSFML_CALL_RETURN(String, GetSize(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Get the style of a string +//////////////////////////////////////////////////////////// +unsigned long sfString_GetStyle(sfString* String) +{ + CSFML_CALL_RETURN(String, GetStyle(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Return the visual position of the Index-th character of the string, +/// in coordinates relative to the string +/// (note : translation, center, rotation and scale are not applied) +//////////////////////////////////////////////////////////// +void sfString_GetCharacterPos(sfString* String, size_t Index, float* X, float* Y) +{ + CSFML_CHECK(String); + + sf::Vector2f Pos = String->This.GetCharacterPos(Index); + if (X) *X = Pos.x; + if (Y) *Y = Pos.y; +} + + +//////////////////////////////////////////////////////////// +/// Get the bounding rectangle of a string on screen +//////////////////////////////////////////////////////////// +sfFloatRect sfString_GetRect(sfString* String) +{ + sfFloatRect Rect = {0.f, 0.f, 0.f, 0.f}; + CSFML_CHECK_RETURN(String, Rect) + + sf::FloatRect SFMLRect = String->This.GetRect(); + String->Rect.Left = SFMLRect.Left; + String->Rect.Top = SFMLRect.Top; + String->Rect.Right = SFMLRect.Right; + String->Rect.Bottom = SFMLRect.Bottom; + + return String->Rect; +} diff --git a/CSFML/src/SFML/Graphics/View.cpp b/CSFML/src/SFML/Graphics/View.cpp new file mode 100644 index 00000000..40af230e --- /dev/null +++ b/CSFML/src/SFML/Graphics/View.cpp @@ -0,0 +1,175 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +struct sfView +{ + sfView() : This(new sf::View) {} + sfView(sfFloatRect Rect) : This(new sf::View(sf::FloatRect(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom))) {} + ~sfView() {delete This;} + + sf::View* This; // pointer needed for RenderView +}; + + +//////////////////////////////////////////////////////////// +/// Construct a default view (1000x1000) +//////////////////////////////////////////////////////////// +sfView* sfView_Create() +{ + return new sfView; +} + + +//////////////////////////////////////////////////////////// +/// Construct a view from a rectangle +//////////////////////////////////////////////////////////// +sfView* sfView_CreateFromRect(sfFloatRect Rect) +{ + return new sfView(Rect); +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing view +//////////////////////////////////////////////////////////// +void sfView_Destroy(sfView* View) +{ + delete View; +} + + +//////////////////////////////////////////////////////////// +/// Change the center of a view +//////////////////////////////////////////////////////////// +void sfView_SetCenter(sfView* View, float X, float Y) +{ + CSFML_CALL_PTR(View, SetCenter(X, Y)); +} + + +//////////////////////////////////////////////////////////// +/// Change the half-size of a view +//////////////////////////////////////////////////////////// +void sfView_SetHalfSize(sfView* View, float HalfWidth, float HalfHeight) +{ + CSFML_CALL_PTR(View, SetHalfSize(HalfWidth, HalfHeight)); +} + + +//////////////////////////////////////////////////////////// +/// Rebuild a view from a rectangle +//////////////////////////////////////////////////////////// +void sfView_SetFromRect(sfView* View, sfFloatRect ViewRect) +{ + CSFML_CALL_PTR(View, SetFromRect(sf::FloatRect(ViewRect.Left, ViewRect.Top, ViewRect.Right, ViewRect.Bottom))); +} + + +//////////////////////////////////////////////////////////// +/// Get the X coordinate of the center of a view +//////////////////////////////////////////////////////////// +float sfView_GetCenterX(sfView* View) +{ + CSFML_CHECK_RETURN(View, 0.f); + + return View->This->GetCenter().x; +} + + +//////////////////////////////////////////////////////////// +/// Get the Y coordinate of the center of a view +//////////////////////////////////////////////////////////// +float sfView_GetCenterY(sfView* View) +{ + CSFML_CHECK_RETURN(View, 0.f); + + return View->This->GetCenter().y; +} + + +//////////////////////////////////////////////////////////// +/// Get the half-width of the view +//////////////////////////////////////////////////////////// +float sfView_GetHalfSizeY(sfView* View) +{ + CSFML_CHECK_RETURN(View, 0.f); + + return View->This->GetHalfSize().x; +} + + +//////////////////////////////////////////////////////////// +/// Get the half-height of the view +//////////////////////////////////////////////////////////// +float sfView_GetHalfSizeX(sfView* View) +{ + CSFML_CHECK_RETURN(View, 0.f); + + return View->This->GetHalfSize().y; +} + + +//////////////////////////////////////////////////////////// +/// Get the bounding rectangle of a view +//////////////////////////////////////////////////////////// +sfFloatRect sfView_GetRect(sfView* View) +{ + sfFloatRect Rect = {0, 0, 0, 0}; + CSFML_CHECK_RETURN(View, Rect); + + sf::FloatRect SFMLRect = View->This->GetRect(); + Rect.Left = SFMLRect.Left; + Rect.Top = SFMLRect.Top; + Rect.Right = SFMLRect.Right; + Rect.Bottom = SFMLRect.Bottom; + + return Rect; +} + + +//////////////////////////////////////////////////////////// +/// Move a view +//////////////////////////////////////////////////////////// +void sfView_Move(sfView* View, float OffsetX, float OffsetY) +{ + CSFML_CALL_PTR(View, Move(OffsetX, OffsetY)); +} + + +//////////////////////////////////////////////////////////// +/// Resize a view rectangle to simulate a zoom / unzoom effect +//////////////////////////////////////////////////////////// +void sfView_Zoom(sfView* View, float Factor) +{ + CSFML_CALL_PTR(View, Zoom(Factor)); +} diff --git a/CSFML/src/SFML/Internal.h b/CSFML/src/SFML/Internal.h new file mode 100644 index 00000000..e7c96631 --- /dev/null +++ b/CSFML/src/SFML/Internal.h @@ -0,0 +1,104 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Define macros to check the validity of CSFML objects +// in debug run +//////////////////////////////////////////////////////////// +#include + +#ifndef NDEBUG + + #define CSFML_CHECK(Object) \ + if (Object == NULL) \ + { \ + fprintf(stderr, "SFML warning : trying to use a null " #Object " object\n"); \ + return; \ + } + + #define CSFML_CALL(Object, Function) \ + if (Object) \ + { \ + (Object->This.Function); \ + } \ + else \ + { \ + fprintf(stderr, "SFML warning : trying to use a null " #Object " object\n"); \ + } \ + + #define CSFML_CALL_PTR(Object, Function) \ + if (Object) \ + { \ + (Object->This->Function); \ + } \ + else \ + { \ + fprintf(stderr, "SFML warning : trying to use a null " #Object " object\n"); \ + } \ + + #define CSFML_CHECK_RETURN(Object, Default) \ + if (Object == NULL) \ + { \ + fprintf(stderr, "SFML warning : trying to use a null " #Object " object\n"); \ + return Default; \ + } + + #define CSFML_CALL_RETURN(Object, Function, Default) \ + if (Object) \ + { \ + return (Object->This.Function); \ + } \ + else \ + { \ + fprintf(stderr, "SFML warning : trying to use a null " #Object " object\n"); \ + return Default; \ + } \ + + #define CSFML_CALL_PTR_RETURN(Object, Function, Default) \ + if (Object) \ + { \ + return (Object->This->Function); \ + } \ + else \ + { \ + fprintf(stderr, "SFML warning : trying to use a null " #Object " object\n"); \ + return Default; \ + } \ + +#else + + #define CSFML_CHECK(Object) + + #define CSFML_CALL(Object, Function) (Object->This.Function); + + #define CSFML_CALL_PTR(Object, Function) (Object->This->Function); + + #define CSFML_CHECK_RETURN(Object, Default) + + #define CSFML_CALL_RETURN(Object, Function, Default) return (Object->This.Function); + + #define CSFML_CALL_PTR_RETURN(Object, Function, Default) return (Object->This->Function); + +#endif diff --git a/CSFML/src/SFML/Makefile b/CSFML/src/SFML/Makefile new file mode 100644 index 00000000..cd2f22e4 --- /dev/null +++ b/CSFML/src/SFML/Makefile @@ -0,0 +1,42 @@ +export CC = gcc +export CPP = g++ +export CFLAGS = -W -Wall -pedantic -fPIC -Wno-unused -I../.. -I../../../include -DNDEBUG -DCSFML_EXPORTS -O2 +export LDFLAGS = -shared +export LIBPATH = ../../../lib +export VERSION = 1.4 +export CP = cp +export LN = ln +export LNFLAGS = -s -f +export DESTDIR = /usr +export DESTLIBDIR = $(DESTDIR)/lib +export DESTINCDIR = $(DESTDIR)/include + +all: csfml-system csfml-window csfml-network csfml-graphics csfml-audio + +csfml-system: + @(cd ./System && $(MAKE)) + +csfml-window: + @(cd ./Window && $(MAKE)) + +csfml-network: + @(cd ./Network && $(MAKE)) + +csfml-graphics: + @(cd ./Graphics && $(MAKE)) + +csfml-audio: + @(cd ./Audio && $(MAKE)) + +.PHONY: clean mrproper + +clean: + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@) + +mrproper: clean + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@) + +install: + @(mkdir -p $(DESTLIBDIR)) + @(mkdir -p $(DESTINCDIR)) + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@ && $(CP) -r ../../../include/SFML/ $(DESTINCDIR)) diff --git a/CSFML/src/SFML/Network/Ftp.cpp b/CSFML/src/SFML/Network/Ftp.cpp new file mode 100644 index 00000000..53e15bf1 --- /dev/null +++ b/CSFML/src/SFML/Network/Ftp.cpp @@ -0,0 +1,396 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +struct sfFtpListingResponse +{ + sfFtpListingResponse(const sf::Ftp::ListingResponse& Response) : This(Response) {} + + sf::Ftp::ListingResponse This; +}; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp directory response +//////////////////////////////////////////////////////////// +void sfFtpListingResponse_Destroy(sfFtpListingResponse* FtpListingResponse) +{ + delete FtpListingResponse; +} + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +//////////////////////////////////////////////////////////// +sfBool sfFtpListingResponse_IsOk(sfFtpListingResponse* FtpListingResponse) +{ + CSFML_CALL_RETURN(FtpListingResponse, IsOk(), sfFalse); +} + +//////////////////////////////////////////////////////////// +/// Get the response status code +//////////////////////////////////////////////////////////// +sfFtpStatus sfFtpListingResponse_GetStatus(sfFtpListingResponse* FtpListingResponse) +{ + CSFML_CHECK_RETURN(FtpListingResponse, sfFtpInvalidResponse); + + return static_cast(FtpListingResponse->This.GetStatus()); +} + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +//////////////////////////////////////////////////////////// +const char* sfFtpListingResponse_GetMessage(sfFtpListingResponse* FtpListingResponse) +{ + CSFML_CHECK_RETURN(FtpListingResponse, NULL); + + return FtpListingResponse->This.GetMessage().c_str(); +} + +//////////////////////////////////////////////////////////// +/// Get the number of filenames in the listing +//////////////////////////////////////////////////////////// +size_t sfFtpListingResponse_GetCount(sfFtpListingResponse* FtpListingResponse) +{ + CSFML_CALL_RETURN(FtpListingResponse, GetCount(), 0); +} + +//////////////////////////////////////////////////////////// +/// Get the Index-th filename in the directory +//////////////////////////////////////////////////////////// +const char* sfFtpListingResponse_GetFilename(sfFtpListingResponse* FtpListingResponse, size_t Index) +{ + CSFML_CHECK_RETURN(FtpListingResponse, NULL); + + return FtpListingResponse->This.GetFilename(Index).c_str(); +} + + +struct sfFtpDirectoryResponse +{ + sfFtpDirectoryResponse(const sf::Ftp::DirectoryResponse& Response) : This(Response) {} + + sf::Ftp::DirectoryResponse This; +}; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp directory response +//////////////////////////////////////////////////////////// +void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* FtpDirectoryResponse) +{ + delete FtpDirectoryResponse; +} + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +//////////////////////////////////////////////////////////// +sfBool sfFtpDirectoryResponse_IsOk(sfFtpDirectoryResponse* FtpDirectoryResponse) +{ + CSFML_CALL_RETURN(FtpDirectoryResponse, IsOk(), sfFalse); +} + +//////////////////////////////////////////////////////////// +/// Get the response status code +//////////////////////////////////////////////////////////// +sfFtpStatus sfFtpDirectoryResponse_GetStatus(sfFtpDirectoryResponse* FtpDirectoryResponse) +{ + CSFML_CHECK_RETURN(FtpDirectoryResponse, sfFtpInvalidResponse); + + return static_cast(FtpDirectoryResponse->This.GetStatus()); +} + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +//////////////////////////////////////////////////////////// +const char* sfFtpDirectoryResponse_GetMessage(sfFtpDirectoryResponse* FtpDirectoryResponse) +{ + CSFML_CHECK_RETURN(FtpDirectoryResponse, NULL); + + return FtpDirectoryResponse->This.GetMessage().c_str(); +} + +//////////////////////////////////////////////////////////// +/// Get the directory returned in the response +//////////////////////////////////////////////////////////// +const char* sfFtpDirectoryResponse_GetDirectory(sfFtpDirectoryResponse* FtpDirectoryResponse) +{ + CSFML_CHECK_RETURN(FtpDirectoryResponse, NULL); + + return FtpDirectoryResponse->This.GetDirectory().c_str(); +} + + +struct sfFtpResponse +{ + sfFtpResponse(const sf::Ftp::Response& Response) : This(Response) {} + + sf::Ftp::Response This; +}; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp response +//////////////////////////////////////////////////////////// +void sfFtpResponse_Destroy(sfFtpResponse* FtpResponse) +{ + delete FtpResponse; +} + + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +//////////////////////////////////////////////////////////// +sfBool sfFtpResponse_IsOk(sfFtpResponse* FtpResponse) +{ + CSFML_CALL_RETURN(FtpResponse, IsOk(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the response status code +//////////////////////////////////////////////////////////// +sfFtpStatus sfFtpResponse_GetStatus(sfFtpResponse* FtpResponse) +{ + CSFML_CHECK_RETURN(FtpResponse, sfFtpInvalidResponse); + + return static_cast(FtpResponse->This.GetStatus()); +} + + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +//////////////////////////////////////////////////////////// +const char* sfFtpResponse_GetMessage(sfFtpResponse* FtpResponse) +{ + CSFML_CHECK_RETURN(FtpResponse, NULL); + + return FtpResponse->This.GetMessage().c_str(); +} + + +struct sfFtp +{ + sf::Ftp This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new Ftp +//////////////////////////////////////////////////////////// +sfFtp* sfFtp_Create() +{ + return new sfFtp; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Ftp +//////////////////////////////////////////////////////////// +void sfFtp_Destroy(sfFtp* Ftp) +{ + delete Ftp; +} + + +//////////////////////////////////////////////////////////// +/// Connect to the specified FTP server +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_Connect(sfFtp* Ftp, sfIPAddress Server, unsigned short Port, float Timeout) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + sf::IPAddress SFMLServer(Server.Address); + + return new sfFtpResponse(Ftp->This.Connect(SFMLServer, Port, Timeout)); +} + + +//////////////////////////////////////////////////////////// +/// Log in using anonymous account +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* Ftp) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.Login()); +} + + +//////////////////////////////////////////////////////////// +/// Log in using a username and a password +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_Login(sfFtp* Ftp, const char* UserName, const char* Password) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.Login(UserName ? UserName : "", Password ? Password : "")); +} + + +//////////////////////////////////////////////////////////// +/// Close the connection with FTP server +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_Disconnect(sfFtp* Ftp) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.Disconnect()); +} + + +//////////////////////////////////////////////////////////// +/// Send a null command just to prevent from being disconnected +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_KeepAlive(sfFtp* Ftp) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.KeepAlive()); +} + + +//////////////////////////////////////////////////////////// +/// Get the current working directory +//////////////////////////////////////////////////////////// +sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* Ftp) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpDirectoryResponse(Ftp->This.GetWorkingDirectory()); +} + + +//////////////////////////////////////////////////////////// +/// Get the contents of the given directory +/// (subdirectories and files) +//////////////////////////////////////////////////////////// +sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* Ftp, const char* Directory) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpListingResponse(Ftp->This.GetDirectoryListing(Directory ? Directory : "")); +} + + +//////////////////////////////////////////////////////////// +/// Change the current working directory +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* Ftp, const char* Directory) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.ChangeDirectory(Directory ? Directory : "")); +} + + +//////////////////////////////////////////////////////////// +/// Go to the parent directory of the current one +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_ParentDirectory(sfFtp* Ftp) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.ParentDirectory()); +} + + +//////////////////////////////////////////////////////////// +/// Create a new directory +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_MakeDirectory(sfFtp* Ftp, const char* Name) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.MakeDirectory(Name ? Name : "")); +} + + +//////////////////////////////////////////////////////////// +/// Remove an existing directory +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* Ftp, const char* Name) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.DeleteDirectory(Name ? Name : "")); +} + + +//////////////////////////////////////////////////////////// +/// Rename a file +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_RenameFile(sfFtp* Ftp, const char* File, const char* NewName) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.RenameFile(File ? File : "", NewName ? NewName : "")); +} + + +//////////////////////////////////////////////////////////// +/// Remove an existing file +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_DeleteFile(sfFtp* Ftp, const char* Name) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.DeleteFile(Name ? Name : "")); +} + + +//////////////////////////////////////////////////////////// +/// Download a file from the server +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_Download(sfFtp* Ftp, const char* DistantFile, const char* DestPath, sfFtpTransferMode Mode) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.Download(DistantFile ? DistantFile : "", + DestPath ? DestPath : "", + static_cast(Mode))); +} + + +//////////////////////////////////////////////////////////// +/// Upload a file to the server +//////////////////////////////////////////////////////////// +sfFtpResponse* sfFtp_Upload(sfFtp* Ftp, const char* LocalFile, const char* DestPath, sfFtpTransferMode Mode) +{ + CSFML_CHECK_RETURN(Ftp, NULL); + + return new sfFtpResponse(Ftp->This.Upload(LocalFile ? LocalFile : "", + DestPath ? DestPath : "", + static_cast(Mode))); +} diff --git a/CSFML/src/SFML/Network/Http.cpp b/CSFML/src/SFML/Network/Http.cpp new file mode 100644 index 00000000..1b8fe9ed --- /dev/null +++ b/CSFML/src/SFML/Network/Http.cpp @@ -0,0 +1,231 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfHttpRequest +{ + sf::Http::Request This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new Http request +//////////////////////////////////////////////////////////// +sfHttpRequest* sfHttpRequest_Create() +{ + return new sfHttpRequest; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Http request +//////////////////////////////////////////////////////////// +void sfHttpRequest_Destroy(sfHttpRequest* HttpRequest) +{ + delete HttpRequest; +} + + +//////////////////////////////////////////////////////////// +/// Set the value of a field; the field is added if it doesn't exist +//////////////////////////////////////////////////////////// +void sfHttpRequest_SetField(sfHttpRequest* HttpRequest, const char* Field, const char* Value) +{ + CSFML_CHECK(HttpRequest); + if (Field) + HttpRequest->This.SetField(Field, Value); +} + + +//////////////////////////////////////////////////////////// +/// Set the request method. +/// This parameter is sfHttpGet by default +//////////////////////////////////////////////////////////// +void sfHttpRequest_SetMethod(sfHttpRequest* HttpRequest, sfHttpMethod Method) +{ + CSFML_CALL(HttpRequest, SetMethod(static_cast(Method))); +} + + +//////////////////////////////////////////////////////////// +/// Set the target URI of the request. +/// This parameter is "/" by default +//////////////////////////////////////////////////////////// +void sfHttpRequest_SetURI(sfHttpRequest* HttpRequest, const char* URI) +{ + CSFML_CALL(HttpRequest, SetURI(URI ? URI : "")); +} + + +//////////////////////////////////////////////////////////// +/// Set the HTTP version of the request. +/// This parameter is 1.0 by default +//////////////////////////////////////////////////////////// +void sfHttpRequest_SetHttpVersion(sfHttpRequest* HttpRequest, unsigned int Major, unsigned int Minor) +{ + CSFML_CALL(HttpRequest, SetHttpVersion(Major, Minor)); +} + + +//////////////////////////////////////////////////////////// +/// Set the body of the request. This parameter is optional and +/// makes sense only for POST requests. +/// This parameter is empty by default +//////////////////////////////////////////////////////////// +void sfHttpRequest_SetBody(sfHttpRequest* HttpRequest, const char* Body) +{ + CSFML_CALL(HttpRequest, SetBody(Body ? Body : "")); +} + + +struct sfHttpResponse +{ + sf::Http::Response This; +}; + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Http response +//////////////////////////////////////////////////////////// +void sfHttpResponse_Destroy(sfHttpResponse* HttpResponse) +{ + delete HttpResponse; +} + + +//////////////////////////////////////////////////////////// +/// Get the value of a field; returns NULL if the field doesn't exist +//////////////////////////////////////////////////////////// +const char* sfHttpResponse_GetField(sfHttpResponse* HttpResponse, const char* Field) +{ + CSFML_CHECK_RETURN(HttpResponse, NULL); + if (!Field) + return NULL; + + return HttpResponse->This.GetField(Field).c_str(); +} + + +//////////////////////////////////////////////////////////// +/// Get the status of a response +//////////////////////////////////////////////////////////// +sfHttpStatus sfHttpResponse_GetStatus(sfHttpResponse* HttpResponse) +{ + CSFML_CHECK_RETURN(HttpResponse, sfHttpInvalidResponse); + + return static_cast(HttpResponse->This.GetStatus()); +} + + +//////////////////////////////////////////////////////////// +/// Get the major HTTP version of a response +//////////////////////////////////////////////////////////// +unsigned int sfHttpResponse_GetMajorVersion(sfHttpResponse* HttpResponse) +{ + CSFML_CALL_RETURN(HttpResponse, GetMajorHttpVersion(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the minor HTTP version of a response +//////////////////////////////////////////////////////////// +unsigned int sfHttpResponse_GetMinorVersion(sfHttpResponse* HttpResponse) +{ + CSFML_CALL_RETURN(HttpResponse, GetMinorHttpVersion(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the body of the response. The body can contain : +/// - the requested page (for GET requests) +/// - a response from the server (for POST requests) +/// - nothing (for HEAD requests) +/// - an error message (in case of an error) +//////////////////////////////////////////////////////////// +const char* sfHttpResponse_GetBody(sfHttpResponse* HttpResponse) +{ + CSFML_CHECK_RETURN(HttpResponse, NULL); + + return HttpResponse->This.GetBody().c_str(); +} + + +struct sfHttp +{ + sf::Http This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new Http object +//////////////////////////////////////////////////////////// +sfHttp* sfHttp_Create() +{ + return new sfHttp; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing Http object +//////////////////////////////////////////////////////////// +void sfHttp_Destroy(sfHttp* Http) +{ + delete Http; +} + + +//////////////////////////////////////////////////////////// +/// Set the target host of a Http server +//////////////////////////////////////////////////////////// +void sfHttp_SetHost(sfHttp* Http, const char* Host, unsigned short Port) +{ + CSFML_CALL(Http, SetHost(Host ? Host : "", Port)); +} + + +//////////////////////////////////////////////////////////// +/// Send a HTTP request and return the server's response. +/// You must be connected to a host before sending requests. +/// Any missing mandatory header field will be added with an appropriate value. +/// Warning : this function waits for the server's response and may +/// not return instantly; use a thread if you don't want to block your +/// application. +//////////////////////////////////////////////////////////// +sfHttpResponse* sfHttp_SendRequest(sfHttp* Http, sfHttpRequest* Request, float Timeout) +{ + CSFML_CHECK_RETURN(Http, NULL); + CSFML_CHECK_RETURN(Request, NULL); + + sfHttpResponse* Response = new sfHttpResponse; + Response->This = Http->This.SendRequest(Request->This, Timeout); + + return Response; +} diff --git a/CSFML/src/SFML/Network/IPAddress.cpp b/CSFML/src/SFML/Network/IPAddress.cpp new file mode 100644 index 00000000..75be0391 --- /dev/null +++ b/CSFML/src/SFML/Network/IPAddress.cpp @@ -0,0 +1,138 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace +{ + //////////////////////////////////////////////////////////// + /// Helper function for converting a SFML address to a CSFML one + //////////////////////////////////////////////////////////// + sfIPAddress FromSFMLAddress(sf::IPAddress Address) + { + sfIPAddress Result; + strncpy(Result.Address, Address.ToString().c_str(), 16); + + return Result; + } + + //////////////////////////////////////////////////////////// + /// Helper function for converting a CSFML address to a SFML one + //////////////////////////////////////////////////////////// + sf::IPAddress ToSFMLAddress(sfIPAddress Address) + { + return sf::IPAddress(Address.Address); + } +} + + +//////////////////////////////////////////////////////////// +/// Construct an address from a string +//////////////////////////////////////////////////////////// +sfIPAddress sfIPAddress_FromString(const char* String) +{ + return FromSFMLAddress(sf::IPAddress(String)); +} + + +//////////////////////////////////////////////////////////// +/// Construct an address from 4 bytes +//////////////////////////////////////////////////////////// +sfIPAddress sfIPAddress_FromBytes(sfUint8 Byte0, sfUint8 Byte1, sfUint8 Byte2, sfUint8 Byte3) +{ + return FromSFMLAddress(sf::IPAddress(Byte0, Byte1, Byte2, Byte3)); +} + + +//////////////////////////////////////////////////////////// +/// Construct the address from a 32-bits integer +//////////////////////////////////////////////////////////// +sfIPAddress sfIPAddress_FromInteger(sfUint32 Address) +{ + return FromSFMLAddress(sf::IPAddress(Address)); +} + + +//////////////////////////////////////////////////////////// +/// Tell if an address is a valid one +//////////////////////////////////////////////////////////// +sfBool sfIPAddress_IsValid(sfIPAddress Address) +{ + return ToSFMLAddress(Address).IsValid() ? sfTrue : sfFalse; +} + + +//////////////////////////////////////////////////////////// +/// Get a string representation of an address +//////////////////////////////////////////////////////////// +void sfIPAddress_ToString(sfIPAddress Address, char* String) +{ + if (String) + strcpy(String, Address.Address); +} + + +//////////////////////////////////////////////////////////// +/// Get an integer representation of the address +//////////////////////////////////////////////////////////// +sfUint32 sfIPAddress_ToInteger(sfIPAddress Address) +{ + return ToSFMLAddress(Address).ToInteger(); +} + + +//////////////////////////////////////////////////////////// +/// Get the computer's local IP address (from the LAN point of view) +//////////////////////////////////////////////////////////// +sfIPAddress sfIPAddress_GetLocalAddress() +{ + return FromSFMLAddress(sf::IPAddress::GetLocalAddress()); +} + + +//////////////////////////////////////////////////////////// +/// Get the computer's public IP address (from the web point of view). +/// The only way to get a public address is to ask it to a +/// distant website ; as a consequence, this function may be +/// very slow -- use it as few as possible ! +//////////////////////////////////////////////////////////// +sfIPAddress sfIPAddress_GetPublicAddress(float Timeout) +{ + return FromSFMLAddress(sf::IPAddress::GetPublicAddress(Timeout)); +} + + +//////////////////////////////////////////////////////////// +/// Get the computer's loopback address +//////////////////////////////////////////////////////////// +sfIPAddress sfIPAddress_LocalHost() +{ + return FromSFMLAddress(sf::IPAddress::LocalHost); +} diff --git a/CSFML/src/SFML/Network/Makefile b/CSFML/src/SFML/Network/Makefile new file mode 100644 index 00000000..924907e0 --- /dev/null +++ b/CSFML/src/SFML/Network/Makefile @@ -0,0 +1,23 @@ +LIB = libcsfml-network.so +SRC = $(wildcard *.cpp) +OBJ = $(SRC:.cpp=.o) +LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + +all: $(LIB) + +libcsfml-network.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lsfml-network + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB)) diff --git a/CSFML/src/SFML/Network/Packet.cpp b/CSFML/src/SFML/Network/Packet.cpp new file mode 100644 index 00000000..7c92d78f --- /dev/null +++ b/CSFML/src/SFML/Network/Packet.cpp @@ -0,0 +1,204 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfPacket +{ + sf::Packet This; +}; + + +namespace +{ + //////////////////////////////////////////////////////////// + /// Helper function to read a variable from a packet + //////////////////////////////////////////////////////////// + template + T PacketRead(sfPacket* Packet, T Default = 0) + { + CSFML_CHECK_RETURN(Packet, Default); + + T Value; + Packet->This >> Value; + return Value; + } + + //////////////////////////////////////////////////////////// + /// Helper function to write a variable to a packet + //////////////////////////////////////////////////////////// + template + void PacketWrite(sfPacket* Packet, T Value) + { + CSFML_CHECK(Packet); + + Packet->This << Value; + } +} + + +//////////////////////////////////////////////////////////// +/// Create a new empty packet +//////////////////////////////////////////////////////////// +sfPacket* sfPacket_Create() +{ + return new sfPacket; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing packet +//////////////////////////////////////////////////////////// +void sfPacket_Destroy(sfPacket* Packet) +{ + delete Packet; +} + + +//////////////////////////////////////////////////////////// +/// Append data to the end of a packet +//////////////////////////////////////////////////////////// +void sfPacket_Append(sfPacket* Packet, void* Data, size_t SizeInBytes) +{ + CSFML_CALL(Packet, Append(Data, SizeInBytes)); +} + + +//////////////////////////////////////////////////////////// +/// Clear all the data of a packet +/////////////////////////////////////////////////////////// +void sfPacket_Clear(sfPacket* Packet) +{ + CSFML_CALL(Packet, Clear()); +} + + +//////////////////////////////////////////////////////////// +/// Get a pointer to the data contained in a packet +/// Warning : the returned pointer may be invalid after you +/// append data to the packet +//////////////////////////////////////////////////////////// +const char* sfPacket_GetData(sfPacket* Packet) +{ + CSFML_CALL_RETURN(Packet, GetData(), NULL); +} + + +//////////////////////////////////////////////////////////// +/// Get the size of the data contained in a packet +//////////////////////////////////////////////////////////// +size_t sfPacket_GetDataSize(sfPacket* Packet) +{ + CSFML_CALL_RETURN(Packet, GetDataSize(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Tell if the reading position has reached the end of the packet +//////////////////////////////////////////////////////////// +sfBool sfPacket_EndOfPacket(sfPacket* Packet) +{ + CSFML_CALL_RETURN(Packet, EndOfPacket(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Check if a packet is in a valid reading state +//////////////////////////////////////////////////////////// +sfBool sfPacket_CanRead(sfPacket* Packet) +{ + CSFML_CALL_RETURN(Packet, operator bool(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Functions to extract data from a packet +/// +/// \param Packet : Packet to read +/// +//////////////////////////////////////////////////////////// +sfBool sfPacket_ReadBool(sfPacket* Packet) {return PacketRead(Packet);} +sfInt8 sfPacket_ReadInt8(sfPacket* Packet) {return PacketRead(Packet);} +sfUint8 sfPacket_ReadUint8(sfPacket* Packet) {return PacketRead(Packet);} +sfInt16 sfPacket_ReadInt16(sfPacket* Packet) {return PacketRead(Packet);} +sfUint16 sfPacket_ReadUint16(sfPacket* Packet) {return PacketRead(Packet);} +sfInt32 sfPacket_ReadInt32(sfPacket* Packet) {return PacketRead(Packet);} +sfUint32 sfPacket_ReadUint32(sfPacket* Packet) {return PacketRead(Packet);} +float sfPacket_ReadFloat(sfPacket* Packet) {return PacketRead(Packet);} +double sfPacket_ReadDouble(sfPacket* Packet) {return PacketRead(Packet);} + +void sfPacket_ReadString(sfPacket* Packet, char* String) +{ + CSFML_CHECK(Packet); + + if (String) + Packet->This >> String; +} + +void sfPacket_ReadWideString(sfPacket* Packet, wchar_t* String) +{ + CSFML_CHECK(Packet); + + if (String) + Packet->This >> String; +} + + +//////////////////////////////////////////////////////////// +/// Functions to insert data into a packet +/// +/// \param Packet : Packet to write +/// +//////////////////////////////////////////////////////////// +void sfPacket_WriteBool(sfPacket* Packet, sfBool Value) {PacketWrite(Packet, static_cast(Value));} +void sfPacket_WriteInt8(sfPacket* Packet, sfInt8 Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteUint8(sfPacket* Packet, sfUint8 Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteInt16(sfPacket* Packet, sfInt16 Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteUint16(sfPacket* Packet, sfUint16 Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteInt32(sfPacket* Packet, sfInt32 Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteUint32(sfPacket* Packet, sfUint32 Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteFloat(sfPacket* Packet, float Value) {PacketWrite(Packet, Value);} +void sfPacket_WriteDouble(sfPacket* Packet, double Value) {PacketWrite(Packet, Value);} + +void sfPacket_WriteString(sfPacket* Packet, const char* String) +{ + CSFML_CHECK(Packet); + + if (String) + Packet->This << String; +} + +void sfPacket_WriteWideString(sfPacket* Packet, const wchar_t* String) +{ + CSFML_CHECK(Packet); + + if (String) + Packet->This << String; +} diff --git a/CSFML/src/SFML/Network/Selector.cpp b/CSFML/src/SFML/Network/Selector.cpp new file mode 100644 index 00000000..5a048476 --- /dev/null +++ b/CSFML/src/SFML/Network/Selector.cpp @@ -0,0 +1,114 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Network/SocketTCP.h +struct sfSocketTCP +{ + sf::SocketTCP This; +}; +// WARNING : this structure must always be the SAME as in Network/SocketUDP.h +struct sfSocketUDP +{ + sf::SocketUDP This; +}; +struct sfSelectorTCP +{ + sf::SelectorTCP This; + std::map Sockets; +}; +struct sfSelectorUDP +{ + sf::SelectorUDP This; + std::map Sockets; +}; + + + +//////////////////////////////////////////////////////////// +/// Create a new selector +//////////////////////////////////////////////////////////// +sfSelectorTCP* sfSelectorTCP_Create() {return new sfSelectorTCP;} +sfSelectorUDP* sfSelectorUDP_Create() {return new sfSelectorUDP;} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing selector +//////////////////////////////////////////////////////////// +void sfSelectorTCP_Destroy(sfSelectorTCP* Selector) {delete Selector;} +void sfSelectorUDP_Destroy(sfSelectorUDP* Selector) {delete Selector;} + + +//////////////////////////////////////////////////////////// +/// Add a socket to watch to a selector +//////////////////////////////////////////////////////////// +void sfSelectorTCP_Add(sfSelectorTCP* Selector, sfSocketTCP* Socket) {CSFML_CALL(Selector, Add(Socket->This)); Selector->Sockets[Socket->This] = Socket;} +void sfSelectorUDP_Add(sfSelectorUDP* Selector, sfSocketUDP* Socket) {CSFML_CALL(Selector, Add(Socket->This)); Selector->Sockets[Socket->This] = Socket;} + + +//////////////////////////////////////////////////////////// +/// Remove a socket from a selector +//////////////////////////////////////////////////////////// +void sfSelectorTCP_Remove(sfSelectorTCP* Selector, sfSocketTCP* Socket) {CSFML_CALL(Selector, Remove(Socket->This)); Selector->Sockets.erase(Socket->This);} +void sfSelectorUDP_Remove(sfSelectorUDP* Selector, sfSocketUDP* Socket) {CSFML_CALL(Selector, Remove(Socket->This)); Selector->Sockets.erase(Socket->This);} + + +//////////////////////////////////////////////////////////// +/// Remove all sockets from a selector +//////////////////////////////////////////////////////////// +void sfSelectorTCP_Clear(sfSelectorTCP* Selector) {CSFML_CALL(Selector, Clear()); Selector->Sockets.clear();} +void sfSelectorUDP_Clear(sfSelectorUDP* Selector) {CSFML_CALL(Selector, Clear()); Selector->Sockets.clear();} + +//////////////////////////////////////////////////////////// +/// Wait and collect sockets which are ready for reading. +/// This functions will return either when at least one socket +/// is ready, or when the given time is out +//////////////////////////////////////////////////////////// +unsigned int sfSelectorTCP_Wait(sfSelectorTCP* Selector, float Timeout) {CSFML_CALL_RETURN(Selector, Wait(Timeout), 0);} +unsigned int sfSelectorUDP_Wait(sfSelectorUDP* Selector, float Timeout) {CSFML_CALL_RETURN(Selector, Wait(Timeout), 0);} + + +//////////////////////////////////////////////////////////// +/// After a call to Wait(), get the Index-th socket which is +/// ready for reading. The total number of sockets ready +/// is the integer returned by the previous call to Wait() +//////////////////////////////////////////////////////////// +sfSocketTCP* sfSelectorTCP_GetSocketReady(sfSelectorTCP* Selector, unsigned int Index) +{ + CSFML_CHECK_RETURN(Selector, NULL); + return Selector->Sockets[Selector->This.GetSocketReady(Index)]; +} +sfSocketUDP* sfSelectorUDP_GetSocketReady(sfSelectorUDP* Selector, unsigned int Index) +{ + CSFML_CHECK_RETURN(Selector, NULL); + return Selector->Sockets[Selector->This.GetSocketReady(Index)]; +} diff --git a/CSFML/src/SFML/Network/SocketTCP.cpp b/CSFML/src/SFML/Network/SocketTCP.cpp new file mode 100644 index 00000000..815a1484 --- /dev/null +++ b/CSFML/src/SFML/Network/SocketTCP.cpp @@ -0,0 +1,192 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Network/Packet.h +struct sfPacket +{ + sf::Packet This; +}; + +struct sfSocketTCP +{ + sf::SocketTCP This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new TCP socket +//////////////////////////////////////////////////////////// +sfSocketTCP* sfSocketTCP_Create() +{ + return new sfSocketTCP; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing TCP socket +//////////////////////////////////////////////////////////// +void sfSocketTCP_Destroy(sfSocketTCP* Socket) +{ + if (Socket) + { + Socket->This.Close(); + delete Socket; + } +} + + +//////////////////////////////////////////////////////////// +/// Change the blocking state of a TCP socket. +/// The default behaviour of a socket is blocking +//////////////////////////////////////////////////////////// +void sfSocketTCP_SetBlocking(sfSocketTCP* Socket, sfBool Blocking) +{ + CSFML_CALL(Socket, SetBlocking(Blocking == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Connect a TCP socket to another computer on a specified port +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketTCP_Connect(sfSocketTCP* Socket, unsigned short Port, sfIPAddress HostAddress, float Timeout) +{ + sf::IPAddress Address(HostAddress.Address); + + CSFML_CHECK_RETURN(Socket, sfSocketError); + + return static_cast(Socket->This.Connect(Port, Address, Timeout)); +} + + +//////////////////////////////////////////////////////////// +/// Listen to a specified port for incoming data or connections +//////////////////////////////////////////////////////////// +sfBool sfSocketTCP_Listen(sfSocketTCP* Socket, unsigned short Port) +{ + CSFML_CALL_RETURN(Socket, Listen(Port), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Wait for a connection (must be listening to a port). +/// This function is blocking, ie. it won't return before +/// a connection has been accepted +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketTCP_Accept(sfSocketTCP* Socket, sfSocketTCP** Connected, sfIPAddress* Address) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(Connected, sfSocketError); + + // Call SFML internal function + sf::IPAddress ClientAddress; + sf::SocketTCP Client; + sf::Socket::Status Status = Socket->This.Accept(Client, &ClientAddress); + if (Status != sf::Socket::Done) + return static_cast(Status); + + // Convert the client socket returned + *Connected = sfSocketTCP_Create(); + (*Connected)->This = Client; + + // Convert the address if needed + if (Address) + strncpy(Address->Address, ClientAddress.ToString().c_str(), 16); + + return sfSocketDone; +} + + +//////////////////////////////////////////////////////////// +/// Send an array of bytes to the host (must be connected first) +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketTCP_Send(sfSocketTCP* Socket, const char* Data, size_t Size) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + + return static_cast(Socket->This.Send(Data, Size)); +} + + +//////////////////////////////////////////////////////////// +/// Receive an array of bytes from the host (must be connected first) +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketTCP_Receive(sfSocketTCP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + + if (SizeReceived) + { + return static_cast(Socket->This.Receive(Data, MaxSize, *SizeReceived)); + } + else + { + std::size_t Size = 0; + return static_cast(Socket->This.Receive(Data, MaxSize, Size)); + } +} + + +//////////////////////////////////////////////////////////// +/// Send a packet of data to the host (must be connected first) +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketTCP_SendPacket(sfSocketTCP* Socket, sfPacket* Packet) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(Packet, sfSocketError); + + return static_cast(Socket->This.Send(Packet->This)); +} + + +//////////////////////////////////////////////////////////// +/// Receive a packet from the host (must be connected first) +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketTCP_ReceivePacket(sfSocketTCP* Socket, sfPacket* Packet) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(Packet, sfSocketError); + + return static_cast(Socket->This.Receive(Packet->This)); +} + + +//////////////////////////////////////////////////////////// +/// Check if a socket is in a valid state ; this function +/// can be called any time to check if the socket is OK +//////////////////////////////////////////////////////////// +sfBool sfSocketTCP_IsValid(sfSocketTCP* Socket) +{ + CSFML_CALL_RETURN(Socket, IsValid(), sfFalse); +} diff --git a/CSFML/src/SFML/Network/SocketUDP.cpp b/CSFML/src/SFML/Network/SocketUDP.cpp new file mode 100644 index 00000000..89e551f7 --- /dev/null +++ b/CSFML/src/SFML/Network/SocketUDP.cpp @@ -0,0 +1,187 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Network/Packet.h +struct sfPacket +{ + sf::Packet This; +}; + +struct sfSocketUDP +{ + sf::SocketUDP This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new UDP socket +//////////////////////////////////////////////////////////// +sfSocketUDP* sfSocketUDP_Create() +{ + return new sfSocketUDP; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing UDP socket +//////////////////////////////////////////////////////////// +void sfSocketUDP_Destroy(sfSocketUDP* Socket) +{ + delete Socket; +} + + +//////////////////////////////////////////////////////////// +/// Change the blocking state of a UDP socket. +/// The default behaviour of a socket is blocking +//////////////////////////////////////////////////////////// +void sfSocketUDP_SetBlocking(sfSocketUDP* Socket, sfBool Blocking) +{ + CSFML_CALL(Socket, SetBlocking(Blocking == sfTrue)); +} + + +//////////////////////////////////////////////////////////// +/// Bind a socket to a specific port +//////////////////////////////////////////////////////////// +sfBool sfSocketUDP_Bind(sfSocketUDP* Socket, unsigned short Port) +{ + CSFML_CALL_RETURN(Socket, Bind(Port), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Unbind a socket from its previous port, if any +//////////////////////////////////////////////////////////// +sfBool sfSocketUDP_Unbind(sfSocketUDP* Socket) +{ + CSFML_CALL_RETURN(Socket, Unbind(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Send an array of bytes +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketUDP_Send(sfSocketUDP* Socket, const char* Data, size_t Size, sfIPAddress Address, unsigned short Port) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError) + + // Convert the address + sf::IPAddress Receiver(Address.Address); + + return static_cast(Socket->This.Send(Data, Size, Receiver, Port)); +} + + +//////////////////////////////////////////////////////////// +/// Receive an array of bytes. +/// This function is blocking, ie. it won't return before some +/// bytes have been received +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketUDP_Receive(sfSocketUDP* Socket, char* Data, size_t MaxSize, size_t* SizeReceived, sfIPAddress* Address, unsigned short* Port) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + + // Call SFML internal function + sf::IPAddress Sender; + unsigned short SenderPort; + std::size_t Received; + + sf::Socket::Status Status = Socket->This.Receive(Data, MaxSize, Received, Sender, SenderPort); + if (Status != sf::Socket::Done) + return static_cast(Status); + + if (SizeReceived) + *SizeReceived = Received; + + if (Address) + strncpy(Address->Address, Sender.ToString().c_str(), 16); + + if (Port) + *Port = SenderPort; + + return sfSocketDone; +} + + +//////////////////////////////////////////////////////////// +/// Send a packet of data +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketUDP_SendPacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress Address, unsigned short Port) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(Packet, sfSocketError); + + // Convert the address + sf::IPAddress Receiver(Address.Address); + + return static_cast(Socket->This.Send(Packet->This, Receiver, Port)); +} + + +//////////////////////////////////////////////////////////// +/// Receive a packet. +/// This function is blocking, ie. it won't return before a +/// packet is received +//////////////////////////////////////////////////////////// +sfSocketStatus sfSocketUDP_ReceivePacket(sfSocketUDP* Socket, sfPacket* Packet, sfIPAddress* Address, unsigned short* Port) +{ + CSFML_CHECK_RETURN(Socket, sfSocketError); + CSFML_CHECK_RETURN(Packet, sfSocketError); + + sf::IPAddress Sender; + unsigned short SenderPort; + sf::Socket::Status Status = Socket->This.Receive(Packet->This, Sender, SenderPort); + if (Status != sf::Socket::Done) + return static_cast(Status); + + if (Address) + strncpy(Address->Address, Sender.ToString().c_str(), 16); + + if (Port) + *Port = SenderPort; + + return sfSocketDone; +} + + +//////////////////////////////////////////////////////////// +/// Check if a socket is in a valid state ; this function +/// can be called any time to check if the socket is OK +//////////////////////////////////////////////////////////// +sfBool sfSocketUDP_IsValid(sfSocketUDP* Socket) +{ + CSFML_CALL_RETURN(Socket, IsValid(), sfFalse); +} diff --git a/CSFML/src/SFML/System/Clock.cpp b/CSFML/src/SFML/System/Clock.cpp new file mode 100644 index 00000000..87a2adfd --- /dev/null +++ b/CSFML/src/SFML/System/Clock.cpp @@ -0,0 +1,72 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfClock +{ + sf::Clock This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new clock and start it +//////////////////////////////////////////////////////////// +sfClock* sfClock_Create() +{ + return new sfClock; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing clock +//////////////////////////////////////////////////////////// +void sfClock_Destroy(sfClock* Clock) +{ + delete Clock; +} + + +//////////////////////////////////////////////////////////// +/// Get the time elapsed for a clock +//////////////////////////////////////////////////////////// +float sfClock_GetTime(sfClock* Clock) +{ + CSFML_CALL_RETURN(Clock, GetElapsedTime(), 0.f) +} + + +//////////////////////////////////////////////////////////// +/// Restart a clock +//////////////////////////////////////////////////////////// +void sfClock_Reset(sfClock* Clock) +{ + CSFML_CALL(Clock, Reset()) +} diff --git a/CSFML/src/SFML/System/Makefile b/CSFML/src/SFML/System/Makefile new file mode 100644 index 00000000..bdf1e4e5 --- /dev/null +++ b/CSFML/src/SFML/System/Makefile @@ -0,0 +1,23 @@ +LIB = libcsfml-system.so +SRC = $(wildcard *.cpp) +OBJ = $(SRC:.cpp=.o) +LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + +all: $(LIB) + +libcsfml-system.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lsfml-system + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB)) diff --git a/CSFML/src/SFML/System/Mutex.cpp b/CSFML/src/SFML/System/Mutex.cpp new file mode 100644 index 00000000..3686141f --- /dev/null +++ b/CSFML/src/SFML/System/Mutex.cpp @@ -0,0 +1,72 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfMutex +{ + sf::Mutex This; +}; + + +//////////////////////////////////////////////////////////// +/// Create a new mutex +//////////////////////////////////////////////////////////// +sfMutex* sfMutex_Create() +{ + return new sfMutex; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing mutex +//////////////////////////////////////////////////////////// +void sfMutex_Destroy(sfMutex* Mutex) +{ + delete Mutex; +} + + +//////////////////////////////////////////////////////////// +/// Lock a mutex +//////////////////////////////////////////////////////////// +void sfMutex_Lock(sfMutex* Mutex) +{ + CSFML_CALL(Mutex, Lock()) +} + + +//////////////////////////////////////////////////////////// +/// Unlock a mutex +//////////////////////////////////////////////////////////// +void sfMutex_Unlock(sfMutex* Mutex) +{ + CSFML_CALL(Mutex, Unlock()) +} diff --git a/CSFML/src/SFML/System/Randomizer.cpp b/CSFML/src/SFML/System/Randomizer.cpp new file mode 100644 index 00000000..b7b68f13 --- /dev/null +++ b/CSFML/src/SFML/System/Randomizer.cpp @@ -0,0 +1,67 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Set the seed for the random numbers generator. Using a known seed +/// allows you to reproduce the same sequence of random numbers +//////////////////////////////////////////////////////////// +void sfRandom_SetSeed(unsigned int Seed) +{ + sf::Randomizer::SetSeed(Seed); +} + + +//////////////////////////////////////////////////////////// +/// Get the seed used to generate random numbers the generator +//////////////////////////////////////////////////////////// +unsigned int sfRandom_GetSeed() +{ + return sf::Randomizer::GetSeed(); +} + + +//////////////////////////////////////////////////////////// +/// Get a random float number in a given range +//////////////////////////////////////////////////////////// +float sfRandom_Float(float Begin, float End) +{ + return sf::Randomizer::Random(Begin, End); +} + + +//////////////////////////////////////////////////////////// +/// Get a random integer number in a given range +//////////////////////////////////////////////////////////// +int sfRandom_Int(int Begin, int End) +{ + return sf::Randomizer::Random(Begin, End); +} diff --git a/CSFML/src/SFML/System/Sleep.cpp b/CSFML/src/SFML/System/Sleep.cpp new file mode 100644 index 00000000..e38d0a26 --- /dev/null +++ b/CSFML/src/SFML/System/Sleep.cpp @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Make the current thread sleep for a given time +//////////////////////////////////////////////////////////// +void sfSleep(float Duration) +{ + sf::Sleep(Duration); +} diff --git a/CSFML/src/SFML/System/Thread.cpp b/CSFML/src/SFML/System/Thread.cpp new file mode 100644 index 00000000..b8ac4c87 --- /dev/null +++ b/CSFML/src/SFML/System/Thread.cpp @@ -0,0 +1,86 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfThread +{ + sfThread(void (*Function)(void*), void* UserData) : This(Function, UserData) {} + + sf::Thread This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new thread from a function pointer +//////////////////////////////////////////////////////////// +sfThread* sfThread_Create(void (*Function)(void*), void* UserData) +{ + return new sfThread(Function, UserData); +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing thread +//////////////////////////////////////////////////////////// +void sfThread_Destroy(sfThread* Thread) +{ + delete Thread; +} + + +//////////////////////////////////////////////////////////// +/// Run a thread +//////////////////////////////////////////////////////////// +void sfThread_Launch(sfThread* Thread) +{ + CSFML_CALL(Thread, Launch()); +} + + +//////////////////////////////////////////////////////////// +/// Wait until a thread finishes +//////////////////////////////////////////////////////////// +void sfThread_Wait(sfThread* Thread) +{ + CSFML_CALL(Thread, Wait()); +} + + +//////////////////////////////////////////////////////////// +/// Terminate a thread +/// Terminating a thread with this function is not safe, +/// you should rather try to make the thread function +/// terminate by itself +//////////////////////////////////////////////////////////// +void sfThread_Terminate(sfThread* Thread) +{ + CSFML_CALL(Thread, Terminate()); +} diff --git a/CSFML/src/SFML/Window/Context.cpp b/CSFML/src/SFML/Window/Context.cpp new file mode 100644 index 00000000..5f4a77fc --- /dev/null +++ b/CSFML/src/SFML/Window/Context.cpp @@ -0,0 +1,63 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfContext +{ + sf::Context This; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new context +//////////////////////////////////////////////////////////// +sfContext* sfContext_Create() +{ + return new sfContext; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing context +//////////////////////////////////////////////////////////// +void sfContext_Destroy(sfContext* Context) +{ + delete Context; +} + + +//////////////////////////////////////////////////////////// +/// Activate or deactivate a context +//////////////////////////////////////////////////////////// +void sfContext_SetActive(sfContext* Context, sfBool Active) +{ + CSFML_CALL(Context, SetActive(Active == sfTrue)) +} diff --git a/CSFML/src/SFML/Window/Input.cpp b/CSFML/src/SFML/Window/Input.cpp new file mode 100644 index 00000000..ef314069 --- /dev/null +++ b/CSFML/src/SFML/Window/Input.cpp @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +struct sfInput +{ + const sf::Input* This; +}; + + +//////////////////////////////////////////////////////////// +/// Get the state of a key +//////////////////////////////////////////////////////////// +sfBool sfInput_IsKeyDown(sfInput* Input, sfKeyCode KeyCode) +{ + CSFML_CALL_PTR_RETURN(Input, IsKeyDown((sf::Key::Code)KeyCode), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the state of a mouse button +//////////////////////////////////////////////////////////// +sfBool sfInput_IsMouseButtonDown(sfInput* Input, sfMouseButton Button) +{ + CSFML_CALL_PTR_RETURN(Input, IsMouseButtonDown((sf::Mouse::Button)Button), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the state of a joystick button +//////////////////////////////////////////////////////////// +sfBool sfInput_IsJoystickButtonDown(sfInput* Input, unsigned int JoyId, unsigned int Button) +{ + CSFML_CALL_PTR_RETURN(Input, IsJoystickButtonDown(JoyId, Button), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the mouse X position +//////////////////////////////////////////////////////////// +int sfInput_GetMouseX(sfInput* Input) +{ + CSFML_CALL_PTR_RETURN(Input, GetMouseX(), 0); +} + + +//////////////////////////////////////////////////////////// +/// Get the mouse Y position +//////////////////////////////////////////////////////////// +int sfInput_GetMouseY(sfInput* Input) +{ + CSFML_CALL_PTR_RETURN(Input, GetMouseY(), 0); +} + +//////////////////////////////////////////////////////////// +/// Get the joystick position on a given axis +//////////////////////////////////////////////////////////// +float sfInput_GetJoystickAxis(sfInput* Input, unsigned int JoyId, sfJoyAxis Axis) +{ + CSFML_CALL_PTR_RETURN(Input, GetJoystickAxis(JoyId, (sf::Joy::Axis)Axis), 0.f); +} diff --git a/CSFML/src/SFML/Window/Makefile b/CSFML/src/SFML/Window/Makefile new file mode 100644 index 00000000..3bd276a4 --- /dev/null +++ b/CSFML/src/SFML/Window/Makefile @@ -0,0 +1,23 @@ +LIB = libcsfml-window.so +SRC = $(wildcard *.cpp) +OBJ = $(SRC:.cpp=.o) +LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + +all: $(LIB) + +libcsfml-window.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lsfml-window -lsfml-system + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB)) diff --git a/CSFML/src/SFML/Window/VideoMode.cpp b/CSFML/src/SFML/Window/VideoMode.cpp new file mode 100644 index 00000000..1acbdf54 --- /dev/null +++ b/CSFML/src/SFML/Window/VideoMode.cpp @@ -0,0 +1,82 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + + +//////////////////////////////////////////////////////////// +/// Get the current desktop video mode +//////////////////////////////////////////////////////////// +sfVideoMode sfVideoMode_GetDesktopMode() +{ + sf::VideoMode Desktop = sf::VideoMode::GetDesktopMode(); + sfVideoMode Ret; + Ret.Width = Desktop.Width; + Ret.Height = Desktop.Height; + Ret.BitsPerPixel = Desktop.BitsPerPixel; + + return Ret; +} + + +//////////////////////////////////////////////////////////// +/// Get a valid video mode +/// Index must be in range [0, GetModesCount()[ +/// Modes are sorted from best to worst +//////////////////////////////////////////////////////////// +sfVideoMode sfVideoMode_GetMode(size_t Index) +{ + sf::VideoMode Mode = sf::VideoMode::GetMode(Index); + sfVideoMode Ret; + Ret.Width = Mode.Width; + Ret.Height = Mode.Height; + Ret.BitsPerPixel = Mode.BitsPerPixel; + + return Ret; +} + + +//////////////////////////////////////////////////////////// +/// Get valid video modes count +//////////////////////////////////////////////////////////// +size_t sfVideoMode_GetModesCount() +{ + return sf::VideoMode::GetModesCount(); +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not a video mode is supported +//////////////////////////////////////////////////////////// +sfBool sfVideoMode_IsValid(sfVideoMode Mode) +{ + sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel); + return VideoMode.IsValid() ? sfTrue : sfFalse; +} diff --git a/CSFML/src/SFML/Window/Window.cpp b/CSFML/src/SFML/Window/Window.cpp new file mode 100644 index 00000000..90c056ac --- /dev/null +++ b/CSFML/src/SFML/Window/Window.cpp @@ -0,0 +1,344 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +// WARNING : this structure must always be the SAME as in Window/Input.h +struct sfInput +{ + const sf::Input* This; +}; +struct sfWindow +{ + sf::Window This; + sfInput Input; +}; + + +//////////////////////////////////////////////////////////// +/// Construct a new window +//////////////////////////////////////////////////////////// +sfWindow* sfWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params) +{ + // Convert video mode + sf::VideoMode VideoMode(Mode.Width, Mode.Height, Mode.BitsPerPixel); + + // Create the window + sfWindow* Window = new sfWindow; + sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel); + Window->This.Create(VideoMode, Title, Style, Settings); + Window->Input.This = &Window->This.GetInput(); + + return Window; +} + + +//////////////////////////////////////////////////////////// +/// Construct a window from an existing control +//////////////////////////////////////////////////////////// +sfWindow* sfWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params) +{ + sfWindow* Window = new sfWindow; + sf::WindowSettings Settings(Params.DepthBits, Params.StencilBits, Params.AntialiasingLevel); + Window->This.Create(Handle, Settings); + Window->Input.This = &Window->This.GetInput(); + + return Window; +} + + +//////////////////////////////////////////////////////////// +/// Destroy an existing window +//////////////////////////////////////////////////////////// +void sfWindow_Destroy(sfWindow* Window) +{ + delete Window; +} + +//////////////////////////////////////////////////////////// +/// Close a window (but doesn't destroy the internal data) +//////////////////////////////////////////////////////////// +void sfWindow_Close(sfWindow* Window) +{ + CSFML_CALL(Window, Close()); +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not a window is opened +//////////////////////////////////////////////////////////// +sfBool sfWindow_IsOpened(sfWindow* Window) +{ + CSFML_CALL_RETURN(Window, IsOpened(), sfFalse); +} + + +//////////////////////////////////////////////////////////// +/// Get the width of the rendering region of a window +//////////////////////////////////////////////////////////// +unsigned int sfWindow_GetWidth(sfWindow* Window) +{ + CSFML_CALL_RETURN(Window, GetWidth(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Get the height of the rendering region of a window +//////////////////////////////////////////////////////////// +unsigned int sfWindow_GetHeight(sfWindow* Window) +{ + CSFML_CALL_RETURN(Window, GetHeight(), 0) +} + + +//////////////////////////////////////////////////////////// +/// Get the creation settings of a window +//////////////////////////////////////////////////////////// +sfWindowSettings sfWindow_GetSettings(sfWindow* Window) +{ + sfWindowSettings Settings = {0, 0, 0}; + CSFML_CHECK_RETURN(Window, Settings); + + const sf::WindowSettings& Params = Window->This.GetSettings(); + Settings.DepthBits = Params.DepthBits; + Settings.StencilBits = Params.StencilBits; + Settings.AntialiasingLevel = Params.AntialiasingLevel; + + return Settings; +} + + +//////////////////////////////////////////////////////////// +/// Get the event on top of events stack of a window, if any, and pop it +//////////////////////////////////////////////////////////// +sfBool sfWindow_GetEvent(sfWindow* Window, sfEvent* Event) +{ + CSFML_CHECK_RETURN(Window, sfFalse); + CSFML_CHECK_RETURN(Event, sfFalse); + + // Get the event + sf::Event SFMLEvent; + sfBool Ret = Window->This.GetEvent(SFMLEvent); + + // No event, return + if (!Ret) + return sfFalse; + + // Convert its type + Event->Type = static_cast(SFMLEvent.Type); + + // Fill its fields + switch (Event->Type) + { + case sfEvtResized : + Event->Size.Width = SFMLEvent.Size.Width; + Event->Size.Height = SFMLEvent.Size.Height; + break; + + case sfEvtTextEntered : + Event->Text.Unicode = SFMLEvent.Text.Unicode; + break; + + case sfEvtKeyReleased : + case sfEvtKeyPressed : + Event->Key.Code = static_cast(SFMLEvent.Key.Code); + Event->Key.Alt = SFMLEvent.Key.Alt ? sfTrue : sfFalse; + Event->Key.Control = SFMLEvent.Key.Control ? sfTrue : sfFalse; + Event->Key.Shift = SFMLEvent.Key.Shift ? sfTrue : sfFalse; + break; + + case sfEvtMouseWheelMoved : + Event->MouseWheel.Delta = SFMLEvent.MouseWheel.Delta; + break; + + case sfEvtMouseButtonPressed : + case sfEvtMouseButtonReleased : + Event->MouseButton.Button = static_cast(SFMLEvent.MouseButton.Button); + Event->MouseButton.X = SFMLEvent.MouseButton.X; + Event->MouseButton.Y = SFMLEvent.MouseButton.Y; + break; + + case sfEvtMouseMoved : + Event->MouseMove.X = SFMLEvent.MouseMove.X; + Event->MouseMove.Y = SFMLEvent.MouseMove.Y; + break; + + case sfEvtJoyButtonPressed : + case sfEvtJoyButtonReleased : + Event->JoyButton.JoystickId = SFMLEvent.JoyButton.JoystickId; + Event->JoyButton.Button = SFMLEvent.JoyButton.Button; + break; + + case sfEvtJoyMoved : + Event->JoyMove.JoystickId = SFMLEvent.JoyMove.JoystickId; + Event->JoyMove.Axis = static_cast(SFMLEvent.JoyMove.Axis); + Event->JoyMove.Position = SFMLEvent.JoyMove.Position; + break; + + default : + break; + } + + return sfTrue; +} + + +//////////////////////////////////////////////////////////// +/// Enable / disable vertical synchronization on a window +//////////////////////////////////////////////////////////// +void sfWindow_UseVerticalSync(sfWindow* Window, sfBool Enabled) +{ + CSFML_CALL(Window, UseVerticalSync(Enabled == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Show or hide the mouse cursor on a window +//////////////////////////////////////////////////////////// +void sfWindow_ShowMouseCursor(sfWindow* Window, sfBool Show) +{ + CSFML_CALL(Window, ShowMouseCursor(Show == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the mouse cursor on a window +//////////////////////////////////////////////////////////// +void sfWindow_SetCursorPosition(sfWindow* Window, unsigned int Left, unsigned int Top) +{ + CSFML_CALL(Window, SetCursorPosition(Left, Top)) +} + + +//////////////////////////////////////////////////////////// +/// Change the position of a window on screen. +/// Only works for top-level windows +//////////////////////////////////////////////////////////// +void sfWindow_SetPosition(sfWindow* Window, int Left, int Top) +{ + CSFML_CALL(Window, SetPosition(Left, Top)) +} + + +//////////////////////////////////////////////////////////// +/// Change the size of the rendering region of a window +//////////////////////////////////////////////////////////// +void sfWindow_SetSize(sfWindow* Window, unsigned int Width, unsigned int Height) +{ + CSFML_CALL(Window, SetSize(Width, Height)) +} + + +//////////////////////////////////////////////////////////// +/// Show or hide a window +//////////////////////////////////////////////////////////// +void sfWindow_Show(sfWindow* Window, sfBool State) +{ + CSFML_CALL(Window, Show(State == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable automatic key-repeat for keydown events. +/// Automatic key-repeat is enabled by default +//////////////////////////////////////////////////////////// +void sfWindow_EnableKeyRepeat(sfWindow* Window, sfBool Enabled) +{ + CSFML_CALL(Window, EnableKeyRepeat(Enabled == sfTrue)) +} + + +//////////////////////////////////////////////////////////// +/// Change the window's icon +//////////////////////////////////////////////////////////// +void sfWindow_SetIcon(sfWindow* Window, unsigned int Width, unsigned int Height, sfUint8* Pixels) +{ + CSFML_CALL(Window, SetIcon(Width, Height, Pixels)) +} + + +//////////////////////////////////////////////////////////// +/// Activate or deactivate a window as the current target for rendering +//////////////////////////////////////////////////////////// +sfBool sfWindow_SetActive(sfWindow* Window, sfBool Active) +{ + CSFML_CALL_RETURN(Window, SetActive(Active == sfTrue), sfFalse) +} + + +//////////////////////////////////////////////////////////// +/// Display a window on screen +//////////////////////////////////////////////////////////// +void sfWindow_Display(sfWindow* Window) +{ + CSFML_CALL(Window, Display()) +} + + +//////////////////////////////////////////////////////////// +/// Get the input manager of a window +//////////////////////////////////////////////////////////// +sfInput* sfWindow_GetInput(sfWindow* Window) +{ + CSFML_CHECK_RETURN(Window, NULL); + + return &Window->Input; +} + + +//////////////////////////////////////////////////////////// +/// Limit the framerate to a maximum fixed frequency for a window +//////////////////////////////////////////////////////////// +void sfWindow_SetFramerateLimit(sfWindow* Window, unsigned int Limit) +{ + CSFML_CALL(Window, SetFramerateLimit(Limit)) +} + + +//////////////////////////////////////////////////////////// +/// Get time elapsed since last frame of a window +//////////////////////////////////////////////////////////// +float sfWindow_GetFrameTime(sfWindow* Window) +{ + CSFML_CALL_RETURN(Window, GetFrameTime(), 0.f) +} + +//////////////////////////////////////////////////////////// +/// Change the joystick threshold, ie. the value below which +/// no move event will be generated +/// +/// \param Threshold : New threshold, in range [0, 100] +/// +//////////////////////////////////////////////////////////// +void sfWindow_SetJoystickThreshold(sfWindow* Window, float Threshold) +{ + CSFML_CALL(Window, SetJoystickThreshold(Threshold)) +} diff --git a/DSFML/AUTHORS b/DSFML/AUTHORS new file mode 100644 index 00000000..266b2457 --- /dev/null +++ b/DSFML/AUTHORS @@ -0,0 +1,2 @@ +SirJulio (Dagorn Julien) => sirjulio13@gmail.com +Insomniak => insomniak.fr@gmail.com diff --git a/DSFML/LICENCE b/DSFML/LICENCE new file mode 100644 index 00000000..48844753 --- /dev/null +++ b/DSFML/LICENCE @@ -0,0 +1,18 @@ +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. diff --git a/DSFML/import/dsfml/audio/all.d b/DSFML/import/dsfml/audio/all.d new file mode 100644 index 00000000..f01177c1 --- /dev/null +++ b/DSFML/import/dsfml/audio/all.d @@ -0,0 +1,36 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.all; + +public import + dsfml.audio.listener, + dsfml.audio.music, + dsfml.audio.sound, + dsfml.audio.soundbuffer, + dsfml.audio.soundbufferrecorder, + dsfml.audio.soundrecorder, + dsfml.audio.soundstatus, + dsfml.audio.soundstream; diff --git a/DSFML/import/dsfml/audio/listener.d b/DSFML/import/dsfml/audio/listener.d new file mode 100644 index 00000000..80dd2077 --- /dev/null +++ b/DSFML/import/dsfml/audio/listener.d @@ -0,0 +1,184 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.listener; + +import dsfml.system.common; +import dsfml.system.vector3; + +/** +* Listener is a global interface for defining the audio +* listener properties ; the audio listener is the point in +* the scene from where all the sounds are heard. +* +* See_Also: +* SFML Tutorial for sound spatialization example. +*/ +class Listener +{ + + /** + * Change the global volume of all the sounds. + * The default volume is 100 + * + * Params: + * volume = New global volume, in the range [0, 100] + */ + static void setGlobalVolume(float volume) + in + { + assert (volume >= 0.f && volume <= 100.f); + } + body + { + sfListener_SetGlobalVolume(volume); + } + + /** + * Get the current value of the global volume of all the sounds + * + * Returns: + * Current global volume, in the range [0, 100] + */ + static float getGlobalVolume() + { + return sfListener_GetGlobalVolume(); + } + + /** + * Change the position of the listener. + * The default position is (0, 0, 0) + * + * Params: + * posX = X position of the listener in the world + * posY = Y position of the listener in the world + * posZ = Z position of the listener in the world + */ + static void setPosition(float posX, float posY, float posZ) + { + sfListener_SetPosition(posX, posY, posZ); + } + + /** + * Change the position of the listener. + * The default position is (0, 0, 0) + * + * Params: + * position = new position + */ + static void setPosition(Vector3f position) + { + sfListener_SetPosition(position.x, position.y, position.z); + } + + + /** + * Get the current position of the listener + * + * Returns: + * Current position + */ + static Vector3f getPosition() + { + Vector3f ret; + sfListener_GetPosition(&ret.x, &ret.y, &ret.z); + return ret; + } + + /** + * Change the orientation of the listener (the point + * he must look at). + * The default target is (0, 0, -1) + * + * Params: + * targetX = X position of the point the listener must look at + * targetY = X position of the point the listener must look at + * targetZ = X position of the point the listener must look at + */ + static void setTarget(float targetX, float targetY, float targetZ) + { + sfListener_SetTarget(targetX, targetY, targetZ); + } + + /** + * Change the orientation of the listener (the point + * he must look at). + * The default target is (0, 0, -1) + * + * Params: + * target = Position of the point the listener must look at + */ + static void setTarget(Vector3f position) + { + sfListener_SetTarget(position.x, position.y, position.z); + } + + /** + * Get the current orientation of the listener (the point + * he's looking at) + * + * Returns: + * Position of the point the listener is looking at + */ + static Vector3f getTarget() + { + Vector3f ret; + sfListener_GetTarget(&ret.x, &ret.y, &ret.z); + return ret; + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef void function(float) pf_sfListener_SetGlobalVolume; + typedef float function() pf_sfListener_GetGlobalVolume; + typedef void function(float, float, float) pf_sfListener_SetPosition; + typedef void function(float*, float*, float*) pf_sfListener_GetPosition; + typedef void function(float, float, float) pf_sfListener_SetTarget; + typedef void function(float*, float*, float*) pf_sfListener_GetTarget; + + static pf_sfListener_SetGlobalVolume sfListener_SetGlobalVolume; + static pf_sfListener_GetGlobalVolume sfListener_GetGlobalVolume; + static pf_sfListener_SetPosition sfListener_SetPosition; + static pf_sfListener_GetPosition sfListener_GetPosition; + static pf_sfListener_SetTarget sfListener_SetTarget; + static pf_sfListener_GetTarget sfListener_GetTarget; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfListener_SetGlobalVolume = cast(pf_sfListener_SetGlobalVolume)dll.getSymbol("sfListener_SetGlobalVolume"); + sfListener_GetGlobalVolume = cast(pf_sfListener_GetGlobalVolume)dll.getSymbol("sfListener_GetGlobalVolume"); + sfListener_SetPosition = cast(pf_sfListener_SetPosition)dll.getSymbol("sfListener_SetPosition"); + sfListener_GetPosition = cast(pf_sfListener_GetPosition)dll.getSymbol("sfListener_GetPosition"); + sfListener_SetTarget = cast(pf_sfListener_SetTarget)dll.getSymbol("sfListener_SetTarget"); + sfListener_GetTarget = cast(pf_sfListener_GetTarget)dll.getSymbol("sfListener_GetTarget"); + } +} diff --git a/DSFML/import/dsfml/audio/music.d b/DSFML/import/dsfml/audio/music.d new file mode 100644 index 00000000..433c8121 --- /dev/null +++ b/DSFML/import/dsfml/audio/music.d @@ -0,0 +1,396 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.music; + +import dsfml.audio.soundstatus; + +import dsfml.system.common; +import dsfml.system.exception; +import dsfml.system.stringutil; +import dsfml.system.vector3; + +/** +* Music defines a big sound played using streaming, +* so usually what we call a music :) +*/ +class Music : DSFMLObject +{ + /** + * Open a music file (doesn't play it -- call Play for that) + * + * Params: + * filename = Path of the file to open + * + */ + this(char[] filename) + { + if (filename is null || filename.length == 0) + throw new LoadingException("LoadingException : Filename is invalid."); + + super(sfMusic_CreateFromFile(toStringz(filename))); + } + + /** + * Open a music file from memory (doesn't play it -- call Play() for that) + * + * Params: + * data = file data in memory + * + */ + this(byte[] data) + { + if (data is null || data.length == 0) + throw new Exception("LoadingException : Memory stream is invalid."); + + super(m_ptr = sfMusic_CreateFromMemory(data.ptr, data.length)); + } + + override void dispose() + { + sfMusic_Destroy(m_ptr); + } + + /** + * Start playing the audio stream + */ + void play() + { + sfMusic_Play(m_ptr); + } + + /** + * Stop playing the audio stream + */ + void stop() + { + sfMusic_Stop(m_ptr); + } + + /** + * Pause the audio stream + */ + void pause() + { + sfMusic_Pause(m_ptr); + } + + + /** + * Return the number of channels (1 = mono, 2 = stereo) + * + * Returns: + * Number of channels + */ + uint getChannelsCount() + { + return sfMusic_GetChannelsCount(m_ptr); + } + + /** + * Get the stream sample rate + * + * Returns: + * Stream frequency (number of samples per second) + */ + uint getSampleRate() + { + return sfMusic_GetSampleRate(m_ptr); + } + + + /** + * Get the music duration + * + * Returns: + * Music duration, in seconds + */ + float getDuration() + { + return sfMusic_GetDuration(m_ptr); + } + + /** + * Get the status of the stream (stopped, paused, playing) + * + * Returns: + * Current status of the sound + */ + SoundStatus getStatus() + { + return sfMusic_GetStatus(m_ptr); + } + + + /** + * Tell whether or not the music is looping + * + * Returns: + * True if the music is looping, false otherwise + */ + bool getLoop() + { + return cast(bool)sfMusic_GetLoop(m_ptr); + } + + /** + * Get the pitch + * + * Returns: + * Pitch value + */ + float getPitch() + { + return sfMusic_GetPitch(m_ptr); + } + + /** + * Get the volume + * + * Returns: + * Volume value (in range [1, 100]) + */ + float getVolume() + { + return sfMusic_GetVolume(m_ptr); + } + + /** + * Get the sound position + * + * Returns: + * Current position of the music. + */ + Vector3f getPosition() + { + Vector3f ret; + sfMusic_GetPosition(m_ptr, &ret.x, &ret.y, &ret.z); + return ret; + } + + /** + * Get the minimum distance + * + * Returns: + * Minimum distance for the sound + */ + float getMinDistance() + { + return sfMusic_GetMinDistance(m_ptr); + } + + /** + * Get the attenuation factor + * + * Returns: + * Attenuation factor of the sound + * + */ + float getAttenuation() + { + return sfMusic_GetAttenuation(m_ptr); + } + + + /** + * Set the music loop state. + * This parameter is disabled by default + * + * Params: + * loop = True to play in loop, false to play once + */ + void setLoop(bool loop) + { + sfMusic_SetLoop(m_ptr, loop); + } + + /** + * Set the sound pitch. + * The default pitch is 1 + * + * Params: + * pitch = New pitch + * + */ + void setPitch(float pitch) + { + sfMusic_SetPitch(m_ptr, pitch); + } + + /** + * Set the sound volume. + * The default volume is 100 + * + * Params: + * volume = Volume (in range [0, 100]) + * + */ + void setVolume(float volume) + in + { + assert (volume >= 0.f && volume <= 100.f); + } + body + { + sfMusic_SetVolume(m_ptr, volume); + } + + /** + * Set the sound position. + * The default position is (0, 0, 0) + * + * Params: + * x = X position of the sound in the world + * y = Y position of the sound in the world + * z = Z position of the sound in the world + * + */ + void setPosition(float x, float y, float z) + { + sfMusic_SetPosition(m_ptr, x, y, z); + } + + /** + * Set the sound position. + * The default position is (0, 0, 0) + * + * Params: + * position = new position + * + */ + void setPosition(Vector3f position) + { + sfMusic_SetPosition(m_ptr, position.x, position.y, position.z); + } + + + /** + * Set the minimum distance - closer than thsi distance + * the listener will hear the sound at its maximum volume. + * The default distance is 1.0 + * + * Params: + * minDistance = new minimum distance for the sound + */ + void setMinDistance(float minDistance) + { + sfMusic_SetMinDistance(m_ptr, minDistance); + } + + /** + * Set the attenuation factor - the higher the attenuation, the + * more the sound will be attenuated with distance from listener. + * The default attenuation factor 1.0 + * + * Params: + * attenuation = new attenuation factor for the sound + */ + void setAttenuation(float attenuation) + { + sfMusic_SetAttenuation(m_ptr, attenuation); + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef void* function(char*) pf_sfMusic_CreateFromFile; + typedef void* function(byte*, size_t) pf_sfMusic_CreateFromMemory; + typedef void function(void*) pf_sfMusic_Destroy; + typedef void function(void*, int) pf_sfMusic_SetLoop; + typedef bool function(void*) pf_sfMusic_GetLoop; + typedef float function(void*) pf_sfMusic_GetDuration; + typedef void function(void*) pf_sfMusic_Play; + typedef void function(void*) pf_sfMusic_Pause; + typedef void function(void*) pf_sfMusic_Stop; + typedef uint function(void*) pf_sfMusic_GetChannelsCount; + typedef uint function(void*) pf_sfMusic_GetSampleRate; + typedef SoundStatus function(void*) pf_sfMusic_GetStatus; + typedef void function(void*, float) pf_sfMusic_SetPitch; + typedef void function(void*, float) pf_sfMusic_SetVolume; + typedef void function(void*, float, float, float) pf_sfMusic_SetPosition; + typedef float function(void*) pf_sfMusic_GetPitch; + typedef float function(void*) pf_sfMusic_GetVolume; + typedef void function(void*, float*, float*, float*) pf_sfMusic_GetPosition; + typedef float function(void*) pf_sfMusic_GetMinDistance; + typedef float function(void*) pf_sfMusic_GetAttenuation; + typedef void function(void*, float) pf_sfMusic_SetMinDistance; + typedef void function(void*, float) pf_sfMusic_SetAttenuation; + + static pf_sfMusic_CreateFromFile sfMusic_CreateFromFile; + static pf_sfMusic_CreateFromMemory sfMusic_CreateFromMemory; + static pf_sfMusic_Destroy sfMusic_Destroy; + static pf_sfMusic_SetLoop sfMusic_SetLoop; + static pf_sfMusic_GetLoop sfMusic_GetLoop; + static pf_sfMusic_GetDuration sfMusic_GetDuration; + static pf_sfMusic_Play sfMusic_Play; + static pf_sfMusic_Pause sfMusic_Pause; + static pf_sfMusic_Stop sfMusic_Stop; + static pf_sfMusic_GetChannelsCount sfMusic_GetChannelsCount; + static pf_sfMusic_GetSampleRate sfMusic_GetSampleRate; + static pf_sfMusic_GetStatus sfMusic_GetStatus; + static pf_sfMusic_SetPitch sfMusic_SetPitch; + static pf_sfMusic_SetVolume sfMusic_SetVolume; + static pf_sfMusic_SetPosition sfMusic_SetPosition; + static pf_sfMusic_GetPitch sfMusic_GetPitch; + static pf_sfMusic_GetVolume sfMusic_GetVolume; + static pf_sfMusic_GetPosition sfMusic_GetPosition; + static pf_sfMusic_GetMinDistance sfMusic_GetMinDistance; + static pf_sfMusic_GetAttenuation sfMusic_GetAttenuation; + static pf_sfMusic_SetMinDistance sfMusic_SetMinDistance; + static pf_sfMusic_SetAttenuation sfMusic_SetAttenuation; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfMusic_CreateFromFile = cast(pf_sfMusic_CreateFromFile)dll.getSymbol("sfMusic_CreateFromFile"); + sfMusic_CreateFromMemory = cast(pf_sfMusic_CreateFromMemory)dll.getSymbol("sfMusic_CreateFromMemory"); + sfMusic_Destroy = cast(pf_sfMusic_Destroy)dll.getSymbol("sfMusic_Destroy"); + sfMusic_SetLoop = cast(pf_sfMusic_SetLoop)dll.getSymbol("sfMusic_SetLoop"); + sfMusic_GetLoop = cast(pf_sfMusic_GetLoop)dll.getSymbol("sfMusic_GetLoop"); + sfMusic_GetDuration = cast(pf_sfMusic_GetDuration)dll.getSymbol("sfMusic_GetDuration"); + sfMusic_Play = cast(pf_sfMusic_Play)dll.getSymbol("sfMusic_Play"); + sfMusic_Pause = cast(pf_sfMusic_Pause)dll.getSymbol("sfMusic_Pause"); + sfMusic_Stop = cast(pf_sfMusic_Stop)dll.getSymbol("sfMusic_Stop"); + sfMusic_GetChannelsCount = cast(pf_sfMusic_GetChannelsCount)dll.getSymbol("sfMusic_GetChannelsCount"); + sfMusic_GetSampleRate = cast(pf_sfMusic_GetSampleRate)dll.getSymbol("sfMusic_GetSampleRate"); + sfMusic_GetStatus = cast(pf_sfMusic_GetStatus)dll.getSymbol("sfMusic_GetStatus"); + sfMusic_SetPitch = cast(pf_sfMusic_SetPitch)dll.getSymbol("sfMusic_SetPitch"); + sfMusic_SetVolume = cast(pf_sfMusic_SetVolume)dll.getSymbol("sfMusic_SetVolume"); + sfMusic_SetPosition = cast(pf_sfMusic_SetPosition)dll.getSymbol("sfMusic_SetPosition"); + sfMusic_GetPitch = cast(pf_sfMusic_GetPitch)dll.getSymbol("sfMusic_GetPitch"); + sfMusic_GetVolume = cast(pf_sfMusic_GetVolume)dll.getSymbol("sfMusic_GetVolume"); + sfMusic_GetPosition = cast(pf_sfMusic_GetPosition)dll.getSymbol("sfMusic_GetPosition"); + sfMusic_GetMinDistance = cast(pf_sfMusic_GetMinDistance)dll.getSymbol("sfMusic_GetMinDistance"); + sfMusic_GetAttenuation = cast(pf_sfMusic_GetAttenuation)dll.getSymbol("sfMusic_GetAttenuation"); + sfMusic_SetMinDistance = cast(pf_sfMusic_SetMinDistance)dll.getSymbol("sfMusic_SetMinDistance"); + sfMusic_SetAttenuation = cast(pf_sfMusic_SetAttenuation)dll.getSymbol("sfMusic_SetAttenuation"); + } +} + diff --git a/DSFML/import/dsfml/audio/sound.d b/DSFML/import/dsfml/audio/sound.d new file mode 100644 index 00000000..d9eb8d3b --- /dev/null +++ b/DSFML/import/dsfml/audio/sound.d @@ -0,0 +1,415 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.sound; + +import dsfml.audio.soundbuffer; +import dsfml.audio.soundstatus; + +import dsfml.system.common; +import dsfml.system.exception; +import dsfml.system.vector3; + +/** +* Sound defines the properties of the sound such as position, +* volume, pitch, etc. +*/ +class Sound : DSFMLObject +{ + /** + * Default constructor + */ + this() + { + super(sfSound_Create()); + } + + /** + * Construct the sound from its parameters + * + * Params: + * buffer = Sound buffer to play + * loop = Loop flag (false by default) + * pitch = Value of the pitch (1 by default) + * volume = Volume (100 by default) + * x = X position (0 by default) + * y = Y position (0 by default) + * z = Z position (0 by default) + * + * Throws: + * NullParameterException if buffer is null + */ + this(SoundBuffer buffer, bool loop = false, float pitch = 1.f, float volume = 100.f, float x = 0.f, float y = 0.f, float z = 0.f) + { + if (buffer is null) + throw new NullParameterException("NullParameterException : SoundBuffer is null."); + + super(sfSound_Create()); + sfSound_SetBuffer(m_ptr, buffer.getNativePointer()); + sfSound_SetLoop(m_ptr, loop); + sfSound_SetPitch(m_ptr, pitch); + sfSound_SetVolume(m_ptr, volume); + sfSound_SetPosition(m_ptr, x, y, z); + } + + + override void dispose() + { + sfSound_Destroy(m_ptr); + } + + /** + * Play the sound + */ + void play() + { + sfSound_Play(m_ptr); + } + + /** + * Pause the sound + */ + void pause() + { + sfSound_Pause(m_ptr); + } + + /** + * Stop the sound + */ + void stop() + { + sfSound_Stop(m_ptr); + } + + /** + * Set the source buffer + * + * Params: + * buffer = New sound buffer to bind to the sound + */ + void setBuffer(SoundBuffer buffer) + { + if (buffer is null) + throw new NullParameterException("NullParameterException : SoundBuffer is null."); + + m_buffer = buffer; + sfSound_SetBuffer(m_ptr, buffer.getNativePointer); + } + + /** + * Set the sound loop state. + * This parameter is disabled by default + * + * Params: + * loop = True to play in loop, false to play once + */ + void setLoop(bool loop) + { + sfSound_SetLoop(m_ptr, loop); + } + + /** + * Set the sound pitch. + * The default pitch is 1 + * + * Params: + * pitch = New pitch + */ + void setPitch(float pitch) + { + sfSound_SetPitch(m_ptr, pitch); + } + + /** + * Set the sound volume. + * The default volume is 100 + * + * Params: + * volume = Volume (in range [0, 100]) + */ + void setVolume(float volume) + in + { + assert(volume >= 0 && volume <= 100); + } + body + { + sfSound_SetVolume(m_ptr, volume); + } + + /** + * Set the sound position. + * The default position is (0, 0, 0) + * + * Params: + * x = X position of the sound in the world + * y = Y position of the sound in the world + * z = Z position of the sound in the world + */ + void setPosition(float x, float y, float z) + { + sfSound_SetPosition(m_ptr, x, y, z); + } + + /** + * Set the sound position. + * The default position is (0, 0, 0) + * + * Params : + * position = new position + */ + void setPosition(Vector3f position) + { + sfSound_SetPosition(m_ptr, position.x, position.y, position.z); + } + + /** + * Set the minimum distance - closer than this distance + * the listener will hear the sound at its maximum volume. + * The default distance is 1.0 + * + * Params: + * minDistance = new minimum distance for the sound + */ + void setMinDistance(float minDistance) + { + sfSound_SetMinDistance(m_ptr, minDistance); + } + + /** + * Set the attenuation factor - the higher the attenuation, the + * more the sound will be attenuated with distance from listener. + * The default attenuation factor 1.0 + * + * Params: + * attenuation = new attenuation factor for the sound + */ + void setAttenuation(float attenuation) + { + sfSound_SetAttenuation(m_ptr, attenuation); + } + + /** + * Set the current playing offset of a sound + * + * Params: + * offset = new playing position, expressed in seconds + */ + void setPlayingOffset(float offset) + { + sfSound_SetPlayingOffset(m_ptr, offset); + } + + + /** + * Get the source buffer + * + * Returns: + * Sound buffer bound to the sound (can be NULL) + */ + SoundBuffer getBuffer() + { + return m_buffer; + } + + /** + * Tell whether or not the sound is looping + * + * Returns: + * True if the sound is looping, false otherwise + */ + bool getLoop() + { + + return cast(bool)(sfSound_GetLoop(m_ptr)); + } + + /** + * Get the pitch + * + * Returns: + * Pitch value + */ + float getPitch() + { + return sfSound_GetPitch(m_ptr); + } + + /** + * Get the volume + * + * Returns: + * Volume value (in range [1, 100]) + */ + float getVolume() + { + return sfSound_GetVolume(m_ptr); + } + + /** + * Get the sound position + * + * Params: + * x = X position of the sound in the world + * y = Y position of the sound in the world + * z = Z position of the sound in the world + */ + Vector3f getPosition() + { + Vector3f ret; + sfSound_GetPosition(m_ptr, &ret.x, &ret.y, &ret.z); + return ret; + } + + /** + * Get the minimum distance + * + * Returns: + * Minimum distance for the sound + */ + float getMinDistance() + { + return sfSound_GetMinDistance(m_ptr); + } + + /** + * Get the attenuation factor + * + * Returns: + * Attenuation factor of the sound + * + */ + float getAttenuation() + { + return sfSound_GetAttenuation(m_ptr); + } + + + /** + * Get the status of the sound (stopped, paused, playing) + * + * Returns: + * Current status of the sound + */ + SoundStatus getStatus() + { + return sfSound_GetStatus(m_ptr); + } + + /** + * Get the current playing position of the sound + * + * Returns: + * Current playing position, expressed in seconds + */ + float getPlayingOffset() + { + return sfSound_GetPlayingOffset(m_ptr); + } + + +private: + SoundBuffer m_buffer; + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfSound_Create; + typedef void function(void*) pf_sfSound_Destroy; + typedef void function(void*) pf_sfSound_Play; + typedef void function(void*) pf_sfSound_Pause; + typedef void function(void*) pf_sfSound_Stop; + typedef void function(void*, void*) pf_sfSound_SetBuffer; + typedef void* function(void*) pf_sfSound_GetBuffer; + typedef void function(void*, int) pf_sfSound_SetLoop; + typedef int function(void*) pf_sfSound_GetLoop; + typedef SoundStatus function(void*) pf_sfSound_GetStatus; + typedef void function(void*, float) pf_sfSound_SetPitch; + typedef void function(void*, float) pf_sfSound_SetVolume; + typedef void function(void*, float, float, float) pf_sfSound_SetPosition; + typedef float function(void*) pf_sfSound_GetPitch; + typedef float function(void*) pf_sfSound_GetVolume; + typedef void function(void*, float*, float*, float*) pf_sfSound_GetPosition; + typedef float function(void*) pf_sfSound_GetPlayingOffset; + typedef float function(void*) pf_sfSound_GetMinDistance; + typedef float function(void*) pf_sfSound_GetAttenuation; + typedef void function(void*, float) pf_sfSound_SetMinDistance; + typedef void function(void*, float) pf_sfSound_SetAttenuation; + typedef void function(void*, float) pf_sfSound_SetPlayingOffset; + + static pf_sfSound_Create sfSound_Create; + static pf_sfSound_Destroy sfSound_Destroy; + static pf_sfSound_Play sfSound_Play; + static pf_sfSound_Pause sfSound_Pause; + static pf_sfSound_Stop sfSound_Stop; + static pf_sfSound_SetBuffer sfSound_SetBuffer; + static pf_sfSound_GetBuffer sfSound_GetBuffer; + static pf_sfSound_SetLoop sfSound_SetLoop; + static pf_sfSound_GetLoop sfSound_GetLoop; + static pf_sfSound_GetStatus sfSound_GetStatus; + static pf_sfSound_SetPitch sfSound_SetPitch; + static pf_sfSound_SetVolume sfSound_SetVolume; + static pf_sfSound_SetPosition sfSound_SetPosition; + static pf_sfSound_GetPitch sfSound_GetPitch; + static pf_sfSound_GetVolume sfSound_GetVolume; + static pf_sfSound_GetPosition sfSound_GetPosition; + static pf_sfSound_GetPlayingOffset sfSound_GetPlayingOffset; + static pf_sfSound_GetMinDistance sfSound_GetMinDistance; + static pf_sfSound_GetAttenuation sfSound_GetAttenuation; + static pf_sfSound_SetMinDistance sfSound_SetMinDistance; + static pf_sfSound_SetAttenuation sfSound_SetAttenuation; + static pf_sfSound_SetPlayingOffset sfSound_SetPlayingOffset; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfSound_Create = cast(pf_sfSound_Create)dll.getSymbol("sfSound_Create"); + sfSound_Destroy = cast(pf_sfSound_Destroy)dll.getSymbol("sfSound_Destroy"); + sfSound_Play = cast(pf_sfSound_Play)dll.getSymbol("sfSound_Play"); + sfSound_Pause = cast(pf_sfSound_Pause)dll.getSymbol("sfSound_Pause"); + sfSound_Stop = cast(pf_sfSound_Stop)dll.getSymbol("sfSound_Stop"); + sfSound_SetBuffer = cast(pf_sfSound_SetBuffer)dll.getSymbol("sfSound_SetBuffer"); + sfSound_GetBuffer = cast(pf_sfSound_GetBuffer)dll.getSymbol("sfSound_GetBuffer"); + sfSound_SetLoop = cast(pf_sfSound_SetLoop)dll.getSymbol("sfSound_SetLoop"); + sfSound_GetLoop = cast(pf_sfSound_GetLoop)dll.getSymbol("sfSound_GetLoop"); + sfSound_GetStatus = cast(pf_sfSound_GetStatus)dll.getSymbol("sfSound_GetStatus"); + sfSound_SetPitch = cast(pf_sfSound_SetPitch)dll.getSymbol("sfSound_SetPitch"); + sfSound_SetVolume = cast(pf_sfSound_SetVolume)dll.getSymbol("sfSound_SetVolume"); + sfSound_SetPosition = cast(pf_sfSound_SetPosition)dll.getSymbol("sfSound_SetPosition"); + sfSound_GetPitch = cast(pf_sfSound_GetPitch)dll.getSymbol("sfSound_GetPitch"); + sfSound_GetVolume = cast(pf_sfSound_GetVolume)dll.getSymbol("sfSound_GetVolume"); + sfSound_GetPosition = cast(pf_sfSound_GetPosition)dll.getSymbol("sfSound_GetPosition"); + sfSound_GetPlayingOffset = cast(pf_sfSound_GetPlayingOffset)dll.getSymbol("sfSound_GetPlayingOffset"); + sfSound_GetMinDistance = cast(pf_sfSound_GetMinDistance)dll.getSymbol("sfSound_GetMinDistance"); + sfSound_GetAttenuation = cast(pf_sfSound_GetAttenuation)dll.getSymbol("sfSound_GetAttenuation"); + sfSound_SetMinDistance = cast(pf_sfSound_SetMinDistance)dll.getSymbol("sfSound_SetMinDistance"); + sfSound_SetAttenuation = cast(pf_sfSound_SetAttenuation)dll.getSymbol("sfSound_SetAttenuation"); + sfSound_SetPlayingOffset = cast(pf_sfSound_SetPlayingOffset)dll.getSymbol("sfSound_SetPlayingOffset"); + } +} diff --git a/DSFML/import/dsfml/audio/soundbuffer.d b/DSFML/import/dsfml/audio/soundbuffer.d new file mode 100644 index 00000000..f329c9f2 --- /dev/null +++ b/DSFML/import/dsfml/audio/soundbuffer.d @@ -0,0 +1,226 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.soundbuffer; + +import dsfml.system.common; +import dsfml.system.exception; +import dsfml.system.stringutil; + + +/** +* SoundBuffer is the low-level for loading and manipulating +* sound buffers +*/ +class SoundBuffer : DSFMLObject +{ + /** + * Load the sound buffer from a file + * + * Params: + * filename = Path of the sound file to load + * + * Throws: + * LoadingException on failure + */ + this(char[] filename) + { + if (filename is null || filename.length == 0) + throw new LoadingException("LoadingException : Filename is invalid."); + + super(sfSoundBuffer_CreateFromFile(toStringz(filename))); + } + + /** + * Load the sound buffer from a file in memory + * + * Params: + * data = Array of file data in memory + * + * Throws: + * LoadingException on failure + */ + this(byte[] data) + { + if (data is null || data.length == 0) + throw new Exception("LoadingException : Memory stream is invalid."); + + super(sfSoundBuffer_CreateFromMemory(data.ptr, data.length)); + } + + /** + * Load the sound buffer from an array of samples - assumed format for + * samples is 16 bits signed integer + * + * Params: + * samples = Array of samples in memory + * channelsCount = Number of channels (1 = mono, 2 = stereo, ...) + * sampleRate = Frequency (number of samples to play per second) + * + * Throws: + * LoadingException on failure + */ + this(short[] samples, uint channelsCount, uint sampleRate) + { + if (samples is null || samples.length == 0) + throw new Exception("LoadingException : Samples array is invalid."); + + super(sfSoundBuffer_CreateFromSamples(samples.ptr, samples.length, channelsCount, sampleRate)); + } + + override void dispose() + { + sfSoundBuffer_Destroy(m_ptr); + } + + + + /** + * Save the sound buffer to a file + * + * Params: + * filename = Path of the sound file to write + * + * Returns: + * True if saving has been successful + */ + bool saveToFile(char[] filename) + { + if (filename !is null && filename.length > 0 ) + { + return cast(bool)sfSoundBuffer_SaveToFile(m_ptr, toStringz(filename)); + } + return false; + } + + /** + * Return the sound samples + * + * Returns: + * Array of sound samples, in 16 bits signed integer format + */ + short[] getSamples() + { + short* temp = null; + temp = sfSoundBuffer_GetSamples(m_ptr); + + return temp is null ? null : temp[0..getSamplesCount]; + } + + /** + * Return the samples count + * + * Returns: + * Number of samples + */ + size_t getSamplesCount() + { + return sfSoundBuffer_GetSamplesCount(m_ptr); + } + + /** + * Get the sample rate + * + * Returns: + * Sound frequency (number of samples per second) + */ + uint getSampleRate() + { + return sfSoundBuffer_GetSampleRate(m_ptr); + } + + /** + * Return the number of channels (1 = mono, 2 = stereo, ...) + * + * Returns: + * Number of channels + */ + uint getChannelsCount() + { + return sfSoundBuffer_GetChannelsCount(m_ptr); + } + + /** + * Get the sound duration + * + * Returns: + * Sound duration, in seconds + */ + float getDuration() + { + return sfSoundBuffer_GetDuration(m_ptr); + } + +package: + this(void* ptr) + { + super(ptr, true); + } + +private: +// External ==================================================================== + + extern (C) + { + typedef void* function(char*) pf_sfSoundBuffer_CreateFromFile; + typedef void* function(byte*, size_t) pf_sfSoundBuffer_CreateFromMemory; + typedef void* function(short*, size_t, uint, uint) pf_sfSoundBuffer_CreateFromSamples; + typedef void function(void*) pf_sfSoundBuffer_Destroy; + typedef int function(void*, char*) pf_sfSoundBuffer_SaveToFile; + typedef short* function(void*) pf_sfSoundBuffer_GetSamples; + typedef size_t function(void*) pf_sfSoundBuffer_GetSamplesCount; + typedef uint function(void*) pf_sfSoundBuffer_GetSampleRate; + typedef uint function(void*) pf_sfSoundBuffer_GetChannelsCount; + typedef float function(void*) pf_sfSoundBuffer_GetDuration; + + static pf_sfSoundBuffer_CreateFromFile sfSoundBuffer_CreateFromFile; + static pf_sfSoundBuffer_CreateFromMemory sfSoundBuffer_CreateFromMemory; + static pf_sfSoundBuffer_CreateFromSamples sfSoundBuffer_CreateFromSamples; + static pf_sfSoundBuffer_Destroy sfSoundBuffer_Destroy; + static pf_sfSoundBuffer_SaveToFile sfSoundBuffer_SaveToFile; + static pf_sfSoundBuffer_GetSamples sfSoundBuffer_GetSamples; + static pf_sfSoundBuffer_GetSamplesCount sfSoundBuffer_GetSamplesCount; + static pf_sfSoundBuffer_GetSampleRate sfSoundBuffer_GetSampleRate; + static pf_sfSoundBuffer_GetChannelsCount sfSoundBuffer_GetChannelsCount; + static pf_sfSoundBuffer_GetDuration sfSoundBuffer_GetDuration; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfSoundBuffer_CreateFromFile = cast(pf_sfSoundBuffer_CreateFromFile)dll.getSymbol("sfSoundBuffer_CreateFromFile"); + sfSoundBuffer_CreateFromMemory = cast(pf_sfSoundBuffer_CreateFromMemory)dll.getSymbol("sfSoundBuffer_CreateFromMemory"); + sfSoundBuffer_CreateFromSamples = cast(pf_sfSoundBuffer_CreateFromSamples)dll.getSymbol("sfSoundBuffer_CreateFromSamples"); + sfSoundBuffer_Destroy = cast(pf_sfSoundBuffer_Destroy)dll.getSymbol("sfSoundBuffer_Destroy"); + sfSoundBuffer_SaveToFile = cast(pf_sfSoundBuffer_SaveToFile)dll.getSymbol("sfSoundBuffer_SaveToFile"); + sfSoundBuffer_GetSamples = cast(pf_sfSoundBuffer_GetSamples)dll.getSymbol("sfSoundBuffer_GetSamples"); + sfSoundBuffer_GetSamplesCount = cast(pf_sfSoundBuffer_GetSamplesCount)dll.getSymbol("sfSoundBuffer_GetSamplesCount"); + sfSoundBuffer_GetSampleRate = cast(pf_sfSoundBuffer_GetSampleRate)dll.getSymbol("sfSoundBuffer_GetSampleRate"); + sfSoundBuffer_GetChannelsCount = cast(pf_sfSoundBuffer_GetChannelsCount)dll.getSymbol("sfSoundBuffer_GetChannelsCount"); + sfSoundBuffer_GetDuration = cast(pf_sfSoundBuffer_GetDuration)dll.getSymbol("sfSoundBuffer_GetDuration"); + } +} + diff --git a/DSFML/import/dsfml/audio/soundbufferrecorder.d b/DSFML/import/dsfml/audio/soundbufferrecorder.d new file mode 100644 index 00000000..417e144e --- /dev/null +++ b/DSFML/import/dsfml/audio/soundbufferrecorder.d @@ -0,0 +1,105 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.soundbufferrecorder; + +import dsfml.system.common; + +import dsfml.audio.soundbuffer; +import dsfml.audio.soundrecorder; + +/** +* Specialized sfSoundRecorder which saves the captured +* audio data into a sound buffer +*/ +class SoundBufferRecorder : SoundRecorder +{ + /** + * Constructor + */ + this() + { + super(sfSoundBufferRecorder_Create()); + } + + override void dispose() + { + sfSoundBufferRecorder_Destroy(m_ptr); + } + + /** + * Get the sound buffer containing the captured audio data + * + * Returns: + * SoundBuffer containing the captured audio data + * + */ + SoundBuffer getBuffer() + { + return new SoundBuffer(sfSoundBufferRecorder_GetBuffer(m_ptr)); + } + +protected: + + override bool onStart() + { + return true; + } + + override bool onProcessSamples(short[] s) + { + return true; + } + + override void onStop() + { + + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfSoundBufferRecorder_Create; + typedef void function(void*) pf_sfSoundBufferRecorder_Destroy; + typedef void* function(void*) pf_sfSoundBufferRecorder_GetBuffer; + + static pf_sfSoundBufferRecorder_Create sfSoundBufferRecorder_Create; + static pf_sfSoundBufferRecorder_Destroy sfSoundBufferRecorder_Destroy; + static pf_sfSoundBufferRecorder_GetBuffer sfSoundBufferRecorder_GetBuffer; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfSoundBufferRecorder_Create = cast(pf_sfSoundBufferRecorder_Create)dll.getSymbol("sfSoundBufferRecorder_Create"); + sfSoundBufferRecorder_Destroy = cast(pf_sfSoundBufferRecorder_Destroy)dll.getSymbol("sfSoundBufferRecorder_Destroy"); + sfSoundBufferRecorder_GetBuffer = cast(pf_sfSoundBufferRecorder_GetBuffer)dll.getSymbol("sfSoundBufferRecorder_GetBuffer"); + } +} + diff --git a/DSFML/import/dsfml/audio/soundrecorder.d b/DSFML/import/dsfml/audio/soundrecorder.d new file mode 100644 index 00000000..5f670d98 --- /dev/null +++ b/DSFML/import/dsfml/audio/soundrecorder.d @@ -0,0 +1,332 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.soundrecorder; + +import dsfml.audio.soundbuffer; + +import dsfml.system.alloc; +import dsfml.system.common; +import dsfml.system.sleep; +import dsfml.system.linkedlist; +import dsfml.system.mutex; +import dsfml.system.lock; +import dsfml.system.thread; + +/** +* SoundRecorder is an interface for capturing sound data. +* +* $(B onProcessSamples and onStop will be called by a different thread, take care of synchronization issues.) +* +* Examples: +* ------- +* class MySoundRecorder : SoundRecorder +* { +* this() +* { +* +* } +* +* protected bool onStart() +* { +* return true; +* } +* +* protected void onStop() +* { +* +* } +* +* protected bool onProcessSamples(out short[]) +* { +* // Process data here +* +* return true; //return true to continue capture, else return false +* } +* } +* ------- +*/ +abstract class SoundRecorder : DSFMLObject +{ + override void dispose() + { + if (m_flag) + stop(); + + m_instances.remove(m_id); + sfSoundRecorder_Destroy(m_ptr); + } + + + /** + * Start the capture. + * + * Only one capture can happen at the same time + * + * Params: + * sampleRate : Sound frequency (the more samples, the higher the quality) + * (44100 by default = CD quality) + */ + void start(uint sampleRate = 44100) + { + sfSoundRecorder_Start(m_ptr, sampleRate); + m_t = new Thread(&threadPoll); + m_t.launch(); + } + + /** + * Stop the capture + */ + void stop() + { + sfSoundRecorder_Stop(m_ptr); + m_flag = false; + m_t.wait(); + m_t = null; + } + + /** + * Get the sample rate + * + * Returns: + * Frequency, in samples per second + */ + uint getSampleRate() + { + return sfSoundRecorder_GetSampleRate(m_ptr); + } + + /** + * Tell if the system supports sound capture. + * If not, this class won't be usable + * + * Returns: + * True if audio capture is supported + * + */ + static bool canCapture() + { + return cast(bool)sfSoundRecorder_CanCapture(); + } + +protected: + /** + * Protected constructor + */ + this() + { + m_id = ++seed; + m_instances[m_id] = this; + super(sfSoundRecorder_Create(&internalOnStart, &internalCallback, &internalOnStop, &m_id)); + + init(true); + } + + this(void* ptr) + { + super(ptr); + + init(false); + } + + /** + * Start recording audio data + * + * Returns: + * False to abort recording audio data, true to start + */ + abstract bool onStart(); + + /** + * Stop recording audio data + */ + abstract void onStop(); + + /** + * callback function + * + * Parameters: + * samples = Array of samples + * + * Returns: + * true to continue recording, false to stop. + */ + abstract bool onProcessSamples(short[] samples); + + bool m_disposed; +private: + /* + * an init function to initialize id of the object. + */ + void init(bool flag) + { + if (flag) + { + m_list = new LinkedList!(Samples)(); + + m_flag = true; + m_continue = true; + + m_mutex = new Mutex(); + } + } + + void* m_userData; + int m_id; + + static int seed = 0; + static SoundRecorder[int] m_instances; + + /* + * Extern C callback function + * + * This function must be static for C interop. To retrieve the current + * instance, we retrieve id of the sender in the user data, and search associated instance + * in the associative array. + * + * We don't call delegate or derived class on that thread because GC is not aware of this thread + * instead we enqueue data informations in a queue and poll this queue with a managed thread. + */ + extern(C) static int internalCallback(short* s, size_t size, void* user) + { + int id; + // retrieve instance + if ((id = *cast(int*)(user)) in m_instances) + { + SoundRecorder temp = m_instances[id]; + scope Lock l = new Lock(temp.m_mutex); + if (temp.m_continue) + // this new is allowed because Samples is an custom alloc class. + temp.m_list.enqueue(new Samples(s, size)); + return temp.m_continue; + } + return false; + } + + extern(C) static int internalOnStart(void* user) + { + int id; + bool ret = false; + if ((id = *cast(int*)(user)) in m_instances) + { + SoundRecorder temp = m_instances[id]; + ret = temp.onStart(); + } + + return ret; + } + + extern(C) static void internalOnStop(void* user) + { + // Nothing to do + } + + /* + * Managed thread loop + */ + void threadPoll(void* user) + { + while (m_flag) + { + sleep(0.05f); + // if samples are available + if (!m_list.empty) + { + // Lock ressources + scope Lock l = new Lock(m_mutex); + + Samples s = m_list.dequeue; + m_continue = this.onProcessSamples(s.data[0..s.length].dup); + + delete s; + + if (!m_continue) + { + // delete all samples left + foreach(Samples dummy; m_list) + delete dummy; + break; + } + } + } + + onStop(); + } + + Mutex m_mutex; + + bool m_flag; + bool m_continue = true; + LinkedList!(Samples) m_list; + Thread m_t; + +// External ==================================================================== + + extern (C) + { + typedef void* function(int function(void*), int function(short*, size_t, void*), void function(void*), void*) pf_sfSoundRecorder_Create; + typedef void function(void*) pf_sfSoundRecorder_Destroy; + typedef void function(void*, uint SampleRate) pf_sfSoundRecorder_Start; + typedef void function(void*) pf_sfSoundRecorder_Stop; + typedef uint function(void*) pf_sfSoundRecorder_GetSampleRate; + typedef int function() pf_sfSoundRecorder_CanCapture; + + static pf_sfSoundRecorder_Create sfSoundRecorder_Create; + static pf_sfSoundRecorder_Destroy sfSoundRecorder_Destroy; + static pf_sfSoundRecorder_Start sfSoundRecorder_Start; + static pf_sfSoundRecorder_Stop sfSoundRecorder_Stop; + static pf_sfSoundRecorder_GetSampleRate sfSoundRecorder_GetSampleRate; + static pf_sfSoundRecorder_CanCapture sfSoundRecorder_CanCapture; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfSoundRecorder_Create = cast(pf_sfSoundRecorder_Create)dll.getSymbol("sfSoundRecorder_Create"); + sfSoundRecorder_Destroy = cast(pf_sfSoundRecorder_Destroy)dll.getSymbol("sfSoundRecorder_Destroy"); + sfSoundRecorder_Start = cast(pf_sfSoundRecorder_Start)dll.getSymbol("sfSoundRecorder_Start"); + sfSoundRecorder_Stop = cast(pf_sfSoundRecorder_Stop)dll.getSymbol("sfSoundRecorder_Stop"); + sfSoundRecorder_GetSampleRate = cast(pf_sfSoundRecorder_GetSampleRate)dll.getSymbol("sfSoundRecorder_GetSampleRate"); + sfSoundRecorder_CanCapture = cast(pf_sfSoundRecorder_CanCapture)dll.getSymbol("sfSoundRecorder_CanCapture"); + } + +} + +// Use explicit alloc to allow instaciation by C thread +private class Samples +{ + mixin Alloc; + + this(short* data, size_t length) + { + this.data = data; + this.length = length; + } + + public short* data; + public size_t length; +} + diff --git a/DSFML/import/dsfml/audio/soundstatus.d b/DSFML/import/dsfml/audio/soundstatus.d new file mode 100644 index 00000000..288da9d0 --- /dev/null +++ b/DSFML/import/dsfml/audio/soundstatus.d @@ -0,0 +1,34 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.soundstatus; + +/// Enumeration of the sound states +enum SoundStatus +{ + STOPPED, /// Sound / music is not playing + PAUSED, /// Sound / music is paused + PLAYING /// Sound / music is playing +} diff --git a/DSFML/import/dsfml/audio/soundstream.d b/DSFML/import/dsfml/audio/soundstream.d new file mode 100644 index 00000000..2a9ee938 --- /dev/null +++ b/DSFML/import/dsfml/audio/soundstream.d @@ -0,0 +1,550 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.audio.soundstream; + +import dsfml.system.alloc; +import dsfml.system.common; +import dsfml.system.vector3; +import dsfml.system.linkedlist; +import dsfml.system.lock; +import dsfml.system.mutex; +import dsfml.system.sleep; +import dsfml.system.thread; + +import dsfml.audio.sound; +import dsfml.audio.soundstatus; + +/** +* SoundStream is a streamed sound, ie samples are acquired +* while the sound is playing. Use it for big sounds that would +* require hundreds of MB in memory, or for streaming sound from the network. +* +* SoundStream is a base class and cannot be instanciated directly. +* +* $(B onGetData override will be called by a different thread, take care of synchronization issues.) onStart is called by the thread which called .play(). +* +* ------------------------ +* class MySoundStream : SoundStream +* { +* this() +* { +* super(2, 44100); // you need to initialize the base class before any operation. +* } +* protected bool onGetData(out short[] data) +* { +* //You need to fill data array with some samples +* +* return true; //or false if you want to stop playback +* } +* +* protected bool onStart() +* { +* return true; +* } +* } +* ------------------------ +*/ +abstract class SoundStream : DSFMLObject +{ + override void dispose() + { + stop(); + sfSoundStream_Destroy(m_ptr); + s_instances.remove(m_id); + } + + /** + * Start playing the stream + */ + void play() + { + m_flag = true; + sfSoundStream_Play(m_ptr); + + if (getStatus() != SoundStatus.PAUSED) + { + m_t = new Thread(&threadPoll); + m_t.launch(); + } + } + + /** + * Pause the stream + */ + void pause() + { + sfSoundStream_Pause(m_ptr); + } + + /** + * Stop the stream + */ + void stop() + { + m_flag = false; + sfSoundStream_Stop(m_ptr); + m_t.wait(); + if (m_dummy !is null) + delete m_dummy; + } + + /** + * Get number of channels of the stream + * + * Returns: + * number of channels + */ + uint getChannelsCount() + { + return m_channelsCount; + } + + /** + * Get the sample rate of the stream + * + * Returns: + * sample rate + */ + uint getSampleRate() + { + return m_sampleRate; + } + + /** + * Get the current status of the stream + * + * Returns: + * Current stream status + */ + SoundStatus getStatus() + { + return sfSoundStream_GetStatus(m_ptr); + } + + /** + * Set the sound pitch. + * The default pitch is 1 + * + * Params: + * pitch = New pitch + */ + void setPitch(float pitch) + { + sfSoundStream_SetPitch(m_ptr, pitch); + } + + /** + * Set the sound volume. + * The default volume is 100 + * + * Params: + * volume = Volume (in range [0, 100]) + */ + void setVolume(float volume) + in + { + assert(volume >= 0.f && volume <= 100.f); + } + body + { + sfSoundStream_SetVolume(m_ptr, volume); + } + + /* + * Set the sound position (take 3 values). + * The default position is (0, 0, 0) + * + * Params: + * x, y, z = Position of the sound in the world + */ + + void setPosition(float x, float y, float z) + { + sfSoundStream_SetPosition(m_ptr, x, y, z); + } + + /** + * Set the sound position (take 3 values). + * The default position is (0, 0, 0) + * + * Params: + * vec = Position of the sound in the world + * + */ + + void setPosition(Vector3f vec) + { + sfSoundStream_SetPosition(m_ptr, vec.x, vec.y, vec.z); + } + + /** + * Set the minimum distance - closer than this distance, + * the listener will hear the sound at its maximum volume. + * The default minimum distance is 1.0 + * + * Params: + * minDistance = New minimum distance for the sound + */ + void setMinDistance(float minDistance) + { + sfSoundStream_SetMinDistance(m_ptr, minDistance); + } + + /** + * Set the attenuation factor - the higher the attenuation, the + * more the sound will be attenuated with distance from listener. + * The default attenuation factor 1.0 + * + * Params: + * attenuation = New attenuation factor for the sound + * + */ + void setAttenuation(float attenuation) + { + sfSoundStream_SetAttenuation(m_ptr, attenuation); + } + + /** + * Get the pitch + * + * Returns: + * Pitch value + */ + + float getPitch() + { + return sfSoundStream_GetPitch(m_ptr); + } + /** + * Get the volume + * + * Returns: + * Volume value (in range [1, 100]) + * + */ + + float getVolume() + { + return sfSoundStream_GetVolume(m_ptr); + } + + /** + * Get the sound position + * + * Returns: + * Sound position + */ + Vector3f getPosition() + { + Vector3f vec; + sfSoundStream_GetPosition(m_ptr, &vec.x, &vec.y, &vec.z); + return vec; + } + + /** + * Get the minimum distance + * + * Returns: + * Get the minimum distance of the sound + */ + float getMinDistance() + { + return sfSoundStream_GetMinDistance(m_ptr); + } + + /** + * Get the attenuation + * + * Returns: + * Get the attenuation of the sound + */ + float getAttenuation() + { + return sfSoundStream_GetAttenuation(m_ptr); + } + + /** + * Get the current playing offset of the stream + * + * Returns: + * current playing offset, in seconds. + */ + float getPlayingOffset() + { + return sfSoundStream_GetPlayingOffset(m_ptr); + } + + /** + * Tell whether or not the stream is looping + * + * Returns: + * True if the music is looping, false otherwise + */ + bool getLoop() + { + if (m_ptr !is null) + return cast(bool)sfSoundStream_GetLoop(m_ptr); + return false; + } + + /** + * Set the stream loop state. + * + * Disabled by default. + * + * Params: + * loop = true to play in loop, false to play once + */ + void setLoop(bool loop) + { + if (m_ptr !is null) + sfSoundStream_SetLoop(m_ptr, loop); + } +protected: + /** + * Protected constructor + * + * Params: + * channelsCount = number of channel + * sampleRate = sample rate of the stream + * + */ + this(uint channelsCount, uint sampleRate) + { + m_channelsCount = channelsCount; + m_sampleRate = sampleRate; + super(sfSoundStream_Create(&externalOnStart, &externalOnGetData, channelsCount, sampleRate, &m_id)); + + m_mutex = new Mutex(); + + m_samples = new LinkedList!(Data); + + m_t = new Thread(&this.threadPoll); + + m_id = ++s_seed; + s_instances[m_id] = this; + } + + /** + * Called each time the stream restart + * + * Returns: + * false to abort the playback + */ + abstract bool onStart(); + + /** + * Called each time the stream needs new data. + * This method will be call by an other thread, take care of possible synchronisation issues. + * + * Params: + * data = array of samples to stream + * + * Returns: + * true to continue streaming, false to stop + */ + abstract bool onGetData(out short[] data); +private: + + // Called sync when user calling play() + extern(C) static int externalOnStart(void* user) + { + int id; + if ((id = *cast(int*) user) in s_instances) + { + SoundStream temp = s_instances[id]; + return (temp.m_flag = temp.onStart()); + } + return true; + } + + // C Thread callback (no allocation can be done) + extern (C) static int externalOnGetData(sfSoundStreamChunk* data, void* user) + { + int id, flag = false; + // Get calling soundStream + if ((id = *cast(int*) user) in s_instances) + { + SoundStream temp = s_instances[id]; + //if no samples are available but streaming is not stopped, we sleep the thread + while (temp.m_samples.empty && temp.m_flag) + sleep(0.01f); + + scope Lock l = new Lock(temp.m_mutex); + if (!temp.m_samples.empty) + { + if (temp.m_dummy !is null) + delete temp.m_dummy; + + temp.m_dummy = temp.m_samples.dequeue; + + if ((flag = temp.m_dummy.Flag) == true) + { + data.Samples = temp.m_dummy.Samples.ptr; + data.NbSamples = temp.m_dummy.Samples.length; + } + else + { + data.Samples = null; + data.NbSamples = 0; + } + } + } + return flag; + } + + // Managed thread loop + void threadPoll(void* dummy) + { + short[] data; + bool ret = true; + // while streaming is active ... + while (ret && m_flag) + { + { + scope Lock l = new Lock(m_mutex); + // see how many samples are available (keep always 2 samples ready) + if (m_samples.getCount < 2) + { + // if we need new samples, lock and call derived class + ret = onGetData(data); + m_samples.enqueue(new Data(data, ret)); + } + } + sleep(0.1f); + } + } + + private class Data + { + short[] Samples; + bool Flag; + + mixin Alloc; + + this (short[] samples, bool flag) + { + this.Samples = samples; + this.Flag = flag; + } + } + + Thread m_t; + Mutex m_mutex; + LinkedList!(Data) m_samples; + Data m_dummy; + + bool m_flag; + + uint m_channelsCount; + uint m_sampleRate; + + int m_id; + static SoundStream[int] s_instances; + static int s_seed = 0; + +// External ==================================================================== + + extern (C) + { + struct sfSoundStreamChunk{ short* Samples; uint NbSamples; } + + alias int function(void*) sfSoundStreamStartCallback; + alias int function (sfSoundStreamChunk*, void*) sfSoundStreamGetDataCallback; + + typedef void* function(sfSoundStreamStartCallback, sfSoundStreamGetDataCallback, uint, uint, void*) pf_sfSoundStream_Create; + typedef void function(void*) pf_sfSoundStream_Destroy; + typedef void function(void*) pf_sfSoundStream_Play; + typedef void function(void*) pf_sfSoundStream_Pause; + typedef void function(void*) pf_sfSoundStream_Stop; + typedef SoundStatus function(void*) pf_sfSoundStream_GetStatus; + typedef uint function(void*) pf_sfSoundStream_GetChannelsCount; + typedef uint function(void*) pf_sfSoundStream_GetSampleRate; + typedef void function(void*, float) pf_sfSoundStream_SetPitch; + typedef void function(void*, float) pf_sfSoundStream_SetVolume; + typedef void function(void*, float, float, float) pf_sfSoundStream_SetPosition; + typedef void function(void*, float) pf_sfSoundStream_SetMinDistance; + typedef void function(void*, float) pf_sfSoundStream_SetAttenuation; + typedef float function(void*) pf_sfSoundStream_GetPitch; + typedef float function(void*) pf_sfSoundStream_GetVolume; + typedef void function(void*, float*, float*, float*) pf_sfSoundStream_GetPosition; + typedef float function(void*) pf_sfSoundStream_GetMinDistance; + typedef float function(void*) pf_sfSoundStream_GetAttenuation; + typedef float function(void*) pf_sfSoundStream_GetPlayingOffset; + typedef int function(void*) pf_sfSoundStream_GetLoop; + typedef void function(void*, int) pf_sfSoundStream_SetLoop; + + + static pf_sfSoundStream_Create sfSoundStream_Create; + static pf_sfSoundStream_Destroy sfSoundStream_Destroy; + static pf_sfSoundStream_Play sfSoundStream_Play; + static pf_sfSoundStream_Pause sfSoundStream_Pause; + static pf_sfSoundStream_Stop sfSoundStream_Stop; + static pf_sfSoundStream_GetStatus sfSoundStream_GetStatus; + static pf_sfSoundStream_GetChannelsCount sfSoundStream_GetChannelsCount; + static pf_sfSoundStream_GetSampleRate sfSoundStream_GetSampleRate; + static pf_sfSoundStream_SetPitch sfSoundStream_SetPitch; + static pf_sfSoundStream_SetVolume sfSoundStream_SetVolume; + static pf_sfSoundStream_SetPosition sfSoundStream_SetPosition; + static pf_sfSoundStream_SetMinDistance sfSoundStream_SetMinDistance; + static pf_sfSoundStream_SetAttenuation sfSoundStream_SetAttenuation; + static pf_sfSoundStream_GetPitch sfSoundStream_GetPitch; + static pf_sfSoundStream_GetVolume sfSoundStream_GetVolume; + static pf_sfSoundStream_GetPosition sfSoundStream_GetPosition; + static pf_sfSoundStream_GetMinDistance sfSoundStream_GetMinDistance; + static pf_sfSoundStream_GetAttenuation sfSoundStream_GetAttenuation; + static pf_sfSoundStream_GetPlayingOffset sfSoundStream_GetPlayingOffset; + static pf_sfSoundStream_GetLoop sfSoundStream_GetLoop; + static pf_sfSoundStream_SetLoop sfSoundStream_SetLoop; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-audio"); + + sfSoundStream_Create = cast(pf_sfSoundStream_Create)dll.getSymbol("sfSoundStream_Create"); + sfSoundStream_Destroy = cast(pf_sfSoundStream_Destroy)dll.getSymbol("sfSoundStream_Destroy"); + sfSoundStream_Play = cast(pf_sfSoundStream_Play)dll.getSymbol("sfSoundStream_Play"); + sfSoundStream_Pause = cast(pf_sfSoundStream_Pause)dll.getSymbol("sfSoundStream_Pause"); + sfSoundStream_Stop = cast(pf_sfSoundStream_Stop)dll.getSymbol("sfSoundStream_Stop"); + sfSoundStream_GetStatus = cast(pf_sfSoundStream_GetStatus)dll.getSymbol("sfSoundStream_GetStatus"); + sfSoundStream_GetChannelsCount = cast(pf_sfSoundStream_GetChannelsCount)dll.getSymbol("sfSoundStream_GetChannelsCount"); + sfSoundStream_GetSampleRate = cast(pf_sfSoundStream_GetSampleRate)dll.getSymbol("sfSoundStream_GetSampleRate"); + sfSoundStream_SetPitch = cast(pf_sfSoundStream_SetPitch)dll.getSymbol("sfSoundStream_SetPitch"); + sfSoundStream_SetVolume = cast(pf_sfSoundStream_SetVolume)dll.getSymbol("sfSoundStream_SetVolume"); + sfSoundStream_SetPosition = cast(pf_sfSoundStream_SetPosition)dll.getSymbol("sfSoundStream_SetPosition"); + sfSoundStream_SetMinDistance = cast(pf_sfSoundStream_SetMinDistance)dll.getSymbol("sfSoundStream_SetMinDistance"); + sfSoundStream_SetAttenuation = cast(pf_sfSoundStream_SetAttenuation)dll.getSymbol("sfSoundStream_SetAttenuation"); + sfSoundStream_GetPitch = cast(pf_sfSoundStream_GetPitch)dll.getSymbol("sfSoundStream_GetPitch"); + sfSoundStream_GetVolume = cast(pf_sfSoundStream_GetVolume)dll.getSymbol("sfSoundStream_GetVolume"); + sfSoundStream_GetPosition = cast(pf_sfSoundStream_GetPosition)dll.getSymbol("sfSoundStream_GetPosition"); + sfSoundStream_GetMinDistance = cast(pf_sfSoundStream_GetMinDistance)dll.getSymbol("sfSoundStream_GetMinDistance"); + sfSoundStream_GetAttenuation = cast(pf_sfSoundStream_GetAttenuation)dll.getSymbol("sfSoundStream_GetAttenuation"); + sfSoundStream_GetPlayingOffset = cast(pf_sfSoundStream_GetPlayingOffset)dll.getSymbol("sfSoundStream_GetPlayingOffset"); + sfSoundStream_GetLoop = cast(pf_sfSoundStream_GetLoop)dll.getSymbol("sfSoundStream_GetLoop"); + sfSoundStream_SetLoop = cast(pf_sfSoundStream_SetLoop)dll.getSymbol("sfSoundStream_SetLoop"); + } +} diff --git a/DSFML/import/dsfml/graphics/all.d b/DSFML/import/dsfml/graphics/all.d new file mode 100644 index 00000000..dd29091d --- /dev/null +++ b/DSFML/import/dsfml/graphics/all.d @@ -0,0 +1,41 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.all; + +public import + dsfml.graphics.blendmode, + dsfml.graphics.color, + dsfml.graphics.font, + dsfml.graphics.idrawable, + dsfml.graphics.image, + dsfml.graphics.postfx, + dsfml.graphics.rect, + dsfml.graphics.renderwindow, + dsfml.graphics.shape, + dsfml.graphics.sprite, + dsfml.graphics.string, + dsfml.graphics.textstyle, + dsfml.graphics.view; diff --git a/DSFML/import/dsfml/graphics/blendmode.d b/DSFML/import/dsfml/graphics/blendmode.d new file mode 100644 index 00000000..c2497a93 --- /dev/null +++ b/DSFML/import/dsfml/graphics/blendmode.d @@ -0,0 +1,37 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.blendmode; + +/** +* Enumerate the blending modes for drawable objects. +*/ +enum BlendMode +{ + ALPHA, /// Pixel = Src * a + Dest * (1 - a) + ADD, /// Pixel = Src + Dest + MULTIPLY, /// Pixel = Src * Dest + NONE /// No blending +} diff --git a/DSFML/import/dsfml/graphics/color.d b/DSFML/import/dsfml/graphics/color.d new file mode 100644 index 00000000..79929485 --- /dev/null +++ b/DSFML/import/dsfml/graphics/color.d @@ -0,0 +1,130 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.color; + + +/** +* Color is an utility structure for manipulating colors +*/ +struct Color +{ + /** + * Construct the color from its 4 RGBA components + * + * Params: + * r = Red component (0 .. 255) + * g = Green component (0 .. 255) + * b = Blue component (0 .. 255) + * a = Alpha component (0 .. 255) (255 by default) + */ + static Color opCall(ubyte r, ubyte g, ubyte b, ubyte a = 255) + { + Color c; + c.r = r; + c.g = g; + c.b = b; + c.a = a; + + return c; + } + + /** + * Operator == and != overload to compare two colors + */ + int opEquals(Color color2) + { + return + (r == color2.r) + && (g == color2.g) + && (b == color2.b) + && (a == color2.a); + } + /** + * Operator + overload to add two colors + */ + Color opAdd(Color color2) + { + ubyte r = this.r + color2.r > 255 ? 255 : this.r + color2.r; + ubyte g = this.g + color2.g > 255 ? 255 : this.g + color2.g; + ubyte b = this.b + color2.b > 255 ? 255 : this.b + color2.b; + ubyte a = this.a + color2.a > 255 ? 255 : this.a + color2.a; + + return Color(r, g, b, a); + } + + /** + * Operator += overload + */ + Color opAddAssign(Color color2) + { + this.r = this.r + color2.r > 255 ? 255 : this.r + color2.r; + this.g = this.g + color2.g > 255 ? 255 : this.g + color2.g; + this.b = this.b + color2.b > 255 ? 255 : this.b + color2.b; + this.a = this.a + color2.a > 255 ? 255 : this.a + color2.a; + + return *this; + } + + /** + * Operator * overload to modulate colors + */ + Color opMul(Color color2) + { + ubyte r = this.r * color2.r / 255; + ubyte g = this.g * color2.g / 255; + ubyte b = this.b * color2.b / 255; + ubyte a = this.a * color2.a / 255; + + return Color(r, g, b, a); + } + + /** + * Operator *= overload + */ + Color opMulAssign(Color color2) + { + this.r = this.r * color2.r / 255; + this.g = this.g * color2.g / 255; + this.b = this.b * color2.b / 255; + this.a = this.a * color2.a / 255; + + return *this; + } + + ubyte r; /// Red component + ubyte g; /// Green component + ubyte b; /// Blue component + ubyte a = 255; /// Alpha (transparency) component + + static const Color BLACK = {0, 0, 0}; /// Black predefined color + static const Color WHITE = {255, 255, 255}; /// White predefined color + static const Color RED = {255, 0, 0}; /// Red predefined color + static const Color GREEN = {0, 255, 0}; /// Green predefined color + static const Color BLUE = {0, 0, 255}; /// Blue predefined color + static const Color YELLOW = {255, 0, 255}; /// Yellow predefined color + static const Color MAGENTA = {255, 0, 255}; /// Magenta predefined color + static const Color CYAN = {0, 255, 255}; /// Cyan predefined color +} diff --git a/DSFML/import/dsfml/graphics/drawableimpl.d b/DSFML/import/dsfml/graphics/drawableimpl.d new file mode 100644 index 00000000..b954bca4 --- /dev/null +++ b/DSFML/import/dsfml/graphics/drawableimpl.d @@ -0,0 +1,320 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.drawableimpl; + +public import dsfml.system.common; +import dsfml.system.vector2; + +import dsfml.graphics.idrawable; +import dsfml.graphics.color; +import dsfml.graphics.blendmode; +import dsfml.graphics.renderwindow; + + +package +{ + struct sfSprite{}; + struct sfShape{}; + struct sfString{}; +} + +/* +* Package base class of all drawable. +* Provide implementation of IDrawable and functions aliases. +*/ +package class Drawableimpl(T) : DSFMLObject, IDrawable +{ + void setX(float x) + { + sfDrawable_SetX(m_ptr, x); + } + + void setY(float y) + { + sfDrawable_SetY(m_ptr, y); + } + + void setPosition(float x, float y) + { + sfDrawable_SetPosition(m_ptr, x, y); + } + + void setPosition(Vector2f vec) + { + sfDrawable_SetPosition(m_ptr, vec.x, vec.y); + } + + void setScaleX(float scale) + { + if (scale > 0) + sfDrawable_SetScaleX(m_ptr, scale); + } + + void setScaleY(float scale) + { + if (scale > 0) + sfDrawable_SetScaleY(m_ptr, scale); + } + + void setScale(float scaleX, float scaleY) + { + if (scaleX > 0 && scaleY > 0) + sfDrawable_SetScale(m_ptr, scaleX, scaleY); + } + + void setScale(Vector2f scale) + { + if (scale.x > 0 && scale.y > 0) + sfDrawable_SetScale(m_ptr, scale.x, scale.y); + } + + void setCenter(float centerX, float centerY) + { + sfDrawable_SetCenter(m_ptr, centerX, centerY); + } + + void setCenter(Vector2f center) + { + sfDrawable_SetCenter(m_ptr, center.x, center.y); + } + + void setRotation(float angle) + { + sfDrawable_SetRotation(m_ptr, angle); + } + + void setColor(Color c) + { + sfDrawable_SetColor(m_ptr, c); + } + + void setBlendMode(BlendMode mode) + { + sfDrawable_SetBlendMode(m_ptr, mode); + } + + Vector2f getPosition() + { + return Vector2f(sfDrawable_GetX(m_ptr), sfDrawable_GetY(m_ptr)); + } + + Vector2f getScale() + { + return Vector2f(sfDrawable_GetScaleX(m_ptr), sfDrawable_GetScaleY(m_ptr)); + } + + Vector2f getCenter() + { + return Vector2f(sfDrawable_GetCenterX(m_ptr), sfDrawable_GetCenterY(m_ptr)); + } + + float getRotation() + { + return sfDrawable_GetRotation(m_ptr); + } + + Color getColor() + { + return sfDrawable_GetColor(m_ptr); + } + + BlendMode getBlendMode() + { + return cast(BlendMode)(sfDrawable_GetBlendMode(m_ptr)); + } + + void rotate(float angle) + { + sfDrawable_Rotate(m_ptr, angle); + } + + void move(float offsetX, float offsetY) + { + sfDrawable_Move(m_ptr, offsetX, offsetY); + } + + void move(Vector2f offset) + { + sfDrawable_Move(m_ptr, offset.x, offset.y); + } + + void scale(float scaleX, float scaleY) + { + if (scaleX > 0 && scaleY > 0) + sfDrawable_SetScale(m_ptr, scaleX, scaleY); + } + + void scale(Vector2f scale) + { + if (scale.x > 0 && scale.y > 0) + sfDrawable_SetScale(m_ptr, scale.x, scale.y); + } + + Vector2f tranformToLocal(Vector2f point) + { + Vector2f ret; + sfDrawable_TransformToLocal(m_ptr, point.x, point.y, &ret.x, &ret.y); + return ret; + } + + Vector2f tranformToGlobal(Vector2f point) + { + Vector2f ret; + sfDrawable_TransformToLocal(m_ptr, point.x, point.y, &ret.x, &ret.y); + return ret; + } + + void render(RenderWindow window) + { + sfRenderWindow_DrawThis(window.getNativePointer, m_ptr); + } + + override void dispose() + { + sfDrawable_Destroy(m_ptr); + } + +protected: + this() + { + super(sfDrawable_Create()); + } + + this(void* ptr) + { + super(ptr); + } + +private: + + extern (C) + { + typedef void* function() pf_sfDrawable_Create; + typedef void function(void*) pf_sfDrawable_Destroy; + typedef void function(void*, float) pf_sfDrawable_SetX; + typedef void function(void*, float) pf_sfDrawable_SetY; + typedef void function(void*, float, float) pf_sfDrawable_SetPosition; + typedef void function(void*, float) pf_sfDrawable_SetScaleX; + typedef void function(void*, float) pf_sfDrawable_SetScaleY; + typedef void function(void*, float, float) pf_sfDrawable_SetScale; + typedef void function(void*, float) pf_sfDrawable_SetRotation; + typedef void function(void*, float, float) pf_sfDrawable_SetCenter; + typedef void function(void*, Color) pf_sfDrawable_SetColor; + typedef void function(void*, BlendMode) pf_sfDrawable_SetBlendMode; + typedef float function(void*) pf_sfDrawable_GetX; + typedef float function(void*) pf_sfDrawable_GetY; + typedef float function(void*) pf_sfDrawable_GetScaleX; + typedef float function(void*) pf_sfDrawable_GetScaleY; + typedef float function(void*) pf_sfDrawable_GetRotation; + typedef float function(void*) pf_sfDrawable_GetCenterX; + typedef float function(void*) pf_sfDrawable_GetCenterY; + typedef Color function(void*) pf_sfDrawable_GetColor; + typedef BlendMode function(void*) pf_sfDrawable_GetBlendMode; + typedef void function(void*, float, float) pf_sfDrawable_Move; + typedef void function(void*, float, float) pf_sfDrawable_Scale; + typedef void function(void*, float) pf_sfDrawable_Rotate; + typedef void function(void*, float, float, float*, float*) pf_sfDrawable_TransformToLocal; + typedef void function(void*, float, float, float*, float*) pf_sfDrawable_TransformToGlobal; + + typedef void function(void*, void*) pf_sfRenderWindow_DrawThis; + + static pf_sfDrawable_Create sfDrawable_Create; + static pf_sfDrawable_Destroy sfDrawable_Destroy; + static pf_sfDrawable_SetX sfDrawable_SetX; + static pf_sfDrawable_SetY sfDrawable_SetY; + static pf_sfDrawable_SetPosition sfDrawable_SetPosition; + static pf_sfDrawable_SetScaleX sfDrawable_SetScaleX; + static pf_sfDrawable_SetScaleY sfDrawable_SetScaleY; + static pf_sfDrawable_SetScale sfDrawable_SetScale; + static pf_sfDrawable_SetRotation sfDrawable_SetRotation; + static pf_sfDrawable_SetCenter sfDrawable_SetCenter; + static pf_sfDrawable_SetColor sfDrawable_SetColor; + static pf_sfDrawable_SetBlendMode sfDrawable_SetBlendMode; + static pf_sfDrawable_GetX sfDrawable_GetX; + static pf_sfDrawable_GetY sfDrawable_GetY; + static pf_sfDrawable_GetScaleX sfDrawable_GetScaleX; + static pf_sfDrawable_GetScaleY sfDrawable_GetScaleY; + static pf_sfDrawable_GetRotation sfDrawable_GetRotation; + static pf_sfDrawable_GetCenterX sfDrawable_GetCenterX; + static pf_sfDrawable_GetCenterY sfDrawable_GetCenterY; + static pf_sfDrawable_GetColor sfDrawable_GetColor; + static pf_sfDrawable_GetBlendMode sfDrawable_GetBlendMode; + static pf_sfDrawable_Move sfDrawable_Move; + static pf_sfDrawable_Scale sfDrawable_Scale; + static pf_sfDrawable_Rotate sfDrawable_Rotate; + static pf_sfDrawable_TransformToLocal sfDrawable_TransformToLocal; + static pf_sfDrawable_TransformToGlobal sfDrawable_TransformToGlobal; + + static pf_sfRenderWindow_DrawThis sfRenderWindow_DrawThis; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + static if (is (T : sfSprite)) + { + char[] symbol = "sfSprite"; + } + else static if (is (T : sfString)) + { + char[] symbol = "sfString"; + } + else static if (is (T : sfShape)) + { + char[] symbol = "sfShape"; + } + + sfDrawable_Create = cast(pf_sfDrawable_Create)dll.getSymbol(symbol ~ "_Create"); + sfDrawable_Destroy = cast(pf_sfDrawable_Destroy)dll.getSymbol(symbol ~ "_Destroy"); + sfDrawable_SetX = cast(pf_sfDrawable_SetX)dll.getSymbol(symbol ~ "_SetX"); + sfDrawable_SetY = cast(pf_sfDrawable_SetY)dll.getSymbol(symbol ~ "_SetY"); + sfDrawable_SetPosition = cast(pf_sfDrawable_SetPosition)dll.getSymbol(symbol ~ "_SetPosition"); + sfDrawable_SetScaleX = cast(pf_sfDrawable_SetScaleX)dll.getSymbol(symbol ~ "_SetScaleX"); + sfDrawable_SetScaleY = cast(pf_sfDrawable_SetScaleY)dll.getSymbol(symbol ~ "_SetScaleY"); + sfDrawable_SetScale = cast(pf_sfDrawable_SetScale)dll.getSymbol(symbol ~ "_SetScale"); + sfDrawable_SetRotation = cast(pf_sfDrawable_SetRotation)dll.getSymbol(symbol ~ "_SetRotation"); + sfDrawable_SetCenter = cast(pf_sfDrawable_SetCenter)dll.getSymbol(symbol ~ "_SetCenter"); + sfDrawable_SetColor = cast(pf_sfDrawable_SetColor)dll.getSymbol(symbol ~ "_SetColor"); + sfDrawable_SetBlendMode = cast(pf_sfDrawable_SetBlendMode)dll.getSymbol(symbol ~ "_SetBlendMode"); + sfDrawable_GetX = cast(pf_sfDrawable_GetX)dll.getSymbol(symbol ~ "_GetX"); + sfDrawable_GetY = cast(pf_sfDrawable_GetY)dll.getSymbol(symbol ~ "_GetY"); + sfDrawable_GetScaleX = cast(pf_sfDrawable_GetScaleX)dll.getSymbol(symbol ~ "_GetScaleX"); + sfDrawable_GetScaleY = cast(pf_sfDrawable_GetScaleY)dll.getSymbol(symbol ~ "_GetScaleX"); + sfDrawable_GetRotation = cast(pf_sfDrawable_GetRotation)dll.getSymbol(symbol ~ "_GetRotation"); + sfDrawable_GetCenterX = cast(pf_sfDrawable_GetCenterX)dll.getSymbol(symbol ~ "_GetCenterX"); + sfDrawable_GetCenterY = cast(pf_sfDrawable_GetCenterY)dll.getSymbol(symbol ~ "_GetCenterY"); + sfDrawable_GetColor = cast(pf_sfDrawable_GetColor)dll.getSymbol(symbol ~ "_GetColor"); + sfDrawable_GetBlendMode = cast(pf_sfDrawable_GetBlendMode)dll.getSymbol(symbol ~ "_GetBlendMode"); + sfDrawable_Move = cast(pf_sfDrawable_Move)dll.getSymbol(symbol ~ "_Move"); + sfDrawable_Scale = cast(pf_sfDrawable_Scale)dll.getSymbol(symbol ~ "_Scale"); + sfDrawable_Rotate = cast(pf_sfDrawable_Rotate)dll.getSymbol(symbol ~ "_Rotate"); + sfDrawable_TransformToLocal = cast(pf_sfDrawable_TransformToLocal)dll.getSymbol(symbol ~ "_TransformToLocal"); + sfDrawable_TransformToGlobal = cast(pf_sfDrawable_TransformToGlobal)dll.getSymbol(symbol ~ "_TransformToGlobal"); + + sfRenderWindow_DrawThis = cast(pf_sfRenderWindow_DrawThis)dll.getSymbol("sfRenderWindow_Draw" ~ symbol[2..$]); + } +} diff --git a/DSFML/import/dsfml/graphics/font.d b/DSFML/import/dsfml/graphics/font.d new file mode 100644 index 00000000..3ce85334 --- /dev/null +++ b/DSFML/import/dsfml/graphics/font.d @@ -0,0 +1,123 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.font; + +import dsfml.system.common; +import dsfml.system.exception; +import dsfml.system.stringutil; + +/** +* Font is the low-level class for loading and +* manipulating character fonts. +*/ +class Font : DSFMLObject +{ + /** + * Get SFML default built-in font (Arial) + */ + static Font getDefaultFont() + { + if (s_default is null) + s_default = new Font(sfFont_GetDefaultFont()); + return s_default; + } + + /** + * construct the Font from a file + * + * Params: + * filename = font file to load + * charSize = size of characters (30 by default) + * charset = characters set to generate (empty by default - takes the ASCII range [31, 255]) + */ + this(char[] filename, uint charSize = 30, dchar[] charset = null) + { + if (filename is null || filename.length == 0) + throw new LoadingException("LoadingException : Filename is invalid."); + + super(sfFont_CreateFromFile(toStringz(filename), charSize, toStringz(charset))); + } + + /** + * construct the Font from a file in memory + * + * Params: + * data = data to load + * charSize = size of characters (30 by default) + * charset = characters set to generate (empty by default - takes the ASCII range [31, 255]) + */ + this(byte[] data, uint charSize = 30, dchar[] charset = null) + { + if (data is null || data.length == 0) + throw new Exception("LoadingException : Memory stream is invalid."); + + super(sfFont_CreateFromMemory(data.ptr, data.length, charSize, toStringz(charset))); + } + + + override void dispose() + { + sfFont_Destroy(m_ptr); + } + + + +package: + + this(void* ptr) + { + super(ptr, true); + } + +private: + static Font s_default; + + extern (C) + { + typedef void* function() pf_sfFont_Create; + typedef void* function(char*, uint, dchar*) pf_sfFont_CreateFromFile; + typedef void* function(byte*, size_t, uint, dchar*) pf_sfFont_CreateFromMemory; + typedef void function(void*) pf_sfFont_Destroy; + typedef void* function() pf_sfFont_GetDefaultFont; + + static pf_sfFont_Create sfFont_Create; + static pf_sfFont_CreateFromFile sfFont_CreateFromFile; + static pf_sfFont_CreateFromMemory sfFont_CreateFromMemory; + static pf_sfFont_Destroy sfFont_Destroy; + static pf_sfFont_GetDefaultFont sfFont_GetDefaultFont; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfFont_Create = cast(pf_sfFont_Create) dll.getSymbol("sfFont_Create"); + sfFont_CreateFromFile = cast(pf_sfFont_CreateFromFile) dll.getSymbol("sfFont_CreateFromFile"); + sfFont_CreateFromMemory = cast(pf_sfFont_CreateFromMemory) dll.getSymbol("sfFont_CreateFromMemory"); + sfFont_Destroy = cast(pf_sfFont_Destroy) dll.getSymbol("sfFont_Destroy"); + sfFont_GetDefaultFont = cast(pf_sfFont_GetDefaultFont) dll.getSymbol("sfFont_GetDefaultFont"); + } +} diff --git a/DSFML/import/dsfml/graphics/idrawable.d b/DSFML/import/dsfml/graphics/idrawable.d new file mode 100644 index 00000000..f96fb37e --- /dev/null +++ b/DSFML/import/dsfml/graphics/idrawable.d @@ -0,0 +1,284 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.idrawable; + +import dsfml.system.vector2; + +import dsfml.graphics.color; +import dsfml.graphics.blendmode; +import dsfml.graphics.renderwindow; + + +/** +* Interface for drawable object +* +* Shape, String and Sprite implement IDrawable +*/ +interface IDrawable +{ + /** + * Set the left position of the object + * + * Params: + * x = New left coordinate + */ + void setX(float x); + + /** + * Set the top position of the object + * + * Params: + * y = New top coordinate + */ + void setY(float y); + + + /** + * Set the position of the object + * + * Params: + * x = New left coordinate + * y = New top coordinate + */ + void setPosition(float x, float y); + + /** + * Set the position of the object + * + * Params: + * vec = new position + */ + void setPosition(Vector2f vec); + + /** + * Set the horizontal scale of the object + * + * Params: + * scale = New horizontal scale (Strictly positive) + */ + void setScaleX(float scale); + + /** + * Set the vertical scale of the object + * + * Params: + * scale = New vertical scale (Strictly positive) + */ + void setScaleY(float scale); + + /** + * Set the scale of the object + * + * Params: + * scaleX = New horizontal scale + * scaleY = New vertical scale + */ + void setScale(float scaleX, float scaleY); + + /** + * Set the scale of the object + * + * Params: + * scale = new scale + */ + void setScale(Vector2f scale); + + /** + * Set the center of the object, in coordinates relative to the + * top-left of the object (take 2 values). + * The default center is (0, 0) + * + * Params: + * centerX : X coordinate of the center + * centerY : Y coordinate of the center + */ + void setCenter(float centerX, float centerY); + + /** + * Set the center of the object, in coordinates relative to the + * top-left of the object (take a 2D vector). + * The default center is (0, 0) + * + * Params: + * center : New center + */ + void setCenter(Vector2f center); + + + /** + * Set the rotation of the object + * + * Params: + * angle = Angle of rotation, in degree + */ + void setRotation(float angle); + + /** + * Set the color + * + * Params: + * c = New color + */ + void setColor(Color c); + + /** + * Set the blending mode for the object. + * The default blend mode is Blend.Alpha + * + * Params: + * mode = New blending mode + */ + void setBlendMode(BlendMode mode); + + /** + * Get the position of the object + * + * Returns: + * Current position + * + */ + Vector2f getPosition(); + + /** + * Get the current scale of the object + * + * Returns: + * Current scale + */ + Vector2f getScale(); + + /** + * Get the center of the object + * + * Returns: + * Current position of the center + * + */ + Vector2f getCenter(); + + /** + * Get the rotation angle of the object + * + * Returns: + * Angle of rotation, in degree + */ + float getRotation(); + + /** + * Get the color of the string + * + * Returns: + * Current color + */ + Color getColor(); + + /** + * Get the current blending mode + * + * Returns: + * Current blending mode + */ + BlendMode getBlendMode(); + + /** + * Rotate the object + * Angle is added to the current orientation of the objet + * + * Params: + * angle = Angle of rotation in degree + */ + void rotate(float angle); + + /** + * Move the object + * New offset is added to object current position + * + * Params: + * offsetX = Offset on the X axis + * offsetY = Offset on the Y axis + */ + void move(float offsetX, float offsetY); + + /** + * Move the object + * New offset is added to object current position + * + * Params: + * offset = Amount of units to move the object of + */ + void move(Vector2f offset); + + /** + * Set the scale of the object + * + * Params: + * scaleX = New horizontal scale (Strictly positive) + * scaleY = New vertical scale (Strictly positive) + */ + void scale(float scaleX, float scaleY); + + /** + * Scale the object (take a 2D vector) + * + * Params: + * factor = Scaling factors (both values must be strictly positive) + */ + void scale(Vector2f factor); + + /** + * Transform a point from global coordinates into local coordinates + * (ie it applies the inverse of object's center, translation, rotation and scale to the point) + * + * Params: + * point = Point to transform + * + * Returns: + * Transformed point + */ + Vector2f tranformToLocal(Vector2f point); + + /** + * Transform a point from local coordinates into global coordinates + * (ie it applies the inverse of object's center, translation, rotation and scale to the point) + * + * Params: + * point = Point to transform + * + * Returns: + * Transformed point + */ + Vector2f tranformToGlobal(Vector2f point); + + /** + * Render the specific geometry of the object + * + * Params: + * window = Target into which render the object + */ + void render(RenderWindow window); +} + + diff --git a/DSFML/import/dsfml/graphics/image.d b/DSFML/import/dsfml/graphics/image.d new file mode 100644 index 00000000..e35d75c3 --- /dev/null +++ b/DSFML/import/dsfml/graphics/image.d @@ -0,0 +1,366 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + + + +/* +* TODO : FIX circular dependency with render window +*/ +module dsfml.graphics.image; + +import dsfml.graphics.color; +import dsfml.graphics.rect; + +import dsfml.system.common; +import dsfml.system.exception; +import dsfml.system.stringutil; + + +/** +* Image is the low-level class for loading and +* manipulating images +*/ +class Image : DSFMLObject +{ + /** + * Default constructor + */ + this() + { + super(sfImage_Create()); + } + + /** + * Construct an empty image + * + * Params: + * width = Image width + * height = Image height + * col = Image color (black by default) + */ + this(uint width, uint height, Color col = Color.BLACK) + { + super(sfImage_CreateFromColor(width, height, col)); + } + + /** + * Construct the image from a file + * + * Params: + * filename = Path of the image file to load + * + * Throws: + * LoadingException if filename is empty or null. + */ + this(char[] filename) + { + if (filename is null || filename.length == 0) + throw new LoadingException("LoadingException : Filename is invalid."); + + super(sfImage_CreateFromFile(toStringz(filename))); + } + + /** + * Construct the image from a file in memory + * + * Params: + * data = array of data in memory + * Throws: + * LoadingException if data is empty or null. + */ + this(byte[] data) + { + if (data is null || data.length == 0) + throw new LoadingException("LoadingException : Memory stream is invalid."); + + super(sfImage_CreateFromMemory(data.ptr, data.length)); + } + + /** + * Construct the image directly from an array of pixels + * + * Params: + * width = Image width + * height = Image height + * data = array of pixels in memory (assumed format is RGBA) + * + * Throws: + * LoadingException if data length doesn't match Width * Height * 4 + */ + this(uint width, uint height, ubyte[] data) + { + if (width * height * 4 != data.length) + throw new LoadingException("LoadingException : Pixels array length doesn't match the specified size."); + + super(sfImage_CreateFromPixels(width, height, data.ptr)); + } + + override void dispose() + { + sfImage_Destroy(m_ptr); + } + + /** + * Save the content of the image to a file + * + * Params: + * filename = Path of the file to save (overwritten if already exist) + * + * Returns: + * True if saving was successful + */ + bool saveToFile(char[] filename) + { + return cast(bool)sfImage_SaveToFile(m_ptr, toStringz(filename)); + } + + /** + * Create an empty image + * + * Params: + * width = Image width + * height = Image height + * col = Image color (black by default) + * + * Returns: + * True if creation was successful + */ + bool create(uint width, uint height, Color col = Color.BLACK) + { + m_ptr = sfImage_CreateFromColor(width, height, col); + return (m_ptr !is null); + } + + /** + * Create transparency mask from a specified colorkey + * + * Params: + * colorKey = Color to become transparent + * alpha = Alpha value to use for transparent pixels (0 by default) + */ + void createMaskFromColor(Color colorKey, ubyte alpha = 0) + { + sfImage_CreateMaskFromColor(m_ptr, colorKey, alpha); + } + +// /** +// * Create the image from the current contents of the +// * given window +// * +// * Params: +// * window = Window to capture +// * sourceRect = Sub-rectangle of the screen to copy (empty by default - entire image) +// * +// * Returns: +// * True if copy was successful +// */ +// void copyScreen(RenderWindow window, IntRect sourceRect = new IntRect()) +// { +// return cast(bool)sfImage_CopyScreen(m_ptr, window.getNativePointer, sourceRect.toCIntRect()); +// } + + /** + * Copy pixels from another image onto this one. + * This function does a slow pixel copy and should only + * be used at initialization time + * + * Params: + * source = Source image to copy + * destX = X coordinate of the destination position + * destY = Y coordinate of the destination position + * sourceRect = Sub-rectangle of the source image to copy + */ + void copy(Image source, uint destX, uint destY, IntRect sourceRect = new IntRect()) + { + sfImage_Copy(m_ptr, source.getNativePointer, destX, destY, sourceRect.toCIntRect()); + } + + /** + * Change the color of a pixel + * Don't forget to call Update when you end modifying pixels + * + * Params: + * x = X coordinate of pixel in the image + * y = Y coordinate of pixel in the image + * col = New color for pixel (X, Y) + */ + void setPixel(uint x, uint y, Color col) + { + sfImage_SetPixel(m_ptr, x, y, col); + } + + /** + * Get a pixel from the image + * + * Params: + * x = X coordinate of pixel in the image + * y = Y coordinate of pixel in the image + * + * Returns: + * Color of pixel (x, y) + */ + Color getPixel(uint x, uint y) + { + return sfImage_GetPixel(m_ptr, x, y); + } + + /** + * Get an array of pixels (8 bits integers RGBA) + * Array size is GetWidth() x GetHeight() x 4 + * This array becomes invalid if you reload or resize the image + * + * Returns: + * array of pixels + */ + ubyte[] getPixelsArray() + { + return sfImage_GetPixelsPtr(m_ptr)[0..getWidth() * getHeight() * 4]; + } + + /** + * Bind the image for rendering + */ + void bind() + { + sfImage_Bind(m_ptr); + } + + /** + * Enable or disable image smooth filter. + * This parameter is enabled by default + * + * Params: + * smooth = True to enable smoothing filter, false to disable it + */ + void setSmooth(bool smooth) + { + sfImage_SetSmooth(m_ptr, smooth); + } + + /** + * Return the width of the image + * + * Returns: + * Width in pixels + */ + uint getWidth() + { + return sfImage_GetWidth(m_ptr); + } + + /** + * Return the height of the image + * + * Returns: + * Height in pixels + */ + uint getHeight() + { + return sfImage_GetHeight(m_ptr); + } + + /** + * Tells whether the smooth filtering is enabled or not + * + * Returns: + * True if image smoothing is enabled + */ + bool isSmooth() + { + return cast(bool)sfImage_IsSmooth(m_ptr); + } + +package: + this(void* ptr) + { + super(ptr); + } + +private: + extern (C) + { + typedef void* function() pf_sfImage_Create; + typedef void* function(uint, uint, Color) pf_sfImage_CreateFromColor; + typedef void* function(uint, uint, ubyte*) pf_sfImage_CreateFromPixels; + typedef void* function(char*) pf_sfImage_CreateFromFile; + typedef void* function(byte* ,size_t) pf_sfImage_CreateFromMemory; + typedef void function(void*) pf_sfImage_Destroy; + typedef int function(void*, char*) pf_sfImage_SaveToFile; + typedef void function(void*, Color, ubyte) pf_sfImage_CreateMaskFromColor; + typedef int function(void*, void*, sfIntRect) pf_sfImage_CopyScreen; + typedef void function(void*, void*, uint, uint, sfIntRect) pf_sfImage_Copy; + typedef void function(void*, uint, uint, Color) pf_sfImage_SetPixel; + typedef Color function(void*, uint, uint) pf_sfImage_GetPixel; + typedef ubyte* function(void*) pf_sfImage_GetPixelsPtr; + typedef void function(void*) pf_sfImage_Bind; + typedef void function(void*, int) pf_sfImage_SetSmooth; + typedef uint function(void*) pf_sfImage_GetWidth; + typedef uint function(void*) pf_sfImage_GetHeight; + typedef int function(void*) pf_sfImage_IsSmooth; + + static pf_sfImage_Create sfImage_Create; + static pf_sfImage_CreateFromColor sfImage_CreateFromColor; + static pf_sfImage_CreateFromPixels sfImage_CreateFromPixels; + static pf_sfImage_CreateFromFile sfImage_CreateFromFile; + static pf_sfImage_CreateFromMemory sfImage_CreateFromMemory; + static pf_sfImage_Destroy sfImage_Destroy; + static pf_sfImage_SaveToFile sfImage_SaveToFile; + static pf_sfImage_CreateMaskFromColor sfImage_CreateMaskFromColor; + static pf_sfImage_CopyScreen sfImage_CopyScreen; + static pf_sfImage_Copy sfImage_Copy; + static pf_sfImage_SetPixel sfImage_SetPixel; + static pf_sfImage_GetPixel sfImage_GetPixel; + static pf_sfImage_GetPixelsPtr sfImage_GetPixelsPtr; + static pf_sfImage_Bind sfImage_Bind; + static pf_sfImage_SetSmooth sfImage_SetSmooth; + static pf_sfImage_GetWidth sfImage_GetWidth; + static pf_sfImage_GetHeight sfImage_GetHeight; + static pf_sfImage_IsSmooth sfImage_IsSmooth; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfImage_Create = cast(pf_sfImage_Create)dll.getSymbol("sfImage_Create"); + sfImage_CreateFromColor = cast(pf_sfImage_CreateFromColor)dll.getSymbol("sfImage_CreateFromColor"); + sfImage_CreateFromPixels = cast(pf_sfImage_CreateFromPixels)dll.getSymbol("sfImage_CreateFromPixels"); + sfImage_CreateFromFile = cast(pf_sfImage_CreateFromFile)dll.getSymbol("sfImage_CreateFromFile"); + sfImage_CreateFromMemory = cast(pf_sfImage_CreateFromMemory)dll.getSymbol("sfImage_CreateFromMemory"); + sfImage_Destroy = cast(pf_sfImage_Destroy)dll.getSymbol("sfImage_Destroy"); + sfImage_SaveToFile = cast(pf_sfImage_SaveToFile)dll.getSymbol("sfImage_SaveToFile"); + sfImage_CreateMaskFromColor = cast(pf_sfImage_CreateMaskFromColor)dll.getSymbol("sfImage_CreateMaskFromColor"); + sfImage_CopyScreen = cast(pf_sfImage_CopyScreen)dll.getSymbol("sfImage_CopyScreen"); + sfImage_Copy = cast(pf_sfImage_Copy)dll.getSymbol("sfImage_Copy"); + sfImage_SetPixel = cast(pf_sfImage_SetPixel)dll.getSymbol("sfImage_SetPixel"); + sfImage_GetPixel = cast(pf_sfImage_GetPixel)dll.getSymbol("sfImage_GetPixel"); + sfImage_GetPixelsPtr = cast(pf_sfImage_GetPixelsPtr)dll.getSymbol("sfImage_GetPixelsPtr"); + sfImage_Bind = cast(pf_sfImage_Bind)dll.getSymbol("sfImage_Bind"); + sfImage_SetSmooth = cast(pf_sfImage_SetSmooth)dll.getSymbol("sfImage_SetSmooth"); + sfImage_GetWidth = cast(pf_sfImage_GetWidth)dll.getSymbol("sfImage_GetWidth"); + sfImage_GetHeight = cast(pf_sfImage_GetHeight)dll.getSymbol("sfImage_GetHeight"); + sfImage_IsSmooth = cast(pf_sfImage_IsSmooth)dll.getSymbol("sfImage_IsSmooth"); + } +} diff --git a/DSFML/import/dsfml/graphics/postfx.d b/DSFML/import/dsfml/graphics/postfx.d new file mode 100644 index 00000000..a37ea61b --- /dev/null +++ b/DSFML/import/dsfml/graphics/postfx.d @@ -0,0 +1,175 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.postfx; + +import dsfml.graphics.image; + +import dsfml.system.common; +import dsfml.system.exception; +import dsfml.system.stringutil; + + +/** +* Define loading methods for effect +*/ +enum LoadingType +{ + FROMFILE, /// string represents a file path + FROMSTRING /// string represents effect code +} + +/** +* PostFX is used to apply a post effect to a window +* +* See_Also: +* $(LINK2 http://www.sfml-dev.org/tutorials/graphics-postfx.php, SFML post FX tutorial) from more informations about Post effects and GLSL fragment shaders syntax. +*/ +class PostFX : DSFMLObject +{ + /** + * construct the effect + * + * Params: + * effect = Path of a file or string containing the effect. + * type = type of the effect (default is FROMFILE) + */ + this(char[] effect, LoadingType type = LoadingType.FROMFILE) + { + if (effect is null || effect.length == 0) + throw new LoadingException("LoadingException : Effect is invalid."); + + if (type == LoadingType.FROMFILE) + super(sfPostFX_CreateFromFile(toStringz(effect))); + else + super(sfPostFX_CreateFromMemory(toStringz(effect))); + } + + override void dispose() + { + sfPostFX_Destroy(m_ptr); + } + + /** + * Change parameters of the effect + * + * Params: + * name = Parameter name in the effect + */ + void setParameter(char[] name, float x) + { + sfPostFX_SetParameter1(m_ptr, toStringz(name), x); + } + + /** + * ditto + */ + void setParameter(char[] name, float x, float y) + { + sfPostFX_SetParameter2(m_ptr, toStringz(name), x, y); + } + + /** + * ditto + */ + void setParameter(char[] name, float x, float y, float z) + { + sfPostFX_SetParameter3(m_ptr, toStringz(name), x, y, z); + } + + /** + * ditto + */ + void setParameter(char[] name, float x, float y, float z, float w) + { + sfPostFX_SetParameter4(m_ptr, toStringz(name), x, y, z, w); + } + + /** + * Set a texture parameter + * + * Params: + * name = Texture name in the effect + * texture = Image to set (pass NULL to use content of current framebuffer) + */ + void setTexture(char[] name, Image texture) + { + m_texture = texture; + sfPostFX_SetTexture(m_ptr, toStringz(name), texture is null ? null : texture.getNativePointer); + } + + /** + * Tell whether or not the system supports post-effects + * + * Returns: + * True if the system can use post-effects + */ + static bool canUsePostFX() + { + return cast(bool)sfPostFX_CanUsePostFX(); + } + + +private: + Image m_texture; + + extern (C) + { + typedef void* function(char*) pf_sfPostFX_CreateFromFile; + typedef void* function(char*) pf_sfPostFX_CreateFromMemory; + typedef void function(void*) pf_sfPostFX_Destroy; + typedef void function(void*, char*, float) pf_sfPostFX_SetParameter1; + typedef void function(void*, char*, float, float) pf_sfPostFX_SetParameter2; + typedef void function(void*, char*, float, float, float) pf_sfPostFX_SetParameter3; + typedef void function(void*, char*, float, float, float, float) pf_sfPostFX_SetParameter4; + typedef void function(void*, char*, void*) pf_sfPostFX_SetTexture; + typedef int function() pf_sfPostFX_CanUsePostFX; + + static pf_sfPostFX_CreateFromFile sfPostFX_CreateFromFile; + static pf_sfPostFX_CreateFromMemory sfPostFX_CreateFromMemory; + static pf_sfPostFX_Destroy sfPostFX_Destroy; + static pf_sfPostFX_SetParameter1 sfPostFX_SetParameter1; + static pf_sfPostFX_SetParameter2 sfPostFX_SetParameter2; + static pf_sfPostFX_SetParameter3 sfPostFX_SetParameter3; + static pf_sfPostFX_SetParameter4 sfPostFX_SetParameter4; + static pf_sfPostFX_SetTexture sfPostFX_SetTexture; + static pf_sfPostFX_CanUsePostFX sfPostFX_CanUsePostFX; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfPostFX_CreateFromFile = cast(pf_sfPostFX_CreateFromFile)dll.getSymbol("sfPostFX_CreateFromFile"); + sfPostFX_CreateFromMemory = cast(pf_sfPostFX_CreateFromMemory)dll.getSymbol("sfPostFX_CreateFromMemory"); + sfPostFX_Destroy = cast(pf_sfPostFX_Destroy)dll.getSymbol("sfPostFX_Destroy"); + sfPostFX_SetParameter1 = cast(pf_sfPostFX_SetParameter1)dll.getSymbol("sfPostFX_SetParameter1"); + sfPostFX_SetParameter2 = cast(pf_sfPostFX_SetParameter2)dll.getSymbol("sfPostFX_SetParameter2"); + sfPostFX_SetParameter3 = cast(pf_sfPostFX_SetParameter3)dll.getSymbol("sfPostFX_SetParameter3"); + sfPostFX_SetParameter4 = cast(pf_sfPostFX_SetParameter4)dll.getSymbol("sfPostFX_SetParameter4"); + sfPostFX_SetTexture = cast(pf_sfPostFX_SetTexture)dll.getSymbol("sfPostFX_SetTexture"); + sfPostFX_CanUsePostFX = cast(pf_sfPostFX_CanUsePostFX)dll.getSymbol("sfPostFX_CanUsePostFX"); + } +} diff --git a/DSFML/import/dsfml/graphics/rect.d b/DSFML/import/dsfml/graphics/rect.d new file mode 100644 index 00000000..f616a7df --- /dev/null +++ b/DSFML/import/dsfml/graphics/rect.d @@ -0,0 +1,291 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.rect; + +struct sfFloatRect +{ + float Left; + float Top; + float Right; + float Bottom; +} + +struct sfIntRect +{ + int Left; + int Top; + int Right; + int Bottom; +} + +version (Tango) +{ + import tango.core.Traits; +} +else +{ + template isIntegerType(T) + { + const bool isIntegerType = + is (T == byte) || + is (T == short) || + is (T == int) || + is (T == long); + } + + template isRealType(T) + { + const bool isRealType = + is (T == float) || + is (T == double) || + is (T == real); + } +} +/** +* Rect is an utility class for manipulating rectangles. +* Template parameter defines the type of coordinates (integer float, ...) +*/ + +class Rect (T) +{ + static if (!isIntegerType!(T) && !isRealType!(T)) + { + static assert (0, "This type is not supported by Rectangle"); + } + + T min(T)(T i, T j) + { + return i < j ? i : j; + } + + T max(T)(T i, T j) + { + return i > j ? i : j; + } + + /** + * Default constructor + */ + this() + { + m_Left = 0; + m_Top = 0; + m_Right = 0; + m_Bottom = 0; + } + + /** + * Construct the rectangle from its coordinates + * + * Params: + * leftCoord = Left coordinate of the rectangle + * topCoord = Top coordinate of the rectangle + * rightCoord = Right coordinate of the rectangle + * bottomCoord = Bottom coordinate of the rectangle + */ + this(T leftCoord, T topCoord, T rightCoord, T bottomCoord) + { + m_Left = leftCoord; + m_Top = topCoord; + m_Right = rightCoord; + m_Bottom = bottomCoord; + } + + /** + * Get the width of the rectangle + * + * Returns: + * Width of rectangle + */ + T getWidth() + { + return m_Right - m_Left; + } + + /** + * Get the height of the rectangle + * + * Returns: + * Height of rectangle + */ + T getHeight() + { + return m_Bottom - m_Top; + } + + /** + * Move the whole rectangle by the given offset + * + * Params: + * offsetX = Horizontal offset + * offsetY = Vertical offset + */ + void offset(T offsetX, T offsetY) + { + m_Left += offsetX; + m_Right += offsetX; + m_Top += offsetY; + m_Bottom += offsetY; + } + + /** + * Check if a point is inside the rectangle's area + * + * Params: + * x = X coordinate of the point to test + * y = Y coordinate of the point to test + * + * Returns: + * True if the point is inside + */ + bool contains(T x, T y) + { + return (x >= m_Left) && (x <= m_Right) && (y >= m_Top) && (y <= m_Bottom); + } + + /** + * Check intersection between two rectangles + * + * Params: + * rectangle = Rectangle to test + * overlappingRect = Rectangle to be filled with overlapping rect (NULL by default) + * + * Returns: + * True if rectangles overlap + */ + bool intersects(Rect!(T) rectangle, out Rect!(T) overlappingRect = null) + { + // Compute overlapping rect + Rect!(T) overlapping = new Rect!(T)( + max(m_Left, rectangle.getLeft), + max(m_Top, rectangle.getTop), + min(m_Right, rectangle.getRight), + min(m_Bottom, rectangle.getBottom) + ); + + // If overlapping rect is valid, then there is intersection + if ((overlapping.getLeft() < overlapping.getRight() ) && (overlapping.getTop() < overlapping.getBottom())) + { + overlappingRect = overlapping; + return true; + } + else + { + overlappingRect = new Rect!(T)(); + return false; + } + } + + /** + * Set left Coordinate + */ + void setLeft(T left) + { + m_Left = left; + } + + /** + * Set top Coordinate + */ + void setTop(T top) + { + m_Top = top; + } + + /** + * Set right Coordinate + */ + void setRight(T right) + { + m_Right = right; + } + + /** + * Set bottom Coordinate + */ + void setBottom(T bottom) + { + m_Bottom = bottom; + } + + /** + * Get left Coordinate + */ + T getLeft() + { + return m_Left; + } + + /** + * Get top Coordinate + */ + T getTop() + { + return m_Top; + } + + /** + * Get right Coordinate + */ + T getRight() + { + return m_Right; + } + + /** + * Get bottom Coordinate + */ + T getBottom() + { + return m_Bottom; + } + +package: + sfFloatRect toCFloatRect() + { + return sfFloatRect(m_Left, m_Top, m_Right, m_Bottom); + } + + sfIntRect toCIntRect() + { + return sfIntRect(cast(int)m_Left, cast(int)m_Top, cast(int)m_Right, cast(int)m_Bottom); + } + +private: + + T m_Left; // Left coordinate of the rectangle + T m_Top; // Top coordinate of the rectangle + T m_Right; // Right coordinate of the rectangle + T m_Bottom; // Bottom coordinate of the rectangle +} + +///Alias +alias Rect!(int) IntRect; +///ditto +alias Rect!(float) FloatRect; + + + diff --git a/DSFML/import/dsfml/graphics/renderwindow.d b/DSFML/import/dsfml/graphics/renderwindow.d new file mode 100644 index 00000000..262c10fc --- /dev/null +++ b/DSFML/import/dsfml/graphics/renderwindow.d @@ -0,0 +1,306 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.renderwindow; + +import dsfml.graphics.color; +import dsfml.graphics.idrawable; +import dsfml.graphics.image; +import dsfml.graphics.rect; +import dsfml.graphics.postfx; +import dsfml.graphics.view; + +import dsfml.window.event; +import dsfml.window.input; +import dsfml.window.videomode; +import dsfml.window.window; +import dsfml.window.windowhandle; +import dsfml.window.windowsettings; +import dsfml.window.windowstyle; + +import dsfml.system.common; +import dsfml.system.stringutil; +import dsfml.system.vector2; + +/** +* Simple wrapper for Window that allows easy 2D rendering. +*/ +class RenderWindow : Window +{ + /** + * Construct the window + * + * Params: + * mode = Video mode to use + * title = Title of the window + * windowStyle = Window style (Resize | Close by default) + * settings = Window settings (default is default WindowSettings values) + */ + this(VideoMode mode, in char[] title, ulong windowStyle = Style.RESIZE | Style.CLOSE, WindowSettings settings = WindowSettings()) + { + super(sfRenderWindow_Create(mode, toStringz(title), windowStyle, settings)); + m_input = new Input(sfRenderWindow_GetInput(m_ptr)); + } + + /** + * Construct the window from an existing control + * + * Params: + * handle = Platform-specific handle of the control + * settings = Window settings (default is default WindowSettings values) + */ + this(WindowHandle handle, WindowSettings settings = WindowSettings()) + { + super(sfRenderWindow_CreateFromHandle(handle, settings)); + m_input = new Input(sfRenderWindow_GetInput(m_ptr)); + } + + override void dispose() + { + sfRenderWindow_Destroy(m_ptr); + } + + /** + * Create (or recreate) the window + * + * Input created with getInput will become invalid. + * + * Params: + * mode = Video mode to use + * title = Title of the window + * windowStyle = Window style (Resize | Close by default) + * settings = Window settings (default is default WindowSettings values) + * + */ + void create(VideoMode mode, char[] title, ulong windowStyle = Style.RESIZE | Style.CLOSE, WindowSettings settings = WindowSettings()) + { + if (m_ptr !is null) + dispose(); + + m_ptr = sfRenderWindow_Create(mode, toStringz(title), windowStyle, settings); + m_input = new Input(sfRenderWindow_GetInput(m_ptr)); + } + + /** + * Create (or recreate) the window from an existing control + * + * Input created with getInput become invalid. + * + * Params: + * handle = Platform-specific handle of the control + * settings = Window settings (default is default WindowSettings values) + * + */ + void create(WindowHandle handle, WindowSettings settings = WindowSettings()) + { + if (m_ptr !is null) + dispose(); + + m_ptr = sfRenderWindow_CreateFromHandle(handle, settings); + m_input = new Input(sfRenderWindow_GetInput(m_ptr)); + } + + /** + * Draw a PostFX on the window + * + * Params: + * postFX = PostFX to draw + */ + void draw(PostFX postFX) + { + sfRenderWindow_DrawPostFX(m_ptr, postFX.getNativePointer); + } + + /** + * Draw a Sprite or a String + * + * Params: + * obj = IDrawable object to draw + */ + void draw(IDrawable obj) + { + obj.render(this); + } + /** + * Save the content of the window to an image + * + * Returns: + * Image instance containing the contents of the screen + */ + Image capture() + { + return new Image(sfRenderWindow_Capture(m_ptr)); + } + + /** + * Clear the screen with the given color. + * + * Params: + * col = Fill color + */ + void clear(Color col = Color.BLACK) + { + sfRenderWindow_Clear(m_ptr, col); + } + + /** + * Change the current active view. + * The current view is defined with the initial size of the window + * + * Params: + * newView = Pointer to the new view (pass getDefaultView to set the default view) + */ + void setView(View newView) + { + if (m_view !is null) + { + m_view.setHandled(false); + } + + sfRenderWindow_SetView(m_ptr, newView.getNativePointer); + + m_view = newView; + m_view.setHandled(true); + } + + /** + * Get the current view rectangle + * + * Returns: + * current view rectangle, in global coordinates + */ + View getView() + { + if (m_view is null) + { + void* cView = sfRenderWindow_GetView(m_ptr); + m_view = new View(cView, true); + } + return m_view; + } + + /** + * Get the default view + * + * Returns: + * default view + */ + View getDefaultView() + { + if (m_defaultView is null) + { + void* cView = sfRenderWindow_GetDefaultView(m_ptr); + m_defaultView = new View(cView, true); + } + return m_defaultView; + } + + /** + * Convert a point in window coordinates into view coordinates + * + * Params: + * windowX = X coordinate of the point to convert, relative to the window + * windowY = Y coordinate of the point to convert, relative to the window + * targetView = Target view to convert the point to (pass NULL to use the current view) + * + * Returns: + * Converted point + */ + Vector2f convertCoords(uint windowX, uint windowY, View targetView = null) + { + Vector2f vec; + sfRenderWindow_ConvertCoords(m_ptr, windowX, windowY, &vec.x, &vec.y, targetView is null ? null : targetView.getNativePointer); + return vec; + } + + /** + * Tell SFML to preserve external OpenGL states, at the expense of + * more CPU charge. Use this function if you don't want SFML + * to mess up your own OpenGL states (if any). + * Don't enable state preservation if not needed, as it will allow + * SFML to do internal optimizations and improve performances. + * This parameter is false by default + * + * Params: + * preserve = True to preserve OpenGL states, false to let SFML optimize + * + */ + void preserveOpenGLStates(bool preserve) + { + sfRenderWindow_PreserveOpenGLStates(m_ptr, preserve); + } + +private: + View m_view = null; + View m_defaultView = null; + + extern (C) + { + typedef void* function(VideoMode, char*, uint, WindowSettings) pf_sfRenderWindow_Create; + typedef void* function(WindowHandle, WindowSettings) pf_sfRenderWindow_CreateFromHandle; + typedef void function(void*) pf_sfRenderWindow_Destroy; + typedef void* function(void*) pf_sfRenderWindow_GetInput; + typedef void function(void*, void*) pf_sfRenderWindow_DrawPostFX; + typedef void* function(void*) pf_sfRenderWindow_Capture; + typedef void function(void*, Color) pf_sfRenderWindow_Clear; + typedef void function(void*, void*) pf_sfRenderWindow_SetView; + typedef void* function(void*) pf_sfRenderWindow_GetView; + typedef void* function (void*) pf_sfRenderWindow_GetDefaultView; + typedef void function(void*, uint, uint, float*, float*, void*) pf_sfRenderWindow_ConvertCoords; + typedef void function(void*, int) pf_sfRenderWindow_PreserveOpenGLStates; + + static pf_sfRenderWindow_Create sfRenderWindow_Create; + static pf_sfRenderWindow_CreateFromHandle sfRenderWindow_CreateFromHandle; + static pf_sfRenderWindow_Destroy sfRenderWindow_Destroy; + static pf_sfRenderWindow_GetInput sfRenderWindow_GetInput; + static pf_sfRenderWindow_DrawPostFX sfRenderWindow_DrawPostFX; + static pf_sfRenderWindow_Capture sfRenderWindow_Capture; + static pf_sfRenderWindow_Clear sfRenderWindow_Clear; + static pf_sfRenderWindow_SetView sfRenderWindow_SetView; + static pf_sfRenderWindow_GetView sfRenderWindow_GetView; + static pf_sfRenderWindow_GetDefaultView sfRenderWindow_GetDefaultView; + static pf_sfRenderWindow_ConvertCoords sfRenderWindow_ConvertCoords; + static pf_sfRenderWindow_PreserveOpenGLStates sfRenderWindow_PreserveOpenGLStates; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfRenderWindow_Create = cast(pf_sfRenderWindow_Create)dll.getSymbol("sfRenderWindow_Create"); + sfRenderWindow_CreateFromHandle = cast(pf_sfRenderWindow_CreateFromHandle)dll.getSymbol("sfRenderWindow_CreateFromHandle"); + sfRenderWindow_Destroy = cast(pf_sfRenderWindow_Destroy)dll.getSymbol("sfRenderWindow_Destroy"); + sfRenderWindow_GetInput = cast(pf_sfRenderWindow_GetInput)dll.getSymbol("sfRenderWindow_GetInput"); + sfRenderWindow_DrawPostFX = cast(pf_sfRenderWindow_DrawPostFX)dll.getSymbol("sfRenderWindow_DrawPostFX"); + sfRenderWindow_Capture = cast(pf_sfRenderWindow_Capture)dll.getSymbol("sfRenderWindow_Capture"); + sfRenderWindow_Clear = cast(pf_sfRenderWindow_Clear)dll.getSymbol("sfRenderWindow_Clear"); + sfRenderWindow_SetView = cast(pf_sfRenderWindow_SetView)dll.getSymbol("sfRenderWindow_SetView"); + sfRenderWindow_GetView = cast(pf_sfRenderWindow_GetView)dll.getSymbol("sfRenderWindow_GetView"); + sfRenderWindow_GetDefaultView = cast(pf_sfRenderWindow_GetDefaultView)dll.getSymbol("sfRenderWindow_GetDefaultView"); + sfRenderWindow_ConvertCoords = cast(pf_sfRenderWindow_ConvertCoords)dll.getSymbol("sfRenderWindow_ConvertCoords"); + sfRenderWindow_PreserveOpenGLStates = cast(pf_sfRenderWindow_PreserveOpenGLStates)dll.getSymbol("sfRenderWindow_PreserveOpenGLStates"); + } +} + diff --git a/DSFML/import/dsfml/graphics/shape.d b/DSFML/import/dsfml/graphics/shape.d new file mode 100644 index 00000000..3fc32760 --- /dev/null +++ b/DSFML/import/dsfml/graphics/shape.d @@ -0,0 +1,333 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.shape; + +import dsfml.system.vector2; + +import dsfml.graphics.blendmode; +import dsfml.graphics.color; +import dsfml.graphics.drawableimpl; + +/** +* Shape defines a drawable convex shape ; it also defines +* helper functions to draw simple shapes like +* lines, rectangles, circles, etc. +*/ +class Shape : Drawableimpl!(sfShape) +{ + this() + { + super(); + } + + /** + * Add a point to the shape + * + * Params: + * x = X position of the point + * y = Y position of the point + * col = Color of the point (white by default) + * outlineCol = Outline color of the point (black by default) + */ + void addPoint(float x, float y, Color col = Color.WHITE, Color outlineCol = Color.BLACK) + { + sfShape_AddPoint(m_ptr, x, y, col, outlineCol); + } + + /** + * Add a point to the shape + * + * Params: + * position = position of the point + * col = Color of the point (white by default) + * outlineCol = Outline color of the point (black by default) + */ + void addPoint(Vector2f position, Color col = Color.WHITE, Color outlineCol = Color.BLACK) + { + sfShape_AddPoint(m_ptr, position.x, position.x, col, outlineCol); + } + + /** + * Enable or disable filling the shape. + * Fill is enabled by default. + * + * Params: + * enable = True to enable, false to disable + */ + void enableFill(bool enable) + { + sfShape_EnableFill(m_ptr, enable); + } + + /** + * Enable or disable drawing a shape outline. + * Outline is enabled by default + * + * Params: + * enable = True to enable, false to disable + */ + void enableOutline(bool enable) + { + sfShape_EnableOutline(m_ptr, enable); + } + + /** + * Change the width of a shape outline + * + * Params: + * width = New width + */ + void setOutlineWidth(float width) + { + sfShape_SetOutlineWidth(m_ptr, width); + } + + /** + * Get the width of the shape outline + * + * Returns: + * Current outline width + * + */ + float getOutlineWidth() + { + return sfShape_GetOutlineWidth(m_ptr); + } + + /** + * Get the number of points composing a shape + * + * Returns: + * Total number of points + */ + uint getNbPoints() + { + return sfShape_GetNbPoints(m_ptr); + } + + /** + * Get a point of the shape + * + * Params: + * index = Index of the point + * + * Returns: + * position of the point + */ + Vector2f getPointPosition(uint index) + { + float x, y; + sfShape_GetPointPosition(m_ptr, index, &x, &y); + return Vector2f(x, y); + } + + /** + * Set the position of a shape point + * + * Params: + * index = Index of the point + * position = New position of the point + */ + void setPointPosition(uint index, Vector2f position) + { + sfShape_SetPointPosition(m_ptr, index, position.x, position.y); + } + + /** + * Get the color of a shape's point + * + * Params: + * index = Index of the point + * + * Returns: + * Color of the point + */ + Color getPointColor(uint index) + { + return sfShape_GetPointColor(m_ptr, index); + } + + /** + * Set the color of a shape's point + * + * Params: + * index = Index of the point + * color = new color of the point + */ + void setPointColor(uint index, Color color) + { + sfShape_SetPointColor(m_ptr, index, color); + } + + /** + * Get the outline color of a shape's point + * + * Params: + * index = Index of the point + * + * Returns: + * Color of the outline + */ + Color getPointOutlineColor(uint index) + { + return sfShape_GetPointOutlineColor(m_ptr, index); + } + + /** + * Set the outline color of a shape's point + * + * Params: + * index = Index of the point + * color = new color of the point + */ + void setPointOutlineColor(uint index, Color color) + { + sfShape_SetPointOutlineColor(m_ptr, index, color); + } + + + + /** + * Create a shape made of a single line + * + * Params: + * p1X, p1Y = Position of the first point + * p2X, p2Y = Position second point + * thickness = Line thickness + * col = Color used to draw the line + * outline = Outline width (0 by default) + * outlineCol = Color used to draw the outline (black by default) + * + * Returns: + * New line shape + */ + static Shape line(float p1X, float p1Y, float p2X, float p2Y, float thickness, Color col, float outline = 0.f, Color outlineCol = Color.BLACK) + { + + return new Shape(sfShape_CreateLine(p1X, p1Y, p2X, p2Y, thickness, col, outline, outlineCol)); + } + + /** + * Create a shape made of a single rectangle + * + * Params: + * p1X = X position of the first point + * p1Y = Y position of the first point + * p2X = X position second point + * p2Y = Y position second point + * col = Color used to fill the rectangle + * outline = Outline width (0 by default) + * outlineCol = Color used to draw the outline (black by default) + * + * Returns: + * new rectangle shape + */ + static Shape rectangle(float p1X, float p1Y, float p2X, float p2Y, Color col, float outline = 0.f, Color outlineCol = Color.BLACK) + { + return new Shape(sfShape_CreateRectangle(p1X, p1Y, p2X, p2Y, col, outline, outlineCol)); + } + + /** + * Create a shape made of a single circle + * + * Params: + * x = X position of the center + * y = Y position of the center + * radius = Radius + * col = Color used to fill the circle + * outline = Outline width (0 by default) + * outlineCol = Color used to draw the outline (black by default) + * + * Returns: + * new circle shape + */ + static Shape circle(float x, float y, float radius, Color col, float outline = 0.f, Color outlineCol = Color.BLACK) + { + return new Shape(sfShape_CreateCircle(x, y, radius, col, outline, outlineCol)); + } + +private: + this (void* ptr) + { + super(ptr); + } + + extern (C) + { + typedef void* function(float, float, float, float, float, Color, float, Color) pf_sfShape_CreateLine; + typedef void* function(float, float, float, float, Color, float, Color) pf_sfShape_CreateRectangle; + typedef void* function(float, float, float, Color, float, Color) pf_sfShape_CreateCircle; + typedef void function(void* Shape, float, float, Color, Color) pf_sfShape_AddPoint; + typedef void function(void* Shape, int) pf_sfShape_EnableFill; + typedef void function(void* Shape, int) pf_sfShape_EnableOutline; + typedef void function (void* Shape, float Width) pf_sfShape_SetOutlineWidth; + typedef float function (void* Shape) pf_sfShape_GetOutlineWidth; + typedef uint function (void* Shape) pf_sfShape_GetNbPoints; + typedef void function (void* Shape, uint Index, float* X, float* Y) pf_sfShape_GetPointPosition; + typedef void function (void* Shape, uint Index, float X, float Y) pf_sfShape_SetPointPosition; + typedef Color function (void* Shape, uint index) pf_sfShape_GetPointColor; + typedef void function (void* Shape, uint index, Color color) pf_sfShape_SetPointColor; + typedef Color function (void* Shape, uint index) pf_sfShape_GetPointOutlineColor; + typedef void function (void* Shape, uint index, Color color) pf_sfShape_SetPointOutlineColor; + + static pf_sfShape_CreateLine sfShape_CreateLine; + static pf_sfShape_CreateRectangle sfShape_CreateRectangle; + static pf_sfShape_CreateCircle sfShape_CreateCircle; + static pf_sfShape_AddPoint sfShape_AddPoint; + static pf_sfShape_EnableFill sfShape_EnableFill; + static pf_sfShape_EnableOutline sfShape_EnableOutline; + static pf_sfShape_SetOutlineWidth sfShape_SetOutlineWidth; + static pf_sfShape_GetOutlineWidth sfShape_GetOutlineWidth; + static pf_sfShape_GetNbPoints sfShape_GetNbPoints; + static pf_sfShape_GetPointPosition sfShape_GetPointPosition; + static pf_sfShape_SetPointPosition sfShape_SetPointPosition; + static pf_sfShape_GetPointColor sfShape_GetPointColor; + static pf_sfShape_SetPointColor sfShape_SetPointColor; + static pf_sfShape_GetPointOutlineColor sfShape_GetPointOutlineColor; + static pf_sfShape_SetPointOutlineColor sfShape_SetPointOutlineColor; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfShape_CreateLine = cast(pf_sfShape_CreateLine)dll.getSymbol("sfShape_CreateLine"); + sfShape_CreateRectangle = cast(pf_sfShape_CreateRectangle)dll.getSymbol("sfShape_CreateRectangle"); + sfShape_CreateCircle = cast(pf_sfShape_CreateCircle)dll.getSymbol("sfShape_CreateCircle"); + sfShape_AddPoint = cast(pf_sfShape_AddPoint)dll.getSymbol("sfShape_AddPoint"); + sfShape_EnableFill = cast(pf_sfShape_EnableFill)dll.getSymbol("sfShape_EnableFill"); + sfShape_EnableOutline = cast(pf_sfShape_EnableOutline)dll.getSymbol("sfShape_EnableOutline"); + sfShape_SetOutlineWidth = cast(pf_sfShape_SetOutlineWidth)dll.getSymbol("sfShape_SetOutlineWidth"); + sfShape_GetOutlineWidth = cast(pf_sfShape_GetOutlineWidth)dll.getSymbol("sfShape_GetOutlineWidth"); + sfShape_GetNbPoints = cast(pf_sfShape_GetNbPoints)dll.getSymbol("sfShape_GetNbPoints"); + sfShape_GetPointPosition = cast(pf_sfShape_GetPointPosition)dll.getSymbol("sfShape_GetPointPosition"); + sfShape_SetPointPosition = cast(pf_sfShape_SetPointPosition)dll.getSymbol("sfShape_SetPointPosition"); + sfShape_GetPointColor = cast (pf_sfShape_GetPointColor)dll.getSymbol("sfShape_GetPointColor"); + sfShape_SetPointColor = cast (pf_sfShape_SetPointColor)dll.getSymbol("sfShape_SetPointColor"); + sfShape_GetPointOutlineColor = cast(pf_sfShape_GetPointOutlineColor)dll.getSymbol("sfShape_GetPointOutlineColor"); + sfShape_SetPointOutlineColor = cast(pf_sfShape_SetPointOutlineColor)dll.getSymbol("sfShape_SetPointOutlineColor"); + } +} diff --git a/DSFML/import/dsfml/graphics/sprite.d b/DSFML/import/dsfml/graphics/sprite.d new file mode 100644 index 00000000..3a5286df --- /dev/null +++ b/DSFML/import/dsfml/graphics/sprite.d @@ -0,0 +1,248 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.sprite; + +import dsfml.graphics.blendmode; +import dsfml.graphics.color; +import dsfml.graphics.drawableimpl; +import dsfml.graphics.image; +import dsfml.graphics.rect; + +import dsfml.system.vector2; + +/** +* Sprite defines a sprite : texture, transformations, +* color, and draw on screen +* See_Also: +* IDrawable +*/ +class Sprite : Drawableimpl!(sfSprite) +{ + /** + * Default constructor + */ + this() + { + } + + /** + * Construct the sprite from a source image + * + * Params: + * img = Image of the sprite + * left = Left coordinate of the sprite (0 by default) + * top = Top coordinate of the sprite (0 by default) + * scaleX = Horizontal scale (1 by default) + * scaleY= Vertical scale (1 by default) + * rotation = Orientation, in degrees (0 by default) + * col = Color of the sprite (white by default) + */ + this(Image img, float left = 0.f, float top = 0.f, float scaleX = 1.f, float scaleY = 1.f, float rotation = 0.f, Color col = Color.WHITE) + { + m_image = img; + sfSprite_SetImage(m_ptr, img.getNativePointer); + setX(left); + setY(top); + setScaleX(scaleX); + setScaleY(scaleY); + setRotation(rotation); + setColor(col); + } + + /** + * Change the image of the sprite + * + * Params: + * img = New image + */ + void setImage(Image img) + { + assert(img !is null, "Trying to set a null image."); + sfSprite_SetImage(m_ptr, img.getNativePointer); + m_image = img; + } + + /** + * Set the sub-rectangle of a sprite inside the source image. + * + * Params: + * rect = New sub-rectangle + */ + void setSubRect(IntRect rect) + { + sfIntRect r = rect.toCIntRect(); + sfSprite_SetSubRect(m_ptr, &r); + m_subRect = rect; + } + + /** + * Resize the sprite (by changing its scale factors). + * The default size is defined by the subrect + * + * Params: + * width = New width (must be strictly positive) + * height = New height (must be strictly positive) + */ + void resize(float width, float height) + { + if (width > 0 && height > 0) + sfSprite_Resize(m_ptr, width, height); + } + + /** + * Resize the sprite (by changing its scale factors). + * The default size is defined by the subrect + * + * Params: + * size = New size (both coordinates must be strictly positive) + */ + void resize(Vector2f size) + { + if (size.x > 0 && size.y > 0) + sfSprite_Resize(m_ptr, size.x, size.y); + } + + + /** + * Flip the sprite horizontally + * + * Params: + * flipped = True to flip the sprite + */ + void flipX(bool flipped) + { + sfSprite_FlipX(m_ptr, flipped); + } + + /** + * Flip the sprite vertically + * + * Params: + * flipped = True to flip the sprite + */ + void flipY(bool flipped) + { + sfSprite_FlipY(m_ptr, flipped); + } + + /** + * Get the source image of the sprite + * + * Returns: + * Pointer to the image (can be NULL) + */ + Image getImage() + { + return m_image; + } + + /** + * Get the sub-rectangle of the sprite inside the source image + * + * Returns: + * Sub-rectangle + */ + IntRect getSubRect() + { + if (m_subRect is null) + m_subRect = new IntRect(0, 0, m_image.getWidth(), m_image.getHeight()); + + return m_subRect; + } + + /** + * Get the sprite size + * + * Returns: + * Size of the sprite + */ + Vector2f getSize() + { + return Vector2f(sfSprite_GetWidth(m_ptr), sfSprite_GetHeight(m_ptr)); + } + + /** + * Get the color of a given pixel in the sprite + * + * Params: + * x = X coordinate + * y = Y coordinate + * + * Returns: + * Color of pixel + */ + Color getPixel(uint x, uint y) + { + return sfSprite_GetPixel(m_ptr, x, y); + } + +private: + Image m_image; //< Image used to draw the sprite + IntRect m_subRect; //< Sub-rectangle of source image to assign to the sprite + + extern (C) + { + typedef void function(void*, void*) pf_sfSprite_SetImage; + typedef void function(void*, sfIntRect*) pf_sfSprite_SetSubRect; + typedef void function(void*, float, float) pf_sfSprite_Resize; + typedef void function(void*, int) pf_sfSprite_FlipX; + typedef void function(void*, int) pf_sfSprite_FlipY; + typedef void* function(void*) pf_sfSprite_GetImage; + typedef void* function(void*) pf_sfSprite_GetSubRect; + typedef float function(void*) pf_sfSprite_GetWidth; + typedef float function(void*) pf_sfSprite_GetHeight; + typedef Color function(void*, uint, uint) pf_sfSprite_GetPixel; + + static pf_sfSprite_SetImage sfSprite_SetImage; + static pf_sfSprite_SetSubRect sfSprite_SetSubRect; + static pf_sfSprite_Resize sfSprite_Resize; + static pf_sfSprite_FlipX sfSprite_FlipX; + static pf_sfSprite_FlipY sfSprite_FlipY; + static pf_sfSprite_GetImage sfSprite_GetImage; + static pf_sfSprite_GetSubRect sfSprite_GetSubRect; + static pf_sfSprite_GetWidth sfSprite_GetWidth; + static pf_sfSprite_GetHeight sfSprite_GetHeight; + static pf_sfSprite_GetPixel sfSprite_GetPixel; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfSprite_SetImage = cast(pf_sfSprite_SetImage)dll.getSymbol("sfSprite_SetImage"); + sfSprite_SetSubRect = cast(pf_sfSprite_SetSubRect)dll.getSymbol("sfSprite_SetSubRect"); + sfSprite_Resize = cast(pf_sfSprite_Resize)dll.getSymbol("sfSprite_Resize"); + sfSprite_FlipX = cast(pf_sfSprite_FlipX)dll.getSymbol("sfSprite_FlipX"); + sfSprite_FlipY = cast(pf_sfSprite_FlipY)dll.getSymbol("sfSprite_FlipY"); + sfSprite_GetImage = cast(pf_sfSprite_GetImage)dll.getSymbol("sfSprite_GetImage"); + sfSprite_GetSubRect = cast(pf_sfSprite_GetSubRect)dll.getSymbol("sfSprite_GetSubRect"); + sfSprite_GetWidth = cast(pf_sfSprite_GetWidth)dll.getSymbol("sfSprite_GetWidth"); + sfSprite_GetHeight = cast(pf_sfSprite_GetHeight)dll.getSymbol("sfSprite_GetHeight"); + sfSprite_GetPixel = cast(pf_sfSprite_GetPixel)dll.getSymbol("sfSprite_GetPixel"); + } + +} + diff --git a/DSFML/import/dsfml/graphics/string.d b/DSFML/import/dsfml/graphics/string.d new file mode 100644 index 00000000..659935d9 --- /dev/null +++ b/DSFML/import/dsfml/graphics/string.d @@ -0,0 +1,290 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.string; + +import dsfml.graphics.blendmode; +import dsfml.graphics.color; +import dsfml.graphics.font; +import dsfml.graphics.textstyle; +import dsfml.graphics.drawableimpl; +import dsfml.graphics.rect; + +import dsfml.system.stringutil; +import dsfml.system.vector2; + + +/** +* String defines a graphical 2D text, that can be drawn on screen +* +* All string litterals used must be prefixed with c for utf-8 +* and d for utf-32 string. +* +* Examples : +* --------------------------------------------------------------- +* String s = new String("Hello"c); +* //this(char[], Font, float) +* s = new String("Hello"d); +* //this(dchar[], Font, float) +* --------------------------------------------------------------- +* +* See_Also: +* IDrawable +*/ +class String : Drawableimpl!(sfString) +{ + /** + * Construct the string from a text + * + * Prefixs string litterals with c + * + * Params: + * text = Text assigned to the string + * font = Font used to draw the string (use default font) + * size = Characters size, in pixels (32 by default) + */ + this(char[] text, Font font = Font.getDefaultFont(), float size = 30.f) + { + super(); + m_font = font; + setFont(font); + setText(text); + setSize(size); + } + + /** + * Construct the string from a unicode text + * + * Prefixs string litterals with d + * + * Params: + * text = Text assigned to the string + * font = Font used to draw the string (use default font) + * size = Characters size, in pixels (32 by default) + */ + this(dchar[] text, Font font = Font.getDefaultFont(), float size = 30.f) + { + super(); + m_font = font; + setFont(font); + setText(text); + setSize(size); + } + + /** + * Set the text (from a multibyte string) + * + * Params: + * text = New text + * + */ + void setText(char[] text) + { + sfString_SetText(m_ptr,toStringz(text)); + } + + /** + * Set the text (from a unicode string) + * + * Params: + * text = New text + */ + void setText(dchar[] text) + { + sfString_SetUnicodeText(m_ptr, toStringz(text)); + } + + /** + * Set the font of the string + * + * Params: + * font = Font filename + */ + void setFont(Font font) + { + m_font = font; + sfString_SetFont(m_ptr, font.getNativePointer); + } + + /** + * Set the size of the string + * + * Params: + * size = New size, in pixels + */ + void setSize(float size) + { + sfString_SetSize(m_ptr, size); + } + + /** + * Set the style of the text + * The default style is Regular + * + * Params: + * TextStyle = New text style, (combination of Style enum values) + * + */ + void setStyle(TextStyle style) + { + sfString_SetStyle(m_ptr, style); + } + + /** + * Get the text (returns a unicode string) + * + * Returns: + * Text + */ + dchar[] getUnicodeText() + { + return fromStringz(sfString_GetUnicodeText(m_ptr)); + } + + /** + * Get the text (returns a multibyte string) + * + * Returns: + * Text + */ + char[] getText() + { + return fromStringz(sfString_GetText(m_ptr)); + } + + /** + * Get the font used by the string + * + * Returns: + * Font name + */ + Font getFont() + { + return m_font; + } + + /** + * Get the size of the characters + * + * Returns: + * Size of the characters + */ + float getSize() + { + return sfString_GetSize(m_ptr); + } + + /** + * Get the current font style + * + * Returns: + * Font style + */ + TextStyle getStyle() + { + return sfString_GetStyle(m_ptr); + } + + /** + * Return the visual position of the Index-th character of the string, + * in coordinates relative to the string + * (note : translation, center, rotation and scale are not applied) + * + * Params: + * index = Index of the character + * + * Returns: + * Position of the Index-th character (end of string of Index is out of range) + */ + Vector2f getCharacterPos(size_t index) + { + Vector2f ret; + sfString_GetCharacterPos(m_ptr, index, &ret.x, &ret.y); + return ret; + } + + /** + * Get the string rectangle on screen + * + * Returns: + * Rectangle contaning the string in screen coordinates + */ + FloatRect getRect() + { + sfFloatRect sfRect = sfString_GetRect(m_ptr); + + return new Rect!(float)(sfRect.Left, sfRect.Top, sfRect.Right, sfRect.Bottom); + } + +private: + Font m_font; + + extern (C) + { + typedef void function(void*, char*) pf_sfString_SetText; + typedef void function(void*, dchar*) pf_sfString_SetUnicodeText; + typedef void function(void*, void*) pf_sfString_SetFont; + typedef void function(void*, float) pf_sfString_SetSize; + typedef void function(void*, TextStyle) pf_sfString_SetStyle; + typedef dchar* function(void*) pf_sfString_GetUnicodeText; + typedef char* function(void*) pf_sfString_GetText; + typedef void* function(void*) pf_sfString_GetFont; + typedef float function(void*) pf_sfString_GetSize; + typedef TextStyle function (void*) pf_sfString_GetStyle; + typedef void function(void*, size_t, float*, float*) pf_sfString_GetCharacterPos; + typedef sfFloatRect function(void*) pf_sfString_GetRect; + + static pf_sfString_SetText sfString_SetText; + static pf_sfString_SetUnicodeText sfString_SetUnicodeText; + static pf_sfString_SetFont sfString_SetFont; + static pf_sfString_SetSize sfString_SetSize; + static pf_sfString_SetStyle sfString_SetStyle; + static pf_sfString_GetUnicodeText sfString_GetUnicodeText; + static pf_sfString_GetText sfString_GetText; + static pf_sfString_GetFont sfString_GetFont; + static pf_sfString_GetSize sfString_GetSize; + static pf_sfString_GetStyle sfString_GetStyle; + static pf_sfString_GetCharacterPos sfString_GetCharacterPos; + static pf_sfString_GetRect sfString_GetRect; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfString_SetText = cast(pf_sfString_SetText)dll.getSymbol("sfString_SetText"); + sfString_SetUnicodeText = cast(pf_sfString_SetUnicodeText)dll.getSymbol("sfString_SetUnicodeText"); + sfString_SetFont = cast(pf_sfString_SetFont)dll.getSymbol("sfString_SetFont"); + sfString_SetSize = cast(pf_sfString_SetSize)dll.getSymbol("sfString_SetSize"); + sfString_SetStyle = cast(pf_sfString_SetStyle)dll.getSymbol("sfString_SetStyle"); + sfString_GetUnicodeText = cast(pf_sfString_GetUnicodeText)dll.getSymbol("sfString_GetUnicodeText"); + sfString_GetText = cast(pf_sfString_GetText)dll.getSymbol("sfString_GetText"); + sfString_GetFont = cast(pf_sfString_GetFont)dll.getSymbol("sfString_GetFont"); + sfString_GetSize = cast(pf_sfString_GetSize)dll.getSymbol("sfString_GetSize"); + sfString_GetStyle = cast(pf_sfString_GetStyle)dll.getSymbol("sfString_GetStyle"); + sfString_GetCharacterPos = cast(pf_sfString_GetCharacterPos)dll.getSymbol("sfString_GetCharacterPos"); + sfString_GetRect = cast(pf_sfString_GetRect)dll.getSymbol("sfString_GetRect"); + } +} diff --git a/DSFML/import/dsfml/graphics/textstyle.d b/DSFML/import/dsfml/graphics/textstyle.d new file mode 100644 index 00000000..33c4c51a --- /dev/null +++ b/DSFML/import/dsfml/graphics/textstyle.d @@ -0,0 +1,37 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.textstyle; + +/** +* Enumerate the string drawing styles +*/ +enum TextStyle +{ + REGULAR = 0, /// Regular characters, no style + BOLD = 1 << 0, /// Characters are bold + ITALIC = 1 << 1, /// Characters are in italic + UNDERLINED = 1 << 2 /// Characters are underlined +} diff --git a/DSFML/import/dsfml/graphics/view.d b/DSFML/import/dsfml/graphics/view.d new file mode 100644 index 00000000..0df612c6 --- /dev/null +++ b/DSFML/import/dsfml/graphics/view.d @@ -0,0 +1,274 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.graphics.view; + +import dsfml.graphics.rect; + +import dsfml.system.common; +import dsfml.system.vector2; + +/** +* This class defines a view (position, size and zoom) ; +* you can consider it as a camera +*/ +class View : DSFMLObject +{ + /** + * Constructor + * + * Default view (1000 x 1000) + */ + this() + { + super(sfView_Create()); + } + + /** + * Constructor + * + * Params: + * center = center of the view + * halfsize = Half-size of the view (from center to corner) + */ + this(Vector2f center, Vector2f halfsize) + { + super(sfView_CreateFromRect(sfFloatRect(center.x - halfsize.x, center.y - halfsize.y, center.x + halfsize.x, center.y + halfsize.y) )); + } + + /** + * Constructor + * + * Params: + * rect = Rectangle defining the position and size of the view + */ + this(FloatRect rect) + { + super(sfView_CreateFromRect(rect.toCFloatRect())); + } + + override void dispose() + { + sfView_Destroy(m_ptr); + } + + /** + * Change the center of the view + * + * Params: + * x = X coordinates of the new center + * y = Y coordinates of the new center + */ + void setCenter(float x, float y) + { + sfView_SetCenter(m_ptr, x, y); + m_isModified = true; + } + + /** + * Change the center of the view + * + * Params: + * center = New center + */ + void setCenter(Vector2f center) + { + sfView_SetCenter(m_ptr, center.x, center.y); + m_isModified = true; + } + + /** + * Change the half-size of the view (take 2 values) + * + * Params: + * halfWidth = New half-width + * halfHeight = New half-height + */ + void setHalfSize(float halfWidth, float HalfHeight) + { + sfView_SetHalfSize(m_ptr, halfWidth, HalfHeight); + m_isModified = true; + } + + /** + * Change the half-size of the view (take 2 values) + * + * Params: + * helfSize = New halfsize + */ + void setHalfSize(Vector2f halfSize) + { + sfView_SetHalfSize(m_ptr, halfSize.x, halfSize.y); + m_isModified = true; + } + + /** + * Rebuild the view from a rectangle + * + * Params: + * viewRect : Rectangle defining the position and size of the view + */ + void setFromRect(FloatRect viewRect) + { + sfView_SetFromRect(m_ptr, viewRect.toCFloatRect()); + m_rect = viewRect; + } + + /** + * Get the center of the view + * + * Returns: + * Center of the view + */ + Vector2f GetCenter() + { + return Vector2f(sfView_GetCenterX(m_ptr), sfView_GetCenterY(m_ptr)); + } + + /** + * Get the halfsize of the view + * + * Returns: + * Halfsize of the view + */ + Vector2f GetHalfSize() + { + return Vector2f(sfView_GetHalfSizeX(m_ptr), sfView_GetHalfSizeY(m_ptr)); + } + + /** + * Get the bounding retangle of the view + */ + FloatRect getRect() + { + if (m_isModified) + { + m_isModified = false; + sfFloatRect cRect = sfView_GetRect(m_ptr); + m_rect = new FloatRect(cRect.Left, cRect.Top, cRect.Right, cRect.Bottom); + } + return m_rect; + } + + /** + * Move the view + * + * Params: + * offsetX = Offset to move the view, on X axis + * offsetY = Offset to move the view, on Y axis + */ + void move(float offsetX, float offsetY) + { + sfView_Move(m_ptr, offsetX, offsetY); + m_isModified = true; + } + + /** + * Move the view + * + * Params: + * offset = offsetto move the view + */ + void move(Vector2f offset) + { + sfView_Move(m_ptr, offset.x, offset.y); + m_isModified = true; + } + + /** + * Resize the view rectangle to simulate a zoom / unzoom effect + * + * Params: + * factor = Zoom factor to apply, relative to the current zoom + */ + void zoom(float factor) + { + sfView_Zoom(m_ptr, factor); + m_isModified = true; + } + +package: + + this(void* ptr, bool preventDelete) + { + super(ptr, preventDelete); + } + +private: + FloatRect m_rect; + bool m_isModified = true; + + extern (C) + { + typedef void* function() pf_sfView_Create; + typedef void* function(sfFloatRect) pf_sfView_CreateFromRect; + typedef void function(void*) pf_sfView_Destroy; + typedef void function(void*, float, float) pf_sfView_SetCenter; + typedef void function(void*, float, float) pf_sfView_SetHalfSize; + typedef void function(void*, sfFloatRect ViewRect) pf_sfView_SetFromRect; + typedef float function(void*) pf_sfView_GetCenterX; + typedef float function(void*) pf_sfView_GetCenterY; + typedef float function(void*) pf_sfView_GetHalfSizeX; + typedef float function(void*) pf_sfView_GetHalfSizeY; + typedef sfFloatRect function(void*) pf_sfView_GetRect; + typedef void function(void*, float, float) pf_sfView_Move; + typedef void function(void*, float) pf_sfView_Zoom; + + static pf_sfView_Create sfView_Create; + static pf_sfView_CreateFromRect sfView_CreateFromRect; + static pf_sfView_Destroy sfView_Destroy; + static pf_sfView_SetCenter sfView_SetCenter; + static pf_sfView_SetHalfSize sfView_SetHalfSize; + static pf_sfView_SetFromRect sfView_SetFromRect; + static pf_sfView_GetCenterX sfView_GetCenterX; + static pf_sfView_GetCenterY sfView_GetCenterY; + static pf_sfView_GetHalfSizeX sfView_GetHalfSizeX; + static pf_sfView_GetHalfSizeY sfView_GetHalfSizeY; + static pf_sfView_GetRect sfView_GetRect; + static pf_sfView_Move sfView_Move; + static pf_sfView_Zoom sfView_Zoom; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-graphics"); + + sfView_Create = cast(pf_sfView_Create) dll.getSymbol("sfView_Create"); + sfView_CreateFromRect = cast(pf_sfView_CreateFromRect) dll.getSymbol("sfView_CreateFromRect"); + sfView_Destroy = cast(pf_sfView_Destroy) dll.getSymbol("sfView_Destroy"); + sfView_SetCenter = cast(pf_sfView_SetCenter) dll.getSymbol("sfView_SetCenter"); + sfView_SetHalfSize = cast(pf_sfView_SetHalfSize) dll.getSymbol("sfView_SetHalfSize"); + sfView_SetFromRect = cast(pf_sfView_SetFromRect) dll.getSymbol("sfView_SetFromRect"); + sfView_GetCenterX = cast(pf_sfView_GetCenterX) dll.getSymbol("sfView_GetCenterX"); + sfView_GetCenterY = cast(pf_sfView_GetCenterY) dll.getSymbol("sfView_GetCenterY"); + sfView_GetHalfSizeX = cast(pf_sfView_GetHalfSizeX) dll.getSymbol("sfView_GetHalfSizeX"); + sfView_GetHalfSizeY = cast(pf_sfView_GetHalfSizeY) dll.getSymbol("sfView_GetHalfSizeY"); + sfView_GetRect = cast(pf_sfView_GetRect) dll.getSymbol("sfView_GetRect"); + sfView_Move = cast(pf_sfView_Move) dll.getSymbol("sfView_Move"); + sfView_Zoom = cast(pf_sfView_Zoom) dll.getSymbol("sfView_Zoom"); + } +} + + diff --git a/DSFML/import/dsfml/network/all.d b/DSFML/import/dsfml/network/all.d new file mode 100644 index 00000000..fa836542 --- /dev/null +++ b/DSFML/import/dsfml/network/all.d @@ -0,0 +1,36 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.all; + +public import + dsfml.network.ftp, + dsfml.network.http, + dsfml.network.ipaddress, + dsfml.network.packet, + dsfml.network.selector, + dsfml.network.socketstatus, + dsfml.network.sockettcp, + dsfml.network.socketudp; diff --git a/DSFML/import/dsfml/network/ftp.d b/DSFML/import/dsfml/network/ftp.d new file mode 100644 index 00000000..5d72e816 --- /dev/null +++ b/DSFML/import/dsfml/network/ftp.d @@ -0,0 +1,598 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.ftp; + +import dsfml.system.common; +import dsfml.system.stringutil; + +import dsfml.network.ipaddress; + + +/** +* Enumeration of transfer mode +*/ +enum FtpTransferMode +{ + BINARY, ///< Binary mode (file is transfered as a sequence of bytes) + ASCII, ///< Text mode using ASCII encoding + EBCDIC ///< Text mode using EBCDIC encoding +} + +/** +* Enumerate all the valid status codes returned in +* a FTP response +*/ +enum FtpStatus +{ + // 1xx: the requested action is being initiated, + // expect another reply before proceeding with a new command + RESTARTMARKERREPLY = 110, ///< Restart marker reply + SERVICEREADYSOON = 120, ///< Service ready in N minutes + DATACONNECTIONALREADYOPENED = 125, ///< Data connection already opened, transfer starting + OPENINGDATACONNECTION = 150, ///< File status ok, about to open data connection + + // 2xx: the requested action has been successfully completed + OK = 200, ///< Command ok + POINTLESSCOMMAND = 202, ///< Command not implemented + SYSTEMSTATUS = 211, ///< System status, or system help reply + DIRECTORYSTATUS = 212, ///< Directory status + FILESTATUS = 213, ///< File status + HELPMESSAGE = 214, ///< Help message + SYSTEMTYPE = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document + SERVICEREADY = 220, ///< Service ready for new user + CLOSINGCONNECTION = 221, ///< Service closing control connection + DATACONNECTIONOPENED = 225, ///< Data connection open, no transfer in progress + CLOSINGDATACONNECTION = 226, ///< Closing data connection, requested file action successful + ENTERINGPASSIVEMODE = 227, ///< Entering passive mode + LOGGEDIN = 230, ///< User logged in, proceed. Logged out if appropriate + FILEACTIONOK = 250, ///< Requested file action ok + DIRECTORYOK = 257, ///< PATHNAME created + + // 3xx: the command has been accepted, but the requested action + // is dormant, pending receipt of further information + NEEDPASSWORD = 331, ///< User name ok, need password + NEEDACCOUNTTOLOGIN = 332, ///< Need account for login + NEEDINFORMATION = 350, ///< Requested file action pending further information + + // 4xx: the command was not accepted and the requested action did not take place, + // but the error condition is temporary and the action may be requested again + SERVICEUNAVAILABLE = 421, ///< Service not available, closing control connection + DATACONNECTIONUNAVAILABLE = 425, ///< Can't open data connection + TRANSFERABORTED = 426, ///< Connection closed, transfer aborted + FILEACTIONABORTED = 450, ///< Requested file action not taken + LOCALERROR = 451, ///< Requested action aborted, local error in processing + INSUFFICIENTSTORAGESPACE = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable + + // 5xx: the command was not accepted and + // the requested action did not take place + COMMANDUNKNOWN = 500, ///< Syntax error, command unrecognized + PARAMETERSUNKNOWN = 501, ///< Syntax error in parameters or arguments + COMMANDNOTIMPLEMENTED = 502, ///< Command not implemented + BADCOMMANDSEQUENCE = 503, ///< Bad sequence of commands + PARAMETERNOTIMPLEMENTED = 504, ///< Command not implemented for that parameter + NOTLOGGEDIN = 530, ///< Not logged in + NEEDACCOUNTTOSTORE = 532, ///< Need account for storing files + FILEUNAVAILABLE = 550, ///< Requested action not taken, file unavailable + PAGETYPEUNKNOWN = 551, ///< Requested action aborted, page type unknown + NOTENOUGHMEMORY = 552, ///< Requested file action aborted, exceeded storage allocation + FILENAMENOTALLOWED = 553, ///< Requested action not taken, file name not allowed + + // 10xx: SFML custom codes + INVALIDRESPONSE = 1000, ///< Response is not a valid FTP one + CONNECTIONFAILED = 1001, ///< Connection with server failed + CONNECTIONCLOSED = 1002, ///< Connection with server closed + INVALIDFILE = 1003 ///< Invalid file to upload / download +} + + +/** +* This class provides methods for manipulating the FTP protocol (described in RFC 959). +* It provides easy access and transfers to remote directories and files on a FTP server. +*/ +class Ftp : DSFMLObject +{ + /** + * This class wraps a FTP response, which is basically : + * - a status code + * - a message + */ + static class FtpResponse : DSFMLObject + { + override void dispose() + { + sfFtpResponse_Destroy(m_ptr); + } + + /** + * Convenience function to check if the response status code + * means a success + * + * Returns: + * True if status is success (code < 400) + */ + bool isOk() + { + return cast(bool)sfFtpResponse_IsOk(m_ptr); + } + + /** + * Get the response status code + * + * Returns: + * Status code + */ + FtpStatus getStatus() + { + return sfFtpResponse_GetStatus(m_ptr); + } + + /** + * Get the full message contained in the response + * + * Returns: + * The response message + */ + char[] getMessage() + { + return fromStringz(sfFtpResponse_GetMessage(m_ptr)); + } + + private: + this(void* ptr) + { + super(ptr); + } + // External ================================================================ + + extern (C) + { + typedef void function(void*) pf_sfFtpResponse_Destroy; + typedef int function(void*) pf_sfFtpResponse_IsOk; + typedef FtpStatus function(void*) pf_sfFtpResponse_GetStatus; + typedef char* function(void*) pf_sfFtpResponse_GetMessage; + + static pf_sfFtpResponse_Destroy sfFtpResponse_Destroy; + static pf_sfFtpResponse_IsOk sfFtpResponse_IsOk; + static pf_sfFtpResponse_GetStatus sfFtpResponse_GetStatus; + static pf_sfFtpResponse_GetMessage sfFtpResponse_GetMessage; + } + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfFtpResponse_Destroy = cast(pf_sfFtpResponse_Destroy)dll.getSymbol("sfFtpResponse_Destroy"); + sfFtpResponse_IsOk = cast(pf_sfFtpResponse_IsOk)dll.getSymbol("sfFtpResponse_IsOk"); + sfFtpResponse_GetStatus = cast(pf_sfFtpResponse_GetStatus)dll.getSymbol("sfFtpResponse_GetStatus"); + sfFtpResponse_GetMessage = cast(pf_sfFtpResponse_GetMessage)dll.getSymbol("sfFtpResponse_GetMessage"); + } + } + + /** + * Specialization of FTP response returning a directory + */ + static class FtpDirectoryResponse : FtpResponse + { + override void dispose() + { + sfFtpDirectoryResponse_Destroy(m_ptr); + } + + /** + * Get the directory returned in the response. + * + * Returns: + * Directory name + */ + char[] getDirectory() + { + return fromStringz(sfFtpDirectoryResponse_GetDirectory(m_ptr)); + } + + private: + this(void* ptr) + { + super(ptr); + } + // External ================================================================ + + extern (C) + { + typedef void function(void*) pf_sfFtpDirectoryResponse_Destroy; + typedef char* function(void*) pf_sfFtpDirectoryResponse_GetDirectory; + + static pf_sfFtpDirectoryResponse_Destroy sfFtpDirectoryResponse_Destroy; + static pf_sfFtpDirectoryResponse_GetDirectory sfFtpDirectoryResponse_GetDirectory; + } + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfFtpDirectoryResponse_Destroy = cast(pf_sfFtpDirectoryResponse_Destroy)dll.getSymbol("sfFtpDirectoryResponse_Destroy"); + sfFtpDirectoryResponse_GetDirectory = cast(pf_sfFtpDirectoryResponse_GetDirectory)dll.getSymbol("sfFtpDirectoryResponse_GetDirectory"); + } + + } + + /** + * Specialization of FTP response returning a filename listing. + */ + static class FtpListingResponse : FtpResponse + { + override void dispose() + { + sfFtpListingResponse_Destroy(m_ptr); + } + + /** + * Get the number of files in the listing + * + * Returns: + * Total number of files + */ + size_t getCount() + { + return sfFtpListingResponse_GetCount(m_ptr); + } + + /** + * Get the index-th filename in the directory + * + * Params: + * index = Index of the filename to get + * + * Returns: + * Filename + */ + char[] opIndex(size_t index) + { + return fromStringz(sfFtpListingResponse_GetFilename(m_ptr, index)); + } + + /** + * Foreach implementation + */ + int opApply(int delegate(char[]) dg) + { + size_t count = getCount(); + int result; + + for(int i = 0; i < count; i++) + { + result = dg(this[i]); + if (result) + break; + } + + return result; + } + + private: + this(void* ptr) + { + super(ptr); + } + + // External ================================================================ + extern (C) + { + typedef void function(void*) pf_sfFtpListingResponse_Destroy; + typedef size_t function(void*) pf_sfFtpListingResponse_GetCount; + typedef char* function(void*, size_t) pf_sfFtpListingResponse_GetFilename; + + static pf_sfFtpListingResponse_Destroy sfFtpListingResponse_Destroy; + static pf_sfFtpListingResponse_GetCount sfFtpListingResponse_GetCount; + static pf_sfFtpListingResponse_GetFilename sfFtpListingResponse_GetFilename; + } + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfFtpListingResponse_Destroy = cast(pf_sfFtpListingResponse_Destroy)dll.getSymbol("sfFtpListingResponse_Destroy"); + sfFtpListingResponse_GetCount = cast(pf_sfFtpListingResponse_GetCount)dll.getSymbol("sfFtpListingResponse_GetCount"); + sfFtpListingResponse_GetFilename = cast(pf_sfFtpListingResponse_GetFilename)dll.getSymbol("sfFtpListingResponse_GetFilename"); + } + } + + /** + * Default constructor + */ + this() + { + super(sfFtp_Create()); + } + + override void dispose() + { + sfFtp_Destroy(m_ptr); + } + + /** + * Connect to the specified FTP server + * + * Params: + * server = FTP server to connect to + * port = Port used for connection (21 by default, standard FTP port) + * timeout = Maximum time to wait, in seconds (0 by default, means no timeout) + * + * Returns: + * Server response to the request + */ + FtpResponse connect(IPAddress server, ushort port = 21, float timeout = 0.f) + { + return new FtpResponse(sfFtp_Connect(m_ptr, server, port, timeout)); + } + + /** + * Log in using anonymous account + * + * Returns: + * Server response to the request + */ + FtpResponse login() + { + return new FtpResponse(sfFtp_LoginAnonymous(m_ptr)); + } + + /** + * Log in using a username and a password + * + * Params: + * username = User name + * password = password + * + * Returns: + * Server response to the request + */ + FtpResponse login(char[] username, char[] password) + { + return new FtpResponse(sfFtp_Login(m_ptr, toStringz(username), toStringz(password))); + } + + /** + * Close the connection with FTP server + * + * Returns: + * Server response to the request + */ + FtpResponse disconnect() + { + return new FtpResponse(sfFtp_Disconnect(m_ptr)); + } + + /** + * Send a null command to prevent from being disconnected. + * + * Returns: + * Server response to the request + */ + FtpResponse keepAlive() + { + return new FtpResponse(sfFtp_KeepAlive(m_ptr)); + } + + /** + * Get the current working directory + * + * Returns: + * Server response to the request + */ + FtpDirectoryResponse getWorkingDirectory() + { + return new FtpDirectoryResponse(sfFtp_GetWorkingDirectory(m_ptr)); + } + + /** + * Get the content of the given directory (subdirectories and files). + * + * Params: + * directory = directory to list (null by default, the current one) + * + * Returns: + * Server response to the request + */ + FtpListingResponse getDirectoryListing(char[] directory = null) + { + return new FtpListingResponse(sfFtp_GetDirectoryListing(m_ptr, toStringz(directory))); + } + + /** + * Change the current working directory + * + * Params: + * directory = New directory, relative to the current one. + * + * Returns: + * Server response to the request + */ + FtpResponse changeDirectory(char[] directory) + { + return new FtpResponse(sfFtp_ChangeDirectory(m_ptr, toStringz(directory))); + } + + /** + * Go to the parent directory of the current one + * + * Returns: + * Server response to the request + */ + FtpResponse parentDirectory() + { + return new FtpResponse(sfFtp_ParentDirectory(m_ptr)); + } + + /** + * Create a new directory + * + * Params: + * name = name of the directory to create + * + * Returns: + * Server response to the request + */ + FtpResponse makeDirectory(char[] name) + { + return new FtpResponse(sfFtp_MakeDirectory(m_ptr, toStringz(name))); + } + + /** + * remove an existing directory + * + * Params: + * name = name of the directory to remove + * + * Returns: + * Server response to the request + */ + FtpResponse deleteDirectory(char[] name) + { + return new FtpResponse(sfFtp_DeleteDirectory(m_ptr, toStringz(name))); + } + + /** + * Rename a file + * + * Params: + * name = file to rename + * newName = new name + * + * Returns: + * Server response to the request + */ + FtpResponse renameFile(char[] name, char[] newName) + { + return new FtpResponse(sfFtp_RenameFile(m_ptr, toStringz(name), toStringz(newName))); + } + + /** + * Remove an existing file + * + * Params: + * name = file to remove + * + * Returns: + * Server response to the request + */ + FtpResponse deleteFile(char[] name) + { + return new FtpResponse(sfFtp_DeleteFile(m_ptr, toStringz(name))); + } + + /** + * Download a file from the server + * + * Params: + * distantFile = Path of the distant file to download + * destFile = Where to put the file on the local computer + * mode = transfer mode (binary by default) + * + * Returns: + * Server response to the request + */ + FtpResponse download(char[] distantFile, char[] destFile, FtpTransferMode mode = FtpTransferMode.BINARY) + { + return new FtpResponse(sfFtp_Download(m_ptr, toStringz(distantFile), toStringz(destFile), mode)); + } + + /** + * Upload a file to the server + * + * Params: + * localFile = Path of the local file to upload + * destPath = Where to put the file on the server + * mode = transfer mode (binary by default) + * Returns: + * Server response to the request + */ + FtpResponse upload(char[] localFile, char[] destFile, FtpTransferMode mode = FtpTransferMode.BINARY) + { + return new FtpResponse(sfFtp_Upload(m_ptr, toStringz(localFile), toStringz(destFile), mode)); + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfFtp_Create; + typedef void function(void*) pf_sfFtp_Destroy; + typedef void* function(void*, IPAddress, ushort, float) pf_sfFtp_Connect; + typedef void* function(void*) pf_sfFtp_LoginAnonymous; + typedef void* function(void*, char*, char*) pf_sfFtp_Login; + typedef void* function(void*) pf_sfFtp_Disconnect; + typedef void* function(void*) pf_sfFtp_KeepAlive; + typedef void* function(void*) pf_sfFtp_GetWorkingDirectory; + typedef void* function(void*, char*) pf_sfFtp_GetDirectoryListing; + typedef void* function(void*, char*) pf_sfFtp_ChangeDirectory; + typedef void* function(void*) pf_sfFtp_ParentDirectory; + typedef void* function(void*, char*) pf_sfFtp_MakeDirectory; + typedef void* function(void*, char*) pf_sfFtp_DeleteDirectory; + typedef void* function(void*, char*, char*) pf_sfFtp_RenameFile; + typedef void* function(void*, char*) pf_sfFtp_DeleteFile; + typedef void* function(void*, char*, char*, FtpTransferMode) pf_sfFtp_Download; + typedef void* function(void*, char*, char*, FtpTransferMode) pf_sfFtp_Upload; + + static pf_sfFtp_Create sfFtp_Create; + static pf_sfFtp_Destroy sfFtp_Destroy; + static pf_sfFtp_Connect sfFtp_Connect; + static pf_sfFtp_LoginAnonymous sfFtp_LoginAnonymous; + static pf_sfFtp_Login sfFtp_Login; + static pf_sfFtp_Disconnect sfFtp_Disconnect; + static pf_sfFtp_KeepAlive sfFtp_KeepAlive; + static pf_sfFtp_GetWorkingDirectory sfFtp_GetWorkingDirectory; + static pf_sfFtp_GetDirectoryListing sfFtp_GetDirectoryListing; + static pf_sfFtp_ChangeDirectory sfFtp_ChangeDirectory; + static pf_sfFtp_ParentDirectory sfFtp_ParentDirectory; + static pf_sfFtp_MakeDirectory sfFtp_MakeDirectory; + static pf_sfFtp_DeleteDirectory sfFtp_DeleteDirectory; + static pf_sfFtp_RenameFile sfFtp_RenameFile; + static pf_sfFtp_DeleteFile sfFtp_DeleteFile; + static pf_sfFtp_Download sfFtp_Download; + static pf_sfFtp_Upload sfFtp_Upload; + } + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfFtp_Create = cast(pf_sfFtp_Create)dll.getSymbol("sfFtp_Create"); + sfFtp_Destroy = cast(pf_sfFtp_Destroy)dll.getSymbol("sfFtp_Destroy"); + sfFtp_Connect = cast(pf_sfFtp_Connect)dll.getSymbol("sfFtp_Connect"); + sfFtp_LoginAnonymous = cast(pf_sfFtp_LoginAnonymous)dll.getSymbol("sfFtp_LoginAnonymous"); + sfFtp_Login = cast(pf_sfFtp_Login)dll.getSymbol("sfFtp_Login"); + sfFtp_Disconnect = cast(pf_sfFtp_Disconnect)dll.getSymbol("sfFtp_Disconnect"); + sfFtp_KeepAlive = cast(pf_sfFtp_KeepAlive)dll.getSymbol("sfFtp_KeepAlive"); + sfFtp_GetWorkingDirectory = cast(pf_sfFtp_GetWorkingDirectory)dll.getSymbol("sfFtp_GetWorkingDirectory"); + sfFtp_GetDirectoryListing = cast(pf_sfFtp_GetDirectoryListing)dll.getSymbol("sfFtp_GetDirectoryListing"); + sfFtp_ChangeDirectory = cast(pf_sfFtp_ChangeDirectory)dll.getSymbol("sfFtp_ChangeDirectory"); + sfFtp_ParentDirectory = cast(pf_sfFtp_ParentDirectory)dll.getSymbol("sfFtp_ParentDirectory"); + sfFtp_MakeDirectory = cast(pf_sfFtp_MakeDirectory)dll.getSymbol("sfFtp_MakeDirectory"); + sfFtp_DeleteDirectory = cast(pf_sfFtp_DeleteDirectory)dll.getSymbol("sfFtp_DeleteDirectory"); + sfFtp_RenameFile = cast(pf_sfFtp_RenameFile)dll.getSymbol("sfFtp_RenameFile"); + sfFtp_DeleteFile = cast(pf_sfFtp_DeleteFile)dll.getSymbol("sfFtp_DeleteFile"); + sfFtp_Download = cast(pf_sfFtp_Download)dll.getSymbol("sfFtp_Download"); + sfFtp_Upload = cast(pf_sfFtp_Upload)dll.getSymbol("sfFtp_Upload"); + } +} diff --git a/DSFML/import/dsfml/network/http.d b/DSFML/import/dsfml/network/http.d new file mode 100644 index 00000000..93efde45 --- /dev/null +++ b/DSFML/import/dsfml/network/http.d @@ -0,0 +1,394 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.http; + +import dsfml.system.stringutil; +import dsfml.system.common; + +/** +* HTTP methods enumeration +*/ +enum HttpMethod +{ + GET, ///< Request in get mode, standard method to retrieve a page + POST, ///< Request in post mode, usually to send data to a page + HEAD ///< Request a page's header only +} + +/** +* HTTP response status code +*/ +enum HttpStatus +{ + // 2xx: success + OK = 200, ///< Most common code returned when operation was successful + CREATED = 201, ///< The resource has successfully been created + ACCEPTED = 202, ///< The request has been accepted, but will be processed later by the server + NOCONTENT = 204, ///< Sent when the server didn't send any data in return + + // 3xx: redirection + MULTIPLECHOICES = 300, ///< The requested page can be accessed from several locations + MOVEDPERMANENTLY = 301, ///< The requested page has permanently moved to a new location + MOVEDTEMPORARILY = 302, ///< The requested page has temporarily moved to a new location + NOTMODIFIED = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed + + // 4xx: client error + BADREQUEST = 400, ///< The server couldn't understand the request (syntax error) + UNAUTHORIZED = 401, ///< The requested page needs an authentification to be accessed + FORBIDDEN = 403, ///< The requested page cannot be accessed at all, even with authentification + NOTFOUND = 404, ///< The requested page doesn't exist + + // 5xx: server error + INTERNALSERVERERROR = 500, ///< The server encountered an unexpected error + NOTIMPLEMENTED = 501, ///< The server doesn't implement a requested feature + BADGATEWAY = 502, ///< The gateway server has received an error from the source server + SERVICENOTAVAILABLE = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) + + // 10xx: SFML custom codes + INVALIDRESPONSE = 1000, ///< Response is not a valid HTTP one + CONNECTIONFAILED = 1001 ///< Connection with server failed +} + +/** +* This class provides methods for manipulating the HTTP protocol (described in +* RFC 1945). +* It can connect to a website, get files, send requests +*/ +class Http : DSFMLObject +{ + /** + * Wrapper for a http request, which is basically : + * - a header with a method, a target URI and a set of field/value pairs + * - an optional body (for POST requests) + */ + static class Response : DSFMLObject + { + override void dispose() + { + sfHttpResponse_Destroy(m_ptr); + } + + /** + * Get the value of a field + * + * Params: + * field = Name of the field to get (case-insensitive) + * Returns: + * Value of the field, or enpty string if not found + */ + char[] getField(char[] field) + { + return fromStringz(sfHttpResponse_GetField(m_ptr, toStringz(field))); + } + + /** + * Get the header status code + * + * Returns: + * header status code + */ + HttpStatus getStatus() + { + return sfHttpResponse_GetStatus(m_ptr); + } + + /** + * Get the major HTTP version number of the response + * + * Returns: + * Major version number + */ + uint getMajorHTTPVersion() + { + return sfHttpResponse_GetMajorVersion(m_ptr); + } + + /** + * Get the minor HTTP version number of the response + * + * Returns: + * Minor version number + */ + uint getMinorHTTPVersion() + { + return sfHttpResponse_GetMinorVersion(m_ptr); + } + + /** + * Get the body of the response. The body can contain : + * - the requested page (for GET requests) + * - a response from the server (for POST requests) + * - nothing (for HEAD requests) + * - an error message (in case of an error) + * + * Returns: + * the response body + */ + char[] getBody() + { + return fromStringz(sfHttpResponse_GetBody(m_ptr)); + } + + private: + this(void* ptr) + { + super(ptr); + } + // External ================================================================ + extern (C) + { + typedef void function(void*) pf_sfHttpResponse_Destroy; + typedef char* function(void*, char*) pf_sfHttpResponse_GetField; + typedef HttpStatus function(void*) pf_sfHttpResponse_GetStatus; + typedef uint function(void*) pf_sfHttpResponse_GetMajorVersion; + typedef uint function(void*) pf_sfHttpResponse_GetMinorVersion; + typedef char* function(void*) pf_sfHttpResponse_GetBody; + + static pf_sfHttpResponse_Destroy sfHttpResponse_Destroy; + static pf_sfHttpResponse_GetField sfHttpResponse_GetField; + static pf_sfHttpResponse_GetStatus sfHttpResponse_GetStatus; + static pf_sfHttpResponse_GetMajorVersion sfHttpResponse_GetMajorVersion; + static pf_sfHttpResponse_GetMinorVersion sfHttpResponse_GetMinorVersion; + static pf_sfHttpResponse_GetBody sfHttpResponse_GetBody; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfHttpResponse_Destroy = cast(pf_sfHttpResponse_Destroy)dll.getSymbol("sfHttpResponse_Destroy"); + sfHttpResponse_GetField = cast(pf_sfHttpResponse_GetField)dll.getSymbol("sfHttpResponse_GetField"); + sfHttpResponse_GetStatus = cast(pf_sfHttpResponse_GetStatus)dll.getSymbol("sfHttpResponse_GetStatus"); + sfHttpResponse_GetMajorVersion = cast(pf_sfHttpResponse_GetMajorVersion)dll.getSymbol("sfHttpResponse_GetMajorVersion"); + sfHttpResponse_GetMinorVersion = cast(pf_sfHttpResponse_GetMinorVersion)dll.getSymbol("sfHttpResponse_GetMinorVersion"); + sfHttpResponse_GetBody = cast(pf_sfHttpResponse_GetBody)dll.getSymbol("sfHttpResponse_GetBody"); + } + } + + /** + * Wrapper for a HTTP response which is basically : + * - a header with a status code and a set of field/value pairs + * - a body (the content of the requested resource) + */ + static class Request : DSFMLObject + { + /** + * Constructor + * + * Params: + * requestMethod = Method to use for the request (Get by default) + * uri = Target URI ("/" by default -- index page) + * requestBody = Content of the request's body (empty by default) + */ + this(HttpMethod requestMethod = HttpMethod.GET, char[] uri = "/", char[] requestBody = "") + { + super(sfHttpRequest_Create()); + sfHttpRequest_SetMethod(m_ptr, requestMethod); + sfHttpRequest_SetURI(m_ptr, toStringz(uri)); + sfHttpRequest_SetBody(m_ptr, toStringz(requestBody)); + } + + /** + * Set the value of a field. Field is created if it doesn't exists. + * + * Params: + * field = name of the field to set (case-insensitive) + * value = value of the field + */ + void setField(char[] field, char[] value) + { + sfHttpRequest_SetField(m_ptr, toStringz(field), toStringz(value)); + } + + /** + * Set the request method. + * + * Params: + * requestMethod = Method to use for the request. + */ + void setMethod(HttpMethod requestMethod) + { + sfHttpRequest_SetMethod(m_ptr, requestMethod); + } + + /** + * Set the target URI of the request. + * + * Params: + * uri = URI to request, local to the host. + * Returns: + */ + void setURI(char[] uri) + { + sfHttpRequest_SetURI(m_ptr, toStringz(uri)); + } + + /** + * Set the HTTP version of the request. + * + * Params: + * major = Major version number + * minor = Minor version number + */ + void setHttpVersion(uint major, uint minor) + { + sfHttpRequest_SetHttpVersion(m_ptr, major, minor); + } + + /** + * Set the body of the request. This parameter is optionnal and make sense + * only for POST requests. + * + * Params: + * requestBody = Content of the request body. + */ + void setBody(char[] requestBody) + { + sfHttpRequest_SetBody(m_ptr, toStringz(requestBody)); + } + + private: + + // External ================================================================ + extern (C) + { + typedef void* function() pf_sfHttpRequest_Create; + typedef void function(void*) pf_sfHttpRequest_Destroy; + typedef void function(void*, char*, char*) pf_sfHttpRequest_SetField; + typedef void function(void*, HttpMethod) pf_sfHttpRequest_SetMethod; + typedef void function(void*, char*) pf_sfHttpRequest_SetURI; + typedef void function(void*, uint, uint) pf_sfHttpRequest_SetHttpVersion; + typedef void function(void*, char*) pf_sfHttpRequest_SetBody; + + static pf_sfHttpRequest_Create sfHttpRequest_Create; + static pf_sfHttpRequest_Destroy sfHttpRequest_Destroy; + static pf_sfHttpRequest_SetField sfHttpRequest_SetField; + static pf_sfHttpRequest_SetMethod sfHttpRequest_SetMethod; + static pf_sfHttpRequest_SetURI sfHttpRequest_SetURI; + static pf_sfHttpRequest_SetHttpVersion sfHttpRequest_SetHttpVersion; + static pf_sfHttpRequest_SetBody sfHttpRequest_SetBody; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfHttpRequest_Create = cast(pf_sfHttpRequest_Create)dll.getSymbol("sfHttpRequest_Create"); + sfHttpRequest_Destroy = cast(pf_sfHttpRequest_Destroy)dll.getSymbol("sfHttpRequest_Destroy"); + sfHttpRequest_SetField = cast(pf_sfHttpRequest_SetField)dll.getSymbol("sfHttpRequest_SetField"); + sfHttpRequest_SetMethod = cast(pf_sfHttpRequest_SetMethod)dll.getSymbol("sfHttpRequest_SetMethod"); + sfHttpRequest_SetURI = cast(pf_sfHttpRequest_SetURI)dll.getSymbol("sfHttpRequest_SetURI"); + sfHttpRequest_SetHttpVersion = cast(pf_sfHttpRequest_SetHttpVersion)dll.getSymbol("sfHttpRequest_SetHttpVersion"); + sfHttpRequest_SetBody = cast(pf_sfHttpRequest_SetBody)dll.getSymbol("sfHttpRequest_SetBody"); + } + } + + /** + * Constructor + */ + this() + { + super(sfHttp_Create()); + } + + /** + * Constructor + * + * Params: + * host = Web server to connect to + * port = port to use for connection (0 by default -- use the standard port of the protocol) + */ + this(char[] host, ushort port = 0) + { + super(sfHttp_Create()); + sfHttp_SetHost(m_ptr, toStringz(host), port); + } + + override void dispose() + { + sfHttp_Destroy(m_ptr); + } + + /** + * Set the target host. + * + * Params: + * host = Web server to connect to + * port = port to use for connection (0 by default -- use the standard port of the protocol) + */ + void setHost(char[] host, ushort port = 0) + { + sfHttp_SetHost(m_ptr, toStringz(host), port); + } + + /** + * Send a HTTP request and return the server's response. + * You must be connected to a host before sending requests. + * Any missing mandatory header field will be added with an appropriate value. + * + * Warning : this function waits for the server's response and may + * not return instantly; use a thread if you don't want to block your + * application. + * + * Params: + * req = Request to send + * + * Returns: + * Server's response + */ + + Response sendRequest(Request req) + { + return new Response( sfHttp_SendRequest(m_ptr, req.getNativePointer) ); + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfHttp_Create; + typedef void function(void*) pf_sfHttp_Destroy; + typedef void function(void*, char*, ushort) pf_sfHttp_SetHost; + typedef void* function(void*, void*) pf_sfHttp_SendRequest; + + static pf_sfHttp_Create sfHttp_Create; + static pf_sfHttp_Destroy sfHttp_Destroy; + static pf_sfHttp_SetHost sfHttp_SetHost; + static pf_sfHttp_SendRequest sfHttp_SendRequest; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfHttp_Create = cast(pf_sfHttp_Create)dll.getSymbol("sfHttp_Create"); + sfHttp_Destroy = cast(pf_sfHttp_Destroy)dll.getSymbol("sfHttp_Destroy"); + sfHttp_SetHost = cast(pf_sfHttp_SetHost)dll.getSymbol("sfHttp_SetHost"); + sfHttp_SendRequest = cast(pf_sfHttp_SendRequest)dll.getSymbol("sfHttp_SendRequest"); + } +} diff --git a/DSFML/import/dsfml/network/ipaddress.d b/DSFML/import/dsfml/network/ipaddress.d new file mode 100644 index 00000000..a04f27f4 --- /dev/null +++ b/DSFML/import/dsfml/network/ipaddress.d @@ -0,0 +1,164 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.ipaddress; + +import dsfml.system.common; +import dsfml.system.stringutil; + +/** +* IPAddress provides easy manipulation of IP v4 addresses +*/ +struct IPAddress +{ + /** + * Construct the address from a string + * + * Params: + * address = IP address ("xxx.xxx.xxx.xxx") or network name + * + */ + static IPAddress opCall(char[] address) + { + return sfIPAddress_FromString(toStringz(address)); + } + + + /** + * Construct the address from 4 bytes + * + * Params: + * byte0 = First byte of the address + * byte1 = Second byte of the address + * byte2 = Third byte of the address + * byte3 = Fourth byte of the address + * + */ + static IPAddress opCall(ubyte byte0, ubyte byte1, ubyte byte2, ubyte byte3) + { + return sfIPAddress_FromBytes(byte0, byte1, byte2, byte3); + } + + /** + * Construct the address from a 32 bits integer + * + * Params: + * address = 4 bytes of the address packed into a 32 bits integer + * + */ + static IPAddress opCall(uint address) + { + return sfIPAddress_FromInteger(address); + } + + /** + * Tell if the address is a valid one + * + * Returns: + * True if address has a valid syntax + * + */ + bool isValid() + { + return cast(bool)sfIPAddress_IsValid(*this); + } + + /** + * Get the computer's local IP address (from the LAN point of view) + * + * Returns: + * Local IP address + * + */ + static IPAddress getLocalAddress() + { + return sfIPAddress_GetLocalAddress(); + } + + /** + * Get the computer's public IP address (from the web point of view). + * The only way to get a public address is to ask it to a + * distant website ; as a consequence, this function may be + * very slow -- use it as few as possible ! + * + * Returns: + * Public IP address + * + */ + static IPAddress getPublicAddress() + { + return sfIPAddress_GetPublicAddress(); + } + + bool opEqual(IPAddress other) + { + return Address == other.Address; + } + + /** + * Local host address (to connect to the same computer). + */ + static IPAddress LOCALHOST() + { + return sfIPAddress_LocalHost(); + } + + byte[16] Address; + +} + +private: + +extern (C) +{ + typedef IPAddress function(char*) pf_sfIPAddress_FromString; + typedef IPAddress function(ubyte, ubyte, ubyte, ubyte) pf_sfIPAddress_FromBytes; + typedef IPAddress function(uint) pf_sfIPAddress_FromInteger; + typedef int function(IPAddress) pf_sfIPAddress_IsValid; + typedef IPAddress function() pf_sfIPAddress_GetLocalAddress; + typedef IPAddress function() pf_sfIPAddress_GetPublicAddress; + typedef IPAddress function() pf_sfIPAddress_LocalHost; + + static pf_sfIPAddress_FromString sfIPAddress_FromString; + static pf_sfIPAddress_FromBytes sfIPAddress_FromBytes; + static pf_sfIPAddress_FromInteger sfIPAddress_FromInteger; + static pf_sfIPAddress_IsValid sfIPAddress_IsValid; + static pf_sfIPAddress_GetLocalAddress sfIPAddress_GetLocalAddress; + static pf_sfIPAddress_GetPublicAddress sfIPAddress_GetPublicAddress; + static pf_sfIPAddress_LocalHost sfIPAddress_LocalHost; +} + +static this() +{ + DllLoader dll = DllLoader.load("csfml-network"); + + sfIPAddress_FromBytes = cast(pf_sfIPAddress_FromBytes)dll.getSymbol("sfIPAddress_FromBytes"); + sfIPAddress_FromString = cast(pf_sfIPAddress_FromString)dll.getSymbol("sfIPAddress_FromString"); + sfIPAddress_FromInteger = cast(pf_sfIPAddress_FromInteger)dll.getSymbol("sfIPAddress_FromInteger"); + sfIPAddress_GetLocalAddress = cast(pf_sfIPAddress_GetLocalAddress)dll.getSymbol("sfIPAddress_GetLocalAddress"); + sfIPAddress_GetPublicAddress = cast(pf_sfIPAddress_GetPublicAddress)dll.getSymbol("sfIPAddress_GetPublicAddress"); + sfIPAddress_IsValid = cast(pf_sfIPAddress_IsValid)dll.getSymbol("sfIPAddress_IsValid"); + sfIPAddress_LocalHost = cast(pf_sfIPAddress_LocalHost)dll.getSymbol("sfIPAddress_LocalHost"); +} diff --git a/DSFML/import/dsfml/network/packet.d b/DSFML/import/dsfml/network/packet.d new file mode 100644 index 00000000..f99f46d1 --- /dev/null +++ b/DSFML/import/dsfml/network/packet.d @@ -0,0 +1,413 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.packet; + +import dsfml.system.common; +import dsfml.system.stringutil; + +/** +* Packet wraps data to send / to receive through the network +* +* The order of insertion and extraction must be the same. +* +* You can derive from Packet and override onSend and onReceive to do custom operations before send or after reception. +* +* Litterals integer are promoted to int. +* Litterals floating point are promoted to float. +* +* Extraction or insertion can be specified with explicit template. +* Examples: +* ------------------------------------------------------------ +* Packet p = new Packet(); +* +* int i = 32, j = 42; +* char[] k = hello; +* +* p.set(i, k, j); //Set the data in the packet +* +* int a, b; +* char[] c; +* p.get(a, c, b); //Get data from the packet +* +* //... +* +* Packet p = new Packet(); +* p.set!(byte)(5); // Litteral are inserted with byte type +* ------------------------------------------------------------ +* +* See_Also: +* $(LINK2 http://www.digitalmars.com/d/1.0/lex.html, D litterals Specification) for more informations. +*/ +class Packet : DSFMLObject +{ + /** + * Default constructor + * + */ + this() + { + super(sfPacket_Create()); + } + + override void dispose() + { + sfPacket_Destroy(m_ptr); + } + + /** + * Append data to the end of the packet. + * + * Params: + * data = Array of data to append + * + */ + void append(byte[] data) + { + if (data !is null) + sfPacket_Append(m_ptr, data.ptr, data.length); + } + + /** + * Clear the packet data + * + */ + void clear() + { + sfPacket_Clear(m_ptr); + } + + /** + * Get an array to the data contained in the packet + * $(B the returned array may be invalid after you + * append data to the packet) + * + * Returns: + * array of data + * + * Remarks: + * return an array of $(B all) data in the packet. + * + * ---------- + * Packet p = new Packet(); + * + * char[] str1 = "Hi"; + * char[] str2 = "Hello"; + * + * p.set(str1, str2); + * + * // Retrieve str1 from packet + * char[] str3; + * p.get(str3); + * + * // Returns an array containing str1 and str2. + * byte[] ptr = p.getData(); + * ---------- + */ + byte[] getData() + { + if (canRead) + return sfPacket_GetData(m_ptr)[0..getDataSize]; + } + + + /** + * Get the size of the data contained in the packet + * + * Returns: + * Data size, in bytes + */ + uint getDataSize() + { + return sfPacket_GetDataSize(m_ptr); + } + + /** + * Tell if the reading position has reached the end of the packet + * + * Returns: + * true if all data have been read. + */ + bool endOfPacket() + { + return cast(bool)sfPacket_EndOfPacket(m_ptr); + } + /** + * Tell if the packet is valid for reading + * + * Returns: + * True if data can be extracted from the packet + * + */ + bool canRead() + { + return cast(bool)sfPacket_CanRead(m_ptr); + } + + + /** + * Add new variables to the packet + * Accept (u)byte, (u)short, (u)int, float, double, char[] and wchar[] types + */ + Packet set(T...)(T t) + { + foreach (v; t) + internalSet(t); + return this; + } + + /** + * Retrieve data from the packet + * Accept (u)byte, (u)short, (u)int, float, double, char[] and wchar[] types + */ + Packet get(T...)(ref T t) + { + foreach (v; t) + internalGet(t); + return this; + } + + /** + * Called before packet is send + * + * Params: + * size = Variable to fill with the size of the data to send + * Returns: + * Array of byte to send + */ + byte[] onSend() + { + return getData(); + } + + /** + * Called after a packet has been received + * + * Params: + * data = Array of byte received + */ + void onReceive(byte[] data) + { + append(data); + } + +private: + void internalGet(ref bool data) + { + data = cast(bool)sfPacket_ReadInt32(m_ptr); + } + void internalGet(ref byte data) + { + data = sfPacket_ReadInt8(m_ptr); + } + void internalGet(ref ubyte data) + { + data = sfPacket_ReadUint8(m_ptr); + } + void internalGet(ref short data) + { + data = sfPacket_ReadInt16(m_ptr); + } + void internalGet(ref ushort data) + { + data = sfPacket_ReadUint16(m_ptr); + } + void internalGet(ref int data) + { + data = sfPacket_ReadInt32(m_ptr); + } + void internalGet(ref uint data) + { + data = sfPacket_ReadUint32(m_ptr); + } + void internalGet(ref float data) + { + data = sfPacket_ReadFloat(m_ptr); + } + void internalGet(ref double data) + { + data = sfPacket_ReadDouble(m_ptr); + } + void internalGet(ref char[] data) + { + scope char[] temp = new char[sfPacket_GetDataSize(m_ptr)]; + sfPacket_ReadString(m_ptr, temp.ptr); + size_t l = fromStringz(temp.ptr).length; + data = new char[l]; + data[] = temp[0 .. l]; + } + + void internalGet(ref wchar[] data) + { + scope wchar[] temp = new wchar[sfPacket_GetDataSize(m_ptr)]; + sfPacket_ReadWideString(m_ptr, temp.ptr); + size_t l = fromStringz(temp.ptr).length; + data = new wchar[l]; + data[] = temp[0 .. l]; + } + + void internalSet(bool data) + { + sfPacket_WriteInt32(m_ptr, cast(int)data); + } + void internalSet(byte data) + { + sfPacket_WriteInt8(m_ptr, data); + } + void internalSet(ubyte data) + { + sfPacket_WriteUint8(m_ptr, data); + } + void internalSet(short data) + { + sfPacket_WriteInt16(m_ptr, data); + } + void internalSet(ushort data) + { + sfPacket_WriteUint16(m_ptr, data); + } + void internalSet(int data) + { + sfPacket_WriteInt32(m_ptr, data); + } + void internalSet(uint data) + { + sfPacket_WriteUint32(m_ptr, data); + } + void internalSet(float data) + { + sfPacket_WriteFloat(m_ptr, data); + } + void internalSet(double data) + { + sfPacket_WriteDouble(m_ptr, data); + } + void internalSet(char[] data) + { + sfPacket_WriteString(m_ptr, toStringz(data)); + } + + void internalSet(wchar[] data) + { + sfPacket_WriteWideString(m_ptr, toStringz(data)); + } + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfPacket_Create; + typedef void function(void*) pf_sfPacket_Destroy; + typedef void function(void*, void*, size_t) pf_sfPacket_Append; + typedef void function(void*) pf_sfPacket_Clear; + typedef byte* function(void*) pf_sfPacket_GetData; + typedef uint function(void*) pf_sfPacket_GetDataSize; + typedef int function(void*) pf_sfPacket_EndOfPacket; + typedef int function(void*) pf_sfPacket_CanRead; + typedef byte function(void*) pf_sfPacket_ReadInt8; + typedef ubyte function(void*) pf_sfPacket_ReadUint8; + typedef short function(void*) pf_sfPacket_ReadInt16; + typedef ushort function(void*) pf_sfPacket_ReadUint16; + typedef int function(void*) pf_sfPacket_ReadInt32; + typedef uint function(void*) pf_sfPacket_ReadUint32; + typedef float function(void*) pf_sfPacket_ReadFloat; + typedef double function(void*) pf_sfPacket_ReadDouble; + typedef void function(void*, char*) pf_sfPacket_ReadString; + typedef void function(void*, wchar*) pf_sfPacket_ReadWideString; + typedef void function(void*, byte) pf_sfPacket_WriteInt8; + typedef void function(void*, ubyte) pf_sfPacket_WriteUint8; + typedef void function(void*, short) pf_sfPacket_WriteInt16; + typedef void function(void*, ushort) pf_sfPacket_WriteUint16; + typedef void function(void*, int) pf_sfPacket_WriteInt32; + typedef void function(void*, uint) pf_sfPacket_WriteUint32; + typedef void function(void*, float) pf_sfPacket_WriteFloat; + typedef void function(void*, double) pf_sfPacket_WriteDouble; + typedef void function(void*, char*) pf_sfPacket_WriteString; + typedef void function(void*, wchar*) pf_sfPacket_WriteWideString; + + static pf_sfPacket_Create sfPacket_Create; + static pf_sfPacket_Destroy sfPacket_Destroy; + static pf_sfPacket_Append sfPacket_Append; + static pf_sfPacket_Clear sfPacket_Clear; + static pf_sfPacket_GetData sfPacket_GetData; + static pf_sfPacket_GetDataSize sfPacket_GetDataSize; + static pf_sfPacket_EndOfPacket sfPacket_EndOfPacket; + static pf_sfPacket_CanRead sfPacket_CanRead; + static pf_sfPacket_ReadInt8 sfPacket_ReadInt8; + static pf_sfPacket_ReadUint8 sfPacket_ReadUint8; + static pf_sfPacket_ReadInt16 sfPacket_ReadInt16; + static pf_sfPacket_ReadUint16 sfPacket_ReadUint16; + static pf_sfPacket_ReadInt32 sfPacket_ReadInt32; + static pf_sfPacket_ReadUint32 sfPacket_ReadUint32; + static pf_sfPacket_ReadFloat sfPacket_ReadFloat; + static pf_sfPacket_ReadDouble sfPacket_ReadDouble; + static pf_sfPacket_ReadString sfPacket_ReadString; + static pf_sfPacket_ReadWideString sfPacket_ReadWideString; + static pf_sfPacket_WriteInt8 sfPacket_WriteInt8; + static pf_sfPacket_WriteUint8 sfPacket_WriteUint8; + static pf_sfPacket_WriteInt16 sfPacket_WriteInt16; + static pf_sfPacket_WriteUint16 sfPacket_WriteUint16; + static pf_sfPacket_WriteInt32 sfPacket_WriteInt32; + static pf_sfPacket_WriteUint32 sfPacket_WriteUint32; + static pf_sfPacket_WriteFloat sfPacket_WriteFloat; + static pf_sfPacket_WriteDouble sfPacket_WriteDouble; + static pf_sfPacket_WriteString sfPacket_WriteString; + static pf_sfPacket_WriteWideString sfPacket_WriteWideString; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfPacket_Append = cast(pf_sfPacket_Append)dll.getSymbol("sfPacket_Append"); + sfPacket_CanRead = cast(pf_sfPacket_CanRead)dll.getSymbol("sfPacket_CanRead"); + sfPacket_Clear = cast(pf_sfPacket_Clear)dll.getSymbol("sfPacket_Clear"); + sfPacket_Create = cast(pf_sfPacket_Create)dll.getSymbol("sfPacket_Create"); + sfPacket_Destroy = cast(pf_sfPacket_Destroy)dll.getSymbol("sfPacket_Destroy"); + sfPacket_EndOfPacket = cast(pf_sfPacket_EndOfPacket)dll.getSymbol("sfPacket_EndOfPacket"); + sfPacket_GetData = cast(pf_sfPacket_GetData)dll.getSymbol("sfPacket_GetData"); + sfPacket_GetDataSize = cast(pf_sfPacket_GetDataSize)dll.getSymbol("sfPacket_GetDataSize"); + sfPacket_ReadDouble = cast(pf_sfPacket_ReadDouble)dll.getSymbol("sfPacket_ReadDouble"); + sfPacket_ReadFloat = cast(pf_sfPacket_ReadFloat)dll.getSymbol("sfPacket_ReadFloat"); + sfPacket_ReadInt16 = cast(pf_sfPacket_ReadInt16)dll.getSymbol("sfPacket_ReadInt16"); + sfPacket_ReadInt32 = cast(pf_sfPacket_ReadInt32)dll.getSymbol("sfPacket_ReadInt32"); + sfPacket_ReadInt8 = cast(pf_sfPacket_ReadInt8)dll.getSymbol("sfPacket_ReadInt8"); + sfPacket_ReadString = cast(pf_sfPacket_ReadString)dll.getSymbol("sfPacket_ReadString"); + sfPacket_ReadWideString = cast(pf_sfPacket_ReadWideString)dll.getSymbol("sfPacket_ReadWideString"); + sfPacket_ReadUint16 = cast(pf_sfPacket_ReadUint16)dll.getSymbol("sfPacket_ReadUint16"); + sfPacket_ReadUint32 = cast(pf_sfPacket_ReadUint32)dll.getSymbol("sfPacket_ReadUint32"); + sfPacket_ReadUint8 = cast(pf_sfPacket_ReadUint8)dll.getSymbol("sfPacket_ReadUint8"); + sfPacket_WriteDouble = cast(pf_sfPacket_WriteDouble)dll.getSymbol("sfPacket_WriteDouble"); + sfPacket_WriteFloat = cast(pf_sfPacket_WriteFloat)dll.getSymbol("sfPacket_WriteFloat"); + sfPacket_WriteInt16 = cast(pf_sfPacket_WriteInt16)dll.getSymbol("sfPacket_WriteInt16"); + sfPacket_WriteInt32 = cast(pf_sfPacket_WriteInt32)dll.getSymbol("sfPacket_WriteInt32"); + sfPacket_WriteInt8 = cast(pf_sfPacket_WriteInt8)dll.getSymbol("sfPacket_WriteInt8"); + sfPacket_WriteString = cast(pf_sfPacket_WriteString)dll.getSymbol("sfPacket_WriteString"); + sfPacket_WriteWideString = cast(pf_sfPacket_WriteWideString)dll.getSymbol("sfPacket_WriteWideString"); + sfPacket_WriteUint16 = cast(pf_sfPacket_WriteUint16)dll.getSymbol("sfPacket_WriteUint16"); + sfPacket_WriteUint32 = cast(pf_sfPacket_WriteUint32)dll.getSymbol("sfPacket_WriteUint32"); + sfPacket_WriteUint8 = cast(pf_sfPacket_WriteUint8)dll.getSymbol("sfPacket_WriteUint8"); + } +} diff --git a/DSFML/import/dsfml/network/selector.d b/DSFML/import/dsfml/network/selector.d new file mode 100644 index 00000000..8536427c --- /dev/null +++ b/DSFML/import/dsfml/network/selector.d @@ -0,0 +1,187 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.selector; + +import dsfml.network.sockettcp; +import dsfml.network.socketudp; + +import dsfml.system.common; + +/** +* Selector TCP allow reading from multiple sockets +* without blocking. It's a kind of multiplexer. Use SocketTCP or +* SocketUDP aliases. +*/ +class Selector(T) : DSFMLObject +{ + //Ensure type is correct + static if (!is(T : SocketTCP) && !is(T : SocketUDP)) + static assert("Only SocketTCP and SocketUDP are valid for Selector."); + + + /** + * Default constructor + */ + this() + { + super(sfSelector_Create()); + } + + override void dispose() + { + sfSelector_Destroy(m_ptr); + } + + /** + * Add a socket to watch + * + * Params: + * socket = A tcp or udp socket + */ + void add(T socket) + { + if (!(socket.getNativePointer in m_watchedSockets)) + { + sfSelector_Add(m_ptr, socket.getNativePointer); + m_watchedSockets[socket.getNativePointer] = socket; + m_numSocketsWatched++; + } + } + + /** + * Remove a previously added socket + * + * Params: + * socket = A tcp or udp socket + */ + void remove(T socket) + { + if (socket.getNativePointer in m_watchedSockets) + { + sfSelector_Remove(m_ptr, socket.getNativePointer); + m_watchedSockets.remove(socket.getNativePointer); + m_numSocketsWatched--; + } + } + + /** + * Clear all sockets being watched + */ + void clear() + { + sfSelector_Clear(m_ptr); + foreach(key; m_watchedSockets.keys) + m_watchedSockets.remove(key); + m_numSocketsWatched = 0; + } + + /** + * Wait and collect sockets which are ready for reading. + * This functions will return either when at least one socket + * is ready, or when the given time is out + * + * Params: + * timeout = Maximum time to wait, in seconds (0 to disable timeout) + * + * Returns: + * Number of sockets ready + */ + uint wait(float timeout = 0.f) + { + return sfSelector_Wait(m_ptr, timeout); + } + + /** + * After a call to Wait(), get the Index-th socket which is + * ready for reading. The total number of sockets ready + * is the integer returned by the previous call to Wait() + * + * Params: + * index = Index of the socket to get + * + * Returns: + * The Index-th socket + */ + T GetSocketsReady(uint index) + { + return m_watchedSockets[sfSelector_GetSocketReady(m_ptr, index)]; + } + + +private: + size_t m_numSocketsWatched; + T[void*] m_watchedSockets; + +// External ==================================================================== + extern (C) + { + typedef void* function() pf_sfSelector_Create; + typedef void function(void*) pf_sfSelector_Destroy; + typedef void function(void*, void*) pf_sfSelector_Add; + typedef void function(void*, void*) pf_sfSelector_Remove; + typedef void function(void*) pf_sfSelector_Clear; + typedef uint function(void*, float) pf_sfSelector_Wait; + typedef void* function(void*, uint) pf_sfSelector_GetSocketReady; + + static pf_sfSelector_Create sfSelector_Create; + static pf_sfSelector_Destroy sfSelector_Destroy; + static pf_sfSelector_Add sfSelector_Add; + static pf_sfSelector_Remove sfSelector_Remove; + static pf_sfSelector_Clear sfSelector_Clear; + static pf_sfSelector_Wait sfSelector_Wait; + static pf_sfSelector_GetSocketReady sfSelector_GetSocketReady; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + static if (is (T : SocketTCP)) + { + char[] symbol = "sfSelectorTCP"; + } + else static if (is (T : SocketUDP)) + { + char[] symbol = "sfSelectorUDP"; + } + + sfSelector_Add = cast(pf_sfSelector_Add)dll.getSymbol(symbol ~ "_Add"); + sfSelector_Clear = cast(pf_sfSelector_Clear)dll.getSymbol(symbol ~ "_Clear"); + sfSelector_Create = cast(pf_sfSelector_Create)dll.getSymbol(symbol ~ "_Create"); + sfSelector_Destroy = cast(pf_sfSelector_Destroy)dll.getSymbol(symbol ~ "_Destroy"); + sfSelector_GetSocketReady = cast(pf_sfSelector_GetSocketReady)dll.getSymbol(symbol ~ "_GetSocketReady"); + sfSelector_Wait = cast(pf_sfSelector_Wait)dll.getSymbol(symbol ~ "_Wait"); + sfSelector_Remove = cast(pf_sfSelector_Remove)dll.getSymbol(symbol ~ "_Remove"); + } +} + +/** +* alias of selector for TCP or UDP Socket. +*/ +alias Selector!(SocketTCP) SelectorTCP; +/// ditto +alias Selector!(SocketUDP) SelectorUDP; + diff --git a/DSFML/import/dsfml/network/socketstatus.d b/DSFML/import/dsfml/network/socketstatus.d new file mode 100644 index 00000000..1af48b8b --- /dev/null +++ b/DSFML/import/dsfml/network/socketstatus.d @@ -0,0 +1,37 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.socketstatus; + +/** +* Enumeration of status returned by socket functions +*/ +enum SocketStatus +{ + DONE, /// + NOTREADY, /// + DISCONNECTED, /// + UNEXPECTEDERROR /// +} diff --git a/DSFML/import/dsfml/network/sockettcp.d b/DSFML/import/dsfml/network/sockettcp.d new file mode 100644 index 00000000..a7bd694a --- /dev/null +++ b/DSFML/import/dsfml/network/sockettcp.d @@ -0,0 +1,268 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.sockettcp; + +import dsfml.network.ipaddress; +import dsfml.network.packet; +import dsfml.network.socketstatus; + +import dsfml.system.common; + +/** +* SocketTCP wraps a socket using TCP protocol to send data safely (but a bit slower) +*/ +class SocketTCP : DSFMLObject +{ + /** + * Default constructor + */ + this() + { + super(sfSocketTCP_Create()); + m_intermediatePacket = new Packet(); + } + + override void dispose() + { + sfSocketTCP_Destroy(m_ptr); + } + + /** + * Connect to another computer on a specified port + * + * Params: + * port = Port to use for transfers (warning : ports < 1024 are reserved) + * hostAddress = IP Address of the host to connect to + * timeout = Maximum time to wait in seconds (0 by default : no timeout) + * + * Returns: + * True if operation has been successful + */ + bool connect(ushort port, IPAddress hostAddress, float timeout = 0.f) + { + return cast(bool) !sfSocketTCP_Connect(m_ptr, port, hostAddress, timeout); + } + + /** + * Listen to a specified port for incoming data or connections + * + * Params: + * port = Port to listen to + * + * Returns: + * True if operation has been successful + */ + bool listen(ushort port) + { + return cast(bool)sfSocketTCP_Listen(m_ptr, port); + } + + /** + * Wait for a connection (must be listening to a port). + * This function is blocking. + * + * Params: + * connected = Socket containing the connection with the connected client + * + * Returns: + * Status code + */ + SocketStatus accept(SocketTCP connected) + { + void* temp = null; + SocketStatus ret = sfSocketTCP_Accept(m_ptr, &temp, null); + connected.m_ptr = temp; + return ret; + } + + /** + * Wait for a connection (must be listening to a port). + * This function is blocking. + * + * Params: + * connected = Socket containing the connection with the connected client + * address = Pointer to an address to fill with client infos + * + * Returns: + * Status code + */ + SocketStatus accept(SocketTCP connected, out IPAddress address) + { + void* temp = null; + SocketStatus ret = sfSocketTCP_Accept(m_ptr, &temp, &address); + connected.m_ptr = temp; + return ret; + } + + /** + * Send an array of bytes to the host (must be connected first) + * + * Params: + * data = array of bytes to send + * + * Returns: + * Status code + */ + SocketStatus send(byte[] data) + { + if (data && data.length > 0) + return cast(SocketStatus)sfSocketTCP_Send(m_ptr, data.ptr, data.length); + } + + /** + * Receive an array of bytes from the host (must be connected first). + * This function will block until a connection was accepted + * + * Params: + * data = array to fill (make sure it is big enough) + * sizeReceived = Number of bytes received + * + * Returns: + * Status code + * + * Remarks: + * Assert if data is null or length == 0 + * + */ + SocketStatus receive(byte[] data, out size_t sizeReceived) + { + if (data && data.length > 0) + return cast(SocketStatus)sfSocketTCP_Receive(m_ptr, data.ptr, data.length, &sizeReceived); + } + + + /** + * Send a packet of data to the host (must be connected first) + * + * Params: + * packetToSend = Packet to send + * + * Returns: + * Status code + * + */ + SocketStatus send(Packet packetToSend) + { + byte[] dataArray = packetToSend.onSend(); + m_intermediatePacket.append(dataArray); + SocketStatus stat = cast(SocketStatus)sfSocketTCP_SendPacket(m_ptr, m_intermediatePacket.getNativePointer); + m_intermediatePacket.clear(); + return stat; + } + + /** + * Receive a packet from the host (must be connected first). + * This function will block if the socket is blocking + * + * Params: + * packetToReceive = Packet to fill with received data + * + * Returns: + * Status code + * + */ + SocketStatus receive(Packet packetToReceive) + { + SocketStatus stat = cast(SocketStatus)sfSocketTCP_ReceivePacket(m_ptr, m_intermediatePacket.getNativePointer); + packetToReceive.onReceive(m_intermediatePacket.getData); + m_intermediatePacket.clear(); + return stat; + } + + /** + * Check if the socket is in a valid state ; this function + * can be called any time to check if the socket is OK + * + * Returns: + * True if the socket is valid + * + */ + bool isValid() + { + return cast(bool)sfSocketTCP_IsValid(m_ptr); + } + + /// + bool opEquals(SocketTCP other) + { + return (other.getNativePointer == this.getNativePointer); + } + + +package: + + this (void* ptr) + { + super(ptr); + m_intermediatePacket = new Packet(); + } + + +private: + Packet m_intermediatePacket; + +// External ==================================================================== + extern (C) + { + typedef void* function() pf_sfSocketTCP_Create; + typedef void function(void*) pf_sfSocketTCP_Destroy; + typedef int function(void*, ushort, IPAddress, float) pf_sfSocketTCP_Connect; + typedef int function(void*, ushort) pf_sfSocketTCP_Listen; + typedef SocketStatus function(void*, void**, IPAddress*) pf_sfSocketTCP_Accept; + typedef SocketStatus function(void*, byte*, size_t) pf_sfSocketTCP_Send; + typedef SocketStatus function(void*, byte*, size_t, size_t*) pf_sfSocketTCP_Receive; + typedef SocketStatus function(void*, void*) pf_sfSocketTCP_SendPacket; + typedef SocketStatus function(void*, void*) pf_sfSocketTCP_ReceivePacket; + typedef int function(void*) pf_sfSocketTCP_IsValid; + + static pf_sfSocketTCP_Create sfSocketTCP_Create; + static pf_sfSocketTCP_Destroy sfSocketTCP_Destroy; + static pf_sfSocketTCP_Connect sfSocketTCP_Connect; + static pf_sfSocketTCP_Listen sfSocketTCP_Listen; + static pf_sfSocketTCP_Accept sfSocketTCP_Accept; + static pf_sfSocketTCP_Send sfSocketTCP_Send; + static pf_sfSocketTCP_Receive sfSocketTCP_Receive; + static pf_sfSocketTCP_SendPacket sfSocketTCP_SendPacket; + static pf_sfSocketTCP_ReceivePacket sfSocketTCP_ReceivePacket; + static pf_sfSocketTCP_IsValid sfSocketTCP_IsValid; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfSocketTCP_Accept = cast(pf_sfSocketTCP_Accept)dll.getSymbol("sfSocketTCP_Accept"); + sfSocketTCP_Connect = cast(pf_sfSocketTCP_Connect)dll.getSymbol("sfSocketTCP_Connect"); + sfSocketTCP_Create = cast(pf_sfSocketTCP_Create)dll.getSymbol("sfSocketTCP_Create"); + sfSocketTCP_Destroy = cast(pf_sfSocketTCP_Destroy)dll.getSymbol("sfSocketTCP_Destroy"); + sfSocketTCP_IsValid = cast(pf_sfSocketTCP_IsValid)dll.getSymbol("sfSocketTCP_IsValid"); + sfSocketTCP_Listen = cast(pf_sfSocketTCP_Listen)dll.getSymbol("sfSocketTCP_Listen"); + sfSocketTCP_Receive = cast(pf_sfSocketTCP_Receive)dll.getSymbol("sfSocketTCP_Receive"); + sfSocketTCP_ReceivePacket = cast(pf_sfSocketTCP_ReceivePacket)dll.getSymbol("sfSocketTCP_ReceivePacket"); + sfSocketTCP_Send = cast(pf_sfSocketTCP_Send)dll.getSymbol("sfSocketTCP_Send"); + sfSocketTCP_SendPacket = cast(pf_sfSocketTCP_SendPacket)dll.getSymbol("sfSocketTCP_SendPacket"); + } +} diff --git a/DSFML/import/dsfml/network/socketudp.d b/DSFML/import/dsfml/network/socketudp.d new file mode 100644 index 00000000..d24bce08 --- /dev/null +++ b/DSFML/import/dsfml/network/socketudp.d @@ -0,0 +1,243 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.network.socketudp; + +import dsfml.network.ipaddress; +import dsfml.network.packet; +import dsfml.network.socketstatus; + +import dsfml.system.common; + +/** +* SocketUDP wraps a socket using UDP protocol to +* send data fastly (but with less safety) +*/ +class SocketUDP : DSFMLObject +{ + /** + * Default constructor + */ + this() + { + super(sfSocketUDP_Create()); + m_intermediatePacket = new Packet(); + } + + override void dispose() + { + sfSocketUDP_Destroy(m_ptr); + } + + /** + * Bind the socket to a specific port + * + * Params: + * port = Port to bind the socket to + * + * Returns: + * True if operation has been successful + * + */ + bool bind(ushort port) + { + m_port = port; + return cast(bool)sfSocketUDP_Bind(m_ptr, port); + } + + /** + * Unbind the socket from its previous port, if any + * + * Returns: True if operation has been successful + * + */ + bool unbind() + { + m_port = 0; + return cast(bool)sfSocketUDP_Unbind(m_ptr, m_port); + } + + /** + * Send an array of bytes + * + * Params: + * data = bytes array to send + * address = Address of the computer to send the packet to + * port = Port to send the data to + * + * Returns: + * Status code + * + */ + SocketStatus send(byte[] data, IPAddress address, ushort port) + { + return cast(SocketStatus) sfSocketUDP_Send(m_ptr, data.ptr, data.length, address, port); + } + + /** + * Receive an array of bytes. + * This function is blocking. + * + * Params: + * data = Pointer to a byte array to fill (make sure it is big enough) + * sizeReceived = Number of bytes received + * address = Address of the computer which sent the data + * + * Returns: + * Status code + * + * Remarks: + * Assert if data is null or length == 0 + * + */ + SocketStatus receive(byte[] data, out size_t sizeReceived, out IPAddress address) + { + SocketStatus ret = sfSocketUDP_Receive(m_ptr, data.ptr, data.length, &sizeReceived, &address); + return ret; + } + + /** + * Send a packet of data + * + * Params: + * packetToSend = Packet to send + * address = Address of the computer to send the packet to + * port = Port to send the data to + * + * Returns: + * Status code + * + */ + SocketStatus send(Packet packetToSend, IPAddress address, ushort port) + { + byte[] dataArray = packetToSend.onSend(); + m_intermediatePacket.append(dataArray); + SocketStatus stat = cast(SocketStatus)sfSocketUDP_SendPacket(m_ptr, m_intermediatePacket.getNativePointer, address, port); + m_intermediatePacket.clear(); + return stat; + } + + /** + * Receive a packet. + * This function is blocking. + * + * Params: + * packetToReceive = Packet to fill with received data + * address = Address of the computer which sent the packet + * + * Returns: + * Status code + * + */ + SocketStatus receive(Packet packetToReceive, out IPAddress address) + { + SocketStatus ret = sfSocketUDP_ReceivePacket(m_ptr, m_intermediatePacket.getNativePointer, &address); + packetToReceive.onReceive(m_intermediatePacket.getData); + m_intermediatePacket.clear(); + return ret; + + } + + /** + * Check if the socket is in a valid state ; this function + * can be called any time to check if the socket is OK + * + * Returns: + * True if the socket is valid + * + */ + bool isValid() + { + return cast(bool)sfSocketUDP_IsValid(m_ptr); + } + + /** + * Get the port the socket is currently bound to + * + * Returns: + * Current port (0 means the socket is not bound) + */ + ushort getPort() + { + return m_port; + } + + /// + bool opEquals(SocketUDP other) + { + return (other.getNativePointer == this.getNativePointer); + } + +package: + this (void* ptr) + { + super(ptr); + m_intermediatePacket = new Packet(); + } + +private: + Packet m_intermediatePacket; + ushort m_port; + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfSocketUDP_Create; + typedef void function(void*) pf_sfSocketUDP_Destroy; + typedef int function(void*, ushort) pf_sfSocketUDP_Bind; + typedef int function(void*, ushort) pf_sfSocketUDP_Unbind; + typedef SocketStatus function(void*, byte*, size_t, IPAddress, ushort) pf_sfSocketUDP_Send; + typedef SocketStatus function(void*, byte*, size_t, size_t*, IPAddress*) pf_sfSocketUDP_Receive; + typedef SocketStatus function(void*, void*, IPAddress, ushort) pf_sfSocketUDP_SendPacket; + typedef SocketStatus function(void*, void*, IPAddress*) pf_sfSocketUDP_ReceivePacket; + typedef int function(void*) pf_sfSocketUDP_IsValid; + + static pf_sfSocketUDP_Create sfSocketUDP_Create; + static pf_sfSocketUDP_Destroy sfSocketUDP_Destroy; + static pf_sfSocketUDP_Bind sfSocketUDP_Bind; + static pf_sfSocketUDP_Unbind sfSocketUDP_Unbind; + static pf_sfSocketUDP_Send sfSocketUDP_Send; + static pf_sfSocketUDP_Receive sfSocketUDP_Receive; + static pf_sfSocketUDP_SendPacket sfSocketUDP_SendPacket; + static pf_sfSocketUDP_ReceivePacket sfSocketUDP_ReceivePacket; + static pf_sfSocketUDP_IsValid sfSocketUDP_IsValid; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-network"); + + sfSocketUDP_Bind = cast(pf_sfSocketUDP_Bind)dll.getSymbol("sfSocketUDP_Bind"); + sfSocketUDP_Create = cast(pf_sfSocketUDP_Create)dll.getSymbol("sfSocketUDP_Create"); + sfSocketUDP_Destroy = cast(pf_sfSocketUDP_Destroy)dll.getSymbol("sfSocketUDP_Destroy"); + sfSocketUDP_IsValid = cast(pf_sfSocketUDP_IsValid)dll.getSymbol("sfSocketUDP_IsValid"); + sfSocketUDP_Receive = cast(pf_sfSocketUDP_Receive)dll.getSymbol("sfSocketUDP_Receive"); + sfSocketUDP_ReceivePacket = cast(pf_sfSocketUDP_ReceivePacket)dll.getSymbol("sfSocketUDP_ReceivePacket"); + sfSocketUDP_Send = cast(pf_sfSocketUDP_Send)dll.getSymbol("sfSocketUDP_Send"); + sfSocketUDP_SendPacket = cast(pf_sfSocketUDP_SendPacket)dll.getSymbol("sfSocketUDP_SendPacket"); + sfSocketUDP_Unbind = cast(pf_sfSocketUDP_Unbind)dll.getSymbol("sfSocketUDP_Unbind"); + } +} diff --git a/DSFML/import/dsfml/system/all.d b/DSFML/import/dsfml/system/all.d new file mode 100644 index 00000000..8b43f2fc --- /dev/null +++ b/DSFML/import/dsfml/system/all.d @@ -0,0 +1,45 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.all; + +version (linux) +{ + version (build) + { + pragma(link, "dl"); //Link libdl.so (dlopen, dlsym) + } +} + + +public import + dsfml.system.clock, + dsfml.system.lock, + dsfml.system.mutex, + dsfml.system.randomizer, + dsfml.system.sleep, + dsfml.system.thread, + dsfml.system.vector2, + dsfml.system.vector3; diff --git a/DSFML/import/dsfml/system/alloc.d b/DSFML/import/dsfml/system/alloc.d new file mode 100644 index 00000000..71a6f98d --- /dev/null +++ b/DSFML/import/dsfml/system/alloc.d @@ -0,0 +1,81 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.alloc; + +version (Tango) +{ + public import tango.core.Memory; +} +else +{ + import std.c.stdlib; + import std.gc; + + struct GC + { + static void* malloc(uint size) + { + return std.c.stdlib.malloc(size); + } + + static void free(void* ptr) + { + std.c.stdlib.free(ptr); + } + + static void addRange(void* ptr, uint size) + { + std.gc.addRange(ptr, ptr + size); + } + + static void removeRange(void* ptr) + { + std.gc.removeRange(ptr); + } + } +} + +/* +* Template for native non-GCed allocation for interaction between C and D threads. +*/ +template Alloc() +{ + new (uint size) + { + void* p = GC.malloc(size); + if (!p) + assert(0, "Memory allocation failed"); + + GC.addRange(p, size); + return p; + } + + delete(void* p) + { + GC.removeRange(p); + GC.free(p); + } +} diff --git a/DSFML/import/dsfml/system/clock.d b/DSFML/import/dsfml/system/clock.d new file mode 100644 index 00000000..0bcedcb5 --- /dev/null +++ b/DSFML/import/dsfml/system/clock.d @@ -0,0 +1,97 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.clock; + +import dsfml.system.common; + +/** + * Utility class for manipulating time + */ +class Clock : DSFMLObject +{ + /** + * Default constructor + */ + this() + { + super(sfClock_Create()); + } + + /** + * Destructor + */ + override void dispose() + { + sfClock_Destroy(m_ptr); + } + + /** + * Return the time elapsed since the last reset + * Returns: + * Elapsed Time in seconds + */ + float getElapsedTime() + { + return sfClock_GetTime(m_ptr); + } + + /** + * Restart the timer + */ + void reset() + { + sfClock_Reset(m_ptr); + } + +private: + +// External ==================================================================== + + + extern (C) + { + typedef void* function() pf_sfClock_Create; + typedef void function(void*) pf_sfClock_Destroy; + typedef float function(void*) pf_sfClock_GetTime; + typedef void function(void*) pf_sfClock_Reset; + + static pf_sfClock_Create sfClock_Create; + static pf_sfClock_Destroy sfClock_Destroy; + static pf_sfClock_GetTime sfClock_GetTime; + static pf_sfClock_Reset sfClock_Reset; + + static this() + { + DllLoader dll = DllLoader.load("csfml-system"); + + sfClock_Create = cast(pf_sfClock_Create)dll.getSymbol("sfClock_Create"); + sfClock_Destroy = cast(pf_sfClock_Destroy)dll.getSymbol("sfClock_Destroy"); + sfClock_GetTime = cast(pf_sfClock_GetTime)dll.getSymbol("sfClock_GetTime"); + sfClock_Reset = cast(pf_sfClock_Reset)dll.getSymbol("sfClock_Reset"); + } + } +} + diff --git a/DSFML/import/dsfml/system/common.d b/DSFML/import/dsfml/system/common.d new file mode 100644 index 00000000..830c1bf7 --- /dev/null +++ b/DSFML/import/dsfml/system/common.d @@ -0,0 +1,70 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.common; + +public import dsfml.system.dllloader; + +/** +* Base class for all DSFML classes. +*/ +class DSFMLObject +{ + this(void* ptr, bool preventDelete = false) + { + m_ptr = ptr; + } + + ~this() + { + if (!m_preventDelete) + dispose(); + + m_ptr = m_ptr.init; + } + + abstract void dispose(); + + void* getNativePointer() + { + return m_ptr; + } + + void setHandled(bool handled) + { + m_preventDelete = handled; + } + + protected invariant() + { + assert(m_ptr !is null, "Problem occurs with a null pointer in " ~ this.toString); + } + +protected: + void* m_ptr; + +private: + bool m_preventDelete; +} diff --git a/DSFML/import/dsfml/system/dllloader.d b/DSFML/import/dsfml/system/dllloader.d new file mode 100644 index 00000000..887da6f7 --- /dev/null +++ b/DSFML/import/dsfml/system/dllloader.d @@ -0,0 +1,189 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.dllloader; + +import dsfml.system.stringutil; + +version (Tango) +{ + import tango.io.Console; + import tango.sys.SharedLib; +} +else +{ + import std.stdio; + + version (Windows) + { + import std.c.windows.windows; + alias HMODULE MODULEHANDLE; + } + version (linux) + { + import std.c.linux.linux; + alias void* MODULEHANDLE; + + const int RTLD_NOW = 0x00002; + const int RTLD_GLOBAL = 0x00100; + } +} + +static this() +{ + version (Tango) + { + SharedLib.throwExceptions = false; + } +} + +private void report(char[] msg, char[] lib, char[] symb) +{ + char[] str = "Loading error. Reason : " ~ msg ~ " (library : " ~ lib ~ ", symbol : " ~ symb ~ ")"; + version (Tango) + { + Cerr(str).newline; + } + else + { + fwritefln(stderr, str); + } +} + + +/** +* Simple Dll loader. +*/ +class DllLoader +{ + static DllLoader load(char[] library) + { + version (Windows) + { + char[] libraryName = library ~ ".dll"; + } + version (linux) + { + char[] libraryName = "lib" ~ library ~ ".so"; + } + + if (libraryName in alreadyLoaded) + { + return alreadyLoaded[libraryName]; + } + else + { + DllLoader temp = new DllLoader(libraryName); + alreadyLoaded[libraryName] = temp; + return temp; + } + } + + ~this() + { + close(); + } + + void* getSymbol(char[] symbolName) + { + void* symb; + version (Tango) + { + symb = m_lib.getSymbol(toStringz(symbolName)); + } + else + { + version (Windows) + { + symb = GetProcAddress(m_lib, toStringz(symbolName)); + } + version (linux) + { + symb = dlsym(m_lib, toStringz(symbolName)); + } + } + + if (symb is null) + report( "Symbol cannot be found in specified library", m_libPath, symbolName); + + return symb; + } + + void close() + { + version (Tango) + { + m_lib.unload(); + } + else + { + version (Windows) + { + FreeLibrary(m_lib); + } + version (linux) + { + dlclose(m_lib); + } + alreadyLoaded.remove(this.m_libPath); + } + } + +private: + this(char[] libraryPath) + { + m_libPath = libraryPath; + + version (Tango) + { + m_lib = SharedLib.load(libraryPath); + } + else + { + version (Windows) + { + m_lib = LoadLibraryA(toStringz(libraryPath)); + } + version (linux) + { + m_lib = dlopen(toStringz(libraryPath), RTLD_NOW | RTLD_GLOBAL); + } + } + if (m_lib is null) + report("Cannot open library", m_libPath, null); + } + + version (Tango) + { + SharedLib m_lib; + } + else + { + MODULEHANDLE m_lib; + } + + static DllLoader[char[]] alreadyLoaded; + char[] m_libPath; +} diff --git a/DSFML/import/dsfml/system/exception.d b/DSFML/import/dsfml/system/exception.d new file mode 100644 index 00000000..c9823a30 --- /dev/null +++ b/DSFML/import/dsfml/system/exception.d @@ -0,0 +1,42 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.exception; + +class LoadingException : Exception +{ + this(char[] msg) + { + super(msg); + } +} + +class NullParameterException : Exception +{ + this(char[] msg) + { + super(msg); + } +} diff --git a/DSFML/import/dsfml/system/linkedlist.d b/DSFML/import/dsfml/system/linkedlist.d new file mode 100644 index 00000000..5ef6b829 --- /dev/null +++ b/DSFML/import/dsfml/system/linkedlist.d @@ -0,0 +1,102 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.linkedlist; + +/* +* Trivial implementation of Queue linked list (for internal use) +*/ +class LinkedList(T) +{ + Node!(T) head; + Node!(T) tail; + private size_t m_count; + + void enqueue(T object) + { + if (empty) + head = tail = new Node!(T)(object); + else + { + tail.Next = new Node!(T)(object); + tail = tail.Next; + } + m_count++; + } + + T dequeue() + { + T o; + if (empty) + o = T.init; + else + { + o = head.Data; + head = head.Next; + m_count--; + } + return o; + } + + bool empty() + { + return (head is null); + } + + size_t getCount() + { + return m_count; + } + + void clear() + { + T data; + while ((data = dequeue()) !is T.init) {} + } + + int opApply(int delegate(ref T) dg) + { + T data; + int result; + while ((data = dequeue) !is T.init) + { + if ((result = dg(data)) != 0) + break; + } + return result; + } +} + +private class Node(T) +{ + Node Next; + T Data; + + this(T data) + { + Data = data; + } +} + diff --git a/DSFML/import/dsfml/system/lock.d b/DSFML/import/dsfml/system/lock.d new file mode 100644 index 00000000..171c96b4 --- /dev/null +++ b/DSFML/import/dsfml/system/lock.d @@ -0,0 +1,65 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.lock; + +import dsfml.system.mutex; + +/** +* Encapsulation of an critical section. Unlocking is guaranteed when the Lock goes out of scope, even on exception. +* +* Remarks: +* Lock is a scope class, you need to mark Lock object as scope : +* +* ----------------- +* Mutex m = new Mutex; +* //.. +* { +* scope Lock l = new Lock(m); +* // Critical section +* } // End of critical (Destructor called and mutex unlocked) +* //.. +* +* ----------------- +*/ +scope class Lock +{ + /** + * Construct the lock and lock the mutex + */ + this(Mutex m) + { + m_mutex = m; + m_mutex.lock(); + } + + ~this() + { + m_mutex.unlock(); + } + +private: + Mutex m_mutex; +} diff --git a/DSFML/import/dsfml/system/mutex.d b/DSFML/import/dsfml/system/mutex.d new file mode 100644 index 00000000..8fa1802c --- /dev/null +++ b/DSFML/import/dsfml/system/mutex.d @@ -0,0 +1,94 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.mutex; + +import dsfml.system.common; + +/** +* Provide portable implementation of Mutual Exclusion object. +* +* Uses CriticalSection on Windows and pthread mutexes on linux. +*/ +final class Mutex : DSFMLObject +{ + /** + * Constructor + */ + this() + { + super(sfMutex_Create()); + } + + override void dispose() + { + sfMutex_Destroy(m_ptr); + } + + /** + * Lock the mutex + * + * Can be called multiples times, but each lock must be unlocked with unlock() + */ + void lock() + { + sfMutex_Lock(m_ptr); + } + + /** + * Unlock the mutex + */ + void unlock() + { + sfMutex_Unlock(m_ptr); + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef void* function() pf_sfMutex_Create; + typedef void function(void*) pf_sfMutex_Destroy; + typedef void function(void*) pf_sfMutex_Lock; + typedef void function(void*) pf_sfMutex_Unlock; + + static pf_sfMutex_Create sfMutex_Create; + static pf_sfMutex_Destroy sfMutex_Destroy; + static pf_sfMutex_Lock sfMutex_Lock; + static pf_sfMutex_Unlock sfMutex_Unlock; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-system"); + + sfMutex_Create = cast(pf_sfMutex_Create)dll.getSymbol("sfMutex_Create"); + sfMutex_Destroy = cast(pf_sfMutex_Destroy)dll.getSymbol("sfMutex_Destroy"); + sfMutex_Lock = cast(pf_sfMutex_Lock)dll.getSymbol("sfMutex_Lock"); + sfMutex_Unlock = cast(pf_sfMutex_Unlock)dll.getSymbol("sfMutex_Unlock"); + } +} diff --git a/DSFML/import/dsfml/system/randomizer.d b/DSFML/import/dsfml/system/randomizer.d new file mode 100644 index 00000000..e9238a7b --- /dev/null +++ b/DSFML/import/dsfml/system/randomizer.d @@ -0,0 +1,130 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.randomizer; + +import dsfml.system.common; + +/** +* Randomizer is an utility class for generating pseudo-random +* numbers +* +* Examples: +* ----------------------------------------------------------- +* int randI = Randomizer.Random(1, 100); +* float randF = Randomizer.Random(1.0, 10.0) +* ----------------------------------------------------------- +*/ +class Randomizer +{ + /** + * Set the seed for the generator. Using a known seed + * allows you to reproduce the same sequence of random number + * + * Params: + * seed = Number to use as the seed + * + */ + static void setSeed(uint seed) + { + sfRandom_SetSeed(seed); + } + + /** + * Get the seed used to generate random numbers the generator. + * + * Returns: + * Current seed + */ + static uint getSeed() + { + return sfRandom_GetSeed(); + } + + /** + * Get a random float number in a given range + * + * Params: + * begin = Start of the range + * end = End of the range + * Returns: + * Random number in [Begin, End] + */ + static float random(float begin, float end) + { + return sfRandom_Float(begin, end); + } + + /** + * Get a random integral number in a given range + * + * Params: + * begin = Start of the range + * end = End of the range + * Returns: + * Random number in [Begin, End] + */ + static int random(int begin, int end) + { + return sfRandom_Int(begin, end); + } + + +private: + + /* + * Prevent instanciation + */ + this() + { + + } + +// External ==================================================================== + + extern (C) + { + typedef void function(uint) pf_sfRandom_SetSeed; + typedef uint function() pf_sfRandom_GetSeed; + typedef float function(float, float) pf_sfRandom_Float; + typedef int function(int, int) pf_sfRandom_Int; + + static pf_sfRandom_SetSeed sfRandom_SetSeed; + static pf_sfRandom_GetSeed sfRandom_GetSeed; + static pf_sfRandom_Float sfRandom_Float; + static pf_sfRandom_Int sfRandom_Int; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-system"); + + sfRandom_SetSeed = cast(pf_sfRandom_SetSeed)dll.getSymbol("sfRandom_SetSeed"); + sfRandom_GetSeed = cast(pf_sfRandom_GetSeed)dll.getSymbol("sfRandom_GetSeed"); + sfRandom_Float = cast(pf_sfRandom_Float)dll.getSymbol("sfRandom_Float"); + sfRandom_Int = cast(pf_sfRandom_Int)dll.getSymbol("sfRandom_Int"); + } +} + diff --git a/DSFML/import/dsfml/system/sleep.d b/DSFML/import/dsfml/system/sleep.d new file mode 100644 index 00000000..5733d11e --- /dev/null +++ b/DSFML/import/dsfml/system/sleep.d @@ -0,0 +1,53 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.sleep; + +import dsfml.system.common; + +extern(C) +{ + typedef void function(float) pf_sfSleep; + + private static pf_sfSleep sfSleep; +} + +static this() +{ + DllLoader dll = DllLoader.load("csfml-system"); + + sfSleep = cast(pf_sfSleep)dll.getSymbol("sfSleep"); +} + +/** +* Make the current thread sleep for a given time +* +* Params: +* duration = Time to sleep, in seconds +*/ +void sleep(float duration) +{ + sfSleep(duration); +} diff --git a/DSFML/import/dsfml/system/stringutil.d b/DSFML/import/dsfml/system/stringutil.d new file mode 100644 index 00000000..91cbb0c3 --- /dev/null +++ b/DSFML/import/dsfml/system/stringutil.d @@ -0,0 +1,169 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.stringutil; + +// version (Tango) +// { +// public import tango.stdc.stringz; +// } +// else +// { + T* toStringz(T)(T[] str) + { + if (str is null) + return null; + else if (str.length && str[$ - 1] is T.init) + return str.ptr; + + T[] ret = new T[str.length + 1]; + + ret[0 .. str.length] = str[0 .. $]; + ret[str.length] = 0; + + return ret.ptr; + } + + size_t stringLength(T)(T* p) + { + if (p is null || *p == T.init) + return 0; + + size_t length; + + while (*(p + length)) + { + length++; + } + + return length; + } + + T[] fromStringz(T)(T* ptr) + { + T[] ret = new T[stringLength(ptr)]; + ret[0..$] = ptr[0..ret.length]; + + return ret; + } + + + +// /* +// * Tango equivalent functions +// * +// * Author : Keinfarbton +// * Licence : BSD style +// */ +// char* toStringz(char[] s) +// { +// if (s.ptr) +// if (!(s.length && s[$-1] is 0)) +// s = s ~ '\0'; +// return s.ptr; +// } +// +// char[] fromStringz (char* s) +// { +// size_t i; +// +// if (s) +// while (*(s+i)) +// ++i; +// +// return s ? s[0 .. i] : null; +// } +// +// wchar* toString16z(wchar[] s) +// { +// if (s.ptr) +// if (!(s.length && s[$-1] is 0)) +// s = s ~ '\0'; +// return s.ptr; +// } +// +// wchar[] fromString16z (wchar* s) +// { +// size_t i; +// +// if (s) +// while (*(s+i)) +// ++i; +// +// return s ? s[0 .. i] : null; +// } +// +// dchar* toString32z (dchar[] s) +// { +// if (s.ptr) +// if (!(s.length && s[$-1] is 0)) +// s = s ~ "\0"d; +// return s.ptr; +// } +// +// +// dchar[] fromString32z (dchar* s) +// { +// size_t i; +// +// if (s) +// while (*(s+i)) +// ++i; +// +// return s ? s[0 .. i] : null; +// } +// } +version (UnitTest) +{ + void main() + { + + } + unittest + { + char[] str = "Test"; + char[] espaceStr = "string with espace"; + + dchar[] strW = "Test"d; + dchar[] espaceStrW = "string with espace"d; + + char[] empty = ""; + dchar[] emptyW = ""d; + + char[] nullStr = null; + dchar[] nullStrW = null; + + assert(fromStringz(toStringz(str)) == str); + assert(fromStringz(toStringz(espaceStr)) == espaceStr); + assert(fromStringz(toStringz(strW)) == strW); + assert(fromStringz(toStringz(espaceStrW)) == espaceStrW); + + assert(fromStringz(toStringz(empty)) == empty); + assert(fromStringz(toStringz(emptyW)) == emptyW); + + assert(fromStringz(toStringz(nullStr)) == nullStr); + assert(fromStringz(toStringz(nullStrW)) == nullStrW); + } +} diff --git a/DSFML/import/dsfml/system/thread.d b/DSFML/import/dsfml/system/thread.d new file mode 100644 index 00000000..cde2d52e --- /dev/null +++ b/DSFML/import/dsfml/system/thread.d @@ -0,0 +1,216 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.thread; + +version(Tango) +{ + static import tango.core.Thread; + alias tango.core.Thread.Thread DThread; +} +else +{ + static import std.thread; + alias std.thread.Thread DThread; +} + +/** +* Thread defines a simple thread abstraction. +* +* Examples: +* Can be a base class (you need to override void run(void) method) : +* -------------------- +* class MyThread : Thread +* { +* void function() +* { +* this.launch(); +* } +* +* //Thread entry point +* protected void run() +* { +* } +* } +* -------------------- +* +* or +* +* -------------------- +* void main() +* { +* Thread t = new Thread(&threadStart); +* t.launch(); +* t.wait(); //Wait the end of t thread +* } +* +* //Thread entry point +* void threadStart (void* userData) +* { +* +* } +* -------------------- +* +* or +* +* -------------------- +* void main() +* { +* MyObject foo = new MyObject(); +* Thread t = new Thread(&foo.bar); +* t.launch(); +* t.wait(); //Wait the end of t thread +* } +* +* class MyObject +* { +* void bar(void* user) +* { +* //... +* } +* } +* -------------------- +*/ +class Thread +{ + /** + * Construct the thread from a function pointer. + * + * Params: + * func = Entry point of the thread + * userData = Data to pass to the thread function (NULL by default) + * + */ + this(void function(void*) func, void* userData = null) + { + m_t = new DThread(&threadStart); + + m_func = func; + m_userData = userData; + } + + /** + * Construct the thread from a delegate. + * + * Params: + * dg = Entry point of the thread + * userData = Data to pass to the thread function (NULL by default) + * + */ + this(void delegate(void*) dg, void* userData = null) + { + m_t = new DThread(&threadStart); + + m_dg = dg; + m_userData = userData; + + m_isDelegate = true; + } + + /** + * Run the thread + */ + final void launch() + { + if (!m_running) + { + m_t.start(); + m_running = true; + } + } + + /** + * Wait until the thread finishes + */ + final void wait() + { + if(m_running) + { + version (Tango) + { + m_t.join(); + } + else + { + m_t.wait(); + } + } + } + +protected: + /** + * Protected constructor + */ + this() + { + m_t = new DThread(&threadStart); + } + + /** + * Override this method in class derived from Thread. + */ + void run() + { + if (m_isDelegate) + this.m_dg(this.m_userData); + else + this.m_func(this.m_userData); + } + +private: + DThread m_t; + bool m_isDelegate; + bool m_running; + + union + { + void function(void*) m_func; + void delegate(void*) m_dg; + } + + void* m_userData; + + /* + * Thread entry point + */ + version (Tango) + { + final void threadStart() + { + run(); + m_running = false; + } + } + else + { + final int threadStart() + { + run(); + m_running = false; + return 0; + } + } +} + diff --git a/DSFML/import/dsfml/system/vector2.d b/DSFML/import/dsfml/system/vector2.d new file mode 100644 index 00000000..ae0d3323 --- /dev/null +++ b/DSFML/import/dsfml/system/vector2.d @@ -0,0 +1,160 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.vector2; + +/** +* Vector2 is an utility class for manipulating 2 dimensional +* vectors. Template parameter defines the type of coordinates +* (integer, float, ...) +*/ +struct Vector2(T) +{ + T x; + T y; + + static Vector2 opCall(T x, T y) + { + Vector2!(T) ret; + + ret.x = x; + ret.y = y; + + return ret; + } + + /// unary (-) overload + Vector2 opNeg() + { + return Vector2!(T)(-x, -y); + } + + /// (+=) overload + Vector2 opAddAssign(Vector2 other) + { + x += other.x; + y += other.y; + return *this; + } + + /// (-=) overload + Vector2 opSubAssign(Vector2 other) + { + x -= other.x; + y -= other.y; + return *this; + } + + /// (+) overload + Vector2 opAdd(Vector2 other) + { + return Vector2!(T)( (x + other.x), (y + other.y) ); + } + + /// (-) overload + Vector2 opSub(Vector2 other) + { + return Vector2!(T) ( (x - other.x), (y - other.y) ); + } + + /// (*) overload + Vector2 opMul(int i) + { + return Vector2!(T) ( (x * i), (y * i) ); + } + + /// (*=) overload + Vector2 opMulAssign(int i) + { + x *= i; + y *= i; + return *this; + } + + /// (/) overload + Vector2 opDiv(int i) + { + return Vector2!(T) ( (x / i), (y / i)); + } + + /// (/=) overload + Vector2 opDivAssign(int i) + { + x /= i; + y /= i; + return *this; + } + + /// + int opEquals(Vector2 other) + { + return (x == other.x) && (y == other.y); + } +} + +version (UnitTest) +{ + unittest + { + Vector2f main = Vector2f(10f, 10f); + Vector2f other = Vector2f(10f, 10f); + Vector2f result; + + result = -main; + assert (result == Vector2f(-10.f, -10.f) ); + + result = main; + result += other; + assert (result == Vector2f(20.f, 20.f)); + + result = main; + result -= other; + assert (result == Vector2f(0.f, 0.f)); + + result = main + other; + assert (result == Vector2f(20.f, 20.f)); + + result = main - other; + assert (result == Vector2f(0.f, 0.f)); + + result = main * 10; + assert (result == Vector2f(100.f, 100.f)); + + result *= 2; + assert (result == Vector2f(200.f, 200.f)); + + result = main / 2; + assert (result == Vector2f(5.f, 5.f)); + + result = main; + result /= 2; + assert (result == Vector2f(5.f, 5.f)); + } +} + +/// Aliases +alias Vector2!(float) Vector2f; +/// ditto +alias Vector2!(int) Vector2i; diff --git a/DSFML/import/dsfml/system/vector3.d b/DSFML/import/dsfml/system/vector3.d new file mode 100644 index 00000000..66c3fd80 --- /dev/null +++ b/DSFML/import/dsfml/system/vector3.d @@ -0,0 +1,166 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.system.vector3; + +/** +* Vector3 is an utility class for manipulating 3 dimensional +* vectors. Template parameter defines the type of coordinates +* (integer, float, ...) +*/ +struct Vector3(T) +{ + T x; + T y; + T z; + + static Vector3 opCall(T x, T y, T z) + { + Vector3!(T) ret; + + ret.x = x; + ret.y = y; + ret.z = z; + + return ret; + } + + /// unary (-) overload + Vector3 opNeg() + { + return Vector3!(T)(-x, -y, -z); + } + + /// (+=) overload + Vector3 opAddAssign(Vector3 other) + { + x += other.x; + y += other.y; + z += other.z; + return *this; + } + + /// (-=) overload + Vector3 opSubAssign(Vector3 other) + { + x -= other.x; + y -= other.y; + z -= other.z; + return *this; + } + + /// (+) overload + Vector3 opAdd(Vector3 other) + { + return Vector3!(T)( (x + other.x), (y + other.y), (z + other.z) ); + } + + /// (-) overload + Vector3 opSub(Vector3 other) + { + return Vector3!(T) ( (x - other.x), (y - other.y), (z - other.z) ); + } + + /// (*) overload + Vector3 opMul(int i) + { + return Vector3!(T) ( (x * i), (y * i), (z * i) ); + } + + /// (*=) overload + Vector3 opMulAssign(int i) + { + x *= i; + y *= i; + z *= i; + return *this; + } + + /// (/) overload + Vector3 opDiv(int i) + { + return Vector3!(T) ( (x / i), (y / i), (z / i) ); + } + + /// (/=) overload + Vector3 opDivAssign(int i) + { + x /= i; + y /= i; + z /= i; + return *this; + } + + /// + int opEquals(Vector3 other) + { + return (x == other.x) && (y == other.y) && (z == other.z) ; + } +} + +version (UnitTest) +{ + unittest + { + Vector3f main = Vector3f(10f, 10f, 10.f); + Vector3f other = Vector3f(10f, 10f, 10.f); + Vector3f result; + + result = -main; + assert (result == Vector3f(-10.f, -10.f, -10.f) ); + + result = main; + result += other; + assert (result == Vector3f(20.f, 20.f, 20.f)); + + result = main; + result -= other; + assert (result == Vector3f(0.f, 0.f, 0.f)); + + result = main + other; + assert (result == Vector3f(20.f, 20.f, 20.f)); + + result = main - other; + assert (result == Vector3f(0.f, 0.f, 0.f)); + + result = main * 10; + assert (result == Vector3f(100.f, 100.f, 100.f)); + + result *= 2; + assert (result == Vector3f(200.f, 200.f, 200.f)); + + result = main / 2; + assert (result == Vector3f(5.f, 5.f, 5.f)); + + result = main; + result /= 2; + assert (result == Vector3f(5.f, 5.f, 5.f)); + } +} + +/// Aliases +alias Vector3!(float) Vector3f; +/// ditto +alias Vector3!(int) Vector3i; diff --git a/DSFML/import/dsfml/window/all.d b/DSFML/import/dsfml/window/all.d new file mode 100644 index 00000000..95b1c733 --- /dev/null +++ b/DSFML/import/dsfml/window/all.d @@ -0,0 +1,35 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.all; + +public import + dsfml.window.event, + dsfml.window.input, + dsfml.window.videomode, + dsfml.window.window, + dsfml.window.windowhandle, + dsfml.window.windowsettings, + dsfml.window.windowstyle; diff --git a/DSFML/import/dsfml/window/event.d b/DSFML/import/dsfml/window/event.d new file mode 100644 index 00000000..d597cf97 --- /dev/null +++ b/DSFML/import/dsfml/window/event.d @@ -0,0 +1,329 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.event; + +/** +* Definition of key codes for keyboard events +* +* $(B Possibles values:)$(BR) +* Except letters and numbers, you can use :$(BR) +* * LCONTROL, LSHIFT, LALT, LSYSTEM, RCONTROL, RSHIFT, RALT, RSYSTEM.$(BR) +* * LBRACKET, RBRACKET, SEMICOLON, COMMA, PERIOD, QUOTE, SLASH, BACKSLASH, TILDE, EQUAL, DASH.$(BR) +* * SPACE, RETURN, BACK, TAB, PAGEUP, PAGEDOWN, END, HOME, INSERT, DELETE.$(BR) +* * ADD, SUBTRACT, MULTIPLY, DIVIDE, LEFT, RIGHT, UP, DOWN.$(BR) +* * NUMPAD0, NUMPAD1, NUMPAD2, NUMPAD3, NUMPAD4, NUMPAD5, NUMPAD6, NUMPAD7, NUMPAD8, NUMPAD9.$(BR) +* * F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15.$(BR) +*/ +enum KeyCode +{ + A = 'a', + B = 'b', + C = 'c', + D = 'd', + E = 'e', + F = 'f', + G = 'g', + H = 'h', + I = 'i', + J = 'j', + K = 'k', + L = 'l', + M = 'm', + N = 'n', + O = 'o', + P = 'p', + Q = 'q', + R = 'r', + S = 's', + T = 't', + U = 'u', + V = 'v', + W = 'w', + X = 'x', + Y = 'y', + Z = 'z', + NUM0 = '0', + NUM1 = '1', + NUM2 = '2', + NUM3 = '3', + NUM4 = '4', + NUM5 = '5', + NUM6 = '6', + NUM7 = '7', + NUM8 = '8', + NUM9 = '9', + ESCAPE = 256, + LCONTROL, + LSHIFT, + LALT, + LSYSTEM, + RCONTROL, + RSHIFT, + RALT, + RSYSTEM, + MENU, + LBRACKET, + RBRACKET, + SEMICOLON, + COMMA, + PERIOD, + QUOTE, + SLASH, + BACKSLASH, + TILDE, + EQUAL, + DASH, + SPACE, + RETURN, + BACK, + TAB, + PAGEUP, + PAGEDOWN, + END, + HOME, + INSERT, + DELETE, + ADD, + SUBTRACT, + MULTIPLY, + DIVIDE, + LEFT, + RIGHT, + UP, + DOWN, + NUMPAD0, + NUMPAD1, + NUMPAD2, + NUMPAD3, + NUMPAD4, + NUMPAD5, + NUMPAD6, + NUMPAD7, + NUMPAD8, + NUMPAD9, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + PAUSE, +} + + +/** +* Definition of button codes for mouse events +*/ +enum MouseButtons +{ + LEFT, /// + RIGHT, /// + MIDDLE, /// + XBUTTON1, /// + XBUTTON2 /// +} + + + +/** +* Definition of joystick axis for joystick events +*/ +enum JoyAxis +{ + AXISX, /// + AXISY, /// + AXISZ, /// + AXISR, /// + AXISU, /// + AXISV, /// + AXISPOV /// +} + + + +/** +* Event defines a system event and its parameters +*/ +align(1) struct Event +{ + enum EventType + { + CLOSED, + RESIZED, + LOSTFOCUS, + GAINEDFOCUS, + TEXTENTERED, + KEYPRESSED, + KEYRELEASED, + MOUSEWHEELMOVED, + MOUSEBUTTONPRESSED, + MOUSEBUTTONRELEASED, + MOUSEMOVED, + MOUSEENTERED, + MOUSELEFT, + JOYBUTTONPRESSED, + JOYBUTTONRELEASED, + JOYMOVED + } + + /** + * Enumeration of the different types of events. Accessing a value of another event that the one received (e.g. Event.Size.Width when receiving an KEYPRESSED event) will result in undefined behavior. + * $(UL + * $(LI CLOSED) + * $(LI LOSTFOCUS) + * $(LI GAINEDFOCUS) + * $(LI RESIZED + * $(UL + * $(LI Event.Size.Width : new Width, in pixels.) + * $(LI Event.Size.Height : new height, in pixels.) + * ) + * ) + * $(LI TEXTENTERED + * $(UL + * $(LI Event.Text.Unicode : dchar entered.) + * ) + * ) + * $(LI KEYPRESSED, KEYRELEASED + * $(UL + * $(LI Event.Key.Code : Key code of the key.) + * $(LI Event.Key.Alt : Alt pressed ?) + * $(LI Event.Key.Control : Control pressed ?) + * $(LI Event.Key.Shift : Shift pressed ?) + * ) + * ) + * $(LI MOUSEWHEELMOVED + * $(UL + * $(LI Event.MouseWheel.Delta : Wheel move (positive if forward, negative else.) ) + * ) + * ) + * $(LI MOUSEBUTTONPRESSED, MOUSEBUTTONRELEASED + * $(UL + * $(LI Event.MouseButton.Button : Mouse button pressed.) + * $(LI Event.MouseButton.X : Cursor X position.) + * $(LI Event.MouseButton.Y : Cursor X position.) + * ) + * ) + * $(LI MOUSEMOVED + * $(UL + * $(LI Event.MouseMove.X : Cursor X position. Local coordinates.) + * $(LI Event.MouseMove.Y : Cursor Y position. Local coordinates.) + * ) + * ) + * $(LI MOUSEENTERED) + * $(LI MOUSELEFT) + * $(LI JOYBUTTONPRESSED, JOYBUTTONRELEASED + * $(UL + * $(LI Event.JoyButton.JoystickId : Id of the joystick.) + * $(LI Event.JoyButton.Button : Joystick button pressed.) + * ) + * ) + * $(LI JOYMOVED + * $(UL + * $(LI Event.JoyMove.JoystickId : Id of the joystick.) + * $(LI Event.JoyMove.Axis : Moved axis.) + * $(LI Event.JoyMove.Position : Actual position of the axis [-100, 100], except for POV [0, 360].) + * ) + * ) + * ) + */ + EventType Type; + + union + { + struct SText + { + dchar Unicode; + } + SText Text; + + struct SKey + { + KeyCode Code; + bool Alt; + byte[3] Filler1; + bool Control; + byte[3] Filler2; + bool Shift; + byte[3] Filler3; + } + SKey Key; + + struct SMouseMove + { + int X; + int Y; + } + SMouseMove MouseMove; + + struct SMouseButton + { + MouseButtons Button; + int X; + int Y; + } + SMouseButton MouseButton; + + struct SMouseWheel + { + int Delta; + } + SMouseWheel MouseWheel; + + struct SJoyMove + { + uint JoystickId; + JoyAxis Axis; + float Position; + } + SJoyMove JoyMove; + + struct SJoyButton + { + uint JoystickId; + uint Button; + } + SJoyButton JoyButton; + + struct SSize + { + uint Width; + uint Height; + } + SSize Size; + } +} + + + diff --git a/DSFML/import/dsfml/window/input.d b/DSFML/import/dsfml/window/input.d new file mode 100644 index 00000000..4f115140 --- /dev/null +++ b/DSFML/import/dsfml/window/input.d @@ -0,0 +1,162 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.input; + +import dsfml.system.common; + +import dsfml.window.event; + +/** +* Input handles real-time input from keyboard and mouse. +* Use it instead of events to handle continuous moves and more +* game-friendly inputs +*/ +class Input : DSFMLObject +{ + /** + * Get the state of a key + * + * Params: + * key = Key to check + * + * Returns: + * True if key is down, false if key is up + */ + bool isKeyDown(KeyCode key) + { + return cast(bool)sfInput_IsKeyDown(m_ptr, key); + } + + /** + * Get the state of a mouse button + * + * Params: + * button = Button to check + * + * Returns: + * True if button is down, false if button is up + */ + bool isMouseButtonDown(MouseButtons button) + { + return cast(bool)sfInput_IsMouseButtonDown(m_ptr, button); + } + + /** + * Get the state of a joystick button + * + * Params: + * joyId = Identifier of the joystick to check (0 or 1) + * button = Button to check + * + * Returns: + * True if button is down, false if button is up + */ + bool isJoystickButtonDown(uint joyId, uint button) + { + return cast(bool)sfInput_IsJoystickButtonDown(m_ptr, joyId, button); + } + + /* + * Get the mouse X position + * + * Returns: + * Current mouse left position, relative to owner window + */ + int getMouseX() + { + return sfInput_GetMouseX(m_ptr); + } + + /** + * Get the mouse Y position + * + * Returns: + * Current mouse top position, relative to owner window + * + */ + int getMouseY() + { + return sfInput_GetMouseY(m_ptr); + } + + /** + * Get a joystick axis position + * + * Params: + * joyId = Identifier of the joystick to check (0 or 1) + * axis = Axis to get + * + * Returns: + * Current axis position, in the range [-100, 100] (except for POV, which is [0, 360]) + */ + float getJoystickAxis(uint joyId, JoyAxis axis) + { + return sfInput_GetJoystickAxis(m_ptr, joyId, axis); + } + + this(void* input) + { + super(input, true); + } + + override void dispose() + { + // nothing to do + } + +private: + +// External ==================================================================== + + extern (C) + { + typedef int function(void*, KeyCode) pf_sfInput_IsKeyDown; + typedef int function(void*, MouseButtons) pf_sfInput_IsMouseButtonDown; + typedef int function(void*, uint, uint) pf_sfInput_IsJoystickButtonDown; + typedef uint function (void*) pf_sfInput_GetMouseX; + typedef uint function(void*) pf_sfInput_GetMouseY; + typedef float function(void*, uint, JoyAxis) pf_sfInput_GetJoystickAxis; + + static pf_sfInput_IsKeyDown sfInput_IsKeyDown; + static pf_sfInput_IsMouseButtonDown sfInput_IsMouseButtonDown; + static pf_sfInput_IsJoystickButtonDown sfInput_IsJoystickButtonDown; + static pf_sfInput_GetMouseX sfInput_GetMouseX; + static pf_sfInput_GetMouseY sfInput_GetMouseY; + static pf_sfInput_GetJoystickAxis sfInput_GetJoystickAxis; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-window"); + + sfInput_IsKeyDown = cast(pf_sfInput_IsKeyDown)dll.getSymbol("sfInput_IsKeyDown"); + sfInput_IsMouseButtonDown = cast(pf_sfInput_IsMouseButtonDown)dll.getSymbol("sfInput_IsMouseButtonDown"); + sfInput_IsJoystickButtonDown = cast(pf_sfInput_IsJoystickButtonDown)dll.getSymbol("sfInput_IsJoystickButtonDown"); + sfInput_GetMouseX = cast(pf_sfInput_GetMouseX)dll.getSymbol("sfInput_GetMouseX"); + sfInput_GetMouseY = cast(pf_sfInput_GetMouseY)dll.getSymbol("sfInput_GetMouseY"); + sfInput_GetJoystickAxis = cast(pf_sfInput_GetJoystickAxis)dll.getSymbol("sfInput_GetJoystickAxis"); + } +} diff --git a/DSFML/import/dsfml/window/videomode.d b/DSFML/import/dsfml/window/videomode.d new file mode 100644 index 00000000..6efd495a --- /dev/null +++ b/DSFML/import/dsfml/window/videomode.d @@ -0,0 +1,136 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.videomode; + +import dsfml.system.common; + +/** +* VideoMode defines a video mode (width, height, bpp, frequency) +* and provides static functions for getting modes supported +* by the display device +*/ +align(1) struct VideoMode +{ + static VideoMode opCall(uint width, uint height, uint bitsPerPixel = 32) + { + VideoMode mode; + mode.Width = width; + mode.Height = height; + mode.BitsPerPixel = bitsPerPixel; + return mode; + } + /** + * Get the current desktop video mode + * + * Returns: + * Current desktop video mode + */ + static VideoMode getDesktopMode() + { + return sfVideoMode_GetDesktopMode(); + } + + /** + * Get a valid video mode + * Index must be in range [0, GetModesCount()[ + * Modes are sorted from best to worst + * + * Params: + * index = Index of video mode to get + * + * Returns: + * Corresponding video mode (invalid mode if index is out of range) + */ + static VideoMode getMode(size_t index) + { + return sfVideoMode_GetMode(index); + } + + /** + * Get valid video modes count + * + * Returns: + * Number of valid video modes available + */ + static size_t getModesCount() + { + return sfVideoMode_GetModesCount(); + } + + /** + * Tell whether or not the video mode is supported + * + * Returns: + * True if video mode is supported, false otherwise + */ + bool isValid() + { + return cast(bool)sfVideoMode_IsValid(*this); + } + + /** + * Comparison operator overload -- tell if two video modes are equal + * + * Params: + * Other : Video mode to compare + * + * Returns: + * True if modes are equal + */ + bool opEquals(VideoMode other) + { + return ((other.Width == Width) && (other.Height == Height) && (other.BitsPerPixel == BitsPerPixel)); + } + + uint Width; /// Video mode width, in pixels + uint Height; /// Video mode height, in pixels + uint BitsPerPixel; /// Video mode pixel depth, in bits per pixels +} + +extern (C) +{ + typedef VideoMode function() pf_sfVideoMode_GetDesktopMode; + typedef VideoMode function(size_t) pf_sfVideoMode_GetMode; + typedef size_t function() pf_sfVideoMode_GetModesCount; + typedef int function(VideoMode) pf_sfVideoMode_IsValid; + + pf_sfVideoMode_GetDesktopMode sfVideoMode_GetDesktopMode; + pf_sfVideoMode_GetMode sfVideoMode_GetMode; + pf_sfVideoMode_GetModesCount sfVideoMode_GetModesCount; + pf_sfVideoMode_IsValid sfVideoMode_IsValid; +} + +static this() +{ + DllLoader dll = DllLoader.load("csfml-window"); + + sfVideoMode_GetDesktopMode = cast(pf_sfVideoMode_GetDesktopMode)dll.getSymbol("sfVideoMode_GetDesktopMode"); + sfVideoMode_GetMode = cast(pf_sfVideoMode_GetMode)dll.getSymbol("sfVideoMode_GetMode"); + sfVideoMode_GetModesCount = cast(pf_sfVideoMode_GetModesCount)dll.getSymbol("sfVideoMode_GetModesCount"); + sfVideoMode_IsValid = cast(pf_sfVideoMode_IsValid)dll.getSymbol("sfVideoMode_IsValid"); +} + + diff --git a/DSFML/import/dsfml/window/window.d b/DSFML/import/dsfml/window/window.d new file mode 100644 index 00000000..15f6c41a --- /dev/null +++ b/DSFML/import/dsfml/window/window.d @@ -0,0 +1,435 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.window; + +import dsfml.window.event; +import dsfml.window.input; +import dsfml.window.videomode; +import dsfml.window.windowhandle; +import dsfml.window.windowsettings; +import dsfml.window.windowstyle; + +import dsfml.system.common; +import dsfml.system.stringutil; + +/** +* Window is a rendering window ; it can create a new window +* or connect to an existing one +*/ +class Window : DSFMLObject +{ + /** + * Construct a new window + * + * Params: + * mode = Video mode to use + * title = Title of the window + * windowStyle = Window style (Resize | Close by default) + * settings = Window settings (default is default WindowSettings values) + */ + this(VideoMode mode, char[] title, Style windowStyle = Style.RESIZE | Style.CLOSE, WindowSettings settings = WindowSettings()) + { + super(sfWindow_Create(mode, toStringz(title), windowStyle, settings)); + } + + /** + * Construct the window from an existing control + * + * Params: + * handle = Platform-specific handle of the control + * settings = Window settings (default is default WindowSettings values) + */ + this(WindowHandle handle, WindowSettings settings = WindowSettings()) + { + super(sfWindow_CreateFromHandle(handle, settings)); + } + + override void dispose() + { + m_input = null; + sfWindow_Destroy(m_ptr); + } + + /** + * Create (or recreate) the window + * + * Input created with getInput becomes invalid. + * + * Params: + * mode = Video mode to use + * title = Title of the window + * windowStyle = Window style (Resize | Close by default) + * settings = Window settings (default is default WindowSettings values) + */ + void create(VideoMode mode, char[] title, Style windowStyle = Style.RESIZE | Style.CLOSE, WindowSettings settings = WindowSettings()) + { + if (m_ptr !is null) + dispose(); + + m_ptr = sfWindow_Create(mode, toStringz(title), windowStyle, settings); + } + + /** + * Create (or recreate) the window from an existing control + * + * Input created with getInput becomes invalid. + * + * Params: + * handle = Platform-specific handle of the control + * settings = Window settings (default is default WindowSettings values) + */ + void create(WindowHandle handle, WindowSettings settings = WindowSettings()) + { + if (m_ptr !is null) + dispose(); + + m_ptr = sfWindow_CreateFromHandle(handle, settings); + } + + /** + * Close (destroy) the window. + * You can call create to recreate a valid window + */ + void close() + { + sfWindow_Close(m_ptr); + } + + /** + * Tell whether or not a window is opened + * + * Returns: + * True if window is currently open. + */ + bool isOpened() + { + return cast(bool)sfWindow_IsOpened(m_ptr); + } + /** + * Get the width of the rendering region of the window + * + * Returns: + * Width in pixels + */ + uint getWidth() + { + return sfWindow_GetWidth(m_ptr); + } + + /** + * Get the height of the rendering region of the window + * + * Returns: + * Height in pixels + */ + uint getHeight() + { + return sfWindow_GetHeight(m_ptr); + } + + /** + * Get the creation settings of a window + * + * Returns: + * Settings used to create the window + */ + WindowSettings getSettings() + { + return sfWindow_GetSettings(m_ptr); + } + + + /** + * Get the event on top of events stack, if any, and pop it + * + * Params: + * eventReceived = Event to fill, if any + * + * Returns: + * True if an event was returned, false if events stack was empty + */ + bool getEvent(ref Event eventReceived) + { + return cast(bool)sfWindow_GetEvent(m_ptr, &eventReceived); + } + + /** + * Enable / disable vertical synchronization + * + * Params: + * enabled : True to enable v-sync, false to deactivate + */ + void useVerticalSync(bool enabled) + { + sfWindow_UseVerticalSync(m_ptr, enabled); + } + + /** + * Show or hide the mouse cursor + * + * Params: + * show : True to show, false to hide + */ + void showMouseCursor(bool show) + { + sfWindow_ShowMouseCursor(m_ptr, show); + } + + /** + * Change the position of the mouse cursor + * + * Params: + * left = Left coordinate of the cursor, relative to the window + * top = Top coordinate of the cursor, relative to the window + */ + void setCursorPosition(uint left, uint top) + { + sfWindow_SetCursorPosition(m_ptr, left, top); + } + + /** + * Change the position of the window on screen. + * Only works for top-level windows + * + * Params: + * left = Left position + * top = Top position + */ + void setPosition(int left, int top) + { + sfWindow_SetPosition(m_ptr, left, top); + } + + /** + * change the size of the rendering region of the window + * + * Params: + * width : new width + * height : new height + */ + void setSize(uint width, uint height) + { + sfWindow_SetSize(m_ptr, width, height); + } + + /** + * Show or hide the window + * + * Params: + * state = True to show, false to hide + * + */ + void show(bool state) + { + sfWindow_Show(m_ptr, state); + } + + /** + * Enable or disable automatic key-repeat for keydown events. + * Automatic key-repeat is enabled by default. + * + * Params: + * enabled = true to enable, false to disable + */ + void enableKeyRepeat(bool enabled) + { + sfWindow_EnableKeyRepeat(m_ptr, enabled); + } + + /** + * Change the window's icon + * + * Params: + * width = Icon's width, in pixels + * height = Icon's height, in pixels + * data = array of pixels in memory, format must be RGBA 32 bits + * + */ + void setIcon(size_t width, size_t height, ubyte[] data) + { + sfWindow_SetIcon(m_ptr, width, height, data.ptr); + } + + /** + * Set the window as the current target for rendering + * + * Params: + * active = True to activate, false to deactivate + * Returns: + * True if operation was successful, false otherwise + */ + bool setActive(bool active = true) + { + return cast(bool)sfWindow_SetActive(m_ptr, active); + } + + /** + * Display the window on screen + */ + void display() + { + sfWindow_Display(m_ptr); + } + + /** + * Get the input manager of the window + * + * Returns: + * An input manager + * See_Also : + * Input + */ + Input getInput() + { + if (m_input is null) + m_input = new Input(sfWindow_GetInput(m_ptr)); + return m_input; + } + + /** + * Limit the framerate to a maximum fixed frequency + * + * Params: + * limit : Framerate limit, in frames per seconds (use 0 to disable limit) + */ + void setFramerateLimit(uint limit) + { + sfWindow_SetFramerateLimit(m_ptr, limit); + } + + /** + * Get time elapsed since last frame + * + * Returns: + * Time elapsed, in seconds + */ + float getFrameTime() + { + return sfWindow_GetFrameTime(m_ptr); + } + + /** + * Change the joystick threshold, ie. the value below which + * no move event will be generated + * + * Params: + * threshold : New threshold, in range [0, 100] + */ + void setJoystickThreshold(float threshold) + { + sfWindow_SetJoystickThreshold(m_ptr, threshold); + } + +protected: + this(void* ptr) + { + super(ptr); + } + + Input m_input; +private: + +// External ==================================================================== + extern (C) + { + typedef void* function(VideoMode, char*, uint, WindowSettings) pf_sfWindow_Create; + typedef void* function(WindowHandle, WindowSettings) pf_sfWindow_CreateFromHandle; + typedef void function(void*) pf_sfWindow_Destroy; + typedef void function(void*) pf_sfWindow_Close; + typedef int function(void*) pf_sfWindow_IsOpened; + typedef uint function(void*) pf_sfWindow_GetWidth; + typedef uint function(void*) pf_sfWindow_GetHeight; + typedef WindowSettings function(void* Window) pf_sfWindow_GetSettings; + typedef int function(void*, Event*) pf_sfWindow_GetEvent; + typedef void function(void*, int) pf_sfWindow_UseVerticalSync; + typedef void function(void*, int) pf_sfWindow_ShowMouseCursor; + typedef void function(void*, uint, uint) pf_sfWindow_SetCursorPosition; + typedef void function(void*, int, int) pf_sfWindow_SetPosition; + typedef void function(void*, uint, uint) pf_sfWindow_SetSize; + typedef void function(void*, int) pf_sfWindow_Show; + typedef void function(void*, int) pf_sfWindow_EnableKeyRepeat; + typedef void function(void*, size_t, size_t, ubyte*) pf_sfWindow_SetIcon; + typedef int function(void*, int) pf_sfWindow_SetActive; + typedef void function(void*) pf_sfWindow_Display; + typedef void* function(void*) pf_sfWindow_GetInput; + typedef void function(void*, uint) pf_sfWindow_SetFramerateLimit; + typedef float function(void*) pf_sfWindow_GetFrameTime; + typedef void function(void*, float) pf_sfWindow_SetJoystickThreshold; + + static pf_sfWindow_Create sfWindow_Create; + static pf_sfWindow_CreateFromHandle sfWindow_CreateFromHandle; + static pf_sfWindow_Destroy sfWindow_Destroy; + static pf_sfWindow_Close sfWindow_Close; + static pf_sfWindow_IsOpened sfWindow_IsOpened; + static pf_sfWindow_GetWidth sfWindow_GetWidth; + static pf_sfWindow_GetHeight sfWindow_GetHeight; + static pf_sfWindow_GetSettings sfWindow_GetSettings; + static pf_sfWindow_GetEvent sfWindow_GetEvent; + static pf_sfWindow_UseVerticalSync sfWindow_UseVerticalSync; + static pf_sfWindow_ShowMouseCursor sfWindow_ShowMouseCursor; + static pf_sfWindow_SetCursorPosition sfWindow_SetCursorPosition; + static pf_sfWindow_SetPosition sfWindow_SetPosition; + static pf_sfWindow_SetSize sfWindow_SetSize; + static pf_sfWindow_Show sfWindow_Show; + static pf_sfWindow_EnableKeyRepeat sfWindow_EnableKeyRepeat; + static pf_sfWindow_SetIcon sfWindow_SetIcon; + static pf_sfWindow_SetActive sfWindow_SetActive; + static pf_sfWindow_Display sfWindow_Display; + static pf_sfWindow_GetInput sfWindow_GetInput; + static pf_sfWindow_SetFramerateLimit sfWindow_SetFramerateLimit; + static pf_sfWindow_GetFrameTime sfWindow_GetFrameTime; + static pf_sfWindow_SetJoystickThreshold sfWindow_SetJoystickThreshold; + } + + static this() + { + DllLoader dll = DllLoader.load("csfml-window"); + + sfWindow_Create = cast(pf_sfWindow_Create)dll.getSymbol("sfWindow_Create"); + sfWindow_CreateFromHandle = cast(pf_sfWindow_CreateFromHandle)dll.getSymbol("sfWindow_CreateFromHandle"); + sfWindow_Destroy = cast(pf_sfWindow_Destroy)dll.getSymbol("sfWindow_Destroy"); + sfWindow_Close = cast(pf_sfWindow_Close)dll.getSymbol("sfWindow_Close"); + sfWindow_IsOpened = cast(pf_sfWindow_IsOpened)dll.getSymbol("sfWindow_IsOpened"); + sfWindow_GetWidth = cast(pf_sfWindow_GetWidth)dll.getSymbol("sfWindow_GetWidth"); + sfWindow_GetHeight = cast(pf_sfWindow_GetHeight)dll.getSymbol("sfWindow_GetHeight"); + sfWindow_GetSettings = cast(pf_sfWindow_GetSettings)dll.getSymbol("sfWindow_GetSettings"); + sfWindow_GetEvent = cast(pf_sfWindow_GetEvent)dll.getSymbol("sfWindow_GetEvent"); + sfWindow_UseVerticalSync = cast(pf_sfWindow_UseVerticalSync)dll.getSymbol("sfWindow_UseVerticalSync"); + sfWindow_ShowMouseCursor = cast(pf_sfWindow_ShowMouseCursor)dll.getSymbol("sfWindow_ShowMouseCursor"); + sfWindow_SetCursorPosition = cast(pf_sfWindow_SetCursorPosition)dll.getSymbol("sfWindow_SetCursorPosition"); + sfWindow_SetPosition = cast(pf_sfWindow_SetPosition)dll.getSymbol("sfWindow_SetPosition"); + sfWindow_SetSize = cast(pf_sfWindow_SetSize)dll.getSymbol("sfWindow_SetSize"); + sfWindow_Show = cast(pf_sfWindow_Show)dll.getSymbol("sfWindow_Show"); + sfWindow_EnableKeyRepeat = cast(pf_sfWindow_EnableKeyRepeat)dll.getSymbol("sfWindow_EnableKeyRepeat"); + sfWindow_SetIcon = cast(pf_sfWindow_SetIcon)dll.getSymbol("sfWindow_SetIcon"); + sfWindow_SetActive = cast(pf_sfWindow_SetActive)dll.getSymbol("sfWindow_SetActive"); + sfWindow_Display = cast(pf_sfWindow_Display)dll.getSymbol("sfWindow_Display"); + sfWindow_GetInput = cast(pf_sfWindow_GetInput)dll.getSymbol("sfWindow_GetInput"); + sfWindow_SetFramerateLimit = cast(pf_sfWindow_SetFramerateLimit)dll.getSymbol("sfWindow_SetFramerateLimit"); + sfWindow_GetFrameTime = cast(pf_sfWindow_GetFrameTime)dll.getSymbol("sfWindow_GetFrameTime"); + sfWindow_SetJoystickThreshold = cast(pf_sfWindow_SetJoystickThreshold)dll.getSymbol("sfWindow_SetJoystickThreshold"); + } +} diff --git a/DSFML/import/dsfml/window/windowhandle.d b/DSFML/import/dsfml/window/windowhandle.d new file mode 100644 index 00000000..fad6c9a5 --- /dev/null +++ b/DSFML/import/dsfml/window/windowhandle.d @@ -0,0 +1,42 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.windowhandle; + +/** +* Define a low-level window handle type, specific to +* each platform +*/ +version(Windows) +{ + // Windows defines a void* handle (HWND) + typedef void* WindowHandle; +} +else version(linux) +{ + // Unix - X11 defines an unsigned integer handle (Window) + typedef ulong WindowHandle; +} + diff --git a/DSFML/import/dsfml/window/windowsettings.d b/DSFML/import/dsfml/window/windowsettings.d new file mode 100644 index 00000000..002f1d16 --- /dev/null +++ b/DSFML/import/dsfml/window/windowsettings.d @@ -0,0 +1,48 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.windowsettings; + +/** +* Structure defining the creation settings of windows +*/ +struct WindowSettings +{ + /// + static WindowSettings opCall(uint depth = 24, uint stencil = 8, uint antialiasing = 0) + { + WindowSettings ret; + + ret.DepthBits = depth; + ret.StencilBits = stencil; + ret.AntialiasingLevel = antialiasing; + + return ret; + } + + uint DepthBits; /// Bits of the depth buffer + uint StencilBits; /// Bits of the stencil buffer + uint AntialiasingLevel; /// Level of antialiasing +} diff --git a/DSFML/import/dsfml/window/windowstyle.d b/DSFML/import/dsfml/window/windowstyle.d new file mode 100644 index 00000000..5966ab61 --- /dev/null +++ b/DSFML/import/dsfml/window/windowstyle.d @@ -0,0 +1,38 @@ +/* +* DSFML - SFML Library binding in D language. +* Copyright (C) 2008 Julien Dagorn (sirjulio13@gmail.com) +* +* This software is provided 'as-is', without any express or +* implied warranty. In no event will the authors be held +* liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute +* it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; +* you must not claim that you wrote the original software. +* If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but +* is not required. +* +* 2. Altered source versions must be plainly marked as such, +* and must not be misrepresented as being the original software. +* +* 3. This notice may not be removed or altered from any +* source distribution. +*/ + +module dsfml.window.windowstyle; + +/** +* Window style +*/ +enum Style +{ + NONE = 0, /// No border / title bar (this flag and all others are mutually exclusive) + TITLEBAR = 1 << 0, /// Title bar + fixed border + RESIZE = 1 << 1, /// Titlebar + resizable border + maximize button + CLOSE = 1 << 2, /// Titlebar + close button + FULLSCREEN = 1 << 3 /// Fullscreen mode (this flag and all others are mutually exclusive) +} diff --git a/DSFML/import/dsss.conf b/DSFML/import/dsss.conf new file mode 100644 index 00000000..e9ea3a76 --- /dev/null +++ b/DSFML/import/dsss.conf @@ -0,0 +1,46 @@ +name=dsfml + +[dsfml/audio] +type = library +target = dsfml-audio +version (Windows){ + postbuild += copy "dsfml-audio.lib" "../lib/dsfml-audio.lib" +} else version (linux){ + postbuild += cp -f "libdsfml-audio.a" "../lib/libdsfml-audio.a" +} + +[dsfml/network] +type = library +target = dsfml-network +version (Windows){ + postbuild += copy "dsfml-network.lib" "../lib/dsfml-network.lib" +} else version (linux){ + postbuild += cp -f "libdsfml-network.a" "../lib/libdsfml-network.a" +} + +[dsfml/graphics] +type = library +target = dsfml-graphics +version (Windows){ + postbuild += copy "dsfml-graphics.lib" "../lib/dsfml-graphics.lib" +} else version (linux){ + postbuild += cp -f "libdsfml-graphics.a" "../lib/libdsfml-graphics.a" +} + +[dsfml/system] +type = library +target = dsfml-system +version (Windows){ + postbuild += copy "dsfml-system.lib" "../lib/dsfml-system.lib" +} else version (linux){ + postbuild += cp -f "libdsfml-system.a" "../lib/libdsfml-system.a" +} + +[dsfml/window] +type = library +target = dsfml-window +version (Windows){ + postbuild += copy "dsfml-window.lib" "../lib/dsfml-window.lib" +} else version (linux){ + postbuild += cp -f "libdsfml-window.a" "../lib/libdsfml-window.a" +} diff --git a/DSFML/samples/dsfml/bin/Data/background.jpg b/DSFML/samples/dsfml/bin/Data/background.jpg new file mode 100644 index 00000000..c778e86b Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/background.jpg differ diff --git a/DSFML/samples/dsfml/bin/Data/ball.tga b/DSFML/samples/dsfml/bin/Data/ball.tga new file mode 100644 index 00000000..e5103c84 Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/ball.tga differ diff --git a/DSFML/samples/dsfml/bin/Data/ball.wav b/DSFML/samples/dsfml/bin/Data/ball.wav new file mode 100644 index 00000000..8b3cfbad Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/ball.wav differ diff --git a/DSFML/samples/dsfml/bin/Data/bluerallyecarleft.bmp b/DSFML/samples/dsfml/bin/Data/bluerallyecarleft.bmp new file mode 100644 index 00000000..afd8c94a Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/bluerallyecarleft.bmp differ diff --git a/DSFML/samples/dsfml/bin/Data/bluerallyecarright.bmp b/DSFML/samples/dsfml/bin/Data/bluerallyecarright.bmp new file mode 100644 index 00000000..07d839b9 Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/bluerallyecarright.bmp differ diff --git a/DSFML/samples/dsfml/bin/Data/blur.sfx b/DSFML/samples/dsfml/bin/Data/blur.sfx new file mode 100644 index 00000000..04bfec53 --- /dev/null +++ b/DSFML/samples/dsfml/bin/Data/blur.sfx @@ -0,0 +1,16 @@ +texture framebuffer +float offset + +effect +{ + vec2 offx = vec2(offset, 0.0); + vec2 offy = vec2(0.0, offset); + + vec4 c0 = framebuffer(_in); + vec4 c1 = framebuffer(_in - offy); + vec4 c2 = framebuffer(_in + offy); + vec4 c3 = framebuffer(_in - offx); + vec4 c4 = framebuffer(_in + offx); + + _out = c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2; +} diff --git a/DSFML/samples/dsfml/bin/Data/car_idle.wav b/DSFML/samples/dsfml/bin/Data/car_idle.wav new file mode 100644 index 00000000..51a55f89 Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/car_idle.wav differ diff --git a/DSFML/samples/dsfml/bin/Data/cheeseburger.ttf b/DSFML/samples/dsfml/bin/Data/cheeseburger.ttf new file mode 100644 index 00000000..47704266 Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/cheeseburger.ttf differ diff --git a/DSFML/samples/dsfml/bin/Data/colorize.sfx b/DSFML/samples/dsfml/bin/Data/colorize.sfx new file mode 100644 index 00000000..bcb48ebc --- /dev/null +++ b/DSFML/samples/dsfml/bin/Data/colorize.sfx @@ -0,0 +1,10 @@ +texture framebuffer +vec3 color + +effect +{ + vec4 pixel = framebuffer(_in); + float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; + + _out = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; +} diff --git a/DSFML/samples/dsfml/bin/Data/crosshair.bmp b/DSFML/samples/dsfml/bin/Data/crosshair.bmp new file mode 100644 index 00000000..b1532f1c Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/crosshair.bmp differ diff --git a/DSFML/samples/dsfml/bin/Data/crosshair.tga b/DSFML/samples/dsfml/bin/Data/crosshair.tga new file mode 100644 index 00000000..8b79c295 Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/crosshair.tga differ diff --git a/DSFML/samples/dsfml/bin/Data/fisheye.sfx b/DSFML/samples/dsfml/bin/Data/fisheye.sfx new file mode 100644 index 00000000..cbc31ee7 --- /dev/null +++ b/DSFML/samples/dsfml/bin/Data/fisheye.sfx @@ -0,0 +1,12 @@ +texture framebuffer +vec2 mouse + +effect +{ + float len = distance(_in, mouse) * 7.0; + + if (len < 1.0) + _out = framebuffer(_in + (_in - mouse) * len); + else + _out = framebuffer(_in); +} diff --git a/DSFML/samples/dsfml/bin/Data/nothing.sfx b/DSFML/samples/dsfml/bin/Data/nothing.sfx new file mode 100644 index 00000000..133b4e31 --- /dev/null +++ b/DSFML/samples/dsfml/bin/Data/nothing.sfx @@ -0,0 +1,6 @@ +texture framebuffer + +effect +{ + _out = framebuffer(_in); +} diff --git a/DSFML/samples/dsfml/bin/Data/paddle.tga b/DSFML/samples/dsfml/bin/Data/paddle.tga new file mode 100644 index 00000000..34bd6b84 Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/paddle.tga differ diff --git a/DSFML/samples/dsfml/bin/Data/wave.jpg b/DSFML/samples/dsfml/bin/Data/wave.jpg new file mode 100644 index 00000000..cd125b8c Binary files /dev/null and b/DSFML/samples/dsfml/bin/Data/wave.jpg differ diff --git a/DSFML/samples/dsfml/bin/Data/wave.sfx b/DSFML/samples/dsfml/bin/Data/wave.sfx new file mode 100644 index 00000000..49b46071 --- /dev/null +++ b/DSFML/samples/dsfml/bin/Data/wave.sfx @@ -0,0 +1,12 @@ +texture framebuffer +texture wave +vec2 offset + +effect +{ + vec2 texoffset = wave(_in * offset).xy; + texoffset -= vec2(0.5, 0.5); + texoffset *= 0.05; + + _out = framebuffer(_in + texoffset); +} diff --git a/DSFML/samples/dsfml/bin/libsndfile-1.dll b/DSFML/samples/dsfml/bin/libsndfile-1.dll new file mode 100644 index 00000000..f112de2b Binary files /dev/null and b/DSFML/samples/dsfml/bin/libsndfile-1.dll differ diff --git a/DSFML/samples/dsfml/bin/openal32.dll b/DSFML/samples/dsfml/bin/openal32.dll new file mode 100644 index 00000000..28eb8e5b Binary files /dev/null and b/DSFML/samples/dsfml/bin/openal32.dll differ diff --git a/DSFML/samples/dsfml/dfl/DFLSample.d b/DSFML/samples/dsfml/dfl/DFLSample.d new file mode 100644 index 00000000..995859da --- /dev/null +++ b/DSFML/samples/dsfml/dfl/DFLSample.d @@ -0,0 +1,230 @@ +module dflsample; + +import dsfml.system.all; +import dsfml.window.all; + +// DFL and Derelict must be present. +import dfl.all; + +import Derelict.opengl.gl; +import Derelict.opengl.glu; + + +// An enum for each controls methods +enum ControlMethod +{ + MOUSE, + KEYBOARD +} + +void main() +{ + DerelictGL.load(); + DerelictGLU.load(); + //Start the message loop + Application.run(new MyForm()); +} + +//A simple form with a groupbox to choose input method and the openGL control +class MyForm : Form +{ + GLControl m_gl; + GroupBox m_gbx; + RadioButton m_rb1; + RadioButton m_rb2; + + this() + { + m_gbx = new GroupBox(); + m_gbx.dock = DockStyle.TOP; + m_gbx.height = 40; + m_gbx.text = "Choose your input"; + this.controls.add(m_gbx); + + m_rb1 = new RadioButton(); + m_rb1.text = "Mouse"; + m_rb1.location = Point(10, 15); + m_rb1.checked = true; + m_rb1.click ~= &radioButtonClick; + m_gbx.controls.add(m_rb1); + + m_rb2 = new RadioButton(); + m_rb2.text = "Keyboard"; + m_rb2.location = Point(m_rb1.width + 10, 15); + m_rb2.click ~= &radioButtonClick; + m_gbx.controls.add(m_rb2); + + m_gl = new GLControl(); + m_gl.dock = DockStyle.FILL; + m_gl.controlMethod = ControlMethod.MOUSE; + this.controls.add(m_gl); + + this.text = "DFL Opengl Integration Sample"; + } + + private void radioButtonClick(Control c, EventArgs ea) + { + m_gl.controlMethod(c.text == "Mouse" ? ControlMethod.MOUSE : ControlMethod.KEYBOARD); + m_gl.focus(); + } + +} + +//Our OpenGL control +class GLControl : Control +{ + Window m_win; + Input i; + Timer m_timer; + GLfloat rotx = 0.f, roty = 0.f; + ControlMethod m_method = ControlMethod.MOUSE; + + this () + { + super(); + this.setStyle(ControlStyles.SELECTABLE | ControlStyles.ALL_PAINTING_IN_WM_PAINT | ControlStyles.WANT_ALL_KEYS, true); + + //We set a timer to ensure periodic refresh of the window + m_timer = new Timer(); + m_timer.interval(10); + m_timer.tick ~= &this.onTick; + + } + + public void controlMethod(ControlMethod m) + { + m_method = m; + } + + //Override of the onHandleCreated method of Control + //integration of DSFML window in a control need a valid handle + protected void onHandleCreated(EventArgs ea) + { + super.onHandleCreated(ea); + + //Construction of the window + m_win = new Window(cast(WindowHandle)this.handle); + + //Get the input for further use + i = m_win.getInput(); + + //Now that the Window is instanciated, we can start the timer. + m_timer.start(); + + //Some opengl initializations functions + glClearDepth(1.f); + glClearColor(0.f, 0.f, 0.f, 0.f); + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90.f, 1.f, 1.f, 500.f); + } + + //We handle Mouse leaving and entering the control to hide or show the cursor + protected void onMouseEnter(MouseEventArgs mea) + { + super.onMouseEnter(mea); + Cursor.current.hide(); + } + + protected void onMouseLeave(MouseEventArgs mea) + { + super.onMouseLeave(mea); + Cursor.current.show(); + } + + //If the window is resize, we need to modify openGL view + protected void onResize(EventArgs ea) + { + super.onResize(ea); + glViewport(0, 0, this.width, this.height); + } + + protected void onTick(Timer t, EventArgs ea) + { + draw(); + } + + protected void onPaint(PaintEventArgs pea) + { + super.onPaint(pea); + draw(); + } + + private void handleKeys() + { + if (i.isKeyDown(KeyCode.UP)) + rotx += 1.f; + if (i.isKeyDown(KeyCode.DOWN)) + rotx += -1.f; + if (i.isKeyDown(KeyCode.LEFT)) + roty += -1.f; + if (i.isKeyDown(KeyCode.RIGHT)) + roty += 1.f; + + } + private void handleMousePos() + { + rotx = i.getMouseY() - (this.height / 2.0); + roty = i.getMouseX() - (this.width / 2.0); + } + + private void draw() + { + if (m_method == ControlMethod.KEYBOARD) + handleKeys(); + else + handleMousePos(); + + m_win.setActive(true); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.f, 0.f, -200.f); + glRotatef(rotx, 1.f, 0.f, 0.f); + glRotatef(roty, 0.f, 1.f, 0.f); + + glBegin(GL_QUADS); + glColor3f(1.f, 0.f, 0.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, -50.f); + glVertex3f( 50.f, -50.f, -50.f); + + glColor3f(0.f, 1.f, 0.f); + glVertex3f(-50.f, -50.f, 50.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f( 50.f, 50.f, 50.f); + glVertex3f( 50.f, -50.f, 50.f); + + glColor3f(0.f, 0.f, 1.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f(-50.f, -50.f, 50.f); + + glColor3f(1.f, 1.f, 0.f); + glVertex3f(50.f, -50.f, -50.f); + glVertex3f(50.f, 50.f, -50.f); + glVertex3f(50.f, 50.f, 50.f); + glVertex3f(50.f, -50.f, 50.f); + + glColor3f(1.f, 0.f, 1.f); + glVertex3f(-50.f, -50.f, 50.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f( 50.f, -50.f, -50.f); + glVertex3f( 50.f, -50.f, 50.f); + + glColor3f(0.f, 1.f, 1.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, 50.f); + glEnd(); + + m_win.display(); + } +} diff --git a/DSFML/samples/dsfml/dsss.conf b/DSFML/samples/dsfml/dsss.conf new file mode 100644 index 00000000..17fe1efc --- /dev/null +++ b/DSFML/samples/dsfml/dsss.conf @@ -0,0 +1,33 @@ +[*] +buildflags += -I../../import -Ivoip + +[pong/pong.d] +target = bin/pong + +[postFX/postFX.d] +target = bin/postFX + +[socket/socketclient.d] +target = bin/client + +[socket/socketserver.d] +target = bin/server + +[sound3d/sound3d.d] +target = bin/sound3d + +[soundstream/soundstream.d] +target = bin/soundstream + +[view/view.d] +target = bin/view + +[voip/entry.d] +target = bin/voip + +version (Windows){ + version (DFL){ + [dfl/dflsample.d] + target = bin/dflSample + } +} diff --git a/DSFML/samples/dsfml/pong/pong.d b/DSFML/samples/dsfml/pong/pong.d new file mode 100644 index 00000000..603a9011 --- /dev/null +++ b/DSFML/samples/dsfml/pong/pong.d @@ -0,0 +1,183 @@ +module pong; + +import dsfml.system.all; +import dsfml.audio.all; +import dsfml.window.all; +import dsfml.graphics.all; + +version (Tango) +{ + import tango.io.Stdout; + import tango.math.Math; +} +else +{ + import std.math; +} + +void main() +{ + // Defines PI + const float PI = 3.14159f; + + // Create the window of the application + RenderWindow app = new RenderWindow(VideoMode(800, 600, 32), "SFML Pong"); + + app.useVerticalSync(true); + + Input i = app.getInput(); + + // Load the sounds used in the game + Sound BallSound = new Sound(new SoundBuffer("Data/ball.wav")); + + // Load the images used in the game + Image PaddleImage = new Image("Data/paddle.tga"); + Image BallImage = new Image("Data/ball.tga"); + + + // Initialize the end text + String End = new String(""c); + Font font = new Font("Data/cheeseburger.ttf"); + End.setFont(font); + End.setSize(60.f); + End.move(150.f, 200.f); + End.setColor(Color(50, 50, 250)); + + // Create the sprites of the background, the paddles and the ball + Sprite LeftPaddle = new Sprite(PaddleImage); + Sprite RightPaddle = new Sprite(PaddleImage); + Sprite Ball = new Sprite(BallImage); + + LeftPaddle.move(10, (app.getView().getRect().getHeight() - LeftPaddle.getSize().y) / 2); + RightPaddle.move(app.getView().getRect().getWidth() - RightPaddle.getSize().x - 10, (app.getView().getRect().getHeight() - RightPaddle.getSize().y) / 2); + Ball.move((app.getView().getRect().getWidth() - Ball.getSize().x) / 2, (app.getView().getRect().getHeight() - Ball.getSize().y) / 2); + + // Define the paddles properties + Clock AITimer = new Clock(); + const float AITime = 0.1f; + float LeftPaddleSpeed = 400.f; + float RightPaddleSpeed = 400.f; + + // Define the ball properties + float BallSpeed = 400.f; + float BallAngle = 0.f; + do + { + // Make sure the ball initial angle is not too much vertical + BallAngle = Randomizer.random(0.f, 2 * PI); + } while (abs(cos(BallAngle)) < 0.7f); + + bool IsPlaying = true; + + Event evt; + while (app.isOpened()) + { + app.clear(Color(255, 255, 255, 255)); + // Handle events + + while (app.getEvent(evt)) + { + // Window closed or escape key pressed : exit + if ((evt.Type == Event.EventType.CLOSED) || + ((evt.Type == Event.EventType.KEYPRESSED) && (evt.Key.Code == KeyCode.ESCAPE))) + { + app.close(); + break; + } + } + + if (IsPlaying) + { + // Move the player's paddle + if (i.isKeyDown(KeyCode.UP) && (LeftPaddle.getPosition().y > 5.f)) + LeftPaddle.move(0.f, -LeftPaddleSpeed * app.getFrameTime()); + if (i.isKeyDown(KeyCode.DOWN) && (LeftPaddle.getPosition().y < app.getView().getRect().getHeight() - LeftPaddle.getSize().y - 5.f)) + LeftPaddle.move(0.f, LeftPaddleSpeed * app.getFrameTime()); + + // Move the computer's paddle + if (((RightPaddleSpeed < 0.f) && (RightPaddle.getPosition().y > 5.f)) || + ((RightPaddleSpeed > 0.f) && (RightPaddle.getPosition().y < app.getView().getRect().getHeight() - RightPaddle.getSize().y - 5.f))) + { + RightPaddle.move(0.f, RightPaddleSpeed * app.getFrameTime()); + } + + // Update the computer's paddle direction according to the ball position + if (AITimer.getElapsedTime() > AITime) + { + AITimer.reset(); + if ((RightPaddleSpeed < 0) && (Ball.getPosition().y + Ball.getSize().y > RightPaddle.getPosition().y + RightPaddle.getSize().y)) + RightPaddleSpeed = -RightPaddleSpeed; + if ((RightPaddleSpeed > 0) && (Ball.getPosition().y < RightPaddle.getPosition().y)) + RightPaddleSpeed = -RightPaddleSpeed; + } + + + + // Move the ball + float Factor = BallSpeed * app.getFrameTime(); + Ball.move(cos(BallAngle) * Factor, sin(BallAngle) * Factor); + + // Check collisions between the ball and the screen + if (Ball.getPosition().x < 0.f) + { + IsPlaying = false; + End.setText("You lost !\n(press escape to exit)"c); + } + + if (Ball.getPosition().x + Ball.getSize().x > app.getView().getRect().getWidth()) + { + IsPlaying = false; + End.setText("You won !\n(press escape to exit)"c); + } + + if (Ball.getPosition().y < 0.f) + { + BallSound.play(); + BallAngle = -BallAngle; + Ball.setY(0.1f); + } + + if (Ball.getPosition().y + Ball.getSize().y > app.getView().getRect().getHeight()) + { + BallSound.play(); + BallAngle = -BallAngle; + Ball.setY(app.getView().getRect().getHeight() - Ball.getSize().y - 0.1f); + } + // Check the collisions between the ball and the paddles + // Left Paddle + if (Ball.getPosition().x < LeftPaddle.getPosition().x + LeftPaddle.getSize().x && + Ball.getPosition().x > LeftPaddle.getPosition().x + (LeftPaddle.getSize().x / 2.0f) && + Ball.getPosition().y + Ball.getSize().y >= LeftPaddle.getPosition().y && + Ball.getPosition().y <= LeftPaddle.getPosition().y + LeftPaddle.getSize().y) + { + BallSound.play(); + BallAngle = PI - BallAngle; + Ball.setX(LeftPaddle.getPosition().x + LeftPaddle.getSize().x + 0.1f); + } + + // Right Paddle + if (Ball.getPosition().x + Ball.getSize().x > RightPaddle.getPosition().x && + Ball.getPosition().x + Ball.getSize().x < RightPaddle.getPosition().x + (RightPaddle.getSize().x / 2.0f) && + Ball.getPosition().y + Ball.getSize().y >= RightPaddle.getPosition().y && + Ball.getPosition().y <= RightPaddle.getPosition().y + RightPaddle.getSize().y) + { + BallSound.play(); + BallAngle = PI - BallAngle; + Ball.setX(RightPaddle.getPosition().x - Ball.getSize().x - 0.1f); + } + } + + // Draw the background, paddles and ball sprites + + app.draw(LeftPaddle); + app.draw(RightPaddle); + app.draw(Ball); + + // If the game is over, display the end message + if (!IsPlaying) + app.draw(End); + + // Display things on screen + app.display(); + } +} diff --git a/DSFML/samples/dsfml/postFX/postFX.d b/DSFML/samples/dsfml/postFX/postFX.d new file mode 100644 index 00000000..e2f210bc --- /dev/null +++ b/DSFML/samples/dsfml/postFX/postFX.d @@ -0,0 +1,117 @@ +module postfx; + +import dsfml.graphics.all; +import dsfml.system.all; +import dsfml.window.all; + +const char[][5] EFFECTS = ["nothing", "blur", "colorize", "fisheye", "wave"]; + +void main() +{ + int actualIndex; + + // Check that the system can use post effects + if (PostFX.canUsePostFX() == false) + assert(0, "Your system doesn't support Post Effects."); + + // Create the main window + RenderWindow app = new RenderWindow(VideoMode(800, 600), "SFML PostFX"); + app.setFramerateLimit(100); + + // Load a cute background image to display :) + Sprite background = new Sprite(new Image("Data/background.jpg")); + + // Load the image needed for the wave effect + Image WaveImage = new Image("Data/wave.jpg"); + + // Load all effects + PostFX[char[]] Effects; + foreach(char[] c; EFFECTS) + { + Effects[c] = new PostFX("Data/" ~ c ~ ".sfx"); + } + PostFX currentEffect = Effects[EFFECTS[actualIndex]]; + + // Do specific initializations + Effects["nothing"].setTexture("framebuffer", null); + Effects["blur"].setTexture("framebuffer", null); + Effects["blur"].setParameter("offset", 0.f); + Effects["colorize"].setTexture("framebuffer", null); + Effects["colorize"].setParameter("color", 1.f, 1.f, 1.f); + Effects["fisheye"].setTexture("framebuffer", null); + Effects["wave"].setTexture("framebuffer", null); + Effects["wave"].setTexture("wave", WaveImage); + + Font f = new Font("Data/cheeseburger.ttf"); + + // Define a string for displaying current effect description + String curFXStr = new String("Current effect is " ~ EFFECTS[actualIndex]); + curFXStr.setFont(f); + curFXStr.setPosition(20.f, 0.f); + + // Define a string for displaying help + String infoStr = new String("Move your mouse to change the effect parameters\nPress numpad + and - to change effect\nWarning : some effects may not work\ndepending on your graphics card"c); + infoStr.setFont(f); + infoStr.setPosition(20.f, 460.f); + infoStr.setColor(Color(200, 100, 150)); + + // Start the game loop + while (app.isOpened()) + { + // Process events + Event evt; + while (app.getEvent(evt)) + { + // Close window : exit + if (evt.Type == Event.EventType.CLOSED || + evt.Type == Event.EventType.KEYPRESSED && evt.Key.Code == KeyCode.ESCAPE) + app.close(); + + if (evt.Type == Event.EventType.KEYPRESSED) + { + // Add key : next effect + if (evt.Key.Code == KeyCode.ADD) + { + if (actualIndex == 4) + actualIndex = 0; + else + actualIndex++; + currentEffect = Effects[EFFECTS[actualIndex]]; + curFXStr.setText("Current effect is " ~ EFFECTS[actualIndex]); + } + + // Subtract key : previous effect + if (evt.Key.Code == KeyCode.SUBTRACT) + { + if (actualIndex == 0) + actualIndex = 4; + else + actualIndex--; + currentEffect = Effects[EFFECTS[actualIndex]]; + curFXStr.setText("Current effect is " ~ EFFECTS[actualIndex]); + } + } + } + + // Get the mouse position in the range [0, 1] + float X = app.getInput().getMouseX() / cast(float) app.getWidth(); + float Y = app.getInput().getMouseY() / cast(float) app.getHeight(); + + // Update the current effect + if (EFFECTS[actualIndex] == "blur") currentEffect.setParameter("offset", X * Y * 0.1f); + else if (EFFECTS[actualIndex] == "colorize") currentEffect.setParameter("color", 0.3f, X, Y); + else if (EFFECTS[actualIndex] == "fisheye") currentEffect.setParameter("mouse", X, 1.f - Y); + else if (EFFECTS[actualIndex] == "wave") currentEffect.setParameter("offset", X, Y); + + // Draw background and apply the post-fx + app.draw(background); + app.draw(currentEffect); + + // Draw interface strings + app.draw(curFXStr); + app.draw(infoStr); + + // Finally, display the rendered frame on screen + app.display(); + } +} diff --git a/DSFML/samples/dsfml/socket/socketclient.d b/DSFML/samples/dsfml/socket/socketclient.d new file mode 100644 index 00000000..231fa961 --- /dev/null +++ b/DSFML/samples/dsfml/socket/socketclient.d @@ -0,0 +1,66 @@ +module socketclient; + +import dsfml.system.all; +import dsfml.network.all; + +version (Tango) +{ + import tango.io.Console; + import tango.io.Stdout; +} +else +{ + import std.stdio; +} + + +void main() +{ + //The TCP socket + SocketTCP client = new SocketTCP(); + //Try to connect to server (on localhost for this sample) + client.connect(9000, IPAddress.LOCALHOST); + + display("Connected to server."w); + + //Prepare a packet with a string + Packet p = new Packet(); + p.set("Hello from the client !"w); + if (client.send(p) != SocketStatus.DONE) // Assert on error + assert(0); + + //Clear the packet + p.clear(); + + //Wait for the response of the server and display it + if (client.receive(p) != SocketStatus.DONE) + assert(0); + wchar[] c; + p.get(c); + display("Packet received : "w ~ c); + read(); +} + +void display(wchar[] c) +{ + version (Tango) + { + Stdout(c).newline; + } + else + { + writefln("%s", c); + } +} + +void read() +{ + version (Tango) + { + Cin.get(); + } + else + { + readln(); + } +} diff --git a/DSFML/samples/dsfml/socket/socketserver.d b/DSFML/samples/dsfml/socket/socketserver.d new file mode 100644 index 00000000..0fce640e --- /dev/null +++ b/DSFML/samples/dsfml/socket/socketserver.d @@ -0,0 +1,83 @@ +module socketserver; + +import dsfml.system.all; +import dsfml.network.all; + +version (Tango) +{ + import tango.io.Console; + import tango.io.Stdout; +} +else +{ + import std.stdio; +} + +void main() +{ + //We create a TCP socket for listening incomming client + SocketTCP listener = new SocketTCP(); + + //Set a random port for the listener + if (!listener.listen(9000)) + assert(0); + + //Creation of TCP socket + SocketTCP client = new SocketTCP(); + IPAddress ipClient; + + display("Waiting for client."w); + + if (listener.accept(client, ipClient) == SocketStatus.DONE) //This call blocks until client connection + { + display("New client connected."w); + //The packet for retrieving the client message + Packet p = new Packet(); + display("Waiting for data"w); + if (client.receive(p) != SocketStatus.DONE) //Assert on reception error + assert(0); + + + //Display the string send by the client + wchar[] c; + p.get(c); + display("Packet received : "w ~ c); + + //Clear the packet (We could use a new one) + p.clear(); + + //and send response to client + client.send(p.set("Hello from the server !"w)); + } + read(); +} + +/** +* Multilib string display +*/ +void display(wchar[] c) +{ + version (Tango) + { + Stdout(c).newline; + } + else + { + writefln("%s", c); + } +} + +/** +* Dummy function to prevent console closing on windows +*/ +void read() +{ + version (Tango) + { + Cin.get(); + } + else + { + readln(); + } +} diff --git a/DSFML/samples/dsfml/sound3d/sound3d.d b/DSFML/samples/dsfml/sound3d/sound3d.d new file mode 100644 index 00000000..db512697 --- /dev/null +++ b/DSFML/samples/dsfml/sound3d/sound3d.d @@ -0,0 +1,190 @@ +module sound3d; + +import dsfml.system.all; +import dsfml.window.all; +import dsfml.graphics.all; +import dsfml.audio.all; + +void main() +{ + //We create our window with a limit of 100 and a white backcolor. + RenderWindow app = new RenderWindow (VideoMode(800, 600, 32), "Sound Spatialization Sample"); + app.useVerticalSync(true); + + Font f = new Font("Data/cheeseburger.ttf", 34); + + //Some instructions + String s = new String("Click anywhere on screen to change listener position.\nPress + or - to modify the speed of the car."c, f); + s.setPosition(20, 30); + s.setColor(Color.BLACK); + + //We prepare our images and the sound + char[][2] images = ["Data/bluerallyecarleft.bmp", "Data/bluerallyecarright.bmp"]; + Car c = new Car(images, "Data/car_idle.wav"); + + int carSpeed = 100; + + //Set default position for the car and the listener + c.setPosition(Vector2f(0, 300)); + SoundListener.setPosition(Vector2f(400, 300)); + + c.startPlaying(); + + //Start the main loop + while (app.isOpened()) + { + app.clear(Color.WHITE); + Event evt; + //The event loop + while (app.getEvent(evt)) + { + // if the window is closed, we can leave the game loop + if (evt.Type == Event.EventType.CLOSED) + app.close(); + // we handle the click event to change listener position + else if (evt.Type == Event.EventType.MOUSEBUTTONPRESSED && evt.MouseButton.Button == MouseButtons.LEFT) + { + Input i = app.getInput(); + SoundListener.setPosition(Vector2f(i.getMouseX(), i.getMouseY())); + } + // and eventual keys press + else if (evt.Type == Event.EventType.KEYPRESSED) + { + //Change the car speed + if (evt.Key.Code == KeyCode.ADD) + { + carSpeed += 25; + } + else if (evt.Key.Code == KeyCode.SUBTRACT) + { + carSpeed -= 25; + } + } + } + + //We move constantly our car. + c.move(Vector2f(app.getFrameTime() * carSpeed, 0)); + + //Draw all the sprite and string on render window + app.draw(s); + app.draw(c.getSprite()); + app.draw(SoundListener.getSprite()); + + //And finally display the window + app.display(); + } + + +} + +// Encapsulate the listener position and the visor sprite. +// There is only one listener so all the methods are statics. +class SoundListener +{ + static Sprite s_crosshair; + static Vector2f s_p; + + static this() + { + Image crosshairImg = new Image("Data/crosshair.tga"); + crosshairImg.createMaskFromColor(Color.WHITE); + + s_crosshair = new Sprite(crosshairImg); + s_crosshair.setCenter(Vector2f(s_crosshair.getSize().x / 2, s_crosshair.getSize().y / 2)); + + //Listener.setTarget(1.f, 0.f, 0.f); + } + + // Adjust position of the listener + static void setPosition(Vector2f p) + { + Listener.setPosition(p.x, p.y, 5.f); + s_crosshair.setPosition(p); + } + + static Sprite getSprite() + { + return s_crosshair; + } +} + + +// Class encapsulating all data for our car +class Car +{ + Vector2f m_actual; + Sprite m_sprite; + Sound m_sound; + bool reverse; + Image[2] imgs; + + //Constructor with with a fixed size string array of image path, and a string for the sound path + this (char[][2] images, char[] soundFilename) + { + //load images and create filter + imgs[0] = new Image(images[0]); imgs[1] = new Image(images[1]); + + foreach(img; imgs) + img.createMaskFromColor(Color(97, 68, 43)); + + m_sprite = new Sprite(imgs[0]); + m_sprite.setCenter(Vector2f(m_sprite.getSize().x / 2, m_sprite.getSize().y / 2)); + + SoundBuffer buff = new SoundBuffer(soundFilename); + + //load our sound with loop enabled + m_sound = new Sound(buff, true); + m_sound.setAttenuation(.05f); + } + + // Begin the sound play + void startPlaying() + { + m_sound.play(); + } + + // Set the position of the car on the window + // Used to setup the begin car window and sound location + void setPosition(Vector2f p) + { + m_sprite.setPosition(p); + m_sound.setPosition(p.x, 0, p.y); + } + + //Move the car (visual and sound position) + //If the car leave the screen, we change the sprite image and reverse moving + void move(Vector2f vec) + { + // if the car is beyond the right screen limit + if (!reverse && m_sprite.getPosition().x > 850) + { + m_sprite.setImage(imgs[1]); + reverse = true; + } + // same as above but for left limit + else if (reverse && vec.x + m_sprite.getPosition().x < -50) + { + m_sprite.setImage(imgs[0]); + reverse = false; + } + + if (reverse) + vec = -vec; + + m_sprite.move(vec); + Vector2f pos = m_sprite.getPosition(); + m_sound.setPosition(pos.x , pos.y, 0); + } + + Sprite getSprite() + { + return m_sprite; + } +} + + + + + + + diff --git a/DSFML/samples/dsfml/soundstream/soundstream.d b/DSFML/samples/dsfml/soundstream/soundstream.d new file mode 100644 index 00000000..75da8489 --- /dev/null +++ b/DSFML/samples/dsfml/soundstream/soundstream.d @@ -0,0 +1,91 @@ +module soundstream; + +import dsfml.system.all; +import dsfml.audio.all; + +version (Tango) +{ + import tango.io.Console; + import tango.io.Stdout; +} +else +{ + import std.stdio; +} + +// SoundStream is an abstract class. +// You need to implement onStart() and onGetData() +// Don't forget to call initialize() before any usage or playback will fail. +class MySoundStream : SoundStream +{ + SoundBuffer m_buff; + short[] m_data; + size_t m_cursor; + + this() + { + // We initialize the stream with some sound informations + super(1, 11025); + + // We create a sound buffer to load samples from files + m_buff = new SoundBuffer("Data/car_idle.wav"); + m_data = m_buff.getSamples[0..m_buff.getSamplesCount]; + } +protected: + bool onStart() + { + // No specifics things to do, just return true. + return true; + } + + bool onGetData(out short[] data) + { + // We ensure that we have enough data to send + if (m_cursor + this.getSampleRate > m_data.length) + return false; + + // Assign data in the buffer ... + data = m_data[m_cursor..m_cursor + this.getSampleRate]; + // ... and increment the cursor + m_cursor += this.getSampleRate; + return true; + } + +} + +void main() +{ + MySoundStream stream = new MySoundStream(); + + display("Playing sound !\n Press enter to stop playback."); + stream.play(); + read(); + stream.stop(); +} + +void display(char[] c) +{ + version (Tango) +{ + Stdout(c).newline; +} + else +{ + writefln("%s", c); +} +} + +/** +* Dummy function to prevent console closing on windows +*/ +void read() +{ + version (Tango) +{ + Cin.get(); +} + else +{ + readln(); +} +} diff --git a/DSFML/samples/dsfml/view/view.d b/DSFML/samples/dsfml/view/view.d new file mode 100644 index 00000000..ff1d50d0 --- /dev/null +++ b/DSFML/samples/dsfml/view/view.d @@ -0,0 +1,69 @@ +module view; + +import dsfml.system.all; +import dsfml.window.all; +import dsfml.graphics.all; + +void main() +{ + RenderWindow window = new RenderWindow(VideoMode(800, 600), "View sample"); + window.setFramerateLimit(100); + Input input = window.getInput(); + Vector2f top; + Rect!(float) bound; + Shape s; + bool mousePressed; + + Sprite background = new Sprite(new Image("Data/background.jpg")); + + Font f = new Font("Data/cheeseburger.ttf"); + String str = new String("Create a selection of the background with your mouse.\nPress Enter to zoom to this selection.\nPress Escape to return to the default view."c, f); + + while (window.isOpened()) + { + Event evt; + + while (window.getEvent(evt)) + { + if ( evt.Type == Event.EventType.MOUSEBUTTONPRESSED && + evt.MouseButton.Button == MouseButtons.LEFT) + { + top = window.convertCoords(input.getMouseX(), input.getMouseY()); + mousePressed = true; + + } + else if ( evt.Type == Event.EventType.MOUSEBUTTONRELEASED && + evt.MouseButton.Button == MouseButtons.LEFT) + { + mousePressed = false; + } + else if ( evt.Type == Event.EventType.MOUSEMOVED && + mousePressed) + { + Vector2f bottom = window.convertCoords(input.getMouseX(), input.getMouseY()); + bound = new Rect!(float)(top.x, top.y, bottom.x, bottom.y); + s = Shape.rectangle(top.x, top.y, bottom.x, bottom.y, Color(0, 0, 0, 0), 1, Color.BLACK); + } + else if ( evt.Type == Event.EventType.KEYPRESSED && + evt.Key.Code == KeyCode.RETURN) + { + if (bound !is null) + window.setView(new View(bound)); + s = null; + } + else if ( evt.Type == Event.EventType.KEYPRESSED && + evt.Key.Code == KeyCode.ESCAPE) + { + window.setView(window.getDefaultView()); + } + else if ( evt.Type == Event.EventType.CLOSED) + window.close(); + + } + + window.draw(background); + window.draw(str); + if (s !is null) window.draw(s); + window.display(); + } +} diff --git a/DSFML/samples/dsfml/voip/client.d b/DSFML/samples/dsfml/voip/client.d new file mode 100644 index 00000000..e010aeb2 --- /dev/null +++ b/DSFML/samples/dsfml/voip/client.d @@ -0,0 +1,72 @@ +module client; + +import util; + + +// Specialization of audio recorder for sending recorded audio +// data through the network +class NetworkRecorder : SoundRecorder +{ +public: + + // Constructor + this(SocketTCP Socket) + { + mySocket = Socket; + } + + ~this() + { + delete mySocket; + } +protected: + override bool onStart() + { + return true; + } + + override void onStop() + { + + } + + override bool onProcessSamples(short[] samples) + { + // Pack the audio samples into a network packet + Packet PacketOut = new Packet(); + PacketOut.set(AudioData); + PacketOut.append((cast(byte*)samples.ptr)[0..samples.length * short.sizeof]); + // Send the audio packet to the server + return mySocket.send(PacketOut) == SocketStatus.DONE; + } + + SocketTCP mySocket; ///< Socket used to communicate with the server +} + +void runClient(IPAddress adr, int port) +{ + // Create a TCP socket for communicating with server + SocketTCP Socket = new SocketTCP(); + + // Connect to the specified server + if (!Socket.connect(port, adr)) + return; + + // Wait for user input... + Cout("Press enter to start recording audio").newline; + Cin.get(); + + // Create a instance of our custom recorder + NetworkRecorder Recorder = new NetworkRecorder(Socket); + + // Start capturing audio data + Recorder.start(44100); + Cout("Press enter to stop recording audio").newline; + Cin.get(); + Recorder.stop(); + + // Send a "end-of-stream" packet + Packet PacketOut = new Packet(); + PacketOut.set(EndOfStream); + Socket.send(PacketOut); +} diff --git a/DSFML/samples/dsfml/voip/entry.d b/DSFML/samples/dsfml/voip/entry.d new file mode 100644 index 00000000..aaa9a088 --- /dev/null +++ b/DSFML/samples/dsfml/voip/entry.d @@ -0,0 +1,46 @@ +module entry; + +import util; +import server; +import client; + +int main(char[][] args) +{ + char[][] argc = args.dup; + if (argc.length > 1) + { + if ( argc[1] == "-c" && + argc.length == 4) + { + IPAddress adr = IPAddress(argc[2]); + + if (adr.isValid() && + parse(argc[3]) <= 60000 && + parse(argc[3]) >= 1000) + { + runClient(adr, parse(argc[3])); + } + else + printUsage(); + } + else if ( argc[1] == "-s" && + argc.length == 3 && + parse(argc[2]) <= 60000 && + parse(argc[2]) >= 1000) + { + runServer(parse(argc[2])); + + } + else + printUsage(); + } + else + printUsage(); + + return 0; +} + +void printUsage() +{ + Cout("Usage :\n voip.exe [-c [ip address] | -s] [port] \n -c = run as client\n -s = run as server\n ip address = address of the server\n port = port between 1000 and 65000\n").newline; +} diff --git a/DSFML/samples/dsfml/voip/server.d b/DSFML/samples/dsfml/voip/server.d new file mode 100644 index 00000000..5735448a --- /dev/null +++ b/DSFML/samples/dsfml/voip/server.d @@ -0,0 +1,162 @@ +module server; + +import util; + +class NetworkAudioStream : SoundStream +{ +public: + static this() + { + s_sync = new Object(); + } + + // Default constructor + this() + { + myListener = new SocketTCP(); + myClient = new SocketTCP(); + // Set the sound parameters + super(1, 44100); + } + + // Destructor + ~this() + { + // Close the sockets + delete myClient; + delete myListener; + } + + // Run the server, stream audio data from the client + void start(int Port) + { + if (!myHasFinished) + { + // Listen to the given port for incoming connections + if (!myListener.listen(Port)) + return; + Cout("Listening").newline; + myListener.accept(myClient); + Cout("New Client").newline; + // Start playback + play(); + + // Start receiving audio data + receiveLoop(); + } + else + { + // Start playback + play(); + } + } + +protected: + + override bool onStart() + { + // Reset the playing offset + myOffset = 0; + + return true; + } + + override bool onGetData(out short[] data) + { + // We have reached the end of the buffer and all audio data have been played : we can stop playback + if ((myOffset == mySamples.length) && myHasFinished) + return false; + // No new data has arrived since last update : wait until we get some + while (myOffset == mySamples.length && !myHasFinished) + sleep(0.01f); + + synchronized(s_sync) + { + myTempBuffer = mySamples[myOffset..mySamples.length]; + // Update the playing offset + myOffset += myTempBuffer.length; + } + + data = myTempBuffer; + return true; + } + +private: + + void receiveLoop() + { + while (!myHasFinished) + { + // Get waiting audio data from the network + Packet PacketIn = new Packet(); + if (myClient.receive(PacketIn) != SocketStatus.DONE) + break; + + // Extract the message ID + ubyte Id; + PacketIn.get(Id); + + if (Id == AudioData) + { + // Extract audio samples from the packet, and append it to our samples buffer + + synchronized(s_sync) + { + byte* temp = PacketIn.getData().ptr; + temp++; + + mySamples ~= (cast(short*)temp)[0..(PacketIn.getDataSize - byte.sizeof ) / short.sizeof]; + } + } + else if (Id == EndOfStream) + { + // End of stream reached : we stop receiving audio data + myHasFinished = true; + } + else + { + // Something's wrong... + myHasFinished = true; + } + } + } + + SocketTCP myListener; + SocketTCP myClient; + short[] mySamples; + short[] myTempBuffer; + size_t myOffset; + bool myHasFinished; + + static Object s_sync; +}; + + + +// Launch a server and wait for incoming audio data from +// a connected client +void runServer(int Port) +{ + // Build an audio stream to play sound data as it is received through the network + NetworkAudioStream audioStream = new NetworkAudioStream; + audioStream.start(Port); + + // Loop until the sound playback is finished + while (audioStream.getStatus() != SoundStatus.STOPPED) + { + // Leave some CPU time for other threads + sleep(0.1f); + } + + Cout("Enter to replay").newline; + Cin.get(); + // Replay the sound (just to make sure replaying the received data is OK) + audioStream.play(); + + // Loop until the sound playback is finished + while (audioStream.getStatus() != SoundStatus.STOPPED) + { + // Leave some CPU time for other threads + sleep(0.1f); + } +} diff --git a/DSFML/samples/dsfml/voip/util.d b/DSFML/samples/dsfml/voip/util.d new file mode 100644 index 00000000..cc69525b --- /dev/null +++ b/DSFML/samples/dsfml/voip/util.d @@ -0,0 +1,49 @@ +module util; + +const ubyte AudioData = 1; +const ubyte EndOfStream = 2; + +public import dsfml.system.all; +public import dsfml.audio.all; +public import dsfml.network.all; + +version(Tango) +{ + public import tango.io.Console; + public import tango.text.convert.Integer; +} +else +{ + public import std.stdio; + + //simple abstraction of Cout & Cin for phobos + class Cout + { + static Cout s_c; + static this() + { + s_c = new Cout(); + } + + static Cout opCall(char[] str) + { + writefln("%s", str); + return s_c; + } + void newline() + { + + } + } + + class Cin + { + static char[] get() + { + return readln(); + } + } + + public import std.string : atoi; + alias atoi parse; +} diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 00000000..5a2bcf0b --- /dev/null +++ b/Doxyfile @@ -0,0 +1,1550 @@ +# Doxyfile 1.5.8 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = SFML + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, +# Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = include/SFML/ \ + Doxygen.hpp \ + src/SFML/ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = .svn \ + stb_vorbis \ + libjpeg \ + libpng \ + SOIL \ + zlib \ + glew \ + glext \ + Linux \ + Unix \ + Attic \ + OSX* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = priv + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = NO + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .htm + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = header.htm + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = footer.htm + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = doxygen.css + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = ../SFML.chm + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = "C:/Program Files/HTML Help Workshop/hhc.exe" + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 1 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = D:/Programmes/mscgen + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Options related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/Doxygen.hpp b/Doxygen.hpp new file mode 100644 index 00000000..33322a0e --- /dev/null +++ b/Doxygen.hpp @@ -0,0 +1,72 @@ +//////////////////////////////////////////////////////////// +/// \mainpage +/// +/// \section welcome Welcome +/// Welcome to the official SFML documentation. Here you will find a detailed +/// view of all the SFML classes, as well as source +/// files.
+/// If you are looking for tutorials, you can visit the official website +/// at www.sfml-dev.org. +/// +/// \section example Short example +/// Here is a short example, to show you how simple it is to use SFML : +/// +/// \code +/// +/// #include +/// #include +/// +/// int main() +/// { +/// // Create the main window +/// sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Load a sprite to display +/// sf::Image Image; +/// if (!Image.LoadFromFile("cute_image.jpg")) +/// return EXIT_FAILURE; +/// sf::Sprite Sprite(Image); +/// +/// // Create a graphical string to display +/// sf::Font Arial; +/// if (!Arial.LoadFromFile("arial.ttf")) +/// return EXIT_FAILURE; +/// sf::String Text("Hello SFML", Arial, 50); +/// +/// // Load a music to play +/// sf::Music Music; +/// if (!Music.OpenFromFile("nice_music.ogg")) +/// return EXIT_FAILURE; +/// +/// // Play the music +/// Music.Play(); +/// +/// // Start the game loop +/// while (App.IsOpened()) +/// { +/// // Process events +/// sf::Event Event; +/// while (App.GetEvent(Event)) +/// { +/// // Close window : exit +/// if (Event.Type == sf::Event::Closed) +/// App.Close(); +/// } +/// +/// // Clear screen +/// App.Clear(); +/// +/// // Draw the sprite +/// App.Draw(Sprite); +/// +/// // Draw the string +/// App.Draw(Text); +/// +/// // Update the window +/// App.Display(); +/// } +/// +/// return EXIT_SUCCESS; +/// } +/// \endcode +//////////////////////////////////////////////////////////// diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..1b0f851e --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ + +all: sfml + +sfml: + @(cd ./src/SFML && $(MAKE)) + +sfml-samples: + @(cd ./samples && $(MAKE)) + +install: + @(cd ./src/SFML && $(MAKE) $@) + +clean: + @(cd ./src/SFML && $(MAKE) $@) + @(cd ./samples && $(MAKE) $@) + +mrproper: + @(cd ./src/SFML && $(MAKE) $@) + @(cd ./samples && $(MAKE) $@) diff --git a/build/codeblocks/SFML.workspace b/build/codeblocks/SFML.workspace new file mode 100644 index 00000000..56e3f261 --- /dev/null +++ b/build/codeblocks/SFML.workspace @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/codeblocks/sfml-audio.cbp b/build/codeblocks/sfml-audio.cbp new file mode 100644 index 00000000..b5920b97 --- /dev/null +++ b/build/codeblocks/sfml-audio.cbp @@ -0,0 +1,146 @@ + + + + + + diff --git a/build/codeblocks/sfml-graphics.cbp b/build/codeblocks/sfml-graphics.cbp new file mode 100644 index 00000000..c7ec569b --- /dev/null +++ b/build/codeblocks/sfml-graphics.cbp @@ -0,0 +1,422 @@ + + + + + + diff --git a/build/codeblocks/sfml-main.cbp b/build/codeblocks/sfml-main.cbp new file mode 100644 index 00000000..66781f3a --- /dev/null +++ b/build/codeblocks/sfml-main.cbp @@ -0,0 +1,46 @@ + + + + + + diff --git a/build/codeblocks/sfml-network.cbp b/build/codeblocks/sfml-network.cbp new file mode 100644 index 00000000..d5824de1 --- /dev/null +++ b/build/codeblocks/sfml-network.cbp @@ -0,0 +1,134 @@ + + + + + + diff --git a/build/codeblocks/sfml-system.cbp b/build/codeblocks/sfml-system.cbp new file mode 100644 index 00000000..c6b5f622 --- /dev/null +++ b/build/codeblocks/sfml-system.cbp @@ -0,0 +1,124 @@ + + + + + + diff --git a/build/codeblocks/sfml-window.cbp b/build/codeblocks/sfml-window.cbp new file mode 100644 index 00000000..2af97df1 --- /dev/null +++ b/build/codeblocks/sfml-window.cbp @@ -0,0 +1,140 @@ + + + + + + diff --git a/build/vc2005/SFML.sln b/build/vc2005/SFML.sln new file mode 100644 index 00000000..e55b3af3 --- /dev/null +++ b/build/vc2005/SFML.sln @@ -0,0 +1,363 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-audio", "sfml-audio.vcproj", "{B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-graphics", "sfml-graphics.vcproj", "{FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-main", "sfml-main.vcproj", "{2BD26A09-E1B6-42E2-A0D0-63987B76BB97}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-network", "sfml-network.vcproj", "{823DDC98-42D5-4A38-88CF-9DC06C788AE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-system", "sfml-system.vcproj", "{C061A27D-7CA0-4179-9869-672FA04A86A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-window", "sfml-window.vcproj", "{0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl", "..\..\samples\build\vc2005\opengl.vcproj", "{4CD9A872-16EF-4C53-81FC-C7E77E782718}" + ProjectSection(ProjectDependencies) = postProject + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "postfx", "..\..\samples\build\vc2005\postfx.vcproj", "{E8B7727D-2308-4ADC-90AE-D3F46798447D}" + ProjectSection(ProjectDependencies) = postProject + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "..\..\samples\build\vc2005\sockets.vcproj", "{E6ED898F-218E-4467-8B1D-92E393283E1B}" + ProjectSection(ProjectDependencies) = postProject + {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "..\..\samples\build\vc2005\sound.vcproj", "{11E3764D-850E-4EDA-9823-F66383A11042}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound-capture", "..\..\samples\build\vc2005\sound-capture.vcproj", "{34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}" + ProjectSection(ProjectDependencies) = postProject + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "voip", "..\..\samples\build\vc2005\voip.vcproj", "{4B169017-FFDD-4588-9658-6F1C9ABC6495}" + ProjectSection(ProjectDependencies) = postProject + {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32", "..\..\samples\build\vc2005\win32.vcproj", "{303EC049-639D-4F9C-9F33-D4B7F702275B}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "window", "..\..\samples\build\vc2005\window.vcproj", "{11E9ABEF-17A5-4FF7-91E5-994F34172F68}" + ProjectSection(ProjectDependencies) = postProject + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxwidgets", "..\..\samples\build\vc2005\wxwidgets.vcproj", "{8B3B274A-B3B7-4C6B-8D4A-5334E2116830}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qt", "..\..\samples\build\vc2005\qt.vcproj", "{EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}" + ProjectSection(ProjectDependencies) = postProject + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pong", "..\..\samples\build\vc2005\pong.vcproj", "{DDDE27DC-5568-43EE-BD0E-57C581F73EDE}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SFML", "SFML", "{C6D36691-1669-4189-AAB8-06C9932C2A45}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{3EE136A0-C638-4989-BE5A-E4007221CA28}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftp", "..\..\samples\build\vc2005\ftp.vcproj", "{7236920B-254C-43A3-9DC1-778B477226DF}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug static|Win32 = Debug static|Win32 + Debug|Win32 = Debug|Win32 + Release DLL|Win32 = Release DLL|Win32 + Release static|Win32 = Release static|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.Build.0 = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.Build.0 = Release static|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug DLL|Win32.Build.0 = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug static|Win32.ActiveCfg = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug static|Win32.Build.0 = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug|Win32.ActiveCfg = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug|Win32.Build.0 = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release DLL|Win32.ActiveCfg = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release DLL|Win32.Build.0 = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release static|Win32.ActiveCfg = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release static|Win32.Build.0 = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release|Win32.ActiveCfg = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release|Win32.Build.0 = Release|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.Build.0 = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.Build.0 = Release static|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Debug DLL|Win32.Build.0 = Debug|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Debug static|Win32.ActiveCfg = Debug|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Debug static|Win32.Build.0 = Debug|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Debug|Win32.ActiveCfg = Debug|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Debug|Win32.Build.0 = Debug|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release DLL|Win32.ActiveCfg = Release|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release DLL|Win32.Build.0 = Release|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release static|Win32.ActiveCfg = Release|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release static|Win32.Build.0 = Release|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release|Win32.ActiveCfg = Release|Win32 + {4CD9A872-16EF-4C53-81FC-C7E77E782718}.Release|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug DLL|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug static|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.ActiveCfg = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Debug|Win32.Build.0 = Debug|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release DLL|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release static|Win32.Build.0 = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.ActiveCfg = Release|Win32 + {E8B7727D-2308-4ADC-90AE-D3F46798447D}.Release|Win32.Build.0 = Release|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug DLL|Win32.Build.0 = Debug|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug static|Win32.ActiveCfg = Debug|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug static|Win32.Build.0 = Debug|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug|Win32.ActiveCfg = Debug|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Debug|Win32.Build.0 = Debug|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Release DLL|Win32.ActiveCfg = Release|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Release DLL|Win32.Build.0 = Release|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Release static|Win32.ActiveCfg = Release|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Release static|Win32.Build.0 = Release|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Release|Win32.ActiveCfg = Release|Win32 + {E6ED898F-218E-4467-8B1D-92E393283E1B}.Release|Win32.Build.0 = Release|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Debug DLL|Win32.Build.0 = Debug|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Debug static|Win32.ActiveCfg = Debug|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Debug static|Win32.Build.0 = Debug|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Debug|Win32.ActiveCfg = Debug|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Debug|Win32.Build.0 = Debug|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Release DLL|Win32.ActiveCfg = Release|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Release DLL|Win32.Build.0 = Release|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Release static|Win32.ActiveCfg = Release|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Release static|Win32.Build.0 = Release|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Release|Win32.ActiveCfg = Release|Win32 + {11E3764D-850E-4EDA-9823-F66383A11042}.Release|Win32.Build.0 = Release|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Debug DLL|Win32.Build.0 = Debug|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Debug static|Win32.ActiveCfg = Debug|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Debug static|Win32.Build.0 = Debug|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Debug|Win32.ActiveCfg = Debug|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Debug|Win32.Build.0 = Debug|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Release DLL|Win32.ActiveCfg = Release|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Release DLL|Win32.Build.0 = Release|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Release static|Win32.ActiveCfg = Release|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Release static|Win32.Build.0 = Release|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Release|Win32.ActiveCfg = Release|Win32 + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573}.Release|Win32.Build.0 = Release|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Debug DLL|Win32.Build.0 = Debug|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Debug static|Win32.ActiveCfg = Debug|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Debug static|Win32.Build.0 = Debug|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Debug|Win32.ActiveCfg = Debug|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Debug|Win32.Build.0 = Debug|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Release DLL|Win32.ActiveCfg = Release|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Release DLL|Win32.Build.0 = Release|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Release static|Win32.ActiveCfg = Release|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Release static|Win32.Build.0 = Release|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Release|Win32.ActiveCfg = Release|Win32 + {4B169017-FFDD-4588-9658-6F1C9ABC6495}.Release|Win32.Build.0 = Release|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Debug DLL|Win32.Build.0 = Debug|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Debug static|Win32.ActiveCfg = Debug|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Debug static|Win32.Build.0 = Debug|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Debug|Win32.ActiveCfg = Debug|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Debug|Win32.Build.0 = Debug|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Release DLL|Win32.ActiveCfg = Release|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Release DLL|Win32.Build.0 = Release|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Release static|Win32.ActiveCfg = Release|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Release static|Win32.Build.0 = Release|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Release|Win32.ActiveCfg = Release|Win32 + {303EC049-639D-4F9C-9F33-D4B7F702275B}.Release|Win32.Build.0 = Release|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Debug DLL|Win32.Build.0 = Debug|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Debug static|Win32.ActiveCfg = Debug|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Debug static|Win32.Build.0 = Debug|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Debug|Win32.ActiveCfg = Debug|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Debug|Win32.Build.0 = Debug|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Release DLL|Win32.ActiveCfg = Release|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Release DLL|Win32.Build.0 = Release|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Release static|Win32.ActiveCfg = Release|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Release static|Win32.Build.0 = Release|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Release|Win32.ActiveCfg = Release|Win32 + {11E9ABEF-17A5-4FF7-91E5-994F34172F68}.Release|Win32.Build.0 = Release|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Debug DLL|Win32.Build.0 = Debug|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Debug static|Win32.ActiveCfg = Debug|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Debug static|Win32.Build.0 = Debug|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Debug|Win32.ActiveCfg = Debug|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Debug|Win32.Build.0 = Debug|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release DLL|Win32.ActiveCfg = Release|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release DLL|Win32.Build.0 = Release|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release static|Win32.ActiveCfg = Release|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release static|Win32.Build.0 = Release|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release|Win32.ActiveCfg = Release|Win32 + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830}.Release|Win32.Build.0 = Release|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug DLL|Win32.Build.0 = Debug|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug static|Win32.ActiveCfg = Debug|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug static|Win32.Build.0 = Debug|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug|Win32.ActiveCfg = Debug|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Debug|Win32.Build.0 = Debug|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Release DLL|Win32.ActiveCfg = Release|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Release DLL|Win32.Build.0 = Release|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Release static|Win32.ActiveCfg = Release|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Release static|Win32.Build.0 = Release|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Release|Win32.ActiveCfg = Release|Win32 + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2}.Release|Win32.Build.0 = Release|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Debug DLL|Win32.Build.0 = Debug|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Debug static|Win32.ActiveCfg = Debug|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Debug static|Win32.Build.0 = Debug|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Debug|Win32.ActiveCfg = Debug|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Debug|Win32.Build.0 = Debug|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release DLL|Win32.ActiveCfg = Release|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release DLL|Win32.Build.0 = Release|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release static|Win32.ActiveCfg = Release|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release static|Win32.Build.0 = Release|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release|Win32.ActiveCfg = Release|Win32 + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE}.Release|Win32.Build.0 = Release|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Debug DLL|Win32.Build.0 = Debug|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Debug static|Win32.ActiveCfg = Debug|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Debug static|Win32.Build.0 = Debug|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Debug|Win32.ActiveCfg = Debug|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Debug|Win32.Build.0 = Debug|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Release DLL|Win32.ActiveCfg = Release|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Release DLL|Win32.Build.0 = Release|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Release static|Win32.ActiveCfg = Release|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Release static|Win32.Build.0 = Release|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Release|Win32.ActiveCfg = Release|Win32 + {7236920B-254C-43A3-9DC1-778B477226DF}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B} = {C6D36691-1669-4189-AAB8-06C9932C2A45} + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97} = {C6D36691-1669-4189-AAB8-06C9932C2A45} + {823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {C6D36691-1669-4189-AAB8-06C9932C2A45} + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C6D36691-1669-4189-AAB8-06C9932C2A45} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {C6D36691-1669-4189-AAB8-06C9932C2A45} + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2} = {C6D36691-1669-4189-AAB8-06C9932C2A45} + {E8B7727D-2308-4ADC-90AE-D3F46798447D} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {E6ED898F-218E-4467-8B1D-92E393283E1B} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {11E3764D-850E-4EDA-9823-F66383A11042} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {34EBDA13-AFA3-4AD9-AB64-2B2D40E09573} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {4B169017-FFDD-4588-9658-6F1C9ABC6495} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {303EC049-639D-4F9C-9F33-D4B7F702275B} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {11E9ABEF-17A5-4FF7-91E5-994F34172F68} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {8B3B274A-B3B7-4C6B-8D4A-5334E2116830} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {EAB1A0A4-8CCC-4A74-B3B5-9F60243581D2} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {DDDE27DC-5568-43EE-BD0E-57C581F73EDE} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {4CD9A872-16EF-4C53-81FC-C7E77E782718} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + {7236920B-254C-43A3-9DC1-778B477226DF} = {3EE136A0-C638-4989-BE5A-E4007221CA28} + EndGlobalSection +EndGlobal diff --git a/build/vc2005/sfml-audio.vcproj b/build/vc2005/sfml-audio.vcproj new file mode 100644 index 00000000..857d80a4 --- /dev/null +++ b/build/vc2005/sfml-audio.vcproj @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2005/sfml-graphics.vcproj b/build/vc2005/sfml-graphics.vcproj new file mode 100644 index 00000000..3b34601e --- /dev/null +++ b/build/vc2005/sfml-graphics.vcproj @@ -0,0 +1,3456 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2005/sfml-main.vcproj b/build/vc2005/sfml-main.vcproj new file mode 100644 index 00000000..dfeef9be --- /dev/null +++ b/build/vc2005/sfml-main.vcproj @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2005/sfml-network.vcproj b/build/vc2005/sfml-network.vcproj new file mode 100644 index 00000000..9ebc1287 --- /dev/null +++ b/build/vc2005/sfml-network.vcproj @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2005/sfml-system.vcproj b/build/vc2005/sfml-system.vcproj new file mode 100644 index 00000000..fa95ce48 --- /dev/null +++ b/build/vc2005/sfml-system.vcproj @@ -0,0 +1,460 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2005/sfml-window.vcproj b/build/vc2005/sfml-window.vcproj new file mode 100644 index 00000000..a3e7dd28 --- /dev/null +++ b/build/vc2005/sfml-window.vcproj @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/SFML.sln b/build/vc2008/SFML.sln new file mode 100644 index 00000000..50d4b35d --- /dev/null +++ b/build/vc2008/SFML.sln @@ -0,0 +1,112 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-audio", "sfml-audio.vcproj", "{B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-graphics", "sfml-graphics.vcproj", "{FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} = {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-main", "sfml-main.vcproj", "{2BD26A09-E1B6-42E2-A0D0-63987B76BB97}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-network", "sfml-network.vcproj", "{823DDC98-42D5-4A38-88CF-9DC06C788AE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-system", "sfml-system.vcproj", "{C061A27D-7CA0-4179-9869-672FA04A86A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sfml-window", "sfml-window.vcproj", "{0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}" + ProjectSection(ProjectDependencies) = postProject + {C061A27D-7CA0-4179-9869-672FA04A86A8} = {C061A27D-7CA0-4179-9869-672FA04A86A8} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug static|Win32 = Debug static|Win32 + Debug|Win32 = Debug|Win32 + Release DLL|Win32 = Release DLL|Win32 + Release static|Win32 = Release static|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug static|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.ActiveCfg = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Debug|Win32.Build.0 = Debug static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release static|Win32.Build.0 = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.ActiveCfg = Release static|Win32 + {B1BDA469-E6A7-4AF7-BDF9-EDDD7AD979A2}.Release|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug static|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.ActiveCfg = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Debug|Win32.Build.0 = Debug static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release static|Win32.Build.0 = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.ActiveCfg = Release static|Win32 + {FA4620B1-393A-4719-9BB4-3BC8CAA70C4B}.Release|Win32.Build.0 = Release static|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug DLL|Win32.ActiveCfg = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug DLL|Win32.Build.0 = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug static|Win32.ActiveCfg = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug static|Win32.Build.0 = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug|Win32.ActiveCfg = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Debug|Win32.Build.0 = Debug|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release DLL|Win32.ActiveCfg = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release DLL|Win32.Build.0 = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release static|Win32.ActiveCfg = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release static|Win32.Build.0 = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release|Win32.ActiveCfg = Release|Win32 + {2BD26A09-E1B6-42E2-A0D0-63987B76BB97}.Release|Win32.Build.0 = Release|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug static|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.ActiveCfg = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Debug|Win32.Build.0 = Debug static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release static|Win32.Build.0 = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.ActiveCfg = Release static|Win32 + {823DDC98-42D5-4A38-88CF-9DC06C788AE4}.Release|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug static|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.ActiveCfg = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Debug|Win32.Build.0 = Debug static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release static|Win32.Build.0 = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.ActiveCfg = Release static|Win32 + {C061A27D-7CA0-4179-9869-672FA04A86A8}.Release|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug static|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.ActiveCfg = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Debug|Win32.Build.0 = Debug static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release static|Win32.Build.0 = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.ActiveCfg = Release static|Win32 + {0F9CE5F0-4D89-4314-9147-8AAB1B8842ED}.Release|Win32.Build.0 = Release static|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/vc2008/sfml-audio.vcproj b/build/vc2008/sfml-audio.vcproj new file mode 100644 index 00000000..ffad02ee --- /dev/null +++ b/build/vc2008/sfml-audio.vcproj @@ -0,0 +1,491 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/sfml-graphics.vcproj b/build/vc2008/sfml-graphics.vcproj new file mode 100644 index 00000000..24a62a30 --- /dev/null +++ b/build/vc2008/sfml-graphics.vcproj @@ -0,0 +1,3454 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/sfml-main.vcproj b/build/vc2008/sfml-main.vcproj new file mode 100644 index 00000000..429ccbef --- /dev/null +++ b/build/vc2008/sfml-main.vcproj @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/sfml-network.vcproj b/build/vc2008/sfml-network.vcproj new file mode 100644 index 00000000..008d030b --- /dev/null +++ b/build/vc2008/sfml-network.vcproj @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/sfml-system.vcproj b/build/vc2008/sfml-system.vcproj new file mode 100644 index 00000000..aa6d8d7d --- /dev/null +++ b/build/vc2008/sfml-system.vcproj @@ -0,0 +1,437 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/sfml-window.vcproj b/build/vc2008/sfml-window.vcproj new file mode 100644 index 00000000..43b7c91e --- /dev/null +++ b/build/vc2008/sfml-window.vcproj @@ -0,0 +1,477 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/xcode/SFML-Info.plist b/build/xcode/SFML-Info.plist new file mode 100644 index 00000000..4ec0de6f --- /dev/null +++ b/build/xcode/SFML-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + SFML + CFBundleIdentifier + com.sfml.sfml + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/SFML-bare.xcodeproj/project.pbxproj b/build/xcode/SFML-bare.xcodeproj/project.pbxproj new file mode 100644 index 00000000..4cd20dd1 --- /dev/null +++ b/build/xcode/SFML-bare.xcodeproj/project.pbxproj @@ -0,0 +1,1392 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXAggregateTarget section */ + A0AD0A300E7663E1006E7E0D /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = A0AD0A460E766415006E7E0D /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + ); + dependencies = ( + A0AD0A340E7663F1006E7E0D /* PBXTargetDependency */, + A0AD0A360E7663F1006E7E0D /* PBXTargetDependency */, + A0AD0A380E7663F1006E7E0D /* PBXTargetDependency */, + A0AD0A3A0E7663F1006E7E0D /* PBXTargetDependency */, + A0AD0A3C0E7663F1006E7E0D /* PBXTargetDependency */, + ); + name = All; + productName = All; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + A018A2AF0EA21A2C005FFAC3 /* Http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A018A2AD0EA21A2C005FFAC3 /* Http.cpp */; }; + A018A2B00EA21A2C005FFAC3 /* Ftp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A018A2AE0EA21A2C005FFAC3 /* Ftp.cpp */; }; + A04C5A9D0EDDD88B00935061 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A940EDDD88B00935061 /* AppController.mm */; }; + A04C5A9E0EDDD88B00935061 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A950EDDD88B00935061 /* Joystick.cpp */; }; + A04C5A9F0EDDD88B00935061 /* VideoModeSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A970EDDD88B00935061 /* VideoModeSupport.cpp */; }; + A04C5AA00EDDD88B00935061 /* WindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A9A0EDDD88B00935061 /* WindowController.mm */; }; + A04C5AA10EDDD88B00935061 /* WindowImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A9C0EDDD88B00935061 /* WindowImplCocoa.mm */; }; + A0660EBA0E89051400D39DEB /* Clock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EA90E89051400D39DEB /* Clock.cpp */; }; + A0660EBC0E89051400D39DEB /* Lock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EAB0E89051400D39DEB /* Lock.cpp */; }; + A0660EBD0E89051400D39DEB /* Randomizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EAC0E89051400D39DEB /* Randomizer.cpp */; }; + A0660EBE0E89051400D39DEB /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EAD0E89051400D39DEB /* Unicode.cpp */; }; + A0660EBF0E89051400D39DEB /* Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EAF0E89051400D39DEB /* Mutex.cpp */; }; + A0660EC00E89051400D39DEB /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EB00E89051400D39DEB /* Platform.cpp */; }; + A0660EC20E89051400D39DEB /* Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EB20E89051400D39DEB /* Thread.cpp */; }; + A0660EC40E89051400D39DEB /* Sleep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EB40E89051400D39DEB /* Sleep.cpp */; }; + A0660ED30E89053100D39DEB /* IPAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EC90E89053100D39DEB /* IPAddress.cpp */; }; + A0660ED40E89053100D39DEB /* SelectorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660ECA0E89053100D39DEB /* SelectorBase.cpp */; }; + A0660ED60E89053100D39DEB /* SocketTCP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660ECC0E89053100D39DEB /* SocketTCP.cpp */; }; + A0660ED70E89053100D39DEB /* SocketHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660ECE0E89053100D39DEB /* SocketHelper.cpp */; }; + A0660ED90E89053100D39DEB /* Packet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660ED10E89053100D39DEB /* Packet.cpp */; }; + A0660EDA0E89053100D39DEB /* SocketUDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660ED20E89053100D39DEB /* SocketUDP.cpp */; }; + A0660EF00E89054E00D39DEB /* AudioDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EDB0E89054E00D39DEB /* AudioDevice.cpp */; }; + A0660EF20E89054E00D39DEB /* AudioResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EDD0E89054E00D39DEB /* AudioResource.cpp */; }; + A0660EF30E89054E00D39DEB /* Listener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EDE0E89054E00D39DEB /* Listener.cpp */; }; + A0660EF50E89054E00D39DEB /* Music.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE00E89054E00D39DEB /* Music.cpp */; }; + A0660EF70E89054E00D39DEB /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE20E89054E00D39DEB /* Sound.cpp */; }; + A0660EF80E89054E00D39DEB /* SoundBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE30E89054E00D39DEB /* SoundBuffer.cpp */; }; + A0660EF90E89054E00D39DEB /* SoundBufferRecorder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE40E89054E00D39DEB /* SoundBufferRecorder.cpp */; }; + A0660EFA0E89054E00D39DEB /* SoundFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE50E89054E00D39DEB /* SoundFile.cpp */; }; + A0660EFC0E89054E00D39DEB /* SoundFileDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE70E89054E00D39DEB /* SoundFileDefault.cpp */; }; + A0660EFE0E89054E00D39DEB /* SoundFileOgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EE90E89054E00D39DEB /* SoundFileOgg.cpp */; }; + A0660F000E89054E00D39DEB /* SoundRecorder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EEB0E89054E00D39DEB /* SoundRecorder.cpp */; }; + A0660F010E89054E00D39DEB /* SoundStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EEC0E89054E00D39DEB /* SoundStream.cpp */; }; + A0660F020E89054E00D39DEB /* stb_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660EEE0E89054E00D39DEB /* stb_vorbis.c */; }; + A0660F3A0E89056300D39DEB /* Context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F040E89056300D39DEB /* Context.cpp */; }; + A0660F3E0E89056300D39DEB /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F090E89056300D39DEB /* Input.cpp */; }; + A0660F5F0E89056300D39DEB /* VideoMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F2E0E89056300D39DEB /* VideoMode.cpp */; }; + A0660F670E89056300D39DEB /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F370E89056300D39DEB /* Window.cpp */; }; + A0660F680E89056300D39DEB /* WindowImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F380E89056300D39DEB /* WindowImpl.cpp */; }; + A0660FF10E89058900D39DEB /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F6B0E89058900D39DEB /* Color.cpp */; }; + A0660FF20E89058900D39DEB /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F6C0E89058900D39DEB /* Drawable.cpp */; }; + A0660FF30E89058900D39DEB /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F6D0E89058900D39DEB /* Font.cpp */; }; + A0660FF40E89058900D39DEB /* FontLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F6E0E89058900D39DEB /* FontLoader.cpp */; }; + A0660FF60E89058900D39DEB /* glew.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F710E89058900D39DEB /* glew.c */; }; + A0660FFA0E89058900D39DEB /* GraphicsContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F750E89058900D39DEB /* GraphicsContext.cpp */; }; + A0660FFC0E89058900D39DEB /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F770E89058900D39DEB /* Image.cpp */; }; + A0660FFD0E89058900D39DEB /* ImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660F780E89058900D39DEB /* ImageLoader.cpp */; }; + A06610000E89058900D39DEB /* jcapimin.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F7C0E89058900D39DEB /* jcapimin.c */; }; + A06610010E89058900D39DEB /* jcapistd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F7D0E89058900D39DEB /* jcapistd.c */; }; + A06610020E89058900D39DEB /* jccoefct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F7E0E89058900D39DEB /* jccoefct.c */; }; + A06610030E89058900D39DEB /* jccolor.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F7F0E89058900D39DEB /* jccolor.c */; }; + A06610040E89058900D39DEB /* jcdctmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F800E89058900D39DEB /* jcdctmgr.c */; }; + A06610050E89058900D39DEB /* jchuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F810E89058900D39DEB /* jchuff.c */; }; + A06610070E89058900D39DEB /* jcinit.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F830E89058900D39DEB /* jcinit.c */; }; + A06610080E89058900D39DEB /* jcmainct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F840E89058900D39DEB /* jcmainct.c */; }; + A06610090E89058900D39DEB /* jcmarker.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F850E89058900D39DEB /* jcmarker.c */; }; + A066100A0E89058900D39DEB /* jcmaster.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F860E89058900D39DEB /* jcmaster.c */; }; + A066100B0E89058900D39DEB /* jcomapi.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F870E89058900D39DEB /* jcomapi.c */; }; + A066100D0E89058900D39DEB /* jcparam.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F890E89058900D39DEB /* jcparam.c */; }; + A066100E0E89058900D39DEB /* jcphuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F8A0E89058900D39DEB /* jcphuff.c */; }; + A066100F0E89058900D39DEB /* jcprepct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F8B0E89058900D39DEB /* jcprepct.c */; }; + A06610100E89058900D39DEB /* jcsample.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F8C0E89058900D39DEB /* jcsample.c */; }; + A06610110E89058900D39DEB /* jctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F8D0E89058900D39DEB /* jctrans.c */; }; + A06610120E89058900D39DEB /* jdapimin.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F8E0E89058900D39DEB /* jdapimin.c */; }; + A06610130E89058900D39DEB /* jdapistd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F8F0E89058900D39DEB /* jdapistd.c */; }; + A06610140E89058900D39DEB /* jdatadst.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F900E89058900D39DEB /* jdatadst.c */; }; + A06610150E89058900D39DEB /* jdatasrc.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F910E89058900D39DEB /* jdatasrc.c */; }; + A06610160E89058900D39DEB /* jdcoefct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F920E89058900D39DEB /* jdcoefct.c */; }; + A06610170E89058900D39DEB /* jdcolor.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F930E89058900D39DEB /* jdcolor.c */; }; + A06610190E89058900D39DEB /* jddctmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F950E89058900D39DEB /* jddctmgr.c */; }; + A066101A0E89058900D39DEB /* jdhuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F960E89058900D39DEB /* jdhuff.c */; }; + A066101C0E89058900D39DEB /* jdinput.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F980E89058900D39DEB /* jdinput.c */; }; + A066101D0E89058900D39DEB /* jdmainct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F990E89058900D39DEB /* jdmainct.c */; }; + A066101E0E89058900D39DEB /* jdmarker.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F9A0E89058900D39DEB /* jdmarker.c */; }; + A066101F0E89058900D39DEB /* jdmaster.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F9B0E89058900D39DEB /* jdmaster.c */; }; + A06610200E89058900D39DEB /* jdmerge.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F9C0E89058900D39DEB /* jdmerge.c */; }; + A06610210E89058900D39DEB /* jdphuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F9D0E89058900D39DEB /* jdphuff.c */; }; + A06610220E89058900D39DEB /* jdpostct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F9E0E89058900D39DEB /* jdpostct.c */; }; + A06610230E89058900D39DEB /* jdsample.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660F9F0E89058900D39DEB /* jdsample.c */; }; + A06610240E89058900D39DEB /* jdtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA00E89058900D39DEB /* jdtrans.c */; }; + A06610250E89058900D39DEB /* jerror.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA10E89058900D39DEB /* jerror.c */; }; + A06610270E89058900D39DEB /* jfdctflt.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA30E89058900D39DEB /* jfdctflt.c */; }; + A06610280E89058900D39DEB /* jfdctfst.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA40E89058900D39DEB /* jfdctfst.c */; }; + A06610290E89058900D39DEB /* jfdctint.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA50E89058900D39DEB /* jfdctint.c */; }; + A066102A0E89058900D39DEB /* jidctflt.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA60E89058900D39DEB /* jidctflt.c */; }; + A066102B0E89058900D39DEB /* jidctfst.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA70E89058900D39DEB /* jidctfst.c */; }; + A066102C0E89058900D39DEB /* jidctint.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA80E89058900D39DEB /* jidctint.c */; }; + A066102D0E89058900D39DEB /* jidctred.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FA90E89058900D39DEB /* jidctred.c */; }; + A066102F0E89058900D39DEB /* jmemmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FAB0E89058900D39DEB /* jmemmgr.c */; }; + A06610300E89058900D39DEB /* jmemnobs.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FAC0E89058900D39DEB /* jmemnobs.c */; }; + A06610350E89058900D39DEB /* jquant1.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FB10E89058900D39DEB /* jquant1.c */; }; + A06610360E89058900D39DEB /* jquant2.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FB20E89058900D39DEB /* jquant2.c */; }; + A06610370E89058900D39DEB /* jutils.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FB30E89058900D39DEB /* jutils.c */; }; + A06610390E89058900D39DEB /* png.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FB60E89058900D39DEB /* png.c */; }; + A066103C0E89058900D39DEB /* pngerror.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FB90E89058900D39DEB /* pngerror.c */; }; + A066103D0E89058900D39DEB /* pnggccrd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FBA0E89058900D39DEB /* pnggccrd.c */; }; + A066103E0E89058900D39DEB /* pngget.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FBB0E89058900D39DEB /* pngget.c */; }; + A066103F0E89058900D39DEB /* pngmem.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FBC0E89058900D39DEB /* pngmem.c */; }; + A06610400E89058900D39DEB /* pngpread.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FBD0E89058900D39DEB /* pngpread.c */; }; + A06610410E89058900D39DEB /* pngread.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FBE0E89058900D39DEB /* pngread.c */; }; + A06610420E89058900D39DEB /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FBF0E89058900D39DEB /* pngrio.c */; }; + A06610430E89058900D39DEB /* pngrtran.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC00E89058900D39DEB /* pngrtran.c */; }; + A06610440E89058900D39DEB /* pngrutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC10E89058900D39DEB /* pngrutil.c */; }; + A06610450E89058900D39DEB /* pngset.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC20E89058900D39DEB /* pngset.c */; }; + A06610460E89058900D39DEB /* pngtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC30E89058900D39DEB /* pngtrans.c */; }; + A06610470E89058900D39DEB /* pngvcrd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC40E89058900D39DEB /* pngvcrd.c */; }; + A06610480E89058900D39DEB /* pngwio.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC50E89058900D39DEB /* pngwio.c */; }; + A06610490E89058900D39DEB /* pngwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC60E89058900D39DEB /* pngwrite.c */; }; + A066104A0E89058900D39DEB /* pngwtran.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC70E89058900D39DEB /* pngwtran.c */; }; + A066104B0E89058900D39DEB /* pngwutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FC80E89058900D39DEB /* pngwutil.c */; }; + A066104D0E89058900D39DEB /* Matrix3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FCA0E89058900D39DEB /* Matrix3.cpp */; }; + A066104E0E89058900D39DEB /* PostFX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FCB0E89058900D39DEB /* PostFX.cpp */; }; + A066104F0E89058900D39DEB /* RenderTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FCC0E89058900D39DEB /* RenderTarget.cpp */; }; + A06610500E89058900D39DEB /* RenderWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FCD0E89058900D39DEB /* RenderWindow.cpp */; }; + A06610510E89058900D39DEB /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FCE0E89058900D39DEB /* Shape.cpp */; }; + A06610520E89058900D39DEB /* image_DXT.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FD00E89058900D39DEB /* image_DXT.c */; }; + A06610540E89058900D39DEB /* SOIL.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FD20E89058900D39DEB /* SOIL.c */; }; + A06610560E89058900D39DEB /* stb_image_aug.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FD40E89058900D39DEB /* stb_image_aug.c */; }; + A066105A0E89058900D39DEB /* Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FD80E89058900D39DEB /* Sprite.cpp */; }; + A066105B0E89058900D39DEB /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FD90E89058900D39DEB /* String.cpp */; }; + A066105C0E89058900D39DEB /* View.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660FDA0E89058900D39DEB /* View.cpp */; }; + A066105D0E89058900D39DEB /* adler32.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FDC0E89058900D39DEB /* adler32.c */; }; + A066105E0E89058900D39DEB /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FDD0E89058900D39DEB /* compress.c */; }; + A066105F0E89058900D39DEB /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FDE0E89058900D39DEB /* crc32.c */; }; + A06610610E89058900D39DEB /* deflate.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FE00E89058900D39DEB /* deflate.c */; }; + A06610630E89058900D39DEB /* inffast.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FE20E89058900D39DEB /* inffast.c */; }; + A06610660E89058900D39DEB /* inflate.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FE50E89058900D39DEB /* inflate.c */; }; + A06610680E89058900D39DEB /* inftrees.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FE70E89058900D39DEB /* inftrees.c */; }; + A066106A0E89058900D39DEB /* trees.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FE90E89058900D39DEB /* trees.c */; }; + A066106C0E89058900D39DEB /* uncompr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FEB0E89058900D39DEB /* uncompr.c */; }; + A066106F0E89058900D39DEB /* zutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A0660FEE0E89058900D39DEB /* zutil.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + A0AD0A330E7663F1006E7E0D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A01269590E63189C00B96A5D /* Project object */; + proxyType = 1; + remoteGlobalIDString = A01269650E6318C000B96A5D; + remoteInfo = "sfml-system"; + }; + A0AD0A350E7663F1006E7E0D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A01269590E63189C00B96A5D /* Project object */; + proxyType = 1; + remoteGlobalIDString = A012696E0E6318FE00B96A5D; + remoteInfo = "sfml-network"; + }; + A0AD0A370E7663F1006E7E0D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A01269590E63189C00B96A5D /* Project object */; + proxyType = 1; + remoteGlobalIDString = A01269750E63190F00B96A5D; + remoteInfo = "sfml-audio"; + }; + A0AD0A390E7663F1006E7E0D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A01269590E63189C00B96A5D /* Project object */; + proxyType = 1; + remoteGlobalIDString = A012697C0E63192000B96A5D; + remoteInfo = "sfml-window"; + }; + A0AD0A3B0E7663F1006E7E0D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A01269590E63189C00B96A5D /* Project object */; + proxyType = 1; + remoteGlobalIDString = A01269830E63192B00B96A5D; + remoteInfo = "sfml-graphics"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + A01269660E6318C000B96A5D /* libsfml-system.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-system.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + A012696F0E6318FE00B96A5D /* libsfml-network.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-network.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + A01269760E63190F00B96A5D /* libsfml-audio.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-audio.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + A012697D0E63192000B96A5D /* libsfml-window.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-window.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + A01269840E63192B00B96A5D /* libsfml-graphics.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-graphics.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + A018A2AD0EA21A2C005FFAC3 /* Http.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Http.cpp; path = ../../src/SFML/Network/Http.cpp; sourceTree = SOURCE_ROOT; }; + A018A2AE0EA21A2C005FFAC3 /* Ftp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ftp.cpp; path = ../../src/SFML/Network/Ftp.cpp; sourceTree = SOURCE_ROOT; }; + A04C5A930EDDD88B00935061 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = ../../src/SFML/Window/Cocoa/AppController.h; sourceTree = SOURCE_ROOT; }; + A04C5A940EDDD88B00935061 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = AppController.mm; path = ../../src/SFML/Window/Cocoa/AppController.mm; sourceTree = SOURCE_ROOT; }; + A04C5A950EDDD88B00935061 /* Joystick.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Joystick.cpp; path = ../../src/SFML/Window/Cocoa/Joystick.cpp; sourceTree = SOURCE_ROOT; }; + A04C5A960EDDD88B00935061 /* Joystick.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Joystick.hpp; path = ../../src/SFML/Window/Cocoa/Joystick.hpp; sourceTree = SOURCE_ROOT; }; + A04C5A970EDDD88B00935061 /* VideoModeSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VideoModeSupport.cpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.cpp; sourceTree = SOURCE_ROOT; }; + A04C5A980EDDD88B00935061 /* VideoModeSupport.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoModeSupport.hpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.hpp; sourceTree = SOURCE_ROOT; }; + A04C5A990EDDD88B00935061 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WindowController.h; path = ../../src/SFML/Window/Cocoa/WindowController.h; sourceTree = SOURCE_ROOT; }; + A04C5A9A0EDDD88B00935061 /* WindowController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowController.mm; path = ../../src/SFML/Window/Cocoa/WindowController.mm; sourceTree = SOURCE_ROOT; }; + A04C5A9B0EDDD88B00935061 /* WindowImplCocoa.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowImplCocoa.hpp; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.hpp; sourceTree = SOURCE_ROOT; }; + A04C5A9C0EDDD88B00935061 /* WindowImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowImplCocoa.mm; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.mm; sourceTree = SOURCE_ROOT; }; + A0660EA90E89051400D39DEB /* Clock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Clock.cpp; path = ../../src/SFML/System/Clock.cpp; sourceTree = SOURCE_ROOT; }; + A0660EAA0E89051400D39DEB /* Platform.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Platform.hpp; path = ../../src/SFML/System/Platform.hpp; sourceTree = SOURCE_ROOT; }; + A0660EAB0E89051400D39DEB /* Lock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Lock.cpp; path = ../../src/SFML/System/Lock.cpp; sourceTree = SOURCE_ROOT; }; + A0660EAC0E89051400D39DEB /* Randomizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Randomizer.cpp; path = ../../src/SFML/System/Randomizer.cpp; sourceTree = SOURCE_ROOT; }; + A0660EAD0E89051400D39DEB /* Unicode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Unicode.cpp; path = ../../src/SFML/System/Unicode.cpp; sourceTree = SOURCE_ROOT; }; + A0660EAF0E89051400D39DEB /* Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Mutex.cpp; path = ../../src/SFML/System/Unix/Mutex.cpp; sourceTree = SOURCE_ROOT; }; + A0660EB00E89051400D39DEB /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Platform.cpp; path = ../../src/SFML/System/Unix/Platform.cpp; sourceTree = SOURCE_ROOT; }; + A0660EB10E89051400D39DEB /* Platform.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Platform.hpp; path = ../../src/SFML/System/Unix/Platform.hpp; sourceTree = SOURCE_ROOT; }; + A0660EB20E89051400D39DEB /* Thread.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Thread.cpp; path = ../../src/SFML/System/Unix/Thread.cpp; sourceTree = SOURCE_ROOT; }; + A0660EB40E89051400D39DEB /* Sleep.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sleep.cpp; path = ../../src/SFML/System/Sleep.cpp; sourceTree = SOURCE_ROOT; }; + A0660EC90E89053100D39DEB /* IPAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = IPAddress.cpp; path = ../../src/SFML/Network/IPAddress.cpp; sourceTree = SOURCE_ROOT; }; + A0660ECA0E89053100D39DEB /* SelectorBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SelectorBase.cpp; path = ../../src/SFML/Network/SelectorBase.cpp; sourceTree = SOURCE_ROOT; }; + A0660ECC0E89053100D39DEB /* SocketTCP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SocketTCP.cpp; path = ../../src/SFML/Network/SocketTCP.cpp; sourceTree = SOURCE_ROOT; }; + A0660ECE0E89053100D39DEB /* SocketHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SocketHelper.cpp; path = ../../src/SFML/Network/Unix/SocketHelper.cpp; sourceTree = SOURCE_ROOT; }; + A0660ED10E89053100D39DEB /* Packet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Packet.cpp; path = ../../src/SFML/Network/Packet.cpp; sourceTree = SOURCE_ROOT; }; + A0660ED20E89053100D39DEB /* SocketUDP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SocketUDP.cpp; path = ../../src/SFML/Network/SocketUDP.cpp; sourceTree = SOURCE_ROOT; }; + A0660EDB0E89054E00D39DEB /* AudioDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AudioDevice.cpp; path = ../../src/SFML/Audio/AudioDevice.cpp; sourceTree = SOURCE_ROOT; }; + A0660EDC0E89054E00D39DEB /* AudioDevice.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = AudioDevice.hpp; path = ../../src/SFML/Audio/AudioDevice.hpp; sourceTree = SOURCE_ROOT; }; + A0660EDD0E89054E00D39DEB /* AudioResource.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AudioResource.cpp; path = ../../src/SFML/Audio/AudioResource.cpp; sourceTree = SOURCE_ROOT; }; + A0660EDE0E89054E00D39DEB /* Listener.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Listener.cpp; path = ../../src/SFML/Audio/Listener.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE00E89054E00D39DEB /* Music.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Music.cpp; path = ../../src/SFML/Audio/Music.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE10E89054E00D39DEB /* OpenAL.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = OpenAL.hpp; path = ../../src/SFML/Audio/OpenAL.hpp; sourceTree = SOURCE_ROOT; }; + A0660EE20E89054E00D39DEB /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sound.cpp; path = ../../src/SFML/Audio/Sound.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE30E89054E00D39DEB /* SoundBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundBuffer.cpp; path = ../../src/SFML/Audio/SoundBuffer.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE40E89054E00D39DEB /* SoundBufferRecorder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundBufferRecorder.cpp; path = ../../src/SFML/Audio/SoundBufferRecorder.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE50E89054E00D39DEB /* SoundFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundFile.cpp; path = ../../src/SFML/Audio/SoundFile.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE60E89054E00D39DEB /* SoundFile.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundFile.hpp; path = ../../src/SFML/Audio/SoundFile.hpp; sourceTree = SOURCE_ROOT; }; + A0660EE70E89054E00D39DEB /* SoundFileDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundFileDefault.cpp; path = ../../src/SFML/Audio/SoundFileDefault.cpp; sourceTree = SOURCE_ROOT; }; + A0660EE80E89054E00D39DEB /* SoundFileDefault.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundFileDefault.hpp; path = ../../src/SFML/Audio/SoundFileDefault.hpp; sourceTree = SOURCE_ROOT; }; + A0660EE90E89054E00D39DEB /* SoundFileOgg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundFileOgg.cpp; path = ../../src/SFML/Audio/SoundFileOgg.cpp; sourceTree = SOURCE_ROOT; }; + A0660EEA0E89054E00D39DEB /* SoundFileOgg.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundFileOgg.hpp; path = ../../src/SFML/Audio/SoundFileOgg.hpp; sourceTree = SOURCE_ROOT; }; + A0660EEB0E89054E00D39DEB /* SoundRecorder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundRecorder.cpp; path = ../../src/SFML/Audio/SoundRecorder.cpp; sourceTree = SOURCE_ROOT; }; + A0660EEC0E89054E00D39DEB /* SoundStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundStream.cpp; path = ../../src/SFML/Audio/SoundStream.cpp; sourceTree = SOURCE_ROOT; }; + A0660EEE0E89054E00D39DEB /* stb_vorbis.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stb_vorbis.c; path = ../../src/SFML/Audio/stb_vorbis/stb_vorbis.c; sourceTree = SOURCE_ROOT; }; + A0660EEF0E89054E00D39DEB /* stb_vorbis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stb_vorbis.h; path = ../../src/SFML/Audio/stb_vorbis/stb_vorbis.h; sourceTree = SOURCE_ROOT; }; + A0660F040E89056300D39DEB /* Context.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Context.cpp; path = ../../src/SFML/Window/Context.cpp; sourceTree = SOURCE_ROOT; }; + A0660F090E89056300D39DEB /* Input.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Input.cpp; path = ../../src/SFML/Window/Input.cpp; sourceTree = SOURCE_ROOT; }; + A0660F0A0E89056300D39DEB /* Joystick.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Joystick.hpp; path = ../../src/SFML/Window/Joystick.hpp; sourceTree = SOURCE_ROOT; }; + A0660F2E0E89056300D39DEB /* VideoMode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VideoMode.cpp; path = ../../src/SFML/Window/VideoMode.cpp; sourceTree = SOURCE_ROOT; }; + A0660F2F0E89056300D39DEB /* VideoModeSupport.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoModeSupport.hpp; path = ../../src/SFML/Window/VideoModeSupport.hpp; sourceTree = SOURCE_ROOT; }; + A0660F370E89056300D39DEB /* Window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Window.cpp; path = ../../src/SFML/Window/Window.cpp; sourceTree = SOURCE_ROOT; }; + A0660F380E89056300D39DEB /* WindowImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = WindowImpl.cpp; path = ../../src/SFML/Window/WindowImpl.cpp; sourceTree = SOURCE_ROOT; }; + A0660F390E89056300D39DEB /* WindowImpl.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowImpl.hpp; path = ../../src/SFML/Window/WindowImpl.hpp; sourceTree = SOURCE_ROOT; }; + A0660F6A0E89058900D39DEB /* Arial.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Arial.hpp; path = ../../src/SFML/Graphics/Arial.hpp; sourceTree = SOURCE_ROOT; }; + A0660F6B0E89058900D39DEB /* Color.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Color.cpp; path = ../../src/SFML/Graphics/Color.cpp; sourceTree = SOURCE_ROOT; }; + A0660F6C0E89058900D39DEB /* Drawable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Drawable.cpp; path = ../../src/SFML/Graphics/Drawable.cpp; sourceTree = SOURCE_ROOT; }; + A0660F6D0E89058900D39DEB /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Font.cpp; path = ../../src/SFML/Graphics/Font.cpp; sourceTree = SOURCE_ROOT; }; + A0660F6E0E89058900D39DEB /* FontLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = FontLoader.cpp; path = ../../src/SFML/Graphics/FontLoader.cpp; sourceTree = SOURCE_ROOT; }; + A0660F6F0E89058900D39DEB /* FontLoader.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = FontLoader.hpp; path = ../../src/SFML/Graphics/FontLoader.hpp; sourceTree = SOURCE_ROOT; }; + A0660F710E89058900D39DEB /* glew.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = glew.c; path = ../../src/SFML/Graphics/GLEW/glew.c; sourceTree = SOURCE_ROOT; }; + A0660F720E89058900D39DEB /* glew.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = glew.h; path = ../../src/SFML/Graphics/GLEW/glew.h; sourceTree = SOURCE_ROOT; }; + A0660F730E89058900D39DEB /* glxew.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = glxew.h; path = ../../src/SFML/Graphics/GLEW/glxew.h; sourceTree = SOURCE_ROOT; }; + A0660F740E89058900D39DEB /* wglew.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = wglew.h; path = ../../src/SFML/Graphics/GLEW/wglew.h; sourceTree = SOURCE_ROOT; }; + A0660F750E89058900D39DEB /* GraphicsContext.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = GraphicsContext.cpp; path = ../../src/SFML/Graphics/GraphicsContext.cpp; sourceTree = SOURCE_ROOT; }; + A0660F760E89058900D39DEB /* GraphicsContext.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = GraphicsContext.hpp; path = ../../src/SFML/Graphics/GraphicsContext.hpp; sourceTree = SOURCE_ROOT; }; + A0660F770E89058900D39DEB /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Image.cpp; path = ../../src/SFML/Graphics/Image.cpp; sourceTree = SOURCE_ROOT; }; + A0660F780E89058900D39DEB /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageLoader.cpp; path = ../../src/SFML/Graphics/ImageLoader.cpp; sourceTree = SOURCE_ROOT; }; + A0660F790E89058900D39DEB /* ImageLoader.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = ImageLoader.hpp; path = ../../src/SFML/Graphics/ImageLoader.hpp; sourceTree = SOURCE_ROOT; }; + A0660F7B0E89058900D39DEB /* cderror.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cderror.h; path = ../../src/SFML/Graphics/libjpeg/cderror.h; sourceTree = SOURCE_ROOT; }; + A0660F7C0E89058900D39DEB /* jcapimin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcapimin.c; path = ../../src/SFML/Graphics/libjpeg/jcapimin.c; sourceTree = SOURCE_ROOT; }; + A0660F7D0E89058900D39DEB /* jcapistd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcapistd.c; path = ../../src/SFML/Graphics/libjpeg/jcapistd.c; sourceTree = SOURCE_ROOT; }; + A0660F7E0E89058900D39DEB /* jccoefct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jccoefct.c; path = ../../src/SFML/Graphics/libjpeg/jccoefct.c; sourceTree = SOURCE_ROOT; }; + A0660F7F0E89058900D39DEB /* jccolor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jccolor.c; path = ../../src/SFML/Graphics/libjpeg/jccolor.c; sourceTree = SOURCE_ROOT; }; + A0660F800E89058900D39DEB /* jcdctmgr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcdctmgr.c; path = ../../src/SFML/Graphics/libjpeg/jcdctmgr.c; sourceTree = SOURCE_ROOT; }; + A0660F810E89058900D39DEB /* jchuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jchuff.c; path = ../../src/SFML/Graphics/libjpeg/jchuff.c; sourceTree = SOURCE_ROOT; }; + A0660F820E89058900D39DEB /* jchuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jchuff.h; path = ../../src/SFML/Graphics/libjpeg/jchuff.h; sourceTree = SOURCE_ROOT; }; + A0660F830E89058900D39DEB /* jcinit.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcinit.c; path = ../../src/SFML/Graphics/libjpeg/jcinit.c; sourceTree = SOURCE_ROOT; }; + A0660F840E89058900D39DEB /* jcmainct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcmainct.c; path = ../../src/SFML/Graphics/libjpeg/jcmainct.c; sourceTree = SOURCE_ROOT; }; + A0660F850E89058900D39DEB /* jcmarker.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcmarker.c; path = ../../src/SFML/Graphics/libjpeg/jcmarker.c; sourceTree = SOURCE_ROOT; }; + A0660F860E89058900D39DEB /* jcmaster.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcmaster.c; path = ../../src/SFML/Graphics/libjpeg/jcmaster.c; sourceTree = SOURCE_ROOT; }; + A0660F870E89058900D39DEB /* jcomapi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcomapi.c; path = ../../src/SFML/Graphics/libjpeg/jcomapi.c; sourceTree = SOURCE_ROOT; }; + A0660F880E89058900D39DEB /* jconfig.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jconfig.h; path = ../../src/SFML/Graphics/libjpeg/jconfig.h; sourceTree = SOURCE_ROOT; }; + A0660F890E89058900D39DEB /* jcparam.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcparam.c; path = ../../src/SFML/Graphics/libjpeg/jcparam.c; sourceTree = SOURCE_ROOT; }; + A0660F8A0E89058900D39DEB /* jcphuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcphuff.c; path = ../../src/SFML/Graphics/libjpeg/jcphuff.c; sourceTree = SOURCE_ROOT; }; + A0660F8B0E89058900D39DEB /* jcprepct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcprepct.c; path = ../../src/SFML/Graphics/libjpeg/jcprepct.c; sourceTree = SOURCE_ROOT; }; + A0660F8C0E89058900D39DEB /* jcsample.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcsample.c; path = ../../src/SFML/Graphics/libjpeg/jcsample.c; sourceTree = SOURCE_ROOT; }; + A0660F8D0E89058900D39DEB /* jctrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jctrans.c; path = ../../src/SFML/Graphics/libjpeg/jctrans.c; sourceTree = SOURCE_ROOT; }; + A0660F8E0E89058900D39DEB /* jdapimin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdapimin.c; path = ../../src/SFML/Graphics/libjpeg/jdapimin.c; sourceTree = SOURCE_ROOT; }; + A0660F8F0E89058900D39DEB /* jdapistd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdapistd.c; path = ../../src/SFML/Graphics/libjpeg/jdapistd.c; sourceTree = SOURCE_ROOT; }; + A0660F900E89058900D39DEB /* jdatadst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdatadst.c; path = ../../src/SFML/Graphics/libjpeg/jdatadst.c; sourceTree = SOURCE_ROOT; }; + A0660F910E89058900D39DEB /* jdatasrc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdatasrc.c; path = ../../src/SFML/Graphics/libjpeg/jdatasrc.c; sourceTree = SOURCE_ROOT; }; + A0660F920E89058900D39DEB /* jdcoefct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdcoefct.c; path = ../../src/SFML/Graphics/libjpeg/jdcoefct.c; sourceTree = SOURCE_ROOT; }; + A0660F930E89058900D39DEB /* jdcolor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdcolor.c; path = ../../src/SFML/Graphics/libjpeg/jdcolor.c; sourceTree = SOURCE_ROOT; }; + A0660F940E89058900D39DEB /* jdct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jdct.h; path = ../../src/SFML/Graphics/libjpeg/jdct.h; sourceTree = SOURCE_ROOT; }; + A0660F950E89058900D39DEB /* jddctmgr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jddctmgr.c; path = ../../src/SFML/Graphics/libjpeg/jddctmgr.c; sourceTree = SOURCE_ROOT; }; + A0660F960E89058900D39DEB /* jdhuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdhuff.c; path = ../../src/SFML/Graphics/libjpeg/jdhuff.c; sourceTree = SOURCE_ROOT; }; + A0660F970E89058900D39DEB /* jdhuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jdhuff.h; path = ../../src/SFML/Graphics/libjpeg/jdhuff.h; sourceTree = SOURCE_ROOT; }; + A0660F980E89058900D39DEB /* jdinput.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdinput.c; path = ../../src/SFML/Graphics/libjpeg/jdinput.c; sourceTree = SOURCE_ROOT; }; + A0660F990E89058900D39DEB /* jdmainct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmainct.c; path = ../../src/SFML/Graphics/libjpeg/jdmainct.c; sourceTree = SOURCE_ROOT; }; + A0660F9A0E89058900D39DEB /* jdmarker.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmarker.c; path = ../../src/SFML/Graphics/libjpeg/jdmarker.c; sourceTree = SOURCE_ROOT; }; + A0660F9B0E89058900D39DEB /* jdmaster.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmaster.c; path = ../../src/SFML/Graphics/libjpeg/jdmaster.c; sourceTree = SOURCE_ROOT; }; + A0660F9C0E89058900D39DEB /* jdmerge.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmerge.c; path = ../../src/SFML/Graphics/libjpeg/jdmerge.c; sourceTree = SOURCE_ROOT; }; + A0660F9D0E89058900D39DEB /* jdphuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdphuff.c; path = ../../src/SFML/Graphics/libjpeg/jdphuff.c; sourceTree = SOURCE_ROOT; }; + A0660F9E0E89058900D39DEB /* jdpostct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdpostct.c; path = ../../src/SFML/Graphics/libjpeg/jdpostct.c; sourceTree = SOURCE_ROOT; }; + A0660F9F0E89058900D39DEB /* jdsample.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdsample.c; path = ../../src/SFML/Graphics/libjpeg/jdsample.c; sourceTree = SOURCE_ROOT; }; + A0660FA00E89058900D39DEB /* jdtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdtrans.c; path = ../../src/SFML/Graphics/libjpeg/jdtrans.c; sourceTree = SOURCE_ROOT; }; + A0660FA10E89058900D39DEB /* jerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jerror.c; path = ../../src/SFML/Graphics/libjpeg/jerror.c; sourceTree = SOURCE_ROOT; }; + A0660FA20E89058900D39DEB /* jerror.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jerror.h; path = ../../src/SFML/Graphics/libjpeg/jerror.h; sourceTree = SOURCE_ROOT; }; + A0660FA30E89058900D39DEB /* jfdctflt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jfdctflt.c; path = ../../src/SFML/Graphics/libjpeg/jfdctflt.c; sourceTree = SOURCE_ROOT; }; + A0660FA40E89058900D39DEB /* jfdctfst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jfdctfst.c; path = ../../src/SFML/Graphics/libjpeg/jfdctfst.c; sourceTree = SOURCE_ROOT; }; + A0660FA50E89058900D39DEB /* jfdctint.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jfdctint.c; path = ../../src/SFML/Graphics/libjpeg/jfdctint.c; sourceTree = SOURCE_ROOT; }; + A0660FA60E89058900D39DEB /* jidctflt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctflt.c; path = ../../src/SFML/Graphics/libjpeg/jidctflt.c; sourceTree = SOURCE_ROOT; }; + A0660FA70E89058900D39DEB /* jidctfst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctfst.c; path = ../../src/SFML/Graphics/libjpeg/jidctfst.c; sourceTree = SOURCE_ROOT; }; + A0660FA80E89058900D39DEB /* jidctint.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctint.c; path = ../../src/SFML/Graphics/libjpeg/jidctint.c; sourceTree = SOURCE_ROOT; }; + A0660FA90E89058900D39DEB /* jidctred.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctred.c; path = ../../src/SFML/Graphics/libjpeg/jidctred.c; sourceTree = SOURCE_ROOT; }; + A0660FAA0E89058900D39DEB /* jinclude.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jinclude.h; path = ../../src/SFML/Graphics/libjpeg/jinclude.h; sourceTree = SOURCE_ROOT; }; + A0660FAB0E89058900D39DEB /* jmemmgr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jmemmgr.c; path = ../../src/SFML/Graphics/libjpeg/jmemmgr.c; sourceTree = SOURCE_ROOT; }; + A0660FAC0E89058900D39DEB /* jmemnobs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jmemnobs.c; path = ../../src/SFML/Graphics/libjpeg/jmemnobs.c; sourceTree = SOURCE_ROOT; }; + A0660FAD0E89058900D39DEB /* jmemsys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jmemsys.h; path = ../../src/SFML/Graphics/libjpeg/jmemsys.h; sourceTree = SOURCE_ROOT; }; + A0660FAE0E89058900D39DEB /* jmorecfg.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jmorecfg.h; path = ../../src/SFML/Graphics/libjpeg/jmorecfg.h; sourceTree = SOURCE_ROOT; }; + A0660FAF0E89058900D39DEB /* jpegint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jpegint.h; path = ../../src/SFML/Graphics/libjpeg/jpegint.h; sourceTree = SOURCE_ROOT; }; + A0660FB00E89058900D39DEB /* jpeglib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jpeglib.h; path = ../../src/SFML/Graphics/libjpeg/jpeglib.h; sourceTree = SOURCE_ROOT; }; + A0660FB10E89058900D39DEB /* jquant1.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jquant1.c; path = ../../src/SFML/Graphics/libjpeg/jquant1.c; sourceTree = SOURCE_ROOT; }; + A0660FB20E89058900D39DEB /* jquant2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jquant2.c; path = ../../src/SFML/Graphics/libjpeg/jquant2.c; sourceTree = SOURCE_ROOT; }; + A0660FB30E89058900D39DEB /* jutils.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jutils.c; path = ../../src/SFML/Graphics/libjpeg/jutils.c; sourceTree = SOURCE_ROOT; }; + A0660FB40E89058900D39DEB /* jversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jversion.h; path = ../../src/SFML/Graphics/libjpeg/jversion.h; sourceTree = SOURCE_ROOT; }; + A0660FB60E89058900D39DEB /* png.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = png.c; path = ../../src/SFML/Graphics/libpng/png.c; sourceTree = SOURCE_ROOT; }; + A0660FB70E89058900D39DEB /* png.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = png.h; path = ../../src/SFML/Graphics/libpng/png.h; sourceTree = SOURCE_ROOT; }; + A0660FB80E89058900D39DEB /* pngconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pngconf.h; path = ../../src/SFML/Graphics/libpng/pngconf.h; sourceTree = SOURCE_ROOT; }; + A0660FB90E89058900D39DEB /* pngerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngerror.c; path = ../../src/SFML/Graphics/libpng/pngerror.c; sourceTree = SOURCE_ROOT; }; + A0660FBA0E89058900D39DEB /* pnggccrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pnggccrd.c; path = ../../src/SFML/Graphics/libpng/pnggccrd.c; sourceTree = SOURCE_ROOT; }; + A0660FBB0E89058900D39DEB /* pngget.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngget.c; path = ../../src/SFML/Graphics/libpng/pngget.c; sourceTree = SOURCE_ROOT; }; + A0660FBC0E89058900D39DEB /* pngmem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngmem.c; path = ../../src/SFML/Graphics/libpng/pngmem.c; sourceTree = SOURCE_ROOT; }; + A0660FBD0E89058900D39DEB /* pngpread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngpread.c; path = ../../src/SFML/Graphics/libpng/pngpread.c; sourceTree = SOURCE_ROOT; }; + A0660FBE0E89058900D39DEB /* pngread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngread.c; path = ../../src/SFML/Graphics/libpng/pngread.c; sourceTree = SOURCE_ROOT; }; + A0660FBF0E89058900D39DEB /* pngrio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrio.c; path = ../../src/SFML/Graphics/libpng/pngrio.c; sourceTree = SOURCE_ROOT; }; + A0660FC00E89058900D39DEB /* pngrtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrtran.c; path = ../../src/SFML/Graphics/libpng/pngrtran.c; sourceTree = SOURCE_ROOT; }; + A0660FC10E89058900D39DEB /* pngrutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrutil.c; path = ../../src/SFML/Graphics/libpng/pngrutil.c; sourceTree = SOURCE_ROOT; }; + A0660FC20E89058900D39DEB /* pngset.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngset.c; path = ../../src/SFML/Graphics/libpng/pngset.c; sourceTree = SOURCE_ROOT; }; + A0660FC30E89058900D39DEB /* pngtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngtrans.c; path = ../../src/SFML/Graphics/libpng/pngtrans.c; sourceTree = SOURCE_ROOT; }; + A0660FC40E89058900D39DEB /* pngvcrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngvcrd.c; path = ../../src/SFML/Graphics/libpng/pngvcrd.c; sourceTree = SOURCE_ROOT; }; + A0660FC50E89058900D39DEB /* pngwio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwio.c; path = ../../src/SFML/Graphics/libpng/pngwio.c; sourceTree = SOURCE_ROOT; }; + A0660FC60E89058900D39DEB /* pngwrite.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwrite.c; path = ../../src/SFML/Graphics/libpng/pngwrite.c; sourceTree = SOURCE_ROOT; }; + A0660FC70E89058900D39DEB /* pngwtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwtran.c; path = ../../src/SFML/Graphics/libpng/pngwtran.c; sourceTree = SOURCE_ROOT; }; + A0660FC80E89058900D39DEB /* pngwutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwutil.c; path = ../../src/SFML/Graphics/libpng/pngwutil.c; sourceTree = SOURCE_ROOT; }; + A0660FCA0E89058900D39DEB /* Matrix3.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Matrix3.cpp; path = ../../src/SFML/Graphics/Matrix3.cpp; sourceTree = SOURCE_ROOT; }; + A0660FCB0E89058900D39DEB /* PostFX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PostFX.cpp; path = ../../src/SFML/Graphics/PostFX.cpp; sourceTree = SOURCE_ROOT; }; + A0660FCC0E89058900D39DEB /* RenderTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = RenderTarget.cpp; path = ../../src/SFML/Graphics/RenderTarget.cpp; sourceTree = SOURCE_ROOT; }; + A0660FCD0E89058900D39DEB /* RenderWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = RenderWindow.cpp; path = ../../src/SFML/Graphics/RenderWindow.cpp; sourceTree = SOURCE_ROOT; }; + A0660FCE0E89058900D39DEB /* Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Shape.cpp; path = ../../src/SFML/Graphics/Shape.cpp; sourceTree = SOURCE_ROOT; }; + A0660FD00E89058900D39DEB /* image_DXT.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = image_DXT.c; path = ../../src/SFML/Graphics/SOIL/image_DXT.c; sourceTree = SOURCE_ROOT; }; + A0660FD10E89058900D39DEB /* image_DXT.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = image_DXT.h; path = ../../src/SFML/Graphics/SOIL/image_DXT.h; sourceTree = SOURCE_ROOT; }; + A0660FD20E89058900D39DEB /* SOIL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SOIL.c; path = ../../src/SFML/Graphics/SOIL/SOIL.c; sourceTree = SOURCE_ROOT; }; + A0660FD30E89058900D39DEB /* SOIL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SOIL.h; path = ../../src/SFML/Graphics/SOIL/SOIL.h; sourceTree = SOURCE_ROOT; }; + A0660FD40E89058900D39DEB /* stb_image_aug.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stb_image_aug.c; path = ../../src/SFML/Graphics/SOIL/stb_image_aug.c; sourceTree = SOURCE_ROOT; }; + A0660FD50E89058900D39DEB /* stb_image_aug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stb_image_aug.h; path = ../../src/SFML/Graphics/SOIL/stb_image_aug.h; sourceTree = SOURCE_ROOT; }; + A0660FD60E89058900D39DEB /* stbi_DDS_aug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stbi_DDS_aug.h; path = ../../src/SFML/Graphics/SOIL/stbi_DDS_aug.h; sourceTree = SOURCE_ROOT; }; + A0660FD70E89058900D39DEB /* stbi_DDS_aug_c.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stbi_DDS_aug_c.h; path = ../../src/SFML/Graphics/SOIL/stbi_DDS_aug_c.h; sourceTree = SOURCE_ROOT; }; + A0660FD80E89058900D39DEB /* Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite.cpp; path = ../../src/SFML/Graphics/Sprite.cpp; sourceTree = SOURCE_ROOT; }; + A0660FD90E89058900D39DEB /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = String.cpp; path = ../../src/SFML/Graphics/String.cpp; sourceTree = SOURCE_ROOT; }; + A0660FDA0E89058900D39DEB /* View.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = View.cpp; path = ../../src/SFML/Graphics/View.cpp; sourceTree = SOURCE_ROOT; }; + A0660FDC0E89058900D39DEB /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = adler32.c; path = ../../src/SFML/Graphics/zlib/adler32.c; sourceTree = SOURCE_ROOT; }; + A0660FDD0E89058900D39DEB /* compress.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = compress.c; path = ../../src/SFML/Graphics/zlib/compress.c; sourceTree = SOURCE_ROOT; }; + A0660FDE0E89058900D39DEB /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ../../src/SFML/Graphics/zlib/crc32.c; sourceTree = SOURCE_ROOT; }; + A0660FDF0E89058900D39DEB /* crc32.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = crc32.h; path = ../../src/SFML/Graphics/zlib/crc32.h; sourceTree = SOURCE_ROOT; }; + A0660FE00E89058900D39DEB /* deflate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = deflate.c; path = ../../src/SFML/Graphics/zlib/deflate.c; sourceTree = SOURCE_ROOT; }; + A0660FE10E89058900D39DEB /* deflate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = deflate.h; path = ../../src/SFML/Graphics/zlib/deflate.h; sourceTree = SOURCE_ROOT; }; + A0660FE20E89058900D39DEB /* inffast.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inffast.c; path = ../../src/SFML/Graphics/zlib/inffast.c; sourceTree = SOURCE_ROOT; }; + A0660FE30E89058900D39DEB /* inffast.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inffast.h; path = ../../src/SFML/Graphics/zlib/inffast.h; sourceTree = SOURCE_ROOT; }; + A0660FE40E89058900D39DEB /* inffixed.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inffixed.h; path = ../../src/SFML/Graphics/zlib/inffixed.h; sourceTree = SOURCE_ROOT; }; + A0660FE50E89058900D39DEB /* inflate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inflate.c; path = ../../src/SFML/Graphics/zlib/inflate.c; sourceTree = SOURCE_ROOT; }; + A0660FE60E89058900D39DEB /* inflate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inflate.h; path = ../../src/SFML/Graphics/zlib/inflate.h; sourceTree = SOURCE_ROOT; }; + A0660FE70E89058900D39DEB /* inftrees.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inftrees.c; path = ../../src/SFML/Graphics/zlib/inftrees.c; sourceTree = SOURCE_ROOT; }; + A0660FE80E89058900D39DEB /* inftrees.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inftrees.h; path = ../../src/SFML/Graphics/zlib/inftrees.h; sourceTree = SOURCE_ROOT; }; + A0660FE90E89058900D39DEB /* trees.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = trees.c; path = ../../src/SFML/Graphics/zlib/trees.c; sourceTree = SOURCE_ROOT; }; + A0660FEA0E89058900D39DEB /* trees.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = trees.h; path = ../../src/SFML/Graphics/zlib/trees.h; sourceTree = SOURCE_ROOT; }; + A0660FEB0E89058900D39DEB /* uncompr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = uncompr.c; path = ../../src/SFML/Graphics/zlib/uncompr.c; sourceTree = SOURCE_ROOT; }; + A0660FEC0E89058900D39DEB /* zconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = zconf.h; path = ../../src/SFML/Graphics/zlib/zconf.h; sourceTree = SOURCE_ROOT; }; + A0660FED0E89058900D39DEB /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = zlib.h; path = ../../src/SFML/Graphics/zlib/zlib.h; sourceTree = SOURCE_ROOT; }; + A0660FEE0E89058900D39DEB /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = zutil.c; path = ../../src/SFML/Graphics/zlib/zutil.c; sourceTree = SOURCE_ROOT; }; + A0660FEF0E89058900D39DEB /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = zutil.h; path = ../../src/SFML/Graphics/zlib/zutil.h; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A01269640E6318C000B96A5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A012696D0E6318FE00B96A5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A01269740E63190F00B96A5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A012697B0E63192000B96A5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A01269820E63192B00B96A5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A01269570E63189C00B96A5D = { + isa = PBXGroup; + children = ( + A01269870E63193B00B96A5D /* sfml-system */, + A012698C0E63194100B96A5D /* sfml-network */, + A012698D0E63194600B96A5D /* sfml-audio */, + A012698E0E63194B00B96A5D /* sfml-window */, + A012698F0E63195100B96A5D /* sfml-graphics */, + A01269670E6318C000B96A5D /* Products */, + ); + sourceTree = ""; + }; + A01269670E6318C000B96A5D /* Products */ = { + isa = PBXGroup; + children = ( + A01269660E6318C000B96A5D /* libsfml-system.dylib */, + A012696F0E6318FE00B96A5D /* libsfml-network.dylib */, + A01269760E63190F00B96A5D /* libsfml-audio.dylib */, + A012697D0E63192000B96A5D /* libsfml-window.dylib */, + A01269840E63192B00B96A5D /* libsfml-graphics.dylib */, + ); + name = Products; + sourceTree = ""; + }; + A01269870E63193B00B96A5D /* sfml-system */ = { + isa = PBXGroup; + children = ( + A0660EA90E89051400D39DEB /* Clock.cpp */, + A0660EAA0E89051400D39DEB /* Platform.hpp */, + A0660EAB0E89051400D39DEB /* Lock.cpp */, + A0660EAC0E89051400D39DEB /* Randomizer.cpp */, + A0660EAD0E89051400D39DEB /* Unicode.cpp */, + A0660EB40E89051400D39DEB /* Sleep.cpp */, + A0660EAE0E89051400D39DEB /* Unix */, + ); + name = "sfml-system"; + sourceTree = ""; + }; + A012698C0E63194100B96A5D /* sfml-network */ = { + isa = PBXGroup; + children = ( + A018A2AD0EA21A2C005FFAC3 /* Http.cpp */, + A018A2AE0EA21A2C005FFAC3 /* Ftp.cpp */, + A0660EC90E89053100D39DEB /* IPAddress.cpp */, + A0660ECA0E89053100D39DEB /* SelectorBase.cpp */, + A0660ECC0E89053100D39DEB /* SocketTCP.cpp */, + A0660ED10E89053100D39DEB /* Packet.cpp */, + A0660ED20E89053100D39DEB /* SocketUDP.cpp */, + A0660ECD0E89053100D39DEB /* Unix */, + ); + name = "sfml-network"; + sourceTree = ""; + }; + A012698D0E63194600B96A5D /* sfml-audio */ = { + isa = PBXGroup; + children = ( + A0660EDB0E89054E00D39DEB /* AudioDevice.cpp */, + A0660EDC0E89054E00D39DEB /* AudioDevice.hpp */, + A0660EDD0E89054E00D39DEB /* AudioResource.cpp */, + A0660EDE0E89054E00D39DEB /* Listener.cpp */, + A0660EE00E89054E00D39DEB /* Music.cpp */, + A0660EE10E89054E00D39DEB /* OpenAL.hpp */, + A0660EE20E89054E00D39DEB /* Sound.cpp */, + A0660EE30E89054E00D39DEB /* SoundBuffer.cpp */, + A0660EE40E89054E00D39DEB /* SoundBufferRecorder.cpp */, + A0660EE50E89054E00D39DEB /* SoundFile.cpp */, + A0660EE60E89054E00D39DEB /* SoundFile.hpp */, + A0660EE70E89054E00D39DEB /* SoundFileDefault.cpp */, + A0660EE80E89054E00D39DEB /* SoundFileDefault.hpp */, + A0660EE90E89054E00D39DEB /* SoundFileOgg.cpp */, + A0660EEA0E89054E00D39DEB /* SoundFileOgg.hpp */, + A0660EEB0E89054E00D39DEB /* SoundRecorder.cpp */, + A0660EEC0E89054E00D39DEB /* SoundStream.cpp */, + A0660EED0E89054E00D39DEB /* stb_vorbis */, + ); + name = "sfml-audio"; + sourceTree = ""; + }; + A012698E0E63194B00B96A5D /* sfml-window */ = { + isa = PBXGroup; + children = ( + A04C5A920EDDD88B00935061 /* Cocoa */, + A0660F040E89056300D39DEB /* Context.cpp */, + A0660F090E89056300D39DEB /* Input.cpp */, + A0660F0A0E89056300D39DEB /* Joystick.hpp */, + A0660F2E0E89056300D39DEB /* VideoMode.cpp */, + A0660F2F0E89056300D39DEB /* VideoModeSupport.hpp */, + A0660F370E89056300D39DEB /* Window.cpp */, + A0660F380E89056300D39DEB /* WindowImpl.cpp */, + A0660F390E89056300D39DEB /* WindowImpl.hpp */, + ); + name = "sfml-window"; + sourceTree = ""; + }; + A012698F0E63195100B96A5D /* sfml-graphics */ = { + isa = PBXGroup; + children = ( + A0660F6A0E89058900D39DEB /* Arial.hpp */, + A0660F6B0E89058900D39DEB /* Color.cpp */, + A0660F6C0E89058900D39DEB /* Drawable.cpp */, + A0660F6D0E89058900D39DEB /* Font.cpp */, + A0660F6E0E89058900D39DEB /* FontLoader.cpp */, + A0660F6F0E89058900D39DEB /* FontLoader.hpp */, + A0660F700E89058900D39DEB /* GLEW */, + A0660F750E89058900D39DEB /* GraphicsContext.cpp */, + A0660F760E89058900D39DEB /* GraphicsContext.hpp */, + A0660F770E89058900D39DEB /* Image.cpp */, + A0660F780E89058900D39DEB /* ImageLoader.cpp */, + A0660F790E89058900D39DEB /* ImageLoader.hpp */, + A0660F7A0E89058900D39DEB /* libjpeg */, + A0660FB50E89058900D39DEB /* libpng */, + A0660FCA0E89058900D39DEB /* Matrix3.cpp */, + A0660FCB0E89058900D39DEB /* PostFX.cpp */, + A0660FCC0E89058900D39DEB /* RenderTarget.cpp */, + A0660FCD0E89058900D39DEB /* RenderWindow.cpp */, + A0660FCE0E89058900D39DEB /* Shape.cpp */, + A0660FCF0E89058900D39DEB /* SOIL */, + A0660FD80E89058900D39DEB /* Sprite.cpp */, + A0660FD90E89058900D39DEB /* String.cpp */, + A0660FDA0E89058900D39DEB /* View.cpp */, + A0660FDB0E89058900D39DEB /* zlib */, + ); + name = "sfml-graphics"; + sourceTree = ""; + }; + A04C5A920EDDD88B00935061 /* Cocoa */ = { + isa = PBXGroup; + children = ( + A04C5A930EDDD88B00935061 /* AppController.h */, + A04C5A940EDDD88B00935061 /* AppController.mm */, + A04C5A950EDDD88B00935061 /* Joystick.cpp */, + A04C5A960EDDD88B00935061 /* Joystick.hpp */, + A04C5A970EDDD88B00935061 /* VideoModeSupport.cpp */, + A04C5A980EDDD88B00935061 /* VideoModeSupport.hpp */, + A04C5A990EDDD88B00935061 /* WindowController.h */, + A04C5A9A0EDDD88B00935061 /* WindowController.mm */, + A04C5A9B0EDDD88B00935061 /* WindowImplCocoa.hpp */, + A04C5A9C0EDDD88B00935061 /* WindowImplCocoa.mm */, + ); + name = Cocoa; + path = ../../src/SFML/Window/Cocoa; + sourceTree = SOURCE_ROOT; + }; + A0660EAE0E89051400D39DEB /* Unix */ = { + isa = PBXGroup; + children = ( + A0660EAF0E89051400D39DEB /* Mutex.cpp */, + A0660EB00E89051400D39DEB /* Platform.cpp */, + A0660EB10E89051400D39DEB /* Platform.hpp */, + A0660EB20E89051400D39DEB /* Thread.cpp */, + ); + name = Unix; + path = ../../src/SFML/System/Unix; + sourceTree = SOURCE_ROOT; + }; + A0660ECD0E89053100D39DEB /* Unix */ = { + isa = PBXGroup; + children = ( + A0660ECE0E89053100D39DEB /* SocketHelper.cpp */, + ); + name = Unix; + path = ../../src/SFML/Network/Unix; + sourceTree = SOURCE_ROOT; + }; + A0660EED0E89054E00D39DEB /* stb_vorbis */ = { + isa = PBXGroup; + children = ( + A0660EEE0E89054E00D39DEB /* stb_vorbis.c */, + A0660EEF0E89054E00D39DEB /* stb_vorbis.h */, + ); + name = stb_vorbis; + path = ../../src/SFML/Audio/stb_vorbis; + sourceTree = SOURCE_ROOT; + }; + A0660F700E89058900D39DEB /* GLEW */ = { + isa = PBXGroup; + children = ( + A0660F710E89058900D39DEB /* glew.c */, + A0660F720E89058900D39DEB /* glew.h */, + A0660F730E89058900D39DEB /* glxew.h */, + A0660F740E89058900D39DEB /* wglew.h */, + ); + name = GLEW; + path = ../../src/SFML/Graphics/GLEW; + sourceTree = SOURCE_ROOT; + }; + A0660F7A0E89058900D39DEB /* libjpeg */ = { + isa = PBXGroup; + children = ( + A0660F7B0E89058900D39DEB /* cderror.h */, + A0660F7C0E89058900D39DEB /* jcapimin.c */, + A0660F7D0E89058900D39DEB /* jcapistd.c */, + A0660F7E0E89058900D39DEB /* jccoefct.c */, + A0660F7F0E89058900D39DEB /* jccolor.c */, + A0660F800E89058900D39DEB /* jcdctmgr.c */, + A0660F810E89058900D39DEB /* jchuff.c */, + A0660F820E89058900D39DEB /* jchuff.h */, + A0660F830E89058900D39DEB /* jcinit.c */, + A0660F840E89058900D39DEB /* jcmainct.c */, + A0660F850E89058900D39DEB /* jcmarker.c */, + A0660F860E89058900D39DEB /* jcmaster.c */, + A0660F870E89058900D39DEB /* jcomapi.c */, + A0660F880E89058900D39DEB /* jconfig.h */, + A0660F890E89058900D39DEB /* jcparam.c */, + A0660F8A0E89058900D39DEB /* jcphuff.c */, + A0660F8B0E89058900D39DEB /* jcprepct.c */, + A0660F8C0E89058900D39DEB /* jcsample.c */, + A0660F8D0E89058900D39DEB /* jctrans.c */, + A0660F8E0E89058900D39DEB /* jdapimin.c */, + A0660F8F0E89058900D39DEB /* jdapistd.c */, + A0660F900E89058900D39DEB /* jdatadst.c */, + A0660F910E89058900D39DEB /* jdatasrc.c */, + A0660F920E89058900D39DEB /* jdcoefct.c */, + A0660F930E89058900D39DEB /* jdcolor.c */, + A0660F940E89058900D39DEB /* jdct.h */, + A0660F950E89058900D39DEB /* jddctmgr.c */, + A0660F960E89058900D39DEB /* jdhuff.c */, + A0660F970E89058900D39DEB /* jdhuff.h */, + A0660F980E89058900D39DEB /* jdinput.c */, + A0660F990E89058900D39DEB /* jdmainct.c */, + A0660F9A0E89058900D39DEB /* jdmarker.c */, + A0660F9B0E89058900D39DEB /* jdmaster.c */, + A0660F9C0E89058900D39DEB /* jdmerge.c */, + A0660F9D0E89058900D39DEB /* jdphuff.c */, + A0660F9E0E89058900D39DEB /* jdpostct.c */, + A0660F9F0E89058900D39DEB /* jdsample.c */, + A0660FA00E89058900D39DEB /* jdtrans.c */, + A0660FA10E89058900D39DEB /* jerror.c */, + A0660FA20E89058900D39DEB /* jerror.h */, + A0660FA30E89058900D39DEB /* jfdctflt.c */, + A0660FA40E89058900D39DEB /* jfdctfst.c */, + A0660FA50E89058900D39DEB /* jfdctint.c */, + A0660FA60E89058900D39DEB /* jidctflt.c */, + A0660FA70E89058900D39DEB /* jidctfst.c */, + A0660FA80E89058900D39DEB /* jidctint.c */, + A0660FA90E89058900D39DEB /* jidctred.c */, + A0660FAA0E89058900D39DEB /* jinclude.h */, + A0660FAB0E89058900D39DEB /* jmemmgr.c */, + A0660FAC0E89058900D39DEB /* jmemnobs.c */, + A0660FAD0E89058900D39DEB /* jmemsys.h */, + A0660FAE0E89058900D39DEB /* jmorecfg.h */, + A0660FAF0E89058900D39DEB /* jpegint.h */, + A0660FB00E89058900D39DEB /* jpeglib.h */, + A0660FB10E89058900D39DEB /* jquant1.c */, + A0660FB20E89058900D39DEB /* jquant2.c */, + A0660FB30E89058900D39DEB /* jutils.c */, + A0660FB40E89058900D39DEB /* jversion.h */, + ); + name = libjpeg; + path = ../../src/SFML/Graphics/libjpeg; + sourceTree = SOURCE_ROOT; + }; + A0660FB50E89058900D39DEB /* libpng */ = { + isa = PBXGroup; + children = ( + A0660FB60E89058900D39DEB /* png.c */, + A0660FB70E89058900D39DEB /* png.h */, + A0660FB80E89058900D39DEB /* pngconf.h */, + A0660FB90E89058900D39DEB /* pngerror.c */, + A0660FBA0E89058900D39DEB /* pnggccrd.c */, + A0660FBB0E89058900D39DEB /* pngget.c */, + A0660FBC0E89058900D39DEB /* pngmem.c */, + A0660FBD0E89058900D39DEB /* pngpread.c */, + A0660FBE0E89058900D39DEB /* pngread.c */, + A0660FBF0E89058900D39DEB /* pngrio.c */, + A0660FC00E89058900D39DEB /* pngrtran.c */, + A0660FC10E89058900D39DEB /* pngrutil.c */, + A0660FC20E89058900D39DEB /* pngset.c */, + A0660FC30E89058900D39DEB /* pngtrans.c */, + A0660FC40E89058900D39DEB /* pngvcrd.c */, + A0660FC50E89058900D39DEB /* pngwio.c */, + A0660FC60E89058900D39DEB /* pngwrite.c */, + A0660FC70E89058900D39DEB /* pngwtran.c */, + A0660FC80E89058900D39DEB /* pngwutil.c */, + ); + name = libpng; + path = ../../src/SFML/Graphics/libpng; + sourceTree = SOURCE_ROOT; + }; + A0660FCF0E89058900D39DEB /* SOIL */ = { + isa = PBXGroup; + children = ( + A0660FD00E89058900D39DEB /* image_DXT.c */, + A0660FD10E89058900D39DEB /* image_DXT.h */, + A0660FD20E89058900D39DEB /* SOIL.c */, + A0660FD30E89058900D39DEB /* SOIL.h */, + A0660FD40E89058900D39DEB /* stb_image_aug.c */, + A0660FD50E89058900D39DEB /* stb_image_aug.h */, + A0660FD60E89058900D39DEB /* stbi_DDS_aug.h */, + A0660FD70E89058900D39DEB /* stbi_DDS_aug_c.h */, + ); + name = SOIL; + path = ../../src/SFML/Graphics/SOIL; + sourceTree = SOURCE_ROOT; + }; + A0660FDB0E89058900D39DEB /* zlib */ = { + isa = PBXGroup; + children = ( + A0660FDC0E89058900D39DEB /* adler32.c */, + A0660FDD0E89058900D39DEB /* compress.c */, + A0660FDE0E89058900D39DEB /* crc32.c */, + A0660FDF0E89058900D39DEB /* crc32.h */, + A0660FE00E89058900D39DEB /* deflate.c */, + A0660FE10E89058900D39DEB /* deflate.h */, + A0660FE20E89058900D39DEB /* inffast.c */, + A0660FE30E89058900D39DEB /* inffast.h */, + A0660FE40E89058900D39DEB /* inffixed.h */, + A0660FE50E89058900D39DEB /* inflate.c */, + A0660FE60E89058900D39DEB /* inflate.h */, + A0660FE70E89058900D39DEB /* inftrees.c */, + A0660FE80E89058900D39DEB /* inftrees.h */, + A0660FE90E89058900D39DEB /* trees.c */, + A0660FEA0E89058900D39DEB /* trees.h */, + A0660FEB0E89058900D39DEB /* uncompr.c */, + A0660FEC0E89058900D39DEB /* zconf.h */, + A0660FED0E89058900D39DEB /* zlib.h */, + A0660FEE0E89058900D39DEB /* zutil.c */, + A0660FEF0E89058900D39DEB /* zutil.h */, + ); + name = zlib; + path = ../../src/SFML/Graphics/zlib; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A01269650E6318C000B96A5D /* sfml-system */ = { + isa = PBXNativeTarget; + buildConfigurationList = A012696A0E6318C000B96A5D /* Build configuration list for PBXNativeTarget "sfml-system" */; + buildPhases = ( + A01269630E6318C000B96A5D /* Sources */, + A01269640E6318C000B96A5D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "sfml-system"; + productName = "sfml-system"; + productReference = A01269660E6318C000B96A5D /* libsfml-system.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + A012696E0E6318FE00B96A5D /* sfml-network */ = { + isa = PBXNativeTarget; + buildConfigurationList = A01269880E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-network" */; + buildPhases = ( + A012696C0E6318FE00B96A5D /* Sources */, + A012696D0E6318FE00B96A5D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "sfml-network"; + productName = "sfml-network"; + productReference = A012696F0E6318FE00B96A5D /* libsfml-network.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + A01269750E63190F00B96A5D /* sfml-audio */ = { + isa = PBXNativeTarget; + buildConfigurationList = A01269890E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-audio" */; + buildPhases = ( + A01269730E63190F00B96A5D /* Sources */, + A01269740E63190F00B96A5D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "sfml-audio"; + productName = "sfml-audio"; + productReference = A01269760E63190F00B96A5D /* libsfml-audio.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + A012697C0E63192000B96A5D /* sfml-window */ = { + isa = PBXNativeTarget; + buildConfigurationList = A012698A0E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-window" */; + buildPhases = ( + A012697A0E63192000B96A5D /* Sources */, + A012697B0E63192000B96A5D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "sfml-window"; + productName = "sfml-window"; + productReference = A012697D0E63192000B96A5D /* libsfml-window.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + A01269830E63192B00B96A5D /* sfml-graphics */ = { + isa = PBXNativeTarget; + buildConfigurationList = A012698B0E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-graphics" */; + buildPhases = ( + A01269810E63192B00B96A5D /* Sources */, + A01269820E63192B00B96A5D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "sfml-graphics"; + productName = "sfml-graphics"; + productReference = A01269840E63192B00B96A5D /* libsfml-graphics.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A01269590E63189C00B96A5D /* Project object */ = { + isa = PBXProject; + buildConfigurationList = A012695C0E63189C00B96A5D /* Build configuration list for PBXProject "SFML-bare" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 0; + mainGroup = A01269570E63189C00B96A5D; + productRefGroup = A01269670E6318C000B96A5D /* Products */; + projectDirPath = ""; + projectRoot = ../..; + targets = ( + A0AD0A300E7663E1006E7E0D /* All */, + A01269650E6318C000B96A5D /* sfml-system */, + A012696E0E6318FE00B96A5D /* sfml-network */, + A01269750E63190F00B96A5D /* sfml-audio */, + A012697C0E63192000B96A5D /* sfml-window */, + A01269830E63192B00B96A5D /* sfml-graphics */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + A01269630E6318C000B96A5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0660EBA0E89051400D39DEB /* Clock.cpp in Sources */, + A0660EBC0E89051400D39DEB /* Lock.cpp in Sources */, + A0660EBD0E89051400D39DEB /* Randomizer.cpp in Sources */, + A0660EBE0E89051400D39DEB /* Unicode.cpp in Sources */, + A0660EBF0E89051400D39DEB /* Mutex.cpp in Sources */, + A0660EC00E89051400D39DEB /* Platform.cpp in Sources */, + A0660EC20E89051400D39DEB /* Thread.cpp in Sources */, + A0660EC40E89051400D39DEB /* Sleep.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A012696C0E6318FE00B96A5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0660ED30E89053100D39DEB /* IPAddress.cpp in Sources */, + A0660ED40E89053100D39DEB /* SelectorBase.cpp in Sources */, + A0660ED60E89053100D39DEB /* SocketTCP.cpp in Sources */, + A0660ED70E89053100D39DEB /* SocketHelper.cpp in Sources */, + A0660ED90E89053100D39DEB /* Packet.cpp in Sources */, + A0660EDA0E89053100D39DEB /* SocketUDP.cpp in Sources */, + A018A2AF0EA21A2C005FFAC3 /* Http.cpp in Sources */, + A018A2B00EA21A2C005FFAC3 /* Ftp.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A01269730E63190F00B96A5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0660EF00E89054E00D39DEB /* AudioDevice.cpp in Sources */, + A0660EF20E89054E00D39DEB /* AudioResource.cpp in Sources */, + A0660EF30E89054E00D39DEB /* Listener.cpp in Sources */, + A0660EF50E89054E00D39DEB /* Music.cpp in Sources */, + A0660EF70E89054E00D39DEB /* Sound.cpp in Sources */, + A0660EF80E89054E00D39DEB /* SoundBuffer.cpp in Sources */, + A0660EF90E89054E00D39DEB /* SoundBufferRecorder.cpp in Sources */, + A0660EFA0E89054E00D39DEB /* SoundFile.cpp in Sources */, + A0660EFC0E89054E00D39DEB /* SoundFileDefault.cpp in Sources */, + A0660EFE0E89054E00D39DEB /* SoundFileOgg.cpp in Sources */, + A0660F000E89054E00D39DEB /* SoundRecorder.cpp in Sources */, + A0660F010E89054E00D39DEB /* SoundStream.cpp in Sources */, + A0660F020E89054E00D39DEB /* stb_vorbis.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A012697A0E63192000B96A5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0660F3A0E89056300D39DEB /* Context.cpp in Sources */, + A0660F3E0E89056300D39DEB /* Input.cpp in Sources */, + A0660F5F0E89056300D39DEB /* VideoMode.cpp in Sources */, + A0660F670E89056300D39DEB /* Window.cpp in Sources */, + A0660F680E89056300D39DEB /* WindowImpl.cpp in Sources */, + A04C5A9D0EDDD88B00935061 /* AppController.mm in Sources */, + A04C5A9E0EDDD88B00935061 /* Joystick.cpp in Sources */, + A04C5A9F0EDDD88B00935061 /* VideoModeSupport.cpp in Sources */, + A04C5AA00EDDD88B00935061 /* WindowController.mm in Sources */, + A04C5AA10EDDD88B00935061 /* WindowImplCocoa.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A01269810E63192B00B96A5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0660FF10E89058900D39DEB /* Color.cpp in Sources */, + A0660FF20E89058900D39DEB /* Drawable.cpp in Sources */, + A0660FF30E89058900D39DEB /* Font.cpp in Sources */, + A0660FF40E89058900D39DEB /* FontLoader.cpp in Sources */, + A0660FF60E89058900D39DEB /* glew.c in Sources */, + A0660FFA0E89058900D39DEB /* GraphicsContext.cpp in Sources */, + A0660FFC0E89058900D39DEB /* Image.cpp in Sources */, + A0660FFD0E89058900D39DEB /* ImageLoader.cpp in Sources */, + A06610000E89058900D39DEB /* jcapimin.c in Sources */, + A06610010E89058900D39DEB /* jcapistd.c in Sources */, + A06610020E89058900D39DEB /* jccoefct.c in Sources */, + A06610030E89058900D39DEB /* jccolor.c in Sources */, + A06610040E89058900D39DEB /* jcdctmgr.c in Sources */, + A06610050E89058900D39DEB /* jchuff.c in Sources */, + A06610070E89058900D39DEB /* jcinit.c in Sources */, + A06610080E89058900D39DEB /* jcmainct.c in Sources */, + A06610090E89058900D39DEB /* jcmarker.c in Sources */, + A066100A0E89058900D39DEB /* jcmaster.c in Sources */, + A066100B0E89058900D39DEB /* jcomapi.c in Sources */, + A066100D0E89058900D39DEB /* jcparam.c in Sources */, + A066100E0E89058900D39DEB /* jcphuff.c in Sources */, + A066100F0E89058900D39DEB /* jcprepct.c in Sources */, + A06610100E89058900D39DEB /* jcsample.c in Sources */, + A06610110E89058900D39DEB /* jctrans.c in Sources */, + A06610120E89058900D39DEB /* jdapimin.c in Sources */, + A06610130E89058900D39DEB /* jdapistd.c in Sources */, + A06610140E89058900D39DEB /* jdatadst.c in Sources */, + A06610150E89058900D39DEB /* jdatasrc.c in Sources */, + A06610160E89058900D39DEB /* jdcoefct.c in Sources */, + A06610170E89058900D39DEB /* jdcolor.c in Sources */, + A06610190E89058900D39DEB /* jddctmgr.c in Sources */, + A066101A0E89058900D39DEB /* jdhuff.c in Sources */, + A066101C0E89058900D39DEB /* jdinput.c in Sources */, + A066101D0E89058900D39DEB /* jdmainct.c in Sources */, + A066101E0E89058900D39DEB /* jdmarker.c in Sources */, + A066101F0E89058900D39DEB /* jdmaster.c in Sources */, + A06610200E89058900D39DEB /* jdmerge.c in Sources */, + A06610210E89058900D39DEB /* jdphuff.c in Sources */, + A06610220E89058900D39DEB /* jdpostct.c in Sources */, + A06610230E89058900D39DEB /* jdsample.c in Sources */, + A06610240E89058900D39DEB /* jdtrans.c in Sources */, + A06610250E89058900D39DEB /* jerror.c in Sources */, + A06610270E89058900D39DEB /* jfdctflt.c in Sources */, + A06610280E89058900D39DEB /* jfdctfst.c in Sources */, + A06610290E89058900D39DEB /* jfdctint.c in Sources */, + A066102A0E89058900D39DEB /* jidctflt.c in Sources */, + A066102B0E89058900D39DEB /* jidctfst.c in Sources */, + A066102C0E89058900D39DEB /* jidctint.c in Sources */, + A066102D0E89058900D39DEB /* jidctred.c in Sources */, + A066102F0E89058900D39DEB /* jmemmgr.c in Sources */, + A06610300E89058900D39DEB /* jmemnobs.c in Sources */, + A06610350E89058900D39DEB /* jquant1.c in Sources */, + A06610360E89058900D39DEB /* jquant2.c in Sources */, + A06610370E89058900D39DEB /* jutils.c in Sources */, + A06610390E89058900D39DEB /* png.c in Sources */, + A066103C0E89058900D39DEB /* pngerror.c in Sources */, + A066103D0E89058900D39DEB /* pnggccrd.c in Sources */, + A066103E0E89058900D39DEB /* pngget.c in Sources */, + A066103F0E89058900D39DEB /* pngmem.c in Sources */, + A06610400E89058900D39DEB /* pngpread.c in Sources */, + A06610410E89058900D39DEB /* pngread.c in Sources */, + A06610420E89058900D39DEB /* pngrio.c in Sources */, + A06610430E89058900D39DEB /* pngrtran.c in Sources */, + A06610440E89058900D39DEB /* pngrutil.c in Sources */, + A06610450E89058900D39DEB /* pngset.c in Sources */, + A06610460E89058900D39DEB /* pngtrans.c in Sources */, + A06610470E89058900D39DEB /* pngvcrd.c in Sources */, + A06610480E89058900D39DEB /* pngwio.c in Sources */, + A06610490E89058900D39DEB /* pngwrite.c in Sources */, + A066104A0E89058900D39DEB /* pngwtran.c in Sources */, + A066104B0E89058900D39DEB /* pngwutil.c in Sources */, + A066104D0E89058900D39DEB /* Matrix3.cpp in Sources */, + A066104E0E89058900D39DEB /* PostFX.cpp in Sources */, + A066104F0E89058900D39DEB /* RenderTarget.cpp in Sources */, + A06610500E89058900D39DEB /* RenderWindow.cpp in Sources */, + A06610510E89058900D39DEB /* Shape.cpp in Sources */, + A06610520E89058900D39DEB /* image_DXT.c in Sources */, + A06610540E89058900D39DEB /* SOIL.c in Sources */, + A06610560E89058900D39DEB /* stb_image_aug.c in Sources */, + A066105A0E89058900D39DEB /* Sprite.cpp in Sources */, + A066105B0E89058900D39DEB /* String.cpp in Sources */, + A066105C0E89058900D39DEB /* View.cpp in Sources */, + A066105D0E89058900D39DEB /* adler32.c in Sources */, + A066105E0E89058900D39DEB /* compress.c in Sources */, + A066105F0E89058900D39DEB /* crc32.c in Sources */, + A06610610E89058900D39DEB /* deflate.c in Sources */, + A06610630E89058900D39DEB /* inffast.c in Sources */, + A06610660E89058900D39DEB /* inflate.c in Sources */, + A06610680E89058900D39DEB /* inftrees.c in Sources */, + A066106A0E89058900D39DEB /* trees.c in Sources */, + A066106C0E89058900D39DEB /* uncompr.c in Sources */, + A066106F0E89058900D39DEB /* zutil.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A0AD0A340E7663F1006E7E0D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A01269650E6318C000B96A5D /* sfml-system */; + targetProxy = A0AD0A330E7663F1006E7E0D /* PBXContainerItemProxy */; + }; + A0AD0A360E7663F1006E7E0D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A012696E0E6318FE00B96A5D /* sfml-network */; + targetProxy = A0AD0A350E7663F1006E7E0D /* PBXContainerItemProxy */; + }; + A0AD0A380E7663F1006E7E0D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A01269750E63190F00B96A5D /* sfml-audio */; + targetProxy = A0AD0A370E7663F1006E7E0D /* PBXContainerItemProxy */; + }; + A0AD0A3A0E7663F1006E7E0D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A012697C0E63192000B96A5D /* sfml-window */; + targetProxy = A0AD0A390E7663F1006E7E0D /* PBXContainerItemProxy */; + }; + A0AD0A3C0E7663F1006E7E0D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A01269830E63192B00B96A5D /* sfml-graphics */; + targetProxy = A0AD0A3B0E7663F1006E7E0D /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + A012695A0E63189C00B96A5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + COPY_PHASE_STRIP = NO; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_PROJECT_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_PROJECT_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + INSTALL_PATH = "@executable_path"; + OBJROOT = build; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SYMROOT = ../../lib/xcode; + }; + name = Debug; + }; + A012695B0E63189C00B96A5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + COPY_PHASE_STRIP = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_PROJECT_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_PROJECT_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + INSTALL_PATH = "@executable_path"; + OBJROOT = build; + OTHER_CFLAGS = "-DNDEBUG"; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SYMROOT = ../../lib/xcode; + }; + name = Release; + }; + A01269680E6318C000B96A5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + PREBINDING = NO; + PRODUCT_NAME = "sfml-system-d"; + }; + name = Debug; + }; + A01269690E6318C000B96A5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; + PREBINDING = NO; + PRODUCT_NAME = "sfml-system"; + ZERO_LINK = NO; + }; + name = Release; + }; + A01269700E6318FF00B96A5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + PREBINDING = NO; + PRODUCT_NAME = "sfml-network-d"; + }; + name = Debug; + }; + A01269710E6318FF00B96A5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + PREBINDING = NO; + PRODUCT_NAME = "sfml-network"; + ZERO_LINK = NO; + }; + name = Release; + }; + A01269770E63190F00B96A5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + OTHER_LDFLAGS = ( + "-framework", + OpenAL, + "$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a", + "-lsfml-system-d", + ); + PREBINDING = NO; + PRODUCT_NAME = "sfml-audio-d"; + }; + name = Debug; + }; + A01269780E63190F00B96A5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + OTHER_LDFLAGS = ( + "-framework", + OpenAL, + "$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a", + "-lsfml-system", + ); + PREBINDING = NO; + PRODUCT_NAME = "sfml-audio"; + ZERO_LINK = NO; + }; + name = Release; + }; + A012697E0E63192000B96A5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + Cocoa, + "-framework", + OpenGL, + "-lsfml-system-d", + ); + PREBINDING = NO; + PRODUCT_NAME = "sfml-window-d"; + }; + name = Debug; + }; + A012697F0E63192000B96A5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + OTHER_CFLAGS = "-DNDEBUG"; + OTHER_LDFLAGS = ( + "-framework", + Cocoa, + "-framework", + OpenGL, + "-lsfml-system", + ); + PREBINDING = NO; + PRODUCT_NAME = "sfml-window"; + ZERO_LINK = NO; + }; + name = Release; + }; + A01269850E63192B00B96A5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + OTHER_LDFLAGS = ( + "$(SRCROOT)/../../extlibs/libs-xcode/libfreetype.a", + "-framework", + OpenGL, + "-lsfml-system-d", + "-lsfml-window-d", + ); + PREBINDING = NO; + PRODUCT_NAME = "sfml-graphics-d"; + }; + name = Debug; + }; + A01269860E63192B00B96A5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../src", + "$(SRCROOT)/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + OTHER_LDFLAGS = ( + "$(SRCROOT)/../../extlibs/libs-xcode/libfreetype.a", + "-framework", + OpenGL, + "-lsfml-system", + "-lsfml-window", + ); + PREBINDING = NO; + PRODUCT_NAME = "sfml-graphics"; + ZERO_LINK = NO; + }; + name = Release; + }; + A0AD0A310E7663E1006E7E0D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = All; + }; + name = Debug; + }; + A0AD0A320E7663E1006E7E0D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = All; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A012695C0E63189C00B96A5D /* Build configuration list for PBXProject "SFML-bare" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A012695A0E63189C00B96A5D /* Debug */, + A012695B0E63189C00B96A5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A012696A0E6318C000B96A5D /* Build configuration list for PBXNativeTarget "sfml-system" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01269680E6318C000B96A5D /* Debug */, + A01269690E6318C000B96A5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A01269880E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-network" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01269700E6318FF00B96A5D /* Debug */, + A01269710E6318FF00B96A5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A01269890E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-audio" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01269770E63190F00B96A5D /* Debug */, + A01269780E63190F00B96A5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A012698A0E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-window" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A012697E0E63192000B96A5D /* Debug */, + A012697F0E63192000B96A5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A012698B0E63193B00B96A5D /* Build configuration list for PBXNativeTarget "sfml-graphics" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01269850E63192B00B96A5D /* Debug */, + A01269860E63192B00B96A5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A0AD0A460E766415006E7E0D /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0AD0A310E7663E1006E7E0D /* Debug */, + A0AD0A320E7663E1006E7E0D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A01269590E63189C00B96A5D /* Project object */; +} diff --git a/build/xcode/SFML.xcodeproj/project.pbxproj b/build/xcode/SFML.xcodeproj/project.pbxproj new file mode 100644 index 00000000..f3936f26 --- /dev/null +++ b/build/xcode/SFML.xcodeproj/project.pbxproj @@ -0,0 +1,2468 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXAggregateTarget section */ + A0F0BA820D92E4F500056981 /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = A02679E40E5CDB03008D4C81 /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + ); + dependencies = ( + A0B4CD3A0D96B11500DEEE0F /* PBXTargetDependency */, + A0F0BA8C0D92E52300056981 /* PBXTargetDependency */, + A0F0BA8A0D92E52300056981 /* PBXTargetDependency */, + A0F0BA860D92E52300056981 /* PBXTargetDependency */, + A07EA05B0DB657A9007C7747 /* PBXTargetDependency */, + A0F0BA880D92E52300056981 /* PBXTargetDependency */, + ); + name = All; + productName = All; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + A018A27B0EA21866005FFAC3 /* Http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A018A2790EA21866005FFAC3 /* Http.cpp */; }; + A018A27C0EA21866005FFAC3 /* Ftp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A018A27A0EA21866005FFAC3 /* Ftp.cpp */; }; + A01A3AED0E75181300D0BA9B /* AudioDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AD80E75181300D0BA9B /* AudioDevice.cpp */; }; + A01A3AEE0E75181300D0BA9B /* AudioDevice.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A01A3AD90E75181300D0BA9B /* AudioDevice.hpp */; }; + A01A3AEF0E75181300D0BA9B /* AudioResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3ADA0E75181300D0BA9B /* AudioResource.cpp */; }; + A01A3AF00E75181300D0BA9B /* Listener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3ADB0E75181300D0BA9B /* Listener.cpp */; }; + A01A3AF20E75181300D0BA9B /* Music.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3ADD0E75181300D0BA9B /* Music.cpp */; }; + A01A3AF30E75181300D0BA9B /* OpenAL.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A01A3ADE0E75181300D0BA9B /* OpenAL.hpp */; }; + A01A3AF40E75181300D0BA9B /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3ADF0E75181300D0BA9B /* Sound.cpp */; }; + A01A3AF50E75181300D0BA9B /* SoundBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE00E75181300D0BA9B /* SoundBuffer.cpp */; }; + A01A3AF60E75181300D0BA9B /* SoundBufferRecorder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE10E75181300D0BA9B /* SoundBufferRecorder.cpp */; }; + A01A3AF70E75181300D0BA9B /* SoundFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE20E75181300D0BA9B /* SoundFile.cpp */; }; + A01A3AF80E75181300D0BA9B /* SoundFile.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A01A3AE30E75181300D0BA9B /* SoundFile.hpp */; }; + A01A3AF90E75181300D0BA9B /* SoundFileDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE40E75181300D0BA9B /* SoundFileDefault.cpp */; }; + A01A3AFA0E75181300D0BA9B /* SoundFileDefault.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A01A3AE50E75181300D0BA9B /* SoundFileDefault.hpp */; }; + A01A3AFB0E75181300D0BA9B /* SoundFileOgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE60E75181300D0BA9B /* SoundFileOgg.cpp */; }; + A01A3AFC0E75181300D0BA9B /* SoundFileOgg.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A01A3AE70E75181300D0BA9B /* SoundFileOgg.hpp */; }; + A01A3AFD0E75181300D0BA9B /* SoundRecorder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE80E75181300D0BA9B /* SoundRecorder.cpp */; }; + A01A3AFE0E75181300D0BA9B /* SoundStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AE90E75181300D0BA9B /* SoundStream.cpp */; }; + A01A3AFF0E75181300D0BA9B /* stb_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = A01A3AEB0E75181300D0BA9B /* stb_vorbis.c */; }; + A01A3B000E75181300D0BA9B /* stb_vorbis.h in Headers */ = {isa = PBXBuildFile; fileRef = A01A3AEC0E75181300D0BA9B /* stb_vorbis.h */; }; + A01C69C90E3E63CE00ED3F04 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01C69C80E3E63CE00ED3F04 /* Unicode.cpp */; }; + A04C59AF0EDDBA9C00935061 /* AppController.h in Headers */ = {isa = PBXBuildFile; fileRef = A04C59A50EDDBA9C00935061 /* AppController.h */; }; + A04C59B00EDDBA9C00935061 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C59A60EDDBA9C00935061 /* AppController.mm */; }; + A04C59B10EDDBA9C00935061 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C59A70EDDBA9C00935061 /* Joystick.cpp */; }; + A04C59B20EDDBA9C00935061 /* Joystick.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A04C59A80EDDBA9C00935061 /* Joystick.hpp */; }; + A04C59B30EDDBA9C00935061 /* VideoModeSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C59A90EDDBA9C00935061 /* VideoModeSupport.cpp */; }; + A04C59B40EDDBA9C00935061 /* VideoModeSupport.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A04C59AA0EDDBA9C00935061 /* VideoModeSupport.hpp */; }; + A04C59B50EDDBA9C00935061 /* WindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = A04C59AB0EDDBA9C00935061 /* WindowController.h */; }; + A04C59B60EDDBA9C00935061 /* WindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C59AC0EDDBA9C00935061 /* WindowController.mm */; }; + A04C59B70EDDBA9C00935061 /* WindowImplCocoa.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A04C59AD0EDDBA9C00935061 /* WindowImplCocoa.hpp */; }; + A04C59B80EDDBA9C00935061 /* WindowImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C59AE0EDDBA9C00935061 /* WindowImplCocoa.mm */; }; + A05EEF700E5CF18F00572B7E /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */; }; + A093E3D00D8BF918002236B4 /* dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A093E3CF0D8BF918002236B4 /* dummy.cpp */; }; + A093E5480D8BFEAE002236B4 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; }; + A09EEBF70D8C19BF00F6C625 /* Platform.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A09EEBED0D8C19BF00F6C625 /* Platform.hpp */; }; + A09EEBF80D8C19BF00F6C625 /* Randomizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBEE0D8C19BF00F6C625 /* Randomizer.cpp */; }; + A09EEBF90D8C19BF00F6C625 /* Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF00D8C19BF00F6C625 /* Mutex.cpp */; }; + A09EEBFA0D8C19BF00F6C625 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF10D8C19BF00F6C625 /* Platform.cpp */; }; + A09EEBFB0D8C19BF00F6C625 /* Platform.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A09EEBF20D8C19BF00F6C625 /* Platform.hpp */; }; + A09EEBFC0D8C19BF00F6C625 /* Thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF30D8C19BF00F6C625 /* Thread.cpp */; }; + A09EEBFD0D8C19BF00F6C625 /* Clock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF40D8C19BF00F6C625 /* Clock.cpp */; }; + A09EEBFE0D8C19BF00F6C625 /* Lock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF50D8C19BF00F6C625 /* Lock.cpp */; }; + A09EEBFF0D8C19BF00F6C625 /* Sleep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF60D8C19BF00F6C625 /* Sleep.cpp */; }; + A0BE1A200D917332007D4CAD /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; }; + A0C93F930D9AA9FA00B9E0C8 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; }; + A0F1E68A0E75440800778F12 /* IPAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6800E75440800778F12 /* IPAddress.cpp */; }; + A0F1E68C0E75440800778F12 /* Packet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6820E75440800778F12 /* Packet.cpp */; }; + A0F1E68D0E75440800778F12 /* SelectorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6830E75440800778F12 /* SelectorBase.cpp */; }; + A0F1E68E0E75440800778F12 /* SocketTCP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6840E75440800778F12 /* SocketTCP.cpp */; }; + A0F1E68F0E75440800778F12 /* SocketUDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6850E75440800778F12 /* SocketUDP.cpp */; }; + A0F1E6900E75440800778F12 /* SocketHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6870E75440800778F12 /* SocketHelper.cpp */; }; + A0F1E71F0E7545AA00778F12 /* Arial.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6990E7545AA00778F12 /* Arial.hpp */; }; + A0F1E7200E7545AA00778F12 /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E69A0E7545AA00778F12 /* Color.cpp */; }; + A0F1E7210E7545AA00778F12 /* Drawable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E69B0E7545AA00778F12 /* Drawable.cpp */; }; + A0F1E7220E7545AA00778F12 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E69C0E7545AA00778F12 /* Font.cpp */; }; + A0F1E7230E7545AA00778F12 /* FontLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E69D0E7545AA00778F12 /* FontLoader.cpp */; }; + A0F1E7240E7545AA00778F12 /* FontLoader.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E69E0E7545AA00778F12 /* FontLoader.hpp */; }; + A0F1E7250E7545AA00778F12 /* glew.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6A00E7545AA00778F12 /* glew.c */; }; + A0F1E7260E7545AA00778F12 /* glew.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6A10E7545AA00778F12 /* glew.h */; }; + A0F1E7290E7545AA00778F12 /* GraphicsContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6A40E7545AA00778F12 /* GraphicsContext.cpp */; }; + A0F1E72A0E7545AA00778F12 /* GraphicsContext.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6A50E7545AA00778F12 /* GraphicsContext.hpp */; }; + A0F1E72B0E7545AA00778F12 /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6A60E7545AA00778F12 /* Image.cpp */; }; + A0F1E72C0E7545AA00778F12 /* ImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6A70E7545AA00778F12 /* ImageLoader.cpp */; }; + A0F1E72D0E7545AA00778F12 /* ImageLoader.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6A80E7545AA00778F12 /* ImageLoader.hpp */; }; + A0F1E72E0E7545AA00778F12 /* cderror.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6AA0E7545AA00778F12 /* cderror.h */; }; + A0F1E72F0E7545AA00778F12 /* jcapimin.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6AB0E7545AA00778F12 /* jcapimin.c */; }; + A0F1E7300E7545AA00778F12 /* jcapistd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6AC0E7545AA00778F12 /* jcapistd.c */; }; + A0F1E7310E7545AA00778F12 /* jccoefct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6AD0E7545AA00778F12 /* jccoefct.c */; }; + A0F1E7320E7545AA00778F12 /* jccolor.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6AE0E7545AA00778F12 /* jccolor.c */; }; + A0F1E7330E7545AA00778F12 /* jcdctmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6AF0E7545AA00778F12 /* jcdctmgr.c */; }; + A0F1E7340E7545AA00778F12 /* jchuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B00E7545AA00778F12 /* jchuff.c */; }; + A0F1E7350E7545AA00778F12 /* jchuff.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6B10E7545AA00778F12 /* jchuff.h */; }; + A0F1E7360E7545AA00778F12 /* jcinit.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B20E7545AA00778F12 /* jcinit.c */; }; + A0F1E7370E7545AA00778F12 /* jcmainct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B30E7545AA00778F12 /* jcmainct.c */; }; + A0F1E7380E7545AA00778F12 /* jcmarker.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B40E7545AA00778F12 /* jcmarker.c */; }; + A0F1E7390E7545AA00778F12 /* jcmaster.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B50E7545AA00778F12 /* jcmaster.c */; }; + A0F1E73A0E7545AA00778F12 /* jcomapi.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B60E7545AA00778F12 /* jcomapi.c */; }; + A0F1E73B0E7545AA00778F12 /* jconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6B70E7545AA00778F12 /* jconfig.h */; }; + A0F1E73C0E7545AA00778F12 /* jcparam.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B80E7545AA00778F12 /* jcparam.c */; }; + A0F1E73D0E7545AA00778F12 /* jcphuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6B90E7545AA00778F12 /* jcphuff.c */; }; + A0F1E73E0E7545AA00778F12 /* jcprepct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6BA0E7545AA00778F12 /* jcprepct.c */; }; + A0F1E73F0E7545AA00778F12 /* jcsample.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6BB0E7545AA00778F12 /* jcsample.c */; }; + A0F1E7400E7545AA00778F12 /* jctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6BC0E7545AA00778F12 /* jctrans.c */; }; + A0F1E7410E7545AA00778F12 /* jdapimin.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6BD0E7545AA00778F12 /* jdapimin.c */; }; + A0F1E7420E7545AA00778F12 /* jdapistd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6BE0E7545AA00778F12 /* jdapistd.c */; }; + A0F1E7430E7545AA00778F12 /* jdatadst.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6BF0E7545AA00778F12 /* jdatadst.c */; }; + A0F1E7440E7545AA00778F12 /* jdatasrc.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C00E7545AA00778F12 /* jdatasrc.c */; }; + A0F1E7450E7545AA00778F12 /* jdcoefct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C10E7545AA00778F12 /* jdcoefct.c */; }; + A0F1E7460E7545AA00778F12 /* jdcolor.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C20E7545AA00778F12 /* jdcolor.c */; }; + A0F1E7470E7545AA00778F12 /* jdct.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6C30E7545AA00778F12 /* jdct.h */; }; + A0F1E7480E7545AA00778F12 /* jddctmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C40E7545AA00778F12 /* jddctmgr.c */; }; + A0F1E7490E7545AA00778F12 /* jdhuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C50E7545AA00778F12 /* jdhuff.c */; }; + A0F1E74A0E7545AA00778F12 /* jdhuff.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6C60E7545AA00778F12 /* jdhuff.h */; }; + A0F1E74B0E7545AA00778F12 /* jdinput.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C70E7545AA00778F12 /* jdinput.c */; }; + A0F1E74C0E7545AA00778F12 /* jdmainct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C80E7545AA00778F12 /* jdmainct.c */; }; + A0F1E74D0E7545AA00778F12 /* jdmarker.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6C90E7545AA00778F12 /* jdmarker.c */; }; + A0F1E74E0E7545AA00778F12 /* jdmaster.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6CA0E7545AA00778F12 /* jdmaster.c */; }; + A0F1E74F0E7545AA00778F12 /* jdmerge.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6CB0E7545AA00778F12 /* jdmerge.c */; }; + A0F1E7500E7545AA00778F12 /* jdphuff.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6CC0E7545AA00778F12 /* jdphuff.c */; }; + A0F1E7510E7545AA00778F12 /* jdpostct.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6CD0E7545AA00778F12 /* jdpostct.c */; }; + A0F1E7520E7545AA00778F12 /* jdsample.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6CE0E7545AA00778F12 /* jdsample.c */; }; + A0F1E7530E7545AA00778F12 /* jdtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6CF0E7545AA00778F12 /* jdtrans.c */; }; + A0F1E7540E7545AA00778F12 /* jerror.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D00E7545AA00778F12 /* jerror.c */; }; + A0F1E7550E7545AA00778F12 /* jerror.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6D10E7545AA00778F12 /* jerror.h */; }; + A0F1E7560E7545AA00778F12 /* jfdctflt.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D20E7545AA00778F12 /* jfdctflt.c */; }; + A0F1E7570E7545AA00778F12 /* jfdctfst.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D30E7545AA00778F12 /* jfdctfst.c */; }; + A0F1E7580E7545AA00778F12 /* jfdctint.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D40E7545AA00778F12 /* jfdctint.c */; }; + A0F1E7590E7545AA00778F12 /* jidctflt.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D50E7545AA00778F12 /* jidctflt.c */; }; + A0F1E75A0E7545AA00778F12 /* jidctfst.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D60E7545AA00778F12 /* jidctfst.c */; }; + A0F1E75B0E7545AA00778F12 /* jidctint.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D70E7545AA00778F12 /* jidctint.c */; }; + A0F1E75C0E7545AA00778F12 /* jidctred.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6D80E7545AA00778F12 /* jidctred.c */; }; + A0F1E75D0E7545AA00778F12 /* jinclude.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6D90E7545AA00778F12 /* jinclude.h */; }; + A0F1E75E0E7545AA00778F12 /* jmemmgr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6DA0E7545AA00778F12 /* jmemmgr.c */; }; + A0F1E75F0E7545AA00778F12 /* jmemnobs.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6DB0E7545AA00778F12 /* jmemnobs.c */; }; + A0F1E7600E7545AA00778F12 /* jmemsys.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6DC0E7545AA00778F12 /* jmemsys.h */; }; + A0F1E7610E7545AA00778F12 /* jmorecfg.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6DD0E7545AA00778F12 /* jmorecfg.h */; }; + A0F1E7620E7545AA00778F12 /* jpegint.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6DE0E7545AA00778F12 /* jpegint.h */; }; + A0F1E7630E7545AA00778F12 /* jpeglib.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6DF0E7545AA00778F12 /* jpeglib.h */; }; + A0F1E7640E7545AA00778F12 /* jquant1.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6E00E7545AA00778F12 /* jquant1.c */; }; + A0F1E7650E7545AA00778F12 /* jquant2.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6E10E7545AA00778F12 /* jquant2.c */; }; + A0F1E7660E7545AA00778F12 /* jutils.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6E20E7545AA00778F12 /* jutils.c */; }; + A0F1E7670E7545AA00778F12 /* jversion.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6E30E7545AA00778F12 /* jversion.h */; }; + A0F1E7680E7545AA00778F12 /* png.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6E50E7545AA00778F12 /* png.c */; }; + A0F1E7690E7545AA00778F12 /* png.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6E60E7545AA00778F12 /* png.h */; }; + A0F1E76A0E7545AA00778F12 /* pngconf.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E6E70E7545AA00778F12 /* pngconf.h */; }; + A0F1E76B0E7545AA00778F12 /* pngerror.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6E80E7545AA00778F12 /* pngerror.c */; }; + A0F1E76C0E7545AA00778F12 /* pnggccrd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6E90E7545AA00778F12 /* pnggccrd.c */; }; + A0F1E76D0E7545AA00778F12 /* pngget.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6EA0E7545AA00778F12 /* pngget.c */; }; + A0F1E76E0E7545AA00778F12 /* pngmem.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6EB0E7545AA00778F12 /* pngmem.c */; }; + A0F1E76F0E7545AA00778F12 /* pngpread.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6EC0E7545AA00778F12 /* pngpread.c */; }; + A0F1E7700E7545AA00778F12 /* pngread.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6ED0E7545AA00778F12 /* pngread.c */; }; + A0F1E7710E7545AA00778F12 /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6EE0E7545AA00778F12 /* pngrio.c */; }; + A0F1E7720E7545AA00778F12 /* pngrtran.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6EF0E7545AA00778F12 /* pngrtran.c */; }; + A0F1E7730E7545AA00778F12 /* pngrutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F00E7545AA00778F12 /* pngrutil.c */; }; + A0F1E7740E7545AA00778F12 /* pngset.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F10E7545AA00778F12 /* pngset.c */; }; + A0F1E7750E7545AA00778F12 /* pngtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F20E7545AA00778F12 /* pngtrans.c */; }; + A0F1E7760E7545AA00778F12 /* pngvcrd.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F30E7545AA00778F12 /* pngvcrd.c */; }; + A0F1E7770E7545AA00778F12 /* pngwio.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F40E7545AA00778F12 /* pngwio.c */; }; + A0F1E7780E7545AA00778F12 /* pngwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F50E7545AA00778F12 /* pngwrite.c */; }; + A0F1E7790E7545AA00778F12 /* pngwtran.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F60E7545AA00778F12 /* pngwtran.c */; }; + A0F1E77A0E7545AA00778F12 /* pngwutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F70E7545AA00778F12 /* pngwutil.c */; }; + A0F1E77C0E7545AA00778F12 /* Matrix3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6F90E7545AA00778F12 /* Matrix3.cpp */; }; + A0F1E77D0E7545AA00778F12 /* PostFX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6FA0E7545AA00778F12 /* PostFX.cpp */; }; + A0F1E77E0E7545AA00778F12 /* RenderTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6FB0E7545AA00778F12 /* RenderTarget.cpp */; }; + A0F1E77F0E7545AA00778F12 /* RenderWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6FC0E7545AA00778F12 /* RenderWindow.cpp */; }; + A0F1E7800E7545AA00778F12 /* Shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6FD0E7545AA00778F12 /* Shape.cpp */; }; + A0F1E7810E7545AA00778F12 /* image_DXT.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6FF0E7545AA00778F12 /* image_DXT.c */; }; + A0F1E7820E7545AA00778F12 /* image_DXT.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7000E7545AA00778F12 /* image_DXT.h */; }; + A0F1E7830E7545AA00778F12 /* SOIL.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7010E7545AA00778F12 /* SOIL.c */; }; + A0F1E7840E7545AA00778F12 /* SOIL.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7020E7545AA00778F12 /* SOIL.h */; }; + A0F1E7850E7545AA00778F12 /* stb_image_aug.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7030E7545AA00778F12 /* stb_image_aug.c */; }; + A0F1E7860E7545AA00778F12 /* stb_image_aug.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7040E7545AA00778F12 /* stb_image_aug.h */; }; + A0F1E7870E7545AA00778F12 /* stbi_DDS_aug.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7050E7545AA00778F12 /* stbi_DDS_aug.h */; }; + A0F1E7880E7545AA00778F12 /* stbi_DDS_aug_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7060E7545AA00778F12 /* stbi_DDS_aug_c.h */; }; + A0F1E7890E7545AA00778F12 /* Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7070E7545AA00778F12 /* Sprite.cpp */; }; + A0F1E78A0E7545AA00778F12 /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7080E7545AA00778F12 /* String.cpp */; }; + A0F1E78B0E7545AA00778F12 /* View.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7090E7545AA00778F12 /* View.cpp */; }; + A0F1E78C0E7545AA00778F12 /* adler32.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E70B0E7545AA00778F12 /* adler32.c */; }; + A0F1E78D0E7545AA00778F12 /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E70C0E7545AA00778F12 /* compress.c */; }; + A0F1E78E0E7545AA00778F12 /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E70D0E7545AA00778F12 /* crc32.c */; }; + A0F1E78F0E7545AA00778F12 /* crc32.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E70E0E7545AA00778F12 /* crc32.h */; }; + A0F1E7900E7545AA00778F12 /* deflate.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E70F0E7545AA00778F12 /* deflate.c */; }; + A0F1E7910E7545AA00778F12 /* deflate.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7100E7545AA00778F12 /* deflate.h */; }; + A0F1E7920E7545AA00778F12 /* inffast.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7110E7545AA00778F12 /* inffast.c */; }; + A0F1E7930E7545AA00778F12 /* inffast.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7120E7545AA00778F12 /* inffast.h */; }; + A0F1E7940E7545AA00778F12 /* inffixed.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7130E7545AA00778F12 /* inffixed.h */; }; + A0F1E7950E7545AA00778F12 /* inflate.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7140E7545AA00778F12 /* inflate.c */; }; + A0F1E7960E7545AA00778F12 /* inflate.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7150E7545AA00778F12 /* inflate.h */; }; + A0F1E7970E7545AA00778F12 /* inftrees.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7160E7545AA00778F12 /* inftrees.c */; }; + A0F1E7980E7545AA00778F12 /* inftrees.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7170E7545AA00778F12 /* inftrees.h */; }; + A0F1E7990E7545AA00778F12 /* trees.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7180E7545AA00778F12 /* trees.c */; }; + A0F1E79A0E7545AA00778F12 /* trees.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7190E7545AA00778F12 /* trees.h */; }; + A0F1E79B0E7545AA00778F12 /* uncompr.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E71A0E7545AA00778F12 /* uncompr.c */; }; + A0F1E79C0E7545AA00778F12 /* zconf.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E71B0E7545AA00778F12 /* zconf.h */; }; + A0F1E79D0E7545AA00778F12 /* zlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E71C0E7545AA00778F12 /* zlib.h */; }; + A0F1E79E0E7545AA00778F12 /* zutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E71D0E7545AA00778F12 /* zutil.c */; }; + A0F1E79F0E7545AA00778F12 /* zutil.h in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E71E0E7545AA00778F12 /* zutil.h */; }; + A0F1E7E20E7545F800778F12 /* Context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7AC0E7545F800778F12 /* Context.cpp */; }; + A0F1E7E60E7545F800778F12 /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7B10E7545F800778F12 /* Input.cpp */; }; + A0F1E7E70E7545F800778F12 /* Joystick.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7B20E7545F800778F12 /* Joystick.hpp */; }; + A0F1E8070E7545F800778F12 /* VideoMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7D60E7545F800778F12 /* VideoMode.cpp */; }; + A0F1E8080E7545F800778F12 /* VideoModeSupport.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7D70E7545F800778F12 /* VideoModeSupport.hpp */; }; + A0F1E80F0E7545F800778F12 /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7DF0E7545F800778F12 /* Window.cpp */; }; + A0F1E8100E7545F800778F12 /* WindowImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E7E00E7545F800778F12 /* WindowImpl.cpp */; }; + A0F1E8110E7545F800778F12 /* WindowImpl.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A0F1E7E10E7545F800778F12 /* WindowImpl.hpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + A09EEA9F0D8C074D00F6C625 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc; + fileType = sourcecode.cpp; + isEditable = 1; + outputFiles = ( + ); + script = /usr/local/bin/ppm; + }; +/* End PBXBuildRule section */ + +/* Begin PBXContainerItemProxy section */ + A012F57F0E0FF91B0022FB0F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E3740D8BF86E002236B4; + remoteInfo = SFML; + }; + A012F5810E0FF9310022FB0F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E3740D8BF86E002236B4; + remoteInfo = SFML; + }; + A017FF8A0E51E06400A4C078 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E37E0D8BF87A002236B4; + remoteInfo = "sfml-system"; + }; + A07EA05A0DB657A9007C7747 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A0C93EB30D9A9CA000B9E0C8; + remoteInfo = "sfml-window-cocoa"; + }; + A07EA05C0DB657C0007C7747 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A0C93EB30D9A9CA000B9E0C8; + remoteInfo = "sfml-window-cocoa"; + }; + A093E5490D8BFEB9002236B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E37E0D8BF87A002236B4; + remoteInfo = "sfml-system"; + }; + A0B4CD390D96B11500DEEE0F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E3740D8BF86E002236B4; + remoteInfo = SFML; + }; + A0F0BA850D92E52300056981 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E3990D8BF89B002236B4; + remoteInfo = "sfml-audio"; + }; + A0F0BA870D92E52300056981 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E3A20D8BF8A2002236B4; + remoteInfo = "sfml-graphics"; + }; + A0F0BA890D92E52300056981 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E3870D8BF885002236B4; + remoteInfo = "sfml-network"; + }; + A0F0BA8B0D92E52300056981 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A093E36A0D8BF860002236B4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A093E37E0D8BF87A002236B4; + remoteInfo = "sfml-system"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + A018A2790EA21866005FFAC3 /* Http.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Http.cpp; path = ../../src/SFML/Network/Http.cpp; sourceTree = SOURCE_ROOT; }; + A018A27A0EA21866005FFAC3 /* Ftp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ftp.cpp; path = ../../src/SFML/Network/Ftp.cpp; sourceTree = SOURCE_ROOT; }; + A018A27D0EA218C7005FFAC3 /* Http.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Http.hpp; path = ../../include/SFML/Network/Http.hpp; sourceTree = SOURCE_ROOT; }; + A018A27E0EA218C7005FFAC3 /* Ftp.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Ftp.hpp; path = ../../include/SFML/Network/Ftp.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A830E7517C800D0BA9B /* AudioResource.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = AudioResource.hpp; path = ../../include/SFML/Audio/AudioResource.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A840E7517C800D0BA9B /* Listener.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Listener.hpp; path = ../../include/SFML/Audio/Listener.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A850E7517C800D0BA9B /* Music.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Music.hpp; path = ../../include/SFML/Audio/Music.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A860E7517C800D0BA9B /* Sound.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Sound.hpp; path = ../../include/SFML/Audio/Sound.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A870E7517C800D0BA9B /* SoundBuffer.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundBuffer.hpp; path = ../../include/SFML/Audio/SoundBuffer.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A880E7517C800D0BA9B /* SoundBufferRecorder.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundBufferRecorder.hpp; path = ../../include/SFML/Audio/SoundBufferRecorder.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A890E7517C800D0BA9B /* SoundRecorder.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundRecorder.hpp; path = ../../include/SFML/Audio/SoundRecorder.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A8A0E7517C800D0BA9B /* SoundStream.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundStream.hpp; path = ../../include/SFML/Audio/SoundStream.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A8B0E7517C800D0BA9B /* Audio.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Audio.hpp; path = ../../include/SFML/Audio.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A8C0E7517C800D0BA9B /* Config.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Config.hpp; path = ../../include/SFML/Config.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A8E0E7517C800D0BA9B /* Color.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Color.hpp; path = ../../include/SFML/Graphics/Color.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A8F0E7517C800D0BA9B /* Drawable.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Drawable.hpp; path = ../../include/SFML/Graphics/Drawable.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A900E7517C800D0BA9B /* Font.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Font.hpp; path = ../../include/SFML/Graphics/Font.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A910E7517C800D0BA9B /* Glyph.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Glyph.hpp; path = ../../include/SFML/Graphics/Glyph.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A920E7517C800D0BA9B /* Image.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Image.hpp; path = ../../include/SFML/Graphics/Image.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A930E7517C800D0BA9B /* Matrix3.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Matrix3.hpp; path = ../../include/SFML/Graphics/Matrix3.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A940E7517C800D0BA9B /* Matrix3.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Matrix3.inl; path = ../../include/SFML/Graphics/Matrix3.inl; sourceTree = SOURCE_ROOT; }; + A01A3A950E7517C800D0BA9B /* PostFX.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = PostFX.hpp; path = ../../include/SFML/Graphics/PostFX.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A960E7517C800D0BA9B /* Rect.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Rect.hpp; path = ../../include/SFML/Graphics/Rect.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A970E7517C800D0BA9B /* Rect.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Rect.inl; path = ../../include/SFML/Graphics/Rect.inl; sourceTree = SOURCE_ROOT; }; + A01A3A980E7517C800D0BA9B /* RenderTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = RenderTarget.hpp; path = ../../include/SFML/Graphics/RenderTarget.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A990E7517C800D0BA9B /* RenderWindow.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = RenderWindow.hpp; path = ../../include/SFML/Graphics/RenderWindow.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A9A0E7517C800D0BA9B /* Shape.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Shape.hpp; path = ../../include/SFML/Graphics/Shape.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A9B0E7517C800D0BA9B /* Sprite.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Sprite.hpp; path = ../../include/SFML/Graphics/Sprite.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A9C0E7517C800D0BA9B /* String.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = String.hpp; path = ../../include/SFML/Graphics/String.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A9D0E7517C800D0BA9B /* View.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = View.hpp; path = ../../include/SFML/Graphics/View.hpp; sourceTree = SOURCE_ROOT; }; + A01A3A9E0E7517C800D0BA9B /* Graphics.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Graphics.hpp; path = ../../include/SFML/Graphics.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA00E7517C800D0BA9B /* IPAddress.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = IPAddress.hpp; path = ../../include/SFML/Network/IPAddress.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA10E7517C800D0BA9B /* Packet.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Packet.hpp; path = ../../include/SFML/Network/Packet.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA20E7517C800D0BA9B /* Selector.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Selector.hpp; path = ../../include/SFML/Network/Selector.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA30E7517C800D0BA9B /* Selector.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Selector.inl; path = ../../include/SFML/Network/Selector.inl; sourceTree = SOURCE_ROOT; }; + A01A3AA40E7517C800D0BA9B /* SelectorBase.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SelectorBase.hpp; path = ../../include/SFML/Network/SelectorBase.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA50E7517C800D0BA9B /* SocketHelper.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SocketHelper.hpp; path = ../../include/SFML/Network/SocketHelper.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA60E7517C800D0BA9B /* Sockets.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Sockets.hpp; path = ../../include/SFML/Network/Sockets.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA70E7517C800D0BA9B /* SocketTCP.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SocketTCP.hpp; path = ../../include/SFML/Network/SocketTCP.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AA80E7517C800D0BA9B /* SocketUDP.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SocketUDP.hpp; path = ../../include/SFML/Network/SocketUDP.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AAA0E7517C800D0BA9B /* SocketHelper.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SocketHelper.hpp; path = ../../include/SFML/Network/Unix/SocketHelper.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AAC0E7517C800D0BA9B /* SocketHelper.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SocketHelper.hpp; path = ../../include/SFML/Network/Win32/SocketHelper.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AAD0E7517C800D0BA9B /* Network.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Network.hpp; path = ../../include/SFML/Network.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AAF0E7517C800D0BA9B /* Clock.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Clock.hpp; path = ../../include/SFML/System/Clock.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB00E7517C800D0BA9B /* Lock.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Lock.hpp; path = ../../include/SFML/System/Lock.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB10E7517C800D0BA9B /* Mutex.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Mutex.hpp; path = ../../include/SFML/System/Mutex.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB20E7517C800D0BA9B /* NonCopyable.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = NonCopyable.hpp; path = ../../include/SFML/System/NonCopyable.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB30E7517C800D0BA9B /* Randomizer.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Randomizer.hpp; path = ../../include/SFML/System/Randomizer.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB40E7517C800D0BA9B /* Resource.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Resource.hpp; path = ../../include/SFML/System/Resource.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB50E7517C800D0BA9B /* Resource.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Resource.inl; path = ../../include/SFML/System/Resource.inl; sourceTree = SOURCE_ROOT; }; + A01A3AB60E7517C800D0BA9B /* ResourcePtr.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = ResourcePtr.inl; path = ../../include/SFML/System/ResourcePtr.inl; sourceTree = SOURCE_ROOT; }; + A01A3AB70E7517C800D0BA9B /* Sleep.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Sleep.hpp; path = ../../include/SFML/System/Sleep.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB80E7517C800D0BA9B /* Thread.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Thread.hpp; path = ../../include/SFML/System/Thread.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AB90E7517C800D0BA9B /* Unicode.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Unicode.hpp; path = ../../include/SFML/System/Unicode.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ABA0E7517C800D0BA9B /* Unicode.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Unicode.inl; path = ../../include/SFML/System/Unicode.inl; sourceTree = SOURCE_ROOT; }; + A01A3ABC0E7517C800D0BA9B /* Mutex.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Mutex.hpp; path = ../../include/SFML/System/Unix/Mutex.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ABD0E7517C800D0BA9B /* Thread.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Thread.hpp; path = ../../include/SFML/System/Unix/Thread.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ABE0E7517C800D0BA9B /* Vector2.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Vector2.hpp; path = ../../include/SFML/System/Vector2.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ABF0E7517C800D0BA9B /* Vector2.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Vector2.inl; path = ../../include/SFML/System/Vector2.inl; sourceTree = SOURCE_ROOT; }; + A01A3AC00E7517C800D0BA9B /* Vector3.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Vector3.hpp; path = ../../include/SFML/System/Vector3.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AC10E7517C800D0BA9B /* Vector3.inl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = Vector3.inl; path = ../../include/SFML/System/Vector3.inl; sourceTree = SOURCE_ROOT; }; + A01A3AC50E7517C800D0BA9B /* System.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = System.hpp; path = ../../include/SFML/System.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AC70E7517C800D0BA9B /* Context.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Context.hpp; path = ../../include/SFML/Window/Context.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AC80E7517C800D0BA9B /* Event.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Event.hpp; path = ../../include/SFML/Window/Event.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AC90E7517C800D0BA9B /* Input.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Input.hpp; path = ../../include/SFML/Window/Input.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ACA0E7517C800D0BA9B /* OpenGL.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = OpenGL.hpp; path = ../../include/SFML/Window/OpenGL.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ACB0E7517C800D0BA9B /* VideoMode.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoMode.hpp; path = ../../include/SFML/Window/VideoMode.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ACC0E7517C800D0BA9B /* Window.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Window.hpp; path = ../../include/SFML/Window/Window.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ACD0E7517C800D0BA9B /* WindowHandle.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowHandle.hpp; path = ../../include/SFML/Window/WindowHandle.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ACE0E7517C800D0BA9B /* WindowListener.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowListener.hpp; path = ../../include/SFML/Window/WindowListener.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ACF0E7517C800D0BA9B /* WindowSettings.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowSettings.hpp; path = ../../include/SFML/Window/WindowSettings.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AD00E7517C800D0BA9B /* WindowStyle.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowStyle.hpp; path = ../../include/SFML/Window/WindowStyle.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AD10E7517C800D0BA9B /* Window.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Window.hpp; path = ../../include/SFML/Window.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AD80E75181300D0BA9B /* AudioDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AudioDevice.cpp; path = ../../src/SFML/Audio/AudioDevice.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AD90E75181300D0BA9B /* AudioDevice.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = AudioDevice.hpp; path = ../../src/SFML/Audio/AudioDevice.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ADA0E75181300D0BA9B /* AudioResource.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AudioResource.cpp; path = ../../src/SFML/Audio/AudioResource.cpp; sourceTree = SOURCE_ROOT; }; + A01A3ADB0E75181300D0BA9B /* Listener.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Listener.cpp; path = ../../src/SFML/Audio/Listener.cpp; sourceTree = SOURCE_ROOT; }; + A01A3ADD0E75181300D0BA9B /* Music.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Music.cpp; path = ../../src/SFML/Audio/Music.cpp; sourceTree = SOURCE_ROOT; }; + A01A3ADE0E75181300D0BA9B /* OpenAL.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = OpenAL.hpp; path = ../../src/SFML/Audio/OpenAL.hpp; sourceTree = SOURCE_ROOT; }; + A01A3ADF0E75181300D0BA9B /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sound.cpp; path = ../../src/SFML/Audio/Sound.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE00E75181300D0BA9B /* SoundBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundBuffer.cpp; path = ../../src/SFML/Audio/SoundBuffer.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE10E75181300D0BA9B /* SoundBufferRecorder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundBufferRecorder.cpp; path = ../../src/SFML/Audio/SoundBufferRecorder.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE20E75181300D0BA9B /* SoundFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundFile.cpp; path = ../../src/SFML/Audio/SoundFile.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE30E75181300D0BA9B /* SoundFile.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundFile.hpp; path = ../../src/SFML/Audio/SoundFile.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AE40E75181300D0BA9B /* SoundFileDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundFileDefault.cpp; path = ../../src/SFML/Audio/SoundFileDefault.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE50E75181300D0BA9B /* SoundFileDefault.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundFileDefault.hpp; path = ../../src/SFML/Audio/SoundFileDefault.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AE60E75181300D0BA9B /* SoundFileOgg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundFileOgg.cpp; path = ../../src/SFML/Audio/SoundFileOgg.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE70E75181300D0BA9B /* SoundFileOgg.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = SoundFileOgg.hpp; path = ../../src/SFML/Audio/SoundFileOgg.hpp; sourceTree = SOURCE_ROOT; }; + A01A3AE80E75181300D0BA9B /* SoundRecorder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundRecorder.cpp; path = ../../src/SFML/Audio/SoundRecorder.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AE90E75181300D0BA9B /* SoundStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SoundStream.cpp; path = ../../src/SFML/Audio/SoundStream.cpp; sourceTree = SOURCE_ROOT; }; + A01A3AEB0E75181300D0BA9B /* stb_vorbis.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stb_vorbis.c; path = ../../src/SFML/Audio/stb_vorbis/stb_vorbis.c; sourceTree = SOURCE_ROOT; }; + A01A3AEC0E75181300D0BA9B /* stb_vorbis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stb_vorbis.h; path = ../../src/SFML/Audio/stb_vorbis/stb_vorbis.h; sourceTree = SOURCE_ROOT; }; + A01C69C80E3E63CE00ED3F04 /* Unicode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Unicode.cpp; path = ../../src/SFML/System/Unicode.cpp; sourceTree = SOURCE_ROOT; }; + A04C59A50EDDBA9C00935061 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = ../../src/SFML/Window/Cocoa/AppController.h; sourceTree = SOURCE_ROOT; }; + A04C59A60EDDBA9C00935061 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = AppController.mm; path = ../../src/SFML/Window/Cocoa/AppController.mm; sourceTree = SOURCE_ROOT; }; + A04C59A70EDDBA9C00935061 /* Joystick.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Joystick.cpp; path = ../../src/SFML/Window/Cocoa/Joystick.cpp; sourceTree = SOURCE_ROOT; }; + A04C59A80EDDBA9C00935061 /* Joystick.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Joystick.hpp; path = ../../src/SFML/Window/Cocoa/Joystick.hpp; sourceTree = SOURCE_ROOT; }; + A04C59A90EDDBA9C00935061 /* VideoModeSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VideoModeSupport.cpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.cpp; sourceTree = SOURCE_ROOT; }; + A04C59AA0EDDBA9C00935061 /* VideoModeSupport.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoModeSupport.hpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.hpp; sourceTree = SOURCE_ROOT; }; + A04C59AB0EDDBA9C00935061 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WindowController.h; path = ../../src/SFML/Window/Cocoa/WindowController.h; sourceTree = SOURCE_ROOT; }; + A04C59AC0EDDBA9C00935061 /* WindowController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowController.mm; path = ../../src/SFML/Window/Cocoa/WindowController.mm; sourceTree = SOURCE_ROOT; }; + A04C59AD0EDDBA9C00935061 /* WindowImplCocoa.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowImplCocoa.hpp; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.hpp; sourceTree = SOURCE_ROOT; }; + A04C59AE0EDDBA9C00935061 /* WindowImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowImplCocoa.mm; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.mm; sourceTree = SOURCE_ROOT; }; + A093E3750D8BF86E002236B4 /* SFML.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SFML.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A093E3770D8BF86E002236B4 /* SFML-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SFML-Info.plist"; sourceTree = SOURCE_ROOT; }; + A093E37F0D8BF87A002236B4 /* sfml-system.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-system.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + A093E3800D8BF87A002236B4 /* sfml-system-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-system-Info.plist"; sourceTree = SOURCE_ROOT; }; + A093E3880D8BF885002236B4 /* sfml-network.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-network.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + A093E3890D8BF885002236B4 /* sfml-network-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-network-Info.plist"; sourceTree = SOURCE_ROOT; }; + A093E3920D8BF892002236B4 /* sfml-window-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-window-Info.plist"; sourceTree = SOURCE_ROOT; }; + A093E39A0D8BF89B002236B4 /* sfml-audio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-audio.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + A093E39B0D8BF89B002236B4 /* sfml-audio-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-audio-Info.plist"; sourceTree = SOURCE_ROOT; }; + A093E3A30D8BF8A2002236B4 /* sfml-graphics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-graphics.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + A093E3A40D8BF8A2002236B4 /* sfml-graphics-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-graphics-Info.plist"; sourceTree = SOURCE_ROOT; }; + A093E3CF0D8BF918002236B4 /* dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dummy.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBED0D8C19BF00F6C625 /* Platform.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Platform.hpp; path = ../../src/SFML/System/Platform.hpp; sourceTree = SOURCE_ROOT; }; + A09EEBEE0D8C19BF00F6C625 /* Randomizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Randomizer.cpp; path = ../../src/SFML/System/Randomizer.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBF00D8C19BF00F6C625 /* Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Mutex.cpp; path = ../../src/SFML/System/Unix/Mutex.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBF10D8C19BF00F6C625 /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Platform.cpp; path = ../../src/SFML/System/Unix/Platform.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBF20D8C19BF00F6C625 /* Platform.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Platform.hpp; path = ../../src/SFML/System/Unix/Platform.hpp; sourceTree = SOURCE_ROOT; }; + A09EEBF30D8C19BF00F6C625 /* Thread.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Thread.cpp; path = ../../src/SFML/System/Unix/Thread.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBF40D8C19BF00F6C625 /* Clock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Clock.cpp; path = ../../src/SFML/System/Clock.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBF50D8C19BF00F6C625 /* Lock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Lock.cpp; path = ../../src/SFML/System/Lock.cpp; sourceTree = SOURCE_ROOT; }; + A09EEBF60D8C19BF00F6C625 /* Sleep.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sleep.cpp; path = ../../src/SFML/System/Sleep.cpp; sourceTree = SOURCE_ROOT; }; + A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-window.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + A0F1E6800E75440800778F12 /* IPAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = IPAddress.cpp; path = ../../src/SFML/Network/IPAddress.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6820E75440800778F12 /* Packet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Packet.cpp; path = ../../src/SFML/Network/Packet.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6830E75440800778F12 /* SelectorBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SelectorBase.cpp; path = ../../src/SFML/Network/SelectorBase.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6840E75440800778F12 /* SocketTCP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SocketTCP.cpp; path = ../../src/SFML/Network/SocketTCP.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6850E75440800778F12 /* SocketUDP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SocketUDP.cpp; path = ../../src/SFML/Network/SocketUDP.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6870E75440800778F12 /* SocketHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SocketHelper.cpp; path = ../../src/SFML/Network/Unix/SocketHelper.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6990E7545AA00778F12 /* Arial.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Arial.hpp; path = ../../src/SFML/Graphics/Arial.hpp; sourceTree = SOURCE_ROOT; }; + A0F1E69A0E7545AA00778F12 /* Color.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Color.cpp; path = ../../src/SFML/Graphics/Color.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E69B0E7545AA00778F12 /* Drawable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Drawable.cpp; path = ../../src/SFML/Graphics/Drawable.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E69C0E7545AA00778F12 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Font.cpp; path = ../../src/SFML/Graphics/Font.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E69D0E7545AA00778F12 /* FontLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = FontLoader.cpp; path = ../../src/SFML/Graphics/FontLoader.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E69E0E7545AA00778F12 /* FontLoader.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = FontLoader.hpp; path = ../../src/SFML/Graphics/FontLoader.hpp; sourceTree = SOURCE_ROOT; }; + A0F1E6A00E7545AA00778F12 /* glew.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = glew.c; path = ../../src/SFML/Graphics/GLEW/glew.c; sourceTree = SOURCE_ROOT; }; + A0F1E6A10E7545AA00778F12 /* glew.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = glew.h; path = ../../src/SFML/Graphics/GLEW/glew.h; sourceTree = SOURCE_ROOT; }; + A0F1E6A40E7545AA00778F12 /* GraphicsContext.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = GraphicsContext.cpp; path = ../../src/SFML/Graphics/GraphicsContext.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6A50E7545AA00778F12 /* GraphicsContext.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = GraphicsContext.hpp; path = ../../src/SFML/Graphics/GraphicsContext.hpp; sourceTree = SOURCE_ROOT; }; + A0F1E6A60E7545AA00778F12 /* Image.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Image.cpp; path = ../../src/SFML/Graphics/Image.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6A70E7545AA00778F12 /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageLoader.cpp; path = ../../src/SFML/Graphics/ImageLoader.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6A80E7545AA00778F12 /* ImageLoader.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = ImageLoader.hpp; path = ../../src/SFML/Graphics/ImageLoader.hpp; sourceTree = SOURCE_ROOT; }; + A0F1E6AA0E7545AA00778F12 /* cderror.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cderror.h; path = ../../src/SFML/Graphics/libjpeg/cderror.h; sourceTree = SOURCE_ROOT; }; + A0F1E6AB0E7545AA00778F12 /* jcapimin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcapimin.c; path = ../../src/SFML/Graphics/libjpeg/jcapimin.c; sourceTree = SOURCE_ROOT; }; + A0F1E6AC0E7545AA00778F12 /* jcapistd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcapistd.c; path = ../../src/SFML/Graphics/libjpeg/jcapistd.c; sourceTree = SOURCE_ROOT; }; + A0F1E6AD0E7545AA00778F12 /* jccoefct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jccoefct.c; path = ../../src/SFML/Graphics/libjpeg/jccoefct.c; sourceTree = SOURCE_ROOT; }; + A0F1E6AE0E7545AA00778F12 /* jccolor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jccolor.c; path = ../../src/SFML/Graphics/libjpeg/jccolor.c; sourceTree = SOURCE_ROOT; }; + A0F1E6AF0E7545AA00778F12 /* jcdctmgr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcdctmgr.c; path = ../../src/SFML/Graphics/libjpeg/jcdctmgr.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B00E7545AA00778F12 /* jchuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jchuff.c; path = ../../src/SFML/Graphics/libjpeg/jchuff.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B10E7545AA00778F12 /* jchuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jchuff.h; path = ../../src/SFML/Graphics/libjpeg/jchuff.h; sourceTree = SOURCE_ROOT; }; + A0F1E6B20E7545AA00778F12 /* jcinit.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcinit.c; path = ../../src/SFML/Graphics/libjpeg/jcinit.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B30E7545AA00778F12 /* jcmainct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcmainct.c; path = ../../src/SFML/Graphics/libjpeg/jcmainct.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B40E7545AA00778F12 /* jcmarker.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcmarker.c; path = ../../src/SFML/Graphics/libjpeg/jcmarker.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B50E7545AA00778F12 /* jcmaster.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcmaster.c; path = ../../src/SFML/Graphics/libjpeg/jcmaster.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B60E7545AA00778F12 /* jcomapi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcomapi.c; path = ../../src/SFML/Graphics/libjpeg/jcomapi.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B70E7545AA00778F12 /* jconfig.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jconfig.h; path = ../../src/SFML/Graphics/libjpeg/jconfig.h; sourceTree = SOURCE_ROOT; }; + A0F1E6B80E7545AA00778F12 /* jcparam.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcparam.c; path = ../../src/SFML/Graphics/libjpeg/jcparam.c; sourceTree = SOURCE_ROOT; }; + A0F1E6B90E7545AA00778F12 /* jcphuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcphuff.c; path = ../../src/SFML/Graphics/libjpeg/jcphuff.c; sourceTree = SOURCE_ROOT; }; + A0F1E6BA0E7545AA00778F12 /* jcprepct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcprepct.c; path = ../../src/SFML/Graphics/libjpeg/jcprepct.c; sourceTree = SOURCE_ROOT; }; + A0F1E6BB0E7545AA00778F12 /* jcsample.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jcsample.c; path = ../../src/SFML/Graphics/libjpeg/jcsample.c; sourceTree = SOURCE_ROOT; }; + A0F1E6BC0E7545AA00778F12 /* jctrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jctrans.c; path = ../../src/SFML/Graphics/libjpeg/jctrans.c; sourceTree = SOURCE_ROOT; }; + A0F1E6BD0E7545AA00778F12 /* jdapimin.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdapimin.c; path = ../../src/SFML/Graphics/libjpeg/jdapimin.c; sourceTree = SOURCE_ROOT; }; + A0F1E6BE0E7545AA00778F12 /* jdapistd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdapistd.c; path = ../../src/SFML/Graphics/libjpeg/jdapistd.c; sourceTree = SOURCE_ROOT; }; + A0F1E6BF0E7545AA00778F12 /* jdatadst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdatadst.c; path = ../../src/SFML/Graphics/libjpeg/jdatadst.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C00E7545AA00778F12 /* jdatasrc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdatasrc.c; path = ../../src/SFML/Graphics/libjpeg/jdatasrc.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C10E7545AA00778F12 /* jdcoefct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdcoefct.c; path = ../../src/SFML/Graphics/libjpeg/jdcoefct.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C20E7545AA00778F12 /* jdcolor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdcolor.c; path = ../../src/SFML/Graphics/libjpeg/jdcolor.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C30E7545AA00778F12 /* jdct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jdct.h; path = ../../src/SFML/Graphics/libjpeg/jdct.h; sourceTree = SOURCE_ROOT; }; + A0F1E6C40E7545AA00778F12 /* jddctmgr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jddctmgr.c; path = ../../src/SFML/Graphics/libjpeg/jddctmgr.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C50E7545AA00778F12 /* jdhuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdhuff.c; path = ../../src/SFML/Graphics/libjpeg/jdhuff.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C60E7545AA00778F12 /* jdhuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jdhuff.h; path = ../../src/SFML/Graphics/libjpeg/jdhuff.h; sourceTree = SOURCE_ROOT; }; + A0F1E6C70E7545AA00778F12 /* jdinput.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdinput.c; path = ../../src/SFML/Graphics/libjpeg/jdinput.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C80E7545AA00778F12 /* jdmainct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmainct.c; path = ../../src/SFML/Graphics/libjpeg/jdmainct.c; sourceTree = SOURCE_ROOT; }; + A0F1E6C90E7545AA00778F12 /* jdmarker.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmarker.c; path = ../../src/SFML/Graphics/libjpeg/jdmarker.c; sourceTree = SOURCE_ROOT; }; + A0F1E6CA0E7545AA00778F12 /* jdmaster.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmaster.c; path = ../../src/SFML/Graphics/libjpeg/jdmaster.c; sourceTree = SOURCE_ROOT; }; + A0F1E6CB0E7545AA00778F12 /* jdmerge.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdmerge.c; path = ../../src/SFML/Graphics/libjpeg/jdmerge.c; sourceTree = SOURCE_ROOT; }; + A0F1E6CC0E7545AA00778F12 /* jdphuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdphuff.c; path = ../../src/SFML/Graphics/libjpeg/jdphuff.c; sourceTree = SOURCE_ROOT; }; + A0F1E6CD0E7545AA00778F12 /* jdpostct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdpostct.c; path = ../../src/SFML/Graphics/libjpeg/jdpostct.c; sourceTree = SOURCE_ROOT; }; + A0F1E6CE0E7545AA00778F12 /* jdsample.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdsample.c; path = ../../src/SFML/Graphics/libjpeg/jdsample.c; sourceTree = SOURCE_ROOT; }; + A0F1E6CF0E7545AA00778F12 /* jdtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jdtrans.c; path = ../../src/SFML/Graphics/libjpeg/jdtrans.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D00E7545AA00778F12 /* jerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jerror.c; path = ../../src/SFML/Graphics/libjpeg/jerror.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D10E7545AA00778F12 /* jerror.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jerror.h; path = ../../src/SFML/Graphics/libjpeg/jerror.h; sourceTree = SOURCE_ROOT; }; + A0F1E6D20E7545AA00778F12 /* jfdctflt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jfdctflt.c; path = ../../src/SFML/Graphics/libjpeg/jfdctflt.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D30E7545AA00778F12 /* jfdctfst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jfdctfst.c; path = ../../src/SFML/Graphics/libjpeg/jfdctfst.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D40E7545AA00778F12 /* jfdctint.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jfdctint.c; path = ../../src/SFML/Graphics/libjpeg/jfdctint.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D50E7545AA00778F12 /* jidctflt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctflt.c; path = ../../src/SFML/Graphics/libjpeg/jidctflt.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D60E7545AA00778F12 /* jidctfst.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctfst.c; path = ../../src/SFML/Graphics/libjpeg/jidctfst.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D70E7545AA00778F12 /* jidctint.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctint.c; path = ../../src/SFML/Graphics/libjpeg/jidctint.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D80E7545AA00778F12 /* jidctred.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jidctred.c; path = ../../src/SFML/Graphics/libjpeg/jidctred.c; sourceTree = SOURCE_ROOT; }; + A0F1E6D90E7545AA00778F12 /* jinclude.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jinclude.h; path = ../../src/SFML/Graphics/libjpeg/jinclude.h; sourceTree = SOURCE_ROOT; }; + A0F1E6DA0E7545AA00778F12 /* jmemmgr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jmemmgr.c; path = ../../src/SFML/Graphics/libjpeg/jmemmgr.c; sourceTree = SOURCE_ROOT; }; + A0F1E6DB0E7545AA00778F12 /* jmemnobs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jmemnobs.c; path = ../../src/SFML/Graphics/libjpeg/jmemnobs.c; sourceTree = SOURCE_ROOT; }; + A0F1E6DC0E7545AA00778F12 /* jmemsys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jmemsys.h; path = ../../src/SFML/Graphics/libjpeg/jmemsys.h; sourceTree = SOURCE_ROOT; }; + A0F1E6DD0E7545AA00778F12 /* jmorecfg.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jmorecfg.h; path = ../../src/SFML/Graphics/libjpeg/jmorecfg.h; sourceTree = SOURCE_ROOT; }; + A0F1E6DE0E7545AA00778F12 /* jpegint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jpegint.h; path = ../../src/SFML/Graphics/libjpeg/jpegint.h; sourceTree = SOURCE_ROOT; }; + A0F1E6DF0E7545AA00778F12 /* jpeglib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jpeglib.h; path = ../../src/SFML/Graphics/libjpeg/jpeglib.h; sourceTree = SOURCE_ROOT; }; + A0F1E6E00E7545AA00778F12 /* jquant1.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jquant1.c; path = ../../src/SFML/Graphics/libjpeg/jquant1.c; sourceTree = SOURCE_ROOT; }; + A0F1E6E10E7545AA00778F12 /* jquant2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jquant2.c; path = ../../src/SFML/Graphics/libjpeg/jquant2.c; sourceTree = SOURCE_ROOT; }; + A0F1E6E20E7545AA00778F12 /* jutils.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = jutils.c; path = ../../src/SFML/Graphics/libjpeg/jutils.c; sourceTree = SOURCE_ROOT; }; + A0F1E6E30E7545AA00778F12 /* jversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = jversion.h; path = ../../src/SFML/Graphics/libjpeg/jversion.h; sourceTree = SOURCE_ROOT; }; + A0F1E6E50E7545AA00778F12 /* png.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = png.c; path = ../../src/SFML/Graphics/libpng/png.c; sourceTree = SOURCE_ROOT; }; + A0F1E6E60E7545AA00778F12 /* png.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = png.h; path = ../../src/SFML/Graphics/libpng/png.h; sourceTree = SOURCE_ROOT; }; + A0F1E6E70E7545AA00778F12 /* pngconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pngconf.h; path = ../../src/SFML/Graphics/libpng/pngconf.h; sourceTree = SOURCE_ROOT; }; + A0F1E6E80E7545AA00778F12 /* pngerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngerror.c; path = ../../src/SFML/Graphics/libpng/pngerror.c; sourceTree = SOURCE_ROOT; }; + A0F1E6E90E7545AA00778F12 /* pnggccrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pnggccrd.c; path = ../../src/SFML/Graphics/libpng/pnggccrd.c; sourceTree = SOURCE_ROOT; }; + A0F1E6EA0E7545AA00778F12 /* pngget.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngget.c; path = ../../src/SFML/Graphics/libpng/pngget.c; sourceTree = SOURCE_ROOT; }; + A0F1E6EB0E7545AA00778F12 /* pngmem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngmem.c; path = ../../src/SFML/Graphics/libpng/pngmem.c; sourceTree = SOURCE_ROOT; }; + A0F1E6EC0E7545AA00778F12 /* pngpread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngpread.c; path = ../../src/SFML/Graphics/libpng/pngpread.c; sourceTree = SOURCE_ROOT; }; + A0F1E6ED0E7545AA00778F12 /* pngread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngread.c; path = ../../src/SFML/Graphics/libpng/pngread.c; sourceTree = SOURCE_ROOT; }; + A0F1E6EE0E7545AA00778F12 /* pngrio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrio.c; path = ../../src/SFML/Graphics/libpng/pngrio.c; sourceTree = SOURCE_ROOT; }; + A0F1E6EF0E7545AA00778F12 /* pngrtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrtran.c; path = ../../src/SFML/Graphics/libpng/pngrtran.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F00E7545AA00778F12 /* pngrutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrutil.c; path = ../../src/SFML/Graphics/libpng/pngrutil.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F10E7545AA00778F12 /* pngset.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngset.c; path = ../../src/SFML/Graphics/libpng/pngset.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F20E7545AA00778F12 /* pngtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngtrans.c; path = ../../src/SFML/Graphics/libpng/pngtrans.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F30E7545AA00778F12 /* pngvcrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngvcrd.c; path = ../../src/SFML/Graphics/libpng/pngvcrd.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F40E7545AA00778F12 /* pngwio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwio.c; path = ../../src/SFML/Graphics/libpng/pngwio.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F50E7545AA00778F12 /* pngwrite.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwrite.c; path = ../../src/SFML/Graphics/libpng/pngwrite.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F60E7545AA00778F12 /* pngwtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwtran.c; path = ../../src/SFML/Graphics/libpng/pngwtran.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F70E7545AA00778F12 /* pngwutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwutil.c; path = ../../src/SFML/Graphics/libpng/pngwutil.c; sourceTree = SOURCE_ROOT; }; + A0F1E6F90E7545AA00778F12 /* Matrix3.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Matrix3.cpp; path = ../../src/SFML/Graphics/Matrix3.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6FA0E7545AA00778F12 /* PostFX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PostFX.cpp; path = ../../src/SFML/Graphics/PostFX.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6FB0E7545AA00778F12 /* RenderTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = RenderTarget.cpp; path = ../../src/SFML/Graphics/RenderTarget.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6FC0E7545AA00778F12 /* RenderWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = RenderWindow.cpp; path = ../../src/SFML/Graphics/RenderWindow.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6FD0E7545AA00778F12 /* Shape.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Shape.cpp; path = ../../src/SFML/Graphics/Shape.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E6FF0E7545AA00778F12 /* image_DXT.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = image_DXT.c; path = ../../src/SFML/Graphics/SOIL/image_DXT.c; sourceTree = SOURCE_ROOT; }; + A0F1E7000E7545AA00778F12 /* image_DXT.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = image_DXT.h; path = ../../src/SFML/Graphics/SOIL/image_DXT.h; sourceTree = SOURCE_ROOT; }; + A0F1E7010E7545AA00778F12 /* SOIL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SOIL.c; path = ../../src/SFML/Graphics/SOIL/SOIL.c; sourceTree = SOURCE_ROOT; }; + A0F1E7020E7545AA00778F12 /* SOIL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SOIL.h; path = ../../src/SFML/Graphics/SOIL/SOIL.h; sourceTree = SOURCE_ROOT; }; + A0F1E7030E7545AA00778F12 /* stb_image_aug.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stb_image_aug.c; path = ../../src/SFML/Graphics/SOIL/stb_image_aug.c; sourceTree = SOURCE_ROOT; }; + A0F1E7040E7545AA00778F12 /* stb_image_aug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stb_image_aug.h; path = ../../src/SFML/Graphics/SOIL/stb_image_aug.h; sourceTree = SOURCE_ROOT; }; + A0F1E7050E7545AA00778F12 /* stbi_DDS_aug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stbi_DDS_aug.h; path = ../../src/SFML/Graphics/SOIL/stbi_DDS_aug.h; sourceTree = SOURCE_ROOT; }; + A0F1E7060E7545AA00778F12 /* stbi_DDS_aug_c.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stbi_DDS_aug_c.h; path = ../../src/SFML/Graphics/SOIL/stbi_DDS_aug_c.h; sourceTree = SOURCE_ROOT; }; + A0F1E7070E7545AA00778F12 /* Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite.cpp; path = ../../src/SFML/Graphics/Sprite.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7080E7545AA00778F12 /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = String.cpp; path = ../../src/SFML/Graphics/String.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7090E7545AA00778F12 /* View.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = View.cpp; path = ../../src/SFML/Graphics/View.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E70B0E7545AA00778F12 /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = adler32.c; path = ../../src/SFML/Graphics/zlib/adler32.c; sourceTree = SOURCE_ROOT; }; + A0F1E70C0E7545AA00778F12 /* compress.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = compress.c; path = ../../src/SFML/Graphics/zlib/compress.c; sourceTree = SOURCE_ROOT; }; + A0F1E70D0E7545AA00778F12 /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ../../src/SFML/Graphics/zlib/crc32.c; sourceTree = SOURCE_ROOT; }; + A0F1E70E0E7545AA00778F12 /* crc32.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = crc32.h; path = ../../src/SFML/Graphics/zlib/crc32.h; sourceTree = SOURCE_ROOT; }; + A0F1E70F0E7545AA00778F12 /* deflate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = deflate.c; path = ../../src/SFML/Graphics/zlib/deflate.c; sourceTree = SOURCE_ROOT; }; + A0F1E7100E7545AA00778F12 /* deflate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = deflate.h; path = ../../src/SFML/Graphics/zlib/deflate.h; sourceTree = SOURCE_ROOT; }; + A0F1E7110E7545AA00778F12 /* inffast.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inffast.c; path = ../../src/SFML/Graphics/zlib/inffast.c; sourceTree = SOURCE_ROOT; }; + A0F1E7120E7545AA00778F12 /* inffast.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inffast.h; path = ../../src/SFML/Graphics/zlib/inffast.h; sourceTree = SOURCE_ROOT; }; + A0F1E7130E7545AA00778F12 /* inffixed.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inffixed.h; path = ../../src/SFML/Graphics/zlib/inffixed.h; sourceTree = SOURCE_ROOT; }; + A0F1E7140E7545AA00778F12 /* inflate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inflate.c; path = ../../src/SFML/Graphics/zlib/inflate.c; sourceTree = SOURCE_ROOT; }; + A0F1E7150E7545AA00778F12 /* inflate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inflate.h; path = ../../src/SFML/Graphics/zlib/inflate.h; sourceTree = SOURCE_ROOT; }; + A0F1E7160E7545AA00778F12 /* inftrees.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = inftrees.c; path = ../../src/SFML/Graphics/zlib/inftrees.c; sourceTree = SOURCE_ROOT; }; + A0F1E7170E7545AA00778F12 /* inftrees.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = inftrees.h; path = ../../src/SFML/Graphics/zlib/inftrees.h; sourceTree = SOURCE_ROOT; }; + A0F1E7180E7545AA00778F12 /* trees.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = trees.c; path = ../../src/SFML/Graphics/zlib/trees.c; sourceTree = SOURCE_ROOT; }; + A0F1E7190E7545AA00778F12 /* trees.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = trees.h; path = ../../src/SFML/Graphics/zlib/trees.h; sourceTree = SOURCE_ROOT; }; + A0F1E71A0E7545AA00778F12 /* uncompr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = uncompr.c; path = ../../src/SFML/Graphics/zlib/uncompr.c; sourceTree = SOURCE_ROOT; }; + A0F1E71B0E7545AA00778F12 /* zconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = zconf.h; path = ../../src/SFML/Graphics/zlib/zconf.h; sourceTree = SOURCE_ROOT; }; + A0F1E71C0E7545AA00778F12 /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = zlib.h; path = ../../src/SFML/Graphics/zlib/zlib.h; sourceTree = SOURCE_ROOT; }; + A0F1E71D0E7545AA00778F12 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = zutil.c; path = ../../src/SFML/Graphics/zlib/zutil.c; sourceTree = SOURCE_ROOT; }; + A0F1E71E0E7545AA00778F12 /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = zutil.h; path = ../../src/SFML/Graphics/zlib/zutil.h; sourceTree = SOURCE_ROOT; }; + A0F1E7AC0E7545F800778F12 /* Context.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Context.cpp; path = ../../src/SFML/Window/Context.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7B10E7545F800778F12 /* Input.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Input.cpp; path = ../../src/SFML/Window/Input.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7B20E7545F800778F12 /* Joystick.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Joystick.hpp; path = ../../src/SFML/Window/Joystick.hpp; sourceTree = SOURCE_ROOT; }; + A0F1E7D60E7545F800778F12 /* VideoMode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VideoMode.cpp; path = ../../src/SFML/Window/VideoMode.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7D70E7545F800778F12 /* VideoModeSupport.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoModeSupport.hpp; path = ../../src/SFML/Window/VideoModeSupport.hpp; sourceTree = SOURCE_ROOT; }; + A0F1E7DF0E7545F800778F12 /* Window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Window.cpp; path = ../../src/SFML/Window/Window.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7E00E7545F800778F12 /* WindowImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = WindowImpl.cpp; path = ../../src/SFML/Window/WindowImpl.cpp; sourceTree = SOURCE_ROOT; }; + A0F1E7E10E7545F800778F12 /* WindowImpl.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowImpl.hpp; path = ../../src/SFML/Window/WindowImpl.hpp; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A093E3730D8BF86E002236B4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E37D0D8BF87A002236B4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3860D8BF885002236B4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3980D8BF89B002236B4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A093E5480D8BFEAE002236B4 /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3A10D8BF8A2002236B4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A0BE1A200D917332007D4CAD /* sfml-system.framework in Frameworks */, + A05EEF700E5CF18F00572B7E /* sfml-window.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A0C93EB20D9A9CA000B9E0C8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A0C93F930D9AA9FA00B9E0C8 /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A01A3A810E7517C800D0BA9B /* Headers */ = { + isa = PBXGroup; + children = ( + A01A3A820E7517C800D0BA9B /* Audio */, + A01A3A8B0E7517C800D0BA9B /* Audio.hpp */, + A01A3A8C0E7517C800D0BA9B /* Config.hpp */, + A01A3A8D0E7517C800D0BA9B /* Graphics */, + A01A3A9E0E7517C800D0BA9B /* Graphics.hpp */, + A01A3A9F0E7517C800D0BA9B /* Network */, + A01A3AAD0E7517C800D0BA9B /* Network.hpp */, + A01A3AAE0E7517C800D0BA9B /* System */, + A01A3AC50E7517C800D0BA9B /* System.hpp */, + A01A3AC60E7517C800D0BA9B /* Window */, + A01A3AD10E7517C800D0BA9B /* Window.hpp */, + ); + name = Headers; + path = ../../include/SFML; + sourceTree = SOURCE_ROOT; + }; + A01A3A820E7517C800D0BA9B /* Audio */ = { + isa = PBXGroup; + children = ( + A01A3A830E7517C800D0BA9B /* AudioResource.hpp */, + A01A3A840E7517C800D0BA9B /* Listener.hpp */, + A01A3A850E7517C800D0BA9B /* Music.hpp */, + A01A3A860E7517C800D0BA9B /* Sound.hpp */, + A01A3A870E7517C800D0BA9B /* SoundBuffer.hpp */, + A01A3A880E7517C800D0BA9B /* SoundBufferRecorder.hpp */, + A01A3A890E7517C800D0BA9B /* SoundRecorder.hpp */, + A01A3A8A0E7517C800D0BA9B /* SoundStream.hpp */, + ); + name = Audio; + path = ../../include/SFML/Audio; + sourceTree = SOURCE_ROOT; + }; + A01A3A8D0E7517C800D0BA9B /* Graphics */ = { + isa = PBXGroup; + children = ( + A01A3A8E0E7517C800D0BA9B /* Color.hpp */, + A01A3A8F0E7517C800D0BA9B /* Drawable.hpp */, + A01A3A900E7517C800D0BA9B /* Font.hpp */, + A01A3A910E7517C800D0BA9B /* Glyph.hpp */, + A01A3A920E7517C800D0BA9B /* Image.hpp */, + A01A3A930E7517C800D0BA9B /* Matrix3.hpp */, + A01A3A940E7517C800D0BA9B /* Matrix3.inl */, + A01A3A950E7517C800D0BA9B /* PostFX.hpp */, + A01A3A960E7517C800D0BA9B /* Rect.hpp */, + A01A3A970E7517C800D0BA9B /* Rect.inl */, + A01A3A980E7517C800D0BA9B /* RenderTarget.hpp */, + A01A3A990E7517C800D0BA9B /* RenderWindow.hpp */, + A01A3A9A0E7517C800D0BA9B /* Shape.hpp */, + A01A3A9B0E7517C800D0BA9B /* Sprite.hpp */, + A01A3A9C0E7517C800D0BA9B /* String.hpp */, + A01A3A9D0E7517C800D0BA9B /* View.hpp */, + ); + name = Graphics; + path = ../../include/SFML/Graphics; + sourceTree = SOURCE_ROOT; + }; + A01A3A9F0E7517C800D0BA9B /* Network */ = { + isa = PBXGroup; + children = ( + A018A27D0EA218C7005FFAC3 /* Http.hpp */, + A018A27E0EA218C7005FFAC3 /* Ftp.hpp */, + A01A3AA00E7517C800D0BA9B /* IPAddress.hpp */, + A01A3AA10E7517C800D0BA9B /* Packet.hpp */, + A01A3AA20E7517C800D0BA9B /* Selector.hpp */, + A01A3AA30E7517C800D0BA9B /* Selector.inl */, + A01A3AA40E7517C800D0BA9B /* SelectorBase.hpp */, + A01A3AA50E7517C800D0BA9B /* SocketHelper.hpp */, + A01A3AA60E7517C800D0BA9B /* Sockets.hpp */, + A01A3AA70E7517C800D0BA9B /* SocketTCP.hpp */, + A01A3AA80E7517C800D0BA9B /* SocketUDP.hpp */, + A01A3AA90E7517C800D0BA9B /* Unix */, + A01A3AAB0E7517C800D0BA9B /* Win32 */, + ); + name = Network; + path = ../../include/SFML/Network; + sourceTree = SOURCE_ROOT; + }; + A01A3AA90E7517C800D0BA9B /* Unix */ = { + isa = PBXGroup; + children = ( + A01A3AAA0E7517C800D0BA9B /* SocketHelper.hpp */, + ); + name = Unix; + path = ../../include/SFML/Network/Unix; + sourceTree = SOURCE_ROOT; + }; + A01A3AAB0E7517C800D0BA9B /* Win32 */ = { + isa = PBXGroup; + children = ( + A01A3AAC0E7517C800D0BA9B /* SocketHelper.hpp */, + ); + name = Win32; + path = ../../include/SFML/Network/Win32; + sourceTree = SOURCE_ROOT; + }; + A01A3AAE0E7517C800D0BA9B /* System */ = { + isa = PBXGroup; + children = ( + A01A3AAF0E7517C800D0BA9B /* Clock.hpp */, + A01A3AB00E7517C800D0BA9B /* Lock.hpp */, + A01A3AB10E7517C800D0BA9B /* Mutex.hpp */, + A01A3AB20E7517C800D0BA9B /* NonCopyable.hpp */, + A01A3AB30E7517C800D0BA9B /* Randomizer.hpp */, + A01A3AB40E7517C800D0BA9B /* Resource.hpp */, + A01A3AB50E7517C800D0BA9B /* Resource.inl */, + A01A3AB60E7517C800D0BA9B /* ResourcePtr.inl */, + A01A3AB70E7517C800D0BA9B /* Sleep.hpp */, + A01A3AB80E7517C800D0BA9B /* Thread.hpp */, + A01A3AB90E7517C800D0BA9B /* Unicode.hpp */, + A01A3ABA0E7517C800D0BA9B /* Unicode.inl */, + A01A3ABB0E7517C800D0BA9B /* Unix */, + A01A3ABE0E7517C800D0BA9B /* Vector2.hpp */, + A01A3ABF0E7517C800D0BA9B /* Vector2.inl */, + A01A3AC00E7517C800D0BA9B /* Vector3.hpp */, + A01A3AC10E7517C800D0BA9B /* Vector3.inl */, + ); + name = System; + path = ../../include/SFML/System; + sourceTree = SOURCE_ROOT; + }; + A01A3ABB0E7517C800D0BA9B /* Unix */ = { + isa = PBXGroup; + children = ( + A01A3ABC0E7517C800D0BA9B /* Mutex.hpp */, + A01A3ABD0E7517C800D0BA9B /* Thread.hpp */, + ); + name = Unix; + path = ../../include/SFML/System/Unix; + sourceTree = SOURCE_ROOT; + }; + A01A3AC60E7517C800D0BA9B /* Window */ = { + isa = PBXGroup; + children = ( + A01A3AC70E7517C800D0BA9B /* Context.hpp */, + A01A3AC80E7517C800D0BA9B /* Event.hpp */, + A01A3AC90E7517C800D0BA9B /* Input.hpp */, + A01A3ACA0E7517C800D0BA9B /* OpenGL.hpp */, + A01A3ACB0E7517C800D0BA9B /* VideoMode.hpp */, + A01A3ACC0E7517C800D0BA9B /* Window.hpp */, + A01A3ACD0E7517C800D0BA9B /* WindowHandle.hpp */, + A01A3ACE0E7517C800D0BA9B /* WindowListener.hpp */, + A01A3ACF0E7517C800D0BA9B /* WindowSettings.hpp */, + A01A3AD00E7517C800D0BA9B /* WindowStyle.hpp */, + ); + name = Window; + path = ../../include/SFML/Window; + sourceTree = SOURCE_ROOT; + }; + A01A3AD70E75181300D0BA9B /* Sources */ = { + isa = PBXGroup; + children = ( + A01A3AD80E75181300D0BA9B /* AudioDevice.cpp */, + A01A3AD90E75181300D0BA9B /* AudioDevice.hpp */, + A01A3ADA0E75181300D0BA9B /* AudioResource.cpp */, + A01A3ADB0E75181300D0BA9B /* Listener.cpp */, + A01A3ADD0E75181300D0BA9B /* Music.cpp */, + A01A3ADE0E75181300D0BA9B /* OpenAL.hpp */, + A01A3ADF0E75181300D0BA9B /* Sound.cpp */, + A01A3AE00E75181300D0BA9B /* SoundBuffer.cpp */, + A01A3AE10E75181300D0BA9B /* SoundBufferRecorder.cpp */, + A01A3AE20E75181300D0BA9B /* SoundFile.cpp */, + A01A3AE30E75181300D0BA9B /* SoundFile.hpp */, + A01A3AE40E75181300D0BA9B /* SoundFileDefault.cpp */, + A01A3AE50E75181300D0BA9B /* SoundFileDefault.hpp */, + A01A3AE60E75181300D0BA9B /* SoundFileOgg.cpp */, + A01A3AE70E75181300D0BA9B /* SoundFileOgg.hpp */, + A01A3AE80E75181300D0BA9B /* SoundRecorder.cpp */, + A01A3AE90E75181300D0BA9B /* SoundStream.cpp */, + A01A3AEA0E75181300D0BA9B /* stb_vorbis */, + ); + name = Sources; + path = ../../src/SFML/Audio; + sourceTree = SOURCE_ROOT; + }; + A01A3AEA0E75181300D0BA9B /* stb_vorbis */ = { + isa = PBXGroup; + children = ( + A01A3AEB0E75181300D0BA9B /* stb_vorbis.c */, + A01A3AEC0E75181300D0BA9B /* stb_vorbis.h */, + ); + name = stb_vorbis; + path = ../../src/SFML/Audio/stb_vorbis; + sourceTree = SOURCE_ROOT; + }; + A04C59A40EDDBA9C00935061 /* Cocoa */ = { + isa = PBXGroup; + children = ( + A04C59A50EDDBA9C00935061 /* AppController.h */, + A04C59A60EDDBA9C00935061 /* AppController.mm */, + A04C59A80EDDBA9C00935061 /* Joystick.hpp */, + A04C59A70EDDBA9C00935061 /* Joystick.cpp */, + A04C59AA0EDDBA9C00935061 /* VideoModeSupport.hpp */, + A04C59A90EDDBA9C00935061 /* VideoModeSupport.cpp */, + A04C59AB0EDDBA9C00935061 /* WindowController.h */, + A04C59AC0EDDBA9C00935061 /* WindowController.mm */, + A04C59AD0EDDBA9C00935061 /* WindowImplCocoa.hpp */, + A04C59AE0EDDBA9C00935061 /* WindowImplCocoa.mm */, + ); + name = Cocoa; + path = ../../src/SFML/Window/Cocoa; + sourceTree = SOURCE_ROOT; + }; + A093E3660D8BF860002236B4 = { + isa = PBXGroup; + children = ( + A093E3AD0D8BF8AD002236B4 /* SFML */, + A093E3B90D8BF8C2002236B4 /* sfml-audio */, + A093E3BC0D8BF8C7002236B4 /* sfml-graphics */, + A093E3B30D8BF8B5002236B4 /* sfml-network */, + A093E3B00D8BF8B0002236B4 /* sfml-system */, + A093E3B60D8BF8BB002236B4 /* sfml-window */, + A093E3760D8BF86E002236B4 /* Products */, + ); + sourceTree = ""; + }; + A093E3760D8BF86E002236B4 /* Products */ = { + isa = PBXGroup; + children = ( + A093E3750D8BF86E002236B4 /* SFML.framework */, + A093E37F0D8BF87A002236B4 /* sfml-system.framework */, + A093E3880D8BF885002236B4 /* sfml-network.framework */, + A093E39A0D8BF89B002236B4 /* sfml-audio.framework */, + A093E3A30D8BF8A2002236B4 /* sfml-graphics.framework */, + A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */, + ); + name = Products; + sourceTree = ""; + }; + A093E3AD0D8BF8AD002236B4 /* SFML */ = { + isa = PBXGroup; + children = ( + A01A3A810E7517C800D0BA9B /* Headers */, + A093E3CF0D8BF918002236B4 /* dummy.cpp */, + A093E3770D8BF86E002236B4 /* SFML-Info.plist */, + ); + name = SFML; + sourceTree = SOURCE_ROOT; + }; + A093E3B00D8BF8B0002236B4 /* sfml-system */ = { + isa = PBXGroup; + children = ( + A09EEBE40D8C19B000F6C625 /* Sources */, + A093E3800D8BF87A002236B4 /* sfml-system-Info.plist */, + ); + name = "sfml-system"; + sourceTree = SOURCE_ROOT; + }; + A093E3B30D8BF8B5002236B4 /* sfml-network */ = { + isa = PBXGroup; + children = ( + A0F1E67F0E75440800778F12 /* Sources */, + A093E3890D8BF885002236B4 /* sfml-network-Info.plist */, + ); + name = "sfml-network"; + sourceTree = SOURCE_ROOT; + }; + A093E3B60D8BF8BB002236B4 /* sfml-window */ = { + isa = PBXGroup; + children = ( + A0F1E7AB0E7545F800778F12 /* Sources */, + A093E3920D8BF892002236B4 /* sfml-window-Info.plist */, + ); + name = "sfml-window"; + sourceTree = SOURCE_ROOT; + }; + A093E3B90D8BF8C2002236B4 /* sfml-audio */ = { + isa = PBXGroup; + children = ( + A01A3AD70E75181300D0BA9B /* Sources */, + A093E39B0D8BF89B002236B4 /* sfml-audio-Info.plist */, + ); + name = "sfml-audio"; + sourceTree = SOURCE_ROOT; + }; + A093E3BC0D8BF8C7002236B4 /* sfml-graphics */ = { + isa = PBXGroup; + children = ( + A0F1E6980E7545AA00778F12 /* Sources */, + A093E3A40D8BF8A2002236B4 /* sfml-graphics-Info.plist */, + ); + name = "sfml-graphics"; + sourceTree = SOURCE_ROOT; + }; + A09EEBE40D8C19B000F6C625 /* Sources */ = { + isa = PBXGroup; + children = ( + A09EEBED0D8C19BF00F6C625 /* Platform.hpp */, + A09EEBEE0D8C19BF00F6C625 /* Randomizer.cpp */, + A01C69C80E3E63CE00ED3F04 /* Unicode.cpp */, + A09EEBEF0D8C19BF00F6C625 /* Unix */, + A09EEBF40D8C19BF00F6C625 /* Clock.cpp */, + A09EEBF50D8C19BF00F6C625 /* Lock.cpp */, + A09EEBF60D8C19BF00F6C625 /* Sleep.cpp */, + ); + name = Sources; + sourceTree = SOURCE_ROOT; + }; + A09EEBEF0D8C19BF00F6C625 /* Unix */ = { + isa = PBXGroup; + children = ( + A09EEBF00D8C19BF00F6C625 /* Mutex.cpp */, + A09EEBF10D8C19BF00F6C625 /* Platform.cpp */, + A09EEBF20D8C19BF00F6C625 /* Platform.hpp */, + A09EEBF30D8C19BF00F6C625 /* Thread.cpp */, + ); + name = Unix; + path = ../../src/SFML/System/Unix; + sourceTree = SOURCE_ROOT; + }; + A0F1E67F0E75440800778F12 /* Sources */ = { + isa = PBXGroup; + children = ( + A0F1E6800E75440800778F12 /* IPAddress.cpp */, + A0F1E6820E75440800778F12 /* Packet.cpp */, + A0F1E6830E75440800778F12 /* SelectorBase.cpp */, + A0F1E6840E75440800778F12 /* SocketTCP.cpp */, + A0F1E6850E75440800778F12 /* SocketUDP.cpp */, + A018A2790EA21866005FFAC3 /* Http.cpp */, + A018A27A0EA21866005FFAC3 /* Ftp.cpp */, + A0F1E6860E75440800778F12 /* Unix */, + ); + name = Sources; + path = ../../src/SFML/Network; + sourceTree = SOURCE_ROOT; + }; + A0F1E6860E75440800778F12 /* Unix */ = { + isa = PBXGroup; + children = ( + A0F1E6870E75440800778F12 /* SocketHelper.cpp */, + ); + name = Unix; + path = ../../src/SFML/Network/Unix; + sourceTree = SOURCE_ROOT; + }; + A0F1E6980E7545AA00778F12 /* Sources */ = { + isa = PBXGroup; + children = ( + A0F1E6990E7545AA00778F12 /* Arial.hpp */, + A0F1E69A0E7545AA00778F12 /* Color.cpp */, + A0F1E69B0E7545AA00778F12 /* Drawable.cpp */, + A0F1E69C0E7545AA00778F12 /* Font.cpp */, + A0F1E69D0E7545AA00778F12 /* FontLoader.cpp */, + A0F1E69E0E7545AA00778F12 /* FontLoader.hpp */, + A0F1E69F0E7545AA00778F12 /* GLEW */, + A0F1E6A40E7545AA00778F12 /* GraphicsContext.cpp */, + A0F1E6A50E7545AA00778F12 /* GraphicsContext.hpp */, + A0F1E6A60E7545AA00778F12 /* Image.cpp */, + A0F1E6A70E7545AA00778F12 /* ImageLoader.cpp */, + A0F1E6A80E7545AA00778F12 /* ImageLoader.hpp */, + A0F1E6A90E7545AA00778F12 /* libjpeg */, + A0F1E6E40E7545AA00778F12 /* libpng */, + A0F1E6F90E7545AA00778F12 /* Matrix3.cpp */, + A0F1E6FA0E7545AA00778F12 /* PostFX.cpp */, + A0F1E6FB0E7545AA00778F12 /* RenderTarget.cpp */, + A0F1E6FC0E7545AA00778F12 /* RenderWindow.cpp */, + A0F1E6FD0E7545AA00778F12 /* Shape.cpp */, + A0F1E6FE0E7545AA00778F12 /* SOIL */, + A0F1E7070E7545AA00778F12 /* Sprite.cpp */, + A0F1E7080E7545AA00778F12 /* String.cpp */, + A0F1E7090E7545AA00778F12 /* View.cpp */, + A0F1E70A0E7545AA00778F12 /* zlib */, + ); + name = Sources; + path = ../../src/SFML/Graphics; + sourceTree = SOURCE_ROOT; + }; + A0F1E69F0E7545AA00778F12 /* GLEW */ = { + isa = PBXGroup; + children = ( + A0F1E6A00E7545AA00778F12 /* glew.c */, + A0F1E6A10E7545AA00778F12 /* glew.h */, + ); + name = GLEW; + path = ../../src/SFML/Graphics/GLEW; + sourceTree = SOURCE_ROOT; + }; + A0F1E6A90E7545AA00778F12 /* libjpeg */ = { + isa = PBXGroup; + children = ( + A0F1E6AA0E7545AA00778F12 /* cderror.h */, + A0F1E6AB0E7545AA00778F12 /* jcapimin.c */, + A0F1E6AC0E7545AA00778F12 /* jcapistd.c */, + A0F1E6AD0E7545AA00778F12 /* jccoefct.c */, + A0F1E6AE0E7545AA00778F12 /* jccolor.c */, + A0F1E6AF0E7545AA00778F12 /* jcdctmgr.c */, + A0F1E6B00E7545AA00778F12 /* jchuff.c */, + A0F1E6B10E7545AA00778F12 /* jchuff.h */, + A0F1E6B20E7545AA00778F12 /* jcinit.c */, + A0F1E6B30E7545AA00778F12 /* jcmainct.c */, + A0F1E6B40E7545AA00778F12 /* jcmarker.c */, + A0F1E6B50E7545AA00778F12 /* jcmaster.c */, + A0F1E6B60E7545AA00778F12 /* jcomapi.c */, + A0F1E6B70E7545AA00778F12 /* jconfig.h */, + A0F1E6B80E7545AA00778F12 /* jcparam.c */, + A0F1E6B90E7545AA00778F12 /* jcphuff.c */, + A0F1E6BA0E7545AA00778F12 /* jcprepct.c */, + A0F1E6BB0E7545AA00778F12 /* jcsample.c */, + A0F1E6BC0E7545AA00778F12 /* jctrans.c */, + A0F1E6BD0E7545AA00778F12 /* jdapimin.c */, + A0F1E6BE0E7545AA00778F12 /* jdapistd.c */, + A0F1E6BF0E7545AA00778F12 /* jdatadst.c */, + A0F1E6C00E7545AA00778F12 /* jdatasrc.c */, + A0F1E6C10E7545AA00778F12 /* jdcoefct.c */, + A0F1E6C20E7545AA00778F12 /* jdcolor.c */, + A0F1E6C30E7545AA00778F12 /* jdct.h */, + A0F1E6C40E7545AA00778F12 /* jddctmgr.c */, + A0F1E6C50E7545AA00778F12 /* jdhuff.c */, + A0F1E6C60E7545AA00778F12 /* jdhuff.h */, + A0F1E6C70E7545AA00778F12 /* jdinput.c */, + A0F1E6C80E7545AA00778F12 /* jdmainct.c */, + A0F1E6C90E7545AA00778F12 /* jdmarker.c */, + A0F1E6CA0E7545AA00778F12 /* jdmaster.c */, + A0F1E6CB0E7545AA00778F12 /* jdmerge.c */, + A0F1E6CC0E7545AA00778F12 /* jdphuff.c */, + A0F1E6CD0E7545AA00778F12 /* jdpostct.c */, + A0F1E6CE0E7545AA00778F12 /* jdsample.c */, + A0F1E6CF0E7545AA00778F12 /* jdtrans.c */, + A0F1E6D00E7545AA00778F12 /* jerror.c */, + A0F1E6D10E7545AA00778F12 /* jerror.h */, + A0F1E6D20E7545AA00778F12 /* jfdctflt.c */, + A0F1E6D30E7545AA00778F12 /* jfdctfst.c */, + A0F1E6D40E7545AA00778F12 /* jfdctint.c */, + A0F1E6D50E7545AA00778F12 /* jidctflt.c */, + A0F1E6D60E7545AA00778F12 /* jidctfst.c */, + A0F1E6D70E7545AA00778F12 /* jidctint.c */, + A0F1E6D80E7545AA00778F12 /* jidctred.c */, + A0F1E6D90E7545AA00778F12 /* jinclude.h */, + A0F1E6DA0E7545AA00778F12 /* jmemmgr.c */, + A0F1E6DB0E7545AA00778F12 /* jmemnobs.c */, + A0F1E6DC0E7545AA00778F12 /* jmemsys.h */, + A0F1E6DD0E7545AA00778F12 /* jmorecfg.h */, + A0F1E6DE0E7545AA00778F12 /* jpegint.h */, + A0F1E6DF0E7545AA00778F12 /* jpeglib.h */, + A0F1E6E00E7545AA00778F12 /* jquant1.c */, + A0F1E6E10E7545AA00778F12 /* jquant2.c */, + A0F1E6E20E7545AA00778F12 /* jutils.c */, + A0F1E6E30E7545AA00778F12 /* jversion.h */, + ); + name = libjpeg; + path = ../../src/SFML/Graphics/libjpeg; + sourceTree = SOURCE_ROOT; + }; + A0F1E6E40E7545AA00778F12 /* libpng */ = { + isa = PBXGroup; + children = ( + A0F1E6E50E7545AA00778F12 /* png.c */, + A0F1E6E60E7545AA00778F12 /* png.h */, + A0F1E6E70E7545AA00778F12 /* pngconf.h */, + A0F1E6E80E7545AA00778F12 /* pngerror.c */, + A0F1E6E90E7545AA00778F12 /* pnggccrd.c */, + A0F1E6EA0E7545AA00778F12 /* pngget.c */, + A0F1E6EB0E7545AA00778F12 /* pngmem.c */, + A0F1E6EC0E7545AA00778F12 /* pngpread.c */, + A0F1E6ED0E7545AA00778F12 /* pngread.c */, + A0F1E6EE0E7545AA00778F12 /* pngrio.c */, + A0F1E6EF0E7545AA00778F12 /* pngrtran.c */, + A0F1E6F00E7545AA00778F12 /* pngrutil.c */, + A0F1E6F10E7545AA00778F12 /* pngset.c */, + A0F1E6F20E7545AA00778F12 /* pngtrans.c */, + A0F1E6F30E7545AA00778F12 /* pngvcrd.c */, + A0F1E6F40E7545AA00778F12 /* pngwio.c */, + A0F1E6F50E7545AA00778F12 /* pngwrite.c */, + A0F1E6F60E7545AA00778F12 /* pngwtran.c */, + A0F1E6F70E7545AA00778F12 /* pngwutil.c */, + ); + name = libpng; + path = ../../src/SFML/Graphics/libpng; + sourceTree = SOURCE_ROOT; + }; + A0F1E6FE0E7545AA00778F12 /* SOIL */ = { + isa = PBXGroup; + children = ( + A0F1E6FF0E7545AA00778F12 /* image_DXT.c */, + A0F1E7000E7545AA00778F12 /* image_DXT.h */, + A0F1E7010E7545AA00778F12 /* SOIL.c */, + A0F1E7020E7545AA00778F12 /* SOIL.h */, + A0F1E7030E7545AA00778F12 /* stb_image_aug.c */, + A0F1E7040E7545AA00778F12 /* stb_image_aug.h */, + A0F1E7050E7545AA00778F12 /* stbi_DDS_aug.h */, + A0F1E7060E7545AA00778F12 /* stbi_DDS_aug_c.h */, + ); + name = SOIL; + path = ../../src/SFML/Graphics/SOIL; + sourceTree = SOURCE_ROOT; + }; + A0F1E70A0E7545AA00778F12 /* zlib */ = { + isa = PBXGroup; + children = ( + A0F1E70B0E7545AA00778F12 /* adler32.c */, + A0F1E70C0E7545AA00778F12 /* compress.c */, + A0F1E70D0E7545AA00778F12 /* crc32.c */, + A0F1E70E0E7545AA00778F12 /* crc32.h */, + A0F1E70F0E7545AA00778F12 /* deflate.c */, + A0F1E7100E7545AA00778F12 /* deflate.h */, + A0F1E7110E7545AA00778F12 /* inffast.c */, + A0F1E7120E7545AA00778F12 /* inffast.h */, + A0F1E7130E7545AA00778F12 /* inffixed.h */, + A0F1E7140E7545AA00778F12 /* inflate.c */, + A0F1E7150E7545AA00778F12 /* inflate.h */, + A0F1E7160E7545AA00778F12 /* inftrees.c */, + A0F1E7170E7545AA00778F12 /* inftrees.h */, + A0F1E7180E7545AA00778F12 /* trees.c */, + A0F1E7190E7545AA00778F12 /* trees.h */, + A0F1E71A0E7545AA00778F12 /* uncompr.c */, + A0F1E71B0E7545AA00778F12 /* zconf.h */, + A0F1E71C0E7545AA00778F12 /* zlib.h */, + A0F1E71D0E7545AA00778F12 /* zutil.c */, + A0F1E71E0E7545AA00778F12 /* zutil.h */, + ); + name = zlib; + path = ../../src/SFML/Graphics/zlib; + sourceTree = SOURCE_ROOT; + }; + A0F1E7AB0E7545F800778F12 /* Sources */ = { + isa = PBXGroup; + children = ( + A04C59A40EDDBA9C00935061 /* Cocoa */, + A0F1E7AC0E7545F800778F12 /* Context.cpp */, + A0F1E7B10E7545F800778F12 /* Input.cpp */, + A0F1E7B20E7545F800778F12 /* Joystick.hpp */, + A0F1E7D60E7545F800778F12 /* VideoMode.cpp */, + A0F1E7D70E7545F800778F12 /* VideoModeSupport.hpp */, + A0F1E7DF0E7545F800778F12 /* Window.cpp */, + A0F1E7E00E7545F800778F12 /* WindowImpl.cpp */, + A0F1E7E10E7545F800778F12 /* WindowImpl.hpp */, + ); + name = Sources; + path = ../../src/SFML/Window; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + A093E3700D8BF86E002236B4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E37A0D8BF87A002236B4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A09EEBF70D8C19BF00F6C625 /* Platform.hpp in Headers */, + A09EEBFB0D8C19BF00F6C625 /* Platform.hpp in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3830D8BF885002236B4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3950D8BF89B002236B4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A01A3AEE0E75181300D0BA9B /* AudioDevice.hpp in Headers */, + A01A3AF30E75181300D0BA9B /* OpenAL.hpp in Headers */, + A01A3AF80E75181300D0BA9B /* SoundFile.hpp in Headers */, + A01A3AFA0E75181300D0BA9B /* SoundFileDefault.hpp in Headers */, + A01A3AFC0E75181300D0BA9B /* SoundFileOgg.hpp in Headers */, + A01A3B000E75181300D0BA9B /* stb_vorbis.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E39E0D8BF8A2002236B4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A0F1E71F0E7545AA00778F12 /* Arial.hpp in Headers */, + A0F1E7240E7545AA00778F12 /* FontLoader.hpp in Headers */, + A0F1E7260E7545AA00778F12 /* glew.h in Headers */, + A0F1E72A0E7545AA00778F12 /* GraphicsContext.hpp in Headers */, + A0F1E72D0E7545AA00778F12 /* ImageLoader.hpp in Headers */, + A0F1E72E0E7545AA00778F12 /* cderror.h in Headers */, + A0F1E7350E7545AA00778F12 /* jchuff.h in Headers */, + A0F1E73B0E7545AA00778F12 /* jconfig.h in Headers */, + A0F1E7470E7545AA00778F12 /* jdct.h in Headers */, + A0F1E74A0E7545AA00778F12 /* jdhuff.h in Headers */, + A0F1E7550E7545AA00778F12 /* jerror.h in Headers */, + A0F1E75D0E7545AA00778F12 /* jinclude.h in Headers */, + A0F1E7600E7545AA00778F12 /* jmemsys.h in Headers */, + A0F1E7610E7545AA00778F12 /* jmorecfg.h in Headers */, + A0F1E7620E7545AA00778F12 /* jpegint.h in Headers */, + A0F1E7630E7545AA00778F12 /* jpeglib.h in Headers */, + A0F1E7670E7545AA00778F12 /* jversion.h in Headers */, + A0F1E7690E7545AA00778F12 /* png.h in Headers */, + A0F1E76A0E7545AA00778F12 /* pngconf.h in Headers */, + A0F1E7820E7545AA00778F12 /* image_DXT.h in Headers */, + A0F1E7840E7545AA00778F12 /* SOIL.h in Headers */, + A0F1E7860E7545AA00778F12 /* stb_image_aug.h in Headers */, + A0F1E7870E7545AA00778F12 /* stbi_DDS_aug.h in Headers */, + A0F1E7880E7545AA00778F12 /* stbi_DDS_aug_c.h in Headers */, + A0F1E78F0E7545AA00778F12 /* crc32.h in Headers */, + A0F1E7910E7545AA00778F12 /* deflate.h in Headers */, + A0F1E7930E7545AA00778F12 /* inffast.h in Headers */, + A0F1E7940E7545AA00778F12 /* inffixed.h in Headers */, + A0F1E7960E7545AA00778F12 /* inflate.h in Headers */, + A0F1E7980E7545AA00778F12 /* inftrees.h in Headers */, + A0F1E79A0E7545AA00778F12 /* trees.h in Headers */, + A0F1E79C0E7545AA00778F12 /* zconf.h in Headers */, + A0F1E79D0E7545AA00778F12 /* zlib.h in Headers */, + A0F1E79F0E7545AA00778F12 /* zutil.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A0C93EAF0D9A9CA000B9E0C8 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A0F1E7E70E7545F800778F12 /* Joystick.hpp in Headers */, + A0F1E8080E7545F800778F12 /* VideoModeSupport.hpp in Headers */, + A0F1E8110E7545F800778F12 /* WindowImpl.hpp in Headers */, + A04C59AF0EDDBA9C00935061 /* AppController.h in Headers */, + A04C59B20EDDBA9C00935061 /* Joystick.hpp in Headers */, + A04C59B40EDDBA9C00935061 /* VideoModeSupport.hpp in Headers */, + A04C59B50EDDBA9C00935061 /* WindowController.h in Headers */, + A04C59B70EDDBA9C00935061 /* WindowImplCocoa.hpp in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + A093E3740D8BF86E002236B4 /* SFML */ = { + isa = PBXNativeTarget; + buildConfigurationList = A02679DE0E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "SFML" */; + buildPhases = ( + A093E3700D8BF86E002236B4 /* Headers */, + A093E3710D8BF86E002236B4 /* Resources */, + A093E3720D8BF86E002236B4 /* Sources */, + A093E3730D8BF86E002236B4 /* Frameworks */, + A0BA42130DDF0E3F00039094 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SFML; + productName = SFML; + productReference = A093E3750D8BF86E002236B4 /* SFML.framework */; + productType = "com.apple.product-type.framework"; + }; + A093E37E0D8BF87A002236B4 /* sfml-system */ = { + isa = PBXNativeTarget; + buildConfigurationList = A02679DF0E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-system" */; + buildPhases = ( + A093E37A0D8BF87A002236B4 /* Headers */, + A093E37B0D8BF87A002236B4 /* Resources */, + A093E37C0D8BF87A002236B4 /* Sources */, + A093E37D0D8BF87A002236B4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + A012F5800E0FF91B0022FB0F /* PBXTargetDependency */, + ); + name = "sfml-system"; + productName = "sfml-system"; + productReference = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; + productType = "com.apple.product-type.framework"; + }; + A093E3870D8BF885002236B4 /* sfml-network */ = { + isa = PBXNativeTarget; + buildConfigurationList = A02679E00E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-network" */; + buildPhases = ( + A093E3830D8BF885002236B4 /* Headers */, + A093E3840D8BF885002236B4 /* Resources */, + A093E3850D8BF885002236B4 /* Sources */, + A093E3860D8BF885002236B4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + A012F5820E0FF9310022FB0F /* PBXTargetDependency */, + ); + name = "sfml-network"; + productName = "sfml-network"; + productReference = A093E3880D8BF885002236B4 /* sfml-network.framework */; + productType = "com.apple.product-type.framework"; + }; + A093E3990D8BF89B002236B4 /* sfml-audio */ = { + isa = PBXNativeTarget; + buildConfigurationList = A02679E10E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-audio" */; + buildPhases = ( + A093E3950D8BF89B002236B4 /* Headers */, + A093E3960D8BF89B002236B4 /* Resources */, + A093E3970D8BF89B002236B4 /* Sources */, + A093E3980D8BF89B002236B4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + A093E54A0D8BFEB9002236B4 /* PBXTargetDependency */, + ); + name = "sfml-audio"; + productName = "sfml-audio"; + productReference = A093E39A0D8BF89B002236B4 /* sfml-audio.framework */; + productType = "com.apple.product-type.framework"; + }; + A093E3A20D8BF8A2002236B4 /* sfml-graphics */ = { + isa = PBXNativeTarget; + buildConfigurationList = A02679E30E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-graphics" */; + buildPhases = ( + A093E39E0D8BF8A2002236B4 /* Headers */, + A093E39F0D8BF8A2002236B4 /* Resources */, + A093E3A00D8BF8A2002236B4 /* Sources */, + A093E3A10D8BF8A2002236B4 /* Frameworks */, + ); + buildRules = ( + A09EEA9F0D8C074D00F6C625 /* PBXBuildRule */, + ); + dependencies = ( + A07EA05D0DB657C0007C7747 /* PBXTargetDependency */, + ); + name = "sfml-graphics"; + productName = "sfml-graphics"; + productReference = A093E3A30D8BF8A2002236B4 /* sfml-graphics.framework */; + productType = "com.apple.product-type.framework"; + }; + A0C93EB30D9A9CA000B9E0C8 /* sfml-window */ = { + isa = PBXNativeTarget; + buildConfigurationList = A02679E20E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-window" */; + buildPhases = ( + A0C93EAF0D9A9CA000B9E0C8 /* Headers */, + A0C93EB00D9A9CA000B9E0C8 /* Resources */, + A0C93EB10D9A9CA000B9E0C8 /* Sources */, + A0C93EB20D9A9CA000B9E0C8 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + A017FF8B0E51E06400A4C078 /* PBXTargetDependency */, + ); + name = "sfml-window"; + productName = "sfml-window"; + productReference = A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A093E36A0D8BF860002236B4 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = A02679DD0E5CDB03008D4C81 /* Build configuration list for PBXProject "SFML" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 0; + mainGroup = A093E3660D8BF860002236B4; + productRefGroup = A093E3760D8BF86E002236B4 /* Products */; + projectDirPath = ""; + projectRoot = ../..; + targets = ( + A0F0BA820D92E4F500056981 /* All */, + A093E3740D8BF86E002236B4 /* SFML */, + A093E3990D8BF89B002236B4 /* sfml-audio */, + A093E3A20D8BF8A2002236B4 /* sfml-graphics */, + A093E3870D8BF885002236B4 /* sfml-network */, + A093E37E0D8BF87A002236B4 /* sfml-system */, + A0C93EB30D9A9CA000B9E0C8 /* sfml-window */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A093E3710D8BF86E002236B4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E37B0D8BF87A002236B4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3840D8BF885002236B4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3960D8BF89B002236B4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E39F0D8BF8A2002236B4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A0C93EB00D9A9CA000B9E0C8 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + A0BA42130DDF0E3F00039094 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "export HEADER_PATH=$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\n\nrm -rf $HEADER_PATH\nmkdir -p $HEADER_PATH\nln -s Versions/Current/Headers $HEADER_PATH/../../../Headers\ncp -r $SRCROOT/../../include/SFML/ $HEADER_PATH\nrm -rf `find $HEADER_PATH -name \".svn\"`\nrm -f $HEADER_PATH/Headers"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A093E3720D8BF86E002236B4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A093E3D00D8BF918002236B4 /* dummy.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E37C0D8BF87A002236B4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A09EEBF80D8C19BF00F6C625 /* Randomizer.cpp in Sources */, + A09EEBF90D8C19BF00F6C625 /* Mutex.cpp in Sources */, + A09EEBFA0D8C19BF00F6C625 /* Platform.cpp in Sources */, + A09EEBFC0D8C19BF00F6C625 /* Thread.cpp in Sources */, + A09EEBFD0D8C19BF00F6C625 /* Clock.cpp in Sources */, + A09EEBFE0D8C19BF00F6C625 /* Lock.cpp in Sources */, + A09EEBFF0D8C19BF00F6C625 /* Sleep.cpp in Sources */, + A01C69C90E3E63CE00ED3F04 /* Unicode.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3850D8BF885002236B4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0F1E68A0E75440800778F12 /* IPAddress.cpp in Sources */, + A0F1E68C0E75440800778F12 /* Packet.cpp in Sources */, + A0F1E68D0E75440800778F12 /* SelectorBase.cpp in Sources */, + A0F1E68E0E75440800778F12 /* SocketTCP.cpp in Sources */, + A0F1E68F0E75440800778F12 /* SocketUDP.cpp in Sources */, + A0F1E6900E75440800778F12 /* SocketHelper.cpp in Sources */, + A018A27B0EA21866005FFAC3 /* Http.cpp in Sources */, + A018A27C0EA21866005FFAC3 /* Ftp.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3970D8BF89B002236B4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A01A3AED0E75181300D0BA9B /* AudioDevice.cpp in Sources */, + A01A3AEF0E75181300D0BA9B /* AudioResource.cpp in Sources */, + A01A3AF00E75181300D0BA9B /* Listener.cpp in Sources */, + A01A3AF20E75181300D0BA9B /* Music.cpp in Sources */, + A01A3AF40E75181300D0BA9B /* Sound.cpp in Sources */, + A01A3AF50E75181300D0BA9B /* SoundBuffer.cpp in Sources */, + A01A3AF60E75181300D0BA9B /* SoundBufferRecorder.cpp in Sources */, + A01A3AF70E75181300D0BA9B /* SoundFile.cpp in Sources */, + A01A3AF90E75181300D0BA9B /* SoundFileDefault.cpp in Sources */, + A01A3AFB0E75181300D0BA9B /* SoundFileOgg.cpp in Sources */, + A01A3AFD0E75181300D0BA9B /* SoundRecorder.cpp in Sources */, + A01A3AFE0E75181300D0BA9B /* SoundStream.cpp in Sources */, + A01A3AFF0E75181300D0BA9B /* stb_vorbis.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A093E3A00D8BF8A2002236B4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0F1E7200E7545AA00778F12 /* Color.cpp in Sources */, + A0F1E7210E7545AA00778F12 /* Drawable.cpp in Sources */, + A0F1E7220E7545AA00778F12 /* Font.cpp in Sources */, + A0F1E7230E7545AA00778F12 /* FontLoader.cpp in Sources */, + A0F1E7250E7545AA00778F12 /* glew.c in Sources */, + A0F1E7290E7545AA00778F12 /* GraphicsContext.cpp in Sources */, + A0F1E72B0E7545AA00778F12 /* Image.cpp in Sources */, + A0F1E72C0E7545AA00778F12 /* ImageLoader.cpp in Sources */, + A0F1E72F0E7545AA00778F12 /* jcapimin.c in Sources */, + A0F1E7300E7545AA00778F12 /* jcapistd.c in Sources */, + A0F1E7310E7545AA00778F12 /* jccoefct.c in Sources */, + A0F1E7320E7545AA00778F12 /* jccolor.c in Sources */, + A0F1E7330E7545AA00778F12 /* jcdctmgr.c in Sources */, + A0F1E7340E7545AA00778F12 /* jchuff.c in Sources */, + A0F1E7360E7545AA00778F12 /* jcinit.c in Sources */, + A0F1E7370E7545AA00778F12 /* jcmainct.c in Sources */, + A0F1E7380E7545AA00778F12 /* jcmarker.c in Sources */, + A0F1E7390E7545AA00778F12 /* jcmaster.c in Sources */, + A0F1E73A0E7545AA00778F12 /* jcomapi.c in Sources */, + A0F1E73C0E7545AA00778F12 /* jcparam.c in Sources */, + A0F1E73D0E7545AA00778F12 /* jcphuff.c in Sources */, + A0F1E73E0E7545AA00778F12 /* jcprepct.c in Sources */, + A0F1E73F0E7545AA00778F12 /* jcsample.c in Sources */, + A0F1E7400E7545AA00778F12 /* jctrans.c in Sources */, + A0F1E7410E7545AA00778F12 /* jdapimin.c in Sources */, + A0F1E7420E7545AA00778F12 /* jdapistd.c in Sources */, + A0F1E7430E7545AA00778F12 /* jdatadst.c in Sources */, + A0F1E7440E7545AA00778F12 /* jdatasrc.c in Sources */, + A0F1E7450E7545AA00778F12 /* jdcoefct.c in Sources */, + A0F1E7460E7545AA00778F12 /* jdcolor.c in Sources */, + A0F1E7480E7545AA00778F12 /* jddctmgr.c in Sources */, + A0F1E7490E7545AA00778F12 /* jdhuff.c in Sources */, + A0F1E74B0E7545AA00778F12 /* jdinput.c in Sources */, + A0F1E74C0E7545AA00778F12 /* jdmainct.c in Sources */, + A0F1E74D0E7545AA00778F12 /* jdmarker.c in Sources */, + A0F1E74E0E7545AA00778F12 /* jdmaster.c in Sources */, + A0F1E74F0E7545AA00778F12 /* jdmerge.c in Sources */, + A0F1E7500E7545AA00778F12 /* jdphuff.c in Sources */, + A0F1E7510E7545AA00778F12 /* jdpostct.c in Sources */, + A0F1E7520E7545AA00778F12 /* jdsample.c in Sources */, + A0F1E7530E7545AA00778F12 /* jdtrans.c in Sources */, + A0F1E7540E7545AA00778F12 /* jerror.c in Sources */, + A0F1E7560E7545AA00778F12 /* jfdctflt.c in Sources */, + A0F1E7570E7545AA00778F12 /* jfdctfst.c in Sources */, + A0F1E7580E7545AA00778F12 /* jfdctint.c in Sources */, + A0F1E7590E7545AA00778F12 /* jidctflt.c in Sources */, + A0F1E75A0E7545AA00778F12 /* jidctfst.c in Sources */, + A0F1E75B0E7545AA00778F12 /* jidctint.c in Sources */, + A0F1E75C0E7545AA00778F12 /* jidctred.c in Sources */, + A0F1E75E0E7545AA00778F12 /* jmemmgr.c in Sources */, + A0F1E75F0E7545AA00778F12 /* jmemnobs.c in Sources */, + A0F1E7640E7545AA00778F12 /* jquant1.c in Sources */, + A0F1E7650E7545AA00778F12 /* jquant2.c in Sources */, + A0F1E7660E7545AA00778F12 /* jutils.c in Sources */, + A0F1E7680E7545AA00778F12 /* png.c in Sources */, + A0F1E76B0E7545AA00778F12 /* pngerror.c in Sources */, + A0F1E76C0E7545AA00778F12 /* pnggccrd.c in Sources */, + A0F1E76D0E7545AA00778F12 /* pngget.c in Sources */, + A0F1E76E0E7545AA00778F12 /* pngmem.c in Sources */, + A0F1E76F0E7545AA00778F12 /* pngpread.c in Sources */, + A0F1E7700E7545AA00778F12 /* pngread.c in Sources */, + A0F1E7710E7545AA00778F12 /* pngrio.c in Sources */, + A0F1E7720E7545AA00778F12 /* pngrtran.c in Sources */, + A0F1E7730E7545AA00778F12 /* pngrutil.c in Sources */, + A0F1E7740E7545AA00778F12 /* pngset.c in Sources */, + A0F1E7750E7545AA00778F12 /* pngtrans.c in Sources */, + A0F1E7760E7545AA00778F12 /* pngvcrd.c in Sources */, + A0F1E7770E7545AA00778F12 /* pngwio.c in Sources */, + A0F1E7780E7545AA00778F12 /* pngwrite.c in Sources */, + A0F1E7790E7545AA00778F12 /* pngwtran.c in Sources */, + A0F1E77A0E7545AA00778F12 /* pngwutil.c in Sources */, + A0F1E77C0E7545AA00778F12 /* Matrix3.cpp in Sources */, + A0F1E77D0E7545AA00778F12 /* PostFX.cpp in Sources */, + A0F1E77E0E7545AA00778F12 /* RenderTarget.cpp in Sources */, + A0F1E77F0E7545AA00778F12 /* RenderWindow.cpp in Sources */, + A0F1E7800E7545AA00778F12 /* Shape.cpp in Sources */, + A0F1E7810E7545AA00778F12 /* image_DXT.c in Sources */, + A0F1E7830E7545AA00778F12 /* SOIL.c in Sources */, + A0F1E7850E7545AA00778F12 /* stb_image_aug.c in Sources */, + A0F1E7890E7545AA00778F12 /* Sprite.cpp in Sources */, + A0F1E78A0E7545AA00778F12 /* String.cpp in Sources */, + A0F1E78B0E7545AA00778F12 /* View.cpp in Sources */, + A0F1E78C0E7545AA00778F12 /* adler32.c in Sources */, + A0F1E78D0E7545AA00778F12 /* compress.c in Sources */, + A0F1E78E0E7545AA00778F12 /* crc32.c in Sources */, + A0F1E7900E7545AA00778F12 /* deflate.c in Sources */, + A0F1E7920E7545AA00778F12 /* inffast.c in Sources */, + A0F1E7950E7545AA00778F12 /* inflate.c in Sources */, + A0F1E7970E7545AA00778F12 /* inftrees.c in Sources */, + A0F1E7990E7545AA00778F12 /* trees.c in Sources */, + A0F1E79B0E7545AA00778F12 /* uncompr.c in Sources */, + A0F1E79E0E7545AA00778F12 /* zutil.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A0C93EB10D9A9CA000B9E0C8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A0F1E7E20E7545F800778F12 /* Context.cpp in Sources */, + A0F1E7E60E7545F800778F12 /* Input.cpp in Sources */, + A0F1E8070E7545F800778F12 /* VideoMode.cpp in Sources */, + A0F1E80F0E7545F800778F12 /* Window.cpp in Sources */, + A0F1E8100E7545F800778F12 /* WindowImpl.cpp in Sources */, + A04C59B00EDDBA9C00935061 /* AppController.mm in Sources */, + A04C59B10EDDBA9C00935061 /* Joystick.cpp in Sources */, + A04C59B30EDDBA9C00935061 /* VideoModeSupport.cpp in Sources */, + A04C59B60EDDBA9C00935061 /* WindowController.mm in Sources */, + A04C59B80EDDBA9C00935061 /* WindowImplCocoa.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A012F5800E0FF91B0022FB0F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E3740D8BF86E002236B4 /* SFML */; + targetProxy = A012F57F0E0FF91B0022FB0F /* PBXContainerItemProxy */; + }; + A012F5820E0FF9310022FB0F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E3740D8BF86E002236B4 /* SFML */; + targetProxy = A012F5810E0FF9310022FB0F /* PBXContainerItemProxy */; + }; + A017FF8B0E51E06400A4C078 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E37E0D8BF87A002236B4 /* sfml-system */; + targetProxy = A017FF8A0E51E06400A4C078 /* PBXContainerItemProxy */; + }; + A07EA05B0DB657A9007C7747 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A0C93EB30D9A9CA000B9E0C8 /* sfml-window */; + targetProxy = A07EA05A0DB657A9007C7747 /* PBXContainerItemProxy */; + }; + A07EA05D0DB657C0007C7747 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A0C93EB30D9A9CA000B9E0C8 /* sfml-window */; + targetProxy = A07EA05C0DB657C0007C7747 /* PBXContainerItemProxy */; + }; + A093E54A0D8BFEB9002236B4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E37E0D8BF87A002236B4 /* sfml-system */; + targetProxy = A093E5490D8BFEB9002236B4 /* PBXContainerItemProxy */; + }; + A0B4CD3A0D96B11500DEEE0F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E3740D8BF86E002236B4 /* SFML */; + targetProxy = A0B4CD390D96B11500DEEE0F /* PBXContainerItemProxy */; + }; + A0F0BA860D92E52300056981 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E3990D8BF89B002236B4 /* sfml-audio */; + targetProxy = A0F0BA850D92E52300056981 /* PBXContainerItemProxy */; + }; + A0F0BA880D92E52300056981 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E3A20D8BF8A2002236B4 /* sfml-graphics */; + targetProxy = A0F0BA870D92E52300056981 /* PBXContainerItemProxy */; + }; + A0F0BA8A0D92E52300056981 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E3870D8BF885002236B4 /* sfml-network */; + targetProxy = A0F0BA890D92E52300056981 /* PBXContainerItemProxy */; + }; + A0F0BA8C0D92E52300056981 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A093E37E0D8BF87A002236B4 /* sfml-system */; + targetProxy = A0F0BA8B0D92E52300056981 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + A02679C20E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + COPY_PHASE_STRIP = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_VERSION = ""; + GCC_WARN_ABOUT_POINTER_SIGNEDNESS = NO; + GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO; + GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; + GCC_WARN_MISSING_PARENTHESES = NO; + GCC_WARN_SHADOW = NO; + GCC_WARN_SIGN_COMPARE = NO; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; + GCC_WARN_UNINITIALIZED_AUTOS = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + OBJROOT = build; + OTHER_CFLAGS = ""; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = ../../lib/xcode; + }; + name = Debug; + }; + A02679C30E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + GCC_OPTIMIZATION_LEVEL = 2; + GCC_VERSION = ""; + GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; + GCC_WARN_ABOUT_RETURN_TYPE = NO; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = NO; + GCC_WARN_MISSING_PARENTHESES = NO; + GCC_WARN_SHADOW = NO; + GCC_WARN_UNINITIALIZED_AUTOS = NO; + GCC_WARN_UNUSED_VARIABLE = NO; + OBJROOT = build; + OTHER_CFLAGS = ""; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DNDEBUG", + ); + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static; + SYMROOT = ../../lib/xcode; + }; + name = Release; + }; + A02679C50E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = All; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679C60E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = All; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A02679C80E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../src", + "${SRCROOT}/../include", + ); + INFOPLIST_FILE = "SFML-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = SFML; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679C90E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../src", + "${SRCROOT}/../include", + ); + INFOPLIST_FILE = "SFML-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = SFML; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A02679CB0E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + "$(SRCROOT)/../../extlibs/headers", + ); + INFOPLIST_FILE = "sfml-audio-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a", + "-framework", + OpenAL, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-audio-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679CC0E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + "$(SRCROOT)/../../extlibs/headers", + ); + INFOPLIST_FILE = "sfml-audio-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_LDFLAGS = ( + "$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a", + "-framework", + OpenAL, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-audio"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A02679CE0E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + INFOPLIST_FILE = "sfml-graphics-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + OpenGL, + "$(SRCROOT)/../../extlibs/libs-xcode/libfreetype.a", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-graphics-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679CF0E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + INFOPLIST_FILE = "sfml-graphics-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + OpenGL, + "$(SRCROOT)/../../extlibs/libs-xcode/libfreetype.a", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-graphics"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A02679D10E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + ); + INFOPLIST_FILE = "sfml-network-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-network-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679D20E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + ); + INFOPLIST_FILE = "sfml-network-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-network"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A02679D40E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + ); + INFOPLIST_FILE = "sfml-system-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-system-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679D50E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + ); + INFOPLIST_FILE = "sfml-system-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-system"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A02679D70E5CDB03008D4C81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 2; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../include", + "${SRCROOT}/../../src", + ); + INFOPLIST_FILE = "sfml-window-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_CPLUSPLUSFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + OpenGL, + "-framework", + ApplicationServices, + "-framework", + Cocoa, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-window-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Debug; + }; + A02679D80E5CDB03008D4C81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 2; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../include", + "${SRCROOT}/../../src", + ); + INFOPLIST_FILE = "sfml-window-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_CPLUSPLUSFLAGS = "-DNDEBUG"; + OTHER_LDFLAGS = ( + "-framework", + OpenGL, + "-framework", + ApplicationServices, + "-framework", + Cocoa, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-window"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Release; + }; + A0C9DDC80E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH)"; + COPY_PHASE_STRIP = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_VERSION = ""; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; + GCC_WARN_UNINITIALIZED_AUTOS = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = ""; + SDKROOT = ""; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = build; + }; + name = Development; + }; + A0C9DDC90E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = All; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + A0C9DDCA0E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../src", + "${SRCROOT}/../include", + ); + INFOPLIST_FILE = "SFML-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = SFML; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + A0C9DDCB0E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + "$(SRCROOT)/../../extlibs/headers", + ); + INFOPLIST_FILE = "sfml-audio-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a", + "-framework", + OpenAL, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-audio-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + A0C9DDCC0E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + "$(HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + HEADER_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/headers\""; + INFOPLIST_FILE = "sfml-graphics-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + OpenGL, + "$(SRCROOT)/../../extlibs/libs-xcode/libfreetype.a", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-graphics-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + A0C9DDCD0E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + ); + INFOPLIST_FILE = "sfml-network-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-network-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + A0C9DDCE0E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../src", + "${SRCROOT}/../../include", + ); + INFOPLIST_FILE = "sfml-system-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-system-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + A0C9DDCF0E8BE5D10084CFD8 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 2; + HEADER_SEARCH_PATHS = ( + "${SRCROOT}/../../include", + "${SRCROOT}/../../src", + ); + INFOPLIST_FILE = "sfml-window-Info.plist"; + INSTALL_PATH = "@executable_path/../Frameworks"; + OTHER_CFLAGS = ""; + OTHER_CPLUSPLUSFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + OpenGL, + "-framework", + ApplicationServices, + "-framework", + Cocoa, + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = "sfml-window-d"; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A02679DD0E5CDB03008D4C81 /* Build configuration list for PBXProject "SFML" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDC80E8BE5D10084CFD8 /* Development */, + A02679C20E5CDB03008D4C81 /* Debug */, + A02679C30E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679DE0E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "SFML" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDCA0E8BE5D10084CFD8 /* Development */, + A02679C80E5CDB03008D4C81 /* Debug */, + A02679C90E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679DF0E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-system" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDCE0E8BE5D10084CFD8 /* Development */, + A02679D40E5CDB03008D4C81 /* Debug */, + A02679D50E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679E00E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-network" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDCD0E8BE5D10084CFD8 /* Development */, + A02679D10E5CDB03008D4C81 /* Debug */, + A02679D20E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679E10E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-audio" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDCB0E8BE5D10084CFD8 /* Development */, + A02679CB0E5CDB03008D4C81 /* Debug */, + A02679CC0E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679E20E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-window" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDCF0E8BE5D10084CFD8 /* Development */, + A02679D70E5CDB03008D4C81 /* Debug */, + A02679D80E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679E30E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-graphics" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDCC0E8BE5D10084CFD8 /* Development */, + A02679CE0E5CDB03008D4C81 /* Debug */, + A02679CF0E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + A02679E40E5CDB03008D4C81 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A0C9DDC90E8BE5D10084CFD8 /* Development */, + A02679C50E5CDB03008D4C81 /* Debug */, + A02679C60E5CDB03008D4C81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = A093E36A0D8BF860002236B4 /* Project object */; +} diff --git a/build/xcode/dummy.cpp b/build/xcode/dummy.cpp new file mode 100644 index 00000000..2115020e --- /dev/null +++ b/build/xcode/dummy.cpp @@ -0,0 +1,6 @@ + +// Using this only to produce a binary in the SFML framework so that +// linking this framework doesn't produce a "couldn't locate ..." error +static void dummyfunc(void) { + +} diff --git a/build/xcode/sfml-audio-Info.plist b/build/xcode/sfml-audio-Info.plist new file mode 100644 index 00000000..6b32efc4 --- /dev/null +++ b/build/xcode/sfml-audio-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-audio + CFBundleIdentifier + com.sfml.audio + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/sfml-graphics-Info.plist b/build/xcode/sfml-graphics-Info.plist new file mode 100644 index 00000000..3e66fac3 --- /dev/null +++ b/build/xcode/sfml-graphics-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-graphics + CFBundleIdentifier + com.sfml.graphics + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/sfml-network-Info.plist b/build/xcode/sfml-network-Info.plist new file mode 100644 index 00000000..1ea2bc5a --- /dev/null +++ b/build/xcode/sfml-network-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-network + CFBundleIdentifier + com.sfml.network + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/sfml-system-Info.plist b/build/xcode/sfml-system-Info.plist new file mode 100644 index 00000000..3d2c3142 --- /dev/null +++ b/build/xcode/sfml-system-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-system + CFBundleIdentifier + com.sfml.system + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/sfml-window-Info.plist b/build/xcode/sfml-window-Info.plist new file mode 100644 index 00000000..383acd7a --- /dev/null +++ b/build/xcode/sfml-window-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-window + CFBundleIdentifier + com.sfml.window + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/templates/SFML Graphics-based Application/Info.plist b/build/xcode/templates/SFML Graphics-based Application/Info.plist new file mode 100644 index 00000000..af9a1cad --- /dev/null +++ b/build/xcode/templates/SFML Graphics-based Application/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/TemplateIcon.icns b/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/TemplateIcon.icns new file mode 100644 index 00000000..d4713d5e Binary files /dev/null and b/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/TemplateIcon.icns differ diff --git a/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/TemplateInfo.plist b/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/TemplateInfo.plist new file mode 100755 index 00000000..d830c09f --- /dev/null +++ b/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/TemplateInfo.plist @@ -0,0 +1,6 @@ +{ + FilesToMacroExpand = ( + "Info.plist", + ); + Description = "This project builds a SFML application linked against the System, Window and Graphics packages, and written in C++."; +} diff --git a/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/project.pbxproj b/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/project.pbxproj new file mode 100644 index 00000000..31673d05 --- /dev/null +++ b/build/xcode/templates/SFML Graphics-based Application/SFML Graphics-based Application.xcodeproj/project.pbxproj @@ -0,0 +1,235 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + A0072ADE0F1D0EC500B4A594 /* sfml-system.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB6CB0F07CFF2000AAC7B /* sfml-system.framework */; }; + A0072ADF0F1D0EC500B4A594 /* sfml-window.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB6CC0F07CFF2000AAC7B /* sfml-window.framework */; }; + A0072AE00F1D0EC500B4A594 /* sfml-graphics.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB6CA0F07CFF2000AAC7B /* sfml-graphics.framework */; }; + A01FB6C90F07CFCE000AAC7B /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01FB6C80F07CFCE000AAC7B /* main.cpp */; }; + A01FB6CE0F07CFF2000AAC7B /* sfml-graphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB6CA0F07CFF2000AAC7B /* sfml-graphics.framework */; }; + A01FB6CF0F07CFF2000AAC7B /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB6CB0F07CFF2000AAC7B /* sfml-system.framework */; }; + A01FB6D00F07CFF2000AAC7B /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB6CC0F07CFF2000AAC7B /* sfml-window.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + A0072AF00F1D0EDD00B4A594 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + A0072ADE0F1D0EC500B4A594 /* sfml-system.framework in Copy Frameworks */, + A0072ADF0F1D0EC500B4A594 /* sfml-window.framework in Copy Frameworks */, + A0072AE00F1D0EC500B4A594 /* sfml-graphics.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + A01FB6A90F07CF6E000AAC7B /* «PROJECTNAME».app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "«PROJECTNAME».app"; sourceTree = BUILT_PRODUCTS_DIR; }; + A01FB6AC0F07CF6E000AAC7B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A01FB6C80F07CFCE000AAC7B /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + A01FB6CA0F07CFF2000AAC7B /* sfml-graphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-graphics.framework"; path = "/Library/Frameworks/sfml-graphics.framework"; sourceTree = ""; }; + A01FB6CB0F07CFF2000AAC7B /* sfml-system.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-system.framework"; path = "/Library/Frameworks/sfml-system.framework"; sourceTree = ""; }; + A01FB6CC0F07CFF2000AAC7B /* sfml-window.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-window.framework"; path = "/Library/Frameworks/sfml-window.framework"; sourceTree = ""; }; + A01FB6CD0F07CFF2000AAC7B /* SFML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SFML.framework; path = /Library/Frameworks/SFML.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A01FB6A70F07CF6E000AAC7B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A01FB6CE0F07CFF2000AAC7B /* sfml-graphics.framework in Frameworks */, + A01FB6CF0F07CFF2000AAC7B /* sfml-system.framework in Frameworks */, + A01FB6D00F07CFF2000AAC7B /* sfml-window.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A01FB69A0F07CF63000AAC7B = { + isa = PBXGroup; + children = ( + A01FB6B20F07CF80000AAC7B /* Sources */, + A01FB6B10F07CF7C000AAC7B /* Resources */, + A01FB6B00F07CF75000AAC7B /* Frameworks */, + A01FB6AA0F07CF6E000AAC7B /* Products */, + ); + sourceTree = ""; + }; + A01FB6AA0F07CF6E000AAC7B /* Products */ = { + isa = PBXGroup; + children = ( + A01FB6A90F07CF6E000AAC7B /* «PROJECTNAME».app */, + ); + name = Products; + sourceTree = ""; + }; + A01FB6B00F07CF75000AAC7B /* Frameworks */ = { + isa = PBXGroup; + children = ( + A01FB6CD0F07CFF2000AAC7B /* SFML.framework */, + A01FB6CB0F07CFF2000AAC7B /* sfml-system.framework */, + A01FB6CC0F07CFF2000AAC7B /* sfml-window.framework */, + A01FB6CA0F07CFF2000AAC7B /* sfml-graphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A01FB6B10F07CF7C000AAC7B /* Resources */ = { + isa = PBXGroup; + children = ( + A01FB6AC0F07CF6E000AAC7B /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + A01FB6B20F07CF80000AAC7B /* Sources */ = { + isa = PBXGroup; + children = ( + A01FB6C80F07CFCE000AAC7B /* main.cpp */, + ); + name = Sources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A01FB6A80F07CF6E000AAC7B /* «PROJECTNAME» */ = { + isa = PBXNativeTarget; + buildConfigurationList = A01FB6AF0F07CF6F000AAC7B /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */; + buildPhases = ( + A01FB6A50F07CF6E000AAC7B /* Resources */, + A01FB6A60F07CF6E000AAC7B /* Sources */, + A01FB6A70F07CF6E000AAC7B /* Frameworks */, + A0072AF00F1D0EDD00B4A594 /* Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "«PROJECTNAME»"; + productName = "«PROJECTNAME»"; + productReference = A01FB6A90F07CF6E000AAC7B /* «PROJECTNAME».app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A01FB69C0F07CF63000AAC7B /* Project object */ = { + isa = PBXProject; + buildConfigurationList = A01FB69F0F07CF63000AAC7B /* Build configuration list for PBXProject "«PROJECTNAME»" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 0; + mainGroup = A01FB69A0F07CF63000AAC7B; + productRefGroup = A01FB6AA0F07CF6E000AAC7B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A01FB6A80F07CF6E000AAC7B /* «PROJECTNAME» */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A01FB6A50F07CF6E000AAC7B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A01FB6A60F07CF6E000AAC7B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A01FB6C90F07CFCE000AAC7B /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A01FB69D0F07CF63000AAC7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + }; + name = Debug; + }; + A01FB69E0F07CF63000AAC7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + name = Release; + }; + A01FB6AD0F07CF6F000AAC7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PREBINDING = NO; + PRODUCT_NAME = "«PROJECTNAME»"; + }; + name = Debug; + }; + A01FB6AE0F07CF6F000AAC7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PREBINDING = NO; + PRODUCT_NAME = "«PROJECTNAME»"; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A01FB69F0F07CF63000AAC7B /* Build configuration list for PBXProject "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01FB69D0F07CF63000AAC7B /* Debug */, + A01FB69E0F07CF63000AAC7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A01FB6AF0F07CF6F000AAC7B /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01FB6AD0F07CF6F000AAC7B /* Debug */, + A01FB6AE0F07CF6F000AAC7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A01FB69C0F07CF63000AAC7B /* Project object */; +} diff --git a/build/xcode/templates/SFML Graphics-based Application/main.cpp b/build/xcode/templates/SFML Graphics-based Application/main.cpp new file mode 100644 index 00000000..7a7335ee --- /dev/null +++ b/build/xcode/templates/SFML Graphics-based Application/main.cpp @@ -0,0 +1,42 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Create main window + sf::RenderWindow App(sf::VideoMode(640, 480), "SFML Graphics"); + + // Start game loop + while (App.IsOpened()) + { + // Process events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Close window : exit + if (Event.Type == sf::Event::Closed) + App.Close(); + } + + // Clear screen + App.Clear(); + + // Draw apredefined shape + App.Draw(sf::Shape::Circle(200, 200, 100, sf::Color::Yellow, 10, sf::Color::Blue)); + + // Finally, display the rendered frame on screen + App.Display(); + } + + return EXIT_SUCCESS; +} diff --git a/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/TemplateIcon.icns b/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/TemplateIcon.icns new file mode 100644 index 00000000..d4713d5e Binary files /dev/null and b/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/TemplateIcon.icns differ diff --git a/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/TemplateInfo.plist b/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/TemplateInfo.plist new file mode 100755 index 00000000..d5eb9fb2 --- /dev/null +++ b/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/TemplateInfo.plist @@ -0,0 +1,6 @@ +{ + FilesToMacroExpand = ( + "Info.plist", + ); + Description = "This project builds a SFML executable linked against the System package, and written in C++."; +} diff --git a/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/project.pbxproj b/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/project.pbxproj new file mode 100644 index 00000000..345f2c7d --- /dev/null +++ b/build/xcode/templates/SFML Tool/SFML Tool.xcodeproj/project.pbxproj @@ -0,0 +1,209 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F650486A84900D96B5E /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* main.cpp */; settings = {ATTRIBUTES = (); }; }; + A0BAFBE70F07DDD2005BC41F /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0BAFBE50F07DDD2005BC41F /* sfml-system.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F690486A84900D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + 8DD76F6C0486A84900D96B5E /* «PROJECTNAME» */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "«PROJECTNAME»"; sourceTree = BUILT_PRODUCTS_DIR; }; + A0BAFBE50F07DDD2005BC41F /* sfml-system.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-system.framework"; path = "/Library/Frameworks/sfml-system.framework"; sourceTree = ""; }; + A0BAFBE60F07DDD2005BC41F /* SFML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SFML.framework; path = /Library/Frameworks/SFML.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F660486A84900D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A0BAFBE70F07DDD2005BC41F /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* «PROJECTNAME» */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + A0BAFBE30F07DDBD005BC41F /* Frameworks */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "«PROJECTNAME»"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 08FB7796FE84155DC02AAC07 /* main.cpp */, + ); + name = Source; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E /* «PROJECTNAME» */, + ); + name = Products; + sourceTree = ""; + }; + A0BAFBE30F07DDBD005BC41F /* Frameworks */ = { + isa = PBXGroup; + children = ( + A0BAFBE50F07DDD2005BC41F /* sfml-system.framework */, + A0BAFBE60F07DDD2005BC41F /* SFML.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F620486A84900D96B5E /* «PROJECTNAME» */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */; + buildPhases = ( + 8DD76F640486A84900D96B5E /* Sources */, + 8DD76F660486A84900D96B5E /* Frameworks */, + 8DD76F690486A84900D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "«PROJECTNAME»"; + productInstallPath = "$(HOME)/bin"; + productName = "«PROJECTNAME»"; + productReference = 8DD76F6C0486A84900D96B5E /* «PROJECTNAME» */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "«PROJECTNAME»" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* «PROJECTNAME» */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F620486A84900D96B5E /* «PROJECTNAME» */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F640486A84900D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F650486A84900D96B5E /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB923208733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "_GLIBCXX_DEBUG=1", + "_GLIBCXX_DEBUG_PEDANTIC=1", + ); + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "«PROJECTNAME»"; + }; + name = Debug; + }; + 1DEB923308733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "«PROJECTNAME»"; + }; + name = Release; + }; + 1DEB923608733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Debug; + }; + 1DEB923708733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = macosx10.5; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923208733DC60010E9CD /* Debug */, + 1DEB923308733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923608733DC60010E9CD /* Debug */, + 1DEB923708733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/build/xcode/templates/SFML Tool/main.cpp b/build/xcode/templates/SFML Tool/main.cpp new file mode 100644 index 00000000..d44df20f --- /dev/null +++ b/build/xcode/templates/SFML Tool/main.cpp @@ -0,0 +1,10 @@ + +#include +#include + +int main() +{ + /* Your code here */ + + return 0; +} \ No newline at end of file diff --git a/build/xcode/templates/SFML Window-based Application/Info.plist b/build/xcode/templates/SFML Window-based Application/Info.plist new file mode 100644 index 00000000..af9a1cad --- /dev/null +++ b/build/xcode/templates/SFML Window-based Application/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/TemplateIcon.icns b/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/TemplateIcon.icns new file mode 100644 index 00000000..d4713d5e Binary files /dev/null and b/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/TemplateIcon.icns differ diff --git a/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/TemplateInfo.plist b/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/TemplateInfo.plist new file mode 100755 index 00000000..7b0ab256 --- /dev/null +++ b/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/TemplateInfo.plist @@ -0,0 +1,6 @@ +{ + FilesToMacroExpand = ( + "Info.plist", + ); + Description = "This project builds a SFML application linked against the System and Window packages, and written in C++."; +} diff --git a/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/project.pbxproj b/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/project.pbxproj new file mode 100644 index 00000000..6dbff7e0 --- /dev/null +++ b/build/xcode/templates/SFML Window-based Application/SFML Window-based Application.xcodeproj/project.pbxproj @@ -0,0 +1,233 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + A0072B1B0F1D0FCD00B4A594 /* sfml-system.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB7880F07D338000AAC7B /* sfml-system.framework */; }; + A0072B1C0F1D0FCD00B4A594 /* sfml-window.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB7890F07D338000AAC7B /* sfml-window.framework */; }; + A01FB7870F07D328000AAC7B /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01FB7860F07D328000AAC7B /* main.cpp */; }; + A01FB78B0F07D338000AAC7B /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB7880F07D338000AAC7B /* sfml-system.framework */; }; + A01FB78C0F07D338000AAC7B /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB7890F07D338000AAC7B /* sfml-window.framework */; }; + A01FB7F70F07D381000AAC7B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01FB7F60F07D381000AAC7B /* OpenGL.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + A0072B2B0F1D0FD800B4A594 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + A0072B1B0F1D0FCD00B4A594 /* sfml-system.framework in Copy Frameworks */, + A0072B1C0F1D0FCD00B4A594 /* sfml-window.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + A01FB77A0F07D2C5000AAC7B /* «PROJECTNAME».app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "«PROJECTNAME».app"; sourceTree = BUILT_PRODUCTS_DIR; }; + A01FB77D0F07D2C5000AAC7B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A01FB7860F07D328000AAC7B /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + A01FB7880F07D338000AAC7B /* sfml-system.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-system.framework"; path = "/Library/Frameworks/sfml-system.framework"; sourceTree = ""; }; + A01FB7890F07D338000AAC7B /* sfml-window.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-window.framework"; path = "/Library/Frameworks/sfml-window.framework"; sourceTree = ""; }; + A01FB78A0F07D338000AAC7B /* SFML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SFML.framework; path = /Library/Frameworks/SFML.framework; sourceTree = ""; }; + A01FB7F60F07D381000AAC7B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A01FB7780F07D2C5000AAC7B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A01FB78B0F07D338000AAC7B /* sfml-system.framework in Frameworks */, + A01FB78C0F07D338000AAC7B /* sfml-window.framework in Frameworks */, + A01FB7F70F07D381000AAC7B /* OpenGL.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A01FB76B0F07D2BC000AAC7B = { + isa = PBXGroup; + children = ( + A01FB7830F07D30C000AAC7B /* Sources */, + A01FB7820F07D309000AAC7B /* Resources */, + A01FB7810F07D304000AAC7B /* Frameworks */, + A01FB77B0F07D2C5000AAC7B /* Products */, + ); + sourceTree = ""; + }; + A01FB77B0F07D2C5000AAC7B /* Products */ = { + isa = PBXGroup; + children = ( + A01FB77A0F07D2C5000AAC7B /* «PROJECTNAME».app */, + ); + name = Products; + sourceTree = ""; + }; + A01FB7810F07D304000AAC7B /* Frameworks */ = { + isa = PBXGroup; + children = ( + A01FB78A0F07D338000AAC7B /* SFML.framework */, + A01FB7880F07D338000AAC7B /* sfml-system.framework */, + A01FB7890F07D338000AAC7B /* sfml-window.framework */, + A01FB7F60F07D381000AAC7B /* OpenGL.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A01FB7820F07D309000AAC7B /* Resources */ = { + isa = PBXGroup; + children = ( + A01FB77D0F07D2C5000AAC7B /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + A01FB7830F07D30C000AAC7B /* Sources */ = { + isa = PBXGroup; + children = ( + A01FB7860F07D328000AAC7B /* main.cpp */, + ); + name = Sources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A01FB7790F07D2C5000AAC7B /* «PROJECTNAME» */ = { + isa = PBXNativeTarget; + buildConfigurationList = A01FB7800F07D2C6000AAC7B /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */; + buildPhases = ( + A01FB7760F07D2C5000AAC7B /* Resources */, + A01FB7770F07D2C5000AAC7B /* Sources */, + A01FB7780F07D2C5000AAC7B /* Frameworks */, + A0072B2B0F1D0FD800B4A594 /* Copy Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "«PROJECTNAME»"; + productName = "«PROJECTNAME»"; + productReference = A01FB77A0F07D2C5000AAC7B /* «PROJECTNAME».app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A01FB76D0F07D2BC000AAC7B /* Project object */ = { + isa = PBXProject; + buildConfigurationList = A01FB7700F07D2BC000AAC7B /* Build configuration list for PBXProject "«PROJECTNAME»" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 0; + mainGroup = A01FB76B0F07D2BC000AAC7B; + productRefGroup = A01FB77B0F07D2C5000AAC7B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A01FB7790F07D2C5000AAC7B /* «PROJECTNAME» */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A01FB7760F07D2C5000AAC7B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A01FB7770F07D2C5000AAC7B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A01FB7870F07D328000AAC7B /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A01FB76E0F07D2BC000AAC7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + }; + name = Debug; + }; + A01FB76F0F07D2BC000AAC7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + name = Release; + }; + A01FB77E0F07D2C6000AAC7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PREBINDING = NO; + PRODUCT_NAME = "«PROJECTNAME»"; + }; + name = Debug; + }; + A01FB77F0F07D2C6000AAC7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PREBINDING = NO; + PRODUCT_NAME = "«PROJECTNAME»"; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A01FB7700F07D2BC000AAC7B /* Build configuration list for PBXProject "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01FB76E0F07D2BC000AAC7B /* Debug */, + A01FB76F0F07D2BC000AAC7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A01FB7800F07D2C6000AAC7B /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A01FB77E0F07D2C6000AAC7B /* Debug */, + A01FB77F0F07D2C6000AAC7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A01FB76D0F07D2BC000AAC7B /* Project object */; +} diff --git a/build/xcode/templates/SFML Window-based Application/main.cpp b/build/xcode/templates/SFML Window-based Application/main.cpp new file mode 100644 index 00000000..16d4d335 --- /dev/null +++ b/build/xcode/templates/SFML Window-based Application/main.cpp @@ -0,0 +1,54 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Create the main window + sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window"); + + // Start game loop + while (App.IsOpened()) + { + // Process events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Close window : exit + if (Event.Type == sf::Event::Closed) + App.Close(); + + // Escape key : exit + if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) + App.Close(); + + // Resize event : adjust viewport + if (Event.Type == sf::Event::Resized) + glViewport(0, 0, Event.Size.Width, Event.Size.Height); + } + + // Set the active window before using OpenGL commands + // It's useless here because active window is always the same, + // but don't forget it if you use multiple windows or controls + App.SetActive(); + + // Clear color buffer + glClear(GL_COLOR_BUFFER_BIT); + + // Your drawing here... + + // Finally, display rendered frame on screen + App.Display(); + } + + return EXIT_SUCCESS; +} diff --git a/dotnet/MainPage.html b/dotnet/MainPage.html new file mode 100644 index 00000000..a8001135 --- /dev/null +++ b/dotnet/MainPage.html @@ -0,0 +1,71 @@ +

Welcome

+

+Welcome to the official SFML.Net documentation. Here you will find a detailed +description of all the SFML.Net classes.
+If you are looking for tutorials, help or whatever, you can visit the official website +at www.sfml-dev.org. +

+ +

Short example

+

+Here is a short example in C#, to show you how simple it is to use SFML.Net : +

+ +
+using System;
+using SFML.Audio;
+using SFML.Window;
+using SFML.Graphics;
+
+namespace Example
+{
+    class Program
+    {
+        static void OnClose(object sender, EventArgs e)
+        {
+            // Close the window when OnClose event is received
+            RenderWindow window = (RenderWindow)sender;
+            window.Close();
+        }
+
+        static void Main(string[] args)
+        {
+            // Create the main window
+            RenderWindow app = new RenderWindow(new VideoMode(800, 600), "SFML window");
+            app.Closed += new EventHandler(OnClose);
+
+            // Load a sprite to display
+            Image  image  = new Image("cute_image.jpg");
+            Sprite sprite = new Sprite(image);
+
+            // Create a graphical string to display
+            Font     arial = new Font("arial.ttf");
+            String2D text  = new String2D("Hello SFML.Net", arial);
+
+            // Load a music to play
+            Music music = new Music("nice_music.ogg");
+            music.Play();
+
+            // Start the game loop
+            while (app.IsOpened())
+            {
+                // Process events
+                app.DispatchEvents();
+
+                // Clear screen
+                app.Clear();
+
+                // Draw the sprite
+                app.Draw(sprite);
+
+                // Draw the string
+                app.Draw(text);
+
+                // Update the window
+                app.Display();
+            }
+        }
+    }
+}
+
+ diff --git a/dotnet/SFML.ndoc b/dotnet/SFML.ndoc new file mode 100644 index 00000000..89133d9b --- /dev/null +++ b/dotnet/SFML.ndoc @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dotnet/build/vc2005/SFML.net.sln b/dotnet/build/vc2005/SFML.net.sln new file mode 100644 index 00000000..2dc845cb --- /dev/null +++ b/dotnet/build/vc2005/SFML.net.sln @@ -0,0 +1,62 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C# Express 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfml-window", "..\..\src\Window\sfml-window.csproj", "{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfml-graphics", "..\..\src\Graphics\sfml-graphics.csproj", "{46786269-57B9-48E7-AA4F-8F4D84609FE6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sfml-audio", "..\..\src\Audio\sfml-audio.csproj", "{0B202C4D-A457-47FE-84A3-031DD878C6BE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-opengl", "..\..\samples\opengl\sample-opengl.csproj", "{160AE11E-138A-4B77-9642-EA74F9A79B4D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-window", "..\..\samples\window\sample-window.csproj", "{C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-postfx", "..\..\samples\post-fx\sample-postfx.csproj", "{9D4738F7-34EA-433A-A765-AF85A52A174D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-sound", "..\..\samples\sound\sample-sound.csproj", "{16E177F3-A0FF-4091-8521-562E0EBAA3AB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-soundcapture", "..\..\samples\sound_capture\sample-soundcapture.csproj", "{F2F48990-F81E-41BA-AD01-168F6178C807}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|Any CPU.Build.0 = Release|Any CPU + {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|Any CPU.Build.0 = Release|Any CPU + {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B202C4D-A457-47FE-84A3-031DD878C6BE}.Release|Any CPU.Build.0 = Release|Any CPU + {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {160AE11E-138A-4B77-9642-EA74F9A79B4D}.Release|Any CPU.Build.0 = Release|Any CPU + {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF}.Release|Any CPU.Build.0 = Release|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D4738F7-34EA-433A-A765-AF85A52A174D}.Release|Any CPU.Build.0 = Release|Any CPU + {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16E177F3-A0FF-4091-8521-562E0EBAA3AB}.Release|Any CPU.Build.0 = Release|Any CPU + {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2F48990-F81E-41BA-AD01-168F6178C807}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2F48990-F81E-41BA-AD01-168F6178C807}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll new file mode 100644 index 00000000..0727f7bf Binary files /dev/null and b/dotnet/extlibs/csfml-audio.dll differ diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll new file mode 100644 index 00000000..13946727 Binary files /dev/null and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll new file mode 100644 index 00000000..2027a9ee Binary files /dev/null and b/dotnet/extlibs/csfml-window.dll differ diff --git a/dotnet/extlibs/libsndfile-1.dll b/dotnet/extlibs/libsndfile-1.dll new file mode 100644 index 00000000..f112de2b Binary files /dev/null and b/dotnet/extlibs/libsndfile-1.dll differ diff --git a/dotnet/extlibs/openal32.dll b/dotnet/extlibs/openal32.dll new file mode 100644 index 00000000..28eb8e5b Binary files /dev/null and b/dotnet/extlibs/openal32.dll differ diff --git a/dotnet/samples/bin/datas/opengl/background.jpg b/dotnet/samples/bin/datas/opengl/background.jpg new file mode 100644 index 00000000..5b2247d4 Binary files /dev/null and b/dotnet/samples/bin/datas/opengl/background.jpg differ diff --git a/dotnet/samples/bin/datas/opengl/texture.jpg b/dotnet/samples/bin/datas/opengl/texture.jpg new file mode 100644 index 00000000..455a99fb Binary files /dev/null and b/dotnet/samples/bin/datas/opengl/texture.jpg differ diff --git a/dotnet/samples/bin/datas/post-fx/background.jpg b/dotnet/samples/bin/datas/post-fx/background.jpg new file mode 100644 index 00000000..c778e86b Binary files /dev/null and b/dotnet/samples/bin/datas/post-fx/background.jpg differ diff --git a/dotnet/samples/bin/datas/post-fx/blur.sfx b/dotnet/samples/bin/datas/post-fx/blur.sfx new file mode 100644 index 00000000..04bfec53 --- /dev/null +++ b/dotnet/samples/bin/datas/post-fx/blur.sfx @@ -0,0 +1,16 @@ +texture framebuffer +float offset + +effect +{ + vec2 offx = vec2(offset, 0.0); + vec2 offy = vec2(0.0, offset); + + vec4 c0 = framebuffer(_in); + vec4 c1 = framebuffer(_in - offy); + vec4 c2 = framebuffer(_in + offy); + vec4 c3 = framebuffer(_in - offx); + vec4 c4 = framebuffer(_in + offx); + + _out = c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2; +} diff --git a/dotnet/samples/bin/datas/post-fx/cheeseburger.ttf b/dotnet/samples/bin/datas/post-fx/cheeseburger.ttf new file mode 100644 index 00000000..47704266 Binary files /dev/null and b/dotnet/samples/bin/datas/post-fx/cheeseburger.ttf differ diff --git a/dotnet/samples/bin/datas/post-fx/colorize.sfx b/dotnet/samples/bin/datas/post-fx/colorize.sfx new file mode 100644 index 00000000..bcb48ebc --- /dev/null +++ b/dotnet/samples/bin/datas/post-fx/colorize.sfx @@ -0,0 +1,10 @@ +texture framebuffer +vec3 color + +effect +{ + vec4 pixel = framebuffer(_in); + float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; + + _out = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; +} diff --git a/dotnet/samples/bin/datas/post-fx/fisheye.sfx b/dotnet/samples/bin/datas/post-fx/fisheye.sfx new file mode 100644 index 00000000..cbc31ee7 --- /dev/null +++ b/dotnet/samples/bin/datas/post-fx/fisheye.sfx @@ -0,0 +1,12 @@ +texture framebuffer +vec2 mouse + +effect +{ + float len = distance(_in, mouse) * 7.0; + + if (len < 1.0) + _out = framebuffer(_in + (_in - mouse) * len); + else + _out = framebuffer(_in); +} diff --git a/dotnet/samples/bin/datas/post-fx/nothing.sfx b/dotnet/samples/bin/datas/post-fx/nothing.sfx new file mode 100644 index 00000000..133b4e31 --- /dev/null +++ b/dotnet/samples/bin/datas/post-fx/nothing.sfx @@ -0,0 +1,6 @@ +texture framebuffer + +effect +{ + _out = framebuffer(_in); +} diff --git a/dotnet/samples/bin/datas/post-fx/wave.jpg b/dotnet/samples/bin/datas/post-fx/wave.jpg new file mode 100644 index 00000000..cd125b8c Binary files /dev/null and b/dotnet/samples/bin/datas/post-fx/wave.jpg differ diff --git a/dotnet/samples/bin/datas/post-fx/wave.sfx b/dotnet/samples/bin/datas/post-fx/wave.sfx new file mode 100644 index 00000000..49b46071 --- /dev/null +++ b/dotnet/samples/bin/datas/post-fx/wave.sfx @@ -0,0 +1,12 @@ +texture framebuffer +texture wave +vec2 offset + +effect +{ + vec2 texoffset = wave(_in * offset).xy; + texoffset -= vec2(0.5, 0.5); + texoffset *= 0.05; + + _out = framebuffer(_in + texoffset); +} diff --git a/dotnet/samples/bin/datas/sound/footsteps.wav b/dotnet/samples/bin/datas/sound/footsteps.wav new file mode 100644 index 00000000..30ef4349 Binary files /dev/null and b/dotnet/samples/bin/datas/sound/footsteps.wav differ diff --git a/dotnet/samples/bin/datas/sound/lepidoptera.ogg b/dotnet/samples/bin/datas/sound/lepidoptera.ogg new file mode 100644 index 00000000..282a3a0a Binary files /dev/null and b/dotnet/samples/bin/datas/sound/lepidoptera.ogg differ diff --git a/dotnet/samples/opengl/OpenGL.cs b/dotnet/samples/opengl/OpenGL.cs new file mode 100644 index 00000000..48b5ab0a --- /dev/null +++ b/dotnet/samples/opengl/OpenGL.cs @@ -0,0 +1,161 @@ +using System; +using SFML; +using SFML.Graphics; +using SFML.Window; +using Tao.OpenGl; + +namespace sample_opengl +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main() + { + // Create main window + RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net OpenGL"); + App.PreserveOpenGLStates(true); + + // Setup event handlers + App.Closed += new EventHandler(OnClosed); + App.KeyPressed += new EventHandler(OnKeyPressed); + App.Resized += new EventHandler(OnResized); + + // Create a sprite for the background + Image BackgroundImage = new Image("datas/opengl/background.jpg"); + Sprite Background = new Sprite(BackgroundImage); + + // Create a text to display + String2D Text = new String2D("This is a rotating cube"); + Text.Position = new Vector2(250.0F, 300.0F); + Text.Color = new Color(128, 0, 128); + + // Load an OpenGL texture. + // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function), + // but here we want more control on it (generate mipmaps, ...) so we create a new one + int Texture = 0; + using (Image TempImage = new Image("datas/opengl/texture.jpg")) + { + Gl.glGenTextures(1, out Texture); + Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture); + Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, (int)TempImage.Width, (int)TempImage.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, TempImage.Pixels); + Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR); + Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR); + } + + // Enable Z-buffer read and write + Gl.glEnable(Gl.GL_DEPTH_TEST); + Gl.glDepthMask(Gl.GL_TRUE); + Gl.glClearDepth(1.0F); + + // Setup a perspective projection + Gl.glMatrixMode(Gl.GL_PROJECTION); + Gl.glLoadIdentity(); + Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F); + + // Bind our texture + Gl.glEnable(Gl.GL_TEXTURE_2D); + Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture); + Gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + float Time = 0.0F; + + // Start game loop + while (App.IsOpened()) + { + // Process events + App.DispatchEvents(); + + // Clear the window + App.Clear(); + + // Draw background + App.Draw(Background); + + // Clear depth buffer + Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT); + + // Apply some transformations + Time += App.GetFrameTime(); + Gl.glMatrixMode(Gl.GL_MODELVIEW); + Gl.glLoadIdentity(); + Gl.glTranslatef(0.0F, 0.0F, -200.0F); + Gl.glRotatef(Time * 50, 1.0F, 0.0F, 0.0F); + Gl.glRotatef(Time * 30, 0.0F, 1.0F, 0.0F); + Gl.glRotatef(Time * 90, 0.0F, 0.0F, 1.0F); + + // Draw a cube + Gl.glBegin(Gl.GL_QUADS); + + Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F); + Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, -50.0F); + Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F, -50.0F); + Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, -50.0F); + + Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, 50.0F); + Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, 50.0F); + Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F, 50.0F); + Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, 50.0F); + + Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F); + Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, -50.0F); + Gl.glTexCoord2f(1, 1); Gl.glVertex3f(-50.0F, 50.0F, 50.0F); + Gl.glTexCoord2f(1, 0); Gl.glVertex3f(-50.0F, -50.0F, 50.0F); + + Gl.glTexCoord2f(0, 0); Gl.glVertex3f(50.0F, -50.0F, -50.0F); + Gl.glTexCoord2f(0, 1); Gl.glVertex3f(50.0F, 50.0F, -50.0F); + Gl.glTexCoord2f(1, 1); Gl.glVertex3f(50.0F, 50.0F, 50.0F); + Gl.glTexCoord2f(1, 0); Gl.glVertex3f(50.0F, -50.0F, 50.0F); + + Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, -50.0F, 50.0F); + Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, -50.0F, -50.0F); + Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, -50.0F, -50.0F); + Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, -50.0F, 50.0F); + + Gl.glTexCoord2f(0, 1); Gl.glVertex3f(-50.0F, 50.0F, 50.0F); + Gl.glTexCoord2f(0, 0); Gl.glVertex3f(-50.0F, 50.0F, -50.0F); + Gl.glTexCoord2f(1, 0); Gl.glVertex3f( 50.0F, 50.0F, -50.0F); + Gl.glTexCoord2f(1, 1); Gl.glVertex3f( 50.0F, 50.0F, 50.0F); + + Gl.glEnd(); + + // Draw some text on top of our OpenGL object + App.Draw(Text); + + // Finally, display the rendered frame on screen + App.Display(); + } + + // Don't forget to destroy our texture + Gl.glDeleteTextures(1, ref Texture); + } + + /// + /// Function called when the window is closed + /// + static void OnClosed(object sender, EventArgs e) + { + RenderWindow window = (RenderWindow)sender; + window.Close(); + } + + /// + /// Function called when a key is pressed + /// + static void OnKeyPressed(object sender, KeyEventArgs e) + { + RenderWindow window = (RenderWindow)sender; + if (e.Code == KeyCode.Escape) + window.Close(); + } + + /// + /// Function called when the window is resized + /// + static void OnResized(object sender, SizeEventArgs e) + { + Gl.glViewport(0, 0, (int)e.Width, (int)e.Height); + } + } +} diff --git a/dotnet/samples/opengl/sample-opengl.csproj b/dotnet/samples/opengl/sample-opengl.csproj new file mode 100644 index 00000000..f15c6b99 --- /dev/null +++ b/dotnet/samples/opengl/sample-opengl.csproj @@ -0,0 +1,66 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {160AE11E-138A-4B77-9642-EA74F9A79B4D} + WinExe + Properties + sample_opengl + opengl + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + + + + {46786269-57B9-48E7-AA4F-8F4D84609FE6} + sfml-graphics + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + + + False + ..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.FreeGlut.dll + + + False + ..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.OpenGl.dll + + + + + + + + \ No newline at end of file diff --git a/dotnet/samples/post-fx/PostFx.cs b/dotnet/samples/post-fx/PostFx.cs new file mode 100644 index 00000000..3a93932e --- /dev/null +++ b/dotnet/samples/post-fx/PostFx.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using SFML; +using SFML.Graphics; +using SFML.Window; + +namespace sample_postfx +{ + static class Program + { + private static Dictionary Effects; + private static Dictionary.Enumerator CurrentEffect; + private static String2D CurFXStr; + + /// + /// The main entry point for the application. + /// + static void Main() + { + // Create the main window + RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net PostFX"); + + // Setup event handlers + App.Closed += new EventHandler(OnClosed); + App.KeyPressed += new EventHandler(OnKeyPressed); + + // Check that the system can use post effects + if (PostFx.CanUsePostFX == false) + { + DisplayError(App); + return; + } + + // Load a cute background image to display :) + Sprite Background = new Sprite(new Image("datas/post-fx/background.jpg")); + + // Load the text font + Font Cheeseburger = new Font("datas/post-fx/cheeseburger.ttf"); + + // Load the image needed for the wave effect + Image WaveImage = new Image("datas/post-fx/wave.jpg"); + + // Load all effects + Effects = new Dictionary(); + Effects["nothing"] = new PostFx("datas/post-fx/nothing.sfx"); + Effects["blur"] = new PostFx("datas/post-fx/blur.sfx"); + Effects["colorize"] = new PostFx("datas/post-fx/colorize.sfx"); + Effects["fisheye"] = new PostFx("datas/post-fx/fisheye.sfx"); + Effects["wave"] = new PostFx("datas/post-fx/wave.sfx"); + CurrentEffect = Effects.GetEnumerator(); + CurrentEffect.MoveNext(); + + // Do specific initializations + Effects["nothing"].SetTexture("framebuffer", null); + Effects["blur"].SetTexture("framebuffer", null); + Effects["blur"].SetParameter("offset", 0.0F); + Effects["colorize"].SetTexture("framebuffer", null); + Effects["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F); + Effects["fisheye"].SetTexture("framebuffer", null); + Effects["wave"].SetTexture("framebuffer", null); + Effects["wave"].SetTexture("wave", WaveImage); + + // Define a string for displaying current effect description + CurFXStr = new String2D(); + CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\""; + CurFXStr.Font = Cheeseburger; + CurFXStr.Position = new Vector2(20.0F, 0.0F); + + // Define a string for displaying help + String2D InfoStr = new String2D(); + InfoStr.Text = "Move your mouse to change the effect parameters\nPress numpad + to change effect\nWarning : some effects may not work\ndepending on your graphics card"; + InfoStr.Font = Cheeseburger; + InfoStr.Position = new Vector2(20.0F, 460.0F); + InfoStr.Color = new Color(200, 100, 150); + + // Start the game loop + while (App.IsOpened()) + { + // Process events + App.DispatchEvents(); + + // Get the mouse position in the range [0, 1] + float X = App.Input.GetMouseX() / (float)App.Width; + float Y = App.Input.GetMouseY() / (float)App.Height; + + // Update the current effect + if (CurrentEffect.Current.Key == "blur") CurrentEffect.Current.Value.SetParameter("offset", X * Y * 0.1f); + else if (CurrentEffect.Current.Key == "colorize") CurrentEffect.Current.Value.SetParameter("color", 0.3f, X, Y); + else if (CurrentEffect.Current.Key == "fisheye") CurrentEffect.Current.Value.SetParameter("mouse", X, 1.0F - Y); + else if (CurrentEffect.Current.Key == "wave") CurrentEffect.Current.Value.SetParameter("offset", X, Y); + + // Clear the window + App.Clear(); + + // Draw background and apply the post-fx + App.Draw(Background); + App.Draw(CurrentEffect.Current.Value); + + // Draw interface strings + App.Draw(CurFXStr); + App.Draw(InfoStr); + + // Finally, display the rendered frame on screen + App.Display(); + } + } + + /// + /// Fonction called when the post-effects are not supported ; + /// Display an error message and wait until the user exits + /// + private static void DisplayError(RenderWindow App) + { + // Define a string for displaying the error message + String2D ErrorStr = new String2D("Sorry, your system doesn't support post-effects"); + ErrorStr.Position = new Vector2(100.0F, 250.0F); + ErrorStr.Color = new Color(200, 100, 150); + + // Start the game loop + while (App.IsOpened()) + { + // Process events + App.DispatchEvents(); + + // Clear the window + App.Clear(); + + // Draw the error message + App.Draw(ErrorStr); + + // Finally, display the rendered frame on screen + App.Display(); + } + } + + /// + /// Function called when the window is closed + /// + static void OnClosed(object sender, EventArgs e) + { + RenderWindow window = (RenderWindow)sender; + window.Close(); + } + + /// + /// Function called when a key is pressed + /// + static void OnKeyPressed(object sender, KeyEventArgs e) + { + RenderWindow window = (RenderWindow)sender; + if (e.Code == KeyCode.Escape) + { + // Close the window + window.Close(); + } + else if (e.Code == KeyCode.Add) + { + // Advance to the next effect + if (CurrentEffect.MoveNext() == false) + { + CurrentEffect = Effects.GetEnumerator(); + CurrentEffect.MoveNext(); + } + CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\""; + } + } + } +} diff --git a/dotnet/samples/post-fx/sample-postfx.csproj b/dotnet/samples/post-fx/sample-postfx.csproj new file mode 100644 index 00000000..11e5ae41 --- /dev/null +++ b/dotnet/samples/post-fx/sample-postfx.csproj @@ -0,0 +1,54 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {9D4738F7-34EA-433A-A765-AF85A52A174D} + WinExe + Properties + sample_postfx + post-fx + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + + + + {46786269-57B9-48E7-AA4F-8F4D84609FE6} + sfml-graphics + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + + + + + + \ No newline at end of file diff --git a/dotnet/samples/sound/Sound.cs b/dotnet/samples/sound/Sound.cs new file mode 100644 index 00000000..fa8fd560 --- /dev/null +++ b/dotnet/samples/sound/Sound.cs @@ -0,0 +1,82 @@ +using System; +using System.Threading; +using SFML; +using SFML.Audio; + +namespace sample_sound +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + // Play a sound + PlaySound(); + Console.Clear(); + + // Play a music + PlayMusic(); + } + + /// + /// Play a sound + /// + private static void PlaySound() + { + // Load a sound buffer from a wav file + SoundBuffer Buffer = new SoundBuffer("datas/sound/footsteps.wav"); + + // Display sound informations + Console.WriteLine("footsteps.wav :"); + Console.WriteLine(" " + Buffer.Duration + " sec"); + Console.WriteLine(" " + Buffer.SampleRate + " samples / sec"); + Console.WriteLine(" " + Buffer.ChannelsCount + " channels"); + + // Create a sound instance and play it + Sound Sound = new Sound(Buffer); + Sound.Play(); + + // Loop while the sound is playing + while (Sound.Status == SoundStatus.Playing) + { + // Display the playing position + Console.CursorLeft = 0; + Console.Write("Playing... " + Sound.PlayingOffset + " sec "); + + // Leave some CPU time for other processes + Thread.Sleep(100); + } + } + + /// + /// Play a music + /// + private static void PlayMusic() + { + // Load an ogg music file + Music Music = new Music("datas/sound/lepidoptera.ogg"); + + // Display music informations + Console.WriteLine("lepidoptera.ogg :"); + Console.WriteLine(" " + Music.Duration + " sec"); + Console.WriteLine(" " + Music.SampleRate + " samples / sec"); + Console.WriteLine(" " + Music.ChannelsCount + " channels"); + + // Play it + Music.Play(); + + // Loop while the music is playing + while (Music.Status == SoundStatus.Playing) + { + // Display the playing position + Console.CursorLeft = 0; + Console.Write("Playing... " + Music.PlayingOffset + " sec "); + + // Leave some CPU time for other processes + Thread.Sleep(100); + } + } + } +} diff --git a/dotnet/samples/sound/sample-sound.csproj b/dotnet/samples/sound/sample-sound.csproj new file mode 100644 index 00000000..55a1453d --- /dev/null +++ b/dotnet/samples/sound/sample-sound.csproj @@ -0,0 +1,56 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {16E177F3-A0FF-4091-8521-562E0EBAA3AB} + Exe + Properties + sample_sound + sound + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + + + + {0B202C4D-A457-47FE-84A3-031DD878C6BE} + sfml-audio + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + + + + + + \ No newline at end of file diff --git a/dotnet/samples/sound_capture/SoundCapture.cs b/dotnet/samples/sound_capture/SoundCapture.cs new file mode 100644 index 00000000..aa4e9421 --- /dev/null +++ b/dotnet/samples/sound_capture/SoundCapture.cs @@ -0,0 +1,83 @@ +using System; +using System.Threading; +using SFML; +using SFML.Audio; + +namespace sample_soundcapture +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main(string[] args) + { + // Check that the device can capture audio + if (SoundRecorder.CanCapture == false) + { + Console.WriteLine("Sorry, audio capture is not supported by your system"); + return; + } + + // Choose the sample rate + Console.WriteLine("Please choose the sample rate for sound capture (44100 is CD quality) : "); + uint SampleRate = uint.Parse(Console.ReadLine()); + + // Wait for user input... + Console.WriteLine("Press enter to start recording audio"); + Console.ReadLine(); + + // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer + SoundBufferRecorder Recorder = new SoundBufferRecorder(); + + // Audio capture is done in a separate thread, so we can block the main thread while it is capturing + Recorder.Start(SampleRate); + Console.WriteLine("Recording... press enter to stop"); + Console.ReadLine(); + Recorder.Stop(); + + // Get the buffer containing the captured data + SoundBuffer Buffer = Recorder.SoundBuffer; + + // Display captured sound informations + Console.WriteLine("Sound information :"); + Console.WriteLine(" " + Buffer.Duration + " seconds"); + Console.WriteLine(" " + Buffer.SampleRate + " samples / seconds"); + Console.WriteLine(" " + Buffer.ChannelsCount + " channels"); + + // Choose what to do with the recorded sound data + Console.WriteLine("What do you want to do with captured sound (p = play, s = save) ? "); + char Choice = char.Parse(Console.ReadLine()); + + if (Choice == 's') + { + // Choose the filename + Console.WriteLine("Choose the file to create : "); + string Filename = Console.ReadLine(); + + // Save the buffer + Buffer.SaveToFile(Filename); + } + else + { + // Create a sound instance and play it + Sound Sound = new Sound(Buffer); + Sound.Play(); + + // Wait until finished + while (Sound.Status == SoundStatus.Playing) + { + // Display the playing position + Console.CursorLeft = 0; + Console.Write("Playing... " + Sound.PlayingOffset + " sec "); + + // Leave some CPU time for other threads + Thread.Sleep(100); + } + } + + // Finished ! + Console.WriteLine("\nDone !"); + } + } +} diff --git a/dotnet/samples/sound_capture/sample-soundcapture.csproj b/dotnet/samples/sound_capture/sample-soundcapture.csproj new file mode 100644 index 00000000..5b50efc8 --- /dev/null +++ b/dotnet/samples/sound_capture/sample-soundcapture.csproj @@ -0,0 +1,56 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {F2F48990-F81E-41BA-AD01-168F6178C807} + Exe + Properties + sample_soundcapture + sound-capture + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + + + + {0B202C4D-A457-47FE-84A3-031DD878C6BE} + sfml-audio + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + + + + + + \ No newline at end of file diff --git a/dotnet/samples/visualbasic/My Project/Application.Designer.vb b/dotnet/samples/visualbasic/My Project/Application.Designer.vb new file mode 100644 index 00000000..d73a4d86 --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.3053 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/dotnet/samples/visualbasic/My Project/Application.myapp b/dotnet/samples/visualbasic/My Project/Application.myapp new file mode 100644 index 00000000..23b627fb --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 2 + true + diff --git a/dotnet/samples/visualbasic/My Project/AssemblyInfo.vb b/dotnet/samples/visualbasic/My Project/AssemblyInfo.vb new file mode 100644 index 00000000..ee7d3d64 --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' + + + diff --git a/dotnet/samples/visualbasic/My Project/Resources.Designer.vb b/dotnet/samples/visualbasic/My Project/Resources.Designer.vb new file mode 100644 index 00000000..4c1f1ee6 --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.3053 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("visualbasic.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/dotnet/samples/visualbasic/My Project/Resources.resx b/dotnet/samples/visualbasic/My Project/Resources.resx new file mode 100644 index 00000000..ffecec85 --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/dotnet/samples/visualbasic/My Project/Settings.Designer.vb b/dotnet/samples/visualbasic/My Project/Settings.Designer.vb new file mode 100644 index 00000000..b6a816e3 --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.3053 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.visualbasic.My.MySettings + Get + Return Global.visualbasic.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/dotnet/samples/visualbasic/My Project/Settings.settings b/dotnet/samples/visualbasic/My Project/Settings.settings new file mode 100644 index 00000000..377f56d6 --- /dev/null +++ b/dotnet/samples/visualbasic/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dotnet/samples/visualbasic/OpenGL.vb b/dotnet/samples/visualbasic/OpenGL.vb new file mode 100644 index 00000000..55b45672 --- /dev/null +++ b/dotnet/samples/visualbasic/OpenGL.vb @@ -0,0 +1,177 @@ +Imports SFML +Imports SFML.Window +Imports SFML.Graphics +Imports Tao.OpenGl +Imports Tao.FreeGlut + + +Module OpenGL + + Dim WithEvents App As RenderWindow + + ''' + ''' Entry point of application + ''' + Sub Main() + + ' Create main window + App = New RenderWindow(New VideoMode(800, 600), "SFML.Net OpenGL (Visual Basic)") + App.PreserveOpenGLStates(True) + + ' Create a sprite for the background + Dim BackgroundImage = New Image("datas/opengl/background.jpg") + Dim Background = New Sprite(BackgroundImage) + + ' Create a text to display + Dim Text = New String2D("This is a rotating cube") + Text.Position = New Vector2(250.0F, 300.0F) + Text.Color = New Color(128, 0, 128) + + ' Load an OpenGL texture. + ' We could directly use a sf::Image as an OpenGL texture (with its Bind() member function), + ' but here we want more control on it (generate mipmaps, ...) so we create a new one + Dim Texture = 0 + Using TempImage = New Image("datas/opengl/texture.jpg") + Gl.glGenTextures(1, Texture) + Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture) + Glu.gluBuild2DMipmaps(Gl.GL_TEXTURE_2D, Gl.GL_RGBA, TempImage.Width, TempImage.Height, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, TempImage.Pixels) + Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR) + Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR) + End Using + + ' Enable Z-buffer read and write + Gl.glEnable(Gl.GL_DEPTH_TEST) + Gl.glDepthMask(Gl.GL_TRUE) + Gl.glClearDepth(1.0F) + + ' Setup a perspective projection + Gl.glMatrixMode(Gl.GL_PROJECTION) + Gl.glLoadIdentity() + Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F) + + ' Bind our texture + Gl.glEnable(Gl.GL_TEXTURE_2D) + Gl.glBindTexture(Gl.GL_TEXTURE_2D, Texture) + Gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F) + + Dim Time = 0.0F + + ' Start game loop + While (App.IsOpened()) + + ' Process events + App.DispatchEvents() + + ' Draw background + App.Draw(Background) + + ' Clear depth buffer + Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT) + + ' Apply some transformations + Time += App.GetFrameTime() + Gl.glMatrixMode(Gl.GL_MODELVIEW) + Gl.glLoadIdentity() + Gl.glTranslatef(0.0F, 0.0F, -200.0F) + Gl.glRotatef(Time * 50, 1.0F, 0.0F, 0.0F) + Gl.glRotatef(Time * 30, 0.0F, 1.0F, 0.0F) + Gl.glRotatef(Time * 90, 0.0F, 0.0F, 1.0F) + + ' Draw a cube + Gl.glBegin(Gl.GL_QUADS) + + Gl.glTexCoord2f(0, 0) + Gl.glVertex3f(-50.0F, -50.0F, -50.0F) + Gl.glTexCoord2f(0, 1) + Gl.glVertex3f(-50.0F, 50.0F, -50.0F) + Gl.glTexCoord2f(1, 1) + Gl.glVertex3f(50.0F, 50.0F, -50.0F) + Gl.glTexCoord2f(1, 0) + Gl.glVertex3f(50.0F, -50.0F, -50.0F) + + Gl.glTexCoord2f(0, 0) + Gl.glVertex3f(-50.0F, -50.0F, 50.0F) + Gl.glTexCoord2f(0, 1) + Gl.glVertex3f(-50.0F, 50.0F, 50.0F) + Gl.glTexCoord2f(1, 1) + Gl.glVertex3f(50.0F, 50.0F, 50.0F) + Gl.glTexCoord2f(1, 0) + Gl.glVertex3f(50.0F, -50.0F, 50.0F) + + Gl.glTexCoord2f(0, 0) + Gl.glVertex3f(-50.0F, -50.0F, -50.0F) + Gl.glTexCoord2f(0, 1) + Gl.glVertex3f(-50.0F, 50.0F, -50.0F) + Gl.glTexCoord2f(1, 1) + Gl.glVertex3f(-50.0F, 50.0F, 50.0F) + Gl.glTexCoord2f(1, 0) + Gl.glVertex3f(-50.0F, -50.0F, 50.0F) + + Gl.glTexCoord2f(0, 0) + Gl.glVertex3f(50.0F, -50.0F, -50.0F) + Gl.glTexCoord2f(0, 1) + Gl.glVertex3f(50.0F, 50.0F, -50.0F) + Gl.glTexCoord2f(1, 1) + Gl.glVertex3f(50.0F, 50.0F, 50.0F) + Gl.glTexCoord2f(1, 0) + Gl.glVertex3f(50.0F, -50.0F, 50.0F) + + Gl.glTexCoord2f(0, 1) + Gl.glVertex3f(-50.0F, -50.0F, 50.0F) + Gl.glTexCoord2f(0, 0) + Gl.glVertex3f(-50.0F, -50.0F, -50.0F) + Gl.glTexCoord2f(1, 0) + Gl.glVertex3f(50.0F, -50.0F, -50.0F) + Gl.glTexCoord2f(1, 1) + Gl.glVertex3f(50.0F, -50.0F, 50.0F) + + Gl.glTexCoord2f(0, 1) + Gl.glVertex3f(-50.0F, 50.0F, 50.0F) + Gl.glTexCoord2f(0, 0) + Gl.glVertex3f(-50.0F, 50.0F, -50.0F) + Gl.glTexCoord2f(1, 0) + Gl.glVertex3f(50.0F, 50.0F, -50.0F) + Gl.glTexCoord2f(1, 1) + Gl.glVertex3f(50.0F, 50.0F, 50.0F) + + Gl.glEnd() + + ' Draw some text on top of our OpenGL object + App.Draw(Text) + + ' Finally, display the rendered frame on screen + App.Display() + + End While + + ' Don't forget to destroy our texture + Gl.glDeleteTextures(1, Texture) + + End Sub + + ''' + ''' Function called when the window is closed + ''' + Sub App_Closed(ByVal sender As Object, ByVal e As EventArgs) Handles App.Closed + Dim window = CType(sender, RenderWindow) + window.Close() + End Sub + + ''' + ''' Function called when a key is pressed + ''' + Sub App_KeyPressed(ByVal sender As Object, ByVal e As KeyEventArgs) Handles App.KeyPressed + Dim window = CType(sender, RenderWindow) + If e.Code = KeyCode.Escape Then + window.Close() + End If + End Sub + + ''' + ''' Function called when the window is resized + ''' + Sub App_Resized(ByVal sender As Object, ByVal e As SizeEventArgs) Handles App.Resized + Gl.glViewport(0, 0, e.Width, e.Height) + End Sub + +End Module diff --git a/dotnet/samples/visualbasic/visualbasic.sln b/dotnet/samples/visualbasic/visualbasic.sln new file mode 100644 index 00000000..099bf8ba --- /dev/null +++ b/dotnet/samples/visualbasic/visualbasic.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Basic Express 2008 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "visualbasic", "visualbasic.vbproj", "{98552080-F688-46B4-A2FF-1AC7C50ECBE8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {98552080-F688-46B4-A2FF-1AC7C50ECBE8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/dotnet/samples/visualbasic/visualbasic.vbproj b/dotnet/samples/visualbasic/visualbasic.vbproj new file mode 100644 index 00000000..e657c3fa --- /dev/null +++ b/dotnet/samples/visualbasic/visualbasic.vbproj @@ -0,0 +1,121 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {98552080-F688-46B4-A2FF-1AC7C50ECBE8} + WinExe + visualbasic.OpenGL + visualbasic + visualbasic + 512 + WindowsFormsWithCustomSubMain + v3.5 + On + Binary + Off + On + + + true + full + true + true + bin\Debug\ + visualbasic.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + pdbonly + false + true + true + bin\Release\ + visualbasic.xml + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + + + + False + ..\..\lib\sfmlnet-graphics.dll + + + False + ..\..\lib\sfmlnet-window.dll + + + + + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + \ No newline at end of file diff --git a/dotnet/samples/window/Window.cs b/dotnet/samples/window/Window.cs new file mode 100644 index 00000000..10356a4c --- /dev/null +++ b/dotnet/samples/window/Window.cs @@ -0,0 +1,134 @@ +using System; +using SFML; +using SFML.Window; +using Tao.OpenGl; + +namespace sample_window +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main() + { + // Create the main window + Window App = new Window(new VideoMode(640, 480, 32), "SFML.Net Window"); + + // Setup event handlers + App.Closed += new EventHandler(OnClosed); + App.KeyPressed += new EventHandler(OnKeyPressed); + App.Resized += new EventHandler(OnResized); + + // Set the color and depth clear values + Gl.glClearDepth(1.0F); + Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); + + // Enable Z-buffer read and write + Gl.glEnable(Gl.GL_DEPTH_TEST); + Gl.glDepthMask(Gl.GL_TRUE); + + // Setup a perspective projection + Gl.glMatrixMode(Gl.GL_PROJECTION); + Gl.glLoadIdentity(); + Glu.gluPerspective(90.0F, 1.0F, 1.0F, 500.0F); + + float Time = 0.0F; + + // Start the game loop + while (App.IsOpened()) + { + // Process events + App.DispatchEvents(); + + // Set the active window before using OpenGL commands + // It's useless here because the active window is always the same, + // but don't forget it if you use multiple windows + App.SetActive(); + + // Clear color and depth buffer + Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); + + // Apply some transformations + Time += App.GetFrameTime(); + Gl.glMatrixMode(Gl.GL_MODELVIEW); + Gl.glLoadIdentity(); + Gl.glTranslatef(0.0F, 0.0F, -200.0F); + Gl.glRotatef(Time * 50, 1.0F, 0.0F, 0.0F); + Gl.glRotatef(Time * 30, 0.0F, 1.0F, 0.0F); + Gl.glRotatef(Time * 90, 0.0F, 0.0F, 1.0F); + + // Draw a cube + Gl.glBegin(Gl.GL_QUADS); + + Gl.glColor3f(1.0F, 0.0F, 0.0F); + Gl.glVertex3f(-50.0F, -50.0F, -50.0F); + Gl.glVertex3f(-50.0F, 50.0F, -50.0F); + Gl.glVertex3f( 50.0F, 50.0F, -50.0F); + Gl.glVertex3f( 50.0F, -50.0F, -50.0F); + + Gl.glColor3f(1.0F, 0.0F, 0.0F); + Gl.glVertex3f(-50.0F, -50.0F, 50.0F); + Gl.glVertex3f(-50.0F, 50.0F, 50.0F); + Gl.glVertex3f( 50.0F, 50.0F, 50.0F); + Gl.glVertex3f( 50.0F, -50.0F, 50.0F); + + Gl.glColor3f(0.0F, 1.0F, 0.0F); + Gl.glVertex3f(-50.0F, -50.0F, -50.0F); + Gl.glVertex3f(-50.0F, 50.0F, -50.0F); + Gl.glVertex3f(-50.0F, 50.0F, 50.0F); + Gl.glVertex3f(-50.0F, -50.0F, 50.0F); + + Gl.glColor3f(0.0F, 1.0F, 0.0F); + Gl.glVertex3f(50.0F, -50.0F, -50.0F); + Gl.glVertex3f(50.0F, 50.0F, -50.0F); + Gl.glVertex3f(50.0F, 50.0F, 50.0F); + Gl.glVertex3f(50.0F, -50.0F, 50.0F); + + Gl.glColor3f(0.0F, 0.0F, 1.0F); + Gl.glVertex3f(-50.0F, -50.0F, 50.0F); + Gl.glVertex3f(-50.0F, -50.0F, -50.0F); + Gl.glVertex3f( 50.0F, -50.0F, -50.0F); + Gl.glVertex3f( 50.0F, -50.0F, 50.0F); + + Gl.glColor3f(0.0F, 0.0F, 1.0F); + Gl.glVertex3f(-50.0F, 50.0F, 50.0F); + Gl.glVertex3f(-50.0F, 50.0F, -50.0F); + Gl.glVertex3f( 50.0F, 50.0F, -50.0F); + Gl.glVertex3f( 50.0F, 50.0F, 50.0F); + + Gl.glEnd(); + + // Finally, display the rendered frame on screen + App.Display(); + } + } + + /// + /// Function called when the window is closed + /// + static void OnClosed(object sender, EventArgs e) + { + Window window = (Window)sender; + window.Close(); + } + + /// + /// Function called when a key is pressed + /// + static void OnKeyPressed(object sender, KeyEventArgs e) + { + Window window = (Window)sender; + if (e.Code == KeyCode.Escape) + window.Close(); + } + + /// + /// Function called when the window is resized + /// + static void OnResized(object sender, SizeEventArgs e) + { + Gl.glViewport(0, 0, (int)e.Width, (int)e.Height); + } + } +} diff --git a/dotnet/samples/window/sample-window.csproj b/dotnet/samples/window/sample-window.csproj new file mode 100644 index 00000000..a830d154 --- /dev/null +++ b/dotnet/samples/window/sample-window.csproj @@ -0,0 +1,60 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {C1FBB9AF-B69A-4D06-9BDC-EAC7606296FF} + WinExe + Properties + sample_window + window + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\ + TRACE + prompt + 4 + + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + + + False + ..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.FreeGlut.dll + + + False + ..\..\..\..\..\Bibliothèques\TaoFramework\bin\Tao.OpenGl.dll + + + + + + + + \ No newline at end of file diff --git a/dotnet/src/Audio/Listener.cs b/dotnet/src/Audio/Listener.cs new file mode 100644 index 00000000..da0c2237 --- /dev/null +++ b/dotnet/src/Audio/Listener.cs @@ -0,0 +1,73 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// Listener is a global interface for defining the audio + /// listener properties ; the audio listener is the point in + /// the scene from where all the sounds are heard + /// + //////////////////////////////////////////////////////////// + public class Listener + { + //////////////////////////////////////////////////////////// + /// + /// Global volume of all sounds, in range [0 .. 100] (default is 100) + /// + //////////////////////////////////////////////////////////// + static float GlobalVolume + { + get {return sfListener_GetGlobalVolume();} + set {sfListener_SetGlobalVolume(value);} + } + + //////////////////////////////////////////////////////////// + /// + /// 3D position of the listener (default is (0, 0, 0)) + /// + //////////////////////////////////////////////////////////// + static Vector3 Position + { + get {Vector3 v; sfListener_GetPosition(out v.X, out v.Y, out v.Z); return v;} + set {sfListener_SetPosition(value.X, value.Y, value.Z);} + } + + //////////////////////////////////////////////////////////// + /// + /// 3D position of the target, ie. the point the listener is looking at + /// (default is (0, 0, -1)) + /// + //////////////////////////////////////////////////////////// + static Vector3 Target + { + get {Vector3 v; sfListener_GetTarget(out v.X, out v.Y, out v.Z); return v;} + set {sfListener_SetTarget(value.X, value.Y, value.Z);} + } + + #region Imports + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfListener_SetGlobalVolume(float Volume); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfListener_GetGlobalVolume(); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfListener_SetPosition(float PosX, float PosY, float PosZ); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfListener_GetPosition(out float PosX, out float PosY, out float PosZ); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfListener_SetTarget(float TargetX, float TargetY, float TargetZ); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfListener_GetTarget(out float TargetX, out float TargetY, out float TargetZ); + #endregion + } + } +} diff --git a/dotnet/src/Audio/Music.cs b/dotnet/src/Audio/Music.cs new file mode 100644 index 00000000..988761ea --- /dev/null +++ b/dotnet/src/Audio/Music.cs @@ -0,0 +1,287 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.IO; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// Music defines a big sound played using streaming, + /// so usually what we call a music :) + /// + //////////////////////////////////////////////////////////// + public class Music : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Construct the music from a file + /// + /// Path of the music file to load + //////////////////////////////////////////////////////////// + public Music(string filename) : + base(sfMusic_CreateFromFile(filename)) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("music", filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the music from a file in a stream + /// + /// Stream containing the file contents + //////////////////////////////////////////////////////////// + public Music(Stream stream) : + base(IntPtr.Zero) + { + stream.Position = 0; + byte[] StreamData = new byte[stream.Length]; + uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); + unsafe + { + fixed (byte* dataPtr = StreamData) + { + SetThis(sfMusic_CreateFromMemory((char*)dataPtr, Read)); + } + } + if (This == IntPtr.Zero) + throw new LoadingFailedException("music"); + } + + //////////////////////////////////////////////////////////// + /// + /// Play the music + /// + //////////////////////////////////////////////////////////// + public void Play() + { + sfMusic_Play(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Pause the music + /// + //////////////////////////////////////////////////////////// + public void Pause() + { + sfMusic_Pause(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Stop the music + /// + //////////////////////////////////////////////////////////// + public void Stop() + { + sfMusic_Stop(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Samples rate, in samples per second + /// + //////////////////////////////////////////////////////////// + public uint SampleRate + { + get {return sfMusic_GetSampleRate(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Number of channels (1 = mono, 2 = stereo) + /// + //////////////////////////////////////////////////////////// + public uint ChannelsCount + { + get {return sfMusic_GetChannelsCount(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Current status of the music (see SoundStatus enum) + /// + //////////////////////////////////////////////////////////// + public SoundStatus Status + { + get {return sfMusic_GetStatus(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Total duration of the music, in seconds + /// + //////////////////////////////////////////////////////////// + public float Duration + { + get {return sfMusic_GetDuration(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Loop state of the sound. Default value is false + /// + //////////////////////////////////////////////////////////// + public bool Loop + { + get {return sfMusic_GetLoop(This);} + set {sfMusic_SetLoop(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Pitch of the music. Default value is 1 + /// + //////////////////////////////////////////////////////////// + public float Pitch + { + get {return sfMusic_GetPitch(This);} + set {sfMusic_SetPitch(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Volume of the music, in range [0, 100]. Default value is 100 + /// + //////////////////////////////////////////////////////////// + public float Volume + { + get {return sfMusic_GetVolume(This);} + set {sfMusic_SetVolume(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// 3D position of the music. Default value is (0, 0, 0) + /// + //////////////////////////////////////////////////////////// + public Vector3 Position + { + get {Vector3 v; sfMusic_GetPosition(This, out v.X, out v.Y, out v.Z); return v;} + set {sfMusic_SetPosition(This, value.X, value.Y, value.Z);} + } + + //////////////////////////////////////////////////////////// + /// + /// Minimum distance of the music. Closer than this distance, + /// the listener will hear the sound at its maximum volume. + /// The default value is 1 + /// + //////////////////////////////////////////////////////////// + public float MinDistance + { + get {return sfMusic_GetMinDistance(This);} + set {sfMusic_SetMinDistance(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Attenuation factor. The higher the attenuation, the + /// more the sound will be attenuated with distance from listener. + /// The default value is 1 + /// + //////////////////////////////////////////////////////////// + public float Attenuation + { + get {return sfMusic_GetAttenuation(This);} + set {sfMusic_SetAttenuation(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Current playing position, in seconds + /// + //////////////////////////////////////////////////////////// + public float PlayingOffset + { + get {return sfMusic_GetPlayingOffset(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfMusic_Destroy(This); + } + + #region Imports + [DllImport("csfml-audio")] + static extern IntPtr sfMusic_CreateFromFile(string Filename); + + [DllImport("csfml-audio")] + unsafe static extern IntPtr sfMusic_CreateFromMemory(char* Data, uint SizeInBytes); + + [DllImport("csfml-audio")] + static extern void sfMusic_Destroy(IntPtr MusicStream); + + [DllImport("csfml-audio")] + static extern void sfMusic_Play(IntPtr Music); + + [DllImport("csfml-audio")] + static extern void sfMusic_Pause(IntPtr Music); + + [DllImport("csfml-audio")] + static extern void sfMusic_Stop(IntPtr Music); + + [DllImport("csfml-audio")] + static extern SoundStatus sfMusic_GetStatus(IntPtr Music); + + [DllImport("csfml-audio")] + static extern float sfMusic_GetDuration(IntPtr Music); + + [DllImport("csfml-audio")] + static extern uint sfMusic_GetChannelsCount(IntPtr Music); + + [DllImport("csfml-audio")] + static extern uint sfMusic_GetSampleRate(IntPtr Music); + + [DllImport("csfml-audio")] + static extern void sfMusic_SetPitch(IntPtr Music, float Pitch); + + [DllImport("csfml-audio")] + static extern void sfMusic_SetLoop(IntPtr Music, bool Loop); + + [DllImport("csfml-audio")] + static extern void sfMusic_SetVolume(IntPtr Music, float Volume); + + [DllImport("csfml-audio")] + static extern void sfMusic_SetPosition(IntPtr Music, float X, float Y, float Z); + + [DllImport("csfml-audio")] + static extern void sfMusic_SetMinDistance(IntPtr Music, float MinDistance); + + [DllImport("csfml-audio")] + static extern void sfMusic_SetAttenuation(IntPtr Music, float Attenuation); + + [DllImport("csfml-audio")] + static extern bool sfMusic_GetLoop(IntPtr Music); + + [DllImport("csfml-audio")] + static extern float sfMusic_GetPitch(IntPtr Music); + + [DllImport("csfml-audio")] + static extern float sfMusic_GetVolume(IntPtr Music); + + [DllImport("csfml-audio")] + static extern void sfMusic_GetPosition(IntPtr Music, out float X, out float Y, out float Z); + + [DllImport("csfml-audio")] + static extern float sfMusic_GetMinDistance(IntPtr Music); + + [DllImport("csfml-audio")] + static extern float sfMusic_GetAttenuation(IntPtr Music); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfMusic_GetPlayingOffset(IntPtr Music); + #endregion + } + } +} diff --git a/dotnet/src/Audio/Sound.cs b/dotnet/src/Audio/Sound.cs new file mode 100644 index 00000000..d6d499ed --- /dev/null +++ b/dotnet/src/Audio/Sound.cs @@ -0,0 +1,270 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// Enumeration of all possible sound states + /// + //////////////////////////////////////////////////////////// + public enum SoundStatus + { + /// Sound is not playing + Stopped, + + /// Sound is paused + Paused, + + /// Sound is playing + Playing + } + + //////////////////////////////////////////////////////////// + /// + /// Sound defines the properties of a sound such as position, + /// volume, pitch, etc. + /// + //////////////////////////////////////////////////////////// + public class Sound : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor (invalid sound) + /// + //////////////////////////////////////////////////////////// + public Sound() : + base(sfSound_Create()) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the sound from a source buffer + /// + /// Sound buffer to play + //////////////////////////////////////////////////////////// + public Sound(SoundBuffer buffer) : + base(sfSound_Create()) + { + SoundBuffer = buffer; + } + + //////////////////////////////////////////////////////////// + /// + /// Play the sound + /// + //////////////////////////////////////////////////////////// + public void Play() + { + sfSound_Play(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Pause the sound + /// + //////////////////////////////////////////////////////////// + public void Pause() + { + sfSound_Pause(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Stop the sound + /// + //////////////////////////////////////////////////////////// + public void Stop() + { + sfSound_Stop(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Buffer containing the sound data to play through the sound + /// + //////////////////////////////////////////////////////////// + public SoundBuffer SoundBuffer + { + get {return myBuffer;} + set {myBuffer = value; sfSound_SetBuffer(This, value != null ? value.This : IntPtr.Zero);} + } + + //////////////////////////////////////////////////////////// + /// + /// Current status of the sound (see SoundStatus enum) + /// + //////////////////////////////////////////////////////////// + public SoundStatus Status + { + get {return sfSound_GetStatus(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Loop state of the sound. Default value is false + /// + //////////////////////////////////////////////////////////// + public bool Loop + { + get {return sfSound_GetLoop(This);} + set {sfSound_SetLoop(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Pitch of the sound. Default value is 1 + /// + //////////////////////////////////////////////////////////// + public float Pitch + { + get {return sfSound_GetPitch(This);} + set {sfSound_SetPitch(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Volume of the sound, in range [0, 100]. Default value is 100 + /// + //////////////////////////////////////////////////////////// + public float Volume + { + get {return sfSound_GetVolume(This);} + set {sfSound_SetVolume(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Current playing position of the sound, in seconds + /// + //////////////////////////////////////////////////////////// + public float PlayingOffset + { + get {return sfSound_GetPlayingOffset(This);} + set {sfSound_SetPlayingOffset(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// 3D position of the sound. Default value is (0, 0, 0) + /// + //////////////////////////////////////////////////////////// + public Vector3 Position + { + get {Vector3 v; sfSound_GetPosition(This, out v.X, out v.Y, out v.Z); return v;} + set {sfSound_SetPosition(This, value.X, value.Y, value.Z);} + } + + //////////////////////////////////////////////////////////// + /// + /// Minimum distance of the sound. Closer than this distance, + /// the listener will hear the sound at its maximum volume. + /// The default value is 1 + /// + //////////////////////////////////////////////////////////// + public float MinDistance + { + get {return sfSound_GetMinDistance(This);} + set {sfSound_SetMinDistance(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Attenuation factor. The higher the attenuation, the + /// more the sound will be attenuated with distance from listener. + /// The default value is 1 + /// + //////////////////////////////////////////////////////////// + public float Attenuation + { + get {return sfSound_GetAttenuation(This);} + set {sfSound_SetAttenuation(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfSound_Destroy(This); + } + + private SoundBuffer myBuffer; + + #region Imports + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfSound_Create(); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_Destroy(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_Play(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_Pause(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_Stop(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetBuffer(IntPtr Sound, IntPtr Buffer); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfSound_GetBuffer(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetLoop(IntPtr Sound, bool Loop); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern bool sfSound_GetLoop(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern SoundStatus sfSound_GetStatus(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetPitch(IntPtr Sound, float Pitch); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetVolume(IntPtr Sound, float Volume); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetPosition(IntPtr Sound, float X, float Y, float Z); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetMinDistance(IntPtr Sound, float MinDistance); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetAttenuation(IntPtr Sound, float Attenuation); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_SetPlayingOffset(IntPtr Sound, float TimeOffset); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSound_GetPitch(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSound_GetVolume(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSound_GetPosition(IntPtr Sound, out float X, out float Y, out float Z); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSound_GetMinDistance(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSound_GetAttenuation(IntPtr Sound); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSound_GetPlayingOffset(IntPtr Sound); + #endregion + } + } +} diff --git a/dotnet/src/Audio/SoundBuffer.cs b/dotnet/src/Audio/SoundBuffer.cs new file mode 100644 index 00000000..12513f70 --- /dev/null +++ b/dotnet/src/Audio/SoundBuffer.cs @@ -0,0 +1,181 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.IO; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// SoundBuffer is the low-level class for loading and manipulating + /// sound buffers. A sound buffer holds audio data (samples) + /// which can then be played by a Sound or saved to a file. + /// + //////////////////////////////////////////////////////////// + public class SoundBuffer : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Construct the sound buffer from a file + /// + /// Path of the sound file to load + /// + //////////////////////////////////////////////////////////// + public SoundBuffer(string filename) : + base(sfSoundBuffer_CreateFromFile(filename)) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("sound buffer", filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the sound buffer from a file in a stream + /// + /// Stream containing the file contents + //////////////////////////////////////////////////////////// + public SoundBuffer(Stream stream) : + base(IntPtr.Zero) + { + stream.Position = 0; + byte[] StreamData = new byte[stream.Length]; + uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); + unsafe + { + fixed (byte* dataPtr = StreamData) + { + SetThis(sfSoundBuffer_CreateFromMemory((char*)dataPtr, Read)); + } + } + if (This == IntPtr.Zero) + throw new LoadingFailedException("sound buffer"); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the sound buffer from an array of samples + /// + /// Array of samples + /// Channels count + /// Sample rate + /// + //////////////////////////////////////////////////////////// + public SoundBuffer(short[] samples, uint channelsCount, uint sampleRate) : + base(IntPtr.Zero) + { + unsafe + { + fixed (short* SamplesPtr = samples) + { + SetThis(sfSoundBuffer_CreateFromSamples(SamplesPtr, (uint)samples.Length, channelsCount, sampleRate)); + } + } + + if (This == IntPtr.Zero) + throw new LoadingFailedException("sound buffer"); + } + + //////////////////////////////////////////////////////////// + /// + /// Save the sound buffer to an audio file + /// + /// Path of the sound file to write + /// True if saving has been successful + //////////////////////////////////////////////////////////// + public bool SaveToFile(string filename) + { + return sfSoundBuffer_SaveToFile(This, filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Samples rate, in samples per second + /// + //////////////////////////////////////////////////////////// + public uint SampleRate + { + get {return sfSoundBuffer_GetSampleRate(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Number of channels (1 = mono, 2 = stereo) + /// + //////////////////////////////////////////////////////////// + public uint ChannelsCount + { + get {return sfSoundBuffer_GetChannelsCount(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Total duration of the buffer, in seconds + /// + //////////////////////////////////////////////////////////// + public float Duration + { + get {return sfSoundBuffer_GetDuration(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Array of samples contained in the buffer + /// + //////////////////////////////////////////////////////////// + public short[] Samples + { + get + { + short[] SamplesArray = new short[sfSoundBuffer_GetSamplesCount(This)]; + Marshal.Copy(sfSoundBuffer_GetSamples(This), SamplesArray, 0, SamplesArray.Length); + return SamplesArray; + } + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfSoundBuffer_Destroy(This); + } + + #region Imports + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfSoundBuffer_CreateFromFile(string Filename); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + unsafe static extern IntPtr sfSoundBuffer_CreateFromMemory(char* Data, uint SizeInBytes); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + unsafe static extern IntPtr sfSoundBuffer_CreateFromSamples(short* Samples, uint SamplesCount, uint ChannelsCount, uint SampleRate); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern void sfSoundBuffer_Destroy(IntPtr SoundBuffer); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern bool sfSoundBuffer_SaveToFile(IntPtr SoundBuffer, string Filename); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfSoundBuffer_GetSamples(IntPtr SoundBuffer); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern uint sfSoundBuffer_GetSamplesCount(IntPtr SoundBuffer); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern uint sfSoundBuffer_GetSampleRate(IntPtr SoundBuffer); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern uint sfSoundBuffer_GetChannelsCount(IntPtr SoundBuffer); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSoundBuffer_GetDuration(IntPtr SoundBuffer); + #endregion + } + } +} diff --git a/dotnet/src/Audio/SoundBufferRecorder.cs b/dotnet/src/Audio/SoundBufferRecorder.cs new file mode 100644 index 00000000..3a3a12b2 --- /dev/null +++ b/dotnet/src/Audio/SoundBufferRecorder.cs @@ -0,0 +1,70 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.Collections.Generic; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// Specialized SoundRecorder which saves the captured + /// audio data into a sound buffer + /// + //////////////////////////////////////////////////////////// + public class SoundBufferRecorder : SoundRecorder + { + //////////////////////////////////////////////////////////// + /// + /// Sound buffer containing the recorded data (invalid until the capture stops) + /// + //////////////////////////////////////////////////////////// + public SoundBuffer SoundBuffer + { + get + { + return mySoundBuffer; + } + } + + //////////////////////////////////////////////////////////// + /// + /// Called when a new capture starts + /// + /// False to abort recording audio data, true to continue + //////////////////////////////////////////////////////////// + protected override bool OnStart() + { + mySamplesArray.Clear(); + return true; + } + + //////////////////////////////////////////////////////////// + /// + /// Process a new chunk of recorded samples + /// + /// Array of samples to process + /// False to stop recording audio data, true to continue + //////////////////////////////////////////////////////////// + protected override bool OnProcessSamples(short[] samples) + { + mySamplesArray.AddRange(samples); + return true; + } + + //////////////////////////////////////////////////////////// + /// + /// Called when the current capture stops + /// + //////////////////////////////////////////////////////////// + protected override void OnStop() + { + mySoundBuffer = new SoundBuffer(mySamplesArray.ToArray(), 1, SampleRate); + } + + List mySamplesArray = new List(); + SoundBuffer mySoundBuffer = null; + } + } +} diff --git a/dotnet/src/Audio/SoundRecorder.cs b/dotnet/src/Audio/SoundRecorder.cs new file mode 100644 index 00000000..3f39c5a5 --- /dev/null +++ b/dotnet/src/Audio/SoundRecorder.cs @@ -0,0 +1,180 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// SoundRecorder is an interface for capturing sound data, + /// it is meant to be used as a base class + /// + //////////////////////////////////////////////////////////// + public abstract class SoundRecorder : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + public SoundRecorder() : + base(IntPtr.Zero) + { + myStartCallback = new StartCallback(OnStart); + myProcessCallback = new ProcessCallback(ProcessSamples); + myStopCallback = new StopCallback(OnStop); + + SetThis(sfSoundRecorder_Create(myStartCallback, myProcessCallback, myStopCallback, IntPtr.Zero)); + } + + //////////////////////////////////////////////////////////// + /// + /// Start the capture using default sample rate (44100 Hz) + /// Warning : only one capture can happen at the same time + /// + //////////////////////////////////////////////////////////// + public void Start() + { + Start(44100); + } + + //////////////////////////////////////////////////////////// + /// + /// Start the capture. + /// Warning : only one capture can happen at the same time + /// + /// Sound frequency; the more samples, the higher the quality (44100 by default = CD quality) + //////////////////////////////////////////////////////////// + public void Start(uint sampleRate) + { + sfSoundRecorder_Start(This, sampleRate); + } + + //////////////////////////////////////////////////////////// + /// + /// Stop the capture + /// + //////////////////////////////////////////////////////////// + public void Stop() + { + sfSoundRecorder_Stop(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Sample rate of the recorder, in samples per second + /// + //////////////////////////////////////////////////////////// + public uint SampleRate + { + get {return sfSoundRecorder_GetSampleRate(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Tell if the system supports sound capture. + /// If not, this class won't be usable + /// + //////////////////////////////////////////////////////////// + public static bool CanCapture + { + get {return sfSoundRecorder_CanCapture();} + } + + //////////////////////////////////////////////////////////// + /// + /// Called when a new capture starts + /// + /// False to abort recording audio data, true to continue + //////////////////////////////////////////////////////////// + protected virtual bool OnStart() + { + // Does nothing by default + return true; + } + + //////////////////////////////////////////////////////////// + /// + /// Process a new chunk of recorded samples + /// + /// Array of samples to process + /// False to stop recording audio data, true to continue + //////////////////////////////////////////////////////////// + protected abstract bool OnProcessSamples(short[] samples); + + //////////////////////////////////////////////////////////// + /// + /// Called when the current capture stops + /// + //////////////////////////////////////////////////////////// + protected virtual void OnStop() + { + // Does nothing by default + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfSoundRecorder_Destroy(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Function called directly by the C library ; convert + /// arguments and forward them to the internal virtual function + /// + /// Pointer to the array of samples + /// Number of samples in the array + /// User data -- unused + /// False to stop recording audio data, true to continue + //////////////////////////////////////////////////////////// + private bool ProcessSamples(IntPtr samples, uint nbSamples, IntPtr userData) + { + short[] samplesArray = new short[nbSamples]; + Marshal.Copy(samples, samplesArray, 0, samplesArray.Length); + + return OnProcessSamples(samplesArray); + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate bool StartCallback(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate bool ProcessCallback(IntPtr samples, uint nbSamples, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate void StopCallback(); + + private StartCallback myStartCallback; + private ProcessCallback myProcessCallback; + private StopCallback myStopCallback; + + #region Imports + [DllImport("csfml-audio")] + static extern IntPtr sfSoundRecorder_Create(StartCallback OnStart, ProcessCallback OnProcess, StopCallback OnStop, IntPtr UserData); + + [DllImport("csfml-audio")] + static extern void sfSoundRecorder_Destroy(IntPtr SoundRecorder); + + [DllImport("csfml-audio")] + static extern void sfSoundRecorder_Start(IntPtr SoundRecorder, uint SampleRate); + + [DllImport("csfml-audio")] + static extern void sfSoundRecorder_Stop(IntPtr SoundRecorder); + + [DllImport("csfml-audio")] + static extern uint sfSoundRecorder_GetSampleRate(IntPtr SoundRecorder); + + [DllImport("csfml-audio")] + static extern bool sfSoundRecorder_CanCapture(); + #endregion + } + } +} diff --git a/dotnet/src/Audio/SoundStream.cs b/dotnet/src/Audio/SoundStream.cs new file mode 100644 index 00000000..c8d019c3 --- /dev/null +++ b/dotnet/src/Audio/SoundStream.cs @@ -0,0 +1,343 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// SoundStream is a streamed sound, ie. samples are acquired + /// while the sound is playing. Use it for big sounds that would + /// require hundreds of MB in memory (see Music), + /// or for streaming sound from the network + /// + //////////////////////////////////////////////////////////// + public abstract class SoundStream : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + public SoundStream() : + base(IntPtr.Zero) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Play the sound stream + /// + //////////////////////////////////////////////////////////// + public void Play() + { + sfSoundStream_Play(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Pause the sound stream + /// + //////////////////////////////////////////////////////////// + public void Pause() + { + sfSoundStream_Pause(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Stop the sound stream + /// + //////////////////////////////////////////////////////////// + public void Stop() + { + sfSoundStream_Stop(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Samples rate, in samples per second + /// + //////////////////////////////////////////////////////////// + public uint SampleRate + { + get {return sfSoundStream_GetSampleRate(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Number of channels (1 = mono, 2 = stereo) + /// + //////////////////////////////////////////////////////////// + public uint ChannelsCount + { + get {return sfSoundStream_GetChannelsCount(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Current status of the sound stream (see SoundStatus enum) + /// + //////////////////////////////////////////////////////////// + public SoundStatus Status + { + get {return sfSoundStream_GetStatus(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Loop state of the sound stream. Default value is false + /// + //////////////////////////////////////////////////////////// + public bool Loop + { + get {return sfSoundStream_GetLoop(This);} + set {sfSoundStream_SetLoop(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Pitch of the sound stream. Default value is 1 + /// + //////////////////////////////////////////////////////////// + public float Pitch + { + get {return sfSoundStream_GetPitch(This);} + set {sfSoundStream_SetPitch(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Volume of the sound stream, in range [0, 100]. Default value is 100 + /// + //////////////////////////////////////////////////////////// + public float Volume + { + get {return sfSoundStream_GetVolume(This);} + set {sfSoundStream_SetVolume(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// 3D position of the sound stream. Default value is (0, 0, 0) + /// + //////////////////////////////////////////////////////////// + public Vector3 Position + { + get {Vector3 v; sfSoundStream_GetPosition(This, out v.X, out v.Y, out v.Z); return v;} + set {sfSoundStream_SetPosition(This, value.X, value.Y, value.Z);} + } + + //////////////////////////////////////////////////////////// + /// + /// Minimum distance of the sound stream. Closer than this distance, + /// the listener will hear the sound at its maximum volume. + /// The default value is 1 + /// + //////////////////////////////////////////////////////////// + public float MinDistance + { + get {return sfSoundStream_GetMinDistance(This);} + set {sfSoundStream_SetMinDistance(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Attenuation factor. The higher the attenuation, the + /// more the sound will be attenuated with distance from listener. + /// The default value is 1 + /// + //////////////////////////////////////////////////////////// + public float Attenuation + { + get {return sfSoundStream_GetAttenuation(This);} + set {sfSoundStream_SetAttenuation(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Current playing position, in seconds + /// + //////////////////////////////////////////////////////////// + public float PlayingOffset + { + get {return sfSoundStream_GetPlayingOffset(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Set the audio stream parameters, you must call it before Play() + /// + /// Number of channels + /// Sample rate, in samples per second + //////////////////////////////////////////////////////////// + protected void Initialize(uint channelsCount, uint sampleRate) + { + myStartCallback = new StartCallbackType(Start); + myGetDataCallback = new GetDataCallbackType(GetData); + SetThis(sfSoundStream_Create(myStartCallback, myGetDataCallback, channelsCount, sampleRate, IntPtr.Zero)); + } + + //////////////////////////////////////////////////////////// + /// + /// Virtual function called when the stream restarts + /// + /// If false is returned, the playback is aborted + //////////////////////////////////////////////////////////// + protected virtual bool OnStart() + { + // Does nothing by default + return true; + } + + //////////////////////////////////////////////////////////// + /// + /// Virtual function called each time new audio data is needed to feed the stream + /// + /// Array of samples to fill for the stream + /// True to continue playback, false to stop + //////////////////////////////////////////////////////////// + protected abstract bool OnGetData(out short[] samples); + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfSoundStream_Destroy(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Structure mapping the C library arguments passed to the data callback + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + private struct Chunk + { + unsafe public short* samplesPtr; + public uint samplesCount; + } + + //////////////////////////////////////////////////////////// + /// + /// Called when the stream restarts + /// + /// User data -- unused + /// If false is returned, the playback is aborted + //////////////////////////////////////////////////////////// + private bool Start(IntPtr userData) + { + return OnStart(); + } + + //////////////////////////////////////////////////////////// + /// + /// Called each time new audio data is needed to feed the stream + /// + /// Data chunk to fill with new audio samples + /// User data -- unused + /// True to continue playback, false to stop + //////////////////////////////////////////////////////////// + private bool GetData(ref Chunk dataChunk, IntPtr userData) + { + if (OnGetData(out myTempBuffer)) + { + unsafe + { + fixed (short* samplesPtr = myTempBuffer) + { + dataChunk.samplesPtr = samplesPtr; + dataChunk.samplesCount = (uint)myTempBuffer.Length; + } + } + + return true; + } + else + { + return false; + } + } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate bool StartCallbackType(IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate bool GetDataCallbackType(ref Chunk dataChunk, IntPtr UserData); + + private StartCallbackType myStartCallback; + private GetDataCallbackType myGetDataCallback; + private short[] myTempBuffer; + + #region Imports + [DllImport("csfml-audio")] + static extern IntPtr sfSoundStream_Create(StartCallbackType OnStart, GetDataCallbackType OnGetData, uint ChannelsCount, uint SampleRate, IntPtr UserData); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_Destroy(IntPtr SoundStreamStream); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_Play(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_Pause(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_Stop(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern SoundStatus sfSoundStream_GetStatus(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern uint sfSoundStream_GetChannelsCount(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern uint sfSoundStream_GetSampleRate(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_SetLoop(IntPtr SoundStream, bool Loop); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_SetPitch(IntPtr SoundStream, float Pitch); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_SetVolume(IntPtr SoundStream, float Volume); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_SetPosition(IntPtr SoundStream, float X, float Y, float Z); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_SetMinDistance(IntPtr SoundStream, float MinDistance); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_SetAttenuation(IntPtr SoundStream, float Attenuation); + + [DllImport("csfml-audio")] + static extern bool sfSoundStream_GetLoop(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern float sfSoundStream_GetPitch(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern float sfSoundStream_GetVolume(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern void sfSoundStream_GetPosition(IntPtr SoundStream, out float X, out float Y, out float Z); + + [DllImport("csfml-audio")] + static extern float sfSoundStream_GetMinDistance(IntPtr SoundStream); + + [DllImport("csfml-audio")] + static extern float sfSoundStream_GetAttenuation(IntPtr SoundStream); + + [DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity] + static extern float sfSoundStream_GetPlayingOffset(IntPtr SoundStream); + #endregion + } + } +} \ No newline at end of file diff --git a/dotnet/src/Audio/Vector3.cs b/dotnet/src/Audio/Vector3.cs new file mode 100644 index 00000000..d3895574 --- /dev/null +++ b/dotnet/src/Audio/Vector3.cs @@ -0,0 +1,119 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Audio + { + //////////////////////////////////////////////////////////// + /// + /// Vector3 is an utility class for manipulating 3 dimensional + /// vectors with float components + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct Vector3 + { + //////////////////////////////////////////////////////////// + /// + /// Construct the vector from its coordinates + /// + /// X coordinate + /// Y coordinate + /// Z coordinate + //////////////////////////////////////////////////////////// + public Vector3(float x, float y, float z) + { + X = x; + Y = y; + Z = z; + } + + //////////////////////////////////////////////////////////// + /// + /// Operator - overload ; returns the opposite of a vector + /// + /// Vector to negate + /// -v + //////////////////////////////////////////////////////////// + public static Vector3 operator -(Vector3 v) + { + return new Vector3(-v.X, -v.Y, -v.Z); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator - overload ; subtracts two vectors + /// + /// First vector + /// Second vector + /// v1 - v2 + //////////////////////////////////////////////////////////// + public static Vector3 operator -(Vector3 v1, Vector3 v2) + { + return new Vector3(v1.X - v2.X, v1.Y - v2.X, v1.Z - v2.Z); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator + overload ; add two vectors + /// + /// First vector + /// Second vector + /// v1 + v2 + //////////////////////////////////////////////////////////// + public static Vector3 operator +(Vector3 v1, Vector3 v2) + { + return new Vector3(v1.X + v2.X, v1.Y + v2.X, v1.Z + v2.Z); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator * overload ; multiply a vector by a scalar value + /// + /// Vector + /// Scalar value + /// v * x + //////////////////////////////////////////////////////////// + public static Vector3 operator *(Vector3 v, float x) + { + return new Vector3(v.X * x, v.Y * x, v.Z * x); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator * overload ; multiply a scalar value by a vector + /// + /// Scalar value + /// Vector + /// x * v + //////////////////////////////////////////////////////////// + public static Vector3 operator *(float x, Vector3 v) + { + return new Vector3(v.X * x, v.Y * x, v.Z * x); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator / overload ; divide a vector by a scalar value + /// + /// Vector + /// Scalar value + /// v / x + //////////////////////////////////////////////////////////// + public static Vector3 operator /(Vector3 v, float x) + { + return new Vector3(v.X / x, v.Y / x, v.Z / x); + } + + /// X (horizontal) component of the vector + public float X; + + /// Y (vertical) component of the vector + public float Y; + + /// Z (depth) component of the vector + public float Z; + } + } +} diff --git a/dotnet/src/Audio/sfml-audio.csproj b/dotnet/src/Audio/sfml-audio.csproj new file mode 100644 index 00000000..d5b29bd9 --- /dev/null +++ b/dotnet/src/Audio/sfml-audio.csproj @@ -0,0 +1,64 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {0B202C4D-A457-47FE-84A3-031DD878C6BE} + Library + Properties + SFML.Audio + sfmlnet-audio + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + bin\audio-doc.xml + + + pdbonly + true + ..\..\lib\ + TRACE + prompt + 4 + true + bin\audio-doc.xml + + + + + + + + + + + + + + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + \ No newline at end of file diff --git a/dotnet/src/Graphics/Color.cs b/dotnet/src/Graphics/Color.cs new file mode 100644 index 00000000..2ba0a170 --- /dev/null +++ b/dotnet/src/Graphics/Color.cs @@ -0,0 +1,95 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Utility class for manipulating 32-bits RGBA colors + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct Color + { + //////////////////////////////////////////////////////////// + /// + /// Construct the color from its red, green and blue components + /// + /// Red component + /// Green component + /// Blue component + //////////////////////////////////////////////////////////// + public Color(byte red, byte green, byte blue) : + this(red, green, blue, 255) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the color from its red, green, blue and alpha components + /// + /// Red component + /// Green component + /// Blue component + /// Alpha (transparency) component + //////////////////////////////////////////////////////////// + public Color(byte red, byte green, byte blue, byte alpha) + { + R = red; + G = green; + B = blue; + A = alpha; + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the color from another + /// + /// Color to copy + //////////////////////////////////////////////////////////// + public Color(Color color) : + this(color.R, color.G, color.B, color.A) + { + } + + /// Red component of the color + public byte R; + + /// Green component of the color + public byte G; + + /// Blue component of the color + public byte B; + + /// Alpha (transparent) component of the color + public byte A; + + + /// Predefined black color + public static readonly Color Black = new Color(0, 0, 0); + + /// Predefined white color + public static readonly Color White = new Color(255, 255, 255); + + /// Predefined red color + public static readonly Color Red = new Color(255, 0, 0); + + /// Predefined green color + public static readonly Color Green = new Color(0, 255, 0); + + /// Predefined blue color + public static readonly Color Blue = new Color(0, 0, 255); + + /// Predefined yellow color + public static readonly Color Yellow = new Color(255, 255, 0); + + /// Predefined magenta color + public static readonly Color Magenta = new Color(255, 0, 255); + + /// Predefined cyan color + public static readonly Color Cyan = new Color(0, 255, 255); + } + } +} diff --git a/dotnet/src/Graphics/Context.cs b/dotnet/src/Graphics/Context.cs new file mode 100644 index 00000000..2bb5889d --- /dev/null +++ b/dotnet/src/Graphics/Context.cs @@ -0,0 +1,80 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.Runtime.ConstrainedExecution; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// This class defines + /// + //////////////////////////////////////////////////////////// + internal class Context : CriticalFinalizerObject + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + public Context() + { + myThis = sfContext_Create(); + } + + //////////////////////////////////////////////////////////// + /// + /// Finalizer + /// + //////////////////////////////////////////////////////////// + ~Context() + { + sfContext_Destroy(myThis); + } + + //////////////////////////////////////////////////////////// + /// + /// Activate or deactivate the context + /// + /// True to activate, false to deactivate + //////////////////////////////////////////////////////////// + public void SetActive(bool active) + { + sfContext_SetActive(myThis, active); + } + + //////////////////////////////////////////////////////////// + /// + /// Global helper context + /// + //////////////////////////////////////////////////////////// + public static Context Global + { + get + { + if (ourGlobalContext == null) + ourGlobalContext = new Context(); + + return ourGlobalContext; + } + } + + private static Context ourGlobalContext = null; + + private IntPtr myThis = IntPtr.Zero; + + #region Imports + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfContext_Create(); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfContext_Destroy(IntPtr View); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfContext_SetActive(IntPtr View, bool Active); + #endregion + } + } +} diff --git a/dotnet/src/Graphics/Drawable.cs b/dotnet/src/Graphics/Drawable.cs new file mode 100644 index 00000000..7b976d52 --- /dev/null +++ b/dotnet/src/Graphics/Drawable.cs @@ -0,0 +1,119 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Enumerate the blending modes available for drawable objects + /// + //////////////////////////////////////////////////////////// + public enum BlendMode + { + /// Pixel = Src * a + Dest * (1 - a) + Alpha, + + /// Pixel = Src + Dest + Add, + + /// Pixel = Src * Dest + Multiply, + + /// No blending + None + } + + //////////////////////////////////////////////////////////// + /// + /// Abstract base class for every object that can be drawn + /// into a render window + /// + //////////////////////////////////////////////////////////// + public abstract class Drawable : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Position of the object on screen + /// + //////////////////////////////////////////////////////////// + public abstract Vector2 Position {get; set;} + + //////////////////////////////////////////////////////////// + /// + /// Rotation of the object, defined in degrees + /// + //////////////////////////////////////////////////////////// + public abstract float Rotation {get; set;} + + //////////////////////////////////////////////////////////// + /// + /// Vertical and horizontal scale of the object + /// + //////////////////////////////////////////////////////////// + public abstract Vector2 Scale {get; set;} + + //////////////////////////////////////////////////////////// + /// + /// Center of the transformation of the object + /// (center of translation, rotation and scale) + /// + //////////////////////////////////////////////////////////// + public abstract Vector2 Center {get; set;} + + //////////////////////////////////////////////////////////// + /// + /// Global color of the object + /// + //////////////////////////////////////////////////////////// + public abstract Color Color {get; set;} + + //////////////////////////////////////////////////////////// + /// + /// Blending mode of the object + /// + //////////////////////////////////////////////////////////// + public abstract BlendMode BlendMode {get; set;} + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from global coordinates into local coordinates + /// (ie it applies the inverse of object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public abstract Vector2 TransformToLocal(Vector2 point); + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from local coordinates into global coordinates + /// (ie it applies the object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public abstract Vector2 TransformToGlobal(Vector2 point); + + //////////////////////////////////////////////////////////// + /// + /// Render the object into the given render window + /// + /// Target window + //////////////////////////////////////////////////////////// + internal abstract void Render(RenderWindow window); + + //////////////////////////////////////////////////////////// + /// + /// Internal constructor, for derived classes + /// + /// Pointer to the object in C library + //////////////////////////////////////////////////////////// + protected Drawable(IntPtr thisPtr) : + base(thisPtr) + { + } + } + } +} diff --git a/dotnet/src/Graphics/Font.cs b/dotnet/src/Graphics/Font.cs new file mode 100644 index 00000000..aba5a3b1 --- /dev/null +++ b/dotnet/src/Graphics/Font.cs @@ -0,0 +1,210 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.IO; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Font is the low-level class for loading and + /// manipulating character fonts. This class is meant to + /// be used by String2D + /// + //////////////////////////////////////////////////////////// + public class Font : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Construct the font from a file + /// + /// Font file to load + /// + //////////////////////////////////////////////////////////// + public Font(string filename) : + this(filename, 30) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the font from a file, using custom size + /// + /// Font file to load + /// Character size + /// + //////////////////////////////////////////////////////////// + public Font(string filename, uint charSize) : + this(filename, charSize, "") + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the font from a file, using custom size and characters set + /// + /// Font file to load + /// Character size + /// Set of characters to generate + /// + //////////////////////////////////////////////////////////// + public Font(string filename, uint charSize, string charset) : + base(IntPtr.Zero) + { + unsafe + { + IntPtr ptr; + int size; + if (Int32.TryParse(charset, out size)) + ptr = new IntPtr(&size); + else + ptr = IntPtr.Zero; + + SetThis(sfFont_CreateFromFile(filename, charSize, ptr)); + } + + if (This == IntPtr.Zero) + throw new LoadingFailedException("font", filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the font from a file in a stream + /// + /// Stream containing the file contents + /// + //////////////////////////////////////////////////////////// + public Font(Stream stream) : + this(stream, 30) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the font from a file in a stream, using custom size + /// + /// Stream containing the file contents + /// Character size + /// + //////////////////////////////////////////////////////////// + public Font(Stream stream, uint charSize) : + this(stream, charSize, "") + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the font from a file in a stream + /// + /// Stream containing the file contents + /// Character size + /// Set of characters to generate + /// + //////////////////////////////////////////////////////////// + public Font(Stream stream, uint charSize, string charset) : + base(IntPtr.Zero) + { + unsafe + { + IntPtr ptr; + int size; + if (Int32.TryParse(charset, out size)) + ptr = new IntPtr(&size); + else + ptr = IntPtr.Zero; + + stream.Position = 0; + byte[] StreamData = new byte[stream.Length]; + uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); + fixed (byte* dataPtr = StreamData) + { + SetThis(sfFont_CreateFromMemory((char*)dataPtr, Read, charSize, ptr)); + } + } + if (This == IntPtr.Zero) + throw new LoadingFailedException("font"); + } + + //////////////////////////////////////////////////////////// + /// + /// Base character size + /// + //////////////////////////////////////////////////////////// + public uint CharacterSize + { + get { return sfFont_GetCharacterSize(This); } + } + + //////////////////////////////////////////////////////////// + /// + /// Default built-in font + /// + //////////////////////////////////////////////////////////// + public static Font DefaultFont + { + get + { + if (ourDefaultFont == null) + ourDefaultFont = new Font(sfFont_GetDefaultFont()); + + return ourDefaultFont; + } + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + if (this != ourDefaultFont) + { + if (!disposing) + Context.Global.SetActive(true); + + sfFont_Destroy(This); + + if (!disposing) + Context.Global.SetActive(false); + } + } + + //////////////////////////////////////////////////////////// + /// + /// Internal constructor + /// + /// Pointer to the object in C library + //////////////////////////////////////////////////////////// + private Font(IntPtr thisPtr) : + base(thisPtr) + { + } + + private static Font ourDefaultFont = null; + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfFont_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfFont_CreateFromFile(string Filename, uint CharSize, IntPtr Charset); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + unsafe static extern IntPtr sfFont_CreateFromMemory(char* Data, uint SizeInBytes, uint CharSize, IntPtr Charset); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfFont_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern uint sfFont_GetCharacterSize(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfFont_GetDefaultFont(); + #endregion + } + } +} diff --git a/dotnet/src/Graphics/Image.cs b/dotnet/src/Graphics/Image.cs new file mode 100644 index 00000000..be66c282 --- /dev/null +++ b/dotnet/src/Graphics/Image.cs @@ -0,0 +1,385 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.IO; +using System.Runtime.ConstrainedExecution; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Image is the low-level class for loading and + /// manipulating images + /// + //////////////////////////////////////////////////////////// + public class Image : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor (invalid image) + /// + /// + //////////////////////////////////////////////////////////// + public Image() : + base(sfImage_Create()) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("image"); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the image with black color + /// + /// Image width + /// Image height + /// + //////////////////////////////////////////////////////////// + public Image(uint width, uint height) : + this(width, height, Color.Black) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the image from a single color + /// + /// Image width + /// Image height + /// Color to fill the image with + /// + //////////////////////////////////////////////////////////// + public Image(uint width, uint height, Color color) : + base(sfImage_CreateFromColor(width, height, color)) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("image"); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the image from a file + /// + /// Path of the image file to load + /// + //////////////////////////////////////////////////////////// + public Image(string filename) : + base(sfImage_CreateFromFile(filename)) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("image", filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the image from a file in a stream + /// + /// Stream containing the file contents + /// + //////////////////////////////////////////////////////////// + public Image(Stream stream) : + base(IntPtr.Zero) + { + stream.Position = 0; + byte[] StreamData = new byte[stream.Length]; + uint Read = (uint)stream.Read(StreamData, 0, StreamData.Length); + unsafe + { + fixed (byte* dataPtr = StreamData) + { + SetThis(sfImage_CreateFromMemory((char*)dataPtr, Read)); + } + } + if (This == IntPtr.Zero) + throw new LoadingFailedException("image"); + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the image directly from an array of pixels + /// + /// 2 dimensions array containing the pixels + /// + //////////////////////////////////////////////////////////// + public Image(Color[,] pixels) : + base(IntPtr.Zero) + { + unsafe + { + fixed (Color* PixelsPtr = pixels) + { + uint Width = (uint)pixels.GetLength(0); + uint Height = (uint)pixels.GetLength(1); + SetThis(sfImage_CreateFromPixels(Width, Height, PixelsPtr)); + } + } + + if (This == IntPtr.Zero) + throw new LoadingFailedException("image"); + } + + //////////////////////////////////////////////////////////// + /// + /// Save the contents of the image to a file + /// + /// Path of the file to save (overwritten if already exist) + /// True if saving was successful + //////////////////////////////////////////////////////////// + public bool SaveToFile(string filename) + { + return sfImage_SaveToFile(This, filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a transparency mask from a specified colorkey + /// + /// Color to become transparent + //////////////////////////////////////////////////////////// + public void CreateMaskFromColor(Color color) + { + CreateMaskFromColor(color, 0); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a transparency mask from a specified colorkey + /// + /// Color to become transparent + /// Alpha value to use for transparent pixels + //////////////////////////////////////////////////////////// + public void CreateMaskFromColor(Color color, byte alpha) + { + sfImage_CreateMaskFromColor(This, color, alpha); + } + + //////////////////////////////////////////////////////////// + /// + /// Copy pixels from another image onto this one. + /// This function does a slow pixel copy and should only + /// be used at initialization time + /// + /// Source image to copy + /// X coordinate of the destination position + /// Y coordinate of the destination position + //////////////////////////////////////////////////////////// + public void Copy(Image source, uint destX, uint destY) + { + sfImage_Copy(This, source.This, destX, destY, new IntRect(0, 0, 0, 0)); + } + + //////////////////////////////////////////////////////////// + /// + /// Copy pixels from another image onto this one. + /// This function does a slow pixel copy and should only + /// be used at initialization time + /// + /// Source image to copy + /// X coordinate of the destination position + /// Y coordinate of the destination position + /// Sub-rectangle of the source image to copy + //////////////////////////////////////////////////////////// + public void Copy(Image source, uint destX, uint destY, IntRect sourceRect) + { + sfImage_Copy(This, source.This, destX, destY, sourceRect); + } + + //////////////////////////////////////////////////////////// + /// + /// Create the image from the current contents of the + /// given window + /// + /// Window to capture + /// True if copy has been successful + //////////////////////////////////////////////////////////// + public bool CopyScreen(RenderWindow window) + { + return CopyScreen(window, new IntRect(0, 0, 0, 0)); + } + + //////////////////////////////////////////////////////////// + /// + /// Create the image from the current contents of the + /// given window + /// + /// Window to capture + /// Sub-rectangle of the screen to copy + /// True if copy has been successful + //////////////////////////////////////////////////////////// + public bool CopyScreen(RenderWindow window, IntRect sourceRect) + { + return sfImage_CopyScreen(This, window.This, sourceRect); + } + + //////////////////////////////////////////////////////////// + /// + /// Get a pixel from the image + /// + /// X coordinate of pixel in the image + /// Y coordinate of pixel in the image + /// Color of pixel (x, y) + //////////////////////////////////////////////////////////// + public Color GetPixel(uint x, uint y) + { + return sfImage_GetPixel(This, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the color of a pixel + /// + /// X coordinate of pixel in the image + /// Y coordinate of pixel in the image + /// New color for pixel (x, y) + //////////////////////////////////////////////////////////// + public void SetPixel(uint x, uint y, Color color) + { + sfImage_SetPixel(This, x, y, color); + } + + //////////////////////////////////////////////////////////// + /// + /// Get a copy of the array of pixels (RGBA 8 bits integers components) + /// Array size is Width x Height x 4 + /// + /// Array of pixels + //////////////////////////////////////////////////////////// + public byte[] Pixels + { + get + { + byte[] PixelsPtr = new byte[Width * Height * 4]; + Marshal.Copy(sfImage_GetPixelsPtr(This), PixelsPtr, 0, PixelsPtr.Length); + return PixelsPtr; + } + } + + //////////////////////////////////////////////////////////// + /// + /// Bind the image for rendering + /// + //////////////////////////////////////////////////////////// + public void Bind() + { + sfImage_Bind(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Control the smooth filter + /// + //////////////////////////////////////////////////////////// + public bool Smooth + { + get {return sfImage_IsSmooth(This);} + set {sfImage_SetSmooth(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the image, in pixels + /// + //////////////////////////////////////////////////////////// + public uint Width + { + get {return sfImage_GetWidth(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Height of the image, in pixels + /// + //////////////////////////////////////////////////////////// + public uint Height + { + get {return sfImage_GetHeight(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Internal constructor + /// + /// Pointer to the object in C library + //////////////////////////////////////////////////////////// + internal Image(IntPtr thisPtr) : + base(thisPtr) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + if (!disposing) + Context.Global.SetActive(true); + + sfImage_Destroy(This); + + if (!disposing) + Context.Global.SetActive(false); + } + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfImage_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfImage_CreateFromColor(uint Width, uint Height, Color Col); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + unsafe static extern IntPtr sfImage_CreateFromPixels(uint Width, uint Height, Color* Pixels); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfImage_CreateFromFile(string Filename); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + unsafe static extern IntPtr sfImage_CreateFromMemory(char* Data, uint Size); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfImage_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfImage_SaveToFile(IntPtr This, string Filename); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfImage_CreateMaskFromColor(IntPtr This, Color Col, byte Alpha); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfImage_CopyScreen(IntPtr This, IntPtr Window, IntRect SourceRect); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfImage_Copy(IntPtr This, IntPtr Source, uint DestX, uint DestY, IntRect SourceRect); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfImage_SetPixel(IntPtr This, uint X, uint Y, Color Col); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfImage_GetPixel(IntPtr This, uint X, uint Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfImage_GetPixelsPtr(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfImage_Bind(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfImage_SetSmooth(IntPtr This, bool Smooth); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern uint sfImage_GetWidth(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern uint sfImage_GetHeight(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfImage_IsSmooth(IntPtr This); + #endregion + } + } +} diff --git a/dotnet/src/Graphics/PostFx.cs b/dotnet/src/Graphics/PostFx.cs new file mode 100644 index 00000000..41c41d20 --- /dev/null +++ b/dotnet/src/Graphics/PostFx.cs @@ -0,0 +1,193 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; +using System.Collections.Generic; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// PostFX is used to apply a post effect to a window + /// + //////////////////////////////////////////////////////////// + public class PostFx : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor (invalid effect) + /// + /// + //////////////////////////////////////////////////////////// + public PostFx() : + base(sfPostFx_Create()) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("post-fx"); + } + + //////////////////////////////////////////////////////////// + /// + /// Load the effect from a file + /// + /// Path of the effect file to load + /// + //////////////////////////////////////////////////////////// + public PostFx(string filename) : + base(sfPostFX_CreateFromFile(filename)) + { + if (This == IntPtr.Zero) + throw new LoadingFailedException("post-fx", filename); + } + + //////////////////////////////////////////////////////////// + /// + /// Load the effect from a text in memory + /// + /// String containing the effect code + /// + //////////////////////////////////////////////////////////// + void LoadFromString(string effect) + { + SetThis(sfPostFX_CreateFromMemory(effect)); + + if (This == IntPtr.Zero) + throw new LoadingFailedException("post-fx"); + } + + //////////////////////////////////////////////////////////// + /// + /// Change a 1-component parameter of the effect + /// + /// Name of the parameter in the effect + /// Value of the parameter + //////////////////////////////////////////////////////////// + public void SetParameter(string name, float x) + { + sfPostFX_SetParameter1(This, name, x); + } + + //////////////////////////////////////////////////////////// + /// + /// Change a 2-component parameter of the effect + /// + /// Name of the parameter in the effect + /// X component of the value + /// Y component of the value + //////////////////////////////////////////////////////////// + public void SetParameter(string name, float x, float y) + { + sfPostFX_SetParameter2(This, name, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change a 3-component parameter of the effect + /// + /// Name of the parameter in the effect + /// X component of the value + /// Y component of the value + /// Z component of the value + //////////////////////////////////////////////////////////// + public void SetParameter(string name, float x, float y, float z) + { + sfPostFX_SetParameter3(This, name, x, y, z); + } + + //////////////////////////////////////////////////////////// + /// + /// Change a 4-component parameter of the effect + /// + /// Name of the parameter in the effect + /// X component of the value + /// Y component of the value + /// Z component of the value + /// W component of the value + //////////////////////////////////////////////////////////// + public void SetParameter(string name, float x, float y, float z, float w) + { + sfPostFX_SetParameter4(This, name, x, y, z, w); + } + + //////////////////////////////////////////////////////////// + /// + /// Set a texture parameter + /// + /// Name of the texture in the effect + /// Image to set (pass null to use the contents of the screen) + //////////////////////////////////////////////////////////// + public void SetTexture(string name, Image texture) + { + myTextures[name] = texture; + sfPostFX_SetTexture(This, name, texture != null ? texture.This : IntPtr.Zero); + } + + //////////////////////////////////////////////////////////// + /// + /// Tell whether or not the system supports post-effects + /// + //////////////////////////////////////////////////////////// + public static bool CanUsePostFX + { + get {return sfPostFX_CanUsePostFX();} + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + if (!disposing) + Context.Global.SetActive(true); + + myTextures.Clear(); + sfPostFX_Destroy(This); + + if (!disposing) + Context.Global.SetActive(false); + } + + Dictionary myTextures = new Dictionary(); + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfPostFx_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFx_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfPostFX_CreateFromFile(string Filename); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfPostFX_CreateFromMemory(string Effect); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFX_Destroy(IntPtr PostFX); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFX_SetParameter1(IntPtr PostFX, string Name, float X); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFX_SetParameter2(IntPtr PostFX, string Name, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFX_SetParameter3(IntPtr PostFX, string Name, float X, float Y, float Z); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFX_SetParameter4(IntPtr PostFX, string Name, float X, float Y, float Z, float W); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfPostFX_SetTexture(IntPtr PostFX, string Name, IntPtr Texture); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfPostFX_CanUsePostFX(); + + #endregion + } + } +} diff --git a/dotnet/src/Graphics/Rect.cs b/dotnet/src/Graphics/Rect.cs new file mode 100644 index 00000000..203e46d0 --- /dev/null +++ b/dotnet/src/Graphics/Rect.cs @@ -0,0 +1,274 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// IntRect is an utility class for manipulating 2D rectangles + /// with integer coordinates + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct IntRect + { + //////////////////////////////////////////////////////////// + /// + /// Construct the rectangle from its coordinates + /// + /// Left coordinate of the rectangle + /// Top coordinate of the rectangle + /// Right coordinate of the rectangle + /// Bottom coordinate of the rectangle + //////////////////////////////////////////////////////////// + public IntRect(int left, int top, int right, int bottom) + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the rectangle + /// + //////////////////////////////////////////////////////////// + public int Width + { + get {return Right - Left;} + } + + //////////////////////////////////////////////////////////// + /// + /// Height of the rectangle + /// + //////////////////////////////////////////////////////////// + public int Height + { + get {return Bottom - Top;} + } + + //////////////////////////////////////////////////////////// + /// + /// Move the whole rectangle by the given offset + /// + /// Horizontal offset + /// Vertical offset + //////////////////////////////////////////////////////////// + public void Offset(int offsetX, int offsetY) + { + Left += offsetX; + Top += offsetY; + Right += offsetX; + Bottom += offsetY; + } + + //////////////////////////////////////////////////////////// + /// + /// Check if a point is inside the rectangle's area + /// + /// X coordinate of the point to test + /// Y coordinate of the point to test + /// True if the point is inside + //////////////////////////////////////////////////////////// + public bool Contains(int x, int y) + { + return (x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom); + } + + //////////////////////////////////////////////////////////// + /// + /// Check intersection between two rectangles + /// + /// Rectangle to test + /// True if rectangles overlap + //////////////////////////////////////////////////////////// + public bool Intersects(IntRect rect) + { + return ((Math.Max(Left, rect.Left) < Math.Min(Right, rect.Right)) && + (Math.Max(Top, rect.Top) < Math.Min(Bottom, rect.Bottom))); + } + + //////////////////////////////////////////////////////////// + /// + /// Check intersection between two rectangles + /// + /// Rectangle to test + /// Rectangle to be filled with overlapping rect + /// True if rectangles overlap + //////////////////////////////////////////////////////////// + public bool Intersects(IntRect rect, out IntRect overlap) + { + IntRect Overlapping = new IntRect(Math.Max(Left, rect.Left), + Math.Max(Top, rect.Top), + Math.Min(Right, rect.Right), + Math.Min(Bottom, rect.Bottom)); + + if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom)) + { + overlap.Left = Overlapping.Left; + overlap.Top = Overlapping.Top; + overlap.Right = Overlapping.Right; + overlap.Bottom = Overlapping.Bottom; + return true; + } + else + { + overlap.Left = 0; + overlap.Top = 0; + overlap.Right = 0; + overlap.Bottom = 0; + return false; + } + } + + /// Left coordinate of the rectangle + public int Left; + + /// Top coordinate of the rectangle + public int Top; + + /// Right coordinate of the rectangle + public int Right; + + /// Bottom coordinate of the rectangle + public int Bottom; + } + + //////////////////////////////////////////////////////////// + /// + /// FloatRect is an utility class for manipulating 2D rectangles + /// with float coordinates + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct FloatRect + { + //////////////////////////////////////////////////////////// + /// + /// Construct the rectangle from its coordinates + /// + /// Left coordinate of the rectangle + /// Top coordinate of the rectangle + /// Right coordinate of the rectangle + /// Bottom coordinate of the rectangle + //////////////////////////////////////////////////////////// + public FloatRect(float left, float top, float right, float bottom) + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the rectangle + /// + //////////////////////////////////////////////////////////// + public float Width + { + get {return Right - Left;} + } + + //////////////////////////////////////////////////////////// + /// + /// Height of the rectangle + /// + //////////////////////////////////////////////////////////// + public float Height + { + get {return Bottom - Top;} + } + + //////////////////////////////////////////////////////////// + /// + /// Move the whole rectangle by the given offset + /// + /// Horizontal offset + /// Vertical offset + //////////////////////////////////////////////////////////// + public void Offset(float offsetX, float offsetY) + { + Left += offsetX; + Top += offsetY; + Right += offsetX; + Bottom += offsetY; + } + + //////////////////////////////////////////////////////////// + /// + /// Check if a point is inside the rectangle's area + /// + /// X coordinate of the point to test + /// Y coordinate of the point to test + /// True if the point is inside + //////////////////////////////////////////////////////////// + public bool Contains(float x, float y) + { + return (x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom); + } + + //////////////////////////////////////////////////////////// + /// + /// Check intersection between two rectangles + /// + /// Rectangle to test + /// True if rectangles overlap + //////////////////////////////////////////////////////////// + public bool Intersects(FloatRect rect) + { + return ((Math.Max(Left, rect.Left) < Math.Min(Right, rect.Right)) && + (Math.Max(Top, rect.Top) < Math.Min(Bottom, rect.Bottom))); + } + + //////////////////////////////////////////////////////////// + /// + /// Check intersection between two rectangles + /// + /// Rectangle to test + /// Rectangle to be filled with overlapping rect + /// True if rectangles overlap + //////////////////////////////////////////////////////////// + public bool Intersects(FloatRect rect, out FloatRect overlap) + { + FloatRect Overlapping = new FloatRect(Math.Max(Left, rect.Left), + Math.Max(Top, rect.Top), + Math.Min(Right, rect.Right), + Math.Min(Bottom, rect.Bottom)); + + if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom)) + { + overlap.Left = Overlapping.Left; + overlap.Top = Overlapping.Top; + overlap.Right = Overlapping.Right; + overlap.Bottom = Overlapping.Bottom; + return true; + } + else + { + overlap.Left = 0; + overlap.Top = 0; + overlap.Right = 0; + overlap.Bottom = 0; + return false; + } + } + + /// Left coordinate of the rectangle + public float Left; + + /// Top coordinate of the rectangle + public float Top; + + /// Right coordinate of the rectangle + public float Right; + + /// Bottom coordinate of the rectangle + public float Bottom; + } + } +} diff --git a/dotnet/src/Graphics/RenderWindow.cs b/dotnet/src/Graphics/RenderWindow.cs new file mode 100644 index 00000000..3b23ee2c --- /dev/null +++ b/dotnet/src/Graphics/RenderWindow.cs @@ -0,0 +1,558 @@ +using System; +using System.Runtime.InteropServices; +using System.Collections; +using System.Collections.Generic; +using System.Security; +using SFML.Window; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Simple wrapper for Window that allows easy + /// 2D rendering + /// + //////////////////////////////////////////////////////////// + public class RenderWindow : SFML.Window.Window + { + //////////////////////////////////////////////////////////// + /// + /// Create the window with default style and creation settings + /// + /// Video mode to use + /// Title of the window + //////////////////////////////////////////////////////////// + public RenderWindow(VideoMode mode, string title) : + this(mode, title, Styles.Resize | Styles.Close, new WindowSettings(24, 8, 0)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window with default creation settings + /// + /// Video mode to use + /// Title of the window + /// Window style (Resize | Close by default) + //////////////////////////////////////////////////////////// + public RenderWindow(VideoMode mode, string title, Styles style) : + this(mode, title, style, new WindowSettings(24, 8, 0)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window + /// + /// Video mode to use + /// Title of the window + /// Window style (Resize | Close by default) + /// Creation parameters + //////////////////////////////////////////////////////////// + public RenderWindow(VideoMode mode, string title, Styles style, WindowSettings settings) : + base(sfRenderWindow_Create(mode, title, style, settings), 0) + { + Initialize(); + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window from an existing control with default creation settings + /// + /// Platform-specific handle of the control + //////////////////////////////////////////////////////////// + public RenderWindow(IntPtr handle) : + this(handle, new WindowSettings(24, 8, 0)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window from an existing control + /// + /// Platform-specific handle of the control + /// Creation parameters + //////////////////////////////////////////////////////////// + public RenderWindow(IntPtr handle, WindowSettings settings) : + base(sfRenderWindow_CreateFromHandle(handle, settings), 0) + { + Initialize(); + } + + //////////////////////////////////////////////////////////// + /// + /// Tell whether or not the window is opened (ie. has been created). + /// Note that a hidden window (Show(false)) + /// will still return true + /// + /// True if the window is opened + //////////////////////////////////////////////////////////// + public override bool IsOpened() + { + return sfRenderWindow_IsOpened(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Close (destroy) the window. + /// The Window instance remains valid and you can call + /// Create to recreate the window + /// + //////////////////////////////////////////////////////////// + public override void Close() + { + sfRenderWindow_Close(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Display the window on screen + /// + //////////////////////////////////////////////////////////// + public override void Display() + { + sfRenderWindow_Display(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the rendering region of the window + /// + //////////////////////////////////////////////////////////// + public override uint Width + { + get {return sfRenderWindow_GetWidth(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Height of the rendering region of the window + /// + //////////////////////////////////////////////////////////// + public override uint Height + { + get {return sfRenderWindow_GetHeight(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Creation settings of the window + /// + //////////////////////////////////////////////////////////// + public override WindowSettings Settings + { + get {return sfRenderWindow_GetSettings(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Enable / disable vertical synchronization + /// + /// True to enable v-sync, false to deactivate + //////////////////////////////////////////////////////////// + public override void UseVerticalSync(bool enable) + { + sfRenderWindow_UseVerticalSync(This, enable); + } + + //////////////////////////////////////////////////////////// + /// + /// Show or hide the mouse cursor + /// + /// True to show, false to hide + //////////////////////////////////////////////////////////// + public override void ShowMouseCursor(bool show) + { + sfRenderWindow_ShowMouseCursor(This, show); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the position of the mouse cursor + /// + /// Left coordinate of the cursor, relative to the window + /// Top coordinate of the cursor, relative to the window + //////////////////////////////////////////////////////////// + public override void SetCursorPosition(uint x, uint y) + { + sfRenderWindow_SetCursorPosition(This, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the position of the window on screen. + /// Only works for top-level windows + /// + /// Left position + /// Top position + //////////////////////////////////////////////////////////// + public override void SetPosition(int x, int y) + { + sfRenderWindow_SetPosition(This, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the size of the rendering region of the window + /// + /// New width + /// New height + //////////////////////////////////////////////////////////// + public override void SetSize(uint width, uint height) + { + sfRenderWindow_SetSize(This, width, height); + } + + //////////////////////////////////////////////////////////// + /// + /// Show or hide the window + /// + /// True to show, false to hide + //////////////////////////////////////////////////////////// + public override void Show(bool show) + { + sfRenderWindow_Show(This, show); + } + + //////////////////////////////////////////////////////////// + /// + /// Enable or disable automatic key-repeat. + /// Automatic key-repeat is enabled by default + /// + /// True to enable, false to disable + //////////////////////////////////////////////////////////// + public override void EnableKeyRepeat(bool enable) + { + sfRenderWindow_EnableKeyRepeat(This, enable); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the window's icon + /// + /// Icon's width, in pixels + /// Icon's height, in pixels + /// Array of pixels, format must be RGBA 32 bits + //////////////////////////////////////////////////////////// + public override void SetIcon(uint width, uint height, byte[] pixels) + { + unsafe + { + fixed (byte* PixelsPtr = pixels) + { + sfRenderWindow_SetIcon(This, width, height, PixelsPtr); + } + } + } + + //////////////////////////////////////////////////////////// + /// + /// Activate of deactivate the window as the current target + /// for rendering + /// + /// True to activate, false to deactivate (true by default) + /// True if operation was successful, false otherwise + //////////////////////////////////////////////////////////// + public override bool SetActive(bool active) + { + return sfRenderWindow_SetActive(This, active); + } + + //////////////////////////////////////////////////////////// + /// + /// Limit the framerate to a maximum fixed frequency + /// + /// Framerate limit, in frames per seconds (use 0 to disable limit) + //////////////////////////////////////////////////////////// + public override void SetFramerateLimit(uint limit) + { + sfRenderWindow_SetFramerateLimit(This, limit); + } + + //////////////////////////////////////////////////////////// + /// + /// Get time elapsed since last frame + /// + /// Time elapsed, in seconds + //////////////////////////////////////////////////////////// + public override float GetFrameTime() + { + return sfRenderWindow_GetFrameTime(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the joystick threshold, ie. the value below which + /// no move event will be generated + /// + /// New threshold, in range [0, 100] + //////////////////////////////////////////////////////////// + public override void SetJoystickThreshold(float threshold) + { + sfRenderWindow_SetJoystickThreshold(This, threshold); + } + + //////////////////////////////////////////////////////////// + /// + /// Default view of the window + /// + //////////////////////////////////////////////////////////// + public View DefaultView + { + get {return myDefaultView;} + } + + //////////////////////////////////////////////////////////// + /// + /// Current view active in the window + /// + //////////////////////////////////////////////////////////// + public View CurrentView + { + get {return myCurrentView;} + set {myCurrentView = value; sfRenderWindow_SetView(This, value.This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Convert a point in window coordinates into view coordinates + /// using the current view of the window + /// + /// X coordinate of the point to convert, relative to the window + /// Y coordinate of the point to convert, relative to the window + /// Converted point + //////////////////////////////////////////////////////////// + public Vector2 ConvertCoords(uint windowX, uint windowY) + { + return ConvertCoords(windowX, windowY, myCurrentView); + } + + //////////////////////////////////////////////////////////// + /// + /// Convert a point in window coordinates into view coordinates + /// + /// X coordinate of the point to convert, relative to the window + /// Y coordinate of the point to convert, relative to the window + /// Target view to convert the point to + /// Converted point + //////////////////////////////////////////////////////////// + public Vector2 ConvertCoords(uint windowX, uint windowY, View targetView) + { + Vector2 Point; + sfRenderWindow_ConvertCoords(This, windowX, windowY, out Point.X, out Point.Y, targetView.This); + + return Point; + } + + //////////////////////////////////////////////////////////// + /// + /// Tell SFML to preserve external OpenGL states, at the expense of + /// more CPU charge. Use this function if you don't want SFML + /// to mess up your own OpenGL states (if any). + /// Don't enable state preservation if not needed, as it will allow + /// SFML to do internal optimizations and improve performances. + /// This parameter is false by default + /// + /// True to preserve OpenGL states, false to let SFML optimize + //////////////////////////////////////////////////////////// + public void PreserveOpenGLStates(bool preserve) + { + sfRenderWindow_PreserveOpenGLStates(This, preserve); + } + + //////////////////////////////////////////////////////////// + /// + /// Clear the entire window with black color + /// + //////////////////////////////////////////////////////////// + public void Clear() + { + sfRenderWindow_Clear(This, Color.Black); + } + + //////////////////////////////////////////////////////////// + /// + /// Clear the entire window with a single color + /// + /// Color to use to clear the window + //////////////////////////////////////////////////////////// + public void Clear(Color color) + { + sfRenderWindow_Clear(This, color); + } + + //////////////////////////////////////////////////////////// + /// + /// Save the content of the window to an image + /// + /// Image instance containing the contents of the screen + //////////////////////////////////////////////////////////// + public Image Capture() + { + return new Image(sfRenderWindow_Capture(This)); + } + + //////////////////////////////////////////////////////////// + /// + /// Draw something into the window + /// + /// Object to draw + //////////////////////////////////////////////////////////// + public void Draw(Drawable objectToDraw) + { + objectToDraw.Render(this); + } + + //////////////////////////////////////////////////////////// + /// + /// Apply a post-fx to the window + /// + /// PostFx to apply + //////////////////////////////////////////////////////////// + public void Draw(PostFx postFx) + { + sfRenderWindow_DrawPostFX(This, postFx != null ? postFx.This : IntPtr.Zero); + } + + //////////////////////////////////////////////////////////// + /// + /// Internal function to get the next event + /// + /// Variable to fill with the raw pointer to the event structure + /// True if there was an event, false otherwise + //////////////////////////////////////////////////////////// + protected override bool GetEvent(out Event eventToFill) + { + return sfRenderWindow_GetEvent(This, out eventToFill); + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfRenderWindow_Destroy(This); + + if (disposing) + myDefaultView.Dispose(); + } + + //////////////////////////////////////////////////////////// + /// + /// Do common initializations + /// + //////////////////////////////////////////////////////////// + private void Initialize() + { + myInput = new Input(sfRenderWindow_GetInput(This)); + myDefaultView = new View(sfRenderWindow_GetDefaultView(This)); + myCurrentView = myDefaultView; + GC.SuppressFinalize(myDefaultView); + } + + private View myCurrentView = null; + private View myDefaultView = null; + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_Create(VideoMode Mode, string Title, Styles Style, WindowSettings Params); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_CreateFromHandle(IntPtr Handle, WindowSettings Params); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_GetInput(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfRenderWindow_IsOpened(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_Close(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfRenderWindow_GetEvent(IntPtr This, out Event Evt); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_Capture(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_Clear(IntPtr This, Color ClearColor); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_Display(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern uint sfRenderWindow_GetWidth(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern uint sfRenderWindow_GetHeight(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern WindowSettings sfRenderWindow_GetSettings(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_UseVerticalSync(IntPtr This, bool Enable); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_ShowMouseCursor(IntPtr This, bool Show); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_SetCursorPosition(IntPtr This, uint X, uint Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_SetPosition(IntPtr This, int X, int Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_SetSize(IntPtr This, uint Width, uint Height); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_Show(IntPtr This, bool Show); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_EnableKeyRepeat(IntPtr This, bool Enable); + + [DllImport("csfml-graphics")] + unsafe static extern void sfRenderWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern bool sfRenderWindow_SetActive(IntPtr This, bool Active); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_SetFramerateLimit(IntPtr This, uint Limit); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfRenderWindow_GetFrameTime(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_SetJoystickThreshold(IntPtr This, float Threshold); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_SetView(IntPtr This, IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_GetView(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfRenderWindow_GetDefaultView(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_ConvertCoords(IntPtr This, uint WindowX, uint WindowY, out float ViewX, out float ViewY, IntPtr TargetView); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_PreserveOpenGLStates(IntPtr This, bool Preserve); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawPostFX(IntPtr This, IntPtr PostFx); + + #endregion + } + } +} diff --git a/dotnet/src/Graphics/Shape.cs b/dotnet/src/Graphics/Shape.cs new file mode 100644 index 00000000..396432af --- /dev/null +++ b/dotnet/src/Graphics/Shape.cs @@ -0,0 +1,505 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Shape defines a drawable convex shape ; it also defines + /// helper functions to draw simple shapes like + /// lines, rectangles, circles, etc. + /// + //////////////////////////////////////////////////////////// + public class Shape : Drawable + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + public Shape() : + base(sfShape_Create()) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Position of the object on screen + /// + //////////////////////////////////////////////////////////// + public override Vector2 Position + { + get { return new Vector2(sfShape_GetX(This), sfShape_GetY(This)); } + set { sfShape_SetPosition(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Rotation of the object, defined in degrees + /// + //////////////////////////////////////////////////////////// + public override float Rotation + { + get { return sfShape_GetRotation(This); } + set { sfShape_SetRotation(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Vertical and horizontal scale of the object + /// + //////////////////////////////////////////////////////////// + public override Vector2 Scale + { + get { return new Vector2(sfShape_GetScaleX(This), sfShape_GetScaleY(This)); } + set { sfShape_SetScale(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Center of the transformation of the object + /// (center of translation, rotation and scale) + /// + //////////////////////////////////////////////////////////// + public override Vector2 Center + { + get { return new Vector2(sfShape_GetCenterX(This), sfShape_GetCenterY(This)); } + set { sfShape_SetCenter(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Global color of the object + /// + //////////////////////////////////////////////////////////// + public override Color Color + { + get { return sfShape_GetColor(This); } + set { sfShape_SetColor(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Blending mode of the object + /// + //////////////////////////////////////////////////////////// + public override BlendMode BlendMode + { + get { return sfShape_GetBlendMode(This); } + set { sfShape_SetBlendMode(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from global coordinates into local coordinates + /// (ie it applies the inverse of object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public override Vector2 TransformToLocal(Vector2 point) + { + Vector2 Transformed; + sfShape_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); + + return Transformed; + } + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from local coordinates into global coordinates + /// (ie it applies the object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public override Vector2 TransformToGlobal(Vector2 point) + { + Vector2 Transformed; + sfShape_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); + + return Transformed; + } + + //////////////////////////////////////////////////////////// + /// + /// Add a point to the shape + /// + /// Position of the point + /// Color of the point + //////////////////////////////////////////////////////////// + public void AddPoint(Vector2 position, Color color) + { + AddPoint(position, color, Color.Black); + } + + //////////////////////////////////////////////////////////// + /// + /// Add a point to the shape + /// + /// Position of the point + /// Color of the point + /// Outline color of the point + //////////////////////////////////////////////////////////// + public void AddPoint(Vector2 position, Color color, Color outlineColor) + { + sfShape_AddPoint(This, position.X, position.Y, color, outlineColor); + } + + //////////////////////////////////////////////////////////// + /// + /// Enable or disable filling the shape. + /// Fill is enabled by default + /// + /// True to enable, false to disable + //////////////////////////////////////////////////////////// + public void EnableFill(bool enable) + { + sfShape_EnableFill(This, enable); + } + + //////////////////////////////////////////////////////////// + /// + /// Enable or disable drawing the shape outline. + /// Outline is enabled by default + /// + /// True to enable, false to disable + //////////////////////////////////////////////////////////// + public void EnableOutline(bool enable) + { + sfShape_EnableOutline(This, enable); + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the shape outline + /// + //////////////////////////////////////////////////////////// + public float OutlineWidth + { + get {return sfShape_GetOutlineWidth(This);} + set {sfShape_SetOutlineWidth(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Totla number of points of the shape + /// + //////////////////////////////////////////////////////////// + public uint NbPoints + { + get {return sfShape_GetNbPoints(This);} + } + + //////////////////////////////////////////////////////////// + /// + /// Set the position of a point + /// + /// Index of the point, in range [0, NbPoints - 1] + /// New position of the index-th point + //////////////////////////////////////////////////////////// + public void SetPointPosition(uint index, Vector2 position) + { + sfShape_SetPointPosition(This, index, position.X, position.Y); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the position of a point + /// + /// Index of the point, in range [0, NbPoints - 1] + /// Position of the index-th point + //////////////////////////////////////////////////////////// + public Vector2 GetPointPosition(uint index) + { + Vector2 Pos; + sfShape_GetPointPosition(This, index, out Pos.X, out Pos.Y); + + return Pos; + } + + //////////////////////////////////////////////////////////// + /// + /// Set the color of a point + /// + /// Index of the point, in range [0, NbPoints - 1] + /// New color of the index-th point + //////////////////////////////////////////////////////////// + public void SetPointColor(uint index, Color color) + { + sfShape_SetPointColor(This, index, color); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the color of a point + /// + /// Index of the point, in range [0, NbPoints - 1] + /// Color of the index-th point + //////////////////////////////////////////////////////////// + public Color GetPointColor(uint index) + { + return sfShape_GetPointColor(This, index); + } + + //////////////////////////////////////////////////////////// + /// + /// Set the outline color of a point + /// + /// Index of the point, in range [0, NbPoints - 1] + /// New outline color of the index-th point + //////////////////////////////////////////////////////////// + public void SetPointOutlineColor(uint index, Color color) + { + sfShape_SetPointOutlineColor(This, index, color); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the outline color of a point + /// + /// Index of the point, in range [0, NbPoints - 1] + /// Outline color of the index-th point + //////////////////////////////////////////////////////////// + public Color GetPointOutlineColor(uint index) + { + return sfShape_GetPointOutlineColor(This, index); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a shape made of a single line + /// + /// Position of the first point + /// Position of the second point + /// Line thickness + /// Color used to draw the line + /// New line shape built with the given parameters + //////////////////////////////////////////////////////////// + public static Shape Line(Vector2 p1, Vector2 p2, float thickness, Color color) + { + return Line(p1, p2, thickness, color, 0, Color.White); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a shape made of a single line + /// + /// Position of the first point + /// Position of the second point + /// Line thickness + /// Color used to draw the line + /// Outline width + /// Color used to draw the outline + /// New line shape built with the given parameters + //////////////////////////////////////////////////////////// + public static Shape Line(Vector2 p1, Vector2 p2, float thickness, Color color, float outline, Color outlineColor) + { + return new Shape(sfShape_CreateLine(p1.X, p1.Y, p2.X, p2.Y, thickness, color, outline, outlineColor)); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a shape made of a single rectangle + /// + /// Position of the top-left corner + /// Position of the bottom-right corner + /// Color used to fill the rectangle + /// New rectangle shape built with the given parameters + //////////////////////////////////////////////////////////// + public static Shape Rectangle(Vector2 p1, Vector2 p2, Color color) + { + return Rectangle(p1, p2, color, 0, Color.White); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a shape made of a single rectangle + /// + /// Position of the top-left corner + /// Position of the bottom-right corner + /// Color used to fill the rectangle + /// Outline width + /// Color used to draw the outline + /// New rectangle shape built with the given parameters + //////////////////////////////////////////////////////////// + public static Shape Rectangle(Vector2 p1, Vector2 p2, Color color, float outline, Color outlineColor) + { + return new Shape(sfShape_CreateRectangle(p1.X, p1.Y, p2.X, p2.Y, color, outline, outlineColor)); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a shape made of a single circle + /// + /// Position of the center + /// Radius of the circle + /// Color used to fill the circle + /// New circle shape built with the given parameters + //////////////////////////////////////////////////////////// + public static Shape Circle(Vector2 center, float radius, Color color) + { + return Circle(center, radius, color, 0, Color.White); + } + + //////////////////////////////////////////////////////////// + /// + /// Create a shape made of a single circle + /// + /// Position of the center + /// Radius of the circle + /// Color used to fill the circle + /// Outline width + /// Color used to draw the outline + /// New circle shape built with the given parameters + //////////////////////////////////////////////////////////// + public static Shape Circle(Vector2 center, float radius, Color color, float outline, Color outlineColor) + { + return new Shape(sfShape_CreateCircle(center.X, center.Y, radius, color, outline, outlineColor)); + } + + //////////////////////////////////////////////////////////// + /// + /// Render the object into the given render window + /// + /// Target window + //////////////////////////////////////////////////////////// + internal override void Render(RenderWindow window) + { + sfRenderWindow_DrawShape(window.This, This); + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfShape_Destroy(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Internal constructor + /// + /// Pointer to the internal object in C library + //////////////////////////////////////////////////////////// + private Shape(IntPtr thisPtr) : + base(thisPtr) + { + } + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfShape_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetPosition(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetRotation(IntPtr This, float Rotation); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetRotation(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetScale(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetScaleX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetScaleY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetCenter(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetCenterX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetCenterY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetColor(IntPtr This, Color Color); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfShape_GetColor(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetBlendMode(IntPtr This, BlendMode Mode); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern BlendMode sfShape_GetBlendMode(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Vector2 sfShape_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Vector2 sfShape_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawShape(IntPtr This, IntPtr Shape); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, Color Col, float Outline, Color OutlineCol); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, Color Col, float Outline, Color OutlineCol); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfShape_CreateCircle(float X, float Y, float Radius, Color Col, float Outline, Color OutlineCol); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_AddPoint(IntPtr This, float X, float Y, Color Col, Color OutlineCol); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_EnableFill(IntPtr This, bool Enable); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_EnableOutline(IntPtr This, bool Enable); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetOutlineWidth(IntPtr This, float Width); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfShape_GetOutlineWidth(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern uint sfShape_GetNbPoints(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetPointPosition(IntPtr This, uint Index, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_GetPointPosition(IntPtr This, uint Index, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetPointColor(IntPtr This, uint Index, Color Col); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfShape_GetPointColor(IntPtr This, uint Index); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfShape_SetPointOutlineColor(IntPtr This, uint Index, Color Col); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfShape_GetPointOutlineColor(IntPtr This, uint Index); + #endregion + } + } +} diff --git a/dotnet/src/Graphics/Sprite.cs b/dotnet/src/Graphics/Sprite.cs new file mode 100644 index 00000000..d6f5c884 --- /dev/null +++ b/dotnet/src/Graphics/Sprite.cs @@ -0,0 +1,332 @@ +using System; +using System.Security; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// This class defines a sprite : texture, transformations, + /// color, and draw on screen + /// + //////////////////////////////////////////////////////////// + public class Sprite : Drawable + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + public Sprite() : + base(sfSprite_Create()) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the sprite from a source image + /// + /// Source image to assign to the sprite + //////////////////////////////////////////////////////////// + public Sprite(Image image) : + base(sfSprite_Create()) + { + Image = image; + } + + //////////////////////////////////////////////////////////// + /// + /// Position of the object on screen + /// + //////////////////////////////////////////////////////////// + public override Vector2 Position + { + get { return new Vector2(sfSprite_GetX(This), sfSprite_GetY(This)); } + set { sfSprite_SetPosition(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Rotation of the object, defined in degrees + /// + //////////////////////////////////////////////////////////// + public override float Rotation + { + get { return sfSprite_GetRotation(This); } + set { sfSprite_SetRotation(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Vertical and horizontal scale of the object + /// + //////////////////////////////////////////////////////////// + public override Vector2 Scale + { + get { return new Vector2(sfSprite_GetScaleX(This), sfSprite_GetScaleY(This)); } + set { sfSprite_SetScale(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Center of the transformation of the object + /// (center of translation, rotation and scale) + /// + //////////////////////////////////////////////////////////// + public override Vector2 Center + { + get { return new Vector2(sfSprite_GetCenterX(This), sfSprite_GetCenterY(This)); } + set { sfSprite_SetCenter(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Global color of the object + /// + //////////////////////////////////////////////////////////// + public override Color Color + { + get { return sfSprite_GetColor(This); } + set { sfSprite_SetColor(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Blending mode of the object + /// + //////////////////////////////////////////////////////////// + public override BlendMode BlendMode + { + get { return sfSprite_GetBlendMode(This); } + set { sfSprite_SetBlendMode(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from global coordinates into local coordinates + /// (ie it applies the inverse of object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public override Vector2 TransformToLocal(Vector2 point) + { + Vector2 Transformed; + sfSprite_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); + + return Transformed; + } + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from local coordinates into global coordinates + /// (ie it applies the object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public override Vector2 TransformToGlobal(Vector2 point) + { + Vector2 Transformed; + sfSprite_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); + + return Transformed; + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the sprite + /// + //////////////////////////////////////////////////////////// + public float Width + { + get { return sfSprite_GetWidth(This); } + set { sfSprite_Resize(This, value, this.Height); } + } + + //////////////////////////////////////////////////////////// + /// + /// Height of the sprite + /// + //////////////////////////////////////////////////////////// + public float Height + { + get { return sfSprite_GetHeight(This); } + set { sfSprite_Resize(This, this.Width, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Source images displayed by the sprite + /// + //////////////////////////////////////////////////////////// + public Image Image + { + get { return myImage; } + set { myImage = value; sfSprite_SetImage(This, value != null ? value.This : IntPtr.Zero); } + } + + //////////////////////////////////////////////////////////// + /// + /// Sub-rectangle of the source image displayed by the sprite + /// + //////////////////////////////////////////////////////////// + public IntRect SubRect + { + get { return sfSprite_GetSubRect(This); } + set { sfSprite_SetSubRect(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Flip the sprite horizontically + /// + /// True to flip, false to canel flip + //////////////////////////////////////////////////////////// + public void FlipX(bool flipped) + { + sfSprite_FlipX(This, flipped); + } + + //////////////////////////////////////////////////////////// + /// + /// Flip the sprite vertically + /// + /// True to flip, false to canel flip + //////////////////////////////////////////////////////////// + public void FlipY(bool flipped) + { + sfSprite_FlipY(This, flipped); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the color of a given pixel in the sprite + /// (point is in local coordinates) + /// + /// X coordinate of the pixel to get + /// Y coordinate of the pixel to get + /// Color of pixel (x, y) + //////////////////////////////////////////////////////////// + public Color GetPixel(uint x, uint y) + { + return sfSprite_GetPixel(This, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Render the object into the given render window + /// + /// Target window + //////////////////////////////////////////////////////////// + internal override void Render(RenderWindow window) + { + sfRenderWindow_DrawSprite(window.This, This); + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfSprite_Destroy(This); + } + + private Image myImage = null; + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfSprite_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetPosition(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetRotation(IntPtr This, float Rotation); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetRotation(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetScale(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetScaleX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetScaleY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetCenter(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetCenterX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetCenterY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetColor(IntPtr This, Color Color); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfSprite_GetColor(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetBlendMode(IntPtr This, BlendMode Mode); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern BlendMode sfSprite_GetBlendMode(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Vector2 sfSprite_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Vector2 sfSprite_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawSprite(IntPtr This, IntPtr Sprite); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_Resize(IntPtr This, float Width, float Height); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetWidth(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfSprite_GetHeight(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetImage(IntPtr This, IntPtr Image); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_SetSubRect(IntPtr This, IntRect Rect); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntRect sfSprite_GetSubRect(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_FlipX(IntPtr This, bool Flipped); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfSprite_FlipY(IntPtr This, bool Flipped); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfSprite_GetPixel(IntPtr This, uint X, uint Y); + #endregion + } + } +} diff --git a/dotnet/src/Graphics/String2D.cs b/dotnet/src/Graphics/String2D.cs new file mode 100644 index 00000000..7f97659a --- /dev/null +++ b/dotnet/src/Graphics/String2D.cs @@ -0,0 +1,380 @@ +using System; +using System.Security; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// This class defines a graphical 2D text, that can be drawn on screen + /// + //////////////////////////////////////////////////////////// + public class String2D : Drawable + { + //////////////////////////////////////////////////////////// + /// + /// Enumerate the string drawing styles + /// + //////////////////////////////////////////////////////////// + [Flags] + public enum Styles + { + /// Regular characters, no style + Regular = 0, + + /// Characters are bold + Bold = 1 << 0, + + /// Characters are in italic + Italic = 1 << 1, + + /// Characters are underlined + Underlined = 1 << 2 + } + + //////////////////////////////////////////////////////////// + /// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + public String2D() : + this("") + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the string from a text + /// + /// Text to display + //////////////////////////////////////////////////////////// + public String2D(string text) : + this(text, Font.DefaultFont) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the string from a text and a font + /// + /// Text to display + /// Font to use + //////////////////////////////////////////////////////////// + public String2D(string text, Font font) : + this(text, font, 30) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the string from a text, font and size + /// + /// Text to display + /// Font to use + /// Base characters size + //////////////////////////////////////////////////////////// + public String2D(string text, Font font, uint size) : + base(sfString_Create()) + { + Text = text; + Font = font; + Size = size; + } + + //////////////////////////////////////////////////////////// + /// + /// Position of the object on screen + /// + //////////////////////////////////////////////////////////// + public override Vector2 Position + { + get { return new Vector2(sfString_GetX(This), sfString_GetY(This)); } + set { sfString_SetPosition(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Rotation of the object, defined in degrees + /// + //////////////////////////////////////////////////////////// + public override float Rotation + { + get { return sfString_GetRotation(This); } + set { sfString_SetRotation(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Vertical and horizontal scale of the object + /// + //////////////////////////////////////////////////////////// + public override Vector2 Scale + { + get { return new Vector2(sfString_GetScaleX(This), sfString_GetScaleY(This)); } + set { sfString_SetScale(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Center of the transformation of the object + /// (center of translation, rotation and scale) + /// + //////////////////////////////////////////////////////////// + public override Vector2 Center + { + get { return new Vector2(sfString_GetCenterX(This), sfString_GetCenterY(This)); } + set { sfString_SetCenter(This, value.X, value.Y); } + } + + //////////////////////////////////////////////////////////// + /// + /// Global color of the object + /// + //////////////////////////////////////////////////////////// + public override Color Color + { + get { return sfString_GetColor(This); } + set { sfString_SetColor(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Blending mode of the object + /// + //////////////////////////////////////////////////////////// + public override BlendMode BlendMode + { + get { return sfString_GetBlendMode(This); } + set { sfString_SetBlendMode(This, value); } + } + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from global coordinates into local coordinates + /// (ie it applies the inverse of object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public override Vector2 TransformToLocal(Vector2 point) + { + Vector2 Transformed; + sfString_TransformToLocal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); + + return Transformed; + } + + //////////////////////////////////////////////////////////// + /// + /// Transform a point from local coordinates into global coordinates + /// (ie it applies the object's center, translation, rotation and scale to the point) + /// + /// Point to transform + /// Transformed point + //////////////////////////////////////////////////////////// + public override Vector2 TransformToGlobal(Vector2 point) + { + Vector2 Transformed; + sfString_TransformToGlobal(This, point.X, point.Y, out Transformed.X, out Transformed.Y); + + return Transformed; + } + + //////////////////////////////////////////////////////////// + /// + /// Text displayed + /// + //////////////////////////////////////////////////////////// + public string Text + { + // TODO : use unicode functions + // (convert from UTF-16 to UTF-32, and find how to marshal System.String as sfUint32*...) + get {return sfString_GetText(This);} + set {sfString_SetText(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Font used to display the text + /// + //////////////////////////////////////////////////////////// + public Font Font + { + get {return myFont;} + set {myFont = value; sfString_SetFont(This, value != null ? value.This : IntPtr.Zero);} + } + + //////////////////////////////////////////////////////////// + /// + /// Base size of characters + /// + //////////////////////////////////////////////////////////// + public float Size + { + get {return sfString_GetSize(This);} + set {sfString_SetSize(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Style of the text (see Styles enum) + /// + //////////////////////////////////////////////////////////// + public Styles Style + { + get {return sfString_GetStyle(This);} + set {sfString_SetStyle(This, value);} + } + + //////////////////////////////////////////////////////////// + /// + /// Get the string rectangle on screen + /// + /// String rectangle in global coordinates (doesn't include rotation) + //////////////////////////////////////////////////////////// + public FloatRect GetRect() + { + return sfString_GetRect(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Return the visual position of the Index-th character of the string, + /// in coordinates relative to the string + /// (note : translation, center, rotation and scale are not applied) + /// + /// Index of the character + /// Position of the Index-th character (end of string if Index is out of range) + //////////////////////////////////////////////////////////// + public Vector2 GetCharacterPos(uint index) + { + Vector2 Pos; + sfString_GetCharacterPos(This, index, out Pos.X, out Pos.Y); + + return Pos; + } + + //////////////////////////////////////////////////////////// + /// + /// Render the object into the given render window + /// + /// Target window + //////////////////////////////////////////////////////////// + internal override void Render(RenderWindow window) + { + sfRenderWindow_DrawString(window.This, This); + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfString_Destroy(This); + } + + private Font myFont = Font.DefaultFont; + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfString_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_Destroy(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetPosition(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetRotation(IntPtr This, float Rotation); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetRotation(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetScale(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetScaleX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetScaleY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetCenter(IntPtr This, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetCenterX(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetCenterY(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetColor(IntPtr This, Color Color); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Color sfString_GetColor(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetBlendMode(IntPtr This, BlendMode Mode); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern BlendMode sfString_GetBlendMode(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Vector2 sfString_TransformToLocal(IntPtr This, float PointX, float PointY, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Vector2 sfString_TransformToGlobal(IntPtr This, float PointX, float PointY, out float X, out float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfRenderWindow_DrawString(IntPtr This, IntPtr String); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetWidth(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetHeight(IntPtr This); + + [DllImport("csfml-graphics", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetText(IntPtr This, string Text); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetFont(IntPtr This, IntPtr Font); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetSize(IntPtr This, float Size); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_SetStyle(IntPtr This, Styles Style); + + [DllImport("csfml-graphics", CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity] + static extern string sfString_GetText(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfString_GetSize(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern Styles sfString_GetStyle(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern FloatRect sfString_GetRect(IntPtr This); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfString_GetCharacterPos(IntPtr This, uint Index, out float X, out float Y); + + #endregion + } + } +} diff --git a/dotnet/src/Graphics/Vector2.cs b/dotnet/src/Graphics/Vector2.cs new file mode 100644 index 00000000..5de7a6e0 --- /dev/null +++ b/dotnet/src/Graphics/Vector2.cs @@ -0,0 +1,114 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// Vector2 is an utility class for manipulating 2 dimensional + /// vectors with float components + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct Vector2 + { + //////////////////////////////////////////////////////////// + /// + /// Construct the vector from its coordinates + /// + /// X coordinate + /// Y coordinate + //////////////////////////////////////////////////////////// + public Vector2(float x, float y) + { + X = x; + Y = y; + } + + //////////////////////////////////////////////////////////// + /// + /// Operator - overload ; returns the opposite of a vector + /// + /// Vector to negate + /// -v + //////////////////////////////////////////////////////////// + public static Vector2 operator -(Vector2 v) + { + return new Vector2(-v.X, -v.Y); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator - overload ; subtracts two vectors + /// + /// First vector + /// Second vector + /// v1 - v2 + //////////////////////////////////////////////////////////// + public static Vector2 operator -(Vector2 v1, Vector2 v2) + { + return new Vector2(v1.X - v2.X, v1.Y - v2.Y); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator + overload ; add two vectors + /// + /// First vector + /// Second vector + /// v1 + v2 + //////////////////////////////////////////////////////////// + public static Vector2 operator +(Vector2 v1, Vector2 v2) + { + return new Vector2(v1.X + v2.X, v1.Y + v2.Y); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator * overload ; multiply a vector by a scalar value + /// + /// Vector + /// Scalar value + /// v * x + //////////////////////////////////////////////////////////// + public static Vector2 operator *(Vector2 v, float x) + { + return new Vector2(v.X * x, v.Y * x); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator * overload ; multiply a scalar value by a vector + /// + /// Scalar value + /// Vector + /// x * v + //////////////////////////////////////////////////////////// + public static Vector2 operator *(float x, Vector2 v) + { + return new Vector2(v.X * x, v.Y * x); + } + + //////////////////////////////////////////////////////////// + /// + /// Operator / overload ; divide a vector by a scalar value + /// + /// Vector + /// Scalar value + /// v / x + //////////////////////////////////////////////////////////// + public static Vector2 operator /(Vector2 v, float x) + { + return new Vector2(v.X / x, v.Y / x); + } + + /// X (horizontal) component of the vector + public float X; + + /// Y (vertical) component of the vector + public float Y; + } + } +} diff --git a/dotnet/src/Graphics/View.cs b/dotnet/src/Graphics/View.cs new file mode 100644 index 00000000..419ba9a9 --- /dev/null +++ b/dotnet/src/Graphics/View.cs @@ -0,0 +1,183 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Graphics + { + //////////////////////////////////////////////////////////// + /// + /// This class defines a view (position, size, etc.) ; + /// you can consider it as a 2D camera + /// + //////////////////////////////////////////////////////////// + public class View : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Create a default view (1000x1000, centered on origin) + /// + //////////////////////////////////////////////////////////// + public View() : + base(sfView_Create()) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the view from a rectangle + /// + /// Rectangle defining the position and size of the view + //////////////////////////////////////////////////////////// + public View(FloatRect viewRect) : + base(sfView_CreateFromRect(viewRect)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the view from its center and half-size + /// + /// Center of the view + /// Half-size of the view (from center to corner) + //////////////////////////////////////////////////////////// + public View(Vector2 center, Vector2 halfSize) : + base(sfView_Create()) + { + this.Center = center; + this.HalfSize = halfSize; + } + + //////////////////////////////////////////////////////////// + /// + /// Center of the view + /// + //////////////////////////////////////////////////////////// + public Vector2 Center + { + get {return new Vector2(sfView_GetCenterX(This), sfView_GetCenterY(This));} + set {sfView_SetCenter(This, value.X, value.Y);} + } + + //////////////////////////////////////////////////////////// + /// + /// Half-size of the view + /// + //////////////////////////////////////////////////////////// + public Vector2 HalfSize + { + get {return new Vector2(sfView_GetHalfSizeX(This), sfView_GetHalfSizeY(This));} + set {sfView_SetHalfSize(This, value.X, value.Y);} + } + + //////////////////////////////////////////////////////////// + /// + /// Rebuild the view from a rectangle + /// + /// Rectangle defining the position and size of the view + //////////////////////////////////////////////////////////// + public void SetFromRect(FloatRect viewRect) + { + sfView_SetFromRect(This, viewRect); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the rectangle defining the view + /// + /// Rectangle of the view + //////////////////////////////////////////////////////////// + public FloatRect GetRect() + { + return sfView_GetRect(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Move the view + /// + /// Offset to move the view + //////////////////////////////////////////////////////////// + public void Move(Vector2 offset) + { + sfView_Move(This, offset.X, offset.Y); + } + + //////////////////////////////////////////////////////////// + /// + /// Resize the view rectangle to simulate a zoom / unzoom effect + /// + /// Zoom factor to apply, relative to the current zoom + //////////////////////////////////////////////////////////// + public void Zoom(float factor) + { + sfView_Zoom(This, factor); + } + + //////////////////////////////////////////////////////////// + /// + /// Internal constructor for other classes which need to manipulate raw views + /// + /// Direct pointer to the view object in the C library + //////////////////////////////////////////////////////////// + internal View(IntPtr thisPtr) : + base(thisPtr) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfView_Destroy(This); + } + + #region Imports + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfView_Create(); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfView_CreateFromRect(FloatRect Rect); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfView_Destroy(IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfView_SetCenter(IntPtr View, float X, float Y); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfView_SetHalfSize(IntPtr View, float HalfWidth, float HalfHeight); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfView_SetFromRect(IntPtr View, FloatRect ViewRect); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfView_GetCenterX(IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfView_GetCenterY(IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfView_GetHalfSizeX(IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern float sfView_GetHalfSizeY(IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern FloatRect sfView_GetRect(IntPtr View); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfView_Move(IntPtr View, float OffsetX, float OffsetY); + + [DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity] + static extern void sfView_Zoom(IntPtr View, float Factor); + + #endregion + } + } +} diff --git a/dotnet/src/Graphics/sfml-graphics.csproj b/dotnet/src/Graphics/sfml-graphics.csproj new file mode 100644 index 00000000..88afc25f --- /dev/null +++ b/dotnet/src/Graphics/sfml-graphics.csproj @@ -0,0 +1,72 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {46786269-57B9-48E7-AA4F-8F4D84609FE6} + Library + Properties + SFML.Graphics + sfmlnet-graphics + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + bin\graphics-doc.xml + + + pdbonly + true + ..\..\lib\ + TRACE + prompt + 4 + true + bin\graphics-doc.xml + + + + + + + + + + + + + + + + + + + + + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + sfml-window + + + + + + + + + \ No newline at end of file diff --git a/dotnet/src/Window/Event.cs b/dotnet/src/Window/Event.cs new file mode 100644 index 00000000..37a1043f --- /dev/null +++ b/dotnet/src/Window/Event.cs @@ -0,0 +1,389 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Window + { + //////////////////////////////////////////////////////////// + /// + /// Definition of key codes for keyboard events + /// + //////////////////////////////////////////////////////////// + public enum KeyCode + { + A = 'a', + B = 'b', + C = 'c', + D = 'd', + E = 'e', + F = 'f', + G = 'g', + H = 'h', + I = 'i', + J = 'j', + K = 'k', + L = 'l', + M = 'm', + N = 'n', + O = 'o', + P = 'p', + Q = 'q', + R = 'r', + S = 's', + T = 't', + U = 'u', + V = 'v', + W = 'w', + X = 'x', + Y = 'y', + Z = 'z', + Num0 = '0', + Num1 = '1', + Num2 = '2', + Num3 = '3', + Num4 = '4', + Num5 = '5', + Num6 = '6', + Num7 = '7', + Num8 = '8', + Num9 = '9', + Escape = 256, + LControl, + LShift, + LAlt, + LSystem, // OS specific key (left side) : windows (Win and Linux), apple (MacOS), ... + RControl, + RShift, + RAlt, + RSystem, // OS specific key (right side) : windows (Win and Linux), apple (MacOS), ... + Menu, + LBracket, // [ + RBracket, // ] + SemiColon, // ; + Comma, // , + Period, // . + Quote, // ' + Slash, // / + BackSlash, + Tilde, // ~ + Equal, // = + Dash, // - + Space, + Return, + Back, + Tab, + PageUp, + PageDown, + End, + Home, + Insert, + Delete, + Add, // + + Subtract, // - + Multiply, // * + Divide, // / + Left, // Left arrow + Right, // Right arrow + Up, // Up arrow + Down, // Down arrow + Numpad0, + Numpad1, + Numpad2, + Numpad3, + Numpad4, + Numpad5, + Numpad6, + Numpad7, + Numpad8, + Numpad9, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + Pause + } + + //////////////////////////////////////////////////////////// + /// + /// Definition of button codes for mouse events + /// + //////////////////////////////////////////////////////////// + public enum MouseButton + { + /// Left mouse button + Left, + + /// Right mouse button + Right, + + /// Center (wheel) mouse button + Middle, + + /// First extra button + XButton1, + + /// Second extra button + XButton2 + } + + //////////////////////////////////////////////////////////// + /// + /// Definition of joystick axis for joystick events + /// + //////////////////////////////////////////////////////////// + public enum JoyAxis + { + /// X axis + AxisX, + + /// Y axis + AxisY, + + /// Z axis + AxisZ, + + /// R axis + AxisR, + + /// U axis + AxisU, + + /// V axis + AxisV, + + /// Point of view + AxisPOV + } + + //////////////////////////////////////////////////////////// + /// + /// Enumeration of the different types of events + /// + //////////////////////////////////////////////////////////// + public enum EventType + { + /// Event triggered when a window is manually closed + Closed, + + /// Event triggered when a window is resized + Resized, + + /// Event triggered when a window loses the focus + LostFocus, + + /// Event triggered when a window gains the focus + GainedFocus, + + /// Event triggered when a valid character is entered + TextEntered, + + /// Event triggered when a keyboard key is pressed + KeyPressed, + + /// Event triggered when a keyboard key is released + KeyReleased, + + /// Event triggered when the mouse wheel is scrolled + MouseWheelMoved, + + /// Event triggered when a mouse button is pressed + MouseButtonPressed, + + /// Event triggered when a mouse button is released + MouseButtonReleased, + + /// Event triggered when the mouse moves within the area of a window + MouseMoved, + + /// Event triggered when the mouse enters the area of a window + MouseEntered, + + /// Event triggered when the mouse leaves the area of a window + MouseLeft, + + /// Event triggered when a joystick button is pressed + JoyButtonPressed, + + /// Event triggered when a joystick button is released + JoyButtonReleased, + + /// Event triggered when a joystick axis moves + JoyMoved + } + + //////////////////////////////////////////////////////////// + /// + /// Keyboard event parameters + /// + //////////////////////////////////////////////////////////// + public struct KeyEvent + { + /// Code of the key (see KeyCode enum) + public KeyCode Code; + + /// Is the Alt modifier pressed? + public bool Alt; + + /// Is the Control modifier pressed? + public bool Control; + + /// Is the Shift modifier pressed? + public bool Shift; + } + + //////////////////////////////////////////////////////////// + /// + /// Text event parameters + /// + //////////////////////////////////////////////////////////// + public struct TextEvent + { + /// UTF-32 value of the character + public uint Unicode; + } + + //////////////////////////////////////////////////////////// + /// + /// Mouse move event parameters + /// + //////////////////////////////////////////////////////////// + public struct MouseMoveEvent + { + /// X coordinate of the mouse cursor + public int X; + + /// Y coordinate of the mouse cursor + public int Y; + } + + //////////////////////////////////////////////////////////// + /// + /// Mouse buttons event parameters + /// + //////////////////////////////////////////////////////////// + public struct MouseButtonEvent + { + /// Code of the button (see MouseButton enum) + public MouseButton Button; + + /// X coordinate of the mouse cursor + public int X; + + /// Y coordinate of the mouse cursor + public int Y; + } + + //////////////////////////////////////////////////////////// + /// + /// Mouse wheel event parameters + /// + //////////////////////////////////////////////////////////// + public struct MouseWheelEvent + { + /// Scroll amount + public int Delta; + } + + //////////////////////////////////////////////////////////// + /// + /// Joystick axis move event parameters + /// + //////////////////////////////////////////////////////////// + public struct JoyMoveEvent + { + /// Index of the joystick which triggered the event + public uint JoystickId; + + /// Joystick axis (see JoyAxis enum) + public JoyAxis Axis; + + /// Current position of the axis + public float Position; + } + + //////////////////////////////////////////////////////////// + /// + /// Joystick buttons event parameters + /// + //////////////////////////////////////////////////////////// + public struct JoyButtonEvent + { + /// Index of the joystick which triggered the event + public uint JoystickId; + + /// Index of the button + public uint Button; + } + + //////////////////////////////////////////////////////////// + /// + /// Size event parameters + /// + //////////////////////////////////////////////////////////// + public struct SizeEvent + { + /// New width of the window + public uint Width; + + /// New height of the window + public uint Height; + } + + //////////////////////////////////////////////////////////// + /// + /// Event defines a system event and its parameters + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Explicit, Size = 20)] + public struct Event + { + /// Type of event (see EventType enum) + [FieldOffset(0)] + public EventType Type; + + /// Arguments for key events (KeyPressed, KeyReleased) + [FieldOffset(4)] + public KeyEvent Key; + + /// Arguments for text events (TextEntered) + [FieldOffset(4)] + public TextEvent Text; + + /// Arguments for mouse move events (MouseMoved) + [FieldOffset(4)] + public MouseMoveEvent MouseMove; + + /// Arguments for mouse button events (MouseButtonPressed, MouseButtonReleased) + [FieldOffset(4)] + public MouseButtonEvent MouseButton; + + /// Arguments for mouse wheel events (MouseWheelMoved) + [FieldOffset(4)] + public MouseWheelEvent MouseWheel; + + /// Arguments for joystick axis events (JoyMoved) + [FieldOffset(4)] + public JoyMoveEvent JoyMove; + + /// Arguments for joystick button events (JoyButtonPressed, JoyButtonReleased) + [FieldOffset(4)] + public JoyButtonEvent JoyButton; + + /// Arguments for size events (Resized) + [FieldOffset(4)] + public SizeEvent Size; + } + } +} diff --git a/dotnet/src/Window/EventArgs.cs b/dotnet/src/Window/EventArgs.cs new file mode 100644 index 00000000..89c47744 --- /dev/null +++ b/dotnet/src/Window/EventArgs.cs @@ -0,0 +1,223 @@ +using System; + +namespace SFML +{ + namespace Window + { + //////////////////////////////////////////////////////////// + /// + /// Keyboard event parameters + /// + //////////////////////////////////////////////////////////// + public class KeyEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the key arguments from a key event + /// + /// Key event + //////////////////////////////////////////////////////////// + public KeyEventArgs(KeyEvent e) + { + Code = e.Code; + Alt = e.Alt; + Control = e.Control; + Shift = e.Shift; + } + + /// Code of the key (see KeyCode enum) + public KeyCode Code; + + /// Is the Alt modifier pressed? + public bool Alt; + + /// Is the Control modifier pressed? + public bool Control; + + /// Is the Shift modifier pressed? + public bool Shift; + } + + //////////////////////////////////////////////////////////// + /// + /// Text event parameters + /// + //////////////////////////////////////////////////////////// + public class TextEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the text arguments from a text event + /// + /// Text event + //////////////////////////////////////////////////////////// + public TextEventArgs(TextEvent e) + { + Unicode = Char.ConvertFromUtf32((int)e.Unicode); + } + + /// UTF-16 value of the character + public string Unicode; + } + + //////////////////////////////////////////////////////////// + /// + /// Mouse move event parameters + /// + //////////////////////////////////////////////////////////// + public class MouseMoveEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the mouse move arguments from a mouse move event + /// + /// Mouse move event + //////////////////////////////////////////////////////////// + public MouseMoveEventArgs(MouseMoveEvent e) + { + X = e.X; + Y = e.Y; + } + + /// X coordinate of the mouse cursor + public int X; + + /// Y coordinate of the mouse cursor + public int Y; + } + + //////////////////////////////////////////////////////////// + /// + /// Mouse buttons event parameters + /// + //////////////////////////////////////////////////////////// + public class MouseButtonEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the mouse button arguments from a mouse button event + /// + /// Mouse button event + //////////////////////////////////////////////////////////// + public MouseButtonEventArgs(MouseButtonEvent e) + { + Button = e.Button; + X = e.X; + Y = e.Y; + } + + /// Code of the button (see MouseButton enum) + public MouseButton Button; + + /// X coordinate of the mouse cursor + public int X; + + /// Y coordinate of the mouse cursor + public int Y; + } + + //////////////////////////////////////////////////////////// + /// + /// Mouse wheel event parameters + /// + //////////////////////////////////////////////////////////// + public class MouseWheelEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the mouse wheel arguments from a mouse wheel event + /// + /// Mouse wheel event + //////////////////////////////////////////////////////////// + public MouseWheelEventArgs(MouseWheelEvent e) + { + Delta = e.Delta; + } + + /// Scroll amount + public int Delta; + } + + //////////////////////////////////////////////////////////// + /// + /// Joystick axis move event parameters + /// + //////////////////////////////////////////////////////////// + public class JoyMoveEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the joystick move arguments from a joystick move event + /// + /// Joystick move event + //////////////////////////////////////////////////////////// + public JoyMoveEventArgs(JoyMoveEvent e) + { + JoystickId = e.JoystickId; + Axis = e.Axis; + Position = e.Position; + } + + /// Index of the joystick which triggered the event + public uint JoystickId; + + /// Joystick axis (see JoyAxis enum) + public JoyAxis Axis; + + /// Current position of the axis + public float Position; + } + + //////////////////////////////////////////////////////////// + /// + /// Joystick buttons event parameters + /// + //////////////////////////////////////////////////////////// + public class JoyButtonEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the joystick button arguments from a joystick button event + /// + /// Joystick button event + //////////////////////////////////////////////////////////// + public JoyButtonEventArgs(JoyButtonEvent e) + { + JoystickId = e.JoystickId; + Button = e.Button; + } + + /// Index of the joystick which triggered the event + public uint JoystickId; + + /// Index of the button + public uint Button; + } + + //////////////////////////////////////////////////////////// + /// + /// Size event parameters + /// + //////////////////////////////////////////////////////////// + public class SizeEventArgs : EventArgs + { + //////////////////////////////////////////////////////////// + /// + /// Construct the size arguments from a size event + /// + /// Size event + //////////////////////////////////////////////////////////// + public SizeEventArgs(SizeEvent e) + { + Width = e.Width; + Height = e.Height; + } + + /// New width of the window + public uint Width; + + /// New height of the window + public uint Height; + } + } +} diff --git a/dotnet/src/Window/Input.cs b/dotnet/src/Window/Input.cs new file mode 100644 index 00000000..8612bd03 --- /dev/null +++ b/dotnet/src/Window/Input.cs @@ -0,0 +1,133 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace SFML +{ + namespace Window + { + //////////////////////////////////////////////////////////// + /// + /// Input handles real-time input from keyboard and mouse. + /// Use it instead of events to handle continuous moves and more + /// game-friendly inputs + /// + //////////////////////////////////////////////////////////// + public class Input : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Get the state of a key + /// + /// Key to check + /// True if key is down, false if key is up + //////////////////////////////////////////////////////////// + public bool IsKeyDown(KeyCode key) + { + return sfInput_IsKeyDown(This, key); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the state of a mouse button + /// + /// Button to check + /// True if button is down, false if button is up + //////////////////////////////////////////////////////////// + public bool IsMouseButtonDown(MouseButton button) + { + return sfInput_IsMouseButtonDown(This, button); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the state of a joystick button + /// + /// Identifier of the joystick to check (0 or 1) + /// Button to check + /// True if button is down, false if button is up + //////////////////////////////////////////////////////////// + public bool IsJoystickButtonDown(uint joystickId, uint button) + { + return sfInput_IsJoystickButtonDown(This, joystickId, button); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the mouse X position + /// + /// Current mouse left position, relative to owner window + //////////////////////////////////////////////////////////// + public int GetMouseX() + { + return sfInput_GetMouseX(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Get the mouse Y position + /// + /// Current mouse top position, relative to owner window + //////////////////////////////////////////////////////////// + public int GetMouseY() + { + return sfInput_GetMouseY(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Get a joystick axis position + /// + /// Identifier of the joystick to check (0 or 1) + /// Axis to get + /// Current axis position, in the range [-100, 100] (except for POV, which is [0, 360]) + //////////////////////////////////////////////////////////// + public float GetJoystickAxis(uint joystickId, JoyAxis axis) + { + return sfInput_GetJoystickAxis(This, joystickId, axis); + } + + //////////////////////////////////////////////////////////// + /// + /// For internal use only, construct the instance from a direct pointer to the internal object + /// + /// Internal pointer to the input object + //////////////////////////////////////////////////////////// + public Input(IntPtr thisPtr) : + base(thisPtr) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + // Nothing to do here, Input instances are owned by the C library + } + + #region Imports + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern bool sfInput_IsKeyDown(IntPtr This, KeyCode Key); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern bool sfInput_IsMouseButtonDown(IntPtr This, MouseButton Button); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern bool sfInput_IsJoystickButtonDown(IntPtr This, uint JoyId, uint Button); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern int sfInput_GetMouseX(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern int sfInput_GetMouseY(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern float sfInput_GetJoystickAxis(IntPtr This, uint JoyId, JoyAxis Axis); + #endregion + } + } +} diff --git a/dotnet/src/Window/LoadingFailedException.cs b/dotnet/src/Window/LoadingFailedException.cs new file mode 100644 index 00000000..cea37d27 --- /dev/null +++ b/dotnet/src/Window/LoadingFailedException.cs @@ -0,0 +1,84 @@ +using System; +using System.Runtime.Serialization; + +namespace SFML +{ + //////////////////////////////////////////////////////////// + /// + /// Exception thrown by SFML whenever loading a resource fails + /// + //////////////////////////////////////////////////////////// + [Serializable] + public class LoadingFailedException : Exception + { + //////////////////////////////////////////////////////////// + /// + /// Default constructor (unknown error) + /// + //////////////////////////////////////////////////////////// + public LoadingFailedException() : + base("Failed to load a resource") + { + } + + //////////////////////////////////////////////////////////// + /// + /// Failure to load a resource from memory + /// + /// Name of the resource + //////////////////////////////////////////////////////////// + public LoadingFailedException(string resourceName) : + base("Failed to load " + resourceName + " from memory") + { + } + + //////////////////////////////////////////////////////////// + /// + /// Failure to load a resource from memory + /// + /// Name of the resource + /// Exception which is the cause ofthe current exception + //////////////////////////////////////////////////////////// + public LoadingFailedException(string resourceName, Exception innerException) : + base("Failed to load " + resourceName + " from memory", innerException) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Failure to load a resource from a file + /// + /// Name of the resource + /// Path of the file + //////////////////////////////////////////////////////////// + public LoadingFailedException(string resourceName, string filename) : + base("Failed to load " + resourceName + " from file " + filename) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Failure to load a resource from a file + /// + /// Name of the resource + /// Path of the file + /// Exception which is the cause ofthe current exception + //////////////////////////////////////////////////////////// + public LoadingFailedException(string resourceName, string filename, Exception innerException) : + base("Failed to load " + resourceName + " from file " + filename, innerException) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Initialize an instance of the exception with serialized data + /// + /// Serialized data + /// Contextual informations + //////////////////////////////////////////////////////////// + public LoadingFailedException(SerializationInfo info, StreamingContext context) : + base(info, context) + { + } + } +} diff --git a/dotnet/src/Window/ObjectBase.cs b/dotnet/src/Window/ObjectBase.cs new file mode 100644 index 00000000..6c3b08b5 --- /dev/null +++ b/dotnet/src/Window/ObjectBase.cs @@ -0,0 +1,93 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + //////////////////////////////////////////////////////////// + /// + /// The ObjectBase class is an abstract base for every + /// SFML object. It's meant for internal use only + /// + //////////////////////////////////////////////////////////// + public abstract class ObjectBase : IDisposable + { + //////////////////////////////////////////////////////////// + /// + /// Construct the object from a pointer to the C library object + /// + /// Internal pointer to the object in the C libraries + //////////////////////////////////////////////////////////// + public ObjectBase(IntPtr thisPtr) + { + myThis = thisPtr; + } + + //////////////////////////////////////////////////////////// + /// + /// Dispose the object + /// + //////////////////////////////////////////////////////////// + ~ObjectBase() + { + Dispose(false); + } + + //////////////////////////////////////////////////////////// + /// + /// Access to the internal pointer of the object. + /// For internal use only + /// + //////////////////////////////////////////////////////////// + public IntPtr This + { + get {return myThis;} + } + + //////////////////////////////////////////////////////////// + /// + /// Explicitely dispose the object + /// + //////////////////////////////////////////////////////////// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + //////////////////////////////////////////////////////////// + /// + /// Destroy the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + private void Dispose(bool disposing) + { + if (myThis != IntPtr.Zero) + { + Destroy(disposing); + myThis = IntPtr.Zero; + } + } + + //////////////////////////////////////////////////////////// + /// + /// Destroy the object (implementation is left to each derived class) + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected abstract void Destroy(bool disposing); + + //////////////////////////////////////////////////////////// + /// + /// Set the pointer to the internal object. For internal use only + /// + /// Pointer to the internal object in C library + //////////////////////////////////////////////////////////// + protected void SetThis(IntPtr thisPtr) + { + myThis = thisPtr; + } + + private IntPtr myThis = IntPtr.Zero; + } +} diff --git a/dotnet/src/Window/VideoMode.cs b/dotnet/src/Window/VideoMode.cs new file mode 100644 index 00000000..82476902 --- /dev/null +++ b/dotnet/src/Window/VideoMode.cs @@ -0,0 +1,55 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Window + { + //////////////////////////////////////////////////////////// + /// + /// VideoMode defines a video mode (width, height, bpp, frequency) + /// and provides static functions for getting modes supported + /// by the display device + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct VideoMode + { + //////////////////////////////////////////////////////////// + /// + /// Construct the video mode with its width and height + /// + /// Video mode width + /// Video mode height + //////////////////////////////////////////////////////////// + public VideoMode(uint width, uint height) : + this(width, height, 32) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the video mode with its width, height and depth + /// + /// Video mode width + /// Video mode height + /// Video mode depth (bits per pixel) + //////////////////////////////////////////////////////////// + public VideoMode(uint width, uint height, uint bpp) + { + Width = width; + Height = height; + BitsPerPixel = bpp; + } + + /// Video mode width, in pixels + public uint Width; + + /// Video mode height, in pixels + public uint Height; + + /// Video mode depth, in bits per pixel + public uint BitsPerPixel; + } + } +} diff --git a/dotnet/src/Window/Window.cs b/dotnet/src/Window/Window.cs new file mode 100644 index 00000000..51041e9b --- /dev/null +++ b/dotnet/src/Window/Window.cs @@ -0,0 +1,613 @@ +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Security; + +namespace SFML +{ + namespace Window + { + //////////////////////////////////////////////////////////// + /// + /// Enumeration of window creation styles + /// + //////////////////////////////////////////////////////////// + [Flags] + public enum Styles + { + /// No border / title bar (this flag and all others are mutually exclusive) + None = 0, + + /// Title bar + fixed border + Titlebar = 1 << 0, + + /// Titlebar + resizable border + maximize button + Resize = 1 << 1, + + /// Titlebar + close button + Close = 1 << 2, + + /// Fullscreen mode (this flag and all others are mutually exclusive)) + Fullscreen = 1 << 3 + } + + //////////////////////////////////////////////////////////// + /// + /// Window is a rendering window ; it can create a new window + /// or connect to an existing one + /// + //////////////////////////////////////////////////////////// + public class Window : ObjectBase + { + //////////////////////////////////////////////////////////// + /// + /// Create the window with default style and creation settings + /// + /// Video mode to use + /// Title of the window + //////////////////////////////////////////////////////////// + public Window(VideoMode mode, string title) : + this(mode, title, Styles.Resize | Styles.Close, new WindowSettings(24, 8, 0)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window with default creation settings + /// + /// Video mode to use + /// Title of the window + /// Window style (Resize | Close by default) + //////////////////////////////////////////////////////////// + public Window(VideoMode mode, string title, Styles style) : + this(mode, title, style, new WindowSettings(24, 8, 0)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window + /// + /// Video mode to use + /// Title of the window + /// Window style (Resize | Close by default) + /// Creation parameters + //////////////////////////////////////////////////////////// + public Window(VideoMode mode, string title, Styles style, WindowSettings settings) : + base(sfWindow_Create(mode, title, style, settings)) + { + myInput = new Input(sfWindow_GetInput(This)); + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window from an existing control with default creation settings + /// + /// Platform-specific handle of the control + //////////////////////////////////////////////////////////// + public Window(IntPtr handle) : + this(handle, new WindowSettings(24, 8, 0)) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Create the window from an existing control + /// + /// Platform-specific handle of the control + /// Creation parameters + //////////////////////////////////////////////////////////// + public Window(IntPtr Handle, WindowSettings settings) : + base(sfWindow_CreateFromHandle(Handle, settings)) + { + myInput = new Input(sfWindow_GetInput(This)); + } + + //////////////////////////////////////////////////////////// + /// + /// Return the list of window's events which happened since last call + /// + /// Array of events + //////////////////////////////////////////////////////////// + public Event[] Events + { + get + { + Event Evt; + List Evts = new List(); + while (GetEvent(out Evt)) + Evts.Add(Evt); + + return Evts.ToArray(); + } + } + + //////////////////////////////////////////////////////////// + /// + /// Input manager of the window + /// + //////////////////////////////////////////////////////////// + public Input Input + { + get {return myInput;} + } + + //////////////////////////////////////////////////////////// + /// + /// Tell whether or not the window is opened (ie. has been created). + /// Note that a hidden window (Show(false)) + /// will still return true + /// + /// True if the window is opened + //////////////////////////////////////////////////////////// + public virtual bool IsOpened() + { + return sfWindow_IsOpened(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Close (destroy) the window. + /// The Window instance remains valid and you can call + /// Create to recreate the window + /// + //////////////////////////////////////////////////////////// + public virtual void Close() + { + sfWindow_Close(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Display the window on screen + /// + //////////////////////////////////////////////////////////// + public virtual void Display() + { + sfWindow_Display(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Width of the rendering region of the window + /// + //////////////////////////////////////////////////////////// + public virtual uint Width + { + get { return sfWindow_GetWidth(This); } + } + + //////////////////////////////////////////////////////////// + /// + /// Height of the rendering region of the window + /// + //////////////////////////////////////////////////////////// + public virtual uint Height + { + get { return sfWindow_GetHeight(This); } + } + + //////////////////////////////////////////////////////////// + /// + /// Creation settings of the window + /// + //////////////////////////////////////////////////////////// + public virtual WindowSettings Settings + { + get { return sfWindow_GetSettings(This); } + } + + //////////////////////////////////////////////////////////// + /// + /// Enable / disable vertical synchronization + /// + /// True to enable v-sync, false to deactivate + //////////////////////////////////////////////////////////// + public virtual void UseVerticalSync(bool enable) + { + sfWindow_UseVerticalSync(This, enable); + } + + //////////////////////////////////////////////////////////// + /// + /// Show or hide the mouse cursor + /// + /// True to show, false to hide + //////////////////////////////////////////////////////////// + public virtual void ShowMouseCursor(bool show) + { + sfWindow_ShowMouseCursor(This, show); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the position of the mouse cursor + /// + /// Left coordinate of the cursor, relative to the window + /// Top coordinate of the cursor, relative to the window + //////////////////////////////////////////////////////////// + public virtual void SetCursorPosition(uint x, uint y) + { + sfWindow_SetCursorPosition(This, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the position of the window on screen. + /// Only works for top-level windows + /// + /// Left position + /// Top position + //////////////////////////////////////////////////////////// + public virtual void SetPosition(int x, int y) + { + sfWindow_SetPosition(This, x, y); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the size of the rendering region of the window + /// + /// New width + /// New height + //////////////////////////////////////////////////////////// + public virtual void SetSize(uint width, uint height) + { + sfWindow_SetSize(This, width, height); + } + + //////////////////////////////////////////////////////////// + /// + /// Show or hide the window + /// + /// True to show, false to hide + //////////////////////////////////////////////////////////// + public virtual void Show(bool show) + { + sfWindow_Show(This, show); + } + + //////////////////////////////////////////////////////////// + /// + /// Enable or disable automatic key-repeat. + /// Automatic key-repeat is enabled by default + /// + /// True to enable, false to disable + //////////////////////////////////////////////////////////// + public virtual void EnableKeyRepeat(bool enable) + { + sfWindow_EnableKeyRepeat(This, enable); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the window's icon + /// + /// Icon's width, in pixels + /// Icon's height, in pixels + /// Array of pixels, format must be RGBA 32 bits + //////////////////////////////////////////////////////////// + public virtual void SetIcon(uint width, uint height, byte[] pixels) + { + unsafe + { + fixed (byte* PixelsPtr = pixels) + { + sfWindow_SetIcon(This, width, height, PixelsPtr); + } + } + } + + //////////////////////////////////////////////////////////// + /// + /// Activate the window as the current target + /// for rendering + /// + /// True if operation was successful, false otherwise + //////////////////////////////////////////////////////////// + public virtual bool SetActive() + { + return SetActive(true); + } + + //////////////////////////////////////////////////////////// + /// + /// Activate of deactivate the window as the current target + /// for rendering + /// + /// True to activate, false to deactivate (true by default) + /// True if operation was successful, false otherwise + //////////////////////////////////////////////////////////// + public virtual bool SetActive(bool active) + { + return sfWindow_SetActive(This, active); + } + + //////////////////////////////////////////////////////////// + /// + /// Limit the framerate to a maximum fixed frequency + /// + /// Framerate limit, in frames per seconds (use 0 to disable limit) + //////////////////////////////////////////////////////////// + public virtual void SetFramerateLimit(uint limit) + { + sfWindow_SetFramerateLimit(This, limit); + } + + //////////////////////////////////////////////////////////// + /// + /// Get time elapsed since last frame + /// + /// Time elapsed, in seconds + //////////////////////////////////////////////////////////// + public virtual float GetFrameTime() + { + return sfWindow_GetFrameTime(This); + } + + //////////////////////////////////////////////////////////// + /// + /// Change the joystick threshold, ie. the value below which + /// no move event will be generated + /// + /// New threshold, in range [0, 100] + //////////////////////////////////////////////////////////// + public virtual void SetJoystickThreshold(float threshold) + { + sfWindow_SetJoystickThreshold(This, threshold); + } + + //////////////////////////////////////////////////////////// + /// + /// Call the event handlers for each pending event. + /// Use of this function is exclusive with the Events property (use one or the other) + /// + //////////////////////////////////////////////////////////// + public void DispatchEvents() + { + foreach (Event e in Events) + { + switch (e.Type) + { + case EventType.Closed : + if (Closed != null) + Closed(this, EventArgs.Empty); + break; + + case EventType.GainedFocus : + if (GainedFocus != null) + GainedFocus(this, EventArgs.Empty); + break; + + case EventType.JoyButtonPressed : + if (JoyButtonPressed != null) + JoyButtonPressed(this, new JoyButtonEventArgs(e.JoyButton)); + break; + + case EventType.JoyButtonReleased : + if (JoyButtonReleased != null) + JoyButtonReleased(this, new JoyButtonEventArgs(e.JoyButton)); + break; + + case EventType.JoyMoved : + if (JoyMoved != null) + JoyMoved(this, new JoyMoveEventArgs(e.JoyMove)); + break; + + case EventType.KeyPressed : + if (KeyPressed != null) + KeyPressed(this, new KeyEventArgs(e.Key)); + break; + + case EventType.KeyReleased : + if (KeyReleased != null) + KeyReleased(this, new KeyEventArgs(e.Key)); + break; + + case EventType.LostFocus : + if (LostFocus != null) + LostFocus(this, EventArgs.Empty); + break; + + case EventType.MouseButtonPressed : + if (MouseButtonPressed != null) + MouseButtonPressed(this, new MouseButtonEventArgs(e.MouseButton)); + break; + + case EventType.MouseButtonReleased : + if (MouseButtonReleased != null) + MouseButtonReleased(this, new MouseButtonEventArgs(e.MouseButton)); + break; + + case EventType.MouseEntered : + if (MouseEntered != null) + MouseEntered(this, EventArgs.Empty); + break; + + case EventType.MouseLeft : + if (MouseLeft != null) + MouseLeft(this, EventArgs.Empty); + break; + + case EventType.MouseMoved : + if (MouseMoved != null) + MouseMoved(this, new MouseMoveEventArgs(e.MouseMove)); + break; + + case EventType.MouseWheelMoved : + if (MouseWheelMoved != null) + MouseWheelMoved(this, new MouseWheelEventArgs(e.MouseWheel)); + break; + + case EventType.Resized : + if (Resized != null) + Resized(this, new SizeEventArgs(e.Size)); + break; + + case EventType.TextEntered : + if (TextEntered != null) + TextEntered(this, new TextEventArgs(e.Text)); + break; + } + } + } + + //////////////////////////////////////////////////////////// + /// + /// Constructor for derived classes + /// + /// Pointer to the internal object + /// Internal hack :) + //////////////////////////////////////////////////////////// + protected Window(IntPtr thisPtr, int dummy) : + base(thisPtr) + { + // TODO : find a cleaner way of separating this constructor from Window(IntPtr handle) + } + + //////////////////////////////////////////////////////////// + /// + /// Internal function to get the next event + /// + /// Variable to fill with the raw pointer to the event structure + /// True if there was an event, false otherwise + //////////////////////////////////////////////////////////// + protected virtual bool GetEvent(out Event eventToFill) + { + return sfWindow_GetEvent(This, out eventToFill); + } + + //////////////////////////////////////////////////////////// + /// + /// Handle the destruction of the object + /// + /// Is the GC disposing the object, or is it an explicit call ? + //////////////////////////////////////////////////////////// + protected override void Destroy(bool disposing) + { + sfWindow_Destroy(This); + } + + /// Event handler for the Closed event + public event EventHandler Closed = null; + + /// Event handler for the Resized event + public event EventHandler Resized = null; + + /// Event handler for the LostFocus event + public event EventHandler LostFocus = null; + + /// Event handler for the GainedFocus event + public event EventHandler GainedFocus = null; + + /// Event handler for the TextEntered event + public event EventHandler TextEntered = null; + + /// Event handler for the KeyPressed event + public event EventHandler KeyPressed = null; + + /// Event handler for the KeyReleased event + public event EventHandler KeyReleased = null; + + /// Event handler for the MouseWheelMoved event + public event EventHandler MouseWheelMoved = null; + + /// Event handler for the MouseButtonPressed event + public event EventHandler MouseButtonPressed = null; + + /// Event handler for the MouseButtonReleased event + public event EventHandler MouseButtonReleased = null; + + /// Event handler for the MouseMoved event + public event EventHandler MouseMoved = null; + + /// Event handler for the MouseEntered event + public event EventHandler MouseEntered = null; + + /// Event handler for the MouseLeft event + public event EventHandler MouseLeft = null; + + /// Event handler for the JoyButtonPressed event + public event EventHandler JoyButtonPressed = null; + + /// Event handler for the JoyButtonReleased event + public event EventHandler JoyButtonReleased = null; + + /// Event handler for the JoyMoved event + public event EventHandler JoyMoved = null; + + protected Input myInput = null; + + #region Imports + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfWindow_Create(VideoMode Mode, string Title, Styles Style, WindowSettings Params); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfWindow_CreateFromHandle(IntPtr Handle, WindowSettings Params); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_Destroy(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern IntPtr sfWindow_GetInput(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern bool sfWindow_IsOpened(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_Close(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern bool sfWindow_GetEvent(IntPtr This, out Event Evt); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_Display(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern uint sfWindow_GetWidth(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern uint sfWindow_GetHeight(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern WindowSettings sfWindow_GetSettings(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_UseVerticalSync(IntPtr This, bool Enable); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_ShowMouseCursor(IntPtr This, bool Show); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_SetCursorPosition(IntPtr This, uint X, uint Y); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_SetPosition(IntPtr This, int X, int Y); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_SetSize(IntPtr This, uint Width, uint Height); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_Show(IntPtr This, bool Show); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_EnableKeyRepeat(IntPtr This, bool Enable); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + unsafe static extern void sfWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern bool sfWindow_SetActive(IntPtr This, bool Active); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_SetFramerateLimit(IntPtr This, uint Limit); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern float sfWindow_GetFrameTime(IntPtr This); + + [DllImport("csfml-window"), SuppressUnmanagedCodeSecurity] + static extern void sfWindow_SetJoystickThreshold(IntPtr This, float Threshold); + #endregion + } + } +} diff --git a/dotnet/src/Window/WindowSettings.cs b/dotnet/src/Window/WindowSettings.cs new file mode 100644 index 00000000..37533717 --- /dev/null +++ b/dotnet/src/Window/WindowSettings.cs @@ -0,0 +1,53 @@ +using System; +using System.Runtime.InteropServices; + +namespace SFML +{ + namespace Window + { + //////////////////////////////////////////////////////////// + /// + /// Structure defining the creation settings of windows + /// + //////////////////////////////////////////////////////////// + [StructLayout(LayoutKind.Sequential)] + public struct WindowSettings + { + //////////////////////////////////////////////////////////// + /// + /// Construct the settings from depth / stencil bits + /// + /// Depth buffer bits + /// Stencil buffer bits + //////////////////////////////////////////////////////////// + public WindowSettings(uint depthBits, uint stencilBits) : + this(depthBits, stencilBits, 0) + { + } + + //////////////////////////////////////////////////////////// + /// + /// Construct the settings from depth / stencil bits and antialiasing level + /// + /// Depth buffer bits + /// Stencil buffer bits + /// Antialiasing level + //////////////////////////////////////////////////////////// + public WindowSettings(uint depthBits, uint stencilBits, uint antialiasingLevel) + { + DepthBits = depthBits; + StencilBits = stencilBits; + AntialiasingLevel = antialiasingLevel; + } + + /// Depth buffer bits (0 is disabled) + public uint DepthBits; + + /// Stencil buffer bits (0 is disabled) + public uint StencilBits; + + /// Antialiasing level (0 is disabled) + public uint AntialiasingLevel; + } + } +} diff --git a/dotnet/src/Window/sfml-window.csproj b/dotnet/src/Window/sfml-window.csproj new file mode 100644 index 00000000..8711c8c4 --- /dev/null +++ b/dotnet/src/Window/sfml-window.csproj @@ -0,0 +1,58 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {D17DE83D-A592-461F-8AF2-53F9E22E1D0F} + Library + Properties + SFML.Window + sfmlnet-window + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + bin\window-doc.xml + + + pdbonly + true + ..\..\lib\ + TRACE + prompt + 4 + true + bin\window-doc.xml + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doxygen.css b/doxygen.css new file mode 100644 index 00000000..de219acf --- /dev/null +++ b/doxygen.css @@ -0,0 +1,384 @@ +div#logo +{ + margin-bottom : 1em; + background : url("./logo-bg.jpg") repeat-x; +} + +div#logo a +{ + display : block; +} + +p#footer +{ + text-decoration : overline; + color : #606060; + padding-top : 1em; + text-align : center; + font-size : smaller; +} + +p#footer a +{ + color : #007298; + text-decoration : none; +} + +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align : center; + margin-top : 0px; + color : #2090B0; + font-size : 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #E0FFE0; + border: 1px dotted #808080; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; border-bottom : 1px dotted #808080; color: black;} +A.code:visited { text-decoration: none; font-weight: normal; border-bottom : 1px dotted #808080; color: black;} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} +/*A:hover { text-decoration: none; background-color: #f2f2ff }*/ +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #0000FF } +SPAN.keywordtype { color: #0000FF } +SPAN.keywordflow { color: #0000FF } +SPAN.comment { color: #008000 } +SPAN.preprocessor { color: #008080 } +SPAN.stringliteral { color: #008080 } +SPAN.charliteral { color: #008080 } +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #2090B0; +} +a:visited { + color: #2090B0; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + /*padding: 4px;*/ + background-color: #F0FFF0; + border-width: 1px; + border-style: solid; + border-color: #808080; + /*-moz-border-radius: 8px 8px 8px 8px;*/ +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #D0FFD0; + width: 100%; + border-bottom-width: 1px; + border-bottom-style: dotted; + border-bottom-color: #808080; + font-weight: bold; + /*-moz-border-radius: 8px 8px 8px 8px;*/ +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } diff --git a/extlibs/bin/libsndfile-1.dll b/extlibs/bin/libsndfile-1.dll new file mode 100644 index 00000000..f112de2b Binary files /dev/null and b/extlibs/bin/libsndfile-1.dll differ diff --git a/extlibs/bin/openal32.dll b/extlibs/bin/openal32.dll new file mode 100644 index 00000000..28eb8e5b Binary files /dev/null and b/extlibs/bin/openal32.dll differ diff --git a/extlibs/headers/AL/al.h b/extlibs/headers/AL/al.h new file mode 100644 index 00000000..630b6ad5 --- /dev/null +++ b/extlibs/headers/AL/al.h @@ -0,0 +1,724 @@ +#ifndef AL_AL_H +#define AL_AL_H + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(_WIN32) && !defined(_XBOX) + /* _OPENAL32LIB is deprecated */ + #if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB) + #define AL_API __declspec(dllexport) + #else + #define AL_API __declspec(dllimport) + #endif +#else + #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY) + #define AL_API __attribute__((visibility("default"))) + #else + #define AL_API extern + #endif +#endif + +#if defined(_WIN32) + #define AL_APIENTRY __cdecl +#else + #define AL_APIENTRY +#endif + +#if defined(TARGET_OS_MAC) && TARGET_OS_MAC + #pragma export on +#endif + +/* + * The OPENAL, ALAPI, ALAPIENTRY, AL_INVALID, AL_ILLEGAL_ENUM, and + * AL_ILLEGAL_COMMAND macros are deprecated, but are included for + * applications porting code from AL 1.0 + */ +#define OPENAL +#define ALAPI AL_API +#define ALAPIENTRY AL_APIENTRY +#define AL_INVALID (-1) +#define AL_ILLEGAL_ENUM AL_INVALID_ENUM +#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION + +#define AL_VERSION_1_0 +#define AL_VERSION_1_1 + + +/** 8-bit boolean */ +typedef char ALboolean; + +/** character */ +typedef char ALchar; + +/** signed 8-bit 2's complement integer */ +typedef char ALbyte; + +/** unsigned 8-bit integer */ +typedef unsigned char ALubyte; + +/** signed 16-bit 2's complement integer */ +typedef short ALshort; + +/** unsigned 16-bit integer */ +typedef unsigned short ALushort; + +/** signed 32-bit 2's complement integer */ +typedef int ALint; + +/** unsigned 32-bit integer */ +typedef unsigned int ALuint; + +/** non-negative 32-bit binary integer size */ +typedef int ALsizei; + +/** enumerated 32-bit value */ +typedef int ALenum; + +/** 32-bit IEEE754 floating-point */ +typedef float ALfloat; + +/** 64-bit IEEE754 floating-point */ +typedef double ALdouble; + +/** void type (for opaque pointers only) */ +typedef void ALvoid; + + +/* Enumerant values begin at column 50. No tabs. */ + +/* "no distance model" or "no buffer" */ +#define AL_NONE 0 + +/* Boolean False. */ +#define AL_FALSE 0 + +/** Boolean True. */ +#define AL_TRUE 1 + +/** Indicate Source has relative coordinates. */ +#define AL_SOURCE_RELATIVE 0x202 + + + +/** + * Directional source, inner cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ +#define AL_CONE_INNER_ANGLE 0x1001 + +/** + * Directional source, outer cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ +#define AL_CONE_OUTER_ANGLE 0x1002 + +/** + * Specify the pitch to be applied, either at source, + * or on mixer results, at listener. + * Range: [0.5-2.0] + * Default: 1.0 + */ +#define AL_PITCH 0x1003 + +/** + * Specify the current location in three dimensional space. + * OpenAL, like OpenGL, uses a right handed coordinate system, + * where in a frontal default view X (thumb) points right, + * Y points up (index finger), and Z points towards the + * viewer/camera (middle finger). + * To switch from a left handed coordinate system, flip the + * sign on the Z coordinate. + * Listener position is always in the world coordinate system. + */ +#define AL_POSITION 0x1004 + +/** Specify the current direction. */ +#define AL_DIRECTION 0x1005 + +/** Specify the current velocity in three dimensional space. */ +#define AL_VELOCITY 0x1006 + +/** + * Indicate whether source is looping. + * Type: ALboolean? + * Range: [AL_TRUE, AL_FALSE] + * Default: FALSE. + */ +#define AL_LOOPING 0x1007 + +/** + * Indicate the buffer to provide sound samples. + * Type: ALuint. + * Range: any valid Buffer id. + */ +#define AL_BUFFER 0x1009 + +/** + * Indicate the gain (volume amplification) applied. + * Type: ALfloat. + * Range: ]0.0- ] + * A value of 1.0 means un-attenuated/unchanged. + * Each division by 2 equals an attenuation of -6dB. + * Each multiplicaton with 2 equals an amplification of +6dB. + * A value of 0.0 is meaningless with respect to a logarithmic + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. + */ +#define AL_GAIN 0x100A + +/* + * Indicate minimum source attenuation + * Type: ALfloat + * Range: [0.0 - 1.0] + * + * Logarthmic + */ +#define AL_MIN_GAIN 0x100D + +/** + * Indicate maximum source attenuation + * Type: ALfloat + * Range: [0.0 - 1.0] + * + * Logarthmic + */ +#define AL_MAX_GAIN 0x100E + +/** + * Indicate listener orientation. + * + * at/up + */ +#define AL_ORIENTATION 0x100F + +/** + * Source state information. + */ +#define AL_SOURCE_STATE 0x1010 +#define AL_INITIAL 0x1011 +#define AL_PLAYING 0x1012 +#define AL_PAUSED 0x1013 +#define AL_STOPPED 0x1014 + +/** + * Buffer Queue params + */ +#define AL_BUFFERS_QUEUED 0x1015 +#define AL_BUFFERS_PROCESSED 0x1016 + +/** + * Source buffer position information + */ +#define AL_SEC_OFFSET 0x1024 +#define AL_SAMPLE_OFFSET 0x1025 +#define AL_BYTE_OFFSET 0x1026 + +/* + * Source type (Static, Streaming or undetermined) + * Source is Static if a Buffer has been attached using AL_BUFFER + * Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers + * Source is undetermined when it has the NULL buffer attached + */ +#define AL_SOURCE_TYPE 0x1027 +#define AL_STATIC 0x1028 +#define AL_STREAMING 0x1029 +#define AL_UNDETERMINED 0x1030 + +/** Sound samples: format specifier. */ +#define AL_FORMAT_MONO8 0x1100 +#define AL_FORMAT_MONO16 0x1101 +#define AL_FORMAT_STEREO8 0x1102 +#define AL_FORMAT_STEREO16 0x1103 + +/** + * source specific reference distance + * Type: ALfloat + * Range: 0.0 - +inf + * + * At 0.0, no distance attenuation occurs. Default is + * 1.0. + */ +#define AL_REFERENCE_DISTANCE 0x1020 + +/** + * source specific rolloff factor + * Type: ALfloat + * Range: 0.0 - +inf + * + */ +#define AL_ROLLOFF_FACTOR 0x1021 + +/** + * Directional source, outer cone gain. + * + * Default: 0.0 + * Range: [0.0 - 1.0] + * Logarithmic + */ +#define AL_CONE_OUTER_GAIN 0x1022 + +/** + * Indicate distance above which sources are not + * attenuated using the inverse clamped distance model. + * + * Default: +inf + * Type: ALfloat + * Range: 0.0 - +inf + */ +#define AL_MAX_DISTANCE 0x1023 + +/** + * Sound samples: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ +#define AL_FREQUENCY 0x2001 +#define AL_BITS 0x2002 +#define AL_CHANNELS 0x2003 +#define AL_SIZE 0x2004 + +/** + * Buffer state. + * + * Not supported for public use (yet). + */ +#define AL_UNUSED 0x2010 +#define AL_PENDING 0x2011 +#define AL_PROCESSED 0x2012 + + +/** Errors: No Error. */ +#define AL_NO_ERROR AL_FALSE + +/** + * Invalid Name paramater passed to AL call. + */ +#define AL_INVALID_NAME 0xA001 + +/** + * Invalid parameter passed to AL call. + */ +#define AL_INVALID_ENUM 0xA002 + +/** + * Invalid enum parameter value. + */ +#define AL_INVALID_VALUE 0xA003 + +/** + * Illegal call. + */ +#define AL_INVALID_OPERATION 0xA004 + + +/** + * No mojo. + */ +#define AL_OUT_OF_MEMORY 0xA005 + + +/** Context strings: Vendor Name. */ +#define AL_VENDOR 0xB001 +#define AL_VERSION 0xB002 +#define AL_RENDERER 0xB003 +#define AL_EXTENSIONS 0xB004 + +/** Global tweakage. */ + +/** + * Doppler scale. Default 1.0 + */ +#define AL_DOPPLER_FACTOR 0xC000 + +/** + * Tweaks speed of propagation. + */ +#define AL_DOPPLER_VELOCITY 0xC001 + +/** + * Speed of Sound in units per second + */ +#define AL_SPEED_OF_SOUND 0xC003 + +/** + * Distance models + * + * used in conjunction with DistanceModel + * + * implicit: NONE, which disances distance attenuation. + */ +#define AL_DISTANCE_MODEL 0xD000 +#define AL_INVERSE_DISTANCE 0xD001 +#define AL_INVERSE_DISTANCE_CLAMPED 0xD002 +#define AL_LINEAR_DISTANCE 0xD003 +#define AL_LINEAR_DISTANCE_CLAMPED 0xD004 +#define AL_EXPONENT_DISTANCE 0xD005 +#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006 + +/* + * Renderer State management + */ +AL_API void AL_APIENTRY alEnable( ALenum capability ); + +AL_API void AL_APIENTRY alDisable( ALenum capability ); + +AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability ); + + +/* + * State retrieval + */ +AL_API const ALchar* AL_APIENTRY alGetString( ALenum param ); + +AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data ); + +AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data ); + +AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data ); + +AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data ); + +AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param ); + +AL_API ALint AL_APIENTRY alGetInteger( ALenum param ); + +AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param ); + +AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param ); + + +/* + * Error support. + * Obtain the most recent error generated in the AL state machine. + */ +AL_API ALenum AL_APIENTRY alGetError( void ); + + +/* + * Extension support. + * Query for the presence of an extension, and obtain any appropriate + * function pointers and enum values. + */ +AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname ); + +AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname ); + +AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename ); + + +/* + * LISTENER + * Listener represents the location and orientation of the + * 'user' in 3D-space. + * + * Properties include: - + * + * Gain AL_GAIN ALfloat + * Position AL_POSITION ALfloat[3] + * Velocity AL_VELOCITY ALfloat[3] + * Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors) +*/ + +/* + * Set Listener parameters + */ +AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value ); + +AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); + +AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values ); + +AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value ); + +AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 ); + +AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values ); + +/* + * Get Listener parameters + */ +AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value ); + +AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); + +AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values ); + +AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value ); + +AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); + +AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values ); + + +/** + * SOURCE + * Sources represent individual sound objects in 3D-space. + * Sources take the PCM data provided in the specified Buffer, + * apply Source-specific modifications, and then + * submit them to be mixed according to spatial arrangement etc. + * + * Properties include: - + * + * Gain AL_GAIN ALfloat + * Min Gain AL_MIN_GAIN ALfloat + * Max Gain AL_MAX_GAIN ALfloat + * Position AL_POSITION ALfloat[3] + * Velocity AL_VELOCITY ALfloat[3] + * Direction AL_DIRECTION ALfloat[3] + * Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE) + * Reference Distance AL_REFERENCE_DISTANCE ALfloat + * Max Distance AL_MAX_DISTANCE ALfloat + * RollOff Factor AL_ROLLOFF_FACTOR ALfloat + * Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat + * Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat + * Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat + * Pitch AL_PITCH ALfloat + * Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE) + * MS Offset AL_MSEC_OFFSET ALint or ALfloat + * Byte Offset AL_BYTE_OFFSET ALint or ALfloat + * Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat + * Attached Buffer AL_BUFFER ALint + * State (Query only) AL_SOURCE_STATE ALint + * Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint + * Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint + */ + +/* Create Source objects */ +AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources ); + +/* Delete Source objects */ +AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources ); + +/* Verify a handle is a valid Source */ +AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid ); + +/* + * Set Source parameters + */ +AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value ); + +AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); + +AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values ); + +AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value ); + +AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); + +AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values ); + +/* + * Get Source parameters + */ +AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value ); + +AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); + +AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values ); + +AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value ); + +AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); + +AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values ); + + +/* + * Source vector based playback calls + */ + +/* Play, replay, or resume (if paused) a list of Sources */ +AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids ); + +/* Stop a list of Sources */ +AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids ); + +/* Rewind a list of Sources */ +AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids ); + +/* Pause a list of Sources */ +AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids ); + +/* + * Source based playback calls + */ + +/* Play, replay, or resume a Source */ +AL_API void AL_APIENTRY alSourcePlay( ALuint sid ); + +/* Stop a Source */ +AL_API void AL_APIENTRY alSourceStop( ALuint sid ); + +/* Rewind a Source (set playback postiton to beginning) */ +AL_API void AL_APIENTRY alSourceRewind( ALuint sid ); + +/* Pause a Source */ +AL_API void AL_APIENTRY alSourcePause( ALuint sid ); + +/* + * Source Queuing + */ +AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids ); + +AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); + + +/** + * BUFFER + * Buffer objects are storage space for sample data. + * Buffers are referred to by Sources. One Buffer can be used + * by multiple Sources. + * + * Properties include: - + * + * Frequency (Query only) AL_FREQUENCY ALint + * Size (Query only) AL_SIZE ALint + * Bits (Query only) AL_BITS ALint + * Channels (Query only) AL_CHANNELS ALint + */ + +/* Create Buffer objects */ +AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers ); + +/* Delete Buffer objects */ +AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers ); + +/* Verify a handle is a valid Buffer */ +AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid ); + +/* Specify the data to be copied into a buffer */ +AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq ); + +/* + * Set Buffer parameters + */ +AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value ); + +AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); + +AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values ); + +AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value ); + +AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); + +AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values ); + +/* + * Get Buffer parameters + */ +AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value ); + +AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); + +AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values ); + +AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value ); + +AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); + +AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values ); + + +/* + * Global Parameters + */ +AL_API void AL_APIENTRY alDopplerFactor( ALfloat value ); + +AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value ); + +AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value ); + +AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel ); + +/* + * Pointer-to-function types, useful for dynamically getting AL entry points. + */ +typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability ); +typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability ); +typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability ); +typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param ); +typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data ); +typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data ); +typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data ); +typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data ); +typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param ); +typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param ); +typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param ); +typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param ); +typedef ALenum (AL_APIENTRY *LPALGETERROR)( void ); +typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname ); +typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname ); +typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename ); +typedef void (AL_APIENTRY *LPALLISTENERF)( ALenum param, ALfloat value ); +typedef void (AL_APIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void (AL_APIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values ); +typedef void (AL_APIENTRY *LPALLISTENERI)( ALenum param, ALint value ); +typedef void (AL_APIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void (AL_APIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values ); +typedef void (AL_APIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value ); +typedef void (AL_APIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); +typedef void (AL_APIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values ); +typedef void (AL_APIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value ); +typedef void (AL_APIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); +typedef void (AL_APIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values ); +typedef void (AL_APIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources ); +typedef void (AL_APIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources ); +typedef ALboolean (AL_APIENTRY *LPALISSOURCE)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value); +typedef void (AL_APIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void (AL_APIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values ); +typedef void (AL_APIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value); +typedef void (AL_APIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void (AL_APIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values ); +typedef void (AL_APIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value ); +typedef void (AL_APIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +typedef void (AL_APIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values ); +typedef void (AL_APIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value ); +typedef void (AL_APIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +typedef void (AL_APIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values ); +typedef void (AL_APIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCEPLAY)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCESTOP)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEREWIND)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEPAUSE)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids ); +typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids ); +typedef void (AL_APIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers ); +typedef void (AL_APIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers ); +typedef ALboolean (AL_APIENTRY *LPALISBUFFER)( ALuint bid ); +typedef void (AL_APIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq ); +typedef void (AL_APIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value); +typedef void (AL_APIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void (AL_APIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values ); +typedef void (AL_APIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value); +typedef void (AL_APIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void (AL_APIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values ); +typedef void (AL_APIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value ); +typedef void (AL_APIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +typedef void (AL_APIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values ); +typedef void (AL_APIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value ); +typedef void (AL_APIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +typedef void (AL_APIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values ); +typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value ); +typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value ); +typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value ); +typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel ); + +#if defined(TARGET_OS_MAC) && TARGET_OS_MAC + #pragma export off +#endif + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#endif /* AL_AL_H */ diff --git a/extlibs/headers/AL/alc.h b/extlibs/headers/AL/alc.h new file mode 100644 index 00000000..b0bbfbe7 --- /dev/null +++ b/extlibs/headers/AL/alc.h @@ -0,0 +1,281 @@ +#ifndef AL_ALC_H +#define AL_ALC_H + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(_WIN32) && !defined(_XBOX) + /* _OPENAL32LIB is deprecated */ + #if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB) + #define ALC_API __declspec(dllexport) + #else + #define ALC_API __declspec(dllimport) + #endif +#else + #if defined(AL_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY) + #define ALC_API __attribute__((visibility("default"))) + #else + #define ALC_API extern + #endif +#endif + +#if defined(_WIN32) + #define ALC_APIENTRY __cdecl +#else + #define ALC_APIENTRY +#endif + +#if defined(TARGET_OS_MAC) && TARGET_OS_MAC + #pragma export on +#endif + +/* + * The ALCAPI, ALCAPIENTRY, and ALC_INVALID macros are deprecated, but are + * included for applications porting code from AL 1.0 + */ +#define ALCAPI ALC_API +#define ALCAPIENTRY ALC_APIENTRY +#define ALC_INVALID 0 + + +#define ALC_VERSION_0_1 1 + +typedef struct ALCdevice_struct ALCdevice; +typedef struct ALCcontext_struct ALCcontext; + + +/** 8-bit boolean */ +typedef char ALCboolean; + +/** character */ +typedef char ALCchar; + +/** signed 8-bit 2's complement integer */ +typedef char ALCbyte; + +/** unsigned 8-bit integer */ +typedef unsigned char ALCubyte; + +/** signed 16-bit 2's complement integer */ +typedef short ALCshort; + +/** unsigned 16-bit integer */ +typedef unsigned short ALCushort; + +/** signed 32-bit 2's complement integer */ +typedef int ALCint; + +/** unsigned 32-bit integer */ +typedef unsigned int ALCuint; + +/** non-negative 32-bit binary integer size */ +typedef int ALCsizei; + +/** enumerated 32-bit value */ +typedef int ALCenum; + +/** 32-bit IEEE754 floating-point */ +typedef float ALCfloat; + +/** 64-bit IEEE754 floating-point */ +typedef double ALCdouble; + +/** void type (for opaque pointers only) */ +typedef void ALCvoid; + + +/* Enumerant values begin at column 50. No tabs. */ + +/* Boolean False. */ +#define ALC_FALSE 0 + +/* Boolean True. */ +#define ALC_TRUE 1 + +/** + * followed by Hz + */ +#define ALC_FREQUENCY 0x1007 + +/** + * followed by Hz + */ +#define ALC_REFRESH 0x1008 + +/** + * followed by AL_TRUE, AL_FALSE + */ +#define ALC_SYNC 0x1009 + +/** + * followed by Num of requested Mono (3D) Sources + */ +#define ALC_MONO_SOURCES 0x1010 + +/** + * followed by Num of requested Stereo Sources + */ +#define ALC_STEREO_SOURCES 0x1011 + +/** + * errors + */ + +/** + * No error + */ +#define ALC_NO_ERROR ALC_FALSE + +/** + * No device + */ +#define ALC_INVALID_DEVICE 0xA001 + +/** + * invalid context ID + */ +#define ALC_INVALID_CONTEXT 0xA002 + +/** + * bad enum + */ +#define ALC_INVALID_ENUM 0xA003 + +/** + * bad value + */ +#define ALC_INVALID_VALUE 0xA004 + +/** + * Out of memory. + */ +#define ALC_OUT_OF_MEMORY 0xA005 + + +/** + * The Specifier string for default device + */ +#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004 +#define ALC_DEVICE_SPECIFIER 0x1005 +#define ALC_EXTENSIONS 0x1006 + +#define ALC_MAJOR_VERSION 0x1000 +#define ALC_MINOR_VERSION 0x1001 + +#define ALC_ATTRIBUTES_SIZE 0x1002 +#define ALC_ALL_ATTRIBUTES 0x1003 + +/** + * ALC_ENUMERATE_ALL_EXT enums + */ +#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012 +#define ALC_ALL_DEVICES_SPECIFIER 0x1013 + +/** + * Capture extension + */ +#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310 +#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311 +#define ALC_CAPTURE_SAMPLES 0x312 + + +/* + * Context Management + */ +ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); + +ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context ); + +ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context ); + +ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context ); + +ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context ); + +ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void ); + +ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context ); + + +/* + * Device Management + */ +ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename ); + +ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device ); + + +/* + * Error support. + * Obtain the most recent Context error + */ +ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device ); + + +/* + * Extension support. + * Query for the presence of an extension, and obtain any appropriate + * function pointers and enum values. + */ +ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname ); + +ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname ); + +ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname ); + + +/* + * Query functions + */ +ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param ); + +ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data ); + + +/* + * Capture functions + */ +ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); + +ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device ); + +ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device ); + +ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device ); + +ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); + +/* + * Pointer-to-function types, useful for dynamically getting ALC entry points. + */ +typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist); +typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context ); +typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context ); +typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context ); +typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context ); +typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void ); +typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context ); +typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename ); +typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device ); +typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device ); +typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname ); +typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname ); +typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname ); +typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param ); +typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest ); +typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); +typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device ); +typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device ); +typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device ); +typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); + +#if defined(TARGET_OS_MAC) && TARGET_OS_MAC + #pragma export off +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* AL_ALC_H */ diff --git a/extlibs/headers/AL/alext.h b/extlibs/headers/AL/alext.h new file mode 100644 index 00000000..2c72d9cd --- /dev/null +++ b/extlibs/headers/AL/alext.h @@ -0,0 +1,69 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2008 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#ifndef AL_ALEXT_H +#define AL_ALEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef AL_EXT_float32 +#define AL_EXT_float32 1 +#define AL_FORMAT_MONO_FLOAT32 0x10010 +#define AL_FORMAT_STEREO_FLOAT32 0x10011 +#endif + +#ifndef AL_LOKI_quadriphonic +#define AL_LOKI_quadriphonic 1 +#define AL_FORMAT_QUAD8_LOKI 0x10004 +#define AL_FORMAT_QUAD16_LOKI 0x10005 +#endif + +#ifndef AL_EXT_MCFORMATS +#define AL_EXT_MCFORMATS 1 +#define AL_FORMAT_QUAD8 0x1204 +#define AL_FORMAT_QUAD16 0x1205 +#define AL_FORMAT_QUAD32 0x1206 +#define AL_FORMAT_REAR8 0x1207 +#define AL_FORMAT_REAR16 0x1208 +#define AL_FORMAT_REAR32 0x1209 +#define AL_FORMAT_51CHN8 0x120A +#define AL_FORMAT_51CHN16 0x120B +#define AL_FORMAT_51CHN32 0x120C +#define AL_FORMAT_61CHN8 0x120D +#define AL_FORMAT_61CHN16 0x120E +#define AL_FORMAT_61CHN32 0x120F +#define AL_FORMAT_71CHN8 0x1210 +#define AL_FORMAT_71CHN16 0x1211 +#define AL_FORMAT_71CHN32 0x1212 +#endif + +#ifndef AL_EXT_IMA4 +#define AL_EXT_IMA4 1 +#define AL_FORMAT_MONO_IMA4 0x1300 +#define AL_FORMAT_STEREO_IMA4 0x1301 +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/extlibs/headers/freetype/cache/ftccache.h b/extlibs/headers/freetype/cache/ftccache.h new file mode 100644 index 00000000..f2e10281 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftccache.h @@ -0,0 +1,319 @@ +/***************************************************************************/ +/* */ +/* ftccache.h */ +/* */ +/* FreeType internal cache interface (specification). */ +/* */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCCACHE_H__ +#define __FTCCACHE_H__ + + +#include FT_CACHE_INTERNAL_MRU_H + +FT_BEGIN_HEADER + + /* handle to cache object */ + typedef struct FTC_CacheRec_* FTC_Cache; + + /* handle to cache class */ + typedef const struct FTC_CacheClassRec_* FTC_CacheClass; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CACHE NODE DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* Each cache controls one or more cache nodes. Each node is part of */ + /* the global_lru list of the manager. Its `data' field however is used */ + /* as a reference count for now. */ + /* */ + /* A node can be anything, depending on the type of information held by */ + /* the cache. It can be an individual glyph image, a set of bitmaps */ + /* glyphs for a given size, some metrics, etc. */ + /* */ + /*************************************************************************/ + + /* structure size should be 20 bytes on 32-bits machines */ + typedef struct FTC_NodeRec_ + { + FTC_MruNodeRec mru; /* circular mru list pointer */ + FTC_Node link; /* used for hashing */ + FT_UInt32 hash; /* used for hashing too */ + FT_UShort cache_index; /* index of cache the node belongs to */ + FT_Short ref_count; /* reference count for this node */ + + } FTC_NodeRec; + + +#define FTC_NODE( x ) ( (FTC_Node)(x) ) +#define FTC_NODE_P( x ) ( (FTC_Node*)(x) ) + +#define FTC_NODE__NEXT(x) FTC_NODE( (x)->mru.next ) +#define FTC_NODE__PREV(x) FTC_NODE( (x)->mru.prev ) + + + /*************************************************************************/ + /* */ + /* These functions are exported so that they can be called from */ + /* user-provided cache classes; otherwise, they are really part of the */ + /* cache sub-system internals. */ + /* */ + + /* reserved for manager's use */ + FT_EXPORT( void ) + ftc_node_destroy( FTC_Node node, + FTC_Manager manager ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CACHE DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* initialize a new cache node */ + typedef FT_Error + (*FTC_Node_NewFunc)( FTC_Node *pnode, + FT_Pointer query, + FTC_Cache cache ); + + typedef FT_ULong + (*FTC_Node_WeightFunc)( FTC_Node node, + FTC_Cache cache ); + + /* compare a node to a given key pair */ + typedef FT_Bool + (*FTC_Node_CompareFunc)( FTC_Node node, + FT_Pointer key, + FTC_Cache cache ); + + + typedef void + (*FTC_Node_FreeFunc)( FTC_Node node, + FTC_Cache cache ); + + typedef FT_Error + (*FTC_Cache_InitFunc)( FTC_Cache cache ); + + typedef void + (*FTC_Cache_DoneFunc)( FTC_Cache cache ); + + + typedef struct FTC_CacheClassRec_ + { + FTC_Node_NewFunc node_new; + FTC_Node_WeightFunc node_weight; + FTC_Node_CompareFunc node_compare; + FTC_Node_CompareFunc node_remove_faceid; + FTC_Node_FreeFunc node_free; + + FT_UInt cache_size; + FTC_Cache_InitFunc cache_init; + FTC_Cache_DoneFunc cache_done; + + } FTC_CacheClassRec; + + + /* each cache really implements a dynamic hash table to manage its nodes */ + typedef struct FTC_CacheRec_ + { + FT_UFast p; + FT_UFast mask; + FT_Long slack; + FTC_Node* buckets; + + FTC_CacheClassRec clazz; /* local copy, for speed */ + + FTC_Manager manager; + FT_Memory memory; + FT_UInt index; /* in manager's table */ + + FTC_CacheClass org_class; /* original class pointer */ + + } FTC_CacheRec; + + +#define FTC_CACHE( x ) ( (FTC_Cache)(x) ) +#define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) ) + + + /* default cache initialize */ + FT_EXPORT( FT_Error ) + FTC_Cache_Init( FTC_Cache cache ); + + /* default cache finalizer */ + FT_EXPORT( void ) + FTC_Cache_Done( FTC_Cache cache ); + + /* Call this function to lookup the cache. If no corresponding + * node is found, a new one is automatically created. This function + * is capable of flushing the cache adequately to make room for the + * new cache object. + */ + FT_EXPORT( FT_Error ) + FTC_Cache_Lookup( FTC_Cache cache, + FT_UInt32 hash, + FT_Pointer query, + FTC_Node *anode ); + + FT_EXPORT( FT_Error ) + FTC_Cache_NewNode( FTC_Cache cache, + FT_UInt32 hash, + FT_Pointer query, + FTC_Node *anode ); + + /* Remove all nodes that relate to a given face_id. This is useful + * when un-installing fonts. Note that if a cache node relates to + * the face_id, but is locked (i.e., has 'ref_count > 0'), the node + * will _not_ be destroyed, but its internal face_id reference will + * be modified. + * + * The final result will be that the node will never come back + * in further lookup requests, and will be flushed on demand from + * the cache normally when its reference count reaches 0. + */ + FT_EXPORT( void ) + FTC_Cache_RemoveFaceID( FTC_Cache cache, + FTC_FaceID face_id ); + + +#ifdef FTC_INLINE + +#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \ + FT_BEGIN_STMNT \ + FTC_Node *_bucket, *_pnode, _node; \ + FTC_Cache _cache = FTC_CACHE(cache); \ + FT_UInt32 _hash = (FT_UInt32)(hash); \ + FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \ + FT_UInt _idx; \ + \ + \ + error = 0; \ + node = NULL; \ + _idx = _hash & _cache->mask; \ + if ( _idx < _cache->p ) \ + _idx = _hash & ( _cache->mask*2 + 1 ); \ + \ + _bucket = _pnode = _cache->buckets + _idx; \ + for (;;) \ + { \ + _node = *_pnode; \ + if ( _node == NULL ) \ + goto _NewNode; \ + \ + if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) ) \ + break; \ + \ + _pnode = &_node->link; \ + } \ + \ + if ( _node != *_bucket ) \ + { \ + *_pnode = _node->link; \ + _node->link = *_bucket; \ + *_bucket = _node; \ + } \ + \ + { \ + FTC_Manager _manager = _cache->manager; \ + \ + \ + if ( _node != _manager->nodes_list ) \ + FTC_MruNode_Up( (FTC_MruNode*)&_manager->nodes_list, \ + (FTC_MruNode)_node ); \ + } \ + goto _Ok; \ + \ + _NewNode: \ + error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \ + \ + _Ok: \ + _pnode = (FTC_Node*)(void*)&(node); \ + *_pnode = _node; \ + FT_END_STMNT + +#else /* !FTC_INLINE */ + +#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \ + FT_BEGIN_STMNT \ + error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, \ + (FTC_Node*)&(node) ); \ + FT_END_STMNT + +#endif /* !FTC_INLINE */ + + + /* + * This macro, together with FTC_CACHE_TRYLOOP_END, defines a retry + * loop to flush the cache repeatedly in case of memory overflows. + * + * It is used when creating a new cache node, or within a lookup + * that needs to allocate data (e.g., the sbit cache lookup). + * + * Example: + * + * { + * FTC_CACHE_TRYLOOP( cache ) + * error = load_data( ... ); + * FTC_CACHE_TRYLOOP_END() + * } + * + */ +#define FTC_CACHE_TRYLOOP( cache ) \ + { \ + FTC_Manager _try_manager = FTC_CACHE( cache )->manager; \ + FT_UInt _try_count = 4; \ + \ + \ + for (;;) \ + { \ + FT_UInt _try_done; + + +#define FTC_CACHE_TRYLOOP_END() \ + if ( !error || error != FT_Err_Out_Of_Memory ) \ + break; \ + \ + _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \ + if ( _try_done == 0 ) \ + break; \ + \ + if ( _try_done == _try_count ) \ + { \ + _try_count *= 2; \ + if ( _try_count < _try_done || \ + _try_count > _try_manager->num_nodes ) \ + _try_count = _try_manager->num_nodes; \ + } \ + } \ + } + + /* */ + +FT_END_HEADER + + +#endif /* __FTCCACHE_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/cache/ftccmap.h b/extlibs/headers/freetype/cache/ftccmap.h new file mode 100644 index 00000000..a41989b2 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftccmap.h @@ -0,0 +1,216 @@ +/***************************************************************************/ +/* */ +/* ftccmap.h */ +/* */ +/* FreeType charmap cache (specification). */ +/* */ +/* Copyright 2000-2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCCMAP_H__ +#define __FTCCMAP_H__ + +#include +#include FT_CACHE_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /*
*/ + /* cache_subsystem */ + /* */ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* @type: */ + /* FTC_CMapCache */ + /* */ + /* @description: */ + /* An opaque handle used to manager a charmap cache. This cache is */ + /* to hold character codes -> glyph indices mappings. */ + /* */ + typedef struct FTC_CMapCacheRec_* FTC_CMapCache; + + + /*************************************************************************/ + /* */ + /* @type: */ + /* FTC_CMapDesc */ + /* */ + /* @description: */ + /* A handle to an @FTC_CMapDescRec structure used to describe a given */ + /* charmap in a charmap cache. */ + /* */ + /* Each @FTC_CMapDesc describes which charmap (of which @FTC_FaceID) */ + /* we want to use in @FTC_CMapCache_Lookup. */ + /* */ + typedef struct FTC_CMapDescRec_* FTC_CMapDesc; + + + /*************************************************************************/ + /* */ + /* @enum: */ + /* FTC_CMapType */ + /* */ + /* @description: */ + /* The list of valid @FTC_CMapDesc types. They indicate how we want */ + /* to address a charmap within an @FTC_FaceID. */ + /* */ + /* @values: */ + /* FTC_CMAP_BY_INDEX :: */ + /* Address a charmap by its index in the corresponding @FT_Face. */ + /* */ + /* FTC_CMAP_BY_ENCODING :: */ + /* Use a @FT_Face charmap that corresponds to a given encoding. */ + /* */ + /* FTC_CMAP_BY_ID :: */ + /* Use an @FT_Face charmap that corresponds to a given */ + /* (platform,encoding) ID. See @FTC_CMapIdRec. */ + /* */ + typedef enum FTC_CMapType_ + { + FTC_CMAP_BY_INDEX = 0, + FTC_CMAP_BY_ENCODING = 1, + FTC_CMAP_BY_ID = 2 + + } FTC_CMapType; + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* FTC_CMapIdRec */ + /* */ + /* @description: */ + /* A short structure to identify a charmap by a (platform,encoding) */ + /* pair of values. */ + /* */ + /* @fields: */ + /* platform :: The platform ID. */ + /* */ + /* encoding :: The encoding ID. */ + /* */ + typedef struct FTC_CMapIdRec_ + { + FT_UInt platform; + FT_UInt encoding; + + } FTC_CMapIdRec; + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* FTC_CMapDescRec */ + /* */ + /* @description: */ + /* A structure to describe a given charmap to @FTC_CMapCache. */ + /* */ + /* @fields: */ + /* face_id :: @FTC_FaceID of the face this charmap belongs to. */ + /* */ + /* type :: The type of charmap, see @FTC_CMapType. */ + /* */ + /* u.index :: For @FTC_CMAP_BY_INDEX types, this is the charmap */ + /* index (within a @FT_Face) we want to use. */ + /* */ + /* u.encoding :: For @FTC_CMAP_BY_ENCODING types, this is the charmap */ + /* encoding we want to use. see @FT_Encoding. */ + /* */ + /* u.id :: For @FTC_CMAP_BY_ID types, this is the */ + /* (platform,encoding) pair we want to use. see */ + /* @FTC_CMapIdRec and @FT_CharMapRec. */ + /* */ + typedef struct FTC_CMapDescRec_ + { + FTC_FaceID face_id; + FTC_CMapType type; + + union + { + FT_UInt index; + FT_Encoding encoding; + FTC_CMapIdRec id; + + } u; + + } FTC_CMapDescRec; + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FTC_CMapCache_New */ + /* */ + /* @description: */ + /* Creates a new charmap cache. */ + /* */ + /* @input: */ + /* manager :: A handle to the cache manager. */ + /* */ + /* @output: */ + /* acache :: A new cache handle. NULL in case of error. */ + /* */ + /* @return: */ + /* FreeType error code. 0 means success. */ + /* */ + /* @note: */ + /* Like all other caches, this one will be destroyed with the cache */ + /* manager. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_CMapCache_New( FTC_Manager manager, + FTC_CMapCache *acache ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FTC_CMapCache_Lookup */ + /* */ + /* @description: */ + /* Translates a character code into a glyph index, using the charmap */ + /* cache. */ + /* */ + /* @input: */ + /* cache :: A charmap cache handle. */ + /* */ + /* cmap_desc :: A charmap descriptor handle. */ + /* */ + /* char_code :: The character code (in the corresponding charmap). */ + /* */ + /* @return: */ + /* Glyph index. 0 means "no glyph". */ + /* */ + /* @note: */ + /* This function doesn't return @FTC_Node handles, since there is no */ + /* real use for them with typical uses of charmaps. */ + /* */ + FT_EXPORT( FT_UInt ) + FTC_CMapCache_Lookup( FTC_CMapCache cache, + FTC_CMapDesc cmap_desc, + FT_UInt32 char_code ); + + /* */ + + +FT_END_HEADER + + +#endif /* __FTCCMAP_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/cache/ftcglyph.h b/extlibs/headers/freetype/cache/ftcglyph.h new file mode 100644 index 00000000..3f8301a5 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftcglyph.h @@ -0,0 +1,313 @@ +/***************************************************************************/ +/* */ +/* ftcglyph.h */ +/* */ +/* FreeType abstract glyph cache (specification). */ +/* */ +/* Copyright 2000-2001, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /* + * + * FTC_GCache is an _abstract_ cache object optimized to store glyph + * data. It works as follows: + * + * - It manages FTC_GNode objects. Each one of them can hold one or more + * glyph `items'. Item types are not specified in the FTC_GCache but + * in classes that extend it. + * + * - Glyph attributes, like face ID, character size, render mode, etc., + * can be grouped into abstract `glyph families'. This avoids storing + * the attributes within the FTC_GCache, since it is likely that many + * FTC_GNodes will belong to the same family in typical uses. + * + * - Each FTC_GNode is thus an FTC_Node with two additional fields: + * + * * gindex: A glyph index, or the first index in a glyph range. + * * family: A pointer to a glyph `family'. + * + * - Family types are not fully specific in the FTC_Family type, but + * by classes that extend it. + * + * Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache. + * They share an FTC_Family sub-class called FTC_BasicFamily which is + * used to store the following data: face ID, pixel/point sizes, load + * flags. For more details see the file `src/cache/ftcbasic.c'. + * + * Client applications can extend FTC_GNode with their own FTC_GNode + * and FTC_Family sub-classes to implement more complex caches (e.g., + * handling automatic synthesis, like obliquing & emboldening, colored + * glyphs, etc.). + * + * See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and + * `ftcsbits.h', which both extend FTC_GCache with additional + * optimizations. + * + * A typical FTC_GCache implementation must provide at least the + * following: + * + * - FTC_GNode sub-class, e.g. MyNode, with relevant methods: + * my_node_new (must call FTC_GNode_Init) + * my_node_free (must call FTC_GNode_Done) + * my_node_compare (must call FTC_GNode_Compare) + * my_node_remove_faceid (must call ftc_gnode_unselect in case + * of match) + * + * - FTC_Family sub-class, e.g. MyFamily, with relevant methods: + * my_family_compare + * my_family_init + * my_family_reset (optional) + * my_family_done + * + * - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query + * data. + * + * - Constant structures for a FTC_GNodeClass. + * + * - MyCacheNew() can be implemented easily as a call to the convenience + * function FTC_GCache_New. + * + * - MyCacheLookup with a call to FTC_GCache_Lookup. This function will + * automatically: + * + * - Search for the corresponding family in the cache, or create + * a new one if necessary. Put it in FTC_GQUERY(myquery).family + * + * - Call FTC_Cache_Lookup. + * + * If it returns NULL, you should create a new node, then call + * ftc_cache_add as usual. + */ + + + /*************************************************************************/ + /* */ + /* Important: The functions defined in this file are only used to */ + /* implement an abstract glyph cache class. You need to */ + /* provide additional logic to implement a complete cache. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********* *********/ + /********* WARNING, THIS IS BETA CODE. *********/ + /********* *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifndef __FTCGLYPH_H__ +#define __FTCGLYPH_H__ + + +#include +#include FT_CACHE_INTERNAL_MANAGER_H + + +FT_BEGIN_HEADER + + + /* + * We can group glyphs into `families'. Each family correspond to a + * given face ID, character size, transform, etc. + * + * Families are implemented as MRU list nodes. They are + * reference-counted. + */ + + typedef struct FTC_FamilyRec_ + { + FTC_MruNodeRec mrunode; + FT_UInt num_nodes; /* current number of nodes in this family */ + FTC_Cache cache; + FTC_MruListClass clazz; + + } FTC_FamilyRec, *FTC_Family; + +#define FTC_FAMILY(x) ( (FTC_Family)(x) ) +#define FTC_FAMILY_P(x) ( (FTC_Family*)(x) ) + + + typedef struct FTC_GNodeRec_ + { + FTC_NodeRec node; + FTC_Family family; + FT_UInt gindex; + + } FTC_GNodeRec, *FTC_GNode; + +#define FTC_GNODE( x ) ( (FTC_GNode)(x) ) +#define FTC_GNODE_P( x ) ( (FTC_GNode*)(x) ) + + + typedef struct FTC_GQueryRec_ + { + FT_UInt gindex; + FTC_Family family; + + } FTC_GQueryRec, *FTC_GQuery; + +#define FTC_GQUERY( x ) ( (FTC_GQuery)(x) ) + + + /*************************************************************************/ + /* */ + /* These functions are exported so that they can be called from */ + /* user-provided cache classes; otherwise, they are really part of the */ + /* cache sub-system internals. */ + /* */ + + /* must be called by derived FTC_Node_InitFunc routines */ + FT_EXPORT( void ) + FTC_GNode_Init( FTC_GNode node, + FT_UInt gindex, /* glyph index for node */ + FTC_Family family ); + + /* returns TRUE iff the query's glyph index correspond to the node; */ + /* this assumes that the "family" and "hash" fields of the query are */ + /* already correctly set */ + FT_EXPORT( FT_Bool ) + FTC_GNode_Compare( FTC_GNode gnode, + FTC_GQuery gquery ); + + /* call this function to clear a node's family -- this is necessary */ + /* to implement the `node_remove_faceid' cache method correctly */ + FT_EXPORT( void ) + FTC_GNode_UnselectFamily( FTC_GNode gnode, + FTC_Cache cache ); + + /* must be called by derived FTC_Node_DoneFunc routines */ + FT_EXPORT( void ) + FTC_GNode_Done( FTC_GNode node, + FTC_Cache cache ); + + + FT_EXPORT( void ) + FTC_Family_Init( FTC_Family family, + FTC_Cache cache ); + + typedef struct FTC_GCacheRec_ + { + FTC_CacheRec cache; + FTC_MruListRec families; + + } FTC_GCacheRec, *FTC_GCache; + +#define FTC_GCACHE( x ) ((FTC_GCache)(x)) + + + /* can be used as @FTC_Cache_InitFunc */ + FT_EXPORT( FT_Error ) + FTC_GCache_Init( FTC_GCache cache ); + + + /* can be used as @FTC_Cache_DoneFunc */ + FT_EXPORT( void ) + FTC_GCache_Done( FTC_GCache cache ); + + + /* the glyph cache class adds fields for the family implementation */ + typedef struct FTC_GCacheClassRec_ + { + FTC_CacheClassRec clazz; + FTC_MruListClass family_class; + + } FTC_GCacheClassRec; + + typedef const FTC_GCacheClassRec* FTC_GCacheClass; + +#define FTC_GCACHE_CLASS( x ) ((FTC_GCacheClass)(x)) + +#define FTC_CACHE__GCACHE_CLASS( x ) \ + FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class ) +#define FTC_CACHE__FAMILY_CLASS( x ) \ + ( (FTC_MruListClass)FTC_CACHE__GCACHE_CLASS( x )->family_class ) + + + /* convenience function; use it instead of FTC_Manager_Register_Cache */ + FT_EXPORT( FT_Error ) + FTC_GCache_New( FTC_Manager manager, + FTC_GCacheClass clazz, + FTC_GCache *acache ); + + FT_EXPORT( FT_Error ) + FTC_GCache_Lookup( FTC_GCache cache, + FT_UInt32 hash, + FT_UInt gindex, + FTC_GQuery query, + FTC_Node *anode ); + + + /* */ + + +#define FTC_FAMILY_FREE( family, cache ) \ + FTC_MruList_Remove( &FTC_GCACHE((cache))->families, \ + (FTC_MruNode)(family) ) + + +#ifdef FTC_INLINE + +#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \ + gindex, query, node, error ) \ + FT_BEGIN_STMNT \ + FTC_GCache _gcache = FTC_GCACHE( cache ); \ + FTC_GQuery _gquery = (FTC_GQuery)( query ); \ + FTC_MruNode_CompareFunc _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \ + \ + \ + _gquery->gindex = (gindex); \ + \ + FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare, \ + _gquery->family, error ); \ + if ( !error ) \ + { \ + FTC_Family _gqfamily = _gquery->family; \ + \ + \ + _gqfamily->num_nodes++; \ + \ + FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ); \ + \ + if ( --_gqfamily->num_nodes == 0 ) \ + FTC_FAMILY_FREE( _gqfamily, _gcache ); \ + } \ + FT_END_STMNT + /* */ + +#else /* !FTC_INLINE */ + +#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \ + gindex, query, node, error ) \ + FT_BEGIN_STMNT \ + error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \ + FTC_GQUERY( query ), (FTC_Node*)&(node) ); \ + FT_END_STMNT + +#endif /* !FTC_INLINE */ + + +FT_END_HEADER + + +#endif /* __FTCGLYPH_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/cache/ftcimage.h b/extlibs/headers/freetype/cache/ftcimage.h new file mode 100644 index 00000000..1bf12db1 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftcimage.h @@ -0,0 +1,104 @@ +/***************************************************************************/ +/* */ +/* ftcimage.h */ +/* */ +/* FreeType Generic Image cache (specification) */ +/* */ +/* Copyright 2000-2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /* + * FTC_ICache is an _abstract_ cache used to store a single FT_Glyph + * image per cache node. + * + * FTC_ICache extends FTC_GCache. For an implementation example, + * see FTC_ImageCache in `src/cache/ftbasic.c'. + */ + + + /*************************************************************************/ + /* */ + /* Each image cache really manages FT_Glyph objects. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTCIMAGE_H__ +#define __FTCIMAGE_H__ + + +#include +#include FT_CACHE_H +#include FT_CACHE_INTERNAL_GLYPH_H + +FT_BEGIN_HEADER + + + /* the FT_Glyph image node type - we store only 1 glyph per node */ + typedef struct FTC_INodeRec_ + { + FTC_GNodeRec gnode; + FT_Glyph glyph; + + } FTC_INodeRec, *FTC_INode; + +#define FTC_INODE( x ) ( (FTC_INode)( x ) ) +#define FTC_INODE_GINDEX( x ) FTC_GNODE(x)->gindex +#define FTC_INODE_FAMILY( x ) FTC_GNODE(x)->family + + typedef FT_Error + (*FTC_IFamily_LoadGlyphFunc)( FTC_Family family, + FT_UInt gindex, + FTC_Cache cache, + FT_Glyph *aglyph ); + + typedef struct FTC_IFamilyClassRec_ + { + FTC_MruListClassRec clazz; + FTC_IFamily_LoadGlyphFunc family_load_glyph; + + } FTC_IFamilyClassRec; + + typedef const FTC_IFamilyClassRec* FTC_IFamilyClass; + +#define FTC_IFAMILY_CLASS( x ) ((FTC_IFamilyClass)(x)) + +#define FTC_CACHE__IFAMILY_CLASS( x ) \ + FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class ) + + + /* can be used as a @FTC_Node_FreeFunc */ + FT_EXPORT( void ) + FTC_INode_Free( FTC_INode inode, + FTC_Cache cache ); + + /* Can be used as @FTC_Node_NewFunc. `gquery.index' and `gquery.family' + * must be set correctly. This function will call the `family_load_glyph' + * method to load the FT_Glyph into the cache node. + */ + FT_EXPORT( FT_Error ) + FTC_INode_New( FTC_INode *pinode, + FTC_GQuery gquery, + FTC_Cache cache ); + + /* can be used as @FTC_Node_WeightFunc */ + FT_EXPORT( FT_ULong ) + FTC_INode_Weight( FTC_INode inode ); + + /* */ + +FT_END_HEADER + +#endif /* __FTCIMAGE_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/cache/ftcmanag.h b/extlibs/headers/freetype/cache/ftcmanag.h new file mode 100644 index 00000000..52658482 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftcmanag.h @@ -0,0 +1,175 @@ +/***************************************************************************/ +/* */ +/* ftcmanag.h */ +/* */ +/* FreeType Cache Manager (specification). */ +/* */ +/* Copyright 2000-2001, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* A cache manager is in charge of the following: */ + /* */ + /* - Maintain a mapping between generic FTC_FaceIDs and live FT_Face */ + /* objects. The mapping itself is performed through a user-provided */ + /* callback. However, the manager maintains a small cache of FT_Face */ + /* and FT_Size objects in order to speed up things considerably. */ + /* */ + /* - Manage one or more cache objects. Each cache is in charge of */ + /* holding a varying number of `cache nodes'. Each cache node */ + /* represents a minimal amount of individually accessible cached */ + /* data. For example, a cache node can be an FT_Glyph image */ + /* containing a vector outline, or some glyph metrics, or anything */ + /* else. */ + /* */ + /* Each cache node has a certain size in bytes that is added to the */ + /* total amount of `cache memory' within the manager. */ + /* */ + /* All cache nodes are located in a global LRU list, where the oldest */ + /* node is at the tail of the list. */ + /* */ + /* Each node belongs to a single cache, and includes a reference */ + /* count to avoid destroying it (due to caching). */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********* *********/ + /********* WARNING, THIS IS BETA CODE. *********/ + /********* *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifndef __FTCMANAG_H__ +#define __FTCMANAG_H__ + + +#include +#include FT_CACHE_H +#include FT_CACHE_INTERNAL_MRU_H +#include FT_CACHE_INTERNAL_CACHE_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /*
*/ + /* cache_subsystem */ + /* */ + /*************************************************************************/ + + +#define FTC_MAX_FACES_DEFAULT 2 +#define FTC_MAX_SIZES_DEFAULT 4 +#define FTC_MAX_BYTES_DEFAULT 200000L /* ~200kByte by default */ + + /* maximum number of caches registered in a single manager */ +#define FTC_MAX_CACHES 16 + + + typedef struct FTC_ManagerRec_ + { + FT_Library library; + FT_Memory memory; + + FTC_Node nodes_list; + FT_ULong max_weight; + FT_ULong cur_weight; + FT_UInt num_nodes; + + FTC_Cache caches[FTC_MAX_CACHES]; + FT_UInt num_caches; + + FTC_MruListRec faces; + FTC_MruListRec sizes; + + FT_Pointer request_data; + FTC_Face_Requester request_face; + + } FTC_ManagerRec; + + + /*************************************************************************/ + /* */ + /* */ + /* FTC_Manager_Compress */ + /* */ + /* */ + /* This function is used to check the state of the cache manager if */ + /* its `num_bytes' field is greater than its `max_bytes' field. It */ + /* will flush as many old cache nodes as possible (ignoring cache */ + /* nodes with a non-zero reference count). */ + /* */ + /* */ + /* manager :: A handle to the cache manager. */ + /* */ + /* */ + /* Client applications should not call this function directly. It is */ + /* normally invoked by specific cache implementations. */ + /* */ + /* The reason this function is exported is to allow client-specific */ + /* cache classes. */ + /* */ + FT_EXPORT( void ) + FTC_Manager_Compress( FTC_Manager manager ); + + + /* try to flush `count' old nodes from the cache; return the number + * of really flushed nodes + */ + FT_EXPORT( FT_UInt ) + FTC_Manager_FlushN( FTC_Manager manager, + FT_UInt count ); + + + /* this must be used internally for the moment */ + FT_EXPORT( FT_Error ) + FTC_Manager_RegisterCache( FTC_Manager manager, + FTC_CacheClass clazz, + FTC_Cache *acache ); + + /* */ + +#define FTC_SCALER_COMPARE( a, b ) \ + ( (a)->face_id == (b)->face_id && \ + (a)->width == (b)->width && \ + (a)->height == (b)->height && \ + ((a)->pixel != 0) == ((b)->pixel != 0) && \ + ( (a)->pixel || \ + ( (a)->x_res == (b)->x_res && \ + (a)->y_res == (b)->y_res ) ) ) + +#define FTC_SCALER_HASH( q ) \ + ( FTC_FACE_ID_HASH( (q)->face_id ) + \ + (q)->width + (q)->height*7 + \ + ( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) ) + + /* */ + +FT_END_HEADER + +#endif /* __FTCMANAG_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/cache/ftcmru.h b/extlibs/headers/freetype/cache/ftcmru.h new file mode 100644 index 00000000..ac1a1a92 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftcmru.h @@ -0,0 +1,247 @@ +/***************************************************************************/ +/* */ +/* ftcmru.h */ +/* */ +/* Simple MRU list-cache (specification). */ +/* */ +/* Copyright 2000-2001, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* An MRU is a list that cannot hold more than a certain number of */ + /* elements (`max_elements'). All elements in the list are sorted in */ + /* least-recently-used order, i.e., the `oldest' element is at the tail */ + /* of the list. */ + /* */ + /* When doing a lookup (either through `Lookup()' or `Lookup_Node()'), */ + /* the list is searched for an element with the corresponding key. If */ + /* it is found, the element is moved to the head of the list and is */ + /* returned. */ + /* */ + /* If no corresponding element is found, the lookup routine will try to */ + /* obtain a new element with the relevant key. If the list is already */ + /* full, the oldest element from the list is discarded and replaced by a */ + /* new one; a new element is added to the list otherwise. */ + /* */ + /* Note that it is possible to pre-allocate the element list nodes. */ + /* This is handy if `max_elements' is sufficiently small, as it saves */ + /* allocations/releases during the lookup process. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTCMRU_H__ +#define __FTCMRU_H__ + + +#include +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + +#define xxFT_DEBUG_ERROR +#define FTC_INLINE + +FT_BEGIN_HEADER + + typedef struct FTC_MruNodeRec_* FTC_MruNode; + + typedef struct FTC_MruNodeRec_ + { + FTC_MruNode next; + FTC_MruNode prev; + + } FTC_MruNodeRec; + + + FT_EXPORT( void ) + FTC_MruNode_Prepend( FTC_MruNode *plist, + FTC_MruNode node ); + + FT_EXPORT( void ) + FTC_MruNode_Up( FTC_MruNode *plist, + FTC_MruNode node ); + + FT_EXPORT( void ) + FTC_MruNode_Remove( FTC_MruNode *plist, + FTC_MruNode node ); + + + typedef struct FTC_MruListRec_* FTC_MruList; + + typedef struct FTC_MruListClassRec_ const * FTC_MruListClass; + + + typedef FT_Bool + (*FTC_MruNode_CompareFunc)( FTC_MruNode node, + FT_Pointer key ); + + typedef FT_Error + (*FTC_MruNode_InitFunc)( FTC_MruNode node, + FT_Pointer key, + FT_Pointer data ); + + typedef FT_Error + (*FTC_MruNode_ResetFunc)( FTC_MruNode node, + FT_Pointer key, + FT_Pointer data ); + + typedef void + (*FTC_MruNode_DoneFunc)( FTC_MruNode node, + FT_Pointer data ); + + + typedef struct FTC_MruListClassRec_ + { + FT_UInt node_size; + FTC_MruNode_CompareFunc node_compare; + FTC_MruNode_InitFunc node_init; + FTC_MruNode_ResetFunc node_reset; + FTC_MruNode_DoneFunc node_done; + + } FTC_MruListClassRec; + + typedef struct FTC_MruListRec_ + { + FT_UInt num_nodes; + FT_UInt max_nodes; + FTC_MruNode nodes; + FT_Pointer data; + FTC_MruListClassRec clazz; + FT_Memory memory; + + } FTC_MruListRec; + + + FT_EXPORT( void ) + FTC_MruList_Init( FTC_MruList list, + FTC_MruListClass clazz, + FT_UInt max_nodes, + FT_Pointer data, + FT_Memory memory ); + + FT_EXPORT( void ) + FTC_MruList_Reset( FTC_MruList list ); + + + FT_EXPORT( void ) + FTC_MruList_Done( FTC_MruList list ); + + FT_EXPORT( FTC_MruNode ) + FTC_MruList_Find( FTC_MruList list, + FT_Pointer key ); + + FT_EXPORT( FT_Error ) + FTC_MruList_New( FTC_MruList list, + FT_Pointer key, + FTC_MruNode *anode ); + + FT_EXPORT( FT_Error ) + FTC_MruList_Lookup( FTC_MruList list, + FT_Pointer key, + FTC_MruNode *pnode ); + + + FT_EXPORT( void ) + FTC_MruList_Remove( FTC_MruList list, + FTC_MruNode node ); + + FT_EXPORT( void ) + FTC_MruList_RemoveSelection( FTC_MruList list, + FTC_MruNode_CompareFunc selection, + FT_Pointer key ); + + +#ifdef FTC_INLINE + +#define FTC_MRULIST_LOOKUP_CMP( list, key, compare, node, error ) \ + FT_BEGIN_STMNT \ + FTC_MruNode* _pfirst = &(list)->nodes; \ + FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \ + FTC_MruNode _first, _node, *_pnode; \ + \ + \ + error = 0; \ + _first = *(_pfirst); \ + _node = NULL; \ + \ + if ( _first ) \ + { \ + _node = _first; \ + do \ + { \ + if ( _compare( _node, (key) ) ) \ + { \ + if ( _node != _first ) \ + FTC_MruNode_Up( _pfirst, _node ); \ + \ + _pnode = (FTC_MruNode*)(void*)&(node); \ + *_pnode = _node; \ + goto _MruOk; \ + } \ + _node = _node->next; \ + \ + } while ( _node != _first) ; \ + } \ + \ + error = FTC_MruList_New( (list), (key), (FTC_MruNode*)(void*)&(node) ); \ + _MruOk: \ + ; \ + FT_END_STMNT + +#define FTC_MRULIST_LOOKUP( list, key, node, error ) \ + FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error ) + +#else /* !FTC_INLINE */ + +#define FTC_MRULIST_LOOKUP( list, key, node, error ) \ + error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) ) + +#endif /* !FTC_INLINE */ + + +#define FTC_MRULIST_LOOP( list, node ) \ + FT_BEGIN_STMNT \ + FTC_MruNode _first = (list)->nodes; \ + \ + \ + if ( _first ) \ + { \ + FTC_MruNode _node = _first; \ + \ + \ + do \ + { \ + *(FTC_MruNode*)&(node) = _node; + + +#define FTC_MRULIST_LOOP_END() \ + _node = _node->next; \ + \ + } while ( _node != _first ); \ + } \ + FT_END_STMNT + + /* */ + +FT_END_HEADER + + +#endif /* __FTCMRU_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/cache/ftcsbits.h b/extlibs/headers/freetype/cache/ftcsbits.h new file mode 100644 index 00000000..b2ef0f18 --- /dev/null +++ b/extlibs/headers/freetype/cache/ftcsbits.h @@ -0,0 +1,96 @@ +/***************************************************************************/ +/* */ +/* ftcsbits.h */ +/* */ +/* A small-bitmap cache (specification). */ +/* */ +/* Copyright 2000-2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCSBITS_H__ +#define __FTCSBITS_H__ + + +#include +#include FT_CACHE_H +#include FT_CACHE_INTERNAL_GLYPH_H + + +FT_BEGIN_HEADER + +#define FTC_SBIT_ITEMS_PER_NODE 16 + + typedef struct FTC_SNodeRec_ + { + FTC_GNodeRec gnode; + FT_UInt count; + FTC_SBitRec sbits[FTC_SBIT_ITEMS_PER_NODE]; + + } FTC_SNodeRec, *FTC_SNode; + + +#define FTC_SNODE( x ) ( (FTC_SNode)( x ) ) +#define FTC_SNODE_GINDEX( x ) FTC_GNODE( x )->gindex +#define FTC_SNODE_FAMILY( x ) FTC_GNODE( x )->family + + typedef FT_UInt + (*FTC_SFamily_GetCountFunc)( FTC_Family family, + FTC_Manager manager ); + + typedef FT_Error + (*FTC_SFamily_LoadGlyphFunc)( FTC_Family family, + FT_UInt gindex, + FTC_Manager manager, + FT_Face *aface ); + + typedef struct FTC_SFamilyClassRec_ + { + FTC_MruListClassRec clazz; + FTC_SFamily_GetCountFunc family_get_count; + FTC_SFamily_LoadGlyphFunc family_load_glyph; + + } FTC_SFamilyClassRec; + + typedef const FTC_SFamilyClassRec* FTC_SFamilyClass; + +#define FTC_SFAMILY_CLASS( x ) ((FTC_SFamilyClass)(x)) + +#define FTC_CACHE__SFAMILY_CLASS( x ) \ + FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class ) + + + FT_EXPORT( void ) + FTC_SNode_Free( FTC_SNode snode, + FTC_Cache cache ); + + FT_EXPORT( FT_Error ) + FTC_SNode_New( FTC_SNode *psnode, + FTC_GQuery gquery, + FTC_Cache cache ); + + FT_EXPORT( FT_ULong ) + FTC_SNode_Weight( FTC_SNode inode ); + + + FT_EXPORT( FT_Bool ) + FTC_SNode_Compare( FTC_SNode snode, + FTC_GQuery gquery, + FTC_Cache cache ); + + /* */ + +FT_END_HEADER + +#endif /* __FTCSBITS_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/config/ftconfig.h b/extlibs/headers/freetype/config/ftconfig.h new file mode 100644 index 00000000..fe3d6c11 --- /dev/null +++ b/extlibs/headers/freetype/config/ftconfig.h @@ -0,0 +1,335 @@ +/* ftconfig.h. Generated by configure. */ +/***************************************************************************/ +/* */ +/* ftconfig.in */ +/* */ +/* UNIX-specific configuration file (specification only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This header file contains a number of macro definitions that are used */ + /* by the rest of the engine. Most of the macros here are automatically */ + /* determined at compile time, and you should not need to change it to */ + /* port FreeType, except to compile the library with a non-ANSI */ + /* compiler. */ + /* */ + /* Note however that if some specific modifications are needed, we */ + /* advise you to place a modified copy in your build directory. */ + /* */ + /* The build directory is usually `freetype/builds/', and */ + /* contains system-specific files that are always included first when */ + /* building the library. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTCONFIG_H__ +#define __FTCONFIG_H__ + +#include +#include FT_CONFIG_OPTIONS_H +#include FT_CONFIG_STANDARD_LIBRARY_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ + /* */ + /* These macros can be toggled to suit a specific system. The current */ + /* ones are defaults used to compile FreeType in an ANSI C environment */ + /* (16bit compilers are also supported). Copy this file to your own */ + /* `freetype/builds/' directory, and edit it to port the engine. */ + /* */ + /*************************************************************************/ + + +#define HAVE_UNISTD_H 1 +#define HAVE_FCNTL_H 1 + +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 + + +#define FT_SIZEOF_INT SIZEOF_INT +#define FT_SIZEOF_LONG SIZEOF_LONG + +#define FT_CHAR_BIT CHAR_BIT + + /* Preferred alignment of data */ +#define FT_ALIGNMENT 8 + + + /* FT_UNUSED is a macro used to indicate that a given parameter is not */ + /* used -- this is only used to get rid of unpleasant compiler warnings */ +#ifndef FT_UNUSED +#define FT_UNUSED( arg ) ( (arg) = (arg) ) +#endif + + + /*************************************************************************/ + /* */ + /* AUTOMATIC CONFIGURATION MACROS */ + /* */ + /* These macros are computed from the ones defined above. Don't touch */ + /* their definition, unless you know precisely what you are doing. No */ + /* porter should need to mess with them. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Mac support */ + /* */ + /* This is the only necessary change, so it is defined here instead */ + /* providing a new configuration file. */ + /* */ +#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ + ( defined( __MWERKS__ ) && defined( macintosh ) ) +#define FT_MACINTOSH 1 +#endif + + + /*************************************************************************/ + /* */ + /* IntN types */ + /* */ + /* Used to guarantee the size of some specific integers. */ + /* */ + typedef signed short FT_Int16; + typedef unsigned short FT_UInt16; + +#if FT_SIZEOF_INT == 4 + + typedef signed int FT_Int32; + typedef unsigned int FT_UInt32; + +#elif FT_SIZEOF_LONG == 4 + + typedef signed long FT_Int32; + typedef unsigned long FT_UInt32; + +#else +#error "no 32bit type found -- please check your configuration files" +#endif + + + /* look up an integer type that is at least 32 bits */ +#if FT_SIZEOF_INT >= 4 + + typedef int FT_Fast; + typedef unsigned int FT_UFast; + +#elif FT_SIZEOF_LONG >= 4 + + typedef long FT_Fast; + typedef unsigned long FT_UFast; + +#endif + + + /* determine whether we have a 64-bit int type for platforms without */ + /* Autoconf */ +#if FT_SIZEOF_LONG == 8 + + /* FT_LONG64 must be defined if a 64-bit type is available */ +#define FT_LONG64 +#define FT_INT64 long + +#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ + + /* this compiler provides the __int64 type */ +#define FT_LONG64 +#define FT_INT64 __int64 + +#elif defined( __BORLANDC__ ) /* Borland C++ */ + + /* XXXX: We should probably check the value of __BORLANDC__ in order */ + /* to test the compiler version. */ + + /* this compiler provides the __int64 type */ +#define FT_LONG64 +#define FT_INT64 __int64 + +#elif defined( __WATCOMC__ ) /* Watcom C++ */ + + /* Watcom doesn't provide 64-bit data types */ + +#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ + +#define FT_LONG64 +#define FT_INT64 long long int + +#elif defined( __GNUC__ ) + + /* GCC provides the "long long" type */ +#define FT_LONG64 +#define FT_INT64 long long int + +#endif /* FT_SIZEOF_LONG == 8 */ + + +#define FT_BEGIN_STMNT do { +#define FT_END_STMNT } while ( 0 ) +#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT + + + /*************************************************************************/ + /* */ + /* A 64-bit data type will create compilation problems if you compile */ + /* in strict ANSI mode. To avoid them, we disable their use if */ + /* __STDC__ is defined. You can however ignore this rule by */ + /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ + /* */ +#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) + +#ifdef __STDC__ + + /* Undefine the 64-bit macros in strict ANSI compilation mode. */ + /* Since `#undef' doesn't survive in configuration header files */ + /* we use the postprocessing facility of AC_CONFIG_HEADERS to */ + /* replace the leading `/' with `#'. */ +#undef FT_LONG64 +#undef FT_INT64 + +#endif /* __STDC__ */ + +#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ + + +#ifdef FT_MAKE_OPTION_SINGLE_OBJECT + +#define FT_LOCAL( x ) static x +#define FT_LOCAL_DEF( x ) static x + +#else + +#ifdef __cplusplus +#define FT_LOCAL( x ) extern "C" x +#define FT_LOCAL_DEF( x ) extern "C" x +#else +#define FT_LOCAL( x ) extern x +#define FT_LOCAL_DEF( x ) x +#endif + +#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ + + +#ifndef FT_BASE + +#ifdef __cplusplus +#define FT_BASE( x ) extern "C" x +#else +#define FT_BASE( x ) extern x +#endif + +#endif /* !FT_BASE */ + + +#ifndef FT_BASE_DEF + +#ifdef __cplusplus +#define FT_BASE_DEF( x ) extern "C" x +#else +#define FT_BASE_DEF( x ) extern x +#endif + +#endif /* !FT_BASE_DEF */ + + +#ifndef FT_EXPORT + +#ifdef __cplusplus +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT( x ) extern x +#endif + +#endif /* !FT_EXPORT */ + + +#ifndef FT_EXPORT_DEF + +#ifdef __cplusplus +#define FT_EXPORT_DEF( x ) extern "C" x +#else +#define FT_EXPORT_DEF( x ) extern x +#endif + +#endif /* !FT_EXPORT_DEF */ + + +#ifndef FT_EXPORT_VAR + +#ifdef __cplusplus +#define FT_EXPORT_VAR( x ) extern "C" x +#else +#define FT_EXPORT_VAR( x ) extern x +#endif + +#endif /* !FT_EXPORT_VAR */ + + /* The following macros are needed to compile the library with a */ + /* C++ compiler and with 16bit compilers. */ + /* */ + + /* This is special. Within C++, you must specify `extern "C"' for */ + /* functions which are used via function pointers, and you also */ + /* must do that for structures which contain function pointers to */ + /* assure C linkage -- it's not possible to have (local) anonymous */ + /* functions which are accessed by (global) function pointers. */ + /* */ + /* */ + /* FT_CALLBACK_DEF is used to _define_ a callback function. */ + /* */ + /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ + /* contains pointers to callback functions. */ + /* */ + /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ + /* that contains pointers to callback functions. */ + /* */ + /* */ + /* Some 16bit compilers have to redefine these macros to insert */ + /* the infamous `_cdecl' or `__fastcall' declarations. */ + /* */ +#ifndef FT_CALLBACK_DEF +#ifdef __cplusplus +#define FT_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_CALLBACK_DEF( x ) static x +#endif +#endif /* FT_CALLBACK_DEF */ + +#ifndef FT_CALLBACK_TABLE +#ifdef __cplusplus +#define FT_CALLBACK_TABLE extern "C" +#define FT_CALLBACK_TABLE_DEF extern "C" +#else +#define FT_CALLBACK_TABLE extern +#define FT_CALLBACK_TABLE_DEF /* nothing */ +#endif +#endif /* FT_CALLBACK_TABLE */ + + +FT_END_HEADER + + +#endif /* __FTCONFIG_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/config/ftheader.h b/extlibs/headers/freetype/config/ftheader.h new file mode 100644 index 00000000..a6df10d2 --- /dev/null +++ b/extlibs/headers/freetype/config/ftheader.h @@ -0,0 +1,593 @@ +/***************************************************************************/ +/* */ +/* ftheader.h */ +/* */ +/* Build macros of the FreeType 2 library. */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +#ifndef __FT_HEADER_H__ +#define __FT_HEADER_H__ + + + /*@***********************************************************************/ + /* */ + /* */ + /* FT_BEGIN_HEADER */ + /* */ + /* */ + /* This macro is used in association with @FT_END_HEADER in header */ + /* files to ensure that the declarations within are properly */ + /* encapsulated in an `extern "C" { .. }' block when included from a */ + /* C++ compiler. */ + /* */ +#ifdef __cplusplus +#define FT_BEGIN_HEADER extern "C" { +#else +#define FT_BEGIN_HEADER /* nothing */ +#endif + + + /*@***********************************************************************/ + /* */ + /* */ + /* FT_END_HEADER */ + /* */ + /* */ + /* This macro is used in association with @FT_BEGIN_HEADER in header */ + /* files to ensure that the declarations within are properly */ + /* encapsulated in an `extern "C" { .. }' block when included from a */ + /* C++ compiler. */ + /* */ +#ifdef __cplusplus +#define FT_END_HEADER } +#else +#define FT_END_HEADER /* nothing */ +#endif + + + /*************************************************************************/ + /* */ + /* Aliases for the FreeType 2 public and configuration files. */ + /* */ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /*
*/ + /* header_file_macros */ + /* */ + /* */ + /* Header File Macros */ + /* */ + /* <Abstract> */ + /* Macro definitions used to #include specific header files. */ + /* */ + /* <Description> */ + /* The following macros are defined to the name of specific */ + /* FreeType 2 header files. They can be used directly in #include */ + /* statements as in: */ + /* */ + /* { */ + /* #include FT_FREETYPE_H */ + /* #include FT_MULTIPLE_MASTERS_H */ + /* #include FT_GLYPH_H */ + /* } */ + /* */ + /* There are several reasons why we are now using macros to name */ + /* public header files. The first one is that such macros are not */ + /* limited to the infamous 8.3 naming rule required by DOS (and */ + /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ + /* */ + /* The second reason is that is allows for more flexibility in the */ + /* way FreeType 2 is installed on a given system. */ + /* */ + /*************************************************************************/ + + + /* configuration files */ + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CONFIG_CONFIG_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* FreeType 2 configuration data. */ + /* */ +#ifndef FT_CONFIG_CONFIG_H +#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h> +#endif + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CONFIG_STANDARD_LIBRARY_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* FreeType 2 configuration data. */ + /* */ +#ifndef FT_CONFIG_STANDARD_LIBRARY_H +#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h> +#endif + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CONFIG_OPTIONS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* FreeType 2 project-specific configuration options. */ + /* */ +#ifndef FT_CONFIG_OPTIONS_H +#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h> +#endif + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CONFIG_MODULES_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the list of FreeType 2 modules that are statically linked to new */ + /* library instances in @FT_Init_FreeType. */ + /* */ +#ifndef FT_CONFIG_MODULES_H +#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h> +#endif + + + /* public headers */ + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_FREETYPE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the base FreeType 2 API. */ + /* */ +#define FT_FREETYPE_H <freetype/freetype.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_ERRORS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the list of FreeType 2 error codes (and messages). */ + /* */ + /* It is included by @FT_FREETYPE_H. */ + /* */ +#define FT_ERRORS_H <freetype/fterrors.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_MODULE_ERRORS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the list of FreeType 2 module error offsets (and messages). */ + /* */ +#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_SYSTEM_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the FreeType 2 interface to low-level operations (i.e. memory */ + /* management and stream i/o). */ + /* */ + /* It is included by @FT_FREETYPE_H. */ + /* */ +#define FT_SYSTEM_H <freetype/ftsystem.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_IMAGE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* types definitions related to glyph images (i.e. bitmaps, outlines, */ + /* scan-converter parameters). */ + /* */ + /* It is included by @FT_FREETYPE_H. */ + /* */ +#define FT_IMAGE_H <freetype/ftimage.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_TYPES_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the basic data types defined by FreeType 2. */ + /* */ + /* It is included by @FT_FREETYPE_H. */ + /* */ +#define FT_TYPES_H <freetype/fttypes.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_LIST_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the list management API of FreeType 2. */ + /* */ + /* (Most applications will never need to include this file.) */ + /* */ +#define FT_LIST_H <freetype/ftlist.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_OUTLINE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the scalable outline management API of FreeType 2. */ + /* */ +#define FT_OUTLINE_H <freetype/ftoutln.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_SIZES_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the API used to manage multiple @FT_Size objects per face. */ + /* */ +#define FT_SIZES_H <freetype/ftsizes.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_MODULE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the module management API of FreeType 2. */ + /* */ +#define FT_MODULE_H <freetype/ftmodapi.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_RENDER_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the renderer module management API of FreeType 2. */ + /* */ +#define FT_RENDER_H <freetype/ftrender.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_TYPE1_TABLES_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the types and API specific to the Type 1 format. */ + /* */ +#define FT_TYPE1_TABLES_H <freetype/t1tables.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_TRUETYPE_IDS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the enumeration values used to identify name strings, languages, */ + /* encodings, etc. This file really contains a _large_ set of */ + /* constant macro definitions, taken from the TrueType and OpenType */ + /* specifications. */ + /* */ +#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_TRUETYPE_TABLES_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the types and API specific to the TrueType (as well as OpenType) */ + /* format. */ + /* */ +#define FT_TRUETYPE_TABLES_H <freetype/tttables.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_TRUETYPE_TAGS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the definitions of TrueType 4-byte `tags' used to identify blocks */ + /* in SFNT-based font formats (i.e. TrueType and OpenType). */ + /* */ +#define FT_TRUETYPE_TAGS_H <freetype/tttags.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_BDF_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the definitions of an API to access BDF-specific strings from a */ + /* face. */ + /* */ +#define FT_BDF_H <freetype/ftbdf.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_GZIP_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the definitions of an API to support for gzip-compressed files. */ + /* */ +#define FT_GZIP_H <freetype/ftgzip.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_LZW_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the definitions of an API to support for LZW-compressed files. */ + /* */ +#define FT_LZW_H <freetype/ftlzw.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_WINFONTS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the definitions of an API to support Windows .FNT files */ + /* */ +#define FT_WINFONTS_H <freetype/ftwinfnt.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_GLYPH_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the API of the optional glyph management component. */ + /* */ +#define FT_GLYPH_H <freetype/ftglyph.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_BITMAP_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the API of the optional bitmap conversion component. */ + /* */ +#define FT_BITMAP_H <freetype/ftbitmap.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_BBOX_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the API of the optional exact bounding box computation routines. */ + /* */ +#define FT_BBOX_H <freetype/ftbbox.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CACHE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the API of the optional FreeType 2 cache sub-system. */ + /* */ +#define FT_CACHE_H <freetype/ftcache.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CACHE_IMAGE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the `glyph image' API of the FreeType 2 cache sub-system. */ + /* */ + /* It is used to define a cache for @FT_Glyph elements. You can also */ + /* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */ + /* to store small glyph bitmaps, as it will use less memory. */ + /* */ + /* This macro is deprecated. Simply include @FT_CACHE_H to have all */ + /* glyph image-related cache declarations. */ + /* */ +#define FT_CACHE_IMAGE_H FT_CACHE_H + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CACHE_SMALL_BITMAPS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the `small bitmaps' API of the FreeType 2 cache sub-system. */ + /* */ + /* It is used to define a cache for small glyph bitmaps in a */ + /* relatively memory-efficient way. You can also use the API defined */ + /* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */ + /* including scalable outlines. */ + /* */ + /* This macro is deprecated. Simply include @FT_CACHE_H to have all */ + /* small bitmaps-related cache declarations. */ + /* */ +#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CACHE_CHARMAP_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the `charmap' API of the FreeType 2 cache sub-system. */ + /* */ + /* This macro is deprecated. Simply include @FT_CACHE_H to have all */ + /* charmap-based cache declarations. */ + /* */ +#define FT_CACHE_CHARMAP_H FT_CACHE_H + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_MAC_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the Macintosh-specific FreeType 2 API. The latter is used to */ + /* access fonts embedded in resource forks. */ + /* */ + /* This header file must be explicitly included by client */ + /* applications compiled on the Mac (note that the base API still */ + /* works though). */ + /* */ +#define FT_MAC_H <freetype/ftmac.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_MULTIPLE_MASTERS_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the optional multiple-masters management API of FreeType 2. */ + /* */ +#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_SFNT_NAMES_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the optional FreeType 2 API used to access embedded `name' strings */ + /* in SFNT-based font formats (i.e. TrueType and OpenType). */ + /* */ +#define FT_SFNT_NAMES_H <freetype/ftsnames.h> + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_OPENTYPE_VALIDATE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the optional FreeType 2 API used to validate OpenType tables */ + /* (BASE, GDEF, GPOS, GSUB, JSTF). */ + /* */ +#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h> + + + /* */ + +#define FT_TRIGONOMETRY_H <freetype/fttrigon.h> +#define FT_STROKER_H <freetype/ftstroke.h> +#define FT_SYNTHESIS_H <freetype/ftsynth.h> +#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h> + +#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h> + +#define FT_CACHE_INTERNAL_MRU_H <freetype/cache/ftcmru.h> +#define FT_CACHE_INTERNAL_MANAGER_H <freetype/cache/ftcmanag.h> +#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h> +#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h> +#define FT_CACHE_INTERNAL_IMAGE_H <freetype/cache/ftcimage.h> +#define FT_CACHE_INTERNAL_SBITS_H <freetype/cache/ftcsbits.h> + + +#define FT_XFREE86_H <freetype/ftxf86.h> + +#define FT_INCREMENTAL_H <freetype/ftincrem.h> + +#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h> + + /* now include internal headers definitions from <freetype/internal/...> */ + +#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h> +#include FT_INTERNAL_INTERNAL_H + + +#endif /* __FT2_BUILD_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/config/ftmodule.h b/extlibs/headers/freetype/config/ftmodule.h new file mode 100644 index 00000000..b8f67bb0 --- /dev/null +++ b/extlibs/headers/freetype/config/ftmodule.h @@ -0,0 +1,19 @@ +FT_USE_MODULE(autofit_module_class) +FT_USE_MODULE(tt_driver_class) +FT_USE_MODULE(t1_driver_class) +FT_USE_MODULE(cff_driver_class) +FT_USE_MODULE(t1cid_driver_class) +FT_USE_MODULE(pfr_driver_class) +FT_USE_MODULE(t42_driver_class) +FT_USE_MODULE(winfnt_driver_class) +FT_USE_MODULE(pcf_driver_class) +FT_USE_MODULE(psaux_module_class) +FT_USE_MODULE(psnames_module_class) +FT_USE_MODULE(pshinter_module_class) +FT_USE_MODULE(ft_raster1_renderer_class) +FT_USE_MODULE(sfnt_module_class) +FT_USE_MODULE(ft_smooth_renderer_class) +FT_USE_MODULE(ft_smooth_lcd_renderer_class) +FT_USE_MODULE(ft_smooth_lcdv_renderer_class) +FT_USE_MODULE(otv_module_class) +FT_USE_MODULE(bdf_driver_class) diff --git a/extlibs/headers/freetype/config/ftoption.h b/extlibs/headers/freetype/config/ftoption.h new file mode 100644 index 00000000..0bcecf7f --- /dev/null +++ b/extlibs/headers/freetype/config/ftoption.h @@ -0,0 +1,565 @@ +/***************************************************************************/ +/* */ +/* ftoption.h */ +/* */ +/* User-selectable configuration macros (specification only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOPTION_H__ +#define __FTOPTION_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + /*************************************************************************/ + /* */ + /* USER-SELECTABLE CONFIGURATION MACROS */ + /* */ + /* This file contains the default configuration macro definitions for */ + /* a standard build of the FreeType library. There are three ways to */ + /* use this file to build project-specific versions of the library: */ + /* */ + /* - You can modify this file by hand, but this is not recommended in */ + /* cases where you would like to build several versions of the */ + /* library from a single source directory. */ + /* */ + /* - You can put a copy of this file in your build directory, more */ + /* precisely in "$BUILD/freetype/config/ftoption.h", where "$BUILD" */ + /* is the name of a directory that is included _before_ the FreeType */ + /* include path during compilation. */ + /* */ + /* The default FreeType Makefiles and Jamfiles use the build */ + /* directory "builds/<system>" by default, but you can easily change */ + /* that for your own projects. */ + /* */ + /* - Copy the file <ft2build.h> to "$BUILD/ft2build.h" and modify it */ + /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ + /* locate this file during the build. For example, */ + /* */ + /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ + /* #include <freetype/config/ftheader.h> */ + /* */ + /* will use "$BUILD/myftoptions.h" instead of this file for macro */ + /* definitions. */ + /* */ + /* Note also that you can similarly pre-define the macro */ + /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ + /* that are statically linked to the library at compile time. By */ + /* default, this file is <freetype/config/ftmodule.h>. */ + /* */ + /* We highly recommend using the third method whenever possible. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Many compilers provide a non-ANSI 64-bit data type that can be used */ + /* by FreeType to speed up some computations. However, this will create */ + /* some problems when compiling the library in strict ANSI mode. */ + /* */ + /* For this reason, the use of 64-bit integers is normally disabled when */ + /* the __STDC__ macro is defined. You can however disable this by */ + /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ + /* */ + /* For most compilers, this will only create compilation warnings when */ + /* building the library. */ + /* */ + /* ObNote: The compiler-specific 64-bit integers are detected in the */ + /* file "ftconfig.h" either statically or through the */ + /* `configure' script on supported platforms. */ + /* */ +#undef FT_CONFIG_OPTION_FORCE_INT64 + + + /*************************************************************************/ + /* */ + /* LZW-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* 'compress' program. This is mostly used to parse many of the PCF */ + /* files that come with various X11 distributions. The implementation */ + /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ + /* (see src/lzw/ftgzip.c). */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_LZW + + + /*************************************************************************/ + /* */ + /* Gzip-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* 'gzip' program. This is mostly used to parse many of the PCF files */ + /* that come with XFree86. The implementation uses `zlib' to */ + /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ + /* */ + /* Define this macro if you want to enable this `feature'. See also */ + /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ + /* */ +#define FT_CONFIG_OPTION_USE_ZLIB + + + /*************************************************************************/ + /* */ + /* ZLib library selection */ + /* */ + /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ + /* It allows FreeType's `ftgzip' component to link to the system's */ + /* installation of the ZLib library. This is useful on systems like */ + /* Unix or VMS where it generally is already available. */ + /* */ + /* If you let it undefined, the component will use its own copy */ + /* of the zlib sources instead. These have been modified to be */ + /* included directly within the component and *not* export external */ + /* function names. This allows you to link any program with FreeType */ + /* _and_ ZLib without linking conflicts. */ + /* */ + /* Do not #undef this macro here since the build system might define */ + /* it for certain configurations only. */ + /* */ +/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ + + + /*************************************************************************/ + /* */ + /* DLL export compilation */ + /* */ + /* When compiling FreeType as a DLL, some systems/compilers need a */ + /* special keyword in front OR after the return type of function */ + /* declarations. */ + /* */ + /* Two macros are used within the FreeType source code to define */ + /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ + /* */ + /* FT_EXPORT( return_type ) */ + /* */ + /* is used in a function declaration, as in */ + /* */ + /* FT_EXPORT( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ); */ + /* */ + /* */ + /* FT_EXPORT_DEF( return_type ) */ + /* */ + /* is used in a function definition, as in */ + /* */ + /* FT_EXPORT_DEF( FT_Error ) */ + /* FT_Init_FreeType( FT_Library* alibrary ) */ + /* { */ + /* ... some code ... */ + /* return FT_Err_Ok; */ + /* } */ + /* */ + /* You can provide your own implementation of FT_EXPORT and */ + /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ + /* will be later automatically defined as `extern return_type' to */ + /* allow normal compilation. */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +/* #define FT_EXPORT(x) extern x */ +/* #define FT_EXPORT_DEF(x) x */ + + + /*************************************************************************/ + /* */ + /* Glyph Postscript Names handling */ + /* */ + /* By default, FreeType 2 is compiled with the `PSNames' module. This */ + /* module is in charge of converting a glyph name string into a */ + /* Unicode value, or return a Macintosh standard glyph name for the */ + /* use with the TrueType `post' table. */ + /* */ + /* Undefine this macro if you do not want `PSNames' compiled in your */ + /* build of FreeType. This has the following effects: */ + /* */ + /* - The TrueType driver will provide its own set of glyph names, */ + /* if you build it to support postscript names in the TrueType */ + /* `post' table. */ + /* */ + /* - The Type 1 driver will not be able to synthetize a Unicode */ + /* charmap out of the glyphs found in the fonts. */ + /* */ + /* You would normally undefine this configuration macro when building */ + /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ + /* */ +#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + + /*************************************************************************/ + /* */ + /* Postscript Names to Unicode Values support */ + /* */ + /* By default, FreeType 2 is built with the `PSNames' module compiled */ + /* in. Among other things, the module is used to convert a glyph name */ + /* into a Unicode value. This is especially useful in order to */ + /* synthetize on the fly a Unicode charmap from the CFF/Type 1 driver */ + /* through a big table named the `Adobe Glyph List' (AGL). */ + /* */ + /* Undefine this macro if you do not want the Adobe Glyph List */ + /* compiled in your `PSNames' module. The Type 1 driver will not be */ + /* able to synthetize a Unicode charmap out of the glyphs found in the */ + /* fonts. */ + /* */ +#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST + + + /*************************************************************************/ + /* */ + /* Support for Mac fonts */ + /* */ + /* Define this macro if you want support for outline fonts in Mac */ + /* format (mac dfont, mac resource, macbinary containing a mac */ + /* resource) on non-Mac platforms. */ + /* */ + /* Note that the `FOND' resource isn't checked. */ + /* */ +#define FT_CONFIG_OPTION_MAC_FONTS + + + /*************************************************************************/ + /* */ + /* Guessing methods to access embedded resource forks */ + /* */ + /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ + /* GNU/Linux). */ + /* */ + /* Resource forks which include fonts data are stored sometimes in */ + /* locations which users or developers don't expected. In some cases, */ + /* resource forks start with some offset from the head of a file. In */ + /* other cases, the actual resource fork is stored in file different */ + /* from what the user specifies. If this option is activated, */ + /* FreeType tries to guess whether such offsets or different file */ + /* names must be used. */ + /* */ + /* Note that normal, direct access of resource forks is controlled via */ + /* the FT_CONFIG_OPTION_MAC_FONTS option. */ + /* */ +#ifdef FT_CONFIG_OPTION_MAC_FONTS +#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#endif + + + /*************************************************************************/ + /* */ + /* Allow the use of FT_Incremental_Interface to load typefaces that */ + /* contain no glyph data, but supply it via a callback function. */ + /* This allows FreeType to be used with the PostScript language, using */ + /* the GhostScript interpreter. */ + /* */ +/* #define FT_CONFIG_OPTION_INCREMENTAL */ + + + /*************************************************************************/ + /* */ + /* The size in bytes of the render pool used by the scan-line converter */ + /* to do all of its work. */ + /* */ + /* This must be greater than 4KByte. */ + /* */ +#define FT_RENDER_POOL_SIZE 16384L + + + /*************************************************************************/ + /* */ + /* FT_MAX_MODULES */ + /* */ + /* The maximum number of modules that can be registered in a single */ + /* FreeType library object. 32 is the default. */ + /* */ +#define FT_MAX_MODULES 32 + + + /*************************************************************************/ + /* */ + /* Debug level */ + /* */ + /* FreeType can be compiled in debug or trace mode. In debug mode, */ + /* errors are reported through the `ftdebug' component. In trace */ + /* mode, additional messages are sent to the standard output during */ + /* execution. */ + /* */ + /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ + /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ + /* */ + /* Don't define any of these macros to compile in `release' mode! */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +/* #define FT_DEBUG_LEVEL_ERROR */ +/* #define FT_DEBUG_LEVEL_TRACE */ + + + /*************************************************************************/ + /* */ + /* Memory Debugging */ + /* */ + /* FreeType now comes with an integrated memory debugger that is */ + /* capable of detecting simple errors like memory leaks or double */ + /* deletes. To compile it within your build of the library, you */ + /* should define FT_DEBUG_MEMORY here. */ + /* */ + /* Note that the memory debugger is only activated at runtime when */ + /* when the _environment_ variable "FT2_DEBUG_MEMORY" is defined also! */ + /* */ + /* Do not #undef this macro here since the build system might define */ + /* it for certain configurations only. */ + /* */ +/* #define FT_DEBUG_MEMORY */ + + + /*************************************************************************/ + /* */ + /* Module errors */ + /* */ + /* If this macro is set (which is _not_ the default), the higher byte */ + /* of an error code gives the module in which the error has occurred, */ + /* while the lower byte is the real error code. */ + /* */ + /* Setting this macro makes sense for debugging purposes only, since */ + /* it would break source compatibility of certain programs that use */ + /* FreeType 2. */ + /* */ + /* More details can be found in the files ftmoderr.h and fterrors.h. */ + /* */ +#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS + + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ + /* embedded bitmaps in all formats using the SFNT module (namely */ + /* TrueType & OpenType). */ + /* */ +#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ + /* load and enumerate the glyph Postscript names in a TrueType or */ + /* OpenType file. */ + /* */ + /* Note that when you do not compile the `PSNames' module by undefining */ + /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ + /* contain additional code used to read the PS Names table from a font. */ + /* */ + /* (By default, the module uses `PSNames' to extract glyph names.) */ + /* */ +#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ + /* access the internal name table in a SFNT-based format like TrueType */ + /* or OpenType. The name table contains various strings used to */ + /* describe the font, like family name, copyright, version, etc. It */ + /* does not contain any glyph name though. */ + /* */ + /* Accessing SFNT names is done through the functions declared in */ + /* `freetype/ftnames.h'. */ + /* */ +#define TT_CONFIG_OPTION_SFNT_NAMES + + + /*************************************************************************/ + /* */ + /* TrueType CMap support */ + /* */ + /* Here you can fine-tune which TrueType CMap table format shall be */ + /* supported. */ +#define TT_CONFIG_CMAP_FORMAT_0 +#define TT_CONFIG_CMAP_FORMAT_2 +#define TT_CONFIG_CMAP_FORMAT_4 +#define TT_CONFIG_CMAP_FORMAT_6 +#define TT_CONFIG_CMAP_FORMAT_8 +#define TT_CONFIG_CMAP_FORMAT_10 +#define TT_CONFIG_CMAP_FORMAT_12 + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ + /* a bytecode interpreter in the TrueType driver. Note that there are */ + /* important patent issues related to the use of the interpreter. */ + /* */ + /* By undefining this, you will only compile the code necessary to load */ + /* TrueType glyphs without hinting. */ + /* */ + /* Do not #undef this macro here, since the build system might */ + /* define it for certain configurations only. */ + /* */ +/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */ + /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */ + /* work-around hinting system. Note that for the moment, the algorithm */ + /* is only used when selected at runtime through the parameter tag */ + /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */ + /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */ + /* */ +#define TT_CONFIG_OPTION_UNPATENTED_HINTING + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ + /* bytecode interpreter with a huge switch statement, rather than a call */ + /* table. This results in smaller and faster code for a number of */ + /* architectures. */ + /* */ + /* Note however that on some compiler/processor combinations, undefining */ + /* this macro will generate faster, though larger, code. */ + /* */ +#define TT_CONFIG_OPTION_INTERPRETER_SWITCH + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ + /* TrueType glyph loader to use Apple's definition of how to handle */ + /* component offsets in composite glyphs. */ + /* */ + /* Apple and MS disagree on the default behavior of component offsets */ + /* in composites. Apple says that they should be scaled by the scale */ + /* factors in the transformation matrix (roughly, it's more complex) */ + /* while MS says they should not. OpenType defines two bits in the */ + /* composite flags array which can be used to disambiguate, but old */ + /* fonts will not have them. */ + /* */ + /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ + /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ + /* */ +#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED + + + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ + /* support for Apple's distortable font technology (fvar, gvar, cvar, */ + /* and avar tables). This has many similarities to Type 1 Multiple */ + /* Masters support. */ + /* */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ + /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ + /* required. */ + /* */ +#define T1_MAX_DICT_DEPTH 5 + + + /*************************************************************************/ + /* */ + /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ + /* calls during glyph loading. */ + /* */ +#define T1_MAX_SUBRS_CALLS 16 + + + /*************************************************************************/ + /* */ + /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ + /* minimum of 16 is required. */ + /* */ + /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ + /* */ +#define T1_MAX_CHARSTRINGS_OPERANDS 256 + + + /*************************************************************************/ + /* */ + /* Define this configuration macro if you want to prevent the */ + /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ + /* files into an existing face. Note that if set, the T1 driver will be */ + /* unable to produce kerning distances. */ + /* */ +#undef T1_CONFIG_OPTION_NO_AFM + + + /*************************************************************************/ + /* */ + /* Define this configuration macro if you want to prevent the */ + /* compilation of the Multiple Masters font support in the Type 1 */ + /* driver. */ + /* */ +#undef T1_CONFIG_OPTION_NO_MM_SUPPORT + + /* */ + +/* + * This temporary macro is used to control various optimizations for + * reducing the heap footprint of memory-mapped TrueType files. + * + */ +/* #define FT_OPTIMIZE_MEMORY */ + +FT_END_HEADER + + +#endif /* __FTOPTION_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/config/ftstdlib.h b/extlibs/headers/freetype/config/ftstdlib.h new file mode 100644 index 00000000..4b9b398b --- /dev/null +++ b/extlibs/headers/freetype/config/ftstdlib.h @@ -0,0 +1,150 @@ +/***************************************************************************/ +/* */ +/* ftstdlib.h */ +/* */ +/* ANSI-specific library and header configuration file (specification */ +/* only). */ +/* */ +/* Copyright 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file is used to group all #includes to the ANSI C library that */ + /* FreeType normally requires. It also defines macros to rename the */ + /* standard functions within the FreeType source code. */ + /* */ + /* Load a file which defines __FTSTDLIB_H__ before this one to override */ + /* it. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTSTDLIB_H__ +#define __FTSTDLIB_H__ + + +#include <stddef.h> + +#define ft_ptrdiff_t ptrdiff_t + + + /**********************************************************************/ + /* */ + /* integer limits */ + /* */ + /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ + /* of `int' and `long' in bytes at compile-time. So far, this works */ + /* for all platforms the library has been tested on. */ + /* */ + /* Note that on the extremely rare platforms that do not provide */ + /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ + /* old Crays where `int' is 36 bits), we do not make any guarantee */ + /* about the correct behaviour of FT2 with all fonts. */ + /* */ + /* In these case, "ftconfig.h" will refuse to compile anyway with a */ + /* message like "couldn't find 32-bit type" or something similar. */ + /* */ + /* IMPORTANT NOTE: We do not define aliases for heap management and */ + /* i/o routines (i.e. malloc/free/fopen/fread/...) */ + /* since these functions should all be encapsulated */ + /* by platform-specific implementations of */ + /* "ftsystem.c". */ + /* */ + /**********************************************************************/ + + +#include <limits.h> + +#define FT_UINT_MAX UINT_MAX +#define FT_INT_MAX INT_MAX +#define FT_ULONG_MAX ULONG_MAX + + + /**********************************************************************/ + /* */ + /* character and string processing */ + /* */ + /**********************************************************************/ + + +#include <ctype.h> + +#define ft_isalnum isalnum +#define ft_isupper isupper +#define ft_islower islower +#define ft_isdigit isdigit +#define ft_isxdigit isxdigit + + +#include <string.h> + +#define ft_memcmp memcmp +#define ft_memcpy memcpy +#define ft_memmove memmove +#define ft_memset memset +#define ft_strcat strcat +#define ft_strcmp strcmp +#define ft_strcpy strcpy +#define ft_strlen strlen +#define ft_strncmp strncmp +#define ft_strncpy strncpy +#define ft_strrchr strrchr + + +#include <stdio.h> + +#define ft_sprintf sprintf + + + /**********************************************************************/ + /* */ + /* sorting */ + /* */ + /**********************************************************************/ + + +#include <stdlib.h> + +#define ft_qsort qsort +#define ft_exit exit /* only used to exit from unhandled exceptions */ + +#define ft_atol atol + + + /**********************************************************************/ + /* */ + /* execution control */ + /* */ + /**********************************************************************/ + + +#include <setjmp.h> + +#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ + /* jmp_buf is defined as a macro */ + /* on certain platforms */ + +#define ft_setjmp setjmp /* same thing here */ +#define ft_longjmp longjmp /* " */ + + + /* the following is only used for debugging purposes, i.e. when */ + /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ + /* */ +#include <stdarg.h> + + +#endif /* __FTSTDLIB_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/freetype.h b/extlibs/headers/freetype/freetype.h new file mode 100644 index 00000000..7b2a96c3 --- /dev/null +++ b/extlibs/headers/freetype/freetype.h @@ -0,0 +1,3089 @@ +/***************************************************************************/ +/* */ +/* freetype.h */ +/* */ +/* FreeType high-level API and common types (specification only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef FT_FREETYPE_H +#error "`ft2build.h' hasn't been included yet!" +#error "Please always use macros to include FreeType header files." +#error "Example:" +#error " #include <ft2build.h>" +#error " #include FT_FREETYPE_H" +#endif + + +#ifndef __FREETYPE_H__ +#define __FREETYPE_H__ + + + /*************************************************************************/ + /* */ + /* The `raster' component duplicates some of the declarations in */ + /* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */ + /* */ + + + /*************************************************************************/ + /* */ + /* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the */ + /* new FreeType design, which is able to host several kinds of font */ + /* drivers. It starts at 2.0. */ + /* */ +#define FREETYPE_MAJOR 2 +#define FREETYPE_MINOR 1 +#define FREETYPE_PATCH 10 + + +#include <ft2build.h> +#include FT_CONFIG_CONFIG_H +#include FT_ERRORS_H +#include FT_TYPES_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* B A S I C T Y P E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* base_interface */ + /* */ + /* <Title> */ + /* Base Interface */ + /* */ + /* <Abstract> */ + /* The FreeType 2 base font interface. */ + /* */ + /* <Description> */ + /* This section describes the public high-level API of FreeType 2. */ + /* */ + /* <Order> */ + /* FT_Library */ + /* FT_Face */ + /* FT_Size */ + /* FT_GlyphSlot */ + /* FT_CharMap */ + /* FT_Encoding */ + /* */ + /* FT_FaceRec */ + /* */ + /* FT_FACE_FLAG_SCALABLE */ + /* FT_FACE_FLAG_FIXED_SIZES */ + /* FT_FACE_FLAG_FIXED_WIDTH */ + /* FT_FACE_FLAG_HORIZONTAL */ + /* FT_FACE_FLAG_VERTICAL */ + /* FT_FACE_FLAG_SFNT */ + /* FT_FACE_FLAG_KERNING */ + /* FT_FACE_FLAG_MULTIPLE_MASTERS */ + /* FT_FACE_FLAG_GLYPH_NAMES */ + /* FT_FACE_FLAG_EXTERNAL_STREAM */ + /* FT_FACE_FLAG_FAST_GLYPHS */ + /* */ + /* FT_STYLE_FLAG_BOLD */ + /* FT_STYLE_FLAG_ITALIC */ + /* */ + /* FT_SizeRec */ + /* FT_Size_Metrics */ + /* */ + /* FT_GlyphSlotRec */ + /* FT_Glyph_Metrics */ + /* FT_SubGlyph */ + /* */ + /* FT_Bitmap_Size */ + /* */ + /* FT_Init_FreeType */ + /* FT_Done_FreeType */ + /* FT_Library_Version */ + /* */ + /* FT_New_Face */ + /* FT_Done_Face */ + /* FT_New_Memory_Face */ + /* FT_Open_Face */ + /* FT_Open_Args */ + /* FT_Parameter */ + /* FT_Attach_File */ + /* FT_Attach_Stream */ + /* */ + /* FT_Set_Char_Size */ + /* FT_Set_Pixel_Sizes */ + /* FT_Set_Transform */ + /* FT_Load_Glyph */ + /* FT_Get_Char_Index */ + /* FT_Get_Name_Index */ + /* FT_Load_Char */ + /* */ + /* FT_OPEN_MEMORY */ + /* FT_OPEN_STREAM */ + /* FT_OPEN_PATHNAME */ + /* FT_OPEN_DRIVER */ + /* FT_OPEN_PARAMS */ + /* */ + /* FT_LOAD_DEFAULT */ + /* FT_LOAD_RENDER */ + /* FT_LOAD_MONOCHROME */ + /* FT_LOAD_LINEAR_DESIGN */ + /* FT_LOAD_NO_SCALE */ + /* FT_LOAD_NO_HINTING */ + /* FT_LOAD_NO_BITMAP */ + /* FT_LOAD_CROP_BITMAP */ + /* */ + /* FT_LOAD_VERTICAL_LAYOUT */ + /* FT_LOAD_IGNORE_TRANSFORM */ + /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ + /* FT_LOAD_FORCE_AUTOHINT */ + /* FT_LOAD_NO_RECURSE */ + /* FT_LOAD_PEDANTIC */ + /* */ + /* FT_LOAD_TARGET_NORMAL */ + /* FT_LOAD_TARGET_LIGHT */ + /* FT_LOAD_TARGET_MONO */ + /* FT_LOAD_TARGET_LCD */ + /* FT_LOAD_TARGET_LCD_V */ + /* */ + /* FT_Render_Glyph */ + /* FT_Render_Mode */ + /* FT_Get_Kerning */ + /* FT_Kerning_Mode */ + /* FT_Get_Glyph_Name */ + /* FT_Get_Postscript_Name */ + /* */ + /* FT_CharMapRec */ + /* FT_Select_Charmap */ + /* FT_Set_Charmap */ + /* FT_Get_Charmap_Index */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Glyph_Metrics */ + /* */ + /* <Description> */ + /* A structure used to model the metrics of a single glyph. The */ + /* values are expressed in 26.6 fractional pixel format; if the flag */ + /* FT_LOAD_NO_SCALE is used, values are returned in font units */ + /* instead. */ + /* */ + /* <Fields> */ + /* width :: */ + /* The glyph's width. */ + /* */ + /* height :: */ + /* The glyph's height. */ + /* */ + /* horiBearingX :: */ + /* Left side bearing for horizontal layout. */ + /* */ + /* horiBearingY :: */ + /* Top side bearing for horizontal layout. */ + /* */ + /* horiAdvance :: */ + /* Advance width for horizontal layout. */ + /* */ + /* vertBearingX :: */ + /* Left side bearing for vertical layout. */ + /* */ + /* vertBearingY :: */ + /* Top side bearing for vertical layout. */ + /* */ + /* vertAdvance :: */ + /* Advance height for vertical layout. */ + /* */ + typedef struct FT_Glyph_Metrics_ + { + FT_Pos width; + FT_Pos height; + + FT_Pos horiBearingX; + FT_Pos horiBearingY; + FT_Pos horiAdvance; + + FT_Pos vertBearingX; + FT_Pos vertBearingY; + FT_Pos vertAdvance; + + } FT_Glyph_Metrics; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Bitmap_Size */ + /* */ + /* <Description> */ + /* This structure models the size of a bitmap strike (i.e., a bitmap */ + /* instance of the font for a given resolution) in a fixed-size font */ + /* face. It is used for the `available_sizes' field of the */ + /* @FT_FaceRec structure. */ + /* */ + /* <Fields> */ + /* height :: The (vertical) baseline-to-baseline distance in pixels. */ + /* It makes most sense to define the height of a bitmap */ + /* font in this way. */ + /* */ + /* width :: The average width of the font (in pixels). Since the */ + /* algorithms to compute this value are different for the */ + /* various bitmap formats, it can only give an additional */ + /* hint if the `height' value isn't sufficient to select */ + /* the proper font. For monospaced fonts the average width */ + /* is the same as the maximum width. */ + /* */ + /* size :: The point size in 26.6 fractional format this font shall */ + /* represent (for a given vertical resolution). */ + /* */ + /* x_ppem :: The horizontal ppem value (in 26.6 fractional format). */ + /* */ + /* y_ppem :: The vertical ppem value (in 26.6 fractional format). */ + /* Usually, this is the `nominal' pixel height of the font. */ + /* */ + /* <Note> */ + /* The values in this structure are taken from the bitmap font. If */ + /* the font doesn't provide a parameter it is set to zero to indicate */ + /* that the information is not available. */ + /* */ + /* The following formula converts from dpi to ppem: */ + /* */ + /* ppem = size * dpi / 72 */ + /* */ + /* where `size' is in points. */ + /* */ + /* Windows FNT: */ + /* The `size' parameter is not reliable: There exist fonts (e.g., */ + /* app850.fon) which have a wrong size for some subfonts; x_ppem */ + /* and y_ppem are thus set equal to pixel width and height given in */ + /* in the Windows FNT header. */ + /* */ + /* TrueType embedded bitmaps: */ + /* `size', `width', and `height' values are not contained in the */ + /* bitmap strike itself. They are computed from the global font */ + /* parameters. */ + /* */ + typedef struct FT_Bitmap_Size_ + { + FT_Short height; + FT_Short width; + + FT_Pos size; + + FT_Pos x_ppem; + FT_Pos y_ppem; + + } FT_Bitmap_Size; + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* O B J E C T C L A S S E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Library */ + /* */ + /* <Description> */ + /* A handle to a FreeType library instance. Each `library' is */ + /* completely independent from the others; it is the `root' of a set */ + /* of objects like fonts, faces, sizes, etc. */ + /* */ + /* It also embeds a memory manager (see @FT_Memory), as well as a */ + /* scan-line converter object (see @FT_Raster). */ + /* */ + /* <Note> */ + /* Library objects are normally created by @FT_Init_FreeType, and */ + /* destroyed with @FT_Done_FreeType. */ + /* */ + typedef struct FT_LibraryRec_ *FT_Library; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Module */ + /* */ + /* <Description> */ + /* A handle to a given FreeType module object. Each module can be a */ + /* font driver, a renderer, or anything else that provides services */ + /* to the formers. */ + /* */ + typedef struct FT_ModuleRec_* FT_Module; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Driver */ + /* */ + /* <Description> */ + /* A handle to a given FreeType font driver object. Each font driver */ + /* is a special module capable of creating faces from font files. */ + /* */ + typedef struct FT_DriverRec_* FT_Driver; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Renderer */ + /* */ + /* <Description> */ + /* A handle to a given FreeType renderer. A renderer is a special */ + /* module in charge of converting a glyph image to a bitmap, when */ + /* necessary. Each renderer supports a given glyph image format, and */ + /* one or more target surface depths. */ + /* */ + typedef struct FT_RendererRec_* FT_Renderer; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Face */ + /* */ + /* <Description> */ + /* A handle to a given typographic face object. A face object models */ + /* a given typeface, in a given style. */ + /* */ + /* <Note> */ + /* Each face object also owns a single @FT_GlyphSlot object, as well */ + /* as one or more @FT_Size objects. */ + /* */ + /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ + /* a given filepathname or a custom input stream. */ + /* */ + /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ + /* */ + /* <Also> */ + /* The @FT_FaceRec details the publicly accessible fields of a given */ + /* face object. */ + /* */ + typedef struct FT_FaceRec_* FT_Face; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Size */ + /* */ + /* <Description> */ + /* A handle to a given size object. Such an object models the data */ + /* that depends on the current _resolution_ and _character size_ in a */ + /* given @FT_Face. */ + /* */ + /* <Note> */ + /* Each face object owns one or more sizes. There is however a */ + /* single _active_ size for the face at any time that will be used by */ + /* functions like @FT_Load_Glyph, @FT_Get_Kerning, etc. */ + /* */ + /* You can use the @FT_Activate_Size API to change the current */ + /* active size of any given face. */ + /* */ + /* <Also> */ + /* The @FT_SizeRec structure details the publicly accessible fields */ + /* of a given face object. */ + /* */ + typedef struct FT_SizeRec_* FT_Size; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_GlyphSlot */ + /* */ + /* <Description> */ + /* A handle to a given `glyph slot'. A slot is a container where it */ + /* is possible to load any one of the glyphs contained in its parent */ + /* face. */ + /* */ + /* In other words, each time you call @FT_Load_Glyph or */ + /* @FT_Load_Char, the slot's content is erased by the new glyph data, */ + /* i.e. the glyph's metrics, its image (bitmap or outline), and */ + /* other control information. */ + /* */ + /* <Also> */ + /* @FT_GlyphSlotRec details the publicly accessible glyph fields. */ + /* */ + typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_CharMap */ + /* */ + /* <Description> */ + /* A handle to a given character map. A charmap is used to translate */ + /* character codes in a given encoding into glyph indexes for its */ + /* parent's face. Some font formats may provide several charmaps per */ + /* font. */ + /* */ + /* Each face object owns zero or more charmaps, but only one of them */ + /* can be "active" and used by @FT_Get_Char_Index or @FT_Load_Char. */ + /* */ + /* The list of available charmaps in a face is available through the */ + /* "face->num_charmaps" and "face->charmaps" fields of @FT_FaceRec. */ + /* */ + /* The currently active charmap is available as "face->charmap". */ + /* You should call @FT_Set_Charmap to change it. */ + /* */ + /* <Note> */ + /* When a new face is created (either through @FT_New_Face or */ + /* @FT_Open_Face), the library looks for a Unicode charmap within */ + /* the list and automatically activates it. */ + /* */ + /* <Also> */ + /* The @FT_CharMapRec details the publicly accessible fields of a */ + /* given character map. */ + /* */ + typedef struct FT_CharMapRec_* FT_CharMap; + + + /*************************************************************************/ + /* */ + /* <Macro> */ + /* FT_ENC_TAG */ + /* */ + /* <Description> */ + /* This macro converts four letter tags into an unsigned long. It is */ + /* used to define "encoding" identifiers (see @FT_Encoding). */ + /* */ + /* <Note> */ + /* Since many 16bit compilers don't like 32bit enumerations, you */ + /* should redefine this macro in case of problems to something like */ + /* this: */ + /* */ + /* #define FT_ENC_TAG( value, a, b, c, d ) value */ + /* */ + /* to get a simple enumeration without assigning special numbers. */ + /* */ + +#ifndef FT_ENC_TAG +#define FT_ENC_TAG( value, a, b, c, d ) \ + value = ( ( (FT_UInt32)(a) << 24 ) | \ + ( (FT_UInt32)(b) << 16 ) | \ + ( (FT_UInt32)(c) << 8 ) | \ + (FT_UInt32)(d) ) + +#endif /* FT_ENC_TAG */ + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Encoding */ + /* */ + /* <Description> */ + /* An enumeration used to specify encodings supported by charmaps. */ + /* Used in the @FT_Select_Charmap API function. */ + /* */ + /* <Note> */ + /* Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */ + /* all character codes must be expressed as FT_Longs. */ + /* */ + /* The values of this type correspond to specific character */ + /* repertories (i.e. charsets), and not to text encoding methods */ + /* (like UTF-8, UTF-16, GB2312_EUC, etc.). */ + /* */ + /* Other encodings might be defined in the future. */ + /* */ + /* <Values> */ + /* FT_ENCODING_NONE :: */ + /* The encoding value 0 is reserved. */ + /* */ + /* FT_ENCODING_UNICODE :: */ + /* Corresponds to the Unicode character set. This value covers */ + /* all versions of the Unicode repertoire, including ASCII and */ + /* Latin-1. Most fonts include a Unicode charmap, but not all */ + /* of them. */ + /* */ + /* FT_ENCODING_MS_SYMBOL :: */ + /* Corresponds to the Microsoft Symbol encoding, used to encode */ + /* mathematical symbols in the 32..255 character code range. For */ + /* more information, see `http://www.ceviz.net/symbol.htm'. */ + /* */ + /* FT_ENCODING_SJIS :: */ + /* Corresponds to Japanese SJIS encoding. More info at */ + /* at `http://langsupport.japanreference.com/encoding.shtml'. */ + /* See note on multi-byte encodings below. */ + /* */ + /* FT_ENCODING_GB2312 :: */ + /* Corresponds to an encoding system for Simplified Chinese as used */ + /* used in mainland China. */ + /* */ + /* FT_ENCODING_BIG5 :: */ + /* Corresponds to an encoding system for Traditional Chinese as used */ + /* in Taiwan and Hong Kong. */ + /* */ + /* FT_ENCODING_WANSUNG :: */ + /* Corresponds to the Korean encoding system known as Wansung. */ + /* For more information see */ + /* `http://www.microsoft.com/typography/unicode/949.txt'. */ + /* */ + /* FT_ENCODING_JOHAB :: */ + /* The Korean standard character set (KS C-5601-1992), which */ + /* corresponds to MS Windows code page 1361. This character set */ + /* includes all possible Hangeul character combinations. */ + /* */ + /* FT_ENCODING_ADOBE_LATIN_1 :: */ + /* Corresponds to a Latin-1 encoding as defined in a Type 1 */ + /* Postscript font. It is limited to 256 character codes. */ + /* */ + /* FT_ENCODING_ADOBE_STANDARD :: */ + /* Corresponds to the Adobe Standard encoding, as found in Type 1, */ + /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ + /* codes. */ + /* */ + /* FT_ENCODING_ADOBE_EXPERT :: */ + /* Corresponds to the Adobe Expert encoding, as found in Type 1, */ + /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ + /* codes. */ + /* */ + /* FT_ENCODING_ADOBE_CUSTOM :: */ + /* Corresponds to a custom encoding, as found in Type 1, CFF, and */ + /* OpenType/CFF fonts. It is limited to 256 character codes. */ + /* */ + /* FT_ENCODING_APPLE_ROMAN :: */ + /* Corresponds to the 8-bit Apple roman encoding. Many TrueType and */ + /* OpenType fonts contain a charmap for this encoding, since older */ + /* versions of Mac OS are able to use it. */ + /* */ + /* FT_ENCODING_OLD_LATIN_2 :: */ + /* This value is deprecated and was never used nor reported by */ + /* FreeType. Don't use or test for it. */ + /* */ + /* FT_ENCODING_MS_SJIS :: */ + /* Same as FT_ENCODING_SJIS. Deprecated. */ + /* */ + /* FT_ENCODING_MS_GB2312 :: */ + /* Same as FT_ENCODING_GB2312. Deprecated. */ + /* */ + /* FT_ENCODING_MS_BIG5 :: */ + /* Same as FT_ENCODING_BIG5. Deprecated. */ + /* */ + /* FT_ENCODING_MS_WANSUNG :: */ + /* Same as FT_ENCODING_WANSUNG. Deprecated. */ + /* */ + /* FT_ENCODING_MS_JOHAB :: */ + /* Same as FT_ENCODING_JOHAB. Deprecated. */ + /* */ + /* <Note> */ + /* By default, FreeType automatically synthetizes a Unicode charmap */ + /* for Postscript fonts, using their glyph names dictionaries. */ + /* However, it will also report the encodings defined explicitly in */ + /* the font file, for the cases when they are needed, with the Adobe */ + /* values as well. */ + /* */ + /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ + /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ + /* FT_ENCODING_UNICODE). Use `FT_Get_BDF_Charset_ID' to find out */ + /* which encoding is really present. If, for example, the */ + /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ + /* the font is encoded in KOI8-R. */ + /* */ + /* FT_ENCODING_NONE is always set (with a single exception) by the */ + /* winfonts driver. Use `FT_Get_WinFNT_Header' and examine the */ + /* `charset' field of the `FT_WinFNT_HeaderRec' structure to find out */ + /* which encoding is really present. For example, FT_WinFNT_ID_CP1251 */ + /* (204) means Windows code page 1251 (for Russian). */ + /* */ + /* FT_ENCODING_NONE is set if `platform_id' is `TT_PLATFORM_MACINTOSH' */ + /* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */ + /* FT_ENCODING_APPLE_ROMAN). */ + /* */ + /* If `platform_id' is `TT_PLATFORM_MACINTOSH', use the function */ + /* `FT_Get_CMap_Language_ID' to query the Mac language ID which may be */ + /* needed to be able to distinguish Apple encoding variants. See */ + /* */ + /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */ + /* */ + /* to get an idea how to do that. Basically, if the language ID is 0, */ + /* dont use it, otherwise subtract 1 from the language ID. Then */ + /* examine `encoding_id'. If, for example, `encoding_id' is */ + /* `TT_MAC_ID_ROMAN' and the language ID (minus 1) is */ + /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ + /* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */ + /* variant the Arabic encoding. */ + /* */ + typedef enum FT_Encoding_ + { + FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), + + FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), + FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), + + FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), + FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), + FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), + FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), + FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), + + /* for backwards compatibility */ + FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, + FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, + FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, + FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, + FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, + + FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), + FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), + FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), + FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), + + FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), + + FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) + + } FT_Encoding; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* ft_encoding_xxx */ + /* */ + /* <Description> */ + /* These constants are deprecated; use the corresponding @FT_Encoding */ + /* values instead. */ + /* */ + /* <Values> */ + /* ft_encoding_none :: see @FT_ENCODING_NONE */ + /* ft_encoding_unicode :: see @FT_ENCODING_UNICODE */ + /* ft_encoding_latin_2 :: see @FT_ENCODING_OLD_LATIN_2 */ + /* ft_encoding_symbol :: see @FT_ENCODING_MS_SYMBOL */ + /* ft_encoding_sjis :: see @FT_ENCODING_SJIS */ + /* ft_encoding_gb2312 :: see @FT_ENCODING_GB2312 */ + /* ft_encoding_big5 :: see @FT_ENCODING_BIG5 */ + /* ft_encoding_wansung :: see @FT_ENCODING_WANSUNG */ + /* ft_encoding_johab :: see @FT_ENCODING_JOHAB */ + /* */ + /* ft_encoding_adobe_standard :: see @FT_ENCODING_ADOBE_STANDARD */ + /* ft_encoding_adobe_expert :: see @FT_ENCODING_ADOBE_EXPERT */ + /* ft_encoding_adobe_custom :: see @FT_ENCODING_ADOBE_CUSTOM */ + /* ft_encoding_latin_1 :: see @FT_ENCODING_ADOBE_LATIN_1 */ + /* */ + /* ft_encoding_apple_roman :: see @FT_ENCODING_APPLE_ROMAN */ + /* */ +#define ft_encoding_none FT_ENCODING_NONE +#define ft_encoding_unicode FT_ENCODING_UNICODE +#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL +#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 +#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 +#define ft_encoding_sjis FT_ENCODING_SJIS +#define ft_encoding_gb2312 FT_ENCODING_GB2312 +#define ft_encoding_big5 FT_ENCODING_BIG5 +#define ft_encoding_wansung FT_ENCODING_WANSUNG +#define ft_encoding_johab FT_ENCODING_JOHAB + +#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD +#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT +#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM +#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_CharMapRec */ + /* */ + /* <Description> */ + /* The base charmap structure. */ + /* */ + /* <Fields> */ + /* face :: A handle to the parent face object. */ + /* */ + /* encoding :: An @FT_Encoding tag identifying the charmap. Use */ + /* this with @FT_Select_Charmap. */ + /* */ + /* platform_id :: An ID number describing the platform for the */ + /* following encoding ID. This comes directly from */ + /* the TrueType specification and should be emulated */ + /* for other formats. */ + /* */ + /* encoding_id :: A platform specific encoding number. This also */ + /* comes from the TrueType specification and should be */ + /* emulated similarly. */ + /* */ + typedef struct FT_CharMapRec_ + { + FT_Face face; + FT_Encoding encoding; + FT_UShort platform_id; + FT_UShort encoding_id; + + } FT_CharMapRec; + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* B A S E O B J E C T C L A S S E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Face_Internal */ + /* */ + /* <Description> */ + /* An opaque handle to an FT_Face_InternalRec structure, used to */ + /* model private data of a given @FT_Face object. */ + /* */ + /* This structure might change between releases of FreeType 2 and is */ + /* not generally available to client applications. */ + /* */ + typedef struct FT_Face_InternalRec_* FT_Face_Internal; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_FaceRec */ + /* */ + /* <Description> */ + /* FreeType root face class structure. A face object models the */ + /* resolution and point-size independent data found in a font file. */ + /* */ + /* <Fields> */ + /* num_faces :: In the case where the face is located in a */ + /* collection (i.e., a file which embeds */ + /* several faces), this is the total number of */ + /* faces found in the resource. 1 by default. */ + /* Accessing non-existent face indices causes */ + /* an error. */ + /* */ + /* face_index :: The index of the face in its font file. */ + /* Usually, this is 0 for all normal font */ + /* formats. It can be > 0 in the case of */ + /* collections (which embed several fonts in a */ + /* single resource/file). */ + /* */ + /* face_flags :: A set of bit flags that give important */ + /* information about the face; see the */ + /* @FT_FACE_FLAG_XXX constants for details. */ + /* */ + /* style_flags :: A set of bit flags indicating the style of */ + /* the face (i.e., italic, bold, underline, */ + /* etc). See the @FT_STYLE_FLAG_XXX */ + /* constants. */ + /* */ + /* num_glyphs :: The total number of glyphs in the face. */ + /* */ + /* family_name :: The face's family name. This is an ASCII */ + /* string, usually in English, which describes */ + /* the typeface's family (like `Times New */ + /* Roman', `Bodoni', `Garamond', etc). This */ + /* is a least common denominator used to list */ + /* fonts. Some formats (TrueType & OpenType) */ + /* provide localized and Unicode versions of */ + /* this string. Applications should use the */ + /* format specific interface to access them. */ + /* */ + /* style_name :: The face's style name. This is an ASCII */ + /* string, usually in English, which describes */ + /* the typeface's style (like `Italic', */ + /* `Bold', `Condensed', etc). Not all font */ + /* formats provide a style name, so this field */ + /* is optional, and can be set to NULL. As */ + /* for `family_name', some formats provide */ + /* localized/Unicode versions of this string. */ + /* Applications should use the format specific */ + /* interface to access them. */ + /* */ + /* num_fixed_sizes :: The number of fixed sizes available in this */ + /* face. This should be set to 0 for scalable */ + /* fonts, unless its face includes a set of */ + /* glyphs (called a `strike') for the */ + /* specified sizes. */ + /* */ + /* available_sizes :: An array of sizes specifying the available */ + /* bitmap/graymap sizes that are contained in */ + /* in the font face. Should be set to NULL if */ + /* the field `num_fixed_sizes' is set to 0. */ + /* */ + /* num_charmaps :: The total number of character maps in the */ + /* face. */ + /* */ + /* charmaps :: A table of pointers to the face's charmaps. */ + /* Used to scan the list of available charmaps */ + /* -- this table might change after a call to */ + /* @FT_Attach_File or @FT_Attach_Stream (e.g. */ + /* if used to hook an additional encoding or */ + /* CMap to the face object). */ + /* */ + /* generic :: A field reserved for client uses. See the */ + /* @FT_Generic type description. */ + /* */ + /* bbox :: The font bounding box. Coordinates are */ + /* expressed in font units (see units_per_EM). */ + /* The box is large enough to contain any */ + /* glyph from the font. Thus, bbox.yMax can */ + /* be seen as the `maximal ascender', */ + /* bbox.yMin as the `minimal descender', and */ + /* the maximal glyph width is given by */ + /* `bbox.xMax-bbox.xMin' (not to be confused */ + /* with the maximal _advance_width_). Only */ + /* relevant for scalable formats. */ + /* */ + /* units_per_EM :: The number of font units per EM square for */ + /* this face. This is typically 2048 for */ + /* TrueType fonts, 1000 for Type1 fonts, and */ + /* should be set to the (unrealistic) value 1 */ + /* for fixed-sizes fonts. Only relevant for */ + /* scalable formats. */ + /* */ + /* ascender :: The face's ascender is the vertical */ + /* distance from the baseline to the topmost */ + /* point of any glyph in the face. This */ + /* field's value is positive, expressed in */ + /* font units. Some font designs use a value */ + /* different from `bbox.yMax'. Only relevant */ + /* for scalable formats. */ + /* */ + /* descender :: The face's descender is the vertical */ + /* distance from the baseline to the */ + /* bottommost point of any glyph in the face. */ + /* This field's value is *negative* for values */ + /* below the baseline. It is expressed in */ + /* font units. Some font designs use a value */ + /* different from `bbox.yMin'. Only relevant */ + /* for scalable formats. */ + /* */ + /* height :: The face's height is the vertical distance */ + /* from one baseline to the next when writing */ + /* several lines of text. Its value is always */ + /* positive, expressed in font units. The */ + /* value can be computed as */ + /* `ascender+descender+line_gap' where the */ + /* value of `line_gap' is also called */ + /* `external leading'. Only relevant for */ + /* scalable formats. */ + /* */ + /* max_advance_width :: The maximal advance width, in font units, */ + /* for all glyphs in this face. This can be */ + /* used to make word wrapping computations */ + /* faster. Only relevant for scalable */ + /* formats. */ + /* */ + /* max_advance_height :: The maximal advance height, in font units, */ + /* for all glyphs in this face. This is only */ + /* relevant for vertical layouts, and should */ + /* be set to the `height' for fonts that do */ + /* not provide vertical metrics. Only */ + /* relevant for scalable formats. */ + /* */ + /* underline_position :: The position, in font units, of the */ + /* underline line for this face. It's the */ + /* center of the underlining stem. Only */ + /* relevant for scalable formats. */ + /* */ + /* underline_thickness :: The thickness, in font units, of the */ + /* underline for this face. Only relevant for */ + /* scalable formats. */ + /* */ + /* glyph :: The face's associated glyph slot(s). This */ + /* object is created automatically with a new */ + /* face object. However, certain kinds of */ + /* applications (mainly tools like converters) */ + /* can need more than one slot to ease their */ + /* task. */ + /* */ + /* size :: The current active size for this face. */ + /* */ + /* charmap :: The current active charmap for this face. */ + /* */ + typedef struct FT_FaceRec_ + { + FT_Long num_faces; + FT_Long face_index; + + FT_Long face_flags; + FT_Long style_flags; + + FT_Long num_glyphs; + + FT_String* family_name; + FT_String* style_name; + + FT_Int num_fixed_sizes; + FT_Bitmap_Size* available_sizes; + + FT_Int num_charmaps; + FT_CharMap* charmaps; + + FT_Generic generic; + + /*# the following are only relevant to scalable outlines */ + FT_BBox bbox; + + FT_UShort units_per_EM; + FT_Short ascender; + FT_Short descender; + FT_Short height; + + FT_Short max_advance_width; + FT_Short max_advance_height; + + FT_Short underline_position; + FT_Short underline_thickness; + + FT_GlyphSlot glyph; + FT_Size size; + FT_CharMap charmap; + + /*@private begin */ + + FT_Driver driver; + FT_Memory memory; + FT_Stream stream; + + FT_ListRec sizes_list; + + FT_Generic autohint; + void* extensions; + + FT_Face_Internal internal; + + /*@private end */ + + } FT_FaceRec; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_FACE_FLAG_XXX */ + /* */ + /* <Description> */ + /* A list of bit flags used in the `face_flags' field of the */ + /* @FT_FaceRec structure. They inform client applications of */ + /* properties of the corresponding face. */ + /* */ + /* <Values> */ + /* FT_FACE_FLAG_SCALABLE :: */ + /* Indicates that the face provides vectorial outlines. This */ + /* doesn't prevent embedded bitmaps, i.e., a face can have both */ + /* this bit and @FT_FACE_FLAG_FIXED_SIZES set. */ + /* */ + /* FT_FACE_FLAG_FIXED_SIZES :: */ + /* Indicates that the face contains `fixed sizes', i.e., bitmap */ + /* strikes for some given pixel sizes. See the `num_fixed_sizes' */ + /* and `available_sizes' fields of @FT_FaceRec. */ + /* */ + /* FT_FACE_FLAG_FIXED_WIDTH :: */ + /* Indicates that the face contains fixed-width characters (like */ + /* Courier, Lucido, MonoType, etc.). */ + /* */ + /* FT_FACE_FLAG_SFNT :: */ + /* Indicates that the face uses the `sfnt' storage scheme. For */ + /* now, this means TrueType and OpenType. */ + /* */ + /* FT_FACE_FLAG_HORIZONTAL :: */ + /* Indicates that the face contains horizontal glyph metrics. This */ + /* should be set for all common formats. */ + /* */ + /* FT_FACE_FLAG_VERTICAL :: */ + /* Indicates that the face contains vertical glyph metrics. This */ + /* is only available in some formats, not all of them. */ + /* */ + /* FT_FACE_FLAG_KERNING :: */ + /* Indicates that the face contains kerning information. If set, */ + /* the kerning distance can be retrieved through the function */ + /* @FT_Get_Kerning. Note that if unset, this function will always */ + /* return the vector (0,0). */ + /* */ + /* FT_FACE_FLAG_FAST_GLYPHS :: */ + /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ + /* */ + /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ + /* Indicates that the font contains multiple masters and is capable */ + /* of interpolating between them. See the multiple-masters */ + /* specific API for details. */ + /* */ + /* FT_FACE_FLAG_GLYPH_NAMES :: */ + /* Indicates that the font contains glyph names that can be */ + /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */ + /* fonts contain broken glyph name tables. Use the function */ + /* @FT_Has_PS_Glyph_Names when needed. */ + /* */ + /* FT_FACE_FLAG_EXTERNAL_STREAM :: */ + /* Used internally by FreeType to indicate that a face's stream was */ + /* provided by the client application and should not be destroyed */ + /* when @FT_Done_Face is called. Don't read or test this flag. */ + /* */ +#define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) +#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) +#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) +#define FT_FACE_FLAG_SFNT ( 1L << 3 ) +#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) +#define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) +#define FT_FACE_FLAG_KERNING ( 1L << 6 ) +#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) +#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) +#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) +#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) + + /* */ + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_HORIZONTAL( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains */ + /* horizontal metrics (this is true for all font formats though). */ + /* */ + /* @also: */ + /* @FT_HAS_VERTICAL can be used to check for vertical metrics. */ + /* */ +#define FT_HAS_HORIZONTAL( face ) \ + ( face->face_flags & FT_FACE_FLAG_HORIZONTAL ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_VERTICAL( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains vertical */ + /* metrics. */ + /* */ +#define FT_HAS_VERTICAL( face ) \ + ( face->face_flags & FT_FACE_FLAG_VERTICAL ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_KERNING( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains kerning */ + /* data that can be accessed with @FT_Get_Kerning. */ + /* */ +#define FT_HAS_KERNING( face ) \ + ( face->face_flags & FT_FACE_FLAG_KERNING ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_IS_SCALABLE( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains a */ + /* scalable font face (true for TrueType, Type 1, CID, and */ + /* OpenType/CFF font formats. */ + /* */ +#define FT_IS_SCALABLE( face ) \ + ( face->face_flags & FT_FACE_FLAG_SCALABLE ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_IS_SFNT( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains a font */ + /* whose format is based on the SFNT storage scheme. This usually */ + /* means: TrueType fonts, OpenType fonts, as well as SFNT-based */ + /* embedded bitmap fonts. */ + /* */ + /* If this macro is true, all functions defined in @FT_SFNT_NAMES_H */ + /* and @FT_TRUETYPE_TABLES_H are available. */ + /* */ +#define FT_IS_SFNT( face ) \ + ( face->face_flags & FT_FACE_FLAG_SFNT ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_IS_FIXED_WIDTH( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains a font */ + /* face that contains fixed-width (or "monospace", "fixed-pitch", */ + /* etc.) glyphs. */ + /* */ +#define FT_IS_FIXED_WIDTH( face ) \ + ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_FIXED_SIZES( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains some */ + /* embedded bitmaps. See the `available_sizes' field of the */ + /* @FT_FaceRec structure. */ + /* */ +#define FT_HAS_FIXED_SIZES( face ) \ + ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) + + + /* */ + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_FAST_GLYPHS( face ) */ + /* */ + /* @description: */ + /* Deprecated; indicates that the face contains so-called "fast" */ + /* glyph bitmaps. */ + /* */ +#define FT_HAS_FAST_GLYPHS( face ) \ + ( face->face_flags & FT_FACE_FLAG_FAST_GLYPHS ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_GLYPH_NAMES( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains some */ + /* glyph names that can be accessed through @FT_Get_Glyph_Name. */ + /* */ +#define FT_HAS_GLYPH_NAMES( face ) \ + ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_HAS_MULTIPLE_MASTERS( face ) */ + /* */ + /* @description: */ + /* A macro that returns true whenever a face object contains some */ + /* multiple masters. The functions provided by */ + /* @FT_MULTIPLE_MASTERS_H are then available to choose the exact */ + /* design you want. */ + /* */ +#define FT_HAS_MULTIPLE_MASTERS( face ) \ + ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) + + + /*************************************************************************/ + /* */ + /* <Constant> */ + /* FT_STYLE_FLAG_XXX */ + /* */ + /* <Description> */ + /* A list of bit-flags used to indicate the style of a given face. */ + /* These are used in the `style_flags' field of @FT_FaceRec. */ + /* */ + /* <Values> */ + /* FT_STYLE_FLAG_ITALIC :: */ + /* Indicates that a given face is italicized. */ + /* */ + /* FT_STYLE_FLAG_BOLD :: */ + /* Indicates that a given face is bold. */ + /* */ +#define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) +#define FT_STYLE_FLAG_BOLD ( 1 << 1 ) + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Size_Internal */ + /* */ + /* <Description> */ + /* An opaque handle to an FT_Size_InternalRec structure, used to */ + /* model private data of a given FT_Size object. */ + /* */ + typedef struct FT_Size_InternalRec_* FT_Size_Internal; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Size_Metrics */ + /* */ + /* <Description> */ + /* The size metrics structure returned scaled important distances for */ + /* a given size object. */ + /* */ + /* <Fields> */ + /* x_ppem :: The character width, expressed in integer pixels. */ + /* This is the width of the EM square expressed in */ + /* pixels, hence the term `ppem' (pixels per EM). */ + /* */ + /* y_ppem :: The character height, expressed in integer pixels. */ + /* This is the height of the EM square expressed in */ + /* pixels, hence the term `ppem' (pixels per EM). */ + /* */ + /* x_scale :: A simple 16.16 fixed point format coefficient used */ + /* to scale horizontal distances expressed in font */ + /* units to fractional (26.6) pixel coordinates. */ + /* */ + /* y_scale :: A simple 16.16 fixed point format coefficient used */ + /* to scale vertical distances expressed in font */ + /* units to fractional (26.6) pixel coordinates. */ + /* */ + /* ascender :: The ascender, expressed in 26.6 fixed point */ + /* pixels. Positive for ascenders above the */ + /* baseline. */ + /* */ + /* descender :: The descender, expressed in 26.6 fixed point */ + /* pixels. Negative for descenders below the */ + /* baseline. */ + /* */ + /* height :: The text height, expressed in 26.6 fixed point */ + /* pixels. Always positive. */ + /* */ + /* max_advance :: Maximum horizontal advance, expressed in 26.6 */ + /* fixed point pixels. Always positive. */ + /* */ + /* <Note> */ + /* For scalable fonts, the values of `ascender', `descender', and */ + /* `height' are scaled versions of `face->ascender', */ + /* `face->descender', and `face->height', respectively. */ + /* */ + /* Unfortunately, due to glyph hinting, these values might not be */ + /* exact for certain fonts. They thus must be treated as unreliable */ + /* with an error margin of at least one pixel! */ + /* */ + /* Indeed, the only way to get the exact pixel ascender and descender */ + /* is to render _all_ glyphs. As this would be a definite */ + /* performance hit, it is up to client applications to perform such */ + /* computations. */ + /* */ + typedef struct FT_Size_Metrics_ + { + FT_UShort x_ppem; /* horizontal pixels per EM */ + FT_UShort y_ppem; /* vertical pixels per EM */ + + FT_Fixed x_scale; /* two scales used to convert font units */ + FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates */ + + FT_Pos ascender; /* ascender in 26.6 frac. pixels */ + FT_Pos descender; /* descender in 26.6 frac. pixels */ + FT_Pos height; /* text height in 26.6 frac. pixels */ + FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ + + } FT_Size_Metrics; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_SizeRec */ + /* */ + /* <Description> */ + /* FreeType root size class structure. A size object models the */ + /* resolution and pointsize dependent data of a given face. */ + /* */ + /* <Fields> */ + /* face :: Handle to the parent face object. */ + /* */ + /* generic :: A typeless pointer, which is unused by the FreeType */ + /* library or any of its drivers. It can be used by */ + /* client applications to link their own data to each size */ + /* object. */ + /* */ + /* metrics :: Metrics for this size object. This field is read-only. */ + /* */ + typedef struct FT_SizeRec_ + { + FT_Face face; /* parent face object */ + FT_Generic generic; /* generic pointer for client uses */ + FT_Size_Metrics metrics; /* size metrics */ + FT_Size_Internal internal; + + } FT_SizeRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_SubGlyph */ + /* */ + /* <Description> */ + /* The subglyph structure is an internal object used to describe */ + /* subglyphs (for example, in the case of composites). */ + /* */ + /* <Note> */ + /* The subglyph implementation is not part of the high-level API, */ + /* hence the forward structure declaration. */ + /* */ + typedef struct FT_SubGlyphRec_* FT_SubGlyph; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Slot_Internal */ + /* */ + /* <Description> */ + /* An opaque handle to an FT_Slot_InternalRec structure, used to */ + /* model private data of a given FT_GlyphSlot object. */ + /* */ + typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_GlyphSlotRec */ + /* */ + /* <Description> */ + /* FreeType root glyph slot class structure. A glyph slot is a */ + /* container where individual glyphs can be loaded, be they */ + /* vectorial or bitmap/graymaps. */ + /* */ + /* <Fields> */ + /* library :: A handle to the FreeType library instance */ + /* this slot belongs to. */ + /* */ + /* face :: A handle to the parent face object. */ + /* */ + /* next :: In some cases (like some font tools), several */ + /* glyph slots per face object can be a good */ + /* thing. As this is rare, the glyph slots are */ + /* listed through a direct, single-linked list */ + /* using its `next' field. */ + /* */ + /* generic :: A typeless pointer which is unused by the */ + /* FreeType library or any of its drivers. It */ + /* can be used by client applications to link */ + /* their own data to each glyph slot object. */ + /* */ + /* metrics :: The metrics of the last loaded glyph in the */ + /* slot. The returned values depend on the last */ + /* load flags (see the @FT_Load_Glyph API */ + /* function) and can be expressed either in 26.6 */ + /* fractional pixels or font units. */ + /* */ + /* Note that even when the glyph image is */ + /* transformed, the metrics are not. */ + /* */ + /* linearHoriAdvance :: For scalable formats only, this field holds */ + /* the linearly scaled horizontal advance width */ + /* for the glyph (i.e. the scaled and unhinted */ + /* value of the hori advance). This can be */ + /* important to perform correct WYSIWYG layout. */ + /* */ + /* Note that this value is expressed by default */ + /* in 16.16 pixels. However, when the glyph is */ + /* loaded with the FT_LOAD_LINEAR_DESIGN flag, */ + /* this field contains simply the value of the */ + /* advance in original font units. */ + /* */ + /* linearVertAdvance :: For scalable formats only, this field holds */ + /* the linearly scaled vertical advance height */ + /* for the glyph. See linearHoriAdvance for */ + /* comments. */ + /* */ + /* advance :: This is the transformed advance width for the */ + /* glyph. */ + /* */ + /* format :: This field indicates the format of the image */ + /* contained in the glyph slot. Typically */ + /* FT_GLYPH_FORMAT_BITMAP, */ + /* FT_GLYPH_FORMAT_OUTLINE, and */ + /* FT_GLYPH_FORMAT_COMPOSITE, but others are */ + /* possible. */ + /* */ + /* bitmap :: This field is used as a bitmap descriptor */ + /* when the slot format is */ + /* FT_GLYPH_FORMAT_BITMAP. Note that the */ + /* address and content of the bitmap buffer can */ + /* change between calls of @FT_Load_Glyph and a */ + /* few other functions. */ + /* */ + /* bitmap_left :: This is the bitmap's left bearing expressed */ + /* in integer pixels. Of course, this is only */ + /* valid if the format is */ + /* FT_GLYPH_FORMAT_BITMAP. */ + /* */ + /* bitmap_top :: This is the bitmap's top bearing expressed in */ + /* integer pixels. Remember that this is the */ + /* distance from the baseline to the top-most */ + /* glyph scanline, upwards y-coordinates being */ + /* *positive*. */ + /* */ + /* outline :: The outline descriptor for the current glyph */ + /* image if its format is */ + /* FT_GLYPH_FORMAT_OUTLINE. */ + /* */ + /* num_subglyphs :: The number of subglyphs in a composite glyph. */ + /* This field is only valid for the composite */ + /* glyph format that should normally only be */ + /* loaded with the @FT_LOAD_NO_RECURSE flag. */ + /* For now this is internal to FreeType. */ + /* */ + /* subglyphs :: An array of subglyph descriptors for */ + /* composite glyphs. There are `num_subglyphs' */ + /* elements in there. Currently internal to */ + /* FreeType. */ + /* */ + /* control_data :: Certain font drivers can also return the */ + /* control data for a given glyph image (e.g. */ + /* TrueType bytecode, Type 1 charstrings, etc.). */ + /* This field is a pointer to such data. */ + /* */ + /* control_len :: This is the length in bytes of the control */ + /* data. */ + /* */ + /* other :: Really wicked formats can use this pointer to */ + /* present their own glyph image to client apps. */ + /* Note that the app will need to know about the */ + /* image format. */ + /* */ + /* lsb_delta :: The difference between hinted and unhinted */ + /* left side bearing while autohinting is */ + /* active. Zero otherwise. */ + /* */ + /* rsb_delta :: The difference between hinted and unhinted */ + /* right side bearing while autohinting is */ + /* active. Zero otherwise. */ + /* */ + /* <Note> */ + /* If @FT_Load_Glyph is called with default flags (see */ + /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ + /* its native format (e.g. a vectorial outline for TrueType and */ + /* Type 1 formats). */ + /* */ + /* This image can later be converted into a bitmap by calling */ + /* @FT_Render_Glyph. This function finds the current renderer for */ + /* the native image's format then invokes it. */ + /* */ + /* The renderer is in charge of transforming the native image through */ + /* the slot's face transformation fields, then convert it into a */ + /* bitmap that is returned in `slot->bitmap'. */ + /* */ + /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ + /* to specify the position of the bitmap relative to the current pen */ + /* position (e.g. coordinates [0,0] on the baseline). Of course, */ + /* `slot->format' is also changed to `FT_GLYPH_FORMAT_BITMAP' . */ + /* */ + /* <Note> */ + /* Here a small pseudo code fragment which shows how to use */ + /* `lsb_delta' and `rsb_delta': */ + /* */ + /* { */ + /* FT_Pos origin_x = 0; */ + /* FT_Pos prev_rsb_delta = 0; */ + /* */ + /* */ + /* for all glyphs do */ + /* <compute kern between current and previous glyph and add it to */ + /* `origin_x'> */ + /* */ + /* <load glyph with `FT_Load_Glyph'> */ + /* */ + /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ + /* origin_x -= 64; */ + /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ + /* origin_x += 64; */ + /* */ + /* prev_rsb_delta = face->glyph->rsb_delta; */ + /* */ + /* <save glyph image, or render glyph, or ...> */ + /* */ + /* origin_x += face->glyph->advance.x; */ + /* endfor */ + /* } */ + /* */ + typedef struct FT_GlyphSlotRec_ + { + FT_Library library; + FT_Face face; + FT_GlyphSlot next; + FT_UInt reserved; /* retained for binary compatibility */ + FT_Generic generic; + + FT_Glyph_Metrics metrics; + FT_Fixed linearHoriAdvance; + FT_Fixed linearVertAdvance; + FT_Vector advance; + + FT_Glyph_Format format; + + FT_Bitmap bitmap; + FT_Int bitmap_left; + FT_Int bitmap_top; + + FT_Outline outline; + + FT_UInt num_subglyphs; + FT_SubGlyph subglyphs; + + void* control_data; + long control_len; + + FT_Pos lsb_delta; + FT_Pos rsb_delta; + + void* other; + + FT_Slot_Internal internal; + + } FT_GlyphSlotRec; + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* F U N C T I O N S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Init_FreeType */ + /* */ + /* <Description> */ + /* Initializes a new FreeType library object. The set of modules */ + /* that are registered by this function is determined at build time. */ + /* */ + /* <Output> */ + /* alibrary :: A handle to a new library object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Init_FreeType( FT_Library *alibrary ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Library_Version */ + /* */ + /* <Description> */ + /* Return the version of the FreeType library being used. This is */ + /* useful when dynamically linking to the library, since one cannot */ + /* use the macros FT_FREETYPE_MAJOR, FT_FREETYPE_MINOR, and */ + /* FT_FREETYPE_PATCH. */ + /* */ + /* <Input> */ + /* library :: A source library handle. */ + /* */ + /* <Output> */ + /* amajor :: The major version number. */ + /* */ + /* aminor :: The minor version number. */ + /* */ + /* apatch :: The patch version number. */ + /* */ + /* <Note> */ + /* The reason why this function takes a 'library' argument is because */ + /* certain programs implement library initialization in a custom way */ + /* that doesn't use `FT_Init_FreeType'. */ + /* */ + /* In such cases, the library version might not be available before */ + /* the library object has been created. */ + /* */ + FT_EXPORT( void ) + FT_Library_Version( FT_Library library, + FT_Int *amajor, + FT_Int *aminor, + FT_Int *apatch ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_FreeType */ + /* */ + /* <Description> */ + /* Destroys a given FreeType library object and all of its childs, */ + /* including resources, drivers, faces, sizes, etc. */ + /* */ + /* <Input> */ + /* library :: A handle to the target library object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_FreeType( FT_Library library ); + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_OPEN_XXX */ + /* */ + /* <Description> */ + /* A list of bit-field constants used within the `flags' field of the */ + /* @FT_Open_Args structure. */ + /* */ + /* <Values> */ + /* FT_OPEN_MEMORY :: This is a memory-based stream. */ + /* */ + /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ + /* */ + /* FT_OPEN_PATHNAME :: Create a new input stream from a C */ + /* path name. */ + /* */ + /* FT_OPEN_DRIVER :: Use the `driver' field. */ + /* */ + /* FT_OPEN_PARAMS :: Use the `num_params' & `params' field. */ + /* */ + /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */ + /* */ + /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */ + /* */ + /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */ + /* */ + /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */ + /* */ + /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */ + /* */ + /* <Note> */ + /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ + /* flags are mutually exclusive. */ + /* */ +#define FT_OPEN_MEMORY 0x1 +#define FT_OPEN_STREAM 0x2 +#define FT_OPEN_PATHNAME 0x4 +#define FT_OPEN_DRIVER 0x8 +#define FT_OPEN_PARAMS 0x10 + +#define ft_open_memory FT_OPEN_MEMORY /* deprecated */ +#define ft_open_stream FT_OPEN_STREAM /* deprecated */ +#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */ +#define ft_open_driver FT_OPEN_DRIVER /* deprecated */ +#define ft_open_params FT_OPEN_PARAMS /* deprecated */ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Parameter */ + /* */ + /* <Description> */ + /* A simple structure used to pass more or less generic parameters */ + /* to @FT_Open_Face. */ + /* */ + /* <Fields> */ + /* tag :: A 4-byte identification tag. */ + /* */ + /* data :: A pointer to the parameter data. */ + /* */ + /* <Note> */ + /* The id and function of parameters are driver-specific. */ + /* */ + typedef struct FT_Parameter_ + { + FT_ULong tag; + FT_Pointer data; + + } FT_Parameter; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Open_Args */ + /* */ + /* <Description> */ + /* A structure used to indicate how to open a new font file/stream. */ + /* A pointer to such a structure can be used as a parameter for the */ + /* functions @FT_Open_Face and @FT_Attach_Stream. */ + /* */ + /* <Fields> */ + /* flags :: A set of bit flags indicating how to use the */ + /* structure. */ + /* */ + /* memory_base :: The first byte of the file in memory. */ + /* */ + /* memory_size :: The size in bytes of the file in memory. */ + /* */ + /* pathname :: A pointer to an 8-bit file pathname. */ + /* */ + /* stream :: A handle to a source stream object. */ + /* */ + /* driver :: This field is exclusively used by @FT_Open_Face; */ + /* it simply specifies the font driver to use to open */ + /* the face. If set to 0, FreeType will try to load */ + /* the face with each one of the drivers in its list. */ + /* */ + /* num_params :: The number of extra parameters. */ + /* */ + /* params :: Extra parameters passed to the font driver when */ + /* opening a new face. */ + /* */ + /* <Note> */ + /* The stream type is determined by the contents of `flags' which */ + /* are tested in the following order by @FT_Open_Face: */ + /* */ + /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ + /* memory file of `memory_size' bytes,located at `memory_address'. */ + /* */ + /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */ + /* custom input stream `stream' is used. */ + /* */ + /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */ + /* is a normal file and use `pathname' to open it. */ + /* */ + /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face will only try to */ + /* open the file with the driver whose handler is in `driver'. */ + /* */ + /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */ + /* `num_params' and `params' will be used. They are ignored */ + /* otherwise. */ + /* */ + typedef struct FT_Open_Args_ + { + FT_UInt flags; + const FT_Byte* memory_base; + FT_Long memory_size; + FT_String* pathname; + FT_Stream stream; + FT_Module driver; + FT_Int num_params; + FT_Parameter* params; + + } FT_Open_Args; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Face */ + /* */ + /* <Description> */ + /* Creates a new face object from a given resource and typeface index */ + /* using a pathname to the font file. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library resource. */ + /* */ + /* <Input> */ + /* pathname :: A path to the font file. */ + /* */ + /* face_index :: The index of the face within the resource. The */ + /* first face has index 0. */ + /* */ + /* <Output> */ + /* aface :: A handle to a new face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* Unlike FreeType 1.x, this function automatically creates a glyph */ + /* slot for the face object which can be accessed directly through */ + /* `face->glyph'. */ + /* */ + /* @FT_New_Face can be used to determine and/or check the font format */ + /* of a given font resource. If the `face_index' field is negative, */ + /* the function will _not_ return any face handle in `aface'; the */ + /* return value is 0 if the font format is recognized, or non-zero */ + /* otherwise. */ + /* */ + /* Each new face object created with this function also owns a */ + /* default @FT_Size object, accessible as `face->size'. */ + /* */ + FT_EXPORT( FT_Error ) + FT_New_Face( FT_Library library, + const char* filepathname, + FT_Long face_index, + FT_Face *aface ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Memory_Face */ + /* */ + /* <Description> */ + /* Creates a new face object from a given resource and typeface index */ + /* using a font file already loaded into memory. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library resource. */ + /* */ + /* <Input> */ + /* file_base :: A pointer to the beginning of the font data. */ + /* */ + /* file_size :: The size of the memory chunk used by the font data. */ + /* */ + /* face_index :: The index of the face within the resource. The */ + /* first face has index 0. */ + /* */ + /* <Output> */ + /* aface :: A handle to a new face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The font data bytes are used _directly_ by the @FT_Face object. */ + /* This means that they are not copied, and that the client is */ + /* responsible for releasing/destroying them _after_ the */ + /* corresponding call to @FT_Done_Face . */ + /* */ + /* Unlike FreeType 1.x, this function automatically creates a glyph */ + /* slot for the face object which can be accessed directly through */ + /* `face->glyph'. */ + /* */ + /* @FT_New_Memory_Face can be used to determine and/or check the font */ + /* format of a given font resource. If the `face_index' field is */ + /* negative, the function will _not_ return any face handle in */ + /* `aface'; the return value is 0 if the font format is recognized, */ + /* or non-zero otherwise. */ + /* */ + FT_EXPORT( FT_Error ) + FT_New_Memory_Face( FT_Library library, + const FT_Byte* file_base, + FT_Long file_size, + FT_Long face_index, + FT_Face *aface ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Open_Face */ + /* */ + /* <Description> */ + /* Opens a face object from a given resource and typeface index using */ + /* an `FT_Open_Args' structure. If the face object doesn't exist, it */ + /* will be created. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library resource. */ + /* */ + /* <Input> */ + /* args :: A pointer to an `FT_Open_Args' structure which must */ + /* be filled by the caller. */ + /* */ + /* face_index :: The index of the face within the resource. The */ + /* first face has index 0. */ + /* */ + /* <Output> */ + /* aface :: A handle to a new face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* Unlike FreeType 1.x, this function automatically creates a glyph */ + /* slot for the face object which can be accessed directly through */ + /* `face->glyph'. */ + /* */ + /* @FT_Open_Face can be used to determine and/or check the font */ + /* format of a given font resource. If the `face_index' field is */ + /* negative, the function will _not_ return any face handle in */ + /* `*aface'; the function's return value is 0 if the font format is */ + /* recognized, or non-zero otherwise. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Open_Face( FT_Library library, + const FT_Open_Args* args, + FT_Long face_index, + FT_Face *aface ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Attach_File */ + /* */ + /* <Description> */ + /* `Attaches' a given font file to an existing face. This is usually */ + /* to read additional information for a single face object. For */ + /* example, it is used to read the AFM files that come with Type 1 */ + /* fonts in order to add kerning data and other metrics. */ + /* */ + /* <InOut> */ + /* face :: The target face object. */ + /* */ + /* <Input> */ + /* filepathname :: An 8-bit pathname naming the `metrics' file. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* If your font file is in memory, or if you want to provide your */ + /* own input stream object, use @FT_Attach_Stream. */ + /* */ + /* The meaning of the `attach' action (i.e., what really happens when */ + /* the new file is read) is not fixed by FreeType itself. It really */ + /* depends on the font format (and thus the font driver). */ + /* */ + /* Client applications are expected to know what they are doing */ + /* when invoking this function. Most drivers simply do not implement */ + /* file attachments. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Attach_File( FT_Face face, + const char* filepathname ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Attach_Stream */ + /* */ + /* <Description> */ + /* This function is similar to @FT_Attach_File with the exception */ + /* that it reads the attachment from an arbitrary stream. */ + /* */ + /* <InOut> */ + /* face :: The target face object. */ + /* */ + /* <Input> */ + /* parameters :: A pointer to an FT_Open_Args structure used to */ + /* describe the input stream to FreeType. */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The meaning of the `attach' (i.e. what really happens when the */ + /* new file is read) is not fixed by FreeType itself. It really */ + /* depends on the font format (and thus the font driver). */ + /* */ + /* Client applications are expected to know what they are doing */ + /* when invoking this function. Most drivers simply do not implement */ + /* file attachments. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Attach_Stream( FT_Face face, + FT_Open_Args* parameters ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_Face */ + /* */ + /* <Description> */ + /* Discards a given face object, as well as all of its child slots */ + /* and sizes. */ + /* */ + /* <Input> */ + /* face :: A handle to a target face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_Face( FT_Face face ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Char_Size */ + /* */ + /* <Description> */ + /* Sets the character dimensions of a given face object. The */ + /* `char_width' and `char_height' values are used for the width and */ + /* height, respectively, expressed in 26.6 fractional points. */ + /* */ + /* If the horizontal or vertical resolution values are zero, a */ + /* default value of 72dpi is used. Similarly, if one of the */ + /* character dimensions is zero, its value is set equal to the other. */ + /* */ + /* <InOut> */ + /* face :: A handle to a target face object. */ + /* */ + /* <Input> */ + /* char_width :: The character width, in 26.6 fractional points. */ + /* */ + /* char_height :: The character height, in 26.6 fractional */ + /* points. */ + /* */ + /* horz_resolution :: The horizontal resolution. */ + /* */ + /* vert_resolution :: The vertical resolution. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* For BDF and PCF formats, this function uses the `PIXEL_SIZE' */ + /* property of the bitmap font; the `char_width' parameter is */ + /* ignored. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Char_Size( FT_Face face, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Pixel_Sizes */ + /* */ + /* <Description> */ + /* Sets the character dimensions of a given face object. The width */ + /* and height are expressed in integer pixels. */ + /* */ + /* If one of the character dimensions is zero, its value is set equal */ + /* to the other. */ + /* */ + /* <InOut> */ + /* face :: A handle to the target face object. */ + /* */ + /* <Input> */ + /* pixel_width :: The character width, in integer pixels. */ + /* */ + /* pixel_height :: The character height, in integer pixels. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The values of `pixel_width' and `pixel_height' correspond to the */ + /* pixel values of the _typographic_ character size, which are NOT */ + /* necessarily the same as the dimensions of the glyph `bitmap */ + /* cells'. */ + /* */ + /* The `character size' is really the size of an abstract square */ + /* called the `EM', used to design the font. However, depending */ + /* on the font design, glyphs will be smaller or greater than the */ + /* EM. */ + /* */ + /* This means that setting the pixel size to, say, 8x8 doesn't */ + /* guarantee in any way that you will get glyph bitmaps that all fit */ + /* within an 8x8 cell (sometimes even far from it). */ + /* */ + /* For bitmap fonts, `pixel_height' usually is a reliable value for */ + /* the height of the bitmap cell. Drivers for bitmap font formats */ + /* which contain a single bitmap strike only (BDF, PCF, FNT) ignore */ + /* `pixel_width'. */ + /* */ + /* For BDF and PCF formats, this function uses the sum of the */ + /* `FONT_ASCENT' and `FONT_DESCENT' properties of the bitmap font. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Pixel_Sizes( FT_Face face, + FT_UInt pixel_width, + FT_UInt pixel_height ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Load_Glyph */ + /* */ + /* <Description> */ + /* A function used to load a single glyph within a given glyph slot, */ + /* for a given size. */ + /* */ + /* <InOut> */ + /* face :: A handle to the target face object where the glyph */ + /* will be loaded. */ + /* */ + /* <Input> */ + /* glyph_index :: The index of the glyph in the font file. For */ + /* CID-keyed fonts (either in PS or in CFF format) */ + /* this argument specifies the CID value. */ + /* */ + /* load_flags :: A flag indicating what to load for this glyph. The */ + /* @FT_LOAD_XXX constants can be used to control the */ + /* glyph loading process (e.g., whether the outline */ + /* should be scaled, whether to load bitmaps or not, */ + /* whether to hint the outline, etc). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* If the glyph image is not a bitmap, and if the bit flag */ + /* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */ + /* transformed with the information passed to a previous call to */ + /* @FT_Set_Transform. */ + /* */ + /* Note that this also transforms the `face.glyph.advance' field, but */ + /* *not* the values in `face.glyph.metrics'. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Load_Glyph( FT_Face face, + FT_UInt glyph_index, + FT_Int32 load_flags ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Load_Char */ + /* */ + /* <Description> */ + /* A function used to load a single glyph within a given glyph slot, */ + /* for a given size, according to its character code. */ + /* */ + /* <InOut> */ + /* face :: A handle to a target face object where the glyph */ + /* will be loaded. */ + /* */ + /* <Input> */ + /* char_code :: The glyph's character code, according to the */ + /* current charmap used in the face. */ + /* */ + /* load_flags :: A flag indicating what to load for this glyph. The */ + /* @FT_LOAD_XXX constants can be used to control the */ + /* glyph loading process (e.g., whether the outline */ + /* should be scaled, whether to load bitmaps or not, */ + /* whether to hint the outline, etc). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* If the face has no current charmap, or if the character code */ + /* is not defined in the charmap, this function will return an */ + /* error. */ + /* */ + /* If the glyph image is not a bitmap, and if the bit flag */ + /* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */ + /* transformed with the information passed to a previous call to */ + /* @FT_Set_Transform. */ + /* */ + /* Note that this also transforms the `face.glyph.advance' field, but */ + /* *not* the values in `face.glyph.metrics'. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Load_Char( FT_Face face, + FT_ULong char_code, + FT_Int32 load_flags ); + + + /*************************************************************************** + * + * @enum: + * FT_LOAD_XXX + * + * @description: + * A list of bit-field constants, used with @FT_Load_Glyph to indicate + * what kind of operations to perform during glyph loading. + * + * @values: + * FT_LOAD_DEFAULT :: + * Corresponding to 0, this value is used a default glyph load. In this + * case, the following will happen: + * + * 1. FreeType looks for a bitmap for the glyph corresponding to the + * face's current size. If one is found, the function returns. The + * bitmap data can be accessed from the glyph slot (see note below). + * + * 2. If no embedded bitmap is searched or found, FreeType looks for a + * scalable outline. If one is found, it is loaded from the font + * file, scaled to device pixels, then "hinted" to the pixel grid in + * order to optimize it. The outline data can be accessed from the + * glyph slot (see note below). + * + * Note that by default, the glyph loader doesn't render outlines into + * bitmaps. The following flags are used to modify this default + * behaviour to more specific and useful cases. + * + * FT_LOAD_NO_SCALE :: + * Don't scale the vector outline being loaded to 26.6 fractional + * pixels, but kept in font units. Note that this also disables + * hinting and the loading of embedded bitmaps. You should only use it + * when you want to retrieve the original glyph outlines in font units. + * + * FT_LOAD_NO_HINTING :: + * Don't hint glyph outlines after their scaling to device pixels. + * This generally generates "blurrier" glyphs in anti-aliased modes. + * + * This flag is ignored if @FT_LOAD_NO_SCALE is set. + * + * FT_LOAD_RENDER :: + * Render the glyph outline immediately into a bitmap before the glyph + * loader returns. By default, the glyph is rendered for the + * @FT_RENDER_MODE_NORMAL mode, which corresponds to 8-bit anti-aliased + * bitmaps using 256 opacity levels. You can use either + * @FT_LOAD_TARGET_MONO or @FT_LOAD_MONOCHROME to render 1-bit + * monochrome bitmaps. + * + * This flag is ignored if @FT_LOAD_NO_SCALE is set. + * + * FT_LOAD_NO_BITMAP :: + * Don't look for bitmaps when loading the glyph. Only scalable + * outlines will be loaded when available, and scaled, hinted, or + * rendered depending on other bit flags. + * + * This does not prevent you from rendering outlines to bitmaps + * with @FT_LOAD_RENDER, however. + * + * FT_LOAD_VERTICAL_LAYOUT :: + * Prepare the glyph image for vertical text layout. This basically + * means that `face.glyph.advance' will correspond to the vertical + * advance height (instead of the default horizontal advance width), + * and that the glyph image will be translated to match the vertical + * bearings positions. + * + * FT_LOAD_FORCE_AUTOHINT :: + * Force the use of the FreeType auto-hinter when a glyph outline is + * loaded. You shouldn't need this in a typical application, since it + * is mostly used to experiment with its algorithm. + * + * FT_LOAD_CROP_BITMAP :: + * Indicates that the glyph loader should try to crop the bitmap (i.e., + * remove all space around its black bits) when loading it. This is + * only useful when loading embedded bitmaps in certain fonts, since + * bitmaps rendered with @FT_LOAD_RENDER are always cropped by default. + * + * FT_LOAD_PEDANTIC :: + * Indicates that the glyph loader should perform pedantic + * verifications during glyph loading, rejecting invalid fonts. This + * is mostly used to detect broken glyphs in fonts. By default, + * FreeType tries to handle broken fonts also. + * + * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: + * Indicates that the glyph loader should ignore the global advance + * width defined in the font. For historical reasons (to support + * buggy CJK fonts), FreeType uses the value of the `advanceWidthMax' + * field in the `htmx' table for all glyphs if the font is monospaced. + * Activating this flags makes FreeType use the metric values given in + * the `htmx' table. + * + * FT_LOAD_NO_RECURSE :: + * This flag is only used internally. It merely indicates that the + * glyph loader should not load composite glyphs recursively. Instead, + * it should set the `num_subglyph' and `subglyphs' values of the glyph + * slot accordingly, and set "glyph->format" to + * @FT_GLYPH_FORMAT_COMPOSITE. + * + * The description of sub-glyphs is not available to client + * applications for now. + * + * FT_LOAD_IGNORE_TRANSFORM :: + * Indicates that the glyph loader should not try to transform the + * loaded glyph image. This doesn't prevent scaling, hinting, or + * rendering. + * + * FT_LOAD_MONOCHROME :: + * This flag is used with @FT_LOAD_RENDER to indicate that you want + * to render a 1-bit monochrome glyph bitmap from a vectorial outline. + * + * Note that this has no effect on the hinting algorithm used by the + * glyph loader. You should better use @FT_LOAD_TARGET_MONO if you + * want to render monochrome-optimized glyph images instead. + * + * FT_LOAD_LINEAR_DESIGN :: + * Return the linearly scaled metrics expressed in original font units + * instead of the default 16.16 pixel values. + * + * FT_LOAD_NO_AUTOHINT :: + * Indicates that the auto-hinter should never be used to hint glyph + * outlines. This doesn't prevent native format-specific hinters from + * being used. This can be important for certain fonts where unhinted + * output is better than auto-hinted one. + * + * FT_LOAD_TARGET_NORMAL :: + * Use hinting for @FT_RENDER_MODE_NORMAL. + * + * FT_LOAD_TARGET_LIGHT :: + * Use hinting for @FT_RENDER_MODE_LIGHT. + * + * FT_LOAD_TARGET_MONO :: + * Use hinting for @FT_RENDER_MODE_MONO. + * + * FT_LOAD_TARGET_LCD :: + * Use hinting for @FT_RENDER_MODE_LCD. + * + * FT_LOAD_TARGET_LCD_V :: + * Use hinting for @FT_RENDER_MODE_LCD_V. + */ +#define FT_LOAD_DEFAULT 0x0 +#define FT_LOAD_NO_SCALE 0x1 +#define FT_LOAD_NO_HINTING 0x2 +#define FT_LOAD_RENDER 0x4 +#define FT_LOAD_NO_BITMAP 0x8 +#define FT_LOAD_VERTICAL_LAYOUT 0x10 +#define FT_LOAD_FORCE_AUTOHINT 0x20 +#define FT_LOAD_CROP_BITMAP 0x40 +#define FT_LOAD_PEDANTIC 0x80 +#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200 +#define FT_LOAD_NO_RECURSE 0x400 +#define FT_LOAD_IGNORE_TRANSFORM 0x800 +#define FT_LOAD_MONOCHROME 0x1000 +#define FT_LOAD_LINEAR_DESIGN 0x2000 + + /* temporary hack! */ +#define FT_LOAD_SBITS_ONLY 0x4000 +#define FT_LOAD_NO_AUTOHINT 0x8000U + + /* */ + +#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) +#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) + +#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) +#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) +#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) +#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) +#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) + + /* */ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Transform */ + /* */ + /* <Description> */ + /* A function used to set the transformation that is applied to glyph */ + /* images when they are loaded into a glyph slot through */ + /* @FT_Load_Glyph. */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face object. */ + /* */ + /* <Input> */ + /* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */ + /* the identity matrix. */ + /* delta :: A pointer to the translation vector. Use 0 for the null */ + /* vector. */ + /* */ + /* <Note> */ + /* The transformation is only applied to scalable image formats after */ + /* the glyph has been loaded. It means that hinting is unaltered by */ + /* the transformation and is performed on the character size given in */ + /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ + /* */ + FT_EXPORT( void ) + FT_Set_Transform( FT_Face face, + FT_Matrix* matrix, + FT_Vector* delta ); + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Render_Mode */ + /* */ + /* <Description> */ + /* An enumeration type that lists the render modes supported by */ + /* FreeType 2. Each mode corresponds to a specific type of scanline */ + /* conversion performed on the outline, as well as specific */ + /* hinting optimizations. */ + /* */ + /* For bitmap fonts the `bitmap->pixel_mode' field in the */ + /* @FT_GlyphSlotRec structure gives the format of the returned */ + /* bitmap. */ + /* */ + /* <Values> */ + /* FT_RENDER_MODE_NORMAL :: */ + /* This is the default render mode; it corresponds to 8-bit */ + /* anti-aliased bitmaps, using 256 levels of opacity. */ + /* */ + /* FT_RENDER_MODE_LIGHT :: */ + /* This is similar to @FT_RENDER_MODE_NORMAL -- you have to use */ + /* @FT_LOAD_TARGET_LIGHT in calls to @FT_Load_Glyph to get any */ + /* effect since the rendering process no longer influences the */ + /* positioning of glyph outlines. */ + /* */ + /* The resulting glyph shapes are more similar to the original, */ + /* while being a bit more fuzzy (`better shapes' instead of `better */ + /* contrast', so to say. */ + /* */ + /* FT_RENDER_MODE_MONO :: */ + /* This mode corresponds to 1-bit bitmaps. */ + /* */ + /* FT_RENDER_MODE_LCD :: */ + /* This mode corresponds to horizontal RGB/BGR sub-pixel displays, */ + /* like LCD-screens. It produces 8-bit bitmaps that are 3 times */ + /* the width of the original glyph outline in pixels, and which use */ + /* the @FT_PIXEL_MODE_LCD mode. */ + /* */ + /* FT_RENDER_MODE_LCD_V :: */ + /* This mode corresponds to vertical RGB/BGR sub-pixel displays */ + /* (like PDA screens, rotated LCD displays, etc.). It produces */ + /* 8-bit bitmaps that are 3 times the height of the original */ + /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ + /* */ + /* <Note> */ + /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */ + /* _not filtered_ to reduce color-fringes. It is up to the caller to */ + /* perform this pass. */ + /* */ + typedef enum FT_Render_Mode_ + { + FT_RENDER_MODE_NORMAL = 0, + FT_RENDER_MODE_LIGHT, + FT_RENDER_MODE_MONO, + FT_RENDER_MODE_LCD, + FT_RENDER_MODE_LCD_V, + + FT_RENDER_MODE_MAX + + } FT_Render_Mode; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* ft_render_mode_xxx */ + /* */ + /* <Description> */ + /* These constats are deprecated. Use the corresponding */ + /* @FT_Render_Mode values instead. */ + /* */ + /* <Values> */ + /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */ + /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */ + /* */ +#define ft_render_mode_normal FT_RENDER_MODE_NORMAL +#define ft_render_mode_mono FT_RENDER_MODE_MONO + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Render_Glyph */ + /* */ + /* <Description> */ + /* Converts a given glyph image to a bitmap. It does so by */ + /* inspecting the glyph image format, find the relevant renderer, and */ + /* invoke it. */ + /* */ + /* <InOut> */ + /* slot :: A handle to the glyph slot containing the image to */ + /* convert. */ + /* */ + /* <Input> */ + /* render_mode :: This is the render mode used to render the glyph */ + /* image into a bitmap. See FT_Render_Mode for a list */ + /* of possible values. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Render_Glyph( FT_GlyphSlot slot, + FT_Render_Mode render_mode ); + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Kerning_Mode */ + /* */ + /* <Description> */ + /* An enumeration used to specify which kerning values to return in */ + /* @FT_Get_Kerning. */ + /* */ + /* <Values> */ + /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ + /* distances (value is 0). */ + /* */ + /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ + /* distances. */ + /* */ + /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ + /* units. */ + /* */ + typedef enum FT_Kerning_Mode_ + { + FT_KERNING_DEFAULT = 0, + FT_KERNING_UNFITTED, + FT_KERNING_UNSCALED + + } FT_Kerning_Mode; + + + /*************************************************************************/ + /* */ + /* <Const> */ + /* ft_kerning_default */ + /* */ + /* <Description> */ + /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */ + /* instead. */ + /* */ +#define ft_kerning_default FT_KERNING_DEFAULT + + + /*************************************************************************/ + /* */ + /* <Const> */ + /* ft_kerning_unfitted */ + /* */ + /* <Description> */ + /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */ + /* instead. */ + /* */ +#define ft_kerning_unfitted FT_KERNING_UNFITTED + + + /*************************************************************************/ + /* */ + /* <Const> */ + /* ft_kerning_unscaled */ + /* */ + /* <Description> */ + /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */ + /* instead. */ + /* */ +#define ft_kerning_unscaled FT_KERNING_UNSCALED + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Kerning */ + /* */ + /* <Description> */ + /* Returns the kerning vector between two glyphs of a same face. */ + /* */ + /* <Input> */ + /* face :: A handle to a source face object. */ + /* */ + /* left_glyph :: The index of the left glyph in the kern pair. */ + /* */ + /* right_glyph :: The index of the right glyph in the kern pair. */ + /* */ + /* kern_mode :: See @FT_Kerning_Mode for more information. */ + /* Determines the scale/dimension of the returned */ + /* kerning vector. */ + /* */ + /* <Output> */ + /* akerning :: The kerning vector. This is either in font units */ + /* or in pixels (26.6 format) for scalable formats, */ + /* and in pixels for fixed-sizes formats. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* Only horizontal layouts (left-to-right & right-to-left) are */ + /* supported by this method. Other layouts, or more sophisticated */ + /* kernings, are out of the scope of this API function -- they can be */ + /* implemented through format-specific interfaces. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Kerning( FT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_UInt kern_mode, + FT_Vector *akerning ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Glyph_Name */ + /* */ + /* <Description> */ + /* Retrieves the ASCII name of a given glyph in a face. This only */ + /* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */ + /* */ + /* <Input> */ + /* face :: A handle to a source face object. */ + /* */ + /* glyph_index :: The glyph index. */ + /* */ + /* buffer_max :: The maximal number of bytes available in the */ + /* buffer. */ + /* */ + /* <Output> */ + /* buffer :: A pointer to a target buffer where the name will be */ + /* copied to. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* An error is returned if the face doesn't provide glyph names or if */ + /* the glyph index is invalid. In all cases of failure, the first */ + /* byte of `buffer' will be set to 0 to indicate an empty name. */ + /* */ + /* The glyph name is truncated to fit within the buffer if it is too */ + /* long. The returned string is always zero-terminated. */ + /* */ + /* This function is not compiled within the library if the config */ + /* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */ + /* `include/freetype/config/ftoptions.h' */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Glyph_Name( FT_Face face, + FT_UInt glyph_index, + FT_Pointer buffer, + FT_UInt buffer_max ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Postscript_Name */ + /* */ + /* <Description> */ + /* Retrieves the ASCII Postscript name of a given face, if available. */ + /* This only works with Postscript and TrueType fonts. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face object. */ + /* */ + /* <Return> */ + /* A pointer to the face's Postscript name. NULL if unavailable. */ + /* */ + /* <Note> */ + /* The returned pointer is owned by the face and will be destroyed */ + /* with it. */ + /* */ + FT_EXPORT( const char* ) + FT_Get_Postscript_Name( FT_Face face ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Select_Charmap */ + /* */ + /* <Description> */ + /* Selects a given charmap by its encoding tag (as listed in */ + /* `freetype.h'). */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face object. */ + /* */ + /* <Input> */ + /* encoding :: A handle to the selected charmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* This function will return an error if no charmap in the face */ + /* corresponds to the encoding queried here. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Select_Charmap( FT_Face face, + FT_Encoding encoding ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Charmap */ + /* */ + /* <Description> */ + /* Selects a given charmap for character code to glyph index */ + /* decoding. */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face object. */ + /* */ + /* <Input> */ + /* charmap :: A handle to the selected charmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* This function will return an error if the charmap is not part of */ + /* the face (i.e., if it is not listed in the face->charmaps[] */ + /* table). */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Charmap( FT_Face face, + FT_CharMap charmap ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Get_Charmap_Index */ + /* */ + /* @description: */ + /* Retrieve index of a given charmap. */ + /* */ + /* @input: */ + /* charmap :: A handle to a charmap. */ + /* */ + /* @return: */ + /* The index into the array of character maps within the face to */ + /* which `charmap' belongs. */ + /* */ + FT_EXPORT( FT_Int ) + FT_Get_Charmap_Index( FT_CharMap charmap ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Char_Index */ + /* */ + /* <Description> */ + /* Returns the glyph index of a given character code. This function */ + /* uses a charmap object to do the translation. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face object. */ + /* */ + /* charcode :: The character code. */ + /* */ + /* <Return> */ + /* The glyph index. 0 means `undefined character code'. */ + /* */ + /* <Note> */ + /* FreeType computes its own glyph indices which are not necessarily */ + /* the same as used in the font in case the font is based on glyph */ + /* indices. Reason for this behaviour is to assure that index 0 is */ + /* never used, representing the missing glyph. */ + /* */ + FT_EXPORT( FT_UInt ) + FT_Get_Char_Index( FT_Face face, + FT_ULong charcode ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_First_Char */ + /* */ + /* <Description> */ + /* This function is used to return the first character code in the */ + /* current charmap of a given face. It will also return the */ + /* corresponding glyph index. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face object. */ + /* */ + /* <Output> */ + /* agindex :: Glyph index of first character code. 0 if charmap is */ + /* empty. */ + /* */ + /* <Return> */ + /* The charmap's first character code. */ + /* */ + /* <Note> */ + /* You should use this function with @FT_Get_Next_Char to be able to */ + /* parse all character codes available in a given charmap. The code */ + /* should look like this: */ + /* */ + /* { */ + /* FT_ULong charcode; */ + /* FT_UInt gindex; */ + /* */ + /* */ + /* charcode = FT_Get_First_Char( face, &gindex ); */ + /* while ( gindex != 0 ) */ + /* { */ + /* ... do something with (charcode,gindex) pair ... */ + /* */ + /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ + /* } */ + /* } */ + /* */ + /* Note that `*agindex' will be set to 0 if the charmap is empty. */ + /* The result itself can be 0 in two cases: if the charmap is empty */ + /* or when the value 0 is the first valid character code. */ + /* */ + FT_EXPORT( FT_ULong ) + FT_Get_First_Char( FT_Face face, + FT_UInt *agindex ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Next_Char */ + /* */ + /* <Description> */ + /* This function is used to return the next character code in the */ + /* current charmap of a given face following the value 'char_code', */ + /* as well as the corresponding glyph index. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face object. */ + /* char_code :: The starting character code. */ + /* */ + /* <Output> */ + /* agindex :: Glyph index of first character code. 0 if charmap */ + /* is empty. */ + /* */ + /* <Return> */ + /* The charmap's next character code. */ + /* */ + /* <Note> */ + /* You should use this function with @FT_Get_First_Char to walk */ + /* through all character codes available in a given charmap. See */ + /* the note for this function for a simple code example. */ + /* */ + /* Note that `*agindex' will be set to 0 when there are no more codes */ + /* in the charmap. */ + /* */ + FT_EXPORT( FT_ULong ) + FT_Get_Next_Char( FT_Face face, + FT_ULong char_code, + FT_UInt *agindex ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Name_Index */ + /* */ + /* <Description> */ + /* Returns the glyph index of a given glyph name. This function uses */ + /* driver specific objects to do the translation. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face object. */ + /* */ + /* glyph_name :: The glyph name. */ + /* */ + /* <Return> */ + /* The glyph index. 0 means `undefined character code'. */ + /* */ + FT_EXPORT( FT_UInt ) + FT_Get_Name_Index( FT_Face face, + FT_String* glyph_name ); + + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* computations */ + /* */ + /* <Title> */ + /* Computations */ + /* */ + /* <Abstract> */ + /* Crunching fixed numbers and vectors. */ + /* */ + /* <Description> */ + /* This section contains various functions used to perform */ + /* computations on 16.16 fixed-float numbers or 2d vectors. */ + /* */ + /* <Order> */ + /* FT_MulDiv */ + /* FT_MulFix */ + /* FT_DivFix */ + /* FT_RoundFix */ + /* FT_CeilFix */ + /* FT_FloorFix */ + /* FT_Vector_Transform */ + /* FT_Matrix_Multiply */ + /* FT_Matrix_Invert */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_MulDiv */ + /* */ + /* <Description> */ + /* A very simple function used to perform the computation `(a*b)/c' */ + /* with maximal accuracy (it uses a 64-bit intermediate integer */ + /* whenever necessary). */ + /* */ + /* This function isn't necessarily as fast as some processor specific */ + /* operations, but is at least completely portable. */ + /* */ + /* <Input> */ + /* a :: The first multiplier. */ + /* b :: The second multiplier. */ + /* c :: The divisor. */ + /* */ + /* <Return> */ + /* The result of `(a*b)/c'. This function never traps when trying to */ + /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ + /* on the signs of `a' and `b'. */ + /* */ + FT_EXPORT( FT_Long ) + FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_MulFix */ + /* */ + /* <Description> */ + /* A very simple function used to perform the computation */ + /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */ + /* used to multiply a given value by a 16.16 fixed float factor. */ + /* */ + /* <Input> */ + /* a :: The first multiplier. */ + /* b :: The second multiplier. Use a 16.16 factor here whenever */ + /* possible (see note below). */ + /* */ + /* <Return> */ + /* The result of `(a*b)/0x10000'. */ + /* */ + /* <Note> */ + /* This function has been optimized for the case where the absolute */ + /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ + /* As this happens mainly when scaling from notional units to */ + /* fractional pixels in FreeType, it resulted in noticeable speed */ + /* improvements between versions 2.x and 1.x. */ + /* */ + /* As a conclusion, always try to place a 16.16 factor as the */ + /* _second_ argument of this function; this can make a great */ + /* difference. */ + /* */ + FT_EXPORT( FT_Long ) + FT_MulFix( FT_Long a, + FT_Long b ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_DivFix */ + /* */ + /* <Description> */ + /* A very simple function used to perform the computation */ + /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */ + /* used to divide a given value by a 16.16 fixed float factor. */ + /* */ + /* <Input> */ + /* a :: The first multiplier. */ + /* b :: The second multiplier. Use a 16.16 factor here whenever */ + /* possible (see note below). */ + /* */ + /* <Return> */ + /* The result of `(a*0x10000)/b'. */ + /* */ + /* <Note> */ + /* The optimization for FT_DivFix() is simple: If (a << 16) fits in */ + /* 32 bits, then the division is computed directly. Otherwise, we */ + /* use a specialized version of @FT_MulDiv. */ + /* */ + FT_EXPORT( FT_Long ) + FT_DivFix( FT_Long a, + FT_Long b ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_RoundFix */ + /* */ + /* <Description> */ + /* A very simple function used to round a 16.16 fixed number. */ + /* */ + /* <Input> */ + /* a :: The number to be rounded. */ + /* */ + /* <Return> */ + /* The result of `(a + 0x8000) & -0x10000'. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_RoundFix( FT_Fixed a ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_CeilFix */ + /* */ + /* <Description> */ + /* A very simple function used to compute the ceiling function of a */ + /* 16.16 fixed number. */ + /* */ + /* <Input> */ + /* a :: The number for which the ceiling function is to be computed. */ + /* */ + /* <Return> */ + /* The result of `(a + 0x10000 - 1) & -0x10000'. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_CeilFix( FT_Fixed a ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_FloorFix */ + /* */ + /* <Description> */ + /* A very simple function used to compute the floor function of a */ + /* 16.16 fixed number. */ + /* */ + /* <Input> */ + /* a :: The number for which the floor function is to be computed. */ + /* */ + /* <Return> */ + /* The result of `a & -0x10000'. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_FloorFix( FT_Fixed a ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Vector_Transform */ + /* */ + /* <Description> */ + /* Transforms a single vector through a 2x2 matrix. */ + /* */ + /* <InOut> */ + /* vector :: The target vector to transform. */ + /* */ + /* <Input> */ + /* matrix :: A pointer to the source 2x2 matrix. */ + /* */ + /* <Note> */ + /* The result is undefined if either `vector' or `matrix' is invalid. */ + /* */ + FT_EXPORT( void ) + FT_Vector_Transform( FT_Vector* vec, + const FT_Matrix* matrix ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FREETYPE_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ft2build.h b/extlibs/headers/freetype/ft2build.h new file mode 100644 index 00000000..7390dc49 --- /dev/null +++ b/extlibs/headers/freetype/ft2build.h @@ -0,0 +1,61 @@ +/***************************************************************************/ +/* */ +/* ft2build.h */ +/* */ +/* Build macros of the FreeType 2 library. */ +/* */ +/* Copyright 1996-2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This is a Unix-specific version of <ft2build.h> that should be used */ + /* exclusively *after* installation of the library. */ + /* */ + /* It assumes that "/usr/local/include/freetype2" (or whatever is */ + /* returned by the "freetype-config --cflags" or "pkg-config --cflags" */ + /* command) is in your compilation include path. */ + /* */ + /* We don't need to do anything special in this release. However, for */ + /* a future FreeType 2 release, the following installation changes will */ + /* be performed: */ + /* */ + /* - The contents of "freetype-2.x/include/freetype" will be installed */ + /* to "/usr/local/include/freetype2" instead of */ + /* "/usr/local/include/freetype2/freetype". */ + /* */ + /* - This file will #include <freetype2/config/ftheader.h>, instead */ + /* of <freetype/config/ftheader.h>. */ + /* */ + /* - The contents of "ftheader.h" will be processed with `sed' to */ + /* replace all "<freetype/xxx>" with "<freetype2/xxx>". */ + /* */ + /* - Adding "/usr/local/include/freetype2" to your compilation include */ + /* path will not be necessary anymore. */ + /* */ + /* These changes will be transparent to client applications which use */ + /* freetype-config (or pkg-config). No modifications will be necessary */ + /* to compile with the new scheme. */ + /* */ + /*************************************************************************/ + + +#ifndef __FT2_BUILD_UNIX_H__ +#define __FT2_BUILD_UNIX_H__ + + /* "<prefix>/include/freetype2" must be in your current inclusion path */ +#include <freetype/config/ftheader.h> + +#endif /* __FT2_BUILD_UNIX_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftbbox.h b/extlibs/headers/freetype/ftbbox.h new file mode 100644 index 00000000..f98c89eb --- /dev/null +++ b/extlibs/headers/freetype/ftbbox.h @@ -0,0 +1,89 @@ +/***************************************************************************/ +/* */ +/* ftbbox.h */ +/* */ +/* FreeType exact bbox computation (specification). */ +/* */ +/* Copyright 1996-2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This component has a _single_ role: to compute exact outline bounding */ + /* boxes. */ + /* */ + /* It is separated from the rest of the engine for various technical */ + /* reasons. It may well be integrated in `ftoutln' later. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTBBOX_H__ +#define __FTBBOX_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* outline_processing */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Get_BBox */ + /* */ + /* <Description> */ + /* Computes the exact bounding box of an outline. This is slower */ + /* than computing the control box. However, it uses an advanced */ + /* algorithm which returns _very_ quickly when the two boxes */ + /* coincide. Otherwise, the outline Bezier arcs are walked over to */ + /* extract their extrema. */ + /* */ + /* <Input> */ + /* outline :: A pointer to the source outline. */ + /* */ + /* <Output> */ + /* abbox :: The outline's exact bounding box. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Get_BBox( FT_Outline* outline, + FT_BBox *abbox ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTBBOX_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftbdf.h b/extlibs/headers/freetype/ftbdf.h new file mode 100644 index 00000000..493bca51 --- /dev/null +++ b/extlibs/headers/freetype/ftbdf.h @@ -0,0 +1,200 @@ +/***************************************************************************/ +/* */ +/* ftbdf.h */ +/* */ +/* FreeType API for accessing BDF-specific strings (specification). */ +/* */ +/* Copyright 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTBDF_H__ +#define __FTBDF_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* bdf_fonts */ + /* */ + /* <Title> */ + /* BDF Files */ + /* */ + /* <Abstract> */ + /* BDF specific API. */ + /* */ + /* <Description> */ + /* This section contains the declaration of BDF specific functions. */ + /* */ + /*************************************************************************/ + + + /********************************************************************** + * + * @enum: + * FT_PropertyType + * + * @description: + * A list of BDF property types. + * + * @values: + * BDF_PROPERTY_TYPE_NONE :: + * Value 0 is used to indicate a missing property. + * + * BDF_PROPERTY_TYPE_ATOM :: + * Property is a string atom. + * + * BDF_PROPERTY_TYPE_INTEGER :: + * Property is a 32-bit signed integer. + * + * BDF_PROPERTY_TYPE_CARDINAL :: + * Property is a 32-bit unsigned integer. + */ + typedef enum BDF_PropertyType_ + { + BDF_PROPERTY_TYPE_NONE = 0, + BDF_PROPERTY_TYPE_ATOM = 1, + BDF_PROPERTY_TYPE_INTEGER = 2, + BDF_PROPERTY_TYPE_CARDINAL = 3 + + } BDF_PropertyType; + + + /********************************************************************** + * + * @type: + * BDF_Property + * + * @description: + * A handle to a @BDF_PropertyRec structure to model a given + * BDF/PCF property. + */ + typedef struct BDF_PropertyRec_* BDF_Property; + + + /********************************************************************** + * + * @struct: + * BDF_PropertyRec + * + * @description: + * This structure models a given BDF/PCF property. + * + * @fields: + * type :: + * The property type. + * + * u.atom :: + * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. + * + * u.integer :: + * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. + * + * u.cardinal :: + * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. + */ + typedef struct BDF_PropertyRec_ + { + BDF_PropertyType type; + union { + const char* atom; + FT_Int32 integer; + FT_UInt32 cardinal; + + } u; + + } BDF_PropertyRec; + + + /********************************************************************** + * + * @function: + * FT_Get_BDF_Charset_ID + * + * @description: + * Retrieves a BDF font character set identity, according to + * the BDF specification. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * acharset_encoding :: + * Charset encoding, as a C string, owned by the face. + * + * acharset_registry :: + * Charset registry, as a C string, owned by the face. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function only works with BDF faces, returning an error otherwise. + */ + FT_EXPORT( FT_Error ) + FT_Get_BDF_Charset_ID( FT_Face face, + const char* *acharset_encoding, + const char* *acharset_registry ); + + + /********************************************************************** + * + * @function: + * FT_Get_BDF_Property + * + * @description: + * Retrieves a BDF property from a BDF or PCF font file. + * + * @input: + * face :: A handle to the input face. + * + * name :: The property name. + * + * @output: + * aproperty :: The property. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function works with BDF _and_ PCF fonts. It returns an error + * otherwise. It also returns an error if the property is not in the + * font. + * + * In case of error, "aproperty->type" is always set to + * @BDF_PROPERTY_TYPE_NONE. + */ + FT_EXPORT( FT_Error ) + FT_Get_BDF_Property( FT_Face face, + const char* prop_name, + BDF_PropertyRec *aproperty ); + + /* */ + +FT_END_HEADER + +#endif /* __FTBDF_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftbitmap.h b/extlibs/headers/freetype/ftbitmap.h new file mode 100644 index 00000000..319dd086 --- /dev/null +++ b/extlibs/headers/freetype/ftbitmap.h @@ -0,0 +1,206 @@ +/***************************************************************************/ +/* */ +/* ftbitmap.h */ +/* */ +/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */ +/* bitmaps into 8bpp format (specification). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTBITMAP_H__ +#define __FTBITMAP_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* bitmap_handling */ + /* */ + /* <Title> */ + /* Bitmap Handling */ + /* */ + /* <Abstract> */ + /* Handling FT_Bitmap objects. */ + /* */ + /* <Description> */ + /* This section contains functions for converting FT_Bitmap objects. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_New */ + /* */ + /* <Description> */ + /* Initialize a pointer to an FT_Bitmap structure. */ + /* */ + /* <InOut> */ + /* abitmap :: A pointer to the bitmap structure. */ + /* */ + FT_EXPORT( void ) + FT_Bitmap_New( FT_Bitmap *abitmap ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Copy */ + /* */ + /* <Description> */ + /* Copies an bitmap into another one. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* source :: A handle to the source bitmap. */ + /* */ + /* <Output> */ + /* target :: A handle to the target bitmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Copy( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Embolden */ + /* */ + /* <Description> */ + /* Embolden a bitmap. The new bitmap will be about `xStrength' */ + /* pixels wider and `yStrength' pixels higher. The left and bottom */ + /* borders are kept unchanged. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* xStrength :: How strong the glyph is emboldened horizontally. */ + /* Expressed in 26.6 pixel format. */ + /* */ + /* yStrength :: How strong the glyph is emboldened vertically. */ + /* Expressed in 26.6 pixel format. */ + /* */ + /* <InOut> */ + /* bitmap :: A handle to the target bitmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The current implementation restricts `xStrength' to be less than */ + /* or equal to 8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ + /* */ + /* Don't embolden the bitmap owned by a @FT_GlyphSlot directly! Call */ + /* @FT_Bitmap_Copy to get a copy and work on the copy instead. */ + /* */ + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Embolden( FT_Library library, + FT_Bitmap* bitmap, + FT_Pos xStrength, + FT_Pos yStrength ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Convert */ + /* */ + /* <Description> */ + /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a */ + /* bitmap object with depth 8bpp, making the number of used bytes per */ + /* line (a.k.a. the `pitch') a multiple of `alignment'. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* source :: The source bitmap. */ + /* */ + /* alignment :: The pitch of the bitmap is a multiple of this */ + /* parameter. Common values are 1, 2, or 4. */ + /* */ + /* <Output> */ + /* target :: The target bitmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* It is possible to call @FT_Bitmap_Convert multiple times without */ + /* calling @FT_Bitmap_Done (the memory is simply reallocated). */ + /* */ + /* Use @FT_Bitmap_Done to finally remove the bitmap object. */ + /* */ + /* The `library' argument is taken to have access to FreeType's */ + /* memory handling functions. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Convert( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target, + FT_Int alignment ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Done */ + /* */ + /* <Description> */ + /* Destroy a bitmap object created with @FT_Bitmap_New. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* bitmap :: The bitmap object to be freed. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The `library' argument is taken to have access to FreeType's */ + /* memory handling functions. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Done( FT_Library library, + FT_Bitmap *bitmap ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTBITMAP_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftcache.h b/extlibs/headers/freetype/ftcache.h new file mode 100644 index 00000000..985641c1 --- /dev/null +++ b/extlibs/headers/freetype/ftcache.h @@ -0,0 +1,817 @@ +/***************************************************************************/ +/* */ +/* ftcache.h */ +/* */ +/* FreeType Cache subsystem (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********* *********/ + /********* WARNING, THIS IS BETA CODE. *********/ + /********* *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifndef __FTCACHE_H__ +#define __FTCACHE_H__ + + +#include <ft2build.h> +#include FT_GLYPH_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* cache_subsystem */ + /* */ + /* <Title> */ + /* Cache Sub-System */ + /* */ + /* <Abstract> */ + /* How to cache face, size, and glyph data with FreeType 2. */ + /* */ + /* <Description> */ + /* This section describes the FreeType 2 cache sub-system which is */ + /* still in beta. */ + /* */ + /* <Order> */ + /* FTC_Manager */ + /* FTC_FaceID */ + /* FTC_Face_Requester */ + /* */ + /* FTC_Manager_New */ + /* FTC_Manager_Reset */ + /* FTC_Manager_Done */ + /* FTC_Manager_LookupFace */ + /* FTC_Manager_LookupSize */ + /* FTC_Manager_RemoveFaceID */ + /* */ + /* FTC_Node */ + /* FTC_Node_Unref */ + /* */ + /* FTC_Font */ + /* FTC_ImageCache */ + /* FTC_ImageCache_New */ + /* FTC_ImageCache_Lookup */ + /* */ + /* FTC_SBit */ + /* FTC_SBitCache */ + /* FTC_SBitCache_New */ + /* FTC_SBitCache_Lookup */ + /* */ + /* FTC_CMapCache */ + /* FTC_CMapCache_New */ + /* FTC_CMapCache_Lookup */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** BASIC TYPE DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_FaceID */ + /* */ + /* <Description> */ + /* An opaque pointer type that is used to identity face objects. The */ + /* contents of such objects is application-dependent. */ + /* */ + typedef struct FTC_FaceIDRec_* FTC_FaceID; + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FTC_Face_Requester */ + /* */ + /* <Description> */ + /* A callback function provided by client applications. It is used */ + /* to translate a given @FTC_FaceID into a new valid @FT_Face object. */ + /* */ + /* <Input> */ + /* face_id :: The face ID to resolve. */ + /* */ + /* library :: A handle to a FreeType library object. */ + /* */ + /* data :: Application-provided request data. */ + /* */ + /* <Output> */ + /* aface :: A new @FT_Face handle. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The face requester should not perform funny things on the returned */ + /* face object, like creating a new @FT_Size for it, or setting a */ + /* transformation through @FT_Set_Transform! */ + /* */ + typedef FT_Error + (*FTC_Face_Requester)( FTC_FaceID face_id, + FT_Library library, + FT_Pointer request_data, + FT_Face* aface ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FTC_FontRec */ + /* */ + /* <Description> */ + /* A simple structure used to describe a given `font' to the cache */ + /* manager. Note that a `font' is the combination of a given face */ + /* with a given character size. */ + /* */ + /* <Fields> */ + /* face_id :: The ID of the face to use. */ + /* */ + /* pix_width :: The character width in integer pixels. */ + /* */ + /* pix_height :: The character height in integer pixels. */ + /* */ + typedef struct FTC_FontRec_ + { + FTC_FaceID face_id; + FT_UShort pix_width; + FT_UShort pix_height; + + } FTC_FontRec; + + + /* */ + + +#define FTC_FONT_COMPARE( f1, f2 ) \ + ( (f1)->face_id == (f2)->face_id && \ + (f1)->pix_width == (f2)->pix_width && \ + (f1)->pix_height == (f2)->pix_height ) + +#define FT_POINTER_TO_ULONG( p ) ((FT_ULong)(FT_Pointer)(p)) + +#define FTC_FACE_ID_HASH( i ) \ + ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^ \ + ( FT_POINTER_TO_ULONG( i ) << 7 ) ) ) + +#define FTC_FONT_HASH( f ) \ + (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \ + ((f)->pix_width << 8) ^ \ + ((f)->pix_height) ) + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_Font */ + /* */ + /* <Description> */ + /* A simple handle to an @FTC_FontRec structure. */ + /* */ + typedef FTC_FontRec* FTC_Font; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CACHE MANAGER OBJECT *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_Manager */ + /* */ + /* <Description> */ + /* This object is used to cache one or more @FT_Face objects, along */ + /* with corresponding @FT_Size objects. */ + /* */ + typedef struct FTC_ManagerRec_* FTC_Manager; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_Node */ + /* */ + /* <Description> */ + /* An opaque handle to a cache node object. Each cache node is */ + /* reference-counted. A node with a count of 0 might be flushed */ + /* out of a full cache whenever a lookup request is performed. */ + /* */ + /* If you lookup nodes, you have the ability to "acquire" them, i.e., */ + /* to increment their reference count. This will prevent the node */ + /* from being flushed out of the cache until you explicitly "release" */ + /* it (see @FTC_Node_Unref). */ + /* */ + /* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */ + /* */ + typedef struct FTC_NodeRec_* FTC_Node; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_Manager_New */ + /* */ + /* <Description> */ + /* Creates a new cache manager. */ + /* */ + /* <Input> */ + /* library :: The parent FreeType library handle to use. */ + /* */ + /* max_bytes :: Maximum number of bytes to use for cached data. */ + /* Use 0 for defaults. */ + /* */ + /* requester :: An application-provided callback used to translate */ + /* face IDs into real @FT_Face objects. */ + /* */ + /* req_data :: A generic pointer that is passed to the requester */ + /* each time it is called (see @FTC_Face_Requester). */ + /* */ + /* <Output> */ + /* amanager :: A handle to a new manager object. 0 in case of */ + /* failure. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_Manager_New( FT_Library library, + FT_UInt max_faces, + FT_UInt max_sizes, + FT_ULong max_bytes, + FTC_Face_Requester requester, + FT_Pointer req_data, + FTC_Manager *amanager ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_Manager_Reset */ + /* */ + /* <Description> */ + /* Empties a given cache manager. This simply gets rid of all the */ + /* currently cached @FT_Face and @FT_Size objects within the manager. */ + /* */ + /* <InOut> */ + /* manager :: A handle to the manager. */ + /* */ + FT_EXPORT( void ) + FTC_Manager_Reset( FTC_Manager manager ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_Manager_Done */ + /* */ + /* <Description> */ + /* Destroys a given manager after emptying it. */ + /* */ + /* <Input> */ + /* manager :: A handle to the target cache manager object. */ + /* */ + FT_EXPORT( void ) + FTC_Manager_Done( FTC_Manager manager ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_Manager_LookupFace */ + /* */ + /* <Description> */ + /* Retrieves the @FT_Face object that corresponds to a given face ID */ + /* through a cache manager. */ + /* */ + /* <Input> */ + /* manager :: A handle to the cache manager. */ + /* */ + /* face_id :: The ID of the face object. */ + /* */ + /* <Output> */ + /* aface :: A handle to the face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The returned @FT_Face object is always owned by the manager. You */ + /* should never try to discard it yourself. */ + /* */ + /* The @FT_Face object doesn't necessarily have a current size object */ + /* (i.e., face->size can be 0). If you need a specific `font size', */ + /* use @FTC_Manager_LookupSize instead. */ + /* */ + /* Never change the face's transformation matrix (i.e., never call */ + /* the @FT_Set_Transform function) on a returned face! If you need */ + /* to transform glyphs, do it yourself after glyph loading. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_Manager_LookupFace( FTC_Manager manager, + FTC_FaceID face_id, + FT_Face *aface ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FTC_ScalerRec */ + /* */ + /* <Description> */ + /* A structure used to describe a given character size in either */ + /* pixels or points to the cache manager. See */ + /* @FTC_Manager_LookupSize. */ + /* */ + /* <Fields> */ + /* face_id :: The source face ID. */ + /* */ + /* width :: The character width. */ + /* */ + /* height :: The character height. */ + /* */ + /* pixel :: A Boolean. If TRUE, the `width' and `height' fields */ + /* are interpreted as integer pixel character sizes. */ + /* Otherwise, they are expressed as 1/64th of points. */ + /* */ + /* x_res :: Only used when `pixel' is FALSE to indicate the */ + /* horizontal resolution in dpi. */ + /* */ + /* y_res :: Only used when `pixel' is FALSE to indicate the */ + /* vertical resolution in dpi. */ + /* */ + /* <Note> */ + /* This type is mainly used to retrieve @FT_Size objects through the */ + /* cache manager. */ + /* */ + typedef struct FTC_ScalerRec_ + { + FTC_FaceID face_id; + FT_UInt width; + FT_UInt height; + FT_Int pixel; + FT_UInt x_res; + FT_UInt y_res; + + } FTC_ScalerRec, *FTC_Scaler; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_Manager_LookupSize */ + /* */ + /* <Description> */ + /* Retrieve the @FT_Size object that corresponds to a given */ + /* @FTC_Scaler through a cache manager. */ + /* */ + /* <Input> */ + /* manager :: A handle to the cache manager. */ + /* */ + /* scaler :: A scaler handle. */ + /* */ + /* <Output> */ + /* asize :: A handle to the size object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The returned @FT_Size object is always owned by the manager. You */ + /* should never try to discard it by yourself. */ + /* */ + /* You can access the parent @FT_Face object simply as `size->face' */ + /* if you need it. Note that this object is also owned by the */ + /* manager. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_Manager_LookupSize( FTC_Manager manager, + FTC_Scaler scaler, + FT_Size *asize ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_Node_Unref */ + /* */ + /* <Description> */ + /* Decrement a cache node's internal reference count. When the count */ + /* reaches 0, it is not destroyed but becomes eligible for subsequent */ + /* cache flushes. */ + /* */ + /* <Input> */ + /* node :: The cache node handle. */ + /* */ + /* manager :: The cache manager handle. */ + /* */ + FT_EXPORT( void ) + FTC_Node_Unref( FTC_Node node, + FTC_Manager manager ); + + + /* remove all nodes belonging to a given face_id */ + FT_EXPORT( void ) + FTC_Manager_RemoveFaceID( FTC_Manager manager, + FTC_FaceID face_id ); + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* cache_subsystem */ + /* */ + /*************************************************************************/ + + /************************************************************************ + * + * @type: + * FTC_CMapCache + * + * @description: + * An opaque handle used to manager a charmap cache. This cache is + * to hold character codes -> glyph indices mappings. + */ + typedef struct FTC_CMapCacheRec_* FTC_CMapCache; + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FTC_CMapCache_New */ + /* */ + /* @description: */ + /* Create a new charmap cache. */ + /* */ + /* @input: */ + /* manager :: A handle to the cache manager. */ + /* */ + /* @output: */ + /* acache :: A new cache handle. NULL in case of error. */ + /* */ + /* @return: */ + /* FreeType error code. 0 means success. */ + /* */ + /* @note: */ + /* Like all other caches, this one will be destroyed with the cache */ + /* manager. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_CMapCache_New( FTC_Manager manager, + FTC_CMapCache *acache ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FTC_CMapCache_Lookup */ + /* */ + /* @description: */ + /* Translate a character code into a glyph index, using the charmap */ + /* cache. */ + /* */ + /* @input: */ + /* cache :: A charmap cache handle. */ + /* */ + /* face_id :: The source face ID. */ + /* */ + /* cmap_index :: The index of the charmap in the source face. */ + /* */ + /* char_code :: The character code (in the corresponding charmap). */ + /* */ + /* @return: */ + /* Glyph index. 0 means `no glyph'. */ + /* */ + FT_EXPORT( FT_UInt ) + FTC_CMapCache_Lookup( FTC_CMapCache cache, + FTC_FaceID face_id, + FT_Int cmap_index, + FT_UInt32 char_code ); + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* cache_subsystem */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** IMAGE CACHE OBJECT *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct FTC_ImageTypeRec_ + { + FTC_FaceID face_id; + FT_Int width; + FT_Int height; + FT_Int32 flags; + + } FTC_ImageTypeRec; + + typedef struct FTC_ImageTypeRec_* FTC_ImageType; + + /* */ + +#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \ + ( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \ + (d1)->flags == (d2)->flags ) + +#define FTC_IMAGE_TYPE_HASH( d ) \ + (FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \ + ( (d)->flags << 4 ) ) + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_ImageCache */ + /* */ + /* <Description> */ + /* A handle to an glyph image cache object. They are designed to */ + /* hold many distinct glyph images while not exceeding a certain */ + /* memory threshold. */ + /* */ + typedef struct FTC_ImageCacheRec_* FTC_ImageCache; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_ImageCache_New */ + /* */ + /* <Description> */ + /* Creates a new glyph image cache. */ + /* */ + /* <Input> */ + /* manager :: The parent manager for the image cache. */ + /* */ + /* <Output> */ + /* acache :: A handle to the new glyph image cache object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_ImageCache_New( FTC_Manager manager, + FTC_ImageCache *acache ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_ImageCache_Lookup */ + /* */ + /* <Description> */ + /* Retrieves a given glyph image from a glyph image cache. */ + /* */ + /* <Input> */ + /* cache :: A handle to the source glyph image cache. */ + /* */ + /* type :: A pointer to a glyph image type descriptor. */ + /* */ + /* gindex :: The glyph index to retrieve. */ + /* */ + /* <Output> */ + /* aglyph :: The corresponding @FT_Glyph object. 0 in case of */ + /* failure. */ + /* */ + /* anode :: Used to return the address of of the corresponding cache */ + /* node after incrementing its reference count (see note */ + /* below). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The returned glyph is owned and managed by the glyph image cache. */ + /* Never try to transform or discard it manually! You can however */ + /* create a copy with @FT_Glyph_Copy and modify the new one. */ + /* */ + /* If `anode' is _not_ NULL, it receives the address of the cache */ + /* node containing the glyph image, after increasing its reference */ + /* count. This ensures that the node (as well as the FT_Glyph) will */ + /* always be kept in the cache until you call @FTC_Node_Unref to */ + /* `release' it. */ + /* */ + /* If `anode' is NULL, the cache node is left unchanged, which means */ + /* that the FT_Glyph could be flushed out of the cache on the next */ + /* call to one of the caching sub-system APIs. Don't assume that it */ + /* is persistent! */ + /* */ + FT_EXPORT( FT_Error ) + FTC_ImageCache_Lookup( FTC_ImageCache cache, + FTC_ImageType type, + FT_UInt gindex, + FT_Glyph *aglyph, + FTC_Node *anode ); + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_SBit */ + /* */ + /* <Description> */ + /* A handle to a small bitmap descriptor. See the @FTC_SBitRec */ + /* structure for details. */ + /* */ + typedef struct FTC_SBitRec_* FTC_SBit; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FTC_SBitRec */ + /* */ + /* <Description> */ + /* A very compact structure used to describe a small glyph bitmap. */ + /* */ + /* <Fields> */ + /* width :: The bitmap width in pixels. */ + /* */ + /* height :: The bitmap height in pixels. */ + /* */ + /* left :: The horizontal distance from the pen position to the */ + /* left bitmap border (a.k.a. `left side bearing', or */ + /* `lsb'). */ + /* */ + /* top :: The vertical distance from the pen position (on the */ + /* baseline) to the upper bitmap border (a.k.a. `top */ + /* side bearing'). The distance is positive for upwards */ + /* Y coordinates. */ + /* */ + /* format :: The format of the glyph bitmap (monochrome or gray). */ + /* */ + /* max_grays :: Maximum gray level value (in the range 1 to 255). */ + /* */ + /* pitch :: The number of bytes per bitmap line. May be positive */ + /* or negative. */ + /* */ + /* xadvance :: The horizontal advance width in pixels. */ + /* */ + /* yadvance :: The vertical advance height in pixels. */ + /* */ + /* buffer :: A pointer to the bitmap pixels. */ + /* */ + typedef struct FTC_SBitRec_ + { + FT_Byte width; + FT_Byte height; + FT_Char left; + FT_Char top; + + FT_Byte format; + FT_Byte max_grays; + FT_Short pitch; + FT_Char xadvance; + FT_Char yadvance; + + FT_Byte* buffer; + + } FTC_SBitRec; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FTC_SBitCache */ + /* */ + /* <Description> */ + /* A handle to a small bitmap cache. These are special cache objects */ + /* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */ + /* much more efficient way than the traditional glyph image cache */ + /* implemented by @FTC_ImageCache. */ + /* */ + typedef struct FTC_SBitCacheRec_* FTC_SBitCache; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_SBitCache_New */ + /* */ + /* <Description> */ + /* Creates a new cache to store small glyph bitmaps. */ + /* */ + /* <Input> */ + /* manager :: A handle to the source cache manager. */ + /* */ + /* <Output> */ + /* acache :: A handle to the new sbit cache. NULL in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FTC_SBitCache_New( FTC_Manager manager, + FTC_SBitCache *acache ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FTC_SBitCache_Lookup */ + /* */ + /* <Description> */ + /* Looks up a given small glyph bitmap in a given sbit cache and */ + /* `lock' it to prevent its flushing from the cache until needed. */ + /* */ + /* <Input> */ + /* cache :: A handle to the source sbit cache. */ + /* */ + /* type :: A pointer to the glyph image type descriptor. */ + /* */ + /* gindex :: The glyph index. */ + /* */ + /* <Output> */ + /* sbit :: A handle to a small bitmap descriptor. */ + /* */ + /* anode :: Used to return the address of of the corresponding cache */ + /* node after incrementing its reference count (see note */ + /* below). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The small bitmap descriptor and its bit buffer are owned by the */ + /* cache and should never be freed by the application. They might */ + /* as well disappear from memory on the next cache lookup, so don't */ + /* treat them as persistent data. */ + /* */ + /* The descriptor's `buffer' field is set to 0 to indicate a missing */ + /* glyph bitmap. */ + /* */ + /* If `anode' is _not_ NULL, it receives the address of the cache */ + /* node containing the bitmap, after increasing its reference count. */ + /* This ensures that the node (as well as the image) will always be */ + /* kept in the cache until you call @FTC_Node_Unref to `release' it. */ + /* */ + /* If `anode' is NULL, the cache node is left unchanged, which means */ + /* that the bitmap could be flushed out of the cache on the next */ + /* call to one of the caching sub-system APIs. Don't assume that it */ + /* is persistent! */ + /* */ + FT_EXPORT( FT_Error ) + FTC_SBitCache_Lookup( FTC_SBitCache cache, + FTC_ImageType type, + FT_UInt gindex, + FTC_SBit *sbit, + FTC_Node *anode ); + + + /* */ + +FT_END_HEADER + +#endif /* __FTCACHE_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftchapters.h b/extlibs/headers/freetype/ftchapters.h new file mode 100644 index 00000000..781160bd --- /dev/null +++ b/extlibs/headers/freetype/ftchapters.h @@ -0,0 +1,82 @@ +/***************************************************************************/ +/* */ +/* This file defines the structure of the FreeType reference. */ +/* It is used by the python script which generates the HTML files. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* core_api */ +/* */ +/* <Title> */ +/* Core API */ +/* */ +/* <Sections> */ +/* basic_types */ +/* base_interface */ +/* glyph_management */ +/* mac_specific */ +/* sizes_management */ +/* header_file_macros */ +/* */ +/***************************************************************************/ + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* format_specific */ +/* */ +/* <Title> */ +/* Format-Specific API */ +/* */ +/* <Sections> */ +/* multiple_masters */ +/* truetype_tables */ +/* type1_tables */ +/* sfnt_names */ +/* bdf_fonts */ +/* pfr_fonts */ +/* winfnt_fonts */ +/* ot_validation */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* cache_subsystem */ +/* */ +/* <Title> */ +/* Cache Sub-System */ +/* */ +/* <Sections> */ +/* cache_subsystem */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* support_api */ +/* */ +/* <Title> */ +/* Support API */ +/* */ +/* <Sections> */ +/* computations */ +/* list_processing */ +/* outline_processing */ +/* bitmap_handling */ +/* raster */ +/* glyph_stroker */ +/* system_interface */ +/* module_management */ +/* gzip */ +/* lzw */ +/* */ +/***************************************************************************/ diff --git a/extlibs/headers/freetype/fterrdef.h b/extlibs/headers/freetype/fterrdef.h new file mode 100644 index 00000000..2f73c085 --- /dev/null +++ b/extlibs/headers/freetype/fterrdef.h @@ -0,0 +1,231 @@ +/***************************************************************************/ +/* */ +/* fterrdef.h */ +/* */ +/* FreeType error codes (specification). */ +/* */ +/* Copyright 2002, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** LIST OF ERROR CODES/MESSAGES *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + + /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */ + /* including this file. */ + + + /* generic errors */ + + FT_NOERRORDEF_( Ok, 0x00, \ + "no error" ) + + FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \ + "cannot open resource" ) + FT_ERRORDEF_( Unknown_File_Format, 0x02, \ + "unknown file format" ) + FT_ERRORDEF_( Invalid_File_Format, 0x03, \ + "broken file" ) + FT_ERRORDEF_( Invalid_Version, 0x04, \ + "invalid FreeType version" ) + FT_ERRORDEF_( Lower_Module_Version, 0x05, \ + "module version is too low" ) + FT_ERRORDEF_( Invalid_Argument, 0x06, \ + "invalid argument" ) + FT_ERRORDEF_( Unimplemented_Feature, 0x07, \ + "unimplemented feature" ) + FT_ERRORDEF_( Invalid_Table, 0x08, \ + "broken table" ) + FT_ERRORDEF_( Invalid_Offset, 0x09, \ + "broken offset within table" ) + + /* glyph/character errors */ + + FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \ + "invalid glyph index" ) + FT_ERRORDEF_( Invalid_Character_Code, 0x11, \ + "invalid character code" ) + FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \ + "unsupported glyph image format" ) + FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \ + "cannot render this glyph format" ) + FT_ERRORDEF_( Invalid_Outline, 0x14, \ + "invalid outline" ) + FT_ERRORDEF_( Invalid_Composite, 0x15, \ + "invalid composite glyph" ) + FT_ERRORDEF_( Too_Many_Hints, 0x16, \ + "too many hints" ) + FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \ + "invalid pixel size" ) + + /* handle errors */ + + FT_ERRORDEF_( Invalid_Handle, 0x20, \ + "invalid object handle" ) + FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \ + "invalid library handle" ) + FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \ + "invalid module handle" ) + FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \ + "invalid face handle" ) + FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \ + "invalid size handle" ) + FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \ + "invalid glyph slot handle" ) + FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \ + "invalid charmap handle" ) + FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \ + "invalid cache manager handle" ) + FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \ + "invalid stream handle" ) + + /* driver errors */ + + FT_ERRORDEF_( Too_Many_Drivers, 0x30, \ + "too many modules" ) + FT_ERRORDEF_( Too_Many_Extensions, 0x31, \ + "too many extensions" ) + + /* memory errors */ + + FT_ERRORDEF_( Out_Of_Memory, 0x40, \ + "out of memory" ) + FT_ERRORDEF_( Unlisted_Object, 0x41, \ + "unlisted object" ) + + /* stream errors */ + + FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \ + "cannot open stream" ) + FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \ + "invalid stream seek" ) + FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \ + "invalid stream skip" ) + FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \ + "invalid stream read" ) + FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \ + "invalid stream operation" ) + FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \ + "invalid frame operation" ) + FT_ERRORDEF_( Nested_Frame_Access, 0x57, \ + "nested frame access" ) + FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \ + "invalid frame read" ) + + /* raster errors */ + + FT_ERRORDEF_( Raster_Uninitialized, 0x60, \ + "raster uninitialized" ) + FT_ERRORDEF_( Raster_Corrupted, 0x61, \ + "raster corrupted" ) + FT_ERRORDEF_( Raster_Overflow, 0x62, \ + "raster overflow" ) + FT_ERRORDEF_( Raster_Negative_Height, 0x63, \ + "negative height while rastering" ) + + /* cache errors */ + + FT_ERRORDEF_( Too_Many_Caches, 0x70, \ + "too many registered caches" ) + + /* TrueType and SFNT errors */ + + FT_ERRORDEF_( Invalid_Opcode, 0x80, \ + "invalid opcode" ) + FT_ERRORDEF_( Too_Few_Arguments, 0x81, \ + "too few arguments" ) + FT_ERRORDEF_( Stack_Overflow, 0x82, \ + "stack overflow" ) + FT_ERRORDEF_( Code_Overflow, 0x83, \ + "code overflow" ) + FT_ERRORDEF_( Bad_Argument, 0x84, \ + "bad argument" ) + FT_ERRORDEF_( Divide_By_Zero, 0x85, \ + "division by zero" ) + FT_ERRORDEF_( Invalid_Reference, 0x86, \ + "invalid reference" ) + FT_ERRORDEF_( Debug_OpCode, 0x87, \ + "found debug opcode" ) + FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \ + "found ENDF opcode in execution stream" ) + FT_ERRORDEF_( Nested_DEFS, 0x89, \ + "nested DEFS" ) + FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \ + "invalid code range" ) + FT_ERRORDEF_( Execution_Too_Long, 0x8B, \ + "execution context too long" ) + FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \ + "too many function definitions" ) + FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \ + "too many instruction definitions" ) + FT_ERRORDEF_( Table_Missing, 0x8E, \ + "SFNT font table missing" ) + FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \ + "horizontal header (hhea) table missing" ) + FT_ERRORDEF_( Locations_Missing, 0x90, \ + "locations (loca) table missing" ) + FT_ERRORDEF_( Name_Table_Missing, 0x91, \ + "name table missing" ) + FT_ERRORDEF_( CMap_Table_Missing, 0x92, \ + "character map (cmap) table missing" ) + FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \ + "horizontal metrics (hmtx) table missing" ) + FT_ERRORDEF_( Post_Table_Missing, 0x94, \ + "PostScript (post) table missing" ) + FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \ + "invalid horizontal metrics" ) + FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \ + "invalid character map (cmap) format" ) + FT_ERRORDEF_( Invalid_PPem, 0x97, \ + "invalid ppem value" ) + FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \ + "invalid vertical metrics" ) + FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \ + "could not find context" ) + FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \ + "invalid PostScript (post) table format" ) + FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \ + "invalid PostScript (post) table" ) + + /* CFF, CID, and Type 1 errors */ + + FT_ERRORDEF_( Syntax_Error, 0xA0, \ + "opcode syntax error" ) + FT_ERRORDEF_( Stack_Underflow, 0xA1, \ + "argument stack underflow" ) + FT_ERRORDEF_( Ignore, 0xA2, \ + "ignore" ) + + /* BDF errors */ + + FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \ + "`STARTFONT' field missing" ) + FT_ERRORDEF_( Missing_Font_Field, 0xB1, \ + "`FONT' field missing" ) + FT_ERRORDEF_( Missing_Size_Field, 0xB2, \ + "`SIZE' field missing" ) + FT_ERRORDEF_( Missing_Chars_Field, 0xB3, \ + "`CHARS' field missing" ) + FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, \ + "`STARTCHAR' field missing" ) + FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, \ + "`ENCODING' field missing" ) + FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, \ + "`BBX' field missing" ) + + +/* END */ diff --git a/extlibs/headers/freetype/fterrors.h b/extlibs/headers/freetype/fterrors.h new file mode 100644 index 00000000..6a2bed02 --- /dev/null +++ b/extlibs/headers/freetype/fterrors.h @@ -0,0 +1,206 @@ +/***************************************************************************/ +/* */ +/* fterrors.h */ +/* */ +/* FreeType error code handling (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This special header file is used to define the handling of FT2 */ + /* enumeration constants. It can also be used to generate error message */ + /* strings with a small macro trick explained below. */ + /* */ + /* I - Error Formats */ + /* ----------------- */ + /* */ + /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ + /* defined in ftoption.h in order to make the higher byte indicate */ + /* the module where the error has happened (this is not compatible */ + /* with standard builds of FreeType 2). You can then use the macro */ + /* FT_ERROR_BASE macro to extract the generic error code from an */ + /* FT_Error value. */ + /* */ + /* */ + /* II - Error Message strings */ + /* -------------------------- */ + /* */ + /* The error definitions below are made through special macros that */ + /* allow client applications to build a table of error message strings */ + /* if they need it. The strings are not included in a normal build of */ + /* FreeType 2 to save space (most client applications do not use */ + /* them). */ + /* */ + /* To do so, you have to define the following macros before including */ + /* this file: */ + /* */ + /* FT_ERROR_START_LIST :: */ + /* This macro is called before anything else to define the start of */ + /* the error list. It is followed by several FT_ERROR_DEF calls */ + /* (see below). */ + /* */ + /* FT_ERROR_DEF( e, v, s ) :: */ + /* This macro is called to define one single error. */ + /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ + /* `v' is the error numerical value. */ + /* `s' is the corresponding error string. */ + /* */ + /* FT_ERROR_END_LIST :: */ + /* This macro ends the list. */ + /* */ + /* Additionally, you have to undefine __FTERRORS_H__ before #including */ + /* this file. */ + /* */ + /* Here is a simple example: */ + /* */ + /* { */ + /* #undef __FTERRORS_H__ */ + /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ + /* #define FT_ERROR_START_LIST { */ + /* #define FT_ERROR_END_LIST { 0, 0 } }; */ + /* */ + /* const struct */ + /* { */ + /* int err_code; */ + /* const char* err_msg */ + /* } ft_errors[] = */ + /* */ + /* #include FT_ERRORS_H */ + /* } */ + /* */ + /*************************************************************************/ + + +#ifndef __FTERRORS_H__ +#define __FTERRORS_H__ + + + /* include module base error codes */ +#include FT_MODULE_ERRORS_H + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** SETUP MACROS *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#undef FT_NEED_EXTERN_C + +#undef FT_ERR_XCAT +#undef FT_ERR_CAT + +#define FT_ERR_XCAT( x, y ) x ## y +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) + + + /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ + /* By default, we use `FT_Err_'. */ + /* */ +#ifndef FT_ERR_PREFIX +#define FT_ERR_PREFIX FT_Err_ +#endif + + + /* FT_ERR_BASE is used as the base for module-specific errors. */ + /* */ +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS + +#ifndef FT_ERR_BASE +#define FT_ERR_BASE FT_Mod_Err_Base +#endif + +#else + +#undef FT_ERR_BASE +#define FT_ERR_BASE 0 + +#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ + + + /* If FT_ERRORDEF is not defined, we need to define a simple */ + /* enumeration type. */ + /* */ +#ifndef FT_ERRORDEF + +#define FT_ERRORDEF( e, v, s ) e = v, +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C + extern "C" { +#endif + +#endif /* !FT_ERRORDEF */ + + + /* this macro is used to define an error */ +#define FT_ERRORDEF_( e, v, s ) \ + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) + + /* this is only used for <module>_Err_Ok, which must be 0! */ +#define FT_NOERRORDEF_( e, v, s ) \ + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) + + +#ifdef FT_ERROR_START_LIST + FT_ERROR_START_LIST +#endif + + + /* now include the error codes */ +#include FT_ERROR_DEFINITIONS_H + + +#ifdef FT_ERROR_END_LIST + FT_ERROR_END_LIST +#endif + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** SIMPLE CLEANUP *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + +#ifdef FT_NEED_EXTERN_C + } +#endif + +#undef FT_ERROR_START_LIST +#undef FT_ERROR_END_LIST + +#undef FT_ERRORDEF +#undef FT_ERRORDEF_ +#undef FT_NOERRORDEF_ + +#undef FT_NEED_EXTERN_C +#undef FT_ERR_CONCAT +#undef FT_ERR_BASE + + /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ +#ifndef FT_KEEP_ERR_PREFIX +#undef FT_ERR_PREFIX +#endif + +#endif /* __FTERRORS_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftglyph.h b/extlibs/headers/freetype/ftglyph.h new file mode 100644 index 00000000..14050a21 --- /dev/null +++ b/extlibs/headers/freetype/ftglyph.h @@ -0,0 +1,565 @@ +/***************************************************************************/ +/* */ +/* ftglyph.h */ +/* */ +/* FreeType convenience functions to handle glyphs (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file contains the definition of several convenience functions */ + /* that can be used by client applications to easily retrieve glyph */ + /* bitmaps and outlines from a given face. */ + /* */ + /* These functions should be optional if you are writing a font server */ + /* or text layout engine on top of FreeType. However, they are pretty */ + /* handy for many other simple uses of the library. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTGLYPH_H__ +#define __FTGLYPH_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* glyph_management */ + /* */ + /* <Title> */ + /* Glyph Management */ + /* */ + /* <Abstract> */ + /* Generic interface to manage individual glyph data. */ + /* */ + /* <Description> */ + /* This section contains definitions used to manage glyph data */ + /* through generic FT_Glyph objects. Each of them can contain a */ + /* bitmap, a vector outline, or even images in other formats. */ + /* */ + /*************************************************************************/ + + + /* forward declaration to a private type */ + typedef struct FT_Glyph_Class_ FT_Glyph_Class; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Glyph */ + /* */ + /* <Description> */ + /* Handle to an object used to model generic glyph images. It is a */ + /* pointer to the @FT_GlyphRec structure and can contain a glyph */ + /* bitmap or pointer. */ + /* */ + /* <Note> */ + /* Glyph objects are not owned by the library. You must thus release */ + /* them manually (through @FT_Done_Glyph) _before_ calling */ + /* @FT_Done_FreeType. */ + /* */ + typedef struct FT_GlyphRec_* FT_Glyph; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_GlyphRec */ + /* */ + /* <Description> */ + /* The root glyph structure contains a given glyph image plus its */ + /* advance width in 16.16 fixed float format. */ + /* */ + /* <Fields> */ + /* library :: A handle to the FreeType library object. */ + /* */ + /* clazz :: A pointer to the glyph's class. Private. */ + /* */ + /* format :: The format of the glyph's image. */ + /* */ + /* advance :: A 16.16 vector that gives the glyph's advance width. */ + /* */ + typedef struct FT_GlyphRec_ + { + FT_Library library; + const FT_Glyph_Class* clazz; + FT_Glyph_Format format; + FT_Vector advance; + + } FT_GlyphRec; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_BitmapGlyph */ + /* */ + /* <Description> */ + /* A handle to an object used to model a bitmap glyph image. This is */ + /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */ + /* */ + typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_BitmapGlyphRec */ + /* */ + /* <Description> */ + /* A structure used for bitmap glyph images. This really is a */ + /* `sub-class' of `FT_GlyphRec'. */ + /* */ + /* <Fields> */ + /* root :: The root FT_Glyph fields. */ + /* */ + /* left :: The left-side bearing, i.e., the horizontal distance */ + /* from the current pen position to the left border of the */ + /* glyph bitmap. */ + /* */ + /* top :: The top-side bearing, i.e., the vertical distance from */ + /* the current pen position to the top border of the glyph */ + /* bitmap. This distance is positive for upwards-y! */ + /* */ + /* bitmap :: A descriptor for the bitmap. */ + /* */ + /* <Note> */ + /* You can typecast FT_Glyph to FT_BitmapGlyph if you have */ + /* glyph->format == FT_GLYPH_FORMAT_BITMAP. This lets you access */ + /* the bitmap's contents easily. */ + /* */ + /* The corresponding pixel buffer is always owned by the BitmapGlyph */ + /* and is thus created and destroyed with it. */ + /* */ + typedef struct FT_BitmapGlyphRec_ + { + FT_GlyphRec root; + FT_Int left; + FT_Int top; + FT_Bitmap bitmap; + + } FT_BitmapGlyphRec; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_OutlineGlyph */ + /* */ + /* <Description> */ + /* A handle to an object used to model an outline glyph image. This */ + /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */ + /* */ + typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_OutlineGlyphRec */ + /* */ + /* <Description> */ + /* A structure used for outline (vectorial) glyph images. This */ + /* really is a `sub-class' of `FT_GlyphRec'. */ + /* */ + /* <Fields> */ + /* root :: The root FT_Glyph fields. */ + /* */ + /* outline :: A descriptor for the outline. */ + /* */ + /* <Note> */ + /* You can typecast FT_Glyph to FT_OutlineGlyph if you have */ + /* glyph->format == FT_GLYPH_FORMAT_OUTLINE. This lets you access */ + /* the outline's content easily. */ + /* */ + /* As the outline is extracted from a glyph slot, its coordinates are */ + /* expressed normally in 26.6 pixels, unless the flag */ + /* FT_LOAD_NO_SCALE was used in FT_Load_Glyph() or FT_Load_Char(). */ + /* */ + /* The outline's tables are always owned by the object and are */ + /* destroyed with it. */ + /* */ + typedef struct FT_OutlineGlyphRec_ + { + FT_GlyphRec root; + FT_Outline outline; + + } FT_OutlineGlyphRec; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Glyph */ + /* */ + /* <Description> */ + /* A function used to extract a glyph image from a slot. */ + /* */ + /* <Input> */ + /* slot :: A handle to the source glyph slot. */ + /* */ + /* <Output> */ + /* aglyph :: A handle to the glyph object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Glyph( FT_GlyphSlot slot, + FT_Glyph *aglyph ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Glyph_Copy */ + /* */ + /* <Description> */ + /* A function used to copy a glyph image. Note that the created */ + /* @FT_Glyph object must be released with @FT_Done_Glyph. */ + /* */ + /* <Input> */ + /* source :: A handle to the source glyph object. */ + /* */ + /* <Output> */ + /* target :: A handle to the target glyph object. 0 in case of */ + /* error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Glyph_Copy( FT_Glyph source, + FT_Glyph *target ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Glyph_Transform */ + /* */ + /* <Description> */ + /* Transforms a glyph image if its format is scalable. */ + /* */ + /* <InOut> */ + /* glyph :: A handle to the target glyph object. */ + /* */ + /* <Input> */ + /* matrix :: A pointer to a 2x2 matrix to apply. */ + /* */ + /* delta :: A pointer to a 2d vector to apply. Coordinates are */ + /* expressed in 1/64th of a pixel. */ + /* */ + /* <Return> */ + /* FreeType error code (the glyph format is not scalable if it is */ + /* not zero). */ + /* */ + /* <Note> */ + /* The 2x2 transformation matrix is also applied to the glyph's */ + /* advance vector. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Glyph_Transform( FT_Glyph glyph, + FT_Matrix* matrix, + FT_Vector* delta ); + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Glyph_BBox_Mode */ + /* */ + /* <Description> */ + /* The mode how the values of @FT_Glyph_Get_CBox are returned. */ + /* */ + /* <Values> */ + /* FT_GLYPH_BBOX_UNSCALED :: */ + /* Return unscaled font units. */ + /* */ + /* FT_GLYPH_BBOX_SUBPIXELS :: */ + /* Return unfitted 26.6 coordinates. */ + /* */ + /* FT_GLYPH_BBOX_GRIDFIT :: */ + /* Return grid-fitted 26.6 coordinates. */ + /* */ + /* FT_GLYPH_BBOX_TRUNCATE :: */ + /* Return coordinates in integer pixels. */ + /* */ + /* FT_GLYPH_BBOX_PIXELS :: */ + /* Return grid-fitted pixel coordinates. */ + /* */ + typedef enum FT_Glyph_BBox_Mode_ + { + FT_GLYPH_BBOX_UNSCALED = 0, + FT_GLYPH_BBOX_SUBPIXELS = 0, + FT_GLYPH_BBOX_GRIDFIT = 1, + FT_GLYPH_BBOX_TRUNCATE = 2, + FT_GLYPH_BBOX_PIXELS = 3 + + } FT_Glyph_BBox_Mode; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* ft_glyph_bbox_xxx */ + /* */ + /* <Description> */ + /* These constants are deprecated. Use the corresponding */ + /* @FT_Glyph_BBox_Mode values instead. */ + /* */ + /* <Values> */ + /* ft_glyph_bbox_unscaled :: see @FT_GLYPH_BBOX_UNSCALED */ + /* ft_glyph_bbox_subpixels :: see @FT_GLYPH_BBOX_SUBPIXELS */ + /* ft_glyph_bbox_gridfit :: see @FT_GLYPH_BBOX_GRIDFIT */ + /* ft_glyph_bbox_truncate :: see @FT_GLYPH_BBOX_TRUNCATE */ + /* ft_glyph_bbox_pixels :: see @FT_GLYPH_BBOX_PIXELS */ + /* */ +#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED +#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS +#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT +#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE +#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Glyph_Get_CBox */ + /* */ + /* <Description> */ + /* Returns a glyph's `control box'. The control box encloses all the */ + /* outline's points, including Bezier control points. Though it */ + /* coincides with the exact bounding box for most glyphs, it can be */ + /* slightly larger in some situations (like when rotating an outline */ + /* which contains Bezier outside arcs). */ + /* */ + /* Computing the control box is very fast, while getting the bounding */ + /* box can take much more time as it needs to walk over all segments */ + /* and arcs in the outline. To get the latter, you can use the */ + /* `ftbbox' component which is dedicated to this single task. */ + /* */ + /* <Input> */ + /* glyph :: A handle to the source glyph object. */ + /* */ + /* mode :: The mode which indicates how to interpret the returned */ + /* bounding box values. */ + /* */ + /* <Output> */ + /* acbox :: The glyph coordinate bounding box. Coordinates are */ + /* expressed in 1/64th of pixels if it is grid-fitted. */ + /* */ + /* <Note> */ + /* Coordinates are relative to the glyph origin, using the Y-upwards */ + /* convention. */ + /* */ + /* If the glyph has been loaded with FT_LOAD_NO_SCALE, `bbox_mode' */ + /* must be set to `FT_GLYPH_BBOX_UNSCALED' to get unscaled font */ + /* units in 26.6 pixel format. The value `FT_GLYPH_BBOX_SUBPIXELS' */ + /* is another name for this constant. */ + /* */ + /* Note that the maximum coordinates are exclusive, which means that */ + /* one can compute the width and height of the glyph image (be it in */ + /* integer or 26.6 pixels) as: */ + /* */ + /* width = bbox.xMax - bbox.xMin; */ + /* height = bbox.yMax - bbox.yMin; */ + /* */ + /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ + /* `FT_GLYPH_BBOX_GRIDFIT', the coordinates will also be grid-fitted, */ + /* which corresponds to: */ + /* */ + /* bbox.xMin = FLOOR(bbox.xMin); */ + /* bbox.yMin = FLOOR(bbox.yMin); */ + /* bbox.xMax = CEILING(bbox.xMax); */ + /* bbox.yMax = CEILING(bbox.yMax); */ + /* */ + /* To get the bbox in pixel coordinates, set `bbox_mode' to */ + /* `FT_GLYPH_BBOX_TRUNCATE'. */ + /* */ + /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ + /* to `FT_GLYPH_BBOX_PIXELS'. */ + /* */ + FT_EXPORT( void ) + FT_Glyph_Get_CBox( FT_Glyph glyph, + FT_UInt bbox_mode, + FT_BBox *acbox ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Glyph_To_Bitmap */ + /* */ + /* <Description> */ + /* Converts a given glyph object to a bitmap glyph object. */ + /* */ + /* <InOut> */ + /* the_glyph :: A pointer to a handle to the target glyph. */ + /* */ + /* <Input> */ + /* render_mode :: An enumeration that describe how the data is */ + /* rendered. */ + /* */ + /* origin :: A pointer to a vector used to translate the glyph */ + /* image before rendering. Can be 0 (if no */ + /* translation). The origin is expressed in */ + /* 26.6 pixels. */ + /* */ + /* destroy :: A boolean that indicates that the original glyph */ + /* image should be destroyed by this function. It is */ + /* never destroyed in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The glyph image is translated with the `origin' vector before */ + /* rendering. */ + /* */ + /* The first parameter is a pointer to a FT_Glyph handle, that will */ + /* be replaced by this function. Typically, you would use (omitting */ + /* error handling): */ + /* */ + /* */ + /* { */ + /* FT_Glyph glyph; */ + /* FT_BitmapGlyph glyph_bitmap; */ + /* */ + /* */ + /* // load glyph */ + /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */ + /* */ + /* // extract glyph image */ + /* error = FT_Get_Glyph( face->glyph, &glyph ); */ + /* */ + /* // convert to a bitmap (default render mode + destroy old) */ + /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */ + /* { */ + /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT, */ + /* 0, 1 ); */ + /* if ( error ) // glyph unchanged */ + /* ... */ + /* } */ + /* */ + /* // access bitmap content by typecasting */ + /* glyph_bitmap = (FT_BitmapGlyph)glyph; */ + /* */ + /* // do funny stuff with it, like blitting/drawing */ + /* ... */ + /* */ + /* // discard glyph image (bitmap or not) */ + /* FT_Done_Glyph( glyph ); */ + /* } */ + /* */ + /* */ + /* This function does nothing if the glyph format isn't scalable. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, + FT_Render_Mode render_mode, + FT_Vector* origin, + FT_Bool destroy ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_Glyph */ + /* */ + /* <Description> */ + /* Destroys a given glyph. */ + /* */ + /* <Input> */ + /* glyph :: A handle to the target glyph object. */ + /* */ + FT_EXPORT( void ) + FT_Done_Glyph( FT_Glyph glyph ); + + + /* other helpful functions */ + + /*************************************************************************/ + /* */ + /* <Section> */ + /* computations */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Matrix_Multiply */ + /* */ + /* <Description> */ + /* Performs the matrix operation `b = a*b'. */ + /* */ + /* <Input> */ + /* a :: A pointer to matrix `a'. */ + /* */ + /* <InOut> */ + /* b :: A pointer to matrix `b'. */ + /* */ + /* <Note> */ + /* The result is undefined if either `a' or `b' is zero. */ + /* */ + FT_EXPORT( void ) + FT_Matrix_Multiply( const FT_Matrix* a, + FT_Matrix* b ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Matrix_Invert */ + /* */ + /* <Description> */ + /* Inverts a 2x2 matrix. Returns an error if it can't be inverted. */ + /* */ + /* <InOut> */ + /* matrix :: A pointer to the target matrix. Remains untouched in */ + /* case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Matrix_Invert( FT_Matrix* matrix ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTGLYPH_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftgzip.h b/extlibs/headers/freetype/ftgzip.h new file mode 100644 index 00000000..ded96bec --- /dev/null +++ b/extlibs/headers/freetype/ftgzip.h @@ -0,0 +1,100 @@ +/***************************************************************************/ +/* */ +/* ftgzip.h */ +/* */ +/* Gzip-compressed stream support. */ +/* */ +/* Copyright 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTGZIP_H__ +#define __FTGZIP_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /*************************************************************************/ + /* */ + /* <Section> */ + /* gzip */ + /* */ + /* <Title> */ + /* GZIP Streams */ + /* */ + /* <Abstract> */ + /* Using gzip-compressed font files. */ + /* */ + /* <Description> */ + /* This section contains the declaration of Gzip-specific functions. */ + /* */ + /*************************************************************************/ + + + /************************************************************************ + * + * @function: + * FT_Stream_OpenGzip + * + * @description: + * Open a new stream to parse gzip-compressed font files. This is + * mainly used to support the compressed *.pcf.gz fonts that come + * with XFree86. + * + * @input: + * stream :: The target embedding stream. + * + * source :: The source stream. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function FT_Stream_Close on the new stream will + * *not* call FT_Stream_Close on the source stream. None of the stream + * objects will be released to the heap. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream. + * + * In certain builds of the library, gzip compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a gzipped stream from + * it and re-open the face with it. + * + * This function may return "FT_Err_Unimplemented" if your build of + * FreeType was not compiled with zlib support. + */ + FT_EXPORT( FT_Error ) + FT_Stream_OpenGzip( FT_Stream stream, + FT_Stream source ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTGZIP_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftimage.h b/extlibs/headers/freetype/ftimage.h new file mode 100644 index 00000000..e92ace3a --- /dev/null +++ b/extlibs/headers/freetype/ftimage.h @@ -0,0 +1,1230 @@ +/***************************************************************************/ +/* */ +/* ftimage.h */ +/* */ +/* FreeType glyph image formats and default raster interface */ +/* (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + /*************************************************************************/ + /* */ + /* Note: A `raster' is simply a scan-line converter, used to render */ + /* FT_Outlines into FT_Bitmaps. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTIMAGE_H__ +#define __FTIMAGE_H__ + + +/* _STANDALONE_ is from ftgrays.c */ +#ifndef _STANDALONE_ +#include <ft2build.h> +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* basic_types */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Pos */ + /* */ + /* <Description> */ + /* The type FT_Pos is a 32-bit integer used to store vectorial */ + /* coordinates. Depending on the context, these can represent */ + /* distances in integer font units, or 16,16, or 26.6 fixed float */ + /* pixel coordinates. */ + /* */ + typedef signed long FT_Pos; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Vector */ + /* */ + /* <Description> */ + /* A simple structure used to store a 2D vector; coordinates are of */ + /* the FT_Pos type. */ + /* */ + /* <Fields> */ + /* x :: The horizontal coordinate. */ + /* y :: The vertical coordinate. */ + /* */ + typedef struct FT_Vector_ + { + FT_Pos x; + FT_Pos y; + + } FT_Vector; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_BBox */ + /* */ + /* <Description> */ + /* A structure used to hold an outline's bounding box, i.e., the */ + /* coordinates of its extrema in the horizontal and vertical */ + /* directions. */ + /* */ + /* <Fields> */ + /* xMin :: The horizontal minimum (left-most). */ + /* */ + /* yMin :: The vertical minimum (bottom-most). */ + /* */ + /* xMax :: The horizontal maximum (right-most). */ + /* */ + /* yMax :: The vertical maximum (top-most). */ + /* */ + typedef struct FT_BBox_ + { + FT_Pos xMin, yMin; + FT_Pos xMax, yMax; + + } FT_BBox; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Pixel_Mode */ + /* */ + /* <Description> */ + /* An enumeration type used to describe the format of pixels in a */ + /* given bitmap. Note that additional formats may be added in the */ + /* future. */ + /* */ + /* <Values> */ + /* FT_PIXEL_MODE_NONE :: */ + /* Value 0 is reserved. */ + /* */ + /* FT_PIXEL_MODE_MONO :: */ + /* A monochrome bitmap, using 1 bit per pixel. Note that pixels */ + /* are stored in most-significant order (MSB), which means that */ + /* the left-most pixel in a byte has value 128. */ + /* */ + /* FT_PIXEL_MODE_GRAY :: */ + /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ + /* images. Each pixel is stored in one byte. Note that the number */ + /* of value "gray" levels is stored in the `num_bytes' field of */ + /* the @FT_Bitmap structure (it generally is 256). */ + /* */ + /* FT_PIXEL_MODE_GRAY2 :: */ + /* A 2-bit/pixel bitmap, used to represent embedded anti-aliased */ + /* bitmaps in font files according to the OpenType specification. */ + /* We haven't found a single font using this format, however. */ + /* */ + /* FT_PIXEL_MODE_GRAY4 :: */ + /* A 4-bit/pixel bitmap, used to represent embedded anti-aliased */ + /* bitmaps in font files according to the OpenType specification. */ + /* We haven't found a single font using this format, however. */ + /* */ + /* FT_PIXEL_MODE_LCD :: */ + /* An 8-bit bitmap, used to represent RGB or BGR decimated glyph */ + /* images used for display on LCD displays; the bitmap's width is */ + /* three times wider than the original glyph image. See also */ + /* @FT_RENDER_MODE_LCD. */ + /* */ + /* FT_PIXEL_MODE_LCD_V :: */ + /* An 8-bit bitmap, used to represent RGB or BGR decimated glyph */ + /* images used for display on rotated LCD displays; the bitmap's */ + /* height is three times taller than the original glyph image. */ + /* See also @FT_RENDER_MODE_LCD_V. */ + /* */ + typedef enum FT_Pixel_Mode_ + { + FT_PIXEL_MODE_NONE = 0, + FT_PIXEL_MODE_MONO, + FT_PIXEL_MODE_GRAY, + FT_PIXEL_MODE_GRAY2, + FT_PIXEL_MODE_GRAY4, + FT_PIXEL_MODE_LCD, + FT_PIXEL_MODE_LCD_V, + + FT_PIXEL_MODE_MAX /* do not remove */ + + } FT_Pixel_Mode; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* ft_pixel_mode_xxx */ + /* */ + /* <Description> */ + /* A list of deprecated constants. Use the corresponding */ + /* @FT_Pixel_Mode values instead. */ + /* */ + /* <Values> */ + /* ft_pixel_mode_none :: see @FT_PIXEL_MODE_NONE */ + /* ft_pixel_mode_mono :: see @FT_PIXEL_MODE_MONO */ + /* ft_pixel_mode_grays :: see @FT_PIXEL_MODE_GRAY */ + /* ft_pixel_mode_pal2 :: see @FT_PIXEL_MODE_GRAY2 */ + /* ft_pixel_mode_pal4 :: see @FT_PIXEL_MODE_GRAY4 */ + /* */ +#define ft_pixel_mode_none FT_PIXEL_MODE_NONE +#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO +#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY +#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 +#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 + + /* */ + +#if 0 + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Palette_Mode */ + /* */ + /* <Description> */ + /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ + /* */ + /* An enumeration type used to describe the format of a bitmap */ + /* palette, used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ + /* */ + /* <Fields> */ + /* ft_palette_mode_rgb :: The palette is an array of 3-bytes RGB */ + /* records. */ + /* */ + /* ft_palette_mode_rgba :: The palette is an array of 4-bytes RGBA */ + /* records. */ + /* */ + /* <Note> */ + /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ + /* FreeType, these types are not handled by the library itself. */ + /* */ + typedef enum FT_Palette_Mode_ + { + ft_palette_mode_rgb = 0, + ft_palette_mode_rgba, + + ft_palettte_mode_max /* do not remove */ + + } FT_Palette_Mode; + + /* */ + +#endif + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Bitmap */ + /* */ + /* <Description> */ + /* A structure used to describe a bitmap or pixmap to the raster. */ + /* Note that we now manage pixmaps of various depths through the */ + /* `pixel_mode' field. */ + /* */ + /* <Fields> */ + /* rows :: The number of bitmap rows. */ + /* */ + /* width :: The number of pixels in bitmap row. */ + /* */ + /* pitch :: The pitch's absolute value is the number of bytes */ + /* taken by one bitmap row, including padding. */ + /* However, the pitch is positive when the bitmap has */ + /* a `down' flow, and negative when it has an `up' */ + /* flow. In all cases, the pitch is an offset to add */ + /* to a bitmap pointer in order to go down one row. */ + /* */ + /* buffer :: A typeless pointer to the bitmap buffer. This */ + /* value should be aligned on 32-bit boundaries in */ + /* most cases. */ + /* */ + /* num_grays :: This field is only used with */ + /* `FT_PIXEL_MODE_GRAY'; it gives the number of gray */ + /* levels used in the bitmap. */ + /* */ + /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ + /* See @FT_Pixel_Mode for possible values. */ + /* */ + /* palette_mode :: This field is intended for paletted pixel modes; */ + /* it indicates how the palette is stored. Not */ + /* used currently. */ + /* */ + /* palette :: A typeless pointer to the bitmap palette; this */ + /* field is intended for paletted pixel modes. Not */ + /* used currently. */ + /* */ + /* <Note> */ + /* For now, the only pixel modes supported by FreeType are mono and */ + /* grays. However, drivers might be added in the future to support */ + /* more `colorful' options. */ + /* */ + typedef struct FT_Bitmap_ + { + int rows; + int width; + int pitch; + unsigned char* buffer; + short num_grays; + char pixel_mode; + char palette_mode; + void* palette; + + } FT_Bitmap; + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* outline_processing */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Outline */ + /* */ + /* <Description> */ + /* This structure is used to describe an outline to the scan-line */ + /* converter. */ + /* */ + /* <Fields> */ + /* n_contours :: The number of contours in the outline. */ + /* */ + /* n_points :: The number of points in the outline. */ + /* */ + /* points :: A pointer to an array of `n_points' FT_Vector */ + /* elements, giving the outline's point coordinates. */ + /* */ + /* tags :: A pointer to an array of `n_points' chars, giving */ + /* each outline point's type. If bit 0 is unset, the */ + /* point is `off' the curve, i.e. a Bezier control */ + /* point, while it is `on' when set. */ + /* */ + /* Bit 1 is meaningful for `off' points only. If set, */ + /* it indicates a third-order Bezier arc control point; */ + /* and a second-order control point if unset. */ + /* */ + /* contours :: An array of `n_contours' shorts, giving the end */ + /* point of each contour within the outline. For */ + /* example, the first contour is defined by the points */ + /* `0' to `contours[0]', the second one is defined by */ + /* the points `contours[0]+1' to `contours[1]', etc. */ + /* */ + /* flags :: A set of bit flags used to characterize the outline */ + /* and give hints to the scan-converter and hinter on */ + /* how to convert/grid-fit it. See FT_Outline_Flags. */ + /* */ + typedef struct FT_Outline_ + { + short n_contours; /* number of contours in glyph */ + short n_points; /* number of points in the glyph */ + + FT_Vector* points; /* the outline's points */ + char* tags; /* the points flags */ + short* contours; /* the contour end points */ + + int flags; /* outline masks */ + + } FT_Outline; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_OUTLINE_FLAGS */ + /* */ + /* <Description> */ + /* A list of bit-field constants use for the flags in an outline's */ + /* `flags' field. */ + /* */ + /* <Values> */ + /* FT_OUTLINE_NONE :: Value 0 is reserved. */ + /* */ + /* FT_OUTLINE_OWNER :: If set, this flag indicates that the */ + /* outline's field arrays (i.e. */ + /* `points', `flags' & `contours') are */ + /* `owned' by the outline object, and */ + /* should thus be freed when it is */ + /* destroyed. */ + /* */ + /* FT_OUTLINE_EVEN_ODD_FILL :: By default, outlines are filled using */ + /* the non-zero winding rule. If set to */ + /* 1, the outline will be filled using */ + /* the even-odd fill rule (only works */ + /* with the smooth raster). */ + /* */ + /* FT_OUTLINE_REVERSE_FILL :: By default, outside contours of an */ + /* outline are oriented in clock-wise */ + /* direction, as defined in the TrueType */ + /* specification. This flag is set if */ + /* the outline uses the opposite */ + /* direction (typically for Type 1 */ + /* fonts). This flag is ignored by the */ + /* scan-converter. However, it is very */ + /* important for the auto-hinter. */ + /* */ + /* FT_OUTLINE_IGNORE_DROPOUTS :: By default, the scan converter will */ + /* try to detect drop-outs in an outline */ + /* and correct the glyph bitmap to */ + /* ensure consistent shape continuity. */ + /* If set, this flag hints the scan-line */ + /* converter to ignore such cases. */ + /* */ + /* FT_OUTLINE_HIGH_PRECISION :: This flag indicates that the */ + /* scan-line converter should try to */ + /* convert this outline to bitmaps with */ + /* the highest possible quality. It is */ + /* typically set for small character */ + /* sizes. Note that this is only a */ + /* hint, that might be completely */ + /* ignored by a given scan-converter. */ + /* */ + /* FT_OUTLINE_SINGLE_PASS :: This flag is set to force a given */ + /* scan-converter to only use a single */ + /* pass over the outline to render a */ + /* bitmap glyph image. Normally, it is */ + /* set for very large character sizes. */ + /* It is only a hint, that might be */ + /* completely ignored by a given */ + /* scan-converter. */ + /* */ +#define FT_OUTLINE_NONE 0x0 +#define FT_OUTLINE_OWNER 0x1 +#define FT_OUTLINE_EVEN_ODD_FILL 0x2 +#define FT_OUTLINE_REVERSE_FILL 0x4 +#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 + +#define FT_OUTLINE_HIGH_PRECISION 0x100 +#define FT_OUTLINE_SINGLE_PASS 0x200 + + + /************************************************************************* + * + * @enum: + * ft_outline_flags + * + * @description: + * These constants are deprecated. Please use the corresponding + * @FT_OUTLINE_FLAGS values. + * + * @values: + * ft_outline_none :: See @FT_OUTLINE_NONE. + * ft_outline_owner :: See @FT_OUTLINE_OWNER. + * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. + * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. + * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. + * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. + * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. + */ +#define ft_outline_none FT_OUTLINE_NONE +#define ft_outline_owner FT_OUTLINE_OWNER +#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL +#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL +#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS +#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION +#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS + + /* */ + +#define FT_CURVE_TAG( flag ) ( flag & 3 ) + +#define FT_CURVE_TAG_ON 1 +#define FT_CURVE_TAG_CONIC 0 +#define FT_CURVE_TAG_CUBIC 2 + +#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ +#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ + +#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ + FT_CURVE_TAG_TOUCH_Y ) + +#define FT_Curve_Tag_On FT_CURVE_TAG_ON +#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC +#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC +#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X +#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Outline_MoveToFunc */ + /* */ + /* <Description> */ + /* A function pointer type used to describe the signature of a `move */ + /* to' function during outline walking/decomposition. */ + /* */ + /* A `move to' is emitted to start a new contour in an outline. */ + /* */ + /* <Input> */ + /* to :: A pointer to the target point of the `move to'. */ + /* */ + /* user :: A typeless pointer which is passed from the caller of the */ + /* decomposition function. */ + /* */ + /* <Return> */ + /* Error code. 0 means success. */ + /* */ + typedef int + (*FT_Outline_MoveToFunc)( FT_Vector* to, + void* user ); + +#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Outline_LineToFunc */ + /* */ + /* <Description> */ + /* A function pointer type used to describe the signature of a `line */ + /* to' function during outline walking/decomposition. */ + /* */ + /* A `line to' is emitted to indicate a segment in the outline. */ + /* */ + /* <Input> */ + /* to :: A pointer to the target point of the `line to'. */ + /* */ + /* user :: A typeless pointer which is passed from the caller of the */ + /* decomposition function. */ + /* */ + /* <Return> */ + /* Error code. 0 means success. */ + /* */ + typedef int + (*FT_Outline_LineToFunc)( FT_Vector* to, + void* user ); + +#define FT_Outline_LineTo_Func FT_Outline_LineToFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Outline_ConicToFunc */ + /* */ + /* <Description> */ + /* A function pointer type use to describe the signature of a `conic */ + /* to' function during outline walking/decomposition. */ + /* */ + /* A `conic to' is emitted to indicate a second-order Bezier arc in */ + /* the outline. */ + /* */ + /* <Input> */ + /* control :: An intermediate control point between the last position */ + /* and the new target in `to'. */ + /* */ + /* to :: A pointer to the target end point of the conic arc. */ + /* */ + /* user :: A typeless pointer which is passed from the caller of */ + /* the decomposition function. */ + /* */ + /* <Return> */ + /* Error code. 0 means success. */ + /* */ + typedef int + (*FT_Outline_ConicToFunc)( FT_Vector* control, + FT_Vector* to, + void* user ); + +#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Outline_CubicToFunc */ + /* */ + /* <Description> */ + /* A function pointer type used to describe the signature of a `cubic */ + /* to' function during outline walking/decomposition. */ + /* */ + /* A `cubic to' is emitted to indicate a third-order Bezier arc. */ + /* */ + /* <Input> */ + /* control1 :: A pointer to the first Bezier control point. */ + /* */ + /* control2 :: A pointer to the second Bezier control point. */ + /* */ + /* to :: A pointer to the target end point. */ + /* */ + /* user :: A typeless pointer which is passed from the caller of */ + /* the decomposition function. */ + /* */ + /* <Return> */ + /* Error code. 0 means success. */ + /* */ + typedef int + (*FT_Outline_CubicToFunc)( FT_Vector* control1, + FT_Vector* control2, + FT_Vector* to, + void* user ); + +#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Outline_Funcs */ + /* */ + /* <Description> */ + /* A structure to hold various function pointers used during outline */ + /* decomposition in order to emit segments, conic, and cubic Beziers, */ + /* as well as `move to' and `close to' operations. */ + /* */ + /* <Fields> */ + /* move_to :: The `move to' emitter. */ + /* */ + /* line_to :: The segment emitter. */ + /* */ + /* conic_to :: The second-order Bezier arc emitter. */ + /* */ + /* cubic_to :: The third-order Bezier arc emitter. */ + /* */ + /* shift :: The shift that is applied to coordinates before they */ + /* are sent to the emitter. */ + /* */ + /* delta :: The delta that is applied to coordinates before they */ + /* are sent to the emitter, but after the shift. */ + /* */ + /* <Note> */ + /* The point coordinates sent to the emitters are the transformed */ + /* version of the original coordinates (this is important for high */ + /* accuracy during scan-conversion). The transformation is simple: */ + /* */ + /* x' = (x << shift) - delta */ + /* y' = (x << shift) - delta */ + /* */ + /* Set the value of `shift' and `delta' to 0 to get the original */ + /* point coordinates. */ + /* */ + typedef struct FT_Outline_Funcs_ + { + FT_Outline_MoveToFunc move_to; + FT_Outline_LineToFunc line_to; + FT_Outline_ConicToFunc conic_to; + FT_Outline_CubicToFunc cubic_to; + + int shift; + FT_Pos delta; + + } FT_Outline_Funcs; + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* basic_types */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Macro> */ + /* FT_IMAGE_TAG */ + /* */ + /* <Description> */ + /* This macro converts four letter tags into an unsigned long. */ + /* */ + /* <Note> */ + /* Since many 16bit compilers don't like 32bit enumerations, you */ + /* should redefine this macro in case of problems to something like */ + /* this: */ + /* */ + /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ + /* */ + /* to get a simple enumeration without assigning special numbers. */ + /* */ +#ifndef FT_IMAGE_TAG +#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ + value = ( ( (unsigned long)_x1 << 24 ) | \ + ( (unsigned long)_x2 << 16 ) | \ + ( (unsigned long)_x3 << 8 ) | \ + (unsigned long)_x4 ) +#endif /* FT_IMAGE_TAG */ + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Glyph_Format */ + /* */ + /* <Description> */ + /* An enumeration type used to describe the format of a given glyph */ + /* image. Note that this version of FreeType only supports two image */ + /* formats, even though future font drivers will be able to register */ + /* their own format. */ + /* */ + /* <Values> */ + /* FT_GLYPH_FORMAT_NONE :: */ + /* The value 0 is reserved and does describe a glyph format. */ + /* */ + /* FT_GLYPH_FORMAT_COMPOSITE :: */ + /* The glyph image is a composite of several other images. This */ + /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ + /* report compound glyphs (like accented characters). */ + /* */ + /* FT_GLYPH_FORMAT_BITMAP :: */ + /* The glyph image is a bitmap, and can be described as an */ + /* @FT_Bitmap. You generally need to access the `bitmap' field of */ + /* the @FT_GlyphSlotRec structure to read it. */ + /* */ + /* FT_GLYPH_FORMAT_OUTLINE :: */ + /* The glyph image is a vertorial outline made of line segments */ + /* and Bezier arcs; it can be described as an @FT_Outline; you */ + /* generally want to access the `outline' field of the */ + /* @FT_GlyphSlotRec structure to read it. */ + /* */ + /* FT_GLYPH_FORMAT_PLOTTER :: */ + /* The glyph image is a vectorial path with no inside/outside */ + /* contours. Some Type 1 fonts, like those in the Hershey family, */ + /* contain glyphs in this format. These are described as */ + /* @FT_Outline, but FreeType isn't currently capable of rendering */ + /* them correctly. */ + /* */ + typedef enum FT_Glyph_Format_ + { + FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), + + FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), + FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) + + } FT_Glyph_Format; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* ft_glyph_format_xxx */ + /* */ + /* <Description> */ + /* A list of decprecated constants. Use the corresponding */ + /* @FT_Glyph_Format values instead. */ + /* */ + /* <Values> */ + /* ft_glyph_format_none :: see @FT_GLYPH_FORMAT_NONE */ + /* ft_glyph_format_composite :: see @FT_GLYPH_FORMAT_COMPOSITE */ + /* ft_glyph_format_bitmap :: see @FT_GLYPH_FORMAT_BITMAP */ + /* ft_glyph_format_outline :: see @FT_GLYPH_FORMAT_OUTLINE */ + /* ft_glyph_format_plotter :: see @FT_GLYPH_FORMAT_PLOTTER */ + /* */ +#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE +#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE +#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP +#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE +#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** R A S T E R D E F I N I T I O N S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* A raster is a scan converter, in charge of rendering an outline into */ + /* a a bitmap. This section contains the public API for rasters. */ + /* */ + /* Note that in FreeType 2, all rasters are now encapsulated within */ + /* specific modules called `renderers'. See `freetype/ftrender.h' for */ + /* more details on renderers. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* raster */ + /* */ + /* <Title> */ + /* Scanline Converter */ + /* */ + /* <Abstract> */ + /* How vectorial outlines are converted into bitmaps and pixmaps. */ + /* */ + /* <Description> */ + /* This section contains technical definitions. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Raster */ + /* */ + /* <Description> */ + /* A handle (pointer) to a raster object. Each object can be used */ + /* independently to convert an outline into a bitmap or pixmap. */ + /* */ + typedef struct FT_RasterRec_* FT_Raster; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Span */ + /* */ + /* <Description> */ + /* A structure used to model a single span of gray (or black) pixels */ + /* when rendering a monochrome or anti-aliased bitmap. */ + /* */ + /* <Fields> */ + /* x :: The span's horizontal start position. */ + /* */ + /* len :: The span's length in pixels. */ + /* */ + /* coverage :: The span color/coverage, ranging from 0 (background) */ + /* to 255 (foreground). Only used for anti-aliased */ + /* rendering. */ + /* */ + /* <Note> */ + /* This structure is used by the span drawing callback type named */ + /* FT_SpanFunc which takes the y-coordinate of the span as a */ + /* a parameter. */ + /* */ + /* The coverage value is always between 0 and 255, even if the number */ + /* of gray levels have been set through FT_Set_Gray_Levels(). */ + /* */ + typedef struct FT_Span_ + { + short x; + unsigned short len; + unsigned char coverage; + + } FT_Span; + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_SpanFunc */ + /* */ + /* <Description> */ + /* A function used as a call-back by the anti-aliased renderer in */ + /* order to let client applications draw themselves the gray pixel */ + /* spans on each scan line. */ + /* */ + /* <Input> */ + /* y :: The scanline's y-coordinate. */ + /* */ + /* count :: The number of spans to draw on this scanline. */ + /* */ + /* spans :: A table of `count' spans to draw on the scanline. */ + /* */ + /* user :: User-supplied data that is passed to the callback. */ + /* */ + /* <Note> */ + /* This callback allows client applications to directly render the */ + /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ + /* */ + /* This can be used to write anti-aliased outlines directly to a */ + /* given background bitmap, and even perform translucency. */ + /* */ + /* Note that the `count' field cannot be greater than a fixed value */ + /* defined by the FT_MAX_GRAY_SPANS configuration macro in */ + /* ftoption.h. By default, this value is set to 32, which means that */ + /* if there are more than 32 spans on a given scanline, the callback */ + /* will be called several times with the same `y' parameter in order */ + /* to draw all callbacks. */ + /* */ + /* Otherwise, the callback is only called once per scan-line, and */ + /* only for those scanlines that do have `gray' pixels on them. */ + /* */ + typedef void + (*FT_SpanFunc)( int y, + int count, + FT_Span* spans, + void* user ); + +#define FT_Raster_Span_Func FT_SpanFunc + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_BitTest_Func */ + /* */ + /* <Description> */ + /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ + /* */ + /* A function used as a call-back by the monochrome scan-converter */ + /* to test whether a given target pixel is already set to the drawing */ + /* `color'. These tests are crucial to implement drop-out control */ + /* per-se the TrueType spec. */ + /* */ + /* <Input> */ + /* y :: The pixel's y-coordinate. */ + /* */ + /* x :: The pixel's x-coordinate. */ + /* */ + /* user :: User-supplied data that is passed to the callback. */ + /* */ + /* <Return> */ + /* 1 if the pixel is `set', 0 otherwise. */ + /* */ + typedef int + (*FT_Raster_BitTest_Func)( int y, + int x, + void* user ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_BitSet_Func */ + /* */ + /* <Description> */ + /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ + /* */ + /* A function used as a call-back by the monochrome scan-converter */ + /* to set an individual target pixel. This is crucial to implement */ + /* drop-out control according to the TrueType specification. */ + /* */ + /* <Input> */ + /* y :: The pixel's y-coordinate. */ + /* */ + /* x :: The pixel's x-coordinate. */ + /* */ + /* user :: User-supplied data that is passed to the callback. */ + /* */ + /* <Return> */ + /* 1 if the pixel is `set', 0 otherwise. */ + /* */ + typedef void + (*FT_Raster_BitSet_Func)( int y, + int x, + void* user ); + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_RASTER_FLAG_XXX */ + /* */ + /* <Description> */ + /* A list of bit flag constants as used in the `flags' field of a */ + /* @FT_Raster_Params structure. */ + /* */ + /* <Values> */ + /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ + /* */ + /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ + /* anti-aliased glyph image should be */ + /* generated. Otherwise, it will be */ + /* monochrome (1-bit). */ + /* */ + /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ + /* rendering. In this mode, client */ + /* applications must provide their own span */ + /* callback. This lets them directly */ + /* draw or compose over an existing bitmap. */ + /* If this bit is not set, the target */ + /* pixmap's buffer _must_ be zeroed before */ + /* rendering. */ + /* */ + /* Note that for now, direct rendering is */ + /* only possible with anti-aliased glyphs. */ + /* */ + /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ + /* rendering mode. If set, the output will */ + /* be clipped to a box specified in the */ + /* "clip_box" field of the FT_Raster_Params */ + /* structure. */ + /* */ + /* Note that by default, the glyph bitmap */ + /* is clipped to the target pixmap, except */ + /* in direct rendering mode where all spans */ + /* are generated if no clipping box is set. */ + /* */ +#define FT_RASTER_FLAG_DEFAULT 0x0 +#define FT_RASTER_FLAG_AA 0x1 +#define FT_RASTER_FLAG_DIRECT 0x2 +#define FT_RASTER_FLAG_CLIP 0x4 + + /* deprecated */ +#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT +#define ft_raster_flag_aa FT_RASTER_FLAG_AA +#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT +#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Raster_Params */ + /* */ + /* <Description> */ + /* A structure to hold the arguments used by a raster's render */ + /* function. */ + /* */ + /* <Fields> */ + /* target :: The target bitmap. */ + /* */ + /* source :: A pointer to the source glyph image (e.g. an */ + /* FT_Outline). */ + /* */ + /* flags :: The rendering flags. */ + /* */ + /* gray_spans :: The gray span drawing callback. */ + /* */ + /* black_spans :: The black span drawing callback. */ + /* */ + /* bit_test :: The bit test callback. UNIMPLEMENTED! */ + /* */ + /* bit_set :: The bit set callback. UNIMPLEMENTED! */ + /* */ + /* user :: User-supplied data that is passed to each drawing */ + /* callback. */ + /* */ + /* clip_box :: An optional clipping box. It is only used in */ + /* direct rendering mode. Note that coordinates here */ + /* should be expressed in _integer_ pixels (and not in */ + /* 26.6 fixed-point units). */ + /* */ + /* <Note> */ + /* An anti-aliased glyph bitmap is drawn if the FT_RASTER_FLAG_AA bit */ + /* flag is set in the `flags' field, otherwise a monochrome bitmap */ + /* will be generated. */ + /* */ + /* If the FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ + /* raster will call the `gray_spans' callback to draw gray pixel */ + /* spans, in the case of an aa glyph bitmap, it will call */ + /* `black_spans', and `bit_test' and `bit_set' in the case of a */ + /* monochrome bitmap. This allows direct composition over a */ + /* pre-existing bitmap through user-provided callbacks to perform the */ + /* span drawing/composition. */ + /* */ + /* Note that the `bit_test' and `bit_set' callbacks are required when */ + /* rendering a monochrome bitmap, as they are crucial to implement */ + /* correct drop-out control as defined in the TrueType specification. */ + /* */ + typedef struct FT_Raster_Params_ + { + const FT_Bitmap* target; + const void* source; + int flags; + FT_SpanFunc gray_spans; + FT_SpanFunc black_spans; + FT_Raster_BitTest_Func bit_test; /* doesn't work! */ + FT_Raster_BitSet_Func bit_set; /* doesn't work! */ + void* user; + FT_BBox clip_box; + + } FT_Raster_Params; + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_NewFunc */ + /* */ + /* <Description> */ + /* A function used to create a new raster object. */ + /* */ + /* <Input> */ + /* memory :: A handle to the memory allocator. */ + /* */ + /* <Output> */ + /* raster :: A handle to the new raster object. */ + /* */ + /* <Return> */ + /* Error code. 0 means success. */ + /* */ + /* <Note> */ + /* The `memory' parameter is a typeless pointer in order to avoid */ + /* un-wanted dependencies on the rest of the FreeType code. In */ + /* practice, it is a FT_Memory, i.e., a handle to the standard */ + /* FreeType memory allocator. However, this field can be completely */ + /* ignored by a given raster implementation. */ + /* */ + typedef int + (*FT_Raster_NewFunc)( void* memory, + FT_Raster* raster ); + +#define FT_Raster_New_Func FT_Raster_NewFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_DoneFunc */ + /* */ + /* <Description> */ + /* A function used to destroy a given raster object. */ + /* */ + /* <Input> */ + /* raster :: A handle to the raster object. */ + /* */ + typedef void + (*FT_Raster_DoneFunc)( FT_Raster raster ); + +#define FT_Raster_Done_Func FT_Raster_DoneFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_ResetFunc */ + /* */ + /* <Description> */ + /* FreeType provides an area of memory called the `render pool', */ + /* available to all registered rasters. This pool can be freely used */ + /* during a given scan-conversion but is shared by all rasters. Its */ + /* content is thus transient. */ + /* */ + /* This function is called each time the render pool changes, or just */ + /* after a new raster object is created. */ + /* */ + /* <Input> */ + /* raster :: A handle to the new raster object. */ + /* */ + /* pool_base :: The address in memory of the render pool. */ + /* */ + /* pool_size :: The size in bytes of the render pool. */ + /* */ + /* <Note> */ + /* Rasters can ignore the render pool and rely on dynamic memory */ + /* allocation if they want to (a handle to the memory allocator is */ + /* passed to the raster constructor). However, this is not */ + /* recommended for efficiency purposes. */ + /* */ + typedef void + (*FT_Raster_ResetFunc)( FT_Raster raster, + unsigned char* pool_base, + unsigned long pool_size ); + +#define FT_Raster_Reset_Func FT_Raster_ResetFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_SetModeFunc */ + /* */ + /* <Description> */ + /* This function is a generic facility to change modes or attributes */ + /* in a given raster. This can be used for debugging purposes, or */ + /* simply to allow implementation-specific `features' in a given */ + /* raster module. */ + /* */ + /* <Input> */ + /* raster :: A handle to the new raster object. */ + /* */ + /* mode :: A 4-byte tag used to name the mode or property. */ + /* */ + /* args :: A pointer to the new mode/property to use. */ + /* */ + typedef int + (*FT_Raster_SetModeFunc)( FT_Raster raster, + unsigned long mode, + void* args ); + +#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Raster_RenderFunc */ + /* */ + /* <Description> */ + /* Invokes a given raster to scan-convert a given glyph image into a */ + /* target bitmap. */ + /* */ + /* <Input> */ + /* raster :: A handle to the raster object. */ + /* */ + /* params :: A pointer to a FT_Raster_Params structure used to store */ + /* the rendering parameters. */ + /* */ + /* <Return> */ + /* Error code. 0 means success. */ + /* */ + /* <Note> */ + /* The exact format of the source image depends on the raster's glyph */ + /* format defined in its FT_Raster_Funcs structure. It can be an */ + /* FT_Outline or anything else in order to support a large array of */ + /* glyph formats. */ + /* */ + /* Note also that the render function can fail and return a */ + /* FT_Err_Unimplemented_Feature error code if the raster used does */ + /* not support direct composition. */ + /* */ + /* XXX: For now, the standard raster doesn't support direct */ + /* composition but this should change for the final release (see */ + /* the files demos/src/ftgrays.c and demos/src/ftgrays2.c for */ + /* examples of distinct implementations which support direct */ + /* composition). */ + /* */ + typedef int + (*FT_Raster_RenderFunc)( FT_Raster raster, + FT_Raster_Params* params ); + +#define FT_Raster_Render_Func FT_Raster_RenderFunc + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Raster_Funcs */ + /* */ + /* <Description> */ + /* A structure used to describe a given raster class to the library. */ + /* */ + /* <Fields> */ + /* glyph_format :: The supported glyph format for this raster. */ + /* */ + /* raster_new :: The raster constructor. */ + /* */ + /* raster_reset :: Used to reset the render pool within the raster. */ + /* */ + /* raster_render :: A function to render a glyph into a given bitmap. */ + /* */ + /* raster_done :: The raster destructor. */ + /* */ + typedef struct FT_Raster_Funcs_ + { + FT_Glyph_Format glyph_format; + FT_Raster_NewFunc raster_new; + FT_Raster_ResetFunc raster_reset; + FT_Raster_SetModeFunc raster_set_mode; + FT_Raster_RenderFunc raster_render; + FT_Raster_DoneFunc raster_done; + + } FT_Raster_Funcs; + + + /* */ + + +FT_END_HEADER + +#endif /* __FTIMAGE_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftincrem.h b/extlibs/headers/freetype/ftincrem.h new file mode 100644 index 00000000..6a1aa1fc --- /dev/null +++ b/extlibs/headers/freetype/ftincrem.h @@ -0,0 +1,292 @@ +/***************************************************************************/ +/* */ +/* ftincrem.h */ +/* */ +/* FreeType incremental loading (specification). */ +/* */ +/* Copyright 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTINCREM_H__ +#define __FTINCREM_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************** + * + * @type: + * FT_Incremental + * + * @description: + * An opaque type describing a user-provided object used to implement + * "incremental" glyph loading within FreeType. This is used to support + * embedded fonts in certain environments (e.g. Postscript interpreters), + * where the glyph data isn't in the font file, or must be overridden by + * different values. + * + * @note: + * It is up to client applications to create and implement @FT_Incremental + * objects, as long as they provide implementations for the methods + * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc + * and @FT_Incremental_GetGlyphMetricsFunc. + * + * See the description of @FT_Incremental_InterfaceRec to understand how + * to use incremental objects with FreeType. + */ + typedef struct FT_IncrementalRec_* FT_Incremental; + + + /*************************************************************************** + * + * @struct: + * FT_Incremental_Metrics + * + * @description: + * A small structure used to contain the basic glyph metrics returned + * by the @FT_Incremental_GetGlyphMetricsFunc method. + * + * @fields: + * bearing_x :: + * Left bearing, in font units. + * + * bearing_y :: + * Top bearing, in font units. + * + * advance :: + * Glyph advance, in font units. + * + * @note: + * These correspond to horizontal or vertical metrics depending on the + * value of the 'vertical' argument to the function + * @FT_Incremental_GetGlyphMetricsFunc. + */ + typedef struct FT_Incremental_MetricsRec_ + { + FT_Long bearing_x; + FT_Long bearing_y; + FT_Long advance; + + } FT_Incremental_MetricsRec, *FT_Incremental_Metrics; + + + /*************************************************************************** + * + * @type: + * FT_Incremental_GetGlyphDataFunc + * + * @description: + * A function called by FreeType to access a given glyph's data bytes + * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is + * enabled. + * + * Note that the format of the glyph's data bytes depends on the font + * file format. For TrueType, it must correspond to the raw bytes within + * the 'glyf' table. For Postscript formats, it must correspond to the + * *unencrypted* charstring bytes, without any 'lenIV' header. It is + * undefined for any other format. + * + * @input: + * incremental :: + * Handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * glyph_index :: + * Index of relevant glyph. + * + * @output: + * adata :: + * A structure describing the returned glyph data bytes (which will be + * accessed as a read-only byte block). + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * If this function returns succesfully the method + * @FT_Incremental_FreeGlyphDataFunc will be called later to release + * the data bytes. + * + * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for + * compound glyphs. + */ + typedef FT_Error + (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental, + FT_UInt glyph_index, + FT_Data* adata ); + + + /*************************************************************************** + * + * @type: + * FT_Incremental_FreeGlyphDataFunc + * + * @description: + * A function used to release the glyph data bytes returned by a + * successful call to @FT_Incremental_GetGlyphDataFunc. + * + * @input: + * incremental :: + * A handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * data :: + * A structure describing the glyph data bytes (which will be accessed + * as a read-only byte block). + */ + typedef void + (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental, + FT_Data* data ); + + + /*************************************************************************** + * + * @type: + * FT_Incremental_GetGlyphMetricsFunc + * + * @description: + * A function used to retrieve the basic metrics of a given glyph index + * before accessing its data. This is necessary because, in certain + * formats like TrueType, the metrics are stored in a different place from + * the glyph images proper. + * + * @input: + * incremental :: + * A handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * glyph_index :: + * Index of relevant glyph. + * + * vertical :: + * If true, return vertical metrics. + * + * ametrics :: + * This parameter is used for both input and output. + * The original glyph metrics, if any, in font units. If metrics are + * not available all the values must be set to zero. + * + * @output: + * ametrics :: + * The replacement glyph metrics in font units. + * + */ + typedef FT_Error + (*FT_Incremental_GetGlyphMetricsFunc) + ( FT_Incremental incremental, + FT_UInt glyph_index, + FT_Bool vertical, + FT_Incremental_MetricsRec *ametrics ); + + + /************************************************************************** + * + * @struct: + * FT_Incremental_FuncsRec + * + * @description: + * A table of functions for accessing fonts that load data + * incrementally. Used in @FT_Incremental_InterfaceRec. + * + * @fields: + * get_glyph_data :: + * The function to get glyph data. Must not be null. + * + * free_glyph_data :: + * The function to release glyph data. Must not be null. + * + * get_glyph_metrics :: + * The function to get glyph metrics. May be null if the font does + * not provide overriding glyph metrics. + */ + typedef struct FT_Incremental_FuncsRec_ + { + FT_Incremental_GetGlyphDataFunc get_glyph_data; + FT_Incremental_FreeGlyphDataFunc free_glyph_data; + FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; + + } FT_Incremental_FuncsRec; + + + /*************************************************************************** + * + * @struct: + * FT_Incremental_InterfaceRec + * + * @description: + * A structure to be used with @FT_Open_Face to indicate that the user + * wants to support incremental glyph loading. You should use it with + * @FT_PARAM_TAG_INCREMENTAL as in the following example: + * + * { + * FT_Incremental_InterfaceRec inc_int; + * FT_Parameter parameter; + * FT_Open_Args open_args; + * + * + * // set up incremental descriptor + * inc_int.funcs = my_funcs; + * inc_int.object = my_object; + * + * // set up optional parameter + * parameter.tag = FT_PARAM_TAG_INCREMENTAL; + * parameter.data = &inc_int; + * + * // set up FT_Open_Args structure + * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; + * open_args.pathname = my_font_pathname; + * open_args.num_params = 1; + * open_args.params = ¶meter; // we use one optional argument + * + * // open the font + * error = FT_Open_Face( library, &open_args, index, &face ); + * ... + * } + */ + typedef struct FT_Incremental_InterfaceRec_ + { + const FT_Incremental_FuncsRec* funcs; + FT_Incremental object; + + } FT_Incremental_InterfaceRec; + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_INCREMENTAL + * + * @description: + * A constant used as the tag of @FT_Parameter structures to indicate + * an incremental loading object to be used by FreeType. + * + */ +#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) + + /* */ + +FT_END_HEADER + +#endif /* __FTINCREM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftlist.h b/extlibs/headers/freetype/ftlist.h new file mode 100644 index 00000000..ae9801b9 --- /dev/null +++ b/extlibs/headers/freetype/ftlist.h @@ -0,0 +1,274 @@ +/***************************************************************************/ +/* */ +/* ftlist.h */ +/* */ +/* Generic list support for FreeType (specification). */ +/* */ +/* Copyright 1996-2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file implements functions relative to list processing. Its */ + /* data structures are defined in `freetype.h'. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTLIST_H__ +#define __FTLIST_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* list_processing */ + /* */ + /* <Title> */ + /* List Processing */ + /* */ + /* <Abstract> */ + /* Simple management of lists. */ + /* */ + /* <Description> */ + /* This section contains various definitions related to list */ + /* processing using doubly-linked nodes. */ + /* */ + /* <Order> */ + /* FT_List */ + /* FT_ListNode */ + /* FT_ListRec */ + /* FT_ListNodeRec */ + /* */ + /* FT_List_Add */ + /* FT_List_Insert */ + /* FT_List_Find */ + /* FT_List_Remove */ + /* FT_List_Up */ + /* FT_List_Iterate */ + /* FT_List_Iterator */ + /* FT_List_Finalize */ + /* FT_List_Destructor */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Find */ + /* */ + /* <Description> */ + /* Finds the list node for a given listed object. */ + /* */ + /* <Input> */ + /* list :: A pointer to the parent list. */ + /* data :: The address of the listed object. */ + /* */ + /* <Return> */ + /* List node. NULL if it wasn't found. */ + /* */ + FT_EXPORT( FT_ListNode ) + FT_List_Find( FT_List list, + void* data ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Add */ + /* */ + /* <Description> */ + /* Appends an element to the end of a list. */ + /* */ + /* <InOut> */ + /* list :: A pointer to the parent list. */ + /* node :: The node to append. */ + /* */ + FT_EXPORT( void ) + FT_List_Add( FT_List list, + FT_ListNode node ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Insert */ + /* */ + /* <Description> */ + /* Inserts an element at the head of a list. */ + /* */ + /* <InOut> */ + /* list :: A pointer to parent list. */ + /* node :: The node to insert. */ + /* */ + FT_EXPORT( void ) + FT_List_Insert( FT_List list, + FT_ListNode node ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Remove */ + /* */ + /* <Description> */ + /* Removes a node from a list. This function doesn't check whether */ + /* the node is in the list! */ + /* */ + /* <Input> */ + /* node :: The node to remove. */ + /* */ + /* <InOut> */ + /* list :: A pointer to the parent list. */ + /* */ + FT_EXPORT( void ) + FT_List_Remove( FT_List list, + FT_ListNode node ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Up */ + /* */ + /* <Description> */ + /* Moves a node to the head/top of a list. Used to maintain LRU */ + /* lists. */ + /* */ + /* <InOut> */ + /* list :: A pointer to the parent list. */ + /* node :: The node to move. */ + /* */ + FT_EXPORT( void ) + FT_List_Up( FT_List list, + FT_ListNode node ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_List_Iterator */ + /* */ + /* <Description> */ + /* An FT_List iterator function which is called during a list parse */ + /* by FT_List_Iterate(). */ + /* */ + /* <Input> */ + /* node :: The current iteration list node. */ + /* */ + /* user :: A typeless pointer passed to FT_List_Iterate(). */ + /* Can be used to point to the iteration's state. */ + /* */ + typedef FT_Error + (*FT_List_Iterator)( FT_ListNode node, + void* user ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Iterate */ + /* */ + /* <Description> */ + /* Parses a list and calls a given iterator function on each element. */ + /* Note that parsing is stopped as soon as one of the iterator calls */ + /* returns a non-zero value. */ + /* */ + /* <Input> */ + /* list :: A handle to the list. */ + /* iterator :: An interator function, called on each node of the */ + /* list. */ + /* user :: A user-supplied field which is passed as the second */ + /* argument to the iterator. */ + /* */ + /* <Return> */ + /* The result (a FreeType error code) of the last iterator call. */ + /* */ + FT_EXPORT( FT_Error ) + FT_List_Iterate( FT_List list, + FT_List_Iterator iterator, + void* user ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_List_Destructor */ + /* */ + /* <Description> */ + /* An FT_List iterator function which is called during a list */ + /* finalization by FT_List_Finalize() to destroy all elements in a */ + /* given list. */ + /* */ + /* <Input> */ + /* system :: The current system object. */ + /* */ + /* data :: The current object to destroy. */ + /* */ + /* user :: A typeless pointer passed to FT_List_Iterate(). It can */ + /* be used to point to the iteration's state. */ + /* */ + typedef void + (*FT_List_Destructor)( FT_Memory memory, + void* data, + void* user ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_List_Finalize */ + /* */ + /* <Description> */ + /* Destroys all elements in the list as well as the list itself. */ + /* */ + /* <Input> */ + /* list :: A handle to the list. */ + /* */ + /* destroy :: A list destructor that will be applied to each element */ + /* of the list. */ + /* */ + /* memory :: The current memory object which handles deallocation. */ + /* */ + /* user :: A user-supplied field which is passed as the last */ + /* argument to the destructor. */ + /* */ + FT_EXPORT( void ) + FT_List_Finalize( FT_List list, + FT_List_Destructor destroy, + FT_Memory memory, + void* user ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTLIST_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftlzw.h b/extlibs/headers/freetype/ftlzw.h new file mode 100644 index 00000000..2ebd5008 --- /dev/null +++ b/extlibs/headers/freetype/ftlzw.h @@ -0,0 +1,99 @@ +/***************************************************************************/ +/* */ +/* ftlzw.h */ +/* */ +/* LZW-compressed stream support. */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTLZW_H__ +#define __FTLZW_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /*************************************************************************/ + /* */ + /* <Section> */ + /* lzw */ + /* */ + /* <Title> */ + /* LZW Streams */ + /* */ + /* <Abstract> */ + /* Using LZW-compressed font files. */ + /* */ + /* <Description> */ + /* This section contains the declaration of LZW-specific functions. */ + /* */ + /*************************************************************************/ + + /************************************************************************ + * + * @function: + * FT_Stream_OpenLZW + * + * @description: + * Open a new stream to parse LZW-compressed font files. This is + * mainly used to support the compressed *.pcf.Z fonts that come + * with XFree86. + * + * @input: + * stream :: The target embedding stream. + * + * source :: The source stream. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function FT_Stream_Close on the new stream will + * *not* call FT_Stream_Close on the source stream. None of the stream + * objects will be released to the heap. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream + * + * In certain builds of the library, LZW compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a LZW stream from it + * and re-open the face with it. + * + * This function may return "FT_Err_Unimplemented" if your build of + * FreeType was not compiled with LZW support. + */ + FT_EXPORT( FT_Error ) + FT_Stream_OpenLZW( FT_Stream stream, + FT_Stream source ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTLZW_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftmac.h b/extlibs/headers/freetype/ftmac.h new file mode 100644 index 00000000..4ebf716e --- /dev/null +++ b/extlibs/headers/freetype/ftmac.h @@ -0,0 +1,162 @@ +/***************************************************************************/ +/* */ +/* ftmac.h */ +/* */ +/* Additional Mac-specific API. */ +/* */ +/* Copyright 1996-2001, 2004 by */ +/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* NOTE: Include this file after <freetype/freetype.h> and after the */ +/* Mac-specific <Types.h> header (or any other Mac header that */ +/* includes <Types.h>); we use Handle type. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMAC_H__ +#define __FTMAC_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* mac_specific */ + /* */ + /* <Title> */ + /* Mac Specific Interface */ + /* */ + /* <Abstract> */ + /* Only available on the Macintosh. */ + /* */ + /* <Description> */ + /* The following definitions are only available if FreeType is */ + /* compiled on a Macintosh. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Face_From_FOND */ + /* */ + /* <Description> */ + /* Creates a new face object from an FOND resource. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library resource. */ + /* */ + /* <Input> */ + /* fond :: An FOND resource. */ + /* */ + /* face_index :: Only supported for the -1 `sanity check' special */ + /* case. */ + /* */ + /* <Output> */ + /* aface :: A handle to a new face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Notes> */ + /* This function can be used to create FT_Face abjects from fonts */ + /* that are installed in the system like so: */ + /* */ + /* { */ + /* fond = GetResource( 'FOND', fontName ); */ + /* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */ + /* } */ + /* */ + FT_EXPORT( FT_Error ) + FT_New_Face_From_FOND( FT_Library library, + Handle fond, + FT_Long face_index, + FT_Face *aface ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_GetFile_From_Mac_Name */ + /* */ + /* <Description> */ + /* Returns an FSSpec for the disk file containing the named font. */ + /* */ + /* <Input> */ + /* fontName :: Mac OS name of the font (eg. Times New Roman Bold). */ + /* */ + /* <Output> */ + /* pathSpec :: FSSpec to the file. For passing to @FT_New_Face. */ + /* */ + /* face_index :: Index of the face. For passing to @FT_New_Face. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_GetFile_From_Mac_Name( const char* fontName, + FSSpec* pathSpec, + FT_Long* face_index ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Face_From_FSSpec */ + /* */ + /* <Description> */ + /* Creates a new face object from a given resource and typeface index */ + /* using an FSSpec to the font file. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library resource. */ + /* */ + /* <Input> */ + /* spec :: FSSpec to the font file. */ + /* */ + /* face_index :: The index of the face within the resource. The */ + /* first face has index 0. */ + /* <Output> */ + /* aface :: A handle to a new face object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */ + /* it accepts an FSSpec instead of a path. */ + /* */ + FT_EXPORT( FT_Error ) + FT_New_Face_From_FSSpec( FT_Library library, + const FSSpec *spec, + FT_Long face_index, + FT_Face *aface ); + + /* */ + + +FT_END_HEADER + + +#endif /* __FTMAC_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftmm.h b/extlibs/headers/freetype/ftmm.h new file mode 100644 index 00000000..525b5c08 --- /dev/null +++ b/extlibs/headers/freetype/ftmm.h @@ -0,0 +1,378 @@ +/***************************************************************************/ +/* */ +/* ftmm.h */ +/* */ +/* FreeType Multiple Master font interface (specification). */ +/* */ +/* Copyright 1996-2001, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMM_H__ +#define __FTMM_H__ + + +#include <ft2build.h> +#include FT_TYPE1_TABLES_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* multiple_masters */ + /* */ + /* <Title> */ + /* Multiple Masters */ + /* */ + /* <Abstract> */ + /* How to manage Multiple Masters fonts. */ + /* */ + /* <Description> */ + /* The following types and functions are used to manage Multiple */ + /* Master fonts, i.e. the selection of specific design instances by */ + /* setting design axis coordinates. */ + /* */ + /* George Williams has extended this interface to make it work with */ + /* both Type 1 Multiple Masters fonts, and GX distortable (var) */ + /* fonts. Some of these routines only work with MM fonts, others */ + /* will work with both types. They are similar enough that a */ + /* consistent interface makes sense. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_MM_Axis */ + /* */ + /* <Description> */ + /* A simple structure used to model a given axis in design space for */ + /* Multiple Masters fonts. */ + /* */ + /* This structure can't be used for GX var fonts. */ + /* */ + /* <Fields> */ + /* name :: The axis's name. */ + /* */ + /* minimum :: The axis's minimum design coordinate. */ + /* */ + /* maximum :: The axis's maximum design coordinate. */ + /* */ + typedef struct FT_MM_Axis_ + { + FT_String* name; + FT_Long minimum; + FT_Long maximum; + + } FT_MM_Axis; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Multi_Master */ + /* */ + /* <Description> */ + /* A structure used to model the axes and space of a Multiple Masters */ + /* font. */ + /* */ + /* This structure can't be used for GX var fonts. */ + /* */ + /* <Fields> */ + /* num_axis :: Number of axes. Cannot exceed 4. */ + /* */ + /* num_designs :: Number of designs; should ne normally 2^num_axis */ + /* even though the Type 1 specification strangely */ + /* allows for intermediate designs to be present. This */ + /* number cannot exceed 16. */ + /* */ + /* axis :: A table of axis descriptors. */ + /* */ + typedef struct FT_Multi_Master_ + { + FT_UInt num_axis; + FT_UInt num_designs; + FT_MM_Axis axis[T1_MAX_MM_AXIS]; + + } FT_Multi_Master; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Var_Axis */ + /* */ + /* <Description> */ + /* A simple structure used to model a given axis in design space for */ + /* Multiple Masters and GX var fonts. */ + /* */ + /* <Fields> */ + /* name :: The axis's name. */ + /* Not always meaningful for GX. */ + /* */ + /* minimum :: The axis's minimum design coordinate. */ + /* */ + /* def :: The axis's default design coordinate. */ + /* FreeType computes meaningful default values for MM; it */ + /* is then an integer value, not in 16.16 format. */ + /* */ + /* maximum :: The axis's maximum design coordinate. */ + /* */ + /* tag :: The axis's tag (the GX equivalent to `name'). */ + /* FreeType provides default values for MM if possible. */ + /* */ + /* strid :: The entry in `name' table (another GX version of */ + /* `name'). */ + /* Not meaningful for MM. */ + /* */ + typedef struct FT_Var_Axis_ + { + FT_String* name; + + FT_Fixed minimum; + FT_Fixed def; + FT_Fixed maximum; + + FT_ULong tag; + FT_UInt strid; + + } FT_Var_Axis; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Var_Named_Style */ + /* */ + /* <Description> */ + /* A simple structure used to model a named style in a GX var font. */ + /* */ + /* This structure can't be used for MM fonts. */ + /* */ + /* <Fields> */ + /* coords :: The design coordinates for this style. */ + /* This is an array with one entry for each axis. */ + /* */ + /* strid :: The entry in `name' table identifying this style. */ + /* */ + typedef struct FT_Var_Named_Style_ + { + FT_Fixed* coords; + FT_UInt strid; + + } FT_Var_Named_Style; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_MM_Var */ + /* */ + /* <Description> */ + /* A structure used to model the axes and space of a Multiple Masters */ + /* or GX var distortable font. */ + /* */ + /* Some fields are specific to one format and not to the other. */ + /* */ + /* <Fields> */ + /* num_axis :: The number of axes. The maximum value is 4 for */ + /* MM; no limit in GX. */ + /* */ + /* num_designs :: The number of designs; should be normally */ + /* 2^num_axis for MM fonts. Not meaningful for GX */ + /* (where every glyph could have a different */ + /* number of designs). */ + /* */ + /* num_namedstyles :: The number of named styles; only meaningful for */ + /* GX which allows certain design coordinates to */ + /* have a string ID (in the `name' table) */ + /* associated with them. The font can tell the */ + /* user that, for example, Weight=1.5 is `Bold'. */ + /* */ + /* axis :: A table of axis descriptors. */ + /* GX fonts contain slightly more data than MM. */ + /* */ + /* namedstyles :: A table of named styles. */ + /* Only meaningful with GX. */ + /* */ + typedef struct FT_MM_Var_ + { + FT_UInt num_axis; + FT_UInt num_designs; + FT_UInt num_namedstyles; + FT_Var_Axis* axis; + FT_Var_Named_Style* namedstyle; + + } FT_MM_Var; + + + /* */ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Multi_Master */ + /* */ + /* <Description> */ + /* Retrieves the Multiple Master descriptor of a given font. */ + /* */ + /* This function can't be used with GX fonts. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face. */ + /* */ + /* <Output> */ + /* amaster :: The Multiple Masters descriptor. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Multi_Master( FT_Face face, + FT_Multi_Master *amaster ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_MM_Var */ + /* */ + /* <Description> */ + /* Retrieves the Multiple Master/GX var descriptor of a given font. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face. */ + /* */ + /* <Output> */ + /* amaster :: The Multiple Masters descriptor. */ + /* Allocates a data structure, which the user must free */ + /* (a single call to FT_FREE will do it). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_MM_Var( FT_Face face, + FT_MM_Var* *amaster ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_MM_Design_Coordinates */ + /* */ + /* <Description> */ + /* For Multiple Masters fonts, choose an interpolated font design */ + /* through design coordinates. */ + /* */ + /* This function can't be used with GX fonts. */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face. */ + /* */ + /* <Input> */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: An array of design coordinates. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_MM_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Long* coords ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Var_Design_Coordinates */ + /* */ + /* <Description> */ + /* For Multiple Master or GX Var fonts, choose an interpolated font */ + /* design through design coordinates. */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face. */ + /* */ + /* <Input> */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: An array of design coordinates. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_MM_Blend_Coordinates */ + /* */ + /* <Description> */ + /* For Multiple Masters and GX var fonts, choose an interpolated font */ + /* design through normalized blend coordinates. */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face. */ + /* */ + /* <Input> */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: The design coordinates array (each element must be */ + /* between 0 and 1.0). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_MM_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Var_Blend_Coordinates */ + /* */ + /* <Description> */ + /* This is another name of @FT_Set_MM_Blend_Coordinates. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Var_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTMM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftmodapi.h b/extlibs/headers/freetype/ftmodapi.h new file mode 100644 index 00000000..1929ca02 --- /dev/null +++ b/extlibs/headers/freetype/ftmodapi.h @@ -0,0 +1,319 @@ +/***************************************************************************/ +/* */ +/* ftmodapi.h */ +/* */ +/* FreeType modules public interface (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMODAPI_H__ +#define __FTMODAPI_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* module_management */ + /* */ + /* <Title> */ + /* Module Management */ + /* */ + /* <Abstract> */ + /* How to add, upgrade, and remove modules from FreeType. */ + /* */ + /* <Description> */ + /* The definitions below are used to manage modules within FreeType. */ + /* Modules can be added, upgraded, and removed at runtime. */ + /* */ + /*************************************************************************/ + + + /* module bit flags */ +#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ +#define FT_MODULE_RENDERER 2 /* this module is a renderer */ +#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ +#define FT_MODULE_STYLER 8 /* this module is a styler */ + +#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ + /* scalable fonts */ +#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ + /* support vector outlines */ +#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ + /* own hinter */ + + + /* deprecated values */ +#define ft_module_font_driver FT_MODULE_FONT_DRIVER +#define ft_module_renderer FT_MODULE_RENDERER +#define ft_module_hinter FT_MODULE_HINTER +#define ft_module_styler FT_MODULE_STYLER + +#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE +#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES +#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER + + + typedef FT_Pointer FT_Module_Interface; + + typedef FT_Error + (*FT_Module_Constructor)( FT_Module module ); + + typedef void + (*FT_Module_Destructor)( FT_Module module ); + + typedef FT_Module_Interface + (*FT_Module_Requester)( FT_Module module, + const char* name ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Module_Class */ + /* */ + /* <Description> */ + /* The module class descriptor. */ + /* */ + /* <Fields> */ + /* module_flags :: Bit flags describing the module. */ + /* */ + /* module_size :: The size of one module object/instance in */ + /* bytes. */ + /* */ + /* module_name :: The name of the module. */ + /* */ + /* module_version :: The version, as a 16.16 fixed number */ + /* (major.minor). */ + /* */ + /* module_requires :: The version of FreeType this module requires */ + /* (starts at version 2.0, i.e 0x20000) */ + /* */ + /* module_init :: A function used to initialize (not create) a */ + /* new module object. */ + /* */ + /* module_done :: A function used to finalize (not destroy) a */ + /* given module object */ + /* */ + /* get_interface :: Queries a given module for a specific */ + /* interface by name. */ + /* */ + typedef struct FT_Module_Class_ + { + FT_ULong module_flags; + FT_Long module_size; + const FT_String* module_name; + FT_Fixed module_version; + FT_Fixed module_requires; + + const void* module_interface; + + FT_Module_Constructor module_init; + FT_Module_Destructor module_done; + FT_Module_Requester get_interface; + + } FT_Module_Class; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Add_Module */ + /* */ + /* <Description> */ + /* Adds a new module to a given library instance. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library object. */ + /* */ + /* <Input> */ + /* clazz :: A pointer to class descriptor for the module. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* An error will be returned if a module already exists by that name, */ + /* or if the module requires a version of FreeType that is too great. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Add_Module( FT_Library library, + const FT_Module_Class* clazz ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Module */ + /* */ + /* <Description> */ + /* Finds a module by its name. */ + /* */ + /* <Input> */ + /* library :: A handle to the library object. */ + /* */ + /* module_name :: The module's name (as an ASCII string). */ + /* */ + /* <Return> */ + /* A module handle. 0 if none was found. */ + /* */ + /* <Note> */ + /* You should better be familiar with FreeType internals to know */ + /* which module to look for :-) */ + /* */ + FT_EXPORT( FT_Module ) + FT_Get_Module( FT_Library library, + const char* module_name ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Remove_Module */ + /* */ + /* <Description> */ + /* Removes a given module from a library instance. */ + /* */ + /* <InOut> */ + /* library :: A handle to a library object. */ + /* */ + /* <Input> */ + /* module :: A handle to a module object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The module object is destroyed by the function in case of success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Remove_Module( FT_Library library, + FT_Module module ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Library */ + /* */ + /* <Description> */ + /* This function is used to create a new FreeType library instance */ + /* from a given memory object. It is thus possible to use libraries */ + /* with distinct memory allocators within the same program. */ + /* */ + /* <Input> */ + /* memory :: A handle to the original memory object. */ + /* */ + /* <Output> */ + /* alibrary :: A pointer to handle of a new library object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_New_Library( FT_Memory memory, + FT_Library *alibrary ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_Library */ + /* */ + /* <Description> */ + /* Discards a given library object. This closes all drivers and */ + /* discards all resource objects. */ + /* */ + /* <Input> */ + /* library :: A handle to the target library. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_Library( FT_Library library ); + + + + typedef void + (*FT_DebugHook_Func)( void* arg ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Debug_Hook */ + /* */ + /* <Description> */ + /* Sets a debug hook function for debugging the interpreter of a font */ + /* format. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library object. */ + /* */ + /* <Input> */ + /* hook_index :: The index of the debug hook. You should use the */ + /* values defined in ftobjs.h, e.g. */ + /* FT_DEBUG_HOOK_TRUETYPE. */ + /* */ + /* debug_hook :: The function used to debug the interpreter. */ + /* */ + /* <Note> */ + /* Currently, four debug hook slots are available, but only two (for */ + /* the TrueType and the Type 1 interpreter) are defined. */ + /* */ + FT_EXPORT( void ) + FT_Set_Debug_Hook( FT_Library library, + FT_UInt hook_index, + FT_DebugHook_Func debug_hook ); + + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Add_Default_Modules */ + /* */ + /* <Description> */ + /* Adds the set of default drivers to a given library object. */ + /* This is only useful when you create a library object with */ + /* FT_New_Library() (usually to plug a custom memory manager). */ + /* */ + /* <InOut> */ + /* library :: A handle to a new library object. */ + /* */ + FT_EXPORT( void ) + FT_Add_Default_Modules( FT_Library library ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTMODAPI_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftmoderr.h b/extlibs/headers/freetype/ftmoderr.h new file mode 100644 index 00000000..b0115dd0 --- /dev/null +++ b/extlibs/headers/freetype/ftmoderr.h @@ -0,0 +1,155 @@ +/***************************************************************************/ +/* */ +/* ftmoderr.h */ +/* */ +/* FreeType module error offsets (specification). */ +/* */ +/* Copyright 2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file is used to define the FreeType module error offsets. */ + /* */ + /* The lower byte gives the error code, the higher byte gives the */ + /* module. The base module has error offset 0. For example, the error */ + /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ + /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ + /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ + /* */ + /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ + /* to make the higher byte always zero (disabling the module error */ + /* mechanism). */ + /* */ + /* It can also be used to create a module error message table easily */ + /* with something like */ + /* */ + /* { */ + /* #undef __FTMODERR_H__ */ + /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ + /* #define FT_MODERR_START_LIST { */ + /* #define FT_MODERR_END_LIST { 0, 0 } }; */ + /* */ + /* const struct */ + /* { */ + /* int mod_err_offset; */ + /* const char* mod_err_msg */ + /* } ft_mod_errors[] = */ + /* */ + /* #include FT_MODULE_ERRORS_H */ + /* } */ + /* */ + /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ + /* the error code. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTMODERR_H__ +#define __FTMODERR_H__ + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** SETUP MACROS *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#undef FT_NEED_EXTERN_C + +#ifndef FT_MODERRDEF + +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, +#else +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, +#endif + +#define FT_MODERR_START_LIST enum { +#define FT_MODERR_END_LIST FT_Mod_Err_Max }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C + extern "C" { +#endif + +#endif /* !FT_MODERRDEF */ + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** LIST MODULE ERROR BASES *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#ifdef FT_MODERR_START_LIST + FT_MODERR_START_LIST +#endif + + + FT_MODERRDEF( Base, 0x000, "base module" ) + FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) + FT_MODERRDEF( BDF, 0x200, "BDF module" ) + FT_MODERRDEF( Cache, 0x300, "cache module" ) + FT_MODERRDEF( CFF, 0x400, "CFF module" ) + FT_MODERRDEF( CID, 0x500, "CID module" ) + FT_MODERRDEF( Gzip, 0x600, "Gzip module" ) + FT_MODERRDEF( LZW, 0x700, "LZW module" ) + FT_MODERRDEF( OTvalid, 0x800, "OpenType validation module" ) + FT_MODERRDEF( PCF, 0x900, "PCF module" ) + FT_MODERRDEF( PFR, 0xA00, "PFR module" ) + FT_MODERRDEF( PSaux, 0xB00, "PS auxiliary module" ) + FT_MODERRDEF( PShinter, 0xC00, "PS hinter module" ) + FT_MODERRDEF( PSnames, 0xD00, "PS names module" ) + FT_MODERRDEF( Raster, 0xE00, "raster module" ) + FT_MODERRDEF( SFNT, 0xF00, "SFNT module" ) + FT_MODERRDEF( Smooth, 0x1000, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0x1100, "TrueType module" ) + FT_MODERRDEF( Type1, 0x1200, "Type 1 module" ) + FT_MODERRDEF( Type42, 0x1300, "Type 42 module" ) + FT_MODERRDEF( Winfonts, 0x1400, "Windows FON/FNT module" ) + + +#ifdef FT_MODERR_END_LIST + FT_MODERR_END_LIST +#endif + + + /*******************************************************************/ + /*******************************************************************/ + /***** *****/ + /***** CLEANUP *****/ + /***** *****/ + /*******************************************************************/ + /*******************************************************************/ + + +#ifdef FT_NEED_EXTERN_C + } +#endif + +#undef FT_MODERR_START_LIST +#undef FT_MODERR_END_LIST +#undef FT_MODERRDEF +#undef FT_NEED_EXTERN_C + + +#endif /* __FTMODERR_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftotval.h b/extlibs/headers/freetype/ftotval.h new file mode 100644 index 00000000..a8de58af --- /dev/null +++ b/extlibs/headers/freetype/ftotval.h @@ -0,0 +1,170 @@ +/***************************************************************************/ +/* */ +/* ftotval.h */ +/* */ +/* FreeType API for validating OpenType tables (specification). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* */ +/* Warning: This module might be moved to a different library in the */ +/* future to avoid a tight dependency between FreeType and the */ +/* OpenType specification. */ +/* */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOTVAL_H__ +#define __FTOTVAL_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* ot_validation */ + /* */ + /* <Title> */ + /* OpenType Validation */ + /* */ + /* <Abstract> */ + /* An API to validate OpenType tables. */ + /* */ + /* <Description> */ + /* This section contains the declaration of functions to validate */ + /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF). */ + /* */ + /*************************************************************************/ + + + /********************************************************************** + * + * @enum: + * FT_VALIDATE_XXX + * + * @description: + * A list of bit-field constants used with @FT_OpenType_Validate to + * indicate which OpenType tables should be validated. + * + * @values: + * FT_VALIDATE_BASE :: + * Validate BASE table. + * + * FT_VALIDATE_GDEF :: + * Validate GDEF table. + * + * FT_VALIDATE_GPOS :: + * Validate GPOS table. + * + * FT_VALIDATE_GSUB :: + * Validate GSUB table. + * + * FT_VALIDATE_JSTF :: + * Validate JSTF table. + * + * FT_VALIDATE_OT :: + * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF). + * + */ +#define FT_VALIDATE_BASE 0x0100 +#define FT_VALIDATE_GDEF 0x0200 +#define FT_VALIDATE_GPOS 0x0400 +#define FT_VALIDATE_GSUB 0x0800 +#define FT_VALIDATE_JSTF 0x1000 + +#define FT_VALIDATE_OT FT_VALIDATE_BASE | \ + FT_VALIDATE_GDEF | \ + FT_VALIDATE_GPOS | \ + FT_VALIDATE_GSUB | \ + FT_VALIDATE_JSTF + + /* */ + + /********************************************************************** + * + * @function: + * FT_OpenType_Validate + * + * @description: + * Validate various OpenType tables to assure that all offsets and + * indices are valid. The idea is that a higher-level library which + * actually does the text layout can access those tables without + * error checking (which can be quite time consuming). + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field which specifies the tables to be validated. See + * @FT_VALIDATE_XXX for possible values. + * + * @output: + * BASE_table :: + * A pointer to the BASE table. + * + * GDEF_table :: + * A pointer to the GDEF table. + * + * GPOS_table :: + * A pointer to the GPOS table. + * + * GSUB_table :: + * A pointer to the GSUB table. + * + * JSTF_table :: + * A pointer to the JSTF table. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function only works with OpenType fonts, returning an error + * otherwise. + * + * After use, the application should deallocate the five tables with + * `free'. A NULL value indicates that the table either doesn't exist + * in the font, or the application hasn't asked for validation. + */ + FT_EXPORT( FT_Error ) + FT_OpenType_Validate( FT_Face face, + FT_UInt validation_flags, + FT_Bytes *BASE_table, + FT_Bytes *GDEF_table, + FT_Bytes *GPOS_table, + FT_Bytes *GSUB_table, + FT_Bytes *JSTF_table ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTOTVAL_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftoutln.h b/extlibs/headers/freetype/ftoutln.h new file mode 100644 index 00000000..76ad60a6 --- /dev/null +++ b/extlibs/headers/freetype/ftoutln.h @@ -0,0 +1,498 @@ +/***************************************************************************/ +/* */ +/* ftoutln.h */ +/* */ +/* Support for the FT_Outline type used to store glyph shapes of */ +/* most scalable font formats (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOUTLN_H__ +#define __FTOUTLN_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* outline_processing */ + /* */ + /* <Title> */ + /* Outline Processing */ + /* */ + /* <Abstract> */ + /* Functions to create, transform, and render vectorial glyph images. */ + /* */ + /* <Description> */ + /* This section contains routines used to create and destroy scalable */ + /* glyph images known as `outlines'. These can also be measured, */ + /* transformed, and converted into bitmaps and pixmaps. */ + /* */ + /* <Order> */ + /* FT_Outline */ + /* FT_OUTLINE_FLAGS */ + /* FT_Outline_New */ + /* FT_Outline_Done */ + /* FT_Outline_Copy */ + /* FT_Outline_Translate */ + /* FT_Outline_Transform */ + /* FT_Outline_Embolden */ + /* FT_Outline_Reverse */ + /* FT_Outline_Check */ + /* */ + /* FT_Outline_Get_CBox */ + /* FT_Outline_Get_BBox */ + /* */ + /* FT_Outline_Get_Bitmap */ + /* FT_Outline_Render */ + /* */ + /* FT_Outline_Decompose */ + /* FT_Outline_Funcs */ + /* FT_Outline_MoveTo_Func */ + /* FT_Outline_LineTo_Func */ + /* FT_Outline_ConicTo_Func */ + /* FT_Outline_CubicTo_Func */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Decompose */ + /* */ + /* <Description> */ + /* Walks over an outline's structure to decompose it into individual */ + /* segments and Bezier arcs. This function is also able to emit */ + /* `move to' and `close to' operations to indicate the start and end */ + /* of new contours in the outline. */ + /* */ + /* <Input> */ + /* outline :: A pointer to the source target. */ + /* */ + /* func_interface :: A table of `emitters', i.e,. function pointers */ + /* called during decomposition to indicate path */ + /* operations. */ + /* */ + /* <InOut> */ + /* user :: A typeless pointer which is passed to each */ + /* emitter during the decomposition. It can be */ + /* used to store the state during the */ + /* decomposition. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means sucess. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Decompose( FT_Outline* outline, + const FT_Outline_Funcs* func_interface, + void* user ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_New */ + /* */ + /* <Description> */ + /* Creates a new outline of a given size. */ + /* */ + /* <Input> */ + /* library :: A handle to the library object from where the */ + /* outline is allocated. Note however that the new */ + /* outline will NOT necessarily be FREED, when */ + /* destroying the library, by FT_Done_FreeType(). */ + /* */ + /* numPoints :: The maximal number of points within the outline. */ + /* */ + /* numContours :: The maximal number of contours within the outline. */ + /* */ + /* <Output> */ + /* anoutline :: A handle to the new outline. NULL in case of */ + /* error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The reason why this function takes a `library' parameter is simply */ + /* to use the library's memory allocator. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_New( FT_Library library, + FT_UInt numPoints, + FT_Int numContours, + FT_Outline *anoutline ); + + + FT_EXPORT( FT_Error ) + FT_Outline_New_Internal( FT_Memory memory, + FT_UInt numPoints, + FT_Int numContours, + FT_Outline *anoutline ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Done */ + /* */ + /* <Description> */ + /* Destroys an outline created with FT_Outline_New(). */ + /* */ + /* <Input> */ + /* library :: A handle of the library object used to allocate the */ + /* outline. */ + /* */ + /* outline :: A pointer to the outline object to be discarded. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* If the outline's `owner' field is not set, only the outline */ + /* descriptor will be released. */ + /* */ + /* The reason why this function takes an `library' parameter is */ + /* simply to use FT_Free(). */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Done( FT_Library library, + FT_Outline* outline ); + + + FT_EXPORT( FT_Error ) + FT_Outline_Done_Internal( FT_Memory memory, + FT_Outline* outline ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Check */ + /* */ + /* <Description> */ + /* Check the contents of an outline descriptor. */ + /* */ + /* <Input> */ + /* outline :: A handle to a source outline. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Check( FT_Outline* outline ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Get_CBox */ + /* */ + /* <Description> */ + /* Returns an outline's `control box'. The control box encloses all */ + /* the outline's points, including Bezier control points. Though it */ + /* coincides with the exact bounding box for most glyphs, it can be */ + /* slightly larger in some situations (like when rotating an outline */ + /* which contains Bezier outside arcs). */ + /* */ + /* Computing the control box is very fast, while getting the bounding */ + /* box can take much more time as it needs to walk over all segments */ + /* and arcs in the outline. To get the latter, you can use the */ + /* `ftbbox' component which is dedicated to this single task. */ + /* */ + /* <Input> */ + /* outline :: A pointer to the source outline descriptor. */ + /* */ + /* <Output> */ + /* acbox :: The outline's control box. */ + /* */ + FT_EXPORT( void ) + FT_Outline_Get_CBox( const FT_Outline* outline, + FT_BBox *acbox ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Translate */ + /* */ + /* <Description> */ + /* Applies a simple translation to the points of an outline. */ + /* */ + /* <InOut> */ + /* outline :: A pointer to the target outline descriptor. */ + /* */ + /* <Input> */ + /* xOffset :: The horizontal offset. */ + /* */ + /* yOffset :: The vertical offset. */ + /* */ + FT_EXPORT( void ) + FT_Outline_Translate( const FT_Outline* outline, + FT_Pos xOffset, + FT_Pos yOffset ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Copy */ + /* */ + /* <Description> */ + /* Copies an outline into another one. Both objects must have the */ + /* same sizes (number of points & number of contours) when this */ + /* function is called. */ + /* */ + /* <Input> */ + /* source :: A handle to the source outline. */ + /* */ + /* <Output> */ + /* target :: A handle to the target outline. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Copy( const FT_Outline* source, + FT_Outline *target ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Transform */ + /* */ + /* <Description> */ + /* Applies a simple 2x2 matrix to all of an outline's points. Useful */ + /* for applying rotations, slanting, flipping, etc. */ + /* */ + /* <InOut> */ + /* outline :: A pointer to the target outline descriptor. */ + /* */ + /* <Input> */ + /* matrix :: A pointer to the transformation matrix. */ + /* */ + /* <Note> */ + /* You can use FT_Outline_Translate() if you need to translate the */ + /* outline's points. */ + /* */ + FT_EXPORT( void ) + FT_Outline_Transform( const FT_Outline* outline, + const FT_Matrix* matrix ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Embolden */ + /* */ + /* <Description> */ + /* Emboldens an outline. The new outline will be at most 4 times */ + /* `strength' pixels wider and higher. You may think of the left and */ + /* bottom borders as unchanged. */ + /* */ + /* <InOut> */ + /* outline :: A handle to the target outline. */ + /* */ + /* <Input> */ + /* strength :: How strong the glyph is emboldened. Expressed in */ + /* 26.6 pixel format. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) + FT_Outline_Embolden( FT_Outline* outline, + FT_Pos strength ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Reverse */ + /* */ + /* <Description> */ + /* Reverses the drawing direction of an outline. This is used to */ + /* ensure consistent fill conventions for mirrored glyphs. */ + /* */ + /* <InOut> */ + /* outline :: A pointer to the target outline descriptor. */ + /* */ + /* <Note> */ + /* This functions toggles the bit flag `FT_OUTLINE_REVERSE_FILL' in */ + /* the outline's `flags' field. */ + /* */ + /* It shouldn't be used by a normal client application, unless it */ + /* knows what it is doing. */ + /* */ + FT_EXPORT( void ) + FT_Outline_Reverse( FT_Outline* outline ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Get_Bitmap */ + /* */ + /* <Description> */ + /* Renders an outline within a bitmap. The outline's image is simply */ + /* OR-ed to the target bitmap. */ + /* */ + /* <Input> */ + /* library :: A handle to a FreeType library object. */ + /* */ + /* outline :: A pointer to the source outline descriptor. */ + /* */ + /* <Output> */ + /* abitmap :: A pointer to the target bitmap descriptor. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* This function does NOT CREATE the bitmap, it only renders an */ + /* outline image within the one you pass to it! */ + /* */ + /* It will use the raster correponding to the default glyph format. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Get_Bitmap( FT_Library library, + FT_Outline* outline, + const FT_Bitmap *abitmap ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Render */ + /* */ + /* <Description> */ + /* Renders an outline within a bitmap using the current scan-convert. */ + /* This functions uses an FT_Raster_Params structure as an argument, */ + /* allowing advanced features like direct composition, translucency, */ + /* etc. */ + /* */ + /* <Input> */ + /* library :: A handle to a FreeType library object. */ + /* */ + /* outline :: A pointer to the source outline descriptor. */ + /* */ + /* <InOut> */ + /* params :: A pointer to a FT_Raster_Params structure used to */ + /* describe the rendering operation. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* You should know what you are doing and how FT_Raster_Params works */ + /* to use this function. */ + /* */ + /* The field `params.source' will be set to `outline' before the scan */ + /* converter is called, which means that the value you give to it is */ + /* actually ignored. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_Render( FT_Library library, + FT_Outline* outline, + FT_Raster_Params* params ); + + + /************************************************************************** + * + * @enum: + * FT_Orientation + * + * @description: + * A list of values used to describe an outline's contour orientation. + * + * The TrueType and Postscript specifications use different conventions + * to determine whether outline contours should be filled or unfilled. + * + * @values: + * FT_ORIENTATION_TRUETYPE :: + * According to the TrueType specification, clockwise contours must + * be filled, and counter-clockwise ones must be unfilled. + * + * FT_ORIENTATION_POSTSCRIPT :: + * According to the Postscript specification, counter-clockwise contours + * must be filled, and clockwise ones must be unfilled. + * + * FT_ORIENTATION_FILL_RIGHT :: + * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to + * remember that in TrueType, everything that is to the right of + * the drawing direction of a contour must be filled. + * + * FT_ORIENTATION_FILL_LEFT :: + * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to + * remember that in Postscript, everything that is to the left of + * the drawing direction of a contour must be filled. + */ + typedef enum + { + FT_ORIENTATION_TRUETYPE = 0, + FT_ORIENTATION_POSTSCRIPT = 1, + FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, + FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT + + } FT_Orientation; + + + /************************************************************************** + * + * @function: + * FT_Outline_Get_Orientation + * + * @description: + * This function analyzes a glyph outline and tries to compute its + * fill orientation (see @FT_Orientation). This is done by computing + * the direction of each global horizontal and/or vertical extrema + * within the outline. + * + * Note that this will return @FT_ORIENTATION_TRUETYPE for empty + * outlines. + * + * @input: + * outline :: + * A handle to the source outline. + * + * @return: + * The orientation. + * + */ + FT_EXPORT( FT_Orientation ) + FT_Outline_Get_Orientation( FT_Outline* outline ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTOUTLN_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftpfr.h b/extlibs/headers/freetype/ftpfr.h new file mode 100644 index 00000000..24816595 --- /dev/null +++ b/extlibs/headers/freetype/ftpfr.h @@ -0,0 +1,172 @@ +/***************************************************************************/ +/* */ +/* ftpfr.h */ +/* */ +/* FreeType API for accessing PFR-specific data (specification only). */ +/* */ +/* Copyright 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTPFR_H__ +#define __FTPFR_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* pfr_fonts */ + /* */ + /* <Title> */ + /* PFR Fonts */ + /* */ + /* <Abstract> */ + /* PFR/TrueDoc specific API. */ + /* */ + /* <Description> */ + /* This section contains the declaration of PFR-specific functions. */ + /* */ + /*************************************************************************/ + + + /********************************************************************** + * + * @function: + * FT_Get_PFR_Metrics + * + * @description: + * Return the outline and metrics resolutions of a given PFR face. + * + * @input: + * face :: Handle to the input face. It can be a non-PFR face. + * + * @output: + * aoutline_resolution :: + * Outline resolution. This is equivalent to `face->units_per_EM'. + * Optional (parameter can be NULL). + * + * ametrics_resolution :: + * Metrics resolution. This is equivalent to `outline_resolution' + * for non-PFR fonts. Optional (parameter can be NULL). + * + * ametrics_x_scale :: + * A 16.16 fixed-point number used to scale distance expressed + * in metrics units to device sub-pixels. This is equivalent to + * `face->size->x_scale', but for metrics only. Optional (parameter + * can be NULL) + * + * ametrics_y_scale :: + * Same as `ametrics_x_scale' but for the vertical direction. + * optional (parameter can be NULL) + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * If the input face is not a PFR, this function will return an error. + * However, in all cases, it will return valid values. + */ + FT_EXPORT( FT_Error ) + FT_Get_PFR_Metrics( FT_Face face, + FT_UInt *aoutline_resolution, + FT_UInt *ametrics_resolution, + FT_Fixed *ametrics_x_scale, + FT_Fixed *ametrics_y_scale ); + + + /********************************************************************** + * + * @function: + * FT_Get_PFR_Kerning + * + * @description: + * Return the kerning pair corresponding to two glyphs in a PFR face. + * The distance is expressed in metrics units, unlike the result of + * @FT_Get_Kerning. + * + * @input: + * face :: A handle to the input face. + * + * left :: Index of the left glyph. + * + * right :: Index of the right glyph. + * + * @output: + * avector :: A kerning vector. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function always return distances in original PFR metrics + * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED + * mode, which always returns distances converted to outline units. + * + * You can use the value of the `x_scale' and `y_scale' parameters + * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. + */ + FT_EXPORT( FT_Error ) + FT_Get_PFR_Kerning( FT_Face face, + FT_UInt left, + FT_UInt right, + FT_Vector *avector ); + + + /********************************************************************** + * + * @function: + * FT_Get_PFR_Advance + * + * @description: + * Return a given glyph advance, expressed in original metrics units, + * from a PFR font. + * + * @input: + * face :: A handle to the input face. + * + * gindex :: The glyph index. + * + * @output: + * aadvance :: The glyph advance in metrics units. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics + * to convert the advance to device sub-pixels (i.e. 1/64th of pixels). + */ + FT_EXPORT( FT_Error ) + FT_Get_PFR_Advance( FT_Face face, + FT_UInt gindex, + FT_Pos *aadvance ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTPFR_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftrender.h b/extlibs/headers/freetype/ftrender.h new file mode 100644 index 00000000..21b051fc --- /dev/null +++ b/extlibs/headers/freetype/ftrender.h @@ -0,0 +1,229 @@ +/***************************************************************************/ +/* */ +/* ftrender.h */ +/* */ +/* FreeType renderer modules public interface (specification). */ +/* */ +/* Copyright 1996-2001, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTRENDER_H__ +#define __FTRENDER_H__ + + +#include <ft2build.h> +#include FT_MODULE_H +#include FT_GLYPH_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* module_management */ + /* */ + /*************************************************************************/ + + + /* create a new glyph object */ + typedef FT_Error + (*FT_Glyph_InitFunc)( FT_Glyph glyph, + FT_GlyphSlot slot ); + + /* destroys a given glyph object */ + typedef void + (*FT_Glyph_DoneFunc)( FT_Glyph glyph ); + + typedef void + (*FT_Glyph_TransformFunc)( FT_Glyph glyph, + FT_Matrix* matrix, + FT_Vector* delta ); + + typedef void + (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph, + FT_BBox* abbox ); + + typedef FT_Error + (*FT_Glyph_CopyFunc)( FT_Glyph source, + FT_Glyph target ); + + typedef FT_Error + (*FT_Glyph_PrepareFunc)( FT_Glyph glyph, + FT_GlyphSlot slot ); + +/* deprecated */ +#define FT_Glyph_Init_Func FT_Glyph_InitFunc +#define FT_Glyph_Done_Func FT_Glyph_DoneFunc +#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc +#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc +#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc +#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc + + + struct FT_Glyph_Class_ + { + FT_Long glyph_size; + FT_Glyph_Format glyph_format; + FT_Glyph_InitFunc glyph_init; + FT_Glyph_DoneFunc glyph_done; + FT_Glyph_CopyFunc glyph_copy; + FT_Glyph_TransformFunc glyph_transform; + FT_Glyph_GetBBoxFunc glyph_bbox; + FT_Glyph_PrepareFunc glyph_prepare; + }; + + + typedef FT_Error + (*FT_Renderer_RenderFunc)( FT_Renderer renderer, + FT_GlyphSlot slot, + FT_UInt mode, + FT_Vector* origin ); + + typedef FT_Error + (*FT_Renderer_TransformFunc)( FT_Renderer renderer, + FT_GlyphSlot slot, + FT_Matrix* matrix, + FT_Vector* delta ); + + + typedef void + (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer, + FT_GlyphSlot slot, + FT_BBox* cbox ); + + + typedef FT_Error + (*FT_Renderer_SetModeFunc)( FT_Renderer renderer, + FT_ULong mode_tag, + FT_Pointer mode_ptr ); + +/* deprecated identifiers */ +#define FTRenderer_render FT_Renderer_RenderFunc +#define FTRenderer_transform FT_Renderer_TransformFunc +#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc +#define FTRenderer_setMode FT_Renderer_SetModeFunc + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Renderer_Class */ + /* */ + /* <Description> */ + /* The renderer module class descriptor. */ + /* */ + /* <Fields> */ + /* root :: The root FT_Module_Class fields. */ + /* */ + /* glyph_format :: The glyph image format this renderer handles. */ + /* */ + /* render_glyph :: A method used to render the image that is in a */ + /* given glyph slot into a bitmap. */ + /* */ + /* set_mode :: A method used to pass additional parameters. */ + /* */ + /* raster_class :: For `FT_GLYPH_FORMAT_OUTLINE' renderers only, this */ + /* is a pointer to its raster's class. */ + /* */ + /* raster :: For `FT_GLYPH_FORMAT_OUTLINE' renderers only. this */ + /* is a pointer to the corresponding raster object, */ + /* if any. */ + /* */ + typedef struct FT_Renderer_Class_ + { + FT_Module_Class root; + + FT_Glyph_Format glyph_format; + + FT_Renderer_RenderFunc render_glyph; + FT_Renderer_TransformFunc transform_glyph; + FT_Renderer_GetCBoxFunc get_glyph_cbox; + FT_Renderer_SetModeFunc set_mode; + + FT_Raster_Funcs* raster_class; + + } FT_Renderer_Class; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Renderer */ + /* */ + /* <Description> */ + /* Retrieves the current renderer for a given glyph format. */ + /* */ + /* <Input> */ + /* library :: A handle to the library object. */ + /* */ + /* format :: The glyph format. */ + /* */ + /* <Return> */ + /* A renderer handle. 0 if none found. */ + /* */ + /* <Note> */ + /* An error will be returned if a module already exists by that name, */ + /* or if the module requires a version of FreeType that is too great. */ + /* */ + /* To add a new renderer, simply use FT_Add_Module(). To retrieve a */ + /* renderer by its name, use FT_Get_Module(). */ + /* */ + FT_EXPORT( FT_Renderer ) + FT_Get_Renderer( FT_Library library, + FT_Glyph_Format format ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Renderer */ + /* */ + /* <Description> */ + /* Sets the current renderer to use, and set additional mode. */ + /* */ + /* <InOut> */ + /* library :: A handle to the library object. */ + /* */ + /* <Input> */ + /* renderer :: A handle to the renderer object. */ + /* */ + /* num_params :: The number of additional parameters. */ + /* */ + /* parameters :: Additional parameters. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* In case of success, the renderer will be used to convert glyph */ + /* images in the renderer's known format into bitmaps. */ + /* */ + /* This doesn't change the current renderer for other formats. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Renderer( FT_Library library, + FT_Renderer renderer, + FT_UInt num_params, + FT_Parameter* parameters ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTRENDER_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftsizes.h b/extlibs/headers/freetype/ftsizes.h new file mode 100644 index 00000000..9abd94bc --- /dev/null +++ b/extlibs/headers/freetype/ftsizes.h @@ -0,0 +1,159 @@ +/***************************************************************************/ +/* */ +/* ftsizes.h */ +/* */ +/* FreeType size objects management (specification). */ +/* */ +/* Copyright 1996-2001, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* Typical application would normally not need to use these functions. */ + /* However, they have been placed in a public API for the rare cases */ + /* where they are needed. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTSIZES_H__ +#define __FTSIZES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* sizes_management */ + /* */ + /* <Title> */ + /* Size Management */ + /* */ + /* <Abstract> */ + /* Managing multiple sizes per face. */ + /* */ + /* <Description> */ + /* When creating a new face object (e.g. with @FT_New_Face), an */ + /* @FT_Size object is automatically created and used to store all */ + /* pixel-size dependent information, available in the "face->size" */ + /* field. */ + /* */ + /* It is however possible to create more sizes for a given face, */ + /* mostly in order to manage several character pixel sizes of the */ + /* same font family and style. See @FT_New_Size and @FT_Done_Size. */ + /* */ + /* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */ + /* modify the contents of the current "active" size; you thus need */ + /* to use @FT_Activate_Size to change it. */ + /* */ + /* 99% of applications won't need the functions provided here, */ + /* especially if they use the caching sub-system, so be cautious */ + /* when using these. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Size */ + /* */ + /* <Description> */ + /* Creates a new size object from a given face object. */ + /* */ + /* <Input> */ + /* face :: A handle to a parent face object. */ + /* */ + /* <Output> */ + /* asize :: A handle to a new size object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* You need to call @FT_Activate_Size in order to select the new size */ + /* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */ + /* @FT_Load_Glyph, @FT_Load_Char, etc. */ + /* */ + FT_EXPORT( FT_Error ) + FT_New_Size( FT_Face face, + FT_Size* size ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_Size */ + /* */ + /* <Description> */ + /* Discards a given size object. Note that @FT_Done_Face */ + /* automatically discards all size objects allocated with */ + /* @FT_New_Size. */ + /* */ + /* <Input> */ + /* size :: A handle to a target size object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Done_Size( FT_Size size ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Activate_Size */ + /* */ + /* <Description> */ + /* Even though it is possible to create several size objects for a */ + /* given face (see @FT_New_Size for details), functions like */ + /* @FT_Load_Glyph or @FT_Load_Char only use the last-created one to */ + /* determine the "current character pixel size". */ + /* */ + /* This function can be used to "activate" a previously created size */ + /* object. */ + /* */ + /* <Input> */ + /* size :: A handle to a target size object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* If "face" is the size's parent face object, this function changes */ + /* the value of "face->size" to the input size handle. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Activate_Size( FT_Size size ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTSIZES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftsnames.h b/extlibs/headers/freetype/ftsnames.h new file mode 100644 index 00000000..0e2d9a4a --- /dev/null +++ b/extlibs/headers/freetype/ftsnames.h @@ -0,0 +1,167 @@ +/***************************************************************************/ +/* */ +/* ftsnames.h */ +/* */ +/* Simple interface to access SFNT name tables (which are used */ +/* to hold font names, copyright info, notices, etc.) (specification). */ +/* */ +/* This is _not_ used to retrieve glyph names! */ +/* */ +/* Copyright 1996-2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FT_SFNT_NAMES_H__ +#define __FT_SFNT_NAMES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* sfnt_names */ + /* */ + /* <Title> */ + /* SFNT Names */ + /* */ + /* <Abstract> */ + /* Access the names embedded in TrueType and OpenType files. */ + /* */ + /* <Description> */ + /* The TrueType and OpenType specification allow the inclusion of */ + /* a special `names table' in font files. This table contains */ + /* textual (and internationalized) information regarding the font, */ + /* like family name, copyright, version, etc. */ + /* */ + /* The definitions below are used to access them if available. */ + /* */ + /* Note that this has nothing to do with glyph names! */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_SfntName */ + /* */ + /* <Description> */ + /* A structure used to model an SFNT `name' table entry. */ + /* */ + /* <Fields> */ + /* platform_id :: The platform ID for `string'. */ + /* */ + /* encoding_id :: The encoding ID for `string'. */ + /* */ + /* language_id :: The language ID for `string'. */ + /* */ + /* name_id :: An identifier for `string'. */ + /* */ + /* string :: The `name' string. Note that its format differs */ + /* depending on the (platform,encoding) pair. It can */ + /* be a Pascal String, a UTF-16 one, etc.. */ + /* */ + /* Generally speaking, the string is not */ + /* zero-terminated. Please refer to the TrueType */ + /* specification for details.. */ + /* */ + /* string_len :: The length of `string' in bytes. */ + /* */ + /* <Note> */ + /* Possible values for `platform_id', `encoding_id', `language_id', */ + /* and `name_id' are given in the file `ttnameid.h'. For details */ + /* please refer to the TrueType or OpenType specification. */ + /* */ + typedef struct FT_SfntName_ + { + FT_UShort platform_id; + FT_UShort encoding_id; + FT_UShort language_id; + FT_UShort name_id; + + FT_Byte* string; /* this string is *not* null-terminated! */ + FT_UInt string_len; /* in bytes */ + + } FT_SfntName; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Sfnt_Name_Count */ + /* */ + /* <Description> */ + /* Retrieves the number of name strings in the SFNT `name' table. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face. */ + /* */ + /* <Return> */ + /* The number of strings in the `name' table. */ + /* */ + FT_EXPORT( FT_UInt ) + FT_Get_Sfnt_Name_Count( FT_Face face ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Sfnt_Name */ + /* */ + /* <Description> */ + /* Retrieves a string of the SFNT `name' table for a given index. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face. */ + /* */ + /* idx :: The index of the `name' string. */ + /* */ + /* <Output> */ + /* aname :: The indexed FT_SfntName structure. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The `string' array returned in the `aname' structure is not */ + /* null-terminated. */ + /* */ + /* Use FT_Get_Sfnt_Name_Count() to get the total number of available */ + /* `name' table entries, then do a loop until you get the right */ + /* platform, encoding, and name ID. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_Sfnt_Name( FT_Face face, + FT_UInt idx, + FT_SfntName *aname ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FT_SFNT_NAMES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftstroke.h b/extlibs/headers/freetype/ftstroke.h new file mode 100644 index 00000000..c6c96dee --- /dev/null +++ b/extlibs/headers/freetype/ftstroke.h @@ -0,0 +1,710 @@ +/***************************************************************************/ +/* */ +/* ftstroke.h */ +/* */ +/* FreeType path stroker (specification). */ +/* */ +/* Copyright 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FT_STROKE_H__ +#define __FT_STROKE_H__ + +#include <ft2build.h> +#include FT_OUTLINE_H +#include FT_GLYPH_H + + +FT_BEGIN_HEADER + + + /************************************************************************ + * + * <Section> + * glyph_stroker + * + * <Title> + * Glyph Stroker + * + * <Abstract> + * Generating bordered and stroked glyphs. + * + * <Description> + * This component generates stroked outlines of a given vectorial + * glyph. It also allows you to retrieve the `outside' and/or the + * `inside' borders of the stroke. + * + * This can be useful to generate `bordered' glyph, i.e., glyphs + * displayed with a coloured (and anti-aliased) border around their + * shape. + */ + + + /************************************************************** + * + * @type: + * FT_Stroker + * + * @description: + * Opaque handler to a path stroker object. + */ + typedef struct FT_StrokerRec_* FT_Stroker; + + + /************************************************************** + * + * @enum: + * FT_Stroker_LineJoin + * + * @description: + * These values determine how two joining lines are rendered + * in a stroker. + * + * @values: + * FT_STROKER_LINEJOIN_ROUND :: + * Used to render rounded line joins. Circular arcs are used + * to join two lines smoothly. + * + * FT_STROKER_LINEJOIN_BEVEL :: + * Used to render beveled line joins; i.e., the two joining lines + * are extended until they intersect. + * + * FT_STROKER_LINEJOIN_MITER :: + * Same as beveled rendering, except that an additional line + * break is added if the angle between the two joining lines + * is too closed (this is useful to avoid unpleasant spikes + * in beveled rendering). + */ + typedef enum + { + FT_STROKER_LINEJOIN_ROUND = 0, + FT_STROKER_LINEJOIN_BEVEL, + FT_STROKER_LINEJOIN_MITER + + } FT_Stroker_LineJoin; + + + /************************************************************** + * + * @enum: + * FT_Stroker_LineCap + * + * @description: + * These values determine how the end of opened sub-paths are + * rendered in a stroke. + * + * @values: + * FT_STROKER_LINECAP_BUTT :: + * The end of lines is rendered as a full stop on the last + * point itself. + * + * FT_STROKER_LINECAP_ROUND :: + * The end of lines is rendered as a half-circle around the + * last point. + * + * FT_STROKER_LINECAP_SQUARE :: + * The end of lines is rendered as a square around the + * last point. + */ + typedef enum + { + FT_STROKER_LINECAP_BUTT = 0, + FT_STROKER_LINECAP_ROUND, + FT_STROKER_LINECAP_SQUARE + + } FT_Stroker_LineCap; + + + /************************************************************** + * + * @enum: + * FT_StrokerBorder + * + * @description: + * These values are used to select a given stroke border + * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder. + * + * @values: + * FT_STROKER_BORDER_LEFT :: + * Select the left border, relative to the drawing direction. + * + * FT_STROKER_BORDER_RIGHT :: + * Select the right border, relative to the drawing direction. + * + * @note: + * Applications are generally interested in the `inside' and `outside' + * borders. However, there is no direct mapping between these and + * the `left' / `right' ones, since this really depends on the glyph's + * drawing orientation, which varies between font formats. + * + * You can however use @FT_Outline_GetInsideBorder and + * @FT_Outline_GetOutsideBorder to get these. + */ + typedef enum + { + FT_STROKER_BORDER_LEFT = 0, + FT_STROKER_BORDER_RIGHT + + } FT_StrokerBorder; + + + /************************************************************** + * + * @function: + * FT_Outline_GetInsideBorder + * + * @description: + * Retrieve the @FT_StrokerBorder value corresponding to the + * `inside' borders of a given outline. + * + * @input: + * outline :: + * The source outline handle. + * + * @return: + * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid + * outlines. + */ + FT_EXPORT( FT_StrokerBorder ) + FT_Outline_GetInsideBorder( FT_Outline* outline ); + + + /************************************************************** + * + * @function: + * FT_Outline_GetOutsideBorder + * + * @description: + * Retrieve the @FT_StrokerBorder value corresponding to the + * `outside' borders of a given outline. + * + * @input: + * outline :: + * The source outline handle. + * + * @return: + * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid + * outlines. + */ + FT_EXPORT( FT_StrokerBorder ) + FT_Outline_GetOutsideBorder( FT_Outline* outline ); + + + /************************************************************** + * + * @function: + * FT_Stroker_New + * + * @description: + * Create a new stroker object. + * + * @input: + * memory :: + * The memory manager handle. + * + * @output: + * A new stroker object handle. NULL in case of error. + * + * @return: + * FreeType error code. 0 means success. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_New( FT_Memory memory, + FT_Stroker *astroker ); + + + /************************************************************** + * + * @function: + * FT_Stroker_Set + * + * @description: + * Reset a stroker object's attributes. + * + * @input: + * stroker :: + * The target stroker handle. + * + * radius :: + * The border radius. + * + * line_cap :: + * The line cap style. + * + * line_join :: + * The line join style. + * + * miter_limit :: + * The miter limit for the FT_STROKER_LINEJOIN_MITER style, + * expressed as 16.16 fixed point value. + * + * @note: + * The radius is expressed in the same units that the outline + * coordinates. + */ + FT_EXPORT( void ) + FT_Stroker_Set( FT_Stroker stroker, + FT_Fixed radius, + FT_Stroker_LineCap line_cap, + FT_Stroker_LineJoin line_join, + FT_Fixed miter_limit ); + + + /************************************************************** + * + * @function: + * FT_Stroker_Rewind + * + * @description: + * Reset a stroker object without changing its attributes. + * You should call this function before beginning a new + * series of calls to @FT_Stroker_BeginSubPath or + * @FT_Stroker_EndSubPath. + * + * @input: + * stroker :: + * The target stroker handle. + */ + FT_EXPORT( void ) + FT_Stroker_Rewind( FT_Stroker stroker ); + + + /************************************************************** + * + * @function: + * FT_Stroker_ParseOutline + * + * @description: + * A convenience function used to parse a whole outline with + * the stroker. The resulting outline(s) can be retrieved + * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export. + * + * @input: + * stroker :: + * The target stroker handle. + * + * outline :: + * The source outline. + * + * opened :: + * A boolean. If TRUE, the outline is treated as an open path + * instead of a closed one. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * If `opened' is 0 (the default), the outline is treated as a closed + * path, and the stroker will generate two distinct `border' outlines. + * + * If `opened' is 1, the outline is processed as an open path, and the + * stroker will generate a single `stroke' outline. + * + * This function calls @FT_Stroker_Rewind automatically. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_ParseOutline( FT_Stroker stroker, + FT_Outline* outline, + FT_Bool opened ); + + + /************************************************************** + * + * @function: + * FT_Stroker_BeginSubPath + * + * @description: + * Start a new sub-path in the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * to :: + * A pointer to the start vector. + * + * open :: + * A boolean. If TRUE, the sub-path is treated as an open one. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function is useful when you need to stroke a path that is + * not stored as a @FT_Outline object. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_BeginSubPath( FT_Stroker stroker, + FT_Vector* to, + FT_Bool open ); + + + /************************************************************** + * + * @function: + * FT_Stroker_EndSubPath + * + * @description: + * Close the current sub-path in the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * You should call this function after @FT_Stroker_BeginSubPath. + * If the subpath was not `opened', this function will `draw' a + * single line segment to the start position when needed. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_EndSubPath( FT_Stroker stroker ); + + + /************************************************************** + * + * @function: + * FT_Stroker_LineTo + * + * @description: + * `Draw' a single line segment in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_LineTo( FT_Stroker stroker, + FT_Vector* to ); + + + /************************************************************** + * + * @function: + * FT_Stroker_ConicTo + * + * @description: + * `Draw; a single quadratic bezier in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * control :: + * A pointer to a Bézier control point. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_ConicTo( FT_Stroker stroker, + FT_Vector* control, + FT_Vector* to ); + + + /************************************************************** + * + * @function: + * FT_Stroker_CubicTo + * + * @description: + * `Draw' a single cubic Bézier in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * control1 :: + * A pointer to the first Bézier control point. + * + * control2 :: + * A pointer to second Bézier control point. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_CubicTo( FT_Stroker stroker, + FT_Vector* control1, + FT_Vector* control2, + FT_Vector* to ); + + + /************************************************************** + * + * @function: + * FT_Stroker_GetBorderCounts + * + * @description: + * Vall this function once you have finished parsing your paths + * with the stroker. It will return the number of points and + * contours necessary to export one of the `border' or `stroke' + * outlines generated by the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * border :: + * The border index. + * + * @output: + * anum_points :: + * The number of points. + * + * anum_contours :: + * The number of contours. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * When an outline, or a sub-path, is `closed', the stroker generates + * two independent `border' outlines, named `left' and `right'. + * + * When the outline, or a sub-path, is `opened', the stroker merges + * the `border' outlines with caps. The `left' border receives all + * points, while the `right' border becomes empty. + * + * Use the function @FT_Stroker_GetCounts instead if you want to + * retrieve the counts associated to both borders. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_GetBorderCounts( FT_Stroker stroker, + FT_StrokerBorder border, + FT_UInt *anum_points, + FT_UInt *anum_contours ); + + + /************************************************************** + * + * @function: + * FT_Stroker_ExportBorder + * + * @description: + * Call this function after @FT_Stroker_GetBorderCounts to + * export the corresponding border to your own @FT_Outline + * structure. + * + * Note that this function will append the border points and + * contours to your outline, but will not try to resize its + * arrays. + * + * @input: + * stroker :: + * The target stroker handle. + * + * border :: + * The border index. + * + * outline :: + * The target outline handle. + * + * @note: + * Always call this function after @FT_Stroker_GetBorderCounts to + * get sure that there is enough room in your @FT_Outline object to + * receive all new data. + * + * When an outline, or a sub-path, is `closed', the stroker generates + * two independent `border' outlines, named `left' and `right' + * + * When the outline, or a sub-path, is `opened', the stroker merges + * the `border' outlines with caps. The `left' border receives all + * points, while the `right' border becomes empty. + * + * Use the function @FT_Stroker_Export instead if you want to + * retrieve all borders at once. + */ + FT_EXPORT( void ) + FT_Stroker_ExportBorder( FT_Stroker stroker, + FT_StrokerBorder border, + FT_Outline* outline ); + + + /************************************************************** + * + * @function: + * FT_Stroker_GetCounts + * + * @description: + * Call this function once you have finished parsing your paths + * with the stroker. It returns the number of points and + * contours necessary to export all points/borders from the stroked + * outline/path. + * + * @input: + * stroker :: + * The target stroker handle. + * + * @output: + * anum_points :: + * The number of points. + * + * anum_contours :: + * The number of contours. + * + * @return: + * FreeType error code. 0 means success. + */ + FT_EXPORT( FT_Error ) + FT_Stroker_GetCounts( FT_Stroker stroker, + FT_UInt *anum_points, + FT_UInt *anum_contours ); + + + /************************************************************** + * + * @function: + * FT_Stroker_Export + * + * @description: + * Call this function after @FT_Stroker_GetBorderCounts to + * export the all borders to your own @FT_Outline structure. + * + * Note that this function will append the border points and + * contours to your outline, but will not try to resize its + * arrays. + * + * @input: + * stroker :: + * The target stroker handle. + * + * outline :: + * The target outline handle. + */ + FT_EXPORT( void ) + FT_Stroker_Export( FT_Stroker stroker, + FT_Outline* outline ); + + + /************************************************************** + * + * @function: + * FT_Stroker_Done + * + * @description: + * Destroy a stroker object. + * + * @input: + * stroker :: + * A stroker handle. Can be NULL. + */ + FT_EXPORT( void ) + FT_Stroker_Done( FT_Stroker stroker ); + + + /************************************************************** + * + * @function: + * FT_Glyph_Stroke + * + * @description: + * Stroke a given outline glyph object with a given stroker. + * + * @inout: + * pglyph :: Source glyph handle on input, new glyph handle + * on output. + * + * @input: + * stroker :: + * A stroker handle. + * + * destroy :: + * A Boolean. If TRUE, the source glyph object is destroyed + * on success. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The source glyph is untouched in case of error. + */ + FT_EXPORT( FT_Error ) + FT_Glyph_Stroke( FT_Glyph *pglyph, + FT_Stroker stroker, + FT_Bool destroy ); + + + /************************************************************** + * + * @function: + * FT_Glyph_StrokeBorder + * + * @description: + * Stroke a given outline glyph object with a given stroker, but + * only return either its inside or outside border. + * + * @inout: + * pglyph :: + * Source glyph handle on input, new glyph handle on output. + * + * @input: + * stroker :: + * A stroker handle. + * + * inside :: + * A Boolean. If TRUE, return the inside border, otherwise + * the outside border. + * + * destroy :: + * A Boolean. If TRUE, the source glyph object is destroyed + * on success. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The source glyph is untouched in case of error. + */ + FT_EXPORT( FT_Error ) + FT_Glyph_StrokeBorder( FT_Glyph *pglyph, + FT_Stroker stroker, + FT_Bool inside, + FT_Bool destroy ); + + /* */ + +FT_END_HEADER + +#endif /* __FT_STROKE_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftsynth.h b/extlibs/headers/freetype/ftsynth.h new file mode 100644 index 00000000..f0c73853 --- /dev/null +++ b/extlibs/headers/freetype/ftsynth.h @@ -0,0 +1,71 @@ +/***************************************************************************/ +/* */ +/* ftsynth.h */ +/* */ +/* FreeType synthesizing code for emboldening and slanting */ +/* (specification). */ +/* */ +/* Copyright 2000-2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /********* *********/ + /********* WARNING, THIS IS ALPHA CODE, THIS API *********/ + /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ + /********* FREETYPE DEVELOPMENT TEAM *********/ + /********* *********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifndef __FTSYNTH_H__ +#define __FTSYNTH_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /* This code is completely experimental -- use with care! */ + /* It will probably be completely rewritten in the future */ + /* or even integrated into the library. */ + FT_EXPORT( void ) + FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); + + + FT_EXPORT( void ) + FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); + + /* */ + +FT_END_HEADER + +#endif /* __FTSYNTH_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftsysio.h b/extlibs/headers/freetype/ftsysio.h new file mode 100644 index 00000000..f8e49543 --- /dev/null +++ b/extlibs/headers/freetype/ftsysio.h @@ -0,0 +1,195 @@ +#ifndef __FT_SYSTEM_IO_H__ +#define __FT_SYSTEM_IO_H__ + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** NOTE: THE CONTENT OF THIS FILE IS NOT CURRENTLY USED *****/ + /***** IN NORMAL BUILDS. CONSIDER IT EXPERIMENTAL. *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + + /******************************************************************** + * + * designing custom streams is a bit different now + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +#include <ft2build.h> +#include FT_INTERNAL_OBJECT_H + +FT_BEGIN_HEADER + + /*@******************************************************************* + * + * @type: FT_Stream + * + * @description: + * handle to an input stream object. These are also @FT_Object handles + */ + typedef struct FT_StreamRec_* FT_Stream; + + + /*@******************************************************************* + * + * @type: FT_Stream_Class + * + * @description: + * opaque handle to a @FT_Stream_ClassRec class structure describing + * the methods of input streams + */ + typedef const struct FT_Stream_ClassRec_* FT_Stream_Class; + + + /*@******************************************************************* + * + * @functype: FT_Stream_ReadFunc + * + * @description: + * a method used to read bytes from an input stream into memory + * + * @input: + * stream :: target stream handle + * buffer :: target buffer address + * size :: number of bytes to read + * + * @return: + * number of bytes effectively read. Must be <= 'size'. + */ + typedef FT_ULong (*FT_Stream_ReadFunc)( FT_Stream stream, + FT_Byte* buffer, + FT_ULong size ); + + + /*@******************************************************************* + * + * @functype: FT_Stream_SeekFunc + * + * @description: + * a method used to seek to a new position within a stream + * + * @input: + * stream :: target stream handle + * pos :: new read position, from start of stream + * + * @return: + * error code. 0 means success + */ + typedef FT_Error (*FT_Stream_SeekFunc)( FT_Stream stream, + FT_ULong pos ); + + + /*@******************************************************************* + * + * @struct: FT_Stream_ClassRec + * + * @description: + * a structure used to describe an input stream class + * + * @input: + * clazz :: root @FT_ClassRec fields + * stream_read :: stream byte read method + * stream_seek :: stream seek method + */ + typedef struct FT_Stream_ClassRec_ + { + FT_ClassRec clazz; + FT_Stream_ReadFunc stream_read; + FT_Stream_SeekFunc stream_seek; + + } FT_Stream_ClassRec; + + /* */ + +#define FT_STREAM_CLASS(x) ((FT_Stream_Class)(x)) +#define FT_STREAM_CLASS__READ(x) FT_STREAM_CLASS(x)->stream_read +#define FT_STREAM_CLASS__SEEK(x) FT_STREAM_CLASS(x)->stream_seek; + + /*@******************************************************************* + * + * @struct: FT_StreamRec + * + * @description: + * the input stream object structure. See @FT_Stream_ClassRec for + * its class descriptor + * + * @fields: + * object :: root @FT_ObjectRec fields + * size :: size of stream in bytes (0 if unknown) + * pos :: current position within stream + * base :: for memory-based streams, the address of the stream's + * first data byte in memory. NULL otherwise + * + * cursor :: the current cursor position within an input stream + * frame. Only valid within a FT_FRAME_ENTER .. FT_FRAME_EXIT + * block; NULL otherwise + * + * limit :: the current frame limit within a FT_FRAME_ENTER .. + * FT_FRAME_EXIT block. NULL otherwise + */ + typedef struct FT_StreamRec_ + { + FT_ObjectRec object; + FT_ULong size; + FT_ULong pos; + const FT_Byte* base; + const FT_Byte* cursor; + const FT_Byte* limit; + + } FT_StreamRec; + + /* some useful macros */ +#define FT_STREAM(x) ((FT_Stream)(x)) +#define FT_STREAM_P(x) ((FT_Stream*)(x)) + +#define FT_STREAM__READ(x) FT_STREAM_CLASS__READ(FT_OBJECT__CLASS(x)) +#define FT_STREAM__SEEK(x) FT_STREAM_CLASS__SEEK(FT_OBJECT__CLASS(x)) + +#define FT_STREAM_IS_BASED(x) ( FT_STREAM(x)->base != NULL ) + + /* */ + + /* create new memory-based stream */ + FT_BASE( FT_Error ) ft_stream_new_memory( const FT_Byte* stream_base, + FT_ULong stream_size, + FT_Memory memory, + FT_Stream *astream ); + + FT_BASE( FT_Error ) ft_stream_new_iso( const char* pathanme, + FT_Memory memory, + FT_Stream *astream ); + + + /* handle to default stream class implementation for a given build */ + /* this is used by "FT_New_Face" */ + /* */ + FT_APIVAR( FT_Type ) ft_stream_default_type; + +FT_END_HEADER + +#endif /* __FT_SYSTEM_STREAM_H__ */ diff --git a/extlibs/headers/freetype/ftsysmem.h b/extlibs/headers/freetype/ftsysmem.h new file mode 100644 index 00000000..8de0c4db --- /dev/null +++ b/extlibs/headers/freetype/ftsysmem.h @@ -0,0 +1,202 @@ +#ifndef __FT_SYSTEM_MEMORY_H__ +#define __FT_SYSTEM_MEMORY_H__ + +#include <ft2build.h> + +FT_BEGIN_HEADER + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** NOTE: THE CONTENT OF THIS FILE IS NOT CURRENTLY USED *****/ + /***** IN NORMAL BUILDS. CONSIDER IT EXPERIMENTAL. *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + + /*@********************************************************************** + * + * @type: FT_Memory + * + * @description: + * opaque handle to a memory manager handle. Note that since FreeType + * 2.2, the memory manager structure FT_MemoryRec is hidden to client + * applications. + * + * however, you can still define custom allocators easily using the + * @ft_memory_new API + */ + typedef struct FT_MemoryRec_* FT_Memory; + + + /*@********************************************************************** + * + * @functype: FT_Memory_AllocFunc + * + * @description: + * a function used to allocate a block of memory. + * + * @input: + * size :: size of blocks in bytes. Always > 0 !! + * mem_data :: memory-manager specific optional argument + * (see @ft_memory_new) + * + * @return: + * address of new block. NULL in case of memory exhaustion + */ + typedef FT_Pointer (*FT_Memory_AllocFunc)( FT_ULong size, + FT_Pointer mem_data ); + + + /*@********************************************************************** + * + * @functype: FT_Memory_FreeFunc + * + * @description: + * a function used to release a block of memory created through + * @FT_Memory_AllocFunc or @FT_Memory_ReallocFunc + * + * @input: + * block :: address of target memory block. cannot be NULL !! + * mem_data :: memory-manager specific optional argument + * (see @ft_memory_new) + */ + typedef void (*FT_Memory_FreeFunc) ( FT_Pointer block, + FT_Pointer mem_data ); + + + /*@********************************************************************** + * + * @functype: FT_Memory_ReallocFunc + * + * @description: + * a function used to reallocate a memory block. + * + * @input: + * block :: address of target memory block. cannot be NULL !! + * new_size :: new requested size in bytes + * cur_size :: current block size in bytes + * mem_data :: memory-manager specific optional argument + * (see @ft_memory_new) + */ + typedef FT_Pointer (*FT_Memory_ReallocFunc)( FT_Pointer block, + FT_ULong new_size, + FT_ULong cur_size, + FT_Pointer mem_data ); + + + /*@********************************************************************** + * + * @functype: FT_Memory_CreateFunc + * + * @description: + * a function used to create a @FT_Memory object to model a + * memory manager + * + * @input: + * size :: size of memory manager structure in bytes + * init_data :: optional initialisation argument + * + * @output: + * amem_data :: memory-manager specific argument to block management + * routines. + * + * @return: + * handle to new memory manager object. NULL in case of failure + */ + typedef FT_Pointer (*FT_Memory_CreateFunc)( FT_UInt size, + FT_Pointer init_data, + FT_Pointer *amem_data ); + + + /*@********************************************************************** + * + * @functype: FT_Memory_DestroyFunc + * + * @description: + * a function used to destroy a given @FT_Memory manager + * + * @input: + * memory :: target memory manager handle + * mem_data :: option manager-specific argument + */ + typedef void (*FT_Memory_DestroyFunc)( FT_Memory memory, + FT_Pointer mem_data ); + + + /*@********************************************************************** + * + * @struct: FT_Memory_FuncsRec + * + * @description: + * a function used to hold all methods of a given memory manager + * implementation. + * + * @fields: + * mem_alloc :: block allocation routine + * mem_free :: block release routine + * mem_realloc :: block re-allocation routine + * mem_create :: manager creation routine + * mem_destroy :: manager destruction routine + */ + typedef struct FT_Memory_FuncsRec_ + { + FT_Memory_AllocFunc mem_alloc; + FT_Memory_FreeFunc mem_free; + FT_Memory_ReallocFunc mem_realloc; + FT_Memory_CreateFunc mem_create; + FT_Memory_DestroyFunc mem_destroy; + + } FT_Memory_FuncsRec, *FT_Memory_Funcs; + + + /*@********************************************************************** + * + * @type: FT_Memory_Funcs + * + * @description: + * a pointer to a constant @FT_Memory_FuncsRec structure used to + * describe a given memory manager implementation. + */ + typedef const FT_Memory_FuncsRec* FT_Memory_Funcs; + + + /*@********************************************************************** + * + * @function: ft_memory_new + * + * @description: + * create a new memory manager, given a set of memory methods + * + * @input: + * mem_funcs :: handle to memory manager implementation descriptor + * mem_init_data :: optional initialisation argument, passed to + * @FT_Memory_CreateFunc + * + * @return: + * new memory manager handle. NULL in case of failure + */ + FT_BASE( FT_Memory ) + ft_memory_new( FT_Memory_Funcs mem_funcs, + FT_Pointer mem_init_data ); + + + /*@********************************************************************** + * + * @function: ft_memory_destroy + * + * @description: + * destroy a given memory manager + * + * @input: + * memory :: handle to target memory manager + */ + FT_BASE( void ) + ft_memory_destroy( FT_Memory memory ); + +/* */ + +FT_END_HEADER + +#endif /* __FT_SYSTEM_MEMORY_H__ */ diff --git a/extlibs/headers/freetype/ftsystem.h b/extlibs/headers/freetype/ftsystem.h new file mode 100644 index 00000000..d1c55f7a --- /dev/null +++ b/extlibs/headers/freetype/ftsystem.h @@ -0,0 +1,309 @@ +/***************************************************************************/ +/* */ +/* ftsystem.h */ +/* */ +/* FreeType low-level system interface definition (specification). */ +/* */ +/* Copyright 1996-2001, 2002 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTSYSTEM_H__ +#define __FTSYSTEM_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* system_interface */ + /* */ + /* <Title> */ + /* System Interface */ + /* */ + /* <Abstract> */ + /* How FreeType manages memory and i/o. */ + /* */ + /* <Description> */ + /* This section contains various definitions related to memory */ + /* management and i/o access. You need to understand this */ + /* information if you want to use a custom memory manager or you own */ + /* input i/o streams. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* M E M O R Y M A N A G E M E N T */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* @type: */ + /* FT_Memory */ + /* */ + /* @description: */ + /* A handle to a given memory manager object, defined with a */ + /* @FT_MemoryRec structure. */ + /* */ + typedef struct FT_MemoryRec_* FT_Memory; + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* FT_Alloc_Func */ + /* */ + /* @description: */ + /* A function used to allocate `size' bytes from `memory'. */ + /* */ + /* @input: */ + /* memory :: A handle to the source memory manager. */ + /* */ + /* size :: The size in bytes to allocate. */ + /* */ + /* @return: */ + /* Address of new memory block. 0 in case of failure. */ + /* */ + typedef void* + (*FT_Alloc_Func)( FT_Memory memory, + long size ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* FT_Free_Func */ + /* */ + /* @description: */ + /* A function used to release a given block of memory. */ + /* */ + /* @input: */ + /* memory :: A handle to the source memory manager. */ + /* */ + /* block :: The address of the target memory block. */ + /* */ + typedef void + (*FT_Free_Func)( FT_Memory memory, + void* block ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* FT_Realloc_Func */ + /* */ + /* @description: */ + /* a function used to re-allocate a given block of memory. */ + /* */ + /* @input: */ + /* memory :: A handle to the source memory manager. */ + /* */ + /* cur_size :: The block's current size in bytes. */ + /* */ + /* new_size :: The block's requested new size. */ + /* */ + /* block :: The block's current address. */ + /* */ + /* @return: */ + /* New block address. 0 in case of memory shortage. */ + /* */ + /* @note: */ + /* In case of error, the old block must still be available. */ + /* */ + typedef void* + (*FT_Realloc_Func)( FT_Memory memory, + long cur_size, + long new_size, + void* block ); + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* FT_MemoryRec */ + /* */ + /* @description: */ + /* A structure used to describe a given memory manager to FreeType 2. */ + /* */ + /* @fields: */ + /* user :: A generic typeless pointer for user data. */ + /* */ + /* alloc :: A pointer type to an allocation function. */ + /* */ + /* free :: A pointer type to an memory freeing function. */ + /* */ + /* realloc :: A pointer type to a reallocation function. */ + /* */ + struct FT_MemoryRec_ + { + void* user; + FT_Alloc_Func alloc; + FT_Free_Func free; + FT_Realloc_Func realloc; + }; + + + /*************************************************************************/ + /* */ + /* I / O M A N A G E M E N T */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* @type: */ + /* FT_Stream */ + /* */ + /* @description: */ + /* A handle to an input stream. */ + /* */ + typedef struct FT_StreamRec_* FT_Stream; + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* FT_StreamDesc */ + /* */ + /* @description: */ + /* A union type used to store either a long or a pointer. This is */ + /* used to store a file descriptor or a FILE* in an input stream. */ + /* */ + typedef union FT_StreamDesc_ + { + long value; + void* pointer; + + } FT_StreamDesc; + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* FT_Stream_IoFunc */ + /* */ + /* @description: */ + /* A function used to seek and read data from a given input stream. */ + /* */ + /* @input: */ + /* stream :: A handle to the source stream. */ + /* */ + /* offset :: The offset of read in stream (always from start). */ + /* */ + /* buffer :: The address of the read buffer. */ + /* */ + /* count :: The number of bytes to read from the stream. */ + /* */ + /* @return: */ + /* The number of bytes effectively read by the stream. */ + /* */ + /* @note: */ + /* This function might be called to perform a seek or skip operation */ + /* with a `count' of 0. */ + /* */ + typedef unsigned long + (*FT_Stream_IoFunc)( FT_Stream stream, + unsigned long offset, + unsigned char* buffer, + unsigned long count ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* FT_Stream_CloseFunc */ + /* */ + /* @description: */ + /* A function used to close a given input stream. */ + /* */ + /* @input: */ + /* stream :: A handle to the target stream. */ + /* */ + typedef void + (*FT_Stream_CloseFunc)( FT_Stream stream ); + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* FT_StreamRec */ + /* */ + /* @description: */ + /* A structure used to describe an input stream. */ + /* */ + /* @input: */ + /* base :: For memory-based streams, this is the address of the */ + /* first stream byte in memory. This field should */ + /* always be set to NULL for disk-based streams. */ + /* */ + /* size :: The stream size in bytes. */ + /* */ + /* pos :: The current position within the stream. */ + /* */ + /* descriptor :: This field is a union that can hold an integer or a */ + /* pointer. It is used by stream implementations to */ + /* store file descriptors or FILE* pointers. */ + /* */ + /* pathname :: This field is completely ignored by FreeType. */ + /* However, it is often useful during debugging to use */ + /* it to store the stream's filename (where available). */ + /* */ + /* read :: The stream's input function. */ + /* */ + /* close :: The stream;s close function. */ + /* */ + /* memory :: The memory manager to use to preload frames. This is */ + /* set internally by FreeType and shouldn't be touched */ + /* by stream implementations. */ + /* */ + /* cursor :: This field is set and used internally by FreeType */ + /* when parsing frames. */ + /* */ + /* limit :: This field is set and used internally by FreeType */ + /* when parsing frames. */ + /* */ + typedef struct FT_StreamRec_ + { + unsigned char* base; + unsigned long size; + unsigned long pos; + + FT_StreamDesc descriptor; + FT_StreamDesc pathname; + FT_Stream_IoFunc read; + FT_Stream_CloseFunc close; + + FT_Memory memory; + unsigned char* cursor; + unsigned char* limit; + + } FT_StreamRec; + + + /* */ + + +FT_END_HEADER + +#endif /* __FTSYSTEM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/fttrigon.h b/extlibs/headers/freetype/fttrigon.h new file mode 100644 index 00000000..0462265e --- /dev/null +++ b/extlibs/headers/freetype/fttrigon.h @@ -0,0 +1,315 @@ +/***************************************************************************/ +/* */ +/* fttrigon.h */ +/* */ +/* FreeType trigonometric functions (specification). */ +/* */ +/* Copyright 2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTTRIGON_H__ +#define __FTTRIGON_H__ + +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* @section: */ + /* computations */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* @type: */ + /* FT_Angle */ + /* */ + /* @description: */ + /* This type is used to model angle values in FreeType. Note that */ + /* the angle is a 16.16 fixed float value expressed in degrees. */ + /* */ + typedef FT_Fixed FT_Angle; + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_ANGLE_PI */ + /* */ + /* @description: */ + /* The angle pi expressed in @FT_Angle units. */ + /* */ +#define FT_ANGLE_PI ( 180L << 16 ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_ANGLE_2PI */ + /* */ + /* @description: */ + /* The angle 2*pi expressed in @FT_Angle units. */ + /* */ +#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_ANGLE_PI2 */ + /* */ + /* @description: */ + /* The angle pi/2 expressed in @FT_Angle units. */ + /* */ +#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) + + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_ANGLE_PI4 */ + /* */ + /* @description: */ + /* The angle pi/4 expressed in @FT_Angle units. */ + /* */ +#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Sin */ + /* */ + /* @description: */ + /* Return the sinus of a given angle in fixed point format. */ + /* */ + /* @input: */ + /* angle :: The input angle. */ + /* */ + /* @return: */ + /* The sinus value. */ + /* */ + /* @note: */ + /* If you need both the sinus and cosinus for a given angle, use the */ + /* function @FT_Vector_Unit. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_Sin( FT_Angle angle ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Cos */ + /* */ + /* @description: */ + /* Return the cosinus of a given angle in fixed point format. */ + /* */ + /* @input: */ + /* angle :: The input angle. */ + /* */ + /* @return: */ + /* The cosinus value. */ + /* */ + /* @note: */ + /* If you need both the sinus and cosinus for a given angle, use the */ + /* function @FT_Vector_Unit. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_Cos( FT_Angle angle ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Tan */ + /* */ + /* @description: */ + /* Return the tangent of a given angle in fixed point format. */ + /* */ + /* @input: */ + /* angle :: The input angle. */ + /* */ + /* @return: */ + /* The tangent value. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_Tan( FT_Angle angle ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Atan2 */ + /* */ + /* @description: */ + /* Return the arc-tangent corresponding to a given vector (x,y) in */ + /* the 2d plane. */ + /* */ + /* @input: */ + /* x :: The horizontal vector coordinate. */ + /* */ + /* y :: The vertical vector coordinate. */ + /* */ + /* @return: */ + /* The arc-tangent value (i.e. angle). */ + /* */ + FT_EXPORT( FT_Angle ) + FT_Atan2( FT_Fixed x, + FT_Fixed y ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Angle_Diff */ + /* */ + /* @description: */ + /* Return the difference between two angles. The result is always */ + /* constrained to the ]-PI..PI] interval. */ + /* */ + /* @input: */ + /* angle1 :: First angle. */ + /* */ + /* angle2 :: Second angle. */ + /* */ + /* @return: */ + /* Contrainted value of `value2-value1'. */ + /* */ + FT_EXPORT( FT_Angle ) + FT_Angle_Diff( FT_Angle angle1, + FT_Angle angle2 ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Vector_Unit */ + /* */ + /* @description: */ + /* Return the unit vector corresponding to a given angle. After the */ + /* call, the value of `vec.x' will be `sin(angle)', and the value of */ + /* `vec.y' will be `cos(angle)'. */ + /* */ + /* This function is useful to retrieve both the sinus and cosinus of */ + /* a given angle quickly. */ + /* */ + /* @output: */ + /* vec :: The address of target vector. */ + /* */ + /* @input: */ + /* angle :: The address of angle. */ + /* */ + FT_EXPORT( void ) + FT_Vector_Unit( FT_Vector* vec, + FT_Angle angle ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Vector_Rotate */ + /* */ + /* @description: */ + /* Rotate a vector by a given angle. */ + /* */ + /* @inout: */ + /* vec :: The address of target vector. */ + /* */ + /* @input: */ + /* angle :: The address of angle. */ + /* */ + FT_EXPORT( void ) + FT_Vector_Rotate( FT_Vector* vec, + FT_Angle angle ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Vector_Length */ + /* */ + /* @description: */ + /* Return the length of a given vector. */ + /* */ + /* @input: */ + /* vec :: The address of target vector. */ + /* */ + /* @return: */ + /* The vector length, expressed in the same units that the original */ + /* vector coordinates. */ + /* */ + FT_EXPORT( FT_Fixed ) + FT_Vector_Length( FT_Vector* vec ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Vector_Polarize */ + /* */ + /* @description: */ + /* Compute both the length and angle of a given vector. */ + /* */ + /* @input: */ + /* vec :: The address of source vector. */ + /* */ + /* @output: */ + /* length :: The vector length. */ + /* angle :: The vector angle. */ + /* */ + FT_EXPORT( void ) + FT_Vector_Polarize( FT_Vector* vec, + FT_Fixed *length, + FT_Angle *angle ); + + + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Vector_From_Polar */ + /* */ + /* @description: */ + /* Compute vector coordinates from a length and angle. */ + /* */ + /* @output: */ + /* vec :: The address of source vector. */ + /* */ + /* @input: */ + /* length :: The vector length. */ + /* angle :: The vector angle. */ + /* */ + FT_EXPORT( void ) + FT_Vector_From_Polar( FT_Vector* vec, + FT_Fixed length, + FT_Angle angle ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTTRIGON_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/fttypes.h b/extlibs/headers/freetype/fttypes.h new file mode 100644 index 00000000..7727ebb5 --- /dev/null +++ b/extlibs/headers/freetype/fttypes.h @@ -0,0 +1,582 @@ +/***************************************************************************/ +/* */ +/* fttypes.h */ +/* */ +/* FreeType simple types definitions (specification only). */ +/* */ +/* Copyright 1996-2001, 2002, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTTYPES_H__ +#define __FTTYPES_H__ + + +#include <ft2build.h> +#include FT_CONFIG_CONFIG_H +#include FT_SYSTEM_H +#include FT_IMAGE_H + +#include <stddef.h> + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* basic_types */ + /* */ + /* <Title> */ + /* Basic Data Types */ + /* */ + /* <Abstract> */ + /* The basic data types defined by the library. */ + /* */ + /* <Description> */ + /* This section contains the basic data types defined by FreeType 2, */ + /* ranging from simple scalar types to bitmap descriptors. More */ + /* font-specific structures are defined in a different section. */ + /* */ + /* <Order> */ + /* FT_Byte */ + /* FT_Bytes */ + /* FT_Char */ + /* FT_Int */ + /* FT_UInt */ + /* FT_Short */ + /* FT_UShort */ + /* FT_Long */ + /* FT_ULong */ + /* FT_Bool */ + /* FT_Offset */ + /* FT_PtrDist */ + /* FT_String */ + /* FT_Tag */ + /* FT_Error */ + /* FT_Fixed */ + /* FT_Pointer */ + /* FT_Pos */ + /* FT_Vector */ + /* FT_BBox */ + /* FT_Matrix */ + /* FT_FWord */ + /* FT_UFWord */ + /* FT_F2Dot14 */ + /* FT_UnitVector */ + /* FT_F26Dot6 */ + /* */ + /* */ + /* FT_Generic */ + /* FT_Generic_Finalizer */ + /* */ + /* FT_Bitmap */ + /* FT_Pixel_Mode */ + /* FT_Palette_Mode */ + /* FT_Glyph_Format */ + /* FT_IMAGE_TAG */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Bool */ + /* */ + /* <Description> */ + /* A typedef of unsigned char, used for simple booleans. */ + /* */ + typedef unsigned char FT_Bool; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_FWord */ + /* */ + /* <Description> */ + /* A signed 16-bit integer used to store a distance in original font */ + /* units. */ + /* */ + typedef signed short FT_FWord; /* distance in FUnits */ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UFWord */ + /* */ + /* <Description> */ + /* An unsigned 16-bit integer used to store a distance in original */ + /* font units. */ + /* */ + typedef unsigned short FT_UFWord; /* unsigned distance */ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Char */ + /* */ + /* <Description> */ + /* A simple typedef for the _signed_ char type. */ + /* */ + typedef signed char FT_Char; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Byte */ + /* */ + /* <Description> */ + /* A simple typedef for the _unsigned_ char type. */ + /* */ + typedef unsigned char FT_Byte; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Bytes */ + /* */ + /* <Description> */ + /* A typedef for constant memory areas. */ + /* */ + typedef const FT_Byte* FT_Bytes; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Tag */ + /* */ + /* <Description> */ + /* A typedef for 32bit tags (as used in the SFNT format). */ + /* */ + typedef FT_UInt32 FT_Tag; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_String */ + /* */ + /* <Description> */ + /* A simple typedef for the char type, usually used for strings. */ + /* */ + typedef char FT_String; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Short */ + /* */ + /* <Description> */ + /* A typedef for signed short. */ + /* */ + typedef signed short FT_Short; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UShort */ + /* */ + /* <Description> */ + /* A typedef for unsigned short. */ + /* */ + typedef unsigned short FT_UShort; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Int */ + /* */ + /* <Description> */ + /* A typedef for the int type. */ + /* */ + typedef signed int FT_Int; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UInt */ + /* */ + /* <Description> */ + /* A typedef for the unsigned int type. */ + /* */ + typedef unsigned int FT_UInt; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Long */ + /* */ + /* <Description> */ + /* A typedef for signed long. */ + /* */ + typedef signed long FT_Long; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_ULong */ + /* */ + /* <Description> */ + /* A typedef for unsigned long. */ + /* */ + typedef unsigned long FT_ULong; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_F2Dot14 */ + /* */ + /* <Description> */ + /* A signed 2.14 fixed float type used for unit vectors. */ + /* */ + typedef signed short FT_F2Dot14; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_F26Dot6 */ + /* */ + /* <Description> */ + /* A signed 26.6 fixed float type used for vectorial pixel */ + /* coordinates. */ + /* */ + typedef signed long FT_F26Dot6; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Fixed */ + /* */ + /* <Description> */ + /* This type is used to store 16.16 fixed float values, like scales */ + /* or matrix coefficients. */ + /* */ + typedef signed long FT_Fixed; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Error */ + /* */ + /* <Description> */ + /* The FreeType error code type. A value of 0 is always interpreted */ + /* as a successful operation. */ + /* */ + typedef int FT_Error; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Pointer */ + /* */ + /* <Description> */ + /* A simple typedef for a typeless pointer. */ + /* */ + typedef void* FT_Pointer; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Offset */ + /* */ + /* <Description> */ + /* This is equivalent to the ANSI C `size_t' type, i.e. the largest */ + /* _unsigned_ integer type used to express a file size or position, */ + /* or a memory block size. */ + /* */ + typedef size_t FT_Offset; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_PtrDist */ + /* */ + /* <Description> */ + /* This is equivalent to the ANSI C `ptrdiff_t' type, i.e. the */ + /* largest _signed_ integer type used to express the distance */ + /* between two pointers. */ + /* */ + typedef ft_ptrdiff_t FT_PtrDist; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_UnitVector */ + /* */ + /* <Description> */ + /* A simple structure used to store a 2D vector unit vector. Uses */ + /* FT_F2Dot14 types. */ + /* */ + /* <Fields> */ + /* x :: Horizontal coordinate. */ + /* */ + /* y :: Vertical coordinate. */ + /* */ + typedef struct FT_UnitVector_ + { + FT_F2Dot14 x; + FT_F2Dot14 y; + + } FT_UnitVector; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Matrix */ + /* */ + /* <Description> */ + /* A simple structure used to store a 2x2 matrix. Coefficients are */ + /* in 16.16 fixed float format. The computation performed is: */ + /* */ + /* { */ + /* x' = x*xx + y*xy */ + /* y' = x*yx + y*yy */ + /* } */ + /* */ + /* <Fields> */ + /* xx :: Matrix coefficient. */ + /* */ + /* xy :: Matrix coefficient. */ + /* */ + /* yx :: Matrix coefficient. */ + /* */ + /* yy :: Matrix coefficient. */ + /* */ + typedef struct FT_Matrix_ + { + FT_Fixed xx, xy; + FT_Fixed yx, yy; + + } FT_Matrix; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Data */ + /* */ + /* <Description> */ + /* Read-only binary data represented as a pointer and a length. */ + /* */ + /* <Fields> */ + /* pointer :: The data. */ + /* */ + /* length :: The length of the data in bytes. */ + /* */ + typedef struct FT_Data_ + { + const FT_Byte* pointer; + FT_Int length; + + } FT_Data; + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_Generic_Finalizer */ + /* */ + /* <Description> */ + /* Describes a function used to destroy the `client' data of any */ + /* FreeType object. See the description of the FT_Generic type for */ + /* details of usage. */ + /* */ + /* <Input> */ + /* The address of the FreeType object which is under finalization. */ + /* Its client data is accessed through its `generic' field. */ + /* */ + typedef void (*FT_Generic_Finalizer)(void* object); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Generic */ + /* */ + /* <Description> */ + /* Client applications often need to associate their own data to a */ + /* variety of FreeType core objects. For example, a text layout API */ + /* might want to associate a glyph cache to a given size object. */ + /* */ + /* Most FreeType object contains a `generic' field, of type */ + /* FT_Generic, which usage is left to client applications and font */ + /* servers. */ + /* */ + /* It can be used to store a pointer to client-specific data, as well */ + /* as the address of a `finalizer' function, which will be called by */ + /* FreeType when the object is destroyed (for example, the previous */ + /* client example would put the address of the glyph cache destructor */ + /* in the `finalizer' field). */ + /* */ + /* <Fields> */ + /* data :: A typeless pointer to any client-specified data. This */ + /* field is completely ignored by the FreeType library. */ + /* */ + /* finalizer :: A pointer to a `generic finalizer' function, which */ + /* will be called when the object is destroyed. If this */ + /* field is set to NULL, no code will be called. */ + /* */ + typedef struct FT_Generic_ + { + void* data; + FT_Generic_Finalizer finalizer; + + } FT_Generic; + + + /*************************************************************************/ + /* */ + /* <Macro> */ + /* FT_MAKE_TAG */ + /* */ + /* <Description> */ + /* This macro converts four letter tags which are used to label */ + /* TrueType tables into an unsigned long to be used within FreeType. */ + /* */ + /* <Note> */ + /* The produced values *must* be 32bit integers. Don't redefine this */ + /* macro. */ + /* */ +#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ + ( ( (FT_ULong)_x1 << 24 ) | \ + ( (FT_ULong)_x2 << 16 ) | \ + ( (FT_ULong)_x3 << 8 ) | \ + (FT_ULong)_x4 ) + + + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* L I S T M A N A G E M E N T */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* list_processing */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_ListNode */ + /* */ + /* <Description> */ + /* Many elements and objects in FreeType are listed through a */ + /* FT_List record (see FT_ListRec). As its name suggests, a */ + /* FT_ListNode is a handle to a single list element. */ + /* */ + typedef struct FT_ListNodeRec_* FT_ListNode; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_List */ + /* */ + /* <Description> */ + /* A handle to a list record (see FT_ListRec). */ + /* */ + typedef struct FT_ListRec_* FT_List; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_ListNodeRec */ + /* */ + /* <Description> */ + /* A structure used to hold a single list element. */ + /* */ + /* <Fields> */ + /* prev :: The previous element in the list. NULL if first. */ + /* */ + /* next :: The next element in the list. NULL if last. */ + /* */ + /* data :: A typeless pointer to the listed object. */ + /* */ + typedef struct FT_ListNodeRec_ + { + FT_ListNode prev; + FT_ListNode next; + void* data; + + } FT_ListNodeRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_ListRec */ + /* */ + /* <Description> */ + /* A structure used to hold a simple doubly-linked list. These are */ + /* used in many parts of FreeType. */ + /* */ + /* <Fields> */ + /* head :: The head (first element) of doubly-linked list. */ + /* */ + /* tail :: The tail (last element) of doubly-linked list. */ + /* */ + typedef struct FT_ListRec_ + { + FT_ListNode head; + FT_ListNode tail; + + } FT_ListRec; + + + /* */ + +#define FT_IS_EMPTY( list ) ( (list).head == 0 ) + + /* return base error code (without module-specific prefix) */ +#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) + + /* return module error code */ +#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) + +#define FT_BOOL( x ) ( (FT_Bool)( x ) ) + +FT_END_HEADER + +#endif /* __FTTYPES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftwinfnt.h b/extlibs/headers/freetype/ftwinfnt.h new file mode 100644 index 00000000..355b7e90 --- /dev/null +++ b/extlibs/headers/freetype/ftwinfnt.h @@ -0,0 +1,257 @@ +/***************************************************************************/ +/* */ +/* ftwinfnt.h */ +/* */ +/* FreeType API for accessing Windows fnt-specific data. */ +/* */ +/* Copyright 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTWINFNT_H__ +#define __FTWINFNT_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* winfnt_fonts */ + /* */ + /* <Title> */ + /* Window FNT Files */ + /* */ + /* <Abstract> */ + /* Windows FNT specific API. */ + /* */ + /* <Description> */ + /* This section contains the declaration of Windows FNT specific */ + /* functions. */ + /* */ + /*************************************************************************/ + + + /************************************************************************* + * + * @enum: + * FT_WinFNT_ID_XXX + * + * @description: + * A list of valid values for the `charset' byte in + * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX + * encodings (except for cp1361) can be found at ftp://ftp.unicode.org + * in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory. cp1361 is + * roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. + * + * @values: + * FT_WinFNT_ID_DEFAULT :: + * This is used for font enumeration and font creation as a + * `don't care' value. Valid font files don't contain this value. + * When querying for information about the character set of the font + * that is currently selected into a specified device context, this + * return value (of the related Windows API) simply denotes failure. + * + * FT_WinFNT_ID_SYMBOL :: + * There is no known mapping table available. + * + * FT_WinFNT_ID_MAC :: + * Mac Roman encoding. + * + * FT_WinFNT_ID_OEM :: + * From Michael Pöttgen <michael@poettgen.de>: + * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM + * is used for the charset of vector fonts, like `modern.fon', + * `roman.fon', and `script.fon' on Windows. + * + * The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value + * specifies a character set that is operating-system dependent. + * + * The `IFIMETRICS' documentation from the `Windows Driver + * Development Kit' says: This font supports an OEM-specific + * character set. The OEM character set is system dependent. + * + * In general OEM, as opposed to ANSI (i.e., cp1252), denotes the + * second default codepage that most international versions of + * Windows have. It is one of the OEM codepages from + * + * http://www.microsoft.com/globaldev/reference/cphome.mspx, + * + * and is used for the `DOS boxes', to support legacy applications. + * A German Windows version for example usually uses ANSI codepage + * 1252 and OEM codepage 850. + * + * FT_WinFNT_ID_CP874 :: + * A superset of Thai TIS 620 and ISO 8859-11. + * + * FT_WinFNT_ID_CP932 :: + * A superset of Japanese Shift-JIS (with minor deviations). + * + * FT_WinFNT_ID_CP936 :: + * A superset of simplified Chinese GB 2312-1980 (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP949 :: + * A superset of Korean Hangul KS C 5601-1987 (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP950 :: + * A superset of traditional Chinese Big 5 ETen (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP1250 :: + * A superset of East European ISO 8859-2 (with slightly different + * ordering). + * + * FT_WinFNT_ID_CP1251 :: + * A superset of Russian ISO 8859-5 (with different ordering). + * + * FT_WinFNT_ID_CP1252 :: + * ANSI encoding. A superset of ISO 8859-1. + * + * FT_WinFNT_ID_CP1253 :: + * A superset of Greek ISO 8859-7 (with minor modifications). + * + * FT_WinFNT_ID_CP1254 :: + * A superset of Turkish ISO 8859-9. + * + * FT_WinFNT_ID_CP1255 :: + * A superset of Hebrew ISO 8859-8 (with some modifications). + * + * FT_WinFNT_ID_CP1256 :: + * A superset of Arabic ISO 8859-6 (with different ordering). + * + * FT_WinFNT_ID_CP1257 :: + * A superset of Baltic ISO 8859-13 (with some deviations). + * + * FT_WinFNT_ID_CP1258 :: + * For Vietnamese. This encoding doesn't cover all necessary + * characters. + * + * FT_WinFNT_ID_CP1361 :: + * Korean (Johab). + */ + +#define FT_WinFNT_ID_CP1252 0 +#define FT_WinFNT_ID_DEFAULT 1 +#define FT_WinFNT_ID_SYMBOL 2 +#define FT_WinFNT_ID_MAC 77 +#define FT_WinFNT_ID_CP932 128 +#define FT_WinFNT_ID_CP949 129 +#define FT_WinFNT_ID_CP1361 130 +#define FT_WinFNT_ID_CP936 134 +#define FT_WinFNT_ID_CP950 136 +#define FT_WinFNT_ID_CP1253 161 +#define FT_WinFNT_ID_CP1254 162 +#define FT_WinFNT_ID_CP1258 163 +#define FT_WinFNT_ID_CP1255 177 +#define FT_WinFNT_ID_CP1256 178 +#define FT_WinFNT_ID_CP1257 186 +#define FT_WinFNT_ID_CP1251 204 +#define FT_WinFNT_ID_CP874 222 +#define FT_WinFNT_ID_CP1250 238 +#define FT_WinFNT_ID_OEM 255 + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_WinFNT_HeaderRec */ + /* */ + /* <Description> */ + /* Windows FNT Header info. */ + /* */ + typedef struct FT_WinFNT_HeaderRec_ + { + FT_UShort version; + FT_ULong file_size; + FT_Byte copyright[60]; + FT_UShort file_type; + FT_UShort nominal_point_size; + FT_UShort vertical_resolution; + FT_UShort horizontal_resolution; + FT_UShort ascent; + FT_UShort internal_leading; + FT_UShort external_leading; + FT_Byte italic; + FT_Byte underline; + FT_Byte strike_out; + FT_UShort weight; + FT_Byte charset; + FT_UShort pixel_width; + FT_UShort pixel_height; + FT_Byte pitch_and_family; + FT_UShort avg_width; + FT_UShort max_width; + FT_Byte first_char; + FT_Byte last_char; + FT_Byte default_char; + FT_Byte break_char; + FT_UShort bytes_per_row; + FT_ULong device_offset; + FT_ULong face_name_offset; + FT_ULong bits_pointer; + FT_ULong bits_offset; + FT_Byte reserved; + FT_ULong flags; + FT_UShort A_space; + FT_UShort B_space; + FT_UShort C_space; + FT_UShort color_table_offset; + FT_ULong reserved1[4]; + + } FT_WinFNT_HeaderRec, *FT_WinFNT_Header; + + + /********************************************************************** + * + * @function: + * FT_Get_WinFNT_Header + * + * @description: + * Retrieve a Windows FNT font info header. + * + * @input: + * face :: A handle to the input face. + * + * @output: + * aheader :: The WinFNT header. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function only works with Windows FNT faces, returning an error + * otherwise. + */ + FT_EXPORT( FT_Error ) + FT_Get_WinFNT_Header( FT_Face face, + FT_WinFNT_HeaderRec *aheader ); + + + /* */ + +FT_END_HEADER + +#endif /* __FTWINFNT_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ftxf86.h b/extlibs/headers/freetype/ftxf86.h new file mode 100644 index 00000000..3362883c --- /dev/null +++ b/extlibs/headers/freetype/ftxf86.h @@ -0,0 +1,60 @@ +/***************************************************************************/ +/* */ +/* ftxf86.h */ +/* */ +/* Support functions for X11. */ +/* */ +/* Copyright 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTXF86_H__ +#define __FTXF86_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /* this comment is intentionally disabled for now, to prevent this */ + /* function from appearing in the API Reference. */ + + /*@***********************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_X11_Font_Format */ + /* */ + /* <Description> */ + /* Return a string describing the format of a given face as an X11 */ + /* FONT_PROPERTY. It should only be used by the FreeType 2 font */ + /* backend of the XFree86 font server. */ + /* */ + /* <Input> */ + /* face :: Input face handle. */ + /* */ + /* <Return> */ + /* Font format string. NULL in case of error. */ + /* */ + FT_EXPORT( const char* ) + FT_Get_X11_Font_Format( FT_Face face ); + + /* */ + +FT_END_HEADER + +#endif /* __FTXF86_H__ */ diff --git a/extlibs/headers/freetype/internal/autohint.h b/extlibs/headers/freetype/internal/autohint.h new file mode 100644 index 00000000..22340afc --- /dev/null +++ b/extlibs/headers/freetype/internal/autohint.h @@ -0,0 +1,205 @@ +/***************************************************************************/ +/* */ +/* autohint.h */ +/* */ +/* High-level `autohint' module-specific interface (specification). */ +/* */ +/* Copyright 1996-2001, 2002 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* The auto-hinter is used to load and automatically hint glyphs if a */ + /* format-specific hinter isn't available. */ + /* */ + /*************************************************************************/ + + +#ifndef __AUTOHINT_H__ +#define __AUTOHINT_H__ + + + /*************************************************************************/ + /* */ + /* A small technical note regarding automatic hinting in order to */ + /* clarify this module interface. */ + /* */ + /* An automatic hinter might compute two kinds of data for a given face: */ + /* */ + /* - global hints: Usually some metrics that describe global properties */ + /* of the face. It is computed by scanning more or less */ + /* agressively the glyphs in the face, and thus can be */ + /* very slow to compute (even if the size of global */ + /* hints is really small). */ + /* */ + /* - glyph hints: These describe some important features of the glyph */ + /* outline, as well as how to align them. They are */ + /* generally much faster to compute than global hints. */ + /* */ + /* The current FreeType auto-hinter does a pretty good job while */ + /* performing fast computations for both global and glyph hints. */ + /* However, we might be interested in introducing more complex and */ + /* powerful algorithms in the future, like the one described in the John */ + /* D. Hobby paper, which unfortunately requires a lot more horsepower. */ + /* */ + /* Because a sufficiently sophisticated font management system would */ + /* typically implement an LRU cache of opened face objects to reduce */ + /* memory usage, it is a good idea to be able to avoid recomputing */ + /* global hints every time the same face is re-opened. */ + /* */ + /* We thus provide the ability to cache global hints outside of the face */ + /* object, in order to speed up font re-opening time. Of course, this */ + /* feature is purely optional, so most client programs won't even notice */ + /* it. */ + /* */ + /* I initially thought that it would be a good idea to cache the glyph */ + /* hints too. However, my general idea now is that if you really need */ + /* to cache these too, you are simply in need of a new font format, */ + /* where all this information could be stored within the font file and */ + /* decoded on the fly. */ + /* */ + /*************************************************************************/ + + +#include <ft2build.h> +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + typedef struct FT_AutoHinterRec_ *FT_AutoHinter; + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_AutoHinter_GlobalGetFunc */ + /* */ + /* <Description> */ + /* Retrieves the global hints computed for a given face object the */ + /* resulting data is dissociated from the face and will survive a */ + /* call to FT_Done_Face(). It must be discarded through the API */ + /* FT_AutoHinter_GlobalDoneFunc(). */ + /* */ + /* <Input> */ + /* hinter :: A handle to the source auto-hinter. */ + /* */ + /* face :: A handle to the source face object. */ + /* */ + /* <Output> */ + /* global_hints :: A typeless pointer to the global hints. */ + /* */ + /* global_len :: The size in bytes of the global hints. */ + /* */ + typedef void + (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter, + FT_Face face, + void** global_hints, + long* global_len ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_AutoHinter_GlobalDoneFunc */ + /* */ + /* <Description> */ + /* Discards the global hints retrieved through */ + /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */ + /* are freed from memory. */ + /* */ + /* <Input> */ + /* hinter :: A handle to the auto-hinter module. */ + /* */ + /* global :: A pointer to retrieved global hints to discard. */ + /* */ + typedef void + (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter, + void* global ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_AutoHinter_GlobalResetFunc */ + /* */ + /* <Description> */ + /* This function is used to recompute the global metrics in a given */ + /* font. This is useful when global font data changes (e.g. Multiple */ + /* Masters fonts where blend coordinates change). */ + /* */ + /* <Input> */ + /* hinter :: A handle to the source auto-hinter. */ + /* */ + /* face :: A handle to the face. */ + /* */ + typedef void + (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter, + FT_Face face ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* FT_AutoHinter_GlyphLoadFunc */ + /* */ + /* <Description> */ + /* This function is used to load, scale, and automatically hint a */ + /* glyph from a given face. */ + /* */ + /* <Input> */ + /* face :: A handle to the face. */ + /* */ + /* glyph_index :: The glyph index. */ + /* */ + /* load_flags :: The load flags. */ + /* */ + /* <Note> */ + /* This function is capable of loading composite glyphs by hinting */ + /* each sub-glyph independently (which improves quality). */ + /* */ + /* It will call the font driver with FT_Load_Glyph(), with */ + /* FT_LOAD_NO_SCALE set. */ + /* */ + typedef FT_Error + (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter, + FT_GlyphSlot slot, + FT_Size size, + FT_UInt glyph_index, + FT_Int32 load_flags ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_AutoHinter_ServiceRec */ + /* */ + /* <Description> */ + /* The auto-hinter module's interface. */ + /* */ + typedef struct FT_AutoHinter_ServiceRec_ + { + FT_AutoHinter_GlobalResetFunc reset_face; + FT_AutoHinter_GlobalGetFunc get_global_hints; + FT_AutoHinter_GlobalDoneFunc done_global_hints; + FT_AutoHinter_GlyphLoadFunc load_glyph; + + } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service; + + +FT_END_HEADER + +#endif /* __AUTOHINT_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftcalc.h b/extlibs/headers/freetype/internal/ftcalc.h new file mode 100644 index 00000000..0df502c7 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftcalc.h @@ -0,0 +1,128 @@ +/***************************************************************************/ +/* */ +/* ftcalc.h */ +/* */ +/* Arithmetic computations (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCALC_H__ +#define __FTCALC_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_FixedSqrt */ + /* */ + /* <Description> */ + /* Computes the square root of a 16.16 fixed point value. */ + /* */ + /* <Input> */ + /* x :: The value to compute the root for. */ + /* */ + /* <Return> */ + /* The result of `sqrt(x)'. */ + /* */ + /* <Note> */ + /* This function is not very fast. */ + /* */ + FT_EXPORT( FT_Int32 ) + FT_SqrtFixed( FT_Int32 x ); + + +#define SQRT_32( x ) FT_Sqrt32( x ) + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Sqrt32 */ + /* */ + /* <Description> */ + /* Computes the square root of an Int32 integer (which will be */ + /* handled as an unsigned long value). */ + /* */ + /* <Input> */ + /* x :: The value to compute the root for. */ + /* */ + /* <Return> */ + /* The result of `sqrt(x)'. */ + /* */ + FT_EXPORT( FT_Int32 ) + FT_Sqrt32( FT_Int32 x ); + + + /*************************************************************************/ + /* */ + /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */ + /* */ + /*************************************************************************/ + + +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_MulDiv_No_Round */ + /* */ + /* <Description> */ + /* A very simple function used to perform the computation `(a*b)/c' */ + /* (without rounding) with maximal accuracy (it uses a 64-bit */ + /* intermediate integer whenever necessary). */ + /* */ + /* This function isn't necessarily as fast as some processor specific */ + /* operations, but is at least completely portable. */ + /* */ + /* <Input> */ + /* a :: The first multiplier. */ + /* b :: The second multiplier. */ + /* c :: The divisor. */ + /* */ + /* <Return> */ + /* The result of `(a*b)/c'. This function never traps when trying to */ + /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ + /* on the signs of `a' and `b'. */ + /* */ + FT_BASE( FT_Long ) + FT_MulDiv_No_Round( FT_Long a, + FT_Long b, + FT_Long c ); + +#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ + + +#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) +#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) +#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) +#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) +#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) + +#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ + : ( -( ( 32 - (x) ) & -64 ) ) ) + + +FT_END_HEADER + +#endif /* __FTCALC_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftdebug.h b/extlibs/headers/freetype/internal/ftdebug.h new file mode 100644 index 00000000..ce142c54 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftdebug.h @@ -0,0 +1,244 @@ +/***************************************************************************/ +/* */ +/* ftdebug.h */ +/* */ +/* Debugging and logging component (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/* */ +/* IMPORTANT: A description of FreeType's debugging support can be */ +/* found in "docs/DEBUG.TXT". Read it if you need to use or */ +/* understand this code. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTDEBUG_H__ +#define __FTDEBUG_H__ + + +#include <ft2build.h> +#include FT_CONFIG_CONFIG_H +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */ + /* is already defined; this simplifies the following #ifdefs */ + /* */ +#ifdef FT_DEBUG_LEVEL_TRACE +#undef FT_DEBUG_LEVEL_ERROR +#define FT_DEBUG_LEVEL_ERROR +#endif + + + /*************************************************************************/ + /* */ + /* Define the trace enums as well as the trace levels array when they */ + /* are needed. */ + /* */ + /*************************************************************************/ + +#ifdef FT_DEBUG_LEVEL_TRACE + +#define FT_TRACE_DEF( x ) trace_ ## x , + + /* defining the enumeration */ + typedef enum + { +#include FT_INTERNAL_TRACE_H + trace_count + + } FT_Trace; + + + /* defining the array of trace levels, provided by `src/base/ftdebug.c' */ + extern int ft_trace_levels[trace_count]; + +#undef FT_TRACE_DEF + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + + /*************************************************************************/ + /* */ + /* Define the FT_TRACE macro */ + /* */ + /* IMPORTANT! */ + /* */ + /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */ + /* value before using any TRACE macro. */ + /* */ + /*************************************************************************/ + +#ifdef FT_DEBUG_LEVEL_TRACE + +#define FT_TRACE( level, varformat ) \ + do \ + { \ + if ( ft_trace_levels[FT_COMPONENT] >= level ) \ + FT_Message varformat; \ + } while ( 0 ) + +#else /* !FT_DEBUG_LEVEL_TRACE */ + +#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */ + +#endif /* !FT_DEBUG_LEVEL_TRACE */ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Trace_Get_Count */ + /* */ + /* <Description> */ + /* Return the number of available trace components. */ + /* */ + /* <Return> */ + /* The number of trace components. 0 if FreeType 2 is not built with */ + /* FT_DEBUG_LEVEL_TRACE definition. */ + /* */ + /* <Note> */ + /* This function may be useful if you want to access elements of */ + /* the internal `ft_trace_levels' array by an index. */ + /* */ + FT_EXPORT( FT_Int ) + FT_Trace_Get_Count( void ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Trace_Get_Name */ + /* */ + /* <Description> */ + /* Return the name of a trace component. */ + /* */ + /* <Input> */ + /* The index of the trace component. */ + /* */ + /* <Return> */ + /* The name of the trace component. This is a statically allocated */ + /* C string, so do not free it after use. NULL if FreeType 2 is not */ + /* built with FT_DEBUG_LEVEL_TRACE definition. */ + /* */ + /* <Note> */ + /* Use @FT_Trace_Get_Count to get the number of available trace */ + /* components. */ + /* */ + /* This function may be useful if you want to control FreeType 2's */ + /* debug level in your appliaciton. */ + /* */ + FT_EXPORT( const char * ) + FT_Trace_Get_Name( FT_Int idx ); + + + /*************************************************************************/ + /* */ + /* You need two opening resp. closing parentheses! */ + /* */ + /* Example: FT_TRACE0(( "Value is %i", foo )) */ + /* */ + /*************************************************************************/ + +#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat ) +#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat ) +#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat ) +#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat ) +#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat ) +#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat ) +#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat ) +#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat ) + + + /*************************************************************************/ + /* */ + /* Define the FT_ERROR macro */ + /* */ + /*************************************************************************/ + +#ifdef FT_DEBUG_LEVEL_ERROR + +#define FT_ERROR( varformat ) FT_Message varformat + +#else /* !FT_DEBUG_LEVEL_ERROR */ + +#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */ + +#endif /* !FT_DEBUG_LEVEL_ERROR */ + + + /*************************************************************************/ + /* */ + /* Define the FT_ASSERT macro */ + /* */ + /*************************************************************************/ + +#ifdef FT_DEBUG_LEVEL_ERROR + +#define FT_ASSERT( condition ) \ + do \ + { \ + if ( !( condition ) ) \ + FT_Panic( "assertion failed on line %d of file %s\n", \ + __LINE__, __FILE__ ); \ + } while ( 0 ) + +#else /* !FT_DEBUG_LEVEL_ERROR */ + +#define FT_ASSERT( condition ) do ; while ( 0 ) + +#endif /* !FT_DEBUG_LEVEL_ERROR */ + + + /*************************************************************************/ + /* */ + /* Define 'FT_Message' and 'FT_Panic' when needed */ + /* */ + /*************************************************************************/ + +#ifdef FT_DEBUG_LEVEL_ERROR + +#include "stdio.h" /* for vprintf() */ + + /* print a message */ + FT_EXPORT( void ) + FT_Message( const char* fmt, ... ); + + /* print a message and exit */ + FT_EXPORT( void ) + FT_Panic( const char* fmt, ... ); + +#endif /* FT_DEBUG_LEVEL_ERROR */ + + + FT_BASE( void ) + ft_debug_init( void ); + + +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + + /* we disable the warning `conditional expression is constant' here */ + /* in order to compile cleanly with the maximum level of warnings */ +#pragma warning( disable : 4127 ) + +#endif /* _MSC_VER */ + + +FT_END_HEADER + +#endif /* __FTDEBUG_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftdriver.h b/extlibs/headers/freetype/internal/ftdriver.h new file mode 100644 index 00000000..02f585d6 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftdriver.h @@ -0,0 +1,206 @@ +/***************************************************************************/ +/* */ +/* ftdriver.h */ +/* */ +/* FreeType font driver interface (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTDRIVER_H__ +#define __FTDRIVER_H__ + + +#include <ft2build.h> +#include FT_MODULE_H + + +FT_BEGIN_HEADER + + + typedef FT_Error + (*FT_Face_InitFunc)( FT_Stream stream, + FT_Face face, + FT_Int typeface_index, + FT_Int num_params, + FT_Parameter* parameters ); + + typedef void + (*FT_Face_DoneFunc)( FT_Face face ); + + + typedef FT_Error + (*FT_Size_InitFunc)( FT_Size size ); + + typedef void + (*FT_Size_DoneFunc)( FT_Size size ); + + + typedef FT_Error + (*FT_Slot_InitFunc)( FT_GlyphSlot slot ); + + typedef void + (*FT_Slot_DoneFunc)( FT_GlyphSlot slot ); + + + typedef FT_Error + (*FT_Size_ResetPointsFunc)( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); + + typedef FT_Error + (*FT_Size_ResetPixelsFunc)( FT_Size size, + FT_UInt pixel_width, + FT_UInt pixel_height ); + + typedef FT_Error + (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, + FT_Size size, + FT_UInt glyph_index, + FT_Int32 load_flags ); + + + typedef FT_UInt + (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap, + FT_Long charcode ); + + typedef FT_Long + (*FT_CharMap_CharNextFunc)( FT_CharMap charmap, + FT_Long charcode ); + + typedef FT_Error + (*FT_Face_GetKerningFunc)( FT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_Vector* kerning ); + + + typedef FT_Error + (*FT_Face_AttachFunc)( FT_Face face, + FT_Stream stream ); + + + typedef FT_Error + (*FT_Face_GetAdvancesFunc)( FT_Face face, + FT_UInt first, + FT_UInt count, + FT_Bool vertical, + FT_UShort* advances ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Driver_ClassRec */ + /* */ + /* <Description> */ + /* The font driver class. This structure mostly contains pointers to */ + /* driver methods. */ + /* */ + /* <Fields> */ + /* root :: The parent module. */ + /* */ + /* face_object_size :: The size of a face object in bytes. */ + /* */ + /* size_object_size :: The size of a size object in bytes. */ + /* */ + /* slot_object_size :: The size of a glyph object in bytes. */ + /* */ + /* init_face :: The format-specific face constructor. */ + /* */ + /* done_face :: The format-specific face destructor. */ + /* */ + /* init_size :: The format-specific size constructor. */ + /* */ + /* done_size :: The format-specific size destructor. */ + /* */ + /* init_slot :: The format-specific slot constructor. */ + /* */ + /* done_slot :: The format-specific slot destructor. */ + /* */ + /* set_char_sizes :: A handle to a function used to set the new */ + /* character size in points + resolution. Can be */ + /* set to 0 to indicate default behaviour. */ + /* */ + /* set_pixel_sizes :: A handle to a function used to set the new */ + /* character size in pixels. Can be set to 0 to */ + /* indicate default behaviour. */ + /* */ + /* load_glyph :: A function handle to load a given glyph image */ + /* in a slot. This field is mandatory! */ + /* */ + /* get_char_index :: A function handle to return the glyph index of */ + /* a given character for a given charmap. This */ + /* field is mandatory! */ + /* */ + /* get_kerning :: A function handle to return the unscaled */ + /* kerning for a given pair of glyphs. Can be */ + /* set to 0 if the format doesn't support */ + /* kerning. */ + /* */ + /* attach_file :: This function handle is used to read */ + /* additional data for a face from another */ + /* file/stream. For example, this can be used to */ + /* add data from AFM or PFM files on a Type 1 */ + /* face, or a CIDMap on a CID-keyed face. */ + /* */ + /* get_advances :: A function handle used to return advance */ + /* widths of 'count' glyphs (in font units), */ + /* starting at `first'. The `vertical' flag must */ + /* be set to get vertical advance heights. The */ + /* `advances' buffer is caller-allocated. */ + /* Currently not implemented. The idea of this */ + /* function is to be able to perform */ + /* device-independent text layout without loading */ + /* a single glyph image. */ + /* */ + /* <Note> */ + /* Most function pointers, with the exception of `load_glyph' and */ + /* `get_char_index' can be set to 0 to indicate a default behaviour. */ + /* */ + typedef struct FT_Driver_ClassRec_ + { + FT_Module_Class root; + + FT_Long face_object_size; + FT_Long size_object_size; + FT_Long slot_object_size; + + FT_Face_InitFunc init_face; + FT_Face_DoneFunc done_face; + + FT_Size_InitFunc init_size; + FT_Size_DoneFunc done_size; + + FT_Slot_InitFunc init_slot; + FT_Slot_DoneFunc done_slot; + + FT_Size_ResetPointsFunc set_char_sizes; + FT_Size_ResetPixelsFunc set_pixel_sizes; + + FT_Slot_LoadFunc load_glyph; + + FT_Face_GetKerningFunc get_kerning; + FT_Face_AttachFunc attach_file; + FT_Face_GetAdvancesFunc get_advances; + + } FT_Driver_ClassRec, *FT_Driver_Class; + + +FT_END_HEADER + +#endif /* __FTDRIVER_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftgloadr.h b/extlibs/headers/freetype/internal/ftgloadr.h new file mode 100644 index 00000000..abc56e25 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftgloadr.h @@ -0,0 +1,147 @@ +/***************************************************************************/ +/* */ +/* ftgloadr.h */ +/* */ +/* The FreeType glyph loader (specification). */ +/* */ +/* Copyright 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTGLOADR_H__ +#define __FTGLOADR_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_GlyphLoader */ + /* */ + /* <Description> */ + /* The glyph loader is an internal object used to load several glyphs */ + /* together (for example, in the case of composites). */ + /* */ + /* <Note> */ + /* The glyph loader implementation is not part of the high-level API, */ + /* hence the forward structure declaration. */ + /* */ + typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ; + + +#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 +#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 +#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 +#define FT_SUBGLYPH_FLAG_SCALE 8 +#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 +#define FT_SUBGLYPH_FLAG_2X2 0x80 +#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 + + + typedef struct FT_SubGlyphRec_ + { + FT_Int index; + FT_UShort flags; + FT_Int arg1; + FT_Int arg2; + FT_Matrix transform; + + } FT_SubGlyphRec; + + + typedef struct FT_GlyphLoadRec_ + { + FT_Outline outline; /* outline */ + FT_Vector* extra_points; /* extra points table */ + FT_UInt num_subglyphs; /* number of subglyphs */ + FT_SubGlyph subglyphs; /* subglyphs */ + + } FT_GlyphLoadRec, *FT_GlyphLoad; + + + typedef struct FT_GlyphLoaderRec_ + { + FT_Memory memory; + FT_UInt max_points; + FT_UInt max_contours; + FT_UInt max_subglyphs; + FT_Bool use_extra; + + FT_GlyphLoadRec base; + FT_GlyphLoadRec current; + + void* other; /* for possible future extension? */ + + } FT_GlyphLoaderRec; + + + /* create new empty glyph loader */ + FT_BASE( FT_Error ) + FT_GlyphLoader_New( FT_Memory memory, + FT_GlyphLoader *aloader ); + + /* add an extra points table to a glyph loader */ + FT_BASE( FT_Error ) + FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader ); + + /* destroy a glyph loader */ + FT_BASE( void ) + FT_GlyphLoader_Done( FT_GlyphLoader loader ); + + /* reset a glyph loader (frees everything int it) */ + FT_BASE( void ) + FT_GlyphLoader_Reset( FT_GlyphLoader loader ); + + /* rewind a glyph loader */ + FT_BASE( void ) + FT_GlyphLoader_Rewind( FT_GlyphLoader loader ); + + /* check that there is enough space to add `n_points' and `n_contours' */ + /* to the glyph loader */ + FT_BASE( FT_Error ) + FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader, + FT_UInt n_points, + FT_UInt n_contours ); + + /* check that there is enough space to add `n_subs' sub-glyphs to */ + /* a glyph loader */ + FT_BASE( FT_Error ) + FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader, + FT_UInt n_subs ); + + /* prepare a glyph loader, i.e. empty the current glyph */ + FT_BASE( void ) + FT_GlyphLoader_Prepare( FT_GlyphLoader loader ); + + /* add the current glyph to the base glyph */ + FT_BASE( void ) + FT_GlyphLoader_Add( FT_GlyphLoader loader ); + + /* copy points from one glyph loader to another */ + FT_BASE( FT_Error ) + FT_GlyphLoader_CopyPoints( FT_GlyphLoader target, + FT_GlyphLoader source ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTGLOADR_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftmemory.h b/extlibs/headers/freetype/internal/ftmemory.h new file mode 100644 index 00000000..d93a0779 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftmemory.h @@ -0,0 +1,445 @@ +/***************************************************************************/ +/* */ +/* ftmemory.h */ +/* */ +/* The FreeType memory management macros (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMEMORY_H__ +#define __FTMEMORY_H__ + + +#include <ft2build.h> +#include FT_CONFIG_CONFIG_H +#include FT_TYPES_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Macro> */ + /* FT_SET_ERROR */ + /* */ + /* <Description> */ + /* This macro is used to set an implicit `error' variable to a given */ + /* expression's value (usually a function call), and convert it to a */ + /* boolean which is set whenever the value is != 0. */ + /* */ +#undef FT_SET_ERROR +#define FT_SET_ERROR( expression ) \ + ( ( error = (expression) ) != 0 ) + + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** M E M O R Y ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + +#ifdef FT_DEBUG_MEMORY + + FT_BASE( FT_Error ) + FT_Alloc_Debug( FT_Memory memory, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); + + FT_BASE( FT_Error ) + FT_QAlloc_Debug( FT_Memory memory, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); + + FT_BASE( FT_Error ) + FT_Realloc_Debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); + + FT_BASE( FT_Error ) + FT_QRealloc_Debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); + + FT_BASE( void ) + FT_Free_Debug( FT_Memory memory, + FT_Pointer block, + const char* file_name, + FT_Long line_no ); + +#endif + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Alloc */ + /* */ + /* <Description> */ + /* Allocates a new block of memory. The returned area is always */ + /* zero-filled; this is a strong convention in many FreeType parts. */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* allocation. */ + /* */ + /* size :: The size in bytes of the block to allocate. */ + /* */ + /* <Output> */ + /* P :: A pointer to the fresh new block. It should be set to */ + /* NULL if `size' is 0, or in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_BASE( FT_Error ) + FT_Alloc( FT_Memory memory, + FT_Long size, + void* *P ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_QAlloc */ + /* */ + /* <Description> */ + /* Allocates a new block of memory. The returned area is *not* */ + /* zero-filled, making allocation quicker. */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* allocation. */ + /* */ + /* size :: The size in bytes of the block to allocate. */ + /* */ + /* <Output> */ + /* P :: A pointer to the fresh new block. It should be set to */ + /* NULL if `size' is 0, or in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_BASE( FT_Error ) + FT_QAlloc( FT_Memory memory, + FT_Long size, + void* *p ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Realloc */ + /* */ + /* <Description> */ + /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ + /* from the heap, possibly changing `*P'. The returned area is */ + /* zero-filled. */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* reallocation. */ + /* */ + /* current :: The current block size in bytes. */ + /* */ + /* size :: The new block size in bytes. */ + /* */ + /* <InOut> */ + /* P :: A pointer to the fresh new block. It should be set to */ + /* NULL if `size' is 0, or in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* All callers of FT_Realloc() _must_ provide the current block size */ + /* as well as the new one. */ + /* */ + FT_BASE( FT_Error ) + FT_Realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_QRealloc */ + /* */ + /* <Description> */ + /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ + /* from the heap, possibly changing `*P'. The returned area is *not* */ + /* zero-filled, making reallocation quicker. */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* reallocation. */ + /* */ + /* current :: The current block size in bytes. */ + /* */ + /* size :: The new block size in bytes. */ + /* */ + /* <InOut> */ + /* P :: A pointer to the fresh new block. It should be set to */ + /* NULL if `size' is 0, or in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* All callers of FT_Realloc() _must_ provide the current block size */ + /* as well as the new one. */ + /* */ + FT_BASE( FT_Error ) + FT_QRealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *p ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Free */ + /* */ + /* <Description> */ + /* Releases a given block of memory allocated through FT_Alloc(). */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* memory deallocation */ + /* */ + /* P :: This is the _address_ of a _pointer_ which points to the */ + /* allocated block. It is always set to NULL on exit. */ + /* */ + /* <Note> */ + /* If P or *P is NULL, this function should return successfully. */ + /* This is a strong convention within all of FreeType and its */ + /* drivers. */ + /* */ + FT_BASE( void ) + FT_Free( FT_Memory memory, + void* *P ); + + +#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count ) + +#define FT_MEM_COPY( dest, source, count ) ft_memcpy( dest, source, count ) + +#define FT_MEM_MOVE( dest, source, count ) ft_memmove( dest, source, count ) + + +#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count ) + +#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) ) + +#define FT_ARRAY_ZERO( dest, count ) \ + FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) ) + +#define FT_ARRAY_COPY( dest, source, count ) \ + FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) ) + +#define FT_ARRAY_MOVE( dest, source, count ) \ + FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) ) + + + /* + * Return the maximum number of adressable elements in an array. + * We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid + * any problems. + */ +#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) ) + +#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) ) + + + /*************************************************************************/ + /* */ + /* We first define FT_MEM_ALLOC, FT_MEM_REALLOC, and FT_MEM_FREE. All */ + /* macros use an _implicit_ `memory' parameter to access the current */ + /* memory allocator. */ + /* */ + +#ifdef FT_DEBUG_MEMORY + +#define FT_MEM_ALLOC( _pointer_, _size_ ) \ + FT_Alloc_Debug( memory, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + +#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ + FT_Realloc_Debug( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + +#define FT_MEM_QALLOC( _pointer_, _size_ ) \ + FT_QAlloc_Debug( memory, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + +#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_QRealloc_Debug( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + +#define FT_MEM_FREE( _pointer_ ) \ + FT_Free_Debug( memory, (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + + +#else /* !FT_DEBUG_MEMORY */ + + +#define FT_MEM_ALLOC( _pointer_, _size_ ) \ + FT_Alloc( memory, _size_, \ + (void**)(void*)&(_pointer_) ) + +#define FT_MEM_FREE( _pointer_ ) \ + FT_Free( memory, \ + (void**)(void*)&(_pointer_) ) + +#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ + FT_Realloc( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_) ) + +#define FT_MEM_QALLOC( _pointer_, _size_ ) \ + FT_QAlloc( memory, _size_, \ + (void**)(void*)&(_pointer_) ) + +#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_QRealloc( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_) ) + +#endif /* !FT_DEBUG_MEMORY */ + + + /*************************************************************************/ + /* */ + /* The following functions macros expect that their pointer argument is */ + /* _typed_ in order to automatically compute array element sizes. */ + /* */ + +#define FT_MEM_NEW( _pointer_ ) \ + FT_MEM_ALLOC( _pointer_, sizeof ( *(_pointer_) ) ) + +#define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \ + FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( *(_pointer_) ) ) + +#define FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \ + (_new_) * sizeof ( *(_pointer_) ) ) + +#define FT_MEM_QNEW( _pointer_ ) \ + FT_MEM_QALLOC( _pointer_, sizeof ( *(_pointer_) ) ) + +#define FT_MEM_QNEW_ARRAY( _pointer_, _count_ ) \ + FT_MEM_QALLOC( _pointer_, (_count_) * sizeof ( *(_pointer_) ) ) + +#define FT_MEM_QRENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_MEM_QREALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \ + (_new_) * sizeof ( *(_pointer_) ) ) + + + /*************************************************************************/ + /* */ + /* the following macros are obsolete but kept for compatibility reasons */ + /* */ + +#define FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ + FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) ) + +#define FT_MEM_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ + FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( _type ), \ + (_new_) * sizeof ( _type_ ) ) + + + /*************************************************************************/ + /* */ + /* The following macros are variants of their FT_MEM_XXXX equivalents; */ + /* they are used to set an _implicit_ `error' variable and return TRUE */ + /* if an error occured (i.e. if 'error != 0'). */ + /* */ + +#define FT_ALLOC( _pointer_, _size_ ) \ + FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) ) + +#define FT_REALLOC( _pointer_, _current_, _size_ ) \ + FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, _current_, _size_ ) ) + +#define FT_QALLOC( _pointer_, _size_ ) \ + FT_SET_ERROR( FT_MEM_QALLOC( _pointer_, _size_ ) ) + +#define FT_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_SET_ERROR( FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) ) + + +#define FT_FREE( _pointer_ ) \ + FT_MEM_FREE( _pointer_ ) + + +#define FT_NEW( _pointer_ ) \ + FT_ALLOC( _pointer_, sizeof ( *(_pointer_) ) ) + +#define FT_NEW_ARRAY( _pointer_, _count_ ) \ + FT_ALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_count_) ) + +#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_REALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_old_), \ + sizeof ( *(_pointer_) ) * (_new_) ) + +#define FT_QNEW( _pointer_ ) \ + FT_QALLOC( _pointer_, sizeof ( *(_pointer_) ) ) + +#define FT_QNEW_ARRAY( _pointer_, _count_ ) \ + FT_QALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_count_) ) + +#define FT_QRENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_QREALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_old_), \ + sizeof ( *(_pointer_) ) * (_new_) ) + + +#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ + FT_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) ) + +#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ + FT_REALLOC( _pointer, (_old_) * sizeof ( _type_ ), \ + (_new_) * sizeof ( _type_ ) ) + + + /* */ + + +FT_END_HEADER + +#endif /* __FTMEMORY_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftobjs.h b/extlibs/headers/freetype/internal/ftobjs.h new file mode 100644 index 00000000..e8e3ee79 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftobjs.h @@ -0,0 +1,749 @@ +/***************************************************************************/ +/* */ +/* ftobjs.h */ +/* */ +/* The FreeType private base classes (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file contains the definition of all internal FreeType classes. */ + /* */ + /*************************************************************************/ + + +#ifndef __FTOBJS_H__ +#define __FTOBJS_H__ + +#include <ft2build.h> +#include FT_RENDER_H +#include FT_SIZES_H +#include FT_INTERNAL_MEMORY_H +#include FT_INTERNAL_GLYPH_LOADER_H +#include FT_INTERNAL_DRIVER_H +#include FT_INTERNAL_AUTOHINT_H +#include FT_INTERNAL_SERVICE_H + +#ifdef FT_CONFIG_OPTION_INCREMENTAL +#include FT_INCREMENTAL_H +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* Some generic definitions. */ + /* */ +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef NULL +#define NULL (void*)0 +#endif + + + /*************************************************************************/ + /* */ + /* The min and max functions missing in C. As usual, be careful not to */ + /* write things like FT_MIN( a++, b++ ) to avoid side effects. */ + /* */ +#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) ) +#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) + +#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) + + +#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) +#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) +#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n ) + +#define FT_PIX_FLOOR( x ) ( (x) & ~63 ) +#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 ) +#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) + + + /* + * Return the highest power of 2 that is <= value; this correspond to + * the highest bit in a given 32-bit value. + */ + FT_BASE( FT_UInt32 ) + ft_highpow2( FT_UInt32 value ); + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** C H A R M A P S ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /* handle to internal charmap object */ + typedef struct FT_CMapRec_* FT_CMap; + + /* handle to charmap class structure */ + typedef const struct FT_CMap_ClassRec_* FT_CMap_Class; + + /* internal charmap object structure */ + typedef struct FT_CMapRec_ + { + FT_CharMapRec charmap; + FT_CMap_Class clazz; + + } FT_CMapRec; + + /* typecase any pointer to a charmap handle */ +#define FT_CMAP( x ) ((FT_CMap)( x )) + + /* obvious macros */ +#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id +#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id +#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding +#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face + + + /* class method definitions */ + typedef FT_Error + (*FT_CMap_InitFunc)( FT_CMap cmap, + FT_Pointer init_data ); + + typedef void + (*FT_CMap_DoneFunc)( FT_CMap cmap ); + + typedef FT_UInt + (*FT_CMap_CharIndexFunc)( FT_CMap cmap, + FT_UInt32 char_code ); + + typedef FT_UInt + (*FT_CMap_CharNextFunc)( FT_CMap cmap, + FT_UInt32 *achar_code ); + + + typedef struct FT_CMap_ClassRec_ + { + FT_ULong size; + FT_CMap_InitFunc init; + FT_CMap_DoneFunc done; + FT_CMap_CharIndexFunc char_index; + FT_CMap_CharNextFunc char_next; + + } FT_CMap_ClassRec; + + + /* create a new charmap and add it to charmap->face */ + FT_BASE( FT_Error ) + FT_CMap_New( FT_CMap_Class clazz, + FT_Pointer init_data, + FT_CharMap charmap, + FT_CMap *acmap ); + + /* destroy a charmap and remove it from face's list */ + FT_BASE( void ) + FT_CMap_Done( FT_CMap cmap ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Face_InternalRec */ + /* */ + /* <Description> */ + /* This structure contains the internal fields of each FT_Face */ + /* object. These fields may change between different releases of */ + /* FreeType. */ + /* */ + /* <Fields> */ + /* max_points :: */ + /* The maximal number of points used to store the vectorial outline */ + /* of any glyph in this face. If this value cannot be known in */ + /* advance, or if the face isn't scalable, this should be set to 0. */ + /* Only relevant for scalable formats. */ + /* */ + /* max_contours :: */ + /* The maximal number of contours used to store the vectorial */ + /* outline of any glyph in this face. If this value cannot be */ + /* known in advance, or if the face isn't scalable, this should be */ + /* set to 0. Only relevant for scalable formats. */ + /* */ + /* transform_matrix :: */ + /* A 2x2 matrix of 16.16 coefficients used to transform glyph */ + /* outlines after they are loaded from the font. Only used by the */ + /* convenience functions. */ + /* */ + /* transform_delta :: */ + /* A translation vector used to transform glyph outlines after they */ + /* are loaded from the font. Only used by the convenience */ + /* functions. */ + /* */ + /* transform_flags :: */ + /* Some flags used to classify the transform. Only used by the */ + /* convenience functions. */ + /* */ + /* services :: */ + /* A cache for frequently used services. It should be only */ + /* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */ + /* */ + /* incremental_interface :: */ + /* If non-null, the interface through which glyph data and metrics */ + /* are loaded incrementally for faces that do not provide all of */ + /* this data when first opened. This field exists only if */ + /* @FT_CONFIG_OPTION_INCREMENTAL is defined. */ + /* */ + typedef struct FT_Face_InternalRec_ + { + FT_UShort max_points; + FT_Short max_contours; + + FT_Matrix transform_matrix; + FT_Vector transform_delta; + FT_Int transform_flags; + + FT_ServiceCacheRec services; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + FT_Incremental_InterfaceRec* incremental_interface; +#endif + + } FT_Face_InternalRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Slot_InternalRec */ + /* */ + /* <Description> */ + /* This structure contains the internal fields of each FT_GlyphSlot */ + /* object. These fields may change between different releases of */ + /* FreeType. */ + /* */ + /* <Fields> */ + /* loader :: The glyph loader object used to load outlines */ + /* into the glyph slot. */ + /* */ + /* flags :: Possible values are zero or */ + /* FT_GLYPH_OWN_BITMAP. The latter indicates */ + /* that the FT_GlyphSlot structure owns the */ + /* bitmap buffer. */ + /* */ + /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */ + /* must be transformed through a specific */ + /* font transformation. This is _not_ the same */ + /* as the face transform set through */ + /* FT_Set_Transform(). */ + /* */ + /* glyph_matrix :: The 2x2 matrix corresponding to the glyph */ + /* transformation, if necessary. */ + /* */ + /* glyph_delta :: The 2d translation vector corresponding to */ + /* the glyph transformation, if necessary. */ + /* */ + /* glyph_hints :: Format-specific glyph hints management. */ + /* */ + +#define FT_GLYPH_OWN_BITMAP 0x1 + + typedef struct FT_Slot_InternalRec_ + { + FT_GlyphLoader loader; + FT_UInt flags; + FT_Bool glyph_transformed; + FT_Matrix glyph_matrix; + FT_Vector glyph_delta; + void* glyph_hints; + + } FT_GlyphSlot_InternalRec; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** M O D U L E S ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_ModuleRec */ + /* */ + /* <Description> */ + /* A module object instance. */ + /* */ + /* <Fields> */ + /* clazz :: A pointer to the module's class. */ + /* */ + /* library :: A handle to the parent library object. */ + /* */ + /* memory :: A handle to the memory manager. */ + /* */ + /* generic :: A generic structure for user-level extensibility (?). */ + /* */ + typedef struct FT_ModuleRec_ + { + FT_Module_Class* clazz; + FT_Library library; + FT_Memory memory; + FT_Generic generic; + + } FT_ModuleRec; + + + /* typecast an object to a FT_Module */ +#define FT_MODULE( x ) ((FT_Module)( x )) +#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz +#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library +#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory + + +#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_FONT_DRIVER ) + +#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_RENDERER ) + +#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_HINTER ) + +#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_STYLER ) + +#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_DRIVER_SCALABLE ) + +#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_DRIVER_NO_OUTLINES ) + +#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + FT_MODULE_DRIVER_HAS_HINTER ) + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Module_Interface */ + /* */ + /* <Description> */ + /* Finds a module and returns its specific interface as a typeless */ + /* pointer. */ + /* */ + /* <Input> */ + /* library :: A handle to the library object. */ + /* */ + /* module_name :: The module's name (as an ASCII string). */ + /* */ + /* <Return> */ + /* A module-specific interface if available, 0 otherwise. */ + /* */ + /* <Note> */ + /* You should better be familiar with FreeType internals to know */ + /* which module to look for, and what its interface is :-) */ + /* */ + FT_BASE( const void* ) + FT_Get_Module_Interface( FT_Library library, + const char* mod_name ); + + FT_BASE( FT_Pointer ) + ft_module_get_service( FT_Module module, + const char* service_id ); + + /* */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /* a few macros used to perform easy typecasts with minimal brain damage */ + +#define FT_FACE( x ) ((FT_Face)(x)) +#define FT_SIZE( x ) ((FT_Size)(x)) +#define FT_SLOT( x ) ((FT_GlyphSlot)(x)) + +#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver +#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library +#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory +#define FT_FACE_STREAM( x ) FT_FACE( x )->stream + +#define FT_SIZE_FACE( x ) FT_SIZE( x )->face +#define FT_SLOT_FACE( x ) FT_SLOT( x )->face + +#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph +#define FT_FACE_SIZE( x ) FT_FACE( x )->size + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_GlyphSlot */ + /* */ + /* <Description> */ + /* It is sometimes useful to have more than one glyph slot for a */ + /* given face object. This function is used to create additional */ + /* slots. All of them are automatically discarded when the face is */ + /* destroyed. */ + /* */ + /* <Input> */ + /* face :: A handle to a parent face object. */ + /* */ + /* <Output> */ + /* aslot :: A handle to a new glyph slot object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_BASE( FT_Error ) + FT_New_GlyphSlot( FT_Face face, + FT_GlyphSlot *aslot ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_GlyphSlot */ + /* */ + /* <Description> */ + /* Destroys a given glyph slot. Remember however that all slots are */ + /* automatically destroyed with its parent. Using this function is */ + /* not always mandatory. */ + /* */ + /* <Input> */ + /* slot :: A handle to a target glyph slot. */ + /* */ + FT_BASE( void ) + FT_Done_GlyphSlot( FT_GlyphSlot slot ); + + /* */ + + /* + * Free the bitmap of a given glyphslot when needed + * (i.e., only when it was allocated with ft_glyphslot_alloc_bitmap). + */ + FT_BASE( void ) + ft_glyphslot_free_bitmap( FT_GlyphSlot slot ); + + + /* + * Allocate a new bitmap buffer in a glyph slot. + */ + FT_BASE( FT_Error ) + ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot, + FT_ULong size ); + + + /* + * Set the bitmap buffer in a glyph slot to a given pointer. + * The buffer will not be freed by a later call to ft_glyphslot_free_bitmap. + */ + FT_BASE( void ) + ft_glyphslot_set_bitmap( FT_GlyphSlot slot, + FT_Byte* buffer ); + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** R E N D E R E R S ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#define FT_RENDERER( x ) ((FT_Renderer)( x )) +#define FT_GLYPH( x ) ((FT_Glyph)( x )) +#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) +#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) + + + typedef struct FT_RendererRec_ + { + FT_ModuleRec root; + FT_Renderer_Class* clazz; + FT_Glyph_Format glyph_format; + FT_Glyph_Class glyph_class; + + FT_Raster raster; + FT_Raster_Render_Func raster_render; + FT_Renderer_RenderFunc render; + + } FT_RendererRec; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** F O N T D R I V E R S ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /* typecast a module into a driver easily */ +#define FT_DRIVER( x ) ((FT_Driver)(x)) + + /* typecast a module as a driver, and get its driver class */ +#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_DriverRec */ + /* */ + /* <Description> */ + /* The root font driver class. A font driver is responsible for */ + /* managing and loading font files of a given format. */ + /* */ + /* <Fields> */ + /* root :: Contains the fields of the root module class. */ + /* */ + /* clazz :: A pointer to the font driver's class. Note that */ + /* this is NOT root.clazz. `class' wasn't used */ + /* as it is a reserved word in C++. */ + /* */ + /* faces_list :: The list of faces currently opened by this */ + /* driver. */ + /* */ + /* extensions :: A typeless pointer to the driver's extensions */ + /* registry, if they are supported through the */ + /* configuration macro FT_CONFIG_OPTION_EXTENSIONS. */ + /* */ + /* glyph_loader :: The glyph loader for all faces managed by this */ + /* driver. This object isn't defined for unscalable */ + /* formats. */ + /* */ + typedef struct FT_DriverRec_ + { + FT_ModuleRec root; + FT_Driver_Class clazz; + + FT_ListRec faces_list; + void* extensions; + + FT_GlyphLoader glyph_loader; + + } FT_DriverRec; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** L I B R A R I E S ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +/* this hook is used by the TrueType debugger. It must be set to an alternate + * truetype bytecode interpreter function + */ +#define FT_DEBUG_HOOK_TRUETYPE 0 + + +/* set this debug hook to a non-null pointer to force unpatented hinting + * for all faces when both TT_CONFIG_OPTION_BYTECODE_INTERPRETER and + * TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used + * during debugging + */ +#define FT_DEBUG_HOOK_UNPATENTED_HINTING 1 + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_LibraryRec */ + /* */ + /* <Description> */ + /* The FreeType library class. This is the root of all FreeType */ + /* data. Use FT_New_Library() to create a library object, and */ + /* FT_Done_Library() to discard it and all child objects. */ + /* */ + /* <Fields> */ + /* memory :: The library's memory object. Manages memory */ + /* allocation. */ + /* */ + /* generic :: Client data variable. Used to extend the */ + /* Library class by higher levels and clients. */ + /* */ + /* version_major :: The major version number of the library. */ + /* */ + /* version_minor :: The minor version number of the library. */ + /* */ + /* version_patch :: The current patch level of the library. */ + /* */ + /* num_modules :: The number of modules currently registered */ + /* within this library. This is set to 0 for new */ + /* libraries. New modules are added through the */ + /* FT_Add_Module() API function. */ + /* */ + /* modules :: A table used to store handles to the currently */ + /* registered modules. Note that each font driver */ + /* contains a list of its opened faces. */ + /* */ + /* renderers :: The list of renderers currently registered */ + /* within the library. */ + /* */ + /* cur_renderer :: The current outline renderer. This is a */ + /* shortcut used to avoid parsing the list on */ + /* each call to FT_Outline_Render(). It is a */ + /* handle to the current renderer for the */ + /* FT_GLYPH_FORMAT_OUTLINE format. */ + /* */ + /* auto_hinter :: XXX */ + /* */ + /* raster_pool :: The raster object's render pool. This can */ + /* ideally be changed dynamically at run-time. */ + /* */ + /* raster_pool_size :: The size of the render pool in bytes. */ + /* */ + /* debug_hooks :: XXX */ + /* */ + typedef struct FT_LibraryRec_ + { + FT_Memory memory; /* library's memory manager */ + + FT_Generic generic; + + FT_Int version_major; + FT_Int version_minor; + FT_Int version_patch; + + FT_UInt num_modules; + FT_Module modules[FT_MAX_MODULES]; /* module objects */ + + FT_ListRec renderers; /* list of renderers */ + FT_Renderer cur_renderer; /* current outline renderer */ + FT_Module auto_hinter; + + FT_Byte* raster_pool; /* scan-line conversion */ + /* render pool */ + FT_ULong raster_pool_size; /* size of render pool in bytes */ + + FT_DebugHook_Func debug_hooks[4]; + + } FT_LibraryRec; + + + FT_BASE( FT_Renderer ) + FT_Lookup_Renderer( FT_Library library, + FT_Glyph_Format format, + FT_ListNode* node ); + + FT_BASE( FT_Error ) + FT_Render_Glyph_Internal( FT_Library library, + FT_GlyphSlot slot, + FT_Render_Mode render_mode ); + + typedef const char* + (*FT_Face_GetPostscriptNameFunc)( FT_Face face ); + + typedef FT_Error + (*FT_Face_GetGlyphNameFunc)( FT_Face face, + FT_UInt glyph_index, + FT_Pointer buffer, + FT_UInt buffer_max ); + + typedef FT_UInt + (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face, + FT_String* glyph_name ); + + +#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_New_Memory */ + /* */ + /* <Description> */ + /* Creates a new memory object. */ + /* */ + /* <Return> */ + /* A pointer to the new memory object. 0 in case of error. */ + /* */ + FT_EXPORT( FT_Memory ) + FT_New_Memory( void ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Done_Memory */ + /* */ + /* <Description> */ + /* Discards memory manager. */ + /* */ + /* <Input> */ + /* memory :: A handle to the memory manager. */ + /* */ + FT_EXPORT( void ) + FT_Done_Memory( FT_Memory memory ); + +#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ + + + /* Define default raster's interface. The default raster is located in */ + /* `src/base/ftraster.c'. */ + /* */ + /* Client applications can register new rasters through the */ + /* FT_Set_Raster() API. */ + +#ifndef FT_NO_DEFAULT_RASTER + FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; +#endif + + +FT_END_HEADER + +#endif /* __FTOBJS_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftrfork.h b/extlibs/headers/freetype/internal/ftrfork.h new file mode 100644 index 00000000..e7b10024 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftrfork.h @@ -0,0 +1,184 @@ +/***************************************************************************/ +/* */ +/* ftrfork.h */ +/* */ +/* Embedded resource forks accessor (specification). */ +/* */ +/* Copyright 2004 by */ +/* Masatake YAMATO and Redhat K.K. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +/***************************************************************************/ +/* Development of the code in this file is support of */ +/* Information-technology Promotion Agency, Japan. */ +/***************************************************************************/ + + +#ifndef __FTRFORK_H__ +#define __FTRFORK_H__ + + +#include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H + + +FT_BEGIN_HEADER + + + /* Number of guessing rules supported in `FT_Raccess_Guess'. */ + /* Don't forget to increment the number if you add a new guessing rule. */ +#define FT_RACCESS_N_RULES 8 + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Raccess_Guess */ + /* */ + /* <Description> */ + /* Guess a file name and offset where the actual resource fork is */ + /* stored. The macro FT_RACCESS_N_RULES holds the number of */ + /* guessing rules; the guessed result for the Nth rule is */ + /* represented as a triplet: a new file name (new_names[N]), a file */ + /* offset (offsets[N]), and an error code (errors[N]). */ + /* */ + /* <Input> */ + /* library :: */ + /* A FreeType library instance. */ + /* */ + /* stream :: */ + /* A file stream containing the resource fork. */ + /* */ + /* base_name :: */ + /* The (base) file name of the resource fork used for some */ + /* guessing rules. */ + /* */ + /* <Output> */ + /* new_names :: */ + /* An array of guessed file names in which the resource forks may */ + /* exist. If `new_names[N]' is NULL, the guessed file name is */ + /* equal to `base_name'. */ + /* */ + /* offsets :: */ + /* An array of guessed file offsets. `offsets[N]' holds the file */ + /* offset of the possible start of the resource fork in file */ + /* `new_names[N]'. */ + /* */ + /* errors :: */ + /* An array of FreeType error codes. `errors[N]' is the error */ + /* code of Nth guessing rule function. If `errors[N]' is not */ + /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */ + /* */ + FT_BASE( void ) + FT_Raccess_Guess( FT_Library library, + FT_Stream stream, + char* base_name, + char** new_names, + FT_Long* offsets, + FT_Error* errors ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Raccess_Get_HeaderInfo */ + /* */ + /* <Description> */ + /* Get the information from the header of resource fork. The */ + /* information includes the file offset where the resource map */ + /* starts, and the file offset where the resource data starts. */ + /* `FT_Raccess_Get_DataOffsets' requires these two data. */ + /* */ + /* <Input> */ + /* library :: */ + /* A FreeType library instance. */ + /* */ + /* stream :: */ + /* A file stream containing the resource fork. */ + /* */ + /* rfork_offset :: */ + /* The file offset where the resource fork starts. */ + /* */ + /* <Output> */ + /* map_offset :: */ + /* The file offset where the resource map starts. */ + /* */ + /* rdata_pos :: */ + /* The file offset where the resource data starts. */ + /* */ + /* <Return> */ + /* FreeType error code. FT_Err_Ok means success. */ + /* */ + FT_BASE( FT_Error ) + FT_Raccess_Get_HeaderInfo( FT_Library library, + FT_Stream stream, + FT_Long rfork_offset, + FT_Long *map_offset, + FT_Long *rdata_pos ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Raccess_Get_DataOffsets */ + /* */ + /* <Description> */ + /* Get the data offsets for a tag in a resource fork. Offsets are */ + /* stored in an array because, in some cases, resources in a resource */ + /* fork have the same tag. */ + /* */ + /* <Input> */ + /* library :: */ + /* A FreeType library instance. */ + /* */ + /* stream :: */ + /* A file stream containing the resource fork. */ + /* */ + /* map_offset :: */ + /* The file offset where the resource map starts. */ + /* */ + /* rdata_pos :: */ + /* The file offset where the resource data starts. */ + /* */ + /* tag :: */ + /* The resource tag. */ + /* */ + /* <Output> */ + /* offsets :: */ + /* The stream offsets for the resource data specified by `tag'. */ + /* This array is allocated by the function, so you have to call */ + /* @FT_Free after use. */ + /* */ + /* count :: */ + /* The length of offsets array. */ + /* */ + /* <Return> */ + /* FreeType error code. FT_Err_Ok means success. */ + /* */ + /* <Note> */ + /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */ + /* value for `map_offset' and `rdata_pos'. */ + /* */ + FT_BASE( FT_Error ) + FT_Raccess_Get_DataOffsets( FT_Library library, + FT_Stream stream, + FT_Long map_offset, + FT_Long rdata_pos, + FT_Long tag, + FT_Long **offsets, + FT_Long *count ); + + +FT_END_HEADER + +#endif /* __FTRFORK_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftserv.h b/extlibs/headers/freetype/internal/ftserv.h new file mode 100644 index 00000000..0850f560 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftserv.h @@ -0,0 +1,323 @@ +/***************************************************************************/ +/* */ +/* ftserv.h */ +/* */ +/* The FreeType services (specification only). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + /*************************************************************************/ + /* */ + /* Each module can export one or more `services'. Each service is */ + /* identified by a constant string and modeled by a pointer; the latter */ + /* generally corresponds to a structure containing function pointers. */ + /* */ + /* Note that a service's data cannot be a mere function pointer because */ + /* in C it is possible that function pointers might be implemented */ + /* differently than data pointers (e.g. 48 bits instead of 32). */ + /* */ + /*************************************************************************/ + + +#ifndef __FTSERV_H__ +#define __FTSERV_H__ + + +FT_BEGIN_HEADER + +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + + /* we disable the warning `conditional expression is constant' here */ + /* in order to compile cleanly with the maximum level of warnings */ +#pragma warning( disable : 4127 ) + +#endif /* _MSC_VER */ + + /* + * @macro: + * FT_FACE_FIND_SERVICE + * + * @description: + * This macro is used to look up a service from a face's driver module. + * + * @input: + * face :: + * The source face handle. + * + * id :: + * A string describing the service as defined in the service's + * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to + * `multi-masters'). It is automatically prefixed with + * `FT_SERVICE_ID_'. + * + * @output: + * ptr :: + * A variable that receives the service pointer. Will be NULL + * if not found. + */ +#ifdef __cplusplus + +#define FT_FACE_FIND_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_ = NULL; \ + FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \ + \ + \ + if ( module->clazz->get_interface ) \ + _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ + *_pptr_ = _tmp_; \ + FT_END_STMNT + +#else /* !C++ */ + +#define FT_FACE_FIND_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_ = NULL; \ + \ + if ( module->clazz->get_interface ) \ + _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ + ptr = _tmp_; \ + FT_END_STMNT + +#endif /* !C++ */ + + /* + * @macro: + * FT_FACE_FIND_GLOBAL_SERVICE + * + * @description: + * This macro is used to look up a service from all modules. + * + * @input: + * face :: + * The source face handle. + * + * id :: + * A string describing the service as defined in the service's + * header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to + * `multi-masters'). It is automatically prefixed with + * `FT_SERVICE_ID_'. + * + * @output: + * ptr :: + * A variable that receives the service pointer. Will be NULL + * if not found. + */ +#ifdef __cplusplus + +#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_; \ + FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \ + \ + \ + _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ + *_pptr_ = _tmp_; \ + FT_END_STMNT + +#else /* !C++ */ + +#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_; \ + \ + \ + _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ + ptr = _tmp_; \ + FT_END_STMNT + +#endif /* !C++ */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** S E R V I C E D E S C R I P T O R S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* + * The following structure is used to _describe_ a given service + * to the library. This is useful to build simple static service lists. + */ + typedef struct FT_ServiceDescRec_ + { + const char* serv_id; /* service name */ + const void* serv_data; /* service pointer/data */ + + } FT_ServiceDescRec; + + typedef const FT_ServiceDescRec* FT_ServiceDesc; + + + /* + * Parse a list of FT_ServiceDescRec descriptors and look for + * a specific service by ID. Note that the last element in the + * array must be { NULL, NULL }, and that the function should + * return NULL if the service isn't available. + * + * This function can be used by modules to implement their + * `get_service' method. + */ + FT_BASE( FT_Pointer ) + ft_service_list_lookup( FT_ServiceDesc service_descriptors, + const char* service_id ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** S E R V I C E S C A C H E *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* + * This structure is used to store a cache for several frequently used + * services. It is the type of `face->internal->services'. You + * should only use FT_FACE_LOOKUP_SERVICE to access it. + * + * All fields should have the type FT_Pointer to relax compilation + * dependencies. We assume the developer isn't completely stupid. + * + * Each field must be named `service_XXXX' where `XXX' corresponds to + * the correct FT_SERVICE_ID_XXXX macro. See the definition of + * FT_FACE_LOOKUP_SERVICE below how this is implemented. + * + */ + typedef struct FT_ServiceCacheRec_ + { + FT_Pointer service_POSTSCRIPT_FONT_NAME; + FT_Pointer service_MULTI_MASTERS; + FT_Pointer service_GLYPH_DICT; + FT_Pointer service_PFR_METRICS; + FT_Pointer service_WINFNT; + + } FT_ServiceCacheRec, *FT_ServiceCache; + + + /* + * A magic number used within the services cache. + */ +#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)-2) /* magic number */ + + + /* + * @macro: + * FT_FACE_LOOKUP_SERVICE + * + * @description: + * This macro is used to lookup a service from a face's driver module + * using its cache. + * + * @input: + * face:: + * The source face handle containing the cache. + * + * field :: + * The field name in the cache. + * + * id :: + * The service ID. + * + * @output: + * ptr :: + * A variable receiving the service data. NULL if not available. + */ +#ifdef __cplusplus + +#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Pointer svc; \ + FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \ + \ + \ + svc = FT_FACE( face )->internal->services. service_ ## id; \ + if ( svc == FT_SERVICE_UNAVAILABLE ) \ + svc = NULL; \ + else if ( svc == NULL ) \ + { \ + FT_FACE_FIND_SERVICE( face, svc, id ); \ + \ + FT_FACE( face )->internal->services. service_ ## id = \ + (FT_Pointer)( svc != NULL ? svc \ + : FT_SERVICE_UNAVAILABLE ); \ + } \ + *Pptr = svc; \ + FT_END_STMNT + +#else /* !C++ */ + +#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Pointer svc; \ + \ + \ + svc = FT_FACE( face )->internal->services. service_ ## id; \ + if ( svc == FT_SERVICE_UNAVAILABLE ) \ + svc = NULL; \ + else if ( svc == NULL ) \ + { \ + FT_FACE_FIND_SERVICE( face, svc, id ); \ + \ + FT_FACE( face )->internal->services. service_ ## id = \ + (FT_Pointer)( svc != NULL ? svc \ + : FT_SERVICE_UNAVAILABLE ); \ + } \ + ptr = svc; \ + FT_END_STMNT + +#endif /* !C++ */ + + /* + * A macro used to define new service structure types. + */ + +#define FT_DEFINE_SERVICE( name ) \ + typedef struct FT_Service_ ## name ## Rec_ \ + FT_Service_ ## name ## Rec ; \ + typedef struct FT_Service_ ## name ## Rec_ \ + const * FT_Service_ ## name ; \ + struct FT_Service_ ## name ## Rec_ + + /* */ + + /* + * The header files containing the services. + */ + +#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h> +#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h> +#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h> +#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h> +#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h> +#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h> +#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h> +#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h> +#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h> +#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> +#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h> +#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h> + + /* */ + +FT_END_HEADER + +#endif /* __FTSERV_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftstream.h b/extlibs/headers/freetype/internal/ftstream.h new file mode 100644 index 00000000..1fa9db45 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftstream.h @@ -0,0 +1,536 @@ +/***************************************************************************/ +/* */ +/* ftstream.h */ +/* */ +/* Stream handling (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTSTREAM_H__ +#define __FTSTREAM_H__ + + +#include <ft2build.h> +#include FT_SYSTEM_H +#include FT_INTERNAL_OBJECTS_H + + +FT_BEGIN_HEADER + + + /* format of an 8-bit frame_op value: */ + /* */ + /* bit 76543210 */ + /* xxxxxxes */ + /* */ + /* s is set to 1 if the value is signed. */ + /* e is set to 1 if the value is little-endian. */ + /* xxx is a command. */ + +#define FT_FRAME_OP_SHIFT 2 +#define FT_FRAME_OP_SIGNED 1 +#define FT_FRAME_OP_LITTLE 2 +#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT ) + +#define FT_MAKE_FRAME_OP( command, little, sign ) \ + ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign ) + +#define FT_FRAME_OP_END 0 +#define FT_FRAME_OP_START 1 /* start a new frame */ +#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */ +#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */ +#define FT_FRAME_OP_LONG 4 /* read 4-byte value */ +#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */ +#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */ + + + typedef enum FT_Frame_Op_ + { + ft_frame_end = 0, + ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ), + + ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ), + ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ), + + ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ), + ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ), + ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ), + ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ), + + ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ), + ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ), + ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ), + ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ), + + ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ), + ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ), + ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ), + ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ), + + ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ), + ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 ) + + } FT_Frame_Op; + + + typedef struct FT_Frame_Field_ + { + FT_Byte value; + FT_Byte size; + FT_UShort offset; + + } FT_Frame_Field; + + + /* Construct an FT_Frame_Field out of a structure type and a field name. */ + /* The structure type must be set in the FT_STRUCTURE macro before */ + /* calling the FT_FRAME_START() macro. */ + /* */ +#define FT_FIELD_SIZE( f ) \ + (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f ) + +#define FT_FIELD_SIZE_DELTA( f ) \ + (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] ) + +#define FT_FIELD_OFFSET( f ) \ + (FT_UShort)( offsetof( FT_STRUCTURE, f ) ) + +#define FT_FRAME_FIELD( frame_op, field ) \ + { \ + frame_op, \ + FT_FIELD_SIZE( field ), \ + FT_FIELD_OFFSET( field ) \ + } + +#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 } + +#define FT_FRAME_START( size ) { ft_frame_start, 0, size } +#define FT_FRAME_END { ft_frame_end, 0, 0 } + +#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f ) +#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f ) +#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f ) +#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f ) +#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f ) +#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f ) +#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f ) +#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f ) + +#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f ) +#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f ) +#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f ) +#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f ) +#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f ) +#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f ) + +#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 } +#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 } +#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 } + +#define FT_FRAME_BYTES( field, count ) \ + { \ + ft_frame_bytes, \ + count, \ + FT_FIELD_OFFSET( field ) \ + } + +#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 } + + + /*************************************************************************/ + /* */ + /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */ + /* type `char*' or equivalent (1-byte elements). */ + /* */ + +#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] ) +#define FT_INT8_( p, i ) ( ((const FT_Char*)(p))[(i)] ) + +#define FT_INT16( x ) ( (FT_Int16)(x) ) +#define FT_UINT16( x ) ( (FT_UInt16)(x) ) +#define FT_INT32( x ) ( (FT_Int32)(x) ) +#define FT_UINT32( x ) ( (FT_UInt32)(x) ) + +#define FT_BYTE_I16( p, i, s ) ( FT_INT16( FT_BYTE_( p, i ) ) << (s) ) +#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) ) +#define FT_BYTE_I32( p, i, s ) ( FT_INT32( FT_BYTE_( p, i ) ) << (s) ) +#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) + +#define FT_INT8_I16( p, i, s ) ( FT_INT16( FT_INT8_( p, i ) ) << (s) ) +#define FT_INT8_U16( p, i, s ) ( FT_UINT16( FT_INT8_( p, i ) ) << (s) ) +#define FT_INT8_I32( p, i, s ) ( FT_INT32( FT_INT8_( p, i ) ) << (s) ) +#define FT_INT8_U32( p, i, s ) ( FT_UINT32( FT_INT8_( p, i ) ) << (s) ) + + +#define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16( p, 0, 8) | \ + FT_BYTE_I16( p, 1, 0) ) + +#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ + FT_BYTE_U16( p, 1, 0 ) ) + +#define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32( p, 0, 24 ) | \ + FT_BYTE_I32( p, 1, 16 ) | \ + FT_BYTE_I32( p, 2, 8 ) | \ + FT_BYTE_I32( p, 3, 0 ) ) + +#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \ + FT_BYTE_U32( p, 1, 16 ) | \ + FT_BYTE_U32( p, 2, 8 ) | \ + FT_BYTE_U32( p, 3, 0 ) ) + +#define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32( p, 0, 16 ) | \ + FT_BYTE_I32( p, 1, 8 ) | \ + FT_BYTE_I32( p, 2, 0 ) ) + +#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 2, 0 ) ) + +#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16( p, 1, 8 ) | \ + FT_BYTE_I16( p, 0, 0 ) ) + +#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \ + FT_BYTE_U16( p, 0, 0 ) ) + +#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32( p, 3, 24 ) | \ + FT_BYTE_I32( p, 2, 16 ) | \ + FT_BYTE_I32( p, 1, 8 ) | \ + FT_BYTE_I32( p, 0, 0 ) ) + +#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \ + FT_BYTE_U32( p, 2, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 0, 0 ) ) + +#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32( p, 2, 16 ) | \ + FT_BYTE_I32( p, 1, 8 ) | \ + FT_BYTE_I32( p, 0, 0 ) ) + +#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 0, 0 ) ) + + +#define FT_NEXT_CHAR( buffer ) \ + ( (signed char)*buffer++ ) + +#define FT_NEXT_BYTE( buffer ) \ + ( (unsigned char)*buffer++ ) + +#define FT_NEXT_SHORT( buffer ) \ + ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) ) + +#define FT_NEXT_USHORT( buffer ) \ + ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) ) + +#define FT_NEXT_OFF3( buffer ) \ + ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) ) + +#define FT_NEXT_UOFF3( buffer ) \ + ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) ) + +#define FT_NEXT_LONG( buffer ) \ + ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) ) + +#define FT_NEXT_ULONG( buffer ) \ + ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) ) + + +#define FT_NEXT_SHORT_LE( buffer ) \ + ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) ) + +#define FT_NEXT_USHORT_LE( buffer ) \ + ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) + +#define FT_NEXT_OFF3_LE( buffer ) \ + ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) + +#define FT_NEXT_UOFF3_LE( buffer ) \ + ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) + +#define FT_NEXT_LONG_LE( buffer ) \ + ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) + +#define FT_NEXT_ULONG_LE( buffer ) \ + ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) ) + + + /*************************************************************************/ + /* */ + /* Each GET_xxxx() macro uses an implicit `stream' variable. */ + /* */ +#if 0 +#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor ) + +#define FT_GET_CHAR() FT_GET_MACRO( CHAR ) +#define FT_GET_BYTE() FT_GET_MACRO( BYTE ) +#define FT_GET_SHORT() FT_GET_MACRO( SHORT ) +#define FT_GET_USHORT() FT_GET_MACRO( USHORT ) +#define FT_GET_OFF3() FT_GET_MACRO( OFF3 ) +#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 ) +#define FT_GET_LONG() FT_GET_MACRO( LONG ) +#define FT_GET_ULONG() FT_GET_MACRO( ULONG ) +#define FT_GET_TAG4() FT_GET_MACRO( ULONG ) + +#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE ) +#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE ) +#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE ) +#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE ) + +#else +#define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) + +#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) +#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) +#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) +#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) +#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) +#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) +#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) +#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) +#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) + +#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) +#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) +#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long ) +#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong ) +#endif + +#define FT_READ_MACRO( func, type, var ) \ + ( var = (type)func( stream, &error ), \ + error != FT_Err_Ok ) + +#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) +#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) +#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var ) +#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var ) +#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var ) +#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var ) +#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var ) +#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var ) + +#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var ) +#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var ) +#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var ) +#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) + + +#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM + + /* initialize a stream for reading a regular system stream */ + FT_EXPORT( FT_Error ) + FT_Stream_Open( FT_Stream stream, + const char* filepathname ); + +#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ + + + /* create a new (input) stream from an FT_Open_Args structure */ + FT_BASE( FT_Error ) + FT_Stream_New( FT_Library library, + const FT_Open_Args* args, + FT_Stream *astream ); + + /* free a stream */ + FT_BASE( void ) + FT_Stream_Free( FT_Stream stream, + FT_Int external ); + + /* initialize a stream for reading in-memory data */ + FT_BASE( void ) + FT_Stream_OpenMemory( FT_Stream stream, + const FT_Byte* base, + FT_ULong size ); + + /* close a stream (does not destroy the stream structure) */ + FT_BASE( void ) + FT_Stream_Close( FT_Stream stream ); + + + /* seek within a stream. position is relative to start of stream */ + FT_BASE( FT_Error ) + FT_Stream_Seek( FT_Stream stream, + FT_ULong pos ); + + /* skip bytes in a stream */ + FT_BASE( FT_Error ) + FT_Stream_Skip( FT_Stream stream, + FT_Long distance ); + + /* return current stream position */ + FT_BASE( FT_Long ) + FT_Stream_Pos( FT_Stream stream ); + + /* read bytes from a stream into a user-allocated buffer, returns an */ + /* error if not all bytes could be read. */ + FT_BASE( FT_Error ) + FT_Stream_Read( FT_Stream stream, + FT_Byte* buffer, + FT_ULong count ); + + /* read bytes from a stream at a given position */ + FT_BASE( FT_Error ) + FT_Stream_ReadAt( FT_Stream stream, + FT_ULong pos, + FT_Byte* buffer, + FT_ULong count ); + + /* try to read bytes at the end of a stream; return number of bytes */ + /* really available */ + FT_BASE( FT_ULong ) + FT_Stream_TryRead( FT_Stream stream, + FT_Byte* buffer, + FT_ULong count ); + + /* Enter a frame of `count' consecutive bytes in a stream. Returns an */ + /* error if the frame could not be read/accessed. The caller can use */ + /* the FT_Stream_Get_XXX functions to retrieve frame data without */ + /* error checks. */ + /* */ + /* You must _always_ call FT_Stream_ExitFrame() once you have entered */ + /* a stream frame! */ + /* */ + FT_BASE( FT_Error ) + FT_Stream_EnterFrame( FT_Stream stream, + FT_ULong count ); + + /* exit a stream frame */ + FT_BASE( void ) + FT_Stream_ExitFrame( FT_Stream stream ); + + /* Extract a stream frame. If the stream is disk-based, a heap block */ + /* is allocated and the frame bytes are read into it. If the stream */ + /* is memory-based, this function simply set a pointer to the data. */ + /* */ + /* Useful to optimize access to memory-based streams transparently. */ + /* */ + /* All extracted frames must be `freed` with a call to the function */ + /* FT_Stream_ReleaseFrame(). */ + /* */ + FT_BASE( FT_Error ) + FT_Stream_ExtractFrame( FT_Stream stream, + FT_ULong count, + FT_Byte** pbytes ); + + /* release an extract frame (see FT_Stream_ExtractFrame) */ + FT_BASE( void ) + FT_Stream_ReleaseFrame( FT_Stream stream, + FT_Byte** pbytes ); + + /* read a byte from an entered frame */ + FT_BASE( FT_Char ) + FT_Stream_GetChar( FT_Stream stream ); + + /* read a 16-bit big-endian integer from an entered frame */ + FT_BASE( FT_Short ) + FT_Stream_GetShort( FT_Stream stream ); + + /* read a 24-bit big-endian integer from an entered frame */ + FT_BASE( FT_Long ) + FT_Stream_GetOffset( FT_Stream stream ); + + /* read a 32-bit big-endian integer from an entered frame */ + FT_BASE( FT_Long ) + FT_Stream_GetLong( FT_Stream stream ); + + /* read a 16-bit little-endian integer from an entered frame */ + FT_BASE( FT_Short ) + FT_Stream_GetShortLE( FT_Stream stream ); + + /* read a 32-bit little-endian integer from an entered frame */ + FT_BASE( FT_Long ) + FT_Stream_GetLongLE( FT_Stream stream ); + + + /* read a byte from a stream */ + FT_BASE( FT_Char ) + FT_Stream_ReadChar( FT_Stream stream, + FT_Error* error ); + + /* read a 16-bit big-endian integer from a stream */ + FT_BASE( FT_Short ) + FT_Stream_ReadShort( FT_Stream stream, + FT_Error* error ); + + /* read a 24-bit big-endian integer from a stream */ + FT_BASE( FT_Long ) + FT_Stream_ReadOffset( FT_Stream stream, + FT_Error* error ); + + /* read a 32-bit big-endian integer from a stream */ + FT_BASE( FT_Long ) + FT_Stream_ReadLong( FT_Stream stream, + FT_Error* error ); + + /* read a 16-bit little-endian integer from a stream */ + FT_BASE( FT_Short ) + FT_Stream_ReadShortLE( FT_Stream stream, + FT_Error* error ); + + /* read a 32-bit little-endian integer from a stream */ + FT_BASE( FT_Long ) + FT_Stream_ReadLongLE( FT_Stream stream, + FT_Error* error ); + + /* Read a structure from a stream. The structure must be described */ + /* by an array of FT_Frame_Field records. */ + FT_BASE( FT_Error ) + FT_Stream_ReadFields( FT_Stream stream, + const FT_Frame_Field* fields, + void* structure ); + + +#define FT_STREAM_POS() \ + FT_Stream_Pos( stream ) + +#define FT_STREAM_SEEK( position ) \ + FT_SET_ERROR( FT_Stream_Seek( stream, position ) ) + +#define FT_STREAM_SKIP( distance ) \ + FT_SET_ERROR( FT_Stream_Skip( stream, distance ) ) + +#define FT_STREAM_READ( buffer, count ) \ + FT_SET_ERROR( FT_Stream_Read( stream, \ + (FT_Byte*)buffer, \ + count ) ) + +#define FT_STREAM_READ_AT( position, buffer, count ) \ + FT_SET_ERROR( FT_Stream_ReadAt( stream, \ + position, \ + (FT_Byte*)buffer, \ + count ) ) + +#define FT_STREAM_READ_FIELDS( fields, object ) \ + FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) ) + + +#define FT_FRAME_ENTER( size ) \ + FT_SET_ERROR( FT_Stream_EnterFrame( stream, size ) ) + +#define FT_FRAME_EXIT() \ + FT_Stream_ExitFrame( stream ) + +#define FT_FRAME_EXTRACT( size, bytes ) \ + FT_SET_ERROR( FT_Stream_ExtractFrame( stream, size, \ + (FT_Byte**)&(bytes) ) ) + +#define FT_FRAME_RELEASE( bytes ) \ + FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) ) + + +FT_END_HEADER + +#endif /* __FTSTREAM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/fttrace.h b/extlibs/headers/freetype/internal/fttrace.h new file mode 100644 index 00000000..1267e167 --- /dev/null +++ b/extlibs/headers/freetype/internal/fttrace.h @@ -0,0 +1,118 @@ +/***************************************************************************/ +/* */ +/* fttrace.h */ +/* */ +/* Tracing handling (specification only). */ +/* */ +/* Copyright 2002, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /* definitions of trace levels for FreeType 2 */ + + /* the first level must always be `trace_any' */ +FT_TRACE_DEF( any ) + + /* base components */ +FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */ +FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */ +FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */ +FT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */ +FT_TRACE_DEF( list ) /* list management (ftlist.c) */ +FT_TRACE_DEF( init ) /* initialization (ftinit.c) */ +FT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */ +FT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */ +FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */ + +FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */ +FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */ +FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ +FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ + + /* Cache sub-system */ +FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ + + /* SFNT driver components */ +FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */ +FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */ +FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */ +FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */ +FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */ +FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */ + + /* TrueType driver components */ +FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */ +FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */ +FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */ +FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */ +FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */ +FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */ + + /* Type 1 driver components */ +FT_TRACE_DEF( t1driver ) +FT_TRACE_DEF( t1gload ) +FT_TRACE_DEF( t1hint ) +FT_TRACE_DEF( t1load ) +FT_TRACE_DEF( t1objs ) +FT_TRACE_DEF( t1parse ) + + /* PostScript helper module `psaux' */ +FT_TRACE_DEF( t1decode ) +FT_TRACE_DEF( psobjs ) + + /* PostScript hinting module `pshinter' */ +FT_TRACE_DEF( pshrec ) +FT_TRACE_DEF( pshalgo1 ) +FT_TRACE_DEF( pshalgo2 ) + + /* Type 2 driver components */ +FT_TRACE_DEF( cffdriver ) +FT_TRACE_DEF( cffgload ) +FT_TRACE_DEF( cffload ) +FT_TRACE_DEF( cffobjs ) +FT_TRACE_DEF( cffparse ) + + /* Type 42 driver component */ +FT_TRACE_DEF( t42 ) + + /* CID driver components */ +FT_TRACE_DEF( cidafm ) +FT_TRACE_DEF( ciddriver ) +FT_TRACE_DEF( cidgload ) +FT_TRACE_DEF( cidload ) +FT_TRACE_DEF( cidobjs ) +FT_TRACE_DEF( cidparse ) + + /* Windows font component */ +FT_TRACE_DEF( winfnt ) + + /* PCF font components */ +FT_TRACE_DEF( pcfdriver ) +FT_TRACE_DEF( pcfread ) + + /* BDF font components */ +FT_TRACE_DEF( bdfdriver ) +FT_TRACE_DEF( bdflib ) + + /* PFR font component */ +FT_TRACE_DEF( pfr ) + + /* OpenType validation components */ +FT_TRACE_DEF( otvmodule ) +FT_TRACE_DEF( otvcommon ) +FT_TRACE_DEF( otvbase ) +FT_TRACE_DEF( otvgdef ) +FT_TRACE_DEF( otvgpos ) +FT_TRACE_DEF( otvgsub ) +FT_TRACE_DEF( otvjstf ) + + +/* END */ diff --git a/extlibs/headers/freetype/internal/ftvalid.h b/extlibs/headers/freetype/internal/ftvalid.h new file mode 100644 index 00000000..d52ff2f3 --- /dev/null +++ b/extlibs/headers/freetype/internal/ftvalid.h @@ -0,0 +1,148 @@ +/***************************************************************************/ +/* */ +/* ftvalid.h */ +/* */ +/* FreeType validation support (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTVALID_H__ +#define __FTVALID_H__ + +#include <ft2build.h> +#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */ + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** V A L I D A T I O N ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /* handle to a validation object */ + typedef struct FT_ValidatorRec_* FT_Validator; + + + /*************************************************************************/ + /* */ + /* There are three distinct validation levels defined here: */ + /* */ + /* FT_VALIDATE_DEFAULT :: */ + /* A table that passes this validation level can be used reliably by */ + /* FreeType. It generally means that all offsets have been checked to */ + /* prevent out-of-bound reads, that array counts are correct, etc. */ + /* */ + /* FT_VALIDATE_TIGHT :: */ + /* A table that passes this validation level can be used reliably and */ + /* doesn't contain invalid data. For example, a charmap table that */ + /* returns invalid glyph indices will not pass, even though it can */ + /* be used with FreeType in default mode (the library will simply */ + /* return an error later when trying to load the glyph). */ + /* */ + /* It also checks that fields which must be a multiple of 2, 4, or 8, */ + /* don't have incorrect values, etc. */ + /* */ + /* FT_VALIDATE_PARANOID :: */ + /* Only for font debugging. Checks that a table follows the */ + /* specification by 100%. Very few fonts will be able to pass this */ + /* level anyway but it can be useful for certain tools like font */ + /* editors/converters. */ + /* */ + typedef enum FT_ValidationLevel_ + { + FT_VALIDATE_DEFAULT = 0, + FT_VALIDATE_TIGHT, + FT_VALIDATE_PARANOID + + } FT_ValidationLevel; + + + /* validator structure */ + typedef struct FT_ValidatorRec_ + { + const FT_Byte* base; /* address of table in memory */ + const FT_Byte* limit; /* `base' + sizeof(table) in memory */ + FT_ValidationLevel level; /* validation level */ + FT_Error error; /* error returned. 0 means success */ + + ft_jmp_buf jump_buffer; /* used for exception handling */ + + } FT_ValidatorRec; + + +#define FT_VALIDATOR( x ) ((FT_Validator)( x )) + + + FT_BASE( void ) + ft_validator_init( FT_Validator valid, + const FT_Byte* base, + const FT_Byte* limit, + FT_ValidationLevel level ); + + FT_BASE( FT_Int ) + ft_validator_run( FT_Validator valid ); + + /* Sets the error field in a validator, then calls `longjmp' to return */ + /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */ + /* error checks within the validation routines. */ + /* */ + FT_BASE( void ) + ft_validator_error( FT_Validator valid, + FT_Error error ); + + + /* Calls ft_validate_error. Assumes that the `valid' local variable */ + /* holds a pointer to the current validator object. */ + /* */ + /* Use preprocessor prescan to pass FT_ERR_PREFIX. */ + /* */ +#define FT_INVALID( _prefix, _error ) FT_INVALID_( _prefix, _error ) +#define FT_INVALID_( _prefix, _error ) \ + ft_validator_error( valid, _prefix ## _error ) + + /* called when a broken table is detected */ +#define FT_INVALID_TOO_SHORT \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) + + /* called when an invalid offset is detected */ +#define FT_INVALID_OFFSET \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Offset ) + + /* called when an invalid format/value is detected */ +#define FT_INVALID_FORMAT \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) + + /* called when an invalid glyph index is detected */ +#define FT_INVALID_GLYPH_ID \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Glyph_Index ) + + /* called when an invalid field value is detected */ +#define FT_INVALID_DATA \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) + + +FT_END_HEADER + +#endif /* __FTVALID_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/internal.h b/extlibs/headers/freetype/internal/internal.h new file mode 100644 index 00000000..27d5dc58 --- /dev/null +++ b/extlibs/headers/freetype/internal/internal.h @@ -0,0 +1,50 @@ +/***************************************************************************/ +/* */ +/* internal.h */ +/* */ +/* Internal header files (specification only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file is automatically included by `ft2build.h'. */ + /* Do not include it manually! */ + /* */ + /*************************************************************************/ + + +#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h> +#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h> +#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h> +#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h> +#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h> +#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h> +#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h> +#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h> +#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h> +#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h> +#define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h> +#define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h> + +#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h> +#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h> + +#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h> +#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h> +#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h> + +#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h> + + +/* END */ diff --git a/extlibs/headers/freetype/internal/pcftypes.h b/extlibs/headers/freetype/internal/pcftypes.h new file mode 100644 index 00000000..382796ff --- /dev/null +++ b/extlibs/headers/freetype/internal/pcftypes.h @@ -0,0 +1,56 @@ +/* pcftypes.h + + FreeType font driver for pcf fonts + + Copyright (C) 2000, 2001, 2002 by + Francesco Zappa Nardelli + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + + +#ifndef __PCFTYPES_H__ +#define __PCFTYPES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + typedef struct PCF_Public_FaceRec_ + { + FT_FaceRec root; + FT_StreamRec gzip_stream; + FT_Stream gzip_source; + + char* charset_encoding; + char* charset_registry; + + } PCF_Public_FaceRec, *PCF_Public_Face; + + +FT_END_HEADER + +#endif /* __PCFTYPES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/psaux.h b/extlibs/headers/freetype/internal/psaux.h new file mode 100644 index 00000000..cf1abf4c --- /dev/null +++ b/extlibs/headers/freetype/internal/psaux.h @@ -0,0 +1,741 @@ +/***************************************************************************/ +/* */ +/* psaux.h */ +/* */ +/* Auxiliary functions and data structures related to PostScript fonts */ +/* (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __PSAUX_H__ +#define __PSAUX_H__ + + +#include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_TYPE1_TYPES_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** T1_TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct PS_TableRec_* PS_Table; + typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* PS_Table_FuncsRec */ + /* */ + /* <Description> */ + /* A set of function pointers to manage PS_Table objects. */ + /* */ + /* <Fields> */ + /* table_init :: Used to initialize a table. */ + /* */ + /* table_done :: Finalizes resp. destroy a given table. */ + /* */ + /* table_add :: Adds a new object to a table. */ + /* */ + /* table_release :: Releases table data, then finalizes it. */ + /* */ + typedef struct PS_Table_FuncsRec_ + { + FT_Error + (*init)( PS_Table table, + FT_Int count, + FT_Memory memory ); + + void + (*done)( PS_Table table ); + + FT_Error + (*add)( PS_Table table, + FT_Int idx, + void* object, + FT_PtrDist length ); + + void + (*release)( PS_Table table ); + + } PS_Table_FuncsRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* PS_TableRec */ + /* */ + /* <Description> */ + /* A PS_Table is a simple object used to store an array of objects in */ + /* a single memory block. */ + /* */ + /* <Fields> */ + /* block :: The address in memory of the growheap's block. This */ + /* can change between two object adds, due to */ + /* reallocation. */ + /* */ + /* cursor :: The current top of the grow heap within its block. */ + /* */ + /* capacity :: The current size of the heap block. Increments by */ + /* 1kByte chunks. */ + /* */ + /* max_elems :: The maximum number of elements in table. */ + /* */ + /* num_elems :: The current number of elements in table. */ + /* */ + /* elements :: A table of element addresses within the block. */ + /* */ + /* lengths :: A table of element sizes within the block. */ + /* */ + /* memory :: The object used for memory operations */ + /* (alloc/realloc). */ + /* */ + /* funcs :: A table of method pointers for this object. */ + /* */ + typedef struct PS_TableRec_ + { + FT_Byte* block; /* current memory block */ + FT_Offset cursor; /* current cursor in memory block */ + FT_Offset capacity; /* current size of memory block */ + FT_Long init; + + FT_Int max_elems; + FT_Int num_elems; + FT_Byte** elements; /* addresses of table elements */ + FT_PtrDist* lengths; /* lengths of table elements */ + + FT_Memory memory; + PS_Table_FuncsRec funcs; + + } PS_TableRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** T1 FIELDS & TOKENS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct PS_ParserRec_* PS_Parser; + + typedef struct T1_TokenRec_* T1_Token; + + typedef struct T1_FieldRec_* T1_Field; + + + /* simple enumeration type used to identify token types */ + typedef enum T1_TokenType_ + { + T1_TOKEN_TYPE_NONE = 0, + T1_TOKEN_TYPE_ANY, + T1_TOKEN_TYPE_STRING, + T1_TOKEN_TYPE_ARRAY, + + /* do not remove */ + T1_TOKEN_TYPE_MAX + + } T1_TokenType; + + + /* a simple structure used to identify tokens */ + typedef struct T1_TokenRec_ + { + FT_Byte* start; /* first character of token in input stream */ + FT_Byte* limit; /* first character after the token */ + T1_TokenType type; /* type of token */ + + } T1_TokenRec; + + + /* enumeration type used to identify object fields */ + typedef enum T1_FieldType_ + { + T1_FIELD_TYPE_NONE = 0, + T1_FIELD_TYPE_BOOL, + T1_FIELD_TYPE_INTEGER, + T1_FIELD_TYPE_FIXED, + T1_FIELD_TYPE_FIXED_1000, + T1_FIELD_TYPE_STRING, + T1_FIELD_TYPE_KEY, + T1_FIELD_TYPE_BBOX, + T1_FIELD_TYPE_INTEGER_ARRAY, + T1_FIELD_TYPE_FIXED_ARRAY, + T1_FIELD_TYPE_CALLBACK, + + /* do not remove */ + T1_FIELD_TYPE_MAX + + } T1_FieldType; + + + typedef enum T1_FieldLocation_ + { + T1_FIELD_LOCATION_CID_INFO, + T1_FIELD_LOCATION_FONT_DICT, + T1_FIELD_LOCATION_FONT_INFO, + T1_FIELD_LOCATION_PRIVATE, + T1_FIELD_LOCATION_BBOX, + + /* do not remove */ + T1_FIELD_LOCATION_MAX + + } T1_FieldLocation; + + + typedef void + (*T1_Field_ParseFunc)( FT_Face face, + FT_Pointer parser ); + + + /* structure type used to model object fields */ + typedef struct T1_FieldRec_ + { + const char* ident; /* field identifier */ + T1_FieldLocation location; + T1_FieldType type; /* type of field */ + T1_Field_ParseFunc reader; + FT_UInt offset; /* offset of field in object */ + FT_Byte size; /* size of field in bytes */ + FT_UInt array_max; /* maximal number of elements for */ + /* array */ + FT_UInt count_offset; /* offset of element count for */ + /* arrays */ + } T1_FieldRec; + + +#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \ + { \ + _ident, T1CODE, _type, \ + 0, \ + FT_FIELD_OFFSET( _fname ), \ + FT_FIELD_SIZE( _fname ), \ + 0, 0 \ + }, + +#define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \ + { \ + _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \ + (T1_Field_ParseFunc)_reader, \ + 0, 0, \ + 0, 0 \ + }, + +#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \ + { \ + _ident, T1CODE, _type, \ + 0, \ + FT_FIELD_OFFSET( _fname ), \ + FT_FIELD_SIZE_DELTA( _fname ), \ + _max, \ + FT_FIELD_OFFSET( num_ ## _fname ) \ + }, + +#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \ + { \ + _ident, T1CODE, _type, \ + 0, \ + FT_FIELD_OFFSET( _fname ), \ + FT_FIELD_SIZE_DELTA( _fname ), \ + _max, 0 \ + }, + + +#define T1_FIELD_BOOL( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname ) + +#define T1_FIELD_NUM( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname ) + +#define T1_FIELD_FIXED( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname ) + +#define T1_FIELD_FIXED_1000( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname ) + +#define T1_FIELD_STRING( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname ) + +#define T1_FIELD_KEY( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname ) + +#define T1_FIELD_BBOX( _ident, _fname ) \ + T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname ) + + +#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \ + T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ + _fname, _fmax ) + +#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \ + T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ + _fname, _fmax ) + +#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \ + T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ + _fname, _fmax ) + +#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \ + T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ + _fname, _fmax ) + +#define T1_FIELD_CALLBACK( _ident, _name ) \ + T1_NEW_CALLBACK_FIELD( _ident, _name ) + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** T1 PARSER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs; + + typedef struct PS_Parser_FuncsRec_ + { + void + (*init)( PS_Parser parser, + FT_Byte* base, + FT_Byte* limit, + FT_Memory memory ); + + void + (*done)( PS_Parser parser ); + + void + (*skip_spaces)( PS_Parser parser ); + void + (*skip_PS_token)( PS_Parser parser ); + + FT_Long + (*to_int)( PS_Parser parser ); + FT_Fixed + (*to_fixed)( PS_Parser parser, + FT_Int power_ten ); + + FT_Error + (*to_bytes)( PS_Parser parser, + FT_Byte* bytes, + FT_Long max_bytes, + FT_Long* pnum_bytes, + FT_Bool delimiters ); + + FT_Int + (*to_coord_array)( PS_Parser parser, + FT_Int max_coords, + FT_Short* coords ); + FT_Int + (*to_fixed_array)( PS_Parser parser, + FT_Int max_values, + FT_Fixed* values, + FT_Int power_ten ); + + void + (*to_token)( PS_Parser parser, + T1_Token token ); + void + (*to_token_array)( PS_Parser parser, + T1_Token tokens, + FT_UInt max_tokens, + FT_Int* pnum_tokens ); + + FT_Error + (*load_field)( PS_Parser parser, + const T1_Field field, + void** objects, + FT_UInt max_objects, + FT_ULong* pflags ); + + FT_Error + (*load_field_table)( PS_Parser parser, + const T1_Field field, + void** objects, + FT_UInt max_objects, + FT_ULong* pflags ); + + } PS_Parser_FuncsRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* PS_ParserRec */ + /* */ + /* <Description> */ + /* A PS_Parser is an object used to parse a Type 1 font very quickly. */ + /* */ + /* <Fields> */ + /* cursor :: The current position in the text. */ + /* */ + /* base :: Start of the processed text. */ + /* */ + /* limit :: End of the processed text. */ + /* */ + /* error :: The last error returned. */ + /* */ + /* memory :: The object used for memory operations (alloc/realloc). */ + /* */ + /* funcs :: A table of functions for the parser. */ + /* */ + typedef struct PS_ParserRec_ + { + FT_Byte* cursor; + FT_Byte* base; + FT_Byte* limit; + FT_Error error; + FT_Memory memory; + + PS_Parser_FuncsRec funcs; + + } PS_ParserRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** T1 BUILDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct T1_BuilderRec_* T1_Builder; + + + typedef FT_Error + (*T1_Builder_Check_Points_Func)( T1_Builder builder, + FT_Int count ); + + typedef void + (*T1_Builder_Add_Point_Func)( T1_Builder builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + + typedef FT_Error + (*T1_Builder_Add_Point1_Func)( T1_Builder builder, + FT_Pos x, + FT_Pos y ); + + typedef FT_Error + (*T1_Builder_Add_Contour_Func)( T1_Builder builder ); + + typedef FT_Error + (*T1_Builder_Start_Point_Func)( T1_Builder builder, + FT_Pos x, + FT_Pos y ); + + typedef void + (*T1_Builder_Close_Contour_Func)( T1_Builder builder ); + + + typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs; + + typedef struct T1_Builder_FuncsRec_ + { + void + (*init)( T1_Builder builder, + FT_Face face, + FT_Size size, + FT_GlyphSlot slot, + FT_Bool hinting ); + + void + (*done)( T1_Builder builder ); + + T1_Builder_Check_Points_Func check_points; + T1_Builder_Add_Point_Func add_point; + T1_Builder_Add_Point1_Func add_point1; + T1_Builder_Add_Contour_Func add_contour; + T1_Builder_Start_Point_Func start_point; + T1_Builder_Close_Contour_Func close_contour; + + } T1_Builder_FuncsRec; + + + /* an enumeration type to handle charstring parsing states */ + typedef enum T1_ParseState_ + { + T1_Parse_Start, + T1_Parse_Have_Width, + T1_Parse_Have_Moveto, + T1_Parse_Have_Path + + } T1_ParseState; + + + /*************************************************************************/ + /* */ + /* <Structure> */ + /* T1_BuilderRec */ + /* */ + /* <Description> */ + /* A structure used during glyph loading to store its outline. */ + /* */ + /* <Fields> */ + /* memory :: The current memory object. */ + /* */ + /* face :: The current face object. */ + /* */ + /* glyph :: The current glyph slot. */ + /* */ + /* loader :: XXX */ + /* */ + /* base :: The base glyph outline. */ + /* */ + /* current :: The current glyph outline. */ + /* */ + /* max_points :: maximum points in builder outline */ + /* */ + /* max_contours :: Maximal number of contours in builder outline. */ + /* */ + /* last :: The last point position. */ + /* */ + /* scale_x :: The horizontal scale (FUnits to sub-pixels). */ + /* */ + /* scale_y :: The vertical scale (FUnits to sub-pixels). */ + /* */ + /* pos_x :: The horizontal translation (if composite glyph). */ + /* */ + /* pos_y :: The vertical translation (if composite glyph). */ + /* */ + /* left_bearing :: The left side bearing point. */ + /* */ + /* advance :: The horizontal advance vector. */ + /* */ + /* bbox :: Unused. */ + /* */ + /* parse_state :: An enumeration which controls the charstring */ + /* parsing state. */ + /* */ + /* load_points :: If this flag is not set, no points are loaded. */ + /* */ + /* no_recurse :: Set but not used. */ + /* */ + /* metrics_only :: A boolean indicating that we only want to compute */ + /* the metrics of a given glyph, not load all of its */ + /* points. */ + /* */ + /* funcs :: An array of function pointers for the builder. */ + /* */ + typedef struct T1_BuilderRec_ + { + FT_Memory memory; + FT_Face face; + FT_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; + + FT_Vector last; + + FT_Fixed scale_x; + FT_Fixed scale_y; + + FT_Pos pos_x; + FT_Pos pos_y; + + FT_Vector left_bearing; + FT_Vector advance; + + FT_BBox bbox; /* bounding box */ + T1_ParseState parse_state; + FT_Bool load_points; + FT_Bool no_recurse; + FT_Bool shift; + + FT_Bool metrics_only; + + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ + + T1_Builder_FuncsRec funcs; + + } T1_BuilderRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** T1 DECODER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#if 0 + + /*************************************************************************/ + /* */ + /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ + /* calls during glyph loading. */ + /* */ +#define T1_MAX_SUBRS_CALLS 8 + + + /*************************************************************************/ + /* */ + /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ + /* minimum of 16 is required. */ + /* */ +#define T1_MAX_CHARSTRINGS_OPERANDS 32 + +#endif /* 0 */ + + + typedef struct T1_Decoder_ZoneRec_ + { + FT_Byte* cursor; + FT_Byte* base; + FT_Byte* limit; + + } T1_Decoder_ZoneRec, *T1_Decoder_Zone; + + + typedef struct T1_DecoderRec_* T1_Decoder; + typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs; + + + typedef FT_Error + (*T1_Decoder_Callback)( T1_Decoder decoder, + FT_UInt glyph_index ); + + + typedef struct T1_Decoder_FuncsRec_ + { + FT_Error + (*init)( T1_Decoder decoder, + FT_Face face, + FT_Size size, + FT_GlyphSlot slot, + FT_Byte** glyph_names, + PS_Blend blend, + FT_Bool hinting, + FT_Render_Mode hint_mode, + T1_Decoder_Callback callback ); + + void + (*done)( T1_Decoder decoder ); + + FT_Error + (*parse_charstrings)( T1_Decoder decoder, + FT_Byte* base, + FT_UInt len ); + + } T1_Decoder_FuncsRec; + + + typedef struct T1_DecoderRec_ + { + T1_BuilderRec builder; + + FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS]; + FT_Long* top; + + T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1]; + T1_Decoder_Zone zone; + + FT_Service_PsCMaps psnames; /* for seac */ + FT_UInt num_glyphs; + FT_Byte** glyph_names; + + FT_Int lenIV; /* internal for sub routine calls */ + FT_UInt num_subrs; + FT_Byte** subrs; + FT_PtrDist* subrs_len; /* array of subrs length (optional) */ + + FT_Matrix font_matrix; + FT_Vector font_offset; + + FT_Int flex_state; + FT_Int num_flex_vectors; + FT_Vector flex_vectors[7]; + + PS_Blend blend; /* for multiple master support */ + + FT_Render_Mode hint_mode; + + T1_Decoder_Callback parse_callback; + T1_Decoder_FuncsRec funcs; + + } T1_DecoderRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** TYPE1 CHARMAPS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes; + + typedef struct T1_CMap_ClassesRec_ + { + FT_CMap_Class standard; + FT_CMap_Class expert; + FT_CMap_Class custom; + FT_CMap_Class unicode; + + } T1_CMap_ClassesRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PSAux Module Interface *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct PSAux_ServiceRec_ + { + /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */ + const PS_Table_FuncsRec* ps_table_funcs; + const PS_Parser_FuncsRec* ps_parser_funcs; + const T1_Builder_FuncsRec* t1_builder_funcs; + const T1_Decoder_FuncsRec* t1_decoder_funcs; + + void + (*t1_decrypt)( FT_Byte* buffer, + FT_Offset length, + FT_UShort seed ); + + T1_CMap_Classes t1_cmap_classes; + + } PSAux_ServiceRec, *PSAux_Service; + + /* backwards-compatible type definition */ + typedef PSAux_ServiceRec PSAux_Interface; + +FT_END_HEADER + +#endif /* __PSAUX_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/pshints.h b/extlibs/headers/freetype/internal/pshints.h new file mode 100644 index 00000000..cd48f6cf --- /dev/null +++ b/extlibs/headers/freetype/internal/pshints.h @@ -0,0 +1,626 @@ +/***************************************************************************/ +/* */ +/* pshints.h */ +/* */ +/* Interface to Postscript-specific (Type 1 and Type 2) hints */ +/* recorders (specification only). These are used to support native */ +/* T1/T2 hints in the "type1", "cid" and "cff" font drivers. */ +/* */ +/* Copyright 2001, 2002, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __PSHINTS_H__ +#define __PSHINTS_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H +#include FT_TYPE1_TABLES_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** INTERNAL REPRESENTATION OF GLOBALS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct PSH_GlobalsRec_* PSH_Globals; + + typedef FT_Error + (*PSH_Globals_NewFunc)( FT_Memory memory, + T1_Private* private_dict, + PSH_Globals* aglobals ); + + typedef FT_Error + (*PSH_Globals_SetScaleFunc)( PSH_Globals globals, + FT_Fixed x_scale, + FT_Fixed y_scale, + FT_Fixed x_delta, + FT_Fixed y_delta ); + + typedef void + (*PSH_Globals_DestroyFunc)( PSH_Globals globals ); + + + typedef struct PSH_Globals_FuncsRec_ + { + PSH_Globals_NewFunc create; + PSH_Globals_SetScaleFunc set_scale; + PSH_Globals_DestroyFunc destroy; + + } PSH_Globals_FuncsRec, *PSH_Globals_Funcs; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PUBLIC TYPE 1 HINTS RECORDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* @type: */ + /* T1_Hints */ + /* */ + /* @description: */ + /* This is a handle to an opaque structure used to record glyph hints */ + /* from a Type 1 character glyph character string. */ + /* */ + /* The methods used to operate on this object are defined by the */ + /* @T1_Hints_FuncsRec structure. Recording glyph hints is normally */ + /* achieved through the following scheme: */ + /* */ + /* - Open a new hint recording session by calling the "open" method. */ + /* This will rewind the recorder and prepare it for new input. */ + /* */ + /* - For each hint found in the glyph charstring, call the */ + /* corresponding method ("stem", "stem3", or "reset"). Note that */ + /* these functions do not return an error code. */ + /* */ + /* - Close the recording session by calling the "close" method. It */ + /* will return an error code if the hints were invalid or something */ + /* strange happened (e.g. memory shortage). */ + /* */ + /* The hints accumulated in the object can later be used by the */ + /* PostScript hinter. */ + /* */ + typedef struct T1_HintsRec_* T1_Hints; + + + /*************************************************************************/ + /* */ + /* @type: */ + /* T1_Hints_Funcs */ + /* */ + /* @description: */ + /* A pointer to the @T1_Hints_FuncsRec structure that defines the */ + /* API of a given @T1_Hints object. */ + /* */ + typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs; + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T1_Hints_OpenFunc */ + /* */ + /* @description: */ + /* A method of the @T1_Hints class used to prepare it for a new */ + /* Type 1 hints recording session. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 1 hints recorder. */ + /* */ + /* @note: */ + /* You should always call the @T1_Hints_CloseFunc method in order to */ + /* close an opened recording session. */ + /* */ + typedef void + (*T1_Hints_OpenFunc)( T1_Hints hints ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T1_Hints_SetStemFunc */ + /* */ + /* @description: */ + /* A method of the @T1_Hints class used to record a new horizontal or */ + /* vertical stem. This corresponds to the Type 1 "hstem" and "vstem" */ + /* operators. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 1 hints recorder. */ + /* */ + /* dimension :: 0 for horizontal stems (hstem), 1 for vertical ones */ + /* (vstem). */ + /* */ + /* coords :: Array of 2 integers, used as (position,length) stem */ + /* descriptor. */ + /* */ + /* @note: */ + /* Use vertical coordinates (y) for horizontal stems (dim=0). Use */ + /* horizontal coordinates (x) for vertical stems (dim=1). */ + /* */ + /* "coords[0]" is the absolute stem position (lowest coordinate); */ + /* "coords[1]" is the length. */ + /* */ + /* The length can be negative, in which case it must be either -20 or */ + /* -21. It will be interpreted as a "ghost" stem, according to */ + /* Type 1 specification. */ + /* */ + /* If the length is -21 (corresponding to a bottom ghost stem), then */ + /* the real stem position is "coords[0]+coords[1]". */ + /* */ + typedef void + (*T1_Hints_SetStemFunc)( T1_Hints hints, + FT_UInt dimension, + FT_Long* coords ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T1_Hints_SetStem3Func */ + /* */ + /* @description: */ + /* A method of the @T1_Hints class used to record three */ + /* counter-controlled horizontal or vertical stems at once. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 1 hints recorder. */ + /* */ + /* dimension :: 0 for horizontal stems, 1 for vertical ones. */ + /* */ + /* coords :: An array of 6 integers, holding 3 (position,length) */ + /* pairs for the counter-controlled stems. */ + /* */ + /* @note: */ + /* Use vertical coordinates (y) for horizontal stems (dim=0). Use */ + /* horizontal coordinates (x) for vertical stems (dim=1). */ + /* */ + /* The lengths cannot be negative (ghost stems are never */ + /* counter-controlled). */ + /* */ + typedef void + (*T1_Hints_SetStem3Func)( T1_Hints hints, + FT_UInt dimension, + FT_Long* coords ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T1_Hints_ResetFunc */ + /* */ + /* @description: */ + /* A method of the @T1_Hints class used to reset the stems hints in a */ + /* recording session. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 1 hints recorder. */ + /* */ + /* end_point :: The index of the last point in the input glyph in */ + /* which the previously defined hints apply. */ + /* */ + typedef void + (*T1_Hints_ResetFunc)( T1_Hints hints, + FT_UInt end_point ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T1_Hints_CloseFunc */ + /* */ + /* @description: */ + /* A method of the @T1_Hints class used to close a hint recording */ + /* session. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 1 hints recorder. */ + /* */ + /* end_point :: The index of the last point in the input glyph. */ + /* */ + /* @return: */ + /* FreeType error code. 0 means success. */ + /* */ + /* @note: */ + /* The error code will be set to indicate that an error occured */ + /* during the recording session. */ + /* */ + typedef FT_Error + (*T1_Hints_CloseFunc)( T1_Hints hints, + FT_UInt end_point ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T1_Hints_ApplyFunc */ + /* */ + /* @description: */ + /* A method of the @T1_Hints class used to apply hints to the */ + /* corresponding glyph outline. Must be called once all hints have */ + /* been recorded. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 1 hints recorder. */ + /* */ + /* outline :: A pointer to the target outline descriptor. */ + /* */ + /* globals :: The hinter globals for this font. */ + /* */ + /* hint_mode :: Hinting information. */ + /* */ + /* @return: */ + /* FreeType error code. 0 means success. */ + /* */ + /* @note: */ + /* On input, all points within the outline are in font coordinates. */ + /* On output, they are in 1/64th of pixels. */ + /* */ + /* The scaling transformation is taken from the "globals" object */ + /* which must correspond to the same font as the glyph. */ + /* */ + typedef FT_Error + (*T1_Hints_ApplyFunc)( T1_Hints hints, + FT_Outline* outline, + PSH_Globals globals, + FT_Render_Mode hint_mode ); + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* T1_Hints_FuncsRec */ + /* */ + /* @description: */ + /* The structure used to provide the API to @T1_Hints objects. */ + /* */ + /* @fields: */ + /* hints :: A handle to the T1 Hints recorder. */ + /* */ + /* open :: The function to open a recording session. */ + /* */ + /* close :: The function to close a recording session. */ + /* */ + /* stem :: The function to set a simple stem. */ + /* */ + /* stem3 :: The function to set counter-controlled stems. */ + /* */ + /* reset :: The function to reset stem hints. */ + /* */ + /* apply :: The function to apply the hints to the corresponding */ + /* glyph outline. */ + /* */ + typedef struct T1_Hints_FuncsRec_ + { + T1_Hints hints; + T1_Hints_OpenFunc open; + T1_Hints_CloseFunc close; + T1_Hints_SetStemFunc stem; + T1_Hints_SetStem3Func stem3; + T1_Hints_ResetFunc reset; + T1_Hints_ApplyFunc apply; + + } T1_Hints_FuncsRec; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** PUBLIC TYPE 2 HINTS RECORDER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* @type: */ + /* T2_Hints */ + /* */ + /* @description: */ + /* This is a handle to an opaque structure used to record glyph hints */ + /* from a Type 2 character glyph character string. */ + /* */ + /* The methods used to operate on this object are defined by the */ + /* @T2_Hints_FuncsRec structure. Recording glyph hints is normally */ + /* achieved through the following scheme: */ + /* */ + /* - Open a new hint recording session by calling the "open" method. */ + /* This will rewind the recorder and prepare it for new input. */ + /* */ + /* - For each hint found in the glyph charstring, call the */ + /* corresponding method ("stems", "hintmask", "counters"). Note */ + /* that these functions do not return an error code. */ + /* */ + /* - Close the recording session by calling the "close" method. It */ + /* will return an error code if the hints were invalid or something */ + /* strange happened (e.g. memory shortage). */ + /* */ + /* The hints accumulated in the object can later be used by the */ + /* Postscript hinter. */ + /* */ + typedef struct T2_HintsRec_* T2_Hints; + + + /*************************************************************************/ + /* */ + /* @type: */ + /* T2_Hints_Funcs */ + /* */ + /* @description: */ + /* A pointer to the @T2_Hints_FuncsRec structure that defines the API */ + /* of a given @T2_Hints object. */ + /* */ + typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs; + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T2_Hints_OpenFunc */ + /* */ + /* @description: */ + /* A method of the @T2_Hints class used to prepare it for a new */ + /* Type 2 hints recording session. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 2 hints recorder. */ + /* */ + /* @note: */ + /* You should always call the @T2_Hints_CloseFunc method in order to */ + /* close an opened recording session. */ + /* */ + typedef void + (*T2_Hints_OpenFunc)( T2_Hints hints ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T2_Hints_StemsFunc */ + /* */ + /* @description: */ + /* A method of the @T2_Hints class used to set the table of stems in */ + /* either the vertical or horizontal dimension. Equivalent to the */ + /* "hstem", "vstem", "hstemhm", and "vstemhm" Type 2 operators. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 2 hints recorder. */ + /* */ + /* dimension :: 0 for horizontal stems (hstem), 1 for vertical ones */ + /* (vstem). */ + /* */ + /* count :: The number of stems. */ + /* */ + /* coords :: An array of "count" (position,length) pairs. */ + /* */ + /* @note: */ + /* Use vertical coordinates (y) for horizontal stems (dim=0). Use */ + /* horizontal coordinates (x) for vertical stems (dim=1). */ + /* */ + /* There are "2*count" elements in the "coords" aray. Each even */ + /* element is an absolute position in font units, each odd element is */ + /* a length in font units. */ + /* */ + /* A length can be negative, in which case it must be either -20 or */ + /* -21. It will be interpreted as a "ghost" stem, according to the */ + /* Type 1 specification. */ + /* */ + typedef void + (*T2_Hints_StemsFunc)( T2_Hints hints, + FT_UInt dimension, + FT_UInt count, + FT_Fixed* coordinates ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T2_Hints_MaskFunc */ + /* */ + /* @description: */ + /* A method of the @T2_Hints class used to set a given hintmask */ + /* (this corresponds to the "hintmask" Type 2 operator). */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 2 hints recorder. */ + /* */ + /* end_point :: The glyph index of the last point to which the */ + /* previously defined/activated hints apply. */ + /* */ + /* bit_count :: The number of bits in the hint mask. */ + /* */ + /* bytes :: An array of bytes modelling the hint mask. */ + /* */ + /* @note: */ + /* If the hintmask starts the charstring (before any glyph point */ + /* definition), the value of "end_point" should be 0. */ + /* */ + /* "bit_count" is the number of meaningful bits in the "bytes" array; */ + /* it must be equal to the total number of hints defined so far */ + /* (i.e. horizontal+verticals). */ + /* */ + /* The "bytes" array can come directly from the Type 2 charstring and */ + /* respects the same format. */ + /* */ + typedef void + (*T2_Hints_MaskFunc)( T2_Hints hints, + FT_UInt end_point, + FT_UInt bit_count, + const FT_Byte* bytes ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T2_Hints_CounterFunc */ + /* */ + /* @description: */ + /* A method of the @T2_Hints class used to set a given counter mask */ + /* (this corresponds to the "hintmask" Type 2 operator). */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 2 hints recorder. */ + /* */ + /* end_point :: A glyph index of the last point to which the */ + /* previously defined/active hints apply. */ + /* */ + /* bit_count :: The number of bits in the hint mask. */ + /* */ + /* bytes :: An array of bytes modelling the hint mask. */ + /* */ + /* @note: */ + /* If the hintmask starts the charstring (before any glyph point */ + /* definition), the value of "end_point" should be 0. */ + /* */ + /* "bit_count" is the number of meaningful bits in the "bytes" array; */ + /* it must be equal to the total number of hints defined so far */ + /* (i.e. horizontal+verticals). */ + /* */ + /* The "bytes" array can come directly from the Type 2 charstring and */ + /* respects the same format. */ + /* */ + typedef void + (*T2_Hints_CounterFunc)( T2_Hints hints, + FT_UInt bit_count, + const FT_Byte* bytes ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T2_Hints_CloseFunc */ + /* */ + /* @description: */ + /* A method of the @T2_Hints class used to close a hint recording */ + /* session. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 2 hints recorder. */ + /* */ + /* end_point :: The index of the last point in the input glyph. */ + /* */ + /* @return: */ + /* FreeType error code. 0 means success. */ + /* */ + /* @note: */ + /* The error code will be set to indicate that an error occured */ + /* during the recording session. */ + /* */ + typedef FT_Error + (*T2_Hints_CloseFunc)( T2_Hints hints, + FT_UInt end_point ); + + + /*************************************************************************/ + /* */ + /* @functype: */ + /* T2_Hints_ApplyFunc */ + /* */ + /* @description: */ + /* A method of the @T2_Hints class used to apply hints to the */ + /* corresponding glyph outline. Must be called after the "close" */ + /* method. */ + /* */ + /* @input: */ + /* hints :: A handle to the Type 2 hints recorder. */ + /* */ + /* outline :: A pointer to the target outline descriptor. */ + /* */ + /* globals :: The hinter globals for this font. */ + /* */ + /* hint_mode :: Hinting information. */ + /* */ + /* @return: */ + /* FreeType error code. 0 means success. */ + /* */ + /* @note: */ + /* On input, all points within the outline are in font coordinates. */ + /* On output, they are in 1/64th of pixels. */ + /* */ + /* The scaling transformation is taken from the "globals" object */ + /* which must correspond to the same font than the glyph. */ + /* */ + typedef FT_Error + (*T2_Hints_ApplyFunc)( T2_Hints hints, + FT_Outline* outline, + PSH_Globals globals, + FT_Render_Mode hint_mode ); + + + /*************************************************************************/ + /* */ + /* @struct: */ + /* T2_Hints_FuncsRec */ + /* */ + /* @description: */ + /* The structure used to provide the API to @T2_Hints objects. */ + /* */ + /* @fields: */ + /* hints :: A handle to the T2 hints recorder object. */ + /* */ + /* open :: The function to open a recording session. */ + /* */ + /* close :: The function to close a recording session. */ + /* */ + /* stems :: The function to set the dimension's stems table. */ + /* */ + /* hintmask :: The function to set hint masks. */ + /* */ + /* counter :: The function to set counter masks. */ + /* */ + /* apply :: The function to apply the hints on the corresponding */ + /* glyph outline. */ + /* */ + typedef struct T2_Hints_FuncsRec_ + { + T2_Hints hints; + T2_Hints_OpenFunc open; + T2_Hints_CloseFunc close; + T2_Hints_StemsFunc stems; + T2_Hints_MaskFunc hintmask; + T2_Hints_CounterFunc counter; + T2_Hints_ApplyFunc apply; + + } T2_Hints_FuncsRec; + + + /* */ + + + typedef struct PSHinter_Interface_ + { + PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module ); + T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module ); + T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module ); + + } PSHinter_Interface; + + typedef PSHinter_Interface* PSHinter_Service; + + +FT_END_HEADER + +#endif /* __PSHINTS_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/sfnt.h b/extlibs/headers/freetype/internal/sfnt.h new file mode 100644 index 00000000..7b582630 --- /dev/null +++ b/extlibs/headers/freetype/internal/sfnt.h @@ -0,0 +1,577 @@ +/***************************************************************************/ +/* */ +/* sfnt.h */ +/* */ +/* High-level `sfnt' driver interface (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SFNT_H__ +#define __SFNT_H__ + + +#include <ft2build.h> +#include FT_INTERNAL_DRIVER_H +#include FT_INTERNAL_TRUETYPE_TYPES_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Init_Face_Func */ + /* */ + /* <Description> */ + /* First part of the SFNT face object initialization. This will find */ + /* the face in a SFNT file or collection, and load its format tag in */ + /* face->format_tag. */ + /* */ + /* <Input> */ + /* stream :: The input stream. */ + /* */ + /* face :: A handle to the target face object. */ + /* */ + /* face_index :: The index of the TrueType font, if we are opening a */ + /* collection. */ + /* */ + /* num_params :: The number of additional parameters. */ + /* */ + /* params :: Optional additional parameters. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The stream cursor must be at the font file's origin. */ + /* */ + /* This function recognizes fonts embedded in a `TrueType */ + /* collection'. */ + /* */ + /* Once the format tag has been validated by the font driver, it */ + /* should then call the TT_Load_Face_Func() callback to read the rest */ + /* of the SFNT tables in the object. */ + /* */ + typedef FT_Error + (*TT_Init_Face_Func)( FT_Stream stream, + TT_Face face, + FT_Int face_index, + FT_Int num_params, + FT_Parameter* params ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_Face_Func */ + /* */ + /* <Description> */ + /* Second part of the SFNT face object initialization. This will */ + /* load the common SFNT tables (head, OS/2, maxp, metrics, etc.) in */ + /* the face object. */ + /* */ + /* <Input> */ + /* stream :: The input stream. */ + /* */ + /* face :: A handle to the target face object. */ + /* */ + /* face_index :: The index of the TrueType font, if we are opening a */ + /* collection. */ + /* */ + /* num_params :: The number of additional parameters. */ + /* */ + /* params :: Optional additional parameters. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* This function must be called after TT_Init_Face_Func(). */ + /* */ + typedef FT_Error + (*TT_Load_Face_Func)( FT_Stream stream, + TT_Face face, + FT_Int face_index, + FT_Int num_params, + FT_Parameter* params ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Done_Face_Func */ + /* */ + /* <Description> */ + /* A callback used to delete the common SFNT data from a face. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* <Note> */ + /* This function does NOT destroy the face object. */ + /* */ + typedef void + (*TT_Done_Face_Func)( TT_Face face ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_SFNT_HeaderRec_Func */ + /* */ + /* <Description> */ + /* Loads the header of a SFNT font file. Supports collections. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* face_index :: The index of the TrueType font, if we are opening a */ + /* collection. */ + /* */ + /* <Output> */ + /* sfnt :: The SFNT header. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The stream cursor must be at the font file's origin. */ + /* */ + /* This function recognizes fonts embedded in a `TrueType */ + /* collection'. */ + /* */ + /* This function checks that the header is valid by looking at the */ + /* values of `search_range', `entry_selector', and `range_shift'. */ + /* */ + typedef FT_Error + (*TT_Load_SFNT_HeaderRec_Func)( TT_Face face, + FT_Stream stream, + FT_Long face_index, + SFNT_Header sfnt ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_Directory_Func */ + /* */ + /* <Description> */ + /* Loads the table directory into a face object. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* sfnt :: The SFNT header. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The stream cursor must be on the first byte after the 4-byte font */ + /* format tag. This is the case just after a call to */ + /* TT_Load_Format_Tag(). */ + /* */ + typedef FT_Error + (*TT_Load_Directory_Func)( TT_Face face, + FT_Stream stream, + SFNT_Header sfnt ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_Any_Func */ + /* */ + /* <Description> */ + /* Loads any font table into client memory. */ + /* */ + /* <Input> */ + /* face :: The face object to look for. */ + /* */ + /* tag :: The tag of table to load. Use the value 0 if you want */ + /* to access the whole font file, else set this parameter */ + /* to a valid TrueType table tag that you can forge with */ + /* the MAKE_TT_TAG macro. */ + /* */ + /* offset :: The starting offset in the table (or the file if */ + /* tag == 0). */ + /* */ + /* length :: The address of the decision variable: */ + /* */ + /* If length == NULL: */ + /* Loads the whole table. Returns an error if */ + /* `offset' == 0! */ + /* */ + /* If *length == 0: */ + /* Exits immediately; returning the length of the given */ + /* table or of the font file, depending on the value of */ + /* `tag'. */ + /* */ + /* If *length != 0: */ + /* Loads the next `length' bytes of table or font, */ + /* starting at offset `offset' (in table or font too). */ + /* */ + /* <Output> */ + /* buffer :: The address of target buffer. */ + /* */ + /* <Return> */ + /* TrueType error code. 0 means success. */ + /* */ + typedef FT_Error + (*TT_Load_Any_Func)( TT_Face face, + FT_ULong tag, + FT_Long offset, + FT_Byte *buffer, + FT_ULong* length ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Find_SBit_Image_Func */ + /* */ + /* <Description> */ + /* Checks whether an embedded bitmap (an `sbit') exists for a given */ + /* glyph, at a given strike. */ + /* */ + /* <Input> */ + /* face :: The target face object. */ + /* */ + /* glyph_index :: The glyph index. */ + /* */ + /* strike_index :: The current strike index. */ + /* */ + /* <Output> */ + /* arange :: The SBit range containing the glyph index. */ + /* */ + /* astrike :: The SBit strike containing the glyph index. */ + /* */ + /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. Returns */ + /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */ + /* glyph. */ + /* */ + typedef FT_Error + (*TT_Find_SBit_Image_Func)( TT_Face face, + FT_UInt glyph_index, + FT_ULong strike_index, + TT_SBit_Range *arange, + TT_SBit_Strike *astrike, + FT_ULong *aglyph_offset ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_SBit_Metrics_Func */ + /* */ + /* <Description> */ + /* Gets the big metrics for a given embedded bitmap. */ + /* */ + /* <Input> */ + /* stream :: The input stream. */ + /* */ + /* range :: The SBit range containing the glyph. */ + /* */ + /* <Output> */ + /* big_metrics :: A big SBit metrics structure for the glyph. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The stream cursor must be positioned at the glyph's offset within */ + /* the `EBDT' table before the call. */ + /* */ + /* If the image format uses variable metrics, the stream cursor is */ + /* positioned just after the metrics header in the `EBDT' table on */ + /* function exit. */ + /* */ + typedef FT_Error + (*TT_Load_SBit_Metrics_Func)( FT_Stream stream, + TT_SBit_Range range, + TT_SBit_Metrics metrics ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_SBit_Image_Func */ + /* */ + /* <Description> */ + /* Loads a given glyph sbit image from the font resource. This also */ + /* returns its metrics. */ + /* */ + /* <Input> */ + /* face :: */ + /* The target face object. */ + /* */ + /* strike_index :: */ + /* The strike index. */ + /* */ + /* glyph_index :: */ + /* The current glyph index. */ + /* */ + /* load_flags :: */ + /* The current load flags. */ + /* */ + /* stream :: */ + /* The input stream. */ + /* */ + /* <Output> */ + /* amap :: */ + /* The target pixmap. */ + /* */ + /* ametrics :: */ + /* A big sbit metrics structure for the glyph image. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. Returns an error if no */ + /* glyph sbit exists for the index. */ + /* */ + /* <Note> */ + /* The `map.buffer' field is always freed before the glyph is loaded. */ + /* */ + typedef FT_Error + (*TT_Load_SBit_Image_Func)( TT_Face face, + FT_ULong strike_index, + FT_UInt glyph_index, + FT_UInt load_flags, + FT_Stream stream, + FT_Bitmap *amap, + TT_SBit_MetricsRec *ametrics ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Set_SBit_Strike_Func */ + /* */ + /* <Description> */ + /* Selects an sbit strike for given horizontal and vertical ppem */ + /* values. */ + /* */ + /* <Input> */ + /* face :: The target face object. */ + /* */ + /* x_ppem :: The horizontal resolution in points per EM. */ + /* */ + /* y_ppem :: The vertical resolution in points per EM. */ + /* */ + /* <Output> */ + /* astrike_index :: The index of the sbit strike. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. Returns an error if no */ + /* sbit strike exists for the selected ppem values. */ + /* */ + typedef FT_Error + (*TT_Set_SBit_Strike_Func)( TT_Face face, + FT_UInt x_ppem, + FT_UInt y_ppem, + FT_ULong *astrike_index ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Get_PS_Name_Func */ + /* */ + /* <Description> */ + /* Gets the PostScript glyph name of a glyph. */ + /* */ + /* <Input> */ + /* idx :: The glyph index. */ + /* */ + /* PSname :: The address of a string pointer. Will be NULL in case */ + /* of error, otherwise it is a pointer to the glyph name. */ + /* */ + /* You must not modify the returned string! */ + /* */ + /* <Output> */ + /* FreeType error code. 0 means success. */ + /* */ + typedef FT_Error + (*TT_Get_PS_Name_Func)( TT_Face face, + FT_UInt idx, + FT_String** PSname ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_Metrics_Func */ + /* */ + /* <Description> */ + /* Loads the horizontal or vertical header in a face object. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* vertical :: A boolean flag. If set, load vertical metrics. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + typedef FT_Error + (*TT_Load_Metrics_Func)( TT_Face face, + FT_Stream stream, + FT_Bool vertical ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Load_Table_Func */ + /* */ + /* <Description> */ + /* Loads a given TrueType table. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The function will use `face->goto_table' to seek the stream to */ + /* the start of the table. */ + /* */ + typedef FT_Error + (*TT_Load_Table_Func)( TT_Face face, + FT_Stream stream ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Free_Table_Func */ + /* */ + /* <Description> */ + /* Frees a given TrueType table. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + typedef void + (*TT_Free_Table_Func)( TT_Face face ); + + + /* + * @functype: + * TT_Face_GetKerningFunc + * + * @description: + * Return the horizontal kerning value between two glyphs. + * + * @input: + * face :: A handle to the source face object. + * left_glyph :: The left glyph index. + * right_glyph :: The right glyph index. + * + * @return: + * The kerning value in font units. + */ + typedef FT_Int + (*TT_Face_GetKerningFunc)( TT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph ); + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* SFNT_Interface */ + /* */ + /* <Description> */ + /* This structure holds pointers to the functions used to load and */ + /* free the basic tables that are required in a `sfnt' font file. */ + /* */ + /* <Fields> */ + /* Check the various xxx_Func() descriptions for details. */ + /* */ + typedef struct SFNT_Interface_ + { + TT_Loader_GotoTableFunc goto_table; + + TT_Init_Face_Func init_face; + TT_Load_Face_Func load_face; + TT_Done_Face_Func done_face; + FT_Module_Requester get_interface; + + TT_Load_Any_Func load_any; + TT_Load_SFNT_HeaderRec_Func load_sfnt_header; + TT_Load_Directory_Func load_directory; + + /* these functions are called by `load_face' but they can also */ + /* be called from external modules, if there is a need to do so */ + TT_Load_Table_Func load_header; + TT_Load_Metrics_Func load_metrics; + TT_Load_Table_Func load_charmaps; + TT_Load_Table_Func load_max_profile; + TT_Load_Table_Func load_os2; + TT_Load_Table_Func load_psnames; + + TT_Load_Table_Func load_names; + TT_Free_Table_Func free_names; + + /* optional tables */ + TT_Load_Table_Func load_hdmx; + TT_Free_Table_Func free_hdmx; + + TT_Load_Table_Func load_kerning; + TT_Load_Table_Func load_gasp; + TT_Load_Table_Func load_pclt; + + /* see `ttload.h' */ + TT_Load_Table_Func load_bitmap_header; + + /* see `ttsbit.h' */ + TT_Set_SBit_Strike_Func set_sbit_strike; + TT_Load_Table_Func load_sbits; + TT_Find_SBit_Image_Func find_sbit_image; + TT_Load_SBit_Metrics_Func load_sbit_metrics; + TT_Load_SBit_Image_Func load_sbit_image; + TT_Free_Table_Func free_sbits; + + /* see `ttkern.h' */ + TT_Face_GetKerningFunc get_kerning; + + /* see `ttpost.h' */ + TT_Get_PS_Name_Func get_psname; + TT_Free_Table_Func free_psnames; + + } SFNT_Interface; + + + /* transitional */ + typedef SFNT_Interface* SFNT_Service; + + +FT_END_HEADER + +#endif /* __SFNT_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svbdf.h b/extlibs/headers/freetype/internal/svbdf.h new file mode 100644 index 00000000..0f7fc611 --- /dev/null +++ b/extlibs/headers/freetype/internal/svbdf.h @@ -0,0 +1,57 @@ +/***************************************************************************/ +/* */ +/* svbdf.h */ +/* */ +/* The FreeType BDF services (specification). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVBDF_H__ +#define __SVBDF_H__ + +#include FT_BDF_H +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_BDF "bdf" + + typedef FT_Error + (*FT_BDF_GetCharsetIdFunc)( FT_Face face, + const char* *acharset_encoding, + const char* *acharset_registry ); + + typedef FT_Error + (*FT_BDF_GetPropertyFunc)( FT_Face face, + const char* prop_name, + BDF_PropertyRec *aproperty ); + + + FT_DEFINE_SERVICE( BDF ) + { + FT_BDF_GetCharsetIdFunc get_charset_id; + FT_BDF_GetPropertyFunc get_property; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVBDF_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svgldict.h b/extlibs/headers/freetype/internal/svgldict.h new file mode 100644 index 00000000..e5e56b25 --- /dev/null +++ b/extlibs/headers/freetype/internal/svgldict.h @@ -0,0 +1,60 @@ +/***************************************************************************/ +/* */ +/* svgldict.h */ +/* */ +/* The FreeType glyph dictionary services (specification). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVGLDICT_H__ +#define __SVGLDICT_H__ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + + /* + * A service used to retrieve glyph names, as well as to find the + * index of a given glyph name in a font. + * + */ + +#define FT_SERVICE_ID_GLYPH_DICT "glyph-dict" + + + typedef FT_Error + (*FT_GlyphDict_GetNameFunc)( FT_Face face, + FT_UInt glyph_index, + FT_Pointer buffer, + FT_UInt buffer_max ); + + typedef FT_UInt + (*FT_GlyphDict_NameIndexFunc)( FT_Face face, + FT_String* glyph_name ); + + + FT_DEFINE_SERVICE( GlyphDict ) + { + FT_GlyphDict_GetNameFunc get_name; + FT_GlyphDict_NameIndexFunc name_index; /* optional */ + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVGLDICT_H__ */ diff --git a/extlibs/headers/freetype/internal/svmm.h b/extlibs/headers/freetype/internal/svmm.h new file mode 100644 index 00000000..8a99ec4b --- /dev/null +++ b/extlibs/headers/freetype/internal/svmm.h @@ -0,0 +1,79 @@ +/***************************************************************************/ +/* */ +/* svmm.h */ +/* */ +/* The FreeType Multiple Masters and GX var services (specification). */ +/* */ +/* Copyright 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVMM_H__ +#define __SVMM_H__ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + + /* + * A service used to manage multiple-masters data in a given face. + * + * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H). + * + */ + +#define FT_SERVICE_ID_MULTI_MASTERS "multi-masters" + + + typedef FT_Error + (*FT_Get_MM_Func)( FT_Face face, + FT_Multi_Master* master ); + + typedef FT_Error + (*FT_Get_MM_Var_Func)( FT_Face face, + FT_MM_Var* *master ); + + typedef FT_Error + (*FT_Set_MM_Design_Func)( FT_Face face, + FT_UInt num_coords, + FT_Long* coords ); + + typedef FT_Error + (*FT_Set_Var_Design_Func)( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + typedef FT_Error + (*FT_Set_MM_Blend_Func)( FT_Face face, + FT_UInt num_coords, + FT_Long* coords ); + + + FT_DEFINE_SERVICE( MultiMasters ) + { + FT_Get_MM_Func get_mm; + FT_Set_MM_Design_Func set_mm_design; + FT_Set_MM_Blend_Func set_mm_blend; + FT_Get_MM_Var_Func get_mm_var; + FT_Set_Var_Design_Func set_var_design; + }; + + /* */ + + +FT_END_HEADER + +#endif /* __SVMM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svotval.h b/extlibs/headers/freetype/internal/svotval.h new file mode 100644 index 00000000..fbe45d0d --- /dev/null +++ b/extlibs/headers/freetype/internal/svotval.h @@ -0,0 +1,53 @@ +/***************************************************************************/ +/* */ +/* svotval.h */ +/* */ +/* The FreeType OpenType validation service (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVOTVAL_H__ +#define __SVOTVAL_H__ + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate" + + + typedef FT_Error + (*otv_validate_func)( FT_Face face, + FT_UInt ot_flags, + FT_Bytes *base, + FT_Bytes *gdef, + FT_Bytes *gpos, + FT_Bytes *gsub, + FT_Bytes *jstf ); + + + FT_DEFINE_SERVICE( OTvalidate ) + { + otv_validate_func validate; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVOTVAL_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svpfr.h b/extlibs/headers/freetype/internal/svpfr.h new file mode 100644 index 00000000..b6105054 --- /dev/null +++ b/extlibs/headers/freetype/internal/svpfr.h @@ -0,0 +1,65 @@ +/***************************************************************************/ +/* */ +/* svpfr.h */ +/* */ +/* Internal PFR service functions (specification). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVPFR_H__ +#define __SVPFR_H__ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_PFR_METRICS "pfr-metrics" + + + typedef FT_Error + (*FT_PFR_GetMetricsFunc)( FT_Face face, + FT_UInt *aoutline, + FT_UInt *ametrics, + FT_Fixed *ax_scale, + FT_Fixed *ay_scale ); + + typedef FT_Error + (*FT_PFR_GetKerningFunc)( FT_Face face, + FT_UInt left, + FT_UInt right, + FT_Vector *avector ); + + typedef FT_Error + (*FT_PFR_GetAdvanceFunc)( FT_Face face, + FT_UInt gindex, + FT_Pos *aadvance ); + + + FT_DEFINE_SERVICE( PfrMetrics ) + { + FT_PFR_GetMetricsFunc get_metrics; + FT_PFR_GetKerningFunc get_kerning; + FT_PFR_GetAdvanceFunc get_advance; + + }; + + /* */ + +FT_END_HEADER + +#endif /* __SVPFR_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svpostnm.h b/extlibs/headers/freetype/internal/svpostnm.h new file mode 100644 index 00000000..7f1700ad --- /dev/null +++ b/extlibs/headers/freetype/internal/svpostnm.h @@ -0,0 +1,58 @@ +/***************************************************************************/ +/* */ +/* svpostnm.h */ +/* */ +/* The FreeType PostScript name services (specification). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVPOSTNM_H__ +#define __SVPOSTNM_H__ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + /* + * A trivial service used to retrieve the PostScript name of a given + * font when available. The `get_name' field should never be NULL. + * + * The correponding function can return NULL to indicate that the + * PostScript name is not available. + * + * The name is owned by the face and will be destroyed with it. + */ + +#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name" + + + typedef const char* + (*FT_PsName_GetFunc)( FT_Face face ); + + + FT_DEFINE_SERVICE( PsFontName ) + { + FT_PsName_GetFunc get_ps_font_name; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVPOSTNM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svpscmap.h b/extlibs/headers/freetype/internal/svpscmap.h new file mode 100644 index 00000000..ade96ef8 --- /dev/null +++ b/extlibs/headers/freetype/internal/svpscmap.h @@ -0,0 +1,113 @@ +/***************************************************************************/ +/* */ +/* svpscmap.h */ +/* */ +/* The FreeType PostScript charmap service (specification). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVPSCMAP_H__ +#define __SVPSCMAP_H__ + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps" + + + /* + * Adobe glyph name to unicode value + */ + typedef FT_UInt32 + (*PS_Unicode_ValueFunc)( const char* glyph_name ); + + /* + * Unicode value to Adobe glyph name index. 0xFFFF if not found. + */ + typedef FT_UInt + (*PS_Unicode_Index_Func)( FT_UInt num_glyphs, + const char** glyph_names, + FT_ULong unicode ); + + /* + * Macintosh name id to glyph name. NULL if invalid index. + */ + typedef const char* + (*PS_Macintosh_Name_Func)( FT_UInt name_index ); + + /* + * Adobe standard string ID to glyph name. NULL if invalid index. + */ + typedef const char* + (*PS_Adobe_Std_Strings_Func)( FT_UInt string_index ); + + /* + * Simple unicode -> glyph index charmap built from font glyph names + * table. + */ + typedef struct PS_UniMap_ + { + FT_UInt unicode; + FT_UInt glyph_index; + + } PS_UniMap; + + + typedef struct PS_Unicodes_ + { + FT_UInt num_maps; + PS_UniMap* maps; + + } PS_Unicodes; + + + typedef FT_Error + (*PS_Unicodes_InitFunc)( FT_Memory memory, + FT_UInt num_glyphs, + const char** glyph_names, + PS_Unicodes* unicodes ); + + typedef FT_UInt + (*PS_Unicodes_CharIndexFunc)( PS_Unicodes* unicodes, + FT_UInt unicode ); + + typedef FT_ULong + (*PS_Unicodes_CharNextFunc)( PS_Unicodes* unicodes, + FT_ULong unicode ); + + + FT_DEFINE_SERVICE( PsCMaps ) + { + PS_Unicode_ValueFunc unicode_value; + + PS_Unicodes_InitFunc unicodes_init; + PS_Unicodes_CharIndexFunc unicodes_char_index; + PS_Unicodes_CharNextFunc unicodes_char_next; + + PS_Macintosh_Name_Func macintosh_name; + PS_Adobe_Std_Strings_Func adobe_std_strings; + const unsigned short* adobe_std_encoding; + const unsigned short* adobe_expert_encoding; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVPSCMAP_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svpsinfo.h b/extlibs/headers/freetype/internal/svpsinfo.h new file mode 100644 index 00000000..63f5db9c --- /dev/null +++ b/extlibs/headers/freetype/internal/svpsinfo.h @@ -0,0 +1,60 @@ +/***************************************************************************/ +/* */ +/* svpsinfo.h */ +/* */ +/* The FreeType PostScript info service (specification). */ +/* */ +/* Copyright 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVPSINFO_H__ +#define __SVPSINFO_H__ + +#include FT_INTERNAL_SERVICE_H +#include FT_INTERNAL_TYPE1_TYPES_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info" + + + typedef FT_Error + (*PS_GetFontInfoFunc)( FT_Face face, + PS_FontInfoRec* afont_info ); + + typedef FT_Int + (*PS_HasGlyphNamesFunc)( FT_Face face ); + + typedef FT_Error + (*PS_GetFontPrivateFunc)( FT_Face face, + PS_PrivateRec* afont_private ); + + + FT_DEFINE_SERVICE( PsInfo ) + { + PS_GetFontInfoFunc ps_get_font_info; + PS_HasGlyphNamesFunc ps_has_glyph_names; + PS_GetFontPrivateFunc ps_get_font_private; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVPSINFO_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svsfnt.h b/extlibs/headers/freetype/internal/svsfnt.h new file mode 100644 index 00000000..87346c6d --- /dev/null +++ b/extlibs/headers/freetype/internal/svsfnt.h @@ -0,0 +1,80 @@ +/***************************************************************************/ +/* */ +/* svsfnt.h */ +/* */ +/* The FreeType SFNT table loading service (specification). */ +/* */ +/* Copyright 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVSFNT_H__ +#define __SVSFNT_H__ + +#include FT_INTERNAL_SERVICE_H +#include FT_TRUETYPE_TABLES_H + + +FT_BEGIN_HEADER + + + /* + * SFNT table loading service. + */ + +#define FT_SERVICE_ID_SFNT_TABLE "sfnt-table" + + + /* + * Used to implement FT_Load_Sfnt_Table(). + */ + typedef FT_Error + (*FT_SFNT_TableLoadFunc)( FT_Face face, + FT_ULong tag, + FT_Long offset, + FT_Byte* buffer, + FT_ULong* length ); + + /* + * Used to implement FT_Get_Sfnt_Table(). + */ + typedef void* + (*FT_SFNT_TableGetFunc)( FT_Face face, + FT_Sfnt_Tag tag ); + + + /* + * Used to implement FT_Sfnt_Table_Info(). + */ + typedef FT_Error + (*FT_SFNT_TableInfoFunc)( FT_Face face, + FT_UInt idx, + FT_ULong *tag, + FT_ULong *length ); + + + FT_DEFINE_SERVICE( SFNT_Table ) + { + FT_SFNT_TableLoadFunc load_table; + FT_SFNT_TableGetFunc get_table; + FT_SFNT_TableInfoFunc table_info; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVSFNT_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svttcmap.h b/extlibs/headers/freetype/internal/svttcmap.h new file mode 100644 index 00000000..f92fcd0e --- /dev/null +++ b/extlibs/headers/freetype/internal/svttcmap.h @@ -0,0 +1,77 @@ +/***************************************************************************/ +/* */ +/* svsttcmap.h */ +/* */ +/* The FreeType TrueType/sfnt cmap extra information service. */ +/* */ +/* Copyright 2003 by */ +/* Masatake YAMATO, Redhat K.K. */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +/* Development of this service is support of + Information-technology Promotion Agency, Japan. */ + +#ifndef __SVTTCMAP_H__ +#define __SVTTCMAP_H__ + +#include FT_INTERNAL_SERVICE_H +#include FT_TRUETYPE_TABLES_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_TT_CMAP "tt-cmaps" + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_CMapInfo */ + /* */ + /* <Description> */ + /* A structure used to store TrueType/sfnt specific cmap information */ + /* which is not covered by the generic @FT_CharMap structure. This */ + /* structure can be accessed with the @FT_Get_TT_CMap_Info function. */ + /* */ + /* <Fields> */ + /* language :: */ + /* The language ID used in Mac fonts. Definitions of values are in */ + /* freetype/ttnameid.h. */ + /* */ + typedef struct TT_CMapInfo_ + { + FT_ULong language; + + } TT_CMapInfo; + + + typedef FT_Error + (*TT_CMap_Info_GetFunc)( FT_CharMap charmap, + TT_CMapInfo *cmap_info ); + + + FT_DEFINE_SERVICE( TTCMaps ) + { + TT_CMap_Info_GetFunc get_cmap_info; + }; + + /* */ + + +FT_END_HEADER + +#endif /* __SVTTCMAP_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svwinfnt.h b/extlibs/headers/freetype/internal/svwinfnt.h new file mode 100644 index 00000000..57f7765d --- /dev/null +++ b/extlibs/headers/freetype/internal/svwinfnt.h @@ -0,0 +1,50 @@ +/***************************************************************************/ +/* */ +/* svwinfnt.h */ +/* */ +/* The FreeType Windows FNT/FONT service (specification). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVWINFNT_H__ +#define __SVWINFNT_H__ + +#include FT_INTERNAL_SERVICE_H +#include FT_WINFONTS_H + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_WINFNT "winfonts" + + typedef FT_Error + (*FT_WinFnt_GetHeaderFunc)( FT_Face face, + FT_WinFNT_HeaderRec *aheader ); + + + FT_DEFINE_SERVICE( WinFnt ) + { + FT_WinFnt_GetHeaderFunc get_header; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVWINFNT_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/svxf86nm.h b/extlibs/headers/freetype/internal/svxf86nm.h new file mode 100644 index 00000000..3a33abcd --- /dev/null +++ b/extlibs/headers/freetype/internal/svxf86nm.h @@ -0,0 +1,55 @@ +/***************************************************************************/ +/* */ +/* svxf86nm.h */ +/* */ +/* The FreeType XFree86 services (specification only). */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVXF86NM_H__ +#define __SVXF86NM_H__ + +#include FT_INTERNAL_SERVICE_H + + +FT_BEGIN_HEADER + + + /* + * A trivial service used to return the name of a face's font driver, + * according to the XFree86 nomenclature. Note that the service data + * is a simple constant string pointer. + */ + +#define FT_SERVICE_ID_XF86_NAME "xf86-driver-name" + +#define FT_XF86_FORMAT_TRUETYPE "TrueType" +#define FT_XF86_FORMAT_TYPE_1 "Type 1" +#define FT_XF86_FORMAT_BDF "BDF" +#define FT_XF86_FORMAT_PCF "PCF" +#define FT_XF86_FORMAT_TYPE_42 "Type 42" +#define FT_XF86_FORMAT_CID "CID Type 1" +#define FT_XF86_FORMAT_CFF "CFF" +#define FT_XF86_FORMAT_PFR "PFR" +#define FT_XF86_FORMAT_WINFNT "Windows FNT" + + /* */ + + +FT_END_HEADER + + +#endif /* __SVXF86NM_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/t1types.h b/extlibs/headers/freetype/internal/t1types.h new file mode 100644 index 00000000..702bb1e4 --- /dev/null +++ b/extlibs/headers/freetype/internal/t1types.h @@ -0,0 +1,191 @@ +/***************************************************************************/ +/* */ +/* t1types.h */ +/* */ +/* Basic Type1/Type2 type definitions and interface (specification */ +/* only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __T1TYPES_H__ +#define __T1TYPES_H__ + + +#include <ft2build.h> +#include FT_TYPE1_TABLES_H +#include FT_INTERNAL_POSTSCRIPT_HINTS_H +#include FT_INTERNAL_SERVICE_H +#include FT_SERVICE_POSTSCRIPT_CMAPS_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* T1_EncodingRec */ + /* */ + /* <Description> */ + /* A structure modeling a custom encoding. */ + /* */ + /* <Fields> */ + /* num_chars :: The number of character codes in the encoding. */ + /* Usually 256. */ + /* */ + /* code_first :: The lowest valid character code in the encoding. */ + /* */ + /* code_last :: The highest valid character code in the encoding. */ + /* */ + /* char_index :: An array of corresponding glyph indices. */ + /* */ + /* char_name :: An array of corresponding glyph names. */ + /* */ + typedef struct T1_EncodingRecRec_ + { + FT_Int num_chars; + FT_Int code_first; + FT_Int code_last; + + FT_UShort* char_index; + FT_String** char_name; + + } T1_EncodingRec, *T1_Encoding; + + + typedef enum T1_EncodingType_ + { + T1_ENCODING_TYPE_NONE = 0, + T1_ENCODING_TYPE_ARRAY, + T1_ENCODING_TYPE_STANDARD, + T1_ENCODING_TYPE_ISOLATIN1, + T1_ENCODING_TYPE_EXPERT + + } T1_EncodingType; + + + typedef struct T1_FontRec_ + { + PS_FontInfoRec font_info; /* font info dictionary */ + PS_PrivateRec private_dict; /* private dictionary */ + FT_String* font_name; /* top-level dictionary */ + + T1_EncodingType encoding_type; + T1_EncodingRec encoding; + + FT_Byte* subrs_block; + FT_Byte* charstrings_block; + FT_Byte* glyph_names_block; + + FT_Int num_subrs; + FT_Byte** subrs; + FT_PtrDist* subrs_len; + + FT_Int num_glyphs; + FT_String** glyph_names; /* array of glyph names */ + FT_Byte** charstrings; /* array of glyph charstrings */ + FT_PtrDist* charstrings_len; + + FT_Byte paint_type; + FT_Byte font_type; + FT_Matrix font_matrix; + FT_Vector font_offset; + FT_BBox font_bbox; + FT_Long font_id; + + FT_Fixed stroke_width; + + } T1_FontRec, *T1_Font; + + + typedef struct CID_SubrsRec_ + { + FT_UInt num_subrs; + FT_Byte** code; + + } CID_SubrsRec, *CID_Subrs; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** ORIGINAL T1_FACE CLASS DEFINITION ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct T1_FaceRec_* T1_Face; + typedef struct CID_FaceRec_* CID_Face; + + + typedef struct T1_FaceRec_ + { + FT_FaceRec root; + T1_FontRec type1; + const void* psnames; + const void* psaux; + const void* afm_data; + FT_CharMapRec charmaprecs[2]; + FT_CharMap charmaps[2]; + PS_Unicodes unicode_map; + + /* support for Multiple Masters fonts */ + PS_Blend blend; + + /* since FT 2.1 - interface to PostScript hinter */ + const void* pshinter; + + } T1_FaceRec; + + + typedef struct CID_FaceRec_ + { + FT_FaceRec root; + void* psnames; + void* psaux; + CID_FaceInfoRec cid; + void* afm_data; + FT_Byte* binary_data; /* used if hex data has been converted */ + FT_Stream cid_stream; + CID_Subrs subrs; + + /* since FT 2.1 - interface to PostScript hinter */ + void* pshinter; + + } CID_FaceRec; + + +FT_END_HEADER + +#endif /* __T1TYPES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/internal/tttypes.h b/extlibs/headers/freetype/internal/tttypes.h new file mode 100644 index 00000000..7f8335f8 --- /dev/null +++ b/extlibs/headers/freetype/internal/tttypes.h @@ -0,0 +1,1457 @@ +/***************************************************************************/ +/* */ +/* tttypes.h */ +/* */ +/* Basic SFNT/TrueType type definitions and interface (specification */ +/* only). */ +/* */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTTYPES_H__ +#define __TTTYPES_H__ + + +#include <ft2build.h> +#include FT_TRUETYPE_TABLES_H +#include FT_INTERNAL_OBJECTS_H + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TTC_HeaderRec */ + /* */ + /* <Description> */ + /* TrueType collection header. This table contains the offsets of */ + /* the font headers of each distinct TrueType face in the file. */ + /* */ + /* <Fields> */ + /* tag :: Must be `ttc ' to indicate a TrueType collection. */ + /* */ + /* version :: The version number. */ + /* */ + /* count :: The number of faces in the collection. The */ + /* specification says this should be an unsigned long, but */ + /* we use a signed long since we need the value -1 for */ + /* specific purposes. */ + /* */ + /* offsets :: The offsets of the font headers, one per face. */ + /* */ + typedef struct TTC_HeaderRec_ + { + FT_ULong tag; + FT_Fixed version; + FT_Long count; + FT_ULong* offsets; + + } TTC_HeaderRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* SFNT_HeaderRec */ + /* */ + /* <Description> */ + /* SFNT file format header. */ + /* */ + /* <Fields> */ + /* format_tag :: The font format tag. */ + /* */ + /* num_tables :: The number of tables in file. */ + /* */ + /* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */ + /* */ + /* entry_selector :: Must be log2 of `search_range / 16'. */ + /* */ + /* range_shift :: Must be `num_tables * 16 - search_range'. */ + /* */ + typedef struct SFNT_HeaderRec_ + { + FT_ULong format_tag; + FT_UShort num_tables; + FT_UShort search_range; + FT_UShort entry_selector; + FT_UShort range_shift; + + FT_ULong offset; /* not in file */ + + } SFNT_HeaderRec, *SFNT_Header; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_TableRec */ + /* */ + /* <Description> */ + /* This structure describes a given table of a TrueType font. */ + /* */ + /* <Fields> */ + /* Tag :: A four-bytes tag describing the table. */ + /* */ + /* CheckSum :: The table checksum. This value can be ignored. */ + /* */ + /* Offset :: The offset of the table from the start of the TrueType */ + /* font in its resource. */ + /* */ + /* Length :: The table length (in bytes). */ + /* */ + typedef struct TT_TableRec_ + { + FT_ULong Tag; /* table type */ + FT_ULong CheckSum; /* table checksum */ + FT_ULong Offset; /* table file offset */ + FT_ULong Length; /* table length */ + + } TT_TableRec, *TT_Table; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_LongMetricsRec */ + /* */ + /* <Description> */ + /* A structure modeling the long metrics of the `hmtx' and `vmtx' */ + /* TrueType tables. The values are expressed in font units. */ + /* */ + /* <Fields> */ + /* advance :: The advance width or height for the glyph. */ + /* */ + /* bearing :: The left-side or top-side bearing for the glyph. */ + /* */ + typedef struct TT_LongMetricsRec_ + { + FT_UShort advance; + FT_Short bearing; + + } TT_LongMetricsRec, *TT_LongMetrics; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* TT_ShortMetrics */ + /* */ + /* <Description> */ + /* A simple type to model the short metrics of the `hmtx' and `vmtx' */ + /* tables. */ + /* */ + typedef FT_Short TT_ShortMetrics; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_NameEntryRec */ + /* */ + /* <Description> */ + /* A structure modeling TrueType name records. Name records are used */ + /* to store important strings like family name, style name, */ + /* copyright, etc. in _localized_ versions (i.e., language, encoding, */ + /* etc). */ + /* */ + /* <Fields> */ + /* platformID :: The ID of the name's encoding platform. */ + /* */ + /* encodingID :: The platform-specific ID for the name's encoding. */ + /* */ + /* languageID :: The platform-specific ID for the name's language. */ + /* */ + /* nameID :: The ID specifying what kind of name this is. */ + /* */ + /* stringLength :: The length of the string in bytes. */ + /* */ + /* stringOffset :: The offset to the string in the `name' table. */ + /* */ + /* string :: A pointer to the string's bytes. Note that these */ + /* are usually UTF-16 encoded characters. */ + /* */ + typedef struct TT_NameEntryRec_ + { + FT_UShort platformID; + FT_UShort encodingID; + FT_UShort languageID; + FT_UShort nameID; + FT_UShort stringLength; + FT_ULong stringOffset; + + /* this last field is not defined in the spec */ + /* but used by the FreeType engine */ + + FT_Byte* string; + + } TT_NameEntryRec, *TT_NameEntry; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_NameTableRec */ + /* */ + /* <Description> */ + /* A structure modeling the TrueType name table. */ + /* */ + /* <Fields> */ + /* format :: The format of the name table. */ + /* */ + /* numNameRecords :: The number of names in table. */ + /* */ + /* storageOffset :: The offset of the name table in the `name' */ + /* TrueType table. */ + /* */ + /* names :: An array of name records. */ + /* */ + /* stream :: the file's input stream. */ + /* */ + typedef struct TT_NameTableRec_ + { + FT_UShort format; + FT_UInt numNameRecords; + FT_UInt storageOffset; + TT_NameEntryRec* names; + FT_Stream stream; + + } TT_NameTableRec, *TT_NameTable; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_GaspRangeRec */ + /* */ + /* <Description> */ + /* A tiny structure used to model a gasp range according to the */ + /* TrueType specification. */ + /* */ + /* <Fields> */ + /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */ + /* */ + /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */ + /* modes to be used. */ + /* */ + typedef struct TT_GaspRangeRec_ + { + FT_UShort maxPPEM; + FT_UShort gaspFlag; + + } TT_GaspRangeRec, *TT_GaspRange; + + +#define TT_GASP_GRIDFIT 0x01 +#define TT_GASP_DOGRAY 0x02 + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_GaspRec */ + /* */ + /* <Description> */ + /* A structure modeling the TrueType `gasp' table used to specify */ + /* grid-fitting and anti-aliasing behaviour. */ + /* */ + /* <Fields> */ + /* version :: The version number. */ + /* */ + /* numRanges :: The number of gasp ranges in table. */ + /* */ + /* gaspRanges :: An array of gasp ranges. */ + /* */ + typedef struct TT_Gasp_ + { + FT_UShort version; + FT_UShort numRanges; + TT_GaspRange gaspRanges; + + } TT_GaspRec; + + +#ifndef FT_OPTIMIZE_MEMORY + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_HdmxEntryRec */ + /* */ + /* <Description> */ + /* A small structure used to model the pre-computed widths of a given */ + /* size. They are found in the `hdmx' table. */ + /* */ + /* <Fields> */ + /* ppem :: The pixels per EM value at which these metrics apply. */ + /* */ + /* max_width :: The maximum advance width for this metric. */ + /* */ + /* widths :: An array of widths. Note: These are 8-bit bytes. */ + /* */ + typedef struct TT_HdmxEntryRec_ + { + FT_Byte ppem; + FT_Byte max_width; + FT_Byte* widths; + + } TT_HdmxEntryRec, *TT_HdmxEntry; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_HdmxRec */ + /* */ + /* <Description> */ + /* A structure used to model the `hdmx' table, which contains */ + /* pre-computed widths for a set of given sizes/dimensions. */ + /* */ + /* <Fields> */ + /* version :: The version number. */ + /* */ + /* num_records :: The number of hdmx records. */ + /* */ + /* records :: An array of hdmx records. */ + /* */ + typedef struct TT_HdmxRec_ + { + FT_UShort version; + FT_Short num_records; + TT_HdmxEntry records; + + } TT_HdmxRec, *TT_Hdmx; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_Kern0_PairRec */ + /* */ + /* <Description> */ + /* A structure used to model a kerning pair for the kerning table */ + /* format 0. The engine now loads this table if it finds one in the */ + /* font file. */ + /* */ + /* <Fields> */ + /* left :: The index of the left glyph in pair. */ + /* */ + /* right :: The index of the right glyph in pair. */ + /* */ + /* value :: The kerning distance. A positive value spaces the */ + /* glyphs, a negative one makes them closer. */ + /* */ + typedef struct TT_Kern0_PairRec_ + { + FT_UShort left; /* index of left glyph in pair */ + FT_UShort right; /* index of right glyph in pair */ + FT_FWord value; /* kerning value */ + + } TT_Kern0_PairRec, *TT_Kern0_Pair; + +#endif /* !OPTIMIZE_MEMORY */ + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** EMBEDDED BITMAPS SUPPORT ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_MetricsRec */ + /* */ + /* <Description> */ + /* A structure used to hold the big metrics of a given glyph bitmap */ + /* in a TrueType or OpenType font. These are usually found in the */ + /* `EBDT' (Microsoft) or `bloc' (Apple) table. */ + /* */ + /* <Fields> */ + /* height :: The glyph height in pixels. */ + /* */ + /* width :: The glyph width in pixels. */ + /* */ + /* horiBearingX :: The horizontal left bearing. */ + /* */ + /* horiBearingY :: The horizontal top bearing. */ + /* */ + /* horiAdvance :: The horizontal advance. */ + /* */ + /* vertBearingX :: The vertical left bearing. */ + /* */ + /* vertBearingY :: The vertical top bearing. */ + /* */ + /* vertAdvance :: The vertical advance. */ + /* */ + typedef struct TT_SBit_MetricsRec_ + { + FT_Byte height; + FT_Byte width; + + FT_Char horiBearingX; + FT_Char horiBearingY; + FT_Byte horiAdvance; + + FT_Char vertBearingX; + FT_Char vertBearingY; + FT_Byte vertAdvance; + + } TT_SBit_MetricsRec, *TT_SBit_Metrics; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_SmallMetricsRec */ + /* */ + /* <Description> */ + /* A structure used to hold the small metrics of a given glyph bitmap */ + /* in a TrueType or OpenType font. These are usually found in the */ + /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */ + /* */ + /* <Fields> */ + /* height :: The glyph height in pixels. */ + /* */ + /* width :: The glyph width in pixels. */ + /* */ + /* bearingX :: The left-side bearing. */ + /* */ + /* bearingY :: The top-side bearing. */ + /* */ + /* advance :: The advance width or height. */ + /* */ + typedef struct TT_SBit_Small_Metrics_ + { + FT_Byte height; + FT_Byte width; + + FT_Char bearingX; + FT_Char bearingY; + FT_Byte advance; + + } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_LineMetricsRec */ + /* */ + /* <Description> */ + /* A structure used to describe the text line metrics of a given */ + /* bitmap strike, for either a horizontal or vertical layout. */ + /* */ + /* <Fields> */ + /* ascender :: The ascender in pixels. */ + /* */ + /* descender :: The descender in pixels. */ + /* */ + /* max_width :: The maximum glyph width in pixels. */ + /* */ + /* caret_slope_enumerator :: Rise of the caret slope, typically set */ + /* to 1 for non-italic fonts. */ + /* */ + /* caret_slope_denominator :: Rise of the caret slope, typically set */ + /* to 0 for non-italic fonts. */ + /* */ + /* caret_offset :: Offset in pixels to move the caret for */ + /* proper positioning. */ + /* */ + /* min_origin_SB :: Minimum of horiBearingX (resp. */ + /* vertBearingY). */ + /* min_advance_SB :: Minimum of */ + /* */ + /* horizontal advance - */ + /* ( horiBearingX + width ) */ + /* */ + /* resp. */ + /* */ + /* vertical advance - */ + /* ( vertBearingY + height ) */ + /* */ + /* max_before_BL :: Maximum of horiBearingY (resp. */ + /* vertBearingY). */ + /* */ + /* min_after_BL :: Minimum of */ + /* */ + /* horiBearingY - height */ + /* */ + /* resp. */ + /* */ + /* vertBearingX - width */ + /* */ + /* pads :: Unused (to make the size of the record */ + /* a multiple of 32 bits. */ + /* */ + typedef struct TT_SBit_LineMetricsRec_ + { + FT_Char ascender; + FT_Char descender; + FT_Byte max_width; + FT_Char caret_slope_numerator; + FT_Char caret_slope_denominator; + FT_Char caret_offset; + FT_Char min_origin_SB; + FT_Char min_advance_SB; + FT_Char max_before_BL; + FT_Char min_after_BL; + FT_Char pads[2]; + + } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_RangeRec */ + /* */ + /* <Description> */ + /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */ + /* (Microsoft) or `bloc' (Apple) tables. */ + /* */ + /* <Fields> */ + /* first_glyph :: The first glyph index in the range. */ + /* */ + /* last_glyph :: The last glyph index in the range. */ + /* */ + /* index_format :: The format of index table. Valid values are 1 */ + /* to 5. */ + /* */ + /* image_format :: The format of `EBDT' image data. */ + /* */ + /* image_offset :: The offset to image data in `EBDT'. */ + /* */ + /* image_size :: For index formats 2 and 5. This is the size in */ + /* bytes of each glyph bitmap. */ + /* */ + /* big_metrics :: For index formats 2 and 5. This is the big */ + /* metrics for each glyph bitmap. */ + /* */ + /* num_glyphs :: For index formats 4 and 5. This is the number of */ + /* glyphs in the code array. */ + /* */ + /* glyph_offsets :: For index formats 1 and 3. */ + /* */ + /* glyph_codes :: For index formats 4 and 5. */ + /* */ + /* table_offset :: The offset of the index table in the `EBLC' */ + /* table. Only used during strike loading. */ + /* */ + typedef struct TT_SBit_RangeRec + { + FT_UShort first_glyph; + FT_UShort last_glyph; + + FT_UShort index_format; + FT_UShort image_format; + FT_ULong image_offset; + + FT_ULong image_size; + TT_SBit_MetricsRec metrics; + FT_ULong num_glyphs; + + FT_ULong* glyph_offsets; + FT_UShort* glyph_codes; + + FT_ULong table_offset; + + } TT_SBit_RangeRec, *TT_SBit_Range; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_StrikeRec */ + /* */ + /* <Description> */ + /* A structure used describe a given bitmap strike in the `EBLC' */ + /* (Microsoft) or `bloc' (Apple) tables. */ + /* */ + /* <Fields> */ + /* num_index_ranges :: The number of index ranges. */ + /* */ + /* index_ranges :: An array of glyph index ranges. */ + /* */ + /* color_ref :: Unused. `color_ref' is put in for future */ + /* enhancements, but these fields are already */ + /* in use by other platforms (e.g. Newton). */ + /* For details, please see */ + /* */ + /* http://fonts.apple.com/ */ + /* TTRefMan/RM06/Chap6bloc.html */ + /* */ + /* hori :: The line metrics for horizontal layouts. */ + /* */ + /* vert :: The line metrics for vertical layouts. */ + /* */ + /* start_glyph :: The lowest glyph index for this strike. */ + /* */ + /* end_glyph :: The highest glyph index for this strike. */ + /* */ + /* x_ppem :: The number of horizontal pixels per EM. */ + /* */ + /* y_ppem :: The number of vertical pixels per EM. */ + /* */ + /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */ + /* and 8. */ + /* */ + /* flags :: Is this a vertical or horizontal strike? For */ + /* details, please see */ + /* */ + /* http://fonts.apple.com/ */ + /* TTRefMan/RM06/Chap6bloc.html */ + /* */ + typedef struct TT_SBit_StrikeRec_ + { + FT_Int num_ranges; + TT_SBit_Range sbit_ranges; + FT_ULong ranges_offset; + + FT_ULong color_ref; + + TT_SBit_LineMetricsRec hori; + TT_SBit_LineMetricsRec vert; + + FT_UShort start_glyph; + FT_UShort end_glyph; + + FT_Byte x_ppem; + FT_Byte y_ppem; + + FT_Byte bit_depth; + FT_Char flags; + + } TT_SBit_StrikeRec, *TT_SBit_Strike; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_ComponentRec */ + /* */ + /* <Description> */ + /* A simple structure to describe a compound sbit element. */ + /* */ + /* <Fields> */ + /* glyph_code :: The element's glyph index. */ + /* */ + /* x_offset :: The element's left bearing. */ + /* */ + /* y_offset :: The element's top bearing. */ + /* */ + typedef struct TT_SBit_ComponentRec_ + { + FT_UShort glyph_code; + FT_Char x_offset; + FT_Char y_offset; + + } TT_SBit_ComponentRec, *TT_SBit_Component; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_SBit_ScaleRec */ + /* */ + /* <Description> */ + /* A structure used describe a given bitmap scaling table, as defined */ + /* in the `EBSC' table. */ + /* */ + /* <Fields> */ + /* hori :: The horizontal line metrics. */ + /* */ + /* vert :: The vertical line metrics. */ + /* */ + /* x_ppem :: The number of horizontal pixels per EM. */ + /* */ + /* y_ppem :: The number of vertical pixels per EM. */ + /* */ + /* x_ppem_substitute :: Substitution x_ppem value. */ + /* */ + /* y_ppem_substitute :: Substitution y_ppem value. */ + /* */ + typedef struct TT_SBit_ScaleRec_ + { + TT_SBit_LineMetricsRec hori; + TT_SBit_LineMetricsRec vert; + + FT_Byte x_ppem; + FT_Byte y_ppem; + + FT_Byte x_ppem_substitute; + FT_Byte y_ppem_substitute; + + } TT_SBit_ScaleRec, *TT_SBit_Scale; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_Post_20Rec */ + /* */ + /* <Description> */ + /* Postscript names sub-table, format 2.0. Stores the PS name of */ + /* each glyph in the font face. */ + /* */ + /* <Fields> */ + /* num_glyphs :: The number of named glyphs in the table. */ + /* */ + /* num_names :: The number of PS names stored in the table. */ + /* */ + /* glyph_indices :: The indices of the glyphs in the names arrays. */ + /* */ + /* glyph_names :: The PS names not in Mac Encoding. */ + /* */ + typedef struct TT_Post_20Rec_ + { + FT_UShort num_glyphs; + FT_UShort num_names; + FT_UShort* glyph_indices; + FT_Char** glyph_names; + + } TT_Post_20Rec, *TT_Post_20; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_Post_25Rec */ + /* */ + /* <Description> */ + /* Postscript names sub-table, format 2.5. Stores the PS name of */ + /* each glyph in the font face. */ + /* */ + /* <Fields> */ + /* num_glyphs :: The number of glyphs in the table. */ + /* */ + /* offsets :: An array of signed offsets in a normal Mac */ + /* Postscript name encoding. */ + /* */ + typedef struct TT_Post_25_ + { + FT_UShort num_glyphs; + FT_Char* offsets; + + } TT_Post_25Rec, *TT_Post_25; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_Post_NamesRec */ + /* */ + /* <Description> */ + /* Postscript names table, either format 2.0 or 2.5. */ + /* */ + /* <Fields> */ + /* loaded :: A flag to indicate whether the PS names are loaded. */ + /* */ + /* format_20 :: The sub-table used for format 2.0. */ + /* */ + /* format_25 :: The sub-table used for format 2.5. */ + /* */ + typedef struct TT_Post_NamesRec_ + { + FT_Bool loaded; + + union + { + TT_Post_20Rec format_20; + TT_Post_25Rec format_25; + + } names; + + } TT_Post_NamesRec, *TT_Post_Names; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** GX VARIATION TABLE SUPPORT ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + typedef struct GX_BlendRec_ *GX_Blend; +#endif + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** ORIGINAL TT_FACE CLASS DEFINITION ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This structure/class is defined here because it is common to the */ + /* following formats: TTF, OpenType-TT, and OpenType-CFF. */ + /* */ + /* Note, however, that the classes TT_Size and TT_GlyphSlot are not */ + /* shared between font drivers, and are thus defined in `ttobjs.h'. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* TT_Face */ + /* */ + /* <Description> */ + /* A handle to a TrueType face/font object. A TT_Face encapsulates */ + /* the resolution and scaling independent parts of a TrueType font */ + /* resource. */ + /* */ + /* <Note> */ + /* The TT_Face structure is also used as a `parent class' for the */ + /* OpenType-CFF class (T2_Face). */ + /* */ + typedef struct TT_FaceRec_* TT_Face; + + + /* a function type used for the truetype bytecode interpreter hooks */ + typedef FT_Error + (*TT_Interpreter)( void* exec_context ); + + /* forward declaration */ + typedef struct TT_LoaderRec_* TT_Loader; + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Loader_GotoTableFunc */ + /* */ + /* <Description> */ + /* Seeks a stream to the start of a given TrueType table. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* tag :: A 4-byte tag used to name the table. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* <Output> */ + /* length :: The length of the table in bytes. Set to 0 if not */ + /* needed. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The stream cursor must be at the font file's origin. */ + /* */ + typedef FT_Error + (*TT_Loader_GotoTableFunc)( TT_Face face, + FT_ULong tag, + FT_Stream stream, + FT_ULong* length ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Loader_StartGlyphFunc */ + /* */ + /* <Description> */ + /* Seeks a stream to the start of a given glyph element, and opens a */ + /* frame for it. */ + /* */ + /* <Input> */ + /* loader :: The current TrueType glyph loader object. */ + /* */ + /* glyph index :: The index of the glyph to access. */ + /* */ + /* offset :: The offset of the glyph according to the */ + /* `locations' table. */ + /* */ + /* byte_count :: The size of the frame in bytes. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* This function is normally equivalent to FT_STREAM_SEEK(offset) */ + /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */ + /* but alternative formats (e.g. compressed ones) might use something */ + /* different. */ + /* */ + typedef FT_Error + (*TT_Loader_StartGlyphFunc)( TT_Loader loader, + FT_UInt glyph_index, + FT_ULong offset, + FT_UInt byte_count ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Loader_ReadGlyphFunc */ + /* */ + /* <Description> */ + /* Reads one glyph element (its header, a simple glyph, or a */ + /* composite) from the loader's current stream frame. */ + /* */ + /* <Input> */ + /* loader :: The current TrueType glyph loader object. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + typedef FT_Error + (*TT_Loader_ReadGlyphFunc)( TT_Loader loader ); + + + /*************************************************************************/ + /* */ + /* <FuncType> */ + /* TT_Loader_EndGlyphFunc */ + /* */ + /* <Description> */ + /* Closes the current loader stream frame for the glyph. */ + /* */ + /* <Input> */ + /* loader :: The current TrueType glyph loader object. */ + /* */ + typedef void + (*TT_Loader_EndGlyphFunc)( TT_Loader loader ); + + + /*************************************************************************/ + /* */ + /* TrueType Face Type */ + /* */ + /* <Struct> */ + /* TT_Face */ + /* */ + /* <Description> */ + /* The TrueType face class. These objects model the resolution and */ + /* point-size independent data found in a TrueType font file. */ + /* */ + /* <Fields> */ + /* root :: The base FT_Face structure, managed by the */ + /* base layer. */ + /* */ + /* ttc_header :: The TrueType collection header, used when */ + /* the file is a `ttc' rather than a `ttf'. */ + /* For ordinary font files, the field */ + /* `ttc_header.count' is set to 0. */ + /* */ + /* format_tag :: The font format tag. */ + /* */ + /* num_tables :: The number of TrueType tables in this font */ + /* file. */ + /* */ + /* dir_tables :: The directory of TrueType tables for this */ + /* font file. */ + /* */ + /* header :: The font's font header (`head' table). */ + /* Read on font opening. */ + /* */ + /* horizontal :: The font's horizontal header (`hhea' */ + /* table). This field also contains the */ + /* associated horizontal metrics table */ + /* (`hmtx'). */ + /* */ + /* max_profile :: The font's maximum profile table. Read on */ + /* font opening. Note that some maximum */ + /* values cannot be taken directly from this */ + /* table. We thus define additional fields */ + /* below to hold the computed maxima. */ + /* */ + /* max_components :: The maximum number of glyph components */ + /* required to load any composite glyph from */ + /* this font. Used to size the load stack. */ + /* */ + /* vertical_info :: A boolean which is set when the font file */ + /* contains vertical metrics. If not, the */ + /* value of the `vertical' field is */ + /* undefined. */ + /* */ + /* vertical :: The font's vertical header (`vhea' table). */ + /* This field also contains the associated */ + /* vertical metrics table (`vmtx'), if found. */ + /* IMPORTANT: The contents of this field is */ + /* undefined if the `verticalInfo' field is */ + /* unset. */ + /* */ + /* num_names :: The number of name records within this */ + /* TrueType font. */ + /* */ + /* name_table :: The table of name records (`name'). */ + /* */ + /* os2 :: The font's OS/2 table (`OS/2'). */ + /* */ + /* postscript :: The font's PostScript table (`post' */ + /* table). The PostScript glyph names are */ + /* not loaded by the driver on face opening. */ + /* See the `ttpost' module for more details. */ + /* */ + /* cmap_table :: Address of the face's `cmap' SFNT table */ + /* in memory (it's an extracted frame). */ + /* */ + /* cmap_size :: The size in bytes of the `cmap_table' */ + /* described above. */ + /* */ + /* goto_table :: A function called by each TrueType table */ + /* loader to position a stream's cursor to */ + /* the start of a given table according to */ + /* its tag. It defaults to TT_Goto_Face but */ + /* can be different for strange formats (e.g. */ + /* Type 42). */ + /* */ + /* access_glyph_frame :: A function used to access the frame of a */ + /* given glyph within the face's font file. */ + /* */ + /* forget_glyph_frame :: A function used to forget the frame of a */ + /* given glyph when all data has been loaded. */ + /* */ + /* read_glyph_header :: A function used to read a glyph header. */ + /* It must be called between an `access' and */ + /* `forget'. */ + /* */ + /* read_simple_glyph :: A function used to read a simple glyph. */ + /* It must be called after the header was */ + /* read, and before the `forget'. */ + /* */ + /* read_composite_glyph :: A function used to read a composite glyph. */ + /* It must be called after the header was */ + /* read, and before the `forget'. */ + /* */ + /* sfnt :: A pointer to the SFNT service. */ + /* */ + /* psnames :: A pointer to the PostScript names service. */ + /* */ + /* hdmx :: The face's horizontal device metrics */ + /* (`hdmx' table). This table is optional in */ + /* TrueType/OpenType fonts. */ + /* */ + /* gasp :: The grid-fitting and scaling properties */ + /* table (`gasp'). This table is optional in */ + /* TrueType/OpenType fonts. */ + /* */ + /* pclt :: The `pclt' SFNT table. */ + /* */ + /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */ + /* sizes, embedded in this font. */ + /* */ + /* sbit_strikes :: An array of sbit strikes embedded in this */ + /* font. This table is optional in a */ + /* TrueType/OpenType font. */ + /* */ + /* num_sbit_scales :: The number of sbit scales for this font. */ + /* */ + /* sbit_scales :: Array of sbit scales embedded in this */ + /* font. This table is optional in a */ + /* TrueType/OpenType font. */ + /* */ + /* postscript_names :: A table used to store the Postscript names */ + /* of the glyphs for this font. See the */ + /* file `ttconfig.h' for comments on the */ + /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */ + /* */ + /* num_locations :: The number of glyph locations in this */ + /* TrueType file. This should be */ + /* identical to the number of glyphs. */ + /* Ignored for Type 2 fonts. */ + /* */ + /* glyph_locations :: An array of longs. These are offsets to */ + /* glyph data within the `glyf' table. */ + /* Ignored for Type 2 font faces. */ + /* */ + /* glyf_len :: The length of the `glyf' table. Needed */ + /* for malformed `loca' tables. */ + /* */ + /* font_program_size :: Size in bytecodes of the face's font */ + /* program. 0 if none defined. Ignored for */ + /* Type 2 fonts. */ + /* */ + /* font_program :: The face's font program (bytecode stream) */ + /* executed at load time, also used during */ + /* glyph rendering. Comes from the `fpgm' */ + /* table. Ignored for Type 2 font fonts. */ + /* */ + /* cvt_program_size :: The size in bytecodes of the face's cvt */ + /* program. Ignored for Type 2 fonts. */ + /* */ + /* cvt_program :: The face's cvt program (bytecode stream) */ + /* executed each time an instance/size is */ + /* changed/reset. Comes from the `prep' */ + /* table. Ignored for Type 2 fonts. */ + /* */ + /* cvt_size :: Size of the control value table (in */ + /* entries). Ignored for Type 2 fonts. */ + /* */ + /* cvt :: The face's original control value table. */ + /* Coordinates are expressed in unscaled font */ + /* units. Comes from the `cvt ' table. */ + /* Ignored for Type 2 fonts. */ + /* */ + /* num_kern_pairs :: The number of kerning pairs present in the */ + /* font file. The engine only loads the */ + /* first horizontal format 0 kern table it */ + /* finds in the font file. Ignored for */ + /* Type 2 fonts. */ + /* */ + /* kern_table_index :: The index of the kerning table in the font */ + /* kerning directory. Ignored for Type 2 */ + /* fonts. */ + /* */ + /* interpreter :: A pointer to the TrueType bytecode */ + /* interpreters field is also used to hook */ + /* the debugger in `ttdebug'. */ + /* */ + /* unpatented_hinting :: If true, use only unpatented methods in */ + /* the bytecode interpreter. */ + /* */ + /* doblend :: A boolean which is set if the font should */ + /* be blended (this is for GX var). */ + /* */ + /* blend :: Contains the data needed to control GX */ + /* variation tables (rather like Multiple */ + /* Master data). */ + /* */ + /* extra :: Reserved for third-party font drivers. */ + /* */ + /* postscript_name :: The PS name of the font. Used by the */ + /* postscript name service. */ + /* */ + typedef struct TT_FaceRec_ + { + FT_FaceRec root; + + TTC_HeaderRec ttc_header; + + FT_ULong format_tag; + FT_UShort num_tables; + TT_Table dir_tables; + + TT_Header header; /* TrueType header table */ + TT_HoriHeader horizontal; /* TrueType horizontal header */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* horz_metrics; + FT_ULong horz_metrics_size; +#endif + + TT_MaxProfile max_profile; + FT_ULong max_components; + + FT_Bool vertical_info; + TT_VertHeader vertical; /* TT Vertical header, if present */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* vert_metrics; + FT_ULong vert_metrics_size; +#endif + + FT_UShort num_names; /* number of name records */ + TT_NameTableRec name_table; /* name table */ + + TT_OS2 os2; /* TrueType OS/2 table */ + TT_Postscript postscript; /* TrueType Postscript table */ + + FT_Byte* cmap_table; /* extracted 'cmap' table */ + FT_ULong cmap_size; + + TT_Loader_GotoTableFunc goto_table; + + TT_Loader_StartGlyphFunc access_glyph_frame; + TT_Loader_EndGlyphFunc forget_glyph_frame; + TT_Loader_ReadGlyphFunc read_glyph_header; + TT_Loader_ReadGlyphFunc read_simple_glyph; + TT_Loader_ReadGlyphFunc read_composite_glyph; + + /* a typeless pointer to the SFNT_Interface table used to load */ + /* the basic TrueType tables in the face object */ + void* sfnt; + + /* a typeless pointer to the FT_Service_PsCMapsRec table used to */ + /* handle glyph names <-> unicode & Mac values */ + void* psnames; + + + /***********************************************************************/ + /* */ + /* Optional TrueType/OpenType tables */ + /* */ + /***********************************************************************/ + + /* horizontal device metrics */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* hdmx_table; + FT_ULong hdmx_table_size; + FT_UInt hdmx_record_count; + FT_ULong hdmx_record_size; + FT_Byte* hdmx_record_sizes; +#else + TT_HdmxRec hdmx; +#endif + + /* grid-fitting and scaling table */ + TT_GaspRec gasp; /* the `gasp' table */ + + /* PCL 5 table */ + TT_PCLT pclt; + + /* embedded bitmaps support */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* sbit_table; + FT_ULong sbit_table_size; + FT_UInt sbit_num_strikes; +#else + FT_ULong num_sbit_strikes; + TT_SBit_Strike sbit_strikes; +#endif + + FT_ULong num_sbit_scales; + TT_SBit_Scale sbit_scales; + + /* postscript names table */ + TT_Post_NamesRec postscript_names; + + + /***********************************************************************/ + /* */ + /* TrueType-specific fields (ignored by the OTF-Type2 driver) */ + /* */ + /***********************************************************************/ + + /* the glyph locations */ +#ifdef FT_OPTIMIZE_MEMORY + FT_UInt num_locations; + FT_Byte* glyph_locations; +#else + FT_UShort num_locations; + FT_Long* glyph_locations; +#endif + + FT_ULong glyf_len; + + /* the font program, if any */ + FT_ULong font_program_size; + FT_Byte* font_program; + + /* the cvt program, if any */ + FT_ULong cvt_program_size; + FT_Byte* cvt_program; + + /* the original, unscaled, control value table */ + FT_ULong cvt_size; + FT_Short* cvt; + +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* kern_table; + FT_ULong kern_table_size; + FT_UInt num_kern_tables; + FT_UInt32 kern_avail_bits; + FT_UInt32 kern_order_bits; +#else + /* the format 0 kerning table, if any */ + FT_Int num_kern_pairs; + FT_Int kern_table_index; + TT_Kern0_Pair kern_pairs; +#endif + + /* A pointer to the bytecode interpreter to use. This is also */ + /* used to hook the debugger for the `ttdebug' utility. */ + TT_Interpreter interpreter; + +#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING + /* Use unpatented hinting only. */ + FT_Bool unpatented_hinting; +#endif + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Bool doblend; + GX_Blend blend; +#endif + + /***********************************************************************/ + /* */ + /* Other tables or fields. This is used by derivative formats like */ + /* OpenType. */ + /* */ + /***********************************************************************/ + + FT_Generic extra; + + const char* postscript_name; + + } TT_FaceRec; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_GlyphZoneRec */ + /* */ + /* <Description> */ + /* A glyph zone is used to load, scale and hint glyph outline */ + /* coordinates. */ + /* */ + /* <Fields> */ + /* memory :: A handle to the memory manager. */ + /* */ + /* max_points :: The maximal size in points of the zone. */ + /* */ + /* max_contours :: Max size in links contours of thez one. */ + /* */ + /* n_points :: The current number of points in the zone. */ + /* */ + /* n_contours :: The current number of contours in the zone. */ + /* */ + /* org :: The original glyph coordinates (font */ + /* units/scaled). */ + /* */ + /* cur :: The current glyph coordinates (scaled/hinted). */ + /* */ + /* tags :: The point control tags. */ + /* */ + /* contours :: The contours end points. */ + /* */ + typedef struct TT_GlyphZoneRec_ + { + FT_Memory memory; + FT_UShort max_points; + FT_UShort max_contours; + FT_UShort n_points; /* number of points in zone */ + FT_Short n_contours; /* number of contours */ + + FT_Vector* org; /* original point coordinates */ + FT_Vector* cur; /* current point coordinates */ + + FT_Byte* tags; /* current touch flags */ + FT_UShort* contours; /* contour end points */ + + } TT_GlyphZoneRec, *TT_GlyphZone; + + + /* handle to execution context */ + typedef struct TT_ExecContextRec_* TT_ExecContext; + + /* glyph loader structure */ + typedef struct TT_LoaderRec_ + { + FT_Face face; + FT_Size size; + FT_GlyphSlot glyph; + FT_GlyphLoader gloader; + + FT_ULong load_flags; + FT_UInt glyph_index; + + FT_Stream stream; + FT_Int byte_len; + + FT_Short n_contours; + FT_BBox bbox; + FT_Int left_bearing; + FT_Int advance; + FT_Int top_bearing; + FT_Int vadvance; + FT_Int linear; + FT_Bool linear_def; + FT_Bool preserve_pps; + FT_Vector pp1; + FT_Vector pp2; + FT_Vector pp3; + FT_Vector pp4; + + FT_ULong glyf_offset; + + /* the zone where we load our glyphs */ + TT_GlyphZoneRec base; + TT_GlyphZoneRec zone; + + TT_ExecContext exec; + FT_Byte* instructions; + FT_ULong ins_pos; + + /* for possible extensibility in other formats */ + void* other; + + } TT_LoaderRec; + + +FT_END_HEADER + +#endif /* __TTTYPES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/t1tables.h b/extlibs/headers/freetype/t1tables.h new file mode 100644 index 00000000..5ae12b82 --- /dev/null +++ b/extlibs/headers/freetype/t1tables.h @@ -0,0 +1,431 @@ +/***************************************************************************/ +/* */ +/* t1tables.h */ +/* */ +/* Basic Type 1/Type 2 tables definitions and interface (specification */ +/* only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __T1TABLES_H__ +#define __T1TABLES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* type1_tables */ + /* */ + /* <Title> */ + /* Type 1 Tables */ + /* */ + /* <Abstract> */ + /* Type 1 (PostScript) specific font tables. */ + /* */ + /* <Description> */ + /* This section contains the definition of Type 1-specific tables, */ + /* including structures related to other PostScript font formats. */ + /* */ + /*************************************************************************/ + + + /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */ + /* structures in order to support Multiple Master fonts. */ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* PS_FontInfoRec */ + /* */ + /* <Description> */ + /* A structure used to model a Type1/Type2 FontInfo dictionary. Note */ + /* that for Multiple Master fonts, each instance has its own */ + /* FontInfo. */ + /* */ + typedef struct PS_FontInfoRec + { + FT_String* version; + FT_String* notice; + FT_String* full_name; + FT_String* family_name; + FT_String* weight; + FT_Long italic_angle; + FT_Bool is_fixed_pitch; + FT_Short underline_position; + FT_UShort underline_thickness; + + } PS_FontInfoRec, *PS_FontInfo; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* T1_FontInfo */ + /* */ + /* <Description> */ + /* This type is equivalent to @PS_FontInfoRec. It is deprecated but */ + /* kept to maintain source compatibility between various versions of */ + /* FreeType. */ + /* */ + typedef PS_FontInfoRec T1_FontInfo; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* PS_PrivateRec */ + /* */ + /* <Description> */ + /* A structure used to model a Type1/Type2 private dictionary. Note */ + /* that for Multiple Master fonts, each instance has its own Private */ + /* dictionary. */ + /* */ + typedef struct PS_PrivateRec_ + { + FT_Int unique_id; + FT_Int lenIV; + + FT_Byte num_blue_values; + FT_Byte num_other_blues; + FT_Byte num_family_blues; + FT_Byte num_family_other_blues; + + FT_Short blue_values[14]; + FT_Short other_blues[10]; + + FT_Short family_blues [14]; + FT_Short family_other_blues[10]; + + FT_Fixed blue_scale; + FT_Int blue_shift; + FT_Int blue_fuzz; + + FT_UShort standard_width[1]; + FT_UShort standard_height[1]; + + FT_Byte num_snap_widths; + FT_Byte num_snap_heights; + FT_Bool force_bold; + FT_Bool round_stem_up; + + FT_Short snap_widths [13]; /* including std width */ + FT_Short snap_heights[13]; /* including std height */ + + FT_Fixed expansion_factor; + + FT_Long language_group; + FT_Long password; + + FT_Short min_feature[2]; + + } PS_PrivateRec, *PS_Private; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* T1_Private */ + /* */ + /* <Description> */ + /* This type is equivalent to @PS_PrivateRec. It is deprecated but */ + /* kept to maintain source compatibility between various versions of */ + /* FreeType. */ + /* */ + typedef PS_PrivateRec T1_Private; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* T1_Blend_Flags */ + /* */ + /* <Description> */ + /* A set of flags used to indicate which fields are present in a */ + /* given blend dictionary (font info or private). Used to support */ + /* Multiple Masters fonts. */ + /* */ + typedef enum + { + /*# required fields in a FontInfo blend dictionary */ + T1_BLEND_UNDERLINE_POSITION = 0, + T1_BLEND_UNDERLINE_THICKNESS, + T1_BLEND_ITALIC_ANGLE, + + /*# required fields in a Private blend dictionary */ + T1_BLEND_BLUE_VALUES, + T1_BLEND_OTHER_BLUES, + T1_BLEND_STANDARD_WIDTH, + T1_BLEND_STANDARD_HEIGHT, + T1_BLEND_STEM_SNAP_WIDTHS, + T1_BLEND_STEM_SNAP_HEIGHTS, + T1_BLEND_BLUE_SCALE, + T1_BLEND_BLUE_SHIFT, + T1_BLEND_FAMILY_BLUES, + T1_BLEND_FAMILY_OTHER_BLUES, + T1_BLEND_FORCE_BOLD, + + /*# never remove */ + T1_BLEND_MAX + + } T1_Blend_Flags; + + + /*# backwards compatible definitions */ +#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION +#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS +#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE +#define t1_blend_blue_values T1_BLEND_BLUE_VALUES +#define t1_blend_other_blues T1_BLEND_OTHER_BLUES +#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH +#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT +#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS +#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS +#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE +#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT +#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES +#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES +#define t1_blend_force_bold T1_BLEND_FORCE_BOLD +#define t1_blend_max T1_BLEND_MAX + + + /* maximum number of Multiple Masters designs, as defined in the spec */ +#define T1_MAX_MM_DESIGNS 16 + + /* maximum number of Multiple Masters axes, as defined in the spec */ +#define T1_MAX_MM_AXIS 4 + + /* maximum number of elements in a design map */ +#define T1_MAX_MM_MAP_POINTS 20 + + + /* this structure is used to store the BlendDesignMap entry for an axis */ + typedef struct PS_DesignMap_ + { + FT_Byte num_points; + FT_Long* design_points; + FT_Fixed* blend_points; + + } PS_DesignMapRec, *PS_DesignMap; + + /* backwards-compatible definition */ + typedef PS_DesignMapRec T1_DesignMap; + + + typedef struct PS_BlendRec_ + { + FT_UInt num_designs; + FT_UInt num_axis; + + FT_String* axis_names[T1_MAX_MM_AXIS]; + FT_Fixed* design_pos[T1_MAX_MM_DESIGNS]; + PS_DesignMapRec design_map[T1_MAX_MM_AXIS]; + + FT_Fixed* weight_vector; + FT_Fixed* default_weight_vector; + + PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1]; + PS_Private privates [T1_MAX_MM_DESIGNS + 1]; + + FT_ULong blend_bitflags; + + FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1]; + + } PS_BlendRec, *PS_Blend; + + + /* backwards-compatible definition */ + typedef PS_BlendRec T1_Blend; + + + typedef struct CID_FaceDictRec_ + { + PS_PrivateRec private_dict; + + FT_UInt len_buildchar; + FT_Fixed forcebold_threshold; + FT_Pos stroke_width; + FT_Fixed expansion_factor; + + FT_Byte paint_type; + FT_Byte font_type; + FT_Matrix font_matrix; + FT_Vector font_offset; + + FT_UInt num_subrs; + FT_ULong subrmap_offset; + FT_Int sd_bytes; + + } CID_FaceDictRec, *CID_FaceDict; + + + /* backwards-compatible definition */ + typedef CID_FaceDictRec CID_FontDict; + + + typedef struct CID_FaceInfoRec_ + { + FT_String* cid_font_name; + FT_Fixed cid_version; + FT_Int cid_font_type; + + FT_String* registry; + FT_String* ordering; + FT_Int supplement; + + PS_FontInfoRec font_info; + FT_BBox font_bbox; + FT_ULong uid_base; + + FT_Int num_xuid; + FT_ULong xuid[16]; + + FT_ULong cidmap_offset; + FT_Int fd_bytes; + FT_Int gd_bytes; + FT_ULong cid_count; + + FT_Int num_dicts; + CID_FaceDict font_dicts; + + FT_ULong data_offset; + + } CID_FaceInfoRec, *CID_FaceInfo; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* CID_Info */ + /* */ + /* <Description> */ + /* This type is equivalent to CID_FaceInfoRec. It is deprecated but */ + /* kept to maintain source compatibility between various versions of */ + /* FreeType. */ + /* */ + typedef CID_FaceInfoRec CID_Info; + + /* */ + + + /************************************************************************ + * + * @function: + * FT_Has_PS_Glyph_Names + * + * @description: + * Return true if a given face provides reliable Postscript glyph + * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, + * except that certain fonts (mostly TrueType) contain incorrect + * glyph name tables. + * + * When this function returns true, the caller is sure that the glyph + * names returned by @FT_Get_Glyph_Name are reliable. + * + * @input: + * face :: + * face handle + * + * @return: + * Boolean. True if glyph names are reliable. + */ + FT_EXPORT( FT_Int ) + FT_Has_PS_Glyph_Names( FT_Face face ); + + + /************************************************************************ + * + * @function: + * FT_Get_PS_Font_Info + * + * @description: + * Retrieve the @PS_FontInfoRec structure corresponding to a given + * Postscript font. + * + * @input: + * face :: + * Postscript face handle. + * + * @output: + * afont_info :: + * Output font info structure pointer. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The string pointers within the font info structure are owned by + * the face and don't need to be freed by the caller. + * + * If the font's format is not Postscript-based, this function will + * return the FT_Err_Invalid_Argument error code. + */ + FT_EXPORT( FT_Error ) + FT_Get_PS_Font_Info( FT_Face face, + PS_FontInfoRec *afont_info ); + + + /************************************************************************ + * + * @function: + * FT_Get_PS_Font_Private + * + * @description: + * Retrieve the @PS_PrivateRec structure corresponding to a given + * Postscript font. + * + * @input: + * face :: + * Postscript face handle. + * + * @output: + * afont_private :: + * Output private dictionary structure pointer. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The string pointers within the font info structure are owned by + * the face and don't need to be freed by the caller. + * + * If the font's format is not Postscript-based, this function will + * return the FT_Err_Invalid_Argument error code. + */ + FT_EXPORT( FT_Error ) + FT_Get_PS_Font_Private( FT_Face face, + PS_PrivateRec *afont_private ); + + /* */ + + + +FT_END_HEADER + +#endif /* __T1TABLES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ttnameid.h b/extlibs/headers/freetype/ttnameid.h new file mode 100644 index 00000000..2e7f1108 --- /dev/null +++ b/extlibs/headers/freetype/ttnameid.h @@ -0,0 +1,1119 @@ +/***************************************************************************/ +/* */ +/* ttnameid.h */ +/* */ +/* TrueType name ID definitions (specification only). */ +/* */ +/* Copyright 1996-2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTNAMEID_H__ +#define __TTNAMEID_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* Possible values for the `platform' identifier code in the name */ + /* records of the TTF `name' table. */ + /* */ + /*************************************************************************/ + + + /*********************************************************************** + * + * @enum: + * TT_PLATFORM_XXX + * + * @description: + * A list of valid values for the `platform_id' identifier code in + * @FT_CharMapRec and @FT_SfntName structures. + * + * @values: + * TT_PLATFORM_APPLE_UNICODE :: + * Used by Apple to indicate a Unicode character map and/or name entry. + * See @TT_APPLE_ID_XXX for corresponding `encoding_id' values. Note + * that name entries in this format are coded as big-endian UCS-2 + * character codes _only_. + * + * TT_PLATFORM_MACINTOSH :: + * Used by Apple to indicate a MacOS-specific charmap and/or name entry. + * See @TT_MAC_ID_XXX for corresponding `encoding_id' values. Note that + * most TrueType fonts contain an Apple roman charmap to be usable on + * MacOS systems (even if they contain a Microsoft charmap as well). + * + * TT_PLATFORM_ISO :: + * This value was used to specify Unicode charmaps. It is however + * now deprecated. See @TT_ISO_ID_XXX for a list of corresponding + * `encoding_id' values. + * + * TT_PLATFORM_MICROSOFT :: + * Used by Microsoft to indicate Windows-specific charmaps. See + * @TT_MS_ID_XXX for a list of corresponding `encoding_id' values. + * Note that most fonts contain a Unicode charmap using + * (@TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS). + * + * TT_PLATFORM_CUSTOM :: + * Used to indicate application-specific charmaps. + * + * TT_PLATFORM_ADOBE :: + * This value isn't part of any font format specification, but is used + * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec + * structure. See @TT_ADOBE_ID_XXX. + */ + +#define TT_PLATFORM_APPLE_UNICODE 0 +#define TT_PLATFORM_MACINTOSH 1 +#define TT_PLATFORM_ISO 2 /* deprecated */ +#define TT_PLATFORM_MICROSOFT 3 +#define TT_PLATFORM_CUSTOM 4 +#define TT_PLATFORM_ADOBE 7 /* artificial */ + + + /*********************************************************************** + * + * @enum: + * TT_APPLE_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries. + * + * @values: + * TT_APPLE_ID_DEFAULT :: + * Unicode version 1.0. + * TT_APPLE_ID_UNICODE_1_1 :: + * Unicode 1.1; specifies Hangul characters starting at U+34xx. + * TT_APPLE_ID_ISO_10646 :: + * Deprecated (identical to preceding.) + * TT_APPLE_ID_UNICODE_2_0 :: + * Unicode 2.0 and beyond (UTF-16 BMP only.) + * TT_APPLE_ID_UNICODE_32 :: + * Unicode 3.1 and beyond, using UTF-32 + */ + +#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */ +#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */ +#define TT_APPLE_ID_ISO_10646 2 /* deprecated */ +#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */ +#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */ + + + /*********************************************************************** + * + * @enum: + * TT_MAC_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_MACINTOSH charmaps and name entries. + * + * @values: + * TT_MAC_ID_ROMAN :: + * TT_MAC_ID_JAPANESE :: + * TT_MAC_ID_TRADITIONAL_CHINESE :: + * TT_MAC_ID_KOREAN :: + * TT_MAC_ID_ARABIC :: + * TT_MAC_ID_HEBREW :: + * TT_MAC_ID_GREEK :: + * TT_MAC_ID_RUSSIAN :: + * TT_MAC_ID_RSYMBOL :: + * TT_MAC_ID_DEVANAGARI :: + * TT_MAC_ID_GURMUKHI :: + * TT_MAC_ID_GUJARATI :: + * TT_MAC_ID_ORIYA :: + * TT_MAC_ID_BENGALI :: + * TT_MAC_ID_TAMIL :: + * TT_MAC_ID_TELUGU :: + * TT_MAC_ID_KANNADA :: + * TT_MAC_ID_MALAYALAM :: + * TT_MAC_ID_SINHALESE :: + * TT_MAC_ID_BURMESE :: + * TT_MAC_ID_KHMER :: + * TT_MAC_ID_THAI :: + * TT_MAC_ID_LAOTIAN :: + * TT_MAC_ID_GEORGIAN :: + * TT_MAC_ID_ARMENIAN :: + * TT_MAC_ID_MALDIVIAN :: + * TT_MAC_ID_SIMPLIFIED_CHINESE :: + * TT_MAC_ID_TIBETAN :: + * TT_MAC_ID_MONGOLIAN :: + * TT_MAC_ID_GEEZ :: + * TT_MAC_ID_SLAVIC :: + * TT_MAC_ID_VIETNAMESE :: + * TT_MAC_ID_SINDHI :: + * TT_MAC_ID_UNINTERP :: + */ + +#define TT_MAC_ID_ROMAN 0 +#define TT_MAC_ID_JAPANESE 1 +#define TT_MAC_ID_TRADITIONAL_CHINESE 2 +#define TT_MAC_ID_KOREAN 3 +#define TT_MAC_ID_ARABIC 4 +#define TT_MAC_ID_HEBREW 5 +#define TT_MAC_ID_GREEK 6 +#define TT_MAC_ID_RUSSIAN 7 +#define TT_MAC_ID_RSYMBOL 8 +#define TT_MAC_ID_DEVANAGARI 9 +#define TT_MAC_ID_GURMUKHI 10 +#define TT_MAC_ID_GUJARATI 11 +#define TT_MAC_ID_ORIYA 12 +#define TT_MAC_ID_BENGALI 13 +#define TT_MAC_ID_TAMIL 14 +#define TT_MAC_ID_TELUGU 15 +#define TT_MAC_ID_KANNADA 16 +#define TT_MAC_ID_MALAYALAM 17 +#define TT_MAC_ID_SINHALESE 18 +#define TT_MAC_ID_BURMESE 19 +#define TT_MAC_ID_KHMER 20 +#define TT_MAC_ID_THAI 21 +#define TT_MAC_ID_LAOTIAN 22 +#define TT_MAC_ID_GEORGIAN 23 +#define TT_MAC_ID_ARMENIAN 24 +#define TT_MAC_ID_MALDIVIAN 25 +#define TT_MAC_ID_SIMPLIFIED_CHINESE 25 +#define TT_MAC_ID_TIBETAN 26 +#define TT_MAC_ID_MONGOLIAN 27 +#define TT_MAC_ID_GEEZ 28 +#define TT_MAC_ID_SLAVIC 29 +#define TT_MAC_ID_VIETNAMESE 30 +#define TT_MAC_ID_SINDHI 31 +#define TT_MAC_ID_UNINTERP 32 + + + /*********************************************************************** + * + * @enum: + * TT_ISO_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_ISO charmaps and name entries. + * + * Their use is now deprecated. + * + * @values: + * TT_ISO_ID_7BIT_ASCII :: + * ASCII. + * TT_ISO_ID_10646 :: + * ISO/10646. + * TT_ISO_ID_8859_1 :: + * Also known as Latin-1. + */ + +#define TT_ISO_ID_7BIT_ASCII 0 +#define TT_ISO_ID_10646 1 +#define TT_ISO_ID_8859_1 2 + + + /*********************************************************************** + * + * @enum: + * TT_MS_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_MICROSOFT charmaps and name entries. + * + * @values: + * TT_MS_ID_SYMBOL_CS :: + * Corresponds to Microsoft symbol encoding. See + * @FT_ENCODING_MS_SYMBOL. + * + * TT_MS_ID_UNICODE_CS :: + * Corresponds to a Microsoft WGL4 charmap, matching Unicode. See + * @FT_ENCODING_UNICODE. + * + * TT_MS_ID_SJIS :: + * Corresponds to SJIS Japanese encoding. See @FT_ENCODING_SJIS. + * + * TT_MS_ID_GB2312 :: + * Corresponds to Simplified Chinese as used in Mainland China. See + * @FT_ENCODING_GB2312. + * + * TT_MS_ID_BIG_5 :: + * Corresponds to Traditional Chinese as used in Taiwan and Hong Kong. + * See @FT_ENCODING_BIG5. + * + * TT_MS_ID_WANSUNG :: + * Corresponds to Korean Wansung encoding. See @FT_ENCODING_WANSUNG. + * + * TT_MS_ID_JOHAB :: + * Corresponds to Johab encoding. See @FT_ENCODING_JOHAB. + * + * TT_MS_ID_UCS_4 :: + * Corresponds to UCS-4 or UTF-32 charmaps. This has been added to + * the OpenType specification version 1.4 (mid-2001.) + */ + +#define TT_MS_ID_SYMBOL_CS 0 +#define TT_MS_ID_UNICODE_CS 1 +#define TT_MS_ID_SJIS 2 +#define TT_MS_ID_GB2312 3 +#define TT_MS_ID_BIG_5 4 +#define TT_MS_ID_WANSUNG 5 +#define TT_MS_ID_JOHAB 6 +#define TT_MS_ID_UCS_4 10 + + + /*********************************************************************** + * + * @enum: + * TT_ADOBE_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_ADOBE charmaps. This is a FreeType-specific extension! + * + * @values: + * TT_ADOBE_ID_STANDARD :: + * Adobe standard encoding. + * TT_ADOBE_ID_EXPERT :: + * Adobe expert encoding. + * TT_ADOBE_ID_CUSTOM :: + * Adobe custom encoding. + */ + +#define TT_ADOBE_ID_STANDARD 0 +#define TT_ADOBE_ID_EXPERT 1 +#define TT_ADOBE_ID_CUSTOM 2 +#define TT_ADOBE_ID_LATIN_1 3 + + + /*************************************************************************/ + /* */ + /* Possible values of the language identifier field in the name records */ + /* of the TTF `name' table if the `platform' identifier code is */ + /* TT_PLATFORM_MACINTOSH. */ + /* */ + /* The canonical source for the Apple assigned Language ID's is at */ + /* */ + /* http://fonts.apple.com/TTRefMan/RM06/Chap6name.html */ + /* */ +#define TT_MAC_LANGID_ENGLISH 0 +#define TT_MAC_LANGID_FRENCH 1 +#define TT_MAC_LANGID_GERMAN 2 +#define TT_MAC_LANGID_ITALIAN 3 +#define TT_MAC_LANGID_DUTCH 4 +#define TT_MAC_LANGID_SWEDISH 5 +#define TT_MAC_LANGID_SPANISH 6 +#define TT_MAC_LANGID_DANISH 7 +#define TT_MAC_LANGID_PORTUGUESE 8 +#define TT_MAC_LANGID_NORWEGIAN 9 +#define TT_MAC_LANGID_HEBREW 10 +#define TT_MAC_LANGID_JAPANESE 11 +#define TT_MAC_LANGID_ARABIC 12 +#define TT_MAC_LANGID_FINNISH 13 +#define TT_MAC_LANGID_GREEK 14 +#define TT_MAC_LANGID_ICELANDIC 15 +#define TT_MAC_LANGID_MALTESE 16 +#define TT_MAC_LANGID_TURKISH 17 +#define TT_MAC_LANGID_CROATIAN 18 +#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19 +#define TT_MAC_LANGID_URDU 20 +#define TT_MAC_LANGID_HINDI 21 +#define TT_MAC_LANGID_THAI 22 +#define TT_MAC_LANGID_KOREAN 23 +#define TT_MAC_LANGID_LITHUANIAN 24 +#define TT_MAC_LANGID_POLISH 25 +#define TT_MAC_LANGID_HUNGARIAN 26 +#define TT_MAC_LANGID_ESTONIAN 27 +#define TT_MAC_LANGID_LETTISH 28 +#define TT_MAC_LANGID_SAAMISK 29 +#define TT_MAC_LANGID_FAEROESE 30 +#define TT_MAC_LANGID_FARSI 31 +#define TT_MAC_LANGID_RUSSIAN 32 +#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33 +#define TT_MAC_LANGID_FLEMISH 34 +#define TT_MAC_LANGID_IRISH 35 +#define TT_MAC_LANGID_ALBANIAN 36 +#define TT_MAC_LANGID_ROMANIAN 37 +#define TT_MAC_LANGID_CZECH 38 +#define TT_MAC_LANGID_SLOVAK 39 +#define TT_MAC_LANGID_SLOVENIAN 40 +#define TT_MAC_LANGID_YIDDISH 41 +#define TT_MAC_LANGID_SERBIAN 42 +#define TT_MAC_LANGID_MACEDONIAN 43 +#define TT_MAC_LANGID_BULGARIAN 44 +#define TT_MAC_LANGID_UKRAINIAN 45 +#define TT_MAC_LANGID_BYELORUSSIAN 46 +#define TT_MAC_LANGID_UZBEK 47 +#define TT_MAC_LANGID_KAZAKH 48 +#define TT_MAC_LANGID_AZERBAIJANI 49 +#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49 +#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50 +#define TT_MAC_LANGID_ARMENIAN 51 +#define TT_MAC_LANGID_GEORGIAN 52 +#define TT_MAC_LANGID_MOLDAVIAN 53 +#define TT_MAC_LANGID_KIRGHIZ 54 +#define TT_MAC_LANGID_TAJIKI 55 +#define TT_MAC_LANGID_TURKMEN 56 +#define TT_MAC_LANGID_MONGOLIAN 57 +#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57 +#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58 +#define TT_MAC_LANGID_PASHTO 59 +#define TT_MAC_LANGID_KURDISH 60 +#define TT_MAC_LANGID_KASHMIRI 61 +#define TT_MAC_LANGID_SINDHI 62 +#define TT_MAC_LANGID_TIBETAN 63 +#define TT_MAC_LANGID_NEPALI 64 +#define TT_MAC_LANGID_SANSKRIT 65 +#define TT_MAC_LANGID_MARATHI 66 +#define TT_MAC_LANGID_BENGALI 67 +#define TT_MAC_LANGID_ASSAMESE 68 +#define TT_MAC_LANGID_GUJARATI 69 +#define TT_MAC_LANGID_PUNJABI 70 +#define TT_MAC_LANGID_ORIYA 71 +#define TT_MAC_LANGID_MALAYALAM 72 +#define TT_MAC_LANGID_KANNADA 73 +#define TT_MAC_LANGID_TAMIL 74 +#define TT_MAC_LANGID_TELUGU 75 +#define TT_MAC_LANGID_SINHALESE 76 +#define TT_MAC_LANGID_BURMESE 77 +#define TT_MAC_LANGID_KHMER 78 +#define TT_MAC_LANGID_LAO 79 +#define TT_MAC_LANGID_VIETNAMESE 80 +#define TT_MAC_LANGID_INDONESIAN 81 +#define TT_MAC_LANGID_TAGALOG 82 +#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83 +#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84 +#define TT_MAC_LANGID_AMHARIC 85 +#define TT_MAC_LANGID_TIGRINYA 86 +#define TT_MAC_LANGID_GALLA 87 +#define TT_MAC_LANGID_SOMALI 88 +#define TT_MAC_LANGID_SWAHILI 89 +#define TT_MAC_LANGID_RUANDA 90 +#define TT_MAC_LANGID_RUNDI 91 +#define TT_MAC_LANGID_CHEWA 92 +#define TT_MAC_LANGID_MALAGASY 93 +#define TT_MAC_LANGID_ESPERANTO 94 +#define TT_MAC_LANGID_WELSH 128 +#define TT_MAC_LANGID_BASQUE 129 +#define TT_MAC_LANGID_CATALAN 130 +#define TT_MAC_LANGID_LATIN 131 +#define TT_MAC_LANGID_QUECHUA 132 +#define TT_MAC_LANGID_GUARANI 133 +#define TT_MAC_LANGID_AYMARA 134 +#define TT_MAC_LANGID_TATAR 135 +#define TT_MAC_LANGID_UIGHUR 136 +#define TT_MAC_LANGID_DZONGKHA 137 +#define TT_MAC_LANGID_JAVANESE 138 +#define TT_MAC_LANGID_SUNDANESE 139 + + +#if 0 /* these seem to be errors that have been dropped */ + +#define TT_MAC_LANGID_SCOTTISH_GAELIC 140 +#define TT_MAC_LANGID_IRISH_GAELIC 141 + +#endif + + + /* The following codes are new as of 2000-03-10 */ +#define TT_MAC_LANGID_GALICIAN 140 +#define TT_MAC_LANGID_AFRIKAANS 141 +#define TT_MAC_LANGID_BRETON 142 +#define TT_MAC_LANGID_INUKTITUT 143 +#define TT_MAC_LANGID_SCOTTISH_GAELIC 144 +#define TT_MAC_LANGID_MANX_GAELIC 145 +#define TT_MAC_LANGID_IRISH_GAELIC 146 +#define TT_MAC_LANGID_TONGAN 147 +#define TT_MAC_LANGID_GREEK_POLYTONIC 148 +#define TT_MAC_LANGID_GREELANDIC 149 +#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150 + + + /*************************************************************************/ + /* */ + /* Possible values of the language identifier field in the name records */ + /* of the TTF `name' table if the `platform' identifier code is */ + /* TT_PLATFORM_MICROSOFT. */ + /* */ + /* The canonical source for the MS assigned LCID's (seems to) be at */ + /* */ + /* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */ + /* */ + /* It used to be at various places, among them */ + /* */ + /* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt */ + /* http://www.microsoft.com/globaldev/reference/loclanghome.asp */ + /* http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP */ + /* http://msdn.microsoft.com/library/en-us/passport25/ */ + /* NET_Passport_VBScript_Documentation/Single_Sign_In/ */ + /* Advanced_Single_Sign_In/Localization_and_LCIDs.asp */ + /* */ + /* Hopefully, it seems now that the Globaldev site prevails... */ + /* (updated by Antoine, 2004-02-17) */ + +#define TT_MS_LANGID_ARABIC_GENERAL 0x0001 +#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 +#define TT_MS_LANGID_ARABIC_IRAQ 0x0801 +#define TT_MS_LANGID_ARABIC_EGYPT 0x0c01 +#define TT_MS_LANGID_ARABIC_LIBYA 0x1001 +#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401 +#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801 +#define TT_MS_LANGID_ARABIC_TUNISIA 0x1c01 +#define TT_MS_LANGID_ARABIC_OMAN 0x2001 +#define TT_MS_LANGID_ARABIC_YEMEN 0x2401 +#define TT_MS_LANGID_ARABIC_SYRIA 0x2801 +#define TT_MS_LANGID_ARABIC_JORDAN 0x2c01 +#define TT_MS_LANGID_ARABIC_LEBANON 0x3001 +#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401 +#define TT_MS_LANGID_ARABIC_UAE 0x3801 +#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3c01 +#define TT_MS_LANGID_ARABIC_QATAR 0x4001 +#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402 +#define TT_MS_LANGID_CATALAN_SPAIN 0x0403 +#define TT_MS_LANGID_CHINESE_GENERAL 0x0004 +#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404 +#define TT_MS_LANGID_CHINESE_PRC 0x0804 +#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04 +#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004 + +#if 1 /* this looks like the correct value */ +#define TT_MS_LANGID_CHINESE_MACAU 0x1404 +#else /* but beware, Microsoft may change its mind... + the most recent Word reference has the following: */ +#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG +#endif + +#if 0 /* used only with .NET "cultures"; commented out */ +#define TT_MS_LANGID_CHINESE_TRADITIONAL 0x7C04 +#endif + +#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405 +#define TT_MS_LANGID_DANISH_DENMARK 0x0406 +#define TT_MS_LANGID_GERMAN_GERMANY 0x0407 +#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807 +#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0c07 +#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007 +#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407 +#define TT_MS_LANGID_GREEK_GREECE 0x0408 + + /* don't ask what this one means... It is commented out currently. */ +#if 0 +#define TT_MS_LANGID_GREEK_GREECE2 0x2008 +#endif + +#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 +#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409 +#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809 +#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09 +#define TT_MS_LANGID_ENGLISH_CANADA 0x1009 +#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409 +#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809 +#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1c09 +#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009 +#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409 +#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809 +#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09 +#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009 +#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409 +#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809 +#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09 +#define TT_MS_LANGID_ENGLISH_INDIA 0x4009 +#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 +#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 +#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a +#define TT_MS_LANGID_SPANISH_MEXICO 0x080a +#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a +#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100a +#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140a +#define TT_MS_LANGID_SPANISH_PANAMA 0x180a +#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1c0a +#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200a +#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240a +#define TT_MS_LANGID_SPANISH_PERU 0x280a +#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2c0a +#define TT_MS_LANGID_SPANISH_ECUADOR 0x300a +#define TT_MS_LANGID_SPANISH_CHILE 0x340a +#define TT_MS_LANGID_SPANISH_URUGUAY 0x380a +#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3c0a +#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400a +#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440a +#define TT_MS_LANGID_SPANISH_HONDURAS 0x480a +#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a +#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a +#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a + /* The following ID blatantly violate MS specs by using a */ + /* sublanguage > 0x1F. */ +#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40aU +#define TT_MS_LANGID_FINNISH_FINLAND 0x040b +#define TT_MS_LANGID_FRENCH_FRANCE 0x040c +#define TT_MS_LANGID_FRENCH_BELGIUM 0x080c +#define TT_MS_LANGID_FRENCH_CANADA 0x0c0c +#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c +#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c +#define TT_MS_LANGID_FRENCH_MONACO 0x180c +#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c +#define TT_MS_LANGID_FRENCH_REUNION 0x200c +#define TT_MS_LANGID_FRENCH_CONGO 0x240c + /* which was formerly: */ +#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO +#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c +#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c +#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300c +#define TT_MS_LANGID_FRENCH_MALI 0x340c +#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c +#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c + /* and another violation of the spec (see 0xE40aU) */ +#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40cU +#define TT_MS_LANGID_HEBREW_ISRAEL 0x040d +#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e +#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f +#define TT_MS_LANGID_ITALIAN_ITALY 0x0410 +#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810 +#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411 +#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412 +#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812 +#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413 +#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813 +#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414 +#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814 +#define TT_MS_LANGID_POLISH_POLAND 0x0415 +#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416 +#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816 +#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417 +#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418 +#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818 +#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419 +#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819 +#define TT_MS_LANGID_CROATIAN_CROATIA 0x041a +#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a +#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a + +#if 0 /* this used to be this value, but it looks like we were wrong */ +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101a +#else /* current sources say */ +#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101a +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141a + /* and XPsp2 Platform SDK added (2004-07-26) */ + /* Names are shortened to be signifiant within 40 chars. */ +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181a +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x181a +#endif + +#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b +#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c +#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d +#define TT_MS_LANGID_SWEDISH_FINLAND 0x081d +#define TT_MS_LANGID_THAI_THAILAND 0x041e +#define TT_MS_LANGID_TURKISH_TURKEY 0x041f +#define TT_MS_LANGID_URDU_PAKISTAN 0x0420 +#define TT_MS_LANGID_URDU_INDIA 0x0820 +#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421 +#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422 +#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423 +#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424 +#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425 +#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426 +#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427 +#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827 +#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 +#define TT_MS_LANGID_FARSI_IRAN 0x0429 +#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a +#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b +#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042c +#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082c +#define TT_MS_LANGID_BASQUE_SPAIN 0x042d +#define TT_MS_LANGID_SORBIAN_GERMANY 0x042e +#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042f +#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430 +#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431 +#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432 +#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433 +#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434 +#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435 +#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436 +#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437 +#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438 +#define TT_MS_LANGID_HINDI_INDIA 0x0439 +#define TT_MS_LANGID_MALTESE_MALTA 0x043a + /* Added by XPsp2 Platform SDK (2004-07-26) */ +#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043b +#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083b +#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3b +#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103b +#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143b +#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183b +#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3b +#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203b +#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243b + /* ... and we also keep our old identifier... */ +#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b + +#if 0 /* this seems to be a previous invertion */ +#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c +#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c +#else +#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c +#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c +#endif + +#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d +#define TT_MS_LANGID_MALAY_MALAYSIA 0x043e +#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e +#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440 + /* alias declared in Windows 2000 */ +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ + TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN + +#define TT_MS_LANGID_SWAHILI_KENYA 0x0441 +#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 +#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443 +#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843 +#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444 +#define TT_MS_LANGID_BENGALI_INDIA 0x0445 +#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 +#define TT_MS_LANGID_PUNJABI_INDIA 0x0446 +#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 +#define TT_MS_LANGID_GUJARATI_INDIA 0x0447 +#define TT_MS_LANGID_ORIYA_INDIA 0x0448 +#define TT_MS_LANGID_TAMIL_INDIA 0x0449 +#define TT_MS_LANGID_TELUGU_INDIA 0x044a +#define TT_MS_LANGID_KANNADA_INDIA 0x044b +#define TT_MS_LANGID_MALAYALAM_INDIA 0x044c +#define TT_MS_LANGID_ASSAMESE_INDIA 0x044d +#define TT_MS_LANGID_MARATHI_INDIA 0x044e +#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450 +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850 +#define TT_MS_LANGID_TIBETAN_CHINA 0x0451 +#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851 + +#if 0 + /* the following used to be defined */ +#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451 + /* ... but it was changed; */ +#else + /* So we will continue to #define it, but with the correct value */ +#define TT_MS_LANGID_TIBETAN_BHUTAN TT_MS_LANGID_DZONGHKA_BHUTAN +#endif + +#define TT_MS_LANGID_WELSH_WALES 0x0452 +#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453 +#define TT_MS_LANGID_LAO_LAOS 0x0454 +#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455 +#define TT_MS_LANGID_GALICIAN_SPAIN 0x0456 +#define TT_MS_LANGID_KONKANI_INDIA 0x0457 +#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458 +#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459 +#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859 + /* Missing a LCID for Sindhi in Devanagari script */ +#define TT_MS_LANGID_SYRIAC_SYRIA 0x045a +#define TT_MS_LANGID_SINHALESE_SRI_LANKA 0x045b +#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045c +#define TT_MS_LANGID_INUKTITUT_CANADA 0x045d +#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045e +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045f +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN 0x085f + /* Missing a LCID for Tifinagh script */ +#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460 + /* Spelled this way by XPsp2 Platform SDK (2004-07-26) */ + /* script is yet unclear... might be Arabic, Nagari or Sharada */ +#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860 + /* ... and aliased (by MS) for compatibility reasons. */ +#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA +#define TT_MS_LANGID_NEPALI_NEPAL 0x0461 +#define TT_MS_LANGID_NEPALI_INDIA 0x0861 +#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 +#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463 +#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464 +#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465 + /* alias declared in Windows 2000 */ +#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES +#define TT_MS_LANGID_EDO_NIGERIA 0x0466 +#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467 +#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468 +#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469 +#define TT_MS_LANGID_YORUBA_NIGERIA 0x046a +#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046b +#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086b +#define TT_MS_LANGID_QUECHUA_PERU 0x0c6b +#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA 0x046c + /* Also spelled by XPsp2 Platform SDK (2004-07-26) */ +#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \ + TT_MS_LANGID_SEPEDI_SOUTH_AFRICA + /* language codes 0x046d, 0x046e and 0x046f are (still) unknown. */ +#define TT_MS_LANGID_IGBO_NIGERIA 0x0470 +#define TT_MS_LANGID_KANURI_NIGERIA 0x0471 +#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 +#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 +#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 + /* also spelled in the `Passport SDK' list as: */ +#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA +#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474 +#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475 +#define TT_MS_LANGID_LATIN 0x0476 +#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477 + /* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */ + /* not written (but OTOH the peculiar writing system is worth */ + /* studying). */ +#define TT_MS_LANGID_YI_CHINA 0x0478 +#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479 + /* language codes from 0x047a to 0x047f are (still) unknown. */ +#define TT_MS_LANGID_UIGHUR_CHINA 0x0480 +#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481 + +#if 0 /* not deemed useful for fonts */ +#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE 0x04ff +#endif + + + /*************************************************************************/ + /* */ + /* Possible values of the `name' identifier field in the name records of */ + /* the TTF `name' table. These values are platform independent. */ + /* */ +#define TT_NAME_ID_COPYRIGHT 0 +#define TT_NAME_ID_FONT_FAMILY 1 +#define TT_NAME_ID_FONT_SUBFAMILY 2 +#define TT_NAME_ID_UNIQUE_ID 3 +#define TT_NAME_ID_FULL_NAME 4 +#define TT_NAME_ID_VERSION_STRING 5 +#define TT_NAME_ID_PS_NAME 6 +#define TT_NAME_ID_TRADEMARK 7 + + /* the following values are from the OpenType spec */ +#define TT_NAME_ID_MANUFACTURER 8 +#define TT_NAME_ID_DESIGNER 9 +#define TT_NAME_ID_DESCRIPTION 10 +#define TT_NAME_ID_VENDOR_URL 11 +#define TT_NAME_ID_DESIGNER_URL 12 +#define TT_NAME_ID_LICENSE 13 +#define TT_NAME_ID_LICENSE_URL 14 + /* number 15 is reserved */ +#define TT_NAME_ID_PREFERRED_FAMILY 16 +#define TT_NAME_ID_PREFERRED_SUBFAMILY 17 +#define TT_NAME_ID_MAC_FULL_NAME 18 + + /* The following code is new as of 2000-01-21 */ +#define TT_NAME_ID_SAMPLE_TEXT 19 + + /* This is new in OpenType 1.3 */ +#define TT_NAME_ID_CID_FINDFONT_NAME 20 + + + /*************************************************************************/ + /* */ + /* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table. */ + /* */ + /* Updated 02-Jul-2000. */ + /* */ + + /* General Scripts Area */ + + /* Bit 0 Basic Latin */ +#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */ + /* Bit 1 C1 Controls and Latin-1 Supplement */ +#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */ + /* Bit 2 Latin Extended-A */ +#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */ + /* Bit 3 Latin Extended-B */ +#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */ + /* Bit 4 IPA Extensions */ +#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */ + /* Bit 5 Spacing Modifier Letters */ +#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */ + /* Bit 6 Combining Diacritical Marks */ +#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */ + /* Bit 7 Greek and Coptic */ +#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */ + /* Bit 8 is reserved (was: Greek Symbols and Coptic) */ + /* Bit 9 Cyrillic + */ + /* Cyrillic Supplementary */ +#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */ + /* U+0500-U+052F */ + /* Bit 10 Armenian */ +#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */ + /* Bit 11 Hebrew */ +#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */ + /* Bit 12 is reserved (was: Hebrew Extended) */ + /* Bit 13 Arabic */ +#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */ + /* Bit 14 is reserved (was: Arabic Extended) */ + /* Bit 15 Devanagari */ +#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */ + /* Bit 16 Bengali */ +#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */ + /* Bit 17 Gurmukhi */ +#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */ + /* Bit 18 Gujarati */ +#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */ + /* Bit 19 Oriya */ +#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */ + /* Bit 20 Tamil */ +#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */ + /* Bit 21 Telugu */ +#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */ + /* Bit 22 Kannada */ +#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */ + /* Bit 23 Malayalam */ +#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */ + /* Bit 24 Thai */ +#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */ + /* Bit 25 Lao */ +#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */ + /* Bit 26 Georgian */ +#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */ + /* Bit 27 is reserved (was Georgian Extended) */ + /* Bit 28 Hangul Jamo */ +#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */ + /* Bit 29 Latin Extended Additional */ +#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */ + /* Bit 30 Greek Extended */ +#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */ + + /* Symbols Area */ + + /* Bit 31 General Punctuation */ +#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */ + /* Bit 32 Superscripts And Subscripts */ +#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */ + /* Bit 33 Currency Symbols */ +#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */ + /* Bit 34 Combining Diacritical Marks For Symbols */ +#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */ + /* Bit 35 Letterlike Symbols */ +#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */ + /* Bit 36 Number Forms */ +#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */ + /* Bit 37 Arrows + */ + /* Supplemental Arrows-A + */ + /* Supplemental Arrows-B */ +#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */ + /* U+27F0-U+27FF */ + /* U+2900-U+297F */ + /* Bit 38 Mathematical Operators + */ + /* Supplemental Mathematical Operators + */ + /* Miscellaneous Mathematical Symbols-A + */ + /* Miscellaneous Mathematical Symbols-B */ +#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */ + /* U+2A00-U+2AFF */ + /* U+27C0-U+27EF */ + /* U+2980-U+29FF */ + /* Bit 39 Miscellaneous Technical */ +#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */ + /* Bit 40 Control Pictures */ +#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */ + /* Bit 41 Optical Character Recognition */ +#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */ + /* Bit 42 Enclosed Alphanumerics */ +#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */ + /* Bit 43 Box Drawing */ +#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */ + /* Bit 44 Block Elements */ +#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */ + /* Bit 45 Geometric Shapes */ +#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */ + /* Bit 46 Miscellaneous Symbols */ +#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */ + /* Bit 47 Dingbats */ +#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */ + + /* CJK Phonetics and Symbols Area */ + + /* Bit 48 CJK Symbols and Punctuation */ +#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */ + /* Bit 49 Hiragana */ +#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */ + /* Bit 50 Katakana + */ + /* Katakana Phonetic Extensions */ +#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */ + /* U+31F0-U+31FF */ + /* Bit 51 Bopomofo + */ + /* Bopomofo Extended */ +#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */ + /* U+31A0-U+31BF */ + /* Bit 52 Hangul Compatibility Jamo */ +#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */ + /* Bit 53 Kanbun */ +#define TT_UCR_CJK_MISC (1L << 21) /* U+3190-U+319F */ +#define TT_UCR_KANBUN TT_UCR_CJK_MISC + /* Bit 54 Enclosed CJK Letters and Months */ +#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */ + /* Bit 55 CJK Compatibility */ +#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */ + + /* Hangul Syllables Area */ + + /* Bit 56 Hangul */ +#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */ + + /* Surrogates Area */ + + /* Bit 57 High Surrogates + */ + /* High Private Use Surrogates + */ + /* Low Surrogates */ +#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */ + /* U+DB80-U+DBFF */ + /* U+DC00-U+DFFF */ + /* According to OpenType specs v.1.3+, setting bit 57 implies that there */ + /* is at least one codepoint beyond the Basic Multilingual Plane that is */ + /* supported by this font. So it really means: >= U+10000 */ + + /* Bit 58 is reserved for Unicode SubRanges */ + + /* CJK Ideographs Area */ + + /* Bit 59 CJK Unified Ideographs + */ + /* CJK Radicals Supplement + */ + /* Kangxi Radicals + */ + /* Ideographic Description Characters + */ + /* CJK Unified Ideographs Extension A */ + /* CJK Unified Ideographs Extension A + */ + /* CJK Unified Ideographs Extension B + */ + /* Kanbun */ +#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */ + /* U+2E80-U+2EFF */ + /* U+2F00-U+2FDF */ + /* U+2FF0-U+2FFF */ + /* U+3400-U+4DB5 */ + /*U+20000-U+2A6DF*/ + /* U+3190-U+319F */ + + /* Private Use Area */ + + /* Bit 60 Private Use */ +#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */ + + /* Compatibility Area and Specials */ + + /* Bit 61 CJK Compatibility Ideographs + */ + /* CJK Compatibility Ideographs Supplement */ +#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+F900-U+FAFF */ + /*U+2F800-U+2FA1F*/ + /* Bit 62 Alphabetic Presentation Forms */ +#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */ + /* Bit 63 Arabic Presentation Forms-A */ +#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FDFF */ + /* Bit 64 Combining Half Marks */ +#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */ + /* Bit 65 CJK Compatibility Forms */ +#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE30-U+FE4F */ + /* Bit 66 Small Form Variants */ +#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */ + /* Bit 67 Arabic Presentation Forms-B */ +#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFE */ + /* Bit 68 Halfwidth and Fullwidth Forms */ +#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */ + /* Bit 69 Specials */ +#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */ + /* Bit 70 Tibetan */ +#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */ + /* Bit 71 Syriac */ +#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */ + /* Bit 72 Thaana */ +#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */ + /* Bit 73 Sinhala */ +#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */ + /* Bit 74 Myanmar */ +#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */ + /* Bit 75 Ethiopic */ +#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */ + /* Bit 76 Cherokee */ +#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */ + /* Bit 77 Unified Canadian Aboriginal Syllabics */ +#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */ + /* Bit 78 Ogham */ +#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */ + /* Bit 79 Runic */ +#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */ + /* Bit 80 Khmer */ +#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */ + /* Bit 81 Mongolian */ +#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */ + /* Bit 82 Braille Patterns */ +#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */ + /* Bit 83 Yi Syllables + */ + /* Yi Radicals */ +#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */ + /* U+A490-U+A4CF */ + /* Bit 84 Tagalog + */ + /* Hanunoo + */ + /* Buhid + */ + /* Tagbanwa */ +#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */ + /* U+1720-U+173F */ + /* U+1740-U+175F */ + /* U+1760-U+177F */ + /* Bit 85 Old Italic */ +#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/ + /* Bit 86 Gothic */ +#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/ + /* Bit 87 Deseret */ +#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/ + /* Bit 88 Byzantine Musical Symbols + */ + /* Musical Symbols */ +#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/ + /*U+1D100-U+1D1FF*/ + /* Bit 89 Mathematical Alphanumeric Symbols */ +#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/ + /* Bit 90 Private Use (plane 15) + */ + /* Private Use (plane 16) */ +#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/ + /*U+100000-U+10FFFD*/ + /* Bit 91 Variation Selectors */ +#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */ + /* Bit 92 Tags */ +#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/ + + + /*************************************************************************/ + /* */ + /* Some compilers have a very limited length of identifiers. */ + /* */ +#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ ) +#define HAVE_LIMIT_ON_IDENTS +#endif + + +#ifndef HAVE_LIMIT_ON_IDENTS + + + /*************************************************************************/ + /* */ + /* Here some alias #defines in order to be clearer. */ + /* */ + /* These are not always #defined to stay within the 31 character limit */ + /* which some compilers have. */ + /* */ + /* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern */ + /* Borland compilers (read: from BC++ 3.1 on) can increase this limit. */ + /* If you get a warning with such a compiler, use the -i40 switch. */ + /* */ +#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \ + TT_UCR_ARABIC_PRESENTATIONS_A +#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \ + TT_UCR_ARABIC_PRESENTATIONS_B + +#define TT_UCR_COMBINING_DIACRITICAL_MARKS \ + TT_UCR_COMBINING_DIACRITICS +#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \ + TT_UCR_COMBINING_DIACRITICS_SYMB + + +#endif /* !HAVE_LIMIT_ON_IDENTS */ + + +FT_END_HEADER + +#endif /* __TTNAMEID_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/tttables.h b/extlibs/headers/freetype/tttables.h new file mode 100644 index 00000000..051c1eaf --- /dev/null +++ b/extlibs/headers/freetype/tttables.h @@ -0,0 +1,731 @@ +/***************************************************************************/ +/* */ +/* tttables.h */ +/* */ +/* Basic SFNT/TrueType tables definitions and interface */ +/* (specification only). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTTABLES_H__ +#define __TTTABLES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + /*************************************************************************/ + /* */ + /* <Section> */ + /* truetype_tables */ + /* */ + /* <Title> */ + /* TrueType Tables */ + /* */ + /* <Abstract> */ + /* TrueType specific table types and functions. */ + /* */ + /* <Description> */ + /* This section contains the definition of TrueType-specific tables */ + /* as well as some routines used to access and process them. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_Header */ + /* */ + /* <Description> */ + /* A structure used to model a TrueType font header table. All */ + /* fields follow the TrueType specification. */ + /* */ + typedef struct TT_Header_ + { + FT_Fixed Table_Version; + FT_Fixed Font_Revision; + + FT_Long CheckSum_Adjust; + FT_Long Magic_Number; + + FT_UShort Flags; + FT_UShort Units_Per_EM; + + FT_Long Created [2]; + FT_Long Modified[2]; + + FT_Short xMin; + FT_Short yMin; + FT_Short xMax; + FT_Short yMax; + + FT_UShort Mac_Style; + FT_UShort Lowest_Rec_PPEM; + + FT_Short Font_Direction; + FT_Short Index_To_Loc_Format; + FT_Short Glyph_Data_Format; + + } TT_Header; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_HoriHeader */ + /* */ + /* <Description> */ + /* A structure used to model a TrueType horizontal header, the `hhea' */ + /* table, as well as the corresponding horizontal metrics table, */ + /* i.e., the `hmtx' table. */ + /* */ + /* <Fields> */ + /* Version :: The table version. */ + /* */ + /* Ascender :: The font's ascender, i.e., the distance */ + /* from the baseline to the top-most of all */ + /* glyph points found in the font. */ + /* */ + /* This value is invalid in many fonts, as */ + /* it is usually set by the font designer, */ + /* and often reflects only a portion of the */ + /* glyphs found in the font (maybe ASCII). */ + /* */ + /* You should use the `sTypoAscender' field */ + /* of the OS/2 table instead if you want */ + /* the correct one. */ + /* */ + /* Descender :: The font's descender, i.e., the distance */ + /* from the baseline to the bottom-most of */ + /* all glyph points found in the font. It */ + /* is negative. */ + /* */ + /* This value is invalid in many fonts, as */ + /* it is usually set by the font designer, */ + /* and often reflects only a portion of the */ + /* glyphs found in the font (maybe ASCII). */ + /* */ + /* You should use the `sTypoDescender' */ + /* field of the OS/2 table instead if you */ + /* want the correct one. */ + /* */ + /* Line_Gap :: The font's line gap, i.e., the distance */ + /* to add to the ascender and descender to */ + /* get the BTB, i.e., the */ + /* baseline-to-baseline distance for the */ + /* font. */ + /* */ + /* advance_Width_Max :: This field is the maximum of all advance */ + /* widths found in the font. It can be */ + /* used to compute the maximum width of an */ + /* arbitrary string of text. */ + /* */ + /* min_Left_Side_Bearing :: The minimum left side bearing of all */ + /* glyphs within the font. */ + /* */ + /* min_Right_Side_Bearing :: The minimum right side bearing of all */ + /* glyphs within the font. */ + /* */ + /* xMax_Extent :: The maximum horizontal extent (i.e., the */ + /* `width' of a glyph's bounding box) for */ + /* all glyphs in the font. */ + /* */ + /* caret_Slope_Rise :: The rise coefficient of the cursor's */ + /* slope of the cursor (slope=rise/run). */ + /* */ + /* caret_Slope_Run :: The run coefficient of the cursor's */ + /* slope. */ + /* */ + /* Reserved :: 10 reserved bytes. */ + /* */ + /* metric_Data_Format :: Always 0. */ + /* */ + /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ + /* table -- this value can be smaller than */ + /* the total number of glyphs in the font. */ + /* */ + /* long_metrics :: A pointer into the `hmtx' table. */ + /* */ + /* short_metrics :: A pointer into the `hmtx' table. */ + /* */ + /* <Note> */ + /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ + /* be identical except for the names of their fields which */ + /* are different. */ + /* */ + /* This ensures that a single function in the `ttload' */ + /* module is able to read both the horizontal and vertical */ + /* headers. */ + /* */ + typedef struct TT_HoriHeader_ + { + FT_Fixed Version; + FT_Short Ascender; + FT_Short Descender; + FT_Short Line_Gap; + + FT_UShort advance_Width_Max; /* advance width maximum */ + + FT_Short min_Left_Side_Bearing; /* minimum left-sb */ + FT_Short min_Right_Side_Bearing; /* minimum right-sb */ + FT_Short xMax_Extent; /* xmax extents */ + FT_Short caret_Slope_Rise; + FT_Short caret_Slope_Run; + FT_Short caret_Offset; + + FT_Short Reserved[4]; + + FT_Short metric_Data_Format; + FT_UShort number_Of_HMetrics; + + /* The following fields are not defined by the TrueType specification */ + /* but they are used to connect the metrics header to the relevant */ + /* `HMTX' table. */ + + void* long_metrics; + void* short_metrics; + + } TT_HoriHeader; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_VertHeader */ + /* */ + /* <Description> */ + /* A structure used to model a TrueType vertical header, the `vhea' */ + /* table, as well as the corresponding vertical metrics table, i.e., */ + /* the `vmtx' table. */ + /* */ + /* <Fields> */ + /* Version :: The table version. */ + /* */ + /* Ascender :: The font's ascender, i.e., the distance */ + /* from the baseline to the top-most of */ + /* all glyph points found in the font. */ + /* */ + /* This value is invalid in many fonts, as */ + /* it is usually set by the font designer, */ + /* and often reflects only a portion of */ + /* the glyphs found in the font (maybe */ + /* ASCII). */ + /* */ + /* You should use the `sTypoAscender' */ + /* field of the OS/2 table instead if you */ + /* want the correct one. */ + /* */ + /* Descender :: The font's descender, i.e., the */ + /* distance from the baseline to the */ + /* bottom-most of all glyph points found */ + /* in the font. It is negative. */ + /* */ + /* This value is invalid in many fonts, as */ + /* it is usually set by the font designer, */ + /* and often reflects only a portion of */ + /* the glyphs found in the font (maybe */ + /* ASCII). */ + /* */ + /* You should use the `sTypoDescender' */ + /* field of the OS/2 table instead if you */ + /* want the correct one. */ + /* */ + /* Line_Gap :: The font's line gap, i.e., the distance */ + /* to add to the ascender and descender to */ + /* get the BTB, i.e., the */ + /* baseline-to-baseline distance for the */ + /* font. */ + /* */ + /* advance_Height_Max :: This field is the maximum of all */ + /* advance heights found in the font. It */ + /* can be used to compute the maximum */ + /* height of an arbitrary string of text. */ + /* */ + /* min_Top_Side_Bearing :: The minimum top side bearing of all */ + /* glyphs within the font. */ + /* */ + /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ + /* glyphs within the font. */ + /* */ + /* yMax_Extent :: The maximum vertical extent (i.e., the */ + /* `height' of a glyph's bounding box) for */ + /* all glyphs in the font. */ + /* */ + /* caret_Slope_Rise :: The rise coefficient of the cursor's */ + /* slope of the cursor (slope=rise/run). */ + /* */ + /* caret_Slope_Run :: The run coefficient of the cursor's */ + /* slope. */ + /* */ + /* caret_Offset :: The cursor's offset for slanted fonts. */ + /* This value is `reserved' in vmtx */ + /* version 1.0. */ + /* */ + /* Reserved :: 8 reserved bytes. */ + /* */ + /* metric_Data_Format :: Always 0. */ + /* */ + /* number_Of_HMetrics :: Number of VMetrics entries in the */ + /* `vmtx' table -- this value can be */ + /* smaller than the total number of glyphs */ + /* in the font. */ + /* */ + /* long_metrics :: A pointer into the `vmtx' table. */ + /* */ + /* short_metrics :: A pointer into the `vmtx' table. */ + /* */ + /* <Note> */ + /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ + /* be identical except for the names of their fields which */ + /* are different. */ + /* */ + /* This ensures that a single function in the `ttload' */ + /* module is able to read both the horizontal and vertical */ + /* headers. */ + /* */ + typedef struct TT_VertHeader_ + { + FT_Fixed Version; + FT_Short Ascender; + FT_Short Descender; + FT_Short Line_Gap; + + FT_UShort advance_Height_Max; /* advance height maximum */ + + FT_Short min_Top_Side_Bearing; /* minimum left-sb or top-sb */ + FT_Short min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */ + FT_Short yMax_Extent; /* xmax or ymax extents */ + FT_Short caret_Slope_Rise; + FT_Short caret_Slope_Run; + FT_Short caret_Offset; + + FT_Short Reserved[4]; + + FT_Short metric_Data_Format; + FT_UShort number_Of_VMetrics; + + /* The following fields are not defined by the TrueType specification */ + /* but they're used to connect the metrics header to the relevant */ + /* `HMTX' or `VMTX' table. */ + + void* long_metrics; + void* short_metrics; + + } TT_VertHeader; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_OS2 */ + /* */ + /* <Description> */ + /* A structure used to model a TrueType OS/2 table. This is the long */ + /* table version. All fields comply to the TrueType specification. */ + /* */ + /* Note that we now support old Mac fonts which do not include an */ + /* OS/2 table. In this case, the `version' field is always set to */ + /* 0xFFFF. */ + /* */ + typedef struct TT_OS2_ + { + FT_UShort version; /* 0x0001 - more or 0xFFFF */ + FT_Short xAvgCharWidth; + FT_UShort usWeightClass; + FT_UShort usWidthClass; + FT_Short fsType; + FT_Short ySubscriptXSize; + FT_Short ySubscriptYSize; + FT_Short ySubscriptXOffset; + FT_Short ySubscriptYOffset; + FT_Short ySuperscriptXSize; + FT_Short ySuperscriptYSize; + FT_Short ySuperscriptXOffset; + FT_Short ySuperscriptYOffset; + FT_Short yStrikeoutSize; + FT_Short yStrikeoutPosition; + FT_Short sFamilyClass; + + FT_Byte panose[10]; + + FT_ULong ulUnicodeRange1; /* Bits 0-31 */ + FT_ULong ulUnicodeRange2; /* Bits 32-63 */ + FT_ULong ulUnicodeRange3; /* Bits 64-95 */ + FT_ULong ulUnicodeRange4; /* Bits 96-127 */ + + FT_Char achVendID[4]; + + FT_UShort fsSelection; + FT_UShort usFirstCharIndex; + FT_UShort usLastCharIndex; + FT_Short sTypoAscender; + FT_Short sTypoDescender; + FT_Short sTypoLineGap; + FT_UShort usWinAscent; + FT_UShort usWinDescent; + + /* only version 1 tables: */ + + FT_ULong ulCodePageRange1; /* Bits 0-31 */ + FT_ULong ulCodePageRange2; /* Bits 32-63 */ + + /* only version 2 tables: */ + + FT_Short sxHeight; + FT_Short sCapHeight; + FT_UShort usDefaultChar; + FT_UShort usBreakChar; + FT_UShort usMaxContext; + + } TT_OS2; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_Postscript */ + /* */ + /* <Description> */ + /* A structure used to model a TrueType Postscript table. All fields */ + /* comply to the TrueType table. This structure does not reference */ + /* the Postscript glyph names, which can be nevertheless accessed */ + /* with the `ttpost' module. */ + /* */ + typedef struct TT_Postscript_ + { + FT_Fixed FormatType; + FT_Fixed italicAngle; + FT_Short underlinePosition; + FT_Short underlineThickness; + FT_ULong isFixedPitch; + FT_ULong minMemType42; + FT_ULong maxMemType42; + FT_ULong minMemType1; + FT_ULong maxMemType1; + + /* Glyph names follow in the file, but we don't */ + /* load them by default. See the ttpost.c file. */ + + } TT_Postscript; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_PCLT */ + /* */ + /* <Description> */ + /* A structure used to model a TrueType PCLT table. All fields */ + /* comply to the TrueType table. */ + /* */ + typedef struct TT_PCLT_ + { + FT_Fixed Version; + FT_ULong FontNumber; + FT_UShort Pitch; + FT_UShort xHeight; + FT_UShort Style; + FT_UShort TypeFamily; + FT_UShort CapHeight; + FT_UShort SymbolSet; + FT_Char TypeFace[16]; + FT_Char CharacterComplement[8]; + FT_Char FileName[6]; + FT_Char StrokeWeight; + FT_Char WidthType; + FT_Byte SerifStyle; + FT_Byte Reserved; + + } TT_PCLT; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* TT_MaxProfile */ + /* */ + /* <Description> */ + /* The maximum profile is a table containing many max values which */ + /* can be used to pre-allocate arrays. This ensures that no memory */ + /* allocation occurs during a glyph load. */ + /* */ + /* <Fields> */ + /* version :: The version number. */ + /* */ + /* numGlyphs :: The number of glyphs in this TrueType */ + /* font. */ + /* */ + /* maxPoints :: The maximum number of points in a */ + /* non-composite TrueType glyph. See also */ + /* the structure element */ + /* `maxCompositePoints'. */ + /* */ + /* maxContours :: The maximum number of contours in a */ + /* non-composite TrueType glyph. See also */ + /* the structure element */ + /* `maxCompositeContours'. */ + /* */ + /* maxCompositePoints :: The maximum number of points in a */ + /* composite TrueType glyph. See also the */ + /* structure element `maxPoints'. */ + /* */ + /* maxCompositeContours :: The maximum number of contours in a */ + /* composite TrueType glyph. See also the */ + /* structure element `maxContours'. */ + /* */ + /* maxZones :: The maximum number of zones used for */ + /* glyph hinting. */ + /* */ + /* maxTwilightPoints :: The maximum number of points in the */ + /* twilight zone used for glyph hinting. */ + /* */ + /* maxStorage :: The maximum number of elements in the */ + /* storage area used for glyph hinting. */ + /* */ + /* maxFunctionDefs :: The maximum number of function */ + /* definitions in the TrueType bytecode for */ + /* this font. */ + /* */ + /* maxInstructionDefs :: The maximum number of instruction */ + /* definitions in the TrueType bytecode for */ + /* this font. */ + /* */ + /* maxStackElements :: The maximum number of stack elements used */ + /* during bytecode interpretation. */ + /* */ + /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ + /* used for glyph hinting. */ + /* */ + /* maxComponentElements :: The maximum number of simple (i.e., non- */ + /* composite) glyphs in a composite glyph. */ + /* */ + /* maxComponentDepth :: The maximum nesting depth of composite */ + /* glyphs. */ + /* */ + /* <Note> */ + /* This structure is only used during font loading. */ + /* */ + typedef struct TT_MaxProfile_ + { + FT_Fixed version; + FT_UShort numGlyphs; + FT_UShort maxPoints; + FT_UShort maxContours; + FT_UShort maxCompositePoints; + FT_UShort maxCompositeContours; + FT_UShort maxZones; + FT_UShort maxTwilightPoints; + FT_UShort maxStorage; + FT_UShort maxFunctionDefs; + FT_UShort maxInstructionDefs; + FT_UShort maxStackElements; + FT_UShort maxSizeOfInstructions; + FT_UShort maxComponentElements; + FT_UShort maxComponentDepth; + + } TT_MaxProfile; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* FT_Sfnt_Tag */ + /* */ + /* <Description> */ + /* An enumeration used to specify the index of an SFNT table. */ + /* Used in the @FT_Get_Sfnt_Table API function. */ + /* */ + typedef enum + { + ft_sfnt_head = 0, + ft_sfnt_maxp = 1, + ft_sfnt_os2 = 2, + ft_sfnt_hhea = 3, + ft_sfnt_vhea = 4, + ft_sfnt_post = 5, + ft_sfnt_pclt = 6, + + sfnt_max /* internal end mark */ + + } FT_Sfnt_Tag; + + /* */ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_Sfnt_Table */ + /* */ + /* <Description> */ + /* Returns a pointer to a given SFNT table within a face. */ + /* */ + /* <Input> */ + /* face :: A handle to the source. */ + /* */ + /* tag :: The index of the SFNT table. */ + /* */ + /* <Return> */ + /* A type-less pointer to the table. This will be 0 in case of */ + /* error, or if the corresponding table was not found *OR* loaded */ + /* from the file. */ + /* */ + /* <Note> */ + /* The table is owned by the face object and disappears with it. */ + /* */ + /* This function is only useful to access SFNT tables that are loaded */ + /* by the sfnt/truetype/opentype drivers. See @FT_Sfnt_Tag for a */ + /* list. */ + /* */ + FT_EXPORT( void* ) + FT_Get_Sfnt_Table( FT_Face face, + FT_Sfnt_Tag tag ); + + + /************************************************************************** + * + * <Function> + * FT_Load_Sfnt_Table + * + * <Description> + * Loads any font table into client memory. + * + * <Input> + * face :: A handle to the source face. + * + * tag :: The 4-byte tag of the table to load. Use the value 0 if + * you want to access the whole font file. Otherwise, you can + * use one of the definitions found in the @FT_TRUETYPE_TAGS_H + * file, or forge a new one with @FT_MAKE_TAG. + * + * offset :: The starting offset in the table (or file if tag == 0). + * + * <Output> + * buffer :: The target buffer address. The client must ensure that + * the memory array is big enough to hold the data. + * + * <InOut> + * length :: If the `length' parameter is NULL, then try to load the whole + * table. Return an error code if it fails. + * + * Else, if `*length' is 0, exit immediately while returning + * the table's (or file) full size in it. + * + * Else the number of bytes to read from the table or file, + * from the starting offset. + * + * <Return> + * FreeType error code. 0 means success. + * + * <Note> + * If you need to determine the table's length you should first call this + * function with `*length' set to 0, as in the following example: + * + * { + * FT_ULong length = 0; + * + * + * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); + * if ( error ) { ... table does not exist ... } + * + * buffer = malloc( length ); + * if ( buffer == NULL ) { ... not enough memory ... } + * + * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); + * if ( error ) { ... could not load table ... } + * } + */ + FT_EXPORT( FT_Error ) + FT_Load_Sfnt_Table( FT_Face face, + FT_ULong tag, + FT_Long offset, + FT_Byte* buffer, + FT_ULong* length ); + + + /************************************************************************** + * + * <Function> + * FT_Sfnt_Table_Info + * + * <Description> + * Returns information on an SFNT table. + * + * <Input> + * face :: + * A handle to the source face. + * + * table_index :: + * The index of an SFNT table. The function returns + * FT_Err_Table_Missing for an invalid value. + * + * <Output> + * tag :: + * The name tag of the SFNT table. + * + * length :: + * The length of the SFNT table. + * + * <Return> + * FreeType error code. 0 means success. + * + * <Note> + * SFNT tables with length zero are treated as missing by Windows. + * + */ + FT_EXPORT( FT_Error ) + FT_Sfnt_Table_Info( FT_Face face, + FT_UInt table_index, + FT_ULong *tag, + FT_ULong *length ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_CMap_Language_ID */ + /* */ + /* <Description> */ + /* Return TrueType/sfnt specific cmap language ID. Definitions of */ + /* language ID values are in freetype/ttnameid.h. */ + /* */ + /* <Input> */ + /* charmap :: */ + /* The target charmap. */ + /* */ + /* <Return> */ + /* The language ID of `charmap'. If `charmap' doesn't belong to a */ + /* TrueType/sfnt face, just return 0 as the default value. */ + /* */ + FT_EXPORT( FT_ULong ) + FT_Get_CMap_Language_ID( FT_CharMap charmap ); + + /* */ + + +FT_END_HEADER + +#endif /* __TTTABLES_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/tttags.h b/extlibs/headers/freetype/tttags.h new file mode 100644 index 00000000..9fee71bf --- /dev/null +++ b/extlibs/headers/freetype/tttags.h @@ -0,0 +1,87 @@ +/***************************************************************************/ +/* */ +/* tttags.h */ +/* */ +/* Tags for TrueType and OpenType tables (specification only). */ +/* */ +/* Copyright 1996-2001, 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTAGS_H__ +#define __TTAGS_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) +#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) +#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) +#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) +#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) +#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) +#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) +#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) +#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) +#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) +#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) +#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) +#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) +#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) +#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) +#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) +#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) +#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) +#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) +#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) +#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) +#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) +#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) +#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) +#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) +#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) +#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) +#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) +#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) +#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) +#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) +#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) +#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) +#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) +#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) +#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) +#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) +#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) +#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) +#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) +#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) +#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) +#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) +#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) + + +FT_END_HEADER + +#endif /* __TTAGS_H__ */ + + +/* END */ diff --git a/extlibs/headers/freetype/ttunpat.h b/extlibs/headers/freetype/ttunpat.h new file mode 100644 index 00000000..0bc0a6fe --- /dev/null +++ b/extlibs/headers/freetype/ttunpat.h @@ -0,0 +1,59 @@ +/***************************************************************************/ +/* */ +/* ttunpat.h */ +/* */ +/* Definitions for the unpatented TrueType hinting system */ +/* */ +/* Copyright 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* Written by Graham Asher <graham.asher@btinternet.com> */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTUNPAT_H__ +#define __TTUNPAT_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_UNPATENTED_HINTING + * + * @description: + * A constant used as the tag of an @FT_Parameter structure to indicate + * that unpatented methods only should be used by the TrueType bytecode + * interpreter for a typeface opened by FT_Open_Face. + * + */ +#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) + + /* */ + +FT_END_HEADER + + +#endif /* __TTUNPAT_H__ */ + + +/* END */ diff --git a/extlibs/headers/ft2build.h b/extlibs/headers/ft2build.h new file mode 100644 index 00000000..7390dc49 --- /dev/null +++ b/extlibs/headers/ft2build.h @@ -0,0 +1,61 @@ +/***************************************************************************/ +/* */ +/* ft2build.h */ +/* */ +/* Build macros of the FreeType 2 library. */ +/* */ +/* Copyright 1996-2001, 2003 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This is a Unix-specific version of <ft2build.h> that should be used */ + /* exclusively *after* installation of the library. */ + /* */ + /* It assumes that "/usr/local/include/freetype2" (or whatever is */ + /* returned by the "freetype-config --cflags" or "pkg-config --cflags" */ + /* command) is in your compilation include path. */ + /* */ + /* We don't need to do anything special in this release. However, for */ + /* a future FreeType 2 release, the following installation changes will */ + /* be performed: */ + /* */ + /* - The contents of "freetype-2.x/include/freetype" will be installed */ + /* to "/usr/local/include/freetype2" instead of */ + /* "/usr/local/include/freetype2/freetype". */ + /* */ + /* - This file will #include <freetype2/config/ftheader.h>, instead */ + /* of <freetype/config/ftheader.h>. */ + /* */ + /* - The contents of "ftheader.h" will be processed with `sed' to */ + /* replace all "<freetype/xxx>" with "<freetype2/xxx>". */ + /* */ + /* - Adding "/usr/local/include/freetype2" to your compilation include */ + /* path will not be necessary anymore. */ + /* */ + /* These changes will be transparent to client applications which use */ + /* freetype-config (or pkg-config). No modifications will be necessary */ + /* to compile with the new scheme. */ + /* */ + /*************************************************************************/ + + +#ifndef __FT2_BUILD_UNIX_H__ +#define __FT2_BUILD_UNIX_H__ + + /* "<prefix>/include/freetype2" must be in your current inclusion path */ +#include <freetype/config/ftheader.h> + +#endif /* __FT2_BUILD_UNIX_H__ */ + + +/* END */ diff --git a/extlibs/headers/sndfile.h b/extlibs/headers/sndfile.h new file mode 100644 index 00000000..46eb1884 --- /dev/null +++ b/extlibs/headers/sndfile.h @@ -0,0 +1,561 @@ +/* +** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com> +** +** This program 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 program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** sndfile.h -- system-wide definitions +** +** API documentation is in the doc/ directory of the source code tarball +** and at http://www.mega-nerd.com/libsndfile/api.html. +*/ + +#ifndef SNDFILE_H +#define SNDFILE_H + +/* This is the version 1.0.X header file. */ +#define SNDFILE_1 + +#include <stdio.h> +#ifdef __APPLE__ + #include <stdint.h> +#endif + +/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */ + +#if (defined (__MWERKS__)) +#include <unix.h> +#else +#include <sys/types.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* The following file types can be read and written. +** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise +** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and +** SF_FORMAT_SUBMASK can be used to separate the major and minor file +** types. +*/ + +enum +{ /* Major formats. */ + SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */ + SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */ + SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */ + SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */ + SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */ + SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */ + SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */ + SF_FORMAT_VOC = 0x080000, /* VOC files. */ + SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */ + SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */ + SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */ + SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */ + SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */ + SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */ + SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */ + SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */ + SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */ + SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */ + SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */ + SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */ + SF_FORMAT_CAF = 0x180000, /* Core Audio File format */ + + /* Subtypes from here on. */ + + SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */ + SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */ + SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */ + SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */ + + SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */ + + SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */ + SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */ + + SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */ + SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */ + SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */ + SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */ + + SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */ + SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */ + + SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */ + SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */ + SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */ + + SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */ + + SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */ + SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */ + + /* Endian-ness options. */ + + SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */ + SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */ + SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */ + SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */ + + SF_FORMAT_SUBMASK = 0x0000FFFF, + SF_FORMAT_TYPEMASK = 0x0FFF0000, + SF_FORMAT_ENDMASK = 0x30000000 +} ; + +/* +** The following are the valid command numbers for the sf_command() +** interface. The use of these commands is documented in the file +** command.html in the doc directory of the source code distribution. +*/ + +enum +{ SFC_GET_LIB_VERSION = 0x1000, + SFC_GET_LOG_INFO = 0x1001, + + SFC_GET_NORM_DOUBLE = 0x1010, + SFC_GET_NORM_FLOAT = 0x1011, + SFC_SET_NORM_DOUBLE = 0x1012, + SFC_SET_NORM_FLOAT = 0x1013, + SFC_SET_SCALE_FLOAT_INT_READ = 0x1014, + + SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020, + SFC_GET_SIMPLE_FORMAT = 0x1021, + + SFC_GET_FORMAT_INFO = 0x1028, + + SFC_GET_FORMAT_MAJOR_COUNT = 0x1030, + SFC_GET_FORMAT_MAJOR = 0x1031, + SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032, + SFC_GET_FORMAT_SUBTYPE = 0x1033, + + SFC_CALC_SIGNAL_MAX = 0x1040, + SFC_CALC_NORM_SIGNAL_MAX = 0x1041, + SFC_CALC_MAX_ALL_CHANNELS = 0x1042, + SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043, + SFC_GET_SIGNAL_MAX = 0x1044, + SFC_GET_MAX_ALL_CHANNELS = 0x1045, + + SFC_SET_ADD_PEAK_CHUNK = 0x1050, + + SFC_UPDATE_HEADER_NOW = 0x1060, + SFC_SET_UPDATE_HEADER_AUTO = 0x1061, + + SFC_FILE_TRUNCATE = 0x1080, + + SFC_SET_RAW_START_OFFSET = 0x1090, + + SFC_SET_DITHER_ON_WRITE = 0x10A0, + SFC_SET_DITHER_ON_READ = 0x10A1, + + SFC_GET_DITHER_INFO_COUNT = 0x10A2, + SFC_GET_DITHER_INFO = 0x10A3, + + SFC_GET_EMBED_FILE_INFO = 0x10B0, + + SFC_SET_CLIPPING = 0x10C0, + SFC_GET_CLIPPING = 0x10C1, + + SFC_GET_INSTRUMENT = 0x10D0, + SFC_SET_INSTRUMENT = 0x10D1, + + SFC_GET_LOOP_INFO = 0x10E0, + + SFC_GET_BROADCAST_INFO = 0x10F0, + SFC_SET_BROADCAST_INFO = 0x10F1, + + /* Following commands for testing only. */ + SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001, + + /* + ** SFC_SET_ADD_* values are deprecated and will disappear at some + ** time in the future. They are guaranteed to be here up to and + ** including version 1.0.8 to avoid breakage of existng software. + ** They currently do nothing and will continue to do nothing. + */ + SFC_SET_ADD_DITHER_ON_WRITE = 0x1070, + SFC_SET_ADD_DITHER_ON_READ = 0x1071 +} ; + + +/* +** String types that can be set and read from files. Not all file types +** support this and even the file types which support one, may not support +** all string types. +*/ + +enum +{ SF_STR_TITLE = 0x01, + SF_STR_COPYRIGHT = 0x02, + SF_STR_SOFTWARE = 0x03, + SF_STR_ARTIST = 0x04, + SF_STR_COMMENT = 0x05, + SF_STR_DATE = 0x06 +} ; + +/* +** Use the following as the start and end index when doing metadata +** transcoding. +*/ + +#define SF_STR_FIRST SF_STR_TITLE +#define SF_STR_LAST SF_STR_DATE + +enum +{ /* True and false */ + SF_FALSE = 0, + SF_TRUE = 1, + + /* Modes for opening files. */ + SFM_READ = 0x10, + SFM_WRITE = 0x20, + SFM_RDWR = 0x30 +} ; + +/* Public error values. These are guaranteed to remain unchanged for the duration +** of the library major version number. +** There are also a large number of private error numbers which are internal to +** the library which can change at any time. +*/ + +enum +{ SF_ERR_NO_ERROR = 0, + SF_ERR_UNRECOGNISED_FORMAT = 1, + SF_ERR_SYSTEM = 2, + SF_ERR_MALFORMED_FILE = 3, + SF_ERR_UNSUPPORTED_ENCODING = 4 +} ; + +/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */ + +typedef struct SNDFILE_tag SNDFILE ; + +/* The following typedef is system specific and is defined when libsndfile is. +** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), +** off64_t (Solaris), __int64_t (Win32) etc. +*/ + +#ifdef __APPLE__ +typedef int64_t sf_count_t ; +#else +typedef __int64 sf_count_t ; +#endif + +#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL + +/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in. +** On write, the SF_INFO structure is filled in by the user and passed into +** sf_open_write (). +*/ + +struct SF_INFO +{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */ + int samplerate ; + int channels ; + int format ; + int sections ; + int seekable ; +} ; + +typedef struct SF_INFO SF_INFO ; + +/* The SF_FORMAT_INFO struct is used to retrieve information about the sound +** file formats libsndfile supports using the sf_command () interface. +** +** Using this interface will allow applications to support new file formats +** and encoding types when libsndfile is upgraded, without requiring +** re-compilation of the application. +** +** Please consult the libsndfile documentation (particularly the information +** on the sf_command () interface) for examples of its use. +*/ + +typedef struct +{ int format ; + const char *name ; + const char *extension ; +} SF_FORMAT_INFO ; + +/* +** Enums and typedefs for adding dither on read and write. +** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE +** and SFC_SET_DITHER_ON_READ. +*/ + +enum +{ SFD_DEFAULT_LEVEL = 0, + SFD_CUSTOM_LEVEL = 0x40000000, + + SFD_NO_DITHER = 500, + SFD_WHITE = 501, + SFD_TRIANGULAR_PDF = 502 +} ; + +typedef struct +{ int type ; + double level ; + const char *name ; +} SF_DITHER_INFO ; + +/* Struct used to retrieve information about a file embedded within a +** larger file. See SFC_GET_EMBED_FILE_INFO. +*/ + +typedef struct +{ sf_count_t offset ; + sf_count_t length ; +} SF_EMBED_FILE_INFO ; + +/* +** Structs used to retrieve music sample information from a file. +*/ + +enum +{ /* + ** The loop mode field in SF_INSTRUMENT will be one of the following. + */ + SF_LOOP_NONE = 800, + SF_LOOP_FORWARD, + SF_LOOP_BACKWARD, + SF_LOOP_ALTERNATING +} ; + +typedef struct +{ int gain ; + char basenote, detune ; + char velocity_lo, velocity_hi ; + char key_lo, key_hi ; + int loop_count ; + + struct + { int mode ; + unsigned int start ; + unsigned int end ; + unsigned int count ; + } loops [16] ; /* make variable in a sensible way */ +} SF_INSTRUMENT ; + + + +/* Struct used to retrieve loop information from a file.*/ +typedef struct +{ + short time_sig_num ; /* any positive integer > 0 */ + short time_sig_den ; /* any positive power of 2 > 0 */ + int loop_mode ; /* see SF_LOOP enum */ + + int num_beats ; /* this is NOT the amount of quarter notes !!!*/ + /* a full bar of 4/4 is 4 beats */ + /* a full bar of 7/8 is 7 beats */ + + float bpm ; /* suggestion, as it can be calculated using other fields:*/ + /* file's lenght, file's sampleRate and our time_sig_den*/ + /* -> bpms are always the amount of _quarter notes_ per minute */ + + int root_key ; /* MIDI note, or -1 for None */ + int future [6] ; +} SF_LOOP_INFO ; + + +/* Struct used to retrieve broadcast (EBU) information from a file. +** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE. +*/ +typedef struct +{ char description [256] ; + char originator [32] ; + char originator_reference [32] ; + char origination_date [10] ; + char origination_time [8] ; + int time_reference_low ; + int time_reference_high ; + short version ; + char umid [64] ; + char reserved [190] ; + unsigned int coding_history_size ; + char coding_history [256] ; +} SF_BROADCAST_INFO ; + +typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ; +typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ; +typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ; +typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ; +typedef sf_count_t (*sf_vio_tell) (void *user_data) ; + +struct SF_VIRTUAL_IO +{ sf_vio_get_filelen get_filelen ; + sf_vio_seek seek ; + sf_vio_read read ; + sf_vio_write write ; + sf_vio_tell tell ; +} ; + +typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ; + +/* Open the specified file for read, write or both. On error, this will +** return a NULL pointer. To find the error number, pass a NULL SNDFILE +** to sf_perror () or sf_error_str (). +** All calls to sf_open() should be matched with a call to sf_close(). +*/ + +SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; + +/* Use the existing file descriptor to create a SNDFILE object. If close_desc +** is TRUE, the file descriptor will be closed when sf_close() is called. If +** it is FALSE, the descritor will not be closed. +** When passed a descriptor like this, the library will assume that the start +** of file header is at the current file offset. This allows sound files within +** larger container files to be read and/or written. +** On error, this will return a NULL pointer. To find the error number, pass a +** NULL SNDFILE to sf_perror () or sf_error_str (). +** All calls to sf_open_fd() should be matched with a call to sf_close(). + +*/ + +SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ; + +SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ; + +/* sf_error () returns a error number which can be translated to a text +** string using sf_error_number(). +*/ + +int sf_error (SNDFILE *sndfile) ; + +/* sf_strerror () returns to the caller a pointer to the current error message for +** the given SNDFILE. +*/ + +const char* sf_strerror (SNDFILE *sndfile) ; + +/* sf_error_number () allows the retrieval of the error string for each internal +** error number. +** +*/ + +const char* sf_error_number (int errnum) ; + +/* The following three error functions are deprecated but they will remain in the +** library for the forseeable future. The function sf_strerror() should be used +** in their place. +*/ + +int sf_perror (SNDFILE *sndfile) ; +int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ; + + +/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */ + +int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ; + +/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */ + +int sf_format_check (const SF_INFO *info) ; + +/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses +** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as +** stdio.h function fseek (). +** An offset of zero with whence set to SEEK_SET will position the +** read / write pointer to the first data sample. +** On success sf_seek returns the current position in (multi-channel) +** samples from the start of the file. +** Please see the libsndfile documentation for moving the read pointer +** separately from the write pointer on files open in mode SFM_RDWR. +** On error all of these functions return -1. +*/ + +sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ; + +/* Functions for retrieving and setting string data within sound files. +** Not all file types support this features; AIFF and WAV do. For both +** functions, the str_type parameter must be one of the SF_STR_* values +** defined above. +** On error, sf_set_string() returns non-zero while sf_get_string() +** returns NULL. +*/ + +int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ; + +const char* sf_get_string (SNDFILE *sndfile, int str_type) ; + +/* Functions for reading/writing the waveform data of a sound file. +*/ + +sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; +sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ; + +/* Functions for reading and writing the data chunk in terms of frames. +** The number of items actually read/written = frames * number of channels. +** sf_xxxx_raw read/writes the raw data bytes from/to the file +** sf_xxxx_short passes data in the native short format +** sf_xxxx_int passes data in the native int format +** sf_xxxx_float passes data in the native float format +** sf_xxxx_double passes data in the native double format +** All of these read/write function return number of frames read/written. +*/ + +sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ; +sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ; +sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ; +sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; +sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ; + +/* Functions for reading and writing the data chunk in terms of items. +** Otherwise similar to above. +** All of these read/write function return number of items read/written. +*/ + +sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ; +sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ; + +sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ; +sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ; + +sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ; +sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ; + +sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; +sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ; + +/* Close the SNDFILE and clean up all memory allocations associated with this +** file. +** Returns 0 on success, or an error number. +*/ + +int sf_close (SNDFILE *sndfile) ; + +/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file +** to force the writing of data to disk. If the file is opened SFM_READ +** no action is taken. +*/ + +void sf_write_sync (SNDFILE *sndfile) ; + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* SNDFILE_H */ diff --git a/extlibs/libs-mingw/libfreetype.a b/extlibs/libs-mingw/libfreetype.a new file mode 100644 index 00000000..f434fe7c Binary files /dev/null and b/extlibs/libs-mingw/libfreetype.a differ diff --git a/extlibs/libs-mingw/libopenal32.a b/extlibs/libs-mingw/libopenal32.a new file mode 100644 index 00000000..234838e4 Binary files /dev/null and b/extlibs/libs-mingw/libopenal32.a differ diff --git a/extlibs/libs-mingw/libsndfile.a b/extlibs/libs-mingw/libsndfile.a new file mode 100644 index 00000000..1667abcd Binary files /dev/null and b/extlibs/libs-mingw/libsndfile.a differ diff --git a/extlibs/libs-vc2005/OpenAL32.lib b/extlibs/libs-vc2005/OpenAL32.lib new file mode 100644 index 00000000..855c94da Binary files /dev/null and b/extlibs/libs-vc2005/OpenAL32.lib differ diff --git a/extlibs/libs-vc2005/freetype.lib b/extlibs/libs-vc2005/freetype.lib new file mode 100644 index 00000000..a6d344a5 Binary files /dev/null and b/extlibs/libs-vc2005/freetype.lib differ diff --git a/extlibs/libs-vc2005/sndfile.lib b/extlibs/libs-vc2005/sndfile.lib new file mode 100644 index 00000000..be79d731 Binary files /dev/null and b/extlibs/libs-vc2005/sndfile.lib differ diff --git a/extlibs/libs-xcode/libfreetype.a b/extlibs/libs-xcode/libfreetype.a new file mode 100644 index 00000000..e35ca8c0 Binary files /dev/null and b/extlibs/libs-xcode/libfreetype.a differ diff --git a/extlibs/libs-xcode/libsndfile.a b/extlibs/libs-xcode/libsndfile.a new file mode 100644 index 00000000..d7181c6d Binary files /dev/null and b/extlibs/libs-xcode/libsndfile.a differ diff --git a/footer.htm b/footer.htm new file mode 100644 index 00000000..382cfc12 --- /dev/null +++ b/footer.htm @@ -0,0 +1,8 @@ + + <p id="footer"> +  ::  Copyright © 2007-2008 Laurent Gomila, all rights reserved  ::  + Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a>  ::  + </p> + + </body> +</html> diff --git a/header.htm b/header.htm new file mode 100644 index 00000000..0ac39bc0 --- /dev/null +++ b/header.htm @@ -0,0 +1,12 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <title>SFML - Simple and Fast Multimedia Library + + + + + + diff --git a/include/SFML/Audio.hpp b/include/SFML/Audio.hpp new file mode 100644 index 00000000..574d4d21 --- /dev/null +++ b/include/SFML/Audio.hpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_HPP +#define SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_AUDIO_HPP diff --git a/include/SFML/Audio/AudioResource.hpp b/include/SFML/Audio/AudioResource.hpp new file mode 100644 index 00000000..c0dbdb2f --- /dev/null +++ b/include/SFML/Audio/AudioResource.hpp @@ -0,0 +1,67 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIORESOURCE_HPP +#define SFML_AUDIORESOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Abstract base class for every class that owns a +/// device-dependant resource -- allow them to initialize / shutdown +/// even when the audio context is not created +//////////////////////////////////////////////////////////// +class SFML_API AudioResource +{ +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + AudioResource(); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + //////////////////////////////////////////////////////////// + AudioResource(const AudioResource&); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~AudioResource(); +}; + +} // namespace sf + + +#endif // SFML_AUDIORESOURCE_HPP diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp new file mode 100644 index 00000000..c6679b39 --- /dev/null +++ b/include/SFML/Audio/Listener.hpp @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LISTENER_HPP +#define SFML_LISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Listener is a global interface for defining the audio +/// listener properties ; the audio listener is the point in +/// the scene from where all the sounds are heard +//////////////////////////////////////////////////////////// +class SFML_API Listener +{ +public : + + //////////////////////////////////////////////////////////// + /// Change the global volume of all the sounds. + /// The default volume is 100 + /// + /// \param Volume : New global volume, in the range [0, 100] + /// + //////////////////////////////////////////////////////////// + static void SetGlobalVolume(float Volume); + + //////////////////////////////////////////////////////////// + /// Get the current value of the global volume of all the sounds + /// + /// \return Current global volume, in the range [0, 100] + /// + //////////////////////////////////////////////////////////// + static float GetGlobalVolume(); + + //////////////////////////////////////////////////////////// + /// Change the position of the listener (take 3 values). + /// The default position is (0, 0, 0) + /// + /// \param X, Y, Z : Position of the listener in the world + /// + //////////////////////////////////////////////////////////// + static void SetPosition(float X, float Y, float Z); + + //////////////////////////////////////////////////////////// + /// Change the position of the listener (take a 3D vector). + /// The default position is (0, 0, 0) + /// + /// \param Position : Position of the listener in the world + /// + //////////////////////////////////////////////////////////// + static void SetPosition(const Vector3f& Position); + + //////////////////////////////////////////////////////////// + /// Get the current position of the listener + /// + /// \return Position of the listener in the world + /// + //////////////////////////////////////////////////////////// + static Vector3f GetPosition(); + + //////////////////////////////////////////////////////////// + /// Change the orientation of the listener (the point + /// he must look at) (take 3 values). + /// The default target is (0, 0, -1) + /// + /// \param X, Y, Z : Position of the point the listener must look at + /// + //////////////////////////////////////////////////////////// + static void SetTarget(float X, float Y, float Z); + + //////////////////////////////////////////////////////////// + /// Change the orientation of the listener (the point + /// he must look at) (take a 3D vector). + /// The default target is (0, 0, -1) + /// + /// \param Target : Position of the point the listener must look at + /// + //////////////////////////////////////////////////////////// + static void SetTarget(const Vector3f& Target); + + //////////////////////////////////////////////////////////// + /// Get the current orientation of the listener (the point + /// he's looking at) + /// + /// \return : Position of the point the listener is looking at + /// + //////////////////////////////////////////////////////////// + static Vector3f GetTarget(); +}; + +} // namespace sf + + +#endif // SFML_LISTENER_HPP diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp new file mode 100644 index 00000000..2820c2a4 --- /dev/null +++ b/include/SFML/Audio/Music.hpp @@ -0,0 +1,120 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUSIC_HPP +#define SFML_MUSIC_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class SoundFile; +} + +//////////////////////////////////////////////////////////// +/// Music defines a big sound played using streaming, +/// so usually what we call a music :) +//////////////////////////////////////////////////////////// +class SFML_API Music : public SoundStream +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the music with a buffer size + /// + /// \param BufferSize : Size of the internal buffer, expressed in number of samples + /// (ie. size taken by the music in memory) (44100 by default) + /// + //////////////////////////////////////////////////////////// + Music(std::size_t BufferSize = 44100); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~Music(); + + //////////////////////////////////////////////////////////// + /// Open a music file (doesn't play it -- call Play() for that) + /// + /// \param Filename : Path of the music file to open + /// + /// \return True if loading has been successful + /// + //////////////////////////////////////////////////////////// + bool OpenFromFile(const std::string& Filename); + + //////////////////////////////////////////////////////////// + /// Open a music file from memory (doesn't play it -- call Play() for that) + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// + /// \return True if loading has been successful + /// + //////////////////////////////////////////////////////////// + bool OpenFromMemory(const char* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// Get the music duration + /// + /// \return Music duration, in seconds + /// + //////////////////////////////////////////////////////////// + float GetDuration() const; + +private : + + //////////////////////////////////////////////////////////// + /// /see SoundStream::OnStart + /// + //////////////////////////////////////////////////////////// + virtual bool OnStart(); + + //////////////////////////////////////////////////////////// + /// /see SoundStream::OnGetData + /// + //////////////////////////////////////////////////////////// + virtual bool OnGetData(Chunk& Data); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::SoundFile* myFile; ///< Sound file + float myDuration; ///< Music duration, in seconds + std::vector mySamples; ///< Temporary buffer of samples +}; + +} // namespace sf + + +#endif // SFML_MUSIC_HPP diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp new file mode 100644 index 00000000..cced19e1 --- /dev/null +++ b/include/SFML/Audio/Sound.hpp @@ -0,0 +1,286 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUND_HPP +#define SFML_SOUND_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class SoundBuffer; + +//////////////////////////////////////////////////////////// +/// Sound defines the properties of a sound such as position, +/// volume, pitch, etc. +//////////////////////////////////////////////////////////// +class SFML_API Sound : public AudioResource +{ +public : + + //////////////////////////////////////////////////////////// + /// Enumeration of the sound states + //////////////////////////////////////////////////////////// + enum Status + { + Stopped, ///< Sound is not playing + Paused, ///< Sound is paused + Playing ///< Sound is playing + }; + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Sound(); + + //////////////////////////////////////////////////////////// + /// Construct the sound from its parameters + /// + /// \param Buffer : Sound buffer to play (NULL by default) + /// \param Loop : Loop flag (false by default) + /// \param Pitch : Value of the pitch (1 by default) + /// \param Volume : Volume (100 by default) + /// \param Position : Position (0, 0, 0 by default) + /// + //////////////////////////////////////////////////////////// + Sound(const SoundBuffer& Buffer, bool Loop = false, float Pitch = 1.f, float Volume = 100.f, const Vector3f& Position = Vector3f(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + /// \param Copy : Instance to copy + /// + //////////////////////////////////////////////////////////// + Sound(const Sound& Copy); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~Sound(); + + //////////////////////////////////////////////////////////// + /// Play the sound + /// + //////////////////////////////////////////////////////////// + void Play(); + + //////////////////////////////////////////////////////////// + /// Pause the sound + /// + //////////////////////////////////////////////////////////// + void Pause(); + + //////////////////////////////////////////////////////////// + /// Stop the sound + /// + //////////////////////////////////////////////////////////// + void Stop(); + + //////////////////////////////////////////////////////////// + /// Set the source buffer + /// + /// \param Buffer : New sound buffer to bind to the sound + /// + //////////////////////////////////////////////////////////// + void SetBuffer(const SoundBuffer& Buffer); + + //////////////////////////////////////////////////////////// + /// Set the sound loop state. + /// This parameter is disabled by default + /// + /// \param Loop : True to play in loop, false to play once + /// + //////////////////////////////////////////////////////////// + void SetLoop(bool Loop); + + //////////////////////////////////////////////////////////// + /// Set the sound pitch. + /// The default pitch is 1 + /// + /// \param Pitch : New pitch + /// + //////////////////////////////////////////////////////////// + void SetPitch(float Pitch); + + //////////////////////////////////////////////////////////// + /// Set the sound volume. + /// The default volume is 100 + /// + /// \param Volume : Volume (in range [0, 100]) + /// + //////////////////////////////////////////////////////////// + void SetVolume(float Volume); + + //////////////////////////////////////////////////////////// + /// Set the sound position (take 3 values). + /// The default position is (0, 0, 0) + /// + /// \param X, Y, Z : Position of the sound in the world + /// + //////////////////////////////////////////////////////////// + void SetPosition(float X, float Y, float Z); + + //////////////////////////////////////////////////////////// + /// Set the sound position (take a 3D vector). + /// The default position is (0, 0, 0) + /// + /// \param Position : Position of the sound in the world + /// + //////////////////////////////////////////////////////////// + void SetPosition(const Vector3f& Position); + + //////////////////////////////////////////////////////////// + /// Set the minimum distance - closer than this distance, + /// the listener will hear the sound at its maximum volume. + /// The default minimum distance is 1.0 + /// + /// \param MinDistance : New minimum distance for the sound + /// + //////////////////////////////////////////////////////////// + void SetMinDistance(float MinDistance); + + //////////////////////////////////////////////////////////// + /// Set the attenuation factor - the higher the attenuation, the + /// more the sound will be attenuated with distance from listener. + /// The default attenuation factor 1.0 + /// + /// \param Attenuation : New attenuation factor for the sound + /// + //////////////////////////////////////////////////////////// + void SetAttenuation(float Attenuation); + + //////////////////////////////////////////////////////////// + /// Set the current playing position of the sound + /// + /// \param TimeOffset : New playing position, expressed in seconds + /// + //////////////////////////////////////////////////////////// + void SetPlayingOffset(float TimeOffset); + + //////////////////////////////////////////////////////////// + /// Get the source buffer + /// + /// \return Sound buffer bound to the sound (can be NULL) + /// + //////////////////////////////////////////////////////////// + const SoundBuffer* GetBuffer() const; + + //////////////////////////////////////////////////////////// + /// Tell whether or not the sound is looping + /// + /// \return True if the sound is looping, false otherwise + /// + //////////////////////////////////////////////////////////// + bool GetLoop() const; + + //////////////////////////////////////////////////////////// + /// Get the pitch + /// + /// \return Pitch value + /// + //////////////////////////////////////////////////////////// + float GetPitch() const; + + //////////////////////////////////////////////////////////// + /// Get the volume + /// + /// \return Volume value (in range [1, 100]) + /// + //////////////////////////////////////////////////////////// + float GetVolume() const; + + //////////////////////////////////////////////////////////// + /// Get the sound position + /// + /// \return Position of the sound in the world + /// + //////////////////////////////////////////////////////////// + Vector3f GetPosition() const; + + //////////////////////////////////////////////////////////// + /// Get the minimum distance + /// + /// \return Minimum distance for the sound + /// + //////////////////////////////////////////////////////////// + float GetMinDistance() const; + + //////////////////////////////////////////////////////////// + /// Get the attenuation factor + /// + /// \return Attenuation factor of the sound + /// + //////////////////////////////////////////////////////////// + float GetAttenuation() const; + + //////////////////////////////////////////////////////////// + /// Get the status of the sound (stopped, paused, playing) + /// + /// \return Current status of the sound + /// + //////////////////////////////////////////////////////////// + Status GetStatus() const; + + //////////////////////////////////////////////////////////// + /// Get the current playing position of the sound + /// + /// \return Current playing position, expressed in seconds + /// + //////////////////////////////////////////////////////////// + float GetPlayingOffset() const; + + //////////////////////////////////////////////////////////// + /// Assignment operator + /// + /// \param Other : Instance to assign + /// + /// \return Reference to the sound + /// + //////////////////////////////////////////////////////////// + Sound& operator =(const Sound& Other); + +private : + + friend class SoundStream; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int mySource; ///< OpenAL source identifier + ResourcePtr myBuffer; ///< Sound buffer bound to the source +}; + +} // namespace sf + + +#endif // SFML_SOUND_HPP diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp new file mode 100644 index 00000000..f9194b2a --- /dev/null +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -0,0 +1,188 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFER_HPP +#define SFML_SOUNDBUFFER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// SoundBuffer is the low-level for loading and manipulating +/// sound buffers +//////////////////////////////////////////////////////////// +class SFML_API SoundBuffer : public AudioResource, public Resource +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SoundBuffer(); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + /// \param Copy : Instance to copy + /// + //////////////////////////////////////////////////////////// + SoundBuffer(const SoundBuffer& Copy); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~SoundBuffer(); + + //////////////////////////////////////////////////////////// + /// Load the sound buffer from a file + /// + /// \param Filename : Path of the sound file to load + /// + /// \return True if loading has been successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromFile(const std::string& Filename); + + //////////////////////////////////////////////////////////// + /// Load the sound buffer from a file in memory + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// + /// \return True if loading has been successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromMemory(const char* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// Load the sound buffer from an array of samples - assumed format for + /// samples is 16 bits signed integer + /// + /// \param Samples : Pointer to the samples in memory + /// \param SamplesCount : Number of samples pointed by Samples + /// \param ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...) + /// \param SampleRate : Frequency (number of samples to play per second) + /// + /// \return True if loading has been successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromSamples(const Int16* Samples, std::size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate); + + //////////////////////////////////////////////////////////// + /// Save the sound buffer to a file + /// + /// \param Filename : Path of the sound file to write + /// + /// \return True if saving has been successful + /// + //////////////////////////////////////////////////////////// + bool SaveToFile(const std::string& Filename) const; + + //////////////////////////////////////////////////////////// + /// Return the sound samples + /// + /// \return Pointer to the array of sound samples, in 16 bits signed integer format + /// + //////////////////////////////////////////////////////////// + const Int16* GetSamples() const; + + //////////////////////////////////////////////////////////// + /// Return the samples count + /// + /// \return Number of samples + /// + //////////////////////////////////////////////////////////// + std::size_t GetSamplesCount() const; + + //////////////////////////////////////////////////////////// + /// Get the sample rate + /// + /// \return Sound frequency (number of samples per second) + /// + //////////////////////////////////////////////////////////// + unsigned int GetSampleRate() const; + + //////////////////////////////////////////////////////////// + /// Return the number of channels (1 = mono, 2 = stereo, ...) + /// + /// \return Number of channels + /// + //////////////////////////////////////////////////////////// + unsigned int GetChannelsCount() const; + + //////////////////////////////////////////////////////////// + /// Get the sound duration + /// + /// \return Sound duration, in seconds + /// + //////////////////////////////////////////////////////////// + float GetDuration() const; + + //////////////////////////////////////////////////////////// + /// Assignment operator + /// + /// \param Other : Instance to assign + /// + /// \return Reference to the sound buffer + /// + //////////////////////////////////////////////////////////// + SoundBuffer& operator =(const SoundBuffer& Other); + +private : + + friend class Sound; + + //////////////////////////////////////////////////////////// + /// Update the internal buffer with the audio samples + /// + /// \param ChannelsCount : Number of channels + /// \param SampleRate : Sample rate + /// + /// \return True on success + /// + //////////////////////////////////////////////////////////// + bool Update(unsigned int ChannelsCount, unsigned int SampleRate); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int myBuffer; ///< OpenAL buffer identifier + std::vector mySamples; ///< Samples buffer + float myDuration; ///< Sound duration, in seconds +}; + +} // namespace sf + + +#endif // SFML_SOUNDBUFFER_HPP diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp new file mode 100644 index 00000000..1629f3b3 --- /dev/null +++ b/include/SFML/Audio/SoundBufferRecorder.hpp @@ -0,0 +1,83 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFERRECORDER_HPP +#define SFML_SOUNDBUFFERRECORDER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Specialized SoundRecorder which saves the captured +/// audio data into a sound buffer +//////////////////////////////////////////////////////////// +class SFML_API SoundBufferRecorder : public SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// Get the sound buffer containing the captured audio data + /// + /// \return Constant reference to the sound buffer + /// + //////////////////////////////////////////////////////////// + const SoundBuffer& GetBuffer() const; + +private : + + //////////////////////////////////////////////////////////// + /// /see SoundBuffer::OnStart + /// + //////////////////////////////////////////////////////////// + virtual bool OnStart(); + + //////////////////////////////////////////////////////////// + /// /see SoundBuffer::OnProcessSamples + /// + //////////////////////////////////////////////////////////// + virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount); + + //////////////////////////////////////////////////////////// + /// /see SoundBuffer::OnStop + /// + //////////////////////////////////////////////////////////// + virtual void OnStop(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector mySamples; ///< Temporary sample buffer to hold the recorded data + SoundBuffer myBuffer; ///< Sound buffer that will contain the recorded data +}; + +} // namespace sf + +#endif // SFML_SOUNDBUFFERRECORDER_HPP diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp new file mode 100644 index 00000000..f62d9c3f --- /dev/null +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDRECORDER_HPP +#define SFML_SOUNDRECORDER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// SoundRecorder is an interface for capturing sound data, +/// it is meant to be used as a base class +//////////////////////////////////////////////////////////// +class SFML_API SoundRecorder : private Thread +{ +public : + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundRecorder(); + + //////////////////////////////////////////////////////////// + /// Start the capture. + /// Warning : only one capture can happen at the same time + /// + /// \param SampleRate : Sound frequency (the more samples, the higher the quality) + /// (44100 by default = CD quality) + /// + //////////////////////////////////////////////////////////// + void Start(unsigned int SampleRate = 44100); + + //////////////////////////////////////////////////////////// + /// Stop the capture + /// + //////////////////////////////////////////////////////////// + void Stop(); + + //////////////////////////////////////////////////////////// + /// Get the sample rate + /// + /// \return Frequency, in samples per second + /// + //////////////////////////////////////////////////////////// + unsigned int GetSampleRate() const; + + //////////////////////////////////////////////////////////// + /// Tell if the system supports sound capture. + /// If not, this class won't be usable + /// + /// \return True if audio capture is supported + /// + //////////////////////////////////////////////////////////// + static bool CanCapture(); + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SoundRecorder(); + +private : + + //////////////////////////////////////////////////////////// + /// Start recording audio data + /// + /// \return False to abort recording audio data, true to start + /// + //////////////////////////////////////////////////////////// + virtual bool OnStart(); + + //////////////////////////////////////////////////////////// + /// Process a new chunk of recorded samples + /// + /// \param Samples : Pointer to the new chunk of recorded samples + /// \param SamplesCount : Number of samples pointed by Samples + /// + /// \return False to stop recording audio data, true to continue + /// + //////////////////////////////////////////////////////////// + virtual bool OnProcessSamples(const Int16* Samples, std::size_t SamplesCount) = 0; + + //////////////////////////////////////////////////////////// + /// Stop recording audio data + /// + //////////////////////////////////////////////////////////// + virtual void OnStop(); + + //////////////////////////////////////////////////////////// + /// /see Thread::Run + /// + //////////////////////////////////////////////////////////// + virtual void Run(); + + //////////////////////////////////////////////////////////// + /// Get the available captured samples and process them + /// + //////////////////////////////////////////////////////////// + void ProcessCapturedSamples(); + + //////////////////////////////////////////////////////////// + /// Clean up the recorder internal resources + /// + //////////////////////////////////////////////////////////// + void CleanUp(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector mySamples; ///< Buffer to store captured samples + unsigned int mySampleRate; ///< Sample rate + bool myIsCapturing; ///< Capturing state +}; + +} // namespace sf + + +#endif // SFML_SOUNDRECORDER_HPP diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp new file mode 100644 index 00000000..8cc2024b --- /dev/null +++ b/include/SFML/Audio/SoundStream.hpp @@ -0,0 +1,225 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSTREAM_HPP +#define SFML_SOUNDSTREAM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// SoundStream is a streamed sound, ie samples are acquired +/// while the sound is playing. Use it for big sounds that would +/// require hundreds of MB in memory (see Music), +/// or for streaming sound from the network +//////////////////////////////////////////////////////////// +class SFML_API SoundStream : private Thread, private Sound +{ +public : + + using Sound::Status; + using Sound::Stopped; + using Sound::Paused; + using Sound::Playing; + using Sound::Pause; + using Sound::SetPitch; + using Sound::SetVolume; + using Sound::SetPosition; + using Sound::SetMinDistance; + using Sound::SetAttenuation; + using Sound::GetPitch; + using Sound::GetVolume; + using Sound::GetPosition; + using Sound::GetMinDistance; + using Sound::GetAttenuation; + + //////////////////////////////////////////////////////////// + /// Structure defining a chunk of audio data to stream + //////////////////////////////////////////////////////////// + struct Chunk + { + const Int16* Samples; ///< Pointer to the audio samples + std::size_t NbSamples; ///< Number of samples pointed by Samples + }; + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundStream(); + + //////////////////////////////////////////////////////////// + /// Start playing the audio stream + /// + //////////////////////////////////////////////////////////// + void Play(); + + //////////////////////////////////////////////////////////// + /// Stop playing the audio stream + /// + //////////////////////////////////////////////////////////// + void Stop(); + + //////////////////////////////////////////////////////////// + /// Return the number of channels (1 = mono, 2 = stereo) + /// + /// \return Number of channels + /// + //////////////////////////////////////////////////////////// + unsigned int GetChannelsCount() const; + + //////////////////////////////////////////////////////////// + /// Get the stream sample rate + /// + /// \return Stream frequency (number of samples per second) + /// + //////////////////////////////////////////////////////////// + unsigned int GetSampleRate() const; + + //////////////////////////////////////////////////////////// + /// Get the status of the stream (stopped, paused, playing) + /// + /// \return Current status of the sound + /// + //////////////////////////////////////////////////////////// + Status GetStatus() const; + + //////////////////////////////////////////////////////////// + /// Get the current playing position of the stream + /// + /// \return Current playing position, expressed in seconds + /// + //////////////////////////////////////////////////////////// + float GetPlayingOffset() const; + + //////////////////////////////////////////////////////////// + /// Set the stream loop state. + /// This parameter is disabled by default + /// + /// \param Loop : True to play in loop, false to play once + /// + //////////////////////////////////////////////////////////// + void SetLoop(bool Loop); + + //////////////////////////////////////////////////////////// + /// Tell whether or not the stream is looping + /// + /// \return True if the music is looping, false otherwise + /// + //////////////////////////////////////////////////////////// + bool GetLoop() const; + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SoundStream(); + + //////////////////////////////////////////////////////////// + /// Set the audio stream parameters, you must call it before Play() + /// + /// \param ChannelsCount : Number of channels + /// \param SampleRate : Sample rate + /// + //////////////////////////////////////////////////////////// + void Initialize(unsigned int ChannelsCount, unsigned int SampleRate); + +private : + + //////////////////////////////////////////////////////////// + /// /see Thread::Run + /// + //////////////////////////////////////////////////////////// + virtual void Run(); + + //////////////////////////////////////////////////////////// + /// Called when the sound restarts + /// + /// \return If false is returned, the playback is aborted + /// + //////////////////////////////////////////////////////////// + virtual bool OnStart(); + + //////////////////////////////////////////////////////////// + /// Called each time new audio data is needed to feed the stream + /// + /// \param Data : New chunk of data to stream + /// + /// \return True to continue playback, false to stop + /// + //////////////////////////////////////////////////////////// + virtual bool OnGetData(Chunk& Data) = 0; + + //////////////////////////////////////////////////////////// + /// Fill a new buffer with audio data, and push it to the + /// playing queue + /// + /// \param Buffer : Buffer to fill + /// + /// \return True if the derived class has requested to stop + /// + //////////////////////////////////////////////////////////// + bool FillAndPushBuffer(unsigned int Buffer); + + //////////////////////////////////////////////////////////// + /// Fill the buffers queue with all available buffers + /// + /// \return True if the derived class has requested to stop + /// + //////////////////////////////////////////////////////////// + bool FillQueue(); + + //////////////////////////////////////////////////////////// + /// Clear the queue of any remaining buffers + /// + //////////////////////////////////////////////////////////// + void ClearQueue(); + + enum {BuffersCount = 3}; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + bool myIsStreaming; ///< Streaming state (true = playing, false = stopped) + unsigned int myBuffers[BuffersCount]; ///< Sound buffers used to store temporary audio data + unsigned int myChannelsCount; ///< Number of channels (1 = mono, 2 = stereo, ...) + unsigned int mySampleRate; ///< Frequency (samples / second) + unsigned long myFormat; ///< Format of the internal sound buffers + bool myLoop; ///< Loop flag (true to loop, false to play once) + unsigned int mySamplesProcessed; ///< Number of buffers processed since beginning of the stream +}; + +} // namespace sf + + +#endif // SFML_SOUNDSTREAM_HPP diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp new file mode 100644 index 00000000..0a6af64c --- /dev/null +++ b/include/SFML/Config.hpp @@ -0,0 +1,165 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONFIG_HPP +#define SFML_CONFIG_HPP + +//////////////////////////////////////////////////////////// +// Identify the operating system +//////////////////////////////////////////////////////////// +#if defined(_WIN32) || defined(__WIN32__) + + // Windows + #define SFML_SYSTEM_WINDOWS + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #ifndef NOMINMAX + #define NOMINMAX + #endif + +#elif defined(linux) || defined(__linux) + + // Linux + #define SFML_SYSTEM_LINUX + +#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) + + // MacOS + #define SFML_SYSTEM_MACOS + +#elif defined(__FreeBSD__) + + // FreeBSD + #define SFML_SYSTEM_FREEBSD + +#else + + // Unsupported system + #error This operating system is not supported by SFML library + +#endif + + +//////////////////////////////////////////////////////////// +// Define a portable debug macro +//////////////////////////////////////////////////////////// +#if !defined(NDEBUG) + + #define SFML_DEBUG + +#endif + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + #ifdef SFML_DYNAMIC + + // Windows platforms + #ifdef SFML_EXPORTS + + // From DLL side, we must export + #define SFML_API __declspec(dllexport) + + #else + + // From client application side, we must import + #define SFML_API __declspec(dllimport) + + #endif + + // For Visual C++ compilers, we also need to turn off this annoying C4251 warning. + // You can read lots ot different things about it, but the point is the code will + // just work fine, and so the simplest way to get rid of this warning is to disable it + #ifdef _MSC_VER + + #pragma warning(disable : 4251) + + #endif + + #else + + // No specific directive needed for static build + #define SFML_API + + #endif + +#else + + // Other platforms don't need to define anything + #define SFML_API + +#endif + + +//////////////////////////////////////////////////////////// +// Define portable fixed-size types +//////////////////////////////////////////////////////////// +#include + +namespace sf +{ + // 8 bits integer types + #if UCHAR_MAX == 0xFF + typedef signed char Int8; + typedef unsigned char Uint8; + #else + #error No 8 bits integer type for this platform + #endif + + // 16 bits integer types + #if USHRT_MAX == 0xFFFF + typedef signed short Int16; + typedef unsigned short Uint16; + #elif UINT_MAX == 0xFFFF + typedef signed int Int16; + typedef unsigned int Uint16; + #elif ULONG_MAX == 0xFFFF + typedef signed long Int16; + typedef unsigned long Uint16; + #else + #error No 16 bits integer type for this platform + #endif + + // 32 bits integer types + #if USHRT_MAX == 0xFFFFFFFF + typedef signed short Int32; + typedef unsigned short Uint32; + #elif UINT_MAX == 0xFFFFFFFF + typedef signed int Int32; + typedef unsigned int Uint32; + #elif ULONG_MAX == 0xFFFFFFFF + typedef signed long Int32; + typedef unsigned long Uint32; + #else + #error No 32 bits integer type for this platform + #endif + +} // namespace sf + + +#endif // SFML_CONFIG_HPP diff --git a/include/SFML/Graphics.hpp b/include/SFML/Graphics.hpp new file mode 100644 index 00000000..c6282c5a --- /dev/null +++ b/include/SFML/Graphics.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_HPP +#define SFML_GRAPHICS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_GRAPHICS_HPP diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp new file mode 100644 index 00000000..1898e4d5 --- /dev/null +++ b/include/SFML/Graphics/Color.hpp @@ -0,0 +1,147 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_COLOR_HPP +#define SFML_COLOR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Color is an utility class for manipulating +/// 32-bits RGBA colors +//////////////////////////////////////////////////////////// +class SFML_API Color +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Color(); + + //////////////////////////////////////////////////////////// + /// Construct the color from its 4 RGBA components + /// + /// \param R : Red component (0 .. 255) + /// \param G : Green component (0 .. 255) + /// \param B : Blue component (0 .. 255) + /// \param A : Alpha component (0 .. 255) (255 by default) + /// + //////////////////////////////////////////////////////////// + Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A = 255); + + //////////////////////////////////////////////////////////// + /// Operator += overload to add a color + /// + /// \param Other : Color to add + /// + /// \return Component-wise saturated addition of the two colors + /// + //////////////////////////////////////////////////////////// + Color& operator +=(const Color& Other); + + //////////////////////////////////////////////////////////// + /// Operator *= overload to modulate a color + /// + /// \param Other : Color to modulate + /// + /// \return Component-wise multiplication of the two colors + /// + //////////////////////////////////////////////////////////// + Color& operator *=(const Color& Other); + + //////////////////////////////////////////////////////////// + /// Compare two colors (for equality) + /// + /// \param Other : Color to compare + /// + /// \return True if colors are equal + /// + //////////////////////////////////////////////////////////// + bool operator ==(const Color& Other) const; + + //////////////////////////////////////////////////////////// + /// Compare two colors (for difference) + /// + /// \param Other : Color to compare + /// + /// \return True if colors are different + /// + //////////////////////////////////////////////////////////// + bool operator !=(const Color& Other) const; + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const Color Black; ///< Black predefined color + static const Color White; ///< White predefined color + static const Color Red; ///< Red predefined color + static const Color Green; ///< Green predefined color + static const Color Blue; ///< Blue predefined color + static const Color Yellow; ///< Yellow predefined color + static const Color Magenta; ///< Magenta predefined color + static const Color Cyan; ///< Cyan predefined color + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Uint8 r; ///< Red component + Uint8 g; ///< Green component + Uint8 b; ///< Blue component + Uint8 a; ///< Alpha (transparency) component +}; + +//////////////////////////////////////////////////////////// +/// Operator + overload to add two colors +/// +/// \param Color1 : First color +/// \param Color2 : Second color +/// +/// \return Component-wise saturated addition of the two colors +/// +//////////////////////////////////////////////////////////// +SFML_API Color operator +(const Color& Color1, const Color& Color2); + +//////////////////////////////////////////////////////////// +/// Operator * overload to modulate two colors +/// +/// \param Color1 : First color +/// \param Color2 : Second color +/// +/// \return Component-wise multiplication of the two colors +/// +//////////////////////////////////////////////////////////// +SFML_API Color operator *(const Color& Color1, const Color& Color2); + +} // namespace sf + + +#endif // SFML_COLOR_HPP diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp new file mode 100644 index 00000000..35860477 --- /dev/null +++ b/include/SFML/Graphics/Drawable.hpp @@ -0,0 +1,361 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_DRAWABLE_HPP +#define SFML_DRAWABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class RenderTarget; + +//////////////////////////////////////////////////////////// +/// Enumerate the blending modes for drawable objects +//////////////////////////////////////////////////////////// +namespace Blend +{ + enum Mode + { + Alpha, ///< Pixel = Src * a + Dest * (1 - a) + Add, ///< Pixel = Src + Dest + Multiply, ///< Pixel = Src * Dest + None ///< No blending + }; +} + +//////////////////////////////////////////////////////////// +/// Abstract base class for every object that can be drawn +/// into a render window +//////////////////////////////////////////////////////////// +class SFML_API Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + /// \param Position : Position of the object (0, 0 by default) + /// \param Scale : Scale factor (1, 1 by default) + /// \param Rotation : Orientation, in degrees (0 by default) + /// \param Col : Color of the object (white by default) + /// + //////////////////////////////////////////////////////////// + Drawable(const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255)); + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Drawable(); + + //////////////////////////////////////////////////////////// + /// Set the position of the object (take 2 values) + /// + /// \param X : New X coordinate + /// \param Y : New Y coordinate + /// + //////////////////////////////////////////////////////////// + void SetPosition(float X, float Y); + + //////////////////////////////////////////////////////////// + /// Set the position of the object (take a 2D vector) + /// + /// \param Position : New position + /// + //////////////////////////////////////////////////////////// + void SetPosition(const Vector2f& Position); + + //////////////////////////////////////////////////////////// + /// Set the X position of the object + /// + /// \param X : New X coordinate + /// + //////////////////////////////////////////////////////////// + void SetX(float X); + + //////////////////////////////////////////////////////////// + /// Set the Y position of the object + /// + /// \param Y : New Y coordinate + /// + //////////////////////////////////////////////////////////// + void SetY(float Y); + + //////////////////////////////////////////////////////////// + /// Set the scale of the object (take 2 values) + /// + /// \param ScaleX : New horizontal scale (must be strictly positive) + /// \param ScaleY : New vertical scale (must be strictly positive) + /// + //////////////////////////////////////////////////////////// + void SetScale(float ScaleX, float ScaleY); + + //////////////////////////////////////////////////////////// + /// Set the scale of the object (take a 2D vector) + /// + /// \param Scale : New scale (both values must be strictly positive) + /// + //////////////////////////////////////////////////////////// + void SetScale(const Vector2f& Scale); + + //////////////////////////////////////////////////////////// + /// Set the X scale factor of the object + /// + /// \param X : New X scale factor + /// + //////////////////////////////////////////////////////////// + void SetScaleX(float FactorX); + + //////////////////////////////////////////////////////////// + /// Set the Y scale factor of the object + /// + /// \param Y : New Y scale factor + /// + //////////////////////////////////////////////////////////// + void SetScaleY(float FactorY); + + //////////////////////////////////////////////////////////// + /// Set the center of the object, in coordinates relative to the + /// top-left of the object (take 2 values). + /// The default center is (0, 0) + /// + /// \param CenterX : X coordinate of the center + /// \param CenterY : Y coordinate of the center + /// + //////////////////////////////////////////////////////////// + void SetCenter(float CenterX, float CenterY); + + //////////////////////////////////////////////////////////// + /// Set the center of the object, in coordinates relative to the + /// top-left of the object (take a 2D vector). + /// The default center is (0, 0) + /// + /// \param Center : New center + /// + //////////////////////////////////////////////////////////// + void SetCenter(const Vector2f& Center); + + //////////////////////////////////////////////////////////// + /// Set the orientation of the object + /// + /// \param Rotation : Angle of rotation, in degrees + /// + //////////////////////////////////////////////////////////// + void SetRotation(float Rotation); + + //////////////////////////////////////////////////////////// + /// Set the color of the object. + /// The default color is white + /// + /// \param Col : New color + /// + //////////////////////////////////////////////////////////// + void SetColor(const Color& Col); + + //////////////////////////////////////////////////////////// + /// Set the blending mode for the object. + /// The default blend mode is Blend::Alpha + /// + /// \param Mode : New blending mode + /// + //////////////////////////////////////////////////////////// + void SetBlendMode(Blend::Mode Mode); + + //////////////////////////////////////////////////////////// + /// Get the position of the object + /// + /// \return Current position + /// + //////////////////////////////////////////////////////////// + const Vector2f& GetPosition() const; + + //////////////////////////////////////////////////////////// + /// Get the current scale of the object + /// + /// \return Current scale factor (always positive) + /// + //////////////////////////////////////////////////////////// + const Vector2f& GetScale() const; + + //////////////////////////////////////////////////////////// + /// Get the center of the object + /// + /// \return Current position of the center + /// + //////////////////////////////////////////////////////////// + const Vector2f& GetCenter() const; + + //////////////////////////////////////////////////////////// + /// Get the orientation of the object. + /// Rotation is always in the range [0, 360] + /// + /// \return Current rotation, in degrees + /// + //////////////////////////////////////////////////////////// + float GetRotation() const; + + //////////////////////////////////////////////////////////// + /// Get the color of the object + /// + /// \return Current color + /// + //////////////////////////////////////////////////////////// + const Color& GetColor() const; + + //////////////////////////////////////////////////////////// + /// Get the current blending mode + /// + /// \return Current blending mode + /// + //////////////////////////////////////////////////////////// + Blend::Mode GetBlendMode() const; + + //////////////////////////////////////////////////////////// + /// Move the object of a given offset (take 2 values) + /// + /// \param OffsetX : X offset + /// \param OffsetY : Y offset + /// + //////////////////////////////////////////////////////////// + void Move(float OffsetX, float OffsetY); + + //////////////////////////////////////////////////////////// + /// Move the object of a given offset (take a 2D vector) + /// + /// \param Offset : Amount of units to move the object of + /// + //////////////////////////////////////////////////////////// + void Move(const Vector2f& Offset); + + //////////////////////////////////////////////////////////// + /// Scale the object (take 2 values) + /// + /// \param FactorX : Scaling factor on X (must be strictly positive) + /// \param FactorY : Scaling factor on Y (must be strictly positive) + /// + //////////////////////////////////////////////////////////// + void Scale(float FactorX, float FactorY); + + //////////////////////////////////////////////////////////// + /// Scale the object (take a 2D vector) + /// + /// \param Factor : Scaling factors (both values must be strictly positive) + /// + //////////////////////////////////////////////////////////// + void Scale(const Vector2f& Factor); + + //////////////////////////////////////////////////////////// + /// Rotate the object + /// + /// \param Angle : Angle of rotation, in degrees + /// + //////////////////////////////////////////////////////////// + void Rotate(float Angle); + + //////////////////////////////////////////////////////////// + /// Transform a point from global coordinates into local coordinates + /// (ie it applies the inverse of object's center, translation, rotation and scale to the point) + /// + /// \param Point : Point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + sf::Vector2f TransformToLocal(const sf::Vector2f& Point) const; + + //////////////////////////////////////////////////////////// + /// Transform a point from local coordinates into global coordinates + /// (ie it applies the object's center, translation, rotation and scale to the point) + /// + /// \param Point : Point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + sf::Vector2f TransformToGlobal(const sf::Vector2f& Point) const; + +protected : + + //////////////////////////////////////////////////////////// + /// Get the transform matrix of the drawable + /// + /// \return Transform matrix + /// + //////////////////////////////////////////////////////////// + const Matrix3& GetMatrix() const; + + //////////////////////////////////////////////////////////// + /// Get the inverse transform matrix of the drawable + /// + /// \return Inverse transform matrix + /// + //////////////////////////////////////////////////////////// + const Matrix3& GetInverseMatrix() const; + +private : + + friend class RenderTarget; + + //////////////////////////////////////////////////////////// + /// Draw the object into the specified window + /// + /// \param Target : Target into which render the object + /// + //////////////////////////////////////////////////////////// + void Draw(RenderTarget& Target) const; + + //////////////////////////////////////////////////////////// + /// Render the specific geometry of the object + /// + /// \param Target : Target into which render the object + /// + //////////////////////////////////////////////////////////// + virtual void Render(RenderTarget& Target) const = 0; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f myPosition; ///< Position of the object on screen + Vector2f myScale; ///< Scale of the object + Vector2f myCenter; ///< Origin of translation / rotation / scaling of the object + float myRotation; ///< Orientation of the object, in degrees + Color myColor; ///< Overlay color of the object + Blend::Mode myBlendMode; ///< Blending mode + mutable bool myNeedUpdate; ///< Do we need to recompute the transform matrix ? + mutable bool myInvNeedUpdate; ///< Do we need to recompute the inverse transform matrix ? + mutable Matrix3 myMatrix; ///< Precomputed transform matrix gathering the translation / rotation / scale / center + mutable Matrix3 myInvMatrix; ///< Precomputed inverse transform matrix gathering the translation / rotation / scale / center +}; + +} // namespace sf + + +#endif // SFML_DRAWABLE_HPP diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp new file mode 100644 index 00000000..293954e6 --- /dev/null +++ b/include/SFML/Graphics/Font.hpp @@ -0,0 +1,145 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FONT_HPP +#define SFML_FONT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class String; + +namespace priv +{ +class FontLoader; +} +//////////////////////////////////////////////////////////// +/// Font is the low-level class for loading and +/// manipulating character fonts. This class is meant to +/// be used by sf::String +//////////////////////////////////////////////////////////// +class SFML_API Font : public Resource +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Font(); + + //////////////////////////////////////////////////////////// + /// Load the font from a file + /// + /// \param Filename : Font file to load + /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default) + /// \param Charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters) + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromFile(const std::string& Filename, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset); + + //////////////////////////////////////////////////////////// + /// Load the font from a file in memory + /// + /// \param Data : Pointer to the data to load + /// \param SizeInBytes : Size of the data, in bytes + /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default) + /// \param Charset : Characters set to generate (by default, contains the ISO-8859-1 printable characters) + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize = 30, const Unicode::Text& Charset = ourDefaultCharset); + + //////////////////////////////////////////////////////////// + /// Get the base size of characters in the font; + /// All glyphs dimensions are based on this value + /// + /// \return Base size of characters + /// + //////////////////////////////////////////////////////////// + unsigned int GetCharacterSize() const; + + //////////////////////////////////////////////////////////// + /// Get the description of a glyph (character) + /// given by its unicode value + /// + /// \param CodePoint : Unicode value of the character to get + /// + /// \return Glyph's visual settings, or an invalid glyph if character not found + /// + //////////////////////////////////////////////////////////// + const Glyph& GetGlyph(Uint32 CodePoint) const; + + //////////////////////////////////////////////////////////// + /// Get the image containing the rendered characters (glyphs) + /// + /// \return Image containing glyphs + /// + //////////////////////////////////////////////////////////// + const Image& GetImage() const; + + //////////////////////////////////////////////////////////// + /// Get the SFML default built-in font (Arial) + /// + /// \return Instance of the default font + /// + //////////////////////////////////////////////////////////// + static const Font& GetDefaultFont(); + +private : + + friend class priv::FontLoader; + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static Uint32 ourDefaultCharset[]; ///< The default charset (all printable ISO-8859-1 characters) + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Image myTexture; ///< Texture holding the bitmap font + unsigned int myCharSize; ///< Size of characters in the bitmap font + std::map myGlyphs; ///< Rendering settings of each character (glyph) +}; + +} // namespace sf + + +#endif // SFML_FONT_HPP diff --git a/include/SFML/Graphics/Glyph.hpp b/include/SFML/Graphics/Glyph.hpp new file mode 100644 index 00000000..602cfef4 --- /dev/null +++ b/include/SFML/Graphics/Glyph.hpp @@ -0,0 +1,61 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GLYPH_HPP +#define SFML_GLYPH_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Structure describing a glyph (a visual character) +//////////////////////////////////////////////////////////// +class SFML_API Glyph +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Glyph() : Advance(0) {} + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + int Advance; ///< Offset to move horizontically to the next character + IntRect Rectangle; ///< Bounding rectangle of the glyph, in relative coordinates + FloatRect TexCoords; ///< Texture coordinates of the glyph inside the bitmap font +}; + +} // namespace sf + + +#endif // SFML_GLYPH_HPP diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp new file mode 100644 index 00000000..e950ec33 --- /dev/null +++ b/include/SFML/Graphics/Image.hpp @@ -0,0 +1,335 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IMAGE_HPP +#define SFML_IMAGE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class RenderImage; +class RenderWindow; + +//////////////////////////////////////////////////////////// +/// Image is the low-level class for loading and +/// manipulating images +//////////////////////////////////////////////////////////// +class SFML_API Image : public Resource +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Image(); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + /// \param Copy : instance to copy + /// + //////////////////////////////////////////////////////////// + Image(const Image& Copy); + + //////////////////////////////////////////////////////////// + /// Construct an empty image + /// + /// \param Width : Image width + /// \param Height : Image height + /// \param Col : Image color (black by default) + /// + //////////////////////////////////////////////////////////// + Image(unsigned int Width, unsigned int Height, const Color& Col = Color(0, 0, 0, 255)); + + //////////////////////////////////////////////////////////// + /// Construct the image from pixels in memory + /// + /// \param Width : Image width + /// \param Height : Image height + /// \param Data : Pointer to the pixels in memory (assumed format is RGBA) + /// + //////////////////////////////////////////////////////////// + Image(unsigned int Width, unsigned int Height, const Uint8* Data); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~Image(); + + //////////////////////////////////////////////////////////// + /// Load the image from a file + /// + /// \param Filename : Path of the image file to load + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromFile(const std::string& Filename); + + //////////////////////////////////////////////////////////// + /// Load the image from a file in memory + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromMemory(const char* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// Load the image directly from an array of pixels + /// + /// \param Width : Image width + /// \param Height : Image height + /// \param Data : Pointer to the pixels in memory (assumed format is RGBA) + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* Data); + + //////////////////////////////////////////////////////////// + /// Save the content of the image to a file + /// + /// \param Filename : Path of the file to save (overwritten if already exist) + /// + /// \return True if saving was successful + /// + //////////////////////////////////////////////////////////// + bool SaveToFile(const std::string& Filename) const; + + //////////////////////////////////////////////////////////// + /// Create an empty image + /// + /// \param Width : Image width + /// \param Height : Image height + /// \param Col : Image color (black by default) + /// + /// \return True if creation was successful + /// + //////////////////////////////////////////////////////////// + bool Create(unsigned int Width, unsigned int Height, Color Col = Color(0, 0, 0, 255)); + + //////////////////////////////////////////////////////////// + /// Create transparency mask from a specified colorkey + /// + /// \param ColorKey : Color to become transparent + /// \param Alpha : Alpha value to use for transparent pixels (0 by default) + /// + //////////////////////////////////////////////////////////// + void CreateMaskFromColor(Color ColorKey, Uint8 Alpha = 0); + + //////////////////////////////////////////////////////////// + /// Copy pixels from another image onto this one. + /// This function does a slow pixel copy and should only + /// be used at initialization time + /// + /// \param Source : Source image to copy + /// \param DestX : X coordinate of the destination position + /// \param DestY : Y coordinate of the destination position + /// \param SourceRect : Sub-rectangle of the source image to copy (empty by default - entire image) + /// + //////////////////////////////////////////////////////////// + void Copy(const Image& Source, unsigned int DestX, unsigned int DestY, const IntRect& SourceRect = IntRect(0, 0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Create the image from the current contents of the + /// given window + /// + /// \param Window : Window to capture + /// \param SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image) + /// + /// \return True if copy was successful + /// + //////////////////////////////////////////////////////////// + bool CopyScreen(RenderWindow& Window, const IntRect& SourceRect = IntRect(0, 0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Change the color of a pixel + /// + /// \param X : X coordinate of pixel in the image + /// \param Y : Y coordinate of pixel in the image + /// \param Col : New color for pixel (X, Y) + /// + //////////////////////////////////////////////////////////// + void SetPixel(unsigned int X, unsigned int Y, const Color& Col); + + //////////////////////////////////////////////////////////// + /// Get a pixel from the image + /// + /// \param X : X coordinate of pixel in the image + /// \param Y : Y coordinate of pixel in the image + /// + /// \return Color of pixel (X, Y) + /// + //////////////////////////////////////////////////////////// + const Color& GetPixel(unsigned int X, unsigned int Y) const; + + //////////////////////////////////////////////////////////// + /// Get a read-only pointer to the array of pixels (RGBA 8 bits integers components) + /// Array size is GetWidth() x GetHeight() x 4 + /// This pointer becomes invalid if you reload or resize the image + /// + /// \return Const pointer to the array of pixels + /// + //////////////////////////////////////////////////////////// + const Uint8* GetPixelsPtr() const; + + //////////////////////////////////////////////////////////// + /// Bind the image for rendering + /// + //////////////////////////////////////////////////////////// + void Bind() const; + + //////////////////////////////////////////////////////////// + /// Enable or disable image smooth filter. + /// This parameter is enabled by default + /// + /// \param Smooth : True to enable smoothing filter, false to disable it + /// + //////////////////////////////////////////////////////////// + void SetSmooth(bool Smooth); + + //////////////////////////////////////////////////////////// + /// Return the width of the image + /// + /// \return Width in pixels + /// + //////////////////////////////////////////////////////////// + unsigned int GetWidth() const; + + //////////////////////////////////////////////////////////// + /// Return the height of the image + /// + /// \return Height in pixels + /// + //////////////////////////////////////////////////////////// + unsigned int GetHeight() const; + + //////////////////////////////////////////////////////////// + /// Tells whether the smooth filtering is enabled or not + /// + /// \return True if image smoothing is enabled + /// + //////////////////////////////////////////////////////////// + bool IsSmooth() const; + + //////////////////////////////////////////////////////////// + /// Convert a subrect expressed in pixels, into float + /// texture coordinates + /// + /// \param Rect : Sub-rectangle of image to convert + /// \param Adjust : Pass true to apply the half-texel adjustment + /// + /// \return Texture coordinates corresponding to the sub-rectangle + /// + //////////////////////////////////////////////////////////// + FloatRect GetTexCoords(const IntRect& Rect, bool Adjust = true) const; + + //////////////////////////////////////////////////////////// + /// Get a valid texture size according to hardware support + /// + /// \param Size : Size to convert + /// + /// \return Valid nearest size (greater than or equal to specified size) + /// + //////////////////////////////////////////////////////////// + static unsigned int GetValidTextureSize(unsigned int Size); + + //////////////////////////////////////////////////////////// + /// Assignment operator + /// + /// \param Other : instance to assign + /// + /// \return Reference to the image + /// + //////////////////////////////////////////////////////////// + Image& operator =(const Image& Other); + +private : + + friend class RenderImage; + + //////////////////////////////////////////////////////////// + /// Create the OpenGL texture + /// + /// \return True if texture has been successfully created + /// + //////////////////////////////////////////////////////////// + bool CreateTexture(); + + //////////////////////////////////////////////////////////// + /// Make sure the texture in video memory is updated with the + /// array of pixels + //////////////////////////////////////////////////////////// + void EnsureTextureUpdate() const; + + //////////////////////////////////////////////////////////// + /// Make sure the array of pixels is updated with the + /// texture in video memory + //////////////////////////////////////////////////////////// + void EnsureArrayUpdate() const; + + //////////////////////////////////////////////////////////// + /// Reset the image attributes + /// + //////////////////////////////////////////////////////////// + void Reset(); + + //////////////////////////////////////////////////////////// + /// Destroy the OpenGL texture + /// + //////////////////////////////////////////////////////////// + void DestroyTexture(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int myWidth; ///< Image width + unsigned int myHeight; ///< Image Height + unsigned int myTextureWidth; ///< Actual texture width (can be greater than image width because of padding) + unsigned int myTextureHeight; ///< Actual texture height (can be greater than image height because of padding) + unsigned int myTexture; ///< Internal texture identifier + bool myIsSmooth; ///< Status of the smooth filter + mutable std::vector myPixels; ///< Pixels of the image + mutable bool myNeedTextureUpdate; ///< Status of synchronization between pixels in central memory and the internal texture un video memory + mutable bool myNeedArrayUpdate; ///< Status of synchronization between pixels in central memory and the internal texture un video memory +}; + +} // namespace sf + + +#endif // SFML_IMAGE_HPP diff --git a/include/SFML/Graphics/Matrix3.hpp b/include/SFML/Graphics/Matrix3.hpp new file mode 100644 index 00000000..2d1ea745 --- /dev/null +++ b/include/SFML/Graphics/Matrix3.hpp @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MATRIX3_HPP +#define SFML_MATRIX3_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Utility class to manipulate 3x3 matrices representing +/// 2D transformations +//////////////////////////////////////////////////////////// +class SFML_API Matrix3 +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor (builds an identity matrix) + /// + //////////////////////////////////////////////////////////// + Matrix3(); + + //////////////////////////////////////////////////////////// + /// Construct a matrix from its 9 elements + /// + //////////////////////////////////////////////////////////// + Matrix3(float a00, float a01, float a02, + float a10, float a11, float a12, + float a20, float a21, float a22); + + //////////////////////////////////////////////////////////// + /// Build a matrix from a set of transformations + /// + /// \param Center : Origin for the transformations + /// \param Translation : Translation offset + /// \param Rotation : Rotation angle in degrees + /// \param Scale : Scaling factors + /// + //////////////////////////////////////////////////////////// + void SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale); + + //////////////////////////////////////////////////////////// + /// Transform a point by the matrix + /// + /// \param Point : Point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + Vector2f Transform(const Vector2f& Point) const; + + //////////////////////////////////////////////////////////// + /// Return the inverse of the matrix + /// + /// \return A new matrix which is the inverse of this + /// + //////////////////////////////////////////////////////////// + Matrix3 GetInverse() const; + + //////////////////////////////////////////////////////////// + /// Return the elements of the matrix as a 4x4, + /// in an array of 16 floats + /// + /// \return Pointer to the 4x4 matrix elements + /// + //////////////////////////////////////////////////////////// + const float* Get4x4Elements() const; + + //////////////////////////////////////////////////////////// + /// Operator () overloads to access the matrix elements + /// + /// \param Row : Element row (0 based) + /// \param Col : Element column (0 based) + /// + /// \return Matrix element (Row, Col) + /// + //////////////////////////////////////////////////////////// + float operator ()(unsigned int Row, unsigned int Col) const; + float& operator ()(unsigned int Row, unsigned int Col); + + //////////////////////////////////////////////////////////// + /// Operator * overload to multiply two matrices + /// + /// \param Mat : Matrix to multiply + /// + /// \return this * Mat + /// + //////////////////////////////////////////////////////////// + Matrix3 operator *(const Matrix3& Mat) const; + + //////////////////////////////////////////////////////////// + /// Operator *= overload to multiply-assign two matrices + /// + /// \param Mat : Matrix to multiply + /// + /// \return this * Mat + /// + //////////////////////////////////////////////////////////// + Matrix3& operator *=(const Matrix3& Mat); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const Matrix3 Identity; ///< Identity matrix + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + float myData[16]; /// Matrix elements (we directly store it as a 4x4 matrix for optimization purpose) +}; + +#include + +} // namespace sf + + +#endif // SFML_MATRIX3_HPP diff --git a/include/SFML/Graphics/Matrix3.inl b/include/SFML/Graphics/Matrix3.inl new file mode 100644 index 00000000..658157c2 --- /dev/null +++ b/include/SFML/Graphics/Matrix3.inl @@ -0,0 +1,186 @@ +//////////////////////////////////////////////////////////// +// +// SFGE - Simple and Fast Game Engine +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Default constructor (builds an identity matrix) +//////////////////////////////////////////////////////////// +inline Matrix3::Matrix3() +{ + myData[0] = 1.f; myData[4] = 0.f; myData[8] = 0.f; myData[12] = 0.f; + myData[1] = 0.f; myData[5] = 1.f; myData[9] = 0.f; myData[13] = 0.f; + myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; + myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f; +} + + +//////////////////////////////////////////////////////////// +/// Construct a matrix from its 9 elements +//////////////////////////////////////////////////////////// +inline Matrix3::Matrix3(float a00, float a01, float a02, + float a10, float a11, float a12, + float a20, float a21, float a22) +{ + myData[0] = a00; myData[4] = a01; myData[8] = 0.f; myData[12] = a02; + myData[1] = a10; myData[5] = a11; myData[9] = 0.f; myData[13] = a12; + myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; + myData[3] = a20; myData[7] = a21; myData[11] = 0.f; myData[15] = a22; +} + + +//////////////////////////////////////////////////////////// +/// Build a matrix from a set of transformations +//////////////////////////////////////////////////////////// +inline void Matrix3::SetFromTransformations(const Vector2f& Center, const Vector2f& Translation, float Rotation, const Vector2f& Scale) +{ + float Angle = Rotation * 3.141592654f / 180.f; + float Cos = static_cast(cos(Angle)); + float Sin = static_cast(sin(Angle)); + float SxCos = Scale.x * Cos; + float SyCos = Scale.y * Cos; + float SxSin = Scale.x * Sin; + float SySin = Scale.y * Sin; + float Tx = -Center.x * SxCos - Center.y * SySin + Translation.x; + float Ty = Center.x * SxSin - Center.y * SyCos + Translation.y; + + myData[0] = SxCos; myData[4] = SySin; myData[8] = 0.f; myData[12] = Tx; + myData[1] = -SxSin; myData[5] = SyCos; myData[9] = 0.f; myData[13] = Ty; + myData[2] = 0.f; myData[6] = 0.f; myData[10] = 1.f; myData[14] = 0.f; + myData[3] = 0.f; myData[7] = 0.f; myData[11] = 0.f; myData[15] = 1.f; +} + + +//////////////////////////////////////////////////////////// +/// Transform a point by the matrix +//////////////////////////////////////////////////////////// +inline Vector2f Matrix3::Transform(const Vector2f& Point) const +{ + return Vector2f(myData[0] * Point.x + myData[4] * Point.y + myData[12], + myData[1] * Point.x + myData[5] * Point.y + myData[13]); +} + + +//////////////////////////////////////////////////////////// +/// Return the inverse of the matrix +//////////////////////////////////////////////////////////// +inline Matrix3 Matrix3::GetInverse() const +{ + // Compute the determinant + float Det = myData[0] * (myData[15] * myData[5] - myData[7] * myData[13]) - + myData[1] * (myData[15] * myData[4] - myData[7] * myData[12]) + + myData[3] * (myData[13] * myData[4] - myData[5] * myData[12]); + + // Compute the inverse if determinant is not zero + if ((Det < -1E-7f) || (Det > 1E-7f)) + { + return Matrix3( (myData[15] * myData[5] - myData[7] * myData[13]) / Det, + -(myData[15] * myData[4] - myData[7] * myData[12]) / Det, + (myData[13] * myData[4] - myData[5] * myData[12]) / Det, + -(myData[15] * myData[1] - myData[3] * myData[13]) / Det, + (myData[15] * myData[0] - myData[3] * myData[12]) / Det, + -(myData[13] * myData[0] - myData[1] * myData[12]) / Det, + (myData[7] * myData[1] - myData[3] * myData[5]) / Det, + -(myData[7] * myData[0] - myData[3] * myData[4]) / Det, + (myData[5] * myData[0] - myData[1] * myData[4]) / Det); + } + else + { + return Identity; + } +} + + +//////////////////////////////////////////////////////////// +/// Return the elements of the matrix as a 4x4, +/// in an array of 16 floats +//////////////////////////////////////////////////////////// +inline const float* Matrix3::Get4x4Elements() const +{ + return myData; +} + + +//////////////////////////////////////////////////////////// +/// Operator () overloads to access the matrix elements +//////////////////////////////////////////////////////////// +inline float Matrix3::operator ()(unsigned int Row, unsigned int Col) const +{ + switch (Row + Col * 3) + { + case 0 : return myData[0]; + case 1 : return myData[1]; + case 2 : return myData[3]; + case 3 : return myData[4]; + case 4 : return myData[5]; + case 5 : return myData[7]; + case 6 : return myData[12]; + case 7 : return myData[13]; + case 8 : return myData[15]; + + default : return myData[0]; + } +} +inline float& Matrix3::operator ()(unsigned int Row, unsigned int Col) +{ + switch (Row + Col * 3) + { + case 0 : return myData[0]; + case 1 : return myData[1]; + case 2 : return myData[3]; + case 3 : return myData[4]; + case 4 : return myData[5]; + case 5 : return myData[7]; + case 6 : return myData[12]; + case 7 : return myData[13]; + case 8 : return myData[15]; + + default : return myData[0]; + } +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload to multiply two matrices +//////////////////////////////////////////////////////////// +inline Matrix3 Matrix3::operator *(const Matrix3& Mat) const +{ + return Matrix3(myData[0] * Mat.myData[0] + myData[4] * Mat.myData[1] + myData[12] * Mat.myData[3], + myData[0] * Mat.myData[4] + myData[4] * Mat.myData[5] + myData[12] * Mat.myData[7], + myData[0] * Mat.myData[12] + myData[4] * Mat.myData[13] + myData[12] * Mat.myData[15], + myData[1] * Mat.myData[0] + myData[5] * Mat.myData[1] + myData[13] * Mat.myData[3], + myData[1] * Mat.myData[4] + myData[5] * Mat.myData[5] + myData[13] * Mat.myData[7], + myData[1] * Mat.myData[12] + myData[5] * Mat.myData[13] + myData[13] * Mat.myData[15], + myData[3] * Mat.myData[0] + myData[7] * Mat.myData[1] + myData[15] * Mat.myData[3], + myData[3] * Mat.myData[4] + myData[7] * Mat.myData[5] + myData[15] * Mat.myData[7], + myData[3] * Mat.myData[12] + myData[7] * Mat.myData[13] + myData[15] * Mat.myData[15]); +} + + +//////////////////////////////////////////////////////////// +/// Operator *= overload to multiply-assign two matrices +//////////////////////////////////////////////////////////// +inline Matrix3& Matrix3::operator *=(const Matrix3& Mat) +{ + return *this = *this * Mat; +} diff --git a/include/SFML/Graphics/PostFX.hpp b/include/SFML/Graphics/PostFX.hpp new file mode 100644 index 00000000..7890a423 --- /dev/null +++ b/include/SFML/Graphics/PostFX.hpp @@ -0,0 +1,194 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_POSTFX_HPP +#define SFML_POSTFX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// PostFX is used to apply a post effect to a window +//////////////////////////////////////////////////////////// +class SFML_API PostFX : public Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + PostFX(); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + /// \param Copy : Instance to copy + /// + //////////////////////////////////////////////////////////// + PostFX(const PostFX& Copy); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~PostFX(); + + //////////////////////////////////////////////////////////// + /// Load the effect from a file + /// + /// \param Filename : Path of the effect file to load + /// + /// \return True on success + /// + //////////////////////////////////////////////////////////// + bool LoadFromFile(const std::string& Filename); + + //////////////////////////////////////////////////////////// + /// Load the effect from a text in memory + /// + /// \param Effect : String containing the effect code + /// + /// \return True on success + /// + //////////////////////////////////////////////////////////// + bool LoadFromMemory(const std::string& Effect); + + //////////////////////////////////////////////////////////// + /// Change a parameter of the effect (1 float) + /// + /// \param Name : Parameter name in the effect + /// \param X : Value to assign + /// + //////////////////////////////////////////////////////////// + void SetParameter(const std::string& Name, float X); + + //////////////////////////////////////////////////////////// + /// Change a parameter of the effect (2 floats) + /// + /// \param Name : Parameter name in the effect + /// \param X, Y : Values to assign + /// + //////////////////////////////////////////////////////////// + void SetParameter(const std::string& Name, float X, float Y); + + //////////////////////////////////////////////////////////// + /// Change a parameter of the effect (3 floats) + /// + /// \param Name : Parameter name in the effect + /// \param X, Y, Z : Values to assign + /// + //////////////////////////////////////////////////////////// + void SetParameter(const std::string& Name, float X, float Y, float Z); + + //////////////////////////////////////////////////////////// + /// Change a parameter of the effect (4 floats) + /// + /// \param Name : Parameter name in the effect + /// \param X, Y, Z, W : Values to assign + /// + //////////////////////////////////////////////////////////// + void SetParameter(const std::string& Name, float X, float Y, float Z, float W); + + //////////////////////////////////////////////////////////// + /// Set a texture parameter + /// + /// \param Name : Texture name in the effect + /// \param Texture : Image to set (pass NULL to use content of current framebuffer) + /// + //////////////////////////////////////////////////////////// + void SetTexture(const std::string& Name, Image* Texture); + + //////////////////////////////////////////////////////////// + /// Assignment operator + /// + /// \param Other : Instance to assign + /// + /// \return Reference to the post-effect + /// + //////////////////////////////////////////////////////////// + PostFX& operator =(const PostFX& Other); + + //////////////////////////////////////////////////////////// + /// Tell whether or not the system supports post-effects + /// + /// \return True if the system can use post-effects + /// + //////////////////////////////////////////////////////////// + static bool CanUsePostFX(); + +protected : + + //////////////////////////////////////////////////////////// + /// /see Drawable::Render + /// + //////////////////////////////////////////////////////////// + virtual void Render(RenderTarget& Target) const; + +private : + + //////////////////////////////////////////////////////////// + /// Preprocess a SFML effect file + /// to convert it to a valid GLSL fragment shader + /// + /// \param File : Stream containing the code to process + /// + /// \return Valid fragment shader source code + /// + //////////////////////////////////////////////////////////// + static std::string PreprocessEffect(std::istream& File); + + //////////////////////////////////////////////////////////// + /// Create the program and attach the shaders + /// + //////////////////////////////////////////////////////////// + void CreateProgram(); + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map TextureTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int myShaderProgram; ///< OpenGL identifier for the program + TextureTable myTextures; ///< Texture variables in the effect + std::string myFragmentShader; ///< Fragment shader source code + mutable Image myFrameBuffer; ///< Texture containing the current frame buffer +}; + +} // namespace sf + + +#endif // SFML_POSTFX_HPP diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp new file mode 100644 index 00000000..b8e693d3 --- /dev/null +++ b/include/SFML/Graphics/Rect.hpp @@ -0,0 +1,127 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RECT_HPP +#define SFML_RECT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Rect is an utility class for manipulating rectangles. +/// Template parameter defines the type of coordinates (integer, float, ...) +//////////////////////////////////////////////////////////// +template +class Rect +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Rect(); + + //////////////////////////////////////////////////////////// + /// Construct the rectangle from its coordinates + /// + /// \param LeftCoord : Left coordinate of the rectangle + /// \param TopCoord : Top coordinate of the rectangle + /// \param RightCoord : Right coordinate of the rectangle + /// \param BottomCoord : Bottom coordinate of the rectangle + /// + //////////////////////////////////////////////////////////// + Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord); + + //////////////////////////////////////////////////////////// + /// Get the width of the rectangle + /// + /// \return Width of rectangle + /// + //////////////////////////////////////////////////////////// + T GetWidth() const; + + //////////////////////////////////////////////////////////// + /// Get the height of the rectangle + /// + /// \return Height of rectangle + /// + //////////////////////////////////////////////////////////// + T GetHeight() const; + + //////////////////////////////////////////////////////////// + /// Move the whole rectangle by the given offset + /// + /// \param OffsetX : Horizontal offset + /// \param OffsetY : Vertical offset + /// + //////////////////////////////////////////////////////////// + void Offset(T OffsetX, T OffsetY); + + //////////////////////////////////////////////////////////// + /// Check if a point is inside the rectangle's area + /// + /// \param X : X coordinate of the point to test + /// \param Y : Y coordinate of the point to test + /// + /// \return True if the point is inside + /// + //////////////////////////////////////////////////////////// + bool Contains(T X, T Y) const; + + //////////////////////////////////////////////////////////// + /// Check intersection between two rectangles + /// + /// \param Rectangle : Rectangle to test + /// \param OverlappingRect : Rectangle to be filled with overlapping rect (NULL by default) + /// + /// \return True if rectangles overlap + /// + //////////////////////////////////////////////////////////// + bool Intersects(const Rect& Rectangle, Rect* OverlappingRect = NULL) const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T Left; ///< Left coordinate of the rectangle + T Top; ///< Top coordinate of the rectangle + T Right; ///< Right coordinate of the rectangle + T Bottom; ///< Bottom coordinate of the rectangle +}; + +#include + +// Define the most common types +typedef Rect IntRect; +typedef Rect FloatRect; + +} // namespace sf + + +#endif // SFML_RECT_HPP diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl new file mode 100644 index 00000000..83911198 --- /dev/null +++ b/include/SFML/Graphics/Rect.inl @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +template +Rect::Rect() : +Left (0), +Top (0), +Right (0), +Bottom(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the color from its coordinates +//////////////////////////////////////////////////////////// +template +Rect::Rect(T LeftCoord, T TopCoord, T RightCoord, T BottomCoord) : +Left (LeftCoord), +Top (TopCoord), +Right (RightCoord), +Bottom(BottomCoord) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Get the width of the rectangle +//////////////////////////////////////////////////////////// +template +T Rect::GetWidth() const +{ + return Right - Left; +} + + +//////////////////////////////////////////////////////////// +/// Get the height of the rectangle +//////////////////////////////////////////////////////////// +template +T Rect::GetHeight() const +{ + return Bottom - Top; +} + + +//////////////////////////////////////////////////////////// +/// Move the whole rectangle by the given offset +//////////////////////////////////////////////////////////// +template +void Rect::Offset(T OffsetX, T OffsetY) +{ + Left += OffsetX; + Right += OffsetX; + Top += OffsetY; + Bottom += OffsetY; +} + + +//////////////////////////////////////////////////////////// +/// Check if a point is inside the rectangle's area +//////////////////////////////////////////////////////////// +template +bool Rect::Contains(T X, T Y) const +{ + return (X >= Left) && (X <= Right) && (Y >= Top) && (Y <= Bottom); +} + + +//////////////////////////////////////////////////////////// +/// Check intersection between two rectangles +//////////////////////////////////////////////////////////// +template +bool Rect::Intersects(const Rect& Rectangle, Rect* OverlappingRect) const +{ + // Compute overlapping rect + Rect Overlapping(std::max(Left, Rectangle.Left), + std::max(Top, Rectangle.Top), + std::min(Right, Rectangle.Right), + std::min(Bottom, Rectangle.Bottom)); + + // If overlapping rect is valid, then there is intersection + if ((Overlapping.Left < Overlapping.Right) && (Overlapping.Top < Overlapping.Bottom)) + { + if (OverlappingRect) + *OverlappingRect = Overlapping; + return true; + } + else + { + if (OverlappingRect) + *OverlappingRect = Rect(0, 0, 0, 0); + return false; + } +} diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp new file mode 100644 index 00000000..93131f3f --- /dev/null +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -0,0 +1,166 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERTARGET_HPP +#define SFML_RENDERTARGET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class Drawable; + +//////////////////////////////////////////////////////////// +/// Base class for all render targets (window, image, ...) +//////////////////////////////////////////////////////////// +class SFML_API RenderTarget +{ +public : + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~RenderTarget(); + + //////////////////////////////////////////////////////////// + /// Clear the entire target with a single color + /// + /// \param FillColor : Color to use to clear the render target + /// + //////////////////////////////////////////////////////////// + void Clear(const Color& FillColor = Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Draw something into the target + /// + /// \param Object : Object to draw + /// + //////////////////////////////////////////////////////////// + virtual void Draw(const Drawable& Object); + + //////////////////////////////////////////////////////////// + /// Get the width of the rendering region of the target + /// + /// \return Width in pixels + /// + //////////////////////////////////////////////////////////// + virtual unsigned int GetWidth() const = 0; + + //////////////////////////////////////////////////////////// + /// Get the height of the rendering region of the target + /// + /// \return Height in pixels + /// + //////////////////////////////////////////////////////////// + virtual unsigned int GetHeight() const = 0; + + //////////////////////////////////////////////////////////// + /// Change the current active view. + /// + /// \param NewView : New view to use (pass GetDefaultView() to set the default view) + /// + //////////////////////////////////////////////////////////// + void SetView(const View& NewView); + + //////////////////////////////////////////////////////////// + /// Get the current view + /// + /// \return Current view active in the window + /// + //////////////////////////////////////////////////////////// + const View& GetView() const; + + //////////////////////////////////////////////////////////// + /// Get the default view of the window for read / write + /// + /// \return Default view + /// + //////////////////////////////////////////////////////////// + View& GetDefaultView(); + + //////////////////////////////////////////////////////////// + /// Tell SFML to preserve external OpenGL states, at the expense of + /// more CPU charge. Use this function if you don't want SFML + /// to mess up your own OpenGL states (if any). + /// Don't enable state preservation if not needed, as it will allow + /// SFML to do internal optimizations and improve performances. + /// This parameter is false by default + /// + /// \param Preserve : True to preserve OpenGL states, false to let SFML optimize + /// + //////////////////////////////////////////////////////////// + void PreserveOpenGLStates(bool Preserve); + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + RenderTarget(); + + //////////////////////////////////////////////////////////// + /// Called by the derived class when it's ready to be initialized + /// + //////////////////////////////////////////////////////////// + void Initialize(); + +private : + + //////////////////////////////////////////////////////////// + /// Activate the target for rendering + /// + /// \param Active : True to activate rendering, false to deactivate + /// + /// \return True if activation succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool Activate(bool Active) = 0; + + //////////////////////////////////////////////////////////// + /// Set the OpenGL render states needed for the SFML rendering + /// + //////////////////////////////////////////////////////////// + void SetRenderStates(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + View myDefaultView; ///< Default view + const View* myCurrentView; ///< Current active view + bool myPreserveStates; ///< Should we preserve external OpenGL states ? + bool myIsDrawing; ///< True when Draw is called from inside, to allow some renderstates optimizations +}; + +} // namespace sf + + +#endif // SFML_RENDERTARGET_HPP diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp new file mode 100644 index 00000000..91f78ad6 --- /dev/null +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -0,0 +1,135 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERWINDOW_HPP +#define SFML_RENDERWINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class Drawable; + +//////////////////////////////////////////////////////////// +/// Simple wrapper for sf::Window that allows easy +/// 2D rendering +//////////////////////////////////////////////////////////// +class SFML_API RenderWindow : public Window, public RenderTarget +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + RenderWindow(); + + //////////////////////////////////////////////////////////// + /// Construct the window + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style (Resize | Close by default) + /// \param Params : Creation parameters (see default constructor for default values) + /// + //////////////////////////////////////////////////////////// + RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings()); + + //////////////////////////////////////////////////////////// + /// Construct the window from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation parameters (see default constructor for default values) + /// + //////////////////////////////////////////////////////////// + RenderWindow(WindowHandle Handle, const WindowSettings& Params = WindowSettings()); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~RenderWindow(); + + //////////////////////////////////////////////////////////// + /// Get the width of the rendering region of the window + /// + /// \return Width in pixels + /// + //////////////////////////////////////////////////////////// + virtual unsigned int GetWidth() const; + + //////////////////////////////////////////////////////////// + /// Get the height of the rendering region of the window + /// + /// \return Height in pixels + /// + //////////////////////////////////////////////////////////// + virtual unsigned int GetHeight() const; + + //////////////////////////////////////////////////////////// + /// Save the content of the window to an image + /// + /// \return Image instance containing the contents of the screen + /// + //////////////////////////////////////////////////////////// + Image Capture() const; + + //////////////////////////////////////////////////////////// + /// Convert a point in window coordinates into view coordinates + /// + /// \param WindowX : X coordinate of the point to convert, relative to the window + /// \param WindowY : Y coordinate of the point to convert, relative to the window + /// \param TargetView : Target view to convert the point to (NULL by default -- uses the current view) + /// + /// \return Converted point + /// + //////////////////////////////////////////////////////////// + sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View* TargetView = NULL) const; + +private : + + //////////////////////////////////////////////////////////// + /// /see Window::OnCreate + /// + //////////////////////////////////////////////////////////// + virtual void OnCreate(); + + //////////////////////////////////////////////////////////// + /// /see RenderTarget::Activate + /// + //////////////////////////////////////////////////////////// + virtual bool Activate(bool Active); +}; + +} // namespace sf + + +#endif // SFML_RENDERWINDOW_HPP diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp new file mode 100644 index 00000000..0db529a4 --- /dev/null +++ b/include/SFML/Graphics/Shape.hpp @@ -0,0 +1,310 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SHAPE_HPP +#define SFML_SHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Shape defines a drawable convex shape ; it also defines +/// helper functions to draw simple shapes like +/// lines, rectangles, circles, etc. +//////////////////////////////////////////////////////////// +class SFML_API Shape : public sf::Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Shape(); + + //////////////////////////////////////////////////////////// + /// Add a point to the shape + /// + /// \param X, Y : Position of the point + /// \param Col : Color of the point (white by default) + /// \param OutlineCol : Outline color of the point (black by default) + /// + //////////////////////////////////////////////////////////// + void AddPoint(float X, float Y, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Add a point to the shape + /// + /// \param Position : Position of the point + /// \param Col : Color of the point (white by default) + /// \param OutlineCol : Outline color of the point (black by default) + /// + //////////////////////////////////////////////////////////// + void AddPoint(const Vector2f& Position, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Get the number of points composing the shape + /// + /// \param Total number of points + /// + //////////////////////////////////////////////////////////// + unsigned int GetNbPoints() const; + + //////////////////////////////////////////////////////////// + /// Enable or disable filling the shape. + /// Fill is enabled by default + /// + /// \param Enable : True to enable, false to disable + /// + //////////////////////////////////////////////////////////// + void EnableFill(bool Enable); + + //////////////////////////////////////////////////////////// + /// Enable or disable drawing the shape outline. + /// Outline is enabled by default + /// + /// \param Enable : True to enable, false to disable + /// + //////////////////////////////////////////////////////////// + void EnableOutline(bool Enable); + + //////////////////////////////////////////////////////////// + /// Set the position of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param Position : New position of the Index-th point + /// + //////////////////////////////////////////////////////////// + void SetPointPosition(unsigned int Index, const Vector2f& Position); + + //////////////////////////////////////////////////////////// + /// Set the position of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param X : New X coordinate of the Index-th point + /// \param Y : New Y coordinate of the Index-th point + /// + //////////////////////////////////////////////////////////// + void SetPointPosition(unsigned int Index, float X, float Y); + + //////////////////////////////////////////////////////////// + /// Set the color of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param Col : New color of the Index-th point + /// + //////////////////////////////////////////////////////////// + void SetPointColor(unsigned int Index, const Color& Col); + + //////////////////////////////////////////////////////////// + /// Set the outline color of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// \param OutlineCol : New outline color of the Index-th point + /// + //////////////////////////////////////////////////////////// + void SetPointOutlineColor(unsigned int Index, const Color& OutlineCol); + + //////////////////////////////////////////////////////////// + /// Change the width of the shape outline + /// + /// \param Width : New width + /// + //////////////////////////////////////////////////////////// + void SetOutlineWidth(float Width); + + //////////////////////////////////////////////////////////// + /// Get the position of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// + /// \return Position of the Index-th point + /// + //////////////////////////////////////////////////////////// + const Vector2f& GetPointPosition(unsigned int Index) const; + + //////////////////////////////////////////////////////////// + /// Get the color of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// + /// \return Color of the Index-th point + /// + //////////////////////////////////////////////////////////// + const Color& GetPointColor(unsigned int Index) const; + + //////////////////////////////////////////////////////////// + /// Get the outline color of a point + /// + /// \param Index : Index of the point, in range [0, GetNbPoints() - 1] + /// + /// \return Outline color of the Index-th point + /// + //////////////////////////////////////////////////////////// + const Color& GetPointOutlineColor(unsigned int Index) const; + + //////////////////////////////////////////////////////////// + /// Get the width of the shape outline + /// + /// \return Current outline width + /// + //////////////////////////////////////////////////////////// + float GetOutlineWidth() const; + + //////////////////////////////////////////////////////////// + /// Create a shape made of a single line (use floats) + /// + /// \param P1X, P1Y : Position of the first point + /// \param P2X, P2Y : Position second point + /// \param Thickness : Line thickness + /// \param Col : Color used to draw the line + /// \param Outline : Outline width (0 by default) + /// \param OutlineCol : Color used to draw the outline (black by default) + /// + //////////////////////////////////////////////////////////// + static Shape Line(float P1X, float P1Y, float P2X, float P2Y, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Create a shape made of a single line (use vectors) + /// + /// \param P1X, P1Y : Position of the first point + /// \param P2X, P2Y : Position second point + /// \param Thickness : Line thickness + /// \param Col : Color used to draw the line + /// \param Outline : Outline width (0 by default) + /// \param OutlineCol : Color used to draw the outline (black by default) + /// + //////////////////////////////////////////////////////////// + static Shape Line(const Vector2f& P1, const Vector2f& P2, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Create a shape made of a single rectangle (use floats) + /// + /// \param P1X, P1Y : Position of the first point + /// \param P2X, P2Y : Position second point + /// \param Col : Color used to fill the rectangle + /// \param Outline : Outline width (0 by default) + /// \param OutlineCol : Color used to draw the outline (black by default) + /// + //////////////////////////////////////////////////////////// + static Shape Rectangle(float P1X, float P1Y, float P2X, float P2Y, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Create a shape made of a single rectangle (use vectors) + /// + /// \param P1 : Position of the first point + /// \param P2 : Position second point + /// \param Col : Color used to fill the rectangle + /// \param Outline : Outline width (0 by default) + /// \param OutlineCol : Color used to draw the outline (black by default) + /// + //////////////////////////////////////////////////////////// + static Shape Rectangle(const Vector2f& P1, const Vector2f& P2, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Create a shape made of a single circle (use floats) + /// + /// \param X, Y : Position of the center + /// \param Radius : Radius + /// \param Col : Color used to fill the circle + /// \param Outline : Outline width (0 by default) + /// \param OutlineCol : Color used to draw the outline (black by default) + /// + //////////////////////////////////////////////////////////// + static Shape Circle(float X, float Y, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// Create a shape made of a single circle (use vectors) + /// + /// \param Center : Position of the center + /// \param Radius : Radius + /// \param Col : Color used to fill the circle + /// \param Outline : Outline width (0 by default) + /// \param OutlineCol : Color used to draw the outline (black by default) + /// + //////////////////////////////////////////////////////////// + static Shape Circle(const Vector2f& Center, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); + +protected : + + //////////////////////////////////////////////////////////// + /// /see Drawable::Render + /// + //////////////////////////////////////////////////////////// + virtual void Render(RenderTarget& Target) const; + +private : + + //////////////////////////////////////////////////////////// + /// Compile the shape : compute its center and its outline + /// + //////////////////////////////////////////////////////////// + void Compile(); + + //////////////////////////////////////////////////////////// + /// Compute the normal of a given 2D segment + /// + /// \param P1 : First point of the segment + /// \param P2 : Second point of the segment + /// \param Normal : Calculated normal + /// + /// \return False if the normal couldn't be calculated (segment is null) + /// + //////////////////////////////////////////////////////////// + static bool ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Normal); + + //////////////////////////////////////////////////////////// + /// Defines a simple 2D point + //////////////////////////////////////////////////////////// + struct Point + { + Point(const Vector2f& Pos = Vector2f(0, 0), const Color& C = Color(255, 255, 255), const Color& OutlineC = Color(255, 255, 255)); + + Vector2f Position; ///< Position + Vector2f Normal; ///< Extruded normal + Color Col; ///< Color of the point + Color OutlineCol; ///< Outline color of the point + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector myPoints; ///< Points composing the shape + float myOutline; ///< Outline width + bool myIsFillEnabled; ///< Should we draw the inside if the shape ? + bool myIsOutlineEnabled; ///< Should we draw the outline if the shape ? + bool myIsCompiled; ///< Compiled state of the shape +}; + +} // namespace sf + + +#endif // SFML_SHAPE_HPP diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp new file mode 100644 index 00000000..c7aa3489 --- /dev/null +++ b/include/SFML/Graphics/Sprite.hpp @@ -0,0 +1,176 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SPRITE_HPP +#define SFML_SPRITE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class Image; + +//////////////////////////////////////////////////////////// +/// Sprite defines a sprite : texture, transformations, +/// color, and draw on screen +//////////////////////////////////////////////////////////// +class SFML_API Sprite : public Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Sprite(); + + //////////////////////////////////////////////////////////// + /// Construct the sprite from a source image + /// + /// \param Img : Image of the sprite + /// \param Position : Position of the sprite (0, 0 by default) + /// \param Scale : Scale factor (1, 1 by default) + /// \param Rotation : Orientation, in degrees (0 by default) + /// \param Col : Color of the sprite (white by default) + /// + //////////////////////////////////////////////////////////// + Sprite(const Image& Img, const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255)); + + //////////////////////////////////////////////////////////// + /// Change the image of the sprite + /// + /// \param Img : New image + /// + //////////////////////////////////////////////////////////// + void SetImage(const Image& Img); + + //////////////////////////////////////////////////////////// + /// Set the sub-rectangle of the sprite inside the source image. + /// By default, the subrect covers the entire source image + /// + /// \param SubRect : New sub-rectangle + /// + //////////////////////////////////////////////////////////// + void SetSubRect(const IntRect& SubRect); + + //////////////////////////////////////////////////////////// + /// Resize the sprite (by changing its scale factors) (take 2 values). + /// The default size is defined by the subrect + /// + /// \param Width : New width (must be strictly positive) + /// \param Height : New height (must be strictly positive) + /// + //////////////////////////////////////////////////////////// + void Resize(float Width, float Height); + + //////////////////////////////////////////////////////////// + /// Resize the sprite (by changing its scale factors) (take a 2D vector). + /// The default size is defined by the subrect + /// + /// \param Size : New size (both coordinates must be strictly positive) + /// + //////////////////////////////////////////////////////////// + void Resize(const Vector2f& Size); + + //////////////////////////////////////////////////////////// + /// Flip the sprite horizontally + /// + /// \param Flipped : True to flip the sprite + /// + //////////////////////////////////////////////////////////// + void FlipX(bool Flipped); + + //////////////////////////////////////////////////////////// + /// Flip the sprite vertically + /// + /// \param Flipped : True to flip the sprite + /// + //////////////////////////////////////////////////////////// + void FlipY(bool Flipped); + + //////////////////////////////////////////////////////////// + /// Get the source image of the sprite + /// + /// \return Pointer to the image (can be NULL) + /// + //////////////////////////////////////////////////////////// + const Image* GetImage() const; + + //////////////////////////////////////////////////////////// + /// Get the sub-rectangle of the sprite inside the source image + /// + /// \return Sub-rectangle + /// + //////////////////////////////////////////////////////////// + const IntRect& GetSubRect() const; + + //////////////////////////////////////////////////////////// + /// Get the sprite size + /// + /// \return Size of the sprite + /// + //////////////////////////////////////////////////////////// + Vector2f GetSize() const; + + //////////////////////////////////////////////////////////// + /// Get the color of a given pixel in the sprite + /// (point is in local coordinates) + /// + /// \param X : X coordinate of the pixel to get + /// \param Y : Y coordinate of the pixel to get + /// + /// \return Color of pixel (X, Y) + /// + //////////////////////////////////////////////////////////// + Color GetPixel(unsigned int X, unsigned int Y) const; + +protected : + + //////////////////////////////////////////////////////////// + /// /see Drawable::Render + /// + //////////////////////////////////////////////////////////// + virtual void Render(RenderTarget& Target) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + ResourcePtr myImage; ///< Image used to draw the sprite + IntRect mySubRect; ///< Sub-rectangle of source image to assign to the sprite + bool myIsFlippedX; ///< Is the sprite flipped on the X axis ? + bool myIsFlippedY; ///< Is the sprite flipped on the Y axis ? +}; + +} // namespace sf + + +#endif // SFML_SPRITE_HPP diff --git a/include/SFML/Graphics/String.hpp b/include/SFML/Graphics/String.hpp new file mode 100644 index 00000000..a7f47184 --- /dev/null +++ b/include/SFML/Graphics/String.hpp @@ -0,0 +1,191 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_STRING_HPP +#define SFML_STRING_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// String defines a graphical 2D text, that can be drawn on screen +//////////////////////////////////////////////////////////// +class SFML_API String : public Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// Enumerate the string drawing styles + //////////////////////////////////////////////////////////// + enum Style + { + Regular = 0, ///< Regular characters, no style + Bold = 1 << 0, ///< Characters are bold + Italic = 1 << 1, ///< Characters are in italic + Underlined = 1 << 2 ///< Characters are underlined + }; + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + String(); + + //////////////////////////////////////////////////////////// + /// Construct the string from any kind of text + /// + /// \param Text : Text assigned to the string + /// \param Font : Font used to draw the string (SFML built-in font by default) + /// \param Size : Characters size (30 by default) + /// + //////////////////////////////////////////////////////////// + explicit String(const Unicode::Text& Text, const Font& CharFont = Font::GetDefaultFont(), float Size = 30.f); + + //////////////////////////////////////////////////////////// + /// Set the text (from any kind of string) + /// + /// \param Text : New text + /// + //////////////////////////////////////////////////////////// + void SetText(const Unicode::Text& Text); + + //////////////////////////////////////////////////////////// + /// Set the font of the string + /// + /// \param Font : Font to use + /// + //////////////////////////////////////////////////////////// + void SetFont(const Font& CharFont); + + //////////////////////////////////////////////////////////// + /// Set the size of the string + /// The default size is 30 + /// + /// \param Size : New size, in pixels + /// + //////////////////////////////////////////////////////////// + void SetSize(float Size); + + //////////////////////////////////////////////////////////// + /// Set the style of the text + /// The default style is Regular + /// + /// \param TextStyle : New text style, (combination of Style enum values) + /// + //////////////////////////////////////////////////////////// + void SetStyle(unsigned long TextStyle); + + //////////////////////////////////////////////////////////// + /// Get the text (the returned text can be converted implicitely to any kind of string) + /// + /// \return String's text + /// + //////////////////////////////////////////////////////////// + const Unicode::Text& GetText() const; + + //////////////////////////////////////////////////////////// + /// Get the font used by the string + /// + /// \return Font used + /// + //////////////////////////////////////////////////////////// + const Font& GetFont() const; + + //////////////////////////////////////////////////////////// + /// Get the size of the characters + /// + /// \return Size of the characters + /// + //////////////////////////////////////////////////////////// + float GetSize() const; + + //////////////////////////////////////////////////////////// + /// Get the style of the text + /// + /// \return Current string style (combination of Style enum values) + /// + //////////////////////////////////////////////////////////// + unsigned long GetStyle() const; + + //////////////////////////////////////////////////////////// + /// Return the visual position of the Index-th character of the string, + /// in coordinates relative to the string + /// (note : translation, center, rotation and scale are not applied) + /// + /// \param Index : Index of the character + /// + /// \return Position of the Index-th character (end of string if Index is out of range) + /// + //////////////////////////////////////////////////////////// + sf::Vector2f GetCharacterPos(std::size_t Index) const; + + //////////////////////////////////////////////////////////// + /// Get the string rectangle on screen + /// + /// \return Rectangle contaning the string in screen coordinates + /// + //////////////////////////////////////////////////////////// + FloatRect GetRect() const; + +protected : + + //////////////////////////////////////////////////////////// + /// /see Drawable::Render + /// + //////////////////////////////////////////////////////////// + virtual void Render(RenderTarget& Target) const; + +private : + + //////////////////////////////////////////////////////////// + /// Recompute the bounding rectangle of the text + /// + //////////////////////////////////////////////////////////// + void RecomputeRect(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Unicode::Text myText; ///< Text to display + ResourcePtr myFont; ///< Font used to display the string + float mySize; ///< Size of the characters + unsigned long myStyle; ///< Text style (see Style enum) + FloatRect myBaseRect; ///< Bounding rectangle of the text in object coordinates + bool myNeedRectUpdate; ///< Does the bounding rect need an update ? +}; + +} // namespace sf + + +#endif // SFML_STRING_HPP diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp new file mode 100644 index 00000000..4ef9ef67 --- /dev/null +++ b/include/SFML/Graphics/View.hpp @@ -0,0 +1,188 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIEW_HPP +#define SFML_VIEW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class RenderTarget; + +//////////////////////////////////////////////////////////// +/// This class defines a view (position, size, etc.) ; +/// you can consider it as a 2D camera +//////////////////////////////////////////////////////////// +class SFML_API View +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the view from a rectangle + /// + /// \param ViewRect : Rectangle defining the position and size of the view (1000x1000 by default) + /// + //////////////////////////////////////////////////////////// + explicit View(const FloatRect& ViewRect = FloatRect(0, 0, 1000, 1000)); + + //////////////////////////////////////////////////////////// + /// Construct the view from its center and half-size + /// + /// \param Center : Center of the view + /// \param HalfSize : Half-size of the view (from center to corner) + /// + //////////////////////////////////////////////////////////// + View(const sf::Vector2f& Center, const sf::Vector2f& HalfSize); + + //////////////////////////////////////////////////////////// + /// Change the center of the view (take 2 values) + /// + /// \param X : X coordinate of the new center + /// \param Y : Y coordinate of the new center + /// + //////////////////////////////////////////////////////////// + void SetCenter(float X, float Y); + + //////////////////////////////////////////////////////////// + /// Change the center of the view (take a vector) + /// + /// \param Center : New center + /// + //////////////////////////////////////////////////////////// + void SetCenter(const sf::Vector2f& Center); + + //////////////////////////////////////////////////////////// + /// Change the half-size of the view (take 2 values) + /// + /// \param HalfWidth : New half-width + /// \param HalfHeight : New half-height + /// + //////////////////////////////////////////////////////////// + void SetHalfSize(float HalfWidth, float HalfHeight); + + //////////////////////////////////////////////////////////// + /// Change the half-size of the view (take a vector) + /// + /// \param HalfSize : New half-size + /// + //////////////////////////////////////////////////////////// + void SetHalfSize(const sf::Vector2f& HalfSize); + + //////////////////////////////////////////////////////////// + /// Rebuild the view from a rectangle + /// + /// \param ViewRect : Rectangle defining the position and size of the view + /// + //////////////////////////////////////////////////////////// + void SetFromRect(const FloatRect& ViewRect); + + //////////////////////////////////////////////////////////// + /// Get the center of the view + /// + /// \return Center of the view + /// + //////////////////////////////////////////////////////////// + const sf::Vector2f& GetCenter() const; + + //////////////////////////////////////////////////////////// + /// Get the half-size of the view + /// + /// \return Half-size of the view + /// + //////////////////////////////////////////////////////////// + const sf::Vector2f& GetHalfSize() const; + + //////////////////////////////////////////////////////////// + /// Get the bounding rectangle of the view + /// + /// \return Bounding rectangle of the view + /// + //////////////////////////////////////////////////////////// + const sf::FloatRect& GetRect() const; + + //////////////////////////////////////////////////////////// + /// Move the view (take 2 values) + /// + /// \param OffsetX : Offset to move the view, on X axis + /// \param OffsetY : Offset to move the view, on Y axis + /// + //////////////////////////////////////////////////////////// + void Move(float OffsetX, float OffsetY); + + //////////////////////////////////////////////////////////// + /// Move the view (take a vector) + /// + /// \param Offset : Offset to move the view + /// + //////////////////////////////////////////////////////////// + void Move(const sf::Vector2f& Offset); + + //////////////////////////////////////////////////////////// + /// Resize the view rectangle to simulate a zoom / unzoom effect + /// + /// \param Factor : Zoom factor to apply, relative to the current zoom + /// + //////////////////////////////////////////////////////////// + void Zoom(float Factor); + +private : + + friend class RenderTarget; + + //////////////////////////////////////////////////////////// + /// Get the projection matrix of the view + /// + /// \return Projection matrix containing the view settings + /// + //////////////////////////////////////////////////////////// + const Matrix3& GetMatrix() const; + + //////////////////////////////////////////////////////////// + /// Recompute the view rectangle and the projection matrix + /// + //////////////////////////////////////////////////////////// + void RecomputeMatrix(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + sf::Vector2f myCenter; ///< Center of the view + sf::Vector2f myHalfSize; ///< Half-size of the view + FloatRect myRect; ///< Rectangle defining the bounds of the view + Matrix3 myMatrix; ///< Precomputed projection matrix corresponding to the view + bool myNeedUpdate; ///< Internal state telling if the matrix needs to be updated +}; + +} // namespace sf + + +#endif // SFML_VIEW_HPP diff --git a/include/SFML/Network.hpp b/include/SFML/Network.hpp new file mode 100644 index 00000000..fe1730ad --- /dev/null +++ b/include/SFML/Network.hpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_HPP +#define SFML_NETWORK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_NETWORK_HPP diff --git a/include/SFML/Network/Ftp.hpp b/include/SFML/Network/Ftp.hpp new file mode 100644 index 00000000..673b9048 --- /dev/null +++ b/include/SFML/Network/Ftp.hpp @@ -0,0 +1,448 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FTP_HPP +#define SFML_FTP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class IPAddress; + +//////////////////////////////////////////////////////////// +/// This class provides methods for manipulating the FTP +/// protocol (described in RFC 959). +/// It provides easy access and transfers to remote +/// directories and files on a FTP server +//////////////////////////////////////////////////////////// +class SFML_API Ftp : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Enumeration of transfer modes + //////////////////////////////////////////////////////////// + enum TransferMode + { + Binary, ///< Binary mode (file is transfered as a sequence of bytes) + Ascii, ///< Text mode using ASCII encoding + Ebcdic ///< Text mode using EBCDIC encoding + }; + + //////////////////////////////////////////////////////////// + /// This class wraps a FTP response, which is basically : + /// - a status code + /// - a message + //////////////////////////////////////////////////////////// + class SFML_API Response + { + public : + + //////////////////////////////////////////////////////////// + /// Enumerate all the valid status codes returned in + /// a FTP response + //////////////////////////////////////////////////////////// + enum Status + { + // 1xx: the requested action is being initiated, + // expect another reply before proceeding with a new command + RestartMarkerReply = 110, ///< Restart marker reply + ServiceReadySoon = 120, ///< Service ready in N minutes + DataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting + OpeningDataConnection = 150, ///< File status ok, about to open data connection + + // 2xx: the requested action has been successfully completed + Ok = 200, ///< Command ok + PointlessCommand = 202, ///< Command not implemented + SystemStatus = 211, ///< System status, or system help reply + DirectoryStatus = 212, ///< Directory status + FileStatus = 213, ///< File status + HelpMessage = 214, ///< Help message + SystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document + ServiceReady = 220, ///< Service ready for new user + ClosingConnection = 221, ///< Service closing control connection + DataConnectionOpened = 225, ///< Data connection open, no transfer in progress + ClosingDataConnection = 226, ///< Closing data connection, requested file action successful + EnteringPassiveMode = 227, ///< Entering passive mode + LoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate + FileActionOk = 250, ///< Requested file action ok + DirectoryOk = 257, ///< PATHNAME created + + // 3xx: the command has been accepted, but the requested action + // is dormant, pending receipt of further information + NeedPassword = 331, ///< User name ok, need password + NeedAccountToLogIn = 332, ///< Need account for login + NeedInformation = 350, ///< Requested file action pending further information + + // 4xx: the command was not accepted and the requested action did not take place, + // but the error condition is temporary and the action may be requested again + ServiceUnavailable = 421, ///< Service not available, closing control connection + DataConnectionUnavailable = 425, ///< Can't open data connection + TransferAborted = 426, ///< Connection closed, transfer aborted + FileActionAborted = 450, ///< Requested file action not taken + LocalError = 451, ///< Requested action aborted, local error in processing + InsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable + + // 5xx: the command was not accepted and + // the requested action did not take place + CommandUnknown = 500, ///< Syntax error, command unrecognized + ParametersUnknown = 501, ///< Syntax error in parameters or arguments + CommandNotImplemented = 502, ///< Command not implemented + BadCommandSequence = 503, ///< Bad sequence of commands + ParameterNotImplemented = 504, ///< Command not implemented for that parameter + NotLoggedIn = 530, ///< Not logged in + NeedAccountToStore = 532, ///< Need account for storing files + FileUnavailable = 550, ///< Requested action not taken, file unavailable + PageTypeUnknown = 551, ///< Requested action aborted, page type unknown + NotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation + FilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed + + // 10xx: SFML custom codes + InvalidResponse = 1000, ///< Response is not a valid FTP one + ConnectionFailed = 1001, ///< Connection with server failed + ConnectionClosed = 1002, ///< Connection with server closed + InvalidFile = 1003 ///< Invalid file to upload / download + }; + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + /// \param Code : Response status code (InvalidResponse by default) + /// \param Message : Response message (empty by default) + /// + //////////////////////////////////////////////////////////// + Response(Status Code = InvalidResponse, const std::string& Message = ""); + + //////////////////////////////////////////////////////////// + /// Convenience function to check if the response status code + /// means a success + /// + /// \return True if status is success (code < 400) + /// + //////////////////////////////////////////////////////////// + bool IsOk() const; + + //////////////////////////////////////////////////////////// + /// Get the response status code + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Status GetStatus() const; + + //////////////////////////////////////////////////////////// + /// Get the full message contained in the response + /// + /// \return The response message + /// + //////////////////////////////////////////////////////////// + const std::string& GetMessage() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Status myStatus; ///< Status code returned from the server + std::string myMessage; ///< Last message received from the server + }; + + //////////////////////////////////////////////////////////// + /// Specialization of FTP response returning a directory + //////////////////////////////////////////////////////////// + class SFML_API DirectoryResponse : public Response + { + public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + /// \param Resp : Source response + /// + //////////////////////////////////////////////////////////// + DirectoryResponse(Response Resp); + + //////////////////////////////////////////////////////////// + /// Get the directory returned in the response + /// + /// \return Directory name + /// + //////////////////////////////////////////////////////////// + const std::string& GetDirectory() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::string myDirectory; ///< Directory extracted from the response message + }; + + + //////////////////////////////////////////////////////////// + /// Specialization of FTP response returning a filename lisiting + //////////////////////////////////////////////////////////// + class SFML_API ListingResponse : public Response + { + public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + /// \param Resp : Source response + /// \param Data : Data containing the raw listing + /// + //////////////////////////////////////////////////////////// + ListingResponse(Response Resp, const std::vector& Data); + + //////////////////////////////////////////////////////////// + /// Get the number of filenames in the listing + /// + /// \return Total number of filenames + /// + //////////////////////////////////////////////////////////// + std::size_t GetCount() const; + + //////////////////////////////////////////////////////////// + /// Get the Index-th filename in the directory + /// + /// \param Index : Index of the filename to get + /// + /// \return Index-th filename + /// + //////////////////////////////////////////////////////////// + const std::string& GetFilename(std::size_t Index) const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector myFilenames; ///< Filenames extracted from the data + }; + + + //////////////////////////////////////////////////////////// + /// Destructor -- close the connection with the server + /// + //////////////////////////////////////////////////////////// + ~Ftp(); + + //////////////////////////////////////////////////////////// + /// Connect to the specified FTP server + /// + /// \param Server : FTP server to connect to + /// \param Port : Port used for connection (21 by default, standard FTP port) + /// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout) + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response Connect(const IPAddress& Server, unsigned short Port = 21, float Timeout = 0.f); + + //////////////////////////////////////////////////////////// + /// Log in using anonymous account + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response Login(); + + //////////////////////////////////////////////////////////// + /// Log in using a username and a password + /// + /// \param UserName : User name + /// \param Password : Password + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response Login(const std::string& UserName, const std::string& Password); + + //////////////////////////////////////////////////////////// + /// Close the connection with FTP server + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response Disconnect(); + + //////////////////////////////////////////////////////////// + /// Send a null command just to prevent from being disconnected + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response KeepAlive(); + + //////////////////////////////////////////////////////////// + /// Get the current working directory + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + DirectoryResponse GetWorkingDirectory(); + + //////////////////////////////////////////////////////////// + /// Get the contents of the given directory + /// (subdirectories and files) + /// + /// \param Directory : Directory to list ("" by default, the current one) + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + ListingResponse GetDirectoryListing(const std::string& Directory = ""); + + //////////////////////////////////////////////////////////// + /// Change the current working directory + /// + /// \param Directory : New directory, relative to the current one + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response ChangeDirectory(const std::string& Directory); + + //////////////////////////////////////////////////////////// + /// Go to the parent directory of the current one + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response ParentDirectory(); + + //////////////////////////////////////////////////////////// + /// Create a new directory + /// + /// \param Name : Name of the directory to create + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response MakeDirectory(const std::string& Name); + + //////////////////////////////////////////////////////////// + /// Remove an existing directory + /// + /// \param Name : Name of the directory to remove + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response DeleteDirectory(const std::string& Name); + + //////////////////////////////////////////////////////////// + /// Rename a file + /// + /// \param File : File to rename + /// \param NewName : New name + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response RenameFile(const std::string& File, const std::string& NewName); + + //////////////////////////////////////////////////////////// + /// Remove an existing file + /// + /// \param Name : File to remove + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response DeleteFile(const std::string& Name); + + //////////////////////////////////////////////////////////// + /// Download a file from the server + /// + /// \param DistantFile : Path of the distant file to download + /// \param DestPath : Where to put to file on the local computer + /// \param Mode : Transfer mode (binary by default) + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode = Binary); + + //////////////////////////////////////////////////////////// + /// Upload a file to the server + /// + /// \param LocalFile : Path of the local file to upload + /// \param DestPath : Where to put to file on the server + /// \param Mode : Transfer mode (binary by default) + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode = Binary); + +private : + + //////////////////////////////////////////////////////////// + /// Send a command to the FTP server + /// + /// \param Command : Command to send + /// \param Parameter : Command parameter ("" by default) + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response SendCommand(const std::string& Command, const std::string& Parameter = ""); + + //////////////////////////////////////////////////////////// + /// Receive a response from the server + /// (usually after a command has been sent) + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response GetResponse(); + + //////////////////////////////////////////////////////////// + /// Utility class for exchanging datas with the server + /// on the data channel + //////////////////////////////////////////////////////////// + class DataChannel; + + friend class DataChannel; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketTCP myCommandSocket; ///< Socket holding the control connection with the server +}; + +} // namespace sf + + +#endif // SFML_FTP_HPP diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp new file mode 100644 index 00000000..ea48d125 --- /dev/null +++ b/include/SFML/Network/Http.hpp @@ -0,0 +1,340 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_HTTP_HPP +#define SFML_HTTP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// This class provides methods for manipulating the HTTP +/// protocol (described in RFC 1945). +/// It can connect to a website, get its files, send requests, etc. +//////////////////////////////////////////////////////////// +class SFML_API Http : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// This class wraps an HTTP request, which is basically : + /// - a header with a method, a target URI, and a set of field/value pairs + /// - an optional body (for POST requests) + //////////////////////////////////////////////////////////// + class SFML_API Request + { + public : + + //////////////////////////////////////////////////////////// + /// Enumerate the available HTTP methods for a request + //////////////////////////////////////////////////////////// + enum Method + { + Get, ///< Request in get mode, standard method to retrieve a page + Post, ///< Request in post mode, usually to send data to a page + Head ///< Request a page's header only + }; + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + /// \param RequestMethod : Method to use for the request (Get by default) + /// \param URI : Target URI ("/" by default -- index page) + /// \param Body : Content of the request's body (empty by default) + /// + //////////////////////////////////////////////////////////// + Request(Method RequestMethod = Get, const std::string& URI = "/", const std::string& Body = ""); + + //////////////////////////////////////////////////////////// + /// Set the value of a field; the field is added if it doesn't exist + /// + /// \param Field : Name of the field to set (case-insensitive) + /// \param Value : Value of the field + /// + //////////////////////////////////////////////////////////// + void SetField(const std::string& Field, const std::string& Value); + + //////////////////////////////////////////////////////////// + /// Set the request method. + /// This parameter is Http::Request::Get by default + /// + /// \param RequestMethod : Method to use for the request + /// + //////////////////////////////////////////////////////////// + void SetMethod(Method RequestMethod); + + //////////////////////////////////////////////////////////// + /// Set the target URI of the request. + /// This parameter is "/" by default + /// + /// \param URI : URI to request, local to the host + /// + //////////////////////////////////////////////////////////// + void SetURI(const std::string& URI); + + //////////////////////////////////////////////////////////// + /// Set the HTTP version of the request. + /// This parameter is 1.0 by default + /// + /// \param Major : Major version number + /// \param Minor : Minor version number + /// + //////////////////////////////////////////////////////////// + void SetHttpVersion(unsigned int Major, unsigned int Minor); + + //////////////////////////////////////////////////////////// + /// Set the body of the request. This parameter is optional and + /// makes sense only for POST requests. + /// This parameter is empty by default + /// + /// \param Body : Content of the request body + /// + //////////////////////////////////////////////////////////// + void SetBody(const std::string& Body); + + private : + + friend class Http; + + //////////////////////////////////////////////////////////// + /// Get the string representation of the request header + /// + /// \return String containing the request + /// + //////////////////////////////////////////////////////////// + std::string ToString() const; + + //////////////////////////////////////////////////////////// + /// Check if the given field has been defined + /// + /// \param Field : Name of the field to check (case-insensitive) + /// + /// \return True if the field exists + /// + //////////////////////////////////////////////////////////// + bool HasField(const std::string& Field) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map FieldTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FieldTable myFields; ///< Fields of the header + Method myMethod; ///< Method to use for the request + std::string myURI; ///< Target URI of the request + unsigned int myMajorVersion; ///< Major HTTP version + unsigned int myMinorVersion; ///< Minor HTTP version + std::string myBody; ///< Body of the request + }; + + //////////////////////////////////////////////////////////// + /// This class wraps an HTTP response, which is basically : + /// - a header with a status code and a set of field/value pairs + /// - a body (the content of the requested resource) + //////////////////////////////////////////////////////////// + class SFML_API Response + { + public : + + //////////////////////////////////////////////////////////// + /// Enumerate all the valid status codes returned in + /// a HTTP response + //////////////////////////////////////////////////////////// + enum Status + { + // 2xx: success + Ok = 200, ///< Most common code returned when operation was successful + Created = 201, ///< The resource has successfully been created + Accepted = 202, ///< The request has been accepted, but will be processed later by the server + NoContent = 204, ///< Sent when the server didn't send any data in return + + // 3xx: redirection + MultipleChoices = 300, ///< The requested page can be accessed from several locations + MovedPermanently = 301, ///< The requested page has permanently moved to a new location + MovedTemporarily = 302, ///< The requested page has temporarily moved to a new location + NotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed + + // 4xx: client error + BadRequest = 400, ///< The server couldn't understand the request (syntax error) + Unauthorized = 401, ///< The requested page needs an authentification to be accessed + Forbidden = 403, ///< The requested page cannot be accessed at all, even with authentification + NotFound = 404, ///< The requested page doesn't exist + + // 5xx: server error + InternalServerError = 500, ///< The server encountered an unexpected error + NotImplemented = 501, ///< The server doesn't implement a requested feature + BadGateway = 502, ///< The gateway server has received an error from the source server + ServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) + + // 10xx: SFML custom codes + InvalidResponse = 1000, ///< Response is not a valid HTTP one + ConnectionFailed = 1001 ///< Connection with server failed + }; + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Response(); + + //////////////////////////////////////////////////////////// + /// Get the value of a field + /// + /// \param Field : Name of the field to get (case-insensitive) + /// + /// \return Value of the field, or empty string if not found + /// + //////////////////////////////////////////////////////////// + const std::string& GetField(const std::string& Field) const; + + //////////////////////////////////////////////////////////// + /// Get the header's status code + /// + /// \return Header's status code + /// + //////////////////////////////////////////////////////////// + Status GetStatus() const; + + //////////////////////////////////////////////////////////// + /// Get the major HTTP version number of the response + /// + /// \return Major version number + /// + //////////////////////////////////////////////////////////// + unsigned int GetMajorHttpVersion() const; + + //////////////////////////////////////////////////////////// + /// Get the major HTTP version number of the response + /// + /// \return Major version number + /// + //////////////////////////////////////////////////////////// + unsigned int GetMinorHttpVersion() const; + + //////////////////////////////////////////////////////////// + /// Get the body of the response. The body can contain : + /// - the requested page (for GET requests) + /// - a response from the server (for POST requests) + /// - nothing (for HEAD requests) + /// - an error message (in case of an error) + /// + /// \return The response body + /// + //////////////////////////////////////////////////////////// + const std::string& GetBody() const; + + private : + + friend class Http; + + //////////////////////////////////////////////////////////// + /// Construct the header from a response string + /// + /// \param Data : Content of the response's header to parse + /// + //////////////////////////////////////////////////////////// + void FromString(const std::string& Data); + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map FieldTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FieldTable myFields; ///< Fields of the header + Status myStatus; ///< Status code + unsigned int myMajorVersion; ///< Major HTTP version + unsigned int myMinorVersion; ///< Minor HTTP version + std::string myBody; ///< Body of the response + }; + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Http(); + + //////////////////////////////////////////////////////////// + /// Construct the Http instance with the target host + /// + /// \param Host : Web server to connect to + /// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used) + /// + //////////////////////////////////////////////////////////// + Http(const std::string& Host, unsigned short Port = 0); + + //////////////////////////////////////////////////////////// + /// Set the target host + /// + /// \param Host : Web server to connect to + /// \param Port : Port to use for connection (0 by default -- use the standard port of the protocol used) + /// + //////////////////////////////////////////////////////////// + void SetHost(const std::string& Host, unsigned short Port = 0); + + //////////////////////////////////////////////////////////// + /// Send a HTTP request and return the server's response. + /// You must be connected to a host before sending requests. + /// Any missing mandatory header field will be added with an appropriate value. + /// Warning : this function waits for the server's response and may + /// not return instantly; use a thread if you don't want to block your + /// application. + /// + /// \param Req : Request to send + /// \param Timeout : Maximum time to wait, in seconds (0 by default, means no timeout) + /// + /// \return Server's response + /// + //////////////////////////////////////////////////////////// + Response SendRequest(const Request& Req, float Timeout = 0.f); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketTCP myConnection; ///< Connection to the host + IPAddress myHost; ///< Web host address + std::string myHostName; ///< Web host name + unsigned short myPort; ///< Port used for connection with host +}; + +} // namespace sf + + +#endif // SFML_HTTP_HPP diff --git a/include/SFML/Network/IPAddress.hpp b/include/SFML/Network/IPAddress.hpp new file mode 100644 index 00000000..1d05c7f1 --- /dev/null +++ b/include/SFML/Network/IPAddress.hpp @@ -0,0 +1,231 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IPADDRESS_HPP +#define SFML_IPADDRESS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// IPAddress provides easy manipulation of IP v4 addresses +//////////////////////////////////////////////////////////// +class SFML_API IPAddress +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor -- constructs an invalid address + /// + //////////////////////////////////////////////////////////// + IPAddress(); + + //////////////////////////////////////////////////////////// + /// Construct the address from a string + /// + /// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name + /// + //////////////////////////////////////////////////////////// + IPAddress(const std::string& Address); + + //////////////////////////////////////////////////////////// + /// Construct the address from a C-style string ; + /// Needed for implicit conversions from literal strings to IPAddress to work + /// + /// \param Address : IP address ("xxx.xxx.xxx.xxx") or network name + /// + //////////////////////////////////////////////////////////// + IPAddress(const char* Address); + + //////////////////////////////////////////////////////////// + /// Construct the address from 4 bytes + /// + /// \param Byte0 : First byte of the address + /// \param Byte1 : Second byte of the address + /// \param Byte2 : Third byte of the address + /// \param Byte3 : Fourth byte of the address + /// + //////////////////////////////////////////////////////////// + IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3); + + //////////////////////////////////////////////////////////// + /// Construct the address from a 32-bits integer + /// + /// \param Address : 4 bytes of the address packed into a 32-bits integer + /// + //////////////////////////////////////////////////////////// + IPAddress(Uint32 Address); + + //////////////////////////////////////////////////////////// + /// Tell if the address is a valid one + /// + /// \return True if address has a valid syntax + /// + //////////////////////////////////////////////////////////// + bool IsValid() const; + + //////////////////////////////////////////////////////////// + /// Get a string representation of the address + /// + /// \return String representation of the IP address ("xxx.xxx.xxx.xxx") + /// + //////////////////////////////////////////////////////////// + std::string ToString() const; + + //////////////////////////////////////////////////////////// + /// Get an integer representation of the address + /// + /// \return 32-bits integer containing the 4 bytes of the address, in system endianness + /// + //////////////////////////////////////////////////////////// + Uint32 ToInteger() const; + + //////////////////////////////////////////////////////////// + /// Get the computer's local IP address (from the LAN point of view) + /// + /// \return Local IP address + /// + //////////////////////////////////////////////////////////// + static IPAddress GetLocalAddress(); + + //////////////////////////////////////////////////////////// + /// Get the computer's public IP address (from the web point of view). + /// The only way to get a public address is to ask it to a + /// distant website ; as a consequence, this function may be + /// very slow -- use it as few as possible ! + /// + /// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) + /// + /// \return Public IP address + /// + //////////////////////////////////////////////////////////// + static IPAddress GetPublicAddress(float Timeout = 0.f); + + //////////////////////////////////////////////////////////// + /// Comparison operator == + /// + /// \param Other : Address to compare + /// + /// \return True if *this == Other + /// + //////////////////////////////////////////////////////////// + bool operator ==(const IPAddress& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator != + /// + /// \param Other : Address to compare + /// + /// \return True if *this != Other + /// + //////////////////////////////////////////////////////////// + bool operator !=(const IPAddress& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator < + /// + /// \param Other : Address to compare + /// + /// \return True if *this < Other + /// + //////////////////////////////////////////////////////////// + bool operator <(const IPAddress& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator > + /// + /// \param Other : Address to compare + /// + /// \return True if *this > Other + /// + //////////////////////////////////////////////////////////// + bool operator >(const IPAddress& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator <= + /// + /// \param Other : Address to compare + /// + /// \return True if *this <= Other + /// + //////////////////////////////////////////////////////////// + bool operator <=(const IPAddress& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator >= + /// + /// \param Other : Address to compare + /// + /// \return True if *this >= Other + /// + //////////////////////////////////////////////////////////// + bool operator >=(const IPAddress& Other) const; + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const IPAddress LocalHost; ///< Local host address (to connect to the same computer) + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Uint32 myAddress; ///< Address stored as an unsigned 32 bits integer +}; + +//////////////////////////////////////////////////////////// +/// Operator >> overload to extract an address from an input stream +/// +/// \param Stream : Input stream +/// \param Address : Address to extract +/// +/// \return Reference to the input stream +/// +//////////////////////////////////////////////////////////// +SFML_API std::istream& operator >>(std::istream& Stream, IPAddress& Address); + +//////////////////////////////////////////////////////////// +/// Operator << overload to print an address to an output stream +/// +/// \param Stream : Output stream +/// \param Address : Address to print +/// +/// \return Reference to the output stream +/// +//////////////////////////////////////////////////////////// +SFML_API std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address); + +} // namespace sf + + +#endif // SFML_IPADDRESS_HPP diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp new file mode 100644 index 00000000..3add17ff --- /dev/null +++ b/include/SFML/Network/Packet.hpp @@ -0,0 +1,187 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PACKET_HPP +#define SFML_PACKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Packet wraps data to send / to receive through the network +//////////////////////////////////////////////////////////// +class SFML_API Packet +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Packet(); + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Packet(); + + //////////////////////////////////////////////////////////// + /// Append data to the end of the packet + /// + /// \param Data : Pointer to the bytes to append + /// \param SizeInBytes : Number of bytes to append + /// + //////////////////////////////////////////////////////////// + void Append(const void* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// Clear the packet data + /// + //////////////////////////////////////////////////////////// + void Clear(); + + //////////////////////////////////////////////////////////// + /// Get a pointer to the data contained in the packet + /// Warning : the returned pointer may be invalid after you + /// append data to the packet + /// + /// \return Pointer to the data + /// + //////////////////////////////////////////////////////////// + const char* GetData() const; + + //////////////////////////////////////////////////////////// + /// Get the size of the data contained in the packet + /// + /// \return Data size, in bytes + /// + //////////////////////////////////////////////////////////// + std::size_t GetDataSize() const; + + //////////////////////////////////////////////////////////// + /// Tell if the reading position has reached the end of the packet + /// + /// \return True if all data have been read into the packet + /// + //////////////////////////////////////////////////////////// + bool EndOfPacket() const; + + //////////////////////////////////////////////////////////// + /// Return the validity of packet + /// + /// \return True if last data extraction from packet was successful + /// + //////////////////////////////////////////////////////////// + operator bool() const; + + //////////////////////////////////////////////////////////// + /// Operator >> overloads to extract data from the packet + /// + //////////////////////////////////////////////////////////// + Packet& operator >>(bool& Data); + Packet& operator >>(Int8& Data); + Packet& operator >>(Uint8& Data); + Packet& operator >>(Int16& Data); + Packet& operator >>(Uint16& Data); + Packet& operator >>(Int32& Data); + Packet& operator >>(Uint32& Data); + Packet& operator >>(float& Data); + Packet& operator >>(double& Data); + Packet& operator >>(char* Data); + Packet& operator >>(std::string& Data); + Packet& operator >>(wchar_t* Data); + Packet& operator >>(std::wstring& Data); + + //////////////////////////////////////////////////////////// + /// Operator << overloads to put data into the packet + /// + //////////////////////////////////////////////////////////// + Packet& operator <<(bool Data); + Packet& operator <<(Int8 Data); + Packet& operator <<(Uint8 Data); + Packet& operator <<(Int16 Data); + Packet& operator <<(Uint16 Data); + Packet& operator <<(Int32 Data); + Packet& operator <<(Uint32 Data); + Packet& operator <<(float Data); + Packet& operator <<(double Data); + Packet& operator <<(const char* Data); + Packet& operator <<(const std::string& Data); + Packet& operator <<(const wchar_t* Data); + Packet& operator <<(const std::wstring& Data); + +private : + + friend class SocketTCP; + friend class SocketUDP; + + //////////////////////////////////////////////////////////// + /// Check if the packet can extract a given size of bytes + /// + /// \param Size : Size to check + /// + /// \return True if Size bytes can be read from the packet's data + /// + //////////////////////////////////////////////////////////// + bool CheckSize(std::size_t Size); + + //////////////////////////////////////////////////////////// + /// Called before the packet is sent to the network + /// + /// \param DataSize : Variable to fill with the size of data to send + /// + /// \return Pointer to the array of bytes to send + /// + //////////////////////////////////////////////////////////// + virtual const char* OnSend(std::size_t& DataSize); + + //////////////////////////////////////////////////////////// + /// Called after the packet has been received from the network + /// + /// \param Data : Pointer to the array of received bytes + /// \param DataSize : Size of the array of bytes + /// + //////////////////////////////////////////////////////////// + virtual void OnReceive(const char* Data, std::size_t DataSize); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector myData; ///< Data stored in the packet + std::size_t myReadPos; ///< Current reading position in the packet + bool myIsValid; ///< Reading state of the packet +}; + +} // namespace sf + + +#endif // SFML_PACKET_HPP diff --git a/include/SFML/Network/Selector.hpp b/include/SFML/Network/Selector.hpp new file mode 100644 index 00000000..3ab7dfaa --- /dev/null +++ b/include/SFML/Network/Selector.hpp @@ -0,0 +1,116 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SELECTOR_HPP +#define SFML_SELECTOR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Selector allow reading from multiple sockets +/// without blocking. It's a kind of multiplexer +//////////////////////////////////////////////////////////// +template +class Selector : private SelectorBase +{ +public : + + //////////////////////////////////////////////////////////// + /// Add a socket to watch + /// + /// \param Socket : Socket to add + /// + //////////////////////////////////////////////////////////// + void Add(Type Socket); + + //////////////////////////////////////////////////////////// + /// Remove a socket + /// + /// \param Socket : Socket to remove + /// + //////////////////////////////////////////////////////////// + void Remove(Type Socket); + + //////////////////////////////////////////////////////////// + /// Remove all sockets + /// + //////////////////////////////////////////////////////////// + void Clear(); + + //////////////////////////////////////////////////////////// + /// Wait and collect sockets which are ready for reading. + /// This functions will return either when at least one socket + /// is ready, or when the given time is out + /// + /// \param Timeout : Timeout, in seconds (0 by default : no timeout) + /// + /// \return Number of sockets ready to be read + /// + //////////////////////////////////////////////////////////// + unsigned int Wait(float Timeout = 0.f); + + //////////////////////////////////////////////////////////// + /// After a call to Wait(), get the Index-th socket which is + /// ready for reading. The total number of sockets ready + /// is the integer returned by the previous call to Wait() + /// + /// \param Index : Index of the socket to get + /// + /// \return The Index-th socket + /// + //////////////////////////////////////////////////////////// + Type GetSocketReady(unsigned int Index); + +private : + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map SocketTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketTable mySockets; ///< Table matching the SFML socket instances with their low-level handles +}; + +#include + +// Let's define the two only valid types of Selector +typedef Selector SelectorUDP; +typedef Selector SelectorTCP; + +} // namespace sf + + +#endif // SFML_SELECTOR_HPP diff --git a/include/SFML/Network/Selector.inl b/include/SFML/Network/Selector.inl new file mode 100644 index 00000000..326c9946 --- /dev/null +++ b/include/SFML/Network/Selector.inl @@ -0,0 +1,97 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Add a socket to watch +//////////////////////////////////////////////////////////// +template +void Selector::Add(Type Socket) +{ + if (Socket.IsValid()) + { + SelectorBase::Add(Socket.mySocket); + mySockets[Socket.mySocket] = Socket; + } +} + + +//////////////////////////////////////////////////////////// +/// Remove a socket +//////////////////////////////////////////////////////////// +template +void Selector::Remove(Type Socket) +{ + typename SocketTable::iterator It = mySockets.find(Socket.mySocket); + if (It != mySockets.end()) + { + SelectorBase::Remove(Socket.mySocket); + mySockets.erase(It); + } +} + + +//////////////////////////////////////////////////////////// +/// Remove all sockets +//////////////////////////////////////////////////////////// +template +void Selector::Clear() +{ + SelectorBase::Clear(); + mySockets.clear(); +} + + +//////////////////////////////////////////////////////////// +/// Wait and collect sockets which are ready for reading. +/// This functions will return either when at least one socket +/// is ready, or when the given time is out +//////////////////////////////////////////////////////////// +template +unsigned int Selector::Wait(float Timeout) +{ + // No socket in the selector : return 0 + if (mySockets.empty()) + return 0; + + return SelectorBase::Wait(Timeout); +} + + +//////////////////////////////////////////////////////////// +/// After a call to Wait(), get the Index-th socket which is +/// ready for reading. The total number of sockets ready +/// is the integer returned by the previous call to Wait() +//////////////////////////////////////////////////////////// +template +Type Selector::GetSocketReady(unsigned int Index) +{ + SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index); + + typename SocketTable::const_iterator It = mySockets.find(Socket); + if (It != mySockets.end()) + return It->second; + else + return Type(Socket); +} diff --git a/include/SFML/Network/SelectorBase.hpp b/include/SFML/Network/SelectorBase.hpp new file mode 100644 index 00000000..433e7893 --- /dev/null +++ b/include/SFML/Network/SelectorBase.hpp @@ -0,0 +1,112 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SELECTORBASE_HPP +#define SFML_SELECTORBASE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Private base class for selectors. +/// As Selector is a template class, this base is needed so that +/// every system call get compiled in SFML (not inlined) +//////////////////////////////////////////////////////////// +class SFML_API SelectorBase +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SelectorBase(); + + //////////////////////////////////////////////////////////// + /// Add a socket to watch + /// + /// \param Socket : Socket to add + /// + //////////////////////////////////////////////////////////// + void Add(SocketHelper::SocketType Socket); + + //////////////////////////////////////////////////////////// + /// Remove a socket + /// + /// \param Socket : Socket to remove + /// + //////////////////////////////////////////////////////////// + void Remove(SocketHelper::SocketType Socket); + + //////////////////////////////////////////////////////////// + /// Remove all sockets + /// + //////////////////////////////////////////////////////////// + void Clear(); + + //////////////////////////////////////////////////////////// + /// Wait and collect sockets which are ready for reading. + /// This functions will return either when at least one socket + /// is ready, or when the given time is out + /// + /// \param Timeout : Timeout, in seconds (0 by default : no timeout) + /// + /// \return Number of sockets ready to be read + /// + //////////////////////////////////////////////////////////// + unsigned int Wait(float Timeout = 0.f); + + //////////////////////////////////////////////////////////// + /// After a call to Wait(), get the Index-th socket which is + /// ready for reading. The total number of sockets ready + /// is the integer returned by the previous call to Wait() + /// + /// \param Index : Index of the socket to get + /// + /// \return The Index-th socket + /// + //////////////////////////////////////////////////////////// + SocketHelper::SocketType GetSocketReady(unsigned int Index); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + fd_set mySet; ///< Set of socket to watch + fd_set mySetReady; ///< Set of socket which are ready for reading + int myMaxSocket; ///< Maximum socket index +}; + +} // namespace sf + + +#endif // SFML_SELECTORBASE_HPP diff --git a/include/SFML/Network/SocketHelper.hpp b/include/SFML/Network/SocketHelper.hpp new file mode 100644 index 00000000..36126dbb --- /dev/null +++ b/include/SFML/Network/SocketHelper.hpp @@ -0,0 +1,64 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETHELPER_HPP +#define SFML_SOCKETHELPER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +namespace Socket +{ + //////////////////////////////////////////////////////////// + /// Enumeration of status returned by socket functions + //////////////////////////////////////////////////////////// + enum Status + { + Done, ///< The socket has sent / received the data + NotReady, ///< The socket is not ready to send / receive data yet + Disconnected, ///< The TCP socket has been disconnected + Error ///< An unexpected error happened + }; +} + +} // namespace sf + + +#ifdef SFML_SYSTEM_WINDOWS + + #include + +#else + + #include + +#endif + + +#endif // SFML_SOCKETHELPER_HPP diff --git a/include/SFML/Network/SocketTCP.hpp b/include/SFML/Network/SocketTCP.hpp new file mode 100644 index 00000000..452b3045 --- /dev/null +++ b/include/SFML/Network/SocketTCP.hpp @@ -0,0 +1,225 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETTCP_HPP +#define SFML_SOCKETTCP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Packet; +class IPAddress; +template class Selector; + +//////////////////////////////////////////////////////////// +/// SocketTCP wraps a socket using TCP protocol to +/// send data safely (but a bit slower) +//////////////////////////////////////////////////////////// +class SFML_API SocketTCP +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SocketTCP(); + + //////////////////////////////////////////////////////////// + /// Change the blocking state of the socket. + /// The default behaviour of a socket is blocking + /// + /// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking + /// + //////////////////////////////////////////////////////////// + void SetBlocking(bool Blocking); + + //////////////////////////////////////////////////////////// + /// Connect to another computer on a specified port + /// + /// \param Port : Port to use for transfers (warning : ports < 1024 are reserved) + /// \param HostAddress : IP Address of the host to connect to + /// \param Timeout : Maximum time to wait, in seconds (0 by default : no timeout) (this parameter is ignored for non-blocking sockets) + /// + /// \return True if operation has been successful + /// + //////////////////////////////////////////////////////////// + Socket::Status Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout = 0.f); + + //////////////////////////////////////////////////////////// + /// Listen to a specified port for incoming data or connections + /// + /// \param Port : Port to listen to + /// + /// \return True if operation has been successful + /// + //////////////////////////////////////////////////////////// + bool Listen(unsigned short Port); + + //////////////////////////////////////////////////////////// + /// Wait for a connection (must be listening to a port). + /// This function will block if the socket is blocking + /// + /// \param Connected : Socket containing the connection with the connected client + /// \param Address : Pointer to an address to fill with client infos (NULL by default) + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Accept(SocketTCP& Connected, IPAddress* Address = NULL); + + //////////////////////////////////////////////////////////// + /// Send an array of bytes to the host (must be connected first) + /// + /// \param Data : Pointer to the bytes to send + /// \param Size : Number of bytes to send + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Send(const char* Data, std::size_t Size); + + //////////////////////////////////////////////////////////// + /// Receive an array of bytes from the host (must be connected first). + /// This function will block if the socket is blocking + /// + /// \param Data : Pointer to a byte array to fill (make sure it is big enough) + /// \param MaxSize : Maximum number of bytes to read + /// \param SizeReceived : Number of bytes received + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived); + + //////////////////////////////////////////////////////////// + /// Send a packet of data to the host (must be connected first) + /// + /// \param PacketToSend : Packet to send + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Send(Packet& PacketToSend); + + //////////////////////////////////////////////////////////// + /// Receive a packet from the host (must be connected first). + /// This function will block if the socket is blocking + /// + /// \param PacketToReceive : Packet to fill with received data + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Receive(Packet& PacketToReceive); + + //////////////////////////////////////////////////////////// + /// Close the socket + /// + /// \return True if operation has been successful + /// + //////////////////////////////////////////////////////////// + bool Close(); + + //////////////////////////////////////////////////////////// + /// Check if the socket is in a valid state ; this function + /// can be called any time to check if the socket is OK + /// + /// \return True if the socket is valid + /// + //////////////////////////////////////////////////////////// + bool IsValid() const; + + //////////////////////////////////////////////////////////// + /// Comparison operator == + /// + /// \param Other : Socket to compare + /// + /// \return True if *this == Other + /// + //////////////////////////////////////////////////////////// + bool operator ==(const SocketTCP& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator != + /// + /// \param Other : Socket to compare + /// + /// \return True if *this != Other + /// + //////////////////////////////////////////////////////////// + bool operator !=(const SocketTCP& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator <. + /// Provided for compatibility with standard containers, as + /// comparing two sockets doesn't make much sense... + /// + /// \param Other : Socket to compare + /// + /// \return True if *this < Other + /// + //////////////////////////////////////////////////////////// + bool operator <(const SocketTCP& Other) const; + +private : + + friend class Selector; + + //////////////////////////////////////////////////////////// + /// Construct the socket from a socket descriptor + /// (for internal use only) + /// + /// \param Descriptor : Socket descriptor + /// + //////////////////////////////////////////////////////////// + SocketTCP(SocketHelper::SocketType Descriptor); + + //////////////////////////////////////////////////////////// + /// Create the socket + /// + /// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket) + /// + //////////////////////////////////////////////////////////// + void Create(SocketHelper::SocketType Descriptor = 0); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketHelper::SocketType mySocket; ///< Socket descriptor + std::vector myPendingPacket; ///< Data of the current pending packet, if any (in non-blocking mode) + Int32 myPendingPacketSize; ///< Size of the current pending packet, if any (in non-blocking mode) + bool myIsBlocking; ///< Is the socket blocking or non-blocking ? +}; + +} // namespace sf + + +#endif // SFML_SOCKETTCP_HPP diff --git a/include/SFML/Network/SocketUDP.hpp b/include/SFML/Network/SocketUDP.hpp new file mode 100644 index 00000000..a5febaf8 --- /dev/null +++ b/include/SFML/Network/SocketUDP.hpp @@ -0,0 +1,226 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETUDP_HPP +#define SFML_SOCKETUDP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Packet; +class IPAddress; +template class Selector; + +//////////////////////////////////////////////////////////// +/// SocketUDP wraps a socket using UDP protocol to +/// send data fastly (but with less safety) +//////////////////////////////////////////////////////////// +class SFML_API SocketUDP +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SocketUDP(); + + //////////////////////////////////////////////////////////// + /// Change the blocking state of the socket. + /// The default behaviour of a socket is blocking + /// + /// \param Blocking : Pass true to set the socket as blocking, or false for non-blocking + /// + //////////////////////////////////////////////////////////// + void SetBlocking(bool Blocking); + + //////////////////////////////////////////////////////////// + /// Bind the socket to a specific port + /// + /// \param Port : Port to bind the socket to + /// + /// \return True if operation has been successful + /// + //////////////////////////////////////////////////////////// + bool Bind(unsigned short Port); + + //////////////////////////////////////////////////////////// + /// Unbind the socket from its previous port, if any + /// + /// \return True if operation has been successful + /// + //////////////////////////////////////////////////////////// + bool Unbind(); + + //////////////////////////////////////////////////////////// + /// Send an array of bytes + /// + /// \param Data : Pointer to the bytes to send + /// \param Size : Number of bytes to send + /// \param Address : Address of the computer to send the packet to + /// \param Port : Port to send the data to + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port); + + //////////////////////////////////////////////////////////// + /// Receive an array of bytes. + /// This function will block if the socket is blocking + /// + /// \param Data : Pointer to a byte array to fill (make sure it is big enough) + /// \param MaxSize : Maximum number of bytes to read + /// \param SizeReceived : Number of bytes received + /// \param Address : Address of the computer which sent the data + /// \param Port : Port on which the remote computer sent the data + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port); + + //////////////////////////////////////////////////////////// + /// Send a packet of data + /// + /// \param PacketToSend : Packet to send + /// \param Address : Address of the computer to send the packet to + /// \param Port : Port to send the data to + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port); + + //////////////////////////////////////////////////////////// + /// Receive a packet. + /// This function will block if the socket is blocking + /// + /// \param PacketToReceive : Packet to fill with received data + /// \param Address : Address of the computer which sent the packet + /// \param Port : Port on which the remote computer sent the data + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Socket::Status Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port); + + //////////////////////////////////////////////////////////// + /// Close the socket + /// + /// \return True if operation has been successful + /// + //////////////////////////////////////////////////////////// + bool Close(); + + //////////////////////////////////////////////////////////// + /// Check if the socket is in a valid state ; this function + /// can be called any time to check if the socket is OK + /// + /// \return True if the socket is valid + /// + //////////////////////////////////////////////////////////// + bool IsValid() const; + + //////////////////////////////////////////////////////////// + /// Get the port the socket is currently bound to + /// + /// \return Current port (0 means the socket is not bound) + /// + //////////////////////////////////////////////////////////// + unsigned short GetPort() const; + + //////////////////////////////////////////////////////////// + /// Comparison operator == + /// + /// \param Other : Socket to compare + /// + /// \return True if *this == Other + /// + //////////////////////////////////////////////////////////// + bool operator ==(const SocketUDP& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator != + /// + /// \param Other : Socket to compare + /// + /// \return True if *this != Other + /// + //////////////////////////////////////////////////////////// + bool operator !=(const SocketUDP& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator <. + /// Provided for compatibility with standard containers, as + /// comparing two sockets doesn't make much sense... + /// + /// \param Other : Socket to compare + /// + /// \return True if *this < Other + /// + //////////////////////////////////////////////////////////// + bool operator <(const SocketUDP& Other) const; + +private : + + friend class Selector; + + //////////////////////////////////////////////////////////// + /// Construct the socket from a socket descriptor + /// (for internal use only) + /// + /// \param Descriptor : Socket descriptor + /// + //////////////////////////////////////////////////////////// + SocketUDP(SocketHelper::SocketType Descriptor); + + //////////////////////////////////////////////////////////// + /// Create the socket + /// + /// \param Descriptor : System socket descriptor to use (0 by default -- create a new socket) + /// + //////////////////////////////////////////////////////////// + void Create(SocketHelper::SocketType Descriptor = 0); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketHelper::SocketType mySocket; ///< Socket identifier + unsigned short myPort; ///< Port to which the socket is bound + std::vector myPendingPacket; ///< Data of the current pending packet, if any (in non-blocking mode) + Int32 myPendingPacketSize; ///< Size of the current pending packet, if any (in non-blocking mode) + bool myIsBlocking; ///< Is the socket blocking or non-blocking ? +}; + +} // namespace sf + + +#endif // SFML_SOCKETUDP_HPP diff --git a/include/SFML/Network/Sockets.hpp b/include/SFML/Network/Sockets.hpp new file mode 100644 index 00000000..b611e852 --- /dev/null +++ b/include/SFML/Network/Sockets.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETS_HPP +#define SFML_SOCKETS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +#ifdef SFML_SYSTEM_WINDOWS + + #include + +#else + + #include + +#endif + + +#endif // SFML_SOCKETS_HPP diff --git a/include/SFML/Network/Unix/SocketHelper.hpp b/include/SFML/Network/Unix/SocketHelper.hpp new file mode 100644 index 00000000..1068cd85 --- /dev/null +++ b/include/SFML/Network/Unix/SocketHelper.hpp @@ -0,0 +1,96 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETHELPERUNIX_HPP +#define SFML_SOCKETHELPERUNIX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// This class defines helper functions to do all the +/// non-portable socket stuff. This class is meant for internal +/// use only +//////////////////////////////////////////////////////////// +class SFML_API SocketHelper +{ +public : + + //////////////////////////////////////////////////////////// + // Define some socket types + //////////////////////////////////////////////////////////// + typedef int SocketType; + typedef socklen_t LengthType; + + //////////////////////////////////////////////////////////// + /// Return the value of the invalid socket + /// + /// \return Unique value of the invalid socket + /// + //////////////////////////////////////////////////////////// + static SocketType InvalidSocket(); + + //////////////////////////////////////////////////////////// + /// Close / destroy a socket + /// + /// \param Socket : Socket to close + /// + /// \return True on success + /// + //////////////////////////////////////////////////////////// + static bool Close(SocketType Socket); + + //////////////////////////////////////////////////////////// + /// Set a socket as blocking or non-blocking + /// + /// \param Socket : Socket to modify + /// \param Block : New blocking state of the socket + /// + //////////////////////////////////////////////////////////// + static void SetBlocking(SocketType Socket, bool Block); + + //////////////////////////////////////////////////////////// + /// Get the last socket error status + /// + /// \return Status corresponding to the last socket error + /// + //////////////////////////////////////////////////////////// + static Socket::Status GetErrorStatus(); +}; + +} // namespace sf + + +#endif // SFML_SOCKETHELPERUNIX_HPP diff --git a/include/SFML/Network/Win32/SocketHelper.hpp b/include/SFML/Network/Win32/SocketHelper.hpp new file mode 100644 index 00000000..d7851b46 --- /dev/null +++ b/include/SFML/Network/Win32/SocketHelper.hpp @@ -0,0 +1,90 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETHELPERWIN32_HPP +#define SFML_SOCKETHELPERWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// This class defines helper functions to do all the +/// non-portable socket stuff. This class is meant for internal +/// use only +//////////////////////////////////////////////////////////// +class SFML_API SocketHelper +{ +public : + + //////////////////////////////////////////////////////////// + // Define some socket types + //////////////////////////////////////////////////////////// + typedef SOCKET SocketType; + typedef int LengthType; + + //////////////////////////////////////////////////////////// + /// Return the value of the invalid socket + /// + /// \return Unique value of the invalid socket + /// + //////////////////////////////////////////////////////////// + static SocketType InvalidSocket(); + + //////////////////////////////////////////////////////////// + /// Close / destroy a socket + /// + /// \param Socket : Socket to close + /// + /// \return True on success + /// + //////////////////////////////////////////////////////////// + static bool Close(SocketType Socket); + + //////////////////////////////////////////////////////////// + /// Set a socket as blocking or non-blocking + /// + /// \param Socket : Socket to modify + /// \param Block : New blocking state of the socket + /// + //////////////////////////////////////////////////////////// + static void SetBlocking(SocketType Socket, bool Block); + + //////////////////////////////////////////////////////////// + /// Get the last socket error status + /// + /// \return Status corresponding to the last socket error + /// + //////////////////////////////////////////////////////////// + static Socket::Status GetErrorStatus(); +}; + +} // namespace sf + + +#endif // SFML_SOCKETHELPERWIN32_HPP diff --git a/include/SFML/System.hpp b/include/SFML/System.hpp new file mode 100644 index 00000000..63502102 --- /dev/null +++ b/include/SFML/System.hpp @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_HPP +#define SFML_SYSTEM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // SFML_SYSTEM_HPP diff --git a/include/SFML/System/Clock.hpp b/include/SFML/System/Clock.hpp new file mode 100644 index 00000000..4b3cf9af --- /dev/null +++ b/include/SFML/System/Clock.hpp @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CLOCK_HPP +#define SFML_CLOCK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Clock is an utility class for manipulating time +//////////////////////////////////////////////////////////// +class SFML_API Clock +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Clock(); + + //////////////////////////////////////////////////////////// + /// Get the time elapsed since last reset + /// + /// \return Time elapsed, in seconds + /// + //////////////////////////////////////////////////////////// + float GetElapsedTime() const; + + //////////////////////////////////////////////////////////// + /// Restart the timer + /// + //////////////////////////////////////////////////////////// + void Reset(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + double myStartTime; ///< Time of last reset +}; + +} // namespace sf + + +#endif // SFML_CLOCK_HPP diff --git a/include/SFML/System/Lock.hpp b/include/SFML/System/Lock.hpp new file mode 100644 index 00000000..f1176fa6 --- /dev/null +++ b/include/SFML/System/Lock.hpp @@ -0,0 +1,71 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LOCK_HPP +#define SFML_LOCK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +class Mutex; + +//////////////////////////////////////////////////////////// +/// Lock is an exception-safe automatic wrapper for +/// locking and unlocking mutexes +//////////////////////////////////////////////////////////// +class SFML_API Lock : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the lock with a target mutex (lock it) + /// + /// @param Mutex : Mutex to lock + /// + //////////////////////////////////////////////////////////// + Lock(Mutex& Mutex); + + //////////////////////////////////////////////////////////// + /// Destructor (unlocks the mutex) + /// + //////////////////////////////////////////////////////////// + ~Lock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Mutex& myMutex; ///< Mutex to lock / unlock +}; + +} // namespace sf + + +#endif // SFML_LOCK_HPP diff --git a/include/SFML/System/Mutex.hpp b/include/SFML/System/Mutex.hpp new file mode 100644 index 00000000..7e096ae9 --- /dev/null +++ b/include/SFML/System/Mutex.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUTEX_HPP +#define SFML_MUTEX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +#ifdef SFML_SYSTEM_WINDOWS + + #include + +#else + + #include + +#endif + + +#endif // SFML_MUTEX_HPP diff --git a/include/SFML/System/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp new file mode 100644 index 00000000..338653db --- /dev/null +++ b/include/SFML/System/NonCopyable.hpp @@ -0,0 +1,70 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NONCOPYABLE_HPP +#define SFML_NONCOPYABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Utility base class to easily declare non-copyable classes. +/// Just inherit from NonCopyable to get a non-copyable class +//////////////////////////////////////////////////////////// +struct SFML_API NonCopyable +{ +protected : + + //////////////////////////////////////////////////////////// + /// The default constructor won't be generated, so provide it + /// + //////////////////////////////////////////////////////////// + NonCopyable() {} + +private : + + //////////////////////////////////////////////////////////// + /// Copy constructor : declare it private and don't implement + /// it to prevent from calling it + /// + //////////////////////////////////////////////////////////// + NonCopyable(const NonCopyable&); + + //////////////////////////////////////////////////////////// + /// Assignment operator : declare it private and don't implement + /// it to prevent from calling it + /// + //////////////////////////////////////////////////////////// + NonCopyable& operator =(const NonCopyable&); +}; + +} // namespace sf + + +#endif // SFML_NONCOPYABLE_HPP diff --git a/include/SFML/System/Randomizer.hpp b/include/SFML/System/Randomizer.hpp new file mode 100644 index 00000000..dd453c1a --- /dev/null +++ b/include/SFML/System/Randomizer.hpp @@ -0,0 +1,94 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RANDOMIZER_HPP +#define SFML_RANDOMIZER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Randomizer is an utility class for generating pseudo-random +/// numbers +//////////////////////////////////////////////////////////// +class SFML_API Randomizer +{ +public : + + //////////////////////////////////////////////////////////// + /// Set the seed for the generator. Using a known seed + /// allows you to reproduce the same sequence of random number + /// + /// \param Seed : Number to use as the seed + /// + //////////////////////////////////////////////////////////// + static void SetSeed(unsigned int Seed); + + //////////////////////////////////////////////////////////// + /// Get the seed used to generate random numbers the generator. + /// + /// \return Current seed + /// + //////////////////////////////////////////////////////////// + static unsigned int GetSeed(); + + //////////////////////////////////////////////////////////// + /// Get a random float number in a given range + /// + /// \return Start : Start of the range + /// \return End : End of the range + /// + /// \return Random number in [Begin, End] + /// + //////////////////////////////////////////////////////////// + static float Random(float Begin, float End); + + //////////////////////////////////////////////////////////// + /// Get a random integer number in a given range + /// + /// \return Start : Start of the range + /// \return End : End of the range + /// + /// \return Random number in [Begin, End] + /// + //////////////////////////////////////////////////////////// + static int Random(int Begin, int End); + +private : + + //////////////////////////////////////////////////////////// + // Static member variables + //////////////////////////////////////////////////////////// + static unsigned int ourSeed; +}; + +} // namespace sf + + +#endif // SFML_RANDOMIZER_HPP diff --git a/include/SFML/System/Resource.hpp b/include/SFML/System/Resource.hpp new file mode 100644 index 00000000..8f5088dc --- /dev/null +++ b/include/SFML/System/Resource.hpp @@ -0,0 +1,216 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RESOURCE_HPP +#define SFML_RESOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// These two classes are defined in the same header because +// they depend on each other. And as they're template classes, +// they must be entirely defined in header files, which +// prevents from proper separate compiling +//////////////////////////////////////////////////////////// + +template class ResourcePtr; + +//////////////////////////////////////////////////////////// +/// Base class for every resource that needs to notify +/// dependent classes about its destruction +//////////////////////////////////////////////////////////// +template +class Resource +{ +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Resource(); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + /// \param Copy : Resource to copy + /// + //////////////////////////////////////////////////////////// + Resource(const Resource& Copy); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~Resource(); + + //////////////////////////////////////////////////////////// + /// Assignment operator + /// + /// \param Other : Resource to copy + /// + /// \return Reference to this + /// + //////////////////////////////////////////////////////////// + Resource& operator =(const Resource& Other); + +private : + + friend class ResourcePtr; + + //////////////////////////////////////////////////////////// + /// Connect a ResourcePtr to this resource + /// + /// \param Observer : Observer to add + /// + //////////////////////////////////////////////////////////// + void Connect(ResourcePtr& Observer) const; + + //////////////////////////////////////////////////////////// + /// Disconnect a ResourcePtr from this resource + /// + /// \param Observer : Observer to remove + /// + //////////////////////////////////////////////////////////// + void Disconnect(ResourcePtr& Observer) const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + mutable std::set*> myObservers; +}; + + +//////////////////////////////////////////////////////////// +/// Safe pointer to a T resource (inheriting from sf::Resource), +/// its pointer is automatically reseted when the resource is destroyed +//////////////////////////////////////////////////////////// +template +class ResourcePtr +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + ResourcePtr(); + + //////////////////////////////////////////////////////////// + /// Construct from a raw resource + /// + /// \param Resource : Internal resource + /// + //////////////////////////////////////////////////////////// + ResourcePtr(const T* Resource); + + //////////////////////////////////////////////////////////// + /// Copy constructor + /// + /// \param Copy : Instance to copy + /// + //////////////////////////////////////////////////////////// + ResourcePtr(const ResourcePtr& Copy); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~ResourcePtr(); + + //////////////////////////////////////////////////////////// + /// Assignment operator from another ResourcePtr + /// + /// \param Other : Resource pointer to assign + /// + /// \return Reference to this + /// + //////////////////////////////////////////////////////////// + ResourcePtr& operator =(const ResourcePtr& Other); + + //////////////////////////////////////////////////////////// + /// Assignment operator from a raw resource + /// + /// \param Resource : Resource to assign + /// + /// \return Reference to this + /// + //////////////////////////////////////////////////////////// + ResourcePtr& operator =(const T* Resource); + + //////////////////////////////////////////////////////////// + /// Cast operator to implicitely convert the resource pointer to + /// its raw pointer type. + /// This might be dangerous in the general case, but in this context + /// it is safe enough to define this operator + /// + /// \return Pointer to the actual resource + /// + //////////////////////////////////////////////////////////// + operator const T*() const; + + //////////////////////////////////////////////////////////// + /// Operator * overload to return a reference to the actual resource + /// + /// \return Reference to the internal resource + /// + //////////////////////////////////////////////////////////// + const T& operator *() const; + + //////////////////////////////////////////////////////////// + /// Operator -> overload to return a pointer to the actual resource + /// + /// \return Pointer to the internal resource + /// + //////////////////////////////////////////////////////////// + const T* operator ->() const; + + //////////////////////////////////////////////////////////// + /// Function called when the observed resource is about to be + /// destroyed + /// + //////////////////////////////////////////////////////////// + void OnResourceDestroyed(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + const T* myResource; /// Pointer to the actual resource +}; + +#include +#include + +} // namespace sf + + +#endif // SFML_RESOURCE_HPP diff --git a/include/SFML/System/Resource.inl b/include/SFML/System/Resource.inl new file mode 100644 index 00000000..c4276a19 --- /dev/null +++ b/include/SFML/System/Resource.inl @@ -0,0 +1,88 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +template +Resource::Resource() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +template +Resource::Resource(const Resource&) +{ + // Nothing to do, we don't want to copy observers +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +template +Resource::~Resource() +{ + // Notify all observers + for (typename std::set*>::iterator i = myObservers.begin(); i != myObservers.end(); ++i) + { + (*i)->OnResourceDestroyed(); + } +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator +//////////////////////////////////////////////////////////// +template +Resource& Resource::operator =(const Resource&) +{ + // Nothing to do, we don't want to copy observers + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Connect a ResourcePtr to this resource +//////////////////////////////////////////////////////////// +template +void Resource::Connect(ResourcePtr& Observer) const +{ + myObservers.insert(&Observer); +} + + +//////////////////////////////////////////////////////////// +/// Disconnect a ResourcePtr from this resource +//////////////////////////////////////////////////////////// +template +void Resource::Disconnect(ResourcePtr& Observer) const +{ + myObservers.erase(&Observer); +} diff --git a/include/SFML/System/ResourcePtr.inl b/include/SFML/System/ResourcePtr.inl new file mode 100644 index 00000000..dbfcd0d7 --- /dev/null +++ b/include/SFML/System/ResourcePtr.inl @@ -0,0 +1,149 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +template +ResourcePtr::ResourcePtr() : +myResource(NULL) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct from a raw resource +//////////////////////////////////////////////////////////// +template +ResourcePtr::ResourcePtr(const T* Resource) : +myResource(Resource) +{ + if (myResource) + myResource->Connect(*this); +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +template +ResourcePtr::ResourcePtr(const ResourcePtr& Copy) : +myResource(Copy.myResource) +{ + if (myResource) + myResource->Connect(*this); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +template +ResourcePtr::~ResourcePtr() +{ + if (myResource) + myResource->Disconnect(*this); +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator from another ResourcePtr +//////////////////////////////////////////////////////////// +template +ResourcePtr& ResourcePtr::operator =(const ResourcePtr& Other) +{ + if (myResource) + myResource->Disconnect(*this); + + myResource = Other.myResource; + + if (myResource) + myResource->Connect(*this); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator from a raw resource +//////////////////////////////////////////////////////////// +template +ResourcePtr& ResourcePtr::operator =(const T* Resource) +{ + if (myResource) + myResource->Disconnect(*this); + + myResource = Resource; + + if (myResource) + myResource->Connect(*this); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Cast operator to implicitely convert the resource pointer to +/// its raw pointer type. +/// This might be dangerous in the general case, but in this context +/// it is safe enough to define this operator +//////////////////////////////////////////////////////////// +template +ResourcePtr::operator const T*() const +{ + return myResource; +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload to return a reference to the actual resource +//////////////////////////////////////////////////////////// +template +const T& ResourcePtr::operator *() const +{ + return *myResource; +} + + +//////////////////////////////////////////////////////////// +/// Operator -> overload to return a pointer to the actual resource +//////////////////////////////////////////////////////////// +template +const T* ResourcePtr::operator ->() const +{ + return myResource; +} + + +//////////////////////////////////////////////////////////// +/// Function called when the observed resource is about to be +/// destroyed +//////////////////////////////////////////////////////////// +template +void ResourcePtr::OnResourceDestroyed() +{ + myResource = NULL; +} diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp new file mode 100644 index 00000000..8cc23f52 --- /dev/null +++ b/include/SFML/System/Sleep.hpp @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SLEEP_HPP +#define SFML_SLEEP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ + //////////////////////////////////////////////////////////// + /// Make the current thread sleep for a given time + /// + /// \param Duration : Time to sleep, in seconds + /// + //////////////////////////////////////////////////////////// + void SFML_API Sleep(float Duration); + +} // namespace sf + + +#endif // SFML_SLEEP_HPP diff --git a/include/SFML/System/Thread.hpp b/include/SFML/System/Thread.hpp new file mode 100644 index 00000000..016dab7c --- /dev/null +++ b/include/SFML/System/Thread.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREAD_HPP +#define SFML_THREAD_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +#ifdef SFML_SYSTEM_WINDOWS + + #include + +#else + + #include + +#endif + + +#endif // SFML_THREAD_HPP diff --git a/include/SFML/System/Unicode.hpp b/include/SFML/System/Unicode.hpp new file mode 100644 index 00000000..6463ed8d --- /dev/null +++ b/include/SFML/System/Unicode.hpp @@ -0,0 +1,290 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_UNICODE_HPP +#define SFML_UNICODE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Provides utility functions to convert from and to +/// any unicode and ASCII encoding +//////////////////////////////////////////////////////////// +class SFML_API Unicode +{ +public : + + //////////////////////////////////////////////////////////// + /// Define a string type for each encoding + /// Warning : in UTF8 and UTF16 strings, one element doesn't + /// necessarily maps to one character ; only an UTF32 element + /// is wide enough to hold all possible unicode values + //////////////////////////////////////////////////////////// + typedef std::basic_string UTF8String; + typedef std::basic_string UTF16String; + typedef std::basic_string UTF32String; + + //////////////////////////////////////////////////////////// + /// This class is an abstract definition of a unicode text, + /// it can be converted from and to any kind of string + /// and encoding + //////////////////////////////////////////////////////////// + class SFML_API Text + { + public : + + //////////////////////////////////////////////////////////// + /// Default constructor (empty text) + /// + //////////////////////////////////////////////////////////// + Text(); + + //////////////////////////////////////////////////////////// + /// Construct the unicode text from any type of string + /// + /// \param Str : String to convert + /// + //////////////////////////////////////////////////////////// + Text(const char* Str); + Text(const wchar_t* Str); + Text(const Uint8* Str); + Text(const Uint16* Str); + Text(const Uint32* Str); + Text(const std::string& Str); + Text(const std::wstring& Str); + Text(const Unicode::UTF8String& Str); + Text(const Unicode::UTF16String& Str); + Text(const Unicode::UTF32String& Str); + + //////////////////////////////////////////////////////////// + /// Operator to cast the text to any type of string + /// + /// \return Converted string + /// + //////////////////////////////////////////////////////////// + operator std::string () const; + operator std::wstring () const; + operator Unicode::UTF8String () const; + operator Unicode::UTF16String () const; + operator const Unicode::UTF32String&() const; + + private : + + //////////////////////////////////////////////////////////// + // Data member + //////////////////////////////////////////////////////////// + sf::Unicode::UTF32String myUTF32String; ///< UTF-32 unicode text + }; + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-32 characters range + /// to an ANSI characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// \param Locale : Locale to use for conversion (uses the current one by default) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF32ToANSI(In Begin, In End, Out Output, char Replacement = '?', const std::locale& Locale = GetDefaultLocale()); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an ANSI characters range + /// to an UTF-32 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Locale : Locale to use for conversion (uses the current one by default) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale = GetDefaultLocale()); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-8 characters range + /// to an UTF-16 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?'); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-8 characters range + /// to an UTF-32 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?'); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-16 characters range + /// to an UTF-8 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?'); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-16 characters range + /// to an UTF-32 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement = '?'); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-32 characters range + /// to an UTF-8 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement = '?'); + + //////////////////////////////////////////////////////////// + /// Generic function to convert an UTF-32 characters range + /// to an UTF-16 characters range, using the given locale + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// \param Output : Iterator pointing to the beginning of the output sequence + /// \param Replacement : Replacement character for characters not convertible to output encoding ('?' by default -- use 0 to use no replacement character) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement = '?'); + + //////////////////////////////////////////////////////////// + /// Get the number of characters composing an UTF-8 string + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// + /// \return Count of the characters in the string + /// + //////////////////////////////////////////////////////////// + template + static std::size_t GetUTF8Length(In Begin, In End); + + //////////////////////////////////////////////////////////// + /// Get the number of characters composing an UTF-16 string + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// + /// \return Count of the characters in the string + /// + //////////////////////////////////////////////////////////// + template + static std::size_t GetUTF16Length(In Begin, In End); + + //////////////////////////////////////////////////////////// + /// Get the number of characters composing an UTF-32 string + /// + /// \param Begin : Iterator pointing to the beginning of the input sequence + /// \param End : Iterator pointing to the end of the input sequence + /// + /// \return Count of the characters in the string + /// + //////////////////////////////////////////////////////////// + template + static std::size_t GetUTF32Length(In Begin, In End); + +private : + + //////////////////////////////////////////////////////////// + /// Get the default system locale + /// + /// \return Reference to the default system locale + /// + //////////////////////////////////////////////////////////// + static const std::locale& GetDefaultLocale(); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const char UTF8TrailingBytes[256]; ///< Lookup table to find the length of an UTF-8 sequence + static const Uint32 UTF8Offsets[6]; ///< Magic values to subtract during UTF-8 conversions + static const Uint8 UTF8FirstBytes[7]; ///< First bytes for UTF-8 sequences +}; + +#include + +} // namespace sf + + +#endif // SFML_UNICODE_HPP diff --git a/include/SFML/System/Unicode.inl b/include/SFML/System/Unicode.inl new file mode 100644 index 00000000..2dbb3a25 --- /dev/null +++ b/include/SFML/System/Unicode.inl @@ -0,0 +1,474 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-32 characters range +/// to an ANSI characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, char Replacement, const std::locale& Locale) +{ + #ifdef __MINGW32__ + + // MinGW has a almost no support for unicode stuff + // As a consequence, the MinGW version of this function can only use the default locale + // and ignores the one passed as parameter + while (Begin < End) + { + char Char = 0; + if (wctomb(&Char, static_cast(*Begin++)) >= 0) + *Output++ = Char; + else if (Replacement) + *Output++ = Replacement; + } + + #else + + // Get the facet of the locale which deals with character conversion + const std::ctype& Facet = std::use_facet< std::ctype >(Locale); + + // Use the facet to convert each character of the input string + while (Begin < End) + *Output++ = Facet.narrow(static_cast(*Begin++), Replacement); + + #endif + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an ANSI characters range +/// to an UTF-32 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::ANSIToUTF32(In Begin, In End, Out Output, const std::locale& Locale) +{ + #ifdef __MINGW32__ + + // MinGW has a almost no support for unicode stuff + // As a consequence, the MinGW version of this function can only use the default locale + // and ignores the one passed as parameter + while (Begin < End) + { + wchar_t Char = 0; + mbtowc(&Char, &*Begin, 1); + Begin++; + *Output++ = static_cast(Char); + } + + #else + + // Get the facet of the locale which deals with character conversion + const std::ctype& Facet = std::use_facet< std::ctype >(Locale); + + // Use the facet to convert each character of the input string + while (Begin < End) + *Output++ = static_cast(Facet.widen(*Begin++)); + + #endif + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-8 characters range +/// to an UTF-16 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF8ToUTF16(In Begin, In End, Out Output, Uint16 Replacement) +{ + while (Begin < End) + { + Uint32 c = 0; + int TrailingBytes = UTF8TrailingBytes[*Begin]; + if (Begin + TrailingBytes < End) + { + // First decode the UTF-8 character + switch (TrailingBytes) + { + case 5 : c += *Begin++; c <<= 6; + case 4 : c += *Begin++; c <<= 6; + case 3 : c += *Begin++; c <<= 6; + case 2 : c += *Begin++; c <<= 6; + case 1 : c += *Begin++; c <<= 6; + case 0 : c += *Begin++; + } + c -= UTF8Offsets[TrailingBytes]; + + // Then encode it in UTF-16 + if (c < 0xFFFF) + { + // Character can be converted directly to 16 bits, just need to check it's in the valid range + if ((c >= 0xD800) && (c <= 0xDFFF)) + { + // Invalid character (this range is reserved) + if (Replacement) + *Output++ = Replacement; + } + else + { + // Valid character directly convertible to 16 bits + *Output++ = static_cast(c); + } + } + else if (c > 0x0010FFFF) + { + // Invalid character (greater than the maximum unicode value) + if (Replacement) + *Output++ = Replacement; + } + else + { + // Character will be converted to 2 UTF-16 elements + c -= 0x0010000; + *Output++ = static_cast((c >> 10) + 0xD800); + *Output++ = static_cast((c & 0x3FFUL) + 0xDC00); + } + } + } + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-8 characters range +/// to an UTF-32 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF8ToUTF32(In Begin, In End, Out Output, Uint32 Replacement) +{ + while (Begin < End) + { + Uint32 c = 0; + int TrailingBytes = UTF8TrailingBytes[*Begin]; + if (Begin + TrailingBytes < End) + { + // First decode the UTF-8 character + switch (TrailingBytes) + { + case 5 : c += *Begin++; c <<= 6; + case 4 : c += *Begin++; c <<= 6; + case 3 : c += *Begin++; c <<= 6; + case 2 : c += *Begin++; c <<= 6; + case 1 : c += *Begin++; c <<= 6; + case 0 : c += *Begin++; + } + c -= UTF8Offsets[TrailingBytes]; + + // Then write it if valid + if ((c < 0xD800) || (c > 0xDFFF)) + { + // Valid UTF-32 character + *Output++ = c; + } + else + { + // Invalid UTF-32 character + if (Replacement) + *Output++ = Replacement; + } + } + } + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-16 characters range +/// to an UTF-8 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF16ToUTF8(In Begin, In End, Out Output, Uint8 Replacement) +{ + while (Begin < End) + { + Uint32 c = *Begin++; + + // If it's a surrogate pair, first convert to a single UTF-32 character + if ((c >= 0xD800) && (c <= 0xDBFF)) + { + if (Begin < End) + { + // The second element is valid : convert the two elements to a UTF-32 character + Uint32 d = *Begin++; + if ((d >= 0xDC00) && (d <= 0xDFFF)) + c = static_cast(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000); + } + else + { + // Invalid second element + if (Replacement) + *Output++ = Replacement; + } + } + + // Then convert to UTF-8 + if (c > 0x0010FFFF) + { + // Invalid character (greater than the maximum unicode value) + if (Replacement) + *Output++ = Replacement; + } + else + { + // Valid character + + // Get number of bytes to write + int BytesToWrite = 1; + if (c < 0x80) BytesToWrite = 1; + else if (c < 0x800) BytesToWrite = 2; + else if (c < 0x10000) BytesToWrite = 3; + else if (c <= 0x0010FFFF) BytesToWrite = 4; + + // Extract bytes to write + Uint8 Bytes[4]; + switch (BytesToWrite) + { + case 4 : Bytes[3] = static_cast((c | 0x80) & 0xBF); c >>= 6; + case 3 : Bytes[2] = static_cast((c | 0x80) & 0xBF); c >>= 6; + case 2 : Bytes[1] = static_cast((c | 0x80) & 0xBF); c >>= 6; + case 1 : Bytes[0] = static_cast (c | UTF8FirstBytes[BytesToWrite]); + } + + // Add them to the output + const Uint8* CurByte = Bytes; + switch (BytesToWrite) + { + case 4 : *Output++ = *CurByte++; + case 3 : *Output++ = *CurByte++; + case 2 : *Output++ = *CurByte++; + case 1 : *Output++ = *CurByte++; + } + } + } + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-16 characters range +/// to an UTF-32 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF16ToUTF32(In Begin, In End, Out Output, Uint32 Replacement) +{ + while (Begin < End) + { + Uint16 c = *Begin++; + if ((c >= 0xD800) && (c <= 0xDBFF)) + { + // We have a surrogate pair, ie. a character composed of two elements + if (Begin < End) + { + Uint16 d = *Begin++; + if ((d >= 0xDC00) && (d <= 0xDFFF)) + { + // The second element is valid : convert the two elements to a UTF-32 character + *Output++ = static_cast(((c - 0xD800) << 10) + (d - 0xDC00) + 0x0010000); + } + else + { + // Invalid second element + if (Replacement) + *Output++ = Replacement; + } + } + } + else if ((c >= 0xDC00) && (c <= 0xDFFF)) + { + // Invalid character + if (Replacement) + *Output++ = Replacement; + } + else + { + // Valid character directly convertible to UTF-32 + *Output++ = static_cast(c); + } + } + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-32 characters range +/// to an UTF-8 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF32ToUTF8(In Begin, In End, Out Output, Uint8 Replacement) +{ + while (Begin < End) + { + Uint32 c = *Begin++; + if (c > 0x0010FFFF) + { + // Invalid character (greater than the maximum unicode value) + if (Replacement) + *Output++ = Replacement; + } + else + { + // Valid character + + // Get number of bytes to write + int BytesToWrite = 1; + if (c < 0x80) BytesToWrite = 1; + else if (c < 0x800) BytesToWrite = 2; + else if (c < 0x10000) BytesToWrite = 3; + else if (c <= 0x0010FFFF) BytesToWrite = 4; + + // Extract bytes to write + Uint8 Bytes[4]; + switch (BytesToWrite) + { + case 4 : Bytes[3] = static_cast((c | 0x80) & 0xBF); c >>= 6; + case 3 : Bytes[2] = static_cast((c | 0x80) & 0xBF); c >>= 6; + case 2 : Bytes[1] = static_cast((c | 0x80) & 0xBF); c >>= 6; + case 1 : Bytes[0] = static_cast (c | UTF8FirstBytes[BytesToWrite]); + } + + // Add them to the output + const Uint8* CurByte = Bytes; + switch (BytesToWrite) + { + case 4 : *Output++ = *CurByte++; + case 3 : *Output++ = *CurByte++; + case 2 : *Output++ = *CurByte++; + case 1 : *Output++ = *CurByte++; + } + } + } + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Generic function to convert an UTF-32 characters range +/// to an UTF-16 characters range, using the given locale +//////////////////////////////////////////////////////////// +template +inline Out Unicode::UTF32ToUTF16(In Begin, In End, Out Output, Uint16 Replacement) +{ + while (Begin < End) + { + Uint32 c = *Begin++; + if (c < 0xFFFF) + { + // Character can be converted directly to 16 bits, just need to check it's in the valid range + if ((c >= 0xD800) && (c <= 0xDFFF)) + { + // Invalid character (this range is reserved) + if (Replacement) + *Output++ = Replacement; + } + else + { + // Valid character directly convertible to 16 bits + *Output++ = static_cast(c); + } + } + else if (c > 0x0010FFFF) + { + // Invalid character (greater than the maximum unicode value) + if (Replacement) + *Output++ = Replacement; + } + else + { + // Character will be converted to 2 UTF-16 elements + c -= 0x0010000; + *Output++ = static_cast((c >> 10) + 0xD800); + *Output++ = static_cast((c & 0x3FFUL) + 0xDC00); + } + } + + return Output; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of characters composing an UTF-8 string +//////////////////////////////////////////////////////////// +template +inline std::size_t Unicode::GetUTF8Length(In Begin, In End) +{ + std::size_t Length = 0; + while (Begin < End) + { + int NbBytes = UTF8TrailingBytes[*Begin]; + if (Begin + NbBytes < End) + ++Length; + + Begin += NbBytes + 1; + } + + return Length; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of characters composing an UTF-16 string +//////////////////////////////////////////////////////////// +template +inline std::size_t Unicode::GetUTF16Length(In Begin, In End) +{ + std::size_t Length = 0; + while (Begin < End) + { + if ((*Begin >= 0xD800) && (*Begin <= 0xDBFF)) + { + ++Begin; + if ((Begin < End) && ((*Begin >= 0xDC00) && (*Begin <= 0xDFFF))) + { + ++Length; + } + } + else + { + ++Length; + } + + ++Begin; + } + + return Length; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of characters composing an UTF-32 string +//////////////////////////////////////////////////////////// +template +inline std::size_t Unicode::GetUTF32Length(In Begin, In End) +{ + return End - Begin; +} diff --git a/include/SFML/System/Unix/Mutex.hpp b/include/SFML/System/Unix/Mutex.hpp new file mode 100644 index 00000000..f8f24b6b --- /dev/null +++ b/include/SFML/System/Unix/Mutex.hpp @@ -0,0 +1,82 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUTEXUNIX_HPP +#define SFML_MUTEXUNIX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Mutex defines a mutex (MUTual EXclusion) object, +/// that allows a thread to lock critical instructions +/// to avoid simultaneous access with other threads. +/// See Lock for an efficient way of using it. +//////////////////////////////////////////////////////////// +class SFML_API Mutex : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Mutex(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~Mutex(); + + //////////////////////////////////////////////////////////// + /// Lock the mutex + /// + //////////////////////////////////////////////////////////// + void Lock(); + + //////////////////////////////////////////////////////////// + /// Unlock the mutex + /// + //////////////////////////////////////////////////////////// + void Unlock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + pthread_mutex_t myMutex; ///< pthread instance of the mutex +}; + +} // namespace sf + + +#endif // SFML_MUTEXUNIX_HPP diff --git a/include/SFML/System/Unix/Thread.hpp b/include/SFML/System/Unix/Thread.hpp new file mode 100644 index 00000000..b26d38ff --- /dev/null +++ b/include/SFML/System/Unix/Thread.hpp @@ -0,0 +1,124 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREADUNIX_HPP +#define SFML_THREADUNIX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Thread defines a thread. +/// There is two ways to use Thread : +/// - Inherit from it and override the Run() virtual function +/// - Construct a sfThread instance and pass it a function +/// pointer to call +//////////////////////////////////////////////////////////// +class SFML_API Thread : NonCopyable +{ +public : + + typedef void (*FuncType)(void*); + + //////////////////////////////////////////////////////////// + /// Construct the thread from a function pointer + /// + /// \param Function : Entry point of the thread + /// \param UserData : Data to pass to the thread function (NULL by default) + /// + //////////////////////////////////////////////////////////// + Thread(FuncType Function, void* UserData = NULL); + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Thread(); + + //////////////////////////////////////////////////////////// + /// Create and run the thread + /// + //////////////////////////////////////////////////////////// + void Launch(); + + //////////////////////////////////////////////////////////// + /// Wait until the thread finishes + /// + //////////////////////////////////////////////////////////// + void Wait(); + + //////////////////////////////////////////////////////////// + /// Terminate the thread + /// Terminating a thread with this function is not safe, + /// you should rather try to make the thread function + /// terminate by itself + /// + //////////////////////////////////////////////////////////// + void Terminate(); + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Thread(); + +private : + + //////////////////////////////////////////////////////////// + /// Function called as the thread entry point + /// + //////////////////////////////////////////////////////////// + virtual void Run(); + + //////////////////////////////////////////////////////////// + /// Actual thread entry point, dispatches to instances + /// + /// \param UserData : Data to pass to the thread function + /// + /// \return Error code + /// + //////////////////////////////////////////////////////////// + static void* ThreadFunc(void* UserData); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + pthread_t myThread; ///< Unix thread instance + bool myIsActive; ///< Thread state (active or inactive) + FuncType myFunction; ///< Function to call as the thread entry point + void* myUserData; ///< Data to pass to the thread function +}; + +} // namespace sf + + +#endif // SFML_THREADUNIX_HPP diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp new file mode 100644 index 00000000..f6a18ab6 --- /dev/null +++ b/include/SFML/System/Vector2.hpp @@ -0,0 +1,215 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VECTOR2_HPP +#define SFML_VECTOR2_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Vector2 is an utility class for manipulating 2 dimensional +/// vectors. Template parameter defines the type of coordinates +/// (integer, float, ...) +//////////////////////////////////////////////////////////// +template +class Vector2 +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Vector2(); + + //////////////////////////////////////////////////////////// + /// Construct the vector from its coordinates + /// + /// \param X : X coordinate + /// \param Y : Y coordinate + /// + //////////////////////////////////////////////////////////// + Vector2(T X, T Y); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector +}; + +//////////////////////////////////////////////////////////// +/// Operator - overload ; returns the opposite of a vector +/// +/// \param V : Vector to negate +/// +/// \return -V +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& V); + +//////////////////////////////////////////////////////////// +/// Operator += overload ; add two vectors and assign to the first op +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 + V2 +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator +=(Vector2& V1, const Vector2& V2); + +//////////////////////////////////////////////////////////// +/// Operator -= overload ; subtract two vectors and assign to the first op +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 - V2 +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator -=(Vector2& V1, const Vector2& V2); + +//////////////////////////////////////////////////////////// +/// Operator + overload ; adds two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 + V2 +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator +(const Vector2& V1, const Vector2& V2); + +//////////////////////////////////////////////////////////// +/// Operator - overload ; subtracts two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 - V2 +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& V1, const Vector2& V2); + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V * X +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator *(const Vector2& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a scalar value by a vector +/// +/// \param X : Scalar value +/// \param V : Vector +/// +/// \return X * V +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator *(T X, const Vector2& V); + +//////////////////////////////////////////////////////////// +/// Operator *= overload ; multiply-assign a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V * X +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator *=(Vector2& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator / overload ; divide a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V / X +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator /(const Vector2& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator /= overload ; divide-assign a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V / X +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator /=(Vector2& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator == overload ; compares the equality of two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return True if V1 is equal to V2 +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector2& V1, const Vector2& V2); + +//////////////////////////////////////////////////////////// +/// Operator != overload ; compares the difference of two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return True if V1 is different than V2 +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector2& V1, const Vector2& V2); + +#include + +// Define the most common types +typedef Vector2 Vector2i; +typedef Vector2 Vector2f; + +} // namespace sf + + +#endif // SFML_VECTOR2_HPP diff --git a/include/SFML/System/Vector2.inl b/include/SFML/System/Vector2.inl new file mode 100644 index 00000000..05f686c9 --- /dev/null +++ b/include/SFML/System/Vector2.inl @@ -0,0 +1,179 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +template +Vector2::Vector2() : +x(0), +y(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the color from its coordinates +//////////////////////////////////////////////////////////// +template +Vector2::Vector2(T X, T Y) : +x(X), +y(Y) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Operator - overload ; returns the opposite of a vector +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& V) +{ + return Vector2(-V.x, -V.y); +} + + +//////////////////////////////////////////////////////////// +/// Operator += overload ; add two vectors and assign to the first op +//////////////////////////////////////////////////////////// +template +Vector2& operator +=(Vector2& V1, const Vector2& V2) +{ + V1.x += V2.x; + V1.y += V2.y; + + return V1; +} + + +//////////////////////////////////////////////////////////// +/// Operator -= overload ; subtract two vectors and assign to the first op +//////////////////////////////////////////////////////////// +template +Vector2& operator -=(Vector2& V1, const Vector2& V2) +{ + V1.x -= V2.x; + V1.y -= V2.y; + + return V1; +} + + +//////////////////////////////////////////////////////////// +/// Operator + overload ; adds two vectors +//////////////////////////////////////////////////////////// +template +Vector2 operator +(const Vector2& V1, const Vector2& V2) +{ + return Vector2(V1.x + V2.x, V1.y + V2.y); +} + + +//////////////////////////////////////////////////////////// +/// Operator - overload ; subtracts two vectors +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& V1, const Vector2& V2) +{ + return Vector2(V1.x - V2.x, V1.y - V2.y); +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector2 operator *(const Vector2& V, T X) +{ + return Vector2(V.x * X, V.y * X); +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a scalar value by a vector +//////////////////////////////////////////////////////////// +template +Vector2 operator *(T X, const Vector2& V) +{ + return Vector2(V.x * X, V.y * X); +} + + +//////////////////////////////////////////////////////////// +/// Operator *= overload ; multiply-assign a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector2& operator *=(Vector2& V, T X) +{ + V.x *= X; + V.y *= X; + + return V; +} + + +//////////////////////////////////////////////////////////// +/// Operator / overload ; divide a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector2 operator /(const Vector2& V, T X) +{ + return Vector2(V.x / X, V.y / X); +} + + +//////////////////////////////////////////////////////////// +/// Operator /= overload ; divide-assign a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector2& operator /=(Vector2& V, T X) +{ + V.x /= X; + V.y /= X; + + return V; +} + + +//////////////////////////////////////////////////////////// +/// Operator == overload ; compares the equality of two vectors +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector2& V1, const Vector2& V2) +{ + return (V1.x == V2.x) && (V1.y == V2.y); +} + + +//////////////////////////////////////////////////////////// +/// Operator != overload ; compares the difference of two vectors +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector2& V1, const Vector2& V2) +{ + return (V1.x != V2.x) || (V1.y != V2.y); +} diff --git a/include/SFML/System/Vector3.hpp b/include/SFML/System/Vector3.hpp new file mode 100644 index 00000000..0174c3f7 --- /dev/null +++ b/include/SFML/System/Vector3.hpp @@ -0,0 +1,217 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VECTOR3_HPP +#define SFML_VECTOR3_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Vector3 is an utility class for manipulating 3 dimensional +/// vectors. Template parameter defines the type of coordinates +/// (integer, float, ...) +//////////////////////////////////////////////////////////// +template +class Vector3 +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Vector3(); + + //////////////////////////////////////////////////////////// + /// Construct the vector from its coordinates + /// + /// \param X : X coordinate + /// \param Y : Y coordinate + /// \param Z : Z coordinate + /// + //////////////////////////////////////////////////////////// + Vector3(T X, T Y, T Z); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + T z; ///< Z coordinate of the vector +}; + +//////////////////////////////////////////////////////////// +/// Operator - overload ; returns the opposite of a vector +/// +/// \param V : Vector to negate +/// +/// \return -V +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& V); + +//////////////////////////////////////////////////////////// +/// Operator += overload ; add two vectors and assign to the first op +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 + V2 +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator +=(Vector3& V1, const Vector3& V2); + +//////////////////////////////////////////////////////////// +/// Operator -= overload ; subtract two vectors and assign to the first op +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 - V2 +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator -=(Vector3& V1, const Vector3& V2); + +//////////////////////////////////////////////////////////// +/// Operator + overload ; adds two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 + V2 +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator +(const Vector3& V1, const Vector3& V2); + +//////////////////////////////////////////////////////////// +/// Operator - overload ; subtracts two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return V1 - V2 +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& V1, const Vector3& V2); + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V * X +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator *(const Vector3& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a scalar value by a vector +/// +/// \param X : Scalar value +/// \param V : Vector +/// +/// \return X * V +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator *(T X, const Vector3& V); + +//////////////////////////////////////////////////////////// +/// Operator *= overload ; multiply-assign a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V * X +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator *=(Vector3& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator / overload ; divide a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V / X +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator /(const Vector3& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator /= overload ; divide-assign a vector by a scalar value +/// +/// \param V : Vector +/// \param X : Scalar value +/// +/// \return V / X +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator /=(Vector3& V, T X); + +//////////////////////////////////////////////////////////// +/// Operator == overload ; compares the equality of two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return True if V1 is equal to V2 +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector3& V1, const Vector3& V2); + +//////////////////////////////////////////////////////////// +/// Operator != overload ; compares the difference of two vectors +/// +/// \param V1 : First vector +/// \param V2 : Second vector +/// +/// \return True if V1 is different than V2 +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector3& V1, const Vector3& V2); + +#include + +// Define the most common types +typedef Vector3 Vector3i; +typedef Vector3 Vector3f; + +} // namespace sf + + +#endif // SFML_VECTOR3_HPP diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl new file mode 100644 index 00000000..234a01c6 --- /dev/null +++ b/include/SFML/System/Vector3.inl @@ -0,0 +1,185 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +template +Vector3::Vector3() : +x(0), +y(0), +z(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the color from its coordinates +//////////////////////////////////////////////////////////// +template +Vector3::Vector3(T X, T Y, T Z) : +x(X), +y(Y), +z(Z) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Operator - overload ; returns the opposite of a vector +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& V) +{ + return Vector3(-V.x, -V.y, -V.z); +} + + +//////////////////////////////////////////////////////////// +/// Operator += overload ; add two vectors and assign to the first op +//////////////////////////////////////////////////////////// +template +Vector3& operator +=(Vector3& V1, const Vector3& V2) +{ + V1.x += V2.x; + V1.y += V2.y; + V1.z += V2.z; + + return V1; +} + + +//////////////////////////////////////////////////////////// +/// Operator -= overload ; subtract two vectors and assign to the first op +//////////////////////////////////////////////////////////// +template +Vector3& operator -=(Vector3& V1, const Vector3& V2) +{ + V1.x -= V2.x; + V1.y -= V2.y; + V1.z -= V2.z; + + return V1; +} + + +//////////////////////////////////////////////////////////// +/// Operator + overload ; adds two vectors +//////////////////////////////////////////////////////////// +template +Vector3 operator +(const Vector3& V1, const Vector3& V2) +{ + return Vector3(V1.x + V2.x, V1.y + V2.y, V1.z + V2.z); +} + + +//////////////////////////////////////////////////////////// +/// Operator - overload ; subtracts two vectors +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& V1, const Vector3& V2) +{ + return Vector3(V1.x - V2.x, V1.y - V2.y, V1.z - V2.z); +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector3 operator *(const Vector3& V, T X) +{ + return Vector3(V.x * X, V.y * X, V.z * X); +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload ; multiply a scalar value by a vector +//////////////////////////////////////////////////////////// +template +Vector3 operator *(T X, const Vector3& V) +{ + return Vector3(V.x * X, V.y * X, V.z * X); +} + + +//////////////////////////////////////////////////////////// +/// Operator *= overload ; multiply-assign a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector3& operator *=(Vector3& V, T X) +{ + V.x *= X; + V.y *= X; + V.z *= X; + + return V; +} + + +//////////////////////////////////////////////////////////// +/// Operator / overload ; divide a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector3 operator /(const Vector3& V, T X) +{ + return Vector3(V.x / X, V.y / X, V.z / X); +} + + +//////////////////////////////////////////////////////////// +/// Operator /= overload ; divide-assign a vector by a scalar value +//////////////////////////////////////////////////////////// +template +Vector3& operator /=(Vector3& V, T X) +{ + V.x /= X; + V.y /= X; + V.z /= X; + + return V; +} + + +//////////////////////////////////////////////////////////// +/// Operator == overload ; compares the equality of two vectors +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector3& V1, const Vector3& V2) +{ + return (V1.x == V2.x) && (V1.y == V2.y) && (V1.z == V2.z); +} + + +//////////////////////////////////////////////////////////// +/// Operator != overload ; compares the difference of two vectors +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector3& V1, const Vector3& V2) +{ + return (V1.x != V2.x) || (V1.y != V2.y) || (V1.z != V2.z); +} diff --git a/include/SFML/System/Win32/Mutex.hpp b/include/SFML/System/Win32/Mutex.hpp new file mode 100644 index 00000000..6d84cc5d --- /dev/null +++ b/include/SFML/System/Win32/Mutex.hpp @@ -0,0 +1,84 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUTEXWIN32_HPP +#define SFML_MUTEXWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Mutex defines a mutex (MUTual EXclusion) object, +/// that allows a thread to lock critical instructions +/// to avoid simultaneous access with other threads. +/// The Win32 version uses critical sections, as it is +/// faster than mutexes.
+/// See Lock for an efficient way of using it. +//////////////////////////////////////////////////////////// +class SFML_API Mutex : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Mutex(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~Mutex(); + + //////////////////////////////////////////////////////////// + /// Lock the mutex + /// + //////////////////////////////////////////////////////////// + void Lock(); + + //////////////////////////////////////////////////////////// + /// Unlock the mutex + /// + //////////////////////////////////////////////////////////// + void Unlock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + CRITICAL_SECTION myHandle; ///< Win32 handle of the mutex +}; + +} // namespace sf + + +#endif // SFML_MUTEXWIN32_HPP diff --git a/include/SFML/System/Win32/Thread.hpp b/include/SFML/System/Win32/Thread.hpp new file mode 100644 index 00000000..c1a0ac9e --- /dev/null +++ b/include/SFML/System/Win32/Thread.hpp @@ -0,0 +1,123 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREADWIN32_HPP +#define SFML_THREADWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Thread defines an easy way to manipulate a thread. +/// There are two ways to use Thread : +/// - Inherit from it and override the Run() virtual function +/// - Construct a Thread instance and pass it a function +/// pointer to call +//////////////////////////////////////////////////////////// +class SFML_API Thread : NonCopyable +{ +public : + + typedef void (*FuncType)(void*); + + //////////////////////////////////////////////////////////// + /// Construct the thread from a function pointer + /// + /// \param Function : Entry point of the thread + /// \param UserData : Data to pass to the thread function (NULL by default) + /// + //////////////////////////////////////////////////////////// + Thread(FuncType Function, void* UserData = NULL); + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Thread(); + + //////////////////////////////////////////////////////////// + /// Create and run the thread + /// + //////////////////////////////////////////////////////////// + void Launch(); + + //////////////////////////////////////////////////////////// + /// Wait until the thread finishes + /// + //////////////////////////////////////////////////////////// + void Wait(); + + //////////////////////////////////////////////////////////// + /// Terminate the thread + /// Terminating a thread with this function is not safe, + /// you should rather try to make the thread function + /// terminate by itself + /// + //////////////////////////////////////////////////////////// + void Terminate(); + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Thread(); + +private : + + //////////////////////////////////////////////////////////// + /// Function called as the thread entry point + /// + //////////////////////////////////////////////////////////// + virtual void Run(); + + //////////////////////////////////////////////////////////// + /// Actual thread entry point, dispatches to instances + /// + /// \param UserData : Data to pass to the thread function + /// + /// \return Error code + /// + //////////////////////////////////////////////////////////// + static unsigned int __stdcall ThreadFunc(void* UserData); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + HANDLE myHandle; ///< Win32 thread handle + FuncType myFunction; ///< Function to call as the thread entry point + void* myUserData; ///< Data to pass to the thread function +}; + +} // namespace sf + + +#endif // SFML_THREADWIN32_HPP diff --git a/include/SFML/Window.hpp b/include/SFML/Window.hpp new file mode 100644 index 00000000..a73ff1bc --- /dev/null +++ b/include/SFML/Window.hpp @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SFML_WINDOW_HPP +#define SFML_SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_SFML_WINDOW_HPP diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp new file mode 100644 index 00000000..2335afb5 --- /dev/null +++ b/include/SFML/Window/Context.hpp @@ -0,0 +1,100 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONTEXT_HPP +#define SFML_CONTEXT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ + class WindowImpl; +} + +//////////////////////////////////////////////////////////// +/// Class wrapping an OpenGL context. +/// All SFML windows already have their own context, so +/// this class is more a helper for specific issues involving +/// OpenGL and multi-threading. +/// It's meant to be used internally. +//////////////////////////////////////////////////////////// +class SFML_API Context : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor, create the context + /// + //////////////////////////////////////////////////////////// + Context(); + + //////////////////////////////////////////////////////////// + /// Destructor, destroy the context + /// + //////////////////////////////////////////////////////////// + ~Context(); + + //////////////////////////////////////////////////////////// + /// Activate or deactivate the context + /// + /// \param Active : True to activate the context, false to deactivate it + /// + //////////////////////////////////////////////////////////// + void SetActive(bool Active); + + //////////////////////////////////////////////////////////// + /// Check if there's a context bound to the current thread + /// + /// \return True if there's a context bound to the current thread + /// + //////////////////////////////////////////////////////////// + static bool IsContextActive(); + + //////////////////////////////////////////////////////////// + /// Get the global context + /// + /// \return Reference to the global context + /// + //////////////////////////////////////////////////////////// + static Context& GetGlobal(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::WindowImpl* myDummyWindow; ///< Dummy window holding the context +}; + +} // namespace sf + + +#endif // SFML_CONTEXT_HPP diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp new file mode 100644 index 00000000..dd9814e2 --- /dev/null +++ b/include/SFML/Window/Event.hpp @@ -0,0 +1,313 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_EVENT_HPP +#define SFML_EVENT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Definition of key codes for keyboard events +//////////////////////////////////////////////////////////// +namespace Key +{ + enum Code + { + A = 'a', + B = 'b', + C = 'c', + D = 'd', + E = 'e', + F = 'f', + G = 'g', + H = 'h', + I = 'i', + J = 'j', + K = 'k', + L = 'l', + M = 'm', + N = 'n', + O = 'o', + P = 'p', + Q = 'q', + R = 'r', + S = 's', + T = 't', + U = 'u', + V = 'v', + W = 'w', + X = 'x', + Y = 'y', + Z = 'z', + Num0 = '0', + Num1 = '1', + Num2 = '2', + Num3 = '3', + Num4 = '4', + Num5 = '5', + Num6 = '6', + Num7 = '7', + Num8 = '8', + Num9 = '9', + Escape = 256, + LControl, + LShift, + LAlt, + LSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ... + RControl, + RShift, + RAlt, + RSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ... + Menu, + LBracket, ///< [ + RBracket, ///< ] + SemiColon, ///< ; + Comma, ///< , + Period, ///< . + Quote, ///< ' + Slash, ///< / + BackSlash, + Tilde, ///< ~ + Equal, ///< = + Dash, ///< - + Space, + Return, + Back, + Tab, + PageUp, + PageDown, + End, + Home, + Insert, + Delete, + Add, ///< + + Subtract, ///< - + Multiply, ///< * + Divide, ///< / + Left, ///< Left arrow + Right, ///< Right arrow + Up, ///< Up arrow + Down, ///< Down arrow + Numpad0, + Numpad1, + Numpad2, + Numpad3, + Numpad4, + Numpad5, + Numpad6, + Numpad7, + Numpad8, + Numpad9, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + Pause, + + Count // For internal use + }; +} + + +//////////////////////////////////////////////////////////// +/// Definition of button codes for mouse events +//////////////////////////////////////////////////////////// +namespace Mouse +{ + enum Button + { + Left, + Right, + Middle, + XButton1, + XButton2, + + Count // For internal use + }; +} + + +//////////////////////////////////////////////////////////// +/// Definition of joystick axis for joystick events +//////////////////////////////////////////////////////////// +namespace Joy +{ + enum Axis + { + AxisX, + AxisY, + AxisZ, + AxisR, + AxisU, + AxisV, + AxisPOV, + + Count // For internal use + }; +} + + +//////////////////////////////////////////////////////////// +/// Event defines a system event and its parameters +//////////////////////////////////////////////////////////// +class Event +{ +public : + + //////////////////////////////////////////////////////////// + /// Keyboard event parameters + //////////////////////////////////////////////////////////// + struct KeyEvent + { + Key::Code Code; + bool Alt; + bool Control; + bool Shift; + }; + + //////////////////////////////////////////////////////////// + /// Text event parameters + //////////////////////////////////////////////////////////// + struct TextEvent + { + Uint32 Unicode; + }; + + //////////////////////////////////////////////////////////// + /// Mouse move event parameters + //////////////////////////////////////////////////////////// + struct MouseMoveEvent + { + int X; + int Y; + }; + + //////////////////////////////////////////////////////////// + /// Mouse buttons events parameters + //////////////////////////////////////////////////////////// + struct MouseButtonEvent + { + Mouse::Button Button; + int X; + int Y; + }; + + //////////////////////////////////////////////////////////// + /// Mouse wheel events parameters + //////////////////////////////////////////////////////////// + struct MouseWheelEvent + { + int Delta; + }; + + //////////////////////////////////////////////////////////// + /// Joystick axis move event parameters + //////////////////////////////////////////////////////////// + struct JoyMoveEvent + { + unsigned int JoystickId; + Joy::Axis Axis; + float Position; + }; + + //////////////////////////////////////////////////////////// + /// Joystick buttons events parameters + //////////////////////////////////////////////////////////// + struct JoyButtonEvent + { + unsigned int JoystickId; + unsigned int Button; + }; + + //////////////////////////////////////////////////////////// + /// Size events parameters + //////////////////////////////////////////////////////////// + struct SizeEvent + { + unsigned int Width; + unsigned int Height; + }; + + //////////////////////////////////////////////////////////// + /// Enumeration of the different types of events + //////////////////////////////////////////////////////////// + enum EventType + { + Closed, + Resized, + LostFocus, + GainedFocus, + TextEntered, + KeyPressed, + KeyReleased, + MouseWheelMoved, + MouseButtonPressed, + MouseButtonReleased, + MouseMoved, + MouseEntered, + MouseLeft, + JoyButtonPressed, + JoyButtonReleased, + JoyMoved + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + EventType Type; ///< Type of the event + + union + { + KeyEvent Key; + TextEvent Text; + MouseMoveEvent MouseMove; + MouseButtonEvent MouseButton; + MouseWheelEvent MouseWheel; + JoyMoveEvent JoyMove; + JoyButtonEvent JoyButton; + SizeEvent Size; + }; +}; + +} // namespace sf + + +#endif // SFML_EVENT_HPP diff --git a/include/SFML/Window/Input.hpp b/include/SFML/Window/Input.hpp new file mode 100644 index 00000000..4156db26 --- /dev/null +++ b/include/SFML/Window/Input.hpp @@ -0,0 +1,134 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_INPUT_HPP +#define SFML_INPUT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Input handles real-time input from keyboard and mouse. +/// Use it instead of events to handle continuous moves and more +/// game-friendly inputs +//////////////////////////////////////////////////////////// +class SFML_API Input : public WindowListener, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Input(); + + //////////////////////////////////////////////////////////// + /// Get the state of a key + /// + /// \param KeyCode : Key to check + /// + /// \return True if key is down, false if key is up + /// + //////////////////////////////////////////////////////////// + bool IsKeyDown(Key::Code KeyCode) const; + + //////////////////////////////////////////////////////////// + /// Get the state of a mouse button + /// + /// \param Button : Button to check + /// + /// \return True if button is down, false if button is up + /// + //////////////////////////////////////////////////////////// + bool IsMouseButtonDown(Mouse::Button Button) const; + + //////////////////////////////////////////////////////////// + /// Get the state of a joystick button + /// + /// \param JoyId : Identifier of the joystick to check (0 or 1) + /// \param Button : Button to check + /// + /// \return True if button is down, false if button is up + /// + //////////////////////////////////////////////////////////// + bool IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const; + + //////////////////////////////////////////////////////////// + /// Get the mouse X position + /// + /// \return Current mouse left position, relative to owner window + /// + //////////////////////////////////////////////////////////// + int GetMouseX() const; + + //////////////////////////////////////////////////////////// + /// Get the mouse Y position + /// + /// \return Current mouse top position, relative to owner window + /// + //////////////////////////////////////////////////////////// + int GetMouseY() const; + + //////////////////////////////////////////////////////////// + /// Get a joystick axis position + /// + /// \param JoyId : Identifier of the joystick to check (0 or 1) + /// \param Axis : Axis to get + /// + /// \return Current axis position, in the range [-100, 100] (except for POV, which is [0, 360]) + /// + //////////////////////////////////////////////////////////// + float GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const; + +private : + + //////////////////////////////////////////////////////////// + /// /see WindowListener::OnEvent + /// + //////////////////////////////////////////////////////////// + virtual void OnEvent(const Event& EventReceived); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + bool myKeys[Key::Count]; ///< Array containing the state of all keyboard keys + bool myMouseButtons[Mouse::Count]; ///< Array containing the state of all mouse buttons + bool myJoystickButtons[2][16]; ///< Array containing the state of all joysticks buttons + int myMouseX; ///< Mouse position on X + int myMouseY; ///< Mouse position on Y + float myJoystickAxis[2][Joy::Count]; ///< Joysticks position on each axis +}; + +} // namespace sf + + +#endif // SFML_INPUT_HPP diff --git a/include/SFML/Window/OpenGL.hpp b/include/SFML/Window/OpenGL.hpp new file mode 100644 index 00000000..ee557640 --- /dev/null +++ b/include/SFML/Window/OpenGL.hpp @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_OPENGL_HPP +#define SFML_OPENGL_HPP + + +//////////////////////////////////////////////////////////// +/// This file just includes the OpenGL (GL and GLU) headers, +/// which have actually different paths on each system +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) || defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + #include + #include + +#elif defined(SFML_SYSTEM_MACOS) + + #include + #include + +#endif + + +#endif // SFML_OPENGL_HPP diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp new file mode 100644 index 00000000..955f0168 --- /dev/null +++ b/include/SFML/Window/VideoMode.hpp @@ -0,0 +1,136 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODE_HPP +#define SFML_VIDEOMODE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// VideoMode defines a video mode (width, height, bpp, frequency) +/// and provides static functions for getting modes supported +/// by the display device +//////////////////////////////////////////////////////////// +class SFML_API VideoMode +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + VideoMode(); + + //////////////////////////////////////////////////////////// + /// Construct the video mode with its attributes + /// + /// \param ModeWidth : Width in pixels + /// \param ModeHeight : Height in pixels + /// \param ModeBpp : Pixel depths in bits per pixel (32 by default) + /// + //////////////////////////////////////////////////////////// + VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32); + + //////////////////////////////////////////////////////////// + /// Get the current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode GetDesktopMode(); + + //////////////////////////////////////////////////////////// + /// Get a valid video mode + /// Index must be in range [0, GetModesCount()[ + /// Modes are sorted from best to worst + /// + /// \param Index : Index of video mode to get + /// + /// \return Corresponding video mode (invalid mode if index is out of range) + /// + //////////////////////////////////////////////////////////// + static VideoMode GetMode(std::size_t Index); + + //////////////////////////////////////////////////////////// + /// Get valid video modes count + /// + /// \return Number of valid video modes available + /// + //////////////////////////////////////////////////////////// + static std::size_t GetModesCount(); + + //////////////////////////////////////////////////////////// + /// Tell whether or not the video mode is supported + /// + /// \return True if video mode is supported, false otherwise + /// + //////////////////////////////////////////////////////////// + bool IsValid() const; + + //////////////////////////////////////////////////////////// + /// Comparison operator overload -- tell if two video modes are equal + /// + /// \param Other : Video mode to compare + /// + /// \return True if modes are equal + /// + //////////////////////////////////////////////////////////// + bool operator ==(const VideoMode& Other) const; + + //////////////////////////////////////////////////////////// + /// Comparison operator overload -- tell if two video modes are different + /// + /// \param Other : Video mode to compare + /// + /// \return True if modes are different + /// + //////////////////////////////////////////////////////////// + bool operator !=(const VideoMode& Other) const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int Width; ///< Video mode width, in pixels + unsigned int Height; ///< Video mode height, in pixels + unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels + +private : + + //////////////////////////////////////////////////////////// + /// Get and sort valid video modes + //////////////////////////////////////////////////////////// + static void InitializeModes(); +}; + +} // namespace sf + + +#endif // SFML_VIDEOMODE_HPP diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp new file mode 100644 index 00000000..1506b3fe --- /dev/null +++ b/include/SFML/Window/Window.hpp @@ -0,0 +1,326 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_HPP +#define SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class WindowImpl; +} + +//////////////////////////////////////////////////////////// +/// Window is a rendering window ; it can create a new window +/// or connect to an existing one +//////////////////////////////////////////////////////////// +class SFML_API Window : public WindowListener, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + Window(); + + //////////////////////////////////////////////////////////// + /// Construct a new window + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style (Resize | Close by default) + /// \param Params : Creation parameters (see default constructor for default values) + /// + //////////////////////////////////////////////////////////// + Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings()); + + //////////////////////////////////////////////////////////// + /// Construct the window from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation parameters (see default constructor for default values) + /// + //////////////////////////////////////////////////////////// + Window(WindowHandle Handle, const WindowSettings& Params = WindowSettings()); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Window(); + + //////////////////////////////////////////////////////////// + /// Create (or recreate) the window + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style (Resize | Close by default) + /// \param Params : Creation parameters (see default constructor for default values) + /// + //////////////////////////////////////////////////////////// + void Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings()); + + //////////////////////////////////////////////////////////// + /// Create (or recreate) the window from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation parameters (see default constructor for default values) + /// + //////////////////////////////////////////////////////////// + void Create(WindowHandle Handle, const WindowSettings& Params = WindowSettings()); + + //////////////////////////////////////////////////////////// + /// Close (destroy) the window. + /// The sf::Window instance remains valid and you can call + /// Create to recreate the window + /// + //////////////////////////////////////////////////////////// + void Close(); + + //////////////////////////////////////////////////////////// + /// Tell whether or not the window is opened (ie. has been created). + /// Note that a hidden window (Show(false)) + /// will still return true + /// + /// \return True if the window is opened + /// + //////////////////////////////////////////////////////////// + bool IsOpened() const; + + //////////////////////////////////////////////////////////// + /// Get the width of the rendering region of the window + /// + /// \return Width in pixels + /// + //////////////////////////////////////////////////////////// + unsigned int GetWidth() const; + + //////////////////////////////////////////////////////////// + /// Get the height of the rendering region of the window + /// + /// \return Height in pixels + /// + //////////////////////////////////////////////////////////// + unsigned int GetHeight() const; + + //////////////////////////////////////////////////////////// + /// Get the creation settings of the window + /// + /// \return Structure containing the creation settings + /// + //////////////////////////////////////////////////////////// + const WindowSettings& GetSettings() const; + + //////////////////////////////////////////////////////////// + /// Get the event on top of events stack, if any, and pop it + /// + /// \param EventReceived : Event to fill, if any + /// + /// \return True if an event was returned, false if events stack was empty + /// + //////////////////////////////////////////////////////////// + bool GetEvent(Event& EventReceived); + + //////////////////////////////////////////////////////////// + /// Enable / disable vertical synchronization + /// + /// \param Enabled : True to enable v-sync, false to deactivate + /// + //////////////////////////////////////////////////////////// + void UseVerticalSync(bool Enabled); + + //////////////////////////////////////////////////////////// + /// Show or hide the mouse cursor + /// + /// \param Show : True to show, false to hide + /// + //////////////////////////////////////////////////////////// + void ShowMouseCursor(bool Show); + + //////////////////////////////////////////////////////////// + /// Change the position of the mouse cursor + /// + /// \param Left : Left coordinate of the cursor, relative to the window + /// \param Top : Top coordinate of the cursor, relative to the window + /// + //////////////////////////////////////////////////////////// + void SetCursorPosition(unsigned int Left, unsigned int Top); + + //////////////////////////////////////////////////////////// + /// Change the position of the window on screen. + /// Only works for top-level windows + /// + /// \param Left : Left position + /// \param Top : Top position + /// + //////////////////////////////////////////////////////////// + void SetPosition(int Left, int Top); + + //////////////////////////////////////////////////////////// + /// Change the size of the rendering region of the window + /// + /// \param Width : New width + /// \param Height : New height + /// + //////////////////////////////////////////////////////////// + void SetSize(unsigned int Width, unsigned int Height); + + //////////////////////////////////////////////////////////// + /// Show or hide the window + /// + /// \param State : True to show, false to hide + /// + //////////////////////////////////////////////////////////// + void Show(bool State); + + //////////////////////////////////////////////////////////// + /// Enable or disable automatic key-repeat. + /// Automatic key-repeat is enabled by default + /// + /// \param Enabled : True to enable, false to disable + /// + //////////////////////////////////////////////////////////// + void EnableKeyRepeat(bool Enabled); + + //////////////////////////////////////////////////////////// + /// Change the window's icon + /// + /// \param Width : Icon's width, in pixels + /// \param Height : Icon's height, in pixels + /// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits + /// + //////////////////////////////////////////////////////////// + void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + + //////////////////////////////////////////////////////////// + /// Activate of deactivate the window as the current target + /// for rendering + /// + /// \param Active : True to activate, false to deactivate (true by default) + /// + /// \return True if operation was successful, false otherwise + /// + //////////////////////////////////////////////////////////// + bool SetActive(bool Active = true) const; + + //////////////////////////////////////////////////////////// + /// Display the window on screen + /// + //////////////////////////////////////////////////////////// + void Display(); + + //////////////////////////////////////////////////////////// + /// Get the input manager of the window + /// + /// \return Reference to the input + /// + //////////////////////////////////////////////////////////// + const Input& GetInput() const; + + //////////////////////////////////////////////////////////// + /// Limit the framerate to a maximum fixed frequency + /// + /// \param Limit : Framerate limit, in frames per seconds (use 0 to disable limit) + /// + //////////////////////////////////////////////////////////// + void SetFramerateLimit(unsigned int Limit); + + //////////////////////////////////////////////////////////// + /// Get time elapsed since last frame + /// + /// \return Time elapsed, in seconds + /// + //////////////////////////////////////////////////////////// + float GetFrameTime() const; + + //////////////////////////////////////////////////////////// + /// Change the joystick threshold, ie. the value below which + /// no move event will be generated + /// + /// \param Threshold : New threshold, in range [0, 100] + /// + //////////////////////////////////////////////////////////// + void SetJoystickThreshold(float Threshold); + +private : + + //////////////////////////////////////////////////////////// + /// Called after the window has been created + /// + //////////////////////////////////////////////////////////// + virtual void OnCreate(); + + //////////////////////////////////////////////////////////// + /// /see WindowListener::OnEvent + /// + /// \param EventReceived : Event received + /// + //////////////////////////////////////////////////////////// + virtual void OnEvent(const Event& EventReceived); + + //////////////////////////////////////////////////////////// + /// Initialize internal window + /// + /// \param Impl : New internal window implementation + /// + //////////////////////////////////////////////////////////// + void Initialize(priv::WindowImpl* Impl); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::WindowImpl* myWindow; ///< Platform-specific implementation of window + std::queue myEvents; ///< Queue of received events + Input myInput; ///< Input manager connected to window + Clock myClock; ///< Clock for measuring the elapsed time between frames + WindowSettings mySettings; ///< Creation settings of the window + float myLastFrameTime; ///< Time elapsed since last frame + bool myIsExternal; ///< Tell whether the window is internal or external (created by SFML or not) + unsigned int myFramerateLimit; ///< Current framerate limit + int mySetCursorPosX; ///< X coordinate passed to the last call to SetCursorPosition + int mySetCursorPosY; ///< Y coordinate passed to the last call to SetCursorPosition +}; + +} // namespace sf + + +#endif // SFML_WINDOW_HPP diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp new file mode 100644 index 00000000..0baf923e --- /dev/null +++ b/include/SFML/Window/WindowHandle.hpp @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWHANDLE_HPP +#define SFML_WINDOWHANDLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Define a low-level window handle type, specific to +/// each platform +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + // Windows defines a void* handle (HWND) + typedef void* WindowHandle; + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + // Unix - X11 defines an unsigned integer handle (Window) + typedef unsigned long WindowHandle; + +#elif defined(SFML_SYSTEM_MACOS) + + // Mac OS X defines a void* handle (NSWindow) + typedef void* WindowHandle; + +#endif + +} // namespace sf + + +#endif // SFML_WINDOWHANDLE_HPP diff --git a/include/SFML/Window/WindowListener.hpp b/include/SFML/Window/WindowListener.hpp new file mode 100644 index 00000000..244f6fe7 --- /dev/null +++ b/include/SFML/Window/WindowListener.hpp @@ -0,0 +1,66 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWLISTENER_HPP +#define SFML_WINDOWLISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +class Event; + +//////////////////////////////////////////////////////////// +/// Base class for classes that want to receive events +/// from a window (for internal use only) +//////////////////////////////////////////////////////////// +class SFML_API WindowListener +{ +public : + + //////////////////////////////////////////////////////////// + /// Called each time an event is received from attached window + /// + /// \param EventReceived : Event received + /// + //////////////////////////////////////////////////////////// + virtual void OnEvent(const Event& EventReceived) = 0; + +protected : + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~WindowListener() {} +}; + +} // namespace sf + + +#endif // SFML_WINDOWLISTENER_HPP diff --git a/include/SFML/Window/WindowSettings.hpp b/include/SFML/Window/WindowSettings.hpp new file mode 100644 index 00000000..05e89624 --- /dev/null +++ b/include/SFML/Window/WindowSettings.hpp @@ -0,0 +1,62 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWSETTINGS_HPP +#define SFML_WINDOWSETTINGS_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Structure defining the creation settings of windows +//////////////////////////////////////////////////////////// +struct WindowSettings +{ + //////////////////////////////////////////////////////////// + /// Default constructor + /// + /// \param Depth : Depth buffer bits (24 by default) + /// \param Stencil : Stencil buffer bits (8 by default) + /// \param Antialiasing : Antialiasing level (0 by default) + /// + //////////////////////////////////////////////////////////// + explicit WindowSettings(unsigned int Depth = 24, unsigned int Stencil = 8, unsigned int Antialiasing = 0) : + DepthBits (Depth), + StencilBits (Stencil), + AntialiasingLevel(Antialiasing) + { + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int DepthBits; ///< Bits of the depth buffer + unsigned int StencilBits; ///< Bits of the stencil buffer + unsigned int AntialiasingLevel; ///< Level of antialiasing +}; + +} // namespace sf + + +#endif // SFML_WINDOWSETTINGS_HPP diff --git a/include/SFML/Window/WindowStyle.hpp b/include/SFML/Window/WindowStyle.hpp new file mode 100644 index 00000000..159b999f --- /dev/null +++ b/include/SFML/Window/WindowStyle.hpp @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWSTYLE_HPP +#define SFML_WINDOWSTYLE_HPP + + +namespace sf +{ + +//////////////////////////////////////////////////////////// +/// Enumeration of window creation styles +//////////////////////////////////////////////////////////// +namespace Style +{ + enum + { + None = 0, ///< No border / title bar (this flag and all others are mutually exclusive) + Titlebar = 1 << 0, ///< Title bar + fixed border + Resize = 1 << 1, ///< Titlebar + resizable border + maximize button + Close = 1 << 2, ///< Titlebar + close button + Fullscreen = 1 << 3 ///< Fullscreen mode (this flag and all others are mutually exclusive) + }; +} + + +} // namespace sf + + +#endif // SFML_WINDOWSTYLE_HPP diff --git a/license.txt b/license.txt new file mode 100644 index 00000000..9c00a750 --- /dev/null +++ b/license.txt @@ -0,0 +1,39 @@ +SFML +---- + +SFML - Copyright (c) 2007 Laurent Gomila - laurent.gom@gmail.com + +This software is provided 'as-is', without any express or +implied warranty. In no event will the authors be held +liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute +it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; + you must not claim that you wrote the original software. + If you use this software in a product, an acknowledgment + in the product documentation would be appreciated but + is not required. + +2. Altered source versions must be plainly marked as such, + and must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any + source distribution. + + + +External libraries used by SFML +------------------------------- + +* GLEW is under the BSD license, the SGI license or the GLX license +* OpenAL-Soft is under the LGPL license +* libsndfile is under the LGPL license +* stb_vorbis is public domain +* libjpeg is public domain +* libpng is under the zlib/png license +* zlib is under the zlib/png license +* SOIL is public domain +* freetype is under the FreeType license or the GPL license diff --git a/python/MANIFEST.in b/python/MANIFEST.in new file mode 100644 index 00000000..c9cdb5f5 --- /dev/null +++ b/python/MANIFEST.in @@ -0,0 +1,10 @@ +graft src +graft scripts +include doc/style.css +include samples/opengl.py +include samples/sound.py +include samples/sound_capture.py +include samples/sound_stream.py +include samples/worm.py +graft samples/data + diff --git a/python/PKG-INFO b/python/PKG-INFO new file mode 100644 index 00000000..7d48fe13 --- /dev/null +++ b/python/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: PySFML +Version: 1.4 +Summary: Python binding for SFML (Simple and Fast Multimedia Library) +Home-page: http://sfml.sourceforge.net/ +Author: Rémi Koenig +Author-email: remi.k2620@gmail.com +License: zlib/png +Description: UNKNOWN +Platform: UNKNOWN diff --git a/python/PySFML/__init__.py b/python/PySFML/__init__.py new file mode 100644 index 00000000..79d6660f --- /dev/null +++ b/python/PySFML/__init__.py @@ -0,0 +1,2 @@ +import sf + diff --git a/python/doc/style.css b/python/doc/style.css new file mode 100644 index 00000000..0a59e690 --- /dev/null +++ b/python/doc/style.css @@ -0,0 +1,96 @@ +div#logo +{ + margin-bottom : 1em; + background : url("http://www.sfml-dev.org/images/logo-bg.jpg") repeat-x; +} + +div#logo a +{ + display : block; +} + +div.class_desc +{ + margin-left:10px; + font-weight: bolder; + color:#168; +} + +div.base_class +{ + margin-top:8px; + margin-left:10px; + font-weight: bold; + color:#168; +} + +div.attr_name +{ + margin-top:20px; + margin-left:10px; + font-weight: bolder; +} + +div.inherited +{ + margin-left:20px; + font-size: smaller; +} + +div.desc +{ + margin-left:20px; +} + +div.event_member +{ + margin-left:30px; + font-weight: lighter; +} + +p#footer +{ + text-decoration : overline; + color : #606060; + padding-top : 1em; + text-align : center; + font-size : smaller; +} + +p#footer a +{ + color : #007298; + text-decoration : none; +} + +H1 { + text-align : center; + margin-top : 0px; + color : #2090B0; + font-size : 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} + +a { + color: #2090B0; +} +a:visited { + color: #2090B0; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} + diff --git a/python/samples/data/apple.png b/python/samples/data/apple.png new file mode 100644 index 00000000..0cfb031d Binary files /dev/null and b/python/samples/data/apple.png differ diff --git a/python/samples/data/fart.wav b/python/samples/data/fart.wav new file mode 100644 index 00000000..b265837a Binary files /dev/null and b/python/samples/data/fart.wav differ diff --git a/python/samples/data/rond2.png b/python/samples/data/rond2.png new file mode 100644 index 00000000..8d36b1d6 Binary files /dev/null and b/python/samples/data/rond2.png differ diff --git a/python/samples/libsndfile-1.dll b/python/samples/libsndfile-1.dll new file mode 100644 index 00000000..f112de2b Binary files /dev/null and b/python/samples/libsndfile-1.dll differ diff --git a/python/samples/opengl.py b/python/samples/opengl.py new file mode 100644 index 00000000..6442b839 --- /dev/null +++ b/python/samples/opengl.py @@ -0,0 +1,166 @@ +#!/usr/bin/python + +from PySFML import * + +from OpenGL.GL import * +from OpenGL.GLUT import * +from OpenGL.GLU import * + + +def main(): + + # Create main window + App = sf.RenderWindow(sf.VideoMode(800, 600), "SFML OpenGL") + App.PreserveOpenGLStates(True) + + # Create a sprite for the background + BackgroundImage = sf.Image() + if not BackgroundImage.LoadFromFile("../../samples/bin/datas/opengl/background.jpg"): + return + Background = sf.Sprite(BackgroundImage) + + # Load an OpenGL texture. + # We could directly use a sf.Image as an OpenGL texture (with its Bind() member function), + # but here we want more control on it (generate mipmaps, ...) so we create a new one + + Image = sf.Image() + if not Image.LoadFromFile("../../samples/bin/datas/opengl/texture.jpg"): + return + # The next line is a bit different from the C++ version + Texture = glGenTextures(1) # instead of glGenTextures(1, &Texture); + glBindTexture(GL_TEXTURE_2D, Texture) + # It is almost the same line there, except in C++, the last argument was Image.GetPixelsPtr(). + # With GetPixelsPtr, PySFML returns a PyCObject: "an opaque value, useful for C extension + # modules who need to pass an opaque value (as a void* pointer) through Python code to other C code". + # However, gluBuild2DMipmaps' python version takes a string as last argument (which is normally a + # pointer to pixels data). This is why Image.GetPixelsPtr is replaced by Image.GetPixelsString. + # This function (that doesn't exist in C++ SFML) returns a string that contains the pixels data. + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Image.GetWidth(), Image.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, Image.GetPixels()) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) + + + # Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST) + glDepthMask(GL_TRUE) + glClearDepth(1.) + + # Setup a perspective projection + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + gluPerspective(90., 1., 1., 500.) + + # Bind our texture + glEnable(GL_TEXTURE_2D) + glBindTexture(GL_TEXTURE_2D, Texture) + glColor4f(1., 1., 1., 1.) + + # Create a clock for measuring the time elapsed + Clock = sf.Clock() + + # Start game loop + while App.IsOpened(): + # Process events + Event = sf.Event() + while App.GetEvent(Event): + # Close window : exit + if Event.Type == sf.Event.Closed: + App.Close() + + # Escape key : exit + if (Event.Type == sf.Event.KeyPressed) and (Event.Key.Code == sf.Key.Escape): + App.Close() + + # Adjust the viewport when the window is resized + if Event.Type == sf.Event.Resized: + glViewport(0, 0, Event.Size.Width, Event.Size.Height); + + # Draw background + App.Draw(Background) + + # Clear depth buffer + glClear(GL_DEPTH_BUFFER_BIT) + + # Apply some transf.ormations + glMatrixMode(GL_MODELVIEW) + glLoadIdentity() + glTranslatef(0, 0, -200) + glRotatef(Clock.GetElapsedTime() * 50, 1, 0, 0) + glRotatef(Clock.GetElapsedTime() * 30, 0, 1, 0) + glRotatef(Clock.GetElapsedTime() * 90, 0, 0, 1) + + # Draw a cube + glBegin(GL_QUADS) + + glTexCoord2f(0, 0) + glVertex3f(-50., -50., -50.) + glTexCoord2f(0, 1) + glVertex3f(-50., 50., -50.) + glTexCoord2f(1, 1) + glVertex3f( 50., 50., -50.) + glTexCoord2f(1, 0) + glVertex3f( 50., -50., -50.) + + glTexCoord2f(0, 0) + glVertex3f(-50., -50., 50.) + glTexCoord2f(0, 1) + glVertex3f(-50., 50., 50.) + glTexCoord2f(1, 1) + glVertex3f( 50., 50., 50.) + glTexCoord2f(1, 0) + glVertex3f( 50., -50., 50.) + + glTexCoord2f(0, 0) + glVertex3f(-50., -50., -50.) + glTexCoord2f(0, 1) + glVertex3f(-50., 50., -50.) + glTexCoord2f(1, 1) + glVertex3f(-50., 50., 50.) + glTexCoord2f(1, 0) + glVertex3f(-50., -50., 50.) + + glTexCoord2f(0, 0) + glVertex3f(50., -50., -50.) + glTexCoord2f(0, 1) + glVertex3f(50., 50., -50.) + glTexCoord2f(1, 1) + glVertex3f(50., 50., 50.) + glTexCoord2f(1, 0) + glVertex3f(50., -50., 50.) + + glTexCoord2f(0, 1) + glVertex3f(-50., -50., 50.) + glTexCoord2f(0, 0) + glVertex3f(-50., -50., -50.) + glTexCoord2f(1, 0) + glVertex3f( 50., -50., -50.) + glTexCoord2f(1, 1) + glVertex3f( 50., -50., 50.) + + glTexCoord2f(0, 1) + glVertex3f(-50., 50., 50.) + glTexCoord2f(0, 0) + glVertex3f(-50., 50., -50.) + glTexCoord2f(1, 0) + glVertex3f( 50., 50., -50.) + glTexCoord2f(1, 1) + glVertex3f( 50., 50., 50.) + + glEnd() + + # Draw some text on top of our OpenGL object + Text = sf.String("This is a rotating cube") + Text.SetPosition(230., 300.) + Text.SetColor(sf.Color(128, 0, 128)) + App.Draw(Text) + + # Finally, display the rendered frame on screen + App.Display() + + # Don't forget to destroy our texture + # In C++, the call to this function was a bit different + glDeleteTextures(Texture) # instead of glDeleteTextures(1, &Texture); + + return +main() + diff --git a/python/samples/sound.py b/python/samples/sound.py new file mode 100644 index 00000000..64874067 --- /dev/null +++ b/python/samples/sound.py @@ -0,0 +1,43 @@ +#!/usr/bin/python + +# You can notice that here we use PySFML.sf instead of just PySFML +# Therefore it won't be needed to put sf. in front of SFML classes + +from PySFML.sf import * + + +def Main(): + Buffer = SoundBuffer() + if not Buffer.LoadFromFile("data/fart.wav"): # Loads the sound + return + Fart = Sound(Buffer, False) + + WindowWidth, WindowHeight = 640, 480 + App = RenderWindow(VideoMode(WindowWidth,WindowHeight,32), "Sound with PySFML", Style.Close, WindowSettings(24,8,0)) + App.SetFramerateLimit(30) + + EventHandler = Event() + InputHandler = App.GetInput() + + Text = String("Turn the sound on.\nClick anywhere on the screen.\nMove the mouse. Click again.\nTry clicking in the corners.") + Text.SetX(30.) + Text.SetY(20.) + Text.SetColor(Color(150, 100, 10, 255)) + + while App.IsOpened(): # Main loop + while App.GetEvent(EventHandler): # Event Handler + if EventHandler.Type == Event.Closed: + App.Close() + if EventHandler.Type == Event.KeyPressed and EventHandler.Key.Code == Key.Escape: + App.Close() + if EventHandler.Type == Event.MouseButtonPressed and EventHandler.MouseButton.Button == Mouse.Left: + Fart.SetPitch(1.5 - 1.*InputHandler.GetMouseY()/WindowHeight) + Fart.SetPosition( 1.*(InputHandler.GetMouseX() - WindowWidth/2)/(WindowWidth/20), 2., -2.) + Fart.Play() + App.Draw(Text) + App.Display() + App.Clear(Color.Black) + + +Main() + diff --git a/python/samples/sound_capture.py b/python/samples/sound_capture.py new file mode 100644 index 00000000..bfb24d0a --- /dev/null +++ b/python/samples/sound_capture.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +from PySFML import * + +def Main(): + # Check that the device can capture audio + if sf.SoundRecorder.CanCapture() == False: + print "Sorry, audio capture is not supported by your system" + return + + # Choose the sample rate + SampleRate = 0 + SampleRate = int(raw_input("Please choose the sample rate for sound capture (44100 is CD quality) : ")) + + # Wait for user input... + print "Press enter to start recording audio" + raw_input() + + # Here we'll use an integrated custom recorder, which saves the captured data into a sfSoundBuffer + Recorder = sf.SoundBufferRecorder() + + # Audio capture is done in a separate thread, so we can block the main thread while it is capturing + Recorder.Start(SampleRate) + print "Recording... press enter to stop" + raw_input() + Recorder.Stop() + + # Get the buffer containing the captured data + Buffer = Recorder.GetBuffer() + + # Display captured sound informations + print "Sound information :" + print " " + str(Buffer.GetDuration()) + " seconds" + print " " + str(Buffer.GetSampleRate()) + " samples / seconds" + print " " + str(Buffer.GetChannelsCount()) + " channels" + + # Choose what to do with the recorded sound data + Choice = str(raw_input("What do you want to do with captured sound (p = play, s = save) ? ")) + + if Choice == 's': + # Choose the filename + Filename = str(raw_input("Choose the file to create : ")) + + # Save the buffer + Buffer.SaveToFile(Filename); + else: + # Create a sound instance and play it + Sound = sf.Sound(Buffer) + Sound.Play() + + # Wait until finished + while Sound.GetStatus() == sf.Sound.Playing: + # Display the playing position - I don't know how to do this in python + # std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Sound.GetPlayingOffset() << " sec"; + + # Leave some CPU time for other threads + sf.Sleep(0.1) + + # Finished ! + print "Done !" + + # Wait until the user presses 'enter' key + print "Press enter to exit..." + raw_input() + + return + +Main() diff --git a/python/samples/sound_stream.py b/python/samples/sound_stream.py new file mode 100755 index 00000000..e3d588be --- /dev/null +++ b/python/samples/sound_stream.py @@ -0,0 +1,49 @@ +#!/usr/bin/python + +from PySFML import sf + +class MyCustomStream(sf.SoundStream): + + def Open(self, Filename): + # Load the sound data into a sound buffer + self.SoundData = sf.SoundBuffer() + if not self.SoundData.LoadFromFile(Filename): + return False + # Initialize the stream with the sound parameters + self.Initialize(self.SoundData.GetChannelsCount(), self.SoundData.GetSampleRate()) + # Copy the audio samples into our internal array + self.myBuffer = self.SoundData.GetSamples() + return True + + def OnStart(self): + self.myOffset = 0 + self.myBufferSize = 80000 + return True + + def OnGetData(self): + # Check if there is enough data to stream + if self.myOffset > len(self.myBuffer): + # Returning something else than a string means that we want to stop playing the stream + return False + # Data contains the string of samples we will return + if self.myOffset + self.myBufferSize >= len(self.myBuffer): + print "End of audio data reached" + Data = self.myBuffer[self.myOffset:] + else: + Data = self.myBuffer[self.myOffset:self.myOffset+self.myBufferSize] + # Update the offset + self.myOffset = self.myBufferSize + self.myOffset + return Data + +def Main(): + Stream = MyCustomStream() + Stream.Open("./data/fart.wav") + Stream.Play() + print "Playing 5 seconds of audio data..." + sf.Sleep(5) + Stream.Stop() + print "Press enter to exit..." + raw_input() + +Main() + diff --git a/python/samples/worm.py b/python/samples/worm.py new file mode 100644 index 00000000..25a1c6c3 --- /dev/null +++ b/python/samples/worm.py @@ -0,0 +1,240 @@ +#!/usr/bin/python + +from PySFML import * +import math +import random +import sys + + +def Game(Difficulty): + + PartsPerFrame = 1 + Difficulty # Number of drawn base parts each frame + PartsSpacing = 3 # Each worm's base part is separated by PartsSpacing pixels + TurnStep = 0.15 # Turn the worm's head of 0.15 rad + + PartSize = 6.0 # worm's base part size for collision + PartRealSize = 18.0 # worm's real base part size for drawing + + # Load images + Rond = sf.Image() # Image containing the base part of the worm + if not Rond.LoadFromFile("./data/rond2.png"): + print "Could not load data/rond2.png" + return + WormPart = sf.Sprite(Rond) + WormPart.SetCenter(Rond.GetWidth()/2, Rond.GetHeight()/2) + AppleImg = sf.Image() # Apple's image + if not AppleImg.LoadFromFile("./data/apple.png"): + print "Could not load data/apple.png" + return + Apple = sf.Sprite(AppleImg, 0, 0, 1, 1, 0) # Corresponding sprite + Black = sf.Color(0,0,0,255) + UglyYellow = sf.Color(220, 220, 20, 255) + + Stop = False + + Event = sf.Event() # Our events manager + + Level = 0 + ShrinkValue = 20 + + Border = 30 + ArenaTop = 20 + ArenaBottom = 520 + + RequiredLength = 300 + + ExitLeft = 350 + ExitRight = 450 + ExitImg = sf.Image(ExitRight-ExitLeft, ArenaTop, Black) + Exit = sf.Sprite(ExitImg, ExitLeft, 0, 1, 1, 0) + + Score = 0 + + HeadX, HeadY = 0, 0 + + while not Stop: + + #Initialize a new game + + Level += 1 + + ArenaLeft = ShrinkValue*Level + ArenaRight = 800-ShrinkValue*Level + ArenaImg = sf.Image(ArenaRight-ArenaLeft, ArenaBottom-ArenaTop, Black) + Arena = sf.Sprite(ArenaImg, ArenaLeft, ArenaTop, 1, 1, 0) + + AppleX, AppleY = random.randrange(ArenaLeft+Border, ArenaRight-Border), random.randrange(ArenaTop+Border, ArenaBottom-Border) + Apple.SetX(AppleX - AppleImg.GetWidth()/2) # We move the apple to somewhere else, randomly + Apple.SetY(AppleY - AppleImg.GetHeight()/2) + + Crash = False + Running = True + + LevelStr = sf.String("Level: " + str(Level)) + LevelStr.SetPosition(60., 540.) + LevelStr.SetColor(UglyYellow) + + ScoreStr = sf.String("Score: 0") + ScoreStr.SetPosition(260., 540.) + ScoreStr.SetColor(UglyYellow) + + Length = 1 + TargetedLength = 30 + + Worm = [[ArenaLeft+50., ArenaTop+50.]] + + Angle = 0 + i = 0 + Dir = 0 + + while Running: # Game main loop + while App.GetEvent(Event): # Event Handler + if Event.Type == sf.Event.Closed: + App.Close() + return + if Event.Type == sf.Event.KeyPressed: + if Event.Key.Code == sf.Key.Escape: + Running = False + Stop = True + if Event.Key.Code == sf.Key.Left: + Dir = -1 + if Event.Key.Code == sf.Key.Right: + Dir = 1 + if Crash and Length<=1: + Running = False + if Event.Type == sf.Event.KeyReleased: + if Event.Key.Code == sf.Key.Left and Dir == -1: + Dir = 0 + if Event.Key.Code == sf.Key.Right and Dir == 1: + Dir = 0 + + App.Draw(Arena) + + + if not Crash: # Create new parts and check collisions if the worm hasn't crashed yet + for i in range(0, PartsPerFrame): # We create PartsPerFrame Worm's parts + Angle += Dir*TurnStep + HeadX, HeadY = Worm[Length-1][0]+PartsSpacing*math.cos(Angle), Worm[Length-1][1]+PartsSpacing*math.sin(Angle) + if TargetedLength <= RequiredLength: + if math.sqrt ( (AppleX - HeadX)**2 + (AppleY - HeadY)**2 ) < 14 + PartSize/2: # The Worm ate the apple + Score += 1 + TargetedLength += 20 # The worm gets longer + if TargetedLength <= RequiredLength: + AppleX, AppleY = random.randrange(ArenaLeft+Border, ArenaRight-Border), random.randrange(ArenaTop+Border, ArenaBottom-Border) + Apple.SetX(AppleX - AppleImg.GetWidth()/2) # We move the apple to somewhere else, randomly + Apple.SetY(AppleY - AppleImg.GetHeight()/2) + App.Draw(Apple) + + if HeadXArenaRight-PartSize/2 or HeadYArenaBottom-PartSize/2: # Crash into a wall + if Length > RequiredLength: + if HeadYExitRight-PartSize/2: + Crash = True + elif HeadY < 0: + Length = 0 + Running = False # Level completed! + else: + Crash = True + elif Running: + Crash = True + if not Crash: + Worm.append([HeadX, HeadY]) + Length += 1 + + + if TargetedLength > RequiredLength: + App.Draw(Exit) + + if Length >= TargetedLength: + Worm[0:TargetedLength] = Worm[Length-TargetedLength:Length] + for i in range(Length, TargetedLength): + del Worm[i] + Worm[TargetedLength:Length] = [] + Length = TargetedLength + + for i in range(0, Length): + WormPart.SetPosition(Worm[i][0], Worm[i][1]) + App.Draw(WormPart) # Draw the part on screen + if i < Length - PartSize/PartsSpacing - 1: + if math.sqrt( (HeadX-Worm[i][0])**2 + (HeadY-Worm[i][1])**2 ) < PartSize and Running: # Check for collision + Crash = True + + if Crash and Length>0: + TargetedLength -= PartsPerFrame + + + ScoreStr.SetText("Score: " + str(Score)) + + App.Draw(ScoreStr) + App.Draw(LevelStr) + App.Display() # Refresh Screen + App.Clear(BGColor) + + + # End of the game + if Crash: + Level = 0 + Score = 0 + else: + Score += 5 # End level bonus + + del Worm + del Arena + del ArenaImg + +def Menu(): + + Selection = 0 + + TextColor = sf.Color(220, 220, 20, 255) + + Running = True + Event = sf.Event() + + Title = sf.String("PyWorm!") + Title.SetX(320.) + Title.SetY(50.) + Title.SetColor(TextColor) + + Levels = ["Very Easy", "Easy", "Medium", "Hard"] + Xs = [320., 350., 330., 350.] + Strings = [0,0,0,0] + for i in range(0, 4): + Strings[i] = sf.String(Levels[i]) + Strings[i].SetColor(TextColor) + Strings[i].SetPosition(Xs[i], 200. + 80*i) + + RectangleImg = sf.Image(ScreenWidth, 40, sf.Color(50,50,10,255)) + Rectangle = sf.Sprite(RectangleImg, 0, 350, 1, 1, 0) + + while App.IsOpened(): # Game main loop + while App.GetEvent(Event): # Event Handler + if Event.Type == sf.Event.Closed: + App.Close() + if Event.Type == sf.Event.KeyPressed: + if Event.Key.Code == sf.Key.Escape: + App.Close() + elif Event.Key.Code == sf.Key.Up: + Selection = (Selection - 1) % 4 + elif Event.Key.Code == sf.Key.Down: + Selection = (Selection + 1) % 4 + elif Event.Key.Code == sf.Key.Return: + Game(Selection) + + Rectangle.SetY(200 + Selection*80) + App.Draw(Rectangle) + App.Draw(Title) + for i in range(0,4): + App.Draw(Strings[i]) + App.Display() + App.Clear(BGColor) + + + +# Initialize the window +ScreenWidth, ScreenHeight = 800, 600 +App = sf.RenderWindow(sf.VideoMode(ScreenWidth,ScreenHeight,32), "PyWorm", sf.Style.Close) # Creates the window +BGColor = sf.Color(100,100,0,255) +App.SetFramerateLimit(30) +Menu() + diff --git a/python/scripts/footer.htm b/python/scripts/footer.htm new file mode 100644 index 00000000..77030f7c --- /dev/null +++ b/python/scripts/footer.htm @@ -0,0 +1,7 @@ + + + + + diff --git a/python/scripts/gen_doc.py b/python/scripts/gen_doc.py new file mode 100755 index 00000000..99e4721e --- /dev/null +++ b/python/scripts/gen_doc.py @@ -0,0 +1,118 @@ +#!/usr/bin/python +# coding=UTF-8 + +from PySFML import sf + +# Amélioration à faire : trouver les méthodes héritées, et de quelle classe + +def function_str(function, class_name=None): + string = '' + name = function.__name__ + doc = function.__doc__ + if not doc.startswith(name+'('): + string += name+"(...)"+'\n' + string += doc+'\n' + strings = string.split('\n') + strings[0] = '
'+strings[0]+'
\n
' + string = strings[0] + for s in strings[1:-1]: + string += s + '
' + string += strings[-1] + inherited = '' + if class_name != None: + try: + base_class_name = function.__objclass__.__name__ + if base_class_name != class_name: + inherited = '
Inherited
\n' + except AttributeError: + pass + return string.replace('\t', '    ')+'
\n'+inherited + +class FilesManager: + def __init__(self): + self.files = {} + f = open("header.htm") + self.header = f.read() + f.close() + f = open("footer.htm") + self.footer = f.read() + f.close() + + def add(self, filename, string): + if not self.files.has_key(filename): + self.files[filename] = open('../doc/' + filename + '.html', 'w') + self.files[filename].write(self.header.replace('TITLE', filename)) + self.files[filename].write(string) + + def __del__(self): + for filename in self.files: + self.files[filename].write(self.footer) + self.files[filename].close() + + +def Main(): + + fm = FilesManager() + + fm.add('index', '

PySFML index

\n') + + fm.add('index', '

Classes

\n') + + module_methods = "" + module_constants = "" + + for m in dir(sf): + if not m.startswith('__'): + if m == 'Event': + attr = sf.Event() + else: + attr = getattr(sf, m) + if type(attr) == str: + module_constants += '
'+m+'
\n
"'+attr+'"
\n' + elif str(type(attr)) == "" or str(type(attr)) == "": + module_methods += function_str(attr) + else: + fm.add('index', ''+m+'
\n') + info = {'Attributes':'', 'Constants':'', 'Methods':'', 'Static methods':''} + members = "" + constants = "" + static_methods = "" + methods = "" + for n in dir(attr): + if not n.startswith('__'): + attr2 = getattr(attr, n) + if str(type(attr2)) == "": # member + info['Attributes'] += '
'+n+'
\n
'+attr2.__doc__+'
\n' + elif type(attr2) == long: + info['Attributes'] += '
'+n+'
\n' + elif type(attr2) == int or type(attr2) == sf.Color: # int or color (constant) + info['Constants'] += '
'+n+'
\n' + elif str(type(attr2)) == "": # static method + info['Static methods'] += function_str(attr2, m) + elif str(type(attr2)) == "": # method + info['Methods'] += function_str(attr2, m) + elif str(type(attr2)).startswith("\n
' + attr2.__doc__+'
\n' + for o in dir(attr2): + if not o.startswith('__'): + attr3 = getattr(attr2, o) + info['Attributes'] += '
> ' + o + '
\n' + else: + print "Warning : unknown type for " + n + " " + str(type(attr2)) + fm.add(m, '

sf.'+m+' Class Reference

\n') + fm.add(m, '
'+attr.__doc__.replace('\n', '
\n').replace('\t', '    ')+'
\n') + if m != 'Event': + base = attr.__base__.__name__ + if base != 'object': + fm.add(m, '
Base class: sf.'+base+'.
\n') + for t in info: + if info[t] != '': + fm.add(m, '

'+t+'

\n'+info[t]+'
\n') + fm.add(m, '
\n
\n') + + fm.add('index', '

Module methods

\n' + module_methods) + + fm.add('index', '

Module constants

\n' + module_constants) + +Main() + diff --git a/python/scripts/header.htm b/python/scripts/header.htm new file mode 100644 index 00000000..f335b428 --- /dev/null +++ b/python/scripts/header.htm @@ -0,0 +1,11 @@ + + + + PySFML - Python binding for SFML (Simple and Fast Multimedia Library) - TITLE + + + + + diff --git a/python/setup.py b/python/setup.py new file mode 100644 index 00000000..125ed275 --- /dev/null +++ b/python/setup.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# coding=UTF-8 + +from distutils.core import setup, Extension + +setup(name='PySFML', + version='1.4', + description='Python binding for SFML (Simple and Fast Multimedia Library)', + author='Rémi Koenig', + author_email='remi.k2620@gmail.com', + url='http://www.sfml-dev.org/', + license='zlib/png', + ext_modules=[ Extension('PySFML.sf', \ + ['src/Clock.cpp', 'src/Color.cpp', 'src/Drawable.cpp', \ + 'src/Event.cpp', 'src/Image.cpp', 'src/Input.cpp', 'src/Key.cpp', 'src/main.cpp', \ + 'src/Music.cpp', 'src/PostFX.cpp', 'src/Rect.cpp', 'src/RenderWindow.cpp', 'src/Sleep.cpp', \ + 'src/Sprite.cpp', 'src/String.cpp', 'src/VideoMode.cpp', 'src/View.cpp', 'src/Window.cpp', \ + 'src/Joy.cpp', 'src/Mouse.cpp', 'src/WindowStyle.cpp', 'src/Blend.cpp', 'src/Sound.cpp', \ + 'src/SoundBuffer.cpp', 'src/Listener.cpp', 'src/SoundRecorder.cpp', 'src/SoundBufferRecorder.cpp', \ + 'src/SoundStream.cpp', 'src/Font.cpp', 'src/Glyph.cpp', 'src/Shape.cpp', 'src/WindowSettings.cpp' ], \ + libraries=['sfml-graphics', 'sfml-window', 'sfml-audio', 'sfml-system'], \ + library_dirs=['../lib/mingw'], \ + include_dirs=['../include'] + )], + package_dir = {'PySFML':'PySFML'}, + packages=['PySFML'], + ) diff --git a/python/src/Blend.cpp b/python/src/Blend.cpp new file mode 100644 index 00000000..7398e462 --- /dev/null +++ b/python/src/Blend.cpp @@ -0,0 +1,136 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include + +#include +#include + +#include "Blend.hpp" + + +typedef struct { + PyObject_HEAD +} PySfBlend; + + + +static PyMemberDef PySfBlend_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfBlend_dealloc(PySfBlend *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfBlend_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfBlend *self; + + self = (PySfBlend *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfBlend_init(PySfBlend *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +static PyMethodDef PySfBlend_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfBlendType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Blend", /*tp_name*/ + sizeof(PySfBlend), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfBlend_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Enumerate the blending modes for drawable objects.\n\ +Alpha Pixel = Src * a + Dest * (1 - a).\n\ +Add Pixel = Src + Dest.\n\ +Multiply Pixel = Src * Dest.\n\ +None No blending.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfBlend_methods, /* tp_methods */ + PySfBlend_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfBlend_init, /* tp_init */ + 0, /* tp_alloc */ + PySfBlend_new, /* tp_new */ +}; + +void PySfBlend_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Blend::Alpha); + PyDict_SetItemString(PySfBlendType.tp_dict, "Alpha", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Blend::Add); + PyDict_SetItemString(PySfBlendType.tp_dict, "Add", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Blend::Multiply); + PyDict_SetItemString(PySfBlendType.tp_dict, "Multiply", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Blend::None); + PyDict_SetItemString(PySfBlendType.tp_dict, "None", obj); + Py_DECREF(obj); +} + diff --git a/python/src/Blend.hpp b/python/src/Blend.hpp new file mode 100644 index 00000000..e47ed9c5 --- /dev/null +++ b/python/src/Blend.hpp @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYBLEND_HPP +#define __PYBLEND_HPP + +void +PySfBlend_InitConst(); + +#endif diff --git a/python/src/Clock.cpp b/python/src/Clock.cpp new file mode 100644 index 00000000..7c28c314 --- /dev/null +++ b/python/src/Clock.cpp @@ -0,0 +1,130 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Clock.hpp" + + +typedef struct { + PyObject_HEAD + sf::Clock *obj; +} PySfClock; + + + +static PyMemberDef PySfClock_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfClock_dealloc(PySfClock *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfClock_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfClock *self; + + self = (PySfClock *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfClock_init(PySfClock *self, PyObject *args, PyObject *kwds) +{ + self->obj = new sf::Clock(); + return 0; +} + + +static PyObject* +PySfClock_GetElapsedTime(PySfClock *self) +{ + return PyFloat_FromDouble(self->obj->GetElapsedTime()); +} + +static PyObject* +PySfClock_Reset(PySfClock *self) +{ + self->obj->Reset(); + Py_RETURN_NONE; +} + +static PyMethodDef PySfClock_methods[] = { + {"GetElapsedTime", (PyCFunction)PySfClock_GetElapsedTime, METH_NOARGS, "GetElapsedTime()\nGet the time elapsed since last reset."}, + {"Reset", (PyCFunction)PySfClock_Reset, METH_NOARGS, "Reset()\nRestart the timer."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfClockType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Clock", /*tp_name*/ + sizeof(PySfClock), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfClock_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Clock is an utility class for manipulating time.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfClock_methods, /* tp_methods */ + PySfClock_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfClock_init, /* tp_init */ + 0, /* tp_alloc */ + PySfClock_new, /* tp_new */ +}; + + diff --git a/python/src/Clock.hpp b/python/src/Clock.hpp new file mode 100644 index 00000000..4b2c9d8c --- /dev/null +++ b/python/src/Clock.hpp @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYCLOCK_HPP +#define __PYCLOCK_HPP + + +#include +#include + +#include +#include + +#endif diff --git a/python/src/Color.cpp b/python/src/Color.cpp new file mode 100644 index 00000000..30e428ee --- /dev/null +++ b/python/src/Color.cpp @@ -0,0 +1,231 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Color.hpp" + +static PyMemberDef PySfColor_members[] = { + {(char *)"r", T_UBYTE, offsetof(PySfColor, r), 0, (char *)"Red component."}, + {(char *)"g", T_UBYTE, offsetof(PySfColor, g), 0, (char *)"Green component."}, + {(char *)"b", T_UBYTE, offsetof(PySfColor, b), 0, (char *)"Blue component."}, + {(char *)"a", T_UBYTE, offsetof(PySfColor, a), 0, (char *)"Alpha (transparency) component."}, + {NULL} /* Sentinel */ +}; + + + +static void +PySfColor_dealloc(PySfColor *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +void +PySfColorUpdate(PySfColor *self) +{ + self->obj->r = self->r; + self->obj->g = self->g; + self->obj->b = self->b; + self->obj->a = self->a; +} + +static PyObject * +PySfColor_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfColor *self; + + self = (PySfColor *)type->tp_alloc(type, 0); + + if (self != NULL) + { + self->r = 0; + self->g = 0; + self->b = 0; + self->a = 255; + } + + return (PyObject *)self; +} + + +static int +PySfColor_init(PySfColor *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"r", "g", "b", "a", NULL}; + + long int rgba=0; + + + if (PyTuple_Size(args) == 1) + { + if ( !PyArg_ParseTuple(args, "l", &rgba)) + return -1; + self->r = rgba & 0xff; + self->g = rgba>>8 & 0xff; + self->b = rgba>>16 & 0xff; + self->a = rgba>>24 & 0xff; + } + else if (PyTuple_Size(args) > 1) + if (! PyArg_ParseTupleAndKeywords(args, kwds, "BBB|B", (char **)kwlist, &(self->r), &(self->g), &(self->b), &(self->a))) + return -1; + + self->obj = new sf::Color(self->r, self->g, self->b, self->a); + + return 0; +} + +static PyMethodDef PySfColor_methods[] = { + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfColorType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Color", /*tp_name*/ + sizeof(PySfColor), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfColor_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Color is an utility class for manipulating 32-bits RGBA colors.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfColor_methods, /* tp_methods */ + PySfColor_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfColor_init, /* tp_init */ + 0, /* tp_alloc */ + PySfColor_new, /* tp_new */ +}; + +PySfColor * +GetNewPySfColor() +{ + return PyObject_New(PySfColor, &PySfColorType); +} + +void +PySfColor_InitConst() +{ + PySfColor *Black, *White, *Red, *Green, *Blue, *Yellow, *Magenta, *Cyan; + Black = GetNewPySfColor(); + Black->obj = (sf::Color *) &(sf::Color::Black); + Black->r = sf::Color::Black.r; + Black->g = sf::Color::Black.g; + Black->b = sf::Color::Black.b; + Black->a = sf::Color::Black.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Black", (PyObject *)Black); + Py_DECREF(Black); + White = GetNewPySfColor(); + White->obj = (sf::Color *) &(sf::Color::White); + White->r = sf::Color::White.r; + White->g = sf::Color::White.g; + White->b = sf::Color::White.b; + White->a = sf::Color::White.a; + PyDict_SetItemString(PySfColorType.tp_dict, "White", (PyObject *)White); + Py_DECREF(White); + Red = GetNewPySfColor(); + Red->obj = (sf::Color *) &(sf::Color::Red); + Red->r = sf::Color::Red.r; + Red->g = sf::Color::Red.g; + Red->b = sf::Color::Red.b; + Red->a = sf::Color::Red.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Red", (PyObject *)Red); + Py_DECREF(Red); + Green = GetNewPySfColor(); + Green->obj = (sf::Color *) &(sf::Color::Green); + Green->r = sf::Color::Green.r; + Green->g = sf::Color::Green.g; + Green->b = sf::Color::Green.b; + Green->a = sf::Color::Green.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Green", (PyObject *)Green); + Py_DECREF(Green); + Blue = GetNewPySfColor(); + Blue->obj = (sf::Color *) &(sf::Color::Blue); + Blue->r = sf::Color::Blue.r; + Blue->g = sf::Color::Blue.g; + Blue->b = sf::Color::Blue.b; + Blue->a = sf::Color::Blue.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Blue", (PyObject *)Blue); + Py_DECREF(Blue); + Yellow = GetNewPySfColor(); + Yellow->obj = (sf::Color *) &(sf::Color::Yellow); + Yellow->r = sf::Color::Yellow.r; + Yellow->g = sf::Color::Yellow.g; + Yellow->b = sf::Color::Yellow.b; + Yellow->a = sf::Color::Yellow.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Yellow", (PyObject *)Yellow); + Py_DECREF(Yellow); + Magenta = GetNewPySfColor(); + Magenta->obj = (sf::Color *) &(sf::Color::Magenta); + Magenta->r = sf::Color::Magenta.r; + Magenta->g = sf::Color::Magenta.g; + Magenta->b = sf::Color::Magenta.b; + Magenta->a = sf::Color::Magenta.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Magenta", (PyObject *)Magenta); + Py_DECREF(Magenta); + Cyan = GetNewPySfColor(); + Cyan->obj = (sf::Color *) &(sf::Color::Cyan); + Cyan->r = sf::Color::Cyan.r; + Cyan->g = sf::Color::Cyan.g; + Cyan->b = sf::Color::Cyan.b; + Cyan->a = sf::Color::Cyan.a; + PyDict_SetItemString(PySfColorType.tp_dict, "Cyan", (PyObject *)Cyan); + Py_DECREF(Cyan); + +/* + static const Color Black; ///< Black predefined color + static const Color White; ///< White predefined color + static const Color Red; ///< Red predefined color + static const Color Green; ///< Green predefined color + static const Color Blue; ///< Blue predefined color + static const Color Yellow; ///< Yellow predefined color + static const Color Magenta; ///< Magenta predefined color + static const Color Cyan; ///< Cyan predefined color +*/ +} + diff --git a/python/src/Color.hpp b/python/src/Color.hpp new file mode 100644 index 00000000..19379e3b --- /dev/null +++ b/python/src/Color.hpp @@ -0,0 +1,55 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYCOLOR_HPP +#define __PYCOLOR_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; + sf::Color *obj; +} PySfColor; + +PySfColor * +GetNewPySfColor(); + +void +PySfColorUpdate(PySfColor *self); + +void +PySfColor_InitConst(); + +#endif diff --git a/python/src/Drawable.cpp b/python/src/Drawable.cpp new file mode 100644 index 00000000..347e7f73 --- /dev/null +++ b/python/src/Drawable.cpp @@ -0,0 +1,305 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Drawable.hpp" + +void CustomDrawable::Render (sf::RenderTarget& Target) const +{ + if (RenderFunction) + PyObject_CallFunction(RenderFunction, (char *)"O", RenderWindow); +} + + +extern PyTypeObject PySfColorType; + +static PyMemberDef PySfDrawable_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfDrawable_dealloc(PySfDrawable *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfDrawable_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfDrawable *self; + + self = (PySfDrawable *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfDrawable_init(PySfDrawable *self, PyObject *args, PyObject *kwds) +{ + self->obj = new CustomDrawable(); + return 0; +} +static PyObject * +PySfDrawable_SetX(PySfDrawable* self, PyObject *args) +{ + self->obj->SetX(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_SetY(PySfDrawable* self, PyObject *args) +{ + self->obj->SetY(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_SetScale(PySfDrawable* self, PyObject *args) +{ + float ScaleX, ScaleY; + if ( !PyArg_ParseTuple(args, "ff", &ScaleX, &ScaleY) ) + return NULL; + self->obj->SetScale(ScaleX, ScaleY); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_SetScaleX(PySfDrawable* self, PyObject *args) +{ + self->obj->SetScaleX(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_SetScaleY(PySfDrawable* self, PyObject *args) +{ + self->obj->SetScaleY(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfDrawable_SetRotation(PySfDrawable* self, PyObject *args) +{ + self->obj->SetRotation(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_SetCenter(PySfDrawable* self, PyObject *args) +{ + float x, y; + if ( !PyArg_ParseTuple(args, "ff", &x, &y) ) + return NULL; + self->obj->SetCenter(x, y); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_GetCenter(PySfDrawable* self) +{ + sf::Vector2f Vect = self->obj->GetCenter(); + return Py_BuildValue("ff", Vect.x, Vect.y); +} + +static PyObject * +PySfDrawable_SetColor(PySfDrawable* self, PyObject *args) +{ + PySfColor *Color = (PySfColor *)args; + if (! PyObject_TypeCheck(args, &PySfColorType)) + { + PyErr_SetString(PyExc_TypeError, "Argument is not a sfColor"); + return NULL; + } + PySfColorUpdate(Color); + self->obj->SetColor(*(Color->obj)); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_GetPosition(PySfDrawable* self) +{ + sf::Vector2f Vect = self->obj->GetPosition(); + return Py_BuildValue("ff", Vect.x, Vect.y); +} +static PyObject * +PySfDrawable_GetScale(PySfDrawable* self) +{ + sf::Vector2f Vect = self->obj->GetScale(); + return Py_BuildValue("ff", Vect.x, Vect.y); +} +static PyObject * +PySfDrawable_GetRotation(PySfDrawable* self) +{ + return PyFloat_FromDouble(self->obj->GetRotation()); +} + +static PyObject * +PySfDrawable_GetColor(PySfDrawable* self) +{ + PySfColor *Color; + + Color = GetNewPySfColor(); + Color->obj = new sf::Color( self->obj->GetColor() ); + Color->r = Color->obj->r; + Color->g = Color->obj->g; + Color->b = Color->obj->b; + Color->a = Color->obj->a; + + return (PyObject *)Color; +} +static PyObject * +PySfDrawable_Move(PySfDrawable* self, PyObject *args) +{ + float x, y; + if ( !PyArg_ParseTuple(args, "ff", &x, &y) ) + return NULL; + self->obj->Move(x, y); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_Rotate(PySfDrawable* self, PyObject *args) +{ + self->obj->Rotate(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} +static PyObject * +PySfDrawable_Scale(PySfDrawable* self, PyObject *args) +{ + float FactorX, FactorY; + if ( !PyArg_ParseTuple(args, "ff", &FactorX, &FactorY) ) + return NULL; + self->obj->Scale(FactorX, FactorY); + Py_RETURN_NONE; +} + +static PyObject * +PySfDrawable_SetBlendMode(PySfDrawable* self, PyObject *args) +{ + self->obj->SetBlendMode((sf::Blend::Mode)PyLong_AsUnsignedLong(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfDrawable_SetPosition(PySfDrawable* self, PyObject *args) +{ + float Left, Top; + if ( !PyArg_ParseTuple(args, "ff", &Left, &Top) ) + return NULL; + self->obj->SetPosition(Left, Top); + Py_RETURN_NONE; +} + +static PyObject * +PySfDrawable_TransformToLocal(PySfDrawable* self, PyObject *args) +{ + float X, Y; + if ( !PyArg_ParseTuple(args, "ff", &X, &Y) ) + return NULL; + sf::Vector2f result = self->obj->TransformToLocal(sf::Vector2f(X, Y)); + return Py_BuildValue("ff", result.x, result.y); +} + +static PyObject * +PySfDrawable_TransformToGlobal(PySfDrawable* self, PyObject *args) +{ + float X, Y; + if ( !PyArg_ParseTuple(args, "ff", &X, &Y) ) + return NULL; + sf::Vector2f result = self->obj->TransformToGlobal(sf::Vector2f(X, Y)); + return Py_BuildValue("ff", result.x, result.y); +} + +static PyMethodDef PySfDrawable_methods[] = { + {"TransformToLocal", (PyCFunction)PySfDrawable_TransformToLocal, METH_VARARGS, "TransformToLocal(X, Y)\n\ +Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point). Returns a tuple.\n\ + X : X coordinate of the point to transform\n\ + Y : Y coordinate of the point to transform"}, + {"TransformToGlobal", (PyCFunction)PySfDrawable_TransformToGlobal, METH_VARARGS, "TransformToGlobal(X, Y)\n\ +Transform a point from local coordinates into global coordinates (ie it applies the object's center, translation, rotation and scale to the point). Returns a tuple.\n\ + X : X coordinate of the point to transform\n\ + Y : Y coordinate of the point to transform"}, + {"SetX", (PyCFunction)PySfDrawable_SetX, METH_O, "SetX(X)\nSet the X position of the object.\n X : New X coordinate"}, + {"SetY", (PyCFunction)PySfDrawable_SetY, METH_O, "SetY(Y)\nSet the Y position of the object.\n Y : New Y coordinate"}, + {"SetScale", (PyCFunction)PySfDrawable_SetScale, METH_VARARGS, "SetScale(ScaleX, ScaleY)\nSet the scale of the object.\n ScaleX : New horizontal scale (must be strictly positive)\n ScaleY : New vertical scale (must be strictly positive)"}, + {"SetScaleX", (PyCFunction)PySfDrawable_SetScaleX, METH_O, "SetScaleX(ScaleX)\nSet the X scale factor of the object.\n ScaleX : New horizontal scale (must be strictly positive)"}, + {"SetScaleY", (PyCFunction)PySfDrawable_SetScaleY, METH_O, "SetScaleY(ScaleY)\nSet the Y scale factor of the object.\n ScaleY : New vertical scale (must be strictly positive)"}, + {"SetRotation", (PyCFunction)PySfDrawable_SetRotation, METH_O, "SetRotation(Rotation)\nSet the orientation of the object.\n Rotation : Angle of rotation, in degrees"}, + {"SetCenter", (PyCFunction)PySfDrawable_SetCenter, METH_VARARGS, "SetCenter(CenterX, CenterY)\nSet the center of the object, in coordinates relative to the object.\n CenterX : X coordinate of the center\n CenterY : Y coordinate of the center"}, + {"GetCenter", (PyCFunction)PySfDrawable_GetCenter, METH_NOARGS, "GetCenter()\nGet the center of the object, in coordinates relative to the object."}, + {"SetColor", (PyCFunction)PySfDrawable_SetColor, METH_O, "SetColor(Color)\nSet the color of the object.\n Color : New color"}, + {"GetPosition", (PyCFunction)PySfDrawable_GetPosition, METH_NOARGS, "GetPosition()\nGet the position of the object."}, + {"GetScale", (PyCFunction)PySfDrawable_GetScale, METH_NOARGS, "GetScale()\nGet the scale of the object."}, + {"GetRotation", (PyCFunction)PySfDrawable_GetRotation, METH_NOARGS, "GetRotation()\nGet the orientation of the object."}, + {"GetColor", (PyCFunction)PySfDrawable_GetColor, METH_NOARGS, "GetColor()\nGet the color of the object."}, + {"Move", (PyCFunction)PySfDrawable_Move, METH_VARARGS, "Move(OffsetX, OffsetY)\nMove the object.\n OffsetX : X offset\n OffsetY : Y offset "}, + {"Scale", (PyCFunction)PySfDrawable_Scale, METH_VARARGS, "Scale(FactorX, FactorY)\nScale the object.\n FactorX : Scaling factor on X (must be strictly positive)\n FactorY : Scaling factor on Y (must be strictly positive)"}, + {"Rotate", (PyCFunction)PySfDrawable_Rotate, METH_O, "Rotate(Angle)\nRotate the object.\n Angle : Angle of rotation, in degrees"}, + {"SetBlendMode", (PyCFunction)PySfDrawable_SetBlendMode, METH_O, "SetBlendMode(Mode)\nSet the blending mode for the object. The default blend mode is sf.Blend.Alpha\n Mode : New blending mode"}, + {"SetPosition", (PyCFunction)PySfDrawable_SetPosition, METH_VARARGS, "SetPosition(X, Y)\nSet the position of the object.\n X : New X coordinate\n Y : New Y coordinate"}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfDrawableType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Drawable", /*tp_name*/ + sizeof(PySfDrawable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfDrawable_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Abstract base class for every object that can be drawn into a render window.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfDrawable_methods, /* tp_methods */ + PySfDrawable_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfDrawable_init, /* tp_init */ + 0, /* tp_alloc */ + PySfDrawable_new, /* tp_new */ +}; + + diff --git a/python/src/Drawable.hpp b/python/src/Drawable.hpp new file mode 100644 index 00000000..8676d9dd --- /dev/null +++ b/python/src/Drawable.hpp @@ -0,0 +1,54 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYDRAWABLE_H +#define __PYDRAWABLE_H + +#include +#include + +#include +#include + +#include "Color.hpp" +#include "RenderWindow.hpp" + + +class CustomDrawable : public sf::Drawable +{ +protected : + virtual void Render(sf::RenderTarget& Target) const; +public : + PySfRenderWindow *RenderWindow; + PyObject *RenderFunction; +}; + + +typedef struct { + PyObject_HEAD + CustomDrawable *obj; +} PySfDrawable; + +#endif + diff --git a/python/src/Event.cpp b/python/src/Event.cpp new file mode 100644 index 00000000..95491690 --- /dev/null +++ b/python/src/Event.cpp @@ -0,0 +1,844 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Event.hpp" + + +//////////////////////////////// +// Text Events Parameters +//////////////////////////////// + +PyMemberDef PySfEventText_members[] = { + {(char *)"Unicode", T_USHORT, offsetof(PySfEventText, Unicode), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +static PyObject * +PySfEventText_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventText *self; + + self = (PySfEventText *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->Unicode = 0; + } + + return (PyObject *)self; +} + +int +PySfEventText_init(PySfEventText *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventText_dealloc(PySfEventText* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +PyTypeObject PySfEventTextType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.Text", /*tp_name*/ + sizeof(PySfEventText), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventText_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "Text Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventText_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventText_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventText_new, /* tp_new */ +}; + + + +///////////////////////////////////// +// Keyboard Events Parameters +///////////////////////////////////// + +static PyObject * +PySfEventKey_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventKey *self; + + self = (PySfEventKey *)type->tp_alloc(type, 0); + if (self != NULL) + { + Py_INCREF(Py_False); + self->Alt = Py_False; + Py_INCREF(Py_False); + self->Control = Py_False; + Py_INCREF(Py_False); + self->Shift = Py_False; + } + + return (PyObject *)self; +} + +int +PySfEventKey_init(PySfEventKey *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventKey_dealloc(PySfEventKey* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +PyMemberDef PySfEventKey_members[] = { + {(char *)"Alt", T_OBJECT, offsetof(PySfEventKey, Alt), RO, (char *)""}, + {(char *)"Control", T_OBJECT, offsetof(PySfEventKey, Control), RO, (char *)""}, + {(char *)"Shift", T_OBJECT, offsetof(PySfEventKey, Shift), RO, (char *)""}, + {(char *)"Code", T_UINT, offsetof(PySfEventKey, Code), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventKeyType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.Key", /*tp_name*/ + sizeof(PySfEventKey), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventKey_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "Key Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventKey_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventKey_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventKey_new, /* tp_new */ +}; + + +//////////////////////////////////// +// MouseMove Events Parameters +//////////////////////////////////// + +static PyObject * +PySfEventMouseMove_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventMouseMove *self; + + self = (PySfEventMouseMove *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->X = 0; + self->Y = 0; + } + + return (PyObject *)self; +} + +int +PySfEventMouseMove_init(PySfEventMouseMove *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventMouseMove_dealloc(PySfEventMouseMove *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + + +PyMemberDef PySfEventMouseMove_members[] = { + {(char *)"X", T_INT, offsetof(PySfEventMouseMove, X), RO, (char *)""}, + {(char *)"Y", T_INT, offsetof(PySfEventMouseMove, Y), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventMouseMoveType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.MouseMove", /*tp_name*/ + sizeof(PySfEventMouseMove), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventMouseMove_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "MouseMove Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventMouseMove_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventMouseMove_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventMouseMove_new, /* tp_new */ +}; + + +//////////////////////////////////// +// MouseButton Events Parameters +//////////////////////////////////// + +static PyObject * +PySfEventMouseButton_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventMouseButton *self; + + self = (PySfEventMouseButton *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->Button = 0; + self->X = 0; + self->Y = 0; + } + + return (PyObject *)self; +} + +int +PySfEventMouseButton_init(PySfEventMouseButton *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventMouseButton_dealloc(PySfEventMouseButton* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + + +PyMemberDef PySfEventMouseButton_members[] = { + {(char *)"Button", T_UINT, offsetof(PySfEventMouseButton, Button), RO, (char *)""}, + {(char *)"X", T_INT, offsetof(PySfEventMouseButton, X), RO, (char *)""}, + {(char *)"Y", T_INT, offsetof(PySfEventMouseButton, Y), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventMouseButtonType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.MouseButton", /*tp_name*/ + sizeof(PySfEventMouseButton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventMouseButton_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "MouseButton Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventMouseButton_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventMouseButton_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventMouseButton_new, /* tp_new */ +}; + + +//////////////////////////////// +// MouseWheel Events Parameters +//////////////////////////////// + +static PyObject * +PySfEventMouseWheel_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventMouseWheel *self; + + self = (PySfEventMouseWheel *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->Delta = 0; + } + + return (PyObject *)self; +} + +int +PySfEventMouseWheel_init(PySfEventMouseWheel *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventMouseWheel_dealloc(PySfEventMouseWheel* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +PyMemberDef PySfEventMouseWheel_members[] = { + {(char *)"Delta", T_INT, offsetof(PySfEventMouseWheel,Delta), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventMouseWheelType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.MouseWheel", /*tp_name*/ + sizeof(PySfEventMouseWheel), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventMouseWheel_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "MouseWheel Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventMouseWheel_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventMouseWheel_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventMouseWheel_new, /* tp_new */ +}; + + +//////////////////////////////////// +// JoyMove Events Parameters +//////////////////////////////////// + +static PyObject * +PySfEventJoyMove_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventJoyMove *self; + + self = (PySfEventJoyMove *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->JoystickId = 0; + self->Axis = 0; + self->Position = 0.f; + } + + return (PyObject *)self; +} + +int +PySfEventJoyMove_init(PySfEventJoyMove *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventJoyMove_dealloc(PySfEventJoyMove* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + + +PyMemberDef PySfEventJoyMove_members[] = { + {(char *)"JoystickId", T_UINT, offsetof(PySfEventJoyMove,JoystickId), RO, (char *)""}, + {(char *)"Axis", T_UINT, offsetof(PySfEventJoyMove,Axis), RO, (char *)""}, + {(char *)"Position", T_FLOAT, offsetof(PySfEventJoyMove,Position), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventJoyMoveType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.JoyMove", /*tp_name*/ + sizeof(PySfEventJoyMove), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventJoyMove_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "JoyMove Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventJoyMove_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventJoyMove_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventJoyMove_new, /* tp_new */ +}; + + +//////////////////////////////////// +// JoyButton Events Parameters +//////////////////////////////////// + +static PyObject * +PySfEventJoyButton_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventJoyButton *self; + + self = (PySfEventJoyButton *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->JoystickId = 0; + self->Button = 0; + } + + return (PyObject *)self; +} + +int +PySfEventJoyButton_init(PySfEventJoyButton *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventJoyButton_dealloc(PySfEventJoyButton* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + + +PyMemberDef PySfEventJoyButton_members[] = { + {(char *)"JoystickId", T_UINT, offsetof(PySfEventJoyButton, JoystickId), RO, (char *)""}, + {(char *)"Button", T_UINT, offsetof(PySfEventJoyButton, Button), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventJoyButtonType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.JoyButton", /*tp_name*/ + sizeof(PySfEventJoyButton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventJoyButton_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "JoyButton Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventJoyButton_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventJoyButton_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventJoyButton_new, /* tp_new */ +}; + + +//////////////////////////////////// +// Size Events Parameters +//////////////////////////////////// + +static PyObject * +PySfEventSize_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEventSize *self; + + self = (PySfEventSize *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->Width = 0; + self->Height = 0; + } + + return (PyObject *)self; +} + +int +PySfEventSize_init(PySfEventSize *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +void +PySfEventSize_dealloc(PySfEventSize* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +PyMemberDef PySfEventSize_members[] = { + {(char *)"Width", T_UINT, offsetof(PySfEventSize, Width), RO, (char *)""}, + {(char *)"Height", T_UINT, offsetof(PySfEventSize, Height), RO, (char *)""}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventSizeType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event.Size", /*tp_name*/ + sizeof(PySfEventSize), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEventSize_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "Size Events Parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PySfEventSize_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEventSize_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEventSize_new, /* tp_new */ +}; + + + + + + +//////////////////////////////////// +// sf.Event +//////////////////////////////////// + + +static int +PySfEvent_init(PySfEvent *self, PyObject *args, PyObject *kwds) +{ + self->obj = new sf::Event(); + return 0; +} + +static PyObject * +PySfEvent_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfEvent *self; + + self = (PySfEvent *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->Text = (PySfEventText *)PySfEventText_new(&PySfEventTextType, NULL, NULL); + self->Key = (PySfEventKey *)PySfEventKey_new(&PySfEventKeyType, NULL, NULL); + self->MouseMove = (PySfEventMouseMove *)PySfEventMouseMove_new(&PySfEventMouseMoveType, NULL, NULL); + self->MouseButton = (PySfEventMouseButton *)PySfEventMouseButton_new(&PySfEventMouseButtonType, NULL, NULL); + self->MouseWheel = (PySfEventMouseWheel *)PySfEventMouseWheel_new(&PySfEventMouseWheelType, NULL, NULL); + self->JoyMove = (PySfEventJoyMove *)PySfEventJoyMove_new(&PySfEventJoyMoveType, NULL, NULL); + self->JoyButton = (PySfEventJoyButton *)PySfEventJoyButton_new(&PySfEventJoyButtonType, NULL, NULL); + self->Size = (PySfEventSize *)PySfEventSize_new(&PySfEventSizeType, NULL, NULL); + } + + return (PyObject *)self; +} + +static void +PySfEvent_dealloc(PySfEvent* self) +{ + Py_DECREF(self->Text); + Py_DECREF(self->Key); + Py_DECREF(self->MouseMove); + Py_DECREF(self->MouseButton); + Py_DECREF(self->MouseWheel); + Py_DECREF(self->JoyMove); + Py_DECREF(self->JoyButton); + Py_DECREF(self->Size); + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyMemberDef PySfEvent_members[] = { + {(char *)"Text", T_OBJECT, offsetof(PySfEvent, Text), RO, (char *)"Text Events Parameters"}, + {(char *)"Key", T_OBJECT, offsetof(PySfEvent, Key), RO, (char *)"Keyboard Events Parameters"}, + {(char *)"MouseMove", T_OBJECT, offsetof(PySfEvent, MouseMove), RO, (char *)"MouseMove Events Parameters"}, + {(char *)"MouseButton", T_OBJECT, offsetof(PySfEvent, MouseButton), RO, (char *)"MouseButton Events Parameters"}, + {(char *)"MouseWheel", T_OBJECT, offsetof(PySfEvent, MouseWheel), RO, (char *)"MouseWheel Events Parameters"}, + {(char *)"JoyMove", T_OBJECT, offsetof(PySfEvent, JoyMove), RO, (char *)"JoyMove Events Parameters"}, + {(char *)"JoyButton", T_OBJECT, offsetof(PySfEvent, JoyButton), RO, (char *)"JoyButton Events Parameters"}, + {(char *)"Size", T_OBJECT, offsetof(PySfEvent, Size), RO, (char *)"Size Events Parameters"}, + {(char *)"Type", T_UINT, offsetof(PySfEvent, Type), RO, (char *)"Type Events Parameters"}, + {NULL} /* Sentinel */ +}; + +static PyMethodDef PySfEvent_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfEventType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Event", /*tp_name*/ + sizeof(PySfEvent), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfEvent_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Event defines a system event and its parameters", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfEvent_methods, /* tp_methods */ + PySfEvent_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfEvent_init, /* tp_init */ + 0, /* tp_alloc */ + PySfEvent_new, /* tp_new */ +}; + + +void +PySfEvent_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Event::KeyReleased); + PyDict_SetItemString(PySfEventType.tp_dict, "KeyReleased", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::LostFocus); + PyDict_SetItemString(PySfEventType.tp_dict, "LostFocus", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::GainedFocus); + PyDict_SetItemString(PySfEventType.tp_dict, "GainedFocus", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::KeyPressed); + PyDict_SetItemString(PySfEventType.tp_dict, "KeyPressed", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::MouseWheelMoved); + PyDict_SetItemString(PySfEventType.tp_dict, "MouseWheelMoved", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::TextEntered); + PyDict_SetItemString(PySfEventType.tp_dict, "TextEntered", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::MouseMoved); + PyDict_SetItemString(PySfEventType.tp_dict, "MouseMoved", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::JoyButtonPressed); + PyDict_SetItemString(PySfEventType.tp_dict, "JoyButtonPressed", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::MouseButtonReleased); + PyDict_SetItemString(PySfEventType.tp_dict, "MouseButtonReleased", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::Closed); + PyDict_SetItemString(PySfEventType.tp_dict, "Closed", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::MouseButtonPressed); + PyDict_SetItemString(PySfEventType.tp_dict, "MouseButtonPressed", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::JoyMoved); + PyDict_SetItemString(PySfEventType.tp_dict, "JoyMoved", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::JoyButtonReleased); + PyDict_SetItemString(PySfEventType.tp_dict, "JoyButtonReleased", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::Resized); + PyDict_SetItemString(PySfEventType.tp_dict, "Resized", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::MouseEntered); + PyDict_SetItemString(PySfEventType.tp_dict, "MouseEntered", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Event::MouseLeft); + PyDict_SetItemString(PySfEventType.tp_dict, "MouseLeft", obj); + Py_DECREF(obj); +} + diff --git a/python/src/Event.hpp b/python/src/Event.hpp new file mode 100644 index 00000000..c0f4ad89 --- /dev/null +++ b/python/src/Event.hpp @@ -0,0 +1,108 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYEVENT_HPP +#define __PYEVENT_HPP + +#include +#include +#include + +#include +#include + +typedef struct +{ + PyObject_HEAD + unsigned int short Unicode; +} PySfEventText; + +typedef struct +{ + PyObject_HEAD + PyObject *Alt; + PyObject *Control; + PyObject *Shift; + unsigned int Code; +} PySfEventKey; + +typedef struct +{ + PyObject_HEAD + int X; + int Y; +} PySfEventMouseMove; + +typedef struct +{ + PyObject_HEAD + unsigned int Button; + int X; + int Y; +} PySfEventMouseButton; + +typedef struct +{ + PyObject_HEAD + int Delta; +} PySfEventMouseWheel; + +typedef struct { + PyObject_HEAD + unsigned int JoystickId; + unsigned int Axis; + float Position; +} PySfEventJoyMove; + +typedef struct { + PyObject_HEAD + unsigned int JoystickId; + unsigned int Button; +} PySfEventJoyButton; + +typedef struct +{ + PyObject_HEAD + unsigned int Width; + unsigned int Height; +} PySfEventSize; + +typedef struct { + PyObject_HEAD + PySfEventText *Text; + PySfEventKey *Key; + PySfEventMouseMove *MouseMove; + PySfEventMouseButton *MouseButton; + PySfEventMouseWheel *MouseWheel; + PySfEventJoyMove *JoyMove; + PySfEventJoyButton *JoyButton; + PySfEventSize *Size; + unsigned int Type; + sf::Event *obj; +} PySfEvent; + +void +PySfEvent_InitConst(); + +#endif diff --git a/python/src/Font.cpp b/python/src/Font.cpp new file mode 100644 index 00000000..e9abe552 --- /dev/null +++ b/python/src/Font.cpp @@ -0,0 +1,219 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Font.hpp" +#include "Glyph.hpp" + +static PyMemberDef PySfFont_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfFont_dealloc(PySfFont *self) +{ + if (self->Owner) + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfFont_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfFont *self; + + self = (PySfFont *)type->tp_alloc(type, 0); + + if (self != NULL) + { + self->Owner = true; + } + + return (PyObject *)self; +} + +static int +PySfFont_init(PySfFont *self, PyObject *args, PyObject *kwds) +{ + self->obj = new sf::Font(); + return 0; +} + +static PyObject * +PySfFont_LoadFromFile(PySfFont* self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Filename", "Charsize", "Charset", NULL}; + unsigned int Charsize=30; + char *Filename; + char *CharsetTmp = NULL; + int CharsetSize; + bool Result; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "s|Is#", (char **)kwlist, &Filename, &Charsize, &CharsetTmp, &CharsetSize)) + return NULL; + + if (CharsetTmp) + { + if ((unsigned char)CharsetTmp[0] == 0xff && (unsigned char)CharsetTmp[1] == 0xfe) + Result = self->obj->LoadFromFile(Filename, Charsize, sf::Unicode::Text((const sf::Uint16 *)(CharsetTmp+2))); + else + Result = self->obj->LoadFromFile(Filename, Charsize, sf::Unicode::Text((const sf::Uint8 *)CharsetTmp)); + } + else + Result = self->obj->LoadFromFile(Filename, Charsize); + + if (Result) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfFont_LoadFromMemory(PySfFont* self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Data", "Charsize", "Charset", NULL}; + unsigned int Charsize=30, Size; + char *Data; + char *CharsetTmp = NULL; + int CharsetSize; + bool Result; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "s#|Is#", (char **)kwlist, &Data, &Size, &Charsize, &CharsetTmp, &CharsetSize)) + return NULL; + + if (CharsetTmp) + { + if ((unsigned char)CharsetTmp[0] == 0xff && (unsigned char)CharsetTmp[1] == 0xfe) + Result = self->obj->LoadFromMemory(Data, Size, Charsize, sf::Unicode::Text((const sf::Uint16 *)(CharsetTmp+2))); + else + Result = self->obj->LoadFromMemory(Data, Size, Charsize, sf::Unicode::Text((const sf::Uint8 *)CharsetTmp)); + } + else + Result = self->obj->LoadFromMemory(Data, Size, Charsize); + + if (Result) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfFont_GetDefaultFont(PySfFont* self, PyObject *args) +{ + PySfFont *DefaultFont = GetNewPySfFont(); + DefaultFont->Owner = false; + DefaultFont->obj = (sf::Font *)&(sf::Font::GetDefaultFont()); + return (PyObject *)DefaultFont; +} + +static PyObject * +PySfFont_GetCharacterSize(PySfFont* self) +{ + return PyLong_FromUnsignedLong(self->obj->GetCharacterSize()); +} + +static PyObject * +PySfFont_GetGlyph(PySfFont* self, PyObject *args) +{ + PySfGlyph *PyGlyph = GetNewPySfGlyph(); + sf::Glyph *Glyph = new sf::Glyph(self->obj->GetGlyph(PyLong_AsUnsignedLong(args))); + PyGlyph->obj = Glyph; + PyGlyph->Rectangle->obj = &(PyGlyph->obj->Rectangle); + PyGlyph->TexCoords->obj = &(PyGlyph->obj->TexCoords); + PySfGlyphUpdateSelf(PyGlyph); + return (PyObject *)PyGlyph; +} + +static PyMethodDef PySfFont_methods[] = { + {"LoadFromFile", (PyCFunction)PySfFont_LoadFromFile, METH_VARARGS | METH_KEYWORDS, "LoadFromFile(Filename, CharSize, Charset)\n\ +Load the font from a file. Returns True if loading was successful.\n\ + Filename : Font file to load\n\ + CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)\n\ + Charset : Characters set to generate (empty by default - takes the ASCII range [31, 255])"}, + {"LoadFromMemory", (PyCFunction)PySfFont_LoadFromMemory, METH_VARARGS | METH_KEYWORDS, "LoadFromMemory(Data, CharSize, Charset)\n\ +Load the font from a file in memory. Returns True if loading was successful.\n\ + Data : data to load\n\ + CharSize : Size of characters in bitmap - the bigger, the higher quality (30 by default)\n\ + Charset : Characters set to generate (empty by default - takes the ASCII range [31, 255])"}, + {"GetDefaultFont", (PyCFunction)PySfFont_GetDefaultFont, METH_NOARGS | METH_STATIC, "GetDefaultFont()\n\ +Get the SFML default built-in font (Arial)."}, + {"GetCharacterSize", (PyCFunction)PySfFont_GetCharacterSize, METH_NOARGS, "GetCharacterSize()\n\ +Get the base size of characters in the font; All glyphs dimensions are based on this value"}, + {"GetGlyph", (PyCFunction)PySfFont_GetGlyph, METH_O, "GetGlyph(CodePoint)\n\ +Get the description of a glyph (character) given by its unicode value. Returns glyph's visual settings, or an invalid glyph if character not found.\n\ + CodePoint : Unicode value of the character to get."}, + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfFontType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Font", /*tp_name*/ + sizeof(PySfFont), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfFont_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Font is the low-level class for loading and manipulating character fonts. This class is meant to be used by sf.String.\nDefault constructor : sf.Font().", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfFont_methods, /* tp_methods */ + PySfFont_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfFont_init, /* tp_init */ + 0, /* tp_alloc */ + PySfFont_new, /* tp_new */ +}; + +PySfFont * +GetNewPySfFont() +{ + return (PySfFont *)PySfFont_new(&PySfFontType, NULL, NULL); +} + + diff --git a/python/src/Font.hpp b/python/src/Font.hpp new file mode 100644 index 00000000..a7851a46 --- /dev/null +++ b/python/src/Font.hpp @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYFONT_HPP +#define __PYFONT_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD + bool Owner; + sf::Font *obj; +} PySfFont; + +PySfFont * +GetNewPySfFont(); + +#endif diff --git a/python/src/Glyph.cpp b/python/src/Glyph.cpp new file mode 100644 index 00000000..21c93a34 --- /dev/null +++ b/python/src/Glyph.cpp @@ -0,0 +1,158 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Glyph.hpp" + +static PyMemberDef PySfGlyph_members[] = { + {(char *)"Advance", T_INT, offsetof(PySfGlyph, Advance), 0, (char *)"Offset to move horizontically to the next character."}, + {(char *)"Rectangle", T_OBJECT, offsetof(PySfGlyph, Rectangle), 0, (char *)"Bounding rectangle of the glyph, in relative coordinates."}, + {(char *)"TexCoords", T_OBJECT, offsetof(PySfGlyph, TexCoords), 0, (char *)"Texture coordinates of the glyph inside the bitmap font."}, + {NULL} /* Sentinel */ +}; + + + +static void +PySfGlyph_dealloc(PySfGlyph *self) +{ + self->Rectangle->obj = new sf::IntRect(self->obj->Rectangle); + Py_DECREF(self->Rectangle); + self->TexCoords->obj = new sf::FloatRect(self->obj->TexCoords); + Py_DECREF(self->TexCoords); + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +void +PySfGlyphUpdateObj(PySfGlyph *self) +{ + self->obj->Advance = self->Advance; + PySfIntRectUpdateObj(self->Rectangle); + PySfFloatRectUpdateObj(self->TexCoords); + self->obj->Rectangle.Left = self->Rectangle->Left; + self->obj->Rectangle.Top = self->Rectangle->Top; + self->obj->Rectangle.Right = self->Rectangle->Right; + self->obj->Rectangle.Bottom = self->Rectangle->Bottom; + self->obj->TexCoords.Left = self->TexCoords->Left; + self->obj->TexCoords.Top = self->TexCoords->Top; + self->obj->TexCoords.Right = self->TexCoords->Right; + self->obj->TexCoords.Bottom = self->TexCoords->Bottom; +} + +void +PySfGlyphUpdateSelf(PySfGlyph *self) +{ + self->Advance = self->obj->Advance; + self->Rectangle->Left = self->obj->Rectangle.Left; + self->Rectangle->Top = self->obj->Rectangle.Top; + self->Rectangle->Right = self->obj->Rectangle.Right; + self->Rectangle->Bottom = self->obj->Rectangle.Bottom; + self->TexCoords->Left = self->obj->TexCoords.Left; + self->TexCoords->Top = self->obj->TexCoords.Top; + self->TexCoords->Right = self->obj->TexCoords.Right; + self->TexCoords->Bottom = self->obj->TexCoords.Bottom; + PySfIntRectUpdateObj(self->Rectangle); + PySfFloatRectUpdateObj(self->TexCoords); +} + +static PyObject * +PySfGlyph_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfGlyph *self; + + self = (PySfGlyph *)type->tp_alloc(type, 0); + + if (self != NULL) + { + self->Advance = 0; + self->Rectangle = GetNewPySfIntRect(); + self->TexCoords = GetNewPySfFloatRect(); + } + + return (PyObject *)self; +} + + +static int +PySfGlyph_init(PySfGlyph *self, PyObject *args, PyObject *kwds) +{ + self->obj = new sf::Glyph(); + self->Rectangle->obj = &(self->obj->Rectangle); + self->TexCoords->obj = &(self->obj->TexCoords); + return 0; +} + +static PyMethodDef PySfGlyph_methods[] = { + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfGlyphType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Glyph", /*tp_name*/ + sizeof(PySfGlyph), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfGlyph_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Structure describing a glyph (a visual character).", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfGlyph_methods, /* tp_methods */ + PySfGlyph_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfGlyph_init, /* tp_init */ + 0, /* tp_alloc */ + PySfGlyph_new, /* tp_new */ +}; + +PySfGlyph * +GetNewPySfGlyph() +{ + return (PySfGlyph *)PySfGlyph_new(&PySfGlyphType, NULL, NULL); +} + diff --git a/python/src/Glyph.hpp b/python/src/Glyph.hpp new file mode 100644 index 00000000..0b35a886 --- /dev/null +++ b/python/src/Glyph.hpp @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYGLYPH_HPP +#define __PYGLYPH_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + +#include "Rect.hpp" + + +typedef struct { + PyObject_HEAD + int Advance; + PySfIntRect *Rectangle; + PySfFloatRect *TexCoords; + sf::Glyph *obj; +} PySfGlyph; + +PySfGlyph * +GetNewPySfGlyph(); + +void +PySfGlyphUpdateObj(PySfGlyph *self); + +void +PySfGlyphUpdateSelf(PySfGlyph *self); + +#endif diff --git a/python/src/Image.cpp b/python/src/Image.cpp new file mode 100644 index 00000000..9991135f --- /dev/null +++ b/python/src/Image.cpp @@ -0,0 +1,419 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Image.hpp" +#include "RenderWindow.hpp" + +extern PyTypeObject PySfColorType; +extern PyTypeObject PySfIntRectType; +extern PyTypeObject PySfRenderWindowType; + +static PyMemberDef PySfImage_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfImage_dealloc(PySfImage* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfImage_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfImage *self; + + self = (PySfImage *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static PyObject * +PySfImage_Create(PySfImage* self, PyObject *args, PyObject *kwds) +{ + PySfColor *ColorTmp=NULL; + sf::Color *Color; + unsigned int Width=0, Height=0; + const char *kwlist[] = {"Width", "Height", "Color", NULL}; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "|IIO!", (char **)kwlist, &Width, &Height, &PySfColorType, &ColorTmp)) + return NULL; + + if (ColorTmp) + { + Color = ColorTmp->obj; + PySfColorUpdate(ColorTmp); + self->obj->Create(Width, Height, *Color); + } + else + self->obj->Create(Width, Height); + + Py_RETURN_NONE; +} + +static PyObject * +PySfImage_CopyScreen(PySfImage* self, PyObject *args) +{ +// bool CopyScreen(RenderWindow& Window, const IntRect& SourceRect = IntRect(0, 0, 0, 0)); + PySfRenderWindow *RenderWindow; + PySfIntRect *SourceRect=NULL; + bool Result; + + if (! PyArg_ParseTuple(args, "O!|O!", &PySfRenderWindowType, &RenderWindow, &PySfIntRectType, &SourceRect)) + return NULL; + + + if (SourceRect) + { + PySfIntRectUpdateObj(SourceRect); + Result = self->obj->CopyScreen(*(RenderWindow->obj), *(SourceRect->obj)); + } + else + Result = self->obj->CopyScreen(*(RenderWindow->obj)); + if (Result) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfImage_SetPixel(PySfImage* self, PyObject *args, PyObject *kwds) +{ + PySfColor *ColorTmp=NULL; + sf::Color *Color; + unsigned int x=0, y=0; + const char *kwlist[] = {"x", "y", "Color", NULL}; + + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "II|O!", (char **)kwlist, &x, &y, &PySfColorType, &ColorTmp)) + return NULL; + + + if (ColorTmp) + { + Color = ColorTmp->obj; + PySfColorUpdate(ColorTmp); + self->obj->SetPixel(x, y, *Color); + } + + Py_RETURN_NONE; +} + +static PyObject * +PySfImage_GetPixel(PySfImage* self, PyObject *args) +{ + PySfColor *Color; + unsigned int x=0, y=0; + + + if (! PyArg_ParseTuple(args, "II", &x, &y)) + return NULL; + + + Color = GetNewPySfColor(); + Color->obj = new sf::Color(self->obj->GetPixel(x, y)); + Color->r = Color->obj->r; + Color->g = Color->obj->g; + Color->b = Color->obj->b; + Color->a = Color->obj->a; + + return (PyObject *)Color; +} + +static PyObject * +PySfImage_CreateMaskFromColor(PySfImage* self, PyObject *args) +{ + PySfColor *ColorTmp= (PySfColor *)args; + sf::Color *Color; + + if ( ! PyObject_TypeCheck(ColorTmp, &PySfColorType)) + PyErr_SetString(PyExc_ValueError, "Argument must be a sf.Color"); + Color = ColorTmp->obj; + PySfColorUpdate(ColorTmp); + self->obj->CreateMaskFromColor(*Color); + + Py_RETURN_NONE; +} + +static PyObject * +PySfImage_LoadFromMemory(PySfImage* self, PyObject *args) +{ + unsigned int SizeInBytes; + char *Data; + + if (! PyArg_ParseTuple(args, "s#", &Data, &SizeInBytes)) + return NULL; + + if (self->obj->LoadFromMemory(Data, (std::size_t) SizeInBytes)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; + +} + +static PyObject * +PySfImage_LoadFromPixels(PySfImage* self, PyObject *args) +{ + unsigned int Width, Height, Size; + char *Data; + + if (! PyArg_ParseTuple(args, "IIs#", &Width, &Height, &Data, &Size)) + return NULL; + + self->obj->LoadFromPixels(Width, Height, (sf::Uint8*) Data); + Py_RETURN_NONE; +} + +static PyObject * +PySfImage_GetPixels(PySfImage *self) +{ + return PyString_FromStringAndSize((const char *)(self->obj->GetPixelsPtr()), self->obj->GetWidth()*self->obj->GetHeight()*4); +} + +static PyObject * +PySfImage_LoadFromFile (PySfImage *self, PyObject *args) +{ + char *path = PyString_AsString(args); + + if (self->obj->LoadFromFile(path)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfImage_SaveToFile (PySfImage *self, PyObject *args) +{ + char *path = PyString_AsString(args); + + if (self->obj->SaveToFile(path)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static int +PySfImage_init(PySfImage *self, PyObject *args, PyObject *kwds); + +static PyObject * +PySfImage_Bind(PySfImage *self) +{ + self->obj->Bind(); + Py_RETURN_NONE; +} + +static PyObject * +PySfImage_SetSmooth (PySfImage *self, PyObject *args) +{ + bool arg=false; + if (PyObject_IsTrue(args)) + arg = true; + self->obj->SetSmooth(arg); + Py_RETURN_NONE; +} + +static PyObject * +PySfImage_GetWidth(PySfImage *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetWidth()); +} + +static PyObject * +PySfImage_GetHeight(PySfImage *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetHeight()); +} + +static PyObject * +PySfImage_GetValidTextureSize(PySfImage* self, PyObject *args) +{ + unsigned long S = PyLong_AsUnsignedLong(args); + return PyLong_FromUnsignedLong(sf::Image::GetValidTextureSize(S)); +} + +static PyObject * +PySfImage_GetTexCoords(PySfImage* self, PyObject *args) +{ + PySfIntRect *RectArg = NULL; + bool Adjust = false; + PyObject *AdjustObj = NULL; + + if (! PyArg_ParseTuple(args, "O!|O", &PySfIntRectType, &RectArg, &AdjustObj)) + return NULL; + + if (PyObject_IsTrue(AdjustObj)) + Adjust = true; + + PySfFloatRect *Rect; + + Rect = GetNewPySfFloatRect(); + Rect->obj = new sf::FloatRect ( self->obj->GetTexCoords(*(RectArg->obj), Adjust) ); + Rect->Left = Rect->obj->Left; + Rect->Top = Rect->obj->Top; + Rect->Right = Rect->obj->Right; + Rect->Bottom = Rect->obj->Bottom; + + return (PyObject *)Rect; +} + +static PyObject * +PySfImage_Copy(PySfImage* self, PyObject *args); + +static PyMethodDef PySfImage_methods[] = { + {"Copy", (PyCFunction)PySfImage_Copy, METH_VARARGS, "Copy(Source, DestX, DestY, SourceRect = sf.IntRect(0,0,0,0))\n\ +Copy pixels from another image onto this one. This function does a slow pixel copy and should only be used at initialization time.\n\ + Source : Source image to copy\n\ + DestX : X coordinate of the destination position\n\ + DestY : Y coordinate of the destination position\n\ + SourceRect : Sub-rectangle of the source image to copy (empty by default - entire image)"}, + {"Create", (PyCFunction)PySfImage_Create, METH_VARARGS, "Create(Width=0, Height=0, Color=sf.Color.Black)\n\ +Create an empty image.\n\ + Width : Image width\n\ + Height : Image height\n\ + Col : Image color (black by default)"}, + {"CopyScreen", (PyCFunction)PySfImage_CopyScreen, METH_VARARGS, "CopyScreen(Window, SourceRect)\n\ +Create the image from the current contents of the given window. Return True if copy was successful.\n\ + Window : Window to capture\n\ + SourceRect : Sub-rectangle of the screen to copy (empty by default - entire image)"}, + {"SetPixel", (PyCFunction)PySfImage_SetPixel, METH_VARARGS | METH_KEYWORDS, "SetPixel(X, Y, Col)\nChange the color of a pixel.\n\ + X : X coordinate of pixel in the image\n Y : Y coordinate of pixel in the image\n Col : New color for pixel (X, Y)"}, + {"GetPixel", (PyCFunction)PySfImage_GetPixel, METH_VARARGS, "GetPixel(X, Y)\nGet a pixel from the image."}, + {"LoadFromFile", (PyCFunction)PySfImage_LoadFromFile, METH_O, "LoadFromFile(Path)\nLoad the surface from a file."}, + {"SaveToFile", (PyCFunction)PySfImage_SaveToFile, METH_O, "SaveToFile(Path)\nSave the content of the image to a file."}, + {"LoadFromMemory", (PyCFunction)PySfImage_LoadFromMemory, METH_VARARGS, "LoadFromMemory(Data)\nLoad the image from a file in memory."}, + {"LoadFromPixels", (PyCFunction)PySfImage_LoadFromPixels, METH_VARARGS, "LoadFromPixels(Width, Height, Data)\nLoad the image directly from a string of pixels."}, + {"GetPixels", (PyCFunction)PySfImage_GetPixels, METH_NOARGS, "GetPixels()\nGet a string representing the array of pixels (8 bits integers RGBA). String length is GetWidth() x GetHeight() x 4. This string becomes invalid if you reload or resize the image."}, + {"CreateMaskFromColor", (PyCFunction)PySfImage_CreateMaskFromColor, METH_O, "CreateMaskFromColor(Color)\nCreate transparency mask from a specified colorkey."}, + {"Bind", (PyCFunction)PySfImage_Bind, METH_NOARGS, "Bind()\nBind the image for rendering."}, + {"SetSmooth", (PyCFunction)PySfImage_SetSmooth, METH_VARARGS, "SetSmooth(Smooth)\nEnable or disable image smooth filter."}, + {"GetWidth", (PyCFunction)PySfImage_GetWidth, METH_NOARGS, "GetWidth()\nReturn the width of the image."}, + {"GetHeight", (PyCFunction)PySfImage_GetHeight, METH_NOARGS, "GetHeight()\nReturn the height of the image."}, + {"GetTexCoords", (PyCFunction)PySfImage_GetTexCoords, METH_VARARGS, "GetTexCoords(Rect, Adjust=True)\nConvert a subrect expressed in pixels, into float texture coordinates. Returns texture coordinates corresponding to the sub-rectangle (sf.FloatRect instance)\n\ + Rect : Sub-rectangle of image to convert\n\ + Adjust : Pass true to apply the half-texel adjustment"}, + {"GetValidTextureSize", (PyCFunction)PySfImage_GetValidTextureSize, METH_STATIC | METH_O, "GetValidTextureSize(Size)\nGet a valid texture size according to hardware support. Returns valid nearest size (greater than or equal to specified size).\n\ + Size : Size to convert"}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfImageType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Image", /*tp_name*/ + sizeof(PySfImage), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfImage_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Image is the low-level class for loading and manipulating images.\n\ +Default constructor : sf.Image()\n\ +Other constructors : sf.Image(Width=0, Height=0, Color=sf.Color.Black) or sf.Image(Width, Height, Data).\n\ +Copy constructor : sf.Image(Copy) where Copy is a sf.Image instance.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfImage_methods, /* tp_methods */ + PySfImage_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfImage_init, /* tp_init */ + 0, /* tp_alloc */ + PySfImage_new, /* tp_new */ +}; + +static int +PySfImage_init(PySfImage *self, PyObject *args, PyObject *kwds) +{ + if (PyTuple_Size(args) == 1) + { + PySfImage *Image; + if (PyArg_ParseTuple(args, "O!", &PySfImageType, &Image)) + { + self->obj = new sf::Image(*(Image->obj)); + return 0; + } + } + self->obj = new sf::Image(); + if (PyTuple_Size(args) > 0) + { + if (PySfImage_Create(self, args, kwds) == NULL) + if (PySfImage_LoadFromPixels(self, args) == NULL) + return -1; + } + return 0; +} + +static PyObject * +PySfImage_Copy(PySfImage* self, PyObject *args) +{ + PySfIntRect *SourceRect = NULL; + PySfImage *Source = NULL; + unsigned int DestX, DestY; + if (! PyArg_ParseTuple(args, "O!II|O!", &PySfImageType, &Source, &DestX, &DestY, &PySfIntRectType, &SourceRect)) + return NULL; + + if (SourceRect) + { + PySfIntRectUpdateObj(SourceRect); + self->obj->Copy(*(Source->obj), DestX, DestY, *(SourceRect->obj)); + } + else + self->obj->Copy(*(Source->obj), DestX, DestY); + + Py_RETURN_NONE; +} + +PySfImage * +GetNewPySfImage() +{ + return PyObject_New(PySfImage, &PySfImageType); +} + diff --git a/python/src/Image.hpp b/python/src/Image.hpp new file mode 100644 index 00000000..84713e0e --- /dev/null +++ b/python/src/Image.hpp @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYIMAGE_HPP +#define __PYIMAGE_HPP + +#include +#include + +#include +#include + +#include "Color.hpp" +#include "Rect.hpp" + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD + sf::Image *obj; +} PySfImage; + +PySfImage * +GetNewPySfImage(); + +#endif + diff --git a/python/src/Input.cpp b/python/src/Input.cpp new file mode 100644 index 00000000..e0162fb2 --- /dev/null +++ b/python/src/Input.cpp @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Input.hpp" + + +static PyMemberDef PySfInput_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfInput_dealloc(PySfInput *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfInput_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfInput *self; + + self = (PySfInput *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfInput_init(PySfInput *self, PyObject *args, PyObject *kwds) +{ + PyErr_SetString(PyExc_StandardError, "You can't create an Input object yourself, because an Input object must always be associated to its window.\nThe only way to get an Input is by creating a window and calling : Input = MyWindow.GetInput()."); + return -1; +} + +static PyObject* +PySfInput_IsKeyDown(PySfInput *self, PyObject *args) +{ + if (self->obj->IsKeyDown( (sf::Key::Code) PyInt_AsLong(args) )) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfInput_IsMouseButtonDown(PySfInput *self, PyObject *args) +{ + if (self->obj->IsMouseButtonDown( (sf::Mouse::Button) PyInt_AsLong(args) )) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfInput_IsJoystickButtonDown(PySfInput *self, PyObject *args) +{ + unsigned int JoyId, Button; + if (! PyArg_ParseTuple (args, "II", &JoyId, &Button)) + return NULL; + if (self->obj->IsJoystickButtonDown(JoyId, Button)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfInput_GetMouseX(PySfInput *self) +{ + return PyInt_FromLong(self->obj->GetMouseX()); +} +static PyObject* +PySfInput_GetMouseY(PySfInput *self) +{ + return PyInt_FromLong(self->obj->GetMouseY()); +} + +static PyObject* +PySfInput_GetJoystickAxis(PySfInput *self, PyObject *args) +{ + unsigned int JoyId, Axis; + if (! PyArg_ParseTuple (args, "II", &JoyId, &Axis)) + return NULL; + return PyFloat_FromDouble(self->obj->GetJoystickAxis(JoyId, (sf::Joy::Axis) Axis)); +} + +static PyMethodDef PySfInput_methods[] = { + {"IsKeyDown", (PyCFunction)PySfInput_IsKeyDown, METH_O, "IsKeyDown(KeyCode)\nGet the state of a key. Returns True if key is down, false if key is up.\n KeyCode : Key to check"}, + {"IsMouseButtonDown", (PyCFunction)PySfInput_IsMouseButtonDown, METH_O, "IsMouseButtonDown(Button)\nGet the state of a mouse button. Returns True if button is down, false if button is up.\n Button : Button to check"}, + {"IsJoystickButtonDown", (PyCFunction)PySfInput_IsJoystickButtonDown, METH_VARARGS, "IsJoystickButtonDown(JoyId, Button)\nGet the state of a joystick button. Returns True if button is down, false if button is up.\n JoyId : Identifier of the joystick to check (0 or 1)\n Button : Button to check"}, + {"GetMouseX", (PyCFunction)PySfInput_GetMouseX, METH_NOARGS, "GetMouseX()\nGet the mouse X position."}, + {"GetMouseY", (PyCFunction)PySfInput_GetMouseY, METH_NOARGS, "GetMouseY()\nGet the mouse Y position."}, + {"GetJoystickAxis", (PyCFunction)PySfInput_GetJoystickAxis, METH_VARARGS, "GetJoystickAxis(JoyId, Axis)\nGet a joystick axis position. Returns current axis position, in the range [-100, 100] (except for POV, which is [0, 360])\n JoyId : Identifier of the joystick to check (0 or 1)\n Axis : Axis to get"}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfInputType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Input", /*tp_name*/ + sizeof(PySfInput), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfInput_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Input handles real-time input from keyboard and mouse. Use it instead of events to handle continuous moves and more game-friendly inputs.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfInput_methods, /* tp_methods */ + PySfInput_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfInput_init, /* tp_init */ + 0, /* tp_alloc */ + PySfInput_new, /* tp_new */ +}; + +PySfInput * +GetNewPySfInput() +{ + return PyObject_New(PySfInput, &PySfInputType); +} + diff --git a/python/src/Input.hpp b/python/src/Input.hpp new file mode 100644 index 00000000..ad5209e0 --- /dev/null +++ b/python/src/Input.hpp @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYINPUT_HPP +#define __PYINPUT_HPP + +#include +#include +#include + +#include +#include + +typedef struct { + PyObject_HEAD + sf::Input *obj; +} PySfInput; + +PySfInput * +GetNewPySfInput(); + +#endif diff --git a/python/src/Joy.cpp b/python/src/Joy.cpp new file mode 100644 index 00000000..b43b29d6 --- /dev/null +++ b/python/src/Joy.cpp @@ -0,0 +1,141 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include + +#include +#include + +#include "Joy.hpp" + + +typedef struct { + PyObject_HEAD +} PySfJoy; + + + +static PyMemberDef PySfJoy_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfJoy_dealloc(PySfJoy *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfJoy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfJoy *self; + + self = (PySfJoy *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfJoy_init(PySfJoy *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +static PyMethodDef PySfJoy_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfJoyType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Joy", /*tp_name*/ + sizeof(PySfJoy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfJoy_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Definition of joystick axis for joystick events.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfJoy_methods, /* tp_methods */ + PySfJoy_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfJoy_init, /* tp_init */ + 0, /* tp_alloc */ + PySfJoy_new, /* tp_new */ +}; + +void PySfJoy_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Joy::AxisX); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisX", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Joy::AxisY); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisY", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Joy::AxisZ); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisZ", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Joy::AxisR); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisR", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Joy::AxisU); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisU", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Joy::AxisV); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisV", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Joy::AxisPOV); + PyDict_SetItemString(PySfJoyType.tp_dict, "AxisPOV", obj); + Py_DECREF(obj); +} + diff --git a/python/src/Joy.hpp b/python/src/Joy.hpp new file mode 100644 index 00000000..14805ade --- /dev/null +++ b/python/src/Joy.hpp @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYJOY_HPP +#define __PYJOY_HPP + +void +PySfJoy_InitConst(); + +#endif diff --git a/python/src/Key.cpp b/python/src/Key.cpp new file mode 100644 index 00000000..f209c376 --- /dev/null +++ b/python/src/Key.cpp @@ -0,0 +1,423 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include + +#include +#include + +#include "Key.hpp" + + +typedef struct { + PyObject_HEAD +} PySfKey; + + + +static PyMemberDef PySfKey_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfKey_dealloc(PySfKey *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfKey_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfKey *self; + + self = (PySfKey *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfKey_init(PySfKey *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +static PyMethodDef PySfKey_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfKeyType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Key", /*tp_name*/ + sizeof(PySfKey), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfKey_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Definition of key codes for keyboard events.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfKey_methods, /* tp_methods */ + PySfKey_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfKey_init, /* tp_init */ + 0, /* tp_alloc */ + PySfKey_new, /* tp_new */ +}; + +void PySfKey_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Key::Numpad2); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad2", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad3); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad3", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad0); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad0", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad1); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad1", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad6); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad6", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad7); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad7", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad4); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad4", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad5); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad5", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad8); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad8", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Numpad9); + PyDict_SetItemString(PySfKeyType.tp_dict, "Numpad9", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::RAlt); + PyDict_SetItemString(PySfKeyType.tp_dict, "RAlt", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::PageUp); + PyDict_SetItemString(PySfKeyType.tp_dict, "PageUp", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Multiply); + PyDict_SetItemString(PySfKeyType.tp_dict, "Multiply", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::D); + PyDict_SetItemString(PySfKeyType.tp_dict, "D", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::SemiColon); + PyDict_SetItemString(PySfKeyType.tp_dict, "SemiColon", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::H); + PyDict_SetItemString(PySfKeyType.tp_dict, "H", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::L); + PyDict_SetItemString(PySfKeyType.tp_dict, "L", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::P); + PyDict_SetItemString(PySfKeyType.tp_dict, "P", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num7); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num7", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::T); + PyDict_SetItemString(PySfKeyType.tp_dict, "T", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::X); + PyDict_SetItemString(PySfKeyType.tp_dict, "X", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::RSystem); + PyDict_SetItemString(PySfKeyType.tp_dict, "RSystem", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F5); + PyDict_SetItemString(PySfKeyType.tp_dict, "F5", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num4); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num4", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num5); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num5", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num6); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num6", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Right); + PyDict_SetItemString(PySfKeyType.tp_dict, "Right", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num0); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num0", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num1); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num1", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num2); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num2", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num3); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num3", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::LControl); + PyDict_SetItemString(PySfKeyType.tp_dict, "LControl", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num8); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num8", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Num9); + PyDict_SetItemString(PySfKeyType.tp_dict, "Num9", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Tab); + PyDict_SetItemString(PySfKeyType.tp_dict, "Tab", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::RBracket); + PyDict_SetItemString(PySfKeyType.tp_dict, "RBracket", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::End); + PyDict_SetItemString(PySfKeyType.tp_dict, "End", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::BackSlash); + PyDict_SetItemString(PySfKeyType.tp_dict, "BackSlash", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::LShift); + PyDict_SetItemString(PySfKeyType.tp_dict, "LShift", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::E); + PyDict_SetItemString(PySfKeyType.tp_dict, "E", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::C); + PyDict_SetItemString(PySfKeyType.tp_dict, "C", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::G); + PyDict_SetItemString(PySfKeyType.tp_dict, "G", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::K); + PyDict_SetItemString(PySfKeyType.tp_dict, "K", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Up); + PyDict_SetItemString(PySfKeyType.tp_dict, "Up", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::O); + PyDict_SetItemString(PySfKeyType.tp_dict, "O", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::S); + PyDict_SetItemString(PySfKeyType.tp_dict, "S", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::W); + PyDict_SetItemString(PySfKeyType.tp_dict, "W", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F12); + PyDict_SetItemString(PySfKeyType.tp_dict, "F12", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F13); + PyDict_SetItemString(PySfKeyType.tp_dict, "F13", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F10); + PyDict_SetItemString(PySfKeyType.tp_dict, "F10", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F11); + PyDict_SetItemString(PySfKeyType.tp_dict, "F11", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F14); + PyDict_SetItemString(PySfKeyType.tp_dict, "F14", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Delete); + PyDict_SetItemString(PySfKeyType.tp_dict, "Delete", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Back); + PyDict_SetItemString(PySfKeyType.tp_dict, "Back", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Tilde); + PyDict_SetItemString(PySfKeyType.tp_dict, "Tilde", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Home); + PyDict_SetItemString(PySfKeyType.tp_dict, "Home", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Pause); + PyDict_SetItemString(PySfKeyType.tp_dict, "Pause", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Add); + PyDict_SetItemString(PySfKeyType.tp_dict, "Add", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F15); + PyDict_SetItemString(PySfKeyType.tp_dict, "F15", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Subtract); + PyDict_SetItemString(PySfKeyType.tp_dict, "Subtract", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::B); + PyDict_SetItemString(PySfKeyType.tp_dict, "B", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F); + PyDict_SetItemString(PySfKeyType.tp_dict, "F", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::J); + PyDict_SetItemString(PySfKeyType.tp_dict, "J", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::N); + PyDict_SetItemString(PySfKeyType.tp_dict, "N", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::LBracket); + PyDict_SetItemString(PySfKeyType.tp_dict, "LBracket", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::R); + PyDict_SetItemString(PySfKeyType.tp_dict, "R", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::V); + PyDict_SetItemString(PySfKeyType.tp_dict, "V", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::LSystem); + PyDict_SetItemString(PySfKeyType.tp_dict, "LSystem", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Z); + PyDict_SetItemString(PySfKeyType.tp_dict, "Z", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Left); + PyDict_SetItemString(PySfKeyType.tp_dict, "Left", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F1); + PyDict_SetItemString(PySfKeyType.tp_dict, "F1", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F2); + PyDict_SetItemString(PySfKeyType.tp_dict, "F2", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F3); + PyDict_SetItemString(PySfKeyType.tp_dict, "F3", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F4); + PyDict_SetItemString(PySfKeyType.tp_dict, "F4", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Divide); + PyDict_SetItemString(PySfKeyType.tp_dict, "Divide", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F6); + PyDict_SetItemString(PySfKeyType.tp_dict, "F6", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F7); + PyDict_SetItemString(PySfKeyType.tp_dict, "F7", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F8); + PyDict_SetItemString(PySfKeyType.tp_dict, "F8", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::F9); + PyDict_SetItemString(PySfKeyType.tp_dict, "F9", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Period); + PyDict_SetItemString(PySfKeyType.tp_dict, "Period", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Down); + PyDict_SetItemString(PySfKeyType.tp_dict, "Down", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::PageDown); + PyDict_SetItemString(PySfKeyType.tp_dict, "PageDown", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Space); + PyDict_SetItemString(PySfKeyType.tp_dict, "Space", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Menu); + PyDict_SetItemString(PySfKeyType.tp_dict, "Menu", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::RControl); + PyDict_SetItemString(PySfKeyType.tp_dict, "RControl", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Slash); + PyDict_SetItemString(PySfKeyType.tp_dict, "Slash", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Return); + PyDict_SetItemString(PySfKeyType.tp_dict, "Return", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Quote); + PyDict_SetItemString(PySfKeyType.tp_dict, "Quote", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::A); + PyDict_SetItemString(PySfKeyType.tp_dict, "A", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Insert); + PyDict_SetItemString(PySfKeyType.tp_dict, "Insert", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::RShift); + PyDict_SetItemString(PySfKeyType.tp_dict, "RShift", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::I); + PyDict_SetItemString(PySfKeyType.tp_dict, "I", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Escape); + PyDict_SetItemString(PySfKeyType.tp_dict, "Escape", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::M); + PyDict_SetItemString(PySfKeyType.tp_dict, "M", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Equal); + PyDict_SetItemString(PySfKeyType.tp_dict, "Equal", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Q); + PyDict_SetItemString(PySfKeyType.tp_dict, "Q", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::U); + PyDict_SetItemString(PySfKeyType.tp_dict, "U", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Y); + PyDict_SetItemString(PySfKeyType.tp_dict, "Y", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Dash); + PyDict_SetItemString(PySfKeyType.tp_dict, "Dash", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::Comma); + PyDict_SetItemString(PySfKeyType.tp_dict, "Comma", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Key::LAlt); + PyDict_SetItemString(PySfKeyType.tp_dict, "LAlt", obj); + Py_DECREF(obj); +} + diff --git a/python/src/Key.hpp b/python/src/Key.hpp new file mode 100644 index 00000000..2126ee27 --- /dev/null +++ b/python/src/Key.hpp @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYKEY_HPP +#define __PYKEY_HPP + +void +PySfKey_InitConst(); + +#endif diff --git a/python/src/Listener.cpp b/python/src/Listener.cpp new file mode 100644 index 00000000..5a56143d --- /dev/null +++ b/python/src/Listener.cpp @@ -0,0 +1,160 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Listener.hpp" + + +static PyMemberDef PySfListener_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfListener_dealloc(PySfListener* self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfListener_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfListener *self; + + self = (PySfListener *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfListener_init(PySfListener *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + + +static PyObject * +PySfListener_SetGlobalVolume(PySfListener* self, PyObject *args) +{ + sf::Listener::SetGlobalVolume(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfListener_GetGlobalVolume(PySfListener* self) +{ + return PyFloat_FromDouble(sf::Listener::GetGlobalVolume()); +} + +static PyObject * +PySfListener_SetPosition(PySfListener* self, PyObject *args) +{ + float X, Y, Z; + if (! PyArg_ParseTuple(args, "fff", &X, &Y, &Z)) + return NULL; + sf::Listener::SetPosition(X, Y, Z); + Py_RETURN_NONE; +} + +static PyObject* +PySfListener_GetPosition(PySfListener *self) +{ + sf::Vector3f Vect = sf::Listener::GetPosition(); + return Py_BuildValue("fff", Vect.x, Vect.y, Vect.z); +} + +static PyObject * +PySfListener_SetTarget(PySfListener* self, PyObject *args) +{ + float X, Y, Z; + if (! PyArg_ParseTuple(args, "fff", &X, &Y, &Z)) + return NULL; + sf::Listener::SetTarget(X, Y, Z); + Py_RETURN_NONE; +} + +static PyObject* +PySfListener_GetTarget(PySfListener *self) +{ + sf::Vector3f Vect = sf::Listener::GetTarget(); + return Py_BuildValue("fff", Vect.x, Vect.y, Vect.z); +} + +static PyMethodDef PySfListener_methods[] = { + {"SetGlobalVolume", (PyCFunction)PySfListener_SetGlobalVolume, METH_STATIC | METH_O, "SetGlobalVolume(Volume)\nChange the global volume of all the sounds."}, + {"GetGlobalVolume", (PyCFunction)PySfListener_GetGlobalVolume, METH_STATIC | METH_NOARGS, "GetGlobalVolume()\nGet the current value of the global volume of all the sounds."}, + {"SetPosition", (PyCFunction)PySfListener_SetPosition, METH_STATIC | METH_VARARGS, "SetPosition(X, Y, Z)\nChange the position of the listener."}, + {"GetPosition", (PyCFunction)PySfListener_GetPosition, METH_STATIC | METH_NOARGS, "GetPosition()\nGet the current position of the listener."}, + {"SetTarget", (PyCFunction)PySfListener_SetTarget, METH_STATIC | METH_VARARGS, "SetTarget(X, Y, Z)\nChange the orientation of the listener (the point he must look at)"}, + {"GetTarget", (PyCFunction)PySfListener_GetTarget, METH_STATIC | METH_NOARGS, "GetTarget()\nGet the current orientation of the listener (the point he's looking at)"}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfListenerType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Listener", /*tp_name*/ + sizeof(PySfListener), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfListener_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Listener is a global interface for defining the audio listener properties ; the audio listener is the point in the scene from where all the sounds are heard.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfListener_methods, /* tp_methods */ + PySfListener_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfListener_init, /* tp_init */ + 0, /* tp_alloc */ + PySfListener_new, /* tp_new */ +}; + + diff --git a/python/src/Listener.hpp b/python/src/Listener.hpp new file mode 100644 index 00000000..6cd72504 --- /dev/null +++ b/python/src/Listener.hpp @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYLISTENER_HPP +#define __PYLISTENER_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD +} PySfListener; + +#endif diff --git a/python/src/Mouse.cpp b/python/src/Mouse.cpp new file mode 100644 index 00000000..490e7e3a --- /dev/null +++ b/python/src/Mouse.cpp @@ -0,0 +1,135 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include + +#include +#include + +#include "Mouse.hpp" + + +typedef struct { + PyObject_HEAD +} PySfMouse; + + + +static PyMemberDef PySfMouse_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfMouse_dealloc(PySfMouse *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfMouse_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfMouse *self; + + self = (PySfMouse *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfMouse_init(PySfMouse *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +static PyMethodDef PySfMouse_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfMouseType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Mouse", /*tp_name*/ + sizeof(PySfMouse), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfMouse_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Definition of button codes for mouse events.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfMouse_methods, /* tp_methods */ + PySfMouse_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfMouse_init, /* tp_init */ + 0, /* tp_alloc */ + PySfMouse_new, /* tp_new */ +}; + +void PySfMouse_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Mouse::Left); + PyDict_SetItemString(PySfMouseType.tp_dict, "Left", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Mouse::Right); + PyDict_SetItemString(PySfMouseType.tp_dict, "Right", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Mouse::Middle); + PyDict_SetItemString(PySfMouseType.tp_dict, "Middle", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Mouse::XButton1); + PyDict_SetItemString(PySfMouseType.tp_dict, "XButton1", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Mouse::XButton2); + PyDict_SetItemString(PySfMouseType.tp_dict, "XButton2", obj); + Py_DECREF(obj); +} + diff --git a/python/src/Mouse.hpp b/python/src/Mouse.hpp new file mode 100644 index 00000000..0876840f --- /dev/null +++ b/python/src/Mouse.hpp @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYMOUSE_HPP +#define __PYMOUSE_HPP + +void +PySfMouse_InitConst(); + +#endif diff --git a/python/src/Music.cpp b/python/src/Music.cpp new file mode 100644 index 00000000..9801262e --- /dev/null +++ b/python/src/Music.cpp @@ -0,0 +1,152 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Music.hpp" + + +extern PyTypeObject PySfSoundStreamType; + + +static PyMemberDef PySfMusic_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfMusic_dealloc(PySfMusic *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfMusic_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfMusic *self; + + self = (PySfMusic *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfMusic_init(PySfMusic *self, PyObject *args, PyObject *kwds) +{ + unsigned int BufferSize=44100; + if (PyTuple_Size(args) == 1) + { + if ( !PyArg_ParseTuple(args, "I", &BufferSize)) + return -1; + } + self->obj = new sf::Music(BufferSize); + return 0; +} + +static PyObject* +PySfMusic_OpenFromMemory(PySfMusic *self, PyObject *args) +{ + unsigned int SizeInBytes; + char *Data; + + if (! PyArg_ParseTuple(args, "s#", &Data, &SizeInBytes)) + return NULL; + + if (self->obj->OpenFromMemory(Data, (std::size_t) SizeInBytes)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfMusic_OpenFromFile(PySfMusic *self, PyObject *args) +{ + char *path = PyString_AsString(args); + if (self->obj->OpenFromFile(path)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfMusic_GetDuration(PySfMusic *self) +{ + return PyFloat_FromDouble((double)(self->obj->GetDuration())); +} + + +static PyMethodDef PySfMusic_methods[] = { + {"OpenFromFile", (PyCFunction)PySfMusic_OpenFromFile, METH_O, "OpenFromFile(Filename)\nOpen a music file (doesn't play it -- call Play() for that). Returns True if loading has been successful.\n Filename : Path of the music file to open"}, + {"OpenFromMemory", (PyCFunction)PySfMusic_OpenFromMemory, METH_VARARGS, "OpenFromMemory(Data)\nOpen a music file (doesn't play it -- call Play() for that). Returns True if loading has been successful.\n Data : string representing the file data in memory"}, + {"GetDuration", (PyCFunction)PySfMusic_GetDuration, METH_NOARGS, "GetDuration()\nGet the sound duration."}, + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfMusicType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Music", /*tp_name*/ + sizeof(PySfMusic), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfMusic_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Music defines a big sound played using streaming, so usually what we call a music :)", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfMusic_methods, /* tp_methods */ + PySfMusic_members, /* tp_members */ + 0, /* tp_getset */ + &PySfSoundStreamType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfMusic_init, /* tp_init */ + 0, /* tp_alloc */ + PySfMusic_new, /* tp_new */ +}; + + diff --git a/python/src/Music.hpp b/python/src/Music.hpp new file mode 100644 index 00000000..9d2fba40 --- /dev/null +++ b/python/src/Music.hpp @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYMUSIC_HPP +#define __PYMUSIC_HPP + +#include +#include + +#include +#include + + + +typedef struct { + PyObject_HEAD + sf::Music *obj; +} PySfMusic; + +#endif diff --git a/python/src/PostFX.cpp b/python/src/PostFX.cpp new file mode 100644 index 00000000..fb2f343d --- /dev/null +++ b/python/src/PostFX.cpp @@ -0,0 +1,211 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "PostFX.hpp" + + +extern PyTypeObject PySfImageType; +extern PyTypeObject PySfDrawableType; + +static PyMemberDef PySfPostFX_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfPostFX_dealloc(PySfPostFX *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfPostFX_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfPostFX *self; + + self = (PySfPostFX *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static PyObject * +PySfPostFX_LoadFromFile (PySfPostFX *self, PyObject *args) +{ + if (self->obj->LoadFromFile(PyString_AsString(args))) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfPostFX_LoadFromMemory (PySfPostFX *self, PyObject *args) +{ + if (self->obj->LoadFromMemory(PyString_AsString(args))) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static int +PySfPostFX_init(PySfPostFX *self, PyObject *args); + + +static PyObject * +PySfPostFX_SetParameter(PySfPostFX* self, PyObject *args) +{ + char *Name; + float X, Y, Z, W; + int size = PyTuple_Size(args); + if (! PyArg_ParseTuple(args, "sf|fff", &Name, &X, &Y, &Z, &W)) + return NULL; + + switch (size) + { + case 2: + self->obj->SetParameter(Name, X); + break; + case 3: + self->obj->SetParameter(Name, X, Y); + break; + case 4: + self->obj->SetParameter(Name, X, Y, Z); + break; + case 5: + self->obj->SetParameter(Name, X, Y, Z, W); + break; + default: + break; + } + + Py_RETURN_NONE; +} + +static PyObject * +PySfPostFX_SetTexture(PySfPostFX* self, PyObject *args) +{ + PySfImage *Image = NULL; + char *Name; + if (! PyArg_ParseTuple(args, "s|O", &Name, &Image)) + return NULL; + if (Image == NULL || (PyObject *)Image == Py_None) + self->obj->SetTexture(Name, NULL); + else + { + if (!PyObject_TypeCheck(Image, &PySfImageType)) + { + PyErr_SetString(PyExc_TypeError, "Argument 2, if specified, must be a sf.Image instance or None."); + return NULL; + } + self->obj->SetTexture(Name, Image->obj); + } + Py_RETURN_NONE; +} + +static PyObject * +PySfPostFX_CanUsePostFX(PySfPostFX* self, PyObject *args) +{ + if (sf::PostFX::CanUsePostFX()) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + + +static PyMethodDef PySfPostFX_methods[] = { + {"LoadFromFile", (PyCFunction)PySfPostFX_LoadFromFile, METH_O, "LoadFromFile(Filename)\nLoad the effect from a file."}, + {"LoadFromMemory", (PyCFunction)PySfPostFX_LoadFromMemory, METH_O, "LoadFromMemory(Effect)\nLoad the effect from a text in memory."}, + {"SetParameter", (PyCFunction)PySfPostFX_SetParameter, METH_VARARGS, "SetParameter(X), SetParameter(X, Y), SetParameter(X, Y, Z), SetParameter(X, Y, Z, W)\nChange a parameter of the effect.\n\ + Name : Parameter name in the effect\n\ + X,Y,Z,W : Values to assign."}, + {"SetTexture", (PyCFunction)PySfPostFX_SetTexture, METH_VARARGS, "SetTexture(Name, Texture)\nSet a texture parameter.\n\ + Name : Texture name in the effect\n\ + Texture : Image to set (pass None to use content of current framebuffer)"}, + {"CanUsePostFX", (PyCFunction)PySfPostFX_CanUsePostFX, METH_STATIC | METH_NOARGS, "CanUsePostFX()\nTell wether or not the system supports post-effects."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfPostFXType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "PostFX", /*tp_name*/ + sizeof(PySfPostFX), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfPostFX_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.PostFX is used to apply a post effect to a window. ", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfPostFX_methods, /* tp_methods */ + PySfPostFX_members, /* tp_members */ + 0, /* tp_getset */ + &PySfDrawableType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfPostFX_init, /* tp_init */ + 0, /* tp_alloc */ + PySfPostFX_new, /* tp_new */ +}; + +static int +PySfPostFX_init(PySfPostFX *self, PyObject *args) +{ + if (PyTuple_Size(args) == 1) + { + PySfPostFX *Copy; + if (PyArg_ParseTuple(args, "O!", &PySfPostFXType, &Copy)) + self->obj = new sf::PostFX(*(Copy->obj)); + else + return -1; + } + else + self->obj = new sf::PostFX(); + return 0; +} + diff --git a/python/src/PostFX.hpp b/python/src/PostFX.hpp new file mode 100644 index 00000000..20541ace --- /dev/null +++ b/python/src/PostFX.hpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYPOSTFX_HPP +#define __PYPOSTFX_HPP + +#include +#include + +#include +#include + +#include "Drawable.hpp" +#include "Image.hpp" + +typedef struct { + PyObject_HEAD + sf::PostFX *obj; +} PySfPostFX; + +#endif diff --git a/python/src/Rect.cpp b/python/src/Rect.cpp new file mode 100644 index 00000000..abd938ab --- /dev/null +++ b/python/src/Rect.cpp @@ -0,0 +1,437 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Rect.hpp" + +static PyMemberDef PySfIntRect_members[] = { + {(char *)"Left", T_INT, offsetof(PySfIntRect, Left), 0, (char *)"Left coordinate of the rectangle."}, + {(char *)"Top", T_INT, offsetof(PySfIntRect, Top), 0, (char *)"Top coordinate of the rectangle."}, + {(char *)"Right", T_INT, offsetof(PySfIntRect, Right), 0, (char *)"Right coordinate of the rectangle."}, + {(char *)"Bottom", T_INT, offsetof(PySfIntRect, Bottom), 0, (char *)"Bottom coordinate of the rectangle."}, + {NULL} /* Sentinel */ +}; + +static PyMemberDef PySfFloatRect_members[] = { + {(char *)"Left", T_FLOAT, offsetof(PySfFloatRect, Left), 0, (char *)"Left coordinate of the rectangle."}, + {(char *)"Top", T_FLOAT, offsetof(PySfFloatRect, Top), 0, (char *)"Top coordinate of the rectangle."}, + {(char *)"Right", T_FLOAT, offsetof(PySfFloatRect, Right), 0, (char *)"Right coordinate of the rectangle."}, + {(char *)"Bottom", T_FLOAT, offsetof(PySfFloatRect, Bottom), 0, (char *)"Bottom coordinate of the rectangle."}, + {NULL} /* Sentinel */ +}; + +static void +PySfIntRect_dealloc(PySfIntRect* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static void +PySfFloatRect_dealloc(PySfFloatRect* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfIntRect_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfIntRect *self; + + self = (PySfIntRect *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static PyObject * +PySfFloatRect_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfFloatRect *self; + + self = (PySfFloatRect *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfIntRect_init(PySfIntRect *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Left", "Top", "Right", "Bottom", NULL}; + int Left, Top, Right, Bottom; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "iiii", (char **)kwlist, &Left, &Top, &Right, &Bottom)) + return -1; + + self->Left = Left; + self->Top = Top; + self->Right = Right; + self->Bottom = Bottom; + self->obj = new sf::IntRect(Left, Top, Right, Bottom); + return 0; +} + +static PyObject * +PySfIntRect_GetWidth(PySfIntRect *self) +{ + PySfIntRectUpdateObj(self); + return PyInt_FromLong(self->obj->GetWidth()); +} + +static PyObject * +PySfIntRect_GetHeight(PySfIntRect *self) +{ + PySfIntRectUpdateObj(self); + return PyInt_FromLong(self->obj->GetHeight()); +} + +static PyObject * +PySfIntRect_Contains(PySfIntRect* self, PyObject *args); + +static PyObject * +PySfIntRect_Intersects(PySfIntRect* self, PyObject *args); + +static PyObject * +PySfFloatRect_GetWidth(PySfFloatRect *self) +{ + PySfFloatRectUpdateObj(self); + return PyFloat_FromDouble(self->obj->GetWidth()); +} + +static PyObject * +PySfFloatRect_GetHeight(PySfFloatRect *self) +{ + PySfFloatRectUpdateObj(self); + return PyFloat_FromDouble(self->obj->GetHeight()); +} + +static PyObject * +PySfFloatRect_Contains(PySfFloatRect* self, PyObject *args); + +static PyObject * +PySfFloatRect_Intersects(PySfFloatRect* self, PyObject *args); + +static int +PySfFloatRect_init(PySfFloatRect *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Left", "Top", "Right", "Bottom", NULL}; + float Left, Top, Right, Bottom; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "ffff", (char **)kwlist, &Left, &Top, &Right, &Bottom)) + return -1; + + self->Left = Left; + self->Top = Top; + self->Right = Right; + self->Bottom = Bottom; + self->obj = new sf::FloatRect(Left, Top, Right, Bottom); + return 0; +} + + +static PyObject * +PySfIntRect_Offset(PySfIntRect* self, PyObject *args) +{ + int OffsetX, OffsetY; + + if (!PyArg_ParseTuple(args, "ii", &OffsetX, &OffsetY)) + return NULL; + + PySfIntRectUpdateObj(self); + self->obj->Offset(OffsetX, OffsetY); + PySfIntRectUpdateSelf(self); + Py_RETURN_NONE; +} + +static PyObject * +PySfFloatRect_Offset(PySfFloatRect* self, PyObject *args) +{ + float OffsetX, OffsetY; + + if (!PyArg_ParseTuple(args, "ff", &OffsetX, &OffsetY)) + return NULL; + + PySfFloatRectUpdateObj(self); + self->obj->Offset(OffsetX, OffsetY); + PySfFloatRectUpdateSelf(self); + Py_RETURN_NONE; +} + + +static PyMethodDef PySfIntRect_methods[] = { + {"Offset", (PyCFunction)PySfIntRect_Offset, METH_VARARGS, "Offset(OffsetX, OffsetY)\n\ +Move the whole rectangle by the given offset.\n\ + OffsetX : Horizontal offset\n\ + OffsetY : Vertical offset\n\ +"}, + {"GetWidth", (PyCFunction)PySfIntRect_GetWidth, METH_NOARGS, "GetWidth()\n\ +Get the width of the rectangle."}, + {"GetHeight", (PyCFunction)PySfIntRect_GetHeight, METH_NOARGS, "GetHeight()\n\ +Get the height of the rectangle."}, + {"Contains", (PyCFunction)PySfIntRect_Contains, METH_VARARGS, "Contains(X, Y)\n\ +Check if a point is inside the rectangle's area.\n\ + X : X coordinate of the point to test\n\ + Y : Y coordinate of the point to test"}, + {"Intersects", (PyCFunction)PySfIntRect_Intersects, METH_VARARGS, "Intersects(Rectangle, OverlappingRect=None)\n\ +Check intersection between two rectangles.\n\ + Rectangle : Rectangle to test\n\ + OverlappingRect : Rectangle to be filled with overlapping rect (None by default)"}, + {NULL} /* Sentinel */ +}; + + +static PyMethodDef PySfFloatRect_methods[] = { + {"Offset", (PyCFunction)PySfFloatRect_Offset, METH_VARARGS, "Offset(OffsetX, OffsetY)\n\ +Move the whole rectangle by the given offset.\n\ + OffsetX : Horizontal offset\n\ + OffsetY : Vertical offset\n\ +"}, + {"GetWidth", (PyCFunction)PySfFloatRect_GetWidth, METH_NOARGS, "GetWidth()\n\ +Get the width of the rectangle."}, + {"GetHeight", (PyCFunction)PySfFloatRect_GetHeight, METH_NOARGS, "GetHeight()\n\ +Get the height of the rectangle."}, + {"Contains", (PyCFunction)PySfFloatRect_Contains, METH_VARARGS, "Contains(X, Y)\n\ +Check if a point is inside the rectangle's area.\n\ + X : X coordinate of the point to test\n\ + Y : Y coordinate of the point to test"}, + {"Intersects", (PyCFunction)PySfFloatRect_Intersects, METH_VARARGS, "Intersects(Rectangle, OverlappingRect=None)\n\ +Check intersection between two rectangles.\n\ + Rectangle : Rectangle to test\n\ + OverlappingRect : Rectangle to be filled with overlapping rect (None by default)"}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfIntRectType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "IntRect", /*tp_name*/ + sizeof(PySfIntRect), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfIntRect_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.IntRect is an utility class for manipulating rectangles.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfIntRect_methods, /* tp_methods */ + PySfIntRect_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfIntRect_init, /* tp_init */ + 0, /* tp_alloc */ + PySfIntRect_new, /* tp_new */ +}; + + +PyTypeObject PySfFloatRectType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "FloatRect", /*tp_name*/ + sizeof(PySfFloatRect), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfFloatRect_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.FloatRect is an utility class for manipulating rectangles.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfFloatRect_methods, /* tp_methods */ + PySfFloatRect_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfFloatRect_init, /* tp_init */ + 0, /* tp_alloc */ + PySfFloatRect_new, /* tp_new */ +}; + + +static PyObject * +PySfFloatRect_Contains(PySfFloatRect* self, PyObject *args) +{ + float x=0, y=0; + + if (! PyArg_ParseTuple(args, "ff", &x, &y)) + return NULL; + + PySfFloatRectUpdateObj(self); + if (self->obj->Contains(x,y)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfFloatRect_Intersects(PySfFloatRect* self, PyObject *args) +{ + PySfFloatRect *Rect=NULL, *OverlappingRect=NULL; + bool result; + + + if (! PyArg_ParseTuple(args, "O!|O!", &PySfFloatRectType, &Rect, &PySfFloatRectType, &OverlappingRect)) + return NULL; + + PySfFloatRectUpdateObj(self); + if (OverlappingRect) + result = self->obj->Intersects(*(Rect->obj), (OverlappingRect->obj)); + else + result = self->obj->Intersects(*(Rect->obj)); + + if (result) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + + +static PyObject * +PySfIntRect_Contains(PySfIntRect* self, PyObject *args) +{ + unsigned int x=0, y=0; + + PySfIntRectUpdateObj(self); + if (! PyArg_ParseTuple(args, "II", &x, &y)) + return NULL; + + if (self->obj->Contains(x,y)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfIntRect_Intersects(PySfIntRect* self, PyObject *args) +{ + PySfIntRect *Rect=NULL, *OverlappingRect=NULL; + bool result; + + PySfIntRectUpdateObj(self); + if (! PyArg_ParseTuple(args, "O!|O!", &PySfIntRectType, &Rect, &PySfIntRectType, &OverlappingRect)) + return NULL; + + if (OverlappingRect) + result = self->obj->Intersects(*(Rect->obj), (OverlappingRect->obj)); + else + result = self->obj->Intersects(*(Rect->obj)); + + if (result) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +void +PySfIntRectUpdateObj(PySfIntRect *self) +{ + self->obj->Left = self->Left; + self->obj->Right = self->Right; + self->obj->Top = self->Top; + self->obj->Bottom = self->Bottom; +} + +void +PySfFloatRectUpdateObj(PySfFloatRect *self) +{ + self->obj->Left = self->Left; + self->obj->Right = self->Right; + self->obj->Top = self->Top; + self->obj->Bottom = self->Bottom; +} +void +PySfIntRectUpdateSelf(PySfIntRect *self) +{ + self->Left = self->obj->Left; + self->Right = self->obj->Right; + self->Top = self->obj->Top; + self->Bottom = self->obj->Bottom; +} + +void +PySfFloatRectUpdateSelf(PySfFloatRect *self) +{ + self->Left = self->obj->Left; + self->Right = self->obj->Right; + self->Top = self->obj->Top; + self->Bottom = self->obj->Bottom; +} + +PySfIntRect * +GetNewPySfIntRect() +{ + return PyObject_New(PySfIntRect, &PySfIntRectType); +} + +PySfFloatRect * +GetNewPySfFloatRect() +{ + return PyObject_New(PySfFloatRect, &PySfFloatRectType); +} + + diff --git a/python/src/Rect.hpp b/python/src/Rect.hpp new file mode 100644 index 00000000..59856f92 --- /dev/null +++ b/python/src/Rect.hpp @@ -0,0 +1,73 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYRECT_HPP +#define __PYRECT_HPP + + +#include +#include + +#include +#include + +#include "offsetof.hpp" + +typedef struct { + PyObject_HEAD + int Left; + int Right; + int Top; + int Bottom; + sf::IntRect *obj; +} PySfIntRect; + +typedef struct { + PyObject_HEAD + float Left; + float Right; + float Top; + float Bottom; + sf::FloatRect *obj; +} PySfFloatRect; + +PySfIntRect * +GetNewPySfIntRect(); + +PySfFloatRect * +GetNewPySfFloatRect(); + +void +PySfIntRectUpdateObj(PySfIntRect *self); + +void +PySfFloatRectUpdateObj(PySfFloatRect *self); + +void +PySfIntRectUpdateSelf(PySfIntRect *self); + +void +PySfFloatRectUpdateSelf(PySfFloatRect *self); + +#endif diff --git a/python/src/RenderWindow.cpp b/python/src/RenderWindow.cpp new file mode 100644 index 00000000..a251bd82 --- /dev/null +++ b/python/src/RenderWindow.cpp @@ -0,0 +1,289 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "RenderWindow.hpp" + +#include "Event.hpp" +#include "VideoMode.hpp" +#include "Drawable.hpp" +#include "Color.hpp" +#include "Rect.hpp" +#include "View.hpp" +#include "Image.hpp" +#include "Window.hpp" + +#include "SFML/Window/WindowStyle.hpp" + + +extern PyTypeObject PySfEventType; +extern PyTypeObject PySfViewType; +extern PyTypeObject PySfColorType; +extern PyTypeObject PySfWindowType; +extern PyTypeObject PySfWindowSettingsType; +extern PyTypeObject PySfVideoModeType; +extern PyTypeObject PySfDrawableType; + +static PyMemberDef PySfRenderWindow_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfRenderWindow_dealloc(PySfRenderWindow* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfRenderWindow_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfRenderWindow *self; + + self = (PySfRenderWindow *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfRenderWindow_init(PySfRenderWindow *self, PyObject *args, PyObject *kwds) +{ + self->obj = new sf::RenderWindow(); + if (PyTuple_Size(args) > 0) + PySfWindow_Create((PySfWindow *)self, args, kwds); + return 0; +} + +static PyObject * +PySfRenderWindow_Capture(PySfRenderWindow *self) +{ + PySfImage *Image; + + Image = GetNewPySfImage(); + Image->obj = new sf::Image(self->obj->Capture()); + return (PyObject *)Image; +} + +static PyObject * +PySfRenderWindow_ConvertCoords(PySfRenderWindow *self, PyObject *args) +{ + unsigned int WindowX, WindowY; + PySfView *PyTargetView = NULL; + sf::View *TargetView = NULL; + sf::Vector2f Vect; + + if (! PyArg_ParseTuple(args, "II|O!", &WindowX, &WindowY, &PySfViewType, &PyTargetView)) + return NULL; + + if (PyTargetView) + TargetView = PyTargetView->obj; + + Vect = self->obj->ConvertCoords(WindowX, WindowY, TargetView); + return Py_BuildValue("ff", Vect.x, Vect.y); +} + +static bool +PySfRenderWindow_DrawObject(PySfRenderWindow *RenderWindow, PySfDrawable *Obj) +{ + if (PyObject_TypeCheck((PyObject *)Obj, &PySfDrawableType)) + { + if (PyObject_HasAttrString((PyObject *)Obj, "Render")) + { + Obj->obj->RenderWindow = RenderWindow; + Obj->obj->RenderFunction = PyObject_GetAttrString((PyObject *)Obj, "Render"); + } + RenderWindow->obj->Draw( *(Obj->obj) ); + return true; + } + return false; +} + +static PyObject * +PySfRenderWindow_Draw(PySfRenderWindow *self, PyObject *args) +{ + if (!args) + return NULL; + + + if (!PySfRenderWindow_DrawObject(self, (PySfDrawable *)args)) + { + PyObject *iterator = PyObject_GetIter(args); + PyObject *item; + + if (iterator == NULL) + { + PyErr_SetString(PyExc_TypeError, "Argument to Draw method is neither a Drawable nor an iterable."); + return NULL; + } + + while ((item = PyIter_Next(iterator))) + { + if (!PySfRenderWindow_DrawObject(self, (PySfDrawable *)item)) + { + PyErr_SetString(PyExc_TypeError, "Object in iterable not a Drawable."); + return NULL; + } + Py_DECREF(item); + } + + Py_DECREF(iterator); + + if (PyErr_Occurred()) { + return NULL; + } + } + Py_RETURN_NONE; +} + +static PyObject * +PySfRenderWindow_GetDefaultView(PySfRenderWindow *self) +{ + PySfView *View; + + View = GetNewPySfView(); + View->Owner = false; + View->obj = &(self->obj->GetDefaultView()); + + return (PyObject *)View; +} + +static PyObject * +PySfRenderWindow_GetView(PySfRenderWindow *self) +{ + PySfView *View; + + View = GetNewPySfView(); + View->obj = new sf::View(self->obj->GetView()); + + return (PyObject *)View; +} + +static PyObject * +PySfRenderWindow_PreserveOpenGLStates(PySfRenderWindow *self, PyObject *args) +{ + bool Optimize = false; + if (PyObject_IsTrue(args)) + Optimize = true; + self->obj->PreserveOpenGLStates(Optimize); + Py_RETURN_NONE; +} + +static PyObject * +PySfRenderWindow_SetView(PySfRenderWindow* self, PyObject *args) +{ + PySfView *View = (PySfView *)args; + if (! PyObject_TypeCheck(View, &PySfViewType)) + { + PyErr_SetString(PyExc_TypeError, "Argument is not a sfView"); + return NULL; + } + self->obj->SetView( *(View->obj)); + Py_RETURN_NONE; +} + +static PyObject * +PySfRenderWindow_Clear(PySfRenderWindow* self, PyObject *args) +{ + PySfColor *Color = (PySfColor *)args; + if (! PyObject_TypeCheck(Color, &PySfColorType)) + { + PyErr_SetString(PyExc_TypeError, "Argument is not a sfColor"); + return NULL; + } + PySfColorUpdate(Color); + self->obj->Clear(*(Color->obj)); + Py_RETURN_NONE; +} + +static PyMethodDef PySfRenderWindow_methods[] = { + {"Clear", (PyCFunction)PySfRenderWindow_Clear, METH_O, "Clear(FillColor)\n\ +Clear the entire target with a single color.\n\ + FillColor : Color to use to clear the render target."}, + {"Capture", (PyCFunction)PySfRenderWindow_Capture, METH_NOARGS, "Capture()\n\ +Save the content of the window to an image. Returns a sf.Image object."}, + {"ConvertCoords", (PyCFunction)PySfRenderWindow_ConvertCoords, METH_VARARGS, "ConvertCoords(WindowX, WindowY, TargetView)\n\ +Convert a point in window coordinates into view coordinates. Returns a tuple of two floats.\n\ + WindowX : X coordinate of the point to convert, relative to the window\n\ + WindowY : Y coordinate of the point to convert, relative to the window\n\ + TargetView : Target view to convert the point to (NULL by default -- uses the current view)."}, + {"Draw", (PyCFunction)PySfRenderWindow_Draw, METH_O, "Draw(Drawable)\n\ +Draw something on the window. The argument can be a drawable or any object supporting the iterator protocol and containing drawables (for example a tuple of drawables)."}, + {"GetDefaultView", (PyCFunction)PySfRenderWindow_GetDefaultView, METH_NOARGS, "GetDefaultView()\n\ +Get the default view of the window for read / write (returns a sf.View instance)."}, + {"GetView", (PyCFunction)PySfRenderWindow_GetView, METH_NOARGS, "GetView()\n\ +Get the current view rectangle (returns a sf.View instance)."}, + {"PreserveOpenGLStates", (PyCFunction)PySfRenderWindow_PreserveOpenGLStates, METH_O, "PreserveOpenGLStates(Preserve)\n\ +Tell SFML to preserve external OpenGL states, at the expense of more CPU charge. Use this function if you don't want SFML to mess up your own OpenGL states (if any). Don't enable state preservation if not needed, as it will allow SFML to do internal optimizations and improve performances. This parameter is false by default\n\ + Preserve : True to preserve OpenGL states, false to let SFML optimize"}, + {"SetView", (PyCFunction)PySfRenderWindow_SetView, METH_O, "SetView(View)\n\ +Change the current active view. View must be a sf.View instance."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfRenderWindowType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "RenderWindow", /*tp_name*/ + sizeof(PySfRenderWindow), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfRenderWindow_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Simple wrapper for sf.Window that allows easy 2D rendering.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfRenderWindow_methods, /* tp_methods */ + PySfRenderWindow_members, /* tp_members */ + 0, /* tp_getset */ + &PySfWindowType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfRenderWindow_init, /* tp_init */ + 0, /* tp_alloc */ + PySfRenderWindow_new, /* tp_new */ +}; + + diff --git a/python/src/RenderWindow.hpp b/python/src/RenderWindow.hpp new file mode 100644 index 00000000..c484b891 --- /dev/null +++ b/python/src/RenderWindow.hpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYRENDERWINDOW_HPP +#define __PYRENDERWINDOW_HPP + +#include +#include + +#include +#include + +#include "WindowSettings.hpp" + +typedef struct { + PyObject_HEAD + sf::RenderWindow *obj; +} PySfRenderWindow; + + +#endif diff --git a/python/src/Shape.cpp b/python/src/Shape.cpp new file mode 100644 index 00000000..ad2bd526 --- /dev/null +++ b/python/src/Shape.cpp @@ -0,0 +1,396 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Shape.hpp" + +#include +#include "Color.hpp" + +extern PyTypeObject PySfColorType; +extern PyTypeObject PySfDrawableType; + +static PyMemberDef PySfShape_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfShape_dealloc(PySfShape* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfShape_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfShape *self; + + self = (PySfShape *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfShape_init(PySfShape *self, PyObject *args) +{ + self->obj = new sf::Shape(); + return 0; +} + + +// void AddPoint(float X, float Y, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0)); +static PyObject * +PySfShape_AddPoint(PySfShape* self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"X", "Y", "Col", "OutlineCol", NULL}; + float X, Y; + sf::Color *Col, *OutlineCol; + PySfColor *ColTmp=NULL, *OutlineColTmp=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff|O!O!", (char **)kwlist, &X, &Y, &PySfColorType, &ColTmp, &PySfColorType, &OutlineColTmp)) + return NULL; + + if (ColTmp) + { + PySfColorUpdate(ColTmp); + Col = ColTmp->obj; + } + else + Col = (sf::Color *)&sf::Color::Black; + + if (OutlineColTmp) + { + PySfColorUpdate(OutlineColTmp); + OutlineCol = OutlineColTmp->obj; + } + else + OutlineCol = (sf::Color *)&sf::Color::Black; + + self->obj->AddPoint(X, Y, *Col, *OutlineCol); + + Py_RETURN_NONE; +} + +static PyObject * +PySfShape_SetOutlineWidth(PySfShape* self, PyObject *args) +{ + self->obj->SetOutlineWidth(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfShape_GetOutlineWidth(PySfShape* self) +{ + return PyFloat_FromDouble(self->obj->GetOutlineWidth()); +} + +// static Shape Line(float X0, float Y0, float X1, float Y1, float Thickness, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); +static PyObject * +PySfShape_Line(PySfShape* self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"X0", "Y0", "X1", "Y1", "Thickness", "Col", "Outline", "OutlineCol", NULL}; + PySfShape *Line = GetNewPySfShape(); + float X0, Y0, X1, Y1, Thickness, Outline = 0.f; + sf::Color *OutlineCol; + PySfColor *ColTmp, *OutlineColTmp=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "fffffO!|fO!", (char **)kwlist, &X0, &Y0, &X1, &Y1, &Thickness, &PySfColorType, &ColTmp, &Outline, &PySfColorType, &OutlineColTmp)) + return NULL; + if (OutlineColTmp) + { + PySfColorUpdate(OutlineColTmp); + OutlineCol = OutlineColTmp->obj; + } + else + OutlineCol = (sf::Color *)&sf::Color::Black; + + PySfColorUpdate(ColTmp); + Line->obj = new sf::Shape(sf::Shape::Line(X0, Y0, X1, Y1, Thickness, *(ColTmp->obj), Outline, *OutlineCol)); + return (PyObject *)Line; +} + +// static Shape Rectangle(float X0, float Y0, float X1, float Y1, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); +static PyObject * +PySfShape_Rectangle(PySfShape* self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"X0", "Y0", "X1", "Y1", "Col", "Outline", "OutlineCol", NULL}; + PySfShape *Rectangle = GetNewPySfShape(); + float X0, Y0, X1, Y1, Outline = 0.f; + sf::Color *OutlineCol; + PySfColor *ColTmp, *OutlineColTmp=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffffO!|fO!", (char **)kwlist, &X0, &Y0, &X1, &Y1, &PySfColorType, &ColTmp, &Outline, &PySfColorType, &OutlineColTmp)) + return NULL; + if (OutlineColTmp) + { + PySfColorUpdate(OutlineColTmp); + OutlineCol = OutlineColTmp->obj; + } + else + OutlineCol = (sf::Color *)&sf::Color::Black; + + PySfColorUpdate(ColTmp); + Rectangle->obj = new sf::Shape(sf::Shape::Rectangle(X0, Y0, X1, Y1, *(ColTmp->obj), Outline, *OutlineCol)); + return (PyObject *)Rectangle; +} + +// static Shape Circle(float X, float Y, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)); +static PyObject * +PySfShape_Circle(PySfShape* self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"X", "Y", "Radius", "Col", "Outline", "OutlineCol", NULL}; + PySfShape *Circle = GetNewPySfShape(); + float X, Y, Radius, Outline = 0.f; + sf::Color *OutlineCol; + PySfColor *ColTmp, *OutlineColTmp=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "fffO!|fO!", (char **)kwlist, &X, &Y, &Radius, &PySfColorType, &ColTmp, &Outline, &PySfColorType, &OutlineColTmp)) + return NULL; + if (OutlineColTmp) + { + PySfColorUpdate(OutlineColTmp); + OutlineCol = OutlineColTmp->obj; + } + else + OutlineCol = (sf::Color *)&sf::Color::Black; + + PySfColorUpdate(ColTmp); + Circle->obj = new sf::Shape(sf::Shape::Circle(X, Y, Radius, *(ColTmp->obj), Outline, *OutlineCol)); + return (PyObject *)Circle; +} + +static PyObject * +PySfShape_GetPointPosition(PySfShape* self, PyObject *args) +{ + sf::Vector2f result = self->obj->GetPointPosition(PyLong_AsUnsignedLong(args)); + return Py_BuildValue("ff", result.x, result.y); +} + +static PyObject * +PySfShape_GetPointColor(PySfShape* self, PyObject *args) +{ + PySfColor *PyColor = GetNewPySfColor(); + PyColor->obj = new sf::Color(self->obj->GetPointColor(PyLong_AsUnsignedLong(args))); + PyColor->r = PyColor->obj->r; + PyColor->g = PyColor->obj->g; + PyColor->b = PyColor->obj->b; + PyColor->a = PyColor->obj->a; + return (PyObject *)PyColor; +} + +static PyObject * +PySfShape_GetPointOutlineColor(PySfShape* self, PyObject *args) +{ + PySfColor *PyColor = GetNewPySfColor(); + PyColor->obj = new sf::Color(self->obj->GetPointOutlineColor(PyLong_AsUnsignedLong(args))); + PyColor->r = PyColor->obj->r; + PyColor->g = PyColor->obj->g; + PyColor->b = PyColor->obj->b; + PyColor->a = PyColor->obj->a; + return (PyObject *)PyColor; +} + +static PyObject * +PySfShape_SetPointPosition(PySfShape* self, PyObject *args) +{ + unsigned int Index; + float X, Y; + if (!PyArg_ParseTuple(args, "Iff", &Index, &X, &Y)) + return NULL; + self->obj->SetPointPosition(Index, X, Y); + Py_RETURN_NONE; +} + +static PyObject * +PySfShape_SetPointColor(PySfShape* self, PyObject *args) +{ + unsigned int Index; + PySfColor *Color; + if (!PyArg_ParseTuple(args, "IO!", &Index, &PySfColorType, &Color)) + return NULL; + PySfColorUpdate(Color); + self->obj->SetPointColor(Index, *(Color->obj)); + Py_RETURN_NONE; +} + +static PyObject * +PySfShape_SetPointOutlineColor(PySfShape* self, PyObject *args) +{ + unsigned int Index; + PySfColor *Color; + if (!PyArg_ParseTuple(args, "IO!", &Index, &PySfColorType, &Color)) + return NULL; + PySfColorUpdate(Color); + self->obj->SetPointOutlineColor(Index, *(Color->obj)); + Py_RETURN_NONE; +} + +static PyObject * +PySfShape_GetNbPoints(PySfShape* self, PyObject *args) +{ + return PyLong_FromUnsignedLong(self->obj->GetNbPoints()); +} + +static PyObject * +PySfShape_EnableFill(PySfShape* self, PyObject *args) +{ + if (PyObject_IsTrue(args)) + self->obj->EnableFill(true); + else + self->obj->EnableFill(false); + Py_RETURN_NONE; +} + +static PyObject * +PySfShape_EnableOutline(PySfShape* self, PyObject *args) +{ + if (PyObject_IsTrue(args)) + self->obj->EnableOutline(true); + else + self->obj->EnableOutline(false); + Py_RETURN_NONE; +} + +static PyMethodDef PySfShape_methods[] = { + {"GetPointPosition", (PyCFunction)PySfShape_GetPointPosition, METH_O, "GetPointPosition(Index)\n\ +Get the position of a point.\n\ + Index : Index-th point."}, + {"GetPointColor", (PyCFunction)PySfShape_GetPointColor, METH_O, "GetPointColor(Index)\n\ +Get the color of a point.\n Index : Index-th point."}, + {"GetPointOutlineColor", (PyCFunction)PySfShape_GetPointOutlineColor, METH_O, "GetPointOutlineColor(Index)\n\ +Get the outline color of a point.\n Index : Index-th point."}, + {"SetPointPosition", (PyCFunction)PySfShape_SetPointPosition, METH_VARARGS, "SetPointPosition(Index, X, Y).\n\ +Set the position of a point\n\ + Index : Index of the point, in range [0, GetNbPoints() - 1]\n\ + X : New X coordinate of the Index-th point\n\ + Y : New Y coordinate of the Index-th point."}, + {"SetPointColor", (PyCFunction)PySfShape_SetPointColor, METH_VARARGS, "SetPointColor(Index, Color).\n\ +Set the color of a point\n\ + Index : Index of the point, in range [0, GetNbPoints() - 1]\n\ + Col : New color of the Index-th point."}, + {"SetPointOutlineColor", (PyCFunction)PySfShape_SetPointOutlineColor, METH_VARARGS, "SetPointOutlineColor(Index, Color).\n\ +Set the outline color of a point\n\ + Index : Index of the point, in range [0, GetNbPoints() - 1]\n\ + Col : New color of the Index-th point."}, + {"GetNbPoints", (PyCFunction)PySfShape_GetNbPoints, METH_NOARGS, "GetNbPoints()\n\ +Get the number of points composing the shape."}, + {"EnableFill", (PyCFunction)PySfShape_EnableFill, METH_O, "EnableFill(Enable)\n\ +Enable or disable filling the shape. Fill is enabled by default.\n\ + Enable : True to enable, false to disable."}, + {"EnableOutline", (PyCFunction)PySfShape_EnableOutline, METH_O, "EnableOutline(Enable)\n\ +Enable or disable drawing the shape outline. Outline is enabled by default.\n\ + Enable : True to enable, false to disable"}, + {"AddPoint", (PyCFunction)PySfShape_AddPoint, METH_VARARGS | METH_KEYWORDS, "AddPoint(X, Y, Col=sf.Color.White, OutlineCol=sf.Color.Black)\n\ +Add a point to the shape.\n\ + X : X coordinate of the point\n\ + Y : Y coordinate of the point\n\ + Col : Color of the point (white by default)\n\ + OutlineCol : Outline color of the point (black by default)."}, + {"SetOutlineWidth", (PyCFunction)PySfShape_SetOutlineWidth, METH_O, "SetOutlineWidth(Width)\n\ +Change the width of the shape outline.\n\ + Width : New width (use 0 to remove the outline)."}, + {"GetOutlineWidth", (PyCFunction)PySfShape_GetOutlineWidth, METH_NOARGS, "GetOutlineWidth()\n\ +Get the width of the shape outline."}, + {"Line", (PyCFunction)PySfShape_Line, METH_STATIC | METH_VARARGS | METH_KEYWORDS, "Line(X0, Y0, X1, Y1, Thickness, Col, Outline = 0., OutlineCol = sf.Color(0, 0, 0))\n\ +Create a shape made of a single line.\n\ + X0 : X coordinate of the first point.\n\ + Y0 : Y coordinate of the first point.\n\ + X1 : X coordinate of the second point.\n\ + Y1 : Y coordinate of the second point.\n\ + Thickness : Line thickness.\n\ + Col : Color used to draw the line\n\ + Outline : Outline width (0 by default)\n\ + OutlineCol : Color used to draw the outline (black by default)."}, + {"Rectangle", (PyCFunction)PySfShape_Rectangle, METH_STATIC | METH_VARARGS | METH_KEYWORDS, "Rectangle(X0, Y0, X1, Y1, Col, Outline = 0., OutlineCol = sf.Color(0, 0, 0))\n\ +Create a shape made of a single rectangle.\n\ + X0 : X coordinate of the first point.\n\ + Y0 : Y coordinate of the first point.\n\ + X1 : X coordinate of the second point.\n\ + Y1 : Y coordinate of the second point.\n\ + Col : Color used to fill the rectangle.\n\ + Outline : Outline width (0 by default).\n\ + OutlineCol : Color used to draw the outline (black by default)."}, + {"Circle", (PyCFunction)PySfShape_Circle, METH_STATIC | METH_VARARGS | METH_KEYWORDS, "Circle(X, Y, Radius, Col, Outline = 0., OutlineCol = sf.Color(0, 0, 0))\n\ +Create a shape made of a single circle.\n\ + X : X coordinate of the center.\n\ + Y : Y coordinate of the center.\n\ + Radius : Radius\n\ + Col : Color used to fill the rectangle.\n\ + Outline : Outline width (0 by default).\n\ + OutlineCol : Color used to draw the outline (black by default)."}, + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfShapeType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Shape", /*tp_name*/ + sizeof(PySfShape), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfShape_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Shape defines a drawable convex shape ; it also defines helper functions to draw simple shapes like lines, rectangles, circles, etc.\nDefault constructor: Shape()", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfShape_methods, /* tp_methods */ + PySfShape_members, /* tp_members */ + 0, /* tp_getset */ + &PySfDrawableType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfShape_init, /* tp_init */ + 0, /* tp_alloc */ + PySfShape_new, /* tp_new */ +}; + + +PySfShape * +GetNewPySfShape() +{ + return PyObject_New(PySfShape, &PySfShapeType); +} + diff --git a/python/src/Shape.hpp b/python/src/Shape.hpp new file mode 100644 index 00000000..05bab545 --- /dev/null +++ b/python/src/Shape.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSHAPE_HPP +#define __PYSHAPE_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD + sf::Shape *obj; +} PySfShape; + +PySfShape * +GetNewPySfShape(); + +#endif diff --git a/python/src/Sleep.cpp b/python/src/Sleep.cpp new file mode 100644 index 00000000..303c8856 --- /dev/null +++ b/python/src/Sleep.cpp @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Sleep.hpp" + +PyObject * +PySFML_Sleep (PyObject *self, PyObject *args) +{ + sf::Sleep(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + diff --git a/python/src/Sleep.hpp b/python/src/Sleep.hpp new file mode 100644 index 00000000..ad2b7e0e --- /dev/null +++ b/python/src/Sleep.hpp @@ -0,0 +1,37 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSLEEP_HPP +#define __PYSLEEP_HPP + +#include +#include + +#include +#include + +PyObject * +PySFML_Sleep (PyObject *self, PyObject *args); + +#endif diff --git a/python/src/Sound.cpp b/python/src/Sound.cpp new file mode 100644 index 00000000..d755d448 --- /dev/null +++ b/python/src/Sound.cpp @@ -0,0 +1,339 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Sound.hpp" + +#include "SoundBuffer.hpp" + +extern PyTypeObject PySfSoundBufferType; + +static PyMemberDef PySfSound_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfSound_dealloc(PySfSound *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfSound_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfSound *self; + + self = (PySfSound *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfSound_init(PySfSound *self, PyObject *args, PyObject *kwds); + +static PyObject* +PySfSound_SetBuffer(PySfSound *self, PyObject *args) +{ + PySfSoundBuffer *Buffer = (PySfSoundBuffer *)args; + if ( ! PyObject_TypeCheck(args, &PySfSoundBufferType)) + PyErr_SetString(PyExc_TypeError, "The argument must be a sfSoundBuffer."); + + self->obj->SetBuffer(*(Buffer->obj)); + + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_SetLoop(PySfSound *self, PyObject *args) +{ + if (PyObject_IsTrue(args)) + self->obj->SetLoop(true); + else + self->obj->SetLoop(false); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_SetPitch(PySfSound *self, PyObject *args) +{ + self->obj->SetPitch(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_SetMinDistance(PySfSound *self, PyObject *args) +{ + self->obj->SetMinDistance(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_SetAttenuation(PySfSound *self, PyObject *args) +{ + self->obj->SetAttenuation(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_SetVolume(PySfSound *self, PyObject *args) +{ + self->obj->SetVolume(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_GetPitch(PySfSound *self) +{ + return PyFloat_FromDouble(self->obj->GetPitch()); +} + +static PyObject* +PySfSound_GetMinDistance(PySfSound *self) +{ + return PyFloat_FromDouble(self->obj->GetMinDistance()); +} + +static PyObject* +PySfSound_GetAttenuation(PySfSound *self) +{ + return PyFloat_FromDouble(self->obj->GetAttenuation()); +} + +static PyObject* +PySfSound_GetVolume(PySfSound *self) +{ + return PyFloat_FromDouble(self->obj->GetVolume()); +} + +static PyObject* +PySfSound_GetPosition(PySfSound *self) +{ + sf::Vector3f Vect = self->obj->GetPosition(); + return Py_BuildValue("fff", Vect.x, Vect.y, Vect.z); +} + +static PyObject* +PySfSound_GetPlayingOffset(PySfSound *self) +{ + return PyFloat_FromDouble(self->obj->GetPlayingOffset()); +} + +static PyObject* +PySfSound_GetLoop(PySfSound *self) +{ + if (self->obj->GetLoop()) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfSound_Play(PySfSound *self) +{ + self->obj->Play(); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_Pause(PySfSound *self) +{ + self->obj->Pause(); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_Stop(PySfSound *self) +{ + self->obj->Stop(); + Py_RETURN_NONE; +} + +static PyObject* +PySfSound_GetStatus(PySfSound *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetStatus()); +} + +static PyObject* +PySfSound_SetPosition(PySfSound *self, PyObject *args) +{ + float X, Y, Z; + if (! PyArg_ParseTuple(args, "fff", &X, &Y, &Z)) + return NULL; + self->obj->SetPosition(X, Y, Z); + Py_RETURN_NONE; +} + +static PyObject * +PySfSound_GetBuffer(PySfSound *self) +{ + PySfSoundBuffer *Buffer; + + Buffer = GetNewPySfSoundBuffer(); + Buffer->obj = new sf::SoundBuffer(*(self->obj->GetBuffer())); + + return (PyObject *)Buffer; +} + +static PyObject* +PySfSound_SetPlayingOffset(PySfSound *self, PyObject *args) +{ + self->obj->SetPlayingOffset(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyMethodDef PySfSound_methods[] = { + {"SetPlayingOffset", (PyCFunction)PySfSound_SetPlayingOffset, METH_O, "SetPlayingOffset(TimeOffset)\nSet the current playing position of the sound.\n TimeOffset : New playing position, expressed in seconds"}, + {"SetLoop", (PyCFunction)PySfSound_SetLoop, METH_O, "SetLoop(Loop)\nSet the Sound loop state.\n Loop : True to play in loop, false to play once"}, + {"SetBuffer", (PyCFunction)PySfSound_SetBuffer, METH_O, "SetBuffer(Buffer)\nSet the source buffer.\n Buffer : New sound buffer to bind to the sound "}, + {"SetPitch", (PyCFunction)PySfSound_SetPitch, METH_O, "SetPitch(Pitch)\nSet the sound pitch. The default pitch is 1.\n Pitch : New pitch"}, + {"SetMinDistance", (PyCFunction)PySfSound_SetMinDistance, METH_O, "SetMinDistance(MinDistance)\nSet the minimum distance - closer than this distance, the listener will hear the sound at its maximum volume. The default minimum distance is 1.0.\n MinDistance : New minimum distance for the sound"}, + {"SetAttenuation", (PyCFunction)PySfSound_SetAttenuation, METH_O, "SetAttenuation(Attenuation)\nSet the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener. The default attenuation factor 1.0.\n Attenuation : New attenuation factor for the sound"}, + {"SetVolume", (PyCFunction)PySfSound_SetVolume, METH_O, "SetVolume(Volume)\nSet the sound volume.\n Volume : Volume (in range [0, 100])"}, + {"SetPosition", (PyCFunction)PySfSound_SetPosition, METH_VARARGS, "SetPosition(X, Y, Z)\nSet the sound position in the world.\n X,Y,Z : Position of the sound in the world"}, + {"GetLoop", (PyCFunction)PySfSound_GetLoop, METH_NOARGS, "GetLoop()\nTell whether or not the Sound is looping."}, + {"GetBuffer", (PyCFunction)PySfSound_GetBuffer, METH_NOARGS, "GetBuffer()\nGet the source buffer. Returns a new sf.SoundBuffer object."}, + {"GetPitch", (PyCFunction)PySfSound_GetPitch, METH_NOARGS, "GetPitch()\nGet the sound pitch."}, + {"GetMinDistance", (PyCFunction)PySfSound_GetMinDistance, METH_NOARGS, "GetMinDistance()\nGet the minimum distance."}, + {"GetAttenuation", (PyCFunction)PySfSound_GetAttenuation, METH_NOARGS, "GetAttenuation()\nGet the attenuation factor."}, + {"GetVolume", (PyCFunction)PySfSound_GetVolume, METH_NOARGS, "GetVolume()\nGet the sound volume."}, + {"GetPosition", (PyCFunction)PySfSound_GetPosition, METH_NOARGS, "GetPosition()\nGet the sound position in the world. Returns a tuple."}, + {"Play", (PyCFunction)PySfSound_Play, METH_NOARGS, "Play()\nPlay the sound."}, + {"Pause", (PyCFunction)PySfSound_Pause, METH_NOARGS, "Pause()\nPause the sound."}, + {"Stop", (PyCFunction)PySfSound_Stop, METH_NOARGS, "Stop()\nStop the sound."}, + {"GetStatus", (PyCFunction)PySfSound_GetStatus, METH_NOARGS, "GetStatus()\nGet the status of the sound (stopped, paused, playing)."}, + {"GetPlayingOffset", (PyCFunction)PySfSound_GetPlayingOffset, METH_NOARGS, "GetPlayingOffset()\nGet the current playing position of the sound."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfSoundType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Sound", /*tp_name*/ + sizeof(PySfSound), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfSound_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Sound defines the properties of a sound such as position, volume, pitch, etc.\n\ +Default constructor : Sound()\n\ +Construct the sound from its parameters : Sound(Buffer, Loop = False, Pitch = 1., Volume = 100., X = 0., Y = 0., Z = 0.);\n\ + Buffer : Sound buffer to play (None by default)\n\ + Loop : Loop flag (False by default)\n\ + Pitch : Value of the pitch (1. by default)\n\ + Volume : Volume (100. by default)\n\ + X : X position (0. by default)\n\ + Y : Y position (0. by default)\n\ + Z : Z position (0. by default)\n\ +Copy constructor : Sound(Copy) where Copy is a sf.Sound instance.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfSound_methods, /* tp_methods */ + PySfSound_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfSound_init, /* tp_init */ + 0, /* tp_alloc */ + PySfSound_new, /* tp_new */ +}; + +static int +PySfSound_init(PySfSound *self, PyObject *args, PyObject *kwds) +{ +// Sound(const SoundBuffer& Buffer, bool Loop = false, float Pitch = 1.f, float Volume = 100.f, float X = 0.f, float Y = 0.f, float Z = 0.f); + + const char *kwlist[] = {"Buffer", "Loop", "Pitch", "Volume", "X", "Y", "Z", NULL}; + PySfSoundBuffer *Buffer=NULL; + bool Loop=false; + PyObject *LoopObj=Py_False; + float Pitch=1.f, Volume=100.f, X=0.f, Y=0.f, Z=0.f; + + if (PyTuple_Size(args) == 1) + { + PySfSound *Copy; + if (PyArg_ParseTuple(args, "O!", &PySfSoundType, &Copy)) + { + self->obj = new sf::Sound(*(Copy->obj)); + return 0; + } + else + PyErr_Clear(); + } + if (PyTuple_Size(args) > 0) + { + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "O!|Offfff", (char **)kwlist, &PySfSoundBufferType, &Buffer, &LoopObj, &Pitch, &Volume, &X, &Y, &Z)) + return -1; + + if (PyObject_IsTrue(LoopObj)) + Loop = true; + + self->obj = new sf::Sound(*(Buffer->obj), Loop, Pitch, Volume, sf::Vector3f(X, Y, Z)); + } + else + self->obj = new sf::Sound(); + + return 0; +} + +void +PySfSound_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Sound::Stopped); + PyDict_SetItemString(PySfSoundType.tp_dict, "Stopped", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Sound::Paused); + PyDict_SetItemString(PySfSoundType.tp_dict, "Paused", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Sound::Playing); + PyDict_SetItemString(PySfSoundType.tp_dict, "Playing", obj); + Py_DECREF(obj); +} + diff --git a/python/src/Sound.hpp b/python/src/Sound.hpp new file mode 100644 index 00000000..d0c38230 --- /dev/null +++ b/python/src/Sound.hpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSOUND_HPP +#define __PYSOUND_HPP + +#include +#include + +#include +#include + +typedef struct { + PyObject_HEAD + sf::Sound *obj; +} PySfSound; + +void +PySfSound_InitConst(); + +#endif diff --git a/python/src/SoundBuffer.cpp b/python/src/SoundBuffer.cpp new file mode 100644 index 00000000..cf651bde --- /dev/null +++ b/python/src/SoundBuffer.cpp @@ -0,0 +1,218 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "SoundBuffer.hpp" + + +static PyMemberDef PySfSoundBuffer_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfSoundBuffer_dealloc(PySfSoundBuffer *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfSoundBuffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfSoundBuffer *self; + + self = (PySfSoundBuffer *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfSoundBuffer_init(PySfSoundBuffer *self, PyObject *args, PyObject *kwds); + +static PyObject* +PySfSoundBuffer_LoadFromFile(PySfSoundBuffer *self, PyObject *args) +{ + char *path = PyString_AsString(args); + if (self->obj->LoadFromFile(path)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfSoundBuffer_LoadFromMemory(PySfSoundBuffer* self, PyObject *args) +{ + unsigned int SizeInBytes; + char *Data; + + if (! PyArg_ParseTuple(args, "s#", &Data, &SizeInBytes)) + return NULL; + + if (self->obj->LoadFromMemory(Data, (std::size_t) SizeInBytes)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +PySfSoundBuffer_LoadFromSamples(PySfSoundBuffer* self, PyObject *args) +{ + unsigned int SizeInBytes, ChannelsCount, SampleRate; + char *Data; + + if (! PyArg_ParseTuple(args, "s#II", &Data, &SizeInBytes, &ChannelsCount, &SampleRate)) + return NULL; + + if (self->obj->LoadFromSamples((const sf::Int16*)Data, (std::size_t) SizeInBytes/2, ChannelsCount, SampleRate)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfSoundBuffer_GetSamples(PySfSoundBuffer *self) +{ + return PyString_FromStringAndSize((const char *)(self->obj->GetSamples()), self->obj->GetSamplesCount()*2); +} + +static PyObject* +PySfSoundBuffer_SaveToFile(PySfSoundBuffer *self, PyObject *args) +{ + char *path = PyString_AsString(args); + if (self->obj->SaveToFile(path)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfSoundBuffer_GetDuration(PySfSoundBuffer *self) +{ + return PyFloat_FromDouble((double)(self->obj->GetDuration())); +} + +static PyObject* +PySfSoundBuffer_GetChannelsCount(PySfSoundBuffer *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetChannelsCount()); +} + +static PyObject* +PySfSoundBuffer_GetSampleRate(PySfSoundBuffer *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetSampleRate()); +} + +static PyObject* +PySfSoundBuffer_GetSamplesCount(PySfSoundBuffer *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetSamplesCount()); +} + + +static PyMethodDef PySfSoundBuffer_methods[] = { + {"LoadFromFile", (PyCFunction)PySfSoundBuffer_LoadFromFile, METH_O, "LoadFromFile(FileName)\nLoad the sound buffer from a file. Returns True if loading has been successful.\n Filename : Path of the sound file to load"}, + {"SaveToFile", (PyCFunction)PySfSoundBuffer_SaveToFile, METH_O, "SaveToFile(Filename)\nSave the sound buffer to a file. Returns True if saving has been successful.\n Filename : Path of the sound file to write"}, + {"LoadFromMemory", (PyCFunction)PySfSoundBuffer_LoadFromMemory, METH_O, "LoadFromMemory(Data)\nLoad the sound buffer from a string in memory.\n Data : string representing the file data in memory "}, + {"LoadFromSamples", (PyCFunction)PySfSoundBuffer_LoadFromSamples, METH_VARARGS, "LoadFromSamples(Samples, ChannelsCount, SampleRate)\nLoad the sound buffer from an array of samples - assumed format for samples is 16 bits signed integer.\n\ + Samples : Pointer to the samples in memory\n\ + ChannelsCount : Number of channels (1 = mono, 2 = stereo, ...)\n\ + SampleRate : Frequency (number of samples to play per second)"}, + {"GetDuration", (PyCFunction)PySfSoundBuffer_GetDuration, METH_NOARGS, "GetDuration()\nGet the sound duration."}, + {"GetChannelsCount", (PyCFunction)PySfSoundBuffer_GetChannelsCount, METH_NOARGS, "GetChannelsCount()\nReturn the number of channels (1 = mono, 2 = stereo)."}, + {"GetSampleRate", (PyCFunction)PySfSoundBuffer_GetSampleRate, METH_NOARGS, "GetSampleRate()\nGet the sound frequency (sample rate)."}, + {"GetSamplesCount", (PyCFunction)PySfSoundBuffer_GetSamplesCount, METH_NOARGS, "GetSamplesCount()\nReturn the samples count."}, + {"GetSamples", (PyCFunction)PySfSoundBuffer_GetSamples, METH_NOARGS, "GetSamples()\nReturn the sound samples as a string."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfSoundBufferType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "SoundBuffer", /*tp_name*/ + sizeof(PySfSoundBuffer), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfSoundBuffer_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.SoundBuffer is the low-level for loading and manipulating sound buffers.\n\ +Default constructor : SoundBuffer()\n\ +Copy constructor : SoundBuffer(Copy) where Copy is a sf.SoundBuffer instance.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfSoundBuffer_methods, /* tp_methods */ + PySfSoundBuffer_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfSoundBuffer_init, /* tp_init */ + 0, /* tp_alloc */ + PySfSoundBuffer_new, /* tp_new */ +}; + +static int +PySfSoundBuffer_init(PySfSoundBuffer *self, PyObject *args, PyObject *kwds) +{ + if (PyTuple_Size(args) == 1) + { + PySfSoundBuffer *Copy; + if (PyArg_ParseTuple(args, "O!", &PySfSoundBufferType, &Copy)) + self->obj = new sf::SoundBuffer(*(Copy->obj)); + else + return -1; + } + else + self->obj = new sf::SoundBuffer(); + return 0; +} + +PySfSoundBuffer * +GetNewPySfSoundBuffer() +{ + return PyObject_New(PySfSoundBuffer, &PySfSoundBufferType); +} + diff --git a/python/src/SoundBuffer.hpp b/python/src/SoundBuffer.hpp new file mode 100644 index 00000000..2420bf90 --- /dev/null +++ b/python/src/SoundBuffer.hpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSOUNDBUFFER_HPP +#define __PYSOUNDBUFFER_HPP + +#include +#include + +#include +#include + +typedef struct { + PyObject_HEAD + sf::SoundBuffer *obj; +} PySfSoundBuffer; + +PySfSoundBuffer * +GetNewPySfSoundBuffer(); + +#endif diff --git a/python/src/SoundBufferRecorder.cpp b/python/src/SoundBufferRecorder.cpp new file mode 100644 index 00000000..37d87e8d --- /dev/null +++ b/python/src/SoundBufferRecorder.cpp @@ -0,0 +1,121 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "SoundBufferRecorder.hpp" + +#include "SoundBuffer.hpp" + +extern PyTypeObject PySfSoundRecorderType; + +static PyMemberDef PySfSoundBufferRecorder_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfSoundBufferRecorder_dealloc(PySfSoundBufferRecorder *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfSoundBufferRecorder_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfSoundBufferRecorder *self; + + self = (PySfSoundBufferRecorder *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfSoundBufferRecorder_init(PySfSoundBufferRecorder *self, PyObject *args) +{ + self->obj = new sf::SoundBufferRecorder(); + return 0; +} + +static PyObject * +PySfSoundBufferRecorder_GetBuffer(PySfSoundBufferRecorder* self) +{ + PySfSoundBuffer *SoundBuffer = GetNewPySfSoundBuffer(); + SoundBuffer->obj = new sf::SoundBuffer( self->obj->GetBuffer() ); + return (PyObject *)SoundBuffer; +} + + +static PyMethodDef PySfSoundBufferRecorder_methods[] = { + {"GetBuffer", (PyCFunction)PySfSoundBufferRecorder_GetBuffer, METH_NOARGS, "GetBuffer()\nGet the sound buffer containing the captured audio data. Returns a SoundBuffer object. Returns a sf.SoundBuffer instance."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfSoundBufferRecorderType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "SoundBufferRecorder", /*tp_name*/ + sizeof(PySfSoundBufferRecorder), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfSoundBufferRecorder_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Specialized SoundRecorder which saves the captured audio data into a sound buffer.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfSoundBufferRecorder_methods, /* tp_methods */ + PySfSoundBufferRecorder_members, /* tp_members */ + 0, /* tp_getset */ + &PySfSoundRecorderType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfSoundBufferRecorder_init, /* tp_init */ + 0, /* tp_alloc */ + PySfSoundBufferRecorder_new, /* tp_new */ +}; + + diff --git a/python/src/SoundBufferRecorder.hpp b/python/src/SoundBufferRecorder.hpp new file mode 100644 index 00000000..96624329 --- /dev/null +++ b/python/src/SoundBufferRecorder.hpp @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSOUNDBUFFERRECORDER_HPP +#define __PYSOUNDBUFFERRECORDER_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + +typedef struct { + PyObject_HEAD + sf::SoundBufferRecorder *obj; +} PySfSoundBufferRecorder; + +#endif diff --git a/python/src/SoundRecorder.cpp b/python/src/SoundRecorder.cpp new file mode 100644 index 00000000..887c0272 --- /dev/null +++ b/python/src/SoundRecorder.cpp @@ -0,0 +1,174 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "SoundRecorder.hpp" + + + +static PyMemberDef PySfSoundRecorder_members[] = { + {NULL} /* Sentinel */ +}; + + +bool CustomSoundRecorder::OnStart() +{ + if (PyObject_HasAttrString(SoundRecorder, "OnStart")) + if (PyObject_IsTrue(PyObject_CallFunction(PyObject_GetAttrString(SoundRecorder, "OnStart"), NULL))) + return true; + return false; +} + +bool CustomSoundRecorder::OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount) +{ + if (PyObject_HasAttrString(SoundRecorder, "OnGetData")) + { + if (PyObject_IsTrue(PyObject_CallFunction(PyObject_GetAttrString(SoundRecorder, "OnGetData"), (char *)"#s", (char *)Samples, SamplesCount*2))) + { + return true; + } + } + return false; +} + +void CustomSoundRecorder::OnStop() +{ + if (PyObject_HasAttrString(SoundRecorder, "OnStop")) + PyObject_CallFunction(PyObject_GetAttrString(SoundRecorder, "OnStop"), NULL); +} + +static void +PySfSoundRecorder_dealloc(PySfSoundRecorder* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfSoundRecorder_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfSoundRecorder *self; + + self = (PySfSoundRecorder *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + +static int +PySfSoundRecorder_init(PySfSoundRecorder *self, PyObject *args) +{ + self->obj = new CustomSoundRecorder(); + self->obj->SoundRecorder = (PyObject *)self; + return 0; +} + + +static PyObject * +PySfSoundRecorder_Start(PySfSoundRecorder* self, PyObject *args) +{ + self->obj->Start( PyInt_AsLong(args) ); + Py_RETURN_NONE; +} + +static PyObject * +PySfSoundRecorder_Stop(PySfSoundRecorder* self) +{ + self->obj->Stop(); + Py_RETURN_NONE; +} + +static PyObject * +PySfSoundRecorder_GetSampleRate(PySfSoundRecorder* self) +{ + return PyInt_FromLong(self->obj->GetSampleRate()); +} + +static PyObject * +PySfSoundRecorder_CanCapture(PySfSoundRecorder* self) +{ + if (sf::SoundRecorder::CanCapture()) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + + + +static PyMethodDef PySfSoundRecorder_methods[] = { + {"Start", (PyCFunction)PySfSoundRecorder_Start, METH_O, "Start(SampleRate=44100)\nStart the capture. Warning : only one capture can happen at the same time.\n SampleRate : Sound frequency (the more samples, the higher the quality) (44100 by default = CD quality)."}, + {"Stop", (PyCFunction)PySfSoundRecorder_Stop, METH_NOARGS, "Stop()\nStop the capture."}, + {"GetSampleRate", (PyCFunction)PySfSoundRecorder_GetSampleRate, METH_NOARGS, "GetSampleRate()\nGet the sample rate. Returns the frequency, in samples per second."}, + {"CanCapture", (PyCFunction)PySfSoundRecorder_CanCapture, METH_STATIC | METH_NOARGS, "CanCapture()\nTell if the system supports sound capture. If not, this class won't be usable. Returns True if audio capture is supported."}, + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfSoundRecorderType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "SoundRecorder", /*tp_name*/ + sizeof(PySfSoundRecorder), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfSoundRecorder_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "SoundRecorder is an interface for capturing sound data, it is meant to be used as a base class.\n\ +Construct the sound recorder with a callback function for processing captured samples : SoundRecorder(Callback, UserData)\n\ + Callback : Callback function for processing captured samples. This function must take two parameters: the first one is a string containing captured samples, the second one is UserData.\n\ + UserData : Data to pass to the callback function (None by default).", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfSoundRecorder_methods, /* tp_methods */ + PySfSoundRecorder_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfSoundRecorder_init, /* tp_init */ + 0, /* tp_alloc */ + PySfSoundRecorder_new, /* tp_new */ +}; + diff --git a/python/src/SoundRecorder.hpp b/python/src/SoundRecorder.hpp new file mode 100644 index 00000000..356262d2 --- /dev/null +++ b/python/src/SoundRecorder.hpp @@ -0,0 +1,50 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSOUNDRECORDER_HPP +#define __PYSOUNDRECORDER_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + +class CustomSoundRecorder : public sf::SoundRecorder +{ +public : + PyObject *SoundRecorder; + virtual bool OnStart(); + virtual bool OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount); + virtual void OnStop(); +}; + +typedef struct { + PyObject_HEAD + CustomSoundRecorder *obj; +} PySfSoundRecorder; + +#endif diff --git a/python/src/SoundStream.cpp b/python/src/SoundStream.cpp new file mode 100644 index 00000000..112fea03 --- /dev/null +++ b/python/src/SoundStream.cpp @@ -0,0 +1,320 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "SoundStream.hpp" + + +bool CustomSoundStream::OnStart() +{ + if (PyObject_HasAttrString(SoundStream, "OnStart")) + if (PyObject_IsTrue(PyObject_CallFunction(PyObject_GetAttrString(SoundStream, "OnStart"), NULL))) + return true; + return false; +} + +bool CustomSoundStream::OnGetData(Chunk& Data) +{ + if (PyObject_HasAttrString(SoundStream, "OnGetData")) + { + PyObject *PyData=NULL; + if ((PyData = PyObject_CallFunction(PyObject_GetAttrString(SoundStream, "OnGetData"), NULL))) + { + if (PyArg_Parse(PyData, "s#", &(Data.Samples), &(Data.NbSamples))) + { + Data.NbSamples /= 2; + if (Data.NbSamples > 0) + return true; + } + } + } + return false; +} + +void CustomSoundStream::Init(unsigned int ChannelsCount, unsigned int SampleRate) +{ + Initialize(ChannelsCount, SampleRate); +} + + +static PyMemberDef PySfSoundStream_members[] = { + {NULL} /* Sentinel */ +}; + + +static int +PySfSoundStream_init(PySfSoundStream *self, PyObject *args, PyObject *kwds) +{ + self->obj = new CustomSoundStream(); + self->obj->SoundStream = (PyObject *)self; + return 0; +} + +static void +PySfSoundStream_dealloc(PySfSoundStream *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfSoundStream_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfSoundStream *self; + self = (PySfSoundStream *)type->tp_alloc(type, 0); + return (PyObject *)self; +} + +static PyObject * +PySfSoundStream_Initialize(PySfSoundStream *self, PyObject *args) +{ + unsigned int ChannelsCount, SampleRate; + if (!PyArg_ParseTuple(args, "II", &ChannelsCount, &SampleRate)) + return NULL; + self->obj->Init(ChannelsCount, SampleRate); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_Play(PySfSoundStream *self) +{ + self->obj->Play(); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_Stop(PySfSoundStream *self) +{ + self->obj->Stop(); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_GetChannelsCount(PySfSoundStream *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetChannelsCount()); +} + +static PyObject* +PySfSoundStream_GetSampleRate(PySfSoundStream *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetSampleRate()); +} + +static PyObject* +PySfSoundStream_SetPitch(PySfSoundStream *self, PyObject *args) +{ + self->obj->SetPitch(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_SetMinDistance(PySfSoundStream *self, PyObject *args) +{ + self->obj->SetMinDistance(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_SetAttenuation(PySfSoundStream *self, PyObject *args) +{ + self->obj->SetAttenuation(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_SetVolume(PySfSoundStream *self, PyObject *args) +{ + self->obj->SetVolume(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_GetPitch(PySfSoundStream *self) +{ + return PyFloat_FromDouble(self->obj->GetPitch()); +} + +static PyObject* +PySfSoundStream_GetMinDistance(PySfSoundStream *self) +{ + return PyFloat_FromDouble(self->obj->GetMinDistance()); +} + +static PyObject* +PySfSoundStream_GetAttenuation(PySfSoundStream *self) +{ + return PyFloat_FromDouble(self->obj->GetAttenuation()); +} + +static PyObject* +PySfSoundStream_GetVolume(PySfSoundStream *self) +{ + return PyFloat_FromDouble(self->obj->GetVolume()); +} + +static PyObject* +PySfSoundStream_GetPosition(PySfSoundStream *self) +{ + sf::Vector3f Vect = self->obj->GetPosition(); + return Py_BuildValue("fff", Vect.x, Vect.y, Vect.z); +} + +static PyObject* +PySfSoundStream_Pause(PySfSoundStream *self) +{ + self->obj->Pause(); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_SetPosition(PySfSoundStream *self, PyObject *args) +{ + float X, Y, Z; + if (! PyArg_ParseTuple(args, "fff", &X, &Y, &Z)) + return NULL; + self->obj->SetPosition(X, Y, Z); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_GetStatus(PySfSoundStream *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetStatus()); +} + +static PyObject* +PySfSoundStream_SetLoop(PySfSoundStream *self, PyObject *args) +{ + if (PyObject_IsTrue(args)) + self->obj->SetLoop(true); + else + self->obj->SetLoop(false); + Py_RETURN_NONE; +} + +static PyObject* +PySfSoundStream_GetLoop(PySfSoundStream *self) +{ + if (self->obj->GetLoop()) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject* +PySfSoundStream_GetPlayingOffset(PySfSoundStream *self) +{ + return PyFloat_FromDouble(self->obj->GetPlayingOffset()); +} + +static PyMethodDef PySfSoundStream_methods[] = { + {"Initialize", (PyCFunction)PySfSoundStream_Initialize, METH_VARARGS, "Initialize(ChannelsCount, SampleRate)\n\ +Set the audio stream parameters, you must call it before Play()\n\ + ChannelsCount : Number of channels\n\ + SampleRate : Sample rate."}, + {"Play", (PyCFunction)PySfSoundStream_Play, METH_NOARGS, "Play()\nPlay the sound."}, + {"Stop", (PyCFunction)PySfSoundStream_Stop, METH_NOARGS, "Stop()\nStop the sound."}, + {"GetChannelsCount", (PyCFunction)PySfSoundStream_GetChannelsCount, METH_NOARGS, "GetChannelsCount()\nReturn the number of channels (1 = mono, 2 = stereo)."}, + {"GetSampleRate", (PyCFunction)PySfSoundStream_GetSampleRate, METH_NOARGS, "GetSampleRate()\nGet the sound frequency (sample rate)."}, + {"GetStatus", (PyCFunction)PySfSoundStream_GetStatus, METH_NOARGS, "GetStatus()\nGet the status of the sound (stopped, paused, playing)."}, + {"SetLoop", (PyCFunction)PySfSoundStream_SetLoop, METH_O, "SetLoop(Loop)\nSet the music loop state. This parameter is disabled by default\n Loop : True to play in loop, false to play once "}, + {"GetLoop", (PyCFunction)PySfSoundStream_GetLoop, METH_NOARGS, "GetLoop()\nTell whether or not the music is looping."}, + {"GetPlayingOffset", (PyCFunction)PySfSoundStream_GetPlayingOffset, METH_NOARGS, "GetPlayingOffset()\nGet the current playing position of the stream."}, +/* The following methods should be inherited from sf.Sound */ + {"SetPitch", (PyCFunction)PySfSoundStream_SetPitch, METH_O, "SetPitch(Pitch)\nSet the sound pitch. The default pitch is 1.\n Pitch : New pitch"}, + {"SetMinDistance", (PyCFunction)PySfSoundStream_SetMinDistance, METH_O, "SetMinDistance(MinDistance)\nSet the minimum distance - closer than this distance, the listener will hear the sound at its maximum volume. The default minimum distance is 1.0.\n MinDistance : New minimum distance for the sound"}, + {"SetAttenuation", (PyCFunction)PySfSoundStream_SetAttenuation, METH_O, "SetAttenuation(Attenuation)\nSet the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener. The default attenuation factor 1.0.\n Attenuation : New attenuation factor for the sound"}, + {"SetVolume", (PyCFunction)PySfSoundStream_SetVolume, METH_O, "SetVolume(Volume)\nSet the sound volume.\n Volume : Volume (in range [0, 100])"}, + {"SetPosition", (PyCFunction)PySfSoundStream_SetPosition, METH_VARARGS, "SetPosition(X, Y, Z)\nSet the sound position in the world.\n X,Y,Z : Position of the sound in the world"}, + {"GetPitch", (PyCFunction)PySfSoundStream_GetPitch, METH_NOARGS, "GetPitch()\nGet the sound pitch."}, + {"GetMinDistance", (PyCFunction)PySfSoundStream_GetMinDistance, METH_NOARGS, "GetMinDistance()\nGet the minimum distance."}, + {"GetAttenuation", (PyCFunction)PySfSoundStream_GetAttenuation, METH_NOARGS, "GetAttenuation()\nGet the attenuation factor."}, + {"GetVolume", (PyCFunction)PySfSoundStream_GetVolume, METH_NOARGS, "GetVolume()\nGet the sound volume."}, + {"GetPosition", (PyCFunction)PySfSoundStream_GetPosition, METH_NOARGS, "GetPosition()\nGet the sound position in the world. Returns a tuple."}, + {"Pause", (PyCFunction)PySfSoundStream_Pause, METH_NOARGS, "Pause()\nPause the sound."}, + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfSoundStreamType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "SoundStream", /*tp_name*/ + sizeof(PySfSoundStream), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfSoundStream_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "SoundStream is a streamed sound, ie samples are acquired\ +while the sound is playing. Use it for big sounds that would\ +require hundreds of MB in memory (see Music),\ +or for streaming sound from the network", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfSoundStream_methods, /* tp_methods */ + PySfSoundStream_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfSoundStream_init, /* tp_init */ + 0, /* tp_alloc */ + PySfSoundStream_new, /* tp_new */ +}; + + +void +PySfSoundStream_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::SoundStream::Stopped); + PyDict_SetItemString(PySfSoundStreamType.tp_dict, "Stopped", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::SoundStream::Paused); + PyDict_SetItemString(PySfSoundStreamType.tp_dict, "Paused", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::SoundStream::Playing); + PyDict_SetItemString(PySfSoundStreamType.tp_dict, "Playing", obj); + Py_DECREF(obj); +} + diff --git a/python/src/SoundStream.hpp b/python/src/SoundStream.hpp new file mode 100644 index 00000000..72ddd355 --- /dev/null +++ b/python/src/SoundStream.hpp @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSOUNDSTREAM_HPP +#define __PYSOUNDSTREAM_HPP + +#include +#include + +#include +#include + +class CustomSoundStream : public sf::SoundStream +{ +public : + PyObject *SoundStream; + virtual bool OnStart(); + virtual bool OnGetData(Chunk& Data); + void Init(unsigned int ChannelsCount, unsigned int SampleRate); +}; + + +typedef struct { + PyObject_HEAD + CustomSoundStream *obj; +} PySfSoundStream; + +void +PySfSoundStream_InitConst(); + +#endif + diff --git a/python/src/Sprite.cpp b/python/src/Sprite.cpp new file mode 100644 index 00000000..c783ccdd --- /dev/null +++ b/python/src/Sprite.cpp @@ -0,0 +1,255 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Sprite.hpp" + + +extern PyTypeObject PySfColorType; +extern PyTypeObject PySfImageType; +extern PyTypeObject PySfIntRectType; +extern PyTypeObject PySfDrawableType; + +static PyMemberDef PySfSprite_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfSprite_dealloc(PySfSprite *self) +{ + if (self->Image != NULL) + Py_DECREF(self->Image); + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfSprite_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfSprite *self; + + self = (PySfSprite *)type->tp_alloc(type, 0); + + if (self != NULL) + { + self->Image = NULL; + } + + return (PyObject *)self; +} + + +static int +PySfSprite_init(PySfSprite *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Image", "X", "Y", "ScaleX", "ScaleY", "Rotation", "Color", NULL}; + float X=0, Y=0, ScaleX=1, ScaleY=1, Rotation=0; + PySfImage *Image=NULL; + PySfColor *Color=NULL; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "O!|fffffO!", (char **)kwlist, &PySfImageType, &Image, &X, &Y, &ScaleX, &ScaleY, &Rotation, &PySfColorType, &Color)) + return -1; + + Py_INCREF(Image); + self->Image = Image; + if (Color != NULL) + self->obj = new sf::Sprite(*(Image->obj), sf::Vector2f(X, Y), sf::Vector2f(ScaleX, ScaleY), Rotation, *(Color->obj)); + else + self->obj = new sf::Sprite(*(Image->obj), sf::Vector2f(X, Y), sf::Vector2f(ScaleX, ScaleY), Rotation); + + + return 0; +} + + + +static PyObject * +PySfSprite_SetImage(PySfSprite* self, PyObject *args) +{ + PySfImage *Image = (PySfImage *)args; + if (! PyObject_TypeCheck(Image, &PySfImageType)) + { + PyErr_SetString(PyExc_TypeError, "Argument is not a sfImage"); + return NULL; + } + Py_DECREF(self->Image); + Py_INCREF(Image); + self->Image = Image; + self->obj->SetImage(*(Image->obj)); + Py_RETURN_NONE; +} + +static PyObject * +PySfSprite_GetImage(PySfSprite* self) +{ + Py_INCREF(self->Image); + return (PyObject *)(self->Image); +} + +static PyObject * +PySfSprite_GetPixel(PySfSprite* self, PyObject *args) +{ + PySfColor *Color; + unsigned int x=0, y=0; + + + if (! PyArg_ParseTuple(args, "II", &x, &y)) + return NULL; + + Color = GetNewPySfColor(); + Color->obj = new sf::Color(self->obj->GetPixel(x, y)); + Color->r = Color->obj->r; + Color->g = Color->obj->g; + Color->b = Color->obj->b; + Color->a = Color->obj->a; + + return (PyObject *)Color; +} + +static PyObject * +PySfSprite_Resize(PySfSprite* self, PyObject *args) +{ + float W=0, H=0; + + if (! PyArg_ParseTuple(args, "ff", &W, &H)) + return NULL; + + self->obj->Resize(W,H); + Py_RETURN_NONE; +} + +static PyObject * +PySfSprite_GetSubRect(PySfSprite* self) +{ + PySfIntRect *Rect; + + Rect = GetNewPySfIntRect(); + Rect->obj = new sf::IntRect(self->obj->GetSubRect()); + Rect->Left = Rect->obj->Left; + Rect->Top = Rect->obj->Top; + Rect->Right = Rect->obj->Right; + Rect->Bottom = Rect->obj->Bottom; + + return (PyObject *)Rect; +} + +static PyObject * +PySfSprite_SetSubRect(PySfSprite* self, PyObject *args) +{ + PySfIntRect *Rect = (PySfIntRect *)args; + if (! PyObject_TypeCheck(Rect, &PySfIntRectType)) + { + PyErr_SetString(PyExc_TypeError, "Argument is not a sf.IntRect instance"); + return NULL; + } + self->obj->SetSubRect(*(Rect->obj)); + Py_RETURN_NONE; +} + +static PyObject * +PySfSprite_FlipX(PySfSprite* self, PyObject *args) +{ + bool Flip = false; + if (PyObject_IsTrue(args)) + Flip = true; + self->obj->FlipX(Flip); + Py_RETURN_NONE; +} + +static PyObject * +PySfSprite_FlipY(PySfSprite* self, PyObject *args) +{ + bool Flip = false; + if (PyObject_IsTrue(args)) + Flip = true; + self->obj->FlipY(Flip); + Py_RETURN_NONE; +} + +static PyObject * +PySfSprite_GetSize(PySfSprite* self) +{ + sf::Vector2f Vect = self->obj->GetSize(); + return Py_BuildValue("ff", Vect.x, Vect.y); +} + +static PyMethodDef PySfSprite_methods[] = { + {"SetImage", (PyCFunction)PySfSprite_SetImage, METH_O, "SetImage(Image)\nChange the image of the sprite.\n Image : new image (sf.Image instance)"}, + {"GetImage", (PyCFunction)PySfSprite_GetImage, METH_NOARGS, "GetImage()\nGet the source image of the sprite."}, + {"GetSize", (PyCFunction)PySfSprite_GetSize, METH_NOARGS, "GetSize()\nGet the sprite's size."}, + {"GetPixel", (PyCFunction)PySfSprite_GetPixel, METH_VARARGS, "GetPixel()\nGet the color of a given pixel in the sprite."}, + {"Resize", (PyCFunction)PySfSprite_Resize, METH_VARARGS, "Resize(Width, Height)\nResize the sprite (by changing its scale factors). The default size is defined by the subrect.\n\ + Width : New width (must be strictly positive)\n\ + Height : New height (must be strictly positive)"}, + {"GetSubRect", (PyCFunction)PySfSprite_GetSubRect, METH_NOARGS, "GetSubRect()\nGet the sub-rectangle of the sprite inside the source image."}, + {"SetSubRect", (PyCFunction)PySfSprite_SetSubRect, METH_O, "SetSubRect(SubRect)\nSet the sub-rectangle of the sprite inside the source image. By default, the subrect covers the entire source image.\n SubRect : New sub-rectangle"}, + {"FlipX", (PyCFunction)PySfSprite_FlipX, METH_O, "FlipX(Flipped)\nFlip the sprite horizontally.\n Flipped : True to flip the sprite"}, + {"FlipY", (PyCFunction)PySfSprite_FlipY, METH_O, "FlipY(Flipped)\nFlip the sprite vertically.\n Flipped : True to flip the sprite"}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfSpriteType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Sprite", /*tp_name*/ + sizeof(PySfSprite), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfSprite_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sfSprite defines a sprite : texture, transformations, color, and draw on screen", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfSprite_methods, /* tp_methods */ + PySfSprite_members, /* tp_members */ + 0, /* tp_getset */ + &PySfDrawableType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfSprite_init, /* tp_init */ + 0, /* tp_alloc */ + PySfSprite_new, /* tp_new */ +}; + + diff --git a/python/src/Sprite.hpp b/python/src/Sprite.hpp new file mode 100644 index 00000000..97cd58b2 --- /dev/null +++ b/python/src/Sprite.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSPRITE_HPP +#define __PYSPRITE_HPP + +#include +#include +#include + +#include +#include + +#include "Drawable.hpp" +#include "Image.hpp" +#include "Rect.hpp" + +typedef struct { + PyObject_HEAD + sf::Sprite *obj; + PySfImage *Image; +} PySfSprite; + +#endif diff --git a/python/src/String.cpp b/python/src/String.cpp new file mode 100644 index 00000000..8d2fa7f2 --- /dev/null +++ b/python/src/String.cpp @@ -0,0 +1,269 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "String.hpp" +#include "Font.hpp" +#include "Color.hpp" +#include "Rect.hpp" + + +extern PyTypeObject PySfColorType; +extern PyTypeObject PySfImageType; +extern PyTypeObject PySfDrawableType; +extern PyTypeObject PySfFontType; + +static PyMemberDef PySfString_members[] = { + {NULL} /* Sentinel */ +}; + + + +static void +PySfString_dealloc(PySfString *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfString_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfString *self; + + self = (PySfString *)type->tp_alloc(type, 0); + + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfString_init(PySfString *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Text", "Font", "Size", NULL}; + float Size = 30.f; + std::string Text = ""; + char *TextTmp = NULL; + unsigned int TextSize; + PySfFont *FontTmp = NULL; + sf::Font *Font; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "|s#O!f", (char **)kwlist, &TextTmp, &TextSize, &PySfFontType, &FontTmp, &Size)) + return -1; + + if (FontTmp) + Font = (FontTmp->obj); + else + Font = (sf::Font *)&(sf::Font::GetDefaultFont()); + + if (TextSize >= 2 && TextTmp) + if ((unsigned char)TextTmp[0] == 0xff && (unsigned char)TextTmp[1] == 0xfe) + { + self->obj = new sf::String(sf::Unicode::Text((const sf::Uint16 *)(TextTmp+2)), *Font, Size); + return 0; + } + + if (TextTmp != NULL) + self->obj = new sf::String(sf::Unicode::Text((const sf::Uint8 *)(TextTmp)), *Font, Size); + else + self->obj = new sf::String(); + return 0; +} + + + +static PyObject * +PySfString_SetText(PySfString* self, PyObject *args) +{ + char *TextTmp = NULL; + int Size; + if (!PyArg_Parse(args, "s#", &TextTmp, &Size)) + return NULL; + + if (Size >= 2) + { + if ((unsigned char)TextTmp[0] == 0xff && (unsigned char)TextTmp[1] == 0xfe) + { + self->obj->SetText(sf::Unicode::Text((const sf::Uint16 *)(TextTmp+2))); + Py_RETURN_NONE; + } + } + self->obj->SetText(sf::Unicode::Text((const sf::Uint8 *)(TextTmp))); + Py_RETURN_NONE; +} + +static PyObject * +PySfString_SetFont(PySfString* self, PyObject *args) +{ + PySfFont *Font = (PySfFont *)args; + if (!PyObject_TypeCheck(Font, &PySfFontType)) + PyErr_SetString(PyExc_ValueError, "Argument must be a sf.Font"); + self->obj->SetFont(*(Font->obj)); + Py_RETURN_NONE; +} + +static PyObject * +PySfString_SetSize(PySfString* self, PyObject *args) +{ + self->obj->SetSize(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfString_GetSize(PySfString* self) +{ + return PyFloat_FromDouble(self->obj->GetSize()); +} + +static PyObject * +PySfString_SetStyle(PySfString* self, PyObject *args) +{ + self->obj->SetStyle(PyLong_AsUnsignedLong(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfString_GetStyle(PySfString* self) +{ + return PyLong_FromUnsignedLong(self->obj->GetStyle()); +} + +static PyObject * +PySfString_GetText(PySfString* self) +{ + return PyString_FromString((std::string(self->obj->GetText())).c_str()); +} + +static PyObject * +PySfString_GetFont(PySfString* self) +{ + PySfFont *Font = GetNewPySfFont(); + Font->obj = new sf::Font(self->obj->GetFont()); + return (PyObject *)Font; +} + +static PyObject * +PySfString_GetRect(PySfString* self) +{ + PySfFloatRect *Rect; + + Rect = GetNewPySfFloatRect(); + Rect->obj = new sf::FloatRect (self->obj->GetRect()); + Rect->Left = Rect->obj->Left; + Rect->Top = Rect->obj->Top; + Rect->Right = Rect->obj->Right; + Rect->Bottom = Rect->obj->Bottom; + + return (PyObject *)Rect; +} + +static PyObject * +PySfString_GetCharacterPos(PySfString* self, PyObject *args) +{ + sf::Vector2f Pos = self->obj->GetCharacterPos(PyLong_AsUnsignedLong(args)); + return Py_BuildValue("ff", Pos.x, Pos.y); +} + + +static PyMethodDef PySfString_methods[] = { + {"GetCharacterPos", (PyCFunction)PySfString_GetCharacterPos, METH_O, "GetCharacterPos(Index)\n\ +Return the visual position (a tuple of two floats) of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied)\n\ + Index : Index of the character"}, + {"SetText", (PyCFunction)PySfString_SetText, METH_O, "SetText(Text)\nSet the text (an utf-8 or utf-16 string).\n Text : New text"}, + {"GetText", (PyCFunction)PySfString_GetText, METH_NOARGS, "GetText()\nGet the text."}, + {"SetFont", (PyCFunction)PySfString_SetFont, METH_O, "SetFont(Font)\nSet the font of the string.\n Font : font to use"}, + {"GetFont", (PyCFunction)PySfString_GetFont, METH_NOARGS, "GetFont()\nGet the font used by the string."}, + {"SetSize", (PyCFunction)PySfString_SetSize, METH_O, "SetSize(Size)\nSet the size of the string.\n Size : New size, in pixels"}, + {"GetSize", (PyCFunction)PySfString_GetSize, METH_NOARGS, "GetSize()\nGet the size of the characters."}, + {"SetStyle", (PyCFunction)PySfString_SetStyle, METH_O, "SetStyle(TextSize)\nSet the style of the text. The default style is Regular.\n TextSize : New text style, (combination of Style values)"}, + {"GetStyle", (PyCFunction)PySfString_GetStyle, METH_NOARGS, "GetStyle()\nGet the style of the text."}, + {"GetRect", (PyCFunction)PySfString_GetRect, METH_NOARGS, "GetRect()\nGet the string rectangle on screen."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfStringType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "String", /*tp_name*/ + sizeof(PySfString), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfString_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.String defines a graphical 2D text, that can be drawn on screen.\n\ +Default constructor : String ()\nConstruct the string from a utf-8 or a utf-16 string : String(Text, Font=sf.Font.GetDefaultFont(), Size=30.)\n Text : Text assigned to the string\n Font : Font used to draw the string (SFML built-in font by default)\n Size : Characters size (30 by default)", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfString_methods, /* tp_methods */ + PySfString_members, /* tp_members */ + 0, /* tp_getset */ + &PySfDrawableType, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfString_init, /* tp_init */ + 0, /* tp_alloc */ + PySfString_new, /* tp_new */ +}; + + + +void PySfString_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::String::Regular); + PyDict_SetItemString(PySfStringType.tp_dict, "Regular", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::String::Bold); + PyDict_SetItemString(PySfStringType.tp_dict, "Bold", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::String::Italic); + PyDict_SetItemString(PySfStringType.tp_dict, "Italic", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::String::Underlined); + PyDict_SetItemString(PySfStringType.tp_dict, "Underlined", obj); + Py_DECREF(obj); +} + diff --git a/python/src/String.hpp b/python/src/String.hpp new file mode 100644 index 00000000..312eb4bb --- /dev/null +++ b/python/src/String.hpp @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYSTRING_HPP +#define __PYSTRING_HPP + +#include +#include + +#include +#include + +typedef struct { + PyObject_HEAD + sf::String *obj; +} PySfString; + +void PySfString_InitConst(); + +#endif diff --git a/python/src/VideoMode.cpp b/python/src/VideoMode.cpp new file mode 100644 index 00000000..19abe2fc --- /dev/null +++ b/python/src/VideoMode.cpp @@ -0,0 +1,202 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "VideoMode.hpp" + + + +static PyMemberDef PySfVideoMode_members[] = { + {(char *)"Width", T_UINT, offsetof(PySfVideoMode, Width), 0, (char *)"Video mode width, in pixels."}, + {(char *)"Height", T_UINT, offsetof(PySfVideoMode, Height), 0, (char *)"Video mode height, in pixels."}, + {(char *)"BitsPerPixel", T_UINT, offsetof(PySfVideoMode, BitsPerPixel), 0, (char *)"Video mode pixel depth, in bits per pixels."}, + {NULL} /* Sentinel */ +}; + + + +static void +PySfVideoMode_dealloc(PySfVideoMode* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfVideoMode_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfVideoMode *self; + + self = (PySfVideoMode *)type->tp_alloc(type, 0); + + if (self != NULL) + { + self->Width = 0; + self->Height = 0; + self->BitsPerPixel = 32; + } + + return (PyObject *)self; +} + +void +PySfVideoModeUpdate(PySfVideoMode *self) +{ + self->obj->Width = self->Width; + self->obj->Height = self->Height; + self->obj->BitsPerPixel = self->BitsPerPixel; +} + +static int +PySfVideoMode_init(PySfVideoMode *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"Width", "Height", "BitsPerPixel", NULL}; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "II|I", (char **)kwlist, &self->Width, &self->Height, &self->BitsPerPixel)) + return -1; + + self->obj = new sf::VideoMode(self->Width, self->Height, self->BitsPerPixel); + + return 0; +} + + + +static PyObject * +PySfVideoMode_IsValid(PySfVideoMode* self) +{ + self->obj->Width = self->Width; + self->obj->Height = self->Height; + self->obj->BitsPerPixel = self->BitsPerPixel; + return PyBool_FromLong(self->obj->IsValid()); +} + +static PyObject * +PySfVideoMode_GetDesktopMode(PySfVideoMode* self) +{ + PySfVideoMode *VideoMode; + + VideoMode = GetNewPySfVideoMode(); + VideoMode->obj = new sf::VideoMode ( sf::VideoMode::GetDesktopMode() ); + VideoMode->Width = VideoMode->obj->Width; + VideoMode->Height = VideoMode->obj->Height; + VideoMode->BitsPerPixel = VideoMode->obj->BitsPerPixel; + + return (PyObject *)VideoMode; +} + +static PyObject * +PySfVideoMode_GetMode(PySfVideoMode* self, PyObject *args) +{ + std::size_t index; + PySfVideoMode *VideoMode; + + index = (std::size_t)PyInt_AsLong(args); + + VideoMode = GetNewPySfVideoMode(); + VideoMode->obj = new sf::VideoMode ( sf::VideoMode::GetMode(index) ); + VideoMode->Width = VideoMode->obj->Width; + VideoMode->Height = VideoMode->obj->Height; + VideoMode->BitsPerPixel = VideoMode->obj->BitsPerPixel; + + return (PyObject *)VideoMode; +} + +static PyObject * +PySfVideoMode_GetModesCount(PySfVideoMode* self) +{ + return PyInt_FromLong(sf::VideoMode::GetModesCount()); +} + + + +static PyMethodDef PySfVideoMode_methods[] = { + {"IsValid", (PyCFunction)PySfVideoMode_IsValid, METH_NOARGS, "IsValid()\nTell whether or not the video mode is supported."}, + {"GetDesktopMode", (PyCFunction)PySfVideoMode_GetDesktopMode, METH_STATIC | METH_NOARGS, "GetDesktopMode()\nGet the current desktop video mode."}, + {"GetMode", (PyCFunction)PySfVideoMode_GetMode, METH_STATIC | METH_O, "GetMode(Index)\nGet a valid video mode. Index must be in range [0, GetModesCount()[ Modes are sorted from best to worst.\n Index : Index of video mode to get"}, + {"GetModesCount", (PyCFunction)PySfVideoMode_GetModesCount, METH_STATIC | METH_NOARGS, "GetModesCount()\nGet valid video modes count."}, + {NULL} /* Sentinel */ +}; + +int PySfVideoMode_Compare(PyObject *o1, PyObject *o2) +{ + PySfVideoModeUpdate((PySfVideoMode *)o1); + PySfVideoModeUpdate((PySfVideoMode *)o2); + if (*(((PySfVideoMode *)o1)->obj) == *(((PySfVideoMode *)o2)->obj)) + return 0; + else + return 1; +} + + +PyTypeObject PySfVideoModeType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "VideoMode", /*tp_name*/ + sizeof(PySfVideoMode), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfVideoMode_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + PySfVideoMode_Compare, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.VideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting modes supported by the display device\n\ +Default constructor : VideoMode()\n\ +Construct the video mode with its attributes : VideoMode(ModeWidth, ModeHeight, ModeBpp = 32)\n ModeWidth : Width in pixels\n ModeHeight : Height in pixels\n ModeBpp : Pixel depths in bits per pixel (32 by default)", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfVideoMode_methods, /* tp_methods */ + PySfVideoMode_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfVideoMode_init, /* tp_init */ + 0, /* tp_alloc */ + PySfVideoMode_new, /* tp_new */ +}; + + +PySfVideoMode * +GetNewPySfVideoMode() +{ + return (PySfVideoMode *)PySfVideoMode_new(&PySfVideoModeType, NULL, NULL); +} + diff --git a/python/src/VideoMode.hpp b/python/src/VideoMode.hpp new file mode 100644 index 00000000..d7a3dec6 --- /dev/null +++ b/python/src/VideoMode.hpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYVIDEOMODE_HPP +#define __PYVIDEOMODE_HPP + +#include +#include +#include + +#include +#include + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD + unsigned int Width; + unsigned int Height; + unsigned int BitsPerPixel; + sf::VideoMode *obj; +} PySfVideoMode; + +void +PySfVideoModeUpdate(PySfVideoMode *self); + +PySfVideoMode * +GetNewPySfVideoMode(); + +#endif diff --git a/python/src/View.cpp b/python/src/View.cpp new file mode 100644 index 00000000..d2587f02 --- /dev/null +++ b/python/src/View.cpp @@ -0,0 +1,194 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "View.hpp" + +extern PyTypeObject PySfFloatRectType; + +static PyMemberDef PySfView_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfView_dealloc(PySfView *self) +{ + if (self->Owner) + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfView_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfView *self; + + self = (PySfView *)type->tp_alloc(type, 0); + if (self != NULL) + { + self->Owner = true; + } + + return (PyObject *)self; +} + +static int +PySfView_init(PySfView *self, PyObject *args, PyObject *kwds) +{ + PySfFloatRect *Rect=NULL; + if (! PyArg_ParseTuple(args, "|O!", &PySfFloatRectType, &Rect)) + return -1; + + if (Rect != NULL) + self->obj = new sf::View( (const sf::FloatRect) *(Rect->obj)); + else + self->obj = new sf::View(); + + return 0; +} + +static PyObject * +PySfView_GetCenter(PySfView* self) +{ + sf::Vector2f Vect = self->obj->GetCenter(); + return Py_BuildValue("ff", Vect.x, Vect.y); +} + +static PyObject * +PySfView_GetHalfSize(PySfView* self) +{ + sf::Vector2f Vect = self->obj->GetHalfSize(); + return Py_BuildValue("ff", Vect.x, Vect.y); +} + +static PyObject * +PySfView_GetRect(PySfView* self) +{ + PySfFloatRect *Rect = GetNewPySfFloatRect(); + Rect->obj = new sf::FloatRect(self->obj->GetRect()); + Rect->Left = Rect->obj->Left; + Rect->Right = Rect->obj->Right; + Rect->Top = Rect->obj->Top; + Rect->Bottom = Rect->obj->Bottom; + return (PyObject *)Rect; +} + +static PyObject * +PySfView_Move(PySfView* self, PyObject *args) +{ + float x, y; + if ( !PyArg_ParseTuple(args, "ff", &x, &y) ) + return NULL; + self->obj->Move(x, y); + Py_RETURN_NONE; +} + +static PyObject * +PySfView_SetCenter(PySfView* self, PyObject *args) +{ + float x, y; + if ( !PyArg_ParseTuple(args, "ff", &x, &y) ) + return NULL; + self->obj->SetCenter(x, y); + Py_RETURN_NONE; +} + +static PyObject * +PySfView_SetHalfSize(PySfView* self, PyObject *args) +{ + float x, y; + if ( !PyArg_ParseTuple(args, "ff", &x, &y) ) + return NULL; + self->obj->SetHalfSize(x, y); + Py_RETURN_NONE; +} + +static PyObject * +PySfView_Zoom(PySfView* self, PyObject *args) +{ + self->obj->Zoom(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyMethodDef PySfView_methods[] = { + {"GetCenter", (PyCFunction)PySfView_GetCenter, METH_NOARGS, "GetCenter()\nGet the center of the view."}, + {"GetHalfSize", (PyCFunction)PySfView_GetHalfSize, METH_NOARGS, "GetHalfSize()\nGet the half-size of the view."}, + {"GetRect", (PyCFunction)PySfView_GetRect, METH_NOARGS, "GetRect()\nGet the bounding rectangle of the view."}, + {"Move", (PyCFunction)PySfView_Move, METH_VARARGS, "Move(OffsetX, OffsetY)\nMove the view.\n\ + OffsetX : Offset to move the view, on X axis\n\ + OffsetY : Offset to move the view, on Y axis"}, + {"SetCenter", (PyCFunction)PySfView_SetCenter, METH_VARARGS, "SetCenter(X, Y)\nChange the center of the view."}, + {"SetHalfSize", (PyCFunction)PySfView_SetHalfSize, METH_VARARGS, "SetHalfSize(HalfWidth, HalfHeight)\nChange the half-size of the view."}, + {"Zoom", (PyCFunction)PySfView_Zoom, METH_O, "Zoom(Factor)\nResize the view rectangle to simulate a zoom / unzoom effect."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfViewType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "View", /*tp_name*/ + sizeof(PySfView), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfView_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "This class defines a view (position, size, etc.) ; you can consider it as a 2D camera.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfView_methods, /* tp_methods */ + PySfView_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfView_init, /* tp_init */ + 0, /* tp_alloc */ + PySfView_new, /* tp_new */ +}; + +PySfView * +GetNewPySfView() +{ + return (PySfView *)PySfView_new(&PySfViewType, NULL, NULL); +} + diff --git a/python/src/View.hpp b/python/src/View.hpp new file mode 100644 index 00000000..af55275f --- /dev/null +++ b/python/src/View.hpp @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYVIEW_HPP +#define __PYVIEW_HPP + +#include +#include + +#include "Rect.hpp" + +#include +#include + +#include "offsetof.hpp" + +typedef struct { + PyObject_HEAD + bool Owner; + sf::View *obj; +} PySfView; + +PySfView * +GetNewPySfView(); + +#endif diff --git a/python/src/Window.cpp b/python/src/Window.cpp new file mode 100644 index 00000000..1f4b17f8 --- /dev/null +++ b/python/src/Window.cpp @@ -0,0 +1,428 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "Window.hpp" + +#include "SFML/Window/WindowStyle.hpp" + +extern PyTypeObject PySfEventType; +extern PyTypeObject PySfWindowSettingsType; +extern PyTypeObject PySfVideoModeType; + +static PyMemberDef PySfWindow_members[] = { + {NULL} /* Sentinel */ +}; + +static void +PySfWindow_dealloc(PySfWindow* self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfWindow_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfWindow *self; + + self = (PySfWindow *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + + +static PyObject* +PySfWindow_GetEvent(PySfWindow *self, PyObject *args) +{ + PySfEvent *PyEvent = (PySfEvent *)args; + + if (! PyObject_TypeCheck(PyEvent, &PySfEventType)) + { + PyErr_SetString(PyExc_TypeError, "Argument is not a sfEvent"); + return NULL; + } + + if (self->obj->GetEvent(*(PyEvent->obj))) + { + PyEvent->Type = PyEvent->obj->Type; + PyEvent->Text->Unicode = PyEvent->obj->Text.Unicode; + PyEvent->Key->Code = PyEvent->obj->Key.Code; + if (PyEvent->obj->Key.Alt && PyEvent->Key->Alt == Py_False) + { + Py_DECREF(Py_False); + Py_INCREF(Py_True); + PyEvent->Key->Alt = Py_True; + } + else if (PyEvent->Key->Alt == Py_True) + { + Py_DECREF(Py_True); + Py_INCREF(Py_False); + PyEvent->Key->Alt = Py_False; + } + if (PyEvent->obj->Key.Control && PyEvent->Key->Control == Py_False) + { + Py_DECREF(Py_False); + Py_INCREF(Py_True); + PyEvent->Key->Control = Py_True; + } + else if (PyEvent->Key->Control == Py_True) + { + Py_DECREF(Py_True); + Py_INCREF(Py_False); + PyEvent->Key->Control = Py_False; + } + if (PyEvent->obj->Key.Shift && PyEvent->Key->Shift == Py_False) + { + Py_DECREF(Py_False); + Py_INCREF(Py_True); + PyEvent->Key->Shift = Py_True; + } + else if (PyEvent->Key->Shift == Py_True) + { + Py_DECREF(Py_True); + Py_INCREF(Py_False); + PyEvent->Key->Shift = Py_False; + } + PyEvent->MouseButton->Button = PyEvent->obj->MouseButton.Button; + PyEvent->MouseButton->X = PyEvent->obj->MouseButton.X; + PyEvent->MouseButton->Y = PyEvent->obj->MouseButton.Y; + PyEvent->MouseMove->X = PyEvent->obj->MouseMove.X; + PyEvent->MouseMove->Y = PyEvent->obj->MouseMove.Y; + PyEvent->JoyMove->JoystickId = PyEvent->obj->JoyMove.JoystickId; + PyEvent->JoyButton->JoystickId = PyEvent->obj->JoyButton.JoystickId; + PyEvent->JoyButton->Button = PyEvent->obj->JoyButton.Button; + PyEvent->JoyMove->Axis = PyEvent->obj->JoyMove.Axis; + PyEvent->JoyMove->Position = PyEvent->obj->JoyMove.Position; + PyEvent->Size->Width = PyEvent->obj->Size.Width; + PyEvent->Size->Height = PyEvent->obj->Size.Height; + PyEvent->MouseWheel->Delta = PyEvent->obj->MouseWheel.Delta; + Py_RETURN_TRUE; + } + else + Py_RETURN_FALSE; +} + + + +PyObject* +PySfWindow_Create(PySfWindow* self, PyObject *args, PyObject *kwds) +{ + PyObject *VideoModeTmp=NULL; + sf::VideoMode *VideoMode; + char *Title=NULL; + unsigned long WindowStyle = sf::Style::Resize | sf::Style::Close; + PySfWindowSettings *ParamsTmp=NULL; + sf::WindowSettings *Params = NULL; + + const char *kwlist[] = {"VideoMode", "Title", "WindowStyle", "Params", NULL}; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "O!s|IO!", (char **)kwlist, &PySfVideoModeType, &VideoModeTmp, &Title, &WindowStyle, &PySfWindowSettingsType, &ParamsTmp)) + return NULL; + + if (VideoModeTmp) { + VideoMode = ((PySfVideoMode *)VideoModeTmp)->obj; + PySfVideoModeUpdate((PySfVideoMode *)VideoModeTmp); + } + else + return NULL; + + if (ParamsTmp) + { + PySfWindowSettingsUpdate(ParamsTmp); + Params = ParamsTmp->obj; + } + else + Params = new sf::WindowSettings(); + + self->obj->Create(*VideoMode, Title, WindowStyle, *Params); + + Py_RETURN_NONE; +} + +static int +PySfWindow_init(PySfWindow *self, PyObject *args, PyObject *kwds) +{ + self->obj = new sf::Window(); + if (PyTuple_Size(args) > 0) + PySfWindow_Create(self, args, kwds); + return 0; +} + +static PyObject * +PySfWindow_Close(PySfWindow *self) +{ + self->obj->Close(); + Py_RETURN_NONE; +} +static PyObject * +PySfWindow_IsOpened(PySfWindow *self) +{ + if (self->obj->IsOpened()) + Py_RETURN_TRUE; + else + Py_RETURN_NONE; +} +static PyObject * +PySfWindow_GetWidth(PySfWindow *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetWidth()); +} +static PyObject * +PySfWindow_GetHeight(PySfWindow *self) +{ + return PyLong_FromUnsignedLong(self->obj->GetHeight()); +} + +static PyObject * +PySfWindow_UseVerticalSync(PySfWindow *self, PyObject *args) +{ + bool Enabled = false; + if (PyObject_IsTrue(args)) + Enabled = true; + self->obj->UseVerticalSync(Enabled); + Py_RETURN_NONE; +} +static PyObject * +PySfWindow_ShowMouseCursor(PySfWindow *self, PyObject *args) +{ + bool Show = false; + if (PyObject_IsTrue(args)) + Show = true; + self->obj->ShowMouseCursor(Show); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_SetActive(PySfWindow *self, PyObject *args) +{ + bool Active = false; + if (PyObject_IsTrue(args)) + Active = true; + if (self->obj->SetActive(Active)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} +static PyObject * +PySfWindow_Display(PySfWindow *self) +{ + self->obj->Display(); + Py_RETURN_NONE; +} +static PyObject * +PySfWindow_GetFrameTime(PySfWindow *self) +{ + return PyFloat_FromDouble(self->obj->GetFrameTime()); +} + +static PyObject * +PySfWindow_GetInput(PySfWindow *self) +{ + PySfInput *Input; + Input = GetNewPySfInput(); + Input->obj = (sf::Input *)&self->obj->GetInput(); + return (PyObject *)Input; +} + +static PyObject * +PySfWindow_GetSettings(PySfWindow *self) +{ + PySfWindowSettings *Settings; + Settings = GetNewPySfWindowSettings(); + Settings->obj = (sf::WindowSettings *)&self->obj->GetSettings(); + Settings->DepthBits = Settings->obj->DepthBits; + Settings->StencilBits = Settings->obj->StencilBits; + Settings->AntialiasingLevel = Settings->obj->AntialiasingLevel; + return (PyObject *)Settings; +} + +static PyObject * +PySfWindow_SetPosition(PySfWindow* self, PyObject *args) +{ + int Left=0, Top=0; + if (! PyArg_ParseTuple(args, "ii", &Left, &Top)) + return NULL; + + self->obj->SetPosition(Left,Top); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_SetFramerateLimit(PySfWindow *self, PyObject *args) +{ + self->obj->SetFramerateLimit(PyLong_AsUnsignedLong(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_Show(PySfWindow *self, PyObject *args) +{ + if (PyObject_IsTrue(args)) + self->obj->Show(true); + else + self->obj->Show(false); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_EnableKeyRepeat(PySfWindow *self, PyObject *args) +{ + if (PyObject_IsTrue(args)) + self->obj->EnableKeyRepeat(true); + else + self->obj->EnableKeyRepeat(false); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_SetCursorPosition(PySfWindow* self, PyObject *args) +{ + unsigned int Left=0, Top=0; + if (! PyArg_ParseTuple(args, "II", &Left, &Top)) + return NULL; + + self->obj->SetCursorPosition(Left,Top); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_SetSize(PySfWindow* self, PyObject *args) +{ + unsigned int Width=0, Height=0; + if (! PyArg_ParseTuple(args, "II", &Width, &Height)) + return NULL; + + self->obj->SetSize(Width, Height); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_SetJoystickThreshold(PySfWindow* self, PyObject *args) +{ + self->obj->SetJoystickThreshold(PyFloat_AsDouble(args)); + Py_RETURN_NONE; +} + +static PyObject * +PySfWindow_SetIcon(PySfWindow* self, PyObject *args) +{ + unsigned int Width, Height, Size; + char *Data; + + if (! PyArg_ParseTuple(args, "IIs#", &Width, &Height, &Data, &Size)) + return NULL; + + self->obj->SetIcon(Width, Height, (sf::Uint8*) Data); + Py_RETURN_NONE; +} + +static PyMethodDef PySfWindow_methods[] = { + {"Close", (PyCFunction)PySfWindow_Close, METH_NOARGS, "Close()\nClose (destroy) the window. The sf.Window instance remains valid and you can call Create to recreate the window."}, + {"Create", (PyCFunction)PySfWindow_Create, METH_VARARGS | METH_KEYWORDS, "Create(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.WindowSettings())\n\ +Create a window.\n\ + Mode : Video mode to use (sf.VideoMode instance)\n\ + Title : Title of the window\n\ + WindowStyle : Window style (Resize | Close by default)\n\ + Params : Creation parameters (see default constructor for default values)\n"}, + {"Display", (PyCFunction)PySfWindow_Display, METH_NOARGS, "Display()\nDisplay the window on screen."}, + {"EnableKeyRepeat", (PyCFunction)PySfWindow_EnableKeyRepeat, METH_O, "EnableKeyRepeat(Enable)\nEnable or disable automatic key-repeat. Automatic key-repeat is enabled by default.\n Enabled : True to enable, false to disable"}, + {"GetEvent", (PyCFunction)PySfWindow_GetEvent, METH_O, "GetEvent(Event)\nGet the event on top of events stack, if any, and pop it. Returns True if an event was returned, False if events stack was empty.\n EventReceived : Event to fill, if any."}, + {"GetFrameTime", (PyCFunction)PySfWindow_GetFrameTime, METH_NOARGS, "GetFrameTime()\nGet time elapsed since last frame. Returns time elapsed, in seconds"}, + {"GetHeight", (PyCFunction)PySfWindow_GetHeight, METH_NOARGS, "GetHeight()\nGet the height of the rendering region of the window."}, + {"GetInput", (PyCFunction)PySfWindow_GetInput, METH_NOARGS, "GetInput()\nGet the input manager of the window."}, + {"GetSettings", (PyCFunction)PySfWindow_GetSettings, METH_NOARGS, "GetSettings()\nGet the creation settings of the window."}, + {"GetWidth", (PyCFunction)PySfWindow_GetWidth, METH_NOARGS, "GetWidth()\nGet the width of the rendering region of the window."}, + {"IsOpened", (PyCFunction)PySfWindow_IsOpened, METH_NOARGS, "IsOpened()\nTell whether or not the window is opened (ie. has been created). Note that a hidden window (Show(False)) will still return True."}, + {"SetActive", (PyCFunction)PySfWindow_SetActive, METH_O, "SetActive(Active)\nActivate of deactivate the window as the current target for rendering. Returns True if operation was successful, False otherwise.\n Active : True to activate, False to deactivate (True by default)"}, + {"SetCursorPosition", (PyCFunction)PySfWindow_SetCursorPosition, METH_VARARGS, "SetCursorPosition(Left, Top)\nChange the position of the mouse cursor.\n Left : Left coordinate of the cursor, relative to the window\n Top : Top coordinate of the cursor, relative to the window"}, + {"SetSize", (PyCFunction)PySfWindow_SetSize, METH_VARARGS, "SetSize(Width, Height)\nChange the size of the rendering region of the window.\n\ + Width : New width\n Height : New height"}, + {"SetFramerateLimit", (PyCFunction)PySfWindow_SetFramerateLimit, METH_O, "SetFramerateLimit(Limit)\nSet the framerate at a fixed frequency.\n Limit : Framerate limit, in frames per seconds (use 0 to disable limit)"}, + {"SetJoystickThreshold", (PyCFunction)PySfWindow_SetJoystickThreshold, METH_O, "SetJoystickThreshold(Threshold)\nChange the joystick threshold, ie. the value below which no move event will be generated.\n Threshold : New threshold, in range [0., 100.]"}, + {"SetPosition", (PyCFunction)PySfWindow_SetPosition, METH_VARARGS, "SetPosition(X, Y)\nChange the position of the window on screen. Only works for top-level windows\n Left : Left position\n Top : Top position"}, + {"Show", (PyCFunction)PySfWindow_Show, METH_O, "Show(State)\nShow or hide the window.\n State : True to show, false to hide."}, + {"ShowMouseCursor", (PyCFunction)PySfWindow_ShowMouseCursor, METH_O, "ShowMouseCursor(Show)\nShow or hide the mouse cursor.\n Show : True to show, false to hide."}, + {"UseVerticalSync", (PyCFunction)PySfWindow_UseVerticalSync, METH_O, "UseVerticalSync(Enabled)\nEnable / disable vertical synchronization.\n Enabled : True to enable v-sync, False to deactivate"}, + {"SetIcon", (PyCFunction)PySfWindow_SetIcon, METH_VARARGS, "SetIcon(Width, Height, Pixels)\n\ +Change the window's icon.\n\ + Width : Icon's width, in pixels\n\ + Height : Icon's height, in pixels\n\ + Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits."}, + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfWindowType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Window", /*tp_name*/ + sizeof(PySfWindow), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfWindow_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "sf.Window is a rendering window ; it can create a new window or connect to an existing one.\n\ +Default constructor : sf.Window()\n\ +Construct a new window : sf.Window(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.WindowSettings())\n\ + Mode : Video mode to use (sf.VideoMode instance)\n\ + Title : Title of the window\n\ + WindowStyle : Window style (Resize | Close by default)\n\ + Params : Creation parameters (see default constructor for default values)\n\ +", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfWindow_methods, /* tp_methods */ + PySfWindow_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfWindow_init, /* tp_init */ + 0, /* tp_alloc */ + PySfWindow_new, /* tp_new */ +}; + + diff --git a/python/src/Window.hpp b/python/src/Window.hpp new file mode 100644 index 00000000..b42084b0 --- /dev/null +++ b/python/src/Window.hpp @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYWINDOW_HPP +#define __PYWINDOW_HPP + +#include +#include +#include + +#include +#include + +#include "Event.hpp" +#include "VideoMode.hpp" +#include "Input.hpp" +#include "WindowSettings.hpp" + + +typedef struct { + PyObject_HEAD + sf::Window *obj; +} PySfWindow; + +PyObject* +PySfWindow_Create(PySfWindow* self, PyObject *args, PyObject *kwds); + +#endif diff --git a/python/src/WindowSettings.cpp b/python/src/WindowSettings.cpp new file mode 100644 index 00000000..f6e5be47 --- /dev/null +++ b/python/src/WindowSettings.cpp @@ -0,0 +1,131 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "WindowSettings.hpp" + +static PyMemberDef PySfWindowSettings_members[] = { + {(char *)"DepthBits", T_UINT, offsetof(PySfWindowSettings, DepthBits), 0, (char *)"Depth buffer bits (24 by default)"}, + {(char *)"StencilBits", T_UINT, offsetof(PySfWindowSettings, StencilBits), 0, (char *)"Stencil buffer bits (8 by default)"}, + {(char *)"AntialiasingLevel", T_UINT, offsetof(PySfWindowSettings, AntialiasingLevel), 0, (char *)"Antialiasing level (0 by default)"}, + {NULL} /* Sentinel */ +}; + + +static void +PySfWindowSettings_dealloc(PySfWindowSettings *self) +{ + delete self->obj; + self->ob_type->tp_free((PyObject*)self); +} + +void +PySfWindowSettingsUpdate(PySfWindowSettings *self) +{ + self->obj->DepthBits = self->DepthBits; + self->obj->StencilBits = self->StencilBits; + self->obj->AntialiasingLevel = self->AntialiasingLevel; +} + +static PyObject * +PySfWindowSettings_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfWindowSettings *self; + + self = (PySfWindowSettings *)type->tp_alloc(type, 0); + + if (self != NULL) + { + self->DepthBits = 24; + self->StencilBits = 8; + self->AntialiasingLevel = 0; + } + + return (PyObject *)self; +} + + +static int +PySfWindowSettings_init(PySfWindowSettings *self, PyObject *args, PyObject *kwds) +{ + const char *kwlist[] = {"DepthBits", "StencilBits", "AntialiasingLevel", NULL}; + if (! PyArg_ParseTupleAndKeywords(args, kwds, "|III", (char **)kwlist, &(self->DepthBits), &(self->StencilBits), &(self->AntialiasingLevel))) + return -1; + self->obj = new sf::WindowSettings(self->DepthBits, self->StencilBits, self->AntialiasingLevel); + + return 0; +} + +static PyMethodDef PySfWindowSettings_methods[] = { + {NULL} /* Sentinel */ +}; + + +PyTypeObject PySfWindowSettingsType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "WindowSettings", /*tp_name*/ + sizeof(PySfWindowSettings), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfWindowSettings_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Structure defining the creation settings of windows.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfWindowSettings_methods, /* tp_methods */ + PySfWindowSettings_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfWindowSettings_init, /* tp_init */ + 0, /* tp_alloc */ + PySfWindowSettings_new, /* tp_new */ +}; + +PySfWindowSettings * +GetNewPySfWindowSettings() +{ + return PyObject_New(PySfWindowSettings, &PySfWindowSettingsType); +} + diff --git a/python/src/WindowSettings.hpp b/python/src/WindowSettings.hpp new file mode 100644 index 00000000..ac613561 --- /dev/null +++ b/python/src/WindowSettings.hpp @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYWINDOWSETTINGS_HPP +#define __PYWINDOWSETTINGS_HPP + +#include +#include + +#include +#include + +#include "offsetof.hpp" + + +typedef struct { + PyObject_HEAD + unsigned int DepthBits; + unsigned int StencilBits; + unsigned int AntialiasingLevel; + sf::WindowSettings *obj; +} PySfWindowSettings; + +void +PySfWindowSettingsUpdate(PySfWindowSettings *self); + +PySfWindowSettings * +GetNewPySfWindowSettings(); + +#endif diff --git a/python/src/WindowStyle.cpp b/python/src/WindowStyle.cpp new file mode 100644 index 00000000..3846f150 --- /dev/null +++ b/python/src/WindowStyle.cpp @@ -0,0 +1,140 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include + +#include +#include + +#include "WindowStyle.hpp" + + +typedef struct { + PyObject_HEAD +} PySfStyle; + + + +static PyMemberDef PySfStyle_members[] = { + {NULL} /* Sentinel */ +}; + + +static void +PySfStyle_dealloc(PySfStyle *self) +{ + self->ob_type->tp_free((PyObject*)self); +} + +static PyObject * +PySfStyle_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PySfStyle *self; + + self = (PySfStyle *)type->tp_alloc(type, 0); + if (self != NULL) + { + } + + return (PyObject *)self; +} + + +static int +PySfStyle_init(PySfStyle *self, PyObject *args, PyObject *kwds) +{ + return 0; +} + +static PyMethodDef PySfStyle_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfStyleType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "Style", /*tp_name*/ + sizeof(PySfStyle), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfStyle_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Enumeration of window creation styles.\n\ +None No border / title bar (this flag and all others are mutually exclusive).\n\ +Titlebar Title bar + fixed border.\n\ +Resize Titlebar + resizable border + maximize button.\n\ +Close Titlebar + close button.\n\ +Fullscreen Fullscreen mode (this flag and all others are mutually exclusive).", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfStyle_methods, /* tp_methods */ + PySfStyle_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PySfStyle_init, /* tp_init */ + 0, /* tp_alloc */ + PySfStyle_new, /* tp_new */ +}; + +void PySfStyle_InitConst() +{ + PyObject *obj; + obj = PyInt_FromLong(sf::Style::None); + PyDict_SetItemString(PySfStyleType.tp_dict, "None", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Style::Titlebar); + PyDict_SetItemString(PySfStyleType.tp_dict, "Titlebar", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Style::Resize); + PyDict_SetItemString(PySfStyleType.tp_dict, "Resize", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Style::Close); + PyDict_SetItemString(PySfStyleType.tp_dict, "Close", obj); + Py_DECREF(obj); + obj = PyInt_FromLong(sf::Style::Fullscreen); + PyDict_SetItemString(PySfStyleType.tp_dict, "Fullscreen", obj); + Py_DECREF(obj); +} + diff --git a/python/src/WindowStyle.hpp b/python/src/WindowStyle.hpp new file mode 100644 index 00000000..042c1b83 --- /dev/null +++ b/python/src/WindowStyle.hpp @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYWINDOWSTYLE_HPP +#define __PYWINDOWSTYLE_HPP + +void +PySfStyle_InitConst(); + +#endif diff --git a/python/src/main.cpp b/python/src/main.cpp new file mode 100644 index 00000000..d879f4a7 --- /dev/null +++ b/python/src/main.cpp @@ -0,0 +1,276 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "main.hpp" + +#include "Color.hpp" +#include "Key.hpp" +#include "Joy.hpp" +#include "Event.hpp" +#include "Mouse.hpp" +#include "WindowStyle.hpp" +#include "Blend.hpp" +#include "Sound.hpp" +#include "String.hpp" +#include "SoundStream.hpp" + +extern PyTypeObject PySfClockType; + +extern PyTypeObject PySfEventType; +extern PyTypeObject PySfEventTextType; +extern PyTypeObject PySfEventKeyType; +extern PyTypeObject PySfEventMouseMoveType; +extern PyTypeObject PySfEventMouseButtonType; +extern PyTypeObject PySfEventMouseWheelType; +extern PyTypeObject PySfEventJoyMoveType; +extern PyTypeObject PySfEventJoyButtonType; +extern PyTypeObject PySfEventSizeType; +extern PyTypeObject PySfKeyType; +extern PyTypeObject PySfJoyType; +extern PyTypeObject PySfMouseType; + +extern PyTypeObject PySfVideoModeType; +extern PyTypeObject PySfWindowType; +extern PyTypeObject PySfWindowSettingsType; +extern PyTypeObject PySfStyleType; +extern PyTypeObject PySfRenderWindowType; +extern PyTypeObject PySfViewType; +extern PyTypeObject PySfInputType; + +extern PyTypeObject PySfDrawableType; +extern PyTypeObject PySfBlendType; +extern PyTypeObject PySfSpriteType; +extern PyTypeObject PySfFontType; +extern PyTypeObject PySfGlyphType; +extern PyTypeObject PySfStringType; +extern PyTypeObject PySfPostFXType; + +extern PyTypeObject PySfImageType; + +extern PyTypeObject PySfColorType; + +extern PyTypeObject PySfShapeType; + +extern PyTypeObject PySfIntRectType; +extern PyTypeObject PySfFloatRectType; + +extern PyTypeObject PySfMusicType; +extern PyTypeObject PySfSoundType; +extern PyTypeObject PySfSoundBufferType; +extern PyTypeObject PySfSoundRecorderType; +extern PyTypeObject PySfSoundBufferRecorderType; +extern PyTypeObject PySfSoundStreamType; +extern PyTypeObject PySfListenerType; + + +static PyMethodDef module_methods[] = { + {"Sleep", (PyCFunction)PySFML_Sleep, METH_O, "Sleep(Duration)\nMake the current thread sleep for a given time.\n Duration : Time to sleep, in seconds"}, + {NULL} /* Sentinel */ +}; + +#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ +#define PyMODINIT_FUNC void +#endif +PyMODINIT_FUNC +initsf(void) +{ + PyObject *m; + + if (PyType_Ready(&PySfClockType) < 0) + return; + + if (PyType_Ready(&PySfWindowType) < 0) + return; + if (PyType_Ready(&PySfWindowSettingsType) < 0) + return; + if (PyType_Ready(&PySfStyleType) < 0) + return; + if (PyType_Ready(&PySfRenderWindowType) < 0) + return; + if (PyType_Ready(&PySfVideoModeType) < 0) + return; + if (PyType_Ready(&PySfViewType) < 0) + return; + if (PyType_Ready(&PySfInputType) < 0) + return; + + if (PyType_Ready(&PySfEventType) < 0) + return; + if (PyType_Ready(&PySfEventTextType) < 0) + return; + if (PyType_Ready(&PySfEventKeyType) < 0) + return; + if (PyType_Ready(&PySfEventMouseMoveType) < 0) + return; + if (PyType_Ready(&PySfEventMouseButtonType) < 0) + return; + if (PyType_Ready(&PySfEventMouseWheelType) < 0) + return; + if (PyType_Ready(&PySfEventJoyMoveType) < 0) + return; + if (PyType_Ready(&PySfEventJoyButtonType) < 0) + return; + if (PyType_Ready(&PySfEventSizeType) < 0) + return; + if (PyType_Ready(&PySfKeyType) < 0) + return; + if (PyType_Ready(&PySfJoyType) < 0) + return; + if (PyType_Ready(&PySfMouseType) < 0) + return; + + if (PyType_Ready(&PySfDrawableType) < 0) + return; + if (PyType_Ready(&PySfBlendType) < 0) + return; + if (PyType_Ready(&PySfSpriteType) < 0) + return; + if (PyType_Ready(&PySfFontType) < 0) + return; + if (PyType_Ready(&PySfGlyphType) < 0) + return; + if (PyType_Ready(&PySfStringType) < 0) + return; + if (PyType_Ready(&PySfPostFXType) < 0) + return; + + if (PyType_Ready(&PySfImageType) < 0) + return; + + if (PyType_Ready(&PySfShapeType) < 0) + return; + + if (PyType_Ready(&PySfColorType) < 0) + return; + + if (PyType_Ready(&PySfIntRectType) < 0) + return; + if (PyType_Ready(&PySfFloatRectType) < 0) + return; + + if (PyType_Ready(&PySfMusicType) < 0) + return; + if (PyType_Ready(&PySfSoundType) < 0) + return; + if (PyType_Ready(&PySfSoundBufferType) < 0) + return; + if (PyType_Ready(&PySfSoundBufferRecorderType) < 0) + return; + if (PyType_Ready(&PySfSoundRecorderType) < 0) + return; + if (PyType_Ready(&PySfSoundStreamType) < 0) + return; + if (PyType_Ready(&PySfListenerType) < 0) + return; + + m = Py_InitModule3("sf", module_methods, "Python binding for sfml (Simple Fast Media Library)"); + + if (m == NULL) + return; + + Py_INCREF(&PySfClockType); + PyModule_AddObject(m, "Clock", (PyObject *)&PySfClockType); + + Py_INCREF(&PySfWindowType); + PyModule_AddObject(m, "Window", (PyObject *)&PySfWindowType); + Py_INCREF(&PySfWindowSettingsType); + PyModule_AddObject(m, "WindowSettings", (PyObject *)&PySfWindowSettingsType); + Py_INCREF(&PySfStyleType); + PyModule_AddObject(m, "Style", (PyObject *)&PySfStyleType); + Py_INCREF(&PySfRenderWindowType); + PyModule_AddObject(m, "RenderWindow", (PyObject *)&PySfRenderWindowType); + Py_INCREF(&PySfVideoModeType); + PyModule_AddObject(m, "VideoMode", (PyObject *)&PySfVideoModeType); + Py_INCREF(&PySfViewType); + PyModule_AddObject(m, "View", (PyObject *)&PySfViewType); + Py_INCREF(&PySfInputType); + PyModule_AddObject(m, "Input", (PyObject *)&PySfInputType); + + Py_INCREF(&PySfDrawableType); + PyModule_AddObject(m, "Drawable", (PyObject *)&PySfDrawableType); + Py_INCREF(&PySfBlendType); + PyModule_AddObject(m, "Blend", (PyObject *)&PySfBlendType); + Py_INCREF(&PySfSpriteType); + PyModule_AddObject(m, "Sprite", (PyObject *)&PySfSpriteType); + Py_INCREF(&PySfFontType); + PyModule_AddObject(m, "Font", (PyObject *)&PySfFontType); + Py_INCREF(&PySfGlyphType); + PyModule_AddObject(m, "Glyph", (PyObject *)&PySfGlyphType); + Py_INCREF(&PySfStringType); + PyModule_AddObject(m, "String", (PyObject *)&PySfStringType); + Py_INCREF(&PySfPostFXType); + PyModule_AddObject(m, "PostFX", (PyObject *)&PySfPostFXType); + + Py_INCREF(&PySfEventType); + PyModule_AddObject(m, "Event", (PyObject *)&PySfEventType); + Py_INCREF(&PySfKeyType); + PyModule_AddObject(m, "Key", (PyObject *)&PySfKeyType); + Py_INCREF(&PySfJoyType); + PyModule_AddObject(m, "Joy", (PyObject *)&PySfJoyType); + Py_INCREF(&PySfMouseType); + PyModule_AddObject(m, "Mouse", (PyObject *)&PySfMouseType); + + Py_INCREF(&PySfImageType); + PyModule_AddObject(m, "Image", (PyObject *)&PySfImageType); + + Py_INCREF(&PySfColorType); + PyModule_AddObject(m, "Color", (PyObject *)&PySfColorType); + + Py_INCREF(&PySfShapeType); + PyModule_AddObject(m, "Shape", (PyObject *)&PySfShapeType); + + Py_INCREF(&PySfIntRectType); + PyModule_AddObject(m, "IntRect", (PyObject *)&PySfIntRectType); + Py_INCREF(&PySfFloatRectType); + PyModule_AddObject(m, "FloatRect", (PyObject *)&PySfFloatRectType); + + Py_INCREF(&PySfMusicType); + PyModule_AddObject(m, "Music", (PyObject *)&PySfMusicType); + Py_INCREF(&PySfSoundType); + PyModule_AddObject(m, "Sound", (PyObject *)&PySfSoundType); + Py_INCREF(&PySfSoundBufferType); + PyModule_AddObject(m, "SoundBuffer", (PyObject *)&PySfSoundBufferType); + Py_INCREF(&PySfSoundRecorderType); + PyModule_AddObject(m, "SoundRecorder", (PyObject *)&PySfSoundRecorderType); + Py_INCREF(&PySfSoundBufferRecorderType); + PyModule_AddObject(m, "SoundBufferRecorder", (PyObject *)&PySfSoundBufferRecorderType); + Py_INCREF(&PySfSoundStreamType); + PyModule_AddObject(m, "SoundStream", (PyObject *)&PySfSoundStreamType); + Py_INCREF(&PySfListenerType); + PyModule_AddObject(m, "Listener", (PyObject *)&PySfListenerType); + + PyModule_AddStringConstant(m, "Version", "1.4"); + + PySfColor_InitConst(); + PySfKey_InitConst(); + PySfJoy_InitConst(); + PySfEvent_InitConst(); + PySfMouse_InitConst(); + PySfStyle_InitConst(); + PySfBlend_InitConst(); + PySfSound_InitConst(); + PySfSoundStream_InitConst(); + PySfString_InitConst(); +} + diff --git a/python/src/main.hpp b/python/src/main.hpp new file mode 100644 index 00000000..fa65683b --- /dev/null +++ b/python/src/main.hpp @@ -0,0 +1,38 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYMAIN_HPP +#define __PYMAIN_HPP + +#include +#include +#include + +#include +#include + +#include "Event.hpp" +#include "Sleep.hpp" + +#endif diff --git a/python/src/offsetof.hpp b/python/src/offsetof.hpp new file mode 100644 index 00000000..73de395a --- /dev/null +++ b/python/src/offsetof.hpp @@ -0,0 +1,32 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007, 2008 Rémi Koenig (remi.k2620@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __OFFSETOF_H +#define __OFFSETOF_H + +#undef offsetof +#define offsetof(TYPE, MEMBER) (reinterpret_cast \ + (&reinterpret_cast (static_cast (0)->MEMBER))) + +#endif diff --git a/ruby/LICENSE.txt b/ruby/LICENSE.txt new file mode 100644 index 00000000..14b9d4ee --- /dev/null +++ b/ruby/LICENSE.txt @@ -0,0 +1,41 @@ +RubySFML - Copyright (c) 2007 Sean O'Neil and Laurent Gomila + +RubySFML relies on a lot of third-party open-source software, and since it is +a library itself, I need to make sure everyone who uses it is aware of the +various licenses it comes with, as well as to give credit where credit is due. +If you distribute applications that use RubySFML, you may also be required to +give credit where credit is due. + +*** Third-party software *** +Ruby 1.8.6 - Ruby license +RubyGems 0.9.4 - Ruby license +ruby-opengl - MIT license +SFML - zlib/png license +zlib - zlib/png license +Freetype - Freetype license (BSD-style with a credit clause) +OpenAL - LGPL license +DevIL - LGPL license +libsndfile - LGPL license + +*** The RubySFML library itself (zlib/png) *** + +This software is provided 'as-is', without any express or +implied warranty. In no event will the authors be held +liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute +it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; + you must not claim that you wrote the original software. + If you use this software in a product, an acknowledgment + in the product documentation would be appreciated but + is not required. + +2. Altered source versions must be plainly marked as such, + and must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any + source distribution. + diff --git a/ruby/README-EN.txt b/ruby/README-EN.txt new file mode 100644 index 00000000..bd7a5d9e --- /dev/null +++ b/ruby/README-EN.txt @@ -0,0 +1,28 @@ +To build/run RubySFML in Windows: + +1) Install Ruby for Windows using the one-click installer. + (RubySFML can't use it until it starts being built with VS 2005, + but it needs to be installed to run the Rakefile.) + +2) Run "gem install rake" to install Ruby's version of make. + +3) Open a DOS box to this folder. + +4) Make sure all the VS2005 environment vars are set. If necessary, run: + \VC\bin\vcvars32.bat + +5) Run "rake" in this folder. The default build target will: + * Download/unpack/compile/install the ruby-1.8.6 source tarball. + * Install Ruby Gems (not strictly necessary, but everyone will want it). + * Configure/compile/install the RubySFML extension. + * Build RubySFML.zip with everything you need to distribute Windows binaries. + (At under 3.7MB, it has all the Ruby bins/libs plus all the SFML bins.) + +6) At this point you can use any of these commands to run the test program: + * test.bat + * rake test + * bin\ruby test.rb + +NOTE: This build of Ruby does not have all the extensions included in the + one-click installer. Some notable ones missing at the moment are + DBI, OpenSSL, and Expat. diff --git a/ruby/README-FR.txt b/ruby/README-FR.txt new file mode 100644 index 00000000..633ecfac --- /dev/null +++ b/ruby/README-FR.txt @@ -0,0 +1,28 @@ +Pour compiler/utiliser RubySFML sous Windows : + +1) Installez Ruby pour Windows en utilisant l'installeur "one-click" (sur le site officiel de Ruby). + (RubySFML ne peut pas l'utiliser car elle doit être recompilée avec VS 2005, + mais il doit tout de même être installé afin de pouvoir exécuter le Rakefile) + +2) Exécutez la commande "gem install rake" pour installer la version Ruby de make. + +3) Ouvrez une invite de commande DOS depuis ce répertoire + +4) Assurez-vous que les variables d'environnement pour VS 2005 sont correctement définies. Si nécessaire, exécutez le + fichier suivant : + \VC\bin\vcvars32.bat + +5) Exécutez la commande "rake" depuis ce répertoire. La compilation par défaut va : + * Télécharger / décompresser / compiler / installer Ruby 1.8.6 + * Installer Ruby Gems (pas strictement nécessaire, mais à peu près tout le monde en aura besoin) + * Configurer / compiler / installer RubySFML + * Construire RubySFML.zip avec tout ce dont vous avez besoin pour distribuer vos binaires Windows. + (Avec moins de 3.7 Mo, il contient tous les binaires et bibliothèques Ruby plus tous les binaires SFML) + +6) Maintenant, vous pouvez utiliser l'une de ces 3 commandes pour exécuter le programme de test : + * test.bat + * rake test + * bin\ruby test.rb + +NOTE : Cette compilation de Ruby ne contient pas toutes les extensions de l'installeur "one-click". + Parmi les plus importantes manquantes, on peut noter DBI, OpenSSL et Expat. diff --git a/ruby/Rakefile b/ruby/Rakefile new file mode 100644 index 00000000..bb591330 --- /dev/null +++ b/ruby/Rakefile @@ -0,0 +1,167 @@ +# Rake doc: http://rake.rubyforge.org/files/doc/rakefile_rdoc.html +require 'rake' +require 'net/ftp' +require 'net/http' +require 'uri' +include Rake + +ENV["RUBYOPT"] = nil +EXTENSION = "RubySFML" +RUBY_VER = "ruby-1.8.6-p111" +GEMS_VER = "rubygems-0.9.4" +ROOT_DIR = Dir.pwd +RUBY_DIR = "#{ROOT_DIR}/#{RUBY_VER}" +GEMS_DIR = "#{ROOT_DIR}/#{GEMS_VER}" +EXTENSION_DIR = "#{ROOT_DIR}/#{EXTENSION}" +RUBY_URL = "ftp://ftp.ruby-lang.org/pub/ruby/1.8/#{RUBY_VER}.tar.gz" + +# These are needed to build Ruby's zlib extension +raise "You forgot to run vcvars32.bat!" unless ENV['INCLUDE'] and ENV['LIB'] +ENV['INCLUDE'] += ";#{ROOT_DIR}/../extlibs/headers;#{ROOT_DIR}/zlib" +ENV['LIB'] += ";#{ROOT_DIR}/../extlibs/libs-vc2005;#{ROOT_DIR}/zlib" + +# Need this for the Unix utils, like gzip.exe and tar.exe, to run +ENV['PATH'] += ";#{ROOT_DIR}" + + +desc "Deletes all compiled and installed Ruby files for a clean rebuild" +task :cleanRuby do |t| + rm_r "bin" rescue nil + rm_r "lib" rescue nil + rm_r "man" rescue nil + rm_r RUBY_DIR rescue nil + rm_r GEMS_DIR rescue nil + rm "#{RUBY_VER}.tar" rescue nil + rm "#{RUBY_VER}.tar.gz" rescue nil +end + +desc "Gets the Ruby source code from the FTP server" +task :getRuby do |t| + tar = "#{RUBY_VER}.tar" + tgz = "#{tar}.gz" + unless File.exists?(tar) or File.exists?(tgz) + puts "Downloading #{RUBY_URL}. Please wait..." + Net::FTP.open("ftp.ruby-lang.org") do |ftp| + ftp.login + files = ftp.chdir("pub/ruby/1.8") + ftp.getbinaryfile(tgz, tgz) + end + end +end + +desc "Unpacks the Ruby source tarball" +task :unpackRuby => [:getRuby] do |t| + unless File.exists?(RUBY_DIR) + tar = "#{RUBY_VER}.tar" + tgz = "#{tar}.gz" + sh "gzip", "-d", tgz if File.exists?(tgz) + sh "tar", "-xvf", tar + end + + unless File.exists?(GEMS_DIR) + sh "unzip", "#{GEMS_VER}.zip" + end +end + +desc "Builds ruby.exe from the source code" +task :buildRuby => [:unpackRuby] do |t| + unless File.exists? "#{RUBY_DIR}/ruby.exe" + Dir.chdir RUBY_DIR + sh "win32\\configure.bat", "--target=i686-mswin32" + sh "nmake" + Dir.chdir ROOT_DIR + end +end + +desc "Installs #{RUBY_VER} and copies the extlibs into the bin folder" +task :installRuby => [:buildRuby] do |t| + unless File.exists? "#{ROOT_DIR}/bin/ruby.exe" + Dir.chdir RUBY_DIR + sh "nmake", "DESTDIR=\"#{ROOT_DIR}\"", "install" + Dir.chdir ROOT_DIR + end + + unless File.exists? "bin/zlib1.dll" + cp Dir["../extlibs/bin/*.dll"], "bin" + cp Dir["zlib/*.dll"], "bin" + cp "#{RUBY_DIR}/.ext/i386-mswin32_80/zlib.so", "lib/ruby/1.8/i386-mswin32" + end + + unless File.exists? "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/rubygems.rb" + Dir.chdir GEMS_DIR + sh "../bin/ruby.exe", "setup.rb" + rm_r "#{ROOT_DIR}/lib/ruby/gems/1.8/doc/rubygems-0.9.4" rescue nil + Dir.chdir ROOT_DIR + end +end + +desc "Deletes all compiled and installed RubySFML files for a clean rebuild" +task :cleanExtension do |t| + dirs = [EXTENSION_DIR, "#{ROOT_DIR}/RubyOpenGL/gl", "#{ROOT_DIR}/RubyOpenGL/glu"] + dirs.each {|d| + rm Dir["#{d}/*.so"] + rm Dir["#{d}/*.def"] + rm Dir["#{d}/*.pdb"] + rm Dir["#{d}/*.lib"] + rm Dir["#{d}/*.exp"] + rm Dir["#{d}/*.log"] + rm Dir["#{d}/*.obj"] + rm "#{d}/Makefile" rescue nil + } + rm "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80/RubySFML.so" rescue nil + rm "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80/gl.so" rescue nil + rm "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80/glu.so" rescue nil +end + +desc "Builds the SFMLRuby extension" +task :buildExtension => [:installRuby] do |t| + unless File.exists? "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80/gl.so" and File.exists? "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80/glu.so" + Dir.chdir "#{ROOT_DIR}/RubyOpenGL/gl" + sh "../../bin/ruby.exe", "extconf.rb" + sh "nmake" + cp "gl.so", "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80" + Dir.chdir "#{ROOT_DIR}/RubyOpenGL/glu" + sh "../../bin/ruby.exe", "extconf.rb" + sh "nmake" + cp "glu.so", "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80" + Dir.chdir ROOT_DIR + end + + inc = "../../include" + lib = "../../lib/vc2005" + ext = "#{EXTENSION_DIR}/RubySFML.so" + File.delete(ext) unless uptodate?(ext, Dir["../lib/vc2005/*.lib"]) rescue nil + + Dir.chdir EXTENSION_DIR + sh "../bin/ruby.exe", "extconf-win.rb", "--with-SFML-include=#{inc}", "--with-SFML-lib=#{lib}" + sh "nmake" + cp "RubySFML.so", "#{ROOT_DIR}/lib/ruby/site_ruby/1.8/i386-msvcr80" + cp "RubySFML.rb", "#{ROOT_DIR}/lib/ruby/site_ruby/1.8" + Dir.chdir ROOT_DIR +end + +desc "Builds everything and runs test.rb" +task :test => [:buildExtension] do |t| + Dir.chdir "#{ROOT_DIR}/test" + sh "../bin/ruby.exe", "test.rb" + Dir.chdir ROOT_DIR +end + +desc "Zips up the compiled binaries for distribution" +task :package => [:buildExtension] do |t| + sh "zip", "-r", "RubySFML.zip", "LICENSE.txt", "bin", "doc", "lib", "test" +end + +desc "Deletes all files generated by this build" +task :clean => [:cleanExtension, :cleanRuby] do |t| + rm "RubySFML.zip" rescue nil +end + +desc "Deletes and rebuilds everything" +task :rebuild => [:clean, :package] do |t| + rm "RubySFML.zip" rescue nil +end + +desc "(Same as 'rake package')" +task :default => [:package] + diff --git a/ruby/RubyOpenGL/common/common.h b/ruby/RubyOpenGL/common/common.h new file mode 100644 index 00000000..dcd279fd --- /dev/null +++ b/ruby/RubyOpenGL/common/common.h @@ -0,0 +1,333 @@ +/* + * Last edit by previous maintainer: + * 2000/01/06 16:37:43, kusano + * + * Copyright (C) 1999 - 2005 Yoshi + * Copyright (C) 2006 John M. Gabriele + * Copyright (C) 2007 James Adam + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _RBOGL_H_ +#define _RBOGL_H_ + +#include + +#ifdef __APPLE__ +#include +#include +#include +#include +#elif defined WIN32 +#include +#include +#else +#include +#include +#endif + +#include "gl-enums.h" + +#ifdef __APPLE__ +#ifndef APIENTRY +#define APIENTRY /* to nothing */ +#endif +#endif + +typedef struct RArray RArray; + +extern VALUE cProc; + +#define LOAD_GL_FUNC(_NAME_) \ +if (fptr_##_NAME_==NULL) \ +fptr_##_NAME_ = load_gl_function(#_NAME_, 1); + +#define FORCE_PIXEL_STORE_MODE \ + glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); \ + glPixelStorei(GL_PACK_ALIGNMENT, 1); \ + glPixelStorei(GL_PACK_SKIP_PIXELS, 0); \ + glPixelStorei(GL_PACK_SKIP_ROWS, 0); \ + glPixelStorei(GL_PACK_ROW_LENGTH, 0); \ + glPixelStorei(GL_PACK_SKIP_IMAGES, 0); \ + glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0); +/* glPixelStorei(GL_PACK_SKIP_VOLUMES_SGIS, 0); + glPixelStorei(GL_PACK_IMAGE_DEPTH_SGIS, 0); */ + +#define RESTORE_PIXEL_STORE_MODE \ + glPopClientAttrib(); + + +/* -------------------------------------------------------------------- */ +#ifndef NUM2DBL +#define NUM2DBL(_val) num2double(_val) + +static inline double num2double( VALUE val ) +{ + struct RFloat* flt; + if (NIL_P(val)) return 0; + flt = RFLOAT(f_float(0, val)); + return flt->value; +} +#endif + +/* -------------------------------------------------------------------- */ +#define ARY2INTEGRAL(_type_,_convert_) \ +static inline int ary2c##_type_( arg, cary, maxlen ) \ +VALUE arg; \ +GL##_type_ cary[]; \ +int maxlen; \ +{ \ + int i; \ + struct RArray* ary; \ + VALUE entry; \ + ary = RARRAY(rb_Array(arg)); \ + if (maxlen < 1) \ + maxlen = ary->len; \ + else \ + maxlen = maxlen < ary->len ? maxlen : ary->len; \ + for (i=0; i < maxlen; i++) \ + { \ + entry = rb_ary_entry((VALUE)ary,i); \ + cary[i] = (GL##_type_)_convert_(entry); \ + } \ + return i; \ +} + +ARY2INTEGRAL(int,NUM2INT) +ARY2INTEGRAL(uint,NUM2UINT) +ARY2INTEGRAL(byte,NUM2INT) +ARY2INTEGRAL(ubyte,NUM2INT) +ARY2INTEGRAL(short,NUM2INT) +ARY2INTEGRAL(ushort,NUM2INT) +ARY2INTEGRAL(boolean,NUM2INT) +#undef ARY2INTEGRAL + +/* -------------------------------------------------------------------- */ +static inline int ary2cflt(arg, cary, maxlen) +VALUE arg; +float cary[]; +int maxlen; +{ + int i; + struct RArray* ary; + ary = RARRAY(rb_Array(arg)); + if (maxlen < 1) + maxlen = ary->len; + else + maxlen = maxlen < ary->len ? maxlen : ary->len; + for (i=0; i < maxlen; i++) + cary[i] = (float)NUM2DBL(rb_ary_entry((VALUE)ary,i)); + return i; +} + +/* -------------------------------------------------------------------- */ +static inline int ary2cdbl(arg, cary, maxlen) +VALUE arg; +double cary[]; +int maxlen; +{ + int i; + struct RArray* ary; + ary = RARRAY(rb_Array(arg)); + if (maxlen < 1) + maxlen = ary->len; + else + maxlen = maxlen < ary->len ? maxlen : ary->len; + for (i=0; i < maxlen; i++) + cary[i] = NUM2DBL(rb_ary_entry((VALUE)ary,i)); + return i; +} + +/* -------------------------------------------------------------------- */ +static inline void mary2ary(src, ary) +VALUE src; +VALUE ary; +{ + struct RArray* tmp_ary; + int i; + tmp_ary = RARRAY(rb_Array(src)); + for (i = 0; i < tmp_ary->len; i++) + { + if (TYPE(tmp_ary->ptr[i]) == T_ARRAY) + mary2ary((VALUE)tmp_ary->ptr[i], ary); + else + rb_ary_push(ary, tmp_ary->ptr[i]); + } +} + +/* -------------------------------------------------------------------- */ +static inline void ary2cmat4x4dbl(ary, cary) +VALUE ary; +double cary[]; +{ + int i,j; + RArray *ary_r,*ary_c; + memset(cary, 0x0, sizeof(double[4*4])); + ary_c = RARRAY(rb_Array(ary)); + if (TYPE(ary_c->ptr[0]) != T_ARRAY) + ary2cdbl((VALUE)ary_c, cary, 16); + else + { + for (i = 0; i < ary_c->len && i < 4; i++) + { + ary_r = RARRAY(rb_Array(ary_c->ptr[i])); + for(j = 0; j < ary_r->len && j < 4; j++) + cary[i*4+j] = (GLdouble)NUM2DBL(ary_r->ptr[j]); + } + } +} + +static inline void ary2cmat4x4flt(ary, cary) +VALUE ary; +float cary[]; +{ + int i,j; + RArray *ary_r,*ary_c; + memset(cary, 0x0, sizeof(float[4*4])); + ary_c = RARRAY(rb_Array(ary)); + if (TYPE(ary_c->ptr[0]) != T_ARRAY) + ary2cflt((VALUE)ary_c, cary, 16); + else + { + for (i = 0; i < ary_c->len && i < 4; i++) + { + ary_r = RARRAY(rb_Array(ary_c->ptr[i])); + for(j = 0; j < ary_r->len && j < 4; j++) + cary[i*4+j] = (GLfloat)NUM2DBL(ary_r->ptr[j]); + } + } +} + +/* -------------------------------------------------------------------- */ +/*Need to find proper size for glReadPixels array*/ +static inline int glformat_size(GLenum format) +{ + switch(format) + { + case GL_COLOR_INDEX: + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + case GL_LUMINANCE: + return 1; + + case GL_LUMINANCE_ALPHA: + return 2; + + case GL_RGB: + case GL_BGR_EXT: + return 3; + + case GL_RGBA: + case GL_BGRA_EXT: + case GL_ABGR_EXT: + return 4; + case 1: + case 2: + case 3: + case 4: + return format; + default: + return -1; + } +} + +/* -------------------------------------------------------------------- */ +static inline int gltype_size(GLenum type) +{ + switch(type) + { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + return 1; + + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + return 2; + + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return 4; + + case GL_BITMAP: + return 0; + + default: + return -1; + } +} + +/* -------------------------------------------------------------------- */ +static inline VALUE allocate_buffer_with_string( int size ) +{ + return rb_str_new(NULL, size); +} + +/* -------------------------------------------------------------------- */ +static inline void *load_gl_function(const char *name,int raise) +{ + void *func_ptr = NULL; + +#if defined(__APPLE__) + static const struct mach_header* library = NULL; + char* symbolName; + NSSymbol symbol; + if (library == NULL) + library = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL",NSADDIMAGE_OPTION_RETURN_ON_ERROR); + + if (library == NULL) + rb_raise(rb_eRuntimeError,"Can't load OpenGL library for dynamic loading"); + + /* prepend a '_' for the Unix C symbol mangling convention */ + symbolName = ALLOC_N(char,strlen(name) + 2); + symbolName[0] = '_'; + strcpy(symbolName+1, name); + + symbol = NSLookupSymbolInImage(library,symbolName,NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + xfree(symbolName); + + if (symbol == NULL) + func_ptr = NULL; + else + func_ptr = NSAddressOfSymbol(symbol); +#elif defined(WIN32) || defined(_WIN32) + func_ptr = wglGetProcAddress((LPCSTR)name); +#elif defined(GLX_VERSION_1_4) + func_ptr = glXGetProcAddress((const GLubyte *)name); +#else + func_ptr = glXGetProcAddressARB((const GLubyte *)name); +#endif + + if (func_ptr == NULL && raise == 1) + rb_raise(rb_eNotImpError,"Function %s is not available at this machine",name); + + return func_ptr; +} + +#endif /* _RBOGL_H_ */ diff --git a/ruby/RubyOpenGL/common/gl-enums.h b/ruby/RubyOpenGL/common/gl-enums.h new file mode 100644 index 00000000..678e666c --- /dev/null +++ b/ruby/RubyOpenGL/common/gl-enums.h @@ -0,0 +1,10387 @@ +/* GL types - define if system GLheaders are not recent */ + +/* GL base */ +#ifndef GL_VERSION_1_5 +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_VERSION_2_0 +typedef char GLchar; +#endif + +/* new GL types introduced by ARB extensions */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_ARB_shader_objects +typedef char GLcharARB; +typedef unsigned int GLhandleARB; +#endif + +#ifndef GL_ARB_vertex_buffer_object +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +/* new GL types introduced by other extensions */ +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +/* List of GL enumerators */ + +/* The code below was genereated on Sun Feb 11 01:24:24 +0100 2007 + source: http://www.opengl.org/registry/api/enum.spec + http://www.opengl.org/registry/api/enumext.spec +*/ + +#ifndef _GLENUMS_H_ +#define _GLENUMS_H_ + +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 +#endif +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#endif +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#endif +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#endif +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#endif +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 +#endif +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#endif +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#endif +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#endif +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#endif +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#endif +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#endif +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#endif +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#endif +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#endif +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#endif +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#endif +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#endif +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#endif +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#endif +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#endif +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#endif +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#endif +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#endif +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif +#ifndef GL_SGIS_texture_select +#define GL_SGIS_texture_select 1 +#endif +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#endif +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#endif +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#endif +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#endif +#ifndef GL_SGIX_icc_texture +#define GL_SGIX_icc_texture 1 +#endif +#ifndef GL_SGIX_impact_pixel_texture +#define GL_SGIX_impact_pixel_texture 1 +#endif +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#endif +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#endif +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#endif +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#endif +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#endif +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#endif +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#endif +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 +#endif +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#endif +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif +#ifndef GL_CURRENT_BIT +#define GL_CURRENT_BIT 0x00000001 +#endif +#ifndef GL_POINT_BIT +#define GL_POINT_BIT 0x00000002 +#endif +#ifndef GL_LINE_BIT +#define GL_LINE_BIT 0x00000004 +#endif +#ifndef GL_POLYGON_BIT +#define GL_POLYGON_BIT 0x00000008 +#endif +#ifndef GL_POLYGON_STIPPLE_BIT +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#endif +#ifndef GL_PIXEL_MODE_BIT +#define GL_PIXEL_MODE_BIT 0x00000020 +#endif +#ifndef GL_LIGHTING_BIT +#define GL_LIGHTING_BIT 0x00000040 +#endif +#ifndef GL_FOG_BIT +#define GL_FOG_BIT 0x00000080 +#endif +#ifndef GL_DEPTH_BUFFER_BIT +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#endif +#ifndef GL_ACCUM_BUFFER_BIT +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#endif +#ifndef GL_STENCIL_BUFFER_BIT +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#endif +#ifndef GL_VIEWPORT_BIT +#define GL_VIEWPORT_BIT 0x00000800 +#endif +#ifndef GL_TRANSFORM_BIT +#define GL_TRANSFORM_BIT 0x00001000 +#endif +#ifndef GL_ENABLE_BIT +#define GL_ENABLE_BIT 0x00002000 +#endif +#ifndef GL_COLOR_BUFFER_BIT +#define GL_COLOR_BUFFER_BIT 0x00004000 +#endif +#ifndef GL_HINT_BIT +#define GL_HINT_BIT 0x00008000 +#endif +#ifndef GL_EVAL_BIT +#define GL_EVAL_BIT 0x00010000 +#endif +#ifndef GL_LIST_BIT +#define GL_LIST_BIT 0x00020000 +#endif +#ifndef GL_TEXTURE_BIT +#define GL_TEXTURE_BIT 0x00040000 +#endif +#ifndef GL_SCISSOR_BIT +#define GL_SCISSOR_BIT 0x00080000 +#endif +#ifndef GL_ALL_ATTRIB_BITS +#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF +#endif +#ifndef GL_CLIENT_PIXEL_STORE_BIT +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#endif +#ifndef GL_CLIENT_VERTEX_ARRAY_BIT +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#endif +#ifndef GL_CLIENT_ALL_ATTRIB_BITS +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#endif +#ifndef GL_FALSE +#define GL_FALSE 0 +#endif +#ifndef GL_TRUE +#define GL_TRUE 1 +#endif +#ifndef GL_POINTS +#define GL_POINTS 0x0000 +#endif +#ifndef GL_LINES +#define GL_LINES 0x0001 +#endif +#ifndef GL_LINE_LOOP +#define GL_LINE_LOOP 0x0002 +#endif +#ifndef GL_LINE_STRIP +#define GL_LINE_STRIP 0x0003 +#endif +#ifndef GL_TRIANGLES +#define GL_TRIANGLES 0x0004 +#endif +#ifndef GL_TRIANGLE_STRIP +#define GL_TRIANGLE_STRIP 0x0005 +#endif +#ifndef GL_TRIANGLE_FAN +#define GL_TRIANGLE_FAN 0x0006 +#endif +#ifndef GL_QUADS +#define GL_QUADS 0x0007 +#endif +#ifndef GL_QUAD_STRIP +#define GL_QUAD_STRIP 0x0008 +#endif +#ifndef GL_POLYGON +#define GL_POLYGON 0x0009 +#endif +#ifndef GL_ACCUM +#define GL_ACCUM 0x0100 +#endif +#ifndef GL_LOAD +#define GL_LOAD 0x0101 +#endif +#ifndef GL_RETURN +#define GL_RETURN 0x0102 +#endif +#ifndef GL_MULT +#define GL_MULT 0x0103 +#endif +#ifndef GL_ADD +#define GL_ADD 0x0104 +#endif +#ifndef GL_NEVER +#define GL_NEVER 0x0200 +#endif +#ifndef GL_LESS +#define GL_LESS 0x0201 +#endif +#ifndef GL_EQUAL +#define GL_EQUAL 0x0202 +#endif +#ifndef GL_LEQUAL +#define GL_LEQUAL 0x0203 +#endif +#ifndef GL_GREATER +#define GL_GREATER 0x0204 +#endif +#ifndef GL_NOTEQUAL +#define GL_NOTEQUAL 0x0205 +#endif +#ifndef GL_GEQUAL +#define GL_GEQUAL 0x0206 +#endif +#ifndef GL_ALWAYS +#define GL_ALWAYS 0x0207 +#endif +#ifndef GL_ZERO +#define GL_ZERO 0 +#endif +#ifndef GL_ONE +#define GL_ONE 1 +#endif +#ifndef GL_SRC_COLOR +#define GL_SRC_COLOR 0x0300 +#endif +#ifndef GL_ONE_MINUS_SRC_COLOR +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#endif +#ifndef GL_SRC_ALPHA +#define GL_SRC_ALPHA 0x0302 +#endif +#ifndef GL_ONE_MINUS_SRC_ALPHA +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#endif +#ifndef GL_DST_ALPHA +#define GL_DST_ALPHA 0x0304 +#endif +#ifndef GL_ONE_MINUS_DST_ALPHA +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#endif +#ifndef GL_DST_COLOR +#define GL_DST_COLOR 0x0306 +#endif +#ifndef GL_ONE_MINUS_DST_COLOR +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#endif +#ifndef GL_SRC_ALPHA_SATURATE +#define GL_SRC_ALPHA_SATURATE 0x0308 +#endif +#ifndef GL_NONE +#define GL_NONE 0 +#endif +#ifndef GL_FRONT_LEFT +#define GL_FRONT_LEFT 0x0400 +#endif +#ifndef GL_FRONT_RIGHT +#define GL_FRONT_RIGHT 0x0401 +#endif +#ifndef GL_BACK_LEFT +#define GL_BACK_LEFT 0x0402 +#endif +#ifndef GL_BACK_RIGHT +#define GL_BACK_RIGHT 0x0403 +#endif +#ifndef GL_FRONT +#define GL_FRONT 0x0404 +#endif +#ifndef GL_BACK +#define GL_BACK 0x0405 +#endif +#ifndef GL_LEFT +#define GL_LEFT 0x0406 +#endif +#ifndef GL_RIGHT +#define GL_RIGHT 0x0407 +#endif +#ifndef GL_FRONT_AND_BACK +#define GL_FRONT_AND_BACK 0x0408 +#endif +#ifndef GL_AUX0 +#define GL_AUX0 0x0409 +#endif +#ifndef GL_AUX1 +#define GL_AUX1 0x040A +#endif +#ifndef GL_AUX2 +#define GL_AUX2 0x040B +#endif +#ifndef GL_AUX3 +#define GL_AUX3 0x040C +#endif +#ifndef GL_NO_ERROR +#define GL_NO_ERROR 0 +#endif +#ifndef GL_INVALID_ENUM +#define GL_INVALID_ENUM 0x0500 +#endif +#ifndef GL_INVALID_VALUE +#define GL_INVALID_VALUE 0x0501 +#endif +#ifndef GL_INVALID_OPERATION +#define GL_INVALID_OPERATION 0x0502 +#endif +#ifndef GL_STACK_OVERFLOW +#define GL_STACK_OVERFLOW 0x0503 +#endif +#ifndef GL_STACK_UNDERFLOW +#define GL_STACK_UNDERFLOW 0x0504 +#endif +#ifndef GL_OUT_OF_MEMORY +#define GL_OUT_OF_MEMORY 0x0505 +#endif +#ifndef GL_2D +#define GL_2D 0x0600 +#endif +#ifndef GL_3D +#define GL_3D 0x0601 +#endif +#ifndef GL_3D_COLOR +#define GL_3D_COLOR 0x0602 +#endif +#ifndef GL_3D_COLOR_TEXTURE +#define GL_3D_COLOR_TEXTURE 0x0603 +#endif +#ifndef GL_4D_COLOR_TEXTURE +#define GL_4D_COLOR_TEXTURE 0x0604 +#endif +#ifndef GL_PASS_THROUGH_TOKEN +#define GL_PASS_THROUGH_TOKEN 0x0700 +#endif +#ifndef GL_POINT_TOKEN +#define GL_POINT_TOKEN 0x0701 +#endif +#ifndef GL_LINE_TOKEN +#define GL_LINE_TOKEN 0x0702 +#endif +#ifndef GL_POLYGON_TOKEN +#define GL_POLYGON_TOKEN 0x0703 +#endif +#ifndef GL_BITMAP_TOKEN +#define GL_BITMAP_TOKEN 0x0704 +#endif +#ifndef GL_DRAW_PIXEL_TOKEN +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#endif +#ifndef GL_COPY_PIXEL_TOKEN +#define GL_COPY_PIXEL_TOKEN 0x0706 +#endif +#ifndef GL_LINE_RESET_TOKEN +#define GL_LINE_RESET_TOKEN 0x0707 +#endif +#ifndef GL_TEXTURE_DEFORMATION_BIT_SGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#endif +#ifndef GL_GEOMETRY_DEFORMATION_BIT_SGIX +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif +#ifndef GL_EXP +#define GL_EXP 0x0800 +#endif +#ifndef GL_EXP2 +#define GL_EXP2 0x0801 +#endif +#ifndef GL_CW +#define GL_CW 0x0900 +#endif +#ifndef GL_CCW +#define GL_CCW 0x0901 +#endif +#ifndef GL_COEFF +#define GL_COEFF 0x0A00 +#endif +#ifndef GL_ORDER +#define GL_ORDER 0x0A01 +#endif +#ifndef GL_DOMAIN +#define GL_DOMAIN 0x0A02 +#endif +#ifndef GL_PIXEL_MAP_I_TO_I +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#endif +#ifndef GL_PIXEL_MAP_S_TO_S +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#endif +#ifndef GL_PIXEL_MAP_I_TO_R +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#endif +#ifndef GL_PIXEL_MAP_I_TO_G +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#endif +#ifndef GL_PIXEL_MAP_I_TO_B +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#endif +#ifndef GL_PIXEL_MAP_I_TO_A +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#endif +#ifndef GL_PIXEL_MAP_R_TO_R +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#endif +#ifndef GL_PIXEL_MAP_G_TO_G +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#endif +#ifndef GL_PIXEL_MAP_B_TO_B +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#endif +#ifndef GL_PIXEL_MAP_A_TO_A +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#endif +#ifndef GL_VERTEX_ARRAY_POINTER +#define GL_VERTEX_ARRAY_POINTER 0x808E +#endif +#ifndef GL_NORMAL_ARRAY_POINTER +#define GL_NORMAL_ARRAY_POINTER 0x808F +#endif +#ifndef GL_COLOR_ARRAY_POINTER +#define GL_COLOR_ARRAY_POINTER 0x8090 +#endif +#ifndef GL_INDEX_ARRAY_POINTER +#define GL_INDEX_ARRAY_POINTER 0x8091 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_POINTER +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_POINTER +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#endif +#ifndef GL_FEEDBACK_BUFFER_POINTER +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#endif +#ifndef GL_SELECTION_BUFFER_POINTER +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#endif +#ifndef GL_CURRENT_COLOR +#define GL_CURRENT_COLOR 0x0B00 +#endif +#ifndef GL_CURRENT_INDEX +#define GL_CURRENT_INDEX 0x0B01 +#endif +#ifndef GL_CURRENT_NORMAL +#define GL_CURRENT_NORMAL 0x0B02 +#endif +#ifndef GL_CURRENT_TEXTURE_COORDS +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#endif +#ifndef GL_CURRENT_RASTER_COLOR +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#endif +#ifndef GL_CURRENT_RASTER_INDEX +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#endif +#ifndef GL_CURRENT_RASTER_TEXTURE_COORDS +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#endif +#ifndef GL_CURRENT_RASTER_POSITION +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#endif +#ifndef GL_CURRENT_RASTER_POSITION_VALID +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#endif +#ifndef GL_CURRENT_RASTER_DISTANCE +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#endif +#ifndef GL_POINT_SMOOTH +#define GL_POINT_SMOOTH 0x0B10 +#endif +#ifndef GL_POINT_SIZE +#define GL_POINT_SIZE 0x0B11 +#endif +#ifndef GL_POINT_SIZE_RANGE +#define GL_POINT_SIZE_RANGE 0x0B12 +#endif +#ifndef GL_POINT_SIZE_GRANULARITY +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#endif +#ifndef GL_LINE_SMOOTH +#define GL_LINE_SMOOTH 0x0B20 +#endif +#ifndef GL_LINE_WIDTH +#define GL_LINE_WIDTH 0x0B21 +#endif +#ifndef GL_LINE_WIDTH_RANGE +#define GL_LINE_WIDTH_RANGE 0x0B22 +#endif +#ifndef GL_LINE_WIDTH_GRANULARITY +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#endif +#ifndef GL_LINE_STIPPLE +#define GL_LINE_STIPPLE 0x0B24 +#endif +#ifndef GL_LINE_STIPPLE_PATTERN +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#endif +#ifndef GL_LINE_STIPPLE_REPEAT +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#endif +#ifndef GL_LIST_MODE +#define GL_LIST_MODE 0x0B30 +#endif +#ifndef GL_MAX_LIST_NESTING +#define GL_MAX_LIST_NESTING 0x0B31 +#endif +#ifndef GL_LIST_BASE +#define GL_LIST_BASE 0x0B32 +#endif +#ifndef GL_LIST_INDEX +#define GL_LIST_INDEX 0x0B33 +#endif +#ifndef GL_POLYGON_MODE +#define GL_POLYGON_MODE 0x0B40 +#endif +#ifndef GL_POLYGON_SMOOTH +#define GL_POLYGON_SMOOTH 0x0B41 +#endif +#ifndef GL_POLYGON_STIPPLE +#define GL_POLYGON_STIPPLE 0x0B42 +#endif +#ifndef GL_EDGE_FLAG +#define GL_EDGE_FLAG 0x0B43 +#endif +#ifndef GL_CULL_FACE +#define GL_CULL_FACE 0x0B44 +#endif +#ifndef GL_CULL_FACE_MODE +#define GL_CULL_FACE_MODE 0x0B45 +#endif +#ifndef GL_FRONT_FACE +#define GL_FRONT_FACE 0x0B46 +#endif +#ifndef GL_LIGHTING +#define GL_LIGHTING 0x0B50 +#endif +#ifndef GL_LIGHT_MODEL_LOCAL_VIEWER +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#endif +#ifndef GL_LIGHT_MODEL_TWO_SIDE +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#endif +#ifndef GL_LIGHT_MODEL_AMBIENT +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#endif +#ifndef GL_SHADE_MODEL +#define GL_SHADE_MODEL 0x0B54 +#endif +#ifndef GL_COLOR_MATERIAL_FACE +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#endif +#ifndef GL_COLOR_MATERIAL_PARAMETER +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#endif +#ifndef GL_COLOR_MATERIAL +#define GL_COLOR_MATERIAL 0x0B57 +#endif +#ifndef GL_FOG +#define GL_FOG 0x0B60 +#endif +#ifndef GL_FOG_INDEX +#define GL_FOG_INDEX 0x0B61 +#endif +#ifndef GL_FOG_DENSITY +#define GL_FOG_DENSITY 0x0B62 +#endif +#ifndef GL_FOG_START +#define GL_FOG_START 0x0B63 +#endif +#ifndef GL_FOG_END +#define GL_FOG_END 0x0B64 +#endif +#ifndef GL_FOG_MODE +#define GL_FOG_MODE 0x0B65 +#endif +#ifndef GL_FOG_COLOR +#define GL_FOG_COLOR 0x0B66 +#endif +#ifndef GL_DEPTH_RANGE +#define GL_DEPTH_RANGE 0x0B70 +#endif +#ifndef GL_DEPTH_TEST +#define GL_DEPTH_TEST 0x0B71 +#endif +#ifndef GL_DEPTH_WRITEMASK +#define GL_DEPTH_WRITEMASK 0x0B72 +#endif +#ifndef GL_DEPTH_CLEAR_VALUE +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#endif +#ifndef GL_DEPTH_FUNC +#define GL_DEPTH_FUNC 0x0B74 +#endif +#ifndef GL_ACCUM_CLEAR_VALUE +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#endif +#ifndef GL_STENCIL_TEST +#define GL_STENCIL_TEST 0x0B90 +#endif +#ifndef GL_STENCIL_CLEAR_VALUE +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#endif +#ifndef GL_STENCIL_FUNC +#define GL_STENCIL_FUNC 0x0B92 +#endif +#ifndef GL_STENCIL_VALUE_MASK +#define GL_STENCIL_VALUE_MASK 0x0B93 +#endif +#ifndef GL_STENCIL_FAIL +#define GL_STENCIL_FAIL 0x0B94 +#endif +#ifndef GL_STENCIL_PASS_DEPTH_FAIL +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#endif +#ifndef GL_STENCIL_PASS_DEPTH_PASS +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#endif +#ifndef GL_STENCIL_REF +#define GL_STENCIL_REF 0x0B97 +#endif +#ifndef GL_STENCIL_WRITEMASK +#define GL_STENCIL_WRITEMASK 0x0B98 +#endif +#ifndef GL_MATRIX_MODE +#define GL_MATRIX_MODE 0x0BA0 +#endif +#ifndef GL_NORMALIZE +#define GL_NORMALIZE 0x0BA1 +#endif +#ifndef GL_VIEWPORT +#define GL_VIEWPORT 0x0BA2 +#endif +#ifndef GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#endif +#ifndef GL_PROJECTION_STACK_DEPTH +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#endif +#ifndef GL_TEXTURE_STACK_DEPTH +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#endif +#ifndef GL_MODELVIEW_MATRIX +#define GL_MODELVIEW_MATRIX 0x0BA6 +#endif +#ifndef GL_PROJECTION_MATRIX +#define GL_PROJECTION_MATRIX 0x0BA7 +#endif +#ifndef GL_TEXTURE_MATRIX +#define GL_TEXTURE_MATRIX 0x0BA8 +#endif +#ifndef GL_ATTRIB_STACK_DEPTH +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#endif +#ifndef GL_CLIENT_ATTRIB_STACK_DEPTH +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#endif +#ifndef GL_ALPHA_TEST +#define GL_ALPHA_TEST 0x0BC0 +#endif +#ifndef GL_ALPHA_TEST_FUNC +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#endif +#ifndef GL_ALPHA_TEST_REF +#define GL_ALPHA_TEST_REF 0x0BC2 +#endif +#ifndef GL_DITHER +#define GL_DITHER 0x0BD0 +#endif +#ifndef GL_BLEND_DST +#define GL_BLEND_DST 0x0BE0 +#endif +#ifndef GL_BLEND_SRC +#define GL_BLEND_SRC 0x0BE1 +#endif +#ifndef GL_BLEND +#define GL_BLEND 0x0BE2 +#endif +#ifndef GL_LOGIC_OP_MODE +#define GL_LOGIC_OP_MODE 0x0BF0 +#endif +#ifndef GL_INDEX_LOGIC_OP +#define GL_INDEX_LOGIC_OP 0x0BF1 +#endif +#ifndef GL_LOGIC_OP +#define GL_LOGIC_OP 0x0BF1 +#endif +#ifndef GL_COLOR_LOGIC_OP +#define GL_COLOR_LOGIC_OP 0x0BF2 +#endif +#ifndef GL_AUX_BUFFERS +#define GL_AUX_BUFFERS 0x0C00 +#endif +#ifndef GL_DRAW_BUFFER +#define GL_DRAW_BUFFER 0x0C01 +#endif +#ifndef GL_READ_BUFFER +#define GL_READ_BUFFER 0x0C02 +#endif +#ifndef GL_SCISSOR_BOX +#define GL_SCISSOR_BOX 0x0C10 +#endif +#ifndef GL_SCISSOR_TEST +#define GL_SCISSOR_TEST 0x0C11 +#endif +#ifndef GL_INDEX_CLEAR_VALUE +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#endif +#ifndef GL_INDEX_WRITEMASK +#define GL_INDEX_WRITEMASK 0x0C21 +#endif +#ifndef GL_COLOR_CLEAR_VALUE +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#endif +#ifndef GL_COLOR_WRITEMASK +#define GL_COLOR_WRITEMASK 0x0C23 +#endif +#ifndef GL_INDEX_MODE +#define GL_INDEX_MODE 0x0C30 +#endif +#ifndef GL_RGBA_MODE +#define GL_RGBA_MODE 0x0C31 +#endif +#ifndef GL_DOUBLEBUFFER +#define GL_DOUBLEBUFFER 0x0C32 +#endif +#ifndef GL_STEREO +#define GL_STEREO 0x0C33 +#endif +#ifndef GL_RENDER_MODE +#define GL_RENDER_MODE 0x0C40 +#endif +#ifndef GL_PERSPECTIVE_CORRECTION_HINT +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#endif +#ifndef GL_POINT_SMOOTH_HINT +#define GL_POINT_SMOOTH_HINT 0x0C51 +#endif +#ifndef GL_LINE_SMOOTH_HINT +#define GL_LINE_SMOOTH_HINT 0x0C52 +#endif +#ifndef GL_POLYGON_SMOOTH_HINT +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#endif +#ifndef GL_FOG_HINT +#define GL_FOG_HINT 0x0C54 +#endif +#ifndef GL_TEXTURE_GEN_S +#define GL_TEXTURE_GEN_S 0x0C60 +#endif +#ifndef GL_TEXTURE_GEN_T +#define GL_TEXTURE_GEN_T 0x0C61 +#endif +#ifndef GL_TEXTURE_GEN_R +#define GL_TEXTURE_GEN_R 0x0C62 +#endif +#ifndef GL_TEXTURE_GEN_Q +#define GL_TEXTURE_GEN_Q 0x0C63 +#endif +#ifndef GL_PIXEL_MAP_I_TO_I_SIZE +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#endif +#ifndef GL_PIXEL_MAP_S_TO_S_SIZE +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#endif +#ifndef GL_PIXEL_MAP_I_TO_R_SIZE +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#endif +#ifndef GL_PIXEL_MAP_I_TO_G_SIZE +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#endif +#ifndef GL_PIXEL_MAP_I_TO_B_SIZE +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#endif +#ifndef GL_PIXEL_MAP_I_TO_A_SIZE +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#endif +#ifndef GL_PIXEL_MAP_R_TO_R_SIZE +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#endif +#ifndef GL_PIXEL_MAP_G_TO_G_SIZE +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#endif +#ifndef GL_PIXEL_MAP_B_TO_B_SIZE +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#endif +#ifndef GL_PIXEL_MAP_A_TO_A_SIZE +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#endif +#ifndef GL_UNPACK_SWAP_BYTES +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#endif +#ifndef GL_UNPACK_LSB_FIRST +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#endif +#ifndef GL_UNPACK_ROW_LENGTH +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#endif +#ifndef GL_UNPACK_SKIP_ROWS +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#endif +#ifndef GL_UNPACK_SKIP_PIXELS +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#endif +#ifndef GL_UNPACK_ALIGNMENT +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#endif +#ifndef GL_PACK_SWAP_BYTES +#define GL_PACK_SWAP_BYTES 0x0D00 +#endif +#ifndef GL_PACK_LSB_FIRST +#define GL_PACK_LSB_FIRST 0x0D01 +#endif +#ifndef GL_PACK_ROW_LENGTH +#define GL_PACK_ROW_LENGTH 0x0D02 +#endif +#ifndef GL_PACK_SKIP_ROWS +#define GL_PACK_SKIP_ROWS 0x0D03 +#endif +#ifndef GL_PACK_SKIP_PIXELS +#define GL_PACK_SKIP_PIXELS 0x0D04 +#endif +#ifndef GL_PACK_ALIGNMENT +#define GL_PACK_ALIGNMENT 0x0D05 +#endif +#ifndef GL_MAP_COLOR +#define GL_MAP_COLOR 0x0D10 +#endif +#ifndef GL_MAP_STENCIL +#define GL_MAP_STENCIL 0x0D11 +#endif +#ifndef GL_INDEX_SHIFT +#define GL_INDEX_SHIFT 0x0D12 +#endif +#ifndef GL_INDEX_OFFSET +#define GL_INDEX_OFFSET 0x0D13 +#endif +#ifndef GL_RED_SCALE +#define GL_RED_SCALE 0x0D14 +#endif +#ifndef GL_RED_BIAS +#define GL_RED_BIAS 0x0D15 +#endif +#ifndef GL_ZOOM_X +#define GL_ZOOM_X 0x0D16 +#endif +#ifndef GL_ZOOM_Y +#define GL_ZOOM_Y 0x0D17 +#endif +#ifndef GL_GREEN_SCALE +#define GL_GREEN_SCALE 0x0D18 +#endif +#ifndef GL_GREEN_BIAS +#define GL_GREEN_BIAS 0x0D19 +#endif +#ifndef GL_BLUE_SCALE +#define GL_BLUE_SCALE 0x0D1A +#endif +#ifndef GL_BLUE_BIAS +#define GL_BLUE_BIAS 0x0D1B +#endif +#ifndef GL_ALPHA_SCALE +#define GL_ALPHA_SCALE 0x0D1C +#endif +#ifndef GL_ALPHA_BIAS +#define GL_ALPHA_BIAS 0x0D1D +#endif +#ifndef GL_DEPTH_SCALE +#define GL_DEPTH_SCALE 0x0D1E +#endif +#ifndef GL_DEPTH_BIAS +#define GL_DEPTH_BIAS 0x0D1F +#endif +#ifndef GL_MAX_EVAL_ORDER +#define GL_MAX_EVAL_ORDER 0x0D30 +#endif +#ifndef GL_MAX_LIGHTS +#define GL_MAX_LIGHTS 0x0D31 +#endif +#ifndef GL_MAX_CLIP_PLANES +#define GL_MAX_CLIP_PLANES 0x0D32 +#endif +#ifndef GL_MAX_TEXTURE_SIZE +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#endif +#ifndef GL_MAX_PIXEL_MAP_TABLE +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#endif +#ifndef GL_MAX_ATTRIB_STACK_DEPTH +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#endif +#ifndef GL_MAX_MODELVIEW_STACK_DEPTH +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#endif +#ifndef GL_MAX_NAME_STACK_DEPTH +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#endif +#ifndef GL_MAX_PROJECTION_STACK_DEPTH +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#endif +#ifndef GL_MAX_TEXTURE_STACK_DEPTH +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#endif +#ifndef GL_MAX_VIEWPORT_DIMS +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#endif +#ifndef GL_MAX_CLIENT_ATTRIB_STACK_DEPTH +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#endif +#ifndef GL_SUBPIXEL_BITS +#define GL_SUBPIXEL_BITS 0x0D50 +#endif +#ifndef GL_INDEX_BITS +#define GL_INDEX_BITS 0x0D51 +#endif +#ifndef GL_RED_BITS +#define GL_RED_BITS 0x0D52 +#endif +#ifndef GL_GREEN_BITS +#define GL_GREEN_BITS 0x0D53 +#endif +#ifndef GL_BLUE_BITS +#define GL_BLUE_BITS 0x0D54 +#endif +#ifndef GL_ALPHA_BITS +#define GL_ALPHA_BITS 0x0D55 +#endif +#ifndef GL_DEPTH_BITS +#define GL_DEPTH_BITS 0x0D56 +#endif +#ifndef GL_STENCIL_BITS +#define GL_STENCIL_BITS 0x0D57 +#endif +#ifndef GL_ACCUM_RED_BITS +#define GL_ACCUM_RED_BITS 0x0D58 +#endif +#ifndef GL_ACCUM_GREEN_BITS +#define GL_ACCUM_GREEN_BITS 0x0D59 +#endif +#ifndef GL_ACCUM_BLUE_BITS +#define GL_ACCUM_BLUE_BITS 0x0D5A +#endif +#ifndef GL_ACCUM_ALPHA_BITS +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#endif +#ifndef GL_NAME_STACK_DEPTH +#define GL_NAME_STACK_DEPTH 0x0D70 +#endif +#ifndef GL_AUTO_NORMAL +#define GL_AUTO_NORMAL 0x0D80 +#endif +#ifndef GL_MAP1_COLOR_4 +#define GL_MAP1_COLOR_4 0x0D90 +#endif +#ifndef GL_MAP1_INDEX +#define GL_MAP1_INDEX 0x0D91 +#endif +#ifndef GL_MAP1_NORMAL +#define GL_MAP1_NORMAL 0x0D92 +#endif +#ifndef GL_MAP1_TEXTURE_COORD_1 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#endif +#ifndef GL_MAP1_TEXTURE_COORD_2 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#endif +#ifndef GL_MAP1_TEXTURE_COORD_3 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#endif +#ifndef GL_MAP1_TEXTURE_COORD_4 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#endif +#ifndef GL_MAP1_VERTEX_3 +#define GL_MAP1_VERTEX_3 0x0D97 +#endif +#ifndef GL_MAP1_VERTEX_4 +#define GL_MAP1_VERTEX_4 0x0D98 +#endif +#ifndef GL_MAP2_COLOR_4 +#define GL_MAP2_COLOR_4 0x0DB0 +#endif +#ifndef GL_MAP2_INDEX +#define GL_MAP2_INDEX 0x0DB1 +#endif +#ifndef GL_MAP2_NORMAL +#define GL_MAP2_NORMAL 0x0DB2 +#endif +#ifndef GL_MAP2_TEXTURE_COORD_1 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#endif +#ifndef GL_MAP2_TEXTURE_COORD_2 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#endif +#ifndef GL_MAP2_TEXTURE_COORD_3 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#endif +#ifndef GL_MAP2_TEXTURE_COORD_4 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#endif +#ifndef GL_MAP2_VERTEX_3 +#define GL_MAP2_VERTEX_3 0x0DB7 +#endif +#ifndef GL_MAP2_VERTEX_4 +#define GL_MAP2_VERTEX_4 0x0DB8 +#endif +#ifndef GL_MAP1_GRID_DOMAIN +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#endif +#ifndef GL_MAP1_GRID_SEGMENTS +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#endif +#ifndef GL_MAP2_GRID_DOMAIN +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#endif +#ifndef GL_MAP2_GRID_SEGMENTS +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#endif +#ifndef GL_TEXTURE_1D +#define GL_TEXTURE_1D 0x0DE0 +#endif +#ifndef GL_TEXTURE_2D +#define GL_TEXTURE_2D 0x0DE1 +#endif +#ifndef GL_FEEDBACK_BUFFER_SIZE +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#endif +#ifndef GL_FEEDBACK_BUFFER_TYPE +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#endif +#ifndef GL_SELECTION_BUFFER_SIZE +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#endif +#ifndef GL_POLYGON_OFFSET_UNITS +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#endif +#ifndef GL_POLYGON_OFFSET_POINT +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#endif +#ifndef GL_POLYGON_OFFSET_LINE +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#endif +#ifndef GL_POLYGON_OFFSET_FILL +#define GL_POLYGON_OFFSET_FILL 0x8037 +#endif +#ifndef GL_POLYGON_OFFSET_FACTOR +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#endif +#ifndef GL_TEXTURE_BINDING_1D +#define GL_TEXTURE_BINDING_1D 0x8068 +#endif +#ifndef GL_TEXTURE_BINDING_2D +#define GL_TEXTURE_BINDING_2D 0x8069 +#endif +#ifndef GL_TEXTURE_BINDING_3D +#define GL_TEXTURE_BINDING_3D 0x806A +#endif +#ifndef GL_VERTEX_ARRAY +#define GL_VERTEX_ARRAY 0x8074 +#endif +#ifndef GL_NORMAL_ARRAY +#define GL_NORMAL_ARRAY 0x8075 +#endif +#ifndef GL_COLOR_ARRAY +#define GL_COLOR_ARRAY 0x8076 +#endif +#ifndef GL_INDEX_ARRAY +#define GL_INDEX_ARRAY 0x8077 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#endif +#ifndef GL_EDGE_FLAG_ARRAY +#define GL_EDGE_FLAG_ARRAY 0x8079 +#endif +#ifndef GL_VERTEX_ARRAY_SIZE +#define GL_VERTEX_ARRAY_SIZE 0x807A +#endif +#ifndef GL_VERTEX_ARRAY_TYPE +#define GL_VERTEX_ARRAY_TYPE 0x807B +#endif +#ifndef GL_VERTEX_ARRAY_STRIDE +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#endif +#ifndef GL_NORMAL_ARRAY_TYPE +#define GL_NORMAL_ARRAY_TYPE 0x807E +#endif +#ifndef GL_NORMAL_ARRAY_STRIDE +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#endif +#ifndef GL_COLOR_ARRAY_SIZE +#define GL_COLOR_ARRAY_SIZE 0x8081 +#endif +#ifndef GL_COLOR_ARRAY_TYPE +#define GL_COLOR_ARRAY_TYPE 0x8082 +#endif +#ifndef GL_COLOR_ARRAY_STRIDE +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#endif +#ifndef GL_INDEX_ARRAY_TYPE +#define GL_INDEX_ARRAY_TYPE 0x8085 +#endif +#ifndef GL_INDEX_ARRAY_STRIDE +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_SIZE +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_TYPE +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_STRIDE +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#endif +#ifndef GL_EDGE_FLAG_ARRAY_STRIDE +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#endif +#ifndef GL_TEXTURE_WIDTH +#define GL_TEXTURE_WIDTH 0x1000 +#endif +#ifndef GL_TEXTURE_HEIGHT +#define GL_TEXTURE_HEIGHT 0x1001 +#endif +#ifndef GL_TEXTURE_INTERNAL_FORMAT +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#endif +#ifndef GL_TEXTURE_COMPONENTS +#define GL_TEXTURE_COMPONENTS 0x1003 +#endif +#ifndef GL_TEXTURE_BORDER_COLOR +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#endif +#ifndef GL_TEXTURE_BORDER +#define GL_TEXTURE_BORDER 0x1005 +#endif +#ifndef GL_TEXTURE_RED_SIZE +#define GL_TEXTURE_RED_SIZE 0x805C +#endif +#ifndef GL_TEXTURE_GREEN_SIZE +#define GL_TEXTURE_GREEN_SIZE 0x805D +#endif +#ifndef GL_TEXTURE_BLUE_SIZE +#define GL_TEXTURE_BLUE_SIZE 0x805E +#endif +#ifndef GL_TEXTURE_ALPHA_SIZE +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#endif +#ifndef GL_TEXTURE_LUMINANCE_SIZE +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#endif +#ifndef GL_TEXTURE_INTENSITY_SIZE +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#endif +#ifndef GL_TEXTURE_PRIORITY +#define GL_TEXTURE_PRIORITY 0x8066 +#endif +#ifndef GL_TEXTURE_RESIDENT +#define GL_TEXTURE_RESIDENT 0x8067 +#endif +#ifndef GL_DONT_CARE +#define GL_DONT_CARE 0x1100 +#endif +#ifndef GL_FASTEST +#define GL_FASTEST 0x1101 +#endif +#ifndef GL_NICEST +#define GL_NICEST 0x1102 +#endif +#ifndef GL_AMBIENT +#define GL_AMBIENT 0x1200 +#endif +#ifndef GL_DIFFUSE +#define GL_DIFFUSE 0x1201 +#endif +#ifndef GL_SPECULAR +#define GL_SPECULAR 0x1202 +#endif +#ifndef GL_POSITION +#define GL_POSITION 0x1203 +#endif +#ifndef GL_SPOT_DIRECTION +#define GL_SPOT_DIRECTION 0x1204 +#endif +#ifndef GL_SPOT_EXPONENT +#define GL_SPOT_EXPONENT 0x1205 +#endif +#ifndef GL_SPOT_CUTOFF +#define GL_SPOT_CUTOFF 0x1206 +#endif +#ifndef GL_CONSTANT_ATTENUATION +#define GL_CONSTANT_ATTENUATION 0x1207 +#endif +#ifndef GL_LINEAR_ATTENUATION +#define GL_LINEAR_ATTENUATION 0x1208 +#endif +#ifndef GL_QUADRATIC_ATTENUATION +#define GL_QUADRATIC_ATTENUATION 0x1209 +#endif +#ifndef GL_COMPILE +#define GL_COMPILE 0x1300 +#endif +#ifndef GL_COMPILE_AND_EXECUTE +#define GL_COMPILE_AND_EXECUTE 0x1301 +#endif +#ifndef GL_BYTE +#define GL_BYTE 0x1400 +#endif +#ifndef GL_UNSIGNED_BYTE +#define GL_UNSIGNED_BYTE 0x1401 +#endif +#ifndef GL_SHORT +#define GL_SHORT 0x1402 +#endif +#ifndef GL_UNSIGNED_SHORT +#define GL_UNSIGNED_SHORT 0x1403 +#endif +#ifndef GL_INT +#define GL_INT 0x1404 +#endif +#ifndef GL_UNSIGNED_INT +#define GL_UNSIGNED_INT 0x1405 +#endif +#ifndef GL_FLOAT +#define GL_FLOAT 0x1406 +#endif +#ifndef GL_2_BYTES +#define GL_2_BYTES 0x1407 +#endif +#ifndef GL_3_BYTES +#define GL_3_BYTES 0x1408 +#endif +#ifndef GL_4_BYTES +#define GL_4_BYTES 0x1409 +#endif +#ifndef GL_DOUBLE +#define GL_DOUBLE 0x140A +#endif +#ifndef GL_DOUBLE_EXT +#define GL_DOUBLE_EXT 0x140A +#endif +#ifndef GL_CLEAR +#define GL_CLEAR 0x1500 +#endif +#ifndef GL_AND +#define GL_AND 0x1501 +#endif +#ifndef GL_AND_REVERSE +#define GL_AND_REVERSE 0x1502 +#endif +#ifndef GL_COPY +#define GL_COPY 0x1503 +#endif +#ifndef GL_AND_INVERTED +#define GL_AND_INVERTED 0x1504 +#endif +#ifndef GL_NOOP +#define GL_NOOP 0x1505 +#endif +#ifndef GL_XOR +#define GL_XOR 0x1506 +#endif +#ifndef GL_OR +#define GL_OR 0x1507 +#endif +#ifndef GL_NOR +#define GL_NOR 0x1508 +#endif +#ifndef GL_EQUIV +#define GL_EQUIV 0x1509 +#endif +#ifndef GL_INVERT +#define GL_INVERT 0x150A +#endif +#ifndef GL_OR_REVERSE +#define GL_OR_REVERSE 0x150B +#endif +#ifndef GL_COPY_INVERTED +#define GL_COPY_INVERTED 0x150C +#endif +#ifndef GL_OR_INVERTED +#define GL_OR_INVERTED 0x150D +#endif +#ifndef GL_NAND +#define GL_NAND 0x150E +#endif +#ifndef GL_SET +#define GL_SET 0x150F +#endif +#ifndef GL_EMISSION +#define GL_EMISSION 0x1600 +#endif +#ifndef GL_SHININESS +#define GL_SHININESS 0x1601 +#endif +#ifndef GL_AMBIENT_AND_DIFFUSE +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#endif +#ifndef GL_COLOR_INDEXES +#define GL_COLOR_INDEXES 0x1603 +#endif +#ifndef GL_MODELVIEW +#define GL_MODELVIEW 0x1700 +#endif +#ifndef GL_PROJECTION +#define GL_PROJECTION 0x1701 +#endif +#ifndef GL_TEXTURE +#define GL_TEXTURE 0x1702 +#endif +#ifndef GL_COLOR +#define GL_COLOR 0x1800 +#endif +#ifndef GL_DEPTH +#define GL_DEPTH 0x1801 +#endif +#ifndef GL_STENCIL +#define GL_STENCIL 0x1802 +#endif +#ifndef GL_COLOR_INDEX +#define GL_COLOR_INDEX 0x1900 +#endif +#ifndef GL_STENCIL_INDEX +#define GL_STENCIL_INDEX 0x1901 +#endif +#ifndef GL_DEPTH_COMPONENT +#define GL_DEPTH_COMPONENT 0x1902 +#endif +#ifndef GL_RED +#define GL_RED 0x1903 +#endif +#ifndef GL_GREEN +#define GL_GREEN 0x1904 +#endif +#ifndef GL_BLUE +#define GL_BLUE 0x1905 +#endif +#ifndef GL_ALPHA +#define GL_ALPHA 0x1906 +#endif +#ifndef GL_RGB +#define GL_RGB 0x1907 +#endif +#ifndef GL_RGBA +#define GL_RGBA 0x1908 +#endif +#ifndef GL_LUMINANCE +#define GL_LUMINANCE 0x1909 +#endif +#ifndef GL_LUMINANCE_ALPHA +#define GL_LUMINANCE_ALPHA 0x190A +#endif +#ifndef GL_BITMAP +#define GL_BITMAP 0x1A00 +#endif +#ifndef GL_POINT +#define GL_POINT 0x1B00 +#endif +#ifndef GL_LINE +#define GL_LINE 0x1B01 +#endif +#ifndef GL_FILL +#define GL_FILL 0x1B02 +#endif +#ifndef GL_RENDER +#define GL_RENDER 0x1C00 +#endif +#ifndef GL_FEEDBACK +#define GL_FEEDBACK 0x1C01 +#endif +#ifndef GL_SELECT +#define GL_SELECT 0x1C02 +#endif +#ifndef GL_FLAT +#define GL_FLAT 0x1D00 +#endif +#ifndef GL_SMOOTH +#define GL_SMOOTH 0x1D01 +#endif +#ifndef GL_KEEP +#define GL_KEEP 0x1E00 +#endif +#ifndef GL_REPLACE +#define GL_REPLACE 0x1E01 +#endif +#ifndef GL_INCR +#define GL_INCR 0x1E02 +#endif +#ifndef GL_DECR +#define GL_DECR 0x1E03 +#endif +#ifndef GL_VENDOR +#define GL_VENDOR 0x1F00 +#endif +#ifndef GL_RENDERER +#define GL_RENDERER 0x1F01 +#endif +#ifndef GL_VERSION +#define GL_VERSION 0x1F02 +#endif +#ifndef GL_EXTENSIONS +#define GL_EXTENSIONS 0x1F03 +#endif +#ifndef GL_S +#define GL_S 0x2000 +#endif +#ifndef GL_T +#define GL_T 0x2001 +#endif +#ifndef GL_R +#define GL_R 0x2002 +#endif +#ifndef GL_Q +#define GL_Q 0x2003 +#endif +#ifndef GL_MODULATE +#define GL_MODULATE 0x2100 +#endif +#ifndef GL_DECAL +#define GL_DECAL 0x2101 +#endif +#ifndef GL_TEXTURE_ENV_MODE +#define GL_TEXTURE_ENV_MODE 0x2200 +#endif +#ifndef GL_TEXTURE_ENV_COLOR +#define GL_TEXTURE_ENV_COLOR 0x2201 +#endif +#ifndef GL_TEXTURE_ENV +#define GL_TEXTURE_ENV 0x2300 +#endif +#ifndef GL_EYE_LINEAR +#define GL_EYE_LINEAR 0x2400 +#endif +#ifndef GL_OBJECT_LINEAR +#define GL_OBJECT_LINEAR 0x2401 +#endif +#ifndef GL_SPHERE_MAP +#define GL_SPHERE_MAP 0x2402 +#endif +#ifndef GL_TEXTURE_GEN_MODE +#define GL_TEXTURE_GEN_MODE 0x2500 +#endif +#ifndef GL_OBJECT_PLANE +#define GL_OBJECT_PLANE 0x2501 +#endif +#ifndef GL_EYE_PLANE +#define GL_EYE_PLANE 0x2502 +#endif +#ifndef GL_NEAREST +#define GL_NEAREST 0x2600 +#endif +#ifndef GL_LINEAR +#define GL_LINEAR 0x2601 +#endif +#ifndef GL_NEAREST_MIPMAP_NEAREST +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#endif +#ifndef GL_LINEAR_MIPMAP_NEAREST +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#endif +#ifndef GL_NEAREST_MIPMAP_LINEAR +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#endif +#ifndef GL_LINEAR_MIPMAP_LINEAR +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#endif +#ifndef GL_TEXTURE_MAG_FILTER +#define GL_TEXTURE_MAG_FILTER 0x2800 +#endif +#ifndef GL_TEXTURE_MIN_FILTER +#define GL_TEXTURE_MIN_FILTER 0x2801 +#endif +#ifndef GL_TEXTURE_WRAP_S +#define GL_TEXTURE_WRAP_S 0x2802 +#endif +#ifndef GL_TEXTURE_WRAP_T +#define GL_TEXTURE_WRAP_T 0x2803 +#endif +#ifndef GL_PROXY_TEXTURE_1D +#define GL_PROXY_TEXTURE_1D 0x8063 +#endif +#ifndef GL_PROXY_TEXTURE_2D +#define GL_PROXY_TEXTURE_2D 0x8064 +#endif +#ifndef GL_CLAMP +#define GL_CLAMP 0x2900 +#endif +#ifndef GL_REPEAT +#define GL_REPEAT 0x2901 +#endif +#ifndef GL_R3_G3_B2 +#define GL_R3_G3_B2 0x2A10 +#endif +#ifndef GL_ALPHA4 +#define GL_ALPHA4 0x803B +#endif +#ifndef GL_ALPHA8 +#define GL_ALPHA8 0x803C +#endif +#ifndef GL_ALPHA12 +#define GL_ALPHA12 0x803D +#endif +#ifndef GL_ALPHA16 +#define GL_ALPHA16 0x803E +#endif +#ifndef GL_LUMINANCE4 +#define GL_LUMINANCE4 0x803F +#endif +#ifndef GL_LUMINANCE8 +#define GL_LUMINANCE8 0x8040 +#endif +#ifndef GL_LUMINANCE12 +#define GL_LUMINANCE12 0x8041 +#endif +#ifndef GL_LUMINANCE16 +#define GL_LUMINANCE16 0x8042 +#endif +#ifndef GL_LUMINANCE4_ALPHA4 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#endif +#ifndef GL_LUMINANCE6_ALPHA2 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#endif +#ifndef GL_LUMINANCE8_ALPHA8 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#endif +#ifndef GL_LUMINANCE12_ALPHA4 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#endif +#ifndef GL_LUMINANCE12_ALPHA12 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#endif +#ifndef GL_LUMINANCE16_ALPHA16 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#endif +#ifndef GL_INTENSITY +#define GL_INTENSITY 0x8049 +#endif +#ifndef GL_INTENSITY4 +#define GL_INTENSITY4 0x804A +#endif +#ifndef GL_INTENSITY8 +#define GL_INTENSITY8 0x804B +#endif +#ifndef GL_INTENSITY12 +#define GL_INTENSITY12 0x804C +#endif +#ifndef GL_INTENSITY16 +#define GL_INTENSITY16 0x804D +#endif +#ifndef GL_RGB4 +#define GL_RGB4 0x804F +#endif +#ifndef GL_RGB5 +#define GL_RGB5 0x8050 +#endif +#ifndef GL_RGB8 +#define GL_RGB8 0x8051 +#endif +#ifndef GL_RGB10 +#define GL_RGB10 0x8052 +#endif +#ifndef GL_RGB12 +#define GL_RGB12 0x8053 +#endif +#ifndef GL_RGB16 +#define GL_RGB16 0x8054 +#endif +#ifndef GL_RGBA2 +#define GL_RGBA2 0x8055 +#endif +#ifndef GL_RGBA4 +#define GL_RGBA4 0x8056 +#endif +#ifndef GL_RGB5_A1 +#define GL_RGB5_A1 0x8057 +#endif +#ifndef GL_RGBA8 +#define GL_RGBA8 0x8058 +#endif +#ifndef GL_RGB10_A2 +#define GL_RGB10_A2 0x8059 +#endif +#ifndef GL_RGBA12 +#define GL_RGBA12 0x805A +#endif +#ifndef GL_RGBA16 +#define GL_RGBA16 0x805B +#endif +#ifndef GL_V2F +#define GL_V2F 0x2A20 +#endif +#ifndef GL_V3F +#define GL_V3F 0x2A21 +#endif +#ifndef GL_C4UB_V2F +#define GL_C4UB_V2F 0x2A22 +#endif +#ifndef GL_C4UB_V3F +#define GL_C4UB_V3F 0x2A23 +#endif +#ifndef GL_C3F_V3F +#define GL_C3F_V3F 0x2A24 +#endif +#ifndef GL_N3F_V3F +#define GL_N3F_V3F 0x2A25 +#endif +#ifndef GL_C4F_N3F_V3F +#define GL_C4F_N3F_V3F 0x2A26 +#endif +#ifndef GL_T2F_V3F +#define GL_T2F_V3F 0x2A27 +#endif +#ifndef GL_T4F_V4F +#define GL_T4F_V4F 0x2A28 +#endif +#ifndef GL_T2F_C4UB_V3F +#define GL_T2F_C4UB_V3F 0x2A29 +#endif +#ifndef GL_T2F_C3F_V3F +#define GL_T2F_C3F_V3F 0x2A2A +#endif +#ifndef GL_T2F_N3F_V3F +#define GL_T2F_N3F_V3F 0x2A2B +#endif +#ifndef GL_T2F_C4F_N3F_V3F +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#endif +#ifndef GL_T4F_C4F_N3F_V4F +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#endif +#ifndef GL_CLIP_PLANE0 +#define GL_CLIP_PLANE0 0x3000 +#endif +#ifndef GL_CLIP_PLANE1 +#define GL_CLIP_PLANE1 0x3001 +#endif +#ifndef GL_CLIP_PLANE2 +#define GL_CLIP_PLANE2 0x3002 +#endif +#ifndef GL_CLIP_PLANE3 +#define GL_CLIP_PLANE3 0x3003 +#endif +#ifndef GL_CLIP_PLANE4 +#define GL_CLIP_PLANE4 0x3004 +#endif +#ifndef GL_CLIP_PLANE5 +#define GL_CLIP_PLANE5 0x3005 +#endif +#ifndef GL_LIGHT0 +#define GL_LIGHT0 0x4000 +#endif +#ifndef GL_LIGHT1 +#define GL_LIGHT1 0x4001 +#endif +#ifndef GL_LIGHT2 +#define GL_LIGHT2 0x4002 +#endif +#ifndef GL_LIGHT3 +#define GL_LIGHT3 0x4003 +#endif +#ifndef GL_LIGHT4 +#define GL_LIGHT4 0x4004 +#endif +#ifndef GL_LIGHT5 +#define GL_LIGHT5 0x4005 +#endif +#ifndef GL_LIGHT6 +#define GL_LIGHT6 0x4006 +#endif +#ifndef GL_LIGHT7 +#define GL_LIGHT7 0x4007 +#endif +#ifndef GL_ABGR_EXT +#define GL_ABGR_EXT 0x8000 +#endif +#ifndef GL_CONSTANT_COLOR +#define GL_CONSTANT_COLOR 0x8001 +#endif +#ifndef GL_CONSTANT_COLOR_EXT +#define GL_CONSTANT_COLOR_EXT 0x8001 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_COLOR +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_COLOR_EXT +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#endif +#ifndef GL_CONSTANT_ALPHA +#define GL_CONSTANT_ALPHA 0x8003 +#endif +#ifndef GL_CONSTANT_ALPHA_EXT +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA_EXT +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#endif +#ifndef GL_BLEND_COLOR +#define GL_BLEND_COLOR 0x8005 +#endif +#ifndef GL_BLEND_COLOR_EXT +#define GL_BLEND_COLOR_EXT 0x8005 +#endif +#ifndef GL_FUNC_ADD +#define GL_FUNC_ADD 0x8006 +#endif +#ifndef GL_FUNC_ADD_EXT +#define GL_FUNC_ADD_EXT 0x8006 +#endif +#ifndef GL_MIN +#define GL_MIN 0x8007 +#endif +#ifndef GL_MIN_EXT +#define GL_MIN_EXT 0x8007 +#endif +#ifndef GL_MAX +#define GL_MAX 0x8008 +#endif +#ifndef GL_MAX_EXT +#define GL_MAX_EXT 0x8008 +#endif +#ifndef GL_BLEND_EQUATION +#define GL_BLEND_EQUATION 0x8009 +#endif +#ifndef GL_BLEND_EQUATION_EXT +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif +#ifndef GL_FUNC_SUBTRACT +#define GL_FUNC_SUBTRACT 0x800A +#endif +#ifndef GL_FUNC_SUBTRACT_EXT +#define GL_FUNC_SUBTRACT_EXT 0x800A +#endif +#ifndef GL_FUNC_REVERSE_SUBTRACT +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif +#ifndef GL_FUNC_REVERSE_SUBTRACT_EXT +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif +#ifndef GL_CMYK_EXT +#define GL_CMYK_EXT 0x800C +#endif +#ifndef GL_CMYKA_EXT +#define GL_CMYKA_EXT 0x800D +#endif +#ifndef GL_PACK_CMYK_HINT_EXT +#define GL_PACK_CMYK_HINT_EXT 0x800E +#endif +#ifndef GL_UNPACK_CMYK_HINT_EXT +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif +#ifndef GL_CONVOLUTION_1D +#define GL_CONVOLUTION_1D 0x8010 +#endif +#ifndef GL_CONVOLUTION_1D_EXT +#define GL_CONVOLUTION_1D_EXT 0x8010 +#endif +#ifndef GL_CONVOLUTION_2D +#define GL_CONVOLUTION_2D 0x8011 +#endif +#ifndef GL_CONVOLUTION_2D_EXT +#define GL_CONVOLUTION_2D_EXT 0x8011 +#endif +#ifndef GL_SEPARABLE_2D +#define GL_SEPARABLE_2D 0x8012 +#endif +#ifndef GL_SEPARABLE_2D_EXT +#define GL_SEPARABLE_2D_EXT 0x8012 +#endif +#ifndef GL_CONVOLUTION_BORDER_MODE +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#endif +#ifndef GL_CONVOLUTION_BORDER_MODE_EXT +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#endif +#ifndef GL_CONVOLUTION_FILTER_SCALE +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#endif +#ifndef GL_CONVOLUTION_FILTER_SCALE_EXT +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#endif +#ifndef GL_CONVOLUTION_FILTER_BIAS +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#endif +#ifndef GL_CONVOLUTION_FILTER_BIAS_EXT +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#endif +#ifndef GL_REDUCE +#define GL_REDUCE 0x8016 +#endif +#ifndef GL_REDUCE_EXT +#define GL_REDUCE_EXT 0x8016 +#endif +#ifndef GL_CONVOLUTION_FORMAT +#define GL_CONVOLUTION_FORMAT 0x8017 +#endif +#ifndef GL_CONVOLUTION_FORMAT_EXT +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#endif +#ifndef GL_CONVOLUTION_WIDTH +#define GL_CONVOLUTION_WIDTH 0x8018 +#endif +#ifndef GL_CONVOLUTION_WIDTH_EXT +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#endif +#ifndef GL_CONVOLUTION_HEIGHT +#define GL_CONVOLUTION_HEIGHT 0x8019 +#endif +#ifndef GL_CONVOLUTION_HEIGHT_EXT +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#endif +#ifndef GL_MAX_CONVOLUTION_WIDTH +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#endif +#ifndef GL_MAX_CONVOLUTION_WIDTH_EXT +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#endif +#ifndef GL_MAX_CONVOLUTION_HEIGHT +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#endif +#ifndef GL_MAX_CONVOLUTION_HEIGHT_EXT +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#endif +#ifndef GL_POST_CONVOLUTION_RED_SCALE +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#endif +#ifndef GL_POST_CONVOLUTION_RED_SCALE_EXT +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_SCALE +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_SCALE_EXT +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_SCALE +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_SCALE_EXT +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_SCALE +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_SCALE_EXT +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#endif +#ifndef GL_POST_CONVOLUTION_RED_BIAS +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#endif +#ifndef GL_POST_CONVOLUTION_RED_BIAS_EXT +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_BIAS +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_BIAS_EXT +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_BIAS +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_BIAS_EXT +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_BIAS +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_BIAS_EXT +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif +#ifndef GL_HISTOGRAM +#define GL_HISTOGRAM 0x8024 +#endif +#ifndef GL_HISTOGRAM_EXT +#define GL_HISTOGRAM_EXT 0x8024 +#endif +#ifndef GL_PROXY_HISTOGRAM +#define GL_PROXY_HISTOGRAM 0x8025 +#endif +#ifndef GL_PROXY_HISTOGRAM_EXT +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#endif +#ifndef GL_HISTOGRAM_WIDTH +#define GL_HISTOGRAM_WIDTH 0x8026 +#endif +#ifndef GL_HISTOGRAM_WIDTH_EXT +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#endif +#ifndef GL_HISTOGRAM_FORMAT +#define GL_HISTOGRAM_FORMAT 0x8027 +#endif +#ifndef GL_HISTOGRAM_FORMAT_EXT +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#endif +#ifndef GL_HISTOGRAM_RED_SIZE +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#endif +#ifndef GL_HISTOGRAM_RED_SIZE_EXT +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#endif +#ifndef GL_HISTOGRAM_GREEN_SIZE +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#endif +#ifndef GL_HISTOGRAM_GREEN_SIZE_EXT +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#endif +#ifndef GL_HISTOGRAM_BLUE_SIZE +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#endif +#ifndef GL_HISTOGRAM_BLUE_SIZE_EXT +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#endif +#ifndef GL_HISTOGRAM_ALPHA_SIZE +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#endif +#ifndef GL_HISTOGRAM_ALPHA_SIZE_EXT +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#endif +#ifndef GL_HISTOGRAM_LUMINANCE_SIZE +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#endif +#ifndef GL_HISTOGRAM_LUMINANCE_SIZE_EXT +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#endif +#ifndef GL_HISTOGRAM_SINK +#define GL_HISTOGRAM_SINK 0x802D +#endif +#ifndef GL_HISTOGRAM_SINK_EXT +#define GL_HISTOGRAM_SINK_EXT 0x802D +#endif +#ifndef GL_MINMAX +#define GL_MINMAX 0x802E +#endif +#ifndef GL_MINMAX_EXT +#define GL_MINMAX_EXT 0x802E +#endif +#ifndef GL_MINMAX_FORMAT +#define GL_MINMAX_FORMAT 0x802F +#endif +#ifndef GL_MINMAX_FORMAT_EXT +#define GL_MINMAX_FORMAT_EXT 0x802F +#endif +#ifndef GL_MINMAX_SINK +#define GL_MINMAX_SINK 0x8030 +#endif +#ifndef GL_MINMAX_SINK_EXT +#define GL_MINMAX_SINK_EXT 0x8030 +#endif +#ifndef GL_TABLE_TOO_LARGE +#define GL_TABLE_TOO_LARGE 0x8031 +#endif +#ifndef GL_TABLE_TOO_LARGE_EXT +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif +#ifndef GL_UNSIGNED_BYTE_3_3_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#endif +#ifndef GL_UNSIGNED_BYTE_3_3_2_EXT +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4_EXT +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#endif +#ifndef GL_UNSIGNED_SHORT_5_5_5_1 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#endif +#ifndef GL_UNSIGNED_SHORT_5_5_5_1_EXT +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8_EXT +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#endif +#ifndef GL_UNSIGNED_INT_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#endif +#ifndef GL_UNSIGNED_INT_10_10_10_2_EXT +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif +#ifndef GL_UNSIGNED_BYTE_2_3_3_REV +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#endif +#ifndef GL_UNSIGNED_BYTE_2_3_3_REV_EXT +#define GL_UNSIGNED_BYTE_2_3_3_REV_EXT 0x8362 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5_EXT +#define GL_UNSIGNED_SHORT_5_6_5_EXT 0x8363 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5_REV +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5_REV_EXT +#define GL_UNSIGNED_SHORT_5_6_5_REV_EXT 0x8364 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4_REV +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#endif +#ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#endif +#ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8_REV +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8_REV_EXT +#define GL_UNSIGNED_INT_8_8_8_8_REV_EXT 0x8367 +#endif +#ifndef GL_UNSIGNED_INT_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#endif +#ifndef GL_UNSIGNED_INT_2_10_10_10_REV_EXT +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif +#ifndef GL_POLYGON_OFFSET_EXT +#define GL_POLYGON_OFFSET_EXT 0x8037 +#endif +#ifndef GL_POLYGON_OFFSET_FACTOR_EXT +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#endif +#ifndef GL_POLYGON_OFFSET_BIAS_EXT +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif +#ifndef GL_RESCALE_NORMAL +#define GL_RESCALE_NORMAL 0x803A +#endif +#ifndef GL_RESCALE_NORMAL_EXT +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif +#ifndef GL_ALPHA4_EXT +#define GL_ALPHA4_EXT 0x803B +#endif +#ifndef GL_ALPHA8_EXT +#define GL_ALPHA8_EXT 0x803C +#endif +#ifndef GL_ALPHA12_EXT +#define GL_ALPHA12_EXT 0x803D +#endif +#ifndef GL_ALPHA16_EXT +#define GL_ALPHA16_EXT 0x803E +#endif +#ifndef GL_LUMINANCE4_EXT +#define GL_LUMINANCE4_EXT 0x803F +#endif +#ifndef GL_LUMINANCE8_EXT +#define GL_LUMINANCE8_EXT 0x8040 +#endif +#ifndef GL_LUMINANCE12_EXT +#define GL_LUMINANCE12_EXT 0x8041 +#endif +#ifndef GL_LUMINANCE16_EXT +#define GL_LUMINANCE16_EXT 0x8042 +#endif +#ifndef GL_LUMINANCE4_ALPHA4_EXT +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#endif +#ifndef GL_LUMINANCE6_ALPHA2_EXT +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#endif +#ifndef GL_LUMINANCE8_ALPHA8_EXT +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#endif +#ifndef GL_LUMINANCE12_ALPHA4_EXT +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#endif +#ifndef GL_LUMINANCE12_ALPHA12_EXT +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#endif +#ifndef GL_LUMINANCE16_ALPHA16_EXT +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#endif +#ifndef GL_INTENSITY_EXT +#define GL_INTENSITY_EXT 0x8049 +#endif +#ifndef GL_INTENSITY4_EXT +#define GL_INTENSITY4_EXT 0x804A +#endif +#ifndef GL_INTENSITY8_EXT +#define GL_INTENSITY8_EXT 0x804B +#endif +#ifndef GL_INTENSITY12_EXT +#define GL_INTENSITY12_EXT 0x804C +#endif +#ifndef GL_INTENSITY16_EXT +#define GL_INTENSITY16_EXT 0x804D +#endif +#ifndef GL_RGB2_EXT +#define GL_RGB2_EXT 0x804E +#endif +#ifndef GL_RGB4_EXT +#define GL_RGB4_EXT 0x804F +#endif +#ifndef GL_RGB5_EXT +#define GL_RGB5_EXT 0x8050 +#endif +#ifndef GL_RGB8_EXT +#define GL_RGB8_EXT 0x8051 +#endif +#ifndef GL_RGB10_EXT +#define GL_RGB10_EXT 0x8052 +#endif +#ifndef GL_RGB12_EXT +#define GL_RGB12_EXT 0x8053 +#endif +#ifndef GL_RGB16_EXT +#define GL_RGB16_EXT 0x8054 +#endif +#ifndef GL_RGBA2_EXT +#define GL_RGBA2_EXT 0x8055 +#endif +#ifndef GL_RGBA4_EXT +#define GL_RGBA4_EXT 0x8056 +#endif +#ifndef GL_RGB5_A1_EXT +#define GL_RGB5_A1_EXT 0x8057 +#endif +#ifndef GL_RGBA8_EXT +#define GL_RGBA8_EXT 0x8058 +#endif +#ifndef GL_RGB10_A2_EXT +#define GL_RGB10_A2_EXT 0x8059 +#endif +#ifndef GL_RGBA12_EXT +#define GL_RGBA12_EXT 0x805A +#endif +#ifndef GL_RGBA16_EXT +#define GL_RGBA16_EXT 0x805B +#endif +#ifndef GL_TEXTURE_RED_SIZE_EXT +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#endif +#ifndef GL_TEXTURE_GREEN_SIZE_EXT +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#endif +#ifndef GL_TEXTURE_BLUE_SIZE_EXT +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#endif +#ifndef GL_TEXTURE_ALPHA_SIZE_EXT +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#endif +#ifndef GL_TEXTURE_LUMINANCE_SIZE_EXT +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#endif +#ifndef GL_TEXTURE_INTENSITY_SIZE_EXT +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#endif +#ifndef GL_REPLACE_EXT +#define GL_REPLACE_EXT 0x8062 +#endif +#ifndef GL_PROXY_TEXTURE_1D_EXT +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#endif +#ifndef GL_PROXY_TEXTURE_2D_EXT +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#endif +#ifndef GL_TEXTURE_TOO_LARGE_EXT +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif +#ifndef GL_TEXTURE_PRIORITY_EXT +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#endif +#ifndef GL_TEXTURE_RESIDENT_EXT +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#endif +#ifndef GL_TEXTURE_1D_BINDING_EXT +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#endif +#ifndef GL_TEXTURE_2D_BINDING_EXT +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#endif +#ifndef GL_TEXTURE_3D_BINDING_EXT +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif +#ifndef GL_PACK_SKIP_IMAGES +#define GL_PACK_SKIP_IMAGES 0x806B +#endif +#ifndef GL_PACK_SKIP_IMAGES_EXT +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#endif +#ifndef GL_PACK_IMAGE_HEIGHT +#define GL_PACK_IMAGE_HEIGHT 0x806C +#endif +#ifndef GL_PACK_IMAGE_HEIGHT_EXT +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#endif +#ifndef GL_UNPACK_SKIP_IMAGES +#define GL_UNPACK_SKIP_IMAGES 0x806D +#endif +#ifndef GL_UNPACK_SKIP_IMAGES_EXT +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#endif +#ifndef GL_UNPACK_IMAGE_HEIGHT +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#endif +#ifndef GL_UNPACK_IMAGE_HEIGHT_EXT +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#endif +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif +#ifndef GL_TEXTURE_3D_EXT +#define GL_TEXTURE_3D_EXT 0x806F +#endif +#ifndef GL_PROXY_TEXTURE_3D +#define GL_PROXY_TEXTURE_3D 0x8070 +#endif +#ifndef GL_PROXY_TEXTURE_3D_EXT +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#endif +#ifndef GL_TEXTURE_DEPTH +#define GL_TEXTURE_DEPTH 0x8071 +#endif +#ifndef GL_TEXTURE_DEPTH_EXT +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#endif +#ifndef GL_TEXTURE_WRAP_R +#define GL_TEXTURE_WRAP_R 0x8072 +#endif +#ifndef GL_TEXTURE_WRAP_R_EXT +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#endif +#ifndef GL_MAX_3D_TEXTURE_SIZE +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#endif +#ifndef GL_MAX_3D_TEXTURE_SIZE_EXT +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif +#ifndef GL_VERTEX_ARRAY_EXT +#define GL_VERTEX_ARRAY_EXT 0x8074 +#endif +#ifndef GL_NORMAL_ARRAY_EXT +#define GL_NORMAL_ARRAY_EXT 0x8075 +#endif +#ifndef GL_COLOR_ARRAY_EXT +#define GL_COLOR_ARRAY_EXT 0x8076 +#endif +#ifndef GL_INDEX_ARRAY_EXT +#define GL_INDEX_ARRAY_EXT 0x8077 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_EXT +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_EXT +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#endif +#ifndef GL_VERTEX_ARRAY_SIZE_EXT +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#endif +#ifndef GL_VERTEX_ARRAY_TYPE_EXT +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#endif +#ifndef GL_VERTEX_ARRAY_STRIDE_EXT +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#endif +#ifndef GL_VERTEX_ARRAY_COUNT_EXT +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#endif +#ifndef GL_NORMAL_ARRAY_TYPE_EXT +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#endif +#ifndef GL_NORMAL_ARRAY_STRIDE_EXT +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#endif +#ifndef GL_NORMAL_ARRAY_COUNT_EXT +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#endif +#ifndef GL_COLOR_ARRAY_SIZE_EXT +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#endif +#ifndef GL_COLOR_ARRAY_TYPE_EXT +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#endif +#ifndef GL_COLOR_ARRAY_STRIDE_EXT +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#endif +#ifndef GL_COLOR_ARRAY_COUNT_EXT +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#endif +#ifndef GL_INDEX_ARRAY_TYPE_EXT +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#endif +#ifndef GL_INDEX_ARRAY_STRIDE_EXT +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#endif +#ifndef GL_INDEX_ARRAY_COUNT_EXT +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_SIZE_EXT +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_TYPE_EXT +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_STRIDE_EXT +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_COUNT_EXT +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#endif +#ifndef GL_EDGE_FLAG_ARRAY_STRIDE_EXT +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#endif +#ifndef GL_EDGE_FLAG_ARRAY_COUNT_EXT +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#endif +#ifndef GL_VERTEX_ARRAY_POINTER_EXT +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#endif +#ifndef GL_NORMAL_ARRAY_POINTER_EXT +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#endif +#ifndef GL_COLOR_ARRAY_POINTER_EXT +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#endif +#ifndef GL_INDEX_ARRAY_POINTER_EXT +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_POINTER_EXT +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_POINTER_EXT +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif +#ifndef GL_INTERLACE_SGIX +#define GL_INTERLACE_SGIX 0x8094 +#endif +#ifndef GL_DETAIL_TEXTURE_2D_SGIS +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#endif +#ifndef GL_DETAIL_TEXTURE_2D_BINDING_SGIS +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#endif +#ifndef GL_LINEAR_DETAIL_SGIS +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#endif +#ifndef GL_LINEAR_DETAIL_ALPHA_SGIS +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#endif +#ifndef GL_LINEAR_DETAIL_COLOR_SGIS +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#endif +#ifndef GL_DETAIL_TEXTURE_LEVEL_SGIS +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#endif +#ifndef GL_DETAIL_TEXTURE_MODE_SGIS +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#endif +#ifndef GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif +#ifndef GL_MULTISAMPLE +#define GL_MULTISAMPLE 0x809D +#endif +#ifndef GL_MULTISAMPLE_ARB +#define GL_MULTISAMPLE_ARB 0x809D +#endif +#ifndef GL_SAMPLE_ALPHA_TO_COVERAGE +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_COVERAGE_ARB +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE_ARB +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#endif +#ifndef GL_SAMPLE_COVERAGE +#define GL_SAMPLE_COVERAGE 0x80A0 +#endif +#ifndef GL_SAMPLE_COVERAGE_ARB +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#endif +#ifndef GL_SAMPLE_BUFFERS +#define GL_SAMPLE_BUFFERS 0x80A8 +#endif +#ifndef GL_SAMPLE_BUFFERS_ARB +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#endif +#ifndef GL_SAMPLES +#define GL_SAMPLES 0x80A9 +#endif +#ifndef GL_SAMPLES_ARB +#define GL_SAMPLES_ARB 0x80A9 +#endif +#ifndef GL_SAMPLE_COVERAGE_VALUE +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#endif +#ifndef GL_SAMPLE_COVERAGE_VALUE_ARB +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#endif +#ifndef GL_SAMPLE_COVERAGE_INVERT +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#endif +#ifndef GL_SAMPLE_COVERAGE_INVERT_ARB +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#endif +#ifndef GL_MULTISAMPLE_SGIS +#define GL_MULTISAMPLE_SGIS 0x809D +#endif +#ifndef GL_SAMPLE_ALPHA_TO_MASK_SGIS +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE_SGIS +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#endif +#ifndef GL_SAMPLE_MASK_SGIS +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#endif +#ifndef GL_1PASS_SGIS +#define GL_1PASS_SGIS 0x80A1 +#endif +#ifndef GL_2PASS_0_SGIS +#define GL_2PASS_0_SGIS 0x80A2 +#endif +#ifndef GL_2PASS_1_SGIS +#define GL_2PASS_1_SGIS 0x80A3 +#endif +#ifndef GL_4PASS_0_SGIS +#define GL_4PASS_0_SGIS 0x80A4 +#endif +#ifndef GL_4PASS_1_SGIS +#define GL_4PASS_1_SGIS 0x80A5 +#endif +#ifndef GL_4PASS_2_SGIS +#define GL_4PASS_2_SGIS 0x80A6 +#endif +#ifndef GL_4PASS_3_SGIS +#define GL_4PASS_3_SGIS 0x80A7 +#endif +#ifndef GL_SAMPLE_BUFFERS_SGIS +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#endif +#ifndef GL_SAMPLES_SGIS +#define GL_SAMPLES_SGIS 0x80A9 +#endif +#ifndef GL_SAMPLE_MASK_VALUE_SGIS +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#endif +#ifndef GL_SAMPLE_MASK_INVERT_SGIS +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#endif +#ifndef GL_SAMPLE_PATTERN_SGIS +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif +#ifndef GL_LINEAR_SHARPEN_SGIS +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#endif +#ifndef GL_LINEAR_SHARPEN_ALPHA_SGIS +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#endif +#ifndef GL_LINEAR_SHARPEN_COLOR_SGIS +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#endif +#ifndef GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif +#ifndef GL_COLOR_MATRIX +#define GL_COLOR_MATRIX 0x80B1 +#endif +#ifndef GL_COLOR_MATRIX_SGI +#define GL_COLOR_MATRIX_SGI 0x80B1 +#endif +#ifndef GL_COLOR_MATRIX_STACK_DEPTH +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#endif +#ifndef GL_COLOR_MATRIX_STACK_DEPTH_SGI +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#endif +#ifndef GL_MAX_COLOR_MATRIX_STACK_DEPTH +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#endif +#ifndef GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_SCALE +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_SCALE_SGI +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_SCALE +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_SCALE +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_SCALE +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_BIAS +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_BIAS_SGI +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_BIAS +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_BIAS +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_BIAS +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif +#ifndef GL_TEXTURE_COLOR_TABLE_SGI +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#endif +#ifndef GL_PROXY_TEXTURE_COLOR_TABLE_SGI +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif +#ifndef GL_TEXTURE_ENV_BIAS_SGIX +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif +#ifndef GL_SHADOW_AMBIENT_SGIX +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif +#ifndef GL_COLOR_TABLE +#define GL_COLOR_TABLE 0x80D0 +#endif +#ifndef GL_COLOR_TABLE_SGI +#define GL_COLOR_TABLE_SGI 0x80D0 +#endif +#ifndef GL_POST_CONVOLUTION_COLOR_TABLE +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#endif +#ifndef GL_POST_CONVOLUTION_COLOR_TABLE_SGI +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#endif +#ifndef GL_POST_COLOR_MATRIX_COLOR_TABLE +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#endif +#ifndef GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#endif +#ifndef GL_PROXY_COLOR_TABLE +#define GL_PROXY_COLOR_TABLE 0x80D3 +#endif +#ifndef GL_PROXY_COLOR_TABLE_SGI +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#endif +#ifndef GL_PROXY_POST_CONVOLUTION_COLOR_TABLE +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#endif +#ifndef GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#endif +#ifndef GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#endif +#ifndef GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#endif +#ifndef GL_COLOR_TABLE_SCALE +#define GL_COLOR_TABLE_SCALE 0x80D6 +#endif +#ifndef GL_COLOR_TABLE_SCALE_SGI +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#endif +#ifndef GL_COLOR_TABLE_BIAS +#define GL_COLOR_TABLE_BIAS 0x80D7 +#endif +#ifndef GL_COLOR_TABLE_BIAS_SGI +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#endif +#ifndef GL_COLOR_TABLE_FORMAT +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#endif +#ifndef GL_COLOR_TABLE_FORMAT_SGI +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#endif +#ifndef GL_COLOR_TABLE_WIDTH +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#endif +#ifndef GL_COLOR_TABLE_WIDTH_SGI +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#endif +#ifndef GL_COLOR_TABLE_RED_SIZE +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#endif +#ifndef GL_COLOR_TABLE_RED_SIZE_SGI +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#endif +#ifndef GL_COLOR_TABLE_GREEN_SIZE +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#endif +#ifndef GL_COLOR_TABLE_GREEN_SIZE_SGI +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#endif +#ifndef GL_COLOR_TABLE_BLUE_SIZE +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#endif +#ifndef GL_COLOR_TABLE_BLUE_SIZE_SGI +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#endif +#ifndef GL_COLOR_TABLE_ALPHA_SIZE +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#endif +#ifndef GL_COLOR_TABLE_ALPHA_SIZE_SGI +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#endif +#ifndef GL_COLOR_TABLE_LUMINANCE_SIZE +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#endif +#ifndef GL_COLOR_TABLE_LUMINANCE_SIZE_SGI +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#endif +#ifndef GL_COLOR_TABLE_INTENSITY_SIZE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#endif +#ifndef GL_COLOR_TABLE_INTENSITY_SIZE_SGI +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif +#ifndef GL_BGR +#define GL_BGR 0x80E0 +#endif +#ifndef GL_BGR_EXT +#define GL_BGR_EXT 0x80E0 +#endif +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_BGRA_EXT +#define GL_BGRA_EXT 0x80E1 +#endif +#ifndef GL_MAX_ELEMENTS_VERTICES +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#endif +#ifndef GL_MAX_ELEMENTS_INDICES +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#endif +#ifndef GL_DUAL_ALPHA4_SGIS +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#endif +#ifndef GL_DUAL_ALPHA8_SGIS +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#endif +#ifndef GL_DUAL_ALPHA12_SGIS +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#endif +#ifndef GL_DUAL_ALPHA16_SGIS +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#endif +#ifndef GL_DUAL_LUMINANCE4_SGIS +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#endif +#ifndef GL_DUAL_LUMINANCE8_SGIS +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#endif +#ifndef GL_DUAL_LUMINANCE12_SGIS +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#endif +#ifndef GL_DUAL_LUMINANCE16_SGIS +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#endif +#ifndef GL_DUAL_INTENSITY4_SGIS +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#endif +#ifndef GL_DUAL_INTENSITY8_SGIS +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#endif +#ifndef GL_DUAL_INTENSITY12_SGIS +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#endif +#ifndef GL_DUAL_INTENSITY16_SGIS +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#endif +#ifndef GL_DUAL_LUMINANCE_ALPHA4_SGIS +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#endif +#ifndef GL_DUAL_LUMINANCE_ALPHA8_SGIS +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#endif +#ifndef GL_QUAD_ALPHA4_SGIS +#define GL_QUAD_ALPHA4_SGIS 0x811E +#endif +#ifndef GL_QUAD_ALPHA8_SGIS +#define GL_QUAD_ALPHA8_SGIS 0x811F +#endif +#ifndef GL_QUAD_LUMINANCE4_SGIS +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#endif +#ifndef GL_QUAD_LUMINANCE8_SGIS +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#endif +#ifndef GL_QUAD_INTENSITY4_SGIS +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#endif +#ifndef GL_QUAD_INTENSITY8_SGIS +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#endif +#ifndef GL_DUAL_TEXTURE_SELECT_SGIS +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#endif +#ifndef GL_QUAD_TEXTURE_SELECT_SGIS +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif +#ifndef GL_POINT_SIZE_MIN +#define GL_POINT_SIZE_MIN 0x8126 +#endif +#ifndef GL_POINT_SIZE_MIN_ARB +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#endif +#ifndef GL_POINT_SIZE_MIN_EXT +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#endif +#ifndef GL_POINT_SIZE_MIN_SGIS +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#endif +#ifndef GL_POINT_SIZE_MAX +#define GL_POINT_SIZE_MAX 0x8127 +#endif +#ifndef GL_POINT_SIZE_MAX_ARB +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#endif +#ifndef GL_POINT_SIZE_MAX_EXT +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#endif +#ifndef GL_POINT_SIZE_MAX_SGIS +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE_ARB +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE_EXT +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE_SGIS +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#endif +#ifndef GL_POINT_DISTANCE_ATTENUATION +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#endif +#ifndef GL_POINT_DISTANCE_ATTENUATION_ARB +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif +#ifndef GL_DISTANCE_ATTENUATION_EXT +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif +#ifndef GL_DISTANCE_ATTENUATION_SGIS +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif +#ifndef GL_FOG_FUNC_SGIS +#define GL_FOG_FUNC_SGIS 0x812A +#endif +#ifndef GL_FOG_FUNC_POINTS_SGIS +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#endif +#ifndef GL_MAX_FOG_FUNC_POINTS_SGIS +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif +#ifndef GL_CLAMP_TO_BORDER +#define GL_CLAMP_TO_BORDER 0x812D +#endif +#ifndef GL_CLAMP_TO_BORDER_ARB +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif +#ifndef GL_CLAMP_TO_BORDER_SGIS +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif +#ifndef GL_TEXTURE_MULTI_BUFFER_HINT_SGIX +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif +#ifndef GL_CLAMP_TO_EDGE_SGIS +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif +#ifndef GL_PACK_SKIP_VOLUMES_SGIS +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#endif +#ifndef GL_PACK_IMAGE_DEPTH_SGIS +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#endif +#ifndef GL_UNPACK_SKIP_VOLUMES_SGIS +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#endif +#ifndef GL_UNPACK_IMAGE_DEPTH_SGIS +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#endif +#ifndef GL_TEXTURE_4D_SGIS +#define GL_TEXTURE_4D_SGIS 0x8134 +#endif +#ifndef GL_PROXY_TEXTURE_4D_SGIS +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#endif +#ifndef GL_TEXTURE_4DSIZE_SGIS +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#endif +#ifndef GL_TEXTURE_WRAP_Q_SGIS +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#endif +#ifndef GL_MAX_4D_TEXTURE_SIZE_SGIS +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#endif +#ifndef GL_TEXTURE_4D_BINDING_SGIS +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif +#ifndef GL_PIXEL_TEX_GEN_SGIX +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#endif +#ifndef GL_PIXEL_TEX_GEN_MODE_SGIX +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif +#ifndef GL_TEXTURE_MIN_LOD +#define GL_TEXTURE_MIN_LOD 0x813A +#endif +#ifndef GL_TEXTURE_MIN_LOD_SGIS +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#endif +#ifndef GL_TEXTURE_MAX_LOD +#define GL_TEXTURE_MAX_LOD 0x813B +#endif +#ifndef GL_TEXTURE_MAX_LOD_SGIS +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#endif +#ifndef GL_TEXTURE_BASE_LEVEL +#define GL_TEXTURE_BASE_LEVEL 0x813C +#endif +#ifndef GL_TEXTURE_BASE_LEVEL_SGIS +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#endif +#ifndef GL_TEXTURE_MAX_LEVEL +#define GL_TEXTURE_MAX_LEVEL 0x813D +#endif +#ifndef GL_TEXTURE_MAX_LEVEL_SGIS +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif +#ifndef GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#endif +#ifndef GL_PIXEL_TILE_CACHE_INCREMENT_SGIX +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#endif +#ifndef GL_PIXEL_TILE_WIDTH_SGIX +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#endif +#ifndef GL_PIXEL_TILE_HEIGHT_SGIX +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#endif +#ifndef GL_PIXEL_TILE_GRID_WIDTH_SGIX +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#endif +#ifndef GL_PIXEL_TILE_GRID_HEIGHT_SGIX +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#endif +#ifndef GL_PIXEL_TILE_GRID_DEPTH_SGIX +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#endif +#ifndef GL_PIXEL_TILE_CACHE_SIZE_SGIX +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif +#ifndef GL_FILTER4_SGIS +#define GL_FILTER4_SGIS 0x8146 +#endif +#ifndef GL_TEXTURE_FILTER4_SIZE_SGIS +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif +#ifndef GL_SPRITE_SGIX +#define GL_SPRITE_SGIX 0x8148 +#endif +#ifndef GL_SPRITE_MODE_SGIX +#define GL_SPRITE_MODE_SGIX 0x8149 +#endif +#ifndef GL_SPRITE_AXIS_SGIX +#define GL_SPRITE_AXIS_SGIX 0x814A +#endif +#ifndef GL_SPRITE_TRANSLATION_SGIX +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#endif +#ifndef GL_SPRITE_AXIAL_SGIX +#define GL_SPRITE_AXIAL_SGIX 0x814C +#endif +#ifndef GL_SPRITE_OBJECT_ALIGNED_SGIX +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#endif +#ifndef GL_SPRITE_EYE_ALIGNED_SGIX +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif +#ifndef GL_IGNORE_BORDER_HP +#define GL_IGNORE_BORDER_HP 0x8150 +#endif +#ifndef GL_CONSTANT_BORDER +#define GL_CONSTANT_BORDER 0x8151 +#endif +#ifndef GL_CONSTANT_BORDER_HP +#define GL_CONSTANT_BORDER_HP 0x8151 +#endif +#ifndef GL_REPLICATE_BORDER +#define GL_REPLICATE_BORDER 0x8153 +#endif +#ifndef GL_REPLICATE_BORDER_HP +#define GL_REPLICATE_BORDER_HP 0x8153 +#endif +#ifndef GL_CONVOLUTION_BORDER_COLOR +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif +#ifndef GL_CONVOLUTION_BORDER_COLOR_HP +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif +#ifndef GL_LINEAR_CLIPMAP_LINEAR_SGIX +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#endif +#ifndef GL_TEXTURE_CLIPMAP_CENTER_SGIX +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#endif +#ifndef GL_TEXTURE_CLIPMAP_FRAME_SGIX +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#endif +#ifndef GL_TEXTURE_CLIPMAP_OFFSET_SGIX +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#endif +#ifndef GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#endif +#ifndef GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#endif +#ifndef GL_TEXTURE_CLIPMAP_DEPTH_SGIX +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#endif +#ifndef GL_MAX_CLIPMAP_DEPTH_SGIX +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#endif +#ifndef GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#endif +#ifndef GL_NEAREST_CLIPMAP_NEAREST_SGIX +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#endif +#ifndef GL_NEAREST_CLIPMAP_LINEAR_SGIX +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#endif +#ifndef GL_LINEAR_CLIPMAP_NEAREST_SGIX +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif +#ifndef GL_POST_TEXTURE_FILTER_BIAS_SGIX +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#endif +#ifndef GL_POST_TEXTURE_FILTER_SCALE_SGIX +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#endif +#ifndef GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#endif +#ifndef GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif +#ifndef GL_REFERENCE_PLANE_SGIX +#define GL_REFERENCE_PLANE_SGIX 0x817D +#endif +#ifndef GL_REFERENCE_PLANE_EQUATION_SGIX +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif +#ifndef GL_IR_INSTRUMENT1_SGIX +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif +#ifndef GL_INSTRUMENT_BUFFER_POINTER_SGIX +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#endif +#ifndef GL_INSTRUMENT_MEASUREMENTS_SGIX +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif +#ifndef GL_LIST_PRIORITY_SGIX +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif +#ifndef GL_CALLIGRAPHIC_FRAGMENT_SGIX +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif +#ifndef GL_PIXEL_TEX_GEN_Q_CEILING_SGIX +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#endif +#ifndef GL_PIXEL_TEX_GEN_Q_ROUND_SGIX +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#endif +#ifndef GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif +#ifndef GL_FRAMEZOOM_SGIX +#define GL_FRAMEZOOM_SGIX 0x818B +#endif +#ifndef GL_FRAMEZOOM_FACTOR_SGIX +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#endif +#ifndef GL_MAX_FRAMEZOOM_FACTOR_SGIX +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif +#ifndef GL_TEXTURE_LOD_BIAS_S_SGIX +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#endif +#ifndef GL_TEXTURE_LOD_BIAS_T_SGIX +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#endif +#ifndef GL_TEXTURE_LOD_BIAS_R_SGIX +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif +#ifndef GL_GENERATE_MIPMAP +#define GL_GENERATE_MIPMAP 0x8191 +#endif +#ifndef GL_GENERATE_MIPMAP_SGIS +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#endif +#ifndef GL_GENERATE_MIPMAP_HINT +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#endif +#ifndef GL_GENERATE_MIPMAP_HINT_SGIS +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif +#ifndef GL_GEOMETRY_DEFORMATION_SGIX +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#endif +#ifndef GL_TEXTURE_DEFORMATION_SGIX +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#endif +#ifndef GL_DEFORMATIONS_MASK_SGIX +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#endif +#ifndef GL_MAX_DEFORMATION_ORDER_SGIX +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif +#ifndef GL_FOG_OFFSET_SGIX +#define GL_FOG_OFFSET_SGIX 0x8198 +#endif +#ifndef GL_FOG_OFFSET_VALUE_SGIX +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif +#ifndef GL_TEXTURE_COMPARE_SGIX +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#endif +#ifndef GL_TEXTURE_COMPARE_OPERATOR_SGIX +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#endif +#ifndef GL_TEXTURE_LEQUAL_R_SGIX +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#endif +#ifndef GL_TEXTURE_GEQUAL_R_SGIX +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif +#ifndef GL_DEPTH_COMPONENT16 +#define GL_DEPTH_COMPONENT16 0x81A5 +#endif +#ifndef GL_DEPTH_COMPONENT16_SGIX +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#endif +#ifndef GL_DEPTH_COMPONENT24 +#define GL_DEPTH_COMPONENT24 0x81A6 +#endif +#ifndef GL_DEPTH_COMPONENT24_SGIX +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#endif +#ifndef GL_DEPTH_COMPONENT32 +#define GL_DEPTH_COMPONENT32 0x81A7 +#endif +#ifndef GL_DEPTH_COMPONENT32_SGIX +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif +#ifndef GL_YCRCB_422_SGIX +#define GL_YCRCB_422_SGIX 0x81BB +#endif +#ifndef GL_YCRCB_444_SGIX +#define GL_YCRCB_444_SGIX 0x81BC +#endif +#ifndef GL_TEXTURE_COLOR_WRITEMASK_SGIS +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif +#ifndef GL_EYE_DISTANCE_TO_POINT_SGIS +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#endif +#ifndef GL_OBJECT_DISTANCE_TO_POINT_SGIS +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#endif +#ifndef GL_EYE_DISTANCE_TO_LINE_SGIS +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#endif +#ifndef GL_OBJECT_DISTANCE_TO_LINE_SGIS +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#endif +#ifndef GL_EYE_POINT_SGIS +#define GL_EYE_POINT_SGIS 0x81F4 +#endif +#ifndef GL_OBJECT_POINT_SGIS +#define GL_OBJECT_POINT_SGIS 0x81F5 +#endif +#ifndef GL_EYE_LINE_SGIS +#define GL_EYE_LINE_SGIS 0x81F6 +#endif +#ifndef GL_OBJECT_LINE_SGIS +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif +#ifndef GL_LIGHT_MODEL_COLOR_CONTROL +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#endif +#ifndef GL_LIGHT_MODEL_COLOR_CONTROL_EXT +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#endif +#ifndef GL_SINGLE_COLOR +#define GL_SINGLE_COLOR 0x81F9 +#endif +#ifndef GL_SINGLE_COLOR_EXT +#define GL_SINGLE_COLOR_EXT 0x81F9 +#endif +#ifndef GL_SEPARATE_SPECULAR_COLOR +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#endif +#ifndef GL_SEPARATE_SPECULAR_COLOR_EXT +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif +#ifndef GL_SHARED_TEXTURE_PALETTE_EXT +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif +#ifndef GL_CONVOLUTION_HINT_SGIX +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif +#ifndef GL_ALPHA_MIN_SGIX +#define GL_ALPHA_MIN_SGIX 0x8320 +#endif +#ifndef GL_ALPHA_MAX_SGIX +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif +#ifndef GL_ASYNC_MARKER_SGIX +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif +#ifndef GL_ASYNC_HISTOGRAM_SGIX +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#endif +#ifndef GL_MAX_ASYNC_HISTOGRAM_SGIX +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif +#ifndef GL_PIXEL_TRANSFORM_2D_EXT +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#endif +#ifndef GL_PIXEL_MAG_FILTER_EXT +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#endif +#ifndef GL_PIXEL_MIN_FILTER_EXT +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#endif +#ifndef GL_PIXEL_CUBIC_WEIGHT_EXT +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#endif +#ifndef GL_CUBIC_EXT +#define GL_CUBIC_EXT 0x8334 +#endif +#ifndef GL_AVERAGE_EXT +#define GL_AVERAGE_EXT 0x8335 +#endif +#ifndef GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#endif +#ifndef GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#endif +#ifndef GL_PIXEL_TRANSFORM_2D_MATRIX_EXT +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif +#ifndef GL_PIXEL_TEXTURE_SGIS +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#endif +#ifndef GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#endif +#ifndef GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#endif +#ifndef GL_PIXEL_GROUP_COLOR_SGIS +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif +#ifndef GL_ASYNC_TEX_IMAGE_SGIX +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#endif +#ifndef GL_ASYNC_DRAW_PIXELS_SGIX +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#endif +#ifndef GL_ASYNC_READ_PIXELS_SGIX +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#endif +#ifndef GL_MAX_ASYNC_TEX_IMAGE_SGIX +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#endif +#ifndef GL_MAX_ASYNC_DRAW_PIXELS_SGIX +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#endif +#ifndef GL_MAX_ASYNC_READ_PIXELS_SGIX +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif +#ifndef GL_TEXTURE_MAX_CLAMP_S_SGIX +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#endif +#ifndef GL_TEXTURE_MAX_CLAMP_T_SGIX +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#endif +#ifndef GL_TEXTURE_MAX_CLAMP_R_SGIX +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif +#ifndef GL_FOG_FACTOR_TO_ALPHA_SGIX +#define GL_FOG_FACTOR_TO_ALPHA_SGIX 0x836F +#endif +#ifndef GL_VERTEX_PRECLIP_SGIX +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#endif +#ifndef GL_VERTEX_PRECLIP_HINT_SGIX +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif +#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif +#ifndef GL_PARALLEL_ARRAYS_INTEL +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#endif +#ifndef GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#endif +#ifndef GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#endif +#ifndef GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif +#ifndef GL_FRAGMENT_LIGHTING_SGIX +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#endif +#ifndef GL_FRAGMENT_COLOR_MATERIAL_SGIX +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#endif +#ifndef GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#endif +#ifndef GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#endif +#ifndef GL_MAX_FRAGMENT_LIGHTS_SGIX +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#endif +#ifndef GL_MAX_ACTIVE_LIGHTS_SGIX +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#endif +#ifndef GL_CURRENT_RASTER_NORMAL_SGIX +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#endif +#ifndef GL_LIGHT_ENV_MODE_SGIX +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#endif +#ifndef GL_FRAGMENT_LIGHT0_SGIX +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#endif +#ifndef GL_FRAGMENT_LIGHT1_SGIX +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#endif +#ifndef GL_FRAGMENT_LIGHT2_SGIX +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#endif +#ifndef GL_FRAGMENT_LIGHT3_SGIX +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#endif +#ifndef GL_FRAGMENT_LIGHT4_SGIX +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#endif +#ifndef GL_FRAGMENT_LIGHT5_SGIX +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#endif +#ifndef GL_FRAGMENT_LIGHT6_SGIX +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#endif +#ifndef GL_FRAGMENT_LIGHT7_SGIX +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif +#ifndef GL_PACK_RESAMPLE_SGIX +#define GL_PACK_RESAMPLE_SGIX 0x842C +#endif +#ifndef GL_UNPACK_RESAMPLE_SGIX +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#endif +#ifndef GL_RESAMPLE_REPLICATE_SGIX +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#endif +#ifndef GL_RESAMPLE_ZERO_FILL_SGIX +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#endif +#ifndef GL_RESAMPLE_DECIMATE_SGIX +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif +#ifndef GL_SMOOTH_POINT_SIZE_RANGE +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#endif +#ifndef GL_SMOOTH_POINT_SIZE_GRANULARITY +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#endif +#ifndef GL_SMOOTH_LINE_WIDTH_RANGE +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#endif +#ifndef GL_SMOOTH_LINE_WIDTH_GRANULARITY +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#endif +#ifndef GL_ALIASED_POINT_SIZE_RANGE +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#endif +#ifndef GL_ALIASED_LINE_WIDTH_RANGE +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif +#ifndef GL_PACK_SUBSAMPLE_RATE_SGIX +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#endif +#ifndef GL_UNPACK_SUBSAMPLE_RATE_SGIX +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_4444_SGIX +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_2424_SGIX +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_4242_SGIX +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif +#ifndef GL_UNSIGNED_BYTE_3_3_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#endif +#ifndef GL_UNSIGNED_SHORT_5_5_5_1 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#endif +#ifndef GL_UNSIGNED_INT_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#endif +#ifndef GL_RESCALE_NORMAL +#define GL_RESCALE_NORMAL 0x803A +#endif +#ifndef GL_TEXTURE_BINDING_3D +#define GL_TEXTURE_BINDING_3D 0x806A +#endif +#ifndef GL_PACK_SKIP_IMAGES +#define GL_PACK_SKIP_IMAGES 0x806B +#endif +#ifndef GL_PACK_IMAGE_HEIGHT +#define GL_PACK_IMAGE_HEIGHT 0x806C +#endif +#ifndef GL_UNPACK_SKIP_IMAGES +#define GL_UNPACK_SKIP_IMAGES 0x806D +#endif +#ifndef GL_UNPACK_IMAGE_HEIGHT +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#endif +#ifndef GL_TEXTURE_3D +#define GL_TEXTURE_3D 0x806F +#endif +#ifndef GL_PROXY_TEXTURE_3D +#define GL_PROXY_TEXTURE_3D 0x8070 +#endif +#ifndef GL_TEXTURE_DEPTH +#define GL_TEXTURE_DEPTH 0x8071 +#endif +#ifndef GL_TEXTURE_WRAP_R +#define GL_TEXTURE_WRAP_R 0x8072 +#endif +#ifndef GL_MAX_3D_TEXTURE_SIZE +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#endif +#ifndef GL_UNSIGNED_BYTE_2_3_3_REV +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5_REV +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4_REV +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#endif +#ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8_REV +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#endif +#ifndef GL_UNSIGNED_INT_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#endif +#ifndef GL_BGR +#define GL_BGR 0x80E0 +#endif +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_MAX_ELEMENTS_VERTICES +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#endif +#ifndef GL_MAX_ELEMENTS_INDICES +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#endif +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif +#ifndef GL_TEXTURE_MIN_LOD +#define GL_TEXTURE_MIN_LOD 0x813A +#endif +#ifndef GL_TEXTURE_MAX_LOD +#define GL_TEXTURE_MAX_LOD 0x813B +#endif +#ifndef GL_TEXTURE_BASE_LEVEL +#define GL_TEXTURE_BASE_LEVEL 0x813C +#endif +#ifndef GL_TEXTURE_MAX_LEVEL +#define GL_TEXTURE_MAX_LEVEL 0x813D +#endif +#ifndef GL_LIGHT_MODEL_COLOR_CONTROL +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#endif +#ifndef GL_SINGLE_COLOR +#define GL_SINGLE_COLOR 0x81F9 +#endif +#ifndef GL_SEPARATE_SPECULAR_COLOR +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#endif +#ifndef GL_SMOOTH_POINT_SIZE_RANGE +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#endif +#ifndef GL_SMOOTH_POINT_SIZE_GRANULARITY +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#endif +#ifndef GL_SMOOTH_LINE_WIDTH_RANGE +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#endif +#ifndef GL_SMOOTH_LINE_WIDTH_GRANULARITY +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#endif +#ifndef GL_ALIASED_POINT_SIZE_RANGE +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#endif +#ifndef GL_ALIASED_LINE_WIDTH_RANGE +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif +#ifndef GL_CONSTANT_COLOR +#define GL_CONSTANT_COLOR 0x8001 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_COLOR +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#endif +#ifndef GL_CONSTANT_ALPHA +#define GL_CONSTANT_ALPHA 0x8003 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#endif +#ifndef GL_BLEND_COLOR +#define GL_BLEND_COLOR 0x8005 +#endif +#ifndef GL_FUNC_ADD +#define GL_FUNC_ADD 0x8006 +#endif +#ifndef GL_MIN +#define GL_MIN 0x8007 +#endif +#ifndef GL_MAX +#define GL_MAX 0x8008 +#endif +#ifndef GL_BLEND_EQUATION +#define GL_BLEND_EQUATION 0x8009 +#endif +#ifndef GL_FUNC_SUBTRACT +#define GL_FUNC_SUBTRACT 0x800A +#endif +#ifndef GL_FUNC_REVERSE_SUBTRACT +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif +#ifndef GL_CONVOLUTION_1D +#define GL_CONVOLUTION_1D 0x8010 +#endif +#ifndef GL_CONVOLUTION_2D +#define GL_CONVOLUTION_2D 0x8011 +#endif +#ifndef GL_SEPARABLE_2D +#define GL_SEPARABLE_2D 0x8012 +#endif +#ifndef GL_CONVOLUTION_BORDER_MODE +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#endif +#ifndef GL_CONVOLUTION_FILTER_SCALE +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#endif +#ifndef GL_CONVOLUTION_FILTER_BIAS +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#endif +#ifndef GL_REDUCE +#define GL_REDUCE 0x8016 +#endif +#ifndef GL_CONVOLUTION_FORMAT +#define GL_CONVOLUTION_FORMAT 0x8017 +#endif +#ifndef GL_CONVOLUTION_WIDTH +#define GL_CONVOLUTION_WIDTH 0x8018 +#endif +#ifndef GL_CONVOLUTION_HEIGHT +#define GL_CONVOLUTION_HEIGHT 0x8019 +#endif +#ifndef GL_MAX_CONVOLUTION_WIDTH +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#endif +#ifndef GL_MAX_CONVOLUTION_HEIGHT +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#endif +#ifndef GL_POST_CONVOLUTION_RED_SCALE +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_SCALE +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_SCALE +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_SCALE +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#endif +#ifndef GL_POST_CONVOLUTION_RED_BIAS +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_BIAS +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_BIAS +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_BIAS +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#endif +#ifndef GL_HISTOGRAM +#define GL_HISTOGRAM 0x8024 +#endif +#ifndef GL_PROXY_HISTOGRAM +#define GL_PROXY_HISTOGRAM 0x8025 +#endif +#ifndef GL_HISTOGRAM_WIDTH +#define GL_HISTOGRAM_WIDTH 0x8026 +#endif +#ifndef GL_HISTOGRAM_FORMAT +#define GL_HISTOGRAM_FORMAT 0x8027 +#endif +#ifndef GL_HISTOGRAM_RED_SIZE +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#endif +#ifndef GL_HISTOGRAM_GREEN_SIZE +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#endif +#ifndef GL_HISTOGRAM_BLUE_SIZE +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#endif +#ifndef GL_HISTOGRAM_ALPHA_SIZE +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#endif +#ifndef GL_HISTOGRAM_LUMINANCE_SIZE +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#endif +#ifndef GL_HISTOGRAM_SINK +#define GL_HISTOGRAM_SINK 0x802D +#endif +#ifndef GL_MINMAX +#define GL_MINMAX 0x802E +#endif +#ifndef GL_MINMAX_FORMAT +#define GL_MINMAX_FORMAT 0x802F +#endif +#ifndef GL_MINMAX_SINK +#define GL_MINMAX_SINK 0x8030 +#endif +#ifndef GL_TABLE_TOO_LARGE +#define GL_TABLE_TOO_LARGE 0x8031 +#endif +#ifndef GL_COLOR_MATRIX +#define GL_COLOR_MATRIX 0x80B1 +#endif +#ifndef GL_COLOR_MATRIX_STACK_DEPTH +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#endif +#ifndef GL_MAX_COLOR_MATRIX_STACK_DEPTH +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_SCALE +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_SCALE +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_SCALE +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_SCALE +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_BIAS +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_BIAS +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_BIAS +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_BIAS +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#endif +#ifndef GL_COLOR_TABLE +#define GL_COLOR_TABLE 0x80D0 +#endif +#ifndef GL_POST_CONVOLUTION_COLOR_TABLE +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#endif +#ifndef GL_POST_COLOR_MATRIX_COLOR_TABLE +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#endif +#ifndef GL_PROXY_COLOR_TABLE +#define GL_PROXY_COLOR_TABLE 0x80D3 +#endif +#ifndef GL_PROXY_POST_CONVOLUTION_COLOR_TABLE +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#endif +#ifndef GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#endif +#ifndef GL_COLOR_TABLE_SCALE +#define GL_COLOR_TABLE_SCALE 0x80D6 +#endif +#ifndef GL_COLOR_TABLE_BIAS +#define GL_COLOR_TABLE_BIAS 0x80D7 +#endif +#ifndef GL_COLOR_TABLE_FORMAT +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#endif +#ifndef GL_COLOR_TABLE_WIDTH +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#endif +#ifndef GL_COLOR_TABLE_RED_SIZE +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#endif +#ifndef GL_COLOR_TABLE_GREEN_SIZE +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#endif +#ifndef GL_COLOR_TABLE_BLUE_SIZE +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#endif +#ifndef GL_COLOR_TABLE_ALPHA_SIZE +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#endif +#ifndef GL_COLOR_TABLE_LUMINANCE_SIZE +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#endif +#ifndef GL_COLOR_TABLE_INTENSITY_SIZE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#endif +#ifndef GL_CONSTANT_BORDER +#define GL_CONSTANT_BORDER 0x8151 +#endif +#ifndef GL_REPLICATE_BORDER +#define GL_REPLICATE_BORDER 0x8153 +#endif +#ifndef GL_CONVOLUTION_BORDER_COLOR +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif +#ifndef GL_TEXTURE0 +#define GL_TEXTURE0 0x84C0 +#endif +#ifndef GL_TEXTURE1 +#define GL_TEXTURE1 0x84C1 +#endif +#ifndef GL_TEXTURE2 +#define GL_TEXTURE2 0x84C2 +#endif +#ifndef GL_TEXTURE3 +#define GL_TEXTURE3 0x84C3 +#endif +#ifndef GL_TEXTURE4 +#define GL_TEXTURE4 0x84C4 +#endif +#ifndef GL_TEXTURE5 +#define GL_TEXTURE5 0x84C5 +#endif +#ifndef GL_TEXTURE6 +#define GL_TEXTURE6 0x84C6 +#endif +#ifndef GL_TEXTURE7 +#define GL_TEXTURE7 0x84C7 +#endif +#ifndef GL_TEXTURE8 +#define GL_TEXTURE8 0x84C8 +#endif +#ifndef GL_TEXTURE9 +#define GL_TEXTURE9 0x84C9 +#endif +#ifndef GL_TEXTURE10 +#define GL_TEXTURE10 0x84CA +#endif +#ifndef GL_TEXTURE11 +#define GL_TEXTURE11 0x84CB +#endif +#ifndef GL_TEXTURE12 +#define GL_TEXTURE12 0x84CC +#endif +#ifndef GL_TEXTURE13 +#define GL_TEXTURE13 0x84CD +#endif +#ifndef GL_TEXTURE14 +#define GL_TEXTURE14 0x84CE +#endif +#ifndef GL_TEXTURE15 +#define GL_TEXTURE15 0x84CF +#endif +#ifndef GL_TEXTURE16 +#define GL_TEXTURE16 0x84D0 +#endif +#ifndef GL_TEXTURE17 +#define GL_TEXTURE17 0x84D1 +#endif +#ifndef GL_TEXTURE18 +#define GL_TEXTURE18 0x84D2 +#endif +#ifndef GL_TEXTURE19 +#define GL_TEXTURE19 0x84D3 +#endif +#ifndef GL_TEXTURE20 +#define GL_TEXTURE20 0x84D4 +#endif +#ifndef GL_TEXTURE21 +#define GL_TEXTURE21 0x84D5 +#endif +#ifndef GL_TEXTURE22 +#define GL_TEXTURE22 0x84D6 +#endif +#ifndef GL_TEXTURE23 +#define GL_TEXTURE23 0x84D7 +#endif +#ifndef GL_TEXTURE24 +#define GL_TEXTURE24 0x84D8 +#endif +#ifndef GL_TEXTURE25 +#define GL_TEXTURE25 0x84D9 +#endif +#ifndef GL_TEXTURE26 +#define GL_TEXTURE26 0x84DA +#endif +#ifndef GL_TEXTURE27 +#define GL_TEXTURE27 0x84DB +#endif +#ifndef GL_TEXTURE28 +#define GL_TEXTURE28 0x84DC +#endif +#ifndef GL_TEXTURE29 +#define GL_TEXTURE29 0x84DD +#endif +#ifndef GL_TEXTURE30 +#define GL_TEXTURE30 0x84DE +#endif +#ifndef GL_TEXTURE31 +#define GL_TEXTURE31 0x84DF +#endif +#ifndef GL_ACTIVE_TEXTURE +#define GL_ACTIVE_TEXTURE 0x84E0 +#endif +#ifndef GL_CLIENT_ACTIVE_TEXTURE +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#endif +#ifndef GL_MAX_TEXTURE_UNITS +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#endif +#ifndef GL_TRANSPOSE_MODELVIEW_MATRIX +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#endif +#ifndef GL_TRANSPOSE_PROJECTION_MATRIX +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#endif +#ifndef GL_TRANSPOSE_TEXTURE_MATRIX +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#endif +#ifndef GL_TRANSPOSE_COLOR_MATRIX +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#endif +#ifndef GL_MULTISAMPLE +#define GL_MULTISAMPLE 0x809D +#endif +#ifndef GL_SAMPLE_ALPHA_TO_COVERAGE +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#endif +#ifndef GL_SAMPLE_COVERAGE +#define GL_SAMPLE_COVERAGE 0x80A0 +#endif +#ifndef GL_SAMPLE_BUFFERS +#define GL_SAMPLE_BUFFERS 0x80A8 +#endif +#ifndef GL_SAMPLES +#define GL_SAMPLES 0x80A9 +#endif +#ifndef GL_SAMPLE_COVERAGE_VALUE +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#endif +#ifndef GL_SAMPLE_COVERAGE_INVERT +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#endif +#ifndef GL_MULTISAMPLE_BIT +#define GL_MULTISAMPLE_BIT 0x20000000 +#endif +#ifndef GL_NORMAL_MAP +#define GL_NORMAL_MAP 0x8511 +#endif +#ifndef GL_REFLECTION_MAP +#define GL_REFLECTION_MAP 0x8512 +#endif +#ifndef GL_TEXTURE_CUBE_MAP +#define GL_TEXTURE_CUBE_MAP 0x8513 +#endif +#ifndef GL_TEXTURE_BINDING_CUBE_MAP +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_X +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Y +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Y +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Z +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Z +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#endif +#ifndef GL_PROXY_TEXTURE_CUBE_MAP +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#endif +#ifndef GL_MAX_CUBE_MAP_TEXTURE_SIZE +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#endif +#ifndef GL_COMPRESSED_ALPHA +#define GL_COMPRESSED_ALPHA 0x84E9 +#endif +#ifndef GL_COMPRESSED_LUMINANCE +#define GL_COMPRESSED_LUMINANCE 0x84EA +#endif +#ifndef GL_COMPRESSED_LUMINANCE_ALPHA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#endif +#ifndef GL_COMPRESSED_INTENSITY +#define GL_COMPRESSED_INTENSITY 0x84EC +#endif +#ifndef GL_COMPRESSED_RGB +#define GL_COMPRESSED_RGB 0x84ED +#endif +#ifndef GL_COMPRESSED_RGBA +#define GL_COMPRESSED_RGBA 0x84EE +#endif +#ifndef GL_TEXTURE_COMPRESSION_HINT +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#endif +#ifndef GL_TEXTURE_COMPRESSED_IMAGE_SIZE +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#endif +#ifndef GL_TEXTURE_COMPRESSED +#define GL_TEXTURE_COMPRESSED 0x86A1 +#endif +#ifndef GL_NUM_COMPRESSED_TEXTURE_FORMATS +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#endif +#ifndef GL_COMPRESSED_TEXTURE_FORMATS +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#endif +#ifndef GL_CLAMP_TO_BORDER +#define GL_CLAMP_TO_BORDER 0x812D +#endif +#ifndef GL_COMBINE +#define GL_COMBINE 0x8570 +#endif +#ifndef GL_COMBINE_RGB +#define GL_COMBINE_RGB 0x8571 +#endif +#ifndef GL_COMBINE_ALPHA +#define GL_COMBINE_ALPHA 0x8572 +#endif +#ifndef GL_SOURCE0_RGB +#define GL_SOURCE0_RGB 0x8580 +#endif +#ifndef GL_SOURCE1_RGB +#define GL_SOURCE1_RGB 0x8581 +#endif +#ifndef GL_SOURCE2_RGB +#define GL_SOURCE2_RGB 0x8582 +#endif +#ifndef GL_SOURCE0_ALPHA +#define GL_SOURCE0_ALPHA 0x8588 +#endif +#ifndef GL_SOURCE1_ALPHA +#define GL_SOURCE1_ALPHA 0x8589 +#endif +#ifndef GL_SOURCE2_ALPHA +#define GL_SOURCE2_ALPHA 0x858A +#endif +#ifndef GL_OPERAND0_RGB +#define GL_OPERAND0_RGB 0x8590 +#endif +#ifndef GL_OPERAND1_RGB +#define GL_OPERAND1_RGB 0x8591 +#endif +#ifndef GL_OPERAND2_RGB +#define GL_OPERAND2_RGB 0x8592 +#endif +#ifndef GL_OPERAND0_ALPHA +#define GL_OPERAND0_ALPHA 0x8598 +#endif +#ifndef GL_OPERAND1_ALPHA +#define GL_OPERAND1_ALPHA 0x8599 +#endif +#ifndef GL_OPERAND2_ALPHA +#define GL_OPERAND2_ALPHA 0x859A +#endif +#ifndef GL_RGB_SCALE +#define GL_RGB_SCALE 0x8573 +#endif +#ifndef GL_ADD_SIGNED +#define GL_ADD_SIGNED 0x8574 +#endif +#ifndef GL_INTERPOLATE +#define GL_INTERPOLATE 0x8575 +#endif +#ifndef GL_SUBTRACT +#define GL_SUBTRACT 0x84E7 +#endif +#ifndef GL_CONSTANT +#define GL_CONSTANT 0x8576 +#endif +#ifndef GL_PRIMARY_COLOR +#define GL_PRIMARY_COLOR 0x8577 +#endif +#ifndef GL_PREVIOUS +#define GL_PREVIOUS 0x8578 +#endif +#ifndef GL_DOT3_RGB +#define GL_DOT3_RGB 0x86AE +#endif +#ifndef GL_DOT3_RGBA +#define GL_DOT3_RGBA 0x86AF +#endif +#ifndef GL_BLEND_DST_RGB +#define GL_BLEND_DST_RGB 0x80C8 +#endif +#ifndef GL_BLEND_SRC_RGB +#define GL_BLEND_SRC_RGB 0x80C9 +#endif +#ifndef GL_BLEND_DST_ALPHA +#define GL_BLEND_DST_ALPHA 0x80CA +#endif +#ifndef GL_BLEND_SRC_ALPHA +#define GL_BLEND_SRC_ALPHA 0x80CB +#endif +#ifndef GL_POINT_SIZE_MIN +#define GL_POINT_SIZE_MIN 0x8126 +#endif +#ifndef GL_POINT_SIZE_MAX +#define GL_POINT_SIZE_MAX 0x8127 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#endif +#ifndef GL_POINT_DISTANCE_ATTENUATION +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#endif +#ifndef GL_GENERATE_MIPMAP +#define GL_GENERATE_MIPMAP 0x8191 +#endif +#ifndef GL_GENERATE_MIPMAP_HINT +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#endif +#ifndef GL_DEPTH_COMPONENT16 +#define GL_DEPTH_COMPONENT16 0x81A5 +#endif +#ifndef GL_DEPTH_COMPONENT24 +#define GL_DEPTH_COMPONENT24 0x81A6 +#endif +#ifndef GL_DEPTH_COMPONENT32 +#define GL_DEPTH_COMPONENT32 0x81A7 +#endif +#ifndef GL_MIRRORED_REPEAT +#define GL_MIRRORED_REPEAT 0x8370 +#endif +#ifndef GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#endif +#ifndef GL_FOG_COORDINATE +#define GL_FOG_COORDINATE 0x8451 +#endif +#ifndef GL_FRAGMENT_DEPTH +#define GL_FRAGMENT_DEPTH 0x8452 +#endif +#ifndef GL_CURRENT_FOG_COORDINATE +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#endif +#ifndef GL_COLOR_SUM +#define GL_COLOR_SUM 0x8458 +#endif +#ifndef GL_CURRENT_SECONDARY_COLOR +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_SIZE +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_TYPE +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_STRIDE +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_POINTER +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#endif +#ifndef GL_MAX_TEXTURE_LOD_BIAS +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#endif +#ifndef GL_TEXTURE_FILTER_CONTROL +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#endif +#ifndef GL_TEXTURE_LOD_BIAS +#define GL_TEXTURE_LOD_BIAS 0x8501 +#endif +#ifndef GL_INCR_WRAP +#define GL_INCR_WRAP 0x8507 +#endif +#ifndef GL_DECR_WRAP +#define GL_DECR_WRAP 0x8508 +#endif +#ifndef GL_TEXTURE_DEPTH_SIZE +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#endif +#ifndef GL_DEPTH_TEXTURE_MODE +#define GL_DEPTH_TEXTURE_MODE 0x884B +#endif +#ifndef GL_TEXTURE_COMPARE_MODE +#define GL_TEXTURE_COMPARE_MODE 0x884C +#endif +#ifndef GL_TEXTURE_COMPARE_FUNC +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#endif +#ifndef GL_COMPARE_R_TO_TEXTURE +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif +#ifndef GL_BUFFER_SIZE +#define GL_BUFFER_SIZE 0x8764 +#endif +#ifndef GL_BUFFER_USAGE +#define GL_BUFFER_USAGE 0x8765 +#endif +#ifndef GL_QUERY_COUNTER_BITS +#define GL_QUERY_COUNTER_BITS 0x8864 +#endif +#ifndef GL_CURRENT_QUERY +#define GL_CURRENT_QUERY 0x8865 +#endif +#ifndef GL_QUERY_RESULT +#define GL_QUERY_RESULT 0x8866 +#endif +#ifndef GL_QUERY_RESULT_AVAILABLE +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#endif +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#endif +#ifndef GL_ARRAY_BUFFER_BINDING +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER_BINDING +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#endif +#ifndef GL_VERTEX_ARRAY_BUFFER_BINDING +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#endif +#ifndef GL_NORMAL_ARRAY_BUFFER_BINDING +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#endif +#ifndef GL_COLOR_ARRAY_BUFFER_BINDING +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#endif +#ifndef GL_INDEX_ARRAY_BUFFER_BINDING +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#endif +#ifndef GL_EDGE_FLAG_ARRAY_BUFFER_BINDING +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#endif +#ifndef GL_WEIGHT_ARRAY_BUFFER_BINDING +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#endif +#ifndef GL_READ_ONLY +#define GL_READ_ONLY 0x88B8 +#endif +#ifndef GL_WRITE_ONLY +#define GL_WRITE_ONLY 0x88B9 +#endif +#ifndef GL_READ_WRITE +#define GL_READ_WRITE 0x88BA +#endif +#ifndef GL_BUFFER_ACCESS +#define GL_BUFFER_ACCESS 0x88BB +#endif +#ifndef GL_BUFFER_MAPPED +#define GL_BUFFER_MAPPED 0x88BC +#endif +#ifndef GL_BUFFER_MAP_POINTER +#define GL_BUFFER_MAP_POINTER 0x88BD +#endif +#ifndef GL_STREAM_DRAW +#define GL_STREAM_DRAW 0x88E0 +#endif +#ifndef GL_STREAM_READ +#define GL_STREAM_READ 0x88E1 +#endif +#ifndef GL_STREAM_COPY +#define GL_STREAM_COPY 0x88E2 +#endif +#ifndef GL_STATIC_DRAW +#define GL_STATIC_DRAW 0x88E4 +#endif +#ifndef GL_STATIC_READ +#define GL_STATIC_READ 0x88E5 +#endif +#ifndef GL_STATIC_COPY +#define GL_STATIC_COPY 0x88E6 +#endif +#ifndef GL_DYNAMIC_DRAW +#define GL_DYNAMIC_DRAW 0x88E8 +#endif +#ifndef GL_DYNAMIC_READ +#define GL_DYNAMIC_READ 0x88E9 +#endif +#ifndef GL_DYNAMIC_COPY +#define GL_DYNAMIC_COPY 0x88EA +#endif +#ifndef GL_SAMPLES_PASSED +#define GL_SAMPLES_PASSED 0x8914 +#endif +#ifndef GL_FOG_COORD_SRC +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#endif +#ifndef GL_FOG_COORD +#define GL_FOG_COORD GL_FOG_COORDINATE +#endif +#ifndef GL_CURRENT_FOG_COORD +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#endif +#ifndef GL_FOG_COORD_ARRAY_TYPE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#endif +#ifndef GL_FOG_COORD_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#endif +#ifndef GL_FOG_COORD_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#endif +#ifndef GL_FOG_COORD_ARRAY +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#endif +#ifndef GL_FOG_COORD_ARRAY_BUFFER_BINDING +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#endif +#ifndef GL_SRC0_RGB +#define GL_SRC0_RGB GL_SOURCE0_RGB +#endif +#ifndef GL_SRC1_RGB +#define GL_SRC1_RGB GL_SOURCE1_RGB +#endif +#ifndef GL_SRC2_RGB +#define GL_SRC2_RGB GL_SOURCE2_RGB +#endif +#ifndef GL_SRC0_ALPHA +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#endif +#ifndef GL_SRC1_ALPHA +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#endif +#ifndef GL_SRC2_ALPHA +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif +#ifndef GL_BLEND_EQUATION_RGB +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_ENABLED +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_SIZE +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_STRIDE +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_TYPE +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#endif +#ifndef GL_CURRENT_VERTEX_ATTRIB +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#endif +#ifndef GL_VERTEX_PROGRAM_POINT_SIZE +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#endif +#ifndef GL_VERTEX_PROGRAM_TWO_SIDE +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_POINTER +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#endif +#ifndef GL_STENCIL_BACK_FUNC +#define GL_STENCIL_BACK_FUNC 0x8800 +#endif +#ifndef GL_STENCIL_BACK_FAIL +#define GL_STENCIL_BACK_FAIL 0x8801 +#endif +#ifndef GL_STENCIL_BACK_PASS_DEPTH_FAIL +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#endif +#ifndef GL_STENCIL_BACK_PASS_DEPTH_PASS +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#endif +#ifndef GL_MAX_DRAW_BUFFERS +#define GL_MAX_DRAW_BUFFERS 0x8824 +#endif +#ifndef GL_DRAW_BUFFER0 +#define GL_DRAW_BUFFER0 0x8825 +#endif +#ifndef GL_DRAW_BUFFER1 +#define GL_DRAW_BUFFER1 0x8826 +#endif +#ifndef GL_DRAW_BUFFER2 +#define GL_DRAW_BUFFER2 0x8827 +#endif +#ifndef GL_DRAW_BUFFER3 +#define GL_DRAW_BUFFER3 0x8828 +#endif +#ifndef GL_DRAW_BUFFER4 +#define GL_DRAW_BUFFER4 0x8829 +#endif +#ifndef GL_DRAW_BUFFER5 +#define GL_DRAW_BUFFER5 0x882A +#endif +#ifndef GL_DRAW_BUFFER6 +#define GL_DRAW_BUFFER6 0x882B +#endif +#ifndef GL_DRAW_BUFFER7 +#define GL_DRAW_BUFFER7 0x882C +#endif +#ifndef GL_DRAW_BUFFER8 +#define GL_DRAW_BUFFER8 0x882D +#endif +#ifndef GL_DRAW_BUFFER9 +#define GL_DRAW_BUFFER9 0x882E +#endif +#ifndef GL_DRAW_BUFFER10 +#define GL_DRAW_BUFFER10 0x882F +#endif +#ifndef GL_DRAW_BUFFER11 +#define GL_DRAW_BUFFER11 0x8830 +#endif +#ifndef GL_DRAW_BUFFER12 +#define GL_DRAW_BUFFER12 0x8831 +#endif +#ifndef GL_DRAW_BUFFER13 +#define GL_DRAW_BUFFER13 0x8832 +#endif +#ifndef GL_DRAW_BUFFER14 +#define GL_DRAW_BUFFER14 0x8833 +#endif +#ifndef GL_DRAW_BUFFER15 +#define GL_DRAW_BUFFER15 0x8834 +#endif +#ifndef GL_BLEND_EQUATION_ALPHA +#define GL_BLEND_EQUATION_ALPHA 0x883D +#endif +#ifndef GL_POINT_SPRITE +#define GL_POINT_SPRITE 0x8861 +#endif +#ifndef GL_COORD_REPLACE +#define GL_COORD_REPLACE 0x8862 +#endif +#ifndef GL_MAX_VERTEX_ATTRIBS +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_NORMALIZED +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#endif +#ifndef GL_MAX_TEXTURE_COORDS +#define GL_MAX_TEXTURE_COORDS 0x8871 +#endif +#ifndef GL_MAX_TEXTURE_IMAGE_UNITS +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#endif +#ifndef GL_FRAGMENT_SHADER +#define GL_FRAGMENT_SHADER 0x8B30 +#endif +#ifndef GL_VERTEX_SHADER +#define GL_VERTEX_SHADER 0x8B31 +#endif +#ifndef GL_MAX_FRAGMENT_UNIFORM_COMPONENTS +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#endif +#ifndef GL_MAX_VERTEX_UNIFORM_COMPONENTS +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#endif +#ifndef GL_MAX_VARYING_FLOATS +#define GL_MAX_VARYING_FLOATS 0x8B4B +#endif +#ifndef GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#endif +#ifndef GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#endif +#ifndef GL_SHADER_TYPE +#define GL_SHADER_TYPE 0x8B4F +#endif +#ifndef GL_FLOAT_VEC2 +#define GL_FLOAT_VEC2 0x8B50 +#endif +#ifndef GL_FLOAT_VEC3 +#define GL_FLOAT_VEC3 0x8B51 +#endif +#ifndef GL_FLOAT_VEC4 +#define GL_FLOAT_VEC4 0x8B52 +#endif +#ifndef GL_INT_VEC2 +#define GL_INT_VEC2 0x8B53 +#endif +#ifndef GL_INT_VEC3 +#define GL_INT_VEC3 0x8B54 +#endif +#ifndef GL_INT_VEC4 +#define GL_INT_VEC4 0x8B55 +#endif +#ifndef GL_BOOL +#define GL_BOOL 0x8B56 +#endif +#ifndef GL_BOOL_VEC2 +#define GL_BOOL_VEC2 0x8B57 +#endif +#ifndef GL_BOOL_VEC3 +#define GL_BOOL_VEC3 0x8B58 +#endif +#ifndef GL_BOOL_VEC4 +#define GL_BOOL_VEC4 0x8B59 +#endif +#ifndef GL_FLOAT_MAT2 +#define GL_FLOAT_MAT2 0x8B5A +#endif +#ifndef GL_FLOAT_MAT3 +#define GL_FLOAT_MAT3 0x8B5B +#endif +#ifndef GL_FLOAT_MAT4 +#define GL_FLOAT_MAT4 0x8B5C +#endif +#ifndef GL_SAMPLER_1D +#define GL_SAMPLER_1D 0x8B5D +#endif +#ifndef GL_SAMPLER_2D +#define GL_SAMPLER_2D 0x8B5E +#endif +#ifndef GL_SAMPLER_3D +#define GL_SAMPLER_3D 0x8B5F +#endif +#ifndef GL_SAMPLER_CUBE +#define GL_SAMPLER_CUBE 0x8B60 +#endif +#ifndef GL_SAMPLER_1D_SHADOW +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#endif +#ifndef GL_SAMPLER_2D_SHADOW +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#endif +#ifndef GL_DELETE_STATUS +#define GL_DELETE_STATUS 0x8B80 +#endif +#ifndef GL_COMPILE_STATUS +#define GL_COMPILE_STATUS 0x8B81 +#endif +#ifndef GL_LINK_STATUS +#define GL_LINK_STATUS 0x8B82 +#endif +#ifndef GL_VALIDATE_STATUS +#define GL_VALIDATE_STATUS 0x8B83 +#endif +#ifndef GL_INFO_LOG_LENGTH +#define GL_INFO_LOG_LENGTH 0x8B84 +#endif +#ifndef GL_ATTACHED_SHADERS +#define GL_ATTACHED_SHADERS 0x8B85 +#endif +#ifndef GL_ACTIVE_UNIFORMS +#define GL_ACTIVE_UNIFORMS 0x8B86 +#endif +#ifndef GL_ACTIVE_UNIFORM_MAX_LENGTH +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#endif +#ifndef GL_SHADER_SOURCE_LENGTH +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#endif +#ifndef GL_ACTIVE_ATTRIBUTES +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#endif +#ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#endif +#ifndef GL_FRAGMENT_SHADER_DERIVATIVE_HINT +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#endif +#ifndef GL_SHADING_LANGUAGE_VERSION +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#endif +#ifndef GL_CURRENT_PROGRAM +#define GL_CURRENT_PROGRAM 0x8B8D +#endif +#ifndef GL_POINT_SPRITE_COORD_ORIGIN +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#endif +#ifndef GL_LOWER_LEFT +#define GL_LOWER_LEFT 0x8CA1 +#endif +#ifndef GL_UPPER_LEFT +#define GL_UPPER_LEFT 0x8CA2 +#endif +#ifndef GL_STENCIL_BACK_REF +#define GL_STENCIL_BACK_REF 0x8CA3 +#endif +#ifndef GL_STENCIL_BACK_VALUE_MASK +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#endif +#ifndef GL_STENCIL_BACK_WRITEMASK +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif +#ifndef GL_CURRENT_RASTER_SECONDARY_COLOR +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#endif +#ifndef GL_PIXEL_PACK_BUFFER +#define GL_PIXEL_PACK_BUFFER 0x88EB +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#endif +#ifndef GL_PIXEL_PACK_BUFFER_BINDING +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER_BINDING +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#endif +#ifndef GL_FLOAT_MAT2x3 +#define GL_FLOAT_MAT2x3 0x8B65 +#endif +#ifndef GL_FLOAT_MAT2x4 +#define GL_FLOAT_MAT2x4 0x8B66 +#endif +#ifndef GL_FLOAT_MAT3x2 +#define GL_FLOAT_MAT3x2 0x8B67 +#endif +#ifndef GL_FLOAT_MAT3x4 +#define GL_FLOAT_MAT3x4 0x8B68 +#endif +#ifndef GL_FLOAT_MAT4x2 +#define GL_FLOAT_MAT4x2 0x8B69 +#endif +#ifndef GL_FLOAT_MAT4x3 +#define GL_FLOAT_MAT4x3 0x8B6A +#endif +#ifndef GL_SRGB +#define GL_SRGB 0x8C40 +#endif +#ifndef GL_SRGB8 +#define GL_SRGB8 0x8C41 +#endif +#ifndef GL_SRGB_ALPHA +#define GL_SRGB_ALPHA 0x8C42 +#endif +#ifndef GL_SRGB8_ALPHA8 +#define GL_SRGB8_ALPHA8 0x8C43 +#endif +#ifndef GL_SLUMINANCE_ALPHA +#define GL_SLUMINANCE_ALPHA 0x8C44 +#endif +#ifndef GL_SLUMINANCE8_ALPHA8 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#endif +#ifndef GL_SLUMINANCE +#define GL_SLUMINANCE 0x8C46 +#endif +#ifndef GL_SLUMINANCE8 +#define GL_SLUMINANCE8 0x8C47 +#endif +#ifndef GL_COMPRESSED_SRGB +#define GL_COMPRESSED_SRGB 0x8C48 +#endif +#ifndef GL_COMPRESSED_SRGB_ALPHA +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#endif +#ifndef GL_COMPRESSED_SLUMINANCE +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#endif +#ifndef GL_COMPRESSED_SLUMINANCE_ALPHA +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#endif +#ifndef GL_TEXTURE0_ARB +#define GL_TEXTURE0_ARB 0x84C0 +#endif +#ifndef GL_TEXTURE1_ARB +#define GL_TEXTURE1_ARB 0x84C1 +#endif +#ifndef GL_TEXTURE2_ARB +#define GL_TEXTURE2_ARB 0x84C2 +#endif +#ifndef GL_TEXTURE3_ARB +#define GL_TEXTURE3_ARB 0x84C3 +#endif +#ifndef GL_TEXTURE4_ARB +#define GL_TEXTURE4_ARB 0x84C4 +#endif +#ifndef GL_TEXTURE5_ARB +#define GL_TEXTURE5_ARB 0x84C5 +#endif +#ifndef GL_TEXTURE6_ARB +#define GL_TEXTURE6_ARB 0x84C6 +#endif +#ifndef GL_TEXTURE7_ARB +#define GL_TEXTURE7_ARB 0x84C7 +#endif +#ifndef GL_TEXTURE8_ARB +#define GL_TEXTURE8_ARB 0x84C8 +#endif +#ifndef GL_TEXTURE9_ARB +#define GL_TEXTURE9_ARB 0x84C9 +#endif +#ifndef GL_TEXTURE10_ARB +#define GL_TEXTURE10_ARB 0x84CA +#endif +#ifndef GL_TEXTURE11_ARB +#define GL_TEXTURE11_ARB 0x84CB +#endif +#ifndef GL_TEXTURE12_ARB +#define GL_TEXTURE12_ARB 0x84CC +#endif +#ifndef GL_TEXTURE13_ARB +#define GL_TEXTURE13_ARB 0x84CD +#endif +#ifndef GL_TEXTURE14_ARB +#define GL_TEXTURE14_ARB 0x84CE +#endif +#ifndef GL_TEXTURE15_ARB +#define GL_TEXTURE15_ARB 0x84CF +#endif +#ifndef GL_TEXTURE16_ARB +#define GL_TEXTURE16_ARB 0x84D0 +#endif +#ifndef GL_TEXTURE17_ARB +#define GL_TEXTURE17_ARB 0x84D1 +#endif +#ifndef GL_TEXTURE18_ARB +#define GL_TEXTURE18_ARB 0x84D2 +#endif +#ifndef GL_TEXTURE19_ARB +#define GL_TEXTURE19_ARB 0x84D3 +#endif +#ifndef GL_TEXTURE20_ARB +#define GL_TEXTURE20_ARB 0x84D4 +#endif +#ifndef GL_TEXTURE21_ARB +#define GL_TEXTURE21_ARB 0x84D5 +#endif +#ifndef GL_TEXTURE22_ARB +#define GL_TEXTURE22_ARB 0x84D6 +#endif +#ifndef GL_TEXTURE23_ARB +#define GL_TEXTURE23_ARB 0x84D7 +#endif +#ifndef GL_TEXTURE24_ARB +#define GL_TEXTURE24_ARB 0x84D8 +#endif +#ifndef GL_TEXTURE25_ARB +#define GL_TEXTURE25_ARB 0x84D9 +#endif +#ifndef GL_TEXTURE26_ARB +#define GL_TEXTURE26_ARB 0x84DA +#endif +#ifndef GL_TEXTURE27_ARB +#define GL_TEXTURE27_ARB 0x84DB +#endif +#ifndef GL_TEXTURE28_ARB +#define GL_TEXTURE28_ARB 0x84DC +#endif +#ifndef GL_TEXTURE29_ARB +#define GL_TEXTURE29_ARB 0x84DD +#endif +#ifndef GL_TEXTURE30_ARB +#define GL_TEXTURE30_ARB 0x84DE +#endif +#ifndef GL_TEXTURE31_ARB +#define GL_TEXTURE31_ARB 0x84DF +#endif +#ifndef GL_ACTIVE_TEXTURE_ARB +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#endif +#ifndef GL_CLIENT_ACTIVE_TEXTURE_ARB +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#endif +#ifndef GL_MAX_TEXTURE_UNITS_ARB +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif +#ifndef GL_TRANSPOSE_MODELVIEW_MATRIX_ARB +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#endif +#ifndef GL_TRANSPOSE_PROJECTION_MATRIX_ARB +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#endif +#ifndef GL_TRANSPOSE_TEXTURE_MATRIX_ARB +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#endif +#ifndef GL_TRANSPOSE_COLOR_MATRIX_ARB +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif +#ifndef GL_MULTISAMPLE_ARB +#define GL_MULTISAMPLE_ARB 0x809D +#endif +#ifndef GL_SAMPLE_ALPHA_TO_COVERAGE_ARB +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE_ARB +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#endif +#ifndef GL_SAMPLE_COVERAGE_ARB +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#endif +#ifndef GL_SAMPLE_BUFFERS_ARB +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#endif +#ifndef GL_SAMPLES_ARB +#define GL_SAMPLES_ARB 0x80A9 +#endif +#ifndef GL_SAMPLE_COVERAGE_VALUE_ARB +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#endif +#ifndef GL_SAMPLE_COVERAGE_INVERT_ARB +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#endif +#ifndef GL_MULTISAMPLE_BIT_ARB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif +#ifndef GL_NORMAL_MAP_ARB +#define GL_NORMAL_MAP_ARB 0x8511 +#endif +#ifndef GL_REFLECTION_MAP_ARB +#define GL_REFLECTION_MAP_ARB 0x8512 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_ARB +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#endif +#ifndef GL_TEXTURE_BINDING_CUBE_MAP_ARB +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#endif +#ifndef GL_PROXY_TEXTURE_CUBE_MAP_ARB +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#endif +#ifndef GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif +#ifndef GL_COMPRESSED_ALPHA_ARB +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#endif +#ifndef GL_COMPRESSED_LUMINANCE_ARB +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#endif +#ifndef GL_COMPRESSED_LUMINANCE_ALPHA_ARB +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#endif +#ifndef GL_COMPRESSED_INTENSITY_ARB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#endif +#ifndef GL_COMPRESSED_RGB_ARB +#define GL_COMPRESSED_RGB_ARB 0x84ED +#endif +#ifndef GL_COMPRESSED_RGBA_ARB +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#endif +#ifndef GL_TEXTURE_COMPRESSION_HINT_ARB +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#endif +#ifndef GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#endif +#ifndef GL_TEXTURE_COMPRESSED_ARB +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#endif +#ifndef GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#endif +#ifndef GL_COMPRESSED_TEXTURE_FORMATS_ARB +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif +#ifndef GL_CLAMP_TO_BORDER_ARB +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif +#ifndef GL_POINT_SIZE_MIN_ARB +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#endif +#ifndef GL_POINT_SIZE_MAX_ARB +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE_ARB +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#endif +#ifndef GL_POINT_DISTANCE_ATTENUATION_ARB +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif +#ifndef GL_MAX_VERTEX_UNITS_ARB +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#endif +#ifndef GL_ACTIVE_VERTEX_UNITS_ARB +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#endif +#ifndef GL_WEIGHT_SUM_UNITY_ARB +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#endif +#ifndef GL_VERTEX_BLEND_ARB +#define GL_VERTEX_BLEND_ARB 0x86A7 +#endif +#ifndef GL_CURRENT_WEIGHT_ARB +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#endif +#ifndef GL_WEIGHT_ARRAY_TYPE_ARB +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#endif +#ifndef GL_WEIGHT_ARRAY_STRIDE_ARB +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#endif +#ifndef GL_WEIGHT_ARRAY_SIZE_ARB +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#endif +#ifndef GL_WEIGHT_ARRAY_POINTER_ARB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#endif +#ifndef GL_WEIGHT_ARRAY_ARB +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#endif +#ifndef GL_MODELVIEW0_ARB +#define GL_MODELVIEW0_ARB 0x1700 +#endif +#ifndef GL_MODELVIEW1_ARB +#define GL_MODELVIEW1_ARB 0x850A +#endif +#ifndef GL_MODELVIEW2_ARB +#define GL_MODELVIEW2_ARB 0x8722 +#endif +#ifndef GL_MODELVIEW3_ARB +#define GL_MODELVIEW3_ARB 0x8723 +#endif +#ifndef GL_MODELVIEW4_ARB +#define GL_MODELVIEW4_ARB 0x8724 +#endif +#ifndef GL_MODELVIEW5_ARB +#define GL_MODELVIEW5_ARB 0x8725 +#endif +#ifndef GL_MODELVIEW6_ARB +#define GL_MODELVIEW6_ARB 0x8726 +#endif +#ifndef GL_MODELVIEW7_ARB +#define GL_MODELVIEW7_ARB 0x8727 +#endif +#ifndef GL_MODELVIEW8_ARB +#define GL_MODELVIEW8_ARB 0x8728 +#endif +#ifndef GL_MODELVIEW9_ARB +#define GL_MODELVIEW9_ARB 0x8729 +#endif +#ifndef GL_MODELVIEW10_ARB +#define GL_MODELVIEW10_ARB 0x872A +#endif +#ifndef GL_MODELVIEW11_ARB +#define GL_MODELVIEW11_ARB 0x872B +#endif +#ifndef GL_MODELVIEW12_ARB +#define GL_MODELVIEW12_ARB 0x872C +#endif +#ifndef GL_MODELVIEW13_ARB +#define GL_MODELVIEW13_ARB 0x872D +#endif +#ifndef GL_MODELVIEW14_ARB +#define GL_MODELVIEW14_ARB 0x872E +#endif +#ifndef GL_MODELVIEW15_ARB +#define GL_MODELVIEW15_ARB 0x872F +#endif +#ifndef GL_MODELVIEW16_ARB +#define GL_MODELVIEW16_ARB 0x8730 +#endif +#ifndef GL_MODELVIEW17_ARB +#define GL_MODELVIEW17_ARB 0x8731 +#endif +#ifndef GL_MODELVIEW18_ARB +#define GL_MODELVIEW18_ARB 0x8732 +#endif +#ifndef GL_MODELVIEW19_ARB +#define GL_MODELVIEW19_ARB 0x8733 +#endif +#ifndef GL_MODELVIEW20_ARB +#define GL_MODELVIEW20_ARB 0x8734 +#endif +#ifndef GL_MODELVIEW21_ARB +#define GL_MODELVIEW21_ARB 0x8735 +#endif +#ifndef GL_MODELVIEW22_ARB +#define GL_MODELVIEW22_ARB 0x8736 +#endif +#ifndef GL_MODELVIEW23_ARB +#define GL_MODELVIEW23_ARB 0x8737 +#endif +#ifndef GL_MODELVIEW24_ARB +#define GL_MODELVIEW24_ARB 0x8738 +#endif +#ifndef GL_MODELVIEW25_ARB +#define GL_MODELVIEW25_ARB 0x8739 +#endif +#ifndef GL_MODELVIEW26_ARB +#define GL_MODELVIEW26_ARB 0x873A +#endif +#ifndef GL_MODELVIEW27_ARB +#define GL_MODELVIEW27_ARB 0x873B +#endif +#ifndef GL_MODELVIEW28_ARB +#define GL_MODELVIEW28_ARB 0x873C +#endif +#ifndef GL_MODELVIEW29_ARB +#define GL_MODELVIEW29_ARB 0x873D +#endif +#ifndef GL_MODELVIEW30_ARB +#define GL_MODELVIEW30_ARB 0x873E +#endif +#ifndef GL_MODELVIEW31_ARB +#define GL_MODELVIEW31_ARB 0x873F +#endif +#ifndef GL_MATRIX_PALETTE_ARB +#define GL_MATRIX_PALETTE_ARB 0x8840 +#endif +#ifndef GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#endif +#ifndef GL_MAX_PALETTE_MATRICES_ARB +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#endif +#ifndef GL_CURRENT_PALETTE_MATRIX_ARB +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#endif +#ifndef GL_MATRIX_INDEX_ARRAY_ARB +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#endif +#ifndef GL_CURRENT_MATRIX_INDEX_ARB +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#endif +#ifndef GL_MATRIX_INDEX_ARRAY_SIZE_ARB +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#endif +#ifndef GL_MATRIX_INDEX_ARRAY_TYPE_ARB +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#endif +#ifndef GL_MATRIX_INDEX_ARRAY_STRIDE_ARB +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#endif +#ifndef GL_MATRIX_INDEX_ARRAY_POINTER_ARB +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif +#ifndef GL_COMBINE_ARB +#define GL_COMBINE_ARB 0x8570 +#endif +#ifndef GL_COMBINE_RGB_ARB +#define GL_COMBINE_RGB_ARB 0x8571 +#endif +#ifndef GL_COMBINE_ALPHA_ARB +#define GL_COMBINE_ALPHA_ARB 0x8572 +#endif +#ifndef GL_SOURCE0_RGB_ARB +#define GL_SOURCE0_RGB_ARB 0x8580 +#endif +#ifndef GL_SOURCE1_RGB_ARB +#define GL_SOURCE1_RGB_ARB 0x8581 +#endif +#ifndef GL_SOURCE2_RGB_ARB +#define GL_SOURCE2_RGB_ARB 0x8582 +#endif +#ifndef GL_SOURCE0_ALPHA_ARB +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#endif +#ifndef GL_SOURCE1_ALPHA_ARB +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#endif +#ifndef GL_SOURCE2_ALPHA_ARB +#define GL_SOURCE2_ALPHA_ARB 0x858A +#endif +#ifndef GL_OPERAND0_RGB_ARB +#define GL_OPERAND0_RGB_ARB 0x8590 +#endif +#ifndef GL_OPERAND1_RGB_ARB +#define GL_OPERAND1_RGB_ARB 0x8591 +#endif +#ifndef GL_OPERAND2_RGB_ARB +#define GL_OPERAND2_RGB_ARB 0x8592 +#endif +#ifndef GL_OPERAND0_ALPHA_ARB +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#endif +#ifndef GL_OPERAND1_ALPHA_ARB +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#endif +#ifndef GL_OPERAND2_ALPHA_ARB +#define GL_OPERAND2_ALPHA_ARB 0x859A +#endif +#ifndef GL_RGB_SCALE_ARB +#define GL_RGB_SCALE_ARB 0x8573 +#endif +#ifndef GL_ADD_SIGNED_ARB +#define GL_ADD_SIGNED_ARB 0x8574 +#endif +#ifndef GL_INTERPOLATE_ARB +#define GL_INTERPOLATE_ARB 0x8575 +#endif +#ifndef GL_SUBTRACT_ARB +#define GL_SUBTRACT_ARB 0x84E7 +#endif +#ifndef GL_CONSTANT_ARB +#define GL_CONSTANT_ARB 0x8576 +#endif +#ifndef GL_PRIMARY_COLOR_ARB +#define GL_PRIMARY_COLOR_ARB 0x8577 +#endif +#ifndef GL_PREVIOUS_ARB +#define GL_PREVIOUS_ARB 0x8578 +#endif +#ifndef GL_DOT3_RGB_ARB +#define GL_DOT3_RGB_ARB 0x86AE +#endif +#ifndef GL_DOT3_RGBA_ARB +#define GL_DOT3_RGBA_ARB 0x86AF +#endif +#ifndef GL_MIRRORED_REPEAT_ARB +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif +#ifndef GL_DEPTH_COMPONENT16_ARB +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#endif +#ifndef GL_DEPTH_COMPONENT24_ARB +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#endif +#ifndef GL_DEPTH_COMPONENT32_ARB +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#endif +#ifndef GL_TEXTURE_DEPTH_SIZE_ARB +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#endif +#ifndef GL_DEPTH_TEXTURE_MODE_ARB +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif +#ifndef GL_TEXTURE_COMPARE_FAIL_VALUE_ARB +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif +#ifndef GL_COLOR_SUM_ARB +#define GL_COLOR_SUM_ARB 0x8458 +#endif +#ifndef GL_VERTEX_PROGRAM_ARB +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#endif +#ifndef GL_CURRENT_VERTEX_ATTRIB_ARB +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#endif +#ifndef GL_PROGRAM_LENGTH_ARB +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#endif +#ifndef GL_PROGRAM_STRING_ARB +#define GL_PROGRAM_STRING_ARB 0x8628 +#endif +#ifndef GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#endif +#ifndef GL_MAX_PROGRAM_MATRICES_ARB +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#endif +#ifndef GL_CURRENT_MATRIX_STACK_DEPTH_ARB +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#endif +#ifndef GL_CURRENT_MATRIX_ARB +#define GL_CURRENT_MATRIX_ARB 0x8641 +#endif +#ifndef GL_VERTEX_PROGRAM_POINT_SIZE_ARB +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#endif +#ifndef GL_VERTEX_PROGRAM_TWO_SIDE_ARB +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#endif +#ifndef GL_PROGRAM_ERROR_POSITION_ARB +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#endif +#ifndef GL_PROGRAM_BINDING_ARB +#define GL_PROGRAM_BINDING_ARB 0x8677 +#endif +#ifndef GL_MAX_VERTEX_ATTRIBS_ARB +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#endif +#ifndef GL_PROGRAM_ERROR_STRING_ARB +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#endif +#ifndef GL_PROGRAM_FORMAT_ASCII_ARB +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#endif +#ifndef GL_PROGRAM_FORMAT_ARB +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#endif +#ifndef GL_PROGRAM_INSTRUCTIONS_ARB +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#endif +#ifndef GL_MAX_PROGRAM_INSTRUCTIONS_ARB +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#endif +#ifndef GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#endif +#ifndef GL_PROGRAM_TEMPORARIES_ARB +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#endif +#ifndef GL_MAX_PROGRAM_TEMPORARIES_ARB +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#endif +#ifndef GL_PROGRAM_NATIVE_TEMPORARIES_ARB +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#endif +#ifndef GL_PROGRAM_PARAMETERS_ARB +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#endif +#ifndef GL_MAX_PROGRAM_PARAMETERS_ARB +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#endif +#ifndef GL_PROGRAM_NATIVE_PARAMETERS_ARB +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#endif +#ifndef GL_PROGRAM_ATTRIBS_ARB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#endif +#ifndef GL_MAX_PROGRAM_ATTRIBS_ARB +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#endif +#ifndef GL_PROGRAM_NATIVE_ATTRIBS_ARB +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#endif +#ifndef GL_PROGRAM_ADDRESS_REGISTERS_ARB +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#endif +#ifndef GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#endif +#ifndef GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#endif +#ifndef GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#endif +#ifndef GL_MAX_PROGRAM_ENV_PARAMETERS_ARB +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#endif +#ifndef GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#endif +#ifndef GL_TRANSPOSE_CURRENT_MATRIX_ARB +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#endif +#ifndef GL_MATRIX0_ARB +#define GL_MATRIX0_ARB 0x88C0 +#endif +#ifndef GL_MATRIX1_ARB +#define GL_MATRIX1_ARB 0x88C1 +#endif +#ifndef GL_MATRIX2_ARB +#define GL_MATRIX2_ARB 0x88C2 +#endif +#ifndef GL_MATRIX3_ARB +#define GL_MATRIX3_ARB 0x88C3 +#endif +#ifndef GL_MATRIX4_ARB +#define GL_MATRIX4_ARB 0x88C4 +#endif +#ifndef GL_MATRIX5_ARB +#define GL_MATRIX5_ARB 0x88C5 +#endif +#ifndef GL_MATRIX6_ARB +#define GL_MATRIX6_ARB 0x88C6 +#endif +#ifndef GL_MATRIX7_ARB +#define GL_MATRIX7_ARB 0x88C7 +#endif +#ifndef GL_MATRIX8_ARB +#define GL_MATRIX8_ARB 0x88C8 +#endif +#ifndef GL_MATRIX9_ARB +#define GL_MATRIX9_ARB 0x88C9 +#endif +#ifndef GL_MATRIX10_ARB +#define GL_MATRIX10_ARB 0x88CA +#endif +#ifndef GL_MATRIX11_ARB +#define GL_MATRIX11_ARB 0x88CB +#endif +#ifndef GL_MATRIX12_ARB +#define GL_MATRIX12_ARB 0x88CC +#endif +#ifndef GL_MATRIX13_ARB +#define GL_MATRIX13_ARB 0x88CD +#endif +#ifndef GL_MATRIX14_ARB +#define GL_MATRIX14_ARB 0x88CE +#endif +#ifndef GL_MATRIX15_ARB +#define GL_MATRIX15_ARB 0x88CF +#endif +#ifndef GL_MATRIX16_ARB +#define GL_MATRIX16_ARB 0x88D0 +#endif +#ifndef GL_MATRIX17_ARB +#define GL_MATRIX17_ARB 0x88D1 +#endif +#ifndef GL_MATRIX18_ARB +#define GL_MATRIX18_ARB 0x88D2 +#endif +#ifndef GL_MATRIX19_ARB +#define GL_MATRIX19_ARB 0x88D3 +#endif +#ifndef GL_MATRIX20_ARB +#define GL_MATRIX20_ARB 0x88D4 +#endif +#ifndef GL_MATRIX21_ARB +#define GL_MATRIX21_ARB 0x88D5 +#endif +#ifndef GL_MATRIX22_ARB +#define GL_MATRIX22_ARB 0x88D6 +#endif +#ifndef GL_MATRIX23_ARB +#define GL_MATRIX23_ARB 0x88D7 +#endif +#ifndef GL_MATRIX24_ARB +#define GL_MATRIX24_ARB 0x88D8 +#endif +#ifndef GL_MATRIX25_ARB +#define GL_MATRIX25_ARB 0x88D9 +#endif +#ifndef GL_MATRIX26_ARB +#define GL_MATRIX26_ARB 0x88DA +#endif +#ifndef GL_MATRIX27_ARB +#define GL_MATRIX27_ARB 0x88DB +#endif +#ifndef GL_MATRIX28_ARB +#define GL_MATRIX28_ARB 0x88DC +#endif +#ifndef GL_MATRIX29_ARB +#define GL_MATRIX29_ARB 0x88DD +#endif +#ifndef GL_MATRIX30_ARB +#define GL_MATRIX30_ARB 0x88DE +#endif +#ifndef GL_MATRIX31_ARB +#define GL_MATRIX31_ARB 0x88DF +#endif +#ifndef GL_FRAGMENT_PROGRAM_ARB +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#endif +#ifndef GL_PROGRAM_ALU_INSTRUCTIONS_ARB +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#endif +#ifndef GL_PROGRAM_TEX_INSTRUCTIONS_ARB +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#endif +#ifndef GL_PROGRAM_TEX_INDIRECTIONS_ARB +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#endif +#ifndef GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#endif +#ifndef GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#endif +#ifndef GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#endif +#ifndef GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#endif +#ifndef GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#endif +#ifndef GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#endif +#ifndef GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#endif +#ifndef GL_MAX_TEXTURE_COORDS_ARB +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#endif +#ifndef GL_MAX_TEXTURE_IMAGE_UNITS_ARB +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif +#ifndef GL_BUFFER_SIZE_ARB +#define GL_BUFFER_SIZE_ARB 0x8764 +#endif +#ifndef GL_BUFFER_USAGE_ARB +#define GL_BUFFER_USAGE_ARB 0x8765 +#endif +#ifndef GL_ARRAY_BUFFER_ARB +#define GL_ARRAY_BUFFER_ARB 0x8892 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER_ARB +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#endif +#ifndef GL_ARRAY_BUFFER_BINDING_ARB +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#endif +#ifndef GL_VERTEX_ARRAY_BUFFER_BINDING_ARB +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#endif +#ifndef GL_NORMAL_ARRAY_BUFFER_BINDING_ARB +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#endif +#ifndef GL_COLOR_ARRAY_BUFFER_BINDING_ARB +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#endif +#ifndef GL_INDEX_ARRAY_BUFFER_BINDING_ARB +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#endif +#ifndef GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#endif +#ifndef GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#endif +#ifndef GL_READ_ONLY_ARB +#define GL_READ_ONLY_ARB 0x88B8 +#endif +#ifndef GL_WRITE_ONLY_ARB +#define GL_WRITE_ONLY_ARB 0x88B9 +#endif +#ifndef GL_READ_WRITE_ARB +#define GL_READ_WRITE_ARB 0x88BA +#endif +#ifndef GL_BUFFER_ACCESS_ARB +#define GL_BUFFER_ACCESS_ARB 0x88BB +#endif +#ifndef GL_BUFFER_MAPPED_ARB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#endif +#ifndef GL_BUFFER_MAP_POINTER_ARB +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#endif +#ifndef GL_STREAM_DRAW_ARB +#define GL_STREAM_DRAW_ARB 0x88E0 +#endif +#ifndef GL_STREAM_READ_ARB +#define GL_STREAM_READ_ARB 0x88E1 +#endif +#ifndef GL_STREAM_COPY_ARB +#define GL_STREAM_COPY_ARB 0x88E2 +#endif +#ifndef GL_STATIC_DRAW_ARB +#define GL_STATIC_DRAW_ARB 0x88E4 +#endif +#ifndef GL_STATIC_READ_ARB +#define GL_STATIC_READ_ARB 0x88E5 +#endif +#ifndef GL_STATIC_COPY_ARB +#define GL_STATIC_COPY_ARB 0x88E6 +#endif +#ifndef GL_DYNAMIC_DRAW_ARB +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#endif +#ifndef GL_DYNAMIC_READ_ARB +#define GL_DYNAMIC_READ_ARB 0x88E9 +#endif +#ifndef GL_DYNAMIC_COPY_ARB +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif +#ifndef GL_QUERY_COUNTER_BITS_ARB +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#endif +#ifndef GL_CURRENT_QUERY_ARB +#define GL_CURRENT_QUERY_ARB 0x8865 +#endif +#ifndef GL_QUERY_RESULT_ARB +#define GL_QUERY_RESULT_ARB 0x8866 +#endif +#ifndef GL_QUERY_RESULT_AVAILABLE_ARB +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#endif +#ifndef GL_SAMPLES_PASSED_ARB +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif +#ifndef GL_PROGRAM_OBJECT_ARB +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#endif +#ifndef GL_SHADER_OBJECT_ARB +#define GL_SHADER_OBJECT_ARB 0x8B48 +#endif +#ifndef GL_OBJECT_TYPE_ARB +#define GL_OBJECT_TYPE_ARB 0x8B4E +#endif +#ifndef GL_OBJECT_SUBTYPE_ARB +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#endif +#ifndef GL_FLOAT_VEC2_ARB +#define GL_FLOAT_VEC2_ARB 0x8B50 +#endif +#ifndef GL_FLOAT_VEC3_ARB +#define GL_FLOAT_VEC3_ARB 0x8B51 +#endif +#ifndef GL_FLOAT_VEC4_ARB +#define GL_FLOAT_VEC4_ARB 0x8B52 +#endif +#ifndef GL_INT_VEC2_ARB +#define GL_INT_VEC2_ARB 0x8B53 +#endif +#ifndef GL_INT_VEC3_ARB +#define GL_INT_VEC3_ARB 0x8B54 +#endif +#ifndef GL_INT_VEC4_ARB +#define GL_INT_VEC4_ARB 0x8B55 +#endif +#ifndef GL_BOOL_ARB +#define GL_BOOL_ARB 0x8B56 +#endif +#ifndef GL_BOOL_VEC2_ARB +#define GL_BOOL_VEC2_ARB 0x8B57 +#endif +#ifndef GL_BOOL_VEC3_ARB +#define GL_BOOL_VEC3_ARB 0x8B58 +#endif +#ifndef GL_BOOL_VEC4_ARB +#define GL_BOOL_VEC4_ARB 0x8B59 +#endif +#ifndef GL_FLOAT_MAT2_ARB +#define GL_FLOAT_MAT2_ARB 0x8B5A +#endif +#ifndef GL_FLOAT_MAT3_ARB +#define GL_FLOAT_MAT3_ARB 0x8B5B +#endif +#ifndef GL_FLOAT_MAT4_ARB +#define GL_FLOAT_MAT4_ARB 0x8B5C +#endif +#ifndef GL_SAMPLER_1D_ARB +#define GL_SAMPLER_1D_ARB 0x8B5D +#endif +#ifndef GL_SAMPLER_2D_ARB +#define GL_SAMPLER_2D_ARB 0x8B5E +#endif +#ifndef GL_SAMPLER_3D_ARB +#define GL_SAMPLER_3D_ARB 0x8B5F +#endif +#ifndef GL_SAMPLER_CUBE_ARB +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#endif +#ifndef GL_SAMPLER_1D_SHADOW_ARB +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#endif +#ifndef GL_SAMPLER_2D_SHADOW_ARB +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#endif +#ifndef GL_SAMPLER_2D_RECT_ARB +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#endif +#ifndef GL_SAMPLER_2D_RECT_SHADOW_ARB +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#endif +#ifndef GL_OBJECT_DELETE_STATUS_ARB +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#endif +#ifndef GL_OBJECT_COMPILE_STATUS_ARB +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#endif +#ifndef GL_OBJECT_LINK_STATUS_ARB +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#endif +#ifndef GL_OBJECT_VALIDATE_STATUS_ARB +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#endif +#ifndef GL_OBJECT_INFO_LOG_LENGTH_ARB +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#endif +#ifndef GL_OBJECT_ATTACHED_OBJECTS_ARB +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#endif +#ifndef GL_OBJECT_ACTIVE_UNIFORMS_ARB +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#endif +#ifndef GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#endif +#ifndef GL_OBJECT_SHADER_SOURCE_LENGTH_ARB +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif +#ifndef GL_VERTEX_SHADER_ARB +#define GL_VERTEX_SHADER_ARB 0x8B31 +#endif +#ifndef GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#endif +#ifndef GL_MAX_VARYING_FLOATS_ARB +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#endif +#ifndef GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#endif +#ifndef GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#endif +#ifndef GL_OBJECT_ACTIVE_ATTRIBUTES_ARB +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#endif +#ifndef GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif +#ifndef GL_FRAGMENT_SHADER_ARB +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#endif +#ifndef GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#endif +#ifndef GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif +#ifndef GL_SHADING_LANGUAGE_VERSION_ARB +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif +#ifndef GL_POINT_SPRITE_ARB +#define GL_POINT_SPRITE_ARB 0x8861 +#endif +#ifndef GL_COORD_REPLACE_ARB +#define GL_COORD_REPLACE_ARB 0x8862 +#endif +#ifndef GL_MAX_DRAW_BUFFERS_ARB +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#endif +#ifndef GL_DRAW_BUFFER0_ARB +#define GL_DRAW_BUFFER0_ARB 0x8825 +#endif +#ifndef GL_DRAW_BUFFER1_ARB +#define GL_DRAW_BUFFER1_ARB 0x8826 +#endif +#ifndef GL_DRAW_BUFFER2_ARB +#define GL_DRAW_BUFFER2_ARB 0x8827 +#endif +#ifndef GL_DRAW_BUFFER3_ARB +#define GL_DRAW_BUFFER3_ARB 0x8828 +#endif +#ifndef GL_DRAW_BUFFER4_ARB +#define GL_DRAW_BUFFER4_ARB 0x8829 +#endif +#ifndef GL_DRAW_BUFFER5_ARB +#define GL_DRAW_BUFFER5_ARB 0x882A +#endif +#ifndef GL_DRAW_BUFFER6_ARB +#define GL_DRAW_BUFFER6_ARB 0x882B +#endif +#ifndef GL_DRAW_BUFFER7_ARB +#define GL_DRAW_BUFFER7_ARB 0x882C +#endif +#ifndef GL_DRAW_BUFFER8_ARB +#define GL_DRAW_BUFFER8_ARB 0x882D +#endif +#ifndef GL_DRAW_BUFFER9_ARB +#define GL_DRAW_BUFFER9_ARB 0x882E +#endif +#ifndef GL_DRAW_BUFFER10_ARB +#define GL_DRAW_BUFFER10_ARB 0x882F +#endif +#ifndef GL_DRAW_BUFFER11_ARB +#define GL_DRAW_BUFFER11_ARB 0x8830 +#endif +#ifndef GL_DRAW_BUFFER12_ARB +#define GL_DRAW_BUFFER12_ARB 0x8831 +#endif +#ifndef GL_DRAW_BUFFER13_ARB +#define GL_DRAW_BUFFER13_ARB 0x8832 +#endif +#ifndef GL_DRAW_BUFFER14_ARB +#define GL_DRAW_BUFFER14_ARB 0x8833 +#endif +#ifndef GL_DRAW_BUFFER15_ARB +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif +#ifndef GL_TEXTURE_RECTANGLE_ARB +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#endif +#ifndef GL_TEXTURE_BINDING_RECTANGLE_ARB +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#endif +#ifndef GL_PROXY_TEXTURE_RECTANGLE_ARB +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#endif +#ifndef GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif +#ifndef GL_RGBA_FLOAT_MODE_ARB +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#endif +#ifndef GL_CLAMP_VERTEX_COLOR_ARB +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#endif +#ifndef GL_CLAMP_FRAGMENT_COLOR_ARB +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#endif +#ifndef GL_CLAMP_READ_COLOR_ARB +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#endif +#ifndef GL_FIXED_ONLY_ARB +#define GL_FIXED_ONLY_ARB 0x891D +#endif +#ifndef GL_HALF_FLOAT_ARB +#define GL_HALF_FLOAT_ARB 0x140B +#endif +#ifndef GL_TEXTURE_RED_TYPE_ARB +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#endif +#ifndef GL_TEXTURE_GREEN_TYPE_ARB +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#endif +#ifndef GL_TEXTURE_BLUE_TYPE_ARB +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#endif +#ifndef GL_TEXTURE_ALPHA_TYPE_ARB +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#endif +#ifndef GL_TEXTURE_LUMINANCE_TYPE_ARB +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#endif +#ifndef GL_TEXTURE_INTENSITY_TYPE_ARB +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#endif +#ifndef GL_TEXTURE_DEPTH_TYPE_ARB +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#endif +#ifndef GL_UNSIGNED_NORMALIZED_ARB +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#endif +#ifndef GL_RGBA32F_ARB +#define GL_RGBA32F_ARB 0x8814 +#endif +#ifndef GL_RGB32F_ARB +#define GL_RGB32F_ARB 0x8815 +#endif +#ifndef GL_ALPHA32F_ARB +#define GL_ALPHA32F_ARB 0x8816 +#endif +#ifndef GL_INTENSITY32F_ARB +#define GL_INTENSITY32F_ARB 0x8817 +#endif +#ifndef GL_LUMINANCE32F_ARB +#define GL_LUMINANCE32F_ARB 0x8818 +#endif +#ifndef GL_LUMINANCE_ALPHA32F_ARB +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#endif +#ifndef GL_RGBA16F_ARB +#define GL_RGBA16F_ARB 0x881A +#endif +#ifndef GL_RGB16F_ARB +#define GL_RGB16F_ARB 0x881B +#endif +#ifndef GL_ALPHA16F_ARB +#define GL_ALPHA16F_ARB 0x881C +#endif +#ifndef GL_INTENSITY16F_ARB +#define GL_INTENSITY16F_ARB 0x881D +#endif +#ifndef GL_LUMINANCE16F_ARB +#define GL_LUMINANCE16F_ARB 0x881E +#endif +#ifndef GL_LUMINANCE_ALPHA16F_ARB +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif +#ifndef GL_PIXEL_PACK_BUFFER_ARB +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER_ARB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#endif +#ifndef GL_PIXEL_PACK_BUFFER_BINDING_ARB +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER_BINDING_ARB +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif +#ifndef GL_ABGR_EXT +#define GL_ABGR_EXT 0x8000 +#endif +#ifndef GL_CONSTANT_COLOR_EXT +#define GL_CONSTANT_COLOR_EXT 0x8001 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_COLOR_EXT +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#endif +#ifndef GL_CONSTANT_ALPHA_EXT +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA_EXT +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#endif +#ifndef GL_BLEND_COLOR_EXT +#define GL_BLEND_COLOR_EXT 0x8005 +#endif +#ifndef GL_POLYGON_OFFSET_EXT +#define GL_POLYGON_OFFSET_EXT 0x8037 +#endif +#ifndef GL_POLYGON_OFFSET_FACTOR_EXT +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#endif +#ifndef GL_POLYGON_OFFSET_BIAS_EXT +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif +#ifndef GL_ALPHA4_EXT +#define GL_ALPHA4_EXT 0x803B +#endif +#ifndef GL_ALPHA8_EXT +#define GL_ALPHA8_EXT 0x803C +#endif +#ifndef GL_ALPHA12_EXT +#define GL_ALPHA12_EXT 0x803D +#endif +#ifndef GL_ALPHA16_EXT +#define GL_ALPHA16_EXT 0x803E +#endif +#ifndef GL_LUMINANCE4_EXT +#define GL_LUMINANCE4_EXT 0x803F +#endif +#ifndef GL_LUMINANCE8_EXT +#define GL_LUMINANCE8_EXT 0x8040 +#endif +#ifndef GL_LUMINANCE12_EXT +#define GL_LUMINANCE12_EXT 0x8041 +#endif +#ifndef GL_LUMINANCE16_EXT +#define GL_LUMINANCE16_EXT 0x8042 +#endif +#ifndef GL_LUMINANCE4_ALPHA4_EXT +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#endif +#ifndef GL_LUMINANCE6_ALPHA2_EXT +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#endif +#ifndef GL_LUMINANCE8_ALPHA8_EXT +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#endif +#ifndef GL_LUMINANCE12_ALPHA4_EXT +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#endif +#ifndef GL_LUMINANCE12_ALPHA12_EXT +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#endif +#ifndef GL_LUMINANCE16_ALPHA16_EXT +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#endif +#ifndef GL_INTENSITY_EXT +#define GL_INTENSITY_EXT 0x8049 +#endif +#ifndef GL_INTENSITY4_EXT +#define GL_INTENSITY4_EXT 0x804A +#endif +#ifndef GL_INTENSITY8_EXT +#define GL_INTENSITY8_EXT 0x804B +#endif +#ifndef GL_INTENSITY12_EXT +#define GL_INTENSITY12_EXT 0x804C +#endif +#ifndef GL_INTENSITY16_EXT +#define GL_INTENSITY16_EXT 0x804D +#endif +#ifndef GL_RGB2_EXT +#define GL_RGB2_EXT 0x804E +#endif +#ifndef GL_RGB4_EXT +#define GL_RGB4_EXT 0x804F +#endif +#ifndef GL_RGB5_EXT +#define GL_RGB5_EXT 0x8050 +#endif +#ifndef GL_RGB8_EXT +#define GL_RGB8_EXT 0x8051 +#endif +#ifndef GL_RGB10_EXT +#define GL_RGB10_EXT 0x8052 +#endif +#ifndef GL_RGB12_EXT +#define GL_RGB12_EXT 0x8053 +#endif +#ifndef GL_RGB16_EXT +#define GL_RGB16_EXT 0x8054 +#endif +#ifndef GL_RGBA2_EXT +#define GL_RGBA2_EXT 0x8055 +#endif +#ifndef GL_RGBA4_EXT +#define GL_RGBA4_EXT 0x8056 +#endif +#ifndef GL_RGB5_A1_EXT +#define GL_RGB5_A1_EXT 0x8057 +#endif +#ifndef GL_RGBA8_EXT +#define GL_RGBA8_EXT 0x8058 +#endif +#ifndef GL_RGB10_A2_EXT +#define GL_RGB10_A2_EXT 0x8059 +#endif +#ifndef GL_RGBA12_EXT +#define GL_RGBA12_EXT 0x805A +#endif +#ifndef GL_RGBA16_EXT +#define GL_RGBA16_EXT 0x805B +#endif +#ifndef GL_TEXTURE_RED_SIZE_EXT +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#endif +#ifndef GL_TEXTURE_GREEN_SIZE_EXT +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#endif +#ifndef GL_TEXTURE_BLUE_SIZE_EXT +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#endif +#ifndef GL_TEXTURE_ALPHA_SIZE_EXT +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#endif +#ifndef GL_TEXTURE_LUMINANCE_SIZE_EXT +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#endif +#ifndef GL_TEXTURE_INTENSITY_SIZE_EXT +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#endif +#ifndef GL_REPLACE_EXT +#define GL_REPLACE_EXT 0x8062 +#endif +#ifndef GL_PROXY_TEXTURE_1D_EXT +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#endif +#ifndef GL_PROXY_TEXTURE_2D_EXT +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#endif +#ifndef GL_TEXTURE_TOO_LARGE_EXT +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif +#ifndef GL_PACK_SKIP_IMAGES_EXT +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#endif +#ifndef GL_PACK_IMAGE_HEIGHT_EXT +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#endif +#ifndef GL_UNPACK_SKIP_IMAGES_EXT +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#endif +#ifndef GL_UNPACK_IMAGE_HEIGHT_EXT +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#endif +#ifndef GL_TEXTURE_3D_EXT +#define GL_TEXTURE_3D_EXT 0x806F +#endif +#ifndef GL_PROXY_TEXTURE_3D_EXT +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#endif +#ifndef GL_TEXTURE_DEPTH_EXT +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#endif +#ifndef GL_TEXTURE_WRAP_R_EXT +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#endif +#ifndef GL_MAX_3D_TEXTURE_SIZE_EXT +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif +#ifndef GL_FILTER4_SGIS +#define GL_FILTER4_SGIS 0x8146 +#endif +#ifndef GL_TEXTURE_FILTER4_SIZE_SGIS +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif +#ifndef GL_HISTOGRAM_EXT +#define GL_HISTOGRAM_EXT 0x8024 +#endif +#ifndef GL_PROXY_HISTOGRAM_EXT +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#endif +#ifndef GL_HISTOGRAM_WIDTH_EXT +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#endif +#ifndef GL_HISTOGRAM_FORMAT_EXT +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#endif +#ifndef GL_HISTOGRAM_RED_SIZE_EXT +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#endif +#ifndef GL_HISTOGRAM_GREEN_SIZE_EXT +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#endif +#ifndef GL_HISTOGRAM_BLUE_SIZE_EXT +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#endif +#ifndef GL_HISTOGRAM_ALPHA_SIZE_EXT +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#endif +#ifndef GL_HISTOGRAM_LUMINANCE_SIZE_EXT +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#endif +#ifndef GL_HISTOGRAM_SINK_EXT +#define GL_HISTOGRAM_SINK_EXT 0x802D +#endif +#ifndef GL_MINMAX_EXT +#define GL_MINMAX_EXT 0x802E +#endif +#ifndef GL_MINMAX_FORMAT_EXT +#define GL_MINMAX_FORMAT_EXT 0x802F +#endif +#ifndef GL_MINMAX_SINK_EXT +#define GL_MINMAX_SINK_EXT 0x8030 +#endif +#ifndef GL_TABLE_TOO_LARGE_EXT +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif +#ifndef GL_CONVOLUTION_1D_EXT +#define GL_CONVOLUTION_1D_EXT 0x8010 +#endif +#ifndef GL_CONVOLUTION_2D_EXT +#define GL_CONVOLUTION_2D_EXT 0x8011 +#endif +#ifndef GL_SEPARABLE_2D_EXT +#define GL_SEPARABLE_2D_EXT 0x8012 +#endif +#ifndef GL_CONVOLUTION_BORDER_MODE_EXT +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#endif +#ifndef GL_CONVOLUTION_FILTER_SCALE_EXT +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#endif +#ifndef GL_CONVOLUTION_FILTER_BIAS_EXT +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#endif +#ifndef GL_REDUCE_EXT +#define GL_REDUCE_EXT 0x8016 +#endif +#ifndef GL_CONVOLUTION_FORMAT_EXT +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#endif +#ifndef GL_CONVOLUTION_WIDTH_EXT +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#endif +#ifndef GL_CONVOLUTION_HEIGHT_EXT +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#endif +#ifndef GL_MAX_CONVOLUTION_WIDTH_EXT +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#endif +#ifndef GL_MAX_CONVOLUTION_HEIGHT_EXT +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#endif +#ifndef GL_POST_CONVOLUTION_RED_SCALE_EXT +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_SCALE_EXT +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_SCALE_EXT +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_SCALE_EXT +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#endif +#ifndef GL_POST_CONVOLUTION_RED_BIAS_EXT +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#endif +#ifndef GL_POST_CONVOLUTION_GREEN_BIAS_EXT +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#endif +#ifndef GL_POST_CONVOLUTION_BLUE_BIAS_EXT +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#endif +#ifndef GL_POST_CONVOLUTION_ALPHA_BIAS_EXT +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif +#ifndef GL_COLOR_MATRIX_SGI +#define GL_COLOR_MATRIX_SGI 0x80B1 +#endif +#ifndef GL_COLOR_MATRIX_STACK_DEPTH_SGI +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#endif +#ifndef GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_SCALE_SGI +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#endif +#ifndef GL_POST_COLOR_MATRIX_RED_BIAS_SGI +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#endif +#ifndef GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#endif +#ifndef GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#endif +#ifndef GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif +#ifndef GL_COLOR_TABLE_SGI +#define GL_COLOR_TABLE_SGI 0x80D0 +#endif +#ifndef GL_POST_CONVOLUTION_COLOR_TABLE_SGI +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#endif +#ifndef GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#endif +#ifndef GL_PROXY_COLOR_TABLE_SGI +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#endif +#ifndef GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#endif +#ifndef GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#endif +#ifndef GL_COLOR_TABLE_SCALE_SGI +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#endif +#ifndef GL_COLOR_TABLE_BIAS_SGI +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#endif +#ifndef GL_COLOR_TABLE_FORMAT_SGI +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#endif +#ifndef GL_COLOR_TABLE_WIDTH_SGI +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#endif +#ifndef GL_COLOR_TABLE_RED_SIZE_SGI +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#endif +#ifndef GL_COLOR_TABLE_GREEN_SIZE_SGI +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#endif +#ifndef GL_COLOR_TABLE_BLUE_SIZE_SGI +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#endif +#ifndef GL_COLOR_TABLE_ALPHA_SIZE_SGI +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#endif +#ifndef GL_COLOR_TABLE_LUMINANCE_SIZE_SGI +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#endif +#ifndef GL_COLOR_TABLE_INTENSITY_SIZE_SGI +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif +#ifndef GL_PIXEL_TEXTURE_SGIS +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#endif +#ifndef GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#endif +#ifndef GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#endif +#ifndef GL_PIXEL_GROUP_COLOR_SGIS +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif +#ifndef GL_PIXEL_TEX_GEN_SGIX +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#endif +#ifndef GL_PIXEL_TEX_GEN_MODE_SGIX +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif +#ifndef GL_PACK_SKIP_VOLUMES_SGIS +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#endif +#ifndef GL_PACK_IMAGE_DEPTH_SGIS +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#endif +#ifndef GL_UNPACK_SKIP_VOLUMES_SGIS +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#endif +#ifndef GL_UNPACK_IMAGE_DEPTH_SGIS +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#endif +#ifndef GL_TEXTURE_4D_SGIS +#define GL_TEXTURE_4D_SGIS 0x8134 +#endif +#ifndef GL_PROXY_TEXTURE_4D_SGIS +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#endif +#ifndef GL_TEXTURE_4DSIZE_SGIS +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#endif +#ifndef GL_TEXTURE_WRAP_Q_SGIS +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#endif +#ifndef GL_MAX_4D_TEXTURE_SIZE_SGIS +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#endif +#ifndef GL_TEXTURE_4D_BINDING_SGIS +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif +#ifndef GL_TEXTURE_COLOR_TABLE_SGI +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#endif +#ifndef GL_PROXY_TEXTURE_COLOR_TABLE_SGI +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif +#ifndef GL_CMYK_EXT +#define GL_CMYK_EXT 0x800C +#endif +#ifndef GL_CMYKA_EXT +#define GL_CMYKA_EXT 0x800D +#endif +#ifndef GL_PACK_CMYK_HINT_EXT +#define GL_PACK_CMYK_HINT_EXT 0x800E +#endif +#ifndef GL_UNPACK_CMYK_HINT_EXT +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif +#ifndef GL_TEXTURE_PRIORITY_EXT +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#endif +#ifndef GL_TEXTURE_RESIDENT_EXT +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#endif +#ifndef GL_TEXTURE_1D_BINDING_EXT +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#endif +#ifndef GL_TEXTURE_2D_BINDING_EXT +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#endif +#ifndef GL_TEXTURE_3D_BINDING_EXT +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif +#ifndef GL_DETAIL_TEXTURE_2D_SGIS +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#endif +#ifndef GL_DETAIL_TEXTURE_2D_BINDING_SGIS +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#endif +#ifndef GL_LINEAR_DETAIL_SGIS +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#endif +#ifndef GL_LINEAR_DETAIL_ALPHA_SGIS +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#endif +#ifndef GL_LINEAR_DETAIL_COLOR_SGIS +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#endif +#ifndef GL_DETAIL_TEXTURE_LEVEL_SGIS +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#endif +#ifndef GL_DETAIL_TEXTURE_MODE_SGIS +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#endif +#ifndef GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif +#ifndef GL_LINEAR_SHARPEN_SGIS +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#endif +#ifndef GL_LINEAR_SHARPEN_ALPHA_SGIS +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#endif +#ifndef GL_LINEAR_SHARPEN_COLOR_SGIS +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#endif +#ifndef GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif +#ifndef GL_UNSIGNED_BYTE_3_3_2_EXT +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4_EXT +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#endif +#ifndef GL_UNSIGNED_SHORT_5_5_5_1_EXT +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8_EXT +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#endif +#ifndef GL_UNSIGNED_INT_10_10_10_2_EXT +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif +#ifndef GL_TEXTURE_MIN_LOD_SGIS +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#endif +#ifndef GL_TEXTURE_MAX_LOD_SGIS +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#endif +#ifndef GL_TEXTURE_BASE_LEVEL_SGIS +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#endif +#ifndef GL_TEXTURE_MAX_LEVEL_SGIS +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif +#ifndef GL_MULTISAMPLE_SGIS +#define GL_MULTISAMPLE_SGIS 0x809D +#endif +#ifndef GL_SAMPLE_ALPHA_TO_MASK_SGIS +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE_SGIS +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#endif +#ifndef GL_SAMPLE_MASK_SGIS +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#endif +#ifndef GL_1PASS_SGIS +#define GL_1PASS_SGIS 0x80A1 +#endif +#ifndef GL_2PASS_0_SGIS +#define GL_2PASS_0_SGIS 0x80A2 +#endif +#ifndef GL_2PASS_1_SGIS +#define GL_2PASS_1_SGIS 0x80A3 +#endif +#ifndef GL_4PASS_0_SGIS +#define GL_4PASS_0_SGIS 0x80A4 +#endif +#ifndef GL_4PASS_1_SGIS +#define GL_4PASS_1_SGIS 0x80A5 +#endif +#ifndef GL_4PASS_2_SGIS +#define GL_4PASS_2_SGIS 0x80A6 +#endif +#ifndef GL_4PASS_3_SGIS +#define GL_4PASS_3_SGIS 0x80A7 +#endif +#ifndef GL_SAMPLE_BUFFERS_SGIS +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#endif +#ifndef GL_SAMPLES_SGIS +#define GL_SAMPLES_SGIS 0x80A9 +#endif +#ifndef GL_SAMPLE_MASK_VALUE_SGIS +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#endif +#ifndef GL_SAMPLE_MASK_INVERT_SGIS +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#endif +#ifndef GL_SAMPLE_PATTERN_SGIS +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif +#ifndef GL_RESCALE_NORMAL_EXT +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif +#ifndef GL_VERTEX_ARRAY_EXT +#define GL_VERTEX_ARRAY_EXT 0x8074 +#endif +#ifndef GL_NORMAL_ARRAY_EXT +#define GL_NORMAL_ARRAY_EXT 0x8075 +#endif +#ifndef GL_COLOR_ARRAY_EXT +#define GL_COLOR_ARRAY_EXT 0x8076 +#endif +#ifndef GL_INDEX_ARRAY_EXT +#define GL_INDEX_ARRAY_EXT 0x8077 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_EXT +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_EXT +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#endif +#ifndef GL_VERTEX_ARRAY_SIZE_EXT +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#endif +#ifndef GL_VERTEX_ARRAY_TYPE_EXT +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#endif +#ifndef GL_VERTEX_ARRAY_STRIDE_EXT +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#endif +#ifndef GL_VERTEX_ARRAY_COUNT_EXT +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#endif +#ifndef GL_NORMAL_ARRAY_TYPE_EXT +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#endif +#ifndef GL_NORMAL_ARRAY_STRIDE_EXT +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#endif +#ifndef GL_NORMAL_ARRAY_COUNT_EXT +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#endif +#ifndef GL_COLOR_ARRAY_SIZE_EXT +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#endif +#ifndef GL_COLOR_ARRAY_TYPE_EXT +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#endif +#ifndef GL_COLOR_ARRAY_STRIDE_EXT +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#endif +#ifndef GL_COLOR_ARRAY_COUNT_EXT +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#endif +#ifndef GL_INDEX_ARRAY_TYPE_EXT +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#endif +#ifndef GL_INDEX_ARRAY_STRIDE_EXT +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#endif +#ifndef GL_INDEX_ARRAY_COUNT_EXT +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_SIZE_EXT +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_TYPE_EXT +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_STRIDE_EXT +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_COUNT_EXT +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#endif +#ifndef GL_EDGE_FLAG_ARRAY_STRIDE_EXT +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#endif +#ifndef GL_EDGE_FLAG_ARRAY_COUNT_EXT +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#endif +#ifndef GL_VERTEX_ARRAY_POINTER_EXT +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#endif +#ifndef GL_NORMAL_ARRAY_POINTER_EXT +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#endif +#ifndef GL_COLOR_ARRAY_POINTER_EXT +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#endif +#ifndef GL_INDEX_ARRAY_POINTER_EXT +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_POINTER_EXT +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_POINTER_EXT +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif +#ifndef GL_GENERATE_MIPMAP_SGIS +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#endif +#ifndef GL_GENERATE_MIPMAP_HINT_SGIS +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif +#ifndef GL_LINEAR_CLIPMAP_LINEAR_SGIX +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#endif +#ifndef GL_TEXTURE_CLIPMAP_CENTER_SGIX +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#endif +#ifndef GL_TEXTURE_CLIPMAP_FRAME_SGIX +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#endif +#ifndef GL_TEXTURE_CLIPMAP_OFFSET_SGIX +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#endif +#ifndef GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#endif +#ifndef GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#endif +#ifndef GL_TEXTURE_CLIPMAP_DEPTH_SGIX +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#endif +#ifndef GL_MAX_CLIPMAP_DEPTH_SGIX +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#endif +#ifndef GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#endif +#ifndef GL_NEAREST_CLIPMAP_NEAREST_SGIX +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#endif +#ifndef GL_NEAREST_CLIPMAP_LINEAR_SGIX +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#endif +#ifndef GL_LINEAR_CLIPMAP_NEAREST_SGIX +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif +#ifndef GL_TEXTURE_COMPARE_SGIX +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#endif +#ifndef GL_TEXTURE_COMPARE_OPERATOR_SGIX +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#endif +#ifndef GL_TEXTURE_LEQUAL_R_SGIX +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#endif +#ifndef GL_TEXTURE_GEQUAL_R_SGIX +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif +#ifndef GL_CLAMP_TO_EDGE_SGIS +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif +#ifndef GL_CLAMP_TO_BORDER_SGIS +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif +#ifndef GL_FUNC_ADD_EXT +#define GL_FUNC_ADD_EXT 0x8006 +#endif +#ifndef GL_MIN_EXT +#define GL_MIN_EXT 0x8007 +#endif +#ifndef GL_MAX_EXT +#define GL_MAX_EXT 0x8008 +#endif +#ifndef GL_BLEND_EQUATION_EXT +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif +#ifndef GL_FUNC_SUBTRACT_EXT +#define GL_FUNC_SUBTRACT_EXT 0x800A +#endif +#ifndef GL_FUNC_REVERSE_SUBTRACT_EXT +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif +#ifndef GL_INTERLACE_SGIX +#define GL_INTERLACE_SGIX 0x8094 +#endif +#ifndef GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#endif +#ifndef GL_PIXEL_TILE_CACHE_INCREMENT_SGIX +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#endif +#ifndef GL_PIXEL_TILE_WIDTH_SGIX +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#endif +#ifndef GL_PIXEL_TILE_HEIGHT_SGIX +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#endif +#ifndef GL_PIXEL_TILE_GRID_WIDTH_SGIX +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#endif +#ifndef GL_PIXEL_TILE_GRID_HEIGHT_SGIX +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#endif +#ifndef GL_PIXEL_TILE_GRID_DEPTH_SGIX +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#endif +#ifndef GL_PIXEL_TILE_CACHE_SIZE_SGIX +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif +#ifndef GL_DUAL_ALPHA4_SGIS +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#endif +#ifndef GL_DUAL_ALPHA8_SGIS +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#endif +#ifndef GL_DUAL_ALPHA12_SGIS +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#endif +#ifndef GL_DUAL_ALPHA16_SGIS +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#endif +#ifndef GL_DUAL_LUMINANCE4_SGIS +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#endif +#ifndef GL_DUAL_LUMINANCE8_SGIS +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#endif +#ifndef GL_DUAL_LUMINANCE12_SGIS +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#endif +#ifndef GL_DUAL_LUMINANCE16_SGIS +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#endif +#ifndef GL_DUAL_INTENSITY4_SGIS +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#endif +#ifndef GL_DUAL_INTENSITY8_SGIS +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#endif +#ifndef GL_DUAL_INTENSITY12_SGIS +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#endif +#ifndef GL_DUAL_INTENSITY16_SGIS +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#endif +#ifndef GL_DUAL_LUMINANCE_ALPHA4_SGIS +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#endif +#ifndef GL_DUAL_LUMINANCE_ALPHA8_SGIS +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#endif +#ifndef GL_QUAD_ALPHA4_SGIS +#define GL_QUAD_ALPHA4_SGIS 0x811E +#endif +#ifndef GL_QUAD_ALPHA8_SGIS +#define GL_QUAD_ALPHA8_SGIS 0x811F +#endif +#ifndef GL_QUAD_LUMINANCE4_SGIS +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#endif +#ifndef GL_QUAD_LUMINANCE8_SGIS +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#endif +#ifndef GL_QUAD_INTENSITY4_SGIS +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#endif +#ifndef GL_QUAD_INTENSITY8_SGIS +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#endif +#ifndef GL_DUAL_TEXTURE_SELECT_SGIS +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#endif +#ifndef GL_QUAD_TEXTURE_SELECT_SGIS +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif +#ifndef GL_SPRITE_SGIX +#define GL_SPRITE_SGIX 0x8148 +#endif +#ifndef GL_SPRITE_MODE_SGIX +#define GL_SPRITE_MODE_SGIX 0x8149 +#endif +#ifndef GL_SPRITE_AXIS_SGIX +#define GL_SPRITE_AXIS_SGIX 0x814A +#endif +#ifndef GL_SPRITE_TRANSLATION_SGIX +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#endif +#ifndef GL_SPRITE_AXIAL_SGIX +#define GL_SPRITE_AXIAL_SGIX 0x814C +#endif +#ifndef GL_SPRITE_OBJECT_ALIGNED_SGIX +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#endif +#ifndef GL_SPRITE_EYE_ALIGNED_SGIX +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif +#ifndef GL_TEXTURE_MULTI_BUFFER_HINT_SGIX +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif +#ifndef GL_POINT_SIZE_MIN_EXT +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#endif +#ifndef GL_POINT_SIZE_MAX_EXT +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE_EXT +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#endif +#ifndef GL_DISTANCE_ATTENUATION_EXT +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif +#ifndef GL_POINT_SIZE_MIN_SGIS +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#endif +#ifndef GL_POINT_SIZE_MAX_SGIS +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#endif +#ifndef GL_POINT_FADE_THRESHOLD_SIZE_SGIS +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#endif +#ifndef GL_DISTANCE_ATTENUATION_SGIS +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif +#ifndef GL_INSTRUMENT_BUFFER_POINTER_SGIX +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#endif +#ifndef GL_INSTRUMENT_MEASUREMENTS_SGIX +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif +#ifndef GL_POST_TEXTURE_FILTER_BIAS_SGIX +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#endif +#ifndef GL_POST_TEXTURE_FILTER_SCALE_SGIX +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#endif +#ifndef GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#endif +#ifndef GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif +#ifndef GL_FRAMEZOOM_SGIX +#define GL_FRAMEZOOM_SGIX 0x818B +#endif +#ifndef GL_FRAMEZOOM_FACTOR_SGIX +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#endif +#ifndef GL_MAX_FRAMEZOOM_FACTOR_SGIX +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif +#ifndef GL_TEXTURE_DEFORMATION_BIT_SGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#endif +#ifndef GL_GEOMETRY_DEFORMATION_BIT_SGIX +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif +#ifndef GL_GEOMETRY_DEFORMATION_SGIX +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#endif +#ifndef GL_TEXTURE_DEFORMATION_SGIX +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#endif +#ifndef GL_DEFORMATIONS_MASK_SGIX +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#endif +#ifndef GL_MAX_DEFORMATION_ORDER_SGIX +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif +#ifndef GL_REFERENCE_PLANE_SGIX +#define GL_REFERENCE_PLANE_SGIX 0x817D +#endif +#ifndef GL_REFERENCE_PLANE_EQUATION_SGIX +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif +#ifndef GL_DEPTH_COMPONENT16_SGIX +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#endif +#ifndef GL_DEPTH_COMPONENT24_SGIX +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#endif +#ifndef GL_DEPTH_COMPONENT32_SGIX +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif +#ifndef GL_FOG_FUNC_SGIS +#define GL_FOG_FUNC_SGIS 0x812A +#endif +#ifndef GL_FOG_FUNC_POINTS_SGIS +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#endif +#ifndef GL_MAX_FOG_FUNC_POINTS_SGIS +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif +#ifndef GL_FOG_OFFSET_SGIX +#define GL_FOG_OFFSET_SGIX 0x8198 +#endif +#ifndef GL_FOG_OFFSET_VALUE_SGIX +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif +#ifndef GL_IMAGE_SCALE_X_HP +#define GL_IMAGE_SCALE_X_HP 0x8155 +#endif +#ifndef GL_IMAGE_SCALE_Y_HP +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#endif +#ifndef GL_IMAGE_TRANSLATE_X_HP +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#endif +#ifndef GL_IMAGE_TRANSLATE_Y_HP +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#endif +#ifndef GL_IMAGE_ROTATE_ANGLE_HP +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#endif +#ifndef GL_IMAGE_ROTATE_ORIGIN_X_HP +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#endif +#ifndef GL_IMAGE_ROTATE_ORIGIN_Y_HP +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#endif +#ifndef GL_IMAGE_MAG_FILTER_HP +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#endif +#ifndef GL_IMAGE_MIN_FILTER_HP +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#endif +#ifndef GL_IMAGE_CUBIC_WEIGHT_HP +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#endif +#ifndef GL_CUBIC_HP +#define GL_CUBIC_HP 0x815F +#endif +#ifndef GL_AVERAGE_HP +#define GL_AVERAGE_HP 0x8160 +#endif +#ifndef GL_IMAGE_TRANSFORM_2D_HP +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#endif +#ifndef GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#endif +#ifndef GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif +#ifndef GL_IGNORE_BORDER_HP +#define GL_IGNORE_BORDER_HP 0x8150 +#endif +#ifndef GL_CONSTANT_BORDER_HP +#define GL_CONSTANT_BORDER_HP 0x8151 +#endif +#ifndef GL_REPLICATE_BORDER_HP +#define GL_REPLICATE_BORDER_HP 0x8153 +#endif +#ifndef GL_CONVOLUTION_BORDER_COLOR_HP +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif +#ifndef GL_TEXTURE_ENV_BIAS_SGIX +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif +#ifndef GL_VERTEX_DATA_HINT_PGI +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#endif +#ifndef GL_VERTEX_CONSISTENT_HINT_PGI +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#endif +#ifndef GL_MATERIAL_SIDE_HINT_PGI +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#endif +#ifndef GL_MAX_VERTEX_HINT_PGI +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#endif +#ifndef GL_COLOR3_BIT_PGI +#define GL_COLOR3_BIT_PGI 0x00010000 +#endif +#ifndef GL_COLOR4_BIT_PGI +#define GL_COLOR4_BIT_PGI 0x00020000 +#endif +#ifndef GL_EDGEFLAG_BIT_PGI +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#endif +#ifndef GL_INDEX_BIT_PGI +#define GL_INDEX_BIT_PGI 0x00080000 +#endif +#ifndef GL_MAT_AMBIENT_BIT_PGI +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#endif +#ifndef GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#endif +#ifndef GL_MAT_DIFFUSE_BIT_PGI +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#endif +#ifndef GL_MAT_EMISSION_BIT_PGI +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#endif +#ifndef GL_MAT_COLOR_INDEXES_BIT_PGI +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#endif +#ifndef GL_MAT_SHININESS_BIT_PGI +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#endif +#ifndef GL_MAT_SPECULAR_BIT_PGI +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#endif +#ifndef GL_NORMAL_BIT_PGI +#define GL_NORMAL_BIT_PGI 0x08000000 +#endif +#ifndef GL_TEXCOORD1_BIT_PGI +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#endif +#ifndef GL_TEXCOORD2_BIT_PGI +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#endif +#ifndef GL_TEXCOORD3_BIT_PGI +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#endif +#ifndef GL_TEXCOORD4_BIT_PGI +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#endif +#ifndef GL_VERTEX23_BIT_PGI +#define GL_VERTEX23_BIT_PGI 0x00000004 +#endif +#ifndef GL_VERTEX4_BIT_PGI +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif +#ifndef GL_PREFER_DOUBLEBUFFER_HINT_PGI +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#endif +#ifndef GL_CONSERVE_MEMORY_HINT_PGI +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#endif +#ifndef GL_RECLAIM_MEMORY_HINT_PGI +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#endif +#ifndef GL_NATIVE_GRAPHICS_HANDLE_PGI +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#endif +#ifndef GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#endif +#ifndef GL_NATIVE_GRAPHICS_END_HINT_PGI +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#endif +#ifndef GL_ALWAYS_FAST_HINT_PGI +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#endif +#ifndef GL_ALWAYS_SOFT_HINT_PGI +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#endif +#ifndef GL_ALLOW_DRAW_OBJ_HINT_PGI +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#endif +#ifndef GL_ALLOW_DRAW_WIN_HINT_PGI +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#endif +#ifndef GL_ALLOW_DRAW_FRG_HINT_PGI +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#endif +#ifndef GL_ALLOW_DRAW_MEM_HINT_PGI +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#endif +#ifndef GL_STRICT_DEPTHFUNC_HINT_PGI +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#endif +#ifndef GL_STRICT_LIGHTING_HINT_PGI +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#endif +#ifndef GL_STRICT_SCISSOR_HINT_PGI +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#endif +#ifndef GL_FULL_STIPPLE_HINT_PGI +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#endif +#ifndef GL_CLIP_NEAR_HINT_PGI +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#endif +#ifndef GL_CLIP_FAR_HINT_PGI +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#endif +#ifndef GL_WIDE_LINE_HINT_PGI +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#endif +#ifndef GL_BACK_NORMALS_HINT_PGI +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif +#ifndef GL_COLOR_INDEX1_EXT +#define GL_COLOR_INDEX1_EXT 0x80E2 +#endif +#ifndef GL_COLOR_INDEX2_EXT +#define GL_COLOR_INDEX2_EXT 0x80E3 +#endif +#ifndef GL_COLOR_INDEX4_EXT +#define GL_COLOR_INDEX4_EXT 0x80E4 +#endif +#ifndef GL_COLOR_INDEX8_EXT +#define GL_COLOR_INDEX8_EXT 0x80E5 +#endif +#ifndef GL_COLOR_INDEX12_EXT +#define GL_COLOR_INDEX12_EXT 0x80E6 +#endif +#ifndef GL_COLOR_INDEX16_EXT +#define GL_COLOR_INDEX16_EXT 0x80E7 +#endif +#ifndef GL_TEXTURE_INDEX_SIZE_EXT +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif +#ifndef GL_CLIP_VOLUME_CLIPPING_HINT_EXT +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif +#ifndef GL_LIST_PRIORITY_SGIX +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif +#ifndef GL_IR_INSTRUMENT1_SGIX +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif +#ifndef GL_CALLIGRAPHIC_FRAGMENT_SGIX +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif +#ifndef GL_TEXTURE_LOD_BIAS_S_SGIX +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#endif +#ifndef GL_TEXTURE_LOD_BIAS_T_SGIX +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#endif +#ifndef GL_TEXTURE_LOD_BIAS_R_SGIX +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif +#ifndef GL_SHADOW_AMBIENT_SGIX +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif +#ifndef GL_INDEX_MATERIAL_EXT +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#endif +#ifndef GL_INDEX_MATERIAL_PARAMETER_EXT +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#endif +#ifndef GL_INDEX_MATERIAL_FACE_EXT +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif +#ifndef GL_INDEX_TEST_EXT +#define GL_INDEX_TEST_EXT 0x81B5 +#endif +#ifndef GL_INDEX_TEST_FUNC_EXT +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#endif +#ifndef GL_INDEX_TEST_REF_EXT +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif +#ifndef GL_IUI_V2F_EXT +#define GL_IUI_V2F_EXT 0x81AD +#endif +#ifndef GL_IUI_V3F_EXT +#define GL_IUI_V3F_EXT 0x81AE +#endif +#ifndef GL_IUI_N3F_V2F_EXT +#define GL_IUI_N3F_V2F_EXT 0x81AF +#endif +#ifndef GL_IUI_N3F_V3F_EXT +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#endif +#ifndef GL_T2F_IUI_V2F_EXT +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#endif +#ifndef GL_T2F_IUI_V3F_EXT +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#endif +#ifndef GL_T2F_IUI_N3F_V2F_EXT +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#endif +#ifndef GL_T2F_IUI_N3F_V3F_EXT +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif +#ifndef GL_ARRAY_ELEMENT_LOCK_FIRST_EXT +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#endif +#ifndef GL_ARRAY_ELEMENT_LOCK_COUNT_EXT +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif +#ifndef GL_CULL_VERTEX_EXT +#define GL_CULL_VERTEX_EXT 0x81AA +#endif +#ifndef GL_CULL_VERTEX_EYE_POSITION_EXT +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#endif +#ifndef GL_CULL_VERTEX_OBJECT_POSITION_EXT +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif +#ifndef GL_YCRCB_422_SGIX +#define GL_YCRCB_422_SGIX 0x81BB +#endif +#ifndef GL_YCRCB_444_SGIX +#define GL_YCRCB_444_SGIX 0x81BC +#endif +#ifndef GL_FRAGMENT_LIGHTING_SGIX +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#endif +#ifndef GL_FRAGMENT_COLOR_MATERIAL_SGIX +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#endif +#ifndef GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#endif +#ifndef GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#endif +#ifndef GL_MAX_FRAGMENT_LIGHTS_SGIX +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#endif +#ifndef GL_MAX_ACTIVE_LIGHTS_SGIX +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#endif +#ifndef GL_CURRENT_RASTER_NORMAL_SGIX +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#endif +#ifndef GL_LIGHT_ENV_MODE_SGIX +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#endif +#ifndef GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#endif +#ifndef GL_FRAGMENT_LIGHT0_SGIX +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#endif +#ifndef GL_FRAGMENT_LIGHT1_SGIX +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#endif +#ifndef GL_FRAGMENT_LIGHT2_SGIX +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#endif +#ifndef GL_FRAGMENT_LIGHT3_SGIX +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#endif +#ifndef GL_FRAGMENT_LIGHT4_SGIX +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#endif +#ifndef GL_FRAGMENT_LIGHT5_SGIX +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#endif +#ifndef GL_FRAGMENT_LIGHT6_SGIX +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#endif +#ifndef GL_FRAGMENT_LIGHT7_SGIX +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif +#ifndef GL_RASTER_POSITION_UNCLIPPED_IBM +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif +#ifndef GL_TEXTURE_LIGHTING_MODE_HP +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#endif +#ifndef GL_TEXTURE_POST_SPECULAR_HP +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#endif +#ifndef GL_TEXTURE_PRE_SPECULAR_HP +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif +#ifndef GL_MAX_ELEMENTS_VERTICES_EXT +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#endif +#ifndef GL_MAX_ELEMENTS_INDICES_EXT +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif +#ifndef GL_PHONG_WIN +#define GL_PHONG_WIN 0x80EA +#endif +#ifndef GL_PHONG_HINT_WIN +#define GL_PHONG_HINT_WIN 0x80EB +#endif +#ifndef GL_FOG_SPECULAR_TEXTURE_WIN +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif +#ifndef GL_FRAGMENT_MATERIAL_EXT +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#endif +#ifndef GL_FRAGMENT_NORMAL_EXT +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#endif +#ifndef GL_FRAGMENT_COLOR_EXT +#define GL_FRAGMENT_COLOR_EXT 0x834C +#endif +#ifndef GL_ATTENUATION_EXT +#define GL_ATTENUATION_EXT 0x834D +#endif +#ifndef GL_SHADOW_ATTENUATION_EXT +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#endif +#ifndef GL_TEXTURE_APPLICATION_MODE_EXT +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#endif +#ifndef GL_TEXTURE_LIGHT_EXT +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#endif +#ifndef GL_TEXTURE_MATERIAL_FACE_EXT +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#endif +#ifndef GL_TEXTURE_MATERIAL_PARAMETER_EXT +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +#endif +#ifndef GL_ALPHA_MIN_SGIX +#define GL_ALPHA_MIN_SGIX 0x8320 +#endif +#ifndef GL_ALPHA_MAX_SGIX +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif +#ifndef GL_PIXEL_TEX_GEN_Q_CEILING_SGIX +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#endif +#ifndef GL_PIXEL_TEX_GEN_Q_ROUND_SGIX +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#endif +#ifndef GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#endif +#ifndef GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif +#ifndef GL_BGR_EXT +#define GL_BGR_EXT 0x80E0 +#endif +#ifndef GL_BGRA_EXT +#define GL_BGRA_EXT 0x80E1 +#endif +#ifndef GL_ASYNC_MARKER_SGIX +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif +#ifndef GL_ASYNC_TEX_IMAGE_SGIX +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#endif +#ifndef GL_ASYNC_DRAW_PIXELS_SGIX +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#endif +#ifndef GL_ASYNC_READ_PIXELS_SGIX +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#endif +#ifndef GL_MAX_ASYNC_TEX_IMAGE_SGIX +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#endif +#ifndef GL_MAX_ASYNC_DRAW_PIXELS_SGIX +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#endif +#ifndef GL_MAX_ASYNC_READ_PIXELS_SGIX +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif +#ifndef GL_ASYNC_HISTOGRAM_SGIX +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#endif +#ifndef GL_MAX_ASYNC_HISTOGRAM_SGIX +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif +#ifndef GL_PARALLEL_ARRAYS_INTEL +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#endif +#ifndef GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#endif +#ifndef GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#endif +#ifndef GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif +#ifndef GL_OCCLUSION_TEST_HP +#define GL_OCCLUSION_TEST_HP 0x8165 +#endif +#ifndef GL_OCCLUSION_TEST_RESULT_HP +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif +#ifndef GL_PIXEL_TRANSFORM_2D_EXT +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#endif +#ifndef GL_PIXEL_MAG_FILTER_EXT +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#endif +#ifndef GL_PIXEL_MIN_FILTER_EXT +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#endif +#ifndef GL_PIXEL_CUBIC_WEIGHT_EXT +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#endif +#ifndef GL_CUBIC_EXT +#define GL_CUBIC_EXT 0x8334 +#endif +#ifndef GL_AVERAGE_EXT +#define GL_AVERAGE_EXT 0x8335 +#endif +#ifndef GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#endif +#ifndef GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#endif +#ifndef GL_PIXEL_TRANSFORM_2D_MATRIX_EXT +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif +#ifndef GL_SHARED_TEXTURE_PALETTE_EXT +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif +#ifndef GL_LIGHT_MODEL_COLOR_CONTROL_EXT +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#endif +#ifndef GL_SINGLE_COLOR_EXT +#define GL_SINGLE_COLOR_EXT 0x81F9 +#endif +#ifndef GL_SEPARATE_SPECULAR_COLOR_EXT +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif +#ifndef GL_COLOR_SUM_EXT +#define GL_COLOR_SUM_EXT 0x8458 +#endif +#ifndef GL_CURRENT_SECONDARY_COLOR_EXT +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_SIZE_EXT +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_TYPE_EXT +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_POINTER_EXT +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_EXT +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif +#ifndef GL_PERTURB_EXT +#define GL_PERTURB_EXT 0x85AE +#endif +#ifndef GL_TEXTURE_NORMAL_EXT +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif +#ifndef GL_FOG_COORDINATE_SOURCE_EXT +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#endif +#ifndef GL_FOG_COORDINATE_EXT +#define GL_FOG_COORDINATE_EXT 0x8451 +#endif +#ifndef GL_FRAGMENT_DEPTH_EXT +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#endif +#ifndef GL_CURRENT_FOG_COORDINATE_EXT +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_TYPE_EXT +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_STRIDE_EXT +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_POINTER_EXT +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_EXT +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif +#ifndef GL_SCREEN_COORDINATES_REND +#define GL_SCREEN_COORDINATES_REND 0x8490 +#endif +#ifndef GL_INVERTED_SCREEN_W_REND +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif +#ifndef GL_TANGENT_ARRAY_EXT +#define GL_TANGENT_ARRAY_EXT 0x8439 +#endif +#ifndef GL_BINORMAL_ARRAY_EXT +#define GL_BINORMAL_ARRAY_EXT 0x843A +#endif +#ifndef GL_CURRENT_TANGENT_EXT +#define GL_CURRENT_TANGENT_EXT 0x843B +#endif +#ifndef GL_CURRENT_BINORMAL_EXT +#define GL_CURRENT_BINORMAL_EXT 0x843C +#endif +#ifndef GL_TANGENT_ARRAY_TYPE_EXT +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#endif +#ifndef GL_TANGENT_ARRAY_STRIDE_EXT +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#endif +#ifndef GL_BINORMAL_ARRAY_TYPE_EXT +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#endif +#ifndef GL_BINORMAL_ARRAY_STRIDE_EXT +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#endif +#ifndef GL_TANGENT_ARRAY_POINTER_EXT +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#endif +#ifndef GL_BINORMAL_ARRAY_POINTER_EXT +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#endif +#ifndef GL_MAP1_TANGENT_EXT +#define GL_MAP1_TANGENT_EXT 0x8444 +#endif +#ifndef GL_MAP2_TANGENT_EXT +#define GL_MAP2_TANGENT_EXT 0x8445 +#endif +#ifndef GL_MAP1_BINORMAL_EXT +#define GL_MAP1_BINORMAL_EXT 0x8446 +#endif +#ifndef GL_MAP2_BINORMAL_EXT +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif +#ifndef GL_COMBINE_EXT +#define GL_COMBINE_EXT 0x8570 +#endif +#ifndef GL_COMBINE_RGB_EXT +#define GL_COMBINE_RGB_EXT 0x8571 +#endif +#ifndef GL_COMBINE_ALPHA_EXT +#define GL_COMBINE_ALPHA_EXT 0x8572 +#endif +#ifndef GL_RGB_SCALE_EXT +#define GL_RGB_SCALE_EXT 0x8573 +#endif +#ifndef GL_ADD_SIGNED_EXT +#define GL_ADD_SIGNED_EXT 0x8574 +#endif +#ifndef GL_INTERPOLATE_EXT +#define GL_INTERPOLATE_EXT 0x8575 +#endif +#ifndef GL_CONSTANT_EXT +#define GL_CONSTANT_EXT 0x8576 +#endif +#ifndef GL_PRIMARY_COLOR_EXT +#define GL_PRIMARY_COLOR_EXT 0x8577 +#endif +#ifndef GL_PREVIOUS_EXT +#define GL_PREVIOUS_EXT 0x8578 +#endif +#ifndef GL_SOURCE0_RGB_EXT +#define GL_SOURCE0_RGB_EXT 0x8580 +#endif +#ifndef GL_SOURCE1_RGB_EXT +#define GL_SOURCE1_RGB_EXT 0x8581 +#endif +#ifndef GL_SOURCE2_RGB_EXT +#define GL_SOURCE2_RGB_EXT 0x8582 +#endif +#ifndef GL_SOURCE0_ALPHA_EXT +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#endif +#ifndef GL_SOURCE1_ALPHA_EXT +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#endif +#ifndef GL_SOURCE2_ALPHA_EXT +#define GL_SOURCE2_ALPHA_EXT 0x858A +#endif +#ifndef GL_OPERAND0_RGB_EXT +#define GL_OPERAND0_RGB_EXT 0x8590 +#endif +#ifndef GL_OPERAND1_RGB_EXT +#define GL_OPERAND1_RGB_EXT 0x8591 +#endif +#ifndef GL_OPERAND2_RGB_EXT +#define GL_OPERAND2_RGB_EXT 0x8592 +#endif +#ifndef GL_OPERAND0_ALPHA_EXT +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#endif +#ifndef GL_OPERAND1_ALPHA_EXT +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#endif +#ifndef GL_OPERAND2_ALPHA_EXT +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif +#ifndef GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif +#ifndef GL_TRANSFORM_HINT_APPLE +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif +#ifndef GL_FOG_SCALE_SGIX +#define GL_FOG_SCALE_SGIX 0x81FC +#endif +#ifndef GL_FOG_SCALE_VALUE_SGIX +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif +#ifndef GL_UNPACK_CONSTANT_DATA_SUNX +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#endif +#ifndef GL_TEXTURE_CONSTANT_DATA_SUNX +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif +#ifndef GL_GLOBAL_ALPHA_SUN +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#endif +#ifndef GL_GLOBAL_ALPHA_FACTOR_SUN +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif +#ifndef GL_RESTART_SUN +#define GL_RESTART_SUN 0x0001 +#endif +#ifndef GL_REPLACE_MIDDLE_SUN +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#endif +#ifndef GL_REPLACE_OLDEST_SUN +#define GL_REPLACE_OLDEST_SUN 0x0003 +#endif +#ifndef GL_TRIANGLE_LIST_SUN +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#endif +#ifndef GL_REPLACEMENT_CODE_SUN +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#endif +#ifndef GL_REPLACEMENT_CODE_ARRAY_SUN +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#endif +#ifndef GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#endif +#ifndef GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#endif +#ifndef GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#endif +#ifndef GL_R1UI_V3F_SUN +#define GL_R1UI_V3F_SUN 0x85C4 +#endif +#ifndef GL_R1UI_C4UB_V3F_SUN +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#endif +#ifndef GL_R1UI_C3F_V3F_SUN +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#endif +#ifndef GL_R1UI_N3F_V3F_SUN +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#endif +#ifndef GL_R1UI_C4F_N3F_V3F_SUN +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#endif +#ifndef GL_R1UI_T2F_V3F_SUN +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#endif +#ifndef GL_R1UI_T2F_N3F_V3F_SUN +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#endif +#ifndef GL_R1UI_T2F_C4F_N3F_V3F_SUN +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif +#ifndef GL_BLEND_DST_RGB_EXT +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#endif +#ifndef GL_BLEND_SRC_RGB_EXT +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#endif +#ifndef GL_BLEND_DST_ALPHA_EXT +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#endif +#ifndef GL_BLEND_SRC_ALPHA_EXT +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif +#ifndef GL_RED_MIN_CLAMP_INGR +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#endif +#ifndef GL_GREEN_MIN_CLAMP_INGR +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#endif +#ifndef GL_BLUE_MIN_CLAMP_INGR +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#endif +#ifndef GL_ALPHA_MIN_CLAMP_INGR +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#endif +#ifndef GL_RED_MAX_CLAMP_INGR +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#endif +#ifndef GL_GREEN_MAX_CLAMP_INGR +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#endif +#ifndef GL_BLUE_MAX_CLAMP_INGR +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#endif +#ifndef GL_ALPHA_MAX_CLAMP_INGR +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif +#ifndef GL_INTERLACE_READ_INGR +#define GL_INTERLACE_READ_INGR 0x8568 +#endif +#ifndef GL_INCR_WRAP_EXT +#define GL_INCR_WRAP_EXT 0x8507 +#endif +#ifndef GL_DECR_WRAP_EXT +#define GL_DECR_WRAP_EXT 0x8508 +#endif +#ifndef GL_422_EXT +#define GL_422_EXT 0x80CC +#endif +#ifndef GL_422_REV_EXT +#define GL_422_REV_EXT 0x80CD +#endif +#ifndef GL_422_AVERAGE_EXT +#define GL_422_AVERAGE_EXT 0x80CE +#endif +#ifndef GL_422_REV_AVERAGE_EXT +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif +#ifndef GL_NORMAL_MAP_NV +#define GL_NORMAL_MAP_NV 0x8511 +#endif +#ifndef GL_REFLECTION_MAP_NV +#define GL_REFLECTION_MAP_NV 0x8512 +#endif +#ifndef GL_NORMAL_MAP_EXT +#define GL_NORMAL_MAP_EXT 0x8511 +#endif +#ifndef GL_REFLECTION_MAP_EXT +#define GL_REFLECTION_MAP_EXT 0x8512 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_EXT +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#endif +#ifndef GL_TEXTURE_BINDING_CUBE_MAP_EXT +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#endif +#ifndef GL_PROXY_TEXTURE_CUBE_MAP_EXT +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#endif +#ifndef GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif +#ifndef GL_WRAP_BORDER_SUN +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif +#ifndef GL_MAX_TEXTURE_LOD_BIAS_EXT +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#endif +#ifndef GL_TEXTURE_FILTER_CONTROL_EXT +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#endif +#ifndef GL_TEXTURE_LOD_BIAS_EXT +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif +#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#endif +#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif +#ifndef GL_MODELVIEW0_STACK_DEPTH_EXT +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#endif +#ifndef GL_MODELVIEW1_STACK_DEPTH_EXT +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#endif +#ifndef GL_MODELVIEW0_MATRIX_EXT +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#endif +#ifndef GL_MODELVIEW1_MATRIX_EXT +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#endif +#ifndef GL_VERTEX_WEIGHTING_EXT +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#endif +#ifndef GL_MODELVIEW0_EXT +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#endif +#ifndef GL_MODELVIEW1_EXT +#define GL_MODELVIEW1_EXT 0x850A +#endif +#ifndef GL_CURRENT_VERTEX_WEIGHT_EXT +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#endif +#ifndef GL_VERTEX_WEIGHT_ARRAY_EXT +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#endif +#ifndef GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#endif +#ifndef GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#endif +#ifndef GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#endif +#ifndef GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif +#ifndef GL_MAX_SHININESS_NV +#define GL_MAX_SHININESS_NV 0x8504 +#endif +#ifndef GL_MAX_SPOT_EXPONENT_NV +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_NV +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_LENGTH_NV +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_VALID_NV +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#endif +#ifndef GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_POINTER_NV +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif +#ifndef GL_REGISTER_COMBINERS_NV +#define GL_REGISTER_COMBINERS_NV 0x8522 +#endif +#ifndef GL_VARIABLE_A_NV +#define GL_VARIABLE_A_NV 0x8523 +#endif +#ifndef GL_VARIABLE_B_NV +#define GL_VARIABLE_B_NV 0x8524 +#endif +#ifndef GL_VARIABLE_C_NV +#define GL_VARIABLE_C_NV 0x8525 +#endif +#ifndef GL_VARIABLE_D_NV +#define GL_VARIABLE_D_NV 0x8526 +#endif +#ifndef GL_VARIABLE_E_NV +#define GL_VARIABLE_E_NV 0x8527 +#endif +#ifndef GL_VARIABLE_F_NV +#define GL_VARIABLE_F_NV 0x8528 +#endif +#ifndef GL_VARIABLE_G_NV +#define GL_VARIABLE_G_NV 0x8529 +#endif +#ifndef GL_CONSTANT_COLOR0_NV +#define GL_CONSTANT_COLOR0_NV 0x852A +#endif +#ifndef GL_CONSTANT_COLOR1_NV +#define GL_CONSTANT_COLOR1_NV 0x852B +#endif +#ifndef GL_PRIMARY_COLOR_NV +#define GL_PRIMARY_COLOR_NV 0x852C +#endif +#ifndef GL_SECONDARY_COLOR_NV +#define GL_SECONDARY_COLOR_NV 0x852D +#endif +#ifndef GL_SPARE0_NV +#define GL_SPARE0_NV 0x852E +#endif +#ifndef GL_SPARE1_NV +#define GL_SPARE1_NV 0x852F +#endif +#ifndef GL_DISCARD_NV +#define GL_DISCARD_NV 0x8530 +#endif +#ifndef GL_E_TIMES_F_NV +#define GL_E_TIMES_F_NV 0x8531 +#endif +#ifndef GL_SPARE0_PLUS_SECONDARY_COLOR_NV +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#endif +#ifndef GL_UNSIGNED_IDENTITY_NV +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#endif +#ifndef GL_UNSIGNED_INVERT_NV +#define GL_UNSIGNED_INVERT_NV 0x8537 +#endif +#ifndef GL_EXPAND_NORMAL_NV +#define GL_EXPAND_NORMAL_NV 0x8538 +#endif +#ifndef GL_EXPAND_NEGATE_NV +#define GL_EXPAND_NEGATE_NV 0x8539 +#endif +#ifndef GL_HALF_BIAS_NORMAL_NV +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#endif +#ifndef GL_HALF_BIAS_NEGATE_NV +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#endif +#ifndef GL_SIGNED_IDENTITY_NV +#define GL_SIGNED_IDENTITY_NV 0x853C +#endif +#ifndef GL_SIGNED_NEGATE_NV +#define GL_SIGNED_NEGATE_NV 0x853D +#endif +#ifndef GL_SCALE_BY_TWO_NV +#define GL_SCALE_BY_TWO_NV 0x853E +#endif +#ifndef GL_SCALE_BY_FOUR_NV +#define GL_SCALE_BY_FOUR_NV 0x853F +#endif +#ifndef GL_SCALE_BY_ONE_HALF_NV +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#endif +#ifndef GL_BIAS_BY_NEGATIVE_ONE_HALF_NV +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#endif +#ifndef GL_COMBINER_INPUT_NV +#define GL_COMBINER_INPUT_NV 0x8542 +#endif +#ifndef GL_COMBINER_MAPPING_NV +#define GL_COMBINER_MAPPING_NV 0x8543 +#endif +#ifndef GL_COMBINER_COMPONENT_USAGE_NV +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#endif +#ifndef GL_COMBINER_AB_DOT_PRODUCT_NV +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#endif +#ifndef GL_COMBINER_CD_DOT_PRODUCT_NV +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#endif +#ifndef GL_COMBINER_MUX_SUM_NV +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#endif +#ifndef GL_COMBINER_SCALE_NV +#define GL_COMBINER_SCALE_NV 0x8548 +#endif +#ifndef GL_COMBINER_BIAS_NV +#define GL_COMBINER_BIAS_NV 0x8549 +#endif +#ifndef GL_COMBINER_AB_OUTPUT_NV +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#endif +#ifndef GL_COMBINER_CD_OUTPUT_NV +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#endif +#ifndef GL_COMBINER_SUM_OUTPUT_NV +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#endif +#ifndef GL_MAX_GENERAL_COMBINERS_NV +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#endif +#ifndef GL_NUM_GENERAL_COMBINERS_NV +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#endif +#ifndef GL_COLOR_SUM_CLAMP_NV +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#endif +#ifndef GL_COMBINER0_NV +#define GL_COMBINER0_NV 0x8550 +#endif +#ifndef GL_COMBINER1_NV +#define GL_COMBINER1_NV 0x8551 +#endif +#ifndef GL_COMBINER2_NV +#define GL_COMBINER2_NV 0x8552 +#endif +#ifndef GL_COMBINER3_NV +#define GL_COMBINER3_NV 0x8553 +#endif +#ifndef GL_COMBINER4_NV +#define GL_COMBINER4_NV 0x8554 +#endif +#ifndef GL_COMBINER5_NV +#define GL_COMBINER5_NV 0x8555 +#endif +#ifndef GL_COMBINER6_NV +#define GL_COMBINER6_NV 0x8556 +#endif +#ifndef GL_COMBINER7_NV +#define GL_COMBINER7_NV 0x8557 +#endif +#ifndef GL_FOG_DISTANCE_MODE_NV +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#endif +#ifndef GL_EYE_RADIAL_NV +#define GL_EYE_RADIAL_NV 0x855B +#endif +#ifndef GL_EYE_PLANE_ABSOLUTE_NV +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +#endif +#ifndef GL_EMBOSS_LIGHT_NV +#define GL_EMBOSS_LIGHT_NV 0x855D +#endif +#ifndef GL_EMBOSS_CONSTANT_NV +#define GL_EMBOSS_CONSTANT_NV 0x855E +#endif +#ifndef GL_EMBOSS_MAP_NV +#define GL_EMBOSS_MAP_NV 0x855F +#endif +#ifndef GL_COMBINE4_NV +#define GL_COMBINE4_NV 0x8503 +#endif +#ifndef GL_SOURCE3_RGB_NV +#define GL_SOURCE3_RGB_NV 0x8583 +#endif +#ifndef GL_SOURCE3_ALPHA_NV +#define GL_SOURCE3_ALPHA_NV 0x858B +#endif +#ifndef GL_OPERAND3_RGB_NV +#define GL_OPERAND3_RGB_NV 0x8593 +#endif +#ifndef GL_OPERAND3_ALPHA_NV +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif +#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif +#ifndef GL_CULL_VERTEX_IBM +#define GL_CULL_VERTEX_IBM 103050 +#endif +#ifndef GL_VERTEX_ARRAY_LIST_IBM +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#endif +#ifndef GL_NORMAL_ARRAY_LIST_IBM +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#endif +#ifndef GL_COLOR_ARRAY_LIST_IBM +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#endif +#ifndef GL_INDEX_ARRAY_LIST_IBM +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_LIST_IBM +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_LIST_IBM +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_LIST_IBM +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_LIST_IBM +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#endif +#ifndef GL_VERTEX_ARRAY_LIST_STRIDE_IBM +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#endif +#ifndef GL_NORMAL_ARRAY_LIST_STRIDE_IBM +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#endif +#ifndef GL_COLOR_ARRAY_LIST_STRIDE_IBM +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#endif +#ifndef GL_INDEX_ARRAY_LIST_STRIDE_IBM +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#endif +#ifndef GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#endif +#ifndef GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#endif +#ifndef GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#endif +#ifndef GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif +#ifndef GL_PACK_SUBSAMPLE_RATE_SGIX +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#endif +#ifndef GL_UNPACK_SUBSAMPLE_RATE_SGIX +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_4444_SGIX +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_2424_SGIX +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_4242_SGIX +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif +#ifndef GL_PACK_SUBSAMPLE_RATE_SGIX +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#endif +#ifndef GL_UNPACK_SUBSAMPLE_RATE_SGIX +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_4444_SGIX +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_2424_SGIX +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#endif +#ifndef GL_PIXEL_SUBSAMPLE_4242_SGIX +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif +#ifndef GL_YCRCB_SGIX +#define GL_YCRCB_SGIX 0x8318 +#endif +#ifndef GL_YCRCBA_SGIX +#define GL_YCRCBA_SGIX 0x8319 +#endif +#ifndef GL_DEPTH_PASS_INSTRUMENT_SGIX +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#endif +#ifndef GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#endif +#ifndef GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif +#ifndef GL_COMPRESSED_RGB_FXT1_3DFX +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#endif +#ifndef GL_COMPRESSED_RGBA_FXT1_3DFX +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif +#ifndef GL_MULTISAMPLE_3DFX +#define GL_MULTISAMPLE_3DFX 0x86B2 +#endif +#ifndef GL_SAMPLE_BUFFERS_3DFX +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#endif +#ifndef GL_SAMPLES_3DFX +#define GL_SAMPLES_3DFX 0x86B4 +#endif +#ifndef GL_MULTISAMPLE_BIT_3DFX +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif +#ifndef GL_MULTISAMPLE_EXT +#define GL_MULTISAMPLE_EXT 0x809D +#endif +#ifndef GL_SAMPLE_ALPHA_TO_MASK_EXT +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#endif +#ifndef GL_SAMPLE_ALPHA_TO_ONE_EXT +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#endif +#ifndef GL_SAMPLE_MASK_EXT +#define GL_SAMPLE_MASK_EXT 0x80A0 +#endif +#ifndef GL_1PASS_EXT +#define GL_1PASS_EXT 0x80A1 +#endif +#ifndef GL_2PASS_0_EXT +#define GL_2PASS_0_EXT 0x80A2 +#endif +#ifndef GL_2PASS_1_EXT +#define GL_2PASS_1_EXT 0x80A3 +#endif +#ifndef GL_4PASS_0_EXT +#define GL_4PASS_0_EXT 0x80A4 +#endif +#ifndef GL_4PASS_1_EXT +#define GL_4PASS_1_EXT 0x80A5 +#endif +#ifndef GL_4PASS_2_EXT +#define GL_4PASS_2_EXT 0x80A6 +#endif +#ifndef GL_4PASS_3_EXT +#define GL_4PASS_3_EXT 0x80A7 +#endif +#ifndef GL_SAMPLE_BUFFERS_EXT +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#endif +#ifndef GL_SAMPLES_EXT +#define GL_SAMPLES_EXT 0x80A9 +#endif +#ifndef GL_SAMPLE_MASK_VALUE_EXT +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#endif +#ifndef GL_SAMPLE_MASK_INVERT_EXT +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#endif +#ifndef GL_SAMPLE_PATTERN_EXT +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#endif +#ifndef GL_MULTISAMPLE_BIT_EXT +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif +#ifndef GL_VERTEX_PRECLIP_SGIX +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#endif +#ifndef GL_VERTEX_PRECLIP_HINT_SGIX +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif +#ifndef GL_CONVOLUTION_HINT_SGIX +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif +#ifndef GL_PACK_RESAMPLE_SGIX +#define GL_PACK_RESAMPLE_SGIX 0x842C +#endif +#ifndef GL_UNPACK_RESAMPLE_SGIX +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#endif +#ifndef GL_RESAMPLE_REPLICATE_SGIX +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#endif +#ifndef GL_RESAMPLE_ZERO_FILL_SGIX +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#endif +#ifndef GL_RESAMPLE_DECIMATE_SGIX +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif +#ifndef GL_EYE_DISTANCE_TO_POINT_SGIS +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#endif +#ifndef GL_OBJECT_DISTANCE_TO_POINT_SGIS +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#endif +#ifndef GL_EYE_DISTANCE_TO_LINE_SGIS +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#endif +#ifndef GL_OBJECT_DISTANCE_TO_LINE_SGIS +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#endif +#ifndef GL_EYE_POINT_SGIS +#define GL_EYE_POINT_SGIS 0x81F4 +#endif +#ifndef GL_OBJECT_POINT_SGIS +#define GL_OBJECT_POINT_SGIS 0x81F5 +#endif +#ifndef GL_EYE_LINE_SGIS +#define GL_EYE_LINE_SGIS 0x81F6 +#endif +#ifndef GL_OBJECT_LINE_SGIS +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif +#ifndef GL_TEXTURE_COLOR_WRITEMASK_SGIS +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif +#ifndef GL_DOT3_RGB_EXT +#define GL_DOT3_RGB_EXT 0x8740 +#endif +#ifndef GL_DOT3_RGBA_EXT +#define GL_DOT3_RGBA_EXT 0x8741 +#endif +#ifndef GL_MIRROR_CLAMP_ATI +#define GL_MIRROR_CLAMP_ATI 0x8742 +#endif +#ifndef GL_MIRROR_CLAMP_TO_EDGE_ATI +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif +#ifndef GL_ALL_COMPLETED_NV +#define GL_ALL_COMPLETED_NV 0x84F2 +#endif +#ifndef GL_FENCE_STATUS_NV +#define GL_FENCE_STATUS_NV 0x84F3 +#endif +#ifndef GL_FENCE_CONDITION_NV +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif +#ifndef GL_MIRRORED_REPEAT_IBM +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif +#ifndef GL_EVAL_2D_NV +#define GL_EVAL_2D_NV 0x86C0 +#endif +#ifndef GL_EVAL_TRIANGULAR_2D_NV +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#endif +#ifndef GL_MAP_TESSELLATION_NV +#define GL_MAP_TESSELLATION_NV 0x86C2 +#endif +#ifndef GL_MAP_ATTRIB_U_ORDER_NV +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#endif +#ifndef GL_MAP_ATTRIB_V_ORDER_NV +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#endif +#ifndef GL_EVAL_FRACTIONAL_TESSELLATION_NV +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB0_NV +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB1_NV +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB2_NV +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB3_NV +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB4_NV +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB5_NV +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB6_NV +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB7_NV +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB8_NV +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB9_NV +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB10_NV +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB11_NV +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB12_NV +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB13_NV +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB14_NV +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#endif +#ifndef GL_EVAL_VERTEX_ATTRIB15_NV +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#endif +#ifndef GL_MAX_MAP_TESSELLATION_NV +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#endif +#ifndef GL_MAX_RATIONAL_EVAL_ORDER_NV +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif +#ifndef GL_DEPTH_STENCIL_NV +#define GL_DEPTH_STENCIL_NV 0x84F9 +#endif +#ifndef GL_UNSIGNED_INT_24_8_NV +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif +#ifndef GL_PER_STAGE_CONSTANTS_NV +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif +#ifndef GL_TEXTURE_RECTANGLE_NV +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#endif +#ifndef GL_TEXTURE_BINDING_RECTANGLE_NV +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#endif +#ifndef GL_PROXY_TEXTURE_RECTANGLE_NV +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#endif +#ifndef GL_MAX_RECTANGLE_TEXTURE_SIZE_NV +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif +#ifndef GL_OFFSET_TEXTURE_RECTANGLE_NV +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#endif +#ifndef GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#endif +#ifndef GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#endif +#ifndef GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#endif +#ifndef GL_UNSIGNED_INT_S8_S8_8_8_NV +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#endif +#ifndef GL_UNSIGNED_INT_8_8_S8_S8_REV_NV +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#endif +#ifndef GL_DSDT_MAG_INTENSITY_NV +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#endif +#ifndef GL_SHADER_CONSISTENT_NV +#define GL_SHADER_CONSISTENT_NV 0x86DD +#endif +#ifndef GL_TEXTURE_SHADER_NV +#define GL_TEXTURE_SHADER_NV 0x86DE +#endif +#ifndef GL_SHADER_OPERATION_NV +#define GL_SHADER_OPERATION_NV 0x86DF +#endif +#ifndef GL_CULL_MODES_NV +#define GL_CULL_MODES_NV 0x86E0 +#endif +#ifndef GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#endif +#ifndef GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#endif +#ifndef GL_OFFSET_TEXTURE_BIAS_NV +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#endif +#ifndef GL_OFFSET_TEXTURE_2D_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#endif +#ifndef GL_OFFSET_TEXTURE_2D_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#endif +#ifndef GL_OFFSET_TEXTURE_2D_BIAS_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#endif +#ifndef GL_PREVIOUS_TEXTURE_INPUT_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#endif +#ifndef GL_CONST_EYE_NV +#define GL_CONST_EYE_NV 0x86E5 +#endif +#ifndef GL_PASS_THROUGH_NV +#define GL_PASS_THROUGH_NV 0x86E6 +#endif +#ifndef GL_CULL_FRAGMENT_NV +#define GL_CULL_FRAGMENT_NV 0x86E7 +#endif +#ifndef GL_OFFSET_TEXTURE_2D_NV +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#endif +#ifndef GL_DEPENDENT_AR_TEXTURE_2D_NV +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#endif +#ifndef GL_DEPENDENT_GB_TEXTURE_2D_NV +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#endif +#ifndef GL_DOT_PRODUCT_NV +#define GL_DOT_PRODUCT_NV 0x86EC +#endif +#ifndef GL_DOT_PRODUCT_DEPTH_REPLACE_NV +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#endif +#ifndef GL_DOT_PRODUCT_TEXTURE_2D_NV +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#endif +#ifndef GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#endif +#ifndef GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#endif +#ifndef GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#endif +#ifndef GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#endif +#ifndef GL_HILO_NV +#define GL_HILO_NV 0x86F4 +#endif +#ifndef GL_DSDT_NV +#define GL_DSDT_NV 0x86F5 +#endif +#ifndef GL_DSDT_MAG_NV +#define GL_DSDT_MAG_NV 0x86F6 +#endif +#ifndef GL_DSDT_MAG_VIB_NV +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#endif +#ifndef GL_HILO16_NV +#define GL_HILO16_NV 0x86F8 +#endif +#ifndef GL_SIGNED_HILO_NV +#define GL_SIGNED_HILO_NV 0x86F9 +#endif +#ifndef GL_SIGNED_HILO16_NV +#define GL_SIGNED_HILO16_NV 0x86FA +#endif +#ifndef GL_SIGNED_RGBA_NV +#define GL_SIGNED_RGBA_NV 0x86FB +#endif +#ifndef GL_SIGNED_RGBA8_NV +#define GL_SIGNED_RGBA8_NV 0x86FC +#endif +#ifndef GL_SIGNED_RGB_NV +#define GL_SIGNED_RGB_NV 0x86FE +#endif +#ifndef GL_SIGNED_RGB8_NV +#define GL_SIGNED_RGB8_NV 0x86FF +#endif +#ifndef GL_SIGNED_LUMINANCE_NV +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#endif +#ifndef GL_SIGNED_LUMINANCE8_NV +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#endif +#ifndef GL_SIGNED_LUMINANCE_ALPHA_NV +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#endif +#ifndef GL_SIGNED_LUMINANCE8_ALPHA8_NV +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#endif +#ifndef GL_SIGNED_ALPHA_NV +#define GL_SIGNED_ALPHA_NV 0x8705 +#endif +#ifndef GL_SIGNED_ALPHA8_NV +#define GL_SIGNED_ALPHA8_NV 0x8706 +#endif +#ifndef GL_SIGNED_INTENSITY_NV +#define GL_SIGNED_INTENSITY_NV 0x8707 +#endif +#ifndef GL_SIGNED_INTENSITY8_NV +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#endif +#ifndef GL_DSDT8_NV +#define GL_DSDT8_NV 0x8709 +#endif +#ifndef GL_DSDT8_MAG8_NV +#define GL_DSDT8_MAG8_NV 0x870A +#endif +#ifndef GL_DSDT8_MAG8_INTENSITY8_NV +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#endif +#ifndef GL_SIGNED_RGB_UNSIGNED_ALPHA_NV +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#endif +#ifndef GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#endif +#ifndef GL_HI_SCALE_NV +#define GL_HI_SCALE_NV 0x870E +#endif +#ifndef GL_LO_SCALE_NV +#define GL_LO_SCALE_NV 0x870F +#endif +#ifndef GL_DS_SCALE_NV +#define GL_DS_SCALE_NV 0x8710 +#endif +#ifndef GL_DT_SCALE_NV +#define GL_DT_SCALE_NV 0x8711 +#endif +#ifndef GL_MAGNITUDE_SCALE_NV +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#endif +#ifndef GL_VIBRANCE_SCALE_NV +#define GL_VIBRANCE_SCALE_NV 0x8713 +#endif +#ifndef GL_HI_BIAS_NV +#define GL_HI_BIAS_NV 0x8714 +#endif +#ifndef GL_LO_BIAS_NV +#define GL_LO_BIAS_NV 0x8715 +#endif +#ifndef GL_DS_BIAS_NV +#define GL_DS_BIAS_NV 0x8716 +#endif +#ifndef GL_DT_BIAS_NV +#define GL_DT_BIAS_NV 0x8717 +#endif +#ifndef GL_MAGNITUDE_BIAS_NV +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#endif +#ifndef GL_VIBRANCE_BIAS_NV +#define GL_VIBRANCE_BIAS_NV 0x8719 +#endif +#ifndef GL_TEXTURE_BORDER_VALUES_NV +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#endif +#ifndef GL_TEXTURE_HI_SIZE_NV +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#endif +#ifndef GL_TEXTURE_LO_SIZE_NV +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#endif +#ifndef GL_TEXTURE_DS_SIZE_NV +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#endif +#ifndef GL_TEXTURE_DT_SIZE_NV +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#endif +#ifndef GL_TEXTURE_MAG_SIZE_NV +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif +#ifndef GL_DOT_PRODUCT_TEXTURE_3D_NV +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif +#ifndef GL_VERTEX_PROGRAM_NV +#define GL_VERTEX_PROGRAM_NV 0x8620 +#endif +#ifndef GL_VERTEX_STATE_PROGRAM_NV +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#endif +#ifndef GL_ATTRIB_ARRAY_SIZE_NV +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#endif +#ifndef GL_ATTRIB_ARRAY_STRIDE_NV +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#endif +#ifndef GL_ATTRIB_ARRAY_TYPE_NV +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#endif +#ifndef GL_CURRENT_ATTRIB_NV +#define GL_CURRENT_ATTRIB_NV 0x8626 +#endif +#ifndef GL_PROGRAM_LENGTH_NV +#define GL_PROGRAM_LENGTH_NV 0x8627 +#endif +#ifndef GL_PROGRAM_STRING_NV +#define GL_PROGRAM_STRING_NV 0x8628 +#endif +#ifndef GL_MODELVIEW_PROJECTION_NV +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#endif +#ifndef GL_IDENTITY_NV +#define GL_IDENTITY_NV 0x862A +#endif +#ifndef GL_INVERSE_NV +#define GL_INVERSE_NV 0x862B +#endif +#ifndef GL_TRANSPOSE_NV +#define GL_TRANSPOSE_NV 0x862C +#endif +#ifndef GL_INVERSE_TRANSPOSE_NV +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#endif +#ifndef GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#endif +#ifndef GL_MAX_TRACK_MATRICES_NV +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#endif +#ifndef GL_MATRIX0_NV +#define GL_MATRIX0_NV 0x8630 +#endif +#ifndef GL_MATRIX1_NV +#define GL_MATRIX1_NV 0x8631 +#endif +#ifndef GL_MATRIX2_NV +#define GL_MATRIX2_NV 0x8632 +#endif +#ifndef GL_MATRIX3_NV +#define GL_MATRIX3_NV 0x8633 +#endif +#ifndef GL_MATRIX4_NV +#define GL_MATRIX4_NV 0x8634 +#endif +#ifndef GL_MATRIX5_NV +#define GL_MATRIX5_NV 0x8635 +#endif +#ifndef GL_MATRIX6_NV +#define GL_MATRIX6_NV 0x8636 +#endif +#ifndef GL_MATRIX7_NV +#define GL_MATRIX7_NV 0x8637 +#endif +#ifndef GL_CURRENT_MATRIX_STACK_DEPTH_NV +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#endif +#ifndef GL_CURRENT_MATRIX_NV +#define GL_CURRENT_MATRIX_NV 0x8641 +#endif +#ifndef GL_VERTEX_PROGRAM_POINT_SIZE_NV +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#endif +#ifndef GL_VERTEX_PROGRAM_TWO_SIDE_NV +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#endif +#ifndef GL_PROGRAM_PARAMETER_NV +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#endif +#ifndef GL_ATTRIB_ARRAY_POINTER_NV +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#endif +#ifndef GL_PROGRAM_TARGET_NV +#define GL_PROGRAM_TARGET_NV 0x8646 +#endif +#ifndef GL_PROGRAM_RESIDENT_NV +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#endif +#ifndef GL_TRACK_MATRIX_NV +#define GL_TRACK_MATRIX_NV 0x8648 +#endif +#ifndef GL_TRACK_MATRIX_TRANSFORM_NV +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#endif +#ifndef GL_VERTEX_PROGRAM_BINDING_NV +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#endif +#ifndef GL_PROGRAM_ERROR_POSITION_NV +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY0_NV +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY1_NV +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY2_NV +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY3_NV +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY4_NV +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY5_NV +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY6_NV +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY7_NV +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY8_NV +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY9_NV +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY10_NV +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY11_NV +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY12_NV +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY13_NV +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY14_NV +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY15_NV +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB0_4_NV +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB1_4_NV +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB2_4_NV +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB3_4_NV +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB4_4_NV +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB5_4_NV +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB6_4_NV +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB7_4_NV +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB8_4_NV +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB9_4_NV +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB10_4_NV +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB11_4_NV +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB12_4_NV +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB13_4_NV +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB14_4_NV +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#endif +#ifndef GL_MAP1_VERTEX_ATTRIB15_4_NV +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB0_4_NV +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB1_4_NV +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB2_4_NV +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB3_4_NV +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB4_4_NV +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB5_4_NV +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB6_4_NV +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB7_4_NV +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB8_4_NV +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB9_4_NV +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB10_4_NV +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB11_4_NV +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB12_4_NV +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB13_4_NV +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB14_4_NV +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#endif +#ifndef GL_MAP2_VERTEX_ATTRIB15_4_NV +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif +#ifndef GL_TEXTURE_MAX_CLAMP_S_SGIX +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#endif +#ifndef GL_TEXTURE_MAX_CLAMP_T_SGIX +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#endif +#ifndef GL_TEXTURE_MAX_CLAMP_R_SGIX +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif +#ifndef GL_SCALEBIAS_HINT_SGIX +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif +#ifndef GL_INTERLACE_OML +#define GL_INTERLACE_OML 0x8980 +#endif +#ifndef GL_INTERLACE_READ_OML +#define GL_INTERLACE_READ_OML 0x8981 +#endif +#ifndef GL_FORMAT_SUBSAMPLE_24_24_OML +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#endif +#ifndef GL_FORMAT_SUBSAMPLE_244_244_OML +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif +#ifndef GL_PACK_RESAMPLE_OML +#define GL_PACK_RESAMPLE_OML 0x8984 +#endif +#ifndef GL_UNPACK_RESAMPLE_OML +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#endif +#ifndef GL_RESAMPLE_REPLICATE_OML +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#endif +#ifndef GL_RESAMPLE_ZERO_FILL_OML +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#endif +#ifndef GL_RESAMPLE_AVERAGE_OML +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#endif +#ifndef GL_RESAMPLE_DECIMATE_OML +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif +#ifndef GL_DEPTH_STENCIL_TO_RGBA_NV +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#endif +#ifndef GL_DEPTH_STENCIL_TO_BGRA_NV +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif +#ifndef GL_BUMP_ROT_MATRIX_ATI +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#endif +#ifndef GL_BUMP_ROT_MATRIX_SIZE_ATI +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#endif +#ifndef GL_BUMP_NUM_TEX_UNITS_ATI +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#endif +#ifndef GL_BUMP_TEX_UNITS_ATI +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#endif +#ifndef GL_DUDV_ATI +#define GL_DUDV_ATI 0x8779 +#endif +#ifndef GL_DU8DV8_ATI +#define GL_DU8DV8_ATI 0x877A +#endif +#ifndef GL_BUMP_ENVMAP_ATI +#define GL_BUMP_ENVMAP_ATI 0x877B +#endif +#ifndef GL_BUMP_TARGET_ATI +#define GL_BUMP_TARGET_ATI 0x877C +#endif +#ifndef GL_FRAGMENT_SHADER_ATI +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#endif +#ifndef GL_REG_0_ATI +#define GL_REG_0_ATI 0x8921 +#endif +#ifndef GL_REG_1_ATI +#define GL_REG_1_ATI 0x8922 +#endif +#ifndef GL_REG_2_ATI +#define GL_REG_2_ATI 0x8923 +#endif +#ifndef GL_REG_3_ATI +#define GL_REG_3_ATI 0x8924 +#endif +#ifndef GL_REG_4_ATI +#define GL_REG_4_ATI 0x8925 +#endif +#ifndef GL_REG_5_ATI +#define GL_REG_5_ATI 0x8926 +#endif +#ifndef GL_REG_6_ATI +#define GL_REG_6_ATI 0x8927 +#endif +#ifndef GL_REG_7_ATI +#define GL_REG_7_ATI 0x8928 +#endif +#ifndef GL_REG_8_ATI +#define GL_REG_8_ATI 0x8929 +#endif +#ifndef GL_REG_9_ATI +#define GL_REG_9_ATI 0x892A +#endif +#ifndef GL_REG_10_ATI +#define GL_REG_10_ATI 0x892B +#endif +#ifndef GL_REG_11_ATI +#define GL_REG_11_ATI 0x892C +#endif +#ifndef GL_REG_12_ATI +#define GL_REG_12_ATI 0x892D +#endif +#ifndef GL_REG_13_ATI +#define GL_REG_13_ATI 0x892E +#endif +#ifndef GL_REG_14_ATI +#define GL_REG_14_ATI 0x892F +#endif +#ifndef GL_REG_15_ATI +#define GL_REG_15_ATI 0x8930 +#endif +#ifndef GL_REG_16_ATI +#define GL_REG_16_ATI 0x8931 +#endif +#ifndef GL_REG_17_ATI +#define GL_REG_17_ATI 0x8932 +#endif +#ifndef GL_REG_18_ATI +#define GL_REG_18_ATI 0x8933 +#endif +#ifndef GL_REG_19_ATI +#define GL_REG_19_ATI 0x8934 +#endif +#ifndef GL_REG_20_ATI +#define GL_REG_20_ATI 0x8935 +#endif +#ifndef GL_REG_21_ATI +#define GL_REG_21_ATI 0x8936 +#endif +#ifndef GL_REG_22_ATI +#define GL_REG_22_ATI 0x8937 +#endif +#ifndef GL_REG_23_ATI +#define GL_REG_23_ATI 0x8938 +#endif +#ifndef GL_REG_24_ATI +#define GL_REG_24_ATI 0x8939 +#endif +#ifndef GL_REG_25_ATI +#define GL_REG_25_ATI 0x893A +#endif +#ifndef GL_REG_26_ATI +#define GL_REG_26_ATI 0x893B +#endif +#ifndef GL_REG_27_ATI +#define GL_REG_27_ATI 0x893C +#endif +#ifndef GL_REG_28_ATI +#define GL_REG_28_ATI 0x893D +#endif +#ifndef GL_REG_29_ATI +#define GL_REG_29_ATI 0x893E +#endif +#ifndef GL_REG_30_ATI +#define GL_REG_30_ATI 0x893F +#endif +#ifndef GL_REG_31_ATI +#define GL_REG_31_ATI 0x8940 +#endif +#ifndef GL_CON_0_ATI +#define GL_CON_0_ATI 0x8941 +#endif +#ifndef GL_CON_1_ATI +#define GL_CON_1_ATI 0x8942 +#endif +#ifndef GL_CON_2_ATI +#define GL_CON_2_ATI 0x8943 +#endif +#ifndef GL_CON_3_ATI +#define GL_CON_3_ATI 0x8944 +#endif +#ifndef GL_CON_4_ATI +#define GL_CON_4_ATI 0x8945 +#endif +#ifndef GL_CON_5_ATI +#define GL_CON_5_ATI 0x8946 +#endif +#ifndef GL_CON_6_ATI +#define GL_CON_6_ATI 0x8947 +#endif +#ifndef GL_CON_7_ATI +#define GL_CON_7_ATI 0x8948 +#endif +#ifndef GL_CON_8_ATI +#define GL_CON_8_ATI 0x8949 +#endif +#ifndef GL_CON_9_ATI +#define GL_CON_9_ATI 0x894A +#endif +#ifndef GL_CON_10_ATI +#define GL_CON_10_ATI 0x894B +#endif +#ifndef GL_CON_11_ATI +#define GL_CON_11_ATI 0x894C +#endif +#ifndef GL_CON_12_ATI +#define GL_CON_12_ATI 0x894D +#endif +#ifndef GL_CON_13_ATI +#define GL_CON_13_ATI 0x894E +#endif +#ifndef GL_CON_14_ATI +#define GL_CON_14_ATI 0x894F +#endif +#ifndef GL_CON_15_ATI +#define GL_CON_15_ATI 0x8950 +#endif +#ifndef GL_CON_16_ATI +#define GL_CON_16_ATI 0x8951 +#endif +#ifndef GL_CON_17_ATI +#define GL_CON_17_ATI 0x8952 +#endif +#ifndef GL_CON_18_ATI +#define GL_CON_18_ATI 0x8953 +#endif +#ifndef GL_CON_19_ATI +#define GL_CON_19_ATI 0x8954 +#endif +#ifndef GL_CON_20_ATI +#define GL_CON_20_ATI 0x8955 +#endif +#ifndef GL_CON_21_ATI +#define GL_CON_21_ATI 0x8956 +#endif +#ifndef GL_CON_22_ATI +#define GL_CON_22_ATI 0x8957 +#endif +#ifndef GL_CON_23_ATI +#define GL_CON_23_ATI 0x8958 +#endif +#ifndef GL_CON_24_ATI +#define GL_CON_24_ATI 0x8959 +#endif +#ifndef GL_CON_25_ATI +#define GL_CON_25_ATI 0x895A +#endif +#ifndef GL_CON_26_ATI +#define GL_CON_26_ATI 0x895B +#endif +#ifndef GL_CON_27_ATI +#define GL_CON_27_ATI 0x895C +#endif +#ifndef GL_CON_28_ATI +#define GL_CON_28_ATI 0x895D +#endif +#ifndef GL_CON_29_ATI +#define GL_CON_29_ATI 0x895E +#endif +#ifndef GL_CON_30_ATI +#define GL_CON_30_ATI 0x895F +#endif +#ifndef GL_CON_31_ATI +#define GL_CON_31_ATI 0x8960 +#endif +#ifndef GL_MOV_ATI +#define GL_MOV_ATI 0x8961 +#endif +#ifndef GL_ADD_ATI +#define GL_ADD_ATI 0x8963 +#endif +#ifndef GL_MUL_ATI +#define GL_MUL_ATI 0x8964 +#endif +#ifndef GL_SUB_ATI +#define GL_SUB_ATI 0x8965 +#endif +#ifndef GL_DOT3_ATI +#define GL_DOT3_ATI 0x8966 +#endif +#ifndef GL_DOT4_ATI +#define GL_DOT4_ATI 0x8967 +#endif +#ifndef GL_MAD_ATI +#define GL_MAD_ATI 0x8968 +#endif +#ifndef GL_LERP_ATI +#define GL_LERP_ATI 0x8969 +#endif +#ifndef GL_CND_ATI +#define GL_CND_ATI 0x896A +#endif +#ifndef GL_CND0_ATI +#define GL_CND0_ATI 0x896B +#endif +#ifndef GL_DOT2_ADD_ATI +#define GL_DOT2_ADD_ATI 0x896C +#endif +#ifndef GL_SECONDARY_INTERPOLATOR_ATI +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#endif +#ifndef GL_NUM_FRAGMENT_REGISTERS_ATI +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#endif +#ifndef GL_NUM_FRAGMENT_CONSTANTS_ATI +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#endif +#ifndef GL_NUM_PASSES_ATI +#define GL_NUM_PASSES_ATI 0x8970 +#endif +#ifndef GL_NUM_INSTRUCTIONS_PER_PASS_ATI +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#endif +#ifndef GL_NUM_INSTRUCTIONS_TOTAL_ATI +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#endif +#ifndef GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#endif +#ifndef GL_NUM_LOOPBACK_COMPONENTS_ATI +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#endif +#ifndef GL_COLOR_ALPHA_PAIRING_ATI +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#endif +#ifndef GL_SWIZZLE_STR_ATI +#define GL_SWIZZLE_STR_ATI 0x8976 +#endif +#ifndef GL_SWIZZLE_STQ_ATI +#define GL_SWIZZLE_STQ_ATI 0x8977 +#endif +#ifndef GL_SWIZZLE_STR_DR_ATI +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#endif +#ifndef GL_SWIZZLE_STQ_DQ_ATI +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#endif +#ifndef GL_SWIZZLE_STRQ_ATI +#define GL_SWIZZLE_STRQ_ATI 0x897A +#endif +#ifndef GL_SWIZZLE_STRQ_DQ_ATI +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#endif +#ifndef GL_RED_BIT_ATI +#define GL_RED_BIT_ATI 0x00000001 +#endif +#ifndef GL_GREEN_BIT_ATI +#define GL_GREEN_BIT_ATI 0x00000002 +#endif +#ifndef GL_BLUE_BIT_ATI +#define GL_BLUE_BIT_ATI 0x00000004 +#endif +#ifndef GL_2X_BIT_ATI +#define GL_2X_BIT_ATI 0x00000001 +#endif +#ifndef GL_4X_BIT_ATI +#define GL_4X_BIT_ATI 0x00000002 +#endif +#ifndef GL_8X_BIT_ATI +#define GL_8X_BIT_ATI 0x00000004 +#endif +#ifndef GL_HALF_BIT_ATI +#define GL_HALF_BIT_ATI 0x00000008 +#endif +#ifndef GL_QUARTER_BIT_ATI +#define GL_QUARTER_BIT_ATI 0x00000010 +#endif +#ifndef GL_EIGHTH_BIT_ATI +#define GL_EIGHTH_BIT_ATI 0x00000020 +#endif +#ifndef GL_SATURATE_BIT_ATI +#define GL_SATURATE_BIT_ATI 0x00000040 +#endif +#ifndef GL_2X_BIT_ATI +#define GL_2X_BIT_ATI 0x00000001 +#endif +#ifndef GL_COMP_BIT_ATI +#define GL_COMP_BIT_ATI 0x00000002 +#endif +#ifndef GL_NEGATE_BIT_ATI +#define GL_NEGATE_BIT_ATI 0x00000004 +#endif +#ifndef GL_BIAS_BIT_ATI +#define GL_BIAS_BIT_ATI 0x00000008 +#endif +#ifndef GL_PN_TRIANGLES_ATI +#define GL_PN_TRIANGLES_ATI 0x87F0 +#endif +#ifndef GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#endif +#ifndef GL_PN_TRIANGLES_POINT_MODE_ATI +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#endif +#ifndef GL_PN_TRIANGLES_NORMAL_MODE_ATI +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#endif +#ifndef GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#endif +#ifndef GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#endif +#ifndef GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#endif +#ifndef GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#endif +#ifndef GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif +#ifndef GL_STATIC_ATI +#define GL_STATIC_ATI 0x8760 +#endif +#ifndef GL_DYNAMIC_ATI +#define GL_DYNAMIC_ATI 0x8761 +#endif +#ifndef GL_PRESERVE_ATI +#define GL_PRESERVE_ATI 0x8762 +#endif +#ifndef GL_DISCARD_ATI +#define GL_DISCARD_ATI 0x8763 +#endif +#ifndef GL_OBJECT_BUFFER_SIZE_ATI +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#endif +#ifndef GL_OBJECT_BUFFER_USAGE_ATI +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#endif +#ifndef GL_ARRAY_OBJECT_BUFFER_ATI +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#endif +#ifndef GL_ARRAY_OBJECT_OFFSET_ATI +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif +#ifndef GL_VERTEX_SHADER_EXT +#define GL_VERTEX_SHADER_EXT 0x8780 +#endif +#ifndef GL_VERTEX_SHADER_BINDING_EXT +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#endif +#ifndef GL_OP_INDEX_EXT +#define GL_OP_INDEX_EXT 0x8782 +#endif +#ifndef GL_OP_NEGATE_EXT +#define GL_OP_NEGATE_EXT 0x8783 +#endif +#ifndef GL_OP_DOT3_EXT +#define GL_OP_DOT3_EXT 0x8784 +#endif +#ifndef GL_OP_DOT4_EXT +#define GL_OP_DOT4_EXT 0x8785 +#endif +#ifndef GL_OP_MUL_EXT +#define GL_OP_MUL_EXT 0x8786 +#endif +#ifndef GL_OP_ADD_EXT +#define GL_OP_ADD_EXT 0x8787 +#endif +#ifndef GL_OP_MADD_EXT +#define GL_OP_MADD_EXT 0x8788 +#endif +#ifndef GL_OP_FRAC_EXT +#define GL_OP_FRAC_EXT 0x8789 +#endif +#ifndef GL_OP_MAX_EXT +#define GL_OP_MAX_EXT 0x878A +#endif +#ifndef GL_OP_MIN_EXT +#define GL_OP_MIN_EXT 0x878B +#endif +#ifndef GL_OP_SET_GE_EXT +#define GL_OP_SET_GE_EXT 0x878C +#endif +#ifndef GL_OP_SET_LT_EXT +#define GL_OP_SET_LT_EXT 0x878D +#endif +#ifndef GL_OP_CLAMP_EXT +#define GL_OP_CLAMP_EXT 0x878E +#endif +#ifndef GL_OP_FLOOR_EXT +#define GL_OP_FLOOR_EXT 0x878F +#endif +#ifndef GL_OP_ROUND_EXT +#define GL_OP_ROUND_EXT 0x8790 +#endif +#ifndef GL_OP_EXP_BASE_2_EXT +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#endif +#ifndef GL_OP_LOG_BASE_2_EXT +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#endif +#ifndef GL_OP_POWER_EXT +#define GL_OP_POWER_EXT 0x8793 +#endif +#ifndef GL_OP_RECIP_EXT +#define GL_OP_RECIP_EXT 0x8794 +#endif +#ifndef GL_OP_RECIP_SQRT_EXT +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#endif +#ifndef GL_OP_SUB_EXT +#define GL_OP_SUB_EXT 0x8796 +#endif +#ifndef GL_OP_CROSS_PRODUCT_EXT +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#endif +#ifndef GL_OP_MULTIPLY_MATRIX_EXT +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#endif +#ifndef GL_OP_MOV_EXT +#define GL_OP_MOV_EXT 0x8799 +#endif +#ifndef GL_OUTPUT_VERTEX_EXT +#define GL_OUTPUT_VERTEX_EXT 0x879A +#endif +#ifndef GL_OUTPUT_COLOR0_EXT +#define GL_OUTPUT_COLOR0_EXT 0x879B +#endif +#ifndef GL_OUTPUT_COLOR1_EXT +#define GL_OUTPUT_COLOR1_EXT 0x879C +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD0_EXT +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD1_EXT +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD2_EXT +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD3_EXT +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD4_EXT +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD5_EXT +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD6_EXT +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD7_EXT +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD8_EXT +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD9_EXT +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD10_EXT +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD11_EXT +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD12_EXT +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD13_EXT +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD14_EXT +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD15_EXT +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD16_EXT +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD17_EXT +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD18_EXT +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD19_EXT +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD20_EXT +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD21_EXT +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD22_EXT +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD23_EXT +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD24_EXT +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD25_EXT +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD26_EXT +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD27_EXT +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD28_EXT +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD29_EXT +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD30_EXT +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#endif +#ifndef GL_OUTPUT_TEXTURE_COORD31_EXT +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#endif +#ifndef GL_OUTPUT_FOG_EXT +#define GL_OUTPUT_FOG_EXT 0x87BD +#endif +#ifndef GL_SCALAR_EXT +#define GL_SCALAR_EXT 0x87BE +#endif +#ifndef GL_VECTOR_EXT +#define GL_VECTOR_EXT 0x87BF +#endif +#ifndef GL_MATRIX_EXT +#define GL_MATRIX_EXT 0x87C0 +#endif +#ifndef GL_VARIANT_EXT +#define GL_VARIANT_EXT 0x87C1 +#endif +#ifndef GL_INVARIANT_EXT +#define GL_INVARIANT_EXT 0x87C2 +#endif +#ifndef GL_LOCAL_CONSTANT_EXT +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#endif +#ifndef GL_LOCAL_EXT +#define GL_LOCAL_EXT 0x87C4 +#endif +#ifndef GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#endif +#ifndef GL_MAX_VERTEX_SHADER_VARIANTS_EXT +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#endif +#ifndef GL_MAX_VERTEX_SHADER_INVARIANTS_EXT +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#endif +#ifndef GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#endif +#ifndef GL_MAX_VERTEX_SHADER_LOCALS_EXT +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#endif +#ifndef GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#endif +#ifndef GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#endif +#ifndef GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#endif +#ifndef GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#endif +#ifndef GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#endif +#ifndef GL_VERTEX_SHADER_INSTRUCTIONS_EXT +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#endif +#ifndef GL_VERTEX_SHADER_VARIANTS_EXT +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#endif +#ifndef GL_VERTEX_SHADER_INVARIANTS_EXT +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#endif +#ifndef GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#endif +#ifndef GL_VERTEX_SHADER_LOCALS_EXT +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#endif +#ifndef GL_VERTEX_SHADER_OPTIMIZED_EXT +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#endif +#ifndef GL_X_EXT +#define GL_X_EXT 0x87D5 +#endif +#ifndef GL_Y_EXT +#define GL_Y_EXT 0x87D6 +#endif +#ifndef GL_Z_EXT +#define GL_Z_EXT 0x87D7 +#endif +#ifndef GL_W_EXT +#define GL_W_EXT 0x87D8 +#endif +#ifndef GL_NEGATIVE_X_EXT +#define GL_NEGATIVE_X_EXT 0x87D9 +#endif +#ifndef GL_NEGATIVE_Y_EXT +#define GL_NEGATIVE_Y_EXT 0x87DA +#endif +#ifndef GL_NEGATIVE_Z_EXT +#define GL_NEGATIVE_Z_EXT 0x87DB +#endif +#ifndef GL_NEGATIVE_W_EXT +#define GL_NEGATIVE_W_EXT 0x87DC +#endif +#ifndef GL_ZERO_EXT +#define GL_ZERO_EXT 0x87DD +#endif +#ifndef GL_ONE_EXT +#define GL_ONE_EXT 0x87DE +#endif +#ifndef GL_NEGATIVE_ONE_EXT +#define GL_NEGATIVE_ONE_EXT 0x87DF +#endif +#ifndef GL_NORMALIZED_RANGE_EXT +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#endif +#ifndef GL_FULL_RANGE_EXT +#define GL_FULL_RANGE_EXT 0x87E1 +#endif +#ifndef GL_CURRENT_VERTEX_EXT +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#endif +#ifndef GL_MVP_MATRIX_EXT +#define GL_MVP_MATRIX_EXT 0x87E3 +#endif +#ifndef GL_VARIANT_VALUE_EXT +#define GL_VARIANT_VALUE_EXT 0x87E4 +#endif +#ifndef GL_VARIANT_DATATYPE_EXT +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#endif +#ifndef GL_VARIANT_ARRAY_STRIDE_EXT +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#endif +#ifndef GL_VARIANT_ARRAY_TYPE_EXT +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#endif +#ifndef GL_VARIANT_ARRAY_EXT +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#endif +#ifndef GL_VARIANT_ARRAY_POINTER_EXT +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#endif +#ifndef GL_INVARIANT_VALUE_EXT +#define GL_INVARIANT_VALUE_EXT 0x87EA +#endif +#ifndef GL_INVARIANT_DATATYPE_EXT +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#endif +#ifndef GL_LOCAL_CONSTANT_VALUE_EXT +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#endif +#ifndef GL_LOCAL_CONSTANT_DATATYPE_EXT +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif +#ifndef GL_MAX_VERTEX_STREAMS_ATI +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#endif +#ifndef GL_VERTEX_STREAM0_ATI +#define GL_VERTEX_STREAM0_ATI 0x876C +#endif +#ifndef GL_VERTEX_STREAM1_ATI +#define GL_VERTEX_STREAM1_ATI 0x876D +#endif +#ifndef GL_VERTEX_STREAM2_ATI +#define GL_VERTEX_STREAM2_ATI 0x876E +#endif +#ifndef GL_VERTEX_STREAM3_ATI +#define GL_VERTEX_STREAM3_ATI 0x876F +#endif +#ifndef GL_VERTEX_STREAM4_ATI +#define GL_VERTEX_STREAM4_ATI 0x8770 +#endif +#ifndef GL_VERTEX_STREAM5_ATI +#define GL_VERTEX_STREAM5_ATI 0x8771 +#endif +#ifndef GL_VERTEX_STREAM6_ATI +#define GL_VERTEX_STREAM6_ATI 0x8772 +#endif +#ifndef GL_VERTEX_STREAM7_ATI +#define GL_VERTEX_STREAM7_ATI 0x8773 +#endif +#ifndef GL_VERTEX_SOURCE_ATI +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif +#ifndef GL_ELEMENT_ARRAY_ATI +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#endif +#ifndef GL_ELEMENT_ARRAY_TYPE_ATI +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#endif +#ifndef GL_ELEMENT_ARRAY_POINTER_ATI +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif +#ifndef GL_QUAD_MESH_SUN +#define GL_QUAD_MESH_SUN 0x8614 +#endif +#ifndef GL_TRIANGLE_MESH_SUN +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif +#ifndef GL_SLICE_ACCUM_SUN +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif +#ifndef GL_MULTISAMPLE_FILTER_HINT_NV +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif +#ifndef GL_DEPTH_CLAMP_NV +#define GL_DEPTH_CLAMP_NV 0x864F +#endif +#ifndef GL_PIXEL_COUNTER_BITS_NV +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#endif +#ifndef GL_CURRENT_OCCLUSION_QUERY_ID_NV +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#endif +#ifndef GL_PIXEL_COUNT_NV +#define GL_PIXEL_COUNT_NV 0x8866 +#endif +#ifndef GL_PIXEL_COUNT_AVAILABLE_NV +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif +#ifndef GL_POINT_SPRITE_NV +#define GL_POINT_SPRITE_NV 0x8861 +#endif +#ifndef GL_COORD_REPLACE_NV +#define GL_COORD_REPLACE_NV 0x8862 +#endif +#ifndef GL_POINT_SPRITE_R_MODE_NV +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif +#ifndef GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#endif +#ifndef GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#endif +#ifndef GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#endif +#ifndef GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#endif +#ifndef GL_OFFSET_HILO_TEXTURE_2D_NV +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#endif +#ifndef GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#endif +#ifndef GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#endif +#ifndef GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#endif +#ifndef GL_DEPENDENT_HILO_TEXTURE_2D_NV +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#endif +#ifndef GL_DEPENDENT_RGB_TEXTURE_3D_NV +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#endif +#ifndef GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#endif +#ifndef GL_DOT_PRODUCT_PASS_THROUGH_NV +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#endif +#ifndef GL_DOT_PRODUCT_TEXTURE_1D_NV +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#endif +#ifndef GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#endif +#ifndef GL_HILO8_NV +#define GL_HILO8_NV 0x885E +#endif +#ifndef GL_SIGNED_HILO8_NV +#define GL_SIGNED_HILO8_NV 0x885F +#endif +#ifndef GL_FORCE_BLUE_TO_ONE_NV +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif +#ifndef GL_STENCIL_TEST_TWO_SIDE_EXT +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#endif +#ifndef GL_ACTIVE_STENCIL_FACE_EXT +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif +#ifndef GL_TEXT_FRAGMENT_SHADER_ATI +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif +#ifndef GL_UNPACK_CLIENT_STORAGE_APPLE +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif +#ifndef GL_ELEMENT_ARRAY_APPLE +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#endif +#ifndef GL_ELEMENT_ARRAY_TYPE_APPLE +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#endif +#ifndef GL_ELEMENT_ARRAY_POINTER_APPLE +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif +#ifndef GL_DRAW_PIXELS_APPLE +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#endif +#ifndef GL_FENCE_APPLE +#define GL_FENCE_APPLE 0x8A0B +#endif +#ifndef GL_VERTEX_ARRAY_BINDING_APPLE +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_APPLE +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#endif +#ifndef GL_VERTEX_ARRAY_STORAGE_HINT_APPLE +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#endif +#ifndef GL_VERTEX_ARRAY_RANGE_POINTER_APPLE +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#endif +#ifndef GL_STORAGE_CACHED_APPLE +#define GL_STORAGE_CACHED_APPLE 0x85BE +#endif +#ifndef GL_STORAGE_SHARED_APPLE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif +#ifndef GL_YCBCR_422_APPLE +#define GL_YCBCR_422_APPLE 0x85B9 +#endif +#ifndef GL_UNSIGNED_SHORT_8_8_APPLE +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#endif +#ifndef GL_UNSIGNED_SHORT_8_8_REV_APPLE +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif +#ifndef GL_RGB_S3TC +#define GL_RGB_S3TC 0x83A0 +#endif +#ifndef GL_RGB4_S3TC +#define GL_RGB4_S3TC 0x83A1 +#endif +#ifndef GL_RGBA_S3TC +#define GL_RGBA_S3TC 0x83A2 +#endif +#ifndef GL_RGBA4_S3TC +#define GL_RGBA4_S3TC 0x83A3 +#endif +#ifndef GL_MAX_DRAW_BUFFERS_ATI +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#endif +#ifndef GL_DRAW_BUFFER0_ATI +#define GL_DRAW_BUFFER0_ATI 0x8825 +#endif +#ifndef GL_DRAW_BUFFER1_ATI +#define GL_DRAW_BUFFER1_ATI 0x8826 +#endif +#ifndef GL_DRAW_BUFFER2_ATI +#define GL_DRAW_BUFFER2_ATI 0x8827 +#endif +#ifndef GL_DRAW_BUFFER3_ATI +#define GL_DRAW_BUFFER3_ATI 0x8828 +#endif +#ifndef GL_DRAW_BUFFER4_ATI +#define GL_DRAW_BUFFER4_ATI 0x8829 +#endif +#ifndef GL_DRAW_BUFFER5_ATI +#define GL_DRAW_BUFFER5_ATI 0x882A +#endif +#ifndef GL_DRAW_BUFFER6_ATI +#define GL_DRAW_BUFFER6_ATI 0x882B +#endif +#ifndef GL_DRAW_BUFFER7_ATI +#define GL_DRAW_BUFFER7_ATI 0x882C +#endif +#ifndef GL_DRAW_BUFFER8_ATI +#define GL_DRAW_BUFFER8_ATI 0x882D +#endif +#ifndef GL_DRAW_BUFFER9_ATI +#define GL_DRAW_BUFFER9_ATI 0x882E +#endif +#ifndef GL_DRAW_BUFFER10_ATI +#define GL_DRAW_BUFFER10_ATI 0x882F +#endif +#ifndef GL_DRAW_BUFFER11_ATI +#define GL_DRAW_BUFFER11_ATI 0x8830 +#endif +#ifndef GL_DRAW_BUFFER12_ATI +#define GL_DRAW_BUFFER12_ATI 0x8831 +#endif +#ifndef GL_DRAW_BUFFER13_ATI +#define GL_DRAW_BUFFER13_ATI 0x8832 +#endif +#ifndef GL_DRAW_BUFFER14_ATI +#define GL_DRAW_BUFFER14_ATI 0x8833 +#endif +#ifndef GL_DRAW_BUFFER15_ATI +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif +#ifndef GL_TYPE_RGBA_FLOAT_ATI +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#endif +#ifndef GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif +#ifndef GL_MODULATE_ADD_ATI +#define GL_MODULATE_ADD_ATI 0x8744 +#endif +#ifndef GL_MODULATE_SIGNED_ADD_ATI +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#endif +#ifndef GL_MODULATE_SUBTRACT_ATI +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif +#ifndef GL_RGBA_FLOAT32_ATI +#define GL_RGBA_FLOAT32_ATI 0x8814 +#endif +#ifndef GL_RGB_FLOAT32_ATI +#define GL_RGB_FLOAT32_ATI 0x8815 +#endif +#ifndef GL_ALPHA_FLOAT32_ATI +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#endif +#ifndef GL_INTENSITY_FLOAT32_ATI +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#endif +#ifndef GL_LUMINANCE_FLOAT32_ATI +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#endif +#ifndef GL_LUMINANCE_ALPHA_FLOAT32_ATI +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#endif +#ifndef GL_RGBA_FLOAT16_ATI +#define GL_RGBA_FLOAT16_ATI 0x881A +#endif +#ifndef GL_RGB_FLOAT16_ATI +#define GL_RGB_FLOAT16_ATI 0x881B +#endif +#ifndef GL_ALPHA_FLOAT16_ATI +#define GL_ALPHA_FLOAT16_ATI 0x881C +#endif +#ifndef GL_INTENSITY_FLOAT16_ATI +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#endif +#ifndef GL_LUMINANCE_FLOAT16_ATI +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#endif +#ifndef GL_LUMINANCE_ALPHA_FLOAT16_ATI +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif +#ifndef GL_FLOAT_R_NV +#define GL_FLOAT_R_NV 0x8880 +#endif +#ifndef GL_FLOAT_RG_NV +#define GL_FLOAT_RG_NV 0x8881 +#endif +#ifndef GL_FLOAT_RGB_NV +#define GL_FLOAT_RGB_NV 0x8882 +#endif +#ifndef GL_FLOAT_RGBA_NV +#define GL_FLOAT_RGBA_NV 0x8883 +#endif +#ifndef GL_FLOAT_R16_NV +#define GL_FLOAT_R16_NV 0x8884 +#endif +#ifndef GL_FLOAT_R32_NV +#define GL_FLOAT_R32_NV 0x8885 +#endif +#ifndef GL_FLOAT_RG16_NV +#define GL_FLOAT_RG16_NV 0x8886 +#endif +#ifndef GL_FLOAT_RG32_NV +#define GL_FLOAT_RG32_NV 0x8887 +#endif +#ifndef GL_FLOAT_RGB16_NV +#define GL_FLOAT_RGB16_NV 0x8888 +#endif +#ifndef GL_FLOAT_RGB32_NV +#define GL_FLOAT_RGB32_NV 0x8889 +#endif +#ifndef GL_FLOAT_RGBA16_NV +#define GL_FLOAT_RGBA16_NV 0x888A +#endif +#ifndef GL_FLOAT_RGBA32_NV +#define GL_FLOAT_RGBA32_NV 0x888B +#endif +#ifndef GL_TEXTURE_FLOAT_COMPONENTS_NV +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#endif +#ifndef GL_FLOAT_CLEAR_COLOR_VALUE_NV +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#endif +#ifndef GL_FLOAT_RGBA_MODE_NV +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif +#ifndef GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#endif +#ifndef GL_FRAGMENT_PROGRAM_NV +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#endif +#ifndef GL_MAX_TEXTURE_COORDS_NV +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#endif +#ifndef GL_MAX_TEXTURE_IMAGE_UNITS_NV +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#endif +#ifndef GL_FRAGMENT_PROGRAM_BINDING_NV +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#endif +#ifndef GL_PROGRAM_ERROR_STRING_NV +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif +#ifndef GL_HALF_FLOAT_NV +#define GL_HALF_FLOAT_NV 0x140B +#endif +#ifndef GL_WRITE_PIXEL_DATA_RANGE_NV +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#endif +#ifndef GL_READ_PIXEL_DATA_RANGE_NV +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#endif +#ifndef GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#endif +#ifndef GL_READ_PIXEL_DATA_RANGE_LENGTH_NV +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#endif +#ifndef GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#endif +#ifndef GL_READ_PIXEL_DATA_RANGE_POINTER_NV +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif +#ifndef GL_PRIMITIVE_RESTART_NV +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#endif +#ifndef GL_PRIMITIVE_RESTART_INDEX_NV +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif +#ifndef GL_TEXTURE_UNSIGNED_REMAP_MODE_NV +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif +#ifndef GL_STENCIL_BACK_FUNC_ATI +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#endif +#ifndef GL_STENCIL_BACK_FAIL_ATI +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#endif +#ifndef GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#endif +#ifndef GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif +#ifndef GL_IMPLEMENTATION_COLOR_READ_TYPE_OES +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#endif +#ifndef GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif +#ifndef GL_DEPTH_BOUNDS_TEST_EXT +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#endif +#ifndef GL_DEPTH_BOUNDS_EXT +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif +#ifndef GL_MIRROR_CLAMP_EXT +#define GL_MIRROR_CLAMP_EXT 0x8742 +#endif +#ifndef GL_MIRROR_CLAMP_TO_EDGE_EXT +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#endif +#ifndef GL_MIRROR_CLAMP_TO_BORDER_EXT +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif +#ifndef GL_BLEND_EQUATION_RGB_EXT +#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#endif +#ifndef GL_BLEND_EQUATION_ALPHA_EXT +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif +#ifndef GL_PACK_INVERT_MESA +#define GL_PACK_INVERT_MESA 0x8758 +#endif +#ifndef GL_UNSIGNED_SHORT_8_8_MESA +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#endif +#ifndef GL_UNSIGNED_SHORT_8_8_REV_MESA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#endif +#ifndef GL_YCBCR_MESA +#define GL_YCBCR_MESA 0x8757 +#endif +#ifndef GL_PIXEL_PACK_BUFFER_EXT +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER_EXT +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#endif +#ifndef GL_PIXEL_PACK_BUFFER_BINDING_EXT +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER_BINDING_EXT +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif +#ifndef GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#endif +#ifndef GL_MAX_PROGRAM_CALL_DEPTH_NV +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#endif +#ifndef GL_MAX_PROGRAM_IF_DEPTH_NV +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#endif +#ifndef GL_MAX_PROGRAM_LOOP_DEPTH_NV +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#endif +#ifndef GL_MAX_PROGRAM_LOOP_COUNT_NV +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif +#ifndef GL_INVALID_FRAMEBUFFER_OPERATION_EXT +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#endif +#ifndef GL_MAX_RENDERBUFFER_SIZE_EXT +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#endif +#ifndef GL_FRAMEBUFFER_BINDING_EXT +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#endif +#ifndef GL_RENDERBUFFER_BINDING_EXT +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#endif +#ifndef GL_FRAMEBUFFER_COMPLETE_EXT +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#endif +#ifndef GL_FRAMEBUFFER_UNSUPPORTED_EXT +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#endif +#ifndef GL_MAX_COLOR_ATTACHMENTS_EXT +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#endif +#ifndef GL_COLOR_ATTACHMENT0_EXT +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#endif +#ifndef GL_COLOR_ATTACHMENT1_EXT +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#endif +#ifndef GL_COLOR_ATTACHMENT2_EXT +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#endif +#ifndef GL_COLOR_ATTACHMENT3_EXT +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#endif +#ifndef GL_COLOR_ATTACHMENT4_EXT +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#endif +#ifndef GL_COLOR_ATTACHMENT5_EXT +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#endif +#ifndef GL_COLOR_ATTACHMENT6_EXT +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#endif +#ifndef GL_COLOR_ATTACHMENT7_EXT +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#endif +#ifndef GL_COLOR_ATTACHMENT8_EXT +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#endif +#ifndef GL_COLOR_ATTACHMENT9_EXT +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#endif +#ifndef GL_COLOR_ATTACHMENT10_EXT +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#endif +#ifndef GL_COLOR_ATTACHMENT11_EXT +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#endif +#ifndef GL_COLOR_ATTACHMENT12_EXT +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#endif +#ifndef GL_COLOR_ATTACHMENT13_EXT +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#endif +#ifndef GL_COLOR_ATTACHMENT14_EXT +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#endif +#ifndef GL_COLOR_ATTACHMENT15_EXT +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#endif +#ifndef GL_DEPTH_ATTACHMENT_EXT +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#endif +#ifndef GL_STENCIL_ATTACHMENT_EXT +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#endif +#ifndef GL_FRAMEBUFFER_EXT +#define GL_FRAMEBUFFER_EXT 0x8D40 +#endif +#ifndef GL_RENDERBUFFER_EXT +#define GL_RENDERBUFFER_EXT 0x8D41 +#endif +#ifndef GL_RENDERBUFFER_WIDTH_EXT +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#endif +#ifndef GL_RENDERBUFFER_HEIGHT_EXT +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#endif +#ifndef GL_RENDERBUFFER_INTERNAL_FORMAT_EXT +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#endif +#ifndef GL_STENCIL_INDEX1_EXT +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#endif +#ifndef GL_STENCIL_INDEX4_EXT +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#endif +#ifndef GL_STENCIL_INDEX8_EXT +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#endif +#ifndef GL_STENCIL_INDEX16_EXT +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#endif +#ifndef GL_RENDERBUFFER_RED_SIZE_EXT +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#endif +#ifndef GL_RENDERBUFFER_GREEN_SIZE_EXT +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#endif +#ifndef GL_RENDERBUFFER_BLUE_SIZE_EXT +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#endif +#ifndef GL_RENDERBUFFER_ALPHA_SIZE_EXT +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#endif +#ifndef GL_RENDERBUFFER_DEPTH_SIZE_EXT +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#endif +#ifndef GL_RENDERBUFFER_STENCIL_SIZE_EXT +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif +#ifndef GL_DEPTH_STENCIL_EXT +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#endif +#ifndef GL_UNSIGNED_INT_24_8_EXT +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#endif +#ifndef GL_DEPTH24_STENCIL8_EXT +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#endif +#ifndef GL_TEXTURE_STENCIL_SIZE_EXT +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif +#ifndef GL_STENCIL_TAG_BITS_EXT +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#endif +#ifndef GL_STENCIL_CLEAR_TAG_VALUE_EXT +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 +#endif +#ifndef GL_SRGB_EXT +#define GL_SRGB_EXT 0x8C40 +#endif +#ifndef GL_SRGB8_EXT +#define GL_SRGB8_EXT 0x8C41 +#endif +#ifndef GL_SRGB_ALPHA_EXT +#define GL_SRGB_ALPHA_EXT 0x8C42 +#endif +#ifndef GL_SRGB8_ALPHA8_EXT +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#endif +#ifndef GL_SLUMINANCE_ALPHA_EXT +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#endif +#ifndef GL_SLUMINANCE8_ALPHA8_EXT +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#endif +#ifndef GL_SLUMINANCE_EXT +#define GL_SLUMINANCE_EXT 0x8C46 +#endif +#ifndef GL_SLUMINANCE8_EXT +#define GL_SLUMINANCE8_EXT 0x8C47 +#endif +#ifndef GL_COMPRESSED_SRGB_EXT +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#endif +#ifndef GL_COMPRESSED_SRGB_ALPHA_EXT +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#endif +#ifndef GL_COMPRESSED_SLUMINANCE_EXT +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#endif +#ifndef GL_COMPRESSED_SLUMINANCE_ALPHA_EXT +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#endif +#ifndef GL_COMPRESSED_SRGB_S3TC_DXT1_EXT +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#endif +#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#endif +#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#endif +#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif +#ifndef GL_READ_FRAMEBUFFER_EXT +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#endif +#ifndef GL_DRAW_FRAMEBUFFER_EXT +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#endif +#ifndef GL_READ_FRAMEBUFFER_BINDING_EXT +#define GL_READ_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT +#endif +#ifndef GL_DRAW_FRAMEBUFFER_BINDING_EXT +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CAA +#endif +#ifndef GL_RENDERBUFFER_SAMPLES_EXT +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#endif +#ifndef GL_MAX_SAMPLES_EXT +#define GL_MAX_SAMPLES_EXT 0x8D57 +#endif +#ifndef GL_TEXTURE_1D_STACK_MESAX +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#endif +#ifndef GL_TEXTURE_2D_STACK_MESAX +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#endif +#ifndef GL_PROXY_TEXTURE_1D_STACK_MESAX +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#endif +#ifndef GL_PROXY_TEXTURE_2D_STACK_MESAX +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#endif +#ifndef GL_TEXTURE_1D_STACK_BINDING_MESAX +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#endif +#ifndef GL_TEXTURE_2D_STACK_BINDING_MESAX +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E +#endif +#ifndef GL_TIME_ELAPSED_EXT +#define GL_TIME_ELAPSED_EXT 0x88BF +#endif +#ifndef GL_BUFFER_SERIALIZED_MODIFY_APPLE +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#endif +#ifndef GL_BUFFER_FLUSHING_UNMAP_APPLE +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +#endif +#ifndef GL_ALL_CLIENT_ATTRIB_BITS +#define GL_ALL_CLIENT_ATTRIB_BITS GL_CLIENT_ALL_ATTRIB_BITS +#endif + + +#endif /* _GLENUMS_H */ + diff --git a/ruby/RubyOpenGL/gl/extconf.rb b/ruby/RubyOpenGL/gl/extconf.rb new file mode 100644 index 00000000..43802872 --- /dev/null +++ b/ruby/RubyOpenGL/gl/extconf.rb @@ -0,0 +1,20 @@ +require "mkmf" +$CFLAGS = "/MD /O2 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS" +#$CFLAGS = "/MD /Zi /EHsc /DWIN32 /DNDEBUG /D_WINDOWS" +#$LDFLAGS = "/Zi" + +libs = [ + "opengl32", + "glu32", +] + +libs.each {|lib| + unless have_library(lib) + puts "Unable to find #{lib}.lib!" + puts + exit + end +} + +create_makefile("gl") + diff --git a/ruby/RubyOpenGL/gl/gl-1.0-1.1.c b/ruby/RubyOpenGL/gl/gl-1.0-1.1.c new file mode 100644 index 00000000..756ceaa0 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-1.0-1.1.c @@ -0,0 +1,5197 @@ +/* + * Copyright (C) 1999 - 2005 Yoshi + * Copyright (C) 2006 John M. Gabriele + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +/* OpenGL 1.0 + 1.1 functions */ + +static VALUE +gl_NewList(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint list; + GLenum mode; + list = (GLuint)NUM2UINT(arg1); + mode = (GLenum)NUM2INT(arg2); + glNewList(list,mode); + return Qnil; +} + +static VALUE +gl_EndList(obj) +VALUE obj; +{ + glEndList(); + return Qnil; +} + +static VALUE +gl_CallList(obj,arg1) +VALUE obj,arg1; +{ + GLuint list; + list = (GLuint)NUM2UINT(arg1); + glCallList(list); + return Qnil; +} + +static VALUE +gl_CallLists(obj,arg1) +VALUE obj,arg1; +{ + GLsizei n; + GLenum type; + GLvoid *lists; + if (TYPE(arg1) == T_STRING) { + type = GL_BYTE; + lists = RSTRING(arg1)->ptr; + n = RSTRING(arg1)->len; + } else if (TYPE(arg1) == T_ARRAY) { + type = GL_INT; + lists = ALLOC_N(GLint, RARRAY(arg1)->len); + n = ary2cint(arg1,lists,0); + } else { + Check_Type(arg1,T_ARRAY); /* force exception */ + return Qnil; /* not reached */ + } + glCallLists(n, type, lists); + if (type == GL_INT) xfree(lists); + return Qnil; +} + +static VALUE +gl_DeleteLists(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint list; + GLsizei range; + list = (GLuint)NUM2UINT(arg1); + range = (GLsizei)NUM2UINT(arg2); + glDeleteLists(list,range); + return Qnil; +} + +static VALUE +gl_GenLists(obj,arg1) +VALUE obj,arg1; +{ + GLsizei range; + GLuint ret; + range = (GLsizei)NUM2UINT(arg1); + ret = glGenLists(range); + return INT2NUM(ret); +} + +static VALUE +gl_ListBase(obj,arg1) +VALUE obj,arg1; +{ + GLuint base; + base = (GLuint)NUM2UINT(arg1); + glListBase(base); + return Qnil; +} + +static VALUE +gl_Begin(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + mode = (GLenum)NUM2INT(arg1); + glBegin(mode); + return Qnil; +} + +static VALUE +gl_Bitmap(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLsizei width; + GLsizei height; + GLfloat xorig; + GLfloat yorig; + GLfloat xmove; + GLfloat ymove; + width = (GLsizei)NUM2UINT(arg1); + height = (GLsizei)NUM2UINT(arg2); + xorig = (GLfloat)NUM2DBL(arg3); + yorig = (GLfloat)NUM2DBL(arg4); + xmove = (GLfloat)NUM2DBL(arg5); + ymove = (GLfloat)NUM2DBL(arg6); + if (TYPE(arg7) == T_FIXNUM || TYPE(arg7) == T_BIGNUM) { /* offset to unpack buffer */ + GLuint offset = NUM2UINT(arg7); + glBitmap(width, height, xorig, yorig, xmove, ymove, (GLvoid *)offset); + } else if (TYPE(arg7) == T_STRING) { + const GLubyte *bitmap; + if (RSTRING(arg7)->len < (width * height / 8)) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len); + + bitmap = (const GLubyte*)RSTRING(arg7)->ptr; + glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap); + } else { + Check_Type(arg7,T_STRING); /* force exception */ + } + return Qnil; +} + +static VALUE +gl_Color3b(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLbyte red; + GLbyte green; + GLbyte blue; + red = (GLbyte)NUM2INT(arg1); + green = (GLbyte)NUM2INT(arg2); + blue = (GLbyte)NUM2INT(arg3); + glColor3b(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble red; + GLdouble green; + GLdouble blue; + red = (GLdouble)NUM2DBL(arg1); + green = (GLdouble)NUM2DBL(arg2); + blue = (GLdouble)NUM2DBL(arg3); + glColor3d(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat red; + GLfloat green; + GLfloat blue; + red = (GLfloat)NUM2DBL(arg1); + green = (GLfloat)NUM2DBL(arg2); + blue = (GLfloat)NUM2DBL(arg3); + glColor3f(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint red; + GLint green; + GLint blue; + red = (GLint)NUM2INT(arg1); + green = (GLint)NUM2INT(arg2); + blue = (GLint)NUM2INT(arg3); + glColor3i(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort red; + GLshort green; + GLshort blue; + red = (GLshort)NUM2INT(arg1); + green = (GLshort)NUM2INT(arg2); + blue = (GLshort)NUM2INT(arg3); + glColor3s(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3ub(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLubyte red; + GLubyte green; + GLubyte blue; + red = (GLubyte)NUM2INT(arg1); + green = (GLubyte)NUM2INT(arg2); + blue = (GLubyte)NUM2INT(arg3); + glColor3ub(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3ui(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint red; + GLuint green; + GLuint blue; + red = (GLuint)NUM2UINT(arg1); + green = (GLuint)NUM2UINT(arg2); + blue = (GLuint)NUM2UINT(arg3); + glColor3ui(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color3us(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLushort red; + GLushort green; + GLushort blue; + red = (GLushort)NUM2INT(arg1); + green = (GLushort)NUM2INT(arg2); + blue = (GLushort)NUM2INT(arg3); + glColor3us(red,green,blue); + return Qnil; +} + +static VALUE +gl_Color4b(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLbyte red; + GLbyte green; + GLbyte blue; + GLbyte alpha; + red = (GLbyte)NUM2INT(arg1); + green = (GLbyte)NUM2INT(arg2); + blue = (GLbyte)NUM2INT(arg3); + alpha = (GLbyte)NUM2INT(arg4); + glColor4b(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4d(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble red; + GLdouble green; + GLdouble blue; + GLdouble alpha; + red = (GLdouble)NUM2DBL(arg1); + green = (GLdouble)NUM2DBL(arg2); + blue = (GLdouble)NUM2DBL(arg3); + alpha = (GLdouble)NUM2DBL(arg4); + glColor4d(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLfloat red; + GLfloat green; + GLfloat blue; + GLfloat alpha; + red = (GLfloat)NUM2DBL(arg1); + green = (GLfloat)NUM2DBL(arg2); + blue = (GLfloat)NUM2DBL(arg3); + alpha = (GLfloat)NUM2DBL(arg4); + glColor4f(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4i(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint red; + GLint green; + GLint blue; + GLint alpha; + red = (GLint)NUM2INT(arg1); + green = (GLint)NUM2INT(arg2); + blue = (GLint)NUM2INT(arg3); + alpha = (GLint)NUM2INT(arg4); + glColor4i(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4s(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLshort red; + GLshort green; + GLshort blue; + GLshort alpha; + red = (GLshort)NUM2INT(arg1); + green = (GLshort)NUM2INT(arg2); + blue = (GLshort)NUM2INT(arg3); + alpha = (GLshort)NUM2INT(arg4); + glColor4s(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4ub(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLubyte red; + GLubyte green; + GLubyte blue; + GLubyte alpha; + red = (GLubyte)NUM2INT(arg1); + green = (GLubyte)NUM2INT(arg2); + blue = (GLubyte)NUM2INT(arg3); + alpha = (GLubyte)NUM2INT(arg4); + glColor4ub(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4ui(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLuint red; + GLuint green; + GLuint blue; + GLuint alpha; + red = (GLuint)NUM2UINT(arg1); + green = (GLuint)NUM2UINT(arg2); + blue = (GLuint)NUM2UINT(arg3); + alpha = (GLuint)NUM2UINT(arg4); + glColor4ui(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_Color4us(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLushort red; + GLushort green; + GLushort blue; + GLushort alpha; + red = (GLushort)NUM2INT(arg1); + green = (GLushort)NUM2INT(arg2); + blue = (GLushort)NUM2INT(arg3); + alpha = (GLushort)NUM2INT(arg4); + glColor4us(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_EdgeFlag(obj,arg1) +VALUE obj,arg1; +{ + GLboolean flag; + flag = (GLboolean)NUM2INT(arg1); + glEdgeFlag(flag); + return Qnil; +} + +static VALUE +gl_EdgeFlagv(obj,arg1) +VALUE obj,arg1; +{ + GLboolean flag[1] = { GL_FALSE }; + Check_Type(arg1,T_ARRAY); + ary2cboolean(arg1,flag,1); + glEdgeFlagv(flag); + return Qnil; +} + +static VALUE +gl_End(obj) +VALUE obj; +{ + glEnd(); + return Qnil; +} + +static VALUE +gl_Indexd(obj,arg1) +VALUE obj,arg1; +{ + GLdouble c; + c = (GLdouble)NUM2DBL(arg1); + glIndexd(c); + return Qnil; +} + +static VALUE +gl_Indexdv(obj,arg1) +VALUE obj,arg1; +{ + GLdouble c[1] = {0.0}; + Check_Type(arg1,T_ARRAY); + ary2cdbl(arg1,c,1); + glIndexdv(c); + return Qnil; +} + +static VALUE +gl_Indexf(obj,arg1) +VALUE obj,arg1; +{ + GLfloat c; + c = (GLfloat)NUM2DBL(arg1); + glIndexf(c); + return Qnil; +} + +static VALUE +gl_Indexfv(obj,arg1) +VALUE obj,arg1; +{ + GLfloat c[1] = {0.0}; + Check_Type(arg1,T_ARRAY); + ary2cflt(arg1,c,1); + glIndexfv(c); + return Qnil; +} + +static VALUE +gl_Indexi(obj,arg1) +VALUE obj,arg1; +{ + GLint c; + c = (GLint)NUM2INT(arg1); + glIndexi(c); + return Qnil; +} + +static VALUE +gl_Indexiv(obj,arg1) +VALUE obj,arg1; +{ + GLint c[1] = {0.0}; + Check_Type(arg1,T_ARRAY); + ary2cint(arg1,c,1); + glIndexiv(c); + return Qnil; +} + +static VALUE +gl_Indexs(obj,arg1) +VALUE obj,arg1; +{ + GLshort c; + c = (GLshort)NUM2INT(arg1); + glIndexs(c); + return Qnil; +} + +static VALUE +gl_Indexsv(obj,arg1) +VALUE obj,arg1; +{ + GLshort c[1] = {0}; + Check_Type(arg1,T_ARRAY); + ary2cshort(arg1,c,1); + glIndexsv(c); + return Qnil; +} + +static VALUE +gl_Normal3b(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLbyte nx; + GLbyte ny; + GLbyte nz; + nx = (GLbyte)NUM2INT(arg1); + ny = (GLbyte)NUM2INT(arg2); + nz = (GLbyte)NUM2INT(arg3); + glNormal3b(nx,ny,nz); + return Qnil; +} + +static VALUE +gl_Normal3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble nx; + GLdouble ny; + GLdouble nz; + nx = (GLdouble)NUM2DBL(arg1); + ny = (GLdouble)NUM2DBL(arg2); + nz = (GLdouble)NUM2DBL(arg3); + glNormal3d(nx,ny,nz); + return Qnil; +} + +static VALUE +gl_Normal3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat nx; + GLfloat ny; + GLfloat nz; + nx = (GLfloat)NUM2DBL(arg1); + ny = (GLfloat)NUM2DBL(arg2); + nz = (GLfloat)NUM2DBL(arg3); + glNormal3f(nx,ny,nz); + return Qnil; +} + +static VALUE +gl_Normal3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint nx; + GLint ny; + GLint nz; + nx = (GLint)NUM2INT(arg1); + ny = (GLint)NUM2INT(arg2); + nz = (GLint)NUM2INT(arg3); + glNormal3i(nx,ny,nz); + return Qnil; +} + +static VALUE +gl_Normal3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort nx; + GLshort ny; + GLshort nz; + nx = (GLshort)NUM2INT(arg1); + ny = (GLshort)NUM2INT(arg2); + nz = (GLshort)NUM2INT(arg3); + glNormal3s(nx,ny,nz); + return Qnil; +} + +static VALUE +gl_RasterPos2d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLdouble x; + GLdouble y; + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + glRasterPos2d(x,y); + return Qnil; +} + +static VALUE +gl_RasterPos2f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat x; + GLfloat y; + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + glRasterPos2f(x,y); + return Qnil; +} + +static VALUE +gl_RasterPos2i(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint x; + GLint y; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + glRasterPos2i(x,y); + return Qnil; +} + +static VALUE +gl_RasterPos2s(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLshort x; + GLshort y; + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + glRasterPos2s(x,y); + return Qnil; +} + +static VALUE +gl_RasterPos3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble x; + GLdouble y; + GLdouble z; + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + z = (GLdouble)NUM2DBL(arg3); + glRasterPos3d(x,y,z); + return Qnil; +} + +static VALUE +gl_RasterPos3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat x; + GLfloat y; + GLfloat z; + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + z = (GLfloat)NUM2DBL(arg3); + glRasterPos3f(x,y,z); + return Qnil; +} + +static VALUE +gl_RasterPos3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint x; + GLint y; + GLint z; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + z = (GLint)NUM2INT(arg3); + glRasterPos3i(x,y,z); + return Qnil; +} + +static VALUE +gl_RasterPos3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort x; + GLshort y; + GLshort z; + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + z = (GLshort)NUM2INT(arg3); + glRasterPos3s(x,y,z); + return Qnil; +} + +static VALUE +gl_RasterPos4d(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble x; + GLdouble y; + GLdouble z; + GLdouble w; + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + z = (GLdouble)NUM2DBL(arg3); + w = (GLdouble)NUM2DBL(arg4); + glRasterPos4d(x,y,z,w); + return Qnil; +} + +static VALUE +gl_RasterPos4f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLfloat x; + GLfloat y; + GLfloat z; + GLfloat w; + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + z = (GLfloat)NUM2DBL(arg3); + w = (GLfloat)NUM2DBL(arg4); + glRasterPos4f(x,y,z,w); + return Qnil; +} + +static VALUE +gl_RasterPos4i(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint x; + GLint y; + GLint z; + GLint w; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + z = (GLint)NUM2INT(arg3); + w = (GLint)NUM2INT(arg4); + glRasterPos4i(x,y,z,w); + return Qnil; +} + +static VALUE +gl_RasterPos4s(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLshort x; + GLshort y; + GLshort z; + GLshort w; + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + z = (GLshort)NUM2INT(arg3); + w = (GLshort)NUM2INT(arg4); + glRasterPos4s(x,y,z,w); + return Qnil; +} + +static VALUE +gl_Rectd(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble x1; + GLdouble y1; + GLdouble x2; + GLdouble y2; + x1 = (GLdouble)NUM2DBL(arg1); + y1 = (GLdouble)NUM2DBL(arg2); + x2 = (GLdouble)NUM2DBL(arg3); + y2 = (GLdouble)NUM2DBL(arg4); + glRectd(x1,y1,x2,y2); + return Qnil; +} + +static VALUE +gl_Rectf(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLfloat x1; + GLfloat y1; + GLfloat x2; + GLfloat y2; + x1 = (GLfloat)NUM2DBL(arg1); + y1 = (GLfloat)NUM2DBL(arg2); + x2 = (GLfloat)NUM2DBL(arg3); + y2 = (GLfloat)NUM2DBL(arg4); + glRectf(x1,y1,x2,y2); + return Qnil; +} + +static VALUE +gl_Recti(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint x1; + GLint y1; + GLint x2; + GLint y2; + x1 = (GLint)NUM2INT(arg1); + y1 = (GLint)NUM2INT(arg2); + x2 = (GLint)NUM2INT(arg3); + y2 = (GLint)NUM2INT(arg4); + glRecti(x1,y1,x2,y2); + return Qnil; +} + +static VALUE +gl_Rects(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLshort x1; + GLshort y1; + GLshort x2; + GLshort y2; + x1 = (GLshort)NUM2INT(arg1); + y1 = (GLshort)NUM2INT(arg2); + x2 = (GLshort)NUM2INT(arg3); + y2 = (GLshort)NUM2INT(arg4); + glRects(x1,y1,x2,y2); + return Qnil; +} + +static VALUE +gl_TexCoord1d(obj,arg1) +VALUE obj,arg1; +{ + GLdouble s; + s = (GLdouble)NUM2DBL(arg1); + glTexCoord1d(s); + return Qnil; +} + +static VALUE +gl_TexCoord1f(obj,arg1) +VALUE obj,arg1; +{ + GLfloat s; + s = (GLfloat)NUM2DBL(arg1); + glTexCoord1f(s); + return Qnil; +} + +static VALUE +gl_TexCoord1i(obj,arg1) +VALUE obj,arg1; +{ + GLint s; + s = (GLint)NUM2INT(arg1); + glTexCoord1i(s); + return Qnil; +} + +static VALUE +gl_TexCoord1s(obj,arg1) +VALUE obj,arg1; +{ + GLshort s; + s = (GLshort)NUM2INT(arg1); + glTexCoord1s(s); + return Qnil; +} + +static VALUE +gl_TexCoord2d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLdouble s; + GLdouble t; + s = (GLdouble)NUM2DBL(arg1); + t = (GLdouble)NUM2DBL(arg2); + glTexCoord2d(s,t); + return Qnil; +} + +static VALUE +gl_TexCoord2f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat s; + GLfloat t; + s = (GLfloat)NUM2DBL(arg1); + t = (GLfloat)NUM2DBL(arg2); + glTexCoord2f(s,t); + return Qnil; +} + +static VALUE +gl_TexCoord2i(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint s; + GLint t; + s = (GLint)NUM2INT(arg1); + t = (GLint)NUM2INT(arg2); + glTexCoord2i(s,t); + return Qnil; +} + +static VALUE +gl_TexCoord2s(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLshort s; + GLshort t; + s = (GLshort)NUM2INT(arg1); + t = (GLshort)NUM2INT(arg2); + glTexCoord2s(s,t); + return Qnil; +} + +static VALUE +gl_TexCoord3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble s; + GLdouble t; + GLdouble r; + s = (GLdouble)NUM2DBL(arg1); + t = (GLdouble)NUM2DBL(arg2); + r = (GLdouble)NUM2DBL(arg3); + glTexCoord3d(s,t,r); + return Qnil; +} + +static VALUE +gl_TexCoord3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat s; + GLfloat t; + GLfloat r; + s = (GLfloat)NUM2DBL(arg1); + t = (GLfloat)NUM2DBL(arg2); + r = (GLfloat)NUM2DBL(arg3); + glTexCoord3f(s,t,r); + return Qnil; +} + +static VALUE +gl_TexCoord3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint s; + GLint t; + GLint r; + s = (GLint)NUM2INT(arg1); + t = (GLint)NUM2INT(arg2); + r = (GLint)NUM2INT(arg3); + glTexCoord3i(s,t,r); + return Qnil; +} + +static VALUE +gl_TexCoord3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort s; + GLshort t; + GLshort r; + s = (GLshort)NUM2INT(arg1); + t = (GLshort)NUM2INT(arg2); + r = (GLshort)NUM2INT(arg3); + glTexCoord3s(s,t,r); + return Qnil; +} + +static VALUE +gl_TexCoord4d(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble s; + GLdouble t; + GLdouble r; + GLdouble q; + s = (GLdouble)NUM2DBL(arg1); + t = (GLdouble)NUM2DBL(arg2); + r = (GLdouble)NUM2DBL(arg3); + q = (GLdouble)NUM2DBL(arg4); + glTexCoord4d(s,t,r,q); + return Qnil; +} + +static VALUE +gl_TexCoord4f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLfloat s; + GLfloat t; + GLfloat r; + GLfloat q; + s = (GLfloat)NUM2DBL(arg1); + t = (GLfloat)NUM2DBL(arg2); + r = (GLfloat)NUM2DBL(arg3); + q = (GLfloat)NUM2DBL(arg4); + glTexCoord4f(s,t,r,q); + return Qnil; +} + +static VALUE +gl_TexCoord4i(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint s; + GLint t; + GLint r; + GLint q; + s = (GLint)NUM2INT(arg1); + t = (GLint)NUM2INT(arg2); + r = (GLint)NUM2INT(arg3); + q = (GLint)NUM2INT(arg4); + glTexCoord4i(s,t,r,q); + return Qnil; +} + +static VALUE +gl_TexCoord4s(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLshort s; + GLshort t; + GLshort r; + GLshort q; + s = (GLshort)NUM2INT(arg1); + t = (GLshort)NUM2INT(arg2); + r = (GLshort)NUM2INT(arg3); + q = (GLshort)NUM2INT(arg4); + glTexCoord4s(s,t,r,q); + return Qnil; +} + +static VALUE +gl_Vertex2d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLdouble x; + GLdouble y; + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + glVertex2d(x,y); + return Qnil; +} + +static VALUE +gl_Vertex2f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat x; + GLfloat y; + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + glVertex2f(x,y); + return Qnil; +} + +static VALUE +gl_Vertex2i(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint x; + GLint y; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + glVertex2i(x,y); + return Qnil; +} + +static VALUE +gl_Vertex2s(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLshort x; + GLshort y; + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + glVertex2s(x,y); + return Qnil; +} + +static VALUE +gl_Vertex3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble x; + GLdouble y; + GLdouble z; + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + z = (GLdouble)NUM2DBL(arg3); + glVertex3d(x,y,z); + return Qnil; +} + +static VALUE +gl_Vertex3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat x; + GLfloat y; + GLfloat z; + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + z = (GLfloat)NUM2DBL(arg3); + glVertex3f(x,y,z); + return Qnil; +} + +static VALUE +gl_Vertex3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint x; + GLint y; + GLint z; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + z = (GLint)NUM2INT(arg3); + glVertex3i(x,y,z); + return Qnil; +} + +static VALUE +gl_Vertex3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort x; + GLshort y; + GLshort z; + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + z = (GLshort)NUM2INT(arg3); + glVertex3s(x,y,z); + return Qnil; +} + +static VALUE +gl_Vertex4d(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble x; + GLdouble y; + GLdouble z; + GLdouble w; + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + z = (GLdouble)NUM2DBL(arg3); + w = (GLdouble)NUM2DBL(arg4); + glVertex4d(x,y,z,w); + return Qnil; +} + +static VALUE +gl_Vertex4f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLfloat x; + GLfloat y; + GLfloat z; + GLfloat w; + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + z = (GLfloat)NUM2DBL(arg3); + w = (GLfloat)NUM2DBL(arg4); + glVertex4f(x,y,z,w); + return Qnil; +} + +static VALUE +gl_Vertex4i(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint x; + GLint y; + GLint z; + GLint w; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + z = (GLint)NUM2INT(arg3); + w = (GLint)NUM2INT(arg4); + glVertex4i(x,y,z,w); + return Qnil; +} + +static VALUE +gl_Vertex4s(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLshort x; + GLshort y; + GLshort z; + GLshort w; + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + z = (GLshort)NUM2INT(arg3); + w = (GLshort)NUM2INT(arg4); + glVertex4s(x,y,z,w); + return Qnil; +} + +static VALUE +gl_ClipPlane(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum plane; + GLdouble equation[4]; + plane = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + ary2cdbl(arg2, equation, 4); + glClipPlane(plane,equation); + return Qnil; +} + +static VALUE +gl_ColorMaterial(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum face; + GLenum mode; + face = (GLenum)NUM2INT(arg1); + mode = (GLenum)NUM2INT(arg2); + glColorMaterial(face,mode); + return Qnil; +} + +static VALUE +gl_CullFace(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + mode = (GLenum)NUM2INT(arg1); + glCullFace(mode); + return Qnil; +} + +static VALUE +gl_Fogf(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat param; + pname = (GLenum)NUM2INT(arg1); + param = (GLfloat)NUM2DBL(arg2); + glFogf(pname,param); + return Qnil; +} + +static VALUE +gl_Fogfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + pname = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + ary2cflt(arg2,params,4); + glFogfv(pname,params); + return Qnil; +} + +static VALUE +gl_Fogi(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint param; + pname = (GLenum)NUM2INT(arg1); + param = (GLint)NUM2INT(arg2); + glFogi(pname,param); + return Qnil; +} + +static VALUE +gl_Fogiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint params[4] = {0,0,0,0}; + pname = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + ary2cint(arg2,params,4); + glFogiv(pname,params); + return Qnil; +} + +static VALUE +gl_FrontFace(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + mode = (GLenum)NUM2INT(arg1); + glFrontFace(mode); + return Qnil; +} + +static VALUE +gl_Hint(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum mode; + target = (GLenum)NUM2UINT(arg1); + mode = (GLenum)NUM2UINT(arg2); + glHint(target,mode); + return Qnil; +} + +static VALUE +gl_Lightf(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum light; + GLenum pname; + GLfloat param; + light = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLfloat)NUM2DBL(arg3); + glLightf(light,pname,param); + return Qnil; +} + +static VALUE +gl_Lightfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum light; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + light = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + glLightfv(light,pname,params); + return Qnil; +} + +static VALUE +gl_Lighti(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum light; + GLenum pname; + GLint param; + light = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLint)NUM2INT(arg3); + glLighti(light,pname,param); + return Qnil; +} + +static VALUE +gl_Lightiv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum light; + GLenum pname; + GLint params[4]={0,0,0,0}; + light = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + glLightiv(light,pname,params); + return Qnil; +} + +static VALUE +gl_LightModelf(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat param; + pname = (GLenum)NUM2INT(arg1); + param = (GLfloat)NUM2DBL(arg2); + glLightModelf(pname,param); + return Qnil; +} + +static VALUE +gl_LightModelfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + pname = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + ary2cflt(arg2,params,4); + glLightModelfv(pname,params); + return Qnil; +} + +static VALUE +gl_LightModeli(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint param; + pname = (GLenum)NUM2INT(arg1); + param = (GLint)NUM2INT(arg2); + glLightModeli(pname,param); + return Qnil; +} + +static VALUE +gl_LightModeliv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint params[4] = {0,0,0,0}; + pname = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + ary2cint(arg2,params,4); + glLightModeliv(pname,params); + return Qnil; +} + +static VALUE +gl_LineStipple(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint factor; + GLushort pattern; + factor = (GLint)NUM2INT(arg1); + pattern = (GLushort)(NUM2INT(arg2) & 0xFFFF); + glLineStipple(factor,pattern); + return Qnil; +} + +static VALUE +gl_LineWidth(obj,arg1) +VALUE obj,arg1; +{ + GLfloat width; + width = (GLfloat)NUM2DBL(arg1); + glLineWidth(width); + return Qnil; +} + +static VALUE +gl_Materialf(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum face; + GLenum pname; + GLfloat param; + face = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLfloat)NUM2DBL(arg3); + glMaterialf(face,pname,param); + return Qnil; +} + +static VALUE +gl_Materialfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum face; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + face = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + glMaterialfv(face,pname,params); + return Qnil; +} + +static VALUE +gl_Materiali(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum face; + GLenum pname; + GLint param; + face = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLint)NUM2INT(arg3); + glMateriali(face,pname,param); + return Qnil; +} + +static VALUE +gl_Materialiv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum face; + GLenum pname; + GLint params[4] = {0,0,0,0}; + face = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + glMaterialiv(face,pname,params); + return Qnil; +} + +static VALUE +gl_PointSize(obj,arg1) +VALUE obj,arg1; +{ + GLfloat size; + size = (GLfloat)NUM2DBL(arg1); + glPointSize(size); + return Qnil; +} + +static VALUE +gl_PolygonMode(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum face; + GLenum mode; + face = (GLenum)NUM2INT(arg1); + mode = (GLenum)NUM2INT(arg2); + glPolygonMode(face,mode); + return Qnil; +} + +static VALUE +gl_PolygonStipple(obj,arg1) +VALUE obj,arg1; +{ + GLubyte mask[128]; + memset(mask, 0x0, sizeof(GLubyte)*128); + if (TYPE(arg1) == T_ARRAY) { + ary2cubyte(arg1,mask,128); + } + else if (TYPE(arg1) == T_STRING) { + if (RSTRING(arg1)->len < 128) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg1)->len); + memcpy(mask, RSTRING(arg1)->ptr, 128); + } + else + Check_Type(arg1,T_STRING); /* force exception */ + glPolygonStipple(mask); + return Qnil; +} + +static VALUE +gl_Scissor(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint x; + GLint y; + GLsizei width; + GLsizei height; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + height = (GLsizei)NUM2UINT(arg4); + glScissor(x,y,width,height); + return Qnil; +} + +static VALUE +gl_ShadeModel(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + mode = (GLenum)NUM2INT(arg1); + glShadeModel(mode); + return Qnil; +} + +static VALUE +gl_TexParameterf(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat param; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLfloat)NUM2DBL(arg3); + glTexParameterf(target,pname,param); + return Qnil; +} + +static VALUE +gl_TexParameterfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + glTexParameterfv(target,pname,params); + return Qnil; +} + +static VALUE +gl_TexParameteri(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint param; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLint)NUM2INT(arg3); + glTexParameteri(target,pname,param); + return Qnil; +} + +static VALUE +gl_TexParameteriv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint params[4] = {0,0,0,0}; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + glTexParameteriv(target,pname,params); + return Qnil; +} + +/* FIXME: spatna funkce ? */ +static VALUE +gl_TexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8; +{ + GLenum target; + GLint level; + GLint components; + GLsizei width; + GLint border; + GLenum format; + GLenum type; + const char *pixels; + int size; + int type_size; + int format_size; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + components = (GLint)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + border = (GLint)NUM2INT(arg5); + format = (GLenum)NUM2INT(arg6); + type = (GLenum)NUM2INT(arg7); + type_size = gltype_size(type); + format_size = glformat_size(format); + + if (type_size == -1 || format_size == -1) + return Qnil; + if (type==GL_BITMAP) + size = format_size*(width/8); + else + size = type_size*format_size*width; + + if (target == GL_PROXY_TEXTURE_1D || NIL_P(arg8)) { /* proxy texture, no data read */ + pixels = NULL; + } else { + if (TYPE(arg8) == T_FIXNUM || TYPE(arg8) == T_BIGNUM) { /* arg8 is offset to unpack buffer */ + pixels = (const char *)NUM2UINT(arg8); + } else if (TYPE(arg8) == T_STRING) { /* image data */ + if (RSTRING(arg8)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len); + pixels = RSTRING(arg8)->ptr; + } else { + Check_Type(arg8,T_STRING); /* force exception */ + return Qnil; + } + } + glTexImage1D(target,level,components,width,border,format,type,pixels); + return Qnil; +} + +static VALUE +gl_TexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9; +{ + GLenum target; + GLint level; + GLint components; + GLsizei width; + GLsizei height; + GLint border; + GLenum format; + GLenum type; + const char *pixels; + int size; + int type_size; + int format_size; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + components = (GLint)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + height = (GLsizei)NUM2UINT(arg5); + border = (GLint)NUM2INT(arg6); + format = (GLenum)NUM2INT(arg7); + type = (GLenum)NUM2INT(arg8); + type_size = gltype_size(type); + format_size = glformat_size(format); + + if (type_size == -1 || format_size == -1) + return Qnil; + if (type==GL_BITMAP) + size = format_size*((height*width)/8); + else + size = type_size*format_size*height*width; + + if (target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_CUBE_MAP || NIL_P(arg9)) { /* proxy texture, no data read */ + pixels = NULL; + } else { + if (TYPE(arg9) == T_FIXNUM || TYPE(arg9) == T_BIGNUM) { /* arg9 is offset to unpack buffer */ + pixels = (const char *)NUM2UINT(arg9); + } else if (TYPE(arg9) == T_STRING) { /* image data */ + if (RSTRING(arg9)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len); + pixels = RSTRING(arg9)->ptr; + } else { + Check_Type(arg9,T_STRING); /* force exception */ + return Qnil; + } + } + glTexImage2D(target,level,components,width,height,border,format,type,pixels); + return Qnil; +} + +static VALUE +gl_TexEnvf(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat param; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLfloat)NUM2DBL(arg3); + glTexEnvf(target,pname,param); + return Qnil; +} + +static VALUE +gl_TexEnvfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + glTexEnvfv(target,pname,params); + return Qnil; +} + +static VALUE +gl_TexEnvi(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint param; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLint)NUM2INT(arg3); + glTexEnvi(target,pname,param); + return Qnil; +} + +static VALUE +gl_TexEnviv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint params[4] = {0,0,0,0}; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + glTexEnviv(target,pname,params); + return Qnil; +} + +static VALUE +gl_TexGend(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum coord; + GLenum pname; + GLdouble param; + coord = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLdouble)NUM2DBL(arg3); + glTexGend(coord,pname,param); + return Qnil; +} + +static VALUE +gl_TexGendv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum coord; + GLenum pname; + GLdouble params[4] = {0.0,0.0,0.0,0.0}; + coord = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cdbl(arg3,params,4); + glTexGendv(coord,pname,params); + return Qnil; +} + + +static VALUE +gl_TexGenf(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum coord; + GLenum pname; + GLfloat param; + coord = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLfloat)NUM2DBL(arg3); + glTexGenf(coord,pname,param); + return Qnil; +} + +static VALUE +gl_TexGenfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum coord; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + coord = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + glTexGenfv(coord,pname,params); + return Qnil; +} + +static VALUE +gl_TexGeni(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum coord; + GLenum pname; + GLint param; + coord = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + param = (GLint)NUM2INT(arg3); + glTexGeni(coord,pname,param); + return Qnil; +} + +static VALUE +gl_TexGeniv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum coord; + GLenum pname; + GLint params[4] = {0,0,0,0}; + coord = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + glTexGeniv(coord,pname,params); + return Qnil; +} +static VALUE g_current_feed_buffer; +static VALUE +gl_FeedbackBuffer(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLsizei size; + GLenum type; + size = (GLsizei)NUM2UINT(arg1); + type = (GLenum)NUM2INT(arg2); + g_current_feed_buffer = allocate_buffer_with_string(sizeof(GLfloat)*size); + rb_str_freeze(g_current_feed_buffer); + glFeedbackBuffer(size, type, (GLfloat*)RSTRING(g_current_feed_buffer)->ptr); + return g_current_feed_buffer; +} + +static VALUE g_current_sel_buffer; +static VALUE +gl_SelectBuffer(obj,arg1) +VALUE obj,arg1; +{ + GLsizei size; + size = (GLsizei)NUM2UINT(arg1); + g_current_sel_buffer = allocate_buffer_with_string(sizeof(GLuint)*size); + rb_str_freeze(g_current_sel_buffer); + glSelectBuffer(size, (GLuint*)RSTRING(g_current_sel_buffer)->ptr); + return g_current_sel_buffer; +} + +static VALUE +gl_RenderMode(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + GLint ret; + mode = (GLenum)NUM2INT(arg1); + ret = glRenderMode(mode); + return INT2NUM(ret); +} + +static VALUE +gl_InitNames(obj) +VALUE obj; +{ + glInitNames(); + return Qnil; +} + +static VALUE +gl_LoadName(obj,arg1) +VALUE obj,arg1; +{ + GLuint name; + name = (GLuint)NUM2UINT(arg1); + glLoadName(name); + return Qnil; +} + +static VALUE +gl_PassThrough(obj,arg1) +VALUE obj,arg1; +{ + GLfloat token; + token = (GLfloat)NUM2DBL(arg1); + glPassThrough(token); + return Qnil; +} + +static VALUE +gl_PopName(obj) +VALUE obj; +{ + glPopName(); + return Qnil; +} + +static VALUE +gl_PushName(obj,arg1) +VALUE obj,arg1; +{ + GLuint name; + name = (GLuint)NUM2UINT(arg1); + glPushName(name); + return Qnil; +} + +static VALUE +gl_DrawBuffer(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + mode = (GLenum)NUM2INT(arg1); + glDrawBuffer(mode); + return Qnil; +} + +static VALUE +gl_Clear(obj,arg1) +VALUE obj,arg1; +{ + GLbitfield mask; + mask = (GLbitfield)NUM2UINT(arg1); + glClear(mask); + return Qnil; +} + +static VALUE +gl_ClearAccum(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLfloat red; + GLfloat green; + GLfloat blue; + GLfloat alpha; + red = (GLfloat)NUM2DBL(arg1); + green = (GLfloat)NUM2DBL(arg2); + blue = (GLfloat)NUM2DBL(arg3); + alpha = (GLfloat)NUM2DBL(arg4); + glClearAccum(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_ClearIndex(obj,arg1) +VALUE obj,arg1; +{ + GLfloat c; + c = (GLfloat)NUM2DBL(arg1); + glClearIndex(c); + return Qnil; +} + +static VALUE +gl_ClearColor(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLclampf red; + GLclampf green; + GLclampf blue; + GLclampf alpha; + red = (GLclampf)NUM2DBL(arg1); + green = (GLclampf)NUM2DBL(arg2); + blue = (GLclampf)NUM2DBL(arg3); + alpha = (GLclampf)NUM2DBL(arg4); + glClearColor(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_ClearStencil(obj,arg1) +VALUE obj,arg1; +{ + GLint s; + s = (GLint)NUM2INT(arg1); + glClearStencil(s); + return Qnil; +} + +static VALUE +gl_ClearDepth(obj,arg1) +VALUE obj,arg1; +{ + GLclampd depth; + depth = (GLclampd)NUM2DBL(arg1); + glClearDepth(depth); + return Qnil; +} + +static VALUE +gl_StencilMask(obj,arg1) +VALUE obj,arg1; +{ + GLuint mask; + mask = (GLuint)NUM2UINT(arg1); + glStencilMask(mask); + return Qnil; +} + +static VALUE +gl_ColorMask(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLboolean red; + GLboolean green; + GLboolean blue; + GLboolean alpha; + red = (GLboolean)NUM2INT(arg1); + green = (GLboolean)NUM2INT(arg2); + blue = (GLboolean)NUM2INT(arg3); + alpha = (GLboolean)NUM2INT(arg4); + glColorMask(red,green,blue,alpha); + return Qnil; +} + +static VALUE +gl_DepthMask(obj,arg1) +VALUE obj,arg1; +{ + GLboolean flag; + flag = (GLboolean)NUM2INT(arg1); + glDepthMask(flag); + return Qnil; +} + +static VALUE +gl_IndexMask(obj,arg1) +VALUE obj,arg1; +{ + GLuint mask; + mask = (GLuint)NUM2UINT(arg1); + glIndexMask(mask); + return Qnil; +} + +static VALUE +gl_Accum(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum op; + GLfloat value; + op = (GLenum)NUM2INT(arg1); + value = (GLfloat)NUM2DBL(arg2); + glAccum(op,value); + return Qnil; +} + +static VALUE +gl_Disable(obj,arg1) +VALUE obj,arg1; +{ + GLenum cap; + cap = (GLenum)NUM2INT(arg1); + glDisable(cap); + return Qnil; +} + +static VALUE +gl_Enable(obj,arg1) +VALUE obj,arg1; +{ + GLenum cap; + cap = (GLenum)NUM2INT(arg1); + glEnable(cap); + return Qnil; +} + +static VALUE +gl_Finish(obj) +VALUE obj; +{ + glFinish(); + return Qnil; +} + +static VALUE +gl_Flush(obj) +VALUE obj; +{ + glFlush(); + return Qnil; +} + +static VALUE +gl_PopAttrib(obj) +VALUE obj; +{ + glPopAttrib(); + return Qnil; +} + +static VALUE +gl_PushAttrib(obj,arg1) +VALUE obj,arg1; +{ + GLbitfield mask; + mask = (GLbitfield)NUM2UINT(arg1); + glPushAttrib(mask); + return Qnil; +} + +static VALUE +gl_Map1d(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLdouble u1; + GLdouble u2; + GLint stride; + GLint order; + GLdouble *points; + + VALUE work_ary; + + target = (GLenum)NUM2INT(arg1); + u1 = (GLdouble)NUM2DBL(arg2); + u2 = (GLdouble)NUM2DBL(arg3); + stride = (GLint)NUM2INT(arg4); + order = (GLint)NUM2INT(arg5); + points = ALLOC_N(GLdouble, order*stride); + work_ary = rb_ary_new(); + mary2ary(arg6, work_ary); + ary2cdbl(work_ary, points, order*stride); + glMap1d(target, u1, u2, stride, order, points); + xfree(points); + return Qnil; +} + +static VALUE +gl_Map1f(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLfloat u1; + GLfloat u2; + GLint stride; + GLint order; + GLfloat *points; + + VALUE work_ary; + + target = (GLenum)NUM2INT(arg1); + u1 = (GLfloat)NUM2DBL(arg2); + u2 = (GLfloat)NUM2DBL(arg3); + stride = (GLint)NUM2INT(arg4); + order = (GLint)NUM2INT(arg5); + points = ALLOC_N(GLfloat, order*stride); + work_ary = rb_ary_new(); + mary2ary(arg6, work_ary); + ary2cflt(work_ary, points, order*stride); + glMap1f(target, u1, u2, stride, order, points); + xfree(points); + return Qnil; +} + +static VALUE +gl_Map2d(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10; +{ + GLenum target; + GLdouble u1; + GLdouble u2; + GLint ustride; + GLint uorder; + GLdouble v1; + GLdouble v2; + GLint vstride; + GLint vorder; + GLdouble *points; + + VALUE work_ary; + + target = (GLenum)NUM2INT(arg1); + u1 = (GLdouble)NUM2INT(arg2); + u2 = (GLdouble)NUM2INT(arg3); + ustride = (GLint)NUM2INT(arg4); + uorder = (GLint)NUM2INT(arg5); + v1 = (GLdouble)NUM2INT(arg6); + v2 = (GLdouble)NUM2INT(arg7); + vstride = (GLint)NUM2INT(arg8); + vorder = (GLint)NUM2INT(arg9); + points = ALLOC_N(GLdouble, MAX(ustride*uorder, vstride*vorder)); + work_ary = rb_ary_new(); + mary2ary(arg10, work_ary); + ary2cdbl(arg10, points, MAX(ustride*uorder, vstride*vorder)); + glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + xfree(points); + return Qnil; +} + +static VALUE +gl_Map2f(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10; +{ + GLenum target; + GLfloat u1; + GLfloat u2; + GLint ustride; + GLint uorder; + GLfloat v1; + GLfloat v2; + GLint vstride; + GLint vorder; + GLfloat *points; + + VALUE work_ary; + + target = (GLenum)NUM2INT(arg1); + u1 = (GLfloat)NUM2INT(arg2); + u2 = (GLfloat)NUM2INT(arg3); + ustride = (GLint)NUM2INT(arg4); + uorder = (GLint)NUM2INT(arg5); + v1 = (GLfloat)NUM2INT(arg6); + v2 = (GLfloat)NUM2INT(arg7); + vstride = (GLint)NUM2INT(arg8); + vorder = (GLint)NUM2INT(arg9); + points = ALLOC_N(GLfloat, MAX(ustride*uorder, vstride*vorder)); + work_ary = rb_ary_new(); + mary2ary(arg10, work_ary); + ary2cflt(arg10, points, MAX(ustride*uorder, vstride*vorder)); + glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + xfree(points); + return Qnil; +} + +static VALUE +gl_MapGrid1d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint un; + GLdouble u1; + GLdouble u2; + un = (GLint)NUM2INT(arg1); + u1 = (GLdouble)NUM2DBL(arg2); + u2 = (GLdouble)NUM2DBL(arg3); + glMapGrid1d(un,u1,u2); + return Qnil; +} + +static VALUE +gl_MapGrid1f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint un; + GLfloat u1; + GLfloat u2; + un = (GLint)NUM2INT(arg1); + u1 = (GLfloat)NUM2DBL(arg2); + u2 = (GLfloat)NUM2DBL(arg3); + glMapGrid1f(un,u1,u2); + return Qnil; +} + +static VALUE +gl_MapGrid2d(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLint un; + GLdouble u1; + GLdouble u2; + GLint vn; + GLdouble v1; + GLdouble v2; + un = (GLint)NUM2INT(arg1); + u1 = (GLdouble)NUM2DBL(arg2); + u2 = (GLdouble)NUM2DBL(arg3); + vn = (GLint)NUM2INT(arg4); + v1 = (GLdouble)NUM2DBL(arg5); + v2 = (GLdouble)NUM2DBL(arg6); + glMapGrid2d(un,u1,u2,vn,v1,v2); + return Qnil; +} + +static VALUE +gl_MapGrid2f(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLint un; + GLfloat u1; + GLfloat u2; + GLint vn; + GLfloat v1; + GLfloat v2; + un = (GLint)NUM2INT(arg1); + u1 = (GLfloat)NUM2DBL(arg2); + u2 = (GLfloat)NUM2DBL(arg3); + vn = (GLint)NUM2INT(arg4); + v1 = (GLfloat)NUM2DBL(arg5); + v2 = (GLfloat)NUM2DBL(arg6); + glMapGrid2f(un,u1,u2,vn,v1,v2); + return Qnil; +} + +static VALUE +gl_EvalCoord1d(obj,arg1) +VALUE obj,arg1; +{ + GLdouble u; + u = (GLdouble)NUM2DBL(arg1); + glEvalCoord1d(u); + return Qnil; +} + +static VALUE +gl_EvalCoord1dv(obj,arg1) +VALUE obj,arg1; +{ + GLdouble params[1] = {0.0}; + Check_Type(arg1,T_ARRAY); + ary2cdbl(arg1,params,1); + glEvalCoord1dv(params); + return Qnil; +} + +static VALUE +gl_EvalCoord1f(obj,arg1) +VALUE obj,arg1; +{ + GLfloat u; + u = (GLfloat)NUM2DBL(arg1); + glEvalCoord1f(u); + return Qnil; +} + +static VALUE +gl_EvalCoord1fv(obj,arg1) +VALUE obj,arg1; +{ + GLfloat params[1] = {0.0}; + Check_Type(arg1,T_ARRAY); + ary2cflt(arg1,params,1); + glEvalCoord1fv(params); + return Qnil; +} + +static VALUE +gl_EvalCoord2d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLdouble u; + GLdouble v; + u = (GLdouble)NUM2DBL(arg1); + v = (GLdouble)NUM2DBL(arg2); + glEvalCoord2d(u,v); + return Qnil; +} + +static VALUE +gl_EvalCoord2dv(obj,arg1) +VALUE obj,arg1; +{ + GLdouble params[2] = {0.0,0.0}; + Check_Type(arg1,T_ARRAY); + ary2cdbl(arg1,params,2); + glEvalCoord2dv(params); + return Qnil; +} + +static VALUE +gl_EvalCoord2f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat u; + GLfloat v; + u = (GLfloat)NUM2DBL(arg1); + v = (GLfloat)NUM2DBL(arg2); + glEvalCoord2f(u,v); + return Qnil; +} + +static VALUE +gl_EvalCoord2fv(obj,arg1) +VALUE obj,arg1; +{ + GLfloat params[2] = {0.0,0.0}; + Check_Type(arg1,T_ARRAY); + ary2cflt(arg1,params,2); + glEvalCoord2fv(params); + return Qnil; +} + +static VALUE +gl_EvalMesh1(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum mode; + GLint i1; + GLint i2; + mode = (GLenum)NUM2INT(arg1); + i1 = (GLint)NUM2INT(arg2); + i2 = (GLint)NUM2INT(arg3); + glEvalMesh1(mode,i1,i2); + return Qnil; +} + +static VALUE +gl_EvalPoint1(obj,arg1) +VALUE obj,arg1; +{ + GLint i; + i = (GLint)NUM2INT(arg1); + glEvalPoint1(i); + return Qnil; +} + +static VALUE +gl_EvalMesh2(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum mode; + GLint i1; + GLint i2; + GLint j1; + GLint j2; + mode = (GLenum)NUM2INT(arg1); + i1 = (GLint)NUM2INT(arg2); + i2 = (GLint)NUM2INT(arg3); + j1 = (GLint)NUM2INT(arg4); + j2 = (GLint)NUM2INT(arg5); + glEvalMesh2(mode,i1,i2,j1,j2); + return Qnil; +} + +static VALUE +gl_EvalPoint2(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint i; + GLint j; + i = (GLint)NUM2INT(arg1); + j = (GLint)NUM2INT(arg2); + glEvalPoint2(i,j); + return Qnil; +} + +static VALUE +gl_AlphaFunc(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum func; + GLclampf ref; + func = (GLenum)NUM2INT(arg1); + ref = (GLclampf)NUM2DBL(arg2); + glAlphaFunc(func,ref); + return Qnil; +} + +static VALUE +gl_BlendFunc(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum sfactor; + GLenum dfactor; + sfactor = (GLenum)NUM2INT(arg1); + dfactor = (GLenum)NUM2INT(arg2); + glBlendFunc(sfactor,dfactor); + return Qnil; +} + +static VALUE +gl_LogicOp(obj,arg1) +VALUE obj,arg1; +{ + GLenum opcode; + opcode = (GLenum)NUM2INT(arg1); + glLogicOp(opcode); + return Qnil; +} + +static VALUE +gl_StencilFunc(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum func; + GLint ref; + GLuint mask; + func = (GLenum)NUM2INT(arg1); + ref = (GLint)NUM2INT(arg2); + mask = (GLuint)NUM2UINT(arg3); + glStencilFunc(func,ref,mask); + return Qnil; +} + +static VALUE +gl_StencilOp(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum fail; + GLenum zfail; + GLenum zpass; + fail = (GLenum)NUM2INT(arg1); + zfail = (GLenum)NUM2INT(arg2); + zpass = (GLenum)NUM2INT(arg3); + glStencilOp(fail,zfail,zpass); + return Qnil; +} + +static VALUE +gl_DepthFunc(obj,arg1) +VALUE obj,arg1; +{ + GLenum func; + func = (GLenum)NUM2INT(arg1); + glDepthFunc(func); + return Qnil; +} + +static VALUE +gl_PixelZoom(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat xfactor; + GLfloat yfactor; + xfactor = (GLfloat)NUM2DBL(arg1); + yfactor = (GLfloat)NUM2DBL(arg2); + glPixelZoom(xfactor,yfactor); + return Qnil; +} + +static VALUE +gl_PixelTransferf(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat param; + pname = (GLenum)NUM2INT(arg1); + param = (GLfloat)NUM2DBL(arg2); + glPixelTransferf(pname,param); + return Qnil; +} + +static VALUE +gl_PixelTransferi(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint param; + pname = (GLenum)NUM2INT(arg1); + param = (GLint)NUM2INT(arg2); + glPixelTransferi(pname,param); + return Qnil; +} + +static VALUE +gl_PixelStoref(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat param; + pname = (GLenum)NUM2INT(arg1); + param = (GLfloat)NUM2DBL(arg2); + glPixelStoref(pname,param); + return Qnil; +} + +static VALUE +gl_PixelStorei(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint param; + pname = (GLenum)NUM2INT(arg1); + param = (GLint)NUM2INT(arg2); + glPixelStorei(pname,param); + return Qnil; +} + +static VALUE +gl_PixelMapfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum map; + GLfloat *values; + GLsizei size; + map = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + size = RARRAY(arg2)->len; + values = ALLOC_N(GLfloat,size); + ary2cflt(arg2,values,size); + glPixelMapfv(map,size,values); + xfree(values); + return Qnil; +} + +static VALUE +gl_PixelMapuiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum map; + GLuint *values; + GLsizei size; + map = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + size = RARRAY(arg2)->len; + values = ALLOC_N(GLuint,size); + ary2cuint(arg2,values,size); + glPixelMapuiv(map,size,values); + xfree(values); + return Qnil; +} + +static VALUE +gl_PixelMapusv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum map; + GLushort *values; + GLsizei size; + map = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + size = RARRAY(arg2)->len; + values = ALLOC_N(GLushort,size); + ary2cushort(arg2,values,size); + glPixelMapusv(map,size,values); + xfree(values); + return Qnil; +} + +static VALUE +gl_ReadBuffer(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + mode = (GLenum)NUM2INT(arg1); + glReadBuffer(mode); + return Qnil; +} + +static VALUE +gl_CopyPixels(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLint x; + GLint y; + GLsizei width; + GLsizei height; + GLenum type; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + height = (GLsizei)NUM2UINT(arg4); + type = (GLenum)NUM2INT(arg5); + glCopyPixels(x,y,width,height,type); + return Qnil; +} + +static VALUE +gl_ReadPixels(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLint x; + GLint y; + GLsizei width; + GLsizei height; + int format; + int type; + VALUE pixels; + GLsizei type_size; + GLsizei format_size; + GLsizei size; + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + height = (GLsizei)NUM2UINT(arg4); + format = NUM2INT(arg5); + type = NUM2INT(arg6); + type_size = gltype_size(type); + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + + if (type==GL_BITMAP) + size = format_size*((width*height)/8); + else + size = width*height*format_size*type_size; + pixels = allocate_buffer_with_string(size); + FORCE_PIXEL_STORE_MODE + glReadPixels(x,y,width,height,format,type,(GLvoid*)RSTRING(pixels)->ptr); + RESTORE_PIXEL_STORE_MODE + return pixels; +} + +static VALUE +gl_DrawPixels(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLsizei width; + GLsizei height; + GLenum format; + GLenum type; + const char *pixels; + GLsizei size; + GLsizei type_size; + GLsizei format_size; + width = (GLsizei)NUM2UINT(arg1); + height = (GLsizei)NUM2UINT(arg2); + format = (GLenum)NUM2INT(arg3); + type = (GLenum)NUM2INT(arg4); + Check_Type(arg5,T_STRING); + type_size = gltype_size(type); + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eArgError, "type/format mismatch"); + if (type==GL_BITMAP) + size = format_size*(width/8); + else + size = type_size*format_size*width*height; + if (RSTRING(arg5)->len < size) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg5)->len); + pixels = RSTRING(arg5)->ptr; + glDrawPixels(width,height,format,type,pixels); + return Qnil; +} + +static VALUE +gl_GetClipPlane(obj,arg1) +VALUE obj,arg1; +{ + GLenum plane; + GLdouble equation[4] = {0.0,0.0,0.0,0.0}; + VALUE retary; + int i; + plane = (GLenum)NUM2INT(arg1); + glGetClipPlane(plane,equation); + retary = rb_ary_new2(4); + for(i=0;i<4;i++) + rb_ary_push(retary, rb_float_new(equation[i])); + return retary; +} + +#define GLGET_FUNC(_name_,_type_,_conv_) \ +static VALUE \ +gl_Get##_name_##v(obj,arg1) \ +VALUE obj,arg1; \ +{ \ + GLenum pname; \ + int nitems; \ + VALUE ary, ary2; \ + int i,j; \ + _type_ items[32]; \ + pname = NUM2INT(arg1); \ + switch(pname) { \ + case GL_ACCUM_CLEAR_VALUE: \ + case GL_BLEND_COLOR: \ + case GL_COLOR_CLEAR_VALUE: \ + case GL_COLOR_WRITEMASK: \ + case GL_CURRENT_COLOR: \ + case GL_CURRENT_RASTER_COLOR: \ + case GL_CURRENT_RASTER_POSITION: \ + case GL_CURRENT_RASTER_SECONDARY_COLOR: \ + case GL_CURRENT_RASTER_TEXTURE_COORDS: \ + case GL_CURRENT_TEXTURE_COORDS: \ + case GL_FOG_COLOR: \ + case GL_LIGHT_MODEL_AMBIENT: \ + case GL_MAP2_GRID_DOMAIN: \ + case GL_CURRENT_SECONDARY_COLOR: \ + case GL_SCISSOR_BOX: \ + case GL_TEXTURE_ENV_COLOR: \ + case GL_VIEWPORT: \ + nitems = 4; \ + break; \ + case GL_CURRENT_NORMAL: \ + case GL_POINT_DISTANCE_ATTENUATION: \ + nitems = 3; \ + break; \ + case GL_DEPTH_RANGE: \ + case GL_LINE_WIDTH_RANGE: \ + case GL_MAP1_GRID_DOMAIN: \ + case GL_MAP2_GRID_SEGMENTS: \ + case GL_MAX_VIEWPORT_DIMS: \ + case GL_POINT_SIZE_RANGE: \ + case GL_POLYGON_MODE: \ + case GL_ALIASED_LINE_WIDTH_RANGE: \ + case GL_ALIASED_POINT_SIZE_RANGE: \ + nitems = 2; \ + break; \ + case GL_MODELVIEW_MATRIX: \ + case GL_PROJECTION_MATRIX: \ + case GL_TEXTURE_MATRIX: \ + glGet##_name_##v(pname, items); \ + ary = rb_ary_new2(4); \ + for (i = 0; i < 4; i++) { \ + ary2 = rb_ary_new2(4); \ + rb_ary_push(ary, ary2); \ + for (j = 0; j < 4; j++) \ + rb_ary_push(ary2, _conv_(items[i*4+j])); \ + } \ + return ary; \ + case GL_POLYGON_STIPPLE: \ + glGet##_name_##v(pname, items); \ + return rb_str_new((const char*)items, 32); \ + default: /* size=1 */ \ + glGet##_name_##v(pname, items); \ + return _conv_(items[0]); \ + } \ + glGet##_name_##v(pname, items); \ + ary = rb_ary_new2(nitems); \ + for (i = 0; i < nitems; i++) \ + rb_ary_push(ary, _conv_(items[i])); \ + return ary; \ +} + +GLGET_FUNC(Double,GLdouble,rb_float_new) +GLGET_FUNC(Float,GLfloat,rb_float_new) +GLGET_FUNC(Integer,GLint,INT2NUM) +GLGET_FUNC(Boolean,GLboolean,INT2NUM) + +#undef GLGET_FUNC + +static VALUE +gl_GetError(obj) +VALUE obj; +{ + GLenum ret; + ret = glGetError(); + return INT2NUM(ret); +} + +static VALUE +gl_GetLightfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum light; + GLenum pname; + GLsizei size; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + VALUE retary; + int i; + light = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + switch(pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + size = 4; + break; + case GL_SPOT_DIRECTION: + size = 3; + break; + case GL_CONSTANT_ATTENUATION: + case GL_LINEAR_ATTENUATION: + case GL_QUADRATIC_ATTENUATION: + case GL_SPOT_EXPONENT: + case GL_SPOT_CUTOFF: + size = 1; + break; + default: + rb_raise(rb_eArgError, "unknown pname:%d",pname); + break; /* not reached */ + } + glGetLightfv(light,pname,params); + retary = rb_ary_new2(size); + for(i=0;iptr); + RESTORE_PIXEL_STORE_MODE + return pixels; +} + + +static VALUE +gl_GetTexParameterfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + int size; + VALUE retary; + int i; + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + switch(pname) { + case GL_TEXTURE_BORDER_COLOR: + size = 4; + break; + default: + size = 1; + break; + } + glGetTexParameterfv(target,pname,params); + retary = rb_ary_new2(size); + for(i=0;iptr); \ + return Qnil; \ +} + +POINTER_FUNC(Vertex) +POINTER_FUNC(Color) +POINTER_FUNC(TexCoord) + +#undef POINTER_FUNC + +static VALUE +gl_DisableClientState(obj,arg1) +VALUE obj,arg1; +{ + GLenum cap; + cap = (GLenum)NUM2INT(arg1); + glDisableClientState(cap); + return Qnil; +} + +static VALUE +gl_DrawArrays(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum mode; + GLint first; + GLsizei count; + mode = (GLenum)NUM2INT(arg1); + first = (GLint)NUM2INT(arg2); + count = (GLsizei)NUM2UINT(arg3); + glDrawArrays(mode,first,count); + return Qnil; +} + +static VALUE +gl_DrawElements(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum mode; + GLsizei count; + GLenum type; + mode = (GLenum)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + type = (GLenum)NUM2INT(arg3); + Check_Type(arg4, T_STRING); + glDrawElements(mode, count, type, (const GLvoid*)RSTRING(arg4)->ptr); + return Qnil; +} + +static VALUE +gl_EdgeFlagPointer(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLsizei stride; + stride = (GLsizei)NUM2UINT(arg1); + Check_Type(arg2, T_STRING); + rb_str_freeze(arg2); + g_EdgeFlag_ptr = arg2; + glEdgeFlagPointer(stride, (const GLboolean*)RSTRING(arg2)->ptr); + return Qnil; +} + +static VALUE +gl_EnableClientState(obj,arg1) +VALUE obj,arg1; +{ + GLenum cap; + cap = (GLenum)NUM2INT(arg1); + glEnableClientState(cap); + return Qnil; +} + +static VALUE +gl_GetPointerv(obj,arg1) +VALUE obj,arg1; +{ + GLenum pname; + pname = (GLenum)NUM2INT(arg1); + switch (pname) { + case GL_VERTEX_ARRAY_POINTER: + return g_Vertex_ptr; + case GL_NORMAL_ARRAY_POINTER: + return g_Normal_ptr; + case GL_COLOR_ARRAY_POINTER: + return g_Color_ptr; + case GL_INDEX_ARRAY_POINTER: + return g_Index_ptr; + case GL_TEXTURE_COORD_ARRAY_POINTER: + return g_TexCoord_ptr; + case GL_EDGE_FLAG_ARRAY_POINTER: + return g_EdgeFlag_ptr; + case GL_FOG_COORD_ARRAY_POINTER: + return g_FogCoord_ptr; + case GL_SECONDARY_COLOR_ARRAY_POINTER: + return g_SecondaryColor_ptr; + case GL_FEEDBACK_BUFFER_POINTER: + return g_current_feed_buffer; + case GL_SELECTION_BUFFER_POINTER: + return g_current_sel_buffer; + default: + rb_raise(rb_eArgError, "Invalid pname %d",pname); + break; /* not reached */ + } + return Qnil; +} + +static VALUE +gl_IndexPointer(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum type; + GLsizei stride; + type = (GLenum)NUM2INT(arg1); + stride = (GLsizei)NUM2UINT(arg2); + Check_Type(arg3, T_STRING); + rb_str_freeze(arg3); + g_Index_ptr = arg3; + glIndexPointer(type, stride, (const GLvoid*)RSTRING(arg3)->ptr); + return Qnil; +} + +static VALUE +gl_InterleavedArrays(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum format; + GLsizei stride; + format = (GLenum)NUM2INT(arg1); + stride = (GLsizei)NUM2UINT(arg2); + Check_Type(arg3, T_STRING); + glInterleavedArrays(format, stride, (const GLvoid*)RSTRING(arg3)->ptr); + return Qnil; +} + +static VALUE +gl_NormalPointer(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum type; + GLsizei stride; + type = (GLenum)NUM2INT(arg1); + stride = (GLsizei)NUM2UINT(arg2); + Check_Type(arg3, T_STRING); + rb_str_freeze(arg3); + g_Normal_ptr = arg3; + glNormalPointer(type, stride, (const GLvoid*)RSTRING(arg3)->ptr); + return Qnil; +} + +static VALUE +gl_PolygonOffset(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat factor; + GLfloat units; + factor = (GLfloat)NUM2DBL(arg1); + units = (GLfloat)NUM2DBL(arg2); + glPolygonOffset(factor,units); + return Qnil; +} + +static VALUE +gl_CopyTexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLenum target; + GLint level; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLint border; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + internalformat = (GLenum)NUM2INT(arg3); + x = (GLint)NUM2INT(arg4); + y = (GLint)NUM2INT(arg5); + width = (GLsizei)NUM2UINT(arg6); + border = (GLint)NUM2INT(arg7); + glCopyTexImage1D(target,level,internalformat,x,y,width,border); + return Qnil; +} + +static VALUE +gl_CopyTexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8; +{ + GLenum target; + GLint level; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + GLint border; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + internalformat = (GLenum)NUM2INT(arg3); + x = (GLint)NUM2INT(arg4); + y = (GLint)NUM2INT(arg5); + width = (GLsizei)NUM2UINT(arg6); + height = (GLsizei)NUM2UINT(arg7); + border = (GLint)NUM2INT(arg8); + glCopyTexImage2D(target,level,internalformat,x,y,width,height,border); + return Qnil; +} + +static VALUE +gl_CopyTexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint x; + GLint y; + GLsizei width; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + x = (GLint)NUM2INT(arg4); + y = (GLint)NUM2INT(arg5); + width = (GLsizei)NUM2UINT(arg6); + glCopyTexSubImage1D(target,level,xoffset,x,y,width); + return Qnil; +} + +static VALUE +gl_CopyTexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + yoffset = (GLint)NUM2INT(arg4); + x = (GLint)NUM2INT(arg5); + y = (GLint)NUM2INT(arg6); + width = (GLsizei)NUM2UINT(arg7); + height = (GLsizei)NUM2UINT(arg8); + glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height); + return Qnil; +} + +static VALUE +gl_TexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLenum target; + GLint level; + GLint xoffset; + GLsizei width; + GLenum format; + GLenum type; + const char *pixels; + int size; + int type_size; + int format_size; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + format = (GLenum)NUM2INT(arg5); + type = (GLenum)NUM2INT(arg6); + type_size = gltype_size(type); + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + + if (type==GL_BITMAP) + size = format_size*(width/8); + else + size = type_size*format_size*width; + + if (TYPE(arg7) == T_STRING) { + if (RSTRING(arg7)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len); + pixels = RSTRING(arg7)->ptr; + } else if (TYPE(arg7) == T_FIXNUM || TYPE(arg7) == T_BIGNUM) { /* arg7 is offset to unpack buffer */ + pixels = (const char *)NUM2UINT(arg7); + } else { + Check_Type(arg7,T_STRING); /* force exception */ + return Qnil; + } + glTexSubImage1D(target,level,xoffset,width,format,type,pixels); + return Qnil; +} + +static VALUE +gl_TexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLsizei width; + GLsizei height; + GLenum format; + GLenum type; + const char *pixels; + int size; + int type_size; + int format_size; + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + yoffset = (GLint)NUM2INT(arg4); + width = (GLsizei)NUM2UINT(arg5); + height = (GLsizei)NUM2UINT(arg6); + format = (GLenum)NUM2INT(arg7); + type = (GLenum)NUM2INT(arg8); + type_size = gltype_size(type); + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + if (type==GL_BITMAP) + size = format_size*((height*width)/8); + else + size = type_size*format_size*height*width; + if (TYPE(arg9) == T_STRING) { + if (RSTRING(arg9)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len); + pixels = RSTRING(arg9)->ptr; + } else if (TYPE(arg9) == T_FIXNUM || TYPE(arg9) == T_BIGNUM) { /* arg9 is offset to unpack buffer */ + pixels = (const char *)NUM2UINT(arg9); + } else { + Check_Type(arg9,T_STRING); /* force exception */ + return Qnil; + } + glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels); + return Qnil; +} + +static VALUE +gl_AreTexturesResident(obj,arg1) +VALUE obj,arg1; +{ + GLuint *textures; + GLboolean *residences; + GLsizei size; + GLboolean r; + VALUE retary; + int i; + Check_Type(arg1,T_ARRAY); + size = RARRAY(arg1)->len; + textures = ALLOC_N(GLuint,size); + residences = ALLOC_N(GLboolean,size); + ary2cuint(arg1,textures,size); + r = glAreTexturesResident(size,textures,residences); + retary = rb_ary_new2(size); + if (r==GL_TRUE) { /* all are resident */ + for(i=0;ilen; + textures = ALLOC_N(GLuint,n); + ary2cuint(arg1,textures,n); + glDeleteTextures( n, textures); + xfree(textures); + return Qnil; +} + +static VALUE +gl_GenTextures(obj,arg1) +VALUE obj,arg1; +{ + GLsizei n; + GLuint *textures; + RArray *ret; + int i; + n = (GLsizei)NUM2UINT(arg1); + textures = ALLOC_N(GLuint, n); + glGenTextures(n, textures); + ret = RARRAY(rb_ary_new2(n)); + for (i = 0; i < n; i++) + rb_ary_push((VALUE)ret, INT2NUM(textures[i])); + xfree(textures); + return (VALUE)ret; +} + +static VALUE +gl_IsTexture(obj,arg1) +VALUE obj,arg1; +{ + GLuint texture; + GLboolean ret; + texture = (GLuint)NUM2UINT(arg1); + ret = glIsTexture(texture); + return INT2NUM(ret); +} + +static VALUE +gl_PrioritizeTextures(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint *textures; + GLclampf *priorities; + GLsizei size; + Check_Type(arg1,T_ARRAY); + Check_Type(arg2,T_ARRAY); + if ((size = RARRAY(arg1)->len) != RARRAY(arg2)->len) + rb_raise(rb_eArgError, "passed arrays must have the same length"); + textures = ALLOC_N(GLuint,size); + priorities = ALLOC_N(GLclampf,size); + ary2cuint(arg1,textures,size); + ary2cflt(arg2,priorities,size); + glPrioritizeTextures(size,textures,priorities); + xfree(textures); + xfree(priorities); + return Qnil; +} + +static VALUE +gl_Indexub(obj,arg1) +VALUE obj,arg1; +{ + GLubyte c; + c = (GLubyte)NUM2INT(arg1); + glIndexub(c); + return Qnil; +} + +static VALUE +gl_Indexubv(obj,arg1) +VALUE obj,arg1; +{ + GLubyte c[1] = {0}; + Check_Type(arg1,T_ARRAY); + ary2cubyte(arg1,c,1); + glIndexubv(c); + return Qnil; +} + +static VALUE +gl_PopClientAttrib(obj) +VALUE obj; +{ + glPopClientAttrib(); + return Qnil; +} + +static VALUE +gl_PushClientAttrib(obj,arg1) +VALUE obj,arg1; +{ + GLbitfield mask; + mask = (GLbitfield)NUM2UINT(arg1); + glPushClientAttrib(mask); + return Qnil; +} + +/* additional functions */ + +#define GLCOLOR_VFUNC(_type_) \ +static VALUE \ +gl_Color##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[4]; \ + RArray *ary; \ + switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 3: \ + gl_Color3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + case 4: \ + gl_Color4##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", ary->len); \ + } \ + } \ + else \ + Check_Type(args[0],T_ARRAY); /* force exception */ \ + break; \ + case 3: \ + gl_Color3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + case 4: \ + gl_Color4##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "arg length:%d", num); \ + } \ + return Qnil; \ +} + +GLCOLOR_VFUNC(b) +GLCOLOR_VFUNC(d) +GLCOLOR_VFUNC(f) +GLCOLOR_VFUNC(i) +GLCOLOR_VFUNC(s) +GLCOLOR_VFUNC(ub) +GLCOLOR_VFUNC(ui) +GLCOLOR_VFUNC(us) +#undef GLCOLOR_VFUNC + +#define GLNORMAL_VFUNC(_type_) \ +static VALUE \ +gl_Normal##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[3]; \ + RArray* ary; \ + switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 3: \ + gl_Normal3##_type_(obj,ary->ptr[0], ary->ptr[1],ary->ptr[2]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", ary->len); \ + } \ + } \ + else \ + Check_Type(args[0],T_ARRAY); /* force exception */ \ + break; \ + case 3: \ + gl_Normal3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "arg length:%d",num); \ + } \ + return Qnil; \ +} + +GLNORMAL_VFUNC(b) +GLNORMAL_VFUNC(d) +GLNORMAL_VFUNC(f) +GLNORMAL_VFUNC(i) +GLNORMAL_VFUNC(s) +#undef GLNORMAL_VFUNC + +#define GLRASTERPOS_VFUNC(_type_) \ +static VALUE \ +gl_RasterPos##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[4]; \ + RArray *ary; \ + switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 2: \ + gl_RasterPos2##_type_(obj,ary->ptr[0],ary->ptr[1]); \ + break; \ + case 3: \ + gl_RasterPos3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + case 4: \ + gl_RasterPos4##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", num); \ + } \ + } \ + else \ + Check_Type(args[0],T_ARRAY); /* force exception */ \ + break; \ + case 2: \ + gl_RasterPos2##_type_(obj,args[0], args[1]); \ + break; \ + case 3: \ + gl_RasterPos3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + case 4: \ + gl_RasterPos4##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "too many arguments"); \ + } \ + return Qnil; \ +} + +GLRASTERPOS_VFUNC(d) +GLRASTERPOS_VFUNC(f) +GLRASTERPOS_VFUNC(i) +GLRASTERPOS_VFUNC(s) +#undef GLRASTERPOS_VFUNC + +#define GLRECT_VFUNC(_type_) \ +static VALUE \ +gl_Rect##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[4]; \ + RArray *ary,*ary2; \ + switch (num = rb_scan_args(argc, argv, "22", &args[0], &args[1], &args[2], &args[3])) { \ + case 2: \ + if (TYPE(args[0]) == T_ARRAY && TYPE(args[1]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + ary2 = RARRAY(args[1]); \ + switch (ary->len) { \ + case 2: \ + gl_Rect##_type_(obj,ary->ptr[0],ary->ptr[1],ary2->ptr[0],ary2->ptr[1]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", ary->len); \ + } \ + } \ + else \ + Check_Type(args[0],T_ARRAY); /* force exception */ \ + break; \ + case 4: \ + gl_Rect##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "arg length:%d", num); \ + } \ + return Qnil; \ +} + +GLRECT_VFUNC(d) +GLRECT_VFUNC(f) +GLRECT_VFUNC(i) +GLRECT_VFUNC(s) +#undef GLRECT_VFUNC + +#define GLTEXCOORD_VFUNC(_type_) \ +static VALUE \ +gl_TexCoord##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[4]; \ + RArray *ary; \ + switch (num = rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 1: \ + gl_TexCoord1##_type_(obj,ary->ptr[0]); \ + break; \ + case 2: \ + gl_TexCoord2##_type_(obj,ary->ptr[0],ary->ptr[1]); \ + break; \ + case 3: \ + gl_TexCoord3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + case 4: \ + gl_TexCoord4##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", num); \ + } \ + } \ + else \ + gl_TexCoord1##_type_(obj,args[0]); \ + break; \ + case 2: \ + gl_TexCoord2##_type_(obj,args[0], args[1]); \ + break; \ + case 3: \ + gl_TexCoord3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + case 4: \ + gl_TexCoord4##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "too many arguments"); \ + break; \ + } \ + return Qnil; \ +} + +GLTEXCOORD_VFUNC(d) +GLTEXCOORD_VFUNC(f) +GLTEXCOORD_VFUNC(i) +GLTEXCOORD_VFUNC(s) +#undef GLTEXCOORD_VFUNC + +#define GLVERTEX_VFUNC(_type_) \ +static VALUE \ +gl_Vertex##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + VALUE args[4]; \ + RArray *ary; \ + switch (rb_scan_args(argc, argv, "13", &args[0], &args[1], &args[2], &args[3])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 2: \ + gl_Vertex2##_type_(obj,ary->ptr[0],ary->ptr[1]); \ + break; \ + case 3: \ + gl_Vertex3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + case 4: \ + gl_Vertex4##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \ + break; \ + default: \ + rb_raise(rb_eRuntimeError, "glVertex vertex num error!:%d", ary->len); \ + } \ + } \ + else \ + Check_Type(args[0],T_ARRAY); /* force exception */ \ + break; \ + case 2: \ + gl_Vertex2##_type_(obj,args[0], args[1]); \ + break; \ + case 3: \ + gl_Vertex3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + case 4: \ + gl_Vertex4##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "too many arguments"); \ + break; \ + } \ + return Qnil; \ +} + +GLVERTEX_VFUNC(d) +GLVERTEX_VFUNC(f) +GLVERTEX_VFUNC(i) +GLVERTEX_VFUNC(s) +#undef GLVERTEX_VFUNC + +/* */ + +static VALUE +gl_LightModel(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + if (TYPE(arg2) == T_ARRAY) + gl_LightModelfv(obj,arg1,arg2); + else + gl_LightModelf(obj,arg1,arg2); + + return Qnil; +} + +static VALUE +gl_Material(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + if (TYPE(arg3) == T_ARRAY) + gl_Materialfv(obj,arg1,arg2,arg3); + else + gl_Materialf(obj,arg1,arg2,arg3); + + return Qnil; +} + +static VALUE +gl_Fog(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + if (TYPE(arg2) == T_ARRAY) + gl_Fogfv(obj,arg1,arg2); + else + gl_Fogf(obj,arg1,arg2); + + return Qnil; +} + +static VALUE +gl_Light(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + if (TYPE(arg3) == T_ARRAY) + gl_Lightfv(obj,arg1,arg2,arg3); + else + gl_Lightf(obj,arg1,arg2,arg3); + + return Qnil; +} + +static VALUE +gl_TexParameter(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + if (TYPE(arg3) == T_ARRAY) + gl_TexParameterfv(obj,arg1,arg2,arg3); + else + gl_TexParameterf(obj,arg1,arg2,arg3); + + return Qnil; +} + +static VALUE +gl_TexEnv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + if (TYPE(arg3) == T_ARRAY) + gl_TexEnvfv(obj,arg1,arg2,arg3); + else + gl_TexEnvf(obj,arg1,arg2,arg3); + + return Qnil; +} + +static VALUE +gl_TexGen(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + if (TYPE(arg3) == T_ARRAY) + gl_TexGenfv(obj,arg1,arg2,arg3); + else + gl_TexGenf(obj,arg1,arg2,arg3); + + return Qnil; +} + +/* init */ +void gl_init_functions_1_0__1_1(VALUE module) +{ + g_FogCoord_ptr = 0; /* for use in gl-1.4.c */ + g_SecondaryColor_ptr = 0; /* for use in gl-1.4.c */ + + /* OpenGL 1.0 functions */ + rb_define_module_function(module, "glNewList", gl_NewList, 2); + rb_define_module_function(module, "glEndList", gl_EndList, 0); + rb_define_module_function(module, "glCallList", gl_CallList, 1); + rb_define_module_function(module, "glCallLists", gl_CallLists, 1); + rb_define_module_function(module, "glDeleteLists", gl_DeleteLists, 2); + rb_define_module_function(module, "glGenLists", gl_GenLists, 1); + rb_define_module_function(module, "glListBase", gl_ListBase, 1); + rb_define_module_function(module, "glBegin", gl_Begin, 1); + rb_define_module_function(module, "glBitmap", gl_Bitmap, 7); + rb_define_module_function(module, "glColor3b", gl_Color3b, 3); + rb_define_module_function(module, "glColor3d", gl_Color3d, 3); + rb_define_module_function(module, "glColor3f", gl_Color3f, 3); + rb_define_module_function(module, "glColor3i", gl_Color3i, 3); + rb_define_module_function(module, "glColor3s", gl_Color3s, 3); + rb_define_module_function(module, "glColor3ub", gl_Color3ub, 3); + rb_define_module_function(module, "glColor3ui", gl_Color3ui, 3); + rb_define_module_function(module, "glColor3us", gl_Color3us, 3); + rb_define_module_function(module, "glColor4b", gl_Color4b, 4); + rb_define_module_function(module, "glColor4d", gl_Color4d, 4); + rb_define_module_function(module, "glColor4f", gl_Color4f, 4); + rb_define_module_function(module, "glColor4i", gl_Color4i, 4); + rb_define_module_function(module, "glColor4s", gl_Color4s, 4); + rb_define_module_function(module, "glColor4ub", gl_Color4ub, 4); + rb_define_module_function(module, "glColor4ui", gl_Color4ui, 4); + rb_define_module_function(module, "glColor4us", gl_Color4us, 4); + rb_define_module_function(module, "glEdgeFlag", gl_EdgeFlag, 1); + rb_define_module_function(module, "glEdgeFlagv", gl_EdgeFlagv, 1); + rb_define_module_function(module, "glEnd", gl_End, 0); + rb_define_module_function(module, "glIndexd", gl_Indexd, 1); + rb_define_module_function(module, "glIndexdv", gl_Indexdv, 1); + rb_define_module_function(module, "glIndexf", gl_Indexf, 1); + rb_define_module_function(module, "glIndexfv", gl_Indexfv, 1); + rb_define_module_function(module, "glIndexi", gl_Indexi, 1); + rb_define_module_function(module, "glIndexiv", gl_Indexiv, 1); + rb_define_module_function(module, "glIndexs", gl_Indexs, 1); + rb_define_module_function(module, "glIndexsv", gl_Indexsv, 1); + rb_define_module_function(module, "glNormal3b", gl_Normal3b, 3); + rb_define_module_function(module, "glNormal3d", gl_Normal3d, 3); + rb_define_module_function(module, "glNormal3f", gl_Normal3f, 3); + rb_define_module_function(module, "glNormal3i", gl_Normal3i, 3); + rb_define_module_function(module, "glNormal3s", gl_Normal3s, 3); + rb_define_module_function(module, "glRasterPos2d", gl_RasterPos2d, 2); + rb_define_module_function(module, "glRasterPos2f", gl_RasterPos2f, 2); + rb_define_module_function(module, "glRasterPos2i", gl_RasterPos2i, 2); + rb_define_module_function(module, "glRasterPos2s", gl_RasterPos2s, 2); + rb_define_module_function(module, "glRasterPos3d", gl_RasterPos3d, 3); + rb_define_module_function(module, "glRasterPos3f", gl_RasterPos3f, 3); + rb_define_module_function(module, "glRasterPos3i", gl_RasterPos3i, 3); + rb_define_module_function(module, "glRasterPos3s", gl_RasterPos3s, 3); + rb_define_module_function(module, "glRasterPos4d", gl_RasterPos4d, 4); + rb_define_module_function(module, "glRasterPos4f", gl_RasterPos4f, 4); + rb_define_module_function(module, "glRasterPos4i", gl_RasterPos4i, 4); + rb_define_module_function(module, "glRasterPos4s", gl_RasterPos4s, 4); + rb_define_module_function(module, "glRectd", gl_Rectd, 4); + rb_define_module_function(module, "glRectf", gl_Rectf, 4); + rb_define_module_function(module, "glRecti", gl_Recti, 4); + rb_define_module_function(module, "glRects", gl_Rects, 4); + rb_define_module_function(module, "glTexCoord1d", gl_TexCoord1d, 1); + rb_define_module_function(module, "glTexCoord1f", gl_TexCoord1f, 1); + rb_define_module_function(module, "glTexCoord1i", gl_TexCoord1i, 1); + rb_define_module_function(module, "glTexCoord1s", gl_TexCoord1s, 1); + rb_define_module_function(module, "glTexCoord2d", gl_TexCoord2d, 2); + rb_define_module_function(module, "glTexCoord2f", gl_TexCoord2f, 2); + rb_define_module_function(module, "glTexCoord2i", gl_TexCoord2i, 2); + rb_define_module_function(module, "glTexCoord2s", gl_TexCoord2s, 2); + rb_define_module_function(module, "glTexCoord3d", gl_TexCoord3d, 3); + rb_define_module_function(module, "glTexCoord3f", gl_TexCoord3f, 3); + rb_define_module_function(module, "glTexCoord3i", gl_TexCoord3i, 3); + rb_define_module_function(module, "glTexCoord3s", gl_TexCoord3s, 3); + rb_define_module_function(module, "glTexCoord4d", gl_TexCoord4d, 4); + rb_define_module_function(module, "glTexCoord4f", gl_TexCoord4f, 4); + rb_define_module_function(module, "glTexCoord4i", gl_TexCoord4i, 4); + rb_define_module_function(module, "glTexCoord4s", gl_TexCoord4s, 4); + rb_define_module_function(module, "glVertex2d", gl_Vertex2d, 2); + rb_define_module_function(module, "glVertex2f", gl_Vertex2f, 2); + rb_define_module_function(module, "glVertex2i", gl_Vertex2i, 2); + rb_define_module_function(module, "glVertex2s", gl_Vertex2s, 2); + rb_define_module_function(module, "glVertex3d", gl_Vertex3d, 3); + rb_define_module_function(module, "glVertex3f", gl_Vertex3f, 3); + rb_define_module_function(module, "glVertex3i", gl_Vertex3i, 3); + rb_define_module_function(module, "glVertex3s", gl_Vertex3s, 3); + rb_define_module_function(module, "glVertex4d", gl_Vertex4d, 4); + rb_define_module_function(module, "glVertex4f", gl_Vertex4f, 4); + rb_define_module_function(module, "glVertex4i", gl_Vertex4i, 4); + rb_define_module_function(module, "glVertex4s", gl_Vertex4s, 4); + rb_define_module_function(module, "glClipPlane", gl_ClipPlane, 2); + rb_define_module_function(module, "glColorMaterial", gl_ColorMaterial, 2); + rb_define_module_function(module, "glCullFace", gl_CullFace, 1); + rb_define_module_function(module, "glFogf", gl_Fogf, 2); + rb_define_module_function(module, "glFogfv", gl_Fogfv, 2); + rb_define_module_function(module, "glFogi", gl_Fogi, 2); + rb_define_module_function(module, "glFogiv", gl_Fogiv, 2); + rb_define_module_function(module, "glFrontFace", gl_FrontFace, 1); + rb_define_module_function(module, "glHint", gl_Hint, 2); + rb_define_module_function(module, "glLightf", gl_Lightf, 3); + rb_define_module_function(module, "glLightfv", gl_Lightfv, 3); + rb_define_module_function(module, "glLighti", gl_Lighti, 3); + rb_define_module_function(module, "glLightiv", gl_Lightiv, 3); + rb_define_module_function(module, "glLightModelf", gl_LightModelf, 2); + rb_define_module_function(module, "glLightModelfv", gl_LightModelfv, 2); + rb_define_module_function(module, "glLightModeli", gl_LightModeli, 2); + rb_define_module_function(module, "glLightModeliv", gl_LightModeliv, 2); + rb_define_module_function(module, "glLineStipple", gl_LineStipple, 2); + rb_define_module_function(module, "glLineWidth", gl_LineWidth, 1); + rb_define_module_function(module, "glMaterialf", gl_Materialf, 3); + rb_define_module_function(module, "glMaterialfv", gl_Materialfv, 3); + rb_define_module_function(module, "glMateriali", gl_Materiali, 3); + rb_define_module_function(module, "glMaterialiv", gl_Materialiv, 3); + rb_define_module_function(module, "glPointSize", gl_PointSize, 1); + rb_define_module_function(module, "glPolygonMode", gl_PolygonMode, 2); + rb_define_module_function(module, "glPolygonStipple", gl_PolygonStipple, 1); + rb_define_module_function(module, "glScissor", gl_Scissor, 4); + rb_define_module_function(module, "glShadeModel", gl_ShadeModel, 1); + rb_define_module_function(module, "glTexParameterf", gl_TexParameterf, 3); + rb_define_module_function(module, "glTexParameterfv", gl_TexParameterfv, 3); + rb_define_module_function(module, "glTexParameteri", gl_TexParameteri, 3); + rb_define_module_function(module, "glTexParameteriv", gl_TexParameteriv, 3); + rb_define_module_function(module, "glTexImage1D", gl_TexImage1D, 8); + rb_define_module_function(module, "glTexImage2D", gl_TexImage2D, 9); + rb_define_module_function(module, "glTexEnvf", gl_TexEnvf, 3); + rb_define_module_function(module, "glTexEnvfv", gl_TexEnvfv, 3); + rb_define_module_function(module, "glTexEnvi", gl_TexEnvi, 3); + rb_define_module_function(module, "glTexEnviv", gl_TexEnviv, 3); + rb_define_module_function(module, "glTexGend", gl_TexGend, 3); + rb_define_module_function(module, "glTexGendv", gl_TexGendv, 3); + rb_define_module_function(module, "glTexGenf", gl_TexGenf, 3); + rb_define_module_function(module, "glTexGenfv", gl_TexGenfv, 3); + rb_define_module_function(module, "glTexGeni", gl_TexGeni, 3); + rb_define_module_function(module, "glTexGeniv", gl_TexGeniv, 3); + rb_define_module_function(module, "glFeedbackBuffer", gl_FeedbackBuffer, 2); + rb_define_module_function(module, "glSelectBuffer", gl_SelectBuffer, 1); + rb_define_module_function(module, "glRenderMode", gl_RenderMode, 1); + rb_define_module_function(module, "glInitNames", gl_InitNames, 0); + rb_define_module_function(module, "glLoadName", gl_LoadName, 1); + rb_define_module_function(module, "glPassThrough", gl_PassThrough, 1); + rb_define_module_function(module, "glPopName", gl_PopName, 0); + rb_define_module_function(module, "glPushName", gl_PushName, 1); + rb_define_module_function(module, "glDrawBuffer", gl_DrawBuffer, 1); + rb_define_module_function(module, "glClear", gl_Clear, 1); + rb_define_module_function(module, "glClearAccum", gl_ClearAccum, 4); + rb_define_module_function(module, "glClearIndex", gl_ClearIndex, 1); + rb_define_module_function(module, "glClearColor", gl_ClearColor, 4); + rb_define_module_function(module, "glClearStencil", gl_ClearStencil, 1); + rb_define_module_function(module, "glClearDepth", gl_ClearDepth, 1); + rb_define_module_function(module, "glStencilMask", gl_StencilMask, 1); + rb_define_module_function(module, "glColorMask", gl_ColorMask, 4); + rb_define_module_function(module, "glDepthMask", gl_DepthMask, 1); + rb_define_module_function(module, "glIndexMask", gl_IndexMask, 1); + rb_define_module_function(module, "glAccum", gl_Accum, 2); + rb_define_module_function(module, "glDisable", gl_Disable, 1); + rb_define_module_function(module, "glEnable", gl_Enable, 1); + rb_define_module_function(module, "glFinish", gl_Finish, 0); + rb_define_module_function(module, "glFlush", gl_Flush, 0); + rb_define_module_function(module, "glPopAttrib", gl_PopAttrib, 0); + rb_define_module_function(module, "glPushAttrib", gl_PushAttrib, 1); + rb_define_module_function(module, "glMap1d", gl_Map1d, 6); + rb_define_module_function(module, "glMap1f", gl_Map1f, 6); + rb_define_module_function(module, "glMap2d", gl_Map2d, 10); + rb_define_module_function(module, "glMap2f", gl_Map2f, 10); + rb_define_module_function(module, "glMapGrid1d", gl_MapGrid1d, 3); + rb_define_module_function(module, "glMapGrid1f", gl_MapGrid1f, 3); + rb_define_module_function(module, "glMapGrid2d", gl_MapGrid2d, 6); + rb_define_module_function(module, "glMapGrid2f", gl_MapGrid2f, 6); + rb_define_module_function(module, "glEvalCoord1d", gl_EvalCoord1d, 1); + rb_define_module_function(module, "glEvalCoord1dv", gl_EvalCoord1dv, 1); + rb_define_module_function(module, "glEvalCoord1f", gl_EvalCoord1f, 1); + rb_define_module_function(module, "glEvalCoord1fv", gl_EvalCoord1fv, 1); + rb_define_module_function(module, "glEvalCoord2d", gl_EvalCoord2d, 2); + rb_define_module_function(module, "glEvalCoord2dv", gl_EvalCoord2dv, 1); + rb_define_module_function(module, "glEvalCoord2f", gl_EvalCoord2f, 2); + rb_define_module_function(module, "glEvalCoord2fv", gl_EvalCoord2fv, 1); + rb_define_module_function(module, "glEvalMesh1", gl_EvalMesh1, 3); + rb_define_module_function(module, "glEvalPoint1", gl_EvalPoint1, 1); + rb_define_module_function(module, "glEvalMesh2", gl_EvalMesh2, 5); + rb_define_module_function(module, "glEvalPoint2", gl_EvalPoint2, 2); + rb_define_module_function(module, "glAlphaFunc", gl_AlphaFunc, 2); + rb_define_module_function(module, "glBlendFunc", gl_BlendFunc, 2); + rb_define_module_function(module, "glLogicOp", gl_LogicOp, 1); + rb_define_module_function(module, "glStencilFunc", gl_StencilFunc, 3); + rb_define_module_function(module, "glStencilOp", gl_StencilOp, 3); + rb_define_module_function(module, "glDepthFunc", gl_DepthFunc, 1); + rb_define_module_function(module, "glPixelZoom", gl_PixelZoom, 2); + rb_define_module_function(module, "glPixelTransferf", gl_PixelTransferf, 2); + rb_define_module_function(module, "glPixelTransferi", gl_PixelTransferi, 2); + rb_define_module_function(module, "glPixelStoref", gl_PixelStoref, 2); + rb_define_module_function(module, "glPixelStorei", gl_PixelStorei, 2); + rb_define_module_function(module, "glPixelMapfv", gl_PixelMapfv, 2); + rb_define_module_function(module, "glPixelMapuiv", gl_PixelMapuiv, 2); + rb_define_module_function(module, "glPixelMapusv", gl_PixelMapusv, 2); + rb_define_module_function(module, "glReadBuffer", gl_ReadBuffer, 1); + rb_define_module_function(module, "glCopyPixels", gl_CopyPixels, 5); + rb_define_module_function(module, "glReadPixels", gl_ReadPixels, 6); + rb_define_module_function(module, "glDrawPixels", gl_DrawPixels, 5); + rb_define_module_function(module, "glGetBooleanv", gl_GetBooleanv, 1); + rb_define_module_function(module, "glGetClipPlane", gl_GetClipPlane, 1); + rb_define_module_function(module, "glGetDoublev", gl_GetDoublev, 1); + rb_define_module_function(module, "glGetError", gl_GetError, 0); + rb_define_module_function(module, "glGetFloatv", gl_GetFloatv, 1); + rb_define_module_function(module, "glGetIntegerv", gl_GetIntegerv, 1); + rb_define_module_function(module, "glGetLightfv", gl_GetLightfv, 2); + rb_define_module_function(module, "glGetLightiv", gl_GetLightiv, 2); + rb_define_module_function(module, "glGetMapdv", gl_GetMapdv, 2); + rb_define_module_function(module, "glGetMapfv", gl_GetMapfv, 2); + rb_define_module_function(module, "glGetMapiv", gl_GetMapiv, 2); + rb_define_module_function(module, "glGetMaterialfv", gl_GetMaterialfv, 2); + rb_define_module_function(module, "glGetMaterialiv", gl_GetMaterialiv, 2); + rb_define_module_function(module, "glGetPixelMapfv", gl_GetPixelMapfv, 1); + rb_define_module_function(module, "glGetPixelMapuiv", gl_GetPixelMapuiv, 1); + rb_define_module_function(module, "glGetPixelMapusv", gl_GetPixelMapusv, 1); + rb_define_module_function(module, "glGetPolygonStipple", gl_GetPolygonStipple, 0); + rb_define_module_function(module, "glGetString", gl_GetString, 1); + rb_define_module_function(module, "glGetTexEnvfv", gl_GetTexEnvfv, 2); + rb_define_module_function(module, "glGetTexEnviv", gl_GetTexEnviv, 2); + rb_define_module_function(module, "glGetTexGendv", gl_GetTexGendv, 2); + rb_define_module_function(module, "glGetTexGenfv", gl_GetTexGenfv, 2); + rb_define_module_function(module, "glGetTexGeniv", gl_GetTexGeniv, 2); + rb_define_module_function(module, "glGetTexImage", gl_GetTexImage, 4); + rb_define_module_function(module, "glGetTexParameterfv", gl_GetTexParameterfv, 2); + rb_define_module_function(module, "glGetTexParameteriv", gl_GetTexParameteriv, 2); + rb_define_module_function(module, "glGetTexLevelParameterfv", gl_GetTexLevelParameterfv, 3); + rb_define_module_function(module, "glGetTexLevelParameteriv", gl_GetTexLevelParameteriv, 3); + rb_define_module_function(module, "glIsEnabled", gl_IsEnabled, 1); + rb_define_module_function(module, "glIsList", gl_IsList, 1); + rb_define_module_function(module, "glDepthRange", gl_DepthRange, 2); + rb_define_module_function(module, "glFrustum", gl_Frustum, 6); + rb_define_module_function(module, "glLoadIdentity", gl_LoadIdentity, 0); + rb_define_module_function(module, "glLoadMatrixf", gl_LoadMatrixf, 1); + rb_define_module_function(module, "glLoadMatrixd", gl_LoadMatrixd, 1); + rb_define_module_function(module, "glMatrixMode", gl_MatrixMode, 1); + rb_define_module_function(module, "glMultMatrixf", gl_MultMatrixf, 1); + rb_define_module_function(module, "glMultMatrixd", gl_MultMatrixd, 1); + rb_define_module_function(module, "glOrtho", gl_Ortho, 6); + rb_define_module_function(module, "glPopMatrix", gl_PopMatrix, 0); + rb_define_module_function(module, "glPushMatrix", gl_PushMatrix, 0); + rb_define_module_function(module, "glRotated", gl_Rotated, 4); + rb_define_module_function(module, "glRotatef", gl_Rotatef, 4); + rb_define_module_function(module, "glScaled", gl_Scaled, 3); + rb_define_module_function(module, "glScalef", gl_Scalef, 3); + rb_define_module_function(module, "glTranslated", gl_Translated, 3); + rb_define_module_function(module, "glTranslatef", gl_Translatef, 3); + rb_define_module_function(module, "glViewport", gl_Viewport, 4); + + /* OpenGL 1.1 functions */ + rb_define_module_function(module, "glArrayElement", gl_ArrayElement, 1); + rb_define_module_function(module, "glColorPointer", gl_ColorPointer, 4); + rb_define_module_function(module, "glDisableClientState", gl_DisableClientState, 1); + rb_define_module_function(module, "glDrawArrays", gl_DrawArrays, 3); + rb_define_module_function(module, "glDrawElements", gl_DrawElements, 4); + rb_define_module_function(module, "glEdgeFlagPointer", gl_EdgeFlagPointer, 2); + rb_define_module_function(module, "glEnableClientState", gl_EnableClientState, 1); + rb_define_module_function(module, "glGetPointerv", gl_GetPointerv, 1); + rb_define_module_function(module, "glIndexPointer", gl_IndexPointer, 3); + rb_define_module_function(module, "glInterleavedArrays", gl_InterleavedArrays, 3); + rb_define_module_function(module, "glNormalPointer", gl_NormalPointer, 3); + rb_define_module_function(module, "glTexCoordPointer", gl_TexCoordPointer, 4); + rb_define_module_function(module, "glVertexPointer", gl_VertexPointer, 4); + rb_define_module_function(module, "glPolygonOffset", gl_PolygonOffset, 2); + rb_define_module_function(module, "glCopyTexImage1D", gl_CopyTexImage1D, 7); + rb_define_module_function(module, "glCopyTexImage2D", gl_CopyTexImage2D, 8); + rb_define_module_function(module, "glCopyTexSubImage1D", gl_CopyTexSubImage1D, 6); + rb_define_module_function(module, "glCopyTexSubImage2D", gl_CopyTexSubImage2D, 8); + rb_define_module_function(module, "glTexSubImage1D", gl_TexSubImage1D, 7); + rb_define_module_function(module, "glTexSubImage2D", gl_TexSubImage2D, 9); + rb_define_module_function(module, "glAreTexturesResident", gl_AreTexturesResident, 1); + rb_define_module_function(module, "glBindTexture", gl_BindTexture, 2); + rb_define_module_function(module, "glDeleteTextures", gl_DeleteTextures, 1); + rb_define_module_function(module, "glGenTextures", gl_GenTextures, 1); + rb_define_module_function(module, "glIsTexture", gl_IsTexture, 1); + rb_define_module_function(module, "glPrioritizeTextures", gl_PrioritizeTextures, 2); + rb_define_module_function(module, "glIndexub", gl_Indexub, 1); + rb_define_module_function(module, "glIndexubv", gl_Indexubv, 1); + rb_define_module_function(module, "glPopClientAttrib", gl_PopClientAttrib, 0); + rb_define_module_function(module, "glPushClientAttrib", gl_PushClientAttrib, 1); + + /* additional functions */ + rb_define_module_function(module, "glColor", gl_Colordv, -1); + rb_define_module_function(module, "glColor3bv", gl_Colorbv, -1); + rb_define_module_function(module, "glColor3dv", gl_Colordv, -1); + rb_define_module_function(module, "glColor3fv", gl_Colorfv, -1); + rb_define_module_function(module, "glColor3iv", gl_Coloriv, -1); + rb_define_module_function(module, "glColor3sv", gl_Colorsv, -1); + rb_define_module_function(module, "glColor3ubv", gl_Colorubv, -1); + rb_define_module_function(module, "glColor3uiv", gl_Coloruiv, -1); + rb_define_module_function(module, "glColor3usv", gl_Colorusv, -1); + rb_define_module_function(module, "glColor4bv", gl_Colorbv, -1); + rb_define_module_function(module, "glColor4dv", gl_Colordv, -1); + rb_define_module_function(module, "glColor4fv", gl_Colorfv, -1); + rb_define_module_function(module, "glColor4iv", gl_Coloriv, -1); + rb_define_module_function(module, "glColor4sv", gl_Colorsv, -1); + rb_define_module_function(module, "glColor4ubv", gl_Colorubv, -1); + rb_define_module_function(module, "glColor4uiv", gl_Coloruiv, -1); + rb_define_module_function(module, "glColor4usv", gl_Colorusv, -1); + + rb_define_module_function(module, "glNormal", gl_Normaldv, -1); + rb_define_module_function(module, "glNormal3bv", gl_Normalbv, -1); + rb_define_module_function(module, "glNormal3dv", gl_Normaldv, -1); + rb_define_module_function(module, "glNormal3fv", gl_Normalfv, -1); + rb_define_module_function(module, "glNormal3iv", gl_Normaliv, -1); + rb_define_module_function(module, "glNormal3sv", gl_Normalsv, -1); + + rb_define_module_function(module, "glRasterPos", gl_RasterPosdv, -1); + rb_define_module_function(module, "glRasterPos2dv", gl_RasterPosdv, -1); + rb_define_module_function(module, "glRasterPos2fv", gl_RasterPosfv, -1); + rb_define_module_function(module, "glRasterPos2iv", gl_RasterPosiv, -1); + rb_define_module_function(module, "glRasterPos2sv", gl_RasterPossv, -1); + rb_define_module_function(module, "glRasterPos3dv", gl_RasterPosdv, -1); + rb_define_module_function(module, "glRasterPos3fv", gl_RasterPosfv, -1); + rb_define_module_function(module, "glRasterPos3iv", gl_RasterPosiv, -1); + rb_define_module_function(module, "glRasterPos3sv", gl_RasterPossv, -1); + rb_define_module_function(module, "glRasterPos4dv", gl_RasterPosdv, -1); + rb_define_module_function(module, "glRasterPos4fv", gl_RasterPosfv, -1); + rb_define_module_function(module, "glRasterPos4iv", gl_RasterPosiv, -1); + rb_define_module_function(module, "glRasterPos4sv", gl_RasterPossv, -1); + + rb_define_module_function(module, "glRect", gl_Rectdv, -1); + rb_define_module_function(module, "glRectdv", gl_Rectdv, -1); + rb_define_module_function(module, "glRectfv", gl_Rectfv, -1); + rb_define_module_function(module, "glRectiv", gl_Rectiv, -1); + rb_define_module_function(module, "glRectsv", gl_Rectsv, -1); + + rb_define_module_function(module, "glTexCoord", gl_TexCoorddv, -1); + rb_define_module_function(module, "glTexCoord1dv", gl_TexCoorddv, -1); + rb_define_module_function(module, "glTexCoord1fv", gl_TexCoordfv, -1); + rb_define_module_function(module, "glTexCoord1iv", gl_TexCoordiv, -1); + rb_define_module_function(module, "glTexCoord1sv", gl_TexCoordsv, -1); + rb_define_module_function(module, "glTexCoord2dv", gl_TexCoorddv, -1); + rb_define_module_function(module, "glTexCoord2fv", gl_TexCoordfv, -1); + rb_define_module_function(module, "glTexCoord2iv", gl_TexCoordiv, -1); + rb_define_module_function(module, "glTexCoord2sv", gl_TexCoordsv, -1); + rb_define_module_function(module, "glTexCoord3dv", gl_TexCoorddv, -1); + rb_define_module_function(module, "glTexCoord3fv", gl_TexCoordfv, -1); + rb_define_module_function(module, "glTexCoord3iv", gl_TexCoordiv, -1); + rb_define_module_function(module, "glTexCoord3sv", gl_TexCoordsv, -1); + rb_define_module_function(module, "glTexCoord4dv", gl_TexCoorddv, -1); + rb_define_module_function(module, "glTexCoord4fv", gl_TexCoordfv, -1); + rb_define_module_function(module, "glTexCoord4iv", gl_TexCoordiv, -1); + rb_define_module_function(module, "glTexCoord4sv", gl_TexCoordsv, -1); + + rb_define_module_function(module, "glVertex", gl_Vertexdv, -1); + rb_define_module_function(module, "glVertex2dv", gl_Vertexdv, -1); + rb_define_module_function(module, "glVertex2fv", gl_Vertexfv, -1); + rb_define_module_function(module, "glVertex2iv", gl_Vertexiv, -1); + rb_define_module_function(module, "glVertex2sv", gl_Vertexsv, -1); + rb_define_module_function(module, "glVertex3dv", gl_Vertexdv, -1); + rb_define_module_function(module, "glVertex3fv", gl_Vertexfv, -1); + rb_define_module_function(module, "glVertex3iv", gl_Vertexiv, -1); + rb_define_module_function(module, "glVertex3sv", gl_Vertexsv, -1); + rb_define_module_function(module, "glVertex4dv", gl_Vertexdv, -1); + rb_define_module_function(module, "glVertex4fv", gl_Vertexfv, -1); + rb_define_module_function(module, "glVertex4iv", gl_Vertexiv, -1); + rb_define_module_function(module, "glVertex4sv", gl_Vertexsv, -1); + + /* these simply calls normal or vector (*v) function depending on + if array or single value is passed to them */ + rb_define_module_function(module, "glLightModel", gl_LightModel, 2); + rb_define_module_function(module, "glMaterial", gl_Material, 3); + rb_define_module_function(module, "glFog", gl_Fog, 2); + rb_define_module_function(module, "glLight", gl_Light, 3); + rb_define_module_function(module, "glTexParameter", gl_TexParameter, 3); + rb_define_module_function(module, "glTexEnv", gl_TexEnv, 3); + rb_define_module_function(module, "glTexGen", gl_TexGen, 3); + + /* aliases */ + rb_define_module_function(module, "glMultMatrix", gl_MultMatrixd, 1); + rb_define_module_function(module, "glLoadMatrix", gl_LoadMatrixd, 1); + rb_define_module_function(module, "glRotate", gl_Rotated, 4); + rb_define_module_function(module, "glScale", gl_Scaled, 3); + rb_define_module_function(module, "glTranslate", gl_Translated, 3); + + rb_define_module_function(module, "glPixelStore", gl_PixelStoref, 2); + rb_define_module_function(module, "glPixelTransfer", gl_PixelTransferf, 2); + rb_define_module_function(module, "glIndex", gl_Indexi, 1); + rb_define_module_function(module, "glGetMaterial", gl_GetMaterialfv, 2); + rb_define_module_function(module, "glGetDouble", gl_GetDoublev, 1); + + rb_global_variable(&g_current_sel_buffer); + rb_global_variable(&g_current_feed_buffer); + rb_global_variable(&g_Vertex_ptr); + rb_global_variable(&g_Normal_ptr); + rb_global_variable(&g_Color_ptr); + rb_global_variable(&g_Index_ptr); + rb_global_variable(&g_TexCoord_ptr); + rb_global_variable(&g_EdgeFlag_ptr); + rb_global_variable(&g_FogCoord_ptr); + rb_global_variable(&g_SecondaryColor_ptr); +} diff --git a/ruby/RubyOpenGL/gl/gl-1.2.c b/ruby/RubyOpenGL/gl/gl-1.2.c new file mode 100644 index 00000000..40959526 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-1.2.c @@ -0,0 +1,1061 @@ +/* + * Copyright (C) 1999 - 2005 Yoshi + * Copyright (C) 2006 John M. Gabriele + * Copyright (C) 2007 Jan Dvorak + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +/* OpenGL 1.2 functions */ + +static void (APIENTRY * fptr_glBlendColor)(GLclampf,GLclampf,GLclampf,GLclampf); +static VALUE +gl_BlendColor(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLclampf red; + GLclampf green; + GLclampf blue; + GLclampf alpha; + LOAD_GL_FUNC(glBlendColor) + red = (GLclampf)NUM2DBL(arg1); + green = (GLclampf)NUM2DBL(arg2); + blue = (GLclampf)NUM2DBL(arg3); + alpha = (GLclampf)NUM2DBL(arg4); + fptr_glBlendColor(red,green,blue,alpha); + return Qnil; +} + +static void (APIENTRY * fptr_glBlendEquation)(GLenum); +static VALUE +gl_BlendEquation(obj,arg1) +VALUE obj,arg1; +{ + GLenum mode; + LOAD_GL_FUNC(glBlendEquation) + mode = (GLenum)NUM2INT(arg1); + fptr_glBlendEquation(mode); + return Qnil; +} + +static void (APIENTRY * fptr_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,GLvoid*); +static VALUE +gl_DrawRangeElements(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum mode; + GLuint start; + GLuint end; + GLsizei count; + GLenum type; + LOAD_GL_FUNC(glDrawRangeElements) + mode = (GLenum)NUM2INT(arg1); + start = (GLuint)NUM2UINT(arg2); + end = (GLuint)NUM2UINT(arg3); + count = (GLsizei)NUM2UINT(arg4); + type = (GLenum)NUM2INT(arg5); + Check_Type(arg6, T_STRING); + fptr_glDrawRangeElements(mode, start, end, count, type, RSTRING(arg6)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glColorTable)(GLenum,GLenum,GLsizei,GLenum,GLenum,GLvoid*); +static VALUE +gl_ColorTable(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLenum internalformat; + GLsizei width; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLsizei size; + LOAD_GL_FUNC(glColorTable) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + format = (GLenum)NUM2INT(arg4); + type = (GLenum)NUM2INT(arg5); + Check_Type(arg6,T_STRING); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + size = format_size*type_size*width; + if (RSTRING(arg6)->len < size) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len); + fptr_glColorTable(target,internalformat,width,format,type,RSTRING(arg6)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glColorTableParameterfv)(GLenum,GLenum,const GLfloat*); +static VALUE +gl_ColorTableParameterfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + LOAD_GL_FUNC(glColorTableParameterfv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + fptr_glColorTableParameterfv(target,pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glColorTableParameteriv)(GLenum,GLenum,const GLint*); +static VALUE +gl_ColorTableParameteriv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint params[4] = {0,0,0,0}; + LOAD_GL_FUNC(glColorTableParameteriv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + fptr_glColorTableParameteriv(target,pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glCopyColorTable)(GLenum,GLenum,GLint,GLint,GLsizei); +static VALUE +gl_CopyColorTable(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + LOAD_GL_FUNC(glCopyColorTable) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + x = (GLenum)NUM2INT(arg3); + y = (GLenum)NUM2INT(arg4); + width = (GLenum)NUM2INT(arg5); + fptr_glCopyColorTable(target,internalformat,x,y,width); + return Qnil; +} + +static void (APIENTRY * fptr_glGetColorTableParameterfv)(GLenum,GLenum,GLfloat *); +static VALUE +gl_GetColorTableParameterfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + GLsizei size; + VALUE retary; + int i; + LOAD_GL_FUNC(glGetColorTableParameterfv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + switch (pname) { + case GL_COLOR_TABLE_SCALE: + case GL_COLOR_TABLE_BIAS: + size = 4; + break; + default: + size = 1; + break; + } + fptr_glGetColorTableParameterfv(target,pname,params); + retary = rb_ary_new2(size); + for(i=0;iptr); + RESTORE_PIXEL_STORE_MODE + return data; +} + +static void (APIENTRY * fptr_glColorSubTable)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *data); +static VALUE +gl_ColorSubTable(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLsizei start; + GLsizei count; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLsizei size; + LOAD_GL_FUNC(glColorSubTable) + target = (GLenum)NUM2INT(arg1); + start = (GLsizei)NUM2UINT(arg2); + count = (GLsizei)NUM2UINT(arg3); + format = (GLenum)NUM2INT(arg4); + type = (GLenum)NUM2INT(arg5); + Check_Type(arg6,T_STRING); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + size = format_size*type_size*count; + if (RSTRING(arg6)->len < size) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len); + fptr_glColorSubTable(target,start,count,format,type,RSTRING(arg6)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glCopyColorSubTable)(GLenum,GLsizei,GLint,GLint,GLsizei); +static VALUE +gl_CopyColorSubTable(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLsizei start; + GLint x; + GLint y; + GLsizei width; + LOAD_GL_FUNC(glCopyColorSubTable) + target = (GLenum)NUM2INT(arg1); + start = (GLsizei)NUM2UINT(arg2); + x = (GLint)NUM2INT(arg3); + y = (GLint)NUM2INT(arg4); + width = (GLsizei)NUM2UINT(arg5); + fptr_glCopyColorSubTable(target,start,x,y,width); + return Qnil; +} + +static void (APIENTRY * fptr_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid *); +static VALUE +gl_ConvolutionFilter1D(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLenum internalformat; + GLsizei width; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLsizei size; + LOAD_GL_FUNC(glConvolutionFilter1D) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + format = (GLenum)NUM2INT(arg4); + type = (GLenum)NUM2INT(arg5); + Check_Type(arg6,T_STRING); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + if (type==GL_BITMAP) + size = format_size*(width/8); + else + size = type_size*format_size*width; + if (RSTRING(arg6)->len < size) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg6)->len); + fptr_glConvolutionFilter1D(target,internalformat,width,format,type,RSTRING(arg6)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *); +static VALUE +gl_ConvolutionFilter2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLenum target; + GLenum internalformat; + GLsizei width; + GLsizei height; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLsizei size; + LOAD_GL_FUNC(glConvolutionFilter2D) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + height = (GLsizei)NUM2UINT(arg4); + format = (GLenum)NUM2INT(arg5); + type = (GLenum)NUM2INT(arg6); + Check_Type(arg7,T_STRING); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + if (type==GL_BITMAP) + size = format_size*((width*height)/8); + else + size = type_size*format_size*width*height; + if (RSTRING(arg7)->len < size) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len); + fptr_glConvolutionFilter2D(target,internalformat,width,height,format,type,RSTRING(arg7)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glConvolutionParameterf)(GLenum,GLenum,GLfloat); +static VALUE +gl_ConvolutionParameterf(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat params; + LOAD_GL_FUNC(glConvolutionParameterf) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + params = (GLfloat)NUM2INT(arg3); + fptr_glConvolutionParameterf(target,pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glConvolutionParameterfv)(GLenum,GLenum,const GLfloat *); +static VALUE +gl_ConvolutionParameterfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + LOAD_GL_FUNC(glConvolutionParameterfv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cflt(arg3,params,4); + fptr_glConvolutionParameterfv(target,pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glConvolutionParameteri)(GLenum,GLenum,GLint); +static VALUE +gl_ConvolutionParameteri(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint params; + LOAD_GL_FUNC(glConvolutionParameteri) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + params = (GLint)NUM2INT(arg3); + fptr_glConvolutionParameteri(target,pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glConvolutionParameteriv)(GLenum,GLenum,const GLint *); +static VALUE +gl_ConvolutionParameteriv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint params[4] = {0,0,0,0}; + LOAD_GL_FUNC(glConvolutionParameteriv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary2cint(arg3,params,4); + fptr_glConvolutionParameteriv(target,pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glCopyConvolutionFilter1D)(GLenum,GLenum,GLint,GLint,GLsizei); +static VALUE +gl_CopyConvolutionFilter1D(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + LOAD_GL_FUNC(glCopyConvolutionFilter1D) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + x = (GLint)NUM2INT(arg3); + y = (GLint)NUM2INT(arg4); + width = (GLsizei)NUM2UINT(arg5); + fptr_glCopyConvolutionFilter1D(target,internalformat,x,y,width); + return Qnil; +} + +static void (APIENTRY * fptr_glCopyConvolutionFilter2D)(GLenum,GLenum,GLint,GLint,GLsizei,GLsizei); +static VALUE +gl_CopyConvolutionFilter2D(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLenum target; + GLenum internalformat; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + LOAD_GL_FUNC(glCopyConvolutionFilter2D) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + x = (GLint)NUM2INT(arg3); + y = (GLint)NUM2INT(arg4); + width = (GLsizei)NUM2UINT(arg5); + height = (GLsizei)NUM2UINT(arg6); + fptr_glCopyConvolutionFilter2D(target,internalformat,x,y,width,height); + return Qnil; +} + +static void (APIENTRY * fptr_glGetConvolutionParameterfv)(GLenum,GLenum,GLfloat *); +static VALUE +gl_GetConvolutionParameterfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum pname; + GLfloat params[4] = {0.0,0.0,0.0,0.0}; + GLsizei size; + int i; + VALUE retary; + LOAD_GL_FUNC(glGetConvolutionParameterfv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + switch(pname) { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + size = 4; + break; + default: + size = 1; + break; + } + fptr_glGetConvolutionParameterfv(target,pname,params); + retary = rb_ary_new2(size); + for(i=0;iptr); + RESTORE_PIXEL_STORE_MODE + return data; +} + +static void (APIENTRY * fptr_glGetSeparableFilter)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*); +static VALUE +gl_GetSeparableFilter(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLint size_row = 0; + GLint size_column = 0; + VALUE data_row; + VALUE data_column; + VALUE retary; + LOAD_GL_FUNC(glGetSeparableFilter) + LOAD_GL_FUNC(glGetConvolutionParameteriv) + target = (GLenum)NUM2INT(arg1); + format = (GLenum)NUM2INT(arg2); + type = (GLenum)NUM2INT(arg3); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_WIDTH,&size_row); + fptr_glGetConvolutionParameteriv(target,GL_CONVOLUTION_HEIGHT,&size_column); + if (type==GL_BITMAP) { + size_row = (size_row/8)*format_size; + size_column = (size_column/8)*format_size; + } else { + size_row *= type_size*format_size; + size_column *= type_size*format_size; + } + data_row = allocate_buffer_with_string(size_row); + data_column = allocate_buffer_with_string(size_column); + FORCE_PIXEL_STORE_MODE + fptr_glGetSeparableFilter(target,format,type,(GLvoid*)RSTRING(data_row)->ptr,(GLvoid*)RSTRING(data_column)->ptr,0); + RESTORE_PIXEL_STORE_MODE + retary = rb_ary_new2(2); + rb_ary_push(retary, data_row); + rb_ary_push(retary, data_column); + return retary; +} + +static void (APIENTRY * fptr_glSeparableFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid *,const GLvoid *); +static VALUE +gl_SeparableFilter2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8; +{ + GLenum target; + GLenum internalformat; + GLsizei width; + GLsizei height; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLsizei size_row; + GLsizei size_column; + LOAD_GL_FUNC(glSeparableFilter2D) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + width = (GLsizei)NUM2UINT(arg3); + height = (GLsizei)NUM2UINT(arg4); + format = (GLenum)NUM2INT(arg5); + type = (GLenum)NUM2INT(arg6); + Check_Type(arg7,T_STRING); + Check_Type(arg8,T_STRING); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + if (type==GL_BITMAP) { + size_row = format_size*(width/8); + size_column = format_size*(height/8); + } else { + size_row = type_size*format_size*width; + size_column = type_size*format_size*height; + } + if (RSTRING(arg7)->len < size_row) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg7)->len); + if (RSTRING(arg8)->len < size_column) + rb_raise(rb_eArgError, "string length:%d", RSTRING(arg8)->len); + + fptr_glSeparableFilter2D(target,internalformat,width,height,format,type,RSTRING(arg7)->ptr,RSTRING(arg8)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glGetHistogramParameterfv)(GLenum,GLenum,GLfloat *); +static VALUE +gl_GetHistogramParameterfv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLfloat params = 0.0; + VALUE retary; + LOAD_GL_FUNC(glGetHistogramParameterfv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetHistogramParameterfv(target,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary, rb_float_new(params)); + return retary; +} + +static void (APIENTRY * fptr_glGetHistogramParameteriv)(GLenum,GLenum,GLint *); +static VALUE +gl_GetHistogramParameteriv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum pname; + GLint params = 0; + VALUE retary; + LOAD_GL_FUNC(glGetHistogramParameteriv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetHistogramParameteriv(target,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary, INT2NUM(params)); + return retary; +} + +static void (APIENTRY * fptr_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); +static VALUE +gl_GetHistogram(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLboolean reset; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLint size = 0; + VALUE data; + LOAD_GL_FUNC(glGetHistogram) + LOAD_GL_FUNC(glGetHistogramParameteriv) + target = (GLenum)NUM2INT(arg1); + reset = (GLboolean)NUM2INT(arg2); + format = (GLenum)NUM2INT(arg3); + type = (GLenum)NUM2INT(arg4); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + fptr_glGetHistogramParameteriv(target,GL_HISTOGRAM_WIDTH,&size); + if (type==GL_BITMAP) + size = (size/8)*format_size; + else + size = size*type_size*format_size; + data = allocate_buffer_with_string(size); + FORCE_PIXEL_STORE_MODE + fptr_glGetHistogram(target,reset,format,type,(GLvoid*)RSTRING(data)->ptr); + RESTORE_PIXEL_STORE_MODE + return data; +} + +static void (APIENTRY * fptr_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,GLvoid *); +static VALUE +gl_GetMinmax(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLboolean reset; + GLenum format; + GLenum type; + GLsizei format_size; + GLsizei type_size; + GLint size; + VALUE data; + LOAD_GL_FUNC(glGetMinmax) + target = (GLenum)NUM2INT(arg1); + reset = (GLboolean)NUM2INT(arg2); + format = (GLenum)NUM2INT(arg3); + type = (GLenum)NUM2INT(arg4); + format_size = glformat_size(format); + type_size = gltype_size(type); + if (type_size == -1 || format_size == -1) + rb_raise(rb_eTypeError, "type/format mismatch"); + if (type==GL_BITMAP) + size = format_size*(2/8); + else + size = type_size*format_size*2; + data = allocate_buffer_with_string(size); + FORCE_PIXEL_STORE_MODE + fptr_glGetMinmax(target,reset,format,type,(GLvoid*)RSTRING(data)->ptr); + RESTORE_PIXEL_STORE_MODE + return data; +} + +static void (APIENTRY * fptr_glGetMinmaxParameterfv)(GLenum,GLenum,GLfloat *); +static VALUE +gl_GetMinmaxParameterfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum pname; + GLfloat params = 0.0; + VALUE retary; + LOAD_GL_FUNC(glGetMinmaxParameterfv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetMinmaxParameterfv(target,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary, rb_float_new(params)); + return retary; +} + +static void (APIENTRY * fptr_glGetMinmaxParameteriv)(GLenum,GLenum,GLint *); +static VALUE +gl_GetMinmaxParameteriv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum pname; + GLint params = 0; + VALUE retary; + LOAD_GL_FUNC(glGetMinmaxParameteriv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetMinmaxParameteriv(target,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary, INT2NUM(params)); + return retary; +} + +static void (APIENTRY * fptr_glHistogram)(GLenum,GLsizei,GLenum,GLboolean); +static VALUE +gl_Histogram(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLsizei width; + GLenum internalformat; + GLboolean sink; + LOAD_GL_FUNC(glHistogram) + target = (GLenum)NUM2INT(arg1); + width = (GLsizei)NUM2UINT(arg2); + internalformat = (GLenum)NUM2INT(arg3); + sink = (GLboolean)NUM2INT(arg4); + fptr_glHistogram(target,width,internalformat,sink); + return Qnil; +} + +static void (APIENTRY * fptr_glMinmax)(GLenum,GLenum,GLboolean); +static VALUE +gl_Minmax(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLenum internalformat; + GLboolean sink; + LOAD_GL_FUNC(glMinmax) + target = (GLenum)NUM2INT(arg1); + internalformat = (GLenum)NUM2INT(arg2); + sink = (GLboolean)NUM2INT(arg3); + fptr_glMinmax(target,internalformat,sink); + return Qnil; +} + +static void (APIENTRY * fptr_glResetHistogram)(GLenum); +static VALUE +gl_ResetHistogram(obj,arg1) +VALUE obj,arg1; +{ + GLenum target; + LOAD_GL_FUNC(glResetHistogram) + target = (GLenum)NUM2INT(arg1); + fptr_glResetHistogram(target); + return Qnil; +} + +static void (APIENTRY * fptr_glResetMinmax)(GLenum); +static VALUE +gl_ResetMinmax(obj,arg1) +VALUE obj,arg1; +{ + GLenum target; + LOAD_GL_FUNC(glResetMinmax) + target = (GLenum)NUM2INT(arg1); + fptr_glResetMinmax(target); + return Qnil; +} + +static void (APIENTRY * fptr_glTexImage3D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); +static VALUE +gl_TexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10; +{ + GLenum target; + GLint level; + GLint internalFormat; + GLsizei width; + GLsizei height; + GLsizei depth; + GLint border; + GLenum format; + GLenum type; + const char *pixels; + int size; + int type_size; + int format_size; + LOAD_GL_FUNC(glTexImage3D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + internalFormat = (GLint)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + height = (GLsizei)NUM2UINT(arg5); + depth = (GLsizei)NUM2UINT(arg6); + border = (GLint)NUM2INT(arg7); + format = (GLenum)NUM2INT(arg8); + type = (GLenum)NUM2INT(arg9); + Check_Type(arg10, T_STRING); + type_size = gltype_size(type); + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + if (type==GL_BITMAP) + size = format_size*((height*width*depth)/8); + else + size = type_size*format_size*height*width*depth; + + if (target == GL_PROXY_TEXTURE_3D || NIL_P(arg10)) { /* proxy texture, no data read */ + pixels = NULL; + } else { + if (TYPE(arg10) == T_FIXNUM || TYPE(arg10) == T_BIGNUM) { /* arg10 is offset to unpack buffer */ + pixels = (const char *)NUM2UINT(arg10); + } else if (TYPE(arg10) == T_STRING) { /* image data */ + if (RSTRING(arg10)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg10)->len); + pixels = RSTRING(arg10)->ptr; + } else { + Check_Type(arg10,T_STRING); /* force exception */ + return Qnil; + } + } + fptr_glTexImage3D( target, level, internalFormat, width, height, + depth, border, format, type,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); +static VALUE +gl_TexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) +VALUE arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint zoffset; + GLsizei width; + GLsizei height; + GLsizei depth; + GLenum format; + GLenum type; + const char *pixels; + int size; + int type_size; + int format_size; + LOAD_GL_FUNC(glTexSubImage3D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + yoffset = (GLint)NUM2INT(arg4); + zoffset = (GLint)NUM2INT(arg5); + width = (GLsizei)NUM2UINT(arg6); + height = (GLsizei)NUM2UINT(arg7); + depth = (GLsizei)NUM2UINT(arg8); + format = (GLenum)NUM2INT(arg9); + type = (GLenum)NUM2INT(arg10); + Check_Type(arg11, T_STRING); + type_size = gltype_size(type); + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + if (type==GL_BITMAP) + size = format_size*((height*width*depth)/8); + else + size = type_size*format_size*height*width*depth; + + if (TYPE(arg11) == T_STRING) { + if (RSTRING(arg11)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len); + pixels = RSTRING(arg11)->ptr; + } else if (TYPE(arg11) == T_FIXNUM || TYPE(arg11) == T_BIGNUM) { /* arg11 is offset to unpack buffer */ + pixels = (const char *)NUM2UINT(arg11); + } else { + Check_Type(arg11,T_STRING); /* force exception */ + return Qnil; + } + + fptr_glTexSubImage3D( target, level, xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glCopyTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei); +static VALUE +gl_CopyTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint zoffset; + GLint x; + GLint y; + GLsizei width; + GLsizei height; + LOAD_GL_FUNC(glCopyTexSubImage3D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + yoffset = (GLint)NUM2INT(arg4); + zoffset = (GLint)NUM2INT(arg5); + x = (GLint)NUM2INT(arg6); + y = (GLint)NUM2INT(arg7); + width = (GLsizei)NUM2UINT(arg8); + height = (GLsizei)NUM2UINT(arg9); + fptr_glCopyTexSubImage3D( target, level, + xoffset, yoffset, zoffset, + x, y, width, height ); + return Qnil; +} + +void gl_init_functions_1_2(VALUE module) +{ + rb_define_module_function(module, "glBlendColor", gl_BlendColor, 4); + rb_define_module_function(module, "glBlendEquation", gl_BlendEquation, 1); + rb_define_module_function(module, "glDrawRangeElements", gl_DrawRangeElements, 6); + rb_define_module_function(module, "glColorTable", gl_ColorTable, 6); + rb_define_module_function(module, "glColorTableParameterfv", gl_ColorTableParameterfv, 3); + rb_define_module_function(module, "glColorTableParameteriv", gl_ColorTableParameteriv, 3); + rb_define_module_function(module, "glCopyColorTable", gl_CopyColorTable, 5); + rb_define_module_function(module, "glGetColorTable", gl_GetColorTable, 3); + rb_define_module_function(module, "glGetColorTableParameterfv", gl_GetColorTableParameterfv, 2); + rb_define_module_function(module, "glGetColorTableParameteriv", gl_GetColorTableParameteriv, 2); + rb_define_module_function(module, "glColorSubTable", gl_ColorSubTable, 6); + rb_define_module_function(module, "glCopyColorSubTable", gl_CopyColorSubTable, 5); + rb_define_module_function(module, "glConvolutionFilter1D", gl_ConvolutionFilter1D, 6); + rb_define_module_function(module, "glConvolutionFilter2D", gl_ConvolutionFilter2D, 7); + rb_define_module_function(module, "glConvolutionParameterf", gl_ConvolutionParameterf, 3); + rb_define_module_function(module, "glConvolutionParameterfv", gl_ConvolutionParameterfv, 3); + rb_define_module_function(module, "glConvolutionParameteri", gl_ConvolutionParameteri, 3); + rb_define_module_function(module, "glConvolutionParameteriv", gl_ConvolutionParameteriv, 3); + rb_define_module_function(module, "glCopyConvolutionFilter1D", gl_CopyConvolutionFilter1D, 5); + rb_define_module_function(module, "glCopyConvolutionFilter2D", gl_CopyConvolutionFilter2D, 6); + rb_define_module_function(module, "glGetConvolutionFilter", gl_GetConvolutionFilter, 3); + rb_define_module_function(module, "glGetConvolutionParameterfv", gl_GetConvolutionParameterfv, 2); + rb_define_module_function(module, "glGetConvolutionParameteriv", gl_GetConvolutionParameteriv, 2); + rb_define_module_function(module, "glGetSeparableFilter", gl_GetSeparableFilter, 3); + rb_define_module_function(module, "glSeparableFilter2D", gl_SeparableFilter2D, 8); + rb_define_module_function(module, "glGetHistogram", gl_GetHistogram, 4); + rb_define_module_function(module, "glGetHistogramParameterfv", gl_GetHistogramParameterfv, 2); + rb_define_module_function(module, "glGetHistogramParameteriv", gl_GetHistogramParameteriv, 2); + rb_define_module_function(module, "glGetMinmax", gl_GetMinmax, 4); + rb_define_module_function(module, "glGetMinmaxParameterfv", gl_GetMinmaxParameterfv, 2); + rb_define_module_function(module, "glGetMinmaxParameteriv", gl_GetMinmaxParameteriv, 2); + rb_define_module_function(module, "glHistogram", gl_Histogram, 4); + rb_define_module_function(module, "glMinmax", gl_Minmax, 3); + rb_define_module_function(module, "glResetHistogram", gl_ResetHistogram, 1); + rb_define_module_function(module, "glResetMinmax", gl_ResetMinmax, 1); + rb_define_module_function(module, "glTexImage3D", gl_TexImage3D, 10); + rb_define_module_function(module, "glTexSubImage3D", gl_TexSubImage3D, 11); + rb_define_module_function(module, "glCopyTexSubImage3D", gl_CopyTexSubImage3D, 9); +} diff --git a/ruby/RubyOpenGL/gl/gl-1.3.c b/ruby/RubyOpenGL/gl/gl-1.3.c new file mode 100644 index 00000000..54398441 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-1.3.c @@ -0,0 +1,725 @@ +/* + * Copyright (C) 2007 Jan Dvorak + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +/* OpenGL 1.3 functions */ + +static void (APIENTRY * fptr_glActiveTexture)(GLenum); +static VALUE +gl_ActiveTexture(obj,arg1) +VALUE obj,arg1; +{ + GLenum texture; + LOAD_GL_FUNC(glActiveTexture) + texture = (GLenum)NUM2INT(arg1); + fptr_glActiveTexture(texture); + return Qnil; +} + +static void (APIENTRY * fptr_glClientActiveTexture)(GLenum); +static VALUE +gl_ClientActiveTexture(obj,arg1) +VALUE obj,arg1; +{ + GLenum texture; + LOAD_GL_FUNC(glClientActiveTexture) + texture = (GLenum)NUM2INT(arg1); + fptr_glClientActiveTexture(texture); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord1d)(GLenum,GLdouble); +static VALUE +gl_MultiTexCoord1d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLdouble s; + LOAD_GL_FUNC(glMultiTexCoord1d) + target = (GLenum)NUM2INT(arg1); + s = (GLdouble)NUM2DBL(arg2); + fptr_glMultiTexCoord1d(target,s); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord1f)(GLenum,GLfloat); +static VALUE +gl_MultiTexCoord1f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLfloat s; + LOAD_GL_FUNC(glMultiTexCoord1f) + target = (GLenum)NUM2INT(arg1); + s = (GLfloat)NUM2DBL(arg2); + fptr_glMultiTexCoord1f(target,s); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord1i)(GLenum,GLint); +static VALUE +gl_MultiTexCoord1i(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLint s; + LOAD_GL_FUNC(glMultiTexCoord1i) + target = (GLenum)NUM2INT(arg1); + s = (GLint)NUM2INT(arg2); + fptr_glMultiTexCoord1i(target,s); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord1s)(GLenum,GLshort); +static VALUE +gl_MultiTexCoord1s(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLshort s; + LOAD_GL_FUNC(glMultiTexCoord1s) + target = (GLenum)NUM2INT(arg1); + s = (GLshort)NUM2INT(arg2); + fptr_glMultiTexCoord1s(target,s); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord2d)(GLenum,GLdouble,GLdouble); +static VALUE +gl_MultiTexCoord2d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLdouble s; + GLdouble t; + LOAD_GL_FUNC(glMultiTexCoord2d) + target = (GLenum)NUM2INT(arg1); + s = (GLdouble)NUM2DBL(arg2); + t = (GLdouble)NUM2DBL(arg3); + fptr_glMultiTexCoord2d(target,s,t); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord2f)(GLenum,GLfloat,GLfloat); +static VALUE +gl_MultiTexCoord2f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLfloat s; + GLfloat t; + LOAD_GL_FUNC(glMultiTexCoord2f) + target = (GLenum)NUM2INT(arg1); + s = (GLfloat)NUM2DBL(arg2); + t = (GLfloat)NUM2DBL(arg3); + fptr_glMultiTexCoord2f(target,s,t); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord2i)(GLenum,GLint,GLint); +static VALUE +gl_MultiTexCoord2i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLint s; + GLint t; + LOAD_GL_FUNC(glMultiTexCoord2i) + target = (GLenum)NUM2INT(arg1); + s = (GLint)NUM2INT(arg2); + t = (GLint)NUM2INT(arg3); + fptr_glMultiTexCoord2i(target,s,t); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord2s)(GLenum,GLshort,GLshort); +static VALUE +gl_MultiTexCoord2s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLshort s; + GLshort t; + LOAD_GL_FUNC(glMultiTexCoord2s) + target = (GLenum)NUM2INT(arg1); + s = (GLshort)NUM2INT(arg2); + t = (GLshort)NUM2INT(arg3); + fptr_glMultiTexCoord2s(target,s,t); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord3d)(GLenum,GLdouble,GLdouble,GLdouble); +static VALUE +gl_MultiTexCoord3d(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLdouble s; + GLdouble t; + GLdouble r; + LOAD_GL_FUNC(glMultiTexCoord3d) + target = (GLenum)NUM2INT(arg1); + s = (GLdouble)NUM2DBL(arg2); + t = (GLdouble)NUM2DBL(arg3); + r = (GLdouble)NUM2DBL(arg4); + fptr_glMultiTexCoord3d(target,s,t,r); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord3f)(GLenum,GLfloat,GLfloat,GLfloat); +static VALUE +gl_MultiTexCoord3f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLfloat s; + GLfloat t; + GLfloat r; + LOAD_GL_FUNC(glMultiTexCoord3f) + target = (GLenum)NUM2INT(arg1); + s = (GLfloat)NUM2DBL(arg2); + t = (GLfloat)NUM2DBL(arg3); + r = (GLfloat)NUM2DBL(arg4); + fptr_glMultiTexCoord3f(target,s,t,r); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord3i)(GLenum,GLint,GLint,GLint); +static VALUE +gl_MultiTexCoord3i(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLint s; + GLint t; + GLint r; + LOAD_GL_FUNC(glMultiTexCoord3i) + target = (GLenum)NUM2INT(arg1); + s = (GLint)NUM2INT(arg2); + t = (GLint)NUM2INT(arg3); + r = (GLint)NUM2INT(arg4); + fptr_glMultiTexCoord3i(target,s,t,r); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord3s)(GLenum,GLshort,GLshort,GLshort); +static VALUE +gl_MultiTexCoord3s(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLshort s; + GLshort t; + GLshort r; + LOAD_GL_FUNC(glMultiTexCoord3s) + target = (GLenum)NUM2INT(arg1); + s = (GLshort)NUM2INT(arg2); + t = (GLshort)NUM2INT(arg3); + r = (GLshort)NUM2INT(arg4); + fptr_glMultiTexCoord3s(target,s,t,r); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord4d)(GLenum,GLdouble,GLdouble,GLdouble,GLdouble); +static VALUE +gl_MultiTexCoord4d(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLdouble s; + GLdouble t; + GLdouble r; + GLdouble q; + LOAD_GL_FUNC(glMultiTexCoord4d) + target = (GLenum)NUM2INT(arg1); + s = (GLdouble)NUM2DBL(arg2); + t = (GLdouble)NUM2DBL(arg3); + r = (GLdouble)NUM2DBL(arg4); + q = (GLdouble)NUM2DBL(arg5); + fptr_glMultiTexCoord4d(target,s,t,r,q); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord4f)(GLenum,GLfloat,GLfloat,GLfloat,GLfloat); +static VALUE +gl_MultiTexCoord4f(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLfloat s; + GLfloat t; + GLfloat r; + GLfloat q; + LOAD_GL_FUNC(glMultiTexCoord4f) + target = (GLenum)NUM2INT(arg1); + s = (GLfloat)NUM2DBL(arg2); + t = (GLfloat)NUM2DBL(arg3); + r = (GLfloat)NUM2DBL(arg4); + q = (GLfloat)NUM2DBL(arg5); + fptr_glMultiTexCoord4f(target,s,t,r,q); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord4i)(GLenum,GLint,GLint,GLint,GLint); +static VALUE +gl_MultiTexCoord4i(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLint s; + GLint t; + GLint r; + GLint q; + LOAD_GL_FUNC(glMultiTexCoord4i) + target = (GLenum)NUM2INT(arg1); + s = (GLint)NUM2INT(arg2); + t = (GLint)NUM2INT(arg3); + r = (GLint)NUM2INT(arg4); + q = (GLint)NUM2INT(arg5); + fptr_glMultiTexCoord4i(target,s,t,r,q); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiTexCoord4s)(GLenum,GLshort,GLshort,GLshort,GLshort); +static VALUE +gl_MultiTexCoord4s(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLenum target; + GLshort s; + GLshort t; + GLshort r; + GLshort q; + LOAD_GL_FUNC(glMultiTexCoord4s) + target = (GLenum)NUM2INT(arg1); + s = (GLshort)NUM2INT(arg2); + t = (GLshort)NUM2INT(arg3); + r = (GLshort)NUM2INT(arg4); + q = (GLshort)NUM2INT(arg5); + fptr_glMultiTexCoord4s(target,s,t,r,q); + return Qnil; +} + +#define GLMULTITEXCOORD_VFUNC(_type_) \ +static VALUE \ +gl_MultiTexCoord##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[5]; \ + RArray *ary; \ + switch (num = rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3],&args[4])) { \ + case 2: \ + if (TYPE(args[1]) == T_ARRAY) { \ + ary = RARRAY(args[1]); \ + switch (ary->len) { \ + case 1: \ + gl_MultiTexCoord1##_type_(obj,args[0],ary->ptr[0]); \ + break; \ + case 2: \ + gl_MultiTexCoord2##_type_(obj,args[0],ary->ptr[0],ary->ptr[1]); \ + break; \ + case 3: \ + gl_MultiTexCoord3##_type_(obj,args[0],ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + case 4: \ + gl_MultiTexCoord4##_type_(obj,args[0],ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", num); \ + } \ + } \ + else { \ + gl_MultiTexCoord1##_type_(obj,args[0], args[1]); \ + break; \ + } \ + break; \ + case 3: \ + gl_MultiTexCoord2##_type_(obj,args[0], args[1], args[2]); \ + break; \ + case 4: \ + gl_MultiTexCoord3##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + case 5: \ + gl_MultiTexCoord4##_type_(obj,args[0], args[1], args[2], args[3], args[4]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "too many arguments"); \ + break; \ + } \ + return Qnil; \ +} + +GLMULTITEXCOORD_VFUNC(d) +GLMULTITEXCOORD_VFUNC(f) +GLMULTITEXCOORD_VFUNC(i) +GLMULTITEXCOORD_VFUNC(s) +#undef GLTEXCOORD_VFUNC + + +static void (APIENTRY * fptr_glLoadTransposeMatrixf)(const GLfloat[]); +static VALUE +gl_LoadTransposeMatrixf(obj,arg1) +VALUE obj,arg1; +{ + GLfloat m[4*4]; + LOAD_GL_FUNC(glLoadTransposeMatrixf) + ary2cmat4x4flt(arg1, m); + fptr_glLoadTransposeMatrixf(m); + return Qnil; +} + +static void (APIENTRY * fptr_glLoadTransposeMatrixd)(const GLdouble[]); +static VALUE +gl_LoadTransposeMatrixd(obj,arg1) +VALUE obj,arg1; +{ + GLdouble m[4*4]; + LOAD_GL_FUNC(glLoadTransposeMatrixd) + ary2cmat4x4dbl(arg1, m); + fptr_glLoadTransposeMatrixd(m); + return Qnil; +} + +static void (APIENTRY * fptr_glMultTransposeMatrixf)(const GLfloat[]); +static VALUE +gl_MultTransposeMatrixf(obj,arg1) +VALUE obj,arg1; +{ + GLfloat m[4*4]; + LOAD_GL_FUNC(glMultTransposeMatrixf) + ary2cmat4x4flt(arg1, m); + fptr_glMultTransposeMatrixf(m); + return Qnil; +} + +static void (APIENTRY * fptr_glMultTransposeMatrixd)(const GLdouble[]); +static VALUE +gl_MultTransposeMatrixd(obj,arg1) +VALUE obj,arg1; +{ + GLdouble m[4*4]; + LOAD_GL_FUNC(glMultTransposeMatrixd) + ary2cmat4x4dbl(arg1, m); + fptr_glMultTransposeMatrixd(m); + return Qnil; +} + +static void (APIENTRY * fptr_glSampleCoverage)(GLclampf,GLboolean); +static VALUE +gl_SampleCoverage(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLclampf value; + GLboolean invert; + LOAD_GL_FUNC(glSampleCoverage) + value = (GLclampf)NUM2DBL(arg1); + invert = (GLboolean)NUM2INT(arg2); + fptr_glSampleCoverage(value,invert); + return Qnil; +} + +static void (APIENTRY * fptr_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,GLvoid*); +static VALUE +gl_CompressedTexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9; +{ + GLenum target; + GLint level; + GLenum internalformat; + GLsizei width; + GLsizei height; + GLsizei depth; + GLint border; + GLsizei imagesize; + GLvoid *pixels; + LOAD_GL_FUNC(glCompressedTexImage3D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + internalformat = (GLenum)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + height = (GLsizei)NUM2UINT(arg5); + depth = (GLsizei)NUM2UINT(arg6); + border = (GLint)NUM2INT(arg7); + imagesize = (GLsizei)NUM2UINT(arg8); + if (TYPE(arg9) == T_STRING) { + if (RSTRING(arg9)->len < imagesize) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len); + pixels = RSTRING(arg9)->ptr; + } else if (NIL_P(arg9)) { + pixels = NULL; + } else { + Check_Type(arg9,T_STRING); /* force exception */ + return Qnil; + } + fptr_glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imagesize,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,GLvoid*); +static VALUE +gl_CompressedTexImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8; +{ + GLenum target; + GLint level; + GLenum internalformat; + GLsizei width; + GLsizei height; + GLint border; + GLsizei imagesize; + GLvoid *pixels; + LOAD_GL_FUNC(glCompressedTexImage2D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + internalformat = (GLenum)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + height = (GLsizei)NUM2UINT(arg5); + border = (GLint)NUM2INT(arg6); + imagesize = (GLsizei)NUM2UINT(arg7); + if (TYPE(arg8) == T_STRING) { + if (RSTRING(arg8)->len < imagesize) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg8)->len); + pixels = RSTRING(arg8)->ptr; + } else if (NIL_P(arg8)) { + pixels = NULL; + } else { + Check_Type(arg8,T_STRING); /* force exception */ + return Qnil; + } + fptr_glCompressedTexImage2D(target,level,internalformat,width,height,border,imagesize,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,GLvoid*); +static VALUE +gl_CompressedTexImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLenum target; + GLint level; + GLenum internalformat; + GLsizei width; + GLint border; + GLsizei imagesize; + GLvoid *pixels; + LOAD_GL_FUNC(glCompressedTexImage1D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + internalformat = (GLenum)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + border = (GLint)NUM2INT(arg5); + imagesize = (GLsizei)NUM2UINT(arg6); + if (TYPE(arg7) == T_STRING) { + if (RSTRING(arg7)->len < imagesize) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len); + pixels = RSTRING(arg7)->ptr; + } else if (NIL_P(arg7)) { + pixels = NULL; + } else { + Check_Type(arg7,T_STRING); /* force exception */ + return Qnil; + } + fptr_glCompressedTexImage1D(target,level,internalformat,width,border,imagesize,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*); +static VALUE +gl_CompressedTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLint zoffset; + GLsizei width; + GLsizei height; + GLsizei depth; + GLenum format; + GLsizei imagesize; + GLvoid *pixels; + LOAD_GL_FUNC(glCompressedTexSubImage3D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + yoffset = (GLint)NUM2INT(arg4); + zoffset = (GLint)NUM2INT(arg5); + width = (GLsizei)NUM2UINT(arg6); + height = (GLsizei)NUM2UINT(arg7); + depth = (GLsizei)NUM2UINT(arg8); + format = (GLenum)NUM2INT(arg9); + imagesize = (GLsizei)NUM2UINT(arg10); + if (TYPE(arg11) == T_STRING) { + if (RSTRING(arg11)->len < imagesize) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len); + pixels = RSTRING(arg11)->ptr; + } else { + Check_Type(arg11,T_STRING); /* force exception */ + return Qnil; + } + fptr_glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imagesize,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,GLvoid*); +static VALUE +gl_CompressedTexSubImage2D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9; +{ + GLenum target; + GLint level; + GLint xoffset; + GLint yoffset; + GLsizei width; + GLsizei height; + GLenum format; + GLsizei imagesize; + GLvoid *pixels; + LOAD_GL_FUNC(glCompressedTexSubImage2D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + yoffset = (GLint)NUM2INT(arg4); + width = (GLsizei)NUM2UINT(arg5); + height = (GLsizei)NUM2UINT(arg6); + format = (GLenum)NUM2INT(arg7); + imagesize = (GLsizei)NUM2UINT(arg8); + if (TYPE(arg9) == T_STRING) { + if (RSTRING(arg9)->len < imagesize) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg9)->len); + pixels = RSTRING(arg9)->ptr; + } else { + Check_Type(arg9,T_STRING); /* force exception */ + return Qnil; + } + fptr_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imagesize,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,GLvoid*); +static VALUE +gl_CompressedTexSubImage1D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLenum target; + GLint level; + GLint xoffset; + GLsizei width; + GLenum format; + GLsizei imagesize; + GLvoid *pixels; + LOAD_GL_FUNC(glCompressedTexSubImage1D) + target = (GLenum)NUM2INT(arg1); + level = (GLint)NUM2INT(arg2); + xoffset = (GLint)NUM2INT(arg3); + width = (GLsizei)NUM2UINT(arg4); + format = (GLenum)NUM2INT(arg5); + imagesize = (GLsizei)NUM2UINT(arg6); + if (TYPE(arg7) == T_STRING) { + if (RSTRING(arg7)->len < imagesize) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len); + pixels = RSTRING(arg7)->ptr; + } else { + Check_Type(arg7,T_STRING); /* force exception */ + return Qnil; + } + fptr_glCompressedTexSubImage1D(target,level,xoffset,width,format,imagesize,pixels); + return Qnil; +} + +static void (APIENTRY * fptr_glGetCompressedTexImage)(GLenum,GLint,GLvoid*); +static VALUE +gl_GetCompressedTexImage(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLint lod; + GLsizei size = 0; + VALUE data; + LOAD_GL_FUNC(glGetCompressedTexImage) + target = (GLenum)NUM2INT(arg1); + lod = (GLenum)NUM2INT(arg2); + glGetTexLevelParameteriv(target,lod,GL_TEXTURE_COMPRESSED_IMAGE_SIZE,&size); /* 1.0 function */ + data = allocate_buffer_with_string(size); + fptr_glGetCompressedTexImage(target,lod,(GLvoid*)RSTRING(data)->ptr); + return data; +} + +void gl_init_functions_1_3(VALUE module) +{ + rb_define_module_function(module, "glActiveTexture", gl_ActiveTexture, 1); + rb_define_module_function(module, "glClientActiveTexture", gl_ClientActiveTexture, 1); + rb_define_module_function(module, "glMultiTexCoord1d", gl_MultiTexCoord1d, 2); + rb_define_module_function(module, "glMultiTexCoord1f", gl_MultiTexCoord1f, 2); + rb_define_module_function(module, "glMultiTexCoord1i", gl_MultiTexCoord1i, 2); + rb_define_module_function(module, "glMultiTexCoord1s", gl_MultiTexCoord1s, 2); + rb_define_module_function(module, "glMultiTexCoord2d", gl_MultiTexCoord2d, 3); + rb_define_module_function(module, "glMultiTexCoord2f", gl_MultiTexCoord2f, 3); + rb_define_module_function(module, "glMultiTexCoord2i", gl_MultiTexCoord2i, 3); + rb_define_module_function(module, "glMultiTexCoord2s", gl_MultiTexCoord2s, 3); + rb_define_module_function(module, "glMultiTexCoord3d", gl_MultiTexCoord3d, 4); + rb_define_module_function(module, "glMultiTexCoord3f", gl_MultiTexCoord3f, 4); + rb_define_module_function(module, "glMultiTexCoord3i", gl_MultiTexCoord3i, 4); + rb_define_module_function(module, "glMultiTexCoord3s", gl_MultiTexCoord3s, 4); + rb_define_module_function(module, "glMultiTexCoord4d", gl_MultiTexCoord4d, 5); + rb_define_module_function(module, "glMultiTexCoord4f", gl_MultiTexCoord4f, 5); + rb_define_module_function(module, "glMultiTexCoord4i", gl_MultiTexCoord4i, 5); + rb_define_module_function(module, "glMultiTexCoord4s", gl_MultiTexCoord4s, 5); + rb_define_module_function(module, "glLoadTransposeMatrixf", gl_LoadTransposeMatrixf, 1); + rb_define_module_function(module, "glLoadTransposeMatrixd", gl_LoadTransposeMatrixd, 1); + rb_define_module_function(module, "glMultTransposeMatrixf", gl_MultTransposeMatrixf, 1); + rb_define_module_function(module, "glMultTransposeMatrixd", gl_MultTransposeMatrixd, 1); + rb_define_module_function(module, "glSampleCoverage", gl_SampleCoverage, 2); + rb_define_module_function(module, "glCompressedTexImage3D", gl_CompressedTexImage3D, 9); + rb_define_module_function(module, "glCompressedTexImage2D", gl_CompressedTexImage2D, 8); + rb_define_module_function(module, "glCompressedTexImage1D", gl_CompressedTexImage1D, 7); + rb_define_module_function(module, "glCompressedTexSubImage3D", gl_CompressedTexSubImage3D, 11); + rb_define_module_function(module, "glCompressedTexSubImage2D", gl_CompressedTexSubImage2D, 9); + rb_define_module_function(module, "glCompressedTexSubImage1D", gl_CompressedTexSubImage1D, 7); + rb_define_module_function(module, "glGetCompressedTexImage", gl_GetCompressedTexImage, 2); + + /* Additional functions */ + + rb_define_module_function(module, "glMultiTexCoord", gl_MultiTexCoorddv, -1); + rb_define_module_function(module, "glMultiTexCoord1dv", gl_MultiTexCoorddv, -1); + rb_define_module_function(module, "glMultiTexCoord1fv", gl_MultiTexCoordfv, -1); + rb_define_module_function(module, "glMultiTexCoord1iv", gl_MultiTexCoordiv, -1); + rb_define_module_function(module, "glMultiTexCoord1sv", gl_MultiTexCoordsv, -1); + rb_define_module_function(module, "glMultiTexCoord2dv", gl_MultiTexCoorddv, -1); + rb_define_module_function(module, "glMultiTexCoord2fv", gl_MultiTexCoordfv, -1); + rb_define_module_function(module, "glMultiTexCoord2iv", gl_MultiTexCoordiv, -1); + rb_define_module_function(module, "glMultiTexCoord2sv", gl_MultiTexCoordsv, -1); + rb_define_module_function(module, "glMultiTexCoord3dv", gl_MultiTexCoorddv, -1); + rb_define_module_function(module, "glMultiTexCoord3fv", gl_MultiTexCoordfv, -1); + rb_define_module_function(module, "glMultiTexCoord3iv", gl_MultiTexCoordiv, -1); + rb_define_module_function(module, "glMultiTexCoord3sv", gl_MultiTexCoordsv, -1); + rb_define_module_function(module, "glMultiTexCoord4dv", gl_MultiTexCoorddv, -1); + rb_define_module_function(module, "glMultiTexCoord4fv", gl_MultiTexCoordfv, -1); + rb_define_module_function(module, "glMultiTexCoord4iv", gl_MultiTexCoordiv, -1); + rb_define_module_function(module, "glMultiTexCoord4sv", gl_MultiTexCoordsv, -1); +} diff --git a/ruby/RubyOpenGL/gl/gl-1.4.c b/ruby/RubyOpenGL/gl/gl-1.4.c new file mode 100644 index 00000000..4741a7c9 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-1.4.c @@ -0,0 +1,647 @@ +/* + * Copyright (C) 2007 Jan Dvorak + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +/* OpenGL 1.4 functions */ + +static void (APIENTRY * fptr_glBlendFuncSeparate)(GLenum,GLenum,GLenum,GLenum); +static VALUE +gl_BlendFuncSeparate(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum srcRGB; + GLenum dstRGB; + GLenum srcAlpha; + GLenum dstAlpha; + LOAD_GL_FUNC(glBlendFuncSeparate) + srcRGB = (GLenum)NUM2INT(arg1); + dstRGB = (GLenum)NUM2INT(arg2); + srcAlpha = (GLenum)NUM2INT(arg3); + dstAlpha = (GLenum)NUM2INT(arg4); + fptr_glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha); + return Qnil; +} + +static void (APIENTRY * fptr_glFogCoordf)(GLfloat); +static VALUE +gl_FogCoordf(obj,arg1) +VALUE obj,arg1; +{ + GLfloat coord; + LOAD_GL_FUNC(glFogCoordf) + coord=(GLfloat)NUM2DBL(arg1); + fptr_glFogCoordf(coord); + return Qnil; +} + +static void (APIENTRY * fptr_glFogCoordfv)(GLfloat *); +static VALUE +gl_FogCoordfv(obj,arg1) +VALUE obj,arg1; +{ + GLfloat coord; + LOAD_GL_FUNC(glFogCoordfv) + Check_Type(arg1,T_ARRAY); + ary2cflt(arg1,&coord,1); + fptr_glFogCoordfv(&coord); + return Qnil; +} + +static void (APIENTRY * fptr_glFogCoordd)(GLdouble); +static VALUE +gl_FogCoordd(obj,arg1) +VALUE obj,arg1; +{ + GLdouble coord; + LOAD_GL_FUNC(glFogCoordd) + coord=(GLdouble)NUM2DBL(arg1); + fptr_glFogCoordd(coord); + return Qnil; +} + +static void (APIENTRY * fptr_glFogCoorddv)(GLdouble *); +static VALUE +gl_FogCoorddv(obj,arg1) +VALUE obj,arg1; +{ + GLdouble coord; + LOAD_GL_FUNC(glFogCoorddv) + Check_Type(arg1,T_ARRAY); + ary2cdbl(arg1,&coord,1); + fptr_glFogCoorddv(&coord); + return Qnil; +} + +extern VALUE g_FogCoord_ptr; +static void (APIENTRY * fptr_glFogCoordPointer)(GLenum,GLsizei,const GLvoid *); +static VALUE +gl_FogCoordPointer(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum type; + GLsizei stride; + LOAD_GL_FUNC(glFogCoordPointer) + type = (GLenum)NUM2INT(arg1); + stride = (GLsizei)NUM2UINT(arg2); + Check_Type(arg3, T_STRING); + rb_str_freeze(arg3); + g_FogCoord_ptr = arg3; + fptr_glFogCoordPointer(type, stride, (const GLvoid*)RSTRING(arg3)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiDrawArrays)(GLenum,GLint*,GLsizei*,GLsizei); +static VALUE +gl_MultiDrawArrays(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + /* TODO: check ary1,ary2 if len < primcount then raise */ + /* stringy ? */ + GLenum mode; + GLsizei primcount; + GLint *ary1; + GLsizei *ary2; + LOAD_GL_FUNC(glMultiDrawArrays) + mode = (GLenum)NUM2INT(arg1); + primcount = (GLsizei)NUM2UINT(arg4); + ary1 = ALLOC_N(GLint,primcount); + ary2 = ALLOC_N(GLsizei,primcount); + ary2cint(arg2,ary1,primcount); + ary2cint(arg3,ary2,primcount); + fptr_glMultiDrawArrays(mode,ary1,ary2,primcount); + xfree(ary1); + xfree(ary2); + return Qnil; +} + +static void (APIENTRY * fptr_glMultiDrawElements)(GLenum,const GLsizei *,GLenum,GLvoid **,GLsizei); +static VALUE +gl_MultiDrawElements(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum mode; + GLenum type; + GLsizei *counts; + GLvoid **indices; + GLint size; + RArray *ary; + int i; + LOAD_GL_FUNC(glMultiDrawElements) + mode = (GLenum)NUM2INT(arg1); + type = (GLenum)NUM2INT(arg2); + Check_Type(arg3,T_ARRAY); + ary = RARRAY(arg3); + size = ary->len; + counts = ALLOC_N(GLsizei,size); + indices = ALLOC_N(GLvoid*,size); + for (i=0;iptr[i])->ptr; + counts[i] = RSTRING(ary->ptr[i])->len; + } + fptr_glMultiDrawElements(mode,counts,type,indices,size); + xfree(counts); + xfree(indices); + return Qnil; +} + +static void (APIENTRY * fptr_glPointParameterf)(GLenum,GLfloat); +static VALUE +gl_PointParameterf(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat param; + LOAD_GL_FUNC(glPointParameterf) + pname = (GLenum)NUM2INT(arg1); + param = (GLfloat)NUM2INT(arg2); + fptr_glPointParameterf(pname,param); + return Qnil; +} + +static void (APIENTRY * fptr_glPointParameterfv)(GLenum,GLfloat *); +static VALUE +gl_PointParameterfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLfloat params[3] = {0.0,0.0,0.0}; + GLint size; + LOAD_GL_FUNC(glPointParameterfv) + pname = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + if (pname==GL_POINT_DISTANCE_ATTENUATION) + size = 3; + else + size = 1; + ary2cflt(arg2,params,size); + fptr_glPointParameterfv(pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glPointParameteri)(GLenum,GLint); +static VALUE +gl_PointParameteri(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint param; + LOAD_GL_FUNC(glPointParameteri) + pname = (GLenum)NUM2INT(arg1); + param = (GLint)NUM2INT(arg2); + fptr_glPointParameteri(pname,param); + return Qnil; +} + +static void (APIENTRY * fptr_glPointParameteriv)(GLenum,GLint *); +static VALUE +gl_PointParameteriv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum pname; + GLint params[3] = {0.0,0.0,0.0}; + GLint size; + LOAD_GL_FUNC(glPointParameteriv) + pname = (GLenum)NUM2INT(arg1); + Check_Type(arg2,T_ARRAY); + if (pname==GL_POINT_DISTANCE_ATTENUATION) + size = 3; + else + size = 1; + ary2cint(arg2,params,size); + fptr_glPointParameteriv(pname,params); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3b)(GLbyte,GLbyte,GLbyte); +static VALUE +gl_SecondaryColor3b(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLbyte red; + GLbyte green; + GLbyte blue; + LOAD_GL_FUNC(glSecondaryColor3b) + red = (GLbyte)NUM2INT(arg1); + green = (GLbyte)NUM2INT(arg2); + blue = (GLbyte)NUM2INT(arg3); + fptr_glSecondaryColor3b(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3d)(GLdouble,GLdouble,GLdouble); +static VALUE +gl_SecondaryColor3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble red; + GLdouble green; + GLdouble blue; + LOAD_GL_FUNC(glSecondaryColor3d) + red = (GLdouble)NUM2DBL(arg1); + green = (GLdouble)NUM2DBL(arg2); + blue = (GLdouble)NUM2DBL(arg3); + fptr_glSecondaryColor3d(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3f)(GLfloat,GLfloat,GLfloat); +static VALUE +gl_SecondaryColor3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat red; + GLfloat green; + GLfloat blue; + LOAD_GL_FUNC(glSecondaryColor3f) + red = (GLfloat)NUM2DBL(arg1); + green = (GLfloat)NUM2DBL(arg2); + blue = (GLfloat)NUM2DBL(arg3); + fptr_glSecondaryColor3f(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3i)(GLint,GLint,GLint); +static VALUE +gl_SecondaryColor3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint red; + GLint green; + GLint blue; + LOAD_GL_FUNC(glSecondaryColor3i) + red = (GLint)NUM2INT(arg1); + green = (GLint)NUM2INT(arg2); + blue = (GLint)NUM2INT(arg3); + fptr_glSecondaryColor3i(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3s)(GLshort,GLshort,GLshort); +static VALUE +gl_SecondaryColor3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort red; + GLshort green; + GLshort blue; + LOAD_GL_FUNC(glSecondaryColor3s) + red = (GLshort)NUM2INT(arg1); + green = (GLshort)NUM2INT(arg2); + blue = (GLshort)NUM2INT(arg3); + fptr_glSecondaryColor3s(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3ub)(GLubyte,GLubyte,GLubyte); +static VALUE +gl_SecondaryColor3ub(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLubyte red; + GLubyte green; + GLubyte blue; + LOAD_GL_FUNC(glSecondaryColor3ub) + red = (GLubyte)NUM2INT(arg1); + green = (GLubyte)NUM2INT(arg2); + blue = (GLubyte)NUM2INT(arg3); + fptr_glSecondaryColor3ub(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3ui)(GLuint,GLuint,GLuint); +static VALUE +gl_SecondaryColor3ui(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint red; + GLuint green; + GLuint blue; + LOAD_GL_FUNC(glSecondaryColor3ui) + red = (GLuint)NUM2UINT(arg1); + green = (GLuint)NUM2UINT(arg2); + blue = (GLuint)NUM2UINT(arg3); + fptr_glSecondaryColor3ui(red,green,blue); + return Qnil; +} + +static void (APIENTRY * fptr_glSecondaryColor3us)(GLushort,GLushort,GLushort); +static VALUE +gl_SecondaryColor3us(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLushort red; + GLushort green; + GLushort blue; + LOAD_GL_FUNC(glSecondaryColor3us) + red = (GLushort)NUM2INT(arg1); + green = (GLushort)NUM2INT(arg2); + blue = (GLushort)NUM2INT(arg3); + fptr_glSecondaryColor3us(red,green,blue); + return Qnil; +} + +#define GLSECONDARYCOLOR_VFUNC(_type_) \ +static VALUE \ +gl_SecondaryColor##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[3]; \ + RArray *ary; \ + switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 3: \ + gl_SecondaryColor3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", num); \ + } \ + } \ + else \ + rb_raise(rb_eArgError, "array length:%d", num); \ + break; \ + case 3: \ + gl_SecondaryColor3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "too many arguments"); \ + break; \ + } \ + return Qnil; \ +} + +GLSECONDARYCOLOR_VFUNC(b) +GLSECONDARYCOLOR_VFUNC(d) +GLSECONDARYCOLOR_VFUNC(f) +GLSECONDARYCOLOR_VFUNC(i) +GLSECONDARYCOLOR_VFUNC(s) +GLSECONDARYCOLOR_VFUNC(ui) +GLSECONDARYCOLOR_VFUNC(ub) +GLSECONDARYCOLOR_VFUNC(us) +#undef GLSECONDARYCOLOR_VFUNC + +extern VALUE g_SecondaryColor_ptr; +static void (APIENTRY * fptr_glSecondaryColorPointer)(GLint,GLenum,GLsizei,const GLvoid *); +static VALUE +gl_SecondaryColorPointer(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint size; + GLenum type; + GLsizei stride; + LOAD_GL_FUNC(glSecondaryColorPointer) + size = (GLint)NUM2INT(arg1); + type = (GLenum)NUM2INT(arg2); + stride = (GLsizei)NUM2UINT(arg3); + Check_Type(arg4, T_STRING); + rb_str_freeze(arg4); + g_SecondaryColor_ptr = arg4; + fptr_glSecondaryColorPointer(size,type, stride, (const GLvoid*)RSTRING(arg4)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos2d)(GLdouble,GLdouble); +static VALUE +gl_WindowPos2d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLdouble x; + GLdouble y; + LOAD_GL_FUNC(glWindowPos2d) + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + fptr_glWindowPos2d(x,y); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos2f)(GLfloat,GLfloat); +static VALUE +gl_WindowPos2f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLfloat x; + GLfloat y; + LOAD_GL_FUNC(glWindowPos2f) + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + fptr_glWindowPos2f(x,y); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos2i)(GLint,GLint); +static VALUE +gl_WindowPos2i(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint x; + GLint y; + LOAD_GL_FUNC(glWindowPos2i) + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + fptr_glWindowPos2i(x,y); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos2s)(GLshort,GLshort); +static VALUE +gl_WindowPos2s(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLshort x; + GLshort y; + LOAD_GL_FUNC(glWindowPos2s) + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + fptr_glWindowPos2s(x,y); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos3d)(GLdouble,GLdouble,GLdouble); +static VALUE +gl_WindowPos3d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLdouble x; + GLdouble y; + GLdouble z; + LOAD_GL_FUNC(glWindowPos3d) + x = (GLdouble)NUM2DBL(arg1); + y = (GLdouble)NUM2DBL(arg2); + z = (GLdouble)NUM2DBL(arg3); + fptr_glWindowPos3d(x,y,z); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos3f)(GLfloat,GLfloat,GLfloat); +static VALUE +gl_WindowPos3f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLfloat x; + GLfloat y; + GLfloat z; + LOAD_GL_FUNC(glWindowPos3f) + x = (GLfloat)NUM2DBL(arg1); + y = (GLfloat)NUM2DBL(arg2); + z = (GLfloat)NUM2DBL(arg3); + fptr_glWindowPos3f(x,y,z); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos3i)(GLint,GLint,GLint); +static VALUE +gl_WindowPos3i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint x; + GLint y; + GLint z; + LOAD_GL_FUNC(glWindowPos3i) + x = (GLint)NUM2INT(arg1); + y = (GLint)NUM2INT(arg2); + z = (GLint)NUM2INT(arg3); + fptr_glWindowPos3i(x,y,z); + return Qnil; +} + +static void (APIENTRY * fptr_glWindowPos3s)(GLshort,GLshort,GLshort); +static VALUE +gl_WindowPos3s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLshort x; + GLshort y; + GLshort z; + LOAD_GL_FUNC(glWindowPos3s) + x = (GLshort)NUM2INT(arg1); + y = (GLshort)NUM2INT(arg2); + z = (GLshort)NUM2INT(arg3); + fptr_glWindowPos3s(x,y,z); + return Qnil; +} + +#define GLWINDOWPOS_VFUNC(_type_) \ +static VALUE \ +gl_WindowPos##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + int num; \ + VALUE args[3]; \ + RArray *ary; \ + switch (num = rb_scan_args(argc, argv, "12", &args[0], &args[1], &args[2])) { \ + case 1: \ + if (TYPE(args[0]) == T_ARRAY) { \ + ary = RARRAY(args[0]); \ + switch (ary->len) { \ + case 2: \ + gl_WindowPos2##_type_(obj,ary->ptr[0],ary->ptr[1]); \ + break; \ + case 3: \ + gl_WindowPos3##_type_(obj,ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "array length:%d", num); \ + } \ + } \ + else \ + rb_raise(rb_eArgError, "array length:%d", num); \ + break; \ + case 2: \ + gl_WindowPos2##_type_(obj,args[0], args[1]); \ + break; \ + case 3: \ + gl_WindowPos3##_type_(obj,args[0], args[1], args[2]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "too many arguments"); \ + break; \ + } \ + return Qnil; \ +} + +GLWINDOWPOS_VFUNC(d) +GLWINDOWPOS_VFUNC(f) +GLWINDOWPOS_VFUNC(i) +GLWINDOWPOS_VFUNC(s) +#undef GLWINDOWPOS_VFUNC + + +void gl_init_functions_1_4(VALUE module) +{ + rb_define_module_function(module, "glBlendFuncSeparate", gl_BlendFuncSeparate, 4); + rb_define_module_function(module, "glFogCoordf", gl_FogCoordf, 1); + rb_define_module_function(module, "glFogCoordfv", gl_FogCoordfv, 1); + rb_define_module_function(module, "glFogCoordd", gl_FogCoordd, 1); + rb_define_module_function(module, "glFogCoorddv", gl_FogCoorddv, 1); + rb_define_module_function(module, "glFogCoordPointer", gl_FogCoordPointer, 3); + rb_define_module_function(module, "glMultiDrawArrays", gl_MultiDrawArrays, 4); + rb_define_module_function(module, "glMultiDrawElements", gl_MultiDrawElements, 3); + rb_define_module_function(module, "glPointParameterf", gl_PointParameterf, 2); + rb_define_module_function(module, "glPointParameterfv", gl_PointParameterfv, 2); + rb_define_module_function(module, "glPointParameteri", gl_PointParameteri, 2); + rb_define_module_function(module, "glPointParameteriv", gl_PointParameteriv, 2); + rb_define_module_function(module, "glSecondaryColor3b", gl_SecondaryColor3b, 3); + rb_define_module_function(module, "glSecondaryColor3d", gl_SecondaryColor3d, 3); + rb_define_module_function(module, "glSecondaryColor3f", gl_SecondaryColor3f, 3); + rb_define_module_function(module, "glSecondaryColor3i", gl_SecondaryColor3i, 3); + rb_define_module_function(module, "glSecondaryColor3s", gl_SecondaryColor3s, 3); + rb_define_module_function(module, "glSecondaryColor3ub", gl_SecondaryColor3ub, 3); + rb_define_module_function(module, "glSecondaryColor3ui", gl_SecondaryColor3ui, 3); + rb_define_module_function(module, "glSecondaryColor3us", gl_SecondaryColor3us, 3); + rb_define_module_function(module, "glSecondaryColorPointer", gl_SecondaryColorPointer, 4); + rb_define_module_function(module, "glWindowPos2d", gl_WindowPos2d, 2); + rb_define_module_function(module, "glWindowPos2f", gl_WindowPos2f, 2); + rb_define_module_function(module, "glWindowPos2i", gl_WindowPos2i, 2); + rb_define_module_function(module, "glWindowPos2s", gl_WindowPos2s, 2); + rb_define_module_function(module, "glWindowPos3d", gl_WindowPos3d, 3); + rb_define_module_function(module, "glWindowPos3f", gl_WindowPos3f, 3); + rb_define_module_function(module, "glWindowPos3i", gl_WindowPos3i, 3); + rb_define_module_function(module, "glWindowPos3s", gl_WindowPos3s, 3); + + /* Additional Functions */ + rb_define_module_function(module, "glSecondaryColor3bv", gl_SecondaryColorbv, -1); + rb_define_module_function(module, "glSecondaryColor3dv", gl_SecondaryColordv, -1); + rb_define_module_function(module, "glSecondaryColor3fv", gl_SecondaryColorfv, -1); + rb_define_module_function(module, "glSecondaryColor3iv", gl_SecondaryColoriv, -1); + rb_define_module_function(module, "glSecondaryColor3sv", gl_SecondaryColorsv, -1); + rb_define_module_function(module, "glSecondaryColor3ubv", gl_SecondaryColorubv, -1); + rb_define_module_function(module, "glSecondaryColor3uiv", gl_SecondaryColoruiv, -1); + rb_define_module_function(module, "glSecondaryColor3usv", gl_SecondaryColorusv, -1); + + rb_define_module_function(module, "glWindowPos2dv", gl_WindowPosdv, -1); + rb_define_module_function(module, "glWindowPos2fv", gl_WindowPosfv, -1); + rb_define_module_function(module, "glWindowPos2iv", gl_WindowPosiv, -1); + rb_define_module_function(module, "glWindowPos2sv", gl_WindowPossv, -1); + rb_define_module_function(module, "glWindowPos3dv", gl_WindowPosdv, -1); + rb_define_module_function(module, "glWindowPos3fv", gl_WindowPosfv, -1); + rb_define_module_function(module, "glWindowPos3iv", gl_WindowPosiv, -1); + rb_define_module_function(module, "glWindowPos3sv", gl_WindowPossv, -1); +} diff --git a/ruby/RubyOpenGL/gl/gl-1.5.c b/ruby/RubyOpenGL/gl/gl-1.5.c new file mode 100644 index 00000000..51025034 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-1.5.c @@ -0,0 +1,362 @@ +/* + * Copyright (C) 2007 Jan Dvorak + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +/* OpenGL 1.5 functions */ + +static void (APIENTRY * fptr_glGenQueries)(GLsizei,GLuint *); +static VALUE +gl_GenQueries(obj,arg1) +VALUE obj,arg1; +{ + GLsizei n; + GLuint *queries; + RArray *ret; + int i; + LOAD_GL_FUNC(glGenQueries) + n = (GLsizei)NUM2UINT(arg1); + queries = ALLOC_N(GLuint, n); + fptr_glGenQueries(n, queries); + ret = RARRAY(rb_ary_new2(n)); + for (i = 0; i < n; i++) + rb_ary_push((VALUE)ret, INT2NUM(queries[i])); + xfree(queries); + return (VALUE)ret; +} + +static void (APIENTRY * fptr_glDeleteQueries)(GLsizei,GLuint *); +static VALUE +gl_DeleteQueries(obj,arg1) +VALUE obj,arg1; +{ + GLsizei n; + GLuint *queries; + LOAD_GL_FUNC(glDeleteQueries) + Check_Type(arg1,T_ARRAY); + n = RARRAY(arg1)->len; + queries = ALLOC_N(GLuint,n); + ary2cuint(arg1,queries,n); + fptr_glDeleteQueries( n, queries); + xfree(queries); + return Qnil; +} + +static GLboolean (APIENTRY * fptr_glIsQuery)(GLuint); +static VALUE +gl_IsQuery(obj,arg1) +VALUE obj,arg1; +{ + GLuint query; + GLboolean ret; + LOAD_GL_FUNC(glIsQuery) + query = (GLuint)NUM2UINT(arg1); + ret = fptr_glIsQuery(query); + return INT2NUM(ret); +} + +static void (APIENTRY * fptr_glBeginQuery)(GLenum,GLuint); +static VALUE +gl_BeginQuery(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLuint id; + LOAD_GL_FUNC(glBeginQuery) + target = (GLenum)NUM2INT(arg1); + id = (GLuint)NUM2UINT(arg2); + fptr_glBeginQuery(target,id); + return Qnil; +} + +static void (APIENTRY * fptr_glEndQuery)(GLenum); +static VALUE +gl_EndQuery(obj,arg1) +VALUE obj,arg1; +{ + GLenum target; + LOAD_GL_FUNC(glEndQuery) + target = (GLenum)NUM2INT(arg1); + fptr_glEndQuery(target); + return Qnil; +} + +static void (APIENTRY * fptr_glGetQueryiv)(GLenum,GLenum,GLint *); +static VALUE +gl_GetQueryiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum pname; + GLint params = 0; + VALUE retary; + LOAD_GL_FUNC(glGetQueryiv) + target = (GLenum)NUM2INT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetQueryiv(target,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary, INT2NUM(params)); + return retary; +} + +static void (APIENTRY * fptr_glGetQueryObjectiv)(GLuint,GLenum,GLint *); +static VALUE +gl_GetQueryObjectiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint id; + GLenum pname; + GLint params = 0; + VALUE retary; + LOAD_GL_FUNC(glGetQueryObjectiv) + id = (GLuint)NUM2UINT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetQueryObjectiv(id,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary,INT2NUM(params)); + return retary; +} + +static void (APIENTRY * fptr_glGetQueryObjectuiv)(GLuint,GLenum,GLuint *); +static VALUE +gl_GetQueryObjectuiv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint id; + GLenum pname; + GLuint params = 0; + VALUE retary; + LOAD_GL_FUNC(glGetQueryObjectuiv) + id = (GLuint)NUM2UINT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetQueryObjectuiv(id,pname,¶ms); + retary = rb_ary_new2(1); + rb_ary_push(retary,INT2NUM(params)); + return retary; +} + +static void (APIENTRY * fptr_glBindBuffer)(GLenum,GLuint); +static VALUE +gl_BindBuffer(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLuint buffer; + LOAD_GL_FUNC(glBindBuffer) + target = (GLenum)NUM2INT(arg1); + buffer = (GLenum)NUM2INT(arg2); + fptr_glBindBuffer(target,buffer); + return Qnil; +} + +static void (APIENTRY * fptr_glDeleteBuffers)(GLsizei,GLuint *); +static VALUE +gl_DeleteBuffers(obj,arg1) +VALUE obj,arg1; +{ + GLsizei n; + GLuint *buffers; + LOAD_GL_FUNC(glDeleteBuffers) + Check_Type(arg1,T_ARRAY); + n = RARRAY(arg1)->len; + buffers = ALLOC_N(GLuint,n); + ary2cuint(arg1,buffers,n); + fptr_glDeleteBuffers(n, buffers); + xfree(buffers); + return Qnil; +} + +static void (APIENTRY * fptr_glGenBuffers)(GLsizei,GLuint *); +static VALUE +gl_GenBuffers(obj,arg1) +VALUE obj,arg1; +{ + GLsizei n; + GLuint *buffers; + RArray *ret; + int i; + LOAD_GL_FUNC(glGenBuffers) + n = (GLsizei)NUM2UINT(arg1); + buffers = ALLOC_N(GLuint, n); + fptr_glGenBuffers(n, buffers); + ret = RARRAY(rb_ary_new2(n)); + for (i = 0; i < n; i++) + rb_ary_push((VALUE)ret, INT2NUM(buffers[i])); + xfree(buffers); + return (VALUE)ret; +} + +static GLboolean (APIENTRY * fptr_glIsBuffer)(GLuint); +static VALUE +gl_IsBuffer(obj,arg1) +VALUE obj,arg1; +{ + GLuint buffer; + GLboolean ret; + LOAD_GL_FUNC(glIsBuffer) + buffer = (GLuint)NUM2UINT(arg1); + ret = fptr_glIsBuffer(buffer); + return INT2NUM(ret); +} + +static void (APIENTRY * fptr_glBufferData)(GLenum,GLsizeiptr,GLvoid *,GLenum); +static VALUE +gl_BufferData(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLsizeiptr size; + GLenum usage; + LOAD_GL_FUNC(glBufferData) + target = (GLenum)NUM2INT(arg1); + size = (GLsizeiptr)NUM2INT(arg2); + usage = (GLenum)NUM2INT(arg4); + if (TYPE(arg3) == T_STRING) { + fptr_glBufferData(target,size,(GLvoid *)RSTRING(arg3)->ptr,usage); + } else if (NIL_P(arg3)) { + fptr_glBufferData(target,size,NULL,usage); + } else { + Check_Type(arg3,T_STRING); /* force exception */ + } + return Qnil; +} + +static void (APIENTRY * fptr_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid *); +static VALUE +gl_BufferSubData(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum target; + GLintptr offset; + GLsizeiptr size; + LOAD_GL_FUNC(glBufferSubData) + target = (GLenum)NUM2INT(arg1); + offset = (GLintptr)NUM2INT(arg2); + size = (GLsizeiptr)NUM2INT(arg3); + Check_Type(arg4,T_STRING); + fptr_glBufferSubData(target,offset,size,(GLvoid *)RSTRING(arg4)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid *); +static VALUE +gl_GetBufferSubData(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLenum target; + GLintptr offset; + GLsizeiptr size; + VALUE data; + LOAD_GL_FUNC(glGetBufferSubData) + target = (GLenum)NUM2INT(arg1); + offset = (GLintptr)NUM2INT(arg2); + size = (GLsizeiptr)NUM2INT(arg3); + data = allocate_buffer_with_string(size); + fptr_glGetBufferSubData(target,offset,size,(GLvoid *)RSTRING(data)->ptr); + return data; +} + +static void (APIENTRY * fptr_glGetBufferParameteriv)(GLenum,GLenum,GLint *); +static VALUE +gl_GetBufferParameteriv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum value; + GLint data = 0; + VALUE retary; + LOAD_GL_FUNC(glGetBufferParameteriv) + target = (GLenum)NUM2INT(arg1); + value = (GLenum)NUM2INT(arg2); + fptr_glGetBufferParameteriv(target,value,&data); + retary = rb_ary_new2(1); + rb_ary_push(retary,INT2NUM(data)); + return retary; +} + +static GLvoid * (APIENTRY * fptr_glMapBuffer)(GLenum,GLenum); +static VALUE +gl_MapBuffer(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum target; + GLenum access; + GLint size = 0; + VALUE data; + GLvoid *buffer_ptr; + LOAD_GL_FUNC(glMapBuffer) + LOAD_GL_FUNC(glGetBufferParameteriv) + target = (GLenum)NUM2INT(arg1); + access = (GLenum)NUM2INT(arg2); + fptr_glGetBufferParameteriv(target,GL_BUFFER_SIZE,&size); + buffer_ptr = fptr_glMapBuffer(target,access); + data = allocate_buffer_with_string(size); + memcpy(RSTRING(data)->ptr, buffer_ptr, size); + return data; +} + +static GLboolean (APIENTRY * fptr_glUnmapBuffer)(GLenum); +static VALUE +gl_UnmapBuffer(obj,arg1) +VALUE obj,arg1; +{ + GLenum target; + GLboolean ret; + LOAD_GL_FUNC(glUnmapBuffer) + target = (GLenum)NUM2INT(arg1); + ret = fptr_glUnmapBuffer(target); + return INT2NUM(ret); +} + +static void (APIENTRY * fptr_glGetBufferPointerv)(GLenum,GLenum,GLvoid **); +static VALUE +gl_GetBufferPointerv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + LOAD_GL_FUNC(glGetBufferPointerv) + /* not implemented */ + return Qnil; +} + +void gl_init_functions_1_5(VALUE module) +{ + rb_define_module_function(module, "glGenQueries", gl_GenQueries, 1); + rb_define_module_function(module, "glDeleteQueries", gl_DeleteQueries, 1); + rb_define_module_function(module, "glIsQuery", gl_IsQuery, 1); + rb_define_module_function(module, "glBeginQuery", gl_BeginQuery, 2); + rb_define_module_function(module, "glEndQuery", gl_EndQuery, 1); + rb_define_module_function(module, "glGetQueryiv", gl_GetQueryiv, 2); + rb_define_module_function(module, "glGetQueryObjectiv", gl_GetQueryObjectiv, 2); + rb_define_module_function(module, "glGetQueryObjectuiv", gl_GetQueryObjectuiv, 2); + rb_define_module_function(module, "glBindBuffer", gl_BindBuffer, 2); + rb_define_module_function(module, "glDeleteBuffers", gl_DeleteBuffers, 1); + rb_define_module_function(module, "glGenBuffers", gl_GenBuffers, 1); + rb_define_module_function(module, "glIsBuffer", gl_IsBuffer, 1); + rb_define_module_function(module, "glBufferData", gl_BufferData, 4); + rb_define_module_function(module, "glBufferSubData", gl_BufferSubData, 4); + rb_define_module_function(module, "glGetBufferSubData", gl_GetBufferSubData, 3); + rb_define_module_function(module, "glMapBuffer", gl_MapBuffer, 2); + rb_define_module_function(module, "glUnmapBuffer", gl_UnmapBuffer, 1); + rb_define_module_function(module, "glGetBufferParameteriv", gl_GetBufferParameteriv, 2); + rb_define_module_function(module, "glGetBufferPointerv", gl_GetBufferPointerv, 3); +} diff --git a/ruby/RubyOpenGL/gl/gl-2.0.c b/ruby/RubyOpenGL/gl/gl-2.0.c new file mode 100644 index 00000000..21c1336a --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-2.0.c @@ -0,0 +1,1632 @@ +/* + * Copyright (C) 2007 Jan Dvorak + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +static void (APIENTRY * fptr_glBlendEquationSeparate)(GLenum,GLenum); +static VALUE +gl_BlendEquationSeparate(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum modeRGB; + GLenum modeAlpha; + LOAD_GL_FUNC(glBlendEquationSeparate) + modeRGB = (GLenum)NUM2INT(arg1); + modeAlpha = (GLenum)NUM2INT(arg2); + fptr_glBlendEquationSeparate(modeRGB,modeAlpha); + return Qnil; +} + +static void (APIENTRY * fptr_glDrawBuffers)(GLsizei,GLenum *); +static VALUE +gl_DrawBuffers(obj,arg1) +VALUE obj,arg1; +{ + GLsizei size; + GLenum *buffers; + LOAD_GL_FUNC(glDrawBuffers) + Check_Type(arg1,T_ARRAY); + size = RARRAY(arg1)->len; + buffers = ALLOC_N(GLenum,size); + ary2cuint(arg1,buffers,size); + fptr_glDrawBuffers(size,buffers); + xfree(buffers); + return Qnil; +} + +static void (APIENTRY * fptr_glStencilOpSeparate)(GLenum,GLenum,GLenum,GLenum); +static VALUE +gl_StencilOpSeparate(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum face; + GLenum sfail; + GLenum dpfail; + GLenum dppass; + LOAD_GL_FUNC(glStencilOpSeparate) + face = (GLenum)NUM2INT(arg1); + sfail = (GLenum)NUM2INT(arg2); + dpfail = (GLenum)NUM2INT(arg3); + dppass = (GLenum)NUM2INT(arg4); + fptr_glStencilOpSeparate(face,sfail,dpfail,dppass); + return Qnil; +} + +static void (APIENTRY * fptr_glStencilFuncSeparate)(GLenum,GLenum,GLint,GLuint); +static VALUE +gl_StencilFuncSeparate(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLenum face; + GLenum func; + GLint ref; + GLuint mask; + LOAD_GL_FUNC(glStencilFuncSeparate) + face = (GLenum)NUM2INT(arg1); + func = (GLenum)NUM2INT(arg2); + ref = (GLint)NUM2INT(arg3); + mask = (GLuint)NUM2UINT(arg4); + fptr_glStencilFuncSeparate(face,func,ref,mask); + return Qnil; +} + +static void (APIENTRY * fptr_glStencilMaskSeparate)(GLenum face,GLuint mask); +static VALUE +gl_StencilMaskSeparate(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLenum face; + GLuint mask; + LOAD_GL_FUNC(glStencilMaskSeparate) + face = (GLenum)NUM2INT(arg1); + mask = (GLenum)NUM2INT(arg2); + fptr_glStencilMaskSeparate(face,mask); + return Qnil; +} + +static void (APIENTRY * fptr_glAttachShader)(GLuint,GLuint); +static VALUE +gl_AttachShader(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLuint shader; + LOAD_GL_FUNC(glAttachShader) + program = (GLuint)NUM2UINT(arg1); + shader = (GLuint)NUM2UINT(arg2); + fptr_glAttachShader(program,shader); + return Qnil; +} + +static void (APIENTRY * fptr_glBindAttribLocation)(GLuint,GLuint,GLchar *); +static VALUE +gl_BindAttribLocation(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint program; + GLuint index; + LOAD_GL_FUNC(glBindAttribLocation) + program = (GLuint)NUM2UINT(arg1); + index = (GLuint)NUM2UINT(arg2); + Check_Type(arg3, T_STRING); + fptr_glBindAttribLocation(program,index,RSTRING(arg3)->ptr); + return Qnil; +} + +static void (APIENTRY * fptr_glCompileShader)(GLuint); +static VALUE +gl_CompileShader(obj,arg1) +VALUE obj,arg1; +{ + GLuint shader; + LOAD_GL_FUNC(glCompileShader) + shader = (GLuint)NUM2UINT(arg1); + fptr_glCompileShader(shader); + return Qnil; +} + +static GLuint (APIENTRY * fptr_glCreateProgram)(void); +static VALUE +gl_CreateProgram(obj) +VALUE obj; +{ + GLuint ret; + LOAD_GL_FUNC(glCreateProgram) + ret = fptr_glCreateProgram(); + return INT2NUM(ret); +} + +static GLuint (APIENTRY * fptr_glCreateShader)(GLenum); +static VALUE +gl_CreateShader(obj,arg1) +VALUE obj,arg1; +{ + GLenum shaderType; + GLuint ret; + LOAD_GL_FUNC(glCreateShader) + shaderType = (GLenum)NUM2INT(arg1); + ret = fptr_glCreateShader(shaderType); + return INT2NUM(ret); +} + +static void (APIENTRY * fptr_glDeleteProgram)(GLuint); +static VALUE +gl_DeleteProgram(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + LOAD_GL_FUNC(glDeleteProgram) + program = (GLuint)NUM2UINT(arg1); + fptr_glDeleteProgram(program); + return Qnil; +} + +static void (APIENTRY * fptr_glDeleteShader)(GLuint); +static VALUE +gl_DeleteShader(obj,arg1) +VALUE obj,arg1; +{ + GLuint shader; + LOAD_GL_FUNC(glDeleteShader) + shader = (GLuint)NUM2UINT(arg1); + fptr_glDeleteShader(shader); + return Qnil; +} + +static void (APIENTRY * fptr_glDetachShader)(GLuint,GLuint); +static VALUE +gl_DetachShader(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLuint shader; + LOAD_GL_FUNC(glDetachShader) + program=(GLuint)NUM2UINT(arg1); + shader=(GLuint)NUM2UINT(arg2); + fptr_glDetachShader(program,shader); + return Qnil; +} + +static void (APIENTRY * fptr_glDisableVertexAttribArray)(GLuint); +static VALUE +gl_DisableVertexAttribArray(obj,arg1) +VALUE obj,arg1; +{ + GLuint index; + LOAD_GL_FUNC(glDisableVertexAttribArray) + index=(GLuint)NUM2UINT(arg1); + fptr_glDisableVertexAttribArray(index); + return Qnil; +} + +static void (APIENTRY * fptr_glEnableVertexAttribArray)(GLuint); +static VALUE +gl_EnableVertexAttribArray(obj,arg1) +VALUE obj,arg1; +{ + GLuint index; + LOAD_GL_FUNC(glEnableVertexAttribArray) + index=(GLuint)NUM2UINT(arg1); + fptr_glEnableVertexAttribArray(index); + return Qnil; +} + +static void (APIENTRY * fptr_glGetProgramiv)(GLuint,GLenum,GLint *); +static VALUE +gl_GetProgramiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLenum pname; + GLint params = 0; + LOAD_GL_FUNC(glGetProgramiv) + program = (GLuint)NUM2UINT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetProgramiv(program,pname,¶ms); + return INT2NUM(params); +} + +static void (APIENTRY * fptr_glGetActiveAttrib)(GLuint,GLuint,GLsizei,GLsizei *,GLint *,GLenum *,GLchar *); +static VALUE +gl_GetActiveAttrib(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLuint index; + GLsizei max_size = 0; + GLsizei written = 0; + GLint attrib_size = 0; + GLenum attrib_type = 0; + VALUE buffer; + VALUE retary; + LOAD_GL_FUNC(glGetActiveAttrib) + LOAD_GL_FUNC(glGetProgramiv) + program = (GLuint)NUM2UINT(arg1); + index = (GLuint)NUM2UINT(arg2); + fptr_glGetProgramiv(program,GL_ACTIVE_ATTRIBUTE_MAX_LENGTH,&max_size); + if (max_size==0) + rb_raise(rb_eTypeError, "Can't determine maximum attribute name length"); + buffer = allocate_buffer_with_string(max_size-1); + fptr_glGetActiveAttrib(program,index,max_size,&written,&attrib_size,&attrib_type,RSTRING(buffer)->ptr); + retary = rb_ary_new2(3); + rb_ary_push(retary, INT2NUM(attrib_size)); + rb_ary_push(retary, INT2NUM(attrib_type)); + rb_ary_push(retary, buffer); + return retary; +} + +static void (APIENTRY * fptr_glGetActiveUniform)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*); +static VALUE +gl_GetActiveUniform(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7; +{ + GLuint program; + GLuint index; + GLsizei max_size = 0; + GLsizei written = 0; + GLint uniform_size = 0; + GLenum uniform_type = 0; + VALUE buffer; + VALUE retary; + LOAD_GL_FUNC(glGetActiveUniform) + LOAD_GL_FUNC(glGetProgramiv) + program = (GLuint)NUM2UINT(arg1); + index = (GLuint)NUM2UINT(arg2); + fptr_glGetProgramiv(program,GL_ACTIVE_UNIFORM_MAX_LENGTH,&max_size); + if (max_size==0) + rb_raise(rb_eTypeError, "Can't determine maximum uniform name length"); + buffer = allocate_buffer_with_string(max_size-1); + fptr_glGetActiveUniform(program,index,max_size,&written,&uniform_size,&uniform_type,RSTRING(buffer)->ptr); + retary = rb_ary_new2(3); + rb_ary_push(retary, INT2NUM(uniform_size)); + rb_ary_push(retary, INT2NUM(uniform_type)); + rb_ary_push(retary, buffer); + return retary; +} + +static void (APIENTRY * fptr_glGetAttachedShaders)(GLuint,GLsizei,GLsizei *,GLuint *); +static VALUE +gl_GetAttachedShaders(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + GLint shaders_num = 0; + GLuint *shaders; + VALUE retary; + GLsizei count = 0; + GLint i; + LOAD_GL_FUNC(glGetAttachedShaders) + LOAD_GL_FUNC(glGetProgramiv) + program = (GLuint)NUM2UINT(arg1); + fptr_glGetProgramiv(program,GL_ATTACHED_SHADERS,&shaders_num); + if (shaders_num<=0) + return Qnil; + shaders = ALLOC_N(GLuint,shaders_num); + fptr_glGetAttachedShaders(program,shaders_num,&count,shaders); + retary = rb_ary_new2(shaders_num); + for(i=0;iptr); + return INT2NUM(ret); +} + +static void (APIENTRY * fptr_glGetProgramInfoLog)(GLuint,GLsizei,GLsizei *,GLchar *); +static VALUE +gl_GetProgramInfoLog(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + GLint max_size = 0; + GLsizei ret_length = 0; + VALUE buffer; + LOAD_GL_FUNC(glGetProgramInfoLog) + LOAD_GL_FUNC(glGetProgramiv) + program = (GLuint)NUM2UINT(arg1); + fptr_glGetProgramiv(program,GL_INFO_LOG_LENGTH,&max_size); + if (max_size<=0) + return rb_str_new2(""); + buffer = allocate_buffer_with_string(max_size); + fptr_glGetProgramInfoLog(program,max_size,&ret_length,RSTRING(buffer)->ptr); + RSTRING(buffer)->len = ret_length; + return buffer; +} + +static void (APIENTRY * fptr_glGetShaderiv)(GLuint,GLenum,GLint *); +static VALUE +gl_GetShaderiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLenum pname; + GLint params = 0; + LOAD_GL_FUNC(glGetShaderiv) + program = (GLuint)NUM2UINT(arg1); + pname = (GLenum)NUM2INT(arg2); + fptr_glGetShaderiv(program,pname,¶ms); + return INT2NUM(params); +} + +static void (APIENTRY * fptr_glGetShaderInfoLog)(GLuint,GLsizei,GLsizei *,GLchar *); +static VALUE +gl_GetShaderInfoLog(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + GLint max_size = 0; + GLsizei ret_length = 0; + VALUE ret_buffer; + GLchar *buffer; + LOAD_GL_FUNC(glGetShaderInfoLog) + LOAD_GL_FUNC(glGetShaderiv) + program = (GLuint)NUM2UINT(arg1); + fptr_glGetShaderiv(program,GL_INFO_LOG_LENGTH,&max_size); + if (max_size<=0) + return rb_str_new2(""); + buffer = ALLOC_N(GLchar,max_size+1); + memset(buffer,0,sizeof(GLchar) * (max_size+1)); + fptr_glGetShaderInfoLog(program,max_size,&ret_length,buffer); + ret_buffer = rb_str_new(buffer, ret_length); + xfree(buffer); + return ret_buffer; +} + +static void (APIENTRY * fptr_glGetShaderSource)(GLuint,GLsizei,GLsizei *,GLchar *); +static VALUE +gl_GetShaderSource(obj,arg1) +VALUE obj,arg1; +{ + GLuint shader; + GLint max_size = 0; + GLsizei ret_length = 0; + VALUE buffer; + LOAD_GL_FUNC(glGetShaderSource) + LOAD_GL_FUNC(glGetShaderiv) + shader = (GLuint)NUM2UINT(arg1); + fptr_glGetShaderiv(shader,GL_SHADER_SOURCE_LENGTH,&max_size); + if (max_size==0) + rb_raise(rb_eTypeError, "Can't determine maximum shader source length"); + buffer = allocate_buffer_with_string(max_size-1); + fptr_glGetShaderSource(shader,max_size,&ret_length,RSTRING(buffer)->ptr); + return buffer; +} + +static GLint (APIENTRY * fptr_glGetUniformLocation)(GLuint,const GLchar*); +static VALUE +gl_GetUniformLocation(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLint ret; + LOAD_GL_FUNC(glGetUniformLocation) + program=(GLuint)NUM2UINT(arg1); + Check_Type(arg2,T_STRING); + ret = fptr_glGetUniformLocation(program,RSTRING(arg2)->ptr); + return INT2NUM(ret); +} + + +#define GET_UNIFORM_SIZE \ + switch (uniform_type) { \ + case GL_FLOAT: \ + case GL_INT: \ + case GL_BOOL: \ + case GL_SAMPLER_1D: \ + case GL_SAMPLER_2D: \ + case GL_SAMPLER_3D: \ + case GL_SAMPLER_CUBE: \ + case GL_SAMPLER_1D_SHADOW: \ + case GL_SAMPLER_2D_SHADOW: \ + uniform_size = 1; \ + break; \ + case GL_FLOAT_VEC2: \ + case GL_INT_VEC2: \ + case GL_BOOL_VEC2: \ + uniform_size = 2; \ + break; \ + case GL_FLOAT_VEC3: \ + case GL_INT_VEC3: \ + case GL_BOOL_VEC3: \ + uniform_size = 3; \ + break; \ + case GL_FLOAT_VEC4: \ + case GL_INT_VEC4: \ + case GL_BOOL_VEC4: \ + case GL_FLOAT_MAT2: \ + uniform_size = 4; \ + break; \ + case GL_FLOAT_MAT2x3: \ + case GL_FLOAT_MAT3x2: \ + uniform_size = 6; \ + break; \ + case GL_FLOAT_MAT2x4: \ + case GL_FLOAT_MAT4x2: \ + uniform_size = 8; \ + break; \ + case GL_FLOAT_MAT3: \ + uniform_size = 9; \ + break; \ + case GL_FLOAT_MAT4x3: \ + case GL_FLOAT_MAT3x4: \ + uniform_size = 12; \ + break; \ + case GL_FLOAT_MAT4: \ + uniform_size = 16; \ + break; \ + default: \ + rb_raise(rb_eTypeError, "Unsupported type '%i'",uniform_type); \ + } + +static void (APIENTRY * fptr_glGetUniformfv)(GLuint,GLint,GLfloat *); +static VALUE +gl_GetUniformfv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint program; + GLint location; + GLfloat params[16]; + VALUE retary; + GLint i; + GLint unused = 0; + GLenum uniform_type = 0; + GLint uniform_size = 0; + + LOAD_GL_FUNC(glGetUniformfv) + LOAD_GL_FUNC(glGetActiveUniform) + program = (GLuint)NUM2UINT(arg1); + location = (GLint)NUM2INT(arg2); + + fptr_glGetActiveUniform(program,location,0,NULL,&unused,&uniform_type,NULL); + if (uniform_type==0) + rb_raise(rb_eTypeError, "Can't determine the uniform's type"); + + GET_UNIFORM_SIZE + + memset(params,0,16*sizeof(GLfloat)); + fptr_glGetUniformfv(program,location,params); + retary = rb_ary_new2(uniform_size); + for(i=0;i_MAX_VERTEX_ATTRIBS) + rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS); + + return g_VertexAttrib_ptr[index]; +} + +static GLboolean (APIENTRY * fptr_glIsProgram)(GLuint); +static VALUE +gl_IsProgram(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + GLboolean ret; + LOAD_GL_FUNC(glIsProgram) + program = (GLuint)NUM2UINT(arg1); + ret = fptr_glIsProgram(program); + return INT2NUM(ret); +} + +static GLboolean (APIENTRY * fptr_glIsShader)(GLuint); +static VALUE +gl_IsShader(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + GLboolean ret; + LOAD_GL_FUNC(glIsShader) + program = (GLuint)NUM2UINT(arg1); + ret = fptr_glIsShader(program); + return INT2NUM(ret); +} + +static void (APIENTRY * fptr_glLinkProgram)(GLuint); +static VALUE +gl_LinkProgram(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + LOAD_GL_FUNC(glLinkProgram) + program = (GLuint)NUM2UINT(arg1); + fptr_glLinkProgram(program); + return Qnil; +} + +static void (APIENTRY * fptr_glShaderSource)(GLuint,GLsizei,GLchar**,GLint *); +static VALUE +gl_ShaderSource(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint shader; + GLint length; + GLchar *str; + LOAD_GL_FUNC(glShaderSource) + shader = (GLuint)NUM2UINT(arg1); + Check_Type(arg2,T_STRING); + str = RSTRING(arg2)->ptr; + length = RSTRING(arg2)->len; + fptr_glShaderSource(shader,1,&str,&length); + return Qnil; +} + +static void (APIENTRY * fptr_glUseProgram)(GLuint); +static VALUE +gl_UseProgram(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + LOAD_GL_FUNC(glUseProgram) + program = (GLuint)NUM2UINT(arg1); + fptr_glUseProgram(program); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform1f)(GLint,GLfloat); +static VALUE +gl_Uniform1f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint location; + GLfloat v0; + LOAD_GL_FUNC(glUniform1f) + location = (GLint)NUM2INT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + fptr_glUniform1f(location,v0); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform2f)(GLint,GLfloat,GLfloat); +static VALUE +gl_Uniform2f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLfloat v0; + GLfloat v1; + LOAD_GL_FUNC(glUniform2f) + location = (GLint)NUM2INT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + v1 = (GLfloat)NUM2DBL(arg3); + fptr_glUniform2f(location,v0,v1); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform3f)(GLint,GLfloat,GLfloat,GLfloat); +static VALUE +gl_Uniform3f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLfloat v0; + GLfloat v1; + GLfloat v2; + LOAD_GL_FUNC(glUniform3f) + location = (GLint)NUM2INT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + v1 = (GLfloat)NUM2DBL(arg3); + v2 = (GLfloat)NUM2DBL(arg4); + fptr_glUniform3f(location,v0,v1,v2); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform4f)(GLint,GLfloat,GLfloat,GLfloat,GLfloat); +static VALUE +gl_Uniform4f(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLint location; + GLfloat v0; + GLfloat v1; + GLfloat v2; + GLfloat v3; + LOAD_GL_FUNC(glUniform4f) + location = (GLint)NUM2INT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + v1 = (GLfloat)NUM2DBL(arg3); + v2 = (GLfloat)NUM2DBL(arg4); + v3 = (GLfloat)NUM2DBL(arg5); + fptr_glUniform4f(location,v0,v1,v2,v3); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform1i)(GLint,GLint); +static VALUE +gl_Uniform1i(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLint location; + GLint v0; + LOAD_GL_FUNC(glUniform1i) + location = (GLint)NUM2INT(arg1); + v0 = (GLint)NUM2INT(arg2); + fptr_glUniform1i(location,v0); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform2i)(GLint,GLint,GLint); +static VALUE +gl_Uniform2i(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLint v0; + GLint v1; + LOAD_GL_FUNC(glUniform2i) + location = (GLint)NUM2INT(arg1); + v0 = (GLint)NUM2INT(arg2); + v1 = (GLint)NUM2INT(arg3); + fptr_glUniform2i(location,v0,v1); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform3i)(GLint,GLint,GLint,GLint); +static VALUE +gl_Uniform3i(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLint v0; + GLint v1; + GLint v2; + LOAD_GL_FUNC(glUniform3i) + location = (GLint)NUM2INT(arg1); + v0 = (GLint)NUM2INT(arg2); + v1 = (GLint)NUM2INT(arg3); + v2 = (GLint)NUM2INT(arg4); + fptr_glUniform3i(location,v0,v1,v2); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform4i)(GLint,GLint,GLint,GLint,GLint); +static VALUE +gl_Uniform4i(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLint location; + GLint v0; + GLint v1; + GLint v2; + GLint v3; + LOAD_GL_FUNC(glUniform4i) + location = (GLint)NUM2INT(arg1); + v0 = (GLint)NUM2INT(arg2); + v1 = (GLint)NUM2INT(arg3); + v2 = (GLint)NUM2INT(arg4); + v3 = (GLint)NUM2INT(arg5); + fptr_glUniform4i(location,v0,v1,v2,v3); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform1fv)(GLint,GLsizei,GLfloat *); +static VALUE +gl_Uniform1fv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLfloat *value; + LOAD_GL_FUNC(glUniform1fv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLfloat,1*count); + ary2cflt(arg3,value,1*count); + fptr_glUniform1fv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform2fv)(GLint,GLsizei,GLfloat *); +static VALUE +gl_Uniform2fv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLfloat *value; + LOAD_GL_FUNC(glUniform2fv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLfloat,2*count); + ary2cflt(arg3,value,2*count); + fptr_glUniform2fv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform3fv)(GLint,GLsizei,GLfloat *); +static VALUE +gl_Uniform3fv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLfloat *value; + LOAD_GL_FUNC(glUniform3fv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLfloat,3*count); + ary2cflt(arg3,value,3*count); + fptr_glUniform3fv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform4fv)(GLint,GLsizei,GLfloat *); +static VALUE +gl_Uniform4fv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLfloat *value; + LOAD_GL_FUNC(glUniform4fv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLfloat,4*count); + ary2cflt(arg3,value,4*count); + fptr_glUniform4fv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform1iv)(GLint,GLsizei,GLint *); +static VALUE +gl_Uniform1iv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLint *value; + LOAD_GL_FUNC(glUniform1iv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLint,1*count); + ary2cint(arg3,value,1*count); + fptr_glUniform1iv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform2iv)(GLint,GLsizei,GLint *); +static VALUE +gl_Uniform2iv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLint *value; + LOAD_GL_FUNC(glUniform2iv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLint,2*count); + ary2cint(arg3,value,2*count); + fptr_glUniform2iv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform3iv)(GLint,GLsizei,GLint *); +static VALUE +gl_Uniform3iv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLint *value; + LOAD_GL_FUNC(glUniform3iv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLint,3*count); + ary2cint(arg3,value,3*count); + fptr_glUniform3iv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniform4iv)(GLint,GLsizei,GLint *); +static VALUE +gl_Uniform4iv(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLint location; + GLsizei count; + GLint *value; + LOAD_GL_FUNC(glUniform4iv) + location = (GLint)NUM2INT(arg1); + count = (GLsizei)NUM2UINT(arg2); + value = ALLOC_N(GLint,4*count); + ary2cint(arg3,value,4*count); + fptr_glUniform4iv(location,count,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix2fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix2fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix2fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 2*2*count); + ary2cflt(arg4,value,2*2*count); + fptr_glUniformMatrix2fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix3fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix3fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix3fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 3*3*count); + ary2cflt(arg4,value,3*3*count); + fptr_glUniformMatrix3fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix4fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix4fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix4fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 4*4*count); + ary2cflt(arg4,value,4*4*count); + fptr_glUniformMatrix4fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glValidateProgram)(GLuint); +static VALUE +gl_ValidateProgram(obj,arg1) +VALUE obj,arg1; +{ + GLuint program; + LOAD_GL_FUNC(glValidateProgram) + program = (GLuint)NUM2UINT(arg1); + fptr_glValidateProgram(program); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib1d)(GLuint,GLdouble); +static VALUE +gl_VertexAttrib1d(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLdouble v0; + LOAD_GL_FUNC(glVertexAttrib1d) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLdouble)NUM2DBL(arg2); + fptr_glVertexAttrib1d(index,v0); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib1f)(GLuint,GLfloat); +static VALUE +gl_VertexAttrib1f(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLfloat v0; + LOAD_GL_FUNC(glVertexAttrib1f) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + fptr_glVertexAttrib1f(index,v0); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib1s)(GLuint,GLshort); +static VALUE +gl_VertexAttrib1s(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLshort v0; + LOAD_GL_FUNC(glVertexAttrib1s) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLshort)NUM2INT(arg2); + fptr_glVertexAttrib1s(index,v0); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib2d)(GLuint,GLdouble,GLdouble); +static VALUE +gl_VertexAttrib2d(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint index; + GLdouble v0; + GLdouble v1; + LOAD_GL_FUNC(glVertexAttrib2d) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLdouble)NUM2DBL(arg2); + v1 = (GLdouble)NUM2DBL(arg3); + fptr_glVertexAttrib2d(index,v0,v1); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib2f)(GLuint,GLfloat,GLfloat); +static VALUE +gl_VertexAttrib2f(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint index; + GLfloat v0; + GLfloat v1; + LOAD_GL_FUNC(glVertexAttrib2f) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + v1 = (GLfloat)NUM2DBL(arg3); + fptr_glVertexAttrib2f(index,v0,v1); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib2s)(GLuint,GLshort,GLshort); +static VALUE +gl_VertexAttrib2s(obj,arg1,arg2,arg3) +VALUE obj,arg1,arg2,arg3; +{ + GLuint index; + GLshort v0; + GLshort v1; + LOAD_GL_FUNC(glVertexAttrib2s) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLshort)NUM2INT(arg2); + v1 = (GLshort)NUM2INT(arg3); + fptr_glVertexAttrib2s(index,v0,v1); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib3d)(GLuint,GLdouble,GLdouble,GLdouble); +static VALUE +gl_VertexAttrib3d(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLuint index; + GLdouble v0; + GLdouble v1; + GLdouble v2; + LOAD_GL_FUNC(glVertexAttrib3d) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLdouble)NUM2DBL(arg2); + v1 = (GLdouble)NUM2DBL(arg3); + v2 = (GLdouble)NUM2DBL(arg4); + fptr_glVertexAttrib3d(index,v0,v1,v2); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib3f)(GLuint,GLfloat,GLfloat,GLfloat); +static VALUE +gl_VertexAttrib3f(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLuint index; + GLfloat v0; + GLfloat v1; + GLfloat v2; + LOAD_GL_FUNC(glVertexAttrib3f) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + v1 = (GLfloat)NUM2DBL(arg3); + v2 = (GLfloat)NUM2DBL(arg4); + fptr_glVertexAttrib3f(index,v0,v1,v2); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib3s)(GLuint,GLshort,GLshort,GLshort); +static VALUE +gl_VertexAttrib3s(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLuint index; + GLshort v0; + GLshort v1; + GLshort v2; + LOAD_GL_FUNC(glVertexAttrib3s) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLshort)NUM2INT(arg2); + v1 = (GLshort)NUM2INT(arg3); + v2 = (GLshort)NUM2INT(arg4); + fptr_glVertexAttrib3s(index,v0,v1,v2); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Nbv)(GLuint,GLbyte *); +static VALUE +gl_VertexAttrib4Nbv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLbyte v[4]; + LOAD_GL_FUNC(glVertexAttrib4Nbv) + index = (GLuint)NUM2UINT(arg1); + ary2cbyte(arg2,v,4); + fptr_glVertexAttrib4Nbv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Niv)(GLuint,GLint *); +static VALUE +gl_VertexAttrib4Niv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLint v[4]; + LOAD_GL_FUNC(glVertexAttrib4Niv) + index = (GLuint)NUM2UINT(arg1); + ary2cint(arg2,v,4); + fptr_glVertexAttrib4Niv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Nsv)(GLuint,GLshort *); +static VALUE +gl_VertexAttrib4Nsv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLshort v[4]; + LOAD_GL_FUNC(glVertexAttrib4Nsv) + index = (GLuint)NUM2UINT(arg1); + ary2cshort(arg2,v,4); + fptr_glVertexAttrib4Nsv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Nub)(GLuint,GLubyte,GLubyte,GLubyte,GLubyte); +static VALUE +gl_VertexAttrib4Nub(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLuint index; + GLubyte v0; + GLubyte v1; + GLubyte v2; + GLubyte v3; + LOAD_GL_FUNC(glVertexAttrib4Nub) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLubyte)NUM2INT(arg2); + v1 = (GLubyte)NUM2INT(arg3); + v2 = (GLubyte)NUM2INT(arg4); + v3 = (GLubyte)NUM2INT(arg5); + fptr_glVertexAttrib4Nub(index,v0,v1,v2,v3); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Nubv)(GLuint,GLubyte *); +static VALUE +gl_VertexAttrib4Nubv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLubyte v[4]; + LOAD_GL_FUNC(glVertexAttrib4Nubv) + index = (GLuint)NUM2UINT(arg1); + ary2cubyte(arg2,v,4); + fptr_glVertexAttrib4Nubv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Nuiv)(GLuint,GLuint *); +static VALUE +gl_VertexAttrib4Nuiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLuint v[4]; + LOAD_GL_FUNC(glVertexAttrib4Nuiv) + index = (GLuint)NUM2UINT(arg1); + ary2cuint(arg2,v,4); + fptr_glVertexAttrib4Nuiv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4Nusv)(GLuint,GLushort *); +static VALUE +gl_VertexAttrib4Nusv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLushort v[4]; + LOAD_GL_FUNC(glVertexAttrib4Nusv) + index = (GLuint)NUM2UINT(arg1); + ary2cushort(arg2,v,4); + fptr_glVertexAttrib4Nusv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4bv)(GLuint,GLbyte *); +static VALUE +gl_VertexAttrib4bv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLbyte v[4]; + LOAD_GL_FUNC(glVertexAttrib4bv) + index = (GLuint)NUM2UINT(arg1); + ary2cbyte(arg2,v,4); + fptr_glVertexAttrib4bv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4d)(GLuint,GLdouble,GLdouble,GLdouble,GLdouble); +static VALUE +gl_VertexAttrib4d(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLuint index; + GLdouble v0; + GLdouble v1; + GLdouble v2; + GLdouble v3; + LOAD_GL_FUNC(glVertexAttrib4d) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLdouble)NUM2DBL(arg2); + v1 = (GLdouble)NUM2DBL(arg3); + v2 = (GLdouble)NUM2DBL(arg4); + v3 = (GLdouble)NUM2DBL(arg5); + fptr_glVertexAttrib4d(index,v0,v1,v2,v3); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4f)(GLuint,GLfloat,GLfloat,GLfloat,GLfloat); +static VALUE +gl_VertexAttrib4f(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLuint index; + GLfloat v0; + GLfloat v1; + GLfloat v2; + GLfloat v3; + LOAD_GL_FUNC(glVertexAttrib4f) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLfloat)NUM2DBL(arg2); + v1 = (GLfloat)NUM2DBL(arg3); + v2 = (GLfloat)NUM2DBL(arg4); + v3 = (GLfloat)NUM2DBL(arg5); + fptr_glVertexAttrib4f(index,v0,v1,v2,v3); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4iv)(GLuint,GLint *); +static VALUE +gl_VertexAttrib4iv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLint v[4]; + LOAD_GL_FUNC(glVertexAttrib4iv) + index = (GLuint)NUM2UINT(arg1); + ary2cint(arg2,v,4); + fptr_glVertexAttrib4iv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4s)(GLuint,GLshort,GLshort,GLshort,GLshort); +static VALUE +gl_VertexAttrib4s(obj,arg1,arg2,arg3,arg4,arg5) +VALUE obj,arg1,arg2,arg3,arg4,arg5; +{ + GLuint index; + GLshort v0; + GLshort v1; + GLshort v2; + GLshort v3; + LOAD_GL_FUNC(glVertexAttrib4s) + index = (GLuint)NUM2UINT(arg1); + v0 = (GLshort)NUM2INT(arg2); + v1 = (GLshort)NUM2INT(arg3); + v2 = (GLshort)NUM2INT(arg4); + v3 = (GLshort)NUM2INT(arg5); + fptr_glVertexAttrib4s(index,v0,v1,v2,v3); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4ubv)(GLuint,GLubyte *); +static VALUE +gl_VertexAttrib4ubv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLubyte v[4]; + LOAD_GL_FUNC(glVertexAttrib4ubv) + index = (GLuint)NUM2UINT(arg1); + ary2cubyte(arg2,v,4); + fptr_glVertexAttrib4ubv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4uiv)(GLuint,GLuint *); +static VALUE +gl_VertexAttrib4uiv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLuint v[4]; + LOAD_GL_FUNC(glVertexAttrib4uiv) + index = (GLuint)NUM2UINT(arg1); + ary2cuint(arg2,v,4); + fptr_glVertexAttrib4uiv(index,v); + return Qnil; +} + +static void (APIENTRY * fptr_glVertexAttrib4usv)(GLuint,GLushort *); +static VALUE +gl_VertexAttrib4usv(obj,arg1,arg2) +VALUE obj,arg1,arg2; +{ + GLuint index; + GLushort v[4]; + LOAD_GL_FUNC(glVertexAttrib4usv) + index = (GLuint)NUM2UINT(arg1); + ary2cushort(arg2,v,4); + fptr_glVertexAttrib4usv(index,v); + return Qnil; +} + +#define GLVERTEXATTRIB_VFUNC(_type_) \ +static VALUE \ +gl_VertexAttrib##_type_##v(argc,argv,obj) \ +int argc; \ +VALUE *argv; \ +VALUE obj; \ +{ \ + VALUE args[5]; \ + RArray *ary; \ + switch (rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3], &args[4])) { \ + case 2: \ + if (TYPE(args[1]) == T_ARRAY) { \ + ary = RARRAY(args[1]); \ + switch (ary->len) { \ + case 1: \ + gl_VertexAttrib1##_type_(obj,args[0],ary->ptr[0]); \ + break; \ + case 2: \ + gl_VertexAttrib2##_type_(obj,args[0],ary->ptr[0],ary->ptr[1]); \ + break; \ + case 3: \ + gl_VertexAttrib3##_type_(obj,args[0],ary->ptr[0],ary->ptr[1],ary->ptr[2]); \ + break; \ + case 4: \ + gl_VertexAttrib4##_type_(obj,args[0],ary->ptr[0],ary->ptr[1],ary->ptr[2],ary->ptr[3]); \ + break; \ + default: \ + rb_raise(rb_eRuntimeError, "glVertex vertex num error!:%d", ary->len); \ + } \ + } \ + else { \ + gl_VertexAttrib1##_type_(obj,args[0], args[1]); \ + break; \ + } \ + break; \ + case 3: \ + gl_VertexAttrib2##_type_(obj,args[0], args[1], args[2]); \ + break; \ + case 4: \ + gl_VertexAttrib3##_type_(obj,args[0], args[1], args[2], args[3]); \ + break; \ + case 5: \ + gl_VertexAttrib4##_type_(obj,args[0], args[1], args[2], args[3], args[4]); \ + break; \ + default: \ + rb_raise(rb_eArgError, "Argument number error!"); \ + break; \ + } \ + return Qnil; \ +} + +GLVERTEXATTRIB_VFUNC(d) +GLVERTEXATTRIB_VFUNC(f) +GLVERTEXATTRIB_VFUNC(s) + +#undef GLVERTEXATTRIB_VFUNC + +static void (APIENTRY * fptr_glVertexAttribPointer)(GLuint,GLint,GLenum,GLboolean,GLsizei,GLvoid *); +static VALUE +gl_VertexAttribPointer(obj,arg1,arg2,arg3,arg4,arg5,arg6) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6; +{ + GLuint index; + GLuint size; + GLenum type; + GLboolean normalized; + GLsizei stride; + LOAD_GL_FUNC(glVertexAttribPointer) + index = (GLuint)NUM2UINT(arg1); + size = (GLuint)NUM2UINT(arg2); + type = (GLenum)NUM2INT(arg3); + normalized = (GLboolean)NUM2INT(arg4); + stride = (GLsizei)NUM2UINT(arg5); + if (index>_MAX_VERTEX_ATTRIBS) + rb_raise(rb_eArgError, "Index too large, maximum allowed value '%i'",_MAX_VERTEX_ATTRIBS); + Check_Type(arg6, T_STRING); + rb_str_freeze(arg6); + g_VertexAttrib_ptr[index] = arg6; + fptr_glVertexAttribPointer(index,size,type,normalized,stride,(GLvoid *)RSTRING(arg6)->ptr); + return Qnil; +} + +void gl_init_functions_2_0(VALUE module) +{ + rb_define_module_function(module, "glBlendEquationSeparate", gl_BlendEquationSeparate, 2); + rb_define_module_function(module, "glDrawBuffers", gl_DrawBuffers, 1); + rb_define_module_function(module, "glStencilOpSeparate", gl_StencilOpSeparate, 4); + rb_define_module_function(module, "glStencilFuncSeparate", gl_StencilFuncSeparate, 4); + rb_define_module_function(module, "glStencilMaskSeparate", gl_StencilMaskSeparate, 2); + rb_define_module_function(module, "glAttachShader", gl_AttachShader, 2); + rb_define_module_function(module, "glBindAttribLocation", gl_BindAttribLocation, 3); + rb_define_module_function(module, "glCompileShader", gl_CompileShader, 1); + rb_define_module_function(module, "glCreateProgram", gl_CreateProgram, 0); + rb_define_module_function(module, "glCreateShader", gl_CreateShader, 1); + rb_define_module_function(module, "glDeleteProgram", gl_DeleteProgram, 1); + rb_define_module_function(module, "glDeleteShader", gl_DeleteShader, 1); + rb_define_module_function(module, "glDetachShader", gl_DetachShader, 2); + rb_define_module_function(module, "glDisableVertexAttribArray", gl_DisableVertexAttribArray, 1); + rb_define_module_function(module, "glEnableVertexAttribArray", gl_EnableVertexAttribArray, 1); + rb_define_module_function(module, "glGetActiveAttrib", gl_GetActiveAttrib, 2); + rb_define_module_function(module, "glGetActiveUniform", gl_GetActiveUniform, 2); + rb_define_module_function(module, "glGetAttachedShaders", gl_GetAttachedShaders, 1); + rb_define_module_function(module, "glGetAttribLocation", gl_GetAttribLocation, 2); + rb_define_module_function(module, "glGetProgramiv", gl_GetProgramiv, 2); + rb_define_module_function(module, "glGetProgramInfoLog", gl_GetProgramInfoLog, 1); + rb_define_module_function(module, "glGetShaderiv", gl_GetShaderiv, 2); + rb_define_module_function(module, "glGetShaderInfoLog", gl_GetShaderInfoLog, 1); + rb_define_module_function(module, "glGetShaderSource", gl_GetShaderSource, 1); + rb_define_module_function(module, "glGetUniformLocation", gl_GetUniformLocation, 2); + rb_define_module_function(module, "glGetUniformfv", gl_GetUniformfv, 2); + rb_define_module_function(module, "glGetUniformiv", gl_GetUniformiv, 2); + rb_define_module_function(module, "glGetVertexAttribdv", gl_GetVertexAttribdv, 2); + rb_define_module_function(module, "glGetVertexAttribfv", gl_GetVertexAttribfv, 2); + rb_define_module_function(module, "glGetVertexAttribiv", gl_GetVertexAttribiv, 2); + rb_define_module_function(module, "glGetVertexAttribPointerv", gl_GetVertexAttribPointerv, 1); + rb_define_module_function(module, "glIsProgram", gl_IsProgram, 1); + rb_define_module_function(module, "glIsShader", gl_IsShader, 1); + rb_define_module_function(module, "glLinkProgram", gl_LinkProgram, 1); + rb_define_module_function(module, "glShaderSource", gl_ShaderSource, 2); + rb_define_module_function(module, "glUseProgram", gl_UseProgram, 1); + rb_define_module_function(module, "glUniform1f", gl_Uniform1f, 2); + rb_define_module_function(module, "glUniform2f", gl_Uniform2f, 3); + rb_define_module_function(module, "glUniform3f", gl_Uniform3f, 4); + rb_define_module_function(module, "glUniform4f", gl_Uniform4f, 5); + rb_define_module_function(module, "glUniform1i", gl_Uniform1i, 2); + rb_define_module_function(module, "glUniform2i", gl_Uniform2i, 3); + rb_define_module_function(module, "glUniform3i", gl_Uniform3i, 4); + rb_define_module_function(module, "glUniform4i", gl_Uniform4i, 5); + rb_define_module_function(module, "glUniform1fv", gl_Uniform1fv, 3); + rb_define_module_function(module, "glUniform2fv", gl_Uniform2fv, 3); + rb_define_module_function(module, "glUniform3fv", gl_Uniform3fv, 3); + rb_define_module_function(module, "glUniform4fv", gl_Uniform4fv, 3); + rb_define_module_function(module, "glUniform1iv", gl_Uniform1iv, 3); + rb_define_module_function(module, "glUniform2iv", gl_Uniform2iv, 3); + rb_define_module_function(module, "glUniform3iv", gl_Uniform3iv, 3); + rb_define_module_function(module, "glUniform4iv", gl_Uniform4iv, 3); + rb_define_module_function(module, "glUniformMatrix2fv", gl_UniformMatrix2fv, 4); + rb_define_module_function(module, "glUniformMatrix3fv", gl_UniformMatrix3fv, 4); + rb_define_module_function(module, "glUniformMatrix4fv", gl_UniformMatrix4fv, 4); + rb_define_module_function(module, "glValidateProgram", gl_ValidateProgram, 1); + rb_define_module_function(module, "glVertexAttrib1d", gl_VertexAttrib1d, 2); + rb_define_module_function(module, "glVertexAttrib1f", gl_VertexAttrib1f, 2); + rb_define_module_function(module, "glVertexAttrib1s", gl_VertexAttrib1s, 2); + rb_define_module_function(module, "glVertexAttrib2d", gl_VertexAttrib2d, 3); + rb_define_module_function(module, "glVertexAttrib2f", gl_VertexAttrib2f, 3); + rb_define_module_function(module, "glVertexAttrib2s", gl_VertexAttrib2s, 3); + rb_define_module_function(module, "glVertexAttrib3d", gl_VertexAttrib3d, 4); + rb_define_module_function(module, "glVertexAttrib3f", gl_VertexAttrib3f, 4); + rb_define_module_function(module, "glVertexAttrib3s", gl_VertexAttrib3s, 4); + rb_define_module_function(module, "glVertexAttrib4Nbv", gl_VertexAttrib4Nbv, 2); + rb_define_module_function(module, "glVertexAttrib4Niv", gl_VertexAttrib4Niv, 2); + rb_define_module_function(module, "glVertexAttrib4Nsv", gl_VertexAttrib4Nsv, 2); + rb_define_module_function(module, "glVertexAttrib4Nub", gl_VertexAttrib4Nub, 5); + rb_define_module_function(module, "glVertexAttrib4Nubv", gl_VertexAttrib4Nubv, 2); + rb_define_module_function(module, "glVertexAttrib4Nuiv", gl_VertexAttrib4Nuiv, 2); + rb_define_module_function(module, "glVertexAttrib4Nusv", gl_VertexAttrib4Nusv, 2); + rb_define_module_function(module, "glVertexAttrib4bv", gl_VertexAttrib4bv, 2); + rb_define_module_function(module, "glVertexAttrib4d", gl_VertexAttrib4d, 5); + rb_define_module_function(module, "glVertexAttrib4f", gl_VertexAttrib4f, 5); + rb_define_module_function(module, "glVertexAttrib4iv", gl_VertexAttrib4iv, 2); + rb_define_module_function(module, "glVertexAttrib4s", gl_VertexAttrib4s, 5); + rb_define_module_function(module, "glVertexAttrib4ubv", gl_VertexAttrib4ubv, 2); + rb_define_module_function(module, "glVertexAttrib4uiv", gl_VertexAttrib4uiv, 2); + rb_define_module_function(module, "glVertexAttrib4usv", gl_VertexAttrib4usv, 2); + rb_define_module_function(module, "glVertexAttribPointer", gl_VertexAttribPointer, 6); + + /* Additional functions */ + rb_define_module_function(module, "glVertexAttrib1dv", gl_VertexAttribdv, -1); + rb_define_module_function(module, "glVertexAttrib1fv", gl_VertexAttribfv, -1); + rb_define_module_function(module, "glVertexAttrib1sv", gl_VertexAttribsv, -1); + rb_define_module_function(module, "glVertexAttrib2dv", gl_VertexAttribdv, -1); + rb_define_module_function(module, "glVertexAttrib2fv", gl_VertexAttribfv, -1); + rb_define_module_function(module, "glVertexAttrib2sv", gl_VertexAttribsv, -1); + rb_define_module_function(module, "glVertexAttrib3dv", gl_VertexAttribdv, -1); + rb_define_module_function(module, "glVertexAttrib3fv", gl_VertexAttribfv, -1); + rb_define_module_function(module, "glVertexAttrib3sv", gl_VertexAttribsv, -1); + rb_define_module_function(module, "glVertexAttrib4dv", gl_VertexAttribdv, -1); + rb_define_module_function(module, "glVertexAttrib4fv", gl_VertexAttribfv, -1); + rb_define_module_function(module, "glVertexAttrib4sv", gl_VertexAttribsv, -1); + + { + int i; + for (i=0;i<_MAX_VERTEX_ATTRIBS;i++) + rb_global_variable(&g_VertexAttrib_ptr[i]); + } +} diff --git a/ruby/RubyOpenGL/gl/gl-2.1.c b/ruby/RubyOpenGL/gl/gl-2.1.c new file mode 100644 index 00000000..787622af --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-2.1.c @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2007 Jan Dvorak + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +static void (APIENTRY * fptr_glUniformMatrix2x3fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix2x3fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix2x3fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 2*3*count); + ary2cflt(arg4,value,2*3*count); + fptr_glUniformMatrix2x3fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix3x2fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix3x2fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix3x2fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 3*2*count); + ary2cflt(arg4,value,3*2*count); + fptr_glUniformMatrix3x2fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix2x4fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix2x4fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix2x4fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 2*4*count); + ary2cflt(arg4,value,2*4*count); + fptr_glUniformMatrix2x4fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix4x2fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix4x2fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix4x2fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 4*2*count); + ary2cflt(arg4,value,4*2*count); + fptr_glUniformMatrix4x2fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix3x4fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix3x4fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix3x4fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 3*4*count); + ary2cflt(arg4,value,3*4*count); + fptr_glUniformMatrix3x4fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +static void (APIENTRY * fptr_glUniformMatrix4x3fv)(GLint,GLsizei,GLboolean,GLfloat *); +static VALUE +gl_UniformMatrix4x3fv(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLint location; + GLsizei count; + GLboolean transpose; + GLfloat *value; + LOAD_GL_FUNC(glUniformMatrix4x3fv) + location = (GLint)NUM2INT(arg1); + count = (GLint)NUM2INT(arg2); + transpose = (GLboolean)NUM2INT(arg3); + value = ALLOC_N(GLfloat, 4*3*count); + ary2cflt(arg4,value,4*3*count); + fptr_glUniformMatrix4x3fv(location,count,transpose,value); + xfree(value); + return Qnil; +} + +void gl_init_functions_2_1(VALUE module) +{ + rb_define_module_function(module, "glUniformMatrix2x3fv", gl_UniformMatrix2x3fv, 4); + rb_define_module_function(module, "glUniformMatrix3x2fv", gl_UniformMatrix3x2fv, 4); + rb_define_module_function(module, "glUniformMatrix2x4fv", gl_UniformMatrix2x4fv, 4); + rb_define_module_function(module, "glUniformMatrix4x2fv", gl_UniformMatrix4x2fv, 4); + rb_define_module_function(module, "glUniformMatrix3x4fv", gl_UniformMatrix3x4fv, 4); + rb_define_module_function(module, "glUniformMatrix4x3fv", gl_UniformMatrix4x3fv, 4); +} diff --git a/ruby/RubyOpenGL/gl/gl-enums.c b/ruby/RubyOpenGL/gl/gl-enums.c new file mode 100644 index 00000000..ff491237 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl-enums.c @@ -0,0 +1,2904 @@ +/* + * Copyright (C) 1999 - 2005 Yoshi + * Copyright (C) 2006 John M. Gabriele + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +void gl_init_enums(VALUE module) +{ + rb_define_const(module, "GL_1PASS_EXT", INT2NUM(GL_1PASS_EXT)); + rb_define_const(module, "GL_1PASS_SGIS", INT2NUM(GL_1PASS_SGIS)); + rb_define_const(module, "GL_2_BYTES", INT2NUM(GL_2_BYTES)); + rb_define_const(module, "GL_2D", INT2NUM(GL_2D)); + rb_define_const(module, "GL_2PASS_0_EXT", INT2NUM(GL_2PASS_0_EXT)); + rb_define_const(module, "GL_2PASS_0_SGIS", INT2NUM(GL_2PASS_0_SGIS)); + rb_define_const(module, "GL_2PASS_1_EXT", INT2NUM(GL_2PASS_1_EXT)); + rb_define_const(module, "GL_2PASS_1_SGIS", INT2NUM(GL_2PASS_1_SGIS)); + rb_define_const(module, "GL_2X_BIT_ATI", INT2NUM(GL_2X_BIT_ATI)); + rb_define_const(module, "GL_3_BYTES", INT2NUM(GL_3_BYTES)); + rb_define_const(module, "GL_3D_COLOR", INT2NUM(GL_3D_COLOR)); + rb_define_const(module, "GL_3D_COLOR_TEXTURE", INT2NUM(GL_3D_COLOR_TEXTURE)); + rb_define_const(module, "GL_3D", INT2NUM(GL_3D)); + rb_define_const(module, "GL_422_AVERAGE_EXT", INT2NUM(GL_422_AVERAGE_EXT)); + rb_define_const(module, "GL_422_EXT", INT2NUM(GL_422_EXT)); + rb_define_const(module, "GL_422_REV_AVERAGE_EXT", INT2NUM(GL_422_REV_AVERAGE_EXT)); + rb_define_const(module, "GL_422_REV_EXT", INT2NUM(GL_422_REV_EXT)); + rb_define_const(module, "GL_4_BYTES", INT2NUM(GL_4_BYTES)); + rb_define_const(module, "GL_4D_COLOR_TEXTURE", INT2NUM(GL_4D_COLOR_TEXTURE)); + rb_define_const(module, "GL_4PASS_0_EXT", INT2NUM(GL_4PASS_0_EXT)); + rb_define_const(module, "GL_4PASS_0_SGIS", INT2NUM(GL_4PASS_0_SGIS)); + rb_define_const(module, "GL_4PASS_1_EXT", INT2NUM(GL_4PASS_1_EXT)); + rb_define_const(module, "GL_4PASS_1_SGIS", INT2NUM(GL_4PASS_1_SGIS)); + rb_define_const(module, "GL_4PASS_2_EXT", INT2NUM(GL_4PASS_2_EXT)); + rb_define_const(module, "GL_4PASS_2_SGIS", INT2NUM(GL_4PASS_2_SGIS)); + rb_define_const(module, "GL_4PASS_3_EXT", INT2NUM(GL_4PASS_3_EXT)); + rb_define_const(module, "GL_4PASS_3_SGIS", INT2NUM(GL_4PASS_3_SGIS)); + rb_define_const(module, "GL_4X_BIT_ATI", INT2NUM(GL_4X_BIT_ATI)); + rb_define_const(module, "GL_8X_BIT_ATI", INT2NUM(GL_8X_BIT_ATI)); + rb_define_const(module, "GL_ABGR_EXT", INT2NUM(GL_ABGR_EXT)); + rb_define_const(module, "GL_ACCUM_ALPHA_BITS", INT2NUM(GL_ACCUM_ALPHA_BITS)); + rb_define_const(module, "GL_ACCUM_BLUE_BITS", INT2NUM(GL_ACCUM_BLUE_BITS)); + rb_define_const(module, "GL_ACCUM_BUFFER_BIT", INT2NUM(GL_ACCUM_BUFFER_BIT)); + rb_define_const(module, "GL_ACCUM_CLEAR_VALUE", INT2NUM(GL_ACCUM_CLEAR_VALUE)); + rb_define_const(module, "GL_ACCUM_GREEN_BITS", INT2NUM(GL_ACCUM_GREEN_BITS)); + rb_define_const(module, "GL_ACCUM", INT2NUM(GL_ACCUM)); + rb_define_const(module, "GL_ACCUM_RED_BITS", INT2NUM(GL_ACCUM_RED_BITS)); + rb_define_const(module, "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH", INT2NUM(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)); + rb_define_const(module, "GL_ACTIVE_ATTRIBUTES", INT2NUM(GL_ACTIVE_ATTRIBUTES)); + rb_define_const(module, "GL_ACTIVE_STENCIL_FACE_EXT", INT2NUM(GL_ACTIVE_STENCIL_FACE_EXT)); + rb_define_const(module, "GL_ACTIVE_TEXTURE_ARB", INT2NUM(GL_ACTIVE_TEXTURE_ARB)); + rb_define_const(module, "GL_ACTIVE_TEXTURE", INT2NUM(GL_ACTIVE_TEXTURE)); + rb_define_const(module, "GL_ACTIVE_UNIFORM_MAX_LENGTH", INT2NUM(GL_ACTIVE_UNIFORM_MAX_LENGTH)); + rb_define_const(module, "GL_ACTIVE_UNIFORMS", INT2NUM(GL_ACTIVE_UNIFORMS)); + rb_define_const(module, "GL_ACTIVE_VERTEX_UNITS_ARB", INT2NUM(GL_ACTIVE_VERTEX_UNITS_ARB)); + rb_define_const(module, "GL_ADD_ATI", INT2NUM(GL_ADD_ATI)); + rb_define_const(module, "GL_ADD", INT2NUM(GL_ADD)); + rb_define_const(module, "GL_ADD_SIGNED_ARB", INT2NUM(GL_ADD_SIGNED_ARB)); + rb_define_const(module, "GL_ADD_SIGNED_EXT", INT2NUM(GL_ADD_SIGNED_EXT)); + rb_define_const(module, "GL_ADD_SIGNED", INT2NUM(GL_ADD_SIGNED)); + rb_define_const(module, "GL_ALIASED_LINE_WIDTH_RANGE", INT2NUM(GL_ALIASED_LINE_WIDTH_RANGE)); + rb_define_const(module, "GL_ALIASED_POINT_SIZE_RANGE", INT2NUM(GL_ALIASED_POINT_SIZE_RANGE)); + rb_define_const(module, "GL_ALL_ATTRIB_BITS", INT2NUM(GL_ALL_ATTRIB_BITS)); + rb_define_const(module, "GL_ALL_COMPLETED_NV", INT2NUM(GL_ALL_COMPLETED_NV)); + rb_define_const(module, "GL_ALLOW_DRAW_FRG_HINT_PGI", INT2NUM(GL_ALLOW_DRAW_FRG_HINT_PGI)); + rb_define_const(module, "GL_ALLOW_DRAW_MEM_HINT_PGI", INT2NUM(GL_ALLOW_DRAW_MEM_HINT_PGI)); + rb_define_const(module, "GL_ALLOW_DRAW_OBJ_HINT_PGI", INT2NUM(GL_ALLOW_DRAW_OBJ_HINT_PGI)); + rb_define_const(module, "GL_ALLOW_DRAW_WIN_HINT_PGI", INT2NUM(GL_ALLOW_DRAW_WIN_HINT_PGI)); + rb_define_const(module, "GL_ALPHA12_EXT", INT2NUM(GL_ALPHA12_EXT)); + rb_define_const(module, "GL_ALPHA12", INT2NUM(GL_ALPHA12)); + rb_define_const(module, "GL_ALPHA16_EXT", INT2NUM(GL_ALPHA16_EXT)); + rb_define_const(module, "GL_ALPHA16F_ARB", INT2NUM(GL_ALPHA16F_ARB)); + rb_define_const(module, "GL_ALPHA16", INT2NUM(GL_ALPHA16)); + rb_define_const(module, "GL_ALPHA32F_ARB", INT2NUM(GL_ALPHA32F_ARB)); + rb_define_const(module, "GL_ALPHA4_EXT", INT2NUM(GL_ALPHA4_EXT)); + rb_define_const(module, "GL_ALPHA4", INT2NUM(GL_ALPHA4)); + rb_define_const(module, "GL_ALPHA8_EXT", INT2NUM(GL_ALPHA8_EXT)); + rb_define_const(module, "GL_ALPHA8", INT2NUM(GL_ALPHA8)); + rb_define_const(module, "GL_ALPHA_BIAS", INT2NUM(GL_ALPHA_BIAS)); + rb_define_const(module, "GL_ALPHA_BITS", INT2NUM(GL_ALPHA_BITS)); + rb_define_const(module, "GL_ALPHA_FLOAT16_ATI", INT2NUM(GL_ALPHA_FLOAT16_ATI)); + rb_define_const(module, "GL_ALPHA_FLOAT32_ATI", INT2NUM(GL_ALPHA_FLOAT32_ATI)); + rb_define_const(module, "GL_ALPHA", INT2NUM(GL_ALPHA)); + rb_define_const(module, "GL_ALPHA_MAX_CLAMP_INGR", INT2NUM(GL_ALPHA_MAX_CLAMP_INGR)); + rb_define_const(module, "GL_ALPHA_MAX_SGIX", INT2NUM(GL_ALPHA_MAX_SGIX)); + rb_define_const(module, "GL_ALPHA_MIN_CLAMP_INGR", INT2NUM(GL_ALPHA_MIN_CLAMP_INGR)); + rb_define_const(module, "GL_ALPHA_MIN_SGIX", INT2NUM(GL_ALPHA_MIN_SGIX)); + rb_define_const(module, "GL_ALPHA_SCALE", INT2NUM(GL_ALPHA_SCALE)); + rb_define_const(module, "GL_ALPHA_TEST_FUNC", INT2NUM(GL_ALPHA_TEST_FUNC)); + rb_define_const(module, "GL_ALPHA_TEST", INT2NUM(GL_ALPHA_TEST)); + rb_define_const(module, "GL_ALPHA_TEST_REF", INT2NUM(GL_ALPHA_TEST_REF)); + rb_define_const(module, "GL_ALWAYS_FAST_HINT_PGI", INT2NUM(GL_ALWAYS_FAST_HINT_PGI)); + rb_define_const(module, "GL_ALWAYS", INT2NUM(GL_ALWAYS)); + rb_define_const(module, "GL_ALWAYS_SOFT_HINT_PGI", INT2NUM(GL_ALWAYS_SOFT_HINT_PGI)); + rb_define_const(module, "GL_AMBIENT_AND_DIFFUSE", INT2NUM(GL_AMBIENT_AND_DIFFUSE)); + rb_define_const(module, "GL_AMBIENT", INT2NUM(GL_AMBIENT)); + rb_define_const(module, "GL_AND", INT2NUM(GL_AND)); + rb_define_const(module, "GL_AND_INVERTED", INT2NUM(GL_AND_INVERTED)); + rb_define_const(module, "GL_AND_REVERSE", INT2NUM(GL_AND_REVERSE)); + rb_define_const(module, "GL_ARB_imaging", INT2NUM(GL_ARB_imaging)); + rb_define_const(module, "GL_ARRAY_BUFFER_ARB", INT2NUM(GL_ARRAY_BUFFER_ARB)); + rb_define_const(module, "GL_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_ARRAY_BUFFER_BINDING", INT2NUM(GL_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_ARRAY_BUFFER", INT2NUM(GL_ARRAY_BUFFER)); + rb_define_const(module, "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", INT2NUM(GL_ARRAY_ELEMENT_LOCK_COUNT_EXT)); + rb_define_const(module, "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", INT2NUM(GL_ARRAY_ELEMENT_LOCK_FIRST_EXT)); + rb_define_const(module, "GL_ARRAY_OBJECT_BUFFER_ATI", INT2NUM(GL_ARRAY_OBJECT_BUFFER_ATI)); + rb_define_const(module, "GL_ARRAY_OBJECT_OFFSET_ATI", INT2NUM(GL_ARRAY_OBJECT_OFFSET_ATI)); + rb_define_const(module, "GL_ASYNC_DRAW_PIXELS_SGIX", INT2NUM(GL_ASYNC_DRAW_PIXELS_SGIX)); + rb_define_const(module, "GL_ASYNC_HISTOGRAM_SGIX", INT2NUM(GL_ASYNC_HISTOGRAM_SGIX)); + rb_define_const(module, "GL_ASYNC_MARKER_SGIX", INT2NUM(GL_ASYNC_MARKER_SGIX)); + rb_define_const(module, "GL_ASYNC_READ_PIXELS_SGIX", INT2NUM(GL_ASYNC_READ_PIXELS_SGIX)); + rb_define_const(module, "GL_ASYNC_TEX_IMAGE_SGIX", INT2NUM(GL_ASYNC_TEX_IMAGE_SGIX)); + rb_define_const(module, "GL_ATTACHED_SHADERS", INT2NUM(GL_ATTACHED_SHADERS)); + rb_define_const(module, "GL_ATTENUATION_EXT", INT2NUM(GL_ATTENUATION_EXT)); + rb_define_const(module, "GL_ATTRIB_ARRAY_POINTER_NV", INT2NUM(GL_ATTRIB_ARRAY_POINTER_NV)); + rb_define_const(module, "GL_ATTRIB_ARRAY_SIZE_NV", INT2NUM(GL_ATTRIB_ARRAY_SIZE_NV)); + rb_define_const(module, "GL_ATTRIB_ARRAY_STRIDE_NV", INT2NUM(GL_ATTRIB_ARRAY_STRIDE_NV)); + rb_define_const(module, "GL_ATTRIB_ARRAY_TYPE_NV", INT2NUM(GL_ATTRIB_ARRAY_TYPE_NV)); + rb_define_const(module, "GL_ATTRIB_STACK_DEPTH", INT2NUM(GL_ATTRIB_STACK_DEPTH)); + rb_define_const(module, "GL_AUTO_NORMAL", INT2NUM(GL_AUTO_NORMAL)); + rb_define_const(module, "GL_AUX0", INT2NUM(GL_AUX0)); + rb_define_const(module, "GL_AUX1", INT2NUM(GL_AUX1)); + rb_define_const(module, "GL_AUX2", INT2NUM(GL_AUX2)); + rb_define_const(module, "GL_AUX3", INT2NUM(GL_AUX3)); + rb_define_const(module, "GL_AUX_BUFFERS", INT2NUM(GL_AUX_BUFFERS)); + rb_define_const(module, "GL_AVERAGE_EXT", INT2NUM(GL_AVERAGE_EXT)); + rb_define_const(module, "GL_AVERAGE_HP", INT2NUM(GL_AVERAGE_HP)); + rb_define_const(module, "GL_BACK", INT2NUM(GL_BACK)); + rb_define_const(module, "GL_BACK_LEFT", INT2NUM(GL_BACK_LEFT)); + rb_define_const(module, "GL_BACK_NORMALS_HINT_PGI", INT2NUM(GL_BACK_NORMALS_HINT_PGI)); + rb_define_const(module, "GL_BACK_RIGHT", INT2NUM(GL_BACK_RIGHT)); + rb_define_const(module, "GL_BGRA_EXT", INT2NUM(GL_BGRA_EXT)); + rb_define_const(module, "GL_BGRA", INT2NUM(GL_BGRA)); + rb_define_const(module, "GL_BGR_EXT", INT2NUM(GL_BGR_EXT)); + rb_define_const(module, "GL_BGR", INT2NUM(GL_BGR)); + rb_define_const(module, "GL_BIAS_BIT_ATI", INT2NUM(GL_BIAS_BIT_ATI)); + rb_define_const(module, "GL_BIAS_BY_NEGATIVE_ONE_HALF_NV", INT2NUM(GL_BIAS_BY_NEGATIVE_ONE_HALF_NV)); + rb_define_const(module, "GL_BINORMAL_ARRAY_EXT", INT2NUM(GL_BINORMAL_ARRAY_EXT)); + rb_define_const(module, "GL_BINORMAL_ARRAY_POINTER_EXT", INT2NUM(GL_BINORMAL_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_BINORMAL_ARRAY_STRIDE_EXT", INT2NUM(GL_BINORMAL_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_BINORMAL_ARRAY_TYPE_EXT", INT2NUM(GL_BINORMAL_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_BITMAP", INT2NUM(GL_BITMAP)); + rb_define_const(module, "GL_BITMAP_TOKEN", INT2NUM(GL_BITMAP_TOKEN)); + rb_define_const(module, "GL_BLEND_COLOR_EXT", INT2NUM(GL_BLEND_COLOR_EXT)); + rb_define_const(module, "GL_BLEND_COLOR", INT2NUM(GL_BLEND_COLOR)); + rb_define_const(module, "GL_BLEND_DST_ALPHA_EXT", INT2NUM(GL_BLEND_DST_ALPHA_EXT)); + rb_define_const(module, "GL_BLEND_DST_ALPHA", INT2NUM(GL_BLEND_DST_ALPHA)); + rb_define_const(module, "GL_BLEND_DST", INT2NUM(GL_BLEND_DST)); + rb_define_const(module, "GL_BLEND_DST_RGB_EXT", INT2NUM(GL_BLEND_DST_RGB_EXT)); + rb_define_const(module, "GL_BLEND_DST_RGB", INT2NUM(GL_BLEND_DST_RGB)); + rb_define_const(module, "GL_BLEND_EQUATION_ALPHA_EXT", INT2NUM(GL_BLEND_EQUATION_ALPHA_EXT)); + rb_define_const(module, "GL_BLEND_EQUATION_ALPHA", INT2NUM(GL_BLEND_EQUATION_ALPHA)); + rb_define_const(module, "GL_BLEND_EQUATION_EXT", INT2NUM(GL_BLEND_EQUATION_EXT)); + rb_define_const(module, "GL_BLEND_EQUATION", INT2NUM(GL_BLEND_EQUATION)); + rb_define_const(module, "GL_BLEND_EQUATION_RGB_EXT", INT2NUM(GL_BLEND_EQUATION_RGB_EXT)); + rb_define_const(module, "GL_BLEND_EQUATION_RGB", INT2NUM(GL_BLEND_EQUATION_RGB)); + rb_define_const(module, "GL_BLEND", INT2NUM(GL_BLEND)); + rb_define_const(module, "GL_BLEND_SRC_ALPHA_EXT", INT2NUM(GL_BLEND_SRC_ALPHA_EXT)); + rb_define_const(module, "GL_BLEND_SRC_ALPHA", INT2NUM(GL_BLEND_SRC_ALPHA)); + rb_define_const(module, "GL_BLEND_SRC", INT2NUM(GL_BLEND_SRC)); + rb_define_const(module, "GL_BLEND_SRC_RGB_EXT", INT2NUM(GL_BLEND_SRC_RGB_EXT)); + rb_define_const(module, "GL_BLEND_SRC_RGB", INT2NUM(GL_BLEND_SRC_RGB)); + rb_define_const(module, "GL_BLUE_BIAS", INT2NUM(GL_BLUE_BIAS)); + rb_define_const(module, "GL_BLUE_BIT_ATI", INT2NUM(GL_BLUE_BIT_ATI)); + rb_define_const(module, "GL_BLUE_BITS", INT2NUM(GL_BLUE_BITS)); + rb_define_const(module, "GL_BLUE", INT2NUM(GL_BLUE)); + rb_define_const(module, "GL_BLUE_MAX_CLAMP_INGR", INT2NUM(GL_BLUE_MAX_CLAMP_INGR)); + rb_define_const(module, "GL_BLUE_MIN_CLAMP_INGR", INT2NUM(GL_BLUE_MIN_CLAMP_INGR)); + rb_define_const(module, "GL_BLUE_SCALE", INT2NUM(GL_BLUE_SCALE)); + rb_define_const(module, "GL_BOOL_ARB", INT2NUM(GL_BOOL_ARB)); + rb_define_const(module, "GL_BOOL", INT2NUM(GL_BOOL)); + rb_define_const(module, "GL_BOOL_VEC2_ARB", INT2NUM(GL_BOOL_VEC2_ARB)); + rb_define_const(module, "GL_BOOL_VEC2", INT2NUM(GL_BOOL_VEC2)); + rb_define_const(module, "GL_BOOL_VEC3_ARB", INT2NUM(GL_BOOL_VEC3_ARB)); + rb_define_const(module, "GL_BOOL_VEC3", INT2NUM(GL_BOOL_VEC3)); + rb_define_const(module, "GL_BOOL_VEC4_ARB", INT2NUM(GL_BOOL_VEC4_ARB)); + rb_define_const(module, "GL_BOOL_VEC4", INT2NUM(GL_BOOL_VEC4)); + rb_define_const(module, "GL_BUFFER_ACCESS_ARB", INT2NUM(GL_BUFFER_ACCESS_ARB)); + rb_define_const(module, "GL_BUFFER_ACCESS", INT2NUM(GL_BUFFER_ACCESS)); + rb_define_const(module, "GL_BUFFER_FLUSHING_UNMAP_APPLE", INT2NUM(GL_BUFFER_FLUSHING_UNMAP_APPLE)); + rb_define_const(module, "GL_BUFFER_MAPPED_ARB", INT2NUM(GL_BUFFER_MAPPED_ARB)); + rb_define_const(module, "GL_BUFFER_MAPPED", INT2NUM(GL_BUFFER_MAPPED)); + rb_define_const(module, "GL_BUFFER_MAP_POINTER_ARB", INT2NUM(GL_BUFFER_MAP_POINTER_ARB)); + rb_define_const(module, "GL_BUFFER_MAP_POINTER", INT2NUM(GL_BUFFER_MAP_POINTER)); + rb_define_const(module, "GL_BUFFER_SERIALIZED_MODIFY_APPLE", INT2NUM(GL_BUFFER_SERIALIZED_MODIFY_APPLE)); + rb_define_const(module, "GL_BUFFER_SIZE_ARB", INT2NUM(GL_BUFFER_SIZE_ARB)); + rb_define_const(module, "GL_BUFFER_SIZE", INT2NUM(GL_BUFFER_SIZE)); + rb_define_const(module, "GL_BUFFER_USAGE_ARB", INT2NUM(GL_BUFFER_USAGE_ARB)); + rb_define_const(module, "GL_BUFFER_USAGE", INT2NUM(GL_BUFFER_USAGE)); + rb_define_const(module, "GL_BUMP_ENVMAP_ATI", INT2NUM(GL_BUMP_ENVMAP_ATI)); + rb_define_const(module, "GL_BUMP_NUM_TEX_UNITS_ATI", INT2NUM(GL_BUMP_NUM_TEX_UNITS_ATI)); + rb_define_const(module, "GL_BUMP_ROT_MATRIX_ATI", INT2NUM(GL_BUMP_ROT_MATRIX_ATI)); + rb_define_const(module, "GL_BUMP_ROT_MATRIX_SIZE_ATI", INT2NUM(GL_BUMP_ROT_MATRIX_SIZE_ATI)); + rb_define_const(module, "GL_BUMP_TARGET_ATI", INT2NUM(GL_BUMP_TARGET_ATI)); + rb_define_const(module, "GL_BUMP_TEX_UNITS_ATI", INT2NUM(GL_BUMP_TEX_UNITS_ATI)); + rb_define_const(module, "GL_BYTE", INT2NUM(GL_BYTE)); + rb_define_const(module, "GL_C3F_V3F", INT2NUM(GL_C3F_V3F)); + rb_define_const(module, "GL_C4F_N3F_V3F", INT2NUM(GL_C4F_N3F_V3F)); + rb_define_const(module, "GL_C4UB_V2F", INT2NUM(GL_C4UB_V2F)); + rb_define_const(module, "GL_C4UB_V3F", INT2NUM(GL_C4UB_V3F)); + rb_define_const(module, "GL_CALLIGRAPHIC_FRAGMENT_SGIX", INT2NUM(GL_CALLIGRAPHIC_FRAGMENT_SGIX)); + rb_define_const(module, "GL_CCW", INT2NUM(GL_CCW)); + rb_define_const(module, "GL_CLAMP_FRAGMENT_COLOR_ARB", INT2NUM(GL_CLAMP_FRAGMENT_COLOR_ARB)); + rb_define_const(module, "GL_CLAMP", INT2NUM(GL_CLAMP)); + rb_define_const(module, "GL_CLAMP_READ_COLOR_ARB", INT2NUM(GL_CLAMP_READ_COLOR_ARB)); + rb_define_const(module, "GL_CLAMP_TO_BORDER_ARB", INT2NUM(GL_CLAMP_TO_BORDER_ARB)); + rb_define_const(module, "GL_CLAMP_TO_BORDER", INT2NUM(GL_CLAMP_TO_BORDER)); + rb_define_const(module, "GL_CLAMP_TO_BORDER_SGIS", INT2NUM(GL_CLAMP_TO_BORDER_SGIS)); + rb_define_const(module, "GL_CLAMP_TO_EDGE", INT2NUM(GL_CLAMP_TO_EDGE)); + rb_define_const(module, "GL_CLAMP_TO_EDGE_SGIS", INT2NUM(GL_CLAMP_TO_EDGE_SGIS)); + rb_define_const(module, "GL_CLAMP_VERTEX_COLOR_ARB", INT2NUM(GL_CLAMP_VERTEX_COLOR_ARB)); + rb_define_const(module, "GL_CLEAR", INT2NUM(GL_CLEAR)); + rb_define_const(module, "GL_CLIENT_ACTIVE_TEXTURE_ARB", INT2NUM(GL_CLIENT_ACTIVE_TEXTURE_ARB)); + rb_define_const(module, "GL_CLIENT_ACTIVE_TEXTURE", INT2NUM(GL_CLIENT_ACTIVE_TEXTURE)); + rb_define_const(module, "GL_CLIENT_ALL_ATTRIB_BITS", INT2NUM(GL_CLIENT_ALL_ATTRIB_BITS)); + rb_define_const(module, "GL_CLIENT_ATTRIB_STACK_DEPTH", INT2NUM(GL_CLIENT_ATTRIB_STACK_DEPTH)); + rb_define_const(module, "GL_CLIENT_PIXEL_STORE_BIT", INT2NUM(GL_CLIENT_PIXEL_STORE_BIT)); + rb_define_const(module, "GL_CLIENT_VERTEX_ARRAY_BIT", INT2NUM(GL_CLIENT_VERTEX_ARRAY_BIT)); + rb_define_const(module, "GL_CLIP_FAR_HINT_PGI", INT2NUM(GL_CLIP_FAR_HINT_PGI)); + rb_define_const(module, "GL_CLIP_NEAR_HINT_PGI", INT2NUM(GL_CLIP_NEAR_HINT_PGI)); + rb_define_const(module, "GL_CLIP_PLANE0", INT2NUM(GL_CLIP_PLANE0)); + rb_define_const(module, "GL_CLIP_PLANE1", INT2NUM(GL_CLIP_PLANE1)); + rb_define_const(module, "GL_CLIP_PLANE2", INT2NUM(GL_CLIP_PLANE2)); + rb_define_const(module, "GL_CLIP_PLANE3", INT2NUM(GL_CLIP_PLANE3)); + rb_define_const(module, "GL_CLIP_PLANE4", INT2NUM(GL_CLIP_PLANE4)); + rb_define_const(module, "GL_CLIP_PLANE5", INT2NUM(GL_CLIP_PLANE5)); + rb_define_const(module, "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", INT2NUM(GL_CLIP_VOLUME_CLIPPING_HINT_EXT)); + rb_define_const(module, "GL_CMYKA_EXT", INT2NUM(GL_CMYKA_EXT)); + rb_define_const(module, "GL_CMYK_EXT", INT2NUM(GL_CMYK_EXT)); + rb_define_const(module, "GL_CND0_ATI", INT2NUM(GL_CND0_ATI)); + rb_define_const(module, "GL_CND_ATI", INT2NUM(GL_CND_ATI)); + rb_define_const(module, "GL_COEFF", INT2NUM(GL_COEFF)); + rb_define_const(module, "GL_COLOR3_BIT_PGI", INT2NUM(GL_COLOR3_BIT_PGI)); + rb_define_const(module, "GL_COLOR4_BIT_PGI", INT2NUM(GL_COLOR4_BIT_PGI)); + rb_define_const(module, "GL_COLOR_ALPHA_PAIRING_ATI", INT2NUM(GL_COLOR_ALPHA_PAIRING_ATI)); + rb_define_const(module, "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_COLOR_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_COLOR_ARRAY_BUFFER_BINDING", INT2NUM(GL_COLOR_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_COLOR_ARRAY_COUNT_EXT", INT2NUM(GL_COLOR_ARRAY_COUNT_EXT)); + rb_define_const(module, "GL_COLOR_ARRAY_EXT", INT2NUM(GL_COLOR_ARRAY_EXT)); + rb_define_const(module, "GL_COLOR_ARRAY", INT2NUM(GL_COLOR_ARRAY)); + rb_define_const(module, "GL_COLOR_ARRAY_LIST_IBM", INT2NUM(GL_COLOR_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_COLOR_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_COLOR_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL", INT2NUM(GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL)); + rb_define_const(module, "GL_COLOR_ARRAY_POINTER_EXT", INT2NUM(GL_COLOR_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_COLOR_ARRAY_POINTER", INT2NUM(GL_COLOR_ARRAY_POINTER)); + rb_define_const(module, "GL_COLOR_ARRAY_SIZE_EXT", INT2NUM(GL_COLOR_ARRAY_SIZE_EXT)); + rb_define_const(module, "GL_COLOR_ARRAY_SIZE", INT2NUM(GL_COLOR_ARRAY_SIZE)); + rb_define_const(module, "GL_COLOR_ARRAY_STRIDE_EXT", INT2NUM(GL_COLOR_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_COLOR_ARRAY_STRIDE", INT2NUM(GL_COLOR_ARRAY_STRIDE)); + rb_define_const(module, "GL_COLOR_ARRAY_TYPE_EXT", INT2NUM(GL_COLOR_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_COLOR_ARRAY_TYPE", INT2NUM(GL_COLOR_ARRAY_TYPE)); + rb_define_const(module, "GL_COLOR_ATTACHMENT0_EXT", INT2NUM(GL_COLOR_ATTACHMENT0_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT10_EXT", INT2NUM(GL_COLOR_ATTACHMENT10_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT11_EXT", INT2NUM(GL_COLOR_ATTACHMENT11_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT12_EXT", INT2NUM(GL_COLOR_ATTACHMENT12_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT13_EXT", INT2NUM(GL_COLOR_ATTACHMENT13_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT14_EXT", INT2NUM(GL_COLOR_ATTACHMENT14_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT15_EXT", INT2NUM(GL_COLOR_ATTACHMENT15_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT1_EXT", INT2NUM(GL_COLOR_ATTACHMENT1_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT2_EXT", INT2NUM(GL_COLOR_ATTACHMENT2_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT3_EXT", INT2NUM(GL_COLOR_ATTACHMENT3_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT4_EXT", INT2NUM(GL_COLOR_ATTACHMENT4_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT5_EXT", INT2NUM(GL_COLOR_ATTACHMENT5_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT6_EXT", INT2NUM(GL_COLOR_ATTACHMENT6_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT7_EXT", INT2NUM(GL_COLOR_ATTACHMENT7_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT8_EXT", INT2NUM(GL_COLOR_ATTACHMENT8_EXT)); + rb_define_const(module, "GL_COLOR_ATTACHMENT9_EXT", INT2NUM(GL_COLOR_ATTACHMENT9_EXT)); + rb_define_const(module, "GL_COLOR_BUFFER_BIT", INT2NUM(GL_COLOR_BUFFER_BIT)); + rb_define_const(module, "GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI", INT2NUM(GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI)); + rb_define_const(module, "GL_COLOR_CLEAR_VALUE", INT2NUM(GL_COLOR_CLEAR_VALUE)); + rb_define_const(module, "GL_COLOR_INDEX12_EXT", INT2NUM(GL_COLOR_INDEX12_EXT)); + rb_define_const(module, "GL_COLOR_INDEX16_EXT", INT2NUM(GL_COLOR_INDEX16_EXT)); + rb_define_const(module, "GL_COLOR_INDEX1_EXT", INT2NUM(GL_COLOR_INDEX1_EXT)); + rb_define_const(module, "GL_COLOR_INDEX2_EXT", INT2NUM(GL_COLOR_INDEX2_EXT)); + rb_define_const(module, "GL_COLOR_INDEX4_EXT", INT2NUM(GL_COLOR_INDEX4_EXT)); + rb_define_const(module, "GL_COLOR_INDEX8_EXT", INT2NUM(GL_COLOR_INDEX8_EXT)); + rb_define_const(module, "GL_COLOR_INDEXES", INT2NUM(GL_COLOR_INDEXES)); + rb_define_const(module, "GL_COLOR_INDEX", INT2NUM(GL_COLOR_INDEX)); + rb_define_const(module, "GL_COLOR", INT2NUM(GL_COLOR)); + rb_define_const(module, "GL_COLOR_LOGIC_OP", INT2NUM(GL_COLOR_LOGIC_OP)); + rb_define_const(module, "GL_COLOR_MATERIAL_FACE", INT2NUM(GL_COLOR_MATERIAL_FACE)); + rb_define_const(module, "GL_COLOR_MATERIAL", INT2NUM(GL_COLOR_MATERIAL)); + rb_define_const(module, "GL_COLOR_MATERIAL_PARAMETER", INT2NUM(GL_COLOR_MATERIAL_PARAMETER)); + rb_define_const(module, "GL_COLOR_MATRIX", INT2NUM(GL_COLOR_MATRIX)); + rb_define_const(module, "GL_COLOR_MATRIX_SGI", INT2NUM(GL_COLOR_MATRIX_SGI)); + rb_define_const(module, "GL_COLOR_MATRIX_STACK_DEPTH", INT2NUM(GL_COLOR_MATRIX_STACK_DEPTH)); + rb_define_const(module, "GL_COLOR_MATRIX_STACK_DEPTH_SGI", INT2NUM(GL_COLOR_MATRIX_STACK_DEPTH_SGI)); + rb_define_const(module, "GL_COLOR_SUM_ARB", INT2NUM(GL_COLOR_SUM_ARB)); + rb_define_const(module, "GL_COLOR_SUM_CLAMP_NV", INT2NUM(GL_COLOR_SUM_CLAMP_NV)); + rb_define_const(module, "GL_COLOR_SUM_EXT", INT2NUM(GL_COLOR_SUM_EXT)); + rb_define_const(module, "GL_COLOR_SUM", INT2NUM(GL_COLOR_SUM)); + rb_define_const(module, "GL_COLOR_TABLE_ALPHA_SIZE", INT2NUM(GL_COLOR_TABLE_ALPHA_SIZE)); + rb_define_const(module, "GL_COLOR_TABLE_ALPHA_SIZE_SGI", INT2NUM(GL_COLOR_TABLE_ALPHA_SIZE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_BIAS", INT2NUM(GL_COLOR_TABLE_BIAS)); + rb_define_const(module, "GL_COLOR_TABLE_BIAS_SGI", INT2NUM(GL_COLOR_TABLE_BIAS_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_BLUE_SIZE", INT2NUM(GL_COLOR_TABLE_BLUE_SIZE)); + rb_define_const(module, "GL_COLOR_TABLE_BLUE_SIZE_SGI", INT2NUM(GL_COLOR_TABLE_BLUE_SIZE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_FORMAT", INT2NUM(GL_COLOR_TABLE_FORMAT)); + rb_define_const(module, "GL_COLOR_TABLE_FORMAT_SGI", INT2NUM(GL_COLOR_TABLE_FORMAT_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_GREEN_SIZE", INT2NUM(GL_COLOR_TABLE_GREEN_SIZE)); + rb_define_const(module, "GL_COLOR_TABLE_GREEN_SIZE_SGI", INT2NUM(GL_COLOR_TABLE_GREEN_SIZE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE", INT2NUM(GL_COLOR_TABLE)); + rb_define_const(module, "GL_COLOR_TABLE_INTENSITY_SIZE", INT2NUM(GL_COLOR_TABLE_INTENSITY_SIZE)); + rb_define_const(module, "GL_COLOR_TABLE_INTENSITY_SIZE_SGI", INT2NUM(GL_COLOR_TABLE_INTENSITY_SIZE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_LUMINANCE_SIZE", INT2NUM(GL_COLOR_TABLE_LUMINANCE_SIZE)); + rb_define_const(module, "GL_COLOR_TABLE_LUMINANCE_SIZE_SGI", INT2NUM(GL_COLOR_TABLE_LUMINANCE_SIZE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_RED_SIZE", INT2NUM(GL_COLOR_TABLE_RED_SIZE)); + rb_define_const(module, "GL_COLOR_TABLE_RED_SIZE_SGI", INT2NUM(GL_COLOR_TABLE_RED_SIZE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_SCALE", INT2NUM(GL_COLOR_TABLE_SCALE)); + rb_define_const(module, "GL_COLOR_TABLE_SCALE_SGI", INT2NUM(GL_COLOR_TABLE_SCALE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_SGI", INT2NUM(GL_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_COLOR_TABLE_WIDTH", INT2NUM(GL_COLOR_TABLE_WIDTH)); + rb_define_const(module, "GL_COLOR_TABLE_WIDTH_SGI", INT2NUM(GL_COLOR_TABLE_WIDTH_SGI)); + rb_define_const(module, "GL_COLOR_WRITEMASK", INT2NUM(GL_COLOR_WRITEMASK)); + rb_define_const(module, "GL_COMBINE4_NV", INT2NUM(GL_COMBINE4_NV)); + rb_define_const(module, "GL_COMBINE_ALPHA_ARB", INT2NUM(GL_COMBINE_ALPHA_ARB)); + rb_define_const(module, "GL_COMBINE_ALPHA_EXT", INT2NUM(GL_COMBINE_ALPHA_EXT)); + rb_define_const(module, "GL_COMBINE_ALPHA", INT2NUM(GL_COMBINE_ALPHA)); + rb_define_const(module, "GL_COMBINE_ARB", INT2NUM(GL_COMBINE_ARB)); + rb_define_const(module, "GL_COMBINE_EXT", INT2NUM(GL_COMBINE_EXT)); + rb_define_const(module, "GL_COMBINE", INT2NUM(GL_COMBINE)); + rb_define_const(module, "GL_COMBINER0_NV", INT2NUM(GL_COMBINER0_NV)); + rb_define_const(module, "GL_COMBINER1_NV", INT2NUM(GL_COMBINER1_NV)); + rb_define_const(module, "GL_COMBINER2_NV", INT2NUM(GL_COMBINER2_NV)); + rb_define_const(module, "GL_COMBINER3_NV", INT2NUM(GL_COMBINER3_NV)); + rb_define_const(module, "GL_COMBINER4_NV", INT2NUM(GL_COMBINER4_NV)); + rb_define_const(module, "GL_COMBINER5_NV", INT2NUM(GL_COMBINER5_NV)); + rb_define_const(module, "GL_COMBINER6_NV", INT2NUM(GL_COMBINER6_NV)); + rb_define_const(module, "GL_COMBINER7_NV", INT2NUM(GL_COMBINER7_NV)); + rb_define_const(module, "GL_COMBINER_AB_DOT_PRODUCT_NV", INT2NUM(GL_COMBINER_AB_DOT_PRODUCT_NV)); + rb_define_const(module, "GL_COMBINER_AB_OUTPUT_NV", INT2NUM(GL_COMBINER_AB_OUTPUT_NV)); + rb_define_const(module, "GL_COMBINER_BIAS_NV", INT2NUM(GL_COMBINER_BIAS_NV)); + rb_define_const(module, "GL_COMBINER_CD_DOT_PRODUCT_NV", INT2NUM(GL_COMBINER_CD_DOT_PRODUCT_NV)); + rb_define_const(module, "GL_COMBINER_CD_OUTPUT_NV", INT2NUM(GL_COMBINER_CD_OUTPUT_NV)); + rb_define_const(module, "GL_COMBINER_COMPONENT_USAGE_NV", INT2NUM(GL_COMBINER_COMPONENT_USAGE_NV)); + rb_define_const(module, "GL_COMBINE_RGB_ARB", INT2NUM(GL_COMBINE_RGB_ARB)); + rb_define_const(module, "GL_COMBINE_RGB_EXT", INT2NUM(GL_COMBINE_RGB_EXT)); + rb_define_const(module, "GL_COMBINE_RGB", INT2NUM(GL_COMBINE_RGB)); + rb_define_const(module, "GL_COMBINER_INPUT_NV", INT2NUM(GL_COMBINER_INPUT_NV)); + rb_define_const(module, "GL_COMBINER_MAPPING_NV", INT2NUM(GL_COMBINER_MAPPING_NV)); + rb_define_const(module, "GL_COMBINER_MUX_SUM_NV", INT2NUM(GL_COMBINER_MUX_SUM_NV)); + rb_define_const(module, "GL_COMBINER_SCALE_NV", INT2NUM(GL_COMBINER_SCALE_NV)); + rb_define_const(module, "GL_COMBINER_SUM_OUTPUT_NV", INT2NUM(GL_COMBINER_SUM_OUTPUT_NV)); + rb_define_const(module, "GL_COMPARE_R_TO_TEXTURE", INT2NUM(GL_COMPARE_R_TO_TEXTURE)); + rb_define_const(module, "GL_COMP_BIT_ATI", INT2NUM(GL_COMP_BIT_ATI)); + rb_define_const(module, "GL_COMPILE_AND_EXECUTE", INT2NUM(GL_COMPILE_AND_EXECUTE)); + rb_define_const(module, "GL_COMPILE", INT2NUM(GL_COMPILE)); + rb_define_const(module, "GL_COMPILE_STATUS", INT2NUM(GL_COMPILE_STATUS)); + rb_define_const(module, "GL_COMPRESSED_ALPHA_ARB", INT2NUM(GL_COMPRESSED_ALPHA_ARB)); + rb_define_const(module, "GL_COMPRESSED_ALPHA", INT2NUM(GL_COMPRESSED_ALPHA)); + rb_define_const(module, "GL_COMPRESSED_INTENSITY_ARB", INT2NUM(GL_COMPRESSED_INTENSITY_ARB)); + rb_define_const(module, "GL_COMPRESSED_INTENSITY", INT2NUM(GL_COMPRESSED_INTENSITY)); + rb_define_const(module, "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", INT2NUM(GL_COMPRESSED_LUMINANCE_ALPHA_ARB)); + rb_define_const(module, "GL_COMPRESSED_LUMINANCE_ALPHA", INT2NUM(GL_COMPRESSED_LUMINANCE_ALPHA)); + rb_define_const(module, "GL_COMPRESSED_LUMINANCE_ARB", INT2NUM(GL_COMPRESSED_LUMINANCE_ARB)); + rb_define_const(module, "GL_COMPRESSED_LUMINANCE", INT2NUM(GL_COMPRESSED_LUMINANCE)); + rb_define_const(module, "GL_COMPRESSED_RGBA_ARB", INT2NUM(GL_COMPRESSED_RGBA_ARB)); + rb_define_const(module, "GL_COMPRESSED_RGBA_FXT1_3DFX", INT2NUM(GL_COMPRESSED_RGBA_FXT1_3DFX)); + rb_define_const(module, "GL_COMPRESSED_RGBA", INT2NUM(GL_COMPRESSED_RGBA)); + rb_define_const(module, "GL_COMPRESSED_RGB_ARB", INT2NUM(GL_COMPRESSED_RGB_ARB)); + rb_define_const(module, "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", INT2NUM(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)); + rb_define_const(module, "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT", INT2NUM(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT)); + rb_define_const(module, "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT", INT2NUM(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)); + rb_define_const(module, "GL_COMPRESSED_RGB_FXT1_3DFX", INT2NUM(GL_COMPRESSED_RGB_FXT1_3DFX)); + rb_define_const(module, "GL_COMPRESSED_RGB", INT2NUM(GL_COMPRESSED_RGB)); + rb_define_const(module, "GL_COMPRESSED_RGB_S3TC_DXT1_EXT", INT2NUM(GL_COMPRESSED_RGB_S3TC_DXT1_EXT)); + rb_define_const(module, "GL_COMPRESSED_SLUMINANCE_ALPHA_EXT", INT2NUM(GL_COMPRESSED_SLUMINANCE_ALPHA_EXT)); + rb_define_const(module, "GL_COMPRESSED_SLUMINANCE_ALPHA", INT2NUM(GL_COMPRESSED_SLUMINANCE_ALPHA)); + rb_define_const(module, "GL_COMPRESSED_SLUMINANCE_EXT", INT2NUM(GL_COMPRESSED_SLUMINANCE_EXT)); + rb_define_const(module, "GL_COMPRESSED_SLUMINANCE", INT2NUM(GL_COMPRESSED_SLUMINANCE)); + rb_define_const(module, "GL_COMPRESSED_SRGB_ALPHA_EXT", INT2NUM(GL_COMPRESSED_SRGB_ALPHA_EXT)); + rb_define_const(module, "GL_COMPRESSED_SRGB_ALPHA", INT2NUM(GL_COMPRESSED_SRGB_ALPHA)); + rb_define_const(module, "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", INT2NUM(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT)); + rb_define_const(module, "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", INT2NUM(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT)); + rb_define_const(module, "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", INT2NUM(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT)); + rb_define_const(module, "GL_COMPRESSED_SRGB_EXT", INT2NUM(GL_COMPRESSED_SRGB_EXT)); + rb_define_const(module, "GL_COMPRESSED_SRGB", INT2NUM(GL_COMPRESSED_SRGB)); + rb_define_const(module, "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT", INT2NUM(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT)); + rb_define_const(module, "GL_COMPRESSED_TEXTURE_FORMATS_ARB", INT2NUM(GL_COMPRESSED_TEXTURE_FORMATS_ARB)); + rb_define_const(module, "GL_COMPRESSED_TEXTURE_FORMATS", INT2NUM(GL_COMPRESSED_TEXTURE_FORMATS)); + rb_define_const(module, "GL_CON_0_ATI", INT2NUM(GL_CON_0_ATI)); + rb_define_const(module, "GL_CON_10_ATI", INT2NUM(GL_CON_10_ATI)); + rb_define_const(module, "GL_CON_11_ATI", INT2NUM(GL_CON_11_ATI)); + rb_define_const(module, "GL_CON_12_ATI", INT2NUM(GL_CON_12_ATI)); + rb_define_const(module, "GL_CON_13_ATI", INT2NUM(GL_CON_13_ATI)); + rb_define_const(module, "GL_CON_14_ATI", INT2NUM(GL_CON_14_ATI)); + rb_define_const(module, "GL_CON_15_ATI", INT2NUM(GL_CON_15_ATI)); + rb_define_const(module, "GL_CON_16_ATI", INT2NUM(GL_CON_16_ATI)); + rb_define_const(module, "GL_CON_17_ATI", INT2NUM(GL_CON_17_ATI)); + rb_define_const(module, "GL_CON_18_ATI", INT2NUM(GL_CON_18_ATI)); + rb_define_const(module, "GL_CON_19_ATI", INT2NUM(GL_CON_19_ATI)); + rb_define_const(module, "GL_CON_1_ATI", INT2NUM(GL_CON_1_ATI)); + rb_define_const(module, "GL_CON_20_ATI", INT2NUM(GL_CON_20_ATI)); + rb_define_const(module, "GL_CON_21_ATI", INT2NUM(GL_CON_21_ATI)); + rb_define_const(module, "GL_CON_22_ATI", INT2NUM(GL_CON_22_ATI)); + rb_define_const(module, "GL_CON_23_ATI", INT2NUM(GL_CON_23_ATI)); + rb_define_const(module, "GL_CON_24_ATI", INT2NUM(GL_CON_24_ATI)); + rb_define_const(module, "GL_CON_25_ATI", INT2NUM(GL_CON_25_ATI)); + rb_define_const(module, "GL_CON_26_ATI", INT2NUM(GL_CON_26_ATI)); + rb_define_const(module, "GL_CON_27_ATI", INT2NUM(GL_CON_27_ATI)); + rb_define_const(module, "GL_CON_28_ATI", INT2NUM(GL_CON_28_ATI)); + rb_define_const(module, "GL_CON_29_ATI", INT2NUM(GL_CON_29_ATI)); + rb_define_const(module, "GL_CON_2_ATI", INT2NUM(GL_CON_2_ATI)); + rb_define_const(module, "GL_CON_30_ATI", INT2NUM(GL_CON_30_ATI)); + rb_define_const(module, "GL_CON_31_ATI", INT2NUM(GL_CON_31_ATI)); + rb_define_const(module, "GL_CON_3_ATI", INT2NUM(GL_CON_3_ATI)); + rb_define_const(module, "GL_CON_4_ATI", INT2NUM(GL_CON_4_ATI)); + rb_define_const(module, "GL_CON_5_ATI", INT2NUM(GL_CON_5_ATI)); + rb_define_const(module, "GL_CON_6_ATI", INT2NUM(GL_CON_6_ATI)); + rb_define_const(module, "GL_CON_7_ATI", INT2NUM(GL_CON_7_ATI)); + rb_define_const(module, "GL_CON_8_ATI", INT2NUM(GL_CON_8_ATI)); + rb_define_const(module, "GL_CON_9_ATI", INT2NUM(GL_CON_9_ATI)); + rb_define_const(module, "GL_CONSERVE_MEMORY_HINT_PGI", INT2NUM(GL_CONSERVE_MEMORY_HINT_PGI)); + rb_define_const(module, "GL_CONSTANT_ALPHA_EXT", INT2NUM(GL_CONSTANT_ALPHA_EXT)); + rb_define_const(module, "GL_CONSTANT_ALPHA", INT2NUM(GL_CONSTANT_ALPHA)); + rb_define_const(module, "GL_CONSTANT_ARB", INT2NUM(GL_CONSTANT_ARB)); + rb_define_const(module, "GL_CONSTANT_ATTENUATION", INT2NUM(GL_CONSTANT_ATTENUATION)); + rb_define_const(module, "GL_CONSTANT_BORDER_HP", INT2NUM(GL_CONSTANT_BORDER_HP)); + rb_define_const(module, "GL_CONSTANT_BORDER", INT2NUM(GL_CONSTANT_BORDER)); + rb_define_const(module, "GL_CONSTANT_COLOR0_NV", INT2NUM(GL_CONSTANT_COLOR0_NV)); + rb_define_const(module, "GL_CONSTANT_COLOR1_NV", INT2NUM(GL_CONSTANT_COLOR1_NV)); + rb_define_const(module, "GL_CONSTANT_COLOR_EXT", INT2NUM(GL_CONSTANT_COLOR_EXT)); + rb_define_const(module, "GL_CONSTANT_COLOR", INT2NUM(GL_CONSTANT_COLOR)); + rb_define_const(module, "GL_CONSTANT_EXT", INT2NUM(GL_CONSTANT_EXT)); + rb_define_const(module, "GL_CONSTANT", INT2NUM(GL_CONSTANT)); + rb_define_const(module, "GL_CONST_EYE_NV", INT2NUM(GL_CONST_EYE_NV)); + rb_define_const(module, "GL_CONVOLUTION_1D_EXT", INT2NUM(GL_CONVOLUTION_1D_EXT)); + rb_define_const(module, "GL_CONVOLUTION_1D", INT2NUM(GL_CONVOLUTION_1D)); + rb_define_const(module, "GL_CONVOLUTION_2D_EXT", INT2NUM(GL_CONVOLUTION_2D_EXT)); + rb_define_const(module, "GL_CONVOLUTION_2D", INT2NUM(GL_CONVOLUTION_2D)); + rb_define_const(module, "GL_CONVOLUTION_BORDER_COLOR_HP", INT2NUM(GL_CONVOLUTION_BORDER_COLOR_HP)); + rb_define_const(module, "GL_CONVOLUTION_BORDER_COLOR", INT2NUM(GL_CONVOLUTION_BORDER_COLOR)); + rb_define_const(module, "GL_CONVOLUTION_BORDER_MODE_EXT", INT2NUM(GL_CONVOLUTION_BORDER_MODE_EXT)); + rb_define_const(module, "GL_CONVOLUTION_BORDER_MODE", INT2NUM(GL_CONVOLUTION_BORDER_MODE)); + rb_define_const(module, "GL_CONVOLUTION_FILTER_BIAS_EXT", INT2NUM(GL_CONVOLUTION_FILTER_BIAS_EXT)); + rb_define_const(module, "GL_CONVOLUTION_FILTER_BIAS", INT2NUM(GL_CONVOLUTION_FILTER_BIAS)); + rb_define_const(module, "GL_CONVOLUTION_FILTER_SCALE_EXT", INT2NUM(GL_CONVOLUTION_FILTER_SCALE_EXT)); + rb_define_const(module, "GL_CONVOLUTION_FILTER_SCALE", INT2NUM(GL_CONVOLUTION_FILTER_SCALE)); + rb_define_const(module, "GL_CONVOLUTION_FORMAT_EXT", INT2NUM(GL_CONVOLUTION_FORMAT_EXT)); + rb_define_const(module, "GL_CONVOLUTION_FORMAT", INT2NUM(GL_CONVOLUTION_FORMAT)); + rb_define_const(module, "GL_CONVOLUTION_HEIGHT_EXT", INT2NUM(GL_CONVOLUTION_HEIGHT_EXT)); + rb_define_const(module, "GL_CONVOLUTION_HEIGHT", INT2NUM(GL_CONVOLUTION_HEIGHT)); + rb_define_const(module, "GL_CONVOLUTION_HINT_SGIX", INT2NUM(GL_CONVOLUTION_HINT_SGIX)); + rb_define_const(module, "GL_CONVOLUTION_WIDTH_EXT", INT2NUM(GL_CONVOLUTION_WIDTH_EXT)); + rb_define_const(module, "GL_CONVOLUTION_WIDTH", INT2NUM(GL_CONVOLUTION_WIDTH)); + rb_define_const(module, "GL_COORD_REPLACE_ARB", INT2NUM(GL_COORD_REPLACE_ARB)); + rb_define_const(module, "GL_COORD_REPLACE", INT2NUM(GL_COORD_REPLACE)); + rb_define_const(module, "GL_COORD_REPLACE_NV", INT2NUM(GL_COORD_REPLACE_NV)); + rb_define_const(module, "GL_COPY", INT2NUM(GL_COPY)); + rb_define_const(module, "GL_COPY_INVERTED", INT2NUM(GL_COPY_INVERTED)); + rb_define_const(module, "GL_COPY_PIXEL_TOKEN", INT2NUM(GL_COPY_PIXEL_TOKEN)); + rb_define_const(module, "GL_CUBIC_EXT", INT2NUM(GL_CUBIC_EXT)); + rb_define_const(module, "GL_CUBIC_HP", INT2NUM(GL_CUBIC_HP)); + rb_define_const(module, "GL_CULL_FACE", INT2NUM(GL_CULL_FACE)); + rb_define_const(module, "GL_CULL_FACE_MODE", INT2NUM(GL_CULL_FACE_MODE)); + rb_define_const(module, "GL_CULL_FRAGMENT_NV", INT2NUM(GL_CULL_FRAGMENT_NV)); + rb_define_const(module, "GL_CULL_MODES_NV", INT2NUM(GL_CULL_MODES_NV)); + rb_define_const(module, "GL_CULL_VERTEX_EXT", INT2NUM(GL_CULL_VERTEX_EXT)); + rb_define_const(module, "GL_CULL_VERTEX_EYE_POSITION_EXT", INT2NUM(GL_CULL_VERTEX_EYE_POSITION_EXT)); + rb_define_const(module, "GL_CULL_VERTEX_IBM", INT2NUM(GL_CULL_VERTEX_IBM)); + rb_define_const(module, "GL_CULL_VERTEX_OBJECT_POSITION_EXT", INT2NUM(GL_CULL_VERTEX_OBJECT_POSITION_EXT)); + rb_define_const(module, "GL_CURRENT_ATTRIB_NV", INT2NUM(GL_CURRENT_ATTRIB_NV)); + rb_define_const(module, "GL_CURRENT_BINORMAL_EXT", INT2NUM(GL_CURRENT_BINORMAL_EXT)); + rb_define_const(module, "GL_CURRENT_BIT", INT2NUM(GL_CURRENT_BIT)); + rb_define_const(module, "GL_CURRENT_COLOR", INT2NUM(GL_CURRENT_COLOR)); + rb_define_const(module, "GL_CURRENT_FOG_COORDINATE_EXT", INT2NUM(GL_CURRENT_FOG_COORDINATE_EXT)); + rb_define_const(module, "GL_CURRENT_FOG_COORDINATE", INT2NUM(GL_CURRENT_FOG_COORDINATE)); + rb_define_const(module, "GL_CURRENT_FOG_COORD", INT2NUM(GL_CURRENT_FOG_COORD)); + rb_define_const(module, "GL_CURRENT_INDEX", INT2NUM(GL_CURRENT_INDEX)); + rb_define_const(module, "GL_CURRENT_MATRIX_ARB", INT2NUM(GL_CURRENT_MATRIX_ARB)); + rb_define_const(module, "GL_CURRENT_MATRIX_INDEX_ARB", INT2NUM(GL_CURRENT_MATRIX_INDEX_ARB)); + rb_define_const(module, "GL_CURRENT_MATRIX_NV", INT2NUM(GL_CURRENT_MATRIX_NV)); + rb_define_const(module, "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", INT2NUM(GL_CURRENT_MATRIX_STACK_DEPTH_ARB)); + rb_define_const(module, "GL_CURRENT_MATRIX_STACK_DEPTH_NV", INT2NUM(GL_CURRENT_MATRIX_STACK_DEPTH_NV)); + rb_define_const(module, "GL_CURRENT_NORMAL", INT2NUM(GL_CURRENT_NORMAL)); + rb_define_const(module, "GL_CURRENT_OCCLUSION_QUERY_ID_NV", INT2NUM(GL_CURRENT_OCCLUSION_QUERY_ID_NV)); + rb_define_const(module, "GL_CURRENT_PALETTE_MATRIX_ARB", INT2NUM(GL_CURRENT_PALETTE_MATRIX_ARB)); + rb_define_const(module, "GL_CURRENT_PROGRAM", INT2NUM(GL_CURRENT_PROGRAM)); + rb_define_const(module, "GL_CURRENT_QUERY_ARB", INT2NUM(GL_CURRENT_QUERY_ARB)); + rb_define_const(module, "GL_CURRENT_QUERY", INT2NUM(GL_CURRENT_QUERY)); + rb_define_const(module, "GL_CURRENT_RASTER_COLOR", INT2NUM(GL_CURRENT_RASTER_COLOR)); + rb_define_const(module, "GL_CURRENT_RASTER_DISTANCE", INT2NUM(GL_CURRENT_RASTER_DISTANCE)); + rb_define_const(module, "GL_CURRENT_RASTER_INDEX", INT2NUM(GL_CURRENT_RASTER_INDEX)); + rb_define_const(module, "GL_CURRENT_RASTER_NORMAL_SGIX", INT2NUM(GL_CURRENT_RASTER_NORMAL_SGIX)); + rb_define_const(module, "GL_CURRENT_RASTER_POSITION", INT2NUM(GL_CURRENT_RASTER_POSITION)); + rb_define_const(module, "GL_CURRENT_RASTER_POSITION_VALID", INT2NUM(GL_CURRENT_RASTER_POSITION_VALID)); + rb_define_const(module, "GL_CURRENT_RASTER_SECONDARY_COLOR", INT2NUM(GL_CURRENT_RASTER_SECONDARY_COLOR)); + rb_define_const(module, "GL_CURRENT_RASTER_TEXTURE_COORDS", INT2NUM(GL_CURRENT_RASTER_TEXTURE_COORDS)); + rb_define_const(module, "GL_CURRENT_SECONDARY_COLOR_EXT", INT2NUM(GL_CURRENT_SECONDARY_COLOR_EXT)); + rb_define_const(module, "GL_CURRENT_SECONDARY_COLOR", INT2NUM(GL_CURRENT_SECONDARY_COLOR)); + rb_define_const(module, "GL_CURRENT_TANGENT_EXT", INT2NUM(GL_CURRENT_TANGENT_EXT)); + rb_define_const(module, "GL_CURRENT_TEXTURE_COORDS", INT2NUM(GL_CURRENT_TEXTURE_COORDS)); + rb_define_const(module, "GL_CURRENT_VERTEX_ATTRIB_ARB", INT2NUM(GL_CURRENT_VERTEX_ATTRIB_ARB)); + rb_define_const(module, "GL_CURRENT_VERTEX_ATTRIB", INT2NUM(GL_CURRENT_VERTEX_ATTRIB)); + rb_define_const(module, "GL_CURRENT_VERTEX_EXT", INT2NUM(GL_CURRENT_VERTEX_EXT)); + rb_define_const(module, "GL_CURRENT_VERTEX_WEIGHT_EXT", INT2NUM(GL_CURRENT_VERTEX_WEIGHT_EXT)); + rb_define_const(module, "GL_CURRENT_WEIGHT_ARB", INT2NUM(GL_CURRENT_WEIGHT_ARB)); + rb_define_const(module, "GL_CW", INT2NUM(GL_CW)); + rb_define_const(module, "GL_DECAL", INT2NUM(GL_DECAL)); + rb_define_const(module, "GL_DECR", INT2NUM(GL_DECR)); + rb_define_const(module, "GL_DECR_WRAP_EXT", INT2NUM(GL_DECR_WRAP_EXT)); + rb_define_const(module, "GL_DECR_WRAP", INT2NUM(GL_DECR_WRAP)); + rb_define_const(module, "GL_DEFORMATIONS_MASK_SGIX", INT2NUM(GL_DEFORMATIONS_MASK_SGIX)); + rb_define_const(module, "GL_DELETE_STATUS", INT2NUM(GL_DELETE_STATUS)); + rb_define_const(module, "GL_DEPENDENT_AR_TEXTURE_2D_NV", INT2NUM(GL_DEPENDENT_AR_TEXTURE_2D_NV)); + rb_define_const(module, "GL_DEPENDENT_GB_TEXTURE_2D_NV", INT2NUM(GL_DEPENDENT_GB_TEXTURE_2D_NV)); + rb_define_const(module, "GL_DEPENDENT_HILO_TEXTURE_2D_NV", INT2NUM(GL_DEPENDENT_HILO_TEXTURE_2D_NV)); + rb_define_const(module, "GL_DEPENDENT_RGB_TEXTURE_3D_NV", INT2NUM(GL_DEPENDENT_RGB_TEXTURE_3D_NV)); + rb_define_const(module, "GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV", INT2NUM(GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV)); + rb_define_const(module, "GL_DEPTH24_STENCIL8_EXT", INT2NUM(GL_DEPTH24_STENCIL8_EXT)); + rb_define_const(module, "GL_DEPTH_ATTACHMENT_EXT", INT2NUM(GL_DEPTH_ATTACHMENT_EXT)); + rb_define_const(module, "GL_DEPTH_BIAS", INT2NUM(GL_DEPTH_BIAS)); + rb_define_const(module, "GL_DEPTH_BITS", INT2NUM(GL_DEPTH_BITS)); + rb_define_const(module, "GL_DEPTH_BOUNDS_EXT", INT2NUM(GL_DEPTH_BOUNDS_EXT)); + rb_define_const(module, "GL_DEPTH_BOUNDS_TEST_EXT", INT2NUM(GL_DEPTH_BOUNDS_TEST_EXT)); + rb_define_const(module, "GL_DEPTH_BUFFER_BIT", INT2NUM(GL_DEPTH_BUFFER_BIT)); + rb_define_const(module, "GL_DEPTH_CLAMP_NV", INT2NUM(GL_DEPTH_CLAMP_NV)); + rb_define_const(module, "GL_DEPTH_CLEAR_VALUE", INT2NUM(GL_DEPTH_CLEAR_VALUE)); + rb_define_const(module, "GL_DEPTH_COMPONENT16_ARB", INT2NUM(GL_DEPTH_COMPONENT16_ARB)); + rb_define_const(module, "GL_DEPTH_COMPONENT16", INT2NUM(GL_DEPTH_COMPONENT16)); + rb_define_const(module, "GL_DEPTH_COMPONENT16_SGIX", INT2NUM(GL_DEPTH_COMPONENT16_SGIX)); + rb_define_const(module, "GL_DEPTH_COMPONENT24_ARB", INT2NUM(GL_DEPTH_COMPONENT24_ARB)); + rb_define_const(module, "GL_DEPTH_COMPONENT24", INT2NUM(GL_DEPTH_COMPONENT24)); + rb_define_const(module, "GL_DEPTH_COMPONENT24_SGIX", INT2NUM(GL_DEPTH_COMPONENT24_SGIX)); + rb_define_const(module, "GL_DEPTH_COMPONENT32_ARB", INT2NUM(GL_DEPTH_COMPONENT32_ARB)); + rb_define_const(module, "GL_DEPTH_COMPONENT32", INT2NUM(GL_DEPTH_COMPONENT32)); + rb_define_const(module, "GL_DEPTH_COMPONENT32_SGIX", INT2NUM(GL_DEPTH_COMPONENT32_SGIX)); + rb_define_const(module, "GL_DEPTH_COMPONENT", INT2NUM(GL_DEPTH_COMPONENT)); + rb_define_const(module, "GL_DEPTH_FUNC", INT2NUM(GL_DEPTH_FUNC)); + rb_define_const(module, "GL_DEPTH", INT2NUM(GL_DEPTH)); + rb_define_const(module, "GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX", INT2NUM(GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX)); + rb_define_const(module, "GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX", INT2NUM(GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX)); + rb_define_const(module, "GL_DEPTH_PASS_INSTRUMENT_SGIX", INT2NUM(GL_DEPTH_PASS_INSTRUMENT_SGIX)); + rb_define_const(module, "GL_DEPTH_RANGE", INT2NUM(GL_DEPTH_RANGE)); + rb_define_const(module, "GL_DEPTH_SCALE", INT2NUM(GL_DEPTH_SCALE)); + rb_define_const(module, "GL_DEPTH_STENCIL_EXT", INT2NUM(GL_DEPTH_STENCIL_EXT)); + rb_define_const(module, "GL_DEPTH_STENCIL_NV", INT2NUM(GL_DEPTH_STENCIL_NV)); + rb_define_const(module, "GL_DEPTH_STENCIL_TO_BGRA_NV", INT2NUM(GL_DEPTH_STENCIL_TO_BGRA_NV)); + rb_define_const(module, "GL_DEPTH_STENCIL_TO_RGBA_NV", INT2NUM(GL_DEPTH_STENCIL_TO_RGBA_NV)); + rb_define_const(module, "GL_DEPTH_TEST", INT2NUM(GL_DEPTH_TEST)); + rb_define_const(module, "GL_DEPTH_TEXTURE_MODE_ARB", INT2NUM(GL_DEPTH_TEXTURE_MODE_ARB)); + rb_define_const(module, "GL_DEPTH_TEXTURE_MODE", INT2NUM(GL_DEPTH_TEXTURE_MODE)); + rb_define_const(module, "GL_DEPTH_WRITEMASK", INT2NUM(GL_DEPTH_WRITEMASK)); + rb_define_const(module, "GL_DETAIL_TEXTURE_2D_BINDING_SGIS", INT2NUM(GL_DETAIL_TEXTURE_2D_BINDING_SGIS)); + rb_define_const(module, "GL_DETAIL_TEXTURE_2D_SGIS", INT2NUM(GL_DETAIL_TEXTURE_2D_SGIS)); + rb_define_const(module, "GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS", INT2NUM(GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS)); + rb_define_const(module, "GL_DETAIL_TEXTURE_LEVEL_SGIS", INT2NUM(GL_DETAIL_TEXTURE_LEVEL_SGIS)); + rb_define_const(module, "GL_DETAIL_TEXTURE_MODE_SGIS", INT2NUM(GL_DETAIL_TEXTURE_MODE_SGIS)); + rb_define_const(module, "GL_DIFFUSE", INT2NUM(GL_DIFFUSE)); + rb_define_const(module, "GL_DISCARD_ATI", INT2NUM(GL_DISCARD_ATI)); + rb_define_const(module, "GL_DISCARD_NV", INT2NUM(GL_DISCARD_NV)); + rb_define_const(module, "GL_DISTANCE_ATTENUATION_EXT", INT2NUM(GL_DISTANCE_ATTENUATION_EXT)); + rb_define_const(module, "GL_DISTANCE_ATTENUATION_SGIS", INT2NUM(GL_DISTANCE_ATTENUATION_SGIS)); + rb_define_const(module, "GL_DITHER", INT2NUM(GL_DITHER)); + rb_define_const(module, "GL_DOMAIN", INT2NUM(GL_DOMAIN)); + rb_define_const(module, "GL_DONT_CARE", INT2NUM(GL_DONT_CARE)); + rb_define_const(module, "GL_DOT2_ADD_ATI", INT2NUM(GL_DOT2_ADD_ATI)); + rb_define_const(module, "GL_DOT3_ATI", INT2NUM(GL_DOT3_ATI)); + rb_define_const(module, "GL_DOT3_RGBA_ARB", INT2NUM(GL_DOT3_RGBA_ARB)); + rb_define_const(module, "GL_DOT3_RGBA_EXT", INT2NUM(GL_DOT3_RGBA_EXT)); + rb_define_const(module, "GL_DOT3_RGBA", INT2NUM(GL_DOT3_RGBA)); + rb_define_const(module, "GL_DOT3_RGB_ARB", INT2NUM(GL_DOT3_RGB_ARB)); + rb_define_const(module, "GL_DOT3_RGB_EXT", INT2NUM(GL_DOT3_RGB_EXT)); + rb_define_const(module, "GL_DOT3_RGB", INT2NUM(GL_DOT3_RGB)); + rb_define_const(module, "GL_DOT4_ATI", INT2NUM(GL_DOT4_ATI)); + rb_define_const(module, "GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV", INT2NUM(GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV", INT2NUM(GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_DEPTH_REPLACE_NV", INT2NUM(GL_DOT_PRODUCT_DEPTH_REPLACE_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV", INT2NUM(GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_NV", INT2NUM(GL_DOT_PRODUCT_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_PASS_THROUGH_NV", INT2NUM(GL_DOT_PRODUCT_PASS_THROUGH_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV", INT2NUM(GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_TEXTURE_1D_NV", INT2NUM(GL_DOT_PRODUCT_TEXTURE_1D_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_TEXTURE_2D_NV", INT2NUM(GL_DOT_PRODUCT_TEXTURE_2D_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_TEXTURE_3D_NV", INT2NUM(GL_DOT_PRODUCT_TEXTURE_3D_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV", INT2NUM(GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV)); + rb_define_const(module, "GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV", INT2NUM(GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_DOUBLEBUFFER", INT2NUM(GL_DOUBLEBUFFER)); + rb_define_const(module, "GL_DOUBLE_EXT", INT2NUM(GL_DOUBLE_EXT)); + rb_define_const(module, "GL_DOUBLE", INT2NUM(GL_DOUBLE)); + rb_define_const(module, "GL_DRAW_BUFFER0_ARB", INT2NUM(GL_DRAW_BUFFER0_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER0_ATI", INT2NUM(GL_DRAW_BUFFER0_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER0", INT2NUM(GL_DRAW_BUFFER0)); + rb_define_const(module, "GL_DRAW_BUFFER10_ARB", INT2NUM(GL_DRAW_BUFFER10_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER10_ATI", INT2NUM(GL_DRAW_BUFFER10_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER10", INT2NUM(GL_DRAW_BUFFER10)); + rb_define_const(module, "GL_DRAW_BUFFER11_ARB", INT2NUM(GL_DRAW_BUFFER11_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER11_ATI", INT2NUM(GL_DRAW_BUFFER11_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER11", INT2NUM(GL_DRAW_BUFFER11)); + rb_define_const(module, "GL_DRAW_BUFFER12_ARB", INT2NUM(GL_DRAW_BUFFER12_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER12_ATI", INT2NUM(GL_DRAW_BUFFER12_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER12", INT2NUM(GL_DRAW_BUFFER12)); + rb_define_const(module, "GL_DRAW_BUFFER13_ARB", INT2NUM(GL_DRAW_BUFFER13_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER13_ATI", INT2NUM(GL_DRAW_BUFFER13_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER13", INT2NUM(GL_DRAW_BUFFER13)); + rb_define_const(module, "GL_DRAW_BUFFER14_ARB", INT2NUM(GL_DRAW_BUFFER14_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER14_ATI", INT2NUM(GL_DRAW_BUFFER14_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER14", INT2NUM(GL_DRAW_BUFFER14)); + rb_define_const(module, "GL_DRAW_BUFFER15_ARB", INT2NUM(GL_DRAW_BUFFER15_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER15_ATI", INT2NUM(GL_DRAW_BUFFER15_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER15", INT2NUM(GL_DRAW_BUFFER15)); + rb_define_const(module, "GL_DRAW_BUFFER1_ARB", INT2NUM(GL_DRAW_BUFFER1_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER1_ATI", INT2NUM(GL_DRAW_BUFFER1_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER1", INT2NUM(GL_DRAW_BUFFER1)); + rb_define_const(module, "GL_DRAW_BUFFER2_ARB", INT2NUM(GL_DRAW_BUFFER2_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER2_ATI", INT2NUM(GL_DRAW_BUFFER2_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER2", INT2NUM(GL_DRAW_BUFFER2)); + rb_define_const(module, "GL_DRAW_BUFFER3_ARB", INT2NUM(GL_DRAW_BUFFER3_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER3_ATI", INT2NUM(GL_DRAW_BUFFER3_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER3", INT2NUM(GL_DRAW_BUFFER3)); + rb_define_const(module, "GL_DRAW_BUFFER4_ARB", INT2NUM(GL_DRAW_BUFFER4_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER4_ATI", INT2NUM(GL_DRAW_BUFFER4_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER4", INT2NUM(GL_DRAW_BUFFER4)); + rb_define_const(module, "GL_DRAW_BUFFER5_ARB", INT2NUM(GL_DRAW_BUFFER5_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER5_ATI", INT2NUM(GL_DRAW_BUFFER5_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER5", INT2NUM(GL_DRAW_BUFFER5)); + rb_define_const(module, "GL_DRAW_BUFFER6_ARB", INT2NUM(GL_DRAW_BUFFER6_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER6_ATI", INT2NUM(GL_DRAW_BUFFER6_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER6", INT2NUM(GL_DRAW_BUFFER6)); + rb_define_const(module, "GL_DRAW_BUFFER7_ARB", INT2NUM(GL_DRAW_BUFFER7_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER7_ATI", INT2NUM(GL_DRAW_BUFFER7_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER7", INT2NUM(GL_DRAW_BUFFER7)); + rb_define_const(module, "GL_DRAW_BUFFER8_ARB", INT2NUM(GL_DRAW_BUFFER8_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER8_ATI", INT2NUM(GL_DRAW_BUFFER8_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER8", INT2NUM(GL_DRAW_BUFFER8)); + rb_define_const(module, "GL_DRAW_BUFFER9_ARB", INT2NUM(GL_DRAW_BUFFER9_ARB)); + rb_define_const(module, "GL_DRAW_BUFFER9_ATI", INT2NUM(GL_DRAW_BUFFER9_ATI)); + rb_define_const(module, "GL_DRAW_BUFFER9", INT2NUM(GL_DRAW_BUFFER9)); + rb_define_const(module, "GL_DRAW_BUFFER", INT2NUM(GL_DRAW_BUFFER)); + rb_define_const(module, "GL_DRAW_FRAMEBUFFER_BINDING_EXT", INT2NUM(GL_DRAW_FRAMEBUFFER_BINDING_EXT)); + rb_define_const(module, "GL_DRAW_FRAMEBUFFER_EXT", INT2NUM(GL_DRAW_FRAMEBUFFER_EXT)); + rb_define_const(module, "GL_DRAW_PIXELS_APPLE", INT2NUM(GL_DRAW_PIXELS_APPLE)); + rb_define_const(module, "GL_DRAW_PIXEL_TOKEN", INT2NUM(GL_DRAW_PIXEL_TOKEN)); + rb_define_const(module, "GL_DS_BIAS_NV", INT2NUM(GL_DS_BIAS_NV)); + rb_define_const(module, "GL_DSDT8_MAG8_INTENSITY8_NV", INT2NUM(GL_DSDT8_MAG8_INTENSITY8_NV)); + rb_define_const(module, "GL_DSDT8_MAG8_NV", INT2NUM(GL_DSDT8_MAG8_NV)); + rb_define_const(module, "GL_DSDT8_NV", INT2NUM(GL_DSDT8_NV)); + rb_define_const(module, "GL_DSDT_MAG_INTENSITY_NV", INT2NUM(GL_DSDT_MAG_INTENSITY_NV)); + rb_define_const(module, "GL_DSDT_MAG_NV", INT2NUM(GL_DSDT_MAG_NV)); + rb_define_const(module, "GL_DSDT_MAG_VIB_NV", INT2NUM(GL_DSDT_MAG_VIB_NV)); + rb_define_const(module, "GL_DSDT_NV", INT2NUM(GL_DSDT_NV)); + rb_define_const(module, "GL_DS_SCALE_NV", INT2NUM(GL_DS_SCALE_NV)); + rb_define_const(module, "GL_DST_ALPHA", INT2NUM(GL_DST_ALPHA)); + rb_define_const(module, "GL_DST_COLOR", INT2NUM(GL_DST_COLOR)); + rb_define_const(module, "GL_DT_BIAS_NV", INT2NUM(GL_DT_BIAS_NV)); + rb_define_const(module, "GL_DT_SCALE_NV", INT2NUM(GL_DT_SCALE_NV)); + rb_define_const(module, "GL_DU8DV8_ATI", INT2NUM(GL_DU8DV8_ATI)); + rb_define_const(module, "GL_DUAL_ALPHA12_SGIS", INT2NUM(GL_DUAL_ALPHA12_SGIS)); + rb_define_const(module, "GL_DUAL_ALPHA16_SGIS", INT2NUM(GL_DUAL_ALPHA16_SGIS)); + rb_define_const(module, "GL_DUAL_ALPHA4_SGIS", INT2NUM(GL_DUAL_ALPHA4_SGIS)); + rb_define_const(module, "GL_DUAL_ALPHA8_SGIS", INT2NUM(GL_DUAL_ALPHA8_SGIS)); + rb_define_const(module, "GL_DUAL_INTENSITY12_SGIS", INT2NUM(GL_DUAL_INTENSITY12_SGIS)); + rb_define_const(module, "GL_DUAL_INTENSITY16_SGIS", INT2NUM(GL_DUAL_INTENSITY16_SGIS)); + rb_define_const(module, "GL_DUAL_INTENSITY4_SGIS", INT2NUM(GL_DUAL_INTENSITY4_SGIS)); + rb_define_const(module, "GL_DUAL_INTENSITY8_SGIS", INT2NUM(GL_DUAL_INTENSITY8_SGIS)); + rb_define_const(module, "GL_DUAL_LUMINANCE12_SGIS", INT2NUM(GL_DUAL_LUMINANCE12_SGIS)); + rb_define_const(module, "GL_DUAL_LUMINANCE16_SGIS", INT2NUM(GL_DUAL_LUMINANCE16_SGIS)); + rb_define_const(module, "GL_DUAL_LUMINANCE4_SGIS", INT2NUM(GL_DUAL_LUMINANCE4_SGIS)); + rb_define_const(module, "GL_DUAL_LUMINANCE8_SGIS", INT2NUM(GL_DUAL_LUMINANCE8_SGIS)); + rb_define_const(module, "GL_DUAL_LUMINANCE_ALPHA4_SGIS", INT2NUM(GL_DUAL_LUMINANCE_ALPHA4_SGIS)); + rb_define_const(module, "GL_DUAL_LUMINANCE_ALPHA8_SGIS", INT2NUM(GL_DUAL_LUMINANCE_ALPHA8_SGIS)); + rb_define_const(module, "GL_DUAL_TEXTURE_SELECT_SGIS", INT2NUM(GL_DUAL_TEXTURE_SELECT_SGIS)); + rb_define_const(module, "GL_DUDV_ATI", INT2NUM(GL_DUDV_ATI)); + rb_define_const(module, "GL_DYNAMIC_ATI", INT2NUM(GL_DYNAMIC_ATI)); + rb_define_const(module, "GL_DYNAMIC_COPY_ARB", INT2NUM(GL_DYNAMIC_COPY_ARB)); + rb_define_const(module, "GL_DYNAMIC_COPY", INT2NUM(GL_DYNAMIC_COPY)); + rb_define_const(module, "GL_DYNAMIC_DRAW_ARB", INT2NUM(GL_DYNAMIC_DRAW_ARB)); + rb_define_const(module, "GL_DYNAMIC_DRAW", INT2NUM(GL_DYNAMIC_DRAW)); + rb_define_const(module, "GL_DYNAMIC_READ_ARB", INT2NUM(GL_DYNAMIC_READ_ARB)); + rb_define_const(module, "GL_DYNAMIC_READ", INT2NUM(GL_DYNAMIC_READ)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING", INT2NUM(GL_EDGE_FLAG_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_COUNT_EXT", INT2NUM(GL_EDGE_FLAG_ARRAY_COUNT_EXT)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_EXT", INT2NUM(GL_EDGE_FLAG_ARRAY_EXT)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY", INT2NUM(GL_EDGE_FLAG_ARRAY)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_LIST_IBM", INT2NUM(GL_EDGE_FLAG_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_POINTER_EXT", INT2NUM(GL_EDGE_FLAG_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_POINTER", INT2NUM(GL_EDGE_FLAG_ARRAY_POINTER)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_STRIDE_EXT", INT2NUM(GL_EDGE_FLAG_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_EDGE_FLAG_ARRAY_STRIDE", INT2NUM(GL_EDGE_FLAG_ARRAY_STRIDE)); + rb_define_const(module, "GL_EDGEFLAG_BIT_PGI", INT2NUM(GL_EDGEFLAG_BIT_PGI)); + rb_define_const(module, "GL_EDGE_FLAG", INT2NUM(GL_EDGE_FLAG)); + rb_define_const(module, "GL_EIGHTH_BIT_ATI", INT2NUM(GL_EIGHTH_BIT_ATI)); + rb_define_const(module, "GL_ELEMENT_ARRAY_APPLE", INT2NUM(GL_ELEMENT_ARRAY_APPLE)); + rb_define_const(module, "GL_ELEMENT_ARRAY_ATI", INT2NUM(GL_ELEMENT_ARRAY_ATI)); + rb_define_const(module, "GL_ELEMENT_ARRAY_BUFFER_ARB", INT2NUM(GL_ELEMENT_ARRAY_BUFFER_ARB)); + rb_define_const(module, "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_ELEMENT_ARRAY_BUFFER_BINDING", INT2NUM(GL_ELEMENT_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_ELEMENT_ARRAY_BUFFER", INT2NUM(GL_ELEMENT_ARRAY_BUFFER)); + rb_define_const(module, "GL_ELEMENT_ARRAY_POINTER_APPLE", INT2NUM(GL_ELEMENT_ARRAY_POINTER_APPLE)); + rb_define_const(module, "GL_ELEMENT_ARRAY_POINTER_ATI", INT2NUM(GL_ELEMENT_ARRAY_POINTER_ATI)); + rb_define_const(module, "GL_ELEMENT_ARRAY_TYPE_APPLE", INT2NUM(GL_ELEMENT_ARRAY_TYPE_APPLE)); + rb_define_const(module, "GL_ELEMENT_ARRAY_TYPE_ATI", INT2NUM(GL_ELEMENT_ARRAY_TYPE_ATI)); + rb_define_const(module, "GL_EMBOSS_CONSTANT_NV", INT2NUM(GL_EMBOSS_CONSTANT_NV)); + rb_define_const(module, "GL_EMBOSS_LIGHT_NV", INT2NUM(GL_EMBOSS_LIGHT_NV)); + rb_define_const(module, "GL_EMBOSS_MAP_NV", INT2NUM(GL_EMBOSS_MAP_NV)); + rb_define_const(module, "GL_EMISSION", INT2NUM(GL_EMISSION)); + rb_define_const(module, "GL_ENABLE_BIT", INT2NUM(GL_ENABLE_BIT)); + rb_define_const(module, "GL_EQUAL", INT2NUM(GL_EQUAL)); + rb_define_const(module, "GL_EQUIV", INT2NUM(GL_EQUIV)); + rb_define_const(module, "GL_E_TIMES_F_NV", INT2NUM(GL_E_TIMES_F_NV)); + rb_define_const(module, "GL_EVAL_2D_NV", INT2NUM(GL_EVAL_2D_NV)); + rb_define_const(module, "GL_EVAL_BIT", INT2NUM(GL_EVAL_BIT)); + rb_define_const(module, "GL_EVAL_FRACTIONAL_TESSELLATION_NV", INT2NUM(GL_EVAL_FRACTIONAL_TESSELLATION_NV)); + rb_define_const(module, "GL_EVAL_TRIANGULAR_2D_NV", INT2NUM(GL_EVAL_TRIANGULAR_2D_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB0_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB0_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB10_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB10_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB11_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB11_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB12_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB12_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB13_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB13_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB14_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB14_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB15_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB15_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB1_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB1_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB2_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB2_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB3_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB3_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB4_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB4_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB5_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB5_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB6_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB6_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB7_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB7_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB8_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB8_NV)); + rb_define_const(module, "GL_EVAL_VERTEX_ATTRIB9_NV", INT2NUM(GL_EVAL_VERTEX_ATTRIB9_NV)); + rb_define_const(module, "GL_EXP2", INT2NUM(GL_EXP2)); + rb_define_const(module, "GL_EXPAND_NEGATE_NV", INT2NUM(GL_EXPAND_NEGATE_NV)); + rb_define_const(module, "GL_EXPAND_NORMAL_NV", INT2NUM(GL_EXPAND_NORMAL_NV)); + rb_define_const(module, "GL_EXP", INT2NUM(GL_EXP)); + rb_define_const(module, "GL_EXT_abgr", INT2NUM(GL_EXT_abgr)); + rb_define_const(module, "GL_EXT_blend_color", INT2NUM(GL_EXT_blend_color)); + rb_define_const(module, "GL_EXT_blend_logic_op", INT2NUM(GL_EXT_blend_logic_op)); + rb_define_const(module, "GL_EXT_blend_minmax", INT2NUM(GL_EXT_blend_minmax)); + rb_define_const(module, "GL_EXT_blend_subtract", INT2NUM(GL_EXT_blend_subtract)); + rb_define_const(module, "GL_EXT_cmyka", INT2NUM(GL_EXT_cmyka)); + rb_define_const(module, "GL_EXT_convolution", INT2NUM(GL_EXT_convolution)); + rb_define_const(module, "GL_EXT_copy_texture", INT2NUM(GL_EXT_copy_texture)); + rb_define_const(module, "GL_EXTENSIONS", INT2NUM(GL_EXTENSIONS)); + rb_define_const(module, "GL_EXT_histogram", INT2NUM(GL_EXT_histogram)); + rb_define_const(module, "GL_EXT_packed_pixels", INT2NUM(GL_EXT_packed_pixels)); + rb_define_const(module, "GL_EXT_point_parameters", INT2NUM(GL_EXT_point_parameters)); + rb_define_const(module, "GL_EXT_polygon_offset", INT2NUM(GL_EXT_polygon_offset)); + rb_define_const(module, "GL_EXT_rescale_normal", INT2NUM(GL_EXT_rescale_normal)); + rb_define_const(module, "GL_EXT_shared_texture_palette", INT2NUM(GL_EXT_shared_texture_palette)); + rb_define_const(module, "GL_EXT_subtexture", INT2NUM(GL_EXT_subtexture)); + rb_define_const(module, "GL_EXT_texture3D", INT2NUM(GL_EXT_texture3D)); + rb_define_const(module, "GL_EXT_texture", INT2NUM(GL_EXT_texture)); + rb_define_const(module, "GL_EXT_texture_object", INT2NUM(GL_EXT_texture_object)); + rb_define_const(module, "GL_EXT_vertex_array", INT2NUM(GL_EXT_vertex_array)); + rb_define_const(module, "GL_EYE_DISTANCE_TO_LINE_SGIS", INT2NUM(GL_EYE_DISTANCE_TO_LINE_SGIS)); + rb_define_const(module, "GL_EYE_DISTANCE_TO_POINT_SGIS", INT2NUM(GL_EYE_DISTANCE_TO_POINT_SGIS)); + rb_define_const(module, "GL_EYE_LINEAR", INT2NUM(GL_EYE_LINEAR)); + rb_define_const(module, "GL_EYE_LINE_SGIS", INT2NUM(GL_EYE_LINE_SGIS)); + rb_define_const(module, "GL_EYE_PLANE_ABSOLUTE_NV", INT2NUM(GL_EYE_PLANE_ABSOLUTE_NV)); + rb_define_const(module, "GL_EYE_PLANE", INT2NUM(GL_EYE_PLANE)); + rb_define_const(module, "GL_EYE_POINT_SGIS", INT2NUM(GL_EYE_POINT_SGIS)); + rb_define_const(module, "GL_EYE_RADIAL_NV", INT2NUM(GL_EYE_RADIAL_NV)); + rb_define_const(module, "GL_FALSE", INT2NUM(GL_FALSE)); + rb_define_const(module, "GL_FASTEST", INT2NUM(GL_FASTEST)); + rb_define_const(module, "GL_FEEDBACK_BUFFER_POINTER", INT2NUM(GL_FEEDBACK_BUFFER_POINTER)); + rb_define_const(module, "GL_FEEDBACK_BUFFER_SIZE", INT2NUM(GL_FEEDBACK_BUFFER_SIZE)); + rb_define_const(module, "GL_FEEDBACK_BUFFER_TYPE", INT2NUM(GL_FEEDBACK_BUFFER_TYPE)); + rb_define_const(module, "GL_FEEDBACK", INT2NUM(GL_FEEDBACK)); + rb_define_const(module, "GL_FENCE_APPLE", INT2NUM(GL_FENCE_APPLE)); + rb_define_const(module, "GL_FENCE_CONDITION_NV", INT2NUM(GL_FENCE_CONDITION_NV)); + rb_define_const(module, "GL_FENCE_STATUS_NV", INT2NUM(GL_FENCE_STATUS_NV)); + rb_define_const(module, "GL_FILL", INT2NUM(GL_FILL)); + rb_define_const(module, "GL_FILTER4_SGIS", INT2NUM(GL_FILTER4_SGIS)); + rb_define_const(module, "GL_FIXED_ONLY_ARB", INT2NUM(GL_FIXED_ONLY_ARB)); + rb_define_const(module, "GL_FLAT", INT2NUM(GL_FLAT)); + rb_define_const(module, "GL_FLOAT_CLEAR_COLOR_VALUE_NV", INT2NUM(GL_FLOAT_CLEAR_COLOR_VALUE_NV)); + rb_define_const(module, "GL_FLOAT", INT2NUM(GL_FLOAT)); + rb_define_const(module, "GL_FLOAT_MAT2_ARB", INT2NUM(GL_FLOAT_MAT2_ARB)); + rb_define_const(module, "GL_FLOAT_MAT2", INT2NUM(GL_FLOAT_MAT2)); + rb_define_const(module, "GL_FLOAT_MAT2x3", INT2NUM(GL_FLOAT_MAT2x3)); + rb_define_const(module, "GL_FLOAT_MAT2x4", INT2NUM(GL_FLOAT_MAT2x4)); + rb_define_const(module, "GL_FLOAT_MAT3_ARB", INT2NUM(GL_FLOAT_MAT3_ARB)); + rb_define_const(module, "GL_FLOAT_MAT3", INT2NUM(GL_FLOAT_MAT3)); + rb_define_const(module, "GL_FLOAT_MAT3x2", INT2NUM(GL_FLOAT_MAT3x2)); + rb_define_const(module, "GL_FLOAT_MAT3x4", INT2NUM(GL_FLOAT_MAT3x4)); + rb_define_const(module, "GL_FLOAT_MAT4_ARB", INT2NUM(GL_FLOAT_MAT4_ARB)); + rb_define_const(module, "GL_FLOAT_MAT4", INT2NUM(GL_FLOAT_MAT4)); + rb_define_const(module, "GL_FLOAT_MAT4x2", INT2NUM(GL_FLOAT_MAT4x2)); + rb_define_const(module, "GL_FLOAT_MAT4x3", INT2NUM(GL_FLOAT_MAT4x3)); + rb_define_const(module, "GL_FLOAT_R16_NV", INT2NUM(GL_FLOAT_R16_NV)); + rb_define_const(module, "GL_FLOAT_R32_NV", INT2NUM(GL_FLOAT_R32_NV)); + rb_define_const(module, "GL_FLOAT_RG16_NV", INT2NUM(GL_FLOAT_RG16_NV)); + rb_define_const(module, "GL_FLOAT_RG32_NV", INT2NUM(GL_FLOAT_RG32_NV)); + rb_define_const(module, "GL_FLOAT_RGB16_NV", INT2NUM(GL_FLOAT_RGB16_NV)); + rb_define_const(module, "GL_FLOAT_RGB32_NV", INT2NUM(GL_FLOAT_RGB32_NV)); + rb_define_const(module, "GL_FLOAT_RGBA16_NV", INT2NUM(GL_FLOAT_RGBA16_NV)); + rb_define_const(module, "GL_FLOAT_RGBA32_NV", INT2NUM(GL_FLOAT_RGBA32_NV)); + rb_define_const(module, "GL_FLOAT_RGBA_MODE_NV", INT2NUM(GL_FLOAT_RGBA_MODE_NV)); + rb_define_const(module, "GL_FLOAT_RGBA_NV", INT2NUM(GL_FLOAT_RGBA_NV)); + rb_define_const(module, "GL_FLOAT_RGB_NV", INT2NUM(GL_FLOAT_RGB_NV)); + rb_define_const(module, "GL_FLOAT_RG_NV", INT2NUM(GL_FLOAT_RG_NV)); + rb_define_const(module, "GL_FLOAT_R_NV", INT2NUM(GL_FLOAT_R_NV)); + rb_define_const(module, "GL_FLOAT_VEC2_ARB", INT2NUM(GL_FLOAT_VEC2_ARB)); + rb_define_const(module, "GL_FLOAT_VEC2", INT2NUM(GL_FLOAT_VEC2)); + rb_define_const(module, "GL_FLOAT_VEC3_ARB", INT2NUM(GL_FLOAT_VEC3_ARB)); + rb_define_const(module, "GL_FLOAT_VEC3", INT2NUM(GL_FLOAT_VEC3)); + rb_define_const(module, "GL_FLOAT_VEC4_ARB", INT2NUM(GL_FLOAT_VEC4_ARB)); + rb_define_const(module, "GL_FLOAT_VEC4", INT2NUM(GL_FLOAT_VEC4)); + rb_define_const(module, "GL_FOG_BIT", INT2NUM(GL_FOG_BIT)); + rb_define_const(module, "GL_FOG_COLOR", INT2NUM(GL_FOG_COLOR)); + rb_define_const(module, "GL_FOG_COORD_ARRAY_BUFFER_BINDING", INT2NUM(GL_FOG_COORD_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_FOG_COORD_ARRAY", INT2NUM(GL_FOG_COORD_ARRAY)); + rb_define_const(module, "GL_FOG_COORD_ARRAY_POINTER", INT2NUM(GL_FOG_COORD_ARRAY_POINTER)); + rb_define_const(module, "GL_FOG_COORD_ARRAY_STRIDE", INT2NUM(GL_FOG_COORD_ARRAY_STRIDE)); + rb_define_const(module, "GL_FOG_COORD_ARRAY_TYPE", INT2NUM(GL_FOG_COORD_ARRAY_TYPE)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING", INT2NUM(GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_EXT", INT2NUM(GL_FOG_COORDINATE_ARRAY_EXT)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY", INT2NUM(GL_FOG_COORDINATE_ARRAY)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_LIST_IBM", INT2NUM(GL_FOG_COORDINATE_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_POINTER_EXT", INT2NUM(GL_FOG_COORDINATE_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_POINTER", INT2NUM(GL_FOG_COORDINATE_ARRAY_POINTER)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", INT2NUM(GL_FOG_COORDINATE_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_STRIDE", INT2NUM(GL_FOG_COORDINATE_ARRAY_STRIDE)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", INT2NUM(GL_FOG_COORDINATE_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_FOG_COORDINATE_ARRAY_TYPE", INT2NUM(GL_FOG_COORDINATE_ARRAY_TYPE)); + rb_define_const(module, "GL_FOG_COORDINATE_EXT", INT2NUM(GL_FOG_COORDINATE_EXT)); + rb_define_const(module, "GL_FOG_COORDINATE", INT2NUM(GL_FOG_COORDINATE)); + rb_define_const(module, "GL_FOG_COORDINATE_SOURCE_EXT", INT2NUM(GL_FOG_COORDINATE_SOURCE_EXT)); + rb_define_const(module, "GL_FOG_COORDINATE_SOURCE", INT2NUM(GL_FOG_COORDINATE_SOURCE)); + rb_define_const(module, "GL_FOG_COORD", INT2NUM(GL_FOG_COORD)); + rb_define_const(module, "GL_FOG_COORD_SRC", INT2NUM(GL_FOG_COORD_SRC)); + rb_define_const(module, "GL_FOG_DENSITY", INT2NUM(GL_FOG_DENSITY)); + rb_define_const(module, "GL_FOG_DISTANCE_MODE_NV", INT2NUM(GL_FOG_DISTANCE_MODE_NV)); + rb_define_const(module, "GL_FOG_END", INT2NUM(GL_FOG_END)); + rb_define_const(module, "GL_FOG_FACTOR_TO_ALPHA_SGIX", INT2NUM(GL_FOG_FACTOR_TO_ALPHA_SGIX)); + rb_define_const(module, "GL_FOG_FUNC_POINTS_SGIS", INT2NUM(GL_FOG_FUNC_POINTS_SGIS)); + rb_define_const(module, "GL_FOG_FUNC_SGIS", INT2NUM(GL_FOG_FUNC_SGIS)); + rb_define_const(module, "GL_FOG_HINT", INT2NUM(GL_FOG_HINT)); + rb_define_const(module, "GL_FOG_INDEX", INT2NUM(GL_FOG_INDEX)); + rb_define_const(module, "GL_FOG", INT2NUM(GL_FOG)); + rb_define_const(module, "GL_FOG_MODE", INT2NUM(GL_FOG_MODE)); + rb_define_const(module, "GL_FOG_OFFSET_SGIX", INT2NUM(GL_FOG_OFFSET_SGIX)); + rb_define_const(module, "GL_FOG_OFFSET_VALUE_SGIX", INT2NUM(GL_FOG_OFFSET_VALUE_SGIX)); + rb_define_const(module, "GL_FOG_SCALE_SGIX", INT2NUM(GL_FOG_SCALE_SGIX)); + rb_define_const(module, "GL_FOG_SCALE_VALUE_SGIX", INT2NUM(GL_FOG_SCALE_VALUE_SGIX)); + rb_define_const(module, "GL_FOG_SPECULAR_TEXTURE_WIN", INT2NUM(GL_FOG_SPECULAR_TEXTURE_WIN)); + rb_define_const(module, "GL_FOG_START", INT2NUM(GL_FOG_START)); + rb_define_const(module, "GL_FORCE_BLUE_TO_ONE_NV", INT2NUM(GL_FORCE_BLUE_TO_ONE_NV)); + rb_define_const(module, "GL_FORMAT_SUBSAMPLE_24_24_OML", INT2NUM(GL_FORMAT_SUBSAMPLE_24_24_OML)); + rb_define_const(module, "GL_FORMAT_SUBSAMPLE_244_244_OML", INT2NUM(GL_FORMAT_SUBSAMPLE_244_244_OML)); + rb_define_const(module, "GL_FRAGMENT_COLOR_EXT", INT2NUM(GL_FRAGMENT_COLOR_EXT)); + rb_define_const(module, "GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX", INT2NUM(GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX)); + rb_define_const(module, "GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX", INT2NUM(GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX)); + rb_define_const(module, "GL_FRAGMENT_COLOR_MATERIAL_SGIX", INT2NUM(GL_FRAGMENT_COLOR_MATERIAL_SGIX)); + rb_define_const(module, "GL_FRAGMENT_DEPTH_EXT", INT2NUM(GL_FRAGMENT_DEPTH_EXT)); + rb_define_const(module, "GL_FRAGMENT_DEPTH", INT2NUM(GL_FRAGMENT_DEPTH)); + rb_define_const(module, "GL_FRAGMENT_LIGHT0_SGIX", INT2NUM(GL_FRAGMENT_LIGHT0_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT1_SGIX", INT2NUM(GL_FRAGMENT_LIGHT1_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT2_SGIX", INT2NUM(GL_FRAGMENT_LIGHT2_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT3_SGIX", INT2NUM(GL_FRAGMENT_LIGHT3_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT4_SGIX", INT2NUM(GL_FRAGMENT_LIGHT4_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT5_SGIX", INT2NUM(GL_FRAGMENT_LIGHT5_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT6_SGIX", INT2NUM(GL_FRAGMENT_LIGHT6_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT7_SGIX", INT2NUM(GL_FRAGMENT_LIGHT7_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHTING_SGIX", INT2NUM(GL_FRAGMENT_LIGHTING_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX", INT2NUM(GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX", INT2NUM(GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX", INT2NUM(GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX)); + rb_define_const(module, "GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX", INT2NUM(GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX)); + rb_define_const(module, "GL_FRAGMENT_MATERIAL_EXT", INT2NUM(GL_FRAGMENT_MATERIAL_EXT)); + rb_define_const(module, "GL_FRAGMENT_NORMAL_EXT", INT2NUM(GL_FRAGMENT_NORMAL_EXT)); + rb_define_const(module, "GL_FRAGMENT_PROGRAM_ARB", INT2NUM(GL_FRAGMENT_PROGRAM_ARB)); + rb_define_const(module, "GL_FRAGMENT_PROGRAM_BINDING_NV", INT2NUM(GL_FRAGMENT_PROGRAM_BINDING_NV)); + rb_define_const(module, "GL_FRAGMENT_PROGRAM_NV", INT2NUM(GL_FRAGMENT_PROGRAM_NV)); + rb_define_const(module, "GL_FRAGMENT_SHADER_ARB", INT2NUM(GL_FRAGMENT_SHADER_ARB)); + rb_define_const(module, "GL_FRAGMENT_SHADER_ATI", INT2NUM(GL_FRAGMENT_SHADER_ATI)); + rb_define_const(module, "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", INT2NUM(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB)); + rb_define_const(module, "GL_FRAGMENT_SHADER_DERIVATIVE_HINT", INT2NUM(GL_FRAGMENT_SHADER_DERIVATIVE_HINT)); + rb_define_const(module, "GL_FRAGMENT_SHADER", INT2NUM(GL_FRAGMENT_SHADER)); + rb_define_const(module, "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT", INT2NUM(GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT", INT2NUM(GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT", INT2NUM(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT", INT2NUM(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT", INT2NUM(GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_BINDING_EXT", INT2NUM(GL_FRAMEBUFFER_BINDING_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_COMPLETE_EXT", INT2NUM(GL_FRAMEBUFFER_COMPLETE_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_EXT", INT2NUM(GL_FRAMEBUFFER_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT", INT2NUM(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT)); + rb_define_const(module, "GL_FRAMEBUFFER_UNSUPPORTED_EXT", INT2NUM(GL_FRAMEBUFFER_UNSUPPORTED_EXT)); + rb_define_const(module, "GL_FRAMEZOOM_FACTOR_SGIX", INT2NUM(GL_FRAMEZOOM_FACTOR_SGIX)); + rb_define_const(module, "GL_FRAMEZOOM_SGIX", INT2NUM(GL_FRAMEZOOM_SGIX)); + rb_define_const(module, "GL_FRONT_AND_BACK", INT2NUM(GL_FRONT_AND_BACK)); + rb_define_const(module, "GL_FRONT_FACE", INT2NUM(GL_FRONT_FACE)); + rb_define_const(module, "GL_FRONT", INT2NUM(GL_FRONT)); + rb_define_const(module, "GL_FRONT_LEFT", INT2NUM(GL_FRONT_LEFT)); + rb_define_const(module, "GL_FRONT_RIGHT", INT2NUM(GL_FRONT_RIGHT)); + rb_define_const(module, "GL_FULL_RANGE_EXT", INT2NUM(GL_FULL_RANGE_EXT)); + rb_define_const(module, "GL_FULL_STIPPLE_HINT_PGI", INT2NUM(GL_FULL_STIPPLE_HINT_PGI)); + rb_define_const(module, "GL_FUNC_ADD_EXT", INT2NUM(GL_FUNC_ADD_EXT)); + rb_define_const(module, "GL_FUNC_ADD", INT2NUM(GL_FUNC_ADD)); + rb_define_const(module, "GL_FUNC_REVERSE_SUBTRACT_EXT", INT2NUM(GL_FUNC_REVERSE_SUBTRACT_EXT)); + rb_define_const(module, "GL_FUNC_REVERSE_SUBTRACT", INT2NUM(GL_FUNC_REVERSE_SUBTRACT)); + rb_define_const(module, "GL_FUNC_SUBTRACT_EXT", INT2NUM(GL_FUNC_SUBTRACT_EXT)); + rb_define_const(module, "GL_FUNC_SUBTRACT", INT2NUM(GL_FUNC_SUBTRACT)); + rb_define_const(module, "GL_GENERATE_MIPMAP_HINT", INT2NUM(GL_GENERATE_MIPMAP_HINT)); + rb_define_const(module, "GL_GENERATE_MIPMAP_HINT_SGIS", INT2NUM(GL_GENERATE_MIPMAP_HINT_SGIS)); + rb_define_const(module, "GL_GENERATE_MIPMAP", INT2NUM(GL_GENERATE_MIPMAP)); + rb_define_const(module, "GL_GENERATE_MIPMAP_SGIS", INT2NUM(GL_GENERATE_MIPMAP_SGIS)); + rb_define_const(module, "GL_GEOMETRY_DEFORMATION_BIT_SGIX", INT2NUM(GL_GEOMETRY_DEFORMATION_BIT_SGIX)); + rb_define_const(module, "GL_GEOMETRY_DEFORMATION_SGIX", INT2NUM(GL_GEOMETRY_DEFORMATION_SGIX)); + rb_define_const(module, "GL_GEQUAL", INT2NUM(GL_GEQUAL)); + rb_define_const(module, "GL_GLOBAL_ALPHA_FACTOR_SUN", INT2NUM(GL_GLOBAL_ALPHA_FACTOR_SUN)); + rb_define_const(module, "GL_GLOBAL_ALPHA_SUN", INT2NUM(GL_GLOBAL_ALPHA_SUN)); + rb_define_const(module, "GL_GREATER", INT2NUM(GL_GREATER)); + rb_define_const(module, "GL_GREEN_BIAS", INT2NUM(GL_GREEN_BIAS)); + rb_define_const(module, "GL_GREEN_BIT_ATI", INT2NUM(GL_GREEN_BIT_ATI)); + rb_define_const(module, "GL_GREEN_BITS", INT2NUM(GL_GREEN_BITS)); + rb_define_const(module, "GL_GREEN", INT2NUM(GL_GREEN)); + rb_define_const(module, "GL_GREEN_MAX_CLAMP_INGR", INT2NUM(GL_GREEN_MAX_CLAMP_INGR)); + rb_define_const(module, "GL_GREEN_MIN_CLAMP_INGR", INT2NUM(GL_GREEN_MIN_CLAMP_INGR)); + rb_define_const(module, "GL_GREEN_SCALE", INT2NUM(GL_GREEN_SCALE)); + rb_define_const(module, "GL_HALF_BIAS_NEGATE_NV", INT2NUM(GL_HALF_BIAS_NEGATE_NV)); + rb_define_const(module, "GL_HALF_BIAS_NORMAL_NV", INT2NUM(GL_HALF_BIAS_NORMAL_NV)); + rb_define_const(module, "GL_HALF_BIT_ATI", INT2NUM(GL_HALF_BIT_ATI)); + rb_define_const(module, "GL_HALF_FLOAT_ARB", INT2NUM(GL_HALF_FLOAT_ARB)); + rb_define_const(module, "GL_HALF_FLOAT_NV", INT2NUM(GL_HALF_FLOAT_NV)); + rb_define_const(module, "GL_HI_BIAS_NV", INT2NUM(GL_HI_BIAS_NV)); + rb_define_const(module, "GL_HILO16_NV", INT2NUM(GL_HILO16_NV)); + rb_define_const(module, "GL_HILO8_NV", INT2NUM(GL_HILO8_NV)); + rb_define_const(module, "GL_HILO_NV", INT2NUM(GL_HILO_NV)); + rb_define_const(module, "GL_HINT_BIT", INT2NUM(GL_HINT_BIT)); + rb_define_const(module, "GL_HI_SCALE_NV", INT2NUM(GL_HI_SCALE_NV)); + rb_define_const(module, "GL_HISTOGRAM_ALPHA_SIZE_EXT", INT2NUM(GL_HISTOGRAM_ALPHA_SIZE_EXT)); + rb_define_const(module, "GL_HISTOGRAM_ALPHA_SIZE", INT2NUM(GL_HISTOGRAM_ALPHA_SIZE)); + rb_define_const(module, "GL_HISTOGRAM_BLUE_SIZE_EXT", INT2NUM(GL_HISTOGRAM_BLUE_SIZE_EXT)); + rb_define_const(module, "GL_HISTOGRAM_BLUE_SIZE", INT2NUM(GL_HISTOGRAM_BLUE_SIZE)); + rb_define_const(module, "GL_HISTOGRAM_EXT", INT2NUM(GL_HISTOGRAM_EXT)); + rb_define_const(module, "GL_HISTOGRAM_FORMAT_EXT", INT2NUM(GL_HISTOGRAM_FORMAT_EXT)); + rb_define_const(module, "GL_HISTOGRAM_FORMAT", INT2NUM(GL_HISTOGRAM_FORMAT)); + rb_define_const(module, "GL_HISTOGRAM_GREEN_SIZE_EXT", INT2NUM(GL_HISTOGRAM_GREEN_SIZE_EXT)); + rb_define_const(module, "GL_HISTOGRAM_GREEN_SIZE", INT2NUM(GL_HISTOGRAM_GREEN_SIZE)); + rb_define_const(module, "GL_HISTOGRAM", INT2NUM(GL_HISTOGRAM)); + rb_define_const(module, "GL_HISTOGRAM_LUMINANCE_SIZE_EXT", INT2NUM(GL_HISTOGRAM_LUMINANCE_SIZE_EXT)); + rb_define_const(module, "GL_HISTOGRAM_LUMINANCE_SIZE", INT2NUM(GL_HISTOGRAM_LUMINANCE_SIZE)); + rb_define_const(module, "GL_HISTOGRAM_RED_SIZE_EXT", INT2NUM(GL_HISTOGRAM_RED_SIZE_EXT)); + rb_define_const(module, "GL_HISTOGRAM_RED_SIZE", INT2NUM(GL_HISTOGRAM_RED_SIZE)); + rb_define_const(module, "GL_HISTOGRAM_SINK_EXT", INT2NUM(GL_HISTOGRAM_SINK_EXT)); + rb_define_const(module, "GL_HISTOGRAM_SINK", INT2NUM(GL_HISTOGRAM_SINK)); + rb_define_const(module, "GL_HISTOGRAM_WIDTH_EXT", INT2NUM(GL_HISTOGRAM_WIDTH_EXT)); + rb_define_const(module, "GL_HISTOGRAM_WIDTH", INT2NUM(GL_HISTOGRAM_WIDTH)); + rb_define_const(module, "GL_IDENTITY_NV", INT2NUM(GL_IDENTITY_NV)); + rb_define_const(module, "GL_IGNORE_BORDER_HP", INT2NUM(GL_IGNORE_BORDER_HP)); + rb_define_const(module, "GL_IMAGE_CUBIC_WEIGHT_HP", INT2NUM(GL_IMAGE_CUBIC_WEIGHT_HP)); + rb_define_const(module, "GL_IMAGE_MAG_FILTER_HP", INT2NUM(GL_IMAGE_MAG_FILTER_HP)); + rb_define_const(module, "GL_IMAGE_MIN_FILTER_HP", INT2NUM(GL_IMAGE_MIN_FILTER_HP)); + rb_define_const(module, "GL_IMAGE_ROTATE_ANGLE_HP", INT2NUM(GL_IMAGE_ROTATE_ANGLE_HP)); + rb_define_const(module, "GL_IMAGE_ROTATE_ORIGIN_X_HP", INT2NUM(GL_IMAGE_ROTATE_ORIGIN_X_HP)); + rb_define_const(module, "GL_IMAGE_ROTATE_ORIGIN_Y_HP", INT2NUM(GL_IMAGE_ROTATE_ORIGIN_Y_HP)); + rb_define_const(module, "GL_IMAGE_SCALE_X_HP", INT2NUM(GL_IMAGE_SCALE_X_HP)); + rb_define_const(module, "GL_IMAGE_SCALE_Y_HP", INT2NUM(GL_IMAGE_SCALE_Y_HP)); + rb_define_const(module, "GL_IMAGE_TRANSFORM_2D_HP", INT2NUM(GL_IMAGE_TRANSFORM_2D_HP)); + rb_define_const(module, "GL_IMAGE_TRANSLATE_X_HP", INT2NUM(GL_IMAGE_TRANSLATE_X_HP)); + rb_define_const(module, "GL_IMAGE_TRANSLATE_Y_HP", INT2NUM(GL_IMAGE_TRANSLATE_Y_HP)); + rb_define_const(module, "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", INT2NUM(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)); + rb_define_const(module, "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", INT2NUM(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)); + rb_define_const(module, "GL_INCR", INT2NUM(GL_INCR)); + rb_define_const(module, "GL_INCR_WRAP_EXT", INT2NUM(GL_INCR_WRAP_EXT)); + rb_define_const(module, "GL_INCR_WRAP", INT2NUM(GL_INCR_WRAP)); + rb_define_const(module, "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_INDEX_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_INDEX_ARRAY_BUFFER_BINDING", INT2NUM(GL_INDEX_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_INDEX_ARRAY_COUNT_EXT", INT2NUM(GL_INDEX_ARRAY_COUNT_EXT)); + rb_define_const(module, "GL_INDEX_ARRAY_EXT", INT2NUM(GL_INDEX_ARRAY_EXT)); + rb_define_const(module, "GL_INDEX_ARRAY", INT2NUM(GL_INDEX_ARRAY)); + rb_define_const(module, "GL_INDEX_ARRAY_LIST_IBM", INT2NUM(GL_INDEX_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_INDEX_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_INDEX_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_INDEX_ARRAY_POINTER_EXT", INT2NUM(GL_INDEX_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_INDEX_ARRAY_POINTER", INT2NUM(GL_INDEX_ARRAY_POINTER)); + rb_define_const(module, "GL_INDEX_ARRAY_STRIDE_EXT", INT2NUM(GL_INDEX_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_INDEX_ARRAY_STRIDE", INT2NUM(GL_INDEX_ARRAY_STRIDE)); + rb_define_const(module, "GL_INDEX_ARRAY_TYPE_EXT", INT2NUM(GL_INDEX_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_INDEX_ARRAY_TYPE", INT2NUM(GL_INDEX_ARRAY_TYPE)); + rb_define_const(module, "GL_INDEX_BIT_PGI", INT2NUM(GL_INDEX_BIT_PGI)); + rb_define_const(module, "GL_INDEX_BITS", INT2NUM(GL_INDEX_BITS)); + rb_define_const(module, "GL_INDEX_CLEAR_VALUE", INT2NUM(GL_INDEX_CLEAR_VALUE)); + rb_define_const(module, "GL_INDEX_LOGIC_OP", INT2NUM(GL_INDEX_LOGIC_OP)); + rb_define_const(module, "GL_INDEX_MATERIAL_EXT", INT2NUM(GL_INDEX_MATERIAL_EXT)); + rb_define_const(module, "GL_INDEX_MATERIAL_FACE_EXT", INT2NUM(GL_INDEX_MATERIAL_FACE_EXT)); + rb_define_const(module, "GL_INDEX_MATERIAL_PARAMETER_EXT", INT2NUM(GL_INDEX_MATERIAL_PARAMETER_EXT)); + rb_define_const(module, "GL_INDEX_MODE", INT2NUM(GL_INDEX_MODE)); + rb_define_const(module, "GL_INDEX_OFFSET", INT2NUM(GL_INDEX_OFFSET)); + rb_define_const(module, "GL_INDEX_SHIFT", INT2NUM(GL_INDEX_SHIFT)); + rb_define_const(module, "GL_INDEX_TEST_EXT", INT2NUM(GL_INDEX_TEST_EXT)); + rb_define_const(module, "GL_INDEX_TEST_FUNC_EXT", INT2NUM(GL_INDEX_TEST_FUNC_EXT)); + rb_define_const(module, "GL_INDEX_TEST_REF_EXT", INT2NUM(GL_INDEX_TEST_REF_EXT)); + rb_define_const(module, "GL_INDEX_WRITEMASK", INT2NUM(GL_INDEX_WRITEMASK)); + rb_define_const(module, "GL_INFO_LOG_LENGTH", INT2NUM(GL_INFO_LOG_LENGTH)); + rb_define_const(module, "GL_INSTRUMENT_BUFFER_POINTER_SGIX", INT2NUM(GL_INSTRUMENT_BUFFER_POINTER_SGIX)); + rb_define_const(module, "GL_INSTRUMENT_MEASUREMENTS_SGIX", INT2NUM(GL_INSTRUMENT_MEASUREMENTS_SGIX)); + rb_define_const(module, "GL_INTENSITY12_EXT", INT2NUM(GL_INTENSITY12_EXT)); + rb_define_const(module, "GL_INTENSITY12", INT2NUM(GL_INTENSITY12)); + rb_define_const(module, "GL_INTENSITY16_EXT", INT2NUM(GL_INTENSITY16_EXT)); + rb_define_const(module, "GL_INTENSITY16F_ARB", INT2NUM(GL_INTENSITY16F_ARB)); + rb_define_const(module, "GL_INTENSITY16", INT2NUM(GL_INTENSITY16)); + rb_define_const(module, "GL_INTENSITY32F_ARB", INT2NUM(GL_INTENSITY32F_ARB)); + rb_define_const(module, "GL_INTENSITY4_EXT", INT2NUM(GL_INTENSITY4_EXT)); + rb_define_const(module, "GL_INTENSITY4", INT2NUM(GL_INTENSITY4)); + rb_define_const(module, "GL_INTENSITY8_EXT", INT2NUM(GL_INTENSITY8_EXT)); + rb_define_const(module, "GL_INTENSITY8", INT2NUM(GL_INTENSITY8)); + rb_define_const(module, "GL_INTENSITY_EXT", INT2NUM(GL_INTENSITY_EXT)); + rb_define_const(module, "GL_INTENSITY_FLOAT16_ATI", INT2NUM(GL_INTENSITY_FLOAT16_ATI)); + rb_define_const(module, "GL_INTENSITY_FLOAT32_ATI", INT2NUM(GL_INTENSITY_FLOAT32_ATI)); + rb_define_const(module, "GL_INTENSITY", INT2NUM(GL_INTENSITY)); + rb_define_const(module, "GL_INTERLACE_OML", INT2NUM(GL_INTERLACE_OML)); + rb_define_const(module, "GL_INTERLACE_READ_INGR", INT2NUM(GL_INTERLACE_READ_INGR)); + rb_define_const(module, "GL_INTERLACE_READ_OML", INT2NUM(GL_INTERLACE_READ_OML)); + rb_define_const(module, "GL_INTERLACE_SGIX", INT2NUM(GL_INTERLACE_SGIX)); + rb_define_const(module, "GL_INTERPOLATE_ARB", INT2NUM(GL_INTERPOLATE_ARB)); + rb_define_const(module, "GL_INTERPOLATE_EXT", INT2NUM(GL_INTERPOLATE_EXT)); + rb_define_const(module, "GL_INTERPOLATE", INT2NUM(GL_INTERPOLATE)); + rb_define_const(module, "GL_INT", INT2NUM(GL_INT)); + rb_define_const(module, "GL_INT_VEC2_ARB", INT2NUM(GL_INT_VEC2_ARB)); + rb_define_const(module, "GL_INT_VEC2", INT2NUM(GL_INT_VEC2)); + rb_define_const(module, "GL_INT_VEC3_ARB", INT2NUM(GL_INT_VEC3_ARB)); + rb_define_const(module, "GL_INT_VEC3", INT2NUM(GL_INT_VEC3)); + rb_define_const(module, "GL_INT_VEC4_ARB", INT2NUM(GL_INT_VEC4_ARB)); + rb_define_const(module, "GL_INT_VEC4", INT2NUM(GL_INT_VEC4)); + rb_define_const(module, "GL_INVALID_ENUM", INT2NUM(GL_INVALID_ENUM)); + rb_define_const(module, "GL_INVALID_FRAMEBUFFER_OPERATION_EXT", INT2NUM(GL_INVALID_FRAMEBUFFER_OPERATION_EXT)); + rb_define_const(module, "GL_INVALID_OPERATION", INT2NUM(GL_INVALID_OPERATION)); + rb_define_const(module, "GL_INVALID_VALUE", INT2NUM(GL_INVALID_VALUE)); + rb_define_const(module, "GL_INVARIANT_DATATYPE_EXT", INT2NUM(GL_INVARIANT_DATATYPE_EXT)); + rb_define_const(module, "GL_INVARIANT_EXT", INT2NUM(GL_INVARIANT_EXT)); + rb_define_const(module, "GL_INVARIANT_VALUE_EXT", INT2NUM(GL_INVARIANT_VALUE_EXT)); + rb_define_const(module, "GL_INVERSE_NV", INT2NUM(GL_INVERSE_NV)); + rb_define_const(module, "GL_INVERSE_TRANSPOSE_NV", INT2NUM(GL_INVERSE_TRANSPOSE_NV)); + rb_define_const(module, "GL_INVERTED_SCREEN_W_REND", INT2NUM(GL_INVERTED_SCREEN_W_REND)); + rb_define_const(module, "GL_INVERT", INT2NUM(GL_INVERT)); + rb_define_const(module, "GL_IR_INSTRUMENT1_SGIX", INT2NUM(GL_IR_INSTRUMENT1_SGIX)); + rb_define_const(module, "GL_IUI_N3F_V2F_EXT", INT2NUM(GL_IUI_N3F_V2F_EXT)); + rb_define_const(module, "GL_IUI_N3F_V3F_EXT", INT2NUM(GL_IUI_N3F_V3F_EXT)); + rb_define_const(module, "GL_IUI_V2F_EXT", INT2NUM(GL_IUI_V2F_EXT)); + rb_define_const(module, "GL_IUI_V3F_EXT", INT2NUM(GL_IUI_V3F_EXT)); + rb_define_const(module, "GL_KEEP", INT2NUM(GL_KEEP)); + rb_define_const(module, "GL_LEFT", INT2NUM(GL_LEFT)); + rb_define_const(module, "GL_LEQUAL", INT2NUM(GL_LEQUAL)); + rb_define_const(module, "GL_LERP_ATI", INT2NUM(GL_LERP_ATI)); + rb_define_const(module, "GL_LESS", INT2NUM(GL_LESS)); + rb_define_const(module, "GL_LIGHT0", INT2NUM(GL_LIGHT0)); + rb_define_const(module, "GL_LIGHT1", INT2NUM(GL_LIGHT1)); + rb_define_const(module, "GL_LIGHT2", INT2NUM(GL_LIGHT2)); + rb_define_const(module, "GL_LIGHT3", INT2NUM(GL_LIGHT3)); + rb_define_const(module, "GL_LIGHT4", INT2NUM(GL_LIGHT4)); + rb_define_const(module, "GL_LIGHT5", INT2NUM(GL_LIGHT5)); + rb_define_const(module, "GL_LIGHT6", INT2NUM(GL_LIGHT6)); + rb_define_const(module, "GL_LIGHT7", INT2NUM(GL_LIGHT7)); + rb_define_const(module, "GL_LIGHT_ENV_MODE_SGIX", INT2NUM(GL_LIGHT_ENV_MODE_SGIX)); + rb_define_const(module, "GL_LIGHTING_BIT", INT2NUM(GL_LIGHTING_BIT)); + rb_define_const(module, "GL_LIGHTING", INT2NUM(GL_LIGHTING)); + rb_define_const(module, "GL_LIGHT_MODEL_AMBIENT", INT2NUM(GL_LIGHT_MODEL_AMBIENT)); + rb_define_const(module, "GL_LIGHT_MODEL_COLOR_CONTROL_EXT", INT2NUM(GL_LIGHT_MODEL_COLOR_CONTROL_EXT)); + rb_define_const(module, "GL_LIGHT_MODEL_COLOR_CONTROL", INT2NUM(GL_LIGHT_MODEL_COLOR_CONTROL)); + rb_define_const(module, "GL_LIGHT_MODEL_LOCAL_VIEWER", INT2NUM(GL_LIGHT_MODEL_LOCAL_VIEWER)); + rb_define_const(module, "GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE", INT2NUM(GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE)); + rb_define_const(module, "GL_LIGHT_MODEL_TWO_SIDE", INT2NUM(GL_LIGHT_MODEL_TWO_SIDE)); + rb_define_const(module, "GL_LINEAR_ATTENUATION", INT2NUM(GL_LINEAR_ATTENUATION)); + rb_define_const(module, "GL_LINEAR_CLIPMAP_LINEAR_SGIX", INT2NUM(GL_LINEAR_CLIPMAP_LINEAR_SGIX)); + rb_define_const(module, "GL_LINEAR_CLIPMAP_NEAREST_SGIX", INT2NUM(GL_LINEAR_CLIPMAP_NEAREST_SGIX)); + rb_define_const(module, "GL_LINEAR_DETAIL_ALPHA_SGIS", INT2NUM(GL_LINEAR_DETAIL_ALPHA_SGIS)); + rb_define_const(module, "GL_LINEAR_DETAIL_COLOR_SGIS", INT2NUM(GL_LINEAR_DETAIL_COLOR_SGIS)); + rb_define_const(module, "GL_LINEAR_DETAIL_SGIS", INT2NUM(GL_LINEAR_DETAIL_SGIS)); + rb_define_const(module, "GL_LINEAR", INT2NUM(GL_LINEAR)); + rb_define_const(module, "GL_LINEAR_MIPMAP_LINEAR", INT2NUM(GL_LINEAR_MIPMAP_LINEAR)); + rb_define_const(module, "GL_LINEAR_MIPMAP_NEAREST", INT2NUM(GL_LINEAR_MIPMAP_NEAREST)); + rb_define_const(module, "GL_LINEAR_SHARPEN_ALPHA_SGIS", INT2NUM(GL_LINEAR_SHARPEN_ALPHA_SGIS)); + rb_define_const(module, "GL_LINEAR_SHARPEN_COLOR_SGIS", INT2NUM(GL_LINEAR_SHARPEN_COLOR_SGIS)); + rb_define_const(module, "GL_LINEAR_SHARPEN_SGIS", INT2NUM(GL_LINEAR_SHARPEN_SGIS)); + rb_define_const(module, "GL_LINE_BIT", INT2NUM(GL_LINE_BIT)); + rb_define_const(module, "GL_LINE", INT2NUM(GL_LINE)); + rb_define_const(module, "GL_LINE_LOOP", INT2NUM(GL_LINE_LOOP)); + rb_define_const(module, "GL_LINE_RESET_TOKEN", INT2NUM(GL_LINE_RESET_TOKEN)); + rb_define_const(module, "GL_LINES", INT2NUM(GL_LINES)); + rb_define_const(module, "GL_LINE_SMOOTH_HINT", INT2NUM(GL_LINE_SMOOTH_HINT)); + rb_define_const(module, "GL_LINE_SMOOTH", INT2NUM(GL_LINE_SMOOTH)); + rb_define_const(module, "GL_LINE_STIPPLE", INT2NUM(GL_LINE_STIPPLE)); + rb_define_const(module, "GL_LINE_STIPPLE_PATTERN", INT2NUM(GL_LINE_STIPPLE_PATTERN)); + rb_define_const(module, "GL_LINE_STIPPLE_REPEAT", INT2NUM(GL_LINE_STIPPLE_REPEAT)); + rb_define_const(module, "GL_LINE_STRIP", INT2NUM(GL_LINE_STRIP)); + rb_define_const(module, "GL_LINE_TOKEN", INT2NUM(GL_LINE_TOKEN)); + rb_define_const(module, "GL_LINE_WIDTH_GRANULARITY", INT2NUM(GL_LINE_WIDTH_GRANULARITY)); + rb_define_const(module, "GL_LINE_WIDTH", INT2NUM(GL_LINE_WIDTH)); + rb_define_const(module, "GL_LINE_WIDTH_RANGE", INT2NUM(GL_LINE_WIDTH_RANGE)); + rb_define_const(module, "GL_LINK_STATUS", INT2NUM(GL_LINK_STATUS)); + rb_define_const(module, "GL_LIST_BASE", INT2NUM(GL_LIST_BASE)); + rb_define_const(module, "GL_LIST_BIT", INT2NUM(GL_LIST_BIT)); + rb_define_const(module, "GL_LIST_INDEX", INT2NUM(GL_LIST_INDEX)); + rb_define_const(module, "GL_LIST_MODE", INT2NUM(GL_LIST_MODE)); + rb_define_const(module, "GL_LIST_PRIORITY_SGIX", INT2NUM(GL_LIST_PRIORITY_SGIX)); + rb_define_const(module, "GL_LOAD", INT2NUM(GL_LOAD)); + rb_define_const(module, "GL_LO_BIAS_NV", INT2NUM(GL_LO_BIAS_NV)); + rb_define_const(module, "GL_LOCAL_CONSTANT_DATATYPE_EXT", INT2NUM(GL_LOCAL_CONSTANT_DATATYPE_EXT)); + rb_define_const(module, "GL_LOCAL_CONSTANT_EXT", INT2NUM(GL_LOCAL_CONSTANT_EXT)); + rb_define_const(module, "GL_LOCAL_CONSTANT_VALUE_EXT", INT2NUM(GL_LOCAL_CONSTANT_VALUE_EXT)); + rb_define_const(module, "GL_LOCAL_EXT", INT2NUM(GL_LOCAL_EXT)); + rb_define_const(module, "GL_LOGIC_OP", INT2NUM(GL_LOGIC_OP)); + rb_define_const(module, "GL_LOGIC_OP_MODE", INT2NUM(GL_LOGIC_OP_MODE)); + rb_define_const(module, "GL_LO_SCALE_NV", INT2NUM(GL_LO_SCALE_NV)); + rb_define_const(module, "GL_LOWER_LEFT", INT2NUM(GL_LOWER_LEFT)); + rb_define_const(module, "GL_LUMINANCE12_ALPHA12_EXT", INT2NUM(GL_LUMINANCE12_ALPHA12_EXT)); + rb_define_const(module, "GL_LUMINANCE12_ALPHA12", INT2NUM(GL_LUMINANCE12_ALPHA12)); + rb_define_const(module, "GL_LUMINANCE12_ALPHA4_EXT", INT2NUM(GL_LUMINANCE12_ALPHA4_EXT)); + rb_define_const(module, "GL_LUMINANCE12_ALPHA4", INT2NUM(GL_LUMINANCE12_ALPHA4)); + rb_define_const(module, "GL_LUMINANCE12_EXT", INT2NUM(GL_LUMINANCE12_EXT)); + rb_define_const(module, "GL_LUMINANCE12", INT2NUM(GL_LUMINANCE12)); + rb_define_const(module, "GL_LUMINANCE16_ALPHA16_EXT", INT2NUM(GL_LUMINANCE16_ALPHA16_EXT)); + rb_define_const(module, "GL_LUMINANCE16_ALPHA16", INT2NUM(GL_LUMINANCE16_ALPHA16)); + rb_define_const(module, "GL_LUMINANCE16_EXT", INT2NUM(GL_LUMINANCE16_EXT)); + rb_define_const(module, "GL_LUMINANCE16F_ARB", INT2NUM(GL_LUMINANCE16F_ARB)); + rb_define_const(module, "GL_LUMINANCE16", INT2NUM(GL_LUMINANCE16)); + rb_define_const(module, "GL_LUMINANCE32F_ARB", INT2NUM(GL_LUMINANCE32F_ARB)); + rb_define_const(module, "GL_LUMINANCE4_ALPHA4_EXT", INT2NUM(GL_LUMINANCE4_ALPHA4_EXT)); + rb_define_const(module, "GL_LUMINANCE4_ALPHA4", INT2NUM(GL_LUMINANCE4_ALPHA4)); + rb_define_const(module, "GL_LUMINANCE4_EXT", INT2NUM(GL_LUMINANCE4_EXT)); + rb_define_const(module, "GL_LUMINANCE4", INT2NUM(GL_LUMINANCE4)); + rb_define_const(module, "GL_LUMINANCE6_ALPHA2_EXT", INT2NUM(GL_LUMINANCE6_ALPHA2_EXT)); + rb_define_const(module, "GL_LUMINANCE6_ALPHA2", INT2NUM(GL_LUMINANCE6_ALPHA2)); + rb_define_const(module, "GL_LUMINANCE8_ALPHA8_EXT", INT2NUM(GL_LUMINANCE8_ALPHA8_EXT)); + rb_define_const(module, "GL_LUMINANCE8_ALPHA8", INT2NUM(GL_LUMINANCE8_ALPHA8)); + rb_define_const(module, "GL_LUMINANCE8_EXT", INT2NUM(GL_LUMINANCE8_EXT)); + rb_define_const(module, "GL_LUMINANCE8", INT2NUM(GL_LUMINANCE8)); + rb_define_const(module, "GL_LUMINANCE_ALPHA16F_ARB", INT2NUM(GL_LUMINANCE_ALPHA16F_ARB)); + rb_define_const(module, "GL_LUMINANCE_ALPHA32F_ARB", INT2NUM(GL_LUMINANCE_ALPHA32F_ARB)); + rb_define_const(module, "GL_LUMINANCE_ALPHA_FLOAT16_ATI", INT2NUM(GL_LUMINANCE_ALPHA_FLOAT16_ATI)); + rb_define_const(module, "GL_LUMINANCE_ALPHA_FLOAT32_ATI", INT2NUM(GL_LUMINANCE_ALPHA_FLOAT32_ATI)); + rb_define_const(module, "GL_LUMINANCE_ALPHA", INT2NUM(GL_LUMINANCE_ALPHA)); + rb_define_const(module, "GL_LUMINANCE_FLOAT16_ATI", INT2NUM(GL_LUMINANCE_FLOAT16_ATI)); + rb_define_const(module, "GL_LUMINANCE_FLOAT32_ATI", INT2NUM(GL_LUMINANCE_FLOAT32_ATI)); + rb_define_const(module, "GL_LUMINANCE", INT2NUM(GL_LUMINANCE)); + rb_define_const(module, "GL_MAD_ATI", INT2NUM(GL_MAD_ATI)); + rb_define_const(module, "GL_MAGNITUDE_BIAS_NV", INT2NUM(GL_MAGNITUDE_BIAS_NV)); + rb_define_const(module, "GL_MAGNITUDE_SCALE_NV", INT2NUM(GL_MAGNITUDE_SCALE_NV)); + rb_define_const(module, "GL_MAP1_BINORMAL_EXT", INT2NUM(GL_MAP1_BINORMAL_EXT)); + rb_define_const(module, "GL_MAP1_COLOR_4", INT2NUM(GL_MAP1_COLOR_4)); + rb_define_const(module, "GL_MAP1_GRID_DOMAIN", INT2NUM(GL_MAP1_GRID_DOMAIN)); + rb_define_const(module, "GL_MAP1_GRID_SEGMENTS", INT2NUM(GL_MAP1_GRID_SEGMENTS)); + rb_define_const(module, "GL_MAP1_INDEX", INT2NUM(GL_MAP1_INDEX)); + rb_define_const(module, "GL_MAP1_NORMAL", INT2NUM(GL_MAP1_NORMAL)); + rb_define_const(module, "GL_MAP1_TANGENT_EXT", INT2NUM(GL_MAP1_TANGENT_EXT)); + rb_define_const(module, "GL_MAP1_TEXTURE_COORD_1", INT2NUM(GL_MAP1_TEXTURE_COORD_1)); + rb_define_const(module, "GL_MAP1_TEXTURE_COORD_2", INT2NUM(GL_MAP1_TEXTURE_COORD_2)); + rb_define_const(module, "GL_MAP1_TEXTURE_COORD_3", INT2NUM(GL_MAP1_TEXTURE_COORD_3)); + rb_define_const(module, "GL_MAP1_TEXTURE_COORD_4", INT2NUM(GL_MAP1_TEXTURE_COORD_4)); + rb_define_const(module, "GL_MAP1_VERTEX_3", INT2NUM(GL_MAP1_VERTEX_3)); + rb_define_const(module, "GL_MAP1_VERTEX_4", INT2NUM(GL_MAP1_VERTEX_4)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB0_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB0_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB10_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB10_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB11_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB11_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB12_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB12_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB13_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB13_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB14_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB14_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB1_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB1_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB15_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB15_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB2_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB2_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB3_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB3_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB4_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB4_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB5_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB5_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB6_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB6_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB7_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB7_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB8_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB8_4_NV)); + rb_define_const(module, "GL_MAP1_VERTEX_ATTRIB9_4_NV", INT2NUM(GL_MAP1_VERTEX_ATTRIB9_4_NV)); + rb_define_const(module, "GL_MAP2_BINORMAL_EXT", INT2NUM(GL_MAP2_BINORMAL_EXT)); + rb_define_const(module, "GL_MAP2_COLOR_4", INT2NUM(GL_MAP2_COLOR_4)); + rb_define_const(module, "GL_MAP2_GRID_DOMAIN", INT2NUM(GL_MAP2_GRID_DOMAIN)); + rb_define_const(module, "GL_MAP2_GRID_SEGMENTS", INT2NUM(GL_MAP2_GRID_SEGMENTS)); + rb_define_const(module, "GL_MAP2_INDEX", INT2NUM(GL_MAP2_INDEX)); + rb_define_const(module, "GL_MAP2_NORMAL", INT2NUM(GL_MAP2_NORMAL)); + rb_define_const(module, "GL_MAP2_TANGENT_EXT", INT2NUM(GL_MAP2_TANGENT_EXT)); + rb_define_const(module, "GL_MAP2_TEXTURE_COORD_1", INT2NUM(GL_MAP2_TEXTURE_COORD_1)); + rb_define_const(module, "GL_MAP2_TEXTURE_COORD_2", INT2NUM(GL_MAP2_TEXTURE_COORD_2)); + rb_define_const(module, "GL_MAP2_TEXTURE_COORD_3", INT2NUM(GL_MAP2_TEXTURE_COORD_3)); + rb_define_const(module, "GL_MAP2_TEXTURE_COORD_4", INT2NUM(GL_MAP2_TEXTURE_COORD_4)); + rb_define_const(module, "GL_MAP2_VERTEX_3", INT2NUM(GL_MAP2_VERTEX_3)); + rb_define_const(module, "GL_MAP2_VERTEX_4", INT2NUM(GL_MAP2_VERTEX_4)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB0_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB0_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB10_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB10_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB11_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB11_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB12_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB12_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB13_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB13_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB14_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB14_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB1_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB1_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB15_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB15_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB2_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB2_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB3_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB3_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB4_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB4_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB5_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB5_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB6_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB6_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB7_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB7_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB8_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB8_4_NV)); + rb_define_const(module, "GL_MAP2_VERTEX_ATTRIB9_4_NV", INT2NUM(GL_MAP2_VERTEX_ATTRIB9_4_NV)); + rb_define_const(module, "GL_MAP_ATTRIB_U_ORDER_NV", INT2NUM(GL_MAP_ATTRIB_U_ORDER_NV)); + rb_define_const(module, "GL_MAP_ATTRIB_V_ORDER_NV", INT2NUM(GL_MAP_ATTRIB_V_ORDER_NV)); + rb_define_const(module, "GL_MAP_COLOR", INT2NUM(GL_MAP_COLOR)); + rb_define_const(module, "GL_MAP_STENCIL", INT2NUM(GL_MAP_STENCIL)); + rb_define_const(module, "GL_MAP_TESSELLATION_NV", INT2NUM(GL_MAP_TESSELLATION_NV)); + rb_define_const(module, "GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI", INT2NUM(GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI)); + rb_define_const(module, "GL_MAT_AMBIENT_BIT_PGI", INT2NUM(GL_MAT_AMBIENT_BIT_PGI)); + rb_define_const(module, "GL_MAT_COLOR_INDEXES_BIT_PGI", INT2NUM(GL_MAT_COLOR_INDEXES_BIT_PGI)); + rb_define_const(module, "GL_MAT_DIFFUSE_BIT_PGI", INT2NUM(GL_MAT_DIFFUSE_BIT_PGI)); + rb_define_const(module, "GL_MAT_EMISSION_BIT_PGI", INT2NUM(GL_MAT_EMISSION_BIT_PGI)); + rb_define_const(module, "GL_MATERIAL_SIDE_HINT_PGI", INT2NUM(GL_MATERIAL_SIDE_HINT_PGI)); + rb_define_const(module, "GL_MATRIX0_ARB", INT2NUM(GL_MATRIX0_ARB)); + rb_define_const(module, "GL_MATRIX0_NV", INT2NUM(GL_MATRIX0_NV)); + rb_define_const(module, "GL_MATRIX10_ARB", INT2NUM(GL_MATRIX10_ARB)); + rb_define_const(module, "GL_MATRIX11_ARB", INT2NUM(GL_MATRIX11_ARB)); + rb_define_const(module, "GL_MATRIX12_ARB", INT2NUM(GL_MATRIX12_ARB)); + rb_define_const(module, "GL_MATRIX13_ARB", INT2NUM(GL_MATRIX13_ARB)); + rb_define_const(module, "GL_MATRIX14_ARB", INT2NUM(GL_MATRIX14_ARB)); + rb_define_const(module, "GL_MATRIX15_ARB", INT2NUM(GL_MATRIX15_ARB)); + rb_define_const(module, "GL_MATRIX16_ARB", INT2NUM(GL_MATRIX16_ARB)); + rb_define_const(module, "GL_MATRIX17_ARB", INT2NUM(GL_MATRIX17_ARB)); + rb_define_const(module, "GL_MATRIX18_ARB", INT2NUM(GL_MATRIX18_ARB)); + rb_define_const(module, "GL_MATRIX19_ARB", INT2NUM(GL_MATRIX19_ARB)); + rb_define_const(module, "GL_MATRIX1_ARB", INT2NUM(GL_MATRIX1_ARB)); + rb_define_const(module, "GL_MATRIX1_NV", INT2NUM(GL_MATRIX1_NV)); + rb_define_const(module, "GL_MATRIX20_ARB", INT2NUM(GL_MATRIX20_ARB)); + rb_define_const(module, "GL_MATRIX21_ARB", INT2NUM(GL_MATRIX21_ARB)); + rb_define_const(module, "GL_MATRIX22_ARB", INT2NUM(GL_MATRIX22_ARB)); + rb_define_const(module, "GL_MATRIX23_ARB", INT2NUM(GL_MATRIX23_ARB)); + rb_define_const(module, "GL_MATRIX24_ARB", INT2NUM(GL_MATRIX24_ARB)); + rb_define_const(module, "GL_MATRIX25_ARB", INT2NUM(GL_MATRIX25_ARB)); + rb_define_const(module, "GL_MATRIX26_ARB", INT2NUM(GL_MATRIX26_ARB)); + rb_define_const(module, "GL_MATRIX27_ARB", INT2NUM(GL_MATRIX27_ARB)); + rb_define_const(module, "GL_MATRIX28_ARB", INT2NUM(GL_MATRIX28_ARB)); + rb_define_const(module, "GL_MATRIX29_ARB", INT2NUM(GL_MATRIX29_ARB)); + rb_define_const(module, "GL_MATRIX2_ARB", INT2NUM(GL_MATRIX2_ARB)); + rb_define_const(module, "GL_MATRIX2_NV", INT2NUM(GL_MATRIX2_NV)); + rb_define_const(module, "GL_MATRIX30_ARB", INT2NUM(GL_MATRIX30_ARB)); + rb_define_const(module, "GL_MATRIX31_ARB", INT2NUM(GL_MATRIX31_ARB)); + rb_define_const(module, "GL_MATRIX3_ARB", INT2NUM(GL_MATRIX3_ARB)); + rb_define_const(module, "GL_MATRIX3_NV", INT2NUM(GL_MATRIX3_NV)); + rb_define_const(module, "GL_MATRIX4_ARB", INT2NUM(GL_MATRIX4_ARB)); + rb_define_const(module, "GL_MATRIX4_NV", INT2NUM(GL_MATRIX4_NV)); + rb_define_const(module, "GL_MATRIX5_ARB", INT2NUM(GL_MATRIX5_ARB)); + rb_define_const(module, "GL_MATRIX5_NV", INT2NUM(GL_MATRIX5_NV)); + rb_define_const(module, "GL_MATRIX6_ARB", INT2NUM(GL_MATRIX6_ARB)); + rb_define_const(module, "GL_MATRIX6_NV", INT2NUM(GL_MATRIX6_NV)); + rb_define_const(module, "GL_MATRIX7_ARB", INT2NUM(GL_MATRIX7_ARB)); + rb_define_const(module, "GL_MATRIX7_NV", INT2NUM(GL_MATRIX7_NV)); + rb_define_const(module, "GL_MATRIX8_ARB", INT2NUM(GL_MATRIX8_ARB)); + rb_define_const(module, "GL_MATRIX9_ARB", INT2NUM(GL_MATRIX9_ARB)); + rb_define_const(module, "GL_MATRIX_EXT", INT2NUM(GL_MATRIX_EXT)); + rb_define_const(module, "GL_MATRIX_INDEX_ARRAY_ARB", INT2NUM(GL_MATRIX_INDEX_ARRAY_ARB)); + rb_define_const(module, "GL_MATRIX_INDEX_ARRAY_POINTER_ARB", INT2NUM(GL_MATRIX_INDEX_ARRAY_POINTER_ARB)); + rb_define_const(module, "GL_MATRIX_INDEX_ARRAY_SIZE_ARB", INT2NUM(GL_MATRIX_INDEX_ARRAY_SIZE_ARB)); + rb_define_const(module, "GL_MATRIX_INDEX_ARRAY_STRIDE_ARB", INT2NUM(GL_MATRIX_INDEX_ARRAY_STRIDE_ARB)); + rb_define_const(module, "GL_MATRIX_INDEX_ARRAY_TYPE_ARB", INT2NUM(GL_MATRIX_INDEX_ARRAY_TYPE_ARB)); + rb_define_const(module, "GL_MATRIX_MODE", INT2NUM(GL_MATRIX_MODE)); + rb_define_const(module, "GL_MATRIX_PALETTE_ARB", INT2NUM(GL_MATRIX_PALETTE_ARB)); + rb_define_const(module, "GL_MAT_SHININESS_BIT_PGI", INT2NUM(GL_MAT_SHININESS_BIT_PGI)); + rb_define_const(module, "GL_MAT_SPECULAR_BIT_PGI", INT2NUM(GL_MAT_SPECULAR_BIT_PGI)); + rb_define_const(module, "GL_MAX_3D_TEXTURE_SIZE_EXT", INT2NUM(GL_MAX_3D_TEXTURE_SIZE_EXT)); + rb_define_const(module, "GL_MAX_3D_TEXTURE_SIZE", INT2NUM(GL_MAX_3D_TEXTURE_SIZE)); + rb_define_const(module, "GL_MAX_4D_TEXTURE_SIZE_SGIS", INT2NUM(GL_MAX_4D_TEXTURE_SIZE_SGIS)); + rb_define_const(module, "GL_MAX_ACTIVE_LIGHTS_SGIX", INT2NUM(GL_MAX_ACTIVE_LIGHTS_SGIX)); + rb_define_const(module, "GL_MAX_ASYNC_DRAW_PIXELS_SGIX", INT2NUM(GL_MAX_ASYNC_DRAW_PIXELS_SGIX)); + rb_define_const(module, "GL_MAX_ASYNC_HISTOGRAM_SGIX", INT2NUM(GL_MAX_ASYNC_HISTOGRAM_SGIX)); + rb_define_const(module, "GL_MAX_ASYNC_READ_PIXELS_SGIX", INT2NUM(GL_MAX_ASYNC_READ_PIXELS_SGIX)); + rb_define_const(module, "GL_MAX_ASYNC_TEX_IMAGE_SGIX", INT2NUM(GL_MAX_ASYNC_TEX_IMAGE_SGIX)); + rb_define_const(module, "GL_MAX_ATTRIB_STACK_DEPTH", INT2NUM(GL_MAX_ATTRIB_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", INT2NUM(GL_MAX_CLIENT_ATTRIB_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_CLIPMAP_DEPTH_SGIX", INT2NUM(GL_MAX_CLIPMAP_DEPTH_SGIX)); + rb_define_const(module, "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX", INT2NUM(GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX)); + rb_define_const(module, "GL_MAX_CLIP_PLANES", INT2NUM(GL_MAX_CLIP_PLANES)); + rb_define_const(module, "GL_MAX_COLOR_ATTACHMENTS_EXT", INT2NUM(GL_MAX_COLOR_ATTACHMENTS_EXT)); + rb_define_const(module, "GL_MAX_COLOR_MATRIX_STACK_DEPTH", INT2NUM(GL_MAX_COLOR_MATRIX_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", INT2NUM(GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI)); + rb_define_const(module, "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", INT2NUM(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB)); + rb_define_const(module, "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS", INT2NUM(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)); + rb_define_const(module, "GL_MAX_CONVOLUTION_HEIGHT_EXT", INT2NUM(GL_MAX_CONVOLUTION_HEIGHT_EXT)); + rb_define_const(module, "GL_MAX_CONVOLUTION_HEIGHT", INT2NUM(GL_MAX_CONVOLUTION_HEIGHT)); + rb_define_const(module, "GL_MAX_CONVOLUTION_WIDTH_EXT", INT2NUM(GL_MAX_CONVOLUTION_WIDTH_EXT)); + rb_define_const(module, "GL_MAX_CONVOLUTION_WIDTH", INT2NUM(GL_MAX_CONVOLUTION_WIDTH)); + rb_define_const(module, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", INT2NUM(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB)); + rb_define_const(module, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT", INT2NUM(GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT)); + rb_define_const(module, "GL_MAX_CUBE_MAP_TEXTURE_SIZE", INT2NUM(GL_MAX_CUBE_MAP_TEXTURE_SIZE)); + rb_define_const(module, "GL_MAX_DEFORMATION_ORDER_SGIX", INT2NUM(GL_MAX_DEFORMATION_ORDER_SGIX)); + rb_define_const(module, "GL_MAX_DRAW_BUFFERS_ARB", INT2NUM(GL_MAX_DRAW_BUFFERS_ARB)); + rb_define_const(module, "GL_MAX_DRAW_BUFFERS_ATI", INT2NUM(GL_MAX_DRAW_BUFFERS_ATI)); + rb_define_const(module, "GL_MAX_DRAW_BUFFERS", INT2NUM(GL_MAX_DRAW_BUFFERS)); + rb_define_const(module, "GL_MAX_ELEMENTS_INDICES_EXT", INT2NUM(GL_MAX_ELEMENTS_INDICES_EXT)); + rb_define_const(module, "GL_MAX_ELEMENTS_INDICES", INT2NUM(GL_MAX_ELEMENTS_INDICES)); + rb_define_const(module, "GL_MAX_ELEMENTS_VERTICES_EXT", INT2NUM(GL_MAX_ELEMENTS_VERTICES_EXT)); + rb_define_const(module, "GL_MAX_ELEMENTS_VERTICES", INT2NUM(GL_MAX_ELEMENTS_VERTICES)); + rb_define_const(module, "GL_MAX_EVAL_ORDER", INT2NUM(GL_MAX_EVAL_ORDER)); + rb_define_const(module, "GL_MAX_EXT", INT2NUM(GL_MAX_EXT)); + rb_define_const(module, "GL_MAX_FOG_FUNC_POINTS_SGIS", INT2NUM(GL_MAX_FOG_FUNC_POINTS_SGIS)); + rb_define_const(module, "GL_MAX_FRAGMENT_LIGHTS_SGIX", INT2NUM(GL_MAX_FRAGMENT_LIGHTS_SGIX)); + rb_define_const(module, "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", INT2NUM(GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV)); + rb_define_const(module, "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", INT2NUM(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB)); + rb_define_const(module, "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", INT2NUM(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS)); + rb_define_const(module, "GL_MAX_FRAMEZOOM_FACTOR_SGIX", INT2NUM(GL_MAX_FRAMEZOOM_FACTOR_SGIX)); + rb_define_const(module, "GL_MAX_GENERAL_COMBINERS_NV", INT2NUM(GL_MAX_GENERAL_COMBINERS_NV)); + rb_define_const(module, "GL_MAX", INT2NUM(GL_MAX)); + rb_define_const(module, "GL_MAX_LIGHTS", INT2NUM(GL_MAX_LIGHTS)); + rb_define_const(module, "GL_MAX_LIST_NESTING", INT2NUM(GL_MAX_LIST_NESTING)); + rb_define_const(module, "GL_MAX_MAP_TESSELLATION_NV", INT2NUM(GL_MAX_MAP_TESSELLATION_NV)); + rb_define_const(module, "GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB", INT2NUM(GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB)); + rb_define_const(module, "GL_MAX_MODELVIEW_STACK_DEPTH", INT2NUM(GL_MAX_MODELVIEW_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_NAME_STACK_DEPTH", INT2NUM(GL_MAX_NAME_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT", INT2NUM(GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT)); + rb_define_const(module, "GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT", INT2NUM(GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT)); + rb_define_const(module, "GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT", INT2NUM(GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT)); + rb_define_const(module, "GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT", INT2NUM(GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT)); + rb_define_const(module, "GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT", INT2NUM(GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT)); + rb_define_const(module, "GL_MAX_PALETTE_MATRICES_ARB", INT2NUM(GL_MAX_PALETTE_MATRICES_ARB)); + rb_define_const(module, "GL_MAX_PIXEL_MAP_TABLE", INT2NUM(GL_MAX_PIXEL_MAP_TABLE)); + rb_define_const(module, "GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT", INT2NUM(GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT)); + rb_define_const(module, "GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI", INT2NUM(GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI)); + rb_define_const(module, "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB", INT2NUM(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_ATTRIBS_ARB", INT2NUM(GL_MAX_PROGRAM_ATTRIBS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_CALL_DEPTH_NV", INT2NUM(GL_MAX_PROGRAM_CALL_DEPTH_NV)); + rb_define_const(module, "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB", INT2NUM(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV", INT2NUM(GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV)); + rb_define_const(module, "GL_MAX_PROGRAM_IF_DEPTH_NV", INT2NUM(GL_MAX_PROGRAM_IF_DEPTH_NV)); + rb_define_const(module, "GL_MAX_PROGRAM_INSTRUCTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB", INT2NUM(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_LOOP_COUNT_NV", INT2NUM(GL_MAX_PROGRAM_LOOP_COUNT_NV)); + rb_define_const(module, "GL_MAX_PROGRAM_LOOP_DEPTH_NV", INT2NUM(GL_MAX_PROGRAM_LOOP_DEPTH_NV)); + rb_define_const(module, "GL_MAX_PROGRAM_MATRICES_ARB", INT2NUM(GL_MAX_PROGRAM_MATRICES_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", INT2NUM(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_PARAMETERS_ARB", INT2NUM(GL_MAX_PROGRAM_PARAMETERS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_TEMPORARIES_ARB", INT2NUM(GL_MAX_PROGRAM_TEMPORARIES_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB", INT2NUM(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_MAX_PROJECTION_STACK_DEPTH", INT2NUM(GL_MAX_PROJECTION_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_RATIONAL_EVAL_ORDER_NV", INT2NUM(GL_MAX_RATIONAL_EVAL_ORDER_NV)); + rb_define_const(module, "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB", INT2NUM(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB)); + rb_define_const(module, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", INT2NUM(GL_MAX_RECTANGLE_TEXTURE_SIZE_NV)); + rb_define_const(module, "GL_MAX_RENDERBUFFER_SIZE_EXT", INT2NUM(GL_MAX_RENDERBUFFER_SIZE_EXT)); + rb_define_const(module, "GL_MAX_SAMPLES_EXT", INT2NUM(GL_MAX_SAMPLES_EXT)); + rb_define_const(module, "GL_MAX_SHININESS_NV", INT2NUM(GL_MAX_SHININESS_NV)); + rb_define_const(module, "GL_MAX_SPOT_EXPONENT_NV", INT2NUM(GL_MAX_SPOT_EXPONENT_NV)); + rb_define_const(module, "GL_MAX_TEXTURE_COORDS_ARB", INT2NUM(GL_MAX_TEXTURE_COORDS_ARB)); + rb_define_const(module, "GL_MAX_TEXTURE_COORDS", INT2NUM(GL_MAX_TEXTURE_COORDS)); + rb_define_const(module, "GL_MAX_TEXTURE_COORDS_NV", INT2NUM(GL_MAX_TEXTURE_COORDS_NV)); + rb_define_const(module, "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", INT2NUM(GL_MAX_TEXTURE_IMAGE_UNITS_ARB)); + rb_define_const(module, "GL_MAX_TEXTURE_IMAGE_UNITS", INT2NUM(GL_MAX_TEXTURE_IMAGE_UNITS)); + rb_define_const(module, "GL_MAX_TEXTURE_IMAGE_UNITS_NV", INT2NUM(GL_MAX_TEXTURE_IMAGE_UNITS_NV)); + rb_define_const(module, "GL_MAX_TEXTURE_LOD_BIAS_EXT", INT2NUM(GL_MAX_TEXTURE_LOD_BIAS_EXT)); + rb_define_const(module, "GL_MAX_TEXTURE_LOD_BIAS", INT2NUM(GL_MAX_TEXTURE_LOD_BIAS)); + rb_define_const(module, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", INT2NUM(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)); + rb_define_const(module, "GL_MAX_TEXTURE_SIZE", INT2NUM(GL_MAX_TEXTURE_SIZE)); + rb_define_const(module, "GL_MAX_TEXTURE_STACK_DEPTH", INT2NUM(GL_MAX_TEXTURE_STACK_DEPTH)); + rb_define_const(module, "GL_MAX_TEXTURE_UNITS_ARB", INT2NUM(GL_MAX_TEXTURE_UNITS_ARB)); + rb_define_const(module, "GL_MAX_TEXTURE_UNITS", INT2NUM(GL_MAX_TEXTURE_UNITS)); + rb_define_const(module, "GL_MAX_TRACK_MATRICES_NV", INT2NUM(GL_MAX_TRACK_MATRICES_NV)); + rb_define_const(module, "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV", INT2NUM(GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV)); + rb_define_const(module, "GL_MAX_VARYING_FLOATS_ARB", INT2NUM(GL_MAX_VARYING_FLOATS_ARB)); + rb_define_const(module, "GL_MAX_VARYING_FLOATS", INT2NUM(GL_MAX_VARYING_FLOATS)); + rb_define_const(module, "GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV", INT2NUM(GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV)); + rb_define_const(module, "GL_MAX_VERTEX_ATTRIBS_ARB", INT2NUM(GL_MAX_VERTEX_ATTRIBS_ARB)); + rb_define_const(module, "GL_MAX_VERTEX_ATTRIBS", INT2NUM(GL_MAX_VERTEX_ATTRIBS)); + rb_define_const(module, "GL_MAX_VERTEX_HINT_PGI", INT2NUM(GL_MAX_VERTEX_HINT_PGI)); + rb_define_const(module, "GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT", INT2NUM(GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT)); + rb_define_const(module, "GL_MAX_VERTEX_SHADER_INVARIANTS_EXT", INT2NUM(GL_MAX_VERTEX_SHADER_INVARIANTS_EXT)); + rb_define_const(module, "GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT", INT2NUM(GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT)); + rb_define_const(module, "GL_MAX_VERTEX_SHADER_LOCALS_EXT", INT2NUM(GL_MAX_VERTEX_SHADER_LOCALS_EXT)); + rb_define_const(module, "GL_MAX_VERTEX_SHADER_VARIANTS_EXT", INT2NUM(GL_MAX_VERTEX_SHADER_VARIANTS_EXT)); + rb_define_const(module, "GL_MAX_VERTEX_STREAMS_ATI", INT2NUM(GL_MAX_VERTEX_STREAMS_ATI)); + rb_define_const(module, "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", INT2NUM(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB)); + rb_define_const(module, "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS", INT2NUM(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)); + rb_define_const(module, "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", INT2NUM(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB)); + rb_define_const(module, "GL_MAX_VERTEX_UNIFORM_COMPONENTS", INT2NUM(GL_MAX_VERTEX_UNIFORM_COMPONENTS)); + rb_define_const(module, "GL_MAX_VERTEX_UNITS_ARB", INT2NUM(GL_MAX_VERTEX_UNITS_ARB)); + rb_define_const(module, "GL_MAX_VIEWPORT_DIMS", INT2NUM(GL_MAX_VIEWPORT_DIMS)); + rb_define_const(module, "GL_MIN_EXT", INT2NUM(GL_MIN_EXT)); + rb_define_const(module, "GL_MIN", INT2NUM(GL_MIN)); + rb_define_const(module, "GL_MINMAX_EXT", INT2NUM(GL_MINMAX_EXT)); + rb_define_const(module, "GL_MINMAX_FORMAT_EXT", INT2NUM(GL_MINMAX_FORMAT_EXT)); + rb_define_const(module, "GL_MINMAX_FORMAT", INT2NUM(GL_MINMAX_FORMAT)); + rb_define_const(module, "GL_MINMAX", INT2NUM(GL_MINMAX)); + rb_define_const(module, "GL_MINMAX_SINK_EXT", INT2NUM(GL_MINMAX_SINK_EXT)); + rb_define_const(module, "GL_MINMAX_SINK", INT2NUM(GL_MINMAX_SINK)); + rb_define_const(module, "GL_MIRROR_CLAMP_ATI", INT2NUM(GL_MIRROR_CLAMP_ATI)); + rb_define_const(module, "GL_MIRROR_CLAMP_EXT", INT2NUM(GL_MIRROR_CLAMP_EXT)); + rb_define_const(module, "GL_MIRROR_CLAMP_TO_BORDER_EXT", INT2NUM(GL_MIRROR_CLAMP_TO_BORDER_EXT)); + rb_define_const(module, "GL_MIRROR_CLAMP_TO_EDGE_ATI", INT2NUM(GL_MIRROR_CLAMP_TO_EDGE_ATI)); + rb_define_const(module, "GL_MIRROR_CLAMP_TO_EDGE_EXT", INT2NUM(GL_MIRROR_CLAMP_TO_EDGE_EXT)); + rb_define_const(module, "GL_MIRRORED_REPEAT_ARB", INT2NUM(GL_MIRRORED_REPEAT_ARB)); + rb_define_const(module, "GL_MIRRORED_REPEAT_IBM", INT2NUM(GL_MIRRORED_REPEAT_IBM)); + rb_define_const(module, "GL_MIRRORED_REPEAT", INT2NUM(GL_MIRRORED_REPEAT)); + rb_define_const(module, "GL_MODELVIEW0_ARB", INT2NUM(GL_MODELVIEW0_ARB)); + rb_define_const(module, "GL_MODELVIEW0_EXT", INT2NUM(GL_MODELVIEW0_EXT)); + rb_define_const(module, "GL_MODELVIEW0_MATRIX_EXT", INT2NUM(GL_MODELVIEW0_MATRIX_EXT)); + rb_define_const(module, "GL_MODELVIEW0_STACK_DEPTH_EXT", INT2NUM(GL_MODELVIEW0_STACK_DEPTH_EXT)); + rb_define_const(module, "GL_MODELVIEW10_ARB", INT2NUM(GL_MODELVIEW10_ARB)); + rb_define_const(module, "GL_MODELVIEW11_ARB", INT2NUM(GL_MODELVIEW11_ARB)); + rb_define_const(module, "GL_MODELVIEW12_ARB", INT2NUM(GL_MODELVIEW12_ARB)); + rb_define_const(module, "GL_MODELVIEW13_ARB", INT2NUM(GL_MODELVIEW13_ARB)); + rb_define_const(module, "GL_MODELVIEW14_ARB", INT2NUM(GL_MODELVIEW14_ARB)); + rb_define_const(module, "GL_MODELVIEW15_ARB", INT2NUM(GL_MODELVIEW15_ARB)); + rb_define_const(module, "GL_MODELVIEW16_ARB", INT2NUM(GL_MODELVIEW16_ARB)); + rb_define_const(module, "GL_MODELVIEW17_ARB", INT2NUM(GL_MODELVIEW17_ARB)); + rb_define_const(module, "GL_MODELVIEW18_ARB", INT2NUM(GL_MODELVIEW18_ARB)); + rb_define_const(module, "GL_MODELVIEW19_ARB", INT2NUM(GL_MODELVIEW19_ARB)); + rb_define_const(module, "GL_MODELVIEW1_ARB", INT2NUM(GL_MODELVIEW1_ARB)); + rb_define_const(module, "GL_MODELVIEW1_EXT", INT2NUM(GL_MODELVIEW1_EXT)); + rb_define_const(module, "GL_MODELVIEW1_MATRIX_EXT", INT2NUM(GL_MODELVIEW1_MATRIX_EXT)); + rb_define_const(module, "GL_MODELVIEW1_STACK_DEPTH_EXT", INT2NUM(GL_MODELVIEW1_STACK_DEPTH_EXT)); + rb_define_const(module, "GL_MODELVIEW20_ARB", INT2NUM(GL_MODELVIEW20_ARB)); + rb_define_const(module, "GL_MODELVIEW21_ARB", INT2NUM(GL_MODELVIEW21_ARB)); + rb_define_const(module, "GL_MODELVIEW22_ARB", INT2NUM(GL_MODELVIEW22_ARB)); + rb_define_const(module, "GL_MODELVIEW23_ARB", INT2NUM(GL_MODELVIEW23_ARB)); + rb_define_const(module, "GL_MODELVIEW24_ARB", INT2NUM(GL_MODELVIEW24_ARB)); + rb_define_const(module, "GL_MODELVIEW25_ARB", INT2NUM(GL_MODELVIEW25_ARB)); + rb_define_const(module, "GL_MODELVIEW26_ARB", INT2NUM(GL_MODELVIEW26_ARB)); + rb_define_const(module, "GL_MODELVIEW27_ARB", INT2NUM(GL_MODELVIEW27_ARB)); + rb_define_const(module, "GL_MODELVIEW28_ARB", INT2NUM(GL_MODELVIEW28_ARB)); + rb_define_const(module, "GL_MODELVIEW29_ARB", INT2NUM(GL_MODELVIEW29_ARB)); + rb_define_const(module, "GL_MODELVIEW2_ARB", INT2NUM(GL_MODELVIEW2_ARB)); + rb_define_const(module, "GL_MODELVIEW30_ARB", INT2NUM(GL_MODELVIEW30_ARB)); + rb_define_const(module, "GL_MODELVIEW31_ARB", INT2NUM(GL_MODELVIEW31_ARB)); + rb_define_const(module, "GL_MODELVIEW3_ARB", INT2NUM(GL_MODELVIEW3_ARB)); + rb_define_const(module, "GL_MODELVIEW4_ARB", INT2NUM(GL_MODELVIEW4_ARB)); + rb_define_const(module, "GL_MODELVIEW5_ARB", INT2NUM(GL_MODELVIEW5_ARB)); + rb_define_const(module, "GL_MODELVIEW6_ARB", INT2NUM(GL_MODELVIEW6_ARB)); + rb_define_const(module, "GL_MODELVIEW7_ARB", INT2NUM(GL_MODELVIEW7_ARB)); + rb_define_const(module, "GL_MODELVIEW8_ARB", INT2NUM(GL_MODELVIEW8_ARB)); + rb_define_const(module, "GL_MODELVIEW9_ARB", INT2NUM(GL_MODELVIEW9_ARB)); + rb_define_const(module, "GL_MODELVIEW", INT2NUM(GL_MODELVIEW)); + rb_define_const(module, "GL_MODELVIEW_MATRIX", INT2NUM(GL_MODELVIEW_MATRIX)); + rb_define_const(module, "GL_MODELVIEW_PROJECTION_NV", INT2NUM(GL_MODELVIEW_PROJECTION_NV)); + rb_define_const(module, "GL_MODELVIEW_STACK_DEPTH", INT2NUM(GL_MODELVIEW_STACK_DEPTH)); + rb_define_const(module, "GL_MODULATE_ADD_ATI", INT2NUM(GL_MODULATE_ADD_ATI)); + rb_define_const(module, "GL_MODULATE", INT2NUM(GL_MODULATE)); + rb_define_const(module, "GL_MODULATE_SIGNED_ADD_ATI", INT2NUM(GL_MODULATE_SIGNED_ADD_ATI)); + rb_define_const(module, "GL_MODULATE_SUBTRACT_ATI", INT2NUM(GL_MODULATE_SUBTRACT_ATI)); + rb_define_const(module, "GL_MOV_ATI", INT2NUM(GL_MOV_ATI)); + rb_define_const(module, "GL_MUL_ATI", INT2NUM(GL_MUL_ATI)); + rb_define_const(module, "GL_MULT", INT2NUM(GL_MULT)); + rb_define_const(module, "GL_MULTISAMPLE_3DFX", INT2NUM(GL_MULTISAMPLE_3DFX)); + rb_define_const(module, "GL_MULTISAMPLE_ARB", INT2NUM(GL_MULTISAMPLE_ARB)); + rb_define_const(module, "GL_MULTISAMPLE_BIT_3DFX", INT2NUM(GL_MULTISAMPLE_BIT_3DFX)); + rb_define_const(module, "GL_MULTISAMPLE_BIT_ARB", INT2NUM(GL_MULTISAMPLE_BIT_ARB)); + rb_define_const(module, "GL_MULTISAMPLE_BIT_EXT", INT2NUM(GL_MULTISAMPLE_BIT_EXT)); + rb_define_const(module, "GL_MULTISAMPLE_BIT", INT2NUM(GL_MULTISAMPLE_BIT)); + rb_define_const(module, "GL_MULTISAMPLE_EXT", INT2NUM(GL_MULTISAMPLE_EXT)); + rb_define_const(module, "GL_MULTISAMPLE_FILTER_HINT_NV", INT2NUM(GL_MULTISAMPLE_FILTER_HINT_NV)); + rb_define_const(module, "GL_MULTISAMPLE", INT2NUM(GL_MULTISAMPLE)); + rb_define_const(module, "GL_MULTISAMPLE_SGIS", INT2NUM(GL_MULTISAMPLE_SGIS)); + rb_define_const(module, "GL_MVP_MATRIX_EXT", INT2NUM(GL_MVP_MATRIX_EXT)); + rb_define_const(module, "GL_N3F_V3F", INT2NUM(GL_N3F_V3F)); + rb_define_const(module, "GL_NAME_STACK_DEPTH", INT2NUM(GL_NAME_STACK_DEPTH)); + rb_define_const(module, "GL_NAND", INT2NUM(GL_NAND)); + rb_define_const(module, "GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI", INT2NUM(GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI)); + rb_define_const(module, "GL_NATIVE_GRAPHICS_END_HINT_PGI", INT2NUM(GL_NATIVE_GRAPHICS_END_HINT_PGI)); + rb_define_const(module, "GL_NATIVE_GRAPHICS_HANDLE_PGI", INT2NUM(GL_NATIVE_GRAPHICS_HANDLE_PGI)); + rb_define_const(module, "GL_NEAREST_CLIPMAP_LINEAR_SGIX", INT2NUM(GL_NEAREST_CLIPMAP_LINEAR_SGIX)); + rb_define_const(module, "GL_NEAREST_CLIPMAP_NEAREST_SGIX", INT2NUM(GL_NEAREST_CLIPMAP_NEAREST_SGIX)); + rb_define_const(module, "GL_NEAREST", INT2NUM(GL_NEAREST)); + rb_define_const(module, "GL_NEAREST_MIPMAP_LINEAR", INT2NUM(GL_NEAREST_MIPMAP_LINEAR)); + rb_define_const(module, "GL_NEAREST_MIPMAP_NEAREST", INT2NUM(GL_NEAREST_MIPMAP_NEAREST)); + rb_define_const(module, "GL_NEGATE_BIT_ATI", INT2NUM(GL_NEGATE_BIT_ATI)); + rb_define_const(module, "GL_NEGATIVE_ONE_EXT", INT2NUM(GL_NEGATIVE_ONE_EXT)); + rb_define_const(module, "GL_NEGATIVE_W_EXT", INT2NUM(GL_NEGATIVE_W_EXT)); + rb_define_const(module, "GL_NEGATIVE_X_EXT", INT2NUM(GL_NEGATIVE_X_EXT)); + rb_define_const(module, "GL_NEGATIVE_Y_EXT", INT2NUM(GL_NEGATIVE_Y_EXT)); + rb_define_const(module, "GL_NEGATIVE_Z_EXT", INT2NUM(GL_NEGATIVE_Z_EXT)); + rb_define_const(module, "GL_NEVER", INT2NUM(GL_NEVER)); + rb_define_const(module, "GL_NICEST", INT2NUM(GL_NICEST)); + rb_define_const(module, "GL_NO_ERROR", INT2NUM(GL_NO_ERROR)); + rb_define_const(module, "GL_NONE", INT2NUM(GL_NONE)); + rb_define_const(module, "GL_NOOP", INT2NUM(GL_NOOP)); + rb_define_const(module, "GL_NOR", INT2NUM(GL_NOR)); + rb_define_const(module, "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_NORMAL_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_NORMAL_ARRAY_BUFFER_BINDING", INT2NUM(GL_NORMAL_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_NORMAL_ARRAY_COUNT_EXT", INT2NUM(GL_NORMAL_ARRAY_COUNT_EXT)); + rb_define_const(module, "GL_NORMAL_ARRAY_EXT", INT2NUM(GL_NORMAL_ARRAY_EXT)); + rb_define_const(module, "GL_NORMAL_ARRAY", INT2NUM(GL_NORMAL_ARRAY)); + rb_define_const(module, "GL_NORMAL_ARRAY_LIST_IBM", INT2NUM(GL_NORMAL_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_NORMAL_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_NORMAL_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL", INT2NUM(GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL)); + rb_define_const(module, "GL_NORMAL_ARRAY_POINTER_EXT", INT2NUM(GL_NORMAL_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_NORMAL_ARRAY_POINTER", INT2NUM(GL_NORMAL_ARRAY_POINTER)); + rb_define_const(module, "GL_NORMAL_ARRAY_STRIDE_EXT", INT2NUM(GL_NORMAL_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_NORMAL_ARRAY_STRIDE", INT2NUM(GL_NORMAL_ARRAY_STRIDE)); + rb_define_const(module, "GL_NORMAL_ARRAY_TYPE_EXT", INT2NUM(GL_NORMAL_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_NORMAL_ARRAY_TYPE", INT2NUM(GL_NORMAL_ARRAY_TYPE)); + rb_define_const(module, "GL_NORMAL_BIT_PGI", INT2NUM(GL_NORMAL_BIT_PGI)); + rb_define_const(module, "GL_NORMALIZED_RANGE_EXT", INT2NUM(GL_NORMALIZED_RANGE_EXT)); + rb_define_const(module, "GL_NORMALIZE", INT2NUM(GL_NORMALIZE)); + rb_define_const(module, "GL_NORMAL_MAP_ARB", INT2NUM(GL_NORMAL_MAP_ARB)); + rb_define_const(module, "GL_NORMAL_MAP_EXT", INT2NUM(GL_NORMAL_MAP_EXT)); + rb_define_const(module, "GL_NORMAL_MAP", INT2NUM(GL_NORMAL_MAP)); + rb_define_const(module, "GL_NORMAL_MAP_NV", INT2NUM(GL_NORMAL_MAP_NV)); + rb_define_const(module, "GL_NOTEQUAL", INT2NUM(GL_NOTEQUAL)); + rb_define_const(module, "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", INT2NUM(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB)); + rb_define_const(module, "GL_NUM_COMPRESSED_TEXTURE_FORMATS", INT2NUM(GL_NUM_COMPRESSED_TEXTURE_FORMATS)); + rb_define_const(module, "GL_NUM_FRAGMENT_CONSTANTS_ATI", INT2NUM(GL_NUM_FRAGMENT_CONSTANTS_ATI)); + rb_define_const(module, "GL_NUM_FRAGMENT_REGISTERS_ATI", INT2NUM(GL_NUM_FRAGMENT_REGISTERS_ATI)); + rb_define_const(module, "GL_NUM_GENERAL_COMBINERS_NV", INT2NUM(GL_NUM_GENERAL_COMBINERS_NV)); + rb_define_const(module, "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", INT2NUM(GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI)); + rb_define_const(module, "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", INT2NUM(GL_NUM_INSTRUCTIONS_PER_PASS_ATI)); + rb_define_const(module, "GL_NUM_INSTRUCTIONS_TOTAL_ATI", INT2NUM(GL_NUM_INSTRUCTIONS_TOTAL_ATI)); + rb_define_const(module, "GL_NUM_LOOPBACK_COMPONENTS_ATI", INT2NUM(GL_NUM_LOOPBACK_COMPONENTS_ATI)); + rb_define_const(module, "GL_NUM_PASSES_ATI", INT2NUM(GL_NUM_PASSES_ATI)); + rb_define_const(module, "GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB", INT2NUM(GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB)); + rb_define_const(module, "GL_OBJECT_ACTIVE_ATTRIBUTES_ARB", INT2NUM(GL_OBJECT_ACTIVE_ATTRIBUTES_ARB)); + rb_define_const(module, "GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB", INT2NUM(GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB)); + rb_define_const(module, "GL_OBJECT_ACTIVE_UNIFORMS_ARB", INT2NUM(GL_OBJECT_ACTIVE_UNIFORMS_ARB)); + rb_define_const(module, "GL_OBJECT_ATTACHED_OBJECTS_ARB", INT2NUM(GL_OBJECT_ATTACHED_OBJECTS_ARB)); + rb_define_const(module, "GL_OBJECT_BUFFER_SIZE_ATI", INT2NUM(GL_OBJECT_BUFFER_SIZE_ATI)); + rb_define_const(module, "GL_OBJECT_BUFFER_USAGE_ATI", INT2NUM(GL_OBJECT_BUFFER_USAGE_ATI)); + rb_define_const(module, "GL_OBJECT_COMPILE_STATUS_ARB", INT2NUM(GL_OBJECT_COMPILE_STATUS_ARB)); + rb_define_const(module, "GL_OBJECT_DELETE_STATUS_ARB", INT2NUM(GL_OBJECT_DELETE_STATUS_ARB)); + rb_define_const(module, "GL_OBJECT_DISTANCE_TO_LINE_SGIS", INT2NUM(GL_OBJECT_DISTANCE_TO_LINE_SGIS)); + rb_define_const(module, "GL_OBJECT_DISTANCE_TO_POINT_SGIS", INT2NUM(GL_OBJECT_DISTANCE_TO_POINT_SGIS)); + rb_define_const(module, "GL_OBJECT_INFO_LOG_LENGTH_ARB", INT2NUM(GL_OBJECT_INFO_LOG_LENGTH_ARB)); + rb_define_const(module, "GL_OBJECT_LINEAR", INT2NUM(GL_OBJECT_LINEAR)); + rb_define_const(module, "GL_OBJECT_LINE_SGIS", INT2NUM(GL_OBJECT_LINE_SGIS)); + rb_define_const(module, "GL_OBJECT_LINK_STATUS_ARB", INT2NUM(GL_OBJECT_LINK_STATUS_ARB)); + rb_define_const(module, "GL_OBJECT_PLANE", INT2NUM(GL_OBJECT_PLANE)); + rb_define_const(module, "GL_OBJECT_POINT_SGIS", INT2NUM(GL_OBJECT_POINT_SGIS)); + rb_define_const(module, "GL_OBJECT_SHADER_SOURCE_LENGTH_ARB", INT2NUM(GL_OBJECT_SHADER_SOURCE_LENGTH_ARB)); + rb_define_const(module, "GL_OBJECT_SUBTYPE_ARB", INT2NUM(GL_OBJECT_SUBTYPE_ARB)); + rb_define_const(module, "GL_OBJECT_TYPE_ARB", INT2NUM(GL_OBJECT_TYPE_ARB)); + rb_define_const(module, "GL_OBJECT_VALIDATE_STATUS_ARB", INT2NUM(GL_OBJECT_VALIDATE_STATUS_ARB)); + rb_define_const(module, "GL_OCCLUSION_TEST_HP", INT2NUM(GL_OCCLUSION_TEST_HP)); + rb_define_const(module, "GL_OCCLUSION_TEST_RESULT_HP", INT2NUM(GL_OCCLUSION_TEST_RESULT_HP)); + rb_define_const(module, "GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV", INT2NUM(GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV)); + rb_define_const(module, "GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV", INT2NUM(GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_OFFSET_HILO_TEXTURE_2D_NV", INT2NUM(GL_OFFSET_HILO_TEXTURE_2D_NV)); + rb_define_const(module, "GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV", INT2NUM(GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV", INT2NUM(GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV)); + rb_define_const(module, "GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV", INT2NUM(GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV)); + rb_define_const(module, "GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV", INT2NUM(GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV", INT2NUM(GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_2D_BIAS_NV", INT2NUM(GL_OFFSET_TEXTURE_2D_BIAS_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_2D_MATRIX_NV", INT2NUM(GL_OFFSET_TEXTURE_2D_MATRIX_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_2D_NV", INT2NUM(GL_OFFSET_TEXTURE_2D_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_2D_SCALE_NV", INT2NUM(GL_OFFSET_TEXTURE_2D_SCALE_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_BIAS_NV", INT2NUM(GL_OFFSET_TEXTURE_BIAS_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_MATRIX_NV", INT2NUM(GL_OFFSET_TEXTURE_MATRIX_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_RECTANGLE_NV", INT2NUM(GL_OFFSET_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV", INT2NUM(GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV)); + rb_define_const(module, "GL_OFFSET_TEXTURE_SCALE_NV", INT2NUM(GL_OFFSET_TEXTURE_SCALE_NV)); + rb_define_const(module, "GL_ONE_EXT", INT2NUM(GL_ONE_EXT)); + rb_define_const(module, "GL_ONE", INT2NUM(GL_ONE)); + rb_define_const(module, "GL_ONE_MINUS_CONSTANT_ALPHA_EXT", INT2NUM(GL_ONE_MINUS_CONSTANT_ALPHA_EXT)); + rb_define_const(module, "GL_ONE_MINUS_CONSTANT_ALPHA", INT2NUM(GL_ONE_MINUS_CONSTANT_ALPHA)); + rb_define_const(module, "GL_ONE_MINUS_CONSTANT_COLOR_EXT", INT2NUM(GL_ONE_MINUS_CONSTANT_COLOR_EXT)); + rb_define_const(module, "GL_ONE_MINUS_CONSTANT_COLOR", INT2NUM(GL_ONE_MINUS_CONSTANT_COLOR)); + rb_define_const(module, "GL_ONE_MINUS_DST_ALPHA", INT2NUM(GL_ONE_MINUS_DST_ALPHA)); + rb_define_const(module, "GL_ONE_MINUS_DST_COLOR", INT2NUM(GL_ONE_MINUS_DST_COLOR)); + rb_define_const(module, "GL_ONE_MINUS_SRC_ALPHA", INT2NUM(GL_ONE_MINUS_SRC_ALPHA)); + rb_define_const(module, "GL_ONE_MINUS_SRC_COLOR", INT2NUM(GL_ONE_MINUS_SRC_COLOR)); + rb_define_const(module, "GL_OP_ADD_EXT", INT2NUM(GL_OP_ADD_EXT)); + rb_define_const(module, "GL_OP_CLAMP_EXT", INT2NUM(GL_OP_CLAMP_EXT)); + rb_define_const(module, "GL_OP_CROSS_PRODUCT_EXT", INT2NUM(GL_OP_CROSS_PRODUCT_EXT)); + rb_define_const(module, "GL_OP_DOT3_EXT", INT2NUM(GL_OP_DOT3_EXT)); + rb_define_const(module, "GL_OP_DOT4_EXT", INT2NUM(GL_OP_DOT4_EXT)); + rb_define_const(module, "GL_OPERAND0_ALPHA_ARB", INT2NUM(GL_OPERAND0_ALPHA_ARB)); + rb_define_const(module, "GL_OPERAND0_ALPHA_EXT", INT2NUM(GL_OPERAND0_ALPHA_EXT)); + rb_define_const(module, "GL_OPERAND0_ALPHA", INT2NUM(GL_OPERAND0_ALPHA)); + rb_define_const(module, "GL_OPERAND0_RGB_ARB", INT2NUM(GL_OPERAND0_RGB_ARB)); + rb_define_const(module, "GL_OPERAND0_RGB_EXT", INT2NUM(GL_OPERAND0_RGB_EXT)); + rb_define_const(module, "GL_OPERAND0_RGB", INT2NUM(GL_OPERAND0_RGB)); + rb_define_const(module, "GL_OPERAND1_ALPHA_ARB", INT2NUM(GL_OPERAND1_ALPHA_ARB)); + rb_define_const(module, "GL_OPERAND1_ALPHA_EXT", INT2NUM(GL_OPERAND1_ALPHA_EXT)); + rb_define_const(module, "GL_OPERAND1_ALPHA", INT2NUM(GL_OPERAND1_ALPHA)); + rb_define_const(module, "GL_OPERAND1_RGB_ARB", INT2NUM(GL_OPERAND1_RGB_ARB)); + rb_define_const(module, "GL_OPERAND1_RGB_EXT", INT2NUM(GL_OPERAND1_RGB_EXT)); + rb_define_const(module, "GL_OPERAND1_RGB", INT2NUM(GL_OPERAND1_RGB)); + rb_define_const(module, "GL_OPERAND2_ALPHA_ARB", INT2NUM(GL_OPERAND2_ALPHA_ARB)); + rb_define_const(module, "GL_OPERAND2_ALPHA_EXT", INT2NUM(GL_OPERAND2_ALPHA_EXT)); + rb_define_const(module, "GL_OPERAND2_ALPHA", INT2NUM(GL_OPERAND2_ALPHA)); + rb_define_const(module, "GL_OPERAND2_RGB_ARB", INT2NUM(GL_OPERAND2_RGB_ARB)); + rb_define_const(module, "GL_OPERAND2_RGB_EXT", INT2NUM(GL_OPERAND2_RGB_EXT)); + rb_define_const(module, "GL_OPERAND2_RGB", INT2NUM(GL_OPERAND2_RGB)); + rb_define_const(module, "GL_OPERAND3_ALPHA_NV", INT2NUM(GL_OPERAND3_ALPHA_NV)); + rb_define_const(module, "GL_OPERAND3_RGB_NV", INT2NUM(GL_OPERAND3_RGB_NV)); + rb_define_const(module, "GL_OP_EXP_BASE_2_EXT", INT2NUM(GL_OP_EXP_BASE_2_EXT)); + rb_define_const(module, "GL_OP_FLOOR_EXT", INT2NUM(GL_OP_FLOOR_EXT)); + rb_define_const(module, "GL_OP_FRAC_EXT", INT2NUM(GL_OP_FRAC_EXT)); + rb_define_const(module, "GL_OP_INDEX_EXT", INT2NUM(GL_OP_INDEX_EXT)); + rb_define_const(module, "GL_OP_LOG_BASE_2_EXT", INT2NUM(GL_OP_LOG_BASE_2_EXT)); + rb_define_const(module, "GL_OP_MADD_EXT", INT2NUM(GL_OP_MADD_EXT)); + rb_define_const(module, "GL_OP_MAX_EXT", INT2NUM(GL_OP_MAX_EXT)); + rb_define_const(module, "GL_OP_MIN_EXT", INT2NUM(GL_OP_MIN_EXT)); + rb_define_const(module, "GL_OP_MOV_EXT", INT2NUM(GL_OP_MOV_EXT)); + rb_define_const(module, "GL_OP_MUL_EXT", INT2NUM(GL_OP_MUL_EXT)); + rb_define_const(module, "GL_OP_MULTIPLY_MATRIX_EXT", INT2NUM(GL_OP_MULTIPLY_MATRIX_EXT)); + rb_define_const(module, "GL_OP_NEGATE_EXT", INT2NUM(GL_OP_NEGATE_EXT)); + rb_define_const(module, "GL_OP_POWER_EXT", INT2NUM(GL_OP_POWER_EXT)); + rb_define_const(module, "GL_OP_RECIP_EXT", INT2NUM(GL_OP_RECIP_EXT)); + rb_define_const(module, "GL_OP_RECIP_SQRT_EXT", INT2NUM(GL_OP_RECIP_SQRT_EXT)); + rb_define_const(module, "GL_OP_ROUND_EXT", INT2NUM(GL_OP_ROUND_EXT)); + rb_define_const(module, "GL_OP_SET_GE_EXT", INT2NUM(GL_OP_SET_GE_EXT)); + rb_define_const(module, "GL_OP_SET_LT_EXT", INT2NUM(GL_OP_SET_LT_EXT)); + rb_define_const(module, "GL_OP_SUB_EXT", INT2NUM(GL_OP_SUB_EXT)); + rb_define_const(module, "GL_ORDER", INT2NUM(GL_ORDER)); + rb_define_const(module, "GL_OR", INT2NUM(GL_OR)); + rb_define_const(module, "GL_OR_INVERTED", INT2NUM(GL_OR_INVERTED)); + rb_define_const(module, "GL_OR_REVERSE", INT2NUM(GL_OR_REVERSE)); + rb_define_const(module, "GL_OUT_OF_MEMORY", INT2NUM(GL_OUT_OF_MEMORY)); + rb_define_const(module, "GL_OUTPUT_COLOR0_EXT", INT2NUM(GL_OUTPUT_COLOR0_EXT)); + rb_define_const(module, "GL_OUTPUT_COLOR1_EXT", INT2NUM(GL_OUTPUT_COLOR1_EXT)); + rb_define_const(module, "GL_OUTPUT_FOG_EXT", INT2NUM(GL_OUTPUT_FOG_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD0_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD0_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD10_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD10_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD11_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD11_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD12_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD12_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD13_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD13_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD14_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD14_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD15_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD15_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD16_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD16_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD17_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD17_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD18_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD18_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD19_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD19_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD1_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD1_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD20_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD20_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD21_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD21_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD22_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD22_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD23_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD23_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD24_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD24_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD25_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD25_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD26_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD26_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD27_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD27_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD28_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD28_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD29_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD29_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD2_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD2_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD30_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD30_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD31_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD31_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD3_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD3_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD4_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD4_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD5_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD5_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD6_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD6_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD7_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD7_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD8_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD8_EXT)); + rb_define_const(module, "GL_OUTPUT_TEXTURE_COORD9_EXT", INT2NUM(GL_OUTPUT_TEXTURE_COORD9_EXT)); + rb_define_const(module, "GL_OUTPUT_VERTEX_EXT", INT2NUM(GL_OUTPUT_VERTEX_EXT)); + rb_define_const(module, "GL_PACK_ALIGNMENT", INT2NUM(GL_PACK_ALIGNMENT)); + rb_define_const(module, "GL_PACK_CMYK_HINT_EXT", INT2NUM(GL_PACK_CMYK_HINT_EXT)); + rb_define_const(module, "GL_PACK_IMAGE_DEPTH_SGIS", INT2NUM(GL_PACK_IMAGE_DEPTH_SGIS)); + rb_define_const(module, "GL_PACK_IMAGE_HEIGHT_EXT", INT2NUM(GL_PACK_IMAGE_HEIGHT_EXT)); + rb_define_const(module, "GL_PACK_IMAGE_HEIGHT", INT2NUM(GL_PACK_IMAGE_HEIGHT)); + rb_define_const(module, "GL_PACK_INVERT_MESA", INT2NUM(GL_PACK_INVERT_MESA)); + rb_define_const(module, "GL_PACK_LSB_FIRST", INT2NUM(GL_PACK_LSB_FIRST)); + rb_define_const(module, "GL_PACK_RESAMPLE_OML", INT2NUM(GL_PACK_RESAMPLE_OML)); + rb_define_const(module, "GL_PACK_RESAMPLE_SGIX", INT2NUM(GL_PACK_RESAMPLE_SGIX)); + rb_define_const(module, "GL_PACK_ROW_LENGTH", INT2NUM(GL_PACK_ROW_LENGTH)); + rb_define_const(module, "GL_PACK_SKIP_IMAGES_EXT", INT2NUM(GL_PACK_SKIP_IMAGES_EXT)); + rb_define_const(module, "GL_PACK_SKIP_IMAGES", INT2NUM(GL_PACK_SKIP_IMAGES)); + rb_define_const(module, "GL_PACK_SKIP_PIXELS", INT2NUM(GL_PACK_SKIP_PIXELS)); + rb_define_const(module, "GL_PACK_SKIP_ROWS", INT2NUM(GL_PACK_SKIP_ROWS)); + rb_define_const(module, "GL_PACK_SKIP_VOLUMES_SGIS", INT2NUM(GL_PACK_SKIP_VOLUMES_SGIS)); + rb_define_const(module, "GL_PACK_SUBSAMPLE_RATE_SGIX", INT2NUM(GL_PACK_SUBSAMPLE_RATE_SGIX)); + rb_define_const(module, "GL_PACK_SWAP_BYTES", INT2NUM(GL_PACK_SWAP_BYTES)); + rb_define_const(module, "GL_PARALLEL_ARRAYS_INTEL", INT2NUM(GL_PARALLEL_ARRAYS_INTEL)); + rb_define_const(module, "GL_PASS_THROUGH_NV", INT2NUM(GL_PASS_THROUGH_NV)); + rb_define_const(module, "GL_PASS_THROUGH_TOKEN", INT2NUM(GL_PASS_THROUGH_TOKEN)); + rb_define_const(module, "GL_PERSPECTIVE_CORRECTION_HINT", INT2NUM(GL_PERSPECTIVE_CORRECTION_HINT)); + rb_define_const(module, "GL_PER_STAGE_CONSTANTS_NV", INT2NUM(GL_PER_STAGE_CONSTANTS_NV)); + rb_define_const(module, "GL_PERTURB_EXT", INT2NUM(GL_PERTURB_EXT)); + rb_define_const(module, "GL_PHONG_HINT_WIN", INT2NUM(GL_PHONG_HINT_WIN)); + rb_define_const(module, "GL_PHONG_WIN", INT2NUM(GL_PHONG_WIN)); + rb_define_const(module, "GL_PIXEL_COUNT_AVAILABLE_NV", INT2NUM(GL_PIXEL_COUNT_AVAILABLE_NV)); + rb_define_const(module, "GL_PIXEL_COUNTER_BITS_NV", INT2NUM(GL_PIXEL_COUNTER_BITS_NV)); + rb_define_const(module, "GL_PIXEL_COUNT_NV", INT2NUM(GL_PIXEL_COUNT_NV)); + rb_define_const(module, "GL_PIXEL_CUBIC_WEIGHT_EXT", INT2NUM(GL_PIXEL_CUBIC_WEIGHT_EXT)); + rb_define_const(module, "GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS", INT2NUM(GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS)); + rb_define_const(module, "GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS", INT2NUM(GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS)); + rb_define_const(module, "GL_PIXEL_GROUP_COLOR_SGIS", INT2NUM(GL_PIXEL_GROUP_COLOR_SGIS)); + rb_define_const(module, "GL_PIXEL_MAG_FILTER_EXT", INT2NUM(GL_PIXEL_MAG_FILTER_EXT)); + rb_define_const(module, "GL_PIXEL_MAP_A_TO_A", INT2NUM(GL_PIXEL_MAP_A_TO_A)); + rb_define_const(module, "GL_PIXEL_MAP_A_TO_A_SIZE", INT2NUM(GL_PIXEL_MAP_A_TO_A_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_B_TO_B", INT2NUM(GL_PIXEL_MAP_B_TO_B)); + rb_define_const(module, "GL_PIXEL_MAP_B_TO_B_SIZE", INT2NUM(GL_PIXEL_MAP_B_TO_B_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_G_TO_G", INT2NUM(GL_PIXEL_MAP_G_TO_G)); + rb_define_const(module, "GL_PIXEL_MAP_G_TO_G_SIZE", INT2NUM(GL_PIXEL_MAP_G_TO_G_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_A", INT2NUM(GL_PIXEL_MAP_I_TO_A)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_A_SIZE", INT2NUM(GL_PIXEL_MAP_I_TO_A_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_B", INT2NUM(GL_PIXEL_MAP_I_TO_B)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_B_SIZE", INT2NUM(GL_PIXEL_MAP_I_TO_B_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_G", INT2NUM(GL_PIXEL_MAP_I_TO_G)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_G_SIZE", INT2NUM(GL_PIXEL_MAP_I_TO_G_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_I", INT2NUM(GL_PIXEL_MAP_I_TO_I)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_I_SIZE", INT2NUM(GL_PIXEL_MAP_I_TO_I_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_R", INT2NUM(GL_PIXEL_MAP_I_TO_R)); + rb_define_const(module, "GL_PIXEL_MAP_I_TO_R_SIZE", INT2NUM(GL_PIXEL_MAP_I_TO_R_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_R_TO_R", INT2NUM(GL_PIXEL_MAP_R_TO_R)); + rb_define_const(module, "GL_PIXEL_MAP_R_TO_R_SIZE", INT2NUM(GL_PIXEL_MAP_R_TO_R_SIZE)); + rb_define_const(module, "GL_PIXEL_MAP_S_TO_S", INT2NUM(GL_PIXEL_MAP_S_TO_S)); + rb_define_const(module, "GL_PIXEL_MAP_S_TO_S_SIZE", INT2NUM(GL_PIXEL_MAP_S_TO_S_SIZE)); + rb_define_const(module, "GL_PIXEL_MIN_FILTER_EXT", INT2NUM(GL_PIXEL_MIN_FILTER_EXT)); + rb_define_const(module, "GL_PIXEL_MODE_BIT", INT2NUM(GL_PIXEL_MODE_BIT)); + rb_define_const(module, "GL_PIXEL_PACK_BUFFER_ARB", INT2NUM(GL_PIXEL_PACK_BUFFER_ARB)); + rb_define_const(module, "GL_PIXEL_PACK_BUFFER_BINDING_ARB", INT2NUM(GL_PIXEL_PACK_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_PIXEL_PACK_BUFFER_BINDING_EXT", INT2NUM(GL_PIXEL_PACK_BUFFER_BINDING_EXT)); + rb_define_const(module, "GL_PIXEL_PACK_BUFFER_BINDING", INT2NUM(GL_PIXEL_PACK_BUFFER_BINDING)); + rb_define_const(module, "GL_PIXEL_PACK_BUFFER_EXT", INT2NUM(GL_PIXEL_PACK_BUFFER_EXT)); + rb_define_const(module, "GL_PIXEL_PACK_BUFFER", INT2NUM(GL_PIXEL_PACK_BUFFER)); + rb_define_const(module, "GL_PIXEL_SUBSAMPLE_2424_SGIX", INT2NUM(GL_PIXEL_SUBSAMPLE_2424_SGIX)); + rb_define_const(module, "GL_PIXEL_SUBSAMPLE_4242_SGIX", INT2NUM(GL_PIXEL_SUBSAMPLE_4242_SGIX)); + rb_define_const(module, "GL_PIXEL_SUBSAMPLE_4444_SGIX", INT2NUM(GL_PIXEL_SUBSAMPLE_4444_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_MODE_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_MODE_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_Q_CEILING_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_Q_CEILING_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_Q_ROUND_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_Q_ROUND_SGIX)); + rb_define_const(module, "GL_PIXEL_TEX_GEN_SGIX", INT2NUM(GL_PIXEL_TEX_GEN_SGIX)); + rb_define_const(module, "GL_PIXEL_TEXTURE_SGIS", INT2NUM(GL_PIXEL_TEXTURE_SGIS)); + rb_define_const(module, "GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX", INT2NUM(GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_CACHE_INCREMENT_SGIX", INT2NUM(GL_PIXEL_TILE_CACHE_INCREMENT_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_CACHE_SIZE_SGIX", INT2NUM(GL_PIXEL_TILE_CACHE_SIZE_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_GRID_DEPTH_SGIX", INT2NUM(GL_PIXEL_TILE_GRID_DEPTH_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_GRID_HEIGHT_SGIX", INT2NUM(GL_PIXEL_TILE_GRID_HEIGHT_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_GRID_WIDTH_SGIX", INT2NUM(GL_PIXEL_TILE_GRID_WIDTH_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_HEIGHT_SGIX", INT2NUM(GL_PIXEL_TILE_HEIGHT_SGIX)); + rb_define_const(module, "GL_PIXEL_TILE_WIDTH_SGIX", INT2NUM(GL_PIXEL_TILE_WIDTH_SGIX)); + rb_define_const(module, "GL_PIXEL_TRANSFORM_2D_EXT", INT2NUM(GL_PIXEL_TRANSFORM_2D_EXT)); + rb_define_const(module, "GL_PIXEL_TRANSFORM_2D_MATRIX_EXT", INT2NUM(GL_PIXEL_TRANSFORM_2D_MATRIX_EXT)); + rb_define_const(module, "GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT", INT2NUM(GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT)); + rb_define_const(module, "GL_PIXEL_UNPACK_BUFFER_ARB", INT2NUM(GL_PIXEL_UNPACK_BUFFER_ARB)); + rb_define_const(module, "GL_PIXEL_UNPACK_BUFFER_BINDING_ARB", INT2NUM(GL_PIXEL_UNPACK_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", INT2NUM(GL_PIXEL_UNPACK_BUFFER_BINDING_EXT)); + rb_define_const(module, "GL_PIXEL_UNPACK_BUFFER_BINDING", INT2NUM(GL_PIXEL_UNPACK_BUFFER_BINDING)); + rb_define_const(module, "GL_PIXEL_UNPACK_BUFFER_EXT", INT2NUM(GL_PIXEL_UNPACK_BUFFER_EXT)); + rb_define_const(module, "GL_PIXEL_UNPACK_BUFFER", INT2NUM(GL_PIXEL_UNPACK_BUFFER)); + rb_define_const(module, "GL_PN_TRIANGLES_ATI", INT2NUM(GL_PN_TRIANGLES_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_NORMAL_MODE_ATI", INT2NUM(GL_PN_TRIANGLES_NORMAL_MODE_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI", INT2NUM(GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI", INT2NUM(GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_POINT_MODE_ATI", INT2NUM(GL_PN_TRIANGLES_POINT_MODE_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI", INT2NUM(GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI", INT2NUM(GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI)); + rb_define_const(module, "GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI", INT2NUM(GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI)); + rb_define_const(module, "GL_POINT_BIT", INT2NUM(GL_POINT_BIT)); + rb_define_const(module, "GL_POINT_DISTANCE_ATTENUATION_ARB", INT2NUM(GL_POINT_DISTANCE_ATTENUATION_ARB)); + rb_define_const(module, "GL_POINT_DISTANCE_ATTENUATION", INT2NUM(GL_POINT_DISTANCE_ATTENUATION)); + rb_define_const(module, "GL_POINT_FADE_THRESHOLD_SIZE_ARB", INT2NUM(GL_POINT_FADE_THRESHOLD_SIZE_ARB)); + rb_define_const(module, "GL_POINT_FADE_THRESHOLD_SIZE_EXT", INT2NUM(GL_POINT_FADE_THRESHOLD_SIZE_EXT)); + rb_define_const(module, "GL_POINT_FADE_THRESHOLD_SIZE", INT2NUM(GL_POINT_FADE_THRESHOLD_SIZE)); + rb_define_const(module, "GL_POINT_FADE_THRESHOLD_SIZE_SGIS", INT2NUM(GL_POINT_FADE_THRESHOLD_SIZE_SGIS)); + rb_define_const(module, "GL_POINT", INT2NUM(GL_POINT)); + rb_define_const(module, "GL_POINTS", INT2NUM(GL_POINTS)); + rb_define_const(module, "GL_POINT_SIZE_GRANULARITY", INT2NUM(GL_POINT_SIZE_GRANULARITY)); + rb_define_const(module, "GL_POINT_SIZE", INT2NUM(GL_POINT_SIZE)); + rb_define_const(module, "GL_POINT_SIZE_MAX_ARB", INT2NUM(GL_POINT_SIZE_MAX_ARB)); + rb_define_const(module, "GL_POINT_SIZE_MAX_EXT", INT2NUM(GL_POINT_SIZE_MAX_EXT)); + rb_define_const(module, "GL_POINT_SIZE_MAX", INT2NUM(GL_POINT_SIZE_MAX)); + rb_define_const(module, "GL_POINT_SIZE_MAX_SGIS", INT2NUM(GL_POINT_SIZE_MAX_SGIS)); + rb_define_const(module, "GL_POINT_SIZE_MIN_ARB", INT2NUM(GL_POINT_SIZE_MIN_ARB)); + rb_define_const(module, "GL_POINT_SIZE_MIN_EXT", INT2NUM(GL_POINT_SIZE_MIN_EXT)); + rb_define_const(module, "GL_POINT_SIZE_MIN", INT2NUM(GL_POINT_SIZE_MIN)); + rb_define_const(module, "GL_POINT_SIZE_MIN_SGIS", INT2NUM(GL_POINT_SIZE_MIN_SGIS)); + rb_define_const(module, "GL_POINT_SIZE_RANGE", INT2NUM(GL_POINT_SIZE_RANGE)); + rb_define_const(module, "GL_POINT_SMOOTH_HINT", INT2NUM(GL_POINT_SMOOTH_HINT)); + rb_define_const(module, "GL_POINT_SMOOTH", INT2NUM(GL_POINT_SMOOTH)); + rb_define_const(module, "GL_POINT_SPRITE_ARB", INT2NUM(GL_POINT_SPRITE_ARB)); + rb_define_const(module, "GL_POINT_SPRITE_COORD_ORIGIN", INT2NUM(GL_POINT_SPRITE_COORD_ORIGIN)); + rb_define_const(module, "GL_POINT_SPRITE", INT2NUM(GL_POINT_SPRITE)); + rb_define_const(module, "GL_POINT_SPRITE_NV", INT2NUM(GL_POINT_SPRITE_NV)); + rb_define_const(module, "GL_POINT_SPRITE_R_MODE_NV", INT2NUM(GL_POINT_SPRITE_R_MODE_NV)); + rb_define_const(module, "GL_POINT_TOKEN", INT2NUM(GL_POINT_TOKEN)); + rb_define_const(module, "GL_POLYGON_BIT", INT2NUM(GL_POLYGON_BIT)); + rb_define_const(module, "GL_POLYGON", INT2NUM(GL_POLYGON)); + rb_define_const(module, "GL_POLYGON_MODE", INT2NUM(GL_POLYGON_MODE)); + rb_define_const(module, "GL_POLYGON_OFFSET_BIAS_EXT", INT2NUM(GL_POLYGON_OFFSET_BIAS_EXT)); + rb_define_const(module, "GL_POLYGON_OFFSET_EXT", INT2NUM(GL_POLYGON_OFFSET_EXT)); + rb_define_const(module, "GL_POLYGON_OFFSET_FACTOR_EXT", INT2NUM(GL_POLYGON_OFFSET_FACTOR_EXT)); + rb_define_const(module, "GL_POLYGON_OFFSET_FACTOR", INT2NUM(GL_POLYGON_OFFSET_FACTOR)); + rb_define_const(module, "GL_POLYGON_OFFSET_FILL", INT2NUM(GL_POLYGON_OFFSET_FILL)); + rb_define_const(module, "GL_POLYGON_OFFSET_LINE", INT2NUM(GL_POLYGON_OFFSET_LINE)); + rb_define_const(module, "GL_POLYGON_OFFSET_POINT", INT2NUM(GL_POLYGON_OFFSET_POINT)); + rb_define_const(module, "GL_POLYGON_OFFSET_UNITS", INT2NUM(GL_POLYGON_OFFSET_UNITS)); + rb_define_const(module, "GL_POLYGON_SMOOTH_HINT", INT2NUM(GL_POLYGON_SMOOTH_HINT)); + rb_define_const(module, "GL_POLYGON_SMOOTH", INT2NUM(GL_POLYGON_SMOOTH)); + rb_define_const(module, "GL_POLYGON_STIPPLE_BIT", INT2NUM(GL_POLYGON_STIPPLE_BIT)); + rb_define_const(module, "GL_POLYGON_STIPPLE", INT2NUM(GL_POLYGON_STIPPLE)); + rb_define_const(module, "GL_POLYGON_TOKEN", INT2NUM(GL_POLYGON_TOKEN)); + rb_define_const(module, "GL_POSITION", INT2NUM(GL_POSITION)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_ALPHA_BIAS", INT2NUM(GL_POST_COLOR_MATRIX_ALPHA_BIAS)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", INT2NUM(GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_ALPHA_SCALE", INT2NUM(GL_POST_COLOR_MATRIX_ALPHA_SCALE)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", INT2NUM(GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_BLUE_BIAS", INT2NUM(GL_POST_COLOR_MATRIX_BLUE_BIAS)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", INT2NUM(GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_BLUE_SCALE", INT2NUM(GL_POST_COLOR_MATRIX_BLUE_SCALE)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", INT2NUM(GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_COLOR_TABLE", INT2NUM(GL_POST_COLOR_MATRIX_COLOR_TABLE)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", INT2NUM(GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_GREEN_BIAS", INT2NUM(GL_POST_COLOR_MATRIX_GREEN_BIAS)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", INT2NUM(GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_GREEN_SCALE", INT2NUM(GL_POST_COLOR_MATRIX_GREEN_SCALE)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", INT2NUM(GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_RED_BIAS", INT2NUM(GL_POST_COLOR_MATRIX_RED_BIAS)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", INT2NUM(GL_POST_COLOR_MATRIX_RED_BIAS_SGI)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_RED_SCALE", INT2NUM(GL_POST_COLOR_MATRIX_RED_SCALE)); + rb_define_const(module, "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", INT2NUM(GL_POST_COLOR_MATRIX_RED_SCALE_SGI)); + rb_define_const(module, "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", INT2NUM(GL_POST_CONVOLUTION_ALPHA_BIAS_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_ALPHA_BIAS", INT2NUM(GL_POST_CONVOLUTION_ALPHA_BIAS)); + rb_define_const(module, "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", INT2NUM(GL_POST_CONVOLUTION_ALPHA_SCALE_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_ALPHA_SCALE", INT2NUM(GL_POST_CONVOLUTION_ALPHA_SCALE)); + rb_define_const(module, "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", INT2NUM(GL_POST_CONVOLUTION_BLUE_BIAS_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_BLUE_BIAS", INT2NUM(GL_POST_CONVOLUTION_BLUE_BIAS)); + rb_define_const(module, "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", INT2NUM(GL_POST_CONVOLUTION_BLUE_SCALE_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_BLUE_SCALE", INT2NUM(GL_POST_CONVOLUTION_BLUE_SCALE)); + rb_define_const(module, "GL_POST_CONVOLUTION_COLOR_TABLE", INT2NUM(GL_POST_CONVOLUTION_COLOR_TABLE)); + rb_define_const(module, "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", INT2NUM(GL_POST_CONVOLUTION_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", INT2NUM(GL_POST_CONVOLUTION_GREEN_BIAS_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_GREEN_BIAS", INT2NUM(GL_POST_CONVOLUTION_GREEN_BIAS)); + rb_define_const(module, "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", INT2NUM(GL_POST_CONVOLUTION_GREEN_SCALE_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_GREEN_SCALE", INT2NUM(GL_POST_CONVOLUTION_GREEN_SCALE)); + rb_define_const(module, "GL_POST_CONVOLUTION_RED_BIAS_EXT", INT2NUM(GL_POST_CONVOLUTION_RED_BIAS_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_RED_BIAS", INT2NUM(GL_POST_CONVOLUTION_RED_BIAS)); + rb_define_const(module, "GL_POST_CONVOLUTION_RED_SCALE_EXT", INT2NUM(GL_POST_CONVOLUTION_RED_SCALE_EXT)); + rb_define_const(module, "GL_POST_CONVOLUTION_RED_SCALE", INT2NUM(GL_POST_CONVOLUTION_RED_SCALE)); + rb_define_const(module, "GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP", INT2NUM(GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP)); + rb_define_const(module, "GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX", INT2NUM(GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX)); + rb_define_const(module, "GL_POST_TEXTURE_FILTER_BIAS_SGIX", INT2NUM(GL_POST_TEXTURE_FILTER_BIAS_SGIX)); + rb_define_const(module, "GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX", INT2NUM(GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX)); + rb_define_const(module, "GL_POST_TEXTURE_FILTER_SCALE_SGIX", INT2NUM(GL_POST_TEXTURE_FILTER_SCALE_SGIX)); + rb_define_const(module, "GL_PREFER_DOUBLEBUFFER_HINT_PGI", INT2NUM(GL_PREFER_DOUBLEBUFFER_HINT_PGI)); + rb_define_const(module, "GL_PRESERVE_ATI", INT2NUM(GL_PRESERVE_ATI)); + rb_define_const(module, "GL_PREVIOUS_ARB", INT2NUM(GL_PREVIOUS_ARB)); + rb_define_const(module, "GL_PREVIOUS_EXT", INT2NUM(GL_PREVIOUS_EXT)); + rb_define_const(module, "GL_PREVIOUS", INT2NUM(GL_PREVIOUS)); + rb_define_const(module, "GL_PREVIOUS_TEXTURE_INPUT_NV", INT2NUM(GL_PREVIOUS_TEXTURE_INPUT_NV)); + rb_define_const(module, "GL_PRIMARY_COLOR_ARB", INT2NUM(GL_PRIMARY_COLOR_ARB)); + rb_define_const(module, "GL_PRIMARY_COLOR_EXT", INT2NUM(GL_PRIMARY_COLOR_EXT)); + rb_define_const(module, "GL_PRIMARY_COLOR", INT2NUM(GL_PRIMARY_COLOR)); + rb_define_const(module, "GL_PRIMARY_COLOR_NV", INT2NUM(GL_PRIMARY_COLOR_NV)); + rb_define_const(module, "GL_PRIMITIVE_RESTART_INDEX_NV", INT2NUM(GL_PRIMITIVE_RESTART_INDEX_NV)); + rb_define_const(module, "GL_PRIMITIVE_RESTART_NV", INT2NUM(GL_PRIMITIVE_RESTART_NV)); + rb_define_const(module, "GL_PROGRAM_ADDRESS_REGISTERS_ARB", INT2NUM(GL_PROGRAM_ADDRESS_REGISTERS_ARB)); + rb_define_const(module, "GL_PROGRAM_ALU_INSTRUCTIONS_ARB", INT2NUM(GL_PROGRAM_ALU_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_ATTRIBS_ARB", INT2NUM(GL_PROGRAM_ATTRIBS_ARB)); + rb_define_const(module, "GL_PROGRAM_BINDING_ARB", INT2NUM(GL_PROGRAM_BINDING_ARB)); + rb_define_const(module, "GL_PROGRAM_ERROR_POSITION_ARB", INT2NUM(GL_PROGRAM_ERROR_POSITION_ARB)); + rb_define_const(module, "GL_PROGRAM_ERROR_POSITION_NV", INT2NUM(GL_PROGRAM_ERROR_POSITION_NV)); + rb_define_const(module, "GL_PROGRAM_ERROR_STRING_ARB", INT2NUM(GL_PROGRAM_ERROR_STRING_ARB)); + rb_define_const(module, "GL_PROGRAM_ERROR_STRING_NV", INT2NUM(GL_PROGRAM_ERROR_STRING_NV)); + rb_define_const(module, "GL_PROGRAM_FORMAT_ARB", INT2NUM(GL_PROGRAM_FORMAT_ARB)); + rb_define_const(module, "GL_PROGRAM_FORMAT_ASCII_ARB", INT2NUM(GL_PROGRAM_FORMAT_ASCII_ARB)); + rb_define_const(module, "GL_PROGRAM_INSTRUCTIONS_ARB", INT2NUM(GL_PROGRAM_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_LENGTH_ARB", INT2NUM(GL_PROGRAM_LENGTH_ARB)); + rb_define_const(module, "GL_PROGRAM_LENGTH_NV", INT2NUM(GL_PROGRAM_LENGTH_NV)); + rb_define_const(module, "GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB", INT2NUM(GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB", INT2NUM(GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_ATTRIBS_ARB", INT2NUM(GL_PROGRAM_NATIVE_ATTRIBS_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB", INT2NUM(GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_PARAMETERS_ARB", INT2NUM(GL_PROGRAM_NATIVE_PARAMETERS_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_TEMPORARIES_ARB", INT2NUM(GL_PROGRAM_NATIVE_TEMPORARIES_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB", INT2NUM(GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB", INT2NUM(GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_OBJECT_ARB", INT2NUM(GL_PROGRAM_OBJECT_ARB)); + rb_define_const(module, "GL_PROGRAM_PARAMETER_NV", INT2NUM(GL_PROGRAM_PARAMETER_NV)); + rb_define_const(module, "GL_PROGRAM_PARAMETERS_ARB", INT2NUM(GL_PROGRAM_PARAMETERS_ARB)); + rb_define_const(module, "GL_PROGRAM_RESIDENT_NV", INT2NUM(GL_PROGRAM_RESIDENT_NV)); + rb_define_const(module, "GL_PROGRAM_STRING_ARB", INT2NUM(GL_PROGRAM_STRING_ARB)); + rb_define_const(module, "GL_PROGRAM_STRING_NV", INT2NUM(GL_PROGRAM_STRING_NV)); + rb_define_const(module, "GL_PROGRAM_TARGET_NV", INT2NUM(GL_PROGRAM_TARGET_NV)); + rb_define_const(module, "GL_PROGRAM_TEMPORARIES_ARB", INT2NUM(GL_PROGRAM_TEMPORARIES_ARB)); + rb_define_const(module, "GL_PROGRAM_TEX_INDIRECTIONS_ARB", INT2NUM(GL_PROGRAM_TEX_INDIRECTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_TEX_INSTRUCTIONS_ARB", INT2NUM(GL_PROGRAM_TEX_INSTRUCTIONS_ARB)); + rb_define_const(module, "GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB", INT2NUM(GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB)); + rb_define_const(module, "GL_PROJECTION", INT2NUM(GL_PROJECTION)); + rb_define_const(module, "GL_PROJECTION_MATRIX", INT2NUM(GL_PROJECTION_MATRIX)); + rb_define_const(module, "GL_PROJECTION_STACK_DEPTH", INT2NUM(GL_PROJECTION_STACK_DEPTH)); + rb_define_const(module, "GL_PROXY_COLOR_TABLE", INT2NUM(GL_PROXY_COLOR_TABLE)); + rb_define_const(module, "GL_PROXY_COLOR_TABLE_SGI", INT2NUM(GL_PROXY_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_PROXY_HISTOGRAM_EXT", INT2NUM(GL_PROXY_HISTOGRAM_EXT)); + rb_define_const(module, "GL_PROXY_HISTOGRAM", INT2NUM(GL_PROXY_HISTOGRAM)); + rb_define_const(module, "GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE", INT2NUM(GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE)); + rb_define_const(module, "GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI", INT2NUM(GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_PROXY_POST_CONVOLUTION_COLOR_TABLE", INT2NUM(GL_PROXY_POST_CONVOLUTION_COLOR_TABLE)); + rb_define_const(module, "GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI", INT2NUM(GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP", INT2NUM(GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP)); + rb_define_const(module, "GL_PROXY_TEXTURE_1D_EXT", INT2NUM(GL_PROXY_TEXTURE_1D_EXT)); + rb_define_const(module, "GL_PROXY_TEXTURE_1D", INT2NUM(GL_PROXY_TEXTURE_1D)); + rb_define_const(module, "GL_PROXY_TEXTURE_1D_STACK_MESAX", INT2NUM(GL_PROXY_TEXTURE_1D_STACK_MESAX)); + rb_define_const(module, "GL_PROXY_TEXTURE_2D_EXT", INT2NUM(GL_PROXY_TEXTURE_2D_EXT)); + rb_define_const(module, "GL_PROXY_TEXTURE_2D", INT2NUM(GL_PROXY_TEXTURE_2D)); + rb_define_const(module, "GL_PROXY_TEXTURE_2D_STACK_MESAX", INT2NUM(GL_PROXY_TEXTURE_2D_STACK_MESAX)); + rb_define_const(module, "GL_PROXY_TEXTURE_3D_EXT", INT2NUM(GL_PROXY_TEXTURE_3D_EXT)); + rb_define_const(module, "GL_PROXY_TEXTURE_3D", INT2NUM(GL_PROXY_TEXTURE_3D)); + rb_define_const(module, "GL_PROXY_TEXTURE_4D_SGIS", INT2NUM(GL_PROXY_TEXTURE_4D_SGIS)); + rb_define_const(module, "GL_PROXY_TEXTURE_COLOR_TABLE_SGI", INT2NUM(GL_PROXY_TEXTURE_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_PROXY_TEXTURE_CUBE_MAP_ARB", INT2NUM(GL_PROXY_TEXTURE_CUBE_MAP_ARB)); + rb_define_const(module, "GL_PROXY_TEXTURE_CUBE_MAP_EXT", INT2NUM(GL_PROXY_TEXTURE_CUBE_MAP_EXT)); + rb_define_const(module, "GL_PROXY_TEXTURE_CUBE_MAP", INT2NUM(GL_PROXY_TEXTURE_CUBE_MAP)); + rb_define_const(module, "GL_PROXY_TEXTURE_RECTANGLE_ARB", INT2NUM(GL_PROXY_TEXTURE_RECTANGLE_ARB)); + rb_define_const(module, "GL_PROXY_TEXTURE_RECTANGLE_NV", INT2NUM(GL_PROXY_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_Q", INT2NUM(GL_Q)); + rb_define_const(module, "GL_QUAD_ALPHA4_SGIS", INT2NUM(GL_QUAD_ALPHA4_SGIS)); + rb_define_const(module, "GL_QUAD_ALPHA8_SGIS", INT2NUM(GL_QUAD_ALPHA8_SGIS)); + rb_define_const(module, "GL_QUAD_INTENSITY4_SGIS", INT2NUM(GL_QUAD_INTENSITY4_SGIS)); + rb_define_const(module, "GL_QUAD_INTENSITY8_SGIS", INT2NUM(GL_QUAD_INTENSITY8_SGIS)); + rb_define_const(module, "GL_QUAD_LUMINANCE4_SGIS", INT2NUM(GL_QUAD_LUMINANCE4_SGIS)); + rb_define_const(module, "GL_QUAD_LUMINANCE8_SGIS", INT2NUM(GL_QUAD_LUMINANCE8_SGIS)); + rb_define_const(module, "GL_QUAD_MESH_SUN", INT2NUM(GL_QUAD_MESH_SUN)); + rb_define_const(module, "GL_QUADRATIC_ATTENUATION", INT2NUM(GL_QUADRATIC_ATTENUATION)); + rb_define_const(module, "GL_QUADS", INT2NUM(GL_QUADS)); + rb_define_const(module, "GL_QUAD_STRIP", INT2NUM(GL_QUAD_STRIP)); + rb_define_const(module, "GL_QUAD_TEXTURE_SELECT_SGIS", INT2NUM(GL_QUAD_TEXTURE_SELECT_SGIS)); + rb_define_const(module, "GL_QUARTER_BIT_ATI", INT2NUM(GL_QUARTER_BIT_ATI)); + rb_define_const(module, "GL_QUERY_COUNTER_BITS_ARB", INT2NUM(GL_QUERY_COUNTER_BITS_ARB)); + rb_define_const(module, "GL_QUERY_COUNTER_BITS", INT2NUM(GL_QUERY_COUNTER_BITS)); + rb_define_const(module, "GL_QUERY_RESULT_ARB", INT2NUM(GL_QUERY_RESULT_ARB)); + rb_define_const(module, "GL_QUERY_RESULT_AVAILABLE_ARB", INT2NUM(GL_QUERY_RESULT_AVAILABLE_ARB)); + rb_define_const(module, "GL_QUERY_RESULT_AVAILABLE", INT2NUM(GL_QUERY_RESULT_AVAILABLE)); + rb_define_const(module, "GL_QUERY_RESULT", INT2NUM(GL_QUERY_RESULT)); + rb_define_const(module, "GL_R1UI_C3F_V3F_SUN", INT2NUM(GL_R1UI_C3F_V3F_SUN)); + rb_define_const(module, "GL_R1UI_C4F_N3F_V3F_SUN", INT2NUM(GL_R1UI_C4F_N3F_V3F_SUN)); + rb_define_const(module, "GL_R1UI_C4UB_V3F_SUN", INT2NUM(GL_R1UI_C4UB_V3F_SUN)); + rb_define_const(module, "GL_R1UI_N3F_V3F_SUN", INT2NUM(GL_R1UI_N3F_V3F_SUN)); + rb_define_const(module, "GL_R1UI_T2F_C4F_N3F_V3F_SUN", INT2NUM(GL_R1UI_T2F_C4F_N3F_V3F_SUN)); + rb_define_const(module, "GL_R1UI_T2F_N3F_V3F_SUN", INT2NUM(GL_R1UI_T2F_N3F_V3F_SUN)); + rb_define_const(module, "GL_R1UI_T2F_V3F_SUN", INT2NUM(GL_R1UI_T2F_V3F_SUN)); + rb_define_const(module, "GL_R1UI_V3F_SUN", INT2NUM(GL_R1UI_V3F_SUN)); + rb_define_const(module, "GL_R3_G3_B2", INT2NUM(GL_R3_G3_B2)); + rb_define_const(module, "GL_RASTER_POSITION_UNCLIPPED_IBM", INT2NUM(GL_RASTER_POSITION_UNCLIPPED_IBM)); + rb_define_const(module, "GL_READ_BUFFER", INT2NUM(GL_READ_BUFFER)); + rb_define_const(module, "GL_READ_FRAMEBUFFER_BINDING_EXT", INT2NUM(GL_READ_FRAMEBUFFER_BINDING_EXT)); + rb_define_const(module, "GL_READ_FRAMEBUFFER_EXT", INT2NUM(GL_READ_FRAMEBUFFER_EXT)); + rb_define_const(module, "GL_READ_ONLY_ARB", INT2NUM(GL_READ_ONLY_ARB)); + rb_define_const(module, "GL_READ_ONLY", INT2NUM(GL_READ_ONLY)); + rb_define_const(module, "GL_READ_PIXEL_DATA_RANGE_LENGTH_NV", INT2NUM(GL_READ_PIXEL_DATA_RANGE_LENGTH_NV)); + rb_define_const(module, "GL_READ_PIXEL_DATA_RANGE_NV", INT2NUM(GL_READ_PIXEL_DATA_RANGE_NV)); + rb_define_const(module, "GL_READ_PIXEL_DATA_RANGE_POINTER_NV", INT2NUM(GL_READ_PIXEL_DATA_RANGE_POINTER_NV)); + rb_define_const(module, "GL_READ_WRITE_ARB", INT2NUM(GL_READ_WRITE_ARB)); + rb_define_const(module, "GL_READ_WRITE", INT2NUM(GL_READ_WRITE)); + rb_define_const(module, "GL_RECLAIM_MEMORY_HINT_PGI", INT2NUM(GL_RECLAIM_MEMORY_HINT_PGI)); + rb_define_const(module, "GL_RED_BIAS", INT2NUM(GL_RED_BIAS)); + rb_define_const(module, "GL_RED_BIT_ATI", INT2NUM(GL_RED_BIT_ATI)); + rb_define_const(module, "GL_RED_BITS", INT2NUM(GL_RED_BITS)); + rb_define_const(module, "GL_RED", INT2NUM(GL_RED)); + rb_define_const(module, "GL_RED_MAX_CLAMP_INGR", INT2NUM(GL_RED_MAX_CLAMP_INGR)); + rb_define_const(module, "GL_RED_MIN_CLAMP_INGR", INT2NUM(GL_RED_MIN_CLAMP_INGR)); + rb_define_const(module, "GL_RED_SCALE", INT2NUM(GL_RED_SCALE)); + rb_define_const(module, "GL_REDUCE_EXT", INT2NUM(GL_REDUCE_EXT)); + rb_define_const(module, "GL_REDUCE", INT2NUM(GL_REDUCE)); + rb_define_const(module, "GL_REFERENCE_PLANE_EQUATION_SGIX", INT2NUM(GL_REFERENCE_PLANE_EQUATION_SGIX)); + rb_define_const(module, "GL_REFERENCE_PLANE_SGIX", INT2NUM(GL_REFERENCE_PLANE_SGIX)); + rb_define_const(module, "GL_REFLECTION_MAP_ARB", INT2NUM(GL_REFLECTION_MAP_ARB)); + rb_define_const(module, "GL_REFLECTION_MAP_EXT", INT2NUM(GL_REFLECTION_MAP_EXT)); + rb_define_const(module, "GL_REFLECTION_MAP", INT2NUM(GL_REFLECTION_MAP)); + rb_define_const(module, "GL_REFLECTION_MAP_NV", INT2NUM(GL_REFLECTION_MAP_NV)); + rb_define_const(module, "GL_REG_0_ATI", INT2NUM(GL_REG_0_ATI)); + rb_define_const(module, "GL_REG_10_ATI", INT2NUM(GL_REG_10_ATI)); + rb_define_const(module, "GL_REG_11_ATI", INT2NUM(GL_REG_11_ATI)); + rb_define_const(module, "GL_REG_12_ATI", INT2NUM(GL_REG_12_ATI)); + rb_define_const(module, "GL_REG_13_ATI", INT2NUM(GL_REG_13_ATI)); + rb_define_const(module, "GL_REG_14_ATI", INT2NUM(GL_REG_14_ATI)); + rb_define_const(module, "GL_REG_15_ATI", INT2NUM(GL_REG_15_ATI)); + rb_define_const(module, "GL_REG_16_ATI", INT2NUM(GL_REG_16_ATI)); + rb_define_const(module, "GL_REG_17_ATI", INT2NUM(GL_REG_17_ATI)); + rb_define_const(module, "GL_REG_18_ATI", INT2NUM(GL_REG_18_ATI)); + rb_define_const(module, "GL_REG_19_ATI", INT2NUM(GL_REG_19_ATI)); + rb_define_const(module, "GL_REG_1_ATI", INT2NUM(GL_REG_1_ATI)); + rb_define_const(module, "GL_REG_20_ATI", INT2NUM(GL_REG_20_ATI)); + rb_define_const(module, "GL_REG_21_ATI", INT2NUM(GL_REG_21_ATI)); + rb_define_const(module, "GL_REG_22_ATI", INT2NUM(GL_REG_22_ATI)); + rb_define_const(module, "GL_REG_23_ATI", INT2NUM(GL_REG_23_ATI)); + rb_define_const(module, "GL_REG_24_ATI", INT2NUM(GL_REG_24_ATI)); + rb_define_const(module, "GL_REG_25_ATI", INT2NUM(GL_REG_25_ATI)); + rb_define_const(module, "GL_REG_26_ATI", INT2NUM(GL_REG_26_ATI)); + rb_define_const(module, "GL_REG_27_ATI", INT2NUM(GL_REG_27_ATI)); + rb_define_const(module, "GL_REG_28_ATI", INT2NUM(GL_REG_28_ATI)); + rb_define_const(module, "GL_REG_29_ATI", INT2NUM(GL_REG_29_ATI)); + rb_define_const(module, "GL_REG_2_ATI", INT2NUM(GL_REG_2_ATI)); + rb_define_const(module, "GL_REG_30_ATI", INT2NUM(GL_REG_30_ATI)); + rb_define_const(module, "GL_REG_31_ATI", INT2NUM(GL_REG_31_ATI)); + rb_define_const(module, "GL_REG_3_ATI", INT2NUM(GL_REG_3_ATI)); + rb_define_const(module, "GL_REG_4_ATI", INT2NUM(GL_REG_4_ATI)); + rb_define_const(module, "GL_REG_5_ATI", INT2NUM(GL_REG_5_ATI)); + rb_define_const(module, "GL_REG_6_ATI", INT2NUM(GL_REG_6_ATI)); + rb_define_const(module, "GL_REG_7_ATI", INT2NUM(GL_REG_7_ATI)); + rb_define_const(module, "GL_REG_8_ATI", INT2NUM(GL_REG_8_ATI)); + rb_define_const(module, "GL_REG_9_ATI", INT2NUM(GL_REG_9_ATI)); + rb_define_const(module, "GL_REGISTER_COMBINERS_NV", INT2NUM(GL_REGISTER_COMBINERS_NV)); + rb_define_const(module, "GL_RENDERBUFFER_ALPHA_SIZE_EXT", INT2NUM(GL_RENDERBUFFER_ALPHA_SIZE_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_BINDING_EXT", INT2NUM(GL_RENDERBUFFER_BINDING_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_BLUE_SIZE_EXT", INT2NUM(GL_RENDERBUFFER_BLUE_SIZE_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_DEPTH_SIZE_EXT", INT2NUM(GL_RENDERBUFFER_DEPTH_SIZE_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_EXT", INT2NUM(GL_RENDERBUFFER_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_GREEN_SIZE_EXT", INT2NUM(GL_RENDERBUFFER_GREEN_SIZE_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_HEIGHT_EXT", INT2NUM(GL_RENDERBUFFER_HEIGHT_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT", INT2NUM(GL_RENDERBUFFER_INTERNAL_FORMAT_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_RED_SIZE_EXT", INT2NUM(GL_RENDERBUFFER_RED_SIZE_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_SAMPLES_EXT", INT2NUM(GL_RENDERBUFFER_SAMPLES_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_STENCIL_SIZE_EXT", INT2NUM(GL_RENDERBUFFER_STENCIL_SIZE_EXT)); + rb_define_const(module, "GL_RENDERBUFFER_WIDTH_EXT", INT2NUM(GL_RENDERBUFFER_WIDTH_EXT)); + rb_define_const(module, "GL_RENDERER", INT2NUM(GL_RENDERER)); + rb_define_const(module, "GL_RENDER", INT2NUM(GL_RENDER)); + rb_define_const(module, "GL_RENDER_MODE", INT2NUM(GL_RENDER_MODE)); + rb_define_const(module, "GL_REPEAT", INT2NUM(GL_REPEAT)); + rb_define_const(module, "GL_REPLACE_EXT", INT2NUM(GL_REPLACE_EXT)); + rb_define_const(module, "GL_REPLACE", INT2NUM(GL_REPLACE)); + rb_define_const(module, "GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN", INT2NUM(GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN)); + rb_define_const(module, "GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN", INT2NUM(GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN)); + rb_define_const(module, "GL_REPLACEMENT_CODE_ARRAY_SUN", INT2NUM(GL_REPLACEMENT_CODE_ARRAY_SUN)); + rb_define_const(module, "GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN", INT2NUM(GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN)); + rb_define_const(module, "GL_REPLACEMENT_CODE_SUN", INT2NUM(GL_REPLACEMENT_CODE_SUN)); + rb_define_const(module, "GL_REPLACE_MIDDLE_SUN", INT2NUM(GL_REPLACE_MIDDLE_SUN)); + rb_define_const(module, "GL_REPLACE_OLDEST_SUN", INT2NUM(GL_REPLACE_OLDEST_SUN)); + rb_define_const(module, "GL_REPLICATE_BORDER_HP", INT2NUM(GL_REPLICATE_BORDER_HP)); + rb_define_const(module, "GL_REPLICATE_BORDER", INT2NUM(GL_REPLICATE_BORDER)); + rb_define_const(module, "GL_RESAMPLE_AVERAGE_OML", INT2NUM(GL_RESAMPLE_AVERAGE_OML)); + rb_define_const(module, "GL_RESAMPLE_DECIMATE_OML", INT2NUM(GL_RESAMPLE_DECIMATE_OML)); + rb_define_const(module, "GL_RESAMPLE_DECIMATE_SGIX", INT2NUM(GL_RESAMPLE_DECIMATE_SGIX)); + rb_define_const(module, "GL_RESAMPLE_REPLICATE_OML", INT2NUM(GL_RESAMPLE_REPLICATE_OML)); + rb_define_const(module, "GL_RESAMPLE_REPLICATE_SGIX", INT2NUM(GL_RESAMPLE_REPLICATE_SGIX)); + rb_define_const(module, "GL_RESAMPLE_ZERO_FILL_OML", INT2NUM(GL_RESAMPLE_ZERO_FILL_OML)); + rb_define_const(module, "GL_RESAMPLE_ZERO_FILL_SGIX", INT2NUM(GL_RESAMPLE_ZERO_FILL_SGIX)); + rb_define_const(module, "GL_RESCALE_NORMAL_EXT", INT2NUM(GL_RESCALE_NORMAL_EXT)); + rb_define_const(module, "GL_RESCALE_NORMAL", INT2NUM(GL_RESCALE_NORMAL)); + rb_define_const(module, "GL_RESTART_SUN", INT2NUM(GL_RESTART_SUN)); + rb_define_const(module, "GL_RETURN", INT2NUM(GL_RETURN)); + rb_define_const(module, "GL_RGB10_A2_EXT", INT2NUM(GL_RGB10_A2_EXT)); + rb_define_const(module, "GL_RGB10_A2", INT2NUM(GL_RGB10_A2)); + rb_define_const(module, "GL_RGB10_EXT", INT2NUM(GL_RGB10_EXT)); + rb_define_const(module, "GL_RGB10", INT2NUM(GL_RGB10)); + rb_define_const(module, "GL_RGB12_EXT", INT2NUM(GL_RGB12_EXT)); + rb_define_const(module, "GL_RGB12", INT2NUM(GL_RGB12)); + rb_define_const(module, "GL_RGB16_EXT", INT2NUM(GL_RGB16_EXT)); + rb_define_const(module, "GL_RGB16F_ARB", INT2NUM(GL_RGB16F_ARB)); + rb_define_const(module, "GL_RGB16", INT2NUM(GL_RGB16)); + rb_define_const(module, "GL_RGB2_EXT", INT2NUM(GL_RGB2_EXT)); + rb_define_const(module, "GL_RGB32F_ARB", INT2NUM(GL_RGB32F_ARB)); + rb_define_const(module, "GL_RGB4_EXT", INT2NUM(GL_RGB4_EXT)); + rb_define_const(module, "GL_RGB4", INT2NUM(GL_RGB4)); + rb_define_const(module, "GL_RGB4_S3TC", INT2NUM(GL_RGB4_S3TC)); + rb_define_const(module, "GL_RGB5_A1_EXT", INT2NUM(GL_RGB5_A1_EXT)); + rb_define_const(module, "GL_RGB5_A1", INT2NUM(GL_RGB5_A1)); + rb_define_const(module, "GL_RGB5_EXT", INT2NUM(GL_RGB5_EXT)); + rb_define_const(module, "GL_RGB5", INT2NUM(GL_RGB5)); + rb_define_const(module, "GL_RGB8_EXT", INT2NUM(GL_RGB8_EXT)); + rb_define_const(module, "GL_RGB8", INT2NUM(GL_RGB8)); + rb_define_const(module, "GL_RGBA12_EXT", INT2NUM(GL_RGBA12_EXT)); + rb_define_const(module, "GL_RGBA12", INT2NUM(GL_RGBA12)); + rb_define_const(module, "GL_RGBA16_EXT", INT2NUM(GL_RGBA16_EXT)); + rb_define_const(module, "GL_RGBA16F_ARB", INT2NUM(GL_RGBA16F_ARB)); + rb_define_const(module, "GL_RGBA16", INT2NUM(GL_RGBA16)); + rb_define_const(module, "GL_RGBA2_EXT", INT2NUM(GL_RGBA2_EXT)); + rb_define_const(module, "GL_RGBA2", INT2NUM(GL_RGBA2)); + rb_define_const(module, "GL_RGBA32F_ARB", INT2NUM(GL_RGBA32F_ARB)); + rb_define_const(module, "GL_RGBA4_EXT", INT2NUM(GL_RGBA4_EXT)); + rb_define_const(module, "GL_RGBA4", INT2NUM(GL_RGBA4)); + rb_define_const(module, "GL_RGBA4_S3TC", INT2NUM(GL_RGBA4_S3TC)); + rb_define_const(module, "GL_RGBA8_EXT", INT2NUM(GL_RGBA8_EXT)); + rb_define_const(module, "GL_RGBA8", INT2NUM(GL_RGBA8)); + rb_define_const(module, "GL_RGBA_FLOAT16_ATI", INT2NUM(GL_RGBA_FLOAT16_ATI)); + rb_define_const(module, "GL_RGBA_FLOAT32_ATI", INT2NUM(GL_RGBA_FLOAT32_ATI)); + rb_define_const(module, "GL_RGBA_FLOAT_MODE_ARB", INT2NUM(GL_RGBA_FLOAT_MODE_ARB)); + rb_define_const(module, "GL_RGBA", INT2NUM(GL_RGBA)); + rb_define_const(module, "GL_RGBA_MODE", INT2NUM(GL_RGBA_MODE)); + rb_define_const(module, "GL_RGBA_S3TC", INT2NUM(GL_RGBA_S3TC)); + rb_define_const(module, "GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV", INT2NUM(GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV)); + rb_define_const(module, "GL_RGB_FLOAT16_ATI", INT2NUM(GL_RGB_FLOAT16_ATI)); + rb_define_const(module, "GL_RGB_FLOAT32_ATI", INT2NUM(GL_RGB_FLOAT32_ATI)); + rb_define_const(module, "GL_RGB", INT2NUM(GL_RGB)); + rb_define_const(module, "GL_RGB_S3TC", INT2NUM(GL_RGB_S3TC)); + rb_define_const(module, "GL_RGB_SCALE_ARB", INT2NUM(GL_RGB_SCALE_ARB)); + rb_define_const(module, "GL_RGB_SCALE_EXT", INT2NUM(GL_RGB_SCALE_EXT)); + rb_define_const(module, "GL_RGB_SCALE", INT2NUM(GL_RGB_SCALE)); + rb_define_const(module, "GL_RIGHT", INT2NUM(GL_RIGHT)); + rb_define_const(module, "GL_R", INT2NUM(GL_R)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", INT2NUM(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_COVERAGE", INT2NUM(GL_SAMPLE_ALPHA_TO_COVERAGE)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_MASK_EXT", INT2NUM(GL_SAMPLE_ALPHA_TO_MASK_EXT)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_MASK_SGIS", INT2NUM(GL_SAMPLE_ALPHA_TO_MASK_SGIS)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_ONE_ARB", INT2NUM(GL_SAMPLE_ALPHA_TO_ONE_ARB)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_ONE_EXT", INT2NUM(GL_SAMPLE_ALPHA_TO_ONE_EXT)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_ONE", INT2NUM(GL_SAMPLE_ALPHA_TO_ONE)); + rb_define_const(module, "GL_SAMPLE_ALPHA_TO_ONE_SGIS", INT2NUM(GL_SAMPLE_ALPHA_TO_ONE_SGIS)); + rb_define_const(module, "GL_SAMPLE_BUFFERS_3DFX", INT2NUM(GL_SAMPLE_BUFFERS_3DFX)); + rb_define_const(module, "GL_SAMPLE_BUFFERS_ARB", INT2NUM(GL_SAMPLE_BUFFERS_ARB)); + rb_define_const(module, "GL_SAMPLE_BUFFERS_EXT", INT2NUM(GL_SAMPLE_BUFFERS_EXT)); + rb_define_const(module, "GL_SAMPLE_BUFFERS", INT2NUM(GL_SAMPLE_BUFFERS)); + rb_define_const(module, "GL_SAMPLE_BUFFERS_SGIS", INT2NUM(GL_SAMPLE_BUFFERS_SGIS)); + rb_define_const(module, "GL_SAMPLE_COVERAGE_ARB", INT2NUM(GL_SAMPLE_COVERAGE_ARB)); + rb_define_const(module, "GL_SAMPLE_COVERAGE", INT2NUM(GL_SAMPLE_COVERAGE)); + rb_define_const(module, "GL_SAMPLE_COVERAGE_INVERT_ARB", INT2NUM(GL_SAMPLE_COVERAGE_INVERT_ARB)); + rb_define_const(module, "GL_SAMPLE_COVERAGE_INVERT", INT2NUM(GL_SAMPLE_COVERAGE_INVERT)); + rb_define_const(module, "GL_SAMPLE_COVERAGE_VALUE_ARB", INT2NUM(GL_SAMPLE_COVERAGE_VALUE_ARB)); + rb_define_const(module, "GL_SAMPLE_COVERAGE_VALUE", INT2NUM(GL_SAMPLE_COVERAGE_VALUE)); + rb_define_const(module, "GL_SAMPLE_MASK_EXT", INT2NUM(GL_SAMPLE_MASK_EXT)); + rb_define_const(module, "GL_SAMPLE_MASK_INVERT_EXT", INT2NUM(GL_SAMPLE_MASK_INVERT_EXT)); + rb_define_const(module, "GL_SAMPLE_MASK_INVERT_SGIS", INT2NUM(GL_SAMPLE_MASK_INVERT_SGIS)); + rb_define_const(module, "GL_SAMPLE_MASK_SGIS", INT2NUM(GL_SAMPLE_MASK_SGIS)); + rb_define_const(module, "GL_SAMPLE_MASK_VALUE_EXT", INT2NUM(GL_SAMPLE_MASK_VALUE_EXT)); + rb_define_const(module, "GL_SAMPLE_MASK_VALUE_SGIS", INT2NUM(GL_SAMPLE_MASK_VALUE_SGIS)); + rb_define_const(module, "GL_SAMPLE_PATTERN_EXT", INT2NUM(GL_SAMPLE_PATTERN_EXT)); + rb_define_const(module, "GL_SAMPLE_PATTERN_SGIS", INT2NUM(GL_SAMPLE_PATTERN_SGIS)); + rb_define_const(module, "GL_SAMPLER_1D_ARB", INT2NUM(GL_SAMPLER_1D_ARB)); + rb_define_const(module, "GL_SAMPLER_1D", INT2NUM(GL_SAMPLER_1D)); + rb_define_const(module, "GL_SAMPLER_1D_SHADOW_ARB", INT2NUM(GL_SAMPLER_1D_SHADOW_ARB)); + rb_define_const(module, "GL_SAMPLER_1D_SHADOW", INT2NUM(GL_SAMPLER_1D_SHADOW)); + rb_define_const(module, "GL_SAMPLER_2D_ARB", INT2NUM(GL_SAMPLER_2D_ARB)); + rb_define_const(module, "GL_SAMPLER_2D", INT2NUM(GL_SAMPLER_2D)); + rb_define_const(module, "GL_SAMPLER_2D_RECT_ARB", INT2NUM(GL_SAMPLER_2D_RECT_ARB)); + rb_define_const(module, "GL_SAMPLER_2D_RECT_SHADOW_ARB", INT2NUM(GL_SAMPLER_2D_RECT_SHADOW_ARB)); + rb_define_const(module, "GL_SAMPLER_2D_SHADOW_ARB", INT2NUM(GL_SAMPLER_2D_SHADOW_ARB)); + rb_define_const(module, "GL_SAMPLER_2D_SHADOW", INT2NUM(GL_SAMPLER_2D_SHADOW)); + rb_define_const(module, "GL_SAMPLER_3D_ARB", INT2NUM(GL_SAMPLER_3D_ARB)); + rb_define_const(module, "GL_SAMPLER_3D", INT2NUM(GL_SAMPLER_3D)); + rb_define_const(module, "GL_SAMPLER_CUBE_ARB", INT2NUM(GL_SAMPLER_CUBE_ARB)); + rb_define_const(module, "GL_SAMPLER_CUBE", INT2NUM(GL_SAMPLER_CUBE)); + rb_define_const(module, "GL_SAMPLES_3DFX", INT2NUM(GL_SAMPLES_3DFX)); + rb_define_const(module, "GL_SAMPLES_ARB", INT2NUM(GL_SAMPLES_ARB)); + rb_define_const(module, "GL_SAMPLES_EXT", INT2NUM(GL_SAMPLES_EXT)); + rb_define_const(module, "GL_SAMPLES", INT2NUM(GL_SAMPLES)); + rb_define_const(module, "GL_SAMPLES_PASSED_ARB", INT2NUM(GL_SAMPLES_PASSED_ARB)); + rb_define_const(module, "GL_SAMPLES_PASSED", INT2NUM(GL_SAMPLES_PASSED)); + rb_define_const(module, "GL_SAMPLES_SGIS", INT2NUM(GL_SAMPLES_SGIS)); + rb_define_const(module, "GL_SATURATE_BIT_ATI", INT2NUM(GL_SATURATE_BIT_ATI)); + rb_define_const(module, "GL_SCALAR_EXT", INT2NUM(GL_SCALAR_EXT)); + rb_define_const(module, "GL_SCALEBIAS_HINT_SGIX", INT2NUM(GL_SCALEBIAS_HINT_SGIX)); + rb_define_const(module, "GL_SCALE_BY_FOUR_NV", INT2NUM(GL_SCALE_BY_FOUR_NV)); + rb_define_const(module, "GL_SCALE_BY_ONE_HALF_NV", INT2NUM(GL_SCALE_BY_ONE_HALF_NV)); + rb_define_const(module, "GL_SCALE_BY_TWO_NV", INT2NUM(GL_SCALE_BY_TWO_NV)); + rb_define_const(module, "GL_SCISSOR_BIT", INT2NUM(GL_SCISSOR_BIT)); + rb_define_const(module, "GL_SCISSOR_BOX", INT2NUM(GL_SCISSOR_BOX)); + rb_define_const(module, "GL_SCISSOR_TEST", INT2NUM(GL_SCISSOR_TEST)); + rb_define_const(module, "GL_SCREEN_COORDINATES_REND", INT2NUM(GL_SCREEN_COORDINATES_REND)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING", INT2NUM(GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_EXT", INT2NUM(GL_SECONDARY_COLOR_ARRAY_EXT)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY", INT2NUM(GL_SECONDARY_COLOR_ARRAY)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_LIST_IBM", INT2NUM(GL_SECONDARY_COLOR_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_POINTER_EXT", INT2NUM(GL_SECONDARY_COLOR_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_POINTER", INT2NUM(GL_SECONDARY_COLOR_ARRAY_POINTER)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", INT2NUM(GL_SECONDARY_COLOR_ARRAY_SIZE_EXT)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_SIZE", INT2NUM(GL_SECONDARY_COLOR_ARRAY_SIZE)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", INT2NUM(GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_STRIDE", INT2NUM(GL_SECONDARY_COLOR_ARRAY_STRIDE)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", INT2NUM(GL_SECONDARY_COLOR_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_SECONDARY_COLOR_ARRAY_TYPE", INT2NUM(GL_SECONDARY_COLOR_ARRAY_TYPE)); + rb_define_const(module, "GL_SECONDARY_COLOR_NV", INT2NUM(GL_SECONDARY_COLOR_NV)); + rb_define_const(module, "GL_SECONDARY_INTERPOLATOR_ATI", INT2NUM(GL_SECONDARY_INTERPOLATOR_ATI)); + rb_define_const(module, "GL_SELECT", INT2NUM(GL_SELECT)); + rb_define_const(module, "GL_SELECTION_BUFFER_POINTER", INT2NUM(GL_SELECTION_BUFFER_POINTER)); + rb_define_const(module, "GL_SELECTION_BUFFER_SIZE", INT2NUM(GL_SELECTION_BUFFER_SIZE)); + rb_define_const(module, "GL_SEPARABLE_2D_EXT", INT2NUM(GL_SEPARABLE_2D_EXT)); + rb_define_const(module, "GL_SEPARABLE_2D", INT2NUM(GL_SEPARABLE_2D)); + rb_define_const(module, "GL_SEPARATE_SPECULAR_COLOR_EXT", INT2NUM(GL_SEPARATE_SPECULAR_COLOR_EXT)); + rb_define_const(module, "GL_SEPARATE_SPECULAR_COLOR", INT2NUM(GL_SEPARATE_SPECULAR_COLOR)); + rb_define_const(module, "GL_SET", INT2NUM(GL_SET)); + rb_define_const(module, "GL_SGI_color_matrix", INT2NUM(GL_SGI_color_matrix)); + rb_define_const(module, "GL_SGI_color_table", INT2NUM(GL_SGI_color_table)); + rb_define_const(module, "GL_SGIS_detail_texture", INT2NUM(GL_SGIS_detail_texture)); + rb_define_const(module, "GL_SGIS_fog_function", INT2NUM(GL_SGIS_fog_function)); + rb_define_const(module, "GL_SGIS_generate_mipmap", INT2NUM(GL_SGIS_generate_mipmap)); + rb_define_const(module, "GL_SGIS_multisample", INT2NUM(GL_SGIS_multisample)); + rb_define_const(module, "GL_SGIS_pixel_texture", INT2NUM(GL_SGIS_pixel_texture)); + rb_define_const(module, "GL_SGIS_point_line_texgen", INT2NUM(GL_SGIS_point_line_texgen)); + rb_define_const(module, "GL_SGIS_point_parameters", INT2NUM(GL_SGIS_point_parameters)); + rb_define_const(module, "GL_SGIS_sharpen_texture", INT2NUM(GL_SGIS_sharpen_texture)); + rb_define_const(module, "GL_SGIS_texture4D", INT2NUM(GL_SGIS_texture4D)); + rb_define_const(module, "GL_SGIS_texture_border_clamp", INT2NUM(GL_SGIS_texture_border_clamp)); + rb_define_const(module, "GL_SGIS_texture_edge_clamp", INT2NUM(GL_SGIS_texture_edge_clamp)); + rb_define_const(module, "GL_SGIS_texture_filter4", INT2NUM(GL_SGIS_texture_filter4)); + rb_define_const(module, "GL_SGIS_texture_lod", INT2NUM(GL_SGIS_texture_lod)); + rb_define_const(module, "GL_SGIS_texture_select", INT2NUM(GL_SGIS_texture_select)); + rb_define_const(module, "GL_SGI_texture_color_table", INT2NUM(GL_SGI_texture_color_table)); + rb_define_const(module, "GL_SGIX_async_histogram", INT2NUM(GL_SGIX_async_histogram)); + rb_define_const(module, "GL_SGIX_async", INT2NUM(GL_SGIX_async)); + rb_define_const(module, "GL_SGIX_async_pixel", INT2NUM(GL_SGIX_async_pixel)); + rb_define_const(module, "GL_SGIX_blend_alpha_minmax", INT2NUM(GL_SGIX_blend_alpha_minmax)); + rb_define_const(module, "GL_SGIX_calligraphic_fragment", INT2NUM(GL_SGIX_calligraphic_fragment)); + rb_define_const(module, "GL_SGIX_clipmap", INT2NUM(GL_SGIX_clipmap)); + rb_define_const(module, "GL_SGIX_convolution_accuracy", INT2NUM(GL_SGIX_convolution_accuracy)); + rb_define_const(module, "GL_SGIX_depth_texture", INT2NUM(GL_SGIX_depth_texture)); + rb_define_const(module, "GL_SGIX_flush_raster", INT2NUM(GL_SGIX_flush_raster)); + rb_define_const(module, "GL_SGIX_fog_offset", INT2NUM(GL_SGIX_fog_offset)); + rb_define_const(module, "GL_SGIX_fragment_lighting", INT2NUM(GL_SGIX_fragment_lighting)); + rb_define_const(module, "GL_SGIX_framezoom", INT2NUM(GL_SGIX_framezoom)); + rb_define_const(module, "GL_SGIX_icc_texture", INT2NUM(GL_SGIX_icc_texture)); + rb_define_const(module, "GL_SGIX_impact_pixel_texture", INT2NUM(GL_SGIX_impact_pixel_texture)); + rb_define_const(module, "GL_SGIX_instruments", INT2NUM(GL_SGIX_instruments)); + rb_define_const(module, "GL_SGIX_interlace", INT2NUM(GL_SGIX_interlace)); + rb_define_const(module, "GL_SGIX_ir_instrument1", INT2NUM(GL_SGIX_ir_instrument1)); + rb_define_const(module, "GL_SGIX_list_priority", INT2NUM(GL_SGIX_list_priority)); + rb_define_const(module, "GL_SGIX_pixel_texture", INT2NUM(GL_SGIX_pixel_texture)); + rb_define_const(module, "GL_SGIX_pixel_tiles", INT2NUM(GL_SGIX_pixel_tiles)); + rb_define_const(module, "GL_SGIX_polynomial_ffd", INT2NUM(GL_SGIX_polynomial_ffd)); + rb_define_const(module, "GL_SGIX_reference_plane", INT2NUM(GL_SGIX_reference_plane)); + rb_define_const(module, "GL_SGIX_resample", INT2NUM(GL_SGIX_resample)); + rb_define_const(module, "GL_SGIX_scalebias_hint", INT2NUM(GL_SGIX_scalebias_hint)); + rb_define_const(module, "GL_SGIX_shadow_ambient", INT2NUM(GL_SGIX_shadow_ambient)); + rb_define_const(module, "GL_SGIX_shadow", INT2NUM(GL_SGIX_shadow)); + rb_define_const(module, "GL_SGIX_sprite", INT2NUM(GL_SGIX_sprite)); + rb_define_const(module, "GL_SGIX_subsample", INT2NUM(GL_SGIX_subsample)); + rb_define_const(module, "GL_SGIX_tag_sample_buffer", INT2NUM(GL_SGIX_tag_sample_buffer)); + rb_define_const(module, "GL_SGIX_texture_add_env", INT2NUM(GL_SGIX_texture_add_env)); + rb_define_const(module, "GL_SGIX_texture_coordinate_clamp", INT2NUM(GL_SGIX_texture_coordinate_clamp)); + rb_define_const(module, "GL_SGIX_texture_lod_bias", INT2NUM(GL_SGIX_texture_lod_bias)); + rb_define_const(module, "GL_SGIX_texture_multi_buffer", INT2NUM(GL_SGIX_texture_multi_buffer)); + rb_define_const(module, "GL_SGIX_texture_scale_bias", INT2NUM(GL_SGIX_texture_scale_bias)); + rb_define_const(module, "GL_SGIX_vertex_preclip", INT2NUM(GL_SGIX_vertex_preclip)); + rb_define_const(module, "GL_SGIX_ycrcb", INT2NUM(GL_SGIX_ycrcb)); + rb_define_const(module, "GL_SHADE_MODEL", INT2NUM(GL_SHADE_MODEL)); + rb_define_const(module, "GL_SHADER_CONSISTENT_NV", INT2NUM(GL_SHADER_CONSISTENT_NV)); + rb_define_const(module, "GL_SHADER_OBJECT_ARB", INT2NUM(GL_SHADER_OBJECT_ARB)); + rb_define_const(module, "GL_SHADER_OPERATION_NV", INT2NUM(GL_SHADER_OPERATION_NV)); + rb_define_const(module, "GL_SHADER_SOURCE_LENGTH", INT2NUM(GL_SHADER_SOURCE_LENGTH)); + rb_define_const(module, "GL_SHADER_TYPE", INT2NUM(GL_SHADER_TYPE)); + rb_define_const(module, "GL_SHADING_LANGUAGE_VERSION_ARB", INT2NUM(GL_SHADING_LANGUAGE_VERSION_ARB)); + rb_define_const(module, "GL_SHADING_LANGUAGE_VERSION", INT2NUM(GL_SHADING_LANGUAGE_VERSION)); + rb_define_const(module, "GL_SHADOW_AMBIENT_SGIX", INT2NUM(GL_SHADOW_AMBIENT_SGIX)); + rb_define_const(module, "GL_SHADOW_ATTENUATION_EXT", INT2NUM(GL_SHADOW_ATTENUATION_EXT)); + rb_define_const(module, "GL_SHARED_TEXTURE_PALETTE_EXT", INT2NUM(GL_SHARED_TEXTURE_PALETTE_EXT)); + rb_define_const(module, "GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS", INT2NUM(GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS)); + rb_define_const(module, "GL_SHININESS", INT2NUM(GL_SHININESS)); + rb_define_const(module, "GL_SHORT", INT2NUM(GL_SHORT)); + rb_define_const(module, "GL_SIGNED_ALPHA8_NV", INT2NUM(GL_SIGNED_ALPHA8_NV)); + rb_define_const(module, "GL_SIGNED_ALPHA_NV", INT2NUM(GL_SIGNED_ALPHA_NV)); + rb_define_const(module, "GL_SIGNED_HILO16_NV", INT2NUM(GL_SIGNED_HILO16_NV)); + rb_define_const(module, "GL_SIGNED_HILO8_NV", INT2NUM(GL_SIGNED_HILO8_NV)); + rb_define_const(module, "GL_SIGNED_HILO_NV", INT2NUM(GL_SIGNED_HILO_NV)); + rb_define_const(module, "GL_SIGNED_IDENTITY_NV", INT2NUM(GL_SIGNED_IDENTITY_NV)); + rb_define_const(module, "GL_SIGNED_INTENSITY8_NV", INT2NUM(GL_SIGNED_INTENSITY8_NV)); + rb_define_const(module, "GL_SIGNED_INTENSITY_NV", INT2NUM(GL_SIGNED_INTENSITY_NV)); + rb_define_const(module, "GL_SIGNED_LUMINANCE8_ALPHA8_NV", INT2NUM(GL_SIGNED_LUMINANCE8_ALPHA8_NV)); + rb_define_const(module, "GL_SIGNED_LUMINANCE8_NV", INT2NUM(GL_SIGNED_LUMINANCE8_NV)); + rb_define_const(module, "GL_SIGNED_LUMINANCE_ALPHA_NV", INT2NUM(GL_SIGNED_LUMINANCE_ALPHA_NV)); + rb_define_const(module, "GL_SIGNED_LUMINANCE_NV", INT2NUM(GL_SIGNED_LUMINANCE_NV)); + rb_define_const(module, "GL_SIGNED_NEGATE_NV", INT2NUM(GL_SIGNED_NEGATE_NV)); + rb_define_const(module, "GL_SIGNED_RGB8_NV", INT2NUM(GL_SIGNED_RGB8_NV)); + rb_define_const(module, "GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV", INT2NUM(GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV)); + rb_define_const(module, "GL_SIGNED_RGBA8_NV", INT2NUM(GL_SIGNED_RGBA8_NV)); + rb_define_const(module, "GL_SIGNED_RGBA_NV", INT2NUM(GL_SIGNED_RGBA_NV)); + rb_define_const(module, "GL_SIGNED_RGB_NV", INT2NUM(GL_SIGNED_RGB_NV)); + rb_define_const(module, "GL_SIGNED_RGB_UNSIGNED_ALPHA_NV", INT2NUM(GL_SIGNED_RGB_UNSIGNED_ALPHA_NV)); + rb_define_const(module, "GL_SINGLE_COLOR_EXT", INT2NUM(GL_SINGLE_COLOR_EXT)); + rb_define_const(module, "GL_SINGLE_COLOR", INT2NUM(GL_SINGLE_COLOR)); + rb_define_const(module, "GL_S", INT2NUM(GL_S)); + rb_define_const(module, "GL_SLICE_ACCUM_SUN", INT2NUM(GL_SLICE_ACCUM_SUN)); + rb_define_const(module, "GL_SLUMINANCE8_ALPHA8_EXT", INT2NUM(GL_SLUMINANCE8_ALPHA8_EXT)); + rb_define_const(module, "GL_SLUMINANCE8_ALPHA8", INT2NUM(GL_SLUMINANCE8_ALPHA8)); + rb_define_const(module, "GL_SLUMINANCE8_EXT", INT2NUM(GL_SLUMINANCE8_EXT)); + rb_define_const(module, "GL_SLUMINANCE8", INT2NUM(GL_SLUMINANCE8)); + rb_define_const(module, "GL_SLUMINANCE_ALPHA_EXT", INT2NUM(GL_SLUMINANCE_ALPHA_EXT)); + rb_define_const(module, "GL_SLUMINANCE_ALPHA", INT2NUM(GL_SLUMINANCE_ALPHA)); + rb_define_const(module, "GL_SLUMINANCE_EXT", INT2NUM(GL_SLUMINANCE_EXT)); + rb_define_const(module, "GL_SLUMINANCE", INT2NUM(GL_SLUMINANCE)); + rb_define_const(module, "GL_SMOOTH", INT2NUM(GL_SMOOTH)); + rb_define_const(module, "GL_SMOOTH_LINE_WIDTH_GRANULARITY", INT2NUM(GL_SMOOTH_LINE_WIDTH_GRANULARITY)); + rb_define_const(module, "GL_SMOOTH_LINE_WIDTH_RANGE", INT2NUM(GL_SMOOTH_LINE_WIDTH_RANGE)); + rb_define_const(module, "GL_SMOOTH_POINT_SIZE_GRANULARITY", INT2NUM(GL_SMOOTH_POINT_SIZE_GRANULARITY)); + rb_define_const(module, "GL_SMOOTH_POINT_SIZE_RANGE", INT2NUM(GL_SMOOTH_POINT_SIZE_RANGE)); + rb_define_const(module, "GL_SOURCE0_ALPHA_ARB", INT2NUM(GL_SOURCE0_ALPHA_ARB)); + rb_define_const(module, "GL_SOURCE0_ALPHA_EXT", INT2NUM(GL_SOURCE0_ALPHA_EXT)); + rb_define_const(module, "GL_SOURCE0_ALPHA", INT2NUM(GL_SOURCE0_ALPHA)); + rb_define_const(module, "GL_SOURCE0_RGB_ARB", INT2NUM(GL_SOURCE0_RGB_ARB)); + rb_define_const(module, "GL_SOURCE0_RGB_EXT", INT2NUM(GL_SOURCE0_RGB_EXT)); + rb_define_const(module, "GL_SOURCE0_RGB", INT2NUM(GL_SOURCE0_RGB)); + rb_define_const(module, "GL_SOURCE1_ALPHA_ARB", INT2NUM(GL_SOURCE1_ALPHA_ARB)); + rb_define_const(module, "GL_SOURCE1_ALPHA_EXT", INT2NUM(GL_SOURCE1_ALPHA_EXT)); + rb_define_const(module, "GL_SOURCE1_ALPHA", INT2NUM(GL_SOURCE1_ALPHA)); + rb_define_const(module, "GL_SOURCE1_RGB_ARB", INT2NUM(GL_SOURCE1_RGB_ARB)); + rb_define_const(module, "GL_SOURCE1_RGB_EXT", INT2NUM(GL_SOURCE1_RGB_EXT)); + rb_define_const(module, "GL_SOURCE1_RGB", INT2NUM(GL_SOURCE1_RGB)); + rb_define_const(module, "GL_SOURCE2_ALPHA_ARB", INT2NUM(GL_SOURCE2_ALPHA_ARB)); + rb_define_const(module, "GL_SOURCE2_ALPHA_EXT", INT2NUM(GL_SOURCE2_ALPHA_EXT)); + rb_define_const(module, "GL_SOURCE2_ALPHA", INT2NUM(GL_SOURCE2_ALPHA)); + rb_define_const(module, "GL_SOURCE2_RGB_ARB", INT2NUM(GL_SOURCE2_RGB_ARB)); + rb_define_const(module, "GL_SOURCE2_RGB_EXT", INT2NUM(GL_SOURCE2_RGB_EXT)); + rb_define_const(module, "GL_SOURCE2_RGB", INT2NUM(GL_SOURCE2_RGB)); + rb_define_const(module, "GL_SOURCE3_ALPHA_NV", INT2NUM(GL_SOURCE3_ALPHA_NV)); + rb_define_const(module, "GL_SOURCE3_RGB_NV", INT2NUM(GL_SOURCE3_RGB_NV)); + rb_define_const(module, "GL_SPARE0_NV", INT2NUM(GL_SPARE0_NV)); + rb_define_const(module, "GL_SPARE0_PLUS_SECONDARY_COLOR_NV", INT2NUM(GL_SPARE0_PLUS_SECONDARY_COLOR_NV)); + rb_define_const(module, "GL_SPARE1_NV", INT2NUM(GL_SPARE1_NV)); + rb_define_const(module, "GL_SPECULAR", INT2NUM(GL_SPECULAR)); + rb_define_const(module, "GL_SPHERE_MAP", INT2NUM(GL_SPHERE_MAP)); + rb_define_const(module, "GL_SPOT_CUTOFF", INT2NUM(GL_SPOT_CUTOFF)); + rb_define_const(module, "GL_SPOT_DIRECTION", INT2NUM(GL_SPOT_DIRECTION)); + rb_define_const(module, "GL_SPOT_EXPONENT", INT2NUM(GL_SPOT_EXPONENT)); + rb_define_const(module, "GL_SPRITE_AXIAL_SGIX", INT2NUM(GL_SPRITE_AXIAL_SGIX)); + rb_define_const(module, "GL_SPRITE_AXIS_SGIX", INT2NUM(GL_SPRITE_AXIS_SGIX)); + rb_define_const(module, "GL_SPRITE_EYE_ALIGNED_SGIX", INT2NUM(GL_SPRITE_EYE_ALIGNED_SGIX)); + rb_define_const(module, "GL_SPRITE_MODE_SGIX", INT2NUM(GL_SPRITE_MODE_SGIX)); + rb_define_const(module, "GL_SPRITE_OBJECT_ALIGNED_SGIX", INT2NUM(GL_SPRITE_OBJECT_ALIGNED_SGIX)); + rb_define_const(module, "GL_SPRITE_SGIX", INT2NUM(GL_SPRITE_SGIX)); + rb_define_const(module, "GL_SPRITE_TRANSLATION_SGIX", INT2NUM(GL_SPRITE_TRANSLATION_SGIX)); + rb_define_const(module, "GL_SRC0_ALPHA", INT2NUM(GL_SRC0_ALPHA)); + rb_define_const(module, "GL_SRC0_RGB", INT2NUM(GL_SRC0_RGB)); + rb_define_const(module, "GL_SRC1_ALPHA", INT2NUM(GL_SRC1_ALPHA)); + rb_define_const(module, "GL_SRC1_RGB", INT2NUM(GL_SRC1_RGB)); + rb_define_const(module, "GL_SRC2_ALPHA", INT2NUM(GL_SRC2_ALPHA)); + rb_define_const(module, "GL_SRC2_RGB", INT2NUM(GL_SRC2_RGB)); + rb_define_const(module, "GL_SRC_ALPHA", INT2NUM(GL_SRC_ALPHA)); + rb_define_const(module, "GL_SRC_ALPHA_SATURATE", INT2NUM(GL_SRC_ALPHA_SATURATE)); + rb_define_const(module, "GL_SRC_COLOR", INT2NUM(GL_SRC_COLOR)); + rb_define_const(module, "GL_SRGB8_ALPHA8_EXT", INT2NUM(GL_SRGB8_ALPHA8_EXT)); + rb_define_const(module, "GL_SRGB8_ALPHA8", INT2NUM(GL_SRGB8_ALPHA8)); + rb_define_const(module, "GL_SRGB8_EXT", INT2NUM(GL_SRGB8_EXT)); + rb_define_const(module, "GL_SRGB8", INT2NUM(GL_SRGB8)); + rb_define_const(module, "GL_SRGB_ALPHA_EXT", INT2NUM(GL_SRGB_ALPHA_EXT)); + rb_define_const(module, "GL_SRGB_ALPHA", INT2NUM(GL_SRGB_ALPHA)); + rb_define_const(module, "GL_SRGB_EXT", INT2NUM(GL_SRGB_EXT)); + rb_define_const(module, "GL_SRGB", INT2NUM(GL_SRGB)); + rb_define_const(module, "GL_STACK_OVERFLOW", INT2NUM(GL_STACK_OVERFLOW)); + rb_define_const(module, "GL_STACK_UNDERFLOW", INT2NUM(GL_STACK_UNDERFLOW)); + rb_define_const(module, "GL_STATIC_ATI", INT2NUM(GL_STATIC_ATI)); + rb_define_const(module, "GL_STATIC_COPY_ARB", INT2NUM(GL_STATIC_COPY_ARB)); + rb_define_const(module, "GL_STATIC_COPY", INT2NUM(GL_STATIC_COPY)); + rb_define_const(module, "GL_STATIC_DRAW_ARB", INT2NUM(GL_STATIC_DRAW_ARB)); + rb_define_const(module, "GL_STATIC_DRAW", INT2NUM(GL_STATIC_DRAW)); + rb_define_const(module, "GL_STATIC_READ_ARB", INT2NUM(GL_STATIC_READ_ARB)); + rb_define_const(module, "GL_STATIC_READ", INT2NUM(GL_STATIC_READ)); + rb_define_const(module, "GL_STENCIL_ATTACHMENT_EXT", INT2NUM(GL_STENCIL_ATTACHMENT_EXT)); + rb_define_const(module, "GL_STENCIL_BACK_FAIL_ATI", INT2NUM(GL_STENCIL_BACK_FAIL_ATI)); + rb_define_const(module, "GL_STENCIL_BACK_FAIL", INT2NUM(GL_STENCIL_BACK_FAIL)); + rb_define_const(module, "GL_STENCIL_BACK_FUNC_ATI", INT2NUM(GL_STENCIL_BACK_FUNC_ATI)); + rb_define_const(module, "GL_STENCIL_BACK_FUNC", INT2NUM(GL_STENCIL_BACK_FUNC)); + rb_define_const(module, "GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI", INT2NUM(GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI)); + rb_define_const(module, "GL_STENCIL_BACK_PASS_DEPTH_FAIL", INT2NUM(GL_STENCIL_BACK_PASS_DEPTH_FAIL)); + rb_define_const(module, "GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI", INT2NUM(GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI)); + rb_define_const(module, "GL_STENCIL_BACK_PASS_DEPTH_PASS", INT2NUM(GL_STENCIL_BACK_PASS_DEPTH_PASS)); + rb_define_const(module, "GL_STENCIL_BACK_REF", INT2NUM(GL_STENCIL_BACK_REF)); + rb_define_const(module, "GL_STENCIL_BACK_VALUE_MASK", INT2NUM(GL_STENCIL_BACK_VALUE_MASK)); + rb_define_const(module, "GL_STENCIL_BACK_WRITEMASK", INT2NUM(GL_STENCIL_BACK_WRITEMASK)); + rb_define_const(module, "GL_STENCIL_BITS", INT2NUM(GL_STENCIL_BITS)); + rb_define_const(module, "GL_STENCIL_BUFFER_BIT", INT2NUM(GL_STENCIL_BUFFER_BIT)); + rb_define_const(module, "GL_STENCIL_CLEAR_TAG_VALUE_EXT", INT2NUM(GL_STENCIL_CLEAR_TAG_VALUE_EXT)); + rb_define_const(module, "GL_STENCIL_CLEAR_VALUE", INT2NUM(GL_STENCIL_CLEAR_VALUE)); + rb_define_const(module, "GL_STENCIL_FAIL", INT2NUM(GL_STENCIL_FAIL)); + rb_define_const(module, "GL_STENCIL_FUNC", INT2NUM(GL_STENCIL_FUNC)); + rb_define_const(module, "GL_STENCIL_INDEX16_EXT", INT2NUM(GL_STENCIL_INDEX16_EXT)); + rb_define_const(module, "GL_STENCIL_INDEX1_EXT", INT2NUM(GL_STENCIL_INDEX1_EXT)); + rb_define_const(module, "GL_STENCIL_INDEX4_EXT", INT2NUM(GL_STENCIL_INDEX4_EXT)); + rb_define_const(module, "GL_STENCIL_INDEX8_EXT", INT2NUM(GL_STENCIL_INDEX8_EXT)); + rb_define_const(module, "GL_STENCIL_INDEX", INT2NUM(GL_STENCIL_INDEX)); + rb_define_const(module, "GL_STENCIL", INT2NUM(GL_STENCIL)); + rb_define_const(module, "GL_STENCIL_PASS_DEPTH_FAIL", INT2NUM(GL_STENCIL_PASS_DEPTH_FAIL)); + rb_define_const(module, "GL_STENCIL_PASS_DEPTH_PASS", INT2NUM(GL_STENCIL_PASS_DEPTH_PASS)); + rb_define_const(module, "GL_STENCIL_REF", INT2NUM(GL_STENCIL_REF)); + rb_define_const(module, "GL_STENCIL_TAG_BITS_EXT", INT2NUM(GL_STENCIL_TAG_BITS_EXT)); + rb_define_const(module, "GL_STENCIL_TEST", INT2NUM(GL_STENCIL_TEST)); + rb_define_const(module, "GL_STENCIL_TEST_TWO_SIDE_EXT", INT2NUM(GL_STENCIL_TEST_TWO_SIDE_EXT)); + rb_define_const(module, "GL_STENCIL_VALUE_MASK", INT2NUM(GL_STENCIL_VALUE_MASK)); + rb_define_const(module, "GL_STENCIL_WRITEMASK", INT2NUM(GL_STENCIL_WRITEMASK)); + rb_define_const(module, "GL_STEREO", INT2NUM(GL_STEREO)); + rb_define_const(module, "GL_STORAGE_CACHED_APPLE", INT2NUM(GL_STORAGE_CACHED_APPLE)); + rb_define_const(module, "GL_STORAGE_SHARED_APPLE", INT2NUM(GL_STORAGE_SHARED_APPLE)); + rb_define_const(module, "GL_STREAM_COPY_ARB", INT2NUM(GL_STREAM_COPY_ARB)); + rb_define_const(module, "GL_STREAM_COPY", INT2NUM(GL_STREAM_COPY)); + rb_define_const(module, "GL_STREAM_DRAW_ARB", INT2NUM(GL_STREAM_DRAW_ARB)); + rb_define_const(module, "GL_STREAM_DRAW", INT2NUM(GL_STREAM_DRAW)); + rb_define_const(module, "GL_STREAM_READ_ARB", INT2NUM(GL_STREAM_READ_ARB)); + rb_define_const(module, "GL_STREAM_READ", INT2NUM(GL_STREAM_READ)); + rb_define_const(module, "GL_STRICT_DEPTHFUNC_HINT_PGI", INT2NUM(GL_STRICT_DEPTHFUNC_HINT_PGI)); + rb_define_const(module, "GL_STRICT_LIGHTING_HINT_PGI", INT2NUM(GL_STRICT_LIGHTING_HINT_PGI)); + rb_define_const(module, "GL_STRICT_SCISSOR_HINT_PGI", INT2NUM(GL_STRICT_SCISSOR_HINT_PGI)); + rb_define_const(module, "GL_SUB_ATI", INT2NUM(GL_SUB_ATI)); + rb_define_const(module, "GL_SUBPIXEL_BITS", INT2NUM(GL_SUBPIXEL_BITS)); + rb_define_const(module, "GL_SUBTRACT_ARB", INT2NUM(GL_SUBTRACT_ARB)); + rb_define_const(module, "GL_SUBTRACT", INT2NUM(GL_SUBTRACT)); + rb_define_const(module, "GL_SWIZZLE_STQ_ATI", INT2NUM(GL_SWIZZLE_STQ_ATI)); + rb_define_const(module, "GL_SWIZZLE_STQ_DQ_ATI", INT2NUM(GL_SWIZZLE_STQ_DQ_ATI)); + rb_define_const(module, "GL_SWIZZLE_STR_ATI", INT2NUM(GL_SWIZZLE_STR_ATI)); + rb_define_const(module, "GL_SWIZZLE_STR_DR_ATI", INT2NUM(GL_SWIZZLE_STR_DR_ATI)); + rb_define_const(module, "GL_SWIZZLE_STRQ_ATI", INT2NUM(GL_SWIZZLE_STRQ_ATI)); + rb_define_const(module, "GL_SWIZZLE_STRQ_DQ_ATI", INT2NUM(GL_SWIZZLE_STRQ_DQ_ATI)); + rb_define_const(module, "GL_T2F_C3F_V3F", INT2NUM(GL_T2F_C3F_V3F)); + rb_define_const(module, "GL_T2F_C4F_N3F_V3F", INT2NUM(GL_T2F_C4F_N3F_V3F)); + rb_define_const(module, "GL_T2F_C4UB_V3F", INT2NUM(GL_T2F_C4UB_V3F)); + rb_define_const(module, "GL_T2F_IUI_N3F_V2F_EXT", INT2NUM(GL_T2F_IUI_N3F_V2F_EXT)); + rb_define_const(module, "GL_T2F_IUI_N3F_V3F_EXT", INT2NUM(GL_T2F_IUI_N3F_V3F_EXT)); + rb_define_const(module, "GL_T2F_IUI_V2F_EXT", INT2NUM(GL_T2F_IUI_V2F_EXT)); + rb_define_const(module, "GL_T2F_IUI_V3F_EXT", INT2NUM(GL_T2F_IUI_V3F_EXT)); + rb_define_const(module, "GL_T2F_N3F_V3F", INT2NUM(GL_T2F_N3F_V3F)); + rb_define_const(module, "GL_T2F_V3F", INT2NUM(GL_T2F_V3F)); + rb_define_const(module, "GL_T4F_C4F_N3F_V4F", INT2NUM(GL_T4F_C4F_N3F_V4F)); + rb_define_const(module, "GL_T4F_V4F", INT2NUM(GL_T4F_V4F)); + rb_define_const(module, "GL_TABLE_TOO_LARGE_EXT", INT2NUM(GL_TABLE_TOO_LARGE_EXT)); + rb_define_const(module, "GL_TABLE_TOO_LARGE", INT2NUM(GL_TABLE_TOO_LARGE)); + rb_define_const(module, "GL_TANGENT_ARRAY_EXT", INT2NUM(GL_TANGENT_ARRAY_EXT)); + rb_define_const(module, "GL_TANGENT_ARRAY_POINTER_EXT", INT2NUM(GL_TANGENT_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_TANGENT_ARRAY_STRIDE_EXT", INT2NUM(GL_TANGENT_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_TANGENT_ARRAY_TYPE_EXT", INT2NUM(GL_TANGENT_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_TEXCOORD1_BIT_PGI", INT2NUM(GL_TEXCOORD1_BIT_PGI)); + rb_define_const(module, "GL_TEXCOORD2_BIT_PGI", INT2NUM(GL_TEXCOORD2_BIT_PGI)); + rb_define_const(module, "GL_TEXCOORD3_BIT_PGI", INT2NUM(GL_TEXCOORD3_BIT_PGI)); + rb_define_const(module, "GL_TEXCOORD4_BIT_PGI", INT2NUM(GL_TEXCOORD4_BIT_PGI)); + rb_define_const(module, "GL_TEXT_FRAGMENT_SHADER_ATI", INT2NUM(GL_TEXT_FRAGMENT_SHADER_ATI)); + rb_define_const(module, "GL_TEXTURE0_ARB", INT2NUM(GL_TEXTURE0_ARB)); + rb_define_const(module, "GL_TEXTURE0", INT2NUM(GL_TEXTURE0)); + rb_define_const(module, "GL_TEXTURE10_ARB", INT2NUM(GL_TEXTURE10_ARB)); + rb_define_const(module, "GL_TEXTURE10", INT2NUM(GL_TEXTURE10)); + rb_define_const(module, "GL_TEXTURE11_ARB", INT2NUM(GL_TEXTURE11_ARB)); + rb_define_const(module, "GL_TEXTURE11", INT2NUM(GL_TEXTURE11)); + rb_define_const(module, "GL_TEXTURE12_ARB", INT2NUM(GL_TEXTURE12_ARB)); + rb_define_const(module, "GL_TEXTURE12", INT2NUM(GL_TEXTURE12)); + rb_define_const(module, "GL_TEXTURE13_ARB", INT2NUM(GL_TEXTURE13_ARB)); + rb_define_const(module, "GL_TEXTURE13", INT2NUM(GL_TEXTURE13)); + rb_define_const(module, "GL_TEXTURE14_ARB", INT2NUM(GL_TEXTURE14_ARB)); + rb_define_const(module, "GL_TEXTURE14", INT2NUM(GL_TEXTURE14)); + rb_define_const(module, "GL_TEXTURE15_ARB", INT2NUM(GL_TEXTURE15_ARB)); + rb_define_const(module, "GL_TEXTURE15", INT2NUM(GL_TEXTURE15)); + rb_define_const(module, "GL_TEXTURE16_ARB", INT2NUM(GL_TEXTURE16_ARB)); + rb_define_const(module, "GL_TEXTURE16", INT2NUM(GL_TEXTURE16)); + rb_define_const(module, "GL_TEXTURE17_ARB", INT2NUM(GL_TEXTURE17_ARB)); + rb_define_const(module, "GL_TEXTURE17", INT2NUM(GL_TEXTURE17)); + rb_define_const(module, "GL_TEXTURE18_ARB", INT2NUM(GL_TEXTURE18_ARB)); + rb_define_const(module, "GL_TEXTURE18", INT2NUM(GL_TEXTURE18)); + rb_define_const(module, "GL_TEXTURE19_ARB", INT2NUM(GL_TEXTURE19_ARB)); + rb_define_const(module, "GL_TEXTURE19", INT2NUM(GL_TEXTURE19)); + rb_define_const(module, "GL_TEXTURE1_ARB", INT2NUM(GL_TEXTURE1_ARB)); + rb_define_const(module, "GL_TEXTURE_1D_BINDING_EXT", INT2NUM(GL_TEXTURE_1D_BINDING_EXT)); + rb_define_const(module, "GL_TEXTURE_1D", INT2NUM(GL_TEXTURE_1D)); + rb_define_const(module, "GL_TEXTURE_1D_STACK_BINDING_MESAX", INT2NUM(GL_TEXTURE_1D_STACK_BINDING_MESAX)); + rb_define_const(module, "GL_TEXTURE_1D_STACK_MESAX", INT2NUM(GL_TEXTURE_1D_STACK_MESAX)); + rb_define_const(module, "GL_TEXTURE1", INT2NUM(GL_TEXTURE1)); + rb_define_const(module, "GL_TEXTURE20_ARB", INT2NUM(GL_TEXTURE20_ARB)); + rb_define_const(module, "GL_TEXTURE20", INT2NUM(GL_TEXTURE20)); + rb_define_const(module, "GL_TEXTURE21_ARB", INT2NUM(GL_TEXTURE21_ARB)); + rb_define_const(module, "GL_TEXTURE21", INT2NUM(GL_TEXTURE21)); + rb_define_const(module, "GL_TEXTURE22_ARB", INT2NUM(GL_TEXTURE22_ARB)); + rb_define_const(module, "GL_TEXTURE22", INT2NUM(GL_TEXTURE22)); + rb_define_const(module, "GL_TEXTURE23_ARB", INT2NUM(GL_TEXTURE23_ARB)); + rb_define_const(module, "GL_TEXTURE23", INT2NUM(GL_TEXTURE23)); + rb_define_const(module, "GL_TEXTURE24_ARB", INT2NUM(GL_TEXTURE24_ARB)); + rb_define_const(module, "GL_TEXTURE24", INT2NUM(GL_TEXTURE24)); + rb_define_const(module, "GL_TEXTURE25_ARB", INT2NUM(GL_TEXTURE25_ARB)); + rb_define_const(module, "GL_TEXTURE25", INT2NUM(GL_TEXTURE25)); + rb_define_const(module, "GL_TEXTURE26_ARB", INT2NUM(GL_TEXTURE26_ARB)); + rb_define_const(module, "GL_TEXTURE26", INT2NUM(GL_TEXTURE26)); + rb_define_const(module, "GL_TEXTURE27_ARB", INT2NUM(GL_TEXTURE27_ARB)); + rb_define_const(module, "GL_TEXTURE27", INT2NUM(GL_TEXTURE27)); + rb_define_const(module, "GL_TEXTURE28_ARB", INT2NUM(GL_TEXTURE28_ARB)); + rb_define_const(module, "GL_TEXTURE28", INT2NUM(GL_TEXTURE28)); + rb_define_const(module, "GL_TEXTURE29_ARB", INT2NUM(GL_TEXTURE29_ARB)); + rb_define_const(module, "GL_TEXTURE29", INT2NUM(GL_TEXTURE29)); + rb_define_const(module, "GL_TEXTURE2_ARB", INT2NUM(GL_TEXTURE2_ARB)); + rb_define_const(module, "GL_TEXTURE_2D_BINDING_EXT", INT2NUM(GL_TEXTURE_2D_BINDING_EXT)); + rb_define_const(module, "GL_TEXTURE_2D", INT2NUM(GL_TEXTURE_2D)); + rb_define_const(module, "GL_TEXTURE_2D_STACK_BINDING_MESAX", INT2NUM(GL_TEXTURE_2D_STACK_BINDING_MESAX)); + rb_define_const(module, "GL_TEXTURE_2D_STACK_MESAX", INT2NUM(GL_TEXTURE_2D_STACK_MESAX)); + rb_define_const(module, "GL_TEXTURE2", INT2NUM(GL_TEXTURE2)); + rb_define_const(module, "GL_TEXTURE30_ARB", INT2NUM(GL_TEXTURE30_ARB)); + rb_define_const(module, "GL_TEXTURE30", INT2NUM(GL_TEXTURE30)); + rb_define_const(module, "GL_TEXTURE31_ARB", INT2NUM(GL_TEXTURE31_ARB)); + rb_define_const(module, "GL_TEXTURE31", INT2NUM(GL_TEXTURE31)); + rb_define_const(module, "GL_TEXTURE3_ARB", INT2NUM(GL_TEXTURE3_ARB)); + rb_define_const(module, "GL_TEXTURE_3D_BINDING_EXT", INT2NUM(GL_TEXTURE_3D_BINDING_EXT)); + rb_define_const(module, "GL_TEXTURE_3D_EXT", INT2NUM(GL_TEXTURE_3D_EXT)); + rb_define_const(module, "GL_TEXTURE_3D", INT2NUM(GL_TEXTURE_3D)); + rb_define_const(module, "GL_TEXTURE3", INT2NUM(GL_TEXTURE3)); + rb_define_const(module, "GL_TEXTURE4_ARB", INT2NUM(GL_TEXTURE4_ARB)); + rb_define_const(module, "GL_TEXTURE_4D_BINDING_SGIS", INT2NUM(GL_TEXTURE_4D_BINDING_SGIS)); + rb_define_const(module, "GL_TEXTURE_4D_SGIS", INT2NUM(GL_TEXTURE_4D_SGIS)); + rb_define_const(module, "GL_TEXTURE_4DSIZE_SGIS", INT2NUM(GL_TEXTURE_4DSIZE_SGIS)); + rb_define_const(module, "GL_TEXTURE4", INT2NUM(GL_TEXTURE4)); + rb_define_const(module, "GL_TEXTURE5_ARB", INT2NUM(GL_TEXTURE5_ARB)); + rb_define_const(module, "GL_TEXTURE5", INT2NUM(GL_TEXTURE5)); + rb_define_const(module, "GL_TEXTURE6_ARB", INT2NUM(GL_TEXTURE6_ARB)); + rb_define_const(module, "GL_TEXTURE6", INT2NUM(GL_TEXTURE6)); + rb_define_const(module, "GL_TEXTURE7_ARB", INT2NUM(GL_TEXTURE7_ARB)); + rb_define_const(module, "GL_TEXTURE7", INT2NUM(GL_TEXTURE7)); + rb_define_const(module, "GL_TEXTURE8_ARB", INT2NUM(GL_TEXTURE8_ARB)); + rb_define_const(module, "GL_TEXTURE8", INT2NUM(GL_TEXTURE8)); + rb_define_const(module, "GL_TEXTURE9_ARB", INT2NUM(GL_TEXTURE9_ARB)); + rb_define_const(module, "GL_TEXTURE9", INT2NUM(GL_TEXTURE9)); + rb_define_const(module, "GL_TEXTURE_ALPHA_SIZE_EXT", INT2NUM(GL_TEXTURE_ALPHA_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_ALPHA_SIZE", INT2NUM(GL_TEXTURE_ALPHA_SIZE)); + rb_define_const(module, "GL_TEXTURE_ALPHA_TYPE_ARB", INT2NUM(GL_TEXTURE_ALPHA_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_APPLICATION_MODE_EXT", INT2NUM(GL_TEXTURE_APPLICATION_MODE_EXT)); + rb_define_const(module, "GL_TEXTURE_BASE_LEVEL", INT2NUM(GL_TEXTURE_BASE_LEVEL)); + rb_define_const(module, "GL_TEXTURE_BASE_LEVEL_SGIS", INT2NUM(GL_TEXTURE_BASE_LEVEL_SGIS)); + rb_define_const(module, "GL_TEXTURE_BINDING_1D", INT2NUM(GL_TEXTURE_BINDING_1D)); + rb_define_const(module, "GL_TEXTURE_BINDING_2D", INT2NUM(GL_TEXTURE_BINDING_2D)); + rb_define_const(module, "GL_TEXTURE_BINDING_3D", INT2NUM(GL_TEXTURE_BINDING_3D)); + rb_define_const(module, "GL_TEXTURE_BINDING_CUBE_MAP_ARB", INT2NUM(GL_TEXTURE_BINDING_CUBE_MAP_ARB)); + rb_define_const(module, "GL_TEXTURE_BINDING_CUBE_MAP_EXT", INT2NUM(GL_TEXTURE_BINDING_CUBE_MAP_EXT)); + rb_define_const(module, "GL_TEXTURE_BINDING_CUBE_MAP", INT2NUM(GL_TEXTURE_BINDING_CUBE_MAP)); + rb_define_const(module, "GL_TEXTURE_BINDING_RECTANGLE_ARB", INT2NUM(GL_TEXTURE_BINDING_RECTANGLE_ARB)); + rb_define_const(module, "GL_TEXTURE_BINDING_RECTANGLE_NV", INT2NUM(GL_TEXTURE_BINDING_RECTANGLE_NV)); + rb_define_const(module, "GL_TEXTURE_BIT", INT2NUM(GL_TEXTURE_BIT)); + rb_define_const(module, "GL_TEXTURE_BLUE_SIZE_EXT", INT2NUM(GL_TEXTURE_BLUE_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_BLUE_SIZE", INT2NUM(GL_TEXTURE_BLUE_SIZE)); + rb_define_const(module, "GL_TEXTURE_BLUE_TYPE_ARB", INT2NUM(GL_TEXTURE_BLUE_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_BORDER_COLOR", INT2NUM(GL_TEXTURE_BORDER_COLOR)); + rb_define_const(module, "GL_TEXTURE_BORDER", INT2NUM(GL_TEXTURE_BORDER)); + rb_define_const(module, "GL_TEXTURE_BORDER_VALUES_NV", INT2NUM(GL_TEXTURE_BORDER_VALUES_NV)); + rb_define_const(module, "GL_TEXTURE_CLIPMAP_CENTER_SGIX", INT2NUM(GL_TEXTURE_CLIPMAP_CENTER_SGIX)); + rb_define_const(module, "GL_TEXTURE_CLIPMAP_DEPTH_SGIX", INT2NUM(GL_TEXTURE_CLIPMAP_DEPTH_SGIX)); + rb_define_const(module, "GL_TEXTURE_CLIPMAP_FRAME_SGIX", INT2NUM(GL_TEXTURE_CLIPMAP_FRAME_SGIX)); + rb_define_const(module, "GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX", INT2NUM(GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX)); + rb_define_const(module, "GL_TEXTURE_CLIPMAP_OFFSET_SGIX", INT2NUM(GL_TEXTURE_CLIPMAP_OFFSET_SGIX)); + rb_define_const(module, "GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX", INT2NUM(GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX)); + rb_define_const(module, "GL_TEXTURE_COLOR_TABLE_SGI", INT2NUM(GL_TEXTURE_COLOR_TABLE_SGI)); + rb_define_const(module, "GL_TEXTURE_COLOR_WRITEMASK_SGIS", INT2NUM(GL_TEXTURE_COLOR_WRITEMASK_SGIS)); + rb_define_const(module, "GL_TEXTURE_COMPARE_FAIL_VALUE_ARB", INT2NUM(GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)); + rb_define_const(module, "GL_TEXTURE_COMPARE_FUNC", INT2NUM(GL_TEXTURE_COMPARE_FUNC)); + rb_define_const(module, "GL_TEXTURE_COMPARE_MODE", INT2NUM(GL_TEXTURE_COMPARE_MODE)); + rb_define_const(module, "GL_TEXTURE_COMPARE_OPERATOR_SGIX", INT2NUM(GL_TEXTURE_COMPARE_OPERATOR_SGIX)); + rb_define_const(module, "GL_TEXTURE_COMPARE_SGIX", INT2NUM(GL_TEXTURE_COMPARE_SGIX)); + rb_define_const(module, "GL_TEXTURE_COMPONENTS", INT2NUM(GL_TEXTURE_COMPONENTS)); + rb_define_const(module, "GL_TEXTURE_COMPRESSED_ARB", INT2NUM(GL_TEXTURE_COMPRESSED_ARB)); + rb_define_const(module, "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB", INT2NUM(GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB)); + rb_define_const(module, "GL_TEXTURE_COMPRESSED_IMAGE_SIZE", INT2NUM(GL_TEXTURE_COMPRESSED_IMAGE_SIZE)); + rb_define_const(module, "GL_TEXTURE_COMPRESSED", INT2NUM(GL_TEXTURE_COMPRESSED)); + rb_define_const(module, "GL_TEXTURE_COMPRESSION_HINT_ARB", INT2NUM(GL_TEXTURE_COMPRESSION_HINT_ARB)); + rb_define_const(module, "GL_TEXTURE_COMPRESSION_HINT", INT2NUM(GL_TEXTURE_COMPRESSION_HINT)); + rb_define_const(module, "GL_TEXTURE_CONSTANT_DATA_SUNX", INT2NUM(GL_TEXTURE_CONSTANT_DATA_SUNX)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING", INT2NUM(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", INT2NUM(GL_TEXTURE_COORD_ARRAY_COUNT_EXT)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_EXT", INT2NUM(GL_TEXTURE_COORD_ARRAY_EXT)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY", INT2NUM(GL_TEXTURE_COORD_ARRAY)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_LIST_IBM", INT2NUM(GL_TEXTURE_COORD_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL", INT2NUM(GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_POINTER_EXT", INT2NUM(GL_TEXTURE_COORD_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_POINTER", INT2NUM(GL_TEXTURE_COORD_ARRAY_POINTER)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_SIZE_EXT", INT2NUM(GL_TEXTURE_COORD_ARRAY_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_SIZE", INT2NUM(GL_TEXTURE_COORD_ARRAY_SIZE)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_STRIDE_EXT", INT2NUM(GL_TEXTURE_COORD_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_STRIDE", INT2NUM(GL_TEXTURE_COORD_ARRAY_STRIDE)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_TYPE_EXT", INT2NUM(GL_TEXTURE_COORD_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_TEXTURE_COORD_ARRAY_TYPE", INT2NUM(GL_TEXTURE_COORD_ARRAY_TYPE)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP", INT2NUM(GL_TEXTURE_CUBE_MAP)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_X", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_X)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z", INT2NUM(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_X", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_X)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_Y", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Y)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT)); + rb_define_const(module, "GL_TEXTURE_CUBE_MAP_POSITIVE_Z", INT2NUM(GL_TEXTURE_CUBE_MAP_POSITIVE_Z)); + rb_define_const(module, "GL_TEXTURE_DEFORMATION_BIT_SGIX", INT2NUM(GL_TEXTURE_DEFORMATION_BIT_SGIX)); + rb_define_const(module, "GL_TEXTURE_DEFORMATION_SGIX", INT2NUM(GL_TEXTURE_DEFORMATION_SGIX)); + rb_define_const(module, "GL_TEXTURE_DEPTH_EXT", INT2NUM(GL_TEXTURE_DEPTH_EXT)); + rb_define_const(module, "GL_TEXTURE_DEPTH", INT2NUM(GL_TEXTURE_DEPTH)); + rb_define_const(module, "GL_TEXTURE_DEPTH_SIZE_ARB", INT2NUM(GL_TEXTURE_DEPTH_SIZE_ARB)); + rb_define_const(module, "GL_TEXTURE_DEPTH_SIZE", INT2NUM(GL_TEXTURE_DEPTH_SIZE)); + rb_define_const(module, "GL_TEXTURE_DEPTH_TYPE_ARB", INT2NUM(GL_TEXTURE_DEPTH_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_DS_SIZE_NV", INT2NUM(GL_TEXTURE_DS_SIZE_NV)); + rb_define_const(module, "GL_TEXTURE_DT_SIZE_NV", INT2NUM(GL_TEXTURE_DT_SIZE_NV)); + rb_define_const(module, "GL_TEXTURE_ENV_BIAS_SGIX", INT2NUM(GL_TEXTURE_ENV_BIAS_SGIX)); + rb_define_const(module, "GL_TEXTURE_ENV_COLOR", INT2NUM(GL_TEXTURE_ENV_COLOR)); + rb_define_const(module, "GL_TEXTURE_ENV", INT2NUM(GL_TEXTURE_ENV)); + rb_define_const(module, "GL_TEXTURE_ENV_MODE", INT2NUM(GL_TEXTURE_ENV_MODE)); + rb_define_const(module, "GL_TEXTURE_FILTER4_SIZE_SGIS", INT2NUM(GL_TEXTURE_FILTER4_SIZE_SGIS)); + rb_define_const(module, "GL_TEXTURE_FILTER_CONTROL_EXT", INT2NUM(GL_TEXTURE_FILTER_CONTROL_EXT)); + rb_define_const(module, "GL_TEXTURE_FILTER_CONTROL", INT2NUM(GL_TEXTURE_FILTER_CONTROL)); + rb_define_const(module, "GL_TEXTURE_FLOAT_COMPONENTS_NV", INT2NUM(GL_TEXTURE_FLOAT_COMPONENTS_NV)); + rb_define_const(module, "GL_TEXTURE_GEN_MODE", INT2NUM(GL_TEXTURE_GEN_MODE)); + rb_define_const(module, "GL_TEXTURE_GEN_Q", INT2NUM(GL_TEXTURE_GEN_Q)); + rb_define_const(module, "GL_TEXTURE_GEN_R", INT2NUM(GL_TEXTURE_GEN_R)); + rb_define_const(module, "GL_TEXTURE_GEN_S", INT2NUM(GL_TEXTURE_GEN_S)); + rb_define_const(module, "GL_TEXTURE_GEN_T", INT2NUM(GL_TEXTURE_GEN_T)); + rb_define_const(module, "GL_TEXTURE_GEQUAL_R_SGIX", INT2NUM(GL_TEXTURE_GEQUAL_R_SGIX)); + rb_define_const(module, "GL_TEXTURE_GREEN_SIZE_EXT", INT2NUM(GL_TEXTURE_GREEN_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_GREEN_SIZE", INT2NUM(GL_TEXTURE_GREEN_SIZE)); + rb_define_const(module, "GL_TEXTURE_GREEN_TYPE_ARB", INT2NUM(GL_TEXTURE_GREEN_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_HEIGHT", INT2NUM(GL_TEXTURE_HEIGHT)); + rb_define_const(module, "GL_TEXTURE_HI_SIZE_NV", INT2NUM(GL_TEXTURE_HI_SIZE_NV)); + rb_define_const(module, "GL_TEXTURE_INDEX_SIZE_EXT", INT2NUM(GL_TEXTURE_INDEX_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE", INT2NUM(GL_TEXTURE)); + rb_define_const(module, "GL_TEXTURE_INTENSITY_SIZE_EXT", INT2NUM(GL_TEXTURE_INTENSITY_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_INTENSITY_SIZE", INT2NUM(GL_TEXTURE_INTENSITY_SIZE)); + rb_define_const(module, "GL_TEXTURE_INTENSITY_TYPE_ARB", INT2NUM(GL_TEXTURE_INTENSITY_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_INTERNAL_FORMAT", INT2NUM(GL_TEXTURE_INTERNAL_FORMAT)); + rb_define_const(module, "GL_TEXTURE_LEQUAL_R_SGIX", INT2NUM(GL_TEXTURE_LEQUAL_R_SGIX)); + rb_define_const(module, "GL_TEXTURE_LIGHT_EXT", INT2NUM(GL_TEXTURE_LIGHT_EXT)); + rb_define_const(module, "GL_TEXTURE_LIGHTING_MODE_HP", INT2NUM(GL_TEXTURE_LIGHTING_MODE_HP)); + rb_define_const(module, "GL_TEXTURE_LOD_BIAS_EXT", INT2NUM(GL_TEXTURE_LOD_BIAS_EXT)); + rb_define_const(module, "GL_TEXTURE_LOD_BIAS", INT2NUM(GL_TEXTURE_LOD_BIAS)); + rb_define_const(module, "GL_TEXTURE_LOD_BIAS_R_SGIX", INT2NUM(GL_TEXTURE_LOD_BIAS_R_SGIX)); + rb_define_const(module, "GL_TEXTURE_LOD_BIAS_S_SGIX", INT2NUM(GL_TEXTURE_LOD_BIAS_S_SGIX)); + rb_define_const(module, "GL_TEXTURE_LOD_BIAS_T_SGIX", INT2NUM(GL_TEXTURE_LOD_BIAS_T_SGIX)); + rb_define_const(module, "GL_TEXTURE_LO_SIZE_NV", INT2NUM(GL_TEXTURE_LO_SIZE_NV)); + rb_define_const(module, "GL_TEXTURE_LUMINANCE_SIZE_EXT", INT2NUM(GL_TEXTURE_LUMINANCE_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_LUMINANCE_SIZE", INT2NUM(GL_TEXTURE_LUMINANCE_SIZE)); + rb_define_const(module, "GL_TEXTURE_LUMINANCE_TYPE_ARB", INT2NUM(GL_TEXTURE_LUMINANCE_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_MAG_FILTER", INT2NUM(GL_TEXTURE_MAG_FILTER)); + rb_define_const(module, "GL_TEXTURE_MAG_SIZE_NV", INT2NUM(GL_TEXTURE_MAG_SIZE_NV)); + rb_define_const(module, "GL_TEXTURE_MATERIAL_FACE_EXT", INT2NUM(GL_TEXTURE_MATERIAL_FACE_EXT)); + rb_define_const(module, "GL_TEXTURE_MATERIAL_PARAMETER_EXT", INT2NUM(GL_TEXTURE_MATERIAL_PARAMETER_EXT)); + rb_define_const(module, "GL_TEXTURE_MATRIX", INT2NUM(GL_TEXTURE_MATRIX)); + rb_define_const(module, "GL_TEXTURE_MAX_ANISOTROPY_EXT", INT2NUM(GL_TEXTURE_MAX_ANISOTROPY_EXT)); + rb_define_const(module, "GL_TEXTURE_MAX_CLAMP_R_SGIX", INT2NUM(GL_TEXTURE_MAX_CLAMP_R_SGIX)); + rb_define_const(module, "GL_TEXTURE_MAX_CLAMP_S_SGIX", INT2NUM(GL_TEXTURE_MAX_CLAMP_S_SGIX)); + rb_define_const(module, "GL_TEXTURE_MAX_CLAMP_T_SGIX", INT2NUM(GL_TEXTURE_MAX_CLAMP_T_SGIX)); + rb_define_const(module, "GL_TEXTURE_MAX_LEVEL", INT2NUM(GL_TEXTURE_MAX_LEVEL)); + rb_define_const(module, "GL_TEXTURE_MAX_LEVEL_SGIS", INT2NUM(GL_TEXTURE_MAX_LEVEL_SGIS)); + rb_define_const(module, "GL_TEXTURE_MAX_LOD", INT2NUM(GL_TEXTURE_MAX_LOD)); + rb_define_const(module, "GL_TEXTURE_MAX_LOD_SGIS", INT2NUM(GL_TEXTURE_MAX_LOD_SGIS)); + rb_define_const(module, "GL_TEXTURE_MIN_FILTER", INT2NUM(GL_TEXTURE_MIN_FILTER)); + rb_define_const(module, "GL_TEXTURE_MIN_LOD", INT2NUM(GL_TEXTURE_MIN_LOD)); + rb_define_const(module, "GL_TEXTURE_MIN_LOD_SGIS", INT2NUM(GL_TEXTURE_MIN_LOD_SGIS)); + rb_define_const(module, "GL_TEXTURE_MULTI_BUFFER_HINT_SGIX", INT2NUM(GL_TEXTURE_MULTI_BUFFER_HINT_SGIX)); + rb_define_const(module, "GL_TEXTURE_NORMAL_EXT", INT2NUM(GL_TEXTURE_NORMAL_EXT)); + rb_define_const(module, "GL_TEXTURE_POST_SPECULAR_HP", INT2NUM(GL_TEXTURE_POST_SPECULAR_HP)); + rb_define_const(module, "GL_TEXTURE_PRE_SPECULAR_HP", INT2NUM(GL_TEXTURE_PRE_SPECULAR_HP)); + rb_define_const(module, "GL_TEXTURE_PRIORITY_EXT", INT2NUM(GL_TEXTURE_PRIORITY_EXT)); + rb_define_const(module, "GL_TEXTURE_PRIORITY", INT2NUM(GL_TEXTURE_PRIORITY)); + rb_define_const(module, "GL_TEXTURE_RECTANGLE_ARB", INT2NUM(GL_TEXTURE_RECTANGLE_ARB)); + rb_define_const(module, "GL_TEXTURE_RECTANGLE_NV", INT2NUM(GL_TEXTURE_RECTANGLE_NV)); + rb_define_const(module, "GL_TEXTURE_RED_SIZE_EXT", INT2NUM(GL_TEXTURE_RED_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_RED_SIZE", INT2NUM(GL_TEXTURE_RED_SIZE)); + rb_define_const(module, "GL_TEXTURE_RED_TYPE_ARB", INT2NUM(GL_TEXTURE_RED_TYPE_ARB)); + rb_define_const(module, "GL_TEXTURE_RESIDENT_EXT", INT2NUM(GL_TEXTURE_RESIDENT_EXT)); + rb_define_const(module, "GL_TEXTURE_RESIDENT", INT2NUM(GL_TEXTURE_RESIDENT)); + rb_define_const(module, "GL_TEXTURE_SHADER_NV", INT2NUM(GL_TEXTURE_SHADER_NV)); + rb_define_const(module, "GL_TEXTURE_STACK_DEPTH", INT2NUM(GL_TEXTURE_STACK_DEPTH)); + rb_define_const(module, "GL_TEXTURE_STENCIL_SIZE_EXT", INT2NUM(GL_TEXTURE_STENCIL_SIZE_EXT)); + rb_define_const(module, "GL_TEXTURE_TOO_LARGE_EXT", INT2NUM(GL_TEXTURE_TOO_LARGE_EXT)); + rb_define_const(module, "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV", INT2NUM(GL_TEXTURE_UNSIGNED_REMAP_MODE_NV)); + rb_define_const(module, "GL_TEXTURE_WIDTH", INT2NUM(GL_TEXTURE_WIDTH)); + rb_define_const(module, "GL_TEXTURE_WRAP_Q_SGIS", INT2NUM(GL_TEXTURE_WRAP_Q_SGIS)); + rb_define_const(module, "GL_TEXTURE_WRAP_R_EXT", INT2NUM(GL_TEXTURE_WRAP_R_EXT)); + rb_define_const(module, "GL_TEXTURE_WRAP_R", INT2NUM(GL_TEXTURE_WRAP_R)); + rb_define_const(module, "GL_TEXTURE_WRAP_S", INT2NUM(GL_TEXTURE_WRAP_S)); + rb_define_const(module, "GL_TEXTURE_WRAP_T", INT2NUM(GL_TEXTURE_WRAP_T)); + rb_define_const(module, "GL_TIME_ELAPSED_EXT", INT2NUM(GL_TIME_ELAPSED_EXT)); + rb_define_const(module, "GL_T", INT2NUM(GL_T)); + rb_define_const(module, "GL_TRACK_MATRIX_NV", INT2NUM(GL_TRACK_MATRIX_NV)); + rb_define_const(module, "GL_TRACK_MATRIX_TRANSFORM_NV", INT2NUM(GL_TRACK_MATRIX_TRANSFORM_NV)); + rb_define_const(module, "GL_TRANSFORM_BIT", INT2NUM(GL_TRANSFORM_BIT)); + rb_define_const(module, "GL_TRANSFORM_HINT_APPLE", INT2NUM(GL_TRANSFORM_HINT_APPLE)); + rb_define_const(module, "GL_TRANSPOSE_COLOR_MATRIX_ARB", INT2NUM(GL_TRANSPOSE_COLOR_MATRIX_ARB)); + rb_define_const(module, "GL_TRANSPOSE_COLOR_MATRIX", INT2NUM(GL_TRANSPOSE_COLOR_MATRIX)); + rb_define_const(module, "GL_TRANSPOSE_CURRENT_MATRIX_ARB", INT2NUM(GL_TRANSPOSE_CURRENT_MATRIX_ARB)); + rb_define_const(module, "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", INT2NUM(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB)); + rb_define_const(module, "GL_TRANSPOSE_MODELVIEW_MATRIX", INT2NUM(GL_TRANSPOSE_MODELVIEW_MATRIX)); + rb_define_const(module, "GL_TRANSPOSE_NV", INT2NUM(GL_TRANSPOSE_NV)); + rb_define_const(module, "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", INT2NUM(GL_TRANSPOSE_PROJECTION_MATRIX_ARB)); + rb_define_const(module, "GL_TRANSPOSE_PROJECTION_MATRIX", INT2NUM(GL_TRANSPOSE_PROJECTION_MATRIX)); + rb_define_const(module, "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", INT2NUM(GL_TRANSPOSE_TEXTURE_MATRIX_ARB)); + rb_define_const(module, "GL_TRANSPOSE_TEXTURE_MATRIX", INT2NUM(GL_TRANSPOSE_TEXTURE_MATRIX)); + rb_define_const(module, "GL_TRIANGLE_FAN", INT2NUM(GL_TRIANGLE_FAN)); + rb_define_const(module, "GL_TRIANGLE_LIST_SUN", INT2NUM(GL_TRIANGLE_LIST_SUN)); + rb_define_const(module, "GL_TRIANGLE_MESH_SUN", INT2NUM(GL_TRIANGLE_MESH_SUN)); + rb_define_const(module, "GL_TRIANGLES", INT2NUM(GL_TRIANGLES)); + rb_define_const(module, "GL_TRIANGLE_STRIP", INT2NUM(GL_TRIANGLE_STRIP)); + rb_define_const(module, "GL_TRUE", INT2NUM(GL_TRUE)); + rb_define_const(module, "GL_TYPE_RGBA_FLOAT_ATI", INT2NUM(GL_TYPE_RGBA_FLOAT_ATI)); + rb_define_const(module, "GL_UNPACK_ALIGNMENT", INT2NUM(GL_UNPACK_ALIGNMENT)); + rb_define_const(module, "GL_UNPACK_CLIENT_STORAGE_APPLE", INT2NUM(GL_UNPACK_CLIENT_STORAGE_APPLE)); + rb_define_const(module, "GL_UNPACK_CMYK_HINT_EXT", INT2NUM(GL_UNPACK_CMYK_HINT_EXT)); + rb_define_const(module, "GL_UNPACK_CONSTANT_DATA_SUNX", INT2NUM(GL_UNPACK_CONSTANT_DATA_SUNX)); + rb_define_const(module, "GL_UNPACK_IMAGE_DEPTH_SGIS", INT2NUM(GL_UNPACK_IMAGE_DEPTH_SGIS)); + rb_define_const(module, "GL_UNPACK_IMAGE_HEIGHT_EXT", INT2NUM(GL_UNPACK_IMAGE_HEIGHT_EXT)); + rb_define_const(module, "GL_UNPACK_IMAGE_HEIGHT", INT2NUM(GL_UNPACK_IMAGE_HEIGHT)); + rb_define_const(module, "GL_UNPACK_LSB_FIRST", INT2NUM(GL_UNPACK_LSB_FIRST)); + rb_define_const(module, "GL_UNPACK_RESAMPLE_OML", INT2NUM(GL_UNPACK_RESAMPLE_OML)); + rb_define_const(module, "GL_UNPACK_RESAMPLE_SGIX", INT2NUM(GL_UNPACK_RESAMPLE_SGIX)); + rb_define_const(module, "GL_UNPACK_ROW_LENGTH", INT2NUM(GL_UNPACK_ROW_LENGTH)); + rb_define_const(module, "GL_UNPACK_SKIP_IMAGES_EXT", INT2NUM(GL_UNPACK_SKIP_IMAGES_EXT)); + rb_define_const(module, "GL_UNPACK_SKIP_IMAGES", INT2NUM(GL_UNPACK_SKIP_IMAGES)); + rb_define_const(module, "GL_UNPACK_SKIP_PIXELS", INT2NUM(GL_UNPACK_SKIP_PIXELS)); + rb_define_const(module, "GL_UNPACK_SKIP_ROWS", INT2NUM(GL_UNPACK_SKIP_ROWS)); + rb_define_const(module, "GL_UNPACK_SKIP_VOLUMES_SGIS", INT2NUM(GL_UNPACK_SKIP_VOLUMES_SGIS)); + rb_define_const(module, "GL_UNPACK_SUBSAMPLE_RATE_SGIX", INT2NUM(GL_UNPACK_SUBSAMPLE_RATE_SGIX)); + rb_define_const(module, "GL_UNPACK_SWAP_BYTES", INT2NUM(GL_UNPACK_SWAP_BYTES)); + rb_define_const(module, "GL_UNSIGNED_BYTE_2_3_3_REV_EXT", INT2NUM(GL_UNSIGNED_BYTE_2_3_3_REV_EXT)); + rb_define_const(module, "GL_UNSIGNED_BYTE_2_3_3_REV", INT2NUM(GL_UNSIGNED_BYTE_2_3_3_REV)); + rb_define_const(module, "GL_UNSIGNED_BYTE_3_3_2_EXT", INT2NUM(GL_UNSIGNED_BYTE_3_3_2_EXT)); + rb_define_const(module, "GL_UNSIGNED_BYTE_3_3_2", INT2NUM(GL_UNSIGNED_BYTE_3_3_2)); + rb_define_const(module, "GL_UNSIGNED_BYTE", INT2NUM(GL_UNSIGNED_BYTE)); + rb_define_const(module, "GL_UNSIGNED_IDENTITY_NV", INT2NUM(GL_UNSIGNED_IDENTITY_NV)); + rb_define_const(module, "GL_UNSIGNED_INT_10_10_10_2_EXT", INT2NUM(GL_UNSIGNED_INT_10_10_10_2_EXT)); + rb_define_const(module, "GL_UNSIGNED_INT_10_10_10_2", INT2NUM(GL_UNSIGNED_INT_10_10_10_2)); + rb_define_const(module, "GL_UNSIGNED_INT_2_10_10_10_REV_EXT", INT2NUM(GL_UNSIGNED_INT_2_10_10_10_REV_EXT)); + rb_define_const(module, "GL_UNSIGNED_INT_2_10_10_10_REV", INT2NUM(GL_UNSIGNED_INT_2_10_10_10_REV)); + rb_define_const(module, "GL_UNSIGNED_INT_24_8_EXT", INT2NUM(GL_UNSIGNED_INT_24_8_EXT)); + rb_define_const(module, "GL_UNSIGNED_INT_24_8_NV", INT2NUM(GL_UNSIGNED_INT_24_8_NV)); + rb_define_const(module, "GL_UNSIGNED_INT_8_8_8_8_EXT", INT2NUM(GL_UNSIGNED_INT_8_8_8_8_EXT)); + rb_define_const(module, "GL_UNSIGNED_INT_8_8_8_8", INT2NUM(GL_UNSIGNED_INT_8_8_8_8)); + rb_define_const(module, "GL_UNSIGNED_INT_8_8_8_8_REV_EXT", INT2NUM(GL_UNSIGNED_INT_8_8_8_8_REV_EXT)); + rb_define_const(module, "GL_UNSIGNED_INT_8_8_8_8_REV", INT2NUM(GL_UNSIGNED_INT_8_8_8_8_REV)); + rb_define_const(module, "GL_UNSIGNED_INT_8_8_S8_S8_REV_NV", INT2NUM(GL_UNSIGNED_INT_8_8_S8_S8_REV_NV)); + rb_define_const(module, "GL_UNSIGNED_INT", INT2NUM(GL_UNSIGNED_INT)); + rb_define_const(module, "GL_UNSIGNED_INT_S8_S8_8_8_NV", INT2NUM(GL_UNSIGNED_INT_S8_S8_8_8_NV)); + rb_define_const(module, "GL_UNSIGNED_INVERT_NV", INT2NUM(GL_UNSIGNED_INVERT_NV)); + rb_define_const(module, "GL_UNSIGNED_NORMALIZED_ARB", INT2NUM(GL_UNSIGNED_NORMALIZED_ARB)); + rb_define_const(module, "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT", INT2NUM(GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT)); + rb_define_const(module, "GL_UNSIGNED_SHORT_1_5_5_5_REV", INT2NUM(GL_UNSIGNED_SHORT_1_5_5_5_REV)); + rb_define_const(module, "GL_UNSIGNED_SHORT_4_4_4_4_EXT", INT2NUM(GL_UNSIGNED_SHORT_4_4_4_4_EXT)); + rb_define_const(module, "GL_UNSIGNED_SHORT_4_4_4_4", INT2NUM(GL_UNSIGNED_SHORT_4_4_4_4)); + rb_define_const(module, "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT", INT2NUM(GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT)); + rb_define_const(module, "GL_UNSIGNED_SHORT_4_4_4_4_REV", INT2NUM(GL_UNSIGNED_SHORT_4_4_4_4_REV)); + rb_define_const(module, "GL_UNSIGNED_SHORT_5_5_5_1_EXT", INT2NUM(GL_UNSIGNED_SHORT_5_5_5_1_EXT)); + rb_define_const(module, "GL_UNSIGNED_SHORT_5_5_5_1", INT2NUM(GL_UNSIGNED_SHORT_5_5_5_1)); + rb_define_const(module, "GL_UNSIGNED_SHORT_5_6_5_EXT", INT2NUM(GL_UNSIGNED_SHORT_5_6_5_EXT)); + rb_define_const(module, "GL_UNSIGNED_SHORT_5_6_5", INT2NUM(GL_UNSIGNED_SHORT_5_6_5)); + rb_define_const(module, "GL_UNSIGNED_SHORT_5_6_5_REV_EXT", INT2NUM(GL_UNSIGNED_SHORT_5_6_5_REV_EXT)); + rb_define_const(module, "GL_UNSIGNED_SHORT_5_6_5_REV", INT2NUM(GL_UNSIGNED_SHORT_5_6_5_REV)); + rb_define_const(module, "GL_UNSIGNED_SHORT_8_8_APPLE", INT2NUM(GL_UNSIGNED_SHORT_8_8_APPLE)); + rb_define_const(module, "GL_UNSIGNED_SHORT_8_8_MESA", INT2NUM(GL_UNSIGNED_SHORT_8_8_MESA)); + rb_define_const(module, "GL_UNSIGNED_SHORT_8_8_REV_APPLE", INT2NUM(GL_UNSIGNED_SHORT_8_8_REV_APPLE)); + rb_define_const(module, "GL_UNSIGNED_SHORT_8_8_REV_MESA", INT2NUM(GL_UNSIGNED_SHORT_8_8_REV_MESA)); + rb_define_const(module, "GL_UNSIGNED_SHORT", INT2NUM(GL_UNSIGNED_SHORT)); + rb_define_const(module, "GL_UPPER_LEFT", INT2NUM(GL_UPPER_LEFT)); + rb_define_const(module, "GL_V2F", INT2NUM(GL_V2F)); + rb_define_const(module, "GL_V3F", INT2NUM(GL_V3F)); + rb_define_const(module, "GL_VALIDATE_STATUS", INT2NUM(GL_VALIDATE_STATUS)); + rb_define_const(module, "GL_VARIABLE_A_NV", INT2NUM(GL_VARIABLE_A_NV)); + rb_define_const(module, "GL_VARIABLE_B_NV", INT2NUM(GL_VARIABLE_B_NV)); + rb_define_const(module, "GL_VARIABLE_C_NV", INT2NUM(GL_VARIABLE_C_NV)); + rb_define_const(module, "GL_VARIABLE_D_NV", INT2NUM(GL_VARIABLE_D_NV)); + rb_define_const(module, "GL_VARIABLE_E_NV", INT2NUM(GL_VARIABLE_E_NV)); + rb_define_const(module, "GL_VARIABLE_F_NV", INT2NUM(GL_VARIABLE_F_NV)); + rb_define_const(module, "GL_VARIABLE_G_NV", INT2NUM(GL_VARIABLE_G_NV)); + rb_define_const(module, "GL_VARIANT_ARRAY_EXT", INT2NUM(GL_VARIANT_ARRAY_EXT)); + rb_define_const(module, "GL_VARIANT_ARRAY_POINTER_EXT", INT2NUM(GL_VARIANT_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_VARIANT_ARRAY_STRIDE_EXT", INT2NUM(GL_VARIANT_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_VARIANT_ARRAY_TYPE_EXT", INT2NUM(GL_VARIANT_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_VARIANT_DATATYPE_EXT", INT2NUM(GL_VARIANT_DATATYPE_EXT)); + rb_define_const(module, "GL_VARIANT_EXT", INT2NUM(GL_VARIANT_EXT)); + rb_define_const(module, "GL_VARIANT_VALUE_EXT", INT2NUM(GL_VARIANT_VALUE_EXT)); + rb_define_const(module, "GL_VECTOR_EXT", INT2NUM(GL_VECTOR_EXT)); + rb_define_const(module, "GL_VENDOR", INT2NUM(GL_VENDOR)); + rb_define_const(module, "GL_VERSION_1_1", INT2NUM(GL_VERSION_1_1)); + rb_define_const(module, "GL_VERSION_1_2", INT2NUM(GL_VERSION_1_2)); + rb_define_const(module, "GL_VERSION_1_3", INT2NUM(GL_VERSION_1_3)); + rb_define_const(module, "GL_VERSION_1_4", INT2NUM(GL_VERSION_1_4)); + rb_define_const(module, "GL_VERSION_1_5", INT2NUM(GL_VERSION_1_5)); + rb_define_const(module, "GL_VERSION", INT2NUM(GL_VERSION)); + rb_define_const(module, "GL_VERTEX23_BIT_PGI", INT2NUM(GL_VERTEX23_BIT_PGI)); + rb_define_const(module, "GL_VERTEX4_BIT_PGI", INT2NUM(GL_VERTEX4_BIT_PGI)); + rb_define_const(module, "GL_VERTEX_ARRAY_BINDING_APPLE", INT2NUM(GL_VERTEX_ARRAY_BINDING_APPLE)); + rb_define_const(module, "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_VERTEX_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_VERTEX_ARRAY_BUFFER_BINDING", INT2NUM(GL_VERTEX_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_VERTEX_ARRAY_COUNT_EXT", INT2NUM(GL_VERTEX_ARRAY_COUNT_EXT)); + rb_define_const(module, "GL_VERTEX_ARRAY_EXT", INT2NUM(GL_VERTEX_ARRAY_EXT)); + rb_define_const(module, "GL_VERTEX_ARRAY", INT2NUM(GL_VERTEX_ARRAY)); + rb_define_const(module, "GL_VERTEX_ARRAY_LIST_IBM", INT2NUM(GL_VERTEX_ARRAY_LIST_IBM)); + rb_define_const(module, "GL_VERTEX_ARRAY_LIST_STRIDE_IBM", INT2NUM(GL_VERTEX_ARRAY_LIST_STRIDE_IBM)); + rb_define_const(module, "GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL", INT2NUM(GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL)); + rb_define_const(module, "GL_VERTEX_ARRAY_POINTER_EXT", INT2NUM(GL_VERTEX_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_VERTEX_ARRAY_POINTER", INT2NUM(GL_VERTEX_ARRAY_POINTER)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_APPLE", INT2NUM(GL_VERTEX_ARRAY_RANGE_APPLE)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE", INT2NUM(GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_LENGTH_NV", INT2NUM(GL_VERTEX_ARRAY_RANGE_LENGTH_NV)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_NV", INT2NUM(GL_VERTEX_ARRAY_RANGE_NV)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_POINTER_APPLE", INT2NUM(GL_VERTEX_ARRAY_RANGE_POINTER_APPLE)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_POINTER_NV", INT2NUM(GL_VERTEX_ARRAY_RANGE_POINTER_NV)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_VALID_NV", INT2NUM(GL_VERTEX_ARRAY_RANGE_VALID_NV)); + rb_define_const(module, "GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV", INT2NUM(GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV)); + rb_define_const(module, "GL_VERTEX_ARRAY_SIZE_EXT", INT2NUM(GL_VERTEX_ARRAY_SIZE_EXT)); + rb_define_const(module, "GL_VERTEX_ARRAY_SIZE", INT2NUM(GL_VERTEX_ARRAY_SIZE)); + rb_define_const(module, "GL_VERTEX_ARRAY_STORAGE_HINT_APPLE", INT2NUM(GL_VERTEX_ARRAY_STORAGE_HINT_APPLE)); + rb_define_const(module, "GL_VERTEX_ARRAY_STRIDE_EXT", INT2NUM(GL_VERTEX_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_VERTEX_ARRAY_STRIDE", INT2NUM(GL_VERTEX_ARRAY_STRIDE)); + rb_define_const(module, "GL_VERTEX_ARRAY_TYPE_EXT", INT2NUM(GL_VERTEX_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_VERTEX_ARRAY_TYPE", INT2NUM(GL_VERTEX_ARRAY_TYPE)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY0_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY0_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY10_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY10_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY11_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY11_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY12_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY12_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY13_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY13_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY14_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY14_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY15_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY15_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY1_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY1_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY2_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY2_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY3_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY3_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY4_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY4_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY5_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY5_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY6_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY6_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY7_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY7_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY8_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY8_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY9_NV", INT2NUM(GL_VERTEX_ATTRIB_ARRAY9_NV)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_ENABLED", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_ENABLED)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_NORMALIZED)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_POINTER", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_POINTER)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_SIZE", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_SIZE)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_STRIDE", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_STRIDE)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB)); + rb_define_const(module, "GL_VERTEX_ATTRIB_ARRAY_TYPE", INT2NUM(GL_VERTEX_ATTRIB_ARRAY_TYPE)); + rb_define_const(module, "GL_VERTEX_BLEND_ARB", INT2NUM(GL_VERTEX_BLEND_ARB)); + rb_define_const(module, "GL_VERTEX_CONSISTENT_HINT_PGI", INT2NUM(GL_VERTEX_CONSISTENT_HINT_PGI)); + rb_define_const(module, "GL_VERTEX_DATA_HINT_PGI", INT2NUM(GL_VERTEX_DATA_HINT_PGI)); + rb_define_const(module, "GL_VERTEX_PRECLIP_HINT_SGIX", INT2NUM(GL_VERTEX_PRECLIP_HINT_SGIX)); + rb_define_const(module, "GL_VERTEX_PRECLIP_SGIX", INT2NUM(GL_VERTEX_PRECLIP_SGIX)); + rb_define_const(module, "GL_VERTEX_PROGRAM_ARB", INT2NUM(GL_VERTEX_PROGRAM_ARB)); + rb_define_const(module, "GL_VERTEX_PROGRAM_BINDING_NV", INT2NUM(GL_VERTEX_PROGRAM_BINDING_NV)); + rb_define_const(module, "GL_VERTEX_PROGRAM_NV", INT2NUM(GL_VERTEX_PROGRAM_NV)); + rb_define_const(module, "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", INT2NUM(GL_VERTEX_PROGRAM_POINT_SIZE_ARB)); + rb_define_const(module, "GL_VERTEX_PROGRAM_POINT_SIZE", INT2NUM(GL_VERTEX_PROGRAM_POINT_SIZE)); + rb_define_const(module, "GL_VERTEX_PROGRAM_POINT_SIZE_NV", INT2NUM(GL_VERTEX_PROGRAM_POINT_SIZE_NV)); + rb_define_const(module, "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", INT2NUM(GL_VERTEX_PROGRAM_TWO_SIDE_ARB)); + rb_define_const(module, "GL_VERTEX_PROGRAM_TWO_SIDE", INT2NUM(GL_VERTEX_PROGRAM_TWO_SIDE)); + rb_define_const(module, "GL_VERTEX_PROGRAM_TWO_SIDE_NV", INT2NUM(GL_VERTEX_PROGRAM_TWO_SIDE_NV)); + rb_define_const(module, "GL_VERTEX_SHADER_ARB", INT2NUM(GL_VERTEX_SHADER_ARB)); + rb_define_const(module, "GL_VERTEX_SHADER_BINDING_EXT", INT2NUM(GL_VERTEX_SHADER_BINDING_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER_EXT", INT2NUM(GL_VERTEX_SHADER_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER_INSTRUCTIONS_EXT", INT2NUM(GL_VERTEX_SHADER_INSTRUCTIONS_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER", INT2NUM(GL_VERTEX_SHADER)); + rb_define_const(module, "GL_VERTEX_SHADER_INVARIANTS_EXT", INT2NUM(GL_VERTEX_SHADER_INVARIANTS_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT", INT2NUM(GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER_LOCALS_EXT", INT2NUM(GL_VERTEX_SHADER_LOCALS_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER_OPTIMIZED_EXT", INT2NUM(GL_VERTEX_SHADER_OPTIMIZED_EXT)); + rb_define_const(module, "GL_VERTEX_SHADER_VARIANTS_EXT", INT2NUM(GL_VERTEX_SHADER_VARIANTS_EXT)); + rb_define_const(module, "GL_VERTEX_SOURCE_ATI", INT2NUM(GL_VERTEX_SOURCE_ATI)); + rb_define_const(module, "GL_VERTEX_STATE_PROGRAM_NV", INT2NUM(GL_VERTEX_STATE_PROGRAM_NV)); + rb_define_const(module, "GL_VERTEX_STREAM0_ATI", INT2NUM(GL_VERTEX_STREAM0_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM1_ATI", INT2NUM(GL_VERTEX_STREAM1_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM2_ATI", INT2NUM(GL_VERTEX_STREAM2_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM3_ATI", INT2NUM(GL_VERTEX_STREAM3_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM4_ATI", INT2NUM(GL_VERTEX_STREAM4_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM5_ATI", INT2NUM(GL_VERTEX_STREAM5_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM6_ATI", INT2NUM(GL_VERTEX_STREAM6_ATI)); + rb_define_const(module, "GL_VERTEX_STREAM7_ATI", INT2NUM(GL_VERTEX_STREAM7_ATI)); + rb_define_const(module, "GL_VERTEX_WEIGHT_ARRAY_EXT", INT2NUM(GL_VERTEX_WEIGHT_ARRAY_EXT)); + rb_define_const(module, "GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT", INT2NUM(GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT)); + rb_define_const(module, "GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT", INT2NUM(GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT)); + rb_define_const(module, "GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT", INT2NUM(GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT)); + rb_define_const(module, "GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT", INT2NUM(GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT)); + rb_define_const(module, "GL_VERTEX_WEIGHTING_EXT", INT2NUM(GL_VERTEX_WEIGHTING_EXT)); + rb_define_const(module, "GL_VIBRANCE_BIAS_NV", INT2NUM(GL_VIBRANCE_BIAS_NV)); + rb_define_const(module, "GL_VIBRANCE_SCALE_NV", INT2NUM(GL_VIBRANCE_SCALE_NV)); + rb_define_const(module, "GL_VIEWPORT_BIT", INT2NUM(GL_VIEWPORT_BIT)); + rb_define_const(module, "GL_VIEWPORT", INT2NUM(GL_VIEWPORT)); + rb_define_const(module, "GL_WEIGHT_ARRAY_ARB", INT2NUM(GL_WEIGHT_ARRAY_ARB)); + rb_define_const(module, "GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB", INT2NUM(GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB)); + rb_define_const(module, "GL_WEIGHT_ARRAY_BUFFER_BINDING", INT2NUM(GL_WEIGHT_ARRAY_BUFFER_BINDING)); + rb_define_const(module, "GL_WEIGHT_ARRAY_POINTER_ARB", INT2NUM(GL_WEIGHT_ARRAY_POINTER_ARB)); + rb_define_const(module, "GL_WEIGHT_ARRAY_SIZE_ARB", INT2NUM(GL_WEIGHT_ARRAY_SIZE_ARB)); + rb_define_const(module, "GL_WEIGHT_ARRAY_STRIDE_ARB", INT2NUM(GL_WEIGHT_ARRAY_STRIDE_ARB)); + rb_define_const(module, "GL_WEIGHT_ARRAY_TYPE_ARB", INT2NUM(GL_WEIGHT_ARRAY_TYPE_ARB)); + rb_define_const(module, "GL_WEIGHT_SUM_UNITY_ARB", INT2NUM(GL_WEIGHT_SUM_UNITY_ARB)); + rb_define_const(module, "GL_W_EXT", INT2NUM(GL_W_EXT)); + rb_define_const(module, "GL_WIDE_LINE_HINT_PGI", INT2NUM(GL_WIDE_LINE_HINT_PGI)); + rb_define_const(module, "GL_WRAP_BORDER_SUN", INT2NUM(GL_WRAP_BORDER_SUN)); + rb_define_const(module, "GL_WRITE_ONLY_ARB", INT2NUM(GL_WRITE_ONLY_ARB)); + rb_define_const(module, "GL_WRITE_ONLY", INT2NUM(GL_WRITE_ONLY)); + rb_define_const(module, "GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV", INT2NUM(GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV)); + rb_define_const(module, "GL_WRITE_PIXEL_DATA_RANGE_NV", INT2NUM(GL_WRITE_PIXEL_DATA_RANGE_NV)); + rb_define_const(module, "GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV", INT2NUM(GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV)); + rb_define_const(module, "GL_X_EXT", INT2NUM(GL_X_EXT)); + rb_define_const(module, "GL_XOR", INT2NUM(GL_XOR)); + rb_define_const(module, "GL_YCBCR_422_APPLE", INT2NUM(GL_YCBCR_422_APPLE)); + rb_define_const(module, "GL_YCBCR_MESA", INT2NUM(GL_YCBCR_MESA)); + rb_define_const(module, "GL_YCRCB_422_SGIX", INT2NUM(GL_YCRCB_422_SGIX)); + rb_define_const(module, "GL_YCRCB_444_SGIX", INT2NUM(GL_YCRCB_444_SGIX)); + rb_define_const(module, "GL_YCRCBA_SGIX", INT2NUM(GL_YCRCBA_SGIX)); + rb_define_const(module, "GL_YCRCB_SGIX", INT2NUM(GL_YCRCB_SGIX)); + rb_define_const(module, "GL_Y_EXT", INT2NUM(GL_Y_EXT)); + rb_define_const(module, "GL_ZERO_EXT", INT2NUM(GL_ZERO_EXT)); + rb_define_const(module, "GL_ZERO", INT2NUM(GL_ZERO)); + rb_define_const(module, "GL_Z_EXT", INT2NUM(GL_Z_EXT)); + rb_define_const(module, "GL_ZOOM_X", INT2NUM(GL_ZOOM_X)); + rb_define_const(module, "GL_ZOOM_Y", INT2NUM(GL_ZOOM_Y)); + /**/ + rb_define_const(module, "GL_ALL_CLIENT_ATTRIB_BITS", INT2NUM(GL_ALL_CLIENT_ATTRIB_BITS)); +} diff --git a/ruby/RubyOpenGL/gl/gl.c b/ruby/RubyOpenGL/gl/gl.c new file mode 100644 index 00000000..bfc71949 --- /dev/null +++ b/ruby/RubyOpenGL/gl/gl.c @@ -0,0 +1,87 @@ +/* + * Copyright (C) 1999 - 2005 Yoshi + * Copyright (C) 2006 John M. Gabriele + * + * This program is distributed under the terms of the MIT license. + * See the included MIT-LICENSE file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#elif defined WIN32 +#include +#include +#else +#include +#endif +#include "../common/common.h" + +#ifdef WIN32 +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif + +static VALUE module; + +void gl_init_enums(VALUE); +void gl_init_functions_1_0__1_1(VALUE); +void gl_init_functions_1_2(VALUE); +void gl_init_functions_1_3(VALUE); +void gl_init_functions_1_4(VALUE); +void gl_init_functions_1_5(VALUE); +void gl_init_functions_2_0(VALUE); +void gl_init_functions_2_1(VALUE); + +VALUE IsFunctionAvailable(char *name) +{ + GLvoid *ret; + ret = load_gl_function(name,0); /* won't raise */ + if (ret==NULL) + return Qfalse; + else + return Qtrue; +} + +static VALUE +IsAvailable(obj,arg1) +VALUE obj,arg1; +{ + char *name = RSTRING(arg1)->ptr; + Check_Type(arg1, T_STRING); + if (name && name[0] && (name[0]=='G' || name[0]=='W')) { /* GL_, GLX_, WGL_ extension */ + char buf[512+128]; + if (strlen(name)>(512)) + return Qfalse; + if (glGetString(GL_EXTENSIONS)==0) + return Qfalse; + + sprintf(buf,"Gl.glGetString(Gl::GL_EXTENSIONS).split(' ').include?('%s')", name); + return rb_eval_string(buf); + } else { /* function */ + return IsFunctionAvailable(name); + } +} + +DLLEXPORT void Init_gl() +{ + module = rb_define_module("Gl"); + gl_init_enums(module); + gl_init_functions_1_0__1_1(module); + gl_init_functions_1_2(module); + gl_init_functions_1_3(module); + gl_init_functions_1_4(module); + gl_init_functions_1_5(module); + gl_init_functions_2_0(module); + gl_init_functions_2_1(module); + + rb_define_module_function(module, "is_available?", IsAvailable, 1); +} diff --git a/ruby/RubyOpenGL/glu/extconf.rb b/ruby/RubyOpenGL/glu/extconf.rb new file mode 100644 index 00000000..011d09ad --- /dev/null +++ b/ruby/RubyOpenGL/glu/extconf.rb @@ -0,0 +1,20 @@ +require "mkmf" +$CFLAGS = "/MD /O2 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS" +#$CFLAGS = "/MD /Zi /EHsc /DWIN32 /DNDEBUG /D_WINDOWS" +#$LDFLAGS = "/Zi" + +libs = [ + "opengl32", + "glu32", +] + +libs.each {|lib| + unless have_library(lib) + puts "Unable to find #{lib}.lib!" + puts + exit + end +} + +create_makefile("glu") + diff --git a/ruby/RubyOpenGL/glu/glu.c b/ruby/RubyOpenGL/glu/glu.c new file mode 100644 index 00000000..07ddc075 --- /dev/null +++ b/ruby/RubyOpenGL/glu/glu.c @@ -0,0 +1,1637 @@ +/* + * Last edit by previous maintainer: + * 2003/10/25 15:25:05, yoshi + * + * Copyright (C) 1999 - 2005 Yoshi + * Copyright (C) 2006 John M. Gabriele + * + * This program is distributed under the terms of the MIT license. + * See the included COPYRIGHT file for the terms of this license. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#include +#elif defined WIN32 +#include +#include +#include +#else +#include +#include +#endif + +#include +#include "../common/common.h" + +#ifdef WIN32 +#define DLLEXPORT __declspec(dllexport) +typedef void (CALLBACK*(VOIDFUNC))(); +#else +#define DLLEXPORT +typedef void (*VOIDFUNC)(); +#endif + +#if defined(GLU_VERSION_1_2) +typedef GLUtesselator tesselatorObj; +#else /* GLU_VERSION_1_2 */ +typedef GLUtriangulatorObj tesselatorObj; +#endif /* !GLU_VERSION_1_2 */ + +#ifdef MESA +struct glu_MesaStack { + int len; + GLfloat **ptr; +}; + +static struct glu_MesaStack gms = {0, NULL}; +#endif + +struct nurbsdata { + GLUnurbsObj *nobj; +}; +struct tessdata { + tesselatorObj *tobj; + VALUE t_ref; +}; + +struct quaddata { + GLUquadricObj *qobj; +}; + +static VALUE cNurbs; +static VALUE cTess; +static VALUE cQuad; + +#define GetNURBS(obj, ndata) {\ + Data_Get_Struct(obj, struct nurbsdata, ndata);\ + if (ndata->nobj == NULL) rb_raise(rb_eRuntimeError, "Nurbs Object already deleted!");\ +} + +#define GetTESS(obj, tdata) {\ + Data_Get_Struct(obj, struct tessdata, tdata);\ + if (tdata->tobj == NULL) rb_raise(rb_eRuntimeError, "Triangulator Object already deleted!");\ +} + +#define GetQUAD(obj, qdata) {\ + Data_Get_Struct(obj, struct quaddata, qdata);\ + if (qdata->qobj == NULL) rb_raise(rb_eRuntimeError, "Quadric Object already deleted!");\ +} + +static ID callId; +static ID refId; + +/* + * GLU Implementation + */ + +/* + * Nurbs + */ +/* from nurbscrv.c */ +static int +get_curve_dim(type) +GLenum type; +{ + switch(type) + { + case GL_MAP1_VERTEX_3: return 3; + case GL_MAP1_VERTEX_4: return 4; + case GL_MAP1_INDEX: return 1; + case GL_MAP1_COLOR_4: return 4; + case GL_MAP1_NORMAL: return 3; + case GL_MAP1_TEXTURE_COORD_1: return 1; + case GL_MAP1_TEXTURE_COORD_2: return 2; + case GL_MAP1_TEXTURE_COORD_3: return 3; + case GL_MAP1_TEXTURE_COORD_4: return 4; + default: abort(); /* TODO: is this OK? */ + } + return 0; /*never get here*/ +} +/* from nurbssrf.c */ +static int +get_surface_dim(GLenum type) +{ + switch(type) + { + case GL_MAP2_VERTEX_3: return 3; + case GL_MAP2_VERTEX_4: return 4; + case GL_MAP2_INDEX: return 1; + case GL_MAP2_COLOR_4: return 4; + case GL_MAP2_NORMAL: return 3; + case GL_MAP2_TEXTURE_COORD_1: return 1; + case GL_MAP2_TEXTURE_COORD_2: return 2; + case GL_MAP2_TEXTURE_COORD_3: return 3; + case GL_MAP2_TEXTURE_COORD_4: return 4; + default: abort(); /* TODO: is this OK? */ + } + return 0; /*never get here*/ +} + +/* + * NURBS API + */ +static void +free_nurbs(ndata) +struct nurbsdata *ndata; +{ + if (ndata->nobj) gluDeleteNurbsRenderer(ndata->nobj); + ndata->nobj = NULL; +} +static VALUE +glu_NewNurbsRenderer(obj) +VALUE obj; +{ + VALUE ret; + struct nurbsdata *ndata; + ret = Data_Make_Struct(cNurbs, struct nurbsdata, 0, free_nurbs, ndata); + ndata->nobj = gluNewNurbsRenderer(); + return ret; +} +static VALUE +glu_DeleteNurbsRenderer(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + free_nurbs(ndata); + return Qnil; +} +static VALUE +glu_NurbsProperty(obj, arg1, arg2, arg3) +VALUE obj, arg1, arg2, arg3; +{ + struct nurbsdata *ndata; + GLenum property; + GLfloat value; + GetNURBS(arg1, ndata); + property = (GLenum)NUM2INT(arg2); + value = (GLfloat)NUM2DBL(arg3); + gluNurbsProperty(ndata->nobj, property, value); + return Qnil; +} +static VALUE +glu_GetNurbsProperty(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct nurbsdata *ndata; + GLenum property; + GLfloat value; + GetNURBS(arg1, ndata); + property = (GLenum)NUM2INT(arg2); + gluGetNurbsProperty(ndata->nobj, property, &value); + return rb_float_new(value); +} +static VALUE +glu_BeginCurve(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + gluBeginCurve(ndata->nobj); + return Qnil; +} +static VALUE +glu_EndCurve(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + gluEndCurve(ndata->nobj); + /* hack for Mesa 3.1 */ +#ifdef MESA + for (gms.len;gms.len>0;gms.len--) + free(gms.ptr[gms.len-1]); + free(gms.ptr); + gms.ptr = NULL; +#endif + return Qnil; +} +static VALUE +glu_NurbsCurve(argc,argv,obj) +int argc; +VALUE *argv; +VALUE obj; +{ + struct nurbsdata *ndata; + GLint uknot_count; + GLfloat *uknot; + GLint u_stride; + GLint uorder; + GLfloat *ctlarray; + GLenum type; + + VALUE args[7]; + GLfloat tmp[4]; + int i; + struct RArray *ary_ctl1; + + switch (rb_scan_args(argc, argv, "43", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6])) { + case 3: + uknot_count = RARRAY(rb_Array(args[1]))->len; + uknot = ALLOC_N(GLfloat, uknot_count); + ary2cflt(args[1], uknot, uknot_count); + ary_ctl1 = RARRAY(rb_Array(args[2])); + type = (GLenum)NUM2INT(args[3]); + u_stride = get_curve_dim(type); + uorder = ary_ctl1->len; + ctlarray = ALLOC_N(GLfloat, u_stride*uorder); + for (i = 0; i < ary_ctl1->len; i++) { + ary2cflt(ary_ctl1->ptr[i], tmp, 4); + memcpy(&ctlarray[i*u_stride], tmp, u_stride); + } + break; + case 7: + uknot_count = (GLint)NUM2INT(args[1]); + uknot = ALLOC_N(GLfloat, uknot_count); + ary2cflt(args[2], uknot, uknot_count); + u_stride = (GLint)NUM2INT(args[3]); + uorder = (GLint)NUM2INT(args[5]); + type = (GLenum)NUM2INT(args[6]); /* ---> line was missing */ + /* ctlarray = ALLOC_N(GLfloat, u_stride*uorder); //--->Mathematically incorrect */ + ctlarray = ALLOC_N(GLfloat, u_stride*(uknot_count-uorder)); + ary_ctl1 = RARRAY(rb_Array(args[4])); + if (TYPE(ary_ctl1->ptr[0]) == T_ARRAY) + for (i = 0; i < ary_ctl1->len; i++) { + ary2cflt(ary_ctl1->ptr[i], tmp, 4); + memcpy(&ctlarray[i*u_stride], tmp, u_stride); + } + else { + /* ary2cflt((VALUE)ary_ctl1, ctlarray, u_stride*uorder); //--->Mathematically incorrect */ + ary2cflt((VALUE)ary_ctl1, ctlarray, (uknot_count-uorder)*u_stride); + } + break; + default: + rb_raise(rb_eArgError, "arg num:%d",argc); + } + GetNURBS(args[0], ndata); + gluNurbsCurve(ndata->nobj, uknot_count, uknot, u_stride, ctlarray, uorder, type); +/* as of Mesa 3.1, Mesa assumes all data that following pointers + points to is valid at gluEndCurve. so, free them in + glu_EndCurve() */ +#ifdef MESA + gms.ptr = REALLOC_N(gms.ptr, GLfloat*, gms.len+=2); + gms.ptr[gms.len - 2] = uknot; + gms.ptr[gms.len - 1] = ctlarray; +#else + free(uknot); + free(ctlarray); +#endif + return Qnil; +} +static VALUE +glu_BeginSurface(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + gluBeginSurface(ndata->nobj); + return Qnil; +} +static VALUE +glu_EndSurface(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + gluEndSurface(ndata->nobj); + /* hack for Mesa 3.1 */ +#ifdef MESA + for(gms.len; gms.len>0; gms.len--) + free(gms.ptr[gms.len-1]); + free(gms.ptr); + gms.ptr = NULL; +#endif + return Qnil; +} + +static VALUE +glu_NurbsSurface(argc, argv, obj) +int argc; +VALUE *argv; +VALUE obj; +{ + struct nurbsdata *ndata; + GLint sknot_count; + GLfloat *sknot; + GLint tknot_count; + GLfloat *tknot; + GLint s_stride; + GLint t_stride; + GLfloat *ctlarray; + GLint sorder; + GLint torder; + GLenum type; + VALUE work_ary; + + VALUE args[11]; + struct RArray *ary_ctl1; + int type_len; + + switch (rb_scan_args(argc, argv, "56", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], &args[8], &args[9], &args[10])) { + case 5: + sknot_count = RARRAY(rb_Array(args[1]))->len; + sknot = ALLOC_N(GLfloat, sknot_count); + ary2cflt(args[1], sknot, sknot_count); + tknot_count = RARRAY(rb_Array(args[2]))->len; + tknot = ALLOC_N(GLfloat, tknot_count); + ary2cflt(args[2], tknot, tknot_count); + ary_ctl1 = RARRAY(rb_Array(args[3])); + sorder = ary_ctl1->len; + torder = RARRAY(rb_Array(ary_ctl1->ptr[0]))->len; + type = (GLenum)NUM2INT(args[4]); + t_stride = get_surface_dim(type); + s_stride = t_stride * sorder; + ctlarray = ALLOC_N(GLfloat, t_stride*s_stride); + work_ary = rb_ary_new(); + mary2ary((VALUE)ary_ctl1, work_ary); + ary2cflt(work_ary, ctlarray, t_stride*s_stride); + case 11: + sknot_count = (GLint)NUM2INT(args[1]); + sknot = ALLOC_N(GLfloat, sknot_count); + ary2cflt(args[2], sknot, sknot_count); + tknot_count = (GLint)NUM2INT(args[3]); + tknot = ALLOC_N(GLfloat, tknot_count); + ary2cflt(args[4], tknot, tknot_count); + s_stride = (GLint)NUM2INT(args[5]); + t_stride = (GLint)NUM2INT(args[6]); + sorder = (GLint)NUM2INT(args[8]); + torder = (GLint)NUM2INT(args[9]); + type = (GLint)NUM2INT(args[10]); + type_len = get_surface_dim(type); + /* ctlarray = ALLOC_N(GLfloat, sorder*torder*type_len); //--->Mathematically incorrect */ + ctlarray = ALLOC_N(GLfloat, (sknot_count-sorder)*(tknot_count-torder)*type_len); + ary_ctl1 = RARRAY(rb_Array(args[7])); + if (TYPE(ary_ctl1->ptr[0]) == T_ARRAY) { + work_ary = rb_ary_new(); + mary2ary((VALUE)ary_ctl1, work_ary); + /* ary2cflt(work_ary, ctlarray, sorder*torder*type_len); //--->Mathematically incorrect */ + ary2cflt(work_ary, ctlarray, (sknot_count-sorder)*(tknot_count-torder)*type_len); + } + else { + /* ary2cflt((VALUE)ary_ctl1, ctlarray, sorder*torder*type_len); //--->Mathematically incorrect */ + ary2cflt((VALUE)ary_ctl1, ctlarray, (sknot_count-sorder)*(tknot_count-torder)*type_len); + } + break; + default: + rb_raise(rb_eArgError, "arg num:%d",argc); + } + GetNURBS(args[0], ndata); + gluNurbsSurface(ndata->nobj, sknot_count, sknot, tknot_count, tknot, + s_stride, t_stride, ctlarray, sorder, torder, type); + +/* as of Mesa 3.1, Mesa assumes all data that following pointers + points to is valid at gluEndSurface. so, free them in + glu_EndSurface() */ +#ifdef MESA + gms.ptr = REALLOC_N(gms.ptr, GLfloat*, gms.len+=3); + gms.ptr[gms.len-3] = sknot; + gms.ptr[gms.len-2] = tknot; + gms.ptr[gms.len-1] = ctlarray; +#else + free(sknot); + free(tknot); + free(ctlarray); +#endif + return Qnil; +} +static VALUE +glu_BeginTrim(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + gluBeginTrim(ndata->nobj); + return Qnil; +} +static VALUE +glu_EndTrim(obj, arg1) +VALUE obj, arg1; +{ + struct nurbsdata *ndata; + GetNURBS(arg1, ndata); + gluEndTrim(ndata->nobj); + return Qnil; +} +static VALUE +glu_PwlCurve(argc, argv, obj) +int argc; +VALUE *argv; +VALUE obj; +{ + struct nurbsdata *ndata; + GLint count; + GLfloat *array; + GLint stride; + GLenum type; + + VALUE args[5]; + GLfloat tmp[3]; + struct RArray* ary_ctl1; + int i; + + switch (rb_scan_args(argc, argv, "32", &args[0], &args[1], &args[2], &args[3], &args[4])) { + case 3: + ary_ctl1 = RARRAY(rb_Array(args[2])); + count = ary_ctl1->len; + type = NUM2INT(args[2]); + stride = (type == GLU_MAP1_TRIM_2 ? 2 : 3); + array = ALLOC_N(GLfloat, count*stride); + for (i = 0; i < ary_ctl1->len; i++) { + ary2cflt(ary_ctl1->ptr[i], tmp, 3); + memcpy(&array[i*stride], tmp, stride); + } + break; + case 5: + count = NUM2INT(args[1]); + stride = NUM2INT(args[3]); + type = NUM2INT(args[4]); + array = ALLOC_N(GLfloat, count*stride); + ary_ctl1 = RARRAY(rb_Array(args[2])); + if (TYPE(ary_ctl1->ptr[0]) == T_ARRAY) + for (i = 0; i < ary_ctl1->len; i++) { + ary2cflt(ary_ctl1->ptr[i], tmp, 3); + memcpy(&array[i*stride], tmp, stride); + } + else + ary2cflt((VALUE)ary_ctl1, array, count*stride); + break; + default: + rb_raise(rb_eArgError, "arg num:%d",argc); + } + GetNURBS(args[0], ndata); + gluPwlCurve(ndata->nobj, count, array, stride, type); + free(array); + return Qnil; +} + +/* + * Tesselation API + */ +static VALUE t_current; +#define TESS_DATA 0 +#define TESS_BEGIN 1 +#define TESS_VERTEX 2 +#define TESS_END 3 +#define TESS_ERROR 4 +#define TESS_EDGE 5 +#if defined(GLU_VERSION_1_2) +# define TESS_OUTDATA 6 +# define TESS_COMBINE 7 +# define TESS_BEGIN_DATA 8 +# define TESS_VERTEX_DATA 9 +# define TESS_END_DATA 10 +# define TESS_ERROR_DATA 11 +# define TESS_EDGE_DATA 12 +# define TESS_COMBINE_DATA 13 +# define TESS_USERDATA 14 +# define REF_LAST 15 +#else /* !GLU_VERSION_1_2 */ +# define REF_LAST 6 +#endif /* GLU_VERSION_1_2 */ +static void +mark_tess(tdata) +struct tessdata* tdata; +{ + if (tdata->tobj) + rb_gc_mark(tdata->t_ref); +} +static void +free_tess(tdata) +struct tessdata *tdata; +{ + ID id; + VALUE call_key; + + if (tdata->tobj) { + gluDeleteTess(tdata->tobj); + } + tdata->t_ref = Qnil; + tdata->tobj = NULL; +} +static VALUE +glu_NewTess(obj) +VALUE obj; +{ + VALUE ret; + struct tessdata *tdata; + ret = Data_Make_Struct(cTess, struct tessdata, mark_tess, free_tess, tdata); + tdata->tobj = gluNewTess(); + tdata->t_ref = rb_ary_new2(REF_LAST); + return ret; +} +static VALUE +glu_DeleteTess(obj, arg1) +VALUE obj, arg1; +{ + struct tessdata *tdata; + GetTESS(arg1, tdata); + free_tess(tdata); + return Qnil; +} +void +t_begin(type) +GLenum type; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_BEGIN), callId, 1, INT2NUM(type)); + } +} +static void +t_edgeFlag(flag) +GLboolean flag; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE), callId, 1, INT2NUM(flag)); + } +} +static void +t_vertex(data) +void* data; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_VERTEX), callId, 1, data); + } +} +static void +t_end() +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_END), callId, 0); + } +} +static void +t_error(errorno) +GLenum errorno; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_ERROR), callId, 1, INT2NUM(errorno)); + } +} + +#if defined(GLU_VERSION_1_2) +static void +t_begin_data(type, user_data) +GLenum type; +void* user_data; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_BEGIN_DATA), callId, 2, INT2NUM(type), user_data); + } +} +static void +t_edgeFlag_data(flag, user_data) +GLboolean flag; +void* user_data; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_EDGE_DATA), callId, 2, INT2NUM(flag), user_data); + } +} +static void +t_vertex_data(data, user_data) +void* data; +void* user_data; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_VERTEX_DATA), callId, 2, data, user_data); + } +} +static void +t_end_data(user_data) +void* user_data; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_END_DATA), callId, 1, user_data); + } +} +static void +t_error_data(errorno, user_data) +GLenum errorno; +void* user_data; +{ + VALUE tess; + struct tessdata *tdata; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_funcall(rb_ary_entry(tdata->t_ref, TESS_ERROR_DATA), callId, 2, INT2NUM(errorno), user_data); + } +} +static void +t_combine(coords, vertex_data, weight, outData) +GLdouble coords[3]; +void* vertex_data[4]; +GLfloat weight[4]; +void** outData; +{ + VALUE tess; + struct tessdata *tdata; + VALUE rb_coord, rb_vertex_data, rb_weight; + int i; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_coord = rb_ary_new2(3); + for (i = 0; i < 3; i++) + rb_ary_store(rb_coord, i, rb_float_new(coords[i])); + rb_vertex_data = rb_ary_new2(4); + for (i = 0; i < 4; i++) + rb_ary_store(rb_vertex_data, i, (VALUE)vertex_data[i]); + rb_weight = rb_ary_new2(4); + for (i = 0; i < 4; i++) + rb_ary_store(rb_weight, i, rb_float_new(weight[i])); + *outData = (void*)rb_funcall(rb_ary_entry(tdata->t_ref, TESS_COMBINE), callId, 3, rb_coord, rb_vertex_data, rb_weight); + rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_OUTDATA), (VALUE)*outData); + } +} +static void +t_combine_data(coords, vertex_data, weight, outData, user_data) +GLdouble coords[3]; +void* vertex_data[4]; +GLfloat weight[4]; +void** outData; +void* user_data; +{ + VALUE tess; + struct tessdata *tdata; + VALUE rb_coord, rb_vertex_data, rb_weight; + int i; + tess = rb_ary_entry(t_current, -1); + if (tess != Qnil) { + GetTESS(tess, tdata); + rb_coord = rb_ary_new2(3); + for (i = 0; i < 3; i++) + rb_ary_store(rb_coord, i, rb_float_new(coords[i])); + rb_vertex_data = rb_ary_new2(4); + for (i = 0; i < 4; i++) + rb_ary_store(rb_vertex_data, i, (VALUE)vertex_data[i]); + rb_weight = rb_ary_new2(4); + for (i = 0; i < 4; i++) + rb_ary_store(rb_weight, i, rb_float_new(weight[i])); + *outData = (void*)rb_funcall(rb_ary_entry(tdata->t_ref, TESS_COMBINE_DATA), callId, 4, rb_coord, rb_vertex_data, rb_weight, (VALUE)user_data); + rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_OUTDATA), (VALUE)*outData); + } +} +static VALUE +glu_TessProperty(obj, arg1, arg2, arg3) +VALUE obj, arg1, arg2; +{ + struct tessdata* tdata; + GLenum property; + GLdouble value; + GetTESS(arg1, tdata); + property = (GLenum)NUM2INT(arg2); + value = (GLdouble)NUM2DBL(arg3); + gluTessProperty(tdata->tobj, property, value); + return Qnil; +} +static VALUE +glu_GetTessProperty(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct tessdata* tdata; + GLenum property; + GLdouble value; + GetTESS(arg1, tdata); + property = (GLenum)NUM2INT(arg2); + gluGetTessProperty(tdata->tobj, property, &value); + return rb_float_new(value); +} +static VALUE +glu_TessNormal(obj, arg1, arg2, arg3, arg4) +VALUE obj, arg1, arg2, arg3, arg4; +{ + struct tessdata* tdata; + GLdouble x, y, z; + GetTESS(arg1, tdata); + x = (GLdouble)NUM2DBL(arg2); + y = (GLdouble)NUM2DBL(arg3); + z = (GLdouble)NUM2DBL(arg4); + gluTessNormal(tdata->tobj, x, y, z); + return Qnil; +} +static VALUE +glu_TessBeginPolygon(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct tessdata* tdata; + GetTESS(arg1, tdata); + rb_ary_store(tdata->t_ref, TESS_USERDATA, arg2); + rb_ary_store(tdata->t_ref, TESS_OUTDATA, rb_ary_new()); + rb_ary_store(tdata->t_ref, TESS_DATA, rb_ary_new()); + rb_ary_push(t_current, arg1); + gluTessBeginPolygon(tdata->tobj, (void*)arg2); + return Qnil; +} +static VALUE +glu_TessEndPolygon(obj, arg1) +VALUE obj, arg1; +{ + struct tessdata* tdata; + GetTESS(arg1, tdata); + gluTessEndPolygon(tdata->tobj); + rb_ary_store(tdata->t_ref, TESS_USERDATA, Qnil); + rb_ary_store(tdata->t_ref, TESS_OUTDATA, Qnil); + rb_ary_store(tdata->t_ref, TESS_DATA, Qnil); + rb_ary_pop(t_current); + return Qnil; +} +static VALUE +glu_TessBeginContour(obj, arg1) +VALUE obj, arg1; +{ + struct tessdata* tdata; + GetTESS(arg1, tdata); + gluTessBeginContour(tdata->tobj); + return Qnil; +} +static VALUE +glu_TessEndContour(obj, arg1) +{ + struct tessdata* tdata; + GetTESS(arg1, tdata); + gluTessEndContour(tdata->tobj); + return Qnil; +} +#endif /* GLU_VERSION_1_2 */ + +static VALUE +glu_TessCallback(obj, arg1, arg2, arg3) +VALUE obj, arg1, arg2, arg3; +{ + struct tessdata* tdata; + GLenum type; + ID id; + GetTESS(arg1, tdata); + type = (GLenum)NUM2INT(arg2); + id = rb_intern("[]="); + if (!rb_obj_is_kind_of(arg3,rb_cProc) && NIL_P(arg3)) + rb_raise(rb_eTypeError, "GLU.TessCallback needs Proc Object:%s",rb_class2name(CLASS_OF(arg3))); + + switch (type) { +#if defined(GLU_VERSION_1_2) + case GLU_TESS_BEGIN: +#else + case GLU_BEGIN: +#endif + rb_ary_store(tdata->t_ref, TESS_BEGIN, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_begin)); + break; +#if defined(GLU_VERSION_1_2) + case GLU_TESS_EDGE_FLAG: +#else + case GLU_EDGE_FLAG: +#endif + rb_ary_store(tdata->t_ref, TESS_EDGE, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_edgeFlag); + break; +#if defined(GLU_VERSION_1_2) + case GLU_TESS_VERTEX: +#else + case GLU_VERTEX: +#endif + rb_ary_store(tdata->t_ref, TESS_VERTEX, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_vertex); + break; +#if defined(GLU_VERSION_1_2) + case GLU_TESS_END: +#else + case GLU_END: +#endif + rb_ary_store(tdata->t_ref, TESS_END, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_end); + break; +#if defined(GLU_VERSION_1_2) + case GLU_TESS_ERROR: +#else + case GLU_ERROR: +#endif + rb_ary_store(tdata->t_ref, TESS_ERROR, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)t_error); + break; +#if defined(GLU_VERSION_1_2) + case GLU_TESS_COMBINE: + rb_ary_store(tdata->t_ref, TESS_COMBINE, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_combine)); + break; + case GLU_TESS_BEGIN_DATA: + rb_ary_store(tdata->t_ref, TESS_BEGIN_DATA, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_begin_data)); + break; + case GLU_TESS_VERTEX_DATA: + rb_ary_store(tdata->t_ref, TESS_VERTEX_DATA, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_vertex_data)); + break; + case GLU_TESS_END_DATA: + rb_ary_store(tdata->t_ref, TESS_END_DATA, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_end_data)); + break; + case GLU_TESS_ERROR_DATA: + rb_ary_store(tdata->t_ref, TESS_ERROR_DATA, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_error_data)); + break; + case GLU_TESS_EDGE_FLAG_DATA: + rb_ary_store(tdata->t_ref, TESS_EDGE_DATA, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_edgeFlag_data)); + break; + case GLU_TESS_COMBINE_DATA: + rb_ary_store(tdata->t_ref, TESS_COMBINE_DATA, arg3); + if (NIL_P(arg3)) + gluTessCallback(tdata->tobj, type, NULL); + else + gluTessCallback(tdata->tobj, type, (VOIDFUNC)(t_combine_data)); + break; +#endif /* GLU_VERSION_1_2 */ + } + return Qnil; +} +static VALUE +glu_BeginPolygon(obj, arg1) +VALUE obj, arg1; +{ + struct tessdata* tdata; + GetTESS(arg1, tdata); + rb_ary_store(tdata->t_ref, TESS_DATA, rb_ary_new()); + rb_ary_push(t_current, arg1); + gluBeginPolygon(tdata->tobj); + return Qnil; +} +static VALUE +glu_TessVertex(obj, arg1, arg2, arg3) +VALUE obj, arg1, arg2, arg3; +{ + struct tessdata* tdata; + GLdouble v[3]; + VALUE call_key; + ID id; + GetTESS(arg1, tdata); + rb_ary_push(rb_ary_entry(tdata->t_ref, TESS_DATA), arg3); + ary2cdbl(arg2, v, 3); + gluTessVertex(tdata->tobj, v,(void *)arg3); + return Qnil; +} +static VALUE +glu_NextContour(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct tessdata* tdata; + GLenum type; + GetTESS(arg1, tdata); + type = (GLenum)NUM2INT(arg2); + gluNextContour(tdata->tobj, type); + return Qnil; +} +static VALUE +glu_EndPolygon(obj, arg1) +VALUE obj, arg1; +{ + struct tessdata* tdata; + GetTESS(arg1, tdata); + gluEndPolygon(tdata->tobj); + rb_ary_store(tdata->t_ref, TESS_DATA, Qnil); + rb_ary_pop(t_current); + return Qnil; +} + +/* + * Quadric API + */ +static void +free_quad(qdata) +struct quaddata *qdata; +{ + if (qdata->qobj) gluDeleteQuadric(qdata->qobj); + qdata->qobj = NULL; +} +static VALUE +glu_NewQuadric(obj) +VALUE obj; +{ + VALUE ret; + struct quaddata *qdata; + ret = Data_Make_Struct(cQuad, struct quaddata, 0, free_quad, qdata); + qdata->qobj = gluNewQuadric(); + return ret; +} +static VALUE +glu_DeleteQuadric(obj, arg1) +VALUE obj, arg1; +{ + struct quaddata *qdata; + GetQUAD(arg1, qdata); + free_quad(qdata); + return Qnil; +} +static VALUE +glu_QuadricNormals(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct quaddata* qdata; + GLenum normals; + GetQUAD(arg1, qdata); + normals = (GLenum)NUM2INT(arg2); + gluQuadricNormals(qdata->qobj, normals); + return Qnil; +} +static VALUE +glu_QuadricTexture(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct quaddata* qdata; + GLboolean textureCoords; + GetQUAD(arg1, qdata); + textureCoords = (GLboolean)NUM2INT(arg2); + gluQuadricTexture(qdata->qobj, textureCoords); + return Qnil; +} +static VALUE +glu_QuadricOrientation(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct quaddata* qdata; + GLenum orientation; + GetQUAD(arg1, qdata); + orientation = (GLenum)NUM2INT(arg2); + gluQuadricOrientation(qdata->qobj, orientation); + return Qnil; +} +static VALUE +glu_QuadricDrawStyle(obj, arg1, arg2) +VALUE obj, arg1, arg2; +{ + struct quaddata* qdata; + GLenum drawStyle; + GetQUAD(arg1, qdata); + drawStyle = (GLenum)NUM2INT(arg2); + gluQuadricDrawStyle(qdata->qobj, drawStyle); + return Qnil; +} +static VALUE +glu_Cylinder(obj, arg1, arg2, arg3, arg4, arg5, arg6) +VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6; +{ + struct quaddata* qdata; + GLdouble baseRadius; + GLdouble topRadius; + GLdouble height; + GLint slices; + GLint stacks; + + GetQUAD(arg1, qdata); + baseRadius = (GLdouble)NUM2DBL(arg2); + topRadius = (GLdouble)NUM2DBL(arg3); + height = (GLdouble)NUM2DBL(arg4); + slices = (GLint)NUM2INT(arg5); + stacks = (GLint)NUM2INT(arg6); + + gluCylinder(qdata->qobj, baseRadius, topRadius, height, slices, stacks); + return Qnil; +} +static VALUE +glu_Disk(obj, arg1, arg2, arg3, arg4, arg5) +VALUE obj, arg1, arg2, arg3, arg4, arg5; +{ + struct quaddata* qdata; + GLdouble innerRadius; + GLdouble outerRadius; + GLint slices; + GLint loops; + + GetQUAD(arg1, qdata); + innerRadius = (GLdouble)NUM2DBL(arg2); + outerRadius = (GLdouble)NUM2DBL(arg3); + slices = (GLint)NUM2INT(arg4); + loops = (GLint)NUM2INT(arg5); + + gluDisk(qdata->qobj, innerRadius, outerRadius, slices, loops); + return Qnil; +} +static VALUE +glu_PartialDisk(obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7; +{ + struct quaddata* qdata; + GLdouble innerRadius; + GLdouble outerRadius; + GLint slices; + GLint loops; + GLdouble startAngle; + GLdouble sweepAngle; + + GetQUAD(arg1, qdata); + innerRadius = (GLdouble)NUM2DBL(arg2); + outerRadius = (GLdouble)NUM2DBL(arg3); + slices = (GLint)NUM2INT(arg4); + loops = (GLint)NUM2INT(arg5); + startAngle = (GLdouble)NUM2DBL(arg6); + sweepAngle = (GLdouble)NUM2DBL(arg7); + + gluPartialDisk(qdata->qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle); + return Qnil; +} +static VALUE +glu_Sphere(obj, arg1, arg2, arg3, arg4) +VALUE obj, arg1, arg2, arg3, arg4; +{ + struct quaddata* qdata; + GLdouble radius; + GLint slices; + GLint stacks; + + GetQUAD(arg1, qdata); + radius = (GLdouble)NUM2DBL(arg2); + slices = (GLint)NUM2INT(arg3); + stacks = (GLint)NUM2INT(arg4); + + gluSphere(qdata->qobj, radius, slices, stacks); + return Qnil; +} +static VALUE +glu_LookAt(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) +VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9; +{ + GLdouble eyex; + GLdouble eyey; + GLdouble eyez; + GLdouble centerx; + GLdouble centery; + GLdouble centerz; + GLdouble upx; + GLdouble upy; + GLdouble upz; + eyex = (GLdouble)NUM2DBL(arg1); + eyey = (GLdouble)NUM2DBL(arg2); + eyez = (GLdouble)NUM2DBL(arg3); + centerx = (GLdouble)NUM2DBL(arg4); + centery = (GLdouble)NUM2DBL(arg5); + centerz = (GLdouble)NUM2DBL(arg6); + upx = (GLdouble)NUM2DBL(arg7); + upy = (GLdouble)NUM2DBL(arg8); + upz = (GLdouble)NUM2DBL(arg9); + gluLookAt( eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz ); + return Qnil; +} +static VALUE +glu_Ortho2D(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble left; + GLdouble right; + GLdouble bottom; + GLdouble top; + left = (GLdouble)NUM2DBL(arg1); + right = (GLdouble)NUM2DBL(arg2); + bottom = (GLdouble)NUM2DBL(arg3); + top = (GLdouble)NUM2DBL(arg4); + gluOrtho2D(left,right,bottom,top); + return Qnil; +} +static VALUE +glu_Perspective(obj,arg1,arg2,arg3,arg4) +VALUE obj,arg1,arg2,arg3,arg4; +{ + GLdouble fovy; + GLdouble aspect; + GLdouble zNear; + GLdouble zFar; + fovy = (GLdouble)NUM2DBL(arg1); + aspect = (GLdouble)NUM2DBL(arg2); + zNear = (GLdouble)NUM2DBL(arg3); + zFar = (GLdouble)NUM2DBL(arg4); + gluPerspective(fovy,aspect,zNear,zFar); + return Qnil; +} +static VALUE +glu_PickMatrix(argc,argv,obj) +int argc; +VALUE* argv; +VALUE obj; +{ + GLdouble x; + GLdouble y; + GLdouble width; + GLdouble height; + GLint viewport[4]; + + VALUE args[5]; + + switch (rb_scan_args(argc, argv, "23", &args[0], &args[1], &args[2], &args[3], &args[4])) { + case 2: + width = 5.0f; + height = 5.0f; + glGetIntegerv(GL_VIEWPORT, viewport); + break; + case 4: + width = (GLdouble)NUM2DBL(args[2]); + height = (GLdouble)NUM2DBL(args[3]); + glGetIntegerv(GL_VIEWPORT, viewport); + break; + case 5: + width = (GLdouble)NUM2DBL(args[2]); + height = (GLdouble)NUM2DBL(args[3]); + ary2cint(args[4], viewport, 4); + break; + default: + rb_raise(rb_eArgError, "GLU.PickMatrix args len:%d",argc); + } + x = (GLdouble)NUM2DBL(args[0]); + y = (GLdouble)NUM2DBL(args[1]); + gluPickMatrix(x, y, width, height, viewport); + return Qnil; +} + +static VALUE +glu_Project(argc,argv,obj) +int argc; +VALUE* argv; +VALUE obj; +{ + GLdouble ox; + GLdouble oy; + GLdouble oz; + GLdouble mdl_mtx[4*4]; + GLdouble prj_mtx[4*4]; + GLint vport[4]; + GLdouble wx; + GLdouble wy; + GLdouble wz; + + VALUE args[6]; + VALUE ret; + + switch (rb_scan_args(argc, argv, "33", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5])) { + case 3: + glGetDoublev(GL_MODELVIEW_MATRIX, mdl_mtx); + glGetDoublev(GL_PROJECTION_MATRIX, prj_mtx); + glGetIntegerv(GL_VIEWPORT, vport); + break; + case 6: + ary2cmat4x4dbl(args[3], mdl_mtx); + ary2cmat4x4dbl(args[4], prj_mtx); + ary2cint(args[5], vport, 4); + break; + default: + rb_raise(rb_eArgError, "GLU.Project args len:%d",argc); + } + ox = (GLdouble)NUM2DBL(args[0]); + oy = (GLdouble)NUM2DBL(args[1]); + oz = (GLdouble)NUM2DBL(args[2]); + + if (gluProject(ox, oy, oz, mdl_mtx, prj_mtx, vport, &wx, &wy, &wz) + == GL_TRUE) { + ret = rb_ary_new3(3, rb_float_new(wx), rb_float_new(wy), rb_float_new(wz)); + return ret; + } + else + return Qnil; +} +static VALUE +glu_UnProject(argc,argv,obj) +int argc; +VALUE* argv; +VALUE obj; +{ + GLdouble wx; + GLdouble wy; + GLdouble wz; + GLdouble mdl_mtx[4*4]; + GLdouble prj_mtx[4*4]; + GLint vport[4]; + GLdouble ox; + GLdouble oy; + GLdouble oz; + + VALUE args[6]; + VALUE ret; + + switch (rb_scan_args(argc, argv, "33", &args[0], &args[1], &args[2], &args[3], &args[4], &args[5])) { + case 3: + glGetDoublev(GL_MODELVIEW_MATRIX, mdl_mtx); + glGetDoublev(GL_PROJECTION_MATRIX, prj_mtx); + glGetIntegerv(GL_VIEWPORT, vport); + break; + case 6: + ary2cmat4x4dbl(args[3], mdl_mtx); + ary2cmat4x4dbl(args[4], prj_mtx); + ary2cint(args[5], vport, 4); + break; + default: + rb_raise(rb_eArgError, "GLU.UnProject args len:%d",argc); + } + wx = (GLdouble)NUM2DBL(args[0]); + wy = (GLdouble)NUM2DBL(args[1]); + wz = (GLdouble)NUM2DBL(args[2]); + + if (gluUnProject(wx, wy, wz, mdl_mtx, prj_mtx, vport, &ox, &oy, &oz) + == GL_TRUE) { + ret = rb_ary_new3(3, rb_float_new(ox), rb_float_new(oy), rb_float_new(oz)); + return ret; + } + else + return Qnil; +} + +static VALUE +glu_Build2DMipmaps(obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7) +VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7; +{ + GLenum target; + GLint components; + GLint width; + GLint height; + GLenum format; + GLenum type; + void* data; + + int type_size; + int format_size; + int size; + + target = (GLenum)NUM2INT(arg1); + components = (GLint)NUM2INT(arg2); + width = (GLint)NUM2INT(arg3); + height = (GLint)NUM2INT(arg4); + format = (GLenum)NUM2INT(arg5); + type = (GLenum)NUM2INT(arg6); + if (TYPE(arg7) == T_STRING) { + type_size = gltype_size(type) / 8; + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + size = type_size*format_size*height*width; + if (RSTRING(arg7)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg7)->len); + data = RSTRING(arg7)->ptr; + } else + rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg7)); + return INT2NUM(gluBuild2DMipmaps(target, components, width, height, format, type, data)); +} + +static VALUE +glu_ScaleImage(obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +VALUE obj, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; +{ + GLenum format; + GLint widthin; + GLint heightin; + GLenum typein; + void* datain; + GLint widthout; + GLint heightout; + GLenum typeout; + int type_size; + int format_size; + int size; + VALUE ret; + + format = (GLenum)NUM2INT(arg1); + widthin = (GLint)NUM2INT(arg2); + heightin = (GLint)NUM2INT(arg3); + typein = (GLenum)NUM2INT(arg4); + if (TYPE(arg5) == T_STRING) { + type_size = gltype_size(typein) / 8; + format_size = glformat_size(format); + if (type_size == -1 || format_size == -1) + return Qnil; + size = type_size*format_size*heightin*widthin; + if (RSTRING(arg5)->len < size) + rb_raise(rb_eArgError, "string length:%d",RSTRING(arg5)->len); + datain = RSTRING(arg5)->ptr; + } else + rb_raise(rb_eTypeError, "type mismatch:%s",rb_class2name(arg5)); + + widthout = (GLint)NUM2INT(arg6); + heightout = (GLint)NUM2INT(arg7); + typeout = (GLenum)NUM2INT(arg8); + type_size = gltype_size(typeout) / 8; + ret = allocate_buffer_with_string(widthout*heightout*format_size*type_size); + gluScaleImage(format, widthin, heightin, typein, datain, + widthout, heightout, typeout, (GLvoid*)RSTRING(ret)->ptr); + return ret; +} + +static VALUE +glu_ErrorString(obj, arg1) +VALUE obj, arg1; +{ + GLenum errorCode; + GLubyte* error; + errorCode = (GLenum)NUM2INT(arg1); + error = (GLubyte*)gluErrorString(errorCode); + if (error) + return rb_str_new2(error); + else + return Qnil; +} +#if defined(GLU_VERSION_1_1) +static VALUE +glu_GetString(obj, arg1) +VALUE obj, arg1; +{ + GLenum name; + GLubyte* str; + name = (GLenum)NUM2INT(arg1); + str = (GLubyte*)gluGetString(name); + if (str) + return rb_str_new2(str); + else + return Qnil; +} +#endif + +static VALUE module; + +#ifndef GLU_BEGIN +#define GLU_BEGIN 100100 +#endif +#ifndef GLU_VERTEX +#define GLU_VERTEX 100101 +#endif +#ifndef GLU_END +#define GLU_END 100102 +#endif +#ifndef GLU_EDGE_FLAG +#define GLU_EDGE_FLAG 100104 +#endif +#ifndef GLU_CW +#define GLU_CW 100120 +#endif +#ifndef GLU_CCW +#define GLU_CCW 100121 +#endif +#ifndef GLU_INTERIOR +#define GLU_INTERIOR 100122 +#endif +#ifndef GLU_EXTERIOR +#define GLU_EXTERIOR 100123 +#endif +#ifndef GLU_UNKNOWN +#define GLU_UNKNOWN 100124 +#endif +#ifndef GLU_ERROR +#define GLU_ERROR 100103 +#endif + +DLLEXPORT void Init_glu() +{ + callId = rb_intern("call"); + refId = rb_intern("[]"); + module = rb_define_module("Glu"); + rb_define_module_function(module, "gluNewNurbsRenderer", glu_NewNurbsRenderer, 0); + rb_define_module_function(module, "gluDeleteNurbsRenderer", glu_DeleteNurbsRenderer, 1); + rb_define_module_function(module, "gluNurbsProperty", glu_NurbsProperty, 3); + rb_define_module_function(module, "gluGetNurbsProperty", glu_GetNurbsProperty, 2); + rb_define_module_function(module, "gluBeginCurve", glu_BeginCurve, 1); + rb_define_module_function(module, "gluEndCurve", glu_EndCurve, 1); + rb_define_module_function(module, "gluNurbsCurve", glu_NurbsCurve, -1); + rb_define_module_function(module, "gluBeginSurface", glu_BeginSurface, 1); + rb_define_module_function(module, "gluEndSurface", glu_EndSurface, 1); + rb_define_module_function(module, "gluNurbsSurface", glu_NurbsSurface, -1); + rb_define_module_function(module, "gluBeginTrim", glu_BeginTrim, 1); + rb_define_module_function(module, "gluEndTrim", glu_EndTrim, 1); + rb_define_module_function(module, "gluPwlCurve", glu_PwlCurve, -1); + rb_define_module_function(module, "gluNewTess", glu_NewTess, 0); + rb_define_module_function(module, "gluDeleteTess", glu_DeleteTess, 1); + rb_define_module_function(module, "gluTessCallback", glu_TessCallback, 3); + rb_define_module_function(module, "gluBeginPolygon", glu_BeginPolygon, 1); + rb_define_module_function(module, "gluTessVertex", glu_TessVertex, 3); + rb_define_module_function(module, "gluNextContour", glu_NextContour, 2); + rb_define_module_function(module, "gluEndPolygon", glu_EndPolygon, 1); +#if defined(GLU_VERSION_1_2) + rb_define_module_function(module, "gluTessBeginPolygon", glu_TessBeginPolygon, 2); + rb_define_module_function(module, "gluTessBeginContour", glu_TessBeginContour, 1); + rb_define_module_function(module, "gluTessEndContour", glu_TessEndContour, 1); + rb_define_module_function(module, "gluTessEndPolygon", glu_TessEndPolygon, 1); + rb_define_module_function(module, "gluTessProperty", glu_TessProperty, 3); + rb_define_module_function(module, "gluTessNormal", glu_TessNormal, 4); + rb_define_module_function(module, "gluGetTessProperty", glu_GetTessProperty, 2); +#endif /* GLU_VERSION_1_2 */ + rb_define_module_function(module, "gluNewQuadric", glu_NewQuadric, 0); + rb_define_module_function(module, "gluDeleteQuadric", glu_DeleteQuadric, 1); + rb_define_module_function(module, "gluQuadricNormals", glu_QuadricNormals, 2); + rb_define_module_function(module, "gluQuadricTexture", glu_QuadricTexture, 2); + rb_define_module_function(module, "gluQuadricOrientation", glu_QuadricOrientation, 2); + rb_define_module_function(module, "gluQuadricDrawStyle", glu_QuadricDrawStyle, 2); + rb_define_module_function(module, "gluCylinder", glu_Cylinder, 6); + rb_define_module_function(module, "gluDisk", glu_Disk, 5); + rb_define_module_function(module, "gluPartialDisk", glu_PartialDisk, 7); + rb_define_module_function(module, "gluSphere", glu_Sphere, 4); + + rb_define_module_function(module, "gluLookAt", glu_LookAt, 9); + rb_define_module_function(module, "gluOrtho2D", glu_Ortho2D, 4); + rb_define_module_function(module, "gluPerspective", glu_Perspective, 4); + rb_define_module_function(module, "gluPickMatrix", glu_PickMatrix, -1); + rb_define_module_function(module, "gluProject", glu_Project, -1); + rb_define_module_function(module, "gluUnProject", glu_UnProject, -1); + rb_define_module_function(module, "gluBuild2DMipmaps", glu_Build2DMipmaps, 7); + rb_define_module_function(module, "gluScaleImage", glu_ScaleImage, 8); + rb_define_module_function(module, "gluErrorString", glu_ErrorString, 1); +#if defined(GLU_VERSION_1_1) + rb_define_module_function(module, "gluGetString", glu_GetString, 1); +#endif + + rb_define_const(module, "GLU_SMOOTH", INT2NUM(GLU_SMOOTH)); + rb_define_const(module, "GLU_FLAT", INT2NUM(GLU_FLAT)); + rb_define_const(module, "GLU_NONE", INT2NUM(GLU_NONE)); + rb_define_const(module, "GLU_POINT", INT2NUM(GLU_POINT)); + rb_define_const(module, "GLU_LINE", INT2NUM(GLU_LINE)); + rb_define_const(module, "GLU_FILL", INT2NUM(GLU_FILL)); + rb_define_const(module, "GLU_SILHOUETTE", INT2NUM(GLU_SILHOUETTE)); + rb_define_const(module, "GLU_OUTSIDE", INT2NUM(GLU_OUTSIDE)); + rb_define_const(module, "GLU_INSIDE", INT2NUM(GLU_INSIDE)); +#if defined(GLU_VERSION_1_2) + rb_define_const(module, "GLU_TESS_BEGIN", INT2NUM(GLU_TESS_BEGIN)); + rb_define_const(module, "GLU_TESS_VERTEX", INT2NUM(GLU_TESS_VERTEX)); + rb_define_const(module, "GLU_TESS_END", INT2NUM(GLU_TESS_END)); + rb_define_const(module, "GLU_TESS_ERROR", INT2NUM(GLU_TESS_ERROR)); + rb_define_const(module, "GLU_TESS_EDGE_FLAG", INT2NUM(GLU_TESS_EDGE_FLAG)); + rb_define_const(module, "GLU_TESS_COMBINE", INT2NUM(GLU_TESS_COMBINE)); + + rb_define_const(module, "GLU_TESS_BEGIN_DATA", INT2NUM(GLU_TESS_BEGIN_DATA)); + rb_define_const(module, "GLU_TESS_VERTEX_DATA", INT2NUM(GLU_TESS_VERTEX_DATA)); + rb_define_const(module, "GLU_TESS_END_DATA", INT2NUM(GLU_TESS_END_DATA)); + rb_define_const(module, "GLU_TESS_ERROR_DATA", INT2NUM(GLU_TESS_ERROR_DATA)); + rb_define_const(module, "GLU_TESS_EDGE_FLAG_DATA", INT2NUM(GLU_TESS_EDGE_FLAG_DATA)); + rb_define_const(module, "GLU_TESS_COMBINE_DATA", INT2NUM(GLU_TESS_COMBINE_DATA)); + + /* Winding rules */ + rb_define_const(module, "GLU_TESS_WINDING_ODD", INT2NUM(GLU_TESS_WINDING_ODD)); + rb_define_const(module, "GLU_TESS_WINDING_NONZERO", INT2NUM(GLU_TESS_WINDING_NONZERO)); + rb_define_const(module, "GLU_TESS_WINDING_POSITIVE", INT2NUM(GLU_TESS_WINDING_POSITIVE)); + rb_define_const(module, "GLU_TESS_WINDING_NEGATIVE", INT2NUM(GLU_TESS_WINDING_NEGATIVE)); + rb_define_const(module, "GLU_TESS_WINDING_ABS_GEQ_TWO", INT2NUM(GLU_TESS_WINDING_ABS_GEQ_TWO)); + + /* Tessellation properties */ + rb_define_const(module, "GLU_TESS_WINDING_RULE", INT2NUM(GLU_TESS_WINDING_RULE)); + rb_define_const(module, "GLU_TESS_BOUNDARY_ONLY", INT2NUM(GLU_TESS_BOUNDARY_ONLY)); + rb_define_const(module, "GLU_TESS_TOLERANCE", INT2NUM(GLU_TESS_TOLERANCE)); +#endif /* GLU_VERSION_1_2 */ + + rb_define_const(module, "GLU_BEGIN", INT2NUM(GLU_BEGIN)); + rb_define_const(module, "GLU_VERTEX", INT2NUM(GLU_VERTEX)); + rb_define_const(module, "GLU_END", INT2NUM(GLU_END)); + rb_define_const(module, "GLU_ERROR", INT2NUM(GLU_ERROR)); + rb_define_const(module, "GLU_EDGE_FLAG", INT2NUM(GLU_EDGE_FLAG)); + rb_define_const(module, "GLU_CW", INT2NUM(GLU_CW)); + rb_define_const(module, "GLU_CCW", INT2NUM(GLU_CCW)); + rb_define_const(module, "GLU_INTERIOR", INT2NUM(GLU_INTERIOR)); + rb_define_const(module, "GLU_EXTERIOR", INT2NUM(GLU_EXTERIOR)); + rb_define_const(module, "GLU_UNKNOWN", INT2NUM(GLU_UNKNOWN)); + rb_define_const(module, "GLU_TESS_ERROR1", INT2NUM(GLU_TESS_ERROR1)); + rb_define_const(module, "GLU_TESS_ERROR2", INT2NUM(GLU_TESS_ERROR2)); + rb_define_const(module, "GLU_TESS_ERROR3", INT2NUM(GLU_TESS_ERROR3)); + rb_define_const(module, "GLU_TESS_ERROR4", INT2NUM(GLU_TESS_ERROR4)); + rb_define_const(module, "GLU_TESS_ERROR5", INT2NUM(GLU_TESS_ERROR5)); + rb_define_const(module, "GLU_TESS_ERROR6", INT2NUM(GLU_TESS_ERROR6)); + rb_define_const(module, "GLU_TESS_ERROR7", INT2NUM(GLU_TESS_ERROR7)); + rb_define_const(module, "GLU_TESS_ERROR8", INT2NUM(GLU_TESS_ERROR8)); +#if defined(TESS_ERROR9) + rb_define_const(module, "GLU_TESS_ERROR9", INT2NUM(GLU_TESS_ERROR9)); +#endif +#if defined(GLU_VERSION_1_3) + rb_define_const(module, "GLU_AUTO_LOAD_MATRIX", INT2NUM(GLU_AUTO_LOAD_MATRIX)); + rb_define_const(module, "GLU_CULLING", INT2NUM(GLU_CULLING)); + rb_define_const(module, "GLU_SAMPLING_TOLERANCE", INT2NUM(GLU_SAMPLING_TOLERANCE)); + rb_define_const(module, "GLU_DISPLAY_MODE", INT2NUM(GLU_DISPLAY_MODE)); + rb_define_const(module, "GLU_SAMPLING_METHOD", INT2NUM(GLU_SAMPLING_METHOD)); + rb_define_const(module, "GLU_U_STEP", INT2NUM(GLU_U_STEP)); + rb_define_const(module, "GLU_V_STEP", INT2NUM(GLU_V_STEP)); +#endif + rb_define_const(module, "GLU_PATH_LENGTH", INT2NUM(GLU_PATH_LENGTH)); + rb_define_const(module, "GLU_PARAMETRIC_ERROR", INT2NUM(GLU_PARAMETRIC_ERROR)); + rb_define_const(module, "GLU_DOMAIN_DISTANCE", INT2NUM(GLU_DOMAIN_DISTANCE)); + rb_define_const(module, "GLU_MAP1_TRIM_2", INT2NUM(GLU_MAP1_TRIM_2)); + rb_define_const(module, "GLU_MAP1_TRIM_3", INT2NUM(GLU_MAP1_TRIM_3)); + rb_define_const(module, "GLU_OUTLINE_POLYGON", INT2NUM(GLU_OUTLINE_POLYGON)); + rb_define_const(module, "GLU_OUTLINE_PATCH", INT2NUM(GLU_OUTLINE_PATCH)); + rb_define_const(module, "GLU_NURBS_ERROR1", INT2NUM(GLU_NURBS_ERROR1)); + rb_define_const(module, "GLU_NURBS_ERROR2", INT2NUM(GLU_NURBS_ERROR2)); + rb_define_const(module, "GLU_NURBS_ERROR3", INT2NUM(GLU_NURBS_ERROR3)); + rb_define_const(module, "GLU_NURBS_ERROR4", INT2NUM(GLU_NURBS_ERROR4)); + rb_define_const(module, "GLU_NURBS_ERROR5", INT2NUM(GLU_NURBS_ERROR5)); + rb_define_const(module, "GLU_NURBS_ERROR6", INT2NUM(GLU_NURBS_ERROR6)); + rb_define_const(module, "GLU_NURBS_ERROR7", INT2NUM(GLU_NURBS_ERROR7)); + rb_define_const(module, "GLU_NURBS_ERROR8", INT2NUM(GLU_NURBS_ERROR8)); + rb_define_const(module, "GLU_NURBS_ERROR9", INT2NUM(GLU_NURBS_ERROR9)); + rb_define_const(module, "GLU_NURBS_ERROR10", INT2NUM(GLU_NURBS_ERROR10)); + rb_define_const(module, "GLU_NURBS_ERROR11", INT2NUM(GLU_NURBS_ERROR11)); + rb_define_const(module, "GLU_NURBS_ERROR12", INT2NUM(GLU_NURBS_ERROR12)); + rb_define_const(module, "GLU_NURBS_ERROR13", INT2NUM(GLU_NURBS_ERROR13)); + rb_define_const(module, "GLU_NURBS_ERROR14", INT2NUM(GLU_NURBS_ERROR14)); + rb_define_const(module, "GLU_NURBS_ERROR15", INT2NUM(GLU_NURBS_ERROR15)); + rb_define_const(module, "GLU_NURBS_ERROR16", INT2NUM(GLU_NURBS_ERROR16)); + rb_define_const(module, "GLU_NURBS_ERROR17", INT2NUM(GLU_NURBS_ERROR17)); + rb_define_const(module, "GLU_NURBS_ERROR18", INT2NUM(GLU_NURBS_ERROR18)); + rb_define_const(module, "GLU_NURBS_ERROR19", INT2NUM(GLU_NURBS_ERROR19)); + rb_define_const(module, "GLU_NURBS_ERROR20", INT2NUM(GLU_NURBS_ERROR20)); + rb_define_const(module, "GLU_NURBS_ERROR21", INT2NUM(GLU_NURBS_ERROR21)); + rb_define_const(module, "GLU_NURBS_ERROR22", INT2NUM(GLU_NURBS_ERROR22)); + rb_define_const(module, "GLU_NURBS_ERROR23", INT2NUM(GLU_NURBS_ERROR23)); + rb_define_const(module, "GLU_NURBS_ERROR24", INT2NUM(GLU_NURBS_ERROR24)); + rb_define_const(module, "GLU_NURBS_ERROR25", INT2NUM(GLU_NURBS_ERROR25)); + rb_define_const(module, "GLU_NURBS_ERROR26", INT2NUM(GLU_NURBS_ERROR26)); + rb_define_const(module, "GLU_NURBS_ERROR27", INT2NUM(GLU_NURBS_ERROR27)); + rb_define_const(module, "GLU_NURBS_ERROR28", INT2NUM(GLU_NURBS_ERROR28)); + rb_define_const(module, "GLU_NURBS_ERROR29", INT2NUM(GLU_NURBS_ERROR29)); + rb_define_const(module, "GLU_NURBS_ERROR30", INT2NUM(GLU_NURBS_ERROR30)); + rb_define_const(module, "GLU_NURBS_ERROR31", INT2NUM(GLU_NURBS_ERROR31)); + rb_define_const(module, "GLU_NURBS_ERROR32", INT2NUM(GLU_NURBS_ERROR32)); + rb_define_const(module, "GLU_NURBS_ERROR33", INT2NUM(GLU_NURBS_ERROR33)); + rb_define_const(module, "GLU_NURBS_ERROR34", INT2NUM(GLU_NURBS_ERROR34)); + rb_define_const(module, "GLU_NURBS_ERROR35", INT2NUM(GLU_NURBS_ERROR35)); + rb_define_const(module, "GLU_NURBS_ERROR36", INT2NUM(GLU_NURBS_ERROR36)); + rb_define_const(module, "GLU_NURBS_ERROR37", INT2NUM(GLU_NURBS_ERROR37)); + rb_define_const(module, "GLU_INVALID_ENUM", INT2NUM(GLU_INVALID_ENUM)); + rb_define_const(module, "GLU_INVALID_VALUE", INT2NUM(GLU_INVALID_VALUE)); + rb_define_const(module, "GLU_OUT_OF_MEMORY", INT2NUM(GLU_OUT_OF_MEMORY)); +#ifdef GLU_INCOMPATIBLE_GL_VERSION + rb_define_const(module, "GLU_INCOMPATIBLE_GL_VERSION", INT2NUM(GLU_INCOMPATIBLE_GL_VERSION)); +#endif + rb_define_const(module, "GLU_VERSION", INT2NUM(GLU_VERSION)); + rb_define_const(module, "GLU_EXTENSIONS", INT2NUM(GLU_EXTENSIONS)); + + cNurbs = rb_define_class("Nurbs", rb_cObject); + cTess = rb_define_class("Tess", rb_cObject); + cQuad = rb_define_class("Quadric", rb_cObject); + + rb_global_variable(&t_current); + t_current = rb_ary_new(); +} diff --git a/ruby/RubySFML/RubySFML.cpp b/ruby/RubySFML/RubySFML.cpp new file mode 100644 index 00000000..901412d9 --- /dev/null +++ b/ruby/RubySFML/RubySFML.cpp @@ -0,0 +1,213 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include "RubySFML.h" +using namespace sf; + +VALUE NOARGV[1]; +VALUE g_vModule; + + +/* + * Returns true if the specified OpenGL extension is supported, false otherwise. + */ +VALUE SFML_checkExtension(VALUE vClass, VALUE vName) { + return OpenGLCaps::CheckExtension(STR2CSTR(vName)) ? Qtrue : Qfalse; +} + +/* + * Returns the maximum texture size on the current display hardware. + */ +VALUE SFML_getMaxTextureSize() { + return INT2NUM(OpenGLCaps::GetMaxTextureSize()); +} + +/* + * Returns the maximum texture units on the current display hardware. + */ +VALUE SFML_getMaxTextureUnits() { + return INT2NUM(OpenGLCaps::GetMaxTextureUnits()); +} + +extern "C" void Init_RubySFML() { + g_vModule = rb_define_module("SFML"); + DEFINE_MODULE_METHOD(checkExtension, checkExtension, 1); + DEFINE_MODULE_METHOD(checkExtension, getMaxTextureSize, 0); + DEFINE_MODULE_METHOD(checkExtension, getMaxTextureUnits, 0); + + Init_Clock(); + Init_Color(); + Init_Drawable(); + Init_Event(); + Init_FloatRect(); + Init_Image(); + Init_Input(); + Init_IntRect(); + Init_Music(); + Init_PostFX(); + Init_RenderWindow(); + Init_Sound(); + Init_SoundBuffer(); + Init_SoundBufferRecorder(); + Init_Sprite(); + Init_String(); + Init_VideoMode(); + Init_View(); + Init_Window(); + + // Window style constants + VALUE vStyle = rb_define_module_under(g_vModule, "Style"); + rb_define_const(g_cWindow, "Resize", INT2FIX(Style::Resize)); + rb_define_const(g_cWindow, "Close", INT2FIX(Style::Close)); + rb_define_const(g_cWindow, "Fullscreen", INT2FIX(Style::Fullscreen)); + + // Sound constants + rb_define_const(g_cSound, "Stopped", INT2FIX(Sound::Stopped)); + rb_define_const(g_cSound, "Paused", INT2FIX(Sound::Paused)); + rb_define_const(g_cSound, "Playing", INT2FIX(Sound::Playing)); + + // Event constants + rb_define_const(g_cEvent, "Closed", INT2FIX(Event::Closed)); + rb_define_const(g_cEvent, "Resized", INT2FIX(Event::Resized)); + rb_define_const(g_cEvent, "LostFocus", INT2FIX(Event::LostFocus)); + rb_define_const(g_cEvent, "GainedFocus", INT2FIX(Event::GainedFocus)); + rb_define_const(g_cEvent, "TextEntered", INT2FIX(Event::TextEntered)); + rb_define_const(g_cEvent, "KeyPressed", INT2FIX(Event::KeyPressed)); + rb_define_const(g_cEvent, "KeyReleased", INT2FIX(Event::KeyReleased)); + rb_define_const(g_cEvent, "MouseWheelMoved", INT2FIX(Event::MouseWheelMoved)); + rb_define_const(g_cEvent, "MouseButtonPressed", INT2FIX(Event::MouseButtonPressed)); + rb_define_const(g_cEvent, "MouseButtonReleased", INT2FIX(Event::MouseButtonReleased)); + rb_define_const(g_cEvent, "MouseMoved", INT2FIX(Event::MouseMoved)); + rb_define_const(g_cEvent, "JoyButtonPressed", INT2FIX(Event::JoyButtonPressed)); + rb_define_const(g_cEvent, "JoyButtonReleased", INT2FIX(Event::JoyButtonReleased)); + rb_define_const(g_cEvent, "JoyMoved", INT2FIX(Event::JoyMoved)); + + // Mouse constants + VALUE vMouse = rb_define_module_under(g_vModule, "Mouse"); + rb_define_const(vMouse, "Left", INT2FIX(Mouse::Left)); + rb_define_const(vMouse, "Right", INT2FIX(Mouse::Right)); + rb_define_const(vMouse, "Middle", INT2FIX(Mouse::Middle)); + rb_define_const(vMouse, "XButton1", INT2FIX(Mouse::XButton1)); + rb_define_const(vMouse, "XButton2", INT2FIX(Mouse::XButton2)); + + // Joystick constants + VALUE vJoy = rb_define_module_under(g_vModule, "Joy"); + rb_define_const(vJoy, "AxisX", INT2FIX(Joy::AxisX)); + rb_define_const(vJoy, "AxisY", INT2FIX(Joy::AxisY)); + rb_define_const(vJoy, "AxisZ", INT2FIX(Joy::AxisZ)); + rb_define_const(vJoy, "AxisR", INT2FIX(Joy::AxisR)); + rb_define_const(vJoy, "AxisU", INT2FIX(Joy::AxisU)); + rb_define_const(vJoy, "AxisV", INT2FIX(Joy::AxisV)); + rb_define_const(vJoy, "AxisPOV", INT2FIX(Joy::AxisPOV)); + + // Keyboard constants + VALUE vKey = rb_define_module_under(g_vModule, "Key"); + rb_define_const(vKey, "A", INT2FIX(Key::A)); + rb_define_const(vKey, "B", INT2FIX(Key::B)); + rb_define_const(vKey, "C", INT2FIX(Key::C)); + rb_define_const(vKey, "D", INT2FIX(Key::D)); + rb_define_const(vKey, "E", INT2FIX(Key::E)); + rb_define_const(vKey, "F", INT2FIX(Key::F)); + rb_define_const(vKey, "G", INT2FIX(Key::G)); + rb_define_const(vKey, "H", INT2FIX(Key::H)); + rb_define_const(vKey, "I", INT2FIX(Key::I)); + rb_define_const(vKey, "J", INT2FIX(Key::J)); + rb_define_const(vKey, "K", INT2FIX(Key::K)); + rb_define_const(vKey, "L", INT2FIX(Key::L)); + rb_define_const(vKey, "M", INT2FIX(Key::M)); + rb_define_const(vKey, "N", INT2FIX(Key::N)); + rb_define_const(vKey, "O", INT2FIX(Key::O)); + rb_define_const(vKey, "P", INT2FIX(Key::P)); + rb_define_const(vKey, "Q", INT2FIX(Key::Q)); + rb_define_const(vKey, "R", INT2FIX(Key::R)); + rb_define_const(vKey, "S", INT2FIX(Key::S)); + rb_define_const(vKey, "T", INT2FIX(Key::T)); + rb_define_const(vKey, "U", INT2FIX(Key::U)); + rb_define_const(vKey, "V", INT2FIX(Key::V)); + rb_define_const(vKey, "W", INT2FIX(Key::W)); + rb_define_const(vKey, "X", INT2FIX(Key::X)); + rb_define_const(vKey, "Y", INT2FIX(Key::Y)); + rb_define_const(vKey, "Z", INT2FIX(Key::Z)); + rb_define_const(vKey, "Num0", INT2FIX(Key::Num0)); + rb_define_const(vKey, "Num1", INT2FIX(Key::Num1)); + rb_define_const(vKey, "Num2", INT2FIX(Key::Num2)); + rb_define_const(vKey, "Num3", INT2FIX(Key::Num3)); + rb_define_const(vKey, "Num4", INT2FIX(Key::Num4)); + rb_define_const(vKey, "Num5", INT2FIX(Key::Num5)); + rb_define_const(vKey, "Num6", INT2FIX(Key::Num6)); + rb_define_const(vKey, "Num7", INT2FIX(Key::Num7)); + rb_define_const(vKey, "Num8", INT2FIX(Key::Num8)); + rb_define_const(vKey, "Num9", INT2FIX(Key::Num9)); + rb_define_const(vKey, "Escape", INT2FIX(Key::Escape)); + rb_define_const(vKey, "Space", INT2FIX(Key::Space)); + rb_define_const(vKey, "Return", INT2FIX(Key::Return)); + rb_define_const(vKey, "Back", INT2FIX(Key::Space)); + rb_define_const(vKey, "Tab", INT2FIX(Key::Tab)); + rb_define_const(vKey, "PageUp", INT2FIX(Key::PageUp)); + rb_define_const(vKey, "PageDown", INT2FIX(Key::PageDown)); + rb_define_const(vKey, "End", INT2FIX(Key::End)); + rb_define_const(vKey, "Home", INT2FIX(Key::Home)); + rb_define_const(vKey, "Insert", INT2FIX(Key::Insert)); + rb_define_const(vKey, "Delete", INT2FIX(Key::Delete)); + rb_define_const(vKey, "Add", INT2FIX(Key::Add)); + rb_define_const(vKey, "Subtract", INT2FIX(Key::Subtract)); + rb_define_const(vKey, "Multiply", INT2FIX(Key::Multiply)); + rb_define_const(vKey, "Divide", INT2FIX(Key::Divide)); + rb_define_const(vKey, "Left", INT2FIX(Key::Left)); + rb_define_const(vKey, "Right", INT2FIX(Key::Right)); + rb_define_const(vKey, "Up", INT2FIX(Key::Up)); + rb_define_const(vKey, "Down", INT2FIX(Key::Down)); + rb_define_const(vKey, "Numpad0", INT2FIX(Key::Numpad0)); + rb_define_const(vKey, "Numpad1", INT2FIX(Key::Numpad1)); + rb_define_const(vKey, "Numpad2", INT2FIX(Key::Numpad2)); + rb_define_const(vKey, "Numpad3", INT2FIX(Key::Numpad3)); + rb_define_const(vKey, "Numpad4", INT2FIX(Key::Numpad4)); + rb_define_const(vKey, "Numpad5", INT2FIX(Key::Numpad5)); + rb_define_const(vKey, "Numpad6", INT2FIX(Key::Numpad6)); + rb_define_const(vKey, "Numpad7", INT2FIX(Key::Numpad7)); + rb_define_const(vKey, "Numpad8", INT2FIX(Key::Numpad8)); + rb_define_const(vKey, "Numpad9", INT2FIX(Key::Numpad9)); + rb_define_const(vKey, "F1", INT2FIX(Key::F1)); + rb_define_const(vKey, "F2", INT2FIX(Key::F2)); + rb_define_const(vKey, "F3", INT2FIX(Key::F3)); + rb_define_const(vKey, "F4", INT2FIX(Key::F4)); + rb_define_const(vKey, "F5", INT2FIX(Key::F5)); + rb_define_const(vKey, "F6", INT2FIX(Key::F6)); + rb_define_const(vKey, "F7", INT2FIX(Key::F7)); + rb_define_const(vKey, "F8", INT2FIX(Key::F8)); + rb_define_const(vKey, "F9", INT2FIX(Key::F9)); + rb_define_const(vKey, "F10", INT2FIX(Key::F10)); + rb_define_const(vKey, "F11", INT2FIX(Key::F11)); + rb_define_const(vKey, "F12", INT2FIX(Key::F12)); + rb_define_const(vKey, "F13", INT2FIX(Key::F13)); + rb_define_const(vKey, "F14", INT2FIX(Key::F14)); + rb_define_const(vKey, "F15", INT2FIX(Key::F15)); + rb_define_const(vKey, "Pause", INT2FIX(Key::Pause)); +} + diff --git a/ruby/RubySFML/RubySFML.h b/ruby/RubySFML/RubySFML.h new file mode 100644 index 00000000..d6fbc7ae --- /dev/null +++ b/ruby/RubySFML/RubySFML.h @@ -0,0 +1,88 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include "ruby_helper.h" + +extern VALUE NOARGV[1]; + +// SFML Ruby module object +extern VALUE g_vModule; + +// SFML Ruby class objects +extern VALUE g_cClock; +extern VALUE g_cColor; +extern VALUE g_cDrawable; +extern VALUE g_cEvent; +extern VALUE g_cFloatRect; +extern VALUE g_cImage; +extern VALUE g_cInput; +extern VALUE g_cIntRect; +extern VALUE g_cMusic; +extern VALUE g_cPostFX; +extern VALUE g_cRenderWindow; +extern VALUE g_cSound; +extern VALUE g_cSoundBuffer; +extern VALUE g_cSoundBufferRecorder; +extern VALUE g_cSprite; +extern VALUE g_cString; +extern VALUE g_cVideoMode; +extern VALUE g_cView; +extern VALUE g_cWindow; + +// SMFL Ruby class init functions +extern void Init_Clock(); +extern void Init_Color(); +extern void Init_Drawable(); +extern void Init_Event(); +extern void Init_FloatRect(); +extern void Init_Image(); +extern void Init_Input(); +extern void Init_IntRect(); +extern void Init_Music(); +extern void Init_PostFX(); +extern void Init_RenderWindow(); +extern void Init_Sound(); +extern void Init_SoundBuffer(); +extern void Init_SoundBufferRecorder(); +extern void Init_Sprite(); +extern void Init_String(); +extern void Init_VideoMode(); +extern void Init_View(); +extern void Init_Window(); + +extern void Color_free(void *p); +extern VALUE Color_new(int argc, VALUE *argv, VALUE vClass); + +extern void Event_free(void *p); +extern VALUE Event_new(int argc, VALUE *argv, VALUE vClass); + +extern void FloatRect_free(void *p); +extern VALUE FloatRect_new(int argc, VALUE *argv, VALUE vClass); + +extern void Image_free(void *p); +extern VALUE Image_new(int argc, VALUE *argv, VALUE vClass); + +extern void IntRect_free(void *p); +extern VALUE IntRect_new(int argc, VALUE *argv, VALUE vClass); + diff --git a/ruby/RubySFML/RubySFML.rb b/ruby/RubySFML/RubySFML.rb new file mode 100644 index 00000000..4259820e --- /dev/null +++ b/ruby/RubySFML/RubySFML.rb @@ -0,0 +1,83 @@ +require "RubySFML.so" + +module SFML + + # A simple class for dealing with tiled sprites. + class TSprite < Sprite + # Use to set/get the tile column + attr_accessor :tx + # Use to set/get the tile row + attr_accessor :ty + + # Pass in the image, the tile width, and the tile height. + def initialize(image, w, h) + super(image) + @tx, @ty, @tw, @th = 0, 0, w, h + setRotationCenter(@tw/2, @th/2) + end + + # Overrides Sprite::render to call setSubRect() for you to choose a + # tile based on tx and ty before the sprite is rendered. + def render(win) + l, t = @tw*@tx, @th*@ty + setSubRect(IntRect.new(l, t, l+@tw, t+@th)) + super(win) + end + end + + # A simple class for dealing with sprites and 2D velocity/acceleration + class VSprite < TSprite + # Use to get/set the x component of the velocity vector + attr_accessor :vx + # Use to get/set the y component of the velocity vector + attr_accessor :vy + + # Pass in the image, the tile width, and the tile height. + def initialize(image, w, h) + super(image, w, h) + @vx = @vy = 0.0 + end + + # Specify a number of degrees to rotate left + def turn_left(degrees) rotate(degrees); end + # Specify a number of degrees to rotate right + def turn_right(degrees) rotate(-degrees); end + + # Returns the magnitude of the velocity vector + def speed + return Math.sqrt(@vx**2 + @vy**2) + end + + # Returns the direction of the velocity vector + def direction + s = speed + return [@vx/s, @vy/s] + end + + # Accelerates the sprite in the direction vector v by the amount "thrust" + def accelerate(v, thrust) + @vx += v[0] * thrust + @vy += v[1] * thrust + end + + # Scales the speed component of the velocity + def scale_speed(amount) + @vx *= amount + @vy *= amount + end + + # Moves the sprite in the direction vector v by the amound d + def move(v, d) + self.x += v[0] * d + self.y += v[1] * d + end + + # Updates the sprite's position based on its velocity and its time slice + def update(time) + self.x += @vx * time + self.y += @vy * time + end + end + +end + diff --git a/ruby/RubySFML/extconf-linux.rb b/ruby/RubySFML/extconf-linux.rb new file mode 100644 index 00000000..30589175 --- /dev/null +++ b/ruby/RubySFML/extconf-linux.rb @@ -0,0 +1,26 @@ +require "mkmf" + +dir_config('SFML') + +libs = [ + "GL", + "GLU", + "sfml-system", + "sfml-window", + "sfml-graphics", + "sfml-audio", +] + +libs.each {|lib| + unless have_library(lib) + puts "Unable to find #{lib}.lib!" + puts "Please specify the path to them using:" + puts "--with-SFML-lib=lib_path" + puts "--with-SFML-include=include_path" + puts + exit + end +} + +create_makefile("RubySFML") + diff --git a/ruby/RubySFML/extconf-win.rb b/ruby/RubySFML/extconf-win.rb new file mode 100644 index 00000000..bd2b6aed --- /dev/null +++ b/ruby/RubySFML/extconf-win.rb @@ -0,0 +1,30 @@ +require "mkmf" +$CFLAGS = "/MD /O2 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS" +#$CFLAGS = "/MD /Zi /EHsc /DWIN32 /DNDEBUG /D_WINDOWS" +#$LDFLAGS = "/Zi" + +dir_config('SFML') + +libs = [ + "gdi32", + "opengl32", + "glu32", + "sfml-system-s", + "sfml-window-s", + "sfml-graphics-s", + "sfml-audio-s", +] + +libs.each {|lib| + unless have_library(lib) + puts "Unable to find #{lib}.lib!" + puts "Please specify the path to them using:" + puts "--with-SFML-lib=lib_path" + puts "--with-SFML-include=include_path" + puts + exit + end +} + +create_makefile("RubySFML") + diff --git a/ruby/RubySFML/ruby_helper.h b/ruby/RubySFML/ruby_helper.h new file mode 100644 index 00000000..12c3610b --- /dev/null +++ b/ruby/RubySFML/ruby_helper.h @@ -0,0 +1,846 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __ruby_helper_h__ +#define __ruby_helper_h__ +#define NOMINMAX +#include +#include +#include +#if defined(_WIN32) || defined(__WIN32__) + #include +#endif +#include + +#if defined(_WIN32) || defined(__WIN32__) + #define DECL __cdecl +#else + #define DECL __attribute__((cdecl)) +#endif + +// Copies a string, makes the first character upper case, and then returns it +inline std::string fupr(const char *p) { + std::string str = p; + str[0] = toupper(str[0]); + return str; +} + +#define IS(v, c) rb_obj_class(v) == c +#define ISKO(v, c) rb_obj_is_kind_of(v, c) +#define ISNUM(v) ISKO(v, rb_cNumeric) +#define ISSTR(v) ISKO(v, rb_cString) + +#define DECLARE_PTR_VAR(MyClass, MyVar, expr)\ + MyClass *p##MyVar = expr;\ + VALUE v##MyVar = p##MyVar == NULL ? Qnil : Data_Wrap_Struct(g_c##MyClass, 0, 0, p##MyVar) + +#define DECLARE_OBJ_VAR(MyClass, MyVar, expr)\ + VALUE v##MyVar = MyClass##_new(0, NOARGV, g_c##MyClass);\ + MyClass *p##MyVar = NULL;\ + Data_Get_Struct(v##MyVar, MyClass, p##MyVar);\ + *p##MyVar = expr + +#define GET_OBJ_VAR(MyClass, MyVar)\ + MyClass *p##MyVar = NULL;\ + Data_Get_Struct(v##MyVar, MyClass, p##MyVar) + +#define DEFINE_CLASS_METHOD(MyClass, MyMethod, n)\ + rb_define_singleton_method(g_c##MyClass, #MyMethod,\ + (unsigned long (DECL *)(...))MyClass##_##MyMethod, n) + +#define DEFINE_CLASS_METHOD2(MyClass, MyMethod, RubyMethod, n)\ + rb_define_singleton_method(g_c##MyClass, #RubyMethod,\ + (unsigned long (DECL *)(...))MyClass##_##MyMethod, n) + +#define DEFINE_INSTANCE_METHOD(MyClass, MyMethod, n)\ + rb_define_method(g_c##MyClass, #MyMethod,\ + (unsigned long (DECL *)(...))MyClass##_##MyMethod, n) + +#define DEFINE_INSTANCE_METHOD2(MyClass, MyMethod, RubyMethod, n)\ + rb_define_method(g_c##MyClass, #RubyMethod,\ + (unsigned long (DECL *)(...))MyClass##_##MyMethod, n) + +// Use to define a standard getter method (for any type of member) +// (Defines both obj.variableName and obj.getVariableName) +#define DEFINE_GETTER(MyClass, MyField) \ + rb_define_method(g_c##MyClass, #MyField, \ + (unsigned long (DECL *)(...))MyClass##_get_##MyField, 0);\ + rb_define_method(g_c##MyClass, (std::string("get")+fupr(#MyField)).c_str(), \ + (unsigned long (DECL *)(...))MyClass##_get_##MyField, 0) + +// Use to define a standard setter method (for any type of member) +// (Defines both obj.variableName = v and obj.setVariableName v) +#define DEFINE_SETTER(MyClass, MyField) \ + rb_define_method(g_c##MyClass, #MyField "=", \ + (unsigned long (DECL *)(...))MyClass##_set_##MyField, 1);\ + rb_define_method(g_c##MyClass, (std::string("set")+fupr(#MyField)).c_str(), \ + (unsigned long (DECL *)(...))MyClass##_set_##MyField, 1) + +// Use to define standard getter and setter methods (for any type of member) +#define DEFINE_RW(MyClass, MyField) \ + DEFINE_GETTER(MyClass, MyField);\ + DEFINE_SETTER(MyClass, MyField) + +// Use to define a standard getter method (for any type of member) +// (Defines both obj.variableName and obj.getVariableName) +#define DEFINE_GETTER2(MyClass, MyField, RubyField) \ + rb_define_method(g_c##MyClass, #RubyField, \ + (unsigned long (DECL *)(...))MyClass##_get_##MyField, 0);\ + rb_define_method(g_c##MyClass, (std::string("get")+fupr(#RubyField)).c_str(), \ + (unsigned long (DECL *)(...))MyClass##_get_##MyField, 0) + +// Use to define a standard setter method (for any type of member) +// (Defines both obj.variableName = v and obj.setVariableName v) +#define DEFINE_SETTER2(MyClass, MyField, RubyField) \ + rb_define_method(g_c##MyClass, #RubyField "=", \ + (unsigned long (DECL *)(...))MyClass##_set_##MyField, 1);\ + rb_define_method(g_c##MyClass, (std::string("set")+fupr(#RubyField)).c_str(), \ + (unsigned long (DECL *)(...))MyClass##_set_##MyField, 1) + +// Use to define standard getter and setter methods (for any type of member) +#define DEFINE_RW2(MyClass, MyField, RubyField) \ + DEFINE_GETTER2(MyClass, MyField, RubyField);\ + DEFINE_SETTER2(MyClass, MyField, RubyField) + +// Use to define a static getter method (for any type of member) +// (Defines both Class.variableName and Class.getVariableName) +#define DEFINE_STATIC_GETTER(MyClass, MyField) \ + rb_define_singleton_method(g_c##MyClass, #MyField, \ + (unsigned long (DECL *)(...))MyClass##_get_##MyField, 0);\ + rb_define_singleton_method(g_c##MyClass, (std::string("get")+fupr(#MyField)).c_str(), \ + (unsigned long (DECL *)(...))MyClass##_get_##MyField, 0) + +// Use to define a static setter method (for any type of member) +// (Defines both Class.variableName = v and Class.setVariableName v) +#define DEFINE_STATIC_SETTER(MyClass, MyField) \ + rb_define_singleton_method(g_c##MyClass, #MyField "=", \ + (unsigned long (DECL *)(...))MyClass##_set_##MyField, 1);\ + rb_define_singleton_method(g_c##MyClass, (std::string("set")+fupr(#MyField)).c_str(), \ + (unsigned long (DECL *)(...))MyClass##_set_##MyField, 1) + +// Use to define static getter and setter methods (for any type of member) +#define DEFINE_STATIC_RW(MyClass, MyField) \ + DEFINE_STATIC_GETTER(MyClass, MyField);\ + DEFINE_STATIC_SETTER(MyClass, MyField) + +#define DEFINE_MODULE_CONST(MyConst)\ + rb_define_const(g_vModule, #MyConst, INT2FIX(MyConst)) + +#define DEFINE_MODULE_METHOD(MyMethod, RubyMethod, n)\ + rb_define_singleton_method(g_vModule, #RubyMethod,\ + (unsigned long (DECL *)(...))SFML_##MyMethod, n) + +#define DEFINE_INT_CONST(MyClass, MyConst)\ + rb_define_const(g_c##MyClass, #MyConst, INT2FIX(MyClass::MyConst)) + +#define DEFINE_PTR_CONST(MyClass, MyConst, expr)\ + rb_define_const(g_c##MyClass, #MyConst, Data_Wrap_Struct(g_c##MyClass, 0, 0, expr)) + + +#define DECLARE_VOID_METHOD(MyClass, MyMethod)\ +static VALUE MyClass##_##MyMethod(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyMethod();\ + return vSelf;\ +}\ + +// Use to declare standard free, new, and init methods with 0 parameters +#define DECLARE_FREE_NEW_INIT0(MyClass)\ +static void MyClass##_free(void *p)\ +{\ + delete (MyClass *)p;\ +}\ +static VALUE MyClass##_new(VALUE vClass)\ +{\ + VALUE argv[1];\ + MyClass *ptr = new MyClass;\ + VALUE tData = Data_Wrap_Struct(vClass, 0, MyClass##_free, ptr);\ + rb_obj_call_init(tData, 0, argv);\ + return tData;\ +}\ +static VALUE MyClass##_initialize(VALUE vSelf)\ +{\ + return vSelf;\ +} + +// Use to declare standard free and new methods with 1 parameter +#define DECLARE_FREE_NEW1(MyClass)\ +static void MyClass##_free(void *p)\ +{\ + delete (MyClass *)p;\ +}\ +static VALUE MyClass##_new(VALUE vClass, VALUE v1)\ +{\ + VALUE argv[1];\ + argv[0] = v1;\ + MyClass *ptr = new MyClass;\ + VALUE tData = Data_Wrap_Struct(vClass, 0, MyClass##_free, ptr);\ + rb_obj_call_init(tData, 1, argv);\ + return tData;\ +} + +// Use to define standard free, new, and init methods with n parameters +// (Also declares a free method) +#define DEFINE_CLASS_NEW_INIT(MyClass, n)\ + g_c##MyClass = rb_define_class(#MyClass, rb_cObject);\ + DEFINE_CLASS_METHOD(MyClass, new, n);\ + DEFINE_INSTANCE_METHOD(MyClass, initialize, n); + + +// Use to declare a standard getter method for a public int member +#define DECLARE_INT_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return INT2NUM((int)ptr->MyField);\ +} + +// Use to declare a static getter method for a public int member +#define DECLARE_STATIC_INT_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vClass)\ +{\ + return INT2NUM((int)MyClass::MyField);\ +} + +// Use to declare a standard setter method for a public int member +#define DECLARE_INT_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = NUM2INT(v);\ + return v;\ +} + +// Use to declare a static setter method for a public int member +#define DECLARE_STATIC_INT_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vClass)\ +{\ + MyClass::MyField = NUM2INT(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public int member +#define DECLARE_INT_RW(MyClass, MyField)\ +DECLARE_INT_GETTER(MyClass, MyField)\ +DECLARE_INT_SETTER(MyClass, MyField) + +// Use to declare static getter and setter methods for a public int member +#define DECLARE_STATIC_INT_RW(MyClass, MyField)\ +DECLARE_STATIC_INT_GETTER(MyClass, MyField)\ +DECLARE_STATIC_INT_SETTER(MyClass, MyField) + +// Use to declare a standard setter method for a public enum member +#define DECLARE_ENUM_SETTER(MyClass, MyField, EnumType)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = (EnumType)NUM2INT(v);\ + return v;\ +} + +// Use to declare a standard setter method for a public enum member +#define DECLARE_STATIC_ENUM_SETTER(MyClass, MyField, EnumType)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = (EnumType)NUM2INT(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public enum member +#define DECLARE_ENUM_RW(MyClass, MyField, EnumType)\ +DECLARE_INT_GETTER(MyClass, MyField)\ +DECLARE_ENUM_SETTER(MyClass, MyField, EnumType) + +// Use to declare standard getter and setter methods for a public enum member +#define DECLARE_STATIC_ENUM_RW(MyClass, MyField, EnumType)\ +DECLARE_STATIC_INT_GETTER(MyClass, MyField)\ +DECLARE_STATIC_ENUM_SETTER(MyClass, MyField, EnumType) + +// Use to declare a standard getter method for a public bool member +#define DECLARE_BOOL_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return ptr->MyField ? Qtrue : Qfalse;\ +} + +// Use to declare a static getter method for a public bool member +#define DECLARE_STATIC_BOOL_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vClass)\ +{\ + return MyClass::MyField ? Qtrue : Qfalse;\ +} + +// Use to declare a standard setter method for a public bool member +#define DECLARE_BOOL_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = RTEST(v) ? true : false;\ + return v;\ +} + +// Use to declare a static setter method for a public bool member +#define DECLARE_STATIC_BOOL_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vClass, VALUE v)\ +{\ + MyClass::MyField = RTEST(v) ? true : false;\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public int member +#define DECLARE_BOOL_RW(MyClass, MyField)\ +DECLARE_BOOL_GETTER(MyClass, MyField)\ +DECLARE_BOOL_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public int member +#define DECLARE_STATIC_BOOL_RW(MyClass, MyField)\ +DECLARE_STATIC_BOOL_GETTER(MyClass, MyField)\ +DECLARE_STATIC_BOOL_SETTER(MyClass, MyField) + +// Use to declare a standard getter method for a public double member +#define DECLARE_DOUBLE_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return rb_float_new((double)ptr->MyField);\ +} + +// Use to declare a static getter method for a public double member +#define DECLARE_STATIC_DOUBLE_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + return rb_float_new((double)MyClass::MyField);\ +} + +// Use to declare a standard setter method for a public double member +#define DECLARE_DOUBLE_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = (float)NUM2DBL(v);\ + return v;\ +} + +// Use to declare a static setter method for a public double member +#define DECLARE_STATIC_DOUBLE_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = NUM2DBL(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public double member +#define DECLARE_DOUBLE_RW(MyClass, MyField)\ +DECLARE_DOUBLE_GETTER(MyClass, MyField)\ +DECLARE_DOUBLE_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public double member +#define DECLARE_STATIC_DOUBLE_RW(MyClass, MyField)\ +DECLARE_DOUBLE_STATIC_GETTER(MyClass, MyField)\ +DECLARE_DOUBLE_STATIC_SETTER(MyClass, MyField) + +// Use to declare a standard getter method for a public std::string member +#define DECLARE_STRING_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return rb_str_new2(ptr->MyField.c_str());\ +} + +// Use to declare a static getter method for a public std::string member +#define DECLARE_STATIC_STRING_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + return rb_str_new2(MyClass::MyField.c_str());\ +} + +// Use to declare a standard setter method for a public std::string member +#define DECLARE_STRING_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = STR2CSTR(v);\ + return v;\ +} + +// Use to declare a static setter method for a public std::string member +#define DECLARE_STATIC_STRING_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = STR2CSTR(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public std::string member +#define DECLARE_STRING_RW(MyClass, MyField)\ +DECLARE_STRING_GETTER(MyClass, MyField)\ +DECLARE_STRING_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public int member +#define DECLARE_STATIC_STRING_RW(MyClass, MyField)\ +DECLARE_STATIC_STRING_GETTER(MyClass, MyField)\ +DECLARE_STATIC_STRING_SETTER(MyClass, MyField) + +// Use to declare a standard getter method for a public short member +#define DECLARE_SHORT_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return INT2FIX((int)ptr->MyField);\ +} + +// Use to declare a standard getter method for a public short member +#define DECLARE_STATIC_SHORT_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + return INT2FIX((int)MyClass->MyField);\ +} + +// Use to declare a standard setter method for a public short member +#define DECLARE_SHORT_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = (short)FIX2INT(v);\ + return v;\ +} + +// Use to declare a standard setter method for a public short member +#define DECLARE_STATIC_SHORT_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = (short)FIX2INT(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public short member +#define DECLARE_SHORT_RW(MyClass, MyField)\ +DECLARE_SHORT_GETTER(MyClass, MyField)\ +DECLARE_SHORT_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public short member +#define DECLARE_STATIC_SHORT_RW(MyClass, MyField)\ +DECLARE_STATIC_SHORT_GETTER(MyClass, MyField)\ +DECLARE_STATIC_SHORT_SETTER(MyClass, MyField) + + +// Use to declare a standard getter method for a public object member +#define DECLARE_OBJ_GETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + VALUE vRet = FieldType##_new(0, NOARGV, g_c##FieldType);\ + FieldType *pRet;\ + Data_Get_Struct(vRet, FieldType, pRet);\ + *pRet = pSelf->MyField;\ + return vRet;\ +} + +// Use to declare a static getter method for a public object member +#define DECLARE_STATIC_OBJ_GETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + VALUE vRet = FieldType##_new(0, NOARGV, g_c##FieldType);\ + FieldType *pRet;\ + Data_Get_Struct(vRet, FieldType, pRet);\ + *pRet = MyClass::MyField;\ + return vRet;\ +} + +// Use to declare a standard setter method for a public object member +#define DECLARE_OBJ_SETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + FieldType *pV;\ + Data_Get_Struct(v, FieldType, pV);\ + pSelf->MyField = *pV;\ + return Qnil;\ +} + +// Use to declare a static setter method for a public object member +#define DECLARE_STATIC_OBJ_SETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_set_##MyField(VALUE vClass, VALUE v)\ +{\ + FieldType *pV;\ + Data_Get_Struct(v, FieldType, pV);\ + MyClass::MyField = *pV;\ + return Qnil;\ +} + +// Use to declare standard getter and setter methods for a public object member +#define DECLARE_OBJ_RW(MyClass, MyField, FieldType)\ +DECLARE_OBJ_GETTER(MyClass, MyField, FieldType)\ +DECLARE_OBJ_SETTER(MyClass, MyField, FieldType) + +// Use to declare static getter and setter methods for a public object member +#define DECLARE_STATIC_OBJ_RW(MyClass, MyField, FieldType)\ +DECLARE_STATIC_OBJ_GETTER(MyClass, MyField, FieldType)\ +DECLARE_STATIC_OBJ_SETTER(MyClass, MyField, FieldType) + + +// Use to declare a standard getter method for a public unsigned short member +#define DECLARE_USHORT_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return INT2FIX((int)ptr->MyField);\ +} + +// Use to declare a standard getter method for a public unsigned short member +#define DECLARE_STATIC_USHORT_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + return INT2FIX((int)MyClass->MyField);\ +} + +// Use to declare a standard setter method for a public unsigned short member +#define DECLARE_USHORT_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = (unsigned short)FIX2INT(v);\ + return v;\ +} + +// Use to declare a standard setter method for a public unsigned short member +#define DECLARE_STATIC_USHORT_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = (unsigned short)FIX2INT(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public unsigned short member +#define DECLARE_USHORT_RW(MyClass, MyField)\ +DECLARE_USHORT_GETTER(MyClass, MyField)\ +DECLARE_USHORT_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public unsigned short member +#define DECLARE_STATIC_USHORT_RW(MyClass, MyField)\ +DECLARE_STATIC_USHORT_GETTER(MyClass, MyField)\ +DECLARE_STATIC_USHORT_SETTER(MyClass, MyField) + + +// Use to declare a standard getter method for a public unsigned char member +#define DECLARE_UCHAR_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return INT2FIX((int)ptr->MyField);\ +} + +// Use to declare a standard getter method for a public unsigned char member +#define DECLARE_STATIC_UCHAR_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + return INT2FIX((int)MyClass->MyField);\ +} + +// Use to declare a standard setter method for a public unsigned char member +#define DECLARE_UCHAR_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = (unsigned char)FIX2INT(v);\ + return v;\ +} + +// Use to declare a standard setter method for a public unsigned char member +#define DECLARE_STATIC_UCHAR_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = (unsigned char)FIX2INT(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public unsigned char member +#define DECLARE_UCHAR_RW(MyClass, MyField)\ +DECLARE_UCHAR_GETTER(MyClass, MyField)\ +DECLARE_UCHAR_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public unsigned char member +#define DECLARE_STATIC_UCHAR_RW(MyClass, MyField)\ +DECLARE_STATIC_UCHAR_GETTER(MyClass, MyField)\ +DECLARE_STATIC_UCHAR_SETTER(MyClass, MyField) + + +// Use to declare a standard getter method for a public char member +#define DECLARE_CHAR_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return INT2FIX((int)ptr->MyField);\ +} + +// Use to declare a standard getter method for a public char member +#define DECLARE_STATIC_CHAR_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + return INT2FIX((int)MyClass->MyField);\ +} + +// Use to declare a standard setter method for a public char member +#define DECLARE_CHAR_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = (char)FIX2INT(v);\ + return v;\ +} + +// Use to declare a standard setter method for a public char member +#define DECLARE_STATIC_CHAR_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass::MyField = (char)FIX2INT(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public char member +#define DECLARE_CHAR_RW(MyClass, MyField)\ +DECLARE_CHAR_GETTER(MyClass, MyField)\ +DECLARE_CHAR_SETTER(MyClass, MyField) + +// Use to declare standard getter and setter methods for a public char member +#define DECLARE_STATIC_CHAR_RW(MyClass, MyField)\ +DECLARE_STATIC_CHAR_GETTER(MyClass, MyField)\ +DECLARE_STATIC_CHAR_SETTER(MyClass, MyField) + +// Use to declare a standard getter method for a public int64 member +#define DECLARE_INT64_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return LL2NUM(ptr->MyField);\ +} + +// Use to declare a static getter method for a public int64 member +#define DECLARE_STATIC_INT64_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vClass)\ +{\ + return LL2NUM(MyClass::MyField);\ +} + +// Use to declare a standard setter method for a public int64 member +#define DECLARE_INT64_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = NUM2LL(v);\ + return v;\ +} + +// Use to declare a static setter method for a public int64 member +#define DECLARE_STATIC_INT64_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vClass)\ +{\ + MyClass::MyField = NUM2LL(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public int64 member +#define DECLARE_INT64_RW(MyClass, MyField)\ +DECLARE_INT64_GETTER(MyClass, MyField)\ +DECLARE_INT64_SETTER(MyClass, MyField) + +// Use to declare static getter and setter methods for a public int64 member +#define DECLARE_STATIC_INT64_RW(MyClass, MyField)\ +DECLARE_STATIC_INT64_GETTER(MyClass, MyField)\ +DECLARE_STATIC_INT64_SETTER(MyClass, MyField) + + +// Use to declare a standard getter method for a public uint64 member +#define DECLARE_UINT64_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + return ULL2NUM(ptr->MyField);\ +} + +// Use to declare a static getter method for a public uint64 member +#define DECLARE_STATIC_UINT64_GETTER(MyClass, MyField)\ +static VALUE MyClass##_get_##MyField(VALUE vClass)\ +{\ + return ULL2NUM(MyClass::MyField);\ +} + +// Use to declare a standard setter method for a public uint64 member +#define DECLARE_UINT64_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *ptr;\ + Data_Get_Struct(vSelf, MyClass, ptr);\ + ptr->MyField = NUM2ULL(v);\ + return v;\ +} + +// Use to declare a static setter method for a public uint64 member +#define DECLARE_USTATIC_INT64_SETTER(MyClass, MyField)\ +static VALUE MyClass##_set_##MyField(VALUE vClass)\ +{\ + MyClass::MyField = NUM2ULL(v);\ + return v;\ +} + +// Use to declare standard getter and setter methods for a public uint64 member +#define DECLARE_UINT64_RW(MyClass, MyField)\ +DECLARE_UINT64_GETTER(MyClass, MyField)\ +DECLARE_UINT64_SETTER(MyClass, MyField) + +// Use to declare static getter and setter methods for a public uint64 member +#define DECLARE_STATIC_UINT64_RW(MyClass, MyField)\ +DECLARE_STATIC_UINT64_GETTER(MyClass, MyField)\ +DECLARE_STATIC_UINT64_SETTER(MyClass, MyField) + + +#define DECLARE_INT_ARR_GETTER(MyClass, MyField, Size)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + VALUE v = rb_ary_new();\ + for(int i=0; iMyField[i]));\ + return v;\ +} + +#define DECLARE_INT_ARR_SETTER(MyClass, MyField, Size)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + for(int i=0; iMyField[i] = FIX2INT(rb_ary_entry(v, i));\ + return v;\ +} + +#define DECLARE_INT_ARR_RW(MyClass, MyField, Size)\ +DECLARE_INT_ARR_GETTER(MyClass, MyField, Size);\ +DECLARE_INT_ARR_SETTER(MyClass, MyField, Size) + + +#define DECLARE_DOUBLE_ARR_GETTER(MyClass, MyField, Size)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + VALUE v = rb_ary_new();\ + for(int i=0; iMyField[i]));\ + return v;\ +} + +#define DECLARE_DOUBLE_ARR_SETTER(MyClass, MyField, Size)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + for(int i=0; iMyField[i] = NUM2DBL(rb_ary_entry(v, i));\ + return v;\ +} + +#define DECLARE_DOUBLE_ARR_RW(MyClass, MyField, Size)\ +DECLARE_DOUBLE_ARR_GETTER(MyClass, MyField, Size);\ +DECLARE_DOUBLE_ARR_SETTER(MyClass, MyField, Size) + + +#define DECLARE_ADDR_GETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + VALUE vRet = Data_Wrap_Struct(g_c##FieldType, 0, 0, &pSelf->MyField);\ + return vRet;\ +} + +// Use to declare a standard getter method for a public object pointer member +#define DECLARE_PTR_GETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + VALUE vRet = Data_Wrap_Struct(g_c##FieldType, 0, 0, pSelf->MyField);\ + return vRet;\ +} + + +// Use to declare a standard getter method for a public object reference member +#define DECLARE_REF_GETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_get_##MyField(VALUE vSelf)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + pSelf->MyField->ReferenceCountedObject_refCount.increment();\ + VALUE vRet = Data_Wrap_Struct(g_c##FieldType, 0, FieldType##_free, pSelf->MyField.pointer());\ + return vRet;\ +} + +// Use to declare a standard setter method for a public object reference member +#define DECLARE_REF_SETTER(MyClass, MyField, FieldType)\ +static VALUE MyClass##_set_##MyField(VALUE vSelf, VALUE v)\ +{\ + MyClass *pSelf;\ + Data_Get_Struct(vSelf, MyClass, pSelf);\ + FieldType *pV;\ + Data_Get_Struct(v, FieldType, pV);\ + pSelf->MyField = pV;\ + return Qnil;\ +} + +// Use to declare standard getter and setter methods for a public object member +#define DECLARE_REF_RW(MyClass, MyField, FieldType)\ +DECLARE_REF_GETTER(MyClass, MyField, FieldType)\ +DECLARE_REF_SETTER(MyClass, MyField, FieldType) + + +#endif // __ruby_helper_h__ + diff --git a/ruby/RubySFML/sfClock.cpp b/ruby/RubySFML/sfClock.cpp new file mode 100644 index 00000000..9880057e --- /dev/null +++ b/ruby/RubySFML/sfClock.cpp @@ -0,0 +1,86 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cClock; + +void Clock_free(void *p) { delete (Clock *)p; } +VALUE Clock_new(int argc, VALUE *argv, VALUE vClass) { + Clock *ptr = new Clock(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Clock_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Clock_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Clock *pSelf; + Data_Get_Struct(vSelf, Clock, pSelf); + if(argc == 0) { + // Nothing to initialize + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Clock_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Clock *pSelf; + Data_Get_Struct(vSelf, Clock, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Elapsed Time=%f", pSelf->GetElapsedTime()); + return rb_str_new2(szBuffer); +} + +static VALUE Clock_get_elapsedTime(VALUE vSelf) { + // Get C++ object pointer from vSelf + Clock *pSelf; + Data_Get_Struct(vSelf, Clock, pSelf); + return rb_float_new(pSelf->GetElapsedTime()); +} + +static VALUE Clock_reset(VALUE vSelf) { + // Get C++ object pointer from vSelf + Clock *pSelf; + Data_Get_Struct(vSelf, Clock, pSelf); + pSelf->Reset(); + return Qnil; +} + +void Init_Clock() +{ + g_cClock = rb_define_class_under(g_vModule, "Clock", rb_cObject); + DEFINE_CLASS_METHOD(Clock, new, -1); + DEFINE_INSTANCE_METHOD(Clock, initialize, -1); + + DEFINE_GETTER(Clock, elapsedTime); + + DEFINE_INSTANCE_METHOD(Clock, to_s, 0); + DEFINE_INSTANCE_METHOD2(Clock, get_elapsedTime, to_f, 0); + DEFINE_INSTANCE_METHOD(Clock, reset, 0); +} + diff --git a/ruby/RubySFML/sfColor.cpp b/ruby/RubySFML/sfColor.cpp new file mode 100644 index 00000000..5ee4e8f2 --- /dev/null +++ b/ruby/RubySFML/sfColor.cpp @@ -0,0 +1,120 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cColor; + +DECLARE_STATIC_OBJ_GETTER(Color, Black, Color); +DECLARE_STATIC_OBJ_GETTER(Color, White, Color); +DECLARE_STATIC_OBJ_GETTER(Color, Red, Color); +DECLARE_STATIC_OBJ_GETTER(Color, Green, Color); +DECLARE_STATIC_OBJ_GETTER(Color, Blue, Color); +DECLARE_STATIC_OBJ_GETTER(Color, Yellow, Color); +DECLARE_STATIC_OBJ_GETTER(Color, Magenta, Color); +DECLARE_STATIC_OBJ_GETTER(Color, Cyan, Color); + +DECLARE_INT_RW(Color, r); +DECLARE_INT_RW(Color, g); +DECLARE_INT_RW(Color, b); +DECLARE_INT_RW(Color, a); + +void Color_free(void *p) { delete (Color *)p; } +VALUE Color_new(int argc, VALUE *argv, VALUE vClass) { + Color *ptr = new Color(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Color_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Color_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Color *pSelf; + Data_Get_Struct(vSelf, Color, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 1 && ISNUM(argv[0])) { + DWORD dw = NUM2UINT(argv[0]); + *pSelf = Color( + (dw >> 24) & 0xFF, + (dw >> 16) & 0xFF, + (dw >> 8) & 0xFF, + (dw >> 0) & 0xFF); + } else if(argc >= 3 && argc <= 4 && + ISNUM(argv[0]) && ISNUM(argv[1]) && ISNUM(argv[2]) && + (argc < 4 || ISNUM(argv[3]))) { + pSelf->r = (unsigned char)NUM2INT(argv[0]); + pSelf->g = (unsigned char)NUM2INT(argv[1]); + pSelf->b = (unsigned char)NUM2INT(argv[2]); + pSelf->a = argc < 4 ? 255 : (unsigned char)NUM2INT(argv[3]); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Color_to_s(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + Color *pSelf; + Data_Get_Struct(vSelf, Color, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "r=%d, g=%d, b=%d, a=%d", pSelf->r, pSelf->g, pSelf->b, pSelf->a); + return rb_str_new2(szBuffer); +} + +static VALUE Color_toRGBA(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + Color *pSelf; + Data_Get_Struct(vSelf, Color, pSelf); + return UINT2NUM((pSelf->r << 24) | (pSelf->g << 16) | (pSelf->b << 8) | pSelf->a); +} + +void Init_Color() +{ + g_cColor = rb_define_class_under(g_vModule, "Color", rb_cObject); + DEFINE_CLASS_METHOD(Color, new, -1); + DEFINE_INSTANCE_METHOD(Color, initialize, -1); + + DEFINE_STATIC_GETTER(Color, Black); + DEFINE_STATIC_GETTER(Color, White); + DEFINE_STATIC_GETTER(Color, Red); + DEFINE_STATIC_GETTER(Color, Green); + DEFINE_STATIC_GETTER(Color, Blue); + DEFINE_STATIC_GETTER(Color, Yellow); + DEFINE_STATIC_GETTER(Color, Magenta); + DEFINE_STATIC_GETTER(Color, Cyan); + + DEFINE_RW(Color, r); + DEFINE_RW(Color, g); + DEFINE_RW(Color, b); + DEFINE_RW(Color, a); + + DEFINE_INSTANCE_METHOD(Color, to_s, 0); + DEFINE_INSTANCE_METHOD(Color, toRGBA, 0); + DEFINE_INSTANCE_METHOD2(Color, toRGBA, to_i, 0); +} + diff --git a/ruby/RubySFML/sfDrawable.cpp b/ruby/RubySFML/sfDrawable.cpp new file mode 100644 index 00000000..a057ca6d --- /dev/null +++ b/ruby/RubySFML/sfDrawable.cpp @@ -0,0 +1,285 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +#include + +#ifdef _MSC_VER + #define COSF cosf + #define SINF sinf +#else + #define COSF cos + #define SINF sin +#endif + +using namespace sf; +#define PI 3.14159265f + +// Wrapper for Drawable that calls the Ruby version of virtual methods in case a Ruby class derives from this one +class rDrawable : public Drawable { +protected: + VALUE m_vSelf, m_vClass; + ID m_idRender; + bool m_bRender; + + virtual void Render(const RenderWindow &Window) const { + // If this method is overridden in Ruby, call it + if(m_bRender) { + VALUE vWindow = Data_Wrap_Struct(g_cRenderWindow, 0, 0, (void*)&Window); + VALUE vRet = rb_funcall(m_vSelf, m_idRender, 1, vWindow); + } else // else raise error (pure virtual method) + rb_raise(rb_eRuntimeError, "Pure virtual method Drawable::Render() called, but not defined."); + } + +public: + // Call as soon as you get a Ruby VALUE pointing to this object + void rInit(VALUE vSelf) { + // Need these for rb_funcall + m_vSelf = vSelf; + m_vClass = CLASS_OF(m_vSelf); + + // Initialize members for Render() virtual method + m_idRender = rb_intern("render"); + m_bRender = rb_method_boundp(m_vClass, m_idRender, 0) == Qtrue; + } +}; + + +VALUE g_cDrawable; + +void Drawable_free(void *p) { delete (Drawable *)p; } +VALUE Drawable_new(int argc, VALUE *argv, VALUE vClass) { + rDrawable *ptr = new rDrawable(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Drawable_free, ptr); + ptr->rInit(tData); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Drawable_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc >= 1 && argc <= 5 && (argc < 5 || IS(argv[4], g_cColor))) { + if(argc >= 1) + pSelf->SetLeft((float)NUM2DBL(argv[0])); + if(argc >= 2) + pSelf->SetTop((float)NUM2DBL(argv[1])); + if(argc >= 3) { + if(ISNUM(argv[2])) { + float f = (float)NUM2DBL(argv[2]); + pSelf->SetScale(f, f); + } else if(IS(argv[2], rb_cArray)) { + float x = (float)NUM2DBL(rb_ary_entry(argv[2], 0)); + float y = (float)NUM2DBL(rb_ary_entry(argv[2], 1)); + pSelf->SetScale(x, y); + } + } + if(argc >= 4) + pSelf->SetRotation((float)NUM2DBL(argv[3])); + if(argc >= 5) + pSelf->SetColor(*(Color *)DATA_PTR(argv[4])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Drawable_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Left=%f, Top=%f, Scale=[%f,%f], Rotation=%f", pSelf->GetLeft(), pSelf->GetTop(), pSelf->GetScaleX(), pSelf->GetScaleX(), pSelf->GetRotation()); + return rb_str_new2(szBuffer); +} + +static VALUE Drawable_set_left(VALUE vSelf, VALUE vLeft) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->SetLeft((float)NUM2DBL(vLeft)); + return Qnil; +} + +static VALUE Drawable_set_top(VALUE vSelf, VALUE vTop) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->SetTop((float)NUM2DBL(vTop)); + return Qnil; +} + +static VALUE Drawable_set_scale(VALUE vSelf, VALUE vScale) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + if(ISNUM(vScale)) { + float f = (float)NUM2DBL(vScale); + pSelf->SetScale(f, f); + } else if(IS(vScale, rb_cArray)) { + float x = (float)NUM2DBL(rb_ary_entry(vScale, 0)); + float y = (float)NUM2DBL(rb_ary_entry(vScale, 1)); + pSelf->SetScale(x, y); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +static VALUE Drawable_set_rotation(VALUE vSelf, VALUE vRotation) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->SetRotation((float)NUM2DBL(vRotation)); + return Qnil; +} + +static VALUE Drawable_setRotationCenter(VALUE vSelf, VALUE vX, VALUE vY) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->SetRotationCenter((float)NUM2DBL(vX), (float)NUM2DBL(vY)); + return Qnil; +} + +static VALUE Drawable_set_color(VALUE vSelf, VALUE vColor) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + if(!IS(vColor, g_cColor)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetColor(*(Color *)DATA_PTR(vColor)); + return Qnil; +} + +static VALUE Drawable_get_left(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + return rb_float_new(pSelf->GetLeft()); +} + +static VALUE Drawable_get_top(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + return rb_float_new(pSelf->GetTop()); +} + +static VALUE Drawable_get_scale(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + float x = pSelf->GetScaleX(); + float y = pSelf->GetScaleY(); + VALUE vArr = rb_ary_new(); + rb_ary_push(vArr, rb_float_new(x)); + rb_ary_push(vArr, rb_float_new(y)); + return vArr; +} + +static VALUE Drawable_get_rotation(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + return rb_float_new(pSelf->GetRotation()); +} + +static VALUE Drawable_get_upVector(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + float f = (pSelf->GetRotation() + 90) * (PI/180.0f); + VALUE v = rb_ary_new(); + rb_ary_push(v, rb_float_new(COSF(f))); + rb_ary_push(v, rb_float_new(-SINF(f))); + return v; +} + +static VALUE Drawable_get_rightVector(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + float f = pSelf->GetRotation() * (PI/180.0f); + VALUE v = rb_ary_new(); + rb_ary_push(v, rb_float_new(COSF(f))); + rb_ary_push(v, rb_float_new(-SINF(f))); + return v; +} + +static VALUE Drawable_get_color(VALUE vSelf) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + DECLARE_OBJ_VAR(Color, Color, pSelf->GetColor()); + return vColor; +} + +static VALUE Drawable_setPosition(VALUE vSelf, float vX, float vY) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->SetPosition((float)NUM2DBL(vX), (float)NUM2DBL(vY)); + return Qnil; +} + +static VALUE Drawable_move(VALUE vSelf, float vX, float vY) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->Move((float)NUM2DBL(vX), (float)NUM2DBL(vY)); + return Qnil; +} + +static VALUE Drawable_rotate(VALUE vSelf, VALUE vRotate) { + // Get C++ object pointer from vSelf + Drawable *pSelf; + Data_Get_Struct(vSelf, Drawable, pSelf); + pSelf->Rotate((float)NUM2DBL(vRotate)); + return Qnil; +} + +void Init_Drawable() +{ + g_cDrawable = rb_define_class_under(g_vModule, "Drawable", rb_cObject); + DEFINE_CLASS_METHOD(Drawable, new, -1); + DEFINE_INSTANCE_METHOD(Drawable, initialize, -1); + + DEFINE_RW(Drawable, left); + DEFINE_RW(Drawable, top); + DEFINE_RW(Drawable, scale); + DEFINE_RW(Drawable, color); + DEFINE_RW(Drawable, rotation); + DEFINE_GETTER(Drawable, upVector); + DEFINE_GETTER(Drawable, rightVector); + + DEFINE_INSTANCE_METHOD(Drawable, to_s, 0); + DEFINE_INSTANCE_METHOD(Drawable, setRotationCenter, 2); + DEFINE_INSTANCE_METHOD(Drawable, setPosition, 2); + DEFINE_INSTANCE_METHOD(Drawable, move, 2); + DEFINE_INSTANCE_METHOD(Drawable, rotate, 1); +} + diff --git a/ruby/RubySFML/sfEvent.cpp b/ruby/RubySFML/sfEvent.cpp new file mode 100644 index 00000000..6bc2c055 --- /dev/null +++ b/ruby/RubySFML/sfEvent.cpp @@ -0,0 +1,270 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cEvent; + +void Event_free(void *p) { delete (Event *)p; } +VALUE Event_new(int argc, VALUE *argv, VALUE vClass) { + Event *ptr = new Event(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Event_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Event_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(argc == 0) { + // Nothing to initialize + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Event_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + char szBuffer[1024]; + szBuffer[0] = 0; + switch(pSelf->Type) { + case Event::Closed: + strcpy(szBuffer, "Closed"); + break; + case Event::Resized: + sprintf(szBuffer, "Resized: Width=%d, Height=%d", pSelf->Size.Width, pSelf->Size.Height); + break; + case Event::LostFocus: + strcpy(szBuffer, "LostFocus"); + break; + case Event::GainedFocus: + strcpy(szBuffer, "GainedFocus"); + break; + case Event::TextEntered: + sprintf(szBuffer, "TextEntered: %C", pSelf->Text.Unicode); + break; + case Event::KeyPressed: + sprintf(szBuffer, "KeyPressed: Code=%d, Alt=%s, Ctrl=%s, Shift=%s", pSelf->Key.Code, pSelf->Key.Alt ? "true" : "false", pSelf->Key.Control ? "true" : "false", pSelf->Key.Shift ? "true" : "false"); + break; + case Event::KeyReleased: + sprintf(szBuffer, "KeyReleased: Code=%d, Alt=%s, Ctrl=%s, Shift=%s", pSelf->Key.Code, pSelf->Key.Alt ? "true" : "false", pSelf->Key.Control ? "true" : "false", pSelf->Key.Shift ? "true" : "false"); + break; + case Event::MouseWheelMoved: + sprintf(szBuffer, "MouseWheelMoved: Delta=%d", pSelf->MouseWheel.Delta); + case Event::MouseButtonPressed: + sprintf(szBuffer, "MouseButtonPressed: Button=%d", pSelf->MouseButton.Button); + break; + case Event::MouseButtonReleased: + sprintf(szBuffer, "MouseButtonReleased: Button=%d", pSelf->MouseButton.Button); + break; + case Event::MouseMoved: + sprintf(szBuffer, "MouseMoved: X=%d, Y=%d", pSelf->MouseMove.X, pSelf->MouseMove.Y); + break; + case Event::JoyButtonPressed: + sprintf(szBuffer, "JoyButtonPressed: Button=%d", pSelf->JoyButton.Button); + break; + case Event::JoyButtonReleased: + sprintf(szBuffer, "JoyButtonReleased: Button=%d", pSelf->JoyButton.Button); + break; + case Event::JoyMoved: + sprintf(szBuffer, "JoyMoved: Axis=%d, Pos=%f", pSelf->JoyMove.Axis, pSelf->JoyMove.Position); + break; + default: + sprintf(szBuffer, "Unsupported event type: %d", pSelf->Type); + break; + } + return rb_str_new2(szBuffer); +} + +static VALUE Event_type(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + return INT2FIX(pSelf->Type); +} + +static VALUE Event_char(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + char szBuffer[4]; + sprintf(szBuffer, "%C", pSelf->Text.Unicode); + return rb_str_new2(szBuffer); +} + +static VALUE Event_code(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::KeyPressed || pSelf->Type == Event::KeyReleased) + return INT2FIX(pSelf->Key.Code); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_alt(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::KeyPressed || pSelf->Type == Event::KeyReleased) + return pSelf->Key.Alt ? Qtrue : Qfalse; + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_control(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::KeyPressed || pSelf->Type == Event::KeyReleased) + return pSelf->Key.Control ? Qtrue : Qfalse; + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_shift(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::KeyPressed || pSelf->Type == Event::KeyReleased) + return pSelf->Key.Shift ? Qtrue : Qfalse; + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_delta(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::MouseWheelMoved) + return INT2FIX(pSelf->MouseWheel.Delta); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_buttons(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::MouseButtonPressed || pSelf->Type == Event::MouseButtonReleased) + return INT2FIX(pSelf->MouseButton.Button); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_button(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::JoyButtonPressed || pSelf->Type == Event::JoyButtonReleased) + return INT2FIX(pSelf->JoyButton.Button); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_x(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::MouseMoved) + return INT2FIX(pSelf->MouseMove.X); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_y(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::MouseMoved) + return INT2FIX(pSelf->MouseMove.Y); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_axis(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::JoyMoved) + return INT2FIX(pSelf->JoyMove.Axis); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_pos(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::JoyMoved) + return rb_float_new(pSelf->JoyMove.Position); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_width(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::Resized) + return INT2FIX(pSelf->Size.Width); + rb_raise(rb_eTypeError, "wrong event type"); +} + +static VALUE Event_height(VALUE vSelf) { + // Get C++ object pointer from vSelf + Event *pSelf; + Data_Get_Struct(vSelf, Event, pSelf); + if(pSelf->Type == Event::Resized) + return INT2FIX(pSelf->Size.Height); + rb_raise(rb_eTypeError, "wrong event type"); +} + +void Init_Event() +{ + g_cEvent = rb_define_class_under(g_vModule, "Event", rb_cObject); + DEFINE_CLASS_METHOD(Event, new, -1); + DEFINE_INSTANCE_METHOD(Event, initialize, -1); + + // For any event type + DEFINE_INSTANCE_METHOD(Event, to_s, 0); + DEFINE_INSTANCE_METHOD(Event, type, 0); + + // For text events + DEFINE_INSTANCE_METHOD(Event, char, 0); + + // For keyboard event types + DEFINE_INSTANCE_METHOD(Event, code, 0); + DEFINE_INSTANCE_METHOD(Event, alt, 0); + DEFINE_INSTANCE_METHOD(Event, control, 0); + DEFINE_INSTANCE_METHOD(Event, shift, 0); + + // For mouse/joystick event types + DEFINE_INSTANCE_METHOD(Event, delta, 0); + DEFINE_INSTANCE_METHOD(Event, buttons, 0); + DEFINE_INSTANCE_METHOD(Event, button, 0); + DEFINE_INSTANCE_METHOD(Event, x, 0); + DEFINE_INSTANCE_METHOD(Event, y, 0); + DEFINE_INSTANCE_METHOD(Event, axis, 0); + DEFINE_INSTANCE_METHOD(Event, pos, 0); + + // For size event types + DEFINE_INSTANCE_METHOD(Event, width, 0); + DEFINE_INSTANCE_METHOD(Event, height, 0); +} + diff --git a/ruby/RubySFML/sfFloatRect.cpp b/ruby/RubySFML/sfFloatRect.cpp new file mode 100644 index 00000000..d09bcae1 --- /dev/null +++ b/ruby/RubySFML/sfFloatRect.cpp @@ -0,0 +1,155 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cFloatRect; + +DECLARE_DOUBLE_RW(FloatRect, Left); +DECLARE_DOUBLE_RW(FloatRect, Top); +DECLARE_DOUBLE_RW(FloatRect, Right); +DECLARE_DOUBLE_RW(FloatRect, Bottom); + + +void FloatRect_free(void *p) { delete (FloatRect *)p; } +VALUE FloatRect_new(int argc, VALUE *argv, VALUE vClass) { + FloatRect *ptr = new FloatRect(); + VALUE tData = Data_Wrap_Struct(vClass, 0, FloatRect_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE FloatRect_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 4 && + ISNUM(argv[0]) && + ISNUM(argv[1]) && + ISNUM(argv[2]) && + ISNUM(argv[3])) { + pSelf->Left = (float)NUM2DBL(argv[0]); + pSelf->Top = (float)NUM2DBL(argv[1]); + pSelf->Right = (float)NUM2DBL(argv[2]); + pSelf->Bottom = (float)NUM2DBL(argv[3]); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE FloatRect_to_s(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Left=%f, Top=%f, Right=%f, Bottom=%f", pSelf->Left, pSelf->Top, pSelf->Right, pSelf->Bottom); + return rb_str_new2(szBuffer); +} + +static VALUE FloatRect_get_Width(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + return rb_float_new(pSelf->GetWidth()); +} + +static VALUE FloatRect_set_Width(VALUE vSelf, VALUE vWidth) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + float nWidth = (float)NUM2DBL(vWidth); + pSelf->Right = pSelf->Left + nWidth; + return vWidth; +} + +static VALUE FloatRect_get_Height(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + return rb_float_new(pSelf->GetHeight()); +} + +static VALUE FloatRect_set_Height(VALUE vSelf, VALUE vHeight) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + float nHeight = (float)NUM2DBL(vHeight); + pSelf->Bottom = pSelf->Top + nHeight; + return vHeight; +} + +static VALUE FloatRect_contains(VALUE vSelf, VALUE x, VALUE y) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf; + Data_Get_Struct(vSelf, FloatRect, pSelf); + return pSelf->Contains((float)NUM2DBL(x), (float)NUM2DBL(y)) ? Qtrue : Qfalse; +} + +static VALUE FloatRect_intersects(VALUE vSelf, VALUE vRect) +{ + // Get C++ object pointer from vSelf + FloatRect *pSelf = NULL, *pRect = NULL; + FloatRect r; + Data_Get_Struct(vSelf, FloatRect, pSelf); + Data_Get_Struct(vRect, FloatRect, pRect); + if(!pSelf->Intersects(*pRect, &r)) + return Qnil; + DECLARE_OBJ_VAR(FloatRect, Result, r); + return vResult; +} + +void Init_FloatRect() +{ + g_cFloatRect = rb_define_class_under(g_vModule, "FloatRect", rb_cObject); + DEFINE_CLASS_METHOD(FloatRect, new, -1); + DEFINE_INSTANCE_METHOD(FloatRect, initialize, -1); + + DEFINE_RW2(FloatRect, Left, left); + DEFINE_RW2(FloatRect, Left, l); + DEFINE_RW2(FloatRect, Top, top); + DEFINE_RW2(FloatRect, Top, t); + DEFINE_RW2(FloatRect, Right, right); + DEFINE_RW2(FloatRect, Right, r); + DEFINE_RW2(FloatRect, Bottom, bottom); + DEFINE_RW2(FloatRect, Bottom, b); + DEFINE_RW2(FloatRect, Width, width); + DEFINE_RW2(FloatRect, Width, w); + DEFINE_RW2(FloatRect, Height, height); + DEFINE_RW2(FloatRect, Height, h); + + DEFINE_INSTANCE_METHOD(FloatRect, to_s, 0); + DEFINE_INSTANCE_METHOD(FloatRect, contains, 2); + DEFINE_INSTANCE_METHOD(FloatRect, intersects, 1); +} + diff --git a/ruby/RubySFML/sfImage.cpp b/ruby/RubySFML/sfImage.cpp new file mode 100644 index 00000000..7f861100 --- /dev/null +++ b/ruby/RubySFML/sfImage.cpp @@ -0,0 +1,238 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cImage; + +void Image_free(void *p) { delete (Image *)p; } +VALUE Image_new(int argc, VALUE *argv, VALUE vClass) { + Image *ptr = new Image(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Image_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Image_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 1 && IS(argv[0], g_cImage)) { + *pSelf = *(Image *)DATA_PTR(argv[0]); + } else if(argc == 1 && ISSTR(argv[0])) { + if(!pSelf->LoadFromFile(STR2CSTR(argv[0]))) + rb_raise(rb_eRuntimeError, "Failed to load specified image file"); + } else if(argc >= 2 && argc <= 3 && + ISNUM(argv[0]) && + ISNUM(argv[1]) && + (argc < 3 || IS(argv[2], g_cColor))) { + pSelf->Create(NUM2INT(argv[0]), NUM2INT(argv[1]), + argc < 3 ? Color::Black : *(Color *)DATA_PTR(argv[2])); + } else if(argc == 2 && + ISSTR(argv[0]) && + ISNUM(argv[1])) { + pSelf->LoadFromMemory(STR2CSTR(argv[2]), NUM2INT(argv[0])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Image_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Width=%d, Height=%d", pSelf->GetWidth(), pSelf->GetHeight()); + return rb_str_new2(szBuffer); +} + +static VALUE Image_loadFromFile(VALUE vSelf, VALUE vPath) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + return pSelf->LoadFromFile(STR2CSTR(vPath)) ? Qtrue : Qfalse; +} + +static VALUE Image_saveToFile(VALUE vSelf, VALUE vPath) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + return pSelf->SaveToFile(STR2CSTR(vPath)) ? Qtrue : Qfalse; +} + +static VALUE Image_create(VALUE vSelf, VALUE vWidth, VALUE vHeight, VALUE vColor) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + if(!IS(vColor, g_cColor)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return pSelf->Create(NUM2INT(vWidth), NUM2INT(vHeight), *(Color *)DATA_PTR(vColor)); +} + +static VALUE Image_loadFromMemory(VALUE vSelf, VALUE vData, VALUE vSize) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + return pSelf->LoadFromMemory(STR2CSTR(vData), NUM2INT(vSize)); +} + +static VALUE Image_createMaskFromColor(VALUE vSelf, VALUE vColor) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + if(IS(vColor, g_cColor)) + pSelf->CreateMaskFromColor(*(Color *)DATA_PTR(vColor)); + else if(ISNUM(vColor)) { + DWORD dw = NUM2UINT(vColor); + Color c((dw >> 24) & 0xFF, (dw >> 16) & 0xFF, (dw >> 8) & 0xFF, (dw >> 0) & 0xFF); + pSelf->CreateMaskFromColor(c); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +static VALUE Image_resize(VALUE vSelf, VALUE vWidth, VALUE vHeight, VALUE vColor) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + if(IS(vColor, g_cColor)) + return pSelf->Resize(NUM2INT(vWidth), NUM2INT(vHeight), *(Color *)DATA_PTR(vColor)); + else if(ISNUM(vColor)) { + DWORD dw = NUM2UINT(vColor); + Color c((dw >> 24) & 0xFF, (dw >> 16) & 0xFF, (dw >> 8) & 0xFF, (dw >> 0) & 0xFF); + return pSelf->Resize(NUM2INT(vWidth), NUM2INT(vHeight), c); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +static VALUE Image_setPixel(VALUE vSelf, VALUE vX, VALUE vY, VALUE vColor) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + if(IS(vColor, g_cColor)) + pSelf->SetPixel(NUM2INT(vX), NUM2INT(vY), *(Color *)DATA_PTR(vColor)); + else if(ISNUM(vColor)) { + DWORD dw = NUM2UINT(vColor); + Color c((dw >> 24) & 0xFF, (dw >> 16) & 0xFF, (dw >> 8) & 0xFF, (dw >> 0) & 0xFF); + pSelf->SetPixel(NUM2INT(vX), NUM2INT(vY), c); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +static VALUE Image_getPixel(VALUE vSelf, VALUE vX, VALUE vY) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + DECLARE_OBJ_VAR(Color, Color, pSelf->GetPixel(NUM2INT(vX), NUM2INT(vY))); + return vColor; +} + +static VALUE Image_bind(VALUE vSelf) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + pSelf->Bind(); + return Qnil; +} + +static VALUE Image_set_smooth(VALUE vSelf, VALUE vSmooth) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + pSelf->SetSmooth(RTEST(vSmooth)); + return Qnil; +} + +static VALUE Image_set_repeat(VALUE vSelf, VALUE vRepeat) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + pSelf->SetRepeat(RTEST(vRepeat)); + return Qnil; +} + +static VALUE Image_get_width(VALUE vSelf) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + return INT2FIX(pSelf->GetWidth()); +} + +static VALUE Image_get_height(VALUE vSelf) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + return INT2FIX(pSelf->GetHeight()); +} + +static VALUE Image_getTexCoords(VALUE vSelf, VALUE vRect) { + // Get C++ object pointer from vSelf + Image *pSelf; + Data_Get_Struct(vSelf, Image, pSelf); + if(!IS(vRect, g_cIntRect)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + DECLARE_OBJ_VAR(FloatRect, Coord, pSelf->GetTexCoords(*(IntRect *)DATA_PTR(vRect))); + return vCoord; +} + +static VALUE Image_getValidTextureSize(VALUE vClass, VALUE vSize) { + // Get C++ object pointer from vSelf + return INT2FIX(Image::GetValidTextureSize(NUM2INT(vSize))); +} + +void Init_Image() +{ + g_cImage = rb_define_class_under(g_vModule, "Image", rb_cObject); + DEFINE_CLASS_METHOD(Image, new, -1); + DEFINE_CLASS_METHOD(Image, getValidTextureSize, 1); + DEFINE_INSTANCE_METHOD(Image, initialize, -1); + + DEFINE_SETTER(Image, smooth); + DEFINE_SETTER(Image, repeat); + DEFINE_GETTER(Image, width); + DEFINE_GETTER2(Image, width, w); + DEFINE_GETTER(Image, height); + DEFINE_GETTER2(Image, height, h); + + DEFINE_INSTANCE_METHOD(Image, to_s, 0); + DEFINE_INSTANCE_METHOD(Image, loadFromFile, 1); + DEFINE_INSTANCE_METHOD(Image, saveToFile, 1); + DEFINE_INSTANCE_METHOD(Image, create, 3); + DEFINE_INSTANCE_METHOD(Image, loadFromMemory, 2); + DEFINE_INSTANCE_METHOD(Image, createMaskFromColor, 1); + DEFINE_INSTANCE_METHOD(Image, resize, 3); + DEFINE_INSTANCE_METHOD(Image, setPixel, 3); + DEFINE_INSTANCE_METHOD(Image, getPixel, 2); + DEFINE_INSTANCE_METHOD(Image, bind, 0); + DEFINE_INSTANCE_METHOD(Image, getTexCoords, 1); + DEFINE_INSTANCE_METHOD2(Image, getPixel, [], 2); + DEFINE_INSTANCE_METHOD2(Image, setPixel, []=, 2); +} + diff --git a/ruby/RubySFML/sfInput.cpp b/ruby/RubySFML/sfInput.cpp new file mode 100644 index 00000000..7c759021 --- /dev/null +++ b/ruby/RubySFML/sfInput.cpp @@ -0,0 +1,105 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cInput; + +void Input_free(void *p) { delete (Input *)p; } +VALUE Input_new(int argc, VALUE *argv, VALUE vClass) { + Input *ptr = new Input(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Input_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Input_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + if(argc == 0) { + // Nothing to initialize + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Input_isKeyDown(VALUE vSelf, VALUE vKey) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + return pSelf->IsKeyDown((Key::Code)NUM2INT(vKey)) ? Qtrue : Qfalse; +} + +static VALUE Input_isMouseButtonDown(VALUE vSelf, VALUE vButton) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + return pSelf->IsMouseButtonDown((Mouse::Button)NUM2INT(vButton)) ? Qtrue : Qfalse; +} + +static VALUE Input_isJoystickButtonDown(VALUE vSelf, VALUE vJoy, VALUE vButton) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + return pSelf->IsJoystickButtonDown(NUM2INT(vJoy), NUM2INT(vButton)) ? Qtrue : Qfalse; +} + +static VALUE Input_getMouseX(VALUE vSelf) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + return INT2FIX(pSelf->GetMouseX()); +} + +static VALUE Input_getMouseY(VALUE vSelf) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + return INT2FIX(pSelf->GetMouseY()); +} + +static VALUE Input_getJoystickAxis(VALUE vSelf, VALUE vJoy, VALUE vAxis) { + // Get C++ object pointer from vSelf + Input *pSelf; + Data_Get_Struct(vSelf, Input, pSelf); + return INT2FIX(pSelf->GetJoystickAxis(NUM2INT(vJoy), (Joy::Axis)NUM2INT(vAxis))); +} + +void Init_Input() +{ + g_cInput = rb_define_class_under(g_vModule, "Input", rb_cObject); + DEFINE_CLASS_METHOD(Input, new, -1); + DEFINE_INSTANCE_METHOD(Input, initialize, -1); + + DEFINE_INSTANCE_METHOD(Input, isKeyDown, 1); + DEFINE_INSTANCE_METHOD(Input, isMouseButtonDown, 1); + DEFINE_INSTANCE_METHOD(Input, isJoystickButtonDown, 2); + DEFINE_INSTANCE_METHOD(Input, getMouseX, 0); + DEFINE_INSTANCE_METHOD(Input, getMouseY, 0); + DEFINE_INSTANCE_METHOD(Input, getJoystickAxis, 2); +} + diff --git a/ruby/RubySFML/sfIntRect.cpp b/ruby/RubySFML/sfIntRect.cpp new file mode 100644 index 00000000..44bee564 --- /dev/null +++ b/ruby/RubySFML/sfIntRect.cpp @@ -0,0 +1,157 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cIntRect; + +DECLARE_INT_RW(IntRect, Left); +DECLARE_INT_RW(IntRect, Top); +DECLARE_INT_RW(IntRect, Right); +DECLARE_INT_RW(IntRect, Bottom); + + +void IntRect_free(void *p) { delete (IntRect *)p; } +VALUE IntRect_new(int argc, VALUE *argv, VALUE vClass) { + // For each version of this method, convert Ruby args to C++ types (applying default values) + IntRect *ptr = new IntRect(); + VALUE tData = Data_Wrap_Struct(vClass, 0, IntRect_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE IntRect_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 4 && + ISNUM(argv[0]) && + ISNUM(argv[1]) && + ISNUM(argv[2]) && + ISNUM(argv[3])) { + pSelf->Left = NUM2INT(argv[0]); + pSelf->Top = NUM2INT(argv[1]); + pSelf->Right = NUM2INT(argv[2]); + pSelf->Bottom = NUM2INT(argv[3]); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + + return vSelf; +} + +static VALUE IntRect_to_s(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Left=%d, Top=%d, Right=%d, Bottom=%d", pSelf->Left, pSelf->Top, pSelf->Right, pSelf->Bottom); + return rb_str_new2(szBuffer); +} + +static VALUE IntRect_get_Width(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + return INT2NUM(pSelf->GetWidth()); +} + +static VALUE IntRect_set_Width(VALUE vSelf, VALUE vWidth) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + int nWidth = NUM2INT(vWidth); + pSelf->Right = pSelf->Left + nWidth; + return vWidth; +} + +static VALUE IntRect_get_Height(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + return INT2NUM(pSelf->GetHeight()); +} + +static VALUE IntRect_set_Height(VALUE vSelf, VALUE vHeight) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + int nHeight = NUM2INT(vHeight); + pSelf->Bottom = pSelf->Top + nHeight; + return vHeight; +} + +static VALUE IntRect_contains(VALUE vSelf, VALUE x, VALUE y) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf; + Data_Get_Struct(vSelf, IntRect, pSelf); + return pSelf->Contains(NUM2INT(x), NUM2INT(y)) ? Qtrue : Qfalse; +} + +static VALUE IntRect_intersects(VALUE vSelf, VALUE vRect) +{ + // Get C++ object pointer from vSelf + IntRect *pSelf = NULL, *pRect = NULL; + IntRect r; + Data_Get_Struct(vSelf, IntRect, pSelf); + Data_Get_Struct(vRect, IntRect, pRect); + if(!pSelf->Intersects(*pRect, &r)) + return Qnil; + DECLARE_OBJ_VAR(IntRect, Result, r); + return vResult; +} + +void Init_IntRect() +{ + g_cIntRect = rb_define_class_under(g_vModule, "IntRect", rb_cObject); + DEFINE_CLASS_METHOD(IntRect, new, -1); + DEFINE_INSTANCE_METHOD(IntRect, initialize, -1); + + DEFINE_RW2(IntRect, Left, left); + DEFINE_RW2(IntRect, Left, l); + DEFINE_RW2(IntRect, Top, top); + DEFINE_RW2(IntRect, Top, t); + DEFINE_RW2(IntRect, Right, right); + DEFINE_RW2(IntRect, Right, r); + DEFINE_RW2(IntRect, Bottom, bottom); + DEFINE_RW2(IntRect, Bottom, b); + DEFINE_RW2(IntRect, Width, width); + DEFINE_RW2(IntRect, Width, w); + DEFINE_RW2(IntRect, Height, height); + DEFINE_RW2(IntRect, Height, h); + + DEFINE_INSTANCE_METHOD(IntRect, to_s, 0); + DEFINE_INSTANCE_METHOD(IntRect, contains, 2); + DEFINE_INSTANCE_METHOD(IntRect, intersects, 1); +} + diff --git a/ruby/RubySFML/sfMusic.cpp b/ruby/RubySFML/sfMusic.cpp new file mode 100644 index 00000000..d0a73ac0 --- /dev/null +++ b/ruby/RubySFML/sfMusic.cpp @@ -0,0 +1,153 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cMusic; + +void Music_free(void *p) { delete (Music *)p; } + +VALUE Music_new(int argc, VALUE *argv, VALUE vClass) { + Music *ptr = NULL; + if(argc == 1 && ISNUM(argv[0])) + ptr = new Music(NUM2INT(argv[0])); + else + ptr = new Music(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Music_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Music_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 1 && ISNUM(argv[0])) { + // Was forced to set this above in Music_new() + } else if(argc == 1 && ISSTR(argv[0])) { + if(!pSelf->Open(STR2CSTR(argv[0]))) + rb_raise(rb_eRuntimeError, "Failed to load specified music file"); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + + return vSelf; +} + +static VALUE Music_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Channels=%d, SampleRate=%d, Duration=%f, Status=%s", pSelf->GetChannelsCount(), pSelf->GetSampleRate(), pSelf->GetDuration(), pSelf->GetStatus() == Sound::Playing ? "playing" : pSelf->GetStatus() == Sound::Paused ? "paused" : "stopped"); + return rb_str_new2(szBuffer); +} + +static VALUE Music_open(VALUE vSelf, VALUE vFile) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + return pSelf->Open(STR2CSTR(vFile)) ? Qtrue : Qfalse; +} + +static VALUE Music_play(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + pSelf->Play(); + return Qnil; +} + +static VALUE Music_stop(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + pSelf->Stop(); + return Qnil; +} + +static VALUE Music_set_loop(VALUE vSelf, VALUE vLoop) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + pSelf->SetLoop(RTEST(vLoop)); + return Qnil; +} + +static VALUE Music_get_loop(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + return pSelf->GetLoop() ? Qtrue : Qfalse; +} + +static VALUE Music_get_duration(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + return rb_float_new(pSelf->GetDuration()); +} + +static VALUE Music_get_channels(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + return INT2FIX(pSelf->GetChannelsCount()); +} + +static VALUE Music_get_sampleRate(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + return INT2FIX(pSelf->GetSampleRate()); +} + +static VALUE Music_get_status(VALUE vSelf) { + // Get C++ object pointer from vSelf + Music *pSelf; + Data_Get_Struct(vSelf, Music, pSelf); + return INT2FIX(pSelf->GetStatus()); +} + +void Init_Music() +{ + g_cMusic = rb_define_class_under(g_vModule, "Music", rb_cObject); + DEFINE_CLASS_METHOD(Music, new, -1); + DEFINE_INSTANCE_METHOD(Music, initialize, -1); + + DEFINE_RW(Music, loop); + DEFINE_GETTER(Music, duration); + DEFINE_GETTER(Music, status); + DEFINE_GETTER(Music, channels); + DEFINE_GETTER(Music, sampleRate); + + DEFINE_INSTANCE_METHOD(Music, to_s, 0); + DEFINE_INSTANCE_METHOD(Music, open, 1); + DEFINE_INSTANCE_METHOD(Music, play, 0); + DEFINE_INSTANCE_METHOD(Music, stop, 0); +} + diff --git a/ruby/RubySFML/sfPostFX.cpp b/ruby/RubySFML/sfPostFX.cpp new file mode 100644 index 00000000..810987fa --- /dev/null +++ b/ruby/RubySFML/sfPostFX.cpp @@ -0,0 +1,147 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +// Wrapper for PostFX that calls the Ruby version of virtual methods in case a Ruby class derives from this one +class rPostFX : public PostFX { +protected: + VALUE m_vSelf, m_vClass; + ID m_idRender; + bool m_bRender, m_bInRender; + + virtual void Render(const RenderWindow &Window) const { + // If this method is overridden in Ruby, call it + if(m_bRender) { + VALUE vWindow = Data_Wrap_Struct(g_cRenderWindow, 0, 0, (void*)&Window); + VALUE vRet = rb_funcall(m_vSelf, m_idRender, 1, vWindow); + } else // else call parent + PostFX::Render(Window); + } + +public: + // Damn constructors should be inherited from base class + rPostFX() : PostFX() {} + rPostFX(const PostFX &Copy) : PostFX(Copy) {} + + // Call as soon as you get a Ruby VALUE pointing to this object + void rInit(VALUE vSelf) { + // Need these for rb_funcall + m_vSelf = vSelf; + m_vClass = CLASS_OF(m_vSelf); + + // Initialize members for Render() virtual method + m_idRender = rb_intern("render"); + m_bRender = rb_method_boundp(m_vClass, m_idRender, 0) == Qtrue; + } + + // When an overridden method in Ruby calls super(), it is called this way + VALUE Render(VALUE vWindow) { + PostFX::Render(*(RenderWindow *)DATA_PTR(vWindow)); + return Qnil; + } +}; + + +VALUE g_cPostFX; + +void PostFX_free(void *p) { delete (PostFX *)p; } +VALUE PostFX_new(int argc, VALUE *argv, VALUE vClass) { + // For each version of this method, convert Ruby args to C++ types (applying default values) + rPostFX *ptr = new rPostFX(); + VALUE tData = Data_Wrap_Struct(vClass, 0, PostFX_free, ptr); + ptr->rInit(tData); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE PostFX_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + PostFX *pSelf; + Data_Get_Struct(vSelf, PostFX, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 1 && ISSTR(argv[0])) { + pSelf->LoadFromFile(STR2CSTR(argv[0])); + } else if(argc == 1 && IS(argv[0], g_cPostFX)) { + *pSelf = *(PostFX *)DATA_PTR(argv[0]); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE PostFX_loadFromFile(VALUE vSelf, VALUE vFile) { + // Get C++ object pointer from vSelf + PostFX *pSelf; + Data_Get_Struct(vSelf, PostFX, pSelf); + return pSelf->LoadFromFile(STR2CSTR(vFile)) ? Qtrue : Qfalse; +} + +static VALUE PostFX_setParameter(int argc, VALUE *argv, VALUE vSelf) { + PostFX *pSelf; + Data_Get_Struct(vSelf, PostFX, pSelf); + if(argc == 2 && ISSTR(argv[0]) && ISNUM(argv[1])) { + pSelf->SetParameter(STR2CSTR(argv[0]), (float)NUM2DBL(argv[1])); + } else if(argc == 3 && ISSTR(argv[0]) && ISNUM(argv[1]) && ISNUM(argv[2])) { + pSelf->SetParameter(STR2CSTR(argv[0]), (float)NUM2DBL(argv[1]), (float)NUM2DBL(argv[2])); + } else if(argc == 4 && ISSTR(argv[0]) && ISNUM(argv[1]) && ISNUM(argv[2]) && ISNUM(argv[3])) { + pSelf->SetParameter(STR2CSTR(argv[0]), (float)NUM2DBL(argv[1]), (float)NUM2DBL(argv[2]), (float)NUM2DBL(argv[3])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +static VALUE PostFX_setTexture(VALUE vSelf, VALUE vName, VALUE vImage) { + // Get C++ object pointer from vSelf + PostFX *pSelf; + Data_Get_Struct(vSelf, PostFX, pSelf); + if(!IS(vImage, g_cImage)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetTexture(STR2CSTR(vName), (Image *)DATA_PTR(vImage)); + return Qnil; +} + +static VALUE PostFX_render(VALUE vSelf, VALUE vWindow) { + // Get C++ object pointer from vSelf + rPostFX *pSelf; + Data_Get_Struct(vSelf, rPostFX, pSelf); + return pSelf->Render(vWindow); +} + +void Init_PostFX() +{ + g_cPostFX = rb_define_class_under(g_vModule, "PostFX", g_cDrawable); + DEFINE_CLASS_METHOD(PostFX, new, -1); + DEFINE_INSTANCE_METHOD(PostFX, initialize, -1); + + DEFINE_INSTANCE_METHOD(PostFX, setParameter, -1); + DEFINE_INSTANCE_METHOD(PostFX, loadFromFile, 1); + DEFINE_INSTANCE_METHOD(PostFX, setTexture, 2); + + // Virtual method + DEFINE_INSTANCE_METHOD(PostFX, render, 1); +} + diff --git a/ruby/RubySFML/sfRenderWindow.cpp b/ruby/RubySFML/sfRenderWindow.cpp new file mode 100644 index 00000000..368b3632 --- /dev/null +++ b/ruby/RubySFML/sfRenderWindow.cpp @@ -0,0 +1,237 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cRenderWindow; + +void RenderWindow_free(void *p) { delete (RenderWindow *)p; } +VALUE RenderWindow_new(int argc, VALUE *argv, VALUE vClass) { + // For each version of this method, convert Ruby args to C++ types (applying default values) + RenderWindow *ptr = new RenderWindow(); + VALUE tData = Data_Wrap_Struct(vClass, 0, RenderWindow_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE RenderWindow_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + if(argc >= 2 && argc <= 4 && + IS(argv[0], g_cVideoMode) && + ISSTR(argv[1]) && + (argc < 3 || true) && + (argc < 4 || ISNUM(argv[3]))) { + pSelf->Create( + *(VideoMode *)DATA_PTR(argv[0]), + STR2CSTR(argv[1]), + argc < 3 ? (Style::Resize | Style::Close) : NUM2INT(argv[2]), + argc < 4 ? 0 : NUM2INT(argv[3])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE RenderWindow_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Height: %d, Width: %d, Depth Bits: %d, Stencil Bits: %d", pSelf->GetWidth(), pSelf->GetHeight(), pSelf->GetDepthBits(), pSelf->GetStencilBits()); + return rb_str_new2(szBuffer); +} + +static VALUE RenderWindow_get_width(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + return INT2FIX(pSelf->GetWidth()); +} + +static VALUE RenderWindow_get_height(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + return INT2FIX(pSelf->GetHeight()); +} + +static VALUE RenderWindow_get_depthBits(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + return INT2FIX(pSelf->GetDepthBits()); +} + +static VALUE RenderWindow_get_stencilBits(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + return INT2FIX(pSelf->GetStencilBits()); +} + +static VALUE RenderWindow_get_frameTime(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + return rb_float_new(pSelf->GetFrameTime()); +} + +static VALUE RenderWindow_get_input(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + DECLARE_PTR_VAR(Input, Input, (Input *)&pSelf->GetInput()); + return vInput; +} + +static VALUE RenderWindow_getEvent(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + Event ePoll; + if(!pSelf->GetEvent(ePoll)) + return Qnil; + DECLARE_OBJ_VAR(Event, Event, ePoll); + return vEvent; +} + +static VALUE RenderWindow_useVerticalSync(VALUE vSelf, VALUE vEnabled) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + pSelf->UseVerticalSync(RTEST(vEnabled) != 0); + return Qnil; +} + +static VALUE RenderWindow_showMouseCursor(VALUE vSelf, VALUE vShow) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + pSelf->ShowMouseCursor(RTEST(vShow) != 0); + return Qnil; +} + +static VALUE RenderWindow_display(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + pSelf->Display(); + return Qnil; +} + +static VALUE RenderWindow_optimize(VALUE vSelf, VALUE vBool) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + pSelf->OptimizeForNonOpenGL(RTEST(vBool)); + return Qnil; +} + +static VALUE RenderWindow_capture(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + DECLARE_OBJ_VAR(Image, Image, pSelf->Capture()); + return vImage; +} + +static VALUE RenderWindow_get_view(VALUE vSelf) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + DECLARE_OBJ_VAR(FloatRect, Rect, pSelf->GetViewRect()); + return vRect; +} + +static VALUE RenderWindow_set_view(VALUE vSelf, VALUE vView) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + View *pView; + Data_Get_Struct(vView, View, pView); + pSelf->SetView(pView); + return Qnil; +} + +static VALUE RenderWindow_set_backgroundColor(VALUE vSelf, VALUE vColor) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + Color *pColor; + Data_Get_Struct(vColor, Color, pColor); + pSelf->SetBackgroundColor(*pColor); + return Qnil; +} + +static VALUE RenderWindow_draw(VALUE vSelf, VALUE vObject) { + if(!ISKO(vObject, g_cDrawable)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + Drawable *pObject; + Data_Get_Struct(vObject, Drawable, pObject); + pSelf->Draw(*pObject); + return Qnil; +} + +static VALUE RenderWindow_setFramerateLimit(VALUE vSelf, VALUE vLimit) { + // Get C++ object pointer from vSelf + RenderWindow *pSelf; + Data_Get_Struct(vSelf, RenderWindow, pSelf); + pSelf->SetFramerateLimit((unsigned int)NUM2INT(vLimit)); + return Qnil; +} + +void Init_RenderWindow() +{ + g_cRenderWindow = rb_define_class_under(g_vModule, "RenderWindow", rb_cObject); + DEFINE_CLASS_METHOD(RenderWindow, new, -1); + DEFINE_INSTANCE_METHOD(RenderWindow, initialize, -1); + + DEFINE_GETTER(RenderWindow, width); + DEFINE_GETTER2(RenderWindow, width, w); + DEFINE_GETTER(RenderWindow, height); + DEFINE_GETTER2(RenderWindow, height, h); + DEFINE_GETTER(RenderWindow, input); + DEFINE_GETTER(RenderWindow, frameTime); + DEFINE_GETTER(RenderWindow, stencilBits); + DEFINE_GETTER(RenderWindow, depthBits); + DEFINE_RW(RenderWindow, view); + DEFINE_SETTER(RenderWindow, backgroundColor); + + DEFINE_INSTANCE_METHOD(RenderWindow, to_s, 0); + DEFINE_INSTANCE_METHOD(RenderWindow, getEvent, 0); // Don't use GETTER + DEFINE_INSTANCE_METHOD(RenderWindow, useVerticalSync, 1); + DEFINE_INSTANCE_METHOD(RenderWindow, showMouseCursor, 1); + DEFINE_INSTANCE_METHOD(RenderWindow, display, 0); + DEFINE_INSTANCE_METHOD(RenderWindow, optimize, 1); + DEFINE_INSTANCE_METHOD(RenderWindow, capture, 0); + DEFINE_INSTANCE_METHOD(RenderWindow, draw, 1); + DEFINE_INSTANCE_METHOD(RenderWindow, setFramerateLimit, 1); +} + diff --git a/ruby/RubySFML/sfSound.cpp b/ruby/RubySFML/sfSound.cpp new file mode 100644 index 00000000..8b9511f7 --- /dev/null +++ b/ruby/RubySFML/sfSound.cpp @@ -0,0 +1,219 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cSound; + +void Sound_free(void *p) { delete (Sound *)p; } +VALUE Sound_new(int argc, VALUE *argv, VALUE vClass) { + Sound *ptr = new Sound(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Sound_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Sound_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + if(argc == 1 && IS(argv[0], g_cSound)) { + *pSelf = *(Sound *)DATA_PTR(argv[0]); + } else if(argc >= 0 && argc <= 7 && + (argc < 1 || IS(argv[0], g_cSoundBuffer))) { + if(argc >= 1) + pSelf->SetBuffer(*(SoundBuffer *)DATA_PTR(argv[0])); + if(argc >= 2) + pSelf->SetLoop(RTEST(argv[1]) != 0); + if(argc >= 3) + pSelf->SetPitch((float)NUM2DBL(argv[2])); + if(argc >= 4) + pSelf->SetVolume((float)NUM2DBL(argv[3])); + if(argc >= 5) { + float x = argc < 5 ? 0.0f : (float)NUM2DBL(argv[4]); + float y = argc < 6 ? 0.0f : (float)NUM2DBL(argv[5]); + float z = argc < 7 ? 0.0f : (float)NUM2DBL(argv[6]); + pSelf->SetPosition(x, y, z); + } + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Sound_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + char szBuffer[256]; + float x, y, z; + pSelf->GetPosition(x, y, z); + sprintf(szBuffer, "Loop=%s, Pitch=%2.2f, Volume=%2.2f, Position=(%2.2f,%2.2f,%2.2f), Status=%s", pSelf->GetLoop() ? "true":"false", pSelf->GetPitch(), pSelf->GetVolume(), x, y, z, pSelf->GetStatus() == Sound::Playing ? "playing" : pSelf->GetStatus() == Sound::Paused ? "paused" : "stopped"); + return rb_str_new2(szBuffer); +} + +static VALUE Sound_play(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->Play(); + return Qnil; +} + +static VALUE Sound_pause(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->Pause(); + return Qnil; +} + +static VALUE Sound_stop(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->Stop(); + return Qnil; +} + +static VALUE Sound_set_buffer(VALUE vSelf, VALUE vBuffer) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + if(!IS(vBuffer, g_cSoundBuffer)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetBuffer(*(SoundBuffer *)DATA_PTR(vBuffer)); + return Qnil; +} + +static VALUE Sound_set_loop(VALUE vSelf, VALUE vLoop) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->SetLoop(RTEST(vLoop)); + return Qnil; +} + +static VALUE Sound_set_pitch(VALUE vSelf, VALUE vPitch) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->SetLoop((float)NUM2DBL(vPitch)); + return Qnil; +} + +static VALUE Sound_set_volume(VALUE vSelf, VALUE vVolume) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->SetVolume((float)NUM2DBL(vVolume)); + return Qnil; +} + +static VALUE Sound_set_position(VALUE vSelf, VALUE vX, VALUE vY, VALUE vZ) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + pSelf->SetPosition((float)NUM2DBL(vX), (float)NUM2DBL(vY), (float)NUM2DBL(vZ)); + return Qnil; +} + +static VALUE Sound_get_buffer(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + DECLARE_PTR_VAR(SoundBuffer, SoundBuffer, (SoundBuffer *)pSelf->GetBuffer()); + return vSoundBuffer; +} + +static VALUE Sound_get_loop(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + return pSelf->GetLoop() ? Qtrue : Qfalse; +} + +static VALUE Sound_get_pitch(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + return rb_float_new(pSelf->GetPitch()); +} + +static VALUE Sound_get_volume(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + return rb_float_new(pSelf->GetVolume()); +} + +static VALUE Sound_get_position(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + float x, y, z; + pSelf->GetPosition(x, y, z); + VALUE vArray = rb_ary_new(); + rb_ary_push(vArray, rb_float_new(x)); + rb_ary_push(vArray, rb_float_new(y)); + rb_ary_push(vArray, rb_float_new(z)); + return vArray; +} + +static VALUE Sound_get_status(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + return INT2FIX(pSelf->GetStatus()); +} + +static VALUE Sound_get_playingOffset(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sound *pSelf; + Data_Get_Struct(vSelf, Sound, pSelf); + return rb_float_new(pSelf->GetPlayingOffset()); +} + +void Init_Sound() +{ + g_cSound = rb_define_class_under(g_vModule, "Sound", rb_cObject); + DEFINE_CLASS_METHOD(Sound, new, -1); + + DEFINE_INSTANCE_METHOD(Sound, initialize, -1); + + DEFINE_RW(Sound, buffer); + DEFINE_RW(Sound, loop); + DEFINE_RW(Sound, pitch); + DEFINE_RW(Sound, volume); + DEFINE_RW(Sound, position); + DEFINE_GETTER(Sound, status); + DEFINE_GETTER(Sound, playingOffset); + + DEFINE_INSTANCE_METHOD(Sound, to_s, 0); + DEFINE_INSTANCE_METHOD(Sound, play, 0); + DEFINE_INSTANCE_METHOD(Sound, pause, 0); + DEFINE_INSTANCE_METHOD(Sound, stop, 0); +} + diff --git a/ruby/RubySFML/sfSoundBuffer.cpp b/ruby/RubySFML/sfSoundBuffer.cpp new file mode 100644 index 00000000..2ee3d594 --- /dev/null +++ b/ruby/RubySFML/sfSoundBuffer.cpp @@ -0,0 +1,137 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cSoundBuffer; + +void SoundBuffer_free(void *p) { delete (SoundBuffer *)p; } +VALUE SoundBuffer_new(int argc, VALUE *argv, VALUE vClass) { + SoundBuffer *ptr = new SoundBuffer(); + VALUE tData = Data_Wrap_Struct(vClass, 0, SoundBuffer_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE SoundBuffer_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc == 1 && IS(argv[0], g_cSoundBuffer)) { + *pSelf = *(SoundBuffer *)DATA_PTR(argv[0]); + } else if(argc == 1 && ISSTR(argv[0])) { + if(!pSelf->LoadFromFile(STR2CSTR(argv[0]))) + rb_raise(rb_eRuntimeError, "Failed to load specified sound file"); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE SoundBuffer_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Samples=%d, SampleRate=%d, Channels=%d, Duration=%f", pSelf->GetSamplesCount(), pSelf->GetSampleRate(), pSelf->GetChannelsCount(), pSelf->GetDuration()); + return rb_str_new2(szBuffer); +} + +static VALUE SoundBuffer_loadFromFile(VALUE vSelf, VALUE vPath) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return pSelf->LoadFromFile(STR2CSTR(vPath)) ? Qtrue : Qfalse; +} + +static VALUE SoundBuffer_saveToFile(VALUE vSelf, VALUE vPath) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return pSelf->SaveToFile(STR2CSTR(vPath)) ? Qtrue : Qfalse; +} + +static VALUE SoundBuffer_loadFromMemory(VALUE vSelf, VALUE vSamples, VALUE vSize) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return pSelf->LoadFromMemory(STR2CSTR(vSamples), NUM2INT(vSize)) ? Qtrue : Qfalse; +} + +static VALUE SoundBuffer_get_samples(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return rb_str_new((const char *)pSelf->GetSamples(), pSelf->GetSamplesCount()*2); +} + +static VALUE SoundBuffer_get_samplesCount(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return INT2FIX(pSelf->GetSamplesCount()); +} + +static VALUE SoundBuffer_get_sampleRate(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return INT2FIX(pSelf->GetSampleRate()); +} + +static VALUE SoundBuffer_get_channels(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return INT2FIX(pSelf->GetChannelsCount()); +} + +static VALUE SoundBuffer_get_duration(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBuffer *pSelf; + Data_Get_Struct(vSelf, SoundBuffer, pSelf); + return rb_float_new(pSelf->GetDuration()); +} + +void Init_SoundBuffer() +{ + g_cSoundBuffer = rb_define_class_under(g_vModule, "SoundBuffer", rb_cObject); + DEFINE_CLASS_METHOD(SoundBuffer, new, -1); + DEFINE_INSTANCE_METHOD(SoundBuffer, initialize, -1); + + DEFINE_GETTER(SoundBuffer, samples); + DEFINE_GETTER(SoundBuffer, samplesCount); + DEFINE_GETTER(SoundBuffer, sampleRate); + DEFINE_GETTER(SoundBuffer, channels); + DEFINE_GETTER(SoundBuffer, duration); + + DEFINE_INSTANCE_METHOD(SoundBuffer, to_s, 0); + DEFINE_INSTANCE_METHOD(SoundBuffer, loadFromFile, 1); + DEFINE_INSTANCE_METHOD(SoundBuffer, saveToFile, 1); + DEFINE_INSTANCE_METHOD(SoundBuffer, loadFromMemory, 2); +} + diff --git a/ruby/RubySFML/sfSoundBufferRecorder.cpp b/ruby/RubySFML/sfSoundBufferRecorder.cpp new file mode 100644 index 00000000..5cd262c6 --- /dev/null +++ b/ruby/RubySFML/sfSoundBufferRecorder.cpp @@ -0,0 +1,101 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cSoundBufferRecorder; + +void SoundBufferRecorder_free(void *p) { delete (SoundBufferRecorder *)p; } +VALUE SoundBufferRecorder_new(int argc, VALUE *argv, VALUE vClass) { + SoundBufferRecorder *ptr = new SoundBufferRecorder(); + VALUE tData = Data_Wrap_Struct(vClass, 0, SoundBufferRecorder_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE SoundBufferRecorder_initialize(int argc, VALUE *argv, VALUE vSelf) { + if(argc == 0) { + // Nothing to initialize + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +VALUE SoundBufferRecorder_canCapture(VALUE vClass) { + return SoundBufferRecorder::CanCapture() ? Qtrue : Qfalse; +} + +VALUE SoundBufferRecorder_get_buffer(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBufferRecorder *pSelf; + Data_Get_Struct(vSelf, SoundBufferRecorder, pSelf); + DECLARE_PTR_VAR(SoundBuffer, SoundBuffer, (SoundBuffer *)&pSelf->GetBuffer()); + return vSoundBuffer; +} + +VALUE SoundBufferRecorder_start(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBufferRecorder *pSelf; + Data_Get_Struct(vSelf, SoundBufferRecorder, pSelf); + if(argc == 0) { + pSelf->Start(); + } else if(argc == 1) { + pSelf->Start(NUM2INT(argv[0])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +VALUE SoundBufferRecorder_stop(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBufferRecorder *pSelf; + Data_Get_Struct(vSelf, SoundBufferRecorder, pSelf); + pSelf->Stop(); + return Qnil; +} + +VALUE SoundBufferRecorder_get_sampleRate(VALUE vSelf) { + // Get C++ object pointer from vSelf + SoundBufferRecorder *pSelf; + Data_Get_Struct(vSelf, SoundBufferRecorder, pSelf); + return INT2FIX(pSelf->GetSampleRate()); +} + +void Init_SoundBufferRecorder() +{ + g_cSoundBufferRecorder = rb_define_class_under(g_vModule, "SoundBufferRecorder", rb_cObject); + DEFINE_CLASS_METHOD(SoundBufferRecorder, new, -1); + DEFINE_INSTANCE_METHOD(SoundBufferRecorder, initialize, -1); + + DEFINE_CLASS_METHOD(SoundBufferRecorder, canCapture, 0); + + DEFINE_GETTER(SoundBufferRecorder, sampleRate); + DEFINE_GETTER(SoundBufferRecorder, buffer); + + DEFINE_INSTANCE_METHOD(SoundBufferRecorder, start, -1); + DEFINE_INSTANCE_METHOD(SoundBufferRecorder, stop, 0); +} + diff --git a/ruby/RubySFML/sfSprite.cpp b/ruby/RubySFML/sfSprite.cpp new file mode 100644 index 00000000..a792dcfe --- /dev/null +++ b/ruby/RubySFML/sfSprite.cpp @@ -0,0 +1,319 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +#include +using namespace sf; + +#ifdef _MSC_VER + #define SQRTF sqrtf +#else + #define SQRTF sqrt +#endif + +// Wrapper for Sprite that calls the Ruby version of virtual methods in case a Ruby class derives from this one +class rSprite : public Sprite { +protected: + VALUE m_vSelf, m_vClass; + ID m_idRender; + bool m_bRender, m_bInRender; + + virtual void Render(const RenderWindow &Window) const { + // If this method is overridden in Ruby, call it + if(m_bRender) { + VALUE vWindow = Data_Wrap_Struct(g_cRenderWindow, 0, 0, (void*)&Window); + VALUE vRet = rb_funcall(m_vSelf, m_idRender, 1, vWindow); + } else // else call parent + Sprite::Render(Window); + } + +public: + // Call as soon as you get a Ruby VALUE pointing to this object + void rInit(VALUE vSelf) { + // Need these for rb_funcall + m_vSelf = vSelf; + m_vClass = CLASS_OF(m_vSelf); + + // Initialize members for Render() virtual method + m_idRender = rb_intern("render"); + m_bRender = rb_method_boundp(m_vClass, m_idRender, 0) == Qtrue; + } + + // When an overridden method in Ruby calls super(), it is called this way + VALUE Render(VALUE vWindow) { + Sprite::Render(*(RenderWindow *)DATA_PTR(vWindow)); + return Qnil; + } +}; + + +VALUE g_cSprite; + +void Sprite_free(void *p) { delete (Sprite *)p; } +VALUE Sprite_new(int argc, VALUE *argv, VALUE vClass) { + rSprite *ptr = new rSprite(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Sprite_free, ptr); + ptr->rInit(tData); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Sprite_initialize(int argc, VALUE *argv, VALUE vSelf) { + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc >= 1 && argc <= 6 && IS(argv[0], g_cImage) && (argc < 6 || IS(argv[5], g_cColor))) { + pSelf->SetImage(*(Image *)DATA_PTR(argv[0])); + if(argc >= 2) + pSelf->SetLeft((float)NUM2DBL(argv[1])); + if(argc >= 3) + pSelf->SetTop((float)NUM2DBL(argv[2])); + if(argc >= 4) { + if(ISNUM(argv[3])) { + float f = (float)NUM2DBL(argv[3]); + pSelf->SetScale(f, f); + } else if(IS(argv[3], rb_cArray)) { + float x = (float)NUM2DBL(rb_ary_entry(argv[3], 0)); + float y = (float)NUM2DBL(rb_ary_entry(argv[3], 1)); + pSelf->SetScale(x, y); + } + } + if(argc >= 5) + pSelf->SetRotation((float)NUM2DBL(argv[4])); + if(argc >= 6) + pSelf->SetColor(*(Color *)DATA_PTR(argv[5])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetRotationCenter(pSelf->GetWidth()/2, pSelf->GetHeight()/2); + return vSelf; +} + +static VALUE Sprite_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Left=%f, Top=%f, Width=%f, Height=%f, Scale=[%f,%f]", pSelf->GetLeft(), pSelf->GetTop(), pSelf->GetWidth(), pSelf->GetHeight(), pSelf->GetScaleX(), pSelf->GetScaleY()); + return rb_str_new2(szBuffer); +} + +static VALUE Sprite_set_image(VALUE vSelf, VALUE vImage) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + if(!IS(vImage, g_cImage)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetImage(*(Image *)DATA_PTR(vImage)); + return Qnil; +} + +static VALUE Sprite_set_subRect(VALUE vSelf, VALUE vRect) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + if(!IS(vRect, g_cIntRect)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetSubRect(*(IntRect *)DATA_PTR(vRect)); + return Qnil; +} + +static VALUE Sprite_get_image(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + DECLARE_PTR_VAR(Image, Image, (Image *)pSelf->GetImage()); + return vImage; +} + +static VALUE Sprite_get_subRect(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + DECLARE_OBJ_VAR(IntRect, Rect, pSelf->GetSubRect()); + return vRect; +} + +static VALUE Sprite_get_width(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + return rb_float_new(pSelf->GetWidth()); +} + +static VALUE Sprite_get_height(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + return rb_float_new(pSelf->GetHeight()); +} + +static VALUE Sprite_getPixel(VALUE vSelf, VALUE vX, VALUE vY) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + DECLARE_OBJ_VAR(Color, Color, pSelf->GetPixel(NUM2INT(vX), NUM2INT(vY))); + return vColor; +} + +static VALUE Sprite_set_right(VALUE vSelf, VALUE v) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + pSelf->SetLeft((float)NUM2DBL(v) - pSelf->GetWidth()); + return Qnil; +} + +static VALUE Sprite_set_bottom(VALUE vSelf, VALUE v) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + pSelf->SetTop((float)NUM2DBL(v) - pSelf->GetHeight()); + return Qnil; +} + +static VALUE Sprite_set_x(VALUE vSelf, VALUE v) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + pSelf->SetLeft((float)NUM2DBL(v) - pSelf->GetWidth()*0.5f); + return Qnil; +} + +static VALUE Sprite_set_y(VALUE vSelf, VALUE v) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + pSelf->SetTop((float)NUM2DBL(v) - pSelf->GetHeight()*0.5f); + return Qnil; +} + +static VALUE Sprite_get_right(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + return rb_float_new(pSelf->GetLeft() + pSelf->GetWidth()); +} + +static VALUE Sprite_get_bottom(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + return rb_float_new(pSelf->GetTop() + pSelf->GetHeight()); +} + +static VALUE Sprite_get_x(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + return rb_float_new(pSelf->GetLeft() + pSelf->GetWidth()*0.5f); +} + +static VALUE Sprite_get_y(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + return rb_float_new(pSelf->GetTop() + pSelf->GetHeight()*0.5f); +} + +static VALUE Sprite_get_radius(VALUE vSelf) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + float w = pSelf->GetWidth() * 0.5f; + float h = pSelf->GetHeight() * 0.5f; + return rb_float_new(SQRTF(w*w + h*h)); +} + +static VALUE Sprite_flipX(VALUE vSelf, VALUE vBool) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + pSelf->FlipX(RTEST(vBool)); + return Qnil; +} + +static VALUE Sprite_flipY(VALUE vSelf, VALUE vBool) { + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + pSelf->FlipY(RTEST(vBool)); + return Qnil; +} + +static VALUE Sprite_distance(VALUE vSelf, VALUE vOther) { + if(!ISKO(vOther, g_cSprite)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + + // Get C++ object pointer from vSelf + Sprite *pSelf; + Data_Get_Struct(vSelf, Sprite, pSelf); + Sprite *pOther; + Data_Get_Struct(vOther, Sprite, pOther); + + // Get distance from center positions + float dx = (pSelf->GetLeft() + pSelf->GetWidth()*0.5f) - + (pOther->GetLeft() + pOther->GetWidth()*0.5f); + float dy = (pSelf->GetTop() + pSelf->GetHeight()*0.5f) - + (pOther->GetTop() + pOther->GetHeight()*0.5f); + return rb_float_new(SQRTF(dx*dx + dy*dy)); +} + +static VALUE Sprite_render(VALUE vSelf, VALUE vWindow) { + // Get C++ object pointer from vSelf + rSprite *pSelf; + Data_Get_Struct(vSelf, rSprite, pSelf); + return pSelf->Render(vWindow); +} + +void Init_Sprite() +{ + g_cSprite = rb_define_class_under(g_vModule, "Sprite", g_cDrawable); + DEFINE_CLASS_METHOD(Sprite, new, -1); + DEFINE_INSTANCE_METHOD(Sprite, initialize, -1); + + DEFINE_RW(Sprite, right); // Right x position + DEFINE_RW(Sprite, bottom); // Bottom x position + DEFINE_RW(Sprite, x); // Center x postion + DEFINE_RW(Sprite, y); // Center y position + DEFINE_RW(Sprite, image); + DEFINE_RW(Sprite, subRect); + DEFINE_GETTER(Sprite, width); + DEFINE_GETTER2(Sprite, width, w); + DEFINE_GETTER(Sprite, height); + DEFINE_GETTER2(Sprite, height, h); + DEFINE_GETTER(Sprite, radius); + + DEFINE_INSTANCE_METHOD(Sprite, to_s, 0); + DEFINE_INSTANCE_METHOD(Sprite, getPixel, 2); + DEFINE_INSTANCE_METHOD2(Sprite, getPixel, [], 2); + DEFINE_INSTANCE_METHOD(Sprite, distance, 1); + DEFINE_INSTANCE_METHOD2(Sprite, distance, getDistance, 1); + DEFINE_INSTANCE_METHOD(Sprite, flipX, 0); + DEFINE_INSTANCE_METHOD(Sprite, flipY, 0); + + // Virtual method + DEFINE_INSTANCE_METHOD(Sprite, render, 1); +} diff --git a/ruby/RubySFML/sfString.cpp b/ruby/RubySFML/sfString.cpp new file mode 100644 index 00000000..a6f770d5 --- /dev/null +++ b/ruby/RubySFML/sfString.cpp @@ -0,0 +1,190 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +// Wrapper for String that calls the Ruby version of virtual methods in case a Ruby class derives from this one +class rString : public String { +protected: + VALUE m_vSelf, m_vClass; + ID m_idRender; + bool m_bRender; + + virtual void Render(const RenderWindow &Window) const { + // If this method is overridden in Ruby, call it + if(m_bRender) { + VALUE vWindow = Data_Wrap_Struct(g_cRenderWindow, 0, 0, (void*)&Window); + VALUE vRet = rb_funcall(m_vSelf, m_idRender, 1, vWindow); + } else // else call parent + String::Render(Window); + } + +public: + // Damn constructors should be inherited from base class + rString(const std::string &Text="", const std::string &Font="", float Size=32.f) :String(Text, Font, Size) {} + + // Call as soon as you get a Ruby VALUE pointing to this object + void rInit(VALUE vSelf) { + // Need these for rb_funcall + m_vSelf = vSelf; + m_vClass = CLASS_OF(m_vSelf); + + // Initialize members for Render() virtual method + m_idRender = rb_intern("render"); + m_bRender = rb_method_boundp(m_vClass, m_idRender, 0) == Qtrue; + } + + // When an overridden method in Ruby calls super(), it is called this way + VALUE Render(VALUE vWindow) { + String::Render(*(RenderWindow *)DATA_PTR(vWindow)); + return Qnil; + } +}; + + +VALUE g_cString; + +void String_free(void *p) { delete (String *)p; } +VALUE String_new(int argc, VALUE *argv, VALUE vClass) { + // For each version of this method, convert Ruby args to C++ types (applying default values) + rString *ptr = new rString(); + VALUE tData = Data_Wrap_Struct(vClass, 0, String_free, ptr); + rb_obj_call_init(tData, argc, argv); + ptr->rInit(tData); + return tData; +} + +static VALUE String_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + if(argc >= 0 && argc <= 3 && + (argc < 1 || ISSTR(argv[0])) && + (argc < 2 || ISSTR(argv[1])) && + (argc < 3 || ISNUM(argv[2]))) { + if(argc >= 1) + pSelf->SetText(STR2CSTR(argv[0])); + if(argc >= 2) + pSelf->SetFont(STR2CSTR(argv[1])); + if(argc >= 3) + pSelf->SetSize((float)NUM2DBL(argv[2])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE String_preloadFont(int argc, VALUE *argv, VALUE vClass) { + if(argc >= 2 && argc <= 2) + String::PreloadFont(STR2CSTR(argv[0]), NUM2INT(argv[1])); + else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return Qnil; +} + +static VALUE String_set_text(VALUE vSelf, VALUE vText) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + if(!ISSTR(vText)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetText(STR2CSTR(vText)); + return Qnil; +} + +static VALUE String_set_font(VALUE vSelf, VALUE vFont) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + if(!ISSTR(vFont)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetText(STR2CSTR(vFont)); + return Qnil; +} + +static VALUE String_set_size(VALUE vSelf, VALUE vSize) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + if(!ISNUM(vSize)) + rb_raise(rb_eTypeError, "wrong argument type(s)"); + pSelf->SetSize((float)NUM2DBL(vSize)); + return Qnil; +} + +static VALUE String_get_text(VALUE vSelf) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + return rb_str_new2(pSelf->GetText().c_str()); +} + +static VALUE String_get_font(VALUE vSelf) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + return rb_str_new2(pSelf->GetFont().c_str()); +} + +static VALUE String_get_size(VALUE vSelf) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + return rb_float_new(pSelf->GetSize()); +} + +static VALUE String_getRect(VALUE vSelf) { + // Get C++ object pointer from vSelf + String *pSelf; + Data_Get_Struct(vSelf, String, pSelf); + DECLARE_OBJ_VAR(FloatRect, Rect, pSelf->GetRect()); + return vRect; +} + +static VALUE String_render(VALUE vSelf, VALUE vWindow) { + // Get C++ object pointer from vSelf + rString *pSelf; + Data_Get_Struct(vSelf, rString, pSelf); + return pSelf->Render(vWindow); +} + +void Init_String() +{ + g_cString = rb_define_class_under(g_vModule, "Text", g_cDrawable); + DEFINE_CLASS_METHOD(String, new, -1); + DEFINE_INSTANCE_METHOD(String, initialize, -1); + + DEFINE_CLASS_METHOD(String, preloadFont, -1); + + DEFINE_RW(String, text); + DEFINE_RW(String, font); + DEFINE_RW(String, size); + + DEFINE_INSTANCE_METHOD(String, getRect, 0); + + // Virtual method + DEFINE_INSTANCE_METHOD(String, render, 1); +} + diff --git a/ruby/RubySFML/sfVideoMode.cpp b/ruby/RubySFML/sfVideoMode.cpp new file mode 100644 index 00000000..f707ce3d --- /dev/null +++ b/ruby/RubySFML/sfVideoMode.cpp @@ -0,0 +1,114 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cVideoMode; + +DECLARE_INT_RW(VideoMode, Width); +DECLARE_INT_RW(VideoMode, Height); +DECLARE_INT_RW(VideoMode, BitsPerPixel); + + +void VideoMode_free(void *p) { delete (VideoMode *)p; } +VALUE VideoMode_new(int argc, VALUE *argv, VALUE vClass) { + VideoMode *ptr = new VideoMode(); + VALUE tData = Data_Wrap_Struct(vClass, 0, VideoMode_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE VideoMode_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + VideoMode *pSelf; + Data_Get_Struct(vSelf, VideoMode, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc >= 2 && argc <= 3 && + ISNUM(argv[0]) && + ISNUM(argv[1]) && + (argc < 3 || ISNUM(argv[2]))) { + *pSelf = VideoMode(NUM2INT(argv[0]), NUM2INT(argv[1]), argc < 3 ? 32 : NUM2INT(argv[2])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE VideoMode_desktop(VALUE vClass) +{ + DECLARE_OBJ_VAR(VideoMode, Desktop, VideoMode::GetDesktopMode()); + return vDesktop; +} + +// Ruby each iterator +static VALUE VideoMode_each(VALUE vClass) +{ + int nLength = VideoMode::GetModesCount(); + for(int i=0; iIsValid() ? Qtrue : Qfalse; +} + +static VALUE VideoMode_to_s(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + VideoMode *pSelf; + Data_Get_Struct(vSelf, VideoMode, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Width: %d, Height: %d, BPP: %d", pSelf->Width, pSelf->Height, pSelf->BitsPerPixel); + return rb_str_new2(szBuffer); +} + +void Init_VideoMode() +{ + g_cVideoMode = rb_define_class_under(g_vModule, "VideoMode", rb_cObject); + DEFINE_CLASS_METHOD(VideoMode, new, -1); + DEFINE_INSTANCE_METHOD(VideoMode, initialize, -1); + + DEFINE_RW2(VideoMode, Width, width); + DEFINE_RW2(VideoMode, Width, w); + DEFINE_RW2(VideoMode, Height, height); + DEFINE_RW2(VideoMode, Height, h); + DEFINE_RW2(VideoMode, BitsPerPixel, bitsPerPixel); + DEFINE_RW2(VideoMode, BitsPerPixel, bpp); + + DEFINE_CLASS_METHOD(VideoMode, each, 0); + DEFINE_CLASS_METHOD(VideoMode, desktop, 0); + DEFINE_INSTANCE_METHOD(VideoMode, isValid, 0); + DEFINE_INSTANCE_METHOD(VideoMode, to_s, 0); +} + diff --git a/ruby/RubySFML/sfView.cpp b/ruby/RubySFML/sfView.cpp new file mode 100644 index 00000000..6714074e --- /dev/null +++ b/ruby/RubySFML/sfView.cpp @@ -0,0 +1,93 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cView; + +//DECLARE_DOUBLE_RW(View, Left); +//DECLARE_DOUBLE_RW(View, Top); +//DECLARE_DOUBLE_RW(View, Width); +//DECLARE_DOUBLE_RW(View, Height); +DECLARE_OBJ_RW(View, Rect, FloatRect); +DECLARE_DOUBLE_RW(View, Zoom); + + +void View_free(void *p) { delete (View *)p; } +VALUE View_new(int argc, VALUE *argv, VALUE vClass) { + View *ptr = new View(); + VALUE tData = Data_Wrap_Struct(vClass, 0, View_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE View_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + View *pSelf; + Data_Get_Struct(vSelf, View, pSelf); + if(argc == 0) { + // Nothing to initialize + } else if(argc >= 1 && argc <= 2 && + IS(argv[0], g_cFloatRect) && + (argc < 2 || ISNUM(argv[1]))) { + pSelf->Rect = *(FloatRect *)DATA_PTR(argv[0]); + if(argc >= 2) + pSelf->Zoom = (float)NUM2DBL(argv[1]); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + + return vSelf; +} + +static VALUE View_to_s(VALUE vSelf) +{ + // Get C++ object pointer from vSelf + View *pSelf; + Data_Get_Struct(vSelf, View, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Left=%f, Top=%f, Width=%f, Height=%f, Zoom=%f", pSelf->Rect.Left, pSelf->Rect.Top, pSelf->Rect.GetHeight(), pSelf->Rect.GetWidth(), pSelf->Zoom); + return rb_str_new2(szBuffer); +} + +void Init_View() +{ + g_cView = rb_define_class_under(g_vModule, "View", rb_cObject); + DEFINE_CLASS_METHOD(View, new, -1); + DEFINE_INSTANCE_METHOD(View, initialize, -1); + + //DEFINE_RW2(View, Left, l); + //DEFINE_RW2(View, Top, top); + //DEFINE_RW2(View, Top, t); + //DEFINE_RW2(View, Width, width); + //DEFINE_RW2(View, Width, w); + //DEFINE_RW2(View, Height, height); + //DEFINE_RW2(View, Height, h); + DEFINE_RW2(View, Rect, rect); + DEFINE_RW2(View, Zoom, zoom); + + DEFINE_INSTANCE_METHOD(View, to_s, 0); +} + diff --git a/ruby/RubySFML/sfWindow.cpp b/ruby/RubySFML/sfWindow.cpp new file mode 100644 index 00000000..77e74d1d --- /dev/null +++ b/ruby/RubySFML/sfWindow.cpp @@ -0,0 +1,181 @@ +//////////////////////////////////////////////////////////// +// +// RubySFML - Ruby extension for the SFML library +// Copyright (C) 2007 Sean O'Neil and Laurent Gomila +// (sean.p.oneil@gmail.com and laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// +#include +#include "RubySFML.h" +using namespace sf; + +VALUE g_cWindow; + +void Window_free(void *p) { delete (Window *)p; } +VALUE Window_new(int argc, VALUE *argv, VALUE vClass) { + Window *ptr = new Window(); + VALUE tData = Data_Wrap_Struct(vClass, 0, Window_free, ptr); + rb_obj_call_init(tData, argc, argv); + return tData; +} + +static VALUE Window_initialize(int argc, VALUE *argv, VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + if(argc >= 2 && argc <= 3 && + IS(argv[0], g_cVideoMode) && + ISSTR(argv[1]) && + (argc < 3 || true) && + (argc < 4 || ISNUM(argv[3]))) { + pSelf->Create(*(VideoMode *)DATA_PTR(argv[0]), STR2CSTR(argv[1]), + argc < 3 ? (Style::Resize|Style::Close) : NUM2INT(argv[2]), + argc < 4 ? 0 : NUM2INT(argv[3])); + } else + rb_raise(rb_eTypeError, "wrong argument type(s)"); + return vSelf; +} + +static VALUE Window_to_s(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + char szBuffer[256]; + sprintf(szBuffer, "Height: %d, Width: %d, Depth Bits: %d, Stencil Bits: %d", pSelf->GetWidth(), pSelf->GetHeight(), pSelf->GetDepthBits(), pSelf->GetStencilBits()); + return rb_str_new2(szBuffer); +} + +static VALUE Window_get_width(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + return INT2FIX(pSelf->GetWidth()); +} + +static VALUE Window_get_height(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + return INT2FIX(pSelf->GetHeight()); +} + +static VALUE Window_get_depthBits(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + return INT2FIX(pSelf->GetDepthBits()); +} + +static VALUE Window_get_stencilBits(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + return INT2FIX(pSelf->GetStencilBits()); +} + +static VALUE Window_get_frameTime(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + return rb_float_new(pSelf->GetFrameTime()); +} + +static VALUE Window_get_input(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + DECLARE_PTR_VAR(Input, Input, (Input *)&pSelf->GetInput()); + return vInput; +} + +static VALUE Window_getEvent(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + Event ePoll; + if(!pSelf->GetEvent(ePoll)) + return Qnil; + DECLARE_OBJ_VAR(Event, Event, ePoll); + return vEvent; +} + +static VALUE Window_useVerticalSync(VALUE vSelf, VALUE vEnabled) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + pSelf->UseVerticalSync(RTEST(vEnabled) != 0); + return Qnil; +} + +static VALUE Window_showMouseCursor(VALUE vSelf, VALUE vShow) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + pSelf->ShowMouseCursor(RTEST(vShow) != 0); + return Qnil; +} + +static VALUE Window_setFramerateLimit(VALUE vSelf, VALUE vLimit) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + pSelf->SetFramerateLimit((unsigned int)NUM2INT(vLimit)); + return Qnil; +} + +static VALUE Window_display(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + pSelf->Display(); + return Qnil; +} + +static VALUE Window_setCurrent(VALUE vSelf) { + // Get C++ object pointer from vSelf + Window *pSelf; + Data_Get_Struct(vSelf, Window, pSelf); + return pSelf->SetCurrent() ? Qtrue : Qfalse; +} + +void Init_Window() +{ + g_cWindow = rb_define_class_under(g_vModule, "Window", rb_cObject); + DEFINE_CLASS_METHOD(Window, new, -1); + DEFINE_INSTANCE_METHOD(Window, initialize, -1); + + DEFINE_GETTER(Window, width); + DEFINE_GETTER2(Window, width, w); + DEFINE_GETTER(Window, height); + DEFINE_GETTER2(Window, height, h); + DEFINE_GETTER(Window, input); + DEFINE_GETTER(Window, frameTime); + DEFINE_GETTER(Window, stencilBits); + DEFINE_GETTER(Window, depthBits); + + DEFINE_INSTANCE_METHOD(Window, to_s, 0); + DEFINE_INSTANCE_METHOD(Window, getEvent, 0); // Don't use GETTER + DEFINE_INSTANCE_METHOD(Window, useVerticalSync, 1); + DEFINE_INSTANCE_METHOD(Window, showMouseCursor, 1); + DEFINE_INSTANCE_METHOD(Window, setFramerateLimit, 1); + DEFINE_INSTANCE_METHOD(Window, display, 0); + DEFINE_INSTANCE_METHOD(Window, setCurrent, 0); // Dont use SETTER +} + diff --git a/ruby/doc/Reference-en.html b/ruby/doc/Reference-en.html new file mode 100644 index 00000000..1b0bb2d2 --- /dev/null +++ b/ruby/doc/Reference-en.html @@ -0,0 +1,431 @@ + +RubySFML Documentation + + + + +

Introduction

+

I apologize for how limited this documentation is, but as this extension is primarily a simple wrapper around SFML's C++ classes, I will rely on SFML's documentation to explain more detail about the classes and methods. This documentation is simply meant to explain which classes and methods are available in Ruby, as well as what changes have been made during the translation from C++ to Ruby.

+

As Ruby doesn't support native threading and has its own networking classes, I only exposed certain classes in the system, window, graphics, and audio libraries. For most exposed classes, the only changes I made were to make the methods start with a lower-case letter. For classes with simple Get/Set methods, I often drop the Get and Set to allow you to use sprite.left and sprite.left=. I also added a few to_i, to_f, and to_s methods where it seemed appropriate. Last but not least, I added an each iterator to VideoMode.

+

In addition to the C++ classes I exposed, I also added two helper classes in RubySFML.rb, one for rendering tiled sprites, and the other for dealing with sprites that use 2D velocity/accelerate calculations (TSprite and VSprite respectively).

+

Tips for Windows Users

+

For the Windows users out there, I apologize for not being compatible with the one-click installer, but it's being built with Visual Studio 6.0, which is ridiculously old and not compatible with any of the SFML libraries. There's a free version of Visual Studio 2005 available, and the Ruby source compiles very smoothly with it, so I can't think of a good excuse for the one-click installer to still be using 6.0.

+

On the bright side, you can distribute your game in a self-sufficient package by zipping it up with the bin and lib folders that come with the Windows binary version of this extension. Add a simple installer that creates a program group icon that runs "%install_path%\bin\ruby.exe %install_path%\my_game.rb", and you're all set. Oh yeah, OpenAL needs to be installed on any machine running this. Fortunately it is a very small/simple install, and it should be easy for you to either bundle it with your distribution or provide a link for your users to download it. All of this keeps your users from having to download/run the one-click installer, install all the necessary extensions, worry about compatibility issues, etc. It is likely that very few Windows users will ever play your game if you don't provide them everything they need to run it, so it's probably better this way.

+

Note: This custom build of Ruby does have gems and zlib (which is required by gems), but no other extensions are installed. Feel free to install any other gems/extensions you need (native mswin32 gems compiled with Visual Studio 6.0 may not work). Keep in mind that many gems often have large doc, examples, and test folders. Deleting these unnecessary folders, along with the gem cache folder, can significantly shrink the size of the file you're distributing.

+ +

RubySFML Sample Code

+
+# Include the RubySFML extension
+require "RubySFML"
+include SFML
+
+# Create the main window
+mode = VideoMode.new 800, 600, 32
+window = RenderWindow.new mode, "RubySFML Test", false
+
+# Load a sprite to display
+image = Image.new "cute_image.jpg"
+sprite = Sprite.new image
+ 
+# Create a graphical string to display
+text = Text.new "Hello SFML", "arial.ttf", 50
+ 
+# Load a music and start playing it
+music = Music.new "nice_music.ogg"
+music.play
+ 
+# Start the game loop
+running = true
+while running
+	while event = window.getEvent
+		running = false if event.type == Event::Close
+	end
+ 
+	# Draw the sprite, then the text, and update the window
+	window.draw sprite
+	window.draw text
+	window.display
+end
+	
+ +

RubySFML Modules

+ + +

RubySFML Classes

+
    +
  • SFML::Clock - A system clock using high-performance timers where available
  • +
  • SFML::Color - A simple RGBA color class
  • +
  • SFML::Drawable - A pure virtual class representing 2D objects to use with RenderWindow
  • +
  • SFML::Event - A class representing various system events (like keyboard and mouse events)
  • +
  • SFML::FloatRect - A simple rectangle made of 4 floats
  • +
  • SFML::Image - A class for managing image files and textures
  • +
  • SFML::Input - A class for checking the current state of various input devices
  • +
  • SFML::IntRect - A simple rectangle made of 4 ints
  • +
  • SFML::Music - A class for playing streaming music files
  • +
  • SFML::PostFX - A class for mananging post-rendering shaders
  • +
  • SFML::RenderWindow - A sub-class of Window which makes it easy to draw 2D sprites and text
  • +
  • SFML::Sound - A class for playing sound clips
  • +
  • SFML::SoundBuffer - A class for managing sound clips and sound files
  • +
  • SFML::SoundBufferRecorder - A class for recording sound from a capture device, like a microphone
  • +
  • SFML::Sprite - A class for managing/drawing 2D sprites
  • +
  • SFML::Text - A class for managing/drawing 2D text (using ttf fonts)
  • +
  • SFML::VideoMode - A class for managing video modes and window sizes
  • +
  • SFML::View - A class for managing the 2D camera in RenderWindow
  • +
  • SFML::Window - A class for creating/managing a suitable window for custom OpenGL rendering (also handles all input and events)
  • +
+ +

RubySFML Methods (by module/class)

+
+

SFML

+
    +
  • checkExtension(str) - Returns true if the specifed OpenGL extension is supported.
  • +
  • getMaxTextureSize - Returns the max texture size for the current display hardware.
  • +
  • getMaxTextureUnits - Returns the max number of texture units for the current display hardware.
  • +
+ +
+

SFML::Clock

+
    +
  • initialize() - Default constructor
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • reset - Resets the clock
  • +
  • elapsedTime,to_f - Returns the elapsed time since the last reset
  • +
+ +
+

SFML::Color

+
    +
  • initialize() - Default constructor
  • +
  • initialize(n) - Builds the color from a 32-bit unsigned RGBA value (0x12345678 is r=0x78, g=0x56, b=0x34, a=0x12)
  • +
  • initialize(r, g, b, a=255) - Builds the color from its separate components
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • r, g, b, a - Returns the r, g, b, and a values (respectively)
  • +
  • r=, g=, b=, a= - Sets the r, g, b, and a values (respectively)
  • +
  • toRGBA - Returns the 4 components as a 32-bit unsigned value (0x12345678 is r=0x78, g=0x56, b=0x34, a=0x12)
  • +
  • to_i - Alias for toRGBA
  • +
+ +
+

SFML::Drawable

+
    +
  • initialize(left=0, top=0, scale=1, rotation=0, color=Color.White) - Initializes various members (scale can be a number or an array of two numbers)
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • left, left= - Gets/sets the left x position
  • +
  • top, top= - Gets/sets the top y position
  • +
  • scale, scale= - Gets/sets the scale of this object (get returns an array, set takes a num or an array
  • +
  • color, color= - Gets/sets the base color of this object
  • +
  • rotation, rotation= - Gets/sets the angle of rotation (in degrees)
  • +
  • upVector - Gets this object's up vector (based on its angle of rotation)
  • +
  • rightVector - Gets this object's right vector (based on its angle of rotation)
  • +
  • setRotationCenter(x, y) - Sets the center of rotation for this object
  • +
  • move(x, y) - Adds an offset to the left and top members
  • +
  • rotate(a) - Adds an offset to the rotation member
  • +
  • render(window) - (virtual) Override to add custom rendering code
  • +
+ +
+

SFML::Event

+
For all event types
+
    +
  • initialize - Takes no parameters
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • type - Returns the event type
  • +
+
For the Event::TextEntered event type
+
    +
  • char - Returns the character typed (only for Event::TextEntered events)
  • +
+
For Event::KeyPressed and Event::KeyReleased event types
+
    +
  • code - Returns the character code (only for Event::KeyPressed and Event::KeyReleased events)
  • +
  • alt - Returns true if an Alt key is down (only for Event::KeyPressed and Event::KeyReleased events)
  • +
  • control - Returns true if a Ctrl key is down (only for Event::KeyPressed and Event::KeyReleased events)
  • +
  • shift - Returns true if a Shift key is down (only for Event::KeyPressed and Event::KeyReleased events)
  • +
+
For mouse and joystick event types
+
    +
  • delta - Returns the scroll wheel offset (only for Event::MouseWheelMoved events)
  • +
  • buttons - Returns the state of the mouse buttons (only for mouse events)
  • +
  • button - Returns the state of the joystick buttons (only for joystick events)
  • +
  • x - Returns the x position (for mouse and joystick events)
  • +
  • y - Returns the y position (for mouse and joystick events)
  • +
  • z - Returns the z position (for joystick events)
  • +
+
For the Event::Resize event type
+
    +
  • width - Returns the new window width (only for Event::Resize events)
  • +
  • height - Returns the new window height (only for Event::Resize events)
  • +
+ +
+

SFML::FloatRect

+
    +
  • initialize() - Default constructor
  • +
  • initialize(left, top, right, bottom) - Initialize the rectangle's members
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • left, l - Gets the left x position
  • +
  • left=, l= - Sets the left x position
  • +
  • top, t - Gets the top y position
  • +
  • top=, t= - Sets the top y position
  • +
  • right, r - Gets the right x position
  • +
  • right=, r= - Sets the right x position
  • +
  • bottom, b - Gets the bottom y position
  • +
  • bottom=, b= - Sets the bottom y position
  • +
  • width, w - Gets the rectangle width
  • +
  • height, h - Gets the rectangle height
  • +
  • contains(x, y) - Returns true if the x, y position is inside the rectangle
  • +
  • intersects(rect) - Returns the intersection of two rectangles (nil if there is no intersection)
  • +
+ +
+

SFML::Image

+
    +
  • initialize - Creates an empty image
  • +
  • initialize(image) - Creates a copy of an image
  • +
  • initialize(path) - Loads an image file using the specified path (raises a RuntimeError on failure)
  • +
  • initialize(w, h, c=Color.Black) - Creates a blank image using the specified width, height, and color
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • getValidTextureSize(s) - (static) Returns the valid nearest texture size >= s
  • +
  • width, w - Gets the image width
  • +
  • height, h - Gets the image height
  • +
  • smooth=, setSmooth(bool) - Sets the OpenGL texture parameter to linear interpolation for true or nearest for false
  • +
  • repeat=, setRepeat(bool) - Sets the OpenGL texture parameter to repeat for true or clip for false
  • +
  • loadFromFile(path) - Loads a file image using the specified path
  • +
  • saveToFile(path) - Saves the image to a file using the specified path
  • +
  • create(w, h, c=Color.Black) - Creates an empty image with the specified width, height, and color
  • +
  • createMaskFromColor(color, a=0) - Scans the image for pixels of the specified color, and sets the alpha value of those pixels to a.
  • +
  • resize(w, h, c=Color.Black) - Resizes the image. If the image grows, sets new pixels to the specified color.
  • +
  • getPixel(x, y), [x,y] - Returns the color of the specified pixel.
  • +
  • setPixel(x, y, c), [x,y]= - Sets the color of the specified pixel to c.
  • +
  • update - Updates the image in video memory (call after manually setting pixels).
  • +
  • bind - Bind the image for rendering (call if you're using this image with raw OpenGL calls).
  • +
  • getTexCoords(rect) - Converts an IntRect representing pixel positions to a FloatRect representing texture coordinates.
  • +
+ +
+

SFML::Input

+
    +
  • initialize - Default constructor
  • +
  • isKeyDown(key) - Returns true if the specified key is down
  • +
  • isMouseButtonDown(button) - Returns true if the specified mouse button is down
  • +
  • isJoystickButtonDown(n, button) - Returns true if the specified button on joystick n is down
  • +
  • getMouseX - Returns the current x position of the mouse
  • +
  • getMouseY - Returns the current y position of the mouse
  • +
  • getJoystickX(n) - Returns the current x position of joystick n
  • +
  • getJoystickY(n) - Returns the current y position of joystick n
  • +
  • getJoystickZ(n) - Returns the current z position of joystick n
  • +
+ +
+

SFML::IntRect

+
    +
  • initialize() - Default constructor
  • +
  • initialize(left, top, right, bottom) - Initialize the rectangle's members
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • left, l - Gets the left x position
  • +
  • left=, l= - Sets the left x position
  • +
  • top, t - Gets the top y position
  • +
  • top=, t= - Sets the top y position
  • +
  • right, r - Gets the right x position
  • +
  • right=, r= - Sets the right x position
  • +
  • bottom, b - Gets the bottom y position
  • +
  • bottom=, b= - Sets the bottom y position
  • +
  • width, w - Gets the rectangle width
  • +
  • height, h - Gets the rectangle height
  • +
  • contains(x, y) - Returns true if the x, y position is inside the rectangle
  • +
  • intersects(rect) - Returns the intersection of two rectangles (nil if there is no intersection)
  • +
+ +
+

SFML::Music

+
    +
  • initialize(bufSize=44100) - Allows you to specify the buffer size.
  • +
  • initialize(path) - Opens a music file using the specified path (raises a RuntimeError on failure).
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • loop, loop= - Gets/sets a boolean indicating whether the music should loop back to the beginning when it's finished playing.
  • +
  • duration - Gets the duration of the sound stream.
  • +
  • channels - Gets the number of channels in the sound stream (1=mono, 2=stereo).
  • +
  • sampleRate - Gets the sample rate of the sound stream (44100 = CD quality).
  • +
  • status - Gets the status of the music object (Sound::Stopped, Sound::Paused, Sound::Playing).
  • +
  • open(path) - Opens a music file using the specified path (returns false on failure).
  • +
  • play - Start the music.
  • +
  • stop - Stop the music.
  • +
+ +
+

SFML::PostFX

+
    +
  • (Inherits all methods from SFML::Drawable)
  • +
  • initialize() - Default constructor
  • +
  • initialize(path) - Loads an effect file using the specified path.
  • +
  • initialize(postFX) - Makes a copy of a PostFX object.
  • +
  • loadFromFile(path) - Loads an effect file using the specified path (returns false on failure).
  • +
  • setParameter(name, x, y=nil, z=nil, w=nil) - Sets the named parameter to an array of 1, 2, 3, or 4 floats.
  • +
  • setTexture(name, image) - Sets a named texture parameter.
  • +
+ +
+

SFML::RenderWindow

+
    +
  • initialize(mode, title, style=Window::Resizable, antialias=0) - Creates a 2D render window using the specified VideoMode, title, and style
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • width, w - Gets the width of the window
  • +
  • height, h - Gets the height of the window
  • +
  • input - Gets the SFML::Input object for this window
  • +
  • frameTime - Gets the amount of time it took to render the previous frame
  • +
  • stencilBits - Gets the number of bits used in the stencil buffer
  • +
  • depthBits - Gets the number of bits used in the back buffer
  • +
  • view, view= - Gets/sets the SFML::View into the 2D world (2D camera position)
  • +
  • backgroundColor= - Sets the background color for the whole window
  • +
  • getEvent - Returns the next event in the window's event queue (or nil if the queue is empty)
  • +
  • useVerticalSync(bool) - Use to enable/disable vsync
  • +
  • showMouseCursor(bool) - Use to show/hide the operating system's mouse cursor
  • +
  • display - Call to swap the front and back buffers to display the frame
  • +
  • beginOpenGL - Call to save the OpenGL state before you call raw OpenGL methods
  • +
  • endOpenGL - Call to restore the OpenGL state after you call raw OpenGL methods
  • +
  • capture - Take a screenshot and return it as an image
  • +
  • draw(obj) - Call to draw any object derived from SFML::Drawable
  • +
  • setFramerateLimit - Set a fixed framerate (use 0 to disable it)
  • +
+ +
+

SFML::Sound

+
    +
  • initialize(sound) - Creates a copy of a Sound object
  • +
  • initialize(buffer=nil, loop=false, pitch=1, volume=100, x=0, y=0, z=0) - Creates a Sound object using the specified sound buffer and other parameters
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • buffer, buffer= - Gets/sets this sound object's SFML::SoundBuffer.
  • +
  • loop, loop= - Gets/sets the loop flag for this sound object.
  • +
  • pitch, pitch= - Gets/sets the pitch for this sound object.
  • +
  • volume, volume= - Gets/sets the volume for this sound object.
  • +
  • position, position= - Gets/sets the position for this sound object (using an array of 3 numbers).
  • +
  • status - Gets the status of this sound object (Sound::Stopped, Sound::Paused, Sound::Playing).
  • +
  • playingOffset - Gets the current playing position of the sound (in seconds).
  • +
  • play - Starts playing the sound.
  • +
  • pause - Pauses the sound.
  • +
  • stop - Stops playing the sound.
  • +
+ +
+

SFML::SoundBuffer

+
    +
  • initialize() - Default constructor
  • +
  • initialize(soundBuffer) - Creates a copy of a SoundBuffer object.
  • +
  • initialize(path) - Loads a sound file using the specified path (raises a RuntimeError on failure).
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • samples - Gets the raw (binary) samples as a Ruby string.
  • +
  • samplesCount - Gets the total number of samples (shorts) returned by the samples call.
  • +
  • samplesRate - Gets the sample rate (or number of samples per second for each channel).
  • +
  • channels - Gets the number of channels (1=mono, 2=stereo).
  • +
  • duration - Gets the duration of the sound buffer (in seconds).
  • +
  • loadFromFile(path) - Loads a sound file using the specified path (returns false on failure).
  • +
  • saveToFile(path) - Saves a sound file to the specified path (returns false on failure).
  • +
  • loadFromMemory(samples, samplesCount, channels, sampleRate) - Builds a SoundBuffer from raw (binary) samples.
  • +
+ +
+

SFML::SoundBufferRecorder

+
    +
  • initialize() - Default constructor
  • +
  • canCapture - (static) Returns true if the current system is capable of sound capture
  • +
  • start(sampleRate=44100) - Starts the sound capture
  • +
  • stop - Stops the sound capture
  • +
  • buffer - Gets the SoundBuffer object containing the captured audio
  • +
  • sampleRate - Gets the current sample rate
  • +
+ +
+

SFML::Sprite

+
    +
  • (Inherits all methods from SFML::Drawable)
  • +
  • initialize() - Default constructor
  • +
  • initialize(image, left=0, top=0, scale=1, rotation=0, c=Color.White) - Builds a Sprite object with the specified image and other options (scale can take one number or an array of two numbers)
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • width, w - Gets the sprite's width (affected by subRect and scale)
  • +
  • height, h - Gets the sprite's height (affected by subRect and scale)
  • +
  • right, right= - Gets/sets the right x position
  • +
  • bottom, bottom= - Gets/sets the bottom y position
  • +
  • x, x= - Gets/sets the center x position
  • +
  • y, y= - Gets/sets the center y position
  • +
  • image, image= - Gets/sets the image to use for this sprite
  • +
  • subRect, subRect= - Gets/sets a rectangle within the image to use (generally used for tiled images)
  • +
  • getPixel(x,y), [x,y] - Gets the color of a pixel within the sprite's subRect of the sprite's image ([0,0] would be the top-left pixel of the subRect)
  • +
  • radius - Gets the bounding radius of the sprite (based on height and width)
  • +
  • distance(sprite) - Gets the distance between the center positions of two sprites
  • +
  • render(window) - (virtual) Override to add custom rendering code
  • +
+ +
+

SFML::Text

+
    +
  • (Inherits all methods from SFML::Drawable)
  • +
  • initialize(str="", font="", size=32) - Initialize the Text object to the specified string, font, and font size.
  • +
  • preloadFont(font, size) - (static) Call this to force the font to be loaded before the first time it gets rendered.
  • + +
  • text, text= - Gets/sets the current text string.
  • +
  • font, font= - Gets/sets the current font.
  • +
  • size, size= - Gets/sets the current font size.
  • +
  • getRect - Gets the current screen rectangle.
  • +
  • render(window) - (virtual) Override to add custom rendering code
  • +
+ +
+

SFML::VideoMode

+
    +
  • initialize() - Default constructor
  • +
  • initialize(w, h, bpp=32) - Creates a VideoMode with the specified width, height, and bits-per-pixel.
  • +
  • desktop - (static) Returns the VideoMode for the current desktop.
  • +
  • each - (static) Iterates through all valid full-screen video modes.
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • width, w, width=, w= - Gets/sets the current width of this VideoMode.
  • +
  • height, h, height=, h= - Gets/sets the current height of this VideoMode.
  • +
  • bitsPerPixel, bpp, bitsPerPixel=, bpp= - Gets/sets the current bits-per-pixel of this VideoMode.
  • +
  • isValid - Returns true if the current VideoMode is a valid full-screen mode.
  • +
+ +
+

SFML::View

+
    +
  • initialize() - Default constructor
  • +
  • initialize(left, top, width, height, zoom=1) - Initializes all View members
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • left, l, left=, l= - Gets/sets the left x position for the view
  • +
  • top, t, top=, t= - Gets/sets the top y position for the view
  • +
  • width, w, width=, w= - Gets/sets the width for the view
  • +
  • height, h, height=, h= - Gets/sets the height for the view
  • +
  • zoom, zoom= - Gets/sets the zoom factor for the view
  • +
+ +
+

SFML::Window

+
    +
  • initialize(mode, title, style=Window::Resizable, antialias=0) - Creates a window using the specified VideoMode, title, and style
  • +
  • to_s - Returns a formatted string representing this object (for debugging purposes)
  • +
  • width, w - Gets the width of the window
  • +
  • height, h - Gets the height of the window
  • +
  • input - Gets the SFML::Input object for this window
  • +
  • frameTime - Gets the amount of time it took to render the previous frame
  • +
  • stencilBits - Gets the number of bits used in the stencil buffer
  • +
  • depthBits - Gets the number of bits used in the back buffer
  • +
  • getEvent - Returns the next event in the window's event queue (or nil if the queue is empty)
  • +
  • useVerticalSync(bool) - Use to enable/disable vsync
  • +
  • showMouseCursor(bool) - Use to show/hide the operating system's mouse cursor
  • +
  • display - Call to swap the front and back buffers to display the frame
  • +
  • setCurrent - Sets this window as the current target for rendering
  • +
  • setFramerateLimit - Set a fixed framerate (use 0 to disable it)
  • +
+ + + + diff --git a/ruby/doc/Reference-fr.html b/ruby/doc/Reference-fr.html new file mode 100644 index 00000000..ce3e00d4 --- /dev/null +++ b/ruby/doc/Reference-fr.html @@ -0,0 +1,430 @@ + +RubySFML Documentation + + + + +

Introduction

+

Cette documentation est assez courte, mais étant donné que cette extension n'est qu'une simple encapsulation des classes C++ de SFML, il est conseillé de se baser sur la documentation SFML pour obtenir plus de détails sur les classes et les fonctions. Cette documentation a simplement pour but de détailler les classes et fonctions qui sont présentes dans l'extension RubySFML, ainsi que de décrire les changements qui ont été effectués durant la traduction C++ vers Ruby.

+

Etant donné que Ruby ne supporte pas les threads et possède ses propres classes pour le réseau, seules certaines classes des modules système, fenêtrage, graphisme et audio sont exposées. Pour la plupart des classes, les seuls changements effectués ont été de faire débuter les noms des fonctions par une minuscule. Pour les classes possédant des accesseurs simples, ceux-ci ont souvent été abandonnés pour utiliser une syntaxe plus simple (par exemple sprite.left = ...). Quelques fonctions to_i, to_f et to_s ont étalement été ajoutées là où cela semblait pertinent. Enfin, un itérateur "each" a été ajouté à VideoMode.

+

En plus des classes C++ exposées, deux classes utiles ont également été ajoutées à RubySFML.rb, l'une pour afficher des sprites à base de tuiles, et l'autre pour gérer les sprites utilisant des calculs de vitesse / acceleration (respectivement TSprite et VSprite).

+ +

Astuces pour les utilisateurs Windows

+

Pour les utilisateurs Windows, nous regrettons de ne pas pouvoir être compatibles avec l'installeur "one-click", mais celui-ci est compilé avec Visual Studio 6.0, qui est ridiculeusement vieux et incompatible avec les bibliothèques SFML. Il existe une version gratuite de Visual Studio 2005, et les sources de Ruby compilent parfaitement avec celle-ci, on ne peut donc trouver aucune bonne excuse à l'installeur pour toujours utiliser Visual C++ 6.0.

+

La bonne nouvelle est que vous pouvez distribuer vos applications dans une archive qui se suffit à elle-même, en incluant les répertoires "bin" et "lib" qui sont inclus dans la version Windows de cette extension. Ajoutez un installeur simple qui crée une icône du menu démarrer exécutant "%install_path%\bin\ruby.exe %install_path%\my_game.rb", et tout sera parfait. Oh, encore une chose, OpenAL doit être installé pour exécuter les programmes utilisant RubySFML. Heureusement, il s'agit d'un installeur extrêmement petit et simple, et vous pourrez sans problème le fournir dans vos installations ou donner un lien pour le télécharger. Tout ceci évite à vos utilisateurs d'avoir à télécharger / exécuter l'installeur "one-click", installer toutes les extensions nécessaires, s'occuper des problèmes de compatibilité, etc. Il est probable que très peu d'utilisateurs Windows utilisent vos applications si vous ne leur fournissez pas tout ce dont ils ont besoin, c'est donc probablement mieux de cette manière.

+

Note : cette compilation perso de Ruby ne contient pas gems et zlib (qui est recquis par gems), mais aucune autre extension n'est installée. N'hésitez pas à installer n'importe quelle autre gems / extension dont vous auriez besoin (les gems mswin32 compilés avec Visual Studio 6.0 ne fonctionneront probablement pas). Gardez en tête que beaucoup de gems ont une documentation conséquente, des exemples et des répertoires de test. Supprimer ces répertoires innutiles, ainsi que le répertoire cache des gems, peut réduire de manière significative la taille des fichiers que vous distribuez.

+ +

Exemple de code RubySFML

+
+# On inclut l'extension RubySFML
+require "RubySFML"
+include SFML
+
+# On crée la fenêtre principale
+mode = VideoMode.new 800, 600, 32
+window = RenderWindow.new mode, "RubySFML Test", false
+
+# On charge un sprite à afficher
+image = Image.new "cute_image.jpg"
+sprite = Sprite.new image
+ 
+# On crée une chaîne graphique à afficher
+text = Text.new "Hello SFML", "arial.ttf", 50
+ 
+# On charge une musique et on commence à la jouer
+music = Music.new "nice_music.ogg"
+music.play
+ 
+# On démarre la boucle principale
+running = true
+while running
+	while event = window.getEvent
+		running = false if event.type == Event::Close
+	end
+ 
+	# On dessine le sprite, le texte, puis on met à jour la fenêtre
+	window.draw sprite
+	window.draw text
+	window.display
+end
+
+ +

Modules RubySFML

+ + +

Classes RubySFML

+
    +
  • SFML::Clock - Une horloge système utilisant les timers haute performance lorsqu'ils sont accessibles
  • +
  • SFML::Color - Une classe de couleurs RGBA très simple
  • +
  • SFML::Drawable - Une classe abstraite représentant les objets 2D utilisés dans une Renderwindow
  • +
  • SFML::Event - Une classe représentant les différents évènements système (clavier, souris, etc.)
  • +
  • SFML::FloatRect - Un simple rectangle composé de 4 coordonnées flottantes
  • +
  • SFML::Image - Une classe pour gérer les fichiers images et les textures
  • +
  • SFML::Input - Une classe pour récupérer l'état des périphériques d'entrée (clavier, souris, joystick)
  • +
  • SFML::IntRect - Un simple rectangle composé de 4 coordonnées entières
  • +
  • SFML::Music - Une classe pour jouer des musiques en streaming
  • +
  • SFML::PostFX - Une classe pour gérer les shaders post-rendu
  • +
  • SFML::RenderWindow - Une sous-classe de Window wui permet d'afficher les objets 2D tels que sprites et texte
  • +
  • SFML::Sound - Une classe pour jouer des sons
  • +
  • SFML::SoundBuffer - Une classe pour stocker des échantillons audio
  • +
  • SFML::SoundBufferRecorder - Une classe pour enregistrer du son à partir d'un périphérique de capture audio, comme un microphone
  • +
  • SFML::Sprite - Une classe pour gérer et afficher des sprites 2D
  • +
  • SFML::Text - Une classe pour gérer et afficher du texte 2D
  • +
  • SFML::VideoMode - Une classe pour gérer les différents modes vidéo
  • +
  • SFML::View - Une classe pour gérer la caméra 2D dans une RenderWindow
  • +
  • SFML::Window - Une classe pour créer et gérer une fenêtre capable d'afficher un rendu OpenGL (gère également les entrées et les évènements)
  • +
+ +

Fonctions RubySFML (par module / classe)

+
+

SFML

+
    +
  • checkExtension(str) - Renvoie vrai si l'extension OpenGL donnée est supportée.
  • +
  • getMaxTextureSize - Renvoie la taille maximum de texture.
  • +
  • getMaxTextureUnits - Renvoie le nombre maximum d'unités de textures utilisables.
  • +
+ +
+

SFML::Clock

+
    +
  • initialize() - Constructeur par défaut
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • reset - Remet à zéro l'horloge
  • +
  • elapsedTime,to_f - Renvoie le nombre de secondes écoulées depuis le dernier appel à reset
  • +
+ +
+

SFML::Color

+
    +
  • initialize() - Constructeur par défaut
  • +
  • initialize(n) - Construit l'objet à partir d'une couleur 32 bits entière non signée (0x12345678 donne r=0x78, g=0x56, b=0x34, a=0x12)
  • +
  • initialize(r, g, b, a=255) - Construit la couleur à partir de ses composantes
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • r, g, b, a - Renvoie les composantes r, g, b et a (respectivement)
  • +
  • r=, g=, b=, a= - Affecte les composantes r, g, b et a (respectivement)
  • +
  • toRGBA -Renvoie les 4 composantes de la couleur sous forme d'entier RGBA 32 bits non signé (0x12345678 donne r=0x78, g=0x56, b=0x34, a=0x12)
  • +
  • to_i - Alias pour toRGBA
  • +
+ +
+

SFML::Drawable

+
    +
  • initialize(left=0, top=0, scale=1, rotation=0, color=Color.White) - Initialise les différents membres (scale peut être un nombre ou un tableau de deux nombres)
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • left, left= - Modifie / récupère la position x de l'objet
  • +
  • top, top= - Modifie / récupère la position y de l'objet
  • +
  • scale, scale= - Modifie / récupère le facteur d'échelle de l'objet (renvoie un tableau, mais peut être initialisé à partir d'un tableau ou d'un seul nombre)
  • +
  • color, color= - Modifie / récupère la couleur de l'objet
  • +
  • rotation, rotation= - Modifie / récupère l'angle de rotation (en degrés)
  • +
  • upVector - Récupère le vecteur "haut" de l'objet (basé sur son angle de rotation)
  • +
  • rightVector - Récupère le vecteur "droite" de l'objet (basé sur son angle de rotation)
  • +
  • setRotationCenter(x, y) - Change le centre de rotation de l'objet
  • +
  • move(x, y) - Déplace l'objet horizontalement et verticalement
  • +
  • rotate(a) - Fait tourner l'objet
  • +
  • render(window) - (virtuelle) à redéfinir pour personnaliser le rendu de l'objet
  • +
+ +
+

SFML::Event

+
Pour tous les types d'évènements
+
    +
  • initialize - Ne prend aucun paramètre
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • type - Renvoie le type de l'évènement
  • +
+
Pour les évènements de type Event::TextEntered
+
    +
  • char - Renvoie le caractère entré (uniquement pour les évènements Event::TextEntered)
  • +
+
Pour les évènements de type Event::KeyPressed et Event::KeyReleased
+
    +
  • code - Renvoie le code de la touche (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)
  • +
  • alt - Renvoie vrai si la touche Alt est enfoncée (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)
  • +
  • control - Renvoie vrai si la touche Control est enfoncée (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)
  • +
  • shift - Renvoie vrai si la touche Shift est enfoncée (uniquement pour les évènements Event::KeyPressed et Event::KeyReleased)
  • +
+
Pour les évènements de type souris et joystick
+
    +
  • delta - Renvoie le déplacement de la molette souris (uniquement pour les évènements Event::MouseWheelMoved)
  • +
  • buttons - Renvoie l'état des boutons de la souris (uniquement pour les évènements souris)
  • +
  • button - Renvoie l'état des boutons du joystick (uniquement pour les évènements joystick)
  • +
  • x - Renvoie la position x (uniquement pour les évènements souris et joystick)
  • +
  • y - Renvoie la position y (uniquement pour les évènements souris et joystick)
  • +
  • z - Renvoie la position z (uniquement pour les évènements joystick)
  • +
+
Pour les évènements de type Event::Resize
+
    +
  • width - Renvoie la nouvelle largeur de la fenêtre (uniquement pour les évènements Event::Resize)
  • +
  • height - Renvoie la nouvelle hauteur de la fenêtre (uniquement pour les évènements Event::Resize)
  • +
+ +
+

SFML::FloatRect

+
    +
  • initialize() - Constructeur par défaut
  • +
  • initialize(left, top, right, bottom) - Initialise les coordonnées du rectangle (gauche, haut, droite, bas)
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • left, l - Renvoie la position x gauche
  • +
  • left=, l= - Modifie la position x gauche
  • +
  • top, t - Renvoie la position y haute
  • +
  • top=, t= - Modifie la position y haute
  • +
  • right, r - Renvoie la position x droite
  • +
  • right=, r= - Modifie la position x droite
  • +
  • bottom, b - Renvoie la position y basse
  • +
  • bottom=, b= - Modifie la position y basse
  • +
  • width, w - Renvoie la largeur du rectangle
  • +
  • height, h - Renvoie la hauteur du rectangle
  • +
  • contains(x, y) - Renvoie vrai si le point (x, y) est à l'intérieur du rectangle
  • +
  • intersects(rect) - Renvoie l'intersection de deux rectangles (nil s'il n'y a aucune intersection)
  • +
+ +
+

SFML::Image

+
    +
  • initialize - Crée une image vide
  • +
  • initialize(image) - Crée une copie d'une image
  • +
  • initialize(path) - Charge une image à partir du fichier spécifié (lève une erreur RuntimeError si échoue)
  • +
  • initialize(w, h, c=Color.Black) - Crée une image vide avec les dimensions et la couleur données
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • getValidTextureSize(s) - (statique) Renvoie la taille de texture valide la plus proche >= s
  • +
  • width, w - Renvoie la largeur de l'image
  • +
  • height, h - Renvoie la hauteur de l'image
  • +
  • smooth=, setSmooth(bool) - Modifie les paramètres de lissage de l'image (true pour activer, false pour désactiver)
  • +
  • repeat=, setRepeat(bool) - Modifie les paramètres de répétition de l'image (true pour activer, false pour désactiver)
  • +
  • loadFromFile(path) - Charge l'image à partir du fichier spécifié (renvoie faux si échoue)
  • +
  • saveToFile(path) - Sauvegarde l'image dans le fichier spécifié
  • +
  • create(w, h, c=Color.Black) - Crée une image vide avec les dimensions et la couleur données
  • +
  • createMaskFromColor(color, a=0) - Remplace la valeur alpha (transparence) de tous les pixels ayant la couleur spécifiée, par la valeur de transparence donnée
  • +
  • resize(w, h, c=Color.Black) - Redimensionne l'image. Si celle-ci est agrandie, les nouveaux pixels ont la couleur spécifiée
  • +
  • getPixel(x, y), [x,y] - Renvoie la couleur du pixel (x, y)
  • +
  • setPixel(x, y, c), [x,y]= - Change la couleur du pixel (x, y) par la couleur spécifiée
  • +
  • update - Met à jour l'image en mémoire vidéo (à appeler après toute modification manuelle des pixels)
  • +
  • bind - Utilise l'image pour le rendu (à appeler si vous utiliser l'image en tant que texture pour un rendu OpenGL)
  • +
  • getTexCoords(rect) - Convertit des coordonnées entières en pixel, en coordonnées flottantes de texture
  • +
+ +
+

SFML::Input

+
    +
  • initialize - Constructeur par défaut
  • +
  • isKeyDown(key) - Renvoie vrai si la touche spécifiée est enfoncée
  • +
  • isMouseButtonDown(button) - Renvoie vrai si le bouton souris spécifié est enfoncé
  • +
  • isJoystickButtonDown(n, button) - Renvoie vrai si le bouton du joystick n spécifié est enfoncé
  • +
  • getMouseX - Renvoie la position x actuelle de la souris
  • +
  • getMouseY - Renvoie la position y actuelle de la souris
  • +
  • getJoystickX(n) - Renvoie la position x actuelle du joystick n
  • +
  • getJoystickY(n) - Renvoie la position y actuelle du joystick n
  • +
  • getJoystickZ(n) - Renvoie la position z actuelle du joystick n
  • +
+ +
+

SFML::IntRect

+
    +
  • initialize() - Constructeur par défaut
  • +
  • initialize(left, top, right, bottom) - Initialise les coordonnées du rectangle (gauche, haut, droite, bas)
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • left, l - Renvoie la position x gauche
  • +
  • left=, l= - Modifie la position x gauche
  • +
  • top, t - Renvoie la position y haute
  • +
  • top=, t= - Modifie la position y haute
  • +
  • right, r - Renvoie la position x droite
  • +
  • right=, r= - Modifie la position x droite
  • +
  • bottom, b - Renvoie la position y basse
  • +
  • bottom=, b= - Modifie la position y basse
  • +
  • width, w - Renvoie la largeur du rectangle
  • +
  • height, h - Renvoie la hauteur du rectangle
  • +
  • contains(x, y) - Renvoie vrai si le point (x, y) est à l'intérieur du rectangle
  • +
  • intersects(rect) - Renvoie l'intersection de deux rectangles (nil s'il n'y a aucune intersection)
  • +
+ +
+

SFML::Music

+
    +
  • initialize(bufSize=44100) - Permet de spécifier la taille du tampon interne (à modifier si vous rencontrez des problèmes de performances ou de saccades)
  • +
  • initialize(path) - Ouvre la musique à partir du fichier spécifié (lève une erreur RuntimeError si échoue).
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • loop, loop= - Renvoie / modifie un booléen indiquant si la musique doit boucler lorsqu'elle est terminée
  • +
  • duration - Renvoie la durée totale de la musique, en secondes
  • +
  • channels - Renvoie le nombre de canaux de la musique (1 = mono, 2 = stereo).
  • +
  • sampleRate - Renvoie le taux d'échantillonnage de la musique (44100 = qualité CD).
  • +
  • status - Renvoie l'état de lecture de la musique (Sound::Stopped, Sound::Paused, Sound::Playing).
  • +
  • open(path) - Ouvre la musique à partir du fichier spécifié (renvoie faux si échoue).
  • +
  • play - Démarre la lecture de la musique
  • +
  • stop - Stoppe la lecture de la musique
  • +
+ +
+

SFML::PostFX

+
    +
  • (Hérite de toutes les fonctions de SFML::Drawable)
  • +
  • initialize() - Constructeur par défaut
  • +
  • initialize(path) - Charge le fichier effet spécifié
  • +
  • initialize(postFX) - Crée une copie d'un objet PostFX
  • +
  • loadFromFile(path) - Charge le fichier effet spécifié (renvoie faux si échoue)
  • +
  • setParameter(name, x, y=nil, z=nil, w=nil) - Change la valeur d'un paramètre de l'effet
  • +
  • setTexture(name, image) - Change une texture de l'effet
  • +
+ +
+

SFML::RenderWindow

+
    +
  • initialize(mode, title, style=Window::Resizable, antialias=0) - Crée une fenêtre de rendu 2D en utilisant le mode vidéo, le titre et le style spécifiés
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • width, w - Renvoie la largeur de la fenêtre
  • +
  • height, h - Renvoie la hauteur de la fenêtre
  • +
  • input - Renvoie l'objet SFML::Input associé à cette fenêtre
  • +
  • frameTime - Renvoie le temps écoulé depuis le dernier rafraîchissement
  • +
  • stencilBits - Renvoie le nombre de bits alloués au tampon stencil
  • +
  • depthBits - Renvoie le nombre de bits alloués au tampon de profondeur
  • +
  • view, view= - Renvoie / modifie l'objet SFML::View courant (camera 2D)
  • +
  • backgroundColor= - Modifie la couleur de fond de la fenêtre
  • +
  • getEvent - Renvoie le prochain évènement en attente dans la file d'évènements (ou nil s'il n'y en a aucun)
  • +
  • useVerticalSync(bool) - Active / désactive la synchronisation verticale
  • +
  • showMouseCursor(bool) - Affiche / cache le curseur souris sur la fenêtre
  • +
  • display - Met à jour la fenêtre à l'écran
  • +
  • beginOpenGL - Sauvegarde les états OpenGL internes avant que vous ne placiez des appels OpenGL
  • +
  • endOpenGL - Restaure les états OpenGL internes après que vous ayiez placé des appels OpenGL
  • +
  • capture - Prend une capture d'écran et la renvoie sous forme d'image
  • +
  • draw(obj) - Affiche dans la fenêtre tout objet dérivant de SFML::Drawable
  • +
  • setFramerateLimit - Fixe une limite de rafraîchissement, en images par seconde (0 pour désactiver)
  • +
+ +
+

SFML::Sound

+
    +
  • initialize(sound) - Crée une copie d'un objet son
  • +
  • initialize(buffer=nil, loop=false, pitch=1, volume=100, x=0, y=0, z=0) - Crée un objet son en utilisant le tampon audio et les autres paramètres spécifiés
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • buffer, buffer= - Renvoie / modifie le SFML::SoundBuffer de cet objet
  • +
  • loop, loop= - Renvoie / modifie l'état de bouclage du son
  • +
  • pitch, pitch= - Renvoie / modifie le pitch du son
  • +
  • volume, volume= - Renvoie / modifie le volume du son
  • +
  • position, position= -Renvoie / modifie la position du son (utilise un tableau de 3 valeurs)
  • +
  • status - Renvoie l'état de lecture du son (Sound::Stopped, Sound::Paused, Sound::Playing).
  • +
  • playingOffset - Renvoie la position de lecture courante du son (en secondes).
  • +
  • play - Démarre la lecture du son
  • +
  • pause - Met ne pause le son
  • +
  • stop - Stoppe la lecture du son
  • +
+ +
+

SFML::SoundBuffer

+
    +
  • initialize() - Constructeur par défaut
  • +
  • initialize(soundBuffer) - Crée une copie d'un objet SoundBuffer
  • +
  • initialize(path) - Charge le tampon sonore à partir du fichier spécifié (lève une erreur RuntimeError si échoue).
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • samples - Renvoie les échantillons sonores bruts sous forme de chaîne Ruby
  • +
  • samplesCount - Renvoie le nombre d'échantillons sonores du tampon
  • +
  • samplesRate - Renvoie le taux d'échantillonnage (nombre d'échantillons par seconde pour chaque canal)
  • +
  • channels - Renvoie le nombre de canaux (1 = mono, 2 = stereo)
  • +
  • duration - Renvoie la durée du tampon sonore (en secondes)
  • +
  • loadFromFile(path) - Charge le tampon sonore à partir du fichier spécifié (renvoie faux si échoue)
  • +
  • saveToFile(path) - Sauvegarde le tampon sonore dans le fichier spécifié (renvoie faux si échoue)
  • +
  • loadFromMemory(samples, samplesCount, channels, sampleRate) - Construit le tampon sonore à partir d'échantillons bruts en mémoire
  • +
+ +
+

SFML::SoundBufferRecorder

+
    +
  • initialize() - Constructeur par défaut
  • +
  • canCapture - (statique) Renvoie vrai si le système est capable d'effectuer les captures audio
  • +
  • start(sampleRate=44100) - Démarre la capture audio
  • +
  • stop - Stoppe la capture audio
  • +
  • buffer - Renvoie l'objet SoundBuffer contenant le son capturé
  • +
  • sampleRate - Renvoie le taux d'échantillonnage utilisé pour la capture
  • +
+ +
+

SFML::Sprite

+
    +
  • (Hérite de toutes les fonctions de SFML::Drawable)
  • +
  • initialize() - Constructeur par défaut
  • +
  • initialize(image, left=0, top=0, scale=1, rotation=0, c=Color.White) - Construit le sprite à partir de l'image et des autres paramètres donnés (le paramètre scale peut être un nombre simple ou un tableau de deux nombres)
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • width, w - Renvoie la largeur du sprite (affectée par subRect et scale)
  • +
  • height, h - Renvoie la hauteur du sprite (affectée par subRect et scale)
  • +
  • right, right= - Renvoie / modifie la position x droite du sprite
  • +
  • bottom, bottom= - Renvoie / modifie la position y basse du sprite
  • +
  • x, x= - Renvoie / modifie la position x centrale du sprite
  • +
  • y, y= - Renvoie / modifie la position y centrale du sprite
  • +
  • image, image= - Renvoie / modifie l'image utilisée par le sprite
  • +
  • subRect, subRect= - Renvoie / modifie le sous-rectangle de l'image source utilisé pour le sprite
  • +
  • getPixel(x,y), [x,y] - Renvoie la couleur d'un pixel du sprite relativement à son sous-rectangle ([0, 0] serait le pixel haut-gauche du sous-rectangle)
  • +
  • radius - Renvoie le rayon du cercle englobant du sprite (basé sur sa hauteur et sa largeur)
  • +
  • distance(sprite) - Renvoie la distance entre les centres de deux sprites
  • +
  • render(window) - (virtuelle) A redéfinir pour effectuer un rendu personnalisé
  • +
+ +
+

SFML::Text

+
    +
  • (Hérite de toutes les fonctions de SFML::Drawable)
  • +
  • initialize(str="", font="", size=32) - Initialise l'objet Text avec le texte, la police et la taille spécifiés
  • +
  • preloadFont(font, size) - (statique) Force le chargement de la police avant sa première utilisation
  • +
  • text, text= - Renvoie / modifie la chaîne à afficher
  • +
  • font, font= - Renvoie / modifie la police de caractères à utiliser
  • +
  • size, size= - Renvoie / modifie la taille du texte
  • +
  • getRect - Renvoie le rectangle englobant de la chaîne graphique
  • +
  • render(window) - (virtuelle) A redéfinir pour effectuer un rendu personnalisé
  • +
+ +
+

SFML::VideoMode

+
    +
  • initialize() - Constructeur par défaut
  • +
  • initialize(w, h, bpp=32) - Crée un mode vidéo avec les dimensions et la profondeur (bits par pixel) spécifiées
  • +
  • desktop - (statique) Renvoie le mode vidéo actuel du bureau
  • +
  • each - (statique) Itère sur tous les modes vidéo plein écran valides
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • width, w, width=, w= - Renvoie / modifie la largeur du mode vidéo
  • +
  • height, h, height=, h= - Renvoie / modifie la hauteur du mode vidéo
  • +
  • bitsPerPixel, bpp, bitsPerPixel=, bpp= - Renvoie / modifie la profondeur (bits par pixels) du mode vidéo
  • +
  • isValid - Renvoie vrai si le mode est un mode plein écran valide
  • +
+ +
+

SFML::View

+
    +
  • initialize() - Constructeur par défaut
  • +
  • initialize(left, top, width, height, zoom=1) - Initialise la vue avec la position, taille et le zomm spécifiés
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • left, l, left=, l= - Renvoie / modifie la position x gauche de la vue
  • +
  • top, t, top=, t= - Renvoie / modifie la position y haute de la vue
  • +
  • width, w, width=, w= - Renvoie / modifie la largeur de la vue
  • +
  • height, h, height=, h= - Renvoie / modifie la hauteur de la vue
  • +
  • zoom, zoom= - Renvoie / modifie le facteur de zoom de la vue
  • +
+ +
+

SFML::Window

+
    +
  • initialize(mode, title, style=Window::Resizable, antialias=0) - Crée une fenêtre en utilisant le mode vidéo, le titre et le style spécifiés
  • +
  • to_s - Renvoie une chaîne formatée décrivant l'objet (pour déboguage)
  • +
  • width, w - Renvoie la largeur de la fenêtre
  • +
  • height, h - Renvoie la hauteur de la fenêtre
  • +
  • input - Renvoie l'objet SFML::Input associé à cette fenêtre
  • +
  • frameTime - Renvoie le temps écoulé depuis le dernier rafraîchissement
  • +
  • stencilBits - Renvoie le nombre de bits alloués au tampon stencil
  • +
  • depthBits - Renvoie le nombre de bits alloués au tampon de profondeur
  • +
  • getEvent - Renvoie le prochain évènement en attente dans la file d'évènements (ou nil s'il n'y en a aucun)
  • +
  • useVerticalSync(bool) - Active / désactive la synchronisation verticale
  • +
  • showMouseCursor(bool) - Affiche / cache le curseur souris sur la fenêtre
  • +
  • display - Met à jour la fenêtre à l'écran
  • +
  • setCurrent - Rend la fenêtre courante active pour le rendu
  • +
  • setFramerateLimit - Fixe une limite de rafraîchissement, en images par seconde (0 pour désactiver)
  • +
+ + + diff --git a/ruby/gzip.exe b/ruby/gzip.exe new file mode 100644 index 00000000..a585edd9 Binary files /dev/null and b/ruby/gzip.exe differ diff --git a/ruby/rubygems-0.9.4.zip b/ruby/rubygems-0.9.4.zip new file mode 100644 index 00000000..79c1199b Binary files /dev/null and b/ruby/rubygems-0.9.4.zip differ diff --git a/ruby/tar.exe b/ruby/tar.exe new file mode 100644 index 00000000..d528bd36 Binary files /dev/null and b/ruby/tar.exe differ diff --git a/ruby/test/SideScroller.bat b/ruby/test/SideScroller.bat new file mode 100644 index 00000000..5f2b0e3a --- /dev/null +++ b/ruby/test/SideScroller.bat @@ -0,0 +1 @@ +..\bin\ruby.exe SideScroller.rb diff --git a/ruby/test/SideScroller.rb b/ruby/test/SideScroller.rb new file mode 100644 index 00000000..59a33cfc --- /dev/null +++ b/ruby/test/SideScroller.rb @@ -0,0 +1,240 @@ +require 'RubySFML' +include SFML + +module Tiles + Grass = 0 + Earth = 1 +end + +# Collectible item. +class Gem2 < Sprite + def initialize(image, x, y) + super(image) + self.x = x + self.y = y + end + + def update + self.rotation = 25 * Math.sin($clock.to_f*6) + end +end + +class Player < VSprite + attr_reader :score + + def initialize(image, w, h) + super(image, w, h) + @sb = SoundBuffer.new("media/Beep.wav") + @sound = Sound.new(@sb) + @score = 0 + end + + def update(window, map) + time = window.frameTime + input = window.input + + # If there's no ground beneath my feet, increase speed downward + if !map.solid?(self.x, self.bottom) + @vy += 1 + # If there is ground beneath my feet, and the user presses up, + # boost speed upwards to jump + elsif input.isKeyDown(Key::Up) + @vy = -20 + end + + super(1) # Update position based on velocity + + # If we just moved down, see it we landed + if @vy > 0 + if map.solid?(self.x, self.bottom) + @vy = 0 + self.top -= self.top % 50 + end + # If we just moved up, see if we hit our head + elsif @vy < 0 + if map.solid?(self.x, self.top) + @vy = 0 + self.top += 50 - self.top % 50 + end + end + + moved = false + if input.isKeyDown(Key::Left) + moved = true + self.x -= 10 + # If we just moved left, see if we hit a wall + if map.solid?(self.left, self.y) + self.left += 50 - self.left % 50 + end + end + + if input.isKeyDown(Key::Right) + moved = true + self.x += 10 + # If we just moved right, see if we hit a wall + if map.solid?(self.right, self.y) + self.left -= self.left % 50 + end + end + + if @vy < 0 + @tx = 3 + elsif moved + @tx = (@tx + 1) % 3 + else + @tx = 0 + end + + # Same as in the tutorial game. + map.gems.reject! do |c| + if (c.x - self.x).abs < 50 and (c.y - self.y).abs < 50 + @sound.play + @score += 10 + true + else + false + end + end + end +end + +# Map class holds and draws tiles and gems. +class Map < Drawable + attr_reader :width, :height, :gems + + def initialize(filename, player) + @start = Time.now + @tileset_image = Image.new("media/Tileset.png") + @tileset = TSprite.new(@tileset_image, 50, 50) + @gem_image = Image.new("media/Gem.png") + @gems = [] + @exit_image = Image.new("media/Star.png") + @exit = TSprite.new(@exit_image, 25, 25) + + lines = File.readlines(filename).map { |line| line.chop } + @height = lines.size + @width = lines[0].size + @tiles = Array.new(@width) do |x| + Array.new(@height) do |y| + case lines[y][x, 1] + when '"' then Tiles::Grass + when '#' then Tiles::Earth + when 'S' then player.x, player.y = x*50, y*50; nil + when 'E' then @exit.left, @exit.top = x*50+25, y*50+25; nil + when 'x' then @gems << Gem2.new(@gem_image, x * 50 + 25, y * 50 + 25); nil + else nil + end + end + end + end + + def done?(player) + player.x.to_i/50 == @exit.x.to_i/50 and player.y.to_i/50 == @exit.y.to_i/50 + end + + def render(window) + # Very primitive drawing function: + # Draws all the tiles, some off-screen, some on-screen. + @height.times do |y| + @width.times do |x| + tile = @tiles[x][y] + if tile + @tileset.tx = tile + @tileset.left = x * 50 + @tileset.top = y * 50 + window.draw(@tileset) if + @tileset.right > window.view.left and + @tileset.left < window.view.right and + @tileset.bottom > window.view.top and + @tileset.top < window.view.bottom + end + end + end + @gems.each { |c| + c.update + window.draw(c) if + c.right > window.view.left and + c.left < window.view.right and + c.bottom > window.view.top and + c.top < window.view.bottom + } + window.draw(@exit) + end + + # Solid at a given pixel position? + def solid?(x, y) + x < 0 or y < 0 or x >= @width*50 or y >= @height*50 or @tiles[x / 50][y / 50] + end +end + +$clock = Clock.new +mode = VideoMode.new(640, 480, 32) +win = RenderWindow.new(mode, "RubySFML Test", 0) +view = View.new(FloatRect.new(0, 0, 640, 480)) +win.showMouseCursor(false) +win.useVerticalSync(true) +sky_image = Image.new("media/Space.png") +sky = Sprite.new(sky_image) +player_image = Image.new("media/CptnRuby.png") +player = Player.new(player_image, 50, 50) +levels = Dir["media/Level*.txt"].sort +level = 1 +level_start = Time.now +map = Map.new(levels.shift, player) + +# Simple game loop +done = false +game_over = false +while !done + if map.done?(player) + if levels.empty? + game_over = true + else + level += 1 + level_start = Time.now + map = Map.new(levels.shift, player) + end + end + + while e = win.getEvent() + done = true if e.type == Event::Closed or + (e.type == Event::KeyReleased and e.code == Key::Escape) + end + + player.update(win, map) + + left = player.x - 640/2 + left = 0 if left < 0 + left = map.width*50-640 if left > map.width*50-640 + top = player.y - 480/2 + top = 0 if top < 0 + top = map.height*50-480 if top > map.height*50-480 + view.rect = FloatRect.new(left, top, left+640, top+480) + win.setView(view) + + sky.left = view.rect.left + sky.top = view.rect.top + win.draw(sky) + win.draw(map) + win.draw(player) + score = Text.new("Score: #{player.score}", "", 20) + score.left, score.top = sky.left, sky.top + win.draw(score) + + if game_over + text = Text.new("Game Over!", "", 60) + text.left, text.top = sky.left+200, sky.top+200 + win.draw(text) + elsif Time.now - level_start < 3 + text = Text.new("Level #{level}!", "", 60) + text.left, text.top = sky.left+200, sky.top+200 + win.draw(text) + text = Text.new("(Collect the gems and find the exit)", "", 25) + text.left, text.top = sky.left+125, sky.top+260 + win.draw(text) + end + + win.display() + sleep(0.01) +end + diff --git a/ruby/test/Tetris.bat b/ruby/test/Tetris.bat new file mode 100644 index 00000000..d5fac16f --- /dev/null +++ b/ruby/test/Tetris.bat @@ -0,0 +1 @@ +..\bin\ruby.exe tetris.rb diff --git a/ruby/test/Tutorial.bat b/ruby/test/Tutorial.bat new file mode 100644 index 00000000..d27785c7 --- /dev/null +++ b/ruby/test/Tutorial.bat @@ -0,0 +1 @@ +..\bin\ruby.exe Tutorial.rb diff --git a/ruby/test/Tutorial.rb b/ruby/test/Tutorial.rb new file mode 100644 index 00000000..d973cf5c --- /dev/null +++ b/ruby/test/Tutorial.rb @@ -0,0 +1,102 @@ +require 'RubySFML' +include SFML + +TURN = 180 +THRUST = 200 + +class Player < VSprite + attr_reader :score + + def initialize(image) + super(image, image.w, image.h) + @sb = SoundBuffer.new("media/Beep.wav") + @beep = Sound.new(@sb) + @score = 0 + end + + def warp(x, y) + self.x = x + self.y = y + end + + def turn_left(time) super(TURN*time); end + def turn_right(time) super(TURN*time); end + def accelerate(time) super(upVector, THRUST*time); end + def update(time) + super(time) + self.x %= 640 + self.y %= 480 + scale_speed(1.0 - 0.5*time) + end + + def collect(stars) + stars.reject! { |star| + if distance(star) < 35 then + @score += 10 + @beep.play + true + else + false + end + } + end +end + +class Star < TSprite + def initialize(image) + super(image, image.h, image.h) + self.color = Color.new(rand(255 - 40) + 40, rand(255 - 40) + 40, rand(255 - 40) + 40, 255) + self.x = rand * 640 + self.y = rand * 480 + self.subRect = IntRect.new(0, 0, image.h, image.h) + @last_change = $clock.to_f + end + + def update(time) + if $clock.to_f - @last_change >= 0.1 # Change every 10th of a second + @tx = (@tx+1) % 10 + @last_change = $clock.to_f + end + end +end + +$clock = Clock.new +mode = VideoMode.new(640, 480, 32) +win = RenderWindow.new(mode, "RubySFML Test", Window::Fullscreen) +win.showMouseCursor(false) +win.useVerticalSync(true) +background_image = Image.new("media/Space.png") +player_image = Image.new("media/Starfighter.png") +star_image = Image.new("media/Star.png") + +background = Sprite.new(background_image) +player_image.createMaskFromColor(Color.new(255, 0, 255, 255)) +player = Player.new(player_image) +player.warp(320, 240) +stars = [] +10.times { stars << Star.new(star_image) } + +# Simple game loop +done = false +while !done + while e = win.getEvent() + done = true if e.type == Event::Closed or + (e.type == Event::KeyReleased and e.code == Key::Escape) + end + time = win.frameTime + input = win.input + player.turn_left(time) if input.isKeyDown(Key::Left) + player.turn_right(time) if input.isKeyDown(Key::Right) + player.accelerate(time) if input.isKeyDown(Key::Up) + player.update(time) + player.collect(stars) + stars << Star.new(star_image) if rand(100) < 1 and stars.size < 10 + stars.each {|star| star.update(time) } + + win.draw(background) + stars.each {|star| win.draw(star) } + win.draw(player) + win.draw(Text.new("Score: #{player.score}", "", 20)) + win.display() +end + diff --git a/ruby/test/fps.bat b/ruby/test/fps.bat new file mode 100644 index 00000000..b171e23c --- /dev/null +++ b/ruby/test/fps.bat @@ -0,0 +1 @@ +..\bin\ruby.exe fps.rb diff --git a/ruby/test/fps.rb b/ruby/test/fps.rb new file mode 100644 index 00000000..4f48db99 --- /dev/null +++ b/ruby/test/fps.rb @@ -0,0 +1,313 @@ +require 'RubySFML' +include SFML +require 'gl' +include Gl +require 'glu' +include Glu + +class Array + def magnitude + return Math::sqrt(self[0]**2 + self[1]**2 + self[2]**2) + end + def normalize + mag = self.magnitude + return [self[0]/mag, self[1]/mag, self[2]/mag] + end + def normalize! + mag = self.magnitude + self[0] /= mag + self[1] /= mag + self[2] /= mag + end + def vec(pos) + return [pos[0]-self[0], pos[1]-self[1], pos[2]-self[2]] + end + def dot(vec) + return self[0]*vec[0] + self[1]*vec[1] + self[2]*vec[2] + end + def cross(vec) + return [ + self[1]*vec[2] - self[2]*vec[1], + self[2]*vec[0] - self[0]*vec[2], + self[0]*vec[1] - self[1]*vec[0] + ] + end +end + +class Player + attr_accessor :pos, :view, :score + def initialize(x, y) + @score = 0 + @pos = [x+0.5, 10, y+0.5] + @view = [0, 0, -1] + end + + def turn_left(time) + angle = -2.0 * time + @view[0], @view[2] = @view[0]*Math::cos(angle) - @view[2]*Math::sin(angle), @view[0]*Math::sin(angle) + @view[2]*Math::cos(angle) + @view.normalize! + end + + def turn_right(time) + angle = 2.0 * time + @view[0], @view[2] = @view[0]*Math::cos(angle) - @view[2]*Math::sin(angle), @view[0]*Math::sin(angle) + @view[2]*Math::cos(angle) + @view.normalize! + end + + def move_right(time) + angle = 0.5*Math::PI + right = [@view[0]*Math::cos(angle) - @view[2]*Math::sin(angle), 0, @view[0]*Math::sin(angle) + @view[2]*Math::cos(angle)] + d = 5*time + @pos = [@pos[0]+right[0]*d, @pos[1], @pos[2]+right[2]*d] + end + + def move_left(time) + angle = 0.5*Math::PI + right = [@view[0]*Math::cos(angle) - @view[2]*Math::sin(angle), 0, @view[0]*Math::sin(angle) + @view[2]*Math::cos(angle)] + d = 5*time + @pos = [@pos[0]-right[0]*d, @pos[1], @pos[2]-right[2]*d] + end + + def move_forward(time) + d = 5*time + @pos = [@pos[0]+@view[0]*d, @pos[1], @pos[2]+@view[2]*d] + end + + def move_backward(time) + d = 5*time + @pos = [@pos[0]-@view[0]*d, @pos[1], @pos[2]-@view[2]*d] + end + + def init_view + glLoadIdentity() + gluLookAt(@pos[0], @pos[1], @pos[2], @pos[0]+@view[0], @pos[1]+@view[1], @pos[2]+@view[2], 0, 1, 0) + end + + def update(win, map) + pos = @pos + input, time = win.input, win.frameTime + turn_left(time) if input.isKeyDown(Key::Left) + turn_right(time) if input.isKeyDown(Key::Right) + move_forward(time) if input.isKeyDown(Key::W) + move_backward(time) if input.isKeyDown(Key::S) + move_left(time) if input.isKeyDown(Key::A) + move_right(time) if input.isKeyDown(Key::D) + @pos = pos if map.solid?(@pos[0], @pos[2]) + end +end + +class Block + attr_accessor :pos + def initialize(x, y) + @pos = [x.to_i+0.5, 0, y.to_i+0.5] + end + + def draw() + glPushMatrix() + glTranslatef(@pos[0], @pos[1], @pos[2]) + glColor4f(1, 0, 0, 1) + glBegin(GL_QUADS) + # Facing +z + glNormal3d(0, 0, 1) + glVertex3f(0.5, 0.5, 0.5) + glVertex3f(-0.5, 0.5, 0.5) + glVertex3f(-0.5, -0.5, 0.5) + glVertex3f(0.5, -0.5, 0.5) + # Facing -z + glNormal3d(0, 0, -1) + glVertex3f(-0.5, 0.5, -0.5) + glVertex3f(0.5, 0.5, -0.5) + glVertex3f(0.5, -0.5, -0.5) + glVertex3f(-0.5, -0.5, -0.5) + # Facing +x + glNormal3d(1, 0, 0) + glVertex3f(0.5, 0.5, 0.5) + glVertex3f(0.5, -0.5, 0.5) + glVertex3f(0.5, -0.5, -0.5) + glVertex3f(0.5, 0.5, -0.5) + # Facing -x + glNormal3d(-1, 0, 0) + glVertex3f(-0.5, 0.5, 0.5) + glVertex3f(-0.5, 0.5, -0.5) + glVertex3f(-0.5, -0.5, -0.5) + glVertex3f(-0.5, -0.5, 0.5) + glEnd() + glPopMatrix() + end +end + +class Billboard + attr_accessor :pos + def initialize(x, y, size=0.25) + @size = size + @pos = [x.to_i+0.5, 0, y.to_i+0.5] + end + + def draw(camera) + normal = @pos.vec(camera.pos).normalize + up = [0, 1, 0] + right = up.cross(normal).normalize + + glPushMatrix() + glTranslatef(@pos[0], @pos[1], @pos[2]) + glColor4f(1, 1, 1, 1) + glBegin(GL_QUADS) + # Facing camera + glNormal3d(normal[0], normal[1], normal[2]) + glTexCoord2f(1, 0) + glVertex3f((right[0]+up[0])*@size, (right[1]+up[1])*@size, (right[2]+up[2])*@size) + glTexCoord2f(0, 0) + glVertex3f((-right[0]+up[0])*@size, (-right[1]+up[1])*@size, (-right[2]+up[2])*@size) + glTexCoord2f(0, 1) + glVertex3f(-(right[0]+up[0])*@size, -(right[1]+up[1])*@size, -(right[2]+up[2])*@size) + glTexCoord2f(1, 1) + glVertex3f((right[0]-up[0])*@size, (right[1]-up[1])*@size, (right[2]-up[2])*@size) + glEnd() + glPopMatrix() + end +end + +# Map class holds and draws tiles and gems. +class Map + attr_reader :width, :height, :blocks, :gems + + def initialize(filename, player) + @start = Time.now + @sb = SoundBuffer.new("media/Beep.wav") + @sound = Sound.new(@sb) + @gem_image = Image.new("media/Gem.png") + @exit_image = Image.new("media/Star.png") + @exit_image.resize(25, 25, Color.Black) + @exit = nil + @blocks = [] + @gems = [] + + lines = File.readlines(filename).map { |line| line.chop } + @height = lines.size + @width = lines[0].size + @tiles = Array.new(@width) do |x| + Array.new(@height) do |y| + case lines[y][x, 1] + when '"', '#' then @blocks << Block.new(x, y); @blocks[-1] + when 'S' then player.pos = [x+0.5, 0, y+0.5]; nil + when 'E' then @exit = Billboard.new(x, y); nil + when 'x' then @gems << Billboard.new(x, y); nil + else nil + end + end + end + end + + def draw(player) + @blocks.each {|b| b.draw()} + glEnable(GL_TEXTURE_2D) + @gem_image.bind + @gems.each {|g| g.draw(player)} + @exit_image.bind + @exit.draw(player) + glDisable(GL_TEXTURE_2D) + end + + def exit?(player) + player.pos[0].to_i == @exit.pos[0].to_i and player.pos[2].to_i == @exit.pos[2].to_i + end + + # Solid at a given pixel position? + def solid?(x, y) + y < 0 or x < 0 or x >= @width or y >= @width or @tiles[x.to_i][y.to_i] + end + + def collect_gems(player) + @gems.reject! {|g| + if player.pos.vec(g.pos).magnitude <= 0.5 + @sound.play + player.score += 10 + true + else + false + end + } + end +end + +$clock = Clock.new +mode = VideoMode.new(640, 480, 32) +win = RenderWindow.new(mode, "RubySFML Test", 0) +win.showMouseCursor(false) +win.useVerticalSync(true) +sky_image = Image.new("media/Space.png") +player = Player.new(0, 5) +levels = Dir["media/Level*.txt"].sort +level = 1 +level_start = Time.now +map = Map.new(levels.shift, player) + +# Simple game loop +done = false +while !done + if map.exit?(player) + if levels.empty? + game_over = true + else + level += 1 + level_start = Time.now + map = Map.new(levels.shift, player) + end + end + + while e = win.getEvent() + done = true if e.type == Event::Closed or + (e.type == Event::KeyReleased and e.code == Key::Escape) + end + time = win.frameTime + player.update(win, map) + + #win.beginOpenGL() + glEnable(GL_DEPTH_TEST) + glEnable(GL_CULL_FACE) + glEnable(GL_BLEND) + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) + glMatrixMode(GL_PROJECTION) + glPushMatrix() + glLoadIdentity() + gluPerspective(45.0, 640.0/480.0, 0.1, 100.0) + glMatrixMode(GL_MODELVIEW) + glPushMatrix() + player.init_view() + glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) + glEnable(GL_COLOR_MATERIAL) + glEnable(GL_LIGHTING) + glEnable(GL_LIGHT0) + glEnable(GL_NORMALIZE) + glDisable(GL_TEXTURE_2D) + glLightfv(GL_LIGHT0, GL_POSITION, player.pos + [1]) + glLightfv(GL_LIGHT0, GL_DIFFUSE, [1, 1, 1, 1]) + glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.25) + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, [0, 0, 0, 1]) + map.collect_gems(player) + map.draw(player) + glPopMatrix() + glMatrixMode(GL_PROJECTION) + glPopMatrix() + #win.endOpenGL() + + text = Text.new("Score: #{player.score}", "", 20) + win.draw(text) + + if game_over + text = Text.new("Game Over!", "", 60) + text.left, text.top = 200, 200 + win.draw(text) + elsif Time.now - level_start < 3 + text = Text.new("Level #{level}!", "", 60) + text.left, text.top = 200, 200 + win.draw(text) + text = Text.new("(Collect the gems and find the exit)", "", 25) + text.left, text.top = 125, 260 + win.draw(text) + end + + win.display() + sleep(0.01) +end + diff --git a/ruby/test/media/Beep.wav b/ruby/test/media/Beep.wav new file mode 100644 index 00000000..589a3edd Binary files /dev/null and b/ruby/test/media/Beep.wav differ diff --git a/ruby/test/media/CptnRuby.png b/ruby/test/media/CptnRuby.png new file mode 100644 index 00000000..7b6a3257 Binary files /dev/null and b/ruby/test/media/CptnRuby.png differ diff --git a/ruby/test/media/Gem.png b/ruby/test/media/Gem.png new file mode 100644 index 00000000..695825ea Binary files /dev/null and b/ruby/test/media/Gem.png differ diff --git a/ruby/test/media/LICENSE b/ruby/test/media/LICENSE new file mode 100644 index 00000000..2ad38d20 --- /dev/null +++ b/ruby/test/media/LICENSE @@ -0,0 +1,29 @@ +NOTE: The Tutorial.rb and SideScroller.rb demos were ported from the gosu +Ruby extension. As the Ruby code does not use the gosu extension, I doubt +the code will be considered a derivative work. However, some of the +media files are theirs, so we've included their copyright notice and license. + + +Copyright (C) 2004-2007 Julian Raschke, Jan Lücker and all contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +Julian Raschke julian@raschke.de +Jan Lücker jan.luecker@gmx.de +http://code.google.com/p/gosu/ diff --git a/ruby/test/media/Level 1.txt b/ruby/test/media/Level 1.txt new file mode 100644 index 00000000..c91378bd --- /dev/null +++ b/ruby/test/media/Level 1.txt @@ -0,0 +1,10 @@ +############## +#............# +#...........## +#...#....S...# +#.....""""...# +#.....#......E +#"""""#.....## +#.xxxx......## +#.xxxx...##### +######"""##### diff --git a/ruby/test/media/Level 2.txt b/ruby/test/media/Level 2.txt new file mode 100644 index 00000000..6cb66bcb --- /dev/null +++ b/ruby/test/media/Level 2.txt @@ -0,0 +1,26 @@ +###################################################### +S....x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x...# +#....................................................# +#""""""""""""""""""""""""""""""""""""""""""""""""""..# +#....................................................# +#....................................................# +#..""""""""""""""""""""""""""""""""""""""""""""""""""# +#..##x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#### +#....................................................# +#.........###...........###...........###............# +#.......#.....#.......#.....#.......#.....#..........# +#.....#.........#...#.........#...#.........#...#....# +#...#x.x.x.x.x.x.x#x.x.x.x.x.x.x#x.x.x.x.x.x.x#x.x...# +#....................................................# +#..""""""""""""""""""""""""""""""""""""""""""""""""""# +#..################################################### +#....x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x...# +#....x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x...# +#""""""""""""""""""""""""""""""""""""""""""""""""""..# +###################################################..# +#....x..x..x..x..x..x..x..x..x..x..x..x..x..x..x..x..# +#....................................................# +#....................................................# +#..################################################### +#....x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x.x...# +####################################################E# diff --git a/ruby/test/media/Level 3.txt b/ruby/test/media/Level 3.txt new file mode 100644 index 00000000..f9c1fb4a --- /dev/null +++ b/ruby/test/media/Level 3.txt @@ -0,0 +1,25 @@ +###################################################### +#........S...........................................# +#.............xx......x.x............................# +#............x..x....................................# +#x....x...x..x.......#####..xxx....................x.# +#.x.........................xxx.........##.........x.# +#...............""..........###...##..........##.....# +#..##..###..##..##...................................# +#........................................xx........### +#.............................###....................# +##....##.............................................# +#....................##....##......##....##....##....# +#.................................................x..# +#...x....##....##.......x...x.....................x..# +#.....x...............x...x...x...................x..# +#......x...##.....##.................................# +#.......x.........................................#..# +#...........##........#...#...#..#.......x...........# +#...#................................................# +#....."""".................x.......#..#####...###....# +#x....#......................##......................# +#"""""#.....#.....x..................#...............# +##xxxx......#........................................# +##xxxx...#####............."...""""".................E +######"""############################################# diff --git a/ruby/test/media/Space.png b/ruby/test/media/Space.png new file mode 100644 index 00000000..47e40741 Binary files /dev/null and b/ruby/test/media/Space.png differ diff --git a/ruby/test/media/Star.png b/ruby/test/media/Star.png new file mode 100644 index 00000000..7ecaf328 Binary files /dev/null and b/ruby/test/media/Star.png differ diff --git a/ruby/test/media/Starfighter.png b/ruby/test/media/Starfighter.png new file mode 100644 index 00000000..91d80454 Binary files /dev/null and b/ruby/test/media/Starfighter.png differ diff --git a/ruby/test/media/Tileset.png b/ruby/test/media/Tileset.png new file mode 100644 index 00000000..48ffd700 Binary files /dev/null and b/ruby/test/media/Tileset.png differ diff --git a/ruby/test/media/cannon.wav b/ruby/test/media/cannon.wav new file mode 100644 index 00000000..69ea2175 Binary files /dev/null and b/ruby/test/media/cannon.wav differ diff --git a/ruby/test/media/cursor.png b/ruby/test/media/cursor.png new file mode 100644 index 00000000..6c38da8e Binary files /dev/null and b/ruby/test/media/cursor.png differ diff --git a/ruby/test/test.bat b/ruby/test/test.bat new file mode 100644 index 00000000..a29a7bf2 --- /dev/null +++ b/ruby/test/test.bat @@ -0,0 +1 @@ +..\bin\ruby.exe test.rb diff --git a/ruby/test/test.rb b/ruby/test/test.rb new file mode 100644 index 00000000..d03c7c01 --- /dev/null +++ b/ruby/test/test.rb @@ -0,0 +1,99 @@ +require "RubySFML" +include SFML + +require "gl" +include Gl + +class TextTest < Text + # Test overriding a virtual C++ method + def render(win) + self.color = Color.new(color.r+1, color.g+2, color.b+3, 255) + super # Call base class's version of render (in C++) + + # Custom OpenGL calls + rect = getRect() + #win.beginOpenGL() + glColor4f(1, 1, 1, 1) + glLineWidth(5) + glBegin(GL_LINES) + glVertex2f(0, 0) + glVertex2f(rect.width, rect.height) + glVertex2f(rect.width, 0) + glVertex2f(0, rect.height) + glEnd() + #win.endOpenGL() + end +end + +# Test Clock class +clock = Clock.new +10.times { sleep 0.01; puts "Clock - #{clock}" } +puts + +# Test VideoMode class +puts "Current desktop mode - #{VideoMode::desktop}" +puts "32-bit video modes:" +VideoMode::each {|mode| puts mode.to_s if mode.bpp == 32 } +puts + +# Test RenderWindow class +mode = VideoMode.new(800, 600, 32) +win = RenderWindow.new(mode, "RubySFML Test") +win.useVerticalSync(false) +win.showMouseCursor(false) +win.setBackgroundColor(Color.Red) +puts "Window - #{win}" +puts "View Rect - #{win.view}" +puts + +# Test Color, Image, and Sprite classes +puts format("Red = 0x%X", Color.Red.toRGBA) +puts format("Green = 0x%X", Color.Green.toRGBA) +puts format("Blue = 0x%X", Color.Blue.toRGBA) +puts format("Black = 0x%X", Color.Black.toRGBA) +image = Image.new("media/cursor.png") +sprite = Sprite.new(image) +image.width.times {|x| puts "image[#{x},#{x}] = #{image[x,x]}" } +image.createMaskFromColor(Color.Black) # Set black to transparent +sprite.x = mode.w/2 - sprite.w/2 +sprite.y = mode.h/2 - sprite.h/2 +puts "Image - #{image}" +puts "Sprite - #{sprite}" +puts + +# Test Text (sfString) class +text = TextTest.new("This is a test!") + +# Test Sound and SoundBuffer classes +sb = SoundBuffer.new("media/cannon.wav") +sound = Sound.new(sb) +sound.volume = 100 +puts "SoundBuffer - #{sound.buffer}" +puts "Sound - #{sound}" + +# Simple game loop +done = false +while !done + while e = win.getEvent() + puts "Event - #{e.to_s}" # Dump events to stdout + + done = true if + e.type == Event::Closed or + (e.type == Event::KeyReleased and e.code == Key::Escape) + + sound.play if + (e.type == Event::KeyPressed and e.code == Key::Space) or + (e.type == Event::MouseButtonPressed and e.buttons == Mouse::Left) + + sprite.x, sprite.y = e.x-sprite.w/2, e.y-sprite.h/2 if + e.type == Event::MouseMoved + end + + text.left = 0 if (text.left += 1) >= 800 + text.top = 0 if (text.top += 1) >= 600 + win.draw(text) + win.draw(sprite) + + win.display() +end + diff --git a/ruby/test/tetris.rb b/ruby/test/tetris.rb new file mode 100644 index 00000000..abc0bab6 --- /dev/null +++ b/ruby/test/tetris.rb @@ -0,0 +1,196 @@ +require 'RubySFML' +include SFML + +# A simple class to handle a single puzzle piece +class Piece + # Each shape is made up of 4 blocks: + # * * * * ** ** ** + # * ** ** ** * * ** + # * * * * * * + # * + SHAPES = [ # Negative y is down + [[0, 0], [0, 1], [0, -1], [0, -2]], + [[0, 0], [0, 1], [1, 0], [0, -1]], + [[0, 0], [0, 1], [1, 0], [1, -1]], + [[1, 0], [1, 1], [0, 0], [0, -1]], + [[0, 0], [0, 1], [1, 1], [0, -1]], + [[1, 0], [1, 1], [0, 1], [1, -1]], + [[0, 0], [0, 1], [1, 1], [1, 0]], + ] + # Each shape has its own color + COLORS = [Color.Red, Color.Yellow, Color.Cyan, Color.Magenta, Color.Green, Color.Blue, Color.new(255, 128, 64)] + + attr_accessor :x, :y, :r + def initialize(n, x, y) + @n, @x, @y = n, x, y + @r = 0 + end + + def shape(); SHAPES[@n]; end + def color(); COLORS[@n]; end + def rleft(); @r = (@r+1) % 4; end + def rright(); @r = (@r-1) % 4; end + def each() # Iterate each block coordinate (corrected for rotation) + case @r + when 0 then shape.each {|c| yield([c[0], c[1]])} + when 1 then shape.each {|c| yield([-c[1], c[0]])} + when 2 then shape.each {|c| yield([-c[0], -c[1]])} + when 3 then shape.each {|c| yield([c[1], -c[0]])} + end + end +end + +class Grid + HEIGHT = 20 + WIDTH = 10 + BLOCK = 18 + BORDER = 1 + BSIZE = BLOCK + BORDER + + def initialize() + @rows = [] + HEIGHT.times { @rows.push Array.new(WIDTH) } + @background_image = Image.new(WIDTH*(BSIZE)+BORDER, HEIGHT*BSIZE+BORDER, Color.White) + @background = Sprite.new(@background_image, (640-WIDTH*BSIZE)/2-BORDER, (480-HEIGHT*BSIZE)/2-BORDER) + @block_image = Image.new(BLOCK, BLOCK, Color.White) + @block = Sprite.new(@block_image) + + @score = 0 + @last_down = $clock.to_f + @piece = Piece.new(rand(7), WIDTH/2-1, HEIGHT-1) + @next_piece = Piece.new(rand(7), WIDTH/2-1, HEIGHT-1) + end + + def [](y) + return @rows[y] + end + + def draw_block(win, x, y, color) + @block.left = x*BSIZE + @background.left+BORDER + @block.top = ((HEIGHT-1)-y)*BSIZE + @background.top+BORDER + @block.color = color + win.draw(@block) + end + + def solid?(x, y) + return true if x < 0 or y < 0 or x >= WIDTH or y >= HEIGHT + return @rows[y][x] + end + + def left + x = @piece.x + @piece.x -= 1 + @piece.each {|c| @piece.x = x if solid?(@piece.x+c[0], @piece.y+c[1])} + end + + def right + x = @piece.x + @piece.x += 1 + @piece.each {|c| @piece.x = x if solid?(@piece.x+c[0], @piece.y+c[1])} + end + + def up + r = @piece.r + @piece.rright + @piece.each {|c| @piece.r = r if solid?(@piece.x+c[0], @piece.y+c[1])} + end + + def down + @last_down = $clock.to_f + y = @piece.y + @piece.y -= 1 + done = false + @piece.each {|c| done = true if solid?(@piece.x+c[0], @piece.y+c[1])} + if done + @piece.y = y + @piece.each {|c| @rows[@piece.y+c[1]][@piece.x+c[0]] = @piece.color} + @piece = @next_piece + @next_piece = Piece.new(rand(7), WIDTH/2-1, HEIGHT-1) + end + end + + def update(win) + speed = 0.5 - 0.1 * (@score/1000) + down if $clock.to_f - @last_down >= speed + + collapsed = 0 + while y = find_full_row() + collapse_row(y) + collapsed += 1 + end + @score += 5 * 2**collapsed if collapsed > 0 + end + + def render(win) + win.draw(@background) + + HEIGHT.times {|y| + WIDTH.times {|x| + c = @rows[y][x] || Color.Black + draw_block(win, x, y, c) + } + } + + @piece.each {|c| + x, y, c = @piece.x+c[0], @piece.y+c[1], @piece.color + next if y < 0 or y > HEIGHT-1 + draw_block(win, x, y, c) + } + + score = Text.new("Score: #{@score}", "", 20) + #score.left, score.top = 10, 10 + win.draw(score) + + text = Text.new("Coming Next:", "", 20) + text.left, text.top = 450, 50 + win.draw(text) + @next_piece.each {|c| + x, y, c = 14+c[0], 16+c[1], @next_piece.color + next if y < 0 or y > HEIGHT-1 + draw_block(win, x, y, c) + } + end + + def collapse_row(i) + while i < HEIGHT-1 + @rows[i] = @rows[i+1] + i += 1 + end + @rows[HEIGHT-1] = Array.new(WIDTH, nil) + end + + def find_full_row() + HEIGHT.times {|y| return y unless @rows[y].index(nil) } + return nil + end +end + +$clock = Clock.new +mode = VideoMode.new(640, 480, 32) +win = RenderWindow.new(mode, "RubySFML Test", 0) +win.showMouseCursor(false) +win.useVerticalSync(true) +grid = Grid.new() + +# Simple game loop +done = false +while !done + while e = win.getEvent() + case e.type + when Event::Closed then done = true + when Event::KeyReleased then done = true if e.code == Key::Escape + when Event::KeyPressed + case e.code + when Key::Up then grid.up + when Key::Left then grid.left + when Key::Right then grid.right + when Key::Down then grid.down + end + end + end + grid.update(win) + grid.render(win) + win.display() + sleep(0.01) +end + diff --git a/ruby/unzip.exe b/ruby/unzip.exe new file mode 100644 index 00000000..510491f6 Binary files /dev/null and b/ruby/unzip.exe differ diff --git a/ruby/zip.exe b/ruby/zip.exe new file mode 100644 index 00000000..55be81da Binary files /dev/null and b/ruby/zip.exe differ diff --git a/ruby/zlib/zconf.h b/ruby/zlib/zconf.h new file mode 100644 index 00000000..e3b0c962 --- /dev/null +++ b/ruby/zlib/zconf.h @@ -0,0 +1,332 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/ruby/zlib/zlib.h b/ruby/zlib/zlib.h new file mode 100644 index 00000000..62d0e467 --- /dev/null +++ b/ruby/zlib/zlib.h @@ -0,0 +1,1357 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. 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 the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress 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. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + 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 the value returned by + compressBound(sourceLen). 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. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress 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, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/ruby/zlib/zlib.lib b/ruby/zlib/zlib.lib new file mode 100644 index 00000000..a70eb592 Binary files /dev/null and b/ruby/zlib/zlib.lib differ diff --git a/ruby/zlib/zlib1.dll b/ruby/zlib/zlib1.dll new file mode 100644 index 00000000..31996cd3 Binary files /dev/null and b/ruby/zlib/zlib1.dll differ diff --git a/ruby/zlib/zlibd.lib b/ruby/zlib/zlibd.lib new file mode 100644 index 00000000..49d4e2dd Binary files /dev/null and b/ruby/zlib/zlibd.lib differ diff --git a/samples/Makefile b/samples/Makefile new file mode 100644 index 00000000..7d8fb8e2 --- /dev/null +++ b/samples/Makefile @@ -0,0 +1,79 @@ +export DEBUGBUILD = no +ifeq ($(DEBUGBUILD), yes) + DEBUGFLAGS = -g -DDEBUG +else + DEBUGFLAGS = -O2 -DNDEBUG +endif + +export CC = g++ +export CFLAGS = -W -Wall -ansi -I../../include $(DEBUGFLAGS) +export LDFLAGS = +export EXECPATH = ../bin + +all: ftp-sample opengl-sample pong-sample post-fx-sample qt-sample sockets-sample sound-sample sound_capture-sample voip-sample window-sample wxwidgets-sample X11-sample + +ftp-sample: + @(cd ./ftp && $(MAKE)) + +opengl-sample: + @(cd ./opengl && $(MAKE)) + +pong-sample: + @(cd ./pong && $(MAKE)) + +post-fx-sample: + @(cd ./post-fx && $(MAKE)) + +qt-sample: + @(cd ./qt && $(MAKE)) + +sockets-sample: + @(cd ./sockets && $(MAKE)) + +sound-sample: + @(cd ./sound && $(MAKE)) + +sound_capture-sample: + @(cd ./sound_capture && $(MAKE)) + +voip-sample: + @(cd ./voip && $(MAKE)) + +window-sample: + @(cd ./window && $(MAKE)) + +wxwidgets-sample: + @(cd ./wxwidgets && $(MAKE)) + +X11-sample: + @(cd ./X11 && $(MAKE)) + +.PHONY: clean mrproper + +clean: + @(cd ./ftp && $(MAKE) $@ && \ + cd ../opengl && $(MAKE) $@ && \ + cd ../pong && $(MAKE) $@ && \ + cd ../post-fx && $(MAKE) $@ && \ + cd ../qt && $(MAKE) $@ && \ + cd ../sockets && $(MAKE) $@ && \ + cd ../sound && $(MAKE) $@ && \ + cd ../sound_capture && $(MAKE) $@ && \ + cd ../voip && $(MAKE) $@ && \ + cd ../window && $(MAKE) $@ && \ + cd ../wxwidgets && $(MAKE) $@ && \ + cd ../X11 && $(MAKE) $@) + +mrproper: clean + @(cd ./ftp && $(MAKE) $@ && \ + cd ../opengl && $(MAKE) $@ && \ + cd ../pong && $(MAKE) $@ && \ + cd ../post-fx && $(MAKE) $@ && \ + cd ../qt && $(MAKE) $@ && \ + cd ../sockets && $(MAKE) $@ && \ + cd ../sound && $(MAKE) $@ && \ + cd ../sound_capture && $(MAKE) $@ && \ + cd ../voip && $(MAKE) $@ && \ + cd ../window && $(MAKE) $@ && \ + cd ../wxwidgets && $(MAKE) $@ && \ + cd ../X11 && $(MAKE) $@) diff --git a/samples/X11/Makefile b/samples/X11/Makefile new file mode 100644 index 00000000..eca4cee4 --- /dev/null +++ b/samples/X11/Makefile @@ -0,0 +1,18 @@ +EXEC = X11 +OBJ = X11.o + +all: $(EXEC) + +X11: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-window -lsfml-system -lGLU -lGL -lX11 + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/X11/X11.cpp b/samples/X11/X11.cpp new file mode 100644 index 00000000..e8a53747 --- /dev/null +++ b/samples/X11/X11.cpp @@ -0,0 +1,212 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Initialize OpenGL states into the specified view +/// +/// \param Window : Target window to initialize +/// +//////////////////////////////////////////////////////////// +void Initialize(sf::Window& Window) +{ + // Activate the window + Window.SetActive(); + + // Setup OpenGL states + // Set color and depth clear value + glClearDepth(1.f); + glClearColor(0.f, 0.5f, 0.5f, 0.f); + + // Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + + // Setup a perspective projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90.f, 1.f, 1.f, 500.f); +} + +//////////////////////////////////////////////////////////// +/// Draw the OpenGL scene (a rotating cube) into +/// the specified view +/// +/// \param Window : Target window for rendering +/// \param ElapsedTime : Time elapsed since the last draw +/// +//////////////////////////////////////////////////////////// +void Draw(sf::Window& Window, float ElapsedTime) +{ + // Activate the window + Window.SetActive(); + + // Clear color and depth buffers + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // Apply some transformations + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.f, 0.f, -200.f); + glRotatef(ElapsedTime * 50, 1.f, 0.f, 0.f); + glRotatef(ElapsedTime * 30, 0.f, 1.f, 0.f); + glRotatef(ElapsedTime * 90, 0.f, 0.f, 1.f); + + // Draw a cube + glBegin(GL_QUADS); + + glColor3f(1.f, 1.f, 0.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, -50.f); + glVertex3f( 50.f, -50.f, -50.f); + + glColor3f(1.f, 1.f, 0.f); + glVertex3f(-50.f, -50.f, 50.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f( 50.f, 50.f, 50.f); + glVertex3f( 50.f, -50.f, 50.f); + + glColor3f(0.f, 1.f, 1.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f(-50.f, -50.f, 50.f); + + glColor3f(0.f, 1.f, 1.f); + glVertex3f(50.f, -50.f, -50.f); + glVertex3f(50.f, 50.f, -50.f); + glVertex3f(50.f, 50.f, 50.f); + glVertex3f(50.f, -50.f, 50.f); + + glColor3f(1.f, 0.f, 1.f); + glVertex3f(-50.f, -50.f, 50.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f( 50.f, -50.f, -50.f); + glVertex3f( 50.f, -50.f, 50.f); + + glColor3f(1.f, 0.f, 1.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, 50.f); + + glEnd(); +} + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Error code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Open a connection with the X server + Display* Disp = XOpenDisplay(NULL); + if (!Disp) + return EXIT_FAILURE; + + // Setup OpenGL states + // Set color and depth clear value + glClearDepth(1.f); + glClearColor(0.f, 0.5f, 0.5f, 0.f); + + // Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + + // Setup a perspective projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90.f, 1.f, 1.f, 500.f); + // Get the default screen + int Screen = DefaultScreen(Disp); + + // Let's create the main window + XSetWindowAttributes Attributes; + Attributes.background_pixel = BlackPixel(Disp, Screen); + Attributes.event_mask = KeyPressMask; + Window Win = XCreateWindow(Disp, RootWindow(Disp, Screen), + 0, 0, 650, 330, 0, + DefaultDepth(Disp, Screen), + InputOutput, + DefaultVisual(Disp, Screen), + CWBackPixel | CWEventMask, &Attributes); + if (!Win) + return EXIT_FAILURE; + + // Set the window's name + XStoreName(Disp, Win, "SFML Window"); + + // Let's create the windows which will serve as containers for our SFML views + Window View1 = XCreateWindow(Disp, Win, + 10, 10, 310, 310, 0, + DefaultDepth(Disp, Screen), + InputOutput, + DefaultVisual(Disp, Screen), + 0, NULL); + Window View2 = XCreateWindow(Disp, Win, + 330, 10, 310, 310, 0, + DefaultDepth(Disp, Screen), + InputOutput, + DefaultVisual(Disp, Screen), + 0, NULL); + + // Show our windows + XMapWindow(Disp, Win); + XFlush(Disp); + + // Create our SFML views + sf::Window SFMLView1(View1); + sf::Window SFMLView2(View2); + + // Create a clock for measuring elapsed time + sf::Clock Clock; + + // Initialize our views + Initialize(SFMLView1); + Initialize(SFMLView2); + + // Start the event loop + bool IsRunning = true; + while (IsRunning) + { + while (XPending(Disp)) + { + // Get the next pending event + XEvent Event; + XNextEvent(Disp, &Event); + + // Process it + switch (Event.type) + { + // Any key is pressed : quit + case KeyPress : + IsRunning = false; + break; + } + } + + // Draw something into our views + Draw(SFMLView1, Clock.GetElapsedTime()); + Draw(SFMLView2, Clock.GetElapsedTime() * 0.3f); + + // Display the views on screen + SFMLView1.Display(); + SFMLView2.Display(); + } + + // Close the display + XCloseDisplay(Disp); + + return EXIT_SUCCESS; +} diff --git a/samples/bin/datas/opengl/background.jpg b/samples/bin/datas/opengl/background.jpg new file mode 100644 index 00000000..5b2247d4 Binary files /dev/null and b/samples/bin/datas/opengl/background.jpg differ diff --git a/samples/bin/datas/opengl/texture.jpg b/samples/bin/datas/opengl/texture.jpg new file mode 100644 index 00000000..455a99fb Binary files /dev/null and b/samples/bin/datas/opengl/texture.jpg differ diff --git a/samples/bin/datas/pong/background.jpg b/samples/bin/datas/pong/background.jpg new file mode 100644 index 00000000..06dfdb8b Binary files /dev/null and b/samples/bin/datas/pong/background.jpg differ diff --git a/samples/bin/datas/pong/ball.png b/samples/bin/datas/pong/ball.png new file mode 100644 index 00000000..c296859b Binary files /dev/null and b/samples/bin/datas/pong/ball.png differ diff --git a/samples/bin/datas/pong/ball.wav b/samples/bin/datas/pong/ball.wav new file mode 100644 index 00000000..8b3cfbad Binary files /dev/null and b/samples/bin/datas/pong/ball.wav differ diff --git a/samples/bin/datas/pong/cheeseburger.ttf b/samples/bin/datas/pong/cheeseburger.ttf new file mode 100644 index 00000000..47704266 Binary files /dev/null and b/samples/bin/datas/pong/cheeseburger.ttf differ diff --git a/samples/bin/datas/pong/paddle_left.png b/samples/bin/datas/pong/paddle_left.png new file mode 100644 index 00000000..63592c9b Binary files /dev/null and b/samples/bin/datas/pong/paddle_left.png differ diff --git a/samples/bin/datas/pong/paddle_right.png b/samples/bin/datas/pong/paddle_right.png new file mode 100644 index 00000000..d408c5fd Binary files /dev/null and b/samples/bin/datas/pong/paddle_right.png differ diff --git a/samples/bin/datas/post-fx/background.jpg b/samples/bin/datas/post-fx/background.jpg new file mode 100644 index 00000000..c778e86b Binary files /dev/null and b/samples/bin/datas/post-fx/background.jpg differ diff --git a/samples/bin/datas/post-fx/blur.sfx b/samples/bin/datas/post-fx/blur.sfx new file mode 100644 index 00000000..04bfec53 --- /dev/null +++ b/samples/bin/datas/post-fx/blur.sfx @@ -0,0 +1,16 @@ +texture framebuffer +float offset + +effect +{ + vec2 offx = vec2(offset, 0.0); + vec2 offy = vec2(0.0, offset); + + vec4 c0 = framebuffer(_in); + vec4 c1 = framebuffer(_in - offy); + vec4 c2 = framebuffer(_in + offy); + vec4 c3 = framebuffer(_in - offx); + vec4 c4 = framebuffer(_in + offx); + + _out = c0 * 0.2 + c1 * 0.2 + c2 * 0.2 + c3 * 0.2 + c4 * 0.2; +} diff --git a/samples/bin/datas/post-fx/cheeseburger.ttf b/samples/bin/datas/post-fx/cheeseburger.ttf new file mode 100644 index 00000000..47704266 Binary files /dev/null and b/samples/bin/datas/post-fx/cheeseburger.ttf differ diff --git a/samples/bin/datas/post-fx/colorize.sfx b/samples/bin/datas/post-fx/colorize.sfx new file mode 100644 index 00000000..bcb48ebc --- /dev/null +++ b/samples/bin/datas/post-fx/colorize.sfx @@ -0,0 +1,10 @@ +texture framebuffer +vec3 color + +effect +{ + vec4 pixel = framebuffer(_in); + float gray = pixel.r * 0.39 + pixel.g * 0.50 + pixel.b * 0.11; + + _out = vec4(gray * color, 1.0) * 0.6 + pixel * 0.4; +} diff --git a/samples/bin/datas/post-fx/fisheye.sfx b/samples/bin/datas/post-fx/fisheye.sfx new file mode 100644 index 00000000..cbc31ee7 --- /dev/null +++ b/samples/bin/datas/post-fx/fisheye.sfx @@ -0,0 +1,12 @@ +texture framebuffer +vec2 mouse + +effect +{ + float len = distance(_in, mouse) * 7.0; + + if (len < 1.0) + _out = framebuffer(_in + (_in - mouse) * len); + else + _out = framebuffer(_in); +} diff --git a/samples/bin/datas/post-fx/nothing.sfx b/samples/bin/datas/post-fx/nothing.sfx new file mode 100644 index 00000000..133b4e31 --- /dev/null +++ b/samples/bin/datas/post-fx/nothing.sfx @@ -0,0 +1,6 @@ +texture framebuffer + +effect +{ + _out = framebuffer(_in); +} diff --git a/samples/bin/datas/post-fx/wave.jpg b/samples/bin/datas/post-fx/wave.jpg new file mode 100644 index 00000000..cd125b8c Binary files /dev/null and b/samples/bin/datas/post-fx/wave.jpg differ diff --git a/samples/bin/datas/post-fx/wave.sfx b/samples/bin/datas/post-fx/wave.sfx new file mode 100644 index 00000000..49b46071 --- /dev/null +++ b/samples/bin/datas/post-fx/wave.sfx @@ -0,0 +1,12 @@ +texture framebuffer +texture wave +vec2 offset + +effect +{ + vec2 texoffset = wave(_in * offset).xy; + texoffset -= vec2(0.5, 0.5); + texoffset *= 0.05; + + _out = framebuffer(_in + texoffset); +} diff --git a/samples/bin/datas/qt/sfml.png b/samples/bin/datas/qt/sfml.png new file mode 100644 index 00000000..77ca41ed Binary files /dev/null and b/samples/bin/datas/qt/sfml.png differ diff --git a/samples/bin/datas/sound/footsteps.wav b/samples/bin/datas/sound/footsteps.wav new file mode 100644 index 00000000..30ef4349 Binary files /dev/null and b/samples/bin/datas/sound/footsteps.wav differ diff --git a/samples/bin/datas/sound/lepidoptera.ogg b/samples/bin/datas/sound/lepidoptera.ogg new file mode 100644 index 00000000..282a3a0a Binary files /dev/null and b/samples/bin/datas/sound/lepidoptera.ogg differ diff --git a/samples/bin/datas/win32/image1.jpg b/samples/bin/datas/win32/image1.jpg new file mode 100644 index 00000000..50ecf043 Binary files /dev/null and b/samples/bin/datas/win32/image1.jpg differ diff --git a/samples/bin/datas/win32/image2.jpg b/samples/bin/datas/win32/image2.jpg new file mode 100644 index 00000000..73370289 Binary files /dev/null and b/samples/bin/datas/win32/image2.jpg differ diff --git a/samples/bin/datas/wxwidgets/sfml.png b/samples/bin/datas/wxwidgets/sfml.png new file mode 100644 index 00000000..77ca41ed Binary files /dev/null and b/samples/bin/datas/wxwidgets/sfml.png differ diff --git a/samples/bin/libsndfile-1.dll b/samples/bin/libsndfile-1.dll new file mode 100644 index 00000000..f112de2b Binary files /dev/null and b/samples/bin/libsndfile-1.dll differ diff --git a/samples/bin/openal32.dll b/samples/bin/openal32.dll new file mode 100644 index 00000000..28eb8e5b Binary files /dev/null and b/samples/bin/openal32.dll differ diff --git a/samples/build/codeblocks/ftp.cbp b/samples/build/codeblocks/ftp.cbp new file mode 100644 index 00000000..05ef7b23 --- /dev/null +++ b/samples/build/codeblocks/ftp.cbp @@ -0,0 +1,59 @@ + + + + + + diff --git a/samples/build/codeblocks/opengl.cbp b/samples/build/codeblocks/opengl.cbp new file mode 100644 index 00000000..46ab5496 --- /dev/null +++ b/samples/build/codeblocks/opengl.cbp @@ -0,0 +1,69 @@ + + + + + + diff --git a/samples/build/codeblocks/pong.cbp b/samples/build/codeblocks/pong.cbp new file mode 100644 index 00000000..a527d6f1 --- /dev/null +++ b/samples/build/codeblocks/pong.cbp @@ -0,0 +1,71 @@ + + + + + + diff --git a/samples/build/codeblocks/postfx.cbp b/samples/build/codeblocks/postfx.cbp new file mode 100644 index 00000000..79ade579 --- /dev/null +++ b/samples/build/codeblocks/postfx.cbp @@ -0,0 +1,65 @@ + + + + + + diff --git a/samples/build/codeblocks/qt.cbp b/samples/build/codeblocks/qt.cbp new file mode 100644 index 00000000..dd34d5af --- /dev/null +++ b/samples/build/codeblocks/qt.cbp @@ -0,0 +1,94 @@ + + + + + + diff --git a/samples/build/codeblocks/sockets.cbp b/samples/build/codeblocks/sockets.cbp new file mode 100644 index 00000000..7132272a --- /dev/null +++ b/samples/build/codeblocks/sockets.cbp @@ -0,0 +1,61 @@ + + + + + + diff --git a/samples/build/codeblocks/sound-capture.cbp b/samples/build/codeblocks/sound-capture.cbp new file mode 100644 index 00000000..f90f1c11 --- /dev/null +++ b/samples/build/codeblocks/sound-capture.cbp @@ -0,0 +1,61 @@ + + + + + + diff --git a/samples/build/codeblocks/sound.cbp b/samples/build/codeblocks/sound.cbp new file mode 100644 index 00000000..6348d5ed --- /dev/null +++ b/samples/build/codeblocks/sound.cbp @@ -0,0 +1,61 @@ + + + + + + diff --git a/samples/build/codeblocks/voip.cbp b/samples/build/codeblocks/voip.cbp new file mode 100644 index 00000000..49a477b6 --- /dev/null +++ b/samples/build/codeblocks/voip.cbp @@ -0,0 +1,65 @@ + + + + + + diff --git a/samples/build/codeblocks/win32.cbp b/samples/build/codeblocks/win32.cbp new file mode 100644 index 00000000..df754293 --- /dev/null +++ b/samples/build/codeblocks/win32.cbp @@ -0,0 +1,63 @@ + + + + + + diff --git a/samples/build/codeblocks/window.cbp b/samples/build/codeblocks/window.cbp new file mode 100644 index 00000000..507389db --- /dev/null +++ b/samples/build/codeblocks/window.cbp @@ -0,0 +1,65 @@ + + + + + + diff --git a/samples/build/codeblocks/wxwidgets.cbp b/samples/build/codeblocks/wxwidgets.cbp new file mode 100644 index 00000000..ac561298 --- /dev/null +++ b/samples/build/codeblocks/wxwidgets.cbp @@ -0,0 +1,89 @@ + + + + + + diff --git a/samples/build/vc2005/ftp.vcproj b/samples/build/vc2005/ftp.vcproj new file mode 100644 index 00000000..d357cec8 --- /dev/null +++ b/samples/build/vc2005/ftp.vcproj @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/opengl.vcproj b/samples/build/vc2005/opengl.vcproj new file mode 100644 index 00000000..b9660a7f --- /dev/null +++ b/samples/build/vc2005/opengl.vcproj @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/pong.vcproj b/samples/build/vc2005/pong.vcproj new file mode 100644 index 00000000..7ee2d4cb --- /dev/null +++ b/samples/build/vc2005/pong.vcproj @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/postfx.vcproj b/samples/build/vc2005/postfx.vcproj new file mode 100644 index 00000000..d6c0ce16 --- /dev/null +++ b/samples/build/vc2005/postfx.vcproj @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/qt.vcproj b/samples/build/vc2005/qt.vcproj new file mode 100644 index 00000000..d2b39eb8 --- /dev/null +++ b/samples/build/vc2005/qt.vcproj @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/sockets.vcproj b/samples/build/vc2005/sockets.vcproj new file mode 100644 index 00000000..9d679c06 --- /dev/null +++ b/samples/build/vc2005/sockets.vcproj @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/sound-capture.vcproj b/samples/build/vc2005/sound-capture.vcproj new file mode 100644 index 00000000..78fecfe4 --- /dev/null +++ b/samples/build/vc2005/sound-capture.vcproj @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/sound.vcproj b/samples/build/vc2005/sound.vcproj new file mode 100644 index 00000000..4aedda3e --- /dev/null +++ b/samples/build/vc2005/sound.vcproj @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/voip.vcproj b/samples/build/vc2005/voip.vcproj new file mode 100644 index 00000000..4bace6a0 --- /dev/null +++ b/samples/build/vc2005/voip.vcproj @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/win32.vcproj b/samples/build/vc2005/win32.vcproj new file mode 100644 index 00000000..96bf3678 --- /dev/null +++ b/samples/build/vc2005/win32.vcproj @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/window.vcproj b/samples/build/vc2005/window.vcproj new file mode 100644 index 00000000..6cb9658f --- /dev/null +++ b/samples/build/vc2005/window.vcproj @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/vc2005/wxwidgets.vcproj b/samples/build/vc2005/wxwidgets.vcproj new file mode 100644 index 00000000..91d08f3a --- /dev/null +++ b/samples/build/vc2005/wxwidgets.vcproj @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/build/xcode/opengl-Info.plist b/samples/build/xcode/opengl-Info.plist new file mode 100644 index 00000000..2da151bb --- /dev/null +++ b/samples/build/xcode/opengl-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/samples/build/xcode/pong-Info.plist b/samples/build/xcode/pong-Info.plist new file mode 100644 index 00000000..2da151bb --- /dev/null +++ b/samples/build/xcode/pong-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/samples/build/xcode/post-fx-Info.plist b/samples/build/xcode/post-fx-Info.plist new file mode 100644 index 00000000..2da151bb --- /dev/null +++ b/samples/build/xcode/post-fx-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/samples/build/xcode/samples.xcodeproj/project.pbxproj b/samples/build/xcode/samples.xcodeproj/project.pbxproj new file mode 100644 index 00000000..3446cd79 --- /dev/null +++ b/samples/build/xcode/samples.xcodeproj/project.pbxproj @@ -0,0 +1,1384 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXAggregateTarget section */ + A07D7E600EE82D33006712A3 /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = A07D7E720EE82D5E006712A3 /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + ); + dependencies = ( + A07D7E640EE82D47006712A3 /* PBXTargetDependency */, + A07D7E660EE82D47006712A3 /* PBXTargetDependency */, + A07D7E680EE82D47006712A3 /* PBXTargetDependency */, + A07D7F190EE832C2006712A3 /* PBXTargetDependency */, + A07D7F1B0EE832C2006712A3 /* PBXTargetDependency */, + A07D7F1D0EE832C2006712A3 /* PBXTargetDependency */, + A07D7F1F0EE832C2006712A3 /* PBXTargetDependency */, + A07D7F210EE832C2006712A3 /* PBXTargetDependency */, + A07D7F230EE832C2006712A3 /* PBXTargetDependency */, + ); + name = All; + productName = All; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + A07D7E330EE82C0A006712A3 /* Ftp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DDA0EE82B93006712A3 /* Ftp.cpp */; }; + A07D7E340EE82C0F006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7E350EE82C0F006712A3 /* sfml-network.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6B0EE82B6F006712A3 /* sfml-network.framework */; }; + A07D7E420EE82C35006712A3 /* OpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DDF0EE82B93006712A3 /* OpenGL.cpp */; }; + A07D7E430EE82C3B006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7E440EE82C3C006712A3 /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6E0EE82B6F006712A3 /* sfml-window.framework */; }; + A07D7E450EE82C55006712A3 /* sfml-graphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6C0EE82B6F006712A3 /* sfml-graphics.framework */; }; + A07D7E500EE82C78006712A3 /* Pong.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DE20EE82B93006712A3 /* Pong.cpp */; }; + A07D7E510EE82C84006712A3 /* sfml-audio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6A0EE82B6F006712A3 /* sfml-audio.framework */; }; + A07D7E520EE82C85006712A3 /* sfml-graphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6C0EE82B6F006712A3 /* sfml-graphics.framework */; }; + A07D7E530EE82C86006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7E540EE82C87006712A3 /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6E0EE82B6F006712A3 /* sfml-window.framework */; }; + A07D7E5A0EE82CB0006712A3 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7E590EE82CB0006712A3 /* OpenGL.framework */; }; + A07D7E740EE82D6B006712A3 /* PostFX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DE50EE82B93006712A3 /* PostFX.cpp */; }; + A07D7E750EE82D71006712A3 /* sfml-graphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6C0EE82B6F006712A3 /* sfml-graphics.framework */; }; + A07D7E760EE82D74006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7E770EE82D75006712A3 /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6E0EE82B6F006712A3 /* sfml-window.framework */; }; + A07D7E9F0EE82F2A006712A3 /* Sockets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DED0EE82B93006712A3 /* Sockets.cpp */; }; + A07D7EA00EE82F2A006712A3 /* TCP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DEE0EE82B93006712A3 /* TCP.cpp */; }; + A07D7EA10EE82F2B006712A3 /* UDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DEF0EE82B93006712A3 /* UDP.cpp */; }; + A07D7EA20EE82F2F006712A3 /* sfml-network.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6B0EE82B6F006712A3 /* sfml-network.framework */; }; + A07D7EAF0EE82F80006712A3 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DF30EE82B93006712A3 /* Sound.cpp */; }; + A07D7EB00EE82F86006712A3 /* sfml-audio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6A0EE82B6F006712A3 /* sfml-audio.framework */; }; + A07D7EB20EE82F8D006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7EC30EE83035006712A3 /* SoundCapture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DF70EE82B93006712A3 /* SoundCapture.cpp */; }; + A07D7EC40EE8303D006712A3 /* sfml-audio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6A0EE82B6F006712A3 /* sfml-audio.framework */; }; + A07D7EC60EE83044006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7ED40EE830DB006712A3 /* Client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DF90EE82B93006712A3 /* Client.cpp */; }; + A07D7ED50EE830DB006712A3 /* Server.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DFB0EE82B93006712A3 /* Server.cpp */; }; + A07D7ED60EE830DC006712A3 /* VoIP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7DFC0EE82B93006712A3 /* VoIP.cpp */; }; + A07D7ED80EE830E7006712A3 /* sfml-audio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6A0EE82B6F006712A3 /* sfml-audio.framework */; }; + A07D7ED90EE830EA006712A3 /* sfml-network.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6B0EE82B6F006712A3 /* sfml-network.framework */; }; + A07D7EDB0EE830F3006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; + A07D7EEA0EE83171006712A3 /* Window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D7E010EE82B93006712A3 /* Window.cpp */; }; + A07D7EEB0EE83174006712A3 /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6E0EE82B6F006712A3 /* sfml-window.framework */; }; + A07D7EED0EE8317B006712A3 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7E590EE82CB0006712A3 /* OpenGL.framework */; }; + A07D7EEF0EE83181006712A3 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + A07D7E630EE82D47006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7E2E0EE82C04006712A3; + remoteInfo = ftp; + }; + A07D7E650EE82D47006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7E390EE82C1A006712A3; + remoteInfo = opengl; + }; + A07D7E670EE82D47006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7E490EE82C68006712A3; + remoteInfo = pong; + }; + A07D7F180EE832C2006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7E6C0EE82D5D006712A3; + remoteInfo = "post-fx"; + }; + A07D7F1A0EE832C2006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7E9A0EE82F0A006712A3; + remoteInfo = sockets; + }; + A07D7F1C0EE832C2006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7EAA0EE82F74006712A3; + remoteInfo = sound; + }; + A07D7F1E0EE832C2006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7EBE0EE8302C006712A3; + remoteInfo = sound_capture; + }; + A07D7F200EE832C2006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7ECF0EE830D3006712A3; + remoteInfo = voip; + }; + A07D7F220EE832C2006712A3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A07D7D530EE82B1A006712A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A07D7EE30EE83167006712A3; + remoteInfo = window; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + A07D7D6A0EE82B6F006712A3 /* sfml-audio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-audio.framework"; path = "/Library/Frameworks/sfml-audio.framework"; sourceTree = ""; }; + A07D7D6B0EE82B6F006712A3 /* sfml-network.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-network.framework"; path = "/Library/Frameworks/sfml-network.framework"; sourceTree = ""; }; + A07D7D6C0EE82B6F006712A3 /* sfml-graphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-graphics.framework"; path = "/Library/Frameworks/sfml-graphics.framework"; sourceTree = ""; }; + A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-system.framework"; path = "/Library/Frameworks/sfml-system.framework"; sourceTree = ""; }; + A07D7D6E0EE82B6F006712A3 /* sfml-window.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "sfml-window.framework"; path = "/Library/Frameworks/sfml-window.framework"; sourceTree = ""; }; + A07D7D6F0EE82B6F006712A3 /* SFML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SFML.framework; path = /Library/Frameworks/SFML.framework; sourceTree = ""; }; + A07D7DDA0EE82B93006712A3 /* Ftp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ftp.cpp; sourceTree = ""; }; + A07D7DDF0EE82B93006712A3 /* OpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = OpenGL.cpp; sourceTree = ""; }; + A07D7DE20EE82B93006712A3 /* Pong.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Pong.cpp; sourceTree = ""; }; + A07D7DE50EE82B93006712A3 /* PostFX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PostFX.cpp; sourceTree = ""; }; + A07D7DED0EE82B93006712A3 /* Sockets.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Sockets.cpp; sourceTree = ""; }; + A07D7DEE0EE82B93006712A3 /* TCP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TCP.cpp; sourceTree = ""; }; + A07D7DEF0EE82B93006712A3 /* UDP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = UDP.cpp; sourceTree = ""; }; + A07D7DF30EE82B93006712A3 /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = ""; }; + A07D7DF70EE82B93006712A3 /* SoundCapture.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SoundCapture.cpp; sourceTree = ""; }; + A07D7DF90EE82B93006712A3 /* Client.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Client.cpp; sourceTree = ""; }; + A07D7DFB0EE82B93006712A3 /* Server.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Server.cpp; sourceTree = ""; }; + A07D7DFC0EE82B93006712A3 /* VoIP.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = VoIP.cpp; sourceTree = ""; }; + A07D7E010EE82B93006712A3 /* Window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Window.cpp; sourceTree = ""; }; + A07D7E2F0EE82C04006712A3 /* ftp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ftp; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7E3A0EE82C1A006712A3 /* opengl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = opengl.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7E3C0EE82C1A006712A3 /* opengl-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "opengl-Info.plist"; sourceTree = ""; }; + A07D7E4A0EE82C68006712A3 /* pong.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = pong.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7E4C0EE82C68006712A3 /* pong-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "pong-Info.plist"; sourceTree = ""; }; + A07D7E590EE82CB0006712A3 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + A07D7E6D0EE82D5D006712A3 /* post-fx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "post-fx.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7E6F0EE82D5D006712A3 /* post-fx-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "post-fx-Info.plist"; sourceTree = ""; }; + A07D7E9B0EE82F0A006712A3 /* sockets */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sockets; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7EAB0EE82F74006712A3 /* sound */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sound; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7EBF0EE8302C006712A3 /* sound_capture */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sound_capture; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7ED00EE830D3006712A3 /* voip */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = voip; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7EE40EE83167006712A3 /* window.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = window.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A07D7EE60EE83167006712A3 /* window-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "window-Info.plist"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A07D7E2D0EE82C04006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E340EE82C0F006712A3 /* sfml-system.framework in Frameworks */, + A07D7E350EE82C0F006712A3 /* sfml-network.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E380EE82C1A006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E430EE82C3B006712A3 /* sfml-system.framework in Frameworks */, + A07D7E440EE82C3C006712A3 /* sfml-window.framework in Frameworks */, + A07D7E450EE82C55006712A3 /* sfml-graphics.framework in Frameworks */, + A07D7E5A0EE82CB0006712A3 /* OpenGL.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E480EE82C68006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E510EE82C84006712A3 /* sfml-audio.framework in Frameworks */, + A07D7E520EE82C85006712A3 /* sfml-graphics.framework in Frameworks */, + A07D7E530EE82C86006712A3 /* sfml-system.framework in Frameworks */, + A07D7E540EE82C87006712A3 /* sfml-window.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E6B0EE82D5D006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E750EE82D71006712A3 /* sfml-graphics.framework in Frameworks */, + A07D7E760EE82D74006712A3 /* sfml-system.framework in Frameworks */, + A07D7E770EE82D75006712A3 /* sfml-window.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E990EE82F0A006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EA20EE82F2F006712A3 /* sfml-network.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EA90EE82F74006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EB00EE82F86006712A3 /* sfml-audio.framework in Frameworks */, + A07D7EB20EE82F8D006712A3 /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EBD0EE8302C006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EC40EE8303D006712A3 /* sfml-audio.framework in Frameworks */, + A07D7EC60EE83044006712A3 /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7ECE0EE830D3006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7ED80EE830E7006712A3 /* sfml-audio.framework in Frameworks */, + A07D7ED90EE830EA006712A3 /* sfml-network.framework in Frameworks */, + A07D7EDB0EE830F3006712A3 /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EE20EE83167006712A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EEB0EE83174006712A3 /* sfml-window.framework in Frameworks */, + A07D7EED0EE8317B006712A3 /* OpenGL.framework in Frameworks */, + A07D7EEF0EE83181006712A3 /* sfml-system.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A07D7D510EE82B1A006712A3 = { + isa = PBXGroup; + children = ( + A07D7D650EE82B3F006712A3 /* Sources */, + A07D7F170EE832AD006712A3 /* Resources */, + A07D7D660EE82B42006712A3 /* Frameworks */, + A07D7D600EE82B34006712A3 /* Products */, + ); + sourceTree = ""; + }; + A07D7D600EE82B34006712A3 /* Products */ = { + isa = PBXGroup; + children = ( + A07D7E2F0EE82C04006712A3 /* ftp */, + A07D7E3A0EE82C1A006712A3 /* opengl.app */, + A07D7E4A0EE82C68006712A3 /* pong.app */, + A07D7E6D0EE82D5D006712A3 /* post-fx.app */, + A07D7E9B0EE82F0A006712A3 /* sockets */, + A07D7EAB0EE82F74006712A3 /* sound */, + A07D7EBF0EE8302C006712A3 /* sound_capture */, + A07D7ED00EE830D3006712A3 /* voip */, + A07D7EE40EE83167006712A3 /* window.app */, + ); + name = Products; + sourceTree = ""; + }; + A07D7D650EE82B3F006712A3 /* Sources */ = { + isa = PBXGroup; + children = ( + A07D7DD90EE82B93006712A3 /* ftp */, + A07D7DDD0EE82B93006712A3 /* opengl */, + A07D7DE00EE82B93006712A3 /* pong */, + A07D7DE30EE82B93006712A3 /* post-fx */, + A07D7DEB0EE82B93006712A3 /* sockets */, + A07D7DF00EE82B93006712A3 /* sound */, + A07D7DF50EE82B93006712A3 /* sound_capture */, + A07D7DF80EE82B93006712A3 /* voip */, + A07D7DFF0EE82B93006712A3 /* window */, + ); + name = Sources; + sourceTree = ""; + }; + A07D7D660EE82B42006712A3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + A07D7E590EE82CB0006712A3 /* OpenGL.framework */, + A07D7D6A0EE82B6F006712A3 /* sfml-audio.framework */, + A07D7D6B0EE82B6F006712A3 /* sfml-network.framework */, + A07D7D6C0EE82B6F006712A3 /* sfml-graphics.framework */, + A07D7D6D0EE82B6F006712A3 /* sfml-system.framework */, + A07D7D6E0EE82B6F006712A3 /* sfml-window.framework */, + A07D7D6F0EE82B6F006712A3 /* SFML.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A07D7DD90EE82B93006712A3 /* ftp */ = { + isa = PBXGroup; + children = ( + A07D7DDA0EE82B93006712A3 /* Ftp.cpp */, + ); + name = ftp; + path = ../../ftp; + sourceTree = SOURCE_ROOT; + }; + A07D7DDD0EE82B93006712A3 /* opengl */ = { + isa = PBXGroup; + children = ( + A07D7DDF0EE82B93006712A3 /* OpenGL.cpp */, + ); + name = opengl; + path = ../../opengl; + sourceTree = SOURCE_ROOT; + }; + A07D7DE00EE82B93006712A3 /* pong */ = { + isa = PBXGroup; + children = ( + A07D7DE20EE82B93006712A3 /* Pong.cpp */, + ); + name = pong; + path = ../../pong; + sourceTree = SOURCE_ROOT; + }; + A07D7DE30EE82B93006712A3 /* post-fx */ = { + isa = PBXGroup; + children = ( + A07D7DE50EE82B93006712A3 /* PostFX.cpp */, + ); + name = "post-fx"; + path = "../../post-fx"; + sourceTree = SOURCE_ROOT; + }; + A07D7DEB0EE82B93006712A3 /* sockets */ = { + isa = PBXGroup; + children = ( + A07D7DED0EE82B93006712A3 /* Sockets.cpp */, + A07D7DEE0EE82B93006712A3 /* TCP.cpp */, + A07D7DEF0EE82B93006712A3 /* UDP.cpp */, + ); + name = sockets; + path = ../../sockets; + sourceTree = SOURCE_ROOT; + }; + A07D7DF00EE82B93006712A3 /* sound */ = { + isa = PBXGroup; + children = ( + A07D7DF30EE82B93006712A3 /* Sound.cpp */, + ); + name = sound; + path = ../../sound; + sourceTree = SOURCE_ROOT; + }; + A07D7DF50EE82B93006712A3 /* sound_capture */ = { + isa = PBXGroup; + children = ( + A07D7DF70EE82B93006712A3 /* SoundCapture.cpp */, + ); + name = sound_capture; + path = ../../sound_capture; + sourceTree = SOURCE_ROOT; + }; + A07D7DF80EE82B93006712A3 /* voip */ = { + isa = PBXGroup; + children = ( + A07D7DF90EE82B93006712A3 /* Client.cpp */, + A07D7DFB0EE82B93006712A3 /* Server.cpp */, + A07D7DFC0EE82B93006712A3 /* VoIP.cpp */, + ); + name = voip; + path = ../../voip; + sourceTree = SOURCE_ROOT; + }; + A07D7DFF0EE82B93006712A3 /* window */ = { + isa = PBXGroup; + children = ( + A07D7E010EE82B93006712A3 /* Window.cpp */, + ); + name = window; + path = ../../window; + sourceTree = SOURCE_ROOT; + }; + A07D7F170EE832AD006712A3 /* Resources */ = { + isa = PBXGroup; + children = ( + A07D7E3C0EE82C1A006712A3 /* opengl-Info.plist */, + A07D7E4C0EE82C68006712A3 /* pong-Info.plist */, + A07D7E6F0EE82D5D006712A3 /* post-fx-Info.plist */, + A07D7EE60EE83167006712A3 /* window-Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A07D7E2E0EE82C04006712A3 /* ftp */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7E3F0EE82C1B006712A3 /* Build configuration list for PBXNativeTarget "ftp" */; + buildPhases = ( + A07D7E2C0EE82C04006712A3 /* Sources */, + A07D7E2D0EE82C04006712A3 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ftp; + productName = ftp; + productReference = A07D7E2F0EE82C04006712A3 /* ftp */; + productType = "com.apple.product-type.tool"; + }; + A07D7E390EE82C1A006712A3 /* opengl */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7E400EE82C1B006712A3 /* Build configuration list for PBXNativeTarget "opengl" */; + buildPhases = ( + A07D7E360EE82C1A006712A3 /* Resources */, + A07D7E370EE82C1A006712A3 /* Sources */, + A07D7E380EE82C1A006712A3 /* Frameworks */, + A02EB4000F1B966900D33111 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = opengl; + productName = opengl; + productReference = A07D7E3A0EE82C1A006712A3 /* opengl.app */; + productType = "com.apple.product-type.application"; + }; + A07D7E490EE82C68006712A3 /* pong */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7E4F0EE82C68006712A3 /* Build configuration list for PBXNativeTarget "pong" */; + buildPhases = ( + A07D7E460EE82C68006712A3 /* Resources */, + A07D7E470EE82C68006712A3 /* Sources */, + A07D7E480EE82C68006712A3 /* Frameworks */, + A02EB40E0F1B977500D33111 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = pong; + productName = pong; + productReference = A07D7E4A0EE82C68006712A3 /* pong.app */; + productType = "com.apple.product-type.application"; + }; + A07D7E6C0EE82D5D006712A3 /* post-fx */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7E730EE82D5E006712A3 /* Build configuration list for PBXNativeTarget "post-fx" */; + buildPhases = ( + A07D7E690EE82D5D006712A3 /* Resources */, + A07D7E6A0EE82D5D006712A3 /* Sources */, + A07D7E6B0EE82D5D006712A3 /* Frameworks */, + A02EB4100F1B978000D33111 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "post-fx"; + productName = "post-fx"; + productReference = A07D7E6D0EE82D5D006712A3 /* post-fx.app */; + productType = "com.apple.product-type.application"; + }; + A07D7E9A0EE82F0A006712A3 /* sockets */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7EA70EE82F60006712A3 /* Build configuration list for PBXNativeTarget "sockets" */; + buildPhases = ( + A07D7E980EE82F0A006712A3 /* Sources */, + A07D7E990EE82F0A006712A3 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = sockets; + productName = sockets; + productReference = A07D7E9B0EE82F0A006712A3 /* sockets */; + productType = "com.apple.product-type.tool"; + }; + A07D7EAA0EE82F74006712A3 /* sound */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7EBA0EE82F91006712A3 /* Build configuration list for PBXNativeTarget "sound" */; + buildPhases = ( + A07D7EA80EE82F74006712A3 /* Sources */, + A07D7EA90EE82F74006712A3 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = sound; + productName = sound; + productReference = A07D7EAB0EE82F74006712A3 /* sound */; + productType = "com.apple.product-type.tool"; + }; + A07D7EBE0EE8302C006712A3 /* sound_capture */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7EC90EE83062006712A3 /* Build configuration list for PBXNativeTarget "sound_capture" */; + buildPhases = ( + A07D7EBC0EE8302C006712A3 /* Sources */, + A07D7EBD0EE8302C006712A3 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = sound_capture; + productName = sound_capture; + productReference = A07D7EBF0EE8302C006712A3 /* sound_capture */; + productType = "com.apple.product-type.tool"; + }; + A07D7ECF0EE830D3006712A3 /* voip */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7EDF0EE830F9006712A3 /* Build configuration list for PBXNativeTarget "voip" */; + buildPhases = ( + A07D7ECD0EE830D3006712A3 /* Sources */, + A07D7ECE0EE830D3006712A3 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = voip; + productName = voip; + productReference = A07D7ED00EE830D3006712A3 /* voip */; + productType = "com.apple.product-type.tool"; + }; + A07D7EE30EE83167006712A3 /* window */ = { + isa = PBXNativeTarget; + buildConfigurationList = A07D7EE90EE83168006712A3 /* Build configuration list for PBXNativeTarget "window" */; + buildPhases = ( + A07D7EE00EE83167006712A3 /* Resources */, + A07D7EE10EE83167006712A3 /* Sources */, + A07D7EE20EE83167006712A3 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = window; + productName = window; + productReference = A07D7EE40EE83167006712A3 /* window.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A07D7D530EE82B1A006712A3 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = A07D7D560EE82B1A006712A3 /* Build configuration list for PBXProject "samples" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 0; + mainGroup = A07D7D510EE82B1A006712A3; + productRefGroup = A07D7D600EE82B34006712A3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A07D7E600EE82D33006712A3 /* All */, + A07D7E2E0EE82C04006712A3 /* ftp */, + A07D7E390EE82C1A006712A3 /* opengl */, + A07D7E490EE82C68006712A3 /* pong */, + A07D7E6C0EE82D5D006712A3 /* post-fx */, + A07D7E9A0EE82F0A006712A3 /* sockets */, + A07D7EAA0EE82F74006712A3 /* sound */, + A07D7EBE0EE8302C006712A3 /* sound_capture */, + A07D7ECF0EE830D3006712A3 /* voip */, + A07D7EE30EE83167006712A3 /* window */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A07D7E360EE82C1A006712A3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E460EE82C68006712A3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E690EE82D5D006712A3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EE00EE83167006712A3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + A02EB4000F1B966900D33111 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd $BUILD_DIR\nmkdir -p $CONTENTS_FOLDER_PATH/Resources\ncd $CONTENTS_FOLDER_PATH/Resources\n\nif ! test -e datas\n then\n ln -s ../../../datas datas\nfi"; + }; + A02EB40E0F1B977500D33111 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd $BUILD_DIR\nmkdir -p $CONTENTS_FOLDER_PATH/Resources\ncd $CONTENTS_FOLDER_PATH/Resources\n\nif ! test -e datas\n then\n ln -s ../../../datas datas\nfi"; + }; + A02EB4100F1B978000D33111 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd $BUILD_DIR\nmkdir -p $CONTENTS_FOLDER_PATH/Resources\ncd $CONTENTS_FOLDER_PATH/Resources\n\nif ! test -e datas\n then\n ln -s ../../../datas datas\nfi"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A07D7E2C0EE82C04006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E330EE82C0A006712A3 /* Ftp.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E370EE82C1A006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E420EE82C35006712A3 /* OpenGL.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E470EE82C68006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E500EE82C78006712A3 /* Pong.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E6A0EE82D5D006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E740EE82D6B006712A3 /* PostFX.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7E980EE82F0A006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7E9F0EE82F2A006712A3 /* Sockets.cpp in Sources */, + A07D7EA00EE82F2A006712A3 /* TCP.cpp in Sources */, + A07D7EA10EE82F2B006712A3 /* UDP.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EA80EE82F74006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EAF0EE82F80006712A3 /* Sound.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EBC0EE8302C006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EC30EE83035006712A3 /* SoundCapture.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7ECD0EE830D3006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7ED40EE830DB006712A3 /* Client.cpp in Sources */, + A07D7ED50EE830DB006712A3 /* Server.cpp in Sources */, + A07D7ED60EE830DC006712A3 /* VoIP.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A07D7EE10EE83167006712A3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A07D7EEA0EE83171006712A3 /* Window.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A07D7E640EE82D47006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7E2E0EE82C04006712A3 /* ftp */; + targetProxy = A07D7E630EE82D47006712A3 /* PBXContainerItemProxy */; + }; + A07D7E660EE82D47006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7E390EE82C1A006712A3 /* opengl */; + targetProxy = A07D7E650EE82D47006712A3 /* PBXContainerItemProxy */; + }; + A07D7E680EE82D47006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7E490EE82C68006712A3 /* pong */; + targetProxy = A07D7E670EE82D47006712A3 /* PBXContainerItemProxy */; + }; + A07D7F190EE832C2006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7E6C0EE82D5D006712A3 /* post-fx */; + targetProxy = A07D7F180EE832C2006712A3 /* PBXContainerItemProxy */; + }; + A07D7F1B0EE832C2006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7E9A0EE82F0A006712A3 /* sockets */; + targetProxy = A07D7F1A0EE832C2006712A3 /* PBXContainerItemProxy */; + }; + A07D7F1D0EE832C2006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7EAA0EE82F74006712A3 /* sound */; + targetProxy = A07D7F1C0EE832C2006712A3 /* PBXContainerItemProxy */; + }; + A07D7F1F0EE832C2006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7EBE0EE8302C006712A3 /* sound_capture */; + targetProxy = A07D7F1E0EE832C2006712A3 /* PBXContainerItemProxy */; + }; + A07D7F210EE832C2006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7ECF0EE830D3006712A3 /* voip */; + targetProxy = A07D7F200EE832C2006712A3 /* PBXContainerItemProxy */; + }; + A07D7F230EE832C2006712A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A07D7EE30EE83167006712A3 /* window */; + targetProxy = A07D7F220EE832C2006712A3 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + A07D7D540EE82B1A006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = NO; + OBJROOT = build; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SYMROOT = ../../bin; + }; + name = Debug; + }; + A07D7D550EE82B1A006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = YES; + OBJROOT = build; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + SYMROOT = ../../bin; + }; + name = Release; + }; + A07D7E310EE82C05006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/bin; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = ftp; + }; + name = Debug; + }; + A07D7E320EE82C05006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = ftp; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7E3D0EE82C1B006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = "opengl-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = opengl; + }; + name = Debug; + }; + A07D7E3E0EE82C1B006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = "opengl-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = opengl; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7E4D0EE82C68006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = "pong-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = pong; + }; + name = Debug; + }; + A07D7E4E0EE82C68006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = "pong-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = pong; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7E610EE82D34006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = All; + }; + name = Debug; + }; + A07D7E620EE82D34006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = All; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7E700EE82D5E006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = "post-fx-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = "post-fx"; + }; + name = Debug; + }; + A07D7E710EE82D5E006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = "post-fx-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = "post-fx"; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7E9D0EE82F0A006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = sockets; + }; + name = Debug; + }; + A07D7E9E0EE82F0A006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CONFIGURATION_BUILD_DIR = ../../bin; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = sockets; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7EAD0EE82F75006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = sound; + }; + name = Debug; + }; + A07D7EAE0EE82F75006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = sound; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7EC10EE8302C006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = sound_capture; + }; + name = Debug; + }; + A07D7EC20EE8302C006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = sound_capture; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7ED20EE830D3006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = voip; + }; + name = Debug; + }; + A07D7ED30EE830D3006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + PREBINDING = NO; + PRODUCT_NAME = voip; + ZERO_LINK = NO; + }; + name = Release; + }; + A07D7EE70EE83167006712A3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = "window-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = window; + }; + name = Debug; + }; + A07D7EE80EE83167006712A3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../../lib/xcode\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = "window-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = window; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A07D7D560EE82B1A006712A3 /* Build configuration list for PBXProject "samples" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7D540EE82B1A006712A3 /* Debug */, + A07D7D550EE82B1A006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7E3F0EE82C1B006712A3 /* Build configuration list for PBXNativeTarget "ftp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7E310EE82C05006712A3 /* Debug */, + A07D7E320EE82C05006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7E400EE82C1B006712A3 /* Build configuration list for PBXNativeTarget "opengl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7E3D0EE82C1B006712A3 /* Debug */, + A07D7E3E0EE82C1B006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7E4F0EE82C68006712A3 /* Build configuration list for PBXNativeTarget "pong" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7E4D0EE82C68006712A3 /* Debug */, + A07D7E4E0EE82C68006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7E720EE82D5E006712A3 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7E610EE82D34006712A3 /* Debug */, + A07D7E620EE82D34006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7E730EE82D5E006712A3 /* Build configuration list for PBXNativeTarget "post-fx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7E700EE82D5E006712A3 /* Debug */, + A07D7E710EE82D5E006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7EA70EE82F60006712A3 /* Build configuration list for PBXNativeTarget "sockets" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7E9D0EE82F0A006712A3 /* Debug */, + A07D7E9E0EE82F0A006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7EBA0EE82F91006712A3 /* Build configuration list for PBXNativeTarget "sound" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7EAD0EE82F75006712A3 /* Debug */, + A07D7EAE0EE82F75006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7EC90EE83062006712A3 /* Build configuration list for PBXNativeTarget "sound_capture" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7EC10EE8302C006712A3 /* Debug */, + A07D7EC20EE8302C006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7EDF0EE830F9006712A3 /* Build configuration list for PBXNativeTarget "voip" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7ED20EE830D3006712A3 /* Debug */, + A07D7ED30EE830D3006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A07D7EE90EE83168006712A3 /* Build configuration list for PBXNativeTarget "window" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A07D7EE70EE83167006712A3 /* Debug */, + A07D7EE80EE83167006712A3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A07D7D530EE82B1A006712A3 /* Project object */; +} diff --git a/samples/build/xcode/window-Info.plist b/samples/build/xcode/window-Info.plist new file mode 100644 index 00000000..2da151bb --- /dev/null +++ b/samples/build/xcode/window-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/samples/ftp/Ftp.cpp b/samples/ftp/Ftp.cpp new file mode 100644 index 00000000..76345404 --- /dev/null +++ b/samples/ftp/Ftp.cpp @@ -0,0 +1,205 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Print a FTP response into a standard output stream +/// +//////////////////////////////////////////////////////////// +std::ostream& operator <<(std::ostream& Stream, const sf::Ftp::Response& Response) +{ + return Stream << Response.GetStatus() << Response.GetMessage(); +} + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Choose the server address + sf::IPAddress Address; + do + { + std::cout << "Enter the FTP server address : "; + std::cin >> Address; + } + while (!Address.IsValid()); + + // Connect to the server + sf::Ftp Server; + sf::Ftp::Response ConnectResponse = Server.Connect(Address); + std::cout << ConnectResponse << std::endl; + if (!ConnectResponse.IsOk()) + return EXIT_FAILURE; + + // Ask for user name and password + std::string UserName, Password; + std::cout << "User name : "; + std::cin >> UserName; + std::cout << "Password : "; + std::cin >> Password; + + // Login to the server + sf::Ftp::Response LoginResponse = Server.Login(UserName, Password); + std::cout << LoginResponse << std::endl; + if (!LoginResponse.IsOk()) + return EXIT_FAILURE; + + // Main menu + int Choice = 0; + do + { + // Main FTP menu + std::cout << std::endl; + std::cout << "Choose an action:" << std::endl; + std::cout << "1. Print working directory" << std::endl; + std::cout << "2. Print contents of working directory" << std::endl; + std::cout << "3. Change directory" << std::endl; + std::cout << "4. Create directory" << std::endl; + std::cout << "5. Delete directory" << std::endl; + std::cout << "6. Rename file" << std::endl; + std::cout << "7. Remove file" << std::endl; + std::cout << "8. Download file" << std::endl; + std::cout << "9. Upload file" << std::endl; + std::cout << "0. Disconnect" << std::endl; + std::cout << std::endl; + + std::cout << "Your choice: "; + std::cin >> Choice; + std::cout << std::endl; + + switch (Choice) + { + default : + { + // Wrong choice + std::cout << "Invalid choice!" << std::endl; + std::cin.clear(); + std::cin.ignore(10000, '\n'); + break; + } + + case 1 : + { + // Print current server directory + sf::Ftp::DirectoryResponse Response = Server.GetWorkingDirectory(); + std::cout << Response << std::endl; + std::cout << "Current directory is " << Response.GetDirectory() << std::endl; + break; + } + + case 2 : + { + // Print content of current server directory + sf::Ftp::ListingResponse Response = Server.GetDirectoryListing(); + std::cout << Response << std::endl; + for (std::size_t i = 0; i < Response.GetCount(); ++i) + std::cout << Response.GetFilename(i) << std::endl; + break; + } + + case 3 : + { + // Change the current directory + std::string Directory; + std::cout << "Choose a directory: "; + std::cin >> Directory; + std::cout << Server.ChangeDirectory(Directory) << std::endl; + break; + } + + case 4 : + { + // Create a new directory + std::string Directory; + std::cout << "Name of the directory to create: "; + std::cin >> Directory; + std::cout << Server.MakeDirectory(Directory) << std::endl; + break; + } + + case 5 : + { + // Remove an existing directory + std::string Directory; + std::cout << "Name of the directory to remove: "; + std::cin >> Directory; + std::cout << Server.DeleteDirectory(Directory) << std::endl; + break; + } + + case 6 : + { + // Rename a file + std::string SrcFilename, DstFilename; + std::cout << "Name of the file to rename: "; + std::cin >> SrcFilename; + std::cout << "New name: "; + std::cin >> DstFilename; + std::cout << Server.RenameFile(SrcFilename, DstFilename) << std::endl; + break; + } + + case 7 : + { + // Remove an existing directory + std::string Filename; + std::cout << "Name of the file to remove: "; + std::cin >> Filename; + std::cout << Server.DeleteFile(Filename) << std::endl; + break; + } + + case 8 : + { + // Download a file from server + std::string Filename, Directory; + std::cout << "Path of the file to download (relative to current directory): "; + std::cin >> Filename; + std::cout << "Directory to download the file to: "; + std::cin >> Directory; + std::cout << Server.Download(Filename, Directory) << std::endl; + break; + } + + case 9 : + { + // Upload a file to server + std::string Filename, Directory; + std::cout << "Path of the file to upload (absolute or relative to working directory): "; + std::cin >> Filename; + std::cout << "Directory to upload the file to (relative to current directory): "; + std::cin >> Directory; + std::cout << Server.Upload(Filename, Directory) << std::endl; + break; + } + + case 0 : + { + // Disconnect + break; + } + } + + } while (Choice != 0); + + // Disconnect from the server + std::cout << "Disconnecting from server..." << std::endl; + std::cout << Server.Disconnect() << std::endl; + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/samples/ftp/Makefile b/samples/ftp/Makefile new file mode 100644 index 00000000..8bd25ae4 --- /dev/null +++ b/samples/ftp/Makefile @@ -0,0 +1,18 @@ +EXEC = ftp +OBJ = Ftp.o + +all: $(EXEC) + +ftp: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-network -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/opengl/Makefile b/samples/opengl/Makefile new file mode 100644 index 00000000..42ff5ca4 --- /dev/null +++ b/samples/opengl/Makefile @@ -0,0 +1,18 @@ +EXEC = opengl +OBJ = OpenGL.o + +all: $(EXEC) + +opengl: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-graphics -lsfml-window -lsfml-system -lGLU -lGL + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/opengl/OpenGL.cpp b/samples/opengl/OpenGL.cpp new file mode 100644 index 00000000..b08a549a --- /dev/null +++ b/samples/opengl/OpenGL.cpp @@ -0,0 +1,143 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Create main window + sf::RenderWindow App(sf::VideoMode(800, 600), "SFML OpenGL"); + App.PreserveOpenGLStates(true); + + // Create a sprite for the background + sf::Image BackgroundImage; + if (!BackgroundImage.LoadFromFile("datas/opengl/background.jpg")) + return EXIT_FAILURE; + sf::Sprite Background(BackgroundImage); + + // Load an OpenGL texture. + // We could directly use a sf::Image as an OpenGL texture (with its Bind() member function), + // but here we want more control on it (generate mipmaps, ...) so we create a new one + GLuint Texture = 0; + { + sf::Image Image; + if (!Image.LoadFromFile("datas/opengl/texture.jpg")) + return EXIT_FAILURE; + glGenTextures(1, &Texture); + glBindTexture(GL_TEXTURE_2D, Texture); + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Image.GetWidth(), Image.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, Image.GetPixelsPtr()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + } + + // Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + glClearDepth(1.f); + + // Setup a perspective projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90.f, 1.f, 1.f, 500.f); + + // Bind our texture + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, Texture); + glColor4f(1.f, 1.f, 1.f, 1.f); + + // Create a clock for measuring the time elapsed + sf::Clock Clock; + + // Start game loop + while (App.IsOpened()) + { + // Process events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Close window : exit + if (Event.Type == sf::Event::Closed) + App.Close(); + + // Escape key : exit + if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) + App.Close(); + + // Adjust the viewport when the window is resized + if (Event.Type == sf::Event::Resized) + glViewport(0, 0, Event.Size.Width, Event.Size.Height); + } + + // Draw background + App.Draw(Background); + + // Clear depth buffer + glClear(GL_DEPTH_BUFFER_BIT); + + // Apply some transformations + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.f, 0.f, -200.f); + glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f); + glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f); + glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f); + + // Draw a cube + glBegin(GL_QUADS); + + glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f); + glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, -50.f); + glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f, -50.f); + glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, -50.f); + + glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, 50.f); + glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, 50.f); + glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f, 50.f); + glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, 50.f); + + glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f); + glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, -50.f); + glTexCoord2f(1, 1); glVertex3f(-50.f, 50.f, 50.f); + glTexCoord2f(1, 0); glVertex3f(-50.f, -50.f, 50.f); + + glTexCoord2f(0, 0); glVertex3f(50.f, -50.f, -50.f); + glTexCoord2f(0, 1); glVertex3f(50.f, 50.f, -50.f); + glTexCoord2f(1, 1); glVertex3f(50.f, 50.f, 50.f); + glTexCoord2f(1, 0); glVertex3f(50.f, -50.f, 50.f); + + glTexCoord2f(0, 1); glVertex3f(-50.f, -50.f, 50.f); + glTexCoord2f(0, 0); glVertex3f(-50.f, -50.f, -50.f); + glTexCoord2f(1, 0); glVertex3f( 50.f, -50.f, -50.f); + glTexCoord2f(1, 1); glVertex3f( 50.f, -50.f, 50.f); + + glTexCoord2f(0, 1); glVertex3f(-50.f, 50.f, 50.f); + glTexCoord2f(0, 0); glVertex3f(-50.f, 50.f, -50.f); + glTexCoord2f(1, 0); glVertex3f( 50.f, 50.f, -50.f); + glTexCoord2f(1, 1); glVertex3f( 50.f, 50.f, 50.f); + + glEnd(); + + // Draw some text on top of our OpenGL object + sf::String Text("This is a rotating cube"); + Text.SetPosition(250.f, 300.f); + Text.SetColor(sf::Color(128, 0, 128)); + App.Draw(Text); + + // Finally, display the rendered frame on screen + App.Display(); + } + + // Don't forget to destroy our texture + glDeleteTextures(1, &Texture); + + return EXIT_SUCCESS; +} diff --git a/samples/pong/Makefile b/samples/pong/Makefile new file mode 100644 index 00000000..314ace22 --- /dev/null +++ b/samples/pong/Makefile @@ -0,0 +1,18 @@ +EXEC = pong +OBJ = Pong.o + +all: $(EXEC) + +pong: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/pong/Pong.cpp b/samples/pong/Pong.cpp new file mode 100644 index 00000000..6ca169cf --- /dev/null +++ b/samples/pong/Pong.cpp @@ -0,0 +1,190 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Defines PI + const float PI = 3.14159f; + + // Create the window of the application + sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Pong"); + + // Load the sounds used in the game + sf::SoundBuffer BallSoundBuffer; + if (!BallSoundBuffer.LoadFromFile("datas/pong/ball.wav")) + { + return EXIT_FAILURE; + } + sf::Sound BallSound(BallSoundBuffer); + + // Load the images used in the game + sf::Image BackgroundImage, LeftPaddleImage, RightPaddleImage, BallImage; + if (!BackgroundImage.LoadFromFile("datas/pong/background.jpg") || + !LeftPaddleImage.LoadFromFile("datas/pong/paddle_left.png") || + !RightPaddleImage.LoadFromFile("datas/pong/paddle_right.png") || + !BallImage.LoadFromFile("datas/pong/ball.png")) + { + return EXIT_FAILURE; + } + + // Load the text font + sf::Font Cheeseburger; + if (!Cheeseburger.LoadFromFile("datas/post-fx/cheeseburger.ttf")) + return EXIT_FAILURE; + + // Initialize the end text + sf::String End; + End.SetFont(Cheeseburger); + End.SetSize(60.f); + End.Move(150.f, 200.f); + End.SetColor(sf::Color(50, 50, 250)); + + // Create the sprites of the background, the paddles and the ball + sf::Sprite Background(BackgroundImage); + sf::Sprite LeftPaddle(LeftPaddleImage); + sf::Sprite RightPaddle(RightPaddleImage); + sf::Sprite Ball(BallImage); + + LeftPaddle.Move(10, (App.GetView().GetRect().GetHeight() - LeftPaddle.GetSize().y) / 2); + RightPaddle.Move(App.GetView().GetRect().GetWidth() - RightPaddle.GetSize().x - 10, (App.GetView().GetRect().GetHeight() - RightPaddle.GetSize().y) / 2); + Ball.Move((App.GetView().GetRect().GetWidth() - Ball.GetSize().x) / 2, (App.GetView().GetRect().GetHeight() - Ball.GetSize().y) / 2); + + // Define the paddles properties + sf::Clock AITimer; + const float AITime = 0.1f; + float LeftPaddleSpeed = 400.f; + float RightPaddleSpeed = 400.f; + + // Define the ball properties + float BallSpeed = 400.f; + float BallAngle; + do + { + // Make sure the ball initial angle is not too much vertical + BallAngle = sf::Randomizer::Random(0.f, 2 * PI); + } while (std::abs(std::cos(BallAngle)) < 0.7f); + + bool IsPlaying = true; + while (App.IsOpened()) + { + // Handle events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Window closed or escape key pressed : exit + if ((Event.Type == sf::Event::Closed) || + ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))) + { + App.Close(); + break; + } + } + + if (IsPlaying) + { + // Move the player's paddle + if (App.GetInput().IsKeyDown(sf::Key::Up) && (LeftPaddle.GetPosition().y > 5.f)) + LeftPaddle.Move(0.f, -LeftPaddleSpeed * App.GetFrameTime()); + if (App.GetInput().IsKeyDown(sf::Key::Down) && (LeftPaddle.GetPosition().y < App.GetView().GetRect().GetHeight() - LeftPaddle.GetSize().y - 5.f)) + LeftPaddle.Move(0.f, LeftPaddleSpeed * App.GetFrameTime()); + + // Move the computer's paddle + if (((RightPaddleSpeed < 0.f) && (RightPaddle.GetPosition().y > 5.f)) || + ((RightPaddleSpeed > 0.f) && (RightPaddle.GetPosition().y < App.GetView().GetRect().GetHeight() - RightPaddle.GetSize().y - 5.f))) + { + RightPaddle.Move(0.f, RightPaddleSpeed * App.GetFrameTime()); + } + + // Update the computer's paddle direction according to the ball position + if (AITimer.GetElapsedTime() > AITime) + { + AITimer.Reset(); + if ((RightPaddleSpeed < 0) && (Ball.GetPosition().y + Ball.GetSize().y > RightPaddle.GetPosition().y + RightPaddle.GetSize().y)) + RightPaddleSpeed = -RightPaddleSpeed; + if ((RightPaddleSpeed > 0) && (Ball.GetPosition().y < RightPaddle.GetPosition().y)) + RightPaddleSpeed = -RightPaddleSpeed; + } + + // Move the ball + float Factor = BallSpeed * App.GetFrameTime(); + Ball.Move(std::cos(BallAngle) * Factor, std::sin(BallAngle) * Factor); + + // Check collisions between the ball and the screen + if (Ball.GetPosition().x < 0.f) + { + IsPlaying = false; + End.SetText("You lost !\n(press escape to exit)"); + } + if (Ball.GetPosition().x + Ball.GetSize().x > App.GetView().GetRect().GetWidth()) + { + IsPlaying = false; + End.SetText("You won !\n(press escape to exit)"); + } + if (Ball.GetPosition().y < 0.f) + { + BallSound.Play(); + BallAngle = -BallAngle; + Ball.SetY(0.1f); + } + if (Ball.GetPosition().y + Ball.GetSize().y > App.GetView().GetRect().GetHeight()) + { + BallSound.Play(); + BallAngle = -BallAngle; + Ball.SetY(App.GetView().GetRect().GetHeight() - Ball.GetSize().y - 0.1f); + } + + // Check the collisions between the ball and the paddles + // Left Paddle + if (Ball.GetPosition().x < LeftPaddle.GetPosition().x + LeftPaddle.GetSize().x && + Ball.GetPosition().x > LeftPaddle.GetPosition().x + (LeftPaddle.GetSize().x / 2.0f) && + Ball.GetPosition().y + Ball.GetSize().y >= LeftPaddle.GetPosition().y && + Ball.GetPosition().y <= LeftPaddle.GetPosition().y + LeftPaddle.GetSize().y) + { + BallSound.Play(); + BallAngle = PI - BallAngle; + Ball.SetX(LeftPaddle.GetPosition().x + LeftPaddle.GetSize().x + 0.1f); + } + + // Right Paddle + if (Ball.GetPosition().x + Ball.GetSize().x > RightPaddle.GetPosition().x && + Ball.GetPosition().x + Ball.GetSize().x < RightPaddle.GetPosition().x + (RightPaddle.GetSize().x / 2.0f) && + Ball.GetPosition().y + Ball.GetSize().y >= RightPaddle.GetPosition().y && + Ball.GetPosition().y <= RightPaddle.GetPosition().y + RightPaddle.GetSize().y) + { + BallSound.Play(); + BallAngle = PI - BallAngle; + Ball.SetX(RightPaddle.GetPosition().x - Ball.GetSize().x - 0.1f); + } + } + + // Clear the window + App.Clear(); + + // Draw the background, paddles and ball sprites + App.Draw(Background); + App.Draw(LeftPaddle); + App.Draw(RightPaddle); + App.Draw(Ball); + + // If the game is over, display the end message + if (!IsPlaying) + App.Draw(End); + + // Display things on screen + App.Display(); + } + + return EXIT_SUCCESS; +} diff --git a/samples/post-fx/Makefile b/samples/post-fx/Makefile new file mode 100644 index 00000000..2c259881 --- /dev/null +++ b/samples/post-fx/Makefile @@ -0,0 +1,18 @@ +EXEC = post-fx +OBJ = PostFX.o + +all: $(EXEC) + +post-fx: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-graphics -lsfml-window -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/post-fx/PostFX.cpp b/samples/post-fx/PostFX.cpp new file mode 100644 index 00000000..8a3e4bc0 --- /dev/null +++ b/samples/post-fx/PostFX.cpp @@ -0,0 +1,184 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + +void DisplayError(); + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Check that the system can use post effects + if (sf::PostFX::CanUsePostFX() == false) + { + DisplayError(); + return EXIT_SUCCESS; + } + + // Create the main window + sf::RenderWindow App(sf::VideoMode(800, 600), "SFML PostFX"); + + // Load a cute background image to display :) + sf::Image BackgroundImage; + if (!BackgroundImage.LoadFromFile("datas/post-fx/background.jpg")) + return EXIT_FAILURE; + sf::Sprite Background(BackgroundImage); + + // Load the text font + sf::Font Cheeseburger; + if (!Cheeseburger.LoadFromFile("datas/post-fx/cheeseburger.ttf")) + return EXIT_FAILURE; + + // Load the image needed for the wave effect + sf::Image WaveImage; + if (!WaveImage.LoadFromFile("datas/post-fx/wave.jpg")) + return EXIT_FAILURE; + + // Load all effects + std::map Effects; + if (!Effects["nothing"].LoadFromFile("datas/post-fx/nothing.sfx")) return EXIT_FAILURE; + if (!Effects["blur"].LoadFromFile("datas/post-fx/blur.sfx")) return EXIT_FAILURE; + if (!Effects["colorize"].LoadFromFile("datas/post-fx/colorize.sfx")) return EXIT_FAILURE; + if (!Effects["fisheye"].LoadFromFile("datas/post-fx/fisheye.sfx")) return EXIT_FAILURE; + if (!Effects["wave"].LoadFromFile("datas/post-fx/wave.sfx")) return EXIT_FAILURE; + std::map::iterator CurrentEffect = Effects.find("nothing"); + + // Do specific initializations + Effects["nothing"].SetTexture("framebuffer", NULL); + Effects["blur"].SetTexture("framebuffer", NULL); + Effects["blur"].SetParameter("offset", 0.f); + Effects["colorize"].SetTexture("framebuffer", NULL); + Effects["colorize"].SetParameter("color", 1.f, 1.f, 1.f); + Effects["fisheye"].SetTexture("framebuffer", NULL); + Effects["wave"].SetTexture("framebuffer", NULL); + Effects["wave"].SetTexture("wave", &WaveImage); + + // Define a string for displaying current effect description + sf::String CurFXStr; + CurFXStr.SetText("Current effect is \"" + CurrentEffect->first + "\""); + CurFXStr.SetFont(Cheeseburger); + CurFXStr.SetPosition(20.f, 0.f); + + // Define a string for displaying help + sf::String InfoStr; + InfoStr.SetText("Move your mouse to change the effect parameters\nPress numpad + and - to change effect\nWarning : some effects may not work\ndepending on your graphics card"); + InfoStr.SetFont(Cheeseburger); + InfoStr.SetPosition(20.f, 460.f); + InfoStr.SetColor(sf::Color(200, 100, 150)); + + // Start the game loop + while (App.IsOpened()) + { + // Process events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Close window : exit + if (Event.Type == sf::Event::Closed) + App.Close(); + + if (Event.Type == sf::Event::KeyPressed) + { + // Escape key : exit + if (Event.Key.Code == sf::Key::Escape) + App.Close(); + + // Add key : next effect + if (Event.Key.Code == sf::Key::Add) + { + CurrentEffect++; + if (CurrentEffect == Effects.end()) + CurrentEffect = Effects.begin(); + CurFXStr.SetText("Current effect is \"" + CurrentEffect->first + "\""); + } + + // Subtract key : previous effect + if (Event.Key.Code == sf::Key::Subtract) + { + if (CurrentEffect == Effects.begin()) + CurrentEffect = Effects.end(); + CurrentEffect--; + CurFXStr.SetText("Current effect is \"" + CurrentEffect->first + "\""); + } + } + } + + // Get the mouse position in the range [0, 1] + float X = App.GetInput().GetMouseX() / static_cast(App.GetWidth()); + float Y = App.GetInput().GetMouseY() / static_cast(App.GetHeight()); + + // Update the current effect + if (CurrentEffect->first == "blur") CurrentEffect->second.SetParameter("offset", X * Y * 0.1f); + else if (CurrentEffect->first == "colorize") CurrentEffect->second.SetParameter("color", 0.3f, X, Y); + else if (CurrentEffect->first == "fisheye") CurrentEffect->second.SetParameter("mouse", X, 1.f - Y); + else if (CurrentEffect->first == "wave") CurrentEffect->second.SetParameter("offset", X, Y); + + // Clear the window + App.Clear(); + + // Draw background and apply the post-fx + App.Draw(Background); + App.Draw(CurrentEffect->second); + + // Draw interface strings + App.Draw(CurFXStr); + App.Draw(InfoStr); + + // Finally, display the rendered frame on screen + App.Display(); + } + + return EXIT_SUCCESS; +} + + +//////////////////////////////////////////////////////////// +/// Fonction called when the post-effects are not supported ; +/// Display an error message and wait until the user exits +/// +//////////////////////////////////////////////////////////// +void DisplayError() +{ + // Create the main window + sf::RenderWindow App(sf::VideoMode(800, 600), "SFML PostFX"); + + // Define a string for displaying the error message + sf::String ErrorStr("Sorry, your system doesn't support post-effects"); + ErrorStr.SetPosition(100.f, 250.f); + ErrorStr.SetColor(sf::Color(200, 100, 150)); + + // Start the game loop + bool Running = true; + while (Running) + { + // Process events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Close window : exit + if (Event.Type == sf::Event::Closed) + Running = false; + + // Escape key : exit + if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) + Running = false; + } + + // Clear the window + App.Clear(); + + // Draw the error message + App.Draw(ErrorStr); + + // Finally, display the rendered frame on screen + App.Display(); + } +} diff --git a/samples/qt/Main.cpp b/samples/qt/Main.cpp new file mode 100644 index 00000000..027cc6fa --- /dev/null +++ b/samples/qt/Main.cpp @@ -0,0 +1,107 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "QSFMLCanvas.hpp" +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Custom SFML canvas +//////////////////////////////////////////////////////////// +class MyCanvas : public QSFMLCanvas +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the canvas + /// + //////////////////////////////////////////////////////////// + MyCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size) : + QSFMLCanvas(Parent, Position, Size) + { + + } + +private : + + //////////////////////////////////////////////////////////// + /// /see QSFMLCanvas::OnInit + /// + //////////////////////////////////////////////////////////// + virtual void OnInit() + { + // Load the image + myImage.LoadFromFile("datas/qt/sfml.png"); + + // Setup the sprite + mySprite.SetImage(myImage); + mySprite.SetCenter(mySprite.GetSize() / 2.f); + } + + //////////////////////////////////////////////////////////// + /// /see QSFMLCanvas::OnUpdate + /// + //////////////////////////////////////////////////////////// + virtual void OnUpdate() + { + sf::Event Event; + while (GetEvent(Event)) + { + // Stick the sprite to the mouse cursor + if (Event.Type == sf::Event::MouseMoved) + { + mySprite.SetX(Event.MouseMove.X); + mySprite.SetY(Event.MouseMove.Y); + } + } + + // Rotate the sprite + mySprite.Rotate(GetFrameTime() * 100.f); + + // Clear the view + Clear(sf::Color(0, 128, 0)); + + // Draw it + Draw(mySprite); + } + + //////////////////////////////////////////////////////////// + /// Member data + //////////////////////////////////////////////////////////// + sf::Image myImage; ///< Some image to show + sf::Sprite mySprite; ///< A sprite to display the image +}; + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main(int argc, char **argv) +{ + QApplication App(argc, argv); + + // Create the main frame + QFrame* MainFrame = new QFrame; + MainFrame->setWindowTitle("Qt SFML"); + MainFrame->resize(400, 400); + MainFrame->show(); + + // Create a label for showing some text + QLabel* Label = new QLabel("This is a SFML window\nembedded into a Qt frame :", MainFrame); + Label->move(20, 10); + Label->setFont(QFont("courier new", 14, 1, false)); + Label->show(); + + // Create a SFML view inside the main frame + MyCanvas* SFMLView = new MyCanvas(MainFrame, QPoint(20, 60), QSize(360, 320)); + SFMLView->show(); + + return App.exec(); +} diff --git a/samples/qt/Makefile b/samples/qt/Makefile new file mode 100644 index 00000000..b02aba9b --- /dev/null +++ b/samples/qt/Makefile @@ -0,0 +1,18 @@ +EXEC = qt +OBJ = Main.o QSFMLCanvas.o + +all: $(EXEC) + +qt: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-graphics -lsfml-window -lsfml-system -lQtCore -lQtGui -lX11 + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) -I/usr/include/qt4 + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/qt/QSFMLCanvas.cpp b/samples/qt/QSFMLCanvas.cpp new file mode 100644 index 00000000..3baa0466 --- /dev/null +++ b/samples/qt/QSFMLCanvas.cpp @@ -0,0 +1,106 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "QSFMLCanvas.hpp" + +// Platform-specific headers +#ifdef Q_WS_X11 + #include + #include +#endif + + +//////////////////////////////////////////////////////////// +/// Construct the QSFMLCanvas +//////////////////////////////////////////////////////////// +QSFMLCanvas::QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime) : +QWidget (Parent), +myInitialized (false) +{ + // Setup some states to allow direct rendering into the widget + setAttribute(Qt::WA_PaintOnScreen); + setAttribute(Qt::WA_NoSystemBackground); + + // Set strong focus to enable keyboard events to be received + setFocusPolicy(Qt::StrongFocus); + + // Setup the widget geometry + move(Position); + resize(Size); + + // Setup the timer + myTimer.setInterval(FrameTime); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +QSFMLCanvas::~QSFMLCanvas() +{ + // Nothing to do... +} + + +//////////////////////////////////////////////////////////// +/// Notification for the derived class that moment is good +/// for doing initializations +//////////////////////////////////////////////////////////// +void QSFMLCanvas::OnInit() +{ + // Nothing to do by default... +} + + +//////////////////////////////////////////////////////////// +/// Notification for the derived class that moment is good +/// for doing its update and drawing stuff +//////////////////////////////////////////////////////////// +void QSFMLCanvas::OnUpdate() +{ + // Nothing to do by default... +} + + +//////////////////////////////////////////////////////////// +/// Called when the widget is shown ; +/// we use it to initialize our SFML window +//////////////////////////////////////////////////////////// +void QSFMLCanvas::showEvent(QShowEvent*) +{ + if (!myInitialized) + { + // Under X11, we need to flush the commands sent to the server to ensure that + // SFML will get an updated view of the windows + #ifdef Q_WS_X11 + XFlush(QX11Info::display()); + #endif + + // Create the SFML window with the widget handle + Create(winId()); + + // Let the derived class do its specific stuff + OnInit(); + + // Setup the timer to trigger a refresh at specified framerate + connect(&myTimer, SIGNAL(timeout()), this, SLOT(repaint())); + myTimer.start(); + + myInitialized = true; + } +} + + +//////////////////////////////////////////////////////////// +/// Called when the widget needs to be painted ; +/// we use it to display a new frame +//////////////////////////////////////////////////////////// +void QSFMLCanvas::paintEvent(QPaintEvent*) +{ + // Let the derived class do its specific stuff + OnUpdate(); + + // Display on screen + Display(); +} diff --git a/samples/qt/QSFMLCanvas.hpp b/samples/qt/QSFMLCanvas.hpp new file mode 100644 index 00000000..a129e014 --- /dev/null +++ b/samples/qt/QSFMLCanvas.hpp @@ -0,0 +1,75 @@ + +#ifndef QSFMLCANVAS_HPP +#define QSFMLCANVAS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// QSFMLCanvas allows to run SFML in a Qt control +//////////////////////////////////////////////////////////// +class QSFMLCanvas : public QWidget, public sf::RenderWindow +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the QSFMLCanvas + /// + /// \param Parent : Parent of the widget + /// \param Position : Position of the widget + /// \param Size : Size of the widget + /// \param FrameTime : Frame duration, in milliseconds (0 by default) + /// + //////////////////////////////////////////////////////////// + QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime = 0); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~QSFMLCanvas(); + +private : + + //////////////////////////////////////////////////////////// + /// Notification for the derived class that moment is good + /// for doing initializations + /// + //////////////////////////////////////////////////////////// + virtual void OnInit(); + + //////////////////////////////////////////////////////////// + /// Notification for the derived class that moment is good + /// for doing its update and drawing stuff + /// + //////////////////////////////////////////////////////////// + virtual void OnUpdate(); + + //////////////////////////////////////////////////////////// + /// Called when the widget is shown ; + /// we use it to initialize our SFML window + /// + //////////////////////////////////////////////////////////// + virtual void showEvent(QShowEvent*); + + //////////////////////////////////////////////////////////// + /// Called when the widget needs to be painted ; + /// we use it to display a new frame + /// + //////////////////////////////////////////////////////////// + virtual void paintEvent(QPaintEvent*); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + QTimer myTimer; ///< Timer used to update the view + bool myInitialized; ///< Tell whether the SFML window has been initialized or not +}; + + +#endif // QSFMLCANVAS_HPP diff --git a/samples/sockets/Makefile b/samples/sockets/Makefile new file mode 100644 index 00000000..6adf0200 --- /dev/null +++ b/samples/sockets/Makefile @@ -0,0 +1,18 @@ +EXEC = sockets +OBJ = Sockets.o TCP.o UDP.o + +all: $(EXEC) + +sockets: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-network -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/sockets/Sockets.cpp b/samples/sockets/Sockets.cpp new file mode 100644 index 00000000..07602190 --- /dev/null +++ b/samples/sockets/Sockets.cpp @@ -0,0 +1,62 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Function prototypes +// (I'm too lazy to put them into separate headers...) +//////////////////////////////////////////////////////////// +void DoClientTCP(unsigned short Port); +void DoClientUDP(unsigned short Port); +void DoServerTCP(unsigned short Port); +void DoServerUDP(unsigned short Port); + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Choose a random port for opening sockets (ports < 1024 are reserved) + const unsigned short Port = 2435; + + // TCP or UDP ? + char Protocol; + std::cout << "Do you want to use TCP ('t') or UDP ('u') ? "; + std::cin >> Protocol; + + // Client or server ? + char Who; + std::cout << "Do you want to be a server ('s') or a client ('c') ? "; + std::cin >> Who; + + if (Who == 's') + { + // Run as a server + if (Protocol == 't') + DoServerTCP(Port); + else + DoServerUDP(Port); + } + else + { + // Run as a client + if (Protocol == 't') + DoClientTCP(Port); + else + DoClientUDP(Port); + } + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/samples/sockets/TCP.cpp b/samples/sockets/TCP.cpp new file mode 100644 index 00000000..25fbb9a8 --- /dev/null +++ b/samples/sockets/TCP.cpp @@ -0,0 +1,93 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Create a client and connect it to a running server +/// +//////////////////////////////////////////////////////////// +void DoClientTCP(unsigned short Port) +{ + // Ask for server address + sf::IPAddress ServerAddress; + do + { + std::cout << "Type address or name of the server to connect to : "; + std::cin >> ServerAddress; + } + while (!ServerAddress.IsValid()); + + // Create a TCP socket for communicating with server + sf::SocketTCP Client; + + // Connect to the specified server + if (Client.Connect(Port, ServerAddress) != sf::Socket::Done) + return; + std::cout << "Connected to server " << ServerAddress << std::endl; + + // Receive a message from the client + char Message[128]; + std::size_t Received; + if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done) + return; + + // Show it + std::cout << "Message received from server : \"" << Message << "\"" << std::endl; + + // Define a message to send back to the server + char ToSend[] = "Hi, I'm a client !"; + + // Send the message + if (Client.Send(ToSend, sizeof(ToSend)) != sf::Socket::Done) + return; + std::cout << "Message sent to server : \"" << ToSend << "\"" << std::endl; + + // Close the socket when we're done + Client.Close(); +} + + +//////////////////////////////////////////////////////////// +/// Launch a server and wait for incoming connections +/// +//////////////////////////////////////////////////////////// +void DoServerTCP(unsigned short Port) +{ + // Create a TCP socket for communicating with clients + sf::SocketTCP Server; + + // Listen to a port for incoming connections + if (!Server.Listen(Port)) + return; + std::cout << "Server is listening to port " << Port << ", waiting for connections... " << std::endl; + + // Wait for a connection + sf::IPAddress ClientAddress; + sf::SocketTCP Client; + if (Server.Accept(Client, &ClientAddress) != sf::Socket::Done) + return; + std::cout << "Client connected : " << ClientAddress << std::endl; + + // Send a message to the client + char ToSend[] = "Hi, I'm the server"; + if (Client.Send(ToSend, sizeof(ToSend)) != sf::Socket::Done) + return; + std::cout << "Message sent to the client : \"" << ToSend << "\"" << std::endl; + + // Receive a message back from the client + char Message[128]; + std::size_t Received; + if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done) + return; + + // Show the message + std::cout << "Message received from the client : \"" << Message << "\"" << std::endl; + + // Close the sockets when we're done + Client.Close(); + Server.Close(); +} diff --git a/samples/sockets/UDP.cpp b/samples/sockets/UDP.cpp new file mode 100644 index 00000000..b0bdb8dd --- /dev/null +++ b/samples/sockets/UDP.cpp @@ -0,0 +1,65 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Create a client and send a message to a running server +/// +//////////////////////////////////////////////////////////// +void DoClientUDP(unsigned short Port) +{ + // Ask for server address + sf::IPAddress ServerAddress; + do + { + std::cout << "Type address or name of the server to send the message to : "; + std::cin >> ServerAddress; + } + while (!ServerAddress.IsValid()); + + // Create a UDP socket for communicating with server + sf::SocketUDP Client; + + // Send a message to the server + char Message[] = "Hi, I'm a client !"; + if (Client.Send(Message, sizeof(Message), ServerAddress, Port) != sf::Socket::Done) + return; + std::cout << "Message sent to server : \"" << Message << "\"" << std::endl; + + // Close the socket when we're done + Client.Close(); +} + + +//////////////////////////////////////////////////////////// +/// Launch a server and wait for incoming messages +/// +//////////////////////////////////////////////////////////// +void DoServerUDP(unsigned short Port) +{ + // Create a UDP socket for communicating with clients + sf::SocketUDP Server; + + // Bind it to the specified port + if (!Server.Bind(Port)) + return; + + // Receive a message from anyone + sf::IPAddress ClientAddress; + unsigned short ClientPort; + char Message[128]; + std::size_t Received; + if (Server.Receive(Message, sizeof(Message), Received, ClientAddress, ClientPort) != sf::Socket::Done) + return; + + // Display it + std::cout << "Message received from " << ClientAddress << " on port " << ClientPort + << ": \"" << Message << "\"" << std::endl; + + // Close the socket when we're done + Server.Close(); +} diff --git a/samples/sound/Makefile b/samples/sound/Makefile new file mode 100644 index 00000000..495c13e9 --- /dev/null +++ b/samples/sound/Makefile @@ -0,0 +1,18 @@ +EXEC = sound +OBJ = Sound.o + +all: $(EXEC) + +sound: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-audio -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/sound/Sound.cpp b/samples/sound/Sound.cpp new file mode 100644 index 00000000..94314d3c --- /dev/null +++ b/samples/sound/Sound.cpp @@ -0,0 +1,96 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Play a sound +/// +//////////////////////////////////////////////////////////// +void PlaySound() +{ + // Load a sound buffer from a wav file + sf::SoundBuffer Buffer; + if (!Buffer.LoadFromFile("datas/sound/footsteps.wav")) + return; + + // Display sound informations + std::cout << "footsteps.wav :" << std::endl; + std::cout << " " << Buffer.GetDuration() << " sec" << std::endl; + std::cout << " " << Buffer.GetSampleRate() << " samples / sec" << std::endl; + std::cout << " " << Buffer.GetChannelsCount() << " channels" << std::endl; + + // Create a sound instance and play it + sf::Sound Sound(Buffer); + Sound.Play(); + + // Loop while the sound is playing + while (Sound.GetStatus() == sf::Sound::Playing) + { + // Display the playing position + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Sound.GetPlayingOffset() << " sec "; + + // Leave some CPU time for other processes + sf::Sleep(0.1f); + } + std::cout << std::endl << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Play a music +/// +//////////////////////////////////////////////////////////// +void PlayMusic() +{ + // Load an ogg music file + sf::Music Music; + if (!Music.OpenFromFile("datas/sound/lepidoptera.ogg")) + return; + + // Display music informations + std::cout << "lepidoptera.ogg :" << std::endl; + std::cout << " " << Music.GetDuration() << " sec" << std::endl; + std::cout << " " << Music.GetSampleRate() << " samples / sec" << std::endl; + std::cout << " " << Music.GetChannelsCount() << " channels" << std::endl; + + // Play it + Music.Play(); + + // Loop while the music is playing + while (Music.GetStatus() == sf::Music::Playing) + { + // Display the playing position + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Music.GetPlayingOffset() << " sec "; + + // Leave some CPU time for other processes + sf::Sleep(0.1f); + } + std::cout << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Play a sound + PlaySound(); + + // Play a music + PlayMusic(); + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/samples/sound_capture/Makefile b/samples/sound_capture/Makefile new file mode 100644 index 00000000..bc492175 --- /dev/null +++ b/samples/sound_capture/Makefile @@ -0,0 +1,18 @@ +EXEC = sound_capture +OBJ = SoundCapture.o + +all: $(EXEC) + +sound_capture: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-audio -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/sound_capture/SoundCapture.cpp b/samples/sound_capture/SoundCapture.cpp new file mode 100644 index 00000000..96ea4418 --- /dev/null +++ b/samples/sound_capture/SoundCapture.cpp @@ -0,0 +1,94 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Check that the device can capture audio + if (sf::SoundRecorder::CanCapture() == false) + { + std::cout << "Sorry, audio capture is not supported by your system" << std::endl; + return EXIT_SUCCESS; + } + + // Choose the sample rate + unsigned int SampleRate; + std::cout << "Please choose the sample rate for sound capture (44100 is CD quality) : "; + std::cin >> SampleRate; + std::cin.ignore(10000, '\n'); + + // Wait for user input... + std::cout << "Press enter to start recording audio"; + std::cin.ignore(10000, '\n'); + + // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer + sf::SoundBufferRecorder Recorder; + + // Audio capture is done in a separate thread, so we can block the main thread while it is capturing + Recorder.Start(SampleRate); + std::cout << "Recording... press enter to stop"; + std::cin.ignore(10000, '\n'); + Recorder.Stop(); + + // Get the buffer containing the captured data + const sf::SoundBuffer& Buffer = Recorder.GetBuffer(); + + // Display captured sound informations + std::cout << "Sound information :" << std::endl; + std::cout << " " << Buffer.GetDuration() << " seconds" << std::endl; + std::cout << " " << Buffer.GetSampleRate() << " samples / seconds" << std::endl; + std::cout << " " << Buffer.GetChannelsCount() << " channels" << std::endl; + + // Choose what to do with the recorded sound data + char Choice; + std::cout << "What do you want to do with captured sound (p = play, s = save) ? "; + std::cin >> Choice; + std::cin.ignore(10000, '\n'); + + if (Choice == 's') + { + // Choose the filename + std::string Filename; + std::cout << "Choose the file to create : "; + std::getline(std::cin, Filename); + + // Save the buffer + Buffer.SaveToFile(Filename); + } + else + { + // Create a sound instance and play it + sf::Sound Sound(Buffer); + Sound.Play(); + + // Wait until finished + while (Sound.GetStatus() == sf::Sound::Playing) + { + // Display the playing position + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << Sound.GetPlayingOffset() << " sec"; + + // Leave some CPU time for other threads + sf::Sleep(0.1f); + } + } + + // Finished ! + std::cout << std::endl << "Done !" << std::endl; + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/samples/voip/Client.cpp b/samples/voip/Client.cpp new file mode 100644 index 00000000..7f23e3b7 --- /dev/null +++ b/samples/voip/Client.cpp @@ -0,0 +1,110 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +const sf::Uint8 AudioData = 1; +const sf::Uint8 EndOfStream = 2; + + +//////////////////////////////////////////////////////////// +/// Specialization of audio recorder for sending recorded audio +/// data through the network +//////////////////////////////////////////////////////////// +class NetworkRecorder : public sf::SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// Constructor + /// + /// \param Socket : Socket that holds the connection with the server + /// + //////////////////////////////////////////////////////////// + NetworkRecorder(sf::SocketTCP Socket) : + mySocket(Socket) + { + + } + +private : + + //////////////////////////////////////////////////////////// + /// /see SoundRecorder::ProcessSamples + /// + //////////////////////////////////////////////////////////// + virtual bool OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount) + { + // Pack the audio samples into a network packet + sf::Packet PacketOut; + PacketOut << AudioData; + PacketOut.Append(Samples, SamplesCount * sizeof(sf::Int16)); + + // Send the audio packet to the server + return mySocket.Send(PacketOut) == sf::Socket::Done; + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + sf::SocketTCP mySocket; ///< Socket used to communicate with the server +}; + + +//////////////////////////////////////////////////////////// +/// Create a client, connect it to a running server and +/// start sending him audio data +/// +//////////////////////////////////////////////////////////// +void DoClient(unsigned short Port) +{ + // Check that the device can capture audio + if (sf::SoundRecorder::CanCapture() == false) + { + std::cout << "Sorry, audio capture is not supported by your system" << std::endl; + return; + } + + // Ask for server address + sf::IPAddress ServerAddress; + do + { + std::cout << "Type address or name of the server to connect to : "; + std::cin >> ServerAddress; + } + while (!ServerAddress.IsValid()); + + // Create a TCP socket for communicating with server + sf::SocketTCP Socket; + + // Connect to the specified server + if (Socket.Connect(Port, ServerAddress) != sf::Socket::Done) + return; + std::cout << "Connected to server " << ServerAddress << std::endl; + + // Wait for user input... + std::cin.ignore(10000, '\n'); + std::cout << "Press enter to start recording audio"; + std::cin.ignore(10000, '\n'); + + // Create a instance of our custom recorder + NetworkRecorder Recorder(Socket); + + // Start capturing audio data + Recorder.Start(44100); + std::cout << "Recording... press enter to stop"; + std::cin.ignore(10000, '\n'); + Recorder.Stop(); + + // Send a "end-of-stream" packet + sf::Packet PacketOut; + PacketOut << EndOfStream; + Socket.Send(PacketOut); + + // Close the socket when we're done + Socket.Close(); +} diff --git a/samples/voip/Makefile b/samples/voip/Makefile new file mode 100644 index 00000000..1adca4ea --- /dev/null +++ b/samples/voip/Makefile @@ -0,0 +1,18 @@ +EXEC = voip +OBJ = VoIP.o Client.o Server.o + +all: $(EXEC) + +voip: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-audio -lsfml-network -lsfml-system + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/voip/Server.cpp b/samples/voip/Server.cpp new file mode 100644 index 00000000..9a55a8ab --- /dev/null +++ b/samples/voip/Server.cpp @@ -0,0 +1,213 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +const sf::Uint8 AudioData = 1; +const sf::Uint8 EndOfStream = 2; + + +//////////////////////////////////////////////////////////// +/// Customized sound stream for acquiring audio data +/// from the network +//////////////////////////////////////////////////////////// +class NetworkAudioStream : public sf::SoundStream +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + NetworkAudioStream() : + myOffset (0), + myHasFinished(false) + { + // Set the sound parameters + Initialize(1, 44100); + } + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~NetworkAudioStream() + { + // Close the sockets + myClient.Close(); + myListener.Close(); + } + + //////////////////////////////////////////////////////////// + /// Run the server, stream audio data from the client + /// + //////////////////////////////////////////////////////////// + void Start(unsigned short Port) + { + if (!myHasFinished) + { + // Listen to the given port for incoming connections + if (!myListener.Listen(Port)) + return; + std::cout << "Server is listening to port " << Port << ", waiting for connections... " << std::endl; + + // Wait for a connection + sf::IPAddress ClientAddress; + myListener.Accept(myClient, &ClientAddress); + std::cout << "Client connected : " << ClientAddress << std::endl; + + // Start playback + Play(); + + // Start receiving audio data + ReceiveLoop(); + } + else + { + // Start playback + Play(); + } + } + +private : + + //////////////////////////////////////////////////////////// + /// /see SoundStream::OnStart + /// + //////////////////////////////////////////////////////////// + virtual bool OnStart() + { + // Reset the playing offset + myOffset = 0; + + return true; + } + + //////////////////////////////////////////////////////////// + /// /see SoundStream::OnGetData + /// + //////////////////////////////////////////////////////////// + virtual bool OnGetData(sf::SoundStream::Chunk& Data) + { + // We have reached the end of the buffer and all audio data have been played : we can stop playback + if ((myOffset == mySamples.size()) && myHasFinished) + return false; + + // No new data has arrived since last update : wait until we get some + while ((myOffset == mySamples.size()) && !myHasFinished) + sf::Sleep(0.01f); + + // Copy samples into a local buffer to avoid synchronization problems + // (don't forget that we run in two separate threads) + { + sf::Lock Lock(myMutex); + myTempBuffer.assign(mySamples.begin() + myOffset, mySamples.end()); + } + + // Fill audio data to pass to the stream + Data.Samples = &myTempBuffer[0]; + Data.NbSamples = myTempBuffer.size(); + + // Update the playing offset + myOffset += myTempBuffer.size(); + + return true; + } + + //////////////////////////////////////////////////////////// + /// Get audio data from the client until playback is stopped + /// + //////////////////////////////////////////////////////////// + void ReceiveLoop() + { + while (!myHasFinished) + { + // Get waiting audio data from the network + sf::Packet PacketIn; + if (myClient.Receive(PacketIn) != sf::Socket::Done) + break; + + // Extract the message ID + sf::Uint8 Id; + PacketIn >> Id; + + if (Id == AudioData) + { + // Extract audio samples from the packet, and append it to our samples buffer + const sf::Int16* Samples = reinterpret_cast(PacketIn.GetData() + 1); + std::size_t NbSamples = (PacketIn.GetDataSize() - 1) / sizeof(sf::Int16); + + // Don't forget that the other thread can access the samples array at any time + // (so we protect any operation on it with the mutex) + { + sf::Lock Lock(myMutex); + std::copy(Samples, Samples + NbSamples, std::back_inserter(mySamples)); + } + } + else if (Id == EndOfStream) + { + // End of stream reached : we stop receiving audio data + std::cout << "Audio data has been 100% received !" << std::endl; + myHasFinished = true; + } + else + { + // Something's wrong... + std::cout << "Invalid packet received..." << std::endl; + myHasFinished = true; + } + } + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + sf::SocketTCP myListener; + sf::SocketTCP myClient; + sf::Mutex myMutex; + std::vector mySamples; + std::vector myTempBuffer; + std::size_t myOffset; + bool myHasFinished; +}; + + +//////////////////////////////////////////////////////////// +/// Launch a server and wait for incoming audio data from +/// a connected client +/// +//////////////////////////////////////////////////////////// +void DoServer(unsigned short Port) +{ + // Build an audio stream to play sound data as it is received through the network + NetworkAudioStream AudioStream; + AudioStream.Start(Port); + + // Loop until the sound playback is finished + while (AudioStream.GetStatus() != sf::SoundStream::Stopped) + { + // Leave some CPU time for other threads + sf::Sleep(0.1f); + } + + std::cin.ignore(10000, '\n'); + + // Wait until the user presses 'enter' key + std::cout << "Press enter to replay the sound..." << std::endl; + std::cin.ignore(10000, '\n'); + + // Replay the sound (just to make sure replaying the received data is OK) + AudioStream.Play(); + + // Loop until the sound playback is finished + while (AudioStream.GetStatus() != sf::SoundStream::Stopped) + { + // Leave some CPU time for other threads + sf::Sleep(0.1f); + } +} diff --git a/samples/voip/VoIP.cpp b/samples/voip/VoIP.cpp new file mode 100644 index 00000000..09360b67 --- /dev/null +++ b/samples/voip/VoIP.cpp @@ -0,0 +1,49 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +// Function prototypes +// (I'm too lazy to put them into separate headers...) +//////////////////////////////////////////////////////////// +void DoClient(unsigned short Port); +void DoServer(unsigned short Port); + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Choose a random port for opening sockets (ports < 1024 are reserved) + const unsigned short Port = 2435; + + // Client or server ? + char Who; + std::cout << "Do you want to be a server ('s') or a client ('c') ? "; + std::cin >> Who; + + if (Who == 's') + { + // Run as a server + DoServer(Port); + } + else + { + // Run as a client + DoClient(Port); + } + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/samples/win32/Win32.cpp b/samples/win32/Win32.cpp new file mode 100644 index 00000000..872012fa --- /dev/null +++ b/samples/win32/Win32.cpp @@ -0,0 +1,126 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + +HWND Button; + + +//////////////////////////////////////////////////////////// +/// Function called whenever one of our windows receives a message +/// +//////////////////////////////////////////////////////////// +LRESULT CALLBACK OnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam) +{ + switch (Message) + { + // Quit when we close the main window + case WM_CLOSE : + { + PostQuitMessage(0); + return 0; + } + + // Quit when we click the "quit" button + case WM_COMMAND : + { + if (reinterpret_cast(LParam) == Button) + { + PostQuitMessage(0); + return 0; + } + } + } + + return DefWindowProc(Handle, Message, WParam, LParam); +} + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \param Instance : Instance of the application +/// +/// \return Error code +/// +//////////////////////////////////////////////////////////// +INT WINAPI WinMain(HINSTANCE Instance, HINSTANCE, LPSTR, INT) +{ + // Define a class for our main window + WNDCLASS WindowClass; + WindowClass.style = 0; + WindowClass.lpfnWndProc = &OnEvent; + WindowClass.cbClsExtra = 0; + WindowClass.cbWndExtra = 0; + WindowClass.hInstance = Instance; + WindowClass.hIcon = NULL; + WindowClass.hCursor = 0; + WindowClass.hbrBackground = reinterpret_cast(COLOR_BACKGROUND); + WindowClass.lpszMenuName = NULL; + WindowClass.lpszClassName = TEXT("SFML App"); + RegisterClass(&WindowClass); + + // Let's create the main window + HWND Window = CreateWindow(TEXT("SFML App"), TEXT("SFML Win32"), WS_SYSMENU | WS_VISIBLE, 200, 200, 660, 520, NULL, NULL, Instance, NULL); + + // Add a button for exiting + Button = CreateWindow(TEXT("BUTTON"), TEXT("Quit"), WS_CHILD | WS_VISIBLE, 560, 440, 80, 40, Window, NULL, Instance, NULL); + + // Let's create two SFML views + HWND View1 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 20, 20, 300, 400, Window, NULL, Instance, NULL); + HWND View2 = CreateWindow(TEXT("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 340, 20, 300, 400, Window, NULL, Instance, NULL); + sf::RenderWindow SFMLView1(View1); + sf::RenderWindow SFMLView2(View2); + + // Load some images to display + sf::Image Image1, Image2; + if (!Image1.LoadFromFile("datas/win32/image1.jpg") || !Image2.LoadFromFile("datas/win32/image2.jpg")) + return EXIT_FAILURE; + sf::Sprite Sprite1(Image1); + sf::Sprite Sprite2(Image2); + Sprite1.SetCenter(Sprite1.GetSize() / 2.f); + + // Create a clock for measuring elapsed time + sf::Clock Clock; + + // Loop until a WM_QUIT message is received + MSG Message; + Message.message = static_cast(~WM_QUIT); + while (Message.message != WM_QUIT) + { + if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE)) + { + // If a message was waiting in the message queue, process it + TranslateMessage(&Message); + DispatchMessage(&Message); + } + else + { + // Clear views + SFMLView1.Clear(); + SFMLView2.Clear(); + + // Draw sprite 1 on view 1 + Sprite1.SetRotation(Clock.GetElapsedTime() * 100); + SFMLView1.Draw(Sprite1); + + // Draw sprite 2 on view 2 + Sprite2.SetX(cos(Clock.GetElapsedTime()) * 100); + SFMLView2.Draw(Sprite2); + + // Display each view on screen + SFMLView1.Display(); + SFMLView2.Display(); + } + } + + // Destroy the main window (all its child controls will be destroyed) + DestroyWindow(Window); + + // Don't forget to unregister the window class + UnregisterClass(TEXT("SFML App"), Instance); + + return EXIT_SUCCESS; +} diff --git a/samples/window/Makefile b/samples/window/Makefile new file mode 100644 index 00000000..6aa0abc2 --- /dev/null +++ b/samples/window/Makefile @@ -0,0 +1,18 @@ +EXEC = window +OBJ = Window.o + +all: $(EXEC) + +window: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-window -lsfml-system -lGLU + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/window/Window.cpp b/samples/window/Window.cpp new file mode 100644 index 00000000..0f457413 --- /dev/null +++ b/samples/window/Window.cpp @@ -0,0 +1,118 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Create the main window + sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window"); + + // Create a clock for measuring the time elapsed + sf::Clock Clock; + + // Set the color and depth clear values + glClearDepth(1.f); + glClearColor(0.f, 0.f, 0.f, 0.f); + + // Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + + // Setup a perspective projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(90.f, 1.f, 1.f, 500.f); + + // Start the game loop + while (App.IsOpened()) + { + // Process events + sf::Event Event; + while (App.GetEvent(Event)) + { + // Close window : exit + if (Event.Type == sf::Event::Closed) + App.Close(); + + // Escape key : exit + if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) + App.Close(); + + // Resize event : adjust viewport + if (Event.Type == sf::Event::Resized) + glViewport(0, 0, Event.Size.Width, Event.Size.Height); + } + + // Set the active window before using OpenGL commands + // It's useless here because the active window is always the same, + // but don't forget it if you use multiple windows + App.SetActive(); + + // Clear color and depth buffer + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // Apply some transformations + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.f, 0.f, -200.f); + glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f); + glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f); + glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f); + + // Draw a cube + glBegin(GL_QUADS); + + glColor3f(1.f, 0.f, 0.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, -50.f); + glVertex3f( 50.f, -50.f, -50.f); + + glColor3f(1.f, 0.f, 0.f); + glVertex3f(-50.f, -50.f, 50.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f( 50.f, 50.f, 50.f); + glVertex3f( 50.f, -50.f, 50.f); + + glColor3f(0.f, 1.f, 0.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f(-50.f, -50.f, 50.f); + + glColor3f(0.f, 1.f, 0.f); + glVertex3f(50.f, -50.f, -50.f); + glVertex3f(50.f, 50.f, -50.f); + glVertex3f(50.f, 50.f, 50.f); + glVertex3f(50.f, -50.f, 50.f); + + glColor3f(0.f, 0.f, 1.f); + glVertex3f(-50.f, -50.f, 50.f); + glVertex3f(-50.f, -50.f, -50.f); + glVertex3f( 50.f, -50.f, -50.f); + glVertex3f( 50.f, -50.f, 50.f); + + glColor3f(0.f, 0.f, 1.f); + glVertex3f(-50.f, 50.f, 50.f); + glVertex3f(-50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, -50.f); + glVertex3f( 50.f, 50.f, 50.f); + + glEnd(); + + // Finally, display the rendered frame on screen + App.Display(); + } + + return EXIT_SUCCESS; +} diff --git a/samples/wxwidgets/Main.cpp b/samples/wxwidgets/Main.cpp new file mode 100644 index 00000000..dddc7ed8 --- /dev/null +++ b/samples/wxwidgets/Main.cpp @@ -0,0 +1,116 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "wxSFMLCanvas.hpp" +#include + + +//////////////////////////////////////////////////////////// +/// Custom SFML canvas +//////////////////////////////////////////////////////////// +class MyCanvas : public wxSFMLCanvas +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the canvas + /// + //////////////////////////////////////////////////////////// + MyCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style = 0) : + wxSFMLCanvas(Parent, Id, Position, Size, Style) + { + // Load an image and assign it to our sprite + myImage.LoadFromFile("datas/wxwidgets/sfml.png"); + mySprite.SetImage(myImage); + mySprite.SetCenter(mySprite.GetSize() / 2.f); + + // Catch the mouse move event + Connect(wxEVT_MOTION, wxMouseEventHandler(MyCanvas::OnMouseMove)); + } + +private : + + //////////////////////////////////////////////////////////// + /// /see wxSFMLCanvas::OnUpdate + /// + //////////////////////////////////////////////////////////// + virtual void OnUpdate() + { + // Rotate the sprite + if (GetInput().IsMouseButtonDown(sf::Mouse::Left)) mySprite.Rotate( GetFrameTime() * 50); + if (GetInput().IsMouseButtonDown(sf::Mouse::Right)) mySprite.Rotate(-GetFrameTime() * 50); + + // Clear the view + Clear(sf::Color(0, 128, 128)); + + // Display the sprite in the view + Draw(mySprite); + } + + //////////////////////////////////////////////////////////// + /// Function called when the mouse cursor moves + /// + //////////////////////////////////////////////////////////// + void OnMouseMove(wxMouseEvent& Event) + { + // Make the sprite follow the mouse cursor + mySprite.SetX(Event.GetX()); + mySprite.SetY(Event.GetY()); + } + + //////////////////////////////////////////////////////////// + /// Member data + //////////////////////////////////////////////////////////// + sf::Image myImage; ///< Some image to load... + sf::Sprite mySprite; ///< Something to draw... +}; + + +//////////////////////////////////////////////////////////// +/// Our main window +//////////////////////////////////////////////////////////// +class MyFrame : public wxFrame +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor : setup the window + /// + //////////////////////////////////////////////////////////// + MyFrame() : + wxFrame(NULL, wxID_ANY, wxT("SFML wxWidgets"), wxDefaultPosition, wxSize(680, 280)) + { + // Error log text box + wxTextCtrl* ErrorLog = new wxTextCtrl(this, wxID_ANY, wxT(""), wxPoint(440, 20), wxSize(200, 200), wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL); + std::cerr.rdbuf(ErrorLog); + std::cerr << "-- This is the error log --" << std::endl; + + // Let's create a SFML view + new MyCanvas(this, wxID_ANY, wxPoint(20, 20), wxSize(400, 200)); + } +}; + + +//////////////////////////////////////////////////////////// +/// Our application class +//////////////////////////////////////////////////////////// +class MyApplication : public wxApp +{ +private : + + //////////////////////////////////////////////////////////// + /// Initialize the application + /// + //////////////////////////////////////////////////////////// + virtual bool OnInit() + { + // Create the main window + MyFrame* MainFrame = new MyFrame; + MainFrame->Show(); + + return true; + } +}; + +IMPLEMENT_APP(MyApplication); diff --git a/samples/wxwidgets/Makefile b/samples/wxwidgets/Makefile new file mode 100644 index 00000000..e6586ec8 --- /dev/null +++ b/samples/wxwidgets/Makefile @@ -0,0 +1,18 @@ +EXEC = wxwidgets +OBJ = Main.o wxSFMLCanvas.o + +all: $(EXEC) + +wxwidgets: $(OBJ) + $(CC) $(LDFLAGS) -o $(EXECPATH)/$@ $(OBJ) -lsfml-graphics -lsfml-window -lsfml-system `wx-config --libs` `pkg-config --libs gtk+-2.0` + +%.o: %.cpp + $(CC) -o $@ -c $< $(CFLAGS) -I/usr/include/gtk-2.0 `wx-config --cppflags` `pkg-config --cflags gtk+-2.0` + +.PHONY: clean mrproper + +clean: + @rm -rf *.o + +mrproper: clean + @rm -rf $(EXECPATH)/$(EXEC) diff --git a/samples/wxwidgets/wxSFMLCanvas.cpp b/samples/wxwidgets/wxSFMLCanvas.cpp new file mode 100644 index 00000000..915b9f15 --- /dev/null +++ b/samples/wxwidgets/wxSFMLCanvas.cpp @@ -0,0 +1,105 @@ + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "wxSFMLCanvas.hpp" + +// Platform-specific includes +#ifdef __WXGTK__ + #include + #include + #include +#endif + + +//////////////////////////////////////////////////////////// +// Event table +//////////////////////////////////////////////////////////// +BEGIN_EVENT_TABLE(wxSFMLCanvas, wxControl) + EVT_IDLE(wxSFMLCanvas::OnIdle) + EVT_PAINT(wxSFMLCanvas::OnPaint) + EVT_ERASE_BACKGROUND(wxSFMLCanvas::OnEraseBackground) +END_EVENT_TABLE() + + +//////////////////////////////////////////////////////////// +/// Construct the wxSFMLCanvas +//////////////////////////////////////////////////////////// +wxSFMLCanvas::wxSFMLCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style) : +wxControl(Parent, Id, Position, Size, Style) +{ + #ifdef __WXGTK__ + + // GTK implementation requires to go deeper to find the low-level X11 identifier of the widget + gtk_widget_realize(m_wxwindow); + gtk_widget_set_double_buffered(m_wxwindow, false); + GdkWindow* Win = GTK_PIZZA(m_wxwindow)->bin_window; + XFlush(GDK_WINDOW_XDISPLAY(Win)); + sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win)); + + #else + + // Tested under Windows XP only (should work with X11 and other Windows versions - no idea about MacOS) + sf::RenderWindow::Create(GetHandle()); + + #endif +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +wxSFMLCanvas::~wxSFMLCanvas() +{ + // Nothing to do... +} + + +//////////////////////////////////////////////////////////// +/// Notification for the derived class that moment is good +/// for doing its update and drawing stuff +//////////////////////////////////////////////////////////// +void wxSFMLCanvas::OnUpdate() +{ + // Nothing to do by default... +} + + +//////////////////////////////////////////////////////////// +/// Called when the control is idle - we can refresh our +/// SFML window +//////////////////////////////////////////////////////////// +void wxSFMLCanvas::OnIdle(wxIdleEvent&) +{ + // Send a paint message when the control is idle, to ensure maximum framerate + Refresh(); +} + + +//////////////////////////////////////////////////////////// +/// Called when the control is repainted - we can display our +/// SFML window +//////////////////////////////////////////////////////////// +void wxSFMLCanvas::OnPaint(wxPaintEvent&) +{ + // Make sure the control is able to be repainted + wxPaintDC Dc(this); + + // Let the derived class do its specific stuff + OnUpdate(); + + // Display on screen + Display(); +} + + +//////////////////////////////////////////////////////////// +/// Called when the control needs to draw its background +//////////////////////////////////////////////////////////// +void wxSFMLCanvas::OnEraseBackground(wxEraseEvent&) +{ + // Don't do anything. We intercept this event in order to prevent the + // parent class to draw the background before repainting the window, + // which would cause some flickering +} diff --git a/samples/wxwidgets/wxSFMLCanvas.hpp b/samples/wxwidgets/wxSFMLCanvas.hpp new file mode 100644 index 00000000..d73e6145 --- /dev/null +++ b/samples/wxwidgets/wxSFMLCanvas.hpp @@ -0,0 +1,70 @@ + +#ifndef WXSFMLCANVAS_HPP +#define WXSFMLCANVAS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// wxSFMLCanvas allows to run SFML in a wxWidgets control +//////////////////////////////////////////////////////////// +class wxSFMLCanvas : public wxControl, public sf::RenderWindow +{ +public : + + //////////////////////////////////////////////////////////// + /// Construct the wxSFMLCanvas + /// + /// \param Parent : Parent of the control (NULL by default) + /// \param Id : Identifier of the control (-1 by default) + /// \param Position : Position of the control (wxDefaultPosition by default) + /// \param Size : Size of the control (wxDefaultSize by default) + /// \param Style : Style of the control (0 by default) + /// + //////////////////////////////////////////////////////////// + wxSFMLCanvas(wxWindow* Parent = NULL, wxWindowID Id = -1, const wxPoint& Position = wxDefaultPosition, const wxSize& Size = wxDefaultSize, long Style = 0); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~wxSFMLCanvas(); + +private : + + DECLARE_EVENT_TABLE() + + //////////////////////////////////////////////////////////// + /// Notification for the derived class that moment is good + /// for doing its update and drawing stuff + /// + //////////////////////////////////////////////////////////// + virtual void OnUpdate(); + + //////////////////////////////////////////////////////////// + /// Called when the window is idle - we can refresh our + /// SFML window + /// + //////////////////////////////////////////////////////////// + void OnIdle(wxIdleEvent&); + + //////////////////////////////////////////////////////////// + /// Called when the window is repainted - we can display our + /// SFML window + /// + //////////////////////////////////////////////////////////// + void OnPaint(wxPaintEvent&); + + //////////////////////////////////////////////////////////// + /// Called when the window needs to draw its background + /// + //////////////////////////////////////////////////////////// + void OnEraseBackground(wxEraseEvent&); +}; + + +#endif // WXSFMLCANVAS_HPP diff --git a/src/SFML/Audio/AudioDevice.cpp b/src/SFML/Audio/AudioDevice.cpp new file mode 100644 index 00000000..3049f7f0 --- /dev/null +++ b/src/SFML/Audio/AudioDevice.cpp @@ -0,0 +1,170 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +AudioDevice* AudioDevice::ourInstance; + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +AudioDevice::AudioDevice() : +myRefCount(0) +{ + // Create the device + myDevice = alcOpenDevice(NULL); + + if (myDevice) + { + // Create the context + myContext = alcCreateContext(myDevice, NULL); + + if (myContext) + { + // Set the context as the current one (we'll only need one) + alcMakeContextCurrent(myContext); + + // Initialize the listener, located at the origin and looking along the Z axis + Listener::SetPosition(0.f, 0.f, 0.f); + Listener::SetTarget(0.f, 0.f, -1.f); + } + else + { + std::cerr << "Failed to create the audio context" << std::endl; + } + } + else + { + std::cerr << "Failed to open the audio device" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +AudioDevice::~AudioDevice() +{ + // Destroy the context + alcMakeContextCurrent(NULL); + if (myContext) + alcDestroyContext(myContext); + + // Destroy the device + if (myDevice) + alcCloseDevice(myDevice); +} + + +//////////////////////////////////////////////////////////// +/// Get the unique instance of the class +//////////////////////////////////////////////////////////// +AudioDevice& AudioDevice::GetInstance() +{ + // Create the audio device if it doesn't exist + if (!ourInstance) + ourInstance = new AudioDevice; + + return *ourInstance; +} + + +//////////////////////////////////////////////////////////// +/// Add a reference to the audio device +//////////////////////////////////////////////////////////// +void AudioDevice::AddReference() +{ + // Create the audio device if it doesn't exist + if (!ourInstance) + ourInstance = new AudioDevice; + + // Increase the references count + ourInstance->myRefCount++; +} + + +//////////////////////////////////////////////////////////// +/// Remove a reference to the audio device +//////////////////////////////////////////////////////////// +void AudioDevice::RemoveReference() +{ + // Decrease the references count + ourInstance->myRefCount--; + + // Destroy the audio device if the references count reaches 0 + if (ourInstance->myRefCount == 0) + { + delete ourInstance; + ourInstance = NULL; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the OpenAL audio device +//////////////////////////////////////////////////////////// +ALCdevice* AudioDevice::GetDevice() const +{ + return myDevice; +} + + +//////////////////////////////////////////////////////////// +/// Get the OpenAL format that matches the given number of channels +//////////////////////////////////////////////////////////// +ALenum AudioDevice::GetFormatFromChannelsCount(unsigned int ChannelsCount) const +{ + // Find the good format according to the number of channels + switch (ChannelsCount) + { + case 1 : return AL_FORMAT_MONO16; + case 2 : return AL_FORMAT_STEREO16; + case 4 : return alGetEnumValue("AL_FORMAT_QUAD16"); + case 6 : return alGetEnumValue("AL_FORMAT_51CHN16"); + case 7 : return alGetEnumValue("AL_FORMAT_61CHN16"); + case 8 : return alGetEnumValue("AL_FORMAT_71CHN16"); + } + + return 0; +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Audio/AudioDevice.hpp b/src/SFML/Audio/AudioDevice.hpp new file mode 100644 index 00000000..1d71a372 --- /dev/null +++ b/src/SFML/Audio/AudioDevice.hpp @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIODEVICE_HPP +#define SFML_AUDIODEVICE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class AudioResource; + +namespace priv +{ + +//////////////////////////////////////////////////////////// +/// AudioDevice is the high-level wrapper around the audio API, +/// it manages creation and destruction of the audio device and context +/// and stores the device capabilities +//////////////////////////////////////////////////////////// +class AudioDevice +{ +public : + + //////////////////////////////////////////////////////////// + /// Get the unique instance of the class + /// + /// \return Unique instance of the class + /// + //////////////////////////////////////////////////////////// + static AudioDevice& GetInstance(); + + //////////////////////////////////////////////////////////// + /// Add a reference to the audio device + /// + //////////////////////////////////////////////////////////// + static void AddReference(); + + //////////////////////////////////////////////////////////// + /// Remove a reference to the audio device + /// + //////////////////////////////////////////////////////////// + static void RemoveReference(); + + //////////////////////////////////////////////////////////// + /// Get the OpenAL audio device + /// + /// \return OpenAL device (cannot be NULL) + /// + //////////////////////////////////////////////////////////// + ALCdevice* GetDevice() const; + + //////////////////////////////////////////////////////////// + /// Get the OpenAL format that matches the given number of channels + /// + /// \param ChannelsCount : Number of channels + /// + /// \return OpenAL device (cannot be NULL) + /// + //////////////////////////////////////////////////////////// + ALenum GetFormatFromChannelsCount(unsigned int ChannelsCount) const; + +private : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + AudioDevice(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~AudioDevice(); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static AudioDevice* ourInstance; ///< Unique instance of the audio device + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + ALCdevice* myDevice; ///< Audio device + ALCcontext* myContext; ///< Audio context + unsigned int myRefCount; ///< References count +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_AUDIODEVICE_HPP diff --git a/src/SFML/Audio/AudioResource.cpp b/src/SFML/Audio/AudioResource.cpp new file mode 100644 index 00000000..28e94753 --- /dev/null +++ b/src/SFML/Audio/AudioResource.cpp @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +AudioResource::AudioResource() +{ + priv::AudioDevice::AddReference(); +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +AudioResource::AudioResource(const AudioResource&) +{ + priv::AudioDevice::AddReference(); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +AudioResource::~AudioResource() +{ + priv::AudioDevice::RemoveReference(); +} + +} // namespace sf diff --git a/src/SFML/Audio/Listener.cpp b/src/SFML/Audio/Listener.cpp new file mode 100644 index 00000000..1dd9a318 --- /dev/null +++ b/src/SFML/Audio/Listener.cpp @@ -0,0 +1,118 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Change the global volume of all the sounds +//////////////////////////////////////////////////////////// +void Listener::SetGlobalVolume(float Volume) +{ + ALCheck(alListenerf(AL_GAIN, Volume * 0.01f)); +} + + +//////////////////////////////////////////////////////////// +/// Get the current value of the global volume of all the sounds +//////////////////////////////////////////////////////////// +float Listener::GetGlobalVolume() +{ + float Volume = 0.f; + ALCheck(alGetListenerf(AL_GAIN, &Volume)); + + return Volume; +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the listener (take 3 values) +//////////////////////////////////////////////////////////// +void Listener::SetPosition(float X, float Y, float Z) +{ + ALCheck(alListener3f(AL_POSITION, X, Y, Z)); +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the listener (take a 3D vector) +//////////////////////////////////////////////////////////// +void Listener::SetPosition(const Vector3f& Position) +{ + SetPosition(Position.x, Position.y, Position.z); +} + + +//////////////////////////////////////////////////////////// +/// Get the current position of the listener +//////////////////////////////////////////////////////////// +Vector3f Listener::GetPosition() +{ + Vector3f Position; + ALCheck(alGetListener3f(AL_POSITION, &Position.x, &Position.y, &Position.z)); + + return Position; +} + + +//////////////////////////////////////////////////////////// +/// Change the orientation of the listener (the point +/// he must look at) (take 3 values) +//////////////////////////////////////////////////////////// +void Listener::SetTarget(float X, float Y, float Z) +{ + float Orientation[] = {X, Y, Z, 0.f, 1.f, 0.f}; + ALCheck(alListenerfv(AL_ORIENTATION, Orientation)); +} + + +//////////////////////////////////////////////////////////// +/// Change the orientation of the listener (the point +/// he must look at) (take a 3D vector) +//////////////////////////////////////////////////////////// +void Listener::SetTarget(const Vector3f& Target) +{ + SetTarget(Target.x, Target.y, Target.z); +} + + +//////////////////////////////////////////////////////////// +/// Get the current orientation of the listener (the point +/// he's looking at) +//////////////////////////////////////////////////////////// +Vector3f Listener::GetTarget() +{ + float Orientation[6]; + ALCheck(alGetListenerfv(AL_ORIENTATION, Orientation)); + + return Vector3f(Orientation[0], Orientation[1], Orientation[2]); +} + +} // namespace sf diff --git a/src/SFML/Audio/Makefile b/src/SFML/Audio/Makefile new file mode 100644 index 00000000..109a00ad --- /dev/null +++ b/src/SFML/Audio/Makefile @@ -0,0 +1,39 @@ +SRC = $(wildcard *.cpp) +SRCVORBIS = $(wildcard ./stb_vorbis/*.c) +OBJ = $(SRC:.cpp=.o) +OBJVORBIS = $(SRCVORBIS:.c=.o) + +ifeq ($(STATIC), yes) + LIB = libsfml-audio-s.a + LIBNAME = $(LIBPATH)/$(LIB) + INSTALL = +else + LIB = libsfml-audio.so + LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + INSTALL = && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) +endif + +all: $(LIB) + +libsfml-audio-s.a: $(OBJ) $(OBJVORBIS) + $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) $(OBJVORBIS) + +libsfml-audio.so: $(OBJ) $(OBJVORBIS) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) $(OBJVORBIS) -lsndfile -lopenal + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +$(OBJVORBIS): %.o: %.c + $(CC) -o $@ -c $< $(CFLAGSEXT) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) $(OBJVORBIS) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp new file mode 100644 index 00000000..a4d9d765 --- /dev/null +++ b/src/SFML/Audio/Music.cpp @@ -0,0 +1,137 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Construct the music with a buffer size +//////////////////////////////////////////////////////////// +Music::Music(std::size_t BufferSize) : +myFile (NULL), +myDuration(0.f), +mySamples (BufferSize) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Music::~Music() +{ + delete myFile; +} + + +//////////////////////////////////////////////////////////// +/// Open a music file (doesn't play it -- call Play() for that) +//////////////////////////////////////////////////////////// +bool Music::OpenFromFile(const std::string& Filename) +{ + // Create the sound file implementation, and open it in read mode + delete myFile; + myFile = priv::SoundFile::CreateRead(Filename); + if (!myFile) + { + std::cerr << "Failed to open \"" << Filename << "\" for reading" << std::endl; + return false; + } + + // Compute the duration + myDuration = static_cast(myFile->GetSamplesCount()) / myFile->GetSampleRate() / myFile->GetChannelsCount(); + + // Initialize the stream + Initialize(myFile->GetChannelsCount(), myFile->GetSampleRate()); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Open a music file from memory (doesn't play it -- call Play() for that) +//////////////////////////////////////////////////////////// +bool Music::OpenFromMemory(const char* Data, std::size_t SizeInBytes) +{ + // Create the sound file implementation, and open it in read mode + delete myFile; + myFile = priv::SoundFile::CreateRead(Data, SizeInBytes); + if (!myFile) + { + std::cerr << "Failed to open music from memory for reading" << std::endl; + return false; + } + + // Compute the duration + myDuration = static_cast(myFile->GetSamplesCount()) / myFile->GetSampleRate(); + + // Initialize the stream + Initialize(myFile->GetChannelsCount(), myFile->GetSampleRate()); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// /see SoundStream::OnStart +//////////////////////////////////////////////////////////// +bool Music::OnStart() +{ + return myFile->Restart(); +} + + +//////////////////////////////////////////////////////////// +/// /see SoundStream::OnGetData +//////////////////////////////////////////////////////////// +bool Music::OnGetData(SoundStream::Chunk& Data) +{ + // Fill the chunk parameters + Data.Samples = &mySamples[0]; + Data.NbSamples = myFile->Read(&mySamples[0], mySamples.size()); + + // Check if we have reached the end of the audio file + return Data.NbSamples == mySamples.size(); +} + + +//////////////////////////////////////////////////////////// +/// Get the sound duration +//////////////////////////////////////////////////////////// +float Music::GetDuration() const +{ + return myDuration; +} + +} // namespace sf diff --git a/src/SFML/Audio/OpenAL.hpp b/src/SFML/Audio/OpenAL.hpp new file mode 100644 index 00000000..e6ab6d41 --- /dev/null +++ b/src/SFML/Audio/OpenAL.hpp @@ -0,0 +1,132 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_OPENAL_HPP +#define SFML_OPENAL_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +#if defined(SFML_SYSTEM_MACOS) +#include +#include +#else +#include +#include +#endif + +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Let's define a macro to quickly check every OpenAL +/// API calls +/// +//////////////////////////////////////////////////////////// +#ifdef SFML_DEBUG + + // If in debug mode, perform a test on every call + #define ALCheck(Func) ((Func), priv::ALCheckError(__FILE__, __LINE__)) + +#else + + // Else, we don't add any overhead + #define ALCheck(Func) (Func) + +#endif + + +//////////////////////////////////////////////////////////// +/// Check last OpenAL error +/// +//////////////////////////////////////////////////////////// +inline void ALCheckError(const std::string& File, unsigned int Line) +{ + // Get the last error + ALenum ErrorCode = alGetError(); + + if (ErrorCode != AL_NO_ERROR) + { + std::string Error, Desc; + + // Decode the error code + switch (ErrorCode) + { + case AL_INVALID_NAME : + { + Error = "AL_INVALID_NAME"; + Desc = "an unacceptable name has been specified"; + break; + } + + case AL_INVALID_ENUM : + { + Error = "AL_INVALID_ENUM"; + Desc = "an unacceptable value has been specified for an enumerated argument"; + break; + } + + case AL_INVALID_VALUE : + { + Error = "AL_INVALID_VALUE"; + Desc = "a numeric argument is out of range"; + break; + } + + case AL_INVALID_OPERATION : + { + Error = "AL_INVALID_OPERATION"; + Desc = "the specified operation is not allowed in the current state"; + break; + } + + case AL_OUT_OF_MEMORY : + { + Error = "AL_OUT_OF_MEMORY"; + Desc = "there is not enough memory left to execute the command"; + break; + } + } + + // Log the error + std::cerr << "An internal OpenAL call failed in " + << File.substr(File.find_last_of("\\/") + 1) << " (" << Line << ") : " + << Error << ", " << Desc + << std::endl; + } +} + +} // namespace priv + +} // namespace sf + + +#endif // SFML_OPENAL_HPP diff --git a/src/SFML/Audio/Sound.cpp b/src/SFML/Audio/Sound.cpp new file mode 100644 index 00000000..01d792b8 --- /dev/null +++ b/src/SFML/Audio/Sound.cpp @@ -0,0 +1,335 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Sound::Sound() +{ + ALCheck(alGenSources(1, &mySource)); + ALCheck(alSourcei(mySource, AL_BUFFER, 0)); +} + + +//////////////////////////////////////////////////////////// +/// Construct the sound from its parameters +//////////////////////////////////////////////////////////// +Sound::Sound(const SoundBuffer& Buffer, bool Loop, float Pitch, float Volume, const Vector3f& Position) : +myBuffer(&Buffer) +{ + ALCheck(alGenSources(1, &mySource)); + + ALCheck(alSourcei (mySource, AL_BUFFER, Buffer.myBuffer)); + ALCheck(alSourcei (mySource, AL_LOOPING, Loop)); + ALCheck(alSourcef (mySource, AL_PITCH, Pitch)); + ALCheck(alSourcef (mySource, AL_GAIN, Volume * 0.01f)); + ALCheck(alSource3f(mySource, AL_POSITION, Position.x, Position.y, Position.z)); +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +Sound::Sound(const Sound& Copy) : +AudioResource(Copy), +myBuffer (Copy.myBuffer) +{ + ALCheck(alGenSources(1, &mySource)); + + ALCheck(alSourcei (mySource, AL_BUFFER, myBuffer ? myBuffer->myBuffer : 0)); + ALCheck(alSourcei (mySource, AL_LOOPING, Copy.GetLoop())); + ALCheck(alSourcef (mySource, AL_PITCH, Copy.GetPitch())); + ALCheck(alSourcef (mySource, AL_GAIN, Copy.GetVolume() * 0.01f)); + ALCheck(alSource3f(mySource, AL_POSITION, Copy.GetPosition().x, Copy.GetPosition().y, Copy.GetPosition().z)); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Sound::~Sound() +{ + if (mySource) + { + if (myBuffer) + { + Stop(); + ALCheck(alSourcei(mySource, AL_BUFFER, 0)); + } + ALCheck(alDeleteSources(1, &mySource)); + } +} + + +//////////////////////////////////////////////////////////// +/// Play the sound +//////////////////////////////////////////////////////////// +void Sound::Play() +{ + ALCheck(alSourcePlay(mySource)); +} + + +//////////////////////////////////////////////////////////// +/// Pause the sound +//////////////////////////////////////////////////////////// +void Sound::Pause() +{ + ALCheck(alSourcePause(mySource)); +} + + +//////////////////////////////////////////////////////////// +/// Stop the sound +//////////////////////////////////////////////////////////// +void Sound::Stop() +{ + ALCheck(alSourceStop(mySource)); +} + + +//////////////////////////////////////////////////////////// +/// Set the source buffer +//////////////////////////////////////////////////////////// +void Sound::SetBuffer(const SoundBuffer& Buffer) +{ + myBuffer = &Buffer; + ALCheck(alSourcei(mySource, AL_BUFFER, myBuffer ? myBuffer->myBuffer : 0)); +} + + +//////////////////////////////////////////////////////////// +/// Set the sound loop state +//////////////////////////////////////////////////////////// +void Sound::SetLoop(bool Loop) +{ + ALCheck(alSourcei(mySource, AL_LOOPING, Loop)); +} + + +//////////////////////////////////////////////////////////// +/// Set the sound pitch +//////////////////////////////////////////////////////////// +void Sound::SetPitch(float Pitch) +{ + ALCheck(alSourcef(mySource, AL_PITCH, Pitch)); +} + + +//////////////////////////////////////////////////////////// +/// Set the sound volume +//////////////////////////////////////////////////////////// +void Sound::SetVolume(float Volume) +{ + ALCheck(alSourcef(mySource, AL_GAIN, Volume * 0.01f)); +} + +//////////////////////////////////////////////////////////// +/// Set the sound position (take 3 values). +/// The default position is (0, 0, 0) +//////////////////////////////////////////////////////////// +void Sound::SetPosition(float X, float Y, float Z) +{ + ALCheck(alSource3f(mySource, AL_POSITION, X, Y, Z)); +} + + +//////////////////////////////////////////////////////////// +/// Set the sound position (take a 3D vector). +/// The default position is (0, 0, 0) +//////////////////////////////////////////////////////////// +void Sound::SetPosition(const Vector3f& Position) +{ + SetPosition(Position.x, Position.y, Position.z); +} + + +//////////////////////////////////////////////////////////// +/// Set the minimum distance - closer than this distance, +/// the listener will hear the sound at its maximum volume. +/// The default minimum distance is 1.0 +//////////////////////////////////////////////////////////// +void Sound::SetMinDistance(float MinDistance) +{ + ALCheck(alSourcef(mySource, AL_REFERENCE_DISTANCE, MinDistance)); +} + + +//////////////////////////////////////////////////////////// +/// Set the attenuation factor - the higher the attenuation, the +/// more the sound will be attenuated with distance from listener. +/// The default attenuation factor 1.0 +//////////////////////////////////////////////////////////// +void Sound::SetAttenuation(float Attenuation) +{ + ALCheck(alSourcef(mySource, AL_ROLLOFF_FACTOR, Attenuation)); +} + + +//////////////////////////////////////////////////////////// +/// Set the current playing position of the sound +//////////////////////////////////////////////////////////// +void Sound::SetPlayingOffset(float TimeOffset) +{ + ALCheck(alSourcef(mySource, AL_SEC_OFFSET, TimeOffset)); +} + + +//////////////////////////////////////////////////////////// +/// Get the source buffer +//////////////////////////////////////////////////////////// +const SoundBuffer* Sound::GetBuffer() const +{ + return myBuffer; +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the sound is looping +//////////////////////////////////////////////////////////// +bool Sound::GetLoop() const +{ + ALint Loop; + ALCheck(alGetSourcei(mySource, AL_LOOPING, &Loop)); + + return Loop != 0; +} + + +//////////////////////////////////////////////////////////// +/// Get the pitch +//////////////////////////////////////////////////////////// +float Sound::GetPitch() const +{ + ALfloat Pitch; + ALCheck(alGetSourcef(mySource, AL_PITCH, &Pitch)); + + return Pitch; +} + + +//////////////////////////////////////////////////////////// +/// Get the volume +//////////////////////////////////////////////////////////// +float Sound::GetVolume() const +{ + ALfloat Gain; + ALCheck(alGetSourcef(mySource, AL_GAIN, &Gain)); + + return Gain * 100.f; +} + + +//////////////////////////////////////////////////////////// +/// Get the sound position +//////////////////////////////////////////////////////////// +Vector3f Sound::GetPosition() const +{ + Vector3f Position; + ALCheck(alGetSource3f(mySource, AL_POSITION, &Position.x, &Position.y, &Position.z)); + + return Position; +} + + +//////////////////////////////////////////////////////////// +/// Get the minimum distance +//////////////////////////////////////////////////////////// +float Sound::GetMinDistance() const +{ + ALfloat MinDistance; + ALCheck(alGetSourcef(mySource, AL_REFERENCE_DISTANCE, &MinDistance)); + + return MinDistance; +} + + +//////////////////////////////////////////////////////////// +/// Get the attenuation factor +//////////////////////////////////////////////////////////// +float Sound::GetAttenuation() const +{ + ALfloat Attenuation; + ALCheck(alGetSourcef(mySource, AL_ROLLOFF_FACTOR, &Attenuation)); + + return Attenuation; +} + + +//////////////////////////////////////////////////////////// +/// Get the current playing position of the sound +//////////////////////////////////////////////////////////// +float Sound::GetPlayingOffset() const +{ + ALfloat Seconds = 0.f; + ALCheck(alGetSourcef(mySource, AL_SEC_OFFSET, &Seconds)); + + return Seconds; +} + + +//////////////////////////////////////////////////////////// +/// Get the status of the sound (stopped, paused, playing) +//////////////////////////////////////////////////////////// +Sound::Status Sound::GetStatus() const +{ + ALint State; + ALCheck(alGetSourcei(mySource, AL_SOURCE_STATE, &State)); + + switch (State) + { + case AL_INITIAL : + case AL_STOPPED : return Stopped; + case AL_PAUSED : return Paused; + case AL_PLAYING : return Playing; + } + + return Stopped; +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator +//////////////////////////////////////////////////////////// +Sound& Sound::operator =(const Sound& Other) +{ + Sound Temp(Other); + + std::swap(mySource, Temp.mySource); + std::swap(myBuffer, Temp.myBuffer); + + return *this; +} + +} // namespace sf diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp new file mode 100644 index 00000000..136b3387 --- /dev/null +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -0,0 +1,308 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SoundBuffer::SoundBuffer() : +myBuffer (0), +myDuration(0.f) +{ + // Create the buffer + ALCheck(alGenBuffers(1, &myBuffer)); +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +SoundBuffer::SoundBuffer(const SoundBuffer& Copy) : +AudioResource (Copy), +Resource(Copy), +myBuffer (0), +mySamples (Copy.mySamples), +myDuration (Copy.myDuration) +{ + // Create the buffer + ALCheck(alGenBuffers(1, &myBuffer)); + + // Update the internal buffer with the new samples + Update(Copy.GetChannelsCount(), Copy.GetSampleRate()); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +SoundBuffer::~SoundBuffer() +{ + if (myBuffer) + ALCheck(alDeleteBuffers(1, &myBuffer)); +} + + +//////////////////////////////////////////////////////////// +/// Load the sound buffer from a file +//////////////////////////////////////////////////////////// +bool SoundBuffer::LoadFromFile(const std::string& Filename) +{ + // Create the sound file + std::auto_ptr File(priv::SoundFile::CreateRead(Filename)); + + // Open the sound file + if (File.get()) + { + // Get the sound parameters + std::size_t NbSamples = File->GetSamplesCount(); + unsigned int ChannelsCount = File->GetChannelsCount(); + unsigned int SampleRate = File->GetSampleRate(); + + // Read the samples from the opened file + mySamples.resize(NbSamples); + if (File->Read(&mySamples[0], NbSamples) == NbSamples) + { + // Update the internal buffer with the new samples + return Update(ChannelsCount, SampleRate); + } + else + { + // Error... + std::cerr << "Failed to read audio data from file \"" << Filename << "\"" << std::endl; + + return false; + } + } + else + { + // Error... + std::cerr << "Failed to load sound buffer from file \"" << Filename << "\"" << std::endl; + + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Load the sound buffer from a file in memory +//////////////////////////////////////////////////////////// +bool SoundBuffer::LoadFromMemory(const char* Data, std::size_t SizeInBytes) +{ + // Create the sound file + std::auto_ptr File(priv::SoundFile::CreateRead(Data, SizeInBytes)); + + // Open the sound file + if (File.get()) + { + // Get the sound parameters + std::size_t NbSamples = File->GetSamplesCount(); + unsigned int ChannelsCount = File->GetChannelsCount(); + unsigned int SampleRate = File->GetSampleRate(); + + // Read the samples from the opened file + mySamples.resize(NbSamples); + if (File->Read(&mySamples[0], NbSamples) == NbSamples) + { + // Update the internal buffer with the new samples + return Update(ChannelsCount, SampleRate); + } + else + { + // Error... + std::cerr << "Failed to read audio data from file in memory" << std::endl; + + return false; + } + } + else + { + // Error... + std::cerr << "Failed to load sound buffer from file in memory" << std::endl; + + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Load the sound buffer from an array of samples - assumed format for +/// samples is 16 bits signed integer +//////////////////////////////////////////////////////////// +bool SoundBuffer::LoadFromSamples(const Int16* Samples, std::size_t SamplesCount, unsigned int ChannelsCount, unsigned int SampleRate) +{ + if (Samples && SamplesCount && ChannelsCount && SampleRate) + { + // Copy the new audio samples + mySamples.assign(Samples, Samples + SamplesCount); + + // Update the internal buffer with the new samples + return Update(ChannelsCount, SampleRate); + } + else + { + // Error... + std::cerr << "Failed to load sound buffer from memory (" + << "Samples : " << Samples << ", " + << "Samples count : " << SamplesCount << ", " + << "Channels count : " << ChannelsCount << ", " + << "Sample rate : " << SampleRate << ")" + << std::endl; + + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Save the sound buffer to a file +//////////////////////////////////////////////////////////// +bool SoundBuffer::SaveToFile(const std::string& Filename) const +{ + // Create the sound file in write mode + std::auto_ptr File(priv::SoundFile::CreateWrite(Filename, GetChannelsCount(), GetSampleRate())); + if (File.get()) + { + // Write the samples to the opened file + File->Write(&mySamples[0], mySamples.size()); + + return true; + } + else + { + // Error... + std::cerr << "Failed to save sound buffer to file \"" << Filename << "\"" << std::endl; + + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Return the sound samples +//////////////////////////////////////////////////////////// +const Int16* SoundBuffer::GetSamples() const +{ + return mySamples.empty() ? NULL : &mySamples[0]; +} + + +//////////////////////////////////////////////////////////// +/// Return the samples count +//////////////////////////////////////////////////////////// +std::size_t SoundBuffer::GetSamplesCount() const +{ + return mySamples.size(); +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate +//////////////////////////////////////////////////////////// +unsigned int SoundBuffer::GetSampleRate() const +{ + ALint SampleRate; + ALCheck(alGetBufferi(myBuffer, AL_FREQUENCY, &SampleRate)); + + return SampleRate; +} + + +//////////////////////////////////////////////////////////// +/// Return the number of channels (1 = mono, 2 = stereo, ...) +//////////////////////////////////////////////////////////// +unsigned int SoundBuffer::GetChannelsCount() const +{ + ALint ChannelsCount; + ALCheck(alGetBufferi(myBuffer, AL_CHANNELS, &ChannelsCount)); + + return ChannelsCount; +} + + +//////////////////////////////////////////////////////////// +/// Get the sound duration +//////////////////////////////////////////////////////////// +float SoundBuffer::GetDuration() const +{ + return myDuration; +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator +//////////////////////////////////////////////////////////// +SoundBuffer& SoundBuffer::operator =(const SoundBuffer& Other) +{ + SoundBuffer Temp(Other); + + mySamples.swap(Temp.mySamples); + std::swap(myBuffer, Temp.myBuffer); + std::swap(myDuration, Temp.myDuration); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Update the internal buffer with the audio samples +//////////////////////////////////////////////////////////// +bool SoundBuffer::Update(unsigned int ChannelsCount, unsigned int SampleRate) +{ + // Check parameters + if (!SampleRate || !ChannelsCount || mySamples.empty()) + return false; + + // Find the good format according to the number of channels + ALenum Format = priv::AudioDevice::GetInstance().GetFormatFromChannelsCount(ChannelsCount); + + // Check if the format is valid + if (Format == 0) + { + std::cerr << "Unsupported number of channels (" << ChannelsCount << ")" << std::endl; + return false; + } + + // Fill the buffer + ALsizei Size = static_cast(mySamples.size()) * sizeof(Int16); + ALCheck(alBufferData(myBuffer, Format, &mySamples[0], Size, SampleRate)); + + // Compute the duration + myDuration = static_cast(mySamples.size()) / SampleRate / ChannelsCount; + + return true; +} + +} // namespace sf diff --git a/src/SFML/Audio/SoundBufferRecorder.cpp b/src/SFML/Audio/SoundBufferRecorder.cpp new file mode 100644 index 00000000..78859fd8 --- /dev/null +++ b/src/SFML/Audio/SoundBufferRecorder.cpp @@ -0,0 +1,75 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// /see SoundBuffer::OnStart +//////////////////////////////////////////////////////////// +bool SoundBufferRecorder::OnStart() +{ + mySamples.clear(); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// /see SoundBuffer::OnProcessSamples +//////////////////////////////////////////////////////////// +bool SoundBufferRecorder::OnProcessSamples(const Int16* Samples, std::size_t SamplesCount) +{ + std::copy(Samples, Samples + SamplesCount, std::back_inserter(mySamples)); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// /see SoundBuffer::OnStop +//////////////////////////////////////////////////////////// +void SoundBufferRecorder::OnStop() +{ + if (!mySamples.empty()) + myBuffer.LoadFromSamples(&mySamples[0], mySamples.size(), 1, GetSampleRate()); +} + + +//////////////////////////////////////////////////////////// +/// Get the sound buffer containing the captured audio data +//////////////////////////////////////////////////////////// +const SoundBuffer& SoundBufferRecorder::GetBuffer() const +{ + return myBuffer; +} + +} // namespace sf diff --git a/src/SFML/Audio/SoundFile.cpp b/src/SFML/Audio/SoundFile.cpp new file mode 100644 index 00000000..78ac35bc --- /dev/null +++ b/src/SFML/Audio/SoundFile.cpp @@ -0,0 +1,271 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Create a new sound from a file, for reading +//////////////////////////////////////////////////////////// +SoundFile* SoundFile::CreateRead(const std::string& Filename) +{ + // Create the file according to its type + SoundFile* File = NULL; + if (SoundFileOgg::IsFileSupported(Filename, true)) File = new SoundFileOgg; + else if (SoundFileDefault::IsFileSupported(Filename, true)) File = new SoundFileDefault; + + // Open it for reading + if (File) + { + std::size_t SamplesCount; + unsigned int ChannelsCount; + unsigned int SampleRate; + + if (File->OpenRead(Filename, SamplesCount, ChannelsCount, SampleRate)) + { + File->myFilename = Filename; + File->myData = NULL; + File->mySize = 0; + File->myNbSamples = SamplesCount; + File->myChannelsCount = ChannelsCount; + File->mySampleRate = SampleRate; + } + else + { + delete File; + File = NULL; + } + } + + return File; +} + + +//////////////////////////////////////////////////////////// +/// Create a new sound from a file in memory, for reading +//////////////////////////////////////////////////////////// +SoundFile* SoundFile::CreateRead(const char* Data, std::size_t SizeInMemory) +{ + // Create the file according to its type + SoundFile* File = NULL; + if (SoundFileOgg::IsFileSupported(Data, SizeInMemory)) File = new SoundFileOgg; + else if (SoundFileDefault::IsFileSupported(Data, SizeInMemory)) File = new SoundFileDefault; + + // Open it for reading + if (File) + { + std::size_t SamplesCount; + unsigned int ChannelsCount; + unsigned int SampleRate; + + if (File->OpenRead(Data, SizeInMemory, SamplesCount, ChannelsCount, SampleRate)) + { + File->myFilename = ""; + File->myData = Data; + File->mySize = SizeInMemory; + File->myNbSamples = SamplesCount; + File->myChannelsCount = ChannelsCount; + File->mySampleRate = SampleRate; + } + else + { + delete File; + File = NULL; + } + } + + return File; +} + + +//////////////////////////////////////////////////////////// +/// Create a new sound from a file, for writing +//////////////////////////////////////////////////////////// +SoundFile* SoundFile::CreateWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate) +{ + // Create the file according to its type + SoundFile* File = NULL; + if (SoundFileOgg::IsFileSupported(Filename, false)) File = new SoundFileOgg; + else if (SoundFileDefault::IsFileSupported(Filename, false)) File = new SoundFileDefault; + + // Open it for writing + if (File) + { + if (File->OpenWrite(Filename, ChannelsCount, SampleRate)) + { + File->myFilename = ""; + File->myData = NULL; + File->mySize = 0; + File->myNbSamples = 0; + File->myChannelsCount = ChannelsCount; + File->mySampleRate = SampleRate; + } + else + { + delete File; + File = NULL; + } + } + + return File; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SoundFile::SoundFile() : +myNbSamples (0), +myChannelsCount(0), +mySampleRate (0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +SoundFile::~SoundFile() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Get the total number of samples in the file +//////////////////////////////////////////////////////////// +std::size_t SoundFile::GetSamplesCount() const +{ + return myNbSamples; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of channels used by the sound +//////////////////////////////////////////////////////////// +unsigned int SoundFile::GetChannelsCount() const +{ + return myChannelsCount; +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate of the sound +//////////////////////////////////////////////////////////// +unsigned int SoundFile::GetSampleRate() const +{ + return mySampleRate; +} + + +//////////////////////////////////////////////////////////// +/// Restart the sound from the beginning +//////////////////////////////////////////////////////////// +bool SoundFile::Restart() +{ + if (myData) + { + // Reopen from memory + return OpenRead(myData, mySize, myNbSamples, myChannelsCount, mySampleRate); + } + else if (myFilename != "") + { + // Reopen from file + return OpenRead(myFilename, myNbSamples, myChannelsCount, mySampleRate); + } + else + { + // Trying to reopen a file opened in write mode... error + std::cerr << "Warning : trying to restart a sound opened in write mode, which is not allowed" << std::endl; + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Open the sound file for reading +//////////////////////////////////////////////////////////// +bool SoundFile::OpenRead(const std::string& Filename, std::size_t&, unsigned int&, unsigned int&) +{ + std::cerr << "Failed to open sound file \"" << Filename << "\", format is not supported by SFML" << std::endl; + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Open the sound file in memory for reading +//////////////////////////////////////////////////////////// +bool SoundFile::OpenRead(const char*, std::size_t, std::size_t&, unsigned int&, unsigned int&) +{ + std::cerr << "Failed to open sound file from memory, format is not supported by SFML" << std::endl; + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Open the sound file for writing +//////////////////////////////////////////////////////////// +bool SoundFile::OpenWrite(const std::string& Filename, unsigned int, unsigned int) +{ + std::cerr << "Failed to open sound file \"" << Filename << "\", format is not supported by SFML" << std::endl; + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Read samples from the loaded sound +//////////////////////////////////////////////////////////// +std::size_t SoundFile::Read(Int16*, std::size_t) +{ + std::cerr << "Failed to read from sound file (not supported)" << std::endl; + + return 0; +} + + +//////////////////////////////////////////////////////////// +/// Write samples to the file +//////////////////////////////////////////////////////////// +void SoundFile::Write(const Int16*, std::size_t) +{ + std::cerr << "Failed to write to sound file (not supported)" << std::endl; +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Audio/SoundFile.hpp b/src/SFML/Audio/SoundFile.hpp new file mode 100644 index 00000000..6ad68cbf --- /dev/null +++ b/src/SFML/Audio/SoundFile.hpp @@ -0,0 +1,209 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDFILE_HPP +#define SFML_SOUNDFILE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// SoundFile is the abstract base class for loading +/// and saving different sound file formats +//////////////////////////////////////////////////////////// +class SoundFile : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Create a new sound from a file, for reading + /// + /// \param Filename : Path of sound file + /// \param NbSamples : Number of samples in the file + /// \param ChannelsCount : Number of channels in the loaded sound + /// \param SampleRate : Sample rate of the loaded sound + /// + /// \return Pointer to the new sound file (NULL if failed) + /// + //////////////////////////////////////////////////////////// + static SoundFile* CreateRead(const std::string& Filename); + + //////////////////////////////////////////////////////////// + /// Create a new sound from a file in memory, for reading + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// \param NbSamples : Number of samples in the file + /// \param ChannelsCount : Number of channels in the loaded sound + /// \param SampleRate : Sample rate of the loaded sound + /// + /// \return Pointer to the new sound file (NULL if failed) + /// + //////////////////////////////////////////////////////////// + static SoundFile* CreateRead(const char* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// Create a new sound from a file, for writing + /// + /// \param Filename : Path of sound file + /// \param ChannelsCount : Number of channels in the sound + /// \param SampleRate : Sample rate of the sound + /// + /// \return Pointer to the new sound file (NULL if failed) + /// + //////////////////////////////////////////////////////////// + static SoundFile* CreateWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate); + + //////////////////////////////////////////////////////////// + /// Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundFile(); + + //////////////////////////////////////////////////////////// + /// Get the total number of samples in the file + /// + /// \return Number of samples + /// + //////////////////////////////////////////////////////////// + std::size_t GetSamplesCount() const; + + //////////////////////////////////////////////////////////// + /// Get the number of channels used by the sound + /// + /// \return Number of channels (1 = mono, 2 = stereo) + /// + //////////////////////////////////////////////////////////// + unsigned int GetChannelsCount() const; + + //////////////////////////////////////////////////////////// + /// Get the sample rate of the sound + /// + /// \return Sample rate, in samples / sec + /// + //////////////////////////////////////////////////////////// + unsigned int GetSampleRate() const; + + //////////////////////////////////////////////////////////// + /// Restart the sound from the beginning + /// + /// \return True if restart was successful + /// + //////////////////////////////////////////////////////////// + bool Restart(); + + //////////////////////////////////////////////////////////// + /// Read samples from the loaded sound + /// + /// \param Data : Pointer to the samples array to fill + /// \param NbSamples : Number of samples to read + /// + /// \return Number of samples read + /// + //////////////////////////////////////////////////////////// + virtual std::size_t Read(Int16* Data, std::size_t NbSamples); + + //////////////////////////////////////////////////////////// + /// Write samples to the file + /// + /// \param Data : Pointer to the samples array to write + /// \param NbSamples : Number of samples to write + /// + //////////////////////////////////////////////////////////// + virtual void Write(const Int16* Data, std::size_t NbSamples); + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SoundFile(); + +private : + + //////////////////////////////////////////////////////////// + /// Open the sound file for reading + /// + /// \param Filename : Path of sound file to load + /// \param NbSamples : Number of samples in the file + /// \param ChannelsCount : Number of channels in the loaded sound + /// \param SampleRate : Sample rate of the loaded sound + /// + /// \return True if the file was successfully opened + /// + //////////////////////////////////////////////////////////// + virtual bool OpenRead(const std::string& Filename, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate); + + //////////////////////////////////////////////////////////// + /// Open the sound file in memory for reading + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// \param NbSamples : Number of samples in the file + /// \param ChannelsCount : Number of channels in the loaded sound + /// \param SampleRate : Sample rate of the loaded sound + /// + /// \return True if the file was successfully opened + /// + //////////////////////////////////////////////////////////// + virtual bool OpenRead(const char* Data, std::size_t SizeInBytes, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate); + + //////////////////////////////////////////////////////////// + /// Open the sound file for writing + /// + /// \param Filename : Path of sound file to write + /// \param ChannelsCount : Number of channels in the sound + /// \param SampleRate : Sample rate of the sound + /// + /// \return True if the file was successfully opened + /// + //////////////////////////////////////////////////////////// + virtual bool OpenWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::size_t myNbSamples; ///< Total number of samples in the file + unsigned int myChannelsCount; ///< Number of channels used by the sound + unsigned int mySampleRate; ///< Number of samples per second + std::string myFilename; ///< Path of the file (valid if loaded from a file) + const char* myData; ///< Pointer to the file in memory (valid if loaded from memory) + std::size_t mySize; ///< Size of the file in memory (valid if loaded from memory) +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_SOUNDFILE_HPP diff --git a/src/SFML/Audio/SoundFileDefault.cpp b/src/SFML/Audio/SoundFileDefault.cpp new file mode 100644 index 00000000..b1b4b7c4 --- /dev/null +++ b/src/SFML/Audio/SoundFileDefault.cpp @@ -0,0 +1,352 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SoundFileDefault::SoundFileDefault() : +myFile(NULL) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +SoundFileDefault::~SoundFileDefault() +{ + if (myFile) + sf_close(myFile); +} + + +//////////////////////////////////////////////////////////// +/// Check if a given file is supported by this loader +//////////////////////////////////////////////////////////// +bool SoundFileDefault::IsFileSupported(const std::string& Filename, bool Read) +{ + if (Read) + { + // Open the sound file + SF_INFO FileInfos; + SNDFILE* File = sf_open(Filename.c_str(), SFM_READ, &FileInfos); + + if (File) + { + sf_close(File); + return true; + } + else + { + return false; + } + } + else + { + // Check the extension + return GetFormatFromFilename(Filename) != -1; + } +} + + +//////////////////////////////////////////////////////////// +/// Check if a given file in memory is supported by this loader +//////////////////////////////////////////////////////////// +bool SoundFileDefault::IsFileSupported(const char* Data, std::size_t SizeInBytes) +{ + // Define the I/O custom functions for reading from memory + SF_VIRTUAL_IO VirtualIO; + VirtualIO.get_filelen = &SoundFileDefault::MemoryGetLength; + VirtualIO.read = &SoundFileDefault::MemoryRead; + VirtualIO.seek = &SoundFileDefault::MemorySeek; + VirtualIO.tell = &SoundFileDefault::MemoryTell; + VirtualIO.write = &SoundFileDefault::MemoryWrite; + + // Initialize the memory data + MemoryInfos Memory; + Memory.DataStart = Data; + Memory.DataPtr = Data; + Memory.TotalSize = SizeInBytes; + + // Open the sound file + SF_INFO FileInfos; + SNDFILE* File = sf_open_virtual(&VirtualIO, SFM_READ, &FileInfos, &Memory); + + if (File) + { + sf_close(File); + return true; + } + else + { + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Open the sound file for reading +//////////////////////////////////////////////////////////// +bool SoundFileDefault::OpenRead(const std::string& Filename, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate) +{ + // If the file is already opened, first close it + if (myFile) + sf_close(myFile); + + // Open the sound file + SF_INFO FileInfos; + myFile = sf_open(Filename.c_str(), SFM_READ, &FileInfos); + if (!myFile) + { + std::cerr << "Failed to read sound file \"" << Filename << "\"" << std::endl; + return false; + } + + // Set the sound parameters + ChannelsCount = FileInfos.channels; + SampleRate = FileInfos.samplerate; + NbSamples = static_cast(FileInfos.frames) * ChannelsCount; + + return true; +} + + +//////////////////////////////////////////////////////////// +/// /see sf::SoundFile::OpenRead +//////////////////////////////////////////////////////////// +bool SoundFileDefault::OpenRead(const char* Data, std::size_t SizeInBytes, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate) +{ + // If the file is already opened, first close it + if (myFile) + sf_close(myFile); + + // Define the I/O custom functions for reading from memory + SF_VIRTUAL_IO VirtualIO; + VirtualIO.get_filelen = &SoundFileDefault::MemoryGetLength; + VirtualIO.read = &SoundFileDefault::MemoryRead; + VirtualIO.seek = &SoundFileDefault::MemorySeek; + VirtualIO.tell = &SoundFileDefault::MemoryTell; + VirtualIO.write = &SoundFileDefault::MemoryWrite; + + // Initialize the memory data + myMemory.DataStart = Data; + myMemory.DataPtr = Data; + myMemory.TotalSize = SizeInBytes; + + // Open the sound file + SF_INFO FileInfos; + myFile = sf_open_virtual(&VirtualIO, SFM_READ, &FileInfos, &myMemory); + if (!myFile) + { + std::cerr << "Failed to read sound file from memory" << std::endl; + return false; + } + + // Set the sound parameters + ChannelsCount = FileInfos.channels; + SampleRate = FileInfos.samplerate; + NbSamples = static_cast(FileInfos.frames) * ChannelsCount; + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Open the sound file for writing +//////////////////////////////////////////////////////////// +bool SoundFileDefault::OpenWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate) +{ + // If the file is already opened, first close it + if (myFile) + sf_close(myFile); + + // Find the right format according to the file extension + int Format = GetFormatFromFilename(Filename); + if (Format == -1) + { + // Error : unrecognized extension + std::cerr << "Failed to create sound file \"" << Filename << "\" : unknown format" << std::endl; + return false; + } + + // Fill the sound infos with parameters + SF_INFO FileInfos; + FileInfos.channels = ChannelsCount; + FileInfos.samplerate = SampleRate; + FileInfos.format = Format | SF_FORMAT_PCM_16; + + // Open the sound file for writing + myFile = sf_open(Filename.c_str(), SFM_WRITE, &FileInfos); + if (!myFile) + { + std::cerr << "Failed to create sound file \"" << Filename << "\"" << std::endl; + return false; + } + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Read samples from the loaded sound +//////////////////////////////////////////////////////////// +std::size_t SoundFileDefault::Read(Int16* Data, std::size_t NbSamples) +{ + if (myFile && Data && NbSamples) + return static_cast(sf_read_short(myFile, Data, NbSamples)); + else + return 0; +} + + +//////////////////////////////////////////////////////////// +/// Write samples to the file +//////////////////////////////////////////////////////////// +void SoundFileDefault::Write(const Int16* Data, std::size_t NbSamples) +{ + if (myFile && Data && NbSamples) + sf_write_short(myFile, Data, NbSamples); +} + + +//////////////////////////////////////////////////////////// +/// Get the internal format of an audio file according to +/// its filename extension +//////////////////////////////////////////////////////////// +int SoundFileDefault::GetFormatFromFilename(const std::string& Filename) +{ + // Extract the extension + std::string Ext = "wav"; + std::string::size_type Pos = Filename.find_last_of("."); + if (Pos != std::string::npos) + Ext = Filename.substr(Pos + 1); + + // Match every supported extension with its format constant + if (Ext == "wav" || Ext == "WAV" ) return SF_FORMAT_WAV; + if (Ext == "aif" || Ext == "AIF" ) return SF_FORMAT_AIFF; + if (Ext == "aiff" || Ext == "AIFF") return SF_FORMAT_AIFF; + if (Ext == "au" || Ext == "AU" ) return SF_FORMAT_AU; + if (Ext == "raw" || Ext == "RAW" ) return SF_FORMAT_RAW; + if (Ext == "paf" || Ext == "PAF" ) return SF_FORMAT_PAF; + if (Ext == "svx" || Ext == "SVX" ) return SF_FORMAT_SVX; + if (Ext == "voc" || Ext == "VOC" ) return SF_FORMAT_VOC; + if (Ext == "sf" || Ext == "SF" ) return SF_FORMAT_IRCAM; + if (Ext == "w64" || Ext == "W64" ) return SF_FORMAT_W64; + if (Ext == "mat4" || Ext == "MAT4") return SF_FORMAT_MAT4; + if (Ext == "mat5" || Ext == "MAT5") return SF_FORMAT_MAT5; + if (Ext == "pvf" || Ext == "PVF" ) return SF_FORMAT_PVF; + if (Ext == "htk" || Ext == "HTK" ) return SF_FORMAT_HTK; + if (Ext == "caf" || Ext == "CAF" ) return SF_FORMAT_CAF; + if (Ext == "nist" || Ext == "NIST") return SF_FORMAT_NIST; // SUPPORTED ? + if (Ext == "sds" || Ext == "SDS" ) return SF_FORMAT_SDS; // SUPPORTED ? + if (Ext == "avr" || Ext == "AVR" ) return SF_FORMAT_AVR; // SUPPORTED ? + if (Ext == "sd2" || Ext == "SD2" ) return SF_FORMAT_SD2; // SUPPORTED ? + if (Ext == "flac" || Ext == "FLAC") return SF_FORMAT_FLAC; // SUPPORTED ? + + return -1; +} + + +//////////////////////////////////////////////////////////// +/// Functions for implementing custom read and write to memory files +/// +//////////////////////////////////////////////////////////// +sf_count_t SoundFileDefault::MemoryGetLength(void* UserData) +{ + MemoryInfos* Memory = static_cast(UserData); + + return Memory->TotalSize; +} +sf_count_t SoundFileDefault::MemoryRead(void* Ptr, sf_count_t Count, void* UserData) +{ + MemoryInfos* Memory = static_cast(UserData); + + sf_count_t Position = Memory->DataPtr - Memory->DataStart; + if (Position + Count >= Memory->TotalSize) + Count = Memory->TotalSize - Position; + + memcpy(Ptr, Memory->DataPtr, static_cast(Count)); + + Memory->DataPtr += Count; + + return Count; +} +sf_count_t SoundFileDefault::MemorySeek(sf_count_t Offset, int Whence, void* UserData) +{ + MemoryInfos* Memory = static_cast(UserData); + + sf_count_t Position = 0; + switch (Whence) + { + case SEEK_SET : + Position = Offset; + break; + case SEEK_CUR : + Position = Memory->DataPtr - Memory->DataStart + Offset; + break; + case SEEK_END : + Position = Memory->TotalSize - Offset; + break; + default : + Position = 0; + break; + } + + if (Position >= Memory->TotalSize) + Position = Memory->TotalSize - 1; + else if (Position < 0) + Position = 0; + + Memory->DataPtr = Memory->DataStart + Position; + + return Position; +} +sf_count_t SoundFileDefault::MemoryTell(void* UserData) +{ + MemoryInfos* Memory = static_cast(UserData); + + return Memory->DataPtr - Memory->DataStart; +} +sf_count_t SoundFileDefault::MemoryWrite(const void*, sf_count_t, void*) +{ + return 0; +} + + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Audio/SoundFileDefault.hpp b/src/SFML/Audio/SoundFileDefault.hpp new file mode 100644 index 00000000..cc4a5670 --- /dev/null +++ b/src/SFML/Audio/SoundFileDefault.hpp @@ -0,0 +1,156 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDFILEDEFAULT_HPP +#define SFML_SOUNDFILEDEFAULT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Specialization of SoundFile that can handle a lot of +/// sound formats (see libsndfile homepage for a complete list) +//////////////////////////////////////////////////////////// +class SoundFileDefault : public SoundFile +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SoundFileDefault(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~SoundFileDefault(); + + //////////////////////////////////////////////////////////// + /// Check if a given file is supported by this loader + /// + /// \param Filename : Path of the file to check + /// \param Read : Is the file opened for reading or writing ? + /// + /// \param return True if the loader can handle this file + /// + //////////////////////////////////////////////////////////// + static bool IsFileSupported(const std::string& Filename, bool Read); + + //////////////////////////////////////////////////////////// + /// Check if a given file in memory is supported by this loader + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// + /// \param return True if the loader can handle this file + /// + //////////////////////////////////////////////////////////// + static bool IsFileSupported(const char* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::Read + /// + //////////////////////////////////////////////////////////// + virtual std::size_t Read(Int16* Data, std::size_t NbSamples); + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::Write + /// + //////////////////////////////////////////////////////////// + virtual void Write(const Int16* Data, std::size_t NbSamples); + +private : + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::OpenRead + /// + //////////////////////////////////////////////////////////// + virtual bool OpenRead(const std::string& Filename, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate); + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::OpenRead + /// + //////////////////////////////////////////////////////////// + virtual bool OpenRead(const char* Data, std::size_t SizeInBytes, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate); + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::OpenWrite + /// + //////////////////////////////////////////////////////////// + virtual bool OpenWrite(const std::string& Filename, unsigned int ChannelsCount, unsigned int SampleRate); + + //////////////////////////////////////////////////////////// + /// Get the internal format of an audio file according to + /// its filename extension + /// + /// \param Filename : Filename to check + /// + /// \return Internal format matching the filename (-1 if no match) + /// + //////////////////////////////////////////////////////////// + static int GetFormatFromFilename(const std::string& Filename); + + //////////////////////////////////////////////////////////// + /// Functions for implementing custom read and write to memory files + /// + //////////////////////////////////////////////////////////// + static sf_count_t MemoryGetLength(void* UserData); + static sf_count_t MemoryRead(void* Ptr, sf_count_t Count, void* UserData); + static sf_count_t MemorySeek(sf_count_t Offset, int Whence, void* UserData); + static sf_count_t MemoryTell(void* UserData); + static sf_count_t MemoryWrite(const void* Ptr, sf_count_t Count, void* UserData); + + //////////////////////////////////////////////////////////// + /// Structure holding data related to memory operations + //////////////////////////////////////////////////////////// + struct MemoryInfos + { + const char* DataStart; ///< Pointer to the begining of the data + const char* DataPtr; ///< Pointer to the current read / write position + sf_count_t TotalSize; ///< Total size of the data, in bytes + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SNDFILE* myFile; ///< File descriptor + MemoryInfos myMemory; ///< Memory read / write data +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_SOUNDFILEDEFAULT_HPP diff --git a/src/SFML/Audio/SoundFileOgg.cpp b/src/SFML/Audio/SoundFileOgg.cpp new file mode 100644 index 00000000..3bbcef0e --- /dev/null +++ b/src/SFML/Audio/SoundFileOgg.cpp @@ -0,0 +1,182 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SoundFileOgg::SoundFileOgg() : +myStream (NULL), +myChannelsCount(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +SoundFileOgg::~SoundFileOgg() +{ + if (myStream) + stb_vorbis_close(myStream); +} + + +//////////////////////////////////////////////////////////// +/// Check if a given file is supported by this loader +//////////////////////////////////////////////////////////// +bool SoundFileOgg::IsFileSupported(const std::string& Filename, bool Read) +{ + if (Read) + { + // Open the vorbis stream + stb_vorbis* Stream = stb_vorbis_open_filename(const_cast(Filename.c_str()), NULL, NULL); + + if (Stream) + { + stb_vorbis_close(Stream); + return true; + } + else + { + return false; + } + } + else + { + // No support for writing ogg files yet... + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Check if a given file in memory is supported by this loader +//////////////////////////////////////////////////////////// +bool SoundFileOgg::IsFileSupported(const char* Data, std::size_t SizeInBytes) +{ + // Open the vorbis stream + unsigned char* Buffer = reinterpret_cast(const_cast(Data)); + int Length = static_cast(SizeInBytes); + stb_vorbis* Stream = stb_vorbis_open_memory(Buffer, Length, NULL, NULL); + + if (Stream) + { + stb_vorbis_close(Stream); + return true; + } + else + { + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Open the sound file for reading +//////////////////////////////////////////////////////////// +bool SoundFileOgg::OpenRead(const std::string& Filename, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate) +{ + // Close the file if already opened + if (myStream) + stb_vorbis_close(myStream); + + // Open the vorbis stream + myStream = stb_vorbis_open_filename(const_cast(Filename.c_str()), NULL, NULL); + if (myStream == NULL) + { + std::cerr << "Failed to read sound file \"" << Filename << "\" (cannot open the file)" << std::endl; + return false; + } + + // Get the music parameters + stb_vorbis_info Infos = stb_vorbis_get_info(myStream); + ChannelsCount = myChannelsCount = Infos.channels; + SampleRate = Infos.sample_rate; + NbSamples = static_cast(stb_vorbis_stream_length_in_samples(myStream) * ChannelsCount); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// /see sf::SoundFile::OpenRead +//////////////////////////////////////////////////////////// +bool SoundFileOgg::OpenRead(const char* Data, std::size_t SizeInBytes, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate) +{ + // Close the file if already opened + if (myStream) + stb_vorbis_close(myStream); + + // Open the vorbis stream + unsigned char* Buffer = reinterpret_cast(const_cast(Data)); + int Length = static_cast(SizeInBytes); + myStream = stb_vorbis_open_memory(Buffer, Length, NULL, NULL); + if (myStream == NULL) + { + std::cerr << "Failed to read sound file from memory (cannot open the file)" << std::endl; + return false; + } + + // Get the music parameters + stb_vorbis_info Infos = stb_vorbis_get_info(myStream); + ChannelsCount = myChannelsCount = Infos.channels; + SampleRate = Infos.sample_rate; + NbSamples = static_cast(stb_vorbis_stream_length_in_samples(myStream) * ChannelsCount); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Read samples from the loaded sound +//////////////////////////////////////////////////////////// +std::size_t SoundFileOgg::Read(Int16* Data, std::size_t NbSamples) +{ + if (myStream && Data && NbSamples) + { + int Read = stb_vorbis_get_samples_short_interleaved(myStream, myChannelsCount, Data, static_cast(NbSamples)); + return static_cast(Read * myChannelsCount); + } + else + { + return 0; + } +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Audio/SoundFileOgg.hpp b/src/SFML/Audio/SoundFileOgg.hpp new file mode 100644 index 00000000..38cc079a --- /dev/null +++ b/src/SFML/Audio/SoundFileOgg.hpp @@ -0,0 +1,114 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDFILEOGG_HPP +#define SFML_SOUNDFILEOGG_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +struct stb_vorbis; + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Specialization of SoundFile that handles ogg-vorbis files (.ogg) +/// (does not support variable bitrate / channels and writing) +//////////////////////////////////////////////////////////// +class SoundFileOgg : public SoundFile +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + SoundFileOgg(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~SoundFileOgg(); + + //////////////////////////////////////////////////////////// + /// Check if a given file is supported by this loader + /// + /// \param Filename : Path of the file to check + /// \param Read : Is the file opened for reading or writing ? + /// + /// \param return True if the loader can handle this file + /// + //////////////////////////////////////////////////////////// + static bool IsFileSupported(const std::string& Filename, bool Read); + + //////////////////////////////////////////////////////////// + /// Check if a given file in memory is supported by this loader + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// + /// \param return True if the loader can handle this file + /// + //////////////////////////////////////////////////////////// + static bool IsFileSupported(const char* Data, std::size_t SizeInBytes); + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::Read + /// + //////////////////////////////////////////////////////////// + virtual std::size_t Read(Int16* Data, std::size_t NbSamples); + +private : + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::OpenRead + /// + //////////////////////////////////////////////////////////// + virtual bool OpenRead(const std::string& Filename, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate); + + //////////////////////////////////////////////////////////// + /// /see sf::SoundFile::OpenRead + /// + //////////////////////////////////////////////////////////// + virtual bool OpenRead(const char* Data, std::size_t SizeInBytes, std::size_t& NbSamples, unsigned int& ChannelsCount, unsigned int& SampleRate); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + stb_vorbis* myStream; ///< Vorbis stream + unsigned int myChannelsCount; ///< Number of channels (1 = mono, 2 = stereo) +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_SOUNDFILEOGG_HPP diff --git a/src/SFML/Audio/SoundRecorder.cpp b/src/SFML/Audio/SoundRecorder.cpp new file mode 100644 index 00000000..a1a96019 --- /dev/null +++ b/src/SFML/Audio/SoundRecorder.cpp @@ -0,0 +1,226 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +// Private data +//////////////////////////////////////////////////////////// +namespace +{ + ALCdevice* CaptureDevice = NULL; +} + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SoundRecorder::SoundRecorder() : +mySampleRate (0), +myIsCapturing(false) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +SoundRecorder::~SoundRecorder() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Start the capture. +/// Warning : only one capture can happen at the same time +//////////////////////////////////////////////////////////// +void SoundRecorder::Start(unsigned int SampleRate) +{ + // Check if the device can do audio capture + if (!CanCapture()) + { + std::cerr << "Failed to start capture : your system cannot capture audio data (call SoundRecorder::CanCapture to check it)" << std::endl; + return; + } + + // Check that another capture is not already running + if (CaptureDevice) + { + std::cerr << "Trying to start audio capture, but another capture is already running" << std::endl; + return; + } + + // Open the capture device for capturing 16 bits mono samples + CaptureDevice = alcCaptureOpenDevice(NULL, SampleRate, AL_FORMAT_MONO16, SampleRate); + if (!CaptureDevice) + { + std::cerr << "Failed to open the audio capture device" << std::endl; + return; + } + + // Clear the sample array + mySamples.clear(); + + // Store the sample rate + mySampleRate = SampleRate; + + // Notify derived class + if (OnStart()) + { + // Start the capture + alcCaptureStart(CaptureDevice); + + // Start the capture in a new thread, to avoid blocking the main thread + myIsCapturing = true; + Launch(); + } +} + + +//////////////////////////////////////////////////////////// +/// Stop the capture +//////////////////////////////////////////////////////////// +void SoundRecorder::Stop() +{ + // Stop the capturing thread + myIsCapturing = false; + Wait(); +} + + +//////////////////////////////////////////////////////////// +/// Get the sample rate +//////////////////////////////////////////////////////////// +unsigned int SoundRecorder::GetSampleRate() const +{ + return mySampleRate; +} + + +//////////////////////////////////////////////////////////// +/// Tell if the system supports sound capture. +/// If not, this class won't be usable +//////////////////////////////////////////////////////////// +bool SoundRecorder::CanCapture() +{ + ALCdevice* Device = priv::AudioDevice::GetInstance().GetDevice(); + + return alcIsExtensionPresent(Device, "ALC_EXT_CAPTURE") != AL_FALSE; +} + + +//////////////////////////////////////////////////////////// +/// Start recording audio data +//////////////////////////////////////////////////////////// +bool SoundRecorder::OnStart() +{ + // Nothing to do + return true; +} + + +//////////////////////////////////////////////////////////// +/// Stop recording audio data +//////////////////////////////////////////////////////////// +void SoundRecorder::OnStop() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// /see Thread::Run +//////////////////////////////////////////////////////////// +void SoundRecorder::Run() +{ + while (myIsCapturing) + { + // Process available samples + ProcessCapturedSamples(); + + // Don't bother the CPU while waiting for more captured data + Sleep(0.1f); + } + + // Capture is finished : clean up everything + CleanUp(); + + // Notify derived class + OnStop(); +} + + +//////////////////////////////////////////////////////////// +/// Get available captured samples and process them +//////////////////////////////////////////////////////////// +void SoundRecorder::ProcessCapturedSamples() +{ + // Get the number of samples available + ALCint SamplesAvailable; + alcGetIntegerv(CaptureDevice, ALC_CAPTURE_SAMPLES, 1, &SamplesAvailable); + + if (SamplesAvailable > 0) + { + // Get the recorded samples + mySamples.resize(SamplesAvailable); + alcCaptureSamples(CaptureDevice, &mySamples[0], SamplesAvailable); + + // Forward them to the derived class + if (!OnProcessSamples(&mySamples[0], mySamples.size())) + { + // The user wants to stop the capture + myIsCapturing = false; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Clean up recorder internal resources +//////////////////////////////////////////////////////////// +void SoundRecorder::CleanUp() +{ + // Stop the capture + alcCaptureStop(CaptureDevice); + + // Get the samples left in the buffer + ProcessCapturedSamples(); + + // Close the device + alcCaptureCloseDevice(CaptureDevice); + CaptureDevice = NULL; +} + +} // namespace sf diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp new file mode 100644 index 00000000..991a0bca --- /dev/null +++ b/src/SFML/Audio/SoundStream.cpp @@ -0,0 +1,347 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SoundStream::SoundStream() : +myIsStreaming (false), +myChannelsCount (0), +mySampleRate (0), +myFormat (0), +myLoop (false), +mySamplesProcessed(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +SoundStream::~SoundStream() +{ + // Stop the sound if it was playing + Stop(); +} + + +//////////////////////////////////////////////////////////// +/// Set the audio stream parameters, you must call it before Play() +//////////////////////////////////////////////////////////// +void SoundStream::Initialize(unsigned int ChannelsCount, unsigned int SampleRate) +{ + myChannelsCount = ChannelsCount; + mySampleRate = SampleRate; + + // Deduce the format from the number of channels + myFormat = priv::AudioDevice::GetInstance().GetFormatFromChannelsCount(ChannelsCount); + + // Check if the format is valid + if (myFormat == 0) + { + myChannelsCount = 0; + mySampleRate = 0; + std::cerr << "Unsupported number of channels (" << myChannelsCount << ")" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Start playing the audio stream +//////////////////////////////////////////////////////////// +void SoundStream::Play() +{ + // Check if the sound parameters have been set + if (myFormat == 0) + { + std::cerr << "Failed to play audio stream : sound parameters have not been initialized (call Initialize first)" << std::endl; + return; + } + + // If the sound is already playing (probably paused), just resume it + if (myIsStreaming) + { + Sound::Play(); + return; + } + + // Notify the derived class + if (OnStart()) + { + // Start updating the stream in a separate thread to avoid blocking the application + mySamplesProcessed = 0; + myIsStreaming = true; + Launch(); + } +} + + +//////////////////////////////////////////////////////////// +/// Stop playing the audio stream +//////////////////////////////////////////////////////////// +void SoundStream::Stop() +{ + // Wait for the thread to terminate + myIsStreaming = false; + Wait(); +} + + +//////////////////////////////////////////////////////////// +/// Return the number of channels (1 = mono, 2 = stereo, ...) +//////////////////////////////////////////////////////////// +unsigned int SoundStream::GetChannelsCount() const +{ + return myChannelsCount; +} + + +//////////////////////////////////////////////////////////// +/// Get the sound frequency (sample rate) +//////////////////////////////////////////////////////////// +unsigned int SoundStream::GetSampleRate() const +{ + return mySampleRate; +} + + +//////////////////////////////////////////////////////////// +/// Get the status of the sound (stopped, paused, playing) +//////////////////////////////////////////////////////////// +Sound::Status SoundStream::GetStatus() const +{ + Status Status = Sound::GetStatus(); + + // To compensate for the lag between Play() and alSourcePlay() + if ((Status == Stopped) && myIsStreaming) + Status = Playing; + + return Status; +} + + +//////////////////////////////////////////////////////////// +/// Get the current playing position of the stream +/// +/// \return Current playing position, expressed in seconds +/// +//////////////////////////////////////////////////////////// +float SoundStream::GetPlayingOffset() const +{ + return Sound::GetPlayingOffset() + static_cast(mySamplesProcessed) / mySampleRate / myChannelsCount; +} + + +//////////////////////////////////////////////////////////// +/// Set the music loop state +//////////////////////////////////////////////////////////// +void SoundStream::SetLoop(bool Loop) +{ + myLoop = Loop; +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the music is looping +//////////////////////////////////////////////////////////// +bool SoundStream::GetLoop() const +{ + return myLoop; +} + + +//////////////////////////////////////////////////////////// +/// /see Thread::Run +//////////////////////////////////////////////////////////// +void SoundStream::Run() +{ + // Create buffers + ALCheck(alGenBuffers(BuffersCount, myBuffers)); + + // Fill the queue + bool RequestStop = FillQueue(); + + // Play the sound + Sound::Play(); + + while (myIsStreaming) + { + // The stream has been interrupted ! + if (Sound::GetStatus() == Stopped) + { + // User requested to stop + if (RequestStop) + { + if (myLoop) + { + // The stream is in loop mode : restart it + if (OnStart()) + { + mySamplesProcessed = 0; + ClearQueue(); + RequestStop = FillQueue(); + Sound::Play(); + } + else + { + // Restart failed : finish the streaming loop + myIsStreaming = false; + break; + } + } + else + { + // The stream is not in loop mode : finish the streaming loop + myIsStreaming = false; + break; + } + } + else + { + // Streaming is not completed : restart the sound + Sound::Play(); + } + } + + // Get the number of buffers that have been processed (ie. ready for reuse) + ALint NbProcessed; + ALCheck(alGetSourcei(Sound::mySource, AL_BUFFERS_PROCESSED, &NbProcessed)); + + while (NbProcessed-- && !RequestStop) + { + // Pop the first unused buffer from the queue + ALuint Buffer; + ALCheck(alSourceUnqueueBuffers(Sound::mySource, 1, &Buffer)); + + // Retrieve its size and add it to the samples count + ALint Size; + ALCheck(alGetBufferi(Buffer, AL_SIZE, &Size)); + mySamplesProcessed += Size / sizeof(Int16); + + // Fill it and push it back into the playing queue + if (FillAndPushBuffer(Buffer)) + RequestStop = true; + } + + // Leave some time for the other threads if the stream is still playing + if (Sound::GetStatus() != Stopped) + Sleep(0.1f); + } + + // Stop the playback + Sound::Stop(); + + // Unqueue any buffer left in the queue + ClearQueue(); + + // Delete the buffers + ALCheck(alDeleteBuffers(BuffersCount, myBuffers)); +} + + +//////////////////////////////////////////////////////////// +/// Fill a new buffer with audio data, and push it to the +/// playing queue +//////////////////////////////////////////////////////////// +bool SoundStream::FillAndPushBuffer(unsigned int Buffer) +{ + bool RequestStop = false; + + // Acquire audio data + Chunk Data = {NULL, 0}; + if (!OnGetData(Data)) + RequestStop = true; + + // Create and fill the buffer, and push it to the queue + if (Data.Samples && Data.NbSamples) + { + // Fill the buffer + ALsizei Size = static_cast(Data.NbSamples) * sizeof(Int16); + ALCheck(alBufferData(Buffer, myFormat, Data.Samples, Size, mySampleRate)); + + // Push it into the sound queue + ALCheck(alSourceQueueBuffers(Sound::mySource, 1, &Buffer)); + } + + return RequestStop; +} + + +//////////////////////////////////////////////////////////// +/// Fill the buffers queue with all available buffers +//////////////////////////////////////////////////////////// +bool SoundStream::FillQueue() +{ + // Fill and enqueue all the available buffers + bool RequestStop = false; + for (int i = 0; (i < BuffersCount) && !RequestStop; ++i) + { + if (FillAndPushBuffer(myBuffers[i])) + RequestStop = true; + } + + return RequestStop; +} + + +//////////////////////////////////////////////////////////// +/// Clear the queue of any remaining buffers +//////////////////////////////////////////////////////////// +void SoundStream::ClearQueue() +{ + // Get the number of buffers still in the queue + ALint NbQueued; + ALCheck(alGetSourcei(Sound::mySource, AL_BUFFERS_QUEUED, &NbQueued)); + + // Unqueue them all + ALuint Buffer; + for (ALint i = 0; i < NbQueued; ++i) + ALCheck(alSourceUnqueueBuffers(Sound::mySource, 1, &Buffer)); +} + + +//////////////////////////////////////////////////////////// +/// Called when the sound restarts +//////////////////////////////////////////////////////////// +bool SoundStream::OnStart() +{ + // Does nothing by default + + return true; +} + +} // namespace sf diff --git a/src/SFML/Audio/stb_vorbis/stb_vorbis.c b/src/SFML/Audio/stb_vorbis/stb_vorbis.c new file mode 100755 index 00000000..c092d972 --- /dev/null +++ b/src/SFML/Audio/stb_vorbis/stb_vorbis.c @@ -0,0 +1,5039 @@ +// Ogg Vorbis I audio decoder -- version 0.99994 +// +// Written in April 2007 by Sean Barrett, sponsored by RAD Game Tools. +// +// Placed in the public domain April 2007 by the author: no copyright is +// claimed, and you may use it for any purpose you like. +// +// No warranty for any purpose is expressed or implied by the author (nor +// by RAD Game Tools). Report bugs and send enhancements to the author. +// +// Get the latest version and other information at: +// http://nothings.org/stb_vorbis/ + + +// Todo: +// +// - seeking (note you can seek yourself using the pushdata API) +// +// Limitations: +// +// - floor 0 not supported (used in old ogg vorbis files) +// - lossless sample-truncation at beginning ignored +// - cannot concatenate multiple vorbis streams +// - sample positions are 32-bit, limiting seekable 192Khz +// files to around 6 hours (Ogg supports 64-bit) +// +// All of these limitations may be removed in future versions. + +#include "stb_vorbis.h" + +#ifndef STB_VORBIS_HEADER_ONLY + +// global configuration settings (e.g. set these in the project/makefile), +// or just set them in this file at the top (although ideally the first few +// should be visible when the header file is compiled too, although it's not +// crucial) + +// STB_VORBIS_NO_PUSHDATA_API +// does not compile the code for the various stb_vorbis_*_pushdata() +// functions +// #define STB_VORBIS_NO_PUSHDATA_API + +// STB_VORBIS_NO_PULLDATA_API +// does not compile the code for the non-pushdata APIs +// #define STB_VORBIS_NO_PULLDATA_API + +// STB_VORBIS_NO_STDIO +// does not compile the code for the APIs that use FILE *s internally +// or externally (implied by STB_VORBIS_NO_PULLDATA_API) +// #define STB_VORBIS_NO_STDIO + +// STB_VORBIS_NO_INTEGER_CONVERSION +// does not compile the code for converting audio sample data from +// float to integer (implied by STB_VORBIS_NO_PULLDATA_API) +// #define STB_VORBIS_NO_INTEGER_CONVERSION + +// STB_VORBIS_NO_FAST_SCALED_FLOAT +// does not use a fast float-to-int trick to accelerate float-to-int on +// most platforms which requires endianness be defined correctly. +#define STB_VORBIS_NO_FAST_SCALED_FLOAT + + +// STB_VORBIS_MAX_CHANNELS [number] +// globally define this to the maximum number of channels you need. +// The spec does not put a restriction on channels except that +// the count is stored in a byte, so 255 is the hard limit. +// Reducing this saves about 16 bytes per value, so using 16 saves +// (255-16)*16 or around 4KB. Plus anything other memory usage +// I forgot to account for. Can probably go as low as 8 (7.1 audio), +// 6 (5.1 audio), or 2 (stereo only). +#ifndef STB_VORBIS_MAX_CHANNELS +#define STB_VORBIS_MAX_CHANNELS 16 // enough for anyone? +#endif + +// STB_VORBIS_PUSHDATA_CRC_COUNT [number] +// after a flush_pushdata(), stb_vorbis begins scanning for the +// next valid page, without backtracking. when it finds something +// that looks like a page, it streams through it and verifies its +// CRC32. Should that validation fail, it keeps scanning. But it's +// possible that _while_ streaming through to check the CRC32 of +// one candidate page, it sees another candidate page. This #define +// determines how many "overlapping" candidate pages it can search +// at once. Note that "real" pages are typically ~4KB to ~8KB, whereas +// garbage pages could be as big as 64KB, but probably average ~16KB. +// So don't hose ourselves by scanning an apparent 64KB page and +// missing a ton of real ones in the interim; so minimum of 2 +#ifndef STB_VORBIS_PUSHDATA_CRC_COUNT +#define STB_VORBIS_PUSHDATA_CRC_COUNT 4 +#endif + +// STB_VORBIS_FAST_HUFFMAN_LENGTH [number] +// sets the log size of the huffman-acceleration table. Maximum +// supported value is 24. with larger numbers, more decodings are O(1), +// but the table size is larger so worse cache missing, so you'll have +// to probe (and try multiple ogg vorbis files) to find the sweet spot. +#ifndef STB_VORBIS_FAST_HUFFMAN_LENGTH +#define STB_VORBIS_FAST_HUFFMAN_LENGTH 10 +#endif + +// STB_VORBIS_FAST_BINARY_LENGTH [number] +// sets the log size of the binary-search acceleration table. this +// is used in similar fashion to the fast-huffman size to set initial +// parameters for the binary search + +// STB_VORBIS_FAST_HUFFMAN_INT +// The fast huffman tables are much more efficient if they can be +// stored as 16-bit results instead of 32-bit results. This restricts +// the codebooks to having only 65535 possible outcomes, though. +// (At least, accelerated by the huffman table.) +#ifndef STB_VORBIS_FAST_HUFFMAN_INT +#define STB_VORBIS_FAST_HUFFMAN_SHORT +#endif + +// STB_VORBIS_NO_HUFFMAN_BINARY_SEARCH +// If the 'fast huffman' search doesn't succeed, then stb_vorbis falls +// back on binary searching for the correct one. This requires storing +// extra tables with the huffman codes in sorted order. Defining this +// symbol trades off space for speed by forcing a linear search in the +// non-fast case, except for "sparse" codebooks. +// #define STB_VORBIS_NO_HUFFMAN_BINARY_SEARCH + +// STB_VORBIS_DIVIDES_IN_RESIDUE +// stb_vorbis precomputes the result of the scalar residue decoding +// that would otherwise require a divide per chunk. you can trade off +// space for time by defining this symbol. +// #define STB_VORBIS_DIVIDES_IN_RESIDUE + +// STB_VORBIS_DIVIDES_IN_CODEBOOK +// vorbis VQ codebooks can be encoded two ways: with every case explicitly +// stored, or with all elements being chosen from a small range of values, +// and all values possible in all elements. By default, stb_vorbis expands +// this latter kind out to look like the former kind for ease of decoding, +// because otherwise an integer divide-per-vector-element is required to +// unpack the index. If you define STB_VORBIS_DIVIDES_IN_CODEBOOK, you can +// trade off storage for speed. +//#define STB_VORBIS_DIVIDES_IN_CODEBOOK + +// STB_VORBIS_CODEBOOK_SHORTS +// The vorbis file format encodes VQ codebook floats as ax+b where a and +// b are floating point per-codebook constants, and x is a 16-bit int. +// Normally, stb_vorbis decodes them to floats rather than leaving them +// as 16-bit ints and computing ax+b while decoding. This is a speed/space +// tradeoff; you can save space by defining this flag. +#ifndef STB_VORBIS_CODEBOOK_SHORTS +#define STB_VORBIS_CODEBOOK_FLOATS +#endif + +// STB_VORBIS_DIVIDE_TABLE +// this replaces small integer divides in the floor decode loop with +// table lookups. made less than 1% difference, so disabled by default. + +// STB_VORBIS_NO_INLINE_DECODE +// disables the inlining of the scalar codebook fast-huffman decode. +// might save a little codespace; useful for debugging +// #define STB_VORBIS_NO_INLINE_DECODE + +// STB_VORBIS_NO_DEFER_FLOOR +// Normally we only decode the floor without synthesizing the actual +// full curve. We can instead synthesize the curve immediately. This +// requires more memory and is very likely slower, so I don't think +// you'd ever want to do it except for debugging. +// #define STB_VORBIS_NO_DEFER_FLOOR + + + + +////////////////////////////////////////////////////////////////////////////// + +#ifdef STB_VORBIS_NO_PULLDATA_API + #define STB_VORBIS_NO_INTEGER_CONVERSION + #define STB_VORBIS_NO_STDIO +#endif + +#if defined(STB_VORBIS_NO_CRT) && !defined(STB_VORBIS_NO_STDIO) + #define STB_VORBIS_NO_STDIO 1 +#endif + +#ifndef STB_VORBIS_NO_INTEGER_CONVERSION +#ifndef STB_VORBIS_NO_FAST_SCALED_FLOAT + + // only need endianness for fast-float-to-int, which we don't + // use for pushdata + + #ifndef STB_VORBIS_BIG_ENDIAN + #define STB_VORBIS_ENDIAN 0 + #else + #define STB_VORBIS_ENDIAN 1 + #endif + +#endif +#endif + + +#ifndef STB_VORBIS_NO_STDIO +#include +#endif + +#ifndef STB_VORBIS_NO_CRT +#include +#include +#include +#include + +#if !defined(__APPLE__) && !defined(MACOSX) && !defined(macintosh) && !defined(Macintosh) &&!defined(__FreeBSD__) +#include +#endif + +#else +#define NULL 0 +#endif + +#ifndef _MSC_VER + #if __GNUC__ + #define __forceinline inline + #else + #define __forceinline + #endif +#endif + +#if STB_VORBIS_MAX_CHANNELS > 256 +#error "Value of STB_VORBIS_MAX_CHANNELS outside of allowed range" +#endif + +#if STB_VORBIS_FAST_HUFFMAN_LENGTH > 24 +#error "Value of STB_VORBIS_FAST_HUFFMAN_LENGTH outside of allowed range" +#endif + + +#define MAX_BLOCKSIZE_LOG 13 // from specification +#define MAX_BLOCKSIZE (1 << MAX_BLOCKSIZE_LOG) + + +typedef unsigned char uint8; +typedef signed char int8; +typedef unsigned short uint16; +typedef signed short int16; +typedef unsigned int uint32; +typedef signed int int32; + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifdef STB_VORBIS_CODEBOOK_FLOATS +typedef float codetype; +#else +typedef uint16 codetype; +#endif + +// @NOTE +// +// Some arrays below are tagged "//varies", which means it's actually +// a variable-sized piece of data, but rather than malloc I assume it's +// small enough it's better to just allocate it all together with the +// main thing +// +// Most of the variables are specified with the smallest size I could pack +// them into. It might give better performance to make them all full-sized +// integers. It should be safe to freely rearrange the structures or change +// the sizes larger--nothing relies on silently truncating etc., nor the +// order of variables. + +#define FAST_HUFFMAN_TABLE_SIZE (1 << STB_VORBIS_FAST_HUFFMAN_LENGTH) +#define FAST_HUFFMAN_TABLE_MASK (FAST_HUFFMAN_TABLE_SIZE - 1) + +typedef struct +{ + int dimensions, entries; + uint8 *codeword_lengths; + float minimum_value; + float delta_value; + uint8 value_bits; + uint8 lookup_type; + uint8 sequence_p; + uint8 sparse; + uint32 lookup_values; + codetype *multiplicands; + uint32 *codewords; + #ifdef STB_VORBIS_FAST_HUFFMAN_SHORT + int16 fast_huffman[FAST_HUFFMAN_TABLE_SIZE]; + #else + int32 fast_huffman[FAST_HUFFMAN_TABLE_SIZE]; + #endif + uint32 *sorted_codewords; + int *sorted_values; + int sorted_entries; +} Codebook; + +typedef struct +{ + uint8 order; + uint16 rate; + uint16 bark_map_size; + uint8 amplitude_bits; + uint8 amplitude_offset; + uint8 number_of_books; + uint8 book_list[16]; // varies +} Floor0; + +typedef struct +{ + uint8 partitions; + uint8 partition_class_list[32]; // varies + uint8 class_dimensions[16]; // varies + uint8 class_subclasses[16]; // varies + uint8 class_masterbooks[16]; // varies + int16 subclass_books[16][8]; // varies + uint16 Xlist[31*8+2]; // varies + uint8 sorted_order[31*8+2]; + uint8 neighbors[31*8+2][2]; + uint8 floor1_multiplier; + uint8 rangebits; + int values; +} Floor1; + +typedef union +{ + Floor0 floor0; + Floor1 floor1; +} Floor; + +typedef struct +{ + uint32 begin, end; + uint32 part_size; + uint8 classifications; + uint8 classbook; + uint8 **classdata; + int16 (*residue_books)[8]; +} Residue; + +typedef struct +{ + uint8 magnitude; + uint8 angle; + uint8 mux; +} MappingChannel; + +typedef struct +{ + uint16 coupling_steps; + MappingChannel *chan; + uint8 submaps; + uint8 submap_floor[15]; // varies + uint8 submap_residue[15]; // varies +} Mapping; + +typedef struct +{ + uint8 blockflag; + uint8 mapping; + uint16 windowtype; + uint16 transformtype; +} Mode; + +typedef struct +{ + uint32 goal_crc; // expected crc if match + int bytes_left; // bytes left in packet + uint32 crc_so_far; // running crc + int bytes_done; // bytes processed in _current_ chunk + uint32 sample_loc; // granule pos encoded in page +} CRCscan; + +typedef struct +{ + uint32 page_start, page_end; + uint32 after_previous_page_start; + uint32 first_decoded_sample; + uint32 last_decoded_sample; +} ProbedPage; + +struct stb_vorbis +{ + // user-accessible info + unsigned int sample_rate; + int channels; + + unsigned int setup_memory_required; + unsigned int temp_memory_required; + unsigned int setup_temp_memory_required; + + // input config +#ifndef STB_VORBIS_NO_STDIO + FILE *f; + uint32 f_start; + int close_on_free; +#endif + + uint8 *stream; + uint8 *stream_start; + uint8 *stream_end; + + uint32 stream_len; + + uint8 push_mode; + + uint32 first_audio_page_offset; + + ProbedPage p_first, p_last; + + // memory management + stb_vorbis_alloc alloc; + int setup_offset; + int temp_offset; + + // run-time results + int eof; + enum STBVorbisError error; + + // user-useful data + + // header info + int blocksize[2]; + int blocksize_0, blocksize_1; + int codebook_count; + Codebook *codebooks; + int floor_count; + uint16 floor_types[64]; // varies + Floor *floor_config; + int residue_count; + uint16 residue_types[64]; // varies + Residue *residue_config; + int mapping_count; + Mapping *mapping; + int mode_count; + Mode mode_config[64]; // varies + + uint32 total_samples; + + // decode buffer + float *channel_buffers[STB_VORBIS_MAX_CHANNELS]; + float *outputs [STB_VORBIS_MAX_CHANNELS]; + + float *previous_window[STB_VORBIS_MAX_CHANNELS]; + int previous_length; + + #ifndef STB_VORBIS_NO_DEFER_FLOOR + int16 *finalY[STB_VORBIS_MAX_CHANNELS]; + #else + float *floor_buffers[STB_VORBIS_MAX_CHANNELS]; + #endif + + uint32 current_loc; // sample location of next frame to decode + int current_loc_valid; + + // per-blocksize precomputed data + + // twiddle factors + float *A[2],*B[2],*C[2]; + float *window[2]; + uint16 *bit_reverse[2]; + + // current page/packet/segment streaming info + uint32 serial; // stream serial number for verification + int last_page; + int segment_count; + uint8 segments[255]; + uint8 page_flag; + uint8 bytes_in_seg; + uint8 first_decode; + int next_seg; + int last_seg; // flag that we're on the last segment + int last_seg_which; // what was the segment number of the last seg? + uint32 acc; + int valid_bits; + int packet_bytes; + int end_seg_with_known_loc; + uint32 known_loc_for_packet; + int discard_samples_deferred; + uint32 samples_output; + + // push mode scanning + int page_crc_tests; // only in push_mode: number of tests active; -1 if not searching +#ifndef STB_VORBIS_NO_PUSHDATA_API + CRCscan scan[STB_VORBIS_PUSHDATA_CRC_COUNT]; +#endif + + // sample-access + int channel_buffer_start; + int channel_buffer_end; +}; + +extern int my_prof(int slot); +//#define stb_prof my_prof + +#ifndef stb_prof +#define stb_prof(x) 0 +#endif + +#if defined(STB_VORBIS_NO_PUSHDATA_API) + #define IS_PUSH_MODE(f) FALSE +#elif defined(STB_VORBIS_NO_PULLDATA_API) + #define IS_PUSH_MODE(f) TRUE +#else + #define IS_PUSH_MODE(f) ((f)->push_mode) +#endif + +typedef struct stb_vorbis vorb; + +static int error(vorb *f, enum STBVorbisError e) +{ + f->error = e; + if (!f->eof && e != VORBIS_need_more_data) { + f->error=e; // breakpoint for debugging + } + return 0; +} + + +// these functions are used for allocating temporary memory +// while decoding. if you can afford the stack space, use +// alloca(); otherwise, provide a temp buffer and it will +// allocate out of those. + +#define array_size_required(count,size) (count*(sizeof(void *)+(size))) + +#define temp_alloc(f,size) (f->alloc.alloc_buffer ? setup_temp_malloc(f,size) : alloca(size)) +#ifdef dealloca +#define temp_free(f,p) (f->alloc.alloc_buffer ? 0 : dealloca(size)) +#else +#define temp_free(f,p) 0 +#endif +#define temp_alloc_save(f) ((f)->temp_offset) +#define temp_alloc_restore(f,p) ((f)->temp_offset = (p)) + +#define temp_block_array(f,count,size) make_block_array(temp_alloc(f,array_size_required(count,size)), count, size) + +// given a sufficiently large block of memory, make an array of pointers to subblocks of it +static void *make_block_array(void *mem, int count, int size) +{ + int i; + void ** p = (void **) mem; + char *q = (char *) (p + count); + for (i=0; i < count; ++i) { + p[i] = q; + q += size; + } + return p; +} + +static void *setup_malloc(vorb *f, int sz) +{ + sz = (sz+3) & ~3; + f->setup_memory_required += sz; + if (f->alloc.alloc_buffer) { + void *p = (char *) f->alloc.alloc_buffer + f->setup_offset; + if (f->setup_offset + sz > f->temp_offset) return NULL; + f->setup_offset += sz; + return p; + } + return sz ? malloc(sz) : NULL; +} + +static void setup_free(vorb *f, void *p) +{ + if (f->alloc.alloc_buffer) return; // do nothing; setup mem is not a stack + free(p); +} + +static void *setup_temp_malloc(vorb *f, int sz) +{ + sz = (sz+3) & ~3; + if (f->alloc.alloc_buffer) { + if (f->temp_offset - sz < f->setup_offset) return NULL; + f->temp_offset -= sz; + return (char *) f->alloc.alloc_buffer + f->temp_offset; + } + return malloc(sz); +} + +static void setup_temp_free(vorb *f, void *p, size_t sz) +{ + if (f->alloc.alloc_buffer) { + f->temp_offset += (sz+3)&~3; + return; + } + free(p); +} + +#define CRC32_POLY 0x04c11db7 // from spec + +static uint32 crc_table[256]; +static void crc32_init(void) +{ + int i,j; + uint32 s; + for(i=0; i < 256; i++) { + for (s=i<<24, j=0; j < 8; ++j) + s = (s << 1) ^ (s >= (1<<31) ? CRC32_POLY : 0); + crc_table[i] = s; + } +} + +static __forceinline uint32 crc32_update(uint32 crc, uint8 byte) +{ + return (crc << 8) ^ crc_table[byte ^ (crc >> 24)]; +} + + +// used in setup, and for huffman that doesn't go fast path +static unsigned int bit_reverse(unsigned int n) +{ + n = ((n & 0xAAAAAAAA) >> 1) | ((n & 0x55555555) << 1); + n = ((n & 0xCCCCCCCC) >> 2) | ((n & 0x33333333) << 2); + n = ((n & 0xF0F0F0F0) >> 4) | ((n & 0x0F0F0F0F) << 4); + n = ((n & 0xFF00FF00) >> 8) | ((n & 0x00FF00FF) << 8); + return (n >> 16) | (n << 16); +} + +static float square(float x) +{ + return x*x; +} + +// this is a weird definition of log2() for which log2(1) = 1, log2(2) = 2, log2(4) = 3 +// as required by the specification. fast(?) implementation from stb.h +// @OPTIMIZE: called multiple times per-packet with "constants"; move to setup +static int ilog(int32 n) +{ + static signed char log2_4[16] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4 }; + + // 2 compares if n < 16, 3 compares otherwise (4 if signed or n > 1<<29) + if (n < (1U << 14)) + if (n < (1U << 4)) return 0 + log2_4[n ]; + else if (n < (1U << 9)) return 5 + log2_4[n >> 5]; + else return 10 + log2_4[n >> 10]; + else if (n < (1U << 24)) + if (n < (1U << 19)) return 15 + log2_4[n >> 15]; + else return 20 + log2_4[n >> 20]; + else if (n < (1U << 29)) return 25 + log2_4[n >> 25]; + else if (n < (1U << 31)) return 30 + log2_4[n >> 30]; + else return 0; // signed n returns 0 +} + +#ifndef M_PI + #define M_PI 3.14159265358979323846264f // from CRC +#endif + +// code length assigned to a value with no huffman encoding +#define NO_CODE 255 + +/////////////////////// LEAF SETUP FUNCTIONS ////////////////////////// +// +// these functions are only called at setup, and only a few times +// per file + +static float float32_unpack(uint32 x) +{ + // from the specification + uint32 mantissa = x & 0x1fffff; + uint32 sign = x & 0x80000000; + uint32 exp = (x & 0x7fe00000) >> 21; + double res = sign ? -(double)mantissa : (double)mantissa; + return (float) ldexp((float)res, exp-788); +} + + +// zlib & jpeg huffman tables assume that the output symbols +// can either be arbitrarily arranged, or have monotonically +// increasing frequencies--they rely on the lengths being sorted; +// this makes for a very simple generation algorithm. +// vorbis allows a huffman table with non-sorted lengths. This +// requires a more sophisticated construction, since symbols in +// order do not map to huffman codes "in order". +static void add_entry(Codebook *c, uint32 huff_code, int symbol, int count, int len, uint32 *values) +{ + if (!c->sparse) { + c->codewords [symbol] = huff_code; + } else { + c->codewords [count] = huff_code; + c->codeword_lengths[count] = len; + values [count] = symbol; + } +} + +static int compute_codewords(Codebook *c, uint8 *len, int n, uint32 *values) +{ + int i,k,m=0; + uint32 available[32]; + + memset(available, 0, sizeof(available)); + // find the first entry + for (k=0; k < n; ++k) if (len[k] < NO_CODE) break; + if (k == n) { assert(c->sorted_entries == 0); return TRUE; } + // add to the list + add_entry(c, 0, k, m++, len[k], values); + // add all available leaves + for (i=1; i <= len[k]; ++i) + available[i] = 1 << (32-i); + // note that the above code treats the first case specially, + // but it's really the same as the following code, so they + // could probably be combined (except the initial code is 0, + // and I use 0 in available[] to mean 'empty') + for (i=k+1; i < n; ++i) { + uint32 res; + int z = len[i], y; + if (z == NO_CODE) continue; + // find lowest available leaf (should always be earliest, + // which is what the specification calls for) + // note that this property, and the fact we can never have + // more than one free leaf at a given level, isn't totally + // trivial to prove, but it seems true and the assert never + // fires, so! + while (z > 0 && !available[z]) --z; + if (z == 0) { assert(0); return FALSE; } + res = available[z]; + available[z] = 0; + add_entry(c, bit_reverse(res), i, m++, len[i], values); + // propogate availability up the tree + if (z != len[i]) { + for (y=len[i]; y > z; --y) { + assert(available[y] == 0); + available[y] = res + (1 << (32-y)); + } + } + } + return TRUE; +} + +// accelerated huffman table allows fast O(1) match of all symbols +// of length <= STB_VORBIS_FAST_HUFFMAN_LENGTH +static void compute_accelerated_huffman(Codebook *c) +{ + int i, len; + for (i=0; i < FAST_HUFFMAN_TABLE_SIZE; ++i) + c->fast_huffman[i] = -1; + + len = c->sparse ? c->sorted_entries : c->entries; + #ifdef STB_VORBIS_FAST_HUFFMAN_SHORT + if (len > 32767) len = 32767; // largest possible value we can encode! + #endif + for (i=0; i < len; ++i) { + if (c->codeword_lengths[i] <= STB_VORBIS_FAST_HUFFMAN_LENGTH) { + uint32 z = c->sparse ? bit_reverse(c->sorted_codewords[i]) : c->codewords[i]; + // set table entries for all bit combinations in the higher bits + while (z < FAST_HUFFMAN_TABLE_SIZE) { + c->fast_huffman[z] = i; + z += 1 << c->codeword_lengths[i]; + } + } + } +} + +static int uint32_compare(const void *p, const void *q) +{ + uint32 x = * (uint32 *) p; + uint32 y = * (uint32 *) q; + return x < y ? -1 : x > y; +} + +static int include_in_sort(Codebook *c, uint8 len) +{ + if (c->sparse) { assert(len != NO_CODE); return TRUE; } + if (len == NO_CODE) return FALSE; + if (len > STB_VORBIS_FAST_HUFFMAN_LENGTH) return TRUE; + return FALSE; +} + +// if the fast table above doesn't work, we want to binary +// search them... need to reverse the bits +static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *values) +{ + int i, len; + // build a list of all the entries + // OPTIMIZATION: don't include the short ones, since they'll be caught by FAST_HUFFMAN. + // this is kind of a frivolous optimization--I don't see any performance improvement, + // but it's like 4 extra lines of code, so. + if (!c->sparse) { + int k = 0; + for (i=0; i < c->entries; ++i) + if (include_in_sort(c, lengths[i])) + c->sorted_codewords[k++] = bit_reverse(c->codewords[i]); + assert(k == c->sorted_entries); + } else { + for (i=0; i < c->sorted_entries; ++i) + c->sorted_codewords[i] = bit_reverse(c->codewords[i]); + } + + qsort(c->sorted_codewords, c->sorted_entries, sizeof(c->sorted_codewords[0]), uint32_compare); + c->sorted_codewords[c->sorted_entries] = 0xffffffff; + + len = c->sparse ? c->sorted_entries : c->entries; + // now we need to indicate how they correspond; we could either + // #1: sort a different data structure that says who they correspond to + // #2: for each sorted entry, search the original list to find who corresponds + // #3: for each original entry, find the sorted entry + // #1 requires extra storage, #2 is slow, #3 can use binary search! + for (i=0; i < len; ++i) { + int huff_len = c->sparse ? lengths[values[i]] : lengths[i]; + if (include_in_sort(c,huff_len)) { + uint32 code = bit_reverse(c->codewords[i]); + int x=0, n=c->sorted_entries; + while (n > 1) { + // invariant: sc[x] <= code < sc[x+n] + int m = x + (n >> 1); + if (c->sorted_codewords[m] <= code) { + x = m; + n -= (n>>1); + } else { + n >>= 1; + } + } + assert(c->sorted_codewords[x] == code); + if (c->sparse) { + c->sorted_values[x] = values[i]; + c->codeword_lengths[x] = huff_len; + } else { + c->sorted_values[x] = i; + } + } + } +} + +// only run while parsing the header (3 times) +static int vorbis_validate(uint8 *data) +{ + static uint8 vorbis[6] = { 'v', 'o', 'r', 'b', 'i', 's' }; + return memcmp(data, vorbis, 6) == 0; +} + +// called from setup only, once per code book +// (formula implied by specification) +static int lookup1_values(int entries, int dim) +{ + int r = (int) floor(exp((float) log((float) entries) / dim)); + if ((int) floor(pow((float) r+1, dim)) <= entries) // (int) cast for MinGW warning; + ++r; // floor() to avoid _ftol() when non-CRT + assert(pow((float) r+1, dim) > entries); + assert((int) floor(pow((float) r, dim)) <= entries); // (int),floor() as above + return r; +} + +// called twice per file +static void compute_twiddle_factors(int n, float *A, float *B, float *C) +{ + int n4 = n >> 2, n8 = n >> 3; + int k,k2; + + for (k=k2=0; k < n4; ++k,k2+=2) { + A[k2 ] = (float) cos(4*k*M_PI/n); + A[k2+1] = (float) -sin(4*k*M_PI/n); + B[k2 ] = (float) cos((k2+1)*M_PI/n/2) * 0.5f; + B[k2+1] = (float) sin((k2+1)*M_PI/n/2) * 0.5f; + } + for (k=k2=0; k < n8; ++k,k2+=2) { + C[k2 ] = (float) cos(2*(k2+1)*M_PI/n); + C[k2+1] = (float) -sin(2*(k2+1)*M_PI/n); + } +} + +static void compute_window(int n, float *window) +{ + int n2 = n >> 1, i; + for (i=0; i < n2; ++i) + window[i] = (float) sin(0.5 * M_PI * square((float) sin((i - 0 + 0.5) / n2 * 0.5 * M_PI))); +} + +static void compute_bitreverse(int n, uint16 *rev) +{ + int ld = ilog(n) - 1; // ilog is off-by-one from normal definitions + int i, n8 = n >> 3; + for (i=0; i < n8; ++i) + rev[i] = (bit_reverse(i) >> (32-ld+3)) << 2; +} + +static int init_blocksize(vorb *f, int b, int n) +{ + int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3; + f->A[b] = (float *) setup_malloc(f, sizeof(float) * n2); + f->B[b] = (float *) setup_malloc(f, sizeof(float) * n2); + f->C[b] = (float *) setup_malloc(f, sizeof(float) * n4); + if (!f->A[b] || !f->B[b] || !f->C[b]) return error(f, VORBIS_outofmem); + compute_twiddle_factors(n, f->A[b], f->B[b], f->C[b]); + f->window[b] = (float *) setup_malloc(f, sizeof(float) * n2); + if (!f->window[b]) return error(f, VORBIS_outofmem); + compute_window(n, f->window[b]); + f->bit_reverse[b] = (uint16 *) setup_malloc(f, sizeof(uint16) * n8); + if (!f->bit_reverse[b]) return error(f, VORBIS_outofmem); + compute_bitreverse(n, f->bit_reverse[b]); + return TRUE; +} + +static void neighbors(uint16 *x, int n, int *plow, int *phigh) +{ + int low = -1; + int high = 65536; + int i; + for (i=0; i < n; ++i) { + if (x[i] > low && x[i] < x[n]) { *plow = i; low = x[i]; } + if (x[i] < high && x[i] > x[n]) { *phigh = i; high = x[i]; } + } +} + +// this has been repurposed so y is now the original index instead of y +typedef struct +{ + uint16 x,y; +} Point; + +int point_compare(const void *p, const void *q) +{ + Point *a = (Point *) p; + Point *b = (Point *) q; + return a->x < b->x ? -1 : a->x > b->x; +} + +// +/////////////////////// END LEAF SETUP FUNCTIONS ////////////////////////// + + +#if defined(STB_VORBIS_NO_STDIO) + #define USE_MEMORY(z) TRUE +#else + #define USE_MEMORY(z) ((z)->stream) +#endif + +static uint8 get8(vorb *z) +{ + if (USE_MEMORY(z)) { + if (z->stream >= z->stream_end) { z->eof = TRUE; return 0; } + return *z->stream++; + } + + #ifndef STB_VORBIS_NO_STDIO + { + int c = fgetc(z->f); + if (c == EOF) { z->eof = TRUE; return 0; } + return c; + } + #endif +} + +static uint32 get32(vorb *f) +{ + uint32 x; + x = get8(f); + x += get8(f) << 8; + x += get8(f) << 16; + x += get8(f) << 24; + return x; +} + +static int getn(vorb *z, uint8 *data, int n) +{ + if (USE_MEMORY(z)) { + if (z->stream+n > z->stream_end) { z->eof = 1; return 0; } + memcpy(data, z->stream, n); + z->stream += n; + return 1; + } + + #ifndef STB_VORBIS_NO_STDIO + if (fread(data, n, 1, z->f) == 1) + return 1; + else { + z->eof = 1; + return 0; + } + #endif +} + +static void skip(vorb *z, int n) +{ + if (USE_MEMORY(z)) { + z->stream += n; + if (z->stream >= z->stream_end) z->eof = 1; + return; + } + #ifndef STB_VORBIS_NO_STDIO + { + long x = ftell(z->f); + fseek(z->f, x+n, SEEK_SET); + } + #endif +} + +static int set_file_offset(stb_vorbis *f, unsigned int loc) +{ + #ifndef STB_VORBIS_NO_PUSHDATA_API + if (f->push_mode) return 0; + #endif + f->eof = 0; + if (USE_MEMORY(f)) { + if (f->stream_start + loc >= f->stream_end || f->stream_start + loc < f->stream_start) { + f->stream = f->stream_end; + f->eof = 1; + return 0; + } else { + f->stream = f->stream_start + loc; + return 1; + } + } + #ifndef STB_VORBIS_NO_STDIO + if (loc + f->f_start < loc || loc >= 0x80000000) { + loc = 0x7fffffff; + f->eof = 1; + } else { + loc += f->f_start; + } + if (!fseek(f->f, loc, SEEK_SET)) + return 1; + f->eof = 1; + fseek(f->f, f->f_start, SEEK_END); + return 0; + #endif +} + + +static uint8 ogg_page_header[4] = { 0x4f, 0x67, 0x67, 0x53 }; + +static int capture_pattern(vorb *f) +{ + if (0x4f != get8(f)) return FALSE; + if (0x67 != get8(f)) return FALSE; + if (0x67 != get8(f)) return FALSE; + if (0x53 != get8(f)) return FALSE; + return TRUE; +} + +#define PAGEFLAG_continued_packet 1 +#define PAGEFLAG_first_page 2 +#define PAGEFLAG_last_page 4 + +static int start_page_no_capturepattern(vorb *f) +{ + uint32 loc0,loc1,n,i; + // stream structure version + if (0 != get8(f)) return error(f, VORBIS_invalid_stream_structure_version); + // header flag + f->page_flag = get8(f); + // absolute granule position + loc0 = get32(f); + loc1 = get32(f); + // @TODO: validate loc0,loc1 as valid positions? + // stream serial number -- vorbis doesn't interleave, so discard + get32(f); + //if (f->serial != get32(f)) return error(f, VORBIS_incorrect_stream_serial_number); + // page sequence number + n = get32(f); + f->last_page = n; + // CRC32 + get32(f); + // page_segments + f->segment_count = get8(f); + if (!getn(f, f->segments, f->segment_count)) + return error(f, VORBIS_unexpected_eof); + // assume we _don't_ know any the sample position of any segments + f->end_seg_with_known_loc = -2; + if (loc0 != ~0 || loc1 != ~0) { + // determine which packet is the last one that will complete + for (i=f->segment_count-1; i >= 0; --i) + if (f->segments[i] < 255) + break; + // 'i' is now the index of the _last_ segment of a packet that ends + if (i >= 0) { + f->end_seg_with_known_loc = i; + f->known_loc_for_packet = loc0; + } + } + if (f->first_decode) { + int i,len; + ProbedPage p; + len = 0; + for (i=0; i < f->segment_count; ++i) + len += f->segments[i]; + len += 27 + f->segment_count; + p.page_start = f->first_audio_page_offset; + p.page_end = p.page_start + len; + p.after_previous_page_start = p.page_start; + p.first_decoded_sample = 0; + p.last_decoded_sample = loc0; + f->p_first = p; + } + f->next_seg = 0; + return TRUE; +} + +static int start_page(vorb *f) +{ + if (!capture_pattern(f)) return error(f, VORBIS_missing_capture_pattern); + return start_page_no_capturepattern(f); +} + +static int start_packet(vorb *f) +{ + while (f->next_seg == -1) { + if (!start_page(f)) return FALSE; + if (f->page_flag & PAGEFLAG_continued_packet) + return error(f, VORBIS_continued_packet_flag_invalid); + } + f->last_seg = FALSE; + f->valid_bits = 0; + f->packet_bytes = 0; + f->bytes_in_seg = 0; + // f->next_seg is now valid + return TRUE; +} + +static int maybe_start_packet(vorb *f) +{ + if (f->next_seg == -1) { + int x = get8(f); + if (f->eof) return FALSE; // EOF at page boundary is not an error! + if (0x4f != x ) return error(f, VORBIS_missing_capture_pattern); + if (0x67 != get8(f)) return error(f, VORBIS_missing_capture_pattern); + if (0x67 != get8(f)) return error(f, VORBIS_missing_capture_pattern); + if (0x53 != get8(f)) return error(f, VORBIS_missing_capture_pattern); + if (!start_page_no_capturepattern(f)) return FALSE; + if (f->page_flag & PAGEFLAG_continued_packet) { + // set up enough state that we can read this packet if we want, + // e.g. during recovery + f->last_seg = FALSE; + f->bytes_in_seg = 0; + return error(f, VORBIS_continued_packet_flag_invalid); + } + } + return start_packet(f); +} + +static int next_segment(vorb *f) +{ + int len; + if (f->last_seg) return 0; + if (f->next_seg == -1) { + f->last_seg_which = f->segment_count-1; // in case start_page fails + if (!start_page(f)) { f->last_seg = 1; return 0; } + if (!(f->page_flag & PAGEFLAG_continued_packet)) return error(f, VORBIS_continued_packet_flag_invalid); + } + len = f->segments[f->next_seg++]; + if (len < 255) { + f->last_seg = TRUE; + f->last_seg_which = f->next_seg-1; + } + if (f->next_seg >= f->segment_count) + f->next_seg = -1; + assert(f->bytes_in_seg == 0); + f->bytes_in_seg = len; + return len; +} + +#define EOP (-1) +#define INVALID_BITS (-1) + +static int get8_packet_raw(vorb *f) +{ + if (!f->bytes_in_seg) + if (f->last_seg) return EOP; + else if (!next_segment(f)) return EOP; + assert(f->bytes_in_seg > 0); + --f->bytes_in_seg; + ++f->packet_bytes; + return get8(f); +} + +static int get8_packet(vorb *f) +{ + int x = get8_packet_raw(f); + f->valid_bits = 0; + return x; +} + +static void flush_packet(vorb *f) +{ + while (get8_packet_raw(f) != EOP); +} + +// @OPTIMIZE: this is the secondary bit decoder, so it's probably not as important +// as the huffman decoder? +static uint32 get_bits(vorb *f, int n) +{ + uint32 z; + + if (f->valid_bits < 0) return 0; + if (f->valid_bits < n) { + if (n > 24) { + // the accumulator technique below would not work correctly in this case + z = get_bits(f, 24); + z += get_bits(f, n-24) << 24; + return z; + } + if (f->valid_bits == 0) f->acc = 0; + while (f->valid_bits < n) { + int z = get8_packet_raw(f); + if (z == EOP) { + f->valid_bits = INVALID_BITS; + return 0; + } + f->acc += z << f->valid_bits; + f->valid_bits += 8; + } + } + if (f->valid_bits < 0) return 0; + z = f->acc & ((1 << n)-1); + f->acc >>= n; + f->valid_bits -= n; + return z; +} + +static int32 get_bits_signed(vorb *f, int n) +{ + uint32 z = get_bits(f, n); + if (z & (1 << (n-1))) + z += ~((1 << n) - 1); + return (int32) z; +} + +// @OPTIMIZE: primary accumulator for huffman +// expand the buffer to as many bits as possible without reading off end of packet +// it might be nice to allow f->valid_bits and f->acc to be stored in registers, +// e.g. cache them locally and decode locally +static __forceinline void prep_huffman(vorb *f) +{ + if (f->valid_bits <= 24) { + if (f->valid_bits == 0) f->acc = 0; + do { + int z; + if (f->last_seg && !f->bytes_in_seg) return; + z = get8_packet_raw(f); + if (z == EOP) return; + f->acc += z << f->valid_bits; + f->valid_bits += 8; + } while (f->valid_bits <= 24); + } +} + +enum +{ + VORBIS_packet_id = 1, + VORBIS_packet_comment = 3, + VORBIS_packet_setup = 5, +}; + +static int codebook_decode_scalar_raw(vorb *f, Codebook *c) +{ + int i; + prep_huffman(f); + + assert(c->sorted_codewords || c->codewords); + // cases to use binary search: sorted_codewords && !c->codewords + // sorted_codewords && c->entries > 8 + if (c->entries > 8 ? c->sorted_codewords!=NULL : !c->codewords) { + // binary search + uint32 code = bit_reverse(f->acc); + int x=0, n=c->sorted_entries, len; + + while (n > 1) { + // invariant: sc[x] <= code < sc[x+n] + int m = x + (n >> 1); + if (c->sorted_codewords[m] <= code) { + x = m; + n -= (n>>1); + } else { + n >>= 1; + } + } + // x is now the sorted index + if (!c->sparse) x = c->sorted_values[x]; + // x is now sorted index if sparse, or symbol otherwise + len = c->codeword_lengths[x]; + if (f->valid_bits >= len) { + f->acc >>= len; + f->valid_bits -= len; + return x; + } + + f->valid_bits = 0; + return -1; + } + + // if small, linear search + assert(!c->sparse); + for (i=0; i < c->entries; ++i) { + if (c->codeword_lengths[i] == NO_CODE) continue; + if (c->codewords[i] == (f->acc & ((1 << c->codeword_lengths[i])-1))) { + if (f->valid_bits >= c->codeword_lengths[i]) { + f->acc >>= c->codeword_lengths[i]; + f->valid_bits -= c->codeword_lengths[i]; + return i; + } + f->valid_bits = 0; + return -1; + } + } + + error(f, VORBIS_invalid_stream); + f->valid_bits = 0; + return -1; +} + +static int codebook_decode_scalar(vorb *f, Codebook *c) +{ + int i; + if (f->valid_bits < STB_VORBIS_FAST_HUFFMAN_LENGTH) + prep_huffman(f); + // fast huffman table lookup + i = f->acc & FAST_HUFFMAN_TABLE_MASK; + i = c->fast_huffman[i]; + if (i >= 0) { + f->acc >>= c->codeword_lengths[i]; + f->valid_bits -= c->codeword_lengths[i]; + if (f->valid_bits < 0) { f->valid_bits = 0; return -1; } + return i; + } + return codebook_decode_scalar_raw(f,c); +} + +#ifndef STB_VORBIS_NO_INLINE_DECODE + +#define DECODE_RAW(var, f,c) \ + if (f->valid_bits < STB_VORBIS_FAST_HUFFMAN_LENGTH) \ + prep_huffman(f); \ + var = f->acc & FAST_HUFFMAN_TABLE_MASK; \ + var = c->fast_huffman[var]; \ + if (var >= 0) { \ + int n = c->codeword_lengths[var]; \ + f->acc >>= n; \ + f->valid_bits -= n; \ + if (f->valid_bits < 0) { f->valid_bits = 0; var = -1; } \ + } else { \ + var = codebook_decode_scalar_raw(f,c); \ + } + +#else + +#define DECODE_RAW(var,f,c) var = codebook_decode_scalar(f,c); + +#endif + +#define DECODE(var,f,c) \ + DECODE_RAW(var,f,c) \ + if (c->sparse) var = c->sorted_values[var]; + +#ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK + #define DECODE_VQ(var,f,c) DECODE_RAW(var,f,c) +#else + #define DECODE_VQ(var,f,c) DECODE(var,f,c) +#endif + + + + + + +// CODEBOOK_ELEMENT_FAST is an optimization for the CODEBOOK_FLOATS case +// where we avoid one addition +#ifndef STB_VORBIS_CODEBOOK_FLOATS + #define CODEBOOK_ELEMENT(c,off) (c->multiplicands[off] * c->delta_value + c->minimum_value) + #define CODEBOOK_ELEMENT_FAST(c,off) (c->multiplicands[off] * c->delta_value) + #define CODEBOOK_ELEMENT_BASE(c) (c->minimum_value) +#else + #define CODEBOOK_ELEMENT(c,off) (c->multiplicands[off]) + #define CODEBOOK_ELEMENT_FAST(c,off) (c->multiplicands[off]) + #define CODEBOOK_ELEMENT_BASE(c) (0) +#endif + +static int codebook_decode_start(vorb *f, Codebook *c, int len) +{ + int z = -1; + + // type 0 is only legal in a scalar context + if (c->lookup_type == 0) + error(f, VORBIS_invalid_stream); + else { + DECODE_VQ(z,f,c); + if (c->sparse) assert(z < c->sorted_entries); + if (z < 0) { // check for EOP + if (!f->bytes_in_seg) + if (f->last_seg) + return z; + error(f, VORBIS_invalid_stream); + } + } + return z; +} + +static int codebook_decode(vorb *f, Codebook *c, float *output, int len) +{ + int i,z = codebook_decode_start(f,c,len); + if (z < 0) return FALSE; + if (len > c->dimensions) len = c->dimensions; + +#ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK + if (c->lookup_type == 1) { + float last = CODEBOOK_ELEMENT_BASE(c); + int div = 1; + for (i=0; i < len; ++i) { + int off = (z / div) % c->lookup_values; + float val = CODEBOOK_ELEMENT_FAST(c,off) + last; + output[i] += val; + if (c->sequence_p) last = val + c->minimum_value; + div *= c->lookup_values; + } + return TRUE; + } +#endif + + z *= c->dimensions; + if (c->sequence_p) { + float last = CODEBOOK_ELEMENT_BASE(c); + for (i=0; i < len; ++i) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + output[i] += val; + last = val + c->minimum_value; + } + } else { + float last = CODEBOOK_ELEMENT_BASE(c); + for (i=0; i < len; ++i) { + output[i] += CODEBOOK_ELEMENT_FAST(c,z+i) + last; + } + } + + return TRUE; +} + +static int codebook_decode_step(vorb *f, Codebook *c, float *output, int len, int step) +{ + int i,z = codebook_decode_start(f,c,len); + float last = CODEBOOK_ELEMENT_BASE(c); + if (z < 0) return FALSE; + if (len > c->dimensions) len = c->dimensions; + +#ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK + if (c->lookup_type == 1) { + int div = 1; + for (i=0; i < len; ++i) { + int off = (z / div) % c->lookup_values; + float val = CODEBOOK_ELEMENT_FAST(c,off) + last; + output[i*step] += val; + if (c->sequence_p) last = val; + div *= c->lookup_values; + } + return TRUE; + } +#endif + + z *= c->dimensions; + for (i=0; i < len; ++i) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + output[i*step] += val; + if (c->sequence_p) last = val; + } + + return TRUE; +} + +static int codebook_decode_deinterleave_repeat(vorb *f, Codebook *c, float **outputs, int ch, int *c_inter_p, int *p_inter_p, int len, int total_decode) +{ + int c_inter = *c_inter_p; + int p_inter = *p_inter_p; + int i,z, effective = c->dimensions; + + // type 0 is only legal in a scalar context + if (c->lookup_type == 0) return error(f, VORBIS_invalid_stream); + + while (total_decode > 0) { + float last = CODEBOOK_ELEMENT_BASE(c); + DECODE_VQ(z,f,c); + #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK + assert(!c->sparse || z < c->sorted_entries); + #endif + if (z < 0) { + if (!f->bytes_in_seg) + if (f->last_seg) return FALSE; + return error(f, VORBIS_invalid_stream); + } + + // if this will take us off the end of the buffers, stop short! + // we check by computing the length of the virtual interleaved + // buffer (len*ch), our current offset within it (p_inter*ch)+(c_inter), + // and the length we'll be using (effective) + if (c_inter + p_inter*ch + effective > len * ch) { + effective = len*ch - (p_inter*ch - c_inter); + } + + #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK + if (c->lookup_type == 1) { + int div = 1; + for (i=0; i < effective; ++i) { + int off = (z / div) % c->lookup_values; + float val = CODEBOOK_ELEMENT_FAST(c,off) + last; + outputs[c_inter][p_inter] += val; + if (++c_inter == ch) { c_inter = 0; ++p_inter; } + if (c->sequence_p) last = val; + div *= c->lookup_values; + } + } else + #endif + { + z *= c->dimensions; + if (c->sequence_p) { + for (i=0; i < effective; ++i) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + outputs[c_inter][p_inter] += val; + if (++c_inter == ch) { c_inter = 0; ++p_inter; } + last = val; + } + } else { + for (i=0; i < effective; ++i) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + outputs[c_inter][p_inter] += val; + if (++c_inter == ch) { c_inter = 0; ++p_inter; } + } + } + } + + total_decode -= effective; + } + *c_inter_p = c_inter; + *p_inter_p = p_inter; + return TRUE; +} + +#ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK +static int codebook_decode_deinterleave_repeat_2(vorb *f, Codebook *c, float **outputs, int *c_inter_p, int *p_inter_p, int len, int total_decode) +{ + int c_inter = *c_inter_p; + int p_inter = *p_inter_p; + int i,z, effective = c->dimensions; + + // type 0 is only legal in a scalar context + if (c->lookup_type == 0) return error(f, VORBIS_invalid_stream); + + while (total_decode > 0) { + float last = CODEBOOK_ELEMENT_BASE(c); + DECODE_VQ(z,f,c); + + if (z < 0) { + if (!f->bytes_in_seg) + if (f->last_seg) return FALSE; + return error(f, VORBIS_invalid_stream); + } + + // if this will take us off the end of the buffers, stop short! + // we check by computing the length of the virtual interleaved + // buffer (len*ch), our current offset within it (p_inter*ch)+(c_inter), + // and the length we'll be using (effective) + if (c_inter + p_inter*2 + effective > len * 2) { + effective = len*2 - (p_inter*2 - c_inter); + } + + { + z *= c->dimensions; + stb_prof(11); + if (c->sequence_p) { + // haven't optimized this case because I don't have any examples + for (i=0; i < effective; ++i) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + outputs[c_inter][p_inter] += val; + if (++c_inter == 2) { c_inter = 0; ++p_inter; } + last = val; + } + } else { + i=0; + if (c_inter == 1) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + outputs[c_inter][p_inter] += val; + c_inter = 0; ++p_inter; + ++i; + } + { + float *z0 = outputs[0]; + float *z1 = outputs[1]; + for (; i+1 < effective;) { + z0[p_inter] += CODEBOOK_ELEMENT_FAST(c,z+i) + last; + z1[p_inter] += CODEBOOK_ELEMENT_FAST(c,z+i+1) + last; + ++p_inter; + i += 2; + } + } + if (i < effective) { + float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; + outputs[c_inter][p_inter] += val; + if (++c_inter == 2) { c_inter = 0; ++p_inter; } + } + } + } + + total_decode -= effective; + } + *c_inter_p = c_inter; + *p_inter_p = p_inter; + return TRUE; +} +#endif + +static int predict_point(int x, int x0, int x1, int y0, int y1) +{ + int dy = y1 - y0; + int adx = x1 - x0; + // @OPTIMIZE: force int division to round in the right direction... is this necessary on x86? + int err = abs(dy) * (x - x0); + int off = err / adx; + return dy < 0 ? y0 - off : y0 + off; +} + +// the following table is block-copied from the specification +static float inverse_db_table[256] = +{ + 1.0649863e-07f, 1.1341951e-07f, 1.2079015e-07f, 1.2863978e-07f, + 1.3699951e-07f, 1.4590251e-07f, 1.5538408e-07f, 1.6548181e-07f, + 1.7623575e-07f, 1.8768855e-07f, 1.9988561e-07f, 2.1287530e-07f, + 2.2670913e-07f, 2.4144197e-07f, 2.5713223e-07f, 2.7384213e-07f, + 2.9163793e-07f, 3.1059021e-07f, 3.3077411e-07f, 3.5226968e-07f, + 3.7516214e-07f, 3.9954229e-07f, 4.2550680e-07f, 4.5315863e-07f, + 4.8260743e-07f, 5.1396998e-07f, 5.4737065e-07f, 5.8294187e-07f, + 6.2082472e-07f, 6.6116941e-07f, 7.0413592e-07f, 7.4989464e-07f, + 7.9862701e-07f, 8.5052630e-07f, 9.0579828e-07f, 9.6466216e-07f, + 1.0273513e-06f, 1.0941144e-06f, 1.1652161e-06f, 1.2409384e-06f, + 1.3215816e-06f, 1.4074654e-06f, 1.4989305e-06f, 1.5963394e-06f, + 1.7000785e-06f, 1.8105592e-06f, 1.9282195e-06f, 2.0535261e-06f, + 2.1869758e-06f, 2.3290978e-06f, 2.4804557e-06f, 2.6416497e-06f, + 2.8133190e-06f, 2.9961443e-06f, 3.1908506e-06f, 3.3982101e-06f, + 3.6190449e-06f, 3.8542308e-06f, 4.1047004e-06f, 4.3714470e-06f, + 4.6555282e-06f, 4.9580707e-06f, 5.2802740e-06f, 5.6234160e-06f, + 5.9888572e-06f, 6.3780469e-06f, 6.7925283e-06f, 7.2339451e-06f, + 7.7040476e-06f, 8.2047000e-06f, 8.7378876e-06f, 9.3057248e-06f, + 9.9104632e-06f, 1.0554501e-05f, 1.1240392e-05f, 1.1970856e-05f, + 1.2748789e-05f, 1.3577278e-05f, 1.4459606e-05f, 1.5399272e-05f, + 1.6400004e-05f, 1.7465768e-05f, 1.8600792e-05f, 1.9809576e-05f, + 2.1096914e-05f, 2.2467911e-05f, 2.3928002e-05f, 2.5482978e-05f, + 2.7139006e-05f, 2.8902651e-05f, 3.0780908e-05f, 3.2781225e-05f, + 3.4911534e-05f, 3.7180282e-05f, 3.9596466e-05f, 4.2169667e-05f, + 4.4910090e-05f, 4.7828601e-05f, 5.0936773e-05f, 5.4246931e-05f, + 5.7772202e-05f, 6.1526565e-05f, 6.5524908e-05f, 6.9783085e-05f, + 7.4317983e-05f, 7.9147585e-05f, 8.4291040e-05f, 8.9768747e-05f, + 9.5602426e-05f, 0.00010181521f, 0.00010843174f, 0.00011547824f, + 0.00012298267f, 0.00013097477f, 0.00013948625f, 0.00014855085f, + 0.00015820453f, 0.00016848555f, 0.00017943469f, 0.00019109536f, + 0.00020351382f, 0.00021673929f, 0.00023082423f, 0.00024582449f, + 0.00026179955f, 0.00027881276f, 0.00029693158f, 0.00031622787f, + 0.00033677814f, 0.00035866388f, 0.00038197188f, 0.00040679456f, + 0.00043323036f, 0.00046138411f, 0.00049136745f, 0.00052329927f, + 0.00055730621f, 0.00059352311f, 0.00063209358f, 0.00067317058f, + 0.00071691700f, 0.00076350630f, 0.00081312324f, 0.00086596457f, + 0.00092223983f, 0.00098217216f, 0.0010459992f, 0.0011139742f, + 0.0011863665f, 0.0012634633f, 0.0013455702f, 0.0014330129f, + 0.0015261382f, 0.0016253153f, 0.0017309374f, 0.0018434235f, + 0.0019632195f, 0.0020908006f, 0.0022266726f, 0.0023713743f, + 0.0025254795f, 0.0026895994f, 0.0028643847f, 0.0030505286f, + 0.0032487691f, 0.0034598925f, 0.0036847358f, 0.0039241906f, + 0.0041792066f, 0.0044507950f, 0.0047400328f, 0.0050480668f, + 0.0053761186f, 0.0057254891f, 0.0060975636f, 0.0064938176f, + 0.0069158225f, 0.0073652516f, 0.0078438871f, 0.0083536271f, + 0.0088964928f, 0.009474637f, 0.010090352f, 0.010746080f, + 0.011444421f, 0.012188144f, 0.012980198f, 0.013823725f, + 0.014722068f, 0.015678791f, 0.016697687f, 0.017782797f, + 0.018938423f, 0.020169149f, 0.021479854f, 0.022875735f, + 0.024362330f, 0.025945531f, 0.027631618f, 0.029427276f, + 0.031339626f, 0.033376252f, 0.035545228f, 0.037855157f, + 0.040315199f, 0.042935108f, 0.045725273f, 0.048696758f, + 0.051861348f, 0.055231591f, 0.058820850f, 0.062643361f, + 0.066714279f, 0.071049749f, 0.075666962f, 0.080584227f, + 0.085821044f, 0.091398179f, 0.097337747f, 0.10366330f, + 0.11039993f, 0.11757434f, 0.12521498f, 0.13335215f, + 0.14201813f, 0.15124727f, 0.16107617f, 0.17154380f, + 0.18269168f, 0.19456402f, 0.20720788f, 0.22067342f, + 0.23501402f, 0.25028656f, 0.26655159f, 0.28387361f, + 0.30232132f, 0.32196786f, 0.34289114f, 0.36517414f, + 0.38890521f, 0.41417847f, 0.44109412f, 0.46975890f, + 0.50028648f, 0.53279791f, 0.56742212f, 0.60429640f, + 0.64356699f, 0.68538959f, 0.72993007f, 0.77736504f, + 0.82788260f, 0.88168307f, 0.9389798f, 1.0f +}; + + +// @OPTIMIZE: if you want to replace this bresenham line-drawing routine, +// note that you must produce bit-identical output to decode correctly; +// this specific sequence of operations is specified in the spec (it's +// drawing integer-quantized frequency-space lines that the encoder +// expects to be exactly the same) +// ... also, isn't the whole point of Bresenham's algorithm to NOT +// have to divide in the setup? sigh. +#ifndef STB_VORBIS_NO_DEFER_FLOOR +#define LINE_OP(a,b) a *= b +#else +#define LINE_OP(a,b) a = b +#endif + +#ifdef STB_VORBIS_DIVIDE_TABLE +#define DIVTAB_NUMER 32 +#define DIVTAB_DENOM 64 +int8 integer_divide_table[DIVTAB_NUMER][DIVTAB_DENOM]; // 2KB +#endif + +static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n) +{ + int dy = y1 - y0; + int adx = x1 - x0; + int ady = abs(dy); + int base; + int x=x0,y=y0; + int err = 0; + int sy; + +#ifdef STB_VORBIS_DIVIDE_TABLE + if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) { + if (dy < 0) { + base = -integer_divide_table[ady][adx]; + sy = base-1; + } else { + base = integer_divide_table[ady][adx]; + sy = base+1; + } + } else { + base = dy / adx; + if (dy < 0) + sy = base - 1; + else + sy = base+1; + } +#else + base = dy / adx; + if (dy < 0) + sy = base - 1; + else + sy = base+1; +#endif + ady -= abs(base) * adx; + if (x1 > n) x1 = n; + LINE_OP(output[x], inverse_db_table[y]); + for (++x; x < x1; ++x) { + err += ady; + if (err >= adx) { + err -= adx; + y += sy; + } else + y += base; + LINE_OP(output[x], inverse_db_table[y]); + } +} + +static int residue_decode(vorb *f, Codebook *book, float *target, int offset, int n, int rtype) +{ + int k; + if (rtype == 0) { + int step = n / book->dimensions; + for (k=0; k < step; ++k) + if (!codebook_decode_step(f, book, target+offset+k, n-offset-k, step)) + return FALSE; + } else { + for (k=0; k < n; ) { + if (!codebook_decode(f, book, target+offset, n-k)) + return FALSE; + k += book->dimensions; + offset += book->dimensions; + } + } + return TRUE; +} + +static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int rn, uint8 *do_not_decode) +{ + int i,j,pass; + Residue *r = f->residue_config + rn; + int rtype = f->residue_types[rn]; + int c = r->classbook; + int classwords = f->codebooks[c].dimensions; + int n_read = r->end - r->begin; + int part_read = n_read / r->part_size; + int temp_alloc_point = temp_alloc_save(f); + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + uint8 ***part_classdata = (uint8 ***) temp_block_array(f,f->channels, part_read * sizeof(**part_classdata)); + #else + int **classifications = (int **) temp_block_array(f,f->channels, part_read * sizeof(**classifications)); + #endif + + stb_prof(2); + for (i=0; i < ch; ++i) + if (!do_not_decode[i]) + memset(residue_buffers[i], 0, sizeof(float) * n); + + if (rtype == 2 && ch != 1) { + int len = ch * n; + for (j=0; j < ch; ++j) + if (!do_not_decode[j]) + break; + if (j == ch) + goto done; + + stb_prof(3); + for (pass=0; pass < 8; ++pass) { + int pcount = 0, class_set = 0; + if (ch == 2) { + stb_prof(13); + while (pcount < part_read) { + int z = r->begin + pcount*r->part_size; + int c_inter = (z & 1), p_inter = z>>1; + if (pass == 0) { + Codebook *c = f->codebooks+r->classbook; + int q; + DECODE(q,f,c); + if (q == EOP) goto done; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + part_classdata[0][class_set] = r->classdata[q]; + #else + for (i=classwords-1; i >= 0; --i) { + classifications[0][i+pcount] = q % r->classifications; + q /= r->classifications; + } + #endif + } + stb_prof(5); + for (i=0; i < classwords && pcount < part_read; ++i, ++pcount) { + int z = r->begin + pcount*r->part_size; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + int c = part_classdata[0][class_set][i]; + #else + int c = classifications[0][pcount]; + #endif + int b = r->residue_books[c][pass]; + if (b >= 0) { + Codebook *book = f->codebooks + b; + stb_prof(20); // accounts for X time + #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK + if (!codebook_decode_deinterleave_repeat(f, book, residue_buffers, ch, &c_inter, &p_inter, n, r->part_size)) + goto done; + #else + // saves 1% + if (!codebook_decode_deinterleave_repeat_2(f, book, residue_buffers, &c_inter, &p_inter, n, r->part_size)) + goto done; + #endif + stb_prof(7); + } else { + z += r->part_size; + c_inter = z & 1; + p_inter = z >> 1; + } + } + stb_prof(8); + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + ++class_set; + #endif + } + } else if (ch == 1) { + while (pcount < part_read) { + int z = r->begin + pcount*r->part_size; + int c_inter = 0, p_inter = z; + if (pass == 0) { + Codebook *c = f->codebooks+r->classbook; + int q; + DECODE(q,f,c); + if (q == EOP) goto done; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + part_classdata[0][class_set] = r->classdata[q]; + #else + for (i=classwords-1; i >= 0; --i) { + classifications[0][i+pcount] = q % r->classifications; + q /= r->classifications; + } + #endif + } + for (i=0; i < classwords && pcount < part_read; ++i, ++pcount) { + int z = r->begin + pcount*r->part_size; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + int c = part_classdata[0][class_set][i]; + #else + int c = classifications[0][pcount]; + #endif + int b = r->residue_books[c][pass]; + if (b >= 0) { + Codebook *book = f->codebooks + b; + stb_prof(22); + if (!codebook_decode_deinterleave_repeat(f, book, residue_buffers, ch, &c_inter, &p_inter, n, r->part_size)) + goto done; + stb_prof(3); + } else { + z += r->part_size; + c_inter = 0; + p_inter = z; + } + } + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + ++class_set; + #endif + } + } else { + while (pcount < part_read) { + int z = r->begin + pcount*r->part_size; + int c_inter = z % ch, p_inter = z/ch; + if (pass == 0) { + Codebook *c = f->codebooks+r->classbook; + int q; + DECODE(q,f,c); + if (q == EOP) goto done; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + part_classdata[0][class_set] = r->classdata[q]; + #else + for (i=classwords-1; i >= 0; --i) { + classifications[0][i+pcount] = q % r->classifications; + q /= r->classifications; + } + #endif + } + for (i=0; i < classwords && pcount < part_read; ++i, ++pcount) { + int z = r->begin + pcount*r->part_size; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + int c = part_classdata[0][class_set][i]; + #else + int c = classifications[0][pcount]; + #endif + int b = r->residue_books[c][pass]; + if (b >= 0) { + Codebook *book = f->codebooks + b; + stb_prof(22); + if (!codebook_decode_deinterleave_repeat(f, book, residue_buffers, ch, &c_inter, &p_inter, n, r->part_size)) + goto done; + stb_prof(3); + } else { + z += r->part_size; + c_inter = z % ch; + p_inter = z / ch; + } + } + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + ++class_set; + #endif + } + } + } + goto done; + } + stb_prof(9); + + for (pass=0; pass < 8; ++pass) { + int pcount = 0, class_set=0; + while (pcount < part_read) { + if (pass == 0) { + for (j=0; j < ch; ++j) { + if (!do_not_decode[j]) { + Codebook *c = f->codebooks+r->classbook; + int temp; + DECODE(temp,f,c); + if (temp == EOP) goto done; + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + part_classdata[j][class_set] = r->classdata[temp]; + #else + for (i=classwords-1; i >= 0; --i) { + classifications[j][i+pcount] = temp % r->classifications; + temp /= r->classifications; + } + #endif + } + } + } + for (i=0; i < classwords && pcount < part_read; ++i, ++pcount) { + for (j=0; j < ch; ++j) { + if (!do_not_decode[j]) { + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + int c = part_classdata[j][class_set][i]; + #else + int c = classifications[j][pcount]; + #endif + int b = r->residue_books[c][pass]; + if (b >= 0) { + float *target = residue_buffers[j]; + int offset = r->begin + pcount * r->part_size; + int n = r->part_size; + Codebook *book = f->codebooks + b; + if (!residue_decode(f, book, target, offset, n, rtype)) + goto done; + } + } + } + } + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + ++class_set; + #endif + } + } + done: + stb_prof(0); + temp_alloc_restore(f,temp_alloc_point); +} + + +#if 0 +// slow way for debugging +void inverse_mdct_slow(float *buffer, int n) +{ + int i,j; + int n2 = n >> 1; + float *x = (float *) malloc(sizeof(*x) * n2); + memcpy(x, buffer, sizeof(*x) * n2); + for (i=0; i < n; ++i) { + float acc = 0; + for (j=0; j < n2; ++j) + // formula from paper: + //acc += n/4.0f * x[j] * (float) cos(M_PI / 2 / n * (2 * i + 1 + n/2.0)*(2*j+1)); + // formula from wikipedia + //acc += 2.0f / n2 * x[j] * (float) cos(M_PI/n2 * (i + 0.5 + n2/2)*(j + 0.5)); + // these are equivalent, except the formula from the paper inverts the multiplier! + // however, what actually works is NO MULTIPLIER!?! + //acc += 64 * 2.0f / n2 * x[j] * (float) cos(M_PI/n2 * (i + 0.5 + n2/2)*(j + 0.5)); + acc += x[j] * (float) cos(M_PI / 2 / n * (2 * i + 1 + n/2.0)*(2*j+1)); + buffer[i] = acc; + } + free(x); +} +#elif 0 +// same as above, but just barely able to run in real time on modern machines +void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype) +{ + float mcos[16384]; + int i,j; + int n2 = n >> 1, nmask = (n << 2) -1; + float *x = (float *) malloc(sizeof(*x) * n2); + memcpy(x, buffer, sizeof(*x) * n2); + for (i=0; i < 4*n; ++i) + mcos[i] = (float) cos(M_PI / 2 * i / n); + + for (i=0; i < n; ++i) { + float acc = 0; + for (j=0; j < n2; ++j) + acc += x[j] * mcos[(2 * i + 1 + n2)*(2*j+1) & nmask]; + buffer[i] = acc; + } + free(x); +} +#else +// transform to use a slow dct-iv; this is STILL basically trivial, +// but only requires half as many ops +void dct_iv_slow(float *buffer, int n) +{ + float mcos[16384]; + float x[2048]; + int i,j; + int n2 = n >> 1, nmask = (n << 3) - 1; + memcpy(x, buffer, sizeof(*x) * n); + for (i=0; i < 8*n; ++i) + mcos[i] = (float) cos(M_PI / 4 * i / n); + for (i=0; i < n; ++i) { + float acc = 0; + for (j=0; j < n; ++j) + acc += x[j] * mcos[((2 * i + 1)*(2*j+1)) & nmask]; + //acc += x[j] * cos(M_PI / n * (i + 0.5) * (j + 0.5)); + buffer[i] = acc; + } + free(x); +} + +void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype) +{ + int i, n4 = n >> 2, n2 = n >> 1, n3_4 = n - n4; + float temp[4096]; + + memcpy(temp, buffer, n2 * sizeof(float)); + dct_iv_slow(temp, n2); // returns -c'-d, a-b' + + for (i=0; i < n4 ; ++i) buffer[i] = temp[i+n4]; // a-b' + for ( ; i < n3_4; ++i) buffer[i] = -temp[n3_4 - i - 1]; // b-a', c+d' + for ( ; i < n ; ++i) buffer[i] = -temp[i - n3_4]; // c'+d +} +#endif + +#ifndef LIBVORBIS_MDCT +#define LIBVORBIS_MDCT 0 +#endif + +#if LIBVORBIS_MDCT +// directly call the vorbis MDCT using an interface documented +// by Jeff Roberts... useful for performance comparison +typedef struct +{ + int n; + int log2n; + + float *trig; + int *bitrev; + + float scale; +} mdct_lookup; + +extern void mdct_init(mdct_lookup *lookup, int n); +extern void mdct_clear(mdct_lookup *l); +extern void mdct_backward(mdct_lookup *init, float *in, float *out); + +mdct_lookup M1,M2; + +void inverse_mdct(float *buffer, int n, vorb *f, int blocktype) +{ + mdct_lookup *M; + if (M1.n == n) M = &M1; + else if (M2.n == n) M = &M2; + else if (M1.n == 0) { mdct_init(&M1, n); M = &M1; } + else { + if (M2.n) __asm int 3; + mdct_init(&M2, n); + M = &M2; + } + + mdct_backward(M, buffer, buffer); +} +#endif + + +// the following were split out into separate functions while optimizing; +// they could be pushed back up but eh. __forceinline showed no change; +// they're probably already being inlined. +static void imdct_step3_iter0_loop(int n, float *e, int i_off, int k_off, float *A) +{ + float *ee0 = e + i_off; + float *ee2 = ee0 + k_off; + int i; + + assert((n & 3) == 0); + for (i=(n>>2); i > 0; --i) { + float k00_20, k01_21; + k00_20 = ee0[ 0] - ee2[ 0]; + k01_21 = ee0[-1] - ee2[-1]; + ee0[ 0] += ee2[ 0];//ee0[ 0] = ee0[ 0] + ee2[ 0]; + ee0[-1] += ee2[-1];//ee0[-1] = ee0[-1] + ee2[-1]; + ee2[ 0] = k00_20 * A[0] - k01_21 * A[1]; + ee2[-1] = k01_21 * A[0] + k00_20 * A[1]; + A += 8; + + k00_20 = ee0[-2] - ee2[-2]; + k01_21 = ee0[-3] - ee2[-3]; + ee0[-2] += ee2[-2];//ee0[-2] = ee0[-2] + ee2[-2]; + ee0[-3] += ee2[-3];//ee0[-3] = ee0[-3] + ee2[-3]; + ee2[-2] = k00_20 * A[0] - k01_21 * A[1]; + ee2[-3] = k01_21 * A[0] + k00_20 * A[1]; + A += 8; + + k00_20 = ee0[-4] - ee2[-4]; + k01_21 = ee0[-5] - ee2[-5]; + ee0[-4] += ee2[-4];//ee0[-4] = ee0[-4] + ee2[-4]; + ee0[-5] += ee2[-5];//ee0[-5] = ee0[-5] + ee2[-5]; + ee2[-4] = k00_20 * A[0] - k01_21 * A[1]; + ee2[-5] = k01_21 * A[0] + k00_20 * A[1]; + A += 8; + + k00_20 = ee0[-6] - ee2[-6]; + k01_21 = ee0[-7] - ee2[-7]; + ee0[-6] += ee2[-6];//ee0[-6] = ee0[-6] + ee2[-6]; + ee0[-7] += ee2[-7];//ee0[-7] = ee0[-7] + ee2[-7]; + ee2[-6] = k00_20 * A[0] - k01_21 * A[1]; + ee2[-7] = k01_21 * A[0] + k00_20 * A[1]; + A += 8; + ee0 -= 8; + ee2 -= 8; + } +} + +static void imdct_step3_inner_r_loop(int lim, float *e, int d0, int k_off, float *A, int k1) +{ + int i; + float k00_20, k01_21; + + float *e0 = e + d0; + float *e2 = e0 + k_off; + + for (i=lim >> 2; i > 0; --i) { + k00_20 = e0[-0] - e2[-0]; + k01_21 = e0[-1] - e2[-1]; + e0[-0] += e2[-0];//e0[-0] = e0[-0] + e2[-0]; + e0[-1] += e2[-1];//e0[-1] = e0[-1] + e2[-1]; + e2[-0] = (k00_20)*A[0] - (k01_21) * A[1]; + e2[-1] = (k01_21)*A[0] + (k00_20) * A[1]; + + A += k1; + + k00_20 = e0[-2] - e2[-2]; + k01_21 = e0[-3] - e2[-3]; + e0[-2] += e2[-2];//e0[-2] = e0[-2] + e2[-2]; + e0[-3] += e2[-3];//e0[-3] = e0[-3] + e2[-3]; + e2[-2] = (k00_20)*A[0] - (k01_21) * A[1]; + e2[-3] = (k01_21)*A[0] + (k00_20) * A[1]; + + A += k1; + + k00_20 = e0[-4] - e2[-4]; + k01_21 = e0[-5] - e2[-5]; + e0[-4] += e2[-4];//e0[-4] = e0[-4] + e2[-4]; + e0[-5] += e2[-5];//e0[-5] = e0[-5] + e2[-5]; + e2[-4] = (k00_20)*A[0] - (k01_21) * A[1]; + e2[-5] = (k01_21)*A[0] + (k00_20) * A[1]; + + A += k1; + + k00_20 = e0[-6] - e2[-6]; + k01_21 = e0[-7] - e2[-7]; + e0[-6] += e2[-6];//e0[-6] = e0[-6] + e2[-6]; + e0[-7] += e2[-7];//e0[-7] = e0[-7] + e2[-7]; + e2[-6] = (k00_20)*A[0] - (k01_21) * A[1]; + e2[-7] = (k01_21)*A[0] + (k00_20) * A[1]; + + e0 -= 8; + e2 -= 8; + + A += k1; + } +} + +static void imdct_step3_inner_s_loop(int n, float *e, int i_off, int k_off, float *A, int a_off, int k0) +{ + int i; + float A0 = A[0]; + float A1 = A[0+1]; + float A2 = A[0+a_off]; + float A3 = A[0+a_off+1]; + float A4 = A[0+a_off*2+0]; + float A5 = A[0+a_off*2+1]; + float A6 = A[0+a_off*3+0]; + float A7 = A[0+a_off*3+1]; + + float k00,k11; + + float *ee0 = e +i_off; + float *ee2 = ee0+k_off; + + for (i=n; i > 0; --i) { + k00 = ee0[ 0] - ee2[ 0]; + k11 = ee0[-1] - ee2[-1]; + ee0[ 0] = ee0[ 0] + ee2[ 0]; + ee0[-1] = ee0[-1] + ee2[-1]; + ee2[ 0] = (k00) * A0 - (k11) * A1; + ee2[-1] = (k11) * A0 + (k00) * A1; + + k00 = ee0[-2] - ee2[-2]; + k11 = ee0[-3] - ee2[-3]; + ee0[-2] = ee0[-2] + ee2[-2]; + ee0[-3] = ee0[-3] + ee2[-3]; + ee2[-2] = (k00) * A2 - (k11) * A3; + ee2[-3] = (k11) * A2 + (k00) * A3; + + k00 = ee0[-4] - ee2[-4]; + k11 = ee0[-5] - ee2[-5]; + ee0[-4] = ee0[-4] + ee2[-4]; + ee0[-5] = ee0[-5] + ee2[-5]; + ee2[-4] = (k00) * A4 - (k11) * A5; + ee2[-5] = (k11) * A4 + (k00) * A5; + + k00 = ee0[-6] - ee2[-6]; + k11 = ee0[-7] - ee2[-7]; + ee0[-6] = ee0[-6] + ee2[-6]; + ee0[-7] = ee0[-7] + ee2[-7]; + ee2[-6] = (k00) * A6 - (k11) * A7; + ee2[-7] = (k11) * A6 + (k00) * A7; + + ee0 -= k0; + ee2 -= k0; + } +} + +static __forceinline void iter_54(float *z) +{ + float k00,k11,k22,k33; + float y0,y1,y2,y3; + + k00 = z[ 0] - z[-4]; + y0 = z[ 0] + z[-4]; + y2 = z[-2] + z[-6]; + k22 = z[-2] - z[-6]; + + z[-0] = y0 + y2; // z0 + z4 + z2 + z6 + z[-2] = y0 - y2; // z0 + z4 - z2 - z6 + + // done with y0,y2 + + k33 = z[-3] - z[-7]; + + z[-4] = k00 + k33; // z0 - z4 + z3 - z7 + z[-6] = k00 - k33; // z0 - z4 - z3 + z7 + + // done with k33 + + k11 = z[-1] - z[-5]; + y1 = z[-1] + z[-5]; + y3 = z[-3] + z[-7]; + + z[-1] = y1 + y3; // z1 + z5 + z3 + z7 + z[-3] = y1 - y3; // z1 + z5 - z3 - z7 + z[-5] = k11 - k22; // z1 - z5 + z2 - z6 + z[-7] = k11 + k22; // z1 - z5 - z2 + z6 +} + +static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, float *A, int base_n) +{ + int k_off = -8; + int a_off = base_n >> 3; + float A2 = A[0+a_off]; + float *z = e + i_off; + float *base = z - 16 * n; + + while (z > base) { + float k00,k11; + + k00 = z[-0] - z[-8]; + k11 = z[-1] - z[-9]; + z[-0] = z[-0] + z[-8]; + z[-1] = z[-1] + z[-9]; + z[-8] = k00; + z[-9] = k11 ; + + k00 = z[ -2] - z[-10]; + k11 = z[ -3] - z[-11]; + z[ -2] = z[ -2] + z[-10]; + z[ -3] = z[ -3] + z[-11]; + z[-10] = (k00+k11) * A2; + z[-11] = (k11-k00) * A2; + + k00 = z[-12] - z[ -4]; // reverse to avoid a unary negation + k11 = z[ -5] - z[-13]; + z[ -4] = z[ -4] + z[-12]; + z[ -5] = z[ -5] + z[-13]; + z[-12] = k11; + z[-13] = k00; + + k00 = z[-14] - z[ -6]; // reverse to avoid a unary negation + k11 = z[ -7] - z[-15]; + z[ -6] = z[ -6] + z[-14]; + z[ -7] = z[ -7] + z[-15]; + z[-14] = (k00+k11) * A2; + z[-15] = (k00-k11) * A2; + + iter_54(z); + iter_54(z-8); + z -= 16; + } +} + +static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype) +{ + int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, l; + int n3_4 = n - n4, ld; + // @OPTIMIZE: reduce register pressure by using fewer variables? + int save_point = temp_alloc_save(f); + float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2)); + float *u=NULL,*v=NULL; + // twiddle factors + float *A = f->A[blocktype]; + + // IMDCT algorithm from "The use of multirate filter banks for coding of high quality digital audio" + // See notes about bugs in that paper in less-optimal implementation 'inverse_mdct_old' after this function. + + // kernel from paper + + + // merged: + // copy and reflect spectral data + // step 0 + + // note that it turns out that the items added together during + // this step are, in fact, being added to themselves (as reflected + // by step 0). inexplicable inefficiency! this became obvious + // once I combined the passes. + + // so there's a missing 'times 2' here (for adding X to itself). + // this propogates through linearly to the end, where the numbers + // are 1/2 too small, and need to be compensated for. + + { + float *d,*e, *AA, *e_stop; + d = &buf2[n2-2]; + AA = A; + e = &buffer[0]; + e_stop = &buffer[n2]; + while (e != e_stop) { + d[1] = (e[0] * AA[0] - e[2]*AA[1]); + d[0] = (e[0] * AA[1] + e[2]*AA[0]); + d -= 2; + AA += 2; + e += 4; + } + + e = &buffer[n2-3]; + while (d >= buf2) { + d[1] = (-e[2] * AA[0] - -e[0]*AA[1]); + d[0] = (-e[2] * AA[1] + -e[0]*AA[0]); + d -= 2; + AA += 2; + e -= 4; + } + } + + // now we use symbolic names for these, so that we can + // possibly swap their meaning as we change which operations + // are in place + + u = buffer; + v = buf2; + + // step 2 (paper output is w, now u) + // this could be in place, but the data ends up in the wrong + // place... _somebody_'s got to swap it, so this is nominated + { + float *AA = &A[n2-8]; + float *d0,*d1, *e0, *e1; + + e0 = &v[n4]; + e1 = &v[0]; + + d0 = &u[n4]; + d1 = &u[0]; + + while (AA >= A) { + float v40_20, v41_21; + + v41_21 = e0[1] - e1[1]; + v40_20 = e0[0] - e1[0]; + d0[1] = e0[1] + e1[1]; + d0[0] = e0[0] + e1[0]; + d1[1] = v41_21*AA[4] - v40_20*AA[5]; + d1[0] = v40_20*AA[4] + v41_21*AA[5]; + + v41_21 = e0[3] - e1[3]; + v40_20 = e0[2] - e1[2]; + d0[3] = e0[3] + e1[3]; + d0[2] = e0[2] + e1[2]; + d1[3] = v41_21*AA[0] - v40_20*AA[1]; + d1[2] = v40_20*AA[0] + v41_21*AA[1]; + + AA -= 8; + + d0 += 4; + d1 += 4; + e0 += 4; + e1 += 4; + } + } + + // step 3 + ld = ilog(n) - 1; // ilog is off-by-one from normal definitions + + // optimized step 3: + + // the original step3 loop can be nested r inside s or s inside r; + // it's written originally as s inside r, but this is dumb when r + // iterates many times, and s few. So I have two copies of it and + // switch between them halfway. + + // this is iteration 0 of step 3 + imdct_step3_iter0_loop(n >> 4, u, n2-1-n4*0, -(n >> 3), A); + imdct_step3_iter0_loop(n >> 4, u, n2-1-n4*1, -(n >> 3), A); + + // this is iteration 1 of step 3 + imdct_step3_inner_r_loop(n >> 5, u, n2-1 - n8*0, -(n >> 4), A, 16); + imdct_step3_inner_r_loop(n >> 5, u, n2-1 - n8*1, -(n >> 4), A, 16); + imdct_step3_inner_r_loop(n >> 5, u, n2-1 - n8*2, -(n >> 4), A, 16); + imdct_step3_inner_r_loop(n >> 5, u, n2-1 - n8*3, -(n >> 4), A, 16); + + l=2; + for (; l < (ld-3)>>1; ++l) { + int k0 = n >> (l+2), k0_2 = k0>>1; + int lim = 1 << (l+1); + int i; + for (i=0; i < lim; ++i) + imdct_step3_inner_r_loop(n >> (l+4), u, n2-1 - k0*i, -k0_2, A, 1 << (l+3)); + } + + for (; l < ld-6; ++l) { + int k0 = n >> (l+2), k1 = 1 << (l+3), k0_2 = k0>>1; + int rlim = n >> (l+6), r; + int lim = 1 << (l+1); + int i_off; + float *A0 = A; + i_off = n2-1; + for (r=rlim; r > 0; --r) { + imdct_step3_inner_s_loop(lim, u, i_off, -k0_2, A0, k1, k0); + A0 += k1*4; + i_off -= 8; + } + } + + // iterations with count: + // ld-6,-5,-4 all interleaved together + // the big win comes from getting rid of needless flops + // due to the constants on pass 5 & 4 being all 1 and 0; + // combining them to be simultaneous to improve cache made little difference + imdct_step3_inner_s_loop_ld654(n >> 5, u, n2-1, A, n); + + // output is u + + // step 4, 5, and 6 + // cannot be in-place because of step 5 + { + uint16 *bitrev = f->bit_reverse[blocktype]; + // weirdly, I'd have thought reading sequentially and writing + // erratically would have been better than vice-versa, but in + // fact that's not what my testing showed. (That is, with + // j = bitreverse(i), do you read i and write j, or read j and write i.) + + float *d0 = &v[n4-4]; + float *d1 = &v[n2-4]; + while (d0 >= v) { + int k4; + + k4 = bitrev[0]; + d1[3] = u[k4+0]; + d1[2] = u[k4+1]; + d0[3] = u[k4+2]; + d0[2] = u[k4+3]; + + k4 = bitrev[1]; + d1[1] = u[k4+0]; + d1[0] = u[k4+1]; + d0[1] = u[k4+2]; + d0[0] = u[k4+3]; + + d0 -= 4; + d1 -= 4; + bitrev += 2; + } + } + // (paper output is u, now v) + + + // data must be in buf2 + assert(v == buf2); + + // step 7 (paper output is v, now v) + // this is now in place + { + float *C = f->C[blocktype]; + float *d, *e; + + d = v; + e = v + n2 - 4; + + while (d < e) { + float a02,a11,b0,b1,b2,b3; + + a02 = d[0] - e[2]; + a11 = d[1] + e[3]; + + b0 = C[1]*a02 + C[0]*a11; + b1 = C[1]*a11 - C[0]*a02; + + b2 = d[0] + e[ 2]; + b3 = d[1] - e[ 3]; + + d[0] = b2 + b0; + d[1] = b3 + b1; + e[2] = b2 - b0; + e[3] = b1 - b3; + + a02 = d[2] - e[0]; + a11 = d[3] + e[1]; + + b0 = C[3]*a02 + C[2]*a11; + b1 = C[3]*a11 - C[2]*a02; + + b2 = d[2] + e[ 0]; + b3 = d[3] - e[ 1]; + + d[2] = b2 + b0; + d[3] = b3 + b1; + e[0] = b2 - b0; + e[1] = b1 - b3; + + C += 4; + d += 4; + e -= 4; + } + } + + // data must be in buf2 + + + // step 8+decode (paper output is X, now buffer) + // this generates pairs of data a la 8 and pushes them directly through + // the decode kernel (pushing rather than pulling) to avoid having + // to make another pass later + + // this cannot POSSIBLY be in place, so we refer to the buffers directly + + { + float *d0,*d1,*d2,*d3; + + float *B = f->B[blocktype] + n2 - 8; + float *e = buf2 + n2 - 8; + d0 = &buffer[0]; + d1 = &buffer[n2-4]; + d2 = &buffer[n2]; + d3 = &buffer[n-4]; + while (e >= v) { + float p0,p1,p2,p3; + + p3 = e[6]*B[7] - e[7]*B[6]; + p2 = -e[6]*B[6] - e[7]*B[7]; + + d0[0] = p3; + d1[3] = - p3; + d2[0] = p2; + d3[3] = p2; + + p1 = e[4]*B[5] - e[5]*B[4]; + p0 = -e[4]*B[4] - e[5]*B[5]; + + d0[1] = p1; + d1[2] = - p1; + d2[1] = p0; + d3[2] = p0; + + p3 = e[2]*B[3] - e[3]*B[2]; + p2 = -e[2]*B[2] - e[3]*B[3]; + + d0[2] = p3; + d1[1] = - p3; + d2[2] = p2; + d3[1] = p2; + + p1 = e[0]*B[1] - e[1]*B[0]; + p0 = -e[0]*B[0] - e[1]*B[1]; + + d0[3] = p1; + d1[0] = - p1; + d2[3] = p0; + d3[0] = p0; + + B -= 8; + e -= 8; + d0 += 4; + d2 += 4; + d1 -= 4; + d3 -= 4; + } + } + + temp_alloc_restore(f,save_point); +} + +#if 0 +// this is the original version of the above code, if you want to optimize it from scratch +void inverse_mdct_naive(float *buffer, int n) +{ + float s; + float A[1 << 12], B[1 << 12], C[1 << 11]; + int i,k,k2,k4, n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, l; + int n3_4 = n - n4, ld; + // how can they claim this only uses N words?! + // oh, because they're only used sparsely, whoops + float u[1 << 13], X[1 << 13], v[1 << 13], w[1 << 13]; + // set up twiddle factors + + for (k=k2=0; k < n4; ++k,k2+=2) { + A[k2 ] = (float) cos(4*k*M_PI/n); + A[k2+1] = (float) -sin(4*k*M_PI/n); + B[k2 ] = (float) cos((k2+1)*M_PI/n/2); + B[k2+1] = (float) sin((k2+1)*M_PI/n/2); + } + for (k=k2=0; k < n8; ++k,k2+=2) { + C[k2 ] = (float) cos(2*(k2+1)*M_PI/n); + C[k2+1] = (float) -sin(2*(k2+1)*M_PI/n); + } + + // IMDCT algorithm from "The use of multirate filter banks for coding of high quality digital audio" + // Note there are bugs in that pseudocode, presumably due to them attempting + // to rename the arrays nicely rather than representing the way their actual + // implementation bounces buffers back and forth. As a result, even in the + // "some formulars corrected" version, a direct implementation fails. These + // are noted below as "paper bug". + + // copy and reflect spectral data + for (k=0; k < n2; ++k) u[k] = buffer[k]; + for ( ; k < n ; ++k) u[k] = -buffer[n - k - 1]; + // kernel from paper + // step 1 + for (k=k2=k4=0; k < n4; k+=1, k2+=2, k4+=4) { + v[n-k4-1] = (u[k4] - u[n-k4-1]) * A[k2] - (u[k4+2] - u[n-k4-3])*A[k2+1]; + v[n-k4-3] = (u[k4] - u[n-k4-1]) * A[k2+1] + (u[k4+2] - u[n-k4-3])*A[k2]; + } + // step 2 + for (k=k4=0; k < n8; k+=1, k4+=4) { + w[n2+3+k4] = v[n2+3+k4] + v[k4+3]; + w[n2+1+k4] = v[n2+1+k4] + v[k4+1]; + w[k4+3] = (v[n2+3+k4] - v[k4+3])*A[n2-4-k4] - (v[n2+1+k4]-v[k4+1])*A[n2-3-k4]; + w[k4+1] = (v[n2+1+k4] - v[k4+1])*A[n2-4-k4] + (v[n2+3+k4]-v[k4+3])*A[n2-3-k4]; + } + // step 3 + ld = ilog(n) - 1; // ilog is off-by-one from normal definitions + for (l=0; l < ld-3; ++l) { + int k0 = n >> (l+2), k1 = 1 << (l+3); + int rlim = n >> (l+4), r4, r; + int s2lim = 1 << (l+2), s2; + for (r=r4=0; r < rlim; r4+=4,++r) { + for (s2=0; s2 < s2lim; s2+=2) { + u[n-1-k0*s2-r4] = w[n-1-k0*s2-r4] + w[n-1-k0*(s2+1)-r4]; + u[n-3-k0*s2-r4] = w[n-3-k0*s2-r4] + w[n-3-k0*(s2+1)-r4]; + u[n-1-k0*(s2+1)-r4] = (w[n-1-k0*s2-r4] - w[n-1-k0*(s2+1)-r4]) * A[r*k1] + - (w[n-3-k0*s2-r4] - w[n-3-k0*(s2+1)-r4]) * A[r*k1+1]; + u[n-3-k0*(s2+1)-r4] = (w[n-3-k0*s2-r4] - w[n-3-k0*(s2+1)-r4]) * A[r*k1] + + (w[n-1-k0*s2-r4] - w[n-1-k0*(s2+1)-r4]) * A[r*k1+1]; + } + } + if (l+1 < ld-3) { + // paper bug: ping-ponging of u&w here is omitted + memcpy(w, u, sizeof(u)); + } + } + + // step 4 + for (i=0; i < n8; ++i) { + int j = bit_reverse(i) >> (32-ld+3); + assert(j < n8); + if (i == j) { + // paper bug: original code probably swapped in place; if copying, + // need to directly copy in this case + int i8 = i << 3; + v[i8+1] = u[i8+1]; + v[i8+3] = u[i8+3]; + v[i8+5] = u[i8+5]; + v[i8+7] = u[i8+7]; + } else if (i < j) { + int i8 = i << 3, j8 = j << 3; + v[j8+1] = u[i8+1], v[i8+1] = u[j8 + 1]; + v[j8+3] = u[i8+3], v[i8+3] = u[j8 + 3]; + v[j8+5] = u[i8+5], v[i8+5] = u[j8 + 5]; + v[j8+7] = u[i8+7], v[i8+7] = u[j8 + 7]; + } + } + // step 5 + for (k=0; k < n2; ++k) { + w[k] = v[k*2+1]; + } + // step 6 + for (k=k2=k4=0; k < n8; ++k, k2 += 2, k4 += 4) { + u[n-1-k2] = w[k4]; + u[n-2-k2] = w[k4+1]; + u[n3_4 - 1 - k2] = w[k4+2]; + u[n3_4 - 2 - k2] = w[k4+3]; + } + // step 7 + for (k=k2=0; k < n8; ++k, k2 += 2) { + v[n2 + k2 ] = ( u[n2 + k2] + u[n-2-k2] + C[k2+1]*(u[n2+k2]-u[n-2-k2]) + C[k2]*(u[n2+k2+1]+u[n-2-k2+1]))/2; + v[n-2 - k2] = ( u[n2 + k2] + u[n-2-k2] - C[k2+1]*(u[n2+k2]-u[n-2-k2]) - C[k2]*(u[n2+k2+1]+u[n-2-k2+1]))/2; + v[n2+1+ k2] = ( u[n2+1+k2] - u[n-1-k2] + C[k2+1]*(u[n2+1+k2]+u[n-1-k2]) - C[k2]*(u[n2+k2]-u[n-2-k2]))/2; + v[n-1 - k2] = (-u[n2+1+k2] + u[n-1-k2] + C[k2+1]*(u[n2+1+k2]+u[n-1-k2]) - C[k2]*(u[n2+k2]-u[n-2-k2]))/2; + } + // step 8 + for (k=k2=0; k < n4; ++k,k2 += 2) { + X[k] = v[k2+n2]*B[k2 ] + v[k2+1+n2]*B[k2+1]; + X[n2-1-k] = v[k2+n2]*B[k2+1] - v[k2+1+n2]*B[k2 ]; + } + + // decode kernel to output + // determined the following value experimentally + // (by first figuring out what made inverse_mdct_slow work); then matching that here + // (probably vorbis encoder premultiplies by n or n/2, to save it on the decoder?) + s = 0.5; // theoretically would be n4 + + // [[[ note! the s value of 0.5 is compensated for by the B[] in the current code, + // so it needs to use the "old" B values to behave correctly, or else + // set s to 1.0 ]]] + for (i=0; i < n4 ; ++i) buffer[i] = s * X[i+n4]; + for ( ; i < n3_4; ++i) buffer[i] = -s * X[n3_4 - i - 1]; + for ( ; i < n ; ++i) buffer[i] = -s * X[i - n3_4]; +} +#endif + +static float *get_window(vorb *f, int len) +{ + len <<= 1; + if (len == f->blocksize_0) return f->window[0]; + if (len == f->blocksize_1) return f->window[1]; + assert(0); + return NULL; +} + +#ifndef STB_VORBIS_NO_DEFER_FLOOR +typedef int16 YTYPE; +#else +typedef int YTYPE; +#endif +static int do_floor(vorb *f, Mapping *map, int i, int n, float *target, YTYPE *finalY, uint8 *step2_flag) +{ + int n2 = n >> 1; + int s = map->chan[i].mux, floor; + floor = map->submap_floor[s]; + if (f->floor_types[floor] == 0) { + return error(f, VORBIS_invalid_stream); + } else { + Floor1 *g = &f->floor_config[floor].floor1; + int j,q; + int lx = 0, ly = finalY[0] * g->floor1_multiplier; + for (q=1; q < g->values; ++q) { + j = g->sorted_order[q]; + #ifndef STB_VORBIS_NO_DEFER_FLOOR + if (finalY[j] >= 0) + #else + if (step2_flag[j]) + #endif + { + int hy = finalY[j] * g->floor1_multiplier; + int hx = g->Xlist[j]; + draw_line(target, lx,ly, hx,hy, n2); + lx = hx, ly = hy; + } + } + if (lx < n2) + // optimization of: draw_line(target, lx,ly, n,ly, n2); + for (j=lx; j < n2; ++j) + LINE_OP(target[j], inverse_db_table[ly]); + } + return TRUE; +} + +static int vorbis_decode_initial(vorb *f, int *p_left_start, int *p_left_end, int *p_right_start, int *p_right_end, int *mode) +{ + Mode *m; + int i, n, prev, next, window_center; + f->channel_buffer_start = f->channel_buffer_end = 0; + + retry: + if (f->eof) return FALSE; + if (!maybe_start_packet(f)) + return FALSE; + // check packet type + if (get_bits(f,1) != 0) { + if (IS_PUSH_MODE(f)) + return error(f,VORBIS_bad_packet_type); + while (EOP != get8_packet(f)); + goto retry; + } + + if (f->alloc.alloc_buffer) + assert(f->alloc.alloc_buffer_length_in_bytes == f->temp_offset); + + i = get_bits(f, ilog(f->mode_count-1)); + if (i == EOP) return FALSE; + if (i >= f->mode_count) return FALSE; + *mode = i; + m = f->mode_config + i; + if (m->blockflag) { + n = f->blocksize_1; + prev = get_bits(f,1); + next = get_bits(f,1); + } else { + prev = next = 0; + n = f->blocksize_0; + } + +// WINDOWING + + window_center = n >> 1; + if (m->blockflag && !prev) { + *p_left_start = (n - f->blocksize_0) >> 2; + *p_left_end = (n + f->blocksize_0) >> 2; + } else { + *p_left_start = 0; + *p_left_end = window_center; + } + if (m->blockflag && !next) { + *p_right_start = (n*3 - f->blocksize_0) >> 2; + *p_right_end = (n*3 + f->blocksize_0) >> 2; + } else { + *p_right_start = window_center; + *p_right_end = n; + } + return TRUE; +} + +static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, int left_end, int right_start, int right_end, int *p_left) +{ + Mapping *map; + int i,j,k,n,n2; + int zero_channel[256]; + int really_zero_channel[256]; + int window_center; + +// WINDOWING + + n = f->blocksize[m->blockflag]; + window_center = n >> 1; + + map = &f->mapping[m->mapping]; + +// FLOORS + n2 = n >> 1; + + stb_prof(1); + for (i=0; i < f->channels; ++i) { + int s = map->chan[i].mux, floor; + zero_channel[i] = FALSE; + floor = map->submap_floor[s]; + if (f->floor_types[floor] == 0) { + return error(f, VORBIS_invalid_stream); + } else { + Floor1 *g = &f->floor_config[floor].floor1; + if (get_bits(f, 1)) { + short *finalY; + uint8 step2_flag[256]; + static int range_list[4] = { 256, 128, 86, 64 }; + int range = range_list[g->floor1_multiplier-1]; + int offset = 2; + finalY = f->finalY[i]; + finalY[0] = get_bits(f, ilog(range)-1); + finalY[1] = get_bits(f, ilog(range)-1); + for (j=0; j < g->partitions; ++j) { + int pclass = g->partition_class_list[j]; + int cdim = g->class_dimensions[pclass]; + int cbits = g->class_subclasses[pclass]; + int csub = (1 << cbits)-1; + int cval = 0; + if (cbits) { + Codebook *c = f->codebooks + g->class_masterbooks[pclass]; + DECODE(cval,f,c); + } + for (k=0; k < cdim; ++k) { + int book = g->subclass_books[pclass][cval & csub]; + cval = cval >> cbits; + if (book >= 0) { + int temp; + Codebook *c = f->codebooks + book; + DECODE(temp,f,c); + finalY[offset++] = temp; + } else + finalY[offset++] = 0; + } + } + if (f->valid_bits == INVALID_BITS) goto error; // behavior according to spec + step2_flag[0] = step2_flag[1] = 1; + for (j=2; j < g->values; ++j) { + int low, high, pred, highroom, lowroom, room, val; + low = g->neighbors[j][0]; + high = g->neighbors[j][1]; + //neighbors(g->Xlist, j, &low, &high); + pred = predict_point(g->Xlist[j], g->Xlist[low], g->Xlist[high], finalY[low], finalY[high]); + val = finalY[j]; + highroom = range - pred; + lowroom = pred; + if (highroom < lowroom) + room = highroom * 2; + else + room = lowroom * 2; + if (val) { + step2_flag[low] = step2_flag[high] = 1; + step2_flag[j] = 1; + if (val >= room) + if (highroom > lowroom) + finalY[j] = val - lowroom + pred; + else + finalY[j] = pred - val + highroom - 1; + else + if (val & 1) + finalY[j] = pred - ((val+1)>>1); + else + finalY[j] = pred + (val>>1); + } else { + step2_flag[j] = 0; + finalY[j] = pred; + } + } + +#ifdef STB_VORBIS_NO_DEFER_FLOOR + do_floor(f, map, i, n, f->floor_buffers[i], finalY, step2_flag); +#else + // defer final floor computation until _after_ residue + for (j=0; j < g->values; ++j) { + if (!step2_flag[j]) + finalY[j] = -1; + } +#endif + } else { + error: + zero_channel[i] = TRUE; + } + // So we just defer everything else to later + + // at this point we've decoded the floor into buffer + } + } + stb_prof(0); + // at this point we've decoded all floors + + if (f->alloc.alloc_buffer) + assert(f->alloc.alloc_buffer_length_in_bytes == f->temp_offset); + + // re-enable coupled channels if necessary + memcpy(really_zero_channel, zero_channel, sizeof(really_zero_channel[0]) * f->channels); + for (i=0; i < map->coupling_steps; ++i) + if (!zero_channel[map->chan[i].magnitude] || !zero_channel[map->chan[i].angle]) { + zero_channel[map->chan[i].magnitude] = zero_channel[map->chan[i].angle] = FALSE; + } + +// RESIDUE DECODE + for (i=0; i < map->submaps; ++i) { + float *residue_buffers[STB_VORBIS_MAX_CHANNELS]; + int r,t; + uint8 do_not_decode[256]; + int ch = 0; + for (j=0; j < f->channels; ++j) { + if (map->chan[j].mux == i) { + if (zero_channel[j]) { + do_not_decode[ch] = TRUE; + residue_buffers[ch] = NULL; + } else { + do_not_decode[ch] = FALSE; + residue_buffers[ch] = f->channel_buffers[j]; + } + ++ch; + } + } + r = map->submap_residue[i]; + t = f->residue_types[r]; + decode_residue(f, residue_buffers, ch, n2, r, do_not_decode); + } + + if (f->alloc.alloc_buffer) + assert(f->alloc.alloc_buffer_length_in_bytes == f->temp_offset); + +// INVERSE COUPLING + stb_prof(14); + for (i = map->coupling_steps-1; i >= 0; --i) { + int n2 = n >> 1; + float *m = f->channel_buffers[map->chan[i].magnitude]; + float *a = f->channel_buffers[map->chan[i].angle ]; + for (j=0; j < n2; ++j) { + float a2,m2; + if (m[j] > 0) + if (a[j] > 0) + m2 = m[j], a2 = m[j] - a[j]; + else + a2 = m[j], m2 = m[j] + a[j]; + else + if (a[j] > 0) + m2 = m[j], a2 = m[j] + a[j]; + else + a2 = m[j], m2 = m[j] - a[j]; + m[j] = m2; + a[j] = a2; + } + } + + // finish decoding the floors +#ifndef STB_VORBIS_NO_DEFER_FLOOR + stb_prof(15); + for (i=0; i < f->channels; ++i) { + if (really_zero_channel[i]) { + memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2); + } else { + do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], NULL); + } + } +#else + for (i=0; i < f->channels; ++i) { + if (really_zero_channel[i]) { + memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2); + } else { + for (j=0; j < n2; ++j) + f->channel_buffers[i][j] *= f->floor_buffers[i][j]; + } + } +#endif + +// INVERSE MDCT + stb_prof(16); + for (i=0; i < f->channels; ++i) + inverse_mdct(f->channel_buffers[i], n, f, m->blockflag); + stb_prof(0); + + // this shouldn't be necessary, unless we exited on an error + // and want to flush to get to the next packet + flush_packet(f); + + if (f->first_decode) { + // assume we start so first non-discarded sample is sample 0 + // this isn't to spec, but spec would require us to read ahead + // and decode the size of all current frames--could be done, + // but presumably it's not a commonly used feature + f->current_loc = -n2; // start of first frame is positioned for discard + // we might have to discard samples "from" the next frame too, + // if we're lapping a large block then a small at the start? + f->discard_samples_deferred = n - right_end; + f->current_loc_valid = TRUE; + f->first_decode = FALSE; + } else if (f->discard_samples_deferred) { + left_start += f->discard_samples_deferred; + *p_left = left_start; + f->discard_samples_deferred = 0; + } else if (f->previous_length == 0 && f->current_loc_valid) { + // we're recovering from a seek... that means we're going to discard + // the samples from this packet even though we know our position from + // the last page header, so we need to update the position based on + // the discarded samples here + // but wait, the code below is going to add this in itself even + // on a discard, so we don't need to do it here... + } + + // check if we have ogg information about the sample # for this packet + if (f->last_seg_which == f->end_seg_with_known_loc) { + // if we have a valid current loc, and this is final: + if (f->current_loc_valid && (f->page_flag & PAGEFLAG_last_page)) { + uint32 current_end = f->known_loc_for_packet - (n-right_end); + // then let's infer the size of the (probably) short final frame + if (current_end < f->current_loc + right_end) { + if (current_end < f->current_loc) { + // negative truncation, that's impossible! + *len = 0; + } else { + *len = current_end - f->current_loc; + } + *len += left_start; + f->current_loc += *len; + return TRUE; + } + } + // otherwise, just set our sample loc + // guess that the ogg granule pos refers to the _middle_ of the + // last frame? + // set f->current_loc to the position of left_start + f->current_loc = f->known_loc_for_packet - (n2-left_start); + f->current_loc_valid = TRUE; + } + if (f->current_loc_valid) + f->current_loc += (right_start - left_start); + + if (f->alloc.alloc_buffer) + assert(f->alloc.alloc_buffer_length_in_bytes == f->temp_offset); + *len = right_end; // ignore samples after the window goes to 0 + return TRUE; +} + +static int vorbis_decode_packet(vorb *f, int *len, int *p_left, int *p_right) +{ + int mode, left_end, right_end; + if (!vorbis_decode_initial(f, p_left, &left_end, p_right, &right_end, &mode)) return 0; + return vorbis_decode_packet_rest(f, len, f->mode_config + mode, *p_left, left_end, *p_right, right_end, p_left); +} + +static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right) +{ + int prev,i,j; + // we use right&left (the start of the right- and left-window sin()-regions) + // to determine how much to return, rather than inferring from the rules + // (same result, clearer code); 'left' indicates where our sin() window + // starts, therefore where the previous window's right edge starts, and + // therefore where to start mixing from the previous buffer. 'right' + // indicates where our sin() ending-window starts, therefore that's where + // we start saving, and where our returned-data ends. + + // mixin from previous window + if (f->previous_length) { + int i,j, n = f->previous_length; + float *w = get_window(f, n); + for (i=0; i < f->channels; ++i) { + for (j=0; j < n; ++j) + f->channel_buffers[i][left+j] = + f->channel_buffers[i][left+j]*w[ j] + + f->previous_window[i][ j]*w[n-1-j]; + } + } + + prev = f->previous_length; + + // last half of this data becomes previous window + f->previous_length = len - right; + + // @OPTIMIZE: could avoid this copy by double-buffering the + // output (flipping previous_window with channel_buffers), but + // then previous_window would have to be 2x as large, and + // channel_buffers couldn't be temp mem (although they're NOT + // currently temp mem, they could be (unless we want to level + // performance by spreading out the computation)) + for (i=0; i < f->channels; ++i) + for (j=0; right+j < len; ++j) + f->previous_window[i][j] = f->channel_buffers[i][right+j]; + + if (!prev) + // there was no previous packet, so this data isn't valid... + // this isn't entirely true, only the would-have-overlapped data + // isn't valid, but this seems to be what the spec requires + return 0; + + // truncate a short frame + if (len < right) right = len; + + f->samples_output += right-left; + + return right - left; +} + +static void vorbis_pump_first_frame(stb_vorbis *f) +{ + int len, right, left; + if (vorbis_decode_packet(f, &len, &left, &right)) + vorbis_finish_frame(f, len, left, right); +} + +#ifndef STB_VORBIS_NO_PUSHDATA_API +static int is_whole_packet_present(stb_vorbis *f, int end_page) +{ + // make sure that we have the packet available before continuing... + // this requires a full ogg parse, but we know we can fetch from f->stream + + // instead of coding this out explicitly, we could save the current read state, + // read the next packet with get8() until end-of-packet, check f->eof, then + // reset the state? but that would be slower, esp. since we'd have over 256 bytes + // of state to restore (primarily the page segment table) + + int s = f->next_seg, first = TRUE; + uint8 *p = f->stream; + + if (s != -1) { // if we're not starting the packet with a 'continue on next page' flag + for (; s < f->segment_count; ++s) { + p += f->segments[s]; + if (f->segments[s] < 255) // stop at first short segment + break; + } + // either this continues, or it ends it... + if (end_page) + if (s < f->segment_count-1) return error(f, VORBIS_invalid_stream); + if (s == f->segment_count) + s = -1; // set 'crosses page' flag + if (p > f->stream_end) return error(f, VORBIS_need_more_data); + first = FALSE; + } + for (; s == -1;) { + uint8 *q; + int n; + + // check that we have the page header ready + if (p + 26 >= f->stream_end) return error(f, VORBIS_need_more_data); + // validate the page + if (memcmp(p, ogg_page_header, 4)) return error(f, VORBIS_invalid_stream); + if (p[4] != 0) return error(f, VORBIS_invalid_stream); + if (first) { // the first segment must NOT have 'continued_packet', later ones MUST + if (f->previous_length) + if ((p[5] & PAGEFLAG_continued_packet)) return error(f, VORBIS_invalid_stream); + // if no previous length, we're resynching, so we can come in on a continued-packet, + // which we'll just drop + } else { + if (!(p[5] & PAGEFLAG_continued_packet)) return error(f, VORBIS_invalid_stream); + } + n = p[26]; // segment counts + q = p+27; // q points to segment table + p = q + n; // advance past header + // make sure we've read the segment table + if (p > f->stream_end) return error(f, VORBIS_need_more_data); + for (s=0; s < n; ++s) { + p += q[s]; + if (q[s] < 255) + break; + } + if (end_page) + if (s < n-1) return error(f, VORBIS_invalid_stream); + if (s == f->segment_count) + s = -1; // set 'crosses page' flag + if (p > f->stream_end) return error(f, VORBIS_need_more_data); + first = FALSE; + } + return TRUE; +} +#endif // !STB_VORBIS_NO_PUSHDATA_API + +static int start_decoder(vorb *f) +{ + uint8 header[6], x,y; + int len,i,j,k, max_submaps = 0; + int longest_floorlist=0; + + // first page, first packet + + if (!start_page(f)) return FALSE; + // validate page flag + if (!(f->page_flag & PAGEFLAG_first_page)) return error(f, VORBIS_invalid_first_page); + if (f->page_flag & PAGEFLAG_last_page) return error(f, VORBIS_invalid_first_page); + if (f->page_flag & PAGEFLAG_continued_packet) return error(f, VORBIS_invalid_first_page); + // check for expected packet length + if (f->segment_count != 1) return error(f, VORBIS_invalid_first_page); + if (f->segments[0] != 30) return error(f, VORBIS_invalid_first_page); + // read packet + // check packet header + if (get8(f) != VORBIS_packet_id) return error(f, VORBIS_invalid_first_page); + if (!getn(f, header, 6)) return error(f, VORBIS_unexpected_eof); + if (!vorbis_validate(header)) return error(f, VORBIS_invalid_first_page); + // vorbis_version + if (get32(f) != 0) return error(f, VORBIS_invalid_first_page); + f->channels = get8(f); if (!f->channels) return error(f, VORBIS_invalid_first_page); + if (f->channels > STB_VORBIS_MAX_CHANNELS) return error(f, VORBIS_too_many_channels); + f->sample_rate = get32(f); if (!f->sample_rate) return error(f, VORBIS_invalid_first_page); + get32(f); // bitrate_maximum + get32(f); // bitrate_nominal + get32(f); // bitrate_minimum + x = get8(f); + { int log0,log1; + log0 = x & 15; + log1 = x >> 4; + f->blocksize_0 = 1 << log0; + f->blocksize_1 = 1 << log1; + if (log0 < 6 || log0 > 13) return error(f, VORBIS_invalid_setup); + if (log1 < 6 || log1 > 13) return error(f, VORBIS_invalid_setup); + if (log0 > log1) return error(f, VORBIS_invalid_setup); + } + + // framing_flag + x = get8(f); + if (!(x & 1)) return error(f, VORBIS_invalid_first_page); + + // second packet! + if (!start_page(f)) return FALSE; + + if (!start_packet(f)) return FALSE; + do { + len = next_segment(f); + skip(f, len); + f->bytes_in_seg = 0; + } while (len); + + // third packet! + if (!start_packet(f)) return FALSE; + + #ifndef STB_VORBIS_NO_PUSHDATA_API + if (IS_PUSH_MODE(f)) { + if (!is_whole_packet_present(f, TRUE)) { + // convert error in ogg header to write type + if (f->error == VORBIS_invalid_stream) + f->error = VORBIS_invalid_setup; + return FALSE; + } + } + #endif + + crc32_init(); // always init it, to avoid multithread race conditions + + if (get8_packet(f) != VORBIS_packet_setup) return error(f, VORBIS_invalid_setup); + for (i=0; i < 6; ++i) header[i] = get8_packet(f); + if (!vorbis_validate(header)) return error(f, VORBIS_invalid_setup); + + // codebooks + + f->codebook_count = get_bits(f,8) + 1; + f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count); + if (f->codebooks == NULL) return error(f, VORBIS_outofmem); + memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count); + for (i=0; i < f->codebook_count; ++i) { + uint32 *values; + int ordered, sorted_count; + int total=0; + uint8 *lengths; + Codebook *c = f->codebooks+i; + x = get_bits(f, 8); if (x != 0x42) return error(f, VORBIS_invalid_setup); + x = get_bits(f, 8); if (x != 0x43) return error(f, VORBIS_invalid_setup); + x = get_bits(f, 8); if (x != 0x56) return error(f, VORBIS_invalid_setup); + x = get_bits(f, 8); + c->dimensions = (get_bits(f, 8)<<8) + x; + x = get_bits(f, 8); + y = get_bits(f, 8); + c->entries = (get_bits(f, 8)<<16) + (y<<8) + x; + ordered = get_bits(f,1); + c->sparse = ordered ? 0 : get_bits(f,1); + + if (c->sparse) + lengths = (uint8 *) setup_temp_malloc(f, c->entries); + else + lengths = c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries); + + if (!lengths) return error(f, VORBIS_outofmem); + + if (ordered) { + int current_entry = 0; + int current_length = get_bits(f,5) + 1; + while (current_entry < c->entries) { + int limit = c->entries - current_entry; + int n = get_bits(f, ilog(limit)); + if (current_entry + n > (int) c->entries) { return error(f, VORBIS_invalid_setup); } + memset(lengths + current_entry, current_length, n); + current_entry += n; + ++current_length; + } + } else { + for (j=0; j < c->entries; ++j) { + int present = c->sparse ? get_bits(f,1) : 1; + if (present) { + lengths[j] = get_bits(f, 5) + 1; + ++total; + } else { + lengths[j] = NO_CODE; + } + } + } + + if (c->sparse && total >= c->entries >> 2) { + // convert sparse items to non-sparse! + if (c->entries > (int) f->setup_temp_memory_required) + f->setup_temp_memory_required = c->entries; + + c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries); + memcpy(c->codeword_lengths, lengths, c->entries); + setup_temp_free(f, lengths, c->entries); // note this is only safe if there have been no intervening temp mallocs! + lengths = c->codeword_lengths; + c->sparse = 0; + } + + // compute the size of the sorted tables + if (c->sparse) { + sorted_count = total; + //assert(total != 0); + } else { + sorted_count = 0; + #ifndef STB_VORBIS_NO_HUFFMAN_BINARY_SEARCH + for (j=0; j < c->entries; ++j) + if (lengths[j] > STB_VORBIS_FAST_HUFFMAN_LENGTH && lengths[j] != NO_CODE) + ++sorted_count; + #endif + } + + c->sorted_entries = sorted_count; + values = NULL; + + if (!c->sparse) { + c->codewords = (uint32 *) setup_malloc(f, sizeof(c->codewords[0]) * c->entries); + if (!c->codewords) return error(f, VORBIS_outofmem); + } else { + unsigned int size; + if (c->sorted_entries) { + c->codeword_lengths = (uint8 *) setup_malloc(f, c->sorted_entries); + if (!c->codeword_lengths) return error(f, VORBIS_outofmem); + c->codewords = (uint32 *) setup_temp_malloc(f, sizeof(*c->codewords) * c->sorted_entries); + if (!c->codewords) return error(f, VORBIS_outofmem); + values = (uint32 *) setup_temp_malloc(f, sizeof(*values) * c->sorted_entries); + if (!values) return error(f, VORBIS_outofmem); + } + size = c->entries + (sizeof(*c->codewords) + sizeof(*values)) * c->sorted_entries; + if (size > f->setup_temp_memory_required) + f->setup_temp_memory_required = size; + } + + if (!compute_codewords(c, lengths, c->entries, values)) { + if (c->sparse) setup_temp_free(f, values, 0); + return error(f, VORBIS_invalid_setup); + } + + if (c->sorted_entries) { + // allocate an extra slot for sentinels + c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1)); + // allocate an extra slot at the front so that c->sorted_values[-1] is defined + // so that we can catch that case without an extra if + c->sorted_values = ( int *) setup_malloc(f, sizeof(*c->sorted_values ) * (c->sorted_entries+1)); + if (c->sorted_values) { ++c->sorted_values; c->sorted_values[-1] = -1; } + compute_sorted_huffman(c, lengths, values); + } + + if (c->sparse) { + setup_temp_free(f, values, sizeof(*values)*c->sorted_entries); + setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries); + setup_temp_free(f, lengths, c->entries); + c->codewords = NULL; + } + + compute_accelerated_huffman(c); + + c->lookup_type = get_bits(f, 4); + if (c->lookup_type > 2) return error(f, VORBIS_invalid_setup); + if (c->lookup_type > 0) { + uint16 *mults; + c->minimum_value = float32_unpack(get_bits(f, 32)); + c->delta_value = float32_unpack(get_bits(f, 32)); + c->value_bits = get_bits(f, 4)+1; + c->sequence_p = get_bits(f,1); + if (c->lookup_type == 1) { + c->lookup_values = lookup1_values(c->entries, c->dimensions); + } else { + c->lookup_values = c->entries * c->dimensions; + } + mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values); + if (mults == NULL) return error(f, VORBIS_outofmem); + for (j=0; j < (int) c->lookup_values; ++j) { + int q = get_bits(f, c->value_bits); + if (q == EOP) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_invalid_setup); } + mults[j] = q; + } + +#ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK + if (c->lookup_type == 1) { + int len, sparse = c->sparse; + // pre-expand the lookup1-style multiplicands, to avoid a divide in the inner loop + if (sparse) { + if (c->sorted_entries == 0) goto skip; + c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->sorted_entries * c->dimensions); + } else + c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions); + if (c->multiplicands == NULL) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } + len = sparse ? c->sorted_entries : c->entries; + for (j=0; j < len; ++j) { + int z = sparse ? c->sorted_values[j] : j, div=1; + for (k=0; k < c->dimensions; ++k) { + int off = (z / div) % c->lookup_values; + c->multiplicands[j*c->dimensions + k] = + #ifndef STB_VORBIS_CODEBOOK_FLOATS + mults[off]; + #else + mults[off]*c->delta_value + c->minimum_value; + // in this case (and this case only) we could pre-expand c->sequence_p, + // and throw away the decode logic for it; have to ALSO do + // it in the case below, but it can only be done if + // STB_VORBIS_CODEBOOK_FLOATS + // !STB_VORBIS_DIVIDES_IN_CODEBOOK + #endif + div *= c->lookup_values; + } + } + setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); + c->lookup_type = 2; + } + else +#endif + { + c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values); + #ifndef STB_VORBIS_CODEBOOK_FLOATS + memcpy(c->multiplicands, mults, sizeof(c->multiplicands[0]) * c->lookup_values); + #else + for (j=0; j < (int) c->lookup_values; ++j) + c->multiplicands[j] = mults[j] * c->delta_value + c->minimum_value; + setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); + #endif + } + skip:; + + #ifdef STB_VORBIS_CODEBOOK_FLOATS + if (c->lookup_type == 2 && c->sequence_p) { + for (j=1; j < (int) c->lookup_values; ++j) + c->multiplicands[j] = c->multiplicands[j-1]; + c->sequence_p = 0; + } + #endif + } + } + + // time domain transfers (notused) + + x = get_bits(f, 6) + 1; + for (i=0; i < x; ++i) { + uint32 z = get_bits(f, 16); + if (z != 0) return error(f, VORBIS_invalid_setup); + } + + // Floors + f->floor_count = get_bits(f, 6)+1; + f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config)); + for (i=0; i < f->floor_count; ++i) { + f->floor_types[i] = get_bits(f, 16); + if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup); + if (f->floor_types[i] == 0) { + Floor0 *g = &f->floor_config[i].floor0; + g->order = get_bits(f,8); + g->rate = get_bits(f,16); + g->bark_map_size = get_bits(f,16); + g->amplitude_bits = get_bits(f,6); + g->amplitude_offset = get_bits(f,8); + g->number_of_books = get_bits(f,4) + 1; + for (j=0; j < g->number_of_books; ++j) + g->book_list[j] = get_bits(f,8); + return error(f, VORBIS_feature_not_supported); + } else { + Point p[31*8+2]; + Floor1 *g = &f->floor_config[i].floor1; + int max_class = -1; + g->partitions = get_bits(f, 5); + for (j=0; j < g->partitions; ++j) { + g->partition_class_list[j] = get_bits(f, 4); + if (g->partition_class_list[j] > max_class) + max_class = g->partition_class_list[j]; + } + for (j=0; j <= max_class; ++j) { + g->class_dimensions[j] = get_bits(f, 3)+1; + g->class_subclasses[j] = get_bits(f, 2); + if (g->class_subclasses[j]) { + g->class_masterbooks[j] = get_bits(f, 8); + if (g->class_masterbooks[j] >= f->codebook_count) return error(f, VORBIS_invalid_setup); + } + for (k=0; k < 1 << g->class_subclasses[j]; ++k) { + g->subclass_books[j][k] = get_bits(f,8)-1; + if (g->subclass_books[j][k] >= f->codebook_count) return error(f, VORBIS_invalid_setup); + } + } + g->floor1_multiplier = get_bits(f,2)+1; + g->rangebits = get_bits(f,4); + g->Xlist[0] = 0; + g->Xlist[1] = 1 << g->rangebits; + g->values = 2; + for (j=0; j < g->partitions; ++j) { + int c = g->partition_class_list[j]; + for (k=0; k < g->class_dimensions[c]; ++k) { + g->Xlist[g->values] = get_bits(f, g->rangebits); + ++g->values; + } + } + // precompute the sorting + for (j=0; j < g->values; ++j) { + p[j].x = g->Xlist[j]; + p[j].y = j; + } + qsort(p, g->values, sizeof(p[0]), point_compare); + for (j=0; j < g->values; ++j) + g->sorted_order[j] = (uint8) p[j].y; + // precompute the neighbors + for (j=2; j < g->values; ++j) { + int low,hi; + neighbors(g->Xlist, j, &low,&hi); + g->neighbors[j][0] = low; + g->neighbors[j][1] = hi; + } + + if (g->values > longest_floorlist) + longest_floorlist = g->values; + } + } + + // Residue + f->residue_count = get_bits(f, 6)+1; + f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(*f->residue_config)); + for (i=0; i < f->residue_count; ++i) { + uint8 residue_cascade[64]; + Residue *r = f->residue_config+i; + f->residue_types[i] = get_bits(f, 16); + if (f->residue_types[i] > 2) return error(f, VORBIS_invalid_setup); + r->begin = get_bits(f, 24); + r->end = get_bits(f, 24); + r->part_size = get_bits(f,24)+1; + r->classifications = get_bits(f,6)+1; + r->classbook = get_bits(f,8); + for (j=0; j < r->classifications; ++j) { + uint8 high_bits=0; + uint8 low_bits=get_bits(f,3); + if (get_bits(f,1)) + high_bits = get_bits(f,5); + residue_cascade[j] = high_bits*8 + low_bits; + } + r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications); + for (j=0; j < r->classifications; ++j) { + for (k=0; k < 8; ++k) { + if (residue_cascade[j] & (1 << k)) { + r->residue_books[j][k] = get_bits(f, 8); + if (r->residue_books[j][k] >= f->codebook_count) return error(f, VORBIS_invalid_setup); + } else { + r->residue_books[j][k] = -1; + } + } + } + // precompute the classifications[] array to avoid inner-loop mod/divide + // call it 'classdata' since we already have r->classifications + r->classdata = (uint8 **) setup_malloc(f, sizeof(*r->classdata) * f->codebooks[r->classbook].entries); + if (!r->classdata) return error(f, VORBIS_outofmem); + memset(r->classdata, 0, sizeof(*r->classdata) * f->codebooks[r->classbook].entries); + for (j=0; j < f->codebooks[r->classbook].entries; ++j) { + int classwords = f->codebooks[r->classbook].dimensions; + int temp = j; + r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords); + for (k=classwords-1; k >= 0; --k) { + r->classdata[j][k] = temp % r->classifications; + temp /= r->classifications; + } + } + } + + f->mapping_count = get_bits(f,6)+1; + f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping)); + for (i=0; i < f->mapping_count; ++i) { + Mapping *m = f->mapping + i; + int mapping_type = get_bits(f,16); + if (mapping_type != 0) return error(f, VORBIS_invalid_setup); + m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan)); + if (get_bits(f,1)) + m->submaps = get_bits(f,4); + else + m->submaps = 1; + if (m->submaps > max_submaps) + max_submaps = m->submaps; + if (get_bits(f,1)) { + m->coupling_steps = get_bits(f,8)+1; + for (k=0; k < m->coupling_steps; ++k) { + m->chan[k].magnitude = get_bits(f, ilog(f->channels)-1); + m->chan[k].angle = get_bits(f, ilog(f->channels)-1); + if (m->chan[k].magnitude >= f->channels) return error(f, VORBIS_invalid_setup); + if (m->chan[k].angle >= f->channels) return error(f, VORBIS_invalid_setup); + if (m->chan[k].magnitude == m->chan[k].angle) return error(f, VORBIS_invalid_setup); + } + } else + m->coupling_steps = 0; + + // reserved field + if (get_bits(f,2)) return error(f, VORBIS_invalid_setup); + if (m->submaps > 1) { + for (j=0; j < f->channels; ++j) { + m->chan[j].mux = get_bits(f, 4); + if (m->chan[j].mux >= m->submaps) return error(f, VORBIS_invalid_setup); + } + } else + // @SPECIFICATION: this case is missing from the spec + for (j=0; j < f->channels; ++j) + m->chan[j].mux = 0; + + for (j=0; j < m->submaps; ++j) { + get_bits(f,8); // discard + m->submap_floor[j] = get_bits(f,8); + m->submap_residue[j] = get_bits(f,8); + if (m->submap_floor[j] >= f->floor_count) return error(f, VORBIS_invalid_setup); + if (m->submap_residue[j] >= f->residue_count) return error(f, VORBIS_invalid_setup); + } + } + + // Modes + f->mode_count = get_bits(f, 6)+1; + for (i=0; i < f->mode_count; ++i) { + Mode *m = f->mode_config+i; + m->blockflag = get_bits(f,1); + m->windowtype = get_bits(f,16); + m->transformtype = get_bits(f,16); + m->mapping = get_bits(f,8); + if (m->windowtype != 0) return error(f, VORBIS_invalid_setup); + if (m->transformtype != 0) return error(f, VORBIS_invalid_setup); + if (m->mapping >= f->mapping_count) return error(f, VORBIS_invalid_setup); + } + + flush_packet(f); + + f->previous_length = 0; + + for (i=0; i < f->channels; ++i) { + f->channel_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1); + f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); + f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist); + #ifdef STB_VORBIS_NO_DEFER_FLOOR + f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); + #endif + } + + if (!init_blocksize(f, 0, f->blocksize_0)) return FALSE; + if (!init_blocksize(f, 1, f->blocksize_1)) return FALSE; + f->blocksize[0] = f->blocksize_0; + f->blocksize[1] = f->blocksize_1; + +#ifdef STB_VORBIS_DIVIDE_TABLE + if (integer_divide_table[1][1]==0) + for (i=0; i < DIVTAB_NUMER; ++i) + for (j=1; j < DIVTAB_DENOM; ++j) + integer_divide_table[i][j] = i / j; +#endif + + // compute how much temporary memory is needed + + // 1. + { + uint32 imdct_mem = (f->blocksize_1 * sizeof(float) >> 1); + uint32 classify_mem; + int i,max_part_read=0; + for (i=0; i < f->residue_count; ++i) { + Residue *r = f->residue_config + i; + int n_read = r->end - r->begin; + int part_read = n_read / r->part_size; + if (part_read > max_part_read) + max_part_read = part_read; + } + #ifndef STB_VORBIS_DIVIDES_IN_RESIDUE + classify_mem = f->channels * (sizeof(void*) + max_part_read * sizeof(uint8 *)); + #else + classify_mem = f->channels * (sizeof(void*) + max_part_read * sizeof(int *)); + #endif + + f->temp_memory_required = classify_mem; + if (imdct_mem > f->temp_memory_required) + f->temp_memory_required = imdct_mem; + } + + f->first_decode = TRUE; + + if (f->alloc.alloc_buffer) { + assert(f->temp_offset == f->alloc.alloc_buffer_length_in_bytes); + // check if there's enough temp memory so we don't error later + if (f->setup_offset + sizeof(*f) + f->temp_memory_required > (unsigned) f->temp_offset) + return error(f, VORBIS_outofmem); + } + + f->first_audio_page_offset = stb_vorbis_get_file_offset(f); + + return TRUE; +} + +static void vorbis_deinit(stb_vorbis *p) +{ + int i,j; + for (i=0; i < p->residue_count; ++i) { + Residue *r = p->residue_config+i; + if (r->classdata) { + for (j=0; j < p->codebooks[r->classbook].entries; ++j) + setup_free(p, r->classdata[j]); + setup_free(p, r->classdata); + } + setup_free(p, r->residue_books); + } + + if (p->codebooks) { + for (i=0; i < p->codebook_count; ++i) { + Codebook *c = p->codebooks + i; + setup_free(p, c->codeword_lengths); + setup_free(p, c->multiplicands); + setup_free(p, c->codewords); + setup_free(p, c->sorted_codewords); + // c->sorted_values[-1] is the first entry in the array + setup_free(p, c->sorted_values ? c->sorted_values-1 : NULL); + } + setup_free(p, p->codebooks); + } + setup_free(p, p->floor_config); + setup_free(p, p->residue_config); + for (i=0; i < p->mapping_count; ++i) + setup_free(p, p->mapping[i].chan); + setup_free(p, p->mapping); + for (i=0; i < p->channels; ++i) { + setup_free(p, p->channel_buffers[i]); + setup_free(p, p->previous_window[i]); + #ifdef STB_VORBIS_NO_DEFER_FLOOR + setup_free(p, p->floor_buffers[i]); + #endif + setup_free(p, p->finalY[i]); + } + for (i=0; i < 2; ++i) { + setup_free(p, p->A[i]); + setup_free(p, p->B[i]); + setup_free(p, p->C[i]); + setup_free(p, p->window[i]); + } + #ifndef STB_VORBIS_NO_STDIO + if (p->close_on_free) fclose(p->f); + #endif +} + +void stb_vorbis_close(stb_vorbis *p) +{ + if (p == NULL) return; + vorbis_deinit(p); + setup_free(p,p); +} + +static void vorbis_init(stb_vorbis *p, stb_vorbis_alloc *z) +{ + memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start + if (z) { + p->alloc = *z; + p->alloc.alloc_buffer_length_in_bytes = (p->alloc.alloc_buffer_length_in_bytes+3) & ~3; + p->temp_offset = p->alloc.alloc_buffer_length_in_bytes; + } + p->eof = 0; + p->error = VORBIS__no_error; + p->stream = NULL; + p->codebooks = NULL; + p->page_crc_tests = -1; + #ifndef STB_VORBIS_NO_STDIO + p->close_on_free = FALSE; + p->f = NULL; + #endif +} + +int stb_vorbis_get_sample_offset(stb_vorbis *f) +{ + if (f->current_loc_valid) + return f->current_loc; + else + return -1; +} + +stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f) +{ + stb_vorbis_info d; + d.channels = f->channels; + d.sample_rate = f->sample_rate; + d.setup_memory_required = f->setup_memory_required; + d.setup_temp_memory_required = f->setup_temp_memory_required; + d.temp_memory_required = f->temp_memory_required; + d.max_frame_size = f->blocksize_1 >> 1; + return d; +} + +int stb_vorbis_get_error(stb_vorbis *f) +{ + int e = f->error; + f->error = VORBIS__no_error; + return e; +} + +static stb_vorbis * vorbis_alloc(stb_vorbis *f) +{ + stb_vorbis *p = (stb_vorbis *) setup_malloc(f, sizeof(*p)); + return p; +} + +#ifndef STB_VORBIS_NO_PUSHDATA_API + +void stb_vorbis_flush_pushdata(stb_vorbis *f) +{ + f->previous_length = 0; + f->page_crc_tests = 0; + f->discard_samples_deferred = 0; + f->current_loc_valid = FALSE; + f->first_decode = FALSE; + f->samples_output = 0; + f->channel_buffer_start = 0; + f->channel_buffer_end = 0; +} + +static int vorbis_search_for_page_pushdata(vorb *f, uint8 *data, int data_len) +{ + int i,n; + for (i=0; i < f->page_crc_tests; ++i) + f->scan[i].bytes_done = 0; + + // if we have room for more scans, search for them first, because + // they may cause us to stop early if their header is incomplete + if (f->page_crc_tests < STB_VORBIS_PUSHDATA_CRC_COUNT) { + if (data_len < 4) return 0; + data_len -= 3; // need to look for 4-byte sequence, so don't miss + // one that straddles a boundary + for (i=0; i < data_len; ++i) { + if (data[i] == 0x4f) { + if (0==memcmp(data+i, ogg_page_header, 4)) { + int j,len; + uint32 crc; + // make sure we have the whole page header + if (i+26 >= data_len || i+27+data[i+26] >= data_len) { + // only read up to this page start, so hopefully we'll + // have the whole page header start next time + data_len = i; + break; + } + // ok, we have it all; compute the length of the page + len = 27 + data[i+26]; + for (j=0; j < data[i+26]; ++j) + len += data[i+27+j]; + // scan everything up to the embedded crc (which we must 0) + crc = 0; + for (j=0; j < 22; ++j) + crc = crc32_update(crc, data[i+j]); + // now process 4 0-bytes + for ( ; j < 26; ++j) + crc = crc32_update(crc, 0); + // len is the total number of bytes we need to scan + n = f->page_crc_tests++; + f->scan[n].bytes_left = len-j; + f->scan[n].crc_so_far = crc; + f->scan[n].goal_crc = data[i+22] + (data[i+23] << 8) + (data[i+24]<<16) + (data[i+25]<<24); + // if the last frame on a page is continued to the next, then + // we can't recover the sample_loc immediately + if (data[i+27+data[i+26]-1] == 255) + f->scan[n].sample_loc = ~0; + else + f->scan[n].sample_loc = data[i+6] + (data[i+7] << 8) + (data[i+ 8]<<16) + (data[i+ 9]<<24); + f->scan[n].bytes_done = i+j; + if (f->page_crc_tests == STB_VORBIS_PUSHDATA_CRC_COUNT) + break; + // keep going if we still have room for more + } + } + } + } + + for (i=0; i < f->page_crc_tests;) { + uint32 crc; + int j; + int n = f->scan[i].bytes_done; + int m = f->scan[i].bytes_left; + if (m > data_len - n) m = data_len - n; + // m is the bytes to scan in the current chunk + crc = f->scan[i].crc_so_far; + for (j=0; j < m; ++j) + crc = crc32_update(crc, data[n+j]); + f->scan[i].bytes_left -= m; + f->scan[i].crc_so_far = crc; + if (f->scan[i].bytes_left == 0) { + // does it match? + if (f->scan[i].crc_so_far == f->scan[i].goal_crc) { + // Houston, we have page + data_len = n+m; // consumption amount is wherever that scan ended + f->page_crc_tests = -1; // drop out of page scan mode + f->previous_length = 0; // decode-but-don't-output one frame + f->next_seg = -1; // start a new page + f->current_loc = f->scan[i].sample_loc; // set the current sample location + // to the amount we'd have decoded had we decoded this page + f->current_loc_valid = f->current_loc != ~0; + return data_len; + } + // delete entry + f->scan[i] = f->scan[--f->page_crc_tests]; + } else { + ++i; + } + } + + return data_len; +} + +// return value: number of bytes we used +int stb_vorbis_decode_frame_pushdata( + stb_vorbis *f, // the file we're decoding + uint8 *data, int data_len, // the memory available for decoding + int *channels, // place to write number of float * buffers + float ***output, // place to write float ** array of float * buffers + int *samples // place to write number of output samples + ) +{ + int i; + int len,right,left; + + if (!IS_PUSH_MODE(f)) return error(f, VORBIS_invalid_api_mixing); + + if (f->page_crc_tests >= 0) { + *samples = 0; + return vorbis_search_for_page_pushdata(f, data, data_len); + } + + f->stream = data; + f->stream_end = data + data_len; + f->error = VORBIS__no_error; + + // check that we have the entire packet in memory + if (!is_whole_packet_present(f, FALSE)) { + *samples = 0; + return 0; + } + + if (!vorbis_decode_packet(f, &len, &left, &right)) { + // save the actual error we encountered + enum STBVorbisError error = f->error; + if (error == VORBIS_bad_packet_type) { + // flush and resynch + f->error = VORBIS__no_error; + while (get8_packet(f) != EOP) + if (f->eof) break; + *samples = 0; + return f->stream - data; + } + if (error == VORBIS_continued_packet_flag_invalid) { + if (f->previous_length == 0) { + // we may be resynching, in which case it's ok to hit one + // of these; just discard the packet + f->error = VORBIS__no_error; + while (get8_packet(f) != EOP) + if (f->eof) break; + *samples = 0; + return f->stream - data; + } + } + // if we get an error while parsing, what to do? + // well, it DEFINITELY won't work to continue from where we are! + stb_vorbis_flush_pushdata(f); + // restore the error that actually made us bail + f->error = error; + *samples = 0; + return 1; + } + + // success! + len = vorbis_finish_frame(f, len, left, right); + for (i=0; i < f->channels; ++i) + f->outputs[i] = f->channel_buffers[i] + left; + + if (channels) *channels = f->channels; + *samples = len; + *output = f->outputs; + return f->stream - data; +} + +stb_vorbis *stb_vorbis_open_pushdata( + unsigned char *data, int data_len, // the memory available for decoding + int *data_used, // only defined if result is not NULL + int *error, stb_vorbis_alloc *alloc) +{ + stb_vorbis *f, p; + vorbis_init(&p, alloc); + p.stream = data; + p.stream_end = data + data_len; + p.push_mode = TRUE; + if (!start_decoder(&p)) { + if (p.eof) + *error = VORBIS_need_more_data; + else + *error = p.error; + return NULL; + } + f = vorbis_alloc(&p); + if (f) { + *f = p; + *data_used = f->stream - data; + *error = 0; + return f; + } else { + vorbis_deinit(&p); + return NULL; + } +} +#endif // STB_VORBIS_NO_PUSHDATA_API + +unsigned int stb_vorbis_get_file_offset(stb_vorbis *f) +{ + #ifndef STB_VORBIS_NO_PUSHDATA_API + if (f->push_mode) return 0; + #endif + if (USE_MEMORY(f)) return f->stream - f->stream_start; + #ifndef STB_VORBIS_NO_STDIO + return ftell(f->f) - f->f_start; + #endif +} + +#ifndef STB_VORBIS_NO_PULLDATA_API +// +// DATA-PULLING API +// + +static uint32 vorbis_find_page(stb_vorbis *f, uint32 *end, uint32 *last) +{ + for(;;) { + int n; + if (f->eof) return 0; + n = get8(f); + if (n == 0x4f) { // page header + unsigned int retry_loc = stb_vorbis_get_file_offset(f); + int i; + // check if we're off the end of a file_section stream + if (retry_loc - 25 > f->stream_len) + return 0; + // check the rest of the header + for (i=1; i < 4; ++i) + if (get8(f) != ogg_page_header[i]) + break; + if (f->eof) return 0; + if (i == 4) { + uint8 header[27]; + uint32 i, crc, goal, len; + for (i=0; i < 4; ++i) + header[i] = ogg_page_header[i]; + for (; i < 27; ++i) + header[i] = get8(f); + if (f->eof) return 0; + if (header[4] != 0) goto invalid; + goal = header[22] + (header[23] << 8) + (header[24]<<16) + (header[25]<<24); + for (i=22; i < 26; ++i) + header[i] = 0; + crc = 0; + for (i=0; i < 27; ++i) + crc = crc32_update(crc, header[i]); + len = 0; + for (i=0; i < header[26]; ++i) { + int s = get8(f); + crc = crc32_update(crc, s); + len += s; + } + if (len && f->eof) return 0; + for (i=0; i < len; ++i) + crc = crc32_update(crc, get8(f)); + // finished parsing probable page + if (crc == goal) { + // we could now check that it's either got the last + // page flag set, OR it's followed by the capture + // pattern, but I guess TECHNICALLY you could have + // a file with garbage between each ogg page and recover + // from it automatically? So even though that paranoia + // might decrease the chance of an invalid decode by + // another 2^32, not worth it since it would hose those + // invalid-but-useful files? + if (end) + *end = stb_vorbis_get_file_offset(f); + if (last) + if (header[5] & 0x04) + *last = 1; + else + *last = 0; + set_file_offset(f, retry_loc-1); + return 1; + } + } + invalid: + // not a valid page, so rewind and look for next one + set_file_offset(f, retry_loc); + } + } +} + +// seek is implemented with 'interpolation search'--this is like +// binary search, but we use the data values to estimate the likely +// location of the data item (plus a bit of a bias so when the +// estimation is wrong we don't waste overly much time) + +#define SAMPLE_unknown 0xffffffff + + +// ogg vorbis, in its insane infinite wisdom, only provides +// information about the sample at the END of the page. +// therefore we COULD have the data we need in the current +// page, and not know it. we could just use the end location +// as our only knowledge for bounds, seek back, and eventually +// the binary search finds it. or we can try to be smart and +// not waste time trying to locate more pages. we try to be +// smart, since this data is already in memory anyway, so +// doing needless I/O would be crazy! +static int vorbis_analyze_page(stb_vorbis *f, ProbedPage *z) +{ + uint8 header[27], lacing[255]; + uint8 packet_type[255]; + int num_packet, packet_start, previous =0; + int i,len; + uint32 samples; + + // record where the page starts + z->page_start = stb_vorbis_get_file_offset(f); + + // parse the header + getn(f, header, 27); + assert(header[0] == 'O' && header[1] == 'g' && header[2] == 'g' && header[3] == 'S'); + getn(f, lacing, header[26]); + + // determine the length of the payload + len = 0; + for (i=0; i < header[26]; ++i) + len += lacing[i]; + + // this implies where the page ends + z->page_end = z->page_start + 27 + header[26] + len; + + // read the last-decoded sample out of the data + z->last_decoded_sample = header[6] + (header[7] << 8) + (header[8] << 16) + (header[9] << 16); + + if (header[5] & 4) { + // if this is the last page, it's not possible to work + // backwards to figure out the first sample! whoops! fuck. + z->first_decoded_sample = SAMPLE_unknown; + set_file_offset(f, z->page_start); + return 1; + } + + // scan through the frames to determine the sample-count of each one... + // our goal is the sample # of the first fully-decoded sample on the + // page, which is the first decoded sample of the 2nd page + + num_packet=0; + + packet_start = ((header[5] & 1) == 0); + + for (i=0; i < header[26]; ++i) { + if (packet_start) { + uint8 n,b,m; + if (lacing[i] == 0) goto bail; // trying to read from zero-length packet + n = get8(f); + // if bottom bit is non-zero, we've got corruption + if (n & 1) goto bail; + n >>= 1; + b = ilog(f->mode_count-1); + m = n >> b; + n &= (1 << b)-1; + if (n >= f->mode_count) goto bail; + if (num_packet == 0 && f->mode_config[n].blockflag) + previous = (m & 1); + packet_type[num_packet++] = f->mode_config[n].blockflag; + skip(f, lacing[i]-1); + } else + skip(f, lacing[i]); + packet_start = (lacing[i] < 255); + } + + // now that we know the sizes of all the pages, we can start determining + // how much sample data there is. + + samples = 0; + + // for the last packet, we step by its whole length, because the definition + // is that we encoded the end sample loc of the 'last packet completed', + // where 'completed' refers to packets being split, and we are left to guess + // what 'end sample loc' means. we assume it means ignoring the fact that + // the last half of the data is useless without windowing against the next + // packet... (so it's not REALLY complete in that sense) + if (num_packet > 1) + samples += f->blocksize[packet_type[num_packet-1]]; + + for (i=num_packet-2; i >= 1; --i) { + // now, for this packet, how many samples do we have that + // do not overlap the following packet? + if (packet_type[i] == 1) + if (packet_type[i+1] == 1) + samples += f->blocksize_1 >> 1; + else + samples += ((f->blocksize_1 - f->blocksize_0) >> 2) + (f->blocksize_0 >> 1); + else + samples += f->blocksize_0 >> 1; + } + // now, at this point, we've rewound to the very beginning of the + // _second_ packet. if we entirely discard the first packet after + // a seek, this will be exactly the right sample number. HOWEVER! + // we can't as easily compute this number for the LAST page. The + // only way to get the sample offset of the LAST page is to use + // the end loc from the previous page. But what that returns us + // is _exactly_ the place where we get our first non-overlapped + // sample. (I think. Stupid spec for being ambiguous.) So for + // consistency it's better to do that here, too. However, that + // will then require us to NOT discard all of the first frame we + // decode, in some cases, which means an even weirder frame size + // and extra code. what a fucking pain. + + // we're going to discard the first packet if we + // start the seek here, so we don't care about it. (we could actually + // do better; if the first packet is long, and the previous packet + // is short, there's actually data in the first half of the first + // packet that doesn't need discarding... but not worth paying the + // effort of tracking that of that here and in the seeking logic) + // except crap, if we infer it from the _previous_ packet's end + // location, we DO need to use that definition... and we HAVE to + // infer the start loc of the LAST packet from the previous packet's + // end location. fuck you, ogg vorbis. + + z->first_decoded_sample = z->last_decoded_sample - samples; + + // restore file state to where we were + set_file_offset(f, z->page_start); + return 1; + + // restore file state to where we were + bail: + set_file_offset(f, z->page_start); + return 0; +} + +static int vorbis_seek_frame_from_page(stb_vorbis *f, uint32 page_start, uint32 first_sample, uint32 target_sample, int fine) +{ + int left_start, left_end, right_start, right_end, mode,i; + int frame=0; + uint32 frame_start; + int frames_to_skip, data_to_skip; + + // first_sample is the sample # of the first sample that doesn't + // overlap the previous page... note that this requires us to + // _partially_ discard the first packet! bleh. + set_file_offset(f, page_start); + + f->next_seg = -1; // force page resync + + frame_start = first_sample; + // frame start is where the previous packet's last decoded sample + // was, which corresponds to left_end... EXCEPT if the previous + // packet was long and this packet is short? Probably a bug here. + + + // now, we can start decoding frames... we'll only FAKE decode them, + // until we find the frame that contains our sample; then we'll rewind, + // and try again + for (;;) { + int start; + + if (!vorbis_decode_initial(f, &left_start, &left_end, &right_start, &right_end, &mode)) + return error(f, VORBIS_seek_failed); + + if (frame == 0) + start = left_end; + else + start = left_start; + + // the window starts at left_start; the last valid sample we generate + // before the next frame's window start is right_start-1 + if (target_sample < frame_start + right_start-start) + break; + + flush_packet(f); + if (f->eof) + return error(f, VORBIS_seek_failed); + + frame_start += right_start - start; + + ++frame; + } + + // ok, at this point, the sample we want is contained in frame #'frame' + + // to decode frame #'frame' normally, we have to decode the + // previous frame first... but if it's the FIRST frame of the page + // we can't. if it's the first frame, it means it falls in the part + // of the first frame that doesn't overlap either of the other frames. + // so, if we have to handle that case for the first frame, we might + // as well handle it for all of them, so: + if (target_sample > frame_start + (left_end - left_start)) { + // so what we want to do is go ahead and just immediately decode + // this frame, but then make it so the next get_frame_float() uses + // this already-decoded data? or do we want to go ahead and rewind, + // and leave a flag saying to skip the first N data? let's do that + frames_to_skip = frame; // if this is frame #1, skip 1 frame (#0) + data_to_skip = left_end - left_start; + } else { + // otherwise, we want to skip frames 0, 1, 2, ... frame-2 + // (which means frame-2+1 total frames) then decode frame-1, + // then leave frame pending + frames_to_skip = frame - 1; + assert(frames_to_skip >= 0); + data_to_skip = -1; + } + + set_file_offset(f, page_start); + f->next_seg = - 1; // force page resync + + for (i=0; i < frames_to_skip; ++i) { + maybe_start_packet(f); + flush_packet(f); + } + + if (data_to_skip >= 0) { + int i,j,n = f->blocksize_0 >> 1; + f->discard_samples_deferred = data_to_skip; + for (i=0; i < f->channels; ++i) + for (j=0; j < n; ++j) + f->previous_window[i][j] = 0; + f->previous_length = n; + frame_start += data_to_skip; + } else { + f->previous_length = 0; + vorbis_pump_first_frame(f); + } + + // at this point, the NEXT decoded frame will generate the desired sample + if (fine) { + // so if we're doing sample accurate streaming, we want to go ahead and decode it! + if (target_sample != frame_start) { + int n; + stb_vorbis_get_frame_float(f, &n, NULL); + assert(target_sample > frame_start); + assert(f->channel_buffer_start + (int) (target_sample-frame_start) < f->channel_buffer_end); + f->channel_buffer_start += (target_sample - frame_start); + } + } + + return 0; +} + +static int vorbis_seek_base(stb_vorbis *f, unsigned int sample_number, int fine) +{ + ProbedPage p[2],q; + if (IS_PUSH_MODE(f)) return error(f, VORBIS_invalid_api_mixing); + + // do we know the location of the last page? + if (f->p_last.page_start == 0) { + uint32 z = stb_vorbis_stream_length_in_samples(f); + if (z == 0) return error(f, VORBIS_cant_find_last_page); + } + + p[0] = f->p_first; + p[1] = f->p_last; + + if (sample_number >= f->p_last.last_decoded_sample) + sample_number = f->p_last.last_decoded_sample-1; + + if (sample_number < f->p_first.last_decoded_sample) { + vorbis_seek_frame_from_page(f, p[0].page_start, 0, sample_number, fine); + return 0; + } else { + int attempts=0; + while (p[0].page_end < p[1].page_start) { + uint32 probe; + uint32 start_offset, end_offset; + uint32 start_sample, end_sample; + + // copy these into local variables so we can tweak them + // if any are unknown + start_offset = p[0].page_end; + end_offset = p[1].after_previous_page_start; // an address known to seek to page p[1] + start_sample = p[0].last_decoded_sample; + end_sample = p[1].last_decoded_sample; + + // currently there is no such tweaking logic needed/possible? + if (start_sample == SAMPLE_unknown || end_sample == SAMPLE_unknown) + return error(f, VORBIS_seek_failed); + + // now we want to lerp between these for the target samples... + + // step 1: we need to bias towards the page start... + if (start_offset + 4000 < end_offset) + end_offset -= 4000; + + // now compute an interpolated search loc + probe = start_offset + (int) floor((float) (end_offset - start_offset) / (end_sample - start_sample) * (sample_number - start_sample)); + + // next we need to bias towards binary search... + // code is a little wonky to allow for full 32-bit unsigned values + if (attempts >= 4) { + uint32 probe2 = start_offset + ((end_offset - start_offset) >> 1); + if (attempts >= 8) + probe = probe2; + else if (probe < probe2) + probe = probe + ((probe2 - probe) >> 1); + else + probe = probe2 + ((probe - probe2) >> 1); + } + ++attempts; + + set_file_offset(f, probe); + if (!vorbis_find_page(f, NULL, NULL)) return error(f, VORBIS_seek_failed); + if (!vorbis_analyze_page(f, &q)) return error(f, VORBIS_seek_failed); + q.after_previous_page_start = probe; + + // it's possible we've just found the last page again + if (q.page_start == p[1].page_start) { + p[1] = q; + continue; + } + + if (sample_number < q.last_decoded_sample) + p[1] = q; + else + p[0] = q; + } + + if (p[0].last_decoded_sample <= sample_number && sample_number < p[1].last_decoded_sample) { + vorbis_seek_frame_from_page(f, p[1].page_start, p[0].last_decoded_sample, sample_number, fine); + return 0; + } + return error(f, VORBIS_seek_failed); + } +} + +int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number) +{ + return vorbis_seek_base(f, sample_number, FALSE); +} + +int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) +{ + return vorbis_seek_base(f, sample_number, TRUE); +} + +void stb_vorbis_seek_start(stb_vorbis *f) +{ + if (IS_PUSH_MODE(f)) { error(f, VORBIS_invalid_api_mixing); return; } + set_file_offset(f, f->first_audio_page_offset); + f->previous_length = 0; + f->first_decode = TRUE; + f->next_seg = -1; + vorbis_pump_first_frame(f); +} + +unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f) +{ + unsigned int restore_offset, previous_safe; + unsigned int end, last_page_loc; + + if (IS_PUSH_MODE(f)) return error(f, VORBIS_invalid_api_mixing); + if (!f->total_samples) { + int last; + uint32 lo,hi; + char header[6]; + + // first, store the current decode position so we can restore it + restore_offset = stb_vorbis_get_file_offset(f); + + // now we want to seek back 64K from the end (the last page must + // be at most a little less than 64K, but let's allow a little slop) + if (f->stream_len >= 65536 && f->stream_len-65536 >= f->first_audio_page_offset) + previous_safe = f->stream_len - 65536; + else + previous_safe = f->first_audio_page_offset; + + set_file_offset(f, previous_safe); + // previous_safe is now our candidate 'earliest known place that seeking + // to will lead to the final page' + + if (!vorbis_find_page(f, &end, (int unsigned *)&last)) { + // if we can't find a page, we're hosed! + f->error = VORBIS_cant_find_last_page; + f->total_samples = 0xffffffff; + goto done; + } + + // check if there are more pages + last_page_loc = stb_vorbis_get_file_offset(f); + + // stop when the last_page flag is set, not when we reach eof; + // this allows us to stop short of a 'file_section' end without + // explicitly checking the length of the section + while (!last) { + set_file_offset(f, end); + if (!vorbis_find_page(f, &end, (int unsigned *)&last)) { + // the last page we found didn't have the 'last page' flag + // set. whoops! + break; + } + previous_safe = last_page_loc+1; + last_page_loc = stb_vorbis_get_file_offset(f); + } + + set_file_offset(f, last_page_loc); + + // parse the header + getn(f, (unsigned char *)header, 6); + // extract the absolute granule position + lo = get32(f); + hi = get32(f); + if (lo == 0xffffffff && hi == 0xffffffff) { + f->error = VORBIS_cant_find_last_page; + f->total_samples = SAMPLE_unknown; + goto done; + } + if (hi) + lo = 0xfffffffe; // saturate + f->total_samples = lo; + + f->p_last.page_start = last_page_loc; + f->p_last.page_end = end; + f->p_last.last_decoded_sample = lo; + f->p_last.first_decoded_sample = SAMPLE_unknown; + f->p_last.after_previous_page_start = previous_safe; + + done: + set_file_offset(f, restore_offset); + } + return f->total_samples == SAMPLE_unknown ? 0 : f->total_samples; +} + +float stb_vorbis_stream_length_in_seconds(stb_vorbis *f) +{ + return stb_vorbis_stream_length_in_samples(f) / (float) f->sample_rate; +} + + + +int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output) +{ + int len, right,left,i; + if (IS_PUSH_MODE(f)) return error(f, VORBIS_invalid_api_mixing); + + if (!vorbis_decode_packet(f, &len, &left, &right)) { + f->channel_buffer_start = f->channel_buffer_end = 0; + return 0; + } + + len = vorbis_finish_frame(f, len, left, right); + for (i=0; i < f->channels; ++i) + f->outputs[i] = f->channel_buffers[i] + left; + + f->channel_buffer_start = left; + f->channel_buffer_end = left+len; + + if (channels) *channels = f->channels; + if (output) *output = f->outputs; + return len; +} + +#ifndef STB_VORBIS_NO_STDIO + +stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *error, stb_vorbis_alloc *alloc, unsigned int length) +{ + stb_vorbis *f, p; + vorbis_init(&p, alloc); + p.f = file; + p.f_start = ftell(file); + p.stream_len = length; + p.close_on_free = close_on_free; + if (start_decoder(&p)) { + f = vorbis_alloc(&p); + if (f) { + *f = p; + vorbis_pump_first_frame(f); + return f; + } + } + if (error) *error = p.error; + vorbis_deinit(&p); + return NULL; +} + +stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, stb_vorbis_alloc *alloc) +{ + unsigned int len, start; + start = ftell(file); + fseek(file, 0, SEEK_END); + len = ftell(file) - start; + fseek(file, start, SEEK_SET); + return stb_vorbis_open_file_section(file, close_on_free, error, alloc, len); +} + +stb_vorbis * stb_vorbis_open_filename(char *filename, int *error, stb_vorbis_alloc *alloc) +{ + FILE *f = fopen(filename, "rb"); + if (f) + return stb_vorbis_open_file(f, TRUE, error, alloc); + if (error) *error = VORBIS_file_open_failure; + return NULL; +} +#endif // STB_VORBIS_NO_STDIO + +stb_vorbis * stb_vorbis_open_memory(unsigned char *data, int len, int *error, stb_vorbis_alloc *alloc) +{ + stb_vorbis *f, p; + if (data == NULL) return NULL; + vorbis_init(&p, alloc); + p.stream = data; + p.stream_end = data + len; + p.stream_start = p.stream; + p.stream_len = len; + p.push_mode = FALSE; + if (start_decoder(&p)) { + f = vorbis_alloc(&p); + if (f) { + *f = p; + vorbis_pump_first_frame(f); + return f; + } + } + if (error) *error = p.error; + vorbis_deinit(&p); + return NULL; +} + +#ifndef STB_VORBIS_NO_INTEGER_CONVERSION +#define PLAYBACK_MONO 1 +#define PLAYBACK_LEFT 2 +#define PLAYBACK_RIGHT 4 + +#define L (PLAYBACK_LEFT | PLAYBACK_MONO) +#define C (PLAYBACK_LEFT | PLAYBACK_RIGHT | PLAYBACK_MONO) +#define R (PLAYBACK_RIGHT | PLAYBACK_MONO) + +static int8 channel_position[7][6] = +{ + { 0 }, + { C }, + { L, R }, + { L, C, R }, + { L, R, L, R }, + { L, C, R, L, R }, + { L, C, R, L, R, C }, +}; + + +#ifndef STB_VORBIS_NO_FAST_SCALED_FLOAT + // add (1<<23) to convert to int, then divide by 2^SHIFT, then add 0.5/2^SHIFT to round + #define MAGIC(SHIFT) (1.5f * (1 << (23-SHIFT)) + 0.5f/(1 << SHIFT)) + #define ADDEND(SHIFT) (((150-SHIFT) << 23) + (1 << 22)) + #define FAST_SCALED_FLOAT_TO_INT(x,s) ((temp = (x) + MAGIC(s)), (*(int *)&temp) - ADDEND(s)) + #define check_endianness() + typedef char stb_vorbis_float_size_test[sizeof(float)==4 && sizeof(int) == 4]; + #define FASTDEF(x) x +#else + #define FAST_SCALED_FLOAT_TO_INT(x,s) ((int) ((x) * (1 << (s)))) + #define check_endianness() + #define FASTDEF(x) +#endif + +static void copy_samples(short *dest, float *src, int len) +{ + int i; + FASTDEF(float temp); + check_endianness(); + for (i=0; i < len; ++i) { + int v = FAST_SCALED_FLOAT_TO_INT(src[i],15); + if ((unsigned int) (v + 32768) > 65535) + v = v < 0 ? -32768 : 32767; + dest[i] = v; + } +} + +static void compute_samples(int mask, short *output, int num_c, float **data, int d_offset, int len) +{ + #define BUFFER_SIZE 32 + float buffer[BUFFER_SIZE]; + int i,j,o,n = BUFFER_SIZE; + FASTDEF(float temp); + check_endianness(); + for (o = 0; o < len; o += BUFFER_SIZE) { + memset(buffer, 0, sizeof(buffer)); + if (o + n > len) n = len - o; + for (j=0; j < num_c; ++j) { + if (channel_position[num_c][j] & mask) { + for (i=0; i < n; ++i) + buffer[i] += data[j][d_offset+o+i]; + } + } + for (i=0; i < n; ++i) { + int v = FAST_SCALED_FLOAT_TO_INT(buffer[i],15); + if ((unsigned int) (v + 32768) > 65535) + v = v < 0 ? -32768 : 32767; + output[o+i] = v; + } + } +} + +static int channel_selector[3][2] = { {0}, {PLAYBACK_MONO}, {PLAYBACK_LEFT, PLAYBACK_RIGHT} }; +static void compute_stereo_samples(short *output, int num_c, float **data, int d_offset, int len) +{ + #define BUFFER_SIZE 32 + float buffer[BUFFER_SIZE]; + int i,j,o,n = BUFFER_SIZE >> 1; + FASTDEF(float temp); + // o is the offset in the source data + check_endianness(); + for (o = 0; o < len; o += BUFFER_SIZE >> 1) { + // o2 is the offset in the output data + int o2 = o << 1; + memset(buffer, 0, sizeof(buffer)); + if (o + n > len) n = len - o; + for (j=0; j < num_c; ++j) { + int m = channel_position[num_c][j] & (PLAYBACK_LEFT | PLAYBACK_RIGHT); + if (m == (PLAYBACK_LEFT | PLAYBACK_RIGHT)) { + for (i=0; i < n; ++i) { + buffer[i*2+0] += data[j][d_offset+o+i]; + buffer[i*2+1] += data[j][d_offset+o+i]; + } + } else if (m == PLAYBACK_LEFT) { + for (i=0; i < n; ++i) { + buffer[i*2+0] += data[j][d_offset+o+i]; + } + } else if (m == PLAYBACK_RIGHT) { + for (i=0; i < n; ++i) { + buffer[i*2+1] += data[j][d_offset+o+i]; + } + } + } + for (i=0; i < (n<<1); ++i) { + int v = FAST_SCALED_FLOAT_TO_INT(buffer[i],15); + if ((unsigned int) (v + 32768) > 65535) + v = v < 0 ? -32768 : 32767; + output[o2+i] = v; + } + } +} + +static void convert_samples_short(int buf_c, short **buffer, int b_offset, int data_c, float **data, int d_offset, int samples) +{ + int i; + if (buf_c != data_c && buf_c <= 2 && data_c <= 6) { + static int channel_selector[3][2] = { {0}, {PLAYBACK_MONO}, {PLAYBACK_LEFT, PLAYBACK_RIGHT} }; + for (i=0; i < buf_c; ++i) + compute_samples(channel_selector[buf_c][i], buffer[i]+b_offset, data_c, data, d_offset, samples); + } else { + int limit = buf_c < data_c ? buf_c : data_c; + for (i=0; i < limit; ++i) + copy_samples(buffer[i]+b_offset, data[i], samples); + for ( ; i < buf_c; ++i) + memset(buffer[i]+b_offset, 0, sizeof(short) * samples); + } +} + +int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer, int num_samples) +{ + float **output; + int len = stb_vorbis_get_frame_float(f, NULL, &output); + if (len > num_samples) len = num_samples; + if (len) + convert_samples_short(num_c, buffer, 0, f->channels, output, 0, len); + return len; +} + +static void convert_channels_short_interleaved(int buf_c, short *buffer, int data_c, float **data, int d_offset, int len) +{ + int i; + check_endianness(); + if (buf_c != data_c && buf_c <= 2 && data_c <= 6) { + assert(buf_c == 2); + for (i=0; i < buf_c; ++i) + compute_stereo_samples(buffer, data_c, data, d_offset, len); + } else { + int limit = buf_c < data_c ? buf_c : data_c; + int j; + FASTDEF(float temp); + for (j=0; j < len; ++j) { + for (i=0; i < limit; ++i) { + int v = FAST_SCALED_FLOAT_TO_INT(data[i][d_offset+j],15); + if ((unsigned int) (v + 32768) > 65535) + v = v < 0 ? -32768 : 32767; + *buffer++ = v; + } + for ( ; i < buf_c; ++i) + *buffer++ = 0; + } + } +} + +int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buffer, int num_shorts) +{ + float **output; + int len; + if (num_c == 1) return stb_vorbis_get_frame_short(f,num_c,&buffer, num_shorts); + len = stb_vorbis_get_frame_float(f, NULL, &output); + if (len) { + if (len*num_c > num_shorts) len = num_shorts / num_c; + convert_channels_short_interleaved(num_c, buffer, f->channels, output, 0, len); + } + return len; +} + +int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short *buffer, int num_shorts) +{ + float **outputs; + int len = num_shorts / channels; + int n=0; + int z = f->channels; + if (z > channels) z = channels; + while (n < len) { + int k = f->channel_buffer_end - f->channel_buffer_start; + if (n+k >= len) k = len - n; + if (k) + convert_channels_short_interleaved(channels, buffer, f->channels, f->channel_buffers, f->channel_buffer_start, k); + buffer += k*channels; + n += k; + f->channel_buffer_start += k; + if (n == len) break; + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; + } + return n; +} + +int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, int len) +{ + float **outputs; + int n=0; + int z = f->channels; + if (z > channels) z = channels; + while (n < len) { + int k = f->channel_buffer_end - f->channel_buffer_start; + if (n+k >= len) k = len - n; + if (k) + convert_samples_short(channels, buffer, n, f->channels, f->channel_buffers, f->channel_buffer_start, k); + n += k; + f->channel_buffer_start += k; + if (n == len) break; + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; + } + return n; +} + +#ifndef STB_VORBIS_NO_STDIO +int stb_vorbis_decode_filename(char *filename, int *channels, short **output) +{ + int data_len, offset, total, limit, error; + short *data; + stb_vorbis *v = stb_vorbis_open_filename(filename, &error, NULL); + if (v == NULL) return -1; + limit = v->channels * 4096; + *channels = v->channels; + offset = data_len = 0; + total = limit; + data = (short *) malloc(total * sizeof(*data)); + if (data == NULL) { + stb_vorbis_close(v); + return -2; + } + for (;;) { + int n = stb_vorbis_get_frame_short_interleaved(v, v->channels, data+offset, total-offset); + if (n == 0) break; + data_len += n; + offset += n * v->channels; + if (offset + limit > total) { + short *data2; + total *= 2; + data2 = (short *) realloc(data, total * sizeof(*data)); + if (data2 == NULL) { + free(data); + stb_vorbis_close(v); + return -2; + } + data = data2; + } + } + *output = data; + return data_len; +} +#endif // NO_STDIO + +int stb_vorbis_decode_memory(uint8 *mem, int len, int *channels, short **output) +{ + int data_len, offset, total, limit, error; + short *data; + stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, NULL); + if (v == NULL) return -1; + limit = v->channels * 4096; + *channels = v->channels; + offset = data_len = 0; + total = limit; + data = (short *) malloc(total * sizeof(*data)); + if (data == NULL) { + stb_vorbis_close(v); + return -2; + } + for (;;) { + int n = stb_vorbis_get_frame_short_interleaved(v, v->channels, data+offset, total-offset); + if (n == 0) break; + data_len += n; + offset += n * v->channels; + if (offset + limit > total) { + short *data2; + total *= 2; + data2 = (short *) realloc(data, total * sizeof(*data)); + if (data2 == NULL) { + free(data); + stb_vorbis_close(v); + return -2; + } + data = data2; + } + } + *output = data; + return data_len; +} +#endif + +int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float *buffer, int num_floats) +{ + float **outputs; + int len = num_floats / channels; + int n=0; + int z = f->channels; + if (z > channels) z = channels; + while (n < len) { + int i,j; + int k = f->channel_buffer_end - f->channel_buffer_start; + if (n+k >= len) k = len - n; + for (j=0; j < k; ++j) { + for (i=0; i < z; ++i) + *buffer++ = f->channel_buffers[i][f->channel_buffer_start+j]; + for ( ; i < channels; ++i) + *buffer++ = 0; + } + n += k; + f->channel_buffer_start += k; + if (n == len) break; + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; + } + return n; +} + +int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, int num_samples) +{ + float **outputs; + int n=0; + int z = f->channels; + if (z > channels) z = channels; + while (n < num_samples) { + int i; + int k = f->channel_buffer_end - f->channel_buffer_start; + if (n+k >= num_samples) k = num_samples - n; + if (k) { + for (i=0; i < z; ++i) + memcpy(buffer[i]+n, f->channel_buffers+f->channel_buffer_start, sizeof(float)*k); + for ( ; i < channels; ++i) + memset(buffer[i]+n, 0, sizeof(float) * k); + } + n += k; + f->channel_buffer_start += k; + if (n == num_samples) break; + if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; + } + return n; +} +#endif // STB_VORBIS_NO_PULLDATA_API + +#endif // STB_VORBIS_HEADER_ONLY diff --git a/src/SFML/Audio/stb_vorbis/stb_vorbis.h b/src/SFML/Audio/stb_vorbis/stb_vorbis.h new file mode 100755 index 00000000..e2355e6c --- /dev/null +++ b/src/SFML/Audio/stb_vorbis/stb_vorbis.h @@ -0,0 +1,357 @@ +// Ogg Vorbis I audio decoder -- version 0.99994 +// +// Written in April 2007 by Sean Barrett, sponsored by RAD Game Tools. +// +// Placed in the public domain April 2007 by the author: no copyright is +// claimed, and you may use it for any purpose you like. +// +// No warranty for any purpose is expressed or implied by the author (nor +// by RAD Game Tools). Report bugs and send enhancements to the author. +// +// Get the latest version and other information at: +// http://nothings.org/stb_vorbis/ + + +// Todo: +// +// - seeking (note you can seek yourself using the pushdata API) +// +// Limitations: +// +// - floor 0 not supported (used in old ogg vorbis files) +// - lossless sample-truncation at beginning ignored +// - cannot concatenate multiple vorbis streams +// - sample positions are 32-bit, limiting seekable 192Khz +// files to around 6 hours (Ogg supports 64-bit) +// +// All of these limitations may be removed in future versions. + + +////////////////////////////////////////////////////////////////////////////// +// +// HEADER BEGINS HERE +// + +#ifndef STB_VORBIS_INCLUDE_STB_VORBIS_H +#define STB_VORBIS_INCLUDE_STB_VORBIS_H + +#if defined(STB_VORBIS_NO_CRT) && !defined(STB_VORBIS_NO_STDIO) +#define STB_VORBIS_NO_STDIO 1 +#endif + +#ifndef STB_VORBIS_NO_STDIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/////////// THREAD SAFETY + +// Individual stb_vorbis* handles are not thread-safe; you cannot decode from +// them from multiple threads at the same time. However, you can have multiple +// stb_vorbis* handles and decode from them independently in multiple thrads. + + +/////////// MEMORY ALLOCATION + +// normally stb_vorbis uses malloc() to allocate memory at startup, +// and alloca() to allocate temporary memory during a frame on the +// stack. (Memory consumption will depend on the amount of setup +// data in the file and how you set the compile flags for speed +// vs. size. In my test files the maximal-size usage is ~150KB.) +// +// You can modify the wrapper functions in the source (setup_malloc, +// setup_temp_malloc, temp_malloc) to change this behavior, or you +// can use a simpler allocation model: you pass in a buffer from +// which stb_vorbis will allocate _all_ its memory (including the +// temp memory). "open" may fail with a VORBIS_outofmem if you +// do not pass in enough data; there is no way to determine how +// much you do need except to succeed (at which point you can +// query get_info to find the exact amount required. yes I know +// this is lame). +// +// If you pass in a non-NULL buffer of the type below, allocation +// will occur from it as described above. Otherwise just pass NULL +// to use malloc()/alloca() + +typedef struct +{ + char *alloc_buffer; + int alloc_buffer_length_in_bytes; +} stb_vorbis_alloc; + + +/////////// FUNCTIONS USEABLE WITH ALL INPUT MODES + +typedef struct stb_vorbis stb_vorbis; + +typedef struct +{ + unsigned int sample_rate; + int channels; + + unsigned int setup_memory_required; + unsigned int setup_temp_memory_required; + unsigned int temp_memory_required; + + int max_frame_size; +} stb_vorbis_info; + +// get general information about the file +extern stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f); + +// get the last error detected (clears it, too) +extern int stb_vorbis_get_error(stb_vorbis *f); + +// close an ogg vorbis file and free all memory in use +extern void stb_vorbis_close(stb_vorbis *f); + +// this function returns the offset (in samples) from the beginning of the +// file that will be returned by the next decode, if it is known, or -1 +// otherwise. after a flush_pushdata() call, this may take a while before +// it becomes valid again. +// NOT WORKING YET after a seek with PULLDATA API +extern int stb_vorbis_get_sample_offset(stb_vorbis *f); + +// returns the current seek point within the file, or offset from the beginning +// of the memory buffer. In pushdata mode it returns 0. +extern unsigned int stb_vorbis_get_file_offset(stb_vorbis *f); + +/////////// PUSHDATA API + +#ifndef STB_VORBIS_NO_PUSHDATA_API + +// this API allows you to get blocks of data from any source and hand +// them to stb_vorbis. you have to buffer them; stb_vorbis will tell +// you how much it used, and you have to give it the rest next time; +// and stb_vorbis may not have enough data to work with and you will +// need to give it the same data again PLUS more. Note that the Vorbis +// specification does not bound the size of an individual frame. + +extern stb_vorbis *stb_vorbis_open_pushdata( + unsigned char *datablock, int datablock_length_in_bytes, + int *datablock_memory_consumed_in_bytes, + int *error, + stb_vorbis_alloc *alloc_buffer); +// create a vorbis decoder by passing in the initial data block containing +// the ogg&vorbis headers (you don't need to do parse them, just provide +// the first N bytes of the file--you're told if it's not enough, see below) +// on success, returns an stb_vorbis *, does not set error, returns the amount of +// data parsed/consumed on this call in *datablock_memory_consumed_in_bytes; +// on failure, returns NULL on error and sets *error, does not change *datablock_memory_consumed +// if returns NULL and *error is VORBIS_need_more_data, then the input block was +// incomplete and you need to pass in a larger block from the start of the file + +extern int stb_vorbis_decode_frame_pushdata( + stb_vorbis *f, unsigned char *datablock, int datablock_length_in_bytes, + int *channels, // place to write number of float * buffers + float ***output, // place to write float ** array of float * buffers + int *samples // place to write number of output samples + ); +// decode a frame of audio sample data if possible from the passed-in data block +// +// return value: number of bytes we used from datablock +// possible cases: +// 0 bytes used, 0 samples output (need more data) +// N bytes used, 0 samples output (resynching the stream, keep going) +// N bytes used, M samples output (one frame of data) +// note that after opening a file, you will ALWAYS get one N-bytes,0-sample +// frame, because Vorbis always "discards" the first frame. +// +// Note that on resynch, stb_vorbis will rarely consume all of the buffer, +// instead only datablock_length_in_bytes-3 or less. This is because it wants +// to avoid missing parts of a page header if they cross a datablock boundary, +// without writing state-machiney code to record a partial detection. +// +// The number of channels returned are stored in *channels (which can be +// NULL--it is always the same as the number of channels reported by +// get_info). *output will contain an array of float* buffers, one per +// channel. In other words, (*output)[0][0] contains the first sample from +// the first channel, and (*output)[1][0] contains the first sample from +// the second channel. + +extern void stb_vorbis_flush_pushdata(stb_vorbis *f); +// inform stb_vorbis that your next datablock will not be contiguous with +// previous ones (e.g. you've seeked in the data); future attempts to decode +// frames will cause stb_vorbis to resynchronize (as noted above), and +// once it sees a valid Ogg page (typically 4-8KB, as large as 64KB), it +// will begin decoding the _next_ frame. +// +// if you want to seek using pushdata, you need to seek in your file, then +// call stb_vorbis_flush_pushdata(), then start calling decoding, then once +// decoding is returning you data, call stb_vorbis_get_sample_offset, and +// if you don't like the result, seek your file again and repeat. +#endif + + +////////// PULLING INPUT API + +#ifndef STB_VORBIS_NO_PULLDATA_API +// This API assumes stb_vorbis is allowed to pull data from a source-- +// either a block of memory containing the _entire_ vorbis stream, or a +// FILE * that you or it create, or possibly some other reading mechanism +// if you go modify the source to replace the FILE * case with some kind +// of callback to your code. (But if you don't support seeking, you may +// just want to go ahead and use pushdata.) + +#if !defined(STB_VORBIS_NO_STDIO) && !defined(STB_VORBIS_NO_INTEGER_CONVERSION) +extern int stb_vorbis_decode_filename(char *filename, int *channels, short **output); +#endif +extern int stb_vorbis_decode_memory(unsigned char *mem, int len, int *channels, short **output); +// decode an entire file and output the data interleaved into a malloc()ed +// buffer stored in *output. The return value is the number of samples +// decoded, or -1 if the file could not be opened or was not an ogg vorbis file. +// When you're done with it, just free() the pointer returned in *output. + +extern stb_vorbis * stb_vorbis_open_memory(unsigned char *data, int len, + int *error, stb_vorbis_alloc *alloc_buffer); +// create an ogg vorbis decoder from an ogg vorbis stream in memory (note +// this must be the entire stream!). on failure, returns NULL and sets *error + +#ifndef STB_VORBIS_NO_STDIO +extern stb_vorbis * stb_vorbis_open_filename(char *filename, + int *error, stb_vorbis_alloc *alloc_buffer); +// create an ogg vorbis decoder from a filename via fopen(). on failure, +// returns NULL and sets *error (possibly to VORBIS_file_open_failure). + +extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close, + int *error, stb_vorbis_alloc *alloc_buffer); +// create an ogg vorbis decoder from an open FILE *, looking for a stream at +// the _current_ seek point (ftell). on failure, returns NULL and sets *error. +// note that stb_vorbis must "own" this stream; if you seek it in between +// calls to stb_vorbis, it will become confused. Morever, if you attempt to +// perform stb_vorbis_seek_*() operations on this file, it will assume it +// owns the _entire_ rest of the file after the start point. Use the next +// function, stb_vorbis_open_file_section(), to limit it. + +extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_close, + int *error, stb_vorbis_alloc *alloc_buffer, unsigned int len); +// create an ogg vorbis decoder from an open FILE *, looking for a stream at +// the _current_ seek point (ftell); the stream will be of length 'len' bytes. +// on failure, returns NULL and sets *error. note that stb_vorbis must "own" +// this stream; if you seek it in between calls to stb_vorbis, it will become +// confused. +#endif + +extern int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number); +extern int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number); +// NOT WORKING YET +// these functions seek in the Vorbis file to (approximately) 'sample_number'. +// after calling seek_frame(), the next call to get_frame_*() will include +// the specified sample. after calling stb_vorbis_seek(), the next call to +// stb_vorbis_get_samples_* will start with the specified sample. If you +// do not need to seek to EXACTLY the target sample when using get_samples_*, +// you can also use seek_frame(). + +extern void stb_vorbis_seek_start(stb_vorbis *f); +// this function is equivalent to stb_vorbis_seek(f,0), but it +// actually works + +extern unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f); +extern float stb_vorbis_stream_length_in_seconds(stb_vorbis *f); +// these functions return the total length of the vorbis stream + +extern int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output); +// decode the next frame and return the number of samples. the number of +// channels returned are stored in *channels (which can be NULL--it is always +// the same as the number of channels reported by get_info). *output will +// contain an array of float* buffers, one per channel. These outputs will +// be overwritten on the next call to stb_vorbis_get_frame_*. +// +// You generally should not intermix calls to stb_vorbis_get_frame_*() +// and stb_vorbis_get_samples_*(), since the latter calls the former. + +#ifndef STB_VORBIS_NO_INTEGER_CONVERSION +extern int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buffer, int num_shorts); +extern int stb_vorbis_get_frame_short (stb_vorbis *f, int num_c, short **buffer, int num_samples); +#endif +// decode the next frame and return the number of samples per channel. the +// data is coerced to the number of channels you request according to the +// channel coercion rules (see below). You must pass in the size of your +// buffer(s) so that stb_vorbis will not overwrite the end of the buffer. +// The maximum buffer size needed can be gotten from get_info(); however, +// the Vorbis I specification implies an absolute maximum of 4096 samples +// per channel. Note that for interleaved data, you pass in the number of +// shorts (the size of your array), but the return value is the number of +// samples per channel, not the total number of samples. + +// Channel coercion rules: +// Let M be the number of channels requested, and N the number of channels present, +// and Cn be the nth channel; let stereo L be the sum of all L and center channels, +// and stereo R be the sum of all R and center channels (channel assignment from the +// vorbis spec). +// M N output +// 1 k sum(Ck) for all k +// 2 * stereo L, stereo R +// k l k > l, the first l channels, then 0s +// k l k <= l, the first k channels +// Note that this is not _good_ surround etc. mixing at all! It's just so +// you get something useful. + +extern int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float *buffer, int num_floats); +extern int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, int num_samples); +// gets num_samples samples, not necessarily on a frame boundary--this requires +// buffering so you have to supply the buffers. DOES NOT APPLY THE COERCION RULES. +// Returns the number of samples stored per channel; it may be less than requested +// at the end of the file. If there are no more samples in the file, returns 0. + +#ifndef STB_VORBIS_NO_INTEGER_CONVERSION +extern int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short *buffer, int num_shorts); +extern int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, int num_samples); +#endif +// gets num_samples samples, not necessarily on a frame boundary--this requires +// buffering so you have to supply the buffers. Applies the coercion rules above +// to produce 'channels' channels. Returns the number of samples stored per channel; +// it may be less than requested at the end of the file. If there are no more +// samples in the file, returns 0. + +#endif + +//////// ERROR CODES + +enum STBVorbisError +{ + VORBIS__no_error, + + VORBIS_need_more_data=1, // not a real error + + VORBIS_invalid_api_mixing, // can't mix API modes + VORBIS_outofmem, // not enough memory + VORBIS_feature_not_supported, // uses floor 0 + VORBIS_too_many_channels, // STB_VORBIS_MAX_CHANNELS is too small + VORBIS_file_open_failure, // fopen() failed + VORBIS_seek_without_length, // can't seek in unknown-length file + + VORBIS_unexpected_eof=10, // file is truncated? + VORBIS_seek_invalid, // seek past EOF + + // decoding errors (corrupt/invalid stream) -- you probably + // don't care about the exact details of these + + // vorbis errors: + VORBIS_invalid_setup=20, + VORBIS_invalid_stream, + + // ogg errors: + VORBIS_missing_capture_pattern=30, + VORBIS_invalid_stream_structure_version, + VORBIS_continued_packet_flag_invalid, + VORBIS_incorrect_stream_serial_number, + VORBIS_invalid_first_page, + VORBIS_bad_packet_type, + VORBIS_cant_find_last_page, + VORBIS_seek_failed +}; + + +#ifdef __cplusplus +} +#endif + +#endif // STB_VORBIS_INCLUDE_STB_VORBIS_H +// +// HEADER ENDS HERE +// +////////////////////////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/Arial.hpp b/src/SFML/Graphics/Arial.hpp new file mode 100644 index 00000000..2b224d83 --- /dev/null +++ b/src/SFML/Graphics/Arial.hpp @@ -0,0 +1,14685 @@ +0, 1, 0, 0, 0, 23, 1, 0, 0, 4, 0, 112, 68, 83, 73, 71, 36, 61, -7, -25, 0, 5, 127, -116, 0, +0, 26, 124, 71, 68, 69, 70, 94, 35, 93, 114, 0, 5, 117, 24, 0, 0, 0, -90, 71, 83, 85, 66, -43, -16, +-35, -52, 0, 5, 117, -64, 0, 0, 9, -86, 74, 83, 84, 70, 109, 42, 105, 6, 0, 5, 127, 108, 0, 0, 0, +30, 76, 84, 83, 72, -128, 101, -6, 60, 0, 0, 28, 120, 0, 0, 6, -114, 79, 83, 47, 50, 12, -33, 50, 107, +0, 0, 1, -8, 0, 0, 0, 86, 80, 67, 76, 84, -3, 123, 62, 67, 0, 5, 116, -32, 0, 0, 0, 54, 86, +68, 77, 88, 80, -110, 106, -11, 0, 0, 35, 8, 0, 0, 17, -108, 99, 109, 97, 112, -25, 64, 106, 58, 0, 0, +-47, -60, 0, 0, 23, 106, 99, 118, 116, 32, -106, 42, -46, 118, 0, 0, -6, -96, 0, 0, 6, 48, 102, 112, 103, +109, -52, 121, 89, -102, 0, 0, -23, 48, 0, 0, 6, 110, 103, 97, 115, 112, 0, 24, 0, 9, 0, 5, 116, -48, +0, 0, 0, 16, 103, 108, 121, 102, 14, -9, -113, -20, 0, 1, 26, -4, 0, 3, -25, 98, 104, 100, 109, 120, -66, +-69, -61, -105, 0, 0, 52, -100, 0, 0, -99, 40, 104, 101, 97, 100, -50, -104, 38, -110, 0, 0, 1, 124, 0, 0, +0, 54, 104, 104, 101, 97, 18, 51, 18, -1, 0, 0, 1, -76, 0, 0, 0, 36, 104, 109, 116, 120, 14, 52, 88, +64, 0, 0, 2, 80, 0, 0, 26, 40, 107, 101, 114, 110, 55, 97, 57, 54, 0, 5, 2, 96, 0, 0, 21, 96, +108, 111, 99, 97, 14, 97, 105, 50, 0, 1, 0, -48, 0, 0, 26, 44, 109, 97, 120, 112, 11, 71, 12, -88, 0, +0, 1, -40, 0, 0, 0, 32, 110, 97, 109, 101, -64, -14, 101, 59, 0, 5, 23, -64, 0, 0, 27, 13, 112, 111, +115, 116, -113, -23, -41, 126, 0, 5, 50, -48, 0, 0, 65, -1, 112, 114, 101, 112, 82, -2, -60, -23, 0, 0, -17, +-96, 0, 0, 10, -1, 0, 1, 0, 0, 0, 3, 0, 0, -26, -24, -70, -22, 95, 15, 60, -11, 8, 27, 8, 0, +0, 0, 0, 0, -94, -29, 39, 42, 0, 0, 0, 0, -71, -43, -76, -10, -6, -81, -3, 103, 16, 0, 8, 12, 0, +0, 0, 9, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 7, 62, -2, 78, 0, 67, 16, 0, -6, -81, +-2, 38, 16, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, -118, 0, 1, 0, +0, 6, -118, 1, 0, 0, 63, 0, 118, 0, 7, 0, 2, 0, 16, 0, 47, 0, 86, 0, 0, 4, 13, 10, -1, +0, 3, 0, 2, 0, 1, 3, -120, 1, -112, 0, 5, 0, 0, 5, -102, 5, 51, 0, 0, 1, 27, 5, -102, 5, +51, 0, 0, 3, -47, 0, 102, 2, 18, 8, 5, 2, 11, 6, 4, 2, 2, 2, 2, 2, 4, 0, 0, 122, -121, +-128, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 77, 111, 110, 111, 0, 64, 0, 32, -1, -4, 5, -45, -2, +81, 1, 51, 7, 62, 1, -78, 64, 0, 1, -1, -1, -1, 0, 0, 0, 0, 6, 0, 1, 0, 0, 0, 0, 0, +2, 57, 0, 0, 2, 57, 0, 0, 2, 57, 0, -80, 2, -41, 0, 94, 4, 115, 0, 21, 4, 115, 0, 73, 7, +29, 0, 119, 5, 86, 0, 88, 1, -121, 0, 90, 2, -86, 0, 124, 2, -86, 0, 124, 3, 29, 0, 64, 4, -84, +0, 114, 2, 57, 0, -86, 2, -86, 0, 65, 2, 57, 0, -70, 2, 57, 0, 0, 4, 115, 0, 85, 4, 115, 0, +-33, 4, 115, 0, 60, 4, 115, 0, 86, 4, 115, 0, 26, 4, 115, 0, 85, 4, 115, 0, 77, 4, 115, 0, 97, +4, 115, 0, 83, 4, 115, 0, 85, 2, 57, 0, -71, 2, 57, 0, -86, 4, -84, 0, 112, 4, -84, 0, 114, 4, +-84, 0, 112, 4, 115, 0, 90, 8, 31, 0, 111, 5, 86, -1, -3, 5, 86, 0, -106, 5, -57, 0, 102, 5, -57, +0, -98, 5, 86, 0, -94, 4, -29, 0, -88, 6, 57, 0, 109, 5, -57, 0, -92, 2, 57, 0, -65, 4, 0, 0, +55, 5, 86, 0, -106, 4, 115, 0, -106, 6, -86, 0, -104, 5, -57, 0, -100, 6, 57, 0, 99, 5, 86, 0, -98, +6, 57, 0, 88, 5, -57, 0, -95, 5, 86, 0, 92, 4, -29, 0, 48, 5, -57, 0, -95, 5, 86, 0, 9, 7, +-115, 0, 25, 5, 86, 0, 9, 5, 86, 0, 6, 4, -29, 0, 41, 2, 57, 0, -117, 2, 57, 0, 0, 2, 57, +0, 39, 3, -63, 0, 54, 4, 115, -1, -31, 2, -86, 0, 89, 4, 115, 0, 74, 4, 115, 0, -122, 4, 0, 0, +80, 4, 115, 0, 70, 4, 115, 0, 75, 2, 57, 0, 19, 4, 115, 0, 66, 4, 115, 0, -121, 1, -57, 0, -120, +1, -57, -1, -94, 4, 0, 0, -120, 1, -57, 0, -125, 6, -86, 0, -121, 4, 115, 0, -121, 4, 115, 0, 68, 4, +115, 0, -121, 4, 115, 0, 72, 2, -86, 0, -123, 4, 0, 0, 63, 2, 57, 0, 36, 4, 115, 0, -125, 4, 0, +0, 26, 5, -57, 0, 6, 4, 0, 0, 15, 4, 0, 0, 33, 4, 0, 0, 40, 2, -84, 0, 57, 2, 20, 0, +-68, 2, -84, 0, 47, 4, -84, 0, 87, 5, 86, -1, -3, 5, 86, -1, -3, 5, -57, 0, 104, 5, 86, 0, -94, +5, -57, 0, -100, 6, 57, 0, 99, 5, -57, 0, -95, 4, 115, 0, 74, 4, 115, 0, 74, 4, 115, 0, 74, 4, +115, 0, 74, 4, 115, 0, 74, 4, 115, 0, 74, 4, 0, 0, 80, 4, 115, 0, 75, 4, 115, 0, 75, 4, 115, +0, 75, 4, 115, 0, 75, 2, 57, 0, -67, 2, 57, 0, 35, 2, 57, -1, -27, 2, 57, 0, 9, 4, 115, 0, +-121, 4, 115, 0, 68, 4, 115, 0, 68, 4, 115, 0, 68, 4, 115, 0, 68, 4, 115, 0, 68, 4, 115, 0, -125, +4, 115, 0, -125, 4, 115, 0, -125, 4, 115, 0, -125, 4, 115, 0, 73, 3, 51, 0, -128, 4, 115, 0, 107, 4, +115, 0, 27, 4, 115, 0, 81, 2, -51, 0, 109, 4, 76, 0, 1, 4, -29, 0, -103, 5, -27, 0, 3, 5, -27, +0, 3, 8, 0, 0, -31, 2, -86, 0, -34, 2, -86, 0, 61, 4, 100, 0, 78, 8, 0, 0, 1, 6, 57, 0, +83, 5, -76, 0, -102, 4, 100, 0, 78, 4, 100, 0, 77, 4, 100, 0, 77, 4, 115, -1, -3, 4, -100, 0, -96, +3, -12, 0, 56, 5, -76, 0, 122, 6, -106, 0, -95, 4, 100, 0, 0, 2, 49, 0, 0, 2, -10, 0, 47, 2, +-20, 0, 45, 6, 37, 0, 127, 7, 29, 0, 68, 4, -29, 0, -127, 4, -29, 0, -98, 2, -86, 0, -24, 4, -84, +0, 114, 4, 100, 0, 84, 4, 115, 0, 46, 4, 100, 0, 51, 4, -27, 0, 26, 4, 115, 0, -122, 4, 115, 0, +-116, 8, 0, 0, -17, 5, 86, -1, -3, 5, 86, -1, -3, 6, 57, 0, 99, 8, 0, 0, -127, 7, -115, 0, 82, +4, 115, -1, -4, 8, 0, 0, 0, 2, -86, 0, 83, 2, -86, 0, 71, 1, -57, 0, -128, 1, -57, 0, 108, 4, +100, 0, 78, 3, -12, 0, 47, 4, 0, 0, 33, 5, 86, 0, 6, 1, 86, -2, 57, 4, 115, -1, -28, 2, -86, +0, 92, 2, -86, 0, 92, 4, 0, 0, 23, 4, 0, 0, 23, 4, 115, 0, 73, 2, 57, 0, -71, 1, -57, 0, +108, 2, -86, 0, 71, 8, 0, 0, 37, 5, 86, -1, -3, 5, 86, 0, -94, 5, 86, -1, -3, 5, 86, 0, -94, +5, 86, 0, -94, 2, 57, 0, -115, 2, 57, -1, -32, 2, 57, 0, 4, 2, 57, 0, 21, 6, 57, 0, 99, 6, +57, 0, 99, 6, 57, 0, 99, 5, -57, 0, -95, 5, -57, 0, -95, 5, -57, 0, -95, 2, 57, 0, -58, 2, -86, +0, 25, 2, -86, 0, 6, 2, -86, 0, 29, 2, -86, 0, 46, 2, -86, 0, -27, 2, -86, 0, -94, 2, -86, 0, +107, 2, -86, 0, 58, 2, -86, 0, -73, 2, -86, 0, 40, 4, 115, 0, 0, 1, -57, 0, 3, 5, 86, 0, 92, +4, 0, 0, 63, 4, -29, 0, 41, 4, 0, 0, 40, 2, 20, 0, -68, 5, -57, -1, -3, 4, 115, 0, 73, 5, +86, 0, 6, 4, 0, 0, 33, 5, 86, 0, -98, 4, 115, 0, -121, 4, -84, 0, 114, 4, -84, 0, -95, 2, -86, +0, 107, 2, -86, 0, 25, 2, -86, 0, 33, 6, -84, 0, 107, 6, -84, 0, 107, 6, -84, 0, 33, 4, 115, 0, +0, 6, 57, 0, 109, 4, 115, 0, 66, 2, 57, 0, -79, 5, 86, 0, 92, 4, 0, 0, 63, 5, -57, 0, 102, +4, 0, 0, 80, 5, -57, 0, 102, 4, 0, 0, 80, 4, 115, 0, 70, 4, 107, -1, -31, 2, -86, 1, -15, 5, +86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, -57, 0, -98, 4, -21, 0, 71, 5, -57, +-1, -3, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, 0, -94, 4, 115, 0, 75, 4, 115, 0, -106, 1, -57, 0, +66, 4, 115, 0, -106, 2, 85, 0, -120, 4, 115, 0, -102, 2, -84, 0, -125, 5, -57, 0, -100, 4, 115, 0, -121, +5, -57, 0, -100, 4, 115, 0, -121, 6, 57, 0, 99, 4, 115, 0, 68, 5, -57, 0, -95, 2, -86, 0, -123, 5, +-57, 0, -95, 2, -86, 0, 60, 5, 86, 0, 92, 4, 0, 0, 63, 4, -29, 0, 48, 2, 57, 0, 36, 4, -29, +0, 48, 3, 0, 0, 35, 5, -57, 0, -95, 4, 115, 0, -125, 5, -57, 0, -95, 4, 115, 0, -125, 4, -29, 0, +41, 4, 0, 0, 40, 4, -29, 0, 41, 4, 0, 0, 40, 4, 104, 0, -92, 6, 57, 0, 96, 6, 98, 0, 85, +4, -96, 0, 72, 4, 116, 0, 72, 3, -111, 0, 98, 4, -16, 0, 68, 3, 41, 0, 46, 5, 48, 0, 72, 4, +107, -1, -31, 4, 0, 0, -80, 2, -21, 0, 82, 8, -64, 0, 51, 8, 0, 0, 79, 4, 0, 0, -103, 8, 0, +0, 79, 4, 0, 0, -103, 8, 0, 0, 79, 4, 0, 0, -104, 4, 0, 0, -104, 7, -43, 1, 106, 5, -64, 0, +-98, 4, -85, 0, 114, 4, -43, 0, -99, 4, -84, 0, 113, 4, -43, 2, 34, 4, -43, 1, 5, 5, -85, -1, -23, +5, 0, 1, -55, 5, -85, 2, 126, 5, -85, -1, -23, 5, -85, 2, 126, 5, -85, -1, -23, 5, -85, 2, 126, 5, +-85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, 1, -64, 5, -85, +2, 126, 5, -85, 1, -64, 5, -85, 1, -64, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, 2, +126, 5, -85, 1, -64, 5, -85, 1, -64, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, 2, 126, +5, -85, 1, -64, 5, -85, 1, -64, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, +-85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, +-1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, -1, -23, 5, -85, 2, +-42, 5, -85, 0, 102, 5, -85, -1, -22, 5, -43, -1, -1, 4, -43, 0, -110, 8, 0, 0, 0, 7, -21, 1, 48, +7, -21, 1, 32, 7, -21, 1, 48, 7, -21, 1, 32, 4, -43, 0, -78, 4, -43, 0, -128, 4, -43, 0, 42, 8, +43, 1, -104, 8, 107, 1, -72, 7, 85, 0, 16, 6, 0, 0, -12, 6, 0, 0, 111, 4, 64, 0, 58, 5, 64, +0, 55, 4, -64, 0, 63, 4, 21, 0, 64, 4, 0, 0, 37, 6, 0, 0, 85, 5, -31, 0, -65, 3, -115, 0, +-119, 4, -43, -1, -39, 1, -128, 0, -128, 2, -43, 0, -122, 7, 21, 0, 97, 2, -106, 0, 15, 4, -43, 0, -110, +2, -42, 0, -125, 2, -42, 0, -125, 4, -43, 0, -78, 2, -42, 0, 112, 5, 86, -1, -3, 4, 115, 0, 74, 5, +-57, 0, 102, 4, 0, 0, 80, 5, -57, 0, 102, 4, 0, 0, 80, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, +0, -94, 4, 115, 0, 75, 5, 86, 0, -94, 4, 115, 0, 75, 6, 57, 0, 109, 4, 115, 0, 66, 6, 57, 0, +109, 4, 115, 0, 66, 6, 57, 0, 109, 4, 115, 0, 66, 5, -57, 0, -92, 4, 115, 0, -121, 5, -57, 0, 31, +4, 115, 0, 6, 2, 57, -1, -50, 2, 57, -1, -50, 2, 57, -1, -28, 2, 57, -1, -28, 2, 57, -1, -10, 2, +57, -1, -11, 2, 57, 0, -93, 1, -57, 0, 102, 4, 0, 0, 55, 1, -57, -1, -94, 5, 86, 0, -106, 4, 0, +0, -120, 4, 0, 0, -122, 4, 115, 0, -106, 1, -57, -1, -6, 5, -57, 0, -100, 4, 115, 0, -121, 5, -55, 0, +-91, 4, 115, 0, -117, 6, 57, 0, 99, 4, 115, 0, 68, 6, 57, 0, 99, 4, 115, 0, 68, 5, -57, 0, -95, +2, -86, 0, 107, 5, 86, 0, 92, 4, 0, 0, 63, 4, -29, 0, 48, 2, 57, 0, 12, 5, -57, 0, -95, 4, +115, 0, -125, 5, -57, 0, -95, 4, 115, 0, -125, 5, -57, 0, -95, 4, 115, 0, -125, 5, -57, 0, -95, 4, 115, +0, -125, 7, -115, 0, 25, 5, -57, 0, 6, 5, 86, 0, 6, 4, 0, 0, 33, 1, -57, 0, -119, 5, 86, -1, +-3, 4, 115, 0, 74, 8, 0, 0, 1, 7, 29, 0, 68, 6, 57, 0, 83, 4, -29, 0, -127, 2, 57, 0, -71, +7, -115, 0, 25, 5, -57, 0, 6, 7, -115, 0, 25, 5, -57, 0, 6, 7, -115, 0, 25, 5, -57, 0, 6, 5, +86, 0, 6, 4, 0, 0, 33, 1, -57, 0, -118, 2, -86, -1, -31, 4, 115, 0, 27, 4, -51, 0, 90, 6, -84, +0, 107, 6, -84, 0, 34, 6, -84, 0, 34, 6, -84, 0, 74, 2, -86, 0, -30, 2, -86, 0, 107, 2, -86, 0, +-34, 2, -86, -1, -22, 5, 87, -1, -1, 6, 70, -1, -89, 6, -76, -1, -88, 3, 18, -1, -88, 6, 50, -1, -89, +6, -40, -1, -89, 6, 5, -1, -89, 1, -57, -1, 120, 5, 86, -1, -3, 5, 86, 0, -106, 5, 88, -1, -2, 5, +86, 0, -94, 4, -29, 0, 41, 5, -57, 0, -92, 2, 57, 0, -65, 5, 86, 0, -106, 5, 88, 0, 11, 6, -86, +0, -104, 5, -57, 0, -100, 5, 51, 0, 109, 6, 57, 0, 99, 5, -57, 0, -92, 5, 86, 0, -98, 4, -14, 0, +-108, 4, -29, 0, 48, 5, 86, 0, 6, 5, 86, 0, 9, 6, -81, 0, 127, 5, -5, 0, 97, 2, 57, 0, 4, +5, 86, 0, 6, 4, -96, 0, 72, 3, -111, 0, 98, 4, 115, 0, -117, 1, -57, 0, 107, 4, 96, 0, -120, 4, +-102, 0, -116, 4, 0, 0, 25, 3, -121, 0, 72, 4, 115, 0, -117, 4, 115, 0, 92, 1, -57, 0, -119, 4, 0, +0, -122, 4, 0, 0, 24, 4, -100, 0, -96, 4, 0, 0, 26, 3, -107, 0, 92, 4, 115, 0, 68, 4, -115, 0, +-125, 3, -37, 0, 86, 4, 96, 0, -120, 4, 51, 0, 17, 5, -76, 0, 122, 6, 63, 0, 87, 1, -57, -1, -55, +4, 96, 0, -120, 4, 115, 0, 72, 4, 96, 0, -120, 6, 63, 0, 87, 5, 87, 0, -94, 6, -21, 0, 50, 4, +85, 0, -95, 5, -64, 0, 100, 5, 86, 0, 92, 2, 57, 0, -65, 2, 57, 0, 4, 4, 0, 0, 55, 8, 117, +0, 13, 8, 21, 0, -92, 6, -43, 0, 49, 4, -87, 0, -95, 5, 21, 0, 10, 5, -64, 0, -96, 5, 86, -1, +-3, 5, 64, 0, -89, 5, 86, 0, -106, 4, 85, 0, -95, 5, 107, 0, 0, 5, 86, 0, -94, 7, 99, 0, 7, +4, -43, 0, 78, 5, -64, 0, -95, 5, -64, 0, -95, 4, -87, 0, -95, 5, 64, 0, 18, 6, -86, 0, -104, 5, +-57, 0, -92, 6, 57, 0, 99, 5, -64, 0, -96, 5, 86, 0, -98, 5, -57, 0, 102, 4, -29, 0, 48, 5, 21, +0, 10, 6, 21, 0, 82, 5, 86, 0, 9, 5, -21, 0, -97, 5, 85, 0, 87, 7, 85, 0, -95, 7, -128, 0, +-95, 6, 85, 0, 0, 7, 21, 0, -88, 5, 64, 0, -91, 5, -64, 0, 85, 8, 21, 0, -92, 5, -57, 0, 26, +4, 115, 0, 74, 4, -107, 0, 91, 4, 64, 0, -120, 2, -21, 0, -120, 4, -85, 0, 0, 4, 115, 0, 75, 5, +90, -1, -5, 3, -85, 0, 50, 4, 120, 0, -121, 4, 120, 0, -121, 3, -128, 0, -122, 4, -85, 0, 24, 5, -128, +0, -116, 4, 107, 0, -120, 4, 115, 0, 68, 4, 85, 0, -120, 4, 115, 0, -121, 4, 0, 0, 80, 3, -86, 0, +38, 4, 0, 0, 33, 6, -107, 0, 75, 4, 0, 0, 15, 4, -107, 0, -118, 4, 43, 0, 69, 6, 107, 0, -115, +6, -107, 0, -115, 5, 0, 0, 40, 5, -64, 0, -117, 4, 43, 0, -124, 4, 21, 0, 48, 6, 0, 0, -119, 4, +85, 0, 31, 4, 115, 0, 75, 4, 115, 0, 0, 2, -21, 0, -119, 4, 21, 0, 75, 4, 0, 0, 63, 1, -57, +0, -120, 2, 57, 0, 9, 1, -57, -1, -94, 7, 64, 0, 19, 6, -128, 0, -125, 4, 115, 0, 0, 3, -128, 0, +-122, 4, 0, 0, 33, 4, 107, 0, -120, 3, -23, 0, -95, 3, 74, 0, -120, 8, 0, 0, 65, 8, -107, 0, -96, +5, -123, 0, 45, 2, -86, 1, 1, 2, -86, 0, 30, 2, -86, 0, 49, 2, -86, 0, 49, 2, -86, 1, 1, 2, +-86, 0, 126, 2, -86, 0, 126, 2, -86, 0, -116, 2, -86, 0, -116, 2, -86, 1, 1, 2, -86, 0, 16, 2, -86, +1, 1, 2, -86, 1, 33, 3, 16, 0, 125, 2, -86, 0, -116, 2, 51, 0, -46, 2, -86, 3, 11, 2, -86, -1, +4, 2, 57, 0, -71, 4, -127, 0, 105, 4, 86, 0, 50, 3, 49, 0, 25, 4, 17, 0, 45, 4, -47, 0, -106, +1, -7, 0, -101, 3, 15, 0, 95, 4, -54, 0, -101, 4, -72, 0, -116, 1, -7, 0, -101, 4, 19, 0, 40, 3, +-80, 0, 80, 3, -76, 0, 60, 4, -54, 0, -101, 4, -49, 0, 80, 1, -7, 0, -101, 2, -46, 0, 60, 4, -104, +0, 90, 4, 60, 0, 25, 4, -120, 0, 110, 4, 95, 0, 115, 3, -79, 0, 25, 3, -44, 0, 10, 4, 102, 0, +-106, 4, 19, 0, 40, 5, -114, 0, 100, 5, 36, 0, 40, 3, -14, 0, -101, 3, -14, 0, -101, 3, -14, 0, -101, +1, -29, 0, 90, 3, 86, 0, 90, 6, -122, 0, -101, 1, -7, -1, -84, 4, 19, 0, 40, 4, 19, 0, 40, 3, +-76, -1, 87, 3, -76, -1, 87, 4, 72, 0, 45, 5, -114, 0, 100, 5, -114, 0, 100, 5, -114, 0, 100, 5, -114, +0, 100, 4, -127, 0, 105, 4, -127, 0, 105, 4, -127, 0, 105, 4, 86, 0, 50, 3, 49, 0, 25, 4, 17, 0, +45, 4, -47, 0, -106, 2, 75, 0, 0, 3, 74, 0, 0, 4, -72, 0, -116, 2, 75, 0, 0, 4, 19, 0, 40, +3, -80, 0, 80, 3, -76, 0, 60, 4, -49, 0, 80, 2, -46, 0, 60, 4, -104, 0, 90, 4, -120, 0, 110, 4, +95, 0, 115, 3, -44, 0, 10, 4, 102, 0, -106, 4, 19, 0, 40, 5, -114, 0, 100, 5, 36, 0, 40, 1, -7, +0, -101, 4, 86, 0, 50, 3, -80, 0, 80, 4, 95, 0, 115, 4, -101, 0, 60, 0, 0, -1, -36, 0, 0, -1, +37, 0, 0, -1, -36, 0, 0, -2, 81, 2, -115, 0, -85, 2, -115, 0, -96, 2, -38, 0, 67, 3, 77, 0, 121, +1, -88, -1, -70, 1, -100, 0, 70, 1, -27, 0, 70, 1, -100, 0, 70, 1, -100, 0, 70, 1, -83, 0, 72, 1, +-100, 0, 70, 1, -79, 0, 70, 1, 81, 0, 70, 4, 53, 1, 124, 4, 53, 1, 46, 4, 53, 0, -73, 4, 53, +0, -127, 4, 53, 1, 44, 4, 53, 0, -66, 4, 53, 0, -81, 4, 53, 0, -127, 4, 53, 0, -102, 4, 53, 0, +-37, 4, 53, 0, -123, 2, -115, 0, -63, 4, 53, 0, -77, 6, 0, 1, 0, 6, 0, 1, 0, 2, 66, 0, 54, +6, 0, 1, 0, 4, 53, 0, -98, 4, 53, 0, -104, 4, 53, 0, -53, 6, 0, 1, 0, 6, 0, 1, 0, 6, +0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 1, -79, 0, 70, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, +1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 5, 27, -1, +-70, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, +1, -12, -1, -70, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 4, -127, 0, 54, 4, +53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, 3, -23, 0, 74, 3, -23, 0, 74, 6, 127, 0, 20, 7, 118, +0, 20, 3, 39, -1, -70, 4, 30, -1, -70, 6, 127, 0, 20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, -1, +-70, 5, 27, 0, 50, 4, -75, 0, 36, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, +6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, +0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 1, -49, +0, 48, 1, -79, 0, 70, 1, -79, 0, 70, 1, -79, 0, 64, 1, -79, 0, 70, 6, 0, 1, 0, 6, 0, 1, +0, 0, 0, -1, -36, 0, 0, -2, 81, 0, 0, -1, 22, 0, 0, -1, 22, 0, 0, -1, 22, 0, 0, -1, 22, +0, 0, -1, 22, 0, 0, -1, 22, 0, 0, -1, 22, 0, 0, -1, 22, 0, 0, -1, 22, 0, 0, -1, -36, 0, +0, -1, 22, 0, 0, -1, -36, 0, 0, -1, 32, 0, 0, -1, -36, 4, 115, 0, 74, 8, 0, 0, 0, 6, 0, +1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, +0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, +6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, +0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, +1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 2, -115, 0, 127, 2, -115, 0, 93, 6, 0, 1, 0, 4, -18, 0, +21, 3, 77, 0, 121, 1, -88, 0, 14, 1, -42, -1, -36, 1, -88, 0, 86, 1, -42, 0, 16, 3, 117, 0, 50, +3, 117, 0, 50, 1, -88, 0, 45, 1, -42, 0, 19, 5, 27, 0, 50, 4, -75, 0, 36, 1, -12, -1, -70, 1, +-12, -1, -70, 1, -88, 0, -109, 1, -42, 0, 19, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, +-1, -70, 2, 66, 0, 0, 3, 0, -1, -9, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, +-70, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, -70, 4, -127, 0, 54, 4, 53, 0, 54, +4, 61, -1, -70, 4, 61, -1, -70, 4, -127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, 4, +-127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, +0, 95, 2, -77, 0, 95, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 6, -110, 0, +62, 6, -110, 0, 62, 4, 63, -1, -70, 4, 63, -1, -70, 6, -110, 0, 62, 6, -110, 0, 62, 4, 63, -1, -70, +4, 63, -1, -70, 8, -55, 0, 62, 8, -55, 0, 62, 6, -59, -1, -70, 6, -59, -1, -70, 8, -55, 0, 62, 8, +-55, 0, 62, 6, -59, -1, -70, 6, -59, -1, -70, 4, -89, -1, -70, 4, -89, -1, -70, 4, -89, -1, -70, 4, -89, +-1, -70, 4, -89, -1, -70, 4, -89, -1, -70, 4, -89, -1, -70, 4, -89, -1, -70, 4, 90, 0, 42, 3, -102, 0, +54, 4, 53, -1, -70, 3, 39, -1, -70, 4, 90, 0, 42, 3, -102, 0, 54, 4, 53, -1, -70, 3, 39, -1, -70, +6, 79, 0, 39, 6, 79, 0, 39, 2, 36, -1, -70, 2, 26, -1, -70, 4, -89, 0, 70, 4, -89, 0, 70, 2, +36, -1, -70, 2, 26, -1, -70, 4, -49, 0, 45, 4, -49, 0, 45, 3, 39, -1, -70, 3, 39, -1, -70, 4, 13, +0, 71, 4, 13, 0, 71, 1, -88, -1, -70, 1, -88, -1, -70, 2, -76, 0, 35, 2, -76, 0, 35, 3, 39, -1, +-70, 3, 39, -1, -70, 4, 53, 0, 69, 4, 53, 0, 69, 1, -12, -1, -70, 1, -12, -1, -70, 2, 66, 0, 54, +3, 0, -1, -9, 3, -102, -1, -70, 3, 39, -1, -70, 3, 117, 0, 50, 3, 117, 0, 50, 5, 27, 0, 50, 4, +-75, 0, 36, 5, 27, 0, 50, 4, -75, 0, 36, 1, -12, -1, -70, 1, -12, -1, -70, 4, 90, 0, 64, 4, -50, +0, 73, 4, 90, 0, 38, 4, -50, 0, 57, 4, 90, 0, 83, 4, -50, 0, 74, 4, 90, 0, 83, 4, -50, 0, +74, 6, 0, 1, 0, 6, 0, 1, 0, 1, -100, 0, 70, 1, -100, 0, 70, 6, 0, 1, 0, 6, 0, 1, 0, +6, 0, 1, 0, 1, 81, 0, 70, 1, -79, 0, 70, 6, 0, 1, 0, 6, 0, 1, 0, 1, -83, 0, 72, 1, +-27, 0, 70, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 1, -79, 0, 70, 1, -79, 0, 70, 1, -79, +0, 70, 1, -79, 0, 70, 1, -79, 0, 64, 1, -49, 0, 48, 6, 0, 1, 0, 1, -100, 0, 70, 1, -100, 0, +70, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, +6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, +0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, +1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, +0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, +6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, +0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, +1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, +0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 2, -115, 0, -54, 2, -115, 0, -57, +2, -115, 0, -58, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, +0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, +1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, +0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, 6, 0, 1, 0, +1, 0, -1, -70, 8, 0, -1, -70, 16, 0, -1, -70, 6, -36, 0, 99, 5, 63, 0, 68, 6, -43, 0, -95, 5, +91, 0, -125, 0, 0, -3, -36, 0, 0, -4, 47, 0, 0, -4, -90, 0, 0, -2, 84, 0, 0, -4, -41, 0, 0, +-3, 115, 0, 0, -2, 41, 0, 0, -2, 13, 0, 0, -3, 17, 0, 0, -4, 103, 0, 0, -3, -99, 0, 0, -5, +-11, 0, 0, -4, 114, 0, 0, -2, -43, 0, 0, -2, -43, 0, 0, -1, 2, 4, 27, 0, -96, 6, -84, 0, 107, +6, -84, 0, 25, 0, 0, -2, -74, 0, 0, -3, 115, 0, 0, -2, 8, 0, 0, -4, -90, 0, 0, -2, 83, 0, +0, -3, 17, 0, 0, -5, -56, 0, 0, -6, -12, 0, 0, -6, -81, 0, 0, -4, 114, 0, 0, -5, -86, 0, 0, +-5, 106, 0, 0, -4, -15, 0, 0, -4, 125, 0, 0, -5, -35, 0, 0, -4, -63, 0, 0, -5, -104, 0, 0, -3, +-22, 0, 0, -2, -124, 0, 0, -3, -62, 0, 0, -4, -15, 0, 0, -3, 95, 0, 0, -2, 118, 0, 0, -2, -68, +0, 0, -4, -21, 0, 0, -3, 108, 0, 0, -3, 88, 0, 0, -4, -112, 0, 0, -3, 21, 0, 0, -4, 44, 0, +0, -4, 19, 0, 0, -4, 18, 0, 0, -5, -106, 0, 0, -5, -106, 1, -57, 0, -120, 5, 86, -1, -3, 4, 115, +0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, +74, 5, 86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, +5, 86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, +86, -1, -3, 4, 115, 0, 74, 5, 86, -1, -3, 4, 115, 0, 74, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, +0, -94, 4, 115, 0, 75, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, 0, +-94, 4, 115, 0, 75, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, 0, -94, 4, 115, 0, 75, 5, 86, 0, -94, +4, 115, 0, 75, 2, 57, 0, 99, 1, -57, 0, 31, 2, 57, 0, -70, 1, -57, 0, 124, 6, 57, 0, 99, 4, +115, 0, 68, 6, 57, 0, 99, 4, 115, 0, 68, 6, 57, 0, 99, 4, 115, 0, 68, 6, 57, 0, 99, 4, 115, +0, 68, 6, 57, 0, 99, 4, 115, 0, 68, 6, 57, 0, 99, 4, 115, 0, 68, 6, 57, 0, 99, 4, 115, 0, +68, 6, -36, 0, 99, 5, 63, 0, 68, 6, -36, 0, 99, 5, 63, 0, 68, 6, -36, 0, 99, 5, 63, 0, 68, +6, -36, 0, 99, 5, 63, 0, 68, 6, -36, 0, 99, 5, 63, 0, 68, 5, -57, 0, -95, 4, 115, 0, -125, 5, +-57, 0, -95, 4, 115, 0, -125, 6, -43, 0, -95, 5, 91, 0, -125, 6, -43, 0, -95, 5, 91, 0, -125, 6, -43, +0, -95, 5, 91, 0, -125, 6, -43, 0, -95, 5, 91, 0, -125, 6, -43, 0, -95, 5, 91, 0, -125, 5, 86, 0, +6, 4, 0, 0, 33, 5, 86, 0, 6, 4, 0, 0, 33, 5, 86, 0, 6, 4, 0, 0, 33, 5, 86, -1, -3, +4, 115, 0, 74, 2, 57, -1, -30, 1, -57, -1, -80, 6, 57, 0, 99, 4, 115, 0, 68, 5, -57, 0, -95, 4, +115, 0, -125, 5, -57, 0, -95, 4, 115, 0, -125, 5, -57, 0, -95, 4, 115, 0, -125, 5, -57, 0, -95, 4, 115, +0, -125, 5, -57, 0, -95, 4, 115, 0, -125, 0, 0, -2, -2, 0, 0, -2, -2, 0, 0, -2, -2, 0, 0, -2, +-2, 4, 85, -1, -3, 2, -21, 0, 12, 7, 99, 0, 7, 5, 90, -1, -5, 4, -87, 0, -95, 3, -128, 0, -122, +4, -87, 0, -95, 3, -128, 0, -122, 5, -57, 0, -92, 4, 107, 0, -120, 4, 115, -1, -3, 4, 0, 0, 20, 4, +115, -1, -3, 4, 0, 0, 20, 5, 86, 0, 9, 4, 0, 0, 15, 5, 85, 0, 87, 4, 43, 0, 69, 5, 85, +0, -95, 4, 115, 0, -121, 6, 5, 0, 99, 4, 115, 0, 85, 6, 57, 0, 96, 4, 115, 0, 68, 5, -75, 0, +58, 1, -12, -1, -70, 2, 36, -1, -70, 2, 26, -1, -70, 4, -89, 0, 70, 1, -12, 0, -98, 1, -12, 0, 16, +1, -12, 0, 27, 1, -12, 0, 16, 1, -12, 0, 107, 1, -12, -1, -7, 2, 39, -1, -50, 1, -88, 0, 15, 1, +-88, -1, -11, 2, -86, 0, -92, 2, -86, 0, -92, 1, -88, 0, 14, 1, -88, 0, 86, 1, -88, 0, 86, 0, 0, +-1, -49, 1, -88, 0, 15, 1, -42, -1, -65, 1, -88, -1, -11, 1, -42, -1, -51, 1, -88, 0, 29, 1, -42, -1, +-11, 1, -88, 0, -109, 1, -42, 0, 19, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, +5, 27, 0, 50, 4, -75, 0, 36, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, -70, 5, +-75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, -70, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, +-1, -70, 1, -12, -1, -70, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, -70, 5, -75, 0, +58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, -70, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, +1, -12, -1, -70, 5, -75, 0, 58, 5, -75, 0, 58, 1, -12, -1, -70, 1, -12, -1, -70, 4, -127, 0, 54, 4, +53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, 4, -127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, +-1, -70, 4, -127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, 4, -127, 0, 54, 4, 53, 0, +54, 4, 61, -1, -70, 4, 61, -1, -70, 4, -127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, +4, -127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, -1, -70, 2, -77, 0, 50, 2, -77, 0, 50, 2, +-77, 0, 95, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, 0, 50, 2, -77, 0, 50, 2, -77, +0, 95, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, 0, 95, 2, -77, 0, +56, 2, -77, 0, 56, 2, -77, 0, 73, 2, -77, 0, 73, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, +3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, +-23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, 0, 74, 3, -23, +0, 74, 6, -110, 0, 62, 6, -110, 0, 62, 4, 63, -1, -70, 4, 63, -1, -70, 6, -110, 0, 62, 6, -110, 0, +62, 4, 63, -1, -70, 4, 63, -1, -70, 6, -110, 0, 62, 6, -110, 0, 62, 4, 63, -1, -70, 4, 63, -1, -70, +8, -55, 0, 62, 8, -55, 0, 62, 6, -59, -1, -70, 6, -59, -1, -70, 8, -55, 0, 62, 8, -55, 0, 62, 6, +-59, -1, -70, 6, -59, -1, -70, 4, -89, -1, -70, 4, -89, -1, -70, 4, 90, 0, 42, 3, -102, 0, 54, 4, 53, +-1, -70, 3, 39, -1, -70, 6, 79, 0, 39, 6, 79, 0, 39, 6, 79, 0, 39, 2, 36, -1, -70, 2, 26, -1, +-70, 6, 79, 0, 39, 6, 79, 0, 39, 2, 36, -1, -70, 2, 26, -1, -70, 6, 79, 0, 39, 6, 79, 0, 39, +2, 36, -1, -70, 2, 26, -1, -70, 6, 79, 0, 39, 6, 79, 0, 39, 2, 36, -1, -70, 2, 26, -1, -70, 6, +79, 0, 39, 6, 79, 0, 39, 2, 36, -1, -70, 2, 26, -1, -70, 4, -89, 0, 70, 4, -89, 0, 70, 4, -89, +0, 70, 4, -89, 0, 70, 6, 127, 0, 20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, -1, -70, 6, 127, 0, +20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, -1, -70, 4, -49, 0, 45, 4, -49, 0, 45, 3, 39, -1, -70, +3, 39, -1, -70, 4, -49, 0, 45, 4, -49, 0, 45, 3, 39, -1, -70, 3, 39, -1, -70, 4, -49, 0, 45, 4, +-49, 0, 45, 3, 39, -1, -70, 3, 39, -1, -70, 6, 127, 0, 20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, +-1, -70, 6, 127, 0, 20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, -1, -70, 6, 127, 0, 20, 7, 118, 0, +20, 3, 39, -1, -70, 4, 30, -1, -70, 6, 127, 0, 20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, -1, -70, +6, 127, 0, 20, 7, 118, 0, 20, 3, 39, -1, -70, 4, 30, -1, -70, 4, 13, 0, 71, 4, 13, 0, 71, 1, +-88, -1, -70, 1, -88, -1, -70, 4, 13, 0, 71, 4, 13, 0, 71, 1, -88, -1, -70, 1, -88, -1, -70, 4, 13, +0, 71, 4, 13, 0, 71, 1, -88, -1, -70, 1, -88, -1, -70, 4, 13, 0, 71, 4, 13, 0, 71, 1, -88, -1, +-70, 1, -88, -1, -70, 4, 53, 0, 69, 4, 53, 0, 69, 1, -12, -1, -70, 1, -12, -1, -70, 4, 53, 0, 69, +4, 53, 0, 69, 4, 53, 0, 69, 4, 53, 0, 69, 4, 53, 0, 69, 4, 53, 0, 69, 1, -12, -1, -70, 1, +-12, -1, -70, 4, 53, 0, 69, 4, 53, 0, 69, 4, -127, 0, 54, 4, 53, 0, 54, 4, 61, -1, -70, 4, 61, +-1, -70, 2, 66, 0, 54, 3, 0, -1, -9, 3, 26, 0, 26, 3, 26, 0, 26, 3, 26, 0, 26, 3, 117, 0, +50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, +3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 3, +117, 0, 50, 3, 117, 0, 50, 3, 117, 0, 50, 5, 27, -1, -70, 4, -75, -1, -70, 5, 27, 0, 50, 4, -75, +0, 36, 1, -12, -1, -70, 1, -12, -1, -70, 3, 117, 0, 50, 3, 117, 0, 50, 5, 27, 0, 50, 4, -75, 0, +36, 1, -12, -1, -70, 1, -12, -1, -70, 5, 27, 0, 50, 4, -75, 0, 36, 6, 127, 0, 69, 6, 127, 0, 69, +6, 127, 0, 69, 6, 127, 0, 69, 1, -88, 0, 40, 0, 0, -2, 41, 0, 0, -2, -94, 0, 0, -1, 48, 0, +0, -1, 29, 0, 0, -1, 18, 0, 0, -1, -110, 0, 0, -2, 126, 8, -4, 0, 50, 8, -83, 0, 50, 0, 0, +-1, -75, 0, 0, -1, -74, 0, 0, -2, -19, 0, 0, -1, 100, 0, 0, -2, 126, 0, 0, -1, -97, 1, -115, 0, +0, 2, -10, -1, -3, 0, 0, -2, -126, 0, 0, -1, 16, 4, -51, 0, 50, 0, 0, -1, 88, 0, 0, -1, 88, +0, 0, -1, 100, 6, -110, 0, 62, 6, -110, 0, 62, 4, 63, -1, -70, 4, 63, -1, -70, 8, -55, 0, 62, 8, +-55, 0, 62, 6, -59, -1, -70, 6, -59, -1, -70, 4, 90, 0, 42, 3, -102, 0, 54, 4, 53, -1, -70, 3, 39, +-1, -70, 3, 77, 0, 121, 2, -76, 0, 35, 2, 66, 0, 54, 1, -12, -1, -70, 2, -112, -1, -70, 1, -12, 0, +47, 1, -12, 0, 59, 1, -12, 0, 18, 1, -12, 0, -79, 1, -12, 0, 109, 6, 127, 0, 20, 7, 118, 0, 20, +1, -7, 0, -101, 0, 0, -2, -39, 2, -68, 0, 0, 3, -14, 0, -101, 4, 90, -1, -11, 4, -50, -1, -11, 4, +90, 0, 83, 4, -50, 0, 74, 4, 90, 0, 83, 4, -50, 0, 74, 4, 90, 0, 83, 4, -50, 0, 74, 4, 90, +0, 83, 4, -50, 0, 74, 4, 90, 0, 83, 4, -50, 0, 74, 4, 90, 0, 83, 4, -50, 0, 74, 4, 53, 0, +113, 4, 53, 0, -83, 4, 90, 0, 15, 4, -50, 0, 15, 0, 0, 6, -118, 7, 1, 1, 1, -85, 6, 6, 6, +5, 5, 6, 6, 6, 6, 7, 7, 6, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, +7, 6, 1, 37, 5, 12, 12, 12, 12, 18, 28, 62, 28, 5, 6, 117, 28, 18, 28, 18, 18, 5, -102, 28, 31, +-123, -32, -106, 18, 7, 7, 7, -62, 6, 6, 38, 53, 6, 35, 39, 101, 83, 55, 57, -27, 93, 57, 113, 55, 36, +53, 83, 6, 43, 18, 55, -58, -92, -43, -60, 99, 6, -2, 6, 7, 5, 5, 6, 5, 6, 7, 6, 6, 6, 6, +6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, +6, 6, 6, 6, 17, 6, 6, 1, 6, 6, 6, 1, 12, 6, 6, 6, 6, 6, 24, 12, 12, 1, 6, -1, 22, +24, 1, 5, 41, 12, -31, 7, 82, 6, 12, 77, 6, 6, 1, 5, 5, 7, 17, 7, 6, 1, 20, 20, 5, 5, +6, 2, 6, 5, 1, 6, 6, 7, 1, 1, 6, 7, 5, 20, 95, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, +7, 7, 6, 6, 6, -1, 6, -4, 1, 1, 1, 1, 6, 1, 1, 1, 1, 25, 5, 6, 28, 99, -2, 6, 6, +5, 6, 5, 6, 1, 7, 6, 6, 6, 12, 4, 12, 1, 18, 83, 62, 1, 43, 46, 11, 46, 11, 45, 6, 6, +37, 38, 37, 38, 46, 1, 46, 12, 39, 12, 39, 1, 57, 1, 37, 1, 1, 46, 55, 46, 55, 18, 36, 46, 1, +46, 1, 1, 43, -102, -2, -102, 1, 46, 55, 46, 55, 28, 99, 28, 99, 1, 18, 48, 11, 45, 38, 18, 30, 30, +20, 1, 38, 50, 1, 1, 1, 1, 1, 1, 1, 25, 1, 1, 25, 1, 25, 25, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 25, 25, 1, 50, 50, 50, 50, 25, 25, 25, +1, 1, 43, 1, 1, 1, 1, 1, 49, 1, 1, 18, 1, 25, 1, 25, 49, 18, 25, 1, 1, 25, 1, 37, 38, +46, 11, 46, 11, 12, 39, 12, 39, 12, 39, 18, 83, 18, 83, 18, 1, 46, 55, 46, 55, 62, -1, 62, -1, 62, +-1, 62, 57, 28, -27, 1, 93, 24, 1, 57, 46, 55, 1, 1, 18, 36, 18, 36, 46, 1, 1, 43, 28, 18, 46, +55, 46, 55, 46, 55, 46, 55, -123, -92, -107, -60, 57, 37, 38, 1, 1, 12, 41, -1, -123, -92, -123, -92, -123, -92, +-107, -60, 1, 1, 1, 12, 12, 12, 12, 12, 1, 1, 1, 1, 37, 1, 22, 18, 1, -126, 20, -35, 37, 1, 13, +12, 28, 46, 62, 1, 16, 117, 46, 31, 18, 46, 28, 1, -102, -107, 77, 39, 15, 62, -107, 11, 38, 41, -35, 41, +1, 30, 18, 41, 36, -35, 24, 21, 24, -58, 49, 36, 36, 36, 41, 21, 40, 42, -35, 41, 36, 41, 42, 12, 1, +37, 12, 1, 62, 62, 28, 1, 49, 55, 12, 49, 27, 37, 36, 1, 37, 12, 12, 24, 25, 12, 12, 12, 18, 117, +46, 18, 28, 28, 46, -102, 49, 49, 77, 26, 28, 43, 20, 37, 49, 20, 1, 49, 46, 38, 49, 36, 38, 1, 39, +40, 11, 55, 55, 13, 55, 22, 55, 36, 55, 53, 11, 20, -60, 49, -43, 49, 1, 44, 49, 36, 1, 42, 49, 1, +37, 39, 55, 38, 49, 43, 57, -1, -33, 36, 36, 55, 13, -60, 55, 1, 1, 1, 49, 12, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -77, 1, 1, 1, 1, 1, 12, 1, 1, -9, 18, 1, 12, -9, 1, +1, 28, 1, 1, -9, 12, 12, 1, 16, 44, 12, 12, 31, 1, 19, 22, -62, -62, -62, 1, 1, -54, -9, 1, 1, +28, 28, 15, 19, 19, 19, 19, 1, 1, 1, 1, 12, 1, 1, 1, 11, 12, 1, 1, 1, 28, 1, 12, 12, 16, +44, 12, 31, 1, 19, 22, -9, 1, 1, 44, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 20, 1, 1, 32, +1, 27, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 44, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 9, 1, 1, 35, 9, 1, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 43, 27, 27, 27, 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, +44, 1, 1, 1, 1, 44, 44, 1, 1, 1, 1, 44, 44, 1, 1, 44, 44, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 41, 41, 41, 41, 1, 1, 1, 1, 43, 43, 17, 17, 43, 43, 17, 17, 1, 1, 1, 1, 1, +1, 1, 1, 50, 50, 50, 50, 50, 50, 50, 50, 35, 1, 1, 1, 35, 1, 1, 1, 1, 1, 29, 1, 50, 50, +29, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 44, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 44, 44, 35, 1, 35, 1, 35, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 4, 27, 1, 1, 32, +20, 1, 1, 1, 27, 27, 27, 27, 27, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 25, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 57, 37, 38, 37, 38, 37, 38, 37, 38, 37, 38, 37, 38, 37, 38, 37, 38, 37, 38, 37, 38, +37, 38, 37, 38, 12, 39, 12, 39, 12, 39, 12, 39, 12, 39, 12, 39, 12, 39, 12, 39, 62, 7, 62, 57, 18, +36, 18, 36, 18, 36, 18, 36, 18, 36, 18, 36, 18, 36, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 28, 55, +28, 55, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, -106, -60, -106, -60, -106, -60, 37, 38, 62, 57, 18, 36, 28, +55, 28, 55, 28, 55, 28, 55, 28, 55, 0, 0, 0, 0, 37, 38, 1, 1, 7, 1, 7, 1, 46, 20, 1, 1, +1, 1, 1, 1, 1, 1, 1, 55, 1, 1, 1, 1, 1, 44, 29, 1, 50, 44, 44, 44, 44, 44, 44, 40, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 44, +1, 1, 44, 44, 1, 1, 44, 44, 1, 1, 44, 44, 1, 1, 44, 44, 1, 1, 44, 44, 1, 1, 44, 44, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 43, 43, 17, 17, 43, 43, 17, 17, 43, 43, 17, 17, 1, 1, 1, 1, 1, 1, +1, 1, 50, 50, 35, 1, 1, 1, 1, 1, 1, 29, 1, 1, 1, 29, 1, 1, 1, 29, 1, 1, 1, 29, 1, +1, 1, 29, 1, 50, 50, 50, 50, 9, 1, 1, 35, 9, 1, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 9, 1, 1, 35, 9, 1, 1, 35, 9, 1, 1, 35, 9, 1, 1, 35, 9, 1, 1, 35, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 44, 1, 1, 1, 1, 1, 1, 44, +44, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 44, 44, 1, 1, 1, 1, 44, 44, 1, 1, 9, 9, 9, 9, 1, 1, 1, 1, +1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 50, 1, 1, 1, 1, 1, 1, 1, 43, 43, 17, 17, 1, +1, 1, 1, 35, 1, 1, 1, 1, 1, 1, 44, 40, 44, 44, 44, 44, 44, 9, 1, -9, 1, 20, -62, 35, 1, +35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 1, 1, 35, 1, 0, 0, 0, 0, 0, 3, 0, 3, 1, +1, 1, 1, 1, 5, 3, 3, 1, 2, 1, 1, 0, 24, 5, -20, 11, -64, 0, -8, 8, -1, 0, 8, 0, 8, +-1, -2, 0, 9, 0, 9, -1, -3, 0, 10, 0, 10, -1, -3, 0, 11, 0, 11, -1, -3, 0, 12, 0, 12, -1, +-3, 0, 13, 0, 13, -1, -3, 0, 14, 0, 13, -1, -3, 0, 15, 0, 14, -1, -3, 0, 16, 0, 15, -1, -3, +0, 17, 0, 15, -1, -4, 0, 18, 0, 17, -1, -4, 0, 19, 0, 18, -1, -4, 0, 20, 0, 19, -1, -4, 0, +21, 0, 19, -1, -5, 0, 22, 0, 20, -1, -5, 0, 23, 0, 21, -1, -5, 0, 24, 0, 21, -1, -6, 0, 25, +0, 23, -1, -5, 0, 26, 0, 25, -1, -6, 0, 27, 0, 26, -1, -6, 0, 28, 0, 26, -1, -6, 0, 29, 0, +27, -1, -6, 0, 30, 0, 28, -1, -7, 0, 31, 0, 28, -1, -7, 0, 32, 0, 29, -1, -7, 0, 33, 0, 31, +-1, -7, 0, 34, 0, 32, -1, -7, 0, 35, 0, 32, -1, -8, 0, 36, 0, 33, -1, -8, 0, 37, 0, 34, -1, +-8, 0, 38, 0, 34, -1, -9, 0, 39, 0, 35, -1, -9, 0, 40, 0, 36, -1, -9, 0, 41, 0, 38, -1, -9, +0, 42, 0, 38, -1, -9, 0, 43, 0, 39, -1, -10, 0, 44, 0, 40, -1, -10, 0, 45, 0, 40, -1, -10, 0, +46, 0, 42, -1, -10, 0, 47, 0, 43, -1, -10, 0, 48, 0, 45, -1, -10, 0, 49, 0, 45, -1, -11, 0, 50, +0, 46, -1, -11, 0, 51, 0, 47, -1, -11, 0, 52, 0, 48, -1, -12, 0, 53, 0, 48, -1, -12, 0, 54, 0, +49, -1, -12, 0, 55, 0, 51, -1, -12, 0, 56, 0, 52, -1, -13, 0, 57, 0, 52, -1, -13, 0, 58, 0, 53, +-1, -13, 0, 59, 0, 53, -1, -13, 0, 60, 0, 54, -1, -13, 0, 61, 0, 55, -1, -13, 0, 62, 0, 56, -1, +-13, 0, 63, 0, 57, -1, -14, 0, 64, 0, 58, -1, -14, 0, 65, 0, 59, -1, -14, 0, 66, 0, 60, -1, -14, +0, 67, 0, 60, -1, -15, 0, 68, 0, 61, -1, -15, 0, 69, 0, 62, -1, -15, 0, 70, 0, 63, -1, -16, 0, +71, 0, 64, -1, -16, 0, 72, 0, 65, -1, -16, 0, 73, 0, 66, -1, -16, 0, 74, 0, 66, -1, -16, 0, 75, +0, 67, -1, -16, 0, 76, 0, 68, -1, -16, 0, 77, 0, 70, -1, -17, 0, 78, 0, 70, -1, -17, 0, 79, 0, +71, -1, -17, 0, 80, 0, 72, -1, -17, 0, 81, 0, 73, -1, -18, 0, 82, 0, 73, -1, -18, 0, 83, 0, 74, +-1, -18, 0, 84, 0, 75, -1, -19, 0, 85, 0, 77, -1, -19, 0, 86, 0, 77, -1, -19, 0, 87, 0, 78, -1, +-19, 0, 88, 0, 79, -1, -20, 0, 89, 0, 80, -1, -20, 0, 90, 0, 80, -1, -19, 0, 91, 0, 81, -1, -20, +0, 92, 0, 83, -1, -20, 0, 93, 0, 84, -1, -20, 0, 94, 0, 84, -1, -20, 0, 95, 0, 85, -1, -21, 0, +96, 0, 86, -1, -21, 0, 97, 0, 87, -1, -21, 0, 98, 0, 87, -1, -22, 0, 99, 0, 89, -1, -22, 0, 100, +0, 90, -1, -22, 0, 101, 0, 91, -1, -22, 0, 102, 0, 92, -1, -23, 0, 103, 0, 92, -1, -23, 0, 104, 0, +93, -1, -23, 0, 105, 0, 94, -1, -24, 0, 106, 0, 96, -1, -23, 0, 107, 0, 96, -1, -23, 0, 108, 0, 97, +-1, -23, 0, 109, 0, 98, -1, -24, 0, 110, 0, 99, -1, -24, 0, 111, 0, 99, -1, -24, 0, 112, 0, 100, -1, +-25, 0, 113, 0, 101, -1, -25, 0, 114, 0, 103, -1, -25, 0, 115, 0, 103, -1, -25, 0, 116, 0, 104, -1, -26, +0, 117, 0, 105, -1, -26, 0, 118, 0, 106, -1, -26, 0, 119, 0, 106, -1, -27, 0, 120, 0, 107, -1, -27, 0, +121, 0, 109, -1, -27, 0, 122, 0, 110, -1, -27, 0, 123, 0, 110, -1, -27, 0, 124, 0, 111, -1, -27, 0, 125, +0, 112, -1, -27, 0, 126, 0, 113, -1, -28, 0, 127, 0, 113, -1, -28, 0, -128, 0, 115, -1, -28, 0, -127, 0, +116, -1, -28, 0, -126, 0, 117, -1, -29, 0, -125, 0, 118, -1, -29, 0, -124, 0, 118, -1, -29, 0, -123, 0, 119, +-1, -30, 0, -122, 0, 120, -1, -30, 0, -121, 0, 121, -1, -30, 0, -120, 0, 122, -1, -30, 0, -119, 0, 123, -1, +-31, 0, -118, 0, 124, -1, -31, 0, -117, 0, 125, -1, -30, 0, -116, 0, 125, -1, -31, 0, -115, 0, 126, -1, -31, +0, -114, 0, 127, -1, -31, 0, -113, 0, -127, -1, -31, 0, -112, 0, -127, -1, -32, 0, -111, 0, -126, -1, -32, 0, +-110, 0, -125, -1, -32, 0, -109, 0, -124, -1, -33, 0, -108, 0, -124, -1, -33, 0, -107, 0, -123, -1, -33, 0, -106, +0, -121, -1, -33, 0, -105, 0, -120, -1, -32, 0, -104, 0, -120, -1, -33, 0, -103, 0, -119, -1, -33, 0, -102, 0, +-118, -1, -34, 0, -101, 0, -117, -1, -34, 0, -100, 0, -116, -1, -34, 0, -99, 0, -116, -1, -34, 0, -98, 0, -114, +-1, -34, 0, -97, 0, -113, -1, -34, 0, -96, 0, -112, -1, -34, 0, -95, 0, -112, -1, -35, 0, -94, 0, -111, -1, +-35, 0, -93, 0, -110, -1, -35, 0, -92, 0, -109, -1, -35, 0, -91, 0, -108, -1, -36, 0, -90, 0, -107, -1, -37, +0, -89, 0, -106, -1, -37, 0, -88, 0, -105, -1, -37, 0, -87, 0, -105, -1, -37, 0, -86, 0, -104, -1, -37, 0, +-85, 0, -103, -1, -37, 0, -84, 0, -101, -1, -37, 0, -83, 0, -101, -1, -37, 0, -82, 0, -100, -1, -37, 0, -81, +0, -99, -1, -37, 0, -80, 0, -98, -1, -37, 0, -79, 0, -98, -1, -38, 0, -78, 0, -97, -1, -38, 0, -77, 0, +-96, -1, -38, 0, -76, 0, -94, -1, -39, 0, -75, 0, -93, -1, -40, 0, -74, 0, -93, -1, -40, 0, -73, 0, -92, +-1, -40, 0, -72, 0, -91, -1, -40, 0, -71, 0, -90, -1, -40, 0, -70, 0, -90, -1, -40, 0, -69, 0, -88, -1, +-40, 0, -68, 0, -87, -1, -41, 0, -67, 0, -86, -1, -41, 0, -66, 0, -86, -1, -41, 0, -65, 0, -85, -1, -41, +0, -64, 0, -84, -1, -41, 0, -63, 0, -83, -1, -41, 0, -62, 0, -82, -1, -41, 0, -61, 0, -81, -1, -42, 0, +-60, 0, -80, -1, -42, 0, -59, 0, -79, -1, -43, 0, -58, 0, -79, -1, -43, 0, -57, 0, -78, -1, -43, 0, -56, +0, -77, -1, -44, 0, -55, 0, -76, -1, -44, 0, -54, 0, -75, -1, -44, 0, -53, 0, -74, -1, -44, 0, -52, 0, +-73, -1, -44, 0, -51, 0, -72, -1, -44, 0, -50, 0, -71, -1, -44, 0, -49, 0, -71, -1, -44, 0, -48, 0, -70, +-1, -44, 0, -47, 0, -68, -1, -44, 0, -46, 0, -67, -1, -45, 0, -45, 0, -67, -1, -46, 0, -44, 0, -66, -1, +-46, 0, -43, 0, -65, -1, -46, 0, -42, 0, -64, -1, -47, 0, -41, 0, -64, -1, -47, 0, -40, 0, -62, -1, -47, +0, -39, 0, -61, -1, -47, 0, -38, 0, -60, -1, -47, 0, -37, 0, -60, -1, -47, 0, -36, 0, -59, -1, -47, 0, +-35, 0, -58, -1, -47, 0, -34, 0, -57, -1, -48, 0, -33, 0, -57, -1, -48, 0, -32, 0, -55, -1, -49, 0, -31, +0, -54, -1, -49, 0, -30, 0, -53, -1, -49, 0, -29, 0, -53, -1, -49, 0, -28, 0, -52, -1, -49, 0, -27, 0, +-51, -1, -49, 0, -26, 0, -50, -1, -49, 0, -25, 0, -48, -1, -50, 0, -24, 0, -48, -1, -50, 0, -23, 0, -47, +-1, -50, 0, -22, 0, -46, -1, -51, 0, -21, 0, -45, -1, -51, 0, -20, 0, -45, -1, -51, 0, -19, 0, -44, -1, +-51, 0, -18, 0, -42, -1, -52, 0, -17, 0, -41, -1, -52, 0, -16, 0, -41, -1, -52, 0, -15, 0, -40, -1, -52, +0, -14, 0, -39, -1, -52, 0, -13, 0, -38, -1, -52, 0, -12, 0, -38, -1, -52, 0, -11, 0, -36, -1, -53, 0, +-10, 0, -35, -1, -53, 0, -9, 0, -34, -1, -53, 0, -8, 0, -34, -1, -54, 0, -7, 0, -33, -1, -54, 0, -6, +0, -32, -1, -54, 0, -5, 0, -31, -1, -54, 0, -4, 0, -31, -1, -54, 0, -3, 0, -29, -1, -55, 0, -2, 0, +-28, -1, -55, 0, -1, 0, -27, -1, -55, 0, -8, 8, -1, 0, 8, 0, 8, -1, -2, 0, 9, 0, 9, -1, -3, +0, 10, 0, 10, -1, -3, 0, 11, 0, 11, -1, -3, 0, 12, 0, 12, -1, -3, 0, 13, 0, 13, -1, -3, 0, +14, 0, 13, -1, -3, 0, 15, 0, 14, -1, -3, 0, 16, 0, 15, -1, -3, 0, 17, 0, 15, -1, -4, 0, 18, +0, 17, -1, -4, 0, 19, 0, 18, -1, -4, 0, 20, 0, 19, -1, -4, 0, 21, 0, 19, -1, -5, 0, 22, 0, +20, -1, -5, 0, 23, 0, 21, -1, -5, 0, 24, 0, 21, -1, -6, 0, 25, 0, 23, -1, -5, 0, 26, 0, 25, +-1, -6, 0, 27, 0, 26, -1, -6, 0, 28, 0, 26, -1, -6, 0, 29, 0, 27, -1, -6, 0, 30, 0, 28, -1, +-7, 0, 31, 0, 28, -1, -7, 0, 32, 0, 29, -1, -7, 0, 33, 0, 31, -1, -7, 0, 34, 0, 32, -1, -7, +0, 35, 0, 32, -1, -8, 0, 36, 0, 33, -1, -8, 0, 37, 0, 34, -1, -8, 0, 38, 0, 34, -1, -9, 0, +39, 0, 35, -1, -9, 0, 40, 0, 36, -1, -9, 0, 41, 0, 38, -1, -9, 0, 42, 0, 38, -1, -9, 0, 43, +0, 39, -1, -10, 0, 44, 0, 40, -1, -10, 0, 45, 0, 40, -1, -10, 0, 46, 0, 42, -1, -10, 0, 47, 0, +43, -1, -10, 0, 48, 0, 45, -1, -10, 0, 49, 0, 45, -1, -11, 0, 50, 0, 46, -1, -11, 0, 51, 0, 47, +-1, -11, 0, 52, 0, 48, -1, -12, 0, 53, 0, 48, -1, -12, 0, 54, 0, 49, -1, -12, 0, 55, 0, 51, -1, +-12, 0, 56, 0, 52, -1, -13, 0, 57, 0, 52, -1, -13, 0, 58, 0, 53, -1, -13, 0, 59, 0, 53, -1, -13, +0, 60, 0, 54, -1, -13, 0, 61, 0, 55, -1, -13, 0, 62, 0, 56, -1, -13, 0, 63, 0, 57, -1, -14, 0, +64, 0, 58, -1, -14, 0, 65, 0, 59, -1, -14, 0, 66, 0, 60, -1, -15, 0, 67, 0, 60, -1, -15, 0, 68, +0, 61, -1, -15, 0, 69, 0, 62, -1, -15, 0, 70, 0, 63, -1, -16, 0, 71, 0, 64, -1, -16, 0, 72, 0, +65, -1, -16, 0, 73, 0, 66, -1, -16, 0, 74, 0, 66, -1, -16, 0, 75, 0, 67, -1, -16, 0, 76, 0, 68, +-1, -16, 0, 77, 0, 70, -1, -17, 0, 78, 0, 70, -1, -17, 0, 79, 0, 71, -1, -17, 0, 80, 0, 72, -1, +-17, 0, 81, 0, 73, -1, -18, 0, 82, 0, 73, -1, -18, 0, 83, 0, 74, -1, -18, 0, 84, 0, 75, -1, -19, +0, 85, 0, 77, -1, -19, 0, 86, 0, 77, -1, -19, 0, 87, 0, 78, -1, -19, 0, 88, 0, 79, -1, -20, 0, +89, 0, 80, -1, -20, 0, 90, 0, 80, -1, -19, 0, 91, 0, 81, -1, -20, 0, 92, 0, 83, -1, -20, 0, 93, +0, 84, -1, -20, 0, 94, 0, 84, -1, -20, 0, 95, 0, 85, -1, -21, 0, 96, 0, 86, -1, -21, 0, 97, 0, +87, -1, -21, 0, 98, 0, 87, -1, -21, 0, 99, 0, 89, -1, -22, 0, 100, 0, 90, -1, -22, 0, 101, 0, 91, +-1, -22, 0, 102, 0, 92, -1, -23, 0, 103, 0, 92, -1, -23, 0, 104, 0, 93, -1, -23, 0, 105, 0, 94, -1, +-23, 0, 106, 0, 96, -1, -23, 0, 107, 0, 96, -1, -23, 0, 108, 0, 97, -1, -23, 0, 109, 0, 98, -1, -23, +0, 110, 0, 99, -1, -24, 0, 111, 0, 99, -1, -24, 0, 112, 0, 100, -1, -24, 0, 113, 0, 101, -1, -25, 0, +114, 0, 103, -1, -25, 0, 115, 0, 103, -1, -25, 0, 116, 0, 104, -1, -25, 0, 117, 0, 105, -1, -26, 0, 118, +0, 106, -1, -26, 0, 119, 0, 106, -1, -26, 0, 120, 0, 107, -1, -27, 0, 121, 0, 109, -1, -27, 0, 122, 0, +110, -1, -27, 0, 123, 0, 110, -1, -27, 0, 124, 0, 111, -1, -27, 0, 125, 0, 112, -1, -28, 0, 126, 0, 113, +-1, -28, 0, 127, 0, 114, -1, -28, 0, -128, 0, 115, -1, -28, 0, -127, 0, 116, -1, -29, 0, -126, 0, 117, -1, +-29, 0, -125, 0, 118, -1, -29, 0, -124, 0, 118, -1, -29, 0, -123, 0, 119, -1, -29, 0, -122, 0, 120, -1, -29, +0, -121, 0, 121, -1, -30, 0, -120, 0, 122, -1, -30, 0, -119, 0, 123, -1, -30, 0, -118, 0, 124, -1, -30, 0, +-117, 0, 125, -1, -30, 0, -116, 0, 125, -1, -30, 0, -115, 0, 126, -1, -30, 0, -114, 0, 127, -1, -30, 0, -113, +0, -127, -1, -31, 0, -112, 0, -127, -1, -31, 0, -111, 0, -126, -1, -32, 0, -110, 0, -125, -1, -32, 0, -109, 0, +-124, -1, -32, 0, -108, 0, -124, -1, -32, 0, -107, 0, -123, -1, -32, 0, -106, 0, -121, -1, -33, 0, -105, 0, -120, +-1, -32, 0, -104, 0, -120, -1, -33, 0, -103, 0, -119, -1, -33, 0, -102, 0, -118, -1, -34, 0, -101, 0, -117, -1, +-34, 0, -100, 0, -116, -1, -34, 0, -99, 0, -116, -1, -34, 0, -98, 0, -114, -1, -34, 0, -97, 0, -113, -1, -34, +0, -96, 0, -112, -1, -34, 0, -95, 0, -112, -1, -35, 0, -94, 0, -111, -1, -35, 0, -93, 0, -110, -1, -35, 0, +-92, 0, -109, -1, -35, 0, -91, 0, -108, -1, -36, 0, -90, 0, -107, -1, -37, 0, -89, 0, -106, -1, -37, 0, -88, +0, -105, -1, -37, 0, -87, 0, -105, -1, -37, 0, -86, 0, -104, -1, -37, 0, -85, 0, -103, -1, -37, 0, -84, 0, +-101, -1, -37, 0, -83, 0, -101, -1, -37, 0, -82, 0, -100, -1, -37, 0, -81, 0, -99, -1, -37, 0, -80, 0, -98, +-1, -37, 0, -79, 0, -98, -1, -38, 0, -78, 0, -97, -1, -38, 0, -77, 0, -96, -1, -39, 0, -76, 0, -94, -1, +-39, 0, -75, 0, -93, -1, -40, 0, -74, 0, -93, -1, -40, 0, -73, 0, -92, -1, -40, 0, -72, 0, -91, -1, -40, +0, -71, 0, -90, -1, -40, 0, -70, 0, -90, -1, -40, 0, -69, 0, -88, -1, -40, 0, -68, 0, -87, -1, -41, 0, +-67, 0, -86, -1, -41, 0, -66, 0, -86, -1, -41, 0, -65, 0, -85, -1, -41, 0, -64, 0, -84, -1, -41, 0, -63, +0, -83, -1, -41, 0, -62, 0, -82, -1, -41, 0, -61, 0, -81, -1, -42, 0, -60, 0, -80, -1, -42, 0, -59, 0, +-79, -1, -43, 0, -58, 0, -79, -1, -43, 0, -57, 0, -78, -1, -44, 0, -56, 0, -77, -1, -44, 0, -55, 0, -76, +-1, -44, 0, -54, 0, -75, -1, -44, 0, -53, 0, -74, -1, -44, 0, -52, 0, -73, -1, -44, 0, -51, 0, -72, -1, +-44, 0, -50, 0, -71, -1, -44, 0, -49, 0, -71, -1, -44, 0, -48, 0, -70, -1, -44, 0, -47, 0, -68, -1, -44, +0, -46, 0, -67, -1, -45, 0, -45, 0, -67, -1, -46, 0, -44, 0, -66, -1, -46, 0, -43, 0, -65, -1, -46, 0, +-42, 0, -64, -1, -47, 0, -41, 0, -64, -1, -47, 0, -40, 0, -62, -1, -47, 0, -39, 0, -61, -1, -47, 0, -38, +0, -60, -1, -47, 0, -37, 0, -60, -1, -47, 0, -36, 0, -59, -1, -47, 0, -35, 0, -58, -1, -47, 0, -34, 0, +-57, -1, -48, 0, -33, 0, -57, -1, -48, 0, -32, 0, -55, -1, -49, 0, -31, 0, -54, -1, -49, 0, -30, 0, -53, +-1, -49, 0, -29, 0, -53, -1, -49, 0, -28, 0, -52, -1, -49, 0, -27, 0, -51, -1, -49, 0, -26, 0, -50, -1, +-49, 0, -25, 0, -48, -1, -50, 0, -24, 0, -48, -1, -50, 0, -23, 0, -47, -1, -50, 0, -22, 0, -46, -1, -51, +0, -21, 0, -45, -1, -51, 0, -20, 0, -45, -1, -51, 0, -19, 0, -44, -1, -51, 0, -18, 0, -42, -1, -52, 0, +-17, 0, -41, -1, -52, 0, -16, 0, -41, -1, -52, 0, -15, 0, -40, -1, -52, 0, -14, 0, -39, -1, -52, 0, -13, +0, -38, -1, -52, 0, -12, 0, -38, -1, -52, 0, -11, 0, -36, -1, -53, 0, -10, 0, -35, -1, -53, 0, -9, 0, +-34, -1, -53, 0, -8, 0, -34, -1, -54, 0, -7, 0, -33, -1, -54, 0, -6, 0, -32, -1, -54, 0, -5, 0, -31, +-1, -54, 0, -4, 0, -31, -1, -54, 0, -3, 0, -29, -1, -55, 0, -2, 0, -28, -1, -55, 0, -1, 0, -27, -1, +-55, 0, -8, 8, -1, 0, 8, 0, 8, -1, -2, 0, 9, 0, 9, -1, -3, 0, 10, 0, 10, -1, -3, 0, 11, +0, 11, -1, -3, 0, 12, 0, 12, -1, -3, 0, 13, 0, 13, -1, -3, 0, 14, 0, 13, -1, -3, 0, 15, 0, +14, -1, -3, 0, 16, 0, 15, -1, -3, 0, 17, 0, 15, -1, -4, 0, 18, 0, 17, -1, -4, 0, 19, 0, 18, +-1, -4, 0, 20, 0, 19, -1, -4, 0, 21, 0, 19, -1, -5, 0, 22, 0, 20, -1, -5, 0, 23, 0, 21, -1, +-5, 0, 24, 0, 21, -1, -6, 0, 25, 0, 23, -1, -5, 0, 26, 0, 25, -1, -6, 0, 27, 0, 26, -1, -6, +0, 28, 0, 26, -1, -6, 0, 29, 0, 27, -1, -6, 0, 30, 0, 28, -1, -7, 0, 31, 0, 28, -1, -7, 0, +32, 0, 29, -1, -7, 0, 33, 0, 31, -1, -7, 0, 34, 0, 32, -1, -7, 0, 35, 0, 32, -1, -8, 0, 36, +0, 33, -1, -8, 0, 37, 0, 34, -1, -8, 0, 38, 0, 34, -1, -9, 0, 39, 0, 35, -1, -9, 0, 40, 0, +36, -1, -9, 0, 41, 0, 38, -1, -9, 0, 42, 0, 38, -1, -9, 0, 43, 0, 39, -1, -10, 0, 44, 0, 40, +-1, -10, 0, 45, 0, 40, -1, -10, 0, 46, 0, 42, -1, -10, 0, 47, 0, 43, -1, -10, 0, 48, 0, 45, -1, +-10, 0, 49, 0, 45, -1, -11, 0, 50, 0, 46, -1, -11, 0, 51, 0, 47, -1, -11, 0, 52, 0, 48, -1, -12, +0, 53, 0, 48, -1, -12, 0, 54, 0, 49, -1, -12, 0, 55, 0, 51, -1, -12, 0, 56, 0, 52, -1, -13, 0, +57, 0, 52, -1, -13, 0, 58, 0, 53, -1, -13, 0, 59, 0, 53, -1, -13, 0, 60, 0, 54, -1, -13, 0, 61, +0, 55, -1, -13, 0, 62, 0, 56, -1, -13, 0, 63, 0, 57, -1, -14, 0, 64, 0, 58, -1, -14, 0, 65, 0, +59, -1, -14, 0, 66, 0, 60, -1, -14, 0, 67, 0, 60, -1, -15, 0, 68, 0, 61, -1, -15, 0, 69, 0, 62, +-1, -15, 0, 70, 0, 63, -1, -16, 0, 71, 0, 64, -1, -16, 0, 72, 0, 65, -1, -16, 0, 73, 0, 66, -1, +-16, 0, 74, 0, 66, -1, -16, 0, 75, 0, 67, -1, -16, 0, 76, 0, 68, -1, -16, 0, 77, 0, 70, -1, -17, +0, 78, 0, 70, -1, -17, 0, 79, 0, 71, -1, -17, 0, 80, 0, 72, -1, -17, 0, 81, 0, 73, -1, -18, 0, +82, 0, 73, -1, -18, 0, 83, 0, 74, -1, -18, 0, 84, 0, 75, -1, -19, 0, 85, 0, 77, -1, -19, 0, 86, +0, 77, -1, -19, 0, 87, 0, 78, -1, -19, 0, 88, 0, 79, -1, -20, 0, 89, 0, 80, -1, -20, 0, 90, 0, +80, -1, -19, 0, 91, 0, 81, -1, -20, 0, 92, 0, 83, -1, -20, 0, 93, 0, 84, -1, -20, 0, 94, 0, 84, +-1, -20, 0, 95, 0, 85, -1, -21, 0, 96, 0, 86, -1, -21, 0, 97, 0, 87, -1, -21, 0, 98, 0, 87, -1, +-21, 0, 99, 0, 89, -1, -22, 0, 100, 0, 90, -1, -22, 0, 101, 0, 91, -1, -22, 0, 102, 0, 92, -1, -23, +0, 103, 0, 92, -1, -23, 0, 104, 0, 93, -1, -23, 0, 105, 0, 94, -1, -23, 0, 106, 0, 96, -1, -23, 0, +107, 0, 96, -1, -23, 0, 108, 0, 97, -1, -23, 0, 109, 0, 98, -1, -23, 0, 110, 0, 99, -1, -24, 0, 111, +0, 99, -1, -24, 0, 112, 0, 100, -1, -24, 0, 113, 0, 101, -1, -25, 0, 114, 0, 103, -1, -25, 0, 115, 0, +103, -1, -25, 0, 116, 0, 104, -1, -25, 0, 117, 0, 105, -1, -26, 0, 118, 0, 106, -1, -26, 0, 119, 0, 106, +-1, -26, 0, 120, 0, 107, -1, -27, 0, 121, 0, 109, -1, -27, 0, 122, 0, 110, -1, -27, 0, 123, 0, 110, -1, +-27, 0, 124, 0, 111, -1, -27, 0, 125, 0, 112, -1, -28, 0, 126, 0, 113, -1, -28, 0, 127, 0, 114, -1, -28, +0, -128, 0, 115, -1, -28, 0, -127, 0, 116, -1, -28, 0, -126, 0, 117, -1, -29, 0, -125, 0, 118, -1, -29, 0, +-124, 0, 118, -1, -29, 0, -123, 0, 119, -1, -29, 0, -122, 0, 120, -1, -29, 0, -121, 0, 121, -1, -30, 0, -120, +0, 122, -1, -30, 0, -119, 0, 123, -1, -30, 0, -118, 0, 124, -1, -30, 0, -117, 0, 125, -1, -30, 0, -116, 0, +125, -1, -30, 0, -115, 0, 126, -1, -30, 0, -114, 0, 127, -1, -30, 0, -113, 0, -127, -1, -31, 0, -112, 0, -127, +-1, -31, 0, -111, 0, -126, -1, -32, 0, -110, 0, -125, -1, -32, 0, -109, 0, -124, -1, -32, 0, -108, 0, -124, -1, +-32, 0, -107, 0, -123, -1, -32, 0, -106, 0, -121, -1, -33, 0, -105, 0, -120, -1, -32, 0, -104, 0, -120, -1, -33, +0, -103, 0, -119, -1, -33, 0, -102, 0, -118, -1, -34, 0, -101, 0, -117, -1, -34, 0, -100, 0, -116, -1, -34, 0, +-99, 0, -116, -1, -34, 0, -98, 0, -114, -1, -34, 0, -97, 0, -113, -1, -34, 0, -96, 0, -112, -1, -34, 0, -95, +0, -112, -1, -35, 0, -94, 0, -111, -1, -35, 0, -93, 0, -110, -1, -35, 0, -92, 0, -109, -1, -35, 0, -91, 0, +-108, -1, -36, 0, -90, 0, -107, -1, -37, 0, -89, 0, -106, -1, -37, 0, -88, 0, -105, -1, -37, 0, -87, 0, -105, +-1, -37, 0, -86, 0, -104, -1, -37, 0, -85, 0, -103, -1, -37, 0, -84, 0, -101, -1, -37, 0, -83, 0, -101, -1, +-37, 0, -82, 0, -100, -1, -37, 0, -81, 0, -99, -1, -37, 0, -80, 0, -98, -1, -37, 0, -79, 0, -98, -1, -38, +0, -78, 0, -97, -1, -38, 0, -77, 0, -96, -1, -39, 0, -76, 0, -94, -1, -39, 0, -75, 0, -93, -1, -40, 0, +-74, 0, -93, -1, -40, 0, -73, 0, -92, -1, -40, 0, -72, 0, -91, -1, -40, 0, -71, 0, -90, -1, -40, 0, -70, +0, -90, -1, -40, 0, -69, 0, -88, -1, -40, 0, -68, 0, -87, -1, -41, 0, -67, 0, -86, -1, -41, 0, -66, 0, +-86, -1, -41, 0, -65, 0, -85, -1, -41, 0, -64, 0, -84, -1, -41, 0, -63, 0, -83, -1, -41, 0, -62, 0, -82, +-1, -41, 0, -61, 0, -81, -1, -42, 0, -60, 0, -80, -1, -42, 0, -59, 0, -79, -1, -43, 0, -58, 0, -79, -1, +-43, 0, -57, 0, -78, -1, -44, 0, -56, 0, -77, -1, -44, 0, -55, 0, -76, -1, -44, 0, -54, 0, -75, -1, -44, +0, -53, 0, -74, -1, -44, 0, -52, 0, -73, -1, -44, 0, -51, 0, -72, -1, -44, 0, -50, 0, -71, -1, -44, 0, +-49, 0, -71, -1, -44, 0, -48, 0, -70, -1, -44, 0, -47, 0, -68, -1, -44, 0, -46, 0, -67, -1, -45, 0, -45, +0, -67, -1, -46, 0, -44, 0, -66, -1, -46, 0, -43, 0, -65, -1, -46, 0, -42, 0, -64, -1, -47, 0, -41, 0, +-64, -1, -47, 0, -40, 0, -62, -1, -47, 0, -39, 0, -61, -1, -47, 0, -38, 0, -60, -1, -47, 0, -37, 0, -60, +-1, -47, 0, -36, 0, -59, -1, -47, 0, -35, 0, -58, -1, -47, 0, -34, 0, -57, -1, -48, 0, -33, 0, -56, -1, +-48, 0, -32, 0, -55, -1, -49, 0, -31, 0, -54, -1, -49, 0, -30, 0, -53, -1, -49, 0, -29, 0, -53, -1, -49, +0, -28, 0, -52, -1, -49, 0, -27, 0, -51, -1, -49, 0, -26, 0, -50, -1, -49, 0, -25, 0, -48, -1, -50, 0, +-24, 0, -48, -1, -50, 0, -23, 0, -47, -1, -50, 0, -22, 0, -46, -1, -51, 0, -21, 0, -45, -1, -51, 0, -20, +0, -45, -1, -51, 0, -19, 0, -44, -1, -51, 0, -18, 0, -42, -1, -52, 0, -17, 0, -41, -1, -52, 0, -16, 0, +-41, -1, -52, 0, -15, 0, -40, -1, -52, 0, -14, 0, -39, -1, -52, 0, -13, 0, -38, -1, -52, 0, -12, 0, -38, +-1, -52, 0, -11, 0, -36, -1, -53, 0, -10, 0, -35, -1, -53, 0, -9, 0, -34, -1, -53, 0, -8, 0, -34, -1, +-54, 0, -7, 0, -33, -1, -54, 0, -6, 0, -32, -1, -54, 0, -5, 0, -31, -1, -54, 0, -4, 0, -31, -1, -54, +0, -3, 0, -29, -1, -55, 0, -2, 0, -28, -1, -55, 0, -1, 0, -27, -1, -55, 0, 0, 0, 24, 0, 0, 6, +-116, 11, 22, 8, 0, 3, 3, 2, 4, 6, 6, 10, 7, 2, 4, 4, 4, 6, 3, 4, 3, 3, 6, 6, 6, +6, 6, 6, 6, 6, 6, 6, 3, 3, 6, 6, 6, 6, 11, 8, 7, 7, 7, 6, 6, 8, 7, 2, 5, 7, +6, 8, 7, 8, 6, 8, 7, 7, 6, 7, 8, 10, 7, 8, 7, 3, 3, 3, 5, 6, 4, 6, 6, 6, 6, +6, 4, 6, 6, 2, 2, 5, 2, 8, 6, 6, 6, 6, 4, 6, 3, 6, 6, 10, 6, 6, 6, 4, 2, 4, +6, 8, 8, 7, 6, 7, 8, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 6, 6, +6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6, 4, 6, 7, 8, 8, 11, 4, 4, 6, 11, 8, 8, +6, 6, 6, 6, 6, 6, 7, 9, 6, 3, 4, 5, 8, 10, 6, 6, 2, 6, 7, 6, 7, 6, 6, 6, 11, +8, 8, 8, 11, 10, 6, 11, 4, 4, 2, 2, 6, 5, 6, 8, 2, 6, 4, 4, 6, 6, 6, 3, 2, 4, +11, 8, 6, 8, 6, 6, 2, 2, 2, 2, 8, 8, 8, 7, 7, 7, 2, 4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 6, 2, 7, 6, 7, 6, 2, 8, 6, 8, 6, 7, 6, 6, 6, 4, 4, 4, 10, 9, 10, 6, 8, +6, 2, 7, 6, 7, 6, 7, 6, 6, 6, 4, 8, 6, 8, 6, 7, 7, 8, 6, 6, 6, 6, 6, 2, 6, +4, 6, 4, 7, 6, 7, 6, 8, 6, 7, 4, 7, 4, 7, 6, 6, 3, 6, 4, 7, 6, 7, 6, 7, 6, +7, 6, 6, 8, 8, 6, 6, 5, 7, 4, 7, 6, 6, 4, 12, 11, 6, 11, 6, 11, 6, 6, 11, 8, 6, +7, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 7, 11, 11, 11, 11, 11, 7, 7, 7, 11, 12, 10, 8, 8, 6, 7, 7, 6, 6, 8, 8, 5, 7, +2, 4, 10, 4, 7, 4, 4, 7, 4, 8, 6, 7, 6, 7, 6, 6, 6, 6, 6, 6, 6, 8, 6, 8, 6, +8, 6, 7, 6, 9, 6, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 7, 5, 6, 6, 2, 7, 6, 8, 6, +8, 6, 8, 6, 7, 4, 7, 6, 6, 4, 7, 6, 7, 6, 7, 6, 8, 6, 10, 10, 8, 6, 2, 8, 6, +11, 10, 8, 6, 3, 10, 10, 10, 10, 10, 10, 8, 6, 2, 4, 6, 6, 10, 10, 10, 10, 4, 4, 4, 4, +8, 9, 9, 5, 9, 10, 8, 2, 8, 7, 8, 6, 7, 7, 2, 7, 8, 8, 7, 7, 8, 7, 6, 7, 6, +8, 7, 8, 8, 2, 8, 6, 5, 6, 2, 6, 6, 6, 5, 6, 6, 2, 6, 6, 6, 6, 5, 6, 6, 5, +6, 5, 8, 8, 2, 6, 6, 6, 8, 6, 10, 6, 7, 7, 2, 2, 5, 12, 11, 9, 7, 7, 7, 8, 7, +7, 6, 8, 6, 12, 7, 9, 9, 7, 7, 8, 7, 8, 7, 6, 7, 6, 7, 8, 7, 7, 6, 10, 10, 8, +9, 7, 8, 11, 8, 6, 6, 7, 4, 6, 6, 8, 5, 6, 6, 5, 6, 8, 6, 6, 6, 6, 6, 6, 6, +8, 6, 6, 6, 8, 8, 7, 8, 6, 6, 8, 6, 6, 6, 4, 6, 6, 2, 2, 2, 10, 9, 6, 5, 6, +6, 5, 5, 11, 13, 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 3, +6, 6, 5, 6, 7, 3, 3, 7, 7, 3, 6, 5, 5, 7, 7, 3, 5, 7, 6, 6, 6, 6, 6, 6, 6, +9, 7, 6, 6, 6, 3, 5, 9, 3, 6, 6, 5, 5, 7, 9, 9, 9, 9, 6, 6, 6, 6, 5, 6, 7, +3, 5, 7, 3, 6, 5, 5, 7, 5, 7, 6, 6, 6, 6, 6, 9, 7, 3, 6, 5, 6, 6, 0, 0, 0, +0, 4, 4, 4, 5, 2, 2, 3, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +4, 6, 8, 8, 3, 8, 6, 6, 6, 8, 8, 8, 8, 8, 2, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, +8, 8, 8, 8, 3, 3, 8, 8, 8, 8, 6, 6, 6, 6, 5, 5, 9, 10, 4, 6, 9, 10, 4, 6, 7, +6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 2, 2, 2, 2, 8, 8, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 11, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 8, 7, 5, +2, 3, 2, 3, 5, 5, 2, 3, 7, 6, 3, 3, 2, 3, 8, 8, 3, 3, 3, 4, 8, 8, 3, 3, 8, +8, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 5, 5, 5, 5, 9, 9, +6, 6, 9, 9, 6, 6, 12, 12, 9, 9, 12, 12, 9, 9, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, +4, 6, 5, 6, 4, 9, 9, 3, 3, 6, 6, 3, 3, 7, 7, 4, 4, 6, 6, 2, 2, 4, 4, 4, 4, +6, 6, 3, 3, 3, 4, 5, 4, 5, 5, 7, 6, 7, 6, 3, 3, 6, 7, 6, 7, 6, 7, 6, 7, 8, +8, 2, 2, 8, 8, 8, 2, 2, 8, 8, 2, 3, 8, 8, 8, 2, 2, 2, 2, 2, 2, 8, 2, 2, 8, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 8, 1, 11, 22, 9, 7, 9, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 6, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 6, 8, 6, 8, 6, 8, 6, 8, +6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 9, +7, 9, 7, 9, 7, 9, 7, 9, 7, 7, 6, 7, 6, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 8, 6, +8, 6, 8, 6, 8, 6, 2, 2, 8, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 0, 0, 0, 0, 6, +4, 10, 7, 6, 5, 6, 5, 8, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 6, 8, 6, 9, 6, 8, 3, +3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 2, 2, 4, 4, 2, 2, 2, 0, 2, 3, 2, 3, 2, 3, 2, +3, 5, 5, 5, 5, 7, 6, 8, 8, 3, 3, 8, 8, 3, 3, 8, 8, 3, 3, 8, 8, 3, 3, 8, 8, +3, 3, 8, 8, 3, 3, 8, 8, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 9, 9, 6, 6, 9, 9, 6, +6, 9, 9, 6, 6, 12, 12, 9, 9, 12, 12, 9, 9, 6, 6, 6, 5, 6, 4, 9, 9, 9, 3, 3, 9, +9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 6, 6, 6, 6, 9, 10, 4, 6, 9, 10, +4, 6, 7, 7, 4, 4, 7, 7, 4, 4, 7, 7, 4, 4, 9, 10, 4, 6, 9, 10, 4, 6, 9, 10, 4, +6, 9, 10, 4, 6, 9, 10, 4, 6, 6, 6, 2, 2, 6, 6, 2, 2, 6, 6, 2, 2, 6, 6, 2, 2, +6, 6, 3, 3, 6, 6, 6, 6, 6, 6, 3, 3, 6, 6, 6, 6, 6, 6, 3, 4, 4, 4, 4, 5, 5, +5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 6, 7, 6, 3, 3, 5, 5, 7, 6, 3, +3, 7, 6, 9, 9, 9, 9, 2, 0, 0, 0, 0, 0, 0, 0, 12, 12, 0, 0, 0, 0, 0, 0, 2, 4, +0, 0, 7, 0, 0, 0, 9, 9, 6, 6, 12, 12, 9, 9, 6, 5, 6, 4, 5, 4, 3, 3, 4, 3, 3, +3, 3, 3, 9, 10, 3, 0, 4, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 6, +6, 7, 12, 24, 9, 0, 3, 3, 3, 4, 7, 7, 11, 8, 2, 4, 4, 5, 7, 3, 4, 3, 3, 7, 7, +7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 7, 7, 7, 7, 12, 7, 8, 9, 9, 8, 7, 9, 9, 3, 6, +8, 7, 9, 9, 9, 8, 9, 9, 8, 7, 9, 7, 11, 7, 7, 7, 3, 3, 3, 5, 7, 4, 7, 7, 6, +7, 7, 3, 7, 7, 3, 3, 6, 3, 11, 7, 7, 7, 7, 4, 7, 3, 7, 5, 9, 5, 5, 5, 4, 3, +4, 7, 7, 7, 9, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 3, 3, 3, 3, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 7, 7, 7, 4, 6, 8, 9, 9, 12, 4, 4, 7, 12, 9, +9, 7, 7, 7, 7, 7, 6, 9, 10, 7, 3, 4, 4, 9, 11, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, +12, 7, 7, 9, 12, 11, 7, 12, 4, 4, 3, 3, 7, 6, 5, 7, 2, 7, 4, 4, 6, 6, 7, 3, 3, +4, 11, 7, 8, 7, 8, 8, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 3, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 7, 3, 8, 7, 7, 5, 3, 9, 7, 7, 5, 8, 7, 7, 7, 4, 4, 4, 10, 10, 10, 7, +9, 7, 3, 8, 7, 9, 6, 9, 6, 7, 7, 4, 7, 7, 7, 7, 9, 7, 9, 8, 7, 8, 7, 7, 3, +7, 4, 7, 4, 9, 7, 9, 7, 9, 7, 9, 4, 9, 4, 8, 7, 7, 3, 7, 5, 9, 7, 9, 7, 7, +5, 7, 5, 7, 9, 9, 7, 7, 5, 7, 5, 8, 7, 6, 4, 13, 12, 6, 12, 6, 12, 6, 6, 12, 9, +7, 7, 7, 7, 7, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 7, 12, 12, 12, 12, 12, 7, 7, 7, 12, 13, 11, 9, 9, 6, 8, 7, 6, 6, 9, 9, 5, +7, 2, 4, 11, 4, 7, 4, 4, 7, 4, 7, 7, 9, 6, 9, 6, 8, 7, 8, 7, 8, 7, 9, 7, 9, +7, 9, 7, 9, 7, 9, 7, 3, 3, 3, 3, 3, 3, 3, 3, 6, 3, 8, 6, 7, 7, 3, 9, 7, 9, +7, 9, 7, 9, 7, 9, 4, 8, 7, 7, 3, 9, 7, 9, 7, 9, 7, 9, 7, 11, 9, 7, 5, 3, 7, +7, 12, 11, 9, 7, 3, 11, 9, 11, 9, 11, 9, 7, 5, 3, 4, 7, 7, 10, 10, 10, 10, 4, 4, 4, +4, 7, 9, 10, 4, 9, 9, 9, 3, 7, 8, 7, 8, 7, 9, 3, 8, 7, 9, 9, 8, 9, 9, 8, 7, +7, 7, 7, 9, 9, 3, 7, 7, 5, 7, 3, 7, 7, 5, 5, 7, 7, 3, 7, 5, 7, 5, 5, 7, 7, +6, 7, 6, 9, 9, 3, 7, 7, 7, 9, 8, 10, 7, 9, 8, 3, 3, 6, 13, 12, 10, 7, 8, 9, 7, +8, 8, 7, 8, 8, 11, 7, 9, 9, 7, 8, 9, 9, 9, 9, 8, 9, 7, 8, 9, 7, 9, 8, 11, 11, +10, 10, 8, 9, 12, 9, 7, 7, 6, 4, 7, 7, 9, 6, 7, 7, 6, 7, 9, 7, 7, 7, 7, 6, 5, +5, 9, 5, 7, 6, 9, 9, 8, 9, 7, 6, 9, 7, 7, 7, 4, 6, 7, 3, 3, 3, 11, 10, 7, 6, +5, 7, 6, 5, 12, 13, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 3, 4, 4, +3, 7, 7, 5, 6, 7, 3, 5, 7, 7, 3, 6, 6, 6, 7, 7, 3, 4, 7, 6, 7, 7, 6, 6, 7, +6, 8, 8, 6, 6, 6, 3, 5, 9, 3, 6, 6, 6, 6, 6, 8, 8, 8, 8, 7, 7, 7, 7, 5, 6, +7, 3, 5, 7, 3, 6, 6, 6, 7, 4, 7, 7, 7, 6, 7, 6, 8, 8, 3, 7, 6, 7, 7, 0, 0, +0, 0, 4, 4, 4, 5, 2, 2, 3, 2, 2, 3, 2, 3, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +6, 4, 6, 9, 9, 3, 9, 6, 6, 6, 9, 9, 9, 9, 9, 3, 9, 9, 9, 9, 9, 9, 9, 9, 8, +9, 9, 9, 9, 9, 3, 3, 9, 9, 9, 9, 7, 6, 6, 6, 6, 6, 10, 11, 5, 6, 10, 11, 5, 6, +8, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 3, 3, 3, 3, 9, 9, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 12, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 4, 9, 7, +5, 2, 3, 2, 3, 5, 5, 2, 3, 8, 7, 3, 3, 2, 3, 9, 9, 3, 3, 3, 5, 9, 9, 3, 3, +9, 9, 3, 3, 7, 6, 6, 6, 7, 6, 6, 6, 7, 6, 6, 6, 4, 4, 4, 4, 6, 6, 6, 6, 10, +10, 6, 6, 10, 10, 6, 6, 13, 13, 10, 10, 13, 13, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, +6, 5, 7, 5, 6, 5, 9, 9, 3, 3, 7, 7, 3, 3, 7, 7, 5, 5, 6, 6, 2, 2, 4, 4, 5, +5, 6, 6, 3, 3, 3, 5, 5, 5, 5, 5, 8, 7, 8, 7, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, +9, 9, 2, 2, 9, 9, 9, 2, 3, 9, 9, 3, 3, 9, 9, 9, 3, 3, 3, 3, 3, 3, 9, 2, 2, +9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 9, 2, 12, 24, 10, 8, 10, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 6, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 7, 7, 7, 7, 7, 7, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, +7, 8, 7, 8, 7, 8, 7, 3, 3, 3, 3, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, +10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 9, 7, 9, 7, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 7, +5, 7, 5, 7, 5, 7, 7, 3, 3, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 0, 0, 0, 0, +7, 4, 11, 8, 7, 5, 7, 5, 9, 7, 7, 6, 7, 6, 8, 6, 8, 6, 8, 7, 9, 7, 9, 7, 9, +3, 3, 3, 7, 3, 3, 3, 3, 3, 3, 3, 2, 2, 4, 4, 2, 2, 2, 0, 2, 3, 2, 3, 2, 3, +2, 3, 5, 5, 5, 5, 8, 7, 9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 9, +9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 7, 6, 6, 6, 7, 6, 6, 6, 7, 6, 6, 6, 7, 6, +6, 6, 7, 6, 6, 6, 7, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 6, 6, 10, 10, +6, 6, 10, 10, 6, 6, 13, 13, 10, 10, 13, 13, 10, 10, 7, 7, 7, 5, 6, 5, 9, 9, 9, 3, 3, +9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 7, 7, 7, 7, 10, 11, 5, 6, 10, +11, 5, 6, 7, 7, 5, 5, 7, 7, 5, 5, 7, 7, 5, 5, 10, 11, 5, 6, 10, 11, 5, 6, 10, 11, +5, 6, 10, 11, 5, 6, 10, 11, 5, 6, 6, 6, 2, 2, 6, 6, 2, 2, 6, 6, 2, 2, 6, 6, 2, +2, 6, 6, 3, 3, 6, 6, 6, 6, 6, 6, 3, 3, 6, 6, 7, 6, 6, 6, 3, 5, 5, 5, 5, 5, +5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 7, 8, 7, 3, 3, 5, 5, 8, 7, +3, 3, 8, 7, 10, 10, 10, 10, 2, 0, 0, 0, 0, 0, 0, 0, 13, 13, 0, 0, 0, 0, 0, 0, 2, +4, 0, 0, 7, 0, 0, 0, 10, 10, 6, 6, 13, 13, 10, 10, 7, 5, 6, 5, 5, 4, 3, 3, 4, 3, +3, 3, 3, 3, 10, 11, 3, 0, 4, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, +6, 7, 7, 13, 26, 10, 0, 4, 4, 3, 5, 7, 7, 12, 9, 2, 4, 4, 5, 8, 4, 4, 4, 4, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 7, 13, 9, 9, 9, 9, 9, 8, 10, 9, 3, +6, 9, 7, 11, 9, 10, 9, 10, 9, 9, 7, 9, 9, 13, 7, 9, 7, 4, 4, 4, 5, 7, 4, 7, 7, +7, 7, 7, 3, 7, 7, 3, 3, 7, 3, 11, 7, 7, 7, 7, 4, 7, 4, 7, 5, 9, 7, 7, 7, 4, +3, 4, 8, 9, 9, 9, 9, 9, 10, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 7, 7, 7, 5, 7, 9, 10, 10, 13, 4, 4, 7, 13, +10, 9, 7, 7, 7, 7, 7, 6, 9, 11, 7, 3, 4, 5, 10, 12, 7, 8, 3, 8, 8, 7, 7, 8, 7, +7, 13, 9, 9, 10, 13, 12, 7, 13, 4, 4, 3, 3, 7, 6, 7, 9, 2, 7, 4, 4, 7, 7, 7, 4, +3, 4, 14, 9, 9, 9, 9, 9, 3, 3, 3, 3, 10, 10, 10, 9, 9, 9, 3, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 7, 3, 9, 7, 7, 7, 3, 9, 7, 9, 7, 9, 7, 8, 8, 4, 4, 4, 11, 11, 11, +7, 10, 7, 3, 9, 7, 9, 7, 9, 7, 7, 7, 4, 9, 7, 9, 7, 9, 8, 9, 9, 7, 9, 7, 7, +3, 7, 4, 7, 4, 9, 7, 9, 7, 10, 7, 9, 4, 9, 4, 9, 7, 7, 3, 7, 5, 9, 7, 9, 7, +7, 7, 7, 7, 7, 10, 9, 8, 7, 6, 8, 5, 8, 7, 7, 5, 15, 13, 7, 13, 7, 13, 7, 7, 13, +9, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 8, 13, 13, 13, 13, 13, 8, 8, 8, 13, 14, 12, 10, 10, 7, 9, 8, 7, 7, 10, 10, +6, 8, 2, 5, 12, 5, 8, 5, 5, 8, 5, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 10, 7, +10, 7, 10, 7, 9, 7, 9, 7, 3, 3, 3, 3, 3, 3, 3, 3, 6, 3, 9, 7, 7, 7, 3, 9, 7, +9, 7, 10, 7, 10, 7, 9, 4, 9, 7, 8, 4, 9, 7, 9, 7, 9, 7, 9, 7, 13, 9, 9, 7, 3, +9, 7, 13, 12, 10, 7, 3, 13, 9, 13, 9, 13, 9, 9, 7, 3, 4, 7, 8, 11, 11, 11, 11, 4, 4, +4, 4, 9, 10, 11, 5, 10, 11, 10, 3, 9, 9, 9, 9, 7, 9, 3, 9, 9, 11, 9, 8, 10, 9, 9, +8, 7, 9, 7, 9, 10, 3, 9, 8, 6, 7, 3, 7, 7, 7, 6, 7, 7, 3, 7, 7, 7, 5, 6, 7, +7, 6, 7, 7, 9, 9, 3, 7, 7, 7, 9, 9, 11, 7, 9, 9, 3, 3, 6, 14, 13, 11, 8, 8, 9, +9, 9, 9, 7, 9, 9, 11, 8, 9, 9, 8, 9, 11, 9, 10, 9, 9, 9, 7, 8, 11, 7, 10, 9, 11, +11, 10, 11, 8, 9, 13, 9, 7, 7, 7, 5, 8, 7, 9, 6, 7, 7, 6, 7, 9, 7, 7, 7, 7, 7, +5, 7, 9, 7, 7, 7, 11, 12, 8, 9, 7, 7, 10, 7, 7, 7, 5, 7, 7, 3, 3, 3, 12, 11, 7, +6, 7, 7, 6, 5, 13, 14, 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 3, 4, +4, 4, 7, 7, 5, 7, 8, 3, 5, 8, 8, 3, 7, 6, 6, 8, 8, 3, 5, 7, 7, 7, 7, 6, 6, +7, 7, 9, 8, 6, 6, 6, 3, 5, 9, 3, 7, 7, 6, 6, 7, 9, 9, 9, 9, 7, 7, 7, 7, 5, +7, 8, 4, 5, 8, 4, 7, 6, 6, 8, 5, 7, 7, 7, 6, 7, 7, 9, 8, 3, 7, 6, 7, 7, 0, +0, 0, 0, 4, 4, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, +7, 7, 4, 7, 10, 10, 4, 10, 7, 7, 7, 10, 10, 10, 10, 10, 3, 10, 10, 10, 10, 10, 10, 10, 10, +8, 10, 10, 10, 9, 9, 3, 3, 10, 10, 10, 10, 7, 7, 7, 7, 6, 6, 11, 12, 5, 7, 11, 12, 5, +7, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 10, +10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 13, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 10, +8, 5, 3, 3, 3, 3, 6, 6, 3, 3, 8, 8, 3, 3, 3, 3, 9, 9, 3, 3, 4, 5, 9, 9, 3, +3, 9, 9, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 4, 4, 6, 6, 6, 6, +11, 11, 7, 7, 11, 11, 7, 7, 14, 14, 11, 11, 14, 14, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 7, +6, 7, 5, 7, 6, 7, 5, 10, 10, 3, 3, 8, 8, 3, 3, 8, 8, 5, 5, 7, 7, 3, 3, 4, 4, +5, 5, 7, 7, 3, 3, 4, 5, 6, 5, 6, 6, 8, 8, 8, 8, 3, 3, 7, 8, 7, 8, 7, 8, 7, +8, 10, 10, 3, 3, 10, 10, 10, 2, 3, 10, 10, 3, 3, 10, 10, 10, 3, 3, 3, 3, 3, 3, 10, 3, +3, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 4, 4, 4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 2, 13, 26, 11, 9, 11, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 7, 11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 9, 7, 9, 7, 9, 7, 9, +7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, +9, 7, 9, 7, 9, 7, 9, 7, 3, 3, 3, 3, 10, 7, 10, 7, 10, 7, 10, 7, 10, 7, 10, 7, 10, +7, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 9, 7, 9, 7, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, +9, 7, 9, 7, 9, 7, 9, 7, 3, 3, 10, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 0, 0, 0, +0, 7, 5, 12, 9, 8, 6, 8, 6, 9, 7, 7, 7, 7, 7, 9, 7, 9, 7, 9, 7, 10, 7, 10, 7, +9, 3, 3, 3, 8, 3, 3, 3, 3, 3, 3, 4, 3, 3, 4, 4, 3, 3, 3, 0, 3, 3, 3, 3, 3, +3, 3, 3, 6, 6, 6, 6, 8, 8, 9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, +9, 9, 3, 3, 9, 9, 3, 3, 9, 9, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 11, 7, 7, 11, +11, 7, 7, 11, 11, 7, 7, 14, 14, 11, 11, 14, 14, 11, 11, 8, 8, 7, 6, 7, 5, 10, 10, 10, 3, +3, 10, 10, 3, 3, 10, 10, 3, 3, 10, 10, 3, 3, 10, 10, 3, 3, 8, 8, 8, 8, 11, 12, 5, 7, +11, 12, 5, 7, 8, 8, 5, 5, 8, 8, 5, 5, 8, 8, 5, 5, 11, 12, 5, 7, 11, 12, 5, 7, 11, +12, 5, 7, 11, 12, 5, 7, 11, 12, 5, 7, 7, 7, 3, 3, 7, 7, 3, 3, 7, 7, 3, 3, 7, 7, +3, 3, 7, 7, 3, 3, 7, 7, 7, 7, 7, 7, 3, 3, 7, 7, 7, 7, 7, 7, 4, 5, 5, 5, 5, +6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 3, 3, 6, 6, 8, +8, 3, 3, 8, 8, 11, 11, 11, 11, 3, 0, 0, 0, 0, 0, 0, 0, 15, 14, 0, 0, 0, 0, 0, 0, +3, 5, 0, 0, 8, 0, 0, 0, 11, 11, 7, 7, 14, 14, 11, 11, 7, 6, 7, 5, 5, 4, 4, 3, 4, +3, 3, 3, 3, 3, 11, 12, 3, 0, 4, 6, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, +7, 7, 7, 8, 15, 30, 11, 0, 4, 4, 5, 5, 8, 8, 13, 10, 3, 5, 5, 6, 9, 4, 5, 4, 4, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 9, 9, 9, 8, 15, 9, 10, 11, 11, 10, 9, 11, 10, +3, 7, 10, 8, 11, 10, 12, 10, 12, 11, 10, 9, 10, 9, 15, 9, 9, 8, 4, 4, 4, 5, 8, 5, 8, +8, 8, 8, 8, 4, 8, 8, 3, 3, 7, 3, 13, 8, 8, 8, 8, 5, 8, 4, 8, 7, 11, 7, 7, 8, +5, 3, 5, 9, 9, 9, 11, 10, 10, 12, 10, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 3, 3, +3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 8, 8, 8, 5, 8, 9, 11, 11, 15, 5, 5, 8, +15, 12, 11, 8, 8, 8, 8, 8, 7, 11, 12, 8, 4, 5, 5, 12, 13, 8, 9, 5, 9, 9, 8, 8, 9, +8, 8, 15, 9, 9, 12, 15, 14, 8, 15, 5, 5, 3, 3, 8, 7, 7, 9, 3, 8, 5, 5, 8, 8, 8, +4, 3, 5, 14, 9, 10, 9, 10, 10, 3, 3, 3, 3, 12, 12, 12, 10, 10, 10, 3, 5, 4, 5, 5, 5, +5, 5, 5, 5, 5, 8, 3, 10, 8, 8, 8, 3, 11, 8, 9, 7, 10, 8, 9, 9, 5, 5, 5, 13, 13, +13, 8, 11, 8, 3, 10, 8, 11, 8, 11, 8, 8, 8, 5, 9, 8, 9, 8, 11, 9, 11, 10, 8, 10, 8, +8, 3, 8, 4, 8, 5, 10, 8, 10, 8, 12, 8, 11, 5, 11, 5, 10, 8, 9, 4, 9, 6, 10, 8, 10, +8, 8, 8, 8, 8, 8, 12, 11, 9, 8, 7, 9, 5, 10, 8, 8, 5, 17, 15, 8, 15, 8, 15, 8, 8, +15, 11, 9, 9, 9, 9, 9, 11, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 9, 15, 15, 15, 15, 15, 9, 9, 9, 15, 16, 14, 11, 11, 8, 10, 9, 8, 8, 11, +11, 7, 9, 3, 5, 13, 5, 9, 5, 5, 9, 5, 9, 8, 11, 8, 11, 8, 10, 8, 10, 8, 10, 8, 11, +8, 11, 8, 11, 8, 10, 8, 10, 8, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 10, 7, 8, 8, 3, 10, +8, 11, 8, 12, 8, 12, 8, 11, 5, 10, 8, 9, 4, 10, 8, 10, 8, 10, 8, 11, 8, 15, 11, 9, 7, +3, 9, 8, 15, 13, 12, 8, 3, 15, 11, 15, 11, 15, 11, 9, 7, 3, 5, 8, 9, 13, 13, 13, 13, 5, +5, 5, 5, 9, 12, 13, 6, 12, 12, 11, 3, 9, 10, 10, 10, 8, 10, 3, 10, 11, 11, 10, 10, 12, 10, +10, 9, 9, 9, 9, 11, 11, 3, 9, 9, 7, 8, 3, 8, 9, 7, 7, 8, 8, 3, 8, 7, 8, 7, 7, +8, 8, 7, 8, 8, 11, 12, 3, 8, 8, 8, 12, 10, 13, 8, 11, 10, 3, 3, 7, 16, 15, 13, 9, 10, +11, 9, 10, 10, 8, 10, 10, 14, 9, 11, 11, 9, 10, 11, 10, 12, 10, 10, 11, 9, 10, 11, 9, 11, 9, +14, 15, 12, 13, 10, 11, 15, 11, 8, 9, 8, 5, 9, 8, 9, 7, 8, 8, 7, 8, 10, 8, 8, 8, 8, +8, 7, 7, 11, 7, 9, 8, 11, 11, 9, 11, 8, 8, 11, 8, 8, 8, 5, 8, 8, 3, 3, 3, 14, 12, +8, 7, 7, 8, 7, 6, 15, 16, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 3, +5, 5, 4, 8, 8, 6, 8, 9, 3, 6, 9, 9, 3, 8, 7, 7, 9, 9, 3, 5, 9, 8, 9, 8, 7, +7, 8, 8, 10, 10, 6, 6, 6, 4, 6, 12, 3, 8, 8, 7, 7, 8, 10, 10, 10, 10, 8, 8, 8, 8, +6, 8, 9, 4, 6, 9, 4, 8, 7, 7, 9, 5, 9, 9, 8, 7, 8, 8, 10, 10, 3, 8, 7, 8, 9, +0, 0, 0, 0, 5, 5, 5, 6, 3, 3, 4, 3, 3, 3, 3, 3, 2, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 5, 8, 11, 11, 4, 11, 8, 8, 8, 11, 11, 11, 11, 11, 3, 11, 11, 11, 11, 11, 11, 11, +11, 10, 11, 11, 11, 11, 11, 4, 4, 11, 11, 11, 11, 8, 8, 8, 8, 7, 7, 12, 14, 6, 8, 12, 14, +6, 8, 10, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3, +11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 15, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 5, 5, +11, 9, 6, 3, 3, 3, 3, 6, 6, 3, 3, 10, 9, 4, 4, 3, 3, 11, 11, 4, 4, 4, 6, 11, 11, +4, 4, 11, 11, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 5, 5, 7, 7, 7, +7, 12, 12, 8, 8, 12, 12, 8, 8, 16, 16, 13, 13, 16, 16, 13, 13, 9, 9, 9, 9, 9, 9, 9, 9, +8, 7, 8, 6, 8, 7, 8, 6, 12, 12, 4, 4, 9, 9, 4, 4, 9, 9, 6, 6, 8, 8, 3, 3, 5, +5, 6, 6, 8, 8, 4, 4, 4, 6, 7, 6, 6, 6, 10, 9, 10, 9, 4, 4, 8, 9, 8, 9, 8, 9, +8, 9, 11, 11, 3, 3, 11, 11, 11, 2, 3, 11, 11, 3, 4, 11, 11, 11, 3, 3, 3, 3, 3, 3, 11, +3, 3, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 5, 5, 5, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 2, 15, 30, 13, 10, 13, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 8, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 9, 8, 9, 8, 9, 8, +9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 10, 8, 10, 8, 10, 8, 10, +8, 10, 8, 10, 8, 10, 8, 10, 8, 3, 3, 3, 3, 12, 8, 12, 8, 12, 8, 12, 8, 12, 8, 12, 8, +12, 8, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 10, 8, 10, 8, 13, 10, 13, 10, 13, 10, 13, 10, 13, +10, 9, 7, 9, 7, 9, 7, 9, 8, 3, 3, 12, 8, 10, 8, 10, 8, 10, 8, 10, 8, 10, 8, 0, 0, +0, 0, 8, 5, 14, 10, 9, 7, 9, 7, 11, 8, 8, 8, 8, 8, 10, 8, 10, 8, 10, 8, 11, 8, 12, +8, 11, 4, 4, 4, 9, 4, 4, 4, 4, 4, 4, 4, 3, 3, 5, 5, 3, 3, 3, 0, 3, 3, 3, 3, +3, 3, 3, 3, 6, 6, 6, 6, 10, 9, 11, 11, 4, 4, 11, 11, 4, 4, 11, 11, 4, 4, 11, 11, 4, +4, 11, 11, 4, 4, 11, 11, 4, 4, 11, 11, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 12, 8, 8, +12, 12, 8, 8, 12, 12, 8, 8, 16, 16, 13, 13, 16, 16, 13, 13, 9, 9, 8, 7, 8, 6, 12, 12, 12, +4, 4, 12, 12, 4, 4, 12, 12, 4, 4, 12, 12, 4, 4, 12, 12, 4, 4, 9, 9, 9, 9, 12, 14, 6, +8, 12, 14, 6, 8, 9, 9, 6, 6, 9, 9, 6, 6, 9, 9, 6, 6, 12, 14, 6, 8, 12, 14, 6, 8, +12, 14, 6, 8, 12, 14, 6, 8, 12, 14, 6, 8, 8, 8, 3, 3, 8, 8, 3, 3, 8, 8, 3, 3, 8, +8, 3, 3, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 4, 6, 6, 6, +6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 9, 10, 9, 4, 4, 6, 6, +10, 9, 4, 4, 10, 9, 12, 12, 12, 12, 3, 0, 0, 0, 0, 0, 0, 0, 17, 16, 0, 0, 0, 0, 0, +0, 3, 6, 0, 0, 9, 0, 0, 0, 12, 12, 8, 8, 16, 16, 13, 13, 8, 7, 8, 6, 6, 5, 4, 4, +5, 4, 4, 4, 4, 4, 12, 14, 3, 0, 5, 6, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, +9, 8, 8, 8, 9, 16, 32, 12, 0, 4, 4, 5, 6, 9, 9, 14, 11, 3, 5, 5, 6, 9, 4, 5, 4, +4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 4, 9, 9, 9, 9, 16, 11, 11, 12, 12, 11, 10, 12, +11, 3, 8, 11, 9, 13, 11, 12, 11, 12, 11, 11, 9, 11, 11, 15, 11, 9, 9, 4, 4, 4, 7, 9, 5, +9, 9, 8, 9, 9, 4, 9, 8, 4, 3, 8, 3, 13, 8, 9, 9, 9, 5, 8, 4, 8, 7, 11, 7, 7, +7, 5, 3, 5, 9, 11, 11, 12, 11, 11, 12, 11, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 3, 3, +3, 3, 8, 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, 6, 9, 9, 9, 6, 9, 9, 12, 12, 16, 5, 5, +9, 16, 12, 11, 9, 9, 9, 9, 9, 8, 11, 13, 9, 4, 5, 5, 12, 14, 9, 10, 5, 9, 9, 9, 9, +9, 9, 9, 16, 11, 11, 12, 17, 15, 9, 16, 5, 5, 4, 4, 9, 8, 7, 9, 3, 9, 5, 5, 8, 8, +9, 4, 4, 5, 17, 11, 11, 11, 11, 11, 3, 3, 3, 3, 12, 12, 12, 11, 11, 11, 3, 5, 4, 5, 5, +5, 5, 5, 5, 5, 5, 9, 3, 11, 8, 9, 7, 3, 12, 9, 9, 7, 11, 9, 9, 9, 5, 5, 5, 13, +13, 13, 9, 12, 9, 3, 11, 8, 12, 8, 12, 8, 9, 9, 5, 11, 9, 11, 9, 12, 10, 12, 11, 9, 11, +9, 9, 3, 9, 4, 9, 5, 11, 8, 11, 8, 12, 9, 11, 5, 11, 5, 11, 8, 9, 4, 9, 6, 11, 8, +11, 8, 9, 7, 9, 7, 9, 12, 11, 9, 9, 7, 10, 5, 10, 9, 8, 6, 18, 16, 8, 16, 8, 16, 8, +8, 16, 12, 9, 10, 9, 10, 10, 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 12, 10, 16, 16, 16, 16, 16, 10, 10, 10, 16, 17, 15, 12, 12, 9, 11, 10, 8, 8, +12, 12, 7, 10, 3, 6, 14, 5, 10, 6, 6, 10, 6, 11, 9, 12, 8, 12, 8, 11, 9, 11, 9, 11, 9, +12, 9, 12, 9, 12, 9, 11, 8, 11, 8, 3, 3, 3, 3, 3, 3, 3, 4, 8, 3, 11, 8, 8, 9, 3, +11, 8, 12, 9, 12, 9, 12, 9, 11, 5, 11, 8, 10, 4, 11, 8, 11, 8, 11, 8, 12, 8, 15, 11, 9, +7, 3, 11, 9, 16, 14, 12, 9, 3, 15, 11, 15, 11, 15, 11, 9, 7, 4, 5, 9, 10, 13, 13, 13, 13, +5, 5, 5, 5, 11, 13, 13, 6, 12, 12, 12, 3, 11, 11, 11, 11, 9, 11, 3, 11, 11, 13, 11, 10, 12, +11, 11, 10, 9, 9, 11, 11, 12, 3, 9, 9, 7, 8, 3, 8, 9, 8, 7, 8, 9, 3, 8, 8, 9, 7, +7, 9, 9, 8, 8, 8, 11, 13, 3, 8, 9, 8, 13, 11, 14, 9, 12, 11, 3, 3, 8, 17, 16, 13, 9, +10, 12, 11, 11, 11, 9, 11, 11, 14, 10, 12, 12, 9, 11, 13, 11, 12, 11, 11, 12, 9, 10, 11, 11, 12, +10, 13, 14, 13, 14, 11, 12, 16, 12, 9, 9, 9, 6, 9, 9, 10, 7, 8, 8, 7, 8, 11, 8, 9, 8, +9, 8, 7, 7, 13, 7, 9, 8, 11, 11, 10, 12, 9, 8, 12, 9, 9, 8, 6, 8, 8, 4, 3, 3, 15, +13, 8, 7, 7, 8, 8, 7, 16, 17, 11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, +3, 5, 5, 4, 9, 9, 6, 8, 10, 3, 6, 10, 9, 3, 8, 7, 7, 10, 10, 3, 6, 9, 8, 9, 9, +7, 8, 9, 8, 11, 10, 6, 6, 6, 4, 7, 12, 3, 8, 8, 7, 7, 9, 11, 11, 11, 11, 9, 9, 9, +9, 6, 8, 10, 5, 7, 9, 5, 8, 7, 7, 10, 6, 9, 9, 9, 8, 9, 8, 11, 10, 3, 9, 7, 9, +9, 0, 0, 0, 0, 5, 5, 6, 7, 3, 3, 4, 3, 3, 3, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 5, 8, 12, 12, 5, 12, 8, 8, 8, 12, 12, 12, 12, 12, 3, 12, 12, 12, 12, 12, 12, +12, 12, 10, 12, 12, 12, 11, 11, 4, 4, 12, 12, 12, 12, 9, 8, 8, 8, 8, 8, 13, 15, 6, 8, 13, +15, 6, 8, 10, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4, 3, 3, 3, +3, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 16, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 5, +5, 12, 10, 7, 3, 4, 3, 4, 7, 7, 3, 4, 10, 9, 4, 4, 3, 4, 11, 11, 4, 4, 5, 6, 11, +11, 4, 4, 11, 11, 4, 4, 9, 8, 8, 8, 9, 8, 8, 8, 9, 8, 8, 8, 5, 5, 5, 5, 8, 8, +8, 8, 13, 13, 9, 9, 13, 13, 9, 9, 18, 18, 14, 14, 18, 18, 14, 14, 9, 9, 9, 9, 9, 9, 9, +9, 9, 7, 8, 6, 9, 7, 8, 6, 13, 13, 4, 4, 9, 9, 4, 4, 10, 10, 6, 6, 8, 8, 3, 3, +5, 5, 6, 6, 8, 8, 4, 4, 5, 6, 7, 6, 7, 7, 10, 9, 10, 9, 4, 4, 9, 10, 9, 10, 9, +10, 9, 10, 12, 12, 3, 3, 12, 12, 12, 3, 3, 12, 12, 3, 4, 12, 12, 12, 3, 3, 3, 3, 3, 4, +12, 3, 3, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 5, 5, 5, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 16, 32, 14, 11, 14, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 8, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 11, 9, 11, 9, 11, +9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, +11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 3, 4, 3, 4, 12, 9, 12, 9, 12, 9, 12, 9, 12, 9, 12, +9, 12, 9, 14, 11, 14, 11, 14, 11, 14, 11, 14, 11, 11, 8, 11, 8, 14, 11, 14, 11, 14, 11, 14, 11, +14, 11, 9, 7, 9, 7, 9, 7, 11, 9, 3, 4, 12, 9, 11, 8, 11, 8, 11, 8, 11, 8, 11, 8, 0, +0, 0, 0, 9, 6, 15, 11, 9, 7, 9, 7, 12, 9, 9, 8, 9, 8, 11, 8, 11, 8, 11, 8, 12, 9, +12, 9, 11, 4, 4, 4, 9, 4, 4, 4, 4, 4, 4, 4, 3, 3, 5, 5, 3, 3, 3, 0, 3, 4, 3, +4, 3, 4, 3, 4, 7, 7, 7, 7, 10, 9, 11, 11, 4, 4, 11, 11, 4, 4, 11, 11, 4, 4, 11, 11, +4, 4, 11, 11, 4, 4, 11, 11, 4, 4, 11, 11, 4, 4, 9, 8, 8, 8, 9, 8, 8, 8, 9, 8, 8, +8, 9, 8, 8, 8, 9, 8, 8, 8, 9, 8, 8, 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 13, 13, 9, +9, 13, 13, 9, 9, 13, 13, 9, 9, 18, 18, 14, 14, 18, 18, 14, 14, 9, 9, 9, 7, 8, 6, 13, 13, +13, 4, 4, 13, 13, 4, 4, 13, 13, 4, 4, 13, 13, 4, 4, 13, 13, 4, 4, 9, 9, 9, 9, 13, 15, +6, 8, 13, 15, 6, 8, 10, 10, 6, 6, 10, 10, 6, 6, 10, 10, 6, 6, 13, 15, 6, 8, 13, 15, 6, +8, 13, 15, 6, 8, 13, 15, 6, 8, 13, 15, 6, 8, 8, 8, 3, 3, 8, 8, 3, 3, 8, 8, 3, 3, +8, 8, 3, 3, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 4, 4, 8, 8, 9, 8, 8, 8, 5, 6, 6, +6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 9, 10, 9, 4, 4, 7, +7, 10, 9, 4, 4, 10, 9, 13, 13, 13, 13, 3, 0, 0, 0, 0, 0, 0, 0, 18, 17, 0, 0, 0, 0, +0, 0, 3, 6, 0, 0, 10, 0, 0, 0, 13, 13, 9, 9, 18, 18, 14, 14, 9, 7, 8, 6, 7, 5, 5, +4, 5, 4, 4, 4, 4, 4, 13, 15, 3, 0, 5, 6, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, +9, 10, 8, 8, 9, 10, 17, 34, 13, 0, 5, 5, 5, 6, 9, 9, 15, 11, 3, 6, 6, 7, 10, 5, 6, +5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 10, 10, 10, 9, 17, 11, 11, 12, 12, 11, 10, +12, 11, 5, 9, 11, 9, 13, 11, 12, 11, 12, 11, 11, 9, 11, 11, 17, 11, 11, 9, 5, 5, 5, 7, 9, +6, 9, 9, 9, 9, 9, 5, 9, 9, 4, 3, 8, 3, 13, 9, 9, 9, 9, 6, 8, 4, 9, 7, 11, 7, +9, 8, 6, 5, 6, 10, 11, 11, 12, 11, 11, 12, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, +5, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 9, 9, 9, 6, 9, 10, 13, 13, 17, 6, +6, 9, 17, 13, 12, 9, 9, 9, 9, 9, 8, 12, 14, 9, 4, 5, 5, 13, 15, 9, 10, 5, 10, 10, 9, +9, 11, 9, 9, 17, 11, 11, 12, 17, 16, 9, 17, 6, 6, 4, 4, 9, 8, 9, 11, 3, 9, 6, 6, 9, +9, 9, 5, 4, 6, 17, 11, 11, 11, 11, 11, 5, 5, 5, 5, 12, 12, 12, 11, 11, 11, 5, 6, 4, 6, +6, 6, 6, 6, 6, 6, 6, 9, 3, 11, 8, 9, 8, 5, 12, 9, 11, 9, 11, 9, 10, 10, 6, 6, 6, +14, 14, 14, 9, 12, 9, 5, 11, 8, 12, 9, 12, 9, 10, 9, 6, 11, 9, 11, 9, 12, 10, 12, 11, 9, +11, 9, 9, 3, 9, 4, 9, 6, 11, 9, 11, 9, 12, 9, 11, 6, 11, 6, 11, 8, 9, 4, 9, 6, 11, +9, 11, 9, 9, 8, 9, 8, 9, 12, 13, 10, 9, 8, 11, 6, 11, 9, 9, 6, 19, 17, 9, 17, 9, 17, +9, 9, 17, 12, 10, 10, 10, 10, 10, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 10, 17, 17, 17, 17, 17, 10, 10, 10, 17, 18, 16, 13, 13, 9, 11, 10, 9, +9, 13, 13, 8, 10, 3, 6, 15, 6, 10, 6, 6, 10, 6, 11, 9, 12, 9, 12, 9, 11, 9, 11, 9, 11, +9, 12, 9, 12, 9, 12, 9, 11, 9, 11, 9, 5, 5, 5, 5, 5, 5, 5, 4, 9, 3, 11, 8, 8, 9, +3, 11, 9, 12, 9, 12, 9, 12, 9, 11, 6, 11, 8, 10, 4, 11, 9, 11, 9, 11, 9, 12, 9, 17, 11, +11, 9, 4, 11, 9, 17, 15, 13, 9, 4, 17, 11, 17, 11, 17, 11, 11, 9, 4, 6, 9, 10, 14, 14, 14, +14, 6, 6, 6, 6, 11, 13, 13, 6, 13, 14, 13, 3, 11, 11, 11, 11, 9, 11, 5, 11, 11, 13, 11, 11, +12, 11, 11, 11, 9, 11, 11, 13, 13, 5, 11, 10, 8, 9, 3, 9, 10, 9, 8, 9, 9, 3, 8, 9, 9, +7, 8, 9, 9, 8, 9, 9, 11, 13, 3, 9, 9, 9, 13, 11, 15, 9, 12, 11, 5, 5, 9, 18, 17, 15, +10, 11, 11, 11, 11, 11, 9, 12, 11, 15, 10, 12, 12, 10, 10, 13, 11, 12, 11, 11, 12, 9, 11, 13, 11, +13, 10, 15, 15, 13, 14, 10, 12, 16, 12, 9, 9, 9, 6, 10, 9, 11, 8, 9, 9, 7, 10, 11, 9, 9, +9, 9, 9, 8, 9, 13, 7, 10, 9, 14, 14, 11, 12, 9, 9, 13, 9, 9, 9, 6, 9, 8, 4, 5, 3, +15, 14, 9, 7, 9, 9, 8, 7, 17, 18, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, +6, 3, 6, 6, 5, 10, 9, 7, 9, 10, 3, 7, 10, 10, 3, 9, 8, 8, 10, 10, 3, 6, 10, 9, 10, +9, 8, 8, 9, 9, 12, 11, 7, 7, 7, 4, 7, 12, 3, 9, 9, 8, 8, 9, 12, 12, 12, 12, 10, 10, +10, 9, 7, 9, 10, 5, 7, 10, 5, 9, 8, 8, 10, 6, 10, 10, 9, 8, 9, 9, 12, 11, 3, 9, 8, +9, 10, 0, 0, 0, 0, 5, 5, 6, 7, 4, 3, 4, 3, 3, 4, 3, 4, 3, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 5, 9, 13, 13, 5, 13, 9, 9, 9, 13, 13, 13, 13, 13, 4, 13, 13, 13, 13, 13, +13, 13, 13, 11, 13, 13, 13, 12, 12, 4, 4, 13, 13, 13, 13, 10, 9, 9, 9, 8, 8, 14, 16, 7, 9, +14, 16, 7, 9, 11, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 4, 4, 4, +4, 4, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 17, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +5, 5, 13, 10, 7, 4, 4, 4, 4, 7, 7, 4, 4, 11, 10, 4, 4, 4, 4, 12, 12, 4, 4, 5, 6, +12, 12, 4, 4, 12, 12, 4, 4, 10, 9, 9, 9, 10, 9, 9, 9, 10, 9, 9, 9, 6, 6, 6, 6, 8, +8, 8, 8, 14, 14, 9, 9, 14, 14, 9, 9, 19, 19, 14, 14, 19, 19, 14, 14, 10, 10, 10, 10, 10, 10, +10, 10, 9, 8, 9, 7, 9, 8, 9, 7, 13, 13, 5, 4, 10, 10, 5, 4, 10, 10, 7, 7, 9, 9, 4, +4, 6, 6, 7, 7, 9, 9, 4, 4, 5, 6, 8, 7, 7, 7, 11, 10, 11, 10, 4, 4, 9, 10, 9, 10, +9, 10, 9, 10, 13, 13, 3, 3, 13, 13, 13, 3, 4, 13, 13, 4, 4, 13, 13, 13, 4, 4, 4, 4, 4, +4, 13, 3, 3, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 5, 5, 5, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2, 17, 34, 15, 11, 15, 11, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 9, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 11, 9, 11, 9, +11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, +9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, 5, 4, 5, 4, 12, 9, 12, 9, 12, 9, 12, 9, 12, 9, +12, 9, 12, 9, 15, 11, 15, 11, 15, 11, 15, 11, 15, 11, 11, 9, 11, 9, 15, 11, 15, 11, 15, 11, 15, +11, 15, 11, 11, 9, 11, 9, 11, 9, 11, 9, 5, 4, 12, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 9, +0, 0, 0, 0, 9, 6, 16, 11, 10, 7, 10, 7, 12, 9, 9, 9, 9, 9, 11, 9, 11, 9, 11, 9, 13, +9, 13, 9, 12, 4, 5, 4, 10, 4, 4, 4, 4, 4, 4, 5, 4, 4, 6, 6, 4, 4, 4, 0, 4, 4, +4, 4, 4, 4, 4, 4, 7, 7, 7, 7, 11, 10, 12, 12, 4, 4, 12, 12, 4, 4, 12, 12, 4, 4, 12, +12, 4, 4, 12, 12, 4, 4, 12, 12, 4, 4, 12, 12, 4, 4, 10, 9, 9, 9, 10, 9, 9, 9, 10, 9, +9, 9, 10, 9, 9, 9, 10, 9, 9, 9, 10, 9, 9, 9, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 14, 14, +9, 9, 14, 14, 9, 9, 14, 14, 9, 9, 19, 19, 14, 14, 19, 19, 14, 14, 10, 10, 9, 8, 9, 7, 13, +13, 13, 5, 4, 13, 13, 5, 4, 13, 13, 5, 4, 13, 13, 5, 4, 13, 13, 5, 4, 10, 10, 10, 10, 14, +16, 7, 9, 14, 16, 7, 9, 10, 10, 7, 7, 10, 10, 7, 7, 10, 10, 7, 7, 14, 16, 7, 9, 14, 16, +7, 9, 14, 16, 7, 9, 14, 16, 7, 9, 14, 16, 7, 9, 9, 9, 4, 4, 9, 9, 4, 4, 9, 9, 4, +4, 9, 9, 4, 4, 9, 9, 4, 4, 9, 9, 9, 9, 9, 9, 4, 4, 9, 9, 10, 9, 9, 9, 5, 6, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 11, 10, 11, 10, 4, 4, +7, 7, 11, 10, 4, 4, 11, 10, 14, 14, 14, 14, 4, 0, 0, 0, 0, 0, 0, 0, 19, 18, 0, 0, 0, +0, 0, 0, 3, 6, 0, 0, 10, 0, 0, 0, 14, 14, 9, 9, 19, 19, 14, 14, 9, 8, 9, 7, 7, 6, +5, 4, 5, 4, 4, 4, 4, 4, 14, 16, 3, 0, 6, 7, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, +10, 9, 10, 9, 9, 9, 10, 19, 38, 14, 0, 5, 5, 6, 7, 11, 11, 17, 13, 4, 6, 6, 7, 11, 5, +6, 5, 5, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 5, 5, 11, 11, 11, 11, 19, 13, 13, 14, 14, 13, +12, 15, 13, 6, 10, 13, 11, 15, 13, 15, 13, 15, 14, 13, 12, 13, 13, 19, 13, 12, 12, 5, 5, 5, 7, +11, 6, 10, 11, 10, 11, 11, 6, 11, 10, 4, 4, 9, 4, 16, 10, 11, 11, 11, 6, 10, 5, 10, 9, 13, +9, 9, 9, 6, 6, 6, 11, 13, 13, 14, 13, 13, 15, 13, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, +6, 6, 6, 6, 10, 11, 11, 11, 11, 11, 10, 10, 10, 10, 11, 8, 11, 11, 11, 7, 10, 12, 14, 14, 19, +6, 6, 10, 19, 15, 14, 10, 10, 10, 11, 11, 9, 14, 16, 10, 4, 7, 7, 15, 17, 11, 12, 6, 11, 11, +11, 10, 12, 11, 11, 19, 13, 13, 15, 19, 18, 11, 19, 7, 7, 4, 4, 10, 9, 9, 12, 3, 11, 6, 6, +10, 10, 11, 5, 4, 7, 17, 13, 13, 13, 13, 13, 6, 6, 6, 6, 15, 15, 15, 13, 13, 13, 6, 6, 5, +6, 6, 6, 6, 6, 6, 6, 6, 11, 4, 13, 10, 12, 9, 6, 14, 11, 12, 9, 13, 11, 11, 11, 6, 6, +6, 16, 16, 16, 11, 15, 11, 6, 13, 10, 14, 10, 14, 10, 11, 11, 6, 13, 10, 13, 10, 14, 12, 14, 13, +11, 13, 11, 11, 4, 11, 6, 11, 6, 13, 10, 13, 10, 15, 11, 14, 6, 14, 6, 13, 10, 12, 6, 12, 7, +13, 10, 13, 10, 12, 9, 12, 9, 10, 15, 14, 11, 11, 8, 12, 8, 12, 11, 10, 7, 21, 19, 10, 19, 10, +19, 10, 10, 19, 14, 11, 11, 11, 11, 11, 13, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 14, 11, 19, 19, 19, 19, 19, 11, 11, 11, 19, 20, 17, 14, 14, 10, 12, 11, +10, 10, 14, 14, 8, 11, 4, 7, 17, 6, 11, 7, 7, 11, 7, 13, 10, 14, 10, 14, 10, 13, 11, 13, 11, +13, 11, 15, 11, 15, 11, 15, 11, 13, 10, 13, 10, 6, 6, 6, 6, 6, 6, 6, 4, 10, 4, 13, 9, 10, +11, 4, 13, 10, 14, 11, 15, 11, 15, 11, 14, 6, 13, 10, 12, 5, 13, 10, 13, 10, 13, 10, 13, 10, 19, +13, 12, 9, 4, 13, 10, 19, 17, 15, 11, 6, 19, 13, 19, 13, 19, 13, 12, 9, 4, 6, 11, 11, 16, 16, +16, 16, 6, 6, 6, 6, 13, 15, 15, 7, 15, 16, 15, 4, 13, 13, 13, 13, 12, 13, 6, 13, 13, 15, 13, +12, 15, 13, 13, 12, 12, 12, 13, 14, 14, 6, 12, 11, 8, 10, 4, 10, 11, 10, 8, 10, 11, 4, 10, 9, +11, 9, 9, 11, 11, 9, 10, 10, 14, 16, 4, 10, 11, 10, 16, 13, 16, 10, 14, 13, 6, 6, 10, 20, 19, +15, 11, 12, 14, 13, 12, 13, 10, 13, 13, 18, 11, 14, 14, 11, 12, 15, 13, 15, 13, 13, 14, 12, 12, 14, +13, 14, 13, 17, 17, 15, 17, 13, 14, 19, 14, 10, 11, 10, 7, 11, 11, 14, 9, 10, 10, 8, 10, 13, 10, +11, 9, 11, 10, 8, 9, 16, 9, 11, 10, 14, 14, 12, 14, 11, 10, 14, 10, 11, 10, 7, 10, 10, 4, 6, +4, 17, 15, 10, 8, 9, 10, 9, 8, 19, 20, 13, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +7, 6, 4, 6, 6, 5, 11, 10, 8, 10, 11, 4, 7, 11, 11, 4, 10, 9, 9, 11, 11, 4, 7, 11, 10, +11, 10, 9, 9, 10, 10, 13, 12, 9, 9, 9, 4, 8, 16, 4, 10, 10, 9, 9, 10, 13, 13, 13, 13, 11, +11, 11, 10, 8, 10, 11, 5, 8, 11, 5, 10, 9, 9, 11, 7, 11, 11, 10, 9, 10, 10, 13, 12, 4, 10, +9, 10, 11, 0, 0, 0, 0, 6, 6, 7, 8, 4, 4, 5, 4, 4, 4, 4, 4, 3, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 6, 10, 14, 14, 5, 14, 10, 10, 10, 14, 14, 14, 14, 14, 4, 14, 14, 14, 14, +14, 14, 14, 14, 12, 14, 14, 14, 14, 14, 5, 5, 14, 14, 14, 14, 11, 10, 10, 10, 9, 9, 15, 18, 7, +10, 15, 18, 7, 10, 12, 11, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 4, 4, +4, 4, 4, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 19, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 6, 6, 14, 12, 8, 4, 4, 4, 4, 8, 8, 4, 4, 12, 11, 5, 5, 4, 4, 14, 14, 5, 5, 5, +7, 14, 14, 5, 5, 14, 14, 5, 5, 11, 10, 10, 10, 11, 10, 10, 10, 11, 10, 10, 10, 6, 6, 6, 6, +9, 9, 9, 9, 16, 16, 10, 10, 16, 16, 10, 10, 21, 21, 16, 16, 21, 21, 16, 16, 11, 11, 11, 11, 11, +11, 11, 11, 10, 9, 10, 7, 10, 9, 10, 7, 15, 15, 5, 5, 11, 11, 5, 5, 11, 11, 7, 7, 10, 10, +4, 4, 6, 6, 7, 7, 10, 10, 5, 5, 5, 7, 9, 7, 8, 8, 12, 11, 12, 11, 5, 5, 10, 11, 10, +11, 10, 11, 10, 11, 14, 14, 4, 4, 14, 14, 14, 3, 4, 14, 14, 4, 5, 14, 14, 14, 4, 4, 4, 4, +4, 4, 14, 4, 4, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 6, 6, 6, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 19, 38, 16, 12, 16, 13, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 13, 10, 13, +10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 10, 13, 11, 13, 11, +13, 11, 13, 11, 13, 11, 13, 11, 13, 11, 13, 11, 6, 4, 6, 4, 15, 11, 15, 11, 15, 11, 15, 11, 15, +11, 15, 11, 15, 11, 16, 12, 16, 12, 16, 12, 16, 12, 16, 12, 13, 10, 13, 10, 16, 13, 16, 13, 16, 13, +16, 13, 16, 13, 12, 9, 12, 9, 12, 9, 13, 10, 6, 4, 15, 11, 13, 10, 13, 10, 13, 10, 13, 10, 13, +10, 0, 0, 0, 0, 10, 7, 18, 13, 11, 8, 11, 8, 14, 11, 11, 10, 11, 10, 13, 10, 13, 10, 13, 10, +14, 11, 15, 11, 14, 5, 5, 5, 11, 5, 5, 5, 5, 5, 5, 5, 4, 4, 6, 6, 4, 4, 4, 0, 4, +4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 11, 14, 14, 5, 5, 14, 14, 5, 5, 14, 14, 5, 5, +14, 14, 5, 5, 14, 14, 5, 5, 14, 14, 5, 5, 14, 14, 5, 5, 11, 10, 10, 10, 11, 10, 10, 10, 11, +10, 10, 10, 11, 10, 10, 10, 11, 10, 10, 10, 11, 10, 10, 10, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +6, 6, 6, 6, 6, 6, 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, +16, 10, 10, 16, 16, 10, 10, 16, 16, 10, 10, 21, 21, 16, 16, 21, 21, 16, 16, 11, 11, 10, 9, 10, 7, +15, 15, 15, 5, 5, 15, 15, 5, 5, 15, 15, 5, 5, 15, 15, 5, 5, 15, 15, 5, 5, 11, 11, 11, 11, +15, 18, 7, 10, 15, 18, 7, 10, 11, 11, 7, 7, 11, 11, 7, 7, 11, 11, 7, 7, 15, 18, 7, 10, 15, +18, 7, 10, 15, 18, 7, 10, 15, 18, 7, 10, 15, 18, 7, 10, 10, 10, 4, 4, 10, 10, 4, 4, 10, 10, +4, 4, 10, 10, 4, 4, 10, 10, 5, 5, 10, 10, 10, 10, 10, 10, 5, 5, 10, 10, 11, 10, 10, 10, 5, +7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 11, 12, 11, 5, +5, 8, 8, 12, 11, 5, 5, 12, 11, 15, 15, 15, 15, 4, 0, 0, 0, 0, 0, 0, 0, 21, 21, 0, 0, +0, 0, 0, 0, 4, 7, 0, 0, 11, 0, 0, 0, 16, 16, 10, 10, 21, 21, 16, 16, 10, 9, 10, 7, 8, +6, 5, 5, 6, 5, 5, 5, 5, 5, 15, 18, 4, 0, 7, 9, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, +10, 11, 10, 11, 10, 10, 10, 11, 21, 42, 16, 0, 6, 6, 6, 7, 12, 12, 19, 14, 4, 7, 7, 8, 12, +6, 7, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 6, 6, 12, 12, 12, 12, 21, 13, 14, 15, 15, +14, 13, 16, 14, 6, 11, 14, 12, 17, 14, 16, 14, 16, 15, 14, 12, 14, 13, 21, 14, 14, 13, 6, 6, 6, +8, 12, 7, 12, 11, 11, 11, 12, 6, 11, 11, 5, 4, 10, 4, 16, 11, 12, 11, 11, 7, 11, 6, 11, 11, +15, 10, 11, 9, 7, 6, 7, 12, 13, 13, 15, 14, 14, 16, 14, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, +12, 6, 6, 6, 6, 11, 12, 12, 12, 12, 12, 11, 11, 11, 11, 12, 8, 12, 12, 12, 7, 11, 13, 15, 15, +21, 7, 7, 12, 21, 16, 15, 12, 12, 12, 12, 11, 10, 15, 17, 12, 6, 7, 8, 16, 19, 12, 13, 6, 12, +12, 12, 12, 13, 12, 12, 21, 13, 13, 16, 21, 20, 12, 21, 7, 7, 5, 5, 12, 10, 11, 14, 4, 12, 7, +7, 11, 11, 12, 6, 5, 7, 21, 13, 14, 13, 14, 14, 6, 6, 6, 6, 16, 16, 16, 14, 14, 14, 6, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 4, 14, 11, 13, 9, 6, 15, 12, 14, 11, 14, 12, 12, 12, 7, +7, 7, 18, 18, 18, 12, 16, 11, 6, 14, 11, 15, 11, 15, 11, 12, 12, 7, 13, 12, 13, 12, 15, 13, 15, +14, 12, 14, 12, 12, 4, 12, 6, 12, 7, 14, 11, 14, 11, 16, 12, 15, 7, 15, 7, 14, 11, 12, 6, 12, +8, 14, 11, 14, 11, 13, 9, 13, 9, 12, 16, 16, 12, 12, 9, 13, 8, 14, 12, 11, 8, 23, 21, 11, 21, +11, 21, 11, 11, 21, 15, 12, 13, 12, 13, 13, 15, 13, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 13, 21, 21, 21, 21, 21, 13, 13, 13, 21, 22, 19, 16, 16, 11, 14, +12, 11, 11, 16, 15, 9, 13, 4, 7, 19, 7, 13, 7, 7, 13, 7, 13, 12, 15, 11, 15, 11, 14, 12, 14, +12, 14, 12, 16, 11, 16, 11, 16, 12, 14, 11, 14, 11, 6, 6, 6, 6, 6, 6, 6, 5, 11, 4, 14, 10, +10, 12, 4, 14, 11, 15, 12, 16, 12, 16, 12, 15, 7, 14, 11, 13, 6, 14, 11, 14, 11, 14, 11, 14, 11, +21, 15, 14, 11, 5, 13, 12, 21, 19, 16, 12, 6, 21, 15, 21, 15, 21, 15, 14, 11, 5, 7, 12, 13, 18, +18, 18, 18, 7, 7, 7, 7, 13, 16, 17, 8, 16, 17, 16, 4, 13, 14, 14, 14, 13, 14, 6, 14, 14, 17, +14, 14, 16, 14, 14, 13, 12, 14, 14, 18, 16, 6, 14, 12, 9, 11, 4, 10, 12, 10, 9, 11, 12, 4, 10, +11, 11, 11, 9, 12, 12, 10, 10, 11, 14, 16, 4, 10, 12, 10, 16, 14, 18, 11, 15, 14, 6, 6, 11, 22, +21, 18, 12, 13, 15, 13, 14, 14, 11, 14, 14, 19, 13, 15, 15, 12, 14, 17, 14, 16, 14, 14, 15, 12, 13, +16, 14, 16, 14, 18, 20, 17, 19, 14, 15, 21, 15, 12, 12, 11, 8, 12, 12, 14, 10, 11, 11, 9, 11, 13, +11, 12, 10, 11, 11, 10, 11, 17, 10, 12, 11, 16, 16, 13, 15, 11, 11, 16, 11, 12, 12, 8, 11, 11, 5, +6, 4, 19, 17, 12, 9, 11, 11, 10, 9, 21, 23, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +7, 8, 7, 6, 7, 7, 6, 12, 11, 8, 11, 13, 6, 8, 13, 12, 6, 11, 10, 10, 13, 13, 6, 7, 12, +11, 12, 11, 10, 10, 12, 11, 15, 14, 11, 11, 11, 5, 9, 18, 6, 11, 11, 10, 10, 11, 15, 15, 15, 15, +12, 12, 12, 11, 8, 11, 13, 6, 9, 12, 6, 11, 10, 10, 13, 7, 12, 12, 11, 10, 12, 11, 15, 14, 6, +11, 10, 11, 12, 0, 0, 0, 0, 7, 7, 7, 9, 4, 4, 5, 4, 4, 4, 4, 4, 3, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 7, 11, 16, 16, 6, 16, 11, 11, 11, 16, 16, 16, 16, 16, 4, 16, 16, 16, +16, 16, 16, 16, 16, 13, 16, 16, 16, 15, 15, 5, 5, 16, 16, 16, 16, 12, 11, 11, 11, 10, 10, 17, 20, +8, 11, 17, 20, 8, 11, 13, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 5, +4, 4, 4, 4, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 21, 16, +16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 7, 7, 16, 13, 9, 4, 5, 4, 5, 9, 9, 4, 5, 13, 12, 5, 5, 4, 5, 15, 15, 5, 5, +6, 8, 15, 15, 5, 5, 15, 15, 5, 5, 12, 11, 11, 11, 12, 11, 11, 11, 12, 11, 11, 11, 7, 7, 7, +7, 10, 10, 10, 10, 17, 17, 11, 11, 17, 17, 11, 11, 23, 23, 18, 18, 23, 23, 18, 18, 12, 12, 12, 12, +12, 12, 12, 12, 11, 9, 11, 8, 11, 9, 11, 8, 17, 17, 6, 6, 12, 12, 6, 6, 13, 13, 8, 8, 11, +11, 4, 4, 7, 7, 8, 8, 11, 11, 5, 5, 6, 8, 9, 8, 9, 9, 13, 12, 13, 12, 5, 5, 11, 13, +11, 13, 11, 13, 11, 13, 16, 16, 4, 4, 16, 16, 16, 3, 4, 16, 16, 4, 5, 16, 16, 16, 4, 4, 4, +4, 4, 5, 16, 4, 4, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 7, 7, 7, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 3, 21, 42, 18, 14, 18, 14, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 13, 12, +13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 14, 12, 14, +12, 14, 12, 14, 12, 14, 12, 14, 12, 14, 12, 14, 12, 6, 5, 6, 5, 16, 12, 16, 12, 16, 12, 16, 12, +16, 12, 16, 12, 16, 12, 18, 14, 18, 14, 18, 14, 18, 14, 18, 14, 14, 11, 14, 11, 18, 14, 18, 14, 18, +14, 18, 14, 18, 14, 14, 11, 14, 11, 14, 11, 13, 12, 6, 5, 16, 12, 14, 11, 14, 11, 14, 11, 14, 11, +14, 11, 0, 0, 0, 0, 11, 8, 19, 14, 12, 9, 12, 9, 15, 12, 12, 11, 12, 11, 14, 11, 14, 11, 14, +11, 16, 12, 16, 12, 15, 5, 6, 6, 12, 5, 5, 5, 5, 5, 5, 6, 4, 4, 7, 7, 4, 4, 4, 0, +4, 5, 4, 5, 4, 5, 4, 5, 9, 9, 9, 9, 13, 12, 15, 15, 5, 5, 15, 15, 5, 5, 15, 15, 5, +5, 15, 15, 5, 5, 15, 15, 5, 5, 15, 15, 5, 5, 15, 15, 5, 5, 12, 11, 11, 11, 12, 11, 11, 11, +12, 11, 11, 11, 12, 11, 11, 11, 12, 11, 11, 11, 12, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, 7, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +17, 17, 11, 11, 17, 17, 11, 11, 17, 17, 11, 11, 23, 23, 18, 18, 23, 23, 18, 18, 12, 12, 11, 9, 11, +8, 17, 17, 17, 6, 6, 17, 17, 6, 6, 17, 17, 6, 6, 17, 17, 6, 6, 17, 17, 6, 6, 12, 12, 12, +12, 17, 20, 8, 11, 17, 20, 8, 11, 13, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 8, 17, 20, 8, 11, +17, 20, 8, 11, 17, 20, 8, 11, 17, 20, 8, 11, 17, 20, 8, 11, 11, 11, 4, 4, 11, 11, 4, 4, 11, +11, 4, 4, 11, 11, 4, 4, 11, 11, 5, 5, 11, 11, 11, 11, 11, 11, 5, 5, 11, 11, 12, 11, 11, 11, +6, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 12, 13, 12, +5, 5, 9, 9, 13, 12, 5, 5, 13, 12, 17, 17, 17, 17, 4, 0, 0, 0, 0, 0, 0, 0, 24, 23, 0, +0, 0, 0, 0, 0, 4, 8, 0, 0, 13, 0, 0, 0, 17, 17, 11, 11, 23, 23, 18, 18, 11, 9, 11, 8, +9, 7, 6, 5, 7, 5, 5, 5, 5, 5, 17, 20, 6, 0, 7, 11, 11, 13, 11, 13, 11, 13, 11, 13, 11, +13, 11, 13, 11, 13, 11, 11, 11, 13, 24, 48, 18, 0, 7, 7, 8, 9, 13, 13, 21, 16, 5, 8, 8, 9, +14, 7, 8, 7, 7, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 7, 7, 14, 14, 14, 13, 24, 15, 16, 17, +17, 16, 15, 19, 17, 6, 12, 16, 13, 19, 17, 19, 16, 19, 17, 16, 14, 17, 15, 23, 15, 16, 15, 7, 7, +7, 12, 13, 8, 13, 14, 12, 14, 13, 7, 14, 14, 5, 6, 12, 6, 20, 14, 13, 14, 14, 8, 12, 7, 14, +11, 17, 11, 12, 12, 8, 6, 8, 14, 15, 15, 17, 16, 17, 19, 17, 13, 13, 13, 13, 13, 13, 12, 13, 13, +13, 13, 6, 6, 6, 6, 14, 13, 13, 13, 13, 13, 14, 14, 14, 14, 13, 10, 13, 13, 13, 8, 13, 15, 18, +18, 24, 8, 8, 13, 24, 19, 17, 13, 13, 13, 13, 14, 12, 17, 20, 13, 6, 9, 9, 18, 21, 15, 15, 8, +14, 13, 13, 13, 15, 13, 13, 24, 15, 15, 19, 24, 23, 13, 24, 8, 8, 5, 5, 13, 12, 12, 16, 4, 13, +8, 8, 12, 12, 13, 7, 5, 8, 26, 15, 16, 15, 16, 16, 6, 6, 6, 6, 19, 19, 19, 17, 17, 17, 6, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 13, 6, 16, 12, 15, 12, 6, 17, 13, 16, 12, 16, 13, 14, 14, +8, 8, 8, 20, 20, 20, 13, 19, 14, 6, 16, 12, 17, 12, 17, 12, 13, 13, 8, 15, 13, 15, 13, 17, 15, +17, 16, 13, 16, 13, 13, 6, 13, 7, 13, 8, 17, 14, 17, 14, 19, 13, 17, 8, 17, 8, 16, 12, 14, 7, +14, 9, 17, 14, 17, 14, 15, 12, 15, 12, 13, 19, 18, 14, 13, 11, 15, 9, 16, 13, 12, 9, 26, 24, 12, +24, 12, 24, 12, 12, 24, 17, 14, 15, 14, 15, 15, 17, 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, +17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, +17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 15, 24, 24, 24, 24, 24, 15, 15, 15, 25, 25, 22, 18, 18, 13, +16, 14, 12, 12, 18, 18, 11, 15, 5, 9, 21, 8, 15, 9, 9, 15, 9, 15, 13, 17, 12, 17, 12, 16, 13, +16, 13, 16, 13, 19, 14, 19, 14, 19, 13, 17, 14, 17, 14, 6, 6, 6, 6, 6, 6, 6, 5, 12, 6, 16, +12, 12, 13, 6, 17, 14, 17, 13, 19, 13, 19, 13, 17, 8, 16, 12, 15, 7, 17, 14, 17, 14, 17, 14, 17, +14, 23, 17, 16, 12, 5, 15, 13, 24, 21, 19, 15, 6, 23, 17, 23, 17, 23, 17, 16, 12, 5, 8, 13, 14, +20, 20, 20, 20, 8, 8, 8, 8, 15, 19, 20, 9, 19, 20, 18, 6, 15, 16, 16, 16, 15, 17, 6, 16, 16, +19, 17, 16, 19, 17, 16, 15, 14, 16, 15, 19, 18, 6, 16, 14, 11, 14, 6, 14, 14, 11, 11, 14, 13, 6, +12, 12, 14, 11, 11, 13, 14, 12, 14, 13, 18, 18, 6, 14, 13, 14, 18, 16, 21, 13, 17, 16, 6, 6, 12, +25, 24, 22, 14, 15, 17, 15, 16, 16, 13, 16, 16, 22, 15, 17, 17, 14, 16, 19, 17, 19, 17, 16, 17, 14, +15, 18, 15, 18, 16, 22, 23, 19, 21, 16, 17, 24, 17, 13, 14, 13, 9, 14, 13, 16, 11, 13, 13, 11, 14, +17, 13, 13, 13, 14, 12, 11, 12, 20, 11, 14, 13, 19, 20, 15, 17, 13, 12, 18, 13, 13, 14, 9, 12, 12, +5, 6, 6, 22, 20, 14, 11, 12, 13, 12, 10, 24, 26, 17, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 9, 8, 6, 8, 8, 7, 14, 13, 10, 12, 14, 6, 9, 14, 14, 6, 12, 11, 11, 14, 14, 6, 8, +14, 13, 14, 13, 11, 11, 13, 12, 17, 15, 12, 12, 12, 6, 10, 21, 6, 12, 12, 11, 11, 13, 17, 17, 17, +17, 14, 14, 14, 13, 10, 12, 14, 7, 10, 14, 7, 12, 11, 11, 14, 8, 14, 14, 13, 11, 13, 12, 17, 15, +6, 13, 11, 13, 14, 0, 0, 0, 0, 8, 8, 9, 10, 5, 5, 6, 5, 5, 5, 5, 5, 4, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 8, 13, 18, 18, 7, 18, 13, 13, 13, 18, 18, 18, 18, 18, 5, 18, 18, +18, 18, 18, 18, 18, 18, 15, 18, 18, 18, 17, 17, 6, 6, 18, 18, 18, 18, 14, 13, 13, 13, 12, 12, 19, +22, 9, 12, 19, 22, 9, 12, 15, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +5, 5, 5, 5, 5, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 24, +18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +18, 18, 18, 8, 8, 18, 15, 10, 5, 6, 5, 6, 10, 10, 5, 6, 15, 14, 6, 6, 5, 6, 17, 17, 6, +6, 7, 9, 17, 17, 6, 6, 17, 17, 6, 6, 14, 13, 13, 13, 14, 13, 13, 13, 14, 13, 13, 13, 8, 8, +8, 8, 12, 12, 12, 12, 20, 20, 13, 13, 20, 20, 13, 13, 26, 26, 20, 20, 26, 26, 20, 20, 14, 14, 14, +14, 14, 14, 14, 14, 13, 11, 13, 9, 13, 11, 13, 9, 19, 19, 6, 6, 14, 14, 6, 6, 14, 14, 9, 9, +12, 12, 5, 5, 8, 8, 9, 9, 13, 13, 6, 6, 7, 9, 11, 9, 10, 10, 15, 14, 15, 14, 6, 6, 13, +14, 13, 14, 13, 14, 13, 14, 18, 18, 5, 5, 18, 18, 18, 4, 5, 18, 18, 5, 6, 18, 18, 18, 5, 5, +5, 5, 5, 5, 18, 5, 5, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 8, 8, 8, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 3, 24, 48, 21, 16, 21, 16, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 15, +13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 16, 13, +16, 13, 16, 13, 16, 13, 16, 13, 16, 13, 16, 13, 16, 13, 6, 5, 6, 5, 19, 13, 19, 13, 19, 13, 19, +13, 19, 13, 19, 13, 19, 13, 21, 16, 21, 16, 21, 16, 21, 16, 21, 16, 17, 14, 17, 14, 21, 16, 21, 16, +21, 16, 21, 16, 21, 16, 16, 12, 16, 12, 16, 12, 15, 13, 6, 5, 19, 13, 17, 14, 17, 14, 17, 14, 17, +14, 17, 14, 0, 0, 0, 0, 13, 9, 22, 16, 14, 11, 14, 11, 17, 13, 13, 12, 13, 12, 16, 12, 16, 13, +16, 14, 18, 13, 19, 13, 17, 6, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 5, 5, 8, 8, 5, 5, 5, +0, 5, 6, 5, 6, 5, 6, 5, 6, 10, 10, 10, 10, 15, 14, 17, 17, 6, 6, 17, 17, 6, 6, 17, 17, +6, 6, 17, 17, 6, 6, 17, 17, 6, 6, 17, 17, 6, 6, 17, 17, 6, 6, 14, 13, 13, 13, 14, 13, 13, +13, 14, 13, 13, 13, 14, 13, 13, 13, 14, 13, 13, 13, 14, 13, 13, 13, 8, 8, 8, 8, 8, 8, 8, 8, +8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 20, 20, 13, 13, 20, 20, 13, 13, 20, 20, 13, 13, 26, 26, 20, 20, 26, 26, 20, 20, 14, 14, 13, 11, +13, 9, 19, 19, 19, 6, 6, 19, 19, 6, 6, 19, 19, 6, 6, 19, 19, 6, 6, 19, 19, 6, 6, 14, 14, +14, 14, 19, 22, 9, 12, 19, 22, 9, 12, 14, 14, 9, 9, 14, 14, 9, 9, 14, 14, 9, 9, 19, 22, 9, +12, 19, 22, 9, 12, 19, 22, 9, 12, 19, 22, 9, 12, 19, 22, 9, 12, 12, 12, 5, 5, 12, 12, 5, 5, +12, 12, 5, 5, 12, 12, 5, 5, 13, 13, 6, 6, 13, 13, 13, 13, 13, 13, 6, 6, 13, 13, 14, 13, 13, +13, 7, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15, 14, 15, +14, 6, 6, 10, 10, 15, 14, 6, 6, 15, 14, 19, 19, 19, 19, 5, 0, 0, 0, 0, 0, 0, 0, 27, 26, +0, 0, 0, 0, 0, 0, 5, 9, 0, 0, 14, 0, 0, 0, 20, 20, 13, 13, 26, 26, 20, 20, 13, 11, 13, +9, 10, 8, 7, 6, 8, 6, 6, 6, 6, 6, 19, 22, 6, 0, 8, 12, 13, 14, 13, 14, 13, 14, 13, 14, +13, 14, 13, 14, 13, 14, 13, 13, 13, 14, 27, 54, 20, 0, 8, 8, 8, 10, 15, 15, 24, 18, 5, 9, 9, +11, 16, 8, 9, 8, 8, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 8, 8, 16, 16, 16, 15, 27, 18, 18, +20, 20, 18, 17, 21, 19, 8, 13, 18, 15, 23, 19, 21, 17, 21, 20, 18, 16, 19, 17, 28, 17, 18, 17, 8, +8, 8, 12, 15, 9, 15, 15, 14, 15, 15, 7, 15, 15, 6, 6, 14, 6, 22, 15, 15, 15, 15, 9, 14, 8, +15, 13, 19, 12, 14, 13, 9, 6, 9, 16, 18, 18, 20, 18, 19, 21, 19, 15, 15, 15, 15, 15, 15, 14, 15, +15, 15, 15, 6, 6, 6, 6, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 11, 15, 15, 15, 9, 15, 17, +20, 20, 27, 9, 9, 15, 27, 21, 19, 15, 15, 15, 15, 16, 13, 19, 22, 15, 7, 10, 10, 21, 24, 17, 17, +8, 16, 15, 15, 15, 17, 15, 15, 27, 18, 18, 21, 27, 25, 15, 27, 9, 9, 6, 6, 15, 13, 14, 18, 5, +15, 9, 9, 14, 14, 15, 8, 6, 9, 29, 18, 18, 18, 18, 18, 8, 8, 8, 8, 21, 21, 21, 19, 19, 19, +6, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 15, 6, 18, 14, 17, 13, 6, 20, 15, 18, 14, 18, 15, 16, +16, 9, 9, 9, 23, 23, 23, 15, 21, 15, 8, 18, 14, 20, 14, 20, 14, 15, 15, 9, 18, 15, 18, 15, 20, +17, 20, 18, 15, 18, 15, 15, 6, 15, 8, 15, 9, 19, 15, 19, 15, 21, 15, 20, 9, 20, 9, 18, 14, 16, +7, 16, 10, 19, 15, 19, 15, 17, 13, 17, 13, 15, 21, 22, 16, 15, 12, 17, 11, 18, 15, 14, 10, 29, 27, +14, 27, 14, 27, 14, 14, 26, 19, 16, 16, 16, 16, 16, 19, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 16, 27, 27, 27, 27, 27, 16, 16, 16, 28, 28, 25, 20, 20, +14, 18, 16, 14, 14, 20, 20, 12, 16, 5, 10, 24, 9, 16, 10, 10, 16, 10, 18, 15, 20, 14, 20, 14, 18, +15, 18, 15, 18, 15, 21, 15, 21, 15, 21, 15, 19, 15, 19, 15, 8, 6, 8, 6, 8, 6, 8, 6, 13, 6, +18, 14, 14, 15, 6, 19, 15, 20, 15, 21, 15, 21, 15, 20, 9, 18, 14, 17, 8, 19, 15, 19, 15, 19, 15, +20, 15, 28, 19, 18, 14, 6, 18, 15, 27, 24, 21, 17, 6, 28, 19, 28, 19, 28, 19, 18, 14, 6, 9, 15, +16, 23, 23, 23, 23, 9, 9, 9, 9, 18, 21, 23, 10, 21, 22, 20, 6, 18, 18, 18, 18, 17, 19, 8, 18, +18, 23, 19, 18, 21, 19, 17, 17, 16, 18, 17, 22, 20, 8, 18, 16, 12, 15, 6, 15, 16, 14, 12, 15, 15, +6, 14, 14, 16, 13, 12, 15, 15, 13, 15, 14, 18, 21, 6, 15, 15, 15, 21, 18, 23, 15, 19, 18, 8, 8, +13, 29, 27, 23, 16, 17, 19, 18, 18, 18, 15, 18, 18, 25, 16, 19, 19, 16, 18, 23, 19, 21, 18, 17, 20, +16, 17, 20, 17, 20, 17, 25, 25, 21, 24, 18, 19, 27, 20, 15, 15, 14, 10, 16, 15, 18, 12, 15, 15, 12, +16, 19, 15, 15, 15, 15, 14, 12, 14, 22, 12, 15, 14, 22, 22, 17, 19, 14, 14, 20, 15, 15, 15, 10, 14, +14, 6, 6, 6, 24, 22, 15, 12, 14, 15, 13, 11, 27, 29, 19, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 10, 9, 6, 9, 9, 8, 15, 15, 11, 14, 16, 6, 10, 16, 16, 6, 14, 12, 13, 16, 16, 6, +10, 16, 14, 15, 15, 12, 13, 15, 14, 19, 17, 12, 12, 12, 6, 11, 21, 6, 14, 14, 13, 13, 14, 19, 19, +19, 19, 15, 15, 15, 15, 11, 14, 16, 8, 11, 16, 8, 14, 12, 13, 16, 10, 16, 15, 15, 13, 15, 14, 19, +17, 6, 15, 12, 15, 16, 0, 0, 0, 0, 9, 9, 10, 11, 6, 5, 6, 5, 5, 6, 5, 6, 4, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 9, 14, 20, 20, 8, 20, 14, 14, 14, 20, 20, 20, 20, 20, 6, 20, +20, 20, 20, 20, 20, 20, 20, 17, 20, 20, 20, 19, 19, 7, 7, 20, 20, 20, 20, 15, 14, 14, 14, 13, 13, +22, 25, 11, 14, 22, 25, 11, 14, 17, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +20, 6, 6, 6, 6, 6, 20, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, +27, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +20, 20, 20, 20, 9, 9, 20, 17, 11, 6, 6, 6, 6, 12, 12, 6, 6, 17, 16, 7, 7, 6, 6, 19, 19, +7, 7, 8, 10, 19, 19, 7, 7, 19, 19, 7, 7, 15, 14, 14, 14, 15, 14, 14, 14, 15, 14, 14, 14, 9, +9, 9, 9, 13, 13, 13, 13, 22, 22, 14, 14, 22, 22, 14, 14, 30, 30, 23, 23, 30, 30, 23, 23, 16, 16, +16, 16, 16, 16, 16, 16, 15, 12, 14, 11, 15, 12, 14, 11, 21, 21, 7, 7, 16, 16, 7, 7, 16, 16, 11, +11, 14, 14, 6, 6, 9, 9, 11, 11, 14, 14, 7, 7, 8, 10, 12, 11, 12, 12, 17, 16, 17, 16, 7, 7, +15, 16, 15, 16, 15, 16, 15, 16, 20, 20, 5, 5, 20, 20, 20, 4, 6, 20, 20, 6, 6, 20, 20, 20, 6, +6, 6, 6, 6, 6, 20, 5, 5, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 9, 9, 9, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 3, 27, 54, 23, 18, 23, 18, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, +18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, +15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 18, 15, 8, 6, 8, 6, 21, 15, 21, 15, 21, 15, +21, 15, 21, 15, 21, 15, 21, 15, 23, 18, 23, 18, 23, 18, 23, 18, 23, 18, 19, 15, 19, 15, 23, 18, 23, +18, 23, 18, 23, 18, 23, 18, 18, 14, 18, 14, 18, 14, 18, 15, 8, 6, 21, 15, 19, 15, 19, 15, 19, 15, +19, 15, 19, 15, 0, 0, 0, 0, 15, 10, 25, 18, 16, 12, 16, 12, 20, 15, 15, 14, 15, 14, 18, 14, 18, +14, 18, 15, 20, 15, 21, 15, 19, 7, 7, 7, 16, 7, 7, 7, 7, 7, 7, 7, 6, 6, 9, 9, 6, 6, +6, 0, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 17, 16, 19, 19, 7, 7, 19, 19, 7, 7, 19, +19, 7, 7, 19, 19, 7, 7, 19, 19, 7, 7, 19, 19, 7, 7, 19, 19, 7, 7, 15, 14, 14, 14, 15, 14, +14, 14, 15, 14, 14, 14, 15, 14, 14, 14, 15, 14, 14, 14, 15, 14, 14, 14, 9, 9, 9, 9, 9, 9, 9, +9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 22, 22, 14, 14, 22, 22, 14, 14, 22, 22, 14, 14, 30, 30, 23, 23, 30, 30, 23, 23, 16, 16, 15, +12, 14, 11, 21, 21, 21, 7, 7, 21, 21, 7, 7, 21, 21, 7, 7, 21, 21, 7, 7, 21, 21, 7, 7, 16, +16, 16, 16, 22, 25, 11, 14, 22, 25, 11, 14, 16, 16, 11, 11, 16, 16, 11, 11, 16, 16, 11, 11, 22, 25, +11, 14, 22, 25, 11, 14, 22, 25, 11, 14, 22, 25, 11, 14, 22, 25, 11, 14, 14, 14, 6, 6, 14, 14, 6, +6, 14, 14, 6, 6, 14, 14, 6, 6, 14, 14, 7, 7, 14, 14, 14, 14, 14, 14, 7, 7, 14, 14, 15, 14, +14, 14, 8, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 17, 16, +17, 16, 7, 7, 12, 12, 17, 16, 7, 7, 17, 16, 22, 22, 22, 22, 6, 0, 0, 0, 0, 0, 0, 0, 30, +29, 0, 0, 0, 0, 0, 0, 5, 10, 0, 0, 16, 0, 0, 0, 22, 22, 14, 14, 30, 30, 23, 23, 15, 12, +14, 11, 11, 9, 8, 7, 9, 7, 7, 7, 7, 7, 22, 25, 6, 0, 9, 12, 15, 16, 15, 16, 15, 16, 15, +16, 15, 16, 15, 16, 15, 16, 14, 14, 15, 16, 29, 58, 22, 0, 8, 8, 9, 10, 16, 16, 26, 19, 6, 10, +10, 11, 17, 8, 10, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 17, 17, 17, 16, 29, 19, +19, 21, 21, 19, 18, 23, 21, 7, 15, 19, 16, 23, 21, 23, 19, 23, 21, 19, 19, 21, 19, 30, 19, 19, 18, +8, 8, 8, 14, 16, 10, 16, 16, 15, 16, 16, 8, 16, 16, 7, 7, 14, 7, 25, 16, 16, 16, 16, 10, 15, +8, 16, 13, 21, 13, 13, 14, 10, 8, 10, 17, 19, 19, 21, 19, 21, 23, 21, 16, 16, 16, 16, 16, 16, 15, +16, 16, 16, 16, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 10, 16, +18, 21, 21, 29, 10, 10, 16, 29, 23, 21, 16, 16, 16, 16, 17, 14, 21, 24, 16, 7, 11, 11, 22, 26, 18, +18, 9, 17, 16, 16, 16, 18, 16, 16, 29, 19, 19, 23, 29, 27, 16, 29, 10, 10, 6, 6, 16, 14, 13, 19, +5, 16, 10, 10, 15, 15, 16, 8, 6, 10, 29, 19, 19, 19, 19, 19, 7, 7, 7, 7, 23, 23, 23, 21, 21, +21, 9, 10, 9, 10, 10, 10, 10, 10, 10, 10, 10, 16, 6, 19, 15, 18, 14, 8, 21, 16, 19, 13, 19, 16, +17, 17, 10, 10, 10, 24, 24, 24, 16, 23, 16, 7, 19, 15, 21, 15, 21, 15, 16, 16, 10, 19, 16, 19, 16, +21, 18, 21, 19, 16, 19, 16, 16, 7, 16, 9, 16, 10, 21, 16, 21, 16, 23, 16, 21, 10, 21, 10, 19, 15, +19, 8, 19, 11, 21, 16, 21, 16, 18, 14, 18, 14, 16, 23, 22, 17, 16, 13, 18, 12, 18, 16, 15, 11, 31, +29, 15, 29, 15, 29, 15, 15, 28, 21, 17, 18, 17, 18, 18, 21, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 29, 29, 29, 29, 29, 18, 18, 18, 30, 31, 27, 22, +22, 15, 19, 17, 15, 15, 22, 21, 13, 18, 5, 10, 26, 9, 18, 10, 10, 18, 10, 19, 16, 21, 15, 21, 15, +19, 16, 19, 16, 19, 16, 23, 16, 23, 16, 23, 16, 21, 16, 21, 16, 7, 9, 7, 9, 7, 9, 7, 7, 15, +7, 19, 14, 15, 16, 7, 21, 16, 21, 16, 23, 16, 23, 16, 21, 10, 19, 15, 18, 8, 21, 16, 21, 16, 21, +16, 21, 16, 30, 21, 19, 13, 7, 19, 16, 29, 26, 23, 18, 8, 30, 21, 30, 21, 30, 21, 19, 13, 6, 10, +16, 17, 24, 24, 24, 24, 10, 10, 10, 10, 19, 23, 24, 11, 22, 24, 22, 7, 19, 19, 19, 19, 18, 21, 7, +19, 19, 23, 21, 19, 23, 21, 19, 18, 19, 19, 19, 23, 22, 7, 19, 17, 13, 16, 7, 16, 17, 14, 13, 16, +16, 7, 15, 15, 17, 13, 13, 16, 17, 14, 16, 15, 21, 23, 7, 16, 16, 16, 23, 19, 25, 16, 21, 19, 7, +7, 15, 31, 29, 25, 17, 18, 21, 19, 19, 19, 16, 20, 19, 27, 18, 21, 21, 17, 19, 23, 21, 23, 21, 19, +21, 19, 18, 22, 19, 21, 19, 27, 27, 23, 26, 19, 21, 29, 21, 16, 17, 15, 11, 17, 16, 20, 13, 16, 16, +13, 17, 20, 16, 16, 16, 16, 15, 13, 13, 24, 13, 17, 15, 23, 24, 18, 21, 15, 15, 22, 16, 16, 16, 11, +15, 15, 7, 9, 7, 26, 24, 16, 13, 13, 16, 14, 12, 29, 31, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 11, 10, 7, 10, 10, 8, 16, 16, 12, 15, 17, 7, 11, 17, 17, 7, 15, 13, 13, 17, 17, +7, 10, 17, 15, 16, 16, 13, 14, 16, 15, 20, 19, 14, 14, 14, 7, 12, 25, 7, 15, 15, 13, 13, 16, 20, +20, 20, 20, 16, 16, 16, 16, 12, 15, 17, 8, 12, 17, 8, 15, 13, 13, 17, 10, 17, 16, 16, 14, 16, 15, +20, 19, 7, 16, 13, 16, 17, 0, 0, 0, 0, 9, 9, 10, 12, 6, 6, 7, 6, 6, 6, 6, 6, 5, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 9, 15, 22, 22, 8, 22, 15, 15, 15, 22, 22, 22, 22, 22, 6, +22, 22, 22, 22, 22, 22, 22, 22, 19, 22, 22, 22, 21, 21, 7, 7, 22, 22, 22, 22, 16, 15, 15, 15, 14, +14, 24, 27, 11, 15, 24, 27, 11, 15, 19, 17, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 7, 6, 6, 6, 6, 22, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +16, 29, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 22, 22, 22, 9, 9, 22, 18, 12, 6, 7, 6, 7, 13, 13, 6, 7, 19, 17, 7, 7, 6, 7, 21, +21, 7, 7, 8, 11, 21, 21, 7, 7, 21, 21, 7, 7, 16, 15, 15, 15, 16, 15, 15, 15, 16, 15, 15, 15, +10, 10, 10, 10, 14, 14, 14, 14, 24, 24, 15, 15, 24, 24, 15, 15, 32, 32, 25, 25, 32, 32, 25, 25, 17, +17, 17, 17, 17, 17, 17, 17, 16, 13, 15, 11, 16, 13, 15, 11, 23, 23, 8, 8, 17, 17, 8, 8, 17, 17, +11, 11, 15, 15, 6, 6, 10, 10, 11, 11, 15, 15, 7, 7, 8, 11, 13, 11, 13, 13, 19, 17, 19, 17, 7, +7, 16, 17, 16, 17, 16, 17, 16, 17, 22, 22, 6, 6, 22, 22, 22, 5, 6, 22, 22, 6, 7, 22, 22, 22, +6, 6, 6, 6, 6, 7, 22, 6, 6, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 9, 9, 9, 22, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 4, 29, 58, 25, 19, 25, 19, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +7, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, +19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 19, 16, 7, 7, 7, 7, 23, 16, 23, 16, 23, +16, 23, 16, 23, 16, 23, 16, 23, 16, 25, 19, 25, 19, 25, 19, 25, 19, 25, 19, 21, 16, 21, 16, 25, 19, +25, 19, 25, 19, 25, 19, 25, 19, 19, 13, 19, 13, 19, 13, 19, 16, 7, 7, 23, 16, 21, 16, 21, 16, 21, +16, 21, 16, 21, 16, 0, 0, 0, 0, 16, 11, 27, 19, 17, 13, 17, 13, 21, 16, 16, 15, 16, 15, 19, 15, +19, 15, 19, 16, 22, 16, 23, 16, 21, 7, 8, 8, 17, 7, 7, 7, 7, 7, 7, 8, 6, 6, 10, 10, 6, +6, 6, 0, 6, 7, 6, 7, 6, 7, 6, 7, 13, 13, 13, 13, 19, 17, 21, 21, 7, 7, 21, 21, 7, 7, +21, 21, 7, 7, 21, 21, 7, 7, 21, 21, 7, 7, 21, 21, 7, 7, 21, 21, 7, 7, 16, 15, 15, 15, 16, +15, 15, 15, 16, 15, 15, 15, 16, 15, 15, 15, 16, 15, 15, 15, 16, 15, 15, 15, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 24, 24, 15, 15, 24, 24, 15, 15, 24, 24, 15, 15, 32, 32, 25, 25, 32, 32, 25, 25, 17, 17, +16, 13, 15, 11, 23, 23, 23, 8, 8, 23, 23, 8, 8, 23, 23, 8, 8, 23, 23, 8, 8, 23, 23, 8, 8, +17, 17, 17, 17, 24, 27, 11, 15, 24, 27, 11, 15, 17, 17, 11, 11, 17, 17, 11, 11, 17, 17, 11, 11, 24, +27, 11, 15, 24, 27, 11, 15, 24, 27, 11, 15, 24, 27, 11, 15, 24, 27, 11, 15, 15, 15, 6, 6, 15, 15, +6, 6, 15, 15, 6, 6, 15, 15, 6, 6, 15, 15, 7, 7, 15, 15, 15, 15, 15, 15, 7, 7, 15, 15, 16, +15, 15, 15, 8, 11, 11, 11, 11, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 19, +17, 19, 17, 7, 7, 13, 13, 19, 17, 7, 7, 19, 17, 24, 24, 24, 24, 6, 0, 0, 0, 0, 0, 0, 0, +33, 31, 0, 0, 0, 0, 0, 0, 6, 11, 0, 0, 17, 0, 0, 0, 24, 24, 15, 15, 32, 32, 25, 25, 16, +13, 15, 11, 12, 10, 8, 7, 9, 7, 7, 7, 7, 7, 24, 27, 7, 0, 10, 14, 16, 17, 16, 17, 16, 17, +16, 17, 16, 17, 16, 17, 16, 17, 15, 15, 16, 17, 32, 64, 24, 0, 9, 9, 11, 11, 18, 18, 28, 21, 6, +11, 11, 12, 19, 9, 11, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 9, 9, 19, 19, 19, 18, 32, +21, 21, 23, 23, 21, 20, 25, 23, 9, 16, 21, 18, 27, 23, 25, 21, 25, 23, 21, 19, 23, 21, 32, 21, 21, +20, 9, 9, 9, 14, 18, 11, 17, 17, 16, 17, 17, 10, 17, 18, 7, 7, 16, 7, 27, 18, 17, 17, 17, 11, +16, 9, 18, 15, 23, 14, 15, 15, 11, 8, 11, 19, 21, 21, 23, 21, 23, 25, 23, 17, 17, 17, 17, 17, 17, +16, 17, 17, 17, 17, 9, 9, 9, 9, 18, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 13, 18, 18, 18, 11, +17, 20, 24, 24, 32, 11, 11, 18, 32, 25, 23, 18, 18, 18, 18, 18, 16, 23, 26, 18, 7, 12, 12, 25, 28, +20, 20, 11, 19, 17, 18, 18, 20, 18, 18, 32, 21, 21, 25, 32, 30, 18, 32, 11, 11, 7, 7, 18, 16, 15, +21, 5, 18, 11, 11, 16, 16, 18, 9, 7, 11, 32, 21, 21, 21, 21, 21, 9, 9, 9, 9, 25, 25, 25, 23, +23, 23, 9, 11, 9, 11, 11, 11, 11, 11, 11, 11, 11, 18, 7, 21, 16, 20, 15, 8, 23, 18, 21, 15, 21, +18, 19, 19, 11, 11, 11, 27, 27, 27, 18, 25, 17, 9, 21, 16, 23, 16, 23, 16, 18, 18, 11, 21, 17, 21, +17, 23, 20, 23, 21, 17, 21, 17, 18, 7, 18, 9, 18, 11, 23, 18, 23, 18, 25, 17, 23, 11, 23, 11, 21, +16, 19, 9, 19, 12, 23, 18, 23, 18, 20, 15, 20, 15, 18, 25, 26, 19, 18, 14, 20, 13, 21, 18, 16, 12, +35, 32, 16, 32, 16, 32, 16, 16, 31, 23, 19, 19, 19, 19, 19, 23, 20, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 32, 32, 32, 32, 32, 19, 19, 19, 33, 34, 29, +24, 24, 17, 21, 19, 16, 16, 24, 24, 14, 19, 6, 11, 28, 10, 19, 11, 11, 19, 11, 21, 17, 23, 16, 23, +16, 21, 17, 21, 17, 21, 17, 25, 17, 25, 17, 25, 18, 23, 18, 23, 18, 9, 9, 9, 9, 9, 9, 9, 7, +16, 7, 21, 16, 16, 18, 7, 23, 18, 23, 18, 25, 17, 25, 17, 23, 11, 21, 16, 20, 9, 23, 18, 23, 18, +23, 18, 23, 18, 32, 23, 21, 15, 7, 21, 17, 32, 28, 25, 20, 9, 32, 23, 32, 23, 32, 23, 21, 15, 7, +11, 18, 19, 27, 27, 27, 27, 11, 11, 11, 11, 21, 25, 27, 12, 25, 26, 24, 7, 21, 21, 21, 21, 20, 23, +9, 21, 21, 27, 23, 21, 25, 23, 21, 20, 19, 21, 21, 27, 24, 9, 21, 19, 14, 18, 7, 18, 18, 16, 14, +18, 17, 7, 16, 16, 18, 15, 14, 17, 17, 14, 18, 17, 23, 24, 7, 18, 17, 18, 24, 21, 28, 17, 23, 21, +9, 9, 16, 34, 32, 27, 19, 20, 23, 21, 20, 21, 17, 22, 21, 30, 19, 23, 23, 19, 21, 27, 23, 25, 23, +21, 23, 19, 20, 24, 21, 24, 21, 29, 30, 25, 28, 21, 23, 32, 23, 17, 17, 16, 12, 19, 17, 22, 15, 18, +18, 14, 19, 22, 18, 17, 17, 17, 16, 15, 15, 25, 14, 18, 17, 26, 26, 19, 23, 17, 16, 24, 17, 17, 18, +12, 16, 16, 7, 9, 7, 28, 25, 18, 14, 15, 18, 16, 13, 32, 34, 22, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 12, 11, 7, 11, 11, 9, 18, 17, 13, 16, 19, 7, 12, 19, 19, 7, 16, 15, 15, 19, +19, 7, 11, 18, 17, 18, 17, 15, 15, 18, 16, 22, 21, 15, 15, 15, 8, 13, 28, 7, 16, 16, 15, 15, 17, +22, 22, 22, 22, 18, 18, 18, 17, 13, 16, 19, 9, 13, 19, 9, 16, 15, 15, 19, 11, 18, 18, 17, 15, 18, +16, 22, 21, 7, 17, 15, 17, 18, 0, 0, 0, 0, 10, 10, 11, 13, 7, 6, 8, 6, 6, 7, 6, 7, 5, +17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 10, 17, 24, 24, 9, 24, 17, 17, 17, 24, 24, 24, 24, 24, +7, 24, 24, 24, 24, 24, 24, 24, 24, 20, 24, 24, 24, 23, 23, 8, 8, 24, 24, 24, 24, 18, 17, 17, 17, +16, 16, 26, 30, 13, 16, 26, 30, 13, 16, 20, 19, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 7, 7, 7, 7, 7, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 18, 32, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 10, 10, 24, 20, 13, 7, 7, 7, 7, 14, 14, 7, 7, 20, 19, 8, 8, 7, 7, +23, 23, 8, 8, 9, 12, 23, 23, 8, 8, 23, 23, 8, 8, 18, 17, 17, 17, 18, 17, 17, 17, 18, 17, 17, +17, 11, 11, 11, 11, 16, 16, 16, 16, 26, 26, 17, 17, 26, 26, 17, 17, 35, 35, 27, 27, 35, 35, 27, 27, +19, 19, 19, 19, 19, 19, 19, 19, 17, 14, 17, 13, 17, 14, 17, 13, 25, 25, 9, 8, 19, 19, 9, 8, 19, +19, 13, 13, 16, 16, 7, 7, 11, 11, 13, 13, 17, 17, 8, 8, 9, 12, 14, 13, 14, 14, 20, 19, 20, 19, +8, 8, 17, 19, 17, 19, 17, 19, 17, 19, 24, 24, 6, 6, 24, 24, 24, 5, 7, 24, 24, 7, 8, 24, 24, +24, 7, 7, 7, 7, 7, 7, 24, 6, 6, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 10, 10, 10, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4, 32, 64, 27, 21, 27, 21, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 7, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, +17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 21, 17, 9, 7, 9, 7, 25, 17, 25, 17, +25, 17, 25, 17, 25, 17, 25, 17, 25, 17, 27, 21, 27, 21, 27, 21, 27, 21, 27, 21, 23, 18, 23, 18, 27, +21, 27, 21, 27, 21, 27, 21, 27, 21, 21, 15, 21, 15, 21, 15, 21, 17, 9, 7, 25, 17, 23, 18, 23, 18, +23, 18, 23, 18, 23, 18, 0, 0, 0, 0, 17, 12, 30, 21, 19, 14, 19, 14, 23, 18, 18, 16, 18, 16, 21, +16, 21, 17, 21, 18, 24, 18, 25, 18, 23, 8, 9, 8, 19, 8, 8, 8, 8, 8, 8, 9, 7, 7, 11, 11, +7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 20, 19, 23, 23, 8, 8, 23, 23, 8, +8, 23, 23, 8, 8, 23, 23, 8, 8, 23, 23, 8, 8, 23, 23, 8, 8, 23, 23, 8, 8, 18, 17, 17, 17, +18, 17, 17, 17, 18, 17, 17, 17, 18, 17, 17, 17, 18, 17, 17, 17, 18, 17, 17, 17, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 16, 16, 26, 26, 17, 17, 26, 26, 17, 17, 26, 26, 17, 17, 35, 35, 27, 27, 35, 35, 27, 27, 19, +19, 17, 14, 17, 13, 25, 25, 25, 9, 8, 25, 25, 9, 8, 25, 25, 9, 8, 25, 25, 9, 8, 25, 25, 9, +8, 19, 19, 19, 19, 26, 30, 13, 16, 26, 30, 13, 16, 19, 19, 13, 13, 19, 19, 13, 13, 19, 19, 13, 13, +26, 30, 13, 16, 26, 30, 13, 16, 26, 30, 13, 16, 26, 30, 13, 16, 26, 30, 13, 16, 16, 16, 7, 7, 16, +16, 7, 7, 16, 16, 7, 7, 16, 16, 7, 7, 17, 17, 8, 8, 17, 17, 17, 17, 17, 17, 8, 8, 17, 17, +18, 17, 17, 17, 9, 12, 12, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +20, 19, 20, 19, 8, 8, 14, 14, 20, 19, 8, 8, 20, 19, 26, 26, 26, 26, 7, 0, 0, 0, 0, 0, 0, +0, 36, 35, 0, 0, 0, 0, 0, 0, 6, 12, 0, 0, 19, 0, 0, 0, 26, 26, 17, 17, 35, 35, 27, 27, +17, 14, 17, 13, 13, 11, 9, 8, 10, 8, 8, 8, 8, 8, 26, 30, 7, 0, 11, 15, 17, 19, 17, 19, 17, +19, 17, 19, 17, 19, 17, 19, 17, 19, 17, 17, 17, 19, 33, 66, 25, 0, 9, 9, 11, 12, 18, 18, 29, 22, +6, 11, 11, 13, 19, 9, 11, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 9, 9, 19, 19, 19, 18, +34, 22, 22, 24, 24, 22, 20, 26, 24, 9, 17, 22, 18, 27, 24, 26, 22, 26, 24, 22, 21, 24, 22, 34, 21, +21, 20, 9, 9, 9, 14, 18, 11, 17, 18, 17, 18, 17, 10, 18, 18, 7, 7, 16, 7, 27, 18, 17, 18, 18, +11, 17, 9, 18, 15, 23, 15, 15, 16, 11, 8, 11, 19, 22, 22, 24, 22, 24, 26, 24, 17, 17, 17, 17, 17, +17, 17, 17, 17, 17, 17, 9, 9, 9, 9, 18, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 13, 18, 18, 18, +12, 18, 20, 24, 24, 33, 11, 11, 18, 33, 26, 24, 18, 18, 18, 18, 19, 16, 24, 27, 18, 7, 12, 12, 25, +29, 20, 20, 11, 19, 19, 18, 18, 20, 18, 18, 33, 22, 22, 26, 33, 31, 18, 33, 11, 11, 7, 7, 18, 16, +15, 21, 6, 18, 11, 11, 17, 17, 18, 9, 7, 11, 32, 22, 22, 22, 22, 22, 9, 9, 9, 9, 26, 26, 26, +24, 24, 24, 9, 11, 9, 11, 11, 11, 11, 11, 11, 11, 11, 18, 7, 22, 17, 20, 16, 8, 24, 18, 21, 15, +22, 18, 19, 19, 11, 11, 11, 28, 28, 28, 18, 26, 18, 9, 22, 17, 24, 17, 24, 17, 18, 18, 11, 22, 17, +22, 17, 24, 20, 24, 22, 17, 22, 17, 18, 7, 18, 10, 18, 11, 24, 18, 24, 18, 26, 17, 24, 11, 24, 11, +22, 17, 21, 9, 21, 12, 24, 18, 24, 18, 20, 16, 20, 16, 18, 26, 26, 19, 18, 14, 20, 13, 21, 18, 17, +12, 36, 33, 17, 33, 17, 33, 17, 17, 32, 24, 19, 20, 19, 20, 20, 23, 21, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 20, 33, 33, 33, 33, 33, 20, 20, 20, 34, 35, +30, 25, 25, 18, 22, 20, 17, 17, 25, 24, 15, 20, 6, 12, 29, 11, 20, 12, 12, 20, 12, 22, 17, 24, 17, +24, 17, 22, 17, 22, 17, 22, 17, 26, 18, 26, 18, 26, 18, 24, 18, 24, 18, 9, 9, 9, 9, 9, 9, 9, +7, 17, 7, 22, 16, 17, 18, 7, 24, 18, 24, 18, 26, 17, 26, 17, 24, 11, 22, 17, 20, 9, 24, 18, 24, +18, 24, 18, 24, 18, 34, 23, 21, 15, 7, 22, 17, 33, 29, 26, 20, 9, 34, 23, 34, 23, 34, 23, 21, 15, +7, 11, 18, 20, 28, 28, 28, 28, 11, 11, 11, 11, 22, 26, 28, 13, 26, 27, 25, 7, 22, 22, 22, 22, 20, +24, 9, 22, 22, 27, 24, 21, 26, 24, 22, 20, 21, 21, 21, 27, 25, 9, 21, 19, 14, 18, 7, 18, 19, 17, +15, 18, 17, 7, 17, 17, 19, 15, 15, 17, 18, 15, 18, 17, 23, 25, 7, 18, 17, 18, 25, 22, 29, 18, 24, +22, 9, 9, 17, 35, 33, 28, 19, 21, 24, 22, 21, 22, 18, 22, 22, 30, 20, 24, 24, 19, 22, 27, 24, 26, +24, 22, 24, 21, 21, 25, 21, 24, 22, 30, 31, 26, 29, 22, 24, 33, 24, 17, 18, 17, 12, 19, 17, 21, 15, +18, 18, 14, 19, 23, 18, 17, 18, 18, 17, 15, 15, 26, 15, 19, 17, 26, 27, 20, 24, 18, 17, 25, 18, 17, +18, 12, 17, 17, 7, 9, 7, 29, 26, 18, 14, 15, 18, 16, 14, 33, 35, 23, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 13, 11, 7, 11, 11, 9, 19, 18, 13, 17, 20, 7, 13, 20, 19, 7, 17, 15, 15, +20, 20, 7, 12, 19, 17, 19, 18, 15, 16, 18, 17, 23, 21, 15, 15, 15, 8, 14, 28, 7, 17, 17, 15, 15, +18, 23, 23, 23, 23, 19, 19, 19, 18, 13, 17, 20, 9, 14, 19, 9, 17, 15, 15, 20, 12, 19, 19, 18, 16, +18, 17, 23, 21, 7, 18, 15, 18, 19, 0, 0, 0, 0, 11, 11, 12, 14, 7, 7, 8, 7, 7, 7, 7, 7, +5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 11, 17, 25, 25, 9, 25, 17, 17, 17, 25, 25, 25, 25, +25, 7, 25, 25, 25, 25, 25, 25, 25, 25, 21, 25, 25, 25, 24, 24, 8, 8, 25, 25, 25, 25, 19, 17, 17, +17, 16, 16, 27, 31, 13, 17, 27, 31, 13, 17, 21, 19, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 7, 7, 7, 7, 7, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 18, 33, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 11, 11, 25, 20, 14, 7, 8, 7, 8, 14, 14, 7, 8, 21, 19, 8, 8, 7, +8, 24, 24, 8, 8, 9, 12, 24, 24, 8, 8, 24, 24, 8, 8, 19, 17, 17, 17, 19, 17, 17, 17, 19, 17, +17, 17, 11, 11, 11, 11, 16, 16, 16, 16, 27, 27, 18, 18, 27, 27, 18, 18, 36, 36, 28, 28, 36, 36, 28, +28, 19, 19, 19, 19, 19, 19, 19, 19, 18, 15, 17, 13, 18, 15, 17, 13, 26, 26, 9, 9, 19, 19, 9, 9, +20, 20, 13, 13, 17, 17, 7, 7, 11, 11, 13, 13, 17, 17, 8, 8, 9, 12, 15, 13, 14, 14, 21, 19, 21, +19, 8, 8, 18, 20, 18, 20, 18, 20, 18, 20, 25, 25, 7, 7, 25, 25, 25, 5, 7, 25, 25, 7, 8, 25, +25, 25, 7, 7, 7, 7, 7, 7, 25, 7, 7, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 11, 11, 11, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 4, 33, 66, 28, 22, 28, 22, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 28, 28, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 7, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, +22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 22, 17, 9, 7, 9, 7, 26, 17, 26, +17, 26, 17, 26, 17, 26, 17, 26, 17, 26, 17, 28, 22, 28, 22, 28, 22, 28, 22, 28, 22, 24, 18, 24, 18, +28, 22, 28, 22, 28, 22, 28, 22, 28, 22, 21, 15, 21, 15, 21, 15, 22, 17, 9, 7, 26, 17, 24, 18, 24, +18, 24, 18, 24, 18, 24, 18, 0, 0, 0, 0, 18, 12, 30, 22, 19, 14, 19, 14, 24, 18, 18, 17, 18, 17, +22, 17, 22, 17, 22, 18, 25, 18, 26, 18, 24, 8, 9, 9, 19, 8, 8, 8, 8, 8, 8, 9, 7, 7, 11, +11, 7, 7, 7, 0, 7, 8, 7, 8, 7, 8, 7, 8, 14, 14, 14, 14, 21, 19, 24, 24, 8, 8, 24, 24, +8, 8, 24, 24, 8, 8, 24, 24, 8, 8, 24, 24, 8, 8, 24, 24, 8, 8, 24, 24, 8, 8, 19, 17, 17, +17, 19, 17, 17, 17, 19, 17, 17, 17, 19, 17, 17, 17, 19, 17, 17, 17, 19, 17, 17, 17, 11, 11, 11, 11, +11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 16, 16, 16, 27, 27, 18, 18, 27, 27, 18, 18, 27, 27, 18, 18, 36, 36, 28, 28, 36, 36, 28, 28, +19, 19, 18, 15, 17, 13, 26, 26, 26, 9, 9, 26, 26, 9, 9, 26, 26, 9, 9, 26, 26, 9, 9, 26, 26, +9, 9, 19, 19, 19, 19, 27, 31, 13, 17, 27, 31, 13, 17, 20, 20, 13, 13, 20, 20, 13, 13, 20, 20, 13, +13, 27, 31, 13, 17, 27, 31, 13, 17, 27, 31, 13, 17, 27, 31, 13, 17, 27, 31, 13, 17, 17, 17, 7, 7, +17, 17, 7, 7, 17, 17, 7, 7, 17, 17, 7, 7, 17, 17, 8, 8, 17, 17, 17, 17, 17, 17, 8, 8, 17, +17, 19, 17, 17, 17, 9, 12, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 21, 19, 21, 19, 8, 8, 14, 14, 21, 19, 8, 8, 21, 19, 27, 27, 27, 27, 7, 0, 0, 0, 0, 0, +0, 0, 37, 36, 0, 0, 0, 0, 0, 0, 6, 12, 0, 0, 20, 0, 0, 0, 27, 27, 18, 18, 36, 36, 28, +28, 18, 15, 17, 13, 14, 11, 9, 8, 11, 8, 8, 8, 8, 8, 27, 31, 7, 0, 11, 15, 18, 20, 18, 20, +18, 20, 18, 20, 18, 20, 18, 20, 18, 20, 17, 17, 18, 20, 37, 74, 28, 0, 10, 10, 11, 13, 21, 21, 33, +25, 7, 12, 12, 14, 22, 10, 12, 10, 10, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 10, 10, 22, 22, 22, +21, 38, 25, 25, 27, 27, 25, 23, 29, 27, 9, 19, 25, 21, 31, 27, 29, 25, 29, 27, 25, 23, 27, 25, 38, +25, 23, 23, 10, 10, 10, 17, 21, 12, 20, 21, 19, 21, 20, 10, 21, 21, 7, 9, 19, 7, 31, 21, 21, 21, +21, 12, 18, 10, 21, 17, 27, 17, 17, 18, 12, 9, 12, 22, 25, 25, 27, 25, 27, 29, 27, 20, 20, 20, 20, +20, 20, 19, 20, 20, 20, 20, 9, 9, 9, 9, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 15, 21, 21, +21, 13, 20, 23, 27, 27, 37, 12, 12, 20, 37, 29, 26, 20, 20, 20, 21, 21, 18, 26, 30, 20, 9, 14, 14, +28, 33, 23, 23, 11, 22, 21, 21, 20, 23, 21, 21, 37, 25, 25, 29, 37, 35, 21, 37, 12, 12, 8, 8, 20, +18, 17, 23, 6, 21, 12, 12, 19, 19, 21, 10, 8, 12, 37, 25, 25, 25, 25, 25, 9, 9, 9, 9, 29, 29, +29, 27, 27, 27, 9, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 21, 8, 25, 18, 23, 18, 9, 27, 21, 23, +17, 25, 21, 22, 22, 12, 12, 12, 31, 31, 31, 21, 29, 21, 9, 25, 18, 27, 19, 27, 19, 21, 20, 12, 25, +20, 25, 20, 27, 23, 27, 25, 20, 25, 20, 21, 7, 21, 11, 21, 12, 27, 21, 27, 21, 29, 21, 27, 12, 27, +12, 25, 18, 23, 10, 23, 14, 27, 21, 27, 21, 23, 18, 23, 18, 20, 29, 30, 21, 21, 17, 23, 15, 24, 20, +19, 14, 40, 37, 19, 37, 19, 37, 19, 19, 36, 27, 22, 22, 22, 22, 22, 26, 23, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 22, 37, 37, 37, 37, 37, 22, 22, 22, 38, +39, 34, 28, 28, 20, 24, 22, 19, 19, 28, 27, 16, 22, 7, 13, 33, 12, 22, 13, 13, 22, 13, 25, 20, 27, +19, 27, 19, 25, 20, 25, 20, 25, 20, 29, 21, 29, 21, 29, 21, 27, 21, 27, 21, 9, 9, 9, 9, 9, 9, +9, 7, 19, 9, 25, 19, 19, 21, 7, 27, 21, 27, 21, 29, 21, 29, 21, 27, 12, 25, 18, 23, 10, 27, 21, +27, 21, 27, 21, 27, 21, 38, 27, 23, 17, 7, 25, 20, 37, 33, 29, 23, 9, 38, 27, 38, 27, 38, 27, 23, +17, 8, 12, 21, 22, 31, 31, 31, 31, 12, 12, 12, 12, 25, 29, 31, 14, 29, 30, 28, 8, 25, 25, 25, 25, +23, 27, 9, 25, 25, 31, 27, 24, 29, 27, 25, 23, 23, 23, 25, 30, 28, 9, 23, 21, 17, 21, 8, 20, 21, +19, 16, 21, 21, 8, 19, 19, 21, 17, 17, 21, 21, 18, 20, 19, 26, 29, 8, 20, 21, 20, 29, 25, 32, 20, +27, 25, 9, 9, 19, 39, 37, 32, 22, 24, 27, 25, 24, 25, 20, 25, 25, 34, 22, 27, 27, 22, 24, 31, 27, +29, 27, 25, 27, 23, 24, 28, 25, 27, 25, 34, 35, 29, 33, 24, 27, 37, 27, 20, 21, 20, 14, 22, 20, 25, +17, 21, 21, 16, 22, 25, 20, 21, 20, 21, 19, 17, 17, 30, 17, 21, 19, 30, 30, 23, 27, 20, 19, 28, 20, +20, 21, 14, 19, 18, 7, 9, 9, 34, 30, 21, 16, 17, 20, 18, 15, 37, 40, 26, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 14, 12, 9, 12, 12, 10, 21, 20, 15, 19, 22, 9, 14, 22, 22, 9, 19, 17, +17, 22, 22, 9, 13, 21, 20, 21, 20, 17, 18, 20, 19, 26, 24, 18, 18, 18, 9, 15, 30, 9, 19, 19, 17, +17, 20, 26, 26, 26, 26, 21, 21, 21, 20, 15, 19, 22, 11, 15, 22, 11, 19, 17, 17, 22, 13, 21, 21, 20, +18, 20, 19, 26, 24, 9, 20, 17, 20, 21, 0, 0, 0, 0, 12, 12, 13, 15, 8, 7, 9, 7, 7, 8, 7, +8, 6, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 12, 19, 28, 28, 10, 28, 19, 19, 19, 28, 28, 28, +28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 28, 24, 28, 28, 28, 26, 26, 9, 9, 28, 28, 28, 28, 21, 19, +20, 20, 18, 18, 30, 35, 15, 19, 30, 35, 15, 19, 24, 22, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 8, 8, 8, 8, 8, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 21, 37, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 12, 12, 28, 23, 15, 8, 8, 8, 8, 16, 16, 8, 8, 24, 22, 9, 9, +8, 8, 26, 26, 9, 9, 10, 14, 26, 26, 9, 9, 26, 26, 9, 9, 21, 19, 20, 20, 21, 19, 20, 20, 21, +19, 20, 20, 12, 12, 12, 12, 18, 18, 18, 18, 30, 30, 20, 20, 30, 30, 20, 20, 41, 41, 31, 31, 41, 41, +31, 31, 22, 22, 22, 22, 22, 22, 22, 22, 20, 17, 19, 15, 20, 17, 19, 15, 29, 29, 10, 10, 22, 22, 10, +10, 22, 22, 15, 15, 19, 19, 8, 8, 13, 13, 15, 15, 19, 19, 9, 9, 10, 14, 17, 15, 16, 16, 24, 22, +24, 22, 9, 9, 20, 22, 20, 22, 20, 22, 20, 22, 28, 28, 7, 7, 28, 28, 28, 6, 8, 28, 28, 8, 9, +28, 28, 28, 8, 8, 8, 8, 8, 8, 28, 7, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 12, 12, 12, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 5, 37, 74, 32, 24, 32, 25, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 7, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, +20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 25, 20, 9, 7, 9, 7, 29, 21, +29, 21, 29, 21, 29, 21, 29, 21, 29, 21, 29, 21, 32, 24, 32, 24, 32, 24, 32, 24, 32, 24, 27, 21, 27, +21, 32, 25, 32, 25, 32, 25, 32, 25, 32, 25, 23, 17, 23, 17, 23, 17, 25, 20, 9, 7, 29, 21, 27, 21, +27, 21, 27, 21, 27, 21, 27, 21, 0, 0, 0, 0, 20, 14, 34, 25, 22, 16, 22, 16, 27, 20, 21, 19, 21, +19, 25, 19, 25, 19, 25, 21, 28, 21, 29, 21, 26, 9, 10, 10, 22, 9, 9, 9, 9, 9, 9, 10, 8, 8, +12, 12, 8, 8, 8, 0, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 24, 22, 26, 26, 9, 9, 26, +26, 9, 9, 26, 26, 9, 9, 26, 26, 9, 9, 26, 26, 9, 9, 26, 26, 9, 9, 26, 26, 9, 9, 21, 19, +20, 20, 21, 19, 20, 20, 21, 19, 20, 20, 21, 19, 20, 20, 21, 19, 20, 20, 21, 19, 20, 20, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +18, 18, 18, 18, 18, 18, 30, 30, 20, 20, 30, 30, 20, 20, 30, 30, 20, 20, 41, 41, 31, 31, 41, 41, 31, +31, 22, 22, 20, 17, 19, 15, 29, 29, 29, 10, 10, 29, 29, 10, 10, 29, 29, 10, 10, 29, 29, 10, 10, 29, +29, 10, 10, 22, 22, 22, 22, 30, 35, 15, 19, 30, 35, 15, 19, 22, 22, 15, 15, 22, 22, 15, 15, 22, 22, +15, 15, 30, 35, 15, 19, 30, 35, 15, 19, 30, 35, 15, 19, 30, 35, 15, 19, 30, 35, 15, 19, 19, 19, 8, +8, 19, 19, 8, 8, 19, 19, 8, 8, 19, 19, 8, 8, 19, 19, 9, 9, 19, 19, 19, 19, 19, 19, 9, 9, +19, 19, 21, 19, 20, 20, 10, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +16, 16, 24, 22, 24, 22, 9, 9, 16, 16, 24, 22, 9, 9, 24, 22, 30, 30, 30, 30, 8, 0, 0, 0, 0, +0, 0, 0, 42, 40, 0, 0, 0, 0, 0, 0, 7, 14, 0, 0, 22, 0, 0, 0, 30, 30, 20, 20, 41, 41, +31, 31, 20, 17, 19, 15, 15, 13, 10, 9, 12, 9, 9, 9, 9, 9, 30, 35, 9, 0, 13, 18, 20, 22, 20, +22, 20, 22, 20, 22, 20, 22, 20, 22, 20, 22, 19, 19, 20, 22, 42, 84, 32, 0, 12, 12, 14, 15, 23, 23, +37, 28, 8, 14, 14, 16, 25, 12, 14, 12, 12, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 12, 12, 25, 25, +25, 23, 43, 28, 28, 30, 30, 28, 26, 33, 30, 12, 21, 28, 23, 35, 30, 33, 28, 33, 30, 28, 26, 30, 28, +42, 27, 28, 26, 12, 12, 12, 19, 23, 14, 23, 23, 21, 23, 23, 13, 23, 23, 10, 10, 21, 10, 36, 23, 23, +23, 23, 14, 20, 12, 23, 23, 29, 22, 21, 21, 14, 11, 14, 25, 28, 28, 30, 28, 30, 33, 30, 23, 23, 23, +23, 23, 23, 21, 23, 23, 23, 23, 12, 12, 12, 12, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 17, 23, +23, 23, 15, 23, 26, 31, 31, 42, 14, 14, 23, 42, 33, 30, 23, 23, 23, 23, 24, 21, 30, 35, 23, 10, 16, +15, 32, 37, 26, 26, 14, 25, 23, 23, 23, 26, 23, 23, 42, 28, 28, 33, 42, 40, 23, 42, 14, 14, 9, 9, +23, 21, 21, 28, 7, 23, 14, 14, 21, 21, 23, 12, 9, 14, 43, 28, 28, 28, 28, 28, 12, 12, 12, 12, 33, +33, 33, 30, 30, 30, 12, 14, 13, 14, 14, 14, 14, 14, 14, 14, 14, 23, 9, 28, 20, 26, 21, 11, 30, 23, +28, 21, 28, 23, 25, 25, 14, 14, 14, 35, 35, 35, 23, 33, 23, 12, 28, 20, 30, 21, 30, 21, 23, 23, 14, +28, 23, 28, 23, 30, 26, 30, 28, 23, 28, 23, 23, 10, 23, 12, 23, 14, 30, 23, 30, 23, 33, 23, 30, 14, +30, 14, 28, 20, 26, 12, 26, 16, 30, 23, 30, 23, 26, 21, 26, 21, 23, 33, 34, 24, 23, 19, 26, 17, 27, +23, 21, 15, 46, 42, 21, 42, 21, 42, 21, 21, 41, 30, 25, 25, 25, 25, 25, 30, 26, 30, 30, 30, 30, 30, +30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, +30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 25, 42, 42, 42, 42, 42, 25, 25, 25, +43, 44, 39, 32, 32, 22, 28, 25, 21, 21, 32, 31, 19, 25, 8, 15, 37, 14, 25, 15, 15, 25, 15, 28, 23, +30, 21, 30, 21, 28, 23, 28, 23, 28, 23, 33, 23, 33, 23, 33, 23, 30, 23, 30, 23, 12, 12, 12, 12, 12, +12, 12, 10, 21, 10, 28, 21, 21, 23, 10, 30, 23, 30, 23, 33, 23, 33, 23, 30, 14, 28, 20, 26, 12, 30, +23, 30, 23, 30, 23, 30, 23, 42, 29, 28, 21, 10, 28, 23, 42, 37, 33, 26, 12, 42, 29, 42, 29, 42, 29, +28, 21, 9, 14, 23, 25, 35, 35, 35, 35, 14, 14, 14, 14, 28, 33, 35, 16, 33, 35, 32, 10, 28, 28, 28, +28, 26, 30, 12, 28, 28, 35, 30, 27, 33, 30, 28, 26, 26, 28, 27, 35, 31, 12, 28, 24, 19, 23, 10, 23, +24, 21, 19, 23, 23, 10, 21, 21, 24, 23, 19, 23, 24, 20, 23, 22, 30, 33, 10, 23, 23, 23, 33, 28, 36, +23, 30, 28, 12, 12, 21, 44, 42, 36, 24, 27, 30, 28, 28, 28, 23, 28, 28, 39, 25, 30, 30, 24, 28, 35, +30, 33, 30, 28, 30, 26, 27, 32, 27, 31, 28, 39, 39, 33, 37, 28, 30, 42, 30, 23, 24, 22, 15, 25, 23, +28, 19, 23, 23, 18, 25, 29, 23, 23, 23, 23, 21, 19, 21, 35, 22, 24, 22, 34, 35, 26, 30, 22, 21, 32, +23, 23, 23, 15, 21, 20, 10, 12, 10, 38, 34, 23, 18, 21, 23, 21, 17, 42, 45, 29, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 16, 14, 10, 14, 14, 12, 24, 23, 17, 21, 25, 10, 16, 25, 25, 10, 21, +19, 19, 25, 25, 10, 15, 24, 22, 24, 23, 19, 20, 23, 21, 29, 27, 20, 20, 20, 10, 18, 37, 10, 21, 21, +19, 19, 22, 29, 29, 29, 29, 24, 24, 24, 23, 17, 21, 25, 12, 17, 25, 12, 21, 19, 19, 25, 15, 24, 24, +23, 20, 23, 21, 29, 27, 10, 23, 19, 23, 24, 0, 0, 0, 0, 13, 13, 15, 17, 9, 8, 10, 8, 8, 9, +8, 9, 7, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 13, 22, 32, 32, 12, 32, 22, 22, 22, 32, 32, +32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 27, 32, 32, 32, 30, 30, 10, 10, 32, 32, 32, 32, 24, +22, 22, 22, 21, 21, 34, 39, 17, 22, 34, 39, 17, 22, 27, 25, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +32, 32, 32, 32, 32, 32, 10, 9, 9, 9, 9, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 23, 42, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +32, 32, 32, 32, 32, 32, 32, 32, 32, 13, 13, 32, 26, 17, 9, 10, 9, 10, 18, 18, 9, 10, 27, 25, 10, +10, 9, 10, 30, 30, 10, 10, 12, 16, 30, 30, 10, 10, 30, 30, 10, 10, 24, 22, 22, 22, 24, 22, 22, 22, +24, 22, 22, 22, 14, 14, 14, 14, 21, 21, 21, 21, 35, 35, 22, 22, 35, 35, 22, 22, 46, 46, 36, 36, 46, +46, 36, 36, 24, 24, 24, 24, 24, 24, 24, 24, 23, 19, 22, 17, 23, 19, 22, 17, 33, 33, 11, 11, 24, 24, +11, 11, 25, 25, 17, 17, 21, 21, 9, 9, 14, 14, 17, 17, 22, 22, 10, 10, 12, 16, 19, 17, 18, 18, 27, +25, 27, 25, 10, 10, 23, 25, 23, 25, 23, 25, 23, 25, 32, 32, 8, 8, 32, 32, 32, 7, 9, 32, 32, 9, +10, 32, 32, 32, 9, 9, 9, 9, 9, 10, 32, 8, 8, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 13, 13, 13, 32, 32, 32, 32, 32, +32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 5, 42, 84, 36, 28, 36, +28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 35, 35, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 10, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, +28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 28, 23, 12, 10, 12, 10, 33, +23, 33, 23, 33, 23, 33, 23, 33, 23, 33, 23, 33, 23, 36, 28, 36, 28, 36, 28, 36, 28, 36, 28, 30, 23, +30, 23, 36, 28, 36, 28, 36, 28, 36, 28, 36, 28, 28, 21, 28, 21, 28, 21, 28, 23, 12, 10, 33, 23, 30, +23, 30, 23, 30, 23, 30, 23, 30, 23, 0, 0, 0, 0, 23, 15, 39, 28, 24, 18, 24, 18, 30, 23, 23, 21, +23, 21, 28, 21, 28, 22, 28, 23, 32, 23, 33, 23, 30, 10, 11, 11, 24, 10, 10, 10, 10, 10, 10, 11, 9, +9, 14, 14, 9, 9, 9, 0, 9, 10, 9, 10, 9, 10, 9, 10, 18, 18, 18, 18, 27, 25, 30, 30, 10, 10, +30, 30, 10, 10, 30, 30, 10, 10, 30, 30, 10, 10, 30, 30, 10, 10, 30, 30, 10, 10, 30, 30, 10, 10, 24, +22, 22, 22, 24, 22, 22, 22, 24, 22, 22, 22, 24, 22, 22, 22, 24, 22, 22, 22, 24, 22, 22, 22, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 21, 21, 21, 21, 21, 21, 21, 21, 21, +21, 21, 21, 21, 21, 21, 21, 35, 35, 22, 22, 35, 35, 22, 22, 35, 35, 22, 22, 46, 46, 36, 36, 46, 46, +36, 36, 24, 24, 23, 19, 22, 17, 33, 33, 33, 11, 11, 33, 33, 11, 11, 33, 33, 11, 11, 33, 33, 11, 11, +33, 33, 11, 11, 24, 24, 24, 24, 34, 39, 17, 22, 34, 39, 17, 22, 25, 25, 17, 17, 25, 25, 17, 17, 25, +25, 17, 17, 34, 39, 17, 22, 34, 39, 17, 22, 34, 39, 17, 22, 34, 39, 17, 22, 34, 39, 17, 22, 21, 21, +9, 9, 21, 21, 9, 9, 21, 21, 9, 9, 21, 21, 9, 9, 22, 22, 10, 10, 22, 22, 22, 22, 22, 22, 10, +10, 22, 22, 24, 22, 22, 22, 12, 16, 16, 16, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +18, 18, 18, 27, 25, 27, 25, 10, 10, 18, 18, 27, 25, 10, 10, 27, 25, 34, 34, 34, 34, 9, 0, 0, 0, +0, 0, 0, 0, 47, 46, 0, 0, 0, 0, 0, 0, 8, 16, 0, 0, 25, 0, 0, 0, 35, 35, 22, 22, 46, +46, 36, 36, 23, 19, 22, 17, 17, 14, 12, 10, 13, 10, 10, 10, 10, 10, 34, 39, 10, 0, 14, 20, 23, 25, +23, 25, 23, 25, 23, 25, 23, 25, 23, 25, 23, 25, 22, 22, 23, 25, 46, 92, 35, 0, 13, 13, 14, 16, 26, +26, 41, 31, 9, 15, 15, 18, 27, 13, 15, 13, 13, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 13, 13, 27, +27, 27, 26, 47, 31, 31, 33, 33, 31, 28, 36, 33, 12, 23, 31, 26, 37, 33, 36, 31, 36, 33, 31, 28, 33, +31, 46, 31, 30, 28, 13, 13, 13, 21, 26, 15, 26, 26, 23, 26, 26, 14, 26, 26, 10, 10, 23, 10, 38, 26, +26, 26, 26, 15, 23, 13, 26, 23, 33, 23, 23, 23, 15, 11, 15, 27, 31, 31, 33, 31, 33, 36, 33, 26, 26, +26, 26, 26, 26, 23, 26, 26, 26, 26, 12, 12, 12, 12, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 18, +26, 26, 26, 16, 25, 28, 34, 34, 46, 15, 15, 25, 46, 36, 33, 25, 25, 25, 26, 27, 23, 33, 38, 25, 15, +17, 17, 35, 41, 28, 28, 14, 27, 25, 26, 25, 28, 26, 26, 46, 31, 31, 36, 46, 43, 26, 46, 15, 15, 10, +10, 25, 23, 23, 30, 8, 26, 15, 15, 23, 23, 26, 13, 10, 15, 46, 31, 31, 31, 31, 31, 12, 12, 12, 12, +36, 36, 36, 33, 33, 33, 12, 15, 13, 15, 15, 15, 15, 15, 15, 15, 15, 26, 10, 31, 23, 28, 23, 11, 33, +26, 30, 23, 31, 26, 27, 27, 15, 15, 15, 38, 38, 38, 26, 36, 26, 12, 31, 23, 33, 23, 33, 23, 26, 25, +15, 31, 26, 31, 26, 33, 28, 33, 31, 26, 31, 26, 26, 10, 26, 13, 26, 15, 33, 26, 33, 26, 36, 26, 33, +15, 33, 15, 31, 23, 28, 13, 28, 17, 33, 26, 33, 26, 28, 23, 28, 23, 25, 36, 37, 27, 26, 21, 28, 18, +30, 25, 23, 17, 50, 46, 23, 46, 23, 46, 23, 23, 45, 33, 27, 28, 27, 28, 28, 33, 29, 33, 33, 33, 33, +33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, +33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 28, 46, 46, 46, 46, 46, 28, 28, +28, 47, 48, 42, 35, 35, 24, 30, 27, 23, 23, 35, 34, 20, 28, 9, 16, 41, 15, 28, 16, 16, 28, 16, 31, +26, 33, 23, 33, 23, 31, 26, 31, 26, 31, 26, 36, 26, 36, 26, 36, 26, 33, 26, 33, 26, 12, 12, 12, 12, +12, 12, 12, 10, 23, 10, 31, 23, 23, 26, 10, 33, 26, 33, 26, 36, 26, 36, 26, 33, 15, 31, 23, 28, 13, +33, 26, 33, 26, 33, 26, 33, 26, 46, 33, 30, 23, 10, 31, 26, 46, 41, 36, 28, 12, 46, 33, 46, 33, 46, +33, 30, 23, 10, 15, 26, 28, 38, 38, 38, 38, 15, 15, 15, 15, 31, 36, 39, 18, 36, 38, 35, 10, 31, 31, +31, 31, 28, 33, 12, 31, 31, 37, 33, 30, 36, 33, 31, 28, 28, 30, 31, 38, 34, 12, 30, 27, 21, 26, 10, +25, 26, 23, 20, 26, 26, 10, 23, 23, 27, 23, 21, 26, 26, 22, 25, 24, 33, 36, 10, 25, 26, 25, 36, 31, +40, 25, 33, 31, 12, 12, 23, 49, 46, 39, 27, 29, 33, 31, 30, 31, 25, 31, 31, 42, 28, 33, 33, 27, 30, +37, 33, 36, 33, 31, 33, 28, 29, 35, 31, 34, 31, 42, 43, 36, 41, 30, 33, 46, 33, 26, 26, 24, 17, 27, +26, 31, 21, 26, 26, 20, 27, 32, 25, 26, 25, 26, 23, 21, 23, 38, 23, 26, 24, 37, 38, 29, 33, 24, 23, +35, 25, 26, 26, 17, 23, 23, 10, 12, 10, 42, 37, 26, 20, 23, 25, 22, 19, 46, 49, 32, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 18, 15, 10, 15, 15, 13, 26, 25, 18, 23, 28, 10, 18, 28, 27, 10, +23, 21, 21, 28, 28, 10, 16, 26, 24, 26, 25, 21, 22, 25, 23, 32, 30, 21, 21, 21, 11, 19, 37, 10, 23, +23, 21, 21, 25, 32, 32, 32, 32, 26, 26, 26, 25, 18, 23, 28, 13, 19, 27, 13, 23, 21, 21, 28, 16, 26, +26, 25, 22, 25, 23, 32, 30, 10, 25, 21, 25, 26, 0, 0, 0, 0, 15, 15, 16, 19, 10, 9, 11, 9, 9, +10, 9, 10, 8, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 15, 24, 35, 35, 13, 35, 24, 24, 24, 35, +35, 35, 35, 35, 10, 35, 35, 35, 35, 35, 35, 35, 35, 29, 35, 35, 35, 33, 33, 11, 11, 35, 35, 35, 35, +26, 24, 24, 24, 22, 22, 37, 43, 18, 24, 37, 43, 18, 24, 29, 27, 35, 35, 35, 35, 35, 35, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 10, 10, 10, 10, 10, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 26, 46, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 15, 15, 35, 28, 19, 10, 11, 10, 11, 20, 20, 10, 11, 29, 27, +11, 11, 10, 11, 33, 33, 11, 11, 13, 17, 33, 33, 11, 11, 33, 33, 11, 11, 26, 24, 24, 24, 26, 24, 24, +24, 26, 24, 24, 24, 16, 16, 16, 16, 22, 22, 22, 22, 38, 38, 24, 24, 38, 38, 24, 24, 51, 51, 39, 39, +51, 51, 39, 39, 27, 27, 27, 27, 27, 27, 27, 27, 25, 21, 24, 18, 25, 21, 24, 18, 36, 36, 12, 12, 27, +27, 12, 12, 28, 28, 18, 18, 23, 23, 10, 10, 16, 16, 18, 18, 24, 24, 11, 11, 13, 17, 21, 18, 20, 20, +29, 27, 29, 27, 11, 11, 25, 28, 25, 28, 25, 28, 25, 28, 35, 35, 9, 9, 35, 35, 35, 8, 10, 35, 35, +10, 11, 35, 35, 35, 10, 10, 10, 10, 10, 10, 35, 9, 9, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 15, 15, 15, 35, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 6, 46, 92, 39, 30, +39, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 38, 38, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 10, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, +26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 31, 26, 12, 10, 12, 10, +36, 26, 36, 26, 36, 26, 36, 26, 36, 26, 36, 26, 36, 26, 39, 30, 39, 30, 39, 30, 39, 30, 39, 30, 33, +26, 33, 26, 39, 31, 39, 31, 39, 31, 39, 31, 39, 31, 30, 23, 30, 23, 30, 23, 31, 26, 12, 10, 36, 26, +33, 26, 33, 26, 33, 26, 33, 26, 33, 26, 0, 0, 0, 0, 25, 17, 42, 31, 27, 20, 27, 20, 33, 25, 26, +23, 26, 23, 31, 23, 31, 24, 31, 26, 35, 26, 36, 26, 33, 11, 12, 12, 27, 11, 11, 11, 11, 11, 11, 12, +10, 10, 15, 15, 10, 10, 10, 0, 10, 11, 10, 11, 10, 11, 10, 11, 20, 20, 20, 20, 29, 27, 33, 33, 11, +11, 33, 33, 11, 11, 33, 33, 11, 11, 33, 33, 11, 11, 33, 33, 11, 11, 33, 33, 11, 11, 33, 33, 11, 11, +26, 24, 24, 24, 26, 24, 24, 24, 26, 24, 24, 24, 26, 24, 24, 24, 26, 24, 24, 24, 26, 24, 24, 24, 16, +16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 38, 38, 24, 24, 38, 38, 24, 24, 38, 38, 24, 24, 51, 51, 39, 39, 51, +51, 39, 39, 27, 27, 25, 21, 24, 18, 36, 36, 36, 12, 12, 36, 36, 12, 12, 36, 36, 12, 12, 36, 36, 12, +12, 36, 36, 12, 12, 27, 27, 27, 27, 37, 43, 18, 24, 37, 43, 18, 24, 28, 28, 18, 18, 28, 28, 18, 18, +28, 28, 18, 18, 37, 43, 18, 24, 37, 43, 18, 24, 37, 43, 18, 24, 37, 43, 18, 24, 37, 43, 18, 24, 23, +23, 10, 10, 23, 23, 10, 10, 23, 23, 10, 10, 23, 23, 10, 10, 24, 24, 11, 11, 24, 24, 24, 24, 24, 24, +11, 11, 24, 24, 26, 24, 24, 24, 13, 17, 18, 18, 18, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +20, 20, 20, 20, 29, 27, 29, 27, 11, 11, 20, 20, 29, 27, 11, 11, 29, 27, 37, 37, 37, 37, 10, 0, 0, +0, 0, 0, 0, 0, 52, 50, 0, 0, 0, 0, 0, 0, 9, 17, 0, 0, 28, 0, 0, 0, 38, 38, 24, 24, +51, 51, 39, 39, 25, 21, 24, 18, 19, 16, 13, 11, 15, 11, 11, 11, 11, 11, 37, 43, 10, 0, 16, 21, 25, +28, 25, 28, 25, 28, 25, 28, 25, 28, 25, 28, 25, 28, 24, 24, 25, 28, 50, 100, 38, 0, 14, 14, 16, 18, +28, 28, 44, 33, 10, 17, 17, 19, 29, 14, 17, 14, 14, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 14, 14, +29, 29, 29, 28, 51, 33, 33, 36, 36, 33, 31, 39, 36, 14, 25, 33, 28, 41, 36, 39, 33, 39, 36, 33, 31, +36, 33, 50, 33, 33, 31, 14, 14, 14, 22, 28, 17, 28, 28, 25, 28, 28, 14, 28, 28, 12, 10, 25, 12, 40, +28, 28, 28, 28, 17, 25, 14, 28, 25, 35, 24, 25, 25, 17, 12, 17, 29, 33, 33, 36, 33, 36, 39, 36, 28, +28, 28, 28, 28, 28, 25, 28, 28, 28, 28, 14, 14, 14, 14, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +20, 28, 28, 28, 18, 27, 31, 37, 37, 50, 17, 17, 27, 50, 39, 36, 27, 27, 27, 28, 29, 25, 36, 41, 27, +16, 19, 18, 38, 44, 31, 31, 16, 29, 27, 28, 27, 30, 28, 28, 50, 33, 33, 39, 50, 47, 28, 50, 17, 17, +11, 11, 27, 25, 25, 33, 8, 28, 17, 17, 25, 25, 28, 14, 11, 17, 50, 33, 33, 33, 33, 33, 14, 14, 14, +14, 39, 39, 39, 36, 36, 36, 14, 17, 15, 17, 17, 17, 17, 17, 17, 17, 17, 28, 11, 33, 25, 31, 25, 12, +36, 28, 33, 25, 33, 28, 29, 29, 17, 17, 17, 42, 42, 42, 28, 39, 28, 14, 33, 25, 36, 25, 36, 25, 28, +28, 17, 33, 28, 33, 28, 36, 31, 36, 33, 28, 33, 28, 28, 12, 28, 15, 28, 17, 36, 28, 36, 28, 39, 28, +36, 17, 36, 17, 33, 25, 31, 13, 31, 19, 36, 28, 36, 28, 31, 25, 31, 25, 28, 39, 40, 29, 28, 22, 31, +20, 32, 28, 25, 18, 54, 50, 25, 50, 25, 50, 25, 25, 49, 36, 29, 30, 29, 30, 30, 35, 31, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, +35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 30, 50, 49, 49, 49, 49, 30, +30, 30, 51, 53, 46, 38, 38, 27, 33, 30, 26, 25, 38, 37, 22, 30, 9, 18, 44, 16, 30, 18, 18, 30, 18, +33, 28, 36, 25, 36, 25, 33, 28, 33, 28, 33, 28, 39, 28, 39, 28, 39, 28, 36, 28, 36, 28, 14, 14, 14, +14, 14, 14, 14, 12, 25, 10, 33, 25, 25, 28, 12, 36, 28, 36, 28, 39, 28, 39, 28, 36, 17, 33, 25, 31, +14, 36, 28, 36, 28, 36, 28, 36, 28, 50, 35, 33, 25, 12, 33, 28, 50, 44, 39, 31, 12, 50, 35, 50, 35, +50, 35, 33, 25, 11, 17, 28, 30, 42, 42, 42, 42, 17, 17, 17, 17, 33, 39, 42, 19, 39, 42, 38, 10, 33, +33, 33, 33, 31, 36, 14, 33, 33, 41, 36, 33, 39, 36, 33, 31, 31, 33, 33, 42, 37, 14, 33, 29, 22, 28, +10, 27, 29, 25, 22, 28, 28, 10, 25, 25, 29, 25, 22, 28, 28, 24, 27, 26, 36, 39, 10, 27, 28, 27, 39, +33, 43, 27, 36, 33, 14, 14, 25, 53, 51, 43, 29, 32, 36, 33, 33, 33, 27, 34, 33, 46, 30, 36, 36, 29, +33, 41, 36, 39, 36, 33, 36, 31, 32, 38, 33, 37, 33, 46, 47, 40, 44, 33, 36, 51, 36, 28, 29, 27, 18, +29, 28, 33, 23, 28, 28, 22, 29, 34, 28, 28, 27, 28, 25, 23, 25, 41, 24, 29, 26, 40, 41, 31, 36, 26, +26, 38, 27, 28, 28, 18, 26, 25, 12, 14, 10, 45, 41, 28, 22, 25, 28, 24, 21, 50, 54, 35, 17, 17, 17, +17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 17, 13, 17, 17, 14, 28, 27, 20, 25, 30, 13, 19, 30, 30, +13, 25, 23, 23, 30, 30, 13, 18, 29, 26, 28, 27, 23, 24, 27, 25, 35, 32, 26, 26, 26, 12, 21, 42, 13, +25, 25, 23, 23, 27, 35, 35, 35, 35, 28, 28, 28, 27, 20, 25, 30, 14, 21, 30, 14, 25, 23, 23, 30, 18, +29, 28, 27, 24, 27, 25, 35, 32, 13, 27, 23, 27, 29, 0, 0, 0, 0, 16, 16, 18, 21, 10, 10, 12, 10, +10, 10, 10, 11, 8, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 16, 26, 38, 38, 14, 38, 26, 26, 26, +38, 38, 38, 38, 38, 11, 38, 38, 38, 38, 38, 38, 38, 38, 32, 38, 38, 38, 36, 36, 12, 12, 38, 38, 38, +38, 28, 26, 26, 26, 24, 24, 41, 47, 20, 26, 41, 47, 20, 26, 32, 29, 38, 38, 38, 38, 38, 38, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 11, 11, 11, 11, 11, 38, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 28, 50, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 16, 16, 38, 31, 21, 10, 11, 10, 11, 22, 22, 10, 11, 32, +29, 12, 12, 10, 11, 36, 36, 12, 12, 14, 19, 36, 36, 12, 12, 36, 36, 12, 12, 28, 26, 26, 26, 28, 26, +26, 26, 28, 26, 26, 26, 17, 17, 17, 17, 24, 24, 24, 24, 41, 41, 27, 27, 41, 41, 27, 27, 55, 55, 42, +42, 55, 55, 42, 42, 29, 29, 29, 29, 29, 29, 29, 29, 27, 23, 26, 20, 27, 23, 26, 20, 39, 39, 13, 13, +29, 29, 13, 13, 30, 30, 20, 20, 25, 25, 10, 10, 17, 17, 20, 20, 26, 26, 12, 12, 14, 19, 23, 20, 22, +22, 32, 29, 32, 29, 12, 12, 27, 30, 27, 30, 27, 30, 27, 30, 38, 38, 10, 10, 38, 38, 38, 8, 11, 38, +38, 10, 12, 38, 38, 38, 11, 11, 11, 11, 11, 11, 38, 10, 10, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 16, 16, 16, 38, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 6, 50, 100, 43, +33, 43, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 42, 42, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 12, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, +33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 33, 28, 14, 12, 14, +12, 39, 28, 39, 28, 39, 28, 39, 28, 39, 28, 39, 28, 39, 28, 43, 33, 43, 33, 43, 33, 43, 33, 43, 33, +36, 28, 36, 28, 43, 33, 43, 33, 43, 33, 43, 33, 43, 33, 33, 25, 33, 25, 33, 25, 33, 28, 14, 12, 39, +28, 36, 28, 36, 28, 36, 28, 36, 28, 36, 28, 0, 0, 0, 0, 27, 18, 46, 33, 29, 22, 29, 22, 36, 28, +28, 25, 28, 25, 33, 25, 33, 26, 33, 28, 38, 28, 39, 28, 36, 12, 13, 13, 29, 12, 12, 12, 12, 12, 12, +13, 10, 10, 17, 17, 10, 10, 10, 0, 10, 11, 10, 11, 10, 11, 10, 11, 22, 22, 22, 22, 32, 29, 36, 36, +12, 12, 36, 36, 12, 12, 36, 36, 12, 12, 36, 36, 12, 12, 36, 36, 12, 12, 36, 36, 12, 12, 36, 36, 12, +12, 28, 26, 26, 26, 28, 26, 26, 26, 28, 26, 26, 26, 28, 26, 26, 26, 28, 26, 26, 26, 28, 26, 26, 26, +17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 41, 41, 27, 27, 41, 41, 27, 27, 41, 41, 27, 27, 55, 55, 42, 42, +55, 55, 42, 42, 29, 29, 27, 23, 26, 20, 39, 39, 39, 13, 13, 39, 39, 13, 13, 39, 39, 13, 13, 39, 39, +13, 13, 39, 39, 13, 13, 29, 29, 29, 29, 41, 47, 20, 26, 41, 47, 20, 26, 30, 30, 20, 20, 30, 30, 20, +20, 30, 30, 20, 20, 41, 47, 20, 26, 41, 47, 20, 26, 41, 47, 20, 26, 41, 47, 20, 26, 41, 47, 20, 26, +25, 25, 10, 10, 25, 25, 10, 10, 25, 25, 10, 10, 25, 25, 10, 10, 26, 26, 12, 12, 26, 26, 26, 26, 26, +26, 12, 12, 26, 26, 28, 26, 26, 26, 14, 19, 19, 19, 19, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +22, 22, 22, 22, 22, 32, 29, 32, 29, 12, 12, 22, 22, 32, 29, 12, 12, 32, 29, 41, 41, 41, 41, 10, 0, +0, 0, 0, 0, 0, 0, 56, 54, 0, 0, 0, 0, 0, 0, 10, 19, 0, 0, 30, 0, 0, 0, 41, 41, 27, +27, 55, 55, 42, 42, 27, 23, 26, 20, 21, 17, 14, 12, 16, 12, 12, 12, 12, 12, 41, 47, 13, 0, 17, 26, +27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 27, 30, 26, 26, 27, 30, 54, 108, 41, 0, 15, 15, 17, +19, 30, 30, 48, 36, 10, 18, 18, 21, 32, 15, 18, 15, 15, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 15, +15, 32, 32, 32, 30, 55, 36, 36, 39, 39, 36, 33, 42, 39, 15, 27, 36, 30, 45, 39, 42, 36, 42, 39, 36, +33, 39, 36, 54, 35, 35, 33, 15, 15, 15, 24, 30, 18, 30, 30, 27, 30, 30, 15, 30, 29, 13, 13, 27, 13, +45, 29, 30, 30, 30, 18, 27, 15, 29, 27, 39, 26, 27, 26, 18, 14, 18, 32, 36, 36, 39, 36, 39, 42, 39, +30, 30, 30, 30, 30, 30, 27, 30, 30, 30, 30, 15, 15, 15, 15, 29, 30, 30, 30, 30, 30, 29, 29, 29, 29, +30, 22, 30, 30, 30, 19, 29, 33, 40, 40, 54, 18, 18, 30, 54, 42, 39, 30, 30, 30, 30, 31, 27, 39, 44, +30, 16, 20, 20, 41, 48, 33, 33, 17, 32, 29, 30, 30, 34, 30, 30, 54, 36, 36, 42, 54, 51, 30, 54, 18, +18, 12, 12, 30, 27, 27, 35, 9, 30, 18, 18, 27, 27, 30, 15, 12, 18, 53, 36, 36, 36, 36, 36, 15, 15, +15, 15, 42, 42, 42, 39, 39, 39, 15, 18, 16, 18, 18, 18, 18, 18, 18, 18, 18, 30, 12, 36, 27, 33, 26, +14, 39, 30, 35, 27, 36, 30, 32, 32, 18, 18, 18, 45, 45, 45, 30, 42, 30, 15, 36, 27, 39, 27, 39, 27, +30, 30, 18, 36, 30, 36, 30, 39, 33, 39, 36, 30, 36, 30, 30, 13, 30, 16, 30, 18, 39, 29, 39, 29, 42, +30, 39, 18, 39, 18, 36, 27, 33, 15, 33, 20, 39, 29, 39, 29, 33, 26, 33, 26, 30, 42, 43, 31, 30, 24, +33, 21, 35, 30, 27, 20, 59, 54, 27, 54, 27, 54, 27, 27, 53, 39, 32, 33, 32, 33, 33, 38, 34, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, +38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 33, 54, 53, 53, 53, 53, +33, 33, 33, 55, 57, 49, 41, 41, 29, 35, 32, 28, 27, 41, 40, 24, 33, 10, 19, 48, 17, 33, 19, 19, 33, +19, 36, 30, 39, 27, 39, 27, 36, 30, 36, 30, 36, 30, 42, 30, 42, 30, 42, 30, 39, 29, 39, 29, 15, 15, +15, 15, 15, 15, 15, 13, 27, 13, 36, 27, 27, 30, 13, 39, 29, 39, 30, 42, 30, 42, 30, 39, 18, 36, 27, +33, 15, 39, 29, 39, 29, 39, 29, 39, 29, 54, 39, 35, 27, 13, 36, 30, 54, 48, 42, 33, 15, 54, 39, 54, +39, 54, 39, 35, 27, 12, 18, 30, 32, 45, 45, 45, 45, 18, 18, 18, 18, 36, 42, 45, 21, 42, 44, 41, 13, +36, 36, 36, 36, 33, 39, 15, 36, 36, 45, 39, 35, 42, 39, 36, 33, 33, 35, 35, 45, 40, 15, 35, 31, 24, +30, 13, 30, 31, 27, 24, 30, 30, 13, 27, 27, 31, 27, 24, 30, 31, 26, 30, 28, 39, 42, 13, 30, 30, 30, +42, 36, 47, 29, 39, 36, 15, 15, 27, 57, 55, 45, 31, 34, 39, 36, 35, 36, 29, 37, 36, 50, 33, 39, 39, +31, 35, 45, 39, 42, 39, 36, 39, 33, 34, 41, 35, 40, 36, 49, 51, 43, 48, 35, 39, 55, 39, 30, 31, 29, +20, 32, 30, 36, 25, 29, 29, 24, 31, 37, 29, 30, 28, 30, 27, 25, 27, 44, 26, 31, 28, 43, 44, 34, 39, +28, 28, 41, 29, 30, 29, 20, 28, 27, 13, 15, 13, 49, 44, 29, 24, 27, 29, 26, 22, 54, 58, 37, 18, 18, +18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 21, 18, 13, 18, 18, 15, 30, 29, 22, 27, 33, 13, 21, 32, +32, 13, 28, 25, 25, 32, 32, 13, 19, 31, 29, 31, 30, 25, 26, 30, 28, 38, 35, 26, 26, 26, 13, 23, 42, +13, 28, 28, 25, 25, 29, 38, 38, 38, 38, 30, 30, 30, 29, 22, 27, 33, 15, 22, 32, 15, 28, 25, 25, 32, +19, 31, 31, 30, 26, 30, 28, 38, 35, 13, 29, 25, 30, 31, 0, 0, 0, 0, 17, 17, 19, 22, 11, 11, 13, +11, 11, 11, 11, 11, 9, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 17, 28, 41, 41, 15, 41, 28, 28, +28, 41, 41, 41, 41, 41, 11, 41, 41, 41, 41, 41, 41, 41, 41, 34, 41, 41, 41, 39, 39, 13, 13, 41, 41, +41, 41, 30, 28, 29, 29, 26, 26, 44, 50, 21, 28, 44, 50, 21, 28, 34, 32, 41, 41, 41, 41, 41, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 12, 11, 11, 11, 11, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 30, 54, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 17, 17, 41, 33, 22, 11, 12, 11, 12, 23, 23, 11, 12, +34, 32, 13, 13, 11, 12, 39, 39, 13, 13, 15, 20, 39, 39, 13, 13, 39, 39, 13, 13, 30, 28, 29, 29, 30, +28, 29, 29, 30, 28, 29, 29, 18, 18, 18, 18, 26, 26, 26, 26, 44, 44, 29, 29, 44, 44, 29, 29, 59, 59, +46, 46, 59, 59, 46, 46, 31, 31, 31, 31, 31, 31, 31, 31, 29, 24, 28, 21, 29, 24, 28, 21, 43, 43, 14, +14, 31, 31, 14, 14, 32, 32, 21, 21, 27, 27, 11, 11, 18, 18, 21, 21, 28, 28, 13, 13, 15, 20, 24, 21, +23, 23, 34, 32, 34, 32, 13, 13, 29, 32, 29, 32, 29, 32, 29, 32, 41, 41, 11, 11, 41, 41, 41, 9, 11, +41, 41, 11, 13, 41, 41, 41, 11, 11, 11, 11, 11, 12, 41, 11, 11, 41, 41, 41, 41, 41, 41, 41, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 17, 17, 17, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 7, 54, 108, +46, 35, 46, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 45, 45, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 13, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, +30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 15, 13, +15, 13, 42, 30, 42, 30, 42, 30, 42, 30, 42, 30, 42, 30, 42, 30, 46, 35, 46, 35, 46, 35, 46, 35, 46, +35, 39, 29, 39, 29, 46, 36, 46, 36, 46, 36, 46, 36, 46, 36, 35, 27, 35, 27, 35, 27, 36, 30, 15, 13, +42, 30, 39, 29, 39, 29, 39, 29, 39, 29, 39, 29, 0, 0, 0, 0, 29, 20, 50, 36, 31, 24, 31, 24, 39, +30, 30, 27, 30, 27, 36, 27, 36, 28, 36, 29, 41, 30, 42, 30, 39, 13, 14, 14, 31, 13, 13, 13, 13, 13, +13, 15, 11, 11, 18, 18, 11, 11, 11, 0, 11, 12, 11, 12, 11, 12, 11, 12, 23, 23, 23, 23, 34, 32, 39, +39, 13, 13, 39, 39, 13, 13, 39, 39, 13, 13, 39, 39, 13, 13, 39, 39, 13, 13, 39, 39, 13, 13, 39, 39, +13, 13, 30, 28, 29, 29, 30, 28, 29, 29, 30, 28, 29, 29, 30, 28, 29, 29, 30, 28, 29, 29, 30, 28, 29, +29, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 44, 44, 29, 29, 44, 44, 29, 29, 44, 44, 29, 29, 59, 59, 46, +46, 59, 59, 46, 46, 31, 31, 29, 24, 28, 21, 43, 43, 43, 14, 14, 43, 43, 14, 14, 43, 43, 14, 14, 43, +43, 14, 14, 43, 43, 14, 14, 31, 31, 31, 31, 44, 50, 21, 28, 44, 50, 21, 28, 32, 32, 21, 21, 32, 32, +21, 21, 32, 32, 21, 21, 44, 50, 21, 28, 44, 50, 21, 28, 44, 50, 21, 28, 44, 50, 21, 28, 44, 50, 21, +28, 27, 27, 11, 11, 27, 27, 11, 11, 27, 27, 11, 11, 27, 27, 11, 11, 28, 28, 13, 13, 28, 28, 28, 28, +28, 28, 13, 13, 28, 28, 30, 28, 29, 29, 15, 20, 21, 21, 21, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 34, 32, 34, 32, 13, 13, 23, 23, 34, 32, 13, 13, 34, 32, 44, 44, 44, 44, 11, +0, 0, 0, 0, 0, 0, 0, 61, 59, 0, 0, 0, 0, 0, 0, 10, 20, 0, 0, 32, 0, 0, 0, 44, 44, +29, 29, 59, 59, 46, 46, 29, 24, 28, 21, 22, 18, 15, 13, 17, 13, 13, 13, 13, 13, 44, 50, 13, 0, 18, +26, 29, 32, 29, 32, 29, 32, 29, 32, 29, 32, 29, 32, 29, 32, 28, 28, 29, 32, 58, 116, 44, 0, 16, 16, +19, 21, 32, 32, 52, 39, 11, 19, 19, 23, 34, 16, 19, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +16, 16, 34, 34, 34, 32, 59, 39, 39, 42, 42, 39, 35, 45, 42, 15, 29, 39, 32, 47, 42, 45, 39, 45, 42, +39, 36, 42, 39, 58, 37, 38, 35, 16, 16, 16, 24, 32, 19, 32, 32, 29, 32, 32, 16, 32, 32, 13, 13, 30, +13, 49, 32, 32, 32, 32, 19, 29, 16, 32, 29, 41, 28, 27, 28, 19, 14, 19, 34, 39, 39, 42, 39, 42, 45, +42, 32, 32, 32, 32, 32, 32, 29, 32, 32, 32, 32, 15, 15, 15, 15, 32, 32, 32, 32, 32, 32, 32, 32, 32, +32, 32, 23, 32, 32, 32, 20, 31, 35, 43, 43, 58, 19, 19, 32, 58, 45, 41, 32, 32, 32, 32, 33, 29, 41, +48, 32, 17, 21, 21, 45, 52, 35, 35, 19, 34, 32, 32, 32, 36, 32, 32, 58, 39, 39, 45, 58, 55, 32, 58, +19, 19, 13, 13, 32, 29, 27, 38, 10, 32, 19, 19, 29, 29, 32, 16, 13, 19, 57, 39, 39, 39, 39, 39, 15, +15, 15, 15, 45, 45, 45, 42, 42, 42, 15, 19, 17, 19, 19, 19, 19, 19, 19, 19, 19, 32, 13, 39, 29, 35, +28, 14, 42, 32, 38, 27, 39, 32, 34, 34, 19, 19, 19, 48, 48, 48, 32, 45, 32, 15, 39, 29, 42, 29, 42, +29, 32, 32, 19, 39, 32, 39, 32, 42, 36, 42, 39, 32, 39, 32, 32, 13, 32, 17, 32, 19, 42, 32, 42, 32, +45, 32, 42, 19, 42, 19, 39, 29, 36, 16, 36, 22, 42, 32, 42, 32, 35, 28, 35, 28, 32, 45, 46, 34, 32, +26, 36, 23, 38, 32, 29, 21, 63, 58, 29, 58, 29, 58, 29, 29, 57, 42, 34, 35, 34, 35, 35, 41, 36, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 35, 58, 57, 57, 57, +57, 35, 35, 35, 59, 61, 53, 44, 44, 31, 38, 34, 30, 29, 44, 43, 26, 35, 11, 21, 51, 19, 35, 21, 21, +35, 21, 39, 32, 42, 29, 42, 29, 39, 32, 39, 32, 39, 32, 45, 32, 45, 32, 45, 32, 42, 32, 42, 32, 15, +15, 15, 15, 15, 15, 15, 13, 29, 13, 39, 30, 29, 32, 13, 42, 32, 42, 32, 45, 32, 45, 32, 42, 19, 39, +29, 35, 16, 42, 32, 42, 32, 42, 32, 42, 32, 58, 41, 38, 27, 13, 39, 32, 58, 52, 45, 35, 15, 58, 41, +58, 41, 58, 41, 38, 27, 13, 19, 32, 35, 48, 48, 48, 48, 19, 19, 19, 19, 39, 45, 49, 22, 45, 48, 44, +13, 39, 39, 39, 39, 35, 42, 15, 39, 39, 47, 42, 38, 45, 42, 39, 36, 36, 38, 37, 48, 43, 15, 38, 34, +26, 32, 13, 32, 33, 29, 26, 32, 32, 13, 29, 29, 33, 29, 26, 32, 33, 28, 32, 30, 41, 45, 13, 32, 32, +32, 45, 39, 50, 31, 42, 39, 15, 15, 29, 61, 59, 50, 34, 37, 42, 39, 38, 39, 31, 39, 39, 54, 35, 42, +42, 34, 38, 47, 42, 45, 42, 39, 42, 36, 37, 44, 37, 43, 39, 53, 54, 46, 51, 38, 42, 59, 42, 32, 33, +31, 21, 34, 32, 39, 27, 32, 32, 25, 34, 40, 32, 32, 31, 32, 29, 27, 27, 48, 28, 33, 30, 47, 48, 36, +42, 30, 30, 44, 31, 32, 32, 21, 30, 29, 13, 15, 13, 53, 47, 32, 25, 27, 32, 28, 24, 58, 62, 40, 19, +19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 22, 19, 14, 19, 19, 16, 33, 31, 23, 29, 35, 14, 22, +35, 34, 14, 30, 27, 27, 35, 35, 14, 20, 33, 31, 33, 32, 27, 28, 32, 30, 40, 37, 29, 29, 29, 14, 24, +46, 14, 30, 30, 27, 27, 31, 40, 40, 40, 40, 33, 33, 33, 31, 23, 29, 35, 17, 24, 34, 17, 30, 27, 27, +35, 20, 33, 33, 32, 28, 32, 30, 40, 37, 14, 31, 27, 32, 33, 0, 0, 0, 0, 19, 19, 21, 24, 12, 12, +14, 12, 12, 12, 12, 12, 10, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 19, 31, 44, 44, 16, 44, 31, +31, 31, 44, 44, 44, 44, 44, 12, 44, 44, 44, 44, 44, 44, 44, 44, 37, 44, 44, 44, 41, 41, 14, 14, 44, +44, 44, 44, 33, 31, 31, 31, 28, 28, 47, 54, 23, 30, 47, 54, 23, 30, 37, 34, 44, 44, 44, 44, 44, 44, +44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 13, 12, 12, 12, 12, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 32, 58, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, +44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 19, 19, 44, 36, 24, 12, 13, 12, 13, 25, 25, 12, +13, 37, 34, 14, 14, 12, 13, 41, 41, 14, 14, 16, 22, 41, 41, 14, 14, 41, 41, 14, 14, 33, 31, 31, 31, +33, 31, 31, 31, 33, 31, 31, 31, 20, 20, 20, 20, 28, 28, 28, 28, 48, 48, 31, 31, 48, 48, 31, 31, 64, +64, 49, 49, 64, 64, 49, 49, 34, 34, 34, 34, 34, 34, 34, 34, 32, 26, 31, 23, 32, 26, 31, 23, 46, 46, +16, 15, 34, 34, 16, 15, 35, 35, 23, 23, 29, 29, 12, 12, 20, 20, 23, 23, 31, 31, 14, 14, 16, 22, 26, +23, 25, 25, 37, 34, 37, 34, 14, 14, 32, 35, 32, 35, 32, 35, 32, 35, 44, 44, 12, 12, 44, 44, 44, 10, +12, 44, 44, 12, 14, 44, 44, 44, 12, 12, 12, 12, 12, 13, 44, 12, 12, 44, 44, 44, 44, 44, 44, 44, 44, +44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, +44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 19, 19, 19, 44, +44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 7, 58, +116, 50, 38, 50, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 48, 48, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 13, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, +39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 39, 32, 15, +13, 15, 13, 45, 32, 45, 32, 45, 32, 45, 32, 45, 32, 45, 32, 45, 32, 50, 38, 50, 38, 50, 38, 50, 38, +50, 38, 42, 32, 42, 32, 50, 39, 50, 39, 50, 39, 50, 39, 50, 39, 38, 27, 38, 27, 38, 27, 39, 32, 15, +13, 45, 32, 42, 32, 42, 32, 42, 32, 42, 32, 42, 32, 0, 0, 0, 0, 31, 21, 54, 39, 34, 25, 34, 25, +42, 32, 32, 29, 32, 29, 39, 29, 39, 30, 39, 32, 44, 32, 45, 32, 41, 14, 16, 15, 34, 14, 14, 14, 14, +14, 14, 16, 12, 12, 19, 19, 12, 12, 12, 0, 12, 13, 12, 13, 12, 13, 12, 13, 25, 25, 25, 25, 37, 34, +41, 41, 14, 14, 41, 41, 14, 14, 41, 41, 14, 14, 41, 41, 14, 14, 41, 41, 14, 14, 41, 41, 14, 14, 41, +41, 14, 14, 33, 31, 31, 31, 33, 31, 31, 31, 33, 31, 31, 31, 33, 31, 31, 31, 33, 31, 31, 31, 33, 31, +31, 31, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 48, 48, 31, 31, 48, 48, 31, 31, 48, 48, 31, 31, 64, 64, +49, 49, 64, 64, 49, 49, 34, 34, 32, 26, 31, 23, 46, 46, 46, 16, 15, 46, 46, 16, 15, 46, 46, 16, 15, +46, 46, 16, 15, 46, 46, 16, 15, 34, 34, 34, 34, 47, 54, 23, 30, 47, 54, 23, 30, 35, 35, 23, 23, 35, +35, 23, 23, 35, 35, 23, 23, 47, 54, 23, 30, 47, 54, 23, 30, 47, 54, 23, 30, 47, 54, 23, 30, 47, 54, +23, 30, 29, 29, 12, 12, 29, 29, 12, 12, 29, 29, 12, 12, 29, 29, 12, 12, 31, 31, 14, 14, 31, 31, 31, +31, 31, 31, 14, 14, 31, 31, 33, 31, 31, 31, 16, 22, 22, 22, 22, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 37, 34, 37, 34, 14, 14, 25, 25, 37, 34, 14, 14, 37, 34, 47, 47, 47, 47, +12, 0, 0, 0, 0, 0, 0, 0, 65, 63, 0, 0, 0, 0, 0, 0, 11, 21, 0, 0, 35, 0, 0, 0, 48, +48, 31, 31, 64, 64, 49, 49, 32, 26, 31, 23, 24, 20, 16, 14, 19, 14, 14, 14, 14, 14, 47, 54, 14, 0, +20, 29, 32, 35, 32, 35, 32, 35, 32, 35, 32, 35, 32, 35, 32, 35, 31, 31, 32, 35, 67, -122, 50, 0, 19, +19, 22, 24, 37, 37, 60, 45, 13, 22, 22, 26, 39, 19, 22, 19, 19, 37, 37, 37, 37, 37, 37, 37, 37, 37, +37, 19, 19, 39, 39, 39, 37, 68, 45, 45, 48, 48, 45, 41, 52, 48, 19, 34, 45, 37, 55, 48, 52, 45, 52, +48, 45, 41, 48, 45, 66, 43, 45, 41, 19, 19, 19, 30, 37, 22, 37, 37, 34, 37, 37, 19, 37, 37, 15, 15, +34, 15, 57, 37, 37, 37, 37, 22, 34, 19, 37, 33, 47, 32, 33, 33, 22, 17, 22, 39, 45, 45, 48, 45, 48, +52, 48, 37, 37, 37, 37, 37, 37, 34, 37, 37, 37, 37, 18, 18, 18, 18, 37, 37, 37, 37, 37, 37, 37, 37, +37, 37, 37, 27, 37, 37, 37, 23, 36, 41, 49, 49, 67, 22, 22, 37, 67, 52, 48, 37, 37, 37, 37, 39, 33, +48, 55, 37, 20, 25, 24, 51, 60, 41, 41, 22, 39, 37, 37, 37, 41, 37, 37, 67, 45, 45, 52, 67, 63, 37, +67, 22, 22, 15, 15, 37, 33, 33, 45, 11, 37, 22, 22, 34, 34, 37, 19, 15, 22, 67, 45, 45, 45, 45, 45, +19, 19, 19, 19, 52, 52, 52, 48, 48, 48, 18, 22, 20, 22, 22, 22, 22, 22, 22, 22, 22, 37, 15, 45, 34, +41, 33, 17, 48, 37, 45, 33, 45, 37, 39, 39, 22, 22, 22, 56, 56, 56, 37, 52, 37, 19, 45, 34, 48, 34, +48, 34, 37, 37, 22, 45, 37, 45, 37, 48, 41, 48, 45, 37, 45, 37, 37, 15, 37, 20, 37, 22, 48, 37, 48, +37, 52, 37, 48, 22, 48, 22, 45, 34, 41, 19, 41, 25, 48, 37, 48, 37, 41, 33, 41, 33, 37, 52, 53, 39, +37, 30, 41, 26, 43, 37, 34, 24, 73, 67, 34, 67, 34, 67, 34, 34, 66, 48, 39, 40, 39, 40, 40, 47, 42, +47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, +47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 49, 40, 67, 66, 66, +66, 66, 40, 40, 40, 68, 71, 61, 50, 50, 36, 44, 40, 34, 34, 50, 49, 30, 40, 13, 24, 59, 22, 40, 24, +24, 40, 24, 45, 37, 48, 34, 48, 34, 45, 37, 45, 37, 45, 37, 52, 37, 52, 37, 52, 37, 48, 37, 48, 37, +19, 18, 19, 18, 19, 18, 19, 15, 34, 15, 45, 34, 34, 37, 15, 48, 37, 48, 37, 52, 37, 52, 37, 48, 22, +45, 34, 41, 19, 48, 37, 48, 37, 48, 37, 48, 37, 66, 47, 45, 33, 15, 45, 37, 67, 60, 52, 41, 18, 66, +47, 66, 47, 66, 47, 45, 33, 15, 22, 37, 40, 56, 56, 56, 56, 22, 22, 22, 22, 45, 53, 56, 26, 52, 56, +50, 15, 45, 45, 45, 45, 41, 48, 19, 45, 45, 55, 48, 44, 52, 48, 45, 41, 41, 45, 43, 56, 50, 19, 45, +39, 30, 37, 15, 37, 39, 34, 30, 37, 37, 15, 34, 34, 39, 33, 30, 37, 38, 32, 37, 35, 48, 52, 15, 37, +37, 37, 52, 45, 58, 36, 48, 45, 19, 19, 34, 71, 68, 57, 39, 43, 48, 45, 44, 45, 36, 45, 45, 62, 40, +48, 48, 39, 44, 55, 48, 52, 48, 45, 48, 41, 43, 51, 43, 50, 45, 61, 63, 53, 59, 44, 48, 68, 48, 37, +38, 36, 24, 39, 37, 45, 31, 37, 37, 29, 39, 46, 37, 37, 36, 37, 34, 31, 33, 55, 32, 38, 35, 54, 55, +42, 48, 35, 34, 50, 36, 37, 37, 24, 34, 34, 15, 18, 15, 61, 54, 37, 29, 33, 37, 33, 28, 67, 72, 46, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 26, 22, 17, 22, 22, 19, 38, 36, 27, 34, 40, 17, +26, 40, 40, 17, 34, 31, 31, 40, 40, 17, 24, 38, 35, 38, 37, 31, 32, 37, 34, 47, 43, 34, 34, 34, 16, +28, 55, 17, 34, 34, 31, 31, 36, 47, 47, 47, 47, 38, 38, 38, 36, 27, 34, 40, 19, 28, 40, 19, 34, 31, +31, 40, 24, 38, 38, 37, 32, 37, 34, 47, 43, 17, 36, 31, 37, 39, 0, 0, 0, 0, 21, 21, 24, 28, 14, +13, 16, 13, 13, 14, 13, 14, 11, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 21, 35, 50, 50, 19, 50, +35, 35, 35, 50, 50, 50, 50, 50, 14, 50, 50, 50, 50, 50, 50, 50, 50, 43, 50, 50, 50, 48, 48, 16, 16, +50, 50, 50, 50, 38, 35, 36, 36, 33, 33, 54, 62, 26, 34, 54, 62, 26, 34, 43, 39, 50, 50, 50, 50, 50, +50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 15, 14, 14, 14, 14, 50, 50, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 67, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, +50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 21, 21, 50, 41, 28, 14, 15, 14, 15, 29, 29, +14, 15, 43, 39, 16, 16, 14, 15, 48, 48, 16, 16, 19, 25, 48, 48, 16, 16, 48, 48, 16, 16, 38, 35, 36, +36, 38, 35, 36, 36, 38, 35, 36, 36, 23, 23, 23, 23, 33, 33, 33, 33, 55, 55, 36, 36, 55, 55, 36, 36, +74, 74, 57, 57, 74, 74, 57, 57, 39, 39, 39, 39, 39, 39, 39, 39, 36, 30, 35, 26, 36, 30, 35, 26, 53, +53, 18, 18, 39, 39, 18, 18, 40, 40, 26, 26, 34, 34, 14, 14, 23, 23, 26, 26, 35, 35, 16, 16, 19, 25, +30, 26, 29, 29, 43, 39, 43, 39, 16, 16, 36, 40, 36, 40, 36, 40, 36, 40, 50, 50, 13, 13, 50, 50, 50, +11, 14, 50, 50, 14, 16, 50, 50, 50, 14, 14, 14, 14, 14, 15, 50, 13, 13, 50, 50, 50, 50, 50, 50, 50, +50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, +50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 21, 21, 21, +50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 8, +67, -122, 57, 44, 57, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 56, 56, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, +37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, 45, 37, +19, 15, 19, 15, 52, 37, 52, 37, 52, 37, 52, 37, 52, 37, 52, 37, 52, 37, 57, 44, 57, 44, 57, 44, 57, +44, 57, 44, 48, 37, 48, 37, 57, 45, 57, 45, 57, 45, 57, 45, 57, 45, 45, 33, 45, 33, 45, 33, 45, 37, +19, 15, 52, 37, 48, 37, 48, 37, 48, 37, 48, 37, 48, 37, 0, 0, 0, 0, 36, 24, 62, 45, 39, 29, 39, +29, 48, 37, 37, 34, 37, 34, 45, 34, 45, 35, 45, 37, 50, 37, 52, 37, 48, 16, 18, 18, 39, 16, 16, 16, +16, 16, 16, 18, 14, 14, 22, 22, 14, 14, 14, 0, 14, 15, 14, 15, 14, 15, 14, 15, 29, 29, 29, 29, 43, +39, 48, 48, 16, 16, 48, 48, 16, 16, 48, 48, 16, 16, 48, 48, 16, 16, 48, 48, 16, 16, 48, 48, 16, 16, +48, 48, 16, 16, 38, 35, 36, 36, 38, 35, 36, 36, 38, 35, 36, 36, 38, 35, 36, 36, 38, 35, 36, 36, 38, +35, 36, 36, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 33, 33, 33, 33, +33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 55, 55, 36, 36, 55, 55, 36, 36, 55, 55, 36, 36, 74, +74, 57, 57, 74, 74, 57, 57, 39, 39, 36, 30, 35, 26, 53, 53, 53, 18, 18, 53, 53, 18, 18, 53, 53, 18, +18, 53, 53, 18, 18, 53, 53, 18, 18, 39, 39, 39, 39, 54, 62, 26, 34, 54, 62, 26, 34, 40, 40, 26, 26, +40, 40, 26, 26, 40, 40, 26, 26, 54, 62, 26, 34, 54, 62, 26, 34, 54, 62, 26, 34, 54, 62, 26, 34, 54, +62, 26, 34, 34, 34, 14, 14, 34, 34, 14, 14, 34, 34, 14, 14, 34, 34, 14, 14, 35, 35, 16, 16, 35, 35, +35, 35, 35, 35, 16, 16, 35, 35, 38, 35, 36, 36, 19, 25, 26, 26, 26, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 43, 39, 43, 39, 16, 16, 29, 29, 43, 39, 16, 16, 43, 39, 54, 54, 54, +54, 14, 0, 0, 0, 0, 0, 0, 0, 75, 73, 0, 0, 0, 0, 0, 0, 13, 25, 0, 0, 40, 0, 0, 0, +55, 55, 36, 36, 74, 74, 57, 57, 36, 30, 35, 26, 28, 23, 19, 16, 21, 16, 16, 16, 16, 16, 54, 62, 17, +0, 23, 34, 36, 40, 36, 40, 36, 40, 36, 40, 36, 40, 36, 40, 36, 40, 35, 35, 36, 40, 75, -106, 56, 0, +21, 21, 23, 27, 42, 42, 67, 50, 14, 25, 25, 29, 44, 21, 25, 21, 21, 42, 42, 42, 42, 42, 42, 42, 42, +42, 42, 21, 21, 44, 44, 44, 42, 76, 50, 50, 54, 54, 50, 46, 58, 54, 21, 38, 50, 42, 61, 54, 58, 50, +58, 54, 50, 45, 54, 50, 75, 49, 49, 46, 21, 21, 21, 34, 42, 25, 42, 42, 38, 42, 42, 21, 42, 42, 17, +17, 38, 17, 63, 42, 42, 42, 42, 25, 38, 21, 42, 37, 53, 36, 37, 37, 25, 20, 25, 44, 50, 50, 54, 50, +54, 58, 54, 42, 42, 42, 42, 42, 42, 38, 42, 42, 42, 42, 21, 21, 21, 21, 42, 42, 42, 42, 42, 42, 42, +42, 42, 42, 42, 30, 42, 42, 42, 26, 40, 46, 55, 55, 75, 25, 25, 41, 75, 58, 53, 41, 41, 41, 42, 43, +37, 53, 62, 41, 23, 28, 27, 58, 67, 46, 46, 23, 44, 41, 42, 41, 46, 42, 42, 75, 50, 50, 58, 75, 71, +42, 75, 25, 25, 17, 17, 41, 37, 37, 49, 13, 42, 25, 25, 38, 38, 42, 21, 17, 25, 76, 50, 50, 50, 50, +50, 21, 21, 21, 21, 58, 58, 58, 54, 54, 54, 21, 25, 24, 25, 25, 25, 25, 25, 25, 25, 25, 42, 17, 50, +38, 46, 37, 20, 54, 42, 49, 37, 50, 42, 44, 44, 25, 25, 25, 63, 63, 63, 42, 58, 42, 21, 50, 38, 54, +38, 54, 38, 42, 41, 25, 50, 42, 50, 42, 54, 46, 54, 50, 42, 50, 42, 42, 17, 42, 22, 42, 25, 54, 42, +54, 42, 58, 42, 54, 25, 54, 25, 50, 38, 45, 21, 45, 28, 54, 42, 54, 42, 46, 37, 46, 37, 41, 58, 60, +43, 42, 33, 46, 30, 49, 41, 38, 27, 82, 75, 38, 75, 38, 75, 38, 38, 73, 54, 44, 45, 44, 45, 45, 53, +47, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, +53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 55, 45, 75, 74, +74, 74, 74, 45, 45, 45, 77, 79, 69, 56, 56, 40, 49, 45, 38, 38, 56, 55, 33, 45, 14, 27, 66, 24, 45, +27, 27, 45, 27, 50, 42, 54, 38, 54, 38, 50, 42, 50, 42, 50, 42, 58, 42, 58, 42, 58, 42, 54, 42, 54, +42, 21, 21, 21, 21, 21, 21, 21, 17, 38, 17, 50, 38, 38, 42, 17, 54, 42, 54, 42, 58, 42, 58, 42, 54, +25, 50, 38, 46, 21, 54, 42, 54, 42, 54, 42, 54, 42, 75, 53, 49, 37, 17, 50, 42, 75, 67, 58, 46, 21, +75, 53, 75, 53, 75, 53, 49, 37, 17, 25, 42, 45, 63, 63, 63, 63, 25, 25, 25, 25, 50, 59, 63, 29, 58, +62, 56, 17, 50, 50, 50, 50, 46, 54, 21, 50, 50, 61, 54, 49, 58, 54, 50, 46, 45, 49, 49, 63, 56, 21, +49, 43, 33, 42, 17, 41, 43, 38, 33, 42, 42, 17, 38, 38, 43, 37, 34, 42, 43, 36, 41, 39, 53, 59, 17, +41, 42, 41, 59, 50, 65, 41, 54, 50, 21, 21, 38, 79, 76, 64, 44, 48, 54, 50, 49, 50, 41, 51, 50, 69, +45, 54, 54, 44, 49, 61, 54, 58, 54, 50, 54, 45, 48, 57, 49, 55, 50, 69, 70, 59, 66, 49, 54, 76, 54, +42, 43, 40, 27, 44, 42, 50, 34, 42, 42, 33, 44, 52, 41, 42, 41, 42, 38, 34, 37, 62, 36, 43, 39, 60, +62, 47, 54, 39, 38, 56, 41, 42, 42, 27, 38, 38, 17, 21, 17, 68, 61, 42, 33, 37, 41, 37, 31, 75, 80, +52, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 29, 25, 19, 25, 25, 21, 42, 41, 30, 38, 45, +19, 29, 45, 44, 19, 38, 35, 35, 45, 45, 19, 26, 43, 40, 42, 41, 35, 36, 41, 38, 52, 48, 37, 37, 37, +18, 31, 60, 19, 38, 38, 35, 35, 40, 52, 52, 52, 52, 42, 42, 42, 41, 30, 38, 45, 22, 31, 44, 22, 38, +35, 35, 45, 26, 43, 42, 41, 36, 41, 38, 52, 48, 19, 41, 35, 41, 43, 0, 0, 0, 0, 24, 24, 27, 31, +16, 15, 18, 15, 15, 16, 15, 16, 12, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 24, 39, 56, 56, 21, +56, 39, 39, 39, 56, 56, 56, 56, 56, 16, 56, 56, 56, 56, 56, 56, 56, 56, 48, 56, 56, 56, 54, 54, 18, +18, 56, 56, 56, 56, 42, 39, 40, 40, 37, 37, 61, 70, 30, 39, 61, 70, 30, 39, 48, 44, 56, 56, 56, 56, +56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 17, 16, 16, 16, 16, 56, 56, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 75, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, +56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 24, 24, 56, 46, 31, 16, 17, 16, 17, 32, +32, 16, 17, 48, 44, 18, 18, 16, 17, 54, 54, 18, 18, 21, 28, 54, 54, 18, 18, 54, 54, 18, 18, 42, 39, +40, 40, 42, 39, 40, 40, 42, 39, 40, 40, 25, 25, 25, 25, 37, 37, 37, 37, 62, 62, 40, 40, 62, 62, 40, +40, 82, 82, 63, 63, 82, 82, 63, 63, 44, 44, 44, 44, 44, 44, 44, 44, 41, 34, 39, 30, 41, 34, 39, 30, +59, 59, 20, 20, 44, 44, 20, 20, 45, 45, 30, 30, 38, 38, 16, 16, 25, 25, 30, 30, 39, 39, 18, 18, 21, +28, 34, 30, 32, 32, 48, 44, 48, 44, 18, 18, 41, 45, 41, 45, 41, 45, 41, 45, 56, 56, 15, 15, 56, 56, +56, 12, 16, 56, 56, 16, 18, 56, 56, 56, 16, 16, 16, 16, 16, 17, 56, 15, 15, 56, 56, 56, 56, 56, 56, +56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, +56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 24, 24, +24, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, +9, 75, -106, 64, 49, 64, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 63, +63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, +50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, 42, 50, +42, 21, 17, 21, 17, 58, 42, 58, 42, 58, 42, 58, 42, 58, 42, 58, 42, 58, 42, 64, 49, 64, 49, 64, 49, +64, 49, 64, 49, 54, 42, 54, 42, 64, 50, 64, 50, 64, 50, 64, 50, 64, 50, 49, 37, 49, 37, 49, 37, 50, +42, 21, 17, 58, 42, 54, 42, 54, 42, 54, 42, 54, 42, 54, 42, 0, 0, 0, 0, 41, 27, 69, 50, 44, 33, +44, 33, 54, 41, 42, 38, 42, 38, 50, 38, 50, 39, 50, 42, 56, 42, 58, 42, 54, 18, 20, 20, 44, 18, 18, +18, 18, 18, 18, 20, 16, 16, 25, 25, 16, 16, 16, 0, 16, 17, 16, 17, 16, 17, 16, 17, 32, 32, 32, 32, +48, 44, 54, 54, 18, 18, 54, 54, 18, 18, 54, 54, 18, 18, 54, 54, 18, 18, 54, 54, 18, 18, 54, 54, 18, +18, 54, 54, 18, 18, 42, 39, 40, 40, 42, 39, 40, 40, 42, 39, 40, 40, 42, 39, 40, 40, 42, 39, 40, 40, +42, 39, 40, 40, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 37, 37, 37, +37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 62, 62, 40, 40, 62, 62, 40, 40, 62, 62, 40, 40, +82, 82, 63, 63, 82, 82, 63, 63, 44, 44, 41, 34, 39, 30, 59, 59, 59, 20, 20, 59, 59, 20, 20, 59, 59, +20, 20, 59, 59, 20, 20, 59, 59, 20, 20, 44, 44, 44, 44, 61, 70, 30, 39, 61, 70, 30, 39, 45, 45, 30, +30, 45, 45, 30, 30, 45, 45, 30, 30, 61, 70, 30, 39, 61, 70, 30, 39, 61, 70, 30, 39, 61, 70, 30, 39, +61, 70, 30, 39, 38, 38, 16, 16, 38, 38, 16, 16, 38, 38, 16, 16, 38, 38, 16, 16, 39, 39, 18, 18, 39, +39, 39, 39, 39, 39, 18, 18, 39, 39, 42, 39, 40, 40, 21, 28, 29, 29, 29, 32, 32, 32, 32, 32, 32, 32, +32, 32, 32, 32, 32, 32, 32, 32, 32, 48, 44, 48, 44, 18, 18, 32, 32, 48, 44, 18, 18, 48, 44, 61, 61, +61, 61, 16, 0, 0, 0, 0, 0, 0, 0, 84, 81, 0, 0, 0, 0, 0, 0, 15, 28, 0, 0, 45, 0, 0, +0, 62, 62, 40, 40, 82, 82, 63, 63, 41, 34, 39, 30, 31, 25, 21, 18, 24, 18, 18, 18, 18, 18, 61, 70, +19, 0, 26, 37, 41, 45, 41, 45, 41, 45, 41, 45, 41, 45, 41, 45, 41, 45, 39, 39, 41, 45, 83, -90, 62, +0, 23, 23, 25, 29, 46, 46, 74, 55, 16, 28, 28, 32, 48, 23, 28, 23, 23, 46, 46, 46, 46, 46, 46, 46, +46, 46, 46, 23, 23, 48, 48, 48, 46, 84, 55, 55, 60, 60, 55, 51, 65, 60, 23, 42, 55, 46, 69, 60, 65, +55, 65, 60, 55, 52, 60, 55, 83, 56, 54, 51, 23, 23, 23, 38, 46, 28, 46, 46, 42, 46, 46, 24, 46, 46, +18, 19, 43, 18, 71, 46, 46, 46, 46, 28, 42, 23, 46, 41, 59, 42, 39, 40, 28, 20, 28, 48, 55, 55, 60, +55, 60, 65, 60, 46, 46, 46, 46, 46, 46, 42, 46, 46, 46, 46, 23, 23, 23, 23, 46, 46, 46, 46, 46, 46, +46, 46, 46, 46, 46, 33, 46, 46, 46, 29, 45, 51, 61, 61, 83, 28, 28, 46, 83, 65, 59, 46, 46, 46, 46, +48, 41, 59, 68, 46, 23, 31, 30, 64, 74, 51, 51, 25, 48, 46, 46, 46, 50, 46, 46, 83, 55, 55, 65, 83, +78, 46, 83, 28, 28, 18, 18, 46, 41, 39, 54, 14, 46, 28, 28, 42, 42, 46, 23, 18, 28, 83, 55, 55, 55, +55, 55, 23, 23, 23, 23, 65, 65, 65, 60, 60, 60, 23, 28, 24, 28, 28, 28, 28, 28, 28, 28, 28, 46, 18, +55, 42, 51, 40, 20, 60, 46, 54, 39, 55, 46, 48, 48, 28, 28, 28, 69, 69, 69, 46, 65, 46, 23, 55, 42, +60, 42, 60, 42, 46, 46, 28, 55, 46, 55, 46, 60, 51, 60, 55, 46, 55, 46, 46, 18, 46, 24, 46, 28, 60, +46, 60, 46, 65, 46, 60, 28, 60, 28, 55, 42, 52, 24, 52, 31, 60, 46, 60, 46, 51, 40, 51, 40, 46, 65, +66, 48, 46, 37, 51, 33, 54, 46, 42, 30, 90, 83, 42, 83, 42, 83, 42, 42, 81, 60, 48, 50, 48, 50, 50, +59, 52, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, +59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 50, 83, +82, 82, 82, 82, 50, 50, 50, 85, 87, 76, 62, 62, 44, 54, 49, 42, 42, 62, 61, 37, 50, 16, 29, 73, 27, +50, 29, 29, 50, 29, 55, 46, 60, 42, 60, 42, 55, 46, 55, 46, 55, 46, 65, 46, 65, 46, 65, 46, 60, 46, +60, 46, 23, 23, 23, 23, 23, 23, 23, 18, 42, 19, 55, 43, 42, 46, 18, 60, 46, 60, 46, 65, 46, 65, 46, +60, 28, 55, 42, 51, 23, 60, 46, 60, 46, 60, 46, 60, 46, 83, 59, 54, 39, 18, 55, 46, 83, 74, 65, 51, +21, 83, 59, 83, 59, 83, 59, 54, 39, 18, 28, 46, 50, 69, 69, 69, 69, 28, 28, 28, 28, 55, 65, 70, 32, +64, 68, 62, 18, 55, 55, 55, 55, 51, 60, 23, 55, 55, 69, 60, 54, 65, 60, 55, 51, 52, 54, 56, 69, 62, +23, 54, 48, 37, 46, 18, 45, 48, 42, 37, 46, 46, 18, 42, 42, 48, 41, 37, 46, 47, 40, 45, 44, 59, 65, +18, 45, 46, 45, 65, 55, 72, 45, 60, 55, 23, 23, 42, 88, 84, 71, 48, 53, 60, 55, 54, 55, 45, 56, 55, +77, 50, 60, 60, 48, 54, 69, 60, 65, 60, 55, 60, 52, 53, 63, 56, 61, 55, 76, 78, 66, 73, 54, 60, 84, +60, 46, 48, 44, 30, 48, 46, 56, 38, 46, 46, 36, 48, 57, 46, 46, 45, 46, 42, 38, 39, 68, 42, 48, 43, +67, 68, 52, 60, 43, 42, 62, 45, 46, 46, 30, 42, 42, 18, 23, 19, 75, 67, 46, 36, 39, 46, 41, 34, 83, +89, 57, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 32, 28, 20, 28, 28, 23, 47, 45, 33, 42, +50, 20, 32, 50, 49, 20, 42, 38, 38, 50, 50, 20, 29, 48, 44, 47, 45, 38, 40, 46, 42, 58, 53, 41, 41, +41, 20, 35, 67, 20, 42, 42, 38, 38, 44, 58, 58, 58, 58, 47, 47, 47, 45, 33, 42, 50, 24, 34, 49, 24, +42, 38, 38, 50, 29, 48, 47, 45, 40, 46, 42, 58, 53, 20, 45, 38, 45, 48, 0, 0, 0, 0, 26, 26, 30, +34, 17, 17, 20, 17, 17, 17, 17, 18, 14, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 26, 44, 62, 62, +23, 62, 44, 44, 44, 62, 62, 62, 62, 62, 18, 62, 62, 62, 62, 62, 62, 62, 62, 53, 62, 62, 62, 59, 59, +20, 20, 62, 62, 62, 62, 47, 44, 44, 44, 41, 41, 67, 77, 33, 43, 67, 77, 33, 43, 53, 49, 62, 62, 62, +62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 19, 18, 18, 18, 18, 62, 62, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 83, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, +62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 26, 26, 62, 51, 34, 17, 19, 17, 19, +36, 36, 17, 19, 53, 49, 20, 20, 17, 19, 59, 59, 20, 20, 23, 31, 59, 59, 20, 20, 59, 59, 20, 20, 47, +44, 44, 44, 47, 44, 44, 44, 47, 44, 44, 44, 28, 28, 28, 28, 41, 41, 41, 41, 68, 68, 44, 44, 68, 68, +44, 44, 91, 91, 70, 70, 91, 91, 70, 70, 48, 48, 48, 48, 48, 48, 48, 48, 45, 37, 44, 33, 45, 37, 44, +33, 65, 65, 22, 22, 48, 48, 22, 22, 50, 50, 33, 33, 42, 42, 17, 17, 28, 28, 33, 33, 44, 44, 20, 20, +23, 31, 37, 33, 36, 36, 53, 49, 53, 49, 20, 20, 45, 50, 45, 50, 45, 50, 45, 50, 62, 62, 17, 17, 62, +62, 62, 14, 18, 62, 62, 17, 20, 62, 62, 62, 18, 18, 18, 18, 18, 19, 62, 17, 17, 62, 62, 62, 62, 62, +62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, +62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 26, +26, 26, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, +62, 10, 83, -90, 71, 54, 71, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, +69, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, +46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, 55, 46, +55, 46, 23, 18, 23, 18, 65, 46, 65, 46, 65, 46, 65, 46, 65, 46, 65, 46, 65, 46, 71, 54, 71, 54, 71, +54, 71, 54, 71, 54, 60, 46, 60, 46, 71, 56, 71, 56, 71, 56, 71, 56, 71, 56, 54, 39, 54, 39, 54, 39, +55, 46, 23, 18, 65, 46, 60, 46, 60, 46, 60, 46, 60, 46, 60, 46, 0, 0, 0, 0, 45, 30, 77, 56, 48, +36, 48, 36, 60, 46, 46, 42, 46, 42, 55, 42, 55, 43, 55, 46, 62, 46, 65, 46, 59, 20, 22, 22, 48, 20, +20, 20, 20, 20, 20, 22, 17, 17, 28, 28, 17, 17, 17, 0, 17, 19, 17, 19, 17, 19, 17, 19, 36, 36, 36, +36, 53, 49, 59, 59, 20, 20, 59, 59, 20, 20, 59, 59, 20, 20, 59, 59, 20, 20, 59, 59, 20, 20, 59, 59, +20, 20, 59, 59, 20, 20, 47, 44, 44, 44, 47, 44, 44, 44, 47, 44, 44, 44, 47, 44, 44, 44, 47, 44, 44, +44, 47, 44, 44, 44, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 41, 41, +41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 68, 68, 44, 44, 68, 68, 44, 44, 68, 68, 44, +44, 91, 91, 70, 70, 91, 91, 70, 70, 48, 48, 45, 37, 44, 33, 65, 65, 65, 22, 22, 65, 65, 22, 22, 65, +65, 22, 22, 65, 65, 22, 22, 65, 65, 22, 22, 48, 48, 48, 48, 67, 77, 33, 43, 67, 77, 33, 43, 50, 50, +33, 33, 50, 50, 33, 33, 50, 50, 33, 33, 67, 77, 33, 43, 67, 77, 33, 43, 67, 77, 33, 43, 67, 77, 33, +43, 67, 77, 33, 43, 42, 42, 17, 17, 42, 42, 17, 17, 42, 42, 17, 17, 42, 42, 17, 17, 44, 44, 20, 20, +44, 44, 44, 44, 44, 44, 20, 20, 44, 44, 47, 44, 44, 44, 23, 31, 32, 32, 32, 36, 36, 36, 36, 36, 36, +36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 53, 49, 53, 49, 20, 20, 36, 36, 53, 49, 20, 20, 53, 49, 67, +67, 67, 67, 17, 0, 0, 0, 0, 0, 0, 0, 93, 90, 0, 0, 0, 0, 0, 0, 16, 31, 0, 0, 50, 0, +0, 0, 68, 68, 44, 44, 91, 91, 70, 70, 45, 37, 44, 33, 34, 28, 23, 20, 27, 20, 20, 20, 20, 20, 67, +77, 20, 0, 28, 41, 45, 50, 45, 50, 45, 50, 45, 50, 45, 50, 45, 50, 45, 50, 44, 44, 45, 50, 92, -72, +69, 0, 26, 26, 26, 33, 51, 51, 82, 61, 18, 31, 31, 36, 54, 26, 31, 26, 26, 51, 51, 51, 51, 51, 51, +51, 51, 51, 51, 26, 26, 54, 54, 54, 51, 93, 61, 61, 66, 66, 61, 56, 72, 66, 26, 46, 61, 51, 75, 66, +72, 61, 72, 66, 61, 57, 66, 61, 91, 62, 61, 56, 26, 26, 26, 41, 51, 31, 51, 51, 46, 51, 51, 27, 52, +51, 20, 21, 47, 20, 77, 51, 51, 51, 52, 31, 46, 26, 51, 45, 65, 45, 45, 45, 31, 23, 31, 54, 61, 61, +66, 61, 66, 72, 66, 51, 51, 51, 51, 51, 51, 46, 51, 51, 51, 51, 24, 24, 24, 24, 51, 51, 51, 51, 51, +51, 51, 51, 51, 51, 51, 37, 51, 51, 51, 32, 49, 56, 68, 68, 92, 31, 31, 51, 92, 72, 66, 51, 51, 51, +51, 53, 45, 66, 76, 51, 25, 34, 34, 71, 82, 56, 56, 28, 54, 50, 51, 51, 57, 51, 51, 92, 61, 61, 72, +92, 87, 51, 92, 31, 31, 20, 20, 51, 45, 45, 61, 15, 51, 31, 31, 46, 46, 51, 26, 20, 31, 93, 61, 61, +61, 61, 61, 26, 26, 26, 26, 72, 72, 72, 66, 66, 66, 24, 31, 28, 31, 31, 31, 31, 31, 31, 31, 31, 51, +20, 61, 46, 56, 45, 23, 66, 51, 61, 45, 61, 51, 54, 54, 31, 31, 31, 77, 77, 77, 51, 72, 52, 26, 61, +46, 66, 46, 66, 46, 51, 51, 31, 61, 51, 61, 51, 66, 57, 66, 61, 51, 61, 51, 51, 20, 51, 27, 51, 31, +66, 51, 66, 51, 72, 51, 66, 31, 66, 31, 61, 46, 57, 26, 57, 35, 66, 51, 66, 51, 56, 45, 56, 45, 51, +72, 73, 53, 51, 41, 57, 36, 60, 51, 46, 34, 100, 92, 46, 92, 46, 92, 46, 46, 90, 66, 54, 56, 54, 56, +56, 65, 58, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, +65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 56, +92, 91, 91, 91, 91, 56, 56, 56, 94, 97, 84, 69, 69, 49, 60, 55, 47, 46, 69, 68, 41, 56, 17, 33, 81, +30, 56, 33, 33, 56, 33, 61, 51, 66, 46, 66, 46, 61, 51, 61, 51, 61, 51, 72, 52, 72, 52, 72, 51, 66, +51, 66, 51, 26, 24, 26, 24, 26, 24, 26, 20, 46, 21, 61, 47, 46, 51, 20, 66, 51, 67, 51, 72, 51, 72, +51, 66, 31, 61, 46, 56, 26, 66, 51, 66, 51, 66, 51, 66, 51, 91, 65, 61, 45, 20, 61, 51, 92, 82, 72, +56, 24, 91, 65, 91, 65, 91, 65, 61, 45, 20, 31, 51, 55, 77, 77, 77, 77, 31, 31, 31, 31, 61, 72, 77, +35, 71, 77, 69, 20, 61, 61, 61, 61, 56, 66, 26, 61, 61, 75, 66, 60, 72, 66, 61, 57, 57, 61, 62, 77, +69, 26, 61, 53, 41, 51, 20, 50, 53, 46, 41, 51, 51, 20, 46, 46, 53, 45, 41, 51, 52, 44, 50, 48, 66, +72, 20, 50, 51, 50, 72, 61, 80, 50, 66, 61, 26, 26, 46, 97, 93, 79, 54, 58, 66, 61, 60, 61, 50, 62, +61, 85, 56, 66, 66, 54, 60, 75, 66, 72, 66, 61, 66, 57, 58, 70, 62, 68, 61, 84, 86, 73, 81, 60, 66, +93, 66, 51, 53, 49, 34, 54, 51, 62, 42, 51, 51, 40, 54, 63, 51, 51, 50, 51, 46, 42, 45, 76, 45, 53, +48, 74, 76, 58, 66, 48, 47, 69, 50, 51, 51, 34, 47, 46, 20, 24, 21, 83, 75, 51, 40, 45, 51, 45, 38, +92, 99, 63, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 35, 31, 20, 31, 31, 26, 52, 50, 37, +47, 55, 23, 35, 55, 54, 23, 47, 42, 43, 55, 55, 23, 32, 53, 49, 52, 50, 42, 44, 51, 47, 64, 59, 46, +46, 46, 22, 38, 76, 23, 47, 47, 43, 43, 49, 64, 64, 64, 64, 52, 52, 52, 50, 37, 47, 55, 26, 38, 54, +26, 47, 42, 43, 55, 32, 53, 52, 50, 44, 51, 47, 64, 59, 23, 50, 42, 50, 53, 0, 0, 0, 0, 29, 29, +33, 38, 19, 19, 22, 19, 19, 19, 19, 19, 15, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 29, 48, 69, +69, 26, 69, 48, 48, 48, 69, 69, 69, 69, 69, 19, 69, 69, 69, 69, 69, 69, 69, 69, 59, 69, 69, 69, 66, +66, 22, 22, 69, 69, 69, 69, 52, 48, 49, 49, 45, 45, 75, 86, 36, 47, 75, 86, 36, 47, 59, 54, 69, 69, +69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 21, 19, 19, 19, 19, 69, 69, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 92, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, +69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 29, 29, 69, 57, 38, 19, 21, 19, +21, 40, 40, 19, 21, 59, 54, 22, 22, 19, 21, 66, 66, 22, 22, 26, 35, 66, 66, 22, 22, 66, 66, 22, 22, +52, 48, 49, 49, 52, 48, 49, 49, 52, 48, 49, 49, 31, 31, 31, 31, 45, 45, 45, 45, 76, 76, 49, 49, 76, +76, 49, 49, 101, 101, 78, 78, 101, 101, 78, 78, 54, 54, 54, 54, 54, 54, 54, 54, 50, 41, 48, 36, 50, 41, +48, 36, 73, 73, 25, 24, 54, 54, 25, 24, 55, 55, 36, 36, 47, 47, 19, 19, 31, 31, 36, 36, 48, 48, 22, +22, 26, 35, 41, 36, 40, 40, 59, 54, 59, 54, 22, 22, 50, 55, 50, 55, 50, 55, 50, 55, 69, 69, 19, 19, +69, 69, 69, 15, 19, 69, 69, 19, 22, 69, 69, 69, 19, 19, 19, 19, 19, 21, 69, 19, 19, 69, 69, 69, 69, +69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, +69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, +29, 29, 29, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, +69, 69, 12, 92, -72, 79, 60, 79, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +47, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, +61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, 51, 61, +51, 61, 51, 26, 20, 26, 20, 72, 51, 72, 51, 72, 51, 72, 51, 72, 51, 72, 51, 72, 51, 79, 60, 79, 60, +79, 60, 79, 60, 79, 60, 66, 51, 66, 51, 79, 62, 79, 62, 79, 62, 79, 62, 79, 62, 61, 45, 61, 45, 61, +45, 61, 51, 26, 20, 72, 51, 66, 51, 66, 51, 66, 51, 66, 51, 66, 51, 0, 0, 0, 0, 50, 34, 85, 62, +54, 40, 54, 40, 66, 51, 51, 46, 51, 46, 61, 46, 61, 48, 61, 51, 69, 51, 72, 51, 66, 22, 25, 24, 54, +22, 22, 22, 22, 22, 22, 25, 19, 19, 31, 31, 19, 19, 19, 0, 19, 21, 19, 21, 19, 21, 19, 21, 40, 40, +40, 40, 59, 54, 66, 66, 22, 22, 66, 66, 22, 22, 66, 66, 22, 22, 66, 66, 22, 22, 66, 66, 22, 22, 66, +66, 22, 22, 66, 66, 22, 22, 52, 48, 49, 49, 52, 48, 49, 49, 52, 48, 49, 49, 52, 48, 49, 49, 52, 48, +49, 49, 52, 48, 49, 49, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 45, +45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 76, 76, 49, 49, 76, 76, 49, 49, 76, 76, +49, 49, 101, 101, 78, 78, 101, 101, 78, 78, 54, 54, 50, 41, 48, 36, 73, 73, 73, 25, 24, 73, 73, 25, 24, +73, 73, 25, 24, 73, 73, 25, 24, 73, 73, 25, 24, 54, 54, 54, 54, 75, 86, 36, 47, 75, 86, 36, 47, 55, +55, 36, 36, 55, 55, 36, 36, 55, 55, 36, 36, 75, 86, 36, 47, 75, 86, 36, 47, 75, 86, 36, 47, 75, 86, +36, 47, 75, 86, 36, 47, 47, 47, 19, 19, 47, 47, 19, 19, 47, 47, 19, 19, 47, 47, 19, 19, 48, 48, 22, +22, 48, 48, 48, 48, 48, 48, 22, 22, 48, 48, 52, 48, 49, 49, 26, 35, 36, 36, 36, 40, 40, 40, 40, 40, +40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 59, 54, 59, 54, 22, 22, 40, 40, 59, 54, 22, 22, 59, 54, +75, 75, 75, 75, 19, 0, 0, 0, 0, 0, 0, 0, 103, 100, 0, 0, 0, 0, 0, 0, 18, 34, 0, 0, 55, +0, 0, 0, 76, 76, 49, 49, 101, 101, 78, 78, 50, 41, 48, 36, 38, 31, 26, 22, 29, 22, 22, 22, 22, 22, +75, 86, 23, 0, 31, 46, 50, 55, 50, 55, 50, 55, 50, 55, 50, 55, 50, 55, 50, 55, 48, 48, 50, 55, 100, +-56, 75, 0, 28, 28, 28, 36, 56, 56, 89, 67, 19, 33, 33, 39, 58, 28, 33, 28, 28, 56, 56, 56, 56, 56, +56, 56, 56, 56, 56, 28, 28, 58, 58, 58, 56, 102, 67, 67, 72, 72, 67, 61, 78, 72, 28, 50, 67, 56, 83, +72, 78, 67, 78, 72, 67, 62, 72, 67, 99, 66, 66, 61, 28, 28, 28, 43, 56, 33, 56, 56, 50, 56, 56, 29, +55, 56, 22, 22, 50, 22, 84, 56, 56, 56, 55, 33, 50, 28, 56, 49, 71, 49, 49, 49, 33, 26, 33, 58, 67, +67, 72, 67, 72, 78, 72, 56, 56, 56, 56, 56, 56, 50, 56, 56, 56, 56, 27, 27, 27, 27, 56, 56, 56, 56, +56, 56, 56, 56, 56, 56, 56, 40, 56, 56, 56, 35, 54, 61, 74, 74, 100, 33, 33, 55, 100, 78, 71, 55, 55, +55, 56, 58, 49, 71, 82, 55, 29, 37, 37, 77, 89, 61, 61, 31, 58, 55, 56, 55, 61, 56, 56, 100, 67, 67, +78, 100, 94, 56, 100, 33, 33, 22, 22, 55, 49, 49, 66, 17, 56, 33, 33, 50, 50, 56, 28, 22, 33, 100, 67, +67, 67, 67, 67, 28, 28, 28, 28, 78, 78, 78, 72, 72, 72, 27, 33, 31, 33, 33, 33, 33, 33, 33, 33, 33, +56, 22, 67, 50, 61, 49, 26, 72, 56, 66, 49, 67, 56, 58, 58, 33, 33, 33, 83, 83, 83, 56, 78, 55, 28, +67, 50, 72, 50, 72, 50, 56, 55, 33, 67, 56, 67, 56, 72, 61, 72, 67, 56, 67, 56, 56, 22, 56, 29, 56, +33, 72, 56, 72, 56, 78, 56, 72, 33, 72, 33, 67, 50, 62, 29, 62, 38, 72, 56, 72, 56, 61, 49, 61, 49, +55, 78, 80, 58, 56, 45, 62, 40, 65, 55, 50, 36, 109, 100, 50, 100, 50, 100, 50, 50, 98, 72, 58, 60, 58, +60, 60, 71, 63, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, +71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 73, +60, 100, 99, 99, 99, 99, 60, 60, 60, 102, 105, 92, 75, 75, 53, 66, 59, 51, 50, 75, 73, 44, 60, 19, 35, +89, 32, 60, 35, 35, 60, 35, 67, 56, 72, 50, 72, 50, 67, 56, 67, 56, 67, 56, 78, 55, 78, 55, 78, 56, +72, 56, 72, 56, 28, 27, 28, 27, 28, 27, 28, 22, 50, 22, 67, 50, 50, 56, 22, 72, 56, 72, 56, 78, 56, +78, 56, 72, 33, 67, 50, 61, 28, 72, 56, 72, 56, 72, 56, 72, 56, 99, 71, 66, 49, 22, 67, 56, 100, 89, +78, 61, 27, 99, 71, 99, 71, 99, 71, 66, 49, 22, 33, 56, 60, 83, 83, 83, 83, 33, 33, 33, 33, 67, 78, +84, 38, 77, 83, 75, 23, 67, 67, 67, 67, 61, 72, 28, 67, 67, 83, 72, 65, 78, 72, 67, 62, 62, 66, 66, +84, 75, 28, 66, 58, 45, 56, 23, 55, 58, 50, 44, 56, 56, 23, 50, 50, 58, 49, 45, 56, 57, 48, 55, 52, +71, 78, 23, 55, 56, 55, 78, 67, 86, 54, 72, 67, 28, 28, 50, 106, 101, 85, 58, 64, 72, 67, 66, 67, 54, +68, 67, 92, 60, 72, 72, 58, 66, 83, 72, 78, 72, 67, 72, 62, 64, 76, 66, 74, 67, 92, 94, 79, 89, 66, +72, 101, 72, 56, 57, 53, 36, 58, 56, 67, 46, 56, 56, 44, 58, 69, 55, 56, 54, 56, 50, 46, 49, 82, 49, +57, 52, 80, 82, 63, 72, 52, 51, 75, 54, 56, 56, 36, 51, 50, 22, 27, 22, 91, 81, 56, 44, 49, 55, 49, +41, 100, 107, 69, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 38, 33, 27, 33, 33, 28, 56, 54, +40, 51, 60, 24, 38, 60, 59, 24, 51, 46, 46, 60, 60, 24, 35, 57, 53, 57, 55, 46, 48, 55, 51, 69, 64, +49, 49, 49, 24, 42, 79, 24, 51, 51, 46, 46, 54, 69, 69, 69, 69, 56, 56, 56, 54, 40, 51, 60, 29, 41, +59, 29, 51, 46, 46, 60, 35, 57, 57, 55, 48, 55, 51, 69, 64, 24, 54, 46, 55, 58, 0, 0, 0, 0, 32, +32, 36, 41, 21, 20, 24, 20, 20, 21, 20, 21, 16, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 32, 53, +75, 75, 28, 75, 53, 53, 53, 75, 75, 75, 75, 75, 21, 75, 75, 75, 75, 75, 75, 75, 75, 64, 75, 75, 75, +71, 71, 24, 24, 75, 75, 75, 75, 56, 53, 53, 53, 49, 49, 81, 93, 39, 51, 81, 93, 39, 51, 64, 59, 75, +75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 23, 21, 21, 21, 21, 75, 75, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 100, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, +75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 32, 32, 75, 62, 41, 21, 23, +21, 23, 43, 43, 21, 23, 64, 59, 24, 24, 21, 23, 71, 71, 24, 24, 28, 38, 71, 71, 24, 24, 71, 71, 24, +24, 56, 53, 53, 53, 56, 53, 53, 53, 56, 53, 53, 53, 34, 34, 34, 34, 49, 49, 49, 49, 82, 82, 53, 53, +82, 82, 53, 53, 110, 110, 85, 85, 110, 110, 85, 85, 58, 58, 58, 58, 58, 58, 58, 58, 54, 45, 53, 39, 54, +45, 53, 39, 79, 79, 27, 26, 58, 58, 27, 26, 60, 60, 39, 39, 51, 51, 21, 21, 34, 34, 39, 39, 53, 53, +24, 24, 28, 38, 45, 39, 43, 43, 64, 59, 64, 59, 24, 24, 54, 60, 54, 60, 54, 60, 54, 60, 75, 75, 20, +20, 75, 75, 75, 16, 21, 75, 75, 21, 24, 75, 75, 75, 21, 21, 21, 21, 21, 23, 75, 20, 20, 75, 75, 75, +75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, +75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, +75, 32, 32, 32, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, +75, 75, 75, 13, 100, -56, 86, 66, 85, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 51, 83, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, +56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, 67, 56, +67, 56, 67, 56, 28, 22, 28, 22, 78, 56, 78, 56, 78, 56, 78, 56, 78, 56, 78, 56, 78, 56, 86, 66, 86, +66, 86, 66, 86, 66, 86, 66, 72, 56, 72, 56, 85, 67, 85, 67, 85, 67, 85, 67, 85, 67, 66, 49, 66, 49, +66, 49, 67, 56, 28, 22, 78, 56, 72, 56, 72, 56, 72, 56, 72, 56, 72, 56, 0, 0, 0, 0, 54, 36, 92, +67, 58, 44, 58, 44, 72, 55, 56, 50, 56, 50, 67, 50, 67, 52, 67, 56, 75, 56, 78, 56, 71, 24, 27, 26, +58, 24, 24, 24, 24, 24, 24, 27, 21, 21, 33, 33, 21, 21, 21, 0, 21, 23, 21, 23, 21, 23, 21, 23, 43, +43, 43, 43, 64, 59, 71, 71, 24, 24, 71, 71, 24, 24, 71, 71, 24, 24, 71, 71, 24, 24, 71, 71, 24, 24, +71, 71, 24, 24, 71, 71, 24, 24, 56, 53, 53, 53, 56, 53, 53, 53, 56, 53, 53, 53, 56, 53, 53, 53, 56, +53, 53, 53, 56, 53, 53, 53, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, +49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 82, 82, 53, 53, 82, 82, 53, 53, 82, +82, 53, 53, 110, 110, 85, 85, 110, 110, 85, 85, 58, 58, 54, 45, 53, 39, 79, 79, 79, 27, 26, 79, 79, 27, +26, 79, 79, 27, 26, 79, 79, 27, 26, 79, 79, 27, 26, 58, 58, 58, 58, 81, 93, 39, 51, 81, 93, 39, 51, +60, 60, 39, 39, 60, 60, 39, 39, 60, 60, 39, 39, 81, 93, 39, 51, 81, 93, 39, 51, 81, 93, 39, 51, 81, +93, 39, 51, 81, 93, 39, 51, 51, 51, 21, 21, 51, 51, 21, 21, 51, 51, 21, 21, 51, 51, 21, 21, 53, 53, +24, 24, 53, 53, 53, 53, 53, 53, 24, 24, 53, 53, 56, 53, 53, 53, 28, 38, 39, 39, 39, 43, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 64, 59, 64, 59, 24, 24, 43, 43, 64, 59, 24, 24, 64, +59, 81, 81, 81, 81, 21, 0, 0, 0, 0, 0, 0, 0, 112, 108, 0, 0, 0, 0, 0, 0, 19, 37, 0, 0, +60, 0, 0, 0, 82, 82, 53, 53, 110, 110, 85, 85, 54, 45, 53, 39, 41, 34, 28, 24, 32, 24, 24, 24, 24, +24, 81, 93, 24, 0, 34, 49, 54, 60, 54, 60, 54, 60, 54, 60, 54, 60, 54, 60, 54, 60, 53, 53, 54, 60, +0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 28, 0, 1, 0, 0, 0, 0, 11, 64, 0, 3, 0, 1, 0, +0, 12, 70, 0, 4, 11, 36, 0, 0, 1, 28, 1, 0, 0, 7, 0, 28, 0, 126, 1, 127, 1, -113, 1, -110, +1, -95, 1, -80, 1, -36, 1, -1, 2, 89, 2, -57, 2, -55, 2, -35, 3, 1, 3, 3, 3, 9, 3, 35, 3, +126, 3, -118, 3, -116, 3, -95, 3, -50, 4, 12, 4, 79, 4, 92, 4, 95, 4, -109, 4, -105, 4, -99, 4, -93, +4, -77, 4, -69, 4, -39, 4, -23, 5, -61, 5, -22, 5, -12, 6, 12, 6, 27, 6, 31, 6, 58, 6, 85, 6, +-19, 6, -2, 30, -123, 30, -7, 32, 15, 32, 21, 32, 30, 32, 34, 32, 38, 32, 46, 32, 48, 32, 51, 32, 58, +32, 60, 32, 62, 32, 68, 32, 111, 32, 127, 32, -92, 32, -89, 32, -84, 33, 5, 33, 19, 33, 22, 33, 34, 33, +38, 33, 46, 33, 84, 33, 94, 33, -107, 33, -88, 34, 2, 34, 6, 34, 15, 34, 18, 34, 21, 34, 26, 34, 31, +34, 41, 34, 43, 34, 72, 34, 97, 34, 101, 35, 2, 35, 16, 35, 33, 37, 0, 37, 2, 37, 12, 37, 16, 37, +20, 37, 24, 37, 28, 37, 36, 37, 44, 37, 52, 37, 60, 37, 108, 37, -128, 37, -124, 37, -120, 37, -116, 37, -109, +37, -95, 37, -84, 37, -78, 37, -70, 37, -68, 37, -60, 37, -53, 37, -49, 37, -39, 37, -26, 38, 60, 38, 64, 38, +66, 38, 96, 38, 99, 38, 102, 38, 107, -24, 5, -24, 24, -24, 58, -16, 2, -16, 49, -5, 2, -5, 32, -5, 54, +-5, 60, -5, 62, -5, 65, -5, 68, -5, -79, -5, -25, -5, -1, -4, 98, -3, 63, -3, -14, -2, -4, -1, -4, -1, +-1, 0, 0, 0, 32, 0, -96, 1, -113, 1, -110, 1, -96, 1, -81, 1, -51, 1, -6, 2, 89, 2, -58, 2, -55, +2, -40, 3, 0, 3, 3, 3, 9, 3, 35, 3, 126, 3, -124, 3, -116, 3, -114, 3, -93, 4, 1, 4, 14, 4, +81, 4, 94, 4, -112, 4, -106, 4, -102, 4, -94, 4, -82, 4, -72, 4, -40, 4, -24, 5, -80, 5, -48, 5, -16, +6, 12, 6, 27, 6, 31, 6, 33, 6, 64, 6, 96, 6, -16, 30, -128, 30, -96, 32, 12, 32, 19, 32, 23, 32, +32, 32, 38, 32, 42, 32, 48, 32, 50, 32, 57, 32, 60, 32, 62, 32, 68, 32, 106, 32, 127, 32, -93, 32, -89, +32, -86, 33, 5, 33, 19, 33, 22, 33, 34, 33, 38, 33, 46, 33, 83, 33, 91, 33, -112, 33, -88, 34, 2, 34, +6, 34, 15, 34, 17, 34, 21, 34, 25, 34, 30, 34, 41, 34, 43, 34, 72, 34, 96, 34, 100, 35, 2, 35, 16, +35, 32, 37, 0, 37, 2, 37, 12, 37, 16, 37, 20, 37, 24, 37, 28, 37, 36, 37, 44, 37, 52, 37, 60, 37, +80, 37, -128, 37, -124, 37, -120, 37, -116, 37, -112, 37, -96, 37, -86, 37, -78, 37, -70, 37, -68, 37, -60, 37, -54, +37, -49, 37, -40, 37, -26, 38, 58, 38, 64, 38, 66, 38, 96, 38, 99, 38, 101, 38, 106, -24, 1, -24, 24, -24, +58, -16, 1, -16, 4, -5, 1, -5, 29, -5, 42, -5, 56, -5, 62, -5, 64, -5, 67, -5, 70, -5, -45, -5, -4, +-4, 94, -3, 62, -3, -14, -2, -128, -1, -4, -1, -1, -1, -29, 0, 0, 3, -107, -1, 20, 2, -54, 2, -67, 3, +47, -1, -36, 2, -52, 0, 0, -2, 15, 0, 0, 1, -110, 1, 119, 1, 107, 1, 114, -4, -96, 0, 0, -2, 105, +0, 0, 0, 0, -2, 43, -2, 42, -2, 41, -2, 40, 0, 0, 0, 124, 0, 122, 0, 118, 0, 108, 0, 104, 0, +76, 0, 62, 0, 0, -4, -48, -4, -53, -4, -32, -4, -46, -4, -49, 0, 0, 0, 0, 0, 0, 0, 0, -29, 93, +0, 0, -30, -36, 0, 0, 0, 0, 0, 0, -32, -123, 0, 0, -32, -107, -31, 91, -32, -124, -32, -7, -31, -88, -32, +119, 0, 0, -32, -73, 0, 0, -32, -112, 0, 0, -32, -118, -32, 125, -31, 117, -33, 106, -33, 121, -32, -70, -29, 44, +-32, -114, -33, -88, -33, -106, -34, -106, -34, -94, -34, -117, 0, 0, -34, -90, 0, 0, 0, 0, -33, 23, -34, 113, -34, +95, 0, 0, -34, 48, -34, 64, -34, 51, -34, 36, -36, 70, -36, 69, -36, 60, -36, 57, -36, 54, -36, 51, -36, 48, +-36, 41, -36, 34, -36, 27, -36, 20, -36, 1, -37, -18, -37, -21, -37, -24, -37, -27, -37, -30, 0, 0, 0, 0, -37, +-58, -37, -65, -37, -66, -37, -73, 0, 0, -37, -59, -37, -91, -37, -81, -37, 69, -37, 66, -37, 65, -37, 36, -37, 34, +-37, 33, -37, 30, 26, -64, 26, -6, 26, -31, 16, -66, 0, 0, 5, -66, 0, 0, 7, -99, 7, -100, 7, -101, 7, +-102, 7, -103, 0, 0, 0, 0, 0, 0, 6, -23, 6, 62, 5, -115, 5, 0, 3, 99, 0, 1, 0, 0, 1, 26, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -54, 0, 0, 2, -54, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 2, -54, 0, 0, 2, -44, 2, -6, 0, 0, 0, 0, 0, 0, 0, 0, 3, 72, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, +92, 3, -114, 3, -72, 4, -46, 0, 0, 4, -20, 0, 0, 5, -100, 5, -96, 5, -82, 0, 0, 5, -80, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -84, 0, 0, 5, -76, 0, 0, 5, -76, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -98, 0, 0, +5, -98, 5, -96, 0, 0, 0, 0, 0, 0, 5, -100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 5, 116, 5, 118, 0, 0, 0, 0, 0, 0, 0, 0, 5, 114, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 88, 0, 0, +5, -80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -84, 6, -126, 6, -86, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 3, 0, -93, 0, -124, 0, -123, 3, 94, 0, -106, 0, -26, 0, -122, 0, -114, 0, -117, +0, -99, 0, -87, 0, -92, 0, 16, 0, -118, 1, 0, 0, -125, 0, -109, 0, -16, 0, -15, 0, -115, 0, -105, 0, +-120, 0, -62, 0, -36, 0, -17, 0, -98, 0, -86, 0, -13, 0, -14, 0, -12, 0, -94, 0, -84, 0, -56, 0, -58, +0, -83, 0, 98, 0, 99, 0, -112, 0, 100, 0, -54, 0, 101, 0, -57, 0, -55, 0, -50, 0, -53, 0, -52, 0, +-51, 0, -25, 0, 102, 0, -47, 0, -49, 0, -48, 0, -82, 0, 103, 0, -18, 0, -111, 0, -44, 0, -46, 0, -45, +0, 104, 0, -23, 0, -21, 0, -119, 0, 106, 0, 105, 0, 107, 0, 109, 0, 108, 0, 110, 0, -96, 0, 111, 0, +113, 0, 112, 0, 114, 0, 115, 0, 117, 0, 116, 0, 118, 0, 119, 0, -24, 0, 120, 0, 122, 0, 121, 0, 123, +0, 125, 0, 124, 0, -73, 0, -95, 0, 127, 0, 126, 0, -128, 0, -127, 0, -22, 0, -20, 0, -71, 1, -106, 1, +-105, 1, 2, 1, 3, 1, 4, 1, 5, 0, -5, 0, -4, 1, -104, 1, -103, 1, -102, 1, -101, 0, -3, 0, -2, +1, 6, 1, 7, 1, 8, 0, -1, 1, -100, 1, -99, 1, -98, 1, -97, 1, -96, 1, -95, 1, 9, 1, 10, 1, +11, 1, 12, 1, -94, 1, -93, 0, -10, 0, -9, 1, -92, 1, -91, 1, -90, 1, -89, 1, -88, 1, -87, 1, -86, +1, -85, 1, -84, 1, -83, 1, -82, 1, -81, 1, -80, 1, -79, 1, -78, 1, -77, 0, -8, 0, -43, 1, -118, 1, +-117, 1, -76, 1, -75, 1, -74, 1, -73, 1, -72, 1, 13, 1, 14, 1, -71, 1, -70, 1, 15, 1, 16, 1, 17, +1, 18, 0, -32, 0, -31, 1, 19, 1, 20, 1, -69, 1, -68, 1, 21, 1, 22, 1, -116, 1, -67, 1, -66, 1, +-65, 1, -64, 1, -63, 1, -62, 1, 23, 1, 24, 0, -81, 0, -80, 1, 25, 1, 26, 1, -61, 1, -60, 1, 27, +1, 28, 1, 29, 1, 30, 1, -59, 1, -58, 0, -7, 0, -6, 0, -30, 0, -29, 1, 31, 1, 32, 1, 33, 1, +34, 1, -57, 1, -56, 1, -55, 1, -54, 1, -53, 1, -52, 1, -51, 1, -50, 1, 35, 1, 36, 1, 37, 1, 38, +1, -49, 1, -48, 1, -47, 1, -46, 1, -45, 1, -44, 0, -70, 1, 39, 1, 40, 1, 41, 1, 42, 0, -28, 0, +-27, 1, -43, 0, -42, 0, -33, 0, -39, 0, -38, 0, -37, 0, -34, 0, -41, 0, -35, 1, -17, 1, -16, 1, -15, +1, -36, 1, -14, 1, -13, 1, -12, 1, -10, 1, -9, 1, -8, 1, -7, 1, -6, 1, 43, 1, -5, 1, -4, 1, +-3, 1, -2, 1, 44, 1, -1, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, +2, 9, 2, 10, 1, 45, 2, 11, 2, 12, 2, 13, 2, 14, 2, 15, 2, 16, 2, 17, 2, 18, 2, 19, 2, +20, 1, 46, 2, 21, 2, 22, 1, 47, 1, 48, 2, 23, 2, 24, 2, 25, 2, 26, 2, 27, 2, 28, 2, 29, +2, 30, 2, 31, 2, 32, 2, -116, 2, 33, 2, 34, 1, 49, 1, 50, 2, 35, 1, 51, 2, 36, 2, 37, 2, +38, 2, 39, 2, 40, 2, 41, 2, 42, 2, 43, 2, -120, 2, -119, 5, 16, 5, 17, 2, -115, 2, -114, 2, -113, +2, -112, 2, -111, 2, -110, 2, -109, 2, -108, 2, -107, 2, -106, 2, -106, 2, -105, 2, -104, 2, -103, 2, -102, 2, +-101, 2, -100, 2, -99, 2, -98, 2, -97, 2, -17, 3, -127, 3, -125, 3, -123, 3, -121, 3, -119, 3, -115, 3, -113, +3, -109, 3, -107, 3, -103, 3, -99, 3, -95, 3, -91, 3, -87, 3, -85, 3, -83, 3, -81, 3, -79, 3, -75, 3, +-71, 3, -67, 3, -63, 3, -59, 3, -55, 3, -51, 2, -16, 3, -47, 3, -43, 3, -39, 3, -35, 3, -31, 3, -27, +3, -23, 3, -19, 3, -17, 3, -15, 2, -15, 2, -14, 2, -13, 2, -12, 2, -11, 2, -10, 2, -9, 2, -8, 5, +56, 5, 57, 5, 58, 2, -7, 2, -6, 2, -5, 2, -4, 2, -3, 2, -2, 2, -1, 3, 0, 3, 1, 3, 2, +3, 3, 3, 4, 2, -20, 3, 5, 5, 40, 5, 44, 5, 59, 5, 60, 5, 62, 5, 64, 5, 57, 5, 66, 5, +68, 5, 70, 5, 72, 5, 74, 5, 78, 5, 82, 5, 86, 5, 90, 3, 31, 5, 94, 5, 98, 5, 102, 5, 106, +5, 110, 5, 114, 5, 118, 3, 39, 5, 122, 5, 126, 5, -128, 5, -126, 5, -124, 5, -122, 5, -120, 5, -118, 5, +-116, 5, -114, 5, -112, 5, -110, 5, -108, 5, -106, 5, -104, 5, -102, 5, -100, 3, 43, 5, -98, 5, -96, 5, -92, +5, -88, 5, -84, 5, -80, 5, -76, 5, -74, 5, -70, 5, -69, 5, -65, 5, -61, 5, -57, 5, -53, 5, -49, 5, +-47, 3, 45, 5, -45, 5, -41, 5, -37, 5, -33, 5, -29, 3, 49, 5, -25, 5, -21, 5, -17, 5, -13, 5, -9, +5, -5, 5, -1, 6, 3, 6, 7, 6, 11, 6, 15, 6, 17, 6, 19, 6, 23, 3, -21, 6, 25, 6, 29, 6, +31, 6, 32, 6, 33, 6, 34, 6, 36, 6, 38, 6, 40, 6, 42, 6, 44, 6, 46, 6, 48, 3, 53, 6, 50, +6, 52, 6, 56, 6, 58, 6, 62, 6, 64, 6, 66, 6, 68, 3, 8, 6, 69, 6, 70, 6, 71, 6, 72, 6, +73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6, 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, +6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 78, 6, 91, 2, -7, 2, -6, 2, -5, 2, -4, 3, 10, 3, +11, 3, 12, 3, 0, 3, 1, 3, 2, 6, 92, 6, 96, 6, 100, 6, 104, 6, 105, 4, -92, 4, -91, 4, -90, +4, -89, 4, -88, 4, -87, 4, -86, 4, -85, 4, -84, 4, -83, 4, -82, 4, -81, 4, -80, 4, -79, 4, -78, 4, +-77, 4, -76, 4, -75, 4, -74, 4, -73, 4, -72, 4, -71, 4, -70, 4, -69, 4, -68, 4, -67, 4, -66, 4, -65, +4, -64, 4, -63, 4, -62, 4, -61, 4, -60, 4, -59, 4, -58, 4, -57, 4, -56, 4, -55, 4, -54, 4, -53, 4, +-52, 4, -51, 4, -50, 4, -49, 4, -48, 4, -47, 4, -46, 4, -45, 4, -44, 4, -43, 4, -42, 4, -41, 4, -40, +4, -39, 4, -38, 4, -37, 4, -36, 4, -35, 4, -34, 4, -33, 4, -32, 4, -31, 4, -30, 4, -29, 4, -28, 4, +-27, 4, -26, 4, -25, 4, -24, 4, -23, 4, -22, 4, -21, 4, -20, 4, -19, 4, -18, 4, -17, 4, -16, 4, -15, +4, -14, 4, -13, 4, -12, 4, -11, 1, -29, 1, -28, 4, -10, 4, -9, 4, -8, 4, -7, 4, -6, 4, -5, 0, +-79, 0, -78, 2, -118, 1, 52, 0, -75, 0, -74, 0, -61, 1, -27, 0, -77, 0, -76, 0, -60, 0, -126, 0, -63, +0, -121, 3, 78, 3, 79, 3, 82, 3, 80, 3, 81, 3, 85, 3, 86, 3, 87, 3, 88, 3, 83, 3, 84, 0, +-11, 1, -25, 2, -64, 4, 126, 0, -68, 0, -103, 0, -19, 0, -62, 0, -91, 0, -110, 1, 63, 0, -113, 1, 65, +1, 118, 1, -111, 1, -110, 1, -109, 1, 119, 0, -72, 1, 124, 1, -19, 1, -18, 4, 113, 4, 114, 4, -127, 4, +115, 3, 89, 3, 90, 3, 91, 3, 92, 3, 93, 4, -124, 4, 117, 4, 119, 4, -123, 4, 118, 4, -122, 4, 121, +4, -121, 4, -120, 4, -119, 4, -118, 4, -117, 4, -116, 4, 120, 4, -108, 4, -115, 4, -114, 4, -113, 4, -112, 4, +-111, 4, -106, 4, -102, 4, -101, 4, -100, 4, -99, 4, -98, 4, -105, 4, -104, 4, -103, 4, 125, 4, -97, 4, -96, +4, -95, 4, -94, 4, -93, 6, 116, 6, 117, 6, 119, 2, -58, 2, -34, 2, -33, 2, -32, 2, -31, 2, -30, 2, +-29, 2, -28, 2, -27, 2, -26, 2, -25, 5, 60, 5, 61, 5, 82, 5, 83, 5, 84, 5, 85, 3, 31, 3, 32, +3, 33, 3, 34, 5, 98, 5, 99, 5, 100, 5, 101, 5, 78, 5, 79, 5, 80, 5, 81, 5, 94, 5, 95, 5, +96, 5, 97, 5, 74, 5, 75, 5, 76, 5, 77, 5, -61, 5, -60, 5, -59, 5, -58, 5, -53, 5, -52, 5, -51, +5, -50, 5, 114, 5, 115, 5, 116, 5, 117, 5, 110, 5, 111, 5, 112, 5, 113, 3, 39, 3, 40, 3, 41, 3, +42, 5, 122, 5, 123, 5, 124, 5, 125, 5, -120, 5, -119, 5, -122, 5, -121, 5, -118, 5, -117, 5, 126, 5, 127, +3, 43, 3, 44, 5, -112, 5, -111, 3, 45, 3, 46, 3, 47, 3, 48, 3, 49, 3, 50, 3, 51, 3, 52, 5, +-13, 5, -12, 5, -11, 5, -10, 5, -21, 5, -20, 5, -19, 5, -18, 6, 15, 6, 16, 6, 17, 6, 18, 5, 76, +5, 77, 6, 29, 6, 30, 6, 106, 6, 31, 6, 107, 6, 108, 3, -21, 3, -22, 3, -21, 3, -20, 6, 64, 6, +65, 6, 66, 6, 67, 5, -33, 5, -32, 5, -31, 5, -30, 6, 40, 6, 41, 6, 38, 6, 39, 6, 42, 6, 43, +5, 70, 6, 48, 6, 49, 6, 36, 6, 37, 6, 44, 6, 45, 6, 58, 6, 59, 6, 60, 6, 61, 3, 53, 3, +54, 3, -13, 3, -12, 0, 0, 1, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 2, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 4, 5, 6, 7, 8, 9, +10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, +35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, +60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, +85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 0, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, +109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, -128, -127, -126, -125, -124, -123, +-122, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99, -98, +-97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, 3, -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, +-73, -72, -71, -70, -69, -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, -49, +-48, 0, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, 0, 4, 11, 36, 0, 0, 1, 28, +1, 0, 0, 7, 0, 28, 0, 126, 1, 127, 1, -113, 1, -110, 1, -95, 1, -80, 1, -36, 1, -1, 2, 89, 2, +-57, 2, -55, 2, -35, 3, 1, 3, 3, 3, 9, 3, 35, 3, 126, 3, -118, 3, -116, 3, -95, 3, -50, 4, 12, +4, 79, 4, 92, 4, 95, 4, -109, 4, -105, 4, -99, 4, -93, 4, -77, 4, -69, 4, -39, 4, -23, 5, -61, 5, +-22, 5, -12, 6, 12, 6, 27, 6, 31, 6, 58, 6, 85, 6, -19, 6, -2, 30, -123, 30, -7, 32, 15, 32, 21, +32, 30, 32, 34, 32, 38, 32, 46, 32, 48, 32, 51, 32, 58, 32, 60, 32, 62, 32, 68, 32, 111, 32, 127, 32, +-92, 32, -89, 32, -84, 33, 5, 33, 19, 33, 22, 33, 34, 33, 38, 33, 46, 33, 84, 33, 94, 33, -107, 33, -88, +34, 2, 34, 6, 34, 15, 34, 18, 34, 21, 34, 26, 34, 31, 34, 41, 34, 43, 34, 72, 34, 97, 34, 101, 35, +2, 35, 16, 35, 33, 37, 0, 37, 2, 37, 12, 37, 16, 37, 20, 37, 24, 37, 28, 37, 36, 37, 44, 37, 52, +37, 60, 37, 108, 37, -128, 37, -124, 37, -120, 37, -116, 37, -109, 37, -95, 37, -84, 37, -78, 37, -70, 37, -68, 37, +-60, 37, -53, 37, -49, 37, -39, 37, -26, 38, 60, 38, 64, 38, 66, 38, 96, 38, 99, 38, 102, 38, 107, -24, 5, +-24, 24, -24, 58, -16, 2, -16, 49, -5, 2, -5, 32, -5, 54, -5, 60, -5, 62, -5, 65, -5, 68, -5, -79, -5, +-25, -5, -1, -4, 98, -3, 63, -3, -14, -2, -4, -1, -4, -1, -1, 0, 0, 0, 32, 0, -96, 1, -113, 1, -110, +1, -96, 1, -81, 1, -51, 1, -6, 2, 89, 2, -58, 2, -55, 2, -40, 3, 0, 3, 3, 3, 9, 3, 35, 3, +126, 3, -124, 3, -116, 3, -114, 3, -93, 4, 1, 4, 14, 4, 81, 4, 94, 4, -112, 4, -106, 4, -102, 4, -94, +4, -82, 4, -72, 4, -40, 4, -24, 5, -80, 5, -48, 5, -16, 6, 12, 6, 27, 6, 31, 6, 33, 6, 64, 6, +96, 6, -16, 30, -128, 30, -96, 32, 12, 32, 19, 32, 23, 32, 32, 32, 38, 32, 42, 32, 48, 32, 50, 32, 57, +32, 60, 32, 62, 32, 68, 32, 106, 32, 127, 32, -93, 32, -89, 32, -86, 33, 5, 33, 19, 33, 22, 33, 34, 33, +38, 33, 46, 33, 83, 33, 91, 33, -112, 33, -88, 34, 2, 34, 6, 34, 15, 34, 17, 34, 21, 34, 25, 34, 30, +34, 41, 34, 43, 34, 72, 34, 96, 34, 100, 35, 2, 35, 16, 35, 32, 37, 0, 37, 2, 37, 12, 37, 16, 37, +20, 37, 24, 37, 28, 37, 36, 37, 44, 37, 52, 37, 60, 37, 80, 37, -128, 37, -124, 37, -120, 37, -116, 37, -112, +37, -96, 37, -86, 37, -78, 37, -70, 37, -68, 37, -60, 37, -54, 37, -49, 37, -40, 37, -26, 38, 58, 38, 64, 38, +66, 38, 96, 38, 99, 38, 101, 38, 106, -24, 1, -24, 24, -24, 58, -16, 1, -16, 4, -5, 1, -5, 29, -5, 42, +-5, 56, -5, 62, -5, 64, -5, 67, -5, 70, -5, -45, -5, -4, -4, 94, -3, 62, -3, -14, -2, -128, -1, -4, -1, +-1, -1, -29, 0, 0, 3, -107, -1, 20, 2, -54, 2, -67, 3, 47, -1, -36, 2, -52, 0, 0, -2, 15, 0, 0, +1, -110, 1, 119, 1, 107, 1, 114, -4, -96, 0, 0, -2, 105, 0, 0, 0, 0, -2, 43, -2, 42, -2, 41, -2, +40, 0, 0, 0, 124, 0, 122, 0, 118, 0, 108, 0, 104, 0, 76, 0, 62, 0, 0, -4, -48, -4, -53, -4, -32, +-4, -46, -4, -49, 0, 0, 0, 0, 0, 0, 0, 0, -29, 93, 0, 0, -30, -36, 0, 0, 0, 0, 0, 0, -32, +-123, 0, 0, -32, -107, -31, 91, -32, -124, -32, -7, -31, -88, -32, 119, 0, 0, -32, -73, 0, 0, -32, -112, 0, 0, +-32, -118, -32, 125, -31, 117, -33, 106, -33, 121, -32, -70, -29, 44, -32, -114, -33, -88, -33, -106, -34, -106, -34, -94, -34, +-117, 0, 0, -34, -90, 0, 0, 0, 0, -33, 23, -34, 113, -34, 95, 0, 0, -34, 48, -34, 64, -34, 51, -34, 36, +-36, 70, -36, 69, -36, 60, -36, 57, -36, 54, -36, 51, -36, 48, -36, 41, -36, 34, -36, 27, -36, 20, -36, 1, -37, +-18, -37, -21, -37, -24, -37, -27, -37, -30, 0, 0, 0, 0, -37, -58, -37, -65, -37, -66, -37, -73, 0, 0, -37, -59, +-37, -91, -37, -81, -37, 69, -37, 66, -37, 65, -37, 36, -37, 34, -37, 33, -37, 30, 26, -64, 26, -6, 26, -31, 16, +-66, 0, 0, 5, -66, 0, 0, 7, -99, 7, -100, 7, -101, 7, -102, 7, -103, 0, 0, 0, 0, 0, 0, 6, -23, +6, 62, 5, -115, 5, 0, 3, 99, 0, 1, 0, 0, 1, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 2, -54, 0, 0, 2, -54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -54, 0, 0, 2, -44, +2, -6, 0, 0, 0, 0, 0, 0, 0, 0, 3, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 3, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 92, 3, -114, 3, -72, 4, -46, 0, 0, 4, -20, +0, 0, 5, -100, 5, -96, 5, -82, 0, 0, 5, -80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, +-84, 0, 0, 5, -76, 0, 0, 5, -76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -98, 0, 0, 5, -98, 5, -96, 0, 0, 0, 0, 0, 0, 5, +-100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 116, 5, 118, 0, 0, 0, +0, 0, 0, 0, 0, 5, 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 88, 0, 0, 5, -80, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 5, -84, 6, -126, 6, -86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, -93, 0, -124, +0, -123, 3, 94, 0, -106, 0, -26, 0, -122, 0, -114, 0, -117, 0, -99, 0, -87, 0, -92, 0, 16, 0, -118, 1, +0, 0, -125, 0, -109, 0, -16, 0, -15, 0, -115, 0, -105, 0, -120, 0, -62, 0, -36, 0, -17, 0, -98, 0, -86, +0, -13, 0, -14, 0, -12, 0, -94, 0, -84, 0, -56, 0, -58, 0, -83, 0, 98, 0, 99, 0, -112, 0, 100, 0, +-54, 0, 101, 0, -57, 0, -55, 0, -50, 0, -53, 0, -52, 0, -51, 0, -25, 0, 102, 0, -47, 0, -49, 0, -48, +0, -82, 0, 103, 0, -18, 0, -111, 0, -44, 0, -46, 0, -45, 0, 104, 0, -23, 0, -21, 0, -119, 0, 106, 0, +105, 0, 107, 0, 109, 0, 108, 0, 110, 0, -96, 0, 111, 0, 113, 0, 112, 0, 114, 0, 115, 0, 117, 0, 116, +0, 118, 0, 119, 0, -24, 0, 120, 0, 122, 0, 121, 0, 123, 0, 125, 0, 124, 0, -73, 0, -95, 0, 127, 0, +126, 0, -128, 0, -127, 0, -22, 0, -20, 0, -71, 1, -106, 1, -105, 1, 2, 1, 3, 1, 4, 1, 5, 0, -5, +0, -4, 1, -104, 1, -103, 1, -102, 1, -101, 0, -3, 0, -2, 1, 6, 1, 7, 1, 8, 0, -1, 1, -100, 1, +-99, 1, -98, 1, -97, 1, -96, 1, -95, 1, 9, 1, 10, 1, 11, 1, 12, 1, -94, 1, -93, 0, -10, 0, -9, +1, -92, 1, -91, 1, -90, 1, -89, 1, -88, 1, -87, 1, -86, 1, -85, 1, -84, 1, -83, 1, -82, 1, -81, 1, +-80, 1, -79, 1, -78, 1, -77, 0, -8, 0, -43, 1, -118, 1, -117, 1, -76, 1, -75, 1, -74, 1, -73, 1, -72, +1, 13, 1, 14, 1, -71, 1, -70, 1, 15, 1, 16, 1, 17, 1, 18, 0, -32, 0, -31, 1, 19, 1, 20, 1, +-69, 1, -68, 1, 21, 1, 22, 1, -116, 1, -67, 1, -66, 1, -65, 1, -64, 1, -63, 1, -62, 1, 23, 1, 24, +0, -81, 0, -80, 1, 25, 1, 26, 1, -61, 1, -60, 1, 27, 1, 28, 1, 29, 1, 30, 1, -59, 1, -58, 0, +-7, 0, -6, 0, -30, 0, -29, 1, 31, 1, 32, 1, 33, 1, 34, 1, -57, 1, -56, 1, -55, 1, -54, 1, -53, +1, -52, 1, -51, 1, -50, 1, 35, 1, 36, 1, 37, 1, 38, 1, -49, 1, -48, 1, -47, 1, -46, 1, -45, 1, +-44, 0, -70, 1, 39, 1, 40, 1, 41, 1, 42, 0, -28, 0, -27, 1, -43, 0, -42, 0, -33, 0, -39, 0, -38, +0, -37, 0, -34, 0, -41, 0, -35, 1, -17, 1, -16, 1, -15, 1, -36, 1, -14, 1, -13, 1, -12, 1, -10, 1, +-9, 1, -8, 1, -7, 1, -6, 1, 43, 1, -5, 1, -4, 1, -3, 1, -2, 1, 44, 1, -1, 2, 0, 2, 1, +2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 1, 45, 2, 11, 2, 12, 2, +13, 2, 14, 2, 15, 2, 16, 2, 17, 2, 18, 2, 19, 2, 20, 1, 46, 2, 21, 2, 22, 1, 47, 1, 48, +2, 23, 2, 24, 2, 25, 2, 26, 2, 27, 2, 28, 2, 29, 2, 30, 2, 31, 2, 32, 2, -116, 2, 33, 2, +34, 1, 49, 1, 50, 2, 35, 1, 51, 2, 36, 2, 37, 2, 38, 2, 39, 2, 40, 2, 41, 2, 42, 2, 43, +2, -120, 2, -119, 5, 16, 5, 17, 2, -115, 2, -114, 2, -113, 2, -112, 2, -111, 2, -110, 2, -109, 2, -108, 2, +-107, 2, -106, 2, -106, 2, -105, 2, -104, 2, -103, 2, -102, 2, -101, 2, -100, 2, -99, 2, -98, 2, -97, 2, -17, +3, -127, 3, -125, 3, -123, 3, -121, 3, -119, 3, -115, 3, -113, 3, -109, 3, -107, 3, -103, 3, -99, 3, -95, 3, +-91, 3, -87, 3, -85, 3, -83, 3, -81, 3, -79, 3, -75, 3, -71, 3, -67, 3, -63, 3, -59, 3, -55, 3, -51, +2, -16, 3, -47, 3, -43, 3, -39, 3, -35, 3, -31, 3, -27, 3, -23, 3, -19, 3, -17, 3, -15, 2, -15, 2, +-14, 2, -13, 2, -12, 2, -11, 2, -10, 2, -9, 2, -8, 5, 56, 5, 57, 5, 58, 2, -7, 2, -6, 2, -5, +2, -4, 2, -3, 2, -2, 2, -1, 3, 0, 3, 1, 3, 2, 3, 3, 3, 4, 2, -20, 3, 5, 5, 40, 5, +44, 5, 59, 5, 60, 5, 62, 5, 64, 5, 57, 5, 66, 5, 68, 5, 70, 5, 72, 5, 74, 5, 78, 5, 82, +5, 86, 5, 90, 3, 31, 5, 94, 5, 98, 5, 102, 5, 106, 5, 110, 5, 114, 5, 118, 3, 39, 5, 122, 5, +126, 5, -128, 5, -126, 5, -124, 5, -122, 5, -120, 5, -118, 5, -116, 5, -114, 5, -112, 5, -110, 5, -108, 5, -106, +5, -104, 5, -102, 5, -100, 3, 43, 5, -98, 5, -96, 5, -92, 5, -88, 5, -84, 5, -80, 5, -76, 5, -74, 5, +-70, 5, -69, 5, -65, 5, -61, 5, -57, 5, -53, 5, -49, 5, -47, 3, 45, 5, -45, 5, -41, 5, -37, 5, -33, +5, -29, 3, 49, 5, -25, 5, -21, 5, -17, 5, -13, 5, -9, 5, -5, 5, -1, 6, 3, 6, 7, 6, 11, 6, +15, 6, 17, 6, 19, 6, 23, 3, -21, 6, 25, 6, 29, 6, 31, 6, 32, 6, 33, 6, 34, 6, 36, 6, 38, +6, 40, 6, 42, 6, 44, 6, 46, 6, 48, 3, 53, 6, 50, 6, 52, 6, 56, 6, 58, 6, 62, 6, 64, 6, +66, 6, 68, 3, 8, 6, 69, 6, 70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, +6, 79, 6, 80, 6, 81, 6, 82, 6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, +78, 6, 91, 2, -7, 2, -6, 2, -5, 2, -4, 3, 10, 3, 11, 3, 12, 3, 0, 3, 1, 3, 2, 6, 92, +6, 96, 6, 100, 6, 104, 6, 105, 4, -92, 4, -91, 4, -90, 4, -89, 4, -88, 4, -87, 4, -86, 4, -85, 4, +-84, 4, -83, 4, -82, 4, -81, 4, -80, 4, -79, 4, -78, 4, -77, 4, -76, 4, -75, 4, -74, 4, -73, 4, -72, +4, -71, 4, -70, 4, -69, 4, -68, 4, -67, 4, -66, 4, -65, 4, -64, 4, -63, 4, -62, 4, -61, 4, -60, 4, +-59, 4, -58, 4, -57, 4, -56, 4, -55, 4, -54, 4, -53, 4, -52, 4, -51, 4, -50, 4, -49, 4, -48, 4, -47, +4, -46, 4, -45, 4, -44, 4, -43, 4, -42, 4, -41, 4, -40, 4, -39, 4, -38, 4, -37, 4, -36, 4, -35, 4, +-34, 4, -33, 4, -32, 4, -31, 4, -30, 4, -29, 4, -28, 4, -27, 4, -26, 4, -25, 4, -24, 4, -23, 4, -22, +4, -21, 4, -20, 4, -19, 4, -18, 4, -17, 4, -16, 4, -15, 4, -14, 4, -13, 4, -12, 4, -11, 1, -29, 1, +-28, 4, -10, 4, -9, 4, -8, 4, -7, 4, -6, 4, -5, 0, -79, 0, -78, 2, -118, 1, 52, 0, -75, 0, -74, +0, -61, 1, -27, 0, -77, 0, -76, 0, -60, 0, -126, 0, -63, 0, -121, 3, 78, 3, 79, 3, 82, 3, 80, 3, +81, 3, 85, 3, 86, 3, 87, 3, 88, 3, 83, 3, 84, 0, -11, 1, -25, 2, -64, 4, 126, 0, -68, 0, -103, +0, -19, 0, -62, 0, -91, 0, -110, 1, 63, 0, -113, 1, 65, 1, 118, 1, -111, 1, -110, 1, -109, 1, 119, 0, +-72, 1, 124, 1, -19, 1, -18, 4, 113, 4, 114, 4, -127, 4, 115, 3, 89, 3, 90, 3, 91, 3, 92, 3, 93, +4, -124, 4, 117, 4, 119, 4, -123, 4, 118, 4, -122, 4, 121, 4, -121, 4, -120, 4, -119, 4, -118, 4, -117, 4, +-116, 4, 120, 4, -108, 4, -115, 4, -114, 4, -113, 4, -112, 4, -111, 4, -106, 4, -102, 4, -101, 4, -100, 4, -99, +4, -98, 4, -105, 4, -104, 4, -103, 4, 125, 4, -97, 4, -96, 4, -95, 4, -94, 4, -93, 6, 116, 6, 117, 6, +119, 2, -58, 2, -34, 2, -33, 2, -32, 2, -31, 2, -30, 2, -29, 2, -28, 2, -27, 2, -26, 2, -25, 5, 60, +5, 61, 5, 82, 5, 83, 5, 84, 5, 85, 3, 31, 3, 32, 3, 33, 3, 34, 5, 98, 5, 99, 5, 100, 5, +101, 5, 78, 5, 79, 5, 80, 5, 81, 5, 94, 5, 95, 5, 96, 5, 97, 5, 74, 5, 75, 5, 76, 5, 77, +5, -61, 5, -60, 5, -59, 5, -58, 5, -53, 5, -52, 5, -51, 5, -50, 5, 114, 5, 115, 5, 116, 5, 117, 5, +110, 5, 111, 5, 112, 5, 113, 3, 39, 3, 40, 3, 41, 3, 42, 5, 122, 5, 123, 5, 124, 5, 125, 5, -120, +5, -119, 5, -122, 5, -121, 5, -118, 5, -117, 5, 126, 5, 127, 3, 43, 3, 44, 5, -112, 5, -111, 3, 45, 3, +46, 3, 47, 3, 48, 3, 49, 3, 50, 3, 51, 3, 52, 5, -13, 5, -12, 5, -11, 5, -10, 5, -21, 5, -20, +5, -19, 5, -18, 6, 15, 6, 16, 6, 17, 6, 18, 5, 76, 5, 77, 6, 29, 6, 30, 6, 106, 6, 31, 6, +107, 6, 108, 3, -21, 3, -22, 3, -21, 3, -20, 6, 64, 6, 65, 6, 66, 6, 67, 5, -33, 5, -32, 5, -31, +5, -30, 6, 40, 6, 41, 6, 38, 6, 39, 6, 42, 6, 43, 5, 70, 6, 48, 6, 49, 6, 36, 6, 37, 6, +44, 6, 45, 6, 58, 6, 59, 6, 60, 6, 61, 3, 53, 3, 54, 3, -13, 3, -12, 0, 0, 64, 67, 85, 84, +65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, +39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, +14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 44, 69, 35, 70, 96, 32, -80, 38, 96, -80, +4, 38, 35, 72, 72, 45, 44, 69, 35, 70, 35, 97, 32, -80, 38, 97, -80, 4, 38, 35, 72, 72, 45, 44, 69, +35, 70, 96, -80, 32, 97, 32, -80, 70, 96, -80, 4, 38, 35, 72, 72, 45, 44, 69, 35, 70, 35, 97, -80, 32, +96, 32, -80, 38, 97, -80, 32, 97, -80, 4, 38, 35, 72, 72, 45, 44, 69, 35, 70, 96, -80, 64, 97, 32, -80, +102, 96, -80, 4, 38, 35, 72, 72, 45, 44, 69, 35, 70, 35, 97, -80, 64, 96, 32, -80, 38, 97, -80, 64, 97, +-80, 4, 38, 35, 72, 72, 45, 44, 1, 16, 32, 60, 0, 60, 45, 44, 32, 69, 35, 32, -80, -51, 68, 35, 32, +-72, 1, 90, 81, 88, 35, 32, -80, -115, 68, 35, 89, 32, -80, -19, 81, 88, 35, 32, -80, 77, 68, 35, 89, 32, +-80, -112, 81, 88, 35, 32, -80, 13, 68, 35, 89, 33, 33, 45, 44, 32, 32, 69, 24, 104, 68, 32, -80, 1, 96, +32, 69, -80, 70, 118, 104, -118, 69, 96, 68, 45, 44, 1, -79, 11, 10, 67, 35, 67, 101, 10, 45, 44, 0, -79, +10, 11, 67, 35, 67, 11, 45, 44, 0, -80, 23, 35, 112, -79, 1, 23, 62, 1, -80, 23, 35, 112, -79, 2, 23, +69, 58, -79, 2, 0, 8, 13, 45, 44, 69, -80, 26, 35, 68, 69, -80, 25, 35, 68, 45, 44, 32, 69, -80, 3, +37, 69, 97, 100, -80, 80, 81, 88, 69, 68, 27, 33, 33, 89, 45, 44, -80, 1, 67, 99, 35, 98, -80, 0, 35, +66, -80, 15, 43, 45, 44, 32, 69, -80, 0, 67, 96, 68, 45, 44, 1, -80, 6, 67, -80, 7, 67, 101, 10, 45, +44, 32, 105, -80, 64, 97, -80, 0, -117, 32, -79, 44, -64, -118, -116, -72, 16, 0, 98, 96, 43, 12, 100, 35, 100, +97, 92, 88, -80, 3, 97, 89, 45, 44, 69, -80, 17, 43, -80, 23, 35, 68, -80, 23, 122, -28, 24, 45, 44, 69, +-80, 17, 43, -80, 23, 35, 68, 45, 44, -80, 18, 67, 88, -121, 69, -80, 17, 43, -80, 23, 35, 68, -80, 23, 122, +-28, 27, 3, -118, 69, 24, 105, 32, -80, 23, 35, 68, -118, -118, -121, 32, -80, -96, 81, 88, -80, 17, 43, -80, 23, +35, 68, -80, 23, 122, -28, 27, 33, -80, 23, 122, -28, 89, 89, 24, 45, 44, 45, 44, -80, 2, 37, 70, 96, -118, +70, -80, 64, 97, -116, 72, 45, 44, 75, 83, 32, 92, 88, -80, 2, -123, 89, 88, -80, 1, -123, 89, 45, 44, 32, +-80, 3, 37, 69, -80, 25, 35, 68, 69, -80, 26, 35, 68, 69, 101, 35, 69, 32, -80, 3, 37, 96, 106, 32, -80, +9, 35, 66, 35, 104, -118, 106, 96, 97, 32, -80, 26, -118, -80, 0, 82, 121, 33, -78, 26, 26, 64, -71, -1, -32, +0, 26, 69, 32, -118, 84, 88, 35, 33, -80, 63, 27, 35, 89, 97, 68, 28, -79, 20, 0, -118, 82, 121, -77, 25, +64, 32, 25, 69, 32, -118, 84, 88, 35, 33, -80, 63, 27, 35, 89, 97, 68, 45, 44, -79, 16, 17, 67, 35, 67, +11, 45, 44, -79, 14, 15, 67, 35, 67, 11, 45, 44, -79, 12, 13, 67, 35, 67, 11, 45, 44, -79, 12, 13, 67, +35, 67, 101, 11, 45, 44, -79, 14, 15, 67, 35, 67, 101, 11, 45, 44, -79, 16, 17, 67, 35, 67, 101, 11, 45, +44, 75, 82, 88, 69, 68, 27, 33, 33, 89, 45, 44, 1, 32, -80, 3, 37, 35, 73, -80, 64, 96, -80, 32, 99, +32, -80, 0, 82, 88, 35, -80, 2, 37, 56, 35, -80, 2, 37, 101, 56, 0, -118, 99, 56, 27, 33, 33, 33, 33, +33, 89, 1, 45, 44, 75, -80, 100, 81, 88, 69, 105, -80, 9, 67, 96, -118, 16, 58, 27, 33, 33, 33, 89, 45, +44, 1, -80, 5, 37, 16, 35, 32, -118, -11, 0, -80, 1, 96, 35, -19, -20, 45, 44, 1, -80, 5, 37, 16, 35, +32, -118, -11, 0, -80, 1, 97, 35, -19, -20, 45, 44, 1, -80, 6, 37, 16, -11, 0, -19, -20, 45, 44, 32, -80, +1, 96, 1, 16, 32, 60, 0, 60, 45, 44, 32, -80, 1, 97, 1, 16, 32, 60, 0, 60, 45, 44, -80, 43, 43, +-80, 42, 42, 45, 44, 0, -80, 7, 67, -80, 6, 67, 11, 45, 44, 62, -80, 42, 42, 45, 44, 53, 45, 44, 118, +-72, 2, 35, 35, 112, 16, 32, -72, 2, 35, 69, 32, -80, 0, 80, 88, -80, 1, 97, 89, 58, 47, 24, 45, 44, +33, 33, 12, 100, 35, 100, -117, -72, 64, 0, 98, 45, 44, 33, -80, -128, 81, 88, 12, 100, 35, 100, -117, -72, 32, +0, 98, 27, -78, 0, 64, 47, 43, 89, -80, 2, 96, 45, 44, 33, -80, -64, 81, 88, 12, 100, 35, 100, -117, -72, +21, 85, 98, 27, -78, 0, -128, 47, 43, 89, -80, 2, 96, 45, 44, 12, 100, 35, 100, -117, -72, 64, 0, 98, 96, +35, 33, 45, 44, -76, 0, 1, 0, 0, 0, 21, -80, 8, 38, -80, 8, 38, -80, 8, 38, -80, 8, 38, 15, 16, +22, 19, 69, 104, 58, -80, 1, 22, 45, 44, -76, 0, 1, 0, 0, 0, 21, -80, 8, 38, -80, 8, 38, -80, 8, +38, -80, 8, 38, 15, 16, 22, 19, 69, 104, 101, 58, -80, 1, 22, 45, 44, 75, 83, 35, 75, 81, 90, 88, 32, +69, -118, 96, 68, 27, 33, 33, 89, 45, 44, 75, 84, 88, 32, 69, -118, 96, 68, 27, 33, 33, 89, 45, 44, 75, +83, 35, 75, 81, 90, 88, 56, 27, 33, 33, 89, 45, 44, 75, 84, 88, 56, 27, 33, 33, 89, 45, 44, -80, 19, +67, 88, 3, 27, 2, 89, 45, 44, -80, 19, 67, 88, 2, 27, 3, 89, 45, 44, 75, 84, -80, 18, 67, 92, 90, +88, 56, 27, 33, 33, 89, 45, 44, -80, 18, 67, 92, 88, 12, -80, 4, 37, -80, 4, 37, 6, 12, 100, 35, 100, +97, 100, -72, 7, 8, 81, 88, -80, 4, 37, -80, 4, 37, 1, 32, 70, -80, 16, 96, 72, 32, 70, -80, 16, 96, +72, 89, 10, 33, 33, 27, 33, 33, 89, 45, 44, -80, 18, 67, 92, 88, 12, -80, 4, 37, -80, 4, 37, 6, 12, +100, 35, 100, 97, 100, -72, 7, 8, 81, 88, -80, 4, 37, -80, 4, 37, 1, 32, 70, -72, -1, -16, 96, 72, 32, +70, -72, -1, -16, 96, 72, 89, 10, 33, 33, 27, 33, 33, 89, 45, 44, 75, 83, 35, 75, 81, 90, 88, -80, 58, +43, 27, 33, 33, 89, 45, 44, 75, 83, 35, 75, 81, 90, 88, -80, 59, 43, 27, 33, 33, 89, 45, 44, 75, 83, +35, 75, 81, 90, -80, 18, 67, 92, 90, 88, 56, 27, 33, 33, 89, 45, 44, 12, -118, 3, 75, 84, -80, 4, 38, +2, 75, 84, 90, -118, -118, 10, -80, 18, 67, 92, 90, 88, 56, 27, 33, 33, 89, 45, 44, 75, 82, 88, -80, 4, +37, -80, 4, 37, 73, -80, 4, 37, -80, 4, 37, 73, 97, 32, -80, 0, 84, 88, 33, 32, 67, -80, 0, 85, 88, +-80, 3, 37, -80, 3, 37, -72, -1, -64, 56, -72, -1, -64, 56, 89, 27, -80, 64, 84, 88, 32, 67, -80, 0, 84, +88, -80, 2, 37, -72, -1, -64, 56, 89, 27, 32, 67, -80, 0, 84, 88, -80, 3, 37, -80, 3, 37, -72, -1, -64, +56, -72, -1, -64, 56, 27, -80, 3, 37, -72, -1, -64, 56, 89, 89, 89, 89, 33, 33, 33, 33, 45, 44, 70, 35, +70, 96, -118, -118, 70, 35, 32, 70, -118, 96, -118, 97, -72, -1, -128, 98, 35, 32, 16, 35, -118, -71, 2, -62, 2, +-62, -118, 112, 69, 96, 32, -80, 0, 80, 88, -80, 1, 97, -72, -1, -70, -117, 27, -80, 70, -116, 89, -80, 16, 96, +104, 1, 58, 45, 44, -79, 2, 0, 66, -79, 35, 1, -120, 81, -79, 64, 1, -120, 83, 90, 88, -71, 16, 0, 0, +32, -120, 84, 88, -78, 2, 1, 2, 67, 96, 66, 89, -79, 36, 1, -120, 81, 88, -71, 32, 0, 0, 64, -120, 84, +88, -78, 2, 2, 2, 67, 96, 66, -79, 36, 1, -120, 84, 88, -78, 2, 32, 2, 67, 96, 66, 0, 75, 1, 75, +82, 88, -78, 2, 8, 2, 67, 96, 66, 89, 27, -71, 64, 0, 0, -128, -120, 84, 88, -78, 2, 4, 2, 67, 96, +66, 89, -71, 64, 0, 0, -128, 99, -72, 1, 0, -120, 84, 88, -78, 2, 8, 2, 67, 96, 66, 89, -71, 64, 0, +1, 0, 99, -72, 2, 0, -120, 84, 88, -78, 2, 16, 2, 67, 96, 66, 89, -71, 64, 0, 2, 0, 99, -72, 4, +0, -120, 84, 88, -78, 2, 64, 2, 67, 96, 66, 89, 89, 89, 89, 89, 45, 44, -80, 2, 67, 84, 88, 75, 83, +35, 75, 81, 90, 88, 56, 27, 33, 33, 89, 27, 33, 33, 33, 33, 89, 45, 0, 0, -79, 84, 15, 65, 34, 3, +23, 0, -17, 3, 23, 0, -1, 3, 23, 0, 3, 0, 31, 3, 23, 0, 47, 3, 23, 0, 79, 3, 23, 0, 95, +3, 23, 0, -113, 3, 23, 0, -97, 3, 23, 0, 6, 0, 15, 3, 23, 0, 95, 3, 23, 0, 111, 3, 23, 0, +127, 3, 23, 0, -65, 3, 23, 0, -16, 3, 23, 0, 6, 0, 64, 3, 23, -78, -110, 51, 64, -72, 3, 23, -78, +-117, 51, 64, -72, 3, 23, -77, 106, 108, 50, 64, -72, 3, 23, -78, 97, 51, 64, -72, 3, 23, -77, 92, 93, 50, +64, -72, 3, 23, -77, 87, 89, 50, 64, -72, 3, 23, -77, 77, 81, 50, 64, -72, 3, 23, -77, 68, 73, 50, 64, +-72, 3, 23, -78, 58, 51, 64, -72, 3, 23, -77, 49, 52, 50, 64, -72, 3, 23, -77, 46, 66, 50, 64, -72, 3, +23, -77, 39, 44, 50, 64, -72, 3, 23, -77, 18, 37, 50, -128, -72, 3, 23, -77, 10, 13, 50, -64, 65, 22, 3, +22, 0, -48, 3, 22, 0, 2, 0, 112, 3, 22, 0, 1, 2, -60, 0, 15, 1, 1, 0, 31, 0, -96, 3, 21, +0, -80, 3, 21, 0, 2, 3, 6, 0, 15, 1, 1, 0, 31, 0, 64, 3, 18, -77, 36, 38, 50, -97, -65, 3, +4, 0, 1, 3, 2, 3, 1, 0, 100, 0, 31, -1, -64, 3, 1, -78, 13, 17, 50, 65, 10, 2, -1, 2, -17, +0, 18, 0, 31, 2, -18, 2, -19, 0, 100, 0, 31, -1, -64, 2, -19, -77, 14, 17, 50, -97, 65, 74, 2, -30, +0, -81, 2, -30, 0, -65, 2, -30, 0, 3, 2, -30, 2, -30, 2, -31, 2, -31, 0, 127, 2, -32, 0, 1, 0, +16, 2, -32, 0, 63, 2, -32, 0, -97, 2, -32, 0, -65, 2, -32, 0, -49, 2, -32, 0, -17, 2, -32, 0, 6, +2, -32, 2, -32, 2, -33, 2, -33, 2, -34, 2, -34, 0, 15, 2, -35, 0, 47, 2, -35, 0, 63, 2, -35, 0, +95, 2, -35, 0, -97, 2, -35, 0, -65, 2, -35, 0, -17, 2, -35, 0, 7, 2, -35, 2, -35, 0, 16, 2, -36, +0, 1, 0, 0, 2, -36, 0, 1, 0, 16, 2, -36, 0, 63, 2, -36, 0, 2, 2, -36, 2, -36, 0, 16, 2, +-37, 0, 1, 2, -37, 2, -37, 0, 15, 2, -38, 0, 1, 2, -38, 2, -38, -1, -64, 2, -45, -78, 55, 57, 50, +-71, -1, -64, 2, -45, -78, 43, 47, 50, -71, -1, -64, 2, -45, -78, 31, 37, 50, -71, -1, -64, 2, -45, -78, 23, +27, 50, -71, -1, -64, 2, -45, -78, 18, 22, 50, -72, 2, -46, -78, -7, 41, 31, -72, 2, -29, -77, 32, 43, 31, +-96, 65, 48, 2, -44, 0, -80, 2, -44, 0, 2, 0, 0, 2, -44, 0, 16, 2, -44, 0, 32, 2, -44, 0, 80, +2, -44, 0, 96, 2, -44, 0, 112, 2, -44, 0, 6, 0, 96, 2, -42, 0, 112, 2, -42, 0, -128, 2, -42, 0, +-112, 2, -42, 0, -96, 2, -42, 0, -80, 2, -42, 0, 6, 0, 0, 2, -42, 0, 16, 2, -42, 0, 32, 2, -54, +0, 32, 2, -52, 0, 32, 2, -42, 0, 48, 2, -42, 0, 64, 2, -42, 0, 80, 2, -42, 0, 8, 2, -48, -78, +32, 43, 31, -72, 2, -49, -78, 38, 66, 31, 65, 22, 2, -50, 2, -57, 0, 23, 0, 31, 2, -51, 2, -56, 0, +23, 0, 31, 2, -52, 2, -58, 0, 23, 0, 31, 2, -53, 2, -59, 0, 23, 0, 31, 2, -55, 2, -59, 0, 30, +0, 31, 2, -54, 2, -58, -78, 30, 31, 0, 65, 11, 2, -58, 0, 0, 2, -57, 0, 16, 2, -58, 0, 16, 2, +-57, 0, 47, 2, -59, 0, 5, 2, -63, -77, 36, 18, 31, -1, 65, 17, 2, -65, 0, 1, 0, 31, 2, -65, 0, +47, 2, -65, 0, 63, 2, -65, 0, 79, 2, -65, 0, 95, 2, -65, 0, -113, 2, -65, 0, 6, 2, -65, 2, 34, +-78, 100, 31, 18, 65, 11, 2, -69, 0, -54, 8, 0, 0, 31, 2, -78, 0, -23, 8, 0, 0, 31, 2, -90, 0, +-94, 8, 0, 64, 106, 31, 64, 38, 67, 73, 50, 64, 32, 67, 73, 50, 64, 38, 58, 61, 50, 64, 32, 58, 61, +50, -97, 32, -97, 38, 2, 64, 38, -106, -103, 50, 64, 32, -106, -103, 50, 64, 38, -114, -110, 50, 64, 32, -114, -110, +50, 64, 38, -124, -116, 50, 64, 32, -124, -116, 50, 64, 38, 122, -127, 50, 64, 32, 122, -127, 50, 64, 38, 108, 118, +50, 64, 32, 108, 118, 50, 64, 38, 100, 106, 50, 64, 32, 100, 106, 50, 64, 38, 90, 95, 50, 64, 32, 90, 95, +50, 64, 38, 79, 84, 50, 64, 32, 79, 84, 50, -72, 2, -98, -73, 36, 39, 31, 55, 79, 107, 1, 32, 65, 15, +2, 119, 0, 48, 2, 119, 0, 64, 2, 119, 0, 80, 2, 119, 0, 4, 2, 119, 2, 119, 2, 119, 0, -7, 4, +0, 0, 31, 2, -101, -78, 42, 42, 31, -72, 2, -102, 64, 43, 41, 42, 31, -128, -70, 1, -128, -68, 1, -128, 82, +1, -128, -94, 1, -128, 101, 1, -128, 126, 1, -128, -127, 1, -128, 60, 1, -128, 94, 1, -128, 43, 1, -128, 28, 1, +-128, 30, 1, -128, 64, 1, -128, -69, 1, 56, 0, 1, 0, -128, 1, 64, -76, 1, -128, 64, 1, -128, -69, 1, 56, +0, 1, 0, -128, 1, 57, 64, 24, 1, -128, -54, 1, -128, -83, 1, -128, 115, 1, -128, 38, 1, -128, 37, 1, -128, +36, 1, -128, 32, 1, 55, 64, -72, 2, 33, -78, 73, 51, 64, -72, 2, 33, -78, 69, 51, 64, -72, 2, 33, -77, +65, 66, 50, 64, -72, 2, 33, -77, 61, 62, 50, 15, 65, 15, 2, 33, 0, 63, 2, 33, 0, 127, 2, 33, 0, +3, 0, -65, 2, 33, 0, -49, 2, 33, 0, -1, 2, 33, 0, 3, 0, 64, 2, 33, -77, 32, 34, 50, 64, -72, +2, 33, -77, 25, 30, 50, 64, -72, 2, 34, -77, 42, 63, 50, 64, -72, 2, 33, -77, 46, 58, 50, 111, 65, 72, +2, -61, 0, 127, 2, -61, 0, -113, 2, -61, 0, -33, 2, -61, 0, 4, 0, 47, 2, -61, 0, 96, 2, -61, 0, +-49, 2, -61, 0, 3, 0, 15, 2, -61, 0, 63, 2, -61, 0, 95, 2, -61, 0, -64, 2, -61, 0, -17, 2, -61, +0, -1, 2, -61, 0, 6, 0, -33, 2, 34, 0, 1, 0, -113, 2, 34, 0, 1, 0, 15, 2, 34, 0, 47, 2, +34, 0, 63, 2, 34, 0, 95, 2, 34, 0, 127, 2, 34, 0, -17, 2, 34, 0, 6, 0, -65, 2, 33, 0, -17, +2, 33, 0, 2, 0, 111, 2, 33, 0, 127, 2, 33, 0, -81, 2, 33, 0, 3, 0, 47, 2, 33, 0, 63, 2, +33, 0, 79, 2, 33, 0, 3, 2, -61, 2, -61, 2, 34, 2, 34, 2, 33, 2, 33, 64, 29, 16, 28, 16, 43, +16, 72, 3, -113, 28, 1, 15, 30, 1, 79, 30, -1, 30, 2, 55, 0, 22, 22, 0, 0, 0, 18, 17, 8, 17, +-72, 1, 13, -74, -9, 13, -8, -9, 13, 0, 9, 65, 9, 2, -114, 2, -113, 0, 29, 0, 31, 2, -112, 2, -113, +0, 29, 0, 31, 2, -113, -78, -7, 29, 31, -72, 1, -104, -78, 38, -69, 31, 65, 21, 1, -105, 0, 30, 4, 1, +0, 31, 1, 57, 0, 38, 1, 37, 0, 31, 1, 56, 0, 115, 4, 1, 0, 31, 1, 53, 0, 28, 8, 1, 0, +31, 1, 52, 0, 28, 2, -85, 0, 31, 1, 50, -78, 28, 86, 31, -72, 1, 15, -78, 38, 44, 31, -70, 1, 14, +0, 30, 4, 1, -74, 31, -7, 28, -28, 31, -23, 28, -72, 2, 1, -74, 31, -24, 28, -69, 31, -41, 32, -72, 4, +1, -78, 31, -43, 28, -72, 2, -85, -74, 31, -44, 28, -119, 31, -55, 47, -72, 8, 1, -78, 31, -68, 38, -72, 1, +1, -78, 31, -70, 32, -72, 2, 1, -74, 31, -71, 28, 56, 31, -83, -54, -72, 4, 1, -78, 31, -127, 38, -72, 1, +-102, -78, 31, 126, 38, -72, 1, -102, -74, 31, 125, 28, 71, 31, 107, 28, -72, 4, 1, -78, 31, 101, 38, -72, 1, +-102, -78, 31, 94, 115, -72, 4, 1, 64, 15, 31, 82, 38, 90, 31, 72, 28, -119, 31, 68, 28, 98, 31, 64, 115, +-72, 8, 1, -74, 31, 63, 28, 94, 31, 60, 38, -72, 1, -102, -78, 31, 53, 28, -72, 4, 1, -74, 31, 48, 28, +-69, 31, 43, 28, -72, 4, 1, -74, 31, 42, 28, 86, 31, 41, 28, -72, 1, 1, -78, 31, 35, 30, -72, 4, 1, +-78, 31, 85, 55, -72, 1, 104, 64, 44, 7, -106, 7, 88, 7, 79, 7, 54, 7, 50, 7, 44, 7, 33, 7, 31, +7, 29, 7, 27, 7, 20, 8, 18, 8, 16, 8, 14, 8, 12, 8, 10, 8, 8, 8, 6, 8, 4, 8, 2, 8, +0, 8, 20, -72, -1, -32, 64, 43, 0, 0, 1, 0, 20, 6, 16, 0, 0, 1, 0, 6, 4, 0, 0, 1, 0, +4, 16, 0, 0, 1, 0, 16, 2, 0, 0, 1, 0, 2, 0, 0, 0, 1, 0, 0, 2, 1, 8, 2, 0, 74, +0, -80, 19, 3, 75, 2, 75, 83, 66, 1, 75, -80, -64, 99, 0, 75, 98, 32, -80, -10, 83, 35, -72, 1, 10, +81, 90, -80, 5, 35, 66, 1, -80, 18, 75, 0, 75, 84, 66, -80, 56, 43, 75, -72, 7, -1, 82, -80, 55, 43, +75, -80, 7, 80, 91, 88, -79, 1, 1, -114, 89, -80, 56, 43, -80, 2, -120, -72, 1, 0, 84, 88, -72, 1, -1, +-79, 1, 1, -114, -123, 27, -80, 18, 67, 88, -71, 0, 1, 1, 17, -123, -115, 27, -71, 0, 1, 1, 40, -123, -115, +89, 89, 0, 24, 22, 118, 63, 24, 63, 18, 62, 17, 57, 70, 68, 62, 17, 57, 70, 68, 62, 17, 57, 70, 68, +62, 17, 57, 70, 68, 62, 17, 57, 70, 96, 68, 62, 17, 57, 70, 96, 68, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 24, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 24, 43, 29, -80, -106, 75, 83, 88, -80, -86, +29, 89, -80, 50, 75, 83, 88, -80, -1, 29, 89, 75, -80, -109, 83, 32, 92, 88, -71, 1, -14, 1, -16, 69, 68, +-71, 1, -15, 1, -16, 69, 68, 89, 88, -71, 3, 62, 1, -14, 69, 82, 88, -71, 1, -14, 3, 62, 68, 89, 89, +75, -72, 1, 86, 83, 32, 92, 88, -71, 0, 32, 1, -15, 69, 68, -71, 0, 38, 1, -15, 69, 68, 89, 88, -71, +8, 30, 0, 32, 69, 82, 88, -71, 0, 32, 8, 30, 68, 89, 89, 75, -72, 1, -102, 83, 32, 92, 88, -71, 0, +37, 1, -14, 69, 68, -71, 0, 36, 1, -14, 69, 68, 89, 88, -71, 9, 9, 0, 37, 69, 82, 88, -71, 0, 37, +9, 9, 68, 89, 89, 75, -72, 4, 1, 83, 32, 92, 88, -79, 115, 36, 69, 68, -79, 36, 36, 69, 68, 89, 88, +-71, 23, 32, 0, 115, 69, 82, 88, -71, 0, 115, 23, 32, 68, 89, 89, 75, -72, 4, 1, 83, 32, 92, 88, -79, +-54, 37, 69, 68, -79, 37, 37, 69, 68, 89, 88, -71, 22, -128, 0, -54, 69, 82, 88, -71, 0, -54, 22, -128, 68, +89, 89, 75, -80, 62, 83, 32, 92, 88, -79, 28, 28, 69, 68, -79, 30, 28, 69, 68, 89, 88, -71, 1, 26, 0, +28, 69, 82, 88, -71, 0, 28, 1, 26, 68, 89, 89, 75, -80, 86, 83, 32, 92, 88, -79, 28, 28, 69, 68, -79, +47, 28, 69, 68, 89, 88, -71, 1, -119, 0, 28, 69, 82, 88, -71, 0, 28, 1, -119, 68, 89, 89, 75, -72, 3, +1, 83, 32, 92, 88, -79, 28, 28, 69, 68, -79, 28, 28, 69, 68, 89, 88, -71, 13, -32, 0, 28, 69, 82, 88, +-71, 0, 28, 13, -32, 68, 89, 89, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 101, +66, 43, 43, 1, -77, 59, 89, 99, 92, 69, 101, 35, 69, 96, 35, 69, 101, 96, 35, 69, 96, -80, -117, 118, 104, +24, -80, -128, 98, 32, 32, -79, 99, 89, 69, 101, 35, 69, 32, -80, 3, 38, 96, 98, 99, 104, 32, -80, 3, 38, +97, 101, -80, 89, 35, 101, 68, -80, 99, 35, 68, 32, -79, 59, 92, 69, 101, 35, 69, 32, -80, 3, 38, 96, 98, +99, 104, 32, -80, 3, 38, 97, 101, -80, 92, 35, 101, 68, -80, 59, 35, 68, -79, 0, 92, 69, 84, 88, -79, 92, +64, 101, 68, -78, 59, 64, 59, 69, 35, 97, 68, 89, -77, 71, 80, 52, 55, 69, 101, 35, 69, 96, 35, 69, 101, +96, 35, 69, 96, -80, -119, 118, 104, 24, -80, -128, 98, 32, 32, -79, 52, 80, 69, 101, 35, 69, 32, -80, 3, 38, +96, 98, 99, 104, 32, -80, 3, 38, 97, 101, -80, 80, 35, 101, 68, -80, 52, 35, 68, 32, -79, 71, 55, 69, 101, +35, 69, 32, -80, 3, 38, 96, 98, 99, 104, 32, -80, 3, 38, 97, 101, -80, 55, 35, 101, 68, -80, 71, 35, 68, +-79, 0, 55, 69, 84, 88, -79, 55, 64, 101, 68, -78, 71, 64, 71, 69, 35, 97, 68, 89, 0, 75, 83, 66, 1, +75, 80, 88, -79, 8, 0, 66, 89, 67, 92, 88, -79, 8, 0, 66, 89, -77, 2, 11, 10, 18, 67, 88, 96, 27, +33, 89, 66, 22, 16, 112, 62, -80, 18, 67, 88, -71, 59, 33, 24, 126, 27, -70, 4, 0, 1, -88, 0, 11, 43, +89, -80, 12, 35, 66, -80, 13, 35, 66, -80, 18, 67, 88, -71, 45, 65, 45, 65, 27, -70, 4, 0, 4, 0, 0, +11, 43, 89, -80, 14, 35, 66, -80, 15, 35, 66, -80, 18, 67, 88, -71, 24, 126, 59, 33, 27, -70, 1, -88, 4, +0, 0, 11, 43, 89, -80, 16, 35, 66, -80, 17, 35, 66, 0, 43, 116, 117, 115, 117, 0, 24, 69, 105, 68, 69, +105, 68, 69, 105, 68, 115, 115, 115, 115, 116, 117, 115, 116, 117, 43, 43, 43, 43, 116, 117, 43, 43, 43, 43, 43, +115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, +43, 43, 43, 69, -80, 64, 97, 68, 115, 116, 0, 0, 75, -80, 42, 83, 75, -80, 63, 81, 90, 88, -79, 7, 7, +69, -80, 64, 96, 68, 89, 0, 75, -80, 58, 83, 75, -80, 63, 81, 90, 88, -79, 11, 11, 69, -72, -1, -64, 96, +68, 89, 0, 75, -80, 46, 83, 75, -80, 58, 81, 90, 88, -79, 3, 3, 69, -80, 64, 96, 68, 89, 0, 75, -80, +46, 83, 75, -80, 60, 81, 90, 88, -79, 9, 9, 69, -72, -1, -64, 96, 68, 89, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 117, 43, 43, 43, 43, 43, 43, 43, 67, 92, 88, -71, 0, -128, +2, -69, -77, 1, 64, 30, 1, 116, 0, 115, 89, 3, -80, 30, 75, 84, 2, -80, 18, 75, 84, 90, -80, 18, 67, +92, 90, 88, -70, 0, -97, 2, 34, 0, 1, 0, 115, 89, 0, 43, 116, 115, 1, 43, 1, 115, 43, 43, 43, 43, +43, 43, 43, 43, 115, 115, 115, 115, 43, 0, 43, 43, 43, 43, 43, 43, 0, 69, 105, 68, 115, 69, 105, 68, 115, +69, 105, 68, 115, 116, 117, 69, 105, 68, 115, 69, 105, 68, 69, 105, 68, 69, 105, 68, 115, 116, 69, 105, 68, 69, +105, 68, 115, 43, 43, 43, 43, 43, 115, 43, 0, 43, 115, 43, 116, 117, 43, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, 115, 116, 117, 43, 0, 5, -70, 0, 25, 5, -70, 0, 26, 5, -89, 0, 25, 4, 38, 0, +24, 0, 0, -1, -25, 0, 0, -1, -24, 0, 0, -1, -25, -2, 105, -1, -24, 5, -70, 0, 25, -2, 105, -1, -24, +2, -22, 0, 0, 0, -72, 0, 0, 0, -72, 0, 0, 0, 0, 0, -88, 0, -83, 1, 105, 0, -83, 0, -65, 0, +-62, 1, -16, 0, 24, 0, -81, 0, -71, 0, -76, 0, -56, 0, 23, 0, 68, 0, -100, 0, 124, 0, -108, 0, -121, +0, 6, 0, 90, 0, -56, 0, -119, 0, 82, 0, 82, 0, 5, 0, 68, 0, -108, 1, 25, -1, -76, 0, 47, 0, +-95, 0, 3, 0, -95, 0, -51, 0, 23, 0, 87, 0, 126, 0, -70, 0, 22, 1, 24, -1, -23, 0, 127, 0, -123, +3, -45, 0, -121, 0, -123, 0, 13, 0, 34, 0, 65, 0, 80, 0, 111, 0, -115, 1, 76, -1, 117, 0, 92, 0, +-33, 4, -125, 0, 55, 0, 76, 0, 110, 0, 112, 1, -128, -1, 88, -1, -114, -1, -110, -1, -92, 0, -91, 0, -71, +3, -56, -1, -3, 0, 11, 0, 26, 0, 99, 0, 99, 0, -51, -1, -18, 5, -40, -1, -36, 0, 45, 0, 92, 0, +-107, 0, -103, 0, -33, 1, -110, 9, -75, 0, 64, 0, 87, 0, -128, 0, -71, 3, -99, 0, 114, 0, -102, 3, 93, +4, 1, -1, 103, -1, -6, 0, 3, 0, 33, 0, 119, 0, -51, 0, 4, 0, 77, 0, -51, 1, -64, 2, 43, 0, +76, 0, 101, 0, -25, 1, 24, 1, 124, 3, 67, 5, -40, -1, -93, -1, -80, -1, -60, 0, 3, 0, 28, 0, 93, +0, 104, 0, -102, 0, -70, 1, 53, 1, 71, 2, 33, 5, 92, -1, 77, -1, -51, 0, 22, 0, 45, 0, 120, 0, +-128, 0, -103, 0, -78, 0, -74, 0, -74, 0, -72, 0, -67, 0, -38, 1, 12, 5, -16, -1, -92, -1, -16, 0, 25, +0, 44, 0, 73, 0, 127, 0, -76, 0, -50, 1, -64, 3, -2, -3, -127, -2, 63, 0, 0, 0, 5, 0, 24, 0, +41, 0, 57, 0, 73, 0, 111, 0, -66, 0, -57, 0, -48, 1, 35, 1, -63, 2, 111, 5, 12, 5, 50, 5, 64, +5, 122, -1, -44, 0, 20, 0, 49, 0, 85, 0, 87, 0, -89, 0, -76, 0, -26, 1, -9, 2, 126, 2, 126, 2, +127, 3, -58, 4, 70, -1, 66, 0, 14, 0, -123, 0, -111, 0, -65, 0, -62, 0, -59, 0, -31, 1, 26, 1, 47, +1, 79, 1, 86, 2, 41, 2, 111, 2, -98, 3, 114, 0, 8, 0, 44, 0, 49, 0, 49, 0, 100, 0, 105, 0, +-119, 0, -104, 0, -57, 0, -34, 1, 43, 1, -74, 2, 12, 2, -49, 3, -93, 4, -85, 4, -5, 6, 29, -2, -32, +-1, 14, 0, 6, 0, 38, 0, -101, 0, -99, 0, -63, 1, 13, 1, 24, 1, 32, 1, 115, 1, -126, 1, -42, 1, +-29, 2, 67, 2, 95, 2, -101, 2, -30, 3, -108, 4, -87, 4, -46, 7, 97, 0, 28, 0, 94, 0, 109, 0, -115, +0, -85, 0, -9, 1, 18, 1, 56, 1, 81, 1, 91, 1, 104, 1, 124, 1, -121, 1, -111, 1, -103, 1, -51, 1, +-48, 1, -24, 2, 65, 2, 84, 2, 107, 2, -17, 3, 104, 3, 113, 3, -67, 4, 66, 4, 66, 4, 83, 4, 115, +4, -125, 5, -122, 5, -117, 6, -24, -2, 88, -2, -60, -2, -47, -2, -9, -1, 50, -1, -122, 0, 81, 0, 124, 0, +-127, 0, -111, 0, -107, 0, -98, 0, -76, 0, -71, 0, -49, 0, -39, 0, -39, 0, -33, 0, -30, 1, 5, 1, 11, +1, 14, 1, 14, 1, 32, 1, 33, 1, 85, 1, 123, 1, 123, 1, 126, 1, -115, 1, -94, 1, -88, 1, -87, 1, +-76, 1, -48, 1, -48, 1, -30, 1, -23, 1, -14, 1, -11, 1, -5, 2, 0, 2, 0, 2, 6, 2, 27, 2, 33, +2, 34, 2, 34, 2, 35, 2, 114, 2, 119, 2, -108, 2, -100, 2, -49, 2, -49, 2, -48, 2, -20, 2, -7, 3, +23, 3, 34, 3, 43, 3, 53, 3, 60, 3, 89, 3, 111, 3, 113, 3, -121, 3, -112, 3, -112, 3, -75, 3, -31, +4, 26, 4, -49, 4, -1, 5, 50, 5, 50, 5, -106, 5, -97, 5, -88, 5, -85, 5, -62, 5, -16, 6, 12, 7, +-126, 8, 0, 8, -52, -4, -93, -3, 42, -3, -34, -2, 0, -2, -120, -2, -106, -2, -78, -2, -76, -1, -31, 0, 21, +0, 25, 0, 26, 0, 28, 0, 31, 0, 60, 0, 81, 0, 97, 0, 97, 0, 106, 0, 120, 0, -106, 0, -91, 0, +-81, 0, -45, 1, 12, 1, 24, 1, 26, 1, 42, 1, 62, 1, 76, 1, 81, 1, 95, 1, 106, 1, 113, 1, 120, +1, -126, 1, -124, 1, -102, 1, -91, 1, -88, 1, -87, 1, -82, 1, -68, 1, -51, 1, -41, 1, -17, 2, 0, 2, +13, 2, 28, 2, 33, 2, 34, 2, 46, 2, 53, 2, 66, 2, 79, 2, 79, 2, 94, 2, 101, 2, 113, 2, -112, +2, -110, 2, -76, 2, -42, 2, -6, 3, 7, 3, 11, 3, 15, 3, 21, 3, 42, 3, 71, 3, 93, 3, 101, 3, +116, 3, 121, 3, -106, 3, -80, 3, -52, 3, -35, 3, -30, 3, -10, 3, -4, 3, -4, 3, -1, 4, 10, 4, 31, +4, 34, 4, 38, 4, 43, 4, 71, 4, 95, 4, 117, 4, -98, 4, -25, 4, -25, 5, 92, 5, -53, 5, -27, 6, +10, 6, 109, 6, -122, 6, -72, 6, -15, 7, 54, 7, 62, 7, 80, 7, 81, 7, 93, 7, -113, 7, -74, 7, -44, +8, 96, 0, -74, 0, -61, 0, -75, 0, -73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -32, 3, +-127, 3, 69, 3, -75, 0, -114, 2, 51, 4, 25, 2, -50, 2, -50, 0, 45, 0, 95, 0, 100, 3, 77, 2, 63, +0, 0, 2, -88, 1, -120, 2, 125, 1, -76, 2, 36, 5, 120, 6, 59, 2, 59, 1, 78, 0, -16, 4, 38, 2, +-108, 2, -58, 2, -97, 2, -10, 2, 59, 3, 77, 1, 75, 1, 83, 0, 106, 2, 49, 0, 0, 0, 0, 0, 0, +6, 20, 4, -86, 0, 0, 0, 60, 4, -61, 0, -19, 4, -68, 2, 101, 2, -50, 3, -75, 0, 120, 6, 12, 1, +126, 2, -17, 6, 12, 0, -78, 1, 0, 2, 57, 0, 0, 1, -59, 3, 48, 4, 43, 3, -53, 0, -38, 3, -33, +1, 7, 4, -95, 0, -37, 4, 10, 1, 23, 1, -19, 2, -89, 3, 80, 1, 11, 1, -67, 4, 62, 5, 88, 0, +33, 3, -100, 0, -82, 3, 113, 1, 125, 0, -75, 2, 69, 0, 0, 10, -5, 8, -116, 1, 43, 1, 78, 1, -86, +0, -121, 0, 84, 1, 50, 1, -8, 3, -1, 0, 3, 2, 78, 0, -76, 0, 55, 3, -29, 0, -125, 0, 107, 2, +-40, 0, -19, 0, 119, 0, -120, 0, -105, 1, 100, 4, 103, 0, -114, 0, 51, 1, 124, 0, -25, 0, -90, 2, -98, +3, 41, 5, 110, 6, 42, 6, 21, 1, -55, 2, 105, 4, -118, 2, 19, 1, -76, 0, 2, 4, -87, 0, 0, 2, +57, 1, 36, 1, 3, 5, 20, 0, -124, 1, 93, 3, -102, 6, -17, 2, -39, 0, 117, 0, -49, 4, 10, 0, -34, +3, -84, 4, -68, 2, -49, 2, -82, 3, 77, 4, -16, 5, 82, 1, 104, 0, 109, 0, 125, 0, -122, 0, 113, -1, +-127, 0, 121, 5, 88, 4, -46, 1, 103, 0, 3, 1, 86, 0, 37, 4, -32, 0, -108, 0, 124, 3, 50, 4, 33, +0, -108, 0, 127, 0, 114, 0, 92, 0, 47, 0, -74, 0, 24, 0, -70, 0, -72, 0, 65, 3, 77, 0, 114, 0, +24, 0, 31, 0, 76, 1, 106, 1, 85, 0, -103, 0, -102, 0, -102, 0, -104, 0, -78, 0, 4, 0, 120, 0, 105, +0, 20, 0, 87, 0, 110, 0, -50, 0, -76, 6, 84, 2, -72, 0, 103, 5, 14, 1, 101, 0, -25, 0, 0, 4, +-53, -2, 82, 0, 90, -1, -90, 0, -103, -1, 103, 0, 110, -1, -110, 0, 45, -1, -44, 0, -121, -1, 124, 0, -72, +0, -88, 0, -27, 0, -113, 0, -88, 1, -123, -2, 123, 0, 112, 0, 30, 0, -39, 0, -34, 1, 76, 5, 70, 2, +-49, 5, 70, -1, 45, 2, -118, 2, -39, 2, 83, 2, -106, 0, -73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 1, 37, 1, 24, 0, -22, 0, -22, 0, -82, 0, 0, 0, 62, 5, -69, 0, -118, 4, -41, 0, +83, 0, 63, -1, -116, -1, -43, 0, 21, 0, 40, 0, 34, 0, -103, 0, 98, 0, 74, 0, -28, 0, 109, 0, -18, +0, -27, 0, 72, 3, -64, 0, 51, -2, 78, 2, -79, -1, 70, 3, 112, 0, 121, 5, -33, 0, 81, -1, -89, -1, +31, 1, 10, 0, 104, -1, 108, 0, 79, 0, -68, 0, -91, 7, 5, 0, 97, 7, 43, 0, 0, 0, 0, 0, 0, +0, 42, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, -42, 0, 0, 1, 126, 0, 0, 3, +32, 0, 0, 5, -90, 0, 0, 7, 78, 0, 0, 9, 56, 0, 0, 9, 126, 0, 0, 9, -2, 0, 0, 10, -92, +0, 0, 11, -124, 0, 0, 11, -20, 0, 0, 12, 100, 0, 0, 12, -86, 0, 0, 12, -26, 0, 0, 13, 86, 0, +0, 15, 18, 0, 0, 15, -18, 0, 0, 18, 24, 0, 0, 19, -14, 0, 0, 21, 82, 0, 0, 23, 12, 0, 0, +24, -30, 0, 0, 25, -114, 0, 0, 28, 34, 0, 0, 30, 86, 0, 0, 30, -78, 0, 0, 31, 112, 0, 0, 31, +-14, 0, 0, 32, 98, 0, 0, 32, -24, 0, 0, 33, -38, 0, 0, 35, -38, 0, 0, 37, -124, 0, 0, 39, 28, +0, 0, 40, 86, 0, 0, 41, -98, 0, 0, 42, 98, 0, 0, 43, 24, 0, 0, 44, -88, 0, 0, 45, -82, 0, +0, 46, -110, 0, 0, 47, 122, 0, 0, 49, -80, 0, 0, 50, 58, 0, 0, 53, 100, 0, 0, 55, 14, 0, 0, +56, 66, 0, 0, 57, 72, 0, 0, 59, 60, 0, 0, 61, -88, 0, 0, 64, 82, 0, 0, 65, 0, 0, 0, 66, +36, 0, 0, 67, -104, 0, 0, 69, -42, 0, 0, 72, -30, 0, 0, 74, -120, 0, 0, 75, -56, 0, 0, 76, 50, +0, 0, 76, -100, 0, 0, 77, 0, 0, 0, 77, -120, 0, 0, 77, -68, 0, 0, 78, 56, 0, 0, 81, 10, 0, +0, 82, -24, 0, 0, 84, -100, 0, 0, 86, 80, 0, 0, 88, 14, 0, 0, 89, 98, 0, 0, 91, 82, 0, 0, +92, -10, 0, 0, 93, -22, 0, 0, 95, 2, 0, 0, 97, -102, 0, 0, 98, -106, 0, 0, 100, -58, 0, 0, 102, +-116, 0, 0, 104, 78, 0, 0, 106, 18, 0, 0, 107, -88, 0, 0, 108, -82, 0, 0, 112, 86, 0, 0, 113, 122, +0, 0, 115, 24, 0, 0, 117, 54, 0, 0, 121, -96, 0, 0, 123, -60, 0, 0, 126, 28, 0, 0, -128, 4, 0, +0, -127, 2, 0, 0, -127, 78, 0, 0, -126, 80, 0, 0, -126, -16, 0, 0, -125, 60, 0, 0, -125, 112, 0, 0, +-125, -84, 0, 0, -125, -18, 0, 0, -124, 84, 0, 0, -124, -102, 0, 0, -124, -50, 0, 0, -123, 4, 0, 0, -123, +58, 0, 0, -123, -118, 0, 0, -123, -52, 0, 0, -122, 30, 0, 0, -122, 86, 0, 0, -122, -88, 0, 0, -122, -34, +0, 0, -121, 30, 0, 0, -121, 96, 0, 0, -121, -98, 0, 0, -121, -24, 0, 0, -120, 40, 0, 0, -120, 86, 0, +0, -120, -114, 0, 0, -120, -34, 0, 0, -119, 20, 0, 0, -119, 84, 0, 0, -119, -114, 0, 0, -119, -46, 0, 0, +-118, 28, 0, 0, -118, 88, 0, 0, -118, -120, 0, 0, -118, -52, 0, 0, -117, 4, 0, 0, -117, -108, 0, 0, -116, +26, 0, 0, -114, 40, 0, 0, -113, -68, 0, 0, -111, 108, 0, 0, -111, -72, 0, 0, -110, 76, 0, 0, -108, 112, +0, 0, -106, -60, 0, 0, -104, -76, 0, 0, -103, -96, 0, 0, -102, 34, 0, 0, -102, -116, 0, 0, -101, -86, 0, +0, -99, 6, 0, 0, -97, 78, 0, 0, -96, -80, 0, 0, -95, 62, 0, 0, -95, -24, 0, 0, -94, -84, 0, 0, +-93, -12, 0, 0, -91, -98, 0, 0, -90, -116, 0, 0, -89, 82, 0, 0, -89, -74, 0, 0, -88, 36, 0, 0, -87, +78, 0, 0, -86, 114, 0, 0, -85, 2, 0, 0, -84, -28, 0, 0, -81, 62, 0, 0, -78, -112, 0, 0, -77, -122, +0, 0, -76, 44, 0, 0, -76, 124, 0, 0, -75, 50, 0, 0, -74, 82, 0, 0, -73, -16, 0, 0, -72, -118, 0, +0, -71, 78, 0, 0, -70, 14, 0, 0, -70, 118, 0, 0, -70, -78, 0, 0, -69, 10, 0, 0, -69, 88, 0, 0, +-67, 112, 0, 0, -65, -74, 0, 0, -65, -18, 0, 0, -64, 32, 0, 0, -63, 74, 0, 0, -62, 118, 0, 0, -61, +36, 0, 0, -61, -56, 0, 0, -60, 106, 0, 0, -59, 60, 0, 0, -59, -112, 0, 0, -59, -58, 0, 0, -58, 30, +0, 0, -57, 112, 0, 0, -57, -30, 0, 0, -56, 60, 0, 0, -55, -76, 0, 0, -53, 32, 0, 0, -52, 0, 0, +0, -52, 50, 0, 0, -52, -50, 0, 0, -51, -14, 0, 0, -48, 104, 0, 0, -48, -94, 0, 0, -48, -26, 0, 0, +-47, 34, 0, 0, -47, -124, 0, 0, -47, -58, 0, 0, -46, 12, 0, 0, -46, 88, 0, 0, -46, -118, 0, 0, -46, +-34, 0, 0, -45, 28, 0, 0, -45, 76, 0, 0, -45, -118, 0, 0, -45, -48, 0, 0, -44, 18, 0, 0, -44, 80, +0, 0, -44, -46, 0, 0, -43, 64, 0, 0, -42, 38, 0, 0, -42, 98, 0, 0, -42, -30, 0, 0, -41, 22, 0, +0, -41, -72, 0, 0, -40, 64, 0, 0, -40, -84, 0, 0, -39, 56, 0, 0, -39, -92, 0, 0, -38, -112, 0, 0, +-37, -126, 0, 0, -37, -74, 0, 0, -37, -22, 0, 0, -36, 26, 0, 0, -36, 94, 0, 0, -36, -42, 0, 0, -34, +80, 0, 0, -32, 106, 0, 0, -32, -100, 0, 0, -32, -42, 0, 0, -31, -48, 0, 0, -29, 94, 0, 0, -29, -108, +0, 0, -28, -8, 0, 0, -27, 116, 0, 0, -26, 84, 0, 0, -25, 74, 0, 0, -24, -38, 0, 0, -22, 68, 0, +0, -20, 50, 0, 0, -19, 46, 0, 0, -19, 116, 0, 0, -19, -88, 0, 0, -19, -22, 0, 0, -18, 36, 0, 0, +-18, 120, 0, 0, -18, -64, 0, 0, -17, 10, 0, 0, -17, 58, 0, 0, -17, 106, 0, 0, -15, 82, 0, 0, -15, +-112, 0, 0, -15, -54, 0, 0, -15, -6, 0, 0, -14, 46, 0, 0, -14, 94, 0, 0, -14, -118, 0, 0, -14, -46, +0, 0, -12, -120, 0, 0, -10, 2, 0, 0, -10, 46, 0, 0, -10, 112, 0, 0, -10, -76, 0, 0, -10, -28, 0, +0, -9, 20, 0, 0, -9, 106, 0, 0, -8, 72, 0, 0, -7, 90, 0, 0, -7, -98, 0, 0, -7, -44, 0, 0, +-6, 46, 0, 0, -6, 108, 0, 0, -6, -96, 0, 0, -6, -48, 0, 0, -5, 12, 0, 0, -5, 76, 0, 0, -5, +-118, 0, 0, -5, -58, 0, 0, -4, 8, 0, 0, -4, 62, 0, 0, -4, 122, 0, 0, -4, -70, 0, 0, -3, -56, +0, 0, -1, 52, 0, 0, -1, -124, 0, 1, 0, -32, 0, 1, 1, 54, 0, 1, 1, 106, 0, 1, 1, -72, 0, +1, 2, 4, 0, 1, 2, 70, 0, 1, 2, 126, 0, 1, 2, -76, 0, 1, 2, -4, 0, 1, 3, -98, 0, 1, +5, 58, 0, 1, 7, 2, 0, 1, 8, -124, 0, 1, 10, 118, 0, 1, 11, -56, 0, 1, 13, 76, 0, 1, 14, +46, 0, 1, 15, -56, 0, 1, 16, 50, 0, 1, 16, 90, 0, 1, 16, -8, 0, 1, 19, 122, 0, 1, 19, -70, +0, 1, 19, -6, 0, 1, 20, 58, 0, 1, 20, 120, 0, 1, 20, -42, 0, 1, 21, 52, 0, 1, 21, -94, 0, +1, 21, -62, 0, 1, 22, -84, 0, 1, 23, 76, 0, 1, 23, -126, 0, 1, 23, -48, 0, 1, 24, 26, 0, 1, +24, 100, 0, 1, 24, -128, 0, 1, 24, -100, 0, 1, 24, -68, 0, 1, 24, -36, 0, 1, 24, -4, 0, 1, 25, +28, 0, 1, 25, 66, 0, 1, 25, 104, 0, 1, 25, -114, 0, 1, 25, -76, 0, 1, 25, -28, 0, 1, 26, 12, +0, 1, 26, 52, 0, 1, 26, 96, 0, 1, 26, -116, 0, 1, 26, -64, 0, 1, 26, -22, 0, 1, 27, 22, 0, +1, 27, 76, 0, 1, 27, 118, 0, 1, 27, -94, 0, 1, 27, -40, 0, 1, 28, 2, 0, 1, 28, 44, 0, 1, +28, 96, 0, 1, 28, -112, 0, 1, 28, -60, 0, 1, 29, 8, 0, 1, 29, 56, 0, 1, 29, 108, 0, 1, 29, +-82, 0, 1, 29, -30, 0, 1, 30, 20, 0, 1, 30, 86, 0, 1, 30, -118, 0, 1, 30, -70, 0, 1, 30, -4, +0, 1, 31, 64, 0, 1, 31, -122, 0, 1, 31, -30, 0, 1, 31, -2, 0, 1, 32, 26, 0, 1, 32, 54, 0, +1, 32, 82, 0, 1, 32, 110, 0, 1, 33, -36, 0, 1, 36, -84, 0, 1, 39, 28, 0, 1, 39, 56, 0, 1, +39, 82, 0, 1, 39, 110, 0, 1, 39, -118, 0, 1, 39, -90, 0, 1, 39, -62, 0, 1, 40, 30, 0, 1, 40, +88, 0, 1, 40, -62, 0, 1, 41, -116, 0, 1, 42, 44, 0, 1, 43, 2, 0, 1, 43, -126, 0, 1, 44, 10, +0, 1, 44, 122, 0, 1, 45, 16, 0, 1, 45, 110, 0, 1, 45, -76, 0, 1, 46, 18, 0, 1, 46, 116, 0, +1, 47, 44, 0, 1, 47, -22, 0, 1, 48, 22, 0, 1, 48, 114, 0, 1, 48, -74, 0, 1, 50, 34, 0, 1, +51, 22, 0, 1, 51, 64, 0, 1, 51, 92, 0, 1, 51, -120, 0, 1, 51, -64, 0, 1, 52, 12, 0, 1, 52, +76, 0, 1, 52, -128, 0, 1, 52, -80, 0, 1, 52, -32, 0, 1, 53, 16, 0, 1, 53, 84, 0, 1, 53, -124, +0, 1, 53, -76, 0, 1, 53, -12, 0, 1, 54, 36, 0, 1, 54, 84, 0, 1, 54, -124, 0, 1, 54, -60, 0, +1, 54, -12, 0, 1, 55, 36, 0, 1, 55, 84, 0, 1, 55, -126, 0, 1, 57, -122, 0, 1, 57, -74, 0, 1, +57, -26, 0, 1, 59, 54, 0, 1, 60, -20, 0, 1, 61, 28, 0, 1, 61, 74, 0, 1, 61, 122, 0, 1, 61, +-88, 0, 1, 61, -40, 0, 1, 62, 6, 0, 1, 63, 52, 0, 1, 64, 98, 0, 1, 64, -110, 0, 1, 66, 2, +0, 1, 66, 58, 0, 1, 66, 106, 0, 1, 67, -4, 0, 1, 68, 42, 0, 1, 68, 88, 0, 1, 68, -122, 0, +1, 68, -82, 0, 1, 70, 12, 0, 1, 71, -92, 0, 1, 71, -36, 0, 1, 72, 28, 0, 1, 72, 88, 0, 1, +72, -120, 0, 1, 72, -74, 0, 1, 72, -46, 0, 1, 73, 2, 0, 1, 73, 50, 0, 1, 74, 34, 0, 1, 75, +-118, 0, 1, 75, -70, 0, 1, 75, -12, 0, 1, 76, 52, 0, 1, 76, 100, 0, 1, 76, -108, 0, 1, 76, -42, +0, 1, 78, 118, 0, 1, 80, 86, 0, 1, 80, -106, 0, 1, 80, -42, 0, 1, 81, 6, 0, 1, 81, 70, 0, +1, 82, 48, 0, 1, 82, -80, 0, 1, 83, -108, 0, 1, 83, -60, 0, 1, 83, -12, 0, 1, 84, 36, 0, 1, +84, 84, 0, 1, 84, -112, 0, 1, 84, -62, 0, 1, 84, -12, 0, 1, 85, 36, 0, 1, 85, 84, 0, 1, 85, +-102, 0, 1, 85, -52, 0, 1, 85, -4, 0, 1, 86, 50, 0, 1, 86, -92, 0, 1, 86, -40, 0, 1, 88, -90, +0, 1, 89, -88, 0, 1, 91, 56, 0, 1, 93, 104, 0, 1, 95, -72, 0, 1, 97, 74, 0, 1, 97, -82, 0, +1, 98, 56, 0, 1, 98, 72, 0, 1, 98, -42, 0, 1, 100, -44, 0, 1, 102, 0, 0, 1, 103, 108, 0, 1, +104, 92, 0, 1, 105, -32, 0, 1, 107, -6, 0, 1, 110, 38, 0, 1, 111, 24, 0, 1, 111, 40, 0, 1, 111, +56, 0, 1, 112, 80, 0, 1, 112, 96, 0, 1, 112, 112, 0, 1, 112, -128, 0, 1, 112, -112, 0, 1, 112, -96, +0, 1, 113, -66, 0, 1, 113, -50, 0, 1, 113, -34, 0, 1, 114, 82, 0, 1, 114, 98, 0, 1, 115, 50, 0, +1, 115, 66, 0, 1, 116, 84, 0, 1, 116, 100, 0, 1, 116, 116, 0, 1, 116, -124, 0, 1, 117, -30, 0, 1, +119, -64, 0, 1, 120, 2, 0, 1, 120, 56, 0, 1, 120, 110, 0, 1, 120, -98, 0, 1, 120, -50, 0, 1, 121, +34, 0, 1, 121, 74, 0, 1, 122, -44, 0, 1, 124, 28, 0, 1, 125, 112, 0, 1, 126, -40, 0, 1, -128, 92, +0, 1, -128, -64, 0, 1, -126, 82, 0, 1, -125, 110, 0, 1, -125, 126, 0, 1, -125, -114, 0, 1, -123, 20, 0, +1, -123, 36, 0, 1, -122, -118, 0, 1, -121, -28, 0, 1, -119, 24, 0, 1, -118, 118, 0, 1, -117, -28, 0, 1, +-115, -86, 0, 1, -115, -22, 0, 1, -114, 34, 0, 1, -114, 88, 0, 1, -114, 126, 0, 1, -114, -82, 0, 1, -114, +-44, 0, 1, -112, 74, 0, 1, -112, 122, 0, 1, -111, -80, 0, 1, -111, -64, 0, 1, -111, -48, 0, 1, -110, 18, +0, 1, -110, 34, 0, 1, -109, -74, 0, 1, -107, 98, 0, 1, -106, -20, 0, 1, -105, 20, 0, 1, -105, 68, 0, +1, -104, -96, 0, 1, -104, -80, 0, 1, -103, -24, 0, 1, -103, -8, 0, 1, -102, -110, 0, 1, -101, -14, 0, 1, +-100, 2, 0, 1, -98, 104, 0, 1, -97, -14, 0, 1, -95, 90, 0, 1, -95, -118, 0, 1, -93, 0, 0, 1, -92, +50, 0, 1, -92, 66, 0, 1, -92, 82, 0, 1, -92, 98, 0, 1, -91, 60, 0, 1, -91, 76, 0, 1, -91, 92, +0, 1, -91, 108, 0, 1, -90, 100, 0, 1, -89, -34, 0, 1, -89, -18, 0, 1, -87, 22, 0, 1, -86, 74, 0, +1, -85, -100, 0, 1, -83, 48, 0, 1, -82, 78, 0, 1, -81, -38, 0, 1, -80, -20, 0, 1, -79, 34, 0, 1, +-77, 88, 0, 1, -77, -8, 0, 1, -76, 8, 0, 1, -75, -98, 0, 1, -73, 64, 0, 1, -73, -60, 0, 1, -71, +70, 0, 1, -71, 86, 0, 1, -69, -66, 0, 1, -67, 62, 0, 1, -66, -66, 0, 1, -66, -18, 0, 1, -64, -114, +0, 1, -62, 20, 0, 1, -61, -40, 0, 1, -59, 4, 0, 1, -59, 20, 0, 1, -58, 68, 0, 1, -58, 84, 0, +1, -58, 100, 0, 1, -57, 36, 0, 1, -57, 52, 0, 1, -55, 26, 0, 1, -55, 42, 0, 1, -54, 96, 0, 1, +-53, 110, 0, 1, -51, 26, 0, 1, -50, -48, 0, 1, -48, 18, 0, 1, -47, -126, 0, 1, -46, -54, 0, 1, -45, +28, 0, 1, -44, -2, 0, 1, -42, 122, 0, 1, -42, -72, 0, 1, -40, 94, 0, 1, -40, -126, 0, 1, -39, -62, +0, 1, -39, -46, 0, 1, -39, -30, 0, 1, -38, 26, 0, 1, -38, 42, 0, 1, -37, -74, 0, 1, -35, 36, 0, +1, -34, -104, 0, 1, -34, -68, 0, 1, -34, -20, 0, 1, -32, 90, 0, 1, -31, 12, 0, 1, -31, -54, 0, 1, +-31, -8, 0, 1, -29, -82, 0, 1, -28, -90, 0, 1, -27, 52, 0, 1, -26, 96, 0, 1, -25, 20, 0, 1, -25, +-18, 0, 1, -24, 56, 0, 1, -24, -74, 0, 1, -23, 124, 0, 1, -23, -92, 0, 1, -23, -18, 0, 1, -22, 68, +0, 1, -21, 48, 0, 1, -21, 122, 0, 1, -21, -82, 0, 1, -21, -42, 0, 1, -21, -2, 0, 1, -20, 50, 0, +1, -20, 118, 0, 1, -20, -70, 0, 1, -20, -8, 0, 1, -18, 54, 0, 1, -18, -18, 0, 1, -16, 14, 0, 1, +-16, -124, 0, 1, -15, 82, 0, 1, -15, -92, 0, 1, -14, 54, 0, 1, -14, -26, 0, 1, -13, -38, 0, 1, -12, +46, 0, 1, -12, -60, 0, 1, -11, -126, 0, 1, -10, 108, 0, 1, -9, 30, 0, 1, -8, 62, 0, 1, -8, -112, +0, 1, -7, 58, 0, 1, -6, 112, 0, 1, -5, 72, 0, 1, -4, 46, 0, 1, -3, 52, 0, 1, -2, 26, 0, +1, -2, -4, 0, 1, -1, -16, 0, 2, 0, -114, 0, 2, 1, -108, 0, 2, 2, -114, 0, 2, 3, 6, 0, 2, +3, 126, 0, 2, 3, -12, 0, 2, 4, 42, 0, 2, 4, -122, 0, 2, 5, 78, 0, 2, 5, -38, 0, 2, 6, +18, 0, 2, 6, 88, 0, 2, 6, -120, 0, 2, 6, -14, 0, 2, 7, -78, 0, 2, 7, -26, 0, 2, 8, 22, +0, 2, 8, 74, 0, 2, 8, 122, 0, 2, 8, -86, 0, 2, 8, -38, 0, 2, 10, 122, 0, 2, 10, -78, 0, +2, 10, -14, 0, 2, 11, 42, 0, 2, 11, 98, 0, 2, 11, -2, 0, 2, 12, -8, 0, 2, 13, 40, 0, 2, +13, -52, 0, 2, 13, -6, 0, 2, 14, 58, 0, 2, 14, -118, 0, 2, 14, -70, 0, 2, 15, 6, 0, 2, 16, +-98, 0, 2, 18, 4, 0, 2, 19, 100, 0, 2, 19, -86, 0, 2, 19, -2, 0, 2, 20, 54, 0, 2, 21, -88, +0, 2, 21, -34, 0, 2, 22, 112, 0, 2, 22, -82, 0, 2, 22, -36, 0, 2, 23, 26, 0, 2, 24, 74, 0, +2, 24, 114, 0, 2, 25, -82, 0, 2, 26, 62, 0, 2, 26, -24, 0, 2, 27, 106, 0, 2, 28, 38, 0, 2, +29, 62, 0, 2, 30, 76, 0, 2, 30, -128, 0, 2, 31, 6, 0, 2, 32, 98, 0, 2, 32, -28, 0, 2, 33, +46, 0, 2, 34, 56, 0, 2, 34, -128, 0, 2, 35, -124, 0, 2, 36, 0, 0, 2, 36, 88, 0, 2, 36, -36, +0, 2, 37, -58, 0, 2, 38, -36, 0, 2, 39, -40, 0, 2, 40, -126, 0, 2, 41, 114, 0, 2, 42, 68, 0, +2, 43, 46, 0, 2, 44, 22, 0, 2, 44, -58, 0, 2, 45, 72, 0, 2, 47, -90, 0, 2, 47, -48, 0, 2, +47, -6, 0, 2, 48, -78, 0, 2, 48, -36, 0, 2, 50, 30, 0, 2, 51, 36, 0, 2, 52, 14, 0, 2, 52, +56, 0, 2, 52, 98, 0, 2, 52, -116, 0, 2, 52, -74, 0, 2, 52, -32, 0, 2, 54, 96, 0, 2, 54, -118, +0, 2, 54, -76, 0, 2, 54, -34, 0, 2, 55, 8, 0, 2, 55, 50, 0, 2, 55, 92, 0, 2, 55, -122, 0, +2, 55, -80, 0, 2, 55, -28, 0, 2, 56, 14, 0, 2, 56, 56, 0, 2, 56, 98, 0, 2, 57, -36, 0, 2, +57, -20, 0, 2, 59, 6, 0, 2, 59, 22, 0, 2, 59, 64, 0, 2, 59, 106, 0, 2, 59, -108, 0, 2, 59, +-66, 0, 2, 61, 104, 0, 2, 63, -124, 0, 2, 64, -78, 0, 2, 64, -62, 0, 2, 66, 62, 0, 2, 66, 78, +0, 2, 67, -108, 0, 2, 69, 96, 0, 2, 70, 102, 0, 2, 71, -26, 0, 2, 73, -122, 0, 2, 75, -86, 0, +2, 77, 4, 0, 2, 78, -26, 0, 2, 80, 42, 0, 2, 81, 88, 0, 2, 81, -126, 0, 2, 81, -84, 0, 2, +81, -42, 0, 2, 82, 0, 0, 2, 82, 42, 0, 2, 82, 84, 0, 2, 82, 126, 0, 2, 82, -88, 0, 2, 82, +-46, 0, 2, 82, -4, 0, 2, 83, 38, 0, 2, 83, 80, 0, 2, 83, 122, 0, 2, 83, -92, 0, 2, 83, -50, +0, 2, 83, -8, 0, 2, 86, 52, 0, 2, 87, -80, 0, 2, 88, -12, 0, 2, 90, -36, 0, 2, 92, 36, 0, +2, 92, 78, 0, 2, 92, 120, 0, 2, 92, -88, 0, 2, 92, -40, 0, 2, 93, 40, 0, 2, 93, 120, 0, 2, +93, -72, 0, 2, 94, 42, 0, 2, 94, 126, 0, 2, 94, -36, 0, 2, 95, 50, 0, 2, 95, 104, 0, 2, 95, +-86, 0, 2, 95, -16, 0, 2, 96, 58, 0, 2, 96, 106, 0, 2, 96, -94, 0, 2, 96, -46, 0, 2, 98, 10, +0, 2, 101, 80, 0, 2, 101, 122, 0, 2, 101, -92, 0, 2, 101, -50, 0, 2, 101, -8, 0, 2, 102, 34, 0, +2, 102, 76, 0, 2, 102, 118, 0, 2, 102, -96, 0, 2, 102, -54, 0, 2, 102, -12, 0, 2, 103, 30, 0, 2, +103, 72, 0, 2, 103, 114, 0, 2, 103, -100, 0, 2, 103, -58, 0, 2, 103, -16, 0, 2, 104, 26, 0, 2, 104, +68, 0, 2, 104, 110, 0, 2, 104, -104, 0, 2, 104, -62, 0, 2, 104, -20, 0, 2, 105, 22, 0, 2, 105, 64, +0, 2, 105, 106, 0, 2, 105, -108, 0, 2, 105, -66, 0, 2, 105, -24, 0, 2, 106, -122, 0, 2, 106, -100, 0, +2, 106, -58, 0, 2, 109, -90, 0, 2, 109, -74, 0, 2, 110, -48, 0, 2, 111, -14, 0, 2, 113, 48, 0, 2, +114, 114, 0, 2, 116, 24, 0, 2, 116, 40, 0, 2, 117, 106, 0, 2, 118, -70, 0, 2, 120, -86, 0, 2, 122, +126, 0, 2, 123, -106, 0, 2, 123, -90, 0, 2, 124, 40, 0, 2, 124, -74, 0, 2, 125, -74, 0, 2, 125, -58, +0, 2, 126, 102, 0, 2, 126, 118, 0, 2, 127, -116, 0, 2, -128, -34, 0, 2, -126, 14, 0, 2, -126, 30, 0, +2, -126, -20, 0, 2, -126, -4, 0, 2, -124, 114, 0, 2, -124, -126, 0, 2, -123, -106, 0, 2, -123, -90, 0, 2, +-122, -38, 0, 2, -120, 112, 0, 2, -119, 44, 0, 2, -119, 60, 0, 2, -118, 58, 0, 2, -117, -108, 0, 2, -116, +32, 0, 2, -116, 48, 0, 2, -115, 90, 0, 2, -114, -26, 0, 2, -113, -94, 0, 2, -113, -78, 0, 2, -112, 78, +0, 2, -112, 94, 0, 2, -111, 44, 0, 2, -111, 60, 0, 2, -110, 20, 0, 2, -110, 36, 0, 2, -109, 44, 0, +2, -109, 60, 0, 2, -107, 2, 0, 2, -107, 18, 0, 2, -106, 106, 0, 2, -106, 122, 0, 2, -104, -28, 0, 2, +-104, -12, 0, 2, -102, -18, 0, 2, -102, -2, 0, 2, -100, 104, 0, 2, -100, 120, 0, 2, -99, 104, 0, 2, -99, +120, 0, 2, -97, 16, 0, 2, -97, 32, 0, 2, -96, 62, 0, 2, -96, 78, 0, 2, -95, -114, 0, 2, -95, -98, +0, 2, -95, -82, 0, 2, -95, -66, 0, 2, -93, 54, 0, 2, -93, 70, 0, 2, -93, 86, 0, 2, -93, 102, 0, +2, -92, -72, 0, 2, -90, 6, 0, 2, -90, -44, 0, 2, -89, -72, 0, 2, -87, 56, 0, 2, -86, -70, 0, 2, +-85, -70, 0, 2, -84, -50, 0, 2, -82, 18, 0, 2, -82, 34, 0, 2, -81, 16, 0, 2, -81, -22, 0, 2, -79, +-122, 0, 2, -79, -106, 0, 2, -78, -76, 0, 2, -77, -70, 0, 2, -75, -72, 0, 2, -75, -56, 0, 2, -75, -40, +0, 2, -75, -24, 0, 2, -73, 50, 0, 2, -73, 66, 0, 2, -73, -6, 0, 2, -72, 10, 0, 2, -71, 24, 0, +2, -71, 40, 0, 2, -70, 20, 0, 2, -70, 36, 0, 2, -69, 66, 0, 2, -69, 82, 0, 2, -69, -16, 0, 2, +-68, 0, 0, 2, -68, 16, 0, 2, -68, -2, 0, 2, -66, 114, 0, 2, -65, -98, 0, 2, -64, -104, 0, 2, -64, +-88, 0, 2, -64, -72, 0, 2, -64, -56, 0, 2, -62, 102, 0, 2, -60, 32, 0, 2, -60, -18, 0, 2, -60, -2, +0, 2, -57, 94, 0, 2, -55, -92, 0, 2, -52, 42, 0, 2, -50, -114, 0, 2, -47, 18, 0, 2, -45, -124, 0, +2, -43, 84, 0, 2, -41, 10, 0, 2, -41, 52, 0, 2, -41, 94, 0, 2, -41, 110, 0, 2, -41, 126, 0, 2, +-41, -88, 0, 2, -41, -46, 0, 2, -41, -4, 0, 2, -40, 12, 0, 2, -40, 28, 0, 2, -40, 70, 0, 2, -40, +112, 0, 2, -40, -128, 0, 2, -40, -112, 0, 2, -40, -70, 0, 2, -40, -28, 0, 2, -39, 14, 0, 2, -39, 30, +0, 2, -39, 46, 0, 2, -39, 62, 0, 2, -39, 78, 0, 2, -39, 94, 0, 2, -39, 110, 0, 2, -39, -104, 0, +2, -39, -88, 0, 2, -39, -72, 0, 2, -39, -30, 0, 2, -38, 12, 0, 2, -38, 54, 0, 2, -38, 96, 0, 2, +-38, -118, 0, 2, -38, -76, 0, 2, -38, -34, 0, 2, -37, 8, 0, 2, -37, 50, 0, 2, -37, 92, 0, 2, -37, +-122, 0, 2, -37, -80, 0, 2, -37, -38, 0, 2, -36, 4, 0, 2, -36, 46, 0, 2, -36, 88, 0, 2, -36, -126, +0, 2, -36, -84, 0, 2, -36, -42, 0, 2, -35, 0, 0, 2, -35, 42, 0, 2, -35, 84, 0, 2, -35, 126, 0, +2, -35, -88, 0, 2, -35, -46, 0, 2, -35, -4, 0, 2, -34, 38, 0, 2, -34, 80, 0, 2, -34, 122, 0, 2, +-34, -92, 0, 2, -34, -50, 0, 2, -34, -8, 0, 2, -33, 34, 0, 2, -33, 76, 0, 2, -33, 118, 0, 2, -33, +-96, 0, 2, -33, -54, 0, 2, -33, -12, 0, 2, -32, 30, 0, 2, -32, 72, 0, 2, -32, 114, 0, 2, -32, -100, +0, 2, -32, -58, 0, 2, -32, -16, 0, 2, -31, 26, 0, 2, -31, 68, 0, 2, -31, 110, 0, 2, -31, -104, 0, +2, -31, -62, 0, 2, -31, -20, 0, 2, -30, 22, 0, 2, -30, 64, 0, 2, -30, 106, 0, 2, -30, -108, 0, 2, +-29, 52, 0, 2, -29, 120, 0, 2, -29, -18, 0, 2, -28, 24, 0, 2, -28, 66, 0, 2, -28, 108, 0, 2, -28, +-106, 0, 2, -28, -64, 0, 2, -28, -22, 0, 2, -27, 20, 0, 2, -27, 62, 0, 2, -27, 104, 0, 2, -27, -110, +0, 2, -27, -68, 0, 2, -27, -26, 0, 2, -26, 16, 0, 2, -26, 58, 0, 2, -26, 100, 0, 2, -26, -114, 0, +2, -26, -72, 0, 2, -26, -30, 0, 2, -25, 12, 0, 2, -25, 54, 0, 2, -25, 96, 0, 2, -25, -118, 0, 2, +-25, -76, 0, 2, -25, -34, 0, 2, -24, 18, 0, 2, -24, 70, 0, 2, -24, 122, 0, 2, -22, 12, 0, 2, -21, +-88, 0, 2, -19, 68, 0, 2, -18, -48, 0, 2, -17, 22, 0, 2, -17, 92, 0, 2, -17, -54, 0, 2, -16, 38, +0, 2, -16, 120, 0, 2, -16, -24, 0, 2, -15, -64, 0, 2, -14, -116, 0, 2, -13, 100, 0, 2, -12, 48, 0, +2, -12, -48, 0, 2, -11, -22, 0, 2, -10, -98, 0, 2, -9, 32, 0, 2, -9, 122, 0, 2, -9, -70, 0, 2, +-8, -40, 0, 2, -6, 34, 0, 2, -5, -70, 0, 2, -4, 22, 0, 2, -4, 116, 0, 2, -4, -48, 0, 2, -3, +44, 0, 2, -3, -32, 0, 2, -2, -106, 0, 2, -1, 66, 0, 2, -1, -18, 0, 3, 0, -102, 0, 3, 1, 82, +0, 3, 2, 10, 0, 3, 2, -62, 0, 3, 2, -44, 0, 3, 2, -26, 0, 3, 2, -8, 0, 3, 3, 10, 0, +3, 3, 28, 0, 3, 3, -118, 0, 3, 3, -8, 0, 3, 4, -80, 0, 3, 4, -62, 0, 3, 4, -44, 0, 3, +4, -26, 0, 3, 4, -10, 0, 3, 5, 8, 0, 3, 5, 26, 0, 3, 5, 44, 0, 3, 5, 62, 0, 3, 5, +80, 0, 3, 5, 98, 0, 3, 6, 16, 0, 3, 6, -68, 0, 3, 7, 106, 0, 3, 8, 22, 0, 3, 8, -82, +0, 3, 8, -24, 0, 3, 9, 18, 0, 3, 9, 60, 0, 3, 9, -112, 0, 3, 9, -30, 0, 3, 10, 94, 0, +3, 10, -88, 0, 3, 11, 36, 0, 3, 11, 120, 0, 3, 11, -4, 0, 3, 12, 78, 0, 3, 12, -60, 0, 3, +13, 28, 0, 3, 13, -126, 0, 3, 13, -40, 0, 3, 14, 50, 0, 3, 14, -80, 0, 3, 14, -4, 0, 3, 15, +90, 0, 3, 15, -66, 0, 3, 16, 12, 0, 3, 16, 90, 0, 3, 16, -78, 0, 3, 16, -6, 0, 3, 17, 36, +0, 3, 17, 82, 0, 3, 17, 120, 0, 3, 17, -84, 0, 3, 17, -36, 0, 3, 18, 12, 0, 3, 18, 94, 0, +3, 18, -52, 0, 3, 19, 34, 0, 3, 19, -106, 0, 3, 19, -22, 0, 3, 20, 94, 0, 3, 20, -92, 0, 3, +21, 12, 0, 3, 21, 82, 0, 3, 21, -82, 0, 3, 21, -34, 0, 3, 22, 24, 0, 3, 22, 62, 0, 3, 22, +110, 0, 3, 22, -108, 0, 3, 22, -70, 0, 3, 22, -20, 0, 3, 23, 28, 0, 3, 23, 110, 0, 3, 23, -44, +0, 3, 24, 42, 0, 3, 24, -112, 0, 3, 24, -28, 0, 3, 25, 82, 0, 3, 25, -108, 0, 3, 25, -12, 0, +3, 26, 54, 0, 3, 26, -126, 0, 3, 26, -68, 0, 3, 26, -8, 0, 3, 27, 50, 0, 3, 27, 110, 0, 3, +27, -94, 0, 3, 27, -44, 0, 3, 28, 4, 0, 3, 28, 52, 0, 3, 28, 94, 0, 3, 28, -124, 0, 3, 28, +-82, 0, 3, 28, -36, 0, 3, 29, 6, 0, 3, 29, 82, 0, 3, 29, -106, 0, 3, 29, -52, 0, 3, 30, 8, +0, 3, 30, 60, 0, 3, 30, 106, 0, 3, 30, -88, 0, 3, 30, -40, 0, 3, 31, 18, 0, 3, 31, 60, 0, +3, 31, 106, 0, 3, 31, -112, 0, 3, 31, -74, 0, 3, 31, -30, 0, 3, 32, 62, 0, 3, 32, 110, 0, 3, +32, -98, 0, 3, 32, -50, 0, 3, 33, 6, 0, 3, 33, 58, 0, 3, 33, 104, 0, 3, 33, -104, 0, 3, 33, +-56, 0, 3, 33, -8, 0, 3, 34, 40, 0, 3, 34, 92, 0, 3, 34, -78, 0, 3, 34, -26, 0, 3, 35, 70, +0, 3, 35, 122, 0, 3, 35, -46, 0, 3, 36, 6, 0, 3, 36, 98, 0, 3, 37, 0, 0, 3, 37, -50, 0, +3, 38, -18, 0, 3, 39, -74, 0, 3, 40, 70, 0, 3, 40, -36, 0, 3, 42, -56, 0, 3, 44, -60, 0, 3, +46, 60, 0, 3, 47, -72, 0, 3, 49, 98, 0, 3, 51, 20, 0, 3, 51, -4, 0, 3, 53, 50, 0, 3, 54, +42, 0, 3, 55, 60, 0, 3, 56, 90, 0, 3, 57, -112, 0, 3, 58, -6, 0, 3, 60, 104, 0, 3, 61, -2, +0, 3, 63, 122, 0, 3, 64, -118, 0, 3, 64, -102, 0, 3, 65, -58, 0, 3, 67, 2, 0, 3, 68, 68, 0, +3, 69, -56, 0, 3, 70, -94, 0, 3, 71, 24, 0, 3, 71, -50, 0, 3, 72, 116, 0, 3, 73, -28, 0, 3, +74, 28, 0, 3, 74, -106, 0, 3, 75, 88, 0, 3, 76, 18, 0, 3, 76, 122, 0, 3, 77, -128, 0, 3, 78, +-74, 0, 3, 79, -124, 0, 3, 80, -30, 0, 3, 81, 92, 0, 3, 81, -42, 0, 3, 82, -98, 0, 3, 83, 88, +0, 3, 84, 12, 0, 3, 84, 104, 0, 3, 84, -62, 0, 3, 85, 10, 0, 3, 85, 122, 0, 3, 85, -10, 0, +3, 86, 64, 0, 3, 86, 122, 0, 3, 86, -64, 0, 3, 87, 4, 0, 3, 87, 86, 0, 3, 87, -88, 0, 3, +88, 42, 0, 3, 88, -84, 0, 3, 88, -18, 0, 3, 89, 46, 0, 3, 89, 100, 0, 3, 89, -102, 0, 3, 89, +-56, 0, 3, 89, -10, 0, 3, 90, 42, 0, 3, 90, 94, 0, 3, 90, -96, 0, 3, 90, -30, 0, 3, 91, 30, +0, 3, 91, 90, 0, 3, 91, -108, 0, 3, 91, -50, 0, 3, 92, 0, 0, 3, 92, 50, 0, 3, 92, 100, 0, +3, 92, -106, 0, 3, 92, -48, 0, 3, 93, 10, 0, 3, 93, 76, 0, 3, 93, -114, 0, 3, 93, -48, 0, 3, +94, 18, 0, 3, 94, 96, 0, 3, 94, -82, 0, 3, 94, -16, 0, 3, 95, 50, 0, 3, 95, 114, 0, 3, 95, +-78, 0, 3, 95, -20, 0, 3, 96, 38, 0, 3, 96, 114, 0, 3, 96, -66, 0, 3, 96, -4, 0, 3, 97, 60, +0, 3, 97, -126, 0, 3, 97, -56, 0, 3, 98, 4, 0, 3, 98, 90, 0, 3, 98, -106, 0, 3, 98, -46, 0, +3, 99, 18, 0, 3, 99, 82, 0, 3, 99, -114, 0, 3, 99, -54, 0, 3, 100, 10, 0, 3, 100, 74, 0, 3, +100, -114, 0, 3, 100, -46, 0, 3, 101, 38, 0, 3, 101, -76, 0, 3, 101, -10, 0, 3, 102, 56, 0, 3, 102, +-96, 0, 3, 103, 8, 0, 3, 103, 58, 0, 3, 103, 108, 0, 3, 103, -92, 0, 3, 103, -36, 0, 3, 104, 114, +0, 3, 105, 8, 0, 3, 105, 82, 0, 3, 105, -100, 0, 3, 105, -40, 0, 3, 106, 20, 0, 3, 106, 106, 0, +3, 106, -64, 0, 3, 107, 10, 0, 3, 107, 84, 0, 3, 107, -84, 0, 3, 108, 4, 0, 3, 108, 68, 0, 3, +108, -124, 0, 3, 108, -68, 0, 3, 108, -12, 0, 3, 109, 62, 0, 3, 109, -120, 0, 3, 109, -58, 0, 3, 110, +4, 0, 3, 110, 70, 0, 3, 110, -120, 0, 3, 110, -36, 0, 3, 111, 48, 0, 3, 111, 118, 0, 3, 111, -68, +0, 3, 112, 2, 0, 3, 112, 72, 0, 3, 112, -98, 0, 3, 112, -12, 0, 3, 113, 74, 0, 3, 113, -96, 0, +3, 113, -20, 0, 3, 114, 56, 0, 3, 114, -124, 0, 3, 114, -48, 0, 3, 115, 68, 0, 3, 115, -72, 0, 3, +116, 44, 0, 3, 116, -96, 0, 3, 116, -34, 0, 3, 117, 28, 0, 3, 117, 90, 0, 3, 117, -104, 0, 3, 117, +-42, 0, 3, 118, 20, 0, 3, 118, 88, 0, 3, 118, -100, 0, 3, 118, -24, 0, 3, 119, 52, 0, 3, 119, -108, +0, 3, 119, -32, 0, 3, 120, 30, 0, 3, 120, 108, 0, 3, 121, 124, 0, 3, 121, -52, 0, 3, 122, 28, 0, +3, 122, 84, 0, 3, 122, -116, 0, 3, 122, -30, 0, 3, 123, 56, 0, 3, 123, -84, 0, 3, 124, 16, 0, 3, +124, 82, 0, 3, 124, -108, 0, 3, 124, -22, 0, 3, 125, 56, 0, 3, 125, -124, 0, 3, 125, -48, 0, 3, 126, +16, 0, 3, 126, 80, 0, 3, 126, -104, 0, 3, 126, -32, 0, 3, 127, 76, 0, 3, 127, -90, 0, 3, 127, -34, +0, 3, -128, 22, 0, 3, -128, 86, 0, 3, -128, -106, 0, 3, -127, -80, 0, 3, -126, -10, 0, 3, -125, -26, 0, +3, -124, -10, 0, 3, -123, 76, 0, 3, -123, -94, 0, 3, -123, -12, 0, 3, -122, 72, 0, 3, -122, -84, 0, 3, +-121, 16, 0, 3, -121, 102, 0, 3, -121, -68, 0, 3, -120, 50, 0, 3, -120, -88, 0, 3, -120, -22, 0, 3, -119, +44, 0, 3, -119, 110, 0, 3, -119, -80, 0, 3, -119, -14, 0, 3, -118, 52, 0, 3, -118, -118, 0, 3, -118, -32, +0, 3, -117, 50, 0, 3, -117, -122, 0, 3, -116, 14, 0, 3, -116, -112, 0, 3, -115, 48, 0, 3, -115, -46, 0, +3, -114, 16, 0, 3, -114, 78, 0, 3, -114, -116, 0, 3, -114, -56, 0, 3, -113, 6, 0, 3, -113, 68, 0, 3, +-113, -126, 0, 3, -113, -66, 0, 3, -112, -94, 0, 3, -111, -114, 0, 3, -110, -92, 0, 3, -109, -64, 0, 3, -108, +-118, 0, 3, -107, 84, 0, 3, -106, 78, 0, 3, -105, 72, 0, 3, -104, 70, 0, 3, -103, 68, 0, 3, -102, 98, +0, 3, -101, -128, 0, 3, -100, -90, 0, 3, -99, -52, 0, 3, -98, -50, 0, 3, -97, -48, 0, 3, -96, 98, 0, +3, -96, -12, 0, 3, -95, 50, 0, 3, -95, 112, 0, 3, -95, -54, 0, 3, -94, 36, 0, 3, -94, 92, 0, 3, +-94, -108, 0, 3, -93, -92, 0, 3, -93, -76, 0, 3, -93, -4, 0, 3, -92, 68, 0, 3, -92, -100, 0, 3, -92, +-12, 0, 3, -91, 38, 0, 3, -91, 88, 0, 3, -91, -102, 0, 3, -91, -36, 0, 3, -90, 22, 0, 3, -90, 80, +0, 3, -90, -108, 0, 3, -90, -40, 0, 3, -89, 80, 0, 3, -89, -54, 0, 3, -88, 90, 0, 3, -88, -98, 0, +3, -88, -34, 0, 3, -87, 96, 0, 3, -87, -30, 0, 3, -85, 58, 0, 3, -85, 74, 0, 3, -85, -104, 0, 3, +-85, -26, 0, 3, -84, 34, 0, 3, -84, 94, 0, 3, -84, -92, 0, 3, -84, -22, 0, 3, -83, 56, 0, 3, -83, +-122, 0, 3, -83, -42, 0, 3, -82, 38, 0, 3, -82, -126, 0, 3, -82, -34, 0, 3, -80, 84, 0, 3, -79, -68, +0, 3, -79, -12, 0, 3, -78, 46, 0, 3, -78, 122, 0, 3, -78, -58, 0, 3, -77, 24, 0, 3, -77, 106, 0, +3, -77, -68, 0, 3, -76, 18, 0, 3, -76, 78, 0, 3, -76, -118, 0, 3, -76, -32, 0, 3, -75, 52, 0, 3, +-74, 108, 0, 3, -73, 12, 0, 3, -73, 90, 0, 3, -73, -102, 0, 3, -73, -44, 0, 3, -71, 106, 0, 3, -69, +-46, 0, 3, -68, -106, 0, 3, -66, 44, 0, 3, -65, -118, 0, 3, -64, 88, 0, 3, -63, -2, 0, 3, -60, 82, +0, 3, -58, -118, 0, 3, -58, -48, 0, 3, -57, 2, 0, 3, -57, -84, 0, 3, -56, -48, 0, 3, -56, -12, 0, +3, -55, -114, 0, 3, -54, -102, 0, 3, -53, -86, 0, 3, -52, -70, 0, 3, -51, -56, 0, 3, -49, 78, 0, 3, +-49, -128, 0, 3, -48, 34, 0, 3, -48, 74, 0, 3, -48, -84, 0, 3, -47, 14, 0, 3, -47, 112, 0, 3, -47, +-46, 0, 3, -46, 16, 0, 3, -46, 78, 0, 3, -46, -120, 0, 3, -46, -62, 0, 3, -46, -18, 0, 3, -45, 58, +0, 3, -45, 116, 0, 3, -45, -82, 0, 3, -43, 10, 0, 3, -42, 94, 0, 3, -42, 110, 0, 3, -41, 44, 0, +3, -40, 98, 0, 3, -40, -64, 0, 3, -39, -40, 0, 3, -37, 102, 0, 3, -36, 12, 0, 3, -35, 82, 0, 3, +-35, -112, 0, 3, -35, -50, 0, 3, -34, 12, 0, 3, -34, 96, 0, 3, -34, -120, 0, 3, -34, -30, 0, 3, -33, +70, 0, 3, -33, -114, 0, 3, -33, -16, 0, 3, -32, 80, 0, 3, -32, -62, 0, 3, -31, 62, 0, 3, -31, -70, +0, 3, -30, 60, 0, 3, -30, -56, 0, 3, -29, 84, 0, 3, -29, -34, 0, 3, -28, 94, 0, 3, -28, -104, 0, +3, -28, -44, 0, 3, -26, 56, 0, 3, -25, 2, 0, 3, -25, 50, 0, 3, -25, 98, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 0, -80, 0, 0, 1, -113, 5, -70, 0, 5, 0, 9, +0, 125, -79, 6, 2, 67, 84, 88, -78, 2, 0, 5, -72, 2, -81, 64, 11, 8, 60, 6, 10, 9, 58, 4, 60, +6, 58, 1, 1, 47, -28, -3, -28, 0, 63, -3, -26, 63, 27, -79, 28, 5, -72, 2, -81, 64, 38, 8, 60, 6, +2, 0, 6, 10, 11, -53, 3, 9, 58, 5, 56, 4, 60, 0, 56, 6, 58, 1, 3, 60, 2, 2, 32, 1, 1, +1, -53, 10, 10, 11, -127, 33, -95, -104, 24, 43, 43, 78, 16, -12, 93, 60, 77, 16, -19, 16, -28, -28, -3, -28, +-28, 16, -18, 0, 63, 63, 77, 16, -3, -26, 75, 83, 88, -77, 5, 4, 0, 1, 1, 16, 60, 16, 60, 89, 89, +49, 48, 19, 3, 17, 51, 17, 3, 3, 53, 51, 21, -25, 55, -33, 52, -93, -49, 1, 108, 3, 9, 1, 69, -2, +-69, -4, -9, -2, -108, -51, -51, 0, 0, 2, 0, 94, 3, -77, 2, 119, 5, -70, 0, 5, 0, 11, 0, 117, -71, +0, 0, -1, -8, -77, 34, 37, 52, 5, -72, -1, -8, 64, 34, 38, 41, 52, 11, 6, 10, 7, 5, 0, 4, 1, +0, 5, 5, 6, 11, -18, 9, 8, 8, 3, 3, 2, 0, 7, 8, 60, 10, 15, 9, -128, 9, 2, 9, -72, -1, +-64, 64, 21, 13, 15, 52, 9, -34, 1, 3, 4, 60, 2, 1, 64, 13, 17, 52, 1, 25, 12, 113, -89, 24, 43, +78, 16, -12, 43, 60, 77, -3, 60, 16, -3, 43, 93, 60, -3, 60, 0, 63, 60, 16, 60, 16, 60, -3, 60, 60, +16, 60, 1, 17, 18, 57, 57, 17, 18, 57, 57, 49, 48, 1, 43, 43, 19, 3, 53, 51, 21, 3, 51, 3, 53, +51, 21, 3, -112, 50, -51, 45, -35, 49, -51, 48, 3, -77, 1, 23, -16, -16, -2, -23, 1, 23, -16, -16, -2, -23, +0, 0, 2, 0, 21, -1, -25, 4, 89, 5, -45, 0, 27, 0, 31, 1, 49, 64, -121, 40, 29, 56, 29, 2, 9, +4, 9, 29, 2, 87, 15, -73, 19, -73, 28, -57, 19, -57, 28, -8, 29, 6, 1, 2, 21, 0, 9, 4, 3, 20, +0, 9, 5, 6, 17, 0, 9, 8, 7, 16, 0, 9, 11, 7, 16, 27, 10, 12, 7, 16, 24, 13, 15, 7, 16, +23, 14, 18, 6, 17, 23, 14, 19, 3, 20, 23, 14, 22, 2, 21, 23, 14, 25, 2, 21, 24, 13, 26, 2, 21, +27, 10, 28, 3, 20, 27, 10, 29, 3, 20, 24, 13, 30, 6, 17, 24, 13, 31, 6, 17, 27, 10, 10, 27, 27, +37, 0, 9, 20, 0, 0, 9, 13, 24, 24, 37, 23, 14, 20, 23, 23, 14, 21, 2, 37, 20, 3, 3, 0, 16, +7, 37, 17, 6, -72, 1, -74, 64, 56, 14, 14, 13, 13, 10, 10, 9, 0, 27, 24, 24, 23, 23, 0, 10, 21, +20, 20, 17, 16, 62, 14, 7, 6, 6, 3, 2, 62, 0, 24, -108, 13, 23, -108, 13, 37, 14, 64, 17, 57, 79, +14, -97, 14, 2, 14, 117, 33, 10, -108, 27, 9, -108, 27, 37, 0, -72, -1, -64, -75, 17, 57, 32, 0, 1, 0, +-72, 2, -95, -77, 32, -87, 104, 24, 43, 16, -10, 93, 43, -19, -28, 16, -28, 16, -10, 93, 43, -19, -28, 16, -28, +16, -12, 60, 60, 16, 60, 16, -12, 60, 60, 16, 60, 0, 63, 60, 16, 60, 16, 60, 63, 60, 16, 60, 16, 60, +16, -3, 60, -3, 60, 17, 57, 47, 60, -3, 60, -121, 5, 46, 43, 125, 16, -60, -121, 46, 24, 43, 125, 16, -60, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 49, 48, 1, 93, 93, 113, 23, 19, 35, +53, 51, 19, 33, 53, 33, 19, 51, 3, 33, 19, 51, 3, 51, 21, 35, 3, 33, 21, 33, 3, 35, 19, 33, 3, +19, 33, 19, 33, 103, 87, -87, -57, 74, -2, -17, 1, 47, 87, -106, 87, 1, 59, 87, -105, 87, -83, -53, 75, 1, +22, -2, -52, 87, -106, 86, -2, -58, 87, 117, 1, 58, 75, -2, -59, 25, 1, -86, -107, 1, 107, -107, 1, -83, -2, +83, 1, -83, -2, 83, -107, -2, -107, -107, -2, 86, 1, -86, -2, 86, 2, 63, 1, 107, 0, 3, 0, 73, -1, 45, +4, 19, 6, 65, 0, 42, 0, 49, 0, 56, 1, -44, 64, 37, 124, 30, 1, 4, 48, 44, 54, 54, 47, 70, 33, +85, 33, 80, 47, 93, 54, 106, 3, 99, 47, 122, 3, 119, 33, 115, 47, 123, 54, -121, 33, -128, 47, -114, 54, 16, +49, -72, -1, -34, -73, 11, 57, 30, 32, 32, 36, 52, 44, -72, -1, -32, 64, 44, 32, 35, 52, 106, 8, 56, 42, +22, 12, 55, 32, 22, 42, 48, 33, 11, 0, 21, 12, 55, 49, 48, 33, 0, 21, 55, 33, 48, 48, -54, 12, 55, +20, 12, 12, 55, 48, 12, 33, 55, 4, 23, 50, 6, -72, 2, -92, -74, 80, 5, 1, 5, -19, 1, 28, -70, 2, +-92, 0, 27, 2, -83, -77, 23, 31, -45, 43, -72, 1, 53, 64, 10, 20, 21, 22, -128, 23, 23, 20, 5, 0, 42, +-72, 1, 55, -78, 1, 10, 50, -72, 1, 53, -76, 41, -45, 1, 13, 28, -70, 1, 56, 0, 27, 2, -104, -78, 53, +115, 38, -72, -1, -64, 64, 10, 18, 57, 48, 38, 64, 38, -128, 38, 3, 38, -72, 2, 82, 64, 15, 42, 22, 23, +23, 31, 31, 32, 32, 56, 56, 50, 50, 41, 41, 42, -72, 1, -109, 64, 22, 0, 21, 20, 20, 43, 43, 49, 49, +11, 11, 10, 10, 48, 0, 64, 0, -128, 0, -48, 0, 4, 0, -72, 2, 12, 64, 9, 5, 46, 115, 111, 16, 127, +16, 2, 16, -70, 1, -114, 0, 6, 1, 56, 64, 15, 63, 5, 79, 5, 127, 5, -113, 5, 4, 5, 25, 57, -57, +-117, 24, 43, 78, 16, -12, 93, 77, -19, -12, 113, -19, 16, -12, 93, 60, 16, 60, 16, 60, 16, 60, 16, 60, 16, +60, 16, -3, 60, 16, 60, 16, 60, 16, 60, 16, 60, 16, 60, 16, 60, 16, -12, 93, 43, -19, -12, -19, 0, 63, +-12, -3, 60, 16, -12, 60, 63, 60, 16, -12, 60, 16, -3, -28, 16, -3, -28, 16, -3, 93, -28, 17, 18, 23, 57, +-121, 14, 46, 43, -121, 14, 125, -60, 15, 15, 15, 15, 49, 48, 24, 67, 121, 64, 74, 33, 55, 12, 19, 36, 37, +35, 37, 34, 37, 3, 6, 18, 38, 14, 15, 13, 15, 2, 6, 55, 33, 53, 79, 1, 51, 40, 53, 79, 1, 44, +19, 46, 79, 0, 48, 12, 46, 79, 0, 54, 37, 56, 79, 1, 33, 32, 55, 56, 52, 39, 50, 79, 0, 51, 50, +45, 17, 43, 79, 1, 44, 43, 19, 20, 47, 15, 49, 79, 0, 48, 49, 12, 11, 0, 16, 60, 16, 60, 43, 16, +60, 16, 60, 43, 16, 60, 43, 16, 60, 16, 60, 43, 1, 43, 43, 43, 43, 42, 43, 42, -127, -127, 1, 43, 43, +0, 43, 93, 1, 93, 5, 53, 46, 2, 39, 55, 22, 23, 22, 23, 17, 38, 39, 38, 38, 53, 52, 55, 54, 55, +53, 51, 21, 22, 23, 22, 23, 7, 38, 38, 39, 17, 22, 23, 30, 2, 21, 20, 6, 7, 21, 3, 6, 6, 21, +20, 22, 23, 19, 54, 54, 53, 52, 38, 39, 1, -2, -121, -87, 123, 10, -75, 21, 53, 76, 106, 111, 116, 86, 93, +-120, 91, -77, 106, -99, 92, 118, 24, -70, 16, 101, 88, -120, 44, 84, 106, 57, -18, -67, 106, 105, 121, 103, 123, 106, +105, -119, 97, -111, -45, -76, 17, 87, -62, -116, 34, -111, 68, 96, 11, 2, 61, 21, 65, 48, -86, 108, -64, 119, 80, +18, 86, 86, 15, 77, 98, -85, 28, 106, 113, 18, -3, -7, 34, 19, 37, 106, -110, 85, -69, -6, 9, -74, 6, 40, +16, -120, 93, 92, 124, 37, -3, 22, 13, -100, 115, 98, 119, 47, 0, 0, 5, 0, 119, -1, -54, 6, -97, 5, -45, +0, 11, 0, 23, 0, 27, 0, 39, 0, 51, 1, 7, 64, 10, -112, 25, -112, 26, 2, 104, 8, 26, 27, 27, -72, +2, -102, 64, 15, 24, 25, 20, 24, 24, 25, 24, 27, 21, 15, 25, 26, 49, 43, 18, -68, 2, -97, 0, 9, 1, +101, 0, 12, 2, -97, 64, 11, 3, 26, 25, 25, 3, 1, 27, 24, 24, 37, 40, -68, 2, -97, 0, 31, 1, 101, +0, 46, 2, -97, -78, 37, 11, 28, -68, 2, -102, 0, 43, 1, 0, 0, 49, 2, -102, -77, 34, -84, 53, 6, -68, +2, -102, 0, 21, 1, 0, 0, 15, 2, -102, 64, 9, 32, 0, 1, 0, 117, 52, 87, 90, 24, 43, 16, -10, 93, +-19, -12, -19, 16, -10, -19, -12, -19, 0, 63, -19, -3, -19, 16, 60, 16, 60, 63, 60, 16, 60, 16, -19, -3, -19, +1, 17, 18, 57, 57, 17, 18, 57, 57, -121, 46, 43, 125, 16, -60, 49, 48, 24, 67, 121, 64, 82, 1, 51, 41, +30, 43, 31, 0, 51, 32, 49, 31, 1, 45, 38, 43, 31, 0, 47, 36, 49, 31, 1, 13, 2, 15, 31, 0, 23, +4, 21, 31, 1, 17, 10, 15, 31, 0, 19, 8, 21, 31, 1, 42, 29, 40, 31, 1, 50, 33, 40, 31, 1, 44, +39, 46, 31, 0, 48, 35, 46, 31, 0, 14, 1, 12, 31, 1, 22, 5, 12, 31, 1, 16, 11, 18, 31, 0, 20, +7, 18, 31, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, 43, 43, 43, -127, 1, 93, +19, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 1, 34, 6, 21, 20, 22, 51, 50, 54, 53, 52, 38, 3, +1, 51, 1, 1, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 1, 34, 6, 21, 20, 22, 51, 50, 54, 53, +52, 38, 119, -98, -106, -118, -75, -73, -122, -123, -79, 1, 57, 67, 89, 90, 66, 68, 89, 90, 66, 3, 34, -110, -4, +-31, 1, -27, -98, -105, -118, -75, -73, -121, -123, -79, 1, 58, 68, 89, 90, 66, 69, 89, 90, 4, 90, -99, -36, -59, +-65, -70, -55, -58, 1, -59, 116, -101, -115, 115, 116, -102, -114, 115, -6, 115, 6, 9, -7, -9, 1, -114, -98, -37, -59, +-65, -70, -55, -57, 1, -60, 116, -101, -116, 116, 116, -102, -114, 115, 0, 3, 0, 88, -1, -34, 5, 39, 5, -45, 0, +31, 0, 44, 0, 54, 1, 61, 64, -56, 122, 21, 114, 22, 114, 23, 122, 46, 122, 47, -122, 22, -90, 47, -35, 0, +8, -106, 29, -93, 22, 2, -119, 47, -125, 54, 2, -125, 28, -124, 33, 2, -76, 22, 1, 96, 23, 97, 33, 2, 22, +21, 64, 22, 106, 0, 3, -86, 30, -38, 22, 2, 115, 28, 115, 29, 2, 117, 26, 114, 27, 2, 117, 0, 123, 22, +2, -118, 23, -125, 27, 2, -87, 21, -82, 22, 2, -125, 30, -118, 32, 2, -118, 10, -125, 28, 2, -53, 32, -58, 39, +2, -51, 22, -62, 27, 2, -70, 26, -58, 20, 2, 105, 54, -70, 22, 2, 105, 23, 101, 51, 2, 101, 47, 1, 86, +51, 92, 54, 2, 70, 51, 90, 31, 2, 77, 22, 66, 27, 2, 48, 26, 57, 31, 2, 38, 27, 36, 32, 2, 0, +45, 45, 30, 45, 46, 10, 10, 0, 27, 22, 22, 29, 21, 32, 22, 22, 32, 32, -70, 10, 45, 20, 10, 10, 45, +38, 41, 16, 1, 52, 41, 30, 58, 3, 11, 27, -122, 29, 35, 94, 96, 19, 112, 19, -96, 19, 3, 47, 19, 64, +19, 2, 19, -36, 29, -113, 24, 1, 24, -72, 2, 90, 64, 28, 25, 62, 30, 114, 32, 29, 1, 29, 56, 56, 41, +94, -96, 13, 1, 13, -96, 49, 94, 32, 7, 1, 7, 106, 55, 113, -104, 24, 43, 16, -10, 93, -19, -12, 93, -19, +16, -12, 93, -28, -12, -19, 93, 16, -12, 93, 93, -19, 16, -28, 0, 63, -28, -19, 63, -19, -121, 14, 46, 43, 14, +125, 16, -60, 7, 14, 60, -121, 14, 16, -60, 7, 14, 16, 60, 60, -121, 14, 16, -60, 49, 48, 1, 93, 93, 93, +93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0, 93, 93, 93, 93, 93, 93, 93, 37, +6, 6, 35, 34, 39, 38, 53, 52, 54, 55, 38, 38, 53, 52, 54, 51, 50, 22, 21, 20, 5, 1, 54, 55, 23, +6, 7, 22, 23, 7, 38, 1, 54, 54, 53, 52, 38, 35, 34, 6, 21, 20, 22, 23, 1, 1, 6, 6, 21, 20, +22, 51, 50, 54, 3, -51, 89, -46, 122, -31, -124, 107, -81, -82, 99, 66, -49, -99, -106, -65, -2, -21, 1, 7, 45, +25, -69, 48, 82, 101, -128, 121, 109, -2, 30, 117, 69, 95, 71, 73, 97, 35, 35, 1, 77, -2, -74, -110, 102, -114, +-126, 81, -83, -83, 99, 99, -104, 124, -103, -120, -37, 83, 114, -114, 66, -124, -61, -72, -127, -47, -108, -2, -79, 88, 116, +40, -64, 124, -122, 91, -113, 70, 3, -123, 69, 104, 63, 75, 95, 94, 68, 34, 75, 42, -3, 53, 1, -103, 87, -107, +73, 89, -64, 101, 0, 1, 0, 90, 3, -77, 1, 39, 5, -70, 0, 5, 0, 38, 64, 21, 0, 5, 3, 1, 5, +-18, 2, 0, 3, -127, 32, 1, -112, 1, 2, 1, 106, 6, 113, -89, 24, 43, 16, -10, 93, -19, 0, 63, -19, 1, +17, 18, 57, 57, 49, 48, 19, 3, 53, 51, 21, 3, -120, 46, -51, 48, 3, -77, 1, 18, -11, -11, -2, -18, 0, +1, 0, 124, -2, 81, 2, 96, 5, -45, 0, 16, 0, 61, 64, 10, 39, 15, 1, 0, 16, 18, 7, 8, 16, 16, +-72, 1, 51, -77, 0, -97, 14, 8, -72, 1, 51, 64, 17, 7, -97, 14, 94, 0, 3, 16, 3, 32, 3, 3, 3, +-84, 17, -99, -116, 24, 43, 16, -10, 93, -3, -10, -19, 16, -10, -19, 0, 63, 60, 63, 60, 49, 48, 1, 93, 1, +38, 2, 17, 52, 55, 54, 55, 51, 6, 7, 6, 7, 6, 21, 16, 1, 1, -33, -107, -50, 77, 90, -68, -127, 121, +39, 61, 35, 43, 1, 43, -2, 81, -68, 1, -8, 1, 14, -18, -38, -3, -5, -48, 89, -118, -106, -69, -67, -2, 31, +-2, 32, 0, 1, 0, 124, -2, 81, 2, 96, 5, -45, 0, 16, 0, 101, 64, 12, 40, 2, 40, 16, 2, 9, 10, +16, 1, 0, 18, 9, -72, 1, 51, -77, 10, -97, 3, 1, -72, 1, 51, -76, 0, -97, 3, 94, 14, -72, -1, -16, +-76, 16, 16, 2, 85, 14, -72, -1, -8, -76, 15, 15, 2, 85, 14, -72, -1, -28, -76, 13, 13, 2, 85, 14, -72, +-1, -20, 64, 15, 10, 10, 2, 85, 15, 14, 31, 14, 2, 14, -84, 18, -99, -116, 24, 43, 16, -10, 93, 43, 43, +43, 43, -3, -10, -19, 16, -10, -19, 0, 63, 60, 63, 60, 49, 48, 1, 93, 19, 35, 0, 17, 52, 39, 38, 39, +38, 39, 51, 22, 23, 22, 21, 16, 2, -3, -127, 1, 43, 43, 34, 61, 39, 122, -127, -68, 90, 77, -49, -2, 81, +1, -32, 1, -31, -68, -71, -106, -118, 90, -46, -5, -3, -38, -18, -2, -14, -2, 8, 0, 1, 0, 64, 3, 99, 2, +-43, 5, -45, 0, 24, 0, -122, 64, 74, 11, 1, 11, 10, 27, 1, 27, 10, 4, 10, 9, 12, 14, 15, 16, 17, +7, 6, 11, 1, 2, 24, 22, 21, 20, 19, 7, 0, 4, 3, 8, 23, 18, 13, 7, 7, 6, 5, 24, 23, 22, +21, 19, 18, 17, 16, 15, 13, 12, 11, 20, 4, 7, 3, 8, 1, 10, 6, 5, 11, 0, 0, 16, 32, 20, 1, +20, -65, 6, 5, 0, 11, -91, 6, -72, 1, -107, 64, 13, 5, -91, 0, 64, 17, 19, 52, 0, 25, 25, 112, -116, +24, 43, 78, 16, -12, 43, 77, -12, -3, -28, 0, 63, 60, -3, 93, 60, 57, 47, 60, 18, 23, 57, 18, 23, 57, +1, 17, 18, 23, 57, 18, 23, 57, 17, 18, 23, 57, 49, 48, 0, 93, 19, 55, 22, 23, 38, 39, 51, 6, 7, +54, 55, 23, 6, 7, 22, 23, 7, 38, 39, 6, 7, 39, 54, 55, 38, 64, 46, -97, 72, 19, 1, -111, 3, 20, +103, -123, 46, 127, 122, 61, 111, 120, 58, 79, 74, 56, 118, 116, 50, -127, 4, -83, -114, 56, 41, -75, 68, 99, -107, +52, 44, -114, 42, 14, 53, -120, 85, 79, -120, -115, 74, 85, -113, 46, 25, 0, 0, 1, 0, 114, 0, -19, 4, 58, +4, -74, 0, 11, 0, 56, 64, 31, 0, 110, 9, 2, -7, 8, 3, 110, 5, 7, 6, 9, 110, 10, 4, 10, -7, +5, 1, 110, 63, 2, 79, 2, 2, 2, 25, 12, 87, 90, 24, 43, 78, 16, -12, 93, 77, -12, 60, -19, 60, 16, +-28, 60, 60, 0, 47, -12, 60, -3, 60, -12, 49, 48, 37, 17, 33, 53, 33, 17, 51, 17, 33, 21, 33, 17, 2, +1, -2, 113, 1, -113, -86, 1, -113, -2, 113, -19, 1, -110, -88, 1, -113, -2, 113, -88, -2, 110, 0, 1, 0, -86, +-2, -34, 1, -125, 0, -51, 0, 10, 0, 78, -75, 10, 3, 0, 7, -85, 6, -72, 1, 80, 64, 38, 1, 3, 60, +2, 2, 1, 10, 1, 60, 0, 10, 2, 3, 1, 3, 60, 0, 6, 56, 7, 58, 79, 0, 95, 0, 111, 0, 127, +0, -96, 0, 5, 0, -96, 11, -95, -104, 24, 43, 16, -12, 93, -12, -28, 16, -19, 60, 16, 60, 0, 63, -19, 60, +16, 60, 16, -19, 16, -3, -19, 1, 17, 18, 57, 49, 48, 51, 53, 51, 21, 20, 6, 7, 39, 54, 54, 55, -74, +-51, 80, 87, 50, 57, 54, 3, -51, -51, 113, -117, 38, 77, 25, 97, 91, 0, 1, 0, 65, 1, -72, 2, 106, 2, +109, 0, 3, 0, 44, 64, 25, 112, 2, 112, 3, 2, 77, 1, 77, 2, 2, 1, 35, 0, 2, 26, 5, 112, 0, +1, 0, 25, 4, 112, -115, 24, 43, 78, 16, -28, 93, 16, -26, 0, 47, 77, -19, 49, 48, 0, 113, 1, 93, 19, +53, 33, 21, 65, 2, 41, 1, -72, -75, -75, 0, 0, 1, 0, -70, 0, 0, 1, -121, 0, -51, 0, 3, 0, 37, +64, 24, 2, 60, 0, 10, 2, 60, 95, 0, 111, 0, 127, 0, -81, 0, 4, -96, 0, 1, 0, -96, 4, -95, -104, +24, 43, 16, -10, 93, 93, -19, 0, 63, -19, 49, 48, 51, 53, 51, 21, -70, -51, -51, -51, 0, 0, 1, 0, 0, +-1, -25, 2, 57, 5, -45, 0, 3, 0, 83, -71, 0, 3, -1, -34, -78, 20, 57, 2, -72, -1, -34, 64, 32, 20, +57, -105, 3, 1, 2, 3, -97, 3, -81, 3, 2, 3, 118, 0, 1, 20, 0, 0, 1, 2, 1, 0, 3, 0, 10, +3, -24, 0, 2, -24, 1, -72, 1, -87, -75, 0, 0, 4, -77, 122, 24, 43, 16, 60, 16, -12, -19, 16, -19, 0, +63, 60, 63, 60, -121, 5, 46, 43, 93, 125, 16, -60, 49, 48, 1, 93, 43, 43, 21, 1, 51, 1, 1, -87, -112, +-2, 88, 25, 5, -20, -6, 20, 0, 0, 2, 0, 85, -1, -25, 4, 17, 5, -64, 0, 16, 0, 29, 1, 85, -79, +2, 2, 67, 84, 88, 64, 10, 26, 30, 4, 5, 20, 30, 13, 13, 23, 9, -72, -1, -24, -76, 15, 15, 2, 85, +9, -72, -1, -24, 64, 25, 13, 13, 2, 85, 9, 17, 0, 12, 15, 15, 2, 85, 0, 22, 12, 12, 2, 85, 0, +12, 13, 13, 2, 85, 0, 47, 43, 43, 43, -51, 47, 43, 43, -51, 0, 63, -19, 63, -19, 49, 48, 27, -79, 6, +2, 67, 84, 88, 64, 10, 26, 30, 4, 5, 20, 30, 13, 13, 23, 9, -72, -1, -12, -76, 15, 15, 6, 85, 9, +-72, -1, -26, -76, 13, 13, 6, 85, 9, -72, -1, -18, 64, 25, 11, 11, 6, 85, 9, 17, 0, 16, 13, 13, 6, +85, 0, 16, 12, 12, 6, 85, 0, 16, 11, 11, 6, 85, 0, 47, 43, 43, 43, -51, 47, 43, 43, 43, -51, 0, +63, -19, 63, -19, 49, 48, 27, -76, 6, 32, 25, 16, 28, -72, -1, -16, -78, 2, 32, 11, -66, -1, -32, 0, 22, +-1, -32, 0, 18, -1, -32, 0, 15, -1, -32, 64, 98, 4, 6, -121, 2, -120, 11, -120, 15, -55, 14, 5, 9, 7, +11, 24, 2, 69, 19, 76, 21, 74, 25, 67, 27, 84, 19, 92, 21, 92, 25, 82, 27, 107, 7, 107, 11, 99, 19, +108, 21, 107, 25, 96, 27, 121, 2, 119, 6, 118, 11, 122, 15, -121, 6, -104, 7, -106, 16, -55, 24, -38, 2, -42, +6, -42, 11, -37, 15, 26, 26, 30, 4, 5, 20, 30, 13, 13, 23, 115, 9, 64, 33, 35, 52, 48, 9, 1, 0, +9, 16, 9, 2, 9, -112, 31, 17, 115, 0, -72, -1, -64, 64, 14, 33, 35, 52, 32, 0, 64, 0, 2, 0, -112, +30, -57, -117, 24, 43, 16, -10, 93, 43, -19, 16, -10, 93, 113, 43, -19, 0, 63, -19, 63, -19, 49, 48, 1, 93, +113, 0, 93, 0, 56, 56, 56, 56, 56, 1, 56, 56, 56, 89, 89, 19, 16, 18, 54, 51, 50, 22, 22, 18, 21, +16, 2, 6, 35, 34, 39, 38, 19, 16, 22, 51, 50, 54, 17, 16, 38, 35, 34, 7, 6, 85, 107, -45, -96, 118, +-78, 116, 66, 106, -45, -95, -44, 121, -111, -71, -87, 124, 124, -87, -87, 126, 124, 74, 93, 2, -45, 1, 4, 1, 61, +-84, 95, -77, -2, -1, -38, -2, -2, -2, -61, -83, -104, -73, 1, -99, -2, -105, -17, -16, 1, 104, 1, 106, -18, 105, +-122, 0, 0, 1, 0, -33, 0, 0, 2, -5, 5, -64, 0, 10, 0, -81, 64, 32, 3, 64, 13, 17, 52, 107, 4, +127, 2, -113, 2, -103, 8, 4, -84, 4, 1, 9, 0, 6, 5, 2, 3, 9, 5, 1, 12, 2, 1, -54, 10, 0, +-72, -1, -64, 64, 10, 33, 35, 52, 48, 0, 1, 32, 0, 1, 0, -72, -1, -32, -76, 16, 16, 2, 85, 0, -72, +-1, -22, 64, 17, 15, 15, 2, 85, 0, 28, 12, 12, 2, 85, 0, 14, 13, 13, 2, 85, 0, -72, -1, -16, 64, +25, 15, 15, 6, 85, 0, 16, 12, 12, 6, 85, 0, 16, 13, 13, 6, 85, 0, 26, 12, 5, 64, 13, 15, 52, +5, -72, -1, -64, 64, 14, 33, 35, 52, 48, 5, 1, 32, 5, 64, 5, 2, 5, 25, 11, -70, 1, 60, 1, -123, +0, 24, 43, 78, 16, -28, 93, 113, 43, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 93, 113, 43, 60, 77, -3, +60, 0, 63, 63, 23, 57, 1, 17, 57, 49, 48, 1, 93, 0, 93, 43, 33, 35, 17, 6, 6, 7, 53, 54, 54, +55, 51, 2, -5, -76, 65, -45, 84, -105, -30, 47, 116, 4, 123, 62, 124, 31, -82, 71, -54, 95, 0, 0, 1, 0, +60, 0, 0, 4, 7, 5, -64, 0, 30, 1, -57, -79, 6, 2, 67, 84, 88, 64, 9, 17, 16, 13, 24, 19, 19, +6, 85, 13, -72, -1, -12, -76, 17, 17, 6, 85, 13, -72, -1, -18, 64, 9, 16, 16, 6, 85, 13, 30, 20, 5, +30, -72, -1, -24, 64, 23, 19, 19, 6, 85, 30, 30, 17, 17, 6, 85, 30, 28, 14, 16, 6, 85, 30, 12, 13, +13, 6, 85, 30, -72, 2, -69, 64, 12, 2, 10, 23, 23, 32, 31, 16, 17, 2, 2, 32, 31, 17, 18, 57, 47, +-44, -51, 17, 18, 57, 47, -51, 0, 47, -19, 43, 43, 43, 43, 63, -19, 43, 43, 43, -60, 50, 49, 48, 27, -79, +2, 2, 67, 84, 88, 64, 9, 17, 16, 13, 12, 18, 18, 2, 85, 13, -72, -1, -12, 64, 9, 15, 17, 2, 85, +13, 30, 20, 5, 30, -72, -1, -32, 64, 11, 18, 19, 2, 85, 30, 20, 15, 17, 2, 85, 30, -72, 2, -69, -78, +2, 10, 23, -72, -1, -24, -76, 11, 11, 2, 85, 23, -72, -1, -20, 64, 14, 13, 13, 2, 85, 23, 23, 32, 31, +16, 17, 2, 2, 32, 31, 17, 18, 57, 47, -44, -51, 17, 18, 57, 47, 43, 43, -51, 0, 47, -19, 43, 43, 63, +-19, 43, 43, -60, 50, 49, 48, 27, 64, 54, 59, 5, 59, 6, -69, 5, -65, 6, -69, 7, -57, 8, -55, 28, 7, +73, 12, 89, 12, 84, 14, 107, 12, 100, 14, 122, 18, 122, 19, -119, 18, -68, 18, -27, 26, -27, 27, -16, 26, 12, +-65, 11, -73, 19, 2, 27, 16, 28, 16, 29, 16, 30, 16, 6, -66, -1, -16, 0, 7, -1, -32, 0, 8, -1, -16, +0, 9, -1, -16, 64, 26, 30, 10, 16, 8, 6, 6, -54, 28, 26, 20, 28, 28, 26, 8, 28, 26, 3, 1, 2, +8, 26, 28, 3, 13, 30, 16, -72, 2, -92, -77, 79, 17, 1, 17, -72, 1, 24, -75, 13, 30, 20, 5, 0, 30, +-72, 2, -69, 64, 15, 1, 2, 12, 10, 115, 23, -45, 0, 0, 1, 64, 33, 35, 52, 1, -69, 2, -127, 0, 32, +0, 16, 1, 56, 64, 12, 17, -75, 63, 2, 95, 2, 111, 2, 127, 2, 4, 2, -70, 2, 36, 0, 31, 1, -113, +-79, -117, 24, 43, 16, -10, 93, -12, -19, 16, -10, 43, 60, 16, -12, -19, 0, 63, 60, -3, 60, 63, -19, -3, 93, +-28, 17, 18, 23, 57, 1, 17, 18, 23, 57, -121, 14, 46, 43, 14, 125, 16, -60, 1, 17, 18, 57, 49, 48, 0, +56, 56, 56, 56, 1, 56, 56, 56, 56, 0, 93, 1, 93, 114, 89, 89, 37, 21, 33, 38, 55, 54, 54, 55, 54, +54, 53, 52, 38, 35, 34, 6, 7, 39, 54, 54, 51, 50, 22, 21, 20, 6, 6, 7, 6, 6, 7, 4, 7, -4, +55, 2, 23, 37, -93, -102, -17, -88, -103, 123, -126, -100, 1, -71, 19, -8, -47, -45, -10, 72, -89, -62, -94, 92, 30, +-83, -83, 65, 60, 99, -64, 126, -60, -27, 102, 107, -109, -100, -118, 19, -49, -39, -22, -83, 88, -86, -68, -92, -120, 97, +49, 0, 1, 0, 86, -1, -26, 4, 22, 5, -64, 0, 43, 1, 89, -79, 2, 2, 67, 84, 88, 64, 11, 25, 24, +64, 13, 13, 2, 85, 24, 28, 0, 1, -72, -1, -64, 64, 43, 12, 13, 2, 85, 1, 41, 35, 10, 13, 15, 12, +15, 30, 10, 10, 41, 21, 30, 28, 4, 30, 41, 28, 5, 41, 13, 35, 13, 12, 24, 25, 1, 0, 18, 32, 16, +12, 12, 2, 85, 32, 7, 38, -72, -1, -24, -76, 12, 13, 2, 85, 38, 47, 43, -51, 47, 43, -51, 47, -51, 47, +-51, 47, 0, 18, 57, 63, 63, 16, -19, 16, -19, 18, 57, 47, -19, -58, 16, -58, 18, 57, 16, -60, 43, 50, 16, +-60, 43, 50, 49, 48, 27, 64, 40, 5, 13, 22, 13, 69, 13, -122, 13, 4, 69, 17, 87, 17, 118, 27, 3, 82, +22, 108, 16, 106, 20, 100, 22, 117, 13, 121, 20, -122, 13, -118, 20, -119, 27, -91, 13, 10, 5, 32, 3, -72, -1, +-32, 64, 11, 11, 12, 13, 14, 4, 7, 1, 35, 13, 12, 1, -72, 2, -92, -77, 64, 0, 1, 0, -69, 1, 24, +0, 41, 0, 13, 1, 53, -76, 12, 12, 21, 4, 24, -70, 2, -92, 0, 25, 2, 104, 64, 39, 21, 30, 28, 5, +4, 30, 41, 13, 18, 115, 95, 32, 111, 32, 2, 32, 24, 13, 13, 6, 85, 32, -128, 7, 115, 38, 64, 33, 35, +52, 48, 38, 1, 0, 38, 16, 38, 2, 38, -72, -1, -12, -73, 13, 13, 6, 85, 38, -112, 45, 24, -72, 1, 56, +-78, 25, -45, 1, -70, 1, 56, 0, 0, -1, -64, 64, 11, 33, 35, 52, 32, 0, 64, 0, 2, 0, -112, 44, -72, +1, -110, -79, -117, 24, 43, 16, -10, 93, 43, -19, -12, -19, 16, -10, 43, 93, 113, 43, -19, -12, 43, 93, -19, 0, +63, -19, 63, -19, -3, -28, 17, 18, 57, 47, -19, 16, -3, 93, -28, 17, 18, 57, 1, 17, 18, 23, 57, 49, 48, +1, 56, 56, 1, 93, 0, 93, 1, 113, 89, 19, 55, 22, 22, 51, 50, 54, 53, 52, 38, 35, 34, 7, 55, 22, +51, 50, 54, 53, 52, 38, 35, 34, 6, 7, 39, 54, 54, 51, 50, 22, 22, 21, 20, 6, 7, 22, 22, 21, 20, +0, 35, 34, 38, 86, -76, 31, -107, 107, 127, -81, -94, 125, 51, 76, 20, 18, 11, 115, -72, -122, 106, 105, -116, 20, +-76, 33, -22, -82, 120, -54, 107, 102, 100, -126, -112, -2, -24, -42, -63, -1, 1, -125, 24, -103, -121, -80, -126, 124, -95, +20, -98, 2, 120, 125, 99, -126, -124, -124, 32, -75, -57, 103, -78, 100, 95, -100, 46, 30, -67, -114, -64, -2, -11, -26, +0, 2, 0, 26, 0, 0, 4, 16, 5, -70, 0, 10, 0, 13, 1, 38, 64, 54, 18, 88, 12, 104, 12, -102, 12, +-87, 12, -55, 12, 5, 76, 3, 76, 13, -108, 4, 3, 18, 1, 2, 8, 0, 12, 6, 3, 7, 5, 10, 11, 3, +7, 0, 12, 12, 13, 13, -54, 3, 4, 20, 3, 3, 4, 3, 13, 0, 2, 12, 13, 4, 7, 3, -69, 2, -69, +0, 8, 0, 2, 1, -96, 64, 10, 0, 4, 4, 0, 12, 12, 0, -54, 10, 4, -72, 2, 102, -73, 5, 5, 10, +64, 29, 31, 52, 10, -72, -1, -32, -76, 16, 16, 2, 85, 10, -72, -1, -26, -76, 13, 13, 2, 85, 10, -72, -1, +-18, -76, 13, 13, 6, 85, 10, -72, 1, 55, 64, 13, 7, 64, 34, 35, 52, 7, -128, 33, 53, 7, -112, 15, 2, +-72, -1, -64, 64, 11, 13, 20, 52, 0, 2, 16, 2, 32, 2, 3, 2, -72, -1, -32, -76, 13, 13, 2, 85, 2, +-72, -1, -28, -74, 13, 13, 6, 85, 2, -75, 14, -72, 1, -116, -79, -117, 24, 43, 16, -20, 43, 43, 93, 43, 16, +-10, 43, 43, -12, 43, 43, 43, 43, 60, 16, -26, 16, -3, 60, 0, 63, 63, 16, -12, 60, -10, 60, 17, 57, 57, +1, 17, 18, 57, 57, -121, 46, 43, 4, 125, 16, -60, 15, 15, 15, 49, 48, 1, 67, 92, 88, -71, 0, 13, -1, +-34, -78, 18, 57, 13, -72, -1, -44, 64, 11, 51, 57, 3, 34, 45, 57, 3, 4, 29, 29, 60, 43, 43, 43, 43, +89, 93, 0, 93, 67, 92, 88, 64, 20, 12, 64, 11, 57, 12, -128, 80, 57, 12, 64, 38, 57, 12, 34, 28, 57, +12, 64, 45, 57, 43, 43, 43, 43, 43, 89, 33, 17, 33, 53, 1, 51, 17, 51, 21, 35, 17, 3, 17, 1, 2, +-106, -3, -124, 2, -99, -109, -58, -58, -76, -2, 53, 1, 95, -91, 3, -74, -4, 74, -91, -2, -95, 2, 4, 2, -107, +-3, 107, 0, 1, 0, 85, -1, -25, 4, 33, 5, -90, 0, 30, 1, 86, -79, 2, 2, 67, 84, 88, -71, 0, 1, +-1, -64, 64, 13, 13, 13, 2, 85, 1, 28, 14, 10, 30, 21, 21, 28, 18, -72, 2, -69, 64, 11, 15, 4, 4, +30, 28, 13, 14, 1, 0, 7, 24, -72, -1, -22, -76, 15, 15, 2, 85, 24, -72, -1, -22, -76, 13, 13, 2, 85, +24, 47, 43, 43, -51, 47, -51, 47, 0, 63, -19, 63, -19, 18, 57, 47, -3, -60, 16, -60, 43, 49, 48, 27, 64, +41, 18, 12, 13, 13, 6, 85, 15, 12, 13, 13, 6, 85, 75, 26, 121, 29, -118, 29, -106, 19, -89, 19, -61, 12, +-42, 12, -37, 27, 8, 9, 19, 24, 14, 42, 26, 3, 9, 48, 5, 48, 11, -70, -1, -32, 0, 3, -1, -32, 64, +16, 19, 10, 21, 18, 19, 19, -54, 14, 15, 20, 14, 19, 20, 14, 15, 13, -72, 2, -92, 64, 19, 14, 10, 30, +21, 64, 14, -96, 14, 2, 14, 14, 15, 64, 21, 1, 21, 21, 28, 18, -72, 2, -69, -73, 15, 4, 1, -45, 64, +0, 1, 0, -72, 1, 24, 64, 32, 4, 30, 28, 13, 17, 95, 16, 111, 16, 127, 16, -113, 16, 4, 16, -128, 7, +115, 24, 64, 33, 35, 52, 48, 24, 1, 0, 24, 16, 24, 2, 24, -72, -1, -12, -73, 13, 13, 6, 85, 24, -112, +32, 18, -68, 1, 53, 0, 15, 1, -107, 0, 13, 1, 56, -78, 14, -75, 1, -70, 1, 56, 0, 0, -1, -64, 64, +11, 33, 35, 52, 32, 0, 64, 0, 2, 0, -112, 31, -72, 1, -110, -79, -117, 24, 43, 16, -10, 93, 43, -19, -12, +-19, -12, -19, 16, -10, 43, 93, 113, 43, -19, -12, 93, 60, 0, 63, -19, -3, 93, -28, 63, -19, 18, 57, 47, 93, +17, 57, 47, 93, 16, -19, 16, -28, -121, 8, 46, 43, 5, 125, 16, -60, 0, 17, 18, 57, 49, 48, 1, 56, 56, +56, 56, 1, 113, 93, 43, 43, 89, 19, 55, 22, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 7, 39, 19, 33, +21, 33, 3, 54, 51, 50, 0, 21, 20, 7, 6, 35, 34, 38, 85, -67, 21, -103, 108, -126, -76, -83, -116, 87, -116, +40, -87, -114, 2, -39, -3, -73, 79, -124, -111, -64, 1, 8, 116, -115, -12, -56, -3, 1, -128, 16, -118, -117, -60, -94, +-102, -78, 79, 63, 22, 2, -15, -84, -2, 118, 92, -2, -10, -47, -57, -111, -78, -32, 0, 0, 2, 0, 77, -1, -25, +4, 21, 5, -64, 0, 29, 0, 42, 1, 79, -79, 2, 2, 67, 84, 88, 64, 31, 15, 1, 31, 1, 95, 1, 3, +1, 27, 40, 30, 64, 13, 1, 13, 13, 20, 5, 30, 27, 5, 34, 30, 20, 13, 10, 30, 1, 0, 37, 16, -72, +-1, -12, 64, 25, 13, 13, 2, 85, 16, 30, 23, 16, 15, 15, 2, 85, 23, 16, 12, 12, 2, 85, 23, 12, 13, +13, 2, 85, 23, 47, 43, 43, 43, -51, 47, 43, -51, -44, -51, 16, -59, 0, 63, -19, 63, -19, 18, 57, 47, 93, +-19, 16, -60, 93, 49, 48, 27, 64, 45, 107, 25, 1, 68, 7, 64, 21, 68, 25, 68, 32, 90, 18, 84, 32, 107, +3, 100, 7, 100, 8, 106, 18, 100, 32, 116, 8, 117, 28, -123, 8, -122, 28, -42, 8, -44, 22, 17, 7, 32, 13, +13, 6, 85, 39, -72, -1, -32, -76, 13, 13, 6, 85, 35, -72, -1, -32, 64, 11, 13, 13, 6, 85, 33, 32, 13, +13, 6, 85, 7, -72, -1, -32, -76, 39, 32, 35, 32, 33, -72, -1, -32, 64, 17, 40, 30, 64, 13, 80, 13, 2, +13, 13, 20, 27, 1, -45, 95, 0, 1, 0, -72, 2, 104, 64, 9, 5, 30, 27, 5, 34, 30, 20, 13, 1, -72, +1, 56, 64, 18, 0, -75, 37, 115, 16, 64, 33, 35, 52, 48, 16, 1, 0, 16, 16, 16, 2, 16, -72, -1, -16, +-73, 12, 12, 6, 85, 16, -112, 44, 10, -70, 1, 56, 0, 30, 1, 57, 64, 22, 63, 23, 95, 23, 111, 23, 127, +23, 4, 23, 22, 12, 12, 6, 85, 23, 22, 13, 13, 6, 85, 23, -72, 2, 36, -77, 43, -57, -117, 24, 43, 16, +-10, 43, 43, 93, -19, -19, 16, -10, 43, 93, 113, 43, -19, -12, -19, 0, 63, -19, 63, -19, -3, 93, -28, 17, 18, +57, 47, 93, -19, 49, 48, 1, 56, 56, 56, 56, 43, 43, 43, 43, 1, 93, 0, 93, 89, 1, 7, 38, 39, 38, +35, 34, 7, 6, 6, 7, 54, 54, 51, 50, 18, 21, 20, 6, 6, 35, 34, 0, 17, 16, 55, 54, 51, 50, 22, +1, 20, 22, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 3, -5, -77, 24, 44, 73, 107, 86, 65, 85, 98, 2, +65, -68, 103, -76, -3, 119, -48, -124, -31, -2, -28, -99, -119, -24, -83, -35, -3, 55, 79, -114, 78, 114, -92, -94, 123, +122, -86, 4, 83, 14, 106, 48, 77, 48, 62, -18, -36, 99, 96, -2, -9, -46, -118, -19, 126, 1, 75, 1, 124, 1, +-87, -63, -88, -62, -4, -35, 93, -86, 89, -72, -98, -104, -81, -81, 0, 1, 0, 97, 0, 0, 4, 22, 5, -89, 0, +13, 0, 112, 64, 14, -60, 13, 1, 4, 13, 1, 4, 2, 8, 4, 9, 3, 13, 0, -72, 2, -69, 64, 48, 2, +1, 4, 9, 12, 13, 115, 3, 3, 2, 64, 33, 35, 52, 79, 2, 95, 2, 111, 2, 3, 2, 26, 15, 8, 115, +9, -21, 0, 79, 1, 95, 1, 95, 2, 3, 63, 1, 95, 1, 111, 1, 127, 1, 4, 1, 25, 14, -72, 1, -110, +-79, -117, 24, 43, 78, 16, -12, 93, 113, 60, 77, -12, -19, 78, 16, -10, 113, 43, 60, 77, 16, -19, 0, 63, 63, +60, -3, 60, 57, 17, 57, 1, 17, 18, 57, 49, 48, 1, 113, 93, 19, 53, 33, 21, 6, 0, 3, 6, 7, 35, +54, 18, 18, 55, 97, 3, -75, -116, -2, -19, 75, 54, 15, -71, 3, -126, -13, -119, 4, -6, -83, -116, -107, -2, 18, +-2, -5, -72, -37, -83, 1, -22, 1, -57, -100, 0, 0, 3, 0, 83, -1, -25, 4, 25, 5, -64, 0, 23, 0, 35, +0, 48, 2, 0, -79, 2, 2, 67, 84, 88, -76, 12, 0, 27, 30, 46, -72, -1, -64, 64, 23, 19, 19, 2, 85, +46, 46, 18, 33, 30, 6, 5, 40, 30, 18, 13, 30, 9, 12, 12, 12, 2, 85, 9, -72, -1, -12, -74, 13, 13, +2, 85, 9, 43, 15, -72, -1, -16, -76, 15, 15, 2, 85, 15, -72, -1, -24, -76, 11, 11, 2, 85, 15, -72, -1, +-24, -74, 13, 13, 2, 85, 15, 24, 3, -72, -1, -16, -76, 16, 16, 2, 85, 3, -72, -1, -16, -76, 15, 15, 2, +85, 3, -72, -1, -12, 64, 25, 13, 13, 2, 85, 3, 36, 21, 12, 11, 11, 2, 85, 21, 12, 12, 12, 2, 85, +21, 12, 13, 13, 2, 85, 21, 47, 43, 43, 43, -51, 47, 43, 43, 43, -51, 47, 43, 43, 43, -51, 47, 43, 43, +-51, 0, 63, -19, 63, -19, 18, 57, 47, 43, -19, 57, 57, 49, 48, 27, -79, 6, 2, 67, 84, 88, -73, 30, 9, +12, 12, 12, 6, 85, 9, -72, -1, -12, -74, 13, 13, 6, 85, 9, 43, 15, -72, -1, -28, -76, 15, 15, 6, 85, +15, -72, -1, -28, -74, 13, 13, 6, 85, 15, 24, 3, -72, -1, -16, -76, 15, 15, 6, 85, 3, -72, -1, -4, 64, +34, 13, 13, 6, 85, 3, 36, 21, 12, 12, 12, 6, 85, 21, 12, 13, 13, 6, 85, 21, 12, 0, 27, 30, 46, +46, 18, 33, 30, 6, 5, 40, 30, 18, 13, 0, 63, -19, 63, -19, 18, 57, 47, -19, 57, 57, 1, 47, 43, 43, +-51, 47, 43, 43, -51, 47, 43, 43, -51, 47, 43, 43, -51, 49, 48, 27, 64, 55, 53, 22, 1, 41, 22, 73, 22, +73, 38, -26, 12, -23, 48, 5, 9, 48, 1, 125, 0, 125, 1, 124, 4, 116, 8, 113, 11, 114, 12, 117, 13, 122, +23, -117, 0, -118, 1, -116, 4, -122, 8, -127, 11, -124, 12, -122, 13, -115, 23, -52, 17, -58, 19, 18, 34, -72, -1, +-32, -78, 28, 32, 26, -72, -1, -32, -78, 32, 32, 47, -72, -1, -32, -78, 45, 32, 38, -72, -1, -32, 64, 30, 41, +32, 12, 0, 30, 24, 0, 12, 27, 30, 46, -96, 46, 1, 46, 18, 33, 30, 6, 5, 40, 30, 18, 13, 30, 115, +-65, 9, 1, 9, -72, 2, 103, 64, 16, 43, 115, 15, 64, 32, 35, 52, 48, 15, 1, 0, 15, 16, 15, 2, 15, +-72, 1, -111, -74, 50, 24, 115, -80, 3, 1, 3, -72, 2, 103, -78, 36, 115, 21, -72, -1, -64, 64, 14, 33, 35, +52, 32, 21, 64, 21, 2, 21, -112, 49, -57, -117, 24, 43, 16, -10, 93, 43, -19, -12, 93, -19, 16, -12, 93, 113, +43, -19, -12, 93, -19, 0, 63, -19, 63, -19, 18, 57, 93, 47, -19, 57, 57, 1, 17, 18, 57, 57, 49, 48, 1, +56, 56, 56, 56, 56, 56, 56, 56, 1, 93, 114, 113, 0, 113, 89, 89, 1, 38, 38, 53, 52, 54, 51, 50, 22, +21, 20, 6, 7, 22, 22, 21, 20, 0, 35, 34, 0, 53, 52, 54, 19, 20, 22, 51, 50, 54, 53, 52, 38, 35, +34, 6, 3, 20, 22, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 1, 106, 112, 108, -26, -65, -64, -22, 107, 109, +-121, -115, -2, -10, -39, -39, -2, -10, -111, 98, -122, 107, 104, -123, -119, 102, 103, -120, 58, 73, -112, 83, -127, -88, -83, +-126, 127, -89, 3, 27, 41, -104, 106, -96, -38, -33, -96, 102, -105, 41, 44, -60, -120, -68, -1, 0, 1, 1, -64, -113, +-63, 1, 84, 104, -124, -125, 95, 99, -121, -124, -4, -1, 77, -112, 79, -90, -128, -126, -86, -88, 0, 0, 2, 0, 85, +-1, -25, 4, 25, 5, -64, 0, 30, 0, 42, 1, -82, -79, 6, 2, 67, 84, 88, -73, 11, 31, 24, 1, 0, 37, +17, 24, -72, -1, -10, -76, 15, 15, 6, 85, 24, -72, -1, -12, -76, 13, 13, 6, 85, 24, -72, -1, -16, 64, 40, +12, 12, 6, 85, 24, 17, 12, 13, 13, 6, 85, 17, 16, 12, 12, 6, 85, 17, 24, 17, 44, 43, 11, 40, 30, +15, 14, 31, 14, 79, 14, 3, 14, 14, 20, 0, 80, 1, 1, 1, -72, -1, -64, 64, 13, 16, 17, 6, 85, 1, +4, 30, 28, 13, 34, 30, 20, 5, 0, 63, -19, 63, -19, -60, 43, 93, 50, 18, 57, 47, 93, -19, 50, 1, 17, +18, 57, 57, 47, 43, 43, 47, 43, 43, 43, 16, -51, -44, -51, 16, -35, -59, 49, 48, 27, -79, 2, 2, 67, 84, +88, -73, 11, 31, 24, 1, 0, 37, 17, 24, -72, -1, -22, -76, 15, 15, 2, 85, 24, -72, -1, -22, 64, 42, 13, +13, 2, 85, 24, 17, 12, 12, 12, 2, 85, 17, 24, 17, 44, 43, 11, 40, 30, 15, 14, 31, 14, 79, 14, 3, +14, 14, 20, 0, 80, 1, 1, 1, 4, 30, 28, 13, 34, 30, 20, 5, 0, 63, -19, 63, -19, -60, 93, 50, 18, +57, 47, 93, -19, 50, 1, 17, 18, 57, 57, 47, 43, 47, 43, 43, 16, -51, -44, -51, 16, -35, -59, 49, 48, 27, +64, 52, 58, 26, 76, 22, 64, 35, 91, 22, 87, 35, 102, 3, 108, 22, 109, 26, 103, 35, 122, 26, 125, 30, -116, +26, -117, 30, -102, 22, -87, 26, -68, 26, -22, 22, -26, 32, -10, 32, 19, 61, 22, -98, 22, -83, 22, 3, 58, 41, +100, 6, 2, 39, -70, -1, -32, 0, 35, -1, -32, 64, 24, 33, 32, 6, 32, 40, 30, 79, 14, 95, 14, 2, 14, +14, 28, 34, 30, 20, 5, 1, -45, 80, 0, 1, 0, -72, 2, 104, -76, 4, 30, 28, 13, 31, -70, 1, 57, 0, +11, 1, 56, 64, 17, 24, 64, 33, 35, 52, 48, 24, 1, 0, 24, 16, 24, 2, 24, -112, 44, 1, -72, 1, 56, +-76, 0, -75, 37, 115, 17, -72, -1, -64, 64, 14, 33, 35, 52, 32, 17, 64, 17, 2, 17, -112, 43, -57, -117, 24, +43, 16, -10, 93, 43, -19, -12, -19, 16, -10, 93, 113, 43, -19, -19, 0, 63, -19, -3, 93, -28, 63, -19, 18, 57, +47, 93, -19, 49, 48, 1, 56, 56, 56, 56, 0, 93, 113, 1, 93, 89, 89, 19, 55, 22, 22, 51, 50, 62, 2, +53, 52, 39, 6, 6, 35, 34, 2, 53, 52, 0, 51, 50, 22, 18, 17, 16, 2, 6, 35, 34, 38, 1, 52, 38, +35, 34, 6, 21, 20, 22, 51, 50, 54, 112, -83, 22, 124, 97, 83, 125, 80, 54, 1, 54, -69, 109, -74, -4, 1, +7, -58, -113, -19, 123, 122, -15, -94, -84, -38, 2, -53, -91, 116, 120, -78, -87, 124, 125, -95, 1, 83, 16, 122, 110, +76, 127, -40, 112, 12, 24, 86, 107, 1, 8, -40, -33, 1, 16, -102, -2, -29, -2, -14, -2, -25, -2, -77, -82, -65, +3, 52, -101, -74, -60, -100, -116, -81, -81, 0, 0, 2, 0, -71, 0, 0, 1, -122, 4, 38, 0, 3, 0, 7, 0, +56, 64, 32, 4, 5, 0, 6, 7, 9, 2, 6, 60, 4, 3, 60, 1, 6, 4, 10, 2, 60, 47, 0, 63, 0, +2, 32, 0, 1, 0, -95, 8, -95, -104, 24, 43, 16, -12, 93, 113, -19, 0, 63, 63, -19, 16, -19, 1, 17, 18, +57, 57, 18, 57, 57, 49, 48, 19, 53, 51, 21, 3, 53, 51, 21, -71, -51, -51, -51, 3, 89, -51, -51, -4, -89, +-51, -51, 0, 2, 0, -86, -2, -34, 1, -125, 4, 38, 0, 3, 0, 14, 0, -123, 64, 47, 115, 11, -125, 11, -109, +11, -93, 11, -16, 11, 5, 0, 11, 1, 38, 10, 55, 10, 70, 10, 86, 10, 101, 10, -75, 10, -30, 10, 7, 11, +10, 14, 7, 4, 3, 60, 1, 7, 60, 6, 6, 5, 14, 4, 11, -85, 10, -72, 1, 80, 64, 35, 5, 60, 4, +1, 6, 4, 10, 2, -127, 0, 0, 5, 6, 7, 60, 4, 10, 56, 11, 58, 5, 47, 4, 63, 4, 2, 32, 4, +1, 4, -95, 15, -95, -104, 24, 43, 16, -12, 93, 113, 60, -12, -28, 16, -3, 60, 16, 60, 16, -19, 0, 63, 63, +16, -3, -3, -19, 16, 60, 16, 60, 16, -19, 16, -19, 1, 17, 18, 57, 0, 16, -55, 49, 48, 1, 113, 0, 114, +113, 19, 53, 51, 21, 3, 53, 51, 21, 20, 6, 7, 39, 54, 54, 55, -74, -51, -51, -51, 80, 87, 50, 57, 54, +3, 3, 89, -51, -51, -4, -89, -51, -51, 113, -117, 38, 77, 25, 97, 91, 0, 0, 1, 0, 112, 0, -30, 4, 59, +4, -61, 0, 6, 0, 90, 64, 12, -113, 3, -128, 5, 2, 3, 5, 6, 3, 8, 2, 5, -69, 2, 90, 0, 6, +0, 3, 2, 90, -78, 2, 64, 6, -70, 1, 80, 0, 2, 1, 80, 64, 21, 0, -85, 1, -85, 32, 4, 2, 26, +8, 4, 60, 1, 32, 0, 1, 0, 117, 7, 87, 90, 24, 43, 16, -10, 93, 60, -19, 78, 16, -10, 0, 25, 47, +26, 77, -19, -19, -19, -19, 24, 26, 16, -19, 16, -19, 1, 17, 18, 23, 57, 49, 48, 0, 93, 19, 53, 1, 21, +1, 1, 21, 112, 3, -53, -4, -2, 3, 2, 2, -127, -88, 1, -102, -77, -2, -60, -2, -63, -77, 0, 0, 2, 0, +114, 1, -95, 4, 58, 4, 6, 0, 3, 0, 7, 0, 71, 64, 39, 5, 6, 1, 4, 7, 9, 0, 37, 3, 1, +37, 3, 2, 7, 37, 4, 4, 6, 37, 48, 2, 1, -97, 2, -49, 2, 2, 2, -65, 5, 0, 26, 9, 1, 25, +8, 87, 90, 24, 43, 78, 16, -28, 16, -26, 0, 47, 77, -19, 93, 113, -19, 60, 16, -19, 16, 60, -19, 16, -19, +1, 17, 57, 57, 17, 57, 57, 49, 48, 1, 33, 53, 33, 17, 33, 53, 33, 4, 58, -4, 56, 3, -56, -4, 56, +3, -56, 3, 94, -88, -3, -101, -88, 0, 0, 1, 0, 112, 0, -30, 4, 59, 4, -61, 0, 6, 0, 90, 64, 12, +-128, 2, -113, 4, 2, 4, 2, 1, 3, 7, 5, 2, -69, 2, 90, 0, 1, 0, 4, 2, 90, -78, 5, 64, 1, +-70, 1, 80, 0, 5, 1, 80, 64, 21, 0, -85, 6, -85, 32, 3, 3, 60, 6, 0, 26, 8, 32, 5, 1, 5, +117, 7, 87, 90, 24, 43, 16, -26, 93, 78, 16, -10, 60, 77, -19, 0, 25, 47, 26, -19, -19, -19, -19, 24, 26, +16, -19, 16, -19, 1, 17, 18, 23, 57, 49, 48, 0, 93, 1, 1, 53, 1, 1, 53, 1, 4, 59, -4, 53, 3, +1, -4, -1, 3, -53, 2, -127, -2, 97, -77, 1, 63, 1, 60, -77, -2, 102, 0, 0, 2, 0, 90, 0, 0, 4, +12, 5, -45, 0, 30, 0, 34, 0, -124, 64, 47, -116, 26, -117, 27, 2, 124, 26, 124, 27, 2, 98, 26, 101, 27, +2, 107, 12, 97, 14, 2, 90, 12, 84, 14, 2, 54, 14, 68, 14, 2, 27, 25, 8, 7, 4, 0, 16, 39, 17, +17, 0, 13, 41, 20, 1, 30, 0, -72, 2, -81, 64, 35, 33, 34, 33, 60, 31, 10, 31, 60, 34, 34, 32, 60, +33, 33, 30, 0, 94, 30, 110, 10, 94, 23, 106, 36, 16, 94, 32, 17, 1, 17, 106, 35, 87, 90, 24, 43, 16, +-10, 93, -19, 16, -10, -19, -12, -19, 16, 60, 16, -19, 60, 16, -3, 0, 63, -19, 60, 16, -10, 60, 63, -19, 18, +57, 47, -28, 17, 23, 57, 49, 48, 1, 93, 93, 93, 93, 0, 93, 93, 1, 38, 53, 52, 55, 54, 55, 62, 2, +53, 52, 38, 35, 34, 6, 7, 39, 54, 54, 51, 50, 4, 21, 20, 6, 7, 14, 2, 7, 3, 53, 51, 21, 1, +-40, 1, 30, 22, 49, 36, -69, 56, -92, 119, 115, -102, 24, -71, 25, -9, -53, -41, 1, 0, 90, -125, 88, 54, 26, +2, -72, -51, 1, 105, 36, 18, 106, 77, 58, 59, 43, -91, 98, 58, 105, -97, -112, -103, 22, -51, -38, -22, -90, 96, +-94, 116, 78, 74, 96, 108, -2, -105, -51, -51, 0, 2, 0, 111, -2, 81, 7, -43, 5, -43, 0, 71, 0, 87, 0, +-9, 64, 87, 4, 33, 16, 32, 22, 33, 33, 37, 53, 13, 51, 14, 69, 14, 73, 24, 68, 33, 70, 36, 70, 73, +71, 86, 84, 14, 122, 41, 14, 22, 37, 41, 1, 38, 9, 42, 29, 38, 41, 53, 26, 54, 57, 67, 37, 86, 24, +89, 29, 91, 33, 86, 41, 86, 73, 89, 86, 101, 24, 101, 37, 102, 41, 118, 26, 122, 29, 114, 36, -123, 24, -124, +26, -116, 29, -117, 33, -121, 38, 25, 14, 16, 80, 14, 0, 3, 83, -72, 2, -69, 64, 10, 15, 39, 48, 11, 80, +11, 2, 11, 7, 22, -69, 2, 72, 0, 67, 0, 75, 2, -69, -76, 67, 58, 3, 10, 31, -72, 2, -69, -73, 58, +1, 32, 43, 112, 43, 2, 43, -70, 1, 77, 0, 39, 2, -69, -74, 47, 72, 36, 15, 7, 1, 7, -72, 2, -125, +64, 15, 16, 80, 62, 0, 36, 18, -96, 15, 36, 48, 16, 112, 16, 2, 16, -70, 1, -87, 0, 27, 2, -98, -76, +63, 56, 42, 36, 43, -70, 1, 9, 0, 35, 2, -98, 64, 9, 32, 53, 1, 53, 25, 88, 87, -116, 24, 43, 78, +16, -12, 93, 77, -19, -3, -19, -12, -19, -12, 93, -19, -12, -3, -28, 16, -3, 93, -19, 0, 47, -19, -19, 93, 63, +-19, 63, -28, -19, 16, -19, 63, 93, -28, -19, 18, 57, 57, 1, 17, 18, 57, 49, 48, 0, 93, 1, 93, 37, 6, +6, 35, 34, 38, 38, 53, 52, 18, 54, 51, 50, 22, 23, 55, 51, 3, 6, 21, 20, 22, 51, 50, 55, 54, 18, +53, 52, 2, 36, 35, 34, 4, 2, 21, 20, 18, 4, 51, 32, 36, 55, 51, 6, 6, 4, 35, 34, 36, 36, 39, +38, 53, 52, 55, 18, 0, 33, 50, 4, 23, 22, 21, 16, 7, 6, 35, 34, 38, 39, 38, 1, 20, 22, 51, 50, +62, 2, 53, 52, 38, 35, 34, 14, 2, 4, -119, 65, -95, 81, 89, -88, 105, -93, -14, 114, 87, -98, 57, 34, -77, +-112, 30, 41, 29, 53, 86, 114, -123, -85, -2, -83, -51, -22, -2, 125, -43, -43, 1, -109, -11, 1, 6, 1, 98, 88, +-75, 51, -8, -2, -86, -15, -34, -2, -119, -2, -8, 67, 84, 100, 122, 1, -63, 1, 64, -8, 1, -117, 114, 97, -52, +-74, -40, 69, 85, 20, 13, -2, 22, -126, 84, 56, 124, 113, 72, -121, 97, 64, 113, 106, 64, -93, 75, 91, 104, -40, +-127, -97, 1, 63, -96, 91, 93, -101, -3, 97, -116, 15, 27, 39, 61, 80, 1, 13, -113, -89, 1, 34, -82, -37, -2, +103, -22, -11, -2, -98, -87, -80, 126, 105, -38, 127, 114, -27, -107, -67, -37, -12, -35, 1, 15, 1, 32, -53, -55, -83, +-53, -2, -34, -31, -54, 42, 39, 25, 1, 76, -119, -104, 67, -124, -53, 102, -120, -106, 65, -112, -50, 0, 0, 2, -1, +-3, 0, 0, 5, 89, 5, -70, 0, 7, 0, 14, 1, 103, -74, 1, 14, 15, 16, 2, 85, 2, -72, -1, -14, -76, +15, 16, 2, 85, 2, -72, -1, -8, -76, 13, 13, 6, 85, 2, -72, -1, -12, 64, 89, 12, 12, 6, 85, 9, 12, +12, 12, 6, 85, 5, 12, 12, 12, 6, 85, 47, 16, 48, 16, 103, 8, 104, 9, 96, 16, -120, 3, -112, 16, -55, +5, -58, 6, -64, 16, -16, 16, 11, 8, 5, 89, 1, 86, 2, 80, 16, 104, 11, -80, 16, -13, 12, -13, 13, -13, +14, 9, 4, 12, 4, 13, 4, 14, 3, 11, 10, 9, 5, 4, 4, 12, 13, 14, 8, 6, 7, 7, 12, 9, 5, +4, 8, 6, 12, 7, 1, 0, 0, -72, -1, -8, 64, 15, 12, 12, 2, 85, 0, 32, 7, 12, 20, 7, 7, 12, +2, 3, 3, -72, -1, -8, 64, 21, 12, 12, 2, 85, 3, 32, 4, 12, 20, 4, 4, 12, 9, 30, 5, 5, 8, +30, 6, 3, 6, -72, 2, 112, 64, 9, 0, 8, 12, -23, 64, 2, 1, 2, 2, -70, 1, 11, 0, 1, 1, 11, +64, 18, 12, 32, 0, 101, 7, 3, 82, 80, 4, -49, 4, -33, 4, 3, -112, 4, 1, 4, -72, 1, 1, 64, 11, +80, 12, -64, 7, -33, 12, 3, -112, 12, 1, 12, -72, 1, 1, 64, 16, 15, 7, -49, 7, 2, 127, 7, -128, 7, +2, 7, -109, 15, -42, -41, 24, 43, 16, -12, 93, 113, 25, -12, 93, 113, -12, 93, 113, 24, -19, 16, -19, 26, 25, +16, -19, -19, 0, 24, 63, 60, 26, -19, 63, -28, 60, 16, -19, 60, 16, -19, -121, 5, 46, 43, 43, 125, 16, -60, +-121, 46, 24, 43, 43, 125, 16, -60, 1, 17, 18, 57, 57, 17, 57, 57, -121, 16, -60, -60, 14, -60, -60, -121, 5, +16, -60, -60, 14, -60, -60, 49, 48, 1, 75, -80, 11, 83, 75, -80, 30, 81, 90, 88, -76, 4, 15, 3, 8, 7, +-70, -1, -16, 0, 0, -1, -8, 56, 56, 56, 56, 89, 1, 114, 113, 93, 43, 43, 43, 43, 43, 43, 35, 1, 51, +1, 35, 3, 33, 3, 19, 33, 3, 38, 39, 6, 7, 3, 2, 51, -47, 2, 88, -35, -85, -3, -101, -95, -39, 1, +-15, -103, 70, 34, 28, 51, 5, -70, -6, 70, 1, -68, -2, 68, 2, 90, 1, -106, -71, 119, -115, -117, 0, 0, 3, +0, -106, 0, 0, 4, -23, 5, -70, 0, 17, 0, 29, 0, 42, 1, 19, -71, 0, 4, -1, -12, 64, 71, 11, 11, +6, 85, 4, 4, 70, 35, 86, 35, 102, 35, 115, 9, -124, 9, 6, 105, 26, 117, 5, 112, 9, 115, 11, -125, 5, +-125, 11, 6, 39, 22, 9, 3, 24, 39, 42, 30, 22, 29, 9, 9, 19, 18, 30, 42, 42, 41, 41, 0, 28, 29, +30, 2, 1, 2, 31, 30, 30, 17, 0, 8, 24, 38, 6, 12, 16, 16, 2, 85, 6, -72, -1, -26, 64, 51, 15, +15, 2, 85, 6, 18, 13, 13, 2, 85, 6, 6, 12, 12, 2, 85, 6, 8, 11, 11, 6, 85, 6, 12, 12, 12, +6, 85, 6, 20, 13, 13, 6, 85, 6, 84, 37, 38, 12, 28, 16, 16, 2, 85, 12, 10, 13, 13, 2, 85, 12, +-72, -1, -12, 64, 21, 11, 11, 6, 85, 12, 26, 44, 29, 30, 32, 1, 32, 0, 1, 0, 32, 16, 16, 2, 85, +0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, +2, 85, 0, -72, -1, -6, -76, 12, 12, 6, 85, 0, -72, -1, -16, 64, 10, 13, 13, 6, 85, 0, 93, 43, 59, +92, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 93, 60, -3, 60, 78, 16, -10, 43, 43, 43, 77, -19, -12, 43, +43, 43, 43, 43, 43, 43, -19, 0, 63, 60, -3, 60, 63, 60, -3, 60, 18, 57, 47, 60, 16, -3, 60, 57, 47, +17, 57, 17, 18, 57, 1, 18, 23, 57, 49, 48, 1, 93, 0, 93, 43, 51, 17, 33, 50, 22, 22, 21, 20, 6, +7, 22, 22, 21, 20, 14, 2, 35, 1, 33, 50, 55, 54, 54, 53, 52, 38, 38, 35, 33, 17, 33, 50, 55, 62, +2, 53, 52, 38, 38, 35, 33, -106, 2, 38, -88, -53, 115, 102, 103, -123, -113, 87, -128, -63, -116, -2, -109, 1, 61, +-127, 56, 74, 75, 70, -126, -98, -2, -37, 1, 109, 94, 38, 67, 90, 58, 84, -107, -116, -2, -83, 5, -70, 89, -71, +101, 94, -90, 51, 39, -68, -128, 103, -79, 96, 49, 3, 82, 17, 22, 102, 77, 73, 111, 41, -5, -96, 7, 12, 56, +107, 70, 82, 121, 49, 0, 0, 1, 0, 102, -1, -25, 5, 118, 5, -45, 0, 29, 0, -45, -75, 99, 2, 106, 29, +2, 1, -72, -1, -24, -76, 11, 11, 6, 85, 0, -72, -1, -24, 64, 95, 11, 11, 6, 85, 32, 0, 50, 13, 99, +0, 112, 0, 116, 29, -128, 0, -124, 29, -112, 0, -102, 5, -85, 3, -91, 13, -71, 3, -76, 13, -57, 13, -48, 0, +-28, 29, -13, 29, 17, 14, 18, 29, 17, 29, 29, 3, 42, 6, 40, 17, 42, 28, 32, 31, 71, 13, 86, 20, 87, +21, 86, 25, 104, 5, 107, 29, 123, 18, -117, 18, -102, 3, -103, 14, -102, 28, -88, 1, -92, 2, -88, 17, -43, 14, +19, 0, 20, 0, 26, 16, 20, 16, 26, 4, 2, -72, -1, -34, -78, 40, 57, 1, -72, -1, -64, 64, 45, 40, 57, +16, 15, 0, 1, 4, 27, 19, 30, 12, 3, 27, 30, 4, 9, 16, 38, 15, 74, 0, 38, 32, 1, 1, 1, 26, +31, 23, 38, 32, 8, 1, 8, 12, 11, 11, 6, 85, 8, 25, 30, 99, 92, 24, 43, 78, 16, -12, 43, 93, 77, +-19, 78, 16, -10, 93, 77, -19, -12, -19, 0, 63, -19, 63, -19, 17, 23, 57, 49, 48, 1, 43, 43, 93, 93, 113, +0, 93, 43, 43, 1, 114, 1, 23, 6, 4, 35, 34, 36, 2, 53, 52, 18, 36, 51, 50, 4, 23, 7, 38, 38, +35, 34, 6, 2, 21, 20, 18, 22, 51, 50, 54, 4, -76, -62, 61, -2, -61, -27, -19, -2, -41, -101, -81, 1, 67, +-62, -36, 1, 44, 59, -65, 51, -62, -109, -87, -29, 92, 109, -26, -122, -93, -30, 2, 2, 49, -17, -5, -63, 1, 110, +-46, -27, 1, 85, -79, -32, -53, 45, -96, -110, -94, -2, -17, -111, -69, -2, -23, -118, -68, 0, 0, 2, 0, -98, 0, +0, 5, 90, 5, -70, 0, 15, 0, 29, 0, -27, 64, 47, 32, 31, 1, 67, 8, 28, 29, 30, 2, 1, 2, 17, +16, 30, 15, 0, 8, 23, 38, 32, 9, 1, 31, 64, 13, 13, 2, 85, 9, 32, 16, 16, 2, 85, 9, 10, 15, +15, 2, 85, 9, 24, 13, 13, 2, 85, 9, -72, -1, -12, 64, 21, 12, 12, 6, 85, 9, 26, 31, 29, 16, 32, +1, 32, 0, 1, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, +13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -9, -76, 12, 12, 6, 85, 0, -72, -1, -8, +64, 10, 13, 13, 6, 85, 0, 93, 30, 59, 92, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 93, 60, -3, 60, +16, -10, 43, 43, 43, 43, 43, 93, -19, 0, 63, 60, -3, 60, 63, 60, -3, 60, 49, 48, 67, 121, 64, 54, 3, +27, 7, 8, 6, 8, 5, 8, 4, 8, 4, 6, 25, 24, 26, 24, 2, 6, 11, 10, 12, 10, 13, 10, 3, 6, +21, 22, 20, 22, 19, 22, 3, 6, 27, 3, 23, 33, 1, 18, 14, 23, 33, 1, 24, 8, 28, 33, 1, 22, 10, +17, 33, 0, 43, 43, 1, 43, 43, 42, 42, 42, 42, -127, 1, 93, 51, 17, 33, 50, 23, 22, 23, 22, 18, 21, +20, 2, 14, 2, 35, 37, 33, 50, 54, 55, 54, 54, 53, 52, 38, 39, 38, 35, 33, -98, 1, -7, -85, 90, 126, +89, 116, 115, 78, 122, -111, -51, -123, -2, -79, 1, 57, -111, -91, 49, 69, 77, -105, 108, 78, -83, -2, -52, 5, -70, +21, 29, 76, 98, -2, -49, -60, -89, -2, -2, -87, 97, 50, -83, 54, 49, 69, -23, -90, -26, -9, 42, 30, 0, 1, +0, -94, 0, 0, 4, -24, 5, -70, 0, 11, 0, -107, 64, 21, 6, 5, 30, 8, 8, 7, 7, 0, 3, 4, 30, +2, 1, 2, 10, 9, 30, 11, 0, 8, 7, -72, -1, -64, 64, 29, 16, 18, 52, 7, 84, 3, 74, 32, 10, 32, +13, 2, 10, 26, 13, 4, 9, 32, 1, 32, 0, 1, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, +2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -6, -76, +12, 12, 6, 85, 0, -72, -1, -16, 64, 10, 13, 13, 6, 85, 0, 93, 12, 59, 91, 24, 43, 78, 16, -12, 43, +43, 43, 43, 43, 43, 93, 60, 77, -3, 60, 78, 16, -10, 93, 77, -12, -28, 43, 0, 63, 60, -3, 60, 63, 60, +-3, 60, 18, 57, 47, 60, 16, -3, 60, 49, 48, 51, 17, 33, 21, 33, 17, 33, 21, 33, 17, 33, 21, -94, 4, +36, -4, -98, 3, 43, -4, -43, 3, -124, 5, -70, -83, -2, 63, -84, -2, 13, -83, 0, 0, 1, 0, -88, 0, 0, +4, -123, 5, -70, 0, 9, 0, -115, 64, 43, 6, 5, 30, 8, 8, -113, 7, 1, 7, 7, 0, 3, 4, 30, 2, +1, 2, 0, 8, 7, -100, 32, 2, 32, 11, 2, 2, 26, 11, 4, 9, 32, 1, 32, 0, 1, 0, 32, 16, 16, +2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, 64, +11, 12, 12, 2, 85, 0, 12, 11, 11, 6, 85, 0, -72, -1, -2, -76, 12, 12, 6, 85, 0, -72, -1, -16, 64, +10, 13, 13, 6, 85, 0, 93, 10, 59, 92, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 93, 60, 77, +-3, 60, 78, 16, -10, 93, 77, -28, 0, 63, 63, 60, -3, 60, 18, 57, 47, 93, 60, 16, -3, 60, 49, 48, 51, +17, 33, 21, 33, 17, 33, 21, 33, 17, -88, 3, -35, -4, -27, 2, -80, -3, 80, 5, -70, -83, -2, 58, -83, -3, +102, 0, 1, 0, 109, -1, -25, 5, -71, 5, -45, 0, 37, 1, 19, 64, 26, 27, 20, 27, 21, 2, 96, 39, 1, +94, 8, 19, 1, 18, 3, 36, 36, 0, 33, 18, 23, 2, 37, 0, 30, 2, 1, -72, -1, -64, 64, 32, 12, 12, +6, 85, 1, 1, 6, 23, 30, 14, 3, 33, 30, 6, 9, 1, 1, 38, 39, 37, 36, 32, 3, 3, 32, 2, 32, +39, 96, 2, 3, 2, -72, -1, -28, -76, 15, 15, 2, 85, 2, -72, -1, -14, -76, 13, 13, 2, 85, 2, -72, -1, +-38, -76, 12, 12, 2, 85, 2, -72, -1, -12, 64, 27, 12, 12, 6, 85, 2, 114, -128, 39, 1, 39, 29, 38, 32, +10, 1, 10, 16, 12, 12, 6, 85, 10, 25, 38, 99, 91, 24, 43, 78, 16, -12, 43, 93, 77, -19, 77, 16, 93, +-10, 43, 43, 43, 43, 93, 60, 77, 16, -3, 60, 17, 18, 57, 47, 0, 63, -19, 63, -19, 18, 57, 47, 43, 60, +-3, 60, 17, 18, 57, 17, 18, 57, 1, 17, 18, 57, 18, 57, 49, 48, 67, 121, 64, 68, 4, 35, 27, 28, 26, +28, 25, 28, 3, 6, 12, 38, 16, 37, 21, 38, 31, 38, 8, 37, 4, 38, 35, 37, 24, 13, 29, 33, 0, 22, +15, 19, 33, 1, 17, 18, 20, 19, 32, 7, 29, 33, 0, 34, 5, 37, 33, 1, 28, 11, 23, 33, 1, 20, 17, +23, 33, 1, 30, 9, 33, 33, 0, 36, 3, 33, 33, 0, 0, 43, 43, 43, 43, 1, 43, 43, 16, 60, 16, 60, +43, 43, 43, 43, 43, 43, 43, 43, 43, 42, -127, 1, 93, 0, 93, 1, 53, 37, 17, 6, 4, 35, 34, 36, 2, +53, 52, 18, 36, 51, 50, 4, 22, 23, 7, 46, 2, 35, 34, 6, 6, 7, 6, 21, 20, 18, 4, 51, 50, 54, +55, 17, 3, 76, 2, 109, -113, -2, -48, -96, -40, -2, -97, -76, -77, 1, 80, -37, -97, 1, 1, -110, 38, -81, 33, +98, -74, 111, -123, -62, 119, 33, 56, -121, 1, 2, -111, 126, -16, 62, 2, 63, -84, 1, -3, -32, 114, 115, -71, 1, +94, -40, -42, 1, 115, -76, 103, -72, -108, 48, 112, -128, 77, 81, -124, 79, -120, -97, -60, -2, -8, -128, 97, 55, 1, +17, 0, 1, 0, -92, 0, 0, 5, 34, 5, -70, 0, 11, 0, -40, -71, 0, 13, -1, -64, 64, 26, 19, 21, 52, +4, 3, 30, 9, 10, -96, 10, -48, 10, 2, 10, 5, 2, 2, 11, 8, 8, 5, 8, 32, 7, 7, 6, -72, -1, +-18, -76, 15, 15, 2, 85, 6, -72, -1, -14, 64, 11, 13, 13, 2, 85, 6, 16, 12, 12, 2, 85, 6, -72, -1, +-32, 64, 24, 11, 11, 6, 85, 6, 1, 12, 12, 6, 85, 6, 93, -128, 13, 1, 13, 2, 11, 32, 1, 32, 0, +1, 0, -72, -1, -64, 64, 10, 19, 21, 52, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, +0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, 64, 11, 12, 12, 2, 85, 0, 8, 11, 11, 6, 85, +0, -72, -1, -9, -76, 12, 12, 6, 85, 0, -72, -1, -8, 64, 22, 13, 13, 6, 85, 0, 93, 12, 32, 13, 1, +32, 13, 80, 13, 96, 13, 112, 13, 4, 59, 89, 24, 43, 93, 113, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, +93, 60, -3, 60, 16, 93, -10, 43, 43, 43, 43, 43, 60, 16, -3, 60, 0, 63, 60, 63, 60, 57, 93, 47, 60, +-3, 60, 49, 48, 1, 43, 51, 17, 51, 17, 33, 17, 51, 17, 35, 17, 33, 17, -92, -62, 2, -6, -62, -62, -3, +6, 5, -70, -3, -90, 2, 90, -6, 70, 2, -77, -3, 77, 0, 1, 0, -65, 0, 0, 1, -127, 5, -70, 0, 3, +0, -52, -75, 1, 2, 0, 8, 2, 5, -72, -1, -64, -77, 56, 61, 52, 5, -72, -1, -64, -77, 51, 52, 52, 5, +-72, -1, -64, -77, 45, 48, 52, 5, -72, -1, -64, -77, 40, 41, 52, 5, -72, -1, -64, -77, 35, 37, 52, 5, -72, +-1, -64, -77, 29, 30, 52, 5, -72, -1, -64, -77, 24, 26, 52, 5, -72, -1, -64, 64, 42, 13, 16, 52, 32, 5, +-112, 5, -81, 5, 3, 3, 32, 1, 0, 0, -113, 0, -96, 0, -80, 0, 4, 47, 0, 64, 0, 80, 0, -33, 0, +-16, 0, 5, 18, 32, 0, -113, 0, -112, 0, 3, 5, -72, -1, -64, 64, 11, 13, 13, 2, 85, 0, 24, 16, 16, +2, 85, 0, -72, -1, -20, -76, 15, 15, 2, 85, 0, -72, -1, -18, -76, 13, 13, 2, 85, 0, -72, -1, -10, 64, +16, 12, 12, 2, 85, 0, 32, 11, 11, 6, 85, 0, -94, 4, -42, 89, 24, 43, 16, -10, 43, 43, 43, 43, 43, +43, 93, 67, 92, 88, -78, -128, 0, 1, 1, 93, 89, 113, 114, 60, -3, 93, 43, 43, 43, 43, 43, 43, 43, 43, +60, 0, 63, 63, 49, 48, 51, 17, 51, 17, -65, -62, 5, -70, -6, 70, 0, 1, 0, 55, -1, -25, 3, 97, 5, +-70, 0, 17, 0, -87, 64, 16, 101, 2, 103, 6, 116, 2, 117, 6, -120, 13, -120, 17, 6, 9, 2, 1, -72, -1, +-64, -76, 11, 12, 6, 85, 1, -72, 1, 26, 64, 11, 4, 30, 15, 9, 9, 38, 10, 10, 8, 38, 11, -72, -1, +-22, -76, 16, 16, 2, 85, 11, -72, -1, -22, -76, 13, 13, 2, 85, 11, -72, -1, -2, -76, 12, 12, 2, 85, 11, +-72, -1, -24, -76, 11, 11, 6, 85, 11, -72, -1, -2, 64, 22, 12, 12, 6, 85, 11, 93, 32, 19, 1, 32, 19, +64, 19, 80, 19, 96, 19, 4, 19, 1, 38, 0, -72, -1, -24, -76, 12, 12, 2, 85, 0, -72, -1, -22, -76, 12, +12, 6, 85, 0, -72, -1, -36, 64, 10, 13, 13, 6, 85, 0, 75, 18, -74, 89, 24, 43, 16, -10, 43, 43, 43, +-19, 16, 93, 113, -10, 43, 43, 43, 43, 43, -19, 60, 16, -19, 0, 63, -19, -19, 43, 63, 49, 48, 0, 93, 19, +55, 22, 22, 51, 50, 54, 54, 53, 17, 51, 17, 20, 6, 6, 35, 34, 38, 59, -81, 7, 112, 99, 73, 106, 40, +-62, 89, -63, -126, -63, -51, 1, -96, 24, -88, 124, 67, 115, 126, 3, -14, -4, 25, -72, -54, 106, -34, 0, 0, 1, +0, -106, 0, 0, 5, 82, 5, -70, 0, 11, 1, -2, 64, 30, 3, 34, 55, 57, 8, 9, 58, 39, 10, 53, 6, +54, 10, 71, 10, 87, 3, -122, 3, -41, 3, 7, 118, 10, -39, 3, -39, 10, 3, 6, -72, -1, -12, 64, 24, 13, +13, 2, 85, 40, 5, -116, 4, -118, 5, -86, 4, -22, 8, 5, 10, 4, 1, 53, 4, -42, 4, 2, 9, -72, -1, +-32, 64, 9, 18, 33, 52, 3, 32, 18, 33, 52, 3, -72, -1, -34, -77, 12, 57, 18, 9, -72, -1, -32, -77, 18, +33, 52, 8, -72, -1, -32, -77, 18, 33, 52, 4, -72, -1, -32, -77, 29, 33, 52, 4, -72, -1, -64, -77, 18, 22, +52, 8, -72, -1, -34, 64, 61, 25, 57, 8, 9, 37, 37, 61, 8, 9, 25, 25, 61, 6, 6, 7, 9, 10, 9, +8, 10, 5, 3, 4, 4, 32, 5, 10, 20, 5, 5, 10, 9, 8, 8, 32, 7, 6, 20, 7, 7, 6, 10, 10, +0, 5, 2, 4, 1, 2, 7, 11, 8, 0, 8, 10, 3, 2, 11, 1, 0, 4, -72, 2, 58, 64, 15, 48, 5, +1, -96, 5, -80, 5, -64, 5, -32, 5, 4, 5, 74, 8, -72, 2, 58, 64, 11, 48, 7, 1, 32, 7, -128, 7, +-80, 7, 3, 7, -72, 2, -122, 64, 12, 11, 32, 32, 0, 1, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, +15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, +-6, -76, 12, 12, 6, 85, 0, -72, -1, -14, 64, 10, 13, 13, 6, 85, 0, 93, 12, 59, -88, 24, 43, 16, -12, +43, 43, 43, 43, 43, 43, 93, -19, -3, 93, 113, -19, -12, 93, 113, -19, 16, 60, 16, 60, 60, 60, 0, 63, 60, +60, 60, 63, 60, 60, 60, 18, 57, 47, -121, 5, 46, 43, 14, 125, 16, -60, -121, 5, 46, 24, 43, 4, 125, 16, +-60, 7, 8, 16, 60, 8, 60, 1, 75, -80, 24, 83, 75, -80, 27, 81, 90, 88, -71, 0, 4, -1, -40, 56, 89, +-79, 6, 2, 67, 84, 88, -71, 0, 4, -1, -16, -77, 12, 17, 52, 3, -72, -1, -16, 64, 23, 12, 17, 52, 6, +16, 14, 17, 52, 8, 16, 14, 16, 52, 9, 16, 14, 17, 52, 10, 16, 13, 16, 52, 0, 43, 43, 43, 43, 43, +43, 89, 49, 48, 1, 43, 43, 43, 43, 43, 43, 43, 67, 92, 88, 64, 17, 9, 34, 25, 57, 8, 44, 25, 57, +4, 44, 25, 57, 4, 34, 27, 57, 5, -72, -1, -34, -74, 22, 57, 4, 34, 22, 57, 6, -72, -1, -34, 64, 11, +18, 57, 8, 34, 20, 57, 4, 64, 20, 57, 8, -72, -1, -34, -75, 37, 57, 4, 64, 21, 57, 43, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 89, 0, 43, 43, 43, 1, 113, 114, 93, 43, 0, 113, 93, 43, 43, 51, 17, 51, +17, 1, 33, 1, 1, 33, 1, 7, 17, -106, -62, 2, -40, 1, 7, -3, -103, 2, -126, -1, 0, -3, -10, -16, 5, +-70, -3, 41, 2, -41, -3, -82, -4, -104, 2, -26, -22, -2, 4, 0, 1, 0, -106, 0, 0, 4, 42, 5, -70, 0, +5, 0, 109, 64, 12, 1, 2, 4, 3, 30, 5, 0, 8, 32, 4, 1, 4, -72, 2, -89, 64, 15, 7, 2, 3, +32, 1, 32, 0, 1, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, +13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -10, -76, 12, 12, 6, 85, 0, -72, -1, +-8, 64, 10, 13, 13, 6, 85, 0, 93, 6, 59, 92, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 93, 60, -3, +60, 16, -26, 93, 0, 63, 60, -3, 60, 63, 49, 48, 51, 17, 51, 17, 33, 21, -106, -62, 2, -46, 5, -70, -6, +-13, -83, 0, 1, 0, -104, 0, 0, 6, 15, 5, -70, 0, 16, 2, -28, -79, 2, 2, 67, 84, 88, -71, 0, 8, +-1, -10, 64, 11, 12, 12, 2, 85, 8, 14, 13, 17, 2, 85, 2, -72, -1, -18, -76, 13, 17, 2, 85, 5, -72, +-1, -18, 64, 40, 13, 17, 2, 85, 12, 18, 12, 12, 2, 85, 5, 15, 12, 3, 9, 0, 1, 2, 8, 9, 11, +14, 0, 8, 9, 2, 10, 11, 6, 16, 16, 2, 85, 11, 16, 13, 13, 2, 85, 11, -72, -1, -6, -74, 12, 12, +2, 85, 11, 16, 0, -72, -1, -26, -76, 16, 16, 2, 85, 0, -72, -1, -8, -76, 15, 15, 2, 85, 0, -72, -1, +-4, -76, 13, 13, 2, 85, 0, 47, 43, 43, 43, -51, 47, 43, 43, 43, -51, 0, 63, 63, -64, -64, 16, -48, -48, +-64, 17, 18, 23, 57, 43, 43, 49, 48, 1, 43, 43, 43, 0, 27, -79, 6, 2, 67, 84, 88, 64, 31, 7, 32, +11, 11, 6, 85, 6, 32, 11, 11, 6, 85, 3, 32, 11, 11, 6, 85, 4, 32, 11, 11, 6, 85, 5, 32, 11, +11, 6, 85, 8, -72, -1, -14, 64, 35, 11, 11, 6, 85, 2, 12, 11, 11, 6, 85, 3, 6, 12, 12, 6, 85, +2, 14, 12, 12, 6, 85, 9, 12, 12, 12, 6, 85, 10, 12, 12, 12, 6, 85, 7, -72, -1, -8, -76, 13, 13, +6, 85, 8, -72, -1, -8, 64, 31, 13, 13, 6, 85, 38, 5, 1, 12, 32, 10, 18, 52, 15, 32, 10, 18, 52, +15, 5, 12, 3, 0, 1, 14, 11, 0, 8, 8, 1, 2, 10, -72, -1, -18, -76, 11, 11, 6, 85, 10, -72, -1, +-18, -76, 12, 12, 6, 85, 10, -69, 2, 86, 0, 18, 0, 16, 2, 86, 64, 13, 0, 12, 11, 11, 6, 85, 0, +6, 12, 12, 6, 85, 0, -72, -1, -8, -76, 13, 13, 6, 85, 0, 1, 47, 43, 43, 43, -12, 47, -12, 43, 43, +0, 63, 60, 63, 60, 60, 17, 18, 23, 57, 43, 43, 93, 49, 48, 1, 43, 43, 43, 43, 43, 43, 43, 43, 0, +43, 43, 43, 43, 43, 27, 64, 127, 0, 2, 15, 8, 20, 2, 27, 8, 4, 118, 12, -122, 12, -56, 12, 3, 9, +12, 73, 12, 73, 15, 3, 41, 4, 37, 13, 44, 14, 88, 3, 91, 4, 118, 13, 120, 14, -121, 13, 8, 11, 2, +5, 8, 57, 13, 54, 14, 79, 2, 75, 3, 68, 7, 64, 8, 77, 13, 66, 14, 10, -104, 2, -103, 3, -106, 7, +-106, 8, -88, 3, -89, 7, 6, 18, 2, 15, 14, 14, 48, 5, 2, 20, 5, 5, 2, 8, 12, 13, 13, 48, 5, +8, 20, 5, 5, 8, 12, 82, 15, 82, 1, 64, 1, 2, 2, 8, 8, 9, 10, 11, 11, 13, 13, 14, 14, 16, +0, 8, 9, 2, 96, 18, -128, 18, 2, 18, -70, 2, -88, 0, 13, 1, 49, -78, 5, 32, 8, -72, 1, 49, 64, +10, 12, 9, 10, 32, 64, 12, 127, 11, 1, 11, -70, 2, 86, 0, 14, 1, 11, -78, 5, 32, 2, -72, 1, 11, +64, 9, 15, 1, 0, 32, 15, 112, 16, 1, 16, -72, 2, 86, -73, 32, 5, 96, 5, -128, 5, 3, 5, -72, 2, +-88, -77, 17, 59, 89, 24, 43, 25, 16, -12, 93, -12, 93, 60, 24, -3, 60, 16, -19, 26, 25, 16, -19, -12, 93, +60, 26, 24, -3, 60, 16, -19, 26, 25, 16, -19, -28, 93, 0, 24, 63, 63, 60, 60, 16, 60, 16, 60, 16, 60, +16, 60, 16, 60, 16, 60, 26, 16, -19, -19, -121, 5, 46, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, -60, 49, +48, 0, 75, -80, 11, 83, 75, -80, 30, 81, 90, 88, -67, 0, 12, -1, -5, 0, 8, -1, -42, 0, 2, -1, -42, +56, 56, 56, 89, 1, 75, -80, 12, 83, 75, -80, 40, 81, 90, 88, -71, 0, 13, -1, -8, -79, 14, 10, 56, 56, +89, 1, 67, 92, 88, -71, 0, 13, -1, -44, -74, 33, 57, 14, 44, 33, 57, 13, -72, -1, -44, -74, 55, 57, 14, +50, 55, 57, 13, -72, -1, -44, -75, 45, 57, 14, 44, 45, 57, 43, 43, 43, 43, 43, 43, 89, 114, 113, 93, 0, +113, 93, 1, 93, 89, 89, 51, 17, 33, 1, 22, 23, 54, 55, 1, 33, 17, 35, 17, 1, 35, 1, 17, -104, 1, +36, 1, 91, 48, 22, 25, 53, 1, 95, 1, 5, -69, -2, 86, -81, -2, 88, 5, -70, -5, -14, -111, 72, 80, -101, +3, -4, -6, 70, 4, -53, -5, 53, 4, -32, -5, 32, 0, 1, 0, -100, 0, 0, 5, 31, 5, -70, 0, 9, 1, +125, -79, 18, 11, -72, -1, -64, 64, 10, 19, 21, 52, 8, 24, 12, 22, 2, 85, 3, -72, -1, -24, 64, 33, 12, +22, 2, 85, 8, 2, 3, 3, 32, 7, 8, 20, 7, 7, 8, 2, 7, 3, 3, 8, 9, 4, 2, 2, 9, 7, +8, 4, 3, 32, 6, 6, 5, -72, -1, -20, -76, 15, 15, 2, 85, 5, -72, -1, -14, 64, 11, 13, 13, 2, 85, +5, 18, 12, 12, 2, 85, 5, -72, -1, -9, 64, 26, 11, 11, 6, 85, 5, 93, 32, 11, 1, 32, 11, 80, 11, +96, 11, 112, 11, -128, 11, 5, 11, 8, 9, 32, 1, 0, -72, -1, -64, 64, 13, 19, 21, 52, 32, 0, 1, 0, +32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, +-1, -6, 64, 11, 12, 12, 2, 85, 0, 4, 11, 11, 6, 85, 0, -72, -1, -9, -76, 12, 12, 6, 85, 0, -72, +-1, -8, 64, 10, 13, 13, 6, 85, 0, 93, 10, 59, 89, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 93, +43, 60, -3, 60, 16, 93, 113, -12, 43, 43, 43, 43, 60, 16, -3, 60, 0, 63, 60, 63, 60, 18, 57, 57, 1, +17, 57, 57, -121, 4, 46, 43, -121, 125, -60, -79, 6, 2, 67, 84, 88, -71, 0, 3, -1, -32, -73, 12, 17, 52, +8, 32, 12, 17, 52, 0, 43, 43, 89, 49, 48, 43, 43, 1, 43, 67, 92, 88, -76, 8, 64, 70, 57, 3, -72, +-1, -64, -74, 70, 57, 8, 64, 50, 57, 3, -72, -1, -64, -74, 50, 57, 7, 34, 25, 57, 2, -72, -1, -34, -74, +25, 57, 7, 34, 50, 57, 2, -72, -1, -34, -74, 50, 57, 7, 34, 35, 57, 2, -72, -1, -34, 64, 11, 35, 57, +7, 14, 20, 57, 7, 14, 19, 57, 2, -72, -1, -12, -74, 19, 57, 7, 14, 29, 57, 2, -72, -1, -12, -74, 29, +57, 7, 14, 21, 57, 2, -72, -1, -8, -79, 21, 57, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, +43, 0, 43, 43, 43, 43, 89, 51, 17, 51, 1, 17, 51, 17, 35, 1, 17, -100, -57, 3, 2, -70, -57, -4, -2, +5, -70, -5, -127, 4, 127, -6, 70, 4, -128, -5, -128, 0, 0, 2, 0, 99, -1, -25, 5, -35, 5, -44, 0, 14, +0, 27, 0, -54, 64, 80, 26, 15, 1, 20, 16, 20, 20, 27, 23, 27, 27, 4, 4, 16, 4, 20, 11, 23, 11, +27, 4, -87, 23, -74, 14, -58, 14, 3, 23, 23, 24, 27, 2, 32, 29, 64, 17, 79, 19, 79, 23, 64, 26, 88, +5, 88, 9, 87, 16, 85, 17, 95, 19, 90, 23, 95, 24, 86, 26, 87, 27, -117, 23, -103, 2, 16, 25, 30, 3, +3, 18, 30, 11, 9, 21, 38, 32, 7, 1, 7, -72, -1, -24, -76, 16, 16, 2, 85, 7, -72, -1, -18, -76, 13, +13, 2, 85, 7, -72, -1, -16, -76, 12, 12, 2, 85, 7, -72, -1, -22, -76, 11, 11, 6, 85, 7, -72, -1, -12, +-76, 13, 13, 6, 85, 7, -72, -1, -6, 64, 33, 12, 12, 6, 85, 7, 26, -128, 29, 1, 29, 15, 38, 32, 0, +1, 0, 6, 11, 11, 6, 85, 0, 6, 12, 12, 6, 85, 0, 25, 28, 99, 92, 24, 43, 78, 16, -12, 43, 43, +93, 77, -19, 78, 16, 93, -10, 43, 43, 43, 43, 43, 43, 93, 77, -19, 0, 63, -19, 63, -19, 49, 48, 1, 93, +113, 0, 93, 93, 93, 113, 19, 16, 0, 33, 50, 4, 18, 21, 20, 2, 4, 35, 34, 36, 2, 55, 16, 0, 51, +50, 0, 17, 52, 2, 38, 35, 34, 0, 99, 1, -120, 1, 54, -53, 1, 70, -85, -76, -2, -74, -65, -49, -2, -70, +-88, -56, 1, 29, -41, -37, 1, 27, 121, -23, -111, -50, -2, -41, 2, -54, 1, 109, 1, -99, -62, -2, -91, -36, -33, +-2, -96, -75, -56, 1, 90, -66, -2, -9, -2, -49, 1, 52, 1, 27, -77, 1, 11, -109, -2, -27, 0, 2, 0, -98, +0, 0, 4, -3, 5, -70, 0, 13, 0, 24, 0, -78, 64, 44, 101, 17, 107, 20, 2, 75, 16, 75, 20, 91, 16, +91, 20, 4, 11, 12, 30, 15, 14, 14, 0, 23, 24, 30, 2, 1, 2, 0, 8, 18, 38, 8, 10, 13, 13, 2, +85, 8, 16, 11, 11, 6, 85, 8, -72, -1, -12, 64, 27, 12, 12, 6, 85, 8, 26, 32, 26, 1, 32, 26, 1, +26, 24, 13, 32, 1, 32, 0, 1, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, +-1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, 64, 11, 12, 12, 2, 85, 0, 12, 11, 11, 6, 85, 0, -72, +-1, -6, -76, 12, 12, 6, 85, 0, -72, -1, -16, 64, 10, 13, 13, 6, 85, 0, 93, 25, 59, 92, 24, 43, 16, +-10, 43, 43, 43, 43, 43, 43, 43, 93, 60, -3, 60, 78, 16, 113, 93, -10, 43, 43, 43, 77, -19, 0, 63, 63, +60, -3, 60, 18, 57, 47, 60, -3, 60, 49, 48, 1, 93, 0, 93, 51, 17, 33, 50, 23, 30, 2, 21, 20, 2, +33, 33, 17, 17, 33, 50, 54, 53, 52, 38, 39, 38, 35, 33, -98, 2, 41, -110, 77, 108, -110, 89, -18, -2, -55, +-2, -120, 1, 123, -68, -98, 93, 76, 49, -124, -2, -119, 5, -70, 14, 18, 101, -74, 109, -69, -2, -3, -3, -84, 3, +1, -116, 127, 92, -125, 21, 13, 0, 0, 2, 0, 88, -1, -114, 5, -18, 5, -44, 0, 21, 0, 40, 1, 104, 64, +-107, 95, 38, -97, 38, 2, 25, 24, 55, 21, 2, 11, 28, 4, 31, 4, 35, 27, 28, 20, 31, 20, 35, 6, 42, +5, 45, 23, 43, 38, 59, 5, 60, 23, 58, 38, 76, 5, 76, 23, 73, 38, 93, 5, 85, 35, 88, 38, 111, 5, +123, 3, 122, 5, -116, 3, -116, 5, -107, 0, -102, 3, -92, 0, -85, 3, -43, 0, -43, 22, -27, 0, -27, 23, -27, +24, 26, 28, 5, 43, 0, 42, 5, 59, 5, 4, 93, 5, -110, 24, -106, 38, -43, 38, 4, 37, 22, 42, 38, 52, +22, 57, 38, 73, 24, 73, 28, 69, 31, 69, 35, 75, 38, 86, 8, 88, 17, 85, 21, 90, 28, 90, 29, 86, 31, +87, 32, 87, 34, 105, 5, 102, 21, 107, 38, 123, 38, -114, 28, -114, 38, -37, 24, -36, 38, 25, 11, 24, 1, 21, +-72, -1, -44, -78, 27, 57, 0, -72, -1, -44, 64, 56, 27, 57, 4, 24, 20, 24, 42, 5, 58, 5, 4, 2, 3, +22, 40, 3, 7, 40, 38, 24, 22, 5, 0, 6, 33, 3, 19, 26, 5, 2, 40, 38, 24, 22, 0, 5, 36, 30, +30, 15, 3, 2, 8, 36, 30, 7, 9, 26, 38, 19, 24, 15, 15, 2, 85, 19, -72, -1, -18, -76, 13, 13, 2, +85, 19, -72, -1, -24, -76, 12, 12, 2, 85, 19, -72, -1, -16, -76, 11, 11, 6, 85, 19, -72, -1, -12, -76, 13, +13, 6, 85, 19, -72, -1, -12, 64, 37, 12, 12, 6, 85, 19, 74, 2, 26, 32, 42, -128, 42, 2, 42, 33, 38, +32, 11, 1, 11, 24, 11, 11, 6, 85, 11, 6, 12, 12, 6, 85, 11, 25, 41, 99, 92, 24, 43, 78, 16, -12, +43, 43, 93, 77, -19, 78, 16, 93, -10, 77, -12, 43, 43, 43, 43, 43, 43, -19, 0, 63, -19, 63, 63, -19, 17, +23, 57, 18, 57, 1, 17, 18, 57, 18, 23, 57, 0, 17, 51, 16, -55, 16, -55, 93, 49, 48, 1, 43, 43, 93, +93, 0, 114, 113, 93, 1, 93, 113, 114, 37, 22, 23, 7, 38, 39, 6, 35, 34, 36, 2, 53, 52, 18, 36, 51, +50, 4, 18, 21, 20, 2, 37, 22, 23, 54, 17, 52, 2, 38, 35, 34, 0, 17, 16, 0, 51, 50, 55, 38, 39, +4, -11, -121, 114, 57, -98, -99, -93, -59, -57, -2, -68, -81, -80, 1, 69, -55, -53, 1, 70, -85, 110, -3, -26, -88, +109, -85, 121, -23, -111, -39, -2, -30, 1, 27, -36, 104, 92, 91, 101, -99, 93, 43, -121, 57, 123, 91, -64, 1, 92, +-38, -39, 1, 100, -70, -63, -2, -91, -38, -75, -2, -33, -115, 47, 93, -100, 1, 57, -78, 1, 10, -109, -2, -41, -2, +-39, -2, -30, -2, -50, 39, 59, 25, 0, 2, 0, -95, 0, 0, 5, -83, 5, -70, 0, 24, 0, 34, 1, -4, 64, +33, 18, 11, 14, 1, 18, 54, 28, 90, 31, 102, 8, 109, 31, 4, 9, 16, 13, 13, 6, 85, 8, 16, 13, 13, +6, 85, 7, 16, 13, 13, 6, 85, 36, -72, -1, -64, -76, 12, 12, 2, 85, 13, -72, -1, -12, -76, 12, 12, 2, +85, 12, -72, -1, -12, -76, 12, 12, 2, 85, 11, -72, -1, -12, -76, 12, 12, 2, 85, 18, -72, -1, -30, -77, 18, +26, 52, 18, -72, -1, -16, -77, 34, 39, 52, 17, -72, -1, -30, -77, 29, 39, 52, 16, -72, -1, -30, -77, 29, 39, +52, 15, -72, -1, -30, -77, 29, 39, 52, 18, -72, -1, -40, -77, 29, 38, 52, 17, -72, -1, -30, -77, 18, 26, 52, +16, -72, -1, -30, -77, 18, 26, 52, 15, -72, -1, -30, 64, 73, 18, 26, 52, 37, 14, 74, 28, 74, 32, 83, 11, +92, 28, 109, 28, 114, 9, 120, 14, 121, 15, -123, 10, -120, 15, -105, 13, -87, 15, -72, 15, -24, 14, -25, 15, 16, +14, 12, 12, 32, 17, 15, 20, 17, 17, 15, 17, 15, 12, 9, 18, 27, 2, 33, 26, 22, 10, 6, 18, 17, 16, +13, 12, 5, 24, 9, 9, 22, 23, 26, 25, 30, 23, -72, -1, -64, 64, 25, 11, 11, 6, 85, 23, 23, 0, 33, +34, 30, 2, 1, 2, 0, 24, 24, 15, 15, 14, 8, 30, 38, 14, -100, 6, -72, -1, -24, -76, 15, 15, 2, 85, +6, -72, -1, -10, -76, 13, 13, 2, 85, 6, -72, -1, -32, 64, 34, 12, 12, 2, 85, 6, 6, 13, 13, 6, 85, +6, 93, 32, 36, 112, 36, -128, 36, 3, 36, 34, 24, 32, 1, 32, 0, 1, 0, 32, 16, 16, 2, 85, 0, -72, +-1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, 64, 11, 12, 12, 2, +85, 0, 6, 11, 11, 6, 85, 0, -72, -1, -9, -76, 12, 12, 6, 85, 0, -72, -1, -8, 64, 10, 13, 13, 6, +85, 0, 93, 35, 59, -88, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 93, 60, 77, -3, 60, 16, 93, +-10, 43, 43, 43, 43, 25, -28, 24, -19, 0, 63, 60, 16, 60, 16, 60, 63, 60, -3, 60, 18, 57, 47, 43, -3, +60, 16, 60, 57, 47, 18, 23, 57, 1, 17, 23, 57, -121, 14, 46, 43, 5, 125, 16, -60, 49, 48, 1, 93, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 43, 43, 43, 93, 67, 92, 88, 64, 10, 8, 64, 15, +57, 15, 16, 58, 17, 18, 58, 43, 43, 43, 89, 1, 113, 67, 92, 88, -71, 0, 14, -1, -34, 64, 26, 25, 57, +17, 34, 25, 57, 18, 34, 25, 57, 14, 64, 28, 57, 16, 34, 20, 57, 16, 34, 31, 57, 16, 34, 21, 57, 43, +43, 43, 43, 43, 43, 43, 89, 51, 17, 33, 50, 22, 22, 21, 20, 6, 7, 22, 23, 22, 23, 19, 35, 3, 46, +2, 39, 38, 35, 35, 17, 17, 33, 50, 54, 54, 53, 52, 38, 35, 33, -95, 2, -118, -60, -52, 122, -54, -45, 77, +40, 85, 76, -1, -12, -62, 85, 110, 87, 45, 33, 75, -31, 1, -95, -123, -106, 78, -105, -93, -2, 48, 5, -70, 79, +-56, 121, -100, -42, 29, 37, 36, 78, 117, -2, 113, 1, 49, -124, -116, 56, 11, 7, -3, 117, 3, 51, 55, 121, 71, +104, -122, 0, 0, 1, 0, 92, -1, -25, 4, -21, 5, -45, 0, 48, 2, 21, 64, 39, 99, 3, 99, 4, 115, 3, +116, 4, 4, 37, 39, 53, 3, 57, 28, 67, 3, 73, 7, 76, 29, 69, 31, 68, 36, 70, 39, 83, 3, 89, 7, +92, 29, 87, 40, -119, 19, 14, 35, -72, -1, -14, -76, 16, 16, 2, 85, 36, -72, -1, -14, -76, 16, 16, 2, 85, +37, -72, -1, -14, -76, 16, 16, 2, 85, 38, -72, -1, -14, -76, 16, 16, 2, 85, 39, -72, -1, -14, -76, 16, 16, +2, 85, 35, -72, -1, -10, -76, 13, 16, 2, 85, 36, -72, -1, -10, -76, 13, 16, 2, 85, 37, -72, -1, -10, -76, +13, 16, 2, 85, 38, -72, -1, -10, -76, 13, 16, 2, 85, 39, -72, -1, -10, 64, 70, 13, 16, 2, 85, 40, 13, +38, 36, 2, 36, 3, 39, 37, 54, 15, 52, 35, 68, 37, 69, 47, 90, 32, 86, 35, 85, 37, 108, 11, 106, 13, +107, 14, 102, 20, 101, 24, 121, 11, 122, 13, 122, 15, 125, 16, 117, 36, 115, 37, -122, 3, -118, 11, -119, 13, -118, +15, -115, 16, -123, 36, -125, 37, -110, 13, -106, 15, -106, 21, 30, -79, 6, 2, 67, 84, 88, 64, 45, 33, 38, 18, +27, 38, 26, 9, 38, 41, 1, 38, 0, 0, 41, 26, 18, 4, 50, 49, 38, 0, 101, 0, 2, 0, 13, 45, 121, +27, -119, 27, 2, 27, 37, 22, 13, 45, 30, 39, 37, 1, 37, 5, 22, 5, -72, -1, -12, 64, 12, 12, 12, 6, +85, 5, 30, 45, 9, 30, 30, 22, 3, 0, 63, -19, 63, -19, 43, 17, 18, 57, 93, 17, 18, 57, 17, 18, 57, +93, 17, 18, 57, 93, 1, 17, 18, 23, 57, 47, -19, 47, -19, 47, -19, 47, -19, 27, 64, 45, 37, 36, 14, 13, +11, 5, 33, 28, 29, 30, 27, 8, 7, 6, 4, 3, 2, 6, 1, 37, 36, 34, 14, 13, 11, 6, 5, 30, 27, +45, 26, 64, 12, 12, 2, 85, -113, 26, 1, 26, -19, 22, 0, 45, 1, -72, -1, -64, 64, 18, 12, 12, 2, 85, +16, 1, 32, 1, 80, 1, 96, 1, 112, 1, -112, 1, 6, 1, -72, 1, -80, 64, 19, 45, 30, 30, 22, 3, 5, +30, 45, 9, 27, 38, 26, 74, 9, 38, 0, 41, 1, 41, -72, -1, -22, -76, 14, 14, 2, 85, 41, -72, -1, -12, +64, 13, 12, 12, 2, 85, 41, 26, 50, 33, 38, 18, 1, 38, 18, -72, -1, -20, -76, 14, 14, 2, 85, 18, -72, +-1, -10, -76, 13, 13, 2, 85, 18, -72, -1, -8, 64, 15, 12, 12, 2, 85, 18, 84, 32, 0, 1, 0, 25, 49, +99, 91, 24, 43, 78, 16, -12, 93, 77, -28, 43, 43, 43, -19, 16, -19, 78, 16, -10, 43, 43, 93, 77, -19, -12, +-19, 0, 63, -19, 63, -19, 16, -3, 93, 43, -28, 16, -3, 93, 43, -12, 17, 18, 23, 57, 17, 23, 57, 17, 18, +57, 57, 1, 18, 23, 57, 89, 49, 48, 0, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 93, 113, +19, 55, 30, 2, 51, 50, 54, 54, 53, 52, 38, 39, 38, 36, 39, 38, 38, 53, 52, 54, 54, 51, 50, 22, 22, +23, 7, 38, 38, 35, 34, 6, 21, 20, 23, 22, 4, 23, 22, 22, 21, 20, 6, 6, 35, 34, 36, 38, 92, -73, +13, 95, -56, 125, 111, -86, 83, 80, 92, 59, -2, 108, 81, 105, 103, 126, -14, -108, -93, -7, -122, 5, -70, 15, -83, +-87, -80, -95, 57, 56, 1, -39, 88, -128, 122, -122, -5, -99, -57, -2, -13, -103, 1, -41, 16, 110, -115, 87, 66, 115, +68, 69, 103, 35, 23, 97, 43, 55, -93, 101, 111, -63, 100, 105, -52, -127, 14, -117, -114, -127, 91, 79, 51, 51, 107, +40, 59, -75, 118, 117, -49, 115, 116, -23, 0, 0, 1, 0, 48, 0, 0, 4, -70, 5, -70, 0, 7, 0, -119, 64, +13, 5, 2, 30, 4, 3, 2, 0, 8, 7, 6, 5, 4, 9, -72, 2, 115, -77, 32, 4, 1, 4, -72, 1, 1, +-73, 6, 32, 1, 2, 47, 3, 1, 3, -72, 1, 1, -75, 1, 1, 32, 0, 1, 0, -72, -1, -24, 64, 11, 16, +16, 2, 85, 0, 8, 15, 15, 2, 85, 0, -72, -1, -14, -76, 12, 12, 2, 85, 0, -72, -1, -30, -76, 13, 13, +2, 85, 0, -72, -1, -4, -76, 12, 12, 6, 85, 0, -72, -1, -2, -76, 13, 13, 6, 85, 0, -72, 2, 115, -77, +8, -74, -103, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 93, 60, 16, -12, 93, 60, 16, -3, -28, 93, -26, 16, +60, 16, 60, 0, 63, 63, 60, -3, 60, 49, 48, 33, 17, 33, 53, 33, 21, 33, 17, 2, 19, -2, 29, 4, -118, +-2, 27, 5, 13, -83, -83, -6, -13, 0, 0, 1, 0, -95, -1, -25, 5, 34, 5, -70, 0, 20, 0, -39, 64, 10, +38, 15, 88, 4, 88, 8, -55, 8, 4, 22, -72, -1, -64, 64, 22, 19, 21, 52, 52, 4, 59, 8, 70, 4, 74, +8, 118, 15, -90, 5, -24, 15, 7, 12, 0, 2, 17, -72, 2, -69, -76, 6, 9, 20, 38, 2, -72, -1, -20, -76, +15, 15, 2, 85, 2, -72, -1, -14, 64, 11, 13, 13, 2, 85, 2, 16, 12, 12, 2, 85, 2, -72, -1, -32, 64, +28, 11, 11, 6, 85, 2, 93, 32, 22, 1, 32, 22, 80, 22, 2, 96, 22, 112, 22, -128, 22, 3, 22, 13, 38, +32, 10, 1, 10, -72, -1, -64, 64, 10, 19, 21, 52, 10, 32, 16, 16, 2, 85, 10, -72, -1, -10, -76, 15, 15, +2, 85, 10, -72, -1, -10, -76, 13, 13, 2, 85, 10, -72, -1, -6, 64, 11, 12, 12, 2, 85, 10, 4, 11, 11, +6, 85, 10, -72, -1, -9, -76, 12, 12, 6, 85, 10, -72, -1, -8, 64, 10, 13, 13, 6, 85, 10, 93, 21, 59, +89, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 43, 93, -19, 77, 16, 93, 93, 113, -10, 43, 43, 43, +43, 77, -19, 0, 63, -19, 63, 60, 49, 48, 1, 93, 43, 0, 93, 1, 51, 17, 20, 2, 4, 35, 34, 36, 2, +53, 17, 51, 17, 20, 22, 22, 51, 50, 54, 17, 4, 96, -62, 100, -2, -5, -44, -50, -2, -6, 112, -62, 71, -83, +125, -42, -74, 5, -70, -4, -79, -35, -2, -4, -93, -114, 1, 13, -23, 3, 79, -4, -78, -65, -75, 98, -62, 1, 20, +0, 0, 1, 0, 9, 0, 0, 5, 70, 5, -70, 0, 10, 1, 62, -79, 2, 2, 67, 84, 88, 64, 18, 5, 1, +0, 8, 2, 1, 2, 0, 8, 10, 0, 5, 9, 8, 5, 1, 2, 5, 47, -35, -51, 16, -35, -51, 17, 51, 51, +0, 63, 63, 63, 17, 18, 57, 49, 48, 27, 64, 36, 47, 5, 1, 42, 0, 40, 3, 37, 10, 47, 12, 48, 12, +96, 12, -119, 8, -119, 9, -112, 12, -64, 12, -16, 12, 11, 32, 12, 80, 12, 2, 4, 2, 11, 8, 2, -79, 6, +2, 67, 84, 88, -73, 9, 1, 12, 11, 0, 8, 1, 2, 0, 63, 63, 1, 17, 18, 57, 57, 27, 64, 36, 10, +9, 9, 32, 8, 5, 20, 8, 8, 5, 0, 1, 1, 32, 2, 5, 20, 2, 2, 5, 9, 1, 2, 5, -23, 32, +10, 0, 8, 9, 101, 8, 1, 101, 2, 8, -72, -1, -64, 64, 11, 40, 57, 80, 8, 1, -128, 8, -112, 8, 2, +8, -72, 1, 1, 64, 13, 2, 64, 40, 57, 95, 2, 1, -113, 2, -97, 2, 2, 2, -72, 1, 1, 64, 17, 32, +5, 80, 5, 2, 48, 5, 96, 5, -112, 5, -64, 5, -16, 5, 5, 5, -72, 2, -120, -77, 11, 96, -88, 24, 43, +25, 16, -12, 93, 113, -28, 93, 113, 43, -28, 93, 113, 43, 24, 16, -19, 16, -19, 0, 63, 60, 26, 25, -19, 24, +63, 60, -121, 5, 46, 43, 125, 16, -60, -121, 46, 24, 43, 125, 16, -60, 1, 75, -80, 11, 83, 75, -80, 20, 81, +90, 88, -78, 0, 15, 10, -72, -1, -15, -78, 9, 18, 1, -72, -1, -15, -78, 8, 20, 2, -72, -1, -18, 56, 56, +56, 56, 56, 56, 89, 1, 75, -80, 40, 83, 75, -80, 54, 81, 90, 88, -71, 0, 0, -1, -64, 56, 89, 89, 49, +48, 1, 93, 113, 93, 0, 93, 89, 33, 1, 51, 1, 22, 23, 54, 55, 1, 51, 1, 2, 65, -3, -56, -46, 1, +125, 46, 31, 34, 45, 1, -116, -58, -3, -62, 5, -70, -5, -41, -128, 112, 120, 120, 4, 41, -6, 70, 0, 0, 1, +0, 25, 0, 0, 7, 118, 5, -70, 0, 24, 1, -37, 64, 38, 41, 0, 38, 17, 41, 18, 38, 24, 57, 0, 54, +17, 57, 18, 54, 24, 73, 0, 71, 17, 73, 18, 71, 24, 88, 0, 87, 17, 88, 18, 87, 24, 16, -104, 8, -104, +15, 2, -79, 6, 2, 67, 84, 88, 64, 51, 16, 1, 26, 25, 43, 21, 52, 5, 52, 12, 68, 5, 68, 12, 75, +21, 84, 5, 84, 12, 91, 21, 100, 5, 100, 12, 107, 21, 116, 5, 116, 12, 123, 21, 15, 5, 21, 12, 3, 0, +1, 18, 8, 0, 8, 15, 2, 8, 2, 1, 2, 0, 63, 63, 63, 63, 63, 17, 18, 23, 57, 93, 1, 17, 18, +57, 57, 27, 64, 30, 3, 4, 5, 5, 2, 6, 7, 8, 8, 5, 10, 11, 12, 12, 9, 13, 14, 15, 15, 12, +20, 19, 18, 18, 21, 22, 23, 24, 24, 21, -72, -1, 60, -77, 5, 0, 24, 32, -72, -1, 60, -77, 12, 18, 17, +32, -72, -1, 60, 64, 90, 21, 8, 9, 32, 0, 5, 2, 2, 32, 1, 0, 20, 1, 1, 0, 24, 5, 8, 8, +30, 21, 24, 20, 21, 21, 24, 18, 12, 9, 9, 30, 21, 18, 20, 21, 21, 18, 17, 12, 15, 15, 32, 16, 17, +20, 16, 16, 17, 18, 9, 12, 8, 24, 21, 5, 15, 17, 16, 12, 0, 2, 5, 21, 12, 5, 3, 24, 16, 15, +15, 9, 9, 8, 8, 2, 2, 1, 2, 24, 18, 18, 17, 17, 0, 8, 26, 23, 23, 26, 16, 65, 9, 1, 81, +0, 32, 0, 12, 1, 81, 0, 21, 1, 81, 0, 64, 0, 5, 1, 81, -74, 32, 32, 1, 1, 1, 25, 25, -72, +1, -117, -79, -88, 24, 43, 78, 16, -12, 93, 26, 25, 77, -3, 26, 24, -3, -3, 26, 25, -3, 24, 78, 69, 101, +68, -26, 0, 63, 60, 16, 60, 16, 60, 63, 60, 16, 60, 16, 60, 16, 60, 16, 60, 18, 23, 57, 1, 18, 57, +57, 17, 18, 57, 57, 17, 18, 57, 57, 17, 57, 57, -121, 77, 46, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, +-60, -121, 46, 24, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, -60, 43, 43, 43, -121, 14, 16, -60, -60, -121, 14, +16, 60, -60, -121, 14, 16, -60, -60, -121, 14, 16, -60, -60, -121, 14, 16, -60, -60, -121, 14, 16, -60, -60, 1, 75, +-80, 15, 83, 75, -80, 17, 81, 90, 88, -78, 18, 10, 24, -72, -1, -10, 56, 56, 89, 1, 75, -80, 37, 83, 75, +-80, 42, 81, 90, 88, -71, 0, 0, -1, -64, 56, 89, 0, 75, -80, 11, 83, 75, -80, 14, 81, 90, 88, -77, 12, +64, 5, 64, 56, 56, 89, 89, 49, 48, 1, 114, 93, 33, 1, 51, 19, 22, 23, 54, 55, 1, 51, 19, 18, 23, +54, 55, 19, 51, 1, 35, 1, 38, 39, 6, 7, 1, 1, -98, -2, 123, -57, -33, 36, 26, 56, 10, 1, 23, -22, +-46, 79, 35, 28, 45, -26, -61, -2, 110, -69, -2, -53, 39, 7, 23, 20, -2, -55, 5, -70, -4, 63, -105, -107, -21, +36, 3, -34, -3, 26, -2, -20, -13, -117, -76, 3, -82, -6, 70, 4, 93, -116, 32, 101, 71, -5, -93, 0, 1, 0, +9, 0, 0, 5, 73, 5, -70, 0, 19, 2, -75, 64, 41, 38, 18, 1, 25, 1, 22, 11, 2, 41, 18, 41, 19, +56, 1, 55, 3, 56, 8, 56, 9, 56, 13, 58, 14, 53, 18, 55, 19, 10, 18, 19, 32, 18, 33, 52, 18, 32, +18, 33, 52, 14, -72, -1, -32, -77, 18, 33, 52, 13, -72, -1, -32, -77, 18, 33, 52, 9, -72, -1, -32, -77, 18, +33, 52, 8, -72, -1, -32, 64, 108, 18, 33, 52, 4, 32, 18, 33, 52, 3, 32, 18, 33, 52, 119, 1, 119, 11, +2, 38, 4, 41, 7, 40, 11, 42, 14, 38, 18, 54, 4, 58, 8, 58, 11, 58, 14, 53, 18, 72, 8, 84, 4, +93, 8, 92, 11, 90, 14, 84, 18, 103, 1, 101, 4, 106, 8, 107, 11, 105, 14, 101, 18, 117, 4, 122, 8, 121, +11, 122, 13, 119, 18, 119, 19, -122, 4, -118, 7, -118, 10, -107, 4, -72, 8, -73, 18, -58, 4, -55, 8, -41, 4, +-40, 8, -39, 14, -42, 18, -25, 4, -24, 8, -24, 14, -26, 18, 44, 6, -72, -1, -22, 64, 17, 12, 17, 2, 85, +16, 22, 12, 17, 2, 85, 11, 8, 12, 17, 2, 85, 1, -72, -1, -8, -77, 12, 17, 2, 85, -79, 6, 2, 67, +84, 88, 64, 11, 12, 0, 21, 20, 16, 24, 10, 17, 6, 85, 6, -72, -1, -24, 64, 14, 10, 17, 6, 85, 16, +6, 0, 2, 13, 0, 8, 10, 2, 2, 0, 63, 60, 63, 60, 17, 18, 57, 57, 43, 43, 1, 17, 18, 57, 57, +27, 64, 93, 6, 7, 8, 9, 9, 1, 6, 5, 4, 3, 3, 11, 16, 16, 19, 15, 14, 13, 13, 1, 16, 16, +13, 17, 18, 19, 19, 11, 1, 0, 9, 2, 13, 11, 3, 12, 19, 10, 11, 1, 6, 16, 2, 19, 9, 10, 19, +19, 32, 0, 9, 20, 0, 0, 9, 3, 2, 13, 13, 32, 12, 3, 20, 12, 12, 3, 10, 9, 9, 3, 3, 2, +2, 19, 13, 13, 12, 12, 0, 8, 47, 21, 1, 21, 23, 23, 26, 32, 12, 64, 12, 2, 12, -72, 1, 95, -73, +32, 10, -112, 10, -64, 10, 3, 10, -72, 1, -72, -75, 95, 2, -97, 2, 2, 2, -72, 1, -72, 64, 10, 6, -76, +64, 16, 80, 16, -49, 16, 3, 16, -72, 1, 95, 64, 10, 32, 0, 25, 20, 21, -62, 33, 96, -88, 24, 43, 43, +78, -12, 26, 25, 77, -3, 93, 24, -27, 25, -19, 93, -19, 93, -3, 93, 24, 78, 69, 101, 68, -26, 93, 0, 63, +60, 16, 60, 16, 60, 63, 60, 16, 60, 16, 60, -121, 5, 77, 46, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, +-60, 0, 17, 18, 57, 57, 57, 57, 15, 15, -121, 14, 16, 60, 60, 8, -60, -121, 14, 16, 60, 60, 8, -60, -121, +14, 16, 60, 60, -60, -121, 14, 16, -60, -60, -60, 89, 43, 43, 0, 43, 43, 49, 48, 1, 93, 0, 93, 1, 43, +43, 43, 43, 43, 43, 43, 43, 67, 92, 88, -71, 0, 11, -1, -34, 64, 11, 25, 57, 1, 34, 25, 57, 14, 24, +27, 57, 18, -72, -1, -34, -78, 27, 57, 19, -72, -1, -34, -78, 27, 57, 4, -72, -1, -24, -74, 27, 57, 8, 34, +27, 57, 9, -72, -1, -64, -78, 28, 57, 13, -72, -1, -64, 64, 31, 28, 57, 19, 64, 28, 57, 3, 64, 28, 57, +13, 14, 22, 23, 60, 19, 18, 22, 23, 61, 8, 9, 22, 23, 60, 3, 4, 22, 23, 61, 11, -72, -1, -34, 64, +46, 18, 57, 1, 34, 18, 57, 11, 12, 29, 33, 61, 1, 0, 29, 33, 60, 11, 10, 29, 33, 61, 1, 2, 29, +33, 60, 11, 12, 19, 23, 61, 1, 0, 19, 23, 60, 11, 10, 19, 23, 61, 1, 2, 19, 23, 60, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 89, 1, +113, 1, 93, 113, 51, 1, 1, 51, 1, 22, 23, 54, 55, 1, 51, 1, 1, 35, 1, 38, 39, 6, 7, 1, 9, +2, 55, -2, 12, -25, 1, 10, 83, 35, 49, 67, 1, 39, -45, -3, -3, 2, 43, -16, -2, -113, 31, 33, 49, 21, +-2, -112, 2, -4, 2, -66, -2, -120, 117, 63, 80, 87, 1, -123, -3, 77, -4, -7, 2, 11, 45, 53, 80, 30, -2, +1, 0, 0, 1, 0, 6, 0, 0, 5, 70, 5, -70, 0, 12, 1, 106, -74, 8, 9, 58, 3, 4, 59, 9, -72, +-1, -25, -77, 18, 23, 52, 8, -72, -1, -25, 64, 14, 18, 23, 52, 4, 25, 18, 23, 52, 3, 25, 18, 23, 52, +9, -72, -1, -40, -77, 24, 33, 52, 8, -72, -1, -40, 64, 59, 24, 33, 52, 4, 40, 24, 33, 52, 18, 38, 4, +41, 8, 42, 10, 47, 14, 4, 104, 1, 104, 6, 104, 11, -34, 6, 4, 5, 4, 3, 3, 6, 8, 7, 9, 6, +6, 9, 6, 3, 9, 10, 12, 16, 2, 85, 9, 32, 10, 11, 20, 10, 10, 11, 6, 3, 6, 9, 3, -72, -1, +-10, 64, 22, 12, 16, 2, 85, 3, 32, 2, 1, 20, 2, 2, 1, 6, 12, 11, 6, 1, 3, 2, 0, 1, 11, +-72, 2, 25, 64, 9, 10, 10, 9, 3, 2, 2, 0, 8, 14, -72, 2, 24, 64, 9, 12, 9, 82, 64, 10, -128, +10, 2, 10, -72, 1, -75, 64, 13, 11, 11, 12, 32, 0, 3, 82, 79, 2, -113, 2, 2, 2, -72, 1, -75, 64, +9, 1, 1, 0, 20, 16, 16, 2, 85, 0, -72, -1, -10, 64, 11, 15, 15, 2, 85, 0, 12, 13, 13, 2, 85, +0, -72, -1, -30, -76, 12, 12, 2, 85, 0, -72, 2, 24, -74, 13, 14, -62, 33, 96, -88, 24, 43, 43, -10, 43, +43, 43, 43, 60, 16, -12, 93, -19, 16, -3, 60, 16, -12, 93, -19, 16, -26, 0, 63, 63, 60, 60, 60, 16, -12, +60, 17, 18, 23, 57, 1, 18, 57, -121, 46, 43, 43, 8, 125, 16, -60, 5, -121, 46, 24, 43, 43, 8, 125, 16, +-60, -121, 14, -60, -60, -121, 16, 14, -60, -60, 75, -80, 23, 83, 75, -80, 28, 81, 90, 88, -76, 8, 12, 9, 12, +4, -70, -1, -12, 0, 3, -1, -12, 1, 56, 56, 56, 56, 89, 49, 48, 0, 93, 1, 93, 67, 92, 88, 64, 9, +9, 34, 25, 57, 8, 34, 25, 57, 4, -72, -1, -34, -79, 25, 57, 43, 43, 43, 89, 43, 43, 43, 43, 43, 43, +43, 43, 43, 33, 17, 1, 51, 1, 22, 23, 54, 55, 1, 51, 1, 17, 2, 59, -3, -53, -20, 1, 33, 80, 69, +66, 94, 1, 28, -30, -3, -73, 2, 109, 3, 77, -2, 70, 124, 124, 115, -112, 1, -81, -4, -77, -3, -109, 0, 0, +1, 0, 41, 0, 0, 4, -80, 5, -70, 0, 12, 1, 12, -79, 18, 14, -72, -1, -64, 64, 15, 13, 17, 52, 72, +1, 71, 8, 72, 9, 3, 10, 8, 11, 9, 2, -79, 6, 2, 67, 84, 88, 64, 14, 12, 0, 14, 13, 1, 11, +30, 12, 8, 8, 5, 30, 6, 2, 0, 63, -3, 60, 63, -3, -60, 1, 17, 18, 57, 57, 27, 64, 43, -85, 4, +1, 3, 2, 1, 1, 4, 9, 10, 4, 8, 10, 10, 38, 29, 33, 52, 40, 10, 1, -7, 10, 1, 10, 32, 1, +4, 20, 1, 1, 4, 10, 40, 11, 28, 52, 1, 40, 11, 28, 52, 8, -72, -1, -40, -77, 11, 28, 52, 4, -72, +-1, -40, 64, 19, 11, 28, 52, 1, 10, 4, 8, 5, 30, 7, 6, 2, 11, 10, 30, 12, 0, 8, 10, -69, 1, +-75, 0, 1, 0, 4, 1, -75, 64, 27, 0, 7, 48, 8, 64, 8, 2, 8, 74, 12, 63, 11, 1, 11, 26, 14, +1, 0, 5, 6, 81, 0, 25, 13, -74, -103, 24, 43, 78, 16, -12, 77, -12, 60, 16, 60, 78, 16, -10, 93, 60, +77, -12, 113, 60, 16, -28, 16, -4, 0, 63, 60, -3, 60, 63, 60, -3, 60, 60, 17, 57, 1, 43, 43, 43, 43, +-121, 5, 46, 43, 93, 113, 43, -121, 125, -60, 14, 16, -60, -121, 14, 16, -60, -60, 1, 114, 89, 49, 48, 1, 113, +93, 43, 67, 92, 88, 64, 9, 2, 34, 33, 57, 1, 24, 33, 57, 9, -72, -1, -34, -75, 25, 57, 2, 34, 25, +57, 43, 43, 43, 43, 89, 51, 53, 1, 54, 55, 33, 53, 33, 21, 1, 7, 33, 21, 41, 2, -17, 80, 72, -4, +-50, 4, 26, -4, -55, 89, 3, -88, -76, 3, -85, 100, 74, -83, -83, -4, 7, 103, -83, 0, 1, 0, -117, -2, 105, +2, 24, 5, -70, 0, 7, 0, 70, 64, 43, 4, 3, 43, 1, 2, 16, 5, 6, 43, 0, 7, 18, 3, 2, 2, +7, 6, -82, 4, 5, 37, 1, 0, 6, 12, 12, 2, 85, 0, 8, 9, 9, 2, 85, 32, 0, 1, 0, -84, 8, +-99, 104, 24, 43, 16, -10, 93, 43, 43, 60, -3, 60, -12, 60, 60, 16, 60, 0, 63, 60, -3, 60, 63, 60, -3, +60, 49, 48, 19, 17, 33, 21, 35, 17, 51, 21, -117, 1, -115, -39, -39, -2, 105, 7, 81, -107, -7, -39, -107, 0, +0, 1, 0, 0, -1, -25, 2, 57, 5, -45, 0, 3, 0, 76, 64, 36, 1, 1, 34, 20, 57, 0, 34, 20, 57, +-104, 0, 1, 1, 0, -112, 0, -96, 0, 2, 0, 118, 3, 2, 20, 3, 3, 2, 2, 1, 0, 3, 0, 10, 3, +-24, 0, -72, 1, -87, -73, 2, -24, 1, 1, 4, -77, 122, 24, 43, 16, 60, 16, -19, -12, -19, 0, 63, 60, 63, +60, -121, 5, 46, 43, 93, 125, 16, -60, 49, 48, 1, 93, 43, 43, 5, 1, 51, 1, 1, -87, -2, 87, -111, 1, +-88, 25, 5, -20, -6, 20, 0, 1, 0, 39, -2, 105, 1, -76, 5, -70, 0, 7, 0, 63, 64, 23, 4, 5, 43, +7, 6, 16, 3, 2, 43, 0, 1, 18, 6, 5, 5, 1, 2, -82, 4, 3, 37, 7, 0, -72, -1, -20, 64, 10, +12, 12, 2, 85, 0, -84, 9, -101, 90, 24, 43, 16, -12, 43, 60, -3, 60, -12, 60, 60, 16, 60, 0, 63, 60, +-3, 60, 63, 60, -3, 60, 49, 48, 1, 33, 53, 51, 17, 35, 53, 33, 1, -76, -2, 115, -39, -39, 1, -115, -2, +105, -107, 6, 39, -107, 0, 0, 1, 0, 54, 2, -78, 3, -117, 5, -45, 0, 6, 0, 97, -71, 0, 0, -1, -64, +64, 21, 20, 57, 0, 64, 20, 57, 38, 2, 41, 3, 2, 6, 2, 9, 3, 2, 5, 1, 6, 60, 1, -72, 1, +101, 64, 23, 2, 5, 60, 4, 0, 60, 1, 6, 6, 3, 2, 8, 56, 4, -36, 3, 108, 2, -36, 1, 105, 7, +8, -68, 1, 50, 0, 33, 1, -65, 1, -127, 0, 24, 43, 43, -10, -12, -10, -12, -28, 17, 18, 61, 57, 47, 24, +16, -19, 16, -19, 0, 47, -19, -19, 16, 60, 49, 48, 1, 113, 113, 43, 43, 19, 35, 1, 51, 1, 35, 3, -17, +-71, 1, 97, -111, 1, 99, -75, -9, 2, -78, 3, 33, -4, -33, 2, 85, 0, 0, 1, -1, -31, -2, 105, 4, -118, +-2, -21, 0, 3, 0, 26, 64, 12, 1, 63, 0, 2, 26, 5, 0, 25, 4, 67, 65, 24, 43, 78, 16, -28, 16, +-26, 0, 47, 77, -19, 49, 48, 3, 53, 33, 21, 31, 4, -87, -2, 105, -126, -126, 0, 0, 1, 0, 89, 4, -86, +1, -47, 5, -62, 0, 3, 0, 96, 64, 11, 3, 56, 23, 25, 52, 2, 64, 15, 17, 52, 0, -72, -1, -64, -77, +23, 25, 52, 3, -72, -1, -64, 64, 26, 22, 25, 52, 80, 1, 80, 3, 2, 64, 3, 80, 0, 2, 3, 2, 0, +0, 1, 16, 1, 2, 1, -121, 2, 0, 0, -72, 2, 83, -78, 1, -122, 3, -72, 2, 96, -77, 2, 25, 4, 113, +-71, 1, 47, 0, 24, 43, 78, 16, -12, 77, -19, -12, -19, 0, 63, -3, 93, 60, 16, 60, 49, 48, 1, 93, 93, +43, 43, 43, 43, 1, 35, 3, 51, 1, -47, -111, -25, -15, 4, -86, 1, 24, 0, 0, 2, 0, 74, -1, -24, 4, +28, 4, 62, 0, 40, 0, 55, 2, 45, 64, 44, 9, 13, 9, 42, 25, 13, 26, 42, 41, 13, 42, 42, 57, 13, +54, 21, 55, 27, 58, 42, 73, 42, 93, 13, 93, 42, 106, 13, 105, 42, 96, 48, -118, 13, -122, 41, -102, 22, -101, +26, -87, 13, 21, 40, -72, -1, -24, -76, 11, 11, 6, 85, 39, -72, -1, -24, 64, 25, 11, 11, 6, 85, -90, 25, +-86, 40, -74, 25, -69, 40, -60, 25, -49, 40, -46, 21, -35, 40, 8, 68, 22, 1, 30, -72, -1, -12, 64, 17, 12, +12, 6, 85, 18, 18, 12, 12, 6, 85, 5, 12, 12, 12, 6, 85, 53, -72, -1, -32, 64, 85, 12, 12, 6, 85, +31, 23, 31, 24, 43, 44, 42, 52, 57, 4, 57, 44, 73, 4, 72, 44, 86, 8, 89, 43, 102, 8, 105, 43, 118, +12, -121, 12, -55, 12, -7, 13, -7, 43, 17, 55, 52, 14, 1, 4, 16, 47, 36, 52, 23, 50, 33, 20, 24, 95, +41, 111, 41, 2, 41, 28, 47, 14, 63, 14, -113, 14, -97, 14, -1, 14, 5, -97, 14, -81, 14, -17, 14, 3, 14, +12, 15, 15, 2, 85, 14, -72, -1, -22, -76, 16, 16, 2, 85, 14, -72, -1, -12, 64, 21, 16, 16, 6, 85, 14, +12, 13, 13, 6, 85, 14, 6, 15, 15, 6, 85, 14, 14, 28, 3, 23, -72, 2, -86, -74, 24, -107, 20, 28, 28, +7, 0, -72, -1, -12, 64, 26, 12, 12, 6, 85, 0, 69, 39, 10, 50, 28, 3, 11, 41, 97, 16, 97, 0, 6, +13, 13, 2, 85, 0, 37, 33, 36, -72, -1, -20, -76, 16, 16, 2, 85, 36, -72, -1, -20, 64, 11, 13, 13, 2, +85, 36, 4, 12, 12, 2, 85, 36, -72, -1, -28, -76, 11, 11, 2, 85, 36, -72, -1, -12, -76, 11, 11, 6, 85, +36, -72, -1, -36, 64, 11, 16, 16, 6, 85, 36, 6, 15, 15, 6, 85, 36, -72, -1, -4, -76, 12, 12, 6, 85, +36, -72, 2, 91, 64, 14, 39, 64, 0, 38, 16, 38, 32, 38, 48, 38, -81, 38, 5, 57, -72, -1, -64, -76, 14, +14, 2, 85, 38, -72, -1, -42, -74, 14, 14, 2, 85, 38, 49, 57, -72, -1, -64, 64, 13, 30, 35, 52, 48, 57, +-64, 57, 2, -96, 57, 1, 57, 23, -72, -1, -12, 64, 65, 16, 16, 6, 85, 23, 37, 24, 34, 47, 36, -65, 6, +-49, 6, 2, 31, 6, 63, 6, 2, 6, 14, 15, 15, 2, 85, 6, 12, 13, 13, 2, 85, 6, 24, 12, 12, 2, +85, 6, 12, 11, 11, 2, 85, 6, 12, 11, 11, 6, 85, 6, 14, 13, 13, 6, 85, 6, 16, 12, 12, 6, 85, +6, 49, 56, 16, -10, 43, 43, 43, 43, 43, 43, 43, 93, 113, -19, -12, -19, 43, 16, 93, 113, 43, -10, 43, 43, +93, -19, -12, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, 43, -27, -27, 0, 63, -19, 63, -28, 43, 63, -19, -3, +-28, 17, 18, 57, 47, 43, 43, 43, 43, 43, 93, 113, -19, 113, 17, 18, 57, 17, 18, 57, 57, 1, 17, 18, 23, +57, 49, 48, 0, 93, 43, 43, 43, 43, 1, 113, 93, 43, 43, 0, 113, 37, 6, 6, 35, 34, 38, 53, 52, 54, +54, 55, 54, 55, 54, 55, 54, 53, 52, 39, 38, 35, 34, 6, 7, 39, 62, 2, 51, 50, 22, 22, 23, 22, 21, +21, 20, 22, 23, 35, 38, 3, 6, 7, 14, 2, 21, 20, 22, 51, 50, 54, 55, 54, 53, 3, 60, 100, -71, 106, +-81, -68, 71, 115, 72, 53, 107, -38, 103, 1, 51, 69, -120, 127, 121, 29, -80, 24, 110, -48, -119, -120, -86, 80, 16, +9, 23, 34, -68, 28, 23, 98, -60, 111, 92, 50, 109, 105, 104, -94, 38, 29, -125, 85, 70, -85, -123, 78, -127, 78, +20, 14, 13, 26, 36, 37, 10, 110, 45, 61, 89, 113, 24, 113, -117, 75, 64, 97, 74, 46, 120, -16, -5, -123, 61, +56, 1, -35, 40, 28, 16, 40, 77, 47, 72, 96, 91, 79, 61, 119, 0, 2, 0, -122, -1, -24, 4, 31, 5, -70, +0, 16, 0, 29, 1, -128, 64, -101, 1, 5, 12, 15, 36, 5, 53, 5, 69, 5, 5, 63, 31, -80, 31, 2, 31, +31, 34, 28, 51, 28, 66, 28, 112, 31, -112, 31, 6, 58, 19, 60, 22, 60, 26, 76, 22, 76, 26, 93, 8, 93, +13, 88, 15, 93, 22, 94, 26, 106, 8, 108, 13, 104, 15, 110, 22, 110, 26, -64, 31, -39, 12, -38, 23, -38, 25, +-30, 19, -20, 23, -20, 25, -29, 29, -32, 31, -1, 31, 25, 32, 5, 47, 15, 47, 20, 48, 5, 63, 15, 64, 5, +76, 15, 80, 5, 102, 5, -38, 29, -11, 4, -6, 16, 12, 16, 21, 14, 4, 6, 2, 0, 27, 28, 6, 7, 1, +10, 21, 28, 14, 11, 24, 36, -48, 11, 1, 16, 11, 64, 11, 96, 11, -128, 11, 4, 31, 64, 13, 13, 2, 85, +11, 12, 15, 15, 2, 85, 11, 24, 13, 13, 2, 85, 11, -72, -1, -10, -76, 12, 12, 2, 85, 11, -72, -1, -16, +-76, 11, 11, 6, 85, 11, -72, -1, -12, -76, 15, 15, 6, 85, 11, -72, -1, -32, -76, 12, 12, 6, 85, 11, -72, +-1, -12, 64, 47, 13, 13, 6, 85, 11, 116, 1, 17, 51, 0, 4, 12, 12, 2, 85, 0, 4, 13, 13, 6, 85, +0, 51, 3, 37, 2, 2, -64, 1, 1, -112, 1, -96, 1, -80, 1, -16, 1, 4, 31, 1, 63, 1, 79, 1, 3, +1, -72, -1, -2, -76, 16, 16, 2, 85, 1, -72, -1, -4, 64, 29, 14, 14, 2, 85, 1, 12, 13, 13, 2, 85, +1, 16, 12, 12, 2, 85, 1, 18, 11, 11, 2, 85, 1, 12, 11, 11, 6, 85, 1, -72, -1, -8, -76, 16, 16, +6, 85, 1, -72, -1, -4, 64, 22, 15, 15, 6, 85, 1, 24, 12, 12, 6, 85, 1, 20, 13, 13, 6, 85, 1, +25, 30, 71, 55, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 60, 77, 16, +-3, -12, 43, 43, -28, 16, -3, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, -19, 0, 63, -19, 63, 63, -19, 63, +17, 57, 17, 18, 57, 49, 48, 0, 93, 1, 93, 113, 114, 0, 113, 33, 35, 17, 51, 17, 54, 51, 50, 30, 2, +21, 16, 0, 35, 34, 39, 3, 20, 23, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 1, 45, -89, -76, 114, -79, +98, -81, 113, 64, -2, -14, -67, -68, 107, 2, 52, 85, -111, 118, -84, -91, 117, 118, -84, 5, -70, -3, -11, -113, 79, +-113, -54, 115, -2, -17, -2, -42, -99, 1, -106, -65, 85, -117, -51, -53, -48, -58, -51, 0, 1, 0, 80, -1, -24, 3, +-19, 4, 62, 0, 26, 1, 90, -79, 2, 2, 67, 84, 88, 64, 52, 14, 127, 15, 1, 15, 11, 1, 64, 0, 80, +0, 112, 0, 3, 0, 4, 18, 28, 11, 7, 24, 28, 4, 11, 1, 14, 21, 7, 8, 14, 14, 2, 85, 7, 12, +13, 13, 2, 85, 7, 12, 12, 12, 2, 85, 7, 16, 11, 11, 2, 85, 7, 47, 43, 43, 43, 43, -51, -44, -58, +0, 63, -19, 63, -19, 16, -60, 93, 50, 16, -60, 93, 50, 49, 48, 27, 64, 71, 9, 12, 1, 31, 28, 67, 19, +67, 23, 83, 19, 83, 23, 96, 19, 96, 23, -101, 2, -101, 3, -102, 13, -92, 16, -92, 26, 12, 8, 13, 25, 10, +106, 2, 105, 3, 106, 5, 117, 12, 112, 13, -128, 13, -90, 12, -75, 9, -74, 10, -75, 12, 12, 22, 12, -122, 12, +-29, 2, 3, 14, 34, 95, 15, 111, 15, 127, 15, 3, 15, 1, -72, 2, -86, 64, 121, 48, 0, 64, 0, 80, 0, +96, 0, 112, 0, -112, 0, -96, 0, -32, 0, -16, 0, 9, 0, 15, 15, 11, 0, 0, 4, 18, 28, 11, 7, 24, +28, 4, 11, 28, 15, 1, 15, 36, 14, 8, 13, 13, 6, 85, 14, 34, 27, 0, 1, 0, 36, 11, 43, 31, 1, +1, 0, 1, 1, 1, 64, 11, 11, 6, 85, 1, 64, 16, 16, 6, 85, 1, 72, 12, 12, 6, 85, 1, 26, 13, +13, 6, 85, 1, 73, 28, 21, 36, -49, 7, 1, 31, 7, 63, 7, 2, 7, 14, 11, 11, 6, 85, 7, 10, 16, +16, 6, 85, 7, 18, 12, 12, 6, 85, 7, 49, 27, 52, -60, 24, 43, 16, -10, 43, 43, 43, 93, 113, -19, 16, +-10, 43, 43, 43, 43, 93, 114, 75, 83, 35, 75, 81, 90, 88, -71, 0, 1, -1, -64, 56, 89, -19, 114, -12, 43, +-19, 114, 0, 63, -19, 63, -19, 18, 57, 47, 17, 57, 47, 16, 93, -28, 16, 93, -28, 49, 48, 0, 93, 113, 1, +93, 113, 89, 1, 23, 6, 6, 35, 34, 0, 17, 52, 18, 54, 51, 50, 22, 23, 7, 38, 38, 35, 34, 6, 21, +20, 22, 51, 50, 54, 3, 60, -79, 29, -17, -82, -38, -2, -9, 114, -23, -119, -83, -36, 31, -81, 25, 127, 90, -120, +-86, -92, -124, 106, -114, 1, -123, 23, -73, -49, 1, 29, 1, 10, -84, 1, 2, -127, -81, -95, 27, 107, 108, -61, -45, +-42, -62, -126, 0, 0, 2, 0, 70, -1, -24, 3, -33, 5, -70, 0, 17, 0, 29, 1, 85, 64, -92, 10, 2, 4, +13, 37, 13, 52, 13, 68, 13, 5, 53, 20, 53, 28, 87, 2, 84, 10, 82, 20, 83, 28, 103, 2, 100, 5, 101, +9, 99, 20, 96, 28, -64, 31, -44, 5, -43, 19, -35, 25, -27, 19, -27, 20, -17, 23, -21, 25, -27, 29, -32, 31, +-1, 31, 22, 31, 31, 43, 26, 60, 22, 60, 26, 75, 26, 112, 31, -112, 31, 7, 46, 2, 36, 13, 46, 22, 58, +2, 53, 13, 75, 2, 69, 13, 70, 20, 73, 28, 87, 10, 86, 13, 103, 13, -27, 6, -25, 22, -6, 1, -12, 14, +16, 1, 21, 3, 14, 11, 16, 15, 0, 27, 28, 11, 7, 17, 0, 10, 21, 28, 3, 11, 24, 51, 1, 0, 37, +17, 15, 37, 16, 16, -48, 17, 1, 16, 17, 64, 17, 96, 17, -128, 17, 4, 31, 64, 11, 11, 2, 85, 31, 64, +13, 13, 2, 85, 17, 18, 16, 16, 2, 85, 17, -72, -1, -12, 64, 17, 15, 15, 2, 85, 17, 6, 14, 14, 2, +85, 17, 24, 13, 13, 2, 85, 17, -72, -1, -14, 64, 11, 11, 11, 6, 85, 17, 14, 16, 16, 6, 85, 17, -72, +-1, -18, -76, 12, 12, 6, 85, 17, -72, -1, -8, 64, 66, 13, 13, 6, 85, 17, 116, 18, 36, -65, 7, -49, 7, +-33, 7, -1, 7, 4, 31, 7, 63, 7, 79, 7, 3, 7, 30, 11, 11, 2, 85, 7, 24, 12, 12, 2, 85, 7, +30, 13, 13, 2, 85, 7, 12, 11, 11, 6, 85, 7, 12, 13, 13, 6, 85, 7, 26, 12, 12, 6, 85, 7, 25, +30, 52, 80, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 93, 113, 77, -19, -3, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 93, 113, 60, 16, -19, 16, -3, 60, -28, 0, 63, -19, 63, 60, 63, -19, 63, 60, 17, 57, 17, +18, 57, 49, 48, 0, 93, 1, 113, 93, 0, 113, 33, 53, 6, 35, 34, 38, 38, 53, 52, 18, 54, 51, 50, 22, +23, 17, 51, 17, 1, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 3, 56, 101, -60, 127, -43, 117, 106, -44, +-125, 96, -106, 47, -77, -3, 32, -84, 117, 118, -91, -88, 123, 120, -95, -122, -98, -116, -5, -93, -97, 1, 3, -118, 81, +65, 2, 14, -6, 70, 2, 18, -52, -54, -63, -58, -38, -52, -60, 0, 0, 2, 0, 75, -1, -24, 4, 30, 4, 62, +0, 21, 0, 29, 1, 83, 64, 23, 31, 0, 28, 21, 2, 85, 3, 93, 5, 93, 9, 85, 11, 101, 3, 107, 5, +111, 9, 101, 11, 8, 21, -72, -1, -28, -76, 13, 13, 6, 85, 17, -72, -1, -28, 64, 82, 13, 13, 6, 85, 29, +28, 13, 13, 6, 85, 39, 18, -39, 5, -6, 20, -10, 26, 4, 49, 18, 58, 25, 49, 28, 65, 18, 77, 26, 65, +28, 81, 18, 92, 25, 82, 28, 97, 18, 109, 26, 97, 28, 120, 6, 120, 21, -10, 2, -10, 24, 16, 0, 22, 1, +15, 13, 23, 23, 80, 22, 96, 22, 112, 22, 3, 22, 28, 15, -112, 16, -96, 16, 2, 16, 16, 4, 27, 28, 10, +7, 0, -70, 2, -86, 0, 1, -1, -64, -76, 16, 16, 2, 85, 1, -72, -1, -64, 64, 16, 16, 16, 6, 85, 16, +1, 1, 1, -107, 19, 28, 4, 11, 23, 64, 13, -72, -1, -36, -76, 13, 13, 2, 85, 13, -72, -1, -18, -76, 13, +13, 6, 85, 13, -72, -1, -22, -76, 12, 12, 6, 85, 13, -72, -1, -64, 64, 9, 39, 42, 52, -80, 13, 1, 13, +26, 31, -72, -1, -64, -77, 37, 38, 52, 31, -72, -1, -64, 64, 65, 30, 35, 52, 48, 31, 1, 31, 22, 51, 16, +36, 7, 64, 36, 42, 52, 31, 7, 63, 7, 79, 7, 3, 7, 32, 11, 11, 2, 85, 7, 24, 12, 12, 2, 85, +7, 28, 13, 13, 2, 85, 7, 14, 11, 11, 6, 85, 7, 28, 12, 12, 6, 85, 7, 22, 13, 13, 6, 85, 7, +25, 30, 52, 55, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 93, 43, 77, -3, -28, 78, 16, 113, 43, 43, +-10, 113, 43, 43, 43, 43, 77, -19, 0, 63, -19, -3, 93, 43, 43, -28, 63, -19, 18, 57, 47, 93, 60, -3, 113, +60, 1, 17, 18, 57, 57, 18, 57, 49, 48, 1, 93, 0, 93, 43, 43, 43, 1, 113, 114, 1, 23, 6, 6, 35, +34, 0, 17, 16, 0, 51, 50, 0, 17, 20, 7, 33, 22, 22, 51, 50, 54, 1, 33, 38, 39, 38, 35, 34, 6, +3, 94, -70, 44, -18, -71, -23, -2, -17, 1, 20, -36, -43, 1, 14, 1, -4, -24, 10, -78, -123, 99, -116, -3, -38, +2, 81, 12, 56, 86, -119, 124, -87, 1, 86, 23, -93, -76, 1, 31, 1, 3, 1, 12, 1, 40, -2, -34, -2, -7, +16, 32, -81, -70, 104, 1, -107, -122, 67, 104, -90, 0, 1, 0, 19, 0, 0, 2, -128, 5, -45, 0, 23, 1, 13, +64, 30, 20, 9, 1, 15, 25, 47, 25, 48, 25, 64, 25, 112, 25, -101, 12, -100, 13, -87, 13, 8, 26, 13, 40, +13, -80, 25, -64, 25, 4, 25, -72, -1, -64, 64, 40, 26, 31, 52, 29, 8, 13, 3, 12, 15, 28, 10, 1, 21, +2, 43, 20, 19, 4, 3, 6, 0, 10, -97, 20, 1, 20, -1, 19, 64, 4, 23, 37, 4, 0, 3, 2, -110, 1, +1, 0, -72, -1, -64, -77, 49, 56, 52, 0, -72, -1, -64, 64, 43, 28, 31, 52, -112, 0, 1, 25, 64, 15, 15, +2, 85, 25, 64, 13, 14, 2, 85, 0, 20, 16, 16, 2, 85, 0, 40, 15, 15, 2, 85, 0, 34, 14, 14, 2, +85, 0, 44, 13, 13, 2, 85, 0, -72, -1, -14, 64, 11, 12, 12, 2, 85, 0, 20, 11, 11, 6, 85, 0, -72, +-1, -22, -76, 16, 16, 6, 85, 0, -72, -1, -26, -76, 15, 15, 6, 85, 0, -72, -1, -6, -73, 12, 12, 6, 85, +0, -93, 24, 25, -68, 1, -70, 0, 33, 0, -10, 1, 10, 0, 24, 43, 43, -10, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 93, 43, 43, 60, 16, -12, 60, 16, 60, -19, 16, -19, -19, 93, 0, 63, 63, 60, 60, 60, -3, +60, 63, -19, 57, 17, 57, 49, 48, 67, 121, 64, 20, 16, 17, 6, 9, 7, 6, 8, 6, 2, 6, 16, 9, 18, +27, 0, 17, 6, 15, 27, 1, 43, 1, 43, 42, -127, -127, 1, 43, 113, 93, 0, 114, 51, 17, 35, 53, 51, 53, +52, 55, 54, 54, 51, 50, 23, 7, 38, 35, 34, 6, 21, 21, 51, 21, 35, 17, -78, -97, -97, 19, 26, -125, 118, +76, 92, 27, 56, 50, 82, 68, -49, -49, 3, -102, -116, 113, 107, 52, 70, 87, 18, -99, 10, 70, 96, 98, -116, -4, +102, 0, 2, 0, 66, -2, 81, 3, -22, 4, 62, 0, 30, 0, 42, 1, 111, 64, 96, 11, 11, 5, 20, 44, 11, +37, 20, 76, 11, 69, 20, 6, 9, 29, 25, 29, 44, 11, 38, 20, 44, 35, 57, 11, 54, 20, 74, 11, 70, 20, +86, 7, 88, 11, 104, 11, -6, 10, -11, 21, 14, 46, 35, 44, 39, 62, 35, 62, 39, 76, 39, -112, 44, -96, 44, +7, 54, 33, 54, 41, 63, 44, 70, 11, 70, 33, 69, 41, 84, 33, 84, 41, 105, 7, 99, 33, 99, 41, 96, 44, +-128, 44, -38, 39, -24, 33, -18, 35, -17, 39, 17, 23, 22, 6, 21, -72, 2, -79, -76, 40, 28, 19, 7, 1, -72, +2, -86, 64, 16, 32, 0, 48, 0, 96, 0, 112, 0, -128, 0, -64, 0, -48, 0, 7, 0, -72, 2, 125, 64, 50, +5, 28, 28, 15, 10, 69, 34, 28, 12, 10, 22, 21, 51, 37, 51, 10, 37, 24, 24, -48, 23, 1, 16, 23, 64, +23, 96, 23, -128, 23, 4, 44, 64, 11, 12, 2, 85, 44, 64, 13, 13, 2, 85, 23, 18, 16, 16, 2, 85, 23, +-72, -1, -12, 64, 17, 15, 15, 2, 85, 23, 6, 14, 14, 2, 85, 23, 22, 13, 13, 2, 85, 23, -72, -1, -22, +64, 11, 11, 11, 6, 85, 23, 18, 16, 16, 6, 85, 23, -72, -1, -18, -76, 12, 12, 6, 85, 23, -72, -1, -4, +64, 74, 13, 13, 6, 85, 23, 116, 15, 1, 37, 0, 34, 31, 36, -65, 15, -49, 15, -33, 15, -1, 15, 4, 31, +15, 63, 15, 79, 15, 3, 15, 32, 11, 11, 2, 85, 15, 26, 12, 12, 2, 85, 15, 34, 13, 13, 2, 85, 15, +28, 11, 11, 6, 85, 15, 12, 13, 13, 6, 85, 15, 26, 12, 12, 6, 85, 15, 25, 43, 44, 116, 33, 52, 80, +24, 43, 43, 78, -12, 43, 43, 43, 43, 43, 43, 93, 113, 77, -19, -12, -19, 16, -3, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 93, 113, 60, 16, -3, -28, -10, 60, 0, 63, -19, -28, 63, -19, -3, 93, -28, 63, -19, -28, 63, +60, 49, 48, 1, 93, 113, 0, 93, 113, 23, 23, 22, 23, 22, 51, 50, 54, 55, 54, 39, 6, 35, 34, 2, 53, +52, 18, 54, 51, 50, 23, 53, 51, 17, 20, 6, 6, 35, 34, 38, 19, 20, 22, 51, 50, 54, 53, 52, 38, 35, +34, 6, 102, -81, 11, 50, 67, 116, 125, -120, 24, 14, 1, 118, -80, -37, -16, 110, -47, -115, -68, 122, -90, 101, -37, +-96, -66, -22, -103, -90, 125, 124, -88, -83, 122, 120, -88, 88, 26, 81, 37, 50, 100, 90, 55, -80, -117, 1, 60, -35, +-104, 1, 1, -116, -104, -128, -4, 106, -8, -49, 120, -85, 3, 42, -47, -64, -65, -52, -61, -58, -61, 0, 0, 1, 0, +-121, 0, 0, 3, -24, 5, -70, 0, 20, 1, 97, -71, 0, 22, -1, -64, -77, 21, 23, 52, 3, -72, -1, -32, 64, +14, 13, 13, 6, 85, 37, 4, 53, 3, 69, 3, -70, 13, 4, 3, -72, -1, -32, 64, 58, 23, 25, 52, 23, 8, +17, 12, 17, 20, 3, 5, 1, 0, 15, 28, 5, 7, 20, 11, 10, 12, 37, 9, 64, 51, 54, 52, -1, 9, 1, +-64, 9, 1, 22, 64, 11, 11, 2, 85, 22, 64, 16, 16, 2, 85, 9, 40, 16, 16, 2, 85, 9, 20, 14, 14, +2, 85, 9, -72, -1, -20, 64, 17, 13, 13, 2, 85, 9, 4, 12, 12, 2, 85, 9, 26, 11, 11, 2, 85, 9, +-72, -1, -10, 64, 11, 11, 11, 6, 85, 9, 20, 16, 16, 6, 85, 9, -72, -1, -8, 64, 11, 13, 13, 6, 85, +9, 10, 15, 15, 6, 85, 9, -72, -1, -10, -74, 12, 12, 6, 85, 9, 78, 22, -72, -1, -64, 64, 23, 52, 54, +52, -80, 22, -16, 22, 2, 112, 22, -96, 22, -80, 22, -1, 22, 4, 22, 2, 20, 37, 1, 0, -72, -1, -64, 64, +16, 51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, -72, -1, -6, -76, 16, 16, 2, 85, +0, -72, -1, -6, 64, 23, 14, 14, 2, 85, 0, 4, 12, 12, 2, 85, 0, 8, 11, 11, 2, 85, 0, 4, 11, +11, 6, 85, 0, -72, -1, -6, 64, 22, 15, 15, 6, 85, 0, 2, 12, 12, 6, 85, 0, 2, 13, 13, 6, 85, +0, 78, 21, 71, 80, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 43, 60, -3, 60, 16, 93, +113, 43, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 43, -19, 0, 63, 60, 63, -19, 63, +17, 57, 17, 57, 1, 18, 57, 49, 48, 67, 121, 64, 14, 6, 14, 7, 37, 14, 6, 12, 27, 1, 13, 8, 15, +27, 1, 0, 43, 1, 43, 43, -127, 0, 43, 93, 43, 1, 43, 51, 17, 51, 17, 54, 51, 50, 22, 22, 21, 17, +35, 17, 52, 38, 35, 34, 6, 6, 21, 17, -121, -76, 126, -64, 118, -82, 75, -76, 117, 107, 80, -115, 60, 5, -70, +-3, -14, -110, 93, -92, -100, -3, 95, 2, -95, -121, 123, 83, -114, 125, -3, -69, 0, 2, 0, -120, 0, 0, 1, 60, +5, -70, 0, 3, 0, 7, 0, -51, 64, 94, 9, 54, 11, 11, 2, 85, 79, 9, -112, 9, -96, 9, -80, 9, -64, +9, -33, 9, -16, 9, 7, 0, 9, 31, 9, 112, 9, -128, 9, -97, 9, -80, 9, -64, 9, -33, 9, -32, 9, -1, +9, 10, 31, 9, 1, 0, 1, 7, 4, 2, 3, 9, 6, 3, 126, 1, 0, 6, 5, 6, 4, 10, 6, 7, 37, +5, 0, 4, -97, 4, -96, 4, -80, 4, -64, 4, -32, 4, 6, -64, 4, -16, 4, 2, 0, 4, 32, 4, -48, 4, +-32, 4, 4, 4, -72, -1, -8, -76, 16, 16, 2, 85, 4, -72, -1, -6, 64, 23, 14, 14, 2, 85, 4, 4, 12, +12, 2, 85, 4, 10, 11, 11, 2, 85, 4, 20, 11, 11, 6, 85, 4, -72, -1, -22, -76, 16, 16, 6, 85, 4, +-72, -1, -2, -76, 13, 13, 6, 85, 4, -72, -1, -4, 64, 10, 12, 12, 6, 85, 4, 78, 8, 71, 80, 24, 43, +16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 60, -3, 60, 0, 63, 63, 60, 63, -19, 1, 17, 18, +57, 57, 17, 18, 57, 57, 49, 48, 1, 93, 114, 113, 43, 19, 53, 51, 21, 3, 17, 51, 17, -120, -76, -76, -76, +4, -21, -49, -49, -5, 21, 4, 38, -5, -38, 0, 0, 2, -1, -94, -2, 81, 1, 58, 5, -70, 0, 3, 0, 18, +0, -43, 64, 69, 4, 5, 37, 5, 59, 4, 51, 5, -122, 5, 5, 23, 8, 5, 5, 7, 4, 4, 2, 4, 5, +19, 0, 1, 13, 11, 2, 3, 20, 12, 4, 17, 5, 11, 7, 3, 126, 1, 0, 11, 6, 7, 28, 17, 15, -112, +20, 1, 20, 23, 23, 26, 12, 12, 13, 37, 10, 10, -112, 11, 1, 31, 11, 63, 11, 79, 11, 3, 11, -72, -1, +-6, 64, 55, 14, 14, 2, 85, 11, 16, 13, 13, 2, 85, 11, 16, 12, 12, 2, 85, 11, 12, 11, 11, 2, 85, +11, 30, 11, 11, 6, 85, 11, 12, 16, 16, 6, 85, 11, 8, 12, 12, 6, 85, 11, 12, 13, 13, 6, 85, 11, +25, 19, 20, -83, 33, 71, 80, 24, 43, 43, 78, -12, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 60, 77, 16, +-3, 60, 78, 16, 69, 101, 68, -26, 113, 0, 63, 77, -19, 63, 63, -19, 17, 18, 57, 18, 57, 1, 17, 18, 57, +57, 17, 18, 57, 57, 17, 51, 51, -121, 16, 8, 60, 49, 48, 67, 121, 64, 14, 8, 16, 15, 38, 8, 16, 10, +27, 1, 9, 14, 7, 27, 0, 0, 43, 1, 43, 43, -127, 1, 93, 19, 53, 51, 21, 1, 55, 22, 51, 50, 54, +53, 17, 51, 17, 20, 7, 6, 35, 34, -122, -76, -2, 104, 34, 54, 31, 55, 54, -76, 51, 65, -105, 73, 4, -23, +-47, -47, -7, 123, -103, 14, 73, -110, 4, 92, -5, -96, -60, 77, 100, 0, 0, 1, 0, -120, 0, 0, 3, -8, 5, +-70, 0, 11, 2, 97, 64, 27, 6, 12, 13, 13, 6, 85, 7, 6, 86, 6, 90, 9, 3, 15, 13, -13, 5, -10, +6, 3, 9, 12, 16, 16, 2, 85, 6, -72, -1, -12, -76, 12, 12, 2, 85, 10, -72, -1, -12, -76, 12, 12, 2, +85, 9, -72, -1, -12, -76, 12, 12, 2, 85, 3, -72, -1, -24, 64, 16, 13, 13, 6, 85, 85, 3, 119, 10, 2, +18, 6, 32, 19, 33, 52, 8, -72, -1, -16, -77, 18, 39, 52, 9, -72, -1, -16, -76, 18, 39, 52, 18, 5, -72, +-1, -16, -77, 18, 33, 52, 9, -72, -1, -16, 64, -124, 18, 39, 52, 6, 4, 4, 5, 4, 6, 55, 9, 71, 4, +5, 37, 6, 45, 10, 88, 10, 119, 3, 117, 10, -38, 3, -29, 6, 7, -90, 6, 1, 35, 6, 38, 7, 37, 8, +57, 6, 56, 9, 63, 13, 79, 13, 89, 4, 89, 6, 88, 7, 89, 9, 125, 4, 121, 5, -103, 9, -58, 6, -46, +4, -42, 6, -28, 6, -23, 7, -9, 6, -7, 8, 21, 18, 10, 10, 5, 3, 3, 4, 2, 6, 6, 7, 9, 9, +8, 10, 10, 5, 9, 8, 8, 37, 7, 6, 20, 7, 7, 6, 3, 4, 4, 37, 5, 10, 20, 5, 5, 10, 10, +9, 6, 3, 4, 8, 1, 2, 0, 4, 5, 6, 7, 8, 8, 11, 11, 0, 10, 4, -72, 1, 15, 64, 9, 5, +4, 12, 12, 6, 85, 5, 34, 8, -72, 1, 15, 64, 33, 32, 7, 63, 7, 2, 7, 16, 12, 12, 6, 85, 7, +26, -112, 13, 1, 13, 11, 37, 0, 2, 37, 1, 1, -112, 0, 1, 63, 0, 79, 0, 2, 0, -72, -1, -2, 64, +49, 14, 14, 2, 85, 0, 16, 13, 13, 2, 85, 0, 16, 12, 12, 2, 85, 0, 10, 11, 11, 2, 85, 0, 18, +11, 11, 6, 85, 0, 18, 12, 12, 6, 85, 0, 8, 13, 13, 6, 85, 0, 25, 12, 13, -31, 33, 71, 102, 24, +43, 43, 78, -12, 43, 43, 43, 43, 43, 43, 43, 93, 113, 60, 77, 16, -19, 16, -19, 78, 16, 113, -10, 43, 93, +77, -19, -12, 43, -19, 0, 63, 60, 16, 60, 16, 60, 63, 60, 63, 60, 17, 23, 57, -121, 5, 46, 43, 4, 125, +16, -60, -121, 5, 46, 24, 43, 14, 125, 16, -60, 7, 16, 8, 60, 8, 60, 3, 16, 8, 60, 8, 60, -79, 6, +2, 67, 84, 88, 64, 13, 75, 9, 1, 31, 9, -124, 3, 2, 9, 24, 13, 17, 52, 0, 43, 93, 113, 89, 49, +48, 1, 67, 92, 88, 64, 10, 9, 44, 29, 57, 9, 8, 29, 29, 60, 6, -72, -1, -34, -78, 29, 57, 6, -72, +-1, -44, -78, 32, 57, 6, -72, -1, -44, -79, 33, 57, 43, 43, 43, 43, 43, 89, 93, 0, 113, 93, 1, 113, 0, +43, 43, 67, 92, 88, -71, 0, 6, -1, -64, -78, 33, 57, 3, -72, -1, -64, -78, 22, 57, 3, -72, -1, -34, -78, +16, 57, 6, -72, -1, -34, -78, 16, 57, 3, -72, -1, -34, -78, 12, 57, 3, -72, -1, -34, -79, 11, 57, 43, 43, +43, 43, 43, 43, 89, 1, 43, 43, 43, 67, 92, 88, 64, 18, -35, 4, 1, 8, 20, 22, 57, 9, 8, 20, 20, +60, 9, 8, 20, 20, 60, 6, -72, -1, -10, -78, 24, 57, 6, -72, -1, -20, -79, 27, 57, 43, 43, 43, 43, 43, +1, 93, 89, 0, 93, 43, 43, 43, 43, 43, 1, 93, 113, 43, 51, 17, 51, 17, 1, 51, 1, 1, 35, 1, 7, +17, -120, -76, 1, -86, -23, -2, 106, 1, -65, -34, -2, -95, 127, 5, -70, -4, -68, 1, -80, -2, 118, -3, 100, 2, +31, 122, -2, 91, 0, 0, 1, 0, -125, 0, 0, 1, 55, 5, -70, 0, 3, 0, -29, -74, 5, 54, 11, 11, 2, +85, 5, -72, -1, -64, -77, 55, 56, 52, 5, -72, -1, -64, -77, 52, 53, 52, 5, -72, -1, -64, -77, 48, 49, 52, +5, -72, -1, -64, -77, 34, 37, 52, 5, -72, -1, -64, 64, 37, 21, 23, 52, 15, 5, 31, 5, -97, 5, -33, 5, +4, 79, 5, -33, 5, -16, 5, 3, 31, 5, 112, 5, -128, 5, -1, 5, 4, 1, 0, 0, 10, 2, 3, 37, 1, +0, -72, -1, -64, -77, 55, 56, 52, 0, -72, -1, -64, 64, 21, 51, 53, 52, -97, 0, 1, -64, 0, -16, 0, 2, +0, 0, 32, 0, -48, 0, -32, 0, 4, 0, -72, -1, -8, -76, 16, 16, 2, 85, 0, -72, -1, -6, 64, 29, 14, +14, 2, 85, 0, 4, 12, 12, 2, 85, 0, 10, 11, 11, 2, 85, 0, 20, 11, 11, 6, 85, 0, 8, 16, 16, +6, 85, 0, -72, -1, -2, -76, 13, 13, 6, 85, 0, -72, -1, -1, -76, 12, 12, 6, 85, 0, -72, -1, -4, 64, +10, 12, 12, 6, 85, 0, 78, 4, 71, 80, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, +114, 43, 43, 60, -3, 60, 0, 63, 63, 49, 48, 1, 93, 113, 114, 43, 43, 43, 43, 43, 43, 51, 17, 51, 17, +-125, -76, 5, -70, -6, 70, 0, 0, 1, 0, -121, 0, 0, 6, 38, 4, 62, 0, 35, 1, -57, -71, 0, 13, -1, +-12, -76, 13, 13, 6, 85, 8, -72, -1, -12, -76, 13, 13, 6, 85, 9, -72, -1, -40, 64, 77, 11, 13, 52, 37, +4, -28, 4, -28, 9, -31, 23, -27, 32, 5, -43, 5, -10, 32, 2, 23, 8, 32, 35, 9, 24, 27, 32, 9, 3, +3, 35, 30, 28, 6, 21, 28, 11, 11, 6, 7, 1, 6, 35, 26, 25, 16, 10, -48, 37, 1, -112, 37, -96, 37, +2, 37, 23, 23, 26, 14, 37, -112, 17, 1, 17, 4, 16, 16, 2, 85, 17, 24, 15, 15, 2, 85, 17, -72, -1, +-20, 64, 11, 14, 14, 2, 85, 17, 20, 12, 12, 2, 85, 17, -72, -1, -24, 64, 23, 11, 11, 2, 85, 17, 2, +11, 11, 6, 85, 17, 12, 16, 16, 6, 85, 17, 6, 15, 15, 6, 85, 17, -72, -1, -6, -76, 12, 12, 6, 85, +17, -72, -1, -8, -76, 13, 13, 6, 85, 17, -72, 1, 93, 64, 12, 24, 37, -112, 27, 1, 27, 24, 15, 15, 2, +85, 27, -72, -1, -20, 64, 11, 14, 14, 2, 85, 27, 20, 12, 12, 2, 85, 27, -72, -1, -18, 64, 17, 11, 11, +2, 85, 27, 4, 11, 11, 6, 85, 27, 10, 16, 16, 6, 85, 27, -72, -1, -2, 64, 11, 13, 13, 6, 85, 27, +12, 15, 15, 6, 85, 27, -72, -1, -4, -76, 12, 12, 6, 85, 27, -72, 1, 93, 64, 22, 0, 2, 51, 35, 37, +1, -48, 0, 1, -112, 0, -96, 0, 2, 31, 0, 63, 0, 79, 0, 3, 0, -72, -1, -2, 64, 29, 14, 14, 2, +85, 0, 16, 13, 13, 2, 85, 0, 16, 12, 12, 2, 85, 0, 12, 11, 11, 2, 85, 0, 22, 11, 11, 6, 85, +0, -72, -1, -4, -76, 16, 16, 6, 85, 0, -72, -1, -12, 64, 20, 15, 15, 6, 85, 0, 10, 12, 12, 6, 85, +0, 14, 13, 13, 6, 85, 0, 25, 36, 37, -72, 1, 120, -77, 33, 71, 80, 24, 43, 43, 78, -12, 43, 43, 43, +43, 43, 43, 43, 43, 43, 93, 113, 114, 60, 77, -3, -28, 16, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, +-19, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, -3, 78, 69, 101, 68, -26, 113, 114, 0, 63, 60, 60, +60, 63, 63, 60, 77, 16, -19, 16, -19, 17, 23, 57, 1, 17, 18, 57, 18, 57, 49, 48, 67, 121, 64, 14, 12, +20, 19, 38, 20, 12, 17, 27, 1, 18, 13, 21, 27, 1, 0, 43, 1, 43, 43, -127, 1, 93, 0, 93, 43, 43, +43, 51, 17, 51, 21, 54, 54, 51, 50, 22, 23, 54, 51, 50, 22, 21, 17, 35, 17, 52, 38, 38, 35, 34, 6, +21, 17, 35, 17, 52, 38, 35, 34, 6, 6, 21, 17, -121, -95, 50, -90, 106, 118, -105, 31, 126, -54, -98, -86, -77, +35, 92, 62, 112, -108, -76, 88, 100, 76, -127, 58, 4, 38, -107, 78, 95, 98, 88, -70, -81, -74, -3, 39, 2, -99, +108, 95, 58, -107, -92, -3, -105, 2, -78, 120, 120, 80, -102, -111, -3, -39, 0, 0, 1, 0, -121, 0, 0, 3, -26, +4, 62, 0, 22, 1, 125, 64, 19, 5, 3, 6, 19, 2, -88, 16, -72, 16, -29, 3, -25, 19, -16, 3, -10, 19, +6, 4, -72, -1, -16, 64, 60, 11, 13, 52, 121, 16, 1, -104, 16, -48, 24, -32, 24, -1, 24, 4, 32, 8, 20, +14, 20, 22, 18, 28, 5, 7, 1, 6, 22, 13, 10, 13, 14, 12, 14, 36, 24, 64, 16, 16, 2, 85, 24, 64, +11, 11, 2, 85, 11, 40, 16, 16, 2, 85, 11, 20, 14, 14, 2, 85, 11, -72, -1, -20, 64, 17, 13, 13, 2, +85, 11, 4, 12, 12, 2, 85, 11, 34, 11, 11, 2, 85, 11, -72, -1, -12, 64, 11, 11, 11, 6, 85, 11, 20, +16, 16, 6, 85, 11, -72, -1, -7, 64, 11, 13, 13, 6, 85, 11, 10, 15, 15, 6, 85, 11, -72, -1, -10, 64, +18, 12, 12, 6, 85, 11, 64, 51, 54, 52, -1, 11, 1, -1, 11, 1, 11, 78, 24, -72, -1, -64, 64, 26, 52, +54, 52, -80, 24, -16, 24, 2, 112, 24, -96, 24, -80, 24, -64, 24, 4, 24, 3, 2, 51, 21, 22, 37, 1, 0, +-72, -1, -10, -76, 17, 17, 2, 85, 0, -72, -1, -6, -76, 16, 16, 2, 85, 0, -72, -1, -6, 64, 23, 14, 14, +2, 85, 0, 4, 12, 12, 2, 85, 0, 10, 11, 11, 2, 85, 0, 4, 11, 11, 6, 85, 0, -72, -1, -6, 64, +17, 15, 15, 6, 85, 0, 2, 12, 12, 6, 85, 0, 4, 13, 13, 6, 85, 0, -72, -1, -64, 64, 18, 51, 54, +52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 23, 16, -10, 93, 113, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, 60, -3, 60, -12, 60, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, -19, 60, 16, 60, 0, 63, 60, 63, 63, -19, 17, 57, 1, 18, 57, 49, 48, 67, 121, 64, +22, 6, 17, 9, 10, 8, 10, 7, 10, 3, 6, 16, 38, 17, 6, 14, 27, 1, 15, 10, 18, 27, 1, 0, 43, +1, 43, 43, 42, -127, 1, 93, 113, 0, 43, 93, 113, 51, 17, 51, 21, 54, 51, 50, 22, 22, 23, 22, 21, 17, +35, 17, 52, 38, 38, 35, 34, 6, 21, 17, -121, -94, 117, -35, 96, -95, 80, 16, 10, -76, 42, 107, 72, 115, -89, +4, 38, -105, -81, 69, 112, 77, 50, 125, -3, 115, 2, -122, 110, 109, 65, -110, -52, -3, -68, 0, 0, 2, 0, 68, +-1, -24, 4, 39, 4, 62, 0, 13, 0, 25, 1, 107, -74, 21, 24, 13, 13, 6, 85, 19, -72, -1, -24, -76, 13, +13, 6, 85, 15, -72, -1, -24, 64, 115, 13, 13, 6, 85, 25, 24, 13, 13, 6, 85, 18, 7, 10, 25, 12, 71, +6, 72, 8, 86, 6, 89, 8, 103, 6, 105, 8, 8, 52, 16, 58, 18, 58, 22, 53, 24, 69, 16, 75, 18, 75, +22, 69, 24, 92, 5, 92, 9, 82, 16, 93, 18, 93, 22, 82, 24, 109, 5, 109, 9, 100, 16, 109, 18, 109, 22, +100, 24, 119, 1, 21, 9, 6, 5, 13, 91, 3, 84, 5, 84, 10, 91, 12, 108, 3, 101, 5, 101, 10, 108, 12, +10, 23, 28, 4, 7, 17, 28, 11, 11, 20, 36, 27, 64, 13, 13, 2, 85, 27, 64, 11, 11, 2, 85, 7, -72, +-1, -22, 64, 17, 15, 15, 2, 85, 7, 24, 13, 13, 2, 85, 7, 16, 11, 11, 2, 85, 7, -72, -1, -16, -76, +11, 11, 6, 85, 7, -72, -1, -16, -76, 13, 13, 6, 85, 7, -72, -1, -16, -76, 15, 15, 6, 85, 7, -72, -1, +-16, -76, 12, 12, 6, 85, 7, -72, -1, -64, 64, 19, 36, 37, 52, 48, 7, 1, 0, 7, 16, 7, 32, 7, 3, +7, 49, -33, 27, 1, 27, -72, -1, -64, 64, 73, 30, 35, 52, 48, 27, 1, 27, 14, 36, 0, 12, 14, 15, 2, +85, 0, 18, 13, 13, 2, 85, 0, 12, 12, 12, 2, 85, 0, 28, 11, 11, 2, 85, 0, 14, 11, 11, 6, 85, +0, 14, 13, 13, 6, 85, 0, 12, 16, 16, 6, 85, 0, 22, 12, 12, 6, 85, 0, 64, 36, 37, 52, 31, 0, +63, 0, 2, 0, 49, 26, 52, 55, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, 113, +43, 93, -10, 93, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, -19, 63, -19, 49, 48, 1, 113, +93, 0, 113, 67, 92, 88, 64, 9, 83, 5, 83, 9, 98, 5, 98, 9, 4, 1, 93, 89, 0, 43, 43, 43, 43, +19, 16, 55, 54, 51, 50, 0, 21, 20, 6, 6, 35, 34, 0, 19, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, +6, 68, -92, -119, -59, -37, 1, 22, 123, -21, -117, -33, -2, -19, -71, -78, -121, -122, -78, -77, -123, -121, -78, 2, 19, +1, 39, -114, 118, -2, -31, -3, -51, -21, -126, 1, 30, 1, 13, -52, -53, -52, -47, -59, -53, -54, 0, 2, 0, -121, +-2, 105, 4, 33, 4, 62, 0, 18, 0, 30, 1, 98, 64, -114, 12, 16, 45, 16, 61, 16, 75, 16, 4, 63, 32, +-80, 32, 2, 31, 32, 41, 12, 35, 29, 50, 21, 50, 29, 66, 29, 112, 32, -112, 32, 8, 58, 23, 58, 27, 74, +23, 74, 27, 89, 8, 91, 12, 92, 23, 92, 27, 106, 8, 107, 12, 105, 16, 109, 23, 107, 27, -64, 32, -45, 20, +-35, 24, -35, 26, -45, 30, -28, 20, -28, 30, -32, 32, -1, 32, 22, 35, 4, 43, 16, 43, 21, 53, 4, 58, 16, +70, 4, 74, 16, 90, 16, -27, 11, -21, 29, -2, 16, 11, 17, 14, 3, 22, 28, 28, 6, 7, 1, 6, 22, 28, +14, 11, 0, 14, 25, 36, -48, 10, 1, 16, 10, 64, 10, 96, 10, -128, 10, 4, 32, 64, 11, 11, 2, 85, 32, +64, 13, 13, 2, 85, 10, -72, -1, -26, 64, 11, 15, 15, 2, 85, 10, 24, 13, 13, 2, 85, 10, -72, -1, -6, +-76, 12, 12, 2, 85, 10, -72, -1, -18, -76, 11, 11, 6, 85, 10, -72, -1, -12, -76, 15, 15, 6, 85, 10, -72, +-1, -24, 64, 35, 12, 12, 6, 85, 10, 116, 1, 19, 51, 2, 51, 18, 37, 0, 0, -64, 1, 1, -112, 1, -96, +1, -80, 1, -16, 1, 4, 31, 1, 63, 1, 79, 1, 3, 1, -72, -1, -4, 64, 29, 14, 14, 2, 85, 1, 16, +13, 13, 2, 85, 1, 16, 12, 12, 2, 85, 1, 16, 11, 11, 2, 85, 1, 12, 11, 11, 6, 85, 1, -72, -1, +-10, -76, 16, 16, 6, 85, 1, -72, -1, -4, 64, 22, 15, 15, 6, 85, 1, 12, 12, 12, 6, 85, 1, 18, 13, +13, 6, 85, 1, 25, 31, 71, 55, 24, 1, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, +114, 60, 77, 16, -3, -12, -28, 16, -3, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, -19, 0, 63, 63, -19, 63, +63, -19, 17, 57, 18, 57, 49, 48, 0, 93, 1, 93, 113, 114, 0, 113, 19, 17, 51, 21, 54, 54, 51, 50, 22, +22, 21, 20, 2, 6, 35, 34, 38, 39, 17, 3, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, -121, -92, 58, +-110, 104, -120, -48, 106, 117, -33, 123, 90, -113, 46, 17, -90, 118, 120, -85, -89, 116, 115, -79, -2, 105, 5, -67, -118, +81, 81, -116, -1, -104, -93, -2, -5, -117, 76, 58, -3, -5, 3, -92, -51, -60, -53, -43, -53, -54, -41, 0, 0, 2, +0, 72, -2, 105, 3, -32, 4, 62, 0, 16, 0, 28, 1, 54, 64, -114, 11, 2, 43, 2, 42, 24, 59, 2, 75, +2, 121, 12, 6, 63, 21, 63, 25, 75, 25, -112, 30, -96, 30, 5, 52, 19, 52, 27, 63, 30, 68, 19, 68, 27, +83, 19, 83, 27, 99, 19, 99, 27, 96, 30, -128, 30, -44, 6, -43, 18, -26, 6, -23, 12, -22, 24, 16, 41, 2, +34, 12, 43, 21, 57, 2, 53, 12, 73, 2, 70, 12, 90, 2, 105, 2, -39, 12, -37, 24, -29, 22, -23, 25, -26, +27, -4, 2, 15, 1, 4, 13, 20, 26, 28, 11, 7, 14, 6, 20, 28, 4, 11, 0, 14, 23, 14, 51, 0, 37, +16, 16, -48, 15, 1, 16, 15, 64, 15, 96, 15, -128, 15, 4, 30, 64, 11, 12, 2, 85, 30, 64, 13, 13, 2, +85, 15, 18, 16, 16, 2, 85, 15, -72, -1, -12, 64, 17, 15, 15, 2, 85, 15, 6, 14, 14, 2, 85, 15, 22, +13, 13, 2, 85, 15, -72, -1, -2, 64, 11, 12, 12, 2, 85, 15, 22, 16, 16, 6, 85, 15, -72, -1, -24, -76, +12, 12, 6, 85, 15, -72, -1, -12, 64, 63, 13, 13, 6, 85, 15, 116, 17, 36, -65, 7, -49, 7, -33, 7, -1, +7, 4, 31, 7, 63, 7, 79, 7, 3, 7, 36, 11, 11, 2, 85, 7, 26, 12, 12, 2, 85, 7, 34, 13, 13, +2, 85, 7, 22, 12, 12, 6, 85, 7, 26, 13, 13, 6, 85, 7, 25, 29, 30, 116, 33, 52, 80, 24, 43, 43, +78, -12, 43, 43, 43, 43, 43, 93, 113, 77, -19, -3, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 60, +16, -3, -12, 60, 0, 63, 63, -19, 63, 63, -19, 17, 57, 18, 57, 49, 48, 0, 93, 1, 93, 113, 0, 113, 1, +17, 6, 6, 35, 34, 0, 17, 52, 54, 54, 51, 50, 23, 53, 51, 17, 1, 20, 22, 51, 50, 54, 53, 52, 38, +35, 34, 6, 3, 44, 42, -105, 85, -67, -2, -17, 111, -45, 126, -59, 113, -94, -3, 33, -84, 120, 115, -90, -81, 118, +117, -93, -2, 105, 2, 8, 59, 78, 1, 46, 1, 7, -96, -2, -125, -90, -114, -6, 67, 3, -83, -51, -51, -61, -57, +-44, -42, -57, 0, 0, 1, 0, -123, 0, 0, 2, -58, 4, 62, 0, 17, 0, -55, 64, 59, 47, 19, 1, 16, 4, +1, 35, 4, 52, 4, 67, 4, 83, 4, 102, 4, 116, 4, 6, 9, 17, 8, 9, 8, 9, 13, 19, 17, 9, 13, +0, 3, 8, 1, 11, 28, 6, 7, 1, 6, 0, 10, 9, 40, -112, 8, 1, 8, 34, 32, 19, 1, 19, 2, 34, +17, 37, 1, 0, -72, -1, -64, 64, 16, 51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, +-72, -1, -8, -76, 16, 16, 2, 85, 0, -72, -1, -8, 64, 17, 14, 14, 2, 85, 0, 4, 12, 12, 2, 85, 0, +6, 11, 11, 2, 85, 0, -72, -1, -4, -76, 16, 16, 6, 85, 0, -72, -1, -12, 64, 22, 15, 15, 6, 85, 0, +6, 12, 12, 6, 85, 0, 8, 13, 13, 6, 85, 0, 78, 18, 71, -60, 24, 43, 16, -10, 43, 43, 43, 43, 43, +43, 43, 43, 93, 113, 43, 60, -3, -28, 16, 93, -12, 114, -28, 0, 63, 63, 63, -19, 17, 57, 57, 17, 57, 57, +1, 17, 18, 57, 57, 0, 16, -55, -121, 14, 125, -60, 49, 48, 0, 93, 114, 1, 93, 51, 17, 51, 21, 54, 54, +51, 50, 23, 7, 38, 35, 34, 6, 7, 6, 21, 17, -123, -94, 62, 105, 63, 91, 94, 62, 66, 66, 59, 94, 20, +30, 4, 38, -95, 113, 72, 58, -89, 39, 71, 63, 96, 114, -3, -44, 0, 0, 1, 0, 63, -1, -24, 3, -79, 4, +62, 0, 48, 3, 23, 64, 123, 4, 34, 20, 34, 58, 9, 74, 9, 68, 36, 86, 34, 101, 34, 124, 9, -114, 9, +-124, 36, -90, 19, -85, 44, -62, 3, 13, 9, 23, 26, 24, 23, 48, 75, 44, -42, 23, 5, 27, 2, 85, 2, 2, +16, 50, 1, 10, 24, 92, 8, 92, 9, 92, 10, 92, 11, 92, 12, 92, 13, 106, 8, 106, 9, 106, 10, 106, 11, +106, 12, 106, 13, -76, 38, -76, 39, 15, 39, 38, 36, 39, 36, 41, 54, 36, 90, 10, 89, 11, 100, 38, 100, 40, +116, 35, 116, 36, -128, 36, -109, 10, -100, 12, -110, 40, -105, 44, -107, 48, -92, 10, -87, 12, -93, 39, -92, 40, -77, +38, -59, 38, 22, 40, -72, -1, -12, -76, 13, 13, 6, 85, 34, -72, -1, -12, -76, 13, 13, 6, 85, 35, -72, -1, +-12, -76, 13, 13, 6, 85, 36, -72, -1, -12, -76, 13, 13, 6, 85, 40, -72, -1, -12, -76, 12, 12, 6, 85, 34, +-72, -1, -12, -76, 12, 12, 6, 85, 35, -72, -1, -12, -76, 12, 12, 6, 85, 36, -72, -1, -12, -76, 12, 12, 6, +85, 29, -72, -1, -34, 64, 18, 30, 57, 90, 8, 39, 37, 12, 10, 4, 26, 32, 38, 21, 4, 11, 46, 29, 26, +-72, 2, -86, 64, 34, 25, 44, 11, 11, 2, 85, 31, 25, 63, 25, 79, 25, 95, 25, -81, 25, -49, 25, 6, 15, +25, 31, 25, 111, 25, -33, 25, 4, 31, 25, -113, 25, 2, 25, -67, 2, 85, 0, 21, 0, 0, 2, -86, 0, 1, +-1, -64, 64, 20, 11, 11, 2, 85, 16, 1, 64, 1, 2, 16, 1, -48, 1, 2, 0, 1, 16, 1, 2, 1, -72, +-1, -64, -77, 20, 22, 52, 1, -72, -1, -64, 64, 16, 14, 17, 52, 1, 1, 46, 92, 29, 108, 29, 2, 29, 28, +21, 7, 4, -72, -1, -12, -76, 11, 11, 2, 85, 4, -72, -1, -26, -76, 16, 16, 6, 85, 4, -72, -1, -26, 64, +19, 15, 15, 6, 85, 4, 28, 46, 11, 31, 26, 1, 26, 36, 25, 64, 19, 24, 52, 50, -72, -1, -64, 64, 47, +15, 15, 2, 85, 25, 24, 15, 15, 2, 85, 25, 24, 13, 13, 2, 85, 25, 22, 12, 12, 2, 85, 25, 32, 16, +16, 6, 85, 25, 32, 15, 15, 6, 85, 25, 16, 12, 12, 6, 85, 25, 22, 13, 13, 6, 85, 25, -72, 2, 91, +-78, 7, 36, 42, -72, -1, -64, -75, 28, 57, -48, 42, 1, 42, -72, -1, -26, -76, 12, 12, 2, 85, 42, -72, -1, +-24, -76, 15, 15, 2, 85, 42, -72, -1, -24, -76, 12, 12, 6, 85, 42, -72, -1, -22, -74, 13, 13, 6, 85, 42, +26, 50, -72, -1, -64, 64, 33, 39, 42, 52, 96, 50, -64, 50, 2, 63, 50, -128, 50, 2, 50, 16, 1, 1, 1, +36, 0, 24, 13, 13, 2, 85, 0, 16, 13, 13, 6, 85, 0, 32, -72, -1, -12, -76, 13, 13, 2, 85, 32, -72, +-1, -12, -76, 16, 16, 6, 85, 32, -72, -1, -12, 64, 25, 15, 15, 6, 85, 32, 36, 15, 16, 11, 11, 2, 85, +15, 22, 12, 12, 2, 85, 15, 32, 13, 13, 2, 85, 15, -72, -1, -6, 64, 32, 15, 15, 2, 85, 15, 14, 12, +12, 6, 85, 15, 12, 13, 13, 6, 85, 15, 34, -33, 0, 1, 63, 0, 79, 0, 2, 0, 25, 49, 52, 55, 24, +43, 78, 16, -12, 93, 113, 77, -12, 43, 43, 43, 43, 43, 43, -19, 43, 43, 43, 16, 43, 43, -19, 114, 78, 16, +93, 113, 43, -10, 43, 43, 43, 43, 113, 43, 77, -19, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 114, 0, +63, -19, 43, 43, 43, 63, -19, 113, 18, 57, 47, 43, 43, 93, 113, 114, 43, -28, 16, -3, 93, 113, 114, 43, -28, +17, 18, 57, 17, 18, 57, 1, 17, 18, 23, 57, 49, 48, 67, 121, 64, 64, 39, 45, 30, 35, 5, 20, 44, 38, +17, 16, 18, 16, 19, 16, 3, 6, 34, 13, 32, 27, 0, 9, 40, 7, 27, 1, 5, 45, 7, 27, 1, 30, 20, +32, 27, 0, 33, 14, 35, 27, 0, 34, 35, 13, 12, 8, 41, 10, 27, 1, 40, 39, 9, 10, 6, 43, 4, 27, +0, 31, 16, 29, 27, 1, 0, 43, 43, 16, 60, 16, 60, 43, 16, 60, 16, 60, 43, 1, 43, 43, 43, 43, 42, +43, -127, -127, -127, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 1, 93, 114, 113, 93, 19, 55, 22, 22, +51, 50, 54, 53, 52, 39, 38, 39, 46, 2, 53, 52, 54, 55, 54, 54, 51, 50, 22, 22, 23, 7, 38, 38, 35, +34, 6, 21, 20, 23, 22, 23, 22, 23, 30, 2, 21, 20, 6, 6, 35, 34, 38, 63, -78, 15, -119, 123, 124, 120, +53, 37, -109, -58, -103, 79, 65, 56, 42, -111, 83, 125, -67, 90, 17, -80, 12, 115, 105, 124, 106, 22, 22, 47, 27, +-124, -65, -105, 86, 105, -58, 125, -49, -39, 1, 61, 28, 107, 114, 101, 68, 61, 35, 24, 37, 50, 73, -127, 78, 71, +121, 40, 31, 43, 72, 123, 103, 24, 82, 92, 82, 55, 35, 28, 29, 19, 10, 36, 51, 65, 124, 92, 90, -97, 87, +-84, 0, 0, 1, 0, 36, -1, -14, 2, 42, 5, -103, 0, 23, 0, -40, -71, 0, 10, -1, -64, -77, 35, 38, 52, +9, -72, -1, -64, 64, 65, 35, 38, 52, -128, 25, 1, 0, 1, 12, 13, 10, 1, 3, 0, 22, 16, 9, 43, 15, +10, 6, 22, 28, 3, 11, 15, 16, 34, 0, 34, 1, 13, 18, 37, 12, 1, -1, 7, 8, 69, 9, 69, 96, 7, +112, 7, -128, 7, -112, 7, 4, 0, 7, 32, 7, -96, 7, -80, 7, -64, 7, -48, 7, 6, 7, -72, -1, -18, -76, +16, 16, 2, 85, 7, -72, -1, -12, -76, 15, 15, 2, 85, 7, -72, -1, -14, -76, 14, 14, 2, 85, 7, -72, -1, +-8, -76, 13, 13, 2, 85, 7, -72, -1, -8, -76, 12, 12, 2, 85, 7, -72, -1, -6, -76, 16, 16, 6, 85, 7, +-72, -1, -16, 64, 11, 15, 15, 6, 85, 7, 6, 12, 12, 6, 85, 7, -72, -1, -24, -76, 13, 13, 6, 85, 7, +-70, 2, 106, 0, 24, 1, 54, -79, 102, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, -12, +-28, 16, -19, 60, -3, 60, 16, -28, -12, 60, 0, 63, -19, 63, 60, -3, 60, 17, 57, 18, 57, 17, 51, 51, 16, +-55, 49, 48, 1, 93, 43, 43, 37, 23, 6, 35, 34, 38, 38, 53, 17, 35, 53, 51, 17, 55, 17, 51, 21, 35, +17, 20, 22, 22, 51, 50, 2, 16, 26, 76, 60, 98, 108, 44, -124, -124, -77, -75, -75, 19, 43, 40, 30, -95, -97, +16, 62, 101, -94, 2, 99, -116, 1, 7, 108, -2, -115, -116, -3, -109, 77, 44, 26, 0, 0, 1, 0, -125, -1, -24, +3, -32, 4, 38, 0, 24, 1, 79, -71, 0, 26, -1, -64, 64, 9, 21, 23, 52, 2, 32, 19, 22, 52, 15, -72, +-1, -16, 64, 51, 18, 20, 52, 43, 19, 1, 36, 8, 19, 22, 12, 1, 19, 22, 11, 6, 0, 10, 17, 28, 3, +11, 0, 51, 22, 37, 24, 23, 64, 51, 54, 52, 26, 64, 16, 16, 2, 85, 23, 40, 16, 16, 2, 85, 23, 18, +14, 14, 2, 85, 23, -72, -1, -20, 64, 11, 13, 13, 2, 85, 23, 4, 12, 12, 2, 85, 23, -72, -1, -12, 64, +11, 11, 11, 6, 85, 23, 20, 16, 16, 6, 85, 23, -72, -1, -8, 64, 11, 13, 13, 6, 85, 23, 12, 15, 15, +6, 85, 23, -72, -1, -10, 64, 13, 12, 12, 6, 85, -1, 23, 1, -64, 23, 1, 23, 78, 26, -72, -1, -64, 64, +21, 52, 54, 52, -80, 26, -16, 26, 2, 112, 26, -96, 26, -80, 26, -1, 26, 4, 26, 12, 37, 9, -72, -1, -64, +64, 16, 51, 54, 52, -16, 9, 1, 0, 9, 32, 9, -48, 9, -32, 9, 4, 9, -72, -1, -8, -76, 16, 16, 2, +85, 9, -72, -1, -8, 64, 17, 14, 14, 2, 85, 9, 4, 12, 12, 2, 85, 9, 10, 11, 11, 6, 85, 9, -72, +-1, -10, 64, 22, 15, 15, 6, 85, 9, 2, 12, 12, 6, 85, 9, 2, 13, 13, 6, 85, 9, 78, 25, 71, 80, +24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 93, 113, 43, -19, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 60, -3, -28, 0, 63, -19, 63, 63, 60, 57, 57, 1, 17, 18, 57, 49, 48, +67, 121, 64, 26, 4, 16, 14, 13, 15, 13, 2, 6, 7, 8, 6, 8, 5, 8, 3, 6, 16, 4, 12, 27, 0, +13, 8, 17, 27, 0, 0, 43, 1, 43, 42, 42, -127, 0, 93, 1, 43, 43, 43, 33, 53, 6, 35, 34, 38, 38, +39, 38, 53, 17, 51, 17, 20, 23, 22, 22, 51, 50, 54, 54, 53, 17, 51, 17, 3, 63, 124, -43, 94, -93, 79, +16, 11, -76, 11, 17, 110, 81, 81, -114, 59, -76, -100, -76, 72, 109, 79, 53, 115, 2, -110, -3, -77, -115, 49, 71, +81, 83, -113, -120, 2, 57, -5, -38, 0, 1, 0, 26, 0, 0, 3, -24, 4, 38, 0, 10, 1, -22, -79, 2, 2, +67, 84, 88, 64, 23, 5, 8, 0, 10, 8, 6, 1, 6, 10, 0, 5, 9, 8, 5, 1, 2, 5, 36, 15, 15, +2, 85, 5, 47, 43, -35, -51, 16, -35, -51, 17, 51, 51, 0, 63, 63, 63, 18, 57, 49, 48, 27, -73, 53, 5, +1, 0, 34, 17, 57, 10, -72, -1, -34, 64, 13, 17, 57, 9, 22, 18, 28, 52, 8, 22, 18, 28, 52, 2, -72, +-1, -22, -77, 18, 28, 52, 1, -72, -1, -22, -77, 18, 28, 52, 10, -72, -1, -40, 64, 9, 30, 33, 52, 0, 40, +30, 33, 52, 10, -72, -1, -24, 64, 9, 34, 37, 52, 0, 22, 34, 37, 52, 10, -72, -1, -38, 64, 126, 40, 46, +52, 0, 32, 40, 46, 52, 15, 12, 41, 0, 40, 9, 38, 10, 57, 0, 53, 10, 72, 0, 71, 10, 86, 1, 86, +2, 89, 8, 88, 9, 102, 1, 102, 2, 105, 8, 105, 9, 120, 0, 119, 1, 119, 2, 121, 8, 120, 9, 119, 10, +-121, 1, -121, 2, -122, 3, -119, 7, -120, 8, -118, 9, -99, 0, -104, 9, -111, 10, -84, 0, -94, 10, -67, 0, -73, +7, -79, 10, -55, 0, -59, 10, -38, 0, -43, 10, -20, 0, -29, 10, -5, 0, -12, 10, 44, 10, 0, 5, 10, 24, +0, 22, 10, 40, 0, 38, 10, 55, 10, 79, 0, 64, 10, 9, 5, 64, 18, 22, 52, 5, 64, 11, 13, 52, -79, +6, 2, 67, 84, 88, 64, 9, 5, 1, 0, 8, 6, 1, 6, 0, 10, -72, -1, -12, 64, 15, 13, 13, 6, 85, +10, 0, 12, 13, 13, 6, 85, 0, 5, 9, 8, -72, -1, -12, 64, 18, 13, 13, 6, 85, 8, 5, 1, 2, 12, +13, 13, 6, 85, 2, 5, 5, 12, 11, 17, 18, 57, 47, -35, 43, -51, 16, -35, 43, -51, 16, -51, 43, -51, 43, +0, 47, 63, 63, 17, 18, 57, 49, 48, 27, 64, 55, 10, 7, 8, 8, 37, 9, 10, 20, 9, 9, 10, 0, 3, +2, 2, 37, 1, 0, 20, 1, 1, 0, 5, 10, 10, 0, 10, 9, 8, 8, 2, 2, 1, 6, 7, 10, 9, 3, +0, 1, 5, 47, 12, 1, 12, 34, 8, 64, 64, 64, 9, -128, 9, 2, 9, -72, 1, 27, -75, 64, 5, -128, 5, +2, 5, -72, 1, 27, 64, 9, 32, 2, 64, 1, 34, 11, -22, -46, 24, 43, 16, -10, -19, 26, 25, -3, 93, -3, +93, 26, 24, -19, -28, 93, 17, 18, 57, 57, 18, 57, 57, 0, 63, 60, 16, 60, 16, 60, 63, 60, 17, 57, -121, +5, 46, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, -60, 89, 49, 48, 0, 43, 43, 1, 113, 93, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 93, 89, 33, 1, 51, 19, 22, 23, 54, 55, 19, 51, 1, 1, -82, +-2, 108, -66, -28, 37, 31, 24, 43, -20, -71, -2, 110, 4, 38, -3, -124, 103, 111, 84, 118, 2, -120, -5, -38, 0, +0, 1, 0, 6, 0, 0, 5, -73, 4, 38, 0, 18, 4, 29, -79, 2, 2, 67, 84, 88, -71, 0, 18, -1, -12, +64, 17, 13, 13, 2, 85, 7, 6, 13, 13, 2, 85, 0, 6, 13, 13, 2, 85, 10, -72, -1, -44, -76, 12, 13, +2, 85, 4, -72, -1, -24, 64, 11, 12, 13, 2, 85, 17, 32, 12, 13, 2, 85, 10, -72, -1, -64, -76, 14, 16, +2, 85, 4, -72, -1, -64, 64, 47, 14, 16, 2, 85, 17, 64, 14, 16, 2, 85, 4, 10, 17, 3, 1, 0, 12, +6, 7, 6, 1, 6, 15, 10, 0, 10, 13, 12, 6, 12, 12, 2, 85, 12, 17, 1, 2, 4, 10, 4, 17, 10, +12, 12, 2, 85, 17, -72, -1, -8, -76, 13, 13, 2, 85, 17, 47, 43, 43, -51, -51, 16, -42, -51, 16, -44, 43, +-51, 0, 63, 63, 63, 63, 63, 17, 18, 23, 57, 49, 48, 0, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 27, +64, 22, 15, 20, 1, 42, 4, 41, 10, 2, 74, 17, 91, 17, -114, 17, 3, 17, 32, 13, 13, 6, 85, 10, -72, +-1, -32, -76, 13, 13, 6, 85, 4, -72, -1, -32, -76, 13, 13, 6, 85, 17, -72, -1, -16, 64, 9, 31, 33, 52, +16, 28, 29, 39, 52, 9, -72, -1, -16, 64, -73, 31, 36, 52, 4, 6, 12, 9, 19, 6, 27, 9, 25, 18, 5, +4, 0, 4, 6, 11, 9, 11, 14, 8, 18, 16, 0, 19, 3, 20, 7, 28, 8, 27, 11, 29, 14, 36, 0, 37, +7, 42, 8, 43, 14, 52, 0, 53, 7, 58, 8, 59, 14, 68, 3, 71, 6, 64, 7, 77, 8, 75, 11, 67, 15, +71, 17, 74, 18, 91, 15, 82, 18, 107, 7, 100, 8, 103, 18, 121, 6, 122, 7, 116, 8, -71, 6, -70, 15, -74, +18, -11, 6, -5, 9, 40, 11, 17, 40, 0, 40, 13, 39, 14, 40, 15, 39, 18, 47, 20, 56, 0, 55, 18, 119, +8, -122, 8, -104, 3, -105, 12, -89, 1, -88, 2, -88, 11, -90, 12, -75, 0, -74, 6, -70, 14, -56, 4, -42, 6, +-39, 9, -24, 4, -24, 15, -25, 18, -12, 6, -6, 9, 28, 11, 6, 13, 13, 6, 85, 12, 6, 13, 13, 6, 85, +16, 6, 13, 13, 6, 85, 14, 6, 13, 13, 6, 85, 15, 6, 13, 13, 6, 85, 18, -79, 6, 2, 67, 84, 88, +64, 27, 10, 14, 15, 4, 18, 0, 17, 8, 7, 8, 37, 7, 15, 37, 14, 18, 37, 0, 0, 14, 7, 3, 13, +1, 12, 37, 13, -72, -1, -42, 64, 55, 11, 11, 6, 85, 13, 2, 37, 1, 42, 11, 11, 6, 85, 1, 13, 1, +20, 19, 6, 10, 11, 17, 38, 10, 43, 17, 84, 4, 82, 10, 92, 17, 108, 17, 124, 17, -118, 17, 10, 17, 10, +4, 3, 0, 1, 15, 10, 0, 10, 12, 6, 7, 6, 1, 6, 0, 63, 63, 63, 63, 63, 17, 18, 23, 57, 93, +1, 17, 18, 57, 57, 47, 43, -12, 47, 43, -12, 17, 18, 23, 57, 16, -28, 16, -28, 16, -28, 17, 18, 57, 17, +18, 57, 17, 18, 57, 27, 64, 20, 3, 5, 5, 2, 6, 7, 7, 5, 9, 10, 10, 8, 11, 12, 12, 10, 16, +17, 17, 15, -72, -1, 75, -77, 5, 0, 18, 32, -72, -1, 73, 64, 102, 10, 15, 14, 32, -61, 17, 7, 8, 32, +7, 17, 18, 18, 43, 5, 7, 20, 5, 5, 7, 14, 10, 12, 12, 37, 13, 14, 20, 13, 13, 14, 8, 17, 15, +15, 43, 10, 8, 20, 10, 10, 8, 0, 5, 2, 2, 37, 1, 0, 20, 1, 1, 0, 0, 2, 1, 7, 18, 4, +8, 15, 17, 12, 14, 13, 10, 17, 10, 4, 3, 18, 13, 12, 12, 8, 8, 7, 7, 2, 2, 1, 6, 18, 15, +15, 14, 14, 0, 10, 20, -10, 16, 13, 1, 96, 13, 112, 13, -128, 13, 3, 13, -72, 1, -89, 64, 10, 32, 79, +10, 1, 111, 10, 127, 10, 2, 10, -72, 2, 85, 64, 9, 79, 17, 1, 111, 17, 127, 17, 2, 17, -72, 2, 85, +64, 11, 16, 5, 1, 96, 5, 112, 5, -128, 5, 3, 5, -72, 1, -89, -75, 1, -10, 19, -10, 102, 24, 43, 78, +16, -12, 25, 77, -12, 93, 93, 24, -3, 93, 113, -3, 93, 113, 26, 25, -3, 93, 93, 24, -26, 0, 63, 60, 16, +60, 16, 60, 63, 60, 16, 60, 16, 60, 16, 60, 16, 60, 18, 23, 57, 1, 17, 18, 57, 57, 18, 57, 57, 17, +57, 57, 18, 57, 57, -121, 77, 46, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, -60, -121, 46, 24, 43, -121, 125, +-60, -121, 46, 24, 43, -121, 125, -60, 43, 43, 43, -121, 14, 16, -60, 7, 14, 16, 60, 7, 14, 16, 60, -121, 14, +16, -60, -121, 14, 16, -60, 75, -80, 31, 83, 88, -76, 13, 32, 12, 32, 2, -68, -1, -32, 0, 1, -1, -32, 0, +14, -1, -48, -76, 0, 48, 15, 32, 18, -72, -1, -32, 1, 56, 56, 56, 56, 56, 56, 56, 56, 89, 75, -80, 52, +83, 88, -71, 0, 8, -1, -48, -79, 7, 48, 1, 56, 56, 89, 75, -80, 33, 83, 75, -80, 51, 81, 90, 88, -71, +0, 8, -1, -32, -79, 7, 32, 1, 56, 56, 89, 75, -80, 18, 83, 75, -80, 30, 81, 90, 88, -71, 0, 14, -1, +-48, -74, 15, 32, 13, 32, 12, 32, 8, -72, -1, -48, -78, 7, 48, 18, -72, -1, -32, -78, 0, 56, 2, -70, -1, +-32, 0, 1, -1, -32, 1, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 89, 75, -80, 18, 83, 75, -80, 23, 81, +90, 88, -71, 0, 17, -1, -32, -77, 10, 32, 4, 32, 0, 56, 56, 56, 89, 89, 49, 48, 1, 67, 92, 88, -71, +0, 14, -1, -44, -74, 18, 57, 0, 44, 18, 57, 0, -72, -1, -44, -79, 19, 57, 43, 43, 43, 89, 43, 43, 43, +43, 43, 93, 113, 114, 43, 43, 43, 0, 43, 43, 43, 113, 93, 1, 93, 89, 33, 1, 51, 19, 23, 54, 55, 19, +51, 19, 23, 55, 19, 51, 1, 35, 3, 39, 3, 1, 75, -2, -69, -70, -87, 63, 4, 51, -87, -71, -97, 53, 61, +-74, -81, -2, -76, -69, -87, 41, -41, 4, 38, -3, -101, -28, 17, -54, 2, 110, -3, -104, -53, -51, 2, 102, -5, -38, +2, 124, -75, -4, -49, 0, 1, 0, 15, 0, 0, 3, -15, 4, 38, 0, 16, 1, -36, -79, 2, 2, 67, 84, 88, +64, 21, 15, 1, 11, 6, 4, 2, 9, 6, 2, 6, 13, 10, 0, 10, 15, 24, 15, 15, 2, 85, 15, 47, 43, +0, 63, 63, 63, 63, 17, 23, 57, 49, 48, 27, -73, 15, 18, 1, 15, 34, 25, 57, 6, -72, -1, -34, 64, 80, +25, 57, 90, 15, -106, 4, -106, 8, -103, 14, -102, 15, -64, 5, -64, 6, -64, 7, -53, 15, 9, 15, 64, 22, 57, +26, 3, 19, 9, 21, 13, 26, 16, 53, 1, 58, 11, -127, 1, -114, 11, 8, 47, 18, 87, 4, 89, 7, 89, 11, +88, 14, -105, 1, -104, 10, -104, 11, -73, 2, -72, 12, -56, 11, -54, 14, -52, 16, -38, 3, -43, 9, -47, 13, -37, +16, -27, 10, 18, 18, -79, 6, 2, 67, 84, 88, 64, 11, 12, 0, 18, 17, 15, 24, 13, 16, 6, 85, 6, -72, +-1, -24, 64, 14, 13, 16, 6, 85, 15, 6, 0, 2, 13, 0, 10, 10, 2, 6, 0, 63, 60, 63, 60, 17, 18, +57, 57, 43, 43, 1, 17, 18, 57, 57, 27, 64, 102, 6, 6, 3, 7, 8, 9, 9, 1, 6, 6, 9, 5, 4, +3, 3, 11, 15, 15, 16, 14, 13, 13, 1, 15, 15, 13, 16, 11, 1, 0, 9, 2, 13, 11, 3, 12, 16, 10, +6, 15, 2, 15, 10, 16, -58, 0, -58, 9, 2, 16, 37, 0, 9, 20, 0, 0, 9, 3, 2, 13, -58, 13, 1, +13, 37, 12, 3, 20, 12, 12, 3, 10, 9, 9, 3, 3, 2, 6, 16, 13, 13, 12, 12, 0, 10, 79, 18, 1, +18, 73, 13, 126, 12, 34, 10, 15, 97, 6, 9, 126, 64, 10, -72, 1, 27, -73, 64, 6, 80, 6, -128, 6, 3, +6, -72, 2, 67, 64, 14, 32, 3, 126, 2, 34, 79, 0, 1, 0, 73, 17, 124, -60, 24, 43, 16, -10, 93, -12, +-19, 26, 25, -3, 93, -3, 26, 24, -19, 16, -27, 16, -12, -19, -26, 93, 0, 63, 60, 16, 60, 16, 60, 63, 60, +16, 60, 16, 60, -121, 5, 46, 43, 93, -121, 125, -60, -121, 46, 24, 43, 93, 125, 16, -60, 0, 17, 18, 57, 57, +15, 15, -121, 8, -60, -121, 14, 16, -60, 8, -60, -121, 14, 16, -60, -60, 8, -60, 7, 14, 16, 60, 60, 8, 60, +89, 49, 48, 1, 67, 92, 88, -76, 14, 24, 29, 57, 11, -72, -1, -34, 64, 11, 29, 57, 12, 34, 23, 57, 3, +34, 23, 57, 11, -72, -1, -34, -78, 33, 57, 16, -72, -1, -64, 64, 10, 21, 57, 1, 34, 33, 57, 9, 64, 28, +57, 43, 43, 43, 43, 43, 43, 43, 43, 89, 93, 113, 0, 43, 93, 43, 43, 1, 93, 89, 51, 1, 1, 51, 23, +22, 23, 54, 55, 55, 51, 1, 1, 35, 3, 39, 1, 15, 1, -124, -2, -103, -31, -93, 46, 28, 44, 37, -77, -41, +-2, -111, 1, -117, -35, -38, 58, -2, -23, 2, 40, 1, -2, -7, 71, 48, 66, 51, -5, -2, 12, -3, -50, 1, 74, +89, -2, 93, 0, 1, 0, 33, -2, 81, 3, -18, 4, 38, 0, 26, 1, -9, -79, 2, 2, 67, 84, 88, 64, 29, +10, 20, 15, 3, 11, 3, 28, 25, 15, 18, 6, 11, 6, 19, 64, 18, 15, 32, 11, 64, 12, 32, 15, 24, 15, +15, 2, 85, 15, 25, 47, 43, 26, -35, 26, 24, -51, 26, 25, 16, -35, 26, 24, -51, 0, 63, 63, 63, -19, 18, +23, 57, 49, 48, 27, -77, 15, 28, 1, 15, -72, -1, -34, 64, 109, 28, 57, 40, 20, 86, 15, -81, 10, 3, 64, +13, 64, 15, 2, 15, 32, 40, 48, 52, 16, 32, 40, 48, 52, 7, 12, 9, 18, 22, 13, 24, 18, 39, 11, 39, +12, 39, 13, 54, 12, 54, 13, 53, 14, -103, 17, 11, 40, 18, 40, 19, 72, 22, 89, 18, 89, 19, 89, 21, 105, +18, 105, 19, 105, 21, 121, 6, 118, 13, 121, 17, 122, 20, 122, 21, -123, 13, -118, 17, -116, 18, -116, 19, -119, 20, +-104, 10, -88, 11, -68, 16, -69, 17, -70, 20, -22, 10, -25, 20, -11, 13, -3, 16, -7, 20, -1, 28, 30, 18, -79, +6, 2, 67, 84, 88, 64, 22, 19, 11, 28, 27, 4, 15, 68, 15, -124, 15, 3, 15, 25, 11, 3, 28, 25, 15, +18, 6, 11, 6, 0, 63, 63, 63, -19, 17, 18, 57, 93, 1, 17, 18, 57, 57, 27, 64, 55, 15, 15, 12, 16, +17, 18, 18, 10, 0, 3, 25, 20, 19, 19, 37, 18, 10, 20, 18, 18, 10, 15, 12, 15, 17, 12, 37, 11, 10, +20, 11, 11, 10, 19, 18, 18, 12, 12, 11, 6, 3, 28, 25, 15, 0, 28, 16, 28, 2, 47, 28, -65, 28, 2, +28, -72, 2, 63, -75, 15, 19, 64, 18, 64, 20, -72, 2, 84, 64, 11, 63, 18, 64, 18, 2, 95, 18, -65, 18, +2, 18, -72, 1, 66, -74, 15, 1, 34, 0, 69, 27, 10, -72, 2, 84, 64, 18, 15, 32, 11, 64, 64, 32, 12, +48, 12, 79, 12, 3, 80, 12, -1, 12, 2, 12, -72, 1, 66, -77, 47, 15, 1, 15, -72, 2, 63, -76, 27, 32, +124, 102, 24, 43, 26, 25, 16, -3, 113, -12, 93, 113, 26, 24, -19, 26, 25, 16, -19, 24, 16, -12, -28, 25, 16, +-28, 93, 113, -19, 26, 24, 16, -19, 25, 16, -28, 93, 113, 0, 24, 63, -19, 63, 60, 16, 60, 16, 60, -121, 5, +46, 43, 8, 125, 16, -60, -121, 5, 46, 24, 43, 14, 125, 16, -60, 0, 17, 18, 57, -121, 14, 16, 60, 60, 8, +-60, 75, -80, 14, 83, 75, -80, 24, 81, 90, 88, -69, 0, 12, -1, -24, 0, 11, -1, -24, 1, 56, 56, 89, 89, +49, 48, 1, 67, 92, 88, -71, 0, 20, -1, -34, -74, 55, 57, 10, 34, 55, 57, 14, -72, -1, -24, -75, 21, 57, +17, 34, 21, 57, 43, 43, 43, 43, 89, 93, 113, 43, 43, 0, 113, 93, 43, 1, 93, 89, 19, 39, 22, 51, 50, +54, 55, 54, 55, 54, 55, 1, 51, 19, 22, 23, 54, 55, 19, 51, 1, 6, 7, 6, 6, 35, 34, 127, 20, 59, +44, 60, 72, 23, 17, 38, 5, 11, -2, 109, -62, -35, 43, 34, 31, 43, -29, -76, -2, 108, 65, 36, 48, 124, 86, +52, -2, 103, -87, 16, 40, 36, 27, 107, 15, 29, 4, 40, -3, -103, 117, -127, 124, 118, 2, 107, -5, -56, -81, 66, +89, 83, 0, 0, 1, 0, 40, 0, 0, 3, -44, 4, 38, 0, 14, 1, -81, 64, 13, 18, -72, 2, -55, 8, 2, +18, 1, 50, 18, 23, 52, 8, -72, -1, -50, 64, 9, 18, 23, 52, 1, 62, 30, 33, 52, 8, -72, -1, -62, 64, +74, 30, 33, 52, 41, 2, 40, 9, 47, 16, 57, 1, 57, 10, 73, 1, 70, 2, 70, 8, 73, 9, 79, 16, 92, +1, 84, 2, 84, 8, 90, 9, 80, 16, 108, 1, 99, 2, 99, 8, 106, 9, 123, 1, 116, 8, 123, 9, -117, 1, +-123, 8, -119, 9, -7, 1, -12, 2, 27, 25, 8, 38, 1, 41, 8, 43, 9, 57, 8, -91, 8, -41, 1, 7, 16, +-72, -1, -64, -73, 16, 21, 52, 2, 44, 18, 57, 9, -72, -1, -44, 64, 35, 18, 57, 1, 2, 58, 9, 10, 2, +8, 10, 10, 37, 1, 2, 20, 1, 1, 2, 1, 13, 14, 8, 6, 2, 97, 5, 43, 7, 6, 6, 10, 97, 13, +0, 13, -72, -1, -12, 64, 9, 11, 11, 6, 85, 13, 43, 14, 10, 2, -72, 1, 15, -76, 8, 8, 7, 5, 6, +-69, 2, 91, 0, 0, 0, 7, -1, -12, 64, 22, 11, 11, 6, 85, 7, 34, 13, -96, 14, 1, 0, 14, 64, 14, +96, 14, -128, 14, -16, 14, 5, 14, -72, -1, -12, 64, 36, 11, 11, 6, 85, 14, 116, 0, 10, 126, 1, 1, -81, +0, 1, 79, 0, 111, 0, -1, 0, 3, 0, 24, 11, 11, 6, 85, 0, 25, 15, 16, 116, 33, 124, -60, 24, 43, +43, 78, -12, 43, 93, 113, 60, 77, 16, -19, 16, -3, 43, 93, 113, 60, -28, 43, 16, -12, 60, 16, 60, 16, -3, +0, 63, -19, 43, 60, 16, -27, 63, 60, -3, -27, 17, 57, 17, 18, 57, -121, 5, 46, 43, -121, 125, -60, 16, 14, +-60, 43, 49, 48, 1, 43, 43, 43, 113, 93, 0, 43, 43, 43, 43, 67, 92, 88, -75, 41, 1, 38, 8, 2, 1, +-72, -1, -50, 64, 9, 18, 23, 52, 8, 50, 18, 23, 52, 1, -72, -1, -62, -73, 30, 33, 52, 8, 62, 30, 33, +52, 0, 43, 43, 43, 43, 1, 113, 89, 1, 93, 67, 92, 88, -71, 0, 8, -1, -34, -78, 15, 57, 9, -72, -1, +-34, -78, 15, 57, 9, -72, -1, -24, -73, 27, 57, 9, 8, 22, 27, 61, 9, -72, -1, -16, -78, 23, 57, 9, -72, +-1, -8, 64, 10, 22, 57, 2, 20, 22, 57, 2, 26, 22, 57, 43, 43, 43, 43, 43, 43, 43, 43, 89, 51, 53, +1, 6, 35, 33, 53, 33, 21, 1, 7, 54, 51, 33, 21, 40, 2, -92, 115, 88, -2, 79, 3, 100, -3, -63, 111, +121, 106, 1, -21, -110, 3, 8, 6, -110, 119, -3, 94, 123, 9, -101, 0, 0, 1, 0, 57, -2, 81, 2, 124, 5, +-45, 0, 42, 0, 123, 64, 77, 71, 15, 1, 40, 18, 15, 17, 52, 2, 18, 15, 17, 52, 7, 24, 11, 14, 52, +37, 18, 11, 14, 52, 22, 39, 22, 0, 41, 42, 42, 12, 31, 37, 32, 19, 13, 37, 12, 17, 13, 12, 12, 31, +32, -82, 27, 18, 17, 37, 5, 25, 58, 27, 37, 38, 3, 58, 5, -82, 42, 39, 58, 38, -82, 42, 42, 95, 0, +-113, 0, 2, 0, 105, 43, 112, 104, 24, 43, 16, -10, 93, 60, 16, -12, -28, 16, -12, -28, 16, -3, -28, 16, -3, +60, 16, -12, 60, 60, 16, 60, 0, 63, -19, 63, -19, 18, 57, 47, -19, 57, 1, 18, 57, 49, 48, 43, 43, 43, +43, 1, 113, 19, 62, 2, 18, 55, 62, 2, 55, 54, 51, 51, 21, 35, 34, 6, 21, 16, 7, 6, 6, 7, 22, +22, 21, 20, 23, 22, 22, 51, 51, 21, 35, 34, 39, 46, 2, 2, 38, 38, 39, 57, 77, 97, 32, 2, 5, 9, +49, 72, 56, 38, 86, 56, 31, 104, 68, 11, 18, 87, 93, 110, 99, 4, 8, 65, 95, 31, 56, 98, 44, 64, 84, +25, 2, 32, 97, 77, 2, 100, 2, 79, -118, 1, 78, 53, 84, 102, 61, 16, 10, -99, 75, -126, -2, -6, 69, 107, +116, 45, 46, -67, -41, -61, 37, 68, 54, -99, 16, 23, 103, -98, 1, 104, -118, 80, 2, 0, 0, 1, 0, -68, -2, +81, 1, 89, 5, -45, 0, 3, 0, 50, -71, 0, 3, 1, 126, 64, 24, 1, 0, 5, -95, 2, 2, -97, 3, -81, +3, 2, 3, 118, 0, 0, 32, 1, 1, 1, -95, 4, -95, -104, 24, 43, 78, 16, -12, 93, 60, 77, 16, -3, 93, +60, 16, -18, 0, 63, 77, -19, 49, 48, 19, 17, 51, 17, -68, -99, -2, 81, 7, -126, -8, 126, 0, 1, 0, 47, +-2, 81, 2, 114, 5, -45, 0, 42, 0, -127, -71, 0, 3, -1, -18, -77, 15, 17, 52, 41, -72, -1, -18, -77, 15, +17, 52, 38, -72, -1, -24, -77, 11, 14, 52, 8, -72, -1, -18, 64, 57, 11, 14, 52, 23, 40, 23, 0, 41, 1, +1, 13, 32, 37, 33, 17, 14, 37, 13, 19, 33, 32, 32, 14, 13, -82, 18, 26, 58, 28, 37, 39, 20, 58, 18, +37, 6, 39, 58, 40, -82, 1, 4, 58, 6, -82, 0, 80, 1, -128, 1, 2, 1, 105, 44, -101, -115, 24, 43, 16, +-12, 93, 60, -12, -28, 16, -12, -28, 16, -3, -28, 16, -3, -28, 16, -12, 60, 60, 16, 60, 0, 63, -19, 63, -19, +18, 57, 47, -19, 57, 1, 17, 57, 49, 48, 43, 43, 43, 43, 1, 21, 14, 2, 2, 7, 14, 2, 7, 6, 35, +35, 53, 51, 50, 54, 53, 52, 55, 54, 54, 55, 38, 38, 53, 52, 39, 38, 38, 35, 35, 53, 51, 50, 23, 30, +2, 18, 22, 22, 2, 114, 77, 97, 32, 2, 5, 9, 49, 72, 56, 38, 86, 56, 31, 104, 68, 9, 16, 96, 88, +115, 94, 5, 7, 65, 95, 31, 56, 98, 44, 64, 84, 25, 2, 32, 97, 2, 100, -93, 2, 80, -119, -2, -78, 53, +85, 101, 61, 16, 11, -99, 75, -125, -6, 67, 111, -123, 37, 55, -75, -41, -61, 38, 67, 53, -99, 16, 22, 104, -98, +-2, -104, -119, 80, 0, 1, 0, 87, 2, 45, 4, 86, 3, 117, 0, 22, 0, 85, 64, 20, 11, 11, 4, 22, 27, +11, 20, 22, 4, 13, 32, 43, 12, 59, 12, 2, 12, 1, 32, 0, -72, -1, -32, 64, 14, 11, 14, 52, 0, 16, +32, 9, -44, 12, 0, -44, 20, 32, 3, -72, 2, 88, 64, 12, 12, 13, 12, 26, 24, 1, 0, 25, 23, 113, -116, +24, 43, 78, 16, -12, 60, 16, -10, 60, 0, 47, 77, -12, -3, -28, 16, -12, -19, 16, 43, -19, 16, 93, -19, 49, +48, 0, 93, 19, 53, 54, 51, 50, 22, 23, 22, 22, 51, 50, 54, 55, 21, 6, 6, 35, 34, 38, 38, 35, 34, +6, 87, 106, -84, 60, -124, 122, 69, 69, 35, 65, -117, 54, 64, -125, 82, 60, 109, -19, 79, 64, 113, 2, 45, -51, +120, 35, 52, 29, 18, 78, 59, -44, 60, 54, 28, 106, 55, 0, -1, -1, -1, -3, 0, 0, 5, 89, 6, -31, 2, +38, 0, 36, 0, 0, 1, 7, 0, -114, 1, 62, 1, 30, 0, 50, -75, 3, 2, 2, 3, 2, 22, -70, 2, 33, +0, 41, 1, 100, -123, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 15, 22, 1, 2, 65, 43, 27, 64, 10, +20, 64, 18, 20, 52, 20, 12, 100, 72, 43, 43, 43, 89, 53, 53, -1, -1, -1, -3, 0, 0, 5, 89, 6, -12, +2, 38, 0, 36, 0, 0, 1, 7, 0, -37, 1, 63, 1, 7, 0, 25, 64, 16, 3, 2, -1, 18, 1, 18, 12, +0, 104, 43, 2, 3, 2, 30, 2, 41, 0, 43, 1, 43, 113, 53, 53, 0, -1, -1, 0, 102, -2, 91, 5, 118, +5, -45, 2, 38, 0, 38, 0, 0, 1, 7, 0, -36, 1, -108, 0, 0, 0, 34, 64, 25, 1, 0, 48, 32, 48, +79, 48, 3, 47, 48, 127, 48, -113, 48, 3, 48, 4, 0, 72, 43, 1, 1, 31, 8, 41, 0, 43, 1, 43, 93, +113, 53, -1, -1, 0, -94, 0, 0, 4, -24, 7, 44, 2, 38, 0, 40, 0, 0, 1, 7, 0, -115, 1, 84, 1, +106, 0, 40, 64, 16, 1, 0, 15, 1, -48, 15, -16, 15, 2, 47, 15, -112, 15, 2, 15, 2, -72, -2, 3, -76, +72, 43, 1, 1, 15, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 93, 113, 53, -1, -1, 0, -100, 0, 0, 5, +31, 6, -5, 2, 38, 0, 49, 0, 0, 1, 7, 0, -41, 1, -89, 1, 81, 0, 75, -79, 1, 27, -72, -1, -64, +-76, 15, 15, 6, 85, 27, -72, -1, -64, 64, 29, 12, 12, 6, 85, -32, 27, -1, 27, 2, 111, 27, -81, 27, 2, +79, 27, 1, -32, 27, -1, 27, 2, 95, 27, -112, 27, 2, 27, 4, -72, -2, 122, -76, 72, 43, 1, 1, 25, -70, +2, 33, 0, 41, 1, 100, -123, 0, 43, 1, 43, 93, 93, 113, 113, 113, 43, 43, 53, 0, -1, -1, 0, 99, -1, +-25, 5, -35, 6, -31, 2, 38, 0, 50, 0, 0, 1, 7, 0, -114, 1, -57, 1, 30, 0, 44, -75, 3, 2, 2, +3, 2, 35, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 31, 32, 3, 3, 65, 43, +27, -73, -81, 32, 1, 32, 3, 100, 72, 43, 43, 93, 89, 53, 53, -1, -1, 0, -95, -1, -25, 5, 34, 6, -31, +2, 38, 0, 56, 0, 0, 1, 7, 0, -114, 1, -119, 1, 30, 0, 25, 64, 12, 2, 1, 0, 21, 28, 12, 0, +65, 1, 2, 2, 28, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, 53, 0, -1, -1, 0, 74, -1, -24, 4, 28, +5, -62, 2, 38, 0, 68, 0, 0, 1, 7, 0, -115, 0, -15, 0, 0, 0, 27, 64, 14, 2, 47, 59, 63, 59, +2, 59, 28, 0, 72, 43, 2, 1, 59, -71, 2, 34, 0, 41, 0, 43, 1, 43, 113, 53, 0, -1, -1, 0, 74, +-1, -24, 4, 28, 5, -62, 2, 38, 0, 68, 0, 0, 1, 7, 0, 67, 0, -6, 0, 0, 0, 27, 64, 14, 2, +-97, 57, -17, 57, 2, 57, 28, 10, 72, 43, 2, 1, 57, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 0, +-1, -1, 0, 74, -1, -24, 4, 28, 5, -62, 2, 38, 0, 68, 0, 0, 1, 7, 0, -42, 0, -34, 0, 0, 0, +54, 64, 38, 2, -97, 58, 1, 32, 58, 48, 58, 112, 58, -128, 58, 4, -112, 58, -96, 58, -80, 58, -32, 58, -16, +58, 5, 58, 64, 46, 50, 52, 0, 58, 61, 28, 28, 65, 2, 1, 62, -71, 2, 34, 0, 41, 0, 43, 1, 43, +43, 93, 113, 114, 53, -1, -1, 0, 74, -1, -24, 4, 28, 5, -61, 2, 38, 0, 68, 0, 0, 1, 7, 0, -114, +0, -34, 0, 0, 0, 39, 64, 24, 3, 2, 60, 64, 10, 10, 6, 85, 112, 60, -128, 60, -16, 60, 3, 60, 28, +98, 72, 43, 2, 3, 2, 63, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 43, 53, 53, 0, -1, -1, 0, 74, +-1, -24, 4, 28, 5, -86, 2, 38, 0, 68, 0, 0, 1, 7, 0, -41, 0, -34, 0, 0, 0, 56, 64, 30, 2, +73, 64, 13, 13, 6, 85, 73, 64, 10, 10, 6, 85, 73, 64, 25, 26, 52, 73, 64, 11, 13, 52, 127, 73, -113, +73, 2, 73, 28, -72, -1, -48, -76, 72, 43, 2, 1, 71, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 43, 43, +43, 43, 53, -1, -1, 0, 74, -1, -24, 4, 28, 5, -19, 2, 38, 0, 68, 0, 0, 1, 7, 0, -37, 0, -35, +0, 0, 0, 30, 64, 16, 3, 2, 15, 65, 31, 65, 2, 65, 28, 0, 104, 43, 2, 3, 2, 65, -71, 2, 34, +0, 41, 0, 43, 1, 43, 113, 53, 53, -1, -1, 0, 80, -2, 111, 3, -19, 4, 62, 2, 38, 0, 70, 0, 0, +1, 7, 0, -36, 0, -61, 0, 20, 0, 55, -79, 1, 28, -72, -1, -64, 64, 26, 20, 20, 6, 85, 31, 28, 47, +28, 2, 16, 28, 1, -17, 28, -1, 28, 2, 16, 28, 48, 28, 127, 28, 3, 28, 11, -72, -1, -104, -74, 72, 43, +1, 1, 28, 8, 41, 0, 43, 1, 43, 93, 93, 113, 114, 43, 53, 0, -1, -1, 0, 75, -1, -24, 4, 30, 5, +-62, 2, 38, 0, 72, 0, 0, 1, 7, 0, -115, 0, -13, 0, 0, 0, 27, 64, 14, 2, -32, 33, -16, 33, 2, +33, 10, 0, 72, 43, 2, 1, 33, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, 75, -1, +-24, 4, 30, 5, -62, 2, 38, 0, 72, 0, 0, 1, 7, 0, 67, 0, -35, 0, 0, 0, 38, -79, 2, 31, -72, +-1, -64, 64, 17, 11, 13, 52, 15, 31, 1, 112, 31, 1, 31, 10, 0, 72, 43, 2, 1, 31, -71, 2, 34, 0, +41, 0, 43, 1, 43, 93, 113, 43, 53, -1, -1, 0, 75, -1, -24, 4, 30, 5, -62, 2, 38, 0, 72, 0, 0, +1, 7, 0, -42, 0, -33, 0, 0, 0, 39, 64, 24, 2, 32, 64, 59, 53, 32, 64, 45, 50, 52, 15, 32, -97, +32, 2, 0, 32, 35, 10, 10, 65, 2, 1, 36, -71, 2, 34, 0, 41, 0, 43, 1, 43, 114, 43, 43, 53, 0, +-1, -1, 0, 75, -1, -24, 4, 30, 5, -61, 2, 38, 0, 72, 0, 0, 1, 7, 0, -114, 0, -33, 0, 0, 0, +35, 64, 20, 3, 2, 34, 64, 11, 11, 2, 85, -81, 34, 1, 34, 10, 100, 72, 43, 2, 3, 2, 37, -71, 2, +34, 0, 41, 0, 43, 1, 43, 93, 43, 53, 53, 0, -1, -1, 0, -67, 0, 0, 2, 46, 5, -62, 2, 38, 0, +-43, 0, 0, 1, 6, 0, -115, -33, 0, 0, 50, -73, 1, 7, 64, 11, 11, 6, 85, 7, -72, -1, -64, -77, 23, +25, 52, 7, -72, -1, -64, 64, 14, 34, 37, 52, 47, 7, 1, 7, 1, 90, 72, 43, 1, 1, 7, -71, 2, 34, +0, 41, 0, 43, 1, 43, 93, 43, 43, 43, 53, -1, -1, 0, 35, 0, 0, 1, -101, 5, -62, 2, 38, 0, -43, +0, 0, 1, 6, 0, 67, -54, 0, 0, 40, 64, 16, 1, 5, 64, 23, 25, 52, 5, 64, 34, 37, 52, 32, 5, +1, 5, 2, -72, -1, -90, -76, 72, 43, 1, 1, 5, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 43, 43, 53, +-1, -1, -1, -17, 0, 0, 2, 104, 5, -62, 2, 38, 0, -43, 0, 0, 1, 6, 0, -42, -42, 0, 0, 22, 64, +10, 1, 0, 6, 9, 1, 2, 65, 1, 1, 10, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 9, +0, 0, 2, 58, 5, -61, 2, 38, 0, -43, 0, 0, 1, 6, 0, -114, -52, 0, 0, 31, 64, 17, 2, 1, 8, +32, 11, 11, 6, 85, 8, 2, 0, 72, 43, 1, 2, 2, 11, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, 53, +53, 0, -1, -1, 0, -121, 0, 0, 3, -26, 5, -86, 2, 38, 0, 81, 0, 0, 1, 7, 0, -41, 0, -1, 0, +0, 0, 53, -77, 1, 1, 1, 38, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 23, +35, 1, 11, 65, 43, 27, -71, 0, 40, -1, -64, -73, 34, 36, 52, 79, 40, 1, 40, 18, -72, -1, -30, -79, 72, +43, 43, 93, 43, 89, 53, 0, -1, -1, 0, 68, -1, -24, 4, 39, 5, -62, 2, 38, 0, 82, 0, 0, 1, 7, +0, -115, 0, -12, 0, 0, 0, 27, 64, 14, 2, -32, 29, -16, 29, 2, 29, 4, 0, 72, 43, 2, 1, 29, -71, +2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, 68, -1, -24, 4, 39, 5, -62, 2, 38, 0, 82, +0, 0, 1, 7, 0, 67, 0, -34, 0, 0, 0, 38, -79, 2, 27, -72, -1, -64, 64, 17, 11, 13, 52, 15, 27, +1, 112, 27, 1, 27, 4, 0, 72, 43, 2, 1, 27, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 113, 43, 53, +-1, -1, 0, 68, -1, -24, 4, 39, 5, -62, 2, 38, 0, 82, 0, 0, 1, 7, 0, -42, 0, -32, 0, 0, 0, +32, 64, 18, 2, 28, 64, 46, 50, 52, -97, 28, 1, 0, 28, 31, 0, 7, 65, 2, 1, 32, -71, 2, 34, 0, +41, 0, 43, 1, 43, 114, 43, 53, -1, -1, 0, 68, -1, -24, 4, 39, 5, -61, 2, 38, 0, 82, 0, 0, 1, +7, 0, -114, 0, -32, 0, 0, 0, 42, 64, 9, 3, 2, 30, 64, 22, 22, 6, 85, 30, -72, -1, -64, 64, 13, +10, 11, 6, 85, 30, 4, 110, 72, 43, 2, 3, 2, 33, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, 43, 53, +53, -1, -1, 0, 68, -1, -24, 4, 39, 5, -86, 2, 38, 0, 82, 0, 0, 1, 7, 0, -41, 0, -32, 0, 0, +0, 48, 64, 23, 2, 47, 43, 63, 43, 2, 127, 43, -1, 43, 2, 79, 43, -113, 43, 2, 47, 43, 63, 43, 2, +43, 4, -72, -1, -20, -76, 72, 43, 2, 1, 41, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 93, 93, 113, 53, +-1, -1, 0, -125, -1, -24, 3, -32, 5, -62, 2, 38, 0, 88, 0, 0, 1, 7, 0, -115, 0, -25, 0, 0, 0, +33, 64, 19, 1, 28, 64, 14, 16, 52, 31, 28, 79, 28, 2, 28, 17, 60, 72, 43, 1, 1, 28, -71, 2, 34, +0, 41, 0, 43, 1, 43, 113, 43, 53, 0, -1, -1, 0, -125, -1, -24, 3, -32, 5, -62, 2, 38, 0, 88, 0, +0, 1, 7, 0, 67, 1, 7, 0, 0, 0, 21, 64, 10, 1, 1, 26, 17, 0, 72, 39, 1, 1, 26, -71, 2, +34, 0, 41, 0, 43, 1, 43, 0, -1, -1, 0, -125, -1, -24, 3, -32, 5, -62, 2, 38, 0, 88, 0, 0, 1, +7, 0, -42, 0, -36, 0, 0, 0, 41, -77, 1, 1, 1, 31, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, 2, +67, 84, 88, -75, 0, 27, 30, 11, 22, 65, 43, 27, -73, -113, 25, 1, 25, 17, 35, 72, 43, 43, 93, 89, 53, +0, -1, -1, 0, -125, -1, -24, 3, -32, 5, -61, 2, 38, 0, 88, 0, 0, 1, 7, 0, -114, 0, -36, 0, 0, +0, 29, 64, 15, 2, 1, 112, 25, 1, 0, 25, 31, 17, 17, 65, 1, 2, 2, 32, -71, 2, 34, 0, 41, 0, +43, 1, 43, 93, 53, 53, 0, 0, 1, 0, 73, -2, -90, 4, 30, 5, -104, 0, 11, 0, 94, 64, 51, 2, 1, +9, 10, 10, 1, 32, 4, 11, 0, 3, 4, 8, 7, 7, 4, 110, 6, 5, 0, 8, 9, 6, 7, 7, 10, 10, +9, 110, 11, 32, 0, 5, 4, 4, 1, 1, 0, 110, 3, 64, 2, -112, 2, 2, 2, 62, 12, 112, -116, 24, 43, +16, -12, 93, 60, -12, 60, 16, 60, 16, 60, 16, -3, -28, 60, 16, 60, 16, 60, 16, 60, 0, 63, 60, -12, 60, +16, 60, 16, 60, 47, 60, 16, -3, 60, 16, 60, 16, 60, 49, 48, 1, 17, 33, 53, 33, 17, 51, 17, 33, 21, +33, 17, 1, -40, -2, 113, 1, -113, -76, 1, -110, -2, 110, -2, -90, 4, -68, -96, 1, -106, -2, 106, -96, -5, 68, +0, 0, 2, 0, -128, 3, -88, 2, -85, 5, -45, 0, 11, 0, 23, 0, 59, -71, 0, 15, 2, -115, -75, 0, 9, +1, 9, -125, 21, -72, 2, -115, -78, 3, 1, 18, -72, 2, -115, -75, 15, 6, 1, 6, -125, 12, -72, 2, -115, 64, +9, 32, 0, 1, 0, -84, 24, -99, 121, 24, 43, 16, -10, 93, -19, -3, 93, -19, 0, 63, -19, -3, 93, -19, 49, +48, 19, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, +-128, -93, 114, 116, -94, -93, 115, 114, -93, 109, 99, 70, 69, 99, 99, 69, 70, 99, 4, -66, 115, -94, -94, 115, 115, +-93, -94, 116, 70, 99, 99, 70, 70, 99, 99, 0, 2, 0, 107, -2, 103, 4, 10, 5, -70, 0, 32, 0, 42, 1, +-127, 64, -106, 21, 27, 20, 28, 2, 54, 1, 93, 4, 88, 16, 104, 15, 104, 24, 104, 33, 120, 15, 115, 28, 117, +29, -119, 41, -87, 33, -26, 1, -24, 15, -24, 27, -8, 32, -7, 33, -8, 35, 17, 72, 25, 74, 29, 73, 32, 104, +25, 104, 29, 104, 42, 6, 74, 9, 75, 32, 105, 15, 107, 32, 121, 15, -90, 0, -91, 17, -87, 41, -87, 42, -26, +14, 10, 69, 30, 102, 5, 101, 30, 3, 29, 8, 31, 20, 16, 16, 2, 85, 15, 15, 16, 24, 33, 42, 42, 41, +25, 25, 14, 0, 0, 32, 1, 1, 3, 12, 12, 10, 27, 27, 28, 26, 26, 13, 42, 33, 31, 27, 24, 15, 12, +1, 0, 9, 39, 30, 7, 6, 15, 12, 1, 42, 7, 3, 31, 30, 0, 3, 33, 6, 27, 24, 35, 25, 26, 13, +25, 26, 13, -72, 2, 94, 64, 23, 14, 25, 20, 14, 14, 25, 13, 14, 14, 18, 13, 25, 39, 26, 7, 6, 14, +10, 13, 26, 25, 22, 7, -72, 2, -86, 64, 56, 6, 6, 12, 24, 25, 0, 33, 51, 35, 28, 22, 7, 24, 7, +12, 11, 3, 28, 10, 11, 14, 14, 6, 36, 7, 26, 44, 39, 36, 18, 6, 13, 13, 2, 85, 18, 10, 12, 12, +2, 85, 18, 20, 11, 11, 2, 85, 31, 18, 63, 18, 2, 18, 25, 43, -26, -70, 1, 48, 0, 24, 1, 28, -123, +43, 78, 16, -12, 93, 43, 43, 43, 77, -19, 78, 16, -10, 77, -19, 0, 63, 63, -19, 63, 63, 63, -3, -28, 63, +17, 18, 57, 47, -28, 17, 18, 57, 17, 18, 57, 1, 17, 18, 57, 18, 57, 57, 17, 57, 8, -121, 46, 43, 8, +-121, 125, -60, 0, 17, 18, 57, 17, 18, 23, 57, 17, 18, 57, 57, 18, 57, 1, 17, 18, 57, 18, 23, 57, -121, +16, 8, 60, 8, -60, 8, 60, 8, 60, -121, 16, 8, 60, 5, 60, 60, 8, 60, 1, 43, 49, 48, 24, 67, 121, +64, 18, 36, 38, 19, 21, 37, 37, 20, 38, 36, 21, 39, 29, 0, 38, 19, 35, 29, 1, 0, 43, 1, 43, 43, +43, -127, -127, 0, 113, 93, 1, 113, 93, 0, 114, 1, 3, 22, 51, 50, 54, 55, 23, 6, 6, 35, 34, 39, 3, +39, 19, 38, 2, 53, 52, 54, 54, 51, 50, 23, 19, 23, 3, 22, 22, 23, 7, 38, 39, 38, 35, 34, 6, 6, +21, 20, 22, 23, 2, -24, -34, 33, 28, 104, -105, 17, -77, 33, -9, -88, 49, 54, 118, 112, 115, 115, -110, 117, -23, +121, 36, 64, 113, 110, 112, 99, 106, 21, -81, 26, -80, 32, 18, 82, -113, 71, 64, 59, 3, 126, -3, 2, 9, -114, +-128, 20, -71, -44, 14, -2, 117, 32, 1, -114, 55, 1, 1, -63, -78, -1, -128, 8, 1, -125, 32, -2, 125, 43, -111, +109, 27, 112, 105, 3, 91, -65, 126, -124, -74, 44, 0, 1, 0, 27, -1, -28, 4, 58, 5, -45, 0, 57, 0, -18, +64, 74, 109, 55, 118, 43, -122, 43, 3, 22, 33, 1, 20, 7, 58, 24, 73, 24, 3, 41, 40, 39, 36, 4, 34, +42, 57, 0, 3, 3, 5, 56, 2, 3, 3, 36, 36, 37, 30, 38, 1, 0, 0, 39, 39, 38, 38, 30, 46, 50, +39, 95, 49, 111, 49, 2, 49, -2, 64, 53, 1, 53, 41, 46, 1, 10, 64, 29, 34, 52, 10, 64, 18, 20, 52, +10, -72, 1, -107, -77, 47, 27, 1, 27, -72, 2, -72, 64, 10, 20, 16, 30, 17, -85, 14, 30, 20, 11, 31, -72, +2, 90, -74, 30, 11, 50, 94, 49, 56, 16, -72, 1, -113, 64, 44, 32, 17, 48, 17, 2, 17, 26, 59, 1, 2, +-91, 34, 94, 32, 5, 1, 5, 77, 56, 94, -65, 42, -49, 42, -17, 42, 3, 42, 114, 31, 38, 37, 39, 30, 62, +-81, 31, 1, 31, 25, 58, -87, -115, 24, 43, 78, 16, -12, 93, 25, 77, -28, 24, -12, 60, 16, -12, 93, -3, -12, +93, -19, -12, 60, 78, 16, -10, 93, 77, -28, -12, -19, 0, 63, -19, 63, -19, -3, -19, 16, -12, 93, -19, 43, 43, +63, -19, 113, -3, 93, -28, 17, 18, 57, 47, 60, 16, 60, 16, 60, 16, -3, 60, 16, 60, 16, 60, 1, 17, 18, +23, 57, 17, 18, 23, 57, 49, 48, 1, 93, 113, 0, 93, 1, 33, 21, 33, 22, 21, 20, 6, 7, 54, 51, 50, +23, 22, 51, 50, 55, 23, 6, 6, 35, 34, 39, 38, 38, 39, 38, 35, 34, 6, 7, 39, 54, 54, 53, 52, 39, +35, 53, 51, 38, 38, 53, 52, 55, 54, 51, 50, 22, 23, 7, 38, 38, 35, 34, 6, 21, 20, 1, -116, 1, 59, +-2, -28, 19, 83, 95, 79, 65, 83, 104, -84, 61, 74, 118, 58, 92, 101, 50, 42, 43, 27, -51, 30, 47, 47, 72, +-93, 67, 69, 96, -122, 17, -60, -102, 33, 18, -102, 124, -80, -75, -21, 27, -77, 15, -107, 104, 111, -109, 3, 41, -108, +44, 44, 87, -62, 101, 22, 25, 41, 56, -91, 39, 24, 8, 5, 63, 6, 8, 50, 43, -83, 53, -59, -114, 61, 63, +-108, 112, 103, 49, -48, 117, 93, -57, -76, 27, 120, -118, -113, 101, 111, 0, 2, 0, 81, -2, 81, 4, 21, 5, -45, +0, 56, 0, 74, 0, -44, 64, 106, 4, 48, 20, 48, 36, 57, 102, 47, 101, 58, 117, 6, 116, 17, 122, 29, 121, +45, 121, 62, 123, 63, 123, 64, 123, 65, 115, 73, 115, 74, -124, 6, -124, 17, -117, 29, -119, 45, -117, 62, -117, 63, +-117, 64, -117, 65, -125, 72, -125, 73, -125, 74, -108, 41, 27, 41, 13, 41, 19, 36, 41, 34, 49, 4, 72, 67, 18, +12, 4, 69, 66, 63, 57, 37, 10, 5, 34, 58, 47, 39, 3, 60, 7, 72, 67, 66, 63, 58, 57, 47, 39, 37, +18, 12, 10, 12, 28, 1, 54, 28, 4, -122, 1, 28, 39, 27, -72, 1, 19, 64, 45, 31, 28, 24, 1, 0, 39, +1, 11, 28, 60, 27, 62, 43, 7, 94, 50, 62, 60, 41, 79, 43, 1, 43, 26, 76, 34, 94, 21, 62, 15, 1, +60, 0, 56, 69, 41, 79, 15, 1, 15, 25, 75, 113, -89, 24, 43, 78, 16, -12, 93, 77, -19, -12, -19, 16, -12, +-19, 78, 16, -10, 93, 77, -19, -12, -19, 16, -12, -19, 0, 63, -28, 63, -19, -3, -28, 16, -12, -19, 17, 18, 23, +57, 1, 17, 18, 23, 57, 18, 23, 57, 17, 23, 57, 49, 48, 1, 93, 0, 93, 23, 55, 22, 22, 51, 50, 54, +53, 52, 39, 38, 37, 46, 2, 53, 52, 54, 55, 38, 38, 53, 52, 54, 51, 50, 22, 23, 7, 38, 38, 35, 34, +6, 21, 20, 23, 22, 23, 22, 23, 22, 22, 21, 20, 7, 6, 7, 22, 22, 21, 20, 6, 6, 35, 34, 38, 1, +54, 54, 53, 52, 39, 38, 39, 38, 39, 6, 6, 21, 20, 23, 22, 23, 22, -113, -75, 28, 122, 105, 102, 115, 36, +62, -2, -22, -108, 117, 74, 120, 105, 71, 58, -56, -91, -69, -46, 21, -69, 21, 105, 89, 92, 113, 36, 56, -6, -99, +55, 71, 67, 73, 42, 112, 80, 79, 100, -68, 109, -65, -32, 2, 51, 74, 73, 52, 53, -84, -119, 67, 81, 69, 46, +46, -95, -122, 70, 26, -126, 105, 104, 70, 51, 43, 75, -86, 91, 103, -116, 76, 96, -100, 31, 68, 115, 65, -128, -68, +-78, -87, 19, 122, 96, 99, 60, 52, 44, 68, -104, 96, 45, 60, -128, 75, 113, 80, 46, 47, 61, -116, 80, 88, -99, +83, -65, 1, -28, 38, 101, 48, 57, 63, 63, 106, 84, 54, 46, 92, 56, 63, 57, 57, 95, 79, 0, 0, 1, 0, +109, 1, -48, 2, 104, 3, -53, 0, 11, 0, 31, -71, 0, 3, 1, 83, 64, 14, 9, 6, -52, 32, 0, 48, 0, +2, 0, 117, 12, 87, -89, 24, 43, 16, -10, 93, -19, 0, 47, -19, 49, 48, 19, 52, 54, 51, 50, 22, 21, 20, +6, 35, 34, 38, 109, -107, 104, 105, -107, -107, 105, 104, -107, 2, -50, 105, -108, -108, 105, 105, -107, -107, 0, 0, 1, +0, 1, -2, 105, 4, 83, 5, -70, 0, 15, 0, 90, 64, 13, 79, 10, 79, 11, 79, 14, 79, 15, 4, 11, 12, +1, 15, -70, 1, -22, 0, 1, 1, 105, 64, 33, 7, 9, 14, 35, 8, 7, 0, 13, 12, 35, 10, 11, 114, 17, +1, -7, 0, 15, 16, 15, 2, 15, 15, 16, 8, 26, 17, 4, 25, 16, -77, 122, 24, 43, 78, 16, -28, 16, -26, +18, 57, 47, 93, 77, -19, 16, -12, 60, -3, 60, 0, 63, 60, -3, 60, 16, -19, -19, 17, 57, 57, 49, 48, 1, +113, 0, 1, 17, 38, 38, 53, 52, 54, 51, 33, 21, 35, 17, 35, 17, 35, 17, 1, -107, -69, -39, -15, -24, 2, +121, -112, -86, -33, -2, 105, 4, 21, 10, -33, -83, -63, -27, -83, -7, 92, 6, -92, -7, 92, 0, 0, 1, 0, -103, +-1, -25, 4, -93, 5, -45, 0, 54, 1, -118, 64, -123, 11, 45, 27, 45, 63, 56, 70, 10, 70, 17, 69, 19, 79, +56, 92, 46, 106, 36, 106, 46, 112, 56, 11, 73, 8, 38, 37, 37, 40, 17, 16, 37, 39, 39, 37, 16, 18, 20, +16, 37, 39, 39, 37, 16, 18, 20, 16, 16, 18, 23, 24, 25, 26, 33, 32, 31, 30, 29, 9, 27, 34, 41, 40, +39, 38, 37, 36, 35, 14, 15, 16, 17, 18, 19, 20, 14, 21, 43, 44, 45, 46, 12, 11, 10, 9, 8, 8, 42, +2, 3, 51, 49, 6, 48, 6, 47, 0, 45, 44, 39, 37, 38, 28, 27, 29, 18, 17, 16, 11, 10, 51, 52, 15, +31, 50, 28, 5, 1, 31, 28, 24, 11, 54, 0, 10, 47, 28, 8, -92, 21, 42, 36, 13, -72, 2, 45, 64, 12, +21, 27, -55, -97, 28, 1, 28, 28, 53, 34, 36, 21, -72, -1, -12, -76, 15, 15, 6, 85, 21, -72, -1, -12, 64, +14, 12, 12, 6, 85, 0, 21, 96, 21, 112, 21, -128, 21, 4, 21, -72, 2, 61, -74, 0, 53, 54, 1, 54, 37, +0, -72, -1, -5, -76, 16, 16, 6, 85, 0, -72, -1, -12, -76, 15, 15, 6, 85, 0, -72, -1, -18, -76, 13, 13, +6, 85, 0, -72, -1, -11, 64, 10, 12, 12, 6, 85, 32, 0, 1, 0, -110, 55, -72, 1, 54, -79, 55, 24, 43, +16, -12, 93, 43, 43, 43, 43, -19, 60, 16, 60, 16, -3, 93, 43, 43, -19, 17, 57, 47, 93, -19, 16, -12, -19, +16, -12, -19, 0, 63, 60, 63, -19, 63, -19, 17, 23, 57, 1, 17, 18, 23, 57, 17, 18, 23, 57, 18, 23, 57, +17, 18, 23, 57, -121, 14, 46, 43, 14, 125, 16, -60, 46, 24, 43, 14, 125, 16, -60, 16, 60, -121, 14, 16, -60, +49, 48, 24, 67, 121, 64, 52, 48, 52, 22, 33, 2, 7, 3, 38, 32, 23, 34, 27, 1, 30, 25, 28, 27, 0, +29, 28, 26, 27, 51, 4, 53, 29, 0, 49, 6, 47, 27, 1, 33, 22, 31, 27, 0, 29, 26, 31, 27, 0, 52, +2, 50, 29, 1, 48, 7, 50, 27, 1, 0, 43, 43, 43, 43, 1, 43, 43, 16, 60, 16, 60, 43, 43, 43, -127, +-127, -127, 1, 93, 51, 17, 52, 54, 54, 51, 50, 22, 21, 20, 14, 2, 21, 20, 23, 22, 23, 22, 23, 22, 21, +20, 6, 35, 34, 38, 39, 55, 22, 22, 51, 50, 54, 53, 52, 39, 38, 39, 38, 39, 38, 53, 52, 62, 2, 53, +52, 38, 35, 34, 6, 21, 17, -103, 89, -48, -126, -83, -58, 36, 92, 24, 22, 21, 100, -120, 45, 64, -51, -96, 126, +-66, 47, -101, 50, 100, 55, 76, 108, 32, 21, 91, -90, 39, 40, 27, 103, 32, 109, 91, 107, -120, 3, -25, -73, -59, +112, -83, 114, 51, 108, -95, 63, 24, 32, 31, 32, 65, 89, 54, 77, 105, -117, -58, -121, 106, 72, 93, 72, 104, 70, +56, 40, 26, 62, 114, 57, 57, 60, 39, 80, -80, 88, 34, 62, 95, -124, -36, -4, 33, 0, 4, 0, 3, -1, -18, +5, -24, 5, -45, 0, 15, 0, 31, 0, 54, 0, 64, 1, -125, 64, 54, -102, 18, -108, 22, -108, 26, -102, 30, -37, +18, -44, 22, -44, 26, -37, 30, 8, -65, 44, -71, 45, 2, 38, 39, 41, 45, 41, 48, 43, 49, -89, 3, -88, 11, +-87, 13, -74, 43, -58, 43, -42, 43, 10, 101, 8, 48, 49, 47, 100, 47, 116, 47, 2, 47, -72, -1, -48, -77, 38, +45, 52, 47, -72, 2, 98, 64, 31, 46, 44, 20, 46, 46, 44, 45, 44, 43, 42, 41, 5, 46, 48, 49, 50, 3, +54, 48, 49, 40, 51, 45, 44, 43, 42, 8, 47, 41, 41, 53, -72, 2, 98, -75, 55, 55, 32, 33, 64, 63, -72, +2, 98, 64, 28, 33, 0, 34, -113, 34, 2, 34, -108, 0, 46, 47, 47, 54, 79, 32, 1, 15, 32, 111, 32, 127, +32, -17, 32, 4, 32, -108, 24, -72, 2, 98, -78, 8, 11, 16, -72, 2, 98, -78, 0, 3, 59, -72, 2, 98, -78, +38, 84, 47, -70, 2, 98, 0, 46, 1, 22, -74, 4, 64, 55, 53, 54, 33, 54, -67, 2, 98, 0, 32, 1, 74, +0, 12, 0, 28, 2, 98, -77, 4, 26, 66, 20, -72, 2, 98, -75, 12, 25, 65, -77, 122, 24, 43, 78, 16, -12, +77, -19, 78, 16, -10, 77, -19, 16, -12, -19, 60, 16, 60, 60, 60, 16, -12, -19, -12, -19, 0, 63, -19, 63, -19, +-12, 93, 113, 60, 60, 16, 60, 16, -12, 93, 60, -3, 60, 17, 18, 57, 47, -3, 57, 47, 18, 23, 57, 1, 17, +23, 57, 18, 23, 57, -121, 46, 43, 43, 113, 14, 125, 16, -60, 1, 57, 49, 48, 24, 67, 121, 64, 74, 60, 62, +1, 37, 36, 37, 61, 38, 18, 37, 14, 38, 2, 37, 30, 38, 22, 38, 10, 37, 6, 38, 26, 37, 62, 35, 59, +44, 1, 17, 15, 20, 33, 0, 31, 1, 28, 33, 1, 23, 9, 20, 33, 0, 25, 7, 28, 33, 1, 60, 37, 63, +44, 1, 19, 13, 16, 33, 1, 29, 3, 16, 33, 1, 21, 11, 24, 33, 0, 27, 5, 24, 33, 0, 0, 43, 43, +43, 43, 43, 1, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -127, -127, 1, 93, 113, 0, +93, 1, 50, 4, 18, 21, 20, 2, 4, 35, 34, 36, 2, 53, 52, 18, 36, 23, 34, 4, 2, 21, 20, 18, 4, +51, 50, 36, 18, 53, 52, 2, 36, 1, 17, 33, 50, 22, 22, 21, 20, 6, 7, 22, 23, 22, 23, 23, 35, 39, +38, 39, 38, 35, 35, 17, 17, 51, 50, 54, 53, 52, 38, 38, 35, 35, 2, -10, -66, 1, 106, -54, -57, -2, -103, +-60, -60, -2, -103, -56, -53, 1, 106, -66, -97, -2, -45, -86, -89, 1, 44, -93, -93, 1, 44, -90, -87, -2, -46, -2, +23, 1, 23, -113, -128, 76, 127, 105, 43, 26, 49, 71, 99, -96, 72, 85, 52, 36, 69, 77, -97, 114, 83, 40, 71, +96, -107, 5, -45, -61, -2, -107, -59, -61, -2, -104, -57, -57, 1, 104, -61, -59, 1, 107, -61, 125, -93, -2, -47, -92, +-93, -2, -43, -89, -89, 1, 43, -93, -92, 1, 47, -93, -5, -23, 3, 44, 45, 112, 63, 89, -124, 8, 18, 25, 48, +113, -97, -128, -105, 38, 28, -2, -89, 1, -55, 68, 56, 36, 57, 28, 0, 3, 0, 3, -1, -18, 5, -24, 5, -45, +0, 15, 0, 31, 0, 58, 1, 51, 64, 32, -108, 18, -108, 22, -101, 26, -101, 30, -90, 3, -88, 11, -88, 13, -71, +48, -44, 18, -44, 22, -37, 26, -37, 30, -43, 51, -42, 54, 14, 112, 8, 32, -72, 2, -85, -77, 33, -121, 36, 47, +-72, 2, -85, -77, 48, 46, 1, 46, -69, 2, 96, 0, 43, 0, 56, 2, 98, 64, 16, 79, 36, 1, 15, 36, 111, +36, 127, 36, -17, 36, 4, 36, -108, 8, 50, -72, 2, 98, 64, 11, 0, 43, -113, 43, -1, 43, 3, 43, -108, 0, +24, -72, 2, 98, -78, 8, 11, 16, -72, 2, 98, -78, 0, 3, 47, -72, 2, 98, -78, 46, -45, 32, -72, 2, 98, +-77, 33, -120, 4, 53, -67, 2, 98, 0, 39, 2, 100, 0, 12, 0, 28, 2, 98, -77, 4, 26, 60, 20, -72, 2, +98, -75, 12, 25, 59, -77, 122, 24, 43, 78, 16, -12, 77, -19, 78, 16, -10, 77, -19, 16, -12, -19, 16, -12, -19, +-12, -19, 0, 63, -19, 63, -19, 16, -12, 93, -19, 16, -12, 93, 113, -19, 16, -3, 93, -28, 16, -3, -28, 49, 48, +67, 121, 64, 84, 51, 55, 37, 42, 1, 31, 41, 38, 18, 37, 14, 38, 2, 37, 30, 38, 22, 38, 10, 37, 6, +38, 26, 37, 51, 42, 53, 31, 0, 55, 37, 53, 31, 0, 17, 15, 20, 33, 0, 31, 1, 28, 33, 1, 23, 9, +20, 33, 0, 25, 7, 28, 33, 1, 52, 40, 50, 31, 1, 54, 38, 56, 31, 0, 19, 13, 16, 33, 1, 29, 3, +16, 33, 1, 21, 11, 24, 33, 0, 27, 5, 24, 33, 0, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -127, -127, -127, 1, 93, 1, 50, 4, 18, 21, 20, 2, 4, 35, 34, +36, 2, 53, 52, 18, 36, 23, 34, 4, 2, 21, 20, 18, 4, 51, 50, 36, 18, 53, 52, 2, 36, 19, 23, 6, +6, 35, 34, 38, 53, 52, 54, 54, 51, 50, 22, 23, 7, 38, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 2, +-10, -66, 1, 106, -54, -57, -2, -103, -60, -60, -2, -103, -56, -53, 1, 106, -66, -97, -2, -45, -86, -89, 1, 44, -93, +-93, 1, 44, -90, -87, -2, -46, 84, 123, 30, -61, -117, -80, -36, 100, -71, 119, -123, -80, 32, 119, 30, 117, 79, 115, +-107, -115, 112, 90, -120, 5, -45, -61, -2, -107, -59, -61, -2, -104, -57, -57, 1, 104, -61, -59, 1, 107, -61, 125, -93, +-2, -47, -92, -93, -2, -43, -89, -89, 1, 43, -93, -92, 1, 47, -93, -3, 16, 36, 125, -107, -28, -54, -124, -61, 99, +127, 109, 29, 74, 79, -92, -103, -103, -99, 104, 0, 0, 2, 0, -31, 2, -117, 6, -9, 5, -70, 0, 7, 0, 20, +0, -100, 64, 31, 93, 11, 1, 57, 17, 53, 18, 74, 17, 70, 18, 4, 11, 17, 18, 15, 14, 7, 0, 4, 18, +17, 16, 11, 4, 20, 19, 4, 2, 20, 8, -72, 1, 105, -78, 9, 2, 5, -72, 2, 98, 64, 10, 13, 12, 10, +9, 4, 0, 13, 14, 16, 14, -70, 2, 98, 0, 15, 1, 59, -78, 17, -84, 18, -70, 1, 59, 0, 20, 2, 98, +-78, 8, 8, 9, -72, 2, 5, -78, 5, -91, 7, -72, 2, 98, 64, 14, 0, -91, 2, 32, 3, 48, 3, 96, 3, +3, 3, 25, 21, -39, -71, 1, 46, 0, 24, 43, 16, -10, 93, 60, -12, -3, -12, -10, 60, 16, -3, -10, -10, -10, +-19, 60, 16, 60, 0, 63, 60, 60, 60, 60, -3, 60, 16, -3, 60, 17, 18, 57, 18, 23, 57, 23, 57, 1, 17, +18, 57, 49, 48, 1, 93, 0, 93, 1, 17, 33, 53, 33, 21, 33, 17, 33, 17, 51, 19, 19, 51, 17, 35, 17, +3, 35, 3, 17, 1, -23, -2, -8, 2, -102, -2, -10, 1, 101, -56, -50, -57, -60, 124, -46, 123, -37, 2, -117, 2, +-74, 121, 121, -3, 74, 3, 47, -3, 117, 2, -117, -4, -47, 2, -84, -3, 84, 2, -74, -3, 74, 0, 0, 1, 0, +-34, 4, -86, 2, 79, 5, -62, 0, 3, 0, 101, -71, 0, 1, -1, -56, -77, 23, 25, 52, 2, -72, -1, -64, -77, +23, 25, 52, 3, -72, -1, -64, 64, 38, 23, 25, 52, 127, 1, -128, 2, -33, 1, 3, 111, 3, 127, 0, 127, 3, +3, 111, 0, 111, 1, 2, 79, 1, 80, 2, 2, 0, 0, 3, 16, 3, 2, 3, -121, 1, 4, 1, -72, 2, 96, +-78, 2, -122, 3, -72, 2, 83, -75, 0, 25, 4, -39, -89, 24, 43, 78, 16, -12, 77, -3, -12, -3, 0, 63, -3, +93, 60, 49, 48, 1, 93, 93, 93, 93, 43, 43, 43, 19, 19, 51, 3, -34, -123, -20, -36, 4, -86, 1, 24, -2, +-24, 0, 0, 2, 0, 61, 4, -10, 2, 110, 5, -61, 0, 3, 0, 7, 0, 72, 64, 35, 0, 3, 2, 7, 60, +5, 5, 2, 0, 6, 7, 5, 4, 2, 3, 1, 0, 7, 60, 4, -97, 3, 60, 95, 0, 111, 0, -113, 0, -112, +0, -96, 0, 5, 0, -72, 2, 36, -77, 8, 112, -115, 24, 43, 78, 16, -12, 93, 77, -3, -10, -3, 16, 60, 16, +60, 16, 60, 16, 60, 0, 63, 60, 16, -19, 17, 57, 57, 49, 48, 19, 53, 51, 21, 51, 53, 51, 21, 61, -68, +-71, -68, 4, -10, -51, -51, -51, -51, 0, 1, 0, 78, -1, -28, 4, 22, 5, -62, 0, 19, 0, -47, 64, -126, -73, +13, -73, 16, 2, 0, 4, 19, 1, 12, 3, 4, 19, 2, 11, 6, 5, 18, 2, 11, 7, 8, 15, 2, 11, 10, +9, 14, 2, 11, 13, 9, 14, 1, 12, 16, 8, 15, 1, 12, 17, 5, 18, 1, 12, 11, 12, 1, 1, 63, 2, +11, 20, 2, 2, 11, 15, 16, 16, 7, 7, 8, 37, 9, 14, 13, 13, 10, 10, 48, 9, 1, -97, 9, -49, 9, +2, 9, -65, 4, 18, 17, 17, 6, 6, 5, 37, 4, 19, 0, 0, 3, 3, 4, 12, 11, 0, 1, 2, 10, 11, +-24, 12, 1, -24, 2, 12, 12, 4, 2, 2, 14, 4, 14, 15, 15, 18, 19, 85, 21, 9, 8, 8, 5, 4, 62, +20, 113, -116, 24, 43, 16, -12, 60, 60, 16, 60, 16, -10, 60, 60, 16, 60, 17, 18, 57, 47, 17, 57, 47, 16, +-19, 16, -19, 0, 63, 60, 63, 60, 47, 60, 16, 60, 16, 60, 16, -3, 60, 16, 60, 16, 60, 16, -3, 93, 113, +60, 16, 60, 16, 60, 16, -3, 60, 16, 60, 16, 60, -121, 5, 46, 43, -121, 125, -60, 15, 15, 15, 15, 15, 15, +15, 15, 49, 48, 1, 93, 1, 3, 35, 19, 33, 53, 33, 19, 33, 53, 33, 19, 51, 3, 33, 21, 33, 3, 33, +21, 1, -17, -62, -120, -61, -2, -26, 1, 100, 122, -2, 34, 2, 39, -60, -122, -61, 1, 26, -2, -100, 121, 1, -35, +1, -95, -2, 67, 1, -67, -88, 1, 21, -88, 1, -68, -2, 68, -88, -2, -21, -88, 0, 0, 2, 0, 1, 0, 0, +7, -112, 5, -70, 0, 15, 0, 19, 1, 16, 64, 15, 1, 24, 13, 17, 6, 85, 14, 16, 19, 15, 14, 16, 12, +0, 19, -72, -1, -15, -76, 13, 17, 2, 85, 19, -72, -1, -10, 64, 30, 11, 11, 2, 85, 19, 15, 15, 32, 0, +1, 20, 0, 0, 1, 19, 15, 1, 3, 12, 0, 13, 14, 30, 16, 16, 17, 17, 0, 1, 16, -72, 2, -89, 64, +40, 8, 6, 5, 30, 7, 127, 8, -113, 8, 2, 8, 8, 0, 3, 19, 30, 2, 1, 2, 10, 9, 30, 12, 11, +15, 12, 0, 8, 4, 9, 32, 12, 12, 18, 12, 16, 16, 2, 85, 18, -72, -1, -10, -76, 15, 15, 2, 85, 18, +-72, -1, -18, 64, 11, 13, 13, 2, 85, 18, 10, 12, 12, 2, 85, 18, -72, -1, -24, -76, 11, 11, 2, 85, 18, +-72, -1, -16, -76, 16, 16, 6, 85, 18, -72, -1, -21, 64, 11, 13, 13, 6, 85, 18, 10, 12, 12, 6, 85, 18, +-72, -1, -27, 64, 21, 11, 11, 6, 85, 18, 18, 20, 21, 7, 84, 3, 74, 10, 26, 21, 0, 25, 20, 96, 91, +24, 43, 25, 78, 16, -28, 24, 16, -10, 77, -12, -28, 17, 18, 57, 47, 43, 43, 43, 43, 43, 43, 43, 43, 43, +60, 16, -3, 60, 0, 63, 60, 60, 60, 16, -3, 60, 63, 60, -3, 60, 18, 57, 47, 93, 60, -3, 60, 16, -26, +17, 18, 57, 47, 60, 16, -3, 60, 1, 17, 18, 23, 57, -121, 46, 43, 125, 16, -60, 43, 43, 1, 17, 18, 57, +57, 7, 60, 60, 43, 49, 48, 51, 1, 33, 21, 33, 17, 33, 21, 33, 17, 33, 21, 33, 17, 33, 3, 1, 33, +17, 35, 1, 2, -63, 4, -77, -3, 31, 2, -83, -3, 83, 2, -4, -4, 65, -3, -54, -56, 1, 26, 1, -28, -111, +5, -70, -83, -2, 61, -84, -2, 15, -83, 1, -89, -2, 89, 2, 83, 2, -70, 0, 3, 0, 83, -1, -59, 5, -19, +5, -16, 0, 27, 0, 38, 0, 48, 1, -93, 64, -128, 41, 0, 42, 1, 37, 15, 3, 16, 2, 34, 0, 34, 3, +56, 15, 58, 27, 69, 38, 73, 39, 69, 40, 82, 9, 92, 33, 82, 38, 84, 46, 105, 14, -125, 0, -128, 1, -128, +2, -125, 3, -124, 27, -123, 28, -69, 27, -4, 0, -6, 38, 22, 11, 28, 7, 38, 11, 39, 3, 58, 4, 61, 48, +74, 1, 74, 4, 73, 29, 69, 32, 72, 39, 75, 45, 91, 0, 91, 3, 89, 28, 85, 32, 89, 33, 91, 39, 82, +41, 90, 45, 107, 1, 105, 2, 122, 48, -117, 2, -123, 37, -117, 39, -94, 9, -12, 1, 24, 4, 3, 11, 19, 20, +4, 27, 19, 4, 4, 32, 11, 45, 20, 32, 27, 45, 4, 18, 0, -72, -1, -32, 64, 59, 10, 10, 6, 85, 15, +32, 8, 10, 6, 85, 3, 39, 40, 15, 16, 16, 2, 0, 28, 38, 18, 17, 17, 1, 42, 40, 38, 37, 4, 29, +28, 39, 48, 4, 34, 47, 42, 40, 38, 37, 4, 29, 28, 39, 48, 4, 44, 31, 2, 16, 16, 48, 17, 1, 20, +17, 17, 1, 31, -72, 2, -69, -78, 25, 3, 44, -72, 2, -69, -78, 11, 9, 1, -72, 1, 11, -76, 2, 45, 47, +38, 7, -72, -1, -24, -76, 16, 16, 2, 85, 7, -72, -1, -18, -76, 13, 13, 2, 85, 7, -72, -1, -16, -76, 12, +12, 2, 85, 7, -72, -1, -6, -76, 11, 11, 6, 85, 7, -72, -1, -12, -76, 13, 13, 6, 85, 7, -72, -1, -6, +64, 11, 12, 12, 6, 85, 7, 26, 32, 50, 1, 50, 17, -70, 1, 11, 0, 16, 1, 49, 64, 23, 34, 38, 21, +6, 11, 11, 6, 85, 21, 6, 12, 12, 6, 85, 32, 21, 1, 21, 25, 49, 99, 92, 24, 43, 78, 16, -12, 93, +43, 43, 77, -19, -3, -19, 78, 16, 93, -10, 43, 43, 43, 43, 43, 43, 77, -19, -12, -19, 0, 63, -19, 63, -3, +-121, 14, 46, 43, 125, 16, -60, 0, 17, 18, 23, 57, 23, 57, 1, 17, 18, 23, 57, 23, 57, 7, 16, 14, 60, +60, 60, 60, 7, 16, 14, 60, 60, 60, 60, 0, 43, 43, 49, 48, 1, 67, 92, 88, -71, 0, 40, -1, -34, -74, +20, 57, 28, 34, 20, 57, 40, -72, -1, -34, -75, 18, 57, 28, 34, 18, 57, 43, 43, 43, 43, 89, 93, 93, 93, +113, 0, 93, 113, 1, 55, 23, 7, 22, 23, 22, 21, 20, 2, 4, 35, 34, 39, 38, 39, 7, 39, 55, 38, 38, +53, 52, 18, 36, 51, 50, 22, 7, 38, 38, 35, 34, 0, 17, 20, 23, 22, 23, 1, 1, 22, 23, 22, 51, 50, +0, 17, 52, 4, -30, -88, 99, -80, 86, 30, 40, -74, -2, -73, -71, -118, 112, 86, 115, -88, 99, -80, 98, 66, -76, +1, 69, -57, -122, -55, 4, 94, -115, 95, -37, -2, -30, 22, 16, 51, 3, 60, -3, 25, 77, 65, 85, 99, -38, 1, +28, 5, 52, -68, 84, -58, -128, 96, 126, -100, -31, -2, -96, -76, 39, 30, 85, -68, 84, -59, -107, -45, -108, -30, 1, +97, -74, 71, -33, 74, 54, -2, -41, -2, -39, 116, 90, 67, 98, 2, -36, -4, -64, 63, 25, 33, 1, 52, 1, 22, +-48, 0, 3, 0, -102, 1, -124, 5, 30, 4, 20, 0, 24, 0, 38, 0, 49, 0, -50, 64, 66, 36, 25, 37, 26, +37, 38, 59, 40, 59, 49, 76, 40, 76, 49, 99, 26, 99, 38, 117, 26, 117, 38, -124, 26, -124, 38, 13, 68, 8, +25, 7, 45, 39, 32, 20, 15, 11, 35, 0, 29, 4, 39, 25, 15, 0, 4, 32, 45, 39, 25, 15, 0, 4, 48, +42, 42, 23, 56, 4, 48, 42, 17, 56, 29, 42, 11, -72, 1, -68, 64, 17, 35, 42, 4, 6, 32, 42, 7, 26, +51, 45, 42, 20, 25, 50, -98, 121, 24, 43, 78, 16, -12, 77, -19, 78, 16, -10, 77, -19, 0, 63, -19, -3, -19, +-12, -19, 16, -12, -19, 17, 23, 57, 1, 17, 18, 23, 57, 0, 17, 18, 57, 17, 18, 57, 1, 17, 18, 57, 17, +18, 57, 49, 48, 67, 121, 64, 50, 43, 47, 30, 34, 18, 22, 5, 10, 9, 38, 43, 22, 45, 31, 0, 34, 5, +32, 31, 1, 47, 18, 45, 31, 0, 30, 10, 32, 31, 1, 44, 21, 42, 31, 1, 33, 6, 35, 31, 1, 46, 19, +48, 31, 0, 31, 8, 29, 31, 0, 0, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, -127, -127, -127, -127, 1, 93, +1, 54, 55, 54, 51, 50, 22, 21, 20, 6, 6, 35, 34, 39, 38, 39, 6, 35, 34, 38, 53, 52, 54, 51, 50, +19, 22, 23, 22, 51, 50, 54, 53, 52, 38, 35, 34, 7, 6, 7, 38, 38, 35, 34, 6, 21, 20, 22, 51, 50, +2, -79, 105, 59, 80, 89, 105, -73, 68, -112, 76, 89, 80, 59, 105, -120, -103, 101, -111, -111, 101, -103, -51, 87, 72, +46, 57, 76, 103, 105, 78, 49, 43, 58, -10, 80, 96, 44, 58, 77, 80, 57, 101, 3, 44, -124, 42, 58, -104, -87, +118, -121, 82, 57, 43, -124, -85, -103, 114, 113, -102, -2, -10, -121, 50, 33, 112, 102, 106, 112, 28, 39, -108, 100, 57, +82, 72, 71, 85, 0, 0, 2, 0, 78, 0, 0, 4, 22, 4, -51, 0, 11, 0, 15, 0, 78, 64, 46, 9, 2, +8, 3, 0, 110, 2, -7, 3, 110, 15, 5, 1, 5, 15, 14, -7, 12, 13, 5, 13, 10, 12, 8, 110, 6, 10, +-7, 5, 1, 13, 1, 110, 63, 2, -112, 2, -96, 2, 3, 2, 85, 16, 113, -116, 24, 43, 16, -10, 93, -28, 60, +16, 60, -3, 60, -12, 60, 0, 63, 47, 16, 60, -3, 60, 16, 93, -12, -3, -28, 16, 60, 16, 60, 49, 48, 1, +17, 33, 53, 33, 17, 51, 17, 33, 21, 33, 17, 1, 33, 53, 33, 1, -35, -2, 113, 1, -113, -86, 1, -113, -2, +113, 1, -113, -4, 56, 3, -56, 1, 4, 1, -109, -89, 1, -113, -2, 113, -89, -2, 109, -2, -4, -88, 0, 2, 0, +77, 0, 106, 4, 24, 5, 60, 0, 6, 0, 10, 0, 118, 64, 22, -114, 3, -128, 5, 2, 10, 9, 8, 7, 4, +0, 6, 5, 3, 3, 12, 2, 8, 7, 37, 9, 10, -67, 2, -84, 0, 5, 2, 90, 0, 6, 0, 3, 2, 90, +-78, 2, 64, 6, -70, 1, 80, 0, 2, 1, 80, 64, 26, 0, -85, 1, -85, 32, 4, 2, 95, 0, 8, 9, 58, +4, 60, 1, 48, 0, -96, 0, 2, 0, 25, 11, 113, -116, 24, 43, 78, 16, -12, 93, 60, 77, -19, -12, 60, 16, +-19, 0, 25, 47, 26, -19, -19, -19, -19, 24, 26, 16, -19, 16, -19, -10, 60, -3, 60, 1, 17, 18, 23, 57, 18, +23, 57, 49, 48, 0, 93, 19, 53, 1, 21, 1, 1, 21, 7, 33, 53, 33, 77, 3, -53, -4, -2, 3, 2, 2, +-4, 56, 3, -56, 2, -6, -88, 1, -102, -76, -2, -59, -2, -63, -77, -15, -89, 0, 2, 0, 77, 0, 106, 4, 24, +5, 60, 0, 6, 0, 10, 0, -118, 64, 24, -128, 2, -113, 4, 2, 10, 9, 8, 7, 4, 0, 4, 2, 1, 3, +11, 5, 10, 9, 7, 8, 37, 64, 9, -72, 2, -84, -73, 1, 0, -85, 6, -85, 3, 32, 2, -69, 2, 90, 0, +64, 0, 1, 1, 80, -78, 3, 32, 4, -69, 2, 90, 0, 64, 0, 5, 1, 80, 64, 9, 32, 3, 7, 10, 58, +3, 60, 6, 5, -72, 1, 34, 64, 11, 31, 0, 48, 0, 2, 0, 26, 12, 113, -116, 24, 43, 78, 16, -10, 93, +77, -19, 60, -19, -12, 60, 0, 25, 47, 26, -3, 24, 26, -19, 25, 26, 16, -3, 24, 26, -19, 25, 26, 16, -19, +-19, 24, 16, -10, 26, -3, 60, 16, 60, 1, 17, 18, 23, 57, 18, 23, 57, 49, 48, 0, 93, 1, 1, 53, 1, +1, 53, 1, 3, 33, 53, 33, 4, 24, -4, 53, 3, 1, -4, -1, 3, -53, 2, -4, 56, 3, -56, 2, -6, -2, +97, -77, 1, 63, 1, 59, -76, -2, 102, -4, -56, -89, 0, 0, 1, -1, -3, 0, 0, 4, 109, 5, -70, 0, 26, +0, -23, 64, 55, 36, 8, 36, 11, 43, 15, 43, 18, 121, 8, 118, 18, -119, 8, -123, 18, 8, 116, 13, -124, 13, +2, 18, 17, 17, 21, 8, 9, 9, 5, 12, 11, 10, 10, 13, 14, 15, 16, 16, 13, 13, 26, 13, 0, 9, 25, +-24, 22, 22, 4, 21, 5, 1, -24, 4, -72, 2, -81, -73, 5, -7, 8, 8, 31, 18, 1, 18, -72, 1, 96, 64, +32, 17, 17, 16, 16, 10, 10, 9, 0, 0, 10, 24, 23, 23, 20, 20, 19, 56, 17, 2, 3, 3, 6, 6, 7, +56, 9, 16, 60, 32, 17, 1, 17, -72, 1, 0, 64, 11, 21, 21, 26, 35, 0, 10, 60, 47, 9, 1, 9, -72, +1, 0, 64, 15, 5, 5, 0, 16, 15, 15, 6, 85, 0, 16, 11, 11, 6, 85, 0, -72, 1, 25, -77, 27, -77, +122, 24, 43, 16, -10, 43, 43, 60, 16, -12, 93, -19, 16, -3, 60, 16, -12, 93, -19, 16, -12, 60, 16, 60, 16, +60, 16, -12, 60, 16, 60, 16, 60, 0, 63, 63, 60, 16, 60, 16, 60, 16, -12, 93, 60, 16, -3, -2, -19, 16, +60, 16, 60, 16, -19, 17, 18, 57, 1, 17, 57, -121, 14, 125, 16, -60, -60, -121, 14, 16, -60, -60, -121, 5, 16, +-60, -121, 16, -60, 49, 48, 0, 93, 1, 93, 33, 17, 33, 53, 33, 53, 33, 53, 33, 1, 51, 1, 22, 23, 54, +55, 1, 51, 1, 33, 21, 33, 21, 33, 21, 33, 17, 1, -35, -2, 97, 1, -97, -2, 97, 1, 85, -2, 106, -56, +1, 34, 49, 27, 23, 59, 1, 18, -42, -2, 107, 1, 85, -2, 100, 1, -100, -2, 100, 1, 69, -117, -113, -108, 2, +-57, -3, -4, 88, 66, 53, 110, 1, -5, -3, 57, -108, -113, -117, -2, -69, 0, 1, 0, -96, -2, 105, 3, -6, 4, +38, 0, 25, 1, 86, 64, 61, 40, 4, 40, 5, 40, 22, 56, 4, 56, 10, 57, 11, 72, 4, 72, 10, 72, 11, +89, 4, 91, 9, 106, 4, 106, 9, 123, 4, 123, 10, -118, 4, -118, 10, 17, 18, 22, 25, 12, 3, 11, 2, 18, +22, 25, 15, 6, 2, 10, 20, 28, 7, 11, 13, 14, 2, 51, 25, 37, 1, 27, -72, -1, -10, -76, 15, 15, 2, +85, 27, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -28, -76, 16, 16, 2, 85, 0, -72, -1, -26, -76, 13, +13, 2, 85, 0, -72, -1, -2, -76, 12, 12, 2, 85, 0, -72, -1, -18, -76, 11, 11, 2, 85, 0, -72, -1, -25, +64, 11, 16, 16, 6, 85, 0, 27, 14, 15, 6, 85, 0, -72, -1, -3, -76, 13, 13, 6, 85, 0, -72, -1, -6, +-76, 12, 12, 6, 85, 0, -72, -1, -21, 64, 28, 11, 11, 6, 85, 0, 26, 96, 27, -128, 27, 2, -80, 27, -64, +27, 2, -48, 27, -32, 27, 2, 27, 15, 12, 37, 13, 13, 14, -72, -1, -12, -76, 16, 16, 2, 85, 14, -72, -1, +-8, -76, 15, 15, 2, 85, 14, -72, -1, -8, -76, 13, 13, 2, 85, 14, -72, -1, -4, -76, 12, 12, 2, 85, 14, +-72, -1, -8, -76, 11, 11, 2, 85, 14, -72, -1, -17, -76, 16, 16, 6, 85, 14, -72, -1, -14, -76, 15, 15, 6, +85, 14, -72, -1, -3, 64, 22, 12, 12, 6, 85, -32, 14, 1, -64, 14, -48, 14, 2, 0, 14, 32, 14, -80, 14, +3, 14, 25, 26, -72, 1, 54, -79, 80, 24, 43, 78, 16, -12, 93, 93, 93, 43, 43, 43, 43, 43, 43, 43, 43, +60, 77, 16, -3, 60, 78, 16, 93, 93, 93, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 60, 77, -3, +-28, 0, 63, 63, -19, 63, 63, 60, 57, 57, 17, 57, 57, 1, 17, 18, 57, 57, 49, 48, 0, 93, 1, 17, 35, +53, 6, 7, 6, 35, 34, 39, 38, 39, 17, 35, 17, 51, 17, 20, 22, 22, 51, 50, 54, 54, 53, 17, 3, -6, +-95, 52, 51, 70, 93, 83, 64, 48, 58, -78, -78, 52, 117, 76, 80, 126, 52, 4, 38, -5, -38, 126, 80, 30, 41, +33, 25, 74, -3, -2, 5, -67, -2, 62, -11, -111, 84, 88, -117, -12, 1, -59, 0, 2, 0, 56, -1, -25, 3, -51, +5, -45, 0, 27, 0, 39, 0, 108, 64, 79, 119, 2, 118, 21, 120, 30, -122, 21, 4, 9, 12, 9, 37, 11, 38, +68, 12, 100, 26, 115, 30, 121, 37, 123, 38, -118, 2, -124, 30, -118, 37, -119, 38, 12, 85, 26, 107, 24, 2, 58, +37, 69, 26, 2, 47, 41, 54, 26, 2, 28, 21, 14, 25, -24, 4, 3, 35, -24, 14, 9, 28, -24, 21, -24, 10, +61, 41, 0, -24, 1, -122, 32, 38, 17, 105, 40, -101, 104, 24, 43, 16, -10, -19, -12, -19, 16, -10, -19, -19, 0, +63, -19, 63, -19, 18, 57, 57, 49, 48, 1, 93, 93, 93, 93, 0, 93, 1, 39, 54, 54, 51, 50, 22, 23, 22, +22, 21, 16, 2, 4, 35, 34, 38, 53, 52, 55, 54, 37, 46, 2, 35, 34, 6, 1, 14, 2, 21, 20, 22, 51, +50, 55, 54, 18, 1, -86, -121, 70, -60, 94, 76, 123, 31, 47, 45, -83, -2, -38, -114, -119, -85, -103, -59, 1, -60, +4, 40, 96, 65, 62, 118, 1, 125, -12, -29, -109, 102, 68, 75, 85, 117, -109, 4, 114, 60, -99, -120, 79, 51, 79, +-40, -116, -2, -32, -2, 63, -42, -74, -91, -30, -95, -49, 8, -88, -80, 95, 99, -2, 44, 14, 108, -11, 126, 83, 108, +55, 76, 1, 61, 0, 0, 1, 0, 122, -2, 81, 5, 106, 5, -45, 0, 11, 0, -115, 64, 32, 4, 10, 0, 8, +4, 3, 4, 5, 3, 32, 11, 10, 20, 11, 11, 10, 4, 5, 4, 3, 5, 32, 9, 10, 20, 9, 9, 10, 2, +3, 30, 11, -72, 2, -90, -74, 1, 0, 2, 6, 5, 30, 9, -72, 2, -90, 64, 14, 7, 8, 14, 1, 2, 45, +6, 7, 81, 32, 13, 1, 13, 4, -70, 2, 58, 0, 10, 2, 113, 64, 11, 9, 0, 11, 45, 9, 32, 8, 1, +8, 86, 12, -72, 1, 51, -79, 92, 24, 43, 16, -10, 93, 60, -12, 60, 16, -12, -19, 16, 93, -12, 60, -12, 60, +0, 63, 60, -26, -3, 60, 63, 60, -26, -3, 60, -121, 5, 46, 43, 8, 125, 16, -60, -121, 5, 46, 24, 43, 8, +125, 16, -60, 0, 17, 18, 57, 57, 49, 48, 19, 33, 21, 33, 1, 1, 33, 21, 33, 53, 1, 1, -117, 4, -43, +-4, 36, 2, 95, -3, 119, 4, 16, -5, 16, 2, 108, -3, -91, 5, -45, -92, -4, -7, -4, -54, -95, -69, 3, 20, +3, 4, 0, 0, 1, 0, -95, -2, 81, 5, -13, 5, -45, 0, 7, 0, 62, 64, 34, 2, 3, 3, 6, 7, 14, +4, 5, 1, 5, 35, 0, 2, 4, -70, 1, 1, 3, -70, 2, 108, 9, 5, -70, 0, 0, 6, -70, 7, 118, 8, +-98, 121, 24, 43, 16, -12, -19, 60, 16, -19, 16, -10, -19, 60, 16, -19, 0, 63, -19, 60, 16, 60, 63, 60, 60, +16, 60, 49, 48, 19, 33, 17, 35, 17, 33, 17, 35, -95, 5, 82, -65, -4, 46, -63, 5, -45, -8, 126, 6, -44, +-7, 44, 0, 0, 1, 0, 0, 0, 0, 4, 100, 4, 39, 0, 11, 0, 65, 64, 30, 6, 7, 2, 11, 43, 1, +0, 6, 8, 5, 10, 6, 5, 37, 3, 4, -110, 1, 26, 13, 7, 8, 37, 10, 9, -110, 0, 25, 12, -10, -71, +2, -106, 0, 24, 43, 78, 16, -12, 77, -12, 60, -3, 60, 78, 16, -10, 77, -12, 60, -3, 60, 0, 63, 60, 63, +60, -3, 60, 57, 57, 49, 48, 17, 33, 21, 35, 17, 35, 17, 33, 17, 35, 17, 35, 4, 100, -94, -67, -2, 86, +-68, -97, 4, 39, -98, -4, 119, 3, -119, -4, 119, 3, -119, 0, 1, 0, 0, -1, 36, 2, 48, 7, 71, 0, 44, +0, -91, 64, 20, 51, 8, 36, 37, 0, 34, 13, 15, 9, 23, 44, 42, 22, 20, 4, 12, 36, 16, 41, 6, -70, +1, -104, 0, 12, 1, -23, -78, 29, 41, 38, -72, 2, -94, 64, 32, 36, 36, 35, 10, 46, 23, 23, 26, 9, -82, +23, 39, 25, 39, 19, -85, 41, 39, 1, 39, 0, 118, 34, 25, 32, 45, 46, -52, 33, -101, 122, 24, 43, 43, 47, +78, -12, 77, -12, -12, -12, -3, -12, -12, -12, 78, 69, 101, 68, -26, 0, 63, 60, 77, 16, -12, -3, -12, -3, -19, +17, 18, 23, 57, 1, 17, 18, 57, 57, 17, 18, 57, 57, 49, 48, 67, 121, 64, 36, 39, 40, 26, 28, 17, 18, +2, 5, 27, 38, 3, 2, 4, 2, 2, 6, 39, 28, 41, 50, 1, 17, 5, 19, 50, 0, 40, 26, 38, 50, 0, +18, 2, 16, 50, 1, 0, 43, 43, 1, 43, 43, 42, 43, -127, -127, -127, -127, 19, 19, 54, 55, 54, 54, 51, 50, +22, 21, 20, 6, 35, 34, 39, 38, 35, 34, 6, 21, 20, 23, 18, 21, 20, 3, 2, 7, 6, 35, 34, 38, 53, +52, 54, 51, 50, 22, 51, 50, 54, 53, 52, 39, 2, -55, 17, 9, 41, 27, 95, 45, 50, 75, 53, 39, 35, 41, +23, 17, 17, 23, 9, 37, 16, 8, 82, 54, 80, 52, 66, 51, 39, 40, 58, 20, 17, 22, 9, 37, 3, -76, 2, +19, -103, 101, 65, 65, 67, 40, 47, 57, 36, 20, 29, 35, 42, 103, -2, 102, -1, 67, -3, -9, -2, -39, 104, 67, +68, 53, 45, 54, 64, 28, 33, 42, 78, 1, 59, 0, 2, 0, 47, 2, -22, 2, -50, 5, -45, 0, 35, 0, 49, +0, -117, 64, 14, 0, 30, 11, 38, 36, 42, 11, 38, 18, 45, 33, 33, 2, 45, -70, 2, 124, 0, 2, 1, 31, +-74, 25, 21, 39, 63, 22, 1, 22, -70, 2, -72, 0, 18, 2, 124, 64, 53, 25, 1, 14, 127, 36, 29, 36, -24, +48, -7, 30, 56, 34, -7, 32, 33, 1, 33, 105, -112, 51, 1, -128, 51, -64, 51, 2, 96, 51, 112, 51, 2, 64, +51, 80, 51, 2, 51, 21, -24, 63, 22, 1, 22, 39, 42, 41, 5, 105, 50, -101, -116, 24, 43, 16, -10, -19, -12, +93, -19, 16, 93, 93, 93, 93, -10, 93, -19, -12, -19, -19, 60, 16, -26, 0, 63, -3, -12, 93, -28, 16, -3, -19, +16, 60, 60, 17, 18, 57, 57, 1, 17, 18, 57, 57, 17, 57, 49, 48, 1, 6, 35, 34, 38, 53, 52, 54, 54, +55, 54, 55, 55, 54, 55, 46, 2, 35, 34, 6, 7, 39, 54, 54, 51, 50, 23, 22, 21, 21, 7, 20, 23, 35, +38, 3, 6, 7, 6, 7, 6, 21, 20, 22, 51, 50, 54, 55, 54, 2, 36, 122, -122, 113, -124, 32, 63, 50, 35, +64, -109, 72, 24, 1, 26, 71, 59, 79, 78, 9, -119, 12, -104, -115, -92, 68, 67, 1, 41, -108, 20, 17, 53, -117, +90, 27, 28, 68, 62, 73, 108, 18, 7, 3, 85, 107, 123, 96, 48, 72, 56, 17, 11, 10, 22, 14, 6, 70, 48, +35, 65, 60, 34, 89, 119, 61, 62, 119, -16, 61, -122, 50, 40, 1, 44, 14, 22, 14, 25, 26, 38, 41, 58, 78, +57, 20, 0, 0, 2, 0, 45, 2, -28, 2, -67, 5, -45, 0, 11, 0, 23, 0, 67, -77, 47, 25, 1, 18, -67, +2, 124, 0, 6, 0, 6, 1, 31, 0, 12, 2, 124, 64, 26, 0, 6, 20, 0, 1, 21, 41, 3, 105, -17, 25, +1, 112, 25, -128, 25, 2, 25, 15, 41, 9, 105, 24, -101, 104, 24, 43, 16, -10, -19, 16, 93, 93, -10, -19, 0, +63, 63, 16, -19, -19, 16, -19, 49, 48, 1, 93, 1, 50, 22, 21, 20, 6, 35, 34, 38, 53, 52, 54, 23, 34, +6, 21, 20, 22, 51, 50, 54, 53, 52, 38, 1, 117, -111, -73, -72, -113, -111, -72, -73, -111, 81, 99, 101, 79, 80, +100, 101, 5, -45, -56, -80, -81, -56, -60, -81, -76, -56, -123, 114, -127, 126, 117, 117, -125, 122, 116, 0, 0, 1, 0, +127, 0, 0, 5, -61, 5, -33, 0, 42, 1, 89, 64, 37, 57, 15, 57, 26, 69, 3, 74, 15, 74, 26, 70, 37, +89, 1, 86, 17, 105, 1, 102, 17, 124, 1, 122, 26, 116, 37, -118, 25, -124, 38, 15, 59, 2, 1, 46, 8, 32, +-72, 2, 72, 64, 41, 9, 3, 43, 22, 59, 22, 2, -7, 22, 1, 22, 58, 19, 58, 18, 43, 39, 59, 39, 2, +-119, 39, -7, 39, 2, 39, 58, 42, 58, 0, 0, 18, 30, 20, 21, 41, 40, 40, 21, 8, 18, -72, 2, 58, -78, +21, 22, 0, -69, 2, 58, 0, 39, 0, 40, -1, -10, 64, 17, 11, 11, 2, 85, 40, 22, 10, 11, 11, 2, 85, +47, 22, 79, 22, 2, 22, -72, 2, 120, 64, 13, 19, 28, 38, 13, 74, 20, 19, 40, 15, 15, 2, 85, 19, -72, +-1, -6, -76, 13, 13, 2, 85, 19, -72, -1, -16, -76, 12, 12, 2, 85, 19, -72, -1, -32, 64, 16, 11, 11, 2, +85, 16, 19, 1, 19, 106, 44, 32, 40, 64, 40, 2, 40, -72, 2, 120, -75, 41, 36, 38, 5, 74, 41, -72, -1, +-32, -76, 16, 16, 2, 85, 41, -72, -1, -22, -76, 15, 15, 2, 85, 41, -72, -1, -18, -76, 13, 13, 2, 85, 41, +-72, -1, -10, 64, 18, 12, 12, 2, 85, 96, 41, 1, 0, 41, 32, 41, 2, 41, -84, 43, -99, -89, 24, 43, 16, +-10, 93, 113, 43, 43, 43, 43, -12, -19, 16, -19, 93, 16, -10, 93, 43, 43, 43, 43, 60, -10, -19, 16, -28, 93, +43, 16, 43, 60, -19, 16, 60, -19, 0, 63, 60, 16, 60, 16, 60, -3, 60, 16, -28, -27, 93, 113, 16, -28, -27, +93, 113, 63, -19, 49, 48, 67, 121, 64, 32, 29, 35, 6, 12, 34, 37, 7, 38, 11, 37, 30, 38, 33, 8, 36, +-106, 0, 31, 10, 28, -106, 1, 35, 6, 32, -106, 1, 29, 12, 32, -106, 1, 43, 43, 1, 43, 43, 43, 43, 43, +43, -127, -127, 1, 113, 93, 37, 38, 39, 38, 2, 53, 52, 18, 36, 51, 32, 23, 22, 17, 20, 2, 7, 6, 7, +37, 21, 33, 53, 54, 55, 62, 2, 53, 52, 2, 38, 35, 34, 7, 6, 17, 20, 18, 23, 21, 33, 53, 1, -16, +108, 57, 87, 94, -97, 1, 47, -60, 1, 80, -76, -125, 108, 87, 53, 96, 1, 108, -3, -63, 80, 44, 72, 100, 51, +99, -55, -113, -65, 105, -110, -74, -96, -3, -65, -96, 67, 63, 96, 1, 3, -99, -60, 1, 73, -80, -2, -70, -2, -6, +-88, -2, -3, 93, 58, 63, 6, -90, -79, 40, 38, 61, -88, -66, 103, -118, 1, 23, -110, 120, -87, -2, -15, -39, -2, +-55, 72, -76, -88, 0, 3, 0, 68, -1, -24, 6, -54, 4, 62, 0, 53, 0, 60, 0, 74, 1, 123, 64, 53, 61, +57, 61, 72, 76, 41, 79, 57, 90, 41, 94, 57, 122, 5, 7, 40, 64, 48, 34, 52, 37, 76, 5, 67, 14, 66, +37, 68, 72, 91, 4, 86, 14, 86, 15, 83, 37, 105, 7, 103, 14, 101, 15, 100, 35, 119, 16, 116, 38, -121, 16, +18, 36, -72, -1, -1, -74, 12, 16, 2, 85, 18, 28, 61, -72, -1, -26, -76, 16, 16, 2, 85, 61, -72, -1, -64, +64, 46, 12, 13, 2, 85, 0, 61, 16, 61, 2, 61, 61, 23, 70, 54, 28, -112, 46, -96, 46, 2, 46, 46, 50, +58, 28, -107, 23, 28, 32, 58, 28, 39, 39, 32, 7, 70, 28, 9, 50, 28, 0, 0, 16, 0, 2, 0, -72, 2, +125, 64, 20, 3, 3, 9, 11, 54, 37, 18, 51, 61, 37, 46, 55, 64, 46, 10, 16, 16, 2, 85, 46, -72, -1, +-10, 64, 27, 13, 13, 2, 85, 46, 21, 12, 12, 6, 85, 46, 16, 11, 11, 6, 85, -33, 46, 1, 31, 46, 63, +46, -113, 46, 3, 46, -72, 1, -60, -75, 43, 53, 36, 0, 51, 43, -72, -1, -30, -76, 16, 16, 2, 85, 43, -72, +-1, -12, -76, 13, 13, 6, 85, 43, -72, -1, -34, -76, 12, 12, 6, 85, 43, -72, -1, -8, 64, 14, 11, 11, 6, +85, 16, 43, 48, 43, 64, 43, -128, 43, 4, 43, -72, 1, -28, 64, 59, 12, 27, 37, 28, 34, 67, 36, 12, 24, +13, 13, 2, 85, 12, 34, 12, 12, 2, 85, 12, 20, 11, 11, 2, 85, 12, 20, 13, 13, 6, 85, 12, 28, 12, +12, 6, 85, 12, 16, 11, 11, 6, 85, -33, 12, 1, 31, 12, 63, 12, 79, 12, 3, 12, 25, 75, 52, 55, 24, +43, 78, 16, -12, 93, 113, 43, 43, 43, 43, 43, 43, 77, -19, -12, -19, 16, -3, 93, 43, 43, 43, 43, 77, -12, +-19, 16, -28, 93, 113, 43, 43, 43, 43, -19, 16, -3, -28, -19, 0, 63, 60, 16, -19, 93, -19, 16, -19, 63, 60, +16, -19, 16, -19, -19, 17, 18, 57, 47, 93, -19, 17, 18, 57, 47, 93, 43, 43, -19, 43, 49, 48, 0, 93, 1, +93, 1, 6, 6, 35, 34, 38, 39, 6, 6, 35, 34, 38, 53, 52, 54, 54, 55, 54, 55, 54, 53, 52, 38, 35, +34, 6, 6, 7, 39, 62, 2, 51, 50, 23, 22, 23, 54, 54, 51, 50, 22, 18, 21, 20, 7, 33, 30, 2, 51, +50, 54, 55, 1, 33, 38, 38, 35, 34, 6, 7, 6, 7, 6, 7, 6, 21, 20, 22, 51, 50, 54, 55, 54, 6, +-58, 50, -16, -78, 127, -65, 77, 104, -43, 123, -84, -65, 99, -79, -62, -106, 102, 1, 105, -125, 87, 120, 57, 19, -81, +28, 105, -60, -125, -89, 102, 59, 40, 64, -94, 115, -94, -44, 98, 2, -3, 1, 2, 67, -109, 88, 103, -113, 27, -3, +-65, 2, 72, 14, -104, 122, 126, -95, -71, 79, -13, 109, 44, 59, 106, 101, 115, -85, 26, 15, 1, 69, -89, -74, 96, +102, 102, 96, -79, 127, 86, -105, 78, 25, 20, 29, 25, 16, 126, 101, 42, 77, 85, 21, 117, -119, 78, 50, 29, 64, +70, 73, -99, -2, -2, 125, 19, 42, -112, -126, 87, 118, 107, 1, 28, -98, -110, -96, -12, 34, 39, 17, 34, 47, 76, +71, 97, 114, 85, 52, 0, 0, 3, 0, -127, -1, -79, 4, 100, 4, 103, 0, 25, 0, 33, 0, 43, 2, -62, 64, +-1, 24, 3, 21, 5, 34, 0, 44, 13, 37, 25, 70, 0, 84, 25, 100, 25, 8, 21, 25, 1, 27, 16, 16, 16, +2, 85, 40, 33, 1, 16, 4, 20, 5, 28, 16, 28, 17, 28, 18, 21, 34, 70, 3, 73, 13, 76, 16, 76, 17, +69, 29, 75, 38, 90, 26, 102, 21, 100, 30, 102, 34, -118, 26, -128, 34, -49, 26, 19, 18, 26, 43, 44, 3, 43, +26, 47, 34, 59, 0, 5, 12, 0, 11, 2, 4, 15, 26, 2, 4, -70, 17, -20, 4, -5, 1, -10, 15, 4, 61, +17, 56, 38, 84, 29, -70, 2, 4, -33, 45, -23, 0, -22, 2, -21, 3, 4, 88, 9, 92, 17, 94, 38, -118, 34, +4, -123, 0, -118, 13, -118, 16, -118, 27, 4, -23, 1, -22, 26, -6, 0, -6, 2, 4, -54, 33, -38, 0, -38, 3, +-21, 34, 4, -54, 0, -54, 2, -7, 4, 3, -97, 17, -102, 33, -86, 3, -85, 33, 4, 124, 27, 121, 33, 121, 34, +-85, 35, 4, 106, 33, 105, 35, 122, 13, 122, 16, 4, 108, 17, 102, 26, 109, 38, 117, 0, 4, 23, 0, 59, 34, +69, 2, 74, 15, 4, 38, 25, 45, 26, 44, 34, 57, 26, 4, -91, 0, -60, 26, -39, 2, -26, 15, 4, 77, 12, +67, 25, 73, 30, 70, 39, 4, 122, 34, 118, 35, -108, 16, -107, 34, 4, 100, 9, 109, 21, 109, 30, 104, 34, -117, +34, 5, 18, 3, 34, 35, 64, 55, 13, 14, 14, 2, 0, 26, 33, 16, 15, 1, 1, 15, 15, 125, 14, 2, 20, +14, 14, 2, 33, 35, 26, 34, 4, 40, 31, 2, 45, 3, 1, 0, 3, 40, 7, 15, 44, 16, 13, 14, 3, 31, +20, 0, 28, 23, 13, 37, 11, 15, 14, 20, 2, 7, 1, -72, 2, 91, -76, 28, 28, 23, 7, 14, -72, 2, 91, +-74, 37, 28, 11, 11, 40, 36, 7, -72, -1, -16, -76, 16, 16, 2, 85, 7, -72, -1, -20, -76, 12, 12, 2, 85, +7, -72, -1, -8, -76, 11, 11, 6, 85, 7, -72, -1, -6, -76, 12, 12, 6, 85, 7, -72, -1, -3, -76, 13, 13, +6, 85, 7, -72, -1, -4, 64, 22, 15, 15, 6, 85, 7, 16, 16, 16, 6, 85, -49, 7, -33, 7, -17, 7, -16, +7, 4, 7, 26, 45, -72, -1, -64, -77, 18, 21, 52, 45, -72, -1, -64, 64, 53, 13, 16, 52, -112, 45, -96, 45, +-16, 45, 3, 0, 45, 32, 45, -128, 45, -32, 45, 4, 45, 31, 36, 20, 0, 16, 16, 2, 85, 20, 10, 11, 11, +2, 85, 20, 5, 11, 11, 6, 85, 20, 14, 12, 12, 6, 85, 20, 4, 13, 13, 6, 85, 20, -72, -1, -12, 64, +17, 15, 15, 6, 85, 31, 20, -33, 20, -17, 20, 3, 31, 20, 1, 20, 25, 44, -70, 1, 51, 2, -111, 0, 24, +43, 78, 16, -12, 93, 113, 43, 43, 43, 43, 43, 43, 77, -19, 78, 16, 93, 113, 43, 43, -10, 93, 43, 43, 43, +43, 43, 43, 43, 77, -19, 0, 63, -19, -28, 63, -19, -28, 17, 57, 17, 18, 57, 17, 18, 57, 17, 18, 57, 1, +17, 18, 23, 57, 18, 57, 17, 18, 23, 57, 18, 57, 17, 18, 23, 57, -121, 14, 46, 43, 125, 16, -60, 7, 14, +60, 60, 60, 60, 7, 16, 14, 60, 60, 60, 60, 49, 48, 1, 67, 92, 88, -71, 0, 0, -1, -34, -78, 12, 57, +33, -72, -1, -34, -74, 28, 57, 34, 34, 18, 57, 35, -72, -1, -34, 64, 10, 25, 57, 26, 34, 37, 57, 26, 64, +30, 57, 43, 43, 43, 0, 43, 43, 43, 89, 93, 93, 93, 93, 113, 113, 1, 93, 93, 93, 93, 93, 93, 93, 93, +93, 93, 93, 93, 113, 113, 67, 92, 88, 64, 30, 41, 25, 34, 26, 35, 34, 3, -23, 15, 1, 35, 3, 36, 26, +32, 34, 3, -26, 0, -27, 2, -28, 3, -29, 4, -28, 34, -17, 45, 6, 1, 93, 113, 0, 93, 113, 89, 1, 93, +113, 43, 0, 113, 93, 1, 55, 23, 7, 22, 23, 22, 21, 16, 7, 6, 35, 34, 39, 7, 39, 55, 38, 39, 38, +53, 16, 0, 51, 50, 22, 7, 38, 35, 34, 6, 21, 20, 23, 1, 1, 22, 51, 50, 54, 53, 52, 39, 38, 3, +-105, 99, 96, 107, 63, 23, 31, -87, -119, -63, -97, 122, 105, 94, 108, 59, 25, 40, 1, 38, -58, 82, -118, 23, 91, +100, -123, -76, 52, 2, 15, -2, 63, 78, 98, -117, -75, 12, 8, 3, -25, -128, 70, -118, 86, 70, 100, -123, -2, -44, +-115, 113, 80, -121, 71, -115, 68, 68, 109, -118, 1, 45, 1, 13, 42, -79, 70, -52, -54, -106, 101, 1, -22, -3, -71, +63, -52, -52, 76, 57, 42, 0, 2, 0, -98, -2, 83, 4, 79, 4, 38, 0, 3, 0, 34, 0, -120, 64, 55, -116, +31, 1, 124, 31, -116, 30, 2, 107, 31, 124, 30, 2, 96, 16, 107, 30, 2, 93, 30, 93, 31, 2, 75, 30, 82, +16, 2, 76, 18, 75, 29, 2, 58, 18, 68, 16, 2, 31, 29, 11, 12, 4, 4, 20, 39, 21, 21, 4, 17, 41, +24, 15, 34, 4, -72, 2, -81, 64, 33, 2, 2, 1, 60, 3, 6, 20, 94, 21, 108, 32, 36, 1, 36, 0, 60, +2, 34, 4, 94, 34, -120, 14, 94, 32, 27, 1, 27, 118, 35, -98, -104, 24, 43, 16, -12, 93, -19, -12, -19, 16, +60, -19, 16, 93, -10, -19, 0, 63, -3, 60, 16, -10, 60, 63, -19, 18, 57, 47, -28, 17, 23, 57, 49, 48, 1, +93, 93, 93, 93, 93, 93, 93, 93, 1, 21, 35, 53, 19, 22, 21, 20, 7, 6, 7, 14, 2, 21, 20, 22, 51, +50, 54, 55, 23, 6, 6, 35, 34, 38, 53, 52, 54, 55, 62, 2, 55, 2, -35, -51, -63, 1, 30, 22, 49, 36, +-69, 55, -92, 119, 114, -101, 24, -72, 25, -9, -54, -40, -1, 89, -125, 89, 54, 25, 2, 4, 38, -51, -51, -2, -105, +34, 17, 110, 77, 58, 59, 43, -92, 98, 58, 106, -98, -112, -104, 21, -53, -36, -22, -90, 97, -96, 116, 79, 74, 96, +108, 0, 0, 2, 0, -24, -2, 108, 1, -57, 4, 38, 0, 3, 0, 9, 0, 118, -79, 6, 2, 67, 84, 88, -79, +7, 4, -72, 2, -81, 64, 11, 1, 60, 3, 6, 0, 58, 6, 60, 3, 58, 7, 1, 47, -28, -3, -28, 0, 63, +-3, -26, 47, 49, 48, 27, -79, 28, 4, -72, 2, -81, 64, 35, 1, 60, 3, 7, 3, 6, 11, -53, 0, 58, 4, +56, 5, 9, 56, 3, 58, 8, 60, 5, 5, 6, 60, 32, 7, 1, 7, -53, 10, 11, -127, 33, -39, -11, 24, 43, +43, -10, 93, -3, 60, 16, -3, -28, -28, 16, -28, -28, -26, 0, 63, 47, 16, -3, -26, 49, 48, 75, 83, 88, -77, +4, 5, 9, 8, 1, 16, 60, 16, 60, 89, 89, 1, 21, 35, 53, 19, 19, 17, 35, 17, 19, 1, -65, -49, -96, +55, -33, 52, 4, 38, -51, -51, -2, -109, -4, -8, -2, -69, 1, 69, 3, 8, 0, 0, 1, 0, 114, 1, -88, 4, +58, 4, 6, 0, 5, 0, 47, -74, 2, 3, 1, 0, 3, 37, 4, -72, 1, 29, 64, 14, 0, 2, 1, 37, 5, +0, 26, 7, 3, 25, 6, 87, 90, 24, 43, 78, 16, -28, 16, -10, 60, 77, -3, 60, 0, 47, -3, -19, 16, 60, +16, 60, 49, 48, 1, 35, 17, 33, 53, 33, 4, 58, -86, -4, -30, 3, -56, 1, -88, 1, -74, -88, 0, 0, 1, +0, 84, -1, -78, 4, 100, 7, 77, 0, 7, 0, -121, 64, 59, 4, 6, 20, 6, 2, 0, 7, 16, 7, 2, 3, +6, 7, 3, 4, 7, 63, 2, 3, 20, 2, 2, 3, 7, 0, 3, 4, 3, 2, 4, 76, 5, 6, 20, 5, 5, +6, 4, 5, 0, 7, 7, 76, 2, 1, 20, 2, 2, 1, 7, 6, 3, 4, 5, 7, 2, 0, 3, 1, -72, 1, +102, 64, 17, 6, 6, 6, 6, 8, 1, 26, 9, 5, 25, 8, 9, 120, 33, 113, 122, 24, 43, 43, 78, -28, 16, +-26, 18, 57, 47, 24, 0, 63, 77, -28, 1, 23, 57, 18, 57, 57, 8, -121, 46, 43, 5, 125, 16, -60, 8, -121, +46, 24, 43, 8, 125, 16, -60, 8, -121, 46, 24, 43, 8, -121, 125, -60, 49, 48, 0, 93, 1, 93, 1, 51, 1, +1, 7, 39, 37, 1, 4, 26, 74, -2, -56, -2, 16, -58, 34, 1, 45, 1, -107, 7, 77, -8, 101, 3, -3, 91, +64, -105, -4, -55, 0, 0, 1, 0, 46, -2, 81, 4, 61, 5, -44, 0, 33, 0, -76, 64, 94, 103, 6, 1, 1, +9, 9, 0, 7, 10, 11, 11, 6, 25, 28, 29, 24, 0, 1, 34, 28, 27, 25, 10, 9, 7, 6, 8, 18, 19, +35, 26, 0, 32, 1, 8, 3, 19, 9, 18, 16, 21, 24, 29, 29, 37, 6, 11, 20, 6, 6, 11, 29, 24, 11, +6, 4, 26, 6, 29, 8, 3, 11, 24, 9, 21, 28, 16, 1, 27, 28, 7, 8, 43, 26, 25, 10, 9, 6, 3, +28, 32, 15, 32, 26, 1, 26, 26, 35, 32, 8, 1, 8, 25, 34, -72, 1, -97, -79, -46, 24, 43, 78, 16, -28, +93, 16, -26, 93, 0, 63, 77, -19, 63, 60, 60, 60, -3, 60, 60, 60, 63, -19, 17, 57, 57, 17, 18, 57, 57, +1, 17, 23, 57, -121, 14, 46, 43, 125, 16, -60, 0, 17, 18, 57, 18, 57, 17, 18, 57, 18, 57, 1, 17, 18, +57, 57, 18, 23, 57, 17, 57, 57, 7, 60, 60, 7, 16, 14, 60, 60, 7, 16, 14, 60, 49, 48, 1, 93, 19, +55, 22, 51, 50, 54, 55, 19, 35, 55, 51, 55, 54, 55, 54, 54, 51, 50, 23, 7, 38, 35, 34, 6, 7, 7, +51, 7, 35, 3, 6, 6, 35, 34, 46, 35, 101, 51, 54, 58, 16, -79, -55, 24, -55, 24, 22, 23, 31, 115, 93, +80, -121, 35, 103, 51, 56, 56, 19, 19, -52, 25, -52, -65, 26, 122, 112, 94, -2, 107, -101, 22, 56, 96, 4, 18, +-116, -123, 120, 45, 62, 70, 38, -103, 24, 55, 105, 103, -116, -5, -68, -108, 113, 0, 0, 2, 0, 51, 1, 120, 4, +50, 4, 42, 0, 22, 0, 45, 1, 21, 64, 99, 36, 11, 35, 14, 43, 22, 36, 34, 34, 37, 43, 45, 47, 47, +7, 0, 2, 15, 14, 0, 25, 13, 34, 15, 37, 17, 2, 28, 14, 26, 15, 17, 25, 26, 33, 30, 34, 28, 37, +26, 38, 33, 2, 33, 25, 53, 2, 54, 5, 53, 25, 54, 28, 69, 2, 70, 5, 69, 25, 70, 28, 86, 2, 86, +25, 101, 2, 101, 25, 118, 5, 118, 28, -122, 5, -122, 28, 31, 27, 10, 27, 18, 27, 41, 20, 45, 4, 11, 10, +11, 18, 11, 41, 4, 45, 4, 36, 32, 35, -72, 2, -96, -73, 39, 32, 112, 32, -128, 32, 2, 32, -72, 2, -77, +-78, 16, 32, 9, -72, 2, -96, -73, 13, 32, 12, 58, 3, 24, 32, 23, -72, 2, -96, -73, 43, 32, 112, 26, -128, +26, 2, 26, -72, 2, -77, -77, 20, 1, 32, 0, -72, 2, -96, -76, 20, 32, 3, 6, 39, -69, 1, 62, 0, 36, +0, 32, 1, 62, -77, 36, 35, 35, 16, -69, 1, 62, 0, 13, 0, 9, 1, 62, -76, 13, 12, 105, 47, 43, -69, +1, 62, 0, 23, 0, 26, 1, 62, -77, 23, 24, 24, 20, -69, 1, 62, 0, 0, 0, 3, 1, 62, -73, 1, 1, +0, 105, 46, -101, -115, 24, 43, 16, -10, 60, 16, -19, 16, -26, 60, 16, 60, -19, 16, -26, 16, -10, 60, -26, 16, +-19, 60, 16, 60, -26, 16, -19, 0, 63, -3, -12, -19, 16, -10, 93, -3, -12, -19, 16, -12, -19, -12, -3, -10, 93, +-19, -12, -19, 49, 48, 0, 93, 93, 93, 1, 93, 19, 53, 54, 51, 50, 22, 23, 22, 22, 51, 50, 54, 55, 21, +6, 6, 35, 34, 38, 38, 35, 34, 6, 3, 53, 54, 51, 50, 22, 23, 22, 22, 51, 50, 54, 55, 21, 6, 6, +35, 34, 38, 38, 35, 34, 6, 51, 106, -84, 60, -125, 123, 69, 69, 35, 65, -117, 54, 64, -125, 82, 60, 108, -18, +79, 64, 113, 84, 106, -84, 60, -125, 123, 69, 69, 35, 65, -117, 54, 64, -125, 82, 60, 108, -18, 79, 64, 113, 2, +-30, -51, 120, 34, 53, 30, 17, 78, 59, -44, 60, 54, 27, 107, 55, -2, 69, -51, 120, 34, 53, 29, 18, 78, 59, +-44, 60, 54, 28, 106, 55, 0, 0, 2, 0, 26, 0, 0, 4, -54, 5, 107, 0, 2, 0, 5, 0, 114, 64, 65, +2, 1, 2, 0, 1, 76, 5, 4, 20, 5, 5, 4, 2, 0, 2, 1, 0, -70, 3, 4, 20, 3, 3, 4, 5, +1, 2, 3, 0, 4, 6, 3, 5, 76, 1, 1, 0, 10, 4, 4, 5, 3, 11, 0, 1, 0, 26, 7, -22, 1, +-8, 1, 2, 121, 1, 1, 1, 25, 6, 7, -15, 33, -87, 104, 24, 43, 43, 78, -28, 113, 93, 16, -26, 93, 25, +17, 18, 57, 47, 0, 24, 63, 60, 77, 16, -3, 60, 63, 1, 18, 57, 57, 18, 57, -121, 46, 43, 8, 125, 16, +-60, -121, 5, 46, 24, 43, 8, 125, 16, -60, 49, 48, 33, 33, 9, 3, 4, -54, -5, 80, 2, 116, 1, 80, -2, +113, -2, 72, 5, 107, -6, -25, 3, -57, -4, 57, 0, 2, 0, -122, 0, 72, 3, -33, 3, -40, 0, 5, 0, 11, +0, -124, 64, 11, 9, 3, 13, 9, 25, 3, 29, 9, 4, 10, 4, -72, 1, -53, 64, 11, 8, 2, 8, -7, 7, +7, 11, -7, 10, 117, 6, -72, -1, -64, -77, 25, 28, 52, 6, -72, -1, -64, 64, 27, 15, 17, 52, 6, -82, 9, +64, 25, 28, 52, 9, 64, 14, 17, 52, 9, -97, 0, 2, -24, 1, 58, 5, -7, 4, 117, 0, -72, -1, -64, -77, +25, 28, 52, 0, -72, -1, -64, 64, 18, 15, 17, 52, 0, -82, 0, 3, 16, 3, 32, 3, 3, 3, -84, 12, -81, +121, 24, 43, 16, -10, 93, -3, 43, 43, -10, -3, -12, -19, 16, -10, 43, 43, -3, 43, 43, -10, -3, 60, 16, -3, +0, 47, 60, -3, 60, 49, 48, 1, 93, 1, 1, 35, 1, 1, 51, 19, 1, 35, 1, 1, 51, 1, 84, 1, 3, +-110, -2, -63, 1, 63, -108, 126, 1, 8, -104, -2, -57, 1, 57, -104, 2, 16, -2, 56, 1, -56, 1, -56, -2, 56, +-2, 56, 1, -56, 1, -56, 0, 0, 2, 0, -116, 0, 72, 3, -27, 3, -40, 0, 5, 0, 11, 0, -128, 64, 11, +6, 3, 2, 9, 22, 3, 18, 9, 4, 1, 7, -72, 1, -53, 64, 24, 5, 11, 10, 8, -7, 7, 7, 11, -7, +10, 117, 6, 64, 25, 28, 52, 6, 64, 15, 17, 52, 6, -82, 9, -72, -1, -64, -77, 25, 28, 52, 9, -72, -1, +-64, 64, 35, 14, 17, 52, 9, -97, 0, 2, -7, 1, 58, 5, -24, 4, 117, 0, 64, 25, 28, 52, 0, 64, 15, +17, 52, 0, -82, 15, 3, 31, 3, 2, 3, -84, 13, -99, -71, 1, -122, 0, 24, 43, 16, -10, 93, -3, 43, 43, +-10, -3, -12, -19, 16, -10, 43, 43, -3, 43, 43, -10, -3, 60, 16, -19, 16, 0, 47, 60, -10, 60, 49, 48, 1, +93, 1, 1, 51, 1, 1, 35, 3, 1, 51, 1, 1, 35, 3, 23, -2, -5, -108, 1, 63, -2, -63, -109, 127, -2, +-8, -105, 1, 58, -2, -58, -105, 2, 16, 1, -56, -2, 56, -2, 56, 1, -56, 1, -56, -2, 56, -2, 56, 0, 0, +3, 0, -17, 0, 0, 7, 18, 0, -51, 0, 3, 0, 7, 0, 11, 0, 60, 64, 18, 6, 5, 2, 1, 4, 10, +60, 8, 8, 7, 7, 4, 4, 3, 10, 10, 60, 9, -72, 1, 25, -78, 7, 60, 5, -72, 1, 25, -73, 3, 60, +0, -53, 12, -39, -11, 24, 43, 16, -10, -3, -10, -3, -10, -3, 0, 63, 60, 16, 60, 16, 60, 16, -19, 23, 50, +49, 48, 51, 53, 51, 21, 33, 53, 51, 21, 33, 53, 51, 21, -17, -51, 1, -34, -51, 1, -35, -50, -51, -51, -51, +-51, -51, -51, -1, -1, -1, -3, 0, 0, 5, 89, 7, 44, 2, 38, 0, 36, 0, 0, 1, 7, 0, 67, 1, 103, +1, 106, 0, 33, -79, 2, 16, -72, -1, -64, 64, 11, 11, 17, 52, 16, 12, 0, 72, 43, 2, 1, 16, -70, 2, +33, 0, 41, 1, 100, -123, 0, 43, 1, 43, 43, 53, 0, -1, -1, -1, -3, 0, 0, 5, 89, 6, -5, 2, 38, +0, 36, 0, 0, 1, 7, 0, -41, 1, 86, 1, 81, 0, 61, -77, 2, 2, 1, 30, -70, 2, 33, 0, 41, 1, +100, -123, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 15, 27, 0, 3, 65, 43, 27, 64, 21, 15, 32, 1, +-1, 32, 1, 32, 64, 24, 29, 52, 32, 64, 11, 16, 52, 32, 1, 82, 72, 43, 43, 43, 43, 113, 114, 89, 53, +0, -1, -1, 0, 99, -1, -25, 5, -35, 6, -5, 2, 38, 0, 50, 0, 0, 1, 7, 0, -41, 1, -53, 1, 81, +0, 51, -77, 2, 2, 1, 43, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 28, 40, +3, 3, 65, 43, 27, 64, 10, 47, 45, 63, 45, 2, 95, 45, 1, 45, 3, -72, -1, -30, -79, 72, 43, 43, 93, +93, 89, 53, 0, 0, 2, 0, -127, -1, -25, 7, -65, 5, -45, 0, 23, 0, 36, 1, -104, 64, 80, 20, 25, 20, +30, 27, 32, 27, 36, 4, 4, 25, 4, 30, 11, 32, 11, 36, 4, 108, 32, 110, 36, 2, 101, 26, 99, 30, 2, +48, 25, 48, 30, 2, 32, 25, 32, 30, 2, 121, 7, 1, 5, 13, 1, -25, 11, 1, -73, 6, -58, 11, 2, -113, +3, -128, 14, 2, 107, 4, 1, 112, 14, 1, 117, 11, 115, 13, 2, 126, 3, 124, 4, 2, 35, 32, 9, 17, 2, +85, 33, -72, -1, -32, -76, 9, 17, 2, 85, 14, -72, -1, -4, 64, 51, 11, 17, 2, 85, 3, 22, 23, 14, 18, +20, 19, 30, 22, 22, 21, 21, 2, 15, 24, 30, 12, 3, 17, 18, 30, 16, 15, 2, 0, 23, 30, 1, 2, 8, +31, 30, 5, 9, 34, 45, 15, 2, 30, 18, 23, 10, 16, 16, 2, 85, 23, -72, -1, -12, -76, 15, 15, 2, 85, +23, -72, -1, -10, 64, 11, 13, 13, 2, 85, 23, 22, 12, 12, 2, 85, 23, -72, -1, -8, -76, 11, 11, 2, 85, +23, -72, -1, -12, -76, 15, 15, 6, 85, 23, -72, -1, -12, 64, 11, 13, 13, 6, 85, 23, 18, 12, 12, 6, 85, +23, -72, -1, -8, 64, 46, 11, 11, 6, 85, 23, 48, 23, 80, 23, 2, 32, 23, 96, 23, 2, 23, 37, 38, 21, +84, 17, 74, 48, 0, 64, 0, 2, 80, 0, 96, 0, 2, 32, 0, 112, 0, 2, 0, 26, 127, 38, 1, 38, 28, +38, 9, -72, -1, -14, -76, 16, 16, 2, 85, 9, -72, -1, -12, 64, 11, 15, 15, 2, 85, 9, 4, 11, 11, 2, +85, 9, -72, -1, -24, -76, 16, 16, 6, 85, 9, -72, -1, -9, 64, 16, 15, 15, 6, 85, 9, 4, 11, 11, 6, +85, 32, 9, 1, 9, 25, 37, -72, 1, 51, -79, -103, 24, 43, 78, 16, -12, 93, 43, 43, 43, 43, 43, 43, 77, +-19, 78, 16, 93, -10, 93, 93, 93, 77, -12, -28, 17, 18, 57, 93, 93, 47, 43, 43, 43, 43, 43, 43, 43, 43, +43, 60, -3, 60, -28, 0, 63, -19, 63, 60, -3, 60, 63, 60, -3, 60, 63, -19, 17, 18, 57, 47, 60, 16, -3, +60, 17, 57, 17, 18, 57, 49, 48, 0, 43, 43, 43, 93, 93, 93, 93, 93, 93, 93, 113, 1, 93, 93, 93, 93, +93, 93, 93, 37, 21, 33, 53, 6, 33, 32, 39, 38, 17, 16, 0, 33, 32, 23, 53, 33, 21, 33, 17, 33, 21, +33, 17, 1, 34, 6, 2, 21, 16, 18, 51, 50, 18, 17, 16, 2, 7, -65, -4, -94, -121, -2, -9, -2, -45, -101, +-120, 1, 28, 1, 52, 1, 8, -120, 3, 63, -3, 118, 2, 87, -3, -87, -3, -70, 101, -64, 98, -25, -96, -95, -27, +-25, -83, -83, -44, -19, -24, -51, 1, 67, 1, 66, 1, -78, -33, -58, -83, -2, 64, -84, -2, 12, 4, -119, -126, -2, +-9, -37, -2, -47, -2, -30, 1, 29, 1, 73, 1, 50, 1, 27, 0, 0, 3, 0, 82, -1, -24, 7, 67, 4, 62, +0, 32, 0, 46, 0, 53, 1, -100, 64, 109, 38, 21, 87, 11, 2, 68, 22, 68, 35, 75, 38, 75, 42, 68, 45, +75, 50, 68, 52, 87, 5, 87, 8, 83, 35, 95, 38, 95, 42, 83, 45, 103, 8, 104, 14, 96, 36, 108, 38, 108, +42, 99, 45, 19, 92, 50, 84, 52, 2, 82, 22, 91, 25, 2, 50, 22, 51, 35, 59, 38, 58, 42, 51, 45, 62, +50, 50, 52, 7, 0, 13, 40, 0, 21, 20, 37, 13, 53, 51, 47, 28, -112, 20, -96, 20, 2, 20, 20, 3, 43, +28, 10, 51, 28, 16, 16, 10, 7, 37, 28, 3, 23, 28, 0, 27, 16, 27, 2, 27, -72, 2, 125, 64, 38, 30, +30, 3, 11, 47, 64, 40, 64, 20, 26, 64, 27, 51, 20, 10, 15, 15, 2, 85, 20, 10, 11, 12, 2, 85, 20, +12, 12, 12, 6, 85, -33, 20, 1, 63, 20, 1, 20, -72, 1, -60, -78, 48, 64, 19, -72, -1, -20, -76, 16, 16, +2, 85, 19, -72, -1, -10, -76, 15, 15, 2, 85, 19, -72, -1, -42, -76, 13, 13, 2, 85, 19, -72, -1, -48, -76, +12, 12, 2, 85, 19, -72, -1, -42, -76, 11, 11, 2, 85, 19, -72, -1, -16, -76, 16, 16, 6, 85, 19, -72, -1, +-13, -76, 15, 15, 6, 85, 19, -72, -1, -20, -76, 13, 13, 6, 85, 19, -72, -1, -53, -76, 12, 12, 6, 85, 19, +-72, -1, -15, -73, 11, 11, 6, 85, -48, 19, 1, 19, -72, -1, -64, -77, 11, 17, 52, 19, -72, 2, 127, 64, 64, +33, 36, 6, 6, 14, 15, 2, 85, 6, 28, 13, 13, 2, 85, 6, 24, 12, 12, 2, 85, 6, 32, 11, 11, 2, +85, 6, 10, 16, 16, 6, 85, 6, 25, 13, 13, 6, 85, 6, 40, 12, 12, 6, 85, 6, 22, 11, 11, 6, 85, +-33, 6, 1, 63, 6, 79, 6, 2, 6, 25, 54, 52, 55, 24, 43, 78, 16, -12, 93, 113, 43, 43, 43, 43, 43, +43, 43, 43, 77, -19, -3, 43, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, -28, 93, 113, 43, 43, 43, +-12, -19, 16, -3, -3, 0, 63, 60, 16, -19, 93, -19, 16, -19, 63, 60, 16, -19, 16, -19, 18, 57, 47, 93, -19, +17, 57, 57, 17, 18, 57, 57, 1, 17, 57, 57, 49, 48, 1, 93, 93, 93, 93, 0, 93, 37, 6, 6, 35, 34, +0, 17, 52, 18, 54, 51, 50, 22, 23, 54, 54, 51, 50, 0, 3, 33, 22, 22, 51, 50, 54, 55, 23, 6, 6, +35, 34, 38, 1, 20, 23, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 6, 5, 33, 38, 38, 35, 34, 6, 3, +-46, 76, -58, 122, -31, -2, -19, 117, -17, -110, -118, -51, 51, 64, -55, 124, -36, 1, 16, 2, -4, -16, 3, -77, -122, +99, -113, 32, -76, 43, -21, -77, -122, -44, -4, -5, 71, 92, -109, -127, -72, -75, -124, 87, -110, 77, 3, 45, 2, 75, +12, -97, 118, 120, -89, -81, 99, 100, 1, 30, 1, 0, -87, 1, 11, -124, 115, 88, 93, 110, -2, -46, -2, -45, -90, +-63, 111, 111, 26, -91, -77, 105, 1, -60, -70, 97, 126, -44, -57, -58, -51, 98, -64, 17, -105, -100, -92, 0, 1, -1, +-4, 1, -54, 4, 111, 2, 91, 0, 3, 0, 30, 64, 15, 1, 53, 0, 2, 26, 5, 32, 0, 1, 0, 25, 4, +-77, 122, 24, 43, 78, 16, -28, 93, 16, -26, 0, 47, 77, -19, 49, 48, 3, 53, 33, 21, 4, 4, 115, 1, -54, +-111, -111, 0, 0, 1, 0, 0, 1, -54, 8, 0, 2, 91, 0, 3, 0, 26, 64, 13, 1, 53, 0, 2, 5, 32, +0, 1, 0, 4, -77, 122, 24, 43, 16, 60, 93, 16, 60, 0, 47, -19, 49, 48, 17, 53, 33, 21, 8, 0, 1, +-54, -111, -111, 0, 2, 0, 83, 3, -13, 2, 90, 5, -45, 0, 11, 0, 23, 0, -40, 64, 92, -97, 25, -81, 25, +2, -17, 7, -17, 19, 2, -33, 7, -33, 19, 2, -49, 7, -49, 19, 2, -65, 7, -65, 19, 2, -81, 7, -81, 19, +2, -97, 7, -97, 19, 2, -113, 7, -113, 19, 2, 126, 7, 126, 19, 2, -5, 8, -5, 20, 2, 108, 8, 108, 20, +2, 90, 8, 90, 20, 2, 12, 8, 12, 20, 2, 20, 19, 8, 7, 23, 12, 15, 11, 0, 3, 15, -7, 14, 3, +-7, 2, 14, 13, 2, 1, 12, 60, 13, 0, 60, 13, 1, -72, 1, 80, 64, 47, 19, 111, 7, 127, 7, -113, 7, +3, 7, 1, 19, 56, 20, 60, 14, 13, 12, 60, 15, 15, 14, 64, 23, 26, 52, 14, 117, 1, 7, 56, 8, 60, +2, 1, 0, 60, 3, 3, -113, 2, 1, 2, 25, 24, 113, -89, 24, 43, 78, 16, -12, 93, 60, 77, 16, -3, 60, +16, -3, -28, 16, -10, 43, 60, 16, -3, 60, 16, -3, -28, 0, 63, 93, 60, -3, 60, -19, 16, -19, 16, 60, 16, +60, 16, -19, 16, -19, 1, 17, 18, 57, 17, 18, 57, 0, 16, -55, 16, -55, 49, 48, 0, 114, 113, 113, 113, 1, +113, 113, 113, 113, 113, 113, 113, 113, 1, 93, 1, 21, 35, 53, 52, 55, 54, 55, 23, 6, 6, 7, 33, 21, 35, +53, 52, 55, 54, 55, 23, 6, 6, 7, 1, 20, -63, 32, 42, 91, 44, 55, 52, 3, 1, -108, -63, 32, 42, 91, +44, 55, 52, 3, 4, -60, -47, -91, -122, 60, 80, 41, 70, 23, 91, 87, -47, -91, -122, 60, 80, 41, 70, 23, 91, +87, 0, 2, 0, 71, 3, -23, 2, 78, 5, -55, 0, 11, 0, 23, 0, -37, 64, 78, -97, 25, -81, 25, 2, -16, +8, -16, 20, 2, 1, 8, 1, 20, 2, -32, 7, -32, 19, 2, -48, 7, -48, 19, 2, -64, 7, -64, 19, 2, -80, +7, -80, 19, 2, -94, 7, -94, 19, 2, -110, 7, -110, 19, 2, -126, 7, -126, 19, 2, 112, 7, 112, 19, 2, 101, +8, 101, 20, 2, 83, 8, 83, 20, 2, 20, 19, 8, 7, 23, 15, 12, 11, 3, 0, 20, -85, 19, -72, 1, 80, +64, 12, 13, 15, -7, 14, 14, 12, 60, 13, 1, 8, -85, 7, -72, 1, 80, 64, 48, 1, 3, -7, 2, 2, 0, +60, 1, 1, 14, 15, 60, 12, 19, 56, 20, 39, 13, 23, 62, 12, 12, 13, 64, 23, 26, 52, 13, 117, 2, 2, +3, 60, 0, 7, 56, 8, 39, 0, 32, 1, 1, 1, 106, 24, 113, -89, 24, 43, 16, -10, 93, 60, -12, -28, 16, +-3, 60, 16, -10, 43, 60, 16, -28, 16, -12, -28, 16, -3, 60, 0, 63, -19, 60, 16, -19, 16, -3, -19, 63, -19, +60, 16, -19, 16, -3, -19, 1, 17, 18, 57, 17, 18, 57, 0, 16, -55, 16, -55, 49, 48, 1, 113, 113, 113, 113, +113, 113, 113, 113, 113, 113, 0, 114, 113, 1, 93, 19, 53, 51, 21, 20, 7, 6, 7, 39, 54, 54, 55, 51, 53, +51, 21, 20, 7, 6, 7, 39, 54, 54, 55, 87, -63, 31, 43, 91, 44, 54, 53, 3, -40, -63, 31, 43, 91, 44, +54, 53, 3, 4, -8, -47, -91, -122, 59, 81, 41, 71, 22, 95, 83, -47, -91, -122, 59, 81, 41, 71, 22, 95, 83, +0, 0, 1, 0, -128, 3, -13, 1, 81, 5, -45, 0, 11, 0, 126, 64, 54, 123, 8, -116, 8, 2, 13, 8, 1, +-3, 7, 1, -34, 7, -17, 7, 2, -67, 7, -49, 7, 2, -101, 7, -82, 7, 2, 90, 7, 108, 7, 2, 8, 7, +11, 0, 3, -7, 2, 2, 1, 11, 0, 60, 1, 8, 56, 111, 1, 127, 1, -113, 1, 3, 1, -72, 1, 80, 64, +21, 7, 0, 1, 0, 7, 56, 8, 39, 0, 60, 3, 3, 32, 2, 1, 2, 25, 12, -99, 121, 24, 43, 78, 16, +-12, 93, 60, 77, 16, -3, -12, -28, 16, 60, 0, 63, -19, 93, 1, -28, 0, 16, -3, 60, 16, 60, 16, -19, 1, +17, 57, 0, 16, -55, 49, 48, 1, 113, 113, 113, 113, 113, 0, 114, 113, 1, 21, 35, 53, 52, 55, 54, 55, 23, +6, 6, 7, 1, 65, -63, 32, 42, 91, 44, 55, 52, 3, 4, -60, -47, -91, -122, 60, 80, 41, 70, 23, 91, 87, +0, 1, 0, 108, 3, -23, 1, 61, 5, -55, 0, 11, 0, 116, 64, 38, -45, 7, -29, 7, 2, -79, 7, -61, 7, +2, -14, 8, 1, -109, 8, -95, 8, 2, 115, 8, -126, 8, 2, 85, 8, 101, 8, 2, 2, 8, 1, 8, 11, 3, +0, 8, -85, 7, -72, 1, 80, 64, 30, 1, 3, -7, 2, 2, 1, 11, 0, 60, 1, 0, 2, 3, 60, 0, 7, +56, 8, 39, 0, 0, 32, 1, 1, 1, 25, 12, -99, 121, 24, 43, 78, 16, -12, 93, 60, 77, 16, -12, -28, 16, +-3, 60, 0, 63, -3, 60, 16, 60, 16, -19, 16, -3, -19, 1, 17, 18, 57, 0, -55, 49, 48, 0, 114, 113, 113, +113, 113, 1, 113, 113, 19, 53, 51, 21, 20, 7, 6, 7, 39, 54, 54, 55, 124, -63, 31, 43, 91, 44, 54, 53, +3, 4, -8, -47, -91, -122, 59, 81, 41, 71, 22, 95, 83, 0, 0, 3, 0, 78, 1, 63, 4, 22, 4, 103, 0, +3, 0, 7, 0, 11, 0, 108, -75, 8, 60, 0, 9, 1, 9, -72, 2, -87, 64, 9, 64, 5, 1, 5, -7, 0, +6, 1, 6, -72, 2, -87, 64, 51, 0, 60, -80, 1, 1, 48, 1, -112, 1, 2, -64, 1, -32, 1, 2, 80, 1, +112, 1, 2, 1, 7, 110, 2, 60, 0, 110, 6, 4, 110, 11, 60, 9, 6, 9, 110, 64, 5, 80, 5, -112, 5, +-96, 5, 4, 5, 113, 12, 113, -116, 24, 43, 78, 16, -12, 93, 77, -28, 60, 16, -3, -28, 16, -12, -3, -28, 0, +47, 93, 93, 113, 113, -3, -10, 113, -3, 113, -10, 113, -19, 49, 48, 1, 53, 51, 21, 1, 33, 53, 33, 1, 53, +51, 21, 1, -53, -51, 1, 126, -4, 56, 3, -56, -3, -75, -51, 3, -102, -51, -51, -2, -27, -88, -2, 24, -51, -51, +0, 0, 2, 0, 47, 0, 0, 3, -57, 5, -114, 0, 5, 0, 9, 0, -105, 64, 93, 9, 6, 9, 8, 6, -123, +0, 1, 20, 0, 6, 7, 0, 1, 6, 7, 6, 9, 7, -123, 4, 5, 20, 4, 7, 8, 4, 5, 9, 8, 9, +6, 8, -123, 2, 1, 20, 2, 8, 7, 2, 1, 8, 7, 8, 9, 7, -123, 4, 3, 20, 4, 7, 6, 4, 3, +5, 0, 3, 2, 7, 9, 6, 8, 8, 1, 4, 8, 6, 4, 7, 9, 1, 6, 3, 0, 5, 0, 2, 3, 8, +15, 1, 1, 1, 105, 11, 4, 105, 10, -98, 121, 24, 43, 16, -26, 16, -26, 93, 0, 63, 60, 63, 60, 18, 23, +57, 1, 17, 18, 23, 57, -121, 8, 46, 43, 8, 125, 16, -60, -121, 8, 46, 24, 43, 8, 125, 16, -60, -121, 8, +46, 24, 43, 8, 125, 16, -60, -121, 8, 46, 24, 43, 8, 125, 16, -60, 49, 48, 9, 2, 35, 1, 1, 23, 9, +2, 2, 37, 1, -94, -2, 94, 111, -2, 121, 1, -121, 57, -2, -84, 1, 84, 1, 103, 5, -114, -3, 55, -3, 59, +2, -59, 2, -55, 97, -3, -104, -3, -103, 2, 103, -1, -1, 0, 33, -2, 81, 3, -18, 5, -61, 2, 38, 0, 92, +0, 0, 1, 7, 0, -114, 0, -74, 0, 0, 0, 58, -75, 2, 1, 1, 2, 2, 34, -71, 2, 34, 0, 41, 0, +43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 27, 34, 11, 19, 65, 43, 27, -71, 0, 31, -1, -64, 64, 15, 43, +48, 52, 15, 31, 31, 31, -16, 31, 3, 31, 15, 98, 72, 43, 43, 113, 43, 89, 53, 53, -1, -1, 0, 6, 0, +0, 5, 70, 6, -31, 2, 38, 0, 60, 0, 0, 1, 7, 0, -114, 1, 80, 1, 30, 0, 27, 64, 11, 2, 1, +17, 11, 0, 72, 43, 1, 2, 2, 20, -70, 2, 33, 0, 41, 1, 100, -123, 0, 43, 1, 43, 53, 53, 0, 0, +1, -2, 57, -1, -57, 3, 35, 5, -45, 0, 3, 0, 57, 64, 12, 1, 0, 0, 63, 3, 2, 20, 3, 3, 2, +0, 3, -72, 1, 125, 64, 10, 2, 1, 0, 2, 26, 5, 1, 25, 4, -50, -71, 1, -84, 0, 24, 43, 25, 78, +16, -28, 16, -26, 0, 24, 63, 60, 77, -19, 57, -121, 5, 46, 43, 125, 16, -60, 49, 48, 5, 1, 51, 1, -2, +57, 4, 77, -99, -5, -77, 57, 6, 12, -7, -12, 0, 0, 1, -1, -28, -1, -25, 4, 83, 5, -45, 0, 47, 0, +-66, -77, 102, 2, 1, 18, -72, -1, -32, -77, 13, 17, 52, 4, -72, -1, -32, -77, 9, 17, 52, 17, -72, -1, -32, +-77, 9, 17, 52, 45, -72, -1, -52, 64, 22, 14, 28, 52, 45, 43, 46, 46, 0, 38, 23, 32, 14, 28, 52, 23, +25, 22, 22, 30, 20, 7, 38, -72, 2, 83, -76, 8, -113, 37, 1, 37, -72, 2, 83, -78, 31, 15, 30, -72, 2, +83, 64, 46, 14, 31, 31, 20, 0, 30, 43, 3, 20, 30, 25, 9, 13, 16, 9, 6, 4, 14, 29, 32, 36, 39, +4, 11, 38, 31, 34, 30, 15, 14, 14, 11, 8, 7, 7, 11, 45, 46, 46, 23, 49, 37, 30, 11, 38, 34, 47, +-19, -44, 60, 16, -42, 60, 17, 51, 17, 57, 47, 51, 18, 57, 47, 51, 17, 18, 57, 57, 17, 23, 57, 18, 23, +57, 0, 63, -19, 63, -19, 17, 57, 47, 60, -3, 60, 16, -10, 93, 60, -3, 60, 17, 18, 57, 47, 18, 57, 43, +0, 17, 18, 57, 24, 47, 18, 57, 43, 49, 48, 1, 43, 43, 43, 93, 1, 34, 7, 6, 7, 6, 7, 33, 7, +33, 6, 21, 20, 23, 33, 7, 33, 22, 23, 22, 51, 50, 55, 21, 6, 35, 32, 3, 38, 39, 35, 55, 51, 38, +53, 52, 55, 35, 55, 51, 18, 37, 54, 51, 50, 23, 7, 38, 3, 22, -88, 114, 68, 55, 56, 10, 2, -86, 27, +-3, 97, 1, 1, 2, -124, 28, -3, -83, 42, -96, 115, -122, -69, 105, 125, -105, -2, 60, -97, 32, 23, -103, 28, 105, +3, 1, -125, 28, 116, 62, 1, 5, -95, -62, -70, 127, 40, 122, 5, 45, 81, 48, 88, 91, 82, -122, 21, 19, 77, +15, -122, -27, 96, 69, 98, -50, 58, 1, 120, 76, 108, -122, 42, 49, 20, 21, -122, 1, 70, -114, 88, 81, -70, 101, +0, 1, 0, 92, 0, 72, 2, 44, 3, -40, 0, 5, 0, 76, -71, 0, 0, -1, -18, -78, 22, 57, 0, -72, -1, +-18, 64, 10, 23, 57, 7, 0, 23, 0, -89, 0, 3, 4, -72, 1, -53, 64, 22, 2, 1, -7, 2, 117, 0, 5, +-43, 4, 117, 0, 60, 32, 3, 48, 3, -112, 3, 3, 3, 106, 6, -72, 1, 75, -79, 90, 24, 43, 16, -10, 93, +-3, -10, -19, 16, -10, -19, 0, 47, -19, 49, 48, 1, 93, 43, 43, 1, 1, 35, 1, 1, 51, 1, 35, 1, 9, +-107, -2, -59, 1, 59, -107, 2, 15, -2, 57, 1, -57, 1, -55, 0, 1, 0, 92, 0, 72, 2, 33, 3, -40, 0, +5, 0, 52, -75, 7, 3, 23, 3, 2, 2, -72, 1, -53, 64, 23, 4, 5, -7, 4, 1, -7, 2, 117, 4, 117, +0, 60, 63, 3, -97, 3, 2, 3, 106, 7, 113, -78, 24, 43, 16, -10, 93, -3, -26, -10, -19, 16, -19, 0, 47, +-19, 49, 48, 1, 93, 1, 1, 51, 1, 1, 35, 1, 101, -2, -9, -107, 1, 48, -2, -48, -107, 2, 18, 1, -58, +-2, 64, -2, 48, 0, 3, 0, 23, 0, 0, 3, 117, 5, -45, 0, 21, 0, 25, 0, 29, 1, 28, 64, 45, 22, +8, 11, 13, 25, 10, 8, 25, 126, 24, 0, 13, 28, 8, 1, 19, 2, 43, 3, 28, 18, 18, 17, 17, 4, 4, +3, 6, 26, 21, 10, 23, 22, 22, 27, 27, 26, 64, 29, 24, 25, 25, 28, 28, 29, -72, -1, -16, 64, 11, 15, +16, 2, 85, 29, 16, 13, 13, 2, 85, 29, -72, -1, -24, 64, 11, 12, 12, 2, 85, 29, 12, 16, 16, 6, 85, +29, -72, -1, -22, 64, 41, 11, 12, 6, 85, -97, 29, -65, 29, -1, 29, 3, 29, 26, 31, -112, 10, -80, 10, 2, +10, 40, 18, 18, 19, -69, 17, 20, 20, 21, 64, 0, 5, 4, 4, 1, 1, 0, -110, 2, 2, 3, -72, -1, -28, +-76, 14, 16, 2, 85, 3, -72, -1, -20, -76, 13, 13, 2, 85, 3, -72, -1, -14, -76, 12, 12, 2, 85, 3, -72, +-1, -6, -76, 11, 11, 2, 85, 3, -72, -1, -20, -76, 13, 13, 6, 85, 3, -72, -1, -14, 64, 10, 11, 12, 6, +85, 3, 25, 30, 124, 80, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 60, 77, 16, -12, 60, 16, 60, 16, +60, 16, -3, 60, 16, 60, -12, 60, 16, -28, 93, 78, 16, -10, 113, 43, 43, 43, 43, 43, 60, 16, 60, 16, 60, +77, 16, -3, 60, 16, 60, 16, 60, 0, 63, 60, 63, 60, 16, 60, 16, 60, 16, 60, 16, -3, 60, 63, -19, 63, +-19, 18, 57, 17, 18, 57, 49, 48, 67, 121, 64, 14, 14, 15, 6, 7, 14, 7, 16, 27, 0, 15, 6, 13, 27, +1, 43, 1, 43, -127, -127, 51, 17, 35, 53, 51, 53, 52, 54, 51, 50, 23, 7, 38, 35, 34, 6, 21, 21, 51, +21, 35, 17, 1, 53, 51, 21, 3, 17, 51, 17, -73, -96, -96, -120, -109, 99, 84, 28, 53, 44, 93, 68, -50, -50, +1, 86, -76, -76, -76, 3, -101, -117, 103, -98, -88, 23, -104, 9, 74, 120, 69, -117, -4, 101, 4, -21, -49, -49, -5, +21, 4, 38, -5, -38, 0, 2, 0, 23, 0, 0, 3, 115, 5, -45, 0, 21, 0, 25, 1, 29, 64, 42, 22, 8, +11, 13, 3, 10, 8, 24, 24, 23, 0, 19, 20, 20, 1, 1, 2, 43, 3, 18, 17, 17, 4, 4, 3, 6, 13, +28, 8, 1, 25, 22, 22, 0, 21, 10, 23, 22, 64, 25, 25, 24, -72, -1, -12, 64, 11, 15, 16, 2, 85, 24, +14, 13, 13, 2, 85, 24, -72, -1, -24, 64, 11, 12, 12, 2, 85, 24, 12, 16, 16, 6, 85, 24, -72, -1, -22, +64, 44, 11, 12, 6, 85, -97, 24, -65, 24, -1, 24, 3, 24, 26, 27, -112, 10, -80, 10, 2, 10, 40, 18, 18, +19, -69, 20, 16, 17, 17, 20, 20, 21, 64, 0, 5, 4, 4, 1, 1, 0, -110, 2, 2, 3, -72, -1, -28, -76, +14, 16, 2, 85, 3, -72, -1, -20, -76, 13, 13, 2, 85, 3, -72, -1, -14, -76, 12, 12, 2, 85, 3, -72, -1, +-6, -76, 11, 11, 2, 85, 3, -72, -1, -20, -76, 13, 13, 6, 85, 3, -72, -1, -14, 64, 10, 11, 12, 6, 85, +3, 25, 26, 124, 80, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 60, 77, 16, -12, 60, 16, 60, 16, 60, +16, -3, 60, 16, 60, 16, 60, 16, -12, 60, 16, -28, 93, 78, 16, -10, 113, 43, 43, 43, 43, 43, 60, 77, 16, +-3, 60, 0, 63, 60, 60, 16, 60, 63, -19, 63, 60, 16, 60, 16, 60, 16, -3, 60, 16, 60, 16, 60, 63, 60, +17, 18, 57, 17, 18, 57, 49, 48, 67, 121, 64, 14, 14, 15, 6, 7, 14, 7, 16, 27, 0, 15, 6, 13, 27, +1, 43, 1, 43, -127, -127, 51, 17, 35, 53, 51, 53, 52, 54, 51, 50, 23, 7, 38, 35, 34, 6, 21, 21, 51, +21, 35, 17, 33, 17, 51, 17, -73, -96, -96, -120, -109, 99, 84, 28, 53, 44, 93, 68, -50, -50, 1, 84, -76, 3, +-101, -117, 103, -98, -88, 23, -104, 9, 74, 120, 69, -117, -4, 101, 5, -70, -6, 70, 0, 0, 1, 0, 73, -2, -90, +4, 34, 5, -90, 0, 19, 0, -104, 64, 81, 13, 14, 14, 5, 5, 6, 32, 7, 7, 12, 11, 11, 8, -120, 10, +9, 0, 16, 15, 15, 4, 4, 3, 32, 1, 2, 2, 17, 18, 18, 1, -120, 19, 0, 12, 13, 13, 16, 17, 110, +19, 10, 11, 11, 14, 14, 15, 15, 18, 18, 19, 32, 0, 9, 8, 8, 5, 5, 4, 4, 1, 1, 0, 110, 2, +7, 6, 6, 2, 2, 64, 3, -112, 3, 2, 3, 62, 20, 112, -116, 24, 43, 16, -12, 93, 60, 16, 60, 16, 60, +16, -12, 60, 16, 60, 16, 60, 16, 60, 16, 60, 16, -3, 60, 16, 60, 16, 60, 16, 60, 16, 60, 16, -12, 60, +60, 16, 60, 0, 47, 60, -12, 60, 16, 60, 60, 16, 60, -3, 60, 16, 60, 16, 60, 63, 60, -12, 60, 16, 60, +60, 16, -3, 60, 16, 60, 16, 60, 49, 48, 1, 17, 33, 53, 33, 17, 33, 53, 33, 17, 51, 17, 33, 21, 33, +17, 33, 21, 33, 17, 1, -37, -2, 110, 1, -110, -2, 110, 1, -110, -76, 1, -109, -2, 109, 1, -109, -2, 109, -2, +-90, 1, 114, -95, 2, -43, -95, 1, 119, -2, -119, -95, -3, 43, -95, -2, -114, 0, 0, 1, 0, -71, 2, 107, 1, +-122, 3, 56, 0, 3, 0, 26, 64, 14, 1, 60, 0, 2, 60, 32, 0, 1, 0, -96, 4, -95, -104, 24, 43, 16, +-12, 93, -3, 0, 47, -19, 49, 48, 19, 53, 51, 21, -71, -51, 2, 107, -51, -51, 0, 1, 0, 108, -2, -15, 1, +61, 0, -47, 0, 11, 0, 110, 64, 40, -13, 8, 1, -111, 8, -96, 8, 2, 114, 8, -124, 8, 2, 3, 8, 1, +-46, 7, 1, -76, 7, -61, 7, 2, 84, 7, 100, 7, 2, 8, 11, 3, 0, 8, -85, 7, 3, -7, 2, 7, -72, +1, 80, 64, 24, 2, 1, 11, 1, 60, 0, 8, 3, -127, 0, 7, 56, 8, 39, 1, 32, 0, 1, 0, 25, 12, +-99, 121, 24, 43, 78, 16, -12, 93, 60, 77, -12, -28, 16, -19, 0, 63, -19, 60, 16, 60, -19, 16, -19, 16, -19, +1, 17, 18, 57, 0, -55, 49, 48, 1, 113, 113, 113, 0, 114, 113, 113, 113, 51, 53, 51, 21, 20, 7, 6, 7, +39, 54, 54, 55, 124, -63, 31, 43, 91, 44, 54, 53, 3, -47, -91, -122, 59, 81, 41, 71, 22, 95, 83, 0, 0, +2, 0, 71, -2, -15, 2, 78, 0, -47, 0, 11, 0, 23, 0, -42, 64, 78, -97, 25, -81, 25, 2, 0, 8, 0, +20, 2, -30, 7, -30, 19, 2, -48, 7, -48, 19, 2, -64, 7, -64, 19, 2, -80, 7, -80, 19, 2, -96, 7, -96, +19, 2, -111, 7, -111, 19, 2, -126, 7, -126, 19, 2, 115, 7, 115, 19, 2, -16, 8, -16, 20, 2, 100, 8, 100, +20, 2, 84, 8, 84, 20, 2, 20, 19, 8, 7, 23, 15, 12, 11, 3, 0, 20, -85, 19, -72, 1, 80, 64, 11, +13, 15, -7, 14, 14, 13, 60, 12, 8, 7, 7, -72, 1, 80, 64, 44, 1, 3, -7, 2, 2, 1, 60, 0, 8, +14, 15, 60, 12, 19, 56, 20, 39, 13, 12, 64, 23, 26, 52, 12, 117, 2, 2, 3, 60, 0, 7, 56, 8, 39, +1, -113, 0, 1, 0, 25, 24, 113, -89, 24, 43, 78, 16, -12, 93, 60, 77, -12, -28, 16, -3, 60, 16, -10, 43, +60, -12, -28, 16, -3, 60, 0, 63, -3, 60, 16, -19, 16, -3, 60, 63, -3, 60, 16, -19, 16, -3, -19, 1, 17, +18, 57, 17, 18, 57, 0, 16, -55, 16, -55, 49, 48, 0, 113, 113, 113, 1, 113, 113, 113, 113, 113, 113, 113, 113, +0, 114, 1, 93, 51, 53, 51, 21, 20, 7, 6, 7, 39, 54, 54, 55, 51, 53, 51, 21, 20, 7, 6, 7, 39, +54, 54, 55, 87, -63, 31, 43, 91, 44, 54, 53, 3, -40, -63, 31, 43, 91, 44, 54, 53, 3, -47, -91, -122, 59, +81, 41, 71, 22, 95, 83, -47, -91, -122, 59, 81, 41, 71, 22, 95, 83, 0, 7, 0, 37, -1, -54, 7, -37, 5, +-45, 0, 3, 0, 15, 0, 30, 0, 42, 0, 57, 0, 69, 0, 84, 1, 126, 64, 11, -104, 1, -105, 3, 2, -77, +8, 1, 2, 3, 3, -72, 2, -102, 64, 15, 0, 1, 20, 0, 0, 1, 2, 1, 50, 43, 3, 0, 23, 16, 19, +-68, 2, -97, 0, 13, 1, 31, 0, 27, 2, -97, 64, 11, 7, 2, 1, 58, 7, 1, 3, 0, 0, 40, 81, -72, +2, -97, -78, 61, 61, 54, -67, 2, -97, 0, 34, 1, 31, 0, 40, 0, 73, 2, -97, -78, 67, 67, 46, -72, 2, +-97, -76, 40, 11, 86, 105, 77, -68, 2, -102, 0, 64, 1, -74, 0, 70, 2, -102, -78, 58, 106, 50, -68, 2, -102, +0, 37, 1, -74, 0, 43, 2, -102, -78, 31, 108, 23, -68, 2, -102, 0, 10, 1, -74, 0, 16, 2, -102, -77, 4, +105, 85, 86, -72, 1, -19, -77, 33, -101, 104, 24, 43, 43, -10, -19, -3, -19, -10, -19, -3, -19, -10, -19, -3, -19, +-26, 0, 63, -19, 60, 16, -19, 16, -3, -19, 60, 16, -19, 16, 60, 16, 60, 63, -12, 60, 16, -19, -3, -19, 1, +17, 18, 57, 57, 17, 18, 57, 57, -121, 46, 43, -121, 125, -60, 49, 48, 24, 67, 121, 64, -116, 5, 84, 83, 37, +79, 38, 75, 37, 56, 37, 52, 38, 48, 37, 29, 37, 25, 38, 21, 37, 82, 60, 70, 31, 0, 80, 62, 77, 31, +1, 72, 68, 70, 31, 0, 74, 66, 77, 31, 1, 55, 33, 43, 31, 0, 53, 35, 50, 31, 1, 45, 41, 43, 31, +0, 47, 39, 50, 31, 1, 28, 6, 16, 31, 0, 26, 8, 23, 31, 1, 18, 14, 16, 31, 0, 20, 12, 23, 31, +1, 84, 59, 81, 31, 1, 78, 63, 81, 31, 1, 71, 69, 73, 31, 0, 76, 65, 73, 31, 0, 57, 32, 54, 31, +1, 51, 36, 54, 31, 1, 44, 42, 46, 31, 0, 49, 38, 46, 31, 0, 30, 5, 27, 31, 1, 24, 9, 27, 31, +1, 17, 15, 19, 31, 0, 22, 11, 19, 31, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -127, 1, 93, 5, +1, 51, 1, 1, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, 55, 54, 53, 52, 39, +38, 35, 34, 7, 6, 1, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, 55, 54, 53, +52, 39, 38, 35, 34, 7, 6, 5, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, 55, +54, 53, 52, 39, 38, 35, 34, 7, 6, 1, 64, 2, 89, -125, -3, -88, -2, 97, -99, -127, -128, -96, -116, -110, -128, +-96, -108, 79, 65, 59, 32, 43, 44, 34, 60, 62, 33, 45, 2, 66, -99, -128, -128, -95, -116, -110, -128, -96, -108, 79, +65, 59, 32, 43, 45, 34, 59, 62, 33, 45, 2, 14, -99, -127, -128, -96, -117, -109, -128, -96, -108, 79, 65, 59, 32, +43, 44, 34, 60, 62, 33, 45, 54, 6, 9, -7, -9, 4, -127, -57, -75, -74, -62, -60, -57, -70, -59, -104, 106, 45, +60, -101, -104, 63, 47, 46, 63, -4, 114, -57, -75, -74, -62, -60, -58, -71, -59, -105, 107, 45, 61, -102, -103, 62, 47, +46, 62, -108, -57, -75, -74, -62, -60, -58, -71, -59, -105, 107, 45, 61, -102, -103, 62, 47, 46, 62, -1, -1, -1, -3, +0, 0, 5, 89, 7, 44, 2, 38, 0, 36, 0, 0, 1, 7, 0, -42, 1, 64, 1, 106, 0, 31, 64, 15, 2, +111, 17, -97, 17, 2, 0, 17, 20, 1, 2, 65, 2, 1, 21, -70, 2, 33, 0, 41, 1, 100, -123, 0, 43, 1, +43, 114, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 7, 44, 2, 38, 0, 40, 0, 0, 1, 7, 0, -42, 1, +107, 1, 106, 0, 42, 64, 18, 1, 12, 64, 30, 32, 52, 0, 12, -81, 12, 2, 47, 12, 95, 12, 2, 12, 2, +-72, -3, -1, -76, 72, 43, 1, 1, 18, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 43, 53, -1, -1, -1, +-3, 0, 0, 5, 89, 7, 44, 2, 38, 0, 36, 0, 0, 1, 7, 0, -115, 1, 63, 1, 106, 0, 33, -79, 2, +18, -72, -1, -64, 64, 11, 18, 25, 52, 18, 12, 0, 72, 43, 2, 1, 15, -70, 2, 33, 0, 41, 1, 100, -123, +0, 43, 1, 43, 43, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 6, -31, 2, 38, 0, 40, 0, 0, 1, 7, +0, -114, 1, 108, 1, 30, 0, 71, -78, 2, 1, 14, -72, -1, -64, 64, 10, 11, 12, 6, 85, 14, 64, 24, 28, +52, 14, -72, -1, -64, 64, 20, 29, 32, 52, 14, 64, 15, 17, 52, -96, 14, -17, 14, 2, -96, 14, -80, 14, 2, +14, 4, -72, 1, 14, -75, 72, 43, 1, 2, 2, 19, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 43, 43, +43, 43, 53, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 7, 44, 2, 38, 0, 40, 0, 0, 1, 7, 0, 67, +1, -127, 1, 106, 0, 40, 64, 16, 1, -97, 13, -81, 13, 2, 111, 13, 127, 13, 2, 64, 13, 1, 13, 2, -72, +-3, -5, -76, 72, 43, 1, 1, 13, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 113, 53, -1, -1, 0, -115, +0, 0, 1, -2, 7, 44, 2, 38, 0, 44, 0, 0, 1, 7, 0, -115, -1, -81, 1, 106, 0, 43, -79, 1, 7, +-72, -1, -64, -77, 23, 25, 52, 7, -72, -1, -64, 64, 14, 34, 37, 52, 47, 7, 1, 7, 1, 90, 72, 43, 1, +1, 7, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 43, 43, 53, 0, -1, -1, -1, -32, 0, 0, 2, 89, 7, +44, 2, 38, 0, 44, 0, 0, 1, 7, 0, -42, -1, -57, 1, 106, 0, 50, -77, 1, 1, 1, 10, -71, 2, 33, +0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 6, 9, 1, 2, 65, 43, 27, 64, 15, 4, 64, 51, +52, 52, 4, 64, 29, 31, 52, 4, 1, 97, 72, 43, 43, 43, 43, 89, 53, -1, -1, 0, 4, 0, 0, 2, 53, +6, -31, 2, 38, 0, 44, 0, 0, 1, 7, 0, -114, -1, -57, 1, 30, 0, 24, 64, 11, 2, 1, 8, 2, 0, +72, 43, 1, 2, 2, 11, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, 53, -1, -1, 0, 54, 0, 0, 1, -82, +7, 44, 2, 38, 0, 44, 0, 0, 1, 7, 0, 67, -1, -35, 1, 106, 0, 57, -77, 1, 1, 1, 5, -71, 2, +33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 45, 4, 4, 2, 2, 65, 43, 27, 64, 15, 5, 64, +23, 25, 52, 5, 64, 34, 37, 52, 32, 5, 1, 5, 2, -72, -1, -90, -79, 72, 43, 43, 93, 43, 43, 89, 53, +0, -1, -1, 0, 99, -1, -25, 5, -35, 7, 44, 2, 38, 0, 50, 0, 0, 1, 7, 0, -115, 1, -57, 1, 106, +0, 36, -79, 2, 31, -72, -1, -64, 64, 16, 22, 25, 52, 112, 31, -33, 31, 2, 31, 3, 0, 72, 43, 2, 1, +31, -71, 2, 33, 0, 41, 0, 43, 1, 43, 113, 43, 53, -1, -1, 0, 99, -1, -25, 5, -35, 7, 44, 2, 38, +0, 50, 0, 0, 1, 7, 0, -42, 1, -58, 1, 106, 0, 22, 64, 10, 2, 0, 30, 33, 3, 3, 65, 2, 1, +34, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 99, -1, -25, 5, -35, 7, 44, 2, 38, 0, 50, +0, 0, 1, 7, 0, 67, 1, -61, 1, 106, 0, 36, -79, 2, 29, -72, -1, -64, 64, 16, 11, 12, 52, 80, 29, +-17, 29, 2, 29, 3, 0, 72, 43, 2, 1, 29, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 43, 53, -1, -1, +0, -95, -1, -25, 5, 34, 7, 44, 2, 38, 0, 56, 0, 0, 1, 7, 0, -115, 1, -120, 1, 106, 0, 43, 64, +27, 1, 24, 64, 12, 14, 52, 79, 24, 1, 31, 24, 47, 24, 2, 127, 24, -113, 24, 2, 24, 17, 0, 72, 43, +1, 1, 24, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 113, 43, 53, 0, -1, -1, 0, -95, -1, -25, 5, +34, 7, 44, 2, 38, 0, 56, 0, 0, 1, 7, 0, -42, 1, -120, 1, 106, 0, 39, -78, 1, 1, 27, -71, 2, +33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -74, 1, 0, 23, 26, 11, 1, 65, 43, 53, 27, -74, 1, +1, 21, 17, 20, 72, 39, 43, 89, 0, -1, -1, 0, -95, -1, -25, 5, 34, 7, 44, 2, 38, 0, 56, 0, 0, +1, 7, 0, 67, 1, -123, 1, 106, 0, 35, 64, 20, 1, 22, 64, 23, 25, 52, 127, 22, 1, -97, 22, 1, 22, +17, 0, 72, 43, 1, 1, 22, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 43, 53, 0, 0, 1, 0, -58, +0, 0, 1, 122, 4, 38, 0, 3, 0, 106, -75, 2, 1, 6, 0, 10, 5, -72, -1, -28, 64, 16, 15, 15, 2, +85, 5, -93, 2, 3, 37, 1, 0, 0, 32, 0, 2, 0, -72, -1, -28, -76, 16, 16, 2, 85, 0, -72, -1, -20, +-76, 13, 15, 2, 85, 0, -72, -1, -16, -76, 12, 12, 2, 85, 0, -72, -1, -6, -76, 11, 11, 2, 85, 0, -72, +-1, -4, 64, 16, 12, 12, 6, 85, 0, 29, 11, 11, 6, 85, 0, -93, 4, -22, -46, 24, 43, 16, -10, 43, 43, +43, 43, 43, 43, 93, 60, -3, 60, -26, 43, 0, 63, 63, 60, 49, 48, 51, 17, 51, 17, -58, -76, 4, 38, -5, +-38, 0, 1, 0, 25, 4, -86, 2, -110, 5, -62, 0, 6, 0, 73, 64, 20, 5, 6, 1, 0, 2, 16, 2, 2, +2, -121, 0, 100, 4, 3, 0, 5, 60, 6, 61, 4, -72, -1, -64, 64, 17, 9, 12, 52, 4, 100, 0, 100, 3, +127, 1, 60, 2, 25, 7, -87, 104, 24, 43, 25, 78, 16, -12, 24, 77, -3, 25, -10, 24, -3, -3, 43, 25, -10, +24, -19, 0, 63, 60, -19, -3, 93, 60, 60, 60, 49, 48, 1, 7, 35, 19, 51, 19, 35, 1, 88, 113, -50, -40, +-64, -31, -52, 5, 84, -86, 1, 24, -2, -24, 0, 0, 1, 0, 6, 4, -61, 2, -92, 5, -86, 0, 23, 0, -105, +64, 17, -121, 14, 1, 64, 8, 18, 16, 7, 5, 4, 11, 23, 0, 58, 15, 63, 8, -72, 2, -72, -78, 19, 63, +4, -72, 2, -76, 64, 25, 12, 0, 25, 23, 23, 26, 12, 118, 11, -127, 16, 77, 17, -99, 23, 118, 0, 127, 24, +25, -32, 33, -77, 122, 24, 43, 43, -10, -3, -10, -28, -12, -3, 78, 69, 101, 68, -26, 0, 63, 77, -26, -20, -4, +-3, -28, 1, 17, 18, 23, 57, 49, 48, 67, 121, 64, 44, 20, 22, 9, 14, 1, 3, 21, 37, 2, 38, 20, 3, +22, 50, 0, 21, 22, 2, 1, 20, 3, 23, 50, 0, 9, 14, 11, 50, 1, 21, 2, 19, 50, 1, 22, 1, 19, +50, 1, 10, 13, 8, 50, 0, 0, 43, 43, 43, 1, 43, 43, 16, 60, 16, 60, 43, 43, 43, -127, -127, -127, 1, +93, 19, 38, 55, 54, 51, 50, 23, 22, 51, 50, 54, 55, 51, 6, 6, 35, 34, 39, 38, 35, 34, 7, 6, 23, +7, 1, 58, 57, 89, 62, 107, 59, 35, 32, 34, 7, -126, 3, 109, 84, 63, 103, 67, 31, 34, 21, 22, 1, 4, +-61, 104, 62, 62, 54, 30, 35, 52, 114, 114, 56, 36, 24, 24, 47, 0, 0, 1, 0, 29, 4, -53, 2, -115, 5, +95, 0, 3, 0, 35, -71, 0, 1, -1, -64, 64, 15, 18, 20, 52, 1, 53, 0, 2, 26, 5, 0, 25, 4, -87, +104, 24, 43, 78, 16, -28, 16, -26, 0, 47, 77, -19, 43, 49, 48, 19, 53, 33, 21, 29, 2, 112, 4, -53, -108, +-108, 0, 1, 0, 46, 4, -75, 2, 125, 5, -72, 0, 13, 0, 75, -77, 85, 2, 1, 11, -72, 2, -97, 64, 12, +16, 4, 127, 4, 2, 4, 7, 8, 8, 0, 0, 8, -69, 2, -97, 0, 7, 0, 0, 2, -97, 64, 15, 64, 1, +-67, 4, -20, 32, 7, 25, 14, 16, 4, 1, -101, 65, 24, 43, 93, 78, 16, -12, 26, 25, 77, -3, -3, 26, 24, +-19, 16, -19, 0, 63, 60, 16, 60, 47, 93, -19, 49, 48, 1, 93, 1, 51, 6, 6, 35, 34, 38, 39, 51, 22, +22, 51, 50, 54, 2, 2, 123, 15, -103, 127, -128, -103, 15, 123, 14, 83, 70, 81, 83, 5, -72, 125, -122, -123, 126, +68, 67, 65, 0, 0, 1, 0, -27, 4, -86, 1, -60, 5, -118, 0, 3, 0, 28, 64, 14, 2, 1, 3, 0, 60, +1, 3, 60, 0, -53, 4, -39, -11, 24, 43, 16, -10, -19, 0, 47, -3, 60, 16, 60, 49, 48, 19, 53, 51, 21, +-27, -33, 4, -86, -32, -32, 0, 2, 0, -94, 4, 127, 2, 10, 5, -19, 0, 11, 0, 23, 0, 86, 64, 14, 6, +-124, 18, 77, 3, 77, 12, -124, 0, 108, 24, -98, 121, 24, 43, 16, -10, -3, 25, -12, -12, 24, -19, 0, -79, 6, +2, 67, 84, 88, -78, 15, -124, 9, -72, -1, -64, 64, 9, 11, 14, 52, 9, 9, 21, -124, 3, 1, 63, -19, 51, +47, 43, -3, 27, -76, 9, -124, 15, 77, 6, -72, 2, -76, -75, 0, 77, 21, -124, 3, 1, 63, -3, 25, -12, 24, +-10, 25, -12, 24, -19, 89, 49, 48, 19, 52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, +54, 53, 52, 38, 35, 34, 6, -94, 107, 73, 74, 106, 106, 73, 75, 106, 76, 63, 43, 43, 63, 62, 44, 43, 63, +5, 58, 73, 106, 107, 76, 77, 106, 107, 79, 47, 64, 64, 45, 45, 64, 63, 0, 0, 1, 0, 107, -2, 91, 2, +28, 0, 23, 0, 21, 0, 65, -76, 11, 9, 12, 58, 9, -72, 2, -75, -75, 14, -100, 79, 0, 1, 0, -72, 2, +90, 64, 15, 2, 1, 10, 12, 58, 11, -91, 6, 118, 18, 77, 1, 2, -100, 1, -72, 1, 62, -77, 22, 87, 121, +24, 43, 16, -10, -3, 16, -12, -19, -12, -28, 0, 63, 60, -3, 113, -10, -19, -12, 16, 60, 49, 48, 23, 55, 51, +7, 22, 22, 21, 20, 6, 35, 34, 39, 55, 22, 51, 50, 55, 54, 53, 52, 38, 38, -40, 52, -122, 33, 85, 86, +-112, -111, 82, 62, 11, 64, 30, 94, 38, 29, 23, 62, -102, -79, 107, 10, 85, 52, 75, 115, 12, 117, 4, 26, 20, +29, 18, 28, 20, 0, 2, 0, 58, 4, -86, 2, -5, 5, -62, 0, 3, 0, 7, 0, 65, 64, 33, 7, 4, 0, +0, 3, 16, 3, 2, 3, -121, 6, 1, 5, 2, 0, 6, 60, 5, 114, 15, 4, 1, 4, -36, 0, 2, 60, 1, +114, 0, 25, 8, 112, -71, 1, -112, 0, 24, 43, 78, 16, -12, 77, -12, -19, 16, -12, 93, -12, -3, 0, 63, 60, +60, 60, 77, -3, 93, 60, 60, 60, 49, 48, 19, 19, 51, 3, 51, 19, 51, 3, 58, 121, -22, -45, -53, 127, -25, +-49, 4, -86, 1, 24, -2, -24, 1, 24, -2, -24, 0, 0, 1, 0, -73, -2, 86, 2, 109, 0, 24, 0, 16, 0, +85, 64, 9, -39, 2, 1, 14, 32, 13, 19, 52, 6, -72, -1, -64, -77, 25, 28, 52, 6, -72, 2, -97, 64, 14, +12, 15, 0, 10, 8, 32, 9, 48, 9, 2, 9, 85, 18, 3, -72, -1, -64, 64, 14, 25, 28, 52, 3, -84, 15, +1, -84, 0, 56, 15, -97, 17, -95, -71, 1, -122, 0, 24, 43, 16, -10, -12, -19, 16, -19, 43, 16, -10, 93, 60, +0, 63, 63, -19, 43, 49, 48, 0, 43, 1, 93, 55, 51, 6, 21, 20, 22, 51, 50, 55, 21, 6, 6, 35, 34, +38, 53, 52, -32, 124, 39, 82, 62, 77, 91, 52, 122, 45, 99, 120, 24, 89, 75, 68, 84, 46, 119, 27, 34, 120, +101, 86, 0, 1, 0, 40, 4, -86, 2, -95, 5, -62, 0, 6, 0, 72, 64, 19, 5, 6, 1, 15, 2, 31, 2, +2, 2, -121, 0, 100, 4, 3, 2, 60, 1, 61, 3, -72, -1, -64, 64, 17, 9, 12, 52, 3, 100, 0, 100, 4, +127, 6, 60, 5, 25, 7, -101, 122, 24, 43, 25, 78, 16, -12, 24, 77, -3, 25, -10, 24, -3, -3, 43, 25, -10, +24, -19, 0, 47, 60, -19, -3, 93, 60, 60, 60, 49, 48, 1, 55, 51, 3, 35, 3, 51, 1, 103, 110, -52, -31, +-64, -40, -50, 5, 24, -86, -2, -24, 1, 24, 0, 1, 0, 0, 0, 0, 4, 43, 5, -70, 0, 13, 0, -77, 64, +21, 0, 1, 8, 4, 13, 3, 4, 13, 2, 7, 6, 2, 7, 5, 10, 9, 1, 8, 5, 10, 7, -69, 1, 14, +0, 8, 0, 2, 1, 14, -78, 1, 11, 10, -72, 1, 14, 64, 36, 12, 13, 8, 1, 1, 4, 8, 8, 10, 4, +2, 32, 11, 1, 11, 84, 15, 7, 8, -35, 5, 10, 2, 1, 10, 101, 4, 1, 93, 13, 28, 16, 16, 2, 85, +13, -72, -1, -14, -76, 15, 15, 2, 85, 13, -72, -1, -14, -76, 13, 13, 2, 85, 13, -72, -1, -6, -76, 10, 12, +2, 85, 13, -72, -1, -10, -76, 12, 12, 6, 85, 13, -72, -1, -12, -73, 13, 13, 6, 85, 32, 13, 1, 13, -72, +2, -78, -77, 14, 59, 92, 24, 43, 16, -3, 93, 43, 43, 43, 43, 43, 43, -26, 60, -19, 16, 60, 16, 60, -12, +60, 16, -28, 93, 0, 63, 25, 18, 57, 47, 17, 57, 47, 24, 63, 60, -3, 60, 16, -19, 16, -19, 15, 15, 15, +15, 49, 48, 19, 7, 53, 55, 17, 51, 17, 1, 21, 1, 17, 33, 21, 33, -111, -111, -111, -62, 1, 76, -2, -76, +2, -40, -4, 102, 2, 53, 123, -89, 124, 2, -35, -3, -56, 1, 25, -89, -2, -25, -3, -46, -83, 0, 1, 0, 3, +0, 0, 1, -65, 5, -70, 0, 11, 0, -61, 64, 72, 31, 13, 112, 13, -128, 13, -64, 13, -48, 13, -1, 13, 6, +0, 1, 8, 4, 11, 3, 4, 11, 2, 7, 6, 2, 7, 5, 10, 9, 1, 8, 5, 10, 7, -55, 8, 2, -55, +1, 10, 11, 10, 1, 1, 4, 8, 8, 10, 4, 0, 7, 8, 69, 5, 10, 2, 1, 10, 64, 4, -33, 1, 1, +1, 78, 13, 54, 11, 11, 2, 85, 11, -72, -1, -8, -76, 16, 16, 2, 85, 11, -72, -1, -6, 64, 29, 14, 14, +2, 85, 11, 4, 12, 12, 2, 85, 11, 10, 11, 11, 2, 85, 11, 20, 11, 11, 6, 85, 11, 8, 16, 16, 6, +85, 11, -72, -1, -2, -76, 13, 13, 6, 85, 11, -72, -1, -5, 64, 17, 12, 12, 6, 85, 0, 11, 32, 11, -48, +11, 3, 11, 78, 12, 71, 80, 24, 43, 16, -3, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, -26, 93, 60, -19, +16, 60, 16, 60, -12, 60, 0, 63, 25, 18, 57, 47, 17, 57, 47, 24, 63, 60, 16, -19, 16, -19, 15, 15, 15, +15, 49, 48, 1, 93, 19, 7, 53, 55, 17, 51, 17, 55, 21, 7, 17, 35, -123, -126, -126, -77, -121, -121, -77, 2, +62, 110, -98, 110, 2, -34, -3, -70, 115, -99, 115, -3, 41, -1, -1, 0, 92, -1, -25, 4, -21, 7, 38, 2, 38, +0, 54, 0, 0, 1, 7, 0, -33, 1, 40, 1, 100, 0, 25, 64, 12, 1, -16, 49, 1, 49, 22, 18, 72, 43, +1, 1, 52, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, 63, -1, -24, 3, -79, 5, -62, +2, 38, 0, 86, 0, 0, 1, 7, 0, -33, 0, -108, 0, 0, 0, 25, 64, 12, 1, 112, 49, 1, 49, 21, 18, +72, 43, 1, 1, 53, -71, 2, 34, 0, 41, 0, 43, 1, 43, 113, 53, 0, -1, -1, 0, 41, 0, 0, 4, -80, +7, 38, 2, 38, 0, 61, 0, 0, 1, 7, 0, -33, 1, 20, 1, 100, 0, 22, 64, 10, 1, 0, 18, 15, 6, +7, 65, 1, 1, 16, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 40, 0, 0, 3, -44, 5, -62, +2, 38, 0, 93, 0, 0, 1, 7, 0, -33, 0, -72, 0, 0, 0, 41, -77, 1, 1, 1, 19, -70, 2, 34, 0, +41, 1, 100, -123, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 20, 17, 6, 7, 65, 43, 27, -75, 0, 20, +17, 6, 14, 65, 43, 89, 53, 0, 0, 2, 0, -68, -2, 81, 1, 89, 5, -45, 0, 3, 0, 7, 0, 79, -67, +0, 2, 2, -82, 0, 7, 1, 101, 0, 6, 1, 126, 64, 35, 3, 0, 9, -95, 0, 3, 2, 0, 1, 1, 5, +5, -97, 4, -81, 4, 2, 4, 118, 6, 7, 7, 32, 2, 1, 2, -95, 8, 8, 9, -43, 33, -95, -104, 24, 43, +43, 78, 16, -12, 93, 60, 16, 60, 77, -3, 93, 60, 16, 60, 16, 60, 16, 60, 16, -18, 0, 63, 77, -3, -3, +-26, 49, 48, 1, 17, 35, 17, 19, 17, 35, 17, 1, 89, -99, -99, -99, 5, -45, -4, -22, 3, 22, -5, -107, -4, +-23, 3, 23, 0, 2, -1, -3, 0, 0, 5, 90, 5, -70, 0, 19, 0, 37, 1, 3, 64, 46, 67, 8, 35, 3, +48, 36, 2, 2, 0, 32, 33, 30, 6, 5, 2, 21, 20, 30, 19, 0, 8, 36, 36, 38, 39, 27, 38, 13, 40, +16, 16, 2, 85, 13, 14, 15, 15, 2, 85, 13, 20, 13, 13, 2, 85, 13, -72, -1, -8, -76, 12, 12, 2, 85, +13, -72, -1, -8, -76, 11, 11, 2, 85, 13, -72, -1, -21, 64, 23, 12, 12, 6, 85, 0, 13, 1, 13, 26, 39, +33, 20, 32, 5, 2, 57, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, +-76, 13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -9, -76, 12, 12, 6, 85, 0, -72, +-1, -8, 64, 10, 13, 13, 6, 85, 0, 93, 38, 96, 91, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, -28, 60, +-3, 60, 78, 16, -10, 93, 43, 43, 43, 43, 43, 43, 77, -19, 17, 18, 57, 47, 0, 63, 60, -3, 60, 63, 60, +-3, 60, 18, 57, 47, 60, -3, 60, 49, 48, 67, 121, 64, 54, 7, 31, 11, 12, 10, 12, 9, 12, 8, 12, 4, +6, 29, 28, 30, 28, 2, 6, 15, 14, 16, 14, 17, 14, 3, 6, 25, 26, 24, 26, 23, 26, 3, 6, 31, 7, +27, 33, 1, 22, 18, 27, 33, 1, 28, 12, 32, 33, 1, 26, 14, 21, 33, 0, 43, 43, 1, 43, 43, 42, 42, +42, 42, -127, 51, 17, 35, 53, 51, 17, 33, 50, 23, 22, 23, 22, 18, 21, 20, 2, 6, 7, 6, 35, 37, 33, +50, 54, 55, 54, 54, 53, 52, 46, 2, 35, 33, 17, 33, 21, 33, -98, -95, -95, 1, -6, -86, 90, 126, 89, 116, +115, -114, -58, -127, 71, -113, -2, -79, 1, 57, -110, -92, 48, 69, 78, 77, 124, -104, -99, -2, -52, 1, -108, -2, 108, +2, -101, -124, 2, -101, 21, 29, 76, 98, -2, -49, -60, -32, -2, -67, -110, 31, 17, -83, 54, 48, 69, -24, -89, -84, +-50, 124, 48, -2, 18, -124, 0, 2, 0, 73, -1, -25, 4, 33, 5, -70, 0, 28, 0, 40, 1, -110, 64, 109, 15, +25, 31, 25, 55, 3, 58, 30, 86, 3, 93, 28, 6, 4, 0, 20, 0, 42, 5, 36, 24, 93, 0, 5, 50, 8, +2, 3, 3, 1, 24, 24, 22, 6, 6, 7, 25, 25, 5, 27, 27, 0, 26, 3, 3, 3, 1, 27, 27, 0, 26, +26, 4, 28, 27, 27, 0, 24, 23, 21, 6, 2, 5, 29, 35, 21, 18, 32, 24, 23, 6, 2, 4, 0, 25, 27, +26, 25, 4, 3, 1, 0, 7, 35, 5, 8, 29, 27, 26, 5, 3, 4, 0, 25, 32, 28, 32, 18, 48, 18, 2, +18, -113, 25, 4, 1, 0, 0, 25, -72, -1, -64, 64, 13, 14, 14, 2, 85, 25, 7, 38, 28, 11, 11, 29, 36, +8, -72, -1, -20, -76, 15, 15, 2, 85, 8, -72, -1, -10, -76, 13, 13, 2, 85, 8, -72, -1, -30, -76, 11, 11, +2, 85, 8, -72, -1, -16, -76, 11, 11, 6, 85, 8, -72, -1, -23, -76, 13, 13, 6, 85, 8, -72, -1, -16, -76, +15, 15, 6, 85, 8, -72, -1, -26, 64, 54, 12, 12, 6, 85, 8, 26, 42, 35, 36, 15, 10, 15, 15, 2, 85, +15, 30, 12, 12, 2, 85, 15, 20, 11, 11, 6, 85, 15, 27, 13, 13, 6, 85, 15, 8, 16, 16, 6, 85, 15, +32, 12, 12, 6, 85, 31, 15, 1, 15, 25, 41, 52, 55, 24, 43, 78, 16, -12, 93, 43, 43, 43, 43, 43, 43, +77, -19, 78, 16, -10, 43, 43, 43, 43, 43, 43, 43, 77, -19, 0, 63, -19, 63, 43, 63, 60, 60, 16, -10, 93, +-19, 17, 18, 23, 57, 1, 17, 18, 57, 18, 23, 57, 0, 17, 18, 23, 57, 17, 18, 57, 1, 17, 18, 23, 57, +7, 16, 14, 60, 7, 16, 8, 60, 8, 60, -121, 8, 60, -121, 16, 8, 125, -60, 8, 60, 7, 16, 14, 60, -79, +6, 2, 67, 84, 88, -74, 9, 24, 26, 24, 89, 24, 3, 0, 93, 89, 49, 48, 24, 67, 121, 64, 36, 33, 40, +9, 17, 13, 37, 33, 17, 35, 29, 0, 37, 12, 35, 29, 0, 39, 10, 29, 29, 1, 34, 16, 32, 29, 1, 36, +14, 38, 29, 0, 40, 9, 38, 29, 0, 0, 43, 43, 43, 1, 43, 43, 43, 43, -127, -127, 1, 93, 0, 93, 1, +51, 22, 23, 55, 23, 7, 0, 17, 20, 0, 35, 34, 39, 38, 53, 16, 0, 51, 50, 22, 23, 38, 38, 39, 5, +39, 55, 38, 1, 52, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 1, 52, -39, 72, 53, -42, 45, -84, 1, 64, +-2, -22, -41, -1, -113, 93, 1, 2, -62, 58, 88, 66, 36, 54, 52, -2, -19, 44, -17, 97, 1, -60, -75, -124, -126, +-86, -81, -125, -128, -77, 5, -70, 54, 48, 102, 102, 83, -2, -112, -2, 120, -3, -2, -37, -62, 127, -35, 1, 5, 1, +28, 24, 35, 73, 81, 59, 127, 103, 109, 90, -4, -94, -64, -53, -53, -47, -62, -60, -49, -1, -1, 0, 6, 0, 0, +5, 70, 7, 44, 2, 38, 0, 60, 0, 0, 1, 7, 0, -115, 1, 77, 1, 106, 0, 24, 64, 10, 1, 1, 16, +6, 26, 72, 39, 1, 1, 16, -70, 2, 33, 0, 41, 1, 100, -123, 0, 43, 1, 43, -1, -1, 0, 33, -2, 81, +3, -18, 5, -62, 2, 38, 0, 92, 0, 0, 1, 7, 0, -115, 0, -58, 0, 0, 0, 31, 64, 17, 1, 0, 30, +1, -112, 30, -32, 30, 2, 30, 15, 34, 72, 43, 1, 1, 30, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 113, +53, 0, 0, 2, 0, -98, 0, 0, 4, -3, 5, -70, 0, 15, 0, 26, 0, -95, 64, 22, 16, 26, 20, 15, 16, +30, 14, -38, 0, 25, 26, 30, 4, 3, -38, 1, 2, 0, 8, 20, 38, 10, -72, -1, -16, -76, 13, 13, 6, 85, +10, -72, -1, -16, -76, 12, 12, 6, 85, 10, -72, -1, -22, 64, 23, 11, 11, 6, 85, 16, 10, 32, 10, 2, 10, +46, 28, 2, 15, 32, 1, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, +-76, 13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -16, -76, 13, 13, 6, 85, 0, -72, +-1, -6, 64, 13, 12, 12, 6, 85, 32, 0, 1, 0, 93, 27, 59, 92, 24, 43, 16, -10, 93, 43, 43, 43, 43, +43, 43, 60, -3, 60, 16, -10, 93, 43, 43, 43, -19, 0, 63, 63, -12, 60, -3, 60, 16, -12, -19, 1, 17, 18, +57, 57, 49, 48, 51, 17, 51, 17, 33, 50, 23, 30, 2, 21, 20, 2, 33, 33, 17, 17, 33, 50, 54, 53, 52, +38, 39, 38, 35, 33, -98, -62, 1, 103, -110, 78, 108, -110, 88, -18, -2, -55, -2, -120, 1, 123, -68, -98, 92, 76, +49, -123, -2, -119, 5, -70, -2, -42, 14, 19, 101, -74, 109, -70, -2, -3, -2, -42, 1, -41, -116, 126, 91, -124, 21, +14, 0, 0, 2, 0, -121, -2, 105, 4, 33, 5, -70, 0, 20, 0, 32, 1, 37, 64, 41, 72, 32, 87, 4, 88, +18, 102, 4, 104, 18, -21, 32, 6, 55, 31, 1, 41, 8, 21, 20, 0, 19, 24, 15, 3, 7, 1, 0, 30, 28, +7, 7, 24, 28, 15, 11, 0, 14, 27, 36, 11, -72, -1, -14, 64, 11, 15, 15, 2, 85, 11, 18, 13, 13, 2, +85, 11, -72, -1, -6, 64, 11, 12, 12, 2, 85, 11, 6, 11, 11, 2, 85, 11, -72, -1, -14, -76, 11, 11, 6, +85, 11, -72, -1, -28, -76, 12, 12, 6, 85, 11, -72, -1, -6, -76, 13, 13, 6, 85, 11, -72, -1, -5, 64, 14, +16, 16, 6, 85, 11, 26, 34, 2, 3, 19, 20, 37, 1, 0, -72, -1, -4, 64, 23, 14, 14, 2, 85, 0, 16, +13, 13, 2, 85, 0, 16, 12, 12, 2, 85, 0, 16, 11, 11, 2, 85, 0, -72, -1, -10, -76, 16, 16, 6, 85, +0, -72, -1, -4, 64, 35, 15, 15, 6, 85, 0, 18, 13, 13, 6, 85, 0, 12, 12, 12, 6, 85, 0, 12, 11, +11, 6, 85, 31, 0, 63, 0, 79, 0, 3, 0, 25, 33, 71, 55, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, +43, 43, 43, 43, 60, -3, 60, 60, 60, 78, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 77, -19, 0, 63, 63, +-19, 63, -19, 63, 17, 57, 17, 18, 57, 1, 17, 18, 57, 49, 48, 67, 121, 64, 28, 25, 29, 8, 14, 9, 37, +13, 38, 29, 8, 27, 29, 1, 25, 14, 27, 29, 1, 28, 10, 30, 29, 1, 26, 12, 24, 29, 0, 0, 43, 43, +1, 43, 43, 43, 43, -127, -127, 1, 93, 0, 93, 19, 17, 51, 17, 54, 55, 54, 51, 50, 22, 22, 21, 20, 2, +6, 35, 34, 39, 38, 39, 17, 3, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, -121, -76, 73, 55, 72, 92, +-120, -48, 106, 117, -33, 122, 83, 71, 54, 72, 17, -90, 118, 120, -85, -89, 116, 115, -79, -2, 105, 7, 81, -3, -4, +77, 25, 34, -116, -1, -104, -92, -2, -4, -117, 33, 26, 75, -3, -5, 3, -92, -51, -60, -53, -43, -53, -54, -41, 0, +0, 1, 0, 114, 2, 127, 4, 58, 3, 39, 0, 3, 0, 26, 64, 12, 2, 37, 0, 0, 26, 5, 1, 25, 4, +87, 90, 24, 43, 78, 16, -28, 16, -10, 0, 47, 77, -19, 49, 48, 1, 33, 53, 33, 4, 58, -4, 56, 3, -56, +2, 127, -88, 0, 0, 1, 0, -95, 1, 32, 4, 9, 4, -120, 0, 11, 1, 32, -75, 39, 4, 1, 36, 4, 1, +-79, 6, 2, 67, 84, 88, 64, 17, 11, 10, 3, 17, 3, 35, 3, 73, 3, 85, 3, 102, 3, -123, 3, 7, 3, +0, 47, 93, 51, 48, 27, -80, 124, 75, 83, 88, 64, 23, 30, 17, 10, 6, 11, 2, 9, 7, 6, 11, 3, 8, +4, 3, 8, 0, 5, 1, 0, 5, 2, 9, 5, -69, 2, 119, 0, 6, 0, 3, 2, 119, -77, 2, 7, 1, 9, +-69, 2, 119, 0, 8, 0, 11, 2, 119, 64, 24, 0, 6, 2, -108, 42, 1, 1, 1, -108, 8, 48, 0, -112, 0, +2, 63, 0, 80, 0, 2, 0, 10, 4, 8, 65, 10, 2, -110, 0, 9, 0, 6, 2, -110, 0, 5, 0, 2, 2, +-110, 0, 3, 0, 0, 2, -110, 64, 22, 11, 9, 5, -108, 4, -108, 3, -80, 11, -64, 11, 2, -97, 11, 1, 32, +11, 1, 11, -4, 12, -98, -71, 1, -127, 0, 24, 43, 16, -10, 93, 93, 93, 60, 25, -4, -4, 60, 24, 16, -20, +16, -20, 16, -20, 16, -20, 16, 60, 0, 47, 93, 113, 60, 25, -4, 93, -4, 60, 24, 16, -20, 16, -20, 16, 60, +16, -20, 16, -20, 15, 15, 15, 15, 75, 83, 88, -78, 6, 42, 8, -66, -1, -42, 0, 7, -1, -32, 0, 3, -1, +-32, 0, 11, -1, -32, 64, 13, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 1, 23, 56, 56, 56, +56, 0, 56, 56, 89, 75, 81, 88, 64, 9, 2, 1, 10, 9, 0, 4, 5, 4, 7, 1, 23, 56, 89, 89, 89, +49, 48, 0, 93, 1, 93, 19, 1, 1, 55, 1, 1, 23, 1, 1, 7, 1, 1, -95, 1, 59, -2, -58, 122, 1, +58, 1, 57, 120, -2, -56, 1, 58, 122, -2, -58, -2, -59, 1, -103, 1, 59, 1, 58, 122, -2, -58, 1, 57, 121, +-2, -57, -2, -58, 122, 1, 58, -2, -59, 0, 0, 1, 0, 107, 2, -35, 1, -36, 5, -52, 0, 9, 0, 80, 64, +16, 1, 34, 18, 57, 3, 34, 18, 57, 7, 8, 0, 1, 4, 3, 9, 0, -72, 1, 31, -77, 8, 3, -24, 4, +-72, 2, -93, 64, 15, 7, 7, 8, 1, 8, 9, 53, 1, 0, -53, 4, 3, 117, 10, 87, -71, 1, 47, 0, 24, +43, 16, -10, 60, -10, 60, -3, 60, 0, 63, 60, 16, -12, -19, 16, -3, 60, 17, 18, 57, 1, 17, 18, 57, 49, +48, 0, 43, 43, 1, 17, 6, 7, 53, 54, 54, 55, 51, 17, 1, 75, 102, 122, 62, -104, 47, 108, 2, -35, 2, +42, 81, 32, 123, 20, 106, 61, -3, 17, 0, 1, 0, 25, 2, -35, 2, -120, 5, -52, 0, 28, 0, -126, 64, 27, +3, 4, 12, 24, 2, 117, 24, -27, 23, -27, 24, -4, 3, 4, 10, 5, 1, 26, 25, 24, 3, 7, 13, 24, 25, +18, 26, -70, 2, 97, 0, 28, 1, 31, -74, 17, 13, 39, 63, 14, 1, 14, -70, 2, -72, 0, 10, 2, 97, 64, +20, 17, 1, 27, 28, 58, 7, 41, 20, -65, 0, 13, 41, 14, 39, 0, 25, 29, -87, 104, 24, 43, 78, 16, -12, +77, -12, -19, 16, -3, -19, -12, 60, 0, 63, -3, -12, 93, -28, 16, -3, -3, 17, 57, 57, 1, 17, 18, 23, 57, +-79, 6, 2, 67, 84, 88, -75, 24, 17, 28, 3, 17, 26, 0, 17, 18, 57, 17, 18, 57, 89, 49, 48, 1, 113, +93, 0, 113, 19, 54, 55, 54, 36, 55, 54, 53, 52, 38, 35, 34, 6, 7, 39, 54, 54, 51, 50, 22, 21, 20, +7, 6, 7, 6, 7, 33, 21, 25, 6, 41, 63, 1, 32, 27, 37, 70, 68, 66, 65, 21, -105, 29, -113, -122, -105, +-115, 59, 45, -96, 83, 35, 1, -126, 2, -35, 57, 57, 86, -47, 30, 41, 43, 48, 62, 47, 67, 16, 111, 105, 118, +85, 84, 75, 56, 115, 61, 36, 121, 0, 1, 0, 33, 2, -53, 2, -122, 5, -52, 0, 43, 0, 118, 64, 17, 35, +8, 16, 19, 35, 16, 77, 15, 15, 22, 5, 1, 39, 48, 0, 1, 0, -68, 2, -72, 0, 5, 2, 97, 0, 41, +1, 31, 64, 12, 29, 25, 39, 95, 26, 111, 26, 2, 63, 26, 1, 26, -70, 2, -72, 0, 22, 2, 97, 64, 25, +29, 1, 15, -96, 19, 41, 32, 39, 8, 41, 38, -33, 0, 25, 41, 26, 39, 1, 41, 0, 25, 44, -87, 104, 24, +43, 78, 16, -12, 77, -19, -12, -19, 16, -3, -19, -12, -3, -12, 0, 63, -3, -12, 93, 114, -28, 16, -3, -3, -12, +93, -28, 17, 18, 57, 47, -4, 57, 1, 18, 57, 17, 57, 49, 48, 19, 55, 22, 23, 22, 51, 50, 54, 53, 52, +38, 35, 34, 7, 6, 35, 55, 22, 54, 53, 52, 38, 35, 34, 6, 7, 39, 54, 54, 51, 50, 22, 21, 20, 6, +7, 22, 22, 21, 20, 6, 35, 34, 38, 33, -110, 20, 32, 43, 59, 71, 86, 72, 87, 12, 21, 14, 8, 22, 81, +75, 60, 59, 56, 63, 23, -113, 41, 125, 120, -112, -125, 71, 67, 89, 84, -98, -110, -116, -108, 3, -95, 15, 60, 22, +30, 78, 55, 50, 60, 2, 1, 110, 1, 60, 43, 37, 52, 44, 58, 23, 106, 84, 107, 80, 55, 86, 19, 22, 101, +68, 93, -118, 111, 0, 3, 0, 107, -1, -57, 6, -120, 5, -45, 0, 3, 0, 13, 0, 42, 1, 0, 64, 26, 6, +17, 1, -10, 17, 1, 47, 44, 51, 33, 63, 38, 68, 33, 84, 33, -84, 40, -68, 40, -20, 40, 8, 2, 3, 3, +-72, 2, -102, 64, 33, 0, 1, 20, 0, 0, 1, 40, 41, 15, 16, 17, 3, 27, 14, 0, 3, 1, 2, 4, 44, +43, 11, 12, 4, 5, 8, 7, 28, 24, 27, 7, -24, 8, -72, 2, -93, -78, 11, 4, 13, -72, 1, 31, 64, 16, +11, 12, 58, 2, 1, 1, 31, 27, 47, 27, 63, 27, 3, 27, 77, 24, -65, 2, 97, 0, 31, 1, 31, 0, 40, +2, 97, 0, 14, 0, 41, 2, 97, 64, 11, 42, 42, 14, 39, 0, 0, 3, 9, 14, 39, 27, -70, 2, 99, 0, +28, 1, 29, 64, 19, 21, 41, 34, 58, 42, 42, 41, 105, 44, 5, 4, 12, 13, 41, 4, 8, 7, -53, 4, -72, +1, 68, -77, 43, 87, 104, 24, 43, 16, -10, -10, 60, 16, -3, 60, 16, 60, 16, -10, 60, 16, -12, -19, -3, -19, +-28, 0, 63, 60, 16, -12, 60, 16, -19, 16, -19, -3, -3, -12, 93, 63, 60, -12, 60, -3, 60, 16, -12, -3, 17, +18, 57, 17, 18, 57, 1, 17, 18, 57, 17, 18, 23, 57, 17, 18, 23, 57, 17, 57, -121, 46, 43, 125, 16, -60, +-79, 6, 2, 67, 84, 88, -75, 38, 31, 42, 17, 31, 41, 0, 17, 18, 57, 17, 18, 57, 89, 49, 48, 1, 93, +0, 93, 113, 23, 1, 51, 1, 3, 17, 6, 7, 53, 54, 54, 55, 51, 17, 1, 54, 55, 54, 36, 55, 54, 53, +52, 38, 35, 34, 6, 7, 39, 54, 54, 51, 50, 22, 21, 20, 7, 6, 7, 6, 7, 33, 21, -28, 4, 77, -99, +-5, -77, 54, 102, 122, 62, -104, 47, 108, 2, 61, 6, 42, 62, 1, 32, 27, 37, 69, 69, 66, 65, 21, -105, 29, +-112, -123, -105, -115, 59, 45, -97, 84, 35, 1, -126, 57, 6, 12, -7, -12, 3, 22, 2, 42, 81, 32, 123, 20, 106, +61, -3, 17, -3, 4, 56, 57, 87, -48, 31, 41, 43, 48, 61, 47, 66, 15, 112, 105, 118, 85, 84, 75, 56, 116, +61, 35, 121, 0, 0, 4, 0, 107, -1, -57, 6, -114, 5, -45, 0, 3, 0, 13, 0, 24, 0, 27, 1, 1, 64, +32, 22, 17, 1, 32, 1, 32, 2, 41, 17, 43, 27, 58, 17, 58, 27, 86, 0, 102, 0, -122, 27, 9, 27, 27, +102, 27, 118, 27, 3, 1, 0, 0, -72, 2, -102, 64, 29, 3, 2, 20, 3, 3, 2, 11, 12, 4, 0, 3, 1, +2, 4, 29, 28, 27, 17, 18, 24, 14, 26, 17, 18, 27, 5, 7, -24, 8, -72, 2, -93, -78, 11, 4, 13, -72, +1, 31, 64, 21, 12, 12, 11, 2, 11, 58, 1, 1, 22, 23, 23, 16, 15, 27, 25, 21, 20, 20, 25, 100, 15, +-72, 2, -80, -78, 14, 19, 18, -72, 1, 31, 64, 45, 24, 24, 14, 0, 3, 39, 14, 11, 26, 53, 19, 27, -7, +17, 17, 95, 16, 1, 16, -18, 14, 53, 19, 22, 77, 32, 24, 1, 24, -84, 29, 12, 13, 53, 5, 4, 8, 7, +-53, 32, 4, 1, 4, 25, 28, -69, 1, -95, 0, 104, 0, 24, 1, 14, -123, 43, 78, 16, -12, 93, 77, -10, 60, +16, 60, -3, 60, 16, -10, 93, -28, 60, -19, -3, 93, 60, 16, -19, 16, -19, 0, 63, -12, 60, 16, 60, 16, -3, +60, 16, -12, -3, 60, 16, 60, 16, 60, 16, 60, 60, 16, 60, 63, -28, 60, 16, 60, 16, -3, 60, 16, -12, -3, +57, 17, 18, 57, 57, 1, 17, 18, 57, 18, 57, 17, 18, 23, 57, 17, 18, 57, -121, 46, 43, 125, 16, -60, 49, +48, 1, 93, 93, 0, 93, 23, 1, 51, 1, 3, 17, 6, 7, 53, 54, 54, 55, 51, 17, 1, 53, 33, 53, 1, +51, 17, 51, 21, 35, 21, 3, 17, 3, -4, 4, 78, -100, -5, -77, 78, 102, 122, 62, -104, 47, 108, 3, -70, -2, +-127, 1, -107, 122, 104, 104, -112, -26, 57, 6, 12, -7, -12, 3, 22, 2, 42, 81, 32, 123, 20, 106, 61, -3, 17, +-3, 4, -102, 123, 1, -38, -2, 23, 108, -102, 1, 6, 1, 7, -2, -7, 0, 4, 0, 33, -1, -57, 6, -114, 5, +-45, 0, 3, 0, 45, 0, 56, 0, 59, 1, 51, -75, 47, 61, 1, 2, 3, 3, -72, 2, -102, 64, 39, 0, 1, +20, 0, 0, 1, 18, 21, 17, 0, 3, 1, 2, 4, 61, 60, 37, 12, 21, 50, 51, 58, 37, 17, 18, 5, 4, +9, 49, 58, 50, 48, 18, 77, 17, 17, 24, 9, 5, -72, 2, -86, 64, 11, 16, 4, 32, 4, 48, 4, 3, 4, +-111, 9, 27, -72, 2, -86, 64, 23, 31, 28, 47, 28, 63, 28, 3, 127, 28, 1, 95, 28, 111, 28, 2, 95, 28, +111, 28, 2, 28, -111, 24, -67, 2, 97, 0, 31, 0, 9, 2, 97, 0, 43, 1, 31, 64, 18, 31, 51, 2, 1, +1, 53, 52, 52, 57, 54, 55, 55, 47, 59, 57, 100, 48, 47, -72, 2, -79, -78, 46, 51, 50, -72, 1, 31, 64, +9, 56, 56, 46, 3, 0, -113, 46, 11, 17, -72, 2, 48, 64, 29, 21, 59, -7, 49, 49, 48, -18, 56, 58, 53, +51, 54, -111, 51, 46, 41, 56, 78, 61, 21, 41, 34, 34, 12, 41, 48, 40, 1, 40, -72, 2, 40, 64, 13, 4, +27, 41, 28, 34, 5, 41, 4, 25, 60, 124, 102, 24, 43, 78, 16, -12, 77, -19, -12, -19, 16, -3, 93, -19, -12, +-19, 16, -10, -19, 60, -28, 16, -19, 16, -3, 60, 16, -19, 16, -12, 0, 63, -10, 60, 16, 60, 16, -3, 60, 16, +-12, 60, -3, 60, 16, 60, 16, 60, 16, 60, 16, 60, 63, 60, -12, -3, -19, 16, -3, -12, 114, 113, 113, 93, -28, +16, -12, 93, -28, 17, 18, 57, 47, -4, 17, 18, 57, 57, 17, 18, 57, 17, 18, 57, 1, 17, 18, 57, 17, 18, +57, 17, 18, 23, 57, 17, 18, 57, -121, 46, 43, 125, 16, -60, 49, 48, 1, 93, 23, 1, 51, 1, 1, 55, 22, +23, 22, 51, 50, 54, 53, 52, 38, 35, 6, 35, 55, 22, 54, 53, 52, 38, 35, 34, 6, 7, 39, 54, 54, 51, +50, 22, 21, 20, 6, 7, 22, 22, 21, 20, 6, 35, 34, 38, 1, 53, 33, 53, 1, 51, 17, 51, 21, 35, 21, +3, 17, 3, -4, 4, 77, -99, -5, -77, -2, -120, -110, 20, 32, 43, 59, 71, 86, 72, 84, 50, 8, 22, 81, 75, +60, 59, 56, 63, 23, -113, 41, 125, 120, -112, -125, 71, 67, 89, 84, -98, -110, -116, -108, 5, 95, -2, -126, 1, -108, +123, 104, 104, -111, -27, 57, 6, 12, -7, -12, 3, -38, 15, 60, 22, 30, 78, 55, 50, 60, 3, 110, 1, 60, 43, +37, 52, 44, 58, 23, 106, 84, 107, 80, 55, 86, 19, 22, 101, 68, 93, -118, 111, -4, -89, -102, 123, 1, -38, -2, +23, 108, -102, 1, 6, 1, 7, -2, -7, 0, 0, 1, 0, 0, 0, 0, 4, 13, 5, -70, 0, 17, 0, -65, 64, +20, 7, 30, 5, 5, 4, 9, 30, 11, 64, 11, 11, 2, 85, 11, 64, 17, 17, 2, 85, 11, -72, 2, 49, 64, +53, 14, 30, 12, 30, 2, 30, 0, 64, 13, 13, 2, 85, 0, -122, 16, 17, 4, 2, 17, 0, 14, 13, -91, 10, +10, 9, 77, 6, 6, 5, 106, 19, 7, 8, 11, 12, 15, 16, 32, 4, 3, 0, 17, 2, 1, 118, 17, 28, 16, +16, 2, 85, 17, -72, -1, -18, -76, 15, 15, 2, 85, 17, -72, -1, -14, -76, 13, 13, 2, 85, 17, -72, -1, -10, +-76, 12, 12, 2, 85, 17, -72, -1, -4, -76, 11, 11, 2, 85, 17, -72, -1, -14, -76, 12, 12, 6, 85, 17, -72, +-1, -16, 64, 10, 13, 13, 6, 85, 17, -97, 18, -95, -89, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, -12, +60, 16, 60, 60, 60, -3, 60, 60, 60, 60, 60, 16, -10, 60, 16, -12, 60, 16, -12, 60, 0, 63, 63, 16, 60, +-12, 43, -19, -3, -19, -2, 43, 43, -19, 16, 60, 16, -19, 49, 48, 55, 35, 53, 51, 17, 33, 21, 33, 17, 33, +21, 33, 17, 33, 21, 33, 21, 35, -88, -88, -88, 3, 101, -3, 93, 2, 56, -3, -56, 1, 59, -2, -59, -62, -10, +-107, 4, 47, -83, -2, 58, -83, -2, -15, -107, -10, 0, -1, -1, 0, 109, -1, -25, 5, -71, 7, 23, 2, 38, 0, +42, 0, 0, 1, 7, 0, -39, 2, 14, 1, 95, 0, 44, -77, 1, 1, 1, 42, -71, 2, 33, 0, 41, 0, 43, +1, -79, 6, 2, 67, 84, 88, -75, 0, 45, 39, 14, 14, 65, 43, 27, 64, 10, 112, 42, -96, 42, 2, 42, 14, +0, 104, 43, 43, 93, 89, 53, -1, -1, 0, 66, -2, 81, 3, -22, 5, -72, 2, 38, 0, 74, 0, 0, 1, 7, +0, -39, 0, -28, 0, 0, 0, 25, 64, 12, 2, -64, 47, 1, 47, 19, 44, 104, 43, 2, 1, 47, -71, 2, 34, +0, 41, 0, 43, 1, 43, 113, 53, 0, -1, -1, 0, -79, 0, 0, 1, -112, 6, -12, 2, 38, 0, 44, 0, 0, +1, 7, 0, -38, -1, -52, 1, 106, 0, 39, -78, 1, 1, 7, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, +67, 84, 88, -74, 1, 0, 5, 6, 1, 2, 65, 43, 53, 27, -74, 1, 1, 7, 2, 9, 72, 39, 43, 89, 0, +-1, -1, 0, 92, -2, 101, 4, -21, 5, -45, 2, 38, 0, 54, 0, 0, 1, 7, 0, -36, 1, 83, 0, 10, 0, +32, 64, 22, 1, 31, 51, 1, -64, 51, -16, 51, 2, -112, 51, 1, 51, 45, 25, 72, 43, 1, 1, 50, 8, 41, +0, 43, 1, 43, 93, 93, 113, 53, -1, -1, 0, 63, -2, 111, 3, -79, 4, 62, 2, 38, 0, 86, 0, 0, 1, +7, 0, -36, 0, -97, 0, 20, 0, 58, -75, 1, 1, 1, 50, 10, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, +-75, 0, 50, 51, 46, 46, 65, 43, 27, 64, 12, 16, 51, 1, -32, 51, -16, 51, 2, -80, 51, 1, 51, -72, -1, +-64, -73, 15, 17, 52, 51, 46, 60, 72, 43, 43, 43, 93, 93, 114, 89, 53, -1, -1, 0, 102, -1, -25, 5, 118, +7, 44, 2, 38, 0, 38, 0, 0, 1, 7, 0, -115, 1, -71, 1, 106, 0, 46, -74, 1, 33, 64, 16, 17, 52, +33, -72, -1, -64, 64, 19, 19, 25, 52, 112, 33, -33, 33, 2, 47, 33, 1, 33, 12, 0, 72, 43, 1, 1, 33, +-71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 43, 43, 53, -1, -1, 0, 80, -1, -24, 3, -19, 5, -62, 2, +38, 0, 70, 0, 0, 1, 7, 0, -115, 0, -54, 0, 0, 0, 48, -77, 1, 1, 1, 30, -71, 2, 34, 0, 41, +0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 30, 30, 11, 11, 65, 43, 27, 64, 13, 0, 30, -96, 30, 2, +127, 30, 1, 30, 11, 0, 72, 43, 43, 93, 113, 89, 53, -1, -1, 0, 102, -1, -25, 5, 118, 7, 38, 2, 38, +0, 38, 0, 0, 1, 7, 0, -33, 1, -80, 1, 100, 0, 22, 64, 10, 1, 0, 35, 32, 8, 15, 65, 1, 1, +34, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 80, -1, -24, 3, -19, 5, -62, 2, 38, 0, 70, +0, 0, 1, 7, 0, -33, 0, -54, 0, 0, 0, 22, 64, 10, 1, 0, 32, 29, 7, 14, 65, 1, 1, 31, -71, +2, 34, 0, 41, 0, 43, 1, 43, 53, 0, 2, 0, 70, -1, -24, 4, 112, 5, -70, 0, 25, 0, 37, 1, 118, +64, 118, 83, 28, 80, 36, -113, 39, 3, 63, 39, 1, 41, 13, 38, 24, 42, 30, 57, 13, 54, 24, 54, 28, 58, +37, 74, 13, 69, 23, 70, 27, 73, 37, 90, 13, 90, 20, 87, 21, 86, 24, 15, 12, 29, 25, 22, 35, 1, 0, +64, 30, 43, 52, 0, -44, 3, 8, 9, 64, 30, 43, 52, 9, -44, 7, 95, 6, 111, 6, 2, 31, 6, 47, 6, +63, 6, 95, 6, -97, 6, 5, 6, -111, 5, 2, 95, 3, 111, 3, 2, 31, 3, 47, 3, 63, 3, 95, 3, -97, +3, 5, 3, -111, 5, 4, 0, 10, 11, 10, 29, 28, 14, 11, 35, 28, 22, 7, 2, 1, -72, 2, 107, 64, 49, +8, 3, 4, 37, 5, 32, 51, 0, 25, 12, 11, 37, 10, 7, 96, 8, 1, -96, 8, 1, -80, 8, -48, 8, 2, +8, -110, 5, 6, 9, 39, 64, 11, 11, 2, 85, 39, 64, 13, 13, 2, 85, 10, 18, 16, 16, 2, 85, 10, -72, +-1, -12, 64, 17, 15, 15, 2, 85, 10, 6, 14, 14, 2, 85, 10, 24, 13, 13, 2, 85, 10, -72, -1, -14, 64, +11, 11, 11, 6, 85, 10, 14, 16, 16, 6, 85, 10, -72, -1, -18, -76, 12, 12, 6, 85, 10, -72, -1, -8, 64, +66, 13, 13, 6, 85, 16, 10, 64, 10, -128, 10, 3, 10, 116, 26, 36, 18, 30, 11, 11, 2, 85, 18, 24, 12, +12, 2, 85, 18, 30, 13, 13, 2, 85, 18, 12, 11, 11, 6, 85, 18, 12, 13, 13, 6, 85, 18, 26, 12, 12, +6, 85, 31, 18, 63, 18, 79, 18, 96, 18, 4, 18, 25, 38, 52, 80, 24, 43, 78, 16, -12, 93, 43, 43, 43, +43, 43, 43, 77, -19, -3, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 60, 60, 60, -12, 93, 113, 114, 60, +16, -3, 60, 60, 60, -28, 16, -3, 60, 16, -3, 60, 0, 63, -19, 63, -19, 63, 60, 63, 60, -12, 93, 113, 60, +16, -12, 93, 113, 60, -3, 43, 60, 16, -3, 43, 60, 17, 18, 57, 18, 57, 49, 48, 0, 93, 1, 114, 93, 1, +33, 53, 33, 53, 51, 21, 51, 21, 35, 17, 35, 53, 6, 35, 34, 38, 38, 53, 52, 18, 54, 51, 50, 22, 23, +1, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 3, 44, -2, -90, 1, 90, -77, -111, -111, -89, 101, -60, 127, +-43, 117, 106, -44, -125, 96, -106, 47, -3, -45, -84, 117, 118, -91, -88, 123, 120, -95, 4, -61, -124, 115, 115, -124, -5, +61, -122, -98, -116, -5, -93, -97, 1, 3, -118, 81, 65, -2, 102, -52, -54, -63, -58, -38, -52, -60, 0, 0, 1, -1, +-31, 6, 30, 4, -118, 6, -97, 0, 3, 0, 37, 64, 13, 2, 48, 3, 3, 1, 48, 0, 3, 26, 5, 0, 25, +4, -70, 1, -119, 1, -114, 0, 24, 43, 78, 16, -28, 16, -26, 0, 47, 77, -19, 60, 16, -19, 49, 48, 3, 53, +33, 21, 31, 4, -87, 6, 30, -127, -127, 0, 1, 1, -15, 2, 125, 2, -66, 3, 74, 0, 3, 0, 33, 64, 11, +2, 1, 3, 0, 60, 1, 3, 60, 0, 25, 4, -72, 1, 79, -79, 65, 24, 43, 78, 16, -12, 77, -3, 0, 47, +-3, 60, 16, 60, 49, 48, 1, 53, 51, 21, 1, -15, -51, 2, 125, -51, -51, -1, -1, -1, -3, 0, 0, 5, 89, +7, 23, 2, 38, 0, 36, 0, 0, 1, 7, 0, -39, 1, 82, 1, 95, 0, 21, 64, 10, 2, 1, 19, 12, 9, +104, 39, 2, 1, 19, -71, 2, 33, 0, 41, 0, 43, 1, 43, 0, -1, -1, 0, 74, -1, -24, 4, 28, 5, -72, +2, 38, 0, 68, 0, 0, 1, 7, 0, -39, 0, -11, 0, 0, 0, 25, 64, 12, 2, -49, 60, 1, 60, 28, 3, +104, 43, 2, 1, 60, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, -1, -3, -2, 96, 6, 12, +5, -70, 2, 38, 0, 36, 0, 0, 1, 7, 0, -34, 3, -97, 0, 10, 0, 22, 64, 12, 2, 1, 15, 4, 0, +72, 39, 2, 1, 15, 8, 41, -72, 1, 100, -123, 0, 43, 1, 43, -1, -1, 0, 74, -2, 111, 4, -12, 4, 62, +2, 38, 0, 68, 0, 0, 1, 7, 0, -34, 2, -121, 0, 25, 0, 18, 64, 12, 2, 1, 56, 39, 0, 72, 39, +2, 1, 56, 10, 41, 0, 43, 1, 43, -1, -1, 0, -98, 0, 0, 5, 90, 7, 38, 2, 38, 0, 39, 0, 0, +1, 7, 0, -33, 0, -15, 1, 100, 0, 45, 64, 21, 2, 30, 64, 19, 19, 6, 85, 30, 64, 15, 15, 6, 85, +30, 64, 12, 12, 6, 85, 30, 2, -72, -1, -10, -76, 72, 43, 2, 1, 33, -71, 2, 33, 0, 41, 0, 43, 1, +43, 43, 43, 43, 53, 0, 0, 3, 0, 71, -1, -24, 4, -18, 5, -70, 0, 10, 0, 28, 0, 40, 1, 52, 64, +48, 54, 39, 83, 31, 83, 39, 98, 31, 98, 39, 5, 53, 24, 54, 31, 2, 45, 33, 58, 13, 73, 13, 67, 23, +69, 30, 73, 40, 90, 13, 106, 13, 8, 45, 13, 35, 24, 2, 6, 10, 0, 12, 38, 32, 25, 28, 22, 6, -72, +2, 67, 64, 52, 0, 64, 1, 3, 64, 2, 2, 1, 0, 27, 26, 0, 38, 72, 22, 7, 28, 11, 10, 32, 72, +14, 11, 10, -111, 0, 0, 1, 3, 2, 64, 1, 49, 27, 27, 28, 35, 51, 11, 25, 26, 12, 26, 11, 37, 28, +18, 16, 16, 2, 85, 28, -72, -1, -12, 64, 23, 15, 15, 2, 85, 28, 6, 14, 14, 2, 85, 28, 24, 13, 13, +2, 85, 28, 11, 16, 16, 6, 85, 28, -72, -1, -8, -76, 15, 15, 6, 85, 28, -72, -1, -18, 64, 11, 13, 13, +6, 85, 28, 9, 12, 12, 6, 85, 28, -72, -1, -25, 64, 62, 11, 11, 6, 85, 16, 28, 64, 28, 96, 28, -128, +28, 4, 28, 116, 29, 36, 18, 30, 11, 11, 2, 85, 18, 24, 12, 12, 2, 85, 18, 30, 13, 13, 2, 85, 18, +10, 13, 13, 6, 85, 18, 34, 12, 12, 6, 85, 18, 7, 11, 11, 6, 85, 63, 18, 79, 18, 2, 18, 25, 41, +52, -71, 2, -106, 0, 24, 43, 78, 16, -12, 93, 43, 43, 43, 43, 43, 43, 77, -19, -3, 93, 43, 43, 43, 43, +43, 43, 43, 43, 43, -3, 60, 60, 16, 60, 16, -28, 16, 60, 16, -2, -3, 60, 16, 60, 77, 16, -28, 0, 63, +-19, 63, 60, 63, -19, 63, 60, 63, 60, 16, -19, 16, -19, -19, 17, 18, 57, 17, 18, 57, 1, 17, 18, 57, 49, +48, 0, 93, 93, 1, 93, 93, 1, 53, 51, 21, 20, 6, 7, 39, 54, 54, 55, 1, 53, 6, 35, 34, 38, 38, +53, 52, 18, 54, 51, 50, 22, 23, 17, 51, 17, 1, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 4, 54, +-72, 72, 78, 45, 51, 49, 2, -2, -88, 101, -60, 127, -43, 117, 106, -44, -125, 96, -106, 47, -77, -3, 32, -84, 117, +118, -91, -88, 123, 120, -95, 5, 1, -71, -71, 101, 125, 34, 68, 23, 87, 82, -6, -1, -122, -98, -116, -5, -93, -97, +1, 3, -118, 81, 65, 2, 14, -6, 70, 2, 18, -52, -54, -63, -58, -38, -52, -60, 0, 0, 2, -1, -3, 0, 0, +5, 90, 5, -70, 0, 19, 0, 37, 1, 3, 64, 46, 67, 8, 35, 3, 48, 36, 2, 2, 0, 32, 33, 30, 6, +5, 2, 21, 20, 30, 19, 0, 8, 36, 36, 38, 39, 27, 38, 13, 40, 16, 16, 2, 85, 13, 14, 15, 15, 2, +85, 13, 20, 13, 13, 2, 85, 13, -72, -1, -8, -76, 12, 12, 2, 85, 13, -72, -1, -8, -76, 11, 11, 2, 85, +13, -72, -1, -21, 64, 23, 12, 12, 6, 85, 0, 13, 1, 13, 26, 39, 33, 20, 32, 5, 2, 57, 0, 32, 16, +16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, +-76, 12, 12, 2, 85, 0, -72, -1, -9, -76, 12, 12, 6, 85, 0, -72, -1, -8, 64, 10, 13, 13, 6, 85, 0, +93, 38, 96, 91, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, -28, 60, -3, 60, 78, 16, -10, 93, 43, 43, 43, +43, 43, 43, 77, -19, 17, 18, 57, 47, 0, 63, 60, -3, 60, 63, 60, -3, 60, 18, 57, 47, 60, -3, 60, 49, +48, 67, 121, 64, 54, 7, 31, 11, 12, 10, 12, 9, 12, 8, 12, 4, 6, 29, 28, 30, 28, 2, 6, 15, 14, +16, 14, 17, 14, 3, 6, 25, 26, 24, 26, 23, 26, 3, 6, 31, 7, 27, 33, 1, 22, 18, 27, 33, 1, 28, +12, 32, 33, 1, 26, 14, 21, 33, 0, 43, 43, 1, 43, 43, 42, 42, 42, 42, -127, 51, 17, 35, 53, 51, 17, +33, 50, 23, 22, 23, 22, 18, 21, 20, 2, 6, 7, 6, 35, 37, 33, 50, 54, 55, 54, 54, 53, 52, 46, 2, +35, 33, 17, 33, 21, 33, -98, -95, -95, 1, -6, -86, 90, 126, 89, 116, 115, -114, -58, -127, 71, -113, -2, -79, 1, +57, -110, -92, 48, 69, 78, 77, 124, -104, -99, -2, -52, 1, -108, -2, 108, 2, -101, -124, 2, -101, 21, 29, 76, 98, +-2, -49, -60, -32, -2, -67, -110, 31, 17, -83, 54, 48, 69, -24, -89, -84, -50, 124, 48, -2, 18, -124, -1, -1, 0, +-94, -2, 86, 4, -24, 5, -70, 2, 38, 0, 40, 0, 0, 1, 7, 0, -34, 2, 120, 0, 0, 0, 18, 64, 12, +1, 1, 20, 11, 0, 72, 39, 1, 1, 12, 8, 41, 0, 43, 1, 43, -1, -1, 0, 75, -2, 86, 4, 30, 4, +62, 2, 38, 0, 72, 0, 0, 1, 7, 0, -34, 1, 61, 0, 0, 0, 39, 64, 18, 2, -112, 30, -49, 30, -33, +30, 3, 96, 30, -128, 30, 2, 80, 30, 1, 30, 19, -72, -1, -70, -74, 72, 43, 2, 1, 30, 10, 41, 0, 43, +1, 43, 93, 93, 93, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 7, 38, 2, 38, 0, 40, 0, 0, 1, 7, +0, -33, 1, 51, 1, 100, 0, 42, 64, 18, 1, 12, 64, 30, 32, 52, 0, 12, -81, 12, 2, 47, 12, 95, 12, +2, 12, 2, -72, -3, -1, -76, 72, 43, 1, 1, 16, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 43, 53, +-1, -1, 0, 75, -1, -24, 4, 30, 5, -62, 2, 38, 0, 72, 0, 0, 1, 7, 0, -33, 0, -32, 0, 0, 0, +21, 64, 10, 2, 1, 30, 10, 0, 72, 39, 2, 1, 33, -71, 2, 34, 0, 41, 0, 43, 1, 43, 0, -1, -1, +0, -106, 0, 0, 4, 42, 7, 44, 2, 38, 0, 47, 0, 0, 1, 7, 0, -115, 0, 82, 1, 106, 0, 21, 64, +10, 1, 1, 9, 2, 112, 72, 39, 1, 1, 9, -71, 2, 33, 0, 41, 0, 43, 1, 43, 0, -1, -1, 0, 66, +0, 0, 1, -77, 7, 29, 2, 38, 0, 79, 0, 0, 1, 7, 0, -115, -1, 100, 1, 91, 0, 60, -77, 1, 1, +1, 7, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 7, 7, 1, 2, 65, 43, 27, +-71, 0, 7, -1, -64, -77, 23, 25, 52, 7, -72, -1, -64, 64, 11, 34, 37, 52, 47, 7, 1, 7, 1, 90, 72, +43, 43, 93, 43, 43, 89, 53, 0, 2, 0, -106, 0, 0, 4, 42, 5, -70, 0, 10, 0, 16, 0, -99, -77, 6, +10, 0, 6, -72, 1, 81, 64, 51, 1, 3, 101, 2, 0, 101, 2, 1, 1, 13, 10, 81, 0, 0, 1, 3, 2, +10, 11, 16, 2, 85, 2, 101, 1, 1, 18, 13, 13, 12, 2, 15, 14, 30, 16, 11, 8, 15, 26, 18, 13, 14, +32, 12, 11, 36, 16, 16, 2, 85, 11, -72, -1, -14, -76, 15, 15, 2, 85, 11, -72, -1, -2, 64, 11, 13, 13, +2, 85, 11, 4, 16, 16, 6, 85, 11, -72, -1, -2, 64, 13, 12, 12, 6, 85, 32, 11, 1, 11, 25, 17, 59, +92, 24, 43, 78, 16, -12, 93, 43, 43, 43, 43, 43, 60, 77, -3, 60, 78, 16, -26, 0, 63, 60, 77, -3, 60, +63, 60, 1, 17, 18, 57, 47, -3, 43, 60, 16, 60, 16, -28, 0, 16, 60, 16, 60, -19, 16, -19, 16, -19, 1, +17, 18, 57, 49, 48, 1, 53, 51, 21, 20, 6, 7, 39, 54, 54, 55, 1, 17, 51, 17, 33, 21, 2, -56, -51, +80, 87, 50, 57, 55, 2, -3, 104, -62, 2, -46, 4, -19, -51, -51, 113, -117, 38, 77, 25, 97, 91, -5, 19, 5, +-70, -6, -13, -83, 0, 2, 0, -120, 0, 0, 2, 84, 5, -70, 0, 10, 0, 14, 0, -43, 64, 9, 47, 16, 1, +10, 3, 0, 7, -73, 6, -72, 2, 67, 64, 14, 1, 3, 64, 2, 0, 64, 2, 1, 0, 2, 3, 1, 0, 6, +-72, 2, 91, 64, 40, 7, 51, 0, 64, 3, 20, 11, 16, 2, 85, 31, 3, 1, 3, 73, 112, 16, -128, 16, 2, +-97, 16, -33, 16, 2, 79, 16, 1, 16, 13, 12, 0, 14, 11, 10, 13, 14, 37, 12, 11, -72, -1, -8, -76, 16, +16, 2, 85, 11, -72, -1, -6, 64, 17, 14, 14, 2, 85, 11, 4, 12, 12, 2, 85, 11, 10, 11, 11, 2, 85, +11, -72, -1, -14, -76, 11, 11, 6, 85, 11, -72, -1, -2, 64, 11, 15, 15, 6, 85, 11, 8, 16, 16, 6, 85, +11, -72, -1, -4, -76, 13, 13, 6, 85, 11, -72, -1, -7, 64, 15, 12, 12, 6, 85, 0, 11, 32, 11, 2, 11, +78, 15, 71, 102, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, 0, 63, 60, 63, +60, 1, 16, 113, 93, 93, -10, 93, 43, -3, -12, -28, 16, 60, 16, 60, 0, 63, 60, -19, 16, -19, 16, -3, -19, +1, 17, 18, 57, 49, 48, 1, 93, 1, 53, 51, 21, 20, 6, 7, 39, 54, 54, 55, 1, 17, 51, 17, 1, -100, +-72, 72, 78, 45, 51, 49, 2, -2, -111, -76, 5, 1, -71, -71, 101, 125, 34, 68, 23, 87, 82, -6, -1, 5, -70, +-6, 70, 0, -1, -1, 0, -106, 0, 0, 4, 42, 5, -70, 2, 38, 0, 47, 0, 0, 1, 7, 1, 1, 0, -28, +0, 0, 0, 41, -79, 1, 6, -72, -1, -64, -76, 12, 14, 52, 6, 4, -72, -2, -89, 64, 10, 72, 43, 1, 6, +64, 13, 17, 52, 6, 4, -72, 1, -48, -79, 72, 43, 0, 43, 43, 53, 1, 43, 43, 53, 0, -1, -1, 0, -125, +0, 0, 2, -92, 5, -70, 0, 38, 0, 79, 0, 0, 1, 6, 1, 1, -26, 0, 0, 29, 64, 14, 1, -113, 4, +-65, 4, 2, 4, 3, -107, 72, 43, 1, 4, 3, -72, 2, 125, -79, 72, 43, 0, 43, 53, 1, 43, 93, 53, 0, +-1, -1, 0, -100, 0, 0, 5, 31, 7, 44, 2, 38, 0, 49, 0, 0, 1, 7, 0, -115, 1, 92, 1, 106, 0, +64, -77, 1, 1, 1, 13, -70, 2, 33, 0, 41, 1, 100, -123, 0, 43, 1, -79, 6, 2, 67, 84, 88, -72, -1, +-20, -76, 13, 13, 2, 4, 65, 43, 27, 64, 17, 111, 13, 127, 13, 2, 0, 13, 1, -65, 13, -32, 13, -16, 13, +3, 13, 4, -72, -2, -107, -79, 72, 43, 43, 93, 113, 113, 89, 53, -1, -1, 0, -121, 0, 0, 3, -26, 5, -62, +2, 38, 0, 81, 0, 0, 1, 7, 0, -115, 0, -30, 0, 0, 0, 36, -76, 1, 63, 26, 1, 26, -72, -1, -64, +-76, 18, 20, 52, 26, 5, -72, -1, -38, -76, 72, 43, 1, 1, 26, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, +113, 53, -1, -1, 0, -100, 0, 0, 5, 31, 7, 44, 2, 38, 0, 49, 0, 0, 1, 7, 0, -33, 1, 119, 1, +106, 0, 25, 64, 10, 1, 0, 15, 12, 1, 5, 65, 1, 1, 13, -70, 2, 33, 0, 41, 1, 100, -123, 0, 43, +1, 43, 53, 0, -1, -1, 0, -121, 0, 0, 3, -26, 5, -62, 2, 38, 0, 81, 0, 0, 1, 7, 0, -33, 0, +-30, 0, 0, 0, 22, 64, 10, 1, 0, 28, 25, 1, 11, 65, 1, 1, 26, -71, 2, 34, 0, 41, 0, 43, 1, +43, 53, -1, -1, 0, 99, -1, -25, 5, -35, 7, 44, 2, 38, 0, 50, 0, 0, 1, 7, 0, -35, 1, -97, 1, +106, 0, 34, 64, 19, 3, 2, 0, 32, 32, 32, 2, -16, 32, 1, 32, 3, 86, 72, 43, 2, 3, 2, 35, -71, +2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 53, 53, -1, -1, 0, 68, -1, -24, 4, 39, 5, -62, 2, 38, 0, +82, 0, 0, 1, 7, 0, -35, 0, -31, 0, 0, 0, 38, -78, 3, 2, 30, -72, -1, -64, 64, 16, 15, 15, 6, +85, -113, 30, 1, 30, 4, 43, 72, 43, 2, 3, 2, 33, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 43, 53, +53, -1, -1, 0, -95, 0, 0, 5, -83, 7, 44, 2, 38, 0, 53, 0, 0, 1, 7, 0, -115, 1, 25, 1, 106, +0, 36, 64, 13, 2, 38, 64, 12, 17, 52, 38, 64, 19, 20, 52, 38, 2, -72, -1, 120, -76, 72, 43, 2, 1, +38, -71, 2, 33, 0, 41, 0, 43, 1, 43, 43, 43, 53, -1, -1, 0, -123, 0, 0, 2, -58, 5, -62, 2, 38, +0, 85, 0, 0, 1, 6, 0, -115, 20, 0, 0, 36, 64, 13, 1, -81, 21, -33, 21, 2, 21, 64, 11, 13, 52, +21, 6, -72, -1, 123, -76, 72, 43, 1, 1, 21, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, 93, 53, -1, -1, +0, -95, 0, 0, 5, -83, 7, 38, 2, 38, 0, 53, 0, 0, 1, 7, 0, -33, 1, 34, 1, 100, 0, 40, 64, +16, 2, 63, 35, 1, -17, 35, -1, 35, 2, 95, 35, -113, 35, 2, 35, 2, -72, -1, 107, -76, 72, 43, 2, 1, +38, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 93, 113, 53, -1, -1, 0, 60, 0, 0, 2, -58, 5, -62, 2, +38, 0, 85, 0, 0, 1, 6, 0, -33, 20, 0, 0, 29, -73, 1, 63, 18, 79, 18, 2, 18, 6, -72, -1, -106, +-76, 72, 43, 1, 1, 21, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, 92, -1, -25, 4, +-21, 7, 44, 2, 38, 0, 54, 0, 0, 1, 7, 0, -115, 1, 14, 1, 106, 0, 33, 64, 19, 1, 127, 52, -113, +52, 2, 79, 52, 95, 52, 2, 52, 22, 0, 72, 43, 1, 1, 52, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, +93, 53, 0, -1, -1, 0, 63, -1, -24, 3, -79, 5, -62, 2, 38, 0, 86, 0, 0, 1, 7, 0, -115, 0, -84, +0, 0, 0, 37, 64, 22, 1, -49, 52, -33, 52, 2, 47, 52, 95, 52, 2, 79, 52, 1, 52, 21, 0, 72, 43, +1, 1, 52, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 93, 93, 53, 0, 0, 2, 0, 48, -3, -67, 4, -70, +5, -70, 0, 7, 0, 18, 0, -54, -77, 13, 18, 8, 14, -70, 1, 49, 0, 13, 1, 73, 64, 13, 9, 11, 101, +10, 18, 8, 101, 9, 9, 0, 10, 1, 10, -72, 2, -71, 64, 20, 7, 18, 81, 8, 8, 9, 101, 10, 45, 7, +5, 2, 30, 4, 3, 2, 7, 0, 8, 20, -72, 2, 115, -75, 6, 5, 32, 4, 1, 4, -72, 1, 1, -73, 6, +32, 1, 2, 47, 3, 1, 3, -72, 1, 1, -76, 1, 7, 32, 1, 0, -72, -1, -24, 64, 11, 16, 16, 2, 85, +0, 8, 15, 15, 2, 85, 0, -72, -1, -14, -76, 12, 12, 2, 85, 0, -72, -1, -30, -76, 13, 13, 2, 85, 0, +-72, -1, -4, -76, 12, 12, 6, 85, 0, -72, -1, -2, -73, 13, 13, 6, 85, 32, 0, 1, 0, -72, 2, 115, -77, +19, -74, -103, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, 43, 60, -19, 16, -12, 93, 60, 16, -3, -12, 93, 60, +16, -26, 0, 63, 60, 63, 60, -3, 60, 1, 16, -12, -3, 60, 16, -28, 0, 16, -10, 93, 60, 16, -3, 60, 16, +-19, 16, -3, -19, 1, 17, 18, 57, 49, 48, 33, 17, 33, 53, 33, 21, 33, 17, 3, 53, 51, 21, 20, 7, 39, +54, 55, 54, 55, 2, 19, -2, 29, 4, -118, -2, 27, -54, -51, -89, 50, 60, 30, 20, 4, 5, 13, -83, -83, -6, +-13, -2, -70, -51, -51, -76, 73, 76, 27, 51, 33, 66, 0, 2, 0, 36, -3, -20, 2, 42, 5, -103, 0, 23, 0, +33, 1, 4, 64, 21, 33, 33, 47, 35, 49, 33, 3, 0, 1, 13, 12, 10, 30, 33, 24, 1, 3, 0, 9, 22, +30, -72, 1, 73, 64, 12, 25, 27, 64, 26, 24, 64, 25, 25, 0, 26, 1, 26, -72, 2, -74, 64, 47, 3, 33, +-111, 24, 27, 26, 24, 25, 64, 26, 26, 1, 7, 16, 9, 43, 15, 10, 6, 22, 28, 3, 11, 15, 16, 35, 73, +16, 34, 0, 34, -97, 1, 1, 1, 13, 18, 37, 12, 1, -1, 7, 8, 69, 9, 69, 7, -72, -1, -22, -76, 16, +16, 2, 85, 7, -72, -1, -16, -76, 15, 15, 2, 85, 7, -72, -1, -22, -76, 14, 14, 2, 85, 7, -72, -1, -12, +-76, 12, 13, 2, 85, 7, -72, -1, -4, -76, 11, 11, 2, 85, 7, -72, -1, -8, -76, 16, 16, 6, 85, 7, -72, +-1, -20, 64, 24, 15, 15, 6, 85, 7, 2, 12, 12, 6, 85, 7, 13, 13, 13, 6, 85, 0, 7, 32, 7, -112, +7, 3, 7, -70, 2, 48, 0, 34, 1, 54, -79, -60, 24, 43, 16, -12, 93, 43, 43, 43, 43, 43, 43, 43, 43, +43, -12, -28, 16, -19, 60, -3, 60, 16, 93, -28, -28, -26, 16, 60, 0, 63, -19, 63, 60, -3, 60, 1, 17, 18, +57, 47, -3, 60, 16, 60, 16, -28, 0, 16, -10, 93, 60, 16, -19, 16, -19, 16, -19, 17, 18, 57, 18, 57, 1, +17, 18, 57, 0, 17, 51, 51, 16, -55, 49, 48, 1, 93, 37, 23, 6, 35, 34, 38, 38, 53, 17, 35, 53, 51, +17, 55, 17, 51, 21, 35, 17, 20, 22, 22, 51, 50, 3, 53, 51, 21, 20, 6, 7, 39, 54, 55, 2, 16, 26, +76, 60, 98, 108, 44, -124, -124, -77, -75, -75, 19, 43, 40, 30, -52, -71, 73, 78, 44, 95, 7, -95, -97, 16, 62, +101, -94, 2, 99, -116, 1, 7, 108, -2, -115, -116, -3, -109, 77, 44, 26, -2, 53, -72, -72, 70, 123, 34, 69, 42, +116, -1, -1, 0, 48, 0, 0, 4, -70, 7, 38, 2, 38, 0, 55, 0, 0, 1, 7, 0, -33, 1, 15, 1, 100, +0, 53, -77, 1, 1, 1, 11, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 12, 11, +1, 6, 65, 43, 27, 64, 12, 8, 64, 37, 39, 52, 8, 64, 13, 17, 52, 8, 6, -72, -1, -83, -79, 72, 43, +43, 43, 43, 89, 53, 0, 0, 2, 0, 35, -1, -14, 2, -3, 5, -70, 0, 10, 0, 34, 0, -16, 64, 42, 111, +5, 108, 7, 127, 7, -114, 7, 4, 96, 1, 96, 6, 96, 7, 112, 1, 112, 4, 114, 7, -128, 1, -128, 4, 8, +0, 23, 24, 21, 6, 10, 0, 11, 13, 27, 12, 14, 11, 20, 33, 7, -72, 2, 45, 64, 36, 1, 7, -73, 6, +0, 64, 2, 2, 1, 0, 7, 51, 1, 10, -111, 0, 64, 1, 64, 2, 26, 36, 27, 20, 43, 26, 21, 6, 33, +28, 14, 11, 26, 12, 34, 27, -72, 2, 48, -74, 24, 29, 37, 23, 20, 69, 18, -72, -1, -14, -76, 16, 16, 2, +85, 18, -72, -1, -10, -76, 14, 15, 2, 85, 18, -72, -1, -4, -76, 12, 12, 2, 85, 18, -72, -1, -20, -76, 16, +16, 6, 85, 18, -72, -1, -24, -76, 15, 15, 6, 85, 18, -72, -1, -10, -76, 13, 13, 6, 85, 18, -72, -1, -12, +64, 10, 12, 12, 6, 85, 0, 18, 1, 18, 25, 35, -72, 1, 54, -79, 102, 24, 43, 78, 16, -12, 93, 43, 43, +43, 43, 43, 43, 43, 77, -28, 60, -3, 60, -12, -28, 60, 0, 63, -19, 63, 60, -3, 60, 1, 78, 16, -10, 77, +-19, -3, -28, 16, -28, 0, 63, 60, 16, -19, 16, -19, 16, -28, 17, 18, 57, 18, 57, 1, 17, 18, 57, 17, 18, +57, 0, 17, 51, 51, -55, 49, 48, 1, 93, 0, 93, 1, 53, 51, 21, 20, 6, 7, 39, 54, 54, 55, 3, 23, +6, 35, 34, 38, 38, 53, 17, 35, 53, 51, 17, 55, 17, 51, 21, 35, 17, 20, 22, 22, 51, 50, 2, 69, -72, +72, 78, 45, 51, 49, 2, -111, 26, 76, 60, 98, 108, 44, -124, -124, -77, -75, -75, 19, 43, 40, 30, 5, 1, -71, +-71, 101, 125, 34, 68, 23, 87, 82, -5, -96, -97, 16, 62, 101, -94, 2, 99, -116, 1, 7, 108, -2, -115, -116, -3, +-109, 77, 44, 26, -1, -1, 0, -95, -1, -25, 5, 34, 7, 43, 2, 38, 0, 56, 0, 0, 1, 7, 0, -37, 1, +-118, 1, 62, 0, 59, 64, 15, 2, 1, 24, -128, 58, 60, 52, -81, 24, -65, 24, -1, 24, 3, 24, -72, 3, 23, +0, 125, 63, 114, 43, 24, 53, 53, 1, -79, 6, 2, 67, 84, 88, -73, 2, 1, 0, 21, 27, 12, 0, 65, 43, +53, 53, 27, -73, 1, 2, 2, 30, 6, 0, 104, 39, 43, 89, 0, -1, -1, 0, -125, -1, -24, 3, -32, 5, -19, +2, 38, 0, 88, 0, 0, 1, 7, 0, -37, 0, -36, 0, 0, 0, 25, 64, 12, 2, 1, 0, 25, 31, 17, 17, +65, 1, 2, 2, 34, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, 53, 0, -1, -1, 0, -95, -1, -25, 5, 34, +7, 44, 2, 38, 0, 56, 0, 0, 1, 7, 0, -35, 1, -105, 1, 106, 0, 51, -75, 2, 1, 1, 2, 2, 28, +-71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -72, -1, -23, -76, 21, 28, 12, 0, 65, 43, 27, +64, 11, -64, 25, 1, 96, 25, 1, 25, 17, 85, 72, 43, 43, 93, 93, 89, 53, 53, 0, -1, -1, 0, -125, -1, +-24, 3, -32, 5, -62, 2, 38, 0, 88, 0, 0, 1, 7, 0, -35, 0, -76, 0, 0, 0, 49, -75, 2, 1, 1, +2, 2, 32, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 28, 32, 11, 22, 65, 43, +27, -71, 0, 29, -1, -64, -73, 18, 20, 52, 29, 17, 100, 72, 43, 43, 43, 89, 53, 52, 0, -1, -1, 0, 41, +0, 0, 4, -80, 7, 44, 2, 38, 0, 61, 0, 0, 1, 7, 0, -115, 0, -5, 1, 106, 0, 40, 64, 16, 1, +-49, 16, -33, 16, 2, -81, 16, 1, 16, 64, 11, 15, 52, 16, 2, -72, -1, 89, -76, 72, 43, 1, 1, 16, -71, +2, 33, 0, 41, 0, 43, 1, 43, 43, 93, 93, 53, -1, -1, 0, 40, 0, 0, 3, -44, 5, -62, 2, 38, 0, +93, 0, 0, 1, 7, 0, -115, 0, -87, 0, 0, 0, 30, -75, 1, 79, 18, 1, 18, 7, -72, -2, 105, -76, 72, +43, 1, 1, 18, -70, 2, 34, 0, 41, 1, 100, -123, 0, 43, 1, 43, 93, 53, -1, -1, 0, 41, 0, 0, 4, +-80, 6, -12, 2, 38, 0, 61, 0, 0, 1, 7, 0, -38, 1, 48, 1, 106, 0, 27, -75, 1, -49, 13, 1, 13, +2, -72, -1, 17, -76, 72, 43, 1, 1, 13, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, +40, 0, 0, 3, -44, 5, -118, 2, 38, 0, 93, 0, 0, 1, 7, 0, -38, 0, -87, 0, 0, 0, 46, 64, 19, +1, 15, 64, 11, 11, 6, 85, 31, 15, 47, 15, 2, -17, 15, -1, 15, 2, 15, 4, -72, -1, -95, -76, 72, 43, +1, 1, 15, -70, 2, 34, 0, 41, 1, 100, -123, 0, 43, 1, 43, 93, 113, 43, 53, 0, 1, 0, -92, 0, 0, +4, 56, 5, -70, 0, 5, 0, -125, 64, 28, 2, 3, 30, 1, 0, 2, 5, 8, 16, 1, 32, 1, 2, 1, 26, +7, 3, 4, 32, 5, 5, 0, 36, 16, 16, 2, 85, 0, -72, -1, -14, -76, 15, 15, 2, 85, 0, -72, -1, -22, +-76, 13, 13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -3, -76, 16, 16, 6, 85, 0, -72, +-1, -13, -76, 15, 15, 6, 85, 0, -72, -1, -22, -76, 13, 13, 6, 85, 0, -72, -1, -12, -73, 12, 12, 6, 85, +0, 25, 6, 59, -71, 1, -114, 0, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 43, 60, 77, 16, -3, +60, 78, 16, -26, 93, 0, 63, 63, 60, 77, -3, 60, 49, 48, 19, 33, 21, 33, 17, 35, -92, 3, -108, -3, 46, +-62, 5, -70, -83, -6, -13, 0, 3, 0, 96, -1, -25, 5, -38, 5, -44, 0, 12, 0, 24, 0, 28, 1, 40, 64, +105, 108, 8, 109, 10, 108, 15, 106, 17, 99, 21, 99, 23, 6, 16, 14, 16, 18, 31, 20, 31, 24, 99, 2, 99, +4, 6, 106, 14, 99, 18, 100, 20, 107, 24, -104, 2, -106, 4, 6, 31, 21, 16, 23, 109, 1, 98, 5, 99, 7, +106, 11, 111, 12, 7, 16, 2, 31, 4, 31, 8, 18, 10, 16, 15, 31, 17, 32, 30, 7, 58, 8, 27, 30, 79, +25, 95, 25, 127, 25, -113, 25, 4, -17, 25, 1, 25, 25, 9, 22, 30, 3, 3, 16, 30, 9, 9, 28, 101, 19, +25, 101, 13, 19, 38, 6, -72, -1, -24, -76, 16, 16, 2, 85, 6, -72, -1, -18, -76, 13, 13, 2, 85, 6, -72, +-1, -16, -76, 12, 12, 2, 85, 6, -72, -1, -7, -76, 11, 11, 6, 85, 6, -72, -1, -12, -76, 13, 13, 6, 85, +6, -72, -1, -6, 64, 38, 12, 12, 6, 85, 32, 6, -128, 6, 2, -128, 30, 1, 6, 26, 30, 13, 38, 0, 6, +11, 11, 6, 85, 0, 6, 12, 12, 6, 85, 32, 0, 1, 0, 25, 29, 99, 92, 24, 43, 16, -10, 93, 43, 43, +-19, 16, -10, 93, 93, 43, 43, 43, 43, 43, 43, -19, 16, -26, 16, -26, 0, 63, -19, 63, -19, 18, 57, 47, 113, +93, -19, 49, 48, 67, 121, 64, 44, 1, 24, 11, 37, 17, 8, 19, 33, 1, 15, 10, 13, 33, 0, 21, 4, 19, +33, 1, 23, 2, 13, 33, 0, 18, 7, 16, 33, 0, 14, 12, 16, 33, 0, 20, 5, 22, 33, 1, 24, 1, 22, +33, 1, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, -127, 1, 93, 93, 93, 0, 93, 93, 19, 16, 0, 33, 32, +0, 17, 16, 0, 33, 34, 36, 2, 55, 20, 0, 51, 50, 0, 17, 16, 0, 35, 34, 0, 19, 53, 33, 21, 96, +1, -118, 1, 52, 1, 53, 1, -121, -2, 118, -2, -51, -35, -2, -77, -109, -56, 1, 16, -28, -32, 1, 22, -2, -24, +-37, -41, -2, -32, -45, 2, 68, 2, -54, 1, 110, 1, -100, -2, 93, -2, -86, -2, -84, -2, 96, -35, 1, 91, -88, +-5, -2, -63, 1, 59, 1, 20, 1, 24, 1, 57, -2, -38, -2, -128, -84, -84, 0, 0, 3, 0, 85, -1, -53, 6, +13, 5, -26, 0, 18, 0, 25, 0, 32, 1, 84, 64, 96, 32, 34, 58, 3, 58, 7, 53, 12, 53, 16, 53, 20, +52, 24, 60, 27, 58, 31, 68, 3, 68, 7, 73, 17, 96, 34, 112, 34, -124, 21, -118, 30, -97, 34, -96, 34, -65, +34, -16, 34, 20, 0, 34, 56, 3, 2, 41, 21, 38, 23, 38, 28, 40, 30, 56, 6, 104, 4, 105, 21, 101, 23, +101, 28, 105, 30, 118, 4, 121, 6, 121, 13, 118, 16, -120, 4, -120, 20, -123, 23, -123, 28, -120, 30, 19, 57, 3, +1, 32, 19, 8, 11, 26, 25, 30, 11, -72, 1, 58, 64, 38, 10, 19, 30, 18, 112, 2, -128, 2, 2, 2, -94, +0, 3, 10, 9, 26, 9, 19, 10, 1, -112, 9, 1, 64, 9, 80, 9, 96, 9, 112, 9, -128, 9, 5, 9, 32, +0, 10, -72, -1, -4, 64, 13, 12, 12, 6, 85, 127, 10, 1, 10, 10, 14, 29, 38, 5, -72, -1, -12, 64, 58, +15, 16, 6, 85, 5, 42, 13, 13, 6, 85, 5, 26, 11, 12, 6, 85, 0, 5, 96, 5, 2, 32, 5, 96, 5, +112, 5, -97, 5, -96, 5, -65, 5, -16, 5, 7, 5, 26, 34, 0, 34, 16, 34, 64, 34, 3, 16, 34, 48, 34, +64, 34, -80, 34, -64, 34, 5, 34, -72, -1, -64, 64, 12, 16, 18, 52, 22, 38, 14, 18, 16, 16, 2, 85, 14, +-72, -1, -22, 64, 11, 13, 13, 2, 85, 14, 8, 15, 16, 6, 85, 14, -72, -1, -42, -76, 13, 13, 6, 85, 14, +-72, -1, -24, 64, 13, 11, 12, 6, 85, 32, 14, 1, 14, 25, 33, 99, 92, 24, 43, 16, -10, 93, 43, 43, 43, +43, 43, -19, 43, 93, 113, 16, -10, 93, 113, 43, 43, 43, -19, 18, 57, 47, 113, 43, 60, -3, 113, 114, 60, 16, +60, 16, 60, 0, 63, 63, -12, 93, 60, -19, 16, -12, -3, 60, 16, 60, 16, 60, 49, 48, 0, 113, 93, 1, 113, +93, 1, 51, 21, 4, 0, 21, 16, 0, 5, 21, 35, 53, 36, 0, 53, 52, 18, 36, 55, 21, 6, 6, 21, 20, +22, 23, 51, 54, 54, 53, 52, 38, 35, 2, -48, -62, 1, 52, 1, 71, -2, -98, -2, -25, -62, -2, -33, -2, -90, +-106, 1, 18, -45, -50, -29, -8, -71, -62, -51, -24, -34, -41, 5, -26, -75, 19, -2, -66, -17, -2, -12, -2, -54, 10, +-42, -42, 11, 1, 63, -7, -93, 1, 8, -104, 10, -88, 6, -42, -56, -54, -46, 3, 6, -38, -62, -72, -23, 0, 0, +2, 0, 72, -1, -24, 4, 83, 4, 62, 0, 20, 0, 32, 1, 20, 64, 80, 6, 9, 6, 18, 16, 34, 55, 2, +71, 2, 86, 2, 86, 4, 118, 9, 117, 18, -122, 9, 10, 8, 7, 1, 73, 23, 70, 25, 70, 29, 73, 31, 91, +23, 84, 25, 84, 29, 91, 31, 104, 9, 104, 11, 103, 15, 121, 9, -9, 28, 13, 24, 19, 1, 37, 29, 42, 31, +53, 29, 58, 31, 4, 111, 8, 96, 19, 2, 19, 8, 3, 30, 4, 16, 6, 0, 6, 6, 10, 27, -72, 2, -102, +-78, 10, 11, 21, -72, 2, -102, -75, 16, 7, 8, 19, 0, 3, -72, -1, -10, -76, 16, 17, 2, 85, 3, -72, -1, +-16, -76, 16, 17, 6, 85, 3, -72, -1, -16, -73, 13, 13, 6, 85, 3, 107, 64, 30, -72, -1, -24, -76, 13, 17, +2, 85, 30, -72, -1, -20, -76, 11, 11, 2, 85, 30, -72, -1, -18, 64, 71, 13, 13, 6, 85, -112, 30, 1, 31, +30, -16, 30, 2, 30, 66, 5, -128, 0, -83, 1, 1, 6, -83, 5, 55, 34, 24, 64, 13, 8, 14, 15, 2, 85, +13, 28, 12, 13, 2, 85, 13, 12, 16, 16, 6, 85, 13, 18, 13, 13, 6, 85, 13, 37, 12, 12, 6, 85, 13, +23, 11, 11, 6, 85, 63, 13, 79, 13, 2, 13, 52, 33, 16, -10, 93, 43, 43, 43, 43, 43, 43, -19, 16, -10, +-19, 60, 16, -19, 26, 16, -3, 113, 93, 43, 43, 43, 26, -19, 43, 43, 43, 17, 51, 51, 0, 63, -19, 63, -19, +63, 63, 17, 18, 23, 57, 93, 49, 48, 0, 113, 114, 93, 1, 113, 93, 1, 51, 6, 3, 18, 23, 35, 38, 39, +6, 33, 34, 2, 17, 16, 18, 51, 50, 22, 23, 54, 37, 34, 6, 21, 20, 22, 51, 50, 54, 53, 52, 38, 3, +-101, -72, 70, 59, 70, 59, -77, 43, 22, 83, -2, -8, -56, -12, -11, -54, 125, -98, 68, 7, -2, -72, -127, -106, -114, +127, 124, -90, -101, 4, 38, -36, -2, -55, -2, 126, -111, 100, 94, -38, 1, 44, 1, 1, 1, 8, 1, 33, 101, 103, +35, 20, -48, -60, -65, -38, -41, -54, -60, -56, 0, 2, 0, 72, -1, -24, 4, 44, 5, -70, 0, 19, 0, 31, 1, +-122, 64, -127, 59, 18, 1, 88, 10, 90, 12, 85, 15, 104, 10, 104, 12, 120, 31, 6, 69, 25, 74, 27, 74, 31, +85, 6, 90, 9, 5, 39, 21, 40, 31, 55, 21, 56, 31, 69, 21, 5, -58, 3, 1, 51, 22, 57, 24, 57, 28, +51, 30, 91, 28, -114, 19, -121, 31, -103, 3, -88, 18, -72, 18, -42, 21, -38, 25, -36, 28, -42, 31, -25, 12, -25, +22, -9, 12, -9, 22, 18, 107, 6, 111, 10, 99, 12, 96, 16, 99, 22, 111, 24, 111, 28, 96, 30, 126, 19, 9, +95, 6, 95, 10, 80, 12, 80, 16, 80, 22, 95, 24, 90, 28, 80, 30, 8, 6, 3, 21, 3, 43, 17, 107, 12, +106, 16, 5, 19, 2, 0, 29, -72, 2, -102, -75, 5, 17, 7, 17, 2, 23, -72, 2, -102, -78, 11, 11, 2, -72, +2, -102, 64, 51, 0, 0, 123, 3, -117, 3, 2, 3, 1, 0, 48, 17, 64, 17, 2, 91, 17, 107, 17, 127, 17, +-113, 17, 4, 5, 17, 8, 14, 64, 0, 1, 0, 0, 14, 1, 1, 26, 64, 33, 64, 13, 13, 2, 85, 33, 64, +11, 11, 2, 85, 8, -72, -1, -22, 64, 17, 15, 15, 2, 85, 8, 24, 13, 13, 2, 85, 8, 16, 11, 11, 2, +85, 8, -72, -1, -16, -76, 15, 15, 6, 85, 8, -72, -1, -15, -76, 11, 13, 6, 85, 8, -72, -1, -64, 64, 74, +36, 37, 52, 48, 8, 1, 0, 8, 16, 8, 32, 8, 3, 8, 49, 33, 20, 64, 14, 12, 14, 15, 2, 85, 14, +18, 13, 13, 2, 85, 14, 12, 12, 12, 2, 85, 14, 28, 11, 11, 2, 85, 14, 12, 16, 16, 6, 85, 14, 13, +13, 13, 6, 85, 14, 22, 12, 12, 6, 85, 14, 13, 11, 11, 6, 85, 31, 14, 63, 14, 2, 14, 49, 32, 16, +-10, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, -10, 93, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, 51, +47, 17, 51, 47, 93, 17, 18, 57, 57, 93, 114, 17, 18, 57, 93, 0, 63, -19, 63, -19, 17, 51, 63, 51, -19, +17, 18, 57, 49, 48, 1, 113, 93, 93, 93, 114, 0, 93, 93, 93, 113, 19, 33, 21, 33, 22, 23, 22, 22, 21, +16, 0, 35, 34, 2, 53, 16, 0, 55, 38, 39, 19, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, -82, 3, +33, -3, -48, 100, -43, -66, -106, -2, -23, -32, -11, -8, 1, 6, -74, 93, -7, 82, -77, -117, 122, -69, -78, -121, -107, +-91, 5, -70, -110, 102, -109, -124, -30, -63, -2, -3, -2, -29, 1, 64, -36, 1, 0, 1, 13, 7, 65, -33, -4, -54, +-86, -36, -68, -53, -68, -50, -24, 0, 0, 1, 0, 98, -1, -24, 3, 99, 4, 62, 0, 36, 0, -24, 64, 55, 31, +38, 95, 38, 125, 2, 125, 21, -119, 1, -117, 2, -125, 8, -124, 15, -117, 21, -119, 22, -78, 4, -78, 15, -61, 4, +-62, 15, 14, -128, 38, 1, 38, 33, 57, 26, 54, 34, 117, 7, 121, 16, -76, 5, -74, 33, -60, 5, -58, 33, 9, +30, 12, 23, 22, -72, -1, -64, 64, 14, 9, 12, 52, 22, 22, 20, 0, 63, 1, 1, 1, 1, 3, 11, -72, 2, +-102, 64, 9, 112, 12, -65, 12, 2, 12, 12, 25, 3, -72, 2, -102, -78, 35, 7, 20, -72, 2, -102, 64, 43, 25, +11, 30, 6, 28, 12, 12, 23, 28, 1, 0, 22, 23, 6, 64, 32, 64, 26, 34, 52, 32, 32, 28, 16, 0, 1, +0, 0, 0, 23, 32, 23, 96, 23, -128, 23, 4, 23, -86, 38, 17, 64, 28, -72, -1, -8, 64, 24, 15, 15, 6, +85, 28, 16, 12, 12, 6, 85, 28, 22, 11, 11, 6, 85, 31, 28, 79, 28, 2, 28, 52, 37, 16, -10, 93, 43, +43, 43, -19, 16, -10, 93, 50, 47, 113, 17, 51, 47, 43, -19, 17, 51, 17, 51, 17, 18, 57, 47, 17, 18, 57, +0, 63, -19, 63, -19, 18, 57, 47, 113, -19, 17, 51, 47, 93, 51, 17, 51, 47, 43, 51, 17, 57, 49, 48, 0, +93, 1, 113, 93, 1, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 55, 21, 38, 35, 34, 6, 21, 20, 22, 51, +50, 55, 23, 6, 35, 34, 38, 53, 52, 55, 38, 53, 52, 54, 51, 50, 3, 61, -127, 123, 107, 88, 81, 120, 116, +15, 35, 32, 16, -113, 111, 112, 77, -115, 123, -127, -96, -18, -69, -72, -80, -109, -82, -76, -50, 3, -82, 104, 93, 94, +54, 70, 93, 1, -105, 1, 110, 69, 71, 97, -125, 109, -86, -66, 126, -75, 76, 83, -110, 119, -67, 0, 2, 0, 68, +-1, -24, 4, -61, 4, 62, 0, 15, 0, 27, 1, 36, 64, 61, 54, 17, 54, 21, 57, 23, 57, 27, 69, 17, 69, +21, 73, 23, 73, 27, 83, 2, 88, 5, 84, 8, 82, 17, 84, 21, 94, 23, 101, 2, 106, 5, 100, 8, 100, 17, +100, 21, 109, 23, 20, 15, 2, 2, 10, 4, 22, 28, 7, 11, 1, 28, 15, 6, 16, 28, 13, 7, 25, 36, 4, +-72, -1, -22, -76, 14, 14, 2, 85, 4, -72, -1, -22, -76, 10, 12, 2, 85, 4, -72, -1, -17, -76, 16, 16, 6, +85, 4, -72, -1, -32, -76, 15, 15, 6, 85, 4, -72, -1, -43, -76, 13, 13, 6, 85, 4, -72, -1, -15, -76, 12, +12, 6, 85, 4, -72, -1, -28, 64, 33, 11, 11, 6, 85, 80, 4, 96, 4, 112, 4, -128, 4, 4, 16, 4, 48, +4, 64, 4, 80, 4, 96, 4, 112, 4, -128, 4, -112, 4, -80, 4, 9, 4, -72, 1, -49, 64, 50, 10, 63, 0, +1, 15, 0, -113, 0, 2, 0, -86, 29, 19, 36, 10, 64, 36, 37, 52, 10, 12, 14, 15, 2, 85, 10, 18, 13, +13, 2, 85, 10, 12, 12, 12, 2, 85, 10, 28, 11, 11, 2, 85, 10, 12, 16, 16, 6, 85, 10, -72, -1, -1, +64, 30, 15, 15, 6, 85, 10, 12, 13, 13, 6, 85, 10, 30, 12, 12, 6, 85, 10, 10, 11, 11, 6, 85, 31, +10, 63, 10, 2, 10, 49, 28, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, -26, 113, 93, +16, -3, 93, 113, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, -19, 63, -19, 63, -19, 1, 17, 18, 57, 17, 51, +49, 48, 1, 93, 1, 21, 33, 22, 17, 16, 0, 35, 34, 0, 17, 16, 0, 51, 50, 23, 7, 34, 6, 21, 20, +22, 51, 50, 54, 53, 52, 38, 4, -61, -2, -33, -123, -2, -35, -48, -40, -2, -24, 1, 35, -51, 75, 95, -83, -125, +-79, -83, -118, -111, -85, -99, 4, 38, -110, 124, -2, -6, -2, -29, -2, -13, 1, 24, 1, 19, 1, 27, 1, 16, 24, +125, -52, -53, -54, -52, -43, -62, -79, -27, 0, 1, 0, 46, 0, 0, 2, -6, 4, 38, 0, 7, 0, -67, 64, 29, +16, 9, 80, 9, 96, 9, 112, 9, -128, 9, -97, 9, -48, 9, 7, 79, 9, 1, 2, 10, 7, 4, 28, 5, 6, +127, 7, 1, 7, -72, 1, 15, -76, 1, 112, 4, 1, 4, -72, 1, 15, -78, 1, 37, 2, -72, -1, -32, -76, 16, +16, 2, 85, 2, -72, -1, -12, -76, 13, 13, 2, 85, 2, -72, -1, -2, -76, 12, 12, 2, 85, 2, -72, -1, -28, +-76, 11, 11, 2, 85, 2, -72, -1, -20, 64, 11, 10, 10, 2, 85, 2, 8, 16, 16, 6, 85, 2, -72, -1, -8, +-76, 13, 13, 6, 85, 2, -72, -1, -10, 64, 45, 12, 12, 6, 85, 16, 2, 32, 2, 112, 2, -128, 2, -48, 2, +-32, 2, -16, 2, 7, 64, 2, -96, 2, -80, 2, 3, 0, 2, 112, 2, -128, 2, -48, 2, -32, 2, -16, 2, 6, +9, 0, 2, 1, 74, 2, 47, 94, 93, 94, 114, 113, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, -28, 93, 16, +-28, 93, 0, 63, -3, 60, 63, 49, 48, 1, 113, 93, 1, 17, 35, 17, 33, 53, 33, 21, 1, -6, -76, -2, -24, +2, -52, 3, -108, -4, 108, 3, -108, -110, -110, 0, 2, 0, 72, -2, 105, 4, -23, 4, 63, 0, 27, 0, 37, 1, +30, 64, 68, 64, 39, 1, 35, 5, 35, 23, 40, 24, 56, 29, 72, 29, 115, 12, 122, 23, -118, 9, -116, 23, -76, +5, -9, 2, 11, 82, 13, 102, 4, 103, 5, 98, 13, 103, 27, -104, 23, -88, 23, -57, 13, -54, 18, -54, 23, -54, +24, 11, 28, 51, 6, 28, 19, 22, 11, 21, 1, 28, 0, 34, 28, 11, 7, 0, 7, 1, 0, -72, -1, -64, 64, +21, 9, 14, 52, 0, 0, 25, 28, 20, 6, 79, 21, 1, 21, 37, 20, 6, 16, 16, 2, 85, 20, -72, -1, -12, +-76, 15, 15, 2, 85, 20, -72, -1, -4, 64, 24, 15, 15, 6, 85, 20, 6, 12, 12, 6, 85, 20, 64, 11, 13, +52, -65, 20, 1, 20, 20, 25, 31, 36, 15, -72, -1, -10, -76, 15, 15, 6, 85, 15, -72, -1, -15, -76, 13, 13, +6, 85, 15, -72, -1, -18, -76, 12, 12, 6, 85, 15, -72, -1, -14, 64, 28, 11, 11, 6, 85, 64, 15, 1, 0, +15, 16, 15, 32, 15, 48, 15, 4, 15, 49, 39, 3, 36, 25, 16, 16, 16, 6, 85, 25, -72, -1, -4, 64, 31, +15, 15, 6, 85, 25, 18, 13, 13, 6, 85, 25, 23, 12, 12, 6, 85, 25, 14, 11, 11, 6, 85, 63, 25, 1, +25, 49, 38, 52, 55, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, -19, 16, -10, 93, 113, 43, 43, 43, 43, -19, +18, 57, 47, 93, 43, 43, 43, 43, 43, -3, 113, 60, 16, 60, 17, 57, 47, 43, 51, 0, 63, 63, -19, 16, -19, +47, 63, 60, -3, -28, 49, 48, 0, 93, 1, 93, 113, 1, 7, 6, 17, 20, 22, 23, 17, 52, 54, 54, 51, 50, +22, 22, 21, 20, 6, 6, 7, 17, 35, 17, 34, 0, 17, 52, 0, 1, 54, 54, 53, 52, 38, 35, 34, 6, 21, +1, -13, 35, -49, -93, -94, 30, 107, 92, -113, -77, 124, 98, -36, -77, -78, -70, -2, -68, 1, 3, 1, -83, 127, -75, +-124, 74, 53, 49, 4, 59, -100, 69, -2, -37, -101, -13, 35, 2, -108, 106, 115, 73, 116, -6, -112, 120, -15, -54, 38, +-2, -126, 1, 126, 1, 70, 1, 0, -19, 1, 37, -4, 77, 23, -18, -63, -77, -92, 73, 124, 0, 2, -1, -31, -3, +103, 4, -118, -2, -21, 0, 3, 0, 7, 0, 67, -74, 2, 1, 63, 3, 0, 6, 0, -72, 2, -97, 64, 24, 5, +7, 5, 63, 4, 7, 6, 6, 3, 3, 2, 26, 9, 4, 5, 5, 0, 0, 1, -59, 8, 67, 65, 24, 43, 16, +-11, 60, 16, 60, 16, 60, 78, 16, -10, 60, 16, 60, 16, 60, 0, 47, 77, -19, 60, 16, -26, 60, 16, 60, -3, +60, 49, 48, 3, 53, 33, 21, 1, 53, 33, 21, 31, 4, -87, -5, 87, 4, -87, -2, 105, -126, -126, -2, -2, -127, +-127, -1, -1, 0, -80, 0, 0, 3, 79, 5, -70, 0, 38, 0, 4, 0, 0, 1, 7, 0, 4, 1, -64, 0, 0, +0, 13, -77, 2, 1, 14, 4, -72, 1, -64, -79, 72, 39, 1, 43, 0, 0, 1, 0, 82, 2, 7, 2, -101, 4, +-82, 0, 20, 0, 90, 64, 26, 53, 4, 68, 4, 101, 4, 98, 17, 119, 4, 112, 17, 6, 18, 13, 20, 3, 3, +16, 20, 1, 2, 39, 6, 12, 20, -72, 1, 89, 64, 24, 6, 28, 16, 7, 13, 37, 10, -126, 20, 2, 63, 1, +20, 37, 1, 48, 0, 1, 0, 25, 21, 113, -116, 24, 43, 78, 16, -12, 93, 60, 77, -19, 16, -19, 16, -12, -19, +0, 63, -19, -12, 60, 16, -12, 60, 17, 18, 57, 47, 1, 17, 18, 57, 49, 48, 0, 93, 19, 17, 51, 21, 54, +54, 51, 50, 22, 22, 21, 17, 35, 17, 52, 38, 35, 34, 6, 21, 17, 82, -126, 41, 103, 64, 83, 114, 50, -115, +65, 68, 81, 89, 2, 7, 2, -103, 69, 41, 42, 63, 101, 109, -2, 106, 1, -111, 88, 69, 92, 104, -2, -106, 0, +3, 0, 51, -1, -26, 8, -109, 5, -70, 0, 54, 0, 65, 0, 95, 1, 106, 64, 107, 83, 4, 82, 28, 102, 27, +101, 28, -123, 14, -118, 87, -119, 89, -120, 91, -102, 90, -100, 91, 10, 6, 28, 10, 35, 5, 47, 22, 28, 25, 35, +21, 47, 35, 27, 44, 35, 52, 26, 69, 25, 66, 26, 74, 59, 74, 63, 81, 3, 85, 4, 100, 3, 108, 19, 100, +47, 101, 48, 98, 80, 118, 4, 123, 19, 121, 83, 123, 87, 122, 91, -123, 4, -113, 14, -113, 19, -115, 22, -123, 31, +-119, 59, -128, 80, -116, 94, -115, 95, -87, 13, -72, 13, -60, 13, -54, 35, -60, 37, 39, 26, 12, 81, 88, 33, 20, +36, -72, 2, -73, -75, 71, 28, 40, 78, 58, 77, -72, 1, 19, 64, 19, 40, 20, 28, 12, 8, 58, 7, 56, 30, +52, 52, 53, 55, 30, 0, 0, 17, 58, 16, -72, 1, 19, -78, 12, 7, 95, -72, 2, -76, 64, 57, 46, 43, 10, +5, 6, 53, 10, 71, 28, 40, 11, 81, 28, 33, 11, 61, 60, 5, 46, 106, 5, 106, 7, 37, -27, 93, 78, 39, +23, 94, 93, 61, 77, 36, -59, 74, 56, 77, 106, 68, 58, 8, 37, 44, 7, 32, 16, 16, 2, 85, 7, 8, 13, +13, 2, 85, 7, -72, -1, -8, 64, 51, 12, 12, 2, 85, 7, 7, 96, 97, 16, 56, 30, 17, 56, 85, 94, 30, +26, 97, 55, 53, -70, 54, 54, 0, 28, 16, 16, 2, 85, 0, 42, 15, 15, 2, 85, 0, 38, 13, 13, 2, 85, +0, 42, 11, 12, 2, 85, 0, 25, 96, 97, -72, 1, -17, -77, 33, -101, 104, 24, 43, 43, 78, -12, 43, 43, 43, +43, 60, 77, 16, -3, 60, 78, 16, -10, 77, -3, -28, 16, -28, 17, 18, 57, 47, 43, 43, 43, 60, -3, -28, -10, +-12, -27, 16, -10, -3, -28, 16, -27, 16, -26, -26, 16, -19, 0, 63, -19, 63, -19, 63, 63, 60, -3, -26, 63, -3, +-28, 63, -19, 17, 57, 47, -19, 47, -28, 16, -19, 16, -3, -28, 16, -3, -27, 17, 18, 57, 17, 18, 57, 49, 48, +1, 93, 0, 93, 19, 33, 50, 23, 22, 23, 51, 17, 23, 17, 33, 54, 51, 50, 23, 22, 23, 39, 38, 38, 35, +34, 6, 21, 20, 23, 22, 4, 22, 22, 21, 20, 6, 35, 34, 38, 39, 7, 6, 6, 35, 34, 39, 38, 53, 17, +35, 6, 6, 7, 6, 35, 35, 17, 35, 19, 17, 51, 50, 54, 54, 53, 52, 38, 38, 35, 1, 17, 7, 20, 22, +51, 50, 54, 55, 38, 38, 39, 23, 22, 22, 51, 50, 55, 54, 53, 52, 39, 38, 36, 39, 38, 38, 53, 52, 55, +51, 1, -50, -22, 123, 94, 13, 92, -74, 1, 64, 85, 92, -67, 118, 95, 4, -69, 6, 104, 102, 102, 101, 57, 56, +1, 61, -117, 74, -21, -60, 125, -98, 69, 1, 28, 47, 18, -109, 65, 37, 102, 31, -112, 114, 79, -61, -97, -62, -62, +-124, -96, -102, 88, 72, 125, -124, 3, 33, 1, 46, 44, 12, 26, 14, 23, 18, 1, -74, 8, -127, 108, 105, 76, 57, +35, 46, -2, -81, 56, 86, 81, 32, 5, -70, -127, 99, -82, 1, 54, 1, -2, -53, 28, 102, 82, -111, 1, 83, 87, +80, 46, 55, 36, 36, 76, 81, -120, 75, -123, -50, 74, 83, -125, 8, 8, 78, 44, 102, 2, -57, 116, -106, 33, 22, +-3, -86, 5, 15, -3, -16, 50, 122, 92, 83, 121, 60, -2, -120, -3, 113, 31, 38, 44, 5, 5, 47, 76, 54, 1, +99, 111, 61, 46, 60, 46, 32, 42, 91, 29, 46, 120, 78, 77, 63, 0, 0, 1, 0, 79, 0, -99, 7, -80, 3, +108, 0, 16, 0, 0, 1, 51, 6, 6, 7, 33, 21, 33, 22, 23, 35, 38, 38, 39, 53, 54, 54, 1, -20, 76, +59, 59, 77, 6, 59, -7, -59, 104, 94, 78, -127, -70, 99, 87, -62, 3, 108, 118, 95, 96, 101, 108, -55, -112, -107, +48, 45, 37, -104, 0, 0, 1, 0, -103, -2, 83, 3, 104, 5, 59, 0, 16, 0, 0, 19, 54, 54, 55, 51, 22, +22, 23, 21, 38, 39, 17, 35, 17, 6, 6, 7, -103, -111, -105, 37, 46, 47, -107, -112, -55, 108, 101, 96, 95, 118, +3, -98, -123, -62, 86, 99, -70, -127, 77, 94, 103, -6, 62, 5, -62, 76, 60, 59, 0, 0, 1, 0, 79, 0, -99, +7, -80, 3, 108, 0, 16, 0, 0, 1, 22, 22, 23, 21, 6, 6, 7, 35, 54, 55, 33, 53, 33, 38, 38, 39, +6, 19, -123, -62, 86, 99, -70, -127, 77, 94, 103, -7, -59, 6, 59, 76, 60, 59, 3, 108, -111, -105, 37, 45, 48, +-107, -112, -55, 108, 101, 97, 94, 118, 0, 1, 0, -103, -2, 83, 3, 104, 5, 59, 0, 16, 0, 0, 23, 53, 22, +22, 23, 17, 51, 17, 54, 55, 21, 6, 6, 7, 35, 38, 38, -103, 119, 94, 96, 101, 108, -55, -112, -107, 47, 46, +37, -105, 16, 76, 59, 60, 76, 5, -62, -6, 62, 103, 94, 77, -127, -70, 99, 86, -62, 0, 0, 1, 0, 79, 0, +-98, 7, -80, 3, 110, 0, 27, 0, 0, 1, 21, 6, 6, 7, 35, 54, 55, 33, 22, 23, 35, 38, 38, 39, 53, +54, 54, 55, 51, 6, 7, 33, 38, 39, 51, 22, 22, 7, -80, 94, -74, -126, 80, 69, 125, -6, -25, 125, 69, 80, +-126, -74, 94, 94, -74, -126, 80, 69, 125, 5, 25, 125, 69, 80, -126, -74, 2, 28, 45, 43, -110, -108, -84, -117, -117, +-84, -108, -110, 43, 45, 44, -111, -107, -84, -117, -117, -84, -107, -111, 0, 1, 0, -104, -2, 85, 3, 103, 5, -73, 0, +27, 0, 0, 1, 51, 22, 22, 23, 21, 38, 39, 17, 54, 55, 21, 6, 6, 7, 35, 38, 38, 39, 53, 22, 23, +17, 6, 7, 53, 54, 54, 1, -23, 45, 44, -111, -108, -85, -116, -116, -85, -108, -111, 44, 45, 43, -110, -108, -85, -116, +-116, -85, -108, -110, 5, -73, 94, -73, -126, 80, 69, 126, -6, -26, 126, 68, 79, -126, -73, 94, 94, -73, -126, 79, 68, +126, 5, 26, 126, 69, 80, -126, -73, 0, 2, 0, -104, -3, -108, 3, 103, 5, -73, 0, 27, 0, 31, 0, 0, 1, +51, 22, 22, 23, 21, 38, 39, 17, 54, 55, 21, 6, 6, 7, 35, 38, 38, 39, 53, 22, 23, 17, 6, 7, 53, +54, 54, 1, 33, 21, 33, 1, -23, 45, 44, -111, -108, -85, -116, -116, -85, -108, -111, 44, 45, 43, -110, -108, -85, -116, +-116, -85, -108, -110, -2, -36, 2, -51, -3, 51, 5, -73, 94, -73, -126, 80, 69, 126, -6, -26, 126, 68, 79, -126, -73, +94, 94, -73, -126, 79, 68, 126, 5, 26, 126, 69, 80, -126, -73, -8, -99, 98, 0, 0, 1, 1, 106, 0, 0, 6, +107, 4, -1, 0, 5, 0, 0, 1, 51, 17, 33, 21, 33, 1, 106, 100, 4, -99, -6, -1, 4, -1, -5, 101, 100, +0, 1, 0, -98, 0, 0, 5, 35, 5, -44, 0, 33, 0, -124, -78, 70, 8, 26, -72, 2, -69, 64, 26, 9, 3, +17, 18, 1, 0, 8, 19, 18, 32, 17, 17, 16, 26, 35, 0, 33, 1, 33, 32, 2, 25, 34, -98, 121, 24, 43, +78, 16, -12, 77, -19, 60, 16, 60, 78, 16, -10, 60, 77, 16, -3, 60, 0, 63, 60, 60, 60, 63, -19, 49, 48, +67, 121, 64, 56, 22, 30, 3, 15, 29, 30, 28, 30, 2, 6, 4, 3, 5, 3, 6, 3, 7, 3, 4, 6, 14, +15, 13, 15, 12, 15, 11, 15, 4, 6, 23, 22, 24, 22, 2, 6, 27, 8, 31, 88, 0, 25, 10, 21, 88, 1, +30, 3, 26, 88, 1, 22, 15, 26, 88, 1, 43, 43, 1, 43, 43, 42, 42, 42, 42, -127, -127, 33, 35, 17, 16, +55, 62, 3, 51, 50, 30, 2, 23, 22, 21, 17, 35, 17, 52, 39, 46, 3, 35, 34, 14, 2, 7, 6, 21, 1, +37, -121, 7, 12, 68, -107, -37, 124, 119, -41, -96, 69, 11, 4, -122, 6, 10, 53, 111, -83, 92, 92, -76, 115, 46, +7, 3, 2, 109, 1, 5, 69, 125, -94, -100, 98, 93, -96, -76, -121, 52, -5, -3, -109, 2, 116, -29, 63, 114, -121, +118, 76, 80, -125, -100, 104, 54, -48, 0, 0, 3, 0, 114, 0, -62, 4, 58, 4, -28, 0, 3, 0, 7, 0, 11, +0, 106, 64, 60, 11, 10, 37, 8, 63, 9, 1, -112, 9, -64, 9, 2, 9, -65, 6, 3, 2, 0, 1, 37, 48, +2, 1, -97, 2, -49, 2, 2, 2, -65, 5, 7, 6, 37, 4, 5, 8, 11, 11, 4, 7, 7, 3, 0, 26, 13, +9, 10, 10, 5, 5, 6, 6, 2, 1, 25, 12, 87, 90, 24, 43, 78, 16, -12, 60, 60, 16, 60, 16, 60, 16, +60, 16, -10, 60, 60, 16, 60, 60, 16, 60, 0, 47, 60, 77, -3, 60, 16, -3, 93, 113, -3, 60, 16, 60, 16, +-3, 93, 113, 60, -3, 60, 49, 48, 1, 33, 53, 33, 17, 33, 53, 33, 17, 33, 53, 33, 4, 58, -4, 56, 3, +-56, -4, 56, 3, -56, -4, 56, 3, -56, 4, 61, -89, -3, -101, -88, -3, -101, -88, 0, 0, 2, 0, -99, 0, 0, +4, 56, 4, -127, 0, 4, 0, 9, 0, 0, 51, 17, 1, 1, 17, 37, 33, 17, 1, 1, -99, 1, -51, 1, -50, +-4, -74, 2, -7, -2, -125, -2, -124, 2, 122, 2, 7, -3, -7, -3, -122, 81, 2, 7, 1, -85, -2, 85, 0, 1, +0, 113, 1, -88, 4, 57, 4, 6, 0, 5, 0, 45, -76, 3, 37, 2, 2, 1, -72, 1, -71, 64, 14, 0, 2, +26, 7, 4, 5, 37, 1, 0, 25, 6, 87, 90, 24, 43, 78, 16, -12, 60, 77, -3, 60, 78, 16, -26, 0, 47, +77, -2, 60, 16, -19, 49, 48, 19, 17, 33, 21, 33, 17, 113, 3, -56, -4, -30, 1, -88, 2, 94, -88, -2, 74, +0, 0, 1, 2, 34, -3, -3, 3, -48, 6, -55, 0, 22, 0, 0, 1, 35, 17, 52, 54, 51, 50, 22, 21, 20, +6, 35, 34, 39, 38, 38, 35, 34, 7, 6, 7, 6, 21, 2, -77, -111, -77, 113, 67, 71, 51, 37, 30, 27, 18, +47, 23, 17, 14, 10, 4, 7, -3, -3, 7, 19, -37, -34, 65, 44, 40, 52, 15, 10, 73, 12, 8, 19, 33, 106, +0, 1, 1, 5, -3, -3, 2, -77, 6, -55, 0, 22, 0, 0, 1, 51, 17, 20, 6, 35, 34, 38, 53, 52, 54, +51, 50, 23, 22, 22, 51, 50, 55, 54, 55, 54, 53, 2, 34, -111, -77, 113, 67, 71, 51, 36, 31, 28, 18, 46, +23, 17, 14, 10, 4, 7, 6, -55, -8, -19, -37, -34, 65, 44, 40, 52, 16, 10, 72, 12, 7, 21, 32, 106, 0, +1, -1, -23, 2, 22, 5, -63, 2, -59, 0, 3, 0, 0, 1, 33, 53, 33, 5, -63, -6, 40, 5, -40, 2, 22, +-81, 0, 0, 1, 1, -55, -3, -109, 2, 120, 7, 72, 0, 3, 0, 0, 1, 17, 51, 17, 1, -55, -81, -3, -109, +9, -75, -10, 75, 0, 0, 1, 2, 126, -3, -109, 5, -62, 2, -59, 0, 5, 0, 0, 1, 21, 33, 17, 35, 17, +5, -62, -3, 107, -81, 2, -59, -81, -5, 125, 5, 50, 0, 1, -1, -23, -3, -109, 3, 44, 2, -59, 0, 5, 0, +0, 1, 33, 53, 33, 17, 35, 2, 125, -3, 108, 3, 67, -81, 2, 22, -81, -6, -50, 0, 1, 2, 126, 2, 22, +5, -62, 7, 72, 0, 5, 0, 0, 1, 17, 51, 17, 33, 21, 2, 126, -81, 2, -107, 2, 22, 5, 50, -5, 125, +-81, 0, 1, -1, -23, 2, 22, 3, 44, 7, 72, 0, 5, 0, 0, 1, 33, 53, 33, 17, 51, 3, 44, -4, -67, +2, -108, -81, 2, 22, -81, 4, -125, 0, 1, 2, 126, -3, -109, 5, -62, 7, 72, 0, 7, 0, 0, 1, 17, 51, +17, 33, 21, 33, 17, 2, 126, -81, 2, -107, -3, 107, -3, -109, 9, -75, -5, 125, -81, -5, 125, 0, 1, -1, -23, +-3, -109, 3, 44, 7, 72, 0, 7, 0, 0, 1, 17, 33, 53, 33, 17, 51, 17, 2, 125, -3, 108, 2, -108, -81, +-3, -109, 4, -125, -81, 4, -125, -10, 75, 0, 1, -1, -23, -3, -109, 5, -63, 2, -59, 0, 7, 0, 0, 1, 33, +53, 33, 21, 33, 17, 35, 2, 125, -3, 108, 5, -40, -3, 107, -81, 2, 22, -81, -81, -5, 125, 0, 0, 1, -1, +-23, 2, 22, 5, -63, 7, 72, 0, 7, 0, 0, 1, 33, 53, 33, 17, 51, 17, 33, 5, -63, -6, 40, 2, -108, +-81, 2, -107, 2, 22, -81, 4, -125, -5, 125, 0, 1, -1, -23, -3, -109, 5, -63, 7, 72, 0, 11, 0, 0, 1, +33, 53, 33, 17, 51, 17, 33, 21, 33, 17, 35, 2, 125, -3, 108, 2, -108, -81, 2, -107, -3, 107, -81, 2, 22, +-81, 4, -125, -5, 125, -81, -5, 125, 0, 2, -1, -23, 1, 88, 5, -63, 3, -125, 0, 3, 0, 7, 0, 0, 1, +33, 53, 33, 17, 33, 53, 33, 5, -63, -6, 40, 5, -40, -6, 40, 5, -40, 2, -44, -81, -3, -43, -81, 0, 2, +1, -64, -3, -109, 3, -21, 7, 72, 0, 3, 0, 7, 0, 0, 1, 17, 51, 17, 33, 17, 51, 17, 3, 60, -81, +-3, -43, -81, -3, -109, 9, -75, -10, 75, 9, -75, -10, 75, 0, 1, 2, 126, -3, -109, 5, -62, 3, -125, 0, 9, +0, 0, 1, 17, 33, 21, 33, 21, 33, 21, 33, 17, 2, 126, 3, 68, -3, 107, 2, -107, -3, 107, -3, -109, 5, +-16, -81, -51, -81, -4, 59, 0, 0, 1, 1, -64, -3, -109, 5, -62, 2, -59, 0, 9, 0, 0, 1, 17, 33, 21, +33, 17, 35, 17, 35, 17, 1, -64, 4, 2, -2, 41, -81, -51, -3, -109, 5, 50, -81, -5, 125, 4, 116, -5, -116, +0, 0, 2, 1, -64, -3, -109, 5, -63, 3, -125, 0, 5, 0, 11, 0, 0, 1, 35, 17, 33, 21, 33, 1, 17, +35, 17, 33, 21, 2, 111, -81, 4, 1, -4, -82, 1, 124, -81, 2, -123, -3, -109, 5, -16, -81, -2, -124, -4, 59, +4, 116, -81, 0, 1, -1, -23, -3, -109, 3, 44, 3, -125, 0, 9, 0, 0, 1, 33, 53, 33, 53, 33, 53, 33, +17, 35, 2, 125, -3, 108, 2, -108, -3, 108, 3, 67, -81, 1, 88, -81, -51, -81, -6, 16, 0, 1, -1, -23, -3, +-109, 3, -22, 2, -59, 0, 9, 0, 0, 1, 19, 33, 53, 33, 17, 35, 17, 35, 17, 1, -65, 1, -2, 41, 4, +1, -81, -51, -3, -109, 4, -125, -81, -6, -50, 4, -125, -5, 125, 0, 2, -1, -23, -3, -109, 3, -22, 3, -125, 0, +5, 0, 11, 0, 0, 1, 17, 33, 53, 33, 17, 1, 33, 53, 33, 17, 35, 3, 59, -4, -82, 4, 1, -3, -43, +-2, 42, 2, -123, -81, -3, -109, 5, 65, -81, -6, 16, 3, -59, -81, -5, -116, 0, 0, 1, 2, 126, 1, 88, 5, +-62, 7, 72, 0, 9, 0, 0, 1, 17, 51, 17, 33, 21, 33, 21, 33, 21, 2, 126, -81, 2, -107, -3, 107, 2, +-107, 1, 88, 5, -16, -4, 59, -81, -51, -81, 0, 1, 1, -64, 2, 22, 5, -62, 7, 72, 0, 9, 0, 0, 1, +33, 17, 51, 17, 51, 17, 51, 17, 33, 5, -62, -5, -2, -81, -51, -81, 1, -41, 2, 22, 5, 50, -5, 125, 4, +-125, -5, 125, 0, 0, 2, 1, -64, 1, 88, 5, -63, 7, 72, 0, 5, 0, 11, 0, 0, 1, 17, 33, 21, 33, +17, 1, 33, 21, 33, 17, 51, 2, 111, 3, 82, -5, -1, 2, 43, 1, -42, -3, 123, -81, 7, 72, -6, -65, -81, +5, -16, -4, 59, -81, 4, 116, 0, 0, 1, -1, -23, 1, 88, 3, 44, 7, 72, 0, 9, 0, 0, 1, 33, 53, +33, 53, 33, 53, 33, 17, 51, 3, 44, -4, -67, 2, -108, -3, 108, 2, -108, -81, 1, 88, -81, -51, -81, 3, -59, +0, 1, -1, -23, 2, 22, 3, -22, 7, 72, 0, 9, 0, 0, 1, 33, 53, 33, 17, 51, 17, 51, 17, 51, 3, +-22, -5, -1, 1, -42, -81, -51, -81, 2, 22, -81, 4, -125, -5, 125, 4, -125, 0, 2, -1, -23, 1, 88, 3, -22, +7, 72, 0, 5, 0, 11, 0, 0, 1, 51, 17, 33, 53, 33, 1, 17, 51, 17, 33, 53, 3, 59, -81, -5, -1, +3, 82, -2, -124, -81, -3, 123, 7, 72, -6, 16, -81, 1, 124, 3, -59, -5, -116, -81, 0, 1, 2, 126, -3, -109, +5, -62, 7, 72, 0, 11, 0, 0, 1, 17, 51, 17, 33, 21, 33, 21, 33, 21, 33, 17, 2, 126, -81, 2, -107, +-3, 107, 2, -107, -3, 107, -3, -109, 9, -75, -4, 59, -81, -51, -81, -4, 59, 0, 2, 1, -64, -3, -109, 5, -62, +7, 72, 0, 7, 0, 11, 0, 0, 1, 17, 51, 17, 33, 21, 33, 17, 33, 17, 51, 17, 3, 60, -81, 1, -41, +-2, 41, -3, -43, -81, -3, -109, 9, -75, -5, 125, -81, -5, 125, 9, -75, -10, 75, 0, 0, 3, 1, -64, -3, -109, +5, -62, 7, 72, 0, 3, 0, 9, 0, 15, 0, 0, 1, 17, 51, 17, 19, 17, 51, 17, 33, 21, 1, 17, 33, +21, 33, 17, 1, -64, -81, -51, -81, 1, -41, -3, 122, 2, -122, -2, 41, -3, -109, 9, -75, -10, 75, 5, 65, 4, +116, -4, 59, -81, -6, -65, 4, 116, -81, -4, 59, 0, 0, 1, -1, -23, -3, -109, 3, 44, 7, 72, 0, 11, 0, +0, 1, 33, 53, 33, 39, 33, 53, 33, 17, 51, 17, 35, 2, 125, -3, 108, 2, -107, 1, -3, 108, 2, -108, -81, +-81, 1, 88, -81, -51, -81, 3, -59, -10, 75, 0, 2, -1, -23, -3, -109, 3, -22, 7, 72, 0, 7, 0, 11, 0, +0, 1, 19, 33, 53, 33, 17, 51, 17, 51, 17, 51, 17, 1, -65, 1, -2, 41, 1, -42, -81, -51, -81, -3, -109, +4, -125, -81, 4, -125, -10, 75, 9, -75, -10, 75, 0, 0, 3, -1, -23, -3, -109, 3, -22, 7, 72, 0, 3, 0, +9, 0, 15, 0, 0, 1, 17, 51, 17, 1, 17, 33, 53, 33, 17, 17, 33, 53, 33, 17, 35, 3, 59, -81, -2, +-124, -3, 123, 1, -42, -2, 42, 2, -123, -81, -3, -109, 9, -75, -10, 75, 9, -75, -5, -116, -81, 3, -59, -6, 16, +-81, -5, -116, 0, 2, -1, -23, -3, -109, 5, -63, 3, -125, 0, 3, 0, 11, 0, 0, 1, 33, 53, 33, 1, 33, +53, 33, 21, 33, 17, 35, 5, -63, -6, 40, 5, -40, -4, -68, -3, 108, 5, -40, -3, 107, -81, 2, -44, -81, -3, +-43, -81, -81, -4, 59, 0, 1, -1, -23, -3, -109, 5, -63, 2, -59, 0, 11, 0, 0, 1, 19, 33, 53, 33, 21, +33, 17, 35, 17, 35, 17, 1, -65, 1, -2, 41, 5, -40, -2, 41, -81, -51, -3, -109, 4, -125, -81, -81, -5, 125, +4, 116, -5, -116, 0, 0, 3, -1, -23, -3, -109, 5, -63, 3, -125, 0, 3, 0, 9, 0, 15, 0, 0, 1, 33, +53, 33, 1, 33, 53, 33, 17, 35, 33, 17, 33, 21, 33, 17, 5, -63, -6, 40, 5, -40, -5, -2, -2, 42, 2, +-123, -81, 1, 124, 2, -122, -2, 41, 2, -44, -81, -3, -43, -81, -5, -116, 4, 116, -81, -4, 59, 0, 2, -1, -23, +1, 88, 5, -63, 7, 72, 0, 7, 0, 11, 0, 0, 1, 33, 53, 33, 17, 51, 17, 33, 17, 33, 53, 33, 5, +-63, -6, 40, 2, -108, -81, 2, -107, -6, 40, 5, -40, 2, -44, -81, 3, -59, -4, 59, -3, -43, -81, 0, 0, 1, +-1, -23, 2, 22, 5, -63, 7, 72, 0, 11, 0, 0, 1, 33, 53, 33, 17, 51, 17, 51, 17, 51, 17, 33, 5, +-63, -6, 40, 1, -42, -81, -51, -81, 1, -41, 2, 22, -81, 4, -125, -5, 125, 4, -125, -5, 125, 0, 3, -1, -23, +1, 88, 5, -63, 7, 72, 0, 5, 0, 11, 0, 15, 0, 0, 1, 33, 53, 33, 17, 51, 1, 33, 17, 51, 17, +33, 17, 33, 53, 33, 2, 110, -3, 123, 1, -42, -81, 3, 83, -3, 122, -81, 1, -41, -6, 40, 5, -40, 2, -44, +-81, 3, -59, -5, -116, 4, 116, -4, 59, -3, -43, -81, 0, 1, -1, -23, -3, -109, 5, -63, 7, 72, 0, 19, 0, +0, 1, 33, 53, 33, 53, 33, 53, 33, 17, 51, 17, 33, 21, 33, 21, 33, 21, 33, 17, 35, 2, 125, -3, 108, +2, -108, -3, 108, 2, -108, -81, 2, -107, -3, 107, 2, -107, -3, 107, -81, 1, 88, -81, -51, -81, 3, -59, -4, 59, +-81, -51, -81, -4, 59, 0, 1, -1, -23, -3, -109, 5, -63, 7, 72, 0, 19, 0, 0, 1, 19, 33, 53, 33, 17, +51, 17, 51, 17, 51, 17, 33, 21, 33, 17, 35, 17, 35, 17, 1, -65, 1, -2, 41, 1, -42, -81, -51, -81, 1, +-41, -2, 41, -81, -51, -3, -109, 4, -125, -81, 4, -125, -5, 125, 4, -125, -5, 125, -81, -5, 125, 4, -125, -5, 125, +0, 4, -1, -23, -3, -109, 5, -63, 7, 72, 0, 5, 0, 11, 0, 17, 0, 23, 0, 0, 1, 33, 21, 33, 17, +51, 1, 17, 51, 17, 33, 53, 1, 33, 53, 33, 17, 35, 1, 17, 35, 17, 33, 21, 3, -21, 1, -42, -3, 123, +-81, -3, -44, -81, -3, 123, 1, -42, -2, 42, 2, -123, -81, 2, 44, -81, 2, -123, 3, -125, -81, 4, 116, -4, 59, +3, -59, -5, -116, -81, -3, -43, -81, -5, -116, 3, -59, -4, 59, 4, 116, -81, 0, 1, -1, -23, 2, 109, 5, -63, +7, 72, 0, 3, 0, 0, 1, 33, 17, 33, 5, -63, -6, 40, 5, -40, 2, 109, 4, -37, 0, 1, -1, -23, -3, +-109, 5, -63, 2, 109, 0, 3, 0, 0, 1, 33, 17, 33, 5, -63, -6, 40, 5, -40, -3, -109, 4, -38, 0, 1, +-1, -23, -3, -109, 5, -63, 7, 72, 0, 3, 0, 0, 3, 17, 33, 17, 23, 5, -40, -3, -109, 9, -75, -10, 75, +0, 0, 1, -1, -23, -3, -109, 2, -43, 7, 72, 0, 3, 0, 0, 3, 17, 33, 17, 23, 2, -20, -3, -109, 9, +-75, -10, 75, 0, 0, 1, 2, -42, -3, -109, 5, -62, 7, 72, 0, 3, 0, 0, 1, 17, 33, 17, 2, -42, 2, +-20, -3, -109, 9, -75, -10, 75, 0, 30, 0, 102, -2, 8, 5, -63, 7, 72, 0, 3, 0, 7, 0, 11, 0, 15, +0, 19, 0, 23, 0, 27, 0, 31, 0, 35, 0, 39, 0, 43, 0, 47, 0, 51, 0, 55, 0, 59, 0, 63, 0, +67, 0, 71, 0, 75, 0, 79, 0, 83, 0, 87, 0, 91, 0, 95, 0, 99, 0, 103, 0, 107, 0, 111, 0, 115, +0, 119, 0, 0, 19, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, 5, 51, 21, 35, 37, 51, 21, 35, 37, +51, 21, 35, 7, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, 5, 51, 21, 35, 37, 51, 21, 35, 37, 51, +21, 35, 7, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, 23, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, +35, 7, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, 5, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, +7, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, 23, 51, 21, 35, 37, 51, 21, 35, 37, 51, 21, 35, 102, +125, 125, 1, -14, 125, 125, 1, -13, 125, 125, -3, 20, 125, 125, 1, -13, 124, 124, 1, -14, 125, 125, -7, 125, 125, +-2, 13, 125, 125, -2, 14, 125, 125, 4, -34, 125, 125, -2, 14, 124, 124, -2, 13, 125, 125, -7, 125, 125, 1, -14, +125, 125, 1, -13, 125, 125, -7, 125, 125, -2, 14, 124, 124, -2, 13, 125, 125, -7, 125, 125, 1, -14, 125, 125, 1, +-13, 125, 125, -3, 20, 125, 125, 1, -13, 124, 124, 1, -14, 125, 125, -7, 125, 125, -2, 13, 125, 125, -2, 14, 125, +125, -7, 125, 125, 1, -13, 124, 124, 1, -14, 125, 125, 7, 72, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, +124, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 124, +125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 0, 63, +-1, -22, -2, 8, 5, -63, 7, 72, 0, 3, 0, 7, 0, 11, 0, 15, 0, 19, 0, 23, 0, 27, 0, 31, 0, +35, 0, 39, 0, 43, 0, 47, 0, 51, 0, 55, 0, 59, 0, 63, 0, 67, 0, 71, 0, 75, 0, 79, 0, 83, +0, 87, 0, 91, 0, 95, 0, 99, 0, 107, 0, 111, 0, 115, 0, 119, 0, 123, 0, 127, 0, -125, 0, -121, 0, +-117, 0, -113, 0, -109, 0, -105, 0, -101, 0, -97, 0, -93, 0, -89, 0, -85, 0, -81, 0, -77, 0, -73, 0, -69, +0, -65, 0, -61, 0, -57, 0, -53, 0, -49, 0, -45, 0, -41, 0, -37, 0, -33, 0, -29, 0, -25, 0, -21, 0, +-17, 0, -13, 0, -9, 0, -5, 0, -1, 0, 0, 19, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, +21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 5, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, +35, 55, 51, 21, 35, 55, 51, 21, 35, 53, 51, 21, 35, 53, 51, 21, 35, 5, 51, 21, 35, 55, 51, 21, 35, +55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 5, 51, 21, 35, 55, 51, 21, 35, 55, +51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 53, 51, 21, 35, 53, 51, 21, 35, 5, 51, +21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 5, 51, 21, +35, 37, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 37, 51, 21, 35, 5, 51, 21, 35, +39, 51, 21, 35, 39, 51, 21, 35, 39, 51, 21, 35, 39, 51, 21, 35, 39, 51, 21, 35, 7, 51, 21, 35, 55, +51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 23, 51, 21, 35, 39, 51, +21, 35, 39, 51, 21, 35, 39, 51, 21, 35, 39, 51, 21, 35, 39, 51, 21, 35, 7, 51, 21, 35, 55, 51, 21, +35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 55, 51, 21, 35, 103, 124, 124, -7, 124, 124, -7, 125, +125, -7, 125, 125, -6, 124, 124, -7, 124, 124, -6, -91, 125, 125, -7, 125, 125, -7, 125, 125, -6, 124, 124, -7, 125, +125, -7, 125, 125, 125, 125, 125, 125, -5, -97, 124, 124, -7, 124, 124, -7, 125, 125, -7, 125, 125, -6, 124, 124, -7, +124, 124, -6, -91, 125, 125, -7, 125, 125, -7, 125, 125, -6, 124, 124, -7, 125, 125, -7, 125, 125, 125, 125, 125, 125, +-5, -97, 124, 124, -7, 124, 124, -7, 125, 125, -7, 125, 125, -6, 124, 124, -7, 124, 124, -6, -91, 125, 125, 1, -14, +125, 125, -6, 124, 124, -7, 125, 125, -7, 125, 125, -4, 27, 125, 125, 4, 98, 124, 124, -7, 124, 124, -6, 125, 125, +-7, 125, 125, -7, 124, 124, -7, 124, 124, 125, 125, 125, -7, 125, 125, -7, 125, 125, -6, 124, 124, -7, 125, 125, -7, +125, 125, 125, 124, 124, -7, 124, 124, -6, 125, 125, -7, 125, 125, -7, 124, 124, -7, 124, 124, 125, 125, 125, -7, 125, +125, -7, 125, 125, -6, 124, 124, -7, 125, 125, -7, 125, 125, 7, 72, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, +125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, +125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, +125, 125, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, +125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, +125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 0, 0, 46, -1, -1, -3, -116, 5, +-42, 7, 72, 0, 61, 0, 65, 0, 69, 0, 73, 0, 77, 0, 81, 0, 85, 0, 89, 0, 93, 0, 97, 0, 101, +0, 105, 0, 109, 0, 113, 0, 117, 0, 121, 0, 125, 0, -127, 0, -123, 0, -119, 0, -115, 0, -111, 0, -107, 0, +-103, 0, -99, 0, -95, 0, -91, 0, -87, 0, -83, 0, -79, 0, -75, 0, -71, 0, -67, 0, -63, 0, -59, 0, -55, +0, -51, 0, -47, 0, -43, 0, -39, 0, -35, 0, -31, 0, -27, 0, -23, 0, -19, 0, -15, 0, 0, 1, 17, 35, +21, 51, 17, 35, 21, 51, 17, 35, 21, 51, 17, 35, 21, 51, 21, 33, 17, 51, 53, 35, 17, 51, 53, 35, 17, +51, 53, 35, 17, 51, 53, 35, 17, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, +53, 51, 21, 51, 53, 51, 21, 35, 21, 37, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, +51, 21, 51, 53, 23, 35, 21, 51, 39, 35, 21, 51, 39, 35, 21, 51, 39, 35, 21, 51, 39, 35, 21, 51, 7, +21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 5, 35, 21, 51, 55, 21, +51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 5, 21, 51, 53, 33, 21, 51, 53, 7, 53, 35, +21, 37, 21, 51, 53, 51, 21, 51, 53, 19, 53, 35, 21, 35, 53, 35, 21, 35, 53, 35, 21, 35, 53, 35, 21, +35, 53, 35, 21, 7, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 19, +53, 35, 21, 35, 53, 35, 21, 35, 53, 35, 21, 35, 53, 35, 21, 35, 53, 35, 21, 7, 21, 51, 53, 51, 21, +51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 51, 21, 51, 53, 5, -42, 124, 124, 124, 124, 124, 124, 124, 124, -6, +41, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 125, 124, 125, 125, 124, 125, 125, 124, 125, 124, 124, -5, 34, 124, +125, 124, 125, 125, 124, 125, 125, 124, 125, 125, 125, -7, 125, 125, -6, 124, 124, -7, 125, 125, -7, 125, 125, -7, 124, +125, 124, 125, 125, 124, 125, 125, 124, -4, -104, 125, 125, 124, 125, 125, 124, 125, 125, 124, 125, -5, 34, 124, 1, 118, +125, -6, 124, 1, -14, 125, 125, 124, 125, 125, 124, 125, 125, 124, 125, 125, 124, 125, 124, 124, 125, 124, 125, 125, 124, +125, 125, 124, 125, 125, 124, 125, 125, 124, 125, 125, 124, 125, 124, 124, 125, 124, 125, 125, 124, 125, 125, 124, 5, -46, +-2, -118, 124, -2, -118, 125, -2, -118, 124, -2, -118, 125, 124, 1, 117, 125, 1, 118, 125, 1, 117, 125, 1, 118, 125, +1, 117, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, -7, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, +125, -7, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, -7, 125, 125, +125, 125, 125, 125, 125, 125, 125, 125, -7, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, -2, -118, 125, 125, +125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, -2, -118, 125, 125, 125, 125, +125, 125, 125, 125, 125, 125, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 0, 1, 0, -110, 0, 0, 4, 66, +3, -80, 0, 3, 0, 0, 19, 33, 17, 33, -110, 3, -80, -4, 80, 3, -80, -4, 80, 0, 0, 1, 0, 0, 1, +61, 7, -1, 2, -65, 0, 3, 0, 0, 17, 33, 17, 33, 7, -1, -8, 1, 2, -65, -2, 126, 0, 1, 1, 48, +0, 0, 6, -68, 5, -117, 0, 2, 0, 0, 33, 1, 1, 1, 48, 2, -58, 2, -58, 5, -117, -6, 117, 0, 0, +1, 1, 32, -1, -31, 6, -53, 5, -119, 0, 2, 0, 0, 9, 2, 1, 32, 5, -85, -6, 85, 5, -119, -3, 44, +-3, 44, 0, 1, 1, 48, -1, -31, 6, -68, 5, 108, 0, 2, 0, 0, 9, 2, 6, -68, -3, 58, -3, 58, 5, +108, -6, 117, 5, -117, 0, 1, 1, 32, -1, -31, 6, -53, 5, -119, 0, 2, 0, 0, 1, 17, 1, 6, -53, -6, +85, 5, -119, -6, 88, 2, -44, 0, 0, 2, 0, -78, 0, -119, 4, 35, 3, -6, 0, 13, 0, 27, 0, 0, 1, +50, 22, 22, 21, 20, 0, 35, 34, 0, 53, 52, 54, 54, 23, 34, 6, 6, 21, 20, 22, 51, 50, 54, 53, 52, +38, 38, 2, 106, 111, -44, 118, -2, -2, -74, -73, -2, -2, 118, -44, 111, 93, -82, 98, -42, -105, -105, -43, 98, -82, +3, -6, 114, -44, 114, -73, -2, -2, 1, 2, -73, 115, -45, 114, 76, 94, -80, 94, -105, -42, -42, -105, 94, -80, 94, +0, 2, 0, -128, 0, 0, 4, 84, 3, -44, 0, 3, 0, 15, 0, 0, 51, 17, 33, 17, 1, 34, 6, 21, 20, +22, 51, 50, 54, 53, 52, 38, -128, 3, -44, -2, 22, 84, 118, 119, 83, 84, 118, 118, 3, -44, -4, 44, 2, -76, +118, 84, 83, 119, 119, 83, 84, 118, 0, 3, 0, 42, 0, 0, 4, -83, 4, -125, 0, 3, 0, 17, 0, 31, 0, +0, 51, 17, 33, 17, 1, 34, 6, 6, 21, 20, 0, 51, 50, 0, 53, 52, 38, 38, 7, 50, 22, 22, 21, 20, +6, 35, 34, 38, 53, 52, 54, 54, 42, 4, -125, -3, -65, 112, -45, 118, 1, 2, -73, -74, 1, 2, 118, -45, 111, +91, -81, 98, -43, -105, -104, -43, 98, -81, 4, -125, -5, 125, 3, -6, 114, -44, 115, -74, -2, -2, 1, 2, -74, 115, +-44, 114, 76, 94, -81, 96, -105, -43, -43, -105, 96, -81, 94, 0, 0, 5, 1, -104, -1, -119, 6, -109, 4, -124, 0, +11, 0, 23, 0, 35, 0, 47, 0, 59, 0, 0, 1, 16, 0, 33, 32, 0, 17, 16, 0, 33, 32, 0, 3, 52, +0, 35, 34, 0, 21, 20, 0, 51, 50, 0, 1, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 5, 20, 6, +35, 34, 38, 53, 52, 54, 51, 50, 22, 1, 55, 22, 51, 50, 55, 23, 6, 6, 35, 34, 38, 6, -109, -2, -117, +-2, -8, -2, -8, -2, -118, 1, 118, 1, 8, 1, 8, 1, 117, 92, -2, -63, -30, -30, -2, -63, 1, 63, -30, -30, +1, 63, -3, 59, 47, 34, 33, 48, 48, 33, 34, 47, 1, -23, 47, 34, 33, 48, 48, 33, 34, 47, -3, -107, 62, +79, -103, -103, 78, 63, 50, -109, 97, 98, -110, 2, 6, -2, -8, -2, -117, 1, 117, 1, 8, 1, 9, 1, 117, -2, +-117, -2, -9, -30, 1, 63, -2, -63, -30, -31, -2, -63, 1, 63, 1, 101, 33, 48, 48, 33, 34, 47, 47, 34, 33, +48, 48, 33, 34, 47, 47, -2, -115, 36, -112, -112, 36, 95, 100, 100, 0, 0, 4, 1, -72, -1, -119, 6, -77, 4, +-124, 0, 11, 0, 23, 0, 35, 0, 47, 0, 0, 1, 16, 0, 33, 32, 0, 17, 16, 0, 33, 32, 0, 5, 52, +38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 37, 52, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 1, 22, 22, +51, 50, 54, 55, 39, 6, 35, 34, 39, 6, -77, -2, -117, -2, -8, -2, -8, -2, -118, 1, 118, 1, 8, 1, 8, +1, 117, -4, -33, 47, 34, 33, 48, 48, 33, 34, 47, 1, -23, 47, 34, 33, 48, 48, 33, 34, 47, -3, -107, 50, +-110, 98, 97, -109, 50, 63, 78, -103, -103, 79, 2, 6, -2, -8, -2, -117, 1, 117, 1, 8, 1, 9, 1, 117, -2, +-117, -123, 34, 47, 47, 34, 33, 48, 48, 33, 34, 47, 47, 34, 33, 48, 48, -2, -48, 95, 100, 100, 95, 36, -112, +-112, 0, 2, 0, 16, -1, 33, 7, 70, 6, 85, 0, 47, 0, 59, 0, 0, 1, 51, 17, 22, 22, 23, 1, 23, +1, 22, 23, 22, 23, 33, 21, 33, 6, 7, 1, 7, 1, 6, 6, 7, 17, 35, 17, 38, 38, 39, 1, 39, 1, +38, 38, 39, 33, 53, 33, 54, 54, 55, 1, 55, 1, 54, 54, 55, 1, 52, 0, 35, 34, 0, 21, 20, 0, 51, +50, 0, 3, -122, 76, 102, -97, 88, 1, 34, 52, -2, -30, 73, 30, 38, 2, 1, 80, -2, -79, 19, 124, 1, 29, +57, -2, -27, 98, -110, 107, 76, 112, -103, 80, -2, -38, 51, 1, 29, 66, 68, 11, -2, -80, 1, 80, 9, 66, 69, +-2, -28, 48, 1, 36, 101, -99, 92, 2, 36, -2, -45, -44, -44, -2, -44, 1, 44, -44, -44, 1, 45, 6, 85, -2, +-81, 7, 63, 71, 1, 28, 53, -2, -30, 95, 74, 96, 93, 69, -67, -98, -2, -35, 50, 1, 26, 72, 57, 12, -2, +-81, 1, 81, 15, 62, 61, -2, -22, 51, 1, 30, 84, -92, 106, 69, 106, -97, 84, 1, 31, 57, -2, -26, 70, 61, +8, -3, -73, -44, 1, 44, -2, -44, -44, -44, -2, -45, 1, 45, 0, 0, 2, 0, -12, -2, 73, 5, 11, 5, -29, +0, 25, 0, 39, 0, 0, 1, 17, 33, 21, 33, 17, 35, 17, 33, 53, 33, 17, 34, 38, 38, 53, 52, 54, 54, +51, 50, 22, 22, 21, 20, 0, 3, 34, 6, 6, 21, 20, 0, 51, 50, 0, 53, 52, 38, 38, 3, 28, 1, -53, +-2, 53, 59, -2, 52, 1, -52, 103, -11, -111, -117, -8, -119, -120, -7, -118, -2, -31, -19, 118, -31, 126, 1, 19, -62, +-61, 1, 19, 126, -31, 1, -51, -2, 110, 59, -2, 73, 1, -73, 59, 1, -110, -125, -5, -116, -120, -6, -118, -117, -7, +-120, -47, -2, -47, 3, -44, 121, -30, 122, -61, -2, -19, 1, 19, -61, 122, -30, 121, 0, 2, 0, 111, -2, -6, 5, +-121, 6, 84, 0, 24, 0, 38, 0, 0, 1, 23, 19, 7, 3, 1, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, +53, 52, 0, 51, 50, 23, 1, 1, 39, 19, 34, 6, 6, 21, 20, 0, 51, 50, 0, 53, 52, 38, 38, 4, -64, +36, -93, 57, -114, -2, -102, -108, -104, -118, -7, -119, -120, -7, -118, 1, 51, -37, 78, 88, 1, 104, -3, -25, 24, 32, +118, -31, 126, 1, 19, -62, -61, 1, 19, 126, -31, 6, 84, 16, -3, 102, 15, 2, 69, -3, 0, 75, -2, -111, -120, +-7, -117, -117, -7, -120, -39, 1, 50, 27, 3, 3, -2, -9, 53, -3, -74, 121, -30, 122, -61, -2, -19, 1, 19, -61, +122, -30, 121, 0, 0, 1, 0, 58, 0, 0, 4, 6, 4, -49, 0, 34, 0, 0, 1, 22, 22, 4, 22, 21, 20, +6, 35, 34, 38, 39, 30, 2, 23, 23, 33, 55, 50, 54, 39, 6, 6, 35, 34, 38, 53, 52, 55, 54, 54, 55, +54, 54, 2, 33, 26, 108, 1, 21, 74, -128, 92, 78, 127, 49, 1, 75, -91, -119, 7, -4, -25, 8, -72, -53, 4, +45, -123, 84, 90, -127, 33, 45, -54, 48, 73, 67, 4, -49, 108, -86, -5, -122, 69, 96, -128, 97, 93, -109, -83, 99, +9, 37, 37, -41, -43, 95, 95, -126, 91, 73, 59, 82, -90, 54, 83, -126, 0, 1, 0, 55, 0, 0, 5, 8, 4, +-49, 0, 51, 0, 0, 33, 33, 55, 54, 55, 54, 54, 53, 52, 39, 6, 6, 35, 34, 38, 53, 52, 54, 51, 50, +23, 38, 38, 53, 52, 54, 51, 50, 22, 21, 20, 7, 54, 55, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 39, +38, 39, 22, 22, 23, 22, 23, 4, 74, -4, -80, 8, -91, 54, 81, 103, 1, 61, -81, 91, 116, -94, -108, 94, 60, +103, 42, 25, -98, 118, 118, -95, 69, 84, 17, 27, 34, 100, -109, -95, 113, 63, -123, 49, 35, 52, 4, 89, 92, 62, +-95, 34, 35, 34, 51, -56, 111, 16, 30, 124, 114, -94, 118, 116, -97, 51, 70, 71, 41, 114, -98, -98, 109, 89, 98, +40, 5, 8, -99, 116, 120, -93, 61, 51, 37, 88, -97, -71, 61, 41, 31, 0, 1, 0, 63, -1, -24, 4, -127, 4, +-49, 0, 28, 0, 0, 5, 38, 38, 39, 38, 39, 38, 38, 53, 52, 54, 51, 50, 23, 22, 23, 54, 55, 54, 51, +50, 22, 21, 20, 6, 7, 6, 7, 6, 2, 98, 31, 115, -91, 121, 28, 46, 41, -108, 109, 110, 81, 61, 38, 33, +60, 83, 109, 108, -106, 88, 126, -92, 75, 59, 24, 118, -49, -38, -96, 43, 70, 117, 60, 111, -106, 78, 58, 115, 113, +59, 80, -107, 103, 90, -61, -98, -49, -123, 105, 0, 1, 0, 64, -1, -24, 3, -42, 4, -49, 0, 17, 0, 0, 1, +22, 23, 22, 23, 6, 7, 6, 7, 38, 39, 38, 39, 38, 39, 54, 55, 54, 2, 9, 89, -126, -106, 92, 74, -88, +-120, 82, 27, 47, 81, 120, 26, -99, 101, -97, 118, 4, -49, -105, -83, -56, 103, 78, -32, -74, -112, 52, 69, 120, -97, +35, -63, 115, -43, -98, 0, 1, 0, 37, -1, -37, 3, -37, 5, 83, 0, 30, 0, 0, 1, 51, 50, 23, 22, 23, +22, 22, 21, 21, 35, 53, 52, 38, 39, 38, 35, 35, 17, 20, 6, 6, 35, 34, 38, 53, 52, 54, 51, 50, 23, +1, -26, 38, -84, 55, 79, 60, 45, 52, 99, 57, 56, 73, 89, 28, 64, -100, 92, 109, 127, -104, 123, 78, 96, 5, +83, 14, 20, 57, 42, -103, 102, 103, 43, 68, 95, 25, 32, -4, -67, 121, -121, 81, 123, 100, 105, -113, 46, 0, 0, +1, 0, 85, -1, -128, 5, 50, 5, -17, 0, 30, 0, 0, 1, 37, 17, 20, 6, 6, 35, 34, 38, 53, 52, 54, +51, 50, 22, 23, 17, 5, 17, 20, 6, 6, 35, 34, 38, 53, 52, 54, 51, 50, 23, 2, 22, 3, 28, 63, -105, +95, 109, -126, -102, 122, 40, 61, 69, -3, -83, 64, -100, 92, 109, 127, -104, 123, 78, 96, 4, -9, -8, -5, -84, 124, +126, 82, 125, 99, 100, -111, 14, 29, 2, -44, -71, -4, -68, 121, -121, 80, 123, 99, 105, -113, 46, 0, -1, -1, 0, +-65, -1, -25, 5, 120, 5, -70, 0, 38, 0, 44, 0, 0, 1, 7, 0, 45, 2, 23, 0, 0, 0, -98, 64, 14, +1, 4, 30, 15, 16, 2, 85, 4, 28, 13, 13, 2, 85, 4, -72, -1, -16, -76, 11, 11, 2, 85, 4, -72, -1, +-32, -76, 9, 10, 6, 85, 4, -72, -1, -4, 64, 17, 12, 12, 6, 85, 4, 18, 13, 13, 6, 85, 4, 9, 15, +15, 6, 85, 4, -72, -1, -38, 64, 22, 16, 16, 6, 85, 79, 4, 95, 4, -97, 4, -65, 4, -64, 4, 5, 4, +3, -106, 72, 43, 0, 0, -72, -1, -10, -76, 16, 16, 2, 85, 0, -72, -1, -6, -76, 12, 13, 2, 85, 0, -72, +-1, -17, -76, 16, 16, 6, 85, 0, -72, -1, -13, -76, 15, 15, 6, 85, 0, -72, -1, -7, 64, 14, 11, 13, 6, +85, 111, 0, -112, 0, 2, 0, 22, -65, 72, 43, 1, 43, 93, 43, 43, 43, 43, 43, 53, 43, 93, 43, 43, 43, +43, 43, 43, 43, 43, 52, -1, -1, 0, -120, -2, 81, 3, 24, 5, -70, 0, 38, 0, 76, 0, 0, 1, 7, 0, +77, 1, -34, 0, 0, 0, -92, 64, 15, 3, 2, 28, 64, 12, 12, 2, 85, 28, 64, 9, 10, 2, 85, 19, -72, +-1, -8, -76, 12, 13, 2, 85, 19, -72, -1, -64, -76, 11, 11, 2, 85, 19, -72, -1, -4, -76, 16, 16, 6, 85, +19, -72, -1, -6, -76, 13, 13, 6, 85, 19, -72, -1, -50, 64, 24, 11, 12, 6, 85, 96, 19, 112, 19, 2, 31, +19, 48, 19, 111, 19, -112, 19, -96, 19, -32, 19, 6, 19, 7, -72, 1, 44, -76, 72, 43, 1, 0, 4, -72, -1, +-8, -76, 12, 13, 2, 85, 4, -72, -1, -4, -76, 16, 16, 6, 85, 4, -72, -1, -8, -76, 15, 15, 6, 85, 4, +-72, -1, -6, 64, 20, 11, 13, 6, 85, 0, 4, 16, 4, 32, 4, 127, 4, -113, 4, 5, 4, 27, -120, 72, 43, +1, 43, 93, 43, 43, 43, 43, 53, 53, 43, 93, 113, 43, 43, 43, 43, 43, 43, 43, 53, 53, -1, -1, 0, 108, +0, 0, 4, -42, 5, -55, 0, 39, 0, 81, 0, -16, 0, 0, 1, 6, 0, -74, 0, 0, 0, 18, 64, 14, 0, +1, 0, 35, -16, 72, 39, 1, 1, 24, 35, 0, 72, 39, 43, 43, 0, 1, 0, -128, 3, -77, 1, -114, 5, -70, +0, 5, 0, 58, 64, 35, 3, 34, 26, 33, 52, 2, 34, 26, 33, 52, 2, 3, 0, 5, 4, 4, 1, 5, -18, +3, 2, 0, 2, -7, 4, -127, 47, 1, 1, 1, 25, 6, -99, 104, 24, 43, 78, 16, -12, 93, 77, -3, -19, 0, +63, 60, -19, 1, 17, 18, 23, 57, 49, 48, 43, 43, 19, 19, 55, 51, 7, 3, -128, 12, 52, -50, 53, 105, 3, +-77, 1, 18, -11, -11, -2, -18, -1, -1, 0, -128, 3, -77, 2, -87, 5, -70, 0, 38, 1, -115, 0, 0, 1, 7, +1, -115, 1, 27, 0, 0, 0, 42, 1, -79, 6, 2, 67, 84, 88, 27, -75, 1, 79, 7, 1, 7, 12, -72, 1, +127, 64, 15, 72, 43, 0, 79, 1, 95, 1, -112, 1, 3, 1, 12, 70, 72, 43, 43, 93, 53, 43, 93, 52, 89, +0, 4, 0, 97, -1, -54, 6, -75, 5, -45, 0, 25, 0, 29, 0, 41, 0, 53, 0, -57, 64, 41, 33, 0, 32, +1, 47, 13, -128, 0, 4, 32, 1, 32, 2, -122, 19, -122, 22, -126, 44, -114, 47, -114, 50, -126, 53, 8, 28, 29, +29, 63, 26, 27, 20, 26, 26, 27, 29, 26, 56, 39, 51, -68, 2, -66, 0, 33, 1, 101, 0, 45, 2, -66, 64, +22, 39, 9, 28, 27, 27, 10, 15, 14, 31, 14, 2, 14, 118, 17, 0, 0, 16, 0, 2, 0, -96, 23, -68, 2, +-66, 0, 4, 1, 101, 0, 17, 2, -66, 64, 10, 10, 3, 28, -24, 27, -96, 30, 48, 42, 36, -72, 2, -67, 64, +17, 42, 42, 30, 110, 0, 29, -7, 26, -82, 0, 14, 42, 13, 58, 0, 42, 1, -72, 1, 84, 64, 11, 20, 42, +63, 7, 1, 7, 25, 54, 113, -89, 24, 43, 78, 16, -12, 93, 77, -3, -12, -19, -12, -19, 25, 16, -12, 24, -19, +16, -12, -19, -3, -19, 25, 16, -12, 24, -19, 0, 63, -19, -3, -3, -28, 93, 16, -28, 93, 16, 60, 16, 60, 63, +-19, -3, -19, 16, -12, 60, -121, 5, 46, 43, 125, 16, -60, 49, 48, 1, 93, 0, 93, 1, 23, 6, 6, 35, 34, +38, 53, 52, 54, 51, 50, 22, 23, 7, 38, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 3, 1, 51, 1, 1, +52, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 2, 108, +123, 20, -89, 122, -104, -71, -70, -104, 122, -103, 21, 122, 17, 89, 63, 95, 119, 115, 92, 74, 99, -58, 3, 34, -110, +-4, -31, 1, -48, -64, -100, -102, -62, -65, -99, -101, -63, -127, 125, 94, 94, 125, 125, 94, 94, 125, 3, -20, 16, -128, +-112, -57, -70, -64, -58, 122, 112, 20, 75, 76, -120, -108, -107, -120, 90, -4, 61, 6, 9, -7, -9, 1, -87, -69, -55, +-55, -80, -58, -55, -56, -68, -114, -114, -114, -110, -118, -114, -114, 0, 0, 2, 0, 15, -1, -24, 2, -122, 5, -45, 0, +26, 0, 38, 0, 125, 64, 31, 79, 40, 1, 25, 26, 26, 11, 11, 12, 11, 10, 25, 24, 27, 11, 26, 0, 25, +1, 4, 12, 24, 1, 60, 25, 25, 21, 5, 19, -7, 18, -72, 2, 122, 64, 40, 15, 41, 21, 13, 34, 42, 5, +5, 19, 18, 39, 8, 41, 30, 108, 38, 38, 12, 2, 12, 41, 0, 24, 32, 24, -112, 24, -96, 24, -80, 24, -64, +24, 6, 24, -97, 39, -87, 122, 24, 43, 16, -10, 93, -19, 60, 16, 60, 16, -10, -3, -12, 60, 0, 63, -19, 63, +-19, -3, -19, 17, 18, 57, 47, -19, 1, 17, 18, 23, 57, 57, 57, 14, 16, 60, 8, 16, 60, -121, 4, 125, 16, +-60, 49, 48, 1, 93, 19, 55, 17, 52, 54, 51, 50, 22, 21, 20, 2, 7, 17, 20, 22, 51, 50, 54, 55, 21, +6, 35, 34, 38, 53, 53, 7, 19, 54, 54, 53, 52, 39, 38, 35, 34, 7, 6, 21, 15, -79, 123, 111, 96, 124, +120, -91, 29, 27, 26, 68, 105, 111, 114, 92, 107, 79, -8, 98, 47, 26, 20, 30, 31, 15, 23, 1, -90, -21, 1, +-57, -30, -103, -126, 109, 92, -2, -9, -26, -2, 97, 89, 43, 33, 74, -94, 87, 114, 127, -31, 98, 2, 43, -87, -128, +55, 61, 34, 25, 26, 42, -79, 0, 0, 2, 0, -110, 0, 0, 4, 66, 3, -80, 0, 3, 0, 7, 0, 0, 19, +33, 17, 33, 19, 17, 33, 17, -110, 3, -80, -4, 80, 76, 3, 24, 3, -80, -4, 80, 3, 100, -4, -24, 3, 24, +0, 1, 0, -125, 1, -67, 2, 82, 3, -116, 0, 3, 0, 0, 1, 17, 33, 17, 2, 82, -2, 49, 3, -116, -2, +49, 1, -49, 0, 2, 0, -125, 1, -67, 2, 82, 3, -116, 0, 3, 0, 7, 0, 0, 1, 17, 33, 17, 5, 33, +17, 33, 2, 82, -2, 49, 1, -125, -2, -55, 1, 55, 3, -116, -2, 49, 1, -49, 76, -2, -55, 0, 0, 1, 0, +-78, 0, -119, 4, 35, 3, -6, 0, 13, 0, 0, 1, 50, 22, 22, 21, 20, 0, 35, 34, 0, 53, 52, 54, 54, +2, 107, 110, -44, 118, -2, -2, -74, -73, -2, -2, 118, -44, 3, -6, 114, -44, 114, -73, -2, -2, 1, 2, -73, 115, +-45, 114, 0, 0, 2, 0, 112, 1, -86, 2, 102, 3, -96, 0, 11, 0, 23, 0, 0, 1, 50, 22, 21, 20, 6, +35, 34, 38, 53, 52, 54, 23, 34, 6, 21, 20, 22, 51, 50, 54, 53, 52, 38, 1, 107, 104, -109, -109, 104, 104, +-109, -110, 105, 73, 102, 103, 72, 72, 103, 102, 3, -96, -109, 104, 104, -109, -109, 104, 104, -109, 76, 103, 72, 73, 102, +102, 73, 72, 103, -1, -1, -1, -3, 0, 0, 5, 89, 6, -66, 2, 38, 0, 36, 0, 0, 1, 7, 0, -40, 1, +74, 1, 95, 0, 38, 64, 23, 2, 0, 15, 1, 16, 15, -48, 15, 2, 32, 15, 48, 15, 2, 0, 15, 18, 12, +12, 65, 2, 1, 15, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 114, 53, -1, -1, 0, 74, -1, -24, 4, +28, 5, 95, 2, 38, 0, 68, 0, 0, 1, 7, 0, -40, 0, -11, 0, 0, 0, 26, 64, 13, 2, 112, 56, 1, +0, 56, 59, 2, 2, 65, 2, 1, 56, -71, 2, -61, 0, 41, 0, 43, 1, 43, 93, 53, -1, -1, 0, 102, -1, +-25, 5, 118, 7, 38, 2, 38, 0, 38, 0, 0, 1, 7, 0, -42, 1, -80, 1, 100, 0, 22, 64, 10, 1, 0, +32, 35, 8, 15, 65, 1, 1, 32, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 80, -1, -24, 3, +-19, 5, -62, 2, 38, 0, 70, 0, 0, 1, 7, 0, -42, 0, -6, 0, 0, 0, 22, 64, 10, 1, 0, 29, 32, +7, 14, 65, 1, 1, 29, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 102, -1, -25, 5, 118, 7, +26, 2, 38, 0, 38, 0, 0, 1, 7, 0, -38, 1, -80, 1, -112, 0, 21, 64, 9, 1, 30, 11, 100, 72, 43, +1, 1, 30, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, 0, -1, -1, 0, 80, -1, -24, 3, -19, 5, -118, 2, +38, 0, 70, 0, 0, 1, 7, 0, -38, 0, -16, 0, 0, 0, 41, -77, 1, 1, 1, 27, -71, 2, 34, 0, 41, +0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 27, 30, 11, 11, 65, 43, 27, -73, 111, 27, 1, 27, 19, 40, +72, 43, 43, 93, 89, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 6, -55, 2, 38, 0, 40, 0, 0, 1, 7, +0, -40, 1, -127, 1, 106, 0, 22, 64, 10, 1, 0, 12, 15, 1, 2, 65, 1, 1, 12, -71, 2, 33, 0, 41, +0, 43, 1, 43, 53, -1, -1, 0, 75, -1, -24, 4, 30, 5, 95, 2, 38, 0, 72, 0, 0, 1, 7, 0, -40, +0, -32, 0, 0, 0, 22, 64, 10, 2, 0, 30, 33, 7, 15, 65, 2, 1, 30, -71, 2, -61, 0, 41, 0, 43, +1, 43, 53, -1, -1, 0, -94, 0, 0, 4, -24, 7, 34, 2, 38, 0, 40, 0, 0, 1, 7, 0, -39, 1, 107, +1, 106, 0, 37, -77, 1, 1, 1, 16, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, +19, 13, 1, 2, 65, 43, 27, -76, 19, 5, 70, 72, 43, 43, 89, 53, 0, -1, -1, 0, 75, -1, -24, 4, 30, +5, -72, 2, 38, 0, 72, 0, 0, 1, 7, 0, -39, 0, -12, 0, 0, 0, 21, 64, 10, 2, 1, 37, 22, 0, +72, 39, 2, 1, 34, -71, 2, 34, 0, 41, 0, 43, 1, 43, 0, -1, -1, 0, -94, 0, 0, 4, -24, 6, -12, +2, 38, 0, 40, 0, 0, 1, 7, 0, -38, 1, -127, 1, 106, 0, 22, 64, 10, 1, 0, 12, 15, 1, 2, 65, +1, 1, 12, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 75, -1, -24, 4, 30, 5, -118, 2, 38, +0, 72, 0, 0, 1, 7, 0, -38, 0, -6, 0, 0, 0, 22, 64, 10, 2, 0, 30, 33, 7, 15, 65, 2, 1, +30, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 109, -1, -25, 5, -71, 7, 33, 2, 38, 0, 42, +0, 0, 1, 7, 0, -42, 2, 14, 1, 95, 0, 37, -77, 1, 1, 1, 40, -71, 2, 33, 0, 41, 0, 43, 1, +-79, 6, 2, 67, 84, 88, -75, 0, 40, 43, 14, 14, 65, 43, 27, -76, 38, 14, 0, 72, 43, 43, 89, 53, 0, +-1, -1, 0, 66, -2, 81, 3, -22, 5, -62, 2, 38, 0, 74, 0, 0, 1, 7, 0, -42, 0, -56, 0, 0, 0, +22, 64, 10, 2, 0, 45, 48, 15, 23, 65, 2, 1, 45, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, +0, 109, -1, -25, 5, -71, 6, -23, 2, 38, 0, 42, 0, 0, 1, 7, 0, -38, 2, 14, 1, 95, 0, 22, 64, +10, 1, 0, 38, 41, 10, 2, 65, 1, 1, 38, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 66, +-2, 81, 3, -22, 5, -118, 2, 38, 0, 74, 0, 0, 1, 7, 0, -38, 0, -28, 0, 0, 0, 21, 64, 9, 2, +43, 41, 44, 72, 43, 2, 1, 43, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, 0, -1, -1, 0, 109, -2, 91, +5, -71, 5, -45, 2, 38, 0, 42, 0, 0, 1, 7, 0, -36, 2, 20, 0, 0, 0, 19, 64, 12, 1, 0, 49, +44, 10, 2, 65, 1, 1, 39, 8, 41, 0, 43, 1, 43, 53, 0, 0, 3, 0, 66, -2, 81, 3, -22, 6, 40, +0, 9, 0, 36, 0, 48, 1, 112, 64, 48, 42, 18, 38, 26, 41, 41, 38, 45, 59, 18, 52, 26, 75, 18, 68, +26, 86, 15, 91, 18, 101, 15, 106, 18, 12, 53, 39, 53, 47, 68, 39, 68, 47, 83, 39, 83, 47, 97, 39, 98, +47, 8, 6, 49, 7, -110, 9, 0, -72, 2, 48, -78, 1, 1, 2, -72, 2, 84, -76, 25, 29, 28, 6, 27, -72, +2, 127, -76, 46, 28, 25, 7, 11, -72, 2, -86, 64, 16, 32, 10, 48, 10, 96, 10, 112, 10, -128, 10, -64, 10, +-48, 10, 7, 10, -72, 2, 125, 64, 11, 13, 28, 34, 15, 17, 69, 40, 28, 19, 10, 6, -70, 2, 91, 0, 7, +1, 12, 64, 36, 9, 9, 1, 126, 2, 2, 29, 22, 28, 27, 51, 43, 51, 17, 37, 30, 30, 50, 64, 11, 11, +2, 85, 50, 64, 13, 13, 2, 85, 29, 18, 16, 16, 2, 85, 29, -72, -1, -12, 64, 17, 15, 15, 2, 85, 29, +6, 14, 14, 2, 85, 29, 22, 13, 13, 2, 85, 29, -72, -1, -22, 64, 11, 11, 11, 6, 85, 29, 18, 16, 16, +6, 85, 29, -72, -1, -18, -76, 12, 12, 6, 85, 29, -72, -1, -4, 64, 81, 13, 13, 6, 85, -48, 29, 1, 16, +29, 64, 29, 96, 29, -128, 29, 4, 29, 116, 22, 11, 37, 10, 34, 37, 36, 22, 32, 11, 11, 2, 85, 22, 26, +12, 12, 2, 85, 22, 34, 13, 13, 2, 85, 22, 28, 11, 11, 6, 85, 22, 12, 13, 13, 6, 85, 22, 26, 12, +12, 6, 85, -65, 22, -49, 22, -33, 22, -1, 22, 4, 31, 22, 63, 22, 79, 22, 3, 22, 25, 49, 52, -71, 1, +10, 0, 24, 43, 78, 16, -12, 93, 113, 43, 43, 43, 43, 43, 43, 77, -19, -12, -19, 16, -3, 93, 113, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 60, 16, -3, -12, -11, 60, 17, 18, 57, 47, -19, 57, 47, -12, -28, 0, 63, +-19, -28, 63, -19, -3, 93, -28, 63, -19, -28, 63, 60, 16, -2, 60, 16, -3, 60, -10, -19, 49, 48, 1, 93, 0, +93, 1, 21, 35, 53, 52, 54, 55, 23, 6, 7, 1, 23, 22, 51, 50, 54, 54, 53, 6, 35, 34, 2, 53, 52, +18, 51, 50, 23, 53, 51, 17, 20, 6, 6, 35, 34, 38, 19, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, +2, 120, -47, 74, 94, 54, 93, 16, -2, 78, -81, 17, -29, 121, -117, 38, 117, -82, -36, -14, -14, -36, -70, 122, -90, +92, -27, -101, -42, -42, -103, -86, 121, -127, -93, -101, -116, -126, -98, 5, 65, -81, 117, 112, -116, 37, 83, 39, 109, -6, +103, 26, -88, 96, -112, -75, -117, 1, 59, -36, -15, 1, 54, -104, -128, -4, 106, -25, -38, 126, -69, 3, 26, -43, -68, +-59, -54, -86, -37, -49, 0, -1, -1, 0, -92, 0, 0, 5, 34, 7, 44, 2, 38, 0, 43, 0, 0, 1, 7, 0, +-42, 1, -82, 1, 106, 0, 22, 64, 10, 1, 0, 14, 17, 1, 6, 65, 1, 1, 14, -71, 2, 33, 0, 41, 0, +43, 1, 43, 53, -1, -1, 0, -121, 0, 0, 3, -24, 7, 44, 2, 38, 0, 75, 0, 0, 1, 7, 0, -42, 1, +44, 1, 106, 0, 21, 64, 9, 1, 21, 5, 0, 72, 43, 1, 1, 23, -71, 2, 33, 0, 41, 0, 43, 1, 43, +53, 0, 0, 2, 0, 31, 0, 0, 5, -89, 5, -70, 0, 19, 0, 23, 1, 6, -71, 0, 25, -1, -64, 64, 44, +19, 21, 52, 47, 25, 1, 17, 21, 20, 6, 4, 18, 0, 3, 4, 3, 19, 23, 8, 6, 2, 20, 1, 11, 2, +30, 12, 1, 1, 4, 22, 21, 30, 16, 17, 17, 19, 8, 4, 2, 15, 19, 8, 12, -72, 2, 93, 64, 9, 15, +32, 14, 14, 9, 15, 8, 32, 9, -72, -1, -18, -76, 15, 15, 2, 85, 9, -72, -1, -14, 64, 11, 13, 13, 2, +85, 9, 16, 12, 12, 2, 85, 9, -72, -1, -64, 64, 19, 11, 11, 6, 85, 9, 1, 12, 12, 6, 85, 9, 93, +47, 25, -128, 25, 2, 25, 1, -72, 2, 93, 64, 11, 19, 5, 18, 32, 19, 32, 16, 16, 2, 85, 19, -72, -1, +-10, -76, 15, 15, 2, 85, 19, -72, -1, -10, -76, 13, 13, 2, 85, 19, -72, -1, -6, 64, 11, 12, 12, 2, 85, +19, 48, 11, 11, 6, 85, 19, -72, -1, -9, -76, 12, 12, 6, 85, 19, -72, -1, -8, 64, 19, 13, 13, 6, 85, +19, 93, 24, 32, 25, 1, 32, 25, 80, 25, 96, 25, 112, 25, 4, 93, 113, 16, -10, 43, 43, 43, 43, 43, 43, +43, -3, 60, 16, -28, 16, 93, -10, 43, 43, 43, 43, 43, -3, 60, 16, 60, 16, -19, -28, 0, 63, 60, 63, 60, +18, 57, 47, 60, -3, 60, 17, 57, 47, 60, -3, 60, 17, 51, 17, 51, 1, 17, 51, 17, 23, 51, 17, 23, 51, +49, 48, 1, 93, 43, 19, 35, 53, 51, 53, 51, 21, 33, 53, 51, 21, 51, 21, 35, 17, 35, 17, 33, 17, 35, +19, 21, 33, 53, -92, -123, -123, -62, 2, -6, -62, -123, -123, -62, -3, 6, -62, -62, 2, -6, 4, 75, -108, -37, -37, +-37, -37, -108, -5, -75, 2, -77, -3, 77, 4, 75, -21, -21, 0, 1, 0, 6, 0, 0, 3, -24, 5, -70, 0, 25, +1, 102, -75, 19, 34, 16, 23, 52, 27, -72, -1, -64, -77, 21, 23, 52, 14, -72, -1, -64, -77, 9, 10, 52, 21, +-72, -1, -34, 64, 11, 23, 25, 52, 37, 11, 53, 10, 69, 10, 3, 10, -72, -1, -32, -74, 23, 25, 52, 10, 24, +7, 2, -72, -1, -64, 64, 50, 30, 43, 52, 2, -44, 8, 1, 1, 12, 4, 0, 20, 28, 12, 7, 17, 25, 10, +7, 32, 1, 1, 1, 18, 37, 27, 64, 11, 11, 2, 85, 27, 64, 16, 16, 2, 85, 15, 40, 16, 16, 2, 85, +15, 20, 14, 14, 2, 85, 15, -72, -1, -20, 64, 17, 13, 13, 2, 85, 15, 4, 12, 12, 2, 85, 15, 26, 11, +11, 2, 85, 15, -72, -1, -10, 64, 11, 11, 11, 6, 85, 15, 20, 16, 16, 6, 85, 15, -72, -1, -8, 64, 11, +13, 13, 6, 85, 15, 10, 15, 15, 6, 85, 15, -72, -1, -10, 64, 18, 12, 12, 6, 85, 15, 64, 51, 54, 52, +-1, 15, 1, -64, 15, 1, 15, 78, 27, -72, -1, -64, 64, 23, 52, 54, 52, -80, 27, -16, 27, 2, 112, 27, -96, +27, -80, 27, -1, 27, 4, 27, 5, 24, 37, 4, 25, -72, -1, -6, -76, 16, 16, 2, 85, 25, -72, -1, -6, 64, +23, 14, 14, 2, 85, 25, 4, 12, 12, 2, 85, 25, 8, 11, 11, 2, 85, 25, 4, 11, 11, 6, 85, 25, -72, +-1, -6, 64, 17, 15, 15, 6, 85, 25, 2, 12, 12, 6, 85, 25, 2, 13, 13, 6, 85, 25, -72, -1, -64, 64, +18, 51, 54, 52, -16, 25, 1, 0, 25, 32, 25, -48, 25, -32, 25, 4, 25, 78, 26, 16, -10, 93, 113, 43, 43, +43, 43, 43, 43, 43, 43, 43, 60, -3, 60, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, -19, 47, 93, 47, 0, 63, 60, 63, -19, 63, 18, 57, 47, 60, -3, 43, 60, 1, 17, 51, +49, 48, 0, 43, 93, 43, 43, 1, 43, 43, 19, 35, 53, 51, 53, 51, 21, 33, 21, 33, 17, 54, 51, 50, 22, +17, 17, 35, 17, 16, 35, 34, 6, 21, 17, 35, -121, -127, -127, -76, 1, 111, -2, -111, 122, -58, -119, -28, -76, -31, +123, -99, -76, 4, -81, -122, -123, -123, -122, -2, -3, -110, -104, -2, -5, -3, 95, 2, -95, 1, 2, -95, -67, -3, -69, +0, -1, -1, -1, -64, 0, 0, 2, 94, 7, 20, 2, 38, 0, 44, 0, 0, 1, 7, 0, -41, -1, -70, 1, 106, +0, 22, 64, 10, 1, 0, 4, 16, 1, 2, 65, 1, 1, 19, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, +-1, -1, -46, 0, 0, 2, 112, 5, -86, 2, 38, 0, -43, 0, 0, 1, 6, 0, -41, -52, 0, 0, 22, 64, 10, +1, 0, 4, 16, 1, 2, 65, 1, 1, 19, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, -1, -28, 0, +0, 2, 84, 6, -81, 2, 38, 0, 44, 0, 0, 1, 7, 0, -40, -1, -57, 1, 80, 0, 22, 64, 10, 1, 0, +4, 7, 1, 2, 65, 1, 1, 7, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, -1, -23, 0, 0, 2, +89, 5, 95, 2, 38, 0, -43, 0, 0, 1, 6, 0, -40, -52, 0, 0, 22, 64, 10, 1, 0, 4, 7, 1, 2, +65, 1, 1, 7, -71, 2, -61, 0, 41, 0, 43, 1, 43, 53, -1, -1, -1, -1, 0, 0, 2, 78, 7, 8, 2, +38, 0, 44, 0, 0, 1, 7, 0, -39, -1, -47, 1, 80, 0, 22, 64, 10, 1, 0, 11, 5, 1, 2, 65, 1, +1, 8, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, -1, -6, 0, 0, 2, 73, 5, -72, 2, 38, 0, +-43, 0, 0, 1, 6, 0, -39, -52, 0, 0, 22, 64, 10, 1, 0, 11, 5, 1, 2, 65, 1, 1, 8, -71, 2, +34, 0, 41, 0, 43, 1, 43, 53, 0, 1, 0, -93, -2, 86, 2, 89, 5, -70, 0, 18, 0, -16, -71, 0, 5, +2, 93, 64, 13, 10, 15, 18, 8, 16, 2, 7, 8, 0, 0, 18, 15, 2, -72, -1, -64, -77, 24, 26, 52, 2, +-72, 2, 93, -75, 32, 13, 1, 13, 17, 20, -72, -1, -64, -76, 13, 13, 2, 85, 20, -72, -1, -64, -77, 56, 61, +52, 20, -72, -1, -64, -77, 51, 52, 52, 20, -72, -1, -64, -77, 45, 48, 52, 20, -72, -1, -64, -77, 40, 41, 52, +20, -72, -1, -64, -77, 35, 37, 52, 20, -72, -1, -64, -77, 29, 30, 52, 20, -72, -1, -64, -77, 24, 26, 52, 20, +-72, -1, -64, 64, 40, 13, 16, 52, 32, 20, -112, 20, -81, 20, 3, 18, 32, 0, 15, -113, 15, -96, 15, -80, 15, +4, 47, 15, 64, 15, 80, 15, -33, 15, -16, 15, 5, 18, 15, 24, 16, 16, 2, 85, 15, -72, -1, -20, -76, 15, +15, 2, 85, 15, -72, -1, -18, -76, 13, 13, 2, 85, 15, -72, -1, -10, 64, 20, 12, 12, 2, 85, 15, 32, 11, +11, 6, 85, 32, 15, -113, 15, -112, 15, 3, 15, -94, 19, 16, -10, 93, 43, 43, 43, 43, 43, 67, 92, 88, -78, +-128, 15, 1, 1, 93, 89, 113, 114, -3, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 60, 47, 93, -19, 43, 17, +18, 57, 47, 47, 60, 0, 63, 63, 63, -19, 49, 48, 33, 6, 21, 20, 22, 51, 50, 55, 21, 6, 35, 34, 38, +53, 52, 55, 17, 51, 17, 1, 62, 29, 82, 62, 77, 91, 119, 104, 91, 124, 35, -62, 78, 62, 67, 85, 46, 119, +61, 118, 103, 80, 126, 5, -71, -6, 70, 0, 0, 2, 0, 102, -2, 87, 2, 28, 5, -70, 0, 3, 0, 22, 0, +-29, 64, 85, 24, 54, 11, 11, 2, 85, 79, 24, -112, 24, -96, 24, -80, 24, -64, 24, -33, 24, -16, 24, 7, 0, +24, 31, 24, 112, 24, -128, 24, -97, 24, -80, 24, -64, 24, -33, 24, -21, 4, -32, 24, -1, 24, 11, 31, 24, 1, +0, 126, 1, 0, 20, 6, 22, 19, 10, 9, 69, 14, 15, 12, 32, 11, 1, 11, 4, 4, 22, 19, 6, 69, 32, +17, 1, 17, 2, 3, 3, 22, 1, 0, 0, 22, 37, 19, -72, -1, -8, -76, 16, 16, 2, 85, 19, -72, -1, -6, +64, 23, 14, 14, 2, 85, 19, 4, 12, 12, 2, 85, 19, 10, 11, 11, 2, 85, 19, 20, 11, 11, 6, 85, 19, +-72, -1, -22, -76, 16, 16, 6, 85, 19, -72, -1, -2, -76, 13, 13, 6, 85, 19, -72, -1, -4, 64, 34, 12, 12, +6, 85, 0, 19, -97, 19, -96, 19, -80, 19, -64, 19, -32, 19, 6, -64, 19, -16, 19, 2, 0, 19, 32, 19, -48, +19, -32, 19, 4, 19, 78, 23, 16, -10, 93, 113, 114, 43, 43, 43, 43, 43, 43, 43, 43, -19, 60, 16, 60, 16, +60, 16, 60, 47, 93, -19, 17, 18, 57, 47, 47, 93, 60, 0, 63, -19, 63, 60, 63, 63, -3, 49, 48, 1, 93, +114, 113, 43, 19, 53, 51, 21, 3, 6, 21, 20, 22, 51, 50, 55, 21, 6, 35, 34, 38, 53, 52, 55, 17, 51, +17, -120, -76, 59, 29, 82, 62, 77, 91, 117, 104, 101, 116, 34, -76, 4, -21, -49, -49, -5, 21, 78, 62, 67, 85, +46, 119, 60, 122, 98, 65, -116, 4, 38, -5, -38, 0, -1, -1, 0, 55, -1, -25, 4, 84, 7, 44, 2, 38, 0, +45, 0, 0, 1, 7, 0, -42, 1, -62, 1, 106, 0, 22, 64, 10, 1, 0, 20, 23, 8, 11, 65, 1, 1, 20, +-71, 2, 33, 0, 41, 0, 43, 1, 43, 53, 0, 2, -1, -94, -2, 81, 2, 32, 5, -62, 0, 6, 0, 20, 1, +37, 64, 43, 4, 8, 3, 18, 32, 8, 32, 17, 32, 18, 59, 7, 51, 8, 50, 17, 72, 11, -122, 8, 10, 7, +19, 8, 14, 10, 0, 100, 4, 4, 15, 3, 31, 3, 2, 3, -121, 2, 5, 6, 6, 1, 2, -72, 2, 34, 64, +11, 14, 6, 10, 28, 19, 15, 5, 60, 6, 61, 4, -72, -1, -64, 64, 33, 9, 12, 52, 4, 100, 0, 100, 3, +127, 1, 60, 2, 32, 16, 16, 6, 85, 2, 32, 11, 11, 6, 85, 15, 2, 31, 2, 47, 2, 63, 2, 4, 2, +-72, -1, -64, 64, 25, 11, 23, 52, 0, 2, 63, 2, 127, 2, -1, 2, 4, 2, -112, 22, 1, 22, 23, 23, 26, +16, 15, 37, 13, 14, -72, -1, -6, 64, 67, 14, 14, 2, 85, 14, 16, 13, 13, 2, 85, 14, 16, 12, 12, 2, +85, 14, 12, 11, 11, 2, 85, 14, 30, 11, 11, 6, 85, 14, 12, 16, 16, 6, 85, 14, 8, 12, 12, 6, 85, +14, 12, 13, 13, 6, 85, -112, 14, 1, 31, 14, 63, 14, 79, 14, 3, 14, 25, 21, 8, 7, 21, 20, 8, 71, +80, 24, 43, 67, 121, 64, 12, 11, 18, 11, 18, 13, 27, 1, 12, 17, 10, 27, 0, 0, 43, 1, 43, -127, 17, +51, 51, 78, 16, -12, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 60, 77, -3, 60, 78, 69, 101, 68, -26, 113, +25, 47, 93, 43, 113, 43, 43, 24, 77, -3, 25, -10, 24, -3, -3, 43, 25, -10, 24, -19, 0, 63, -19, 63, 63, +60, 60, 16, 60, 16, -3, 93, 60, 16, -19, 17, 18, 57, 18, 57, 49, 48, 1, 93, 19, 7, 35, 19, 51, 19, +35, 1, 55, 22, 51, 50, 54, 53, 17, 51, 17, 20, 6, 35, 34, -26, 113, -51, -40, -64, -32, -53, -2, 77, 34, +52, 33, 63, 46, -76, 117, -106, 73, 5, 84, -86, 1, 24, -2, -24, -7, -70, -103, 14, 83, -120, 4, 92, -5, -96, +-59, -80, 0, -1, -1, 0, -106, -2, 91, 5, 82, 5, -70, 2, 38, 0, 46, 0, 0, 1, 7, 1, -18, 1, -52, +0, 0, 0, 29, -79, 1, 22, -72, -1, -64, 64, 14, 9, 100, 6, 85, 32, 22, 1, 0, 22, 17, 0, 5, 65, +14, 0, 47, 1, 43, 93, 43, 53, 0, -1, -1, 0, -120, -2, 91, 3, -8, 5, -70, 2, 38, 0, 78, 0, 0, +1, 7, 1, -18, 1, 33, 0, 0, 0, 21, 64, 13, 1, 32, 22, -112, 22, 2, 0, 22, 17, 0, 5, 65, 14, +0, 47, 1, 43, 93, 53, 0, 0, 1, 0, -122, 0, 0, 3, -10, 4, 38, 0, 11, 1, 91, -71, 0, 6, -1, +-24, -76, 12, 12, 2, 85, 10, -72, -1, -24, -76, 12, 12, 2, 85, 9, -72, -1, -24, 64, 76, 12, 12, 2, 85, +23, 3, 1, 68, 3, 1, 6, 6, 4, 9, 2, 7, 6, 37, 6, 47, 7, 47, 8, -128, 13, -73, 5, -58, 5, +-64, 13, -27, 6, -27, 9, -32, 13, -6, 4, -11, 6, 13, 63, 13, 90, 4, 89, 5, 105, 4, 105, 5, -104, 6, +-88, 6, 7, 5, 6, 27, 4, 24, 9, 40, 9, 56, 9, 88, 4, 89, 5, 7, 74, 6, 1, 3, -72, -1, -12, +64, 16, 10, 9, 16, 2, 6, 6, 7, 9, 10, 9, 8, 10, 5, 9, 8, 8, -72, -1, -8, 64, 64, 11, 12, +6, 85, 8, 37, 7, 6, 20, 7, 7, 6, 3, 4, 4, 37, 5, 10, 20, 5, 5, 10, 101, 10, 1, 10, 9, +6, 3, 4, 4, 1, 6, 5, 4, 6, 11, 8, 8, 7, 10, -85, 6, 1, 10, 9, 8, 6, 5, 4, 3, 7, +32, 7, -128, 7, -65, 7, 3, 7, 2, 11, 37, 0, -72, -1, -8, -76, 16, 16, 2, 85, 0, -72, -1, -6, 64, +17, 14, 14, 2, 85, 0, 6, 12, 12, 2, 85, 0, 6, 11, 11, 2, 85, 0, -72, -1, -8, -76, 16, 16, 6, +85, 0, -72, -1, -18, -76, 15, 15, 6, 85, 0, -72, -1, -8, -76, 12, 13, 6, 85, 0, -72, -1, -64, 64, 18, +51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 12, 16, -10, 93, 113, 43, 43, 43, +43, 43, 43, 43, 43, -3, 60, 25, 47, 93, 23, 57, 113, 0, 24, 63, 60, 16, 60, 63, 60, 63, 17, 23, 57, +114, -121, 5, 46, 43, 4, 125, 16, -60, -121, 5, 46, 24, 43, 43, 14, 125, 16, -60, 7, 8, 16, 60, 8, 60, +0, 23, 56, 49, 48, 56, 1, 114, 113, 93, 93, 0, 93, 114, 113, 43, 43, 43, 51, 17, 51, 17, 1, 51, 1, +1, 35, 1, 7, 17, -122, -76, 1, -86, -23, -2, 106, 1, -65, -34, -2, -95, 127, 4, 38, -2, 80, 1, -80, -2, +118, -3, 100, 2, 31, 122, -2, 91, 0, -1, -1, 0, -106, -2, 91, 4, 42, 5, -70, 2, 38, 0, 47, 0, 0, +1, 7, 1, -18, 1, 84, 0, 0, 0, 19, 64, 11, 1, 32, 22, 1, 0, 16, 11, 0, 5, 65, 8, 0, 47, +1, 43, 93, 53, 0, -1, -1, -1, -3, -2, 91, 1, -82, 5, -70, 2, 38, 0, 79, 0, 0, 1, 6, 1, -18, +-110, 0, 0, 22, -74, 1, 79, 4, 1, 31, 4, 1, -72, -1, -28, -76, 4, 4, 0, 0, 65, 1, 43, 93, 113, +53, -1, -1, 0, -100, -2, 91, 5, 31, 5, -70, 2, 38, 0, 49, 0, 0, 1, 7, 1, -18, 1, -26, 0, 0, +0, 19, 64, 11, 1, 32, 20, 1, 0, 20, 15, 0, 5, 65, 12, 0, 47, 1, 43, 93, 53, 0, -1, -1, 0, +-121, -2, 91, 3, -26, 4, 62, 2, 38, 0, 81, 0, 0, 1, 7, 1, -18, 0, -6, 0, 0, 0, 14, -73, 1, +0, 33, 28, 1, 12, 65, 25, 0, 47, 1, 43, 53, 0, 1, 0, -91, -1, -25, 5, 93, 5, -45, 0, 29, 0, +-4, 64, 94, 59, 7, 52, 11, 63, 22, 65, 11, 105, 19, 108, 22, 123, 3, 117, 6, 114, 7, 117, 22, -117, 3, +-101, 3, 12, 5, 3, 5, 25, 20, 3, 20, 25, 36, 3, 36, 19, 47, 22, 113, 2, -126, 2, -107, 2, -92, 2, +-92, 3, -77, 2, -74, 3, -64, 2, -48, 2, 16, 15, 14, 14, 12, 15, 14, 23, 30, 5, 3, 1, 0, 2, 15, +14, 17, 30, 12, 9, 28, 29, 8, 15, 47, 14, 1, 14, 21, 38, 9, 36, 16, 16, 2, 85, 9, -72, -1, -44, +-76, 13, 13, 2, 85, 9, -72, -1, -16, -76, 11, 11, 2, 85, 9, -72, -1, -20, -76, 13, 13, 6, 85, 9, -72, +-1, -12, 64, 20, 11, 12, 6, 85, 0, 9, 1, 9, 86, 31, 1, 28, 32, 29, 32, 16, 16, 2, 85, 29, -72, +-1, -10, -76, 15, 15, 2, 85, 29, -72, -1, -10, -76, 13, 13, 2, 85, 29, -72, -1, -6, -76, 12, 12, 2, 85, +29, -72, -1, -12, -76, 15, 15, 6, 85, 29, -72, -1, -8, -76, 13, 13, 6, 85, 29, -72, -1, -10, -74, 12, 12, +6, 85, 29, 93, 30, 16, -3, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, -10, 93, 43, 43, 43, 43, 43, -19, +47, 93, 47, 0, 63, 60, 63, -19, 47, 47, 63, 60, 63, -19, 1, 17, 51, 0, 17, 51, 17, 51, 49, 48, 0, +93, 1, 93, 19, 51, 21, 54, 54, 51, 50, 22, 18, 17, 16, 0, 35, 34, 39, 55, 22, 51, 50, 54, 18, 53, +16, 33, 34, 6, 6, 21, 17, 35, -91, -60, 115, -30, 125, -75, -27, -120, -2, -4, -36, 127, 121, 87, 96, 65, 77, +-126, 76, -2, 107, -123, -55, 76, -60, 5, -70, -74, -124, 75, -94, -2, -49, -2, -14, -2, 118, -2, 127, 72, -103, 52, +-127, 1, 7, -47, 2, 67, 125, -63, -47, -4, -33, 0, 0, 1, 0, -117, -2, 81, 3, -22, 4, 62, 0, 29, 1, +60, 64, 74, 36, 24, 52, 25, 68, 25, -32, 24, -27, 25, 5, 21, 28, -44, 17, -46, 18, -30, 18, 4, -123, 18, +-99, 15, -84, 15, -86, 18, -68, 15, 5, 6, 18, 5, 28, 114, 18, -119, 15, -128, 17, 5, 7, 7, 6, 6, 9, +28, 4, 15, 21, 10, 16, 28, 26, 7, 23, 22, 6, 18, 16, 20, 12, 13, 1, 13, 37, 0, 18, 16, 16, 2, +85, 0, -72, -1, -22, 64, 11, 13, 13, 2, 85, 0, 6, 12, 12, 2, 85, 0, -72, -1, -10, -76, 11, 11, 2, +85, 0, -72, -1, -12, 64, 11, 11, 11, 6, 85, 0, 26, 16, 16, 6, 85, 0, -72, -1, -7, -76, 13, 13, 6, +85, 0, -72, -1, -10, 64, 11, 12, 12, 6, 85, -1, 0, 1, -1, 0, 1, 0, -72, -1, -64, 64, 28, 51, 54, +52, -80, 0, -16, 0, 2, 112, 0, -96, 0, -80, 0, -64, 0, 4, 0, 69, 31, 24, 23, -102, 19, 20, 37, 22, +21, -72, -1, -8, 64, 17, 16, 16, 2, 85, 21, 6, 12, 12, 2, 85, 21, 4, 11, 11, 6, 85, 21, -72, -1, +-6, -76, 16, 16, 6, 85, 21, -72, -1, -6, 64, 17, 15, 15, 6, 85, 21, 2, 12, 12, 6, 85, 21, 4, 13, +13, 6, 85, 21, -72, -1, -64, 64, 21, 51, 54, 52, -16, 21, 1, 0, 21, 32, 21, -48, 21, -32, 21, 4, 21, +78, 30, 18, 13, 20, 17, 18, 57, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, -12, 60, +16, -10, 93, 113, 43, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, -19, 60, 16, 60, 0, 17, 18, 57, 63, 60, +63, -19, 63, 63, -19, 51, 47, 51, 47, 49, 48, 1, 93, 93, 93, 0, 93, 1, 17, 20, 6, 35, 34, 39, 55, +22, 51, 50, 54, 53, 17, 52, 38, 35, 34, 6, 21, 17, 35, 17, 51, 21, 54, 51, 50, 22, 22, 3, -22, 117, +-106, 73, 68, 34, 53, 32, 65, 44, 104, 119, 117, -93, -76, -94, 117, -35, -126, -80, 57, 2, -115, -3, 57, -59, -80, +19, -103, 14, 88, -125, 2, -68, -108, -120, -106, -56, -3, -68, 4, 38, -105, -81, 112, -91, 0, -1, -1, 0, 99, -1, +-25, 5, -35, 6, -45, 2, 38, 0, 50, 0, 0, 1, 7, 0, -40, 1, -37, 1, 116, 0, 30, -75, 2, 32, 28, +112, 28, 2, -72, -1, -20, -73, 28, 31, 0, 7, 65, 2, 1, 28, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, +53, -1, -1, 0, 68, -1, -24, 4, 39, 5, 95, 2, 38, 0, 82, 0, 0, 1, 7, 0, -40, 0, -21, 0, 0, +0, 37, -77, 2, 2, 1, 26, -71, 2, -61, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 27, 28, +0, 7, 65, 43, 27, -76, 26, 2, 10, 72, 43, 43, 89, 53, 0, -1, -1, 0, 99, -1, -25, 5, -35, 7, 34, +2, 38, 0, 50, 0, 0, 1, 7, 0, -39, 1, -37, 1, 106, 0, 33, 64, 20, 2, 80, 35, 96, 35, 112, 35, +-128, 35, -112, 35, 5, 35, 2, 0, 72, 43, 2, 1, 32, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 53, 0, +-1, -1, 0, 68, -1, -24, 4, 39, 5, -72, 2, 38, 0, 82, 0, 0, 1, 7, 0, -39, 0, -21, 0, 0, 0, +22, 64, 10, 2, 0, 33, 27, 0, 7, 65, 2, 1, 30, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, +0, -95, -2, 91, 5, -83, 5, -70, 2, 38, 0, 53, 0, 0, 1, 7, 1, -18, 1, -26, 0, 0, 0, 19, 64, +11, 2, 32, 46, 1, 0, 46, 40, 1, 6, 65, 37, 0, 47, 1, 43, 93, 53, 0, -1, -1, 0, -123, -2, 91, +2, -58, 4, 62, 2, 38, 0, 85, 0, 0, 1, 6, 1, -18, 37, 0, 0, 4, -80, 20, 0, 47, -1, -1, 0, +92, -1, -25, 4, -21, 7, 38, 2, 38, 0, 54, 0, 0, 1, 7, 0, -42, 1, 76, 1, 100, 0, 22, 64, 10, +1, 0, 51, 54, 22, 22, 65, 1, 1, 50, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 63, -1, +-24, 3, -79, 5, -62, 2, 38, 0, 86, 0, 0, 1, 7, 0, -42, 0, -66, 0, 0, 0, 22, 64, 10, 1, 0, +51, 54, 21, 21, 65, 1, 1, 50, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, 0, 1, 0, 48, 0, 0, 4, +-70, 5, -70, 0, 15, 0, -76, 64, 38, 0, 17, 16, 17, 32, 17, 3, 12, 1, 48, 11, 2, 2, 15, 6, 8, +5, 30, 7, 6, 2, 15, 8, 11, 12, 57, 7, 1, 2, 57, 6, 14, 9, 8, 32, 7, 1, 7, -72, 1, 1, +-73, 9, 32, 4, 5, 47, 6, 1, 6, -72, 1, 1, -78, 4, 4, 15, -72, -1, -24, 64, 11, 16, 16, 2, 85, +15, 8, 15, 15, 2, 85, 15, -72, -1, -14, -76, 12, 12, 2, 85, 15, -72, -1, -30, -76, 13, 13, 2, 85, 15, +-72, -1, -4, -76, 12, 12, 6, 85, 15, -72, -1, -24, -76, 13, 13, 6, 85, 15, -72, -1, -32, 64, 10, 16, 16, +6, 85, 16, 15, 32, 15, 2, 15, -72, 2, 115, -77, 16, -74, -103, 24, 43, 16, -3, 93, 43, 43, 43, 43, 43, +43, 43, 60, 16, -12, 93, 60, 16, -3, -12, 93, 60, 16, 60, 16, -12, 60, 16, -12, 60, 0, 63, 63, 60, -3, +60, 17, 18, 57, 47, 60, -3, 60, 49, 48, 1, 93, 1, 33, 53, 33, 17, 33, 53, 33, 21, 33, 17, 33, 21, +33, 17, 35, 2, 19, -2, -74, 1, 74, -2, 29, 4, -118, -2, 27, 1, 72, -2, -72, -62, 2, 117, -124, 2, 20, +-83, -83, -3, -20, -124, -3, -117, 0, 0, 1, 0, 12, -1, -14, 2, 19, 5, -103, 0, 30, 1, 14, -71, 0, 5, +-1, -64, -77, 35, 38, 52, 6, -72, -1, -64, 64, 91, 35, 38, 52, 47, 32, -128, 32, 2, 16, 1, 43, 15, 2, +2, 26, 12, 5, 43, 11, 6, 6, 22, -55, 26, 3, 24, 26, 23, 5, 21, 8, 52, 11, 12, 6, 85, 9, 52, +11, 12, 6, 85, 8, 9, 6, 17, 14, 13, 10, 4, 9, 18, 0, 3, 4, 7, 4, 8, 30, 15, 51, 11, -96, +2, -80, 2, -64, 2, -48, 2, 4, 2, 2, 6, 11, 12, 34, 23, 34, 24, 9, 18, 37, 8, 24, -1, 30, 6, +5, 69, 30, -72, -1, -6, -76, 16, 16, 2, 85, 30, -72, -1, -6, 64, 23, 14, 14, 2, 85, 30, 4, 12, 13, +2, 85, 30, 8, 11, 11, 2, 85, 30, 6, 16, 16, 6, 85, 30, -72, -1, -6, -76, 15, 15, 6, 85, 30, -72, +-1, -4, 64, 11, 11, 11, 6, 85, 30, 18, 12, 12, 6, 85, 30, -72, -1, -12, 64, 20, 13, 13, 6, 85, -81, +30, -65, 30, 2, 0, 30, -48, 30, 2, 30, 78, 31, 23, 24, 71, -71, 1, 10, 0, 24, 43, 0, 16, -55, 1, +16, -12, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, -12, 60, 16, -19, 60, -3, 60, 16, -28, -12, 60, 17, +51, 47, 113, 16, -28, 17, 18, 23, 51, 17, 18, 23, 51, 0, 17, 51, 51, 43, 43, 17, 18, 57, 18, 57, 63, +-19, 63, 60, -3, 60, 18, 57, 47, 60, -3, 60, 49, 48, 1, 93, 43, 43, 19, 35, 53, 51, 17, 35, 53, 51, +17, 55, 17, 51, 21, 35, 17, 51, 21, 35, 21, 20, 22, 51, 50, 55, 23, 6, 35, 34, 38, 38, 53, -111, -123, +-123, -124, -124, -76, -76, -76, -84, -84, 37, 64, 32, 47, 26, 73, 61, 106, 115, 31, 2, 2, -124, 1, 20, -116, 1, +7, 108, -2, -115, -116, -2, -20, -124, -43, 85, 62, 7, -97, 16, 72, 117, -120, 0, -1, -1, 0, -95, -1, -25, 5, +34, 7, 14, 2, 38, 0, 56, 0, 0, 1, 7, 0, -41, 1, -92, 1, 100, 0, 22, 64, 10, 1, 0, 21, 33, +17, 17, 65, 1, 1, 21, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, -125, -1, -24, 3, -32, 5, +-86, 2, 38, 0, 88, 0, 0, 1, 7, 0, -41, 0, -20, 0, 0, 0, 32, 64, 18, 1, -17, 25, 1, 25, 64, +83, 84, 52, 0, 25, 37, 17, 17, 65, 1, 1, 25, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, 113, 53, -1, +-1, 0, -95, -1, -25, 5, 34, 6, -61, 2, 38, 0, 56, 0, 0, 1, 7, 0, -40, 1, -92, 1, 100, 0, 37, +-77, 1, 1, 1, 21, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 21, 23, 11, 1, +65, 43, 27, -76, 21, 15, 0, 72, 43, 43, 89, 53, 0, -1, -1, 0, -125, -1, -24, 3, -32, 5, 95, 2, 38, +0, 88, 0, 0, 1, 7, 0, -40, 0, -20, 0, 0, 0, 22, 64, 10, 1, 0, 25, 28, 10, 23, 65, 1, 1, +25, -71, 2, -61, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, -95, -1, -25, 5, 34, 7, 28, 2, 38, 0, 56, +0, 0, 1, 7, 0, -39, 1, -112, 1, 100, 0, 22, 64, 10, 1, 0, 28, 22, 11, 1, 65, 1, 1, 25, -71, +2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, -125, -1, -24, 3, -32, 5, -72, 2, 38, 0, 88, 0, 0, +1, 7, 0, -39, 0, -20, 0, 0, 0, 40, -77, 1, 1, 1, 29, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, +2, 67, 84, 88, -75, 0, 32, 26, 10, 23, 65, 43, 27, -79, 32, 11, -72, -1, -40, -79, 72, 43, 43, 89, 53, +0, 1, 0, -95, -2, 86, 5, 34, 5, -70, 0, 34, 1, 51, -73, 88, 16, 88, 34, -55, 16, 3, 36, -72, -1, +-64, 64, 42, 19, 21, 52, 58, 16, 59, 17, 52, 33, 54, 34, 74, 16, 74, 17, 70, 33, 70, 34, 88, 17, 86, +33, 102, 34, 118, 23, -86, 34, -24, 23, 14, 12, 34, 13, 21, 52, 7, -100, 8, 8, 5, -72, 2, 93, -75, 10, +15, 15, 9, 15, 25, -72, 2, -69, 64, 10, 0, 9, 29, 19, 2, 32, 8, 1, 8, 2, -72, 2, 93, 64, 16, +13, 13, 15, 0, 1, -1, 0, 1, 0, -100, 15, 15, 18, 28, 38, 31, -72, -1, -20, -76, 15, 15, 2, 85, 31, +-72, -1, -14, 64, 17, 13, 13, 2, 85, 31, 16, 12, 12, 2, 85, 31, 12, 15, 15, 6, 85, 31, -72, -1, -16, +64, 31, 11, 11, 6, 85, 32, 31, 1, 32, 31, 80, 31, 2, 96, 31, 112, 31, -128, 31, 3, 31, 93, 36, 21, +38, 18, 32, 16, 16, 2, 85, 18, -72, -1, -10, -76, 15, 15, 2, 85, 18, -72, -1, -10, -76, 13, 13, 2, 85, +18, -72, -1, -6, -76, 12, 12, 2, 85, 18, -72, -1, -4, -76, 11, 11, 6, 85, 18, -72, -1, -9, -76, 12, 12, +6, 85, 18, -72, -1, -8, -76, 13, 13, 6, 85, 18, -72, -1, -10, -73, 15, 15, 6, 85, 32, 10, 1, 18, -72, +-1, -64, -74, 19, 21, 52, 18, 93, 35, 59, -71, 1, -114, 0, 24, 43, 16, -12, 43, 93, 43, 43, 43, 43, 43, +43, 43, 43, -19, 16, -10, 93, 93, 113, 43, 43, 43, 43, 43, -19, 18, 57, 47, -19, 93, 113, 51, 47, -19, 47, +93, 0, 63, 60, 63, -19, 51, 63, 63, -19, 51, 47, -19, 49, 48, 1, 43, 93, 43, 0, 93, 5, 6, 21, 20, +22, 51, 50, 55, 21, 6, 35, 34, 38, 53, 52, 55, 36, 2, 17, 17, 51, 17, 20, 22, 22, 51, 50, 54, 17, +17, 51, 17, 20, 2, 6, 3, 18, 20, 82, 62, 77, 91, 118, 101, 98, 121, 28, -2, -13, -18, -62, 73, -79, 116, +-37, -76, -62, 78, -16, 24, 71, 42, 71, 84, 46, 119, 61, 120, 101, 70, 113, 23, 1, 26, 1, 80, 3, 79, -4, +-78, -65, -71, 94, -60, 1, 18, 3, 78, -4, -79, -63, -2, -2, -76, 0, 0, 1, 0, -125, -2, 87, 4, -45, 4, +38, 0, 37, 1, 114, -75, 12, 34, 15, 17, 52, 39, -72, -1, -64, 64, 9, 21, 23, 52, 18, 32, 19, 22, 52, +28, -72, -1, -16, 64, 64, 18, 20, 52, 10, 21, 25, 21, 38, 18, 53, 18, 68, 18, 119, 28, -124, 28, 7, 42, +18, 43, 32, 2, 7, 7, 8, 8, 5, 69, 10, 15, 35, 24, 6, 37, 16, 11, 30, 28, 19, 11, 7, 32, 8, +64, 8, 112, 8, 3, 8, 2, 69, 13, 13, 0, 0, 37, 34, 33, 17, 3, 16, -102, 35, -72, 2, 48, 64, 25, +37, 36, 64, 51, 54, 52, 39, 64, 16, 16, 2, 85, 36, 40, 16, 16, 2, 85, 36, 18, 14, 14, 2, 85, 36, +-72, -1, -22, 64, 11, 13, 13, 2, 85, 36, 4, 12, 12, 2, 85, 36, -72, -1, -4, -76, 11, 11, 2, 85, 36, +-72, -1, -12, 64, 11, 11, 11, 6, 85, 36, 20, 16, 16, 6, 85, 36, -72, -1, -10, 64, 11, 13, 13, 6, 85, +36, 12, 15, 15, 6, 85, 36, -72, -1, -10, 64, 13, 12, 12, 6, 85, -1, 36, 1, -64, 36, 1, 36, 78, 39, +-72, -1, -64, 64, 21, 52, 54, 52, -80, 39, -16, 39, 2, 112, 39, -96, 39, -80, 39, -1, 39, 4, 39, 26, 37, +23, -72, -1, -8, -76, 16, 16, 2, 85, 23, -72, -1, -8, 64, 17, 14, 14, 2, 85, 23, 4, 12, 12, 2, 85, +23, 10, 11, 11, 6, 85, 23, -72, -1, -10, 64, 17, 15, 15, 6, 85, 23, 2, 12, 12, 6, 85, 23, 2, 13, +13, 6, 85, 23, -72, -1, -64, 64, 21, 51, 54, 52, -16, 23, 1, 0, 23, 32, 23, -48, 23, -32, 23, 4, 23, +78, 38, 71, 80, 24, 43, 16, -12, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, 93, 113, 43, -10, 93, +113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, -28, 23, 57, 17, 57, 47, 50, 47, -19, 47, +93, 60, 0, 63, -19, 63, 60, 63, 60, 63, -19, 51, 47, 51, 47, 49, 48, 0, 93, 1, 93, 43, 43, 43, 43, +33, 6, 21, 20, 22, 51, 50, 55, 21, 6, 35, 34, 38, 53, 52, 55, 55, 53, 6, 35, 34, 38, 38, 53, 17, +51, 17, 20, 22, 22, 51, 50, 54, 54, 53, 17, 51, 17, 3, -72, 29, 82, 62, 76, 92, 117, 104, 98, 119, 26, +8, 124, -42, 126, -79, 59, -76, 26, 110, 83, 91, -113, 48, -76, 78, 62, 67, 85, 46, 119, 60, 120, 100, 67, 105, +33, -100, -76, 112, -89, -107, 2, -110, -3, -77, -117, 119, 84, 96, -112, 122, 2, 57, -5, -38, 0, -1, -1, 0, 25, +0, 0, 7, 118, 7, 44, 2, 38, 0, 58, 0, 0, 1, 7, 0, -42, 2, 108, 1, 106, 0, 37, -77, 1, 1, +1, 27, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 27, 30, 8, 9, 65, 43, 27, +-76, 25, 21, 0, 72, 43, 43, 89, 53, 0, -1, -1, 0, 6, 0, 0, 5, -73, 5, -62, 2, 38, 0, 90, 0, +0, 1, 7, 0, -42, 1, -102, 0, 0, 0, 37, -77, 1, 1, 1, 21, -71, 2, 34, 0, 41, 0, 43, 1, -79, +6, 2, 67, 84, 88, -75, 0, 21, 24, 7, 8, 65, 43, 27, -76, 19, 17, 0, 72, 43, 43, 89, 53, 0, -1, +-1, 0, 6, 0, 0, 5, 70, 7, 44, 2, 38, 0, 60, 0, 0, 1, 7, 0, -42, 1, 109, 1, 106, 0, 22, +64, 10, 1, 0, 15, 18, 2, 10, 65, 1, 1, 15, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, +33, -2, 81, 3, -18, 5, -62, 2, 38, 0, 92, 0, 0, 1, 7, 0, -42, 0, -41, 0, 0, 0, 37, -77, 1, +1, 1, 29, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 29, 32, 12, 18, 65, 43, +27, -76, 27, 15, 0, 72, 43, 43, 89, 53, 0, 0, 1, 0, -119, 0, 0, 2, 86, 5, -45, 0, 14, 0, -75, +64, 77, 79, 16, -112, 16, -96, 16, -80, 16, -64, 16, -33, 16, -16, 16, 7, -80, 16, -64, 16, -33, 16, -32, 16, +-1, 16, 5, 0, 16, 31, 16, 112, 16, -128, 16, -97, 16, 5, 31, 16, 75, 3, 89, 3, 104, 3, 112, 16, 5, +10, 28, 5, 0, 0, 10, 7, 7, 0, 8, 32, 8, 112, 8, -128, 8, 4, 8, 13, 14, 37, 1, 16, 64, 11, +11, 2, 85, 0, -72, -1, -10, 64, 23, 16, 16, 2, 85, 0, 6, 12, 12, 2, 85, 0, 16, 11, 11, 2, 85, +0, 8, 16, 16, 6, 85, 0, -72, -1, -4, 64, 38, 12, 13, 6, 85, -97, 0, -64, 0, -32, 0, 3, 0, 0, +-96, 0, -80, 0, 3, -64, 0, -16, 0, 2, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 15, 71, 80, 24, +43, 16, -12, 93, 113, 114, 114, 43, 43, 43, 43, 43, 43, 60, -3, 60, 47, 93, 51, 47, 0, 63, 63, -19, 49, +48, 1, 93, 114, 114, 113, 51, 17, 52, 54, 54, 51, 50, 23, 7, 38, 35, 34, 6, 21, 17, -119, 54, -122, 106, +79, 88, 26, 54, 52, 90, 59, 4, -105, 115, 127, 74, 18, -99, 10, 79, 87, -5, 120, 0, -1, -1, -1, -3, 0, +0, 5, 89, 8, 12, 2, 54, 0, 99, 0, 0, 1, 23, 0, -115, 1, 83, 2, 74, 0, 101, -73, 4, 39, 17, +0, 72, 43, 4, 39, -72, -1, -64, -77, 51, 54, 52, 39, -72, -1, -64, -77, 34, 36, 52, 39, -72, -1, -64, -77, +30, 32, 52, 39, -72, -1, -64, -74, 16, 18, 52, -81, 39, 1, 39, 0, 47, 93, 43, 43, 43, 43, -79, 6, 2, +67, 84, 88, 64, 9, 0, 39, 16, 39, 2, -96, 39, 1, 39, -72, -1, -64, -77, 69, 69, 52, 39, -72, -1, -64, +-77, 44, 47, 52, 39, -72, -1, -64, -78, 23, 25, 52, 43, 43, 43, 93, 114, 89, 53, 1, 43, 53, 0, -1, -1, +0, 74, -1, -24, 4, 28, 7, -124, 2, 38, 0, 110, 0, 0, 1, 7, 0, -115, 1, 15, 1, -62, 0, -54, -79, +6, 2, 67, 84, 88, 64, 42, 4, 0, 80, 83, 59, 59, 65, 3, 2, 0, 56, 62, 28, 28, 65, 4, 0, 83, +80, 83, -16, 83, 3, 47, 83, 112, 83, -128, 83, 3, 83, 3, 2, 32, 65, -128, 65, 2, -128, 65, 1, 65, 0, +47, 113, 114, 53, 53, 47, 93, 113, 53, 1, 43, 53, 53, 43, 53, 27, 64, 44, 4, 80, 68, 0, 72, 43, 81, +82, 80, 83, -128, 75, 79, 52, 83, 64, 96, 96, 52, 83, 64, 56, 56, 52, 0, 83, 96, 83, -113, 83, -48, 83, +4, -113, 83, -16, 83, 2, 83, -128, 56, 63, 52, 83, -72, -1, -64, 64, 9, 44, 46, 52, 83, -128, 41, 47, 52, +83, -72, -1, -64, -77, 39, 40, 52, 83, -72, -1, -128, -77, 35, 36, 52, 83, -72, -1, -64, -77, 31, 34, 52, 83, +-72, -1, -128, 64, 15, 30, 30, 52, 83, 64, 21, 24, 52, 83, -128, 19, 20, 52, 83, 28, -72, 1, 64, 0, 26, +24, 16, -36, 43, 43, 43, 43, 43, 43, 43, 43, 43, 113, 114, 43, 43, 43, -60, -44, -60, 49, 48, 1, 43, 53, +89, -1, -1, 0, 1, 0, 0, 7, -112, 7, 44, 2, 38, 0, -112, 0, 0, 1, 7, 0, -115, 2, -109, 1, 106, +0, 22, 64, 10, 2, 0, 20, 22, 1, 4, 65, 2, 1, 23, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, +-1, 0, 68, -1, -24, 6, -54, 5, -62, 2, 38, 0, -96, 0, 0, 1, 7, 0, -115, 2, 88, 0, 0, 0, 21, +64, 10, 3, 1, 78, 37, 0, 72, 39, 3, 1, 78, -71, 2, 34, 0, 41, 0, 43, 1, 43, 0, -1, -1, 0, +83, -1, -59, 5, -19, 7, 44, 2, 38, 0, -111, 0, 0, 1, 7, 0, -115, 1, -53, 1, 106, 0, 21, 64, 9, +3, 52, 25, 50, 72, 43, 3, 1, 52, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, 0, -1, -1, 0, -127, -1, +-79, 4, 100, 5, -62, 2, 38, 0, -95, 0, 0, 1, 7, 0, -115, 1, 54, 0, 0, 0, 21, 64, 10, 3, 1, +44, 29, 30, 72, 39, 3, 1, 47, -71, 2, 34, 0, 41, 0, 43, 1, 43, 0, 0, 1, 0, -71, 3, 89, 1, +-122, 4, 38, 0, 3, 0, 36, 64, 14, 2, 1, 3, 0, 60, 1, 5, -97, 3, 60, 0, 25, 4, -95, -71, 1, +-112, 0, 24, 43, 78, 16, -12, 77, -3, -26, 0, 47, -3, 60, 16, 60, 49, 48, 19, 53, 51, 21, -71, -51, 3, +89, -51, -51, -1, -1, 0, 25, 0, 0, 7, 118, 7, 44, 2, 38, 0, 58, 0, 0, 1, 7, 0, 67, 2, -118, +1, 106, 0, 24, -71, 0, 1, -1, -90, -73, 27, 25, 8, 9, 65, 1, 1, 26, -71, 2, 33, 0, 41, 0, 43, +1, 43, 53, -1, -1, 0, 6, 0, 0, 5, -73, 5, -62, 2, 38, 0, 90, 0, 0, 1, 7, 0, 67, 1, 104, +0, 0, 0, 24, -71, 0, 1, -1, -90, -73, 21, 19, 7, 8, 65, 1, 1, 20, -71, 2, 34, 0, 41, 0, 43, +1, 43, 53, -1, -1, 0, 25, 0, 0, 7, 118, 7, 44, 2, 38, 0, 58, 0, 0, 1, 7, 0, -115, 2, -118, +1, 106, 0, 21, 64, 9, 1, 25, 8, 0, 72, 43, 1, 1, 25, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, +0, -1, -1, 0, 6, 0, 0, 5, -73, 5, -62, 2, 38, 0, 90, 0, 0, 1, 7, 0, -115, 1, 104, 0, 0, +0, 21, 64, 9, 1, 19, 7, 0, 72, 43, 1, 1, 19, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, 0, -1, +-1, 0, 25, 0, 0, 7, 118, 6, -31, 2, 38, 0, 58, 0, 0, 1, 7, 0, -114, 2, 108, 1, 30, 0, 43, +-75, 2, 1, 1, 2, 2, 25, -71, 2, 33, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 28, 29, +8, 9, 65, 43, 27, -79, 28, 23, -72, -1, -30, -79, 72, 43, 43, 89, 53, 53, 0, -1, -1, 0, 6, 0, 0, +5, -73, 5, -61, 2, 38, 0, 90, 0, 0, 1, 7, 0, -114, 1, -102, 0, 0, 0, 24, 64, 11, 2, 1, 22, +7, 0, 72, 43, 1, 2, 2, 22, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, 53, -1, -1, 0, 6, 0, 0, +5, 70, 7, 44, 2, 38, 0, 60, 0, 0, 1, 7, 0, 67, 1, 77, 1, 106, 0, 21, 64, 10, 1, 1, 14, +6, 26, 72, 39, 1, 1, 14, -71, 2, 33, 0, 41, 0, 43, 1, 43, 0, -1, -1, 0, 33, -2, 81, 3, -18, +5, -62, 2, 38, 0, 92, 0, 0, 1, 7, 0, 67, 0, -73, 0, 0, 0, 28, 64, 15, 1, 28, 32, 13, 14, +6, 85, 28, 15, 26, 72, 43, 1, 1, 28, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, 53, 0, 1, 0, -118, +3, -23, 1, 91, 5, -55, 0, 9, 0, 71, -74, 3, 1, 8, 0, 3, -85, 4, -72, 1, 80, 64, 24, 9, 1, +0, 60, 9, 9, 8, 0, 4, 105, 3, -59, 0, 0, 9, -127, 7, 63, 8, 1, 8, 25, 10, -99, -71, 1, -112, +0, 24, 43, 78, 16, -12, 93, 60, 77, -3, 60, 16, -12, -28, 0, 63, 60, 16, -3, 60, 16, -3, -19, 1, 17, +18, 57, 0, -55, 49, 48, 1, 35, 22, 23, 7, 38, 38, 53, 53, 51, 1, 75, 94, 2, 108, 44, 93, 72, -63, +4, -8, -100, 44, 71, 42, -114, -125, -91, 0, 0, 1, -1, -31, 4, -53, 2, -54, 5, 95, 0, 3, 0, 26, 64, +12, 1, 53, 0, 2, 26, 5, 0, 25, 4, 67, 104, 24, 43, 78, 16, -28, 16, -26, 0, 47, 77, -19, 49, 48, +3, 53, 33, 21, 31, 2, -23, 4, -53, -108, -108, 0, 0, 1, 0, 27, -1, -28, 4, 58, 5, -45, 0, 54, 1, +47, 64, -59, 11, 36, 19, 4, 41, 24, 58, 18, 83, 46, 109, 44, 98, 46, -122, 40, 8, -37, 30, -33, 33, -38, +50, -23, 33, -6, 33, 5, 25, 33, 1, 117, 9, -122, 9, 2, 52, 53, 53, 30, 30, 31, 43, 32, 51, 50, 50, +33, 33, 95, 32, -33, 32, 2, -113, 32, 1, 15, 32, 31, 32, 47, 32, -97, 32, -81, 32, 5, 32, 32, 38, 2, +3, 3, 25, 25, 26, 43, 27, 1, 0, 0, 28, 28, 0, 27, 1, 47, 27, 1, 27, 27, 22, 38, 42, 39, 95, +41, 111, 41, 2, 41, -120, 64, 45, 1, 45, 41, 38, 1, 7, 30, 20, 106, 16, 13, 30, 14, -85, 11, 30, 16, +11, 23, -97, 22, 11, 33, 30, 28, 3, 25, 35, 50, 53, 0, 3, 3, 48, 42, 94, 41, 105, 13, -27, 32, 14, +48, 14, 2, 14, 26, 56, 51, 52, 52, 1, 1, 2, -121, 25, 94, 32, 3, 1, 3, 77, 48, 94, -65, 35, -49, +35, -17, 35, 3, 35, 114, 23, 32, 31, 31, 27, 27, 26, -59, 22, -85, -81, 31, 1, 23, 25, 55, -87, -115, 24, +43, 78, 16, -12, 93, 25, 77, -28, 24, -12, 60, 16, 60, 16, 60, 16, -12, 93, -3, -12, 93, -19, -12, 60, 16, +60, 16, 60, 78, 16, -10, 93, 77, -28, -12, -19, 17, 18, 23, 57, 17, 18, 23, 57, 0, 63, -19, 63, -19, -3, +-19, 16, -12, -19, 63, -19, 113, -3, 93, -28, 17, 18, 57, 47, 93, 113, 60, 16, 60, 16, 60, 16, -3, 60, 16, +60, 16, 60, 17, 57, 47, 93, 113, 114, 60, 16, 60, 16, 60, 16, -3, 60, 16, 60, 16, 60, 49, 48, 0, 93, +1, 114, 113, 93, 1, 33, 21, 33, 6, 7, 54, 51, 50, 23, 22, 51, 50, 55, 23, 6, 35, 34, 39, 38, 35, +34, 7, 39, 54, 55, 35, 53, 51, 38, 39, 35, 53, 51, 38, 53, 52, 36, 51, 50, 22, 23, 7, 38, 38, 35, +34, 6, 21, 20, 23, 33, 21, 33, 22, 1, -79, 1, 22, -2, -26, 33, -128, 77, 64, 87, 103, -86, 68, 69, 118, +58, -110, 92, 74, -112, -105, 70, -91, -112, 69, -62, 32, -47, -47, 4, 37, -88, 126, 23, 1, 9, -63, -90, -9, 26, +-77, 13, -108, 107, 117, -115, 28, 1, 88, -2, -54, 26, 2, 102, -108, -112, -125, 22, 25, 41, 56, -91, 63, 44, 46, +93, -83, 112, -47, -108, 31, 117, -108, 90, 77, -62, -36, -65, -68, 27, 113, -111, -106, 92, 58, -123, -108, 105, 0, 0, +2, 0, 90, -1, -34, 4, 124, 4, 72, 0, 18, 0, 25, 0, -92, 64, 80, -74, 4, 1, 69, 23, 90, 4, 82, +14, 91, 16, 90, 21, 82, 23, 107, 4, 104, 7, 8, 32, 27, 58, 4, 75, 4, 73, 17, 74, 21, 5, 18, 0, +76, 19, 47, 25, -49, 25, 2, 25, 25, 9, 15, 6, 105, 5, 1, -84, 3, -85, 9, 11, 20, 58, 24, -84, 22, +-85, 15, 7, 5, -85, -113, 6, -97, 6, -81, 6, -65, 6, -49, 6, -33, 6, 6, 6, 6, 20, 19, -72, 2, -63, +64, 21, 0, 18, 32, 18, 2, 16, 18, 32, 18, 48, 18, 3, 18, 49, 27, 1, 0, 24, 25, 25, 0, -72, 2, +-63, -73, 31, 12, 63, 12, 2, 12, 49, 26, 16, -10, 93, -3, 60, 16, 60, 16, 60, 16, -10, 93, 93, -3, 60, +57, 47, 93, -19, 0, 63, -3, -12, -28, 63, -3, -28, 47, -28, 17, 18, 57, 47, 93, 60, -3, 60, 49, 48, 1, +93, 93, 0, 93, 1, 17, 22, 51, 50, 55, 23, 6, 6, 35, 34, 0, 53, 52, 0, 51, 50, 0, 19, 39, 17, +38, 35, 34, 7, 17, 1, 65, 120, -78, -2, -115, 72, 120, -32, 123, -19, -2, -36, 1, 38, -21, -42, 1, 48, 11, +-25, -128, -84, -81, 121, 2, 19, -2, -115, 121, -10, 43, -83, 103, 1, 64, -11, -9, 1, 62, -2, -28, -2, -25, 74, +1, 41, 121, 122, -2, -40, 0, 0, 5, 0, 107, -1, -57, 6, -128, 5, -45, 0, 3, 0, 13, 0, 33, 0, 45, +0, 56, 0, -28, 64, 14, 47, 58, 123, 17, 119, 21, -118, 17, -122, 21, 5, 2, 3, 3, -72, -1, -64, -77, 66, +92, 52, 3, -72, -1, -64, 64, 17, 39, 59, 52, 3, 63, 0, 1, 20, 0, 0, 1, 24, 24, 37, 14, 14, 54, +-72, 2, 97, 64, 11, 31, 37, 47, 37, 63, 37, 3, 37, 37, 29, 43, -70, 2, 97, 0, 19, 1, -64, 64, 9, +29, 5, 7, -84, 8, -96, 11, 4, 13, -72, 1, 31, -76, 11, 12, -30, 2, 1, -69, 1, 125, 0, 3, 0, 48, +2, 97, 64, 13, 29, -30, 0, 0, 3, 9, 34, 41, 16, 39, 46, 41, 32, -72, 1, 29, 64, 29, 26, 40, 41, +22, 39, 51, 41, 26, 26, 58, 0, 3, 1, 2, 4, 58, 57, 11, 12, 5, 4, 12, 13, 41, 4, 8, 7, -53, +4, -72, 1, 70, -77, 57, 87, 104, 24, 43, 16, -10, -10, 60, 16, -3, 60, 16, 60, 18, 57, 17, 18, 23, 57, +78, 16, -10, 77, -19, -12, -19, 16, -3, -19, -12, -19, 0, 63, 60, 16, -10, -19, 16, -3, 60, -12, 60, -3, 60, +16, -12, -3, 57, 16, -3, -19, 18, 57, 47, 93, -19, 25, 57, 47, 17, 57, 47, -121, 5, 46, 24, 43, 43, 43, +125, 16, -60, 49, 48, 1, 93, 23, 1, 51, 1, 3, 17, 6, 7, 53, 54, 54, 55, 51, 17, 1, 38, 53, 52, +54, 51, 50, 22, 21, 20, 7, 22, 21, 20, 6, 35, 34, 38, 53, 52, 55, 20, 22, 51, 50, 54, 53, 52, 38, +35, 34, 6, 3, 20, 51, 50, 54, 53, 52, 38, 35, 34, 6, -28, 4, 77, -99, -5, -77, 54, 102, 122, 55, -96, +46, 108, 2, -19, -126, 125, -117, -117, -117, -116, -89, -88, -126, -118, -95, -79, 70, 51, 51, 73, 72, 54, 55, 64, 28, +-107, 71, 80, 86, 68, 70, 76, 57, 6, 12, -7, -12, 3, 22, 2, 42, 81, 32, 123, 17, 109, 61, -3, 17, -2, +-110, 47, 115, 80, 111, 107, 86, 115, 45, 41, -113, 106, 126, 127, 100, -108, -63, 50, 52, 52, 45, 46, 55, 58, -2, +-111, 127, 69, 53, 58, 68, 69, 0, 5, 0, 34, -1, -57, 6, -127, 5, -45, 0, 3, 0, 34, 0, 54, 0, 66, +0, 77, 1, 81, 64, 23, 31, 20, -33, 20, 2, 47, 79, 105, 38, 102, 42, 123, 38, 119, 42, -118, 38, -123, 42, +7, 2, 3, 3, -72, -1, -64, -77, 66, 92, 52, 3, -72, -1, -64, 64, 21, 39, 59, 52, 3, 63, 0, 1, 20, +0, 0, 1, 28, 28, 33, 24, 45, 45, 58, 35, 35, 75, -72, 2, 97, 64, 11, 31, 58, 47, 58, 63, 58, 3, +58, 58, 50, 64, -67, 2, 97, 0, 40, 1, -64, 0, 50, 0, 14, 2, 97, 64, 14, 13, 13, 33, 24, 5, -59, +32, 4, 48, 4, 2, 4, 100, 7, -67, 2, 97, 0, 33, 1, 31, 0, 24, 0, 20, 2, -86, 64, 23, 31, 21, +47, 21, 63, 21, 3, 127, 21, 1, 95, 21, 111, 21, 2, 95, 21, 111, 21, 2, 21, -111, 18, -72, 2, 97, -77, +24, -30, 2, 1, -69, 1, 125, 0, 3, 0, 69, 2, 97, 64, 17, 50, -30, 0, 0, 3, 9, 14, 13, -97, 16, +55, 41, 37, 39, 67, 41, 53, -72, 1, 29, 64, 27, 47, 61, 41, 43, 39, 72, 41, 47, 26, 79, 0, 3, 1, +2, 4, 79, 78, 16, 41, 26, 34, 10, 41, 48, 30, 1, 30, -72, 2, 40, 64, 23, 4, 14, 39, 13, 100, 5, +20, 41, 16, 21, -48, 21, 2, 21, 34, 5, 41, 4, 25, 78, 124, 104, 24, 43, 78, 16, -12, 77, -19, -12, 114, +-19, 16, -10, -28, 16, -3, 93, -19, -12, -19, 17, 18, 23, 57, 78, 16, -10, 77, -19, -12, -19, 16, -3, -19, -12, +-19, 16, -28, 57, 0, 63, 60, 16, -10, -19, 16, -3, 60, -12, -3, -12, 114, 113, 113, 93, -28, 16, -3, -3, -12, +93, -28, 17, 18, 57, 47, -19, 16, -3, -19, 18, 57, 47, 93, -19, 25, 57, 47, 17, 57, 47, 17, 18, 57, 47, +-121, 5, 46, 24, 43, 43, 43, 125, 16, -60, 49, 48, 1, 93, 0, 114, 23, 1, 51, 1, 1, 55, 22, 51, 50, +54, 53, 52, 35, 7, 55, 50, 53, 52, 35, 34, 7, 39, 54, 54, 51, 32, 21, 20, 7, 22, 21, 20, 6, 35, +32, 1, 38, 53, 52, 54, 51, 50, 22, 21, 20, 7, 22, 21, 20, 6, 35, 34, 38, 53, 52, 55, 20, 22, 51, +50, 54, 53, 52, 38, 35, 34, 6, 3, 20, 51, 50, 54, 53, 52, 38, 35, 34, 6, -27, 4, 77, -100, -5, -76, +-2, -96, -110, 31, 123, 67, 90, -100, 58, 22, -100, 121, 104, 36, -113, 41, -122, 100, 1, 30, -118, -83, -91, -118, -2, +-11, 4, 125, -126, -119, 126, -116, -117, -115, -88, -86, -128, -121, -92, -79, 70, 51, 49, 74, 72, 54, 54, 64, 28, -107, +72, 78, 85, 68, 70, 76, 57, 6, 12, -7, -12, 3, -38, 15, 112, 75, 57, 111, 3, 110, 102, 89, 102, 23, 111, +79, -68, 120, 39, 43, -110, 101, -124, -2, -92, 47, 115, 90, 101, 107, 86, 112, 48, 41, -113, 109, 123, 123, 104, -108, +-63, 50, 52, 51, 46, 46, 55, 58, -2, -111, 127, 70, 52, 58, 68, 69, 0, 0, 5, 0, 34, -1, -57, 6, -127, +5, -45, 0, 3, 0, 31, 0, 51, 0, 63, 0, 74, 1, 119, 64, 44, 123, 35, 119, 39, -118, 35, -122, 39, -63, +27, -41, 27, -27, 27, -11, 21, 8, 18, 25, 32, 25, 47, 76, 49, 25, 4, 5, 21, 5, 27, 2, 20, 21, 21, +108, 16, 17, 20, 16, 16, 17, 2, 3, 3, -72, -1, -64, -77, 66, 92, 52, 3, -72, -1, -64, 64, 17, 39, 59, +52, 3, 63, 0, 1, 20, 0, 0, 1, 42, 42, 55, 32, 32, 72, -72, 2, 97, 64, 11, 31, 55, 47, 55, 63, +55, 3, 55, 55, 47, 61, -70, 2, 97, 0, 37, 1, -64, 64, 19, 47, 21, 21, 13, 17, 16, 39, 95, 15, 111, +15, 127, 15, -113, 15, 4, 15, -85, 13, -72, 2, 97, 64, 28, 15, 23, 64, 23, 80, 23, 3, 23, 23, 29, 17, +5, -59, -128, 4, 1, 32, 4, 48, 4, 64, 4, 80, 4, 4, 4, 100, 7, -70, 2, 97, 0, 29, 1, 31, -76, +17, 19, 20, 18, 20, -72, 2, 97, -77, 17, 39, 2, 1, -69, 1, 125, 0, 3, 0, 66, 2, 97, 64, 13, 47, +-30, 0, 0, 3, 9, 52, 41, 34, 39, 64, 41, 50, -72, 1, 29, 64, 34, 44, 58, 41, 40, 39, 69, 41, 44, +26, 76, 0, 3, 1, 2, 4, 76, 75, 21, 15, 16, 19, 15, 18, 1, 18, 34, 10, 41, 0, 26, 48, 26, 2, +26, -72, 2, 40, 64, 20, 4, 20, 20, 17, 17, 15, 15, 15, 16, 1, 16, 39, 5, 41, 4, 25, 75, 87, 104, +24, 43, 78, 16, -12, 77, -19, -12, 93, 50, 47, 50, 47, 51, 47, 16, -3, 93, -19, -12, 93, 60, 17, 18, 57, +17, 18, 23, 57, 78, 16, -10, 77, -19, -12, -19, 16, -3, -19, -12, -19, 0, 63, 60, 16, -10, -19, 16, -3, 60, +-12, -19, 60, 16, 60, 16, -3, -3, -12, 93, 113, -28, 17, 18, 57, 47, 93, -3, -12, 93, -28, 17, 18, 57, 47, +16, -3, -19, 18, 57, 47, 93, -19, 25, 57, 47, 17, 57, 47, -121, 5, 46, 24, 43, 43, 43, 125, 16, -60, -121, +14, 46, 24, 43, 5, 125, 16, -60, 49, 48, 1, 113, 93, 93, 23, 1, 51, 1, 1, 55, 22, 51, 50, 54, 53, +52, 38, 35, 34, 7, 39, 19, 33, 21, 33, 7, 54, 51, 50, 22, 21, 20, 6, 35, 34, 38, 1, 38, 53, 52, +54, 51, 50, 22, 21, 20, 7, 22, 21, 20, 6, 35, 34, 38, 53, 52, 55, 20, 22, 51, 50, 54, 53, 52, 38, +35, 34, 6, 3, 20, 51, 50, 54, 53, 52, 38, 35, 34, 6, -27, 4, 77, -100, -5, -76, -2, -96, -112, 26, 121, +76, 92, 83, 66, 70, 70, -115, 79, 1, -42, -2, -118, 34, 79, 89, 113, -98, -71, -126, 118, -101, 4, -109, -126, -119, +126, -116, -117, -115, -88, -86, -128, -121, -92, -79, 70, 51, 49, 74, 72, 54, 54, 64, 28, -107, 72, 78, 85, 68, 70, +76, 57, 6, 12, -7, -12, 3, -41, 18, 105, 83, 63, 58, 85, 64, 25, 1, 121, 121, -98, 53, -109, 108, 120, -106, +113, -2, 51, 47, 115, 90, 101, 107, 86, 112, 48, 41, -113, 109, 123, 123, 104, -108, -63, 50, 52, 51, 46, 46, 55, +58, -2, -111, 127, 70, 52, 58, 68, 69, 0, 5, 0, 74, -1, -57, 6, -128, 5, -45, 0, 3, 0, 12, 0, 32, +0, 44, 0, 55, 0, -28, 64, 14, 47, 57, 125, 16, 119, 20, -117, 16, -122, 20, 5, 2, 3, 3, -72, -1, -64, +-77, 66, 92, 52, 3, -72, -1, -64, 64, 17, 39, 59, 52, 3, 63, 0, 1, 20, 0, 0, 1, 23, 23, 36, 13, +13, 53, -72, 2, 97, 64, 11, 31, 36, 47, 36, 63, 36, 3, 36, 36, 28, 42, -70, 2, 97, 0, 18, 1, -64, +-78, 28, 12, 4, -72, 1, -71, -73, 6, 7, -84, 9, 8, 39, 2, 1, -69, 1, 125, 0, 3, 0, 47, 2, 97, +64, 13, 28, -30, 0, 0, 3, 9, 33, 41, 15, 39, 45, 41, 31, -72, 1, 29, 64, 41, 25, 39, 41, 21, 39, +50, 41, 25, 26, 57, 0, 3, 1, 2, 4, 57, 56, 6, 9, 4, 9, 32, 10, 1, 10, -121, 12, 41, 4, 8, +7, -84, 47, 4, 1, 4, 60, 56, 124, 104, 24, 43, 16, -10, 93, -12, 60, 16, -3, -12, 93, 60, 17, 18, 57, +17, 18, 23, 57, 78, 16, -10, 77, -19, -12, -19, 16, -3, -19, -12, -19, 0, 63, 60, 16, -10, -19, 16, -3, 60, +-12, 60, -3, 60, -10, 60, 16, -3, -19, 18, 57, 47, 93, -19, 25, 57, 47, 17, 57, 47, -121, 5, 46, 24, 43, +43, 43, 125, 16, -60, 49, 48, 1, 93, 23, 1, 51, 1, 3, 18, 19, 33, 53, 33, 21, 2, 3, 1, 38, 53, +52, 54, 51, 50, 22, 21, 20, 7, 22, 21, 20, 6, 35, 34, 38, 53, 52, 55, 20, 22, 51, 50, 54, 53, 52, +38, 35, 34, 6, 3, 20, 51, 50, 54, 53, 52, 38, 35, 34, 6, -52, 4, 77, -99, -5, -77, -92, 24, -19, -2, +-128, 2, 37, -12, 34, 3, 112, -126, 125, -117, -117, -117, -116, -89, -87, -127, -122, -91, -79, 70, 51, 49, 75, 72, 54, +55, 64, 28, -107, 71, 80, 86, 68, 70, 76, 57, 6, 12, -7, -12, 3, 22, 1, 65, 1, 35, 121, 80, -2, -28, +-2, -113, -2, -110, 47, 115, 80, 111, 107, 86, 115, 45, 41, -113, 109, 123, 123, 104, -108, -63, 49, 53, 51, 46, 46, +55, 58, -2, -111, 127, 69, 53, 58, 68, 69, 0, 0, 1, 0, -30, -3, -39, 1, -64, -1, 111, 0, 9, 0, 58, +64, 21, 6, 62, 7, 108, 9, 9, 0, -97, 2, 1, 3, 2, -127, 1, 1, 0, 6, -27, 7, -30, 0, -72, 2, +96, -77, 10, 9, 3, -39, -71, 1, -112, 0, 24, 43, 17, 57, 16, -12, -12, -28, 16, 60, 16, -3, 60, 0, 47, +60, -3, 60, 16, -10, -19, 49, 48, 19, 53, 51, 21, 20, 6, 7, 39, 54, 55, -17, -47, 74, 94, 54, 93, 16, +-2, -64, -81, 117, 110, -115, 38, 84, 40, 107, 0, 0, 1, 0, 107, -2, 91, 2, 28, -1, -46, 0, 19, 0, 75, +64, 10, 8, 77, 0, 13, 16, 13, 32, 13, 3, 13, -72, 2, 49, 64, 30, 2, 17, 58, 19, 77, 0, 127, 15, +2, 31, 2, 47, 2, 3, 2, 56, 20, 5, 41, 15, -7, 19, 0, 106, 10, -30, 11, 25, 20, 87, -71, 1, -112, +0, 24, 43, 78, 16, -12, 77, -28, -10, 60, -12, -19, 0, 16, -2, 93, -12, -3, -28, 16, -12, 93, -19, 49, 48, +23, 54, 51, 50, 22, 21, 20, 6, 35, 34, 39, 55, 22, 51, 50, 53, 52, 35, 34, 7, -43, 35, 31, -119, 124, +-115, -104, 63, 77, 11, 44, 43, -89, 127, 14, 18, 50, 4, 110, 72, 77, 116, 12, 117, 4, 76, 67, 2, 0, -1, +-1, 0, -34, 4, -86, 2, 79, 5, -62, 2, 22, 0, -115, 0, 0, 0, 3, -1, -22, 4, -50, 2, -63, 5, -29, +0, 3, 0, 7, 0, 11, 0, 90, 64, 56, 4, -96, 6, 9, -96, 11, 64, 6, 11, 0, 3, 1, -112, 3, 1, +3, -121, -128, 0, 3, 5, -97, 7, 7, 0, 8, -97, 80, 10, 96, 10, 2, 10, 10, 0, 3, 117, -16, 2, 1, +2, 64, 44, 47, 52, 2, -59, 1, -96, 95, 0, 1, 80, 0, 1, 0, 47, 114, 93, -19, -10, 43, 113, -19, 17, +51, 47, 93, -19, 17, 51, 47, -19, 0, 63, 26, -3, 93, 113, 60, 60, 26, 16, -19, 16, -19, 49, 48, 1, 51, +3, 35, 37, 51, 21, 35, 37, 51, 21, 35, 1, 91, -70, -56, 117, 1, 60, -83, -83, -3, -42, -83, -83, 5, -29, +-2, -21, -64, -64, -64, -64, 0, 0, 3, -1, -1, 0, 0, 5, 91, 5, -70, 0, 7, 0, 14, 0, 18, 1, -85, +-74, 1, 14, 15, 16, 2, 85, 2, -72, -1, -14, -76, 15, 16, 2, 85, 2, -72, -1, -4, -76, 16, 16, 6, 85, +2, -72, -1, -10, -76, 13, 13, 6, 85, 2, -72, -1, -8, 64, 101, 12, 12, 6, 85, 9, 12, 12, 12, 6, 85, +5, 12, 12, 12, 6, 85, 47, 20, 48, 20, 103, 8, 104, 9, 96, 20, -120, 3, -97, 15, -112, 20, -55, 5, -58, +6, -64, 20, -16, 20, 12, 8, 5, 89, 1, 86, 2, 80, 20, 104, 11, -80, 20, -13, 12, -13, 13, -13, 14, 9, +4, 12, 4, 13, 4, 14, 3, 15, 0, 18, 16, 18, 2, 18, -38, 16, 2, 11, 10, 9, 5, 4, 4, 12, 13, +14, 8, 6, 7, 7, 12, 9, 5, 4, 8, 6, 12, 7, 2, 3, 3, -72, -1, -8, 64, 15, 12, 12, 2, 85, +3, 32, 4, 12, 20, 4, 4, 12, 1, 0, 0, -72, -1, -8, 64, 21, 12, 12, 2, 85, 0, 32, 7, 12, 20, +7, 7, 12, 9, 30, 5, 5, 8, 30, 6, 3, 6, -72, 2, 112, 64, 14, 0, 12, -23, 2, 1, 2, 16, 82, +17, 82, 18, -23, 64, 15, -72, -1, -64, -77, 18, 21, 52, 15, -72, -1, -64, 64, 10, 11, 12, 52, -33, 15, 1, +15, 84, 0, 2, -70, 1, 11, 0, 1, 1, 11, 64, 18, 12, 32, 0, 101, 7, 3, 82, 80, 4, -49, 4, -33, +4, 3, -112, 4, 1, 4, -72, 1, 1, 64, 11, 80, 12, -64, 7, -33, 12, 3, -112, 12, 1, 12, -72, 1, 1, +64, 13, 15, 7, -49, 7, 2, 127, 7, -128, 7, 2, 7, -109, 19, -70, 1, -101, 1, -114, 0, 24, 43, 16, -12, +93, 113, 25, -12, 93, 113, -12, 93, 113, 24, -19, 16, -19, 26, 25, 16, -19, -19, 24, 16, -12, 114, 43, 43, 26, +-3, -12, -19, 0, 63, 60, -19, 47, -28, 60, 16, -19, 60, 16, -19, -121, 5, 46, 43, 43, 125, 16, -60, -121, 46, +24, 43, 43, 125, 16, -60, 1, 17, 18, 57, 57, 17, 57, 57, -121, 16, -60, -60, 14, -60, -60, -121, 5, 16, -60, +-60, 14, -60, -60, 0, 24, 63, -3, 93, 60, 49, 48, 1, 75, -80, 11, 83, 75, -80, 30, 81, 90, 88, -76, 4, +15, 3, 8, 7, -70, -1, -16, 0, 0, -1, -8, 56, 56, 56, 56, 89, 1, 114, 113, 93, 43, 43, 43, 43, 43, +43, 43, 35, 1, 51, 1, 35, 3, 33, 3, 19, 33, 3, 38, 39, 6, 7, 37, 19, 51, 3, 1, 2, 51, -47, +2, 88, -35, -85, -3, -101, -95, -39, 1, -15, -103, 73, 31, 28, 51, -3, -17, -123, -20, -36, 5, -70, -6, 70, 1, +-68, -2, 68, 2, 90, 1, -106, -62, 110, -115, -117, -102, 1, 24, -2, -24, 0, 0, 2, -1, -89, 0, 0, 5, -41, +5, -70, 0, 11, 0, 15, 0, -21, 64, 56, 12, 0, 15, 16, 15, 2, 15, -38, 13, 2, 6, 5, 30, 8, 8, +7, 7, 0, 3, 4, 30, 2, 1, 2, 10, 9, 30, 11, 0, 8, 13, 82, 14, 82, -112, 15, 1, 15, -23, 15, +12, 31, 12, 79, 12, -49, 12, -33, 12, 5, 12, 64, 14, 17, 52, 12, -72, -1, -64, 64, 13, 9, 11, 52, -97, +12, 1, 12, 64, 46, 100, 52, 12, 7, -72, -1, -64, 64, 44, 16, 18, 52, 7, 84, 3, 74, 32, 10, 32, 13, +2, 10, 26, 17, 4, 9, 32, 1, 0, 50, 16, 16, 2, 85, 0, 10, 15, 15, 2, 85, 0, 26, 13, 13, 2, +85, 0, 38, 12, 12, 2, 85, 0, -72, -1, -15, 64, 23, 11, 11, 2, 85, 0, 8, 16, 16, 6, 85, 0, 15, +15, 15, 6, 85, 0, 28, 13, 13, 6, 85, 0, -72, -1, -20, 64, 11, 12, 12, 6, 85, 0, 32, 11, 11, 6, +85, 0, -70, 1, 22, 0, 16, 1, -119, -79, 91, 24, 43, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +60, -3, 60, 78, 16, -10, 93, 77, -12, -28, 43, 47, 43, 114, 43, 43, 113, -3, 93, -12, -19, 0, 63, 60, -3, +60, 63, 60, -3, 60, 18, 57, 47, 60, 16, -3, 60, 63, -3, 93, 60, 49, 48, 33, 17, 33, 21, 33, 17, 33, +21, 33, 17, 33, 21, 1, 19, 51, 3, 1, -111, 4, 36, -4, -98, 3, 43, -4, -43, 3, -124, -7, -48, -123, -20, +-36, 5, -70, -83, -2, 63, -84, -2, 13, -83, 4, -94, 1, 24, -2, -24, 0, 0, 2, -1, -88, 0, 0, 5, -26, +5, -70, 0, 11, 0, 15, 1, 44, -71, 0, 17, -1, -64, 64, 46, 19, 21, 52, 12, 0, 15, 16, 15, 2, 15, +-38, 13, 2, 4, 3, 30, 9, -96, 10, -48, 10, 2, 10, 10, 8, 5, 2, 2, 11, 8, 8, 13, 82, 14, 82, +-112, 15, 1, 15, -23, 12, 64, 15, 17, 52, 12, -72, -1, -64, 64, 29, 9, 11, 52, 12, 32, 11, 11, 6, 85, +79, 12, 95, 12, -96, 12, 3, 80, 12, 1, 16, 12, 1, 12, 5, 8, 32, 7, 7, 6, -72, -1, -35, 64, 29, +16, 16, 2, 85, 6, 12, 15, 15, 2, 85, 6, 30, 13, 13, 2, 85, 6, 10, 12, 12, 2, 85, 6, 18, 16, +16, 6, 85, 6, -72, -1, -2, 64, 52, 15, 15, 6, 85, 6, 17, 13, 13, 6, 85, 6, 10, 12, 12, 6, 85, +96, 6, -113, 6, 2, 6, 26, 80, 17, -128, 17, 2, 17, 2, 11, 32, 1, 0, 8, 16, 16, 2, 85, 0, 28, +15, 15, 2, 85, 0, 46, 13, 13, 2, 85, 0, -72, -1, -6, 64, 23, 12, 12, 2, 85, 0, 48, 16, 16, 6, +85, 0, 25, 15, 15, 6, 85, 0, 38, 13, 13, 6, 85, 0, -72, -1, -6, 64, 20, 12, 12, 6, 85, 0, 64, +11, 11, 6, 85, 79, 0, 95, 0, -65, 0, 3, 0, -35, 16, -72, 1, -119, -79, 89, 24, 43, 16, -10, 93, 43, +43, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, 16, 93, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 60, 16, +-3, 60, 47, 114, 113, 93, 43, 43, 43, -3, 93, -12, -19, 0, 63, 60, 63, 60, 18, 57, 47, 93, 60, -3, 60, +63, -3, 93, 60, 49, 48, 1, 43, 33, 17, 51, 17, 33, 17, 51, 17, 35, 17, 33, 17, 1, 19, 51, 3, 1, +104, -62, 2, -6, -62, -62, -3, 6, -3, 126, -123, -20, -36, 5, -70, -3, -90, 2, 90, -6, 70, 2, -77, -3, 77, +4, -94, 1, 24, -2, -24, 0, 2, -1, -88, 0, 0, 2, 42, 5, -70, 0, 3, 0, 7, 0, -58, 64, 50, 15, +9, 47, 9, 48, 9, -128, 9, 4, 0, 7, 16, 7, 2, 7, -38, 6, 5, 2, 1, 2, 0, 8, 5, 82, 6, +82, -112, 7, 1, 7, -23, 4, 22, 12, 13, 2, 85, 4, 24, 11, 11, 6, 85, 4, 64, 15, 17, 52, 4, -72, +-1, -64, 64, 95, 9, 11, 52, 79, 4, 95, 4, -96, 4, -80, 4, 4, 16, 4, 1, 4, 2, 3, 32, 1, 0, +10, 16, 16, 2, 85, 0, 28, 15, 15, 2, 85, 0, 46, 13, 13, 2, 85, 0, 56, 12, 12, 2, 85, 0, 10, +11, 11, 2, 85, 0, 4, 16, 16, 6, 85, 0, 12, 15, 15, 6, 85, 0, 42, 13, 13, 6, 85, 0, 18, 12, +12, 6, 85, 0, 24, 11, 11, 6, 85, 95, 0, 111, 0, 127, 0, 3, 79, 0, 95, 0, 2, 0, -35, 8, -72, +1, -119, -79, 89, 24, 43, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, 47, 114, +93, 43, 43, 43, 43, -3, 93, -12, -19, 0, 63, 63, 63, 60, -19, 93, 49, 48, 1, 93, 33, 17, 51, 17, 1, +19, 51, 3, 1, 104, -62, -3, 126, -123, -20, -36, 5, -70, -6, 70, 4, -94, 1, 24, -2, -24, 0, 3, -1, -89, +-1, -25, 5, -46, 5, -44, 0, 12, 0, 24, 0, 28, 1, 14, 64, 86, 5, 15, 10, 17, 10, 21, 5, 23, 19, +15, 29, 17, 29, 21, 19, 23, 71, 14, 73, 18, 73, 20, 71, 24, 88, 5, 88, 7, 86, 11, 84, 15, 90, 17, +91, 18, 93, 21, 83, 23, -119, 18, -102, 2, -107, 4, 23, 0, 28, 16, 28, 2, 28, -38, 27, 26, 2, 22, 30, +3, 3, 16, 30, 9, 9, 26, 82, 27, 82, -112, 28, 1, 28, -23, 25, 32, 11, 11, 6, 85, 25, 64, 15, 17, +52, 25, -72, -1, -64, 64, 15, 9, 11, 52, -96, 25, -80, 25, 2, -128, 25, 1, 25, 19, 38, 6, -72, -1, -22, +64, 11, 16, 16, 2, 85, 6, 8, 15, 15, 2, 85, 6, -72, -1, -18, -76, 13, 13, 2, 85, 6, -72, -1, -16, +64, 11, 12, 12, 2, 85, 6, 16, 11, 11, 2, 85, 6, -72, -1, -11, -76, 13, 13, 6, 85, 6, -72, -1, -8, +64, 55, 12, 12, 6, 85, 6, 26, 30, 13, 38, 0, 10, 15, 16, 2, 85, 0, 16, 11, 14, 2, 85, 0, 10, +9, 10, 2, 85, 0, 11, 13, 13, 6, 85, 0, 18, 12, 12, 6, 85, 0, 73, 11, 11, 6, 85, 15, 0, 31, +0, 47, 0, 3, 0, 46, 29, -72, 1, -119, -79, 92, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, 43, -19, 78, +16, -10, 43, 43, 43, 43, 43, 43, 43, 77, -19, 47, 113, 93, 43, 43, 43, -3, 93, -12, -19, 0, 63, -19, 63, +-19, 63, 60, -19, 93, 49, 48, 1, 93, 19, 16, 0, 33, 32, 0, 17, 16, 0, 33, 34, 36, 2, 55, 20, 0, +51, 50, 0, 17, 16, 0, 35, 34, 0, 37, 19, 51, 3, 88, 1, -118, 1, 52, 1, 53, 1, -121, -2, 118, -2, +-51, -35, -2, -77, -109, -56, 1, 16, -28, -32, 1, 22, -2, -24, -37, -41, -2, -32, -2, -121, -123, -20, -36, 2, -54, +1, 110, 1, -100, -2, 93, -2, -86, -2, -84, -2, 96, -35, 1, 91, -88, -5, -2, -63, 1, 59, 1, 20, 1, 24, +1, 57, -2, -38, -101, 1, 24, -2, -24, 0, 2, -1, -89, 0, 0, 6, -68, 5, -70, 0, 12, 0, 16, 1, -51, +-74, 8, 9, 58, 3, 4, 59, 9, -72, -1, -25, -77, 18, 23, 52, 8, -72, -1, -25, 64, 14, 18, 23, 52, 4, +25, 18, 23, 52, 3, 25, 18, 23, 52, 9, -72, -1, -40, -77, 24, 33, 52, 8, -72, -1, -40, 64, 42, 24, 33, +52, 4, 40, 24, 33, 52, 18, 38, 4, 41, 8, 42, 10, 47, 18, 4, 104, 1, 104, 6, 104, 11, -34, 6, 4, +5, 4, 3, 3, 6, 8, 7, 9, 9, 6, 6, 3, 6, 9, 3, -72, -1, -10, 64, 42, 12, 16, 2, 85, 3, +32, 2, 1, 20, 2, 2, 1, 6, 9, 6, 3, 9, 10, 12, 16, 2, 85, 9, 32, 10, 11, 20, 10, 10, 11, +0, 16, 16, 16, 2, 16, -38, 15, 14, 2, 1, 11, -72, -1, -32, 64, 11, 13, 13, 6, 85, 11, 32, 11, 11, +6, 85, 11, -72, 2, 25, 64, 42, 10, 10, 9, 9, 3, 3, 2, 2, 0, 8, 11, 6, 1, 3, 2, 0, 14, +82, 15, 82, -112, 16, 1, 16, -23, 13, 25, 12, 12, 2, 85, 96, 13, 112, 13, 2, 13, 64, 15, 17, 52, 13, +-72, -1, -64, 64, 14, 9, 11, 52, 79, 13, 95, 13, -80, 13, -64, 13, 4, 13, 18, -72, 2, 24, 64, 9, 12, +9, 82, 64, 10, -128, 10, 2, 10, -72, 1, -75, 64, 13, 11, 11, 12, 32, 0, 3, 82, 79, 2, -113, 2, 2, +2, -72, 1, -75, 64, 39, 1, 1, 0, 36, 16, 16, 2, 85, 0, 12, 15, 15, 2, 85, 0, 28, 12, 12, 2, +85, 0, 34, 16, 16, 6, 85, 0, 32, 15, 15, 6, 85, 0, 12, 12, 12, 6, 85, 0, -72, 2, 71, -78, 17, +6, 12, -72, 1, -119, -79, -88, 24, 43, 17, 57, 16, -10, 43, 43, 43, 43, 43, 43, 60, 16, -12, 93, -19, 16, +-3, 60, 16, -12, 93, -19, 16, -26, 47, 93, 43, 43, 113, 43, -3, 93, -12, -19, 0, 17, 18, 23, 57, 63, 63, +60, 16, 60, 16, 60, 16, -12, 43, 43, 60, 63, 60, -19, 93, -121, 5, 46, 43, 43, 8, 125, 16, -60, -121, 5, +46, 24, 43, 43, 8, 125, 16, -60, -121, 14, 16, -60, -60, -121, 14, 16, -60, -60, 75, -80, 23, 83, 75, -80, 28, +81, 90, 88, -76, 8, 12, 9, 12, 4, -70, -1, -12, 0, 3, -1, -12, 1, 56, 56, 56, 56, 89, 49, 48, 0, +93, 1, 93, 67, 92, 88, 64, 9, 9, 34, 25, 57, 8, 34, 25, 57, 4, -72, -1, -34, -79, 25, 57, 43, 43, +43, 89, 43, 43, 43, 43, 43, 43, 43, 43, 43, 33, 17, 1, 51, 1, 22, 23, 54, 55, 1, 51, 1, 17, 1, +19, 51, 3, 3, -79, -3, -53, -20, 1, 33, 85, 64, 66, 94, 1, 28, -30, -3, -73, -5, 52, -123, -20, -36, 2, +109, 3, 77, -2, 70, -125, 117, 115, -112, 1, -81, -4, -77, -3, -109, 4, -94, 1, 24, -2, -24, 0, 0, 2, -1, +-89, 0, 0, 5, -91, 5, -45, 0, 29, 0, 33, 1, -76, 64, 69, -97, 17, -97, 27, 2, 88, 1, 87, 13, 122, +18, 117, 26, -122, 24, -81, 35, 6, 92, 5, 80, 9, 111, 5, 100, 9, 118, 9, 5, 37, 9, 75, 18, 75, 20, +70, 24, 69, 26, 5, 11, 5, 4, 9, 29, 5, 20, 9, 42, 5, 5, 12, 21, 2, 23, 59, 26, 3, 0, 33, +16, 33, 2, 33, -38, 32, 31, 2, 22, -72, 2, 72, 64, 35, 7, 3, 14, 13, 0, 1, 45, 27, 27, 17, 45, +13, 30, 15, 16, 29, 28, 28, 16, 8, 31, 82, 32, 82, -112, 33, 1, 33, -23, 30, 64, 15, 17, 52, 30, -72, +-1, -64, 64, 16, 9, 11, 52, 79, 30, 95, 30, -96, 30, -80, 30, -64, 30, 5, 30, 13, -72, 2, 58, -77, 16, +16, 17, 1, -69, 2, 58, 0, 27, 0, 28, -1, -10, 64, 17, 11, 11, 2, 85, 28, 17, 10, 11, 11, 2, 85, +47, 17, 79, 17, 2, 17, -72, 2, 120, 64, 13, 14, 19, 38, 11, 74, 15, 14, 12, 16, 16, 2, 85, 14, -72, +-1, -10, 64, 11, 15, 15, 2, 85, 14, 6, 13, 13, 2, 85, 14, -72, -1, -4, -76, 12, 12, 2, 85, 14, -72, +-1, -24, 64, 11, 11, 11, 2, 85, 14, 16, 16, 16, 6, 85, 14, -72, -1, -6, -76, 12, 13, 6, 85, 14, -72, +-1, -9, 64, 18, 11, 11, 6, 85, 16, 19, -81, 14, 2, 14, 106, 35, 32, 28, 64, 28, 2, 28, -72, 2, 120, +-75, 29, 25, 38, 3, 74, 29, -72, -1, -32, -76, 16, 16, 2, 85, 29, -72, -1, -22, -76, 15, 15, 2, 85, 29, +-72, -1, -18, -76, 13, 13, 2, 85, 29, -72, -1, -10, -76, 12, 12, 2, 85, 29, -72, -1, -32, -76, 16, 16, 6, +85, 29, -72, -1, -20, -76, 15, 15, 6, 85, 29, -72, -1, -14, -76, 13, 13, 6, 85, 29, -72, -1, -8, 64, 10, +12, 12, 6, 85, 32, 29, 1, 29, -84, 34, -70, 1, -119, 1, -114, 0, 24, 43, 16, -10, 93, 43, 43, 43, 43, +43, 43, 43, 43, -12, -19, 16, -19, 93, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 60, -12, -19, 16, -19, +93, 43, 16, 43, 60, -19, 16, 60, 16, -19, 47, 93, 43, 43, -3, 93, -12, -19, 0, 63, 60, 16, 60, 16, 60, +-3, -12, 60, 16, -12, 60, 16, 60, 63, -19, 63, 60, -19, 93, 49, 48, 1, 113, 93, 93, 93, 93, 0, 93, 55, +33, 36, 17, 52, 18, 36, 51, 50, 4, 18, 21, 16, 5, 33, 21, 33, 53, 36, 17, 52, 2, 35, 34, 2, 21, +16, 5, 21, 33, 3, 19, 51, 3, 107, 1, 64, -2, -48, -96, 1, 36, -51, -53, 1, 15, -81, -2, -48, 1, 64, +-3, -58, 1, 100, -5, -55, -49, -8, 1, 98, -3, -59, -60, -123, -20, -36, -83, -2, 1, 110, -57, 1, 60, -73, -88, +-2, -58, -40, -2, -110, -2, -83, -94, -90, 1, -77, -11, 1, 61, -2, -63, -23, -2, 71, -86, -94, 4, -94, 1, 24, +-2, -24, 0, 0, 4, -1, 120, 0, 0, 2, 79, 5, -29, 0, 3, 0, 7, 0, 11, 0, 15, 0, -77, 64, 26, +9, -93, 10, 13, -93, 15, 64, 10, 15, 15, 4, 1, -97, 4, 1, 4, 66, -128, 7, -55, 2, 1, 6, 0, 10, +9, -72, 2, 48, -77, 11, 11, 4, 12, -72, 2, 48, 64, 12, 80, 14, 96, 14, 2, 14, 14, 4, 31, 7, 1, +7, -72, 1, 12, 64, 20, -16, 6, 1, 6, 64, 44, 47, 52, 6, 73, 5, 64, 4, 17, 78, 2, 3, 37, 1, +0, -72, -1, -4, 64, 17, 14, 14, 2, 85, 0, 4, 11, 12, 2, 85, 0, 12, 16, 16, 6, 85, 0, -72, -1, +-2, -76, 13, 13, 6, 85, 0, -72, -1, -4, 64, 13, 12, 12, 6, 85, 16, 0, 32, 0, 2, 0, 69, 16, 71, +-71, 1, 10, 0, 24, 43, 16, -10, 93, 43, 43, 43, 43, 43, 60, -3, 60, -28, 47, -19, -10, 43, 113, -19, 113, +17, 51, 47, 93, -19, 17, 51, 47, -19, 0, 63, 63, 60, -2, 26, -19, 93, 113, 60, 60, 26, 16, -19, 16, -19, +49, 48, 51, 17, 51, 17, 3, 51, 3, 35, 37, 51, 21, 35, 37, 51, 21, 35, -119, -76, 84, -70, -56, 117, 1, +60, -83, -83, -3, -42, -83, -83, 4, 38, -5, -38, 5, -29, -2, -21, -64, -64, -64, -64, 0, -1, -1, -1, -3, 0, +0, 5, 89, 5, -70, 2, 6, 0, 36, 0, 0, -1, -1, 0, -106, 0, 0, 4, -23, 5, -70, 2, 6, 0, 37, +0, 0, 0, 2, -1, -2, 0, 0, 5, 90, 5, -70, 0, 3, 0, 10, 0, -31, 64, 60, -124, 8, 1, -97, 8, +1, 7, 2, 23, 2, 47, 12, 48, 12, 120, 6, -119, 1, -122, 2, -105, 4, -104, 5, -73, 4, -72, 5, -57, 4, +-56, 5, -25, 3, -9, 3, 15, 6, 4, 8, 5, 39, 4, 40, 5, 55, 4, 56, 5, 6, -108, 8, 1, 1, 14, +15, 16, 2, 85, 2, -72, -1, -14, -76, 15, 16, 2, 85, 2, -72, -1, -10, 64, 60, 12, 12, 2, 85, 6, 8, +8, 5, 10, 4, 4, 8, 2, 3, 1, 0, 8, 5, 8, 4, 5, 32, 3, 2, 20, 3, 3, 2, 8, 4, 8, +5, 4, 32, 0, 1, 20, 0, 0, 1, 5, 4, 30, 0, 8, 1, 2, 2, 1, 2, 3, 8, 0, 8, 4, 1, +0, 5, 2, 3, -70, 2, 20, 0, 0, 2, 20, 64, 13, 8, 6, 12, 12, 6, 85, -49, 8, 1, 8, 8, 12, +11, 25, 17, 18, 57, 47, 93, 43, 24, -19, -19, 57, 57, 18, 57, 57, 0, 63, 63, 63, 63, 17, 57, 16, -3, +60, -121, 5, 46, 43, 8, 125, 16, -60, -121, 5, 46, 24, 43, 8, 125, 16, -60, 1, 17, 57, 17, 57, -121, 14, +16, -60, -121, 14, 16, -60, 49, 48, 1, 43, 43, 43, 114, 113, 93, 0, 114, 93, 35, 1, 51, 1, 37, 33, 1, +38, 39, 6, 7, 2, 2, 51, -47, 2, 88, -5, -79, 3, 47, -2, -61, 71, 33, 27, 52, 5, -70, -6, 70, -83, +3, 67, -68, 116, -120, -112, 0, -1, -1, 0, -94, 0, 0, 4, -24, 5, -70, 2, 6, 0, 40, 0, 0, -1, -1, +0, 41, 0, 0, 4, -80, 5, -70, 2, 6, 0, 61, 0, 0, -1, -1, 0, -92, 0, 0, 5, 34, 5, -70, 2, +6, 0, 43, 0, 0, -1, -1, 0, -65, 0, 0, 1, -127, 5, -70, 2, 6, 0, 44, 0, 0, -1, -1, 0, -106, +0, 0, 5, 82, 5, -70, 2, 6, 0, 46, 0, 0, 0, 1, 0, 11, 0, 0, 5, 72, 5, -70, 0, 10, 0, +-25, 64, 26, 95, 5, 1, 0, 12, 47, 12, 48, 12, 111, 12, 4, 87, 3, 92, 4, 86, 5, 3, 10, 8, 15, +16, 2, 85, 0, -72, -1, -8, 64, 17, 15, 16, 2, 85, 3, 5, 5, 2, 7, 8, 8, 5, 0, 1, 10, 9, +5, -72, -1, -18, 64, 9, 12, 12, 2, 85, 5, 2, 5, 8, 2, -72, -1, -20, 64, 13, 12, 12, 6, 85, 2, +32, 1, 0, 20, 1, 1, 0, 5, -72, -1, -18, 64, 40, 12, 12, 2, 85, 5, 8, 5, 2, 8, 12, 12, 13, +6, 85, 8, 32, 9, 10, 20, 9, 9, 10, 5, 0, 1, 9, 8, 8, 2, 1, 8, 10, 0, 2, 8, 10, 9, +0, 2, 1, -70, 1, 95, 0, 9, -1, -8, -76, 13, 13, 2, 85, 9, -70, 1, 95, 0, 5, -1, -12, 64, 13, +11, 11, 6, 85, 0, 5, 48, 5, 2, 5, 5, 12, 11, 25, 17, 18, 57, 47, 93, 43, 24, -19, 43, -19, 57, +57, 18, 57, 57, 0, 63, 60, 63, 60, 63, 60, 17, 18, 57, -121, 5, 46, 43, 43, 8, 125, 16, -60, 43, -121, +5, 46, 24, 43, 43, 8, 125, 16, -60, 43, 1, 17, 57, 17, 57, -121, 14, 16, -60, -121, 14, 16, -60, 49, 48, +1, 43, 43, 114, 93, 0, 114, 1, 1, 35, 1, 38, 39, 6, 7, 1, 35, 1, 3, 16, 2, 56, -45, -2, -125, +50, 27, 33, 45, -2, 116, -58, 2, 61, 5, -70, -6, 70, 4, 40, -116, 101, 121, 120, -5, -40, 5, -70, -1, -1, +0, -104, 0, 0, 6, 15, 5, -70, 2, 6, 0, 48, 0, 0, -1, -1, 0, -100, 0, 0, 5, 31, 5, -70, 2, +6, 0, 49, 0, 0, 0, 3, 0, 109, 0, 0, 4, -58, 5, -70, 0, 3, 0, 7, 0, 11, 0, 62, 64, 39, +5, 30, 31, 7, 1, 79, 7, 95, 7, 127, 7, -113, 7, 4, 7, 7, 0, 9, 30, 11, 8, 2, 30, 0, 2, +6, -100, 1, 98, 10, 86, 13, 7, -100, 0, 98, 11, 86, 12, 16, -10, -28, -28, 16, -10, -28, -28, 0, 63, -19, +63, -19, 18, 57, 47, 93, 113, -19, 49, 48, 19, 33, 21, 33, 19, 33, 21, 33, 3, 33, 21, 33, -120, 4, 35, +-5, -35, 94, 3, 103, -4, -103, 121, 4, 89, -5, -89, 5, -70, -83, -2, 38, -84, -2, 38, -83, -1, -1, 0, 99, +-1, -25, 5, -35, 5, -44, 2, 6, 0, 50, 0, 0, 0, 1, 0, -92, 0, 0, 5, 34, 5, -70, 0, 7, 0, +-84, -71, 0, 9, -1, -64, 64, 14, 19, 21, 52, 3, 8, 0, 8, 5, 30, 1, 2, 5, 32, 3, -72, -1, -18, +-76, 15, 15, 2, 85, 3, -72, -1, -14, 64, 25, 13, 13, 2, 85, 3, 16, 12, 12, 2, 85, 3, 93, -128, 9, +1, 9, 6, 32, 0, 32, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, +13, 2, 85, 0, -72, -1, -6, -76, 12, 12, 2, 85, 0, -72, -1, -11, 64, 14, 12, 13, 6, 85, 0, 8, 11, +11, 6, 85, 32, 0, 1, 0, -72, -1, -64, -74, 19, 21, 52, 0, 93, 8, 9, -72, -1, -32, 64, 19, 11, 11, +6, 85, 32, 9, 1, 32, 9, 80, 9, 96, 9, 112, 9, 4, 59, 89, 24, 43, 93, 113, 43, 16, -10, 43, 93, +43, 43, 43, 43, 43, 43, -19, 16, 93, -10, 43, 43, 43, -19, 0, 63, -19, 63, 63, 49, 48, 1, 43, 51, 17, +33, 17, 35, 17, 33, 17, -92, 4, 126, -62, -3, 6, 5, -70, -6, 70, 5, 13, -6, -13, -1, -1, 0, -98, 0, +0, 4, -3, 5, -70, 2, 6, 0, 51, 0, 0, 0, 1, 0, -108, 0, 0, 4, -94, 5, -70, 0, 11, 0, -39, +64, 60, -11, 9, 1, 54, 3, 54, 9, 2, 21, 4, -107, 4, -91, 4, -42, 2, 4, 7, 2, 11, 9, 22, 2, +26, 9, 38, 2, 45, 9, 55, 2, 58, 3, 63, 9, 73, 3, 10, 105, 3, 106, 9, 120, 3, 120, 9, -72, 3, +-71, 9, -10, 2, -7, 9, 8, 3, 4, 3, 2, 4, -72, -1, -16, -76, 15, 16, 2, 85, 4, -72, -1, -16, 64, +17, 12, 12, 2, 85, 4, 30, 8, 9, 20, 8, 8, 9, 3, 2, 3, 4, 2, -72, -1, -10, 64, 54, 15, 16, +2, 85, 2, 18, 12, 12, 6, 85, 2, 30, 10, 9, 20, 10, 10, 9, 10, 8, 9, 3, 4, 4, 2, 4, 5, +2, 1, 30, 11, 2, 5, 30, 7, 8, 4, 2, 9, 3, 4, 8, 8, 7, 10, 11, 11, 7, 0, -29, 32, 6, +1, 6, -72, 1, 49, -77, 13, 7, -23, 12, 16, -26, 16, -10, 93, -28, 16, 60, 16, 60, 16, 60, 18, 23, 57, +0, 63, -19, 63, -3, 60, 16, 60, 17, 18, 23, 57, -121, 5, 46, 43, 43, 43, 8, 125, 16, -60, -121, 5, 46, +24, 43, 43, 43, 8, 125, 16, -60, 49, 48, 1, 93, 113, 114, 0, 113, 93, 1, 21, 33, 1, 1, 33, 21, 33, +53, 1, 1, 53, 4, 121, -4, -19, 1, -12, -2, 12, 3, 60, -5, -14, 1, -33, -2, 33, 5, -70, -83, -3, -20, +-3, -76, -83, -54, 2, 47, 1, -2, -61, 0, -1, -1, 0, 48, 0, 0, 4, -70, 5, -70, 2, 6, 0, 55, 0, +0, -1, -1, 0, 6, 0, 0, 5, 70, 5, -70, 2, 6, 0, 60, 0, 0, -1, -1, 0, 9, 0, 0, 5, 73, +5, -70, 2, 6, 0, 59, 0, 0, 0, 1, 0, 127, 0, 0, 6, 48, 5, -70, 0, 22, 1, 10, 64, 74, 64, +4, 79, 9, 73, 15, 64, 20, 64, 24, 96, 24, 112, 24, -112, 24, -96, 24, 9, 0, 24, 32, 24, 48, 24, 64, +24, 4, 21, 32, 15, 17, 52, 15, 32, 15, 17, 52, 35, 3, 35, 10, 52, 3, 52, 10, -94, 10, -28, 10, -10, +10, 7, 8, 5, 93, 16, 19, 19, 0, 18, 12, 2, 6, 2, 0, 2, 18, 8, 7, 17, 32, 6, 18, -72, -1, +-5, 64, 14, 12, 13, 6, 85, 18, 18, 22, 11, 32, 13, 1, 32, 22, 13, -72, -1, -16, -76, 15, 15, 2, 85, +13, -72, -1, -22, -76, 12, 12, 2, 85, 13, -72, -1, -32, 64, 27, 12, 13, 6, 85, 0, 13, 32, 13, 48, 13, +64, 13, 4, 64, 13, 96, 13, 112, 13, -112, 13, -96, 13, -1, 13, 6, 13, -72, 2, 93, 64, 16, 24, -128, 24, +-64, 24, -48, 24, 3, -96, 24, -32, 24, -16, 24, 3, 24, -72, -1, -64, -77, 9, 17, 52, 22, -72, -1, -12, 64, +32, 16, 16, 2, 85, 22, 8, 12, 12, 2, 85, 22, 16, 15, 15, 6, 85, 22, 16, 13, 13, 6, 85, 22, 20, +12, 12, 6, 85, 32, 22, 1, 22, -71, 2, 93, 0, 23, 16, -28, 93, 43, 43, 43, 43, 43, 43, 93, 113, 16, +-26, 93, 113, 43, 43, 43, 16, -19, 16, -19, 18, 57, 47, 43, 60, -3, 60, 0, 63, 63, 63, 63, 17, 18, 57, +47, 60, -3, 60, 49, 48, 0, 93, 43, 43, 1, 113, 93, 19, 51, 17, 20, 22, 23, 17, 51, 17, 54, 54, 17, +17, 51, 17, 16, 5, 17, 35, 17, 36, 0, 17, 127, -62, -42, -33, -62, -46, -29, -61, -3, -120, -62, -2, -74, -2, +-45, 5, -70, -2, 117, -15, -63, 18, 3, 79, -4, -79, 13, -50, 1, 1, 1, 115, -2, 98, -3, -77, 10, -2, 59, +1, -59, 6, 1, 53, 1, 11, 0, 0, 1, 0, 97, 0, 0, 5, -101, 5, -45, 0, 29, 1, 119, 64, 91, -97, +17, -97, 27, 2, 88, 1, 89, 4, 88, 5, 87, 13, 91, 20, 84, 21, 88, 23, 88, 24, 122, 18, 117, 26, -122, +24, 11, 92, 5, 80, 9, 111, 5, 100, 9, 118, 9, 5, 37, 9, 75, 18, 75, 20, 70, 24, 69, 26, 5, 11, +5, 4, 9, 29, 5, 20, 9, 42, 5, 5, 12, 21, 2, 23, 59, 26, 3, 22, 30, 7, 3, 14, 13, 0, 1, +45, 27, 27, 17, 45, 13, 30, 15, 16, 29, 28, 28, 16, 8, 13, -72, 2, 58, -77, 16, 16, 17, 1, -69, 2, +58, 0, 27, 0, 28, -1, -10, 64, 17, 11, 11, 2, 85, 28, 17, 10, 11, 11, 2, 85, 47, 17, 79, 17, 2, +17, -72, 2, 120, 64, 13, 14, 19, 38, 11, 74, 15, 14, 16, 16, 16, 2, 85, 14, -72, -1, -10, 64, 11, 15, +15, 2, 85, 14, 10, 13, 13, 2, 85, 14, -72, -1, -20, 64, 11, 11, 11, 2, 85, 14, 16, 16, 16, 6, 85, +14, -72, -1, -6, -76, 12, 13, 6, 85, 14, -72, -1, -9, 64, 19, 11, 11, 6, 85, 16, 19, 1, 14, 106, 95, +31, 1, 31, 32, 28, 64, 28, 2, 28, -72, 2, 120, -75, 29, 25, 38, 3, 74, 29, -72, -1, -32, -76, 16, 16, +2, 85, 29, -72, -1, -22, -76, 15, 15, 2, 85, 29, -72, -1, -18, -76, 13, 13, 2, 85, 29, -72, -1, -10, -76, +12, 12, 2, 85, 29, -72, -1, -32, -76, 16, 16, 6, 85, 29, -72, -1, -20, -76, 15, 15, 6, 85, 29, -72, -1, +-14, -76, 13, 13, 6, 85, 29, -72, -1, -8, 64, 15, 12, 12, 6, 85, 96, 29, 1, 0, 29, 32, 29, 2, 29, +-84, 30, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, -12, -19, 16, -19, 93, 16, 93, -10, 93, 43, 43, +43, 43, 43, 43, 43, 60, -12, -19, 16, -19, 93, 43, 16, 43, 60, -19, 16, 60, 16, -19, 0, 63, 60, 16, 60, +16, 60, -3, -12, 60, 16, -12, 60, 16, 60, 63, -19, 49, 48, 1, 113, 93, 93, 93, 93, 0, 93, 55, 33, 36, +17, 52, 18, 36, 51, 50, 4, 18, 21, 16, 5, 33, 21, 33, 53, 36, 17, 52, 2, 35, 34, 2, 21, 16, 5, +21, 33, 97, 1, 64, -2, -48, -96, 1, 36, -51, -53, 1, 15, -81, -2, -48, 1, 64, -3, -58, 1, 100, -5, -55, +-49, -8, 1, 98, -3, -59, -83, -2, 1, 110, -57, 1, 60, -73, -88, -2, -58, -40, -2, -110, -2, -83, -94, -90, 1, +-77, -11, 1, 61, -2, -63, -23, -2, 71, -86, -94, -1, -1, 0, 4, 0, 0, 2, 53, 6, -31, 2, 38, 0, 44, +0, 0, 1, 7, 0, -114, -1, -57, 1, 30, 0, 40, -75, 2, 1, 1, 2, 2, 11, -71, 2, 33, 0, 41, 0, +43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 5, 10, 1, 2, 65, 43, 27, -76, 8, 2, 0, 72, 43, 43, 89, +53, 53, -1, -1, 0, 6, 0, 0, 5, 70, 6, -31, 2, 38, 0, 60, 0, 0, 1, 7, 0, -114, 1, 80, 1, +30, 0, 27, 64, 11, 2, 1, 17, 11, 0, 72, 43, 1, 2, 2, 20, -70, 2, 33, 0, 41, 1, 100, -123, 0, +43, 1, 43, 53, 53, 0, -1, -1, 0, 72, -1, -24, 4, 83, 5, -62, 2, 38, 1, 46, 0, 0, 1, 7, 0, +-115, 0, -12, 0, 0, 0, 27, 64, 14, 2, -32, 33, -16, 33, 2, 33, 21, 0, 72, 43, 2, 1, 33, -71, 2, +34, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, 98, -1, -24, 3, 99, 5, -62, 2, 38, 1, 48, 0, +0, 1, 7, 0, -115, 0, -112, 0, 0, 0, 22, 64, 10, 1, 0, 37, 39, 28, 0, 65, 1, 1, 37, -71, 2, +34, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, -117, -2, 105, 3, -22, 5, -62, 2, 38, 2, 24, 0, 0, 1, +7, 0, -115, 0, -12, 0, 0, 0, 21, 64, 9, 1, 20, 16, 0, 72, 43, 1, 1, 20, -71, 2, 34, 0, 41, +0, 43, 1, 43, 53, 0, -1, -1, 0, 99, 0, 0, 1, -44, 5, -62, 2, 38, 2, 26, 0, 0, 1, 6, 0, +-115, -123, 0, 0, 60, -77, 1, 1, 1, 7, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, +21, 7, 7, 1, 2, 65, 43, 27, -71, 0, 7, -1, -64, -77, 23, 25, 52, 7, -72, -1, -64, 64, 11, 34, 37, +52, 47, 7, 1, 7, 1, 90, 72, 43, 43, 93, 43, 43, 89, 53, -1, -1, 0, -120, -1, -24, 3, -38, 5, -29, +2, 38, 2, 35, 0, 0, 1, 7, 1, -16, 0, -36, 0, 0, 0, 13, -76, 1, 2, 3, 3, 23, -71, 2, 34, +0, 41, 0, 43, 0, 0, 2, 0, -116, -2, 105, 4, 61, 5, -45, 0, 20, 0, 44, 1, 6, 64, 89, 56, 20, +72, 20, 87, 15, 103, 15, 106, 25, 106, 29, 101, 38, 121, 11, 122, 25, 122, 29, -119, 11, -117, 25, -105, 13, 13, +40, 12, 1, 72, 41, 89, 37, -87, 8, -84, 13, 4, 13, 16, 10, 14, 52, -69, 13, -53, 13, 2, 0, 7, 36, +104, 13, 1, 13, 13, 21, 28, 16, 44, -64, 44, 2, 44, 27, 28, 7, 36, 28, 19, 7, 1, 19, 11, 2, 14, +13, 21, 21, 1, 24, 36, 63, 10, 79, 10, 2, 10, -72, 2, 84, 64, 9, 39, 36, 46, 20, 11, 11, 2, 85, +16, -72, -1, -16, -76, 11, 13, 6, 85, 16, -72, -1, -64, 64, 20, 36, 37, 52, 48, 16, 1, 0, 16, 16, 16, +32, 16, 3, 16, 49, 46, 31, 1, 37, 2, -72, -1, -10, 64, 17, 16, 16, 2, 85, 2, 6, 12, 12, 2, 85, +2, 6, 11, 11, 2, 85, 2, -72, -1, -14, 64, 17, 15, 15, 6, 85, 2, 4, 12, 12, 6, 85, 2, 6, 11, +11, 6, 85, 2, -72, -1, -64, 64, 18, 51, 54, 52, -16, 2, 1, 0, 2, 32, 2, -48, 2, -32, 2, 4, 2, +78, 45, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, -10, 93, 93, 43, 43, 43, -19, -12, 93, +-19, 17, 57, 47, 57, 0, 63, 63, 63, 16, -19, 16, -19, 47, 93, -19, 25, 57, 47, 93, 17, 18, 57, 1, 93, +43, 49, 48, 1, 93, 0, 113, 93, 37, 17, 35, 17, 52, 54, 54, 51, 50, 22, 21, 20, 6, 7, 22, 22, 21, +20, 2, 35, 34, 19, 50, 54, 53, 52, 38, 35, 34, 6, 6, 21, 17, 20, 22, 22, 51, 50, 54, 53, 52, 38, +38, 35, 35, 1, 63, -77, 91, -34, -120, -55, -49, -89, 108, -82, -67, -33, -45, -40, 43, -72, -88, -113, 107, 93, -119, +31, 48, -98, 103, 125, -111, 107, -99, -126, 26, -121, -3, -30, 5, -123, -87, -65, 125, -25, -119, -122, -92, 19, 17, -40, +-98, -86, -2, -13, 3, 120, -128, 121, 98, -124, 98, 120, -106, -2, 109, -84, -94, -126, -85, 126, 104, -91, 59, 0, 0, +1, 0, 25, -2, 105, 3, -25, 4, 38, 0, 8, 1, 26, -77, -113, 10, 1, 2, -72, -1, -18, 64, 11, 15, 17, +2, 85, 2, 10, 13, 13, 2, 85, 2, -72, -1, -20, 64, 15, 9, 11, 2, 85, -16, 2, 1, 0, 2, 1, 2, +1, 2, 3, 1, -72, -1, -4, 64, 68, 14, 17, 6, 85, 1, 37, 0, 8, 20, 0, 0, 8, 2, 3, 2, 1, +3, 4, 15, 17, 6, 85, 3, 37, 4, 5, 20, 4, 4, 5, 2, 1, 5, 7, 14, 4, 3, 3, 1, 1, 0, +6, 5, 8, 10, 3, 4, 6, 1, 0, 7, 4, -1, 6, 0, -1, 7, 5, 6, 37, 8, 7, 18, 17, 17, 2, +85, 7, -72, -1, -16, 64, 17, 16, 16, 2, 85, 7, 10, 13, 13, 2, 85, 7, 10, 9, 9, 2, 85, 7, -72, +-1, -2, -76, 16, 16, 6, 85, 7, -72, -1, -8, 64, 38, 12, 12, 6, 85, 0, 7, -113, 7, -32, 7, -16, 7, +4, 64, 7, 1, -80, 7, 1, 7, 7, 10, 9, 0, 10, 48, 10, 96, 10, -128, 10, -112, 10, 5, 64, 10, 1, +10, -72, -1, -64, -78, 21, 26, 52, 43, 113, 93, 17, 18, 57, 47, 114, 113, 93, 43, 43, 43, 43, 43, 43, 60, +-3, 60, 25, 16, -28, 16, -28, 17, 18, 57, 17, 18, 57, -79, 6, 2, 67, 84, 88, -78, 2, 6, 7, 17, 18, +57, 89, 0, 24, 63, 60, 63, 60, 16, 60, 16, 60, 63, 17, 18, 57, -121, 5, 46, 43, 43, 8, 125, 16, -60, +-121, 5, 46, 24, 43, 43, 8, 125, 16, -60, 49, 48, 0, 114, 113, 43, 43, 43, 1, 93, 19, 51, 1, 1, 51, +1, 17, 35, 17, 25, -67, 1, 41, 1, 48, -72, -2, 115, -73, 4, 38, -4, -69, 3, 69, -5, -38, -2, 105, 1, +-105, 0, 0, 1, 0, 72, -2, 81, 3, 118, 5, -70, 0, 31, 0, -20, 64, 32, 8, 25, 24, 25, 108, 4, 119, +6, -122, 6, -90, 4, -87, 24, 7, 26, 3, 67, 3, 84, 3, 3, 55, 3, 122, 29, -117, 29, 3, 2, 30, 17, +-72, 2, 106, 64, 19, 16, 15, 8, 28, 23, 10, 30, 72, 0, 0, 30, 1, 16, 16, 12, -96, 0, 1, 0, -72, +-1, -64, -74, 9, 10, 52, 0, 0, 27, 19, -72, 2, 48, 64, 19, 12, 24, 16, 16, 2, 85, 12, 24, 13, 14, +2, 85, 12, 25, 16, 16, 6, 85, 12, -72, -1, -12, -76, 15, 15, 6, 85, 12, -72, -1, -22, 64, 18, 13, 13, +6, 85, 12, 10, 12, 12, 6, 85, 12, 12, 31, 1, 111, 1, 2, 1, -72, -1, -64, 64, 58, 9, 11, 52, 1, +5, 36, 27, 18, 11, 17, 2, 85, 27, 18, 16, 16, 6, 85, 27, 2, 15, 15, 6, 85, 27, 12, 13, 13, 6, +85, 27, 32, 12, 12, 6, 85, 27, 12, 11, 11, 6, 85, 31, 27, 63, 27, 79, 27, 95, 27, 127, 27, -113, 27, +6, 27, 40, 32, 16, -10, 93, 43, 43, 43, 43, 43, 43, -19, 47, 43, 93, 51, 47, 43, 43, 43, 43, 43, 43, +-19, 17, 51, 47, 43, 93, 17, 51, 47, 17, 51, 0, 63, -19, 63, -19, 63, -19, 17, 51, 49, 48, 1, 93, 0, +113, 93, 19, 33, 21, 4, 0, 21, 20, 22, 23, 30, 2, 21, 20, 6, 6, 35, 55, 54, 53, 52, 38, 38, 39, +46, 2, 53, 52, 0, 55, 33, -22, 2, -116, -2, -13, -2, -109, 108, 121, -100, -125, 98, 120, -99, 113, 49, -88, 54, +78, 109, -105, -103, 76, 1, 86, -20, -2, 96, 5, -70, 122, -90, -3, -25, -28, 120, 116, 10, 14, 41, 127, 89, 97, +-92, 66, -90, 19, 122, 41, 62, 18, 4, 4, 113, -70, 117, -19, 1, -9, -97, 0, 1, 0, -117, -2, 105, 3, -22, +4, 62, 0, 19, 1, 41, 64, 87, 114, 17, 112, 21, -117, 14, -126, 16, -126, 17, -101, 14, -84, 14, -87, 17, -96, +21, -69, 14, -80, 21, -64, 21, -44, 17, -48, 21, -32, 21, -1, 21, 16, -16, 21, 1, 6, 7, 9, 17, 22, 7, +37, 4, 53, 4, 70, 4, -39, 16, -32, 3, -17, 17, 9, 11, 15, 0, 10, 15, 28, 5, 7, 2, 1, 6, 17, +15, 19, 11, 12, 10, 12, 37, 21, 64, 11, 11, 2, 85, 9, 24, 16, 16, 2, 85, 9, -72, -1, -22, 64, 17, +13, 13, 2, 85, 9, 6, 12, 12, 2, 85, 9, 28, 11, 11, 2, 85, 9, -72, -1, -12, 64, 11, 11, 11, 6, +85, 9, 20, 16, 16, 6, 85, 9, -72, -1, -7, 64, 11, 13, 13, 6, 85, 9, 10, 15, 15, 6, 85, 9, -72, +-1, -10, 64, 26, 12, 12, 6, 85, 112, 9, -96, 9, -80, 9, -64, 9, -1, 9, 5, 9, 78, 21, 3, 2, -102, +18, 19, 37, 1, 0, -72, -1, -8, 64, 17, 16, 16, 2, 85, 0, 6, 11, 12, 2, 85, 0, 4, 11, 11, 6, +85, 0, -72, -1, -6, 64, 17, 15, 15, 6, 85, 0, 2, 12, 12, 6, 85, 0, 4, 13, 13, 6, 85, 0, -72, +-1, -64, 64, 21, 51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 20, 17, 12, 19, +17, 18, 57, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, -12, 60, 16, -10, 93, 43, 43, 43, +43, 43, 43, 43, 43, 43, 43, -19, 60, 16, 60, 0, 17, 18, 57, 63, 60, 63, -19, 63, 63, 49, 48, 0, 93, +1, 113, 93, 51, 17, 51, 21, 54, 51, 50, 22, 22, 21, 17, 35, 17, 52, 38, 35, 34, 6, 21, 17, -117, -94, +117, -35, -126, -80, 57, -76, 104, 119, 117, -93, 4, 38, -105, -81, 112, -91, -100, -5, -36, 4, 29, -108, -120, -106, -56, +-3, -68, 0, 3, 0, 92, -1, -24, 4, 24, 5, -45, 0, 7, 0, 13, 0, 18, 1, 52, 64, 97, 87, 1, 87, +3, 88, 5, 88, 7, 103, 1, 103, 3, 6, 36, 16, 41, 18, 58, 11, 53, 13, 53, 16, 58, 18, 70, 1, 73, +3, 73, 5, 70, 7, 73, 11, 70, 13, 67, 16, 74, 18, 102, 5, 105, 7, 118, 16, 121, 18, -122, 16, -119, 18, +-75, 16, -70, 18, 22, 9, 28, 127, 15, -113, 15, 2, 15, 15, 2, 17, 28, 6, 11, 12, 28, 2, 3, 9, 14, +36, 4, 8, 15, 36, 0, 20, 64, 13, 13, 2, 85, 20, 64, 11, 11, 2, 85, 4, -72, -1, -22, 64, 17, 15, +15, 2, 85, 4, 24, 13, 13, 2, 85, 4, 16, 11, 11, 2, 85, 4, -72, -1, -16, -76, 11, 11, 6, 85, 4, +-72, -1, -16, -76, 13, 13, 6, 85, 4, -72, -1, -16, -76, 15, 15, 6, 85, 4, -72, -1, -16, -76, 12, 12, 6, +85, 4, -72, -1, -64, 64, 21, 36, 37, 52, 48, 4, 1, 0, 4, 16, 4, 32, 4, 3, 4, 49, 4, 49, -33, +20, 1, 20, -72, -1, -64, 64, 68, 30, 35, 52, 48, 20, 1, 20, 0, 12, 14, 15, 2, 85, 0, 18, 13, 13, +2, 85, 0, 12, 12, 12, 2, 85, 0, 28, 11, 11, 2, 85, 0, 14, 11, 11, 6, 85, 0, 14, 13, 13, 6, +85, 0, 12, 16, 16, 6, 85, 0, 22, 12, 12, 6, 85, 0, 64, 36, 37, 52, 31, 0, 63, 0, 2, 0, 49, +19, 16, -28, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 16, 113, 43, 93, -26, -10, 93, 93, 43, 43, 43, 43, +43, 43, 43, 43, 43, 43, 16, -3, 60, 16, -3, 60, 0, 63, -19, 63, -19, 18, 57, 47, 93, -19, 49, 48, 1, +93, 0, 93, 19, 16, 33, 32, 17, 16, 33, 32, 19, 33, 2, 38, 35, 32, 1, 33, 18, 33, 32, 92, 1, -34, +1, -34, -2, 34, -2, 34, -70, 2, 72, 10, -96, 124, -2, -23, 2, 61, -3, -72, 11, 1, 25, 1, 26, 2, -35, +2, -10, -3, 10, -3, 11, 3, 62, 1, 57, -32, -3, 86, -3, -25, 0, 1, 0, -119, 0, 0, 1, 61, 4, 38, +0, 3, 0, 76, 64, 18, 2, 1, 6, 0, 10, 5, 78, 2, 3, 37, 1, 0, 6, 11, 12, 2, 85, 0, -72, +-1, -4, -76, 12, 12, 6, 85, 0, -72, -1, -2, 64, 19, 13, 13, 6, 85, 0, 12, 16, 16, 6, 85, 0, 0, +32, 0, 2, 0, 69, 4, 71, -71, 1, 10, 0, 24, 43, 16, -10, 93, 43, 43, 43, 43, 60, -3, 60, -26, 0, +63, 63, 60, 49, 48, 51, 17, 51, 17, -119, -76, 4, 38, -5, -38, 0, 1, 0, -122, 0, 0, 3, -1, 4, 38, +0, 11, 1, 90, -71, 0, 5, -1, -24, -76, 12, 12, 2, 85, 8, -72, -1, -24, -76, 12, 12, 2, 85, 9, -72, +-1, -24, 64, 62, 12, 12, 2, 85, 23, 2, 1, 68, 2, 1, 63, 13, 90, 3, 89, 4, 105, 3, 105, 4, -128, +13, -104, 5, -88, 5, -73, 4, -58, 4, -64, 13, -27, 5, -27, 8, -32, 13, -6, 3, -11, 5, 16, 5, 5, 27, +3, 24, 8, 40, 8, 56, 8, 88, 3, 89, 4, 7, 74, 5, 1, 2, -72, -1, -12, 64, 12, 9, 8, 16, 2, +5, 8, 9, 9, 4, 8, 7, 7, -72, -1, -7, 64, 82, 11, 11, 6, 85, 7, 37, 6, 5, 20, 6, 6, 5, +2, 3, 3, 16, 16, 16, 6, 85, 3, 7, 12, 13, 6, 85, 3, 37, 4, 9, 20, 4, 4, 9, 101, 9, 1, +9, 8, 5, 2, 4, 3, 0, 6, 4, 3, 6, 10, 7, 7, 6, 10, -85, 5, 1, 9, 8, 7, 5, 4, 3, +2, 7, 16, 6, 80, 6, 112, 6, -128, 6, -97, 6, -65, 6, 6, 6, 1, 10, 37, 11, -72, -1, -8, -76, 16, +16, 2, 85, 11, -72, -1, -6, 64, 17, 14, 14, 2, 85, 11, 6, 12, 12, 2, 85, 11, 6, 11, 11, 2, 85, +11, -72, -1, -4, -76, 16, 16, 6, 85, 11, -72, -1, -16, -76, 15, 15, 6, 85, 11, -72, -1, -7, -76, 12, 13, +6, 85, 11, -72, -1, -64, 64, 18, 51, 54, 52, -16, 11, 1, 0, 11, 32, 11, -48, 11, -32, 11, 4, 11, 78, +12, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, -3, 60, 25, 47, 93, 23, 57, 113, 0, 24, 63, 60, +16, 60, 63, 60, 63, 17, 23, 57, 114, -121, 5, 46, 43, 43, 43, 4, 125, 16, -60, -121, 5, 46, 24, 43, 43, +14, 125, 16, -60, 7, 14, 16, 60, 60, 0, 23, 56, 49, 48, 56, 1, 114, 113, 93, 0, 114, 113, 43, 43, 43, +19, 51, 17, 1, 51, 1, 1, 35, 1, 7, 17, 35, -122, -77, 1, -81, -18, -2, 37, 2, 4, -26, -2, 98, 66, +-77, 4, 38, -2, 95, 1, -95, -2, 71, -3, -109, 1, -12, 61, -2, 73, 0, 0, 1, 0, 24, 0, 0, 3, -26, +5, -70, 0, 7, 0, -17, -71, 0, 3, -1, -20, 64, 64, 9, 9, 2, 85, 0, 24, 14, 17, 2, 85, 3, 0, +19, 0, 121, 0, -119, 0, 4, 3, 16, 20, 25, 52, 55, 6, 70, 5, 86, 5, 104, 3, -89, 4, -89, 5, 6, +8, 3, 0, 9, 24, 3, 48, 9, 96, 9, -104, 0, -96, 9, -80, 9, 8, 0, 12, 11, 15, 6, 85, 5, 4, +7, 7, -72, -1, -6, 64, 22, 11, 13, 6, 85, 7, 12, 16, 17, 6, 85, 7, 37, 6, 5, 20, 6, 6, 5, +1, 2, 3, 3, -72, -1, -12, 64, 56, 12, 13, 6, 85, 3, 12, 16, 17, 6, 85, 3, 37, 0, 1, 20, 0, +3, 4, 0, 1, 0, 3, 1, 5, 4, 0, 6, 7, 7, 2, 1, 10, 4, 4, 20, 4, -106, 0, -106, 4, 4, +3, 5, 4, 1, 4, 2, 7, 6, 2, 24, 17, 17, 2, 85, 2, -70, 1, 27, 0, 6, 1, 27, 64, 13, 0, +0, 32, 0, 48, 0, 96, 0, 4, 0, 0, 9, 8, 25, 17, 18, 57, 47, 93, 24, -19, -19, 43, 18, 57, 18, +23, 57, 93, 0, 63, 60, 60, 16, 60, 63, 60, 18, 57, 57, -121, 8, 46, 43, 43, 43, -121, 5, 125, -60, -121, +46, 24, 43, 43, 43, -121, 125, -60, 0, 43, 49, 48, 1, 93, 93, 43, 0, 93, 43, 43, 1, 1, 35, 1, 3, +51, 1, 35, 1, -1, -2, -41, -66, 1, -118, -98, -66, 2, 36, -66, 3, 26, -4, -26, 4, 18, 1, -88, -6, 70, +0, -1, -1, 0, -96, -2, 105, 3, -6, 4, 38, 2, 6, 0, -105, 0, 0, -1, -1, 0, 26, 0, 0, 3, -24, +4, 38, 2, 6, 0, 89, 0, 0, 0, 1, 0, 92, -2, 81, 3, 112, 5, -45, 0, 40, 1, 12, 64, 49, 9, +33, 9, 38, 70, 15, 86, 15, -125, 15, 5, 5, 10, 54, 11, -26, 11, 3, -119, 4, -121, 6, -118, 11, -117, 12, +-121, 35, -101, 38, -58, 11, -42, 12, 8, 105, 4, 103, 6, 107, 11, 106, 30, 121, 12, 121, 30, 6, 33, -72, -1, +-24, -77, 9, 11, 52, 12, -72, -1, -48, 64, 33, 29, 32, 52, 34, 8, 28, -96, 9, 1, 9, 9, 29, 40, 24, +28, 23, 15, 16, 28, 29, 10, 2, 28, 40, 1, 24, 23, 23, 20, 31, 5, 36, 37, -72, -1, -19, -76, 15, 16, +6, 85, 37, -72, -1, -8, -76, 13, 13, 6, 85, 37, -72, -1, -12, 64, 27, 12, 12, 6, 85, 111, 37, 127, 37, +2, 37, 37, 31, 27, 28, 20, 10, 16, 16, 2, 85, 20, 20, 13, 13, 2, 85, 20, -72, -1, -27, -76, 15, 16, +6, 85, 20, -72, -1, -27, -73, 13, 13, 6, 85, 31, 20, 1, 20, -72, -1, -64, 64, 33, 9, 11, 52, 20, 20, +-128, 8, 1, 8, 8, 0, 78, 42, 13, 36, 31, 32, 12, 12, 6, 85, 31, 8, 11, 11, 6, 85, 31, 31, -113, +31, 2, 31, -71, 2, 84, 0, 41, 16, -10, 93, 43, 43, -19, 16, -10, 50, 47, 93, 51, 47, 43, 93, 43, 43, +43, 43, -19, 17, 51, 47, 93, 43, 43, 43, -19, 17, 18, 57, 47, 51, 0, 63, -19, 63, -19, 63, -19, 17, 18, +57, 47, 93, -3, 57, 49, 48, 0, 43, 43, 93, 93, 113, 1, 93, 1, 21, 35, 34, 6, 21, 20, 33, 51, 21, +34, 6, 6, 21, 20, 22, 23, 30, 2, 21, 20, 6, 7, 55, 54, 54, 53, 52, 39, 36, 17, 52, 54, 55, 38, +38, 53, 52, 54, 51, 3, 4, -109, -92, -109, 1, 43, -109, -124, -60, -99, 113, -70, 120, 112, 74, -38, -71, 46, 99, +83, -85, -2, 70, -73, -114, -114, -127, -27, -37, 5, -45, -107, 97, 90, -84, -107, 78, -54, -128, 96, -106, 21, 14, 61, +124, 72, -124, -71, 2, -89, 7, 88, 46, 102, 19, 48, 1, 118, -103, -12, 61, 18, -77, 93, -126, -63, 0, -1, -1, +0, 68, -1, -24, 4, 39, 4, 62, 2, 6, 0, 82, 0, 0, 0, 2, 0, -125, -2, 105, 4, 69, 4, 62, 0, +13, 0, 25, 1, 12, 64, 100, 7, 2, 1, 107, 11, -54, 3, -39, 3, -9, 2, -8, 8, 5, 106, 24, 106, 25, +96, 27, -128, 27, -88, 6, -71, 5, 6, 95, 25, 98, 3, 106, 6, 108, 9, 98, 15, 108, 21, 6, 80, 3, 95, +5, 95, 9, 80, 15, 95, 21, 5, 57, 16, 53, 18, 55, 22, 57, 24, 73, 16, 70, 18, 70, 22, 73, 24, 86, +3, 87, 5, 88, 9, 89, 12, 104, 12, 120, 12, -118, 12, 15, 12, 10, 0, 14, 20, 28, 10, 11, 14, 28, 4, +7, 17, 17, 13, 23, 36, 7, -72, -1, -64, 64, 10, 36, 37, 52, 7, 14, 15, 15, 2, 85, 7, -72, -1, -18, +-76, 15, 15, 6, 85, 7, -72, -1, -18, 64, 24, 11, 13, 6, 85, 48, 7, 96, 7, -128, 7, 3, 0, 7, 16, +7, 32, 7, 3, 7, 49, -33, 27, 1, 27, -72, -1, -64, 64, 10, 30, 35, 52, 48, 27, 1, 27, 13, 37, 0, +-72, -1, -4, 64, 11, 14, 16, 2, 85, 0, 4, 11, 12, 2, 85, 0, -72, -1, -4, 64, 11, 15, 16, 6, 85, +0, 4, 11, 11, 6, 85, 0, -72, -1, -64, 64, 18, 51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, +0, 4, 0, 78, 26, 16, -10, 93, 113, 43, 43, 43, 43, 43, -19, 16, 113, 43, 93, -10, 93, 93, 43, 43, 43, +43, -19, 17, 51, 47, 0, 63, -19, 63, -19, 63, 17, 57, 49, 48, 0, 93, 1, 93, 93, 93, 93, 113, 19, 17, +16, 18, 51, 50, 0, 21, 20, 0, 35, 34, 39, 17, 1, 34, 6, 21, 20, 22, 51, 50, 54, 53, 52, 38, -125, +-18, -29, -30, 1, 15, -2, -3, -45, -59, 115, 1, 35, -125, -98, -100, -122, -121, -86, -74, -2, 105, 3, -123, 1, 46, +1, 34, -2, -52, -10, -9, -2, -53, 125, -2, 4, 5, 64, -55, -37, -59, -60, -53, -61, -34, -63, 0, 0, 1, 0, +86, -2, 81, 3, -58, 4, 62, 0, 34, 0, -18, 64, 75, 39, 8, 41, 31, 54, 8, 57, 32, 70, 8, 74, 32, +6, -122, 32, -104, 31, -88, 5, -88, 31, -73, 32, -57, 32, -40, 4, -39, 31, 8, 38, 32, 55, 32, 71, 32, 118, +32, -122, 4, 5, 9, 28, 27, 21, 28, 16, 15, 3, 28, 33, 7, 19, 18, 18, 13, 30, 1, 0, 0, 24, 36, +13, 8, 16, 16, 2, 85, 13, 4, 16, 16, 6, 85, 13, -72, -1, -4, -76, 15, 15, 6, 85, 13, -72, -1, -8, +-76, 13, 13, 6, 85, 13, -72, -1, -16, -76, 12, 12, 6, 85, 13, -72, -1, -64, 64, 19, 36, 37, 52, 48, 13, +1, 0, 13, 16, 13, 32, 13, 3, 13, 49, -33, 36, 1, 36, -72, -1, -64, 64, 58, 30, 35, 52, 48, 36, 1, +36, 6, 36, 30, 8, 14, 14, 2, 85, 30, 12, 13, 13, 2, 85, 30, 12, 12, 12, 2, 85, 30, 16, 11, 11, +2, 85, 30, 4, 15, 16, 6, 85, 30, 19, 11, 13, 6, 85, 30, 64, 36, 37, 52, 31, 30, 63, 30, 2, 30, +49, 35, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, -19, 16, 113, 43, 93, -10, 93, 93, 43, 43, 43, 43, 43, +43, -19, 51, 47, 51, 17, 18, 57, 47, 51, 0, 63, -19, 63, -19, 47, -19, 49, 48, 0, 93, 93, 1, 93, 1, +7, 38, 35, 34, 6, 21, 20, 22, 23, 30, 2, 21, 20, 6, 35, 34, 39, 55, 22, 51, 50, 54, 53, 52, 38, +39, 38, 38, 53, 52, 0, 33, 50, 3, -58, 42, 112, 112, -55, -18, -125, -62, -117, 124, 70, -34, -90, 67, 85, 44, +58, 43, 96, 110, 79, 126, -34, -39, 1, 89, 1, 36, 123, 4, 28, -106, 35, -7, -88, 116, -77, 51, 37, 65, 115, +75, -119, -80, 14, -91, 12, 83, 59, 54, 57, 27, 47, -4, -82, -15, 1, 100, 0, 0, 1, 0, -120, -1, -24, 3, +-38, 4, 38, 0, 19, 0, -14, 64, 57, 68, 3, 68, 7, 84, 3, 83, 7, -102, 17, -106, 18, 6, 31, 21, 80, +4, 91, 7, 99, 4, 106, 7, 115, 4, 123, 7, -64, 21, -48, 21, -32, 21, -1, 21, 11, 112, 21, -80, 21, 2, +-16, 21, 1, 5, 28, 15, 11, 10, 0, 6, 9, 10, 12, 10, 37, 11, -72, -1, -12, 64, 17, 16, 16, 2, 85, +11, 10, 15, 15, 2, 85, 11, 26, 14, 14, 2, 85, 11, -72, -1, -12, 64, 23, 13, 13, 2, 85, 11, 12, 12, +12, 2, 85, 11, 24, 16, 16, 6, 85, 11, 8, 15, 15, 6, 85, 11, -72, -1, -8, 64, 23, 12, 13, 6, 85, +31, 11, 112, 11, -80, 11, -64, 11, -1, 11, 5, 11, 78, 21, 1, 2, 37, 0, 19, -72, -1, -8, -76, 16, 16, +2, 85, 19, -72, -1, -8, 64, 11, 14, 14, 2, 85, 19, 4, 12, 12, 2, 85, 19, -72, -1, -8, 64, 11, 15, +15, 6, 85, 19, 4, 11, 11, 6, 85, 19, -72, -1, -64, 64, 18, 51, 54, 52, -16, 19, 1, 0, 19, 32, 19, +-48, 19, -32, 19, 4, 19, 78, 20, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 60, -3, 60, 16, -12, 93, 43, +43, 43, 43, 43, 43, 43, 43, -19, 60, 16, 60, 0, 63, 60, 63, -19, 49, 48, 1, 113, 93, 93, 0, 113, 19, +51, 17, 20, 22, 51, 50, 54, 54, 53, 17, 51, 17, 20, 6, 35, 34, 38, 38, 53, -120, -76, -110, 98, 81, 120, +46, -77, -20, -63, -107, -61, 77, 4, 38, -3, -117, -93, -110, 92, 120, 111, 2, 103, -3, -110, -19, -29, -123, -82, -106, +0, 0, 1, 0, 17, -2, 105, 4, 32, 4, 38, 0, 11, 1, 33, 64, 117, 53, 2, 1, -95, 2, -51, 8, -16, +2, -1, 8, 4, 48, 2, 63, 8, 2, 5, 5, 10, 11, 21, 5, 26, 11, 56, 11, 119, 8, 6, -88, 3, -90, +8, -74, 5, -71, 11, -55, 2, -57, 5, -57, 8, -56, 11, -41, 8, -8, 3, -9, 9, 11, 7, 11, 15, 13, 23, +11, 32, 13, 57, 5, 55, 11, 6, 5, 1, 6, 4, 9, 8, 9, 4, 0, 7, 11, 0, 7, 10, 3, 2, 1, +6, 10, 3, 2, 8, 0, 9, 1, 0, 7, 7, 8, 9, 17, 2, 85, 7, 11, 13, 17, 6, 85, 7, 37, 6, +1, 20, 6, 6, 1, 3, 4, 9, 9, -72, -1, -8, -76, 9, 17, 2, 85, 9, -72, -1, -11, 64, 40, 13, 17, +6, 85, 9, 37, 10, 3, 20, 10, 10, 3, 4, 3, 3, 1, 1, 0, 6, 9, 7, 7, 6, 6, 10, 14, 7, +9, 6, 10, 3, 1, 0, 4, -102, 6, 0, -113, 10, 6, -72, -1, -11, -76, 16, 16, 2, 85, 6, -72, -1, -11, +64, 30, 10, 10, 2, 85, 15, 6, 31, 6, 32, 6, 3, 6, -102, 13, 10, 11, 17, 17, 2, 85, 0, 10, 16, +10, 32, 10, 3, 10, 73, 12, 25, 16, -26, 93, 43, 16, -26, 93, 43, 43, 24, 16, -28, 16, -28, 17, 57, 57, +17, 18, 57, 57, 0, 63, 60, 16, 60, 16, 60, 63, 60, 16, 60, 16, 60, -121, 5, 46, 43, 43, 43, -121, 125, +-60, -121, 46, 24, 43, 43, 43, -121, 125, -60, 0, 17, 18, 57, 57, 15, 15, 15, 15, 49, 48, 1, 93, 113, 114, +0, 93, 113, 114, 19, 51, 1, 1, 51, 1, 1, 35, 1, 1, 35, 1, 48, -60, 1, 36, 1, 46, -58, -2, 122, +1, -102, -51, -2, -59, -2, -62, -55, 1, -103, 4, 38, -3, -76, 2, 76, -3, 44, -3, 23, 2, 101, -3, -101, 2, +-29, 0, 1, 0, 122, -2, 105, 5, 57, 4, 38, 0, 28, 1, 18, -73, -76, 19, -32, 30, -1, 30, 3, 11, -72, +-1, -32, -77, 11, 14, 52, 4, -72, -1, -32, 64, 35, 11, 14, 52, 18, 32, 36, 38, 52, -68, 26, -54, 26, 2, +121, 18, 121, 25, 2, 9, 6, 20, 6, -110, 23, 11, 22, 14, 14, 6, 7, 6, 0, 6, 8, 21, -69, 2, 48, +0, 7, 0, 22, -1, -2, -73, 13, 13, 2, 85, 22, 22, 28, 14, -72, 2, 48, -74, 15, 40, 15, 15, 2, 85, +15, -72, -1, -22, 64, 11, 13, 13, 2, 85, 15, 12, 12, 12, 2, 85, 15, -72, -1, -10, 64, 33, 12, 13, 6, +85, 15, 20, 15, 15, 6, 85, 15, 31, 16, 16, 6, 85, 15, 64, 50, 54, 52, -1, 15, 1, -33, 15, -1, 15, +2, 15, 78, 30, 2, -70, 2, 48, 0, 28, -1, -6, 64, 11, 16, 16, 2, 85, 28, 4, 11, 12, 2, 85, 28, +-72, -1, -3, -76, 11, 11, 6, 85, 28, -72, -1, -13, -76, 15, 15, 6, 85, 28, -72, -1, -64, 64, 40, 51, 54, +52, -16, 28, 1, 0, 28, 32, 28, -48, 28, -32, 28, 4, 28, 78, 29, 32, 30, 111, 30, -128, 30, -80, 30, -32, +30, 5, 80, 30, -128, 30, -112, 30, -64, 30, -17, 30, 5, 93, 113, 16, -12, 93, 113, 43, 43, 43, 43, 43, -19, +16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, -19, 18, 57, 47, 43, 60, -3, 60, 0, 63, 63, 63, 63, 63, +-19, 60, 16, 60, 49, 48, 0, 93, 113, 43, 43, 43, 1, 93, 19, 51, 17, 20, 22, 22, 23, 17, 51, 17, 62, +2, 53, 17, 51, 17, 20, 6, 6, 7, 17, 35, 17, 46, 3, 53, 122, -77, 48, -101, -120, -76, -125, -102, 53, -77, +77, -22, -50, -76, -123, -56, -117, 46, 4, 38, -3, -12, -109, -102, 103, 7, 3, -89, -4, 89, 7, 98, -103, -103, 2, +12, -3, -6, -48, -54, -105, 7, -2, -127, 1, 127, 4, 68, -107, -92, -73, 0, 0, 1, 0, 87, -1, -24, 5, -24, +4, 38, 0, 36, 1, 85, 64, 73, 0, 38, 40, 30, 32, 38, 57, 30, 72, 30, 64, 38, 83, 5, 92, 18, 93, +29, 83, 31, 100, 5, 107, 18, 110, 29, 97, 31, 118, 24, 122, 29, 117, 31, 122, 36, -123, 24, -119, 36, -81, 38, +-16, 38, 22, 0, 38, 1, 30, 11, 6, 17, 72, 28, 6, 72, 32, 0, 11, 1, 11, 11, 32, 0, 22, 6, 0, +6, 28, 11, 32, 11, 22, -69, 2, 48, 0, 23, 0, 1, 2, 48, 64, 19, 0, 23, 23, 25, 20, 0, 0, 3, +35, 30, 0, 13, 16, 13, 2, 80, 13, 1, 13, -72, 2, 48, 64, 18, 10, 8, 15, 15, 6, 85, 10, 10, 35, +20, 64, 25, 10, 16, 16, 2, 85, 25, -72, -1, -10, 64, 11, 12, 12, 2, 85, 25, 10, 11, 11, 2, 85, 25, +-72, -1, -13, -76, 15, 15, 6, 85, 25, -72, -1, -23, -76, 12, 13, 6, 85, 25, -72, -1, -64, 64, 41, 36, 37, +52, 32, 25, 48, 25, 2, 0, 25, 1, 0, 25, 16, 25, 32, 25, 48, 25, -81, 25, -16, 25, 6, 0, 25, 16, +25, 32, 25, 64, 25, 96, 25, 5, 25, 49, -33, 38, 1, 38, -72, -1, -64, 64, 10, 30, 35, 52, 48, 38, 1, +38, 3, 64, 35, -72, -1, -10, 64, 11, 11, 11, 2, 85, 35, 5, 16, 16, 6, 85, 35, -72, -1, -5, 64, 29, +15, 15, 6, 85, 35, 24, 13, 13, 6, 85, 35, 27, 12, 12, 6, 85, 35, 64, 36, 37, 52, 31, 35, 63, 35, +2, 35, 49, 37, 16, -10, 93, 43, 43, 43, 43, 43, 43, -19, 16, 113, 43, 93, -10, 93, 93, 114, 113, 43, 43, +43, 43, 43, 43, -19, 18, 57, 47, 43, -19, 113, 114, 57, 17, 18, 57, 47, 17, 18, 57, 47, 16, -19, 16, -19, +0, 63, 63, 63, 63, 17, 18, 57, 47, 93, 16, -19, 16, -19, 17, 18, 57, 49, 48, 1, 114, 93, 19, 51, 2, +21, 20, 22, 51, 50, 54, 54, 53, 17, 51, 17, 20, 22, 22, 51, 50, 54, 53, 52, 3, 51, 18, 17, 16, 2, +35, 34, 39, 6, 35, 34, 2, 53, 16, -11, -82, -107, -128, 99, 64, 112, 37, -77, 37, 113, 64, 98, -128, -108, -83, +-98, -37, -86, -30, 97, 98, -30, -77, -46, 4, 38, -2, -73, -29, -81, -42, 100, -116, 126, 1, 55, -2, -55, 123, -112, +99, -43, -80, -29, 1, 73, -2, -25, -2, -8, -2, -9, -2, -20, -17, -17, 1, 34, -5, 1, 8, -1, -1, -1, -47, +0, 0, 2, 2, 5, -61, 2, 38, 2, 26, 0, 0, 1, 6, 0, -114, -108, 0, 0, 40, -75, 2, 1, 1, 2, +2, 11, -71, 2, 34, 0, 41, 0, 43, 1, -79, 6, 2, 67, 84, 88, -75, 0, 5, 10, 1, 2, 65, 43, 27, +-76, 8, 2, 0, 72, 43, 43, 89, 53, 53, -1, -1, 0, -120, -1, -24, 3, -38, 5, -61, 2, 38, 2, 35, 0, +0, 1, 7, 0, -114, 0, -16, 0, 0, 0, 29, 64, 15, 2, 1, 112, 20, 1, 0, 20, 27, 0, 11, 65, 1, +2, 2, 20, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 52, 0, -1, -1, 0, 68, -1, -24, 4, 39, 5, +-62, 2, 38, 0, 82, 0, 0, 1, 7, 0, -115, 0, -12, 0, 0, 0, 27, 64, 14, 2, -32, 29, -16, 29, 2, +29, 4, 0, 72, 43, 2, 1, 29, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 0, -1, -1, 0, -120, -1, +-24, 3, -38, 5, -62, 2, 38, 2, 35, 0, 0, 1, 7, 0, -115, 0, -36, 0, 0, 0, 11, -78, 1, 1, 20, +-71, 2, 34, 0, 41, 0, 43, 0, -1, -1, 0, 87, -1, -24, 5, -24, 5, -62, 2, 38, 2, 38, 0, 0, 1, +7, 0, -115, 1, -32, 0, 0, 0, 22, 64, 10, 1, 0, 37, 39, 11, 12, 65, 1, 1, 37, -71, 2, 34, 0, +41, 0, 43, 1, 43, 53, -1, -1, 0, -94, 0, 0, 4, -24, 6, -31, 2, 38, 0, 40, 0, 0, 1, 7, 0, +-114, 1, 94, 1, 30, 0, 12, -77, 1, 2, 2, 12, -71, 2, 33, 0, 41, 0, 43, 0, 1, 0, 50, -1, -25, +6, -103, 5, -70, 0, 29, 1, 24, 64, 42, 102, 4, 118, 4, -121, 4, 3, 34, 8, 25, 12, 4, 6, 23, 15, +93, 14, 74, 12, 6, 30, 23, 23, 27, 2, 29, 30, 0, 2, 27, 8, 17, 30, 12, 9, 15, 74, 14, 14, 20, +3, 2, -72, 2, -120, -77, 27, 20, 38, 9, -72, -1, -48, -76, 13, 13, 2, 85, 9, -72, -1, -14, -76, 11, 11, +2, 85, 9, -72, -1, -10, -76, 11, 11, 6, 85, 9, -72, -1, -30, -76, 12, 12, 6, 85, 9, -72, -1, -20, 64, +12, 13, 13, 6, 85, 9, 55, 31, 27, 32, 26, 26, 3, -70, 2, -120, 0, 0, -1, -32, -76, 16, 16, 2, 85, +0, -72, -1, -12, -76, 15, 15, 2, 85, 0, -72, -1, -42, -76, 13, 13, 2, 85, 0, -72, -1, -22, -76, 12, 12, +2, 85, 0, -72, -1, -6, -76, 11, 11, 2, 85, 0, -72, -1, -22, -76, 11, 11, 6, 85, 0, -72, -1, -10, -76, +12, 12, 6, 85, 0, -72, -1, -42, -76, 13, 13, 6, 85, 0, -72, -1, -15, -74, 15, 16, 6, 85, 0, 84, 30, +16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, -19, 16, -10, 43, 43, 43, 43, 43, -19, 16, -19, +17, 18, 57, 47, -28, 0, 63, -19, 63, 63, -3, 60, 18, 57, 47, -19, 16, -3, -19, 17, 18, 57, 18, 57, 49, +48, 67, 121, 64, 24, 18, 22, 7, 11, 18, 11, 20, 54, 1, 22, 7, 20, 54, 1, 19, 10, 17, 54, 0, 21, +8, 23, 54, 1, 43, 43, 1, 43, 43, -127, -127, 0, 93, 19, 33, 21, 33, 17, 54, 51, 50, 0, 21, 20, 2, +35, 34, 39, 55, 22, 51, 50, 54, 53, 52, 38, 35, 34, 7, 17, 35, 17, 33, 50, 4, -110, -2, 24, -3, -69, +-23, 1, 28, -23, -31, 104, -125, 31, 76, 82, -105, -101, -77, -68, -94, -26, -62, -2, 24, 5, -70, -83, -2, 56, 99, +-2, -26, -53, -78, -2, -42, 33, -92, 37, -80, -122, -114, -69, 94, -3, 88, 5, 13, -1, -1, 0, -95, 0, 0, 4, +85, 7, 44, 2, 38, 2, 61, 0, 0, 1, 7, 0, -115, 0, -5, 1, 106, 0, 21, 64, 9, 1, 6, 3, -89, +72, 43, 1, 1, 6, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, 0, 0, 1, 0, 100, -1, -25, 5, 118, 5, +-45, 0, 26, 0, -49, 64, -123, -87, 22, -76, 6, -71, 22, 3, 27, 6, 43, 6, 59, 6, 93, 25, 111, 25, 127, +25, -79, 9, 7, 41, 3, 41, 9, 41, 11, 53, 3, 59, 6, 53, 9, 59, 22, 71, 3, 75, 6, 69, 9, 75, +22, 86, 3, 84, 9, 86, 11, 84, 19, 106, 11, 119, 3, 121, 6, 120, 11, -121, 3, -119, 12, -88, 22, -75, 6, +-56, 8, 24, 7, -29, 32, 8, 96, 8, 112, 8, -128, 8, 4, 8, 8, 10, 17, 21, 84, 20, 20, 10, 17, 26, +30, 2, 2, 10, 23, 30, 17, 3, 5, 30, 10, 9, 1, 1, 8, 2, 21, 38, 20, 7, 38, 20, 98, 47, 8, +1, -97, 8, 1, 8, 26, 32, 28, 1, 28, 26, 45, 2, 38, 13, -72, -1, -7, 64, 19, 16, 16, 6, 85, 13, +10, 11, 11, 6, 85, 32, 13, 1, 13, 25, 27, 99, 92, 24, 43, 16, -10, 93, 43, 43, -3, -28, 16, 93, -12, +93, 113, -28, -19, 16, -19, 17, 18, 57, 47, 0, 63, -19, 63, -19, 18, 57, 47, -19, 17, 18, 57, 47, -28, 17, +18, 57, 47, 93, -28, 49, 48, 1, 93, 113, 0, 93, 1, 21, 33, 22, 18, 51, 32, 19, 23, 2, 33, 32, 0, +19, 52, 18, 36, 51, 50, 4, 23, 7, 2, 33, 34, 2, 7, 3, 89, -3, -33, 11, -4, -59, 1, 94, 89, -69, +127, -2, 27, -2, -91, -2, -83, 11, -105, 1, 56, -40, -28, 1, 51, 54, -66, 83, -2, -61, -42, -13, 12, 3, 75, +-83, -9, -2, -29, 1, 116, 49, -2, 26, 1, -65, 1, 71, -56, 1, 74, -44, -30, -55, 50, 1, 51, -2, -2, -36, +0, -1, -1, 0, 92, -1, -25, 4, -21, 5, -45, 2, 6, 0, 54, 0, 0, -1, -1, 0, -65, 0, 0, 1, -127, +5, -70, 2, 6, 0, 44, 0, 0, -1, -1, 0, 4, 0, 0, 2, 53, 6, -31, 2, 38, 0, 44, 0, 0, 1, +7, 0, -114, -1, -57, 1, 30, 0, 40, -75, 2, 1, 1, 2, 2, 11, -71, 2, 33, 0, 41, 0, 43, 1, -79, +6, 2, 67, 84, 88, -75, 0, 5, 10, 1, 2, 65, 43, 27, -76, 8, 2, 0, 72, 43, 43, 89, 53, 53, -1, +-1, 0, 55, -1, -25, 3, 97, 5, -70, 2, 6, 0, 45, 0, 0, 0, 2, 0, 13, -1, -25, 8, 41, 5, -70, +0, 27, 0, 38, 1, 24, -78, 61, 8, 21, -72, 1, 14, 64, 17, 20, 98, 18, 1, 30, 38, 38, 11, 13, 30, +27, 2, 28, 30, 11, 8, 23, -72, 2, 72, 64, 30, 18, 9, 11, 32, 0, 28, 10, 16, 16, 2, 85, 28, 36, +15, 15, 2, 85, 28, 30, 13, 13, 2, 85, 28, 10, 11, 11, 6, 85, 28, -72, -1, -10, 64, 11, 12, 12, 6, +85, 28, 32, 13, 13, 6, 85, 28, -72, -1, -24, 64, 19, 14, 15, 6, 85, 28, 25, 16, 16, 6, 85, -128, 28, +1, 28, 28, 26, 33, 38, 6, -72, -1, -11, -76, 12, 13, 6, 85, 6, -72, -1, -64, 64, 19, 36, 37, 52, 48, +6, 1, 0, 6, 16, 6, 32, 6, 3, 6, 49, 40, 14, 32, 26, -72, -1, -16, 64, 11, 16, 16, 2, 85, 26, +10, 13, 13, 2, 85, 26, -72, 2, 58, 64, 17, 21, 74, 20, 12, 11, 12, 6, 85, 20, 2, 16, 16, 6, 85, +20, 45, 39, 16, -10, 43, 43, -28, -12, 43, 43, -19, 16, -10, 93, 93, 43, 43, -19, 18, 57, 47, 93, 43, 43, +43, 43, 43, 43, 43, 43, 60, -19, 0, 63, -19, 63, -19, 63, -19, 18, 57, 47, -19, 16, -3, -19, 49, 48, 67, +121, 64, 44, 24, 36, 3, 17, 16, 38, 8, 38, 31, 37, 4, 37, 35, 38, 24, 17, 26, 44, 1, 30, 9, 33, +54, 1, 36, 3, 33, 54, 1, 25, 15, 23, 44, 0, 32, 7, 29, 54, 0, 34, 5, 37, 54, 1, 43, 43, 43, +1, 43, 43, 43, 43, 43, 43, 43, 43, -127, -127, 1, 17, 33, 50, 22, 22, 21, 20, 6, 6, 35, 33, 17, 33, +17, 20, 6, 6, 35, 34, 39, 55, 22, 51, 50, 54, 53, 17, 1, 33, 50, 54, 54, 53, 52, 38, 38, 35, 33, +4, -102, 1, 94, -13, -36, 98, -115, -55, -66, -3, -61, -3, -18, 43, -118, 106, 64, 90, 33, 48, 34, 66, 66, 3, +-106, 1, -124, 106, 122, 87, 93, -99, -63, -2, -4, 5, -70, -3, -114, 111, -58, 104, -119, -43, 77, 5, 13, -3, 13, +-26, -42, 119, 24, -84, 20, 99, -72, 4, 8, -6, -21, 41, 119, 96, 91, 123, 38, 0, 0, 2, 0, -92, 0, 0, +7, -55, 5, -70, 0, 20, 0, 31, 1, 68, 64, 47, 43, 8, 12, 31, 19, 1, 30, 31, 31, 11, 20, 17, 2, +21, 30, 14, 11, 8, 20, 11, 32, 0, 21, 32, 15, 16, 2, 85, 21, 6, 13, 13, 2, 85, 21, 32, 12, 12, +2, 85, 21, 12, 11, 11, 6, 85, 21, -72, -1, -12, 64, 11, 12, 12, 6, 85, 21, 24, 13, 13, 6, 85, 21, +-72, -1, -30, 64, 34, 15, 15, 6, 85, 21, 16, 16, 16, 6, 85, 21, 21, 15, 26, 38, 6, 30, 13, 13, 2, +85, 6, 22, 12, 12, 2, 85, 6, 12, 11, 11, 2, 85, 6, -72, -1, -11, -76, 11, 11, 6, 85, 6, -72, -1, +-14, -76, 12, 12, 6, 85, 6, -72, -1, -12, -76, 13, 13, 6, 85, 6, -72, -1, -64, 64, 26, 36, 37, 52, 48, +6, 1, 0, 6, 16, 6, 32, 6, 3, 6, 49, 33, 17, 14, 32, 15, 32, 16, 16, 2, 85, 15, -72, -1, -10, +-76, 15, 15, 2, 85, 15, -72, -1, -10, -76, 13, 13, 2, 85, 15, -72, -1, -6, -76, 12, 12, 2, 85, 15, -72, +-1, -6, -76, 12, 12, 6, 85, 15, -72, -1, -12, -76, 13, 13, 6, 85, 15, -72, -1, -8, -76, 15, 15, 6, 85, +15, -72, -1, -4, -74, 16, 16, 6, 85, 15, 93, 32, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, +-12, 93, 93, 43, 43, 43, 43, 43, 43, 43, -19, 18, 57, 47, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, +0, 63, 60, -19, 63, 60, 18, 57, 47, -3, 60, 16, 60, 49, 48, 67, 121, 64, 30, 3, 29, 8, 38, 24, 37, +4, 37, 28, 38, 23, 9, 26, 54, 1, 29, 3, 26, 54, 1, 25, 7, 22, 54, 0, 27, 5, 30, 54, 1, 43, +43, 1, 43, 43, 43, 43, 43, 43, -127, 1, 17, 33, 50, 22, 22, 21, 20, 6, 6, 35, 33, 17, 33, 17, 35, +17, 51, 17, 33, 17, 19, 33, 50, 54, 54, 53, 52, 38, 38, 35, 35, 4, 58, 1, 70, -47, -23, -113, -105, -55, +-64, -3, -49, -3, -18, -62, -62, 2, 18, -62, 1, 107, 124, 123, 93, 82, -89, -38, -20, 5, -70, -3, -114, 70, -50, +-119, -113, -40, 68, 2, -95, -3, 95, 5, -70, -3, -114, 2, 114, -6, -21, 36, 121, 99, 85, 122, 45, 0, 1, 0, +49, 0, 0, 6, 120, 5, -70, 0, 23, 1, 57, 64, 13, 102, 4, 119, 4, -121, 4, 3, 25, 8, 19, 12, 4, +6, -72, 2, 72, 64, 12, 17, 17, 12, 2, 23, 30, 0, 2, 20, 12, 8, 2, -72, 2, -120, -77, 21, 12, 32, +10, -72, -1, -44, 64, 17, 16, 16, 2, 85, 10, 10, 15, 15, 2, 85, 10, 20, 13, 13, 2, 85, 10, -72, -1, +-46, 64, 11, 12, 13, 2, 85, 10, 19, 16, 16, 6, 85, 10, -72, -1, -21, -76, 13, 13, 6, 85, 10, -72, -1, +-32, -76, 12, 12, 6, 85, 10, -72, -1, -42, 64, 18, 11, 11, 6, 85, 10, 64, 51, 54, 52, -1, 10, 1, -64, +10, 1, 10, 78, 25, -72, -1, -64, 64, 25, 52, 54, 52, -80, 25, -16, 25, 2, 16, 25, 112, 25, -96, 25, -80, +25, -1, 25, 5, 25, 21, 32, 20, 20, 3, -70, 2, -120, 0, 0, -1, -32, -76, 16, 16, 2, 85, 0, -72, -1, +-38, -76, 13, 13, 2, 85, 0, -72, -1, -18, -76, 12, 12, 2, 85, 0, -72, -1, -2, 64, 11, 11, 11, 2, 85, +0, 9, 16, 16, 6, 85, 0, -72, -1, -9, -76, 15, 15, 6, 85, 0, -72, -1, -39, -76, 13, 13, 6, 85, 0, +-72, -1, -12, 64, 16, 12, 12, 6, 85, 0, 4, 11, 11, 6, 85, 0, 0, 1, 0, -29, 24, 16, -10, 113, 43, +43, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, -19, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, +43, 43, 43, -19, 16, -19, 0, 63, 60, 63, -3, 60, 18, 57, 47, -19, 57, 18, 57, 49, 48, 67, 121, 64, 16, +7, 16, 8, 37, 15, 38, 16, 7, 13, 54, 1, 14, 9, 17, 54, 1, 43, 1, 43, 43, 43, -127, 0, 93, 19, +33, 21, 33, 17, 36, 51, 50, 22, 22, 21, 17, 35, 17, 52, 38, 38, 35, 34, 5, 17, 35, 17, 33, 49, 4, +-107, -2, 23, 1, 17, -92, -97, -20, 91, -62, 54, -113, 106, -95, -2, -9, -62, -2, 22, 5, -70, -83, -2, 61, 94, +-127, -32, -59, -2, 126, 1, 123, -112, -97, 90, 92, -3, 88, 5, 13, 0, -1, -1, 0, -95, 0, 0, 4, -94, 7, +44, 2, 38, 2, 68, 0, 0, 1, 7, 0, -115, 1, 47, 1, 106, 0, 14, -78, 1, 1, 34, -70, 2, 33, 0, +41, 1, 100, -123, 0, 43, -1, -1, 0, 10, -1, -20, 5, 15, 7, 23, 2, 38, 2, 77, 0, 0, 1, 7, 0, +-39, 1, 100, 1, 95, 0, 22, 64, 10, 1, 0, 24, 18, 0, 4, 65, 1, 1, 21, -71, 2, 33, 0, 41, 0, +43, 1, 43, 53, 0, 1, 0, -96, -2, 105, 5, 33, 5, -70, 0, 11, 1, 45, 64, 25, 16, 13, 1, 15, 13, +32, 13, -128, 13, -32, 13, 4, 9, 6, 2, 2, 7, 30, 4, 4, 11, 8, 8, 32, 11, -72, -1, -28, 64, 11, +15, 15, 2, 85, 11, 16, 12, 12, 2, 85, 11, -72, -1, -19, 64, 50, 11, 11, 6, 85, 11, 2, 12, 12, 6, +85, 11, 10, 13, 13, 6, 85, 11, 25, 15, 15, 6, 85, 64, 11, 96, 11, 2, 32, 11, 79, 11, 96, 11, -112, +11, -96, 11, -64, 11, 6, 32, 11, 96, 11, -64, 11, -16, 11, 4, 11, -72, 2, 20, 64, 10, 2, 7, 32, 4, +36, 16, 16, 2, 85, 4, -72, -1, -25, -76, 15, 15, 2, 85, 4, -72, -1, -2, -76, 13, 13, 2, 85, 4, -72, +-1, -4, 64, 25, 12, 12, 2, 85, 4, 16, 11, 11, 2, 85, 4, 14, 11, 11, 6, 85, 64, 4, -113, 4, 2, +95, 4, 1, 4, -72, 2, 20, 64, 15, 1, 6, 13, 13, 2, 85, 1, 30, 2, 12, 15, 15, 2, 85, 2, -72, +-1, -14, -76, 13, 13, 2, 85, 2, -72, -1, -16, -76, 11, 11, 2, 85, 2, -72, -1, -10, -76, 11, 11, 6, 85, +2, -72, -1, -6, -76, 12, 12, 6, 85, 2, -72, -1, -8, -76, 13, 13, 6, 85, 2, -72, -1, -10, 64, 22, 15, +15, 6, 85, 0, 2, 80, 2, -96, 2, -80, 2, -16, 2, 5, 80, 2, 1, -112, 2, 1, 2, 47, 93, 113, 114, +43, 43, 43, 43, 43, 43, 43, -3, 43, -3, 93, 113, 43, 43, 43, 43, 43, 43, -19, 16, -3, 93, 113, 114, 43, +43, 43, 43, 43, 43, -19, 0, 63, 60, 16, -19, 47, 63, 60, 49, 48, 1, 93, 113, 33, 17, 35, 17, 33, 17, +51, 17, 33, 17, 51, 17, 3, 55, -83, -2, 22, -62, 2, -4, -61, -2, 105, 1, -105, 5, -70, -6, -13, 5, 13, +-6, 70, -1, -1, -1, -3, 0, 0, 5, 89, 5, -70, 2, 6, 0, 36, 0, 0, 0, 2, 0, -89, 0, 0, 4, +-8, 5, -70, 0, 14, 0, 24, 0, -28, 64, 21, 40, 8, 4, 30, 24, 24, 14, 3, 30, 0, 2, 15, 30, 14, +8, 2, 2, 0, 19, 38, 9, -72, -1, -15, -76, 11, 12, 6, 85, 9, -72, -1, -8, 64, 11, 13, 13, 6, 85, +9, 4, 16, 16, 6, 85, 9, -72, -1, -64, 64, 19, 36, 37, 52, 48, 9, 1, 0, 9, 16, 9, 32, 9, 3, +9, 49, -33, 26, 1, 26, -72, -1, -64, 64, 17, 30, 35, 52, 48, 26, 1, 26, 3, 15, 32, 0, 32, 16, 16, +2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, -10, -76, 13, 13, 2, 85, 0, -72, -1, -6, -76, +12, 12, 2, 85, 0, -72, -1, -10, -76, 12, 12, 6, 85, 0, -72, -1, -18, -76, 13, 13, 6, 85, 0, -72, -1, +-10, -74, 15, 16, 6, 85, 0, 93, 25, 16, -10, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, 113, 43, 93, -10, +93, 93, 43, 43, 43, 43, -19, 18, 57, 47, 0, 63, -19, 63, -19, 18, 57, 47, -3, 49, 48, 67, 121, 64, 28, +6, 22, 11, 38, 7, 37, 21, 38, 17, 12, 19, 54, 1, 22, 6, 19, 54, 1, 18, 10, 16, 54, 0, 20, 8, +23, 54, 1, 43, 43, 1, 43, 43, 43, 43, 43, -127, 19, 33, 21, 33, 17, 33, 50, 22, 22, 21, 20, 6, 6, +35, 33, 55, 33, 50, 54, 53, 52, 38, 38, 35, 33, -89, 3, -73, -3, 11, 1, 94, -62, -27, -118, 99, -60, -20, +-3, -62, -62, 1, -124, -99, -99, 90, -96, -63, -2, -3, 5, -70, -83, -2, 60, 74, -51, -120, 111, -63, 122, -91, -128, +-128, 91, 122, 40, 0, -1, -1, 0, -106, 0, 0, 4, -23, 5, -70, 2, 6, 0, 37, 0, 0, 0, 1, 0, -95, +0, 0, 4, 85, 5, -70, 0, 5, 0, 123, 64, 23, 2, 3, 30, 1, 0, 2, 5, 8, 1, 26, 7, 3, 4, +32, 5, 5, 0, 36, 16, 16, 2, 85, 0, -72, -1, -14, -76, 15, 15, 2, 85, 0, -72, -1, -22, -76, 13, 13, +2, 85, 0, -72, -1, -2, -76, 12, 12, 2, 85, 0, -72, -1, -10, -76, 16, 16, 6, 85, 0, -72, -1, -12, -76, +15, 15, 6, 85, 0, -72, -1, -23, -76, 13, 13, 6, 85, 0, -72, -1, -10, 64, 10, 12, 12, 6, 85, 0, 25, +6, 59, -114, 24, 43, 78, 16, -12, 43, 43, 43, 43, 43, 43, 43, 43, 60, 77, 16, -3, 60, 78, 16, -26, 0, +63, 63, 60, 77, -3, 60, 49, 48, 19, 33, 21, 33, 17, 35, -95, 3, -76, -3, 14, -62, 5, -70, -83, -6, -13, +0, 2, 0, 0, -2, -86, 5, 35, 5, -70, 0, 13, 0, 20, 1, 18, 64, 21, 15, 22, 47, 22, 2, 15, 30, +0, 2, 5, 9, 2, 19, 3, 10, 30, 7, 8, 13, 30, 16, -72, -1, -32, -76, 16, 16, 2, 85, 16, -72, -1, +-14, -76, 13, 13, 2, 85, 16, -72, -1, -24, 64, 11, 11, 11, 2, 85, 16, 10, 13, 13, 6, 85, 16, -72, -1, +-8, -76, 15, 15, 6, 85, 16, -72, -1, -14, 64, 11, 16, 16, 6, 85, 16, 16, 3, 9, 20, 32, 2, -72, -1, +-2, -76, 12, 12, 2, 85, 2, -72, -1, -24, -76, 11, 11, 2, 85, 2, -72, -1, -10, -76, 11, 12, 6, 85, 2, +-72, 2, 93, -78, 5, 30, 3, -72, -1, -32, 64, 17, 15, 15, 2, 85, 3, 34, 13, 13, 2, 85, 3, 10, 11, +12, 6, 85, 3, -72, -1, -40, -76, 13, 13, 6, 85, 3, -72, -1, -16, 64, 46, 15, 15, 6, 85, 3, 10, 16, +16, 6, 85, 9, 15, 3, 1, 58, 31, 3, -33, 3, 2, 15, 3, -113, 3, 2, 15, 3, -97, 3, -81, 3, -65, +3, -1, 3, 5, 3, 75, 22, 19, 101, 11, 11, 8, 30, 9, -72, -1, -10, 64, 16, 11, 13, 6, 85, 9, 10, +16, 16, 6, 85, 9, 31, 9, 1, 9, 21, 16, 60, 114, 16, 43, 43, -19, 57, 47, -19, 16, -10, 93, 113, 114, +94, 93, 94, 43, 43, 43, 43, 43, 43, -19, -12, 43, 43, 43, -19, 17, 18, 57, 47, 43, 43, 43, 43, 43, 43, +-19, 0, 63, -3, 60, 60, 60, 47, 60, 63, -19, 49, 48, 1, 93, 1, 33, 17, 51, 17, 35, 17, 33, 17, 35, +17, 51, 18, 17, 37, 33, 21, 20, 2, 7, 33, 1, 35, 3, 124, -124, -83, -4, 55, -83, 114, -79, 2, -70, -2, +1, 67, 98, 2, -92, 5, -70, -6, -13, -3, -3, 1, 86, -2, -86, 2, 3, 1, 11, 3, 44, 41, 75, -69, -3, +119, -47, -1, -1, 0, -94, 0, 0, 4, -24, 5, -70, 2, 6, 0, 40, 0, 0, 0, 1, 0, 7, 0, 0, 7, +91, 5, -69, 0, 61, 1, -90, 64, -91, -115, 24, -124, 26, -117, 38, -126, 40, 4, 47, 63, 1, 15, 63, 47, 63, +64, 63, 119, 20, 112, 63, -121, 20, -128, 63, -106, 20, -106, 23, -103, 41, -103, 44, -32, 63, 12, 40, 28, 40, 35, +57, 18, 56, 28, 56, 35, 56, 46, 73, 46, 104, 27, 104, 36, -120, 44, 10, 73, 18, 73, 28, 73, 35, 118, 23, +118, 41, 120, 44, 6, 39, 25, 56, 58, 58, 32, 44, 46, 20, 44, 44, 46, 37, 38, 38, 32, 39, 40, 20, 39, +39, 40, 5, 3, 3, 32, 20, 18, 20, 20, 20, 18, 27, 26, 26, 32, 25, 24, 20, 25, 25, 24, 58, 56, 3, +5, 4, 8, 60, 44, 46, 20, 18, 4, 49, 42, 22, 42, 60, 37, 40, 27, 24, 4, 33, 37, 40, 32, 39, 27, +26, 24, 3, 25, 3, 5, 18, 20, 22, 3, 31, 11, 46, 44, 42, 3, 58, 56, 32, 50, 1, 60, 30, 60, -72, +2, 93, -73, 33, 33, 61, 38, 26, 32, 8, 49, -69, 2, 72, 0, 53, 0, 11, 1, 14, 64, 22, 53, 8, 123, +61, 2, -97, 50, 1, 50, 45, 39, 26, 11, 11, 6, 85, 79, 39, -113, 39, 2, 39, -72, 1, 114, -74, 31, -112, +11, 1, 11, 45, 25, -72, -1, -16, 64, 10, 11, 11, 6, 85, 64, 25, -128, 25, 2, 25, -72, 1, 114, 64, 12, +32, 0, 31, 101, 61, 32, 12, 16, 16, 2, 85, 32, -72, -1, -8, -76, 15, 15, 2, 85, 32, -72, -1, -2, -76, +12, 12, 2, 85, 32, -72, -1, -6, -76, 11, 11, 6, 85, 32, -72, -1, -2, 64, 13, 15, 15, 6, 85, -16, 32, +1, 112, 32, -32, 32, 2, 32, 47, 93, 113, 43, 43, 43, 43, 43, 60, -3, 60, 16, -3, 93, 43, -28, 113, 16, +-3, 93, 43, -28, 113, 0, 63, -12, 60, -19, 16, -19, 63, 60, 60, 18, 57, 47, -19, 60, 16, 60, 1, 17, 18, +57, 57, 23, 57, 17, 18, 23, 57, 57, 57, 17, 23, 57, 17, 18, 57, 57, 0, 17, 23, 57, 18, 57, 57, 17, +18, 23, 57, 17, 18, 23, 57, -121, 5, 46, 43, 14, 125, 16, -60, -121, 14, 46, 24, 43, 14, 125, 16, -60, -121, +5, 46, 24, 43, 14, 125, 16, -60, -121, 14, 46, 24, 43, 14, 125, 16, -60, 0, 46, 46, 49, 48, 0, 93, 93, +1, 93, 93, 113, 1, 17, 50, 54, 55, 62, 2, 51, 50, 23, 21, 34, 39, 38, 35, 34, 7, 6, 7, 6, 6, +7, 22, 23, 1, 35, 3, 38, 38, 35, 17, 35, 17, 34, 6, 7, 7, 3, 35, 1, 54, 55, 38, 38, 39, 38, +39, 38, 35, 7, 53, 54, 51, 50, 22, 22, 23, 22, 22, 23, 17, 4, 21, -113, 107, 83, 61, 79, -110, 87, 95, +23, 9, 29, 32, 7, 93, 45, 46, 59, 64, 94, 89, -112, -121, 1, 46, -16, -11, 98, -122, 121, -57, 96, -109, 98, +12, -11, -15, 1, 46, -118, -114, 79, 100, 69, 63, 45, 45, 89, 78, 11, 101, 96, -115, 80, 63, 84, 105, -112, 5, +-70, -3, 126, 105, -62, -112, 119, 81, 2, -88, 1, 1, 45, 45, -109, -97, 115, 38, 40, -34, -2, 24, 1, -114, -98, +-126, -3, 82, 2, -82, 101, -89, 20, -2, 114, 1, -24, -33, 39, 32, 107, -83, -99, 40, 40, 2, -88, 2, 79, 119, +-110, -59, 100, 2, 2, -126, 0, 0, 1, 0, 78, -1, -25, 4, -126, 5, -45, 0, 38, 1, 22, 64, 83, 78, 25, +-60, 3, 2, 6, 31, 57, 14, 70, 30, 101, 33, 117, 30, -91, 31, 6, 7, 25, 75, 30, 90, 30, 116, 3, 4, +-64, 1, -63, 22, -53, 23, -56, 24, 4, 40, 8, 31, 11, 64, 31, 80, 31, 96, 31, 112, 31, -128, 31, 5, 31, +29, 12, 23, -29, 63, 24, 79, 24, 95, 24, 127, 24, 4, 24, 24, 37, 26, 1, -29, 48, 0, 64, 0, 80, 0, +3, 0, 0, 26, 37, 12, -72, 2, 72, -77, 10, 10, 37, 19, -72, 2, 72, -78, 26, 3, 4, -72, 2, 72, 64, +20, 37, 9, 11, 11, 23, 16, 38, 29, 16, 11, 11, 6, 85, 29, 16, 13, 13, 6, 85, 29, -72, -1, -25, 64, +14, 15, 16, 6, 85, -97, 29, -81, 29, 2, 29, 75, 7, 38, 34, -72, -1, -18, -76, 12, 12, 2, 85, 34, -72, +-1, -19, 64, 17, 11, 12, 6, 85, 32, 34, 1, 34, 92, 40, 23, 38, 24, 98, 1, 38, 0, -71, 1, 49, 0, +39, 16, -12, -19, -12, -19, 16, -10, 93, 43, 43, -19, -12, 93, 43, 43, 43, -19, 17, 57, 47, 0, 63, -19, 63, +-19, 18, 57, 47, -19, 17, 18, 57, 47, 93, -28, 17, 18, 57, 47, 93, -28, 1, 17, 18, 57, 93, 0, 18, 57, +49, 48, 67, 121, 64, 28, 35, 36, 27, 28, 17, 18, 5, 6, 18, 27, 16, 54, 1, 5, 36, 7, 54, 1, 17, +28, 19, 54, 1, 6, 35, 4, 54, 0, 43, 43, 1, 43, 43, -127, -127, -127, -127, 0, 113, 93, 1, 93, 113, 19, +55, 22, 22, 51, 50, 54, 53, 52, 38, 35, 35, 53, 50, 54, 54, 53, 52, 38, 35, 34, 6, 6, 21, 39, 18, +33, 50, 22, 21, 20, 7, 22, 22, 21, 20, 4, 35, 32, 78, -71, 21, -73, -105, -102, -78, -68, -94, 93, -122, -114, +109, -107, 127, 111, -99, 60, -70, 69, 1, -65, -41, -4, -62, 112, -105, -2, -37, -14, -2, 96, 1, -98, 48, 107, -42, +-98, 112, 121, -113, -87, 31, 127, 81, 96, -114, 111, -73, 45, 42, 1, -45, -17, -96, -51, 113, 31, -65, -123, -67, -1, +0, 0, 1, 0, -95, 0, 0, 5, 32, 5, -70, 0, 9, 1, 58, 64, 10, 47, 11, 1, 7, 24, 12, 28, 2, +85, 2, -72, -1, -24, 64, 20, 12, 28, 2, 85, 55, 2, 56, 7, 86, 2, 89, 7, 105, 7, 118, 2, 121, 7, +7, 2, -72, -1, -12, 64, 34, 16, 16, 6, 85, 7, 76, 15, 16, 6, 85, 7, 60, 12, 12, 6, 85, 7, 78, +11, 11, 6, 85, 3, 7, 8, 8, 32, 2, 3, 20, 2, 2, 3, 2, -72, -1, -32, -76, 11, 11, 6, 85, 7, +-72, -1, -52, 64, 20, 11, 11, 6, 85, 2, 7, 8, 3, 1, 2, 8, 6, 8, 3, 8, 6, 2, 7, 32, 4, +-72, -1, -20, -76, 15, 15, 2, 85, 4, -72, -1, -18, 64, 11, 13, 13, 2, 85, 4, 18, 12, 12, 2, 85, 4, +-72, -1, -4, -76, 11, 11, 6, 85, 4, -72, -1, -2, 64, 25, 12, 13, 6, 85, 4, 8, 15, 15, 6, 85, 4, +57, 15, 11, 1, 11, 2, 32, 0, 36, 16, 16, 2, 85, 0, -72, -1, -10, -76, 15, 15, 2, 85, 0, -72, -1, +-6, -76, 13, 13, 2, 85, 0, -72, -1, -4, -76, 12, 12, 2, 85, 0, -72, -1, -10, -76, 11, 11, 6, 85, 0, +-72, -1, -6, -76, 12, 13, 6, 85, 0, -72, -1, -9, -74, 15, 15, 6, 85, 0, 57, 10, 16, -10, 43, 43, 43, +43, 43, 43, 43, -19, 16, 93, -10, 43, 43, 43, 43, 43, 43, -19, 17, 18, 57, 57, 0, 63, 60, 63, 60, 18, +57, 57, 43, 43, -121, 5, 46, 43, -121, 125, -60, -79, 6, 2, 67, 84, 88, 64, 12, 6, 2, 15, 7, 21, 2, +91, 7, -118, 7, 5, 2, -72, -1, -32, -78, 12, 17, 52, 0, 43, 93, 89, 43, 43, 43, 43, 49, 48, 0, 93, +43, 43, 1, 93, 19, 51, 17, 1, 51, 17, 35, 17, 1, 35, -95, -80, 3, 12, -61, -80, -4, -13, -62, 5, -70, +-5, 119, 4, -119, -6, 70, 4, -122, -5, 122, 0, -1, -1, 0, -95, 0, 0, 5, 32, 7, 23, 2, 38, 2, 66, +0, 0, 1, 7, 0, -39, 1, 120, 1, 95, 0, 22, 64, 10, 1, 0, 17, 11, 0, 4, 65, 1, 1, 14, -71, +2, 33, 0, 41, 0, 43, 1, 43, 53, 0, 1, 0, -95, 0, 0, 4, -94, 5, -69, 0, 33, 1, 9, 64, 67, +-117, 25, -124, 27, 2, 10, 7, 29, 7, 44, 7, 47, 35, 118, 24, -119, 7, -115, 30, 7, 58, 19, 58, 21, 56, +29, 3, 6, 4, 4, 37, 21, 19, 20, 21, 21, 19, 28, 27, 27, 8, 11, 16, 6, 85, 27, 32, 26, 25, 20, +26, 26, 25, 25, 28, 31, 27, 6, 4, 9, 2, 19, 21, 16, 23, 23, 2, -72, 2, 93, -77, 31, 31, 33, 16, +-72, 2, 72, 64, 33, 9, 123, 0, 2, 26, 27, 27, 33, 8, 27, 28, 25, 3, 26, 6, 4, 23, 21, 19, 3, +32, -112, 11, 1, 11, 45, 26, 45, 35, 1, 32, 32, 33, -72, -1, -22, -76, 16, 16, 2, 85, 33, -72, -1, -10, +-76, 15, 15, 2, 85, 33, -72, -1, -6, -76, 13, 13, 2, 85, 33, -72, -1, -2, -76, 12, 12, 2, 85, 33, -72, +-1, -8, -76, 11, 11, 6, 85, 33, -72, -1, -4, -76, 12, 12, 6, 85, 33, -72, -1, -12, -76, 13, 13, 6, 85, +33, -72, -1, -12, -74, 15, 15, 6, 85, 33, 57, 34, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, +-10, -28, 113, 17, 23, 57, 57, 57, 18, 23, 57, 0, 63, 60, 16, 60, 63, -12, -19, 18, 57, 47, -19, 25, 57, +47, 18, 57, 57, 17, 18, 57, 57, 17, 18, 57, 57, -121, 5, 46, 24, 43, 43, 14, 125, 16, -60, -121, 14, 46, +24, 43, 14, 125, 16, -60, 49, 48, 0, 93, 1, 93, 113, 19, 51, 17, 50, 54, 55, 62, 2, 51, 50, 23, 21, +34, 39, 38, 35, 34, 7, 6, 7, 6, 6, 7, 22, 23, 1, 35, 3, 38, 38, 35, 17, 35, -95, -62, -123, 108, +84, 61, 79, -110, 88, 112, 6, 10, 29, 32, 7, 93, 45, 46, 59, 74, 102, 71, -114, -118, 1, 46, -15, -11, 101, +-120, 108, -62, 5, -70, -3, 126, 103, -60, -112, 119, 81, 2, -88, 1, 1, 45, 45, -109, -70, 97, 29, 39, -33, -2, +24, 1, -114, -91, 123, -3, 82, 0, 0, 1, 0, 18, -1, -25, 4, -97, 5, -70, 0, 18, 0, -17, -78, 25, 8, +13, -72, 1, 14, -73, 12, 98, 10, 5, 30, 0, 2, 15, -72, 2, 72, 64, 13, 10, 9, 3, 8, 3, 32, 2, +6, 16, 16, 2, 85, 2, -72, -1, -20, 64, 17, 15, 15, 2, 85, 2, 38, 13, 13, 2, 85, 2, 6, 12, 12, +2, 85, 2, -72, -1, -24, -76, 11, 11, 2, 85, 2, -72, -1, -22, 64, 25, 11, 11, 6, 85, 2, 8, 13, 13, +6, 85, 2, 8, 15, 15, 6, 85, 2, 93, -128, 20, 1, 20, 6, 32, 18, -72, -1, -28, -76, 16, 16, 2, 85, +18, -72, -1, -8, 64, 17, 15, 15, 2, 85, 18, 2, 13, 13, 2, 85, 18, 8, 12, 12, 2, 85, 18, -72, -1, +-28, 64, 11, 11, 11, 2, 85, 18, 26, 11, 11, 6, 85, 18, -72, 2, 58, 64, 9, 13, 74, 12, 6, 12, 12, +6, 85, 12, -72, -1, -8, -76, 13, 13, 6, 85, 12, -72, -1, -8, -74, 15, 15, 6, 85, 12, 98, 19, 16, -10, +43, 43, 43, -28, -12, 43, 43, 43, 43, 43, 43, -19, 16, 93, -10, 43, 43, 43, 43, 43, 43, 43, 43, -3, 0, +63, 63, -19, 63, -19, 16, -3, -19, 49, 48, 67, 121, 64, 16, 16, 17, 7, 9, 8, 38, 16, 9, 18, 44, 1, +17, 7, 15, 44, 0, 43, 1, 43, 43, -127, -127, 1, 33, 17, 35, 17, 33, 17, 20, 6, 6, 35, 34, 39, 55, +22, 51, 50, 54, 53, 1, 9, 3, -106, -62, -3, -18, 43, -118, 106, 64, 90, 33, 48, 34, 66, 66, 5, -70, -6, +70, 5, 13, -3, 13, -26, -42, 119, 24, -84, 20, 99, -72, 0, -1, -1, 0, -104, 0, 0, 6, 15, 5, -70, 2, +6, 0, 48, 0, 0, -1, -1, 0, -92, 0, 0, 5, 34, 5, -70, 2, 6, 0, 43, 0, 0, -1, -1, 0, 99, +-1, -25, 5, -35, 5, -44, 2, 6, 0, 50, 0, 0, 0, 1, 0, -96, 0, 0, 5, 33, 5, -70, 0, 7, 0, +-76, -71, 0, 9, -1, -64, 64, 13, 19, 21, 52, 3, 7, 8, 5, 30, 0, 2, 3, 32, 2, -72, -1, -18, -76, +15, 15, 2, 85, 2, -72, -1, -18, 64, 11, 13, 13, 2, 85, 2, 16, 12, 12, 2, 85, 2, -72, -1, -32, -76, +11, 11, 6, 85, 2, -72, -1, -2, 64, 21, 12, 13, 6, 85, 2, 57, 15, 9, -128, 9, 2, 9, 6, 32, 7, +32, 16, 16, 2, 85, 7, -72, -1, -10, -76, 15, 15, 2, 85, 7, -72, -1, -10, -76, 13, 13, 2, 85, 7, -72, +-1, -6, 64, 11, 12, 12, 2, 85, 7, 10, 11, 11, 6, 85, 7, -72, -1, -10, -73, 12, 13, 6, 85, 32, 7, +1, 7, -72, -1, -64, 64, 18, 19, 21, 52, 7, 93, 8, 32, 9, 1, 32, 9, 80, 9, 96, 9, 112, 9, 4, +93, 113, 16, -10, 43, 93, 43, 43, 43, 43, 43, 43, -19, 16, 93, -10, 43, 43, 43, 43, 43, -19, 0, 63, -19, +63, 60, 49, 48, 1, 43, 19, 33, 17, 35, 17, 33, 17, 35, -96, 4, -127, -61, -3, 4, -62, 5, -70, -6, 70, +5, 13, -6, -13, 0, -1, -1, 0, -98, 0, 0, 4, -3, 5, -70, 2, 6, 0, 51, 0, 0, -1, -1, 0, 102, +-1, -25, 5, 118, 5, -45, 2, 6, 0, 38, 0, 0, -1, -1, 0, 48, 0, 0, 4, -70, 5, -70, 2, 6, 0, +55, 0, 0, 0, 1, 0, 10, -1, -20, 5, 15, 5, -70, 0, 16, 0, -73, 64, 23, 102, 2, 1, -101, 2, 1, +104, 2, 1, -100, 1, -109, 3, 2, 2, 16, 2, 1, 16, 3, 1, 2, 2, -72, -1, -12, 64, 17, 13, 13, 6, +85, 2, 30, 16, 0, 20, 16, 2, 3, 16, 0, 3, 2, 2, -72, -1, -12, 64, 32, 13, 13, 6, 85, 2, 30, +5, 4, 20, 5, 2, 1, 5, 4, 2, 16, 5, 3, 8, 0, 11, 93, 10, 74, 8, 4, 3, 3, 1, 0, 2, +13, -72, 2, 72, 64, 16, 8, 9, 16, 1, 0, 5, 3, 4, 2, 32, 10, 1, 10, -109, 0, 4, -70, 1, 92, +0, 0, 1, 92, -77, 2, 2, 18, 17, 25, 17, 18, 57, 47, 24, -19, -19, 25, 16, -28, 93, 17, 18, 57, 57, +18, 57, 57, 0, 24, 63, -19, 63, 60, 60, 16, 60, 16, -12, -19, 17, 18, 23, 57, -121, 8, 46, 43, 43, 5, +125, 16, -60, -121, 8, 46, 24, 43, 43, 5, 125, 16, -60, -121, 8, 16, -60, 49, 48, 1, 114, 93, 0, 114, 93, +19, 51, 1, 1, 51, 1, 6, 6, 35, 34, 39, 53, 22, 51, 50, 54, 55, 10, -60, 1, -34, 1, -94, -63, -3, +-38, 103, -124, 123, 75, 109, 78, 87, 71, 103, 62, 5, -70, -4, 126, 3, -126, -5, -116, -42, -124, 35, -90, 45, 91, +-94, 0, 3, 0, 82, 0, 0, 5, -62, 5, -58, 0, 17, 0, 24, 0, 31, 1, 7, 64, 73, 32, 33, 1, 16, +33, 79, 33, 112, 33, -48, 33, -32, 33, 5, 37, 21, 43, 23, 43, 27, 37, 29, 4, 18, 123, 25, 9, 12, 19, +123, 31, 30, 48, 12, 1, 111, 12, 127, 12, 2, 12, -109, 11, 25, 30, 0, 63, 3, 1, 112, 3, 1, 3, -109, +1, 2, 11, 8, 28, 38, 15, 18, 15, 15, 6, 85, 15, 20, 13, 13, 6, 85, 15, -72, -1, -10, 64, 21, 11, +12, 6, 85, 15, 15, 63, 15, 2, 31, 15, 111, 15, 127, 15, -113, 15, -17, 15, 5, 15, -72, 1, -61, -77, 10, +22, 38, 6, -72, -1, -12, -76, 15, 15, 6, 85, 6, -72, -1, -10, 64, 27, 13, 13, 6, 85, 6, 10, 11, 12, +6, 85, 0, 6, 48, 6, 2, 16, 6, 96, 6, 112, 6, -128, 6, -32, 6, 5, 6, -72, 1, -61, 64, 13, 11, +19, 10, 25, 11, 2, 64, 10, 1, 10, 30, 1, 11, -72, -1, -4, 64, 11, 15, 15, 2, 85, 11, 10, 15, 15, +6, 85, 11, -72, -1, -6, 64, 19, 13, 13, 6, 85, 0, 11, -112, 11, -64, 11, 3, 32, 11, 79, 11, -80, 11, +3, 11, 47, 93, 114, 43, 43, 43, 60, -3, 113, 60, 16, 60, 16, 60, 16, -3, 93, 113, 43, 43, 43, -19, 16, +-3, 93, 113, 43, 43, 43, -19, 0, 63, 63, -12, 93, 113, 60, -19, 16, -12, 93, 113, -3, -28, 16, 60, 16, -28, +49, 48, 0, 93, 1, 93, 113, 1, 53, 51, 21, 4, 0, 21, 20, 0, 5, 21, 35, 53, 36, 0, 53, 52, 0, +5, 17, 54, 54, 53, 52, 38, 37, 6, 6, 21, 20, 22, 23, 2, -80, -74, 1, 24, 1, 68, -2, -58, -2, -34, +-74, -2, -4, -2, -90, 1, 89, 1, -69, -68, -40, -44, -2, -118, -75, -32, -35, -72, 5, 10, -68, -68, 15, -2, -51, +-28, -33, -2, -56, 16, -67, -67, 10, 1, 41, -12, -11, 1, 38, -101, -3, 0, 9, -56, -81, -84, -55, 10, 8, -58, +-79, -81, -56, 8, -1, -1, 0, 9, 0, 0, 5, 73, 5, -70, 2, 6, 0, 59, 0, 0, 0, 1, 0, -97, -2, +105, 5, -90, 5, -70, 0, 11, 0, -7, 64, 23, 32, 13, -32, 13, 2, 4, 1, 2, 9, 7, 2, 30, 11, 8, +3, 32, 6, 0, 15, 15, 2, 85, 6, -72, -1, -14, -76, 13, 13, 2, 85, 6, -72, -1, -10, -76, 12, 12, 2, +85, 6, -72, -1, -44, -76, 16, 16, 6, 85, 6, -72, -1, -10, 64, 14, 11, 11, 6, 85, 96, 6, -128, 6, 2, +6, 6, 9, 30, 7, -72, -1, -22, 64, 11, 15, 15, 2, 85, 7, 24, 12, 12, 2, 85, 7, -72, -1, -35, -76, +15, 15, 6, 85, 7, -72, -1, -35, 64, 31, 13, 13, 6, 85, 7, 6, 12, 12, 6, 85, 32, 7, -97, 7, -81, +7, -65, 7, 4, 7, 75, 13, 2, 32, 11, 36, 16, 16, 2, 85, 11, -72, -1, -10, -76, 15, 15, 2, 85, 11, +-72, -1, -6, -76, 13, 13, 2, 85, 11, -72, -1, -2, -76, 12, 12, 2, 85, 11, -72, -1, -2, -76, 16, 16, 6, +85, 11, -72, -1, -12, -76, 15, 15, 6, 85, 11, -72, -1, -12, -76, 13, 13, 6, 85, 11, -72, -1, -6, 64, 16, +12, 12, 6, 85, 11, 6, 11, 11, 6, 85, 32, 11, 1, 11, 57, 12, 16, -10, 93, 43, 43, 43, 43, 43, 43, +43, 43, 43, -19, 16, -10, 93, 43, 43, 43, 43, 43, -3, 57, 47, 93, 43, 43, 43, 43, 43, -19, 0, 63, -3, +60, 47, 63, 60, 49, 48, 1, 93, 19, 51, 17, 33, 17, 51, 17, 51, 17, 35, 17, 33, -97, -62, 2, -4, -61, +-122, -84, -5, -91, 5, -70, -6, -13, 5, 13, -6, -13, -3, -68, 1, -105, 0, 1, 0, 87, 0, 0, 4, -76, 5, +-70, 0, 18, 0, -12, 64, 11, 105, 2, 121, 2, -119, 2, 3, 22, 8, 2, 4, -72, 2, 72, 64, 11, 14, 14, +17, 10, 2, 1, 8, 17, 1, 32, 0, -72, -1, -8, -76, 16, 16, 2, 85, 0, -72, -1, -28, 64, 11, 15, 15, +2, 85, 0, 30, 13, 13, 2, 85, 0, -72, -1, -2, -76, 12, 12, 2, 85, 0, -72, -1, -24, 64, 11, 11, 11, +2, 85, 0, 6, 13, 13, 6, 85, 0, -72, -1, -4, 64, 43, 12, 12, 6, 85, 0, 93, -128, 20, 1, 20, 11, +32, 8, 10, 16, 16, 2, 85, 8, 20, 15, 15, 2, 85, 8, 22, 13, 13, 2, 85, 8, 26, 12, 12, 2, 85, +8, 18, 11, 11, 2, 85, 8, -72, -1, -14, 64, 26, 16, 16, 6, 85, 8, 14, 15, 15, 6, 85, 8, 12, 13, +13, 6, 85, 8, 24, 12, 12, 6, 85, 32, 8, 1, 8, -72, -1, -64, 64, 18, 19, 21, 52, 8, 93, 19, 32, +20, 1, 32, 20, 80, 20, 96, 20, 112, 20, 4, 93, 113, 16, -10, 43, 93, 43, 43, 43, 43, 43, 43, 43, 43, +43, -19, 16, 93, -10, 43, 43, 43, 43, 43, 43, 43, -3, 60, 0, 63, 63, 60, 57, 47, -19, 57, 49, 48, 67, +121, 64, 14, 5, 13, 6, 37, 13, 5, 11, 54, 0, 12, 7, 14, 54, 0, 43, 1, 43, 43, -127, 0, 93, 33, +35, 17, 4, 35, 34, 38, 38, 53, 17, 51, 17, 20, 22, 51, 50, 55, 17, 51, 4, -76, -62, -2, -5, -60, -103, +-22, 79, -62, -81, 123, -51, -30, -62, 2, 79, 97, -113, -36, -78, 1, -81, -2, 99, -16, -105, 91, 2, -55, 0, 0, +1, 0, -95, 0, 0, 6, -75, 5, -70, 0, 11, 1, 34, 64, 79, 15, 13, 64, 13, 112, 13, -128, 13, -65, 13, +-64, 13, -17, 13, 7, 7, 2, 30, 11, 8, 4, 4, 1, 16, 2, 32, 11, 42, 16, 16, 2, 85, 11, 14, 15, +15, 2, 85, 11, 6, 13, 13, 2, 85, 11, 16, 12, 12, 2, 85, 11, 10, 11, 11, 2, 85, 11, 26, 15, 15, +6, 85, 11, 15, 12, 13, 6, 85, 15, 11, 1, 79, 11, 127, 11, -113, 11, 3, 11, -72, 1, 109, -77, 6, 7, +32, 10, -72, -1, -40, -76, 16, 16, 2, 85, 10, -72, -1, -18, -76, 15, 15, 2, 85, 10, -72, -1, -2, -76, 13, +13, 2, 85, 10, -72, -1, -16, -76, 12, 12, 2, 85, 10, -72, -1, -32, -76, 11, 11, 2, 85, 10, -72, -1, -26, +-76, 15, 15, 6, 85, 10, -72, -1, -18, 64, 18, 12, 13, 6, 85, 80, 10, 1, 0, 10, 1, 64, 10, 112, 10, +-128, 10, 3, 10, -72, 1, 109, 64, 9, 6, 32, 3, 16, 16, 16, 2, 85, 3, -72, -1, -10, -76, 15, 15, 2, +85, 3, -72, -1, -2, 64, 11, 12, 12, 2, 85, 3, 7, 16, 16, 6, 85, 3, -72, -1, -4, -76, 15, 15, 6, +85, 3, -72, -1, -2, 64, 24, 11, 13, 6, 85, 64, 3, -112, 3, 2, 32, 3, 112, 3, -96, 3, -64, 3, -17, +3, 5, 3, 112, 13, 1, 93, 47, 93, 114, 43, 43, 43, 43, 43, 43, -19, -3, 93, 113, 114, 43, 43, 43, 43, +43, 43, 43, -19, 16, -3, 93, 113, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, 60, 16, 60, 47, -3, 60, 49, +48, 1, 93, 19, 51, 17, 33, 17, 51, 17, 33, 17, 51, 17, 33, -95, -62, 1, -25, -62, 1, -25, -62, -7, -20, +5, -70, -6, -13, 5, 13, -6, -13, 5, 13, -6, 70, 0, 1, 0, -95, -2, 105, 7, 58, 5, -70, 0, 15, 1, +89, 64, 37, 64, 17, 111, 17, 112, 17, -128, 17, -96, 17, 5, 8, 4, 4, 1, 2, 13, 6, 11, 2, 30, 15, +8, 12, 30, -112, 14, -96, 14, -80, 14, 3, 14, 14, 7, 32, 10, -72, -1, -40, -76, 16, 16, 2, 85, 10, -72, +-1, -18, -76, 15, 15, 2, 85, 10, -72, -1, -2, -76, 13, 13, 2, 85, 10, -72, -1, -16, -76, 12, 12, 2, 85, +10, -72, -1, -32, -76, 11, 11, 2, 85, 10, -72, -1, -18, -76, 16, 16, 6, 85, 10, -72, -1, -45, -76, 15, 15, +6, 85, 10, -72, -1, -10, 64, 28, 12, 13, 6, 85, 10, 10, 11, 11, 6, 85, 0, 10, 80, 10, 2, 0, 10, +16, 10, 2, 64, 10, 112, 10, -128, 10, 3, 10, -72, 1, 109, 64, 52, 3, 2, 32, 15, 42, 16, 16, 2, 85, +15, 14, 15, 15, 2, 85, 15, 6, 13, 13, 2, 85, 15, 16, 12, 12, 2, 85, 15, 10, 11, 11, 2, 85, 15, +14, 16, 16, 6, 85, 15, 40, 15, 15, 6, 85, 15, 10, 12, 12, 6, 85, 15, -72, -1, -10, 64, 15, 11, 11, +6, 85, 15, 15, 1, 79, 15, 127, 15, -113, 15, 3, 15, -72, 1, 109, 64, 9, 6, 32, 3, 16, 16, 16, 2, +85, 3, -72, -1, -10, -76, 15, 15, 2, 85, 3, -72, -1, -2, -76, 12, 12, 2, 85, 3, -72, -1, -14, -76, 16, +16, 6, 85, 3, -72, -1, -24, 64, 30, 15, 15, 6, 85, 3, 6, 11, 13, 6, 85, 64, 3, 1, -17, 3, 1, +0, 3, 32, 3, 111, 3, 112, 3, -96, 3, -17, 3, 6, 3, 47, 93, 113, 114, 43, 43, 43, 43, 43, 43, -3, +-3, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, -3, 93, 113, 114, 43, 43, 43, 43, 43, 43, 43, +43, 43, -3, 57, 47, 93, -19, 0, 63, -3, 60, 60, 47, 63, 60, 16, 60, 49, 48, 1, 93, 19, 51, 17, 33, +17, 51, 17, 33, 17, 51, 17, 51, 17, 35, 17, 33, -95, -62, 1, -25, -62, 1, -25, -62, -123, -83, -6, 20, 5, +-70, -6, -13, 5, 13, -6, -13, 5, 13, -6, -13, -3, -68, 1, -105, 0, 0, 2, 0, 0, 0, 0, 6, 15, 5, +-70, 0, 12, 0, 22, 0, -53, 64, 30, 34, 8, 2, 30, 22, 22, 10, 12, 30, 0, 2, 13, 30, 10, 8, 17, +38, 6, 20, 16, 16, 2, 85, 6, 12, 13, 13, 2, 85, 6, -72, -1, -10, -76, 11, 13, 6, 85, 6, -72, -1, +-64, 64, 29, 36, 37, 52, 48, 6, 1, 0, 6, 16, 6, 32, 6, 3, 6, 49, 32, 24, 1, 24, 1, 13, 32, +10, 24, 16, 16, 2, 85, 10, -72, -1, -10, 64, 23, 15, 15, 2, 85, 10, 6, 13, 13, 2, 85, 10, 20, 12, +12, 2, 85, 10, 26, 11, 11, 2, 85, 10, -72, -1, -18, 64, 11, 11, 11, 6, 85, 10, 10, 12, 13, 6, 85, +10, -72, -1, -18, 64, 9, 15, 16, 6, 85, 10, -19, 0, 0, 23, 16, 60, 16, -12, 43, 43, 43, 43, 43, 43, +43, 43, -3, 60, 16, 93, -10, 93, 93, 43, 43, 43, 43, -19, 0, 63, -19, 63, -19, 18, 57, 47, -3, 49, 48, +67, 121, 64, 24, 4, 20, 19, 38, 15, 8, 17, 54, 1, 20, 4, 17, 54, 1, 16, 7, 14, 54, 0, 18, 5, +21, 54, 1, 43, 43, 1, 43, 43, 43, -127, 17, 33, 17, 33, 32, 18, 21, 20, 6, 33, 33, 17, 33, 1, 33, +50, 54, 53, 52, 38, 38, 35, 33, 2, -128, 1, 95, 1, 89, -41, -7, -2, -43, -3, -45, -2, 66, 2, -128, 1, +99, -73, -92, 97, -96, -70, -2, -3, 5, -70, -3, -114, -1, 0, -96, -72, -16, 5, 13, -5, -104, 123, -122, 91, 125, +35, 0, 0, 3, 0, -88, 0, 0, 6, 107, 5, -70, 0, 10, 0, 20, 0, 24, 1, 52, 64, 18, 34, 8, 2, +30, 20, 20, 10, 21, 1, 2, 11, 30, 24, 10, 8, 15, 38, 6, -72, -1, -22, -76, 15, 15, 2, 85, 6, -72, +-1, -36, -76, 13, 13, 2, 85, 6, -72, -1, -50, -76, 12, 12, 2, 85, 6, -72, -1, -30, 64, 39, 13, 13, 6, +85, 6, 3, 15, 15, 6, 85, 80, 6, 1, 16, 6, 32, 6, -64, 6, -48, 6, -32, 6, 5, 64, 6, 96, 6, +-128, 6, -81, 6, 4, 6, 6, 10, 24, 32, 22, -72, -1, -36, -76, 16, 16, 2, 85, 22, -72, -1, -52, 64, 17, +15, 15, 2, 85, 22, 46, 13, 13, 2, 85, 22, 22, 12, 12, 2, 85, 22, -72, -1, -23, -76, 11, 11, 6, 85, +22, -72, -1, -8, 64, 17, 12, 12, 6, 85, 22, 8, 13, 13, 6, 85, 22, 10, 15, 15, 6, 85, 22, -72, 1, +14, 64, 22, 32, 26, 48, 26, 64, 26, 80, 26, -128, 26, 5, 26, 1, 11, 32, 10, 32, 16, 16, 2, 85, 10, +-72, -1, -10, -76, 15, 15, 2, 85, 10, -72, -1, -10, -76, 13, 13, 2, 85, 10, -72, -1, -6, -76, 12, 12, 2, +85, 10, -72, -1, -8, -76, 13, 13, 6, 85, 10, -72, -1, -8, -74, 15, 16, 6, 85, 10, 93, 25, 16, -10, 43, +43, 43, 43, 43, 43, -3, 60, 16, 93, -10, 43, 43, 43, 43, 43, 43, 43, 43, -3, 17, 57, 47, 93, 113, 114, +43, 43, 43, 43, 43, -19, 0, 63, 60, -19, 63, 60, 18, 57, 47, -19, 49, 48, 67, 121, 64, 24, 4, 18, 17, +38, 13, 8, 15, 54, 1, 18, 4, 15, 54, 1, 14, 7, 12, 54, 0, 16, 5, 19, 54, 1, 43, 43, 1, 43, +43, 43, -127, 19, 51, 17, 33, 32, 22, 21, 20, 6, 33, 33, 55, 33, 50, 54, 53, 52, 38, 38, 35, 33, 1, +51, 17, 35, -88, -62, 1, 94, 1, 88, -39, -24, -2, -59, -3, -46, -62, 1, 99, -73, -91, 100, -98, -71, -2, -4, +4, 63, -62, -62, 5, -70, -3, -114, -2, -95, -86, -1, -91, 123, -121, 92, 124, 34, 3, 25, -6, 70, 0, 0, 2, +0, -91, 0, 0, 4, -10, 5, -70, 0, 11, 0, 21, 0, -59, 64, 22, 37, 8, 2, 30, 21, 21, 11, 0, 2, +12, 30, 11, 8, 16, 38, 7, 22, 16, 16, 2, 85, 7, -72, -1, -16, -76, 12, 12, 2, 85, 7, -72, -1, -13, +-76, 11, 13, 6, 85, 7, -72, -1, -64, 64, 35, 36, 37, 52, 48, 7, 1, 0, 7, 16, 7, 32, 7, 3, 7, +49, 64, 23, -128, 23, -112, 23, -81, 23, 4, 23, 1, 12, 32, 11, 32, 16, 16, 2, 85, 11, -72, -1, -10, -76, +15, 15, 2, 85, 11, -72, -1, -10, -76, 13, 13, 2, 85, 11, -72, -1, -6, -76, 12, 12, 2, 85, 11, -72, -1, +-10, -76, 12, 13, 6, 85, 11, -72, -1, -14, -74, 15, 16, 6, 85, 11, 93, 22, 16, -10, 43, 43, 43, 43, 43, +43, -3, 60, 16, 93, -10, 93, 93, 43, 43, 43, 43, -19, 0, 63, -19, 63, 18, 57, 47, -3, 49, 48, 67, 121, +64, 26, 4, 19, 5, 37, 18, 38, 14, 9, 16, 54, 1, 19, 4, 16, 54, 1, 15, 8, 13, 54, 0, 17, 6, +20, 54, 1, 43, 43, 1, 43, 43, 43, 43, -127, 19, 51, 17, 33, 50, 22, 22, 21, 20, 2, 33, 33, 55, 33, +50, 54, 53, 52, 38, 38, 35, 33, -91, -62, 1, 94, -11, -36, 96, -24, -2, -60, -3, -45, -62, 1, 99, -40, -125, +95, -98, -67, -2, -4, 5, -70, -3, -114, 114, -60, 104, -86, -1, 0, -91, -103, 108, 88, 123, 36, 0, -1, -1, 0, +74, -1, -25, 5, 92, 5, -45, 1, 83, 2, 47, 5, -64, 0, 0, -64, 0, 64, 0, 0, 29, 64, 9, 0, 13, +13, 39, 16, 16, 2, 85, 13, -72, -1, -35, -74, 13, 13, 2, 85, 13, 92, 28, 78, 16, -10, 43, 43, 17, 53, +0, 0, 2, 0, -92, -1, -25, 7, -83, 5, -45, 0, 18, 0, 30, 1, -68, 64, 54, 6, 21, 9, 23, 9, 27, +6, 29, 21, 21, 27, 23, 27, 27, 21, 29, 37, 7, 38, 11, 43, 13, 38, 21, 42, 23, 42, 27, 37, 29, 70, +20, 72, 24, 73, 26, 71, 30, 80, 21, 91, 23, 92, 27, 83, 29, 123, 14, -117, 14, -100, 4, 26, 14, -72, -1, +-24, -76, 16, 17, 2, 85, 14, -72, -1, -24, -76, 13, 14, 2, 85, 14, -72, -1, -24, -76, 11, 11, 2, 85, 4, +-72, -1, -24, -76, 16, 17, 2, 85, 4, -72, -1, -24, -76, 13, 14, 2, 85, 4, -72, -1, -24, 64, 49, 11, 11, +2, 85, 2, 30, 16, 64, 16, 17, 2, 85, 16, 64, 13, 14, 2, 85, 16, 64, 11, 11, 2, 85, 16, 64, 11, +11, 6, 85, 16, 16, 18, 0, 28, 30, 6, 3, 0, 2, 18, 8, 22, 30, 12, 9, 25, 38, 9, -72, -1, -10, +-76, 16, 16, 2, 85, 9, -72, -1, -14, -76, 15, 15, 2, 85, 9, -72, -1, -18, -76, 13, 13, 2, 85, 9, -72, +-1, -16, -76, 12, 12, 2, 85, 9, -72, -1, -18, -76, 11, 11, 2, 85, 9, -72, -1, -2, -76, 11, 11, 6, 85, +9, -72, -1, -10, -76, 13, 13, 6, 85, 9, -72, -1, -8, 64, 15, 15, 15, 6, 85, 9, 92, -128, 32, 1, 32, +19, 38, 15, 123, 3, -72, -1, -42, 64, 11, 16, 16, 2, 85, 3, 20, 15, 15, 2, 85, 3, -72, -1, -4, 64, +11, 13, 13, 2, 85, 3, 4, 12, 12, 2, 85, 3, -72, -1, -24, 64, 17, 11, 11, 2, 85, 3, 26, 11, 11, +6, 85, 3, 10, 12, 12, 6, 85, 3, -72, -1, -8, 64, 29, 13, 13, 6, 85, 3, 26, 15, 15, 6, 85, 32, +3, 127, 3, -113, 3, 3, 3, -38, 1, 17, 32, 18, 32, 16, 16, 2, 85, 18, -72, -1, -10, -76, 15, 15, 2, +85, 18, -72, -1, -10, -76, 13, 13, 2, 85, 18, -72, -1, -6, -76, 12, 12, 2, 85, 18, -72, -1, -8, -76, 15, +16, 6, 85, 18, -72, -1, -10, -76, 13, 13, 6, 85, 18, -72, -1, -6, -74, 12, 12, 6, 85, 18, 93, 31, 16, +-10, 43, 43, 43, 43, 43, 43, 43, -3, 60, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, -12, -19, 16, 93, +-12, 43, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, -19, 63, 63, 63, -19, 17, 18, 57, 47, 43, 43, 43, 43, +-19, 49, 48, 43, 43, 43, 43, 43, 43, 1, 93, 19, 51, 17, 33, 18, 0, 33, 32, 0, 17, 16, 0, 33, 32, +0, 3, 33, 17, 35, 1, 16, 0, 51, 50, 18, 17, 16, 2, 35, 34, 2, -92, -62, 1, 26, 21, 1, 112, 1, +16, 1, 31, 1, 121, -2, -120, -2, -37, -2, -10, -2, -99, 31, -2, -30, -62, 2, -97, 1, 0, -48, -43, -2, -6, +-43, -39, -5, 5, -70, -3, 110, 1, 56, 1, 115, -2, 108, -2, -90, -2, -104, -2, 106, 1, 95, 1, 54, -3, -124, +2, -42, -2, -22, -2, -51, 1, 52, 1, 33, 1, 18, 1, 59, -2, -63, 0, -1, -1, 0, 26, 0, 0, 5, 38, +5, -70, 1, 83, 0, 53, 5, -57, 0, 0, -64, 0, 64, 0, 0, -120, -71, 0, 15, -1, -12, -76, 11, 16, 6, +85, 16, -72, -1, -12, 64, 14, 11, 16, 6, 85, 1, 0, 0, 0, 34, 16, 16, 2, 85, 0, -72, -1, -18, -76, +15, 15, 2, 85, 0, -72, -1, -14, 64, 11, 13, 13, 2, 85, 0, 16, 12, 12, 2, 85, 0, -72, -1, -10, -76, +11, 11, 2, 85, 0, -72, -1, -4, -76, 16, 16, 6, 85, 0, -72, -1, -16, 64, 11, 15, 15, 6, 85, 0, 2, +13, 13, 6, 85, 0, -72, -1, -4, -76, 12, 12, 6, 85, 0, -72, -1, -14, 64, 13, 11, 11, 6, 85, 32, 0, +1, 32, 0, 1, 0, 93, 36, 1, 16, -10, 93, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 17, 53, 53, +43, 43, -1, -1, 0, 74, -1, -24, 4, 28, 4, 62, 2, 6, 0, 68, 0, 0, 0, 2, 0, 91, -1, -24, 4, +68, 5, -35, 0, 28, 0, 40, 1, 19, 64, 69, 57, 10, 53, 37, 57, 39, 73, 10, 70, 37, 72, 39, 89, 14, +89, 17, 85, 21, 91, 31, 81, 37, 92, 39, 12, 61, 24, 1, 9, 32, 38, 9, 35, 23, 0, 51, 1, -113, 5, +28, 26, 0, 32, 28, 12, 7, 38, 28, 19, 11, 0, -110, 1, -102, 29, 36, 42, 64, 13, 13, 2, 85, 42, 64, +11, 11, 2, 85, 15, -72, -1, -16, 64, 17, 16, 16, 2, 85, 15, 10, 15, 15, 2, 85, 15, 10, 13, 13, 2, +85, 15, -72, -1, -10, 64, 11, 12, 12, 2, 85, 15, 4, 11, 11, 2, 85, 15, -72, -1, -16, -76, 11, 13, 6, +85, 15, -72, -1, -8, -76, 15, 15, 6, 85, 15, -72, -1, -64, 64, 16, 36, 37, 52, 48, 15, 1, 0, 15, 16, +15, 32, 15, 3, 15, 49, 42, -72, -1, -64, 64, 67, 30, 35, 52, 48, 42, 1, 42, -128, 42, 1, 35, 36, 23, +12, 14, 15, 2, 85, 23, 18, 13, 13, 2, 85, 23, 12, 12, 12, 2, 85, 23, 28, 11, 11, 2, 85, 23, 18, +11, 11, 6, 85, 23, 22, 12, 13, 6, 85, 23, 14, 16, 16, 6, 85, 23, 64, 36, 37, 52, 31, 23, 63, 23, +2, 23, 49, 41, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, 93, 16, 113, 43, -10, 93, 93, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, -19, -12, -19, 0, 63, -19, 63, -19, 63, -19, -12, -28, 1, 17, 18, 57, 0, +17, 18, 57, 49, 48, 0, 113, 1, 93, 1, 23, 14, 2, 35, 34, 6, 6, 7, 54, 54, 51, 50, 0, 21, 20, +6, 6, 35, 34, 38, 2, 17, 16, 0, 33, 50, 54, 3, 52, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 3, +-111, -97, 11, 73, 115, -88, -33, -94, 71, 4, 68, -74, 114, -47, 1, 18, -118, -67, -93, -67, -46, 112, 1, 29, 1, +40, -72, 50, 2, -99, -113, -107, -94, -77, -125, -122, -89, 5, -35, 2, 107, 84, 24, 86, -67, -107, 101, 101, -2, -31, +-11, -70, -18, -126, -83, 1, 14, 1, 79, 1, -91, 1, 36, 12, -4, 80, -90, -44, -32, -69, -71, -60, -29, 0, 0, +3, 0, -120, 0, 0, 3, -16, 4, 38, 0, 15, 0, 25, 0, 35, 1, 50, 64, 54, 15, 37, 47, 37, 2, 70, +8, 8, 16, 35, 8, 5, 30, 16, 43, 35, 35, 15, 25, 43, 0, 6, 26, 43, 15, 10, 21, 36, 5, 12, 12, +13, 6, 85, 5, 8, 15, 15, 6, 85, 5, 22, 16, 16, 6, 85, -48, 5, 1, 5, -86, 30, 36, 11, -72, -1, +-4, -76, 13, 13, 2, 85, 11, -72, -1, -18, -76, 12, 12, 6, 85, 11, -72, -1, -8, -76, 13, 13, 6, 85, 11, +-72, -1, -12, 64, 11, 15, 15, 6, 85, 11, 6, 16, 16, 6, 85, 11, -72, -1, -64, 64, 19, 36, 37, 52, 48, +11, 1, 0, 11, 16, 11, 32, 11, 3, 11, 49, -33, 37, 1, 37, -72, -1, -64, 64, 29, 30, 35, 52, 48, 37, +1, 37, 25, 26, 37, 15, 4, 12, 12, 2, 85, 15, 10, 11, 11, 2, 85, 15, 4, 9, 9, 2, 85, 15, -72, +-1, -10, 64, 11, 11, 11, 6, 85, 15, 10, 12, 12, 6, 85, 15, -72, -1, -14, -74, 15, 16, 6, 85, 15, 69, +36, 16, -10, 43, 43, 43, 43, 43, 43, -3, 60, 16, 113, 43, 93, -10, 93, 93, 43, 43, 43, 43, 43, 43, -19, +-12, 93, 43, 43, 43, -19, 0, 63, -19, 63, -19, 18, 57, 47, -3, 1, 17, 18, 57, 0, 17, 18, 57, 49, 48, +67, 121, 64, 51, 2, 33, 19, 37, 3, 37, 32, 38, 18, 7, 21, 27, 1, 23, 2, 21, 27, 1, 28, 13, 30, +27, 1, 33, 9, 30, 27, 1, 20, 6, 17, 27, 0, 7, 22, 4, 24, 27, 1, 29, 12, 27, 27, 0, 31, 10, +34, 27, 1, 9, 8, 16, 60, 43, 43, 43, 60, 43, 1, 43, 43, 43, 43, 43, 43, 43, -127, 1, 93, 19, 33, +50, 22, 22, 21, 20, 6, 7, 22, 22, 21, 6, 6, 35, 33, 19, 51, 50, 54, 54, 53, 52, 38, 35, 35, 17, +51, 50, 54, 55, 52, 38, 38, 35, 35, -120, 1, -97, -103, -107, 107, 63, 63, 75, 99, 10, -60, -69, -2, 33, -76, +-64, 115, 86, 68, 119, -112, -58, -19, -103, 114, 3, 66, 106, 117, -38, 4, 38, 51, -120, 95, 76, 113, 38, 25, -119, +94, -105, -110, 2, 103, 24, 73, 51, 84, 66, -3, 3, 71, 87, 51, 87, 23, 0, 1, 0, -120, 0, 0, 2, -21, +4, 38, 0, 5, 0, 100, 64, 11, 3, 43, 0, 6, 5, 10, 1, 7, 4, 37, 0, -72, -1, -10, -76, 17, 17, +2, 85, 0, -72, -1, -6, 64, 17, 14, 14, 2, 85, 0, 4, 12, 12, 2, 85, 0, 10, 11, 11, 2, 85, 0, +-72, -1, -12, -76, 16, 16, 6, 85, 0, -72, -1, -4, 64, 22, 13, 13, 6, 85, 0, 12, 12, 12, 6, 85, 0, +4, 11, 11, 6, 85, 0, 0, 1, 0, 69, 6, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, 60, +0, 63, 63, -19, 49, 48, 19, 33, 21, 33, 17, 35, -120, 2, 99, -2, 81, -76, 4, 38, -107, -4, 111, 0, 0, +2, 0, 0, -2, -45, 4, 108, 4, 38, 0, 12, 0, 17, 1, 59, 64, 15, 13, 43, 0, 6, 5, 9, 15, 3, +10, 43, 7, 10, 13, -110, 0, -72, -1, -18, 64, 11, 16, 16, 2, 85, 0, 22, 12, 12, 2, 85, 0, -72, -1, +-14, -76, 11, 11, 2, 85, 0, -72, -1, -8, -76, 11, 11, 6, 85, 0, -72, -1, -22, 64, 25, 12, 12, 6, 85, +-113, 0, 1, 0, 64, 15, -55, 0, 11, 16, 11, 32, 11, 3, 11, 11, 8, 9, 16, 37, 2, -72, -1, -12, 64, +23, 12, 12, 6, 85, 2, 2, 16, 16, 6, 85, 15, 2, 1, 15, 2, -49, 2, 2, 2, 2, 5, 43, 3, -72, +-1, -30, 64, 17, 16, 16, 2, 85, 3, 0, 15, 15, 2, 85, 3, 14, 14, 14, 2, 85, 3, -72, -1, -10, 64, +11, 13, 13, 2, 85, 3, 6, 12, 12, 2, 85, 3, -72, -1, -10, 64, 17, 11, 11, 2, 85, 3, 8, 11, 11, +6, 85, 3, 18, 12, 12, 6, 85, 3, -72, -1, -38, -76, 13, 13, 6, 85, 3, -72, -1, -26, -76, 15, 15, 6, +85, 3, -72, -1, -11, 64, 36, 16, 16, 6, 85, 31, 3, 63, 3, -97, 3, -81, 3, -65, 3, -33, 3, -17, 3, +-1, 3, 8, 79, 3, -113, 3, 2, -33, 3, 1, 3, 78, 19, 8, 43, 9, 9, -72, -1, -8, -76, 12, 13, 6, +85, 9, -72, -1, -12, 64, 15, 15, 15, 6, 85, -33, 9, 1, 15, 9, 1, 31, 9, 1, 9, 18, 16, 60, 93, +113, 114, 43, 43, 16, -19, 16, -10, 114, 113, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -3, 57, 47, +93, 113, 43, 43, -19, 17, 18, 57, 47, 93, -19, -12, 93, 43, 43, 43, 43, 43, -19, 0, 63, -3, 60, 60, 47, +60, 63, -19, 49, 48, 1, 33, 17, 51, 17, 35, 17, 33, 17, 35, 17, 51, 18, 19, 2, 7, 33, 17, 1, 21, +2, -28, 115, -108, -4, -68, -108, 95, -66, -114, 20, -116, 2, 59, 4, 38, -4, 110, -2, 63, 1, 45, -2, -45, 1, +-63, 1, 2, 1, -5, -3, -5, -8, 2, -3, -1, -1, 0, 75, -1, -24, 4, 30, 4, 62, 2, 6, 0, 72, 0, +0, 0, 1, -1, -5, 0, 0, 5, 96, 4, 38, 0, 56, 1, -72, 64, 57, 39, 5, 1, 3, 18, 12, 37, 19, +18, 28, 37, 16, 58, 47, 58, 63, 58, 96, 58, 112, 58, -81, 58, 10, 0, 58, 31, 58, 48, 58, 79, 58, 127, +58, -128, 58, -33, 58, -17, 58, 8, 52, 22, 59, 33, -124, 22, -117, 33, -108, 22, -101, 33, 6, 53, 51, 51, -72, +-1, -8, -76, 16, 16, 2, 85, 51, -72, -1, -14, 64, 74, 15, 17, 6, 85, 51, 43, 41, 39, 20, 41, 41, 39, +3, 5, 5, 14, 15, 17, 6, 85, 5, 43, 14, 16, 20, 14, 14, 16, 23, 22, 22, 37, 21, 20, 20, 21, 21, +20, 32, 33, 33, 37, 34, 35, 20, 34, 34, 35, 3, 5, 53, 51, 4, 8, 1, 16, 14, 39, 41, 4, 11, 18, +37, 18, 1, 35, 32, 23, 20, 4, 29, 34, 55, 1, -72, 1, 12, 64, 63, 29, 26, 26, 0, 27, 46, 51, 11, +48, 11, 72, 8, 8, 0, 6, 34, 33, 33, 27, 27, 22, 22, 21, 10, 37, 39, 53, 41, 51, 5, 47, 35, 33, +32, 3, 28, 34, 18, 16, 14, 3, 5, 5, 10, 23, 22, 20, 3, 27, 64, 10, 1, 10, -86, -128, 21, 1, 0, +21, 16, 21, 2, 21, -72, 2, 40, 64, 11, 0, 27, 37, 56, 28, 10, 15, 16, 2, 85, 28, -72, -1, -14, -76, +14, 14, 2, 85, 28, -72, -1, -4, -76, 12, 12, 2, 85, 28, -72, -1, -10, -76, 11, 11, 2, 85, 28, -72, -1, +-9, -76, 11, 13, 6, 85, 28, -72, -1, -8, 64, 13, 16, 16, 6, 85, -128, 28, 1, 0, 28, 16, 28, 2, 28, +-72, 2, 40, 64, 29, 79, 47, 1, 47, -86, 0, 34, -112, 34, -48, 34, 3, 80, 34, -80, 34, -16, 34, 3, 112, +34, -32, 34, -16, 34, 3, 34, 51, 57, 16, -11, 93, 113, 114, -28, 113, -12, 93, 113, 43, 43, 43, 43, 43, 43, +60, -3, 60, -12, 93, 113, -28, 113, 18, 23, 57, 17, 23, 57, 17, 18, 23, 57, 17, 23, 57, 0, 63, 60, 16, +60, 16, 60, 16, 60, 63, 60, 16, -19, 60, 16, -28, 17, 18, 57, 47, 60, -3, 60, 17, 18, 23, 57, 17, 57, +57, 17, 18, 23, 57, 17, 18, 23, 57, -121, 5, 46, 43, 14, 125, 16, -60, -121, 5, 46, 24, 43, 14, 125, 16, +-60, -121, 14, 46, 24, 43, 43, 14, 125, 16, -60, -121, 14, 46, 24, 43, 43, 43, 14, 125, 16, -60, 49, 48, 1, +113, 113, 93, 0, 93, 1, 17, 50, 54, 55, 54, 55, 54, 51, 51, 21, 39, 34, 7, 6, 7, 6, 6, 7, 22, +23, 19, 35, 3, 38, 38, 35, 17, 35, 17, 34, 6, 7, 3, 35, 19, 54, 55, 38, 38, 39, 38, 39, 38, 35, +34, 7, 53, 51, 50, 22, 22, 23, 22, 22, 51, 17, 3, 9, 86, 70, 67, 63, 50, 49, 107, 66, 49, 72, 20, +21, 43, 40, 68, 72, 117, 111, -58, -58, -63, 59, 88, 61, -72, 60, 88, 59, -63, -58, -59, 112, 117, 80, 64, 64, +22, 25, 26, 51, 13, 40, 25, 104, 85, 67, 54, 66, 69, 87, 4, 38, -2, 53, 66, -97, -105, 42, 41, -107, 1, +21, 22, 109, 104, 80, 33, 31, -71, -2, -73, 1, 73, 100, 62, -2, 21, 1, -21, 61, 101, -2, -73, 1, 73, -71, +31, 37, 87, -92, 55, 13, 13, 1, -107, 25, 81, -128, -99, 68, 1, -53, 0, 0, 1, 0, 50, -1, -24, 3, 98, +4, 62, 0, 38, 1, 10, 64, 93, -44, 9, 1, 16, 40, 85, 29, -128, 9, -124, 12, -126, 29, 5, 8, 25, 1, +59, 8, 18, 0, 1, 26, -113, 0, 27, 80, 27, 96, 27, 112, 27, -80, 27, 5, -48, 27, 1, 27, 27, 30, 0, +11, -113, 15, 10, 127, 10, 2, 10, 10, 8, 64, 1, 1, 1, 72, -112, 0, -96, 0, 2, 0, 0, 24, 8, 72, +13, 7, 30, 72, 24, 11, 18, 16, 33, 1, 1, 5, 10, -55, 11, -113, 27, -55, 26, 5, 36, 16, -113, 33, 36, +21, -72, -1, -16, -76, 16, 16, 2, 85, 21, -72, -1, -64, 64, 17, 36, 37, 52, 48, 21, 1, 0, 21, 16, 21, +32, 21, 3, 21, 49, 40, 26, -72, -1, -16, 64, 13, 16, 16, 2, 85, 64, 26, 1, -113, 26, -80, 26, 2, 26, +-71, 2, 91, 0, 39, 16, -26, 93, 113, 43, 16, -10, 93, 93, 43, 43, -19, -12, -19, 16, -19, -12, -3, 17, 57, +47, 17, 18, 57, 0, 63, -19, 63, -19, 18, 57, 47, 93, -19, 113, 17, 57, 47, 93, -28, 17, 18, 57, 47, 113, +93, -28, 17, 18, 57, 49, 48, 67, 121, 64, 42, 31, 36, 19, 23, 14, 15, 6, 7, 35, 38, 7, 14, 5, 27, +1, 31, 23, 33, 27, 1, 36, 19, 33, 27, 3, 6, 15, 8, 27, 1, 32, 22, 30, 27, 0, 34, 20, 37, 27, +1, 19, 18, 16, 60, 43, 43, 43, 1, 43, 43, 43, 43, -127, -127, -127, -127, 0, 93, 1, 93, 113, 1, 53, 62, +2, 53, 52, 38, 35, 34, 7, 39, 18, 33, 50, 22, 21, 20, 7, 22, 22, 21, 20, 6, 35, 32, 3, 55, 22, +22, 51, 50, 54, 53, 52, 38, 38, 35, 34, 1, 114, 114, 83, 74, 97, 77, -104, 61, -85, 80, 1, 50, -86, -63, +126, 80, 80, -48, -69, -2, -107, 58, -87, 23, -115, 91, 91, 121, 76, 86, 113, 9, 1, -32, -115, 1, 16, 80, 60, +73, 87, -77, 28, 1, 43, -70, -127, -126, 77, 43, -123, 91, -113, -78, 1, 67, 36, 102, 112, 103, 80, 62, 92, 23, +0, 0, 1, 0, -121, 0, 0, 3, -16, 4, 38, 0, 9, 1, 82, 64, 17, 25, 3, 20, 8, 2, 86, 2, 103, +2, 123, 7, -124, 2, -115, 7, 5, 2, -72, -1, -22, 64, 11, 9, 17, 2, 85, 7, 22, 9, 17, 2, 85, 2, +-72, -1, -22, 64, 57, 9, 17, 6, 85, 7, 22, 9, 17, 6, 85, 3, 7, 8, 8, 43, 2, 3, 20, 2, 2, +3, 2, 7, 8, 3, 1, 6, 8, 6, 10, 7, 37, 11, 64, 16, 16, 2, 85, 11, 64, 11, 11, 2, 85, 4, +36, 16, 17, 2, 85, 4, 18, 14, 14, 2, 85, 4, -72, -1, -19, 64, 29, 13, 13, 2, 85, 4, 6, 12, 12, +2, 85, 4, 26, 11, 11, 2, 85, 4, 22, 16, 16, 6, 85, 4, 6, 15, 15, 6, 85, 4, -72, -1, -12, -76, +12, 13, 6, 85, 4, -72, -1, -4, 64, 18, 11, 11, 6, 85, 4, 64, 51, 54, 52, -1, 4, 1, -1, 4, 1, +4, 78, 11, -72, -1, -64, 64, 23, 52, 54, 52, -80, 11, -16, 11, 2, 112, 11, -128, 11, -96, 11, -80, 11, -64, +11, 5, 11, 2, 37, 9, -72, -1, -6, -76, 16, 16, 2, 85, 9, -72, -1, -6, 64, 11, 14, 14, 2, 85, 9, +6, 11, 12, 2, 85, 9, -72, -1, -6, 64, 11, 15, 15, 6, 85, 9, 4, 11, 11, 6, 85, 9, -72, -1, -64, +64, 18, 51, 54, 52, -16, 9, 1, 0, 9, 32, 9, -48, 9, -32, 9, 4, 9, 78, 10, 16, -10, 93, 113, 43, +43, 43, 43, 43, 43, -19, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +-19, -79, 6, 2, 67, 84, 88, -77, 3, 8, 7, 2, 17, 18, 57, 57, 27, -77, 3, 8, 6, 2, 17, 18, 57, +57, 89, 0, 63, 60, 63, 60, 18, 57, 57, -121, 5, 46, 43, -121, 125, -60, 0, 43, 43, 43, 43, 49, 48, 0, +93, 1, 93, 19, 51, 17, 1, 51, 17, 35, 17, 1, 35, -121, -76, 1, -13, -62, -76, -2, 13, -62, 4, 38, -4, +-42, 3, 42, -5, -38, 3, 37, -4, -37, 0, -1, -1, 0, -121, 0, 0, 3, -16, 5, -72, 2, 38, 2, 98, 0, +0, 1, 7, 0, -39, 0, -10, 0, 0, 0, 22, 64, 10, 1, 0, 17, 11, 0, 4, 65, 1, 1, 14, -71, 2, +34, 0, 41, 0, 43, 1, 43, 53, 0, 1, 0, -122, 0, 0, 3, -112, 4, 38, 0, 29, 1, 62, 64, 75, 62, +5, 63, 6, 63, 7, 68, 5, 68, 23, -108, 23, 6, 13, 6, 47, 4, 44, 5, 47, 6, 47, 31, 76, 6, 94, +6, 122, 7, -117, 7, -106, 6, 10, 75, 4, 75, 6, -101, 4, -101, 6, -85, 4, -85, 6, -69, 4, -69, 6, -53, +4, -53, 6, 10, 31, 31, 63, 31, 123, 4, 123, 6, -113, 4, -113, 6, 6, 4, 17, 6, 15, 24, 23, 23, -72, +-1, -16, 64, 27, 12, 13, 6, 85, 23, 37, 22, 21, 20, 22, 22, 21, 6, 4, 9, 2, 17, 15, 4, 6, 4, +12, 21, 24, 28, 19, 2, -72, 1, 12, 64, 42, 27, 27, 22, 1, 12, 72, 9, 9, 1, 6, 28, 23, 23, 22, +10, 4, 6, 19, 17, 15, 5, 11, 24, 21, 23, 3, 28, 11, -86, 0, 22, 1, 22, 73, 32, 31, 1, 31, 1, +28, 37, 0, -72, -1, -8, -76, 16, 16, 2, 85, 0, -72, -1, -6, 64, 17, 14, 14, 2, 85, 0, 6, 12, 12, +2, 85, 0, 6, 11, 11, 2, 85, 0, -72, -1, -6, -76, 12, 12, 6, 85, 0, -72, -1, -4, -76, 13, 13, 6, +85, 0, -72, -1, -16, -76, 15, 15, 6, 85, 0, -72, -1, -10, -76, 16, 16, 6, 85, 0, -72, -1, -64, 64, 18, +51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 30, 16, -12, 93, 113, 43, 43, 43, +43, 43, 43, 43, 43, 43, -3, 60, 16, 93, -11, 93, -28, 18, 23, 57, 17, 23, 57, 0, 63, 60, 16, 60, 63, +60, 16, -19, 17, 18, 57, 47, -19, 57, 18, 57, 57, 18, 23, 57, 17, 18, 57, 57, -121, 5, 46, 43, 43, 14, +125, 16, -60, 1, 17, 51, 17, 51, 93, 113, 49, 48, 1, 93, 113, 19, 51, 17, 50, 54, 55, 62, 2, 51, 51, +21, 39, 34, 7, 6, 7, 6, 6, 7, 22, 23, 19, 35, 3, 38, 38, 35, 17, 35, -122, -76, 86, 69, 67, 53, +66, 86, 95, 36, 50, 71, 20, 21, 43, 41, 68, 71, 116, 112, -59, -58, -64, 59, 88, 61, -76, 4, 38, -2, 53, +66, -97, 126, 80, 28, -107, 1, 21, 22, 109, 104, 80, 33, 31, -71, -2, -73, 1, 73, 99, 63, -2, 21, 0, 0, +1, 0, 24, -1, -7, 4, 35, 4, 38, 0, 18, 1, 70, 64, 22, 28, 8, 5, 43, 0, 6, 3, 51, 12, 14, +28, 10, 10, 3, 37, 20, 64, 11, 11, 2, 85, 2, -72, -1, -52, 64, 11, 16, 16, 2, 85, 2, 40, 15, 15, +2, 85, 2, -72, -1, -6, 64, 11, 14, 14, 2, 85, 2, 20, 13, 13, 2, 85, 2, -72, -1, -14, 64, 11, 12, +12, 2, 85, 2, 10, 11, 11, 2, 85, 2, -72, -1, -20, -76, 9, 9, 2, 85, 2, -72, -1, -15, -76, 11, 12, +6, 85, 2, -72, -1, -10, 64, 27, 13, 13, 6, 85, 2, 4, 15, 15, 6, 85, 2, 16, 16, 16, 6, 85, 2, +64, 51, 54, 52, -1, 2, 1, 2, 78, 20, -72, -1, -64, 64, 25, 52, 54, 52, -80, 20, -16, 20, 2, 64, 20, +96, 20, 112, 20, -96, 20, -80, 20, -64, 20, 6, 20, 5, 37, 18, -72, -1, -10, -76, 17, 17, 2, 85, 18, -72, +-1, -48, 64, 17, 16, 16, 2, 85, 18, 22, 15, 15, 2, 85, 18, 22, 13, 13, 2, 85, 18, -72, -1, -26, -76, +12, 12, 2, 85, 18, -72, -1, -20, -76, 11, 11, 2, 85, 18, -72, -1, -18, -76, 12, 12, 6, 85, 18, -72, -1, +-14, -76, 13, 13, 6, 85, 18, -72, -1, -32, 64, 22, 15, 16, 6, 85, 79, 18, 95, 18, 111, 18, 112, 18, -33, +18, 5, 18, -69, 12, 12, 20, 19, 124, -71, 1, 10, 0, 24, 43, 17, 18, 57, 47, -12, 93, 43, 43, 43, 43, +43, 43, 43, 43, 43, -19, 16, 93, 113, 43, -10, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +-19, 0, 63, -19, 16, -28, 63, -19, 49, 48, 67, 121, 64, 18, 15, 17, 7, 9, 8, 38, 16, 37, 15, 9, 18, +27, 1, 17, 7, 14, 27, 0, 43, 1, 43, 43, 43, -127, -127, 19, 33, 17, 35, 17, 33, 17, 20, 6, 6, 35, +34, 39, 53, 51, 50, 54, 54, 53, -33, 3, 68, -77, -2, 35, 24, 108, 102, 63, 82, 79, 56, 48, 16, 4, 38, +-5, -38, 3, -111, -3, -17, -71, 118, 88, 8, -106, 23, 50, -118, 0, 1, 0, -116, 0, 0, 4, -12, 4, 38, 0, +12, 1, -120, -74, 7, 28, 10, 13, 2, 85, 2, -72, -1, -28, 64, 118, 10, 12, 2, 85, 14, 2, -75, 10, -59, +10, 3, 18, 2, 27, 7, 2, 4, 1, 12, 3, 3, 8, 12, 9, 70, 1, 74, 3, 69, 8, 74, 9, 86, 8, +90, 9, -124, 1, -113, 3, -127, 8, -113, 9, -48, 1, -33, 3, -48, 8, -33, 9, -11, 8, -6, 9, 20, 8, 9, +25, 2, 27, 9, 120, 2, 120, 9, -120, 9, -108, 1, -101, 3, -108, 8, -101, 9, -92, 1, -85, 3, -76, 1, -69, +3, -74, 8, -60, 1, -53, 3, -58, 8, 18, 5, 8, 10, 9, 20, 1, 26, 3, 22, 8, 27, 9, -107, 1, -103, +2, -102, 3, -107, 8, -98, 9, 11, 1, -72, -1, -10, 64, 21, 1, 10, 9, 9, 11, 10, 12, 6, 85, 9, 43, +2, 1, 20, 2, 2, 1, 3, 7, 8, 8, -72, -1, -20, -76, 10, 12, 6, 85, 8, -72, -1, -11, 64, 39, 13, +13, 6, 85, 8, 43, 2, 3, 20, 2, 2, 3, 10, 7, 2, 3, 11, 3, 1, 6, 11, 9, 9, 8, 8, 6, +10, 2, 9, 8, 1, 3, 5, 6, 11, 6, 7, 37, 4, -72, -1, -28, 64, 11, 16, 16, 2, 85, 4, 28, 14, +14, 2, 85, 4, -72, -1, -20, -76, 12, 12, 2, 85, 4, -72, -1, -6, -76, 12, 12, 6, 85, 4, -72, -1, -2, +64, 33, 13, 13, 6, 85, 4, 8, 15, 15, 6, 85, 4, 32, 16, 17, 6, 85, 4, 78, -128, 14, -80, 14, -64, +14, 3, 14, 63, 14, 1, 11, 10, 37, 0, -72, -1, -6, 64, 11, 16, 16, 2, 85, 0, 6, 11, 12, 2, 85, +0, -72, -1, -2, -76, 12, 12, 6, 85, 0, -72, -1, -12, 64, 12, 15, 17, 6, 85, 0, 0, 32, 0, 2, 0, +78, 13, 16, -10, 93, 43, 43, 43, 43, -3, 60, 93, 16, 93, -10, 43, 43, 43, 43, 43, 43, 43, -3, 60, 17, +18, 23, 57, 0, 63, 60, 16, 60, 16, 60, 63, 60, 18, 23, 57, -121, 5, 46, 43, 43, 43, -121, 125, -60, -121, +46, 24, 43, 43, -121, 125, -60, 49, 48, 1, 56, 1, 114, 93, 113, 0, 114, 93, 43, 43, 19, 33, 1, 1, 33, +17, 35, 17, 1, 35, 1, 17, 35, -116, 1, 24, 1, 23, 1, 54, 1, 3, -76, -2, -58, -95, -2, -41, -80, 4, +38, -4, -82, 3, 82, -5, -38, 3, 87, -4, -87, 3, -128, -4, -128, 0, 0, 1, 0, -120, 0, 0, 3, -29, 4, +38, 0, 11, 0, -4, 64, 25, -48, 13, -32, 13, 2, 2, 43, 9, 9, 4, 1, 6, 10, 7, 10, 4, 7, 37, +13, 64, 11, 11, 2, 85, 5, -72, -1, -20, 64, 11, 16, 16, 2, 85, 5, 22, 14, 14, 2, 85, 5, -72, -1, +-20, 64, 17, 13, 13, 2, 85, 5, 8, 12, 12, 2, 85, 5, 34, 11, 11, 2, 85, 5, -72, -1, -10, 64, 30, +11, 13, 6, 85, 5, 10, 15, 15, 6, 85, 5, 22, 16, 16, 6, 85, 5, 64, 51, 54, 52, -1, 5, 1, -1, +5, 1, 5, 78, 13, -72, -1, -64, 64, 22, 52, 54, 52, -80, 13, -16, 13, 2, 112, 13, -96, 13, -80, 13, -64, +13, 4, 13, 1, 10, 37, 0, -72, -1, -10, -76, 17, 17, 2, 85, 0, -72, -1, -6, -76, 16, 16, 2, 85, 0, +-72, -1, -6, 64, 23, 14, 14, 2, 85, 0, 4, 12, 12, 2, 85, 0, 10, 11, 11, 2, 85, 0, 3, 11, 11, +6, 85, 0, -72, -1, -10, -76, 15, 15, 6, 85, 0, -72, -1, -64, 64, 20, 51, 54, 52, -16, 0, 1, 0, 0, +32, 0, -48, 0, -32, 0, -16, 0, 5, 0, 78, 12, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, -3, +60, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -3, 60, 0, 63, 60, 63, 60, +57, 47, -19, 49, 48, 1, 93, 19, 51, 17, 33, 17, 51, 17, 35, 17, 33, 17, 35, -120, -76, 1, -13, -76, -76, +-2, 13, -76, 4, 38, -2, 70, 1, -70, -5, -38, 1, -41, -2, 41, 0, -1, -1, 0, 68, -1, -24, 4, 39, 4, +62, 2, 6, 0, 82, 0, 0, 0, 1, 0, -120, 0, 0, 3, -50, 4, 38, 0, 7, 1, 11, 64, 16, 4, 43, +0, 6, 6, 3, 10, 3, 37, 9, 64, 11, 11, 2, 85, 1, -72, -1, -5, 64, 17, 16, 16, 2, 85, 1, 12, +15, 15, 2, 85, 1, 22, 14, 14, 2, 85, 1, -72, -1, -8, 64, 17, 13, 13, 2, 85, 1, 16, 12, 12, 2, +85, 1, 38, 11, 11, 2, 85, 1, -72, -1, -8, -76, 12, 12, 6, 85, 1, -72, -1, -6, 64, 32, 13, 13, 6, +85, 1, 14, 15, 15, 6, 85, 1, 24, 16, 16, 6, 85, 1, 64, 51, 54, 52, -1, 1, 1, -33, 1, -1, 1, +2, 1, 78, 9, -72, -1, -64, 64, 23, 52, 54, 52, -80, 9, -16, 9, 2, 31, 9, 112, 9, -96, 9, -80, 9, +-64, 9, 5, 9, 6, 37, 0, -72, -1, -10, -76, 17, 17, 2, 85, 0, -72, -1, -6, -76, 16, 16, 2, 85, 0, +-72, -1, -6, 64, 17, 14, 14, 2, 85, 0, 4, 12, 12, 2, 85, 0, 10, 11, 11, 2, 85, 0, -72, -1, -2, +-76, 12, 12, 6, 85, 0, -72, -1, -8, -76, 15, 15, 6, 85, 0, -72, -1, -4, -76, 16, 16, 6, 85, 0, -72, +-1, -64, 64, 18, 51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 8, 16, -10, 93, +113, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, -3, 0, 63, 60, 63, -19, 49, 48, 19, 33, 17, 35, 17, 33, 17, 35, -120, 3, 70, -76, +-2, 34, -76, 4, 38, -5, -38, 3, -111, -4, 111, -1, -1, 0, -121, -2, 105, 4, 33, 4, 62, 2, 6, 0, 83, +0, 0, -1, -1, 0, 80, -1, -24, 3, -19, 4, 62, 2, 6, 0, 70, 0, 0, 0, 1, 0, 38, 0, 0, 3, +-123, 4, 38, 0, 7, 0, -102, 64, 19, 47, 9, 48, 9, 64, 9, 95, 9, -96, 9, 5, 2, 7, 43, 0, 6, +5, 10, 7, -69, 1, 87, 0, 4, 0, 2, 1, 87, -78, 4, 37, 5, -72, -1, -10, 64, 11, 16, 16, 2, 85, +5, 10, 15, 15, 2, 85, 5, -72, -1, -12, -76, 13, 13, 2, 85, 5, -72, -1, -10, -76, 11, 11, 2, 85, 5, +-72, -1, -18, -76, 11, 11, 6, 85, 5, -72, -1, -8, -76, 12, 12, 6, 85, 5, -72, -1, -5, 64, 38, 13, 13, +6, 85, 5, 6, 16, 16, 6, 85, 0, 5, 16, 5, 80, 5, -80, 5, -64, 5, 5, 0, 5, 80, 5, 96, 5, +-96, 5, -80, 5, 5, 0, 5, -96, 5, 2, 5, 47, 93, 113, 114, 43, 43, 43, 43, 43, 43, 43, 43, -19, -19, +16, -19, 0, 63, 63, -3, 60, 49, 48, 1, 93, 19, 33, 21, 33, 17, 35, 17, 33, 38, 3, 95, -2, -86, -77, +-2, -86, 4, 38, -107, -4, 111, 3, -111, 0, -1, -1, 0, 33, -2, 81, 3, -18, 4, 38, 2, 6, 0, 92, 0, +0, 0, 3, 0, 75, -2, 105, 6, 74, 5, -70, 0, 29, 0, 41, 0, 53, 1, 68, 64, 98, 88, 18, 1, 4, +6, 4, 10, 11, 21, 11, 25, 15, 55, 31, 55, 91, 3, 92, 13, 85, 18, 83, 28, 89, 32, 89, 34, 89, 38, +85, 44, 86, 46, 85, 52, 106, 3, 106, 13, 101, 18, 100, 28, 106, 32, 110, 34, 110, 38, 104, 40, 102, 44, 101, +46, 102, 52, 121, 3, 118, 6, 121, 13, 118, 18, 118, 28, -125, 6, -119, 13, -123, 18, 35, 30, 48, 1, 0, 39, +51, 51, 28, 5, 26, 7, 33, 51, 45, 28, 11, 20, 11, 16, 14, 0, 0, 1, 15, -72, -1, -10, -73, 15, 16, +2, 85, 15, 37, 0, 16, -72, -1, -16, -76, 12, 12, 6, 85, 16, -72, -1, -13, 64, 10, 13, 13, 6, 85, 16, +16, 23, 36, 36, 8, -72, -1, -10, -76, 10, 11, 2, 85, 8, -72, -1, -28, -76, 11, 12, 6, 85, 8, -72, -1, +-22, -76, 13, 13, 6, 85, 8, -72, -1, -22, -76, 15, 15, 6, 85, 8, -72, -1, -64, 64, 36, 36, 37, 52, 48, +8, 1, 32, 8, 1, 8, 49, 0, 55, 64, 55, 80, 55, 96, 55, -128, 55, -112, 55, 6, 0, 55, 32, 55, 48, +55, 64, 55, -33, 55, 5, 55, -72, -1, -64, 64, 52, 30, 35, 52, 48, 55, 1, 55, 42, 36, 23, 24, 11, 11, +6, 85, 23, 35, 12, 12, 6, 85, 23, 28, 13, 13, 6, 85, 23, 8, 15, 15, 6, 85, 23, 14, 16, 16, 6, +85, 23, 64, 36, 37, 52, 31, 23, 63, 23, 2, 23, 49, 54, 16, -10, 93, 43, 43, 43, 43, 43, 43, -19, 16, +113, 43, 93, 93, -12, 93, 93, 43, 43, 43, 43, 43, -19, 18, 57, 47, 43, 43, 60, -3, 43, 60, 0, 63, 63, +63, 60, -3, -28, 63, 60, -3, -28, 1, 17, 18, 57, 57, 49, 48, 93, 0, 93, 1, 51, 17, 54, 54, 51, 50, +18, 21, 20, 2, 35, 34, 38, 39, 17, 35, 17, 6, 6, 35, 34, 2, 17, 52, 18, 51, 50, 22, 23, 19, 20, +22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 5, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 2, -15, -76, +56, -122, 77, -67, -35, -18, -79, 58, 120, 84, -76, 54, -125, 76, -89, -6, -30, -65, 80, -126, 51, -77, -124, 99, 110, +-101, -113, 112, 120, 121, -3, 94, -105, 112, 117, 116, 122, 123, 111, -116, 5, -70, -2, 5, 64, 63, -2, -59, -17, -7, +-2, -51, 36, 80, -2, 13, 1, -13, 58, 58, 1, 37, 1, 17, -25, 1, 57, 63, 64, -2, 80, -16, -91, -53, -42, +-54, -58, -50, -70, -31, -58, -59, -59, -46, -46, -51, 0, -1, -1, 0, 15, 0, 0, 3, -15, 4, 38, 2, 6, 0, +91, 0, 0, 0, 1, 0, -118, -2, -45, 4, 88, 4, 38, 0, 11, 1, 6, 64, 22, 95, 13, 1, 4, 1, 6, +7, 2, 43, 11, 10, 9, 14, 3, 37, 13, 64, 11, 11, 2, 85, 6, -72, -1, -22, -76, 16, 16, 2, 85, 6, +-72, -1, -32, -76, 13, 13, 2, 85, 6, -72, -1, -6, 64, 11, 12, 12, 2, 85, 6, 22, 11, 11, 2, 85, 6, +-72, -1, -14, -76, 11, 13, 6, 85, 6, -72, -1, -26, -76, 15, 15, 6, 85, 6, -72, -1, -18, -73, 16, 16, 6, +85, 6, 9, 43, 7, -72, -1, -16, -76, 16, 16, 2, 85, 7, -72, -1, -16, 64, 17, 13, 13, 2, 85, 7, 40, +11, 11, 2, 85, 7, 8, 13, 13, 6, 85, 7, -72, -1, -10, -76, 15, 16, 6, 85, 7, -72, 1, 12, 64, 16, +-112, 6, 1, 96, 6, -128, 6, -64, 6, 3, 6, 78, 13, 2, 37, 0, -72, -1, -6, 64, 23, 16, 16, 2, 85, +0, 6, 11, 12, 2, 85, 0, 14, 11, 11, 6, 85, 0, 4, 12, 12, 6, 85, 0, -72, -1, -15, -76, 15, 15, +6, 85, 0, -72, -1, -10, -76, 16, 16, 6, 85, 0, -72, -1, -64, 64, 18, 51, 54, 52, -16, 0, 1, 0, 0, +32, 0, -48, 0, -32, 0, 4, 0, 78, 12, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, -19, 16, -10, 93, +114, -4, 43, 43, 43, 43, 43, -19, 16, 43, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, 63, -3, 60, 63, 60, +49, 48, 1, 93, 19, 51, 17, 33, 17, 51, 17, 51, 17, 35, 17, 33, -118, -76, 1, -14, -76, 116, -108, -4, -58, +4, 38, -4, 110, 3, -110, -4, 110, -2, 63, 1, 45, 0, 0, 1, 0, 69, 0, 0, 3, -93, 4, 38, 0, 19, +0, -51, 64, 18, 28, 8, 8, 1, 13, 15, 72, 6, 6, 9, 1, 6, 12, 10, 9, 12, 37, 10, -72, -1, -48, +64, 17, 16, 16, 2, 85, 10, 32, 15, 15, 2, 85, 10, 10, 13, 13, 2, 85, 10, -72, -1, -6, -76, 10, 11, +2, 85, 10, -72, -1, -8, 64, 22, 12, 12, 6, 85, 10, 20, 15, 15, 6, 85, 10, 26, 16, 16, 6, 85, 10, +78, 21, 1, 37, 0, -72, -1, -32, 64, 17, 16, 16, 2, 85, 0, 28, 15, 15, 2, 85, 0, 22, 13, 13, 2, +85, 0, -72, -1, -4, 64, 36, 12, 12, 2, 85, 0, 22, 11, 12, 6, 85, 0, 24, 13, 13, 6, 85, 0, 24, +15, 15, 6, 85, 0, 28, 16, 16, 6, 85, 31, 0, 79, 0, 2, 0, 40, 20, 16, -10, 93, 43, 43, 43, 43, +43, 43, 43, 43, -19, 16, -12, 43, 43, 43, 43, 43, 43, 43, -3, 60, 0, 63, 63, 60, 57, 47, -19, 57, 18, +57, 49, 48, 67, 121, 64, 18, 16, 18, 3, 5, 4, 38, 17, 37, 5, 16, 2, 29, 0, 3, 18, 6, 29, 0, +43, 1, 43, 43, 43, -127, -127, 19, 51, 21, 20, 22, 22, 51, 50, 55, 17, 51, 17, 35, 17, 6, 35, 34, 38, +38, 53, 69, -76, 31, 118, 89, 102, -94, -76, -76, -90, -112, 121, -71, 66, 4, 38, -55, -126, 117, 87, 54, 1, -31, +-5, -38, 1, -84, 52, 123, -78, 107, 0, 1, 0, -115, 0, 0, 5, -35, 4, 38, 0, 11, 1, 124, 64, 37, 0, +13, 16, 13, 112, 13, 3, 32, 13, 48, 13, 79, 13, 96, 13, 112, 13, -96, 13, -64, 13, -17, 13, 8, 8, 4, +4, 1, 6, 7, 2, 43, 11, 10, 7, 37, 9, -72, -1, -10, -76, 16, 16, 2, 85, 9, -72, -1, -18, 64, 11, +13, 13, 2, 85, 9, 6, 12, 12, 2, 85, 9, -72, -1, -16, -76, 11, 11, 2, 85, 9, -72, -1, -24, -76, 12, +12, 6, 85, 9, -72, -1, -5, -76, 15, 15, 6, 85, 9, -72, -1, -3, 64, 36, 16, 16, 6, 85, 48, 9, 1, +0, 9, 16, 9, 48, 9, 64, 9, -80, 9, -48, 9, -32, 9, 7, 16, 9, 32, 9, 48, 9, 96, 9, 112, 9, +-128, 9, 6, 9, -72, 1, -60, -75, 64, 5, 1, 3, 37, 5, -72, -1, -20, -76, 16, 16, 2, 85, 5, -72, -1, +-22, -76, 13, 13, 2, 85, 5, -72, -1, -12, -76, 12, 12, 2, 85, 5, -72, -1, -12, -76, 11, 11, 2, 85, 5, +-72, -1, -19, -76, 12, 12, 6, 85, 5, -72, -1, -10, -76, 15, 15, 6, 85, 5, -72, -1, -6, 64, 36, 16, 16, +6, 85, 31, 5, 47, 5, -81, 5, -33, 5, 4, 0, 5, 48, 5, -48, 5, -32, 5, 4, 16, 5, 32, 5, 48, +5, 96, 5, 112, 5, -128, 5, 6, 5, -72, 1, -60, -78, 2, 37, 0, -72, -1, -6, -76, 16, 16, 2, 85, 0, +-72, -1, -12, 64, 11, 14, 14, 2, 85, 0, 6, 11, 11, 2, 85, 0, -72, -1, -16, 64, 11, 9, 10, 2, 85, +0, 6, 16, 16, 6, 85, 0, -72, -1, -2, -76, 15, 15, 6, 85, 0, -72, -1, -8, 64, 28, 13, 13, 6, 85, +0, 9, 12, 12, 6, 85, 0, 5, 11, 11, 6, 85, 15, 0, 1, 79, 0, 1, 0, 0, 1, 0, 78, 12, 16, +-10, 93, 113, 114, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, -3, 93, 113, 114, 43, 43, 43, 43, 43, 43, 43, +-3, 113, -3, 93, 113, 114, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, -3, 60, 63, 60, 16, 60, 49, 48, 1, +93, 93, 19, 51, 17, 33, 17, 51, 17, 33, 17, 51, 17, 33, -115, -76, 1, -102, -76, 1, -101, -77, -6, -80, 4, +38, -4, 111, 3, -111, -4, 111, 3, -111, -5, -38, 0, 1, 0, -115, -2, -45, 6, 84, 4, 38, 0, 15, 1, 124, +64, 46, 16, 17, 1, 32, 17, 79, 17, 96, 17, 112, 17, -96, 17, -64, 17, -17, 17, 7, 8, 4, 4, 1, 6, +6, 11, 2, 43, 15, 10, 13, 14, 14, 43, 12, 10, 16, 16, 6, 85, 12, 20, 15, 15, 6, 85, 12, -72, -1, +-17, 64, 25, 13, 13, 6, 85, 12, 17, 12, 12, 6, 85, 12, 12, 17, 48, 17, 80, 17, 112, 17, -96, 17, 4, +7, 37, 9, -72, -1, -10, -76, 16, 16, 2, 85, 9, -72, -1, -18, 64, 11, 13, 13, 2, 85, 9, 6, 12, 12, +2, 85, 9, -72, -1, -16, -76, 11, 11, 2, 85, 9, -72, -1, -19, 64, 42, 12, 13, 6, 85, 9, 3, 16, 16, +6, 85, 48, 9, 1, 0, 9, 16, 9, 48, 9, 64, 9, -80, 9, -48, 9, -32, 9, 7, 16, 9, 32, 9, 48, +9, 96, 9, 112, 9, -128, 9, 6, 9, -72, 1, -60, -75, 64, 5, 1, 3, 37, 5, -72, -1, -20, -76, 16, 16, +2, 85, 5, -72, -1, -22, -76, 13, 13, 2, 85, 5, -72, -1, -12, -76, 12, 12, 2, 85, 5, -72, -1, -12, -76, +11, 11, 2, 85, 5, -72, -1, -15, 64, 36, 12, 13, 6, 85, 31, 5, 47, 5, -81, 5, -33, 5, 4, 0, 5, +48, 5, -48, 5, -32, 5, 4, 16, 5, 32, 5, 48, 5, 96, 5, 112, 5, -128, 5, 6, 5, -72, 1, -60, -78, +2, 37, 0, -72, -1, -6, -76, 16, 16, 2, 85, 0, -72, -1, -12, 64, 11, 14, 14, 2, 85, 0, 6, 11, 11, +2, 85, 0, -72, -1, -16, 64, 11, 9, 10, 2, 85, 0, 10, 16, 16, 6, 85, 0, -72, -1, -13, 64, 22, 13, +13, 6, 85, 0, 13, 12, 12, 6, 85, 15, 0, 1, 79, 0, 1, 0, 0, 1, 0, 78, 16, 16, -10, 93, 113, +114, 43, 43, 43, 43, 43, 43, 43, -19, -3, 93, 113, 114, 43, 43, 43, 43, 43, -3, 113, -3, 93, 113, 114, 43, +43, 43, 43, 43, 43, -19, 93, 18, 57, 47, 43, 43, 43, 43, -19, 0, 63, 63, -3, 60, 60, 63, 60, 16, 60, +49, 48, 1, 93, 93, 19, 51, 17, 33, 17, 51, 17, 33, 17, 51, 17, 51, 17, 35, 17, 33, -115, -76, 1, -102, +-76, 1, -101, -77, 119, -107, -6, -50, 4, 38, -4, 110, 3, -110, -4, 110, 3, -110, -4, 110, -2, 63, 1, 45, 0, +2, 0, 40, 0, 0, 4, -73, 4, 38, 0, 12, 0, 21, 0, -8, 64, 28, 19, 16, 1, 25, 19, 1, 25, 18, +1, 25, 4, 1, 21, 43, 2, 2, 10, 12, 43, 0, 6, 13, 43, 10, 10, 17, 36, 6, -72, -1, -26, -76, 13, +13, 2, 85, 6, -72, -1, -6, -76, 11, 11, 2, 85, 6, -72, -1, -2, -76, 11, 11, 6, 85, 6, -72, -1, -22, +-76, 12, 12, 6, 85, 6, -72, -1, -20, 64, 10, 15, 15, 6, 85, 6, 23, -33, 23, 1, 23, -72, -1, -64, 64, +22, 30, 35, 52, 48, 23, 1, 2, 13, 37, 10, 12, 16, 16, 2, 85, 10, 16, 15, 15, 2, 85, 10, -72, -1, +-38, -76, 13, 13, 2, 85, 10, -72, -1, -22, -76, 12, 12, 2, 85, 10, -72, -1, -12, -76, 11, 11, 2, 85, 10, +-72, -1, -64, -77, 25, 76, 52, 10, -72, -1, -64, 64, 10, 11, 13, 52, -112, 10, 1, 10, 12, 12, 0, -72, -1, +-14, -76, 11, 11, 6, 85, 0, -72, -1, -32, -76, 12, 13, 6, 85, 0, -72, -1, -45, -76, 15, 15, 6, 85, 0, +-72, -1, -54, 64, 11, 16, 16, 6, 85, 0, 64, 25, 76, 52, 0, 22, 16, -34, 43, 43, 43, 43, 43, 60, 16, +-34, 93, 43, 43, 43, 43, 43, 43, 43, -3, 60, 1, 113, 43, 93, 16, -34, 43, 43, 43, 43, 43, -19, 0, 63, +-19, 63, -19, 18, 57, 47, -19, 49, 48, 114, 114, 114, 114, 19, 33, 17, 51, 50, 22, 21, 20, 6, 35, 33, 17, +33, 1, 51, 50, 54, 53, 52, 38, 35, 35, 40, 1, -37, -27, -13, -36, -43, -48, -2, 61, -2, -39, 1, -37, -67, +-84, -112, 123, -87, -43, 4, 38, -2, 97, -67, -119, -114, -77, 3, -111, -3, 1, 83, 92, 84, 92, 0, 3, 0, -117, +0, 0, 5, 46, 4, 38, 0, 3, 0, 14, 0, 23, 1, 32, 64, 19, 31, 8, 6, 43, 23, 23, 3, 5, 0, +6, 15, 43, 14, 14, 3, 10, 19, 36, 10, -72, -1, -20, 64, 11, 15, 16, 2, 85, 10, 10, 13, 13, 2, 85, +10, -72, -1, -38, -76, 15, 15, 6, 85, 10, -72, -1, -20, 64, 39, 16, 16, 6, 85, 80, 10, -112, 10, 2, 15, +10, 1, 96, 10, 112, 10, -128, 10, -64, 10, 4, 10, 10, 15, 3, 37, 1, 4, 16, 16, 2, 85, 1, 32, 15, +15, 2, 85, 1, -72, -1, -30, 64, 11, 13, 13, 2, 85, 1, 10, 12, 12, 2, 85, 1, -72, -1, -20, -76, 10, +11, 2, 85, 1, -72, -1, -28, -76, 11, 11, 6, 85, 1, -72, -1, -12, 64, 23, 12, 13, 6, 85, 1, 16, 15, +15, 6, 85, 1, 36, 16, 16, 6, 85, 1, 78, 25, 5, 15, 37, 4, -72, -1, -4, 64, 11, 16, 16, 2, 85, +4, 4, 11, 12, 2, 85, 4, -72, -1, -12, -76, 15, 15, 6, 85, 4, -72, -1, -16, -76, 16, 16, 6, 85, 4, +-72, -1, -64, 64, 18, 51, 54, 52, -16, 4, 1, 0, 4, 32, 4, -48, 4, -32, 4, 4, 4, 78, 24, 16, -10, +93, 113, 43, 43, 43, 43, 43, -3, 60, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, -3, 17, 57, 47, 93, +113, 114, 43, 43, 43, 43, -19, 0, 63, 60, 16, -19, 63, 60, 18, 57, 47, -3, 49, 48, 67, 121, 64, 22, 8, +21, 17, 12, 19, 27, 1, 21, 8, 19, 27, 1, 18, 11, 16, 27, 0, 20, 9, 22, 27, 1, 43, 43, 1, 43, +43, -127, 1, 51, 17, 35, 1, 51, 17, 51, 50, 22, 21, 20, 6, 35, 33, 55, 51, 50, 54, 53, 52, 38, 35, +35, 4, 122, -76, -76, -4, 17, -76, -28, -33, -15, -55, -35, -2, 62, -76, -67, -85, -110, 108, -71, -43, 4, 38, -5, +-38, 4, 38, -2, 97, -83, -104, -123, -67, -108, 84, 89, 69, 108, 0, 2, 0, -124, 0, 0, 3, -20, 4, 38, 0, +10, 0, 19, 1, 6, 64, 22, 31, 8, 2, 43, 19, 19, 10, 0, 6, 11, 43, 10, 10, 15, 36, 6, 14, 12, +12, 2, 85, 6, -72, -1, -4, -76, 11, 11, 6, 85, 6, -72, -1, -15, -76, 12, 12, 6, 85, 6, -72, -1, -10, +64, 11, 15, 15, 6, 85, 6, 6, 16, 16, 6, 85, 6, -72, -1, -64, 64, 55, 36, 37, 52, 48, 6, 1, 0, +6, 16, 6, 32, 6, 3, 6, 49, 31, 21, 63, 21, 95, 21, 127, 21, -97, 21, -81, 21, -65, 21, -33, 21, 8, +15, 21, 1, 15, 21, -113, 21, -81, 21, -65, 21, -49, 21, -33, 21, -17, 21, 7, 21, 1, 11, 37, 0, -72, -1, +-4, 64, 11, 16, 16, 2, 85, 0, 4, 11, 12, 2, 85, 0, -72, -1, -4, -76, 12, 12, 6, 85, 0, -72, -1, +-2, -76, 13, 13, 6, 85, 0, -72, -1, -12, -76, 15, 15, 6, 85, 0, -72, -1, -20, -76, 16, 16, 6, 85, 0, +-72, -1, -64, 64, 18, 51, 54, 52, -16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 20, 16, -10, +93, 113, 43, 43, 43, 43, 43, 43, 43, -3, 60, 16, 113, 114, 93, -10, 93, 93, 43, 43, 43, 43, 43, 43, -19, +0, 63, -19, 63, 18, 57, 47, -3, 49, 48, 67, 121, 64, 22, 4, 17, 13, 8, 15, 27, 1, 17, 4, 15, 27, +1, 14, 7, 12, 27, 0, 16, 5, 18, 27, 1, 43, 43, 1, 43, 43, -127, 19, 51, 17, 51, 50, 22, 21, 20, +6, 35, 33, 55, 51, 50, 54, 53, 52, 38, 35, 35, -124, -76, -28, -33, -15, -55, -35, -2, 62, -76, -67, -85, -110, +108, -71, -43, 4, 38, -2, 97, -83, -104, -123, -67, -108, 84, 89, 69, 108, 0, -1, -1, 0, 43, -1, -37, 3, -54, +4, 62, 1, 83, 2, 125, 4, 21, 0, 0, -64, 0, 64, 0, 0, 57, -79, 0, 14, -72, -1, -6, 64, 11, 16, +16, 2, 85, 14, 6, 15, 15, 2, 85, 14, -72, -1, -12, -76, 12, 12, 2, 85, 14, -72, -1, -2, 64, 14, 15, +15, 6, 85, 14, 6, 16, 16, 6, 85, 14, 14, 55, 28, 78, 16, -10, 17, 43, 43, 43, 43, 43, 53, 0, 0, +2, 0, -119, -1, -24, 5, -83, 4, 62, 0, 19, 0, 31, 1, 125, 64, 94, 10, 4, 1, 52, 25, 71, 25, 90, +8, 95, 12, 80, 14, 83, 21, 83, 25, 95, 27, 91, 31, 110, 8, 111, 12, 101, 14, 99, 21, 99, 25, 111, 27, +110, 31, -71, 4, -53, 4, -39, 4, -39, 15, -37, 21, -39, 22, -37, 25, -43, 27, -45, 31, -23, 4, -25, 15, -7, +4, -5, 5, -9, 15, -7, 21, -6, 25, -11, 27, -13, 31, 34, 2, 43, 17, 17, 19, 0, 20, 28, 6, 7, 0, +6, 19, 10, 26, 28, 13, 11, 3, 16, 36, 23, -72, -1, -18, -76, 16, 16, 2, 85, 23, -72, -1, -28, -76, 13, +13, 2, 85, 23, -72, -1, -19, 64, 11, 16, 16, 6, 85, 23, 16, 13, 13, 6, 85, 23, -72, -1, -9, 64, 24, +12, 12, 6, 85, 48, 23, -1, 23, 2, -97, 23, -48, 23, -32, 23, -16, 23, 4, 23, 23, 0, 29, 36, 10, -72, +-1, -4, -76, 16, 16, 2, 85, 10, -72, -1, -14, -76, 15, 15, 2, 85, 10, -72, -1, -12, -76, 15, 15, 6, 85, +10, -72, -1, -10, -76, 13, 13, 6, 85, 10, -72, -1, -16, -76, 11, 12, 6, 85, 10, -72, -1, -64, 64, 20, 36, +37, 52, 48, 10, 1, 0, 10, 16, 10, 32, 10, 3, 10, 49, 33, 1, 18, 37, 0, -72, -1, -10, -76, 17, 17, +2, 85, 0, -72, -1, -6, -76, 16, 16, 2, 85, 0, -72, -1, -6, 64, 23, 14, 14, 2, 85, 0, 4, 12, 12, +2, 85, 0, 10, 11, 11, 2, 85, 0, 4, 11, 12, 6, 85, 0, -72, -1, -2, -76, 13, 13, 6, 85, 0, -72, +-1, -8, -76, 15, 15, 6, 85, 0, -72, -1, -12, -76, 16, 16, 6, 85, 0, -72, -1, -64, 64, 18, 51, 54, 52, +-16, 0, 1, 0, 0, 32, 0, -48, 0, -32, 0, 4, 0, 78, 32, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, -3, 60, 16, -10, 93, 93, 43, 43, 43, 43, 43, 43, -19, 18, 57, 47, 93, 113, 43, 43, 43, +43, 43, -3, 60, 0, 63, -19, 63, 63, 63, -19, 17, 18, 57, 47, -19, 49, 48, 1, 93, 113, 19, 51, 17, 51, +54, 54, 51, 50, 22, 22, 21, 16, 2, 35, 34, 2, 39, 35, 17, 35, 1, 34, 6, 21, 20, 22, 51, 50, 54, +53, 52, 38, -119, -76, -38, 24, -19, -67, -95, -70, 121, -6, -42, -57, -16, 15, -38, -76, 3, 90, -124, -109, -108, 124, +123, -99, -120, 4, 38, -2, 68, -28, -16, -126, -28, -63, -2, -19, -2, -28, 1, 8, -26, -2, 42, 3, -91, -53, -73, +-37, -52, -67, -46, -51, -51, 0, 2, 0, 31, 0, 0, 3, -53, 4, 38, 0, 18, 0, 27, 1, 32, 64, 38, 4, +9, 29, 8, 52, 12, 68, 12, 91, 8, 84, 12, -44, 12, 7, 121, 11, 1, 36, 8, 12, 2, 10, 6, 8, 8, +10, 12, 12, 2, 85, 8, 6, 12, 12, 6, 85, 8, -72, -1, -10, 64, 42, 16, 16, 6, 85, 8, 37, 9, 11, +20, 9, 9, 11, 11, 12, 6, 9, 3, 12, 12, 27, 43, 3, 3, 2, 20, 43, 18, 6, 9, 8, 8, 2, 10, +11, 6, 8, 3, 9, 19, 2, 37, 0, -72, -1, -4, 64, 11, 16, 16, 2, 85, 0, 18, 15, 15, 2, 85, 0, +-72, -1, -10, 64, 11, 13, 13, 2, 85, 0, 18, 12, 12, 2, 85, 0, -72, -1, -18, -76, 11, 11, 2, 85, 0, +-72, -1, -22, -76, 10, 10, 2, 85, 0, -72, -1, -8, -76, 12, 12, 6, 85, 0, -72, -1, -6, 64, 24, 13, 13, +6, 85, 0, 14, 15, 15, 6, 85, 0, 34, 16, 16, 6, 85, 0, 78, 29, 9, 40, 23, 36, 15, -72, -1, -8, +-74, 10, 10, 2, 85, 15, -111, 28, 16, -10, 43, -19, 25, -28, 24, 16, -10, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, -3, 60, 17, 23, 57, 0, 63, 60, 16, 60, 63, -19, 18, 57, 47, -19, 25, 57, 47, 17, 18, 57, 17, +57, -121, 5, 46, 24, 43, 43, 43, 43, 14, 125, 16, -60, 1, 17, 18, 57, 49, 48, 24, 67, 121, 64, 24, 13, +25, 25, 13, 23, 27, 2, 21, 17, 23, 27, 0, 24, 14, 26, 27, 0, 13, 12, 22, 16, 20, 27, 1, 0, 43, +16, 60, 43, 1, 43, 43, -127, 1, 93, 113, 1, 17, 35, 17, 35, 34, 6, 7, 7, 35, 19, 54, 55, 38, 38, +53, 52, 54, 51, 5, 33, 34, 6, 21, 20, 22, 51, 51, 3, -53, -77, 104, 95, 93, 89, -99, -33, -62, 89, 88, +-102, -107, -61, -71, 1, 57, -1, 0, -95, 93, -119, -82, -57, 4, 38, -5, -38, 1, -98, 49, -123, -24, 1, 30, -125, +17, 21, -76, 117, -118, -84, -107, 100, 67, 95, 89, -1, -1, 0, 75, -1, -24, 4, 30, 5, -61, 2, 38, 0, 72, +0, 0, 1, 7, 0, -114, 0, -33, 0, 0, 0, 35, 64, 20, 3, 2, 34, 64, 11, 11, 2, 85, -81, 34, 1, +34, 10, 80, 72, 43, 2, 3, 2, 37, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 43, 53, 53, 0, 0, 1, +0, 0, -2, 81, 3, -24, 5, -70, 0, 37, 1, 56, 64, 30, 3, 15, 20, 15, 37, 11, 53, 11, 70, 11, 5, +54, 18, 69, 19, 122, 31, -117, 31, 4, 23, 23, 22, 22, 26, 28, 20, 15, 7, 2, -72, -1, -64, 64, 55, 30, +43, 52, 2, -44, 8, 1, 1, 13, 4, 0, 32, 28, 13, 7, 36, 37, 10, 23, 0, 22, 1, 22, 7, 32, 2, +1, 2, 29, 37, 39, 64, 11, 11, 2, 85, 39, 64, 16, 16, 2, 85, 16, 40, 16, 16, 2, 85, 16, 20, 14, +14, 2, 85, 16, -72, -1, -20, 64, 17, 13, 13, 2, 85, 16, 4, 12, 12, 2, 85, 16, 26, 11, 11, 2, 85, +16, -72, -1, -10, 64, 30, 11, 13, 6, 85, 16, 10, 15, 15, 6, 85, 16, 20, 16, 16, 6, 85, 16, 64, 51, +54, 52, -1, 16, 1, -64, 16, 1, 16, 78, 39, -72, -1, -64, 64, 24, 52, 54, 52, -80, 39, -16, 39, 2, 112, +39, -96, 39, -80, 39, -1, 39, 4, 39, 10, 5, 36, 37, 4, 37, -72, -1, -6, -76, 16, 16, 2, 85, 37, -72, +-1, -6, 64, 23, 14, 14, 2, 85, 37, 4, 12, 12, 2, 85, 37, 8, 11, 11, 2, 85, 37, 8, 11, 11, 6, +85, 37, -72, -1, -8, -76, 15, 15, 6, 85, 37, -72, -1, -64, 64, 18, 51, 54, 52, -16, 37, 1, 0, 37, 32, +37, -48, 37, -32, 37, 4, 37, 78, 38, 16, -3, 93, 113, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, 60, 16, +93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 47, 93, 47, 47, 93, 51, 0, +63, 60, 63, -19, 63, 18, 57, 47, 60, -3, 43, 60, 63, -19, 51, 47, 51, 47, 49, 48, 1, 93, 0, 93, 19, +35, 39, 51, 53, 51, 21, 33, 21, 33, 17, 54, 54, 51, 50, 22, 21, 17, 20, 6, 35, 34, 39, 55, 22, 51, +50, 54, 53, 17, 52, 38, 35, 34, 6, 21, 17, 35, -121, -122, 1, -121, -77, 1, 87, -2, -87, 61, -95, 99, -81, +-66, -104, 114, 79, 63, 34, 52, 32, 47, 63, 113, 113, 99, -75, -77, 4, -63, 119, -126, -126, 119, -2, -22, 74, 73, +-72, -27, -3, 37, -18, -121, 19, -103, 14, 63, -100, 2, -41, -127, -127, -118, -44, -3, -69, 0, -1, -1, 0, -120, 0, +0, 2, -21, 5, -62, 2, 38, 2, 93, 0, 0, 1, 6, 0, -115, 120, 0, 0, 11, -78, 1, 1, 6, -71, 2, +34, 0, 41, 0, 43, 0, 0, 1, 0, 75, -1, -37, 3, -22, 4, 62, 0, 26, 0, -30, 64, 58, 31, 28, 69, +24, 85, 4, 85, 24, 107, 12, 108, 13, 108, 16, 115, 9, 115, 10, 123, 12, 116, 18, 117, 19, -123, 18, -107, 18, +-112, 24, 15, 20, -113, 95, 21, 111, 21, 2, 21, 21, 11, 17, 8, 34, 48, 7, 64, 7, 96, 7, -96, 7, 4, +7, 7, 17, 11, 26, -72, -1, -64, 64, 72, 30, 32, 52, 26, 43, 2, 2, 11, 23, 28, 17, 7, 5, 28, 11, +11, 1, 1, 7, 2, 21, 36, 20, -102, 7, 36, 31, 8, 1, 8, 55, 28, 26, 2, 36, 14, 8, 14, 14, 2, +85, 14, 12, 13, 13, 2, 85, 14, 12, 12, 12, 2, 85, 14, 16, 11, 11, 2, 85, 14, 16, 12, 12, 6, 85, +14, 10, 11, 13, 6, 85, 14, -72, -1, -4, 64, 24, 15, 15, 6, 85, 14, 14, 16, 16, 6, 85, 14, 64, 36, +37, 52, 31, 14, 63, 14, 2, 14, 49, 27, 52, -71, 1, 10, 0, 24, 43, 78, 16, -12, 93, 43, 43, 43, 43, +43, 43, 43, 43, 43, 77, -3, 60, 78, 16, -10, 93, 77, -19, -12, -19, 17, 18, 57, 47, 0, 63, -19, 63, -19, +18, 57, 47, -19, 43, 17, 18, 57, 47, 93, -28, 17, 18, 57, 47, 93, -28, 49, 48, 1, 93, 1, 21, 33, 22, +22, 51, 50, 19, 23, 6, 6, 35, 6, 2, 55, 16, 0, 51, 50, 22, 23, 7, 38, 35, 34, 6, 7, 2, -127, +-2, -119, 17, -111, -127, -28, 41, -80, 28, -21, -66, -30, -8, 6, 1, 2, -33, -78, -36, 24, -81, 44, -47, 120, -103, +17, 2, 106, -108, -83, -83, 1, 8, 23, -81, -42, 13, 1, 57, -1, 1, 3, 1, 40, -67, -107, 28, -39, -79, -114, +0, -1, -1, 0, 63, -1, -24, 3, -79, 4, 62, 2, 6, 0, 86, 0, 0, -1, -1, 0, -120, 0, 0, 1, 60, +5, -70, 2, 6, 0, 76, 0, 0, -1, -1, 0, 9, 0, 0, 2, 58, 5, -61, 2, 38, 0, -43, 0, 0, 1, +6, 0, -114, -52, 0, 0, 31, 64, 17, 2, 1, 8, 32, 11, 11, 6, 85, 8, 2, 0, 72, 43, 1, 2, 2, +11, -71, 2, 34, 0, 41, 0, 43, 1, 43, 43, 53, 53, 0, -1, -1, -1, -94, -2, 81, 1, 58, 5, -70, 2, +6, 0, 77, 0, 0, 0, 2, 0, 19, -1, -6, 6, -8, 4, 38, 0, 25, 0, 34, 1, 32, 64, 31, 21, 4, +21, 6, 16, 36, 3, 1, 43, 34, 34, 9, 11, 43, 25, 6, 26, 43, 9, 19, 43, 18, 18, 9, 10, 16, 10, +0, 26, 37, 9, -72, -1, -12, 64, 11, 16, 16, 2, 85, 9, 12, 15, 15, 2, 85, 9, -72, -1, -12, -76, 13, +13, 2, 85, 9, -72, -1, -20, -76, 11, 11, 6, 85, 9, -72, -1, -39, -76, 12, 12, 6, 85, 9, -72, -1, -16, +-76, 13, 13, 6, 85, 9, -72, -1, -30, 64, 18, 16, 16, 6, 85, 64, 9, 96, 9, 2, -112, 9, 1, 9, 9, +12, 30, 36, 5, -72, -1, -10, -76, 11, 11, 6, 85, 5, -72, -1, -28, -76, 12, 12, 6, 85, 5, -72, -1, -10, +64, 11, 15, 15, 6, 85, 5, 4, 16, 16, 6, 85, 5, -72, -1, -64, 64, 19, 36, 37, 52, 48, 5, 1, 0, +5, 16, 5, 32, 5, 3, 5, 49, -33, 36, 1, 36, -72, -1, -64, 64, 22, 30, 35, 52, 48, 36, 1, 36, 12, +37, 24, 8, 15, 16, 2, 85, 24, 18, 13, 13, 2, 85, 24, -72, -1, -12, 64, 34, 11, 12, 2, 85, 24, 32, +11, 11, 6, 85, 24, 28, 12, 12, 6, 85, 24, 20, 13, 13, 6, 85, 79, 24, 95, 24, -33, 24, 3, 24, -92, +19, -102, 35, 16, -10, -10, 93, 43, 43, 43, 43, 43, 43, -19, 16, 113, 43, 93, -12, 93, 93, 43, 43, 43, 43, +43, -3, 17, 57, 47, 93, 113, 43, 43, 43, 43, 43, 43, 43, -3, 60, 0, 63, 63, 60, 16, -19, 16, -19, 63, +-19, 18, 57, 47, -19, 49, 48, 1, 93, 1, 17, 51, 50, 22, 21, 20, 6, 35, 33, 17, 33, 17, 20, 6, 6, +35, 34, 39, 53, 22, 51, 50, 54, 53, 17, 1, 51, 50, 54, 53, 52, 38, 35, 35, 4, 68, -27, -36, -13, -60, +-30, -2, 62, -2, 13, 39, 111, 104, 29, 111, 71, 40, 63, 40, 3, 91, -67, -84, -110, 107, -70, -42, 4, 38, -2, +97, -84, -103, -128, -62, 3, -111, -3, -17, -81, -112, 71, 6, -109, 10, 78, -109, 2, -68, -4, 110, 83, 90, 70, 107, +0, 0, 2, 0, -125, 0, 0, 6, 57, 4, 38, 0, 18, 0, 27, 1, 22, 64, 40, 21, 3, 21, 5, 2, 1, +15, 43, 26, 10, 10, 8, 17, 14, 6, 19, 43, 11, 8, 10, 17, 8, 37, 0, 27, 18, 18, 19, 28, 16, 16, +2, 85, 19, 20, 13, 13, 2, 85, 19, -72, -1, -14, 64, 11, 12, 12, 6, 85, 19, 10, 13, 13, 6, 85, 19, +-72, -1, -12, 64, 21, 15, 15, 6, 85, 19, 25, 16, 16, 6, 85, 15, 19, 47, 19, 2, 19, 19, 12, 23, 36, +4, -72, -1, -8, -76, 11, 11, 6, 85, 4, -72, -1, -28, -76, 12, 12, 6, 85, 4, -72, -1, -12, -76, 15, 15, +6, 85, 4, -72, -1, -64, 64, 17, 36, 37, 52, 48, 4, 1, 0, 4, 32, 4, 2, 4, 49, -33, 29, 1, 29, +-72, -1, -64, 64, 11, 30, 35, 52, 48, 29, 1, 29, 14, 11, 37, 12, -72, -1, -8, 64, 17, 16, 16, 2, 85, +12, 4, 11, 12, 2, 85, 12, 4, 12, 12, 6, 85, 12, -72, -1, -4, -76, 13, 13, 6, 85, 12, -72, -1, -12, +-76, 15, 15, 6, 85, 12, -72, -1, -12, -76, 16, 16, 6, 85, 12, -72, -1, -64, 64, 18, 51, 54, 52, -16, 12, +1, 0, 12, 32, 12, -48, 12, -32, 12, 4, 12, 78, 28, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, -3, +60, 16, 113, 43, 93, -10, 93, 93, 43, 43, 43, 43, -19, 18, 57, 47, 93, 43, 43, 43, 43, 43, 43, 60, 18, +57, 57, -3, 60, 0, 63, 60, -19, 63, 60, 18, 57, 47, 60, -3, 60, 49, 48, 1, 93, 1, 51, 50, 22, 21, +20, 6, 35, 33, 17, 33, 17, 35, 17, 51, 17, 33, 17, 51, 17, 51, 50, 54, 53, 52, 38, 35, 35, 3, -123, +-27, -34, -15, -54, -36, -2, 62, -2, 102, -76, -76, 1, -102, -76, -67, -83, -112, 107, -70, -43, 2, 108, -90, -111, -127, +-76, 1, -41, -2, 41, 4, 38, -2, 70, 1, -70, -4, 103, 79, 84, 66, 101, 0, 1, 0, 0, 0, 0, 3, -24, +5, -70, 0, 27, 1, 30, 64, 18, 3, 12, 20, 12, 37, 8, 53, 8, 70, 8, 5, 122, 18, -118, 18, 2, 4, +27, -72, -1, -64, 64, 50, 30, 43, 52, 27, -44, 5, 26, 26, 10, 1, 0, 19, 28, 10, 7, 15, 24, 10, 4, +32, 27, 1, 27, 16, 37, 29, 64, 11, 11, 2, 85, 29, 64, 16, 16, 2, 85, 13, 40, 16, 16, 2, 85, 13, +20, 14, 14, 2, 85, 13, -72, -1, -20, 64, 17, 13, 13, 2, 85, 13, 4, 12, 12, 2, 85, 13, 26, 11, 11, +2, 85, 13, -72, -1, -10, 64, 30, 11, 13, 6, 85, 13, 10, 15, 15, 6, 85, 13, 22, 16, 16, 6, 85, 13, +64, 51, 54, 52, -1, 13, 1, -64, 13, 1, 13, 78, 29, -72, -1, -64, 64, 24, 52, 54, 52, -80, 29, -16, 29, +2, 112, 29, -96, 29, -80, 29, -1, 29, 4, 29, 7, 2, 23, 37, 1, 24, -72, -1, -6, -76, 16, 16, 2, 85, +24, -72, -1, -6, 64, 23, 14, 14, 2, 85, 24, 4, 12, 12, 2, 85, 24, 8, 11, 11, 2, 85, 24, 6, 11, +11, 6, 85, 24, -72, -1, -6, -76, 15, 15, 6, 85, 24, -72, -1, -64, 64, 18, 51, 54, 52, -16, 24, 1, 0, +24, 32, 24, -48, 24, -32, 24, 4, 24, 78, 28, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 60, -3, 60, +60, 16, 93, 113, 43, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 47, 93, 47, 0, 63, +60, 63, -19, 63, 18, 57, 47, 60, -3, 43, 60, 49, 48, 1, 93, 0, 93, 19, 53, 51, 21, 33, 21, 33, 17, +54, 54, 51, 50, 22, 21, 17, 35, 17, 52, 38, 35, 34, 6, 21, 17, 35, 17, 35, 39, -121, -77, 1, 87, -2, +-87, 61, -95, 99, -81, -66, -76, 113, 113, 99, -75, -77, -122, 1, 5, 56, -126, -126, 119, -2, -22, 74, 73, -72, -27, +-3, 95, 2, -95, -127, -127, -118, -44, -3, -69, 4, -63, 119, 0, -1, -1, 0, -122, 0, 0, 3, -112, 5, -62, 2, +38, 2, 100, 0, 0, 1, 6, 0, -115, 120, 0, 0, 11, -78, 1, 1, 30, -71, 2, 34, 0, 41, 0, 43, 0, +-1, -1, 0, 33, -2, 81, 3, -18, 5, -72, 2, 38, 0, 92, 0, 0, 1, 7, 0, -39, 0, -73, 0, 0, 0, +22, 64, 10, 1, 0, 34, 28, 11, 19, 65, 1, 1, 31, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, 0, 1, +0, -120, -2, -46, 3, -29, 4, 38, 0, 11, 1, 62, 64, 14, 9, 6, 6, 2, 14, 7, 43, 4, 4, 11, 10, +0, 43, 3, -72, -1, -6, -76, 10, 13, 2, 85, 3, -72, -1, -4, -76, 12, 12, 6, 85, 3, -72, -1, -8, -76, +13, 13, 6, 85, 3, -72, -1, -16, 64, 23, 15, 16, 6, 85, 95, 3, 111, 3, 127, 3, 3, 3, 3, 4, 8, +37, 13, 64, 11, 11, 2, 85, 11, -72, -1, -15, 64, 11, 16, 16, 2, 85, 11, 22, 14, 14, 2, 85, 11, -72, +-1, -16, 64, 17, 13, 13, 2, 85, 11, 10, 12, 12, 2, 85, 11, 38, 11, 11, 2, 85, 11, -72, -1, -9, -76, +11, 11, 6, 85, 11, -72, -1, -11, -76, 12, 12, 6, 85, 11, -72, -1, -8, 64, 30, 13, 13, 6, 85, 11, 8, +15, 15, 6, 85, 11, 22, 16, 16, 6, 85, 11, 64, 51, 54, 52, -1, 11, 1, -1, 11, 1, 11, 78, 13, -72, +-1, -64, 64, 21, 52, 54, 52, -80, 13, -16, 13, 2, 112, 13, -96, 13, -80, 13, -64, 13, 4, 13, 7, 37, 4, +-72, -1, -10, -76, 17, 17, 2, 85, 4, -72, -1, -6, -76, 16, 16, 2, 85, 4, -72, -1, -6, 64, 23, 14, 14, +2, 85, 4, 4, 12, 12, 2, 85, 4, 10, 11, 11, 2, 85, 4, 4, 11, 11, 6, 85, 4, -72, -1, -8, -76, +15, 15, 6, 85, 4, -72, -1, -64, 64, 18, 51, 54, 52, -16, 4, 1, 0, 4, 32, 4, -48, 4, -32, 4, 4, +4, 78, 12, 16, -10, 93, 113, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, 93, 113, 43, -10, 93, 113, 43, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 18, 57, 47, 93, 43, 43, 43, 43, -19, 0, 63, 60, 16, -19, +63, 63, 60, 49, 48, 33, 17, 35, 17, 33, 17, 51, 17, 33, 17, 51, 17, 2, -128, -107, -2, -99, -76, 1, -13, +-76, -2, -46, 1, 46, 4, 38, -4, 110, 3, -110, -5, -38, 0, 0, 1, 0, -95, 0, 0, 3, -84, 7, 80, 0, +7, 0, -116, 64, 46, 1, 4, 30, 7, 2, 6, 8, 0, 30, 3, 22, 15, 15, 2, 85, 3, 18, 12, 12, 2, +85, 3, 9, 11, 11, 6, 85, 3, 19, 12, 13, 6, 85, 3, 30, 15, 15, 6, 85, 3, 3, 8, 9, 5, 32, +6, -72, -1, -28, -76, 16, 16, 2, 85, 6, -72, -1, -12, -76, 15, 15, 2, 85, 6, -72, -1, -6, -76, 13, 13, +2, 85, 6, -72, -1, -2, -76, 12, 12, 2, 85, 6, -72, -1, -3, -76, 15, 16, 6, 85, 6, -72, -1, -1, -76, +13, 13, 6, 85, 6, -72, -1, -6, -74, 12, 12, 6, 85, 6, 57, 8, 16, -10, 43, 43, 43, 43, 43, 43, 43, +-19, 17, 18, 57, 47, 43, 43, 43, 43, 43, -19, 0, 63, 63, -19, 47, 49, 48, 1, 17, 51, 17, 33, 17, 35, +17, 2, -1, -83, -3, -73, -62, 5, -70, 1, -106, -3, -67, -6, -13, 5, -70, 0, 1, 0, -120, 0, 0, 3, 12, +5, -68, 0, 7, 0, -105, 64, 35, 1, 0, 4, 43, 7, 6, 6, 10, 0, 37, 3, 22, 15, 15, 2, 85, 3, +12, 12, 12, 2, 85, 3, 10, 11, 11, 6, 85, 3, 20, 12, 13, 6, 85, 3, -72, -1, -25, -76, 15, 15, 6, +85, 3, -72, -1, -13, 64, 14, 16, 16, 6, 85, 32, 3, 1, 3, 3, 8, 9, 5, 37, 6, -72, -1, -10, -76, +17, 17, 2, 85, 6, -72, -1, -6, 64, 23, 14, 14, 2, 85, 6, 4, 12, 12, 2, 85, 6, 10, 11, 11, 2, +85, 6, 2, 12, 12, 6, 85, 6, -72, -1, -4, -76, 15, 15, 6, 85, 6, -72, -1, -13, -74, 16, 16, 6, 85, +6, 69, 8, 16, -10, 43, 43, 43, 43, 43, 43, 43, -19, 17, 18, 57, 47, 93, 43, 43, 43, 43, 43, 43, -19, +0, 63, 63, -19, 63, 49, 48, 1, 17, 51, 17, 33, 17, 35, 17, 2, 119, -107, -2, 48, -76, 4, 38, 1, -106, +-3, -43, -4, 111, 4, 38, 0, 0, 1, 0, 65, 1, -54, 7, -64, 2, 91, 0, 3, 0, 20, 64, 9, 1, 30, +0, 2, -85, 5, 0, -85, 4, 16, -26, 16, -26, 0, 47, -19, 49, 48, 19, 53, 33, 21, 65, 7, 127, 1, -54, +-111, -111, 0, 0, 4, 0, -96, 0, 0, 8, 64, 5, -70, 0, 9, 0, 21, 0, 33, 0, 37, 1, 58, 64, 24, +39, 1, 40, 6, 47, 39, -118, 1, -122, 6, -86, 11, -93, 14, -86, 21, 8, 7, 24, 9, 22, 2, 85, 2, -72, +-1, -24, 64, 37, 9, 22, 2, 85, 55, 2, 102, 2, 117, 2, -123, 2, -113, 7, 5, 56, 8, 1, 7, 6, 6, +-70, 2, 1, 20, 2, 2, 1, 2, 7, 6, 3, 1, 2, 31, 42, 13, -72, 1, 102, 64, 40, 25, 42, 19, 77, +35, 34, 53, 36, 37, 117, 8, 8, 6, 8, 1, 6, 2, 8, 2, 3, 32, 5, 22, 16, 16, 2, 85, 5, 4, +15, 15, 2, 85, 5, 10, 13, 13, 2, 85, 5, -72, -1, -32, 64, 16, 12, 12, 2, 85, 5, 5, 8, 10, 36, +-59, 16, 37, -59, 22, 94, 10, -72, 1, 98, 64, 23, 28, 94, 16, 6, 11, 12, 2, 85, 16, 62, 39, 7, 8, +32, 9, 9, 0, 28, 16, 16, 2, 85, 0, -72, -1, -12, -76, 15, 15, 2, 85, 0, -72, -1, -14, -76, 13, 13, +2, 85, 0, -72, -1, -6, -74, 11, 12, 2, 85, 0, -7, 38, 16, -10, 43, 43, 43, 43, 60, 16, -3, 60, 16, +-10, 43, -19, -3, -19, -28, 16, -28, 17, 18, 57, 47, 43, 43, 43, 43, -3, 60, 17, 18, 57, 57, 0, 63, 60, +16, -12, 60, -3, 60, -2, -19, -3, -19, 63, 60, 18, 57, 57, -121, 5, 46, 43, -121, 125, -60, 49, 48, 24, 67, +121, 64, 42, 11, 33, 26, 18, 28, 31, 1, 24, 20, 22, 31, 0, 30, 14, 28, 31, 1, 32, 12, 22, 31, 0, +27, 17, 25, 31, 0, 23, 21, 25, 31, 0, 29, 15, 31, 31, 1, 33, 11, 31, 31, 1, 0, 43, 43, 43, 43, +1, 43, 43, 43, 43, -127, 0, 93, 43, 43, 1, 93, 19, 51, 1, 17, 51, 17, 35, 1, 17, 35, 1, 52, 54, +51, 50, 22, 21, 20, 6, 35, 34, 38, 55, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 3, 33, 21, 33, +-96, -61, 2, -51, -71, -62, -3, 47, -74, 4, -49, -57, -92, -93, -61, -55, -91, -114, -43, -81, 107, 78, 73, 113, 117, +70, 75, 109, -100, 2, -87, -3, 87, 5, -70, -5, -112, 4, 112, -6, 70, 4, 107, -5, -107, 3, 17, -79, -46, -40, +-73, -71, -40, -61, -44, -122, -120, -125, -123, -116, 125, -126, -3, 126, -108, 0, 0, 1, 0, 45, 0, 0, 5, 89, 4, +38, 0, 11, 0, -56, 64, 22, 15, 13, 47, 13, 2, 10, 10, 2, 10, 8, 0, 4, 43, 5, 6, 11, 37, 9, +0, 37, 2, 9, -72, -1, -24, -76, 16, 16, 2, 85, 9, -72, -1, -8, -76, 13, 13, 2, 85, 9, -72, -1, -14, +-76, 12, 12, 2, 85, 9, -72, -1, -19, -76, 12, 12, 6, 85, 9, -72, -1, -4, 64, 20, 13, 13, 6, 85, 9, +10, 15, 15, 6, 85, 9, 38, 16, 16, 6, 85, 9, 66, 6, 2, -72, -1, -24, -76, 15, 16, 2, 85, 2, -72, +-1, -12, 64, 11, 13, 13, 2, 85, 2, 10, 11, 11, 2, 85, 2, -72, -1, -18, 64, 11, 11, 11, 6, 85, 2, +8, 12, 12, 6, 85, 2, -72, -1, -8, -76, 13, 13, 6, 85, 2, -72, -1, -22, -76, 15, 15, 6, 85, 2, -72, +-1, -32, 64, 13, 16, 16, 6, 85, 2, 66, 5, 6, -60, 13, 5, 124, 12, 16, -26, 16, -26, 16, -28, 43, 43, +43, 43, 43, 43, 43, 43, 16, -28, 43, 43, 43, 43, 43, 43, 43, 16, -19, 16, -19, 0, 63, -3, 60, 60, 63, +63, 49, 48, 1, 93, 1, 17, 35, 17, 33, 53, 33, 21, 35, 17, 35, 17, 1, -7, -76, -2, -24, 5, 44, -14, +-76, 3, -108, -4, 108, 3, -108, -110, -110, -4, 108, 3, -108, 0, 0, 2, 1, 1, -2, 82, 1, -87, -1, -50, 0, +14, 0, 29, 0, 49, -71, 0, 0, 2, -45, -73, 8, 64, 13, 23, 52, 8, 8, 15, -67, 2, -45, 0, 23, 2, +-60, 0, 19, 0, 4, 2, -45, -74, 27, 12, 64, 26, 27, 52, 12, 47, 43, 60, -3, 60, 0, 63, -3, 50, 47, +43, -3, 49, 48, 5, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 23, 50, 22, 22, 21, 20, +6, 6, 35, 34, 38, 38, 53, 52, 54, 1, 85, 24, 38, 22, 22, 38, 24, 24, 38, 22, 43, 41, 24, 38, 22, +22, 38, 24, 24, 38, 22, 48, 50, 22, 38, 24, 24, 37, 23, 23, 37, 24, 31, 53, -44, 22, 38, 24, 24, 37, +23, 23, 37, 24, 36, 48, 0, 5, 0, 30, -2, 82, 2, -116, -1, -50, 0, 14, 0, 29, 0, 42, 0, 55, 0, +70, 0, 99, -78, 30, 15, 0, -72, 2, -45, 64, 11, 37, 23, 8, 64, 13, 23, 52, 8, 8, 56, 43, -67, 2, +-45, 0, 64, 0, 49, 2, -60, 0, 46, 2, -45, -78, 53, 53, 12, -72, 2, -45, -76, 4, -27, 27, 60, 33, -72, +2, -45, -77, 68, 40, -27, 19, -72, 2, -45, 64, 9, 27, 64, 26, 27, 52, 27, 27, 72, 71, 17, 18, 57, 47, +43, -3, -2, 60, -3, 60, 16, -2, -3, 57, 47, -19, 0, 63, 60, -3, 60, 50, 47, 43, 60, 60, -3, 60, 60, +49, 48, 23, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 33, 50, 22, 22, 21, 20, 6, 6, +35, 34, 38, 38, 53, 52, 54, 33, 50, 22, 21, 20, 6, 6, 35, 34, 38, 53, 52, 54, 5, 50, 22, 21, 20, +6, 35, 34, 38, 38, 53, 52, 54, 33, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 114, 24, +37, 23, 23, 37, 24, 24, 38, 22, 43, 1, 12, 22, 37, 25, 22, 38, 24, 24, 38, 22, 48, 1, 7, 41, 43, +22, 38, 24, 35, 49, 48, -2, -50, 31, 53, 48, 36, 24, 37, 23, 44, 1, 126, 22, 37, 25, 22, 38, 24, 21, +37, 26, 48, 50, 22, 38, 24, 24, 37, 23, 23, 37, 24, 31, 53, 19, 39, 26, 24, 37, 23, 23, 37, 24, 36, +48, 53, 31, 24, 37, 23, 49, 35, 36, 48, -44, 43, 41, 35, 49, 23, 37, 24, 31, 53, 19, 39, 26, 24, 37, +23, 20, 38, 26, 36, 48, 0, 3, 0, 49, -2, 82, 2, 121, -1, -50, 0, 12, 0, 16, 0, 31, 0, 80, -76, +16, 100, 14, 14, 0, -72, 2, -45, -73, 6, 64, 13, 23, 52, 6, 6, 17, -70, 2, -45, 0, 24, 2, -60, -74, +14, 14, 15, 85, 9, 21, 3, -72, 2, -45, 64, 16, 28, 95, 9, 1, 127, 9, 1, 9, 64, 23, 25, 52, 9, +9, 33, 32, 17, 18, 57, 47, 43, 93, 114, 60, -3, 60, 16, -2, 50, 47, 0, 63, -3, 50, 47, 43, -3, 50, +47, -19, 49, 48, 5, 50, 22, 21, 20, 6, 35, 34, 38, 53, 52, 54, 54, 5, 53, 33, 21, 23, 50, 22, 22, +21, 20, 6, 35, 34, 38, 38, 53, 52, 54, 54, 2, 37, 40, 44, 44, 40, 36, 48, 22, 38, -2, 36, 1, 80, +-92, 21, 37, 26, 44, 40, 22, 37, 25, 19, 39, 50, 53, 31, 31, 53, 49, 35, 24, 38, 22, 114, 104, 104, 98, +19, 39, 26, 31, 53, 20, 38, 26, 22, 37, 25, 0, 3, 0, 49, -2, 82, 2, 121, -1, -50, 0, 12, 0, 20, +0, 35, 0, 108, 64, 12, 32, 20, 1, 20, 20, 28, 14, 19, 100, 16, 16, 0, -72, 2, -45, -73, 6, 64, 13, +23, 52, 6, 6, 21, -67, 2, -45, 0, 28, 2, -60, 0, 25, 0, 3, 2, -45, 64, 34, 32, 9, 85, 18, 15, +117, 14, 117, 19, 117, 47, 18, 63, 18, 2, 18, 64, 32, 34, 52, 18, 64, 45, 47, 52, 18, 64, 63, 67, 52, +18, 18, 37, 36, 17, 18, 57, 47, 43, 43, 43, 113, -12, -3, -28, 16, -2, 60, -3, 60, 0, 63, -3, 50, 47, +43, -3, 50, 47, -3, 60, 17, 57, 47, 113, 49, 48, 5, 50, 22, 21, 20, 6, 35, 34, 38, 53, 52, 54, 54, +1, 53, 35, 53, 33, 21, 35, 21, 37, 50, 22, 22, 21, 20, 6, 35, 34, 38, 38, 53, 52, 54, 54, 2, 37, +40, 44, 44, 40, 36, 48, 22, 38, -2, -107, 113, 1, 80, 107, 1, 15, 21, 37, 26, 44, 40, 22, 37, 25, 19, +39, 50, 53, 31, 31, 53, 49, 35, 24, 38, 22, -2, -6, -108, 104, 104, -108, 50, 19, 39, 26, 31, 53, 20, 38, +26, 22, 37, 25, 0, 1, 1, 1, -2, -113, 1, -87, -1, 55, 0, 14, 0, 20, -67, 0, 0, 2, -45, 0, 8, +0, 4, 2, -45, 0, 12, 47, -19, 0, 47, -3, 49, 48, 5, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, +53, 52, 54, 1, 85, 24, 38, 22, 22, 38, 24, 24, 38, 22, 43, -55, 22, 38, 24, 24, 37, 23, 23, 37, 24, +31, 53, 0, 0, 2, 0, 126, -2, -113, 2, 44, -1, 55, 0, 12, 0, 27, 0, 39, -79, 13, 0, -72, 2, -45, +-78, 20, 6, 16, -72, 2, -45, -78, 24, 106, 10, -72, 2, -45, -77, 3, 3, 29, 28, 17, 18, 57, 47, -19, -2, +-19, 0, 47, 60, -3, 60, 49, 48, 23, 50, 22, 21, 20, 6, 35, 34, 38, 38, 53, 52, 54, 33, 50, 22, 21, +20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 54, -46, 30, 54, 48, 36, 24, 38, 22, 48, 1, 42, 40, 44, 22, +38, 24, 22, 37, 25, 19, 39, -55, 43, 41, 35, 49, 23, 37, 24, 36, 48, 53, 31, 24, 37, 23, 20, 38, 26, +22, 37, 25, 0, 0, 3, 0, 126, -2, 82, 2, 44, -1, -50, 0, 12, 0, 27, 0, 42, 0, 72, -79, 13, 0, +-72, 2, -45, 64, 9, 20, 6, 64, 13, 23, 52, 6, 6, 28, -68, 2, -45, 0, 36, 2, -60, 0, 32, 2, -45, +-76, 40, 40, 3, 10, 16, -72, 2, -45, -78, 24, 106, 10, -72, 2, -45, -77, 3, 3, 44, 43, 17, 18, 57, 47, +-19, -2, -19, 17, 18, 57, 47, -19, 0, 63, -3, 50, 47, 43, 60, -3, 60, 49, 48, 23, 50, 22, 21, 20, 6, +35, 34, 38, 38, 53, 52, 54, 33, 50, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 54, 7, 50, 22, +22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, -46, 30, 54, 48, 36, 24, 38, 22, 48, 1, 42, 40, 44, +22, 38, 24, 22, 37, 25, 19, 39, 105, 24, 38, 22, 22, 38, 24, 24, 38, 22, 48, 50, 43, 41, 35, 49, 23, +37, 24, 36, 48, 53, 31, 24, 37, 23, 20, 38, 26, 22, 37, 25, -44, 22, 38, 24, 24, 37, 23, 23, 37, 24, +36, 48, 0, 1, 0, -116, -2, -59, 2, 30, -1, 45, 0, 3, 0, 15, -75, 1, 100, 0, 2, 2, 1, 47, 51, +47, 0, 47, -19, 49, 48, 19, 53, 33, 21, -116, 1, -110, -2, -59, 104, 104, 0, 1, 0, -116, -2, 82, 2, 30, +-1, 98, 0, 7, 0, 40, -75, 3, 100, 6, 2, -97, 0, -72, 2, -60, 64, 11, 5, 5, 6, 117, 1, 2, 2, +1, 1, 9, 8, 17, 18, 57, 47, 51, 47, 16, -3, 50, 47, 0, 63, -12, 60, -19, 49, 48, 1, 53, 35, 53, +33, 21, 35, 21, 1, 28, -112, 1, -110, -114, -2, 82, -88, 104, 104, -88, 0, 1, 1, 1, 4, -98, 1, -87, 5, +70, 0, 14, 0, 32, -71, 0, 0, 2, -45, -76, 16, 8, 1, 8, 4, -72, 2, -45, -73, 31, 12, 47, 12, -81, +12, 3, 12, 47, 113, -19, 0, 47, 93, -19, 49, 48, 1, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, +52, 54, 1, 85, 22, 37, 25, 22, 38, 24, 24, 37, 23, 48, 5, 70, 20, 38, 26, 24, 38, 22, 22, 38, 24, +35, 49, 0, 3, 0, 16, -2, 81, 2, -102, -1, -51, 0, 15, 0, 30, 0, 45, 0, 98, -71, 0, 16, 2, -45, +-77, 24, 24, 39, 0, -72, 2, -45, 64, 18, 8, 64, 53, 57, 52, 8, 64, 33, 37, 52, 8, 64, 9, 23, 52, +8, 8, 31, -70, 2, -45, 0, 39, -1, -64, -77, 9, 12, 52, 39, -70, 2, -60, 0, 35, 2, -45, -78, 43, -85, +20, -69, 2, -45, 0, 28, 0, 12, 2, -45, -75, 4, -85, 28, 28, 47, 46, 17, 18, 57, 47, -10, -19, 16, -3, +-10, -19, 0, 63, 43, -3, 50, 47, 43, 43, 43, -19, 18, 57, 47, -19, 49, 48, 23, 50, 22, 22, 21, 20, 6, +6, 35, 34, 38, 38, 53, 52, 54, 54, 5, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 5, +50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, 52, 54, 100, 22, 37, 25, 22, 38, 24, 24, 37, 23, 20, +38, 1, 11, 24, 38, 22, 22, 38, 24, 24, 38, 22, 48, 1, 21, 24, 37, 23, 23, 37, 24, 24, 38, 22, 48, +51, 19, 39, 26, 24, 37, 23, 23, 37, 24, 22, 37, 25, 108, 22, 38, 24, 24, 37, 23, 23, 37, 24, 36, 48, +104, 22, 38, 24, 24, 37, 23, 23, 37, 24, 36, 48, 0, 0, 1, 1, 1, 1, -18, 1, -87, 2, -106, 0, 12, +0, 26, -68, 0, 6, 2, -45, 0, 0, 0, 3, 2, -45, -75, 31, 10, 47, 10, 2, 10, 47, 113, -19, 0, 47, +-19, 49, 48, 1, 50, 22, 21, 20, 6, 35, 34, 38, 38, 53, 52, 54, 1, 85, 30, 54, 49, 35, 24, 38, 22, +43, 2, -106, 44, 40, 36, 48, 22, 37, 25, 31, 53, 0, 1, 1, 33, -2, 81, 1, -119, -1, -51, 0, 3, 0, +26, -71, 0, 0, -1, -64, -76, 13, 19, 52, 0, 3, -72, 2, -60, -78, 1, 100, 0, 47, -19, 0, 63, 47, 43, +49, 48, 5, 51, 17, 35, 1, 33, 104, 104, 51, -2, -124, 0, 0, 1, 0, 125, 3, -123, 2, -109, 4, 37, 0, +3, 0, 14, -75, 0, -7, 1, 3, -18, 0, 47, -19, 0, 47, -3, 49, 48, 19, 53, 33, 21, 125, 2, 22, 3, +-123, -96, -96, 0, 0, 1, 0, -116, 4, -29, 2, 30, 5, 75, 0, 3, 0, 14, -75, 0, 100, 1, 3, 110, 0, +47, -19, 0, 47, -3, 49, 48, 19, 53, 33, 21, -116, 1, -110, 4, -29, 104, 104, 0, 0, 1, 0, -46, -1, -20, +1, 97, 5, 1, 0, 3, 0, 27, -77, 1, 1, 0, 5, -72, 2, -56, -78, 3, 32, 0, -71, 2, -57, 0, 4, +16, -10, -3, -26, 0, 47, 51, 47, 49, 48, 23, 17, 51, 17, -46, -113, 20, 5, 21, -6, -21, 0, 1, 3, 11, +4, -98, 3, -77, 5, 71, 0, 12, 0, 20, -67, 0, 7, 2, -45, 0, 0, 0, 3, 2, -45, 0, 10, 47, -19, +0, 47, -19, 49, 48, 1, 50, 22, 21, 20, 6, 6, 35, 34, 38, 53, 52, 54, 3, 95, 41, 43, 18, 39, 27, +35, 49, 54, 5, 71, 53, 32, 22, 36, 26, 49, 35, 41, 44, 0, 1, -1, 4, 4, -98, -1, -84, 5, 71, 0, +12, 0, 20, -67, 0, 7, 2, -45, 0, 0, 0, 10, 2, -45, 0, 3, 47, -19, 0, 47, -19, 49, 48, 3, 50, +22, 21, 14, 2, 35, 34, 38, 53, 52, 54, -88, 40, 44, 1, 22, 37, 24, 36, 48, 53, 5, 71, 53, 32, 24, +37, 23, 49, 35, 41, 44, 0, 0, 2, 0, -71, 0, 0, 1, -122, 4, 38, 0, 3, 0, 7, 0, 26, 64, 12, +0, 60, 1, 5, 60, 4, 3, 7, 0, 7, 60, 4, 47, -19, 60, 16, 60, 0, 47, -19, 47, -19, 49, 48, 19, +53, 51, 21, 3, 53, 51, 21, -71, -51, -51, -51, 3, 89, -51, -51, -4, -89, -51, -51, 0, 1, 0, 105, 0, 0, +4, 74, 4, 37, 0, 21, 0, -23, 64, 122, 25, 8, 38, 12, 56, 1, 58, 2, 59, 8, 59, 9, 57, 12, 59, +21, 72, 1, 77, 2, 73, 8, 77, 9, 73, 12, 77, 21, 85, 3, 86, 9, 86, 12, 103, 3, 127, 8, 115, 20, +-116, 9, -126, 20, -128, 21, -89, 12, -40, 0, -41, 21, 26, 8, 2, 41, 19, 40, 21, 61, 2, 63, 21, -127, 9, +-113, 21, -90, 12, -38, 21, 9, 21, 12, 11, 11, 0, 2, 9, 10, 1, 1, 0, 11, 11, 32, 10, 1, 20, 10, +10, 1, 21, 12, 1, 9, 4, 10, 6, 5, 0, 1, 10, 17, 16, 11, 10, 6, 15, 16, 18, 4, 5, 7, 9, +2, 12, 21, 4, 17, 6, 1, -72, 2, 96, -73, -128, 0, 1, 0, 0, 16, 32, 17, -72, 2, -54, -74, 23, 11, +10, 5, 32, 10, 6, -71, 2, -55, 0, 22, 16, -10, 50, -19, 47, 51, 16, -10, -19, 51, 47, 93, -19, 17, 18, +23, 57, 51, 17, 51, 50, 17, 51, 0, 63, 60, 60, 60, 63, 60, 60, 60, 18, 23, 57, -121, 5, 46, 43, -121, +125, -60, 7, 14, 60, 60, -121, 14, 16, -60, 60, -79, 6, 2, 67, 84, 88, -75, 2, 24, 12, 17, 52, 12, -72, +-1, -24, -78, 12, 17, 52, 0, 43, 43, 89, 49, 48, 0, 93, 1, 93, 33, 35, 1, 6, 7, 3, 35, 19, 18, +55, 3, 51, 1, 54, 54, 55, 55, 51, 7, 6, 6, 7, 4, 74, -20, -2, 107, 94, 17, 43, -58, 43, 30, -78, +-9, -21, 1, 84, 62, 49, 14, 25, -58, 24, 16, 95, 117, 2, 61, 51, -101, -2, -111, 1, 111, 1, 0, 90, 1, +92, -2, 37, 41, 103, 118, -43, -37, -115, -75, 71, 0, 0, 1, 0, 50, 0, 0, 4, 41, 4, 49, 0, 18, 0, +118, 64, 44, 5, 16, 22, 16, 84, 16, 99, 16, -30, 16, 5, 0, 4, -7, 3, 10, 12, -7, 13, 12, -7, 13, +13, 10, -7, 15, 7, 5, 32, 0, 0, 1, 20, 12, 12, 6, 85, 1, 26, 13, 13, 6, 85, 1, -72, -1, -16, +64, 11, 15, 15, 6, 85, 1, 8, 16, 16, 6, 85, 1, -72, 2, -52, -76, 20, 12, 12, 13, 12, -72, -1, -64, +-75, 13, 17, 52, 12, 13, 4, -71, 2, -53, 0, 19, 16, -10, 50, 47, 43, 17, 51, 47, 16, -10, 43, 43, 43, +43, 50, 47, -19, 0, 63, -19, 51, 47, -19, 47, -19, 63, -3, 60, 49, 48, 1, 93, 37, 51, 21, 33, 53, 33, +17, 52, 38, 38, 35, 34, 7, 39, 54, 51, 32, 4, 21, 3, -128, -87, -4, 9, 2, -113, 66, -83, -73, 65, -120, +16, -121, -104, 1, 30, 1, 1, -96, -96, -96, 1, 106, -108, -107, 88, 14, -98, 22, -8, -4, 0, 0, 1, 0, 25, +0, 0, 2, -24, 4, 49, 0, 25, 0, -55, 64, 86, 3, 24, 18, 24, 35, 24, 47, 27, 56, 10, 52, 24, 75, +10, 89, 10, 106, 10, 123, 10, -123, 6, -112, 5, -87, 11, 13, 3, 4, 4, -70, 1, 2, 20, 1, 1, 2, 5, +7, 7, 35, 8, 10, 20, 8, 8, 10, 5, 4, 10, 8, 1, 12, -24, 0, 4, 16, 4, 2, 4, 4, 22, 8, +7, 2, 3, 10, 19, -7, 20, 7, 20, 17, -7, 22, 7, 5, 10, 12, 8, 19, -59, 20, 20, 7, 8, -72, -1, +-16, 64, 17, 8, 8, 4, 12, 32, 1, 3, -97, 2, -81, 2, -65, 2, 3, 2, 2, 1, -72, -1, -10, 64, 14, +12, 12, 6, 85, 1, 10, 15, 16, 6, 85, 47, 1, 1, 1, -71, 2, -56, 0, 27, 16, -10, 93, 43, 43, 50, +125, 47, 24, 93, 51, 16, -3, 50, 51, 47, 56, 51, 51, 47, -28, 17, 18, 57, 57, 0, 63, -19, 51, 63, -19, +63, 60, 60, 60, 124, 18, 57, 47, 93, 24, -19, 51, 17, 57, 18, 57, -121, 5, 46, 43, 14, 125, 16, -60, -121, +5, 46, 24, 43, 125, 16, -60, 49, 48, 1, 93, 1, 17, 19, 35, 3, 34, 7, 7, 35, 55, 54, 54, 51, 17, +52, 38, 38, 35, 34, 7, 39, 54, 51, 50, 22, 22, 2, -122, 98, -69, 73, 123, 82, 59, -61, 84, 75, -58, 73, +25, 86, 71, 61, 48, 14, 67, 97, -120, -112, 52, 2, -82, -2, -70, -2, -104, 1, 4, -107, 111, -92, -110, 91, 1, +23, 86, 89, 54, 10, -104, 22, 102, -107, 0, 1, 0, 45, 0, 0, 3, -28, 4, 37, 0, 7, 0, 81, 64, 16, +3, 10, 1, 5, -7, 6, 6, 4, 32, 1, 12, 11, 12, 6, 85, 1, -72, -1, -20, -76, 13, 13, 6, 85, 1, +-72, -1, -4, 64, 16, 15, 15, 6, 85, 1, 10, 16, 16, 6, 85, -97, 1, 1, 1, -96, 7, -72, 2, -52, -76, +9, 48, 6, 1, 6, -71, 2, -53, 0, 8, 16, -26, 93, 16, -10, -12, 93, 43, 43, 43, 43, -19, 0, 63, -3, +60, 63, 49, 48, 1, 35, 17, 35, 17, 33, 53, 33, 3, -28, -75, -66, -3, -68, 3, -73, 3, -123, -4, 123, 3, +-123, -96, 0, 2, 0, -106, 0, 0, 4, 64, 4, 49, 0, 14, 0, 18, 0, -118, 64, 31, 50, 3, 52, 4, 69, +3, 69, 4, 86, 3, 86, 4, 102, 4, 7, 14, -7, 0, 18, 7, 17, 10, 14, 12, -7, 0, 2, 7, 8, 32, +5, -72, -1, -20, 64, 11, 16, 16, 6, 85, 5, 16, 15, 15, 6, 85, 5, -72, -1, -16, -76, 12, 12, 6, 85, +5, -72, 2, -56, 64, 14, 20, 14, 14, 0, 0, 15, 32, 18, 42, 16, 16, 6, 85, 18, -72, -1, -18, -76, 15, +15, 6, 85, 18, -72, -1, -10, 64, 11, 13, 13, 6, 85, 18, 4, 12, 12, 6, 85, 18, -71, 2, -57, 0, 19, +16, -10, 43, 43, 43, 43, -19, 51, 47, 51, 47, 16, -10, 43, 43, 43, -19, 0, 63, 51, -3, 50, 63, 60, 47, +47, -19, 49, 48, 1, 93, 19, 54, 51, 32, 22, 21, 17, 35, 17, 52, 38, 38, 35, 34, 7, 19, 17, 35, 17, +-106, -75, -85, 1, 76, -2, -65, 74, -75, -83, -120, -89, -69, -65, 4, 18, 31, -10, -2, -3, -61, 2, 10, -97, -107, +77, 28, -2, -25, -3, -86, 2, 86, 0, 1, 0, -101, 0, 0, 1, 94, 4, 37, 0, 3, 0, 55, -76, 2, 10, +3, 6, 5, -72, 2, -56, -78, 0, 32, 3, -72, -1, -2, -76, 11, 11, 6, 85, 3, -72, -1, -2, 64, 11, 13, +13, 6, 85, 3, 20, 16, 16, 6, 85, 3, -71, 2, -57, 0, 4, 16, -10, 43, 43, 43, -3, -28, 0, 63, 63, +49, 48, 1, 17, 35, 17, 1, 94, -61, 4, 37, -5, -37, 4, 37, 0, 1, 0, 95, 0, 0, 2, -30, 4, 37, +0, 19, 0, 80, 64, 30, 15, 21, 32, 21, 2, 9, 10, 0, -24, 17, -7, 18, 6, 16, 16, 0, 17, 8, 32, +9, 9, 3, 32, 14, 14, 18, 15, 19, 1, 19, -72, 2, -52, 64, 11, 21, 18, 20, 12, 13, 6, 85, 32, 18, +1, 18, -71, 2, -59, 0, 20, 16, -26, 93, 43, 16, -26, 93, 17, 57, 47, -19, 57, 47, -19, 17, 18, 57, 47, +0, 63, -19, -19, 63, 49, 48, 1, 93, 1, 34, 6, 21, 20, 23, 22, 21, 21, 35, 53, 52, 39, 38, 53, 52, +55, 33, 53, 33, 2, -30, -103, -83, 9, 26, -64, 20, 7, -121, -2, -12, 2, -125, 3, -98, -81, -109, 29, 84, -14, +102, -109, -82, 106, -36, 74, 49, -91, 113, -96, 0, 0, 1, 0, -101, 0, 0, 4, 57, 4, 49, 0, 17, 0, 115, +64, 20, 99, 15, 115, 16, 2, 67, 15, 83, 15, 2, 1, 10, 10, 6, -7, 13, 7, 2, 32, 17, -72, -1, -20, +64, 11, 16, 16, 6, 85, 17, 16, 15, 15, 6, 85, 17, -72, -1, -16, -76, 12, 12, 6, 85, 17, -72, 2, -56, +64, 10, 19, 8, 32, 11, 42, 16, 16, 6, 85, 11, -72, -1, -18, -76, 15, 15, 6, 85, 11, -72, -1, -10, 64, +11, 13, 13, 6, 85, 11, 4, 12, 12, 6, 85, 11, -71, 2, -57, 0, 18, 16, -10, 43, 43, 43, 43, -19, 16, +-12, 43, 43, 43, -19, 0, 63, -19, 63, 60, 49, 48, 1, 93, 93, 33, 35, 17, 52, 38, 38, 35, 34, 7, 17, +35, 17, 54, 51, 50, 22, 22, 21, 4, 57, -65, 52, -100, -110, 85, 105, -65, -42, -77, -60, -17, 98, 2, 63, 117, +-122, 81, 14, -4, -125, 4, 14, 35, 115, -64, -84, 0, 0, 1, 0, -116, -1, -29, 4, 64, 4, 59, 0, 29, 0, +-100, 64, 41, 47, 31, 1, 107, 27, 123, 27, 2, 3, 18, 19, 18, 35, 18, 3, 70, 5, 86, 5, 107, 23, 123, +23, 4, 5, -7, 25, 11, 31, 14, 1, 14, 14, 12, -7, 17, 7, 0, 6, 15, 14, -72, -1, -16, 64, 23, 2, +15, 15, -97, 14, -81, 14, 2, 14, 14, 0, 9, 32, 21, 16, 16, 16, 6, 85, 47, 21, 1, 21, -72, 2, -56, +-77, 31, 1, 32, 0, -72, -1, -10, -76, 16, 16, 6, 85, 0, -72, -1, -17, -76, 15, 15, 6, 85, 0, -72, -1, +-12, -76, 13, 13, 6, 85, 0, -72, -1, -2, -76, 11, 11, 6, 85, 0, -71, 2, -57, 0, 30, 16, -10, 43, 43, +43, 43, -19, 16, -10, 93, 43, -19, 18, 57, 47, 93, 51, 47, 23, 56, 0, 63, 63, -3, 50, 47, 93, 63, -19, +93, 93, 49, 48, 1, 93, 93, 19, 51, 17, 20, 22, 51, 50, 54, 54, 53, 53, 52, 35, 34, 7, 39, 54, 51, +50, 22, 21, 21, 20, 6, 6, 35, 34, 38, 38, 53, -116, -65, -83, 107, 114, -123, 40, -121, 95, 79, 60, 108, -89, +-116, -112, 79, -33, -81, -102, -29, 90, 4, 37, -3, -39, -21, -106, 106, -86, -112, -121, -23, 106, 98, -78, -36, -44, 76, +-50, -24, -90, -104, -24, -48, 0, 1, 0, -101, 2, 0, 1, 94, 4, 37, 0, 3, 0, 56, -76, 2, 2, 3, 6, +5, -72, 2, -56, -78, 0, 32, 3, -72, -1, -2, -76, 11, 11, 6, 85, 3, -72, -1, -2, 64, 11, 13, 13, 6, +85, 3, 16, 16, 16, 6, 85, 3, -71, 2, -57, 0, 4, 16, -12, 43, 43, 43, -3, -26, 0, 63, 51, 47, 49, +48, 1, 17, 35, 17, 1, 94, -61, 4, 37, -3, -37, 2, 37, 0, 0, 1, 0, 40, -2, 104, 3, -126, 4, 49, +0, 14, 0, 94, -75, 43, 10, 59, 10, 2, 3, -70, -1, -16, 0, 4, -1, -16, 64, 19, 7, 14, 14, -7, 0, +6, 0, 12, -7, 2, 7, 14, 14, 0, 0, 15, 8, 32, 5, -72, -1, -14, 64, 23, 11, 12, 6, 85, 5, 10, +13, 13, 6, 85, 5, 22, 15, 15, 6, 85, 5, 32, 16, 16, 6, 85, 5, -71, 2, -56, 0, 16, 16, -10, 43, +43, 43, 43, -19, 17, 51, 47, 51, 47, 0, 63, -19, 51, 63, -19, 63, 49, 48, 56, 1, 56, 1, 93, 19, 54, +51, 32, 4, 17, 17, 35, 17, 52, 38, 38, 35, 34, 7, 40, -102, -128, 1, 42, 1, 22, -65, 89, -72, 122, 108, +-108, 4, 27, 22, -29, -2, -17, -4, 43, 3, -94, -83, -110, 66, 20, 0, 1, 0, 80, -1, -16, 3, 86, 4, 55, +0, 23, 0, 113, 64, 53, 74, 5, 74, 9, 92, 5, 92, 9, 89, 17, 89, 20, 6, 42, 5, 44, 9, 59, 5, +59, 9, 4, 1, -97, 0, 0, 3, -97, 22, 11, 12, -97, 13, 13, 10, -97, 15, 7, 1, 12, 1, 0, 0, 12, +63, 13, 1, 13, 13, 24, 7, 38, 18, -72, -1, -8, -76, 11, 13, 6, 85, 18, -72, -1, -8, -73, 15, 15, 6, +85, 32, 18, 1, 18, -71, 2, -58, 0, 25, 16, -10, 93, 43, 43, -19, 17, 51, 47, 93, 51, 60, 17, 51, 47, +47, 0, 63, -19, 51, 47, -19, 63, -19, 51, 47, -19, 49, 48, 1, 93, 93, 55, 55, 22, 51, 50, 54, 54, 53, +52, 38, 35, 34, 7, 39, 54, 51, 32, 0, 21, 20, 6, 6, 35, 34, 80, 26, 94, 99, 113, -102, 83, -75, -87, +100, 93, 26, 117, 92, 1, 10, 1, 43, -127, -10, -66, 93, 14, -84, 30, 93, -86, 111, -89, -46, 30, -84, 30, -2, +-54, -17, -100, -16, -106, 0, 1, 0, 60, 0, 0, 3, 70, 5, -70, 0, 22, 0, -97, 64, 28, 54, 6, 68, 6, +84, 6, 117, 6, -125, 6, 5, 10, 10, 20, -7, 0, 6, 21, 2, 8, 32, 11, 8, 11, 13, 6, 85, 11, -72, +-1, -25, -76, 15, 15, 6, 85, 11, -72, -1, -32, 64, 10, 16, 16, 6, 85, 11, 11, 20, 19, 32, 1, -72, -1, +-20, -76, 11, 11, 6, 85, 1, -72, -1, -24, -76, 12, 13, 6, 85, 1, -72, -1, -8, -76, 15, 15, 6, 85, 1, +-72, -1, -2, -76, 16, 16, 6, 85, 1, -72, 2, -54, -77, 24, 0, 32, 20, -72, -1, -10, 64, 25, 11, 11, 6, +85, 20, 25, 12, 13, 6, 85, 20, 25, 15, 15, 6, 85, 20, 34, 16, 16, 6, 85, 20, 20, 23, 17, 51, 47, +43, 43, 43, 43, -19, 16, -12, 43, 43, 43, 43, -19, 18, 57, 47, 43, 43, 43, -19, 0, 63, 63, -19, 63, 49, +48, 1, 93, 19, 33, 17, 20, 6, 7, 7, 6, 21, 21, 35, 53, 52, 54, 55, 55, 54, 54, 53, 53, 33, 17, +51, -6, 2, 76, 42, 52, 54, 81, -65, 51, 49, 60, 44, 25, -3, -75, -66, 4, 37, -2, -8, 112, -117, 71, 72, +109, 124, -86, -113, -127, -126, 63, 76, 56, 90, 71, -113, 2, 53, 0, 2, 0, -101, 0, 0, 4, 57, 4, 49, 0, +8, 0, 17, 0, 112, 64, 18, 67, 6, 83, 6, 102, 6, 3, 17, -7, 1, 10, 14, -7, 4, 7, 10, 32, 8, +-72, -1, -20, 64, 11, 16, 16, 6, 85, 8, 14, 15, 15, 6, 85, 8, -72, -1, -14, -76, 12, 12, 6, 85, 8, +-72, 2, -56, 64, 10, 19, 16, 32, 2, 60, 16, 16, 6, 85, 2, -72, -1, -18, -76, 15, 16, 6, 85, 2, -72, +-1, -12, 64, 11, 13, 13, 6, 85, 2, 4, 12, 12, 6, 85, 2, -71, 2, -57, 0, 18, 16, -10, 43, 43, 43, +43, -19, 16, -10, 43, 43, 43, -19, 0, 63, -19, 63, -19, 49, 48, 1, 93, 33, 33, 17, 54, 51, 50, 22, 22, +21, 3, 17, 52, 38, 38, 35, 34, 7, 17, 4, 57, -4, 98, -42, -77, -60, -17, 98, -65, 52, -100, -110, 85, 105, +4, 14, 35, 115, -64, -84, -2, 78, 1, -97, 117, -122, 81, 14, -3, 35, 0, 0, 1, 0, 80, 0, 0, 4, 62, +4, 49, 0, 26, 0, -59, 64, 22, 10, 4, 7, 8, 8, 21, 41, 4, 54, 21, 90, 4, 90, 5, 105, 5, 106, +18, 9, 0, 16, 3, -72, -1, -16, 64, 75, 12, 12, 15, 23, 3, 2, 2, 32, 1, 0, 20, 1, 1, 0, 21, +23, 23, 18, 11, 13, 6, 85, 23, 32, 24, 0, 20, 24, 24, 0, 0, 3, 21, 3, 24, 1, 19, -7, 6, 7, +2, 1, 6, 13, -7, 11, 11, 23, 24, 10, 0, 3, 2, 23, 21, 5, 10, 1, 1, 24, 30, 16, 16, 6, 85, +63, 24, 95, 24, 2, 24, 24, 15, 32, 10, -72, -1, -20, 64, 11, 16, 16, 6, 85, 10, 16, 15, 15, 6, 85, +10, -72, -1, -16, -76, 12, 12, 6, 85, 10, -71, 2, -56, 0, 28, 16, -10, 43, 43, 43, -19, 51, 47, 93, 43, +25, 51, 47, 24, 18, 23, 57, 0, 63, 60, 60, 16, -19, 63, 60, 63, -19, 17, 18, 23, 57, -121, 5, 46, 43, +43, 14, 125, 16, -60, -121, 5, 46, 24, 43, 14, 125, 16, -60, 1, 24, 17, 18, 57, 47, 0, 56, 1, 56, 49, +48, 1, 93, 19, 3, 51, 23, 54, 54, 51, 50, 22, 22, 21, 17, 33, 53, 33, 17, 52, 38, 38, 35, 34, 6, +3, 3, 35, 19, 54, -12, -92, -69, 78, 47, -56, 115, 122, -79, 80, -3, -35, 1, 98, 23, 95, 72, 112, -99, 55, +75, -63, 84, 12, 2, 106, 1, -69, -22, 103, -113, 125, -16, -15, -2, 45, -96, 1, 55, -80, -95, 101, -25, -2, -29, +-2, 119, 1, -98, 59, 0, 1, 0, -101, -2, 104, 1, 94, 4, 37, 0, 3, 0, 55, -76, 2, 14, 3, 6, 5, +-72, 2, -56, -78, 0, 32, 3, -72, -1, -2, -76, 11, 11, 6, 85, 3, -72, -1, -2, 64, 11, 13, 13, 6, 85, +3, 16, 16, 16, 6, 85, 3, -71, 2, -57, 0, 4, 16, -10, 43, 43, 43, -3, -26, 0, 63, 63, 49, 48, 1, +17, 35, 17, 1, 94, -61, 4, 37, -6, 67, 5, -67, 0, 1, 0, 60, 0, 0, 2, 60, 4, 49, 0, 17, 0, +108, 64, 35, 4, 15, 20, 15, 36, 15, 47, 19, 52, 15, 5, 2, -7, 1, 10, 10, -7, 11, 11, 8, -7, 13, +7, 11, 2, 2, 10, 16, 11, 1, 11, 11, 4, 32, 17, -72, -1, -17, 64, 17, 16, 16, 6, 85, 17, 7, 15, +15, 6, 85, 17, 14, 13, 13, 6, 85, 17, -72, -1, -17, 64, 12, 12, 12, 6, 85, 47, 17, -65, 17, -49, 17, +3, 17, -71, 2, -56, 0, 19, 16, -10, 93, 43, 43, 43, 43, -19, 51, 47, 93, 51, 51, 47, 47, 0, 63, -19, +51, 47, -19, 63, -19, 49, 48, 1, 93, 33, 33, 53, 33, 17, 52, 38, 38, 35, 34, 7, 39, 54, 51, 50, 22, +22, 21, 2, 60, -2, 0, 1, 65, 26, 85, 71, 61, 48, 14, 67, 97, -120, -112, 52, -96, 2, 8, 86, 89, 54, +10, -104, 22, 102, -107, -120, 0, 0, 2, 0, 90, -1, -31, 4, 62, 4, 66, 0, 13, 0, 25, 0, -33, 64, 42, +47, 27, 55, 24, 71, 24, 83, 2, 89, 5, 89, 9, 83, 12, 83, 16, 92, 18, 92, 22, 83, 24, -89, 9, -88, +13, -25, 1, -23, 6, 15, 17, -7, 11, 11, 23, -7, 3, 7, 20, 38, 7, -72, -1, -12, 64, 11, 16, 16, 2, +85, 7, 12, 15, 15, 2, 85, 7, -72, -1, -12, 64, 11, 14, 14, 2, 85, 7, 10, 13, 13, 2, 85, 7, -72, +-1, -10, 64, 11, 12, 12, 2, 85, 7, 0, 11, 11, 2, 85, 7, -72, -1, -26, -76, 11, 11, 6, 85, 7, -72, +-1, -16, -76, 13, 13, 6, 85, 7, -72, -1, -14, -76, 12, 12, 6, 85, 7, -72, -1, -8, -76, 15, 15, 6, 85, +7, -72, 2, -58, 64, 10, 27, 14, 38, 0, 10, 12, 15, 2, 85, 0, -72, -1, -10, 64, 29, 11, 11, 2, 85, +0, 14, 11, 11, 6, 85, 0, 14, 13, 13, 6, 85, 0, 12, 16, 16, 6, 85, 0, 20, 12, 12, 6, 85, 0, +-72, -1, -10, -76, 15, 15, 6, 85, 0, -71, 2, -59, 0, 26, 16, -10, 43, 43, 43, 43, 43, 43, 43, -19, 16, +-10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 0, 63, -19, 63, -19, 49, 48, 1, 93, 19, 52, 0, 51, +50, 22, 18, 21, 20, 6, 6, 35, 34, 0, 55, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 90, 1, 17, +-31, -122, -40, -108, 112, -30, -96, -31, -2, -17, -47, -104, -119, -108, -113, -102, -119, -111, -112, 2, 14, -2, 1, 54, 117, +-1, 0, -65, -99, -8, -104, 1, 49, -4, -68, -47, -30, -83, -64, -42, -25, 0, 0, 1, 0, 25, -1, -98, 3, -75, +4, 37, 0, 17, 0, -111, 64, 31, -121, 17, 1, 8, 0, 53, 13, 121, 0, 121, 3, 117, 12, 117, 13, -119, 0, +7, 27, 0, 24, 3, 59, 4, 105, 4, 4, 0, 3, 2, 2, -72, -1, -8, 64, 54, 15, 16, 6, 85, 2, 32, +1, 0, 20, 1, 1, 0, 3, 0, 2, 16, -7, 0, 15, 16, 15, 2, 15, 7, 2, 1, 6, 3, 3, 16, 3, +2, 0, 2, 1, 18, 12, 12, 6, 85, 1, 1, 8, 16, 15, 15, 31, 16, 1, 16, 16, 7, 32, 8, -71, 2, +-51, 0, 19, 16, -10, -19, 51, 47, 93, 51, 47, 17, 18, 57, 47, 43, 51, 51, 17, 51, 25, 17, 57, 47, 0, +24, 63, 60, 60, 47, 93, -3, 17, 57, 57, -121, 5, 46, 43, 43, -121, 14, 125, -60, 49, 48, 1, 93, 93, 0, +93, 37, 3, 51, 19, 54, 54, 53, 19, 51, 3, 14, 3, 4, 5, 39, 54, 1, 60, -72, -55, -99, -86, 86, 10, +-63, 10, 8, 19, 85, -92, -2, -61, -2, -38, 27, -77, -127, 3, -92, -4, -105, 67, -5, -66, 1, 109, -2, -25, -53, +-92, -59, -111, 120, 49, -90, 26, 0, 0, 1, 0, 110, -2, 104, 3, -9, 4, 49, 0, 25, 0, -110, 64, 9, 56, +22, 73, 22, 91, 22, 3, 15, 23, -72, -1, -16, -78, 2, 16, 21, -72, -1, -16, 64, 23, 2, 3, 108, 8, 8, +14, 26, 19, 14, 12, 12, 24, -7, 14, 7, 5, 5, 6, 6, 0, 20, 32, 17, -72, -1, -8, -76, 11, 12, 6, +85, 17, -72, -1, -4, 64, 17, 13, 13, 6, 85, 17, 20, 15, 15, 6, 85, 17, 35, 16, 16, 6, 85, 17, -72, +2, -56, 64, 22, 27, 0, 32, 12, 18, 11, 13, 6, 85, 12, 8, 15, 15, 6, 85, 12, 18, 16, 16, 6, 85, +12, -71, 2, -55, 0, 26, 16, -10, 43, 43, 43, -19, 16, -10, 43, 43, 43, 43, -19, 17, 57, 47, 51, 47, 0, +63, -19, 51, 47, 63, 17, 18, 57, 47, -19, 49, 48, 23, 56, 1, 23, 56, 93, 1, 17, 20, 51, 50, 55, 23, +6, 35, 34, 38, 53, 17, 54, 51, 50, 4, 17, 17, 35, 17, 52, 38, 38, 35, 34, 1, 38, 123, 50, 34, 21, +59, 76, -126, -109, -76, -63, -16, 1, 36, -66, 51, -96, -113, 98, 3, -127, -2, -25, 122, 12, -117, 25, -116, -117, 1, +-113, 53, -58, -2, -25, -4, 22, 3, -41, 111, -119, 92, 0, 0, 1, 0, 115, -1, -16, 4, 5, 4, 55, 0, 32, +0, -96, 64, 57, 77, 14, 75, 18, 122, 14, -117, 14, 4, 47, 14, 47, 18, 61, 14, 61, 18, 4, 24, 108, 29, +29, 2, 8, 11, -7, 10, 10, 13, -7, 8, 11, 0, 0, 19, -7, 2, 7, 11, 11, 10, 10, 32, 26, 26, 27, +27, 22, 16, 38, 5, 8, 16, 16, 6, 85, 5, -72, -1, -8, -76, 15, 15, 6, 85, 5, -72, -1, -8, -73, 11, +13, 6, 85, 32, 5, 1, 5, -67, 2, -58, 0, 34, 0, 22, 2, -49, 0, 32, -1, -8, 64, 17, 16, 16, 6, +85, 32, 14, 15, 15, 6, 85, 32, 14, 11, 13, 6, 85, 32, -71, 2, -55, 0, 33, 16, -12, 43, 43, 43, -19, +16, -12, 93, 43, 43, 43, -19, 17, 57, 47, 51, 47, 17, 51, 47, 51, 47, 0, 63, -19, 51, 47, 63, -19, 51, +47, -19, 17, 18, 57, 47, -19, 49, 48, 1, 93, 93, 19, 54, 51, 50, 0, 17, 16, 0, 33, 34, 39, 55, 22, +51, 50, 54, 53, 52, 38, 35, 34, 7, 21, 20, 51, 50, 55, 23, 6, 35, 34, 38, 53, 122, -83, -67, -23, 1, +56, -2, -64, -2, -30, -61, 113, 46, 98, -105, -85, -9, -62, -94, 84, 82, 123, 50, 34, 20, 58, 77, -126, -110, 4, +2, 53, -2, -18, -2, -4, -2, -1, -2, -48, 71, -98, 63, -61, -60, -84, -47, 19, -62, 123, 12, -117, 25, -115, -118, +0, 1, 0, 25, -2, 104, 3, 97, 4, 37, 0, 13, 0, -90, -71, 0, 3, -1, -20, 64, 65, 15, 16, 6, 85, +9, 3, 1, 87, 4, 104, 2, 102, 3, 102, 4, 120, 2, 118, 4, -23, 3, -7, 3, 8, 25, 1, 20, 11, 38, +11, 47, 15, 54, 11, 72, 2, 71, 4, 88, 2, 8, 12, 16, 1, 4, 108, 0, 12, 16, 12, 2, 12, 12, 2, +0, 14, 9, 8, 3, 2, 6, 4, 12, 32, 1, -72, -1, -8, 64, 26, 11, 13, 6, 85, 1, 36, 15, 16, 6, +85, -113, 1, 1, 31, 1, 47, 1, 111, 1, 127, 1, 4, 1, 1, 9, 2, -72, -1, -16, 64, 16, 3, 32, 15, +2, 63, 2, 95, 2, 127, 2, 4, 2, 2, 8, 32, 9, -71, 2, -58, 0, 15, 16, -10, -19, 51, 47, 93, -19, +56, 18, 57, 47, 93, 113, 43, 43, -19, 57, 0, 63, 60, 60, 60, 63, 18, 57, 47, 93, -19, 51, 56, 49, 48, +1, 93, 93, 113, 43, 1, 17, 1, 51, 1, 54, 54, 55, 19, 51, 3, 2, 5, 17, 1, 89, -2, -64, -53, 1, +0, 79, 64, 10, 29, -57, 33, 29, -2, -14, -2, 104, 3, 41, 2, -108, -3, -17, 47, 115, 97, 1, 14, -2, -51, +-2, -14, 105, -4, -19, 0, 1, 0, 10, 0, 0, 3, 102, 4, 37, 0, 17, 0, -101, -71, 0, 10, -1, -20, 64, +28, 11, 12, 6, 85, 11, 20, 13, 16, 6, 85, 7, 13, 47, 19, 58, 5, 58, 10, 72, 10, 118, 4, -124, 4, +7, 12, 16, 5, -70, -1, -16, 0, 13, -1, -16, 64, 30, 5, 13, 5, 13, 6, 12, 10, 6, 12, 12, -70, 11, +10, 20, 11, 11, 10, 6, 10, -7, 7, 10, 17, 12, 11, 6, 9, 9, 12, 11, -72, -1, -16, 64, 22, 15, 11, +47, 11, 2, 11, 11, 0, 10, 6, 6, 7, 7, 17, 10, 16, 16, 6, 85, 17, 32, 0, -71, 2, -58, 0, 19, +16, -10, -19, 43, 51, 47, 60, 17, 51, 17, 51, 47, 93, 56, 51, 51, 47, 0, 63, 60, 60, 63, -3, 57, -121, +5, 46, 43, -121, 125, -60, 1, 17, 18, 57, 57, 0, 57, 57, 56, 1, 56, 56, 49, 48, 1, 93, 43, 43, 1, +7, 14, 2, 7, 19, 21, 33, 53, 33, 1, 51, 1, 54, 54, 53, 55, 3, 102, 10, 5, 33, 106, 116, -29, -3, +4, 2, 21, -3, -74, -39, 1, 39, 75, 64, 10, 4, 37, -65, 95, 117, 124, 67, -2, -98, 113, -96, 3, -123, -2, +41, 55, 125, 115, -80, 0, 0, 2, 0, -106, -2, 104, 3, -8, 4, 37, 0, 20, 0, 24, 0, -97, 64, 25, 16, +26, 117, 6, -125, 6, 3, 22, 21, 14, 10, 10, 20, -7, 0, 6, 8, 32, 11, 14, 16, 16, 6, 85, 11, -72, +-1, -12, 64, 28, 15, 15, 6, 85, 11, 12, 13, 13, 6, 85, 11, 22, 12, 12, 6, 85, 11, 11, 0, 18, 32, +2, 6, 16, 16, 6, 85, 2, -72, -1, -11, -76, 15, 15, 6, 85, 2, -72, -1, -11, -73, 11, 12, 6, 85, 16, +2, 1, 2, -69, 2, -54, 0, 26, 0, 23, 2, -29, -78, 22, 22, 0, -72, -1, -23, -76, 15, 16, 6, 85, 0, +-72, -1, -13, -76, 13, 13, 6, 85, 0, -72, -1, -11, -76, 12, 12, 6, 85, 0, -71, 2, -57, 0, 25, 16, -10, +43, 43, 43, 50, 47, -19, 16, -10, 93, 43, 43, 43, -19, 18, 57, 47, 43, 43, 43, 43, -19, 0, 63, -19, 63, +63, 47, 49, 48, 1, 93, 19, 33, 17, 20, 6, 7, 7, 6, 21, 21, 35, 53, 52, 54, 55, 55, 54, 54, 53, +53, 33, 19, 17, 51, 17, -106, 3, 98, 41, 53, 53, 82, -65, 39, 62, 59, 43, 27, -3, 92, 16, -73, 4, 37, +-2, -8, 113, -119, 72, 72, 110, 123, -86, -113, 109, -121, 78, 76, 55, 89, 73, -113, -6, -29, 3, -18, -4, 18, 0, +0, 1, 0, 40, 0, 0, 3, -126, 4, 49, 0, 14, 0, 104, -73, 43, 10, 59, 10, 73, 10, 3, 3, -70, -1, +-16, 0, 4, -1, -16, 64, 21, 7, 10, 14, -7, 0, 6, 0, 12, -7, 2, 7, 14, 14, 47, 0, 1, 0, 0, +8, 32, 5, -72, -1, -14, 64, 11, 12, 12, 6, 85, 5, 8, 13, 13, 6, 85, 5, -72, -1, -35, -76, 15, 15, +6, 85, 5, -72, -1, -32, -76, 16, 16, 6, 85, 5, -71, 2, -56, 0, 16, 16, -10, 43, 43, 43, 43, -19, 51, +47, 93, 51, 47, 0, 63, -19, 51, 63, -19, 63, 49, 48, 56, 1, 56, 1, 93, 19, 54, 51, 32, 22, 21, 17, +35, 17, 52, 38, 38, 35, 34, 7, 40, -102, -127, 1, 66, -3, -66, 62, -80, -98, 107, -107, 4, 27, 22, -7, -5, +-3, -61, 2, 10, -111, -108, 92, 20, 0, 1, 0, 100, -1, -29, 5, 42, 4, 37, 0, 33, 0, -111, 64, 70, 7, +15, 8, 19, 22, 15, 28, 19, 25, 26, 43, 31, 47, 35, 49, 15, 53, 16, 61, 19, 61, 26, 49, 30, 72, 20, +72, 25, 89, 5, 92, 18, 90, 31, 104, 5, 106, 18, 106, 31, 117, 11, 114, 12, 116, 16, 118, 26, 121, 31, -116, +5, -119, 30, -119, 31, 28, 14, 3, 3, 33, 17, -7, 28, 11, 22, 7, 33, 6, 8, -72, -1, -8, 64, 24, 16, +16, 6, 85, 22, 8, 16, 16, 6, 85, 33, 8, 16, 16, 6, 85, 8, 32, 7, 7, 33, 22, 32, 23, -72, 2, +-58, -75, 35, 14, 3, 0, 32, 33, -71, 2, -59, 0, 34, 16, -12, -3, 50, 50, 16, -10, -19, 18, 57, 47, -19, +43, 43, 43, 0, 63, 60, 60, 63, -19, 18, 57, 47, 51, 49, 48, 1, 93, 1, 23, 18, 23, 50, 54, 53, 19, +51, 3, 14, 3, 7, 22, 22, 51, 50, 54, 54, 55, 19, 51, 3, 6, 2, 4, 35, 34, 38, 2, 17, 3, 1, +38, 4, 6, 17, 106, -86, 21, -64, 24, 6, 26, 81, -81, -108, 25, -74, -123, 123, -80, 84, 14, 43, -64, 36, 21, +108, -2, -11, -45, -69, -3, 125, 14, 4, 37, -84, -2, -9, 102, 106, -108, 1, 29, -2, -78, 85, 88, 98, 73, 12, +108, -126, 117, -71, -85, 1, -57, -2, 119, -35, -2, -38, -74, -75, 1, 80, 1, 24, 1, 37, 0, 1, 0, 40, -1, +-8, 4, -109, 4, 49, 0, 30, 0, -102, 64, 76, 73, 21, 73, 22, 90, 21, 101, 15, 117, 15, 5, 1, -24, 0, +0, 3, -7, 29, 10, 18, 10, 7, 24, -7, 12, 7, 10, 10, 0, 24, 32, 7, 11, 11, 11, 6, 85, 7, 15, +12, 12, 6, 85, 7, 15, 15, 15, 6, 85, 7, 8, 16, 16, 6, 85, 64, 7, 1, 7, 7, 16, 0, 0, 1, +1, 10, 9, 9, 47, 10, 1, 10, 10, 19, 32, 16, -72, -1, -11, -76, 12, 12, 6, 85, 16, -72, -1, -35, -76, +15, 15, 6, 85, 16, -72, -1, -32, -76, 16, 16, 6, 85, 16, -71, 2, -56, 0, 32, 16, -10, 43, 43, 43, -19, +51, 47, 93, 51, 47, 17, 51, 47, 51, 47, 18, 57, 47, 113, 43, 43, 43, 43, -19, 18, 57, 47, 0, 63, -3, +50, 63, 63, -19, 51, 25, 47, 24, -19, 49, 48, 1, 93, 55, 55, 22, 51, 50, 54, 53, 17, 34, 7, 39, 54, +51, 50, 4, 22, 21, 17, 35, 17, 52, 38, 38, 35, 7, 17, 20, 6, 6, 35, 34, 40, 33, 52, 61, 69, 52, +86, 125, 17, -28, -21, -18, 1, 0, -121, -65, 47, -98, -74, 96, 37, 117, 116, 94, 25, -113, 18, 61, 80, 2, 100, +18, -97, 29, 80, -43, -49, -3, -61, 2, 10, -101, -112, 90, 2, -3, 125, 100, 106, 68, 0, 0, 2, 0, -101, 0, +0, 3, 87, 4, 37, 0, 3, 0, 7, 0, 79, -74, 2, 6, 10, 3, 7, 6, 9, -72, 2, -56, 64, 25, 0, +32, 3, 13, 15, 15, 6, 85, 3, 3, 12, 12, 6, 85, 3, -108, 4, 32, 7, 20, 16, 16, 6, 85, 7, -72, +-1, -3, -76, 13, 13, 6, 85, 7, -72, -1, -3, -76, 11, 11, 6, 85, 7, -71, 2, -57, 0, 8, 16, -10, 43, +43, 43, -3, -10, 43, 43, -3, -26, 0, 63, 60, 63, 60, 49, 48, 1, 17, 35, 17, 33, 17, 35, 17, 3, 87, +-61, -2, -54, -61, 4, 37, -5, -37, 4, 37, -5, -37, 4, 37, 0, 0, 2, 0, -101, 0, 0, 3, 87, 4, 37, +0, 3, 0, 7, 0, 79, -74, 2, 10, 6, 3, 7, 6, 9, -72, 2, -56, 64, 25, 0, 32, 3, 13, 15, 15, +6, 85, 3, 3, 12, 12, 6, 85, 3, -108, 4, 32, 7, 20, 16, 16, 6, 85, 7, -72, -1, -3, -76, 13, 13, +6, 85, 7, -72, -1, -3, -76, 11, 11, 6, 85, 7, -71, 2, -57, 0, 8, 16, -10, 43, 43, 43, -3, -10, 43, +43, -3, -26, 0, 63, 60, 47, 63, 49, 48, 1, 17, 35, 17, 33, 17, 35, 17, 3, 87, -61, -2, -54, -61, 4, +37, -5, -37, 4, 37, -3, -37, 2, 37, 0, 0, 2, 0, -101, 2, 0, 3, 87, 4, 37, 0, 3, 0, 7, 0, +78, -75, 2, 6, 3, 7, 6, 9, -72, 2, -56, 64, 25, 0, 32, 3, 13, 15, 15, 6, 85, 3, 3, 12, 12, +6, 85, 3, -108, 4, 32, 7, 20, 16, 16, 6, 85, 7, -72, -1, -3, -76, 13, 13, 6, 85, 7, -72, -1, -3, +-76, 11, 11, 6, 85, 7, -71, 2, -57, 0, 8, 16, -10, 43, 43, 43, -3, -10, 43, 43, -3, -26, 0, 63, 60, +47, 47, 49, 48, 1, 17, 35, 17, 33, 17, 35, 17, 3, 87, -61, -2, -54, -61, 4, 37, -3, -37, 2, 37, -3, +-37, 2, 37, 0, 1, 0, 90, 2, -92, 1, -119, 4, 37, 0, 3, 0, 25, 64, 12, 3, 0, 0, 1, 6, 2, +60, 1, 100, 3, -84, 0, 47, -19, -4, -19, 0, 63, 51, 47, 60, 49, 48, 19, 19, 51, 3, 90, 98, -51, -74, +2, -92, 1, -127, -2, 127, 0, 0, 2, 0, 90, 2, -92, 2, -4, 4, 37, 0, 3, 0, 7, 0, 48, 64, 26, +0, 4, 1, 5, 4, 4, 5, 6, 2, 60, 1, 100, 3, -84, 95, 0, 1, 0, 0, 6, 60, 5, 100, 7, -84, +4, 47, -19, -4, -3, 50, 47, 93, -19, -4, -19, 0, 63, 51, 47, 16, 60, 16, 60, 49, 48, 1, 19, 51, 3, +33, 19, 51, 3, 1, -51, 98, -51, -74, -2, 20, 98, -51, -74, 2, -92, 1, -127, -2, 127, 1, -127, -2, 127, 0, +2, 0, -101, 0, 0, 5, -21, 4, 37, 0, 13, 0, 27, 0, 106, 64, 9, 22, 6, 2, 16, 15, 1, 15, 18, +17, -72, 2, -46, -75, 14, 14, 9, 10, 6, 7, -72, 2, -46, -78, 10, 6, 29, -68, 2, -56, 0, 23, 2, -48, +0, 22, 2, -47, -76, 1, 1, 0, 2, 0, -70, 2, -48, 0, 3, 2, -47, -77, 17, 16, 14, 16, -65, 2, -48, +0, 15, 2, -47, 0, 7, 2, -48, 0, 10, 2, -57, 0, 28, 16, -10, -3, -10, -19, 60, 16, 60, -10, -19, 60, +16, 60, 16, -10, -3, -26, 0, 63, -3, 60, 63, 60, 16, -3, 60, 47, 93, 47, 63, 49, 48, 1, 17, 35, 17, +52, 38, 35, 33, 17, 35, 17, 33, 50, 22, 1, 17, 51, 17, 33, 50, 54, 53, 17, 51, 17, 20, 6, 35, 4, +94, -88, 70, 78, -2, 33, -88, 2, -88, -117, -112, -3, -54, -88, 1, -33, 88, 60, -88, -120, -109, 3, 23, -2, 65, +1, -82, 77, 67, -4, 106, 4, 37, -107, -4, 112, 2, -51, -3, -62, 78, 66, 3, 6, -4, -23, 115, -101, 0, 0, +2, -1, -84, 0, 0, 1, 94, 5, 71, 0, 12, 0, 16, 0, 78, -71, 0, 0, 2, -45, -73, 7, -84, 16, 15, +10, 16, 6, 10, -72, 2, -45, -76, 47, 3, 1, 3, 18, -72, 2, -56, -78, 13, 32, 16, -72, -1, -2, -76, 11, +11, 6, 85, 16, -72, -1, -2, 64, 11, 13, 13, 6, 85, 16, 18, 16, 16, 6, 85, 16, -71, 2, -57, 0, 17, +16, -12, 43, 43, 43, -3, -26, 47, 93, -19, 0, 63, 63, 16, -2, -19, 49, 48, 17, 50, 22, 21, 20, 6, 6, +35, 38, 38, 53, 52, 54, 1, 17, 35, 17, 41, 43, 22, 38, 24, 37, 47, 49, 1, -127, -61, 5, 71, 53, 32, +24, 38, 22, 1, 50, 33, 37, 48, -2, -34, -5, -37, 4, 37, -1, -1, 0, 40, -2, 104, 3, -126, 4, 49, 2, +38, 2, -86, 0, 0, 1, 7, 2, -115, 0, 8, 1, -10, 0, 29, 64, 15, 2, 1, -113, 15, 1, 0, 15, 15, +2, 2, 65, 1, 2, 2, 15, -71, 2, -38, 0, 41, 0, 43, 1, 43, 93, 53, 53, 0, -1, -1, 0, 40, -2, +104, 3, -126, 4, 49, 2, 38, 2, -86, 0, 0, 1, 7, 2, -107, 0, 8, 1, -10, 0, 44, 64, 12, 1, 80, +15, -112, 15, 2, -112, 15, -80, 15, 2, 15, -72, -1, -64, 64, 12, 9, 12, 52, 0, 15, 15, 2, 2, 65, 1, +1, 18, -71, 2, -38, 0, 41, 0, 43, 1, 43, 43, 93, 113, 53, -1, -1, -1, 87, 0, 0, 3, 70, 5, -70, +0, 38, 2, -84, 0, 0, 1, 7, 2, -106, -2, 86, 0, 0, 0, 22, 64, 10, 1, 0, 27, 27, 38, 38, 65, +1, 1, 23, -71, 2, -37, 0, 41, 0, 43, 1, 43, 53, -1, -1, -1, 87, 0, 0, 3, 70, 5, -70, 0, 38, +2, -84, 0, 0, 0, 39, 2, -106, -2, 86, 0, 0, 1, 6, 2, -104, -31, 57, 0, 73, -79, 2, 48, -72, -1, +-30, -76, 10, 10, 6, 85, 48, -72, -1, -30, -73, 15, 15, 6, 85, 0, 48, 1, 48, -72, -1, -64, 64, 19, 12, +14, 52, 0, 48, 41, 20, 19, 65, 1, 0, 27, 27, 51, 51, 65, 2, 1, 38, -72, 2, -36, -77, 41, 1, 1, +23, -71, 2, -37, 0, 41, 0, 43, 43, 1, 43, 53, 43, 43, 93, 43, 43, 53, 0, 0, 1, 0, 45, 0, 0, +3, -63, 4, 37, 0, 13, 0, -126, 64, 32, 47, 15, 59, 9, 58, 10, 121, 6, 121, 9, 121, 10, -127, 2, 7, +42, 2, 42, 6, 42, 9, 42, 10, 60, 2, 59, 6, 6, 6, 9, 8, 8, -72, -1, -10, 64, 46, 14, 17, 6, +85, 8, -70, 7, 6, 20, 7, 7, 6, 6, 9, 58, 5, -7, 4, 4, 3, 10, 12, 7, 6, 9, 9, 4, 9, +8, 6, 8, 7, 7, 13, 4, 4, 12, 32, 47, 13, -65, 13, -49, 13, 3, 13, -71, 2, -51, 0, 15, 16, -10, +93, -19, 51, 47, 18, 57, 47, 51, 51, 17, 51, 25, 17, 57, 47, 0, 24, 63, 60, 63, 60, 16, -3, -28, 57, +-121, 5, 46, 43, 43, -121, 125, -60, 49, 48, 1, 93, 93, 1, 2, 0, 35, 33, 53, 33, 3, 51, 19, 54, 19, +19, 51, 3, -73, 17, -2, -5, -22, -2, 118, 1, 20, -79, -55, -94, -18, 13, 10, -63, 3, 12, -2, 40, -2, -52, +-96, 3, -123, -4, 121, 67, 1, -41, 1, 109, 0, -1, -1, 0, 100, -1, -29, 5, 42, 5, 70, 2, 38, 2, -71, +0, 0, 1, 7, 2, -106, 3, 125, 0, 0, 0, 26, 64, 13, 1, 79, 46, 1, 10, 46, 46, 22, 22, 65, 1, +1, 34, -71, 2, -35, 0, 41, 0, 43, 1, 43, 113, 53, -1, -1, 0, 100, -1, -29, 5, 42, 5, 70, 2, 38, +2, -71, 0, 0, 1, 7, 2, -106, -1, 106, 0, 0, 0, 22, 64, 10, 1, 0, 46, 46, 33, 33, 65, 1, 1, +34, -71, 2, -35, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 100, -1, -29, 5, 42, 5, 70, 2, 38, 2, -31, +0, 0, 1, 7, 2, -106, 3, 125, 0, 0, 0, 26, 64, 13, 2, 79, 59, 1, 10, 59, 59, 22, 22, 65, 2, +1, 47, -71, 2, -35, 0, 41, 0, 43, 1, 43, 113, 53, -1, -1, 0, 100, -1, -29, 5, 42, 5, 70, 2, 38, +2, -31, 0, 0, 1, 7, 2, -106, -1, 106, 0, 0, 0, 22, 64, 10, 2, 0, 59, 59, 33, 33, 65, 2, 1, +47, -71, 2, -35, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 105, -2, -59, 4, 74, 4, 37, 2, 38, 2, -96, +0, 0, 1, 7, 2, -108, 0, -21, 0, 0, 0, 22, 64, 10, 1, 0, 23, 24, 6, 17, 65, 1, 1, 23, -71, +2, -34, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 105, -2, 82, 4, 74, 4, 37, 2, 38, 2, -96, 0, 0, +1, 7, 2, -107, 0, -21, 0, 0, 0, 22, 64, 10, 1, 0, 25, 26, 6, 17, 65, 1, 1, 25, -71, 2, -34, +0, 41, 0, 43, 1, 43, 53, 0, 2, 0, 105, 0, 0, 4, 74, 4, 37, 0, 21, 0, 37, 1, 30, 64, 83, +-126, 20, -128, 21, -89, 12, -40, 0, -41, 21, 5, 85, 3, 86, 9, 86, 12, 103, 3, 127, 8, 115, 20, -116, 9, +7, 59, 21, 72, 1, 77, 2, 73, 8, 77, 9, 73, 12, 77, 21, 7, 25, 8, 38, 12, 56, 1, 58, 2, 59, +8, 59, 9, 57, 12, 7, 63, 21, -127, 9, -113, 21, -90, 12, -38, 21, 5, 8, 2, 41, 19, 40, 21, 61, 2, +4, 2, 24, 12, 17, 6, 85, 12, -72, -1, -24, -76, 12, 17, 6, 85, 34, -72, 2, -45, 64, 44, -80, 26, 1, +26, 26, 6, 10, 21, 12, 11, 11, 0, 2, 9, 10, 1, 1, 0, 11, 11, -70, 10, 1, 20, 10, 10, 1, 21, +12, 1, 9, 4, 10, 6, 5, 0, 1, 10, 17, 16, 11, 10, 6, 30, -72, 2, -45, 64, 33, 0, 22, 32, 22, +127, 22, -81, 22, -65, 22, 5, 31, 22, 47, 22, 2, 22, 22, 5, 15, 16, 18, 4, 5, 7, 9, 2, 12, 21, +4, 17, 6, 1, -72, 2, 96, -73, -128, 0, 1, 0, 0, 16, 32, 17, -72, 2, -54, -74, 39, 11, 10, 5, 32, +10, 6, -71, 2, -55, 0, 38, 16, -10, 50, -19, 47, 51, 16, -10, -19, 51, 47, 93, -19, 17, 18, 23, 57, 51, +17, 51, 50, 17, 51, 18, 57, 47, 113, 93, -19, 0, 63, 60, 60, 60, 63, 60, 60, 60, 18, 23, 57, -121, 5, +46, 43, -121, 125, -60, 7, 14, 60, 60, -121, 14, 16, -60, 60, 0, 24, 17, 18, 57, 47, 93, -19, 43, 43, 49, +48, 0, 93, 93, 1, 93, 93, 93, 93, 33, 35, 1, 6, 7, 3, 35, 19, 18, 55, 3, 51, 1, 54, 54, 55, +55, 51, 7, 6, 6, 7, 1, 52, 54, 54, 51, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 4, 74, -20, +-2, 107, 93, 18, 43, -58, 43, 30, -78, -9, -21, 1, 84, 62, 50, 13, 25, -58, 24, 17, 108, 103, -2, -83, 23, +38, 23, 24, 38, 22, 22, 38, 24, 23, 38, 22, 2, 61, 51, -101, -2, -111, 1, 111, 1, 0, 90, 1, 92, -2, +37, 41, 109, 112, -43, -37, -100, -81, 62, -2, -35, 24, 37, 23, 23, 37, 24, 24, 37, 23, 23, 37, 0, -1, -1, +0, 50, 0, 0, 4, 41, 4, 49, 2, 38, 2, -95, 0, 0, 1, 6, 2, -104, 8, -20, 0, 32, 64, 19, 1, +0, 29, 16, 29, 32, 29, 96, 29, 4, 0, 29, 22, 15, 15, 65, 1, 1, 19, -71, 2, -33, 0, 41, 0, 43, +1, 43, 93, 53, -1, -1, 0, 25, 0, 0, 2, -24, 4, 49, 2, 38, 2, -94, 0, 0, 1, 6, 2, -104, -40, +70, 0, 40, 64, 26, 1, 64, 36, -128, 36, 2, 32, 36, 80, 36, -112, 36, -80, 36, -64, 36, 5, 0, 36, 29, +17, 17, 65, 1, 1, 26, -71, 2, -32, 0, 41, 0, 43, 1, 43, 93, 113, 53, -1, -1, 0, 45, 0, 0, 3, +-28, 4, 37, 2, 38, 2, -93, 0, 0, 1, 6, 2, -104, 78, 0, 0, 32, 64, 19, 1, 0, 18, 16, 18, 32, +18, -80, 18, 4, 0, 18, 11, 5, 4, 65, 1, 1, 8, -71, 2, -36, 0, 41, 0, 43, 1, 43, 93, 53, -1, +-1, 0, -106, 0, 0, 4, 64, 4, 49, 2, 38, 2, -92, 0, 0, 1, 7, 2, -104, 1, 12, -1, -66, 0, 30, +64, 17, 2, 64, 29, 112, 29, -80, 29, 3, 0, 29, 22, 15, 8, 65, 2, 1, 19, -71, 2, -31, 0, 41, 0, +43, 1, 43, 93, 53, 0, 2, 0, 0, 0, 0, 1, -80, 4, 37, 0, 3, 0, 18, 0, 87, -71, 0, 12, 2, +-45, -73, 4, 2, 10, 3, 6, 3, 32, 0, -72, -1, -18, 64, 28, 16, 16, 6, 85, 0, 10, 13, 15, 6, 85, +0, 64, 67, 68, 52, 0, 64, 61, 53, -97, 0, 1, 79, 0, -1, 0, 2, 0, -69, 2, -56, 0, 20, 0, 8, +2, -45, 64, 9, 47, 15, 1, 15, 64, 16, 17, 52, 15, 47, 43, 113, -19, 16, -10, 113, 114, 43, 43, 43, 43, +-3, 0, 63, 63, 47, -19, 49, 48, 1, 17, 35, 17, 3, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 53, 52, +54, 54, 1, -80, -62, -102, 22, 37, 25, 22, 38, 24, 31, 53, 22, 38, 4, 37, -5, -37, 4, 37, -2, 113, 20, +38, 26, 24, 38, 22, 43, 41, 24, 37, 23, 0, 0, 2, 0, 0, 0, 0, 3, 59, 4, 37, 0, 19, 0, 34, +0, -114, 64, 10, 15, 36, 31, 36, 80, 1, 98, 1, 4, 28, -72, 2, -45, 64, 29, 16, 20, 1, 20, 9, 10, +0, 39, 17, -7, 18, 6, 16, 16, 0, 17, 8, 32, 9, 2, 16, 16, 6, 85, 9, 9, 3, 32, 14, -72, -1, +-6, 64, 43, 11, 13, 6, 85, 14, 22, 15, 15, 6, 85, 14, 2, 16, 16, 6, 85, 14, 64, 14, 16, 52, 79, +14, 1, 15, 14, -49, 14, -33, 14, 3, 14, 19, 64, 14, 23, 52, 15, 19, 31, 19, 2, 19, -72, 2, -52, -77, +36, 18, -59, 24, -71, 2, -45, 0, 32, 47, -3, -26, 16, -26, 93, 43, 47, 93, 113, 43, 43, 43, 43, -19, 51, +47, 43, -19, 17, 18, 57, 47, 0, 63, -3, -28, 63, 47, 93, -19, 49, 48, 1, 93, 1, 34, 6, 21, 20, 23, +22, 21, 21, 35, 53, 52, 39, 38, 53, 52, 55, 33, 53, 33, 1, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, +38, 53, 52, 54, 3, 59, -103, -83, 9, 26, -64, 20, 7, -121, -2, -12, 2, -125, -3, 25, 22, 37, 25, 22, 38, +24, 24, 37, 23, 48, 3, -98, -81, -109, 29, 84, -14, 102, -109, -82, 106, -36, 74, 49, -91, 113, -96, -2, -86, 20, +38, 26, 24, 38, 22, 22, 38, 24, 35, 49, 0, -1, -1, 0, -116, -1, -29, 4, 64, 4, 59, 2, 38, 2, -88, +0, 0, 1, 7, 2, -104, 1, 20, 0, 0, 0, 22, 64, 10, 1, 0, 40, 33, 29, 22, 65, 1, 1, 30, -71, +2, -33, 0, 41, 0, 43, 1, 43, 53, 0, 2, 0, 0, 2, 0, 1, -80, 4, 37, 0, 3, 0, 16, 0, 102, +-71, 0, 10, 2, -45, 64, 12, 4, 4, 0, 2, 1, 2, 2, 3, 6, 3, 32, 0, -72, -1, -18, 64, 34, 16, +16, 6, 85, 0, 10, 13, 15, 6, 85, 0, 40, 11, 12, 6, 85, 0, 64, 67, 68, 52, 0, 64, 61, 53, -97, +0, 1, 79, 0, -1, 0, 2, 0, -69, 2, -56, 0, 18, 0, 7, 2, -45, 64, 9, 47, 13, 1, 13, 64, 16, +17, 52, 13, 47, 43, 113, -19, 16, -12, 113, 114, 43, 43, 43, 43, 43, -3, 0, 63, 51, 47, 93, 57, 47, -19, +49, 48, 1, 17, 35, 17, 7, 50, 22, 21, 20, 6, 35, 34, 38, 53, 52, 54, 54, 1, -80, -62, -102, 31, 53, +49, 35, 31, 53, 22, 38, 4, 37, -3, -37, 2, 37, -10, 43, 41, 35, 49, 44, 40, 24, 38, 22, 0, -1, -1, +0, 40, -2, 104, 3, -126, 4, 49, 2, 38, 2, -86, 0, 0, 1, 6, 2, -104, 18, -72, 0, 22, 64, 10, 1, +0, 25, 18, 14, 8, 65, 1, 1, 15, -71, 2, -31, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 80, -1, -16, +3, 86, 4, 55, 2, 38, 2, -85, 0, 0, 1, 6, 2, -104, -11, -52, 0, 40, -79, 1, 34, -72, -1, -32, 64, +20, 11, 11, 6, 85, 0, 34, 96, 34, 112, 34, 3, 0, 34, 27, 13, 7, 65, 1, 1, 24, -71, 2, -33, 0, +41, 0, 43, 1, 43, 93, 43, 53, -1, -1, 0, 60, 0, 0, 3, 70, 5, -70, 0, 38, 2, -84, 0, 0, 1, +6, 2, -104, 31, 57, 0, 55, -79, 1, 33, -72, -1, -30, -76, 15, 15, 6, 85, 33, -72, -1, -30, -73, 10, 10, +6, 85, 0, 33, 1, 33, -72, -1, -64, 64, 12, 12, 14, 52, 0, 33, 26, 20, 19, 65, 1, 1, 23, -71, 2, +-36, 0, 41, 0, 43, 1, 43, 43, 93, 43, 43, 53, 0, -1, -1, 0, 80, 0, 0, 4, 62, 4, 49, 2, 38, +2, -82, 0, 0, 1, 7, 2, -104, 1, 63, -1, -68, 0, 22, 64, 10, 1, 0, 37, 30, 21, 14, 65, 1, 1, +27, -71, 2, -33, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 60, 0, 0, 2, 60, 4, 49, 2, 38, 2, -80, +0, 0, 1, 7, 2, -104, -1, 98, -1, -50, 0, 49, -79, 1, 28, -72, -1, -30, -76, 11, 13, 6, 85, 28, -72, +-1, -64, -73, 12, 14, 52, 16, 28, -112, 28, 2, -72, -1, -22, -73, 28, 21, 2, 3, 65, 1, 1, 18, -71, 2, +-33, 0, 41, 0, 43, 1, 43, 93, 43, 43, 53, 0, 0, 3, 0, 90, -1, -31, 4, 62, 4, 66, 0, 13, 0, +25, 0, 40, 1, 25, 64, 33, 47, 42, 92, 18, 92, 22, 83, 24, -89, 9, -88, 13, -25, 1, -23, 6, 8, 55, +24, 71, 24, 83, 2, 89, 5, 89, 9, 83, 12, 83, 16, 7, 34, -72, 2, -45, 64, 25, 127, 26, -97, 26, 2, +32, 26, -33, 26, 2, 47, 26, 1, 26, 26, 23, 17, -7, 11, 11, 23, -7, 3, 7, 30, -72, 2, -45, 64, 18, +31, 38, 79, 38, 2, 95, 38, -113, 38, -97, 38, 3, 38, 38, 14, 20, 38, 7, -72, -1, -12, 64, 11, 16, 16, +2, 85, 7, 12, 15, 15, 2, 85, 7, -72, -1, -12, 64, 11, 14, 14, 2, 85, 7, 10, 13, 13, 2, 85, 7, +-72, -1, -10, 64, 11, 12, 12, 2, 85, 7, 0, 11, 11, 2, 85, 7, -72, -1, -26, -76, 11, 11, 6, 85, 7, +-72, -1, -16, -76, 13, 13, 6, 85, 7, -72, -1, -14, -76, 12, 12, 6, 85, 7, -72, -1, -8, -76, 15, 15, 6, +85, 7, -72, 2, -58, 64, 10, 42, 14, 38, 0, 10, 12, 15, 2, 85, 0, -72, -1, -10, 64, 29, 11, 11, 2, +85, 0, 14, 11, 11, 6, 85, 0, 14, 13, 13, 6, 85, 0, 12, 16, 16, 6, 85, 0, 20, 12, 12, 6, 85, +0, -72, -1, -10, -76, 15, 15, 6, 85, 0, -71, 2, -59, 0, 41, 16, -10, 43, 43, 43, 43, 43, 43, 43, -19, +16, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 17, 57, 47, 93, 113, -19, 0, 63, -19, 63, -3, 17, +57, 47, 93, 113, 114, -19, 49, 48, 1, 93, 93, 19, 52, 0, 51, 50, 22, 18, 21, 20, 6, 6, 35, 34, 0, +55, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, 5, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, +52, 54, 90, 1, 17, -31, -122, -40, -108, 112, -30, -96, -31, -2, -17, -47, -104, -119, -108, -113, -102, -119, -111, -112, 1, +35, 22, 37, 25, 22, 38, 24, 24, 37, 23, 48, 2, 14, -2, 1, 54, 117, -1, 0, -65, -99, -8, -104, 1, 49, +-4, -68, -47, -30, -83, -64, -42, -25, 89, 20, 38, 26, 24, 38, 22, 22, 38, 24, 35, 49, 0, 2, 0, 110, -2, +104, 3, -9, 4, 49, 0, 24, 0, 40, 0, -23, 64, 32, 9, 32, 31, 34, 52, 9, 32, 14, 17, 52, 73, 21, +75, 22, 91, 21, -117, 22, -72, 15, 5, 25, 21, 41, 21, 56, 21, 61, 22, 4, 15, 23, -72, -1, -16, -78, 2, +14, 21, -69, -1, -16, 0, 2, 0, 25, 2, -45, 64, 19, 33, 33, 3, 108, 8, 8, 13, 41, 18, 14, 11, 11, +23, -7, 13, 7, 5, -59, 6, -72, -1, -64, -75, 25, 40, 52, 6, 85, 29, -72, 2, -45, -74, 37, 20, 15, 15, +6, 85, 37, -72, -1, -22, 64, 20, 12, 13, 6, 85, 37, 64, 35, 38, 52, 37, 64, 25, 28, 52, 37, 37, 0, +19, 32, 16, -72, -1, -8, -76, 11, 12, 6, 85, 16, -72, -1, -4, 64, 20, 13, 13, 6, 85, 16, 20, 15, 15, +6, 85, 16, 35, 16, 16, 6, 85, 47, 16, 1, 16, -72, 2, -56, 64, 22, 42, 0, 32, 11, 18, 11, 13, 6, +85, 11, 8, 15, 15, 6, 85, 11, 18, 16, 16, 6, 85, 11, -71, 2, -55, 0, 41, 16, -10, 43, 43, 43, -19, +16, -10, 93, 43, 43, 43, 43, -19, 17, 57, 47, 43, 43, 43, 43, -19, -2, 43, -28, 0, 63, -19, 51, 47, 63, +17, 18, 57, 47, -19, 51, 47, -19, 49, 48, 23, 56, 1, 23, 56, 93, 93, 43, 43, 1, 17, 20, 51, 50, 55, +23, 6, 35, 34, 17, 17, 54, 51, 32, 22, 21, 17, 35, 17, 52, 38, 38, 35, 34, 1, 50, 22, 22, 21, 20, +6, 6, 35, 34, 38, 38, 53, 52, 54, 54, 1, 38, 92, 45, 31, 19, 54, 68, -7, -76, -63, 1, 26, -6, -66, +63, -91, 126, 98, 1, 11, 24, 37, 23, 22, 37, 25, 24, 38, 22, 19, 39, 3, -127, -2, -25, 122, 12, -117, 25, +1, 23, 1, -113, 53, -26, -7, -4, 22, 3, -41, 117, -111, 78, -2, -93, 23, 37, 24, 25, 37, 22, 22, 38, 24, +22, 37, 25, 0, 2, 0, 115, -1, -16, 4, 5, 4, 55, 0, 32, 0, 45, 0, -42, 64, 19, 77, 14, 75, 18, +122, 14, -117, 14, 4, 47, 14, 47, 18, 61, 14, 61, 18, 4, 33, -72, 2, -45, 64, 28, 40, 40, 24, 108, 29, +29, 2, 8, 11, -7, 10, 10, 13, -7, 8, 11, 0, 0, 19, -7, 2, 7, 11, 11, 10, 10, 32, 27, -72, -1, +-64, -75, 25, 35, 52, 27, 62, 37, -70, 2, -45, 0, 43, -1, -28, 64, 32, 12, 13, 6, 85, 43, 8, 16, 16, +6, 85, 43, 64, 33, 35, 52, 43, 64, 25, 28, 52, 43, 43, 22, 16, 38, 5, 8, 16, 16, 6, 85, 5, -72, +-1, -8, -76, 15, 15, 6, 85, 5, -72, -1, -8, -73, 11, 13, 6, 85, 32, 5, 1, 5, -67, 2, -58, 0, 47, +0, 22, 2, -49, 0, 32, -1, -8, 64, 17, 16, 16, 6, 85, 32, 14, 15, 15, 6, 85, 32, 14, 11, 13, 6, +85, 32, -71, 2, -55, 0, 46, 16, -10, 43, 43, 43, -19, 16, -12, 93, 43, 43, 43, -19, 17, 57, 47, 43, 43, +43, 43, -19, -18, 43, 17, 51, 47, 51, 47, 0, 63, -19, 51, 47, 63, -19, 51, 47, -19, 17, 18, 57, 47, -19, +51, 47, -19, 49, 48, 1, 93, 93, 19, 54, 51, 50, 0, 17, 16, 0, 33, 34, 39, 55, 22, 51, 50, 54, 53, +52, 38, 35, 34, 7, 21, 20, 51, 50, 55, 23, 6, 35, 34, 38, 53, 5, 50, 22, 22, 21, 20, 6, 35, 34, +38, 53, 52, 54, 122, -83, -67, -23, 1, 56, -2, -64, -2, -30, -61, 113, 46, 98, -105, -85, -9, -62, -94, 84, 82, +123, 18, 10, 21, 39, 66, 98, -103, 2, 10, 24, 37, 23, 48, 36, 35, 49, 48, 4, 2, 53, -2, -18, -2, -4, +-2, -1, -2, -48, 71, -98, 63, -61, -60, -84, -47, 19, -62, 123, 2, -121, 19, -125, -121, 73, 23, 37, 24, 36, 48, +48, 36, 35, 49, 0, -1, -1, 0, 10, 0, 0, 3, 102, 4, 37, 2, 38, 2, -74, 0, 0, 1, 7, 2, -104, +-1, 101, -1, -115, 0, 43, -73, 1, 28, 18, 11, 12, 6, 85, 28, -72, -1, -18, 64, 16, 13, 13, 6, 85, 0, +28, 28, 9, 9, 65, 71, 11, 1, 1, 1, 18, -71, 2, -31, 0, 41, 0, 43, 1, 113, 43, 43, 43, 53, 0, +-1, -1, 0, -106, -2, 104, 3, -8, 4, 37, 2, 38, 2, -73, 0, 0, 1, 7, 2, -104, 0, -56, 0, 0, 0, +58, 64, 28, 2, 35, 8, 16, 16, 6, 85, 35, 64, 62, 67, 52, 35, 64, 51, 55, 52, 35, 64, 29, 31, 52, +-1, 35, 1, 112, 35, 1, -72, -1, -93, -73, 35, 28, 23, 19, 65, 2, 1, 25, -71, 2, -30, 0, 41, 0, 43, +1, 43, 93, 113, 43, 43, 43, 43, 53, -1, -1, 0, 40, 0, 0, 3, -126, 4, 49, 2, 38, 2, -72, 0, 0, +1, 6, 2, -104, 18, -72, 0, 32, -79, 1, 25, -72, -1, -18, 64, 13, 13, 13, 6, 85, 0, 25, 18, 14, 8, +65, 1, 1, 15, -71, 2, -31, 0, 41, 0, 43, 1, 43, 43, 53, 0, 2, 0, 100, -1, -29, 5, 42, 4, 37, +0, 33, 0, 46, 0, -40, 64, 90, 47, 48, -51, 19, -53, 20, -53, 25, -38, 20, -38, 25, 6, -92, 11, -92, 12, +-86, 20, -86, 25, -69, 20, -69, 25, 6, 121, 31, -116, 5, -119, 30, -119, 31, -101, 20, -103, 25, 6, 106, 18, 106, +31, 117, 11, 114, 12, 116, 16, 118, 26, 6, 72, 20, 72, 25, 89, 5, 92, 18, 90, 31, 104, 5, 6, 43, 31, +49, 15, 53, 16, 61, 19, 61, 26, 49, 30, 6, 7, 15, 8, 19, 22, 15, 28, 19, 25, 26, 5, 34, -72, 2, +-45, 64, 16, 40, 40, 17, 14, 3, 3, 33, 17, -7, 28, 11, 22, 7, 33, 6, 37, -72, 2, -45, -74, 111, 44, +1, 44, 44, 22, 8, -72, -1, -8, 64, 27, 16, 16, 6, 85, 22, 8, 16, 16, 6, 85, 33, 8, 16, 16, 6, +85, 8, 32, 48, 7, 1, 7, 7, 33, 22, 32, 23, -72, 2, -58, -75, 48, 14, 3, 0, 32, 33, -71, 2, -59, +0, 47, 16, -10, -3, 50, 50, 16, -10, -19, 18, 57, 47, 93, -3, 43, 43, 43, 17, 57, 47, 93, -19, 0, 63, +60, 60, 63, -19, 18, 57, 47, 51, 17, 57, 47, -19, 49, 48, 1, 93, 93, 93, 93, 93, 93, 93, 1, 23, 18, +23, 50, 54, 53, 19, 51, 3, 14, 3, 7, 22, 22, 51, 50, 54, 54, 55, 19, 51, 3, 6, 2, 4, 35, 34, +38, 2, 17, 3, 1, 50, 22, 21, 20, 6, 35, 34, 38, 38, 53, 52, 54, 1, 38, 4, 6, 17, 106, -86, 21, +-64, 24, 6, 26, 81, -81, -108, 25, -74, -123, 123, -80, 84, 14, 43, -64, 36, 21, 108, -2, -11, -45, -69, -3, 125, +14, 3, 16, 35, 49, 48, 36, 21, 37, 26, 48, 4, 37, -84, -2, -9, 102, 106, -108, 1, 29, -2, -78, 85, 88, +98, 73, 12, 108, -126, 117, -71, -85, 1, -57, -2, 119, -35, -2, -38, -74, -75, 1, 80, 1, 24, 1, 37, -2, 2, +49, 35, 35, 49, 19, 39, 26, 35, 49, 0, -1, -1, 0, 40, -1, -8, 4, -109, 4, 49, 2, 38, 2, -70, 0, +0, 1, 7, 2, -104, 1, -122, -1, -93, 0, 28, 64, 15, 1, -96, 41, -80, 41, 2, 0, 41, 34, 24, 18, 65, +1, 1, 31, -71, 2, -31, 0, 41, 0, 43, 1, 43, 93, 53, 0, 2, 0, -101, 0, 0, 1, 94, 5, 70, 0, +3, 0, 18, 0, 78, -69, 0, 12, 2, -45, 0, 4, 2, -35, -76, 2, 10, 3, 6, 8, -72, 2, -45, -77, 16, +16, 3, 20, -72, 2, -56, -78, 0, 32, 3, -72, -1, -2, -76, 11, 11, 6, 85, 3, -72, -1, -2, 64, 11, 13, +13, 6, 85, 3, 20, 16, 16, 6, 85, 3, -71, 2, -57, 0, 19, 16, -10, 43, 43, 43, -3, -26, 18, 57, 47, +-19, 0, 63, 63, 63, -19, 49, 48, 1, 17, 35, 17, 19, 50, 22, 22, 21, 20, 6, 6, 35, 34, 38, 38, 53, +52, 54, 1, 94, -61, 96, 22, 37, 25, 22, 38, 24, 24, 37, 23, 48, 4, 37, -5, -37, 4, 37, 1, 33, 20, +38, 26, 24, 38, 22, 22, 38, 24, 35, 49, -1, -1, 0, 50, 0, 0, 4, 41, 5, 75, 2, 38, 2, -95, 0, +0, 1, 7, 2, -101, 0, -122, 0, 0, 0, 36, 64, 22, 1, 20, 64, 18, 21, 52, 0, 20, 16, 20, -32, 20, +3, 0, 20, 21, 11, 11, 65, 1, 1, 20, -71, 2, -35, 0, 41, 0, 43, 1, 43, 93, 43, 53, -1, -1, 0, +80, -1, -16, 3, 86, 5, 75, 2, 38, 2, -85, 0, 0, 1, 6, 2, -101, 100, 0, 0, 22, 64, 10, 1, 0, +25, 26, 13, 7, 65, 1, 1, 25, -71, 2, -35, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, 115, -1, -16, 4, +5, 5, 75, 2, 38, 2, -76, 0, 0, 1, 7, 2, -101, 0, -68, 0, 0, 0, 35, -76, 1, 64, 34, 1, 34, +-72, -1, -64, 64, 12, 9, 11, 52, 0, 34, 35, 2, 2, 65, 1, 1, 34, -71, 2, -35, 0, 41, 0, 43, 1, +43, 43, 93, 53, 0, 0, 1, 0, 60, 0, 0, 4, 100, 5, -70, 0, 25, 0, -46, 64, 35, 108, 2, 113, 8, +115, 9, 3, 5, 15, 26, 8, 39, 24, 52, 3, 75, 0, 75, 1, 87, 25, 111, 8, -118, 8, -126, 24, 10, 2, +24, 12, 17, 6, 85, 16, -72, -1, -24, 64, 59, 12, 17, 6, 85, 12, 25, 16, 15, 15, 0, 2, 9, 10, 1, +1, 10, 10, 32, 15, 0, 20, 15, 15, 0, 25, 16, 2, 9, 4, 14, 6, 5, 0, 1, 10, 11, -7, 14, 20, +21, 21, 15, 15, 14, 6, 22, 19, 20, 4, 5, 7, 9, 2, 25, 16, 4, 21, 6, 1, -72, 2, 96, -73, -128, +0, 1, 0, 0, 20, 32, 21, -72, 2, -54, 64, 15, 27, 10, 11, 12, 15, 117, 14, 14, 13, 32, 12, 12, 5, +32, 6, -71, 2, -55, 0, 26, 16, -10, -19, 51, 47, -3, 60, 16, -28, 16, 60, 50, 16, -10, -19, 51, 47, 93, +-19, 17, 18, 23, 57, 51, 17, 51, 17, 51, 50, 0, 63, 60, 16, 60, 16, 60, 16, -19, 63, 60, 60, 60, 18, +23, 57, -121, 5, 46, 43, 125, 16, -60, 7, 14, 60, 60, -121, 14, 16, -60, 60, 0, 24, 47, 43, 43, 49, 48, +1, 93, 0, 93, 33, 35, 1, 6, 7, 3, 35, 19, 18, 55, 39, 35, 17, 51, 17, 51, 1, 54, 54, 55, 55, +51, 7, 6, 6, 7, 4, 100, -20, -2, 107, 93, 18, 43, -58, 43, 30, -78, -122, -68, -66, 120, 1, 84, 62, 50, +13, 25, -58, 24, 17, 108, 103, 2, 61, 51, -101, -2, -111, 1, 111, 1, 0, 90, -68, 2, 53, -2, 107, -2, 37, +41, 109, 112, -43, -37, -100, -81, 62, 0, 0, 1, -1, -36, -2, -19, 0, 36, 5, 9, 0, 3, 0, 13, -76, 2, +3, 0, -85, 3, 47, -19, 0, 47, 47, 49, 48, 19, 17, 35, 17, 36, 72, 5, 9, -7, -28, 6, 28, 0, 0, +1, -1, 37, -2, -19, 0, -37, 5, -123, 0, 14, 1, 1, 64, 18, 24, 5, 23, 11, 2, 77, 2, 77, 14, 2, +1, 12, -27, 13, 13, 4, -27, 3, -72, -1, -64, -77, 9, 14, 52, 3, -72, 2, -40, 64, 13, 5, 10, -27, 9, +6, -27, 9, 7, 64, 9, 14, 52, 7, -72, 2, -40, -74, 5, 8, 64, 63, 63, 52, 8, -72, -1, -64, 64, 52, +22, 23, 52, 8, 8, 5, 11, 5, 14, 2, 64, -115, -114, 52, 2, 64, 91, 92, 52, 2, 64, 38, 41, 52, 2, +64, 14, 23, 52, 2, 2, 5, 34, 9, 20, 52, 5, 12, -27, 13, 10, -27, 9, 13, 64, 43, 45, 52, 0, 13, +1, 13, -72, 2, -42, 64, 9, 9, 64, 43, 45, 52, 0, 9, 1, 9, -70, 2, -42, 0, 11, -1, -34, 64, 15, +43, 51, 52, 11, 11, 14, -85, 2, 4, -27, 3, 6, -27, 7, 3, -72, -1, -64, -74, 43, 45, 52, 15, 3, 1, +3, -70, 2, -42, 0, 7, -1, -64, -74, 43, 45, 52, 15, 7, 1, 7, -72, 2, -42, -73, 5, 34, 43, 51, 52, +5, 5, 2, 47, 51, 47, 43, -28, 93, 43, -28, 93, 43, 16, -20, 16, -20, 16, -3, 50, 47, 43, -28, 93, 43, +-28, 93, 43, 16, -20, 16, -20, 0, 47, 43, 51, 47, 43, 43, 43, 43, 60, 16, 60, 17, 51, 47, 43, 43, 16, +-3, 43, 60, -20, 16, -20, 16, -3, 43, -20, 60, 16, -20, 47, 49, 48, 0, 93, 1, 114, 19, 35, 17, 7, 39, +55, 39, 55, 23, 55, 23, 7, 23, 7, 39, 36, 72, -122, 49, -85, -85, 49, -86, -86, 49, -85, -85, 49, -122, -2, +-19, 5, 109, -120, 49, -87, -88, 49, -85, -85, 49, -88, -87, 49, -120, 0, 1, -1, -36, -2, -19, 1, -82, 5, -123, +0, 10, 0, 95, 64, 54, 6, 10, -27, 9, 114, 8, 0, 0, 3, 8, 1, -27, 2, 114, 3, 3, 4, -85, 8, +7, 0, 114, 8, 5, -85, 6, 6, 7, 10, -27, 9, 1, -27, 2, 2, 9, -24, 8, 8, 3, 34, 40, 41, 52, +3, 64, 9, 11, 52, 3, -91, 4, -85, 7, 47, -3, -10, 43, 43, 60, 16, -12, 60, 16, -20, 16, -20, 16, 60, +16, -19, 16, -19, 0, 47, 60, -3, 60, 16, -12, -28, 25, 17, 18, 57, 47, 24, 16, -12, -28, 47, 49, 48, 1, +7, 39, 55, 33, 17, 35, 17, 33, 39, 55, 1, -82, -39, 49, -119, -2, -10, 71, 1, 81, -119, 49, 4, -82, -42, +49, -126, -6, 98, 5, -27, -126, 49, 0, 0, 1, -2, 81, -2, -19, 0, 35, 5, -123, 0, 10, 0, 122, 64, 46, +12, 64, 9, 10, 52, 1, 7, -27, 8, 114, 9, 6, 6, 9, 3, 5, -27, 4, 114, 3, -85, 9, 2, -85, 9, +10, 6, 114, 9, 1, -85, 0, 0, 10, 7, -27, 8, 5, -27, 4, 4, 8, -24, 9, 9, 3, -72, -1, -34, -77, +40, 41, 52, 3, -72, -1, -64, 64, 13, 9, 11, 52, 3, -91, 2, -85, 10, 64, 9, 10, 52, 10, -71, 2, -39, +0, 12, 16, -11, 43, -3, -10, 43, 43, 60, 16, -12, 60, 16, -20, 16, -20, 16, 60, 16, -19, 16, -19, 0, 47, +60, -19, 16, -3, -12, -28, 25, 17, 18, 57, 47, 24, 16, -12, -28, 47, 49, 48, 1, 43, 19, 35, 17, 33, 23, +7, 39, 55, 23, 7, 33, 35, 71, -2, -10, -119, 49, -39, -39, 49, -119, 1, 81, -2, -19, 5, -98, -126, 49, -42, +-41, 49, -126, 0, 0, 1, 0, -85, 1, 24, 1, -19, 3, -116, 0, 17, 0, 67, -79, 11, 10, -72, -1, -64, -77, +15, 17, 52, 10, -72, -1, -64, -75, 12, 17, 52, 10, 10, 3, -72, 2, -20, -73, 11, 10, 10, 0, 15, 15, 6, +0, -72, -1, -64, -75, 16, 17, 52, 0, 0, 6, -72, 1, 28, -123, 47, 51, 47, 43, 18, 57, 47, 18, 57, 47, +51, 0, 63, 51, 47, 43, 43, 51, 49, 48, 1, 20, 6, 35, 34, 38, 53, 52, 55, 54, 55, 23, 6, 7, 6, +21, 20, 22, 1, -19, 80, 63, 77, 102, 88, 43, 86, 33, 59, 31, 55, -39, 1, -95, 53, 84, -112, 107, -107, 112, +55, 61, 55, 54, 40, 71, 54, 54, 48, 0, 2, 0, -96, 1, 22, 1, -30, 4, -32, 0, 17, 0, 29, 0, 93, +-79, 11, 10, -72, -1, -64, -77, 15, 17, 52, 10, -72, -1, -64, 64, 11, 12, 17, 52, 10, 10, 15, 3, 1, 3, +3, 27, -68, 2, -18, 0, 21, 2, -20, 0, 18, 2, -19, 64, 11, 24, 24, 6, 11, 10, 10, 0, 15, 15, 6, +0, -72, -1, -64, -75, 16, 17, 52, 0, 0, 6, -72, 1, 28, -123, 47, 51, 47, 43, 18, 57, 47, 18, 57, 47, +51, 17, 51, 47, -19, 0, 63, -3, 50, 47, 93, 51, 47, 43, 43, 51, 49, 48, 1, 20, 6, 35, 34, 38, 53, +52, 55, 54, 55, 23, 6, 7, 6, 21, 20, 22, 3, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 1, -30, +80, 63, 77, 102, 88, 43, 86, 33, 59, 31, 55, -39, 27, 67, 48, 48, 71, 70, 49, 49, 66, 2, -11, 53, 84, +-112, 107, -107, 112, 55, 61, 55, 54, 40, 71, 54, 54, 48, -2, 34, 47, 69, 69, 47, 48, 68, 66, 0, 2, 0, +67, 1, 24, 2, -100, 5, -79, 0, 39, 0, 51, 0, -125, -71, 0, 20, -1, -52, -77, 14, 17, 52, 20, -72, -1, +-32, 64, 17, 10, 12, 52, 4, 64, 21, 26, 52, 4, 64, 9, 17, 52, 4, 4, 25, 13, -70, 2, -15, 0, 37, +2, -14, -73, 25, 64, 9, 11, 52, 25, 25, 49, -68, 2, -18, 0, 43, 2, -20, 0, 24, 2, -15, -74, 25, 25, +40, 46, 10, 10, 0, -72, 2, -19, 64, 15, 7, 64, 18, 19, 52, 7, 7, -128, 16, 1, 16, 16, 34, 34, 40, +-70, 2, -19, 0, 46, 1, 36, -123, 47, -19, 51, 47, 51, 47, 93, 51, 47, 43, -19, 57, 47, 17, 18, 57, 47, +-19, 0, 63, -3, 50, 47, 43, 63, -19, 17, 57, 47, 43, 43, 49, 48, 1, 43, 43, 1, 20, 7, 6, 35, 34, +38, 53, 52, 54, 53, 52, 38, 35, 34, 6, 21, 20, 23, 22, 23, 22, 21, 20, 7, 39, 52, 55, 55, 52, 39, +38, 39, 38, 53, 52, 54, 51, 50, 22, 3, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 2, -100, 36, 41, +64, 50, 66, 110, 64, 52, 65, 83, 42, 64, 14, 42, 10, 61, 1, 5, 74, 126, 12, 75, -76, -123, 120, -88, -74, +73, 52, 49, 72, 73, 52, 51, 70, 4, -71, 62, 47, 53, 66, 44, 68, 68, 22, 34, 42, 73, 53, 49, 76, 116, +34, 105, 122, 66, 82, 1, 18, 10, 52, 56, 66, 112, 14, 89, 111, -121, -78, -119, -4, 108, 51, 73, 74, 50, 52, +73, 74, 0, 1, 0, 121, 0, -109, 2, -24, 3, 51, 0, 36, 0, -105, -75, 11, 32, 16, 17, 52, 33, -72, -1, +-32, 64, 15, 16, 17, 52, 23, 19, 24, 64, 14, 21, 52, 24, 24, 28, 35, 0, -70, 2, -17, 0, 1, -1, -64, +-73, 9, 13, 52, 1, 1, 35, 10, 19, -72, 2, -17, -78, 28, 28, 35, -72, 2, -17, -75, 10, 6, 10, 5, 5, +10, -72, 2, -21, 64, 13, 35, 35, 24, 24, 23, 23, 1, 0, 0, 1, 1, 38, 6, -72, -1, -64, 64, 12, 9, +10, 52, 6, 5, 16, 14, 15, 52, 5, 5, 31, -70, 2, -13, 0, 13, 1, 22, -123, 47, -19, 57, 47, 43, 51, +43, 17, 51, 47, 51, 47, 17, 57, 47, 57, 47, 57, 47, 0, 63, 51, 47, 18, 57, 16, -3, 50, 47, -19, 17, +18, 57, 47, 43, -19, 17, 18, 57, 47, 43, 17, 57, 49, 48, 1, 43, 43, 1, 7, 6, 7, 6, 7, 39, 54, +55, 54, 55, 39, 38, 53, 52, 55, 54, 55, 54, 51, 50, 23, 22, 23, 7, 38, 39, 38, 35, 34, 6, 21, 20, +23, 22, 23, 54, 2, -24, 48, -104, 98, 113, 93, 31, 13, 22, 19, 25, 116, 51, 40, 48, 62, 80, 81, 75, 49, +11, 40, 52, 37, 7, 61, 39, 48, 104, 60, 47, 95, -117, 2, 25, -92, 38, 47, 54, 87, 17, 46, 39, 34, 27, +66, 34, 40, 32, 84, 100, 67, 86, 43, 9, 46, -125, 25, 5, 39, 54, 34, 41, 38, 29, 34, 67, 0, 1, -1, +-70, 1, 37, 1, -88, 1, -45, 0, 3, 0, 24, -67, 0, 2, 2, -17, 0, 1, 2, -21, 0, 0, 2, -16, -79, +5, 1, 47, 16, -28, 0, 63, -19, 49, 48, 1, 33, 53, 33, 1, -88, -2, 18, 1, -18, 1, 37, -82, 0, 0, +2, 0, 70, 4, -41, 1, -100, 6, 61, 0, 7, 0, 16, 0, 68, -71, 0, 0, 2, -11, -78, 2, 2, 6, -72, +2, -11, 64, 9, 4, 64, 9, 14, 52, 4, 4, 15, 8, -72, 2, -11, -78, 11, 11, 15, -70, 2, -11, 0, 13, +2, -12, -76, 0, 8, 8, 4, 13, -72, 1, 36, -123, 47, 60, 51, 47, 60, 0, 63, -19, 51, 47, -19, 17, 51, +47, 43, -19, 51, 47, -3, 49, 48, 1, 20, 7, 6, 7, 52, 55, 54, 23, 20, 6, 7, 6, 7, 52, 55, 54, +1, -100, 51, 91, -56, 44, 83, -41, 27, 23, 92, -56, 44, 83, 6, 61, 46, 43, 37, 80, 43, 40, 35, 62, 48, +23, 20, 37, 80, 43, 40, 35, 0, 0, 2, 0, 70, 4, -41, 1, -27, 6, 90, 0, 47, 0, 58, 0, -83, 64, +9, 3, 57, 9, 37, 8, 8, 35, 13, 45, -70, 2, -11, 0, 51, -1, -64, -75, 11, 15, 52, 51, 51, 57, -72, +2, -11, -74, 37, 37, 20, 24, 24, 35, 28, -72, 2, -11, -78, 20, 20, 35, -70, 2, -11, 0, 13, 2, -12, 64, +14, 8, 6, 57, 9, 48, 37, 53, 41, 35, 31, 17, 6, 6, 0, -70, 2, -10, 0, 48, -1, -64, -75, 9, 10, +52, 48, 48, 53, -72, 2, -10, 64, 12, 41, 64, 9, 17, 52, 41, 41, 31, 13, 24, 24, 17, -70, 2, -10, 0, +31, -1, -64, -77, 23, 27, 52, 31, -72, -1, -64, -77, 14, 18, 52, 31, 47, 43, 43, -3, 50, 47, 57, 17, 51, +47, 43, -3, 50, 47, 43, -19, 57, 47, 17, 18, 57, 17, 18, 57, 17, 57, 57, 18, 57, 0, 63, -3, 50, 47, +-19, 18, 57, 47, 17, 57, 47, -3, 50, 47, 43, -19, 17, 18, 57, 47, 18, 57, 17, 57, 49, 48, 1, 20, 6, +7, 22, 22, 21, 20, 7, 39, 6, 7, 6, 35, 54, 55, 54, 53, 52, 38, 35, 34, 7, 6, 7, 54, 55, 54, +51, 50, 22, 21, 20, 7, 6, 7, 54, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 7, 52, 38, 35, 34, +21, 20, 23, 22, 23, 54, 1, -27, 22, 22, 14, 18, 7, 86, 46, 58, 71, 87, 40, 4, 12, 20, 19, 20, 18, +7, 20, 7, 11, 20, 46, 34, 38, 4, 7, 3, 69, 63, 17, 16, 26, 39, 43, 53, 27, 38, 71, 24, 20, 22, +18, 5, 30, 13, 6, 26, 37, 65, 34, 10, 23, 13, 47, 41, 67, 54, 30, 36, 66, 9, 27, 24, 24, 37, 24, +10, 35, 70, 31, 55, 66, 42, 21, 21, 29, 15, 20, 47, 16, 17, 29, 32, 47, 47, 52, 38, 85, 23, 38, 28, +18, 20, 6, 27, 19, 0, 0, 2, 0, 70, -2, -10, 1, -100, 0, 91, 0, 7, 0, 15, 0, 69, -71, 0, 8, +2, -11, -78, 10, 10, 12, -70, 2, -11, 0, 14, -1, -64, -74, 9, 15, 52, 14, 14, 4, 0, -72, 2, -11, -78, +2, 2, 6, -70, 2, -11, 0, 4, 2, -9, -76, 0, 8, 8, 4, 12, -72, 1, 36, -123, 47, 60, 51, 47, 60, +0, 63, -19, 51, 47, -19, 17, 51, 47, 43, -3, 50, 47, -19, 49, 48, 37, 20, 7, 6, 7, 52, 55, 54, 23, +20, 7, 6, 7, 52, 55, 54, 1, -100, 52, 90, -56, 44, 83, -41, 52, 90, -56, 44, 83, 91, 47, 44, 35, 81, +44, 40, 34, 59, 47, 45, 35, 82, 43, 42, 35, 0, 1, 0, 70, 5, 98, 1, -100, 6, 49, 0, 7, 0, 35, +-71, 0, 0, 2, -11, -78, 2, 2, 6, -70, 2, -11, 0, 4, 2, -12, -78, 0, 0, 4, -72, 1, 36, -123, 47, +51, 47, 0, 63, -19, 51, 47, -3, 49, 48, 1, 20, 7, 6, 7, 52, 55, 54, 1, -100, 52, 90, -56, 44, 83, +6, 49, 46, 45, 35, 81, 44, 40, 35, 0, 0, 2, 0, 72, 4, -41, 1, -83, 6, -118, 0, 29, 0, 40, 0, +-118, -75, 26, 39, 4, 13, 3, 20, -70, 2, -11, 0, 33, -1, -64, 64, 10, 11, 13, 52, 33, 33, 39, 3, 3, +9, 39, -72, 2, -11, -78, 13, 13, 9, -72, 2, -12, 64, 12, 3, 0, 23, 13, 4, 39, 3, 30, 36, 0, 0, +23, -72, 2, -10, -77, 30, 30, 36, 8, -72, 2, -10, -78, 9, 9, 17, -70, 2, -10, 0, 36, -1, -64, -77, 26, +28, 52, 36, -72, -1, -64, -77, 19, 21, 52, 36, -72, -1, -64, -77, 14, 16, 52, 36, -72, 1, 29, -123, 47, 43, +43, 43, -3, 50, 47, -19, 17, 51, 47, -3, 50, 47, 17, 18, 23, 57, 17, 18, 57, 0, 63, 51, 47, -19, 18, +57, 47, 17, 51, 47, 43, -19, 17, 18, 57, 17, 57, 49, 48, 1, 20, 6, 7, 39, 6, 7, 6, 35, 35, 54, +55, 54, 55, 38, 39, 38, 53, 52, 54, 51, 50, 22, 21, 20, 6, 7, 22, 23, 22, 39, 52, 38, 35, 34, 6, +21, 20, 23, 23, 54, 1, -83, 6, 3, 83, 50, 18, 74, 50, 73, 53, 71, 64, 33, 31, 16, 20, 77, 45, 26, +42, 11, 20, 16, 17, 11, 75, 38, 18, 10, 11, 25, 44, 8, 5, 125, 17, 36, 18, 50, 55, 18, 72, 25, 56, +51, 39, 19, 21, 26, 31, 66, 101, 56, 40, 19, 41, 55, 14, 13, 11, 93, 27, 46, 14, 7, 22, 24, 34, 20, +0, 0, 1, 0, 70, -1, -43, 1, -100, 0, -92, 0, 7, 0, 35, -71, 0, 0, 2, -11, -78, 2, 2, 6, -70, +2, -11, 0, 4, 2, -8, -78, 0, 0, 4, -72, 1, 36, -123, 47, 51, 47, 0, 63, -19, 51, 47, -19, 49, 48, +37, 20, 7, 6, 7, 52, 55, 54, 1, -100, 52, 90, -56, 44, 83, -92, 48, 44, 35, 80, 43, 40, 34, 0, 1, +0, 70, 4, -41, 1, -79, 6, 25, 0, 40, 0, -121, 64, 27, 7, 24, 4, 37, 38, 33, 28, 29, 17, 24, 29, +29, 18, 38, 64, 9, 10, 52, 38, 38, 15, 18, 1, 18, 18, 24, 33, -72, 2, -11, -78, 4, 4, 24, -70, 2, +-11, 0, 11, 2, -12, -73, 7, 29, 28, 21, 18, 17, 0, 38, -72, 2, -7, -76, 37, 37, 29, 14, 17, -72, 2, +-7, -78, 18, 18, 29, -70, 2, -7, 0, 28, -1, -64, -77, 21, 23, 52, 28, -72, -1, -64, -77, 13, 16, 52, 28, +47, 43, 43, -19, 51, 47, -3, 50, 17, 51, 47, -3, 50, 17, 18, 57, 17, 18, 57, 0, 63, -19, 57, 47, -19, +17, 51, 47, 93, 51, 47, 43, 18, 57, 47, 17, 57, 18, 57, 17, 18, 57, 17, 18, 57, 49, 48, 1, 20, 7, +6, 35, 34, 38, 39, 6, 7, 6, 35, 34, 38, 53, 52, 54, 55, 55, 20, 6, 21, 20, 22, 51, 50, 55, 54, +55, 55, 22, 23, 22, 51, 50, 55, 54, 53, 55, 22, 22, 1, -79, 26, 29, 51, 18, 30, 19, 21, 18, 32, 35, +42, 42, 14, 13, 21, 4, 18, 18, 43, 26, 12, 18, 21, 8, 5, 12, 28, 38, 22, 18, 21, 4, 7, 5, -59, +75, 48, 54, 12, 13, 36, 18, 32, 57, 50, 26, 50, 32, 9, 8, 36, 12, 22, 35, 56, 26, 75, 6, 49, 11, +31, 50, 40, 43, 6, 19, 47, 0, 0, 2, 0, 70, 4, -41, 1, 81, 6, 13, 0, 11, 0, 24, 0, 45, -71, +0, 9, 2, -11, -78, 15, 15, 22, -68, 2, -11, 0, 3, 2, -12, 0, 0, 2, -10, -78, 12, 12, 6, -70, 2, +-6, 0, 18, 1, 29, -123, 47, -19, 51, 47, -19, 0, 63, -3, 50, 47, -19, 49, 48, 1, 20, 6, 35, 34, 38, +53, 52, 54, 51, 50, 22, 7, 52, 38, 35, 34, 6, 21, 20, 23, 22, 51, 50, 54, 1, 81, 92, 67, 54, 54, +80, 59, 54, 74, 60, 78, 27, 26, 36, 33, 26, 49, 25, 34, 5, 119, 62, 98, 60, 54, 77, 119, 90, 87, 28, +68, 45, 24, 35, 14, 11, 14, 0, 1, 1, 124, 1, -64, 2, -63, 3, -99, 0, 13, 0, 29, 64, 14, 10, 10, +3, 10, 32, 16, 19, 52, 3, 10, 7, 0, 0, 7, 47, 51, 47, 18, 57, 57, 43, 0, 47, 51, 47, 49, 48, +1, 6, 6, 7, 38, 39, 38, 39, 54, 54, 55, 22, 23, 22, 2, -63, 28, 28, 19, 85, 48, 32, 85, 21, 35, +34, 56, 57, 38, 2, -24, 87, 108, 101, 48, 34, 23, 68, 91, 118, 95, 49, 44, 29, 0, 0, 1, 1, 46, 1, +37, 2, -98, 5, -69, 0, 19, 0, 59, -78, 13, 13, 14, -68, 2, -14, 0, 5, 2, -21, 0, 18, -1, -16, 64, +16, 9, 18, 52, 7, 4, 14, 14, 5, 13, 64, 11, 29, 52, 13, 13, 4, -71, 2, -5, 0, 5, 47, -19, 51, +47, 43, 25, 18, 57, 47, 17, 57, 43, 0, 24, 63, 63, 57, 47, 49, 48, 1, 1, 20, 7, 6, 7, 35, 52, +55, 52, 39, 38, 39, 38, 39, 55, 22, 23, 22, 23, 22, 2, -98, 14, 3, 25, 34, 4, 58, 45, 79, 40, 74, +96, 79, 48, 68, 35, 42, 2, -57, 90, 119, 29, -76, 24, 115, -44, -72, -113, 126, 64, 90, -40, 95, 81, 115, -128, +-104, 0, 0, 1, 0, -73, 1, 37, 3, 33, 5, -56, 0, 32, 0, 127, -79, 6, 4, -72, 2, -17, 64, 12, 25, +64, 14, 17, 52, 25, 25, 21, 20, 20, 15, 21, -68, 2, -14, 0, 29, 2, -14, 0, 15, 2, -21, -75, 17, 64, +14, 24, 52, 9, -72, -1, -12, -77, 9, 17, 52, 29, -72, 2, -5, -77, 30, 30, 14, 6, -72, -1, -42, 64, 15, +14, 17, 52, 6, 21, 21, 15, 20, 64, 11, 29, 52, 20, 20, 14, -71, 2, -5, 0, 15, 47, -19, 51, 47, 43, +25, 18, 57, 47, 57, 43, 17, 51, 24, 47, -19, 43, 43, 0, 63, 63, 63, 18, 57, 47, 17, 57, 47, 43, -3, +57, -79, 6, 2, 67, 84, 88, -76, 20, 64, 15, 17, 52, 0, 43, 89, 49, 48, 1, 20, 7, 6, 35, 34, 39, +22, 23, 22, 22, 21, 20, 6, 21, 35, 2, 39, 38, 38, 39, 55, 22, 23, 22, 51, 50, 55, 54, 55, 55, 22, +22, 3, 33, 52, 57, 104, 13, 56, 38, 16, 27, 28, 4, 30, 76, 25, 48, -125, -125, 66, 67, 52, 95, 106, 112, +43, 24, 13, 32, 4, 4, 5, 27, 110, 66, 72, 8, 80, 47, 79, -44, -78, 31, -115, 6, 1, 67, 85, -90, -9, +-92, -54, 95, 46, 84, 75, 41, 107, 2, 35, 93, 0, 1, 0, -127, 1, 37, 3, -60, 5, -56, 0, 41, 0, -106, +-73, 21, 32, 14, 17, 52, 6, 28, 3, -72, 2, -17, -77, 36, 36, 24, 9, -72, 2, -17, 64, 11, -113, 28, 1, +28, 28, 18, 23, 23, 24, 18, 38, 65, 9, 2, -14, 0, 32, 2, -14, 0, 24, 2, -14, 0, 18, 2, -21, 0, +32, 2, -5, -77, 33, 33, 17, 39, -70, 2, -5, 0, 38, -1, -64, 64, 23, 12, 18, 52, 38, 38, 14, 17, -128, +9, 1, 9, 23, 24, 24, 18, 23, 64, 10, 29, 52, 23, 23, 17, -70, 2, -5, 0, 18, -1, -64, -77, 9, 12, +52, 18, 47, 43, -19, 51, 47, 43, 25, 18, 57, 47, 17, 57, 93, 17, 51, 51, 24, 47, 43, -19, 18, 57, 47, +-19, 0, 63, 63, 63, 63, 17, 18, 57, 47, 17, 57, 47, 93, -19, 18, 57, 47, -3, 17, 57, 49, 48, 1, 43, +1, 20, 6, 35, 34, 38, 39, 6, 6, 35, 22, 23, 22, 22, 21, 20, 6, 7, 35, 52, 2, 39, 38, 39, 55, +22, 23, 22, 51, 50, 55, 54, 55, 51, 22, 22, 51, 50, 55, 51, 20, 22, 3, -60, 95, 99, 57, 84, 20, 34, +104, 73, 37, 16, 29, 31, 11, 24, 40, 56, 68, 52, -125, 73, 52, 60, 67, 82, 85, 48, 41, 16, 32, 8, 56, +52, 105, 20, 33, 5, 5, 99, 125, -124, 36, 37, 56, 57, 73, 39, 71, -96, 113, 63, 117, -103, -36, 1, 26, -123, +101, -63, -19, 86, 44, 49, 58, 50, 92, 92, 74, -90, 22, 73, 0, 1, 1, 44, 1, 37, 3, 46, 5, -75, 0, +43, 0, 114, -77, -124, 31, 1, 31, -72, -1, -64, -77, 11, 17, 52, 32, -72, -1, -64, -73, 10, 17, 52, 32, 13, +13, 0, 24, -66, 2, -17, 0, 23, 2, -14, 0, 0, 2, -17, 0, 1, 2, -21, -74, 1, 0, 0, 24, 23, 23, +34, -72, 2, -4, -77, 13, 13, 40, 17, -72, 2, -4, -78, 28, 28, 7, -70, 2, -4, 0, 40, 1, 46, -123, 47, +-3, 57, 47, -19, 17, 51, 47, -19, 57, 47, 51, 50, 47, 51, 0, 63, -19, 63, -19, 17, 57, 47, 57, 43, -79, +6, 2, 67, 84, 88, -78, 9, 13, 1, 0, 93, 89, 49, 48, 1, 43, 93, 1, 7, 34, 39, 38, 39, 38, 53, +52, 55, 54, 55, 54, 55, 38, 39, 38, 53, 52, 55, 54, 55, 54, 55, 7, 6, 7, 6, 21, 20, 23, 22, 23, +22, 21, 20, 7, 6, 7, 6, 21, 20, 23, 22, 3, 46, 63, 90, 83, 110, 67, 82, 35, 30, 62, 33, 92, 85, +85, 101, 74, 57, 109, 76, 93, 31, 111, 37, 88, 75, 70, 71, 76, 68, 63, 63, 68, -119, 89, 1, -17, -54, 13, +17, 34, 41, 61, 57, 60, 51, 66, 35, 87, 32, 33, 45, 46, 76, 100, 77, 98, 68, 71, -64, 41, 18, 43, 36, +32, 33, 27, 26, 31, 26, 29, 72, 66, 65, 77, 41, 48, 32, 21, 0, 0, 2, 0, -66, 1, -6, 3, -128, 4, +-7, 0, 16, 0, 33, 0, 64, 64, 16, 20, 64, 14, 17, 52, 25, 32, 14, 17, 52, 20, 64, 9, 17, 52, 14, +-72, 2, -17, -78, 23, 23, 31, -69, 2, -17, 0, 4, 0, 0, 2, -2, -78, 17, 17, 8, -70, 2, -3, 0, 27, +1, 52, -123, 47, -19, 51, 47, -19, 0, 47, -3, 50, 47, -19, 49, 48, 1, 43, 43, 0, 43, 1, 20, 7, 6, +35, 34, 39, 38, 53, 52, 55, 54, 55, 54, 51, 50, 22, 7, 52, 39, 38, 39, 38, 35, 34, 7, 6, 21, 20, +23, 22, 51, 50, 54, 3, -128, 103, 117, -41, 121, 70, 80, 44, 50, 70, 86, 92, 118, -10, 74, 80, 67, 101, 93, +47, 66, 44, 36, 69, 63, 124, 122, -100, 3, -103, -83, 113, -127, 42, 48, 91, 81, -121, -104, 98, 120, -18, -36, 57, +66, 55, 45, 41, 90, 73, 72, 82, 38, 35, 73, 0, 1, 0, -81, 1, 64, 3, 71, 5, -81, 0, 40, 0, 111, +-71, 0, 40, -1, -32, -77, 12, 17, 52, 39, -72, -1, -24, -74, 9, 17, 52, 31, 22, 11, 15, -72, 2, -1, -77, +27, 27, 22, 0, -72, -1, -64, -74, 14, 17, 52, 0, 0, 1, 22, -68, 2, -14, 0, 1, 2, -21, 0, 23, 2, +-5, -74, 22, 22, 7, 31, 1, 11, 7, -72, 2, -2, 64, 11, 35, 64, 16, 17, 52, 35, 35, 1, 0, 0, 1, +25, 47, 51, 24, 47, 17, 51, 47, 43, -3, 57, 18, 57, 17, 51, 47, -19, 0, 63, 63, 18, 57, 47, 43, 17, +57, 47, -3, 57, 18, 57, 49, 48, 1, 43, 43, 1, 7, 38, 39, 38, 39, 38, 53, 52, 55, 54, 55, 6, 7, +6, 35, 34, 39, 38, 53, 52, 54, 53, 55, 22, 23, 22, 51, 50, 55, 54, 55, 6, 7, 6, 21, 20, 23, 22, +23, 22, 3, 71, 38, 65, 33, 56, 29, 36, 5, 1, 21, 48, 23, 74, 47, -100, 48, 38, 6, 36, 24, 22, 46, +106, 79, 99, 22, 85, 17, 7, 12, 28, 22, 46, 16, 2, 36, -28, 43, 37, 61, 91, 111, -93, 58, 61, 17, -74, +9, 4, 14, 32, 25, 78, 33, -124, 34, 4, 55, 18, 37, 19, 4, 19, 103, 51, 87, 65, -95, 110, 87, 72, 25, +0, 0, 1, 0, -127, 1, 37, 3, -84, 5, -81, 0, 17, 0, -123, 64, 32, 12, 32, 14, 17, 52, 3, 38, 14, +17, 52, 3, 52, 9, 13, 52, 1, 1, 0, 8, 64, 14, 17, 52, 8, 64, 10, 17, 52, 8, 8, 9, 0, -70, +2, -14, 0, 9, 2, -14, -75, 13, 32, 9, 13, 52, 13, -70, 2, -1, 0, 5, 2, -21, 64, 11, 14, 13, 5, +8, 9, 1, 0, 0, 9, 4, 5, -72, 1, 71, -123, 25, 47, 51, 51, 51, 47, 51, 47, 51, 17, 51, 51, 0, +24, 63, -19, 43, 63, 63, 17, 57, 47, 43, 43, 18, 57, 47, -79, 6, 2, 67, 84, 88, 64, 15, 13, -56, 15, +17, 52, 13, -106, 14, 14, 52, 13, 64, 9, 13, 52, 0, 43, 43, 43, 89, 49, 48, 1, 43, 43, 43, 1, 3, +6, 2, 3, 35, 2, 2, 39, 19, 22, 23, 22, 19, 51, 18, 55, 54, 3, -84, 8, -108, -82, 41, 14, 64, -57, +-93, 36, -101, 101, 98, 63, 10, 39, 89, 86, 5, -81, -2, -31, -105, -2, 94, -2, -50, 1, 51, 1, -124, -110, 1, +61, -75, -47, -53, -2, -8, 1, 22, -39, -46, 0, 0, 1, 0, -102, 1, 49, 3, -58, 5, -69, 0, 22, 0, -109, +64, 19, 6, 84, 14, 17, 52, 19, 38, 14, 17, 52, 19, 52, 9, 13, 52, 12, 12, 11, 0, -72, -1, -64, -77, +14, 17, 52, 0, -72, -1, -64, -75, 10, 17, 52, 0, 0, 1, -68, 2, -21, 0, 11, 2, -21, 0, 4, -1, -32, +-77, 9, 13, 52, 4, -70, 2, -1, 0, 17, 2, -14, 64, 11, 5, 4, 17, 12, 11, 0, 1, 1, 11, 16, 17, +-72, 1, 71, -123, 25, 47, 51, 51, 51, 47, 51, 47, 51, 17, 51, 51, 0, 24, 63, -19, 43, 63, 63, 57, 47, +43, 43, 18, 57, 47, -79, 6, 2, 67, 84, 88, -71, 0, 4, -1, 56, -77, 15, 17, 52, 4, -72, -1, 106, -77, +14, 14, 52, 4, -72, -1, -64, -78, 9, 13, 52, 0, 43, 43, 43, 89, 49, 48, 1, 43, 43, 43, 1, 3, 38, +2, 39, 35, 6, 7, 6, 7, 6, 7, 17, 54, 55, 54, 19, 51, 22, 23, 22, 23, 22, 3, -58, 36, -108, -34, +49, 7, 43, 32, 42, 60, 63, 110, -112, 89, 86, 50, 19, 51, 63, 59, 80, 66, 2, 115, -2, -60, -103, 1, -56, +-3, -31, 114, -105, 118, 124, -120, 1, 30, -123, -43, -49, 1, 67, -18, -98, -108, 110, 90, 0, 0, 2, 0, -37, 1, +37, 3, 77, 5, -52, 0, 26, 0, 39, 0, 106, -71, 0, 26, -1, -32, 64, 13, 12, 17, 52, 3, 16, 9, 10, +52, 27, 31, 5, 37, 0, -72, -1, -64, -74, 15, 17, 52, 0, 0, 1, 8, -72, 2, -17, -77, 37, 37, 1, 31, +-66, 2, -17, 0, 17, 2, -14, 0, 1, 2, -21, 0, 11, 2, -3, -78, 34, 34, 27, -70, 2, -3, 0, 5, 2, +-3, -75, 23, 23, 1, 0, 0, 1, 25, 47, 51, 24, 47, 17, 51, 47, -19, -3, 50, 47, -19, 0, 63, 63, -19, +17, 57, 47, -19, 17, 57, 47, 43, 17, 57, 18, 57, 49, 48, 1, 43, 43, 1, 7, 38, 39, 38, 17, 6, 6, +35, 34, 38, 53, 52, 55, 54, 55, 54, 51, 50, 23, 22, 23, 22, 21, 22, 23, 22, 3, 52, 39, 38, 35, 34, +6, 21, 20, 22, 51, 50, 54, 3, 77, 61, 100, 32, 26, 68, 68, 33, 109, -127, 30, 38, 64, 82, 111, 83, 43, +35, 11, 7, 20, 34, 15, -82, 23, 31, 80, 60, 112, 98, 70, 30, 86, 1, -6, -43, 61, -112, 118, 1, 45, 24, +14, 90, 84, 62, 91, 116, 71, 91, 87, 70, -117, 86, -88, -26, 93, 41, 2, 10, 91, 47, 64, 90, 39, 42, 46, +12, 0, 0, 3, 0, -123, 0, -84, 3, -76, 6, 56, 0, 11, 0, 15, 0, 27, 0, 80, 64, 9, 15, 2, 15, +27, 52, 6, 13, 1, 3, -72, 2, -18, -77, 9, 9, 15, 25, -72, 2, -18, -77, 19, 19, 14, 22, -72, 2, -19, +-78, 16, 16, 15, -72, 3, 0, -77, 12, 12, 29, 0, -72, 2, -19, -78, 6, 6, 13, -71, 3, 0, 0, 14, 47, +-19, 57, 47, -19, 17, 51, 47, -3, 57, 47, -19, 0, 47, 51, 47, -19, 47, 51, 47, -19, 49, 48, 1, 93, 43, +1, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 37, 1, 35, 1, 19, 20, 6, 35, 34, 38, 53, 52, 54, +51, 50, 22, 1, -76, 76, 55, 54, 77, 76, 55, 55, 76, 2, 0, -3, 62, 109, 2, -68, 68, 76, 56, 55, 74, +75, 54, 54, 78, 5, -71, 55, 78, 79, 54, 53, 74, 72, 71, -6, -122, 5, 122, -6, -9, 54, 76, 76, 54, 54, +79, 78, 0, 0, 1, 0, -63, 0, 48, 1, -41, 2, 34, 0, 20, 0, 57, -71, 0, 18, -1, -64, -75, 12, 17, +52, 18, 7, 6, -72, -1, -64, -74, 12, 14, 52, 6, 6, 18, 11, -72, 2, -20, 64, 9, 7, 6, 6, 11, 11, +15, 0, 0, 15, 47, 51, 47, 18, 57, 47, 57, 47, 51, 0, 63, 51, 51, 47, 43, 51, 47, 43, 49, 48, 1, +20, 7, 6, 7, 6, 7, 39, 54, 55, 54, 53, 38, 39, 38, 53, 52, 54, 51, 50, 22, 1, -41, 38, 31, 59, +34, 74, 42, 69, 23, 41, 49, 37, 41, 75, 54, 57, 86, 1, -102, 85, 73, 59, 57, 33, 55, 55, 55, 25, 45, +40, 19, 32, 36, 60, 54, 77, 80, 0, 2, 0, -77, 3, 58, 3, 100, 5, -12, 0, 103, 0, 115, 1, 28, -71, +0, 13, -1, -32, -77, 11, 16, 52, 35, -72, -1, -32, 64, 50, 11, 16, 52, 13, 35, 24, 3, 48, 30, 113, 101, +54, 107, 89, 32, 11, 16, 52, 66, 32, 11, 16, 52, 89, 66, 71, 78, 24, 24, 44, 57, 6, 97, 4, 107, 31, +42, 15, 7, 4, 113, 30, 70, 85, 59, 96, 4, 107, 71, 30, -68, 2, -5, 0, 17, 2, -5, 0, 113, -1, -64, +-75, 10, 13, 52, 113, 113, 84, -70, 2, -5, 0, 71, 2, -5, -75, 31, 107, 1, 107, 107, 78, -72, 2, -14, 64, +25, 10, 32, 11, 16, 52, 92, 32, 11, 16, 52, 10, 92, 95, 0, 1, 0, 0, 81, 21, 97, 104, 75, 27, 110, +63, -72, -1, -32, -77, 11, 16, 52, 38, -72, -1, -32, 64, 30, 11, 16, 52, 63, 38, 44, 80, 51, 1, 51, 51, +70, 71, 84, 85, 15, 17, 30, 31, 8, 110, 7, 96, 97, 104, 59, 42, 110, 44, 6, -70, 2, -5, 0, 97, 2, +-5, -73, 104, 64, 10, 12, 52, 104, 104, 57, -68, 2, -5, 0, 44, 2, -5, 0, 110, 1, 64, -123, 47, -27, -27, +51, 47, 43, -27, -27, 17, 18, 57, 57, 17, 18, 57, 57, 18, 23, 57, 50, 47, 113, 18, 57, 57, 43, 43, 17, +57, 57, 17, 18, 57, 57, 51, 47, 113, 57, 57, 43, 43, 0, 63, 51, 47, 93, -27, -27, 51, 47, 43, -27, -27, +17, 18, 23, 57, 17, 18, 23, 57, 17, 23, 57, 50, 47, 17, 18, 57, 57, 43, 43, 17, 57, 57, 17, 18, 57, +57, 17, 57, 57, 43, 43, 49, 48, 1, 20, 6, 35, 34, 39, 39, 7, 23, 22, 21, 20, 6, 35, 34, 39, 6, +7, 22, 23, 22, 21, 20, 6, 35, 34, 38, 53, 52, 54, 55, 39, 6, 7, 6, 35, 34, 38, 53, 52, 55, 54, +55, 38, 39, 6, 7, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 23, 54, 55, 38, 39, 38, 53, 52, 54, 51, +50, 23, 22, 23, 55, 38, 39, 38, 53, 52, 54, 51, 50, 22, 21, 20, 6, 7, 23, 54, 55, 54, 51, 50, 22, +21, 20, 7, 6, 7, 23, 54, 55, 54, 51, 50, 22, 5, 52, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 3, +100, 44, 33, 53, 74, 74, 10, 118, 86, 37, 28, 52, 106, 9, 12, 22, 9, 17, 33, 32, 31, 33, 36, 18, 27, +34, 33, 46, 48, 28, 36, 86, 8, 113, 8, 3, 67, 33, 59, 43, 33, 43, 42, 34, 44, 107, 51, 3, 8, 61, +60, 86, 36, 28, 47, 46, 40, 28, 25, 2, 23, 27, 33, 31, 32, 33, 37, 17, 27, 63, 3, 46, 46, 29, 36, +85, 73, 46, 10, 65, 33, 60, 43, 35, 42, -2, -49, 22, 18, 17, 22, 22, 17, 17, 23, 4, -106, 29, 36, 25, +26, 30, 58, 47, 54, 28, 39, -49, 6, 3, 68, 34, 60, 44, 30, 40, 39, 31, 45, 110, 51, 9, 64, 63, 80, +38, 29, 54, 46, 4, 55, 16, 14, 23, 10, 18, 35, 30, 31, 36, 37, 18, 16, 18, 28, 29, 45, 54, 29, 40, +80, 76, 52, 8, 9, 67, 81, 49, 30, 43, 42, 31, 45, 109, 50, 10, 122, 5, 81, 40, 29, 53, 45, 36, 22, +34, 24, 11, 20, 35, 32, 18, 22, 22, 18, 16, 24, 23, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, +3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, +-5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, +17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, +0, 54, 1, 10, 2, 24, 3, 113, 0, 17, 0, 31, 0, 80, 64, 9, 22, 32, 13, 17, 52, 12, 22, 29, 14, +-72, 2, -17, -78, 13, 13, 29, -70, 2, -17, 0, 4, 2, -21, 64, 9, 22, 18, 12, 13, 8, 14, 14, 26, 18, +-72, 2, -3, -77, 0, 0, 33, 26, -70, 2, -3, 0, 8, 1, 40, -123, 47, -19, 17, 51, 47, -19, 25, 17, 57, +47, 18, 57, 57, 18, 57, 0, 24, 63, -3, 50, 47, -20, 18, 57, 57, 43, 49, 48, 1, 20, 7, 6, 35, 34, +39, 38, 53, 52, 55, 54, 55, 39, 55, 22, 23, 22, 7, 52, 39, 38, 39, 6, 7, 6, 21, 20, 22, 51, 50, +54, 2, 24, 46, 71, -67, 73, 48, 55, 35, 32, 33, 15, 61, -75, 35, 120, 87, 110, 47, 54, 45, 9, 28, 57, +48, 56, -124, 2, 76, -115, 71, 110, 29, 33, 61, 70, 92, 78, 79, 4, -87, 95, 25, 84, -89, 38, 63, 27, 26, +49, 12, 39, 35, 51, 57, 63, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +1, 0, -98, 1, 45, 3, -92, 5, -61, 0, 44, 0, -73, -71, 0, 18, -1, -32, -74, 16, 17, 52, 11, 12, 25, +4, -72, -1, -32, 64, 11, 9, 17, 52, 4, 19, 16, 26, 25, 32, 29, 25, -72, -1, -64, 64, 10, 9, 14, 52, +25, 25, 22, 16, 16, 7, 29, -72, 2, -17, -75, 0, 22, 1, 22, 22, 7, -72, 2, -14, -77, 0, 0, 39, 1, +-70, 2, -14, 0, 39, 2, -21, 64, 10, 12, 11, 11, 19, 36, 26, 38, 32, 0, 19, -72, 2, -5, -76, 4, 4, +38, 0, 25, -72, 2, -5, 64, 16, 26, 26, 32, 38, 0, 1, 1, 39, 0, 64, 12, 29, 52, 0, 0, 38, -72, +2, -5, -77, 48, 39, 1, 39, 47, 93, -19, 51, 47, 43, 25, 18, 57, 47, 17, 18, 57, 50, 24, 47, -19, 17, +18, 57, 47, -19, 18, 57, 17, 18, 57, 17, 57, 47, 51, 0, 63, 63, 18, 57, 47, 63, 57, 47, 93, -19, 18, +57, 47, 18, 57, 47, 43, 17, 57, 17, 57, 17, 57, 57, 43, 18, 57, 57, 49, 48, 1, 43, 19, 55, 22, 22, +23, 54, 54, 51, 50, 23, 22, 23, 7, 38, 39, 38, 35, 34, 6, 7, 22, 22, 51, 50, 54, 55, 23, 6, 6, +35, 34, 38, 39, 22, 23, 22, 21, 20, 7, 35, 52, 39, 38, 39, 38, -98, 75, 90, 74, 71, 14, 95, 91, 61, +49, 45, 49, 8, 5, 33, 49, 46, 93, 113, 29, 51, 73, 31, 82, 114, 62, 23, 28, -101, 122, 59, 69, 40, 42, +12, 9, 51, 35, 39, 34, 68, 54, 4, -53, -16, -94, 96, 42, -93, -111, 30, 27, 60, 12, 1, 11, 16, 105, 116, +16, 15, 56, 75, 8, -109, -102, 21, 29, 96, 65, 50, 107, -114, -23, -37, -76, -97, -114, 113, 0, 0, 2, 0, -104, +1, 70, 3, -121, 5, -86, 0, 22, 0, 44, 0, 123, 64, 25, 35, 32, 11, 17, 52, 31, 32, 11, 17, 52, 23, +33, 22, 3, 0, 26, 12, 42, 9, 0, 64, 14, 17, 52, 0, -68, 2, -1, 0, 1, 2, -14, 0, 26, 2, -1, +-78, 9, 9, 42, -70, 2, -1, 0, 15, 2, -21, 64, 16, 23, 12, 33, 22, 42, 11, 17, 52, 22, 22, 29, 0, +1, 1, 19, 29, -72, 2, -2, -77, 5, 5, 46, 39, -70, 2, -4, 0, 19, 1, 44, -123, 47, -19, 17, 51, 47, +-19, 25, 18, 57, 47, 51, 18, 57, 47, 43, 51, 57, 57, 0, 24, 63, -19, 57, 47, -19, 63, -19, 43, 17, 18, +57, 17, 18, 23, 57, 49, 48, 1, 43, 43, 1, 55, 22, 23, 22, 21, 20, 7, 6, 35, 34, 38, 39, 6, 6, +35, 34, 39, 38, 53, 52, 18, 55, 19, 22, 22, 51, 50, 54, 53, 52, 39, 38, 39, 6, 7, 6, 7, 6, 21, +20, 22, 51, 50, 54, 1, -82, 66, -46, 105, 92, 65, 74, 107, 28, 48, 28, 44, 89, 47, 95, 61, 65, -94, -60, +80, 22, 77, 40, 48, 65, 87, 80, -115, 41, 48, 64, 39, 49, 68, 61, 43, 71, 4, -49, -37, -47, -48, -74, -105, +120, 105, 119, 14, 23, 37, 30, 52, 55, 95, 113, 1, 29, -28, -3, -44, 23, 32, 51, 39, 74, -121, 124, -98, 43, +67, 89, 82, 103, 74, 64, 74, 28, 0, 1, 0, -53, 1, 45, 3, 123, 5, -67, 0, 35, 0, 121, -75, 21, 32, +14, 22, 52, 10, -72, -1, -32, -74, 11, 17, 52, 15, 16, 19, 29, -72, 2, -17, -74, 28, 28, 25, 19, 19, 12, +3, -72, 2, -17, -77, 25, 25, 0, 12, -70, 2, -14, 0, 0, 2, -21, 64, 21, 3, 64, 15, 16, 52, 3, 64, +11, 13, 52, 3, 28, 35, 16, 15, 15, 29, 28, 28, 35, 22, -72, 2, -13, -78, 6, 6, 35, -70, 2, -5, 0, +0, 1, 34, -123, 47, -19, 51, 47, -19, 17, 51, 47, 51, 57, 47, 51, 17, 18, 57, 43, 43, 0, 63, 63, 18, +57, 47, -19, 18, 57, 47, 18, 57, 47, -19, 18, 57, 57, 49, 48, 1, 43, 43, 1, 52, 18, 55, 34, 38, 53, +52, 54, 55, 54, 54, 51, 50, 22, 23, 7, 38, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 55, 7, 6, 7, +6, 7, 6, 7, 1, 88, 71, 81, -107, -112, 78, 75, 59, 118, 45, 53, 115, 75, 10, 73, 77, 49, 125, -107, 108, +95, 86, -115, 123, 45, 98, 94, 104, 68, 77, 20, 1, 45, -85, 1, 46, -123, 63, 62, 47, -111, 89, 74, 82, 86, +95, 10, 25, 16, 67, 50, 54, 60, 34, 56, -65, 34, 88, 97, -121, -104, -76, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, +0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, +-64, 0, 0, 3, 0, 70, 4, -41, 1, -79, 7, 87, 0, 7, 0, 16, 0, 58, 0, -50, -71, 0, 0, 2, -11, +-78, 2, 2, 6, -72, 2, -11, 64, 9, 4, 64, 9, 14, 52, 4, 4, 15, 8, -72, 2, -11, -78, 11, 11, 15, +-72, 2, -11, 64, 27, 13, 64, 9, 17, 52, 13, 13, 36, 24, 42, 21, 55, 56, 51, 46, 47, 35, 42, 47, 47, +36, 56, 56, 36, 36, 42, 51, -72, 2, -11, -78, 21, 21, 42, -70, 2, -11, 0, 28, 2, -12, -76, 0, 8, 8, +4, 13, -72, -1, -63, 64, 12, 15, 16, 52, 13, 24, 47, 46, 39, 36, 35, 17, 56, -72, 2, -7, -76, 55, 55, +47, 31, 35, -72, 2, -7, -78, 36, 36, 47, -70, 2, -7, 0, 46, -1, -64, -77, 21, 23, 52, 46, -72, -1, -64, +-77, 13, 16, 52, 46, -72, 1, 36, -123, 47, 43, 43, -19, 51, 47, -3, 50, 17, 51, 47, -3, 50, 17, 18, 57, +17, 18, 57, 47, 43, 60, 51, 47, 60, 0, 63, -19, 57, 47, -19, 17, 51, 47, 50, 47, 18, 57, 47, 17, 57, +18, 57, 17, 18, 57, 17, 18, 57, 17, 51, 47, 43, -19, 51, 47, -19, 17, 51, 47, 43, -19, 51, 47, -19, 49, +48, 1, 20, 7, 6, 7, 52, 55, 54, 23, 20, 6, 7, 6, 7, 52, 55, 54, 23, 20, 7, 6, 35, 34, 38, +39, 6, 7, 6, 35, 34, 38, 53, 52, 55, 54, 55, 55, 20, 6, 21, 20, 22, 51, 50, 55, 54, 55, 55, 22, +23, 22, 51, 50, 55, 54, 53, 55, 22, 22, 1, -100, 51, 91, -56, 44, 83, -41, 27, 23, 92, -56, 44, 83, -20, +26, 29, 51, 17, 33, 17, 20, 19, 32, 35, 41, 43, 8, 5, 14, 21, 4, 18, 18, 43, 26, 12, 18, 21, 9, +4, 12, 28, 38, 22, 18, 21, 4, 7, 7, 87, 46, 43, 37, 80, 43, 40, 35, 62, 48, 23, 20, 37, 80, 43, +40, 35, -94, 76, 48, 54, 13, 12, 34, 19, 32, 57, 49, 26, 29, 18, 36, 8, 8, 36, 12, 22, 35, 56, 25, +75, 7, 49, 11, 32, 50, 41, 45, 6, 19, 49, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, +0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, +3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, +7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, +32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, +33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, +0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, +32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, +0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, +0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, +37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 1, -1, +-70, 1, 37, 5, 27, 1, -45, 0, 3, 0, 24, -67, 0, 2, 2, -17, 0, 1, 2, -21, 0, 0, 2, -16, -79, +5, 1, 47, 16, -28, 0, 63, -19, 49, 48, 1, 33, 53, 33, 5, 27, -6, -97, 5, 97, 1, 37, -82, 0, 0, +2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, +4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 4, 0, 58, -2, -103, 5, -75, 3, -64, 0, 28, 0, 32, 0, 36, 0, 40, 0, -18, -75, 36, 16, 18, 21, +52, 30, -72, -1, -16, -77, 18, 21, 52, 40, -72, -1, -16, -77, 18, 21, 52, 16, -72, -1, -64, 64, 11, 14, 17, +52, 22, 52, 12, 17, 52, 33, 35, 34, -72, 3, 2, -75, 36, 36, 30, 37, 39, 38, -72, 3, 2, -76, 40, 40, +29, 31, 30, -72, 3, 2, 64, 12, 111, 32, 1, -33, 32, 1, 32, 32, 1, 10, 18, 9, 65, 9, 3, 4, 0, +23, 2, -17, 0, 24, 3, 4, 0, 18, 2, -17, 0, 1, 2, -21, -78, 34, 36, 33, -72, 3, 1, -75, 35, 35, +37, 30, 32, 29, -72, 3, 1, -76, 31, 31, 38, 40, 39, -72, 3, 1, -73, 37, 37, 5, 24, 24, 23, 23, 19, +65, 10, 3, 3, 0, 64, 0, 0, 2, -16, 0, 42, 0, 10, 2, -5, 0, 32, 0, 9, -1, -64, -75, 9, 11, +52, 9, 9, 14, -70, 3, 3, 0, 5, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -12, 26, -3, +50, 47, 25, 57, 47, 24, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 0, 63, +-19, 63, -19, 63, 18, 57, 17, 51, 47, 93, 113, -3, 57, 57, 51, 47, -3, 57, 57, 17, 51, 47, -3, 57, 57, +49, 48, 1, 43, 43, 43, 43, 43, 1, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 7, 6, 21, 20, 23, +22, 51, 33, 53, 52, 38, 39, 55, 22, 23, 22, 21, 1, 7, 39, 55, 19, 7, 39, 55, 39, 7, 39, 55, 5, +-75, -4, 70, -64, 114, -113, 42, 15, 57, 30, 22, 21, 29, 124, 111, -86, 3, 79, 54, 65, 77, 44, 9, 68, -2, +69, 74, -92, 76, -128, 74, -93, 77, 34, 75, -91, 78, 1, 37, 67, 84, -77, 93, 97, 35, 98, 19, 46, 46, 71, +56, 118, 65, 58, 27, 112, -115, 50, -93, 55, 14, 112, -42, -2, 3, -111, 84, -111, -2, -97, -110, 86, -110, 90, -113, +85, -112, 0, -1, -1, 0, 58, -2, -103, 5, -75, 3, -64, 0, 22, 3, 31, 0, 0, 0, 4, -1, -70, -2, -103, +1, -12, 3, -90, 0, 3, 0, 7, 0, 11, 0, 24, 0, -69, -75, 7, 16, 18, 21, 52, 1, -72, -1, -16, -77, +18, 21, 52, 11, -72, -1, -16, 64, 11, 18, 21, 52, 18, 52, 12, 17, 52, 4, 6, 5, -72, 3, 2, -75, 7, +7, 1, 8, 10, 9, -72, 3, 2, -76, 11, 11, 0, 2, 1, -72, 3, 2, 64, 10, 111, 3, 1, -33, 3, 1, +3, 3, 13, 19, -66, 2, -17, 0, 20, 3, 4, 0, 14, 2, -17, 0, 13, 2, -21, -78, 5, 7, 4, -72, 3, +1, -75, 6, 6, 8, 1, 3, 0, -72, 3, 1, -76, 2, 2, 9, 11, 10, -72, 3, 1, -73, 8, 8, 13, 20, +20, 19, 19, 15, -67, 3, 3, 0, 12, 2, -16, 0, 26, 0, 13, 1, 42, -123, 47, 16, -11, -3, 50, 47, 25, +57, 47, 24, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 0, 63, -19, 63, -19, +17, 51, 47, 93, 113, -3, 57, 57, 51, 47, -3, 57, 57, 17, 51, 47, -3, 57, 57, 49, 48, 1, 43, 43, 43, +43, 37, 7, 39, 55, 19, 7, 39, 55, 39, 7, 39, 55, 37, 33, 53, 33, 52, 39, 38, 39, 55, 22, 23, 22, +21, 1, -28, 74, -92, 76, -128, 74, -93, 77, 34, 75, -91, 78, 1, -106, -3, -58, 1, -15, 28, 19, 75, 78, 72, +18, 27, 56, -111, 84, -111, -2, -97, -110, 86, -110, 90, -113, 85, -112, -12, -82, 118, 62, 43, 81, -93, 91, 51, 77, +-78, -1, -1, -1, -70, -2, -103, 1, -12, 3, -90, 0, 22, 3, 33, 0, 0, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 4, 0, 54, -2, 78, 4, 32, 3, 117, 0, 44, 0, 48, 0, +52, 0, 56, 0, -10, -75, 52, 16, 18, 21, 52, 46, -72, -1, -16, -77, 18, 21, 52, 56, -72, -1, -16, 64, 17, +18, 21, 52, 41, 32, 10, 11, 52, 24, 42, 10, 11, 52, 121, 42, 1, 27, -72, -1, -74, -75, 9, 17, 52, 49, +51, 50, -72, 3, 2, -75, 52, 52, 46, 53, 55, 54, -72, 3, 2, -76, 56, 56, 45, 47, 46, -70, 3, 2, 0, +48, -1, -64, 64, 10, 11, 17, 52, 48, 48, 19, 7, 3, 31, 30, -70, 2, -17, 0, 32, 3, 6, -76, 15, 18, +0, 19, 11, -72, 2, -17, -78, 3, 3, 18, -70, 2, -17, 0, 19, 3, 7, -78, 50, 52, 49, -72, 3, 1, -75, +51, 51, 53, 46, 48, 45, -72, 3, 1, -76, 47, 47, 54, 56, 55, -72, 3, 1, 64, 23, 53, 64, 10, 11, 52, +53, 53, -113, 0, 1, 0, 18, 30, 32, 31, 31, 19, 18, 18, 58, 7, 7, 25, -70, 3, 3, 0, 39, 1, 42, +-123, 47, -19, 51, 47, 17, 51, 47, 51, 51, 47, 57, 57, 17, 57, 93, 57, 47, 43, -3, 57, 57, 51, 47, -19, +57, 57, 17, 51, 47, -19, 57, 57, 0, 63, -19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 17, 57, +47, 43, -3, 57, 57, 51, 47, -3, 57, 57, 17, 51, 47, -3, 57, 57, 49, 48, 1, 43, 93, 43, 43, 43, 43, +43, 1, 34, 38, 35, 34, 7, 6, 7, 54, 55, 54, 51, 50, 23, 22, 51, 50, 54, 51, 7, 6, 7, 6, 7, +6, 21, 20, 23, 22, 33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 5, 7, 39, 55, +19, 7, 39, 55, 39, 7, 39, 55, 1, -28, 20, 76, 19, 64, 80, 52, 90, 40, 35, 75, -79, 66, -52, 95, 69, +29, 112, 28, 37, -45, -108, -36, 123, -103, -32, -61, 1, 70, -72, 6, -30, 58, -40, -113, -85, 88, 100, 79, 60, 115, +35, 2, 1, 74, -92, 76, -128, 74, -93, 77, 34, 75, -91, 78, 2, -72, 6, 12, 8, 18, 113, 34, 74, 28, 13, +14, -87, 36, 46, 68, 98, 122, -90, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -88, -122, 102, 91, 28, -13, -111, +84, -111, -2, -97, -110, 86, -110, 90, -113, 85, -112, 0, 4, 0, 54, -2, 78, 4, 53, 3, 105, 0, 62, 0, 66, +0, 70, 0, 74, 1, 54, -75, 70, 16, 18, 21, 52, 64, -72, -1, -16, -77, 18, 21, 52, 74, -72, -1, -16, 64, +17, 18, 21, 52, 30, 32, 10, 11, 52, 13, 42, 10, 11, 52, 121, 31, 1, 16, -72, -1, -94, -75, 9, 17, 52, +71, 73, 72, -72, 3, 2, -76, 74, 74, 65, 63, 66, -72, 3, 2, -76, 64, 64, 67, 69, 70, -72, 3, 2, 64, +15, -48, 68, 1, 68, 68, 1, 19, 56, 8, 52, 61, 41, 37, 20, 19, -70, 2, -17, 0, 21, 3, 6, -76, 48, +51, 34, 52, 45, -72, 2, -17, -78, 37, 37, 51, -66, 2, -17, 0, 52, 3, 7, 0, 61, 2, -17, 0, 1, 2, +-21, -78, 68, 70, 67, -72, 3, 1, -75, 69, 69, 65, 72, 74, 73, -72, 3, 1, -76, 71, 71, 64, 66, 65, -72, +3, 1, 64, 18, 63, 64, 18, 25, 52, 95, 63, 127, 63, 2, 63, 63, 4, 14, 56, 51, 8, 4, -72, 3, 3, +64, 16, 57, 57, -113, 34, 1, 34, 51, 19, 21, 14, 20, 20, 52, 51, 51, 0, -72, 2, -16, -77, 76, 41, 41, +14, -70, 3, 3, 0, 28, 1, 42, -123, 47, -19, 51, 47, 16, -28, 51, 47, 51, 51, 47, 18, 57, 57, 17, 57, +93, 57, 47, -3, 57, 18, 57, 17, 18, 57, 47, 93, 43, -3, 57, 57, 50, 47, -3, 57, 57, 17, 51, 47, -19, +57, 57, 0, 63, -19, 63, -19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 17, 18, 57, 57, 17, 18, +57, 47, 93, -79, 6, 2, 67, 84, 88, -76, 15, 68, 31, 68, 2, 0, 93, 89, -19, 57, 57, 50, 47, -3, 57, +57, 50, 47, -3, 57, 57, 49, 48, 1, 43, 93, 43, 43, 43, 43, 43, 1, 35, 34, 38, 53, 52, 55, 54, 55, +6, 7, 6, 7, 6, 21, 20, 23, 22, 33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, +55, 38, 38, 35, 34, 7, 6, 7, 54, 55, 54, 51, 50, 22, 51, 50, 54, 55, 7, 6, 7, 6, 7, 7, 20, +23, 22, 51, 51, 5, 7, 39, 55, 19, 7, 39, 55, 39, 7, 39, 55, 4, 53, -119, 121, 102, 10, 4, 7, -85, +87, -96, 88, 111, -32, -61, 1, 70, -72, 6, -30, 58, -40, -113, -85, 88, 100, 85, 66, 127, 37, -87, 40, 89, 36, +101, 63, 21, 110, 34, 37, 83, -79, 97, -30, 77, 51, 97, 53, 40, 41, 52, 33, 58, 2, 50, 31, 75, -119, -2, +-101, 74, -92, 76, -128, 74, -93, 77, 34, 75, -91, 78, 1, 37, 90, 104, 39, 58, 22, 36, 52, 37, 68, 86, 108, +-118, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -85, -128, 100, 83, 25, 90, 5, 7, 9, 3, 24, 98, 38, 84, +37, 8, 7, -86, 5, 9, 6, 11, 56, 82, 28, 17, -37, -111, 84, -111, -2, -97, -110, 86, -110, 90, -113, 85, -112, +0, 0, 4, -1, -70, -2, -103, 4, 61, 3, 107, 0, 22, 0, 26, 0, 30, 0, 34, 0, -79, -75, 30, 16, 18, +21, 52, 24, -72, -1, -16, -77, 18, 21, 52, 34, -72, -1, -16, -75, 18, 21, 52, 27, 29, 28, -72, 3, 2, -75, +30, 30, 24, 31, 33, 32, -72, 3, 2, -76, 34, 34, 25, 23, 24, -72, 3, 2, -75, 26, 26, 1, 11, 2, 15, +-72, 2, -17, -77, 9, 9, 22, 2, -70, 2, -17, 0, 1, 2, -21, -78, 28, 30, 27, -72, 3, 1, -75, 29, 29, +25, 32, 34, 33, -72, 3, 1, -76, 31, 31, 24, 26, 23, -72, 3, 1, 64, 15, 25, 25, 3, 11, 11, 1, 3, +84, 11, 17, 52, 3, 3, 1, 0, -72, 2, -16, -79, 36, 1, 47, 16, -28, 17, 57, 47, 43, 18, 57, 47, 17, +57, 47, -19, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 0, 63, -3, 60, 50, 47, -19, 18, 57, +17, 51, 47, -19, 57, 57, 51, 47, -3, 57, 57, 17, 51, 47, -3, 57, 57, 49, 48, 1, 43, 43, 43, 1, 33, +53, 33, 38, 39, 38, 39, 38, 35, 34, 7, 54, 55, 54, 51, 50, 23, 22, 23, 22, 23, 51, 1, 7, 39, 55, +19, 7, 39, 55, 39, 7, 39, 55, 4, 61, -5, 125, 3, 47, 102, 70, 87, 72, 81, 83, 51, 52, 29, 47, 68, +104, 102, -117, 69, -100, 121, 43, 60, -2, -123, 74, -92, 76, -128, 74, -93, 77, 34, 75, -91, 78, 1, 37, -82, 79, +44, 55, 25, 28, 7, 74, 45, 65, 100, 50, -116, 109, 9, -2, 101, -111, 84, -111, -2, -97, -110, 86, -110, 90, -113, +85, -112, 0, -1, -1, -1, -70, -2, -103, 4, 61, 3, 107, 0, 22, 3, 41, 0, 0, 0, 4, 0, 74, -1, 70, +3, -23, 5, -55, 0, 30, 0, 34, 0, 38, 0, 42, 0, -23, 64, 11, 42, 16, 18, 21, 52, 36, 16, 18, 21, +52, 32, -72, -1, -16, 64, 14, 18, 21, 52, 19, 42, 9, 17, 52, 18, 42, 12, 17, 52, 4, -72, -1, -32, -77, +9, 17, 52, 3, -72, -1, -32, -77, 9, 17, 52, 2, -72, -1, -42, 64, 11, 9, 17, 52, 24, 52, 12, 17, 52, +31, 33, 34, -72, 3, 2, -75, 32, 32, 42, 35, 37, 38, -72, 3, 2, -76, 36, 36, 39, 41, 42, -72, 3, 2, +64, 9, 15, 40, 1, 40, 40, 26, 13, 12, 25, -70, 2, -17, 0, 26, 3, 9, -78, 12, 58, 16, -70, 3, 10, +0, 6, 3, 8, -78, 32, 34, 33, -72, 3, 1, -75, 31, 31, 37, 40, 42, 41, -72, 3, 1, -76, 39, 39, 36, +38, 35, -72, 3, 1, -73, 37, 37, 25, 26, 26, 25, 25, 21, -70, 3, 3, 0, 0, 2, -16, -78, 44, 13, 12, +-72, 1, 26, -123, 47, 51, 16, -12, -3, 50, 47, 25, 57, 47, 17, 51, 24, 47, -19, 57, 57, 51, 47, -3, 57, +57, 17, 51, 47, -3, 57, 57, 0, 63, -3, 25, -28, 24, 63, -19, 17, 57, 17, 51, 47, 93, -19, 57, 57, 51, +47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 20, 7, +6, 7, 6, 35, 34, 39, 38, 39, 38, 39, 55, 22, 22, 51, 50, 55, 54, 54, 53, 52, 39, 38, 39, 55, 22, +23, 22, 21, 3, 7, 39, 55, 1, 7, 39, 55, 7, 7, 39, 55, 3, -23, 94, 82, 122, 116, 75, 69, 80, 61, +85, 72, 71, 17, 66, -113, 58, -128, -117, 126, -78, 46, 37, 67, 57, 82, 39, 44, -33, 77, -96, 74, 1, 104, 78, +-94, 75, 65, 76, -94, 74, 1, 37, 110, 118, 104, 75, 72, 20, 15, 32, 27, 27, 40, 13, 27, 82, 75, -27, 92, +79, 87, 70, 74, -99, 76, 76, 86, 106, 3, 91, -110, 86, -110, -2, -8, -112, 86, -113, -81, -111, 84, -111, 0, -1, +-1, 0, 74, -1, 70, 3, -23, 5, -55, 0, 22, 3, 43, 0, 0, 0, 1, 0, 20, 1, 37, 6, 127, 5, -33, +0, 44, 0, -70, -71, 0, 22, -1, -64, 64, 19, 16, 17, 52, 9, 32, 16, 17, 52, 59, 5, 107, 5, 2, 9, +32, 9, 12, 52, 42, -72, -1, -32, -77, 16, 17, 52, 18, -72, -1, -24, -77, 15, 17, 52, 18, -72, -1, -36, -77, +13, 14, 52, 18, -72, -1, -16, 64, 10, 10, 12, 52, 4, 3, 7, 18, 4, 44, 13, 65, 11, 2, -17, 0, 12, +3, 11, 0, 37, 0, 36, 3, 9, 0, 26, 0, 44, 2, -17, 0, 28, 2, -21, -77, 3, 4, 0, 7, -72, 2, +-13, -74, 64, 18, 18, 40, 12, 12, 0, 65, 9, 3, 0, 0, 27, 2, -16, 0, 46, 0, 37, 2, -5, 0, 32, +0, 36, -1, -64, -75, 9, 11, 52, 36, 36, 40, -70, 3, 3, 0, 32, 1, 42, -123, 47, -3, 50, 25, 47, 43, +26, -19, 24, 16, -11, 25, -19, 51, 24, 47, 18, 57, 47, 26, -19, 18, 57, 57, 0, 63, -3, 60, 63, 57, 63, +-19, 17, 23, 57, 43, 43, 43, 49, 48, 1, 43, 43, 93, 43, 43, 1, 38, 38, 39, 7, 39, 38, 53, 52, 55, +54, 55, 37, 21, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 23, 22, 23, 21, 33, 34, 39, 38, 53, 52, 55, +54, 55, 23, 6, 6, 21, 20, 23, 22, 51, 6, 11, 70, -76, -103, 33, 118, 62, 84, 78, -65, 1, 26, -47, 125, +77, 98, 64, 40, 41, -104, 113, 122, 74, -5, 85, -17, 101, 108, 47, 13, 42, 34, 34, 21, 115, 86, -90, 1, -45, +106, -99, 91, 31, 90, 52, 29, -84, 98, 90, 72, 110, -83, 70, 41, 34, 43, 23, 23, 48, 30, 30, 115, 126, -121, +-111, -82, 57, 61, -109, 88, 112, 31, 84, 20, 78, 84, 38, 109, 44, 33, 0, 1, 0, 20, 1, 37, 7, 118, 5, +-33, 0, 69, 0, -3, -71, 0, 42, -1, -42, -77, 16, 17, 52, 33, -72, -1, -16, -77, 15, 17, 52, 47, -72, -1, +-32, -77, 15, 17, 52, 44, -72, -1, -32, -77, 15, 17, 52, 48, -72, -1, -32, -77, 13, 17, 52, 46, -72, -1, -32, +64, 21, 13, 17, 52, 59, 27, 107, 27, -119, 61, 3, 31, 32, 9, 15, 52, 19, 32, 15, 17, 52, 14, -72, -1, +-32, -77, 16, 17, 52, 40, -72, -1, -32, -77, 15, 17, 52, 40, -72, -1, -36, -77, 13, 14, 52, 40, -72, -1, -16, +64, 11, 10, 12, 52, 65, 26, 25, 29, 40, 5, 16, 35, 65, 12, 2, -17, 0, 34, 3, 11, 0, 9, 0, 8, +3, 9, 0, 55, 0, 16, 2, -17, 0, 56, 0, 0, 2, -21, -77, 25, 26, 21, 29, -72, 2, -13, 64, 13, 15, +40, 95, 40, 2, 40, 40, 21, 12, 35, 35, 56, 21, -72, 3, 3, -76, 64, 65, 65, 12, 56, -66, 2, -16, 0, +71, 0, 9, 2, -5, 0, 32, 0, 8, -1, -64, -75, 9, 11, 52, 8, 8, 12, -70, 3, 3, 0, 4, 1, 42, +-123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -27, 17, 57, 47, 26, -19, 18, 57, 47, 17, 18, 57, 47, 93, +-19, 18, 57, 57, 0, 63, 60, -3, 60, 63, 57, 63, -19, 17, 23, 57, 43, 43, 43, 49, 48, 1, 43, 43, 43, +93, 43, 43, 0, 43, 43, 43, 43, 1, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 6, 21, 20, 23, 22, 51, +33, 50, 55, 54, 53, 52, 39, 38, 39, 7, 39, 38, 53, 52, 55, 54, 55, 37, 21, 7, 6, 7, 6, 21, 20, +23, 22, 23, 22, 23, 22, 23, 22, 23, 22, 23, 22, 51, 51, 21, 35, 34, 39, 38, 39, 38, 39, 38, 39, 20, +7, 6, 35, 1, -44, -17, 101, 108, 47, 13, 42, 34, 34, 21, 115, 86, -90, 1, -86, -97, 108, -127, 49, 25, 72, +33, 118, 62, 84, 78, -65, 1, 26, -47, -85, 70, 59, 64, 40, 41, 88, 71, 61, 53, 33, 73, 47, 45, 61, 45, +-125, 123, 82, 90, 44, 81, 49, 11, 25, 51, 111, 119, -21, 1, 37, 57, 61, -109, 88, 112, 31, 84, 20, 78, 84, +38, 109, 44, 33, 41, 49, 89, 67, 46, 24, 38, 31, 90, 52, 29, -84, 98, 90, 72, 110, -83, 70, 58, 35, 30, +18, 23, 48, 30, 30, 67, 65, 56, 60, 37, 90, 57, 38, 51, -82, 84, 41, 105, 63, 13, 30, 49, -78, 100, 107, +0, 0, 1, -1, -70, 1, 37, 3, 39, 5, -33, 0, 29, 0, -95, -71, 0, 25, -1, -64, 64, 19, 16, 17, 52, +12, 32, 16, 17, 52, 59, 8, 107, 8, 2, 12, 32, 9, 12, 52, 21, -72, -1, -24, -77, 15, 17, 52, 21, -72, +-1, -36, -77, 13, 14, 52, 21, -72, -1, -16, 64, 10, 10, 12, 52, 7, 6, 10, 21, 4, 2, 16, -65, 2, -17, +0, 15, 3, 11, 0, 29, 0, 2, 2, -17, 0, 1, 2, -21, -77, 6, 7, 3, 10, -72, 2, -13, 64, 22, 64, +111, 21, -113, 21, 2, 15, 21, 47, 21, 95, 21, 3, 32, 21, 1, 21, 21, 1, 15, 15, 3, -66, 3, 0, 0, +32, 0, 0, 2, -16, 0, 31, 0, 1, 1, 42, -123, 47, 16, -12, 26, 25, -19, 51, 24, 47, 18, 57, 47, 93, +93, 93, 26, -19, 18, 57, 57, 0, 63, -3, 60, 63, -19, 17, 23, 57, 43, 43, 43, 49, 48, 1, 43, 93, 43, +43, 1, 33, 53, 33, 38, 38, 39, 7, 39, 38, 53, 52, 55, 54, 55, 37, 21, 7, 6, 7, 6, 21, 20, 23, +22, 23, 22, 23, 22, 23, 3, 39, -4, -109, 2, -7, 70, -76, -103, 33, 118, 62, 84, 78, -65, 1, 26, -47, 125, +77, 98, 64, 40, 41, -104, 113, 122, 74, 1, 37, -82, 106, -99, 91, 31, 90, 52, 29, -84, 98, 90, 72, 110, -83, +70, 41, 34, 43, 23, 23, 48, 30, 30, 115, 126, -121, -111, 0, 1, -1, -70, 1, 37, 4, 30, 5, -33, 0, 54, +0, -36, -71, 0, 47, -1, -42, -77, 13, 17, 52, 38, -72, -1, -16, -77, 13, 17, 52, 52, -72, -1, -32, -77, 15, +17, 52, 49, -72, -1, -32, -77, 13, 17, 52, 53, -72, -1, -32, -77, 13, 17, 52, 51, -72, -1, -32, 64, 31, 13, +17, 52, 84, 43, 84, 50, 2, 68, 43, 68, 50, 2, 59, 32, 107, 32, -119, 11, 3, 36, 32, 9, 15, 52, 24, +32, 15, 17, 52, 45, -72, -1, -32, -77, 15, 17, 52, 45, -72, -1, -36, -77, 13, 14, 52, 45, -72, -1, -16, 64, +14, 10, 12, 52, 0, 45, 1, 15, 31, 30, 34, 45, 5, 21, 40, 65, 9, 2, -17, 0, 39, 3, 11, 0, 5, +0, 21, 2, -17, 0, 6, 0, 20, 2, -21, -77, 30, 31, 26, 34, -72, 2, -13, 64, 11, 15, 45, 1, 45, 45, +26, 20, 40, 40, 6, 26, -72, 3, 3, -77, 15, 15, 20, 6, -69, 2, -16, 0, 56, 0, 20, 1, 42, -123, 47, +16, -27, 17, 57, 47, -19, 18, 57, 47, 17, 18, 57, 47, 93, -19, 18, 57, 57, 0, 63, 60, -3, 60, 63, -19, +17, 23, 57, 93, 43, 43, 43, 49, 48, 1, 43, 43, 93, 93, 93, 43, 43, 0, 43, 43, 43, 43, 1, 22, 23, +22, 51, 51, 21, 35, 34, 39, 38, 39, 38, 39, 38, 39, 20, 7, 6, 35, 35, 53, 51, 50, 55, 54, 53, 52, +39, 38, 39, 7, 39, 38, 53, 52, 55, 54, 55, 37, 21, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 23, 22, +23, 22, 2, -43, 47, 45, 61, 45, -125, 123, 82, 90, 44, 81, 49, 11, 25, 51, 111, 119, -21, 103, 108, -97, 108, +-127, 49, 25, 72, 33, 118, 62, 84, 78, -65, 1, 26, -47, 125, 77, 98, 64, 40, 41, 88, 71, 61, 53, 33, 2, +101, 57, 38, 51, -82, 84, 41, 105, 63, 13, 30, 49, -78, 100, 107, -82, 41, 49, 89, 67, 46, 24, 38, 31, 90, +52, 29, -84, 98, 90, 72, 110, -83, 70, 41, 34, 43, 23, 23, 48, 30, 30, 67, 65, 56, 60, 37, 0, 2, 0, +20, 1, 37, 6, 127, 6, -16, 0, 44, 0, 55, 0, -15, 64, 16, 48, 8, 19, 21, 52, 47, 32, 10, 11, 52, +54, 32, 10, 11, 52, 22, -72, -1, -64, 64, 19, 16, 17, 52, 9, 32, 16, 17, 52, 59, 5, 107, 5, 2, 9, +32, 9, 12, 52, 42, -72, -1, -32, -73, 16, 17, 52, 51, 13, 50, 12, 45, -72, 2, -17, -74, 15, 46, 1, 46, +46, 12, 18, -72, -1, -24, -77, 15, 17, 52, 18, -72, -1, -36, -77, 13, 14, 52, 18, -72, -1, -16, 64, 10, 10, +12, 52, 4, 3, 7, 18, 4, 44, 13, 65, 11, 2, -17, 0, 12, 3, 11, 0, 37, 0, 36, 3, 9, 0, 26, +0, 44, 2, -17, 0, 28, 2, -21, 64, 9, 46, 12, 50, 50, 7, 3, 4, 0, 7, -72, 2, -13, -74, 64, 18, +18, 40, 12, 12, 0, 65, 9, 3, 0, 0, 27, 2, -16, 0, 57, 0, 37, 2, -5, 0, 32, 0, 36, -1, -64, +-75, 9, 11, 52, 36, 36, 40, -70, 3, 3, 0, 32, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, +-11, 25, -19, 51, 24, 47, 18, 57, 47, 26, -19, 18, 57, 57, 17, 51, 47, 16, 60, 0, 63, -3, 60, 63, 57, +63, -19, 17, 23, 57, 43, 43, 43, 17, 51, 47, 93, -19, 17, 51, 18, 57, 49, 48, 1, 43, 43, 93, 43, 43, +0, 43, 43, 43, 1, 38, 38, 39, 7, 39, 38, 53, 52, 55, 54, 55, 37, 21, 7, 6, 7, 6, 21, 20, 23, +22, 23, 22, 23, 22, 23, 21, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 6, 21, 20, 23, 22, 51, 1, +21, 6, 7, 6, 7, 53, 54, 54, 55, 54, 6, 11, 70, -76, -103, 33, 118, 62, 84, 78, -65, 1, 26, -47, 125, +77, 98, 64, 40, 41, -104, 113, 122, 74, -5, 85, -17, 101, 108, 47, 13, 42, 34, 34, 21, 115, 86, -90, 4, 74, +-40, -72, -93, 93, 32, -64, -122, -106, 1, -45, 106, -99, 91, 31, 90, 52, 29, -84, 98, 90, 72, 110, -83, 70, 41, +34, 43, 23, 23, 48, 30, 30, 115, 126, -121, -111, -82, 57, 61, -109, 88, 112, 31, 84, 20, 78, 84, 38, 109, 44, +33, 5, 29, -87, 79, 89, 78, 63, 106, 36, 126, 70, 79, 0, 2, 0, 20, 1, 37, 7, 118, 6, -16, 0, 69, +0, 80, 1, 51, 64, 16, 73, 8, 19, 21, 52, 72, 32, 10, 11, 52, 79, 32, 10, 11, 52, 42, -72, -1, -42, +-77, 16, 17, 52, 33, -72, -1, -16, -77, 15, 17, 52, 47, -72, -1, -32, -77, 15, 17, 52, 44, -72, -1, -32, -77, +15, 17, 52, 48, -72, -1, -32, -77, 13, 17, 52, 46, -72, -1, -32, 64, 21, 13, 17, 52, 59, 27, 107, 27, -119, +61, 3, 31, 32, 9, 15, 52, 19, 32, 15, 17, 52, 14, -72, -1, -32, -73, 16, 17, 52, 76, 35, 75, 34, 70, +-72, 2, -17, -74, 15, 71, 1, 71, 71, 34, 40, -72, -1, -32, -77, 15, 17, 52, 40, -72, -1, -36, -77, 13, 14, +52, 40, -72, -1, -16, 64, 11, 10, 12, 52, 65, 26, 25, 29, 40, 5, 16, 35, 65, 12, 2, -17, 0, 34, 3, +11, 0, 9, 0, 8, 3, 9, 0, 55, 0, 16, 2, -17, 0, 56, 0, 0, 2, -21, 64, 9, 71, 35, 75, 75, +29, 25, 26, 21, 29, -72, 2, -13, 64, 13, 15, 40, 95, 40, 2, 40, 40, 21, 12, 35, 35, 56, 21, -72, 3, +3, -76, 64, 65, 65, 12, 56, -66, 2, -16, 0, 82, 0, 9, 2, -5, 0, 32, 0, 8, -1, -64, -75, 9, 11, +52, 8, 8, 12, -70, 3, 3, 0, 4, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -27, 17, 57, +47, 26, -19, 18, 57, 47, 17, 18, 57, 47, 93, -19, 18, 57, 57, 17, 51, 47, 16, 60, 0, 63, 60, -3, 60, +63, 57, 63, -19, 17, 23, 57, 43, 43, 43, 17, 51, 47, 93, -19, 17, 51, 18, 57, 49, 48, 1, 43, 43, 43, +93, 43, 43, 0, 43, 43, 43, 43, 43, 43, 43, 1, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 6, 21, 20, +23, 22, 51, 33, 50, 55, 54, 53, 52, 39, 38, 39, 7, 39, 38, 53, 52, 55, 54, 55, 37, 21, 7, 6, 7, +6, 21, 20, 23, 22, 23, 22, 23, 22, 23, 22, 23, 22, 23, 22, 51, 51, 21, 35, 34, 39, 38, 39, 38, 39, +38, 39, 20, 7, 6, 35, 1, 21, 6, 7, 6, 7, 53, 54, 54, 55, 54, 1, -44, -17, 101, 108, 47, 13, 42, +34, 34, 21, 115, 86, -90, 1, -86, -97, 108, -127, 49, 25, 72, 33, 118, 62, 84, 78, -65, 1, 26, -47, -85, 70, +59, 64, 40, 41, 88, 71, 61, 53, 33, 73, 47, 45, 61, 45, -125, 123, 82, 90, 44, 81, 49, 11, 25, 51, 111, +119, -21, 2, -91, -40, -72, -93, 93, 32, -64, -122, -106, 1, 37, 57, 61, -109, 88, 112, 31, 84, 20, 78, 84, 38, +109, 44, 33, 41, 49, 89, 67, 46, 24, 38, 31, 90, 52, 29, -84, 98, 90, 72, 110, -83, 70, 58, 35, 30, 18, +23, 48, 30, 30, 67, 65, 56, 60, 37, 90, 57, 38, 51, -82, 84, 41, 105, 63, 13, 30, 49, -78, 100, 107, 5, +-53, -87, 79, 89, 78, 63, 106, 36, 126, 70, 79, 0, 2, -1, -70, 1, 37, 3, 39, 7, 2, 0, 29, 0, 40, +0, -46, 64, 14, -56, 33, 1, 32, 32, 10, 11, 52, 39, 32, 10, 11, 52, 25, -72, -1, -64, 64, 23, 16, 17, +52, 12, 32, 16, 17, 52, 59, 8, 107, 8, 2, 12, 32, 9, 12, 52, 36, 16, 35, 15, 30, -72, 2, -17, -77, +31, 31, 15, 21, -72, -1, -24, -77, 15, 17, 52, 21, -72, -1, -36, -77, 13, 14, 52, 21, -72, -1, -16, 64, 10, +10, 12, 52, 7, 6, 10, 21, 4, 2, 16, -65, 2, -17, 0, 15, 3, 11, 0, 29, 0, 2, 2, -17, 0, 1, +2, -21, 64, 9, 31, 15, 35, 35, 10, 6, 7, 3, 10, -72, 2, -13, 64, 22, 64, 111, 21, -113, 21, 2, 15, +21, 47, 21, 95, 21, 3, 32, 21, 1, 21, 21, 1, 15, 15, 3, -66, 3, 0, 0, 32, 0, 0, 2, -16, 0, +42, 0, 1, 1, 42, -123, 47, 16, -11, 26, 25, -19, 51, 24, 47, 18, 57, 47, 93, 93, 93, 26, -19, 18, 57, +57, 17, 51, 47, 16, 60, 0, 63, -3, 60, 63, -19, 17, 23, 57, 43, 43, 43, 17, 51, 47, -19, 17, 51, 18, +57, 49, 48, 1, 43, 93, 43, 43, 0, 43, 43, 93, 1, 33, 53, 33, 38, 38, 39, 7, 39, 38, 53, 52, 55, +54, 55, 37, 21, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 23, 22, 23, 3, 21, 6, 7, 6, 7, 53, 54, +54, 55, 54, 3, 39, -4, -109, 2, -7, 70, -76, -103, 33, 118, 62, 84, 78, -65, 1, 26, -47, 125, 77, 98, 64, +40, 41, -104, 113, 122, 74, 97, -40, -72, -93, 93, 32, -64, -122, -106, 1, 37, -82, 106, -99, 91, 31, 90, 52, 29, +-84, 98, 90, 72, 110, -83, 70, 41, 34, 43, 23, 23, 48, 30, 30, 115, 126, -121, -111, 5, 47, -87, 79, 89, 78, +63, 106, 36, 126, 70, 79, 0, 0, 2, -1, -70, 1, 37, 4, 30, 7, 2, 0, 54, 0, 65, 1, 27, -77, -56, +58, 1, 65, -72, -1, -32, 64, 19, 16, 17, 52, 63, 32, 13, 14, 52, 57, 32, 10, 11, 52, 64, 32, 10, 11, +52, 47, -72, -1, -42, -77, 13, 17, 52, 38, -72, -1, -16, -77, 13, 17, 52, 52, -72, -1, -32, -77, 15, 17, 52, +49, -72, -1, -32, -77, 13, 17, 52, 53, -72, -1, -32, -77, 13, 17, 52, 51, -72, -1, -32, 64, 35, 13, 17, 52, +84, 43, 84, 50, 2, 68, 43, 68, 50, 2, 59, 32, 107, 32, -119, 11, 3, 36, 32, 9, 15, 52, 24, 32, 15, +17, 52, 61, 40, 60, 39, 55, -72, 2, -17, -77, 56, 56, 39, 45, -72, -1, -32, -77, 15, 17, 52, 45, -72, -1, +-36, -77, 13, 14, 52, 45, -72, -1, -16, 64, 14, 10, 12, 52, 0, 45, 1, 15, 31, 30, 34, 45, 5, 21, 40, +65, 9, 2, -17, 0, 39, 3, 11, 0, 5, 0, 21, 2, -17, 0, 6, 0, 20, 2, -21, 64, 9, 56, 40, 60, +60, 34, 30, 31, 26, 34, -72, 2, -13, 64, 11, 15, 45, 1, 45, 45, 26, 20, 40, 40, 6, 26, -72, 3, 3, +-77, 15, 15, 20, 6, -69, 2, -16, 0, 67, 0, 20, 1, 42, -123, 47, 16, -27, 17, 57, 47, -19, 18, 57, 47, +17, 18, 57, 47, 93, -19, 18, 57, 57, 17, 51, 47, 16, 60, 0, 63, 60, -3, 60, 63, -19, 17, 23, 57, 93, +43, 43, 43, 17, 51, 47, -19, 17, 51, 18, 57, 49, 48, 1, 43, 43, 93, 93, 93, 43, 43, 0, 43, 43, 43, +43, 43, 43, 43, 43, 93, 1, 22, 23, 22, 51, 51, 21, 35, 34, 39, 38, 39, 38, 39, 38, 39, 20, 7, 6, +35, 35, 53, 51, 50, 55, 54, 53, 52, 39, 38, 39, 7, 39, 38, 53, 52, 55, 54, 55, 37, 21, 7, 6, 7, +6, 21, 20, 23, 22, 23, 22, 23, 22, 23, 22, 19, 21, 6, 7, 6, 7, 53, 54, 54, 55, 54, 2, -43, 47, +45, 61, 45, -125, 123, 82, 90, 44, 81, 49, 11, 25, 51, 111, 119, -21, 103, 108, -97, 108, -127, 49, 25, 72, 33, +118, 62, 84, 78, -65, 1, 26, -47, 125, 77, 98, 64, 40, 41, 88, 71, 61, 53, 33, 58, -40, -72, -93, 93, 32, +-64, -122, -106, 2, 101, 57, 38, 51, -82, 84, 41, 105, 63, 13, 30, 49, -78, 100, 107, -82, 41, 49, 89, 67, 46, +24, 38, 31, 90, 52, 29, -84, 98, 90, 72, 110, -83, 70, 41, 34, 43, 23, 23, 48, 30, 30, 67, 65, 56, 60, +37, 4, 67, -87, 79, 89, 78, 63, 106, 36, 126, 70, 79, 0, 0, 1, 0, 50, -1, -89, 4, -39, 3, -78, 0, +59, 0, -103, -71, 0, 38, -1, -42, 64, 19, 14, 17, 52, 41, 52, 14, 17, 52, 42, 52, 11, 17, 52, 3, 6, +14, 33, 39, 32, 65, 9, 3, 7, 0, 6, 2, -17, 0, 57, 3, 4, 0, 39, 2, -17, 0, 22, -1, -64, -77, +9, 11, 52, 22, -66, 3, 13, 0, 14, 2, -17, 0, 48, 2, -21, 0, 51, 3, 12, 64, 9, 10, 10, 44, 36, +3, 18, 0, 0, 44, -72, 2, -3, -76, 64, 18, 18, 61, 33, -69, 2, -5, 0, 32, 0, 32, -1, -64, -75, 9, +11, 52, 32, 32, 36, -70, 3, 12, 0, 26, 1, 57, -123, 47, -3, 50, 25, 47, 43, 26, -19, 17, 51, 24, 47, +26, -19, 51, 47, 18, 57, 17, 18, 57, 47, -19, 0, 63, -19, 63, 43, -19, 63, -19, 63, 18, 57, 17, 18, 57, +49, 48, 1, 43, 43, 43, 1, 20, 6, 7, 38, 38, 35, 34, 7, 6, 21, 20, 22, 51, 51, 50, 22, 22, 21, +20, 7, 6, 33, 34, 39, 38, 53, 52, 55, 54, 55, 54, 55, 23, 6, 6, 21, 20, 22, 51, 50, 55, 54, 54, +53, 52, 38, 35, 35, 34, 38, 53, 52, 55, 54, 55, 54, 51, 50, 22, 4, -39, 12, 2, 35, 97, 50, 87, 96, +88, 43, 53, 80, 72, 69, 96, -37, -55, -2, -87, -78, 94, 102, 34, 26, 46, 3, 60, 42, 63, 67, -87, -99, 120, +-97, -120, -38, 25, 28, -22, 43, 66, 55, 60, 85, 102, 103, 66, 76, 3, 32, 32, 67, 14, 45, 52, 101, 93, 55, +19, 19, 3, 16, 65, -5, -125, 120, 69, 75, -105, 104, 114, 87, 95, 6, 113, 17, 112, -61, 75, 122, 122, 48, 41, +114, 27, 19, 12, 62, 49, 67, 115, 125, 84, 101, 80, 0, 0, 1, 0, 36, -1, 31, 4, -75, 2, 5, 0, 54, +0, -112, -71, 0, 32, -1, -32, 64, 9, 12, 17, 52, 26, 53, 25, 25, 53, 6, -72, -1, -64, 64, 10, 9, 10, +52, 6, 6, 1, 44, 44, 1, 34, -70, 2, -17, 0, 17, -1, -64, -77, 9, 13, 52, 17, -66, 3, 14, 0, 53, +2, -17, 0, 1, 2, -21, 0, 38, 3, 12, -77, 13, 13, 0, 47, -72, 3, 12, -76, 64, 4, 4, 30, 0, -66, +2, -16, 0, 56, 0, 26, 2, -5, 0, 32, 0, 25, -1, -64, -75, 9, 11, 52, 25, 25, 30, -70, 3, 12, 0, +21, 1, 57, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -28, 17, 57, 47, 26, -19, 18, 57, 47, -19, 0, +63, -19, 63, 43, -3, 17, 57, 47, 18, 57, 47, 43, 17, 51, 47, 18, 57, 49, 48, 1, 43, 1, 35, 34, 6, +21, 20, 51, 50, 22, 23, 22, 23, 22, 21, 20, 7, 6, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 7, +6, 21, 20, 23, 22, 51, 50, 55, 54, 53, 52, 38, 35, 38, 38, 35, 34, 38, 53, 52, 55, 54, 55, 54, 51, +51, 4, -75, -81, -102, -101, 93, 41, 48, 81, 48, 18, 29, 123, -122, -2, -53, -41, 127, -121, 64, 23, 98, 40, 38, +37, 57, -128, 122, -43, -113, 109, -122, 30, 35, 27, 115, 18, 63, 54, 73, 60, 101, 76, 84, -81, 1, 37, 16, 24, +33, 4, 9, 6, 9, 15, 37, -69, 85, 93, 73, 78, -112, 116, -126, 47, -102, 20, 65, 64, 110, 70, 123, 64, 61, +22, 27, 47, 17, 17, 3, 7, 33, 33, 124, 79, 64, 31, 23, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, +4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, +0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, +0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, +-64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, +0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, +3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 3, 0, 48, 4, -41, 1, -49, 7, 119, 0, 45, 0, +86, 0, 98, 1, 29, 64, 9, 3, 97, 10, 35, 9, 9, 33, 14, 43, -70, 2, -11, 0, 90, -1, -64, -75, 11, +15, 52, 90, 90, 97, -72, 2, -11, -74, 35, 35, 20, 23, 23, 33, 27, -72, 2, -11, -78, 20, 20, 33, -72, 2, +-11, 64, 22, 14, 14, 75, 53, 70, 50, 83, 84, 79, 74, 75, 63, 70, 75, 75, 64, 84, 84, 64, 64, 70, 79, +-72, 2, -11, -78, 50, 50, 70, -70, 2, -11, 0, 57, 2, -12, 64, 14, 9, 6, 97, 10, 87, 35, 93, 39, 33, +30, 17, 6, 6, 0, -70, 2, -10, 0, 87, -1, -64, -75, 9, 10, 52, 87, 87, 93, -72, 2, -10, 64, 12, 39, +64, 9, 16, 52, 39, 39, 30, 14, 23, 23, 17, -72, 2, -10, 64, 10, 30, 30, 53, 75, 74, 67, 64, 63, 46, +84, -72, 2, -7, -76, 83, 83, 75, 60, 63, -72, 2, -7, -78, 64, 64, 75, -70, 2, -7, 0, 74, -1, -64, -77, +21, 23, 52, 74, -72, -1, -64, -77, 13, 16, 52, 74, -72, 1, 36, -123, 47, 43, 43, -19, 51, 47, -3, 50, 17, +51, 47, -3, 50, 17, 18, 57, 17, 18, 57, 51, 47, -3, 50, 47, 57, 17, 51, 47, 43, -3, 50, 47, 43, -19, +57, 47, 17, 18, 57, 17, 18, 57, 17, 57, 57, 18, 57, 0, 63, -19, 57, 47, -19, 17, 51, 47, 50, 47, 18, +57, 47, 17, 57, 18, 57, 17, 18, 57, 17, 18, 57, 17, 51, 47, -3, 50, 47, -19, 18, 57, 47, 17, 57, 47, +-3, 50, 47, 43, -19, 17, 18, 57, 47, 18, 57, 17, 57, 49, 48, 1, 6, 6, 7, 22, 22, 21, 20, 6, 7, +39, 6, 7, 6, 35, 55, 54, 53, 52, 38, 35, 34, 7, 7, 54, 55, 54, 51, 50, 22, 21, 20, 6, 7, 54, +55, 38, 39, 38, 53, 52, 55, 54, 55, 22, 22, 3, 20, 7, 6, 35, 34, 38, 39, 6, 7, 6, 35, 34, 38, +53, 52, 54, 55, 55, 20, 6, 21, 20, 22, 51, 50, 55, 54, 55, 55, 22, 23, 22, 51, 50, 55, 54, 53, 55, +22, 22, 3, 52, 38, 35, 34, 6, 21, 20, 23, 22, 23, 54, 1, -54, 4, 13, 22, 15, 17, 3, 4, 86, 46, +58, 71, 87, 36, 20, 20, 19, 21, 18, 26, 7, 11, 20, 46, 34, 38, 7, 8, 69, 64, 32, 9, 18, 37, 46, +50, 29, 38, 30, 26, 29, 51, 18, 30, 19, 20, 19, 32, 35, 42, 42, 14, 13, 21, 4, 18, 18, 43, 26, 12, +18, 21, 8, 5, 12, 28, 38, 22, 18, 21, 4, 7, 41, 23, 12, 19, 12, 18, 5, 30, 13, 7, 21, 23, 47, +35, 12, 21, 13, 18, 43, 26, 67, 54, 30, 36, 60, 37, 29, 22, 38, 24, 44, 71, 30, 55, 67, 42, 17, 35, +33, 20, 46, 32, 12, 24, 27, 47, 45, 55, 1, 1, 38, -2, 116, 75, 48, 54, 12, 13, 34, 19, 32, 56, 50, +26, 50, 33, 8, 8, 36, 12, 22, 35, 56, 25, 76, 6, 49, 11, 31, 50, 41, 44, 6, 19, 49, 1, 36, 24, +38, 17, 12, 18, 20, 6, 27, 17, 0, 0, 3, 0, 70, 4, -41, 1, -79, 7, 61, 0, 41, 0, 49, 0, 57, +0, -52, 64, 19, 7, 25, 4, 38, 39, 34, 29, 30, 18, 25, 30, 30, 19, 39, 39, 19, 19, 25, 34, -72, 2, +-11, -78, 4, 4, 25, -72, 2, -11, 64, 9, 11, 64, 9, 12, 52, 11, 11, 48, 42, -72, 2, -11, -78, 44, 44, +48, -72, 2, -11, 64, 9, 46, 64, 9, 24, 52, 46, 46, 56, 50, -72, 2, -11, -78, 52, 52, 56, -70, 2, -11, +0, 54, 2, -12, 64, 18, 42, 50, 50, 46, 54, 64, 37, 40, 52, 54, 7, 30, 29, 22, 19, 18, 0, 39, -72, +2, -7, -76, 38, 38, 30, 14, 18, -72, 2, -7, -78, 19, 19, 30, -70, 2, -7, 0, 29, -1, -64, -77, 21, 23, +52, 29, -72, -1, -64, -77, 13, 16, 52, 29, -72, 1, 36, -123, 47, 43, 43, -19, 51, 47, -3, 50, 17, 51, 47, +-3, 50, 17, 18, 57, 17, 18, 57, 47, 43, 60, 51, 47, 60, 0, 63, -19, 51, 47, -19, 17, 51, 47, 43, -19, +51, 47, -19, 17, 51, 47, 43, -19, 57, 47, -19, 17, 51, 47, 50, 47, 18, 57, 47, 17, 57, 18, 57, 17, 18, +57, 17, 18, 57, 49, 48, 1, 20, 7, 6, 35, 34, 38, 39, 6, 7, 6, 35, 34, 38, 53, 52, 55, 54, 55, +55, 20, 6, 21, 20, 22, 51, 50, 55, 54, 55, 55, 22, 23, 22, 51, 50, 55, 54, 53, 55, 22, 22, 7, 20, +7, 6, 7, 52, 55, 54, 23, 20, 7, 6, 7, 52, 55, 54, 1, -79, 26, 29, 51, 17, 33, 17, 19, 20, 32, +35, 42, 42, 8, 5, 14, 21, 4, 17, 19, 43, 26, 13, 17, 21, 9, 4, 12, 28, 38, 22, 18, 21, 4, 7, +15, 52, 89, -55, 43, 84, -41, 51, 90, -55, 43, 84, 6, -25, 76, 48, 53, 13, 12, 34, 19, 31, 56, 49, 25, +29, 18, 36, 8, 8, 36, 12, 23, 33, 56, 27, 73, 6, 49, 11, 32, 50, 41, 45, 7, 24, 44, -42, 46, 44, +35, 82, 44, 41, 34, 35, 47, 45, 36, 81, 43, 41, 35, 0, 0, 2, 0, 70, 4, -41, 1, -79, 6, -71, 0, +7, 0, 49, 0, -83, -71, 0, 0, 2, -11, -78, 2, 2, 6, -72, 2, -11, 64, 27, 4, 64, 9, 28, 52, 4, +4, 27, 46, 47, 42, 37, 38, 26, 27, 15, 33, 12, 38, 38, 27, 47, 47, 27, 27, 33, 42, -72, 2, -11, -78, +12, 12, 33, -70, 2, -11, 0, 19, 2, -12, -78, 0, 0, 4, -72, -1, -64, 64, 12, 14, 19, 52, 4, 15, 38, +37, 30, 27, 26, 8, 47, -72, 2, -7, -76, 46, 46, 38, 22, 26, -72, 2, -7, -78, 27, 27, 38, -70, 2, -7, +0, 37, -1, -64, -77, 21, 23, 52, 37, -72, -1, -64, -77, 13, 16, 52, 37, -72, 1, 36, -123, 47, 43, 43, -19, +51, 47, -3, 50, 17, 51, 47, -3, 50, 17, 18, 57, 17, 18, 57, 47, 43, 51, 47, 0, 63, -19, 57, 47, -19, +17, 51, 47, 50, 47, 18, 57, 47, 17, 18, 57, 17, 57, 17, 57, 17, 18, 57, 17, 51, 47, 43, -19, 51, 47, +-3, 49, 48, 1, 20, 7, 6, 7, 52, 55, 54, 23, 20, 7, 6, 35, 34, 38, 39, 6, 7, 6, 35, 34, 38, +53, 52, 55, 54, 55, 55, 20, 6, 21, 20, 22, 51, 50, 55, 54, 55, 55, 22, 23, 22, 51, 50, 55, 54, 53, +55, 22, 22, 1, -94, 52, 89, -55, 45, 82, -26, 26, 29, 51, 17, 33, 17, 20, 19, 32, 35, 42, 42, 8, 5, +14, 21, 4, 18, 18, 43, 26, 12, 18, 21, 8, 5, 12, 28, 38, 22, 18, 21, 4, 7, 6, -71, 46, 46, 35, +80, 42, 41, 34, -101, 75, 48, 54, 13, 12, 34, 19, 32, 56, 50, 26, 29, 18, 36, 8, 8, 36, 12, 22, 35, +56, 25, 76, 6, 49, 11, 31, 50, 41, 44, 6, 19, 49, 0, 3, 0, 64, 4, -39, 1, -79, 7, 46, 0, 32, +0, 74, 0, 86, 0, -20, -73, 29, 84, 4, 15, 11, 0, 8, 22, -70, 2, -11, 0, 78, -1, -64, 64, 10, 11, +13, 52, 78, 78, 84, 0, 0, 8, 84, -72, 2, -11, 64, 29, 15, 15, 8, 64, 9, 24, 52, 8, 8, 52, 40, +58, 37, 71, 72, 67, 62, 63, 51, 58, 63, 63, 52, 72, 72, 52, 52, 58, 67, -72, 2, -11, -78, 37, 37, 58, +-70, 2, -11, 0, 44, 2, -12, 64, 9, 84, 4, 75, 15, 81, 19, 0, 0, 25, -72, 2, -10, -75, 75, 75, 81, +11, 11, 19, -72, 2, -10, 64, 10, 81, 81, 40, 63, 62, 55, 52, 51, 33, 72, -72, 2, -7, -76, 71, 71, 63, +47, 51, -72, 2, -7, -78, 52, 52, 63, -70, 2, -7, 0, 62, -1, -64, -77, 21, 23, 52, 62, -72, -1, -64, -77, +13, 16, 52, 62, -72, 1, 36, -123, 47, 43, 43, -19, 51, 47, -3, 50, 17, 51, 47, -3, 50, 17, 18, 57, 17, +18, 57, 51, 47, -3, 50, 47, 17, 51, 47, -3, 50, 47, 17, 18, 57, 17, 57, 57, 0, 63, -19, 57, 47, -19, +17, 51, 47, 50, 47, 18, 57, 47, 17, 57, 18, 57, 17, 18, 57, 17, 18, 57, 17, 51, 47, 43, 51, 47, -19, +18, 57, 47, 17, 51, 47, 43, -19, 17, 18, 57, 17, 57, 18, 57, 49, 48, 1, 34, 39, 38, 39, 6, 7, 6, +35, 34, 38, 39, 54, 55, 54, 55, 38, 39, 38, 53, 52, 54, 51, 50, 22, 21, 20, 7, 6, 7, 22, 23, 22, +21, 20, 7, 6, 35, 34, 38, 39, 6, 7, 6, 35, 34, 38, 53, 52, 55, 54, 55, 55, 20, 6, 21, 20, 22, +51, 50, 55, 54, 55, 55, 22, 23, 22, 51, 50, 55, 54, 53, 55, 22, 22, 39, 52, 38, 35, 34, 6, 21, 20, +22, 23, 54, 54, 1, -79, 35, 39, 8, 35, 57, 23, 60, 56, 14, 27, 15, 76, 31, 48, 58, 23, 11, 17, 71, +45, 29, 47, 10, 3, 20, 32, 6, 10, 26, 29, 51, 17, 33, 17, 20, 19, 32, 35, 42, 42, 8, 5, 14, 21, +4, 18, 18, 43, 26, 12, 18, 21, 9, 4, 12, 28, 38, 22, 18, 21, 4, 7, 81, 30, 22, 7, 6, 20, 35, +3, 7, 6, 49, 9, 2, 10, 49, 14, 38, 9, 8, 34, 15, 23, 33, 22, 15, 23, 23, 43, 85, 41, 29, 21, +23, 7, 35, 15, 11, 17, -95, 75, 48, 54, 13, 12, 34, 19, 32, 56, 50, 26, 29, 18, 36, 8, 8, 36, 12, +22, 35, 56, 25, 75, 7, 50, 11, 31, 50, 41, 45, 6, 20, 49, -14, 21, 40, 14, 9, 21, 29, 19, 7, 18, +0, 0, 2, 0, 70, 4, -41, 1, -79, 6, -45, 0, 41, 0, 49, 0, -79, 64, 19, 7, 25, 4, 38, 39, 34, +29, 30, 18, 25, 30, 30, 19, 39, 39, 19, 19, 25, 34, -72, 2, -11, -78, 4, 4, 25, -72, 2, -11, 64, 14, +11, 64, 27, 29, 52, 11, 64, 9, 9, 52, 11, 11, 48, 42, -72, 2, -11, -78, 44, 44, 48, -70, 2, -11, 0, +46, 2, -12, 64, 16, 42, 42, 46, 64, 37, 40, 52, 46, 7, 30, 29, 22, 19, 18, 0, 39, -72, 2, -7, -76, +38, 38, 30, 14, 18, -72, 2, -7, -78, 19, 19, 30, -70, 2, -7, 0, 29, -1, -64, -77, 21, 23, 52, 29, -72, +-1, -64, -77, 13, 16, 52, 29, -72, 1, 36, -123, 47, 43, 43, -19, 51, 47, -3, 50, 17, 51, 47, -3, 50, 17, +18, 57, 17, 18, 57, 47, 43, 51, 47, 0, 63, -19, 51, 47, -19, 17, 51, 47, 43, 43, -19, 57, 47, -19, 17, +51, 47, 50, 47, 18, 57, 47, 17, 57, 18, 57, 17, 18, 57, 17, 18, 57, 49, 48, 1, 20, 7, 6, 35, 34, +38, 39, 6, 7, 6, 35, 34, 38, 53, 52, 55, 54, 55, 55, 20, 6, 21, 20, 22, 51, 50, 55, 54, 55, 55, +22, 23, 22, 51, 50, 55, 54, 53, 55, 22, 22, 7, 20, 7, 6, 7, 52, 55, 54, 1, -79, 26, 29, 51, 18, +30, 19, 20, 19, 32, 35, 42, 42, 8, 5, 14, 21, 4, 18, 18, 43, 26, 12, 18, 21, 8, 5, 12, 28, 38, +22, 18, 21, 4, 7, 15, 51, 90, -55, 44, 83, 6, 125, 75, 47, 53, 12, 13, 34, 19, 32, 56, 50, 25, 29, +18, 35, 9, 9, 36, 12, 22, 33, 55, 26, 74, 6, 49, 11, 31, 50, 41, 44, 6, 19, 49, -24, 47, 45, 36, +80, 43, 40, 35, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, +33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, +0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, +32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 1, -1, -36, -2, -19, 1, -81, 4, -46, 0, 5, +0, 16, -75, 0, 3, 2, 5, 1, 2, 47, -35, -58, 0, 47, 47, -51, 49, 48, 19, 17, 35, 17, 33, 21, 36, +72, 1, -45, 4, -117, -6, 98, 5, -27, 71, 0, 0, 1, -2, 81, -2, -19, 0, 36, 4, -46, 0, 5, 0, 16, +-75, 5, 2, 3, 0, 3, 4, 47, -51, -58, 0, 47, 47, -51, 49, 48, 1, 53, 33, 17, 35, 17, -2, 81, 1, +-45, 72, 4, -117, 71, -6, 27, 5, -98, 0, 1, -1, 22, -2, -19, 0, -22, 5, -123, 0, 11, 0, 33, 64, 14, +6, 9, 10, 0, 5, 10, 3, 8, 0, 2, 3, 10, 5, 3, 47, -42, -51, 16, -35, -42, 60, 0, 47, 47, -35, +60, 16, -42, -51, 49, 48, 19, 35, 17, 35, 17, 35, 17, 33, 21, 33, 17, 33, -22, -58, 72, -58, 1, -44, -2, +114, 1, -114, 3, -40, -5, 21, 4, -21, 1, -83, 71, -2, -31, 0, 1, -1, 22, -2, -19, 0, -22, 5, -123, 0, +11, 0, 33, 64, 14, 5, 2, 1, 11, 6, 1, 8, 1, 6, 8, 9, 3, 11, 9, 47, -42, -64, 16, -35, -42, +-51, 0, 47, 47, -35, -64, 16, -42, -51, 49, 48, 3, 33, 17, 33, 53, 33, 17, 35, 17, 35, 17, 35, -22, 1, +-114, -2, 114, 1, -44, -58, 72, -58, 4, 31, 1, 31, 71, -2, 83, -5, 21, 4, -21, 0, 1, -1, 22, -2, -19, +0, -22, 5, -123, 0, 7, 0, 27, 64, 13, 47, 6, 127, 6, 2, 6, 0, 5, 3, 0, 2, 5, 3, 47, -58, +-35, -58, 0, 47, 47, 60, -51, 93, 49, 48, 19, 35, 17, 35, 17, 35, 17, 33, -22, -58, 72, -58, 1, -44, 3, +-40, -5, 21, 4, -21, 1, -83, 0, 0, 2, -1, 22, -2, -19, 0, -22, 5, -123, 0, 6, 0, 10, 0, 64, 64, +30, 5, 7, 9, 3, 3, 10, 4, 8, 64, 16, 21, 52, 8, 10, 6, 2, 1, 8, 4, 10, 10, 0, 1, 7, +5, 0, 1, 9, 3, 1, 47, -42, -51, 16, -35, -42, -51, 17, 18, 57, 61, 47, 60, 60, 0, 24, 47, 47, 60, +-35, -34, 43, -51, 18, 57, 61, 47, 60, 60, 60, 49, 48, 19, 35, 17, 39, 55, 23, 7, 55, 39, 7, 23, 36, +72, -58, -22, -22, -58, 98, -122, -122, -122, -2, -19, 5, 11, -74, -41, -41, -74, -74, 121, 121, 120, 0, 0, 1, -1, +22, -2, -19, 0, -22, 5, -123, 0, 13, 0, 35, 64, 15, 4, 3, 7, 0, 8, 13, 11, 8, 6, 10, 11, 3, +13, 1, 11, 47, -64, -42, -64, 16, -35, -64, -50, 0, 47, 47, -64, -35, -64, -42, -51, 49, 48, 3, 51, 17, 35, +53, 33, 17, 51, 21, 35, 17, 35, 17, 35, -22, -58, -58, 1, 14, -58, -58, 72, -58, 4, 31, 1, 31, 71, -2, +-102, 71, -5, 21, 4, -21, 0, 1, -1, 22, -2, -19, 0, -22, 5, -123, 0, 15, 0, 41, 64, 18, 5, 4, 6, +3, 9, 0, 10, 15, 13, 5, 10, 7, 12, 13, 4, 15, 2, 13, 47, -64, -42, -64, 16, -35, -64, -42, -64, 0, +47, 47, -64, -35, -64, -42, -64, -35, -64, 49, 48, 3, 51, 17, 35, 53, 33, 21, 35, 17, 51, 21, 35, 17, 35, +17, 35, -22, -58, -58, 1, -44, -58, -58, -58, 72, -58, 4, 31, 1, 31, 71, 71, -2, -31, 71, -5, 21, 4, -21, +0, 2, -1, 22, -2, -19, 0, -22, 5, -123, 0, 3, 0, 11, 0, 33, 64, 14, 5, 3, 0, 7, 4, 0, 10, +1, 7, 9, 10, 0, 4, 10, 47, -42, -51, 16, -35, -42, -51, 0, 47, 47, -35, 60, 16, -42, -51, 49, 48, 3, +33, 17, 33, 3, 17, 33, 17, 35, 17, 35, 17, -92, 1, 72, -2, -72, 70, 1, -44, -58, 72, 4, 31, 1, 31, +-2, -102, 1, -83, -2, 83, -5, 21, 4, -21, 0, 0, 1, -1, 22, -2, -19, 0, -22, 5, -123, 0, 5, 0, 20, +-73, 3, 5, 2, 1, 4, 0, 3, 1, 47, -58, -35, -58, 0, 47, 47, 60, -51, 49, 48, 19, 35, 17, 3, 33, +3, 36, 72, -58, 1, -44, -58, -2, -19, 5, 44, 1, 108, -2, -108, 0, 1, -1, 22, -2, -19, 0, -22, 5, -123, +0, 6, 0, 29, 64, 11, 5, 6, 4, 2, 5, 5, 2, 6, 1, 4, 2, 47, -58, -35, -58, 18, 57, 61, 47, +0, 24, 47, 47, 60, -51, 49, 48, 19, 17, 35, 17, 35, 19, 19, 36, 72, -58, -22, -22, 3, -40, -5, 21, 4, +-21, 1, -83, -2, 83, 0, 0, 2, -1, -36, -2, 87, 0, 36, 7, 39, 0, 3, 0, 7, 0, 29, 64, 12, 2, +2, 3, 7, 7, 6, 3, 6, 1, 5, 2, 6, 47, 60, -35, 60, 0, 47, 47, 18, 57, 47, 18, 57, 47, 49, +48, 19, 17, 35, 17, 19, 17, 35, 17, 36, 72, 72, 72, 7, 39, -4, 56, 3, -56, -6, -8, -4, 56, 3, -56, +0, 0, 1, -1, 22, -2, 87, 0, -22, 7, 39, 0, 11, 0, 31, 64, 13, 7, 4, 5, 10, 1, 0, 7, 11, +9, 2, 4, 0, 2, 47, -35, -64, 16, -35, -35, -64, 0, 47, -35, -64, 47, -35, -64, 49, 48, 3, 53, 51, 17, +35, 53, 33, 21, 35, 17, 51, 21, -22, -58, -58, 1, -44, -58, -58, -2, 87, 71, 8, 66, 71, 71, -9, -66, 71, +0, 1, -1, -36, -2, 87, 0, -32, 7, 39, 0, 4, 0, 19, -74, 1, 0, 4, 3, 0, 2, 3, 47, -35, -50, +0, 47, 47, 25, -35, -51, 49, 48, 19, 7, 17, 35, 17, -32, -68, 72, 6, 110, -114, -8, 119, 8, -48, 0, 1, +-1, 32, -2, 87, 0, 36, 7, 39, 0, 4, 0, 27, 64, 12, 6, 4, 22, 4, 2, 3, 4, 0, 2, 1, 4, +2, 47, -50, -51, 0, 47, 47, 25, -35, -51, 49, 48, 0, 93, 19, 17, 35, 17, 39, 36, 72, -68, 7, 39, -9, +48, 7, -119, -114, 0, 1, -1, -36, -2, 87, 0, -22, 7, 39, 0, 5, 0, 16, -75, 5, 1, 4, 3, 1, 4, +47, -35, -51, 0, 47, -51, 47, 49, 48, 19, 17, 51, 21, 33, 17, 36, -58, -2, -14, 7, 39, -9, 119, 71, 8, +-48, 0, 0, 2, 0, 74, 0, -21, 4, 33, 4, -64, 0, 27, 0, 39, 0, -67, 64, 24, 47, 41, 1, 8, 16, +14, 15, 22, 2, 0, 1, 23, 15, 17, 16, 9, 1, 3, 2, 22, 33, 16, 1, 16, -68, 2, -94, 0, 17, 2, +-72, 0, 21, 2, -72, -78, 31, 41, 19, -72, 1, 105, -75, 5, 8, 46, 2, 1, 2, -68, 2, -94, 0, 7, 2, +-72, 0, 3, 2, -72, 64, 22, 37, 41, 5, 9, 46, 15, 48, 15, 64, 15, -126, 15, 4, 15, 62, 34, 41, 14, +62, 10, 62, 12, -72, 1, 105, 64, 27, 28, 41, 26, 23, 33, 1, 63, 1, 79, 1, -115, 1, 4, 1, 62, 24, +62, 0, 62, 56, 26, 72, 26, -49, 26, 3, 26, -72, 1, -2, -75, 40, 5, 7, -98, 121, 24, 43, 0, 63, 1, +78, 16, -12, 93, 77, -28, -28, -12, 93, 60, 16, -19, -3, -28, -28, -19, -12, 93, 60, 0, 77, 16, -19, -28, -28, +-12, 93, 60, 16, -3, -19, -28, -28, -12, 93, 60, 17, 18, 57, 57, 17, 18, 57, 57, 1, 17, 18, 57, 57, 17, +18, 57, 57, 49, 48, 1, 93, 19, 39, 55, 23, 54, 51, 50, 23, 55, 23, 7, 22, 21, 20, 7, 23, 7, 39, +6, 35, 34, 39, 7, 39, 55, 38, 53, 52, 23, 20, 22, 51, 50, 54, 53, 52, 38, 35, 34, 6, -43, -117, 115, +-117, 106, -125, -124, 105, -117, 116, -117, 71, 71, -117, 116, -117, 105, -124, -125, 106, -117, 115, -117, 71, -93, -104, 107, 107, +-104, -105, 108, 107, -104, 3, -63, -120, 119, -117, 72, 72, -117, 119, -120, 110, 125, 126, 110, -120, 119, -116, 73, 73, -116, +119, -120, 110, 126, 125, 125, 108, -104, -104, 108, 107, -104, -104, 0, 0, 16, 0, 0, 0, 0, 8, 0, 5, -63, 0, +5, 0, 9, 0, 13, 0, 25, 0, 29, 0, 35, 0, 46, 0, 52, 0, 56, 0, 68, 0, 72, 0, 76, 0, 82, +0, 89, 0, 96, 0, 104, 1, -2, 64, -1, -89, 15, -73, 15, 2, 119, 15, -121, 15, -105, 15, 3, 122, 38, 1, +83, 37, 99, 37, 2, 35, 37, 51, 37, 67, 37, 3, 89, 61, 105, 61, 2, 41, 61, 57, 61, 73, 61, 3, 89, +65, 105, 65, 2, 41, 65, 57, 65, 73, 65, 3, 86, 59, 102, 59, 2, 38, 59, 54, 59, 70, 59, 3, 86, 67, +102, 67, 2, 38, 67, 54, 67, 70, 67, 3, -58, 102, 1, -59, 104, 1, -54, 98, 1, -55, 100, 1, 86, 96, 102, +96, 2, 89, 91, 105, 91, 2, -91, 42, -75, 42, 2, 99, 42, 1, -75, 42, -59, 42, -43, 42, -11, 42, 4, 117, +42, -123, 42, -107, 42, 3, 51, 42, 67, 42, 83, 42, 3, 99, 66, 24, 66, 40, 45, 87, 111, 93, 1, 63, 93, +79, 93, 95, 93, 3, 93, 93, 39, 86, 80, 40, 1, 47, 40, 63, 40, 79, 40, 3, 40, 47, 12, 79, 71, 1, +71, 1, 50, 51, 7, 27, 3, 47, 8, 28, 4, 51, 19, 21, 103, 16, 60, 94, 80, 39, 1, 15, 39, 79, 39, +95, 39, 3, -97, 39, 1, 32, 39, 48, 39, 64, 39, 3, 39, 82, 11, 70, 34, 79, 77, 55, 75, 32, 82, 54, +74, 31, 77, 97, 112, 57, -128, 57, -112, 57, 3, 64, 57, 80, 57, 96, 57, 3, 31, 57, 1, 57, 39, 87, 48, +94, 1, 94, 31, 39, -65, 39, 2, 31, 39, 95, 39, 111, 39, -97, 64, 102, 39, -33, 39, -17, 39, 6, 39, 36, +85, 45, 101, 45, 2, 37, 45, 53, 45, 69, 45, 3, 45, 83, -97, 43, 1, 43, 95, 18, 111, 18, 2, 18, 90, +80, 36, 1, 36, 23, -112, 14, 1, 111, 14, 127, 14, 2, 14, 33, 7, 54, 9, 53, 35, 3, 0, 31, 1, 31, +35, 1, 11, 33, 0, 10, 35, 106, 48, 101, 1, 101, 111, 63, 127, 63, 2, 15, 63, 31, 63, 63, 63, 79, 63, +4, 63, 26, 73, 27, 74, 78, 47, 15, 77, 1, 77, 78, 49, 69, 81, 50, 70, 78, 47, -64, -64, -35, -64, -64, +16, -35, 93, -64, 16, -44, -64, -35, -64, 47, 93, 113, -51, 114, 16, -48, -64, -64, -35, -64, -64, 16, -44, 93, -64, +16, -44, -64, -35, -64, 16, -42, 113, 93, -51, -44, 93, -51, -58, 93, -44, 113, -51, 51, 93, 93, 16, -44, 93, 113, +-35, 114, -64, 16, -42, 93, 93, 93, -51, 0, 47, -64, 60, 60, -35, -64, 60, 60, 16, -44, -64, -42, -64, 16, -42, +93, 93, 113, 93, -51, -44, -64, -35, -48, -58, 47, -64, 60, 60, -35, -64, 60, 60, 16, -35, -64, -42, 93, -64, 16, +-42, 93, 113, -51, 18, 57, 47, 113, 113, -51, 57, 16, -60, -64, 16, -51, 49, 48, 93, 93, 113, 93, 93, 113, 113, +93, 93, 93, 93, 1, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 113, 93, 93, 1, 35, 53, 35, 53, 33, 5, +33, 53, 33, 1, 35, 17, 51, 1, 20, 35, 34, 39, 55, 22, 51, 50, 53, 17, 51, 1, 33, 53, 33, 1, 33, +53, 51, 53, 51, 1, 20, 33, 35, 17, 51, 50, 21, 20, 7, 22, 1, 35, 21, 35, 17, 33, 1, 33, 53, 33, +1, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 1, 35, 17, 51, 1, 33, 53, 33, 5, 33, 17, 51, 21, +51, 1, 52, 35, 35, 21, 51, 50, 23, 52, 35, 35, 21, 51, 50, 37, 16, 35, 34, 17, 16, 51, 50, 8, 0, +100, -33, 1, 67, -3, -63, -2, -67, 1, 67, 2, 63, 100, 100, -2, -10, -45, 86, 52, 73, 25, 40, 95, 116, -4, +-116, -2, -67, 1, 67, 4, 126, -2, -67, -33, 100, -3, -113, -2, -18, -16, -21, -7, 89, 119, -5, -76, -33, 100, 1, +67, 4, 126, -2, -67, 1, 67, -3, -107, -92, -103, -103, -95, -95, -103, -103, -92, -3, 14, 100, 100, 3, 30, -2, -67, +1, 67, -3, -63, -2, -67, 100, -33, 3, -70, -93, 89, 101, -105, 30, -85, 111, 124, -98, -3, -57, -55, -58, -58, -55, +4, 126, -33, 100, 100, 100, -4, 126, 1, 67, -2, -31, -15, 45, 79, 26, -118, 1, -28, 1, 27, 100, -6, 63, 100, +-33, 1, 12, -47, 2, -60, -70, 91, 54, 46, 2, -108, -33, 1, 67, -6, 63, 100, 2, 123, -83, -64, -64, -83, -81, +-64, -64, -2, -79, 1, 67, -4, 126, 100, 100, 1, 67, -33, 3, 25, 99, -62, -49, 109, -36, -1, 1, 13, -2, -13, +-2, -11, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, +0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, +3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, +7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, +32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, +33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, +0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, +32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, +0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, +0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, +37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, +0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, +-4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, +3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, +-5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, +17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, +1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, +0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, +4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, +0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, +0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, +-64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 1, 0, 127, -2, 83, 2, 48, 6, 72, 0, 23, 0, 72, -71, 0, 22, -1, -32, -77, 11, 17, +52, 16, -72, -1, -12, -77, 14, 17, 52, 15, -72, -1, -32, -76, 10, 17, 52, 0, 1, -72, 3, 6, -78, 14, 13, +13, -72, 2, -6, -78, 14, 14, 1, -72, 2, -6, -78, 0, 0, 7, -71, 2, -1, 0, 18, 47, -19, 51, 47, -20, +60, 16, -3, 0, 47, 51, 63, 51, 49, 48, 1, 43, 43, 43, 1, 7, 38, 39, 38, 39, 38, 17, 52, 55, 54, +55, 54, 55, 23, 6, 7, 6, 21, 20, 23, 22, 23, 22, 2, 48, 44, 104, 51, 103, 57, 74, 74, 58, 102, 53, +100, 46, 108, 56, 60, 34, 28, 56, 28, -2, -128, 45, 125, 78, -98, -82, -28, 1, 5, -6, -32, -79, -98, 83, 121, +42, -18, -22, -7, -14, -12, -62, -99, -106, 75, 0, -1, -1, 0, 93, -2, 83, 2, 14, 6, 72, 0, 87, 3, 124, +2, -115, 0, 0, -64, 0, 64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 4, 0, 21, 1, 37, 4, -45, 6, 32, 0, 12, 0, 47, 0, 124, 0, -121, 1, 79, 64, 35, 5, 0, 1, +7, 7, 1, 1, 37, 45, 46, 41, 36, 37, 29, 30, 19, 33, 16, 37, 37, 30, 15, 46, 1, 46, 46, 30, 64, +9, 12, 52, 30, 30, 33, 41, -72, 2, -11, -78, 16, 16, 33, -72, 2, -11, 64, 26, 23, 23, 99, -126, 126, -123, +57, 87, 61, 64, 67, 126, 126, -123, 73, 73, 80, 80, 119, 99, 99, -123, -123, 87, 67, 107, -72, 2, -17, -78, 53, +53, 87, -72, 2, -17, -78, 61, 61, 67, -72, 2, -21, -78, 5, 5, 1, -72, 2, -7, -74, 0, 0, 19, 37, 36, +13, 46, -72, 2, -7, -76, 45, 45, 37, 26, 29, -72, 2, -7, -78, 30, 30, 36, -72, 2, -7, -73, 64, 37, 37, +99, 57, 90, 103, 95, -72, 3, 3, 64, 18, 99, 99, 119, 80, 103, 103, 48, 84, -126, -126, 70, 73, 126, 125, 64, +4, 84, 76, -72, 3, 3, -78, 80, 80, 84, -72, -1, -64, -77, 16, 17, 52, 84, -72, -1, -64, 64, 10, 9, 10, +52, 84, 84, 70, 53, 110, 48, 115, -72, 3, 3, -74, 32, 119, 119, 48, 48, -119, 70, -72, 1, 28, -123, 47, 17, +51, 47, 51, 25, 47, 26, -3, 17, 57, 57, 24, 17, 57, 47, 43, 43, 51, 25, 47, -3, 17, 23, 57, 24, 17, +57, 47, 17, 18, 57, 47, 25, 17, 18, 57, 47, -3, 17, 57, 57, 17, 51, 24, 47, 26, -3, 50, 47, -3, 50, +17, 51, 47, -3, 50, 17, 18, 57, 51, 47, -3, 50, 47, 0, 63, 60, 16, -19, 60, 16, -19, 17, 18, 57, 47, +50, 47, 60, 57, 47, 57, 47, 18, 57, 47, 17, 57, 17, 18, 57, 17, 18, 57, 17, 51, 47, -19, 57, 47, -19, +17, 51, 47, 43, 50, 47, 93, 18, 57, 47, 17, 18, 57, 17, 57, 17, 57, 17, 18, 57, 17, 51, 47, 51, 47, +18, 57, 57, 49, 48, 1, 7, 38, 39, 38, 39, 54, 51, 50, 23, 22, 23, 22, 23, 20, 6, 35, 34, 38, 39, +6, 7, 6, 35, 34, 38, 53, 52, 54, 55, 55, 20, 22, 51, 50, 54, 55, 55, 22, 23, 22, 51, 50, 55, 54, +55, 55, 22, 1, 20, 7, 6, 7, 7, 34, 39, 38, 39, 6, 7, 6, 35, 34, 38, 39, 6, 6, 35, 34, 38, +53, 52, 54, 55, 38, 38, 53, 52, 55, 54, 55, 22, 23, 22, 23, 22, 22, 51, 50, 54, 55, 3, 38, 39, 38, +53, 52, 55, 54, 55, 22, 22, 23, 23, 22, 23, 22, 51, 50, 54, 55, 3, 38, 39, 38, 53, 52, 55, 54, 55, +22, 23, 22, 23, 22, 5, 39, 6, 7, 6, 7, 22, 22, 51, 50, 54, 2, -3, 21, 25, 51, 13, 54, 9, 37, +37, 21, 31, 5, 17, -69, 53, 41, 23, 37, 23, 12, 25, 32, 33, 42, 42, 8, 2, 30, 29, 32, 21, 47, 6, +23, 11, 6, 14, 38, 27, 19, 12, 8, 25, 5, 1, 34, 5, 8, 20, 13, 119, 76, 61, 46, 40, 56, 48, 63, +65, 123, 22, 40, 112, 53, 112, -124, -28, -92, 4, 11, 23, 19, 32, 13, 14, 21, 22, 12, 67, 57, 46, 51, 39, +59, 7, 3, 7, 23, 19, 32, 9, 23, 23, 36, 16, 32, 39, 66, 28, 35, 5, 58, 7, 2, 7, 23, 20, 29, +4, 30, 36, 16, 27, -4, -18, 19, 88, 46, 52, 35, 22, 55, 50, 28, 60, 5, 81, 8, 61, 53, 14, 45, 42, +36, 57, 12, 42, 106, 72, 107, 11, 13, 30, 24, 31, 54, 45, 18, 45, 12, 12, 48, 35, 85, 40, 6, 40, 7, +19, 41, 27, 38, 6, 20, -4, -93, 37, 31, 50, 38, 25, 35, 28, 59, 68, 29, 25, 76, 60, 59, 77, 33, 26, +84, -43, 76, 15, 52, 15, 34, 42, 34, 38, 82, 82, 123, 106, 55, 48, 25, 60, 1, 17, 32, 20, 39, 17, 35, +42, 34, 37, 51, 119, 114, -84, 73, 38, 46, 45, 39, 1, 17, 42, 10, 41, 15, 34, 43, 37, 34, 25, -121, -92, +84, -114, 23, 111, 32, 31, 35, 56, 9, 10, 33, -1, -1, 0, 121, 0, -109, 2, -24, 3, 51, 0, 22, 2, -17, +0, 0, 0, 2, 0, 14, 1, 10, 1, -90, 6, -99, 0, 22, 0, 43, 0, -116, 64, 14, 0, 20, 22, 64, 22, +63, 52, 22, 22, 16, 20, 12, 8, 11, -72, -1, -64, -74, 22, 63, 52, 11, 11, 4, 16, -72, 2, -15, -78, 8, +8, 20, -72, 2, -15, 64, 11, 4, 64, 9, 15, 52, 4, 4, 39, 28, 27, 36, -68, 2, -17, 0, 39, 3, 11, +0, 27, 3, 15, 64, 9, 22, 22, 0, 11, 0, 11, 12, 12, 36, -72, 3, 16, -74, 39, 39, 31, 28, 27, 27, +23, -71, 3, 16, 0, 31, 47, -19, 25, 57, 47, 51, 17, 57, 47, 24, -3, 50, 47, 51, 51, 25, 47, 24, 47, +51, 25, 47, 0, 24, 63, 63, -28, 17, 57, 17, 51, 47, 43, -19, 51, 47, -19, 18, 57, 47, 43, 18, 57, 17, +18, 57, 47, 43, 18, 57, 49, 48, 1, 6, 7, 6, 35, 34, 39, 38, 35, 34, 6, 7, 39, 54, 55, 54, 51, +50, 23, 22, 51, 50, 55, 3, 20, 7, 6, 7, 39, 54, 54, 53, 52, 2, 39, 38, 39, 54, 54, 55, 22, 18, +23, 22, 1, -90, 28, 29, 41, 48, 50, 45, 99, 6, 12, 24, 15, 11, 25, 11, 23, 38, 9, 100, 50, 33, 53, +52, 70, 29, 15, 50, 18, 3, 5, 33, 23, 14, 17, 20, 51, 23, 16, 49, 14, 18, 6, 118, 32, 17, 24, 15, +33, 7, 7, 13, 36, 9, 20, 32, 16, 23, -5, -96, 80, 75, 40, 87, 10, 29, 76, 13, 104, 1, 117, -53, 123, +-128, 44, 102, 45, 114, -2, 116, -97, -58, 0, 2, -1, -36, 1, 37, 1, -42, 6, -99, 0, 22, 0, 45, 0, -112, +64, 14, 23, 43, 45, 64, 22, 63, 52, 45, 45, 39, 43, 35, 31, 34, -72, -1, -64, -74, 22, 63, 52, 34, 34, +27, 39, -72, 2, -15, -78, 31, 31, 43, -72, 2, -15, -73, 27, 64, 9, 15, 52, 27, 27, 12, -66, 2, -17, 0, +13, 3, 11, 0, 22, 2, -17, 0, 1, 2, -21, 64, 18, 45, 45, 23, 34, 23, 34, 35, 35, 12, 64, 9, 17, +52, 12, 12, 13, 13, 6, -72, 3, 18, -78, 17, 17, 0, -71, 2, -16, 0, 47, 16, -11, 50, 47, -3, 25, 57, +47, 50, 24, 47, 43, 51, 47, 51, 51, 25, 47, 24, 47, 51, 25, 47, 0, 24, 63, -19, 63, -20, 51, 47, 43, +-19, 51, 47, -19, 18, 57, 47, 43, 18, 57, 17, 18, 57, 47, 43, 18, 57, 49, 48, 1, 35, 34, 39, 38, 38, +39, 46, 2, 39, 38, 39, 55, 22, 23, 22, 19, 22, 23, 22, 51, 51, 3, 6, 7, 6, 35, 34, 39, 38, 35, +34, 6, 7, 39, 54, 55, 54, 51, 50, 23, 22, 51, 50, 55, 1, -42, -116, 68, 41, 36, 37, 10, 6, 13, 21, +18, 22, 39, 123, 39, 16, 10, 10, 18, 34, 28, 33, -116, 98, 28, 29, 41, 48, 50, 45, 99, 6, 12, 24, 15, +11, 25, 11, 23, 38, 9, 100, 50, 33, 53, 52, 1, 37, 55, 48, -66, -117, 113, -18, 123, 39, 48, 36, -62, 120, +-89, 104, -2, 124, -78, 50, 42, 4, -93, 32, 17, 24, 15, 33, 7, 7, 13, 36, 9, 20, 32, 16, 23, 0, 0, +2, 0, 86, 1, 10, 1, 110, 7, 10, 0, 31, 0, 52, 0, -101, -71, 0, 3, -1, -32, -77, 18, 25, 52, 2, +-72, -1, -32, -75, 11, 17, 52, 37, 36, 45, -70, 2, -17, 0, 48, -1, -64, 64, 13, 9, 42, 52, 48, 48, 5, +21, 0, 23, 7, 29, 5, 5, -72, -1, -64, -74, 18, 25, 52, 5, 29, 29, 23, -68, 2, -11, 0, 15, 3, 21, +0, 36, 3, 15, 64, 11, 21, 7, 18, 18, 26, 0, 0, 26, 5, 5, 11, -72, 3, 5, -78, 26, 26, 45, -72, +3, 16, -74, 48, 48, 40, 37, 36, 36, 32, -70, 3, 16, 0, 40, 1, 59, -123, 47, -19, 25, 57, 47, 51, 17, +57, 47, 24, -3, 57, 47, -3, 50, 47, 17, 51, 47, 18, 57, 47, 57, 57, 0, 63, 63, -3, 50, 47, 51, 43, +47, 18, 57, 17, 57, 57, 17, 51, 125, 47, 24, 43, -28, 17, 57, 49, 48, 0, 43, 43, 1, 20, 7, 6, 7, +7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, +50, 54, 19, 20, 7, 6, 7, 39, 54, 54, 53, 52, 2, 39, 38, 39, 54, 54, 55, 22, 18, 23, 22, 1, 110, +31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 2, 29, +15, 50, 18, 3, 5, 33, 23, 14, 17, 20, 51, 23, 16, 49, 14, 18, 6, 102, 25, 20, 13, 15, 64, 46, 35, +16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, -5, -54, 80, 75, 40, 87, 10, +29, 76, 13, 104, 1, 117, -53, 123, -128, 44, 102, 45, 114, -2, 116, -97, -58, 0, 2, 0, 16, 1, 37, 1, -42, +7, 10, 0, 31, 0, 54, 0, -100, -71, 0, 2, -1, -32, -77, 11, 17, 52, 44, -70, 2, -17, 0, 45, -1, -64, +64, 13, 9, 42, 52, 45, 45, 5, 21, 0, 23, 7, 29, 5, 5, -72, -1, -64, -74, 18, 25, 52, 5, 29, 29, +23, -66, 2, -11, 0, 15, 3, 21, 0, 54, 2, -17, 0, 33, 2, -21, 64, 11, 21, 7, 18, 18, 26, 0, 0, +26, 5, 5, 11, -72, 3, 5, 64, 13, 26, 26, 45, 44, 64, 9, 17, 52, 44, 44, 45, 45, 38, -72, 3, 18, +-78, 49, 49, 32, -70, 2, -16, 0, 56, 1, 59, -123, 16, -11, 50, 47, -3, 25, 57, 47, 50, 24, 47, 43, 18, +57, 47, -3, 50, 47, 17, 51, 47, 18, 57, 47, 57, 57, 0, 63, -19, 63, -3, 50, 47, 51, 43, 47, 18, 57, +17, 57, 57, 17, 51, 125, 47, 24, 43, -20, 49, 48, 0, 43, 1, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, +53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 19, 35, 34, 39, +38, 38, 39, 46, 2, 39, 38, 39, 55, 22, 23, 22, 19, 22, 23, 22, 51, 51, 1, 40, 31, 21, 42, -70, 100, +31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, -52, -116, 68, 41, 36, 37, 10, +6, 13, 21, 18, 22, 39, 123, 39, 16, 10, 10, 18, 34, 28, 33, -116, 6, 102, 25, 20, 13, 15, 64, 46, 35, +16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, -6, -53, 55, 48, -66, -117, 113, +-18, 123, 39, 48, 36, -62, 120, -89, 104, -2, 124, -78, 50, 42, 0, 3, 0, 50, -1, 99, 3, 117, 4, 113, 0, +32, 0, 42, 0, 74, 0, -51, -71, 0, 45, -1, -32, 64, 9, 11, 17, 52, 16, 64, 11, 17, 52, 3, -72, -1, +-32, 64, 15, 11, 18, 52, 18, 64, 9, 17, 52, 64, 43, 66, 50, 72, 48, 58, -72, 2, -11, 64, 21, 66, 66, +72, 64, 18, 25, 52, 72, 72, 48, 64, 9, 29, 52, 48, 48, 28, 11, 20, 10, 28, -72, 2, -17, -78, 37, 37, +33, -70, 2, -17, 0, 20, 2, -21, -78, 10, 10, 14, -70, 3, 10, 0, 4, 3, 8, 64, 11, 64, 50, 61, 61, +69, 43, 43, 69, 48, 48, 54, -72, 3, 5, -78, 69, 69, 24, -72, 2, -3, -77, 40, 40, 10, 33, -68, 3, 3, +0, 20, 3, 3, 0, 0, 2, -16, -78, 76, 11, 10, -72, -1, -64, -77, 9, 12, 52, 10, -72, 1, 59, -123, 47, +43, 51, 16, -12, -19, -19, 17, 57, 47, -3, 50, 47, -3, 50, 47, 17, 51, 47, 18, 57, 47, 57, 57, 0, 63, +-3, 50, 25, 47, 24, 63, -3, 50, 47, -19, 17, 18, 57, 17, 51, 47, 43, 51, 47, 43, 51, 47, -19, 17, 18, +57, 17, 57, 57, 49, 48, 1, 43, 43, 43, 0, 43, 1, 20, 7, 6, 35, 34, 39, 38, 39, 38, 39, 55, 22, +22, 51, 50, 55, 54, 55, 54, 55, 34, 39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 21, 7, 38, 39, 38, 35, +34, 6, 21, 20, 22, 3, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, +6, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 3, 117, 122, -120, -78, 66, 70, 51, 82, 65, 65, 17, 56, +123, 49, 122, 109, 85, 85, 43, 79, -121, 67, 76, 48, 56, 86, 87, 38, 30, 63, 22, 31, 27, 39, 28, 41, 88, +77, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 1, +97, -91, -93, -74, 15, 11, 27, 23, 22, 35, 13, 29, 62, 49, 93, 47, 106, 43, 49, 112, 103, 88, 102, 101, 79, +-115, 5, 96, 37, 32, 37, 28, 49, 51, 1, -1, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, +27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, -1, -1, 0, 50, -1, 99, 3, 117, 4, 113, 0, 22, 3, -123, +0, 0, 0, 2, 0, 45, -1, 64, 1, 82, 5, -20, 0, 31, 0, 52, 0, -97, -71, 0, 2, -1, -32, 64, 10, +11, 17, 52, 21, 0, 23, 7, 29, 5, 15, -72, 2, -11, 64, 10, 23, 23, 29, 64, 18, 25, 52, 29, 29, 5, +-72, -1, -64, -74, 18, 20, 52, 32, 5, 1, 5, -72, -1, -64, -73, 9, 15, 52, 5, 5, 37, 36, 45, -70, 2, +-17, 0, 48, 3, 11, -77, 47, 36, 1, 36, -72, 3, 15, 64, 9, 21, 7, 18, 18, 0, 0, 5, 5, 26, -72, +3, 5, -77, 11, 11, 40, 45, -72, 3, 16, -74, 48, 48, 40, 37, 36, 36, 32, -70, 3, 16, 0, 40, 1, 59, +-123, 47, -19, 25, 57, 47, 51, 17, 57, 47, 24, -19, 17, 51, 47, -19, 51, 47, 50, 47, 57, 47, 57, 57, 0, +63, 93, 63, -28, 17, 57, 51, 47, 43, 93, 43, 51, 47, 43, 51, 47, -19, 17, 18, 57, 17, 57, 57, 49, 48, +0, 43, 5, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, +35, 34, 6, 21, 20, 22, 51, 50, 54, 19, 20, 7, 6, 7, 39, 54, 54, 53, 52, 2, 39, 38, 39, 54, 54, +55, 22, 18, 23, 22, 1, 69, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, 22, +43, 93, 33, 22, 19, 43, 29, 15, 50, 18, 3, 5, 33, 23, 14, 17, 20, 51, 23, 16, 49, 14, 18, 55, 25, +20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 2, +103, 80, 75, 40, 87, 10, 29, 76, 13, 104, 1, 117, -53, 123, -128, 44, 102, 45, 114, -2, 116, -97, -58, 0, 0, +2, 0, 19, -1, 64, 1, -42, 5, -20, 0, 22, 0, 54, 0, -87, -71, 0, 25, -1, -32, 64, 10, 11, 17, 52, +44, 23, 46, 30, 52, 28, 38, -72, 2, -11, 64, 13, 46, 46, 52, 64, 18, 25, 52, 52, 52, -112, 28, 1, 28, +-72, -1, -64, -74, 9, 14, 52, 28, 28, 1, 12, -66, 2, -17, 0, 13, 3, 11, 0, 22, 2, -17, 0, 1, 2, +-21, 64, 11, 44, 30, 41, 41, 49, 23, 23, 49, 28, 28, 34, -72, 3, 5, 64, 22, 49, 64, 13, 14, 52, 49, +64, 9, 10, 52, 49, 49, 12, 64, 9, 17, 52, 12, 12, 13, 13, 6, -72, 3, 18, -78, 17, 17, 0, -70, 2, +-16, 0, 56, 1, 59, -123, 16, -12, 50, 47, -3, 25, 57, 47, 50, 24, 47, 43, 50, 47, 43, 43, -3, 50, 47, +17, 51, 47, 18, 57, 47, 57, 57, 0, 63, -19, 63, -20, 17, 51, 47, 43, 93, 51, 47, 43, 51, 47, -19, 17, +18, 57, 17, 57, 57, 49, 48, 0, 43, 1, 35, 34, 39, 38, 38, 39, 46, 2, 39, 38, 39, 55, 22, 23, 22, +19, 22, 23, 22, 51, 51, 3, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, +20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 1, -42, -116, 68, 41, 36, 37, 10, 6, 13, 21, 18, +22, 39, 123, 39, 16, 10, 10, 18, 34, 28, 33, -116, -91, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, +29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 1, 37, 55, 48, -66, -117, 113, -18, 123, 39, 48, 36, -62, 120, +-89, 104, -2, 124, -78, 50, 42, -3, -10, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, 27, 22, +14, 29, 18, 28, 18, 12, 15, 52, 3, 0, 0, 2, 0, 50, -1, -89, 4, -39, 4, 113, 0, 59, 0, 91, 0, +-16, -71, 0, 62, -1, -32, -77, 11, 17, 52, 38, -72, -1, -42, 64, 20, 14, 17, 52, 41, 52, 14, 17, 52, 42, +52, 11, 17, 52, 81, 60, 83, 67, 89, 65, 75, -72, 2, -11, 64, 21, 83, 83, 89, 64, 18, 25, 52, 89, 89, +15, 65, 1, 65, 65, 32, 3, 6, 14, 33, 39, 32, 65, 9, 3, 7, 0, 6, 2, -17, 0, 57, 3, 4, 0, +39, 2, -17, 0, 22, -1, -64, -77, 9, 11, 52, 22, -68, 3, 13, 0, 14, 2, -17, 0, 48, 2, -21, 64, 11, +81, 67, 78, 78, 86, 60, 60, 86, 65, 65, 71, -72, 3, 5, -77, 86, 86, 36, 51, -72, 3, 12, 64, 9, 10, +10, 44, 36, 3, 18, 0, 0, 44, -72, 2, -3, -76, 64, 18, 18, 93, 33, -69, 2, -5, 0, 32, 0, 32, -1, +-64, -75, 9, 11, 52, 32, 32, 36, -70, 3, 12, 0, 26, 1, 59, -123, 47, -3, 50, 25, 47, 43, 26, -19, 17, +51, 24, 47, 26, -19, 51, 47, 18, 57, 17, 18, 57, 47, -19, 17, 51, 47, -3, 50, 47, 17, 51, 47, 18, 57, +47, 57, 57, 0, 63, -19, 63, 43, -19, 63, -19, 63, 18, 57, 17, 18, 57, 17, 51, 47, 93, 51, 47, 43, 51, +47, -19, 17, 18, 57, 17, 57, 57, 49, 48, 1, 43, 43, 43, 0, 43, 1, 20, 6, 7, 38, 38, 35, 34, 7, +6, 21, 20, 22, 51, 51, 50, 22, 22, 21, 20, 7, 6, 33, 34, 39, 38, 53, 52, 55, 54, 55, 54, 55, 23, +6, 6, 21, 20, 22, 51, 50, 55, 54, 54, 53, 52, 38, 35, 35, 34, 38, 53, 52, 55, 54, 55, 54, 51, 50, +22, 37, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, 35, +34, 6, 21, 20, 22, 51, 50, 54, 4, -39, 12, 2, 35, 97, 50, 87, 96, 88, 43, 53, 80, 72, 69, 96, -37, +-55, -2, -87, -78, 94, 102, 34, 26, 46, 3, 60, 42, 63, 67, -87, -99, 120, -97, -120, -38, 25, 28, -22, 43, 66, +55, 60, 85, 102, 103, 66, 76, -4, -111, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, +36, 22, 43, 93, 33, 22, 19, 3, 32, 32, 67, 14, 45, 52, 101, 93, 55, 19, 19, 3, 16, 65, -5, -125, 120, +69, 75, -105, 104, 114, 87, 95, 6, 113, 17, 112, -61, 75, 122, 122, 48, 41, 114, 27, 19, 12, 62, 49, 67, 115, +125, 84, 101, 80, 107, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, +18, 12, 15, 52, 3, 0, 0, 2, 0, 36, -1, 31, 4, -75, 3, -18, 0, 54, 0, 86, 0, -31, -71, 0, 57, +-1, -32, -77, 11, 17, 52, 32, -72, -1, -32, 64, 10, 12, 17, 52, 76, 55, 78, 62, 84, 60, 70, -72, 2, -11, +64, 17, 78, 78, 84, 64, 18, 25, 52, 84, 84, 60, 60, 26, 53, 25, 25, 53, 6, -72, -1, -64, 64, 10, 9, +10, 52, 6, 6, 1, 44, 44, 1, 34, -70, 2, -17, 0, 17, -1, -64, -77, 9, 13, 52, 17, -68, 3, 14, 0, +53, 2, -17, 0, 1, 2, -21, 64, 11, 76, 62, 73, 73, 81, 55, 55, 81, 60, 60, 66, -72, 3, 5, -77, 81, +81, 30, 38, -72, 3, 12, -77, 13, 13, 0, 47, -72, 3, 12, -76, 64, 4, 4, 30, 0, -66, 2, -16, 0, 88, +0, 26, 2, -5, 0, 32, 0, 25, -1, -64, -75, 9, 11, 52, 25, 25, 30, -70, 3, 12, 0, 21, 1, 59, -123, +47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -27, 17, 57, 47, 26, -19, 18, 57, 47, -19, 17, 51, 47, -3, 50, +47, 17, 51, 47, 18, 57, 47, 57, 57, 0, 63, -19, 63, 43, -3, 17, 57, 47, 18, 57, 47, 43, 17, 51, 47, +18, 57, 51, 47, 51, 47, 43, 51, 47, -19, 17, 18, 57, 17, 57, 57, 49, 48, 1, 43, 0, 43, 1, 35, 34, +6, 21, 20, 51, 50, 22, 23, 22, 23, 22, 21, 20, 7, 6, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, +7, 6, 21, 20, 23, 22, 51, 50, 55, 54, 53, 52, 38, 35, 38, 38, 35, 34, 38, 53, 52, 55, 54, 55, 54, +51, 51, 1, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, +35, 34, 6, 21, 20, 22, 51, 50, 54, 4, -75, -81, -102, -101, 93, 41, 48, 81, 48, 18, 29, 123, -122, -2, -53, +-41, 127, -121, 64, 23, 98, 40, 38, 37, 57, -128, 122, -43, -113, 109, -122, 30, 35, 27, 115, 18, 63, 54, 73, 60, +101, 76, 84, -81, -4, -85, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, 22, 43, +93, 33, 22, 19, 1, 37, 16, 24, 33, 4, 9, 6, 9, 15, 37, -69, 85, 93, 73, 78, -112, 116, -126, 47, -102, +20, 65, 64, 110, 70, 123, 64, 61, 22, 27, 47, 17, 17, 3, 7, 33, 33, 124, 79, 64, 31, 23, 1, 119, 25, +20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 0, +2, -1, -70, 1, 37, 1, -12, 5, 89, 0, 12, 0, 44, 0, -114, -71, 0, 15, -1, -32, 64, 15, 11, 17, 52, +6, 52, 12, 17, 52, 34, 13, 36, 20, 42, 18, 28, -72, 2, -11, 64, 12, 36, 36, 42, 64, 18, 24, 52, 42, +42, 18, 18, 7, -66, 2, -17, 0, 8, 3, 4, 0, 2, 2, -17, 0, 1, 2, -21, 64, 11, 34, 20, 31, 31, +39, 13, 13, 39, 18, 18, 24, -72, 3, 5, -73, 39, 39, 1, 8, 8, 7, 7, 3, -67, 3, 3, 0, 0, 2, +-16, 0, 46, 0, 1, 1, 59, -123, 47, 16, -11, -3, 50, 47, 25, 57, 47, 24, 17, 57, 47, -3, 50, 47, 17, +51, 47, 18, 57, 47, 57, 57, 0, 63, -19, 63, -19, 51, 47, 51, 47, 43, 51, 47, -19, 17, 18, 57, 17, 57, +57, 49, 48, 1, 43, 0, 43, 1, 33, 53, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 3, 20, 7, 6, 7, +7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, +50, 54, 1, -12, -3, -58, 1, -15, 28, 19, 75, 78, 72, 18, 27, 108, 31, 21, 42, -70, 100, 31, 16, 21, 53, +59, 45, 20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 1, 37, -82, 118, 62, 43, 81, -93, 91, 51, 77, +-78, 2, -100, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, +15, 52, 3, 0, -1, -1, -1, -70, 1, 37, 1, -12, 5, 89, 0, 22, 3, -117, 0, 0, 0, 1, 0, -109, 1, +10, 1, 82, 5, -20, 0, 20, 0, 51, -78, 5, 4, 13, -66, 2, -17, 0, 16, 3, 11, 0, 4, 3, 15, 0, +13, 3, 16, -74, 16, 16, 8, 5, 4, 4, 0, -71, 3, 16, 0, 8, 47, -19, 25, 57, 47, 51, 17, 57, 47, +24, -19, 0, 63, 63, -28, 17, 57, 49, 48, 1, 20, 7, 6, 7, 39, 54, 54, 53, 52, 2, 39, 38, 39, 54, +54, 55, 22, 18, 23, 22, 1, 82, 29, 15, 50, 18, 3, 5, 33, 23, 14, 17, 20, 51, 23, 16, 49, 14, 18, +2, 36, 80, 75, 40, 87, 10, 29, 76, 13, 104, 1, 117, -53, 123, -128, 44, 102, 45, 114, -2, 116, -97, -58, 0, +0, 1, 0, 19, 1, 37, 1, -42, 5, -20, 0, 22, 0, 60, -65, 0, 12, 2, -17, 0, 13, 3, 11, 0, 22, +2, -17, 0, 1, 2, -21, 64, 10, 12, 64, 9, 17, 52, 12, 12, 13, 13, 6, -72, 3, 18, -78, 17, 17, 0, +-71, 2, -16, 0, 24, 16, -12, 50, 47, -3, 25, 57, 47, 50, 24, 47, 43, 0, 63, -19, 63, -20, 49, 48, 1, +35, 34, 39, 38, 38, 39, 46, 2, 39, 38, 39, 55, 22, 23, 22, 19, 22, 23, 22, 51, 51, 1, -42, -116, 68, +41, 36, 37, 10, 6, 13, 21, 18, 22, 39, 123, 39, 16, 10, 10, 18, 34, 28, 33, -116, 1, 37, 55, 48, -66, +-117, 113, -18, 123, 39, 48, 36, -62, 120, -89, 104, -2, 124, -78, 50, 42, 0, 0, 2, 0, 58, -1, -95, 5, -75, +3, -64, 0, 28, 0, 32, 0, -111, -71, 0, 16, -1, -64, 64, 11, 14, 17, 52, 22, 52, 12, 17, 52, 29, 31, +30, -72, 3, 2, -75, 32, 32, 1, 10, 18, 9, 65, 9, 3, 4, 0, 23, 2, -17, 0, 24, 3, 4, 0, 18, +2, -17, 0, 1, 2, -21, -78, 30, 32, 29, -72, 3, 1, -73, 31, 31, 5, 24, 24, 23, 23, 19, 65, 10, 3, +3, 0, 64, 0, 0, 2, -16, 0, 34, 0, 10, 2, -5, 0, 32, 0, 9, -1, -64, -75, 9, 11, 52, 9, 9, +14, -70, 3, 3, 0, 5, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -12, 26, -3, 50, 47, 25, +57, 47, 24, 17, 57, 47, -19, 57, 57, 0, 63, -19, 63, -19, 63, 18, 57, 17, 51, 47, -3, 57, 57, 49, 48, +1, 43, 43, 1, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 7, 6, 21, 20, 23, 22, 51, 33, 53, 52, +38, 39, 55, 22, 23, 22, 21, 1, 7, 39, 55, 5, -75, -4, 70, -64, 114, -113, 42, 15, 57, 30, 22, 21, 29, +124, 111, -86, 3, 79, 54, 65, 77, 44, 9, 68, -3, -61, 78, -94, 74, 1, 37, 67, 84, -77, 93, 97, 35, 98, +19, 46, 46, 71, 56, 118, 65, 58, 27, 112, -115, 50, -93, 55, 14, 112, -42, -3, -3, -111, 84, -110, 0, -1, -1, +0, 58, -1, -95, 5, -75, 3, -64, 0, 22, 3, -113, 0, 0, 0, 2, -1, -70, -1, -95, 1, -12, 3, -90, 0, +12, 0, 16, 0, 93, -73, 6, 52, 12, 17, 52, 15, 13, 14, -72, 3, 2, -77, 16, 16, 1, 7, -66, 2, -17, +0, 8, 3, 4, 0, 2, 2, -17, 0, 1, 2, -21, -78, 14, 16, 13, -72, 3, 1, -73, 15, 15, 1, 8, 8, +7, 7, 3, -67, 3, 3, 0, 0, 2, -16, 0, 18, 0, 1, 1, 42, -123, 47, 16, -12, -3, 50, 47, 25, 57, +47, 24, 17, 57, 47, -19, 57, 57, 0, 63, -19, 63, -19, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 1, 33, +53, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 3, 7, 39, 55, 1, -12, -3, -58, 1, -15, 28, 19, 75, 78, +72, 18, 27, 102, 78, -94, 74, 1, 37, -82, 118, 62, 43, 81, -93, 91, 51, 77, -78, -2, 25, -111, 84, -110, -1, +-1, -1, -70, -1, -95, 1, -12, 3, -90, 0, 22, 3, -111, 0, 0, 0, 4, 0, 0, 1, 10, 2, 44, 5, 32, +0, 3, 0, 7, 0, 25, 0, 39, 0, -112, -78, 0, 2, 3, -72, 3, 2, -76, 1, 1, 4, 6, 7, -72, 3, +2, 64, 15, 15, 5, 1, 5, 5, 22, 30, 32, 13, 17, 52, 20, 30, 37, 22, -72, 2, -17, -78, 21, 21, 37, +-70, 2, -17, 0, 12, 2, -21, -78, 1, 3, 0, -72, 3, 1, -76, 2, 2, 5, 7, 6, -72, 3, 1, 64, 12, +4, 4, 34, 30, 26, 21, 20, 16, 22, 22, 34, 26, -72, 2, -3, -77, 8, 8, 41, 34, -70, 2, -3, 0, 16, +1, 40, -123, 47, -19, 17, 51, 47, -19, 25, 17, 57, 47, 18, 57, 57, 18, 57, 17, 51, 24, 47, -3, 57, 57, +51, 47, -19, 57, 57, 0, 63, -3, 50, 47, -20, 18, 57, 57, 43, 17, 51, 47, 93, -19, 57, 57, 51, 47, -19, +57, 57, 49, 48, 1, 7, 39, 55, 7, 7, 39, 55, 1, 20, 7, 6, 35, 34, 39, 38, 53, 52, 55, 54, 55, +39, 55, 22, 23, 22, 7, 52, 39, 38, 39, 6, 7, 6, 21, 20, 22, 51, 50, 54, 1, -44, 78, -94, 75, 65, +76, -94, 74, 1, -30, 46, 71, -67, 73, 48, 55, 35, 32, 33, 15, 61, -75, 35, 120, 87, 110, 47, 54, 45, 9, +28, 57, 48, 56, -124, 4, -53, -112, 86, -113, -81, -111, 84, -111, -3, -121, -115, 71, 110, 29, 33, 61, 70, 92, 78, +79, 4, -87, 95, 25, 84, -89, 38, 63, 27, 26, 49, 12, 39, 35, 51, 57, 63, 0, 4, -1, -9, 1, 37, 3, +0, 6, 37, 0, 3, 0, 7, 0, 38, 0, 47, 0, -76, -75, 4, 11, 1, 0, 2, 3, -72, 3, 2, -76, 1, +1, 4, 6, 7, -72, 3, 2, 64, 17, 5, 64, 9, 11, 52, 5, 5, 29, 39, 43, 40, 13, 46, 16, 29, 29, +22, -72, 3, 10, -78, 40, 40, 46, -72, 2, -17, -75, -112, 16, 1, 16, 16, 38, -70, 2, -17, 0, 9, 2, -21, +-78, 1, 3, 0, -72, 3, 1, -76, 2, 2, 5, 7, 6, -72, 3, 1, 64, 12, 64, 4, 4, 43, 35, 8, 22, +40, 39, 13, 4, 25, -72, 2, -2, -73, 32, 15, 29, 1, 29, 29, 43, 8, -67, 2, -16, 0, 49, 0, 43, 3, +19, 0, 19, 1, 19, -123, 47, -19, 16, -27, 25, 17, 57, 47, 93, 26, -3, 23, 57, 18, 57, 24, 18, 57, 47, +26, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -3, 50, 47, 93, -3, 50, 47, -3, 50, 47, 17, 18, 57, 17, +57, 57, 17, 51, 47, 43, -19, 57, 57, 51, 47, -19, 57, 57, 49, 48, 1, 93, 1, 7, 39, 55, 7, 7, 39, +55, 1, 35, 34, 39, 38, 39, 6, 6, 35, 34, 38, 53, 52, 54, 55, 38, 38, 53, 52, 55, 54, 55, 22, 22, +23, 23, 22, 23, 22, 51, 51, 1, 39, 6, 6, 7, 22, 22, 51, 50, 2, 3, 78, -94, 75, 65, 76, -94, 74, +2, -121, -113, 72, 55, 41, 25, 30, 92, 51, 115, -103, -32, -88, 2, 13, 23, 19, 31, 10, 21, 14, 30, 25, 20, +31, 33, -113, -2, -93, 19, 87, 100, 34, 21, 56, 49, 60, 5, -48, -112, 86, -113, -81, -111, 84, -111, -5, 91, 123, +92, -111, 56, 62, 31, 24, 86, -47, 78, 8, 68, 8, 34, 42, 34, 36, 62, 116, 62, -84, -114, 68, 104, 1, 17, +109, 31, 67, 55, 9, 10, 0, 3, 0, 58, 1, 37, 5, -75, 5, 6, 0, 3, 0, 7, 0, 36, 0, -76, -71, +0, 24, -1, -64, 64, 11, 14, 17, 52, 30, 52, 12, 17, 52, 0, 2, 3, -72, 3, 2, -76, 1, 1, 4, 6, +7, -72, 3, 2, 64, 11, 5, 64, 9, 11, 52, 5, 5, 32, 18, 26, 17, 65, 9, 3, 4, 0, 31, 2, -17, +0, 32, 3, 4, 0, 26, 2, -17, 0, 9, 2, -21, -78, 1, 3, 0, -72, 3, 1, -76, 2, 2, 5, 7, 6, +-72, 3, 1, -73, 4, 4, 13, 32, 32, 31, 31, 27, 65, 10, 3, 3, 0, 64, 0, 8, 2, -16, 0, 38, 0, +18, 2, -5, 0, 32, 0, 17, -1, -64, -75, 9, 11, 52, 17, 17, 22, -70, 3, 3, 0, 13, 1, 42, -123, 47, +-3, 50, 25, 47, 43, 26, -19, 24, 16, -11, 26, -3, 50, 47, 25, 57, 47, 24, 17, 57, 47, -3, 57, 57, 51, +47, -19, 57, 57, 0, 63, -19, 63, -19, 63, 18, 57, 17, 51, 47, 43, -19, 57, 57, 51, 47, -19, 57, 57, 49, +48, 1, 43, 43, 1, 7, 39, 55, 7, 7, 39, 55, 1, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 7, +6, 21, 20, 23, 22, 51, 33, 53, 52, 38, 39, 55, 22, 23, 22, 21, 3, -33, 78, -94, 75, 65, 76, -94, 74, +3, 96, -4, 70, -64, 114, -113, 42, 15, 57, 30, 22, 21, 29, 124, 111, -86, 3, 79, 54, 65, 77, 44, 9, 68, +4, -79, -112, 86, -113, -81, -111, 84, -111, -4, 122, 67, 84, -77, 93, 97, 35, 98, 19, 46, 46, 71, 56, 118, 65, +58, 27, 112, -115, 50, -93, 55, 14, 112, -42, -1, -1, 0, 58, 1, 37, 5, -75, 5, 6, 0, 22, 3, -107, 0, +0, 0, 3, -1, -70, 1, 37, 1, -12, 5, 86, 0, 3, 0, 7, 0, 20, 0, 123, -73, 14, 52, 12, 17, 52, +0, 2, 3, -72, 3, 2, -76, 1, 1, 4, 6, 7, -72, 3, 2, -75, 15, 5, 1, 5, 5, 15, -66, 2, -17, +0, 16, 3, 4, 0, 10, 2, -17, 0, 9, 2, -21, -78, 1, 3, 0, -72, 3, 1, -76, 2, 2, 5, 7, 6, +-72, 3, 1, -73, 4, 4, 9, 16, 16, 15, 15, 11, -67, 3, 3, 0, 8, 2, -16, 0, 22, 0, 9, 1, 42, +-123, 47, 16, -11, -3, 50, 47, 25, 57, 47, 24, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -19, +63, -19, 51, 47, 93, -19, 57, 57, 51, 47, -19, 57, 57, 49, 48, 1, 43, 1, 7, 39, 55, 7, 7, 39, 55, +1, 33, 53, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 1, -17, 78, -94, 75, 65, 76, -94, 74, 1, -113, -3, +-58, 1, -15, 28, 19, 75, 78, 72, 18, 27, 5, 1, -112, 86, -113, -81, -111, 84, -111, -4, 42, -82, 118, 62, 43, +81, -93, 91, 51, 77, -78, 0, -1, -1, -1, -70, 1, 37, 1, -12, 5, 86, 0, 22, 3, -105, 0, 0, 0, 4, +0, 58, 1, 37, 5, -75, 5, -71, 0, 3, 0, 7, 0, 11, 0, 40, 0, -22, 64, 11, 11, 16, 18, 21, 52, +5, 16, 18, 21, 52, 1, -72, -1, -16, -77, 18, 21, 52, 28, -72, -1, -64, 64, 11, 14, 17, 52, 34, 52, 12, +17, 52, 0, 2, 3, -72, 3, 2, -75, 1, 1, 11, 4, 6, 7, -72, 3, 2, -76, 5, 5, 8, 10, 11, -72, +3, 2, 64, 11, 9, 64, 9, 11, 52, 9, 9, 36, 22, 30, 21, 65, 9, 3, 4, 0, 35, 2, -17, 0, 36, +3, 4, 0, 30, 2, -17, 0, 13, 2, -21, -78, 1, 3, 2, -72, 3, 1, -75, 0, 0, 8, 5, 7, 4, -72, +3, 1, -76, 6, 6, 9, 11, 10, -72, 3, 1, -73, 8, 8, 17, 36, 36, 35, 35, 31, 65, 10, 3, 3, 0, +64, 0, 12, 2, -16, 0, 42, 0, 22, 2, -5, 0, 32, 0, 21, -1, -64, -75, 9, 11, 52, 21, 21, 26, -70, +3, 3, 0, 17, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -11, 26, -3, 50, 47, 25, 57, 47, +24, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -3, 57, 57, 0, 63, -19, 63, -19, 63, 18, +57, 17, 51, 47, 43, -19, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, +43, 43, 1, 7, 39, 55, 1, 7, 39, 55, 7, 7, 39, 55, 1, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, +6, 7, 6, 21, 20, 23, 22, 51, 33, 53, 52, 38, 39, 55, 22, 23, 22, 21, 3, 26, 77, -96, 74, 1, 104, +78, -94, 75, 65, 76, -94, 74, 3, 96, -4, 70, -64, 114, -113, 42, 15, 57, 30, 22, 21, 29, 124, 111, -86, 3, +79, 54, 65, 77, 44, 9, 68, 5, 99, -110, 86, -110, -2, -8, -112, 86, -113, -81, -111, 84, -111, -4, 122, 67, 84, +-77, 93, 97, 35, 98, 19, 46, 46, 71, 56, 118, 65, 58, 27, 112, -115, 50, -93, 55, 14, 112, -42, -1, -1, 0, +58, 1, 37, 5, -75, 5, -71, 0, 22, 3, -103, 0, 0, 0, 4, -1, -70, 1, 37, 1, -12, 6, 9, 0, 3, +0, 7, 0, 11, 0, 24, 0, -78, 64, 11, 11, 16, 18, 21, 52, 5, 16, 18, 21, 52, 1, -72, -1, -16, 64, +11, 18, 21, 52, 18, 52, 12, 17, 52, 0, 2, 3, -72, 3, 2, -75, 1, 1, 11, 4, 6, 7, -72, 3, 2, +-76, 5, 5, 8, 10, 11, -72, 3, 2, -75, 15, 9, 1, 9, 9, 19, -66, 2, -17, 0, 20, 3, 4, 0, 14, +2, -17, 0, 13, 2, -21, -78, 1, 3, 2, -72, 3, 1, -75, 0, 0, 8, 5, 7, 4, -72, 3, 1, -76, 6, +6, 9, 11, 10, -72, 3, 1, -73, 8, 8, 13, 20, 20, 19, 19, 15, -67, 3, 3, 0, 12, 2, -16, 0, 26, +0, 13, 1, 42, -123, 47, 16, -11, -3, 50, 47, 25, 57, 47, 24, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, +57, 17, 51, 47, -3, 57, 57, 0, 63, -19, 63, -19, 51, 47, 93, -19, 57, 57, 51, 47, -19, 57, 57, 17, 51, +47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 43, 1, 7, 39, 55, 1, 7, 39, 55, 7, 7, 39, 55, 1, 33, +53, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 1, 42, 77, -96, 74, 1, 104, 78, -94, 75, 65, 76, -94, 74, +1, -113, -3, -58, 1, -15, 28, 19, 75, 78, 72, 18, 27, 5, -77, -110, 86, -110, -2, -8, -112, 86, -113, -81, -111, +84, -111, -4, 42, -82, 118, 62, 43, 81, -93, 91, 51, 77, -78, -1, -1, -1, -70, 1, 37, 1, -12, 6, 9, 0, +22, 3, -101, 0, 0, 0, 2, 0, 54, -2, 78, 4, 32, 3, 117, 0, 3, 0, 48, 0, -100, 64, 14, 45, 32, +10, 11, 52, 28, 42, 10, 11, 52, 121, 46, 1, 31, -72, -1, -74, -75, 9, 17, 52, 0, 2, 1, -70, 3, 2, +0, 3, -1, -64, 64, 10, 9, 10, 52, 3, 3, 23, 11, 7, 35, 34, -70, 2, -17, 0, 36, 3, 6, -76, 19, +22, 4, 23, 15, -72, 2, -17, -78, 7, 7, 22, -70, 2, -17, 0, 23, 3, 7, -78, 1, 3, 2, -72, 3, 1, +64, 18, 0, 0, -113, 4, 1, 4, 22, 34, 36, 35, 35, 23, 22, 22, 50, 11, 11, 29, -70, 3, 3, 0, 43, +1, 42, -123, 47, -19, 51, 47, 17, 51, 47, 51, 51, 47, 57, 57, 17, 57, 93, 57, 47, -3, 57, 57, 0, 63, +-19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 17, 57, 47, 43, -3, 57, 57, 49, 48, 1, 43, 93, +43, 43, 1, 7, 39, 55, 3, 34, 38, 35, 34, 7, 6, 7, 54, 55, 54, 51, 50, 23, 22, 51, 50, 54, 51, +7, 6, 7, 6, 7, 6, 21, 20, 23, 22, 33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, +54, 3, 6, 85, -99, 77, 125, 20, 76, 19, 64, 80, 52, 90, 40, 35, 75, -79, 66, -52, 95, 69, 29, 112, 28, +37, -45, -108, -36, 123, -103, -32, -61, 1, 70, -72, 6, -30, 58, -40, -113, -85, 88, 100, 79, 60, 115, 35, 1, 7, +-105, 90, -111, 1, 93, 6, 12, 8, 18, 113, 34, 74, 28, 13, 14, -87, 36, 46, 68, 98, 122, -90, -41, 108, 94, +11, -97, 40, 48, 106, 121, -57, -88, -122, 102, 91, 28, 0, 0, 2, 0, 54, -2, 78, 4, 53, 3, 105, 0, 62, +0, 66, 0, -52, 64, 14, 30, 32, 10, 11, 52, 13, 42, 10, 11, 52, 121, 31, 1, 16, -72, -1, -94, -75, 9, +17, 52, 65, 63, 64, -70, 3, 2, 0, 66, -1, -64, 64, 15, 11, 19, 52, 66, 66, 1, 19, 56, 8, 52, 61, +41, 37, 20, 19, -70, 2, -17, 0, 21, 3, 6, -76, 48, 51, 34, 52, 45, -72, 2, -17, -78, 37, 37, 51, -66, +2, -17, 0, 52, 3, 7, 0, 61, 2, -17, 0, 1, 2, -21, -78, 64, 66, 65, -72, 3, 1, -73, 63, 63, 4, +14, 56, 51, 8, 4, -72, 3, 3, 64, 16, 57, 57, -113, 34, 1, 34, 51, 19, 21, 14, 20, 20, 52, 51, 51, +0, -72, 2, -16, -77, 68, 41, 41, 14, -70, 3, 3, 0, 28, 1, 42, -123, 47, -19, 51, 47, 16, -27, 51, 47, +51, 51, 47, 18, 57, 57, 17, 57, 93, 57, 47, -3, 57, 18, 57, 17, 18, 57, 47, -3, 57, 57, 0, 63, -19, +63, -19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 17, 18, 57, 57, 17, 18, 57, 47, 43, -19, 57, +57, 49, 48, 1, 43, 93, 43, 43, 1, 35, 34, 38, 53, 52, 55, 54, 55, 6, 7, 6, 7, 6, 21, 20, 23, +22, 33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 55, 38, 38, 35, 34, 7, 6, 7, +54, 55, 54, 51, 50, 22, 51, 50, 54, 55, 7, 6, 7, 6, 7, 7, 20, 23, 22, 51, 51, 1, 7, 39, 55, +4, 53, -119, 121, 102, 10, 4, 7, -85, 87, -96, 88, 111, -32, -61, 1, 70, -72, 6, -30, 58, -40, -113, -85, 88, +100, 85, 66, 127, 37, -87, 40, 89, 36, 101, 63, 21, 110, 34, 37, 83, -79, 97, -30, 77, 51, 97, 53, 40, 41, +52, 33, 58, 2, 50, 31, 75, -119, -2, -118, 77, -95, 77, 1, 37, 90, 104, 39, 58, 22, 36, 52, 37, 68, 86, +108, -118, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -85, -128, 100, 83, 25, 90, 5, 7, 9, 3, 24, 98, 38, +84, 37, 8, 7, -86, 5, 9, 6, 11, 56, 82, 28, 17, -2, -26, -110, 85, -110, 0, 0, 2, -1, -70, -1, -68, +4, 61, 3, 107, 0, 22, 0, 26, 0, 92, -78, 25, 23, 24, -72, 3, 2, -75, 26, 26, 1, 11, 2, 15, -72, +2, -17, -77, 9, 9, 22, 2, -70, 2, -17, 0, 1, 2, -21, -78, 24, 26, 23, -72, 3, 1, 64, 15, 25, 25, +3, 11, 11, 1, 3, 84, 11, 17, 52, 3, 3, 1, 0, -72, 2, -16, -79, 28, 1, 47, 16, -27, 17, 57, 47, +43, 18, 57, 47, 17, 57, 47, -19, 57, 57, 0, 63, -3, 60, 50, 47, -19, 18, 57, 17, 51, 47, -19, 57, 57, +49, 48, 1, 33, 53, 33, 38, 39, 38, 39, 38, 35, 34, 7, 54, 55, 54, 51, 50, 23, 22, 23, 22, 23, 51, +1, 7, 39, 55, 4, 61, -5, 125, 3, 47, 102, 70, 87, 72, 81, 83, 51, 52, 29, 47, 68, 104, 102, -117, 69, +-100, 121, 43, 60, -2, 3, 75, -93, 78, 1, 37, -82, 79, 44, 55, 25, 28, 7, 74, 45, 65, 100, 50, -116, 109, +9, -2, 121, -112, 84, -110, 0, -1, -1, -1, -70, -1, -68, 4, 61, 3, 107, 0, 22, 3, -97, 0, 0, 0, 1, +0, 54, -2, 78, 4, 32, 3, 117, 0, 44, 0, 117, 64, 14, 41, 32, 10, 11, 52, 24, 42, 10, 11, 52, 121, +42, 1, 27, -72, -1, -74, -74, 9, 17, 52, 7, 3, 31, 30, -70, 2, -17, 0, 32, 3, 6, -76, 15, 18, 0, +19, 11, -72, 2, -17, -78, 3, 3, 18, -70, 2, -17, 0, 19, 3, 7, 64, 16, -113, 0, 1, 0, 18, 30, 32, +31, 31, 19, 18, 18, 46, 7, 7, 25, -70, 3, 3, 0, 39, 1, 42, -123, 47, -19, 51, 47, 17, 51, 47, 51, +51, 47, 57, 57, 17, 57, 93, 0, 63, -19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 49, 48, 1, +43, 93, 43, 43, 1, 34, 38, 35, 34, 7, 6, 7, 54, 55, 54, 51, 50, 23, 22, 51, 50, 54, 51, 7, 6, +7, 6, 7, 6, 21, 20, 23, 22, 33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 1, +-28, 20, 76, 19, 64, 80, 52, 90, 40, 35, 75, -79, 66, -52, 95, 69, 29, 112, 28, 37, -45, -108, -36, 123, -103, +-32, -61, 1, 70, -72, 6, -30, 58, -40, -113, -85, 88, 100, 79, 60, 115, 35, 2, -72, 6, 12, 8, 18, 113, 34, +74, 28, 13, 14, -87, 36, 46, 68, 98, 122, -90, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -88, -122, 102, 91, +28, 0, 0, 1, 0, 54, -2, 78, 4, 53, 3, 105, 0, 62, 0, -96, 64, 14, 30, 32, 10, 11, 52, 13, 42, +10, 11, 52, 121, 31, 1, 16, -72, -1, -94, 64, 11, 9, 17, 52, 56, 8, 52, 61, 41, 37, 20, 19, -70, 2, +-17, 0, 21, 3, 6, -76, 48, 51, 34, 52, 45, -72, 2, -17, -78, 37, 37, 51, -66, 2, -17, 0, 52, 3, 7, +0, 61, 2, -17, 0, 1, 2, -21, -77, 56, 51, 8, 4, -72, 3, 3, 64, 16, 57, 57, -113, 34, 1, 34, 51, +19, 21, 14, 20, 20, 52, 51, 51, 0, -72, 2, -16, -77, 64, 41, 41, 14, -70, 3, 3, 0, 28, 1, 42, -123, +47, -19, 51, 47, 16, -27, 51, 47, 51, 51, 47, 18, 57, 57, 17, 57, 93, 57, 47, -3, 57, 18, 57, 0, 63, +-19, 63, -19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 17, 18, 57, 57, 49, 48, 1, 43, 93, 43, +43, 1, 35, 34, 38, 53, 52, 55, 54, 55, 6, 7, 6, 7, 6, 21, 20, 23, 22, 33, 51, 23, 7, 35, 34, +39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 55, 38, 38, 35, 34, 7, 6, 7, 54, 55, 54, 51, 50, 22, 51, +50, 54, 55, 7, 6, 7, 6, 7, 7, 20, 23, 22, 51, 51, 4, 53, -119, 121, 102, 10, 4, 7, -85, 87, -96, +88, 111, -32, -61, 1, 70, -72, 6, -30, 58, -40, -113, -85, 88, 100, 85, 66, 127, 37, -87, 40, 89, 36, 101, 63, +21, 110, 34, 37, 83, -79, 97, -30, 77, 51, 97, 53, 40, 41, 52, 33, 58, 2, 50, 31, 75, -119, 1, 37, 90, +104, 39, 58, 22, 36, 52, 37, 68, 86, 108, -118, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -85, -128, 100, 83, +25, 90, 5, 7, 9, 3, 24, 98, 38, 84, 37, 8, 7, -86, 5, 9, 6, 11, 56, 82, 28, 17, 0, 0, 1, +-1, -70, 1, 37, 4, 61, 3, 107, 0, 22, 0, 60, -78, 11, 2, 15, -72, 2, -17, -77, 9, 9, 22, 2, -70, +2, -17, 0, 1, 2, -21, 64, 12, 11, 11, 1, 3, 84, 11, 17, 52, 3, 3, 1, 0, -72, 2, -16, -79, 24, +1, 47, 16, -27, 17, 57, 47, 43, 18, 57, 47, 0, 63, -3, 60, 50, 47, -19, 18, 57, 49, 48, 1, 33, 53, +33, 38, 39, 38, 39, 38, 35, 34, 7, 54, 55, 54, 51, 50, 23, 22, 23, 22, 23, 51, 4, 61, -5, 125, 3, +47, 102, 70, 87, 72, 81, 83, 51, 52, 29, 47, 68, 104, 102, -117, 69, -100, 121, 43, 60, 1, 37, -82, 79, 44, +55, 25, 28, 7, 74, 45, 65, 100, 50, -116, 109, 9, 0, -1, -1, -1, -70, 1, 37, 4, 61, 3, 107, 0, 22, +3, -93, 0, 0, 0, 2, 0, 54, -2, 78, 4, 32, 5, 29, 0, 3, 0, 48, 0, -109, 64, 14, 45, 32, 10, +11, 52, 28, 42, 10, 11, 52, 121, 46, 1, 31, -72, -1, -74, -75, 9, 17, 52, 0, 2, 3, -72, 3, 2, -74, +1, 1, 15, 11, 7, 35, 34, -70, 2, -17, 0, 36, 3, 6, -76, 19, 22, 4, 23, 15, -72, 2, -17, -78, 7, +7, 22, -70, 2, -17, 0, 23, 3, 7, -78, 1, 3, 2, -72, 3, 1, 64, 18, 0, 0, -113, 4, 1, 4, 22, +34, 36, 35, 35, 23, 22, 22, 50, 11, 11, 29, -70, 3, 3, 0, 43, 1, 42, -123, 47, -19, 51, 47, 17, 51, +47, 51, 51, 47, 57, 57, 17, 57, 93, 57, 47, -3, 57, 57, 0, 63, -19, 57, 47, -19, 18, 57, 17, 57, 63, +-19, 57, 17, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 93, 43, 43, 1, 7, 39, 55, 3, 34, 38, 35, +34, 7, 6, 7, 54, 55, 54, 51, 50, 23, 22, 51, 50, 54, 51, 7, 6, 7, 6, 7, 6, 21, 20, 23, 22, +33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 2, -92, 77, -95, 75, 29, 20, 76, 19, +64, 80, 52, 90, 40, 35, 75, -79, 66, -52, 95, 69, 29, 112, 28, 37, -45, -108, -36, 123, -103, -32, -61, 1, 70, +-72, 6, -30, 58, -40, -113, -85, 88, 100, 79, 60, 115, 35, 4, -56, -111, 84, -110, -3, -101, 6, 12, 8, 18, 113, +34, 74, 28, 13, 14, -87, 36, 46, 68, 98, 122, -90, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -88, -122, 102, +91, 28, 0, 2, 0, 54, -2, 78, 4, 53, 5, 29, 0, 3, 0, 66, 0, -62, 64, 14, 34, 32, 10, 11, 52, +17, 42, 10, 11, 52, 121, 35, 1, 20, -72, -1, -94, -75, 9, 17, 52, 0, 2, 3, -72, 3, 2, 64, 11, 1, +1, 49, 60, 12, 56, 65, 45, 41, 24, 23, -70, 2, -17, 0, 25, 3, 6, -76, 52, 55, 38, 56, 49, -72, 2, +-17, -78, 41, 41, 55, -66, 2, -17, 0, 56, 3, 7, 0, 65, 2, -17, 0, 5, 2, -21, -78, 1, 3, 2, -72, +3, 1, -73, 0, 0, 8, 18, 60, 55, 12, 8, -72, 3, 3, 64, 16, 61, 61, -113, 38, 1, 38, 55, 23, 25, +18, 24, 24, 56, 55, 55, 4, -72, 2, -16, -77, 68, 45, 45, 18, -70, 3, 3, 0, 32, 1, 42, -123, 47, -19, +51, 47, 16, -27, 51, 47, 51, 51, 47, 18, 57, 57, 17, 57, 93, 57, 47, -3, 57, 18, 57, 17, 18, 57, 47, +-3, 57, 57, 0, 63, -19, 63, -19, 57, 47, -19, 18, 57, 17, 57, 63, -19, 57, 17, 57, 17, 18, 57, 57, 17, +51, 47, -19, 57, 57, 49, 48, 1, 43, 93, 43, 43, 1, 7, 39, 55, 1, 35, 34, 38, 53, 52, 55, 54, 55, +6, 7, 6, 7, 6, 21, 20, 23, 22, 33, 51, 23, 7, 35, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, +55, 38, 38, 35, 34, 7, 6, 7, 54, 55, 54, 51, 50, 22, 51, 50, 54, 55, 7, 6, 7, 6, 7, 7, 20, +23, 22, 51, 51, 2, -88, 77, -95, 75, 2, 48, -119, 121, 102, 10, 4, 7, -85, 87, -96, 88, 111, -32, -61, 1, +70, -72, 6, -30, 58, -40, -113, -85, 88, 100, 85, 66, 127, 37, -87, 40, 89, 36, 101, 63, 21, 110, 34, 37, 83, +-79, 97, -30, 77, 51, 97, 53, 40, 41, 52, 33, 58, 2, 50, 31, 75, -119, 4, -56, -111, 84, -110, -4, 8, 90, +104, 39, 58, 22, 36, 52, 37, 68, 86, 108, -118, -41, 108, 94, 11, -97, 40, 48, 106, 121, -57, -85, -128, 100, 83, +25, 90, 5, 7, 9, 3, 24, 98, 38, 84, 37, 8, 7, -86, 5, 9, 6, 11, 56, 82, 28, 17, 0, 0, 2, +-1, -70, 1, 37, 4, 61, 5, 29, 0, 3, 0, 26, 0, 92, -78, 0, 2, 3, -72, 3, 2, -75, 1, 1, 19, +15, 6, 19, -72, 2, -17, -77, 13, 13, 26, 6, -70, 2, -17, 0, 5, 2, -21, -78, 1, 3, 0, -72, 3, 1, +64, 15, 2, 2, 7, 15, 15, 5, 7, 84, 11, 17, 52, 7, 7, 5, 4, -72, 2, -16, -79, 28, 5, 47, 16, +-27, 17, 57, 47, 43, 18, 57, 47, 17, 57, 47, -19, 57, 57, 0, 63, -3, 60, 50, 47, -19, 18, 57, 17, 51, +47, -19, 57, 57, 49, 48, 1, 7, 39, 55, 1, 33, 53, 33, 38, 39, 38, 39, 38, 35, 34, 7, 54, 55, 54, +51, 50, 23, 22, 23, 22, 23, 51, 2, 94, 76, -94, 74, 2, -125, -5, 125, 3, 47, 102, 70, 87, 72, 81, 83, +51, 52, 29, 47, 68, 104, 102, -117, 69, -100, 121, 43, 60, 4, -56, -111, 84, -110, -4, 8, -82, 79, 44, 55, 25, +28, 7, 74, 45, 65, 100, 50, -116, 109, 9, 0, -1, -1, -1, -70, 1, 37, 4, 61, 5, 29, 0, 22, 3, -89, +0, 0, 0, 1, 0, 95, 1, 37, 2, -77, 4, 106, 0, 22, 0, 77, 64, 9, 102, 19, 116, 19, 2, 7, 7, +13, 18, -72, 2, -17, -78, 17, 17, 13, -70, 2, -17, 0, 1, 2, -21, -75, 18, 18, 17, 17, 8, 13, -70, 3, +3, 0, 0, 2, -16, -78, 24, 4, 8, -70, 2, -7, 0, 7, 1, 42, -123, 47, -19, 51, 16, -11, -19, 17, 57, +47, 25, 57, 47, 0, 24, 63, -3, 50, 47, -19, 18, 57, 47, 49, 48, 1, 93, 1, 33, 34, 38, 53, 52, 54, +55, 51, 22, 23, 22, 51, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 2, -77, -2, 64, 57, 91, 8, 11, 23, +11, 29, 24, 42, 1, -125, 50, 62, -111, 15, -83, 72, 58, 1, 37, 66, 45, 38, 62, 37, 41, 18, 15, -77, 109, +-120, 45, -62, 85, -70, -106, -14, 0, -1, -1, 0, 95, 1, 37, 2, -77, 4, 106, 0, 22, 3, -87, 0, 0, 0, +2, 0, 95, 1, 37, 2, -77, 6, 19, 0, 3, 0, 26, 0, 111, -73, 102, 23, 116, 23, 2, 0, 2, 3, -72, +3, 2, -74, 1, 1, 22, 11, 11, 17, 22, -72, 2, -17, -78, 21, 21, 17, -70, 2, -17, 0, 5, 2, -21, -78, +1, 3, 0, -72, 3, 1, 64, 10, 2, 2, 21, 11, 22, 22, 21, 21, 12, 17, -70, 3, 3, 0, 4, 2, -16, +-78, 28, 8, 12, -70, 2, -7, 0, 11, 1, 42, -123, 47, -19, 51, 16, -11, -19, 17, 57, 47, 25, 57, 47, 24, +17, 18, 57, 47, -19, 57, 57, 0, 63, -3, 50, 47, -19, 18, 57, 47, 17, 51, 47, -19, 57, 57, 49, 48, 1, +93, 1, 7, 39, 55, 1, 33, 34, 38, 53, 52, 54, 55, 51, 22, 23, 22, 51, 33, 52, 39, 38, 39, 55, 22, +23, 22, 21, 1, -87, 78, -96, 73, 1, -81, -2, 64, 57, 91, 8, 11, 23, 11, 29, 24, 42, 1, -125, 50, 62, +-111, 15, -83, 72, 58, 5, -67, -111, 86, -111, -5, 18, 66, 45, 38, 62, 37, 41, 18, 15, -77, 109, -120, 45, -62, +85, -70, -106, -14, 0, -1, -1, 0, 95, 1, 37, 2, -77, 6, 19, 0, 22, 3, -85, 0, 0, 0, 1, 0, 74, +-1, 70, 3, -23, 3, 112, 0, 30, 0, 114, 64, 11, 19, 42, 9, 17, 52, 18, 42, 12, 17, 52, 4, -72, -1, +-32, -77, 9, 17, 52, 3, -72, -1, -32, -77, 9, 17, 52, 2, -72, -1, -42, 64, 11, 9, 17, 52, 24, 52, 12, +17, 52, 13, 12, 25, -70, 2, -17, 0, 26, 3, 9, -78, 12, 58, 16, -70, 3, 10, 0, 6, 3, 8, -76, 26, +26, 25, 25, 21, -70, 3, 3, 0, 0, 2, -16, -78, 32, 13, 12, -72, 1, 26, -123, 47, 51, 16, -12, -3, 50, +47, 25, 57, 47, 0, 24, 63, -3, 25, -28, 24, 63, -19, 17, 57, 49, 48, 1, 43, 43, 43, 43, 43, 43, 1, +20, 7, 6, 7, 6, 35, 34, 39, 38, 39, 38, 39, 55, 22, 22, 51, 50, 55, 54, 54, 53, 52, 39, 38, 39, +55, 22, 23, 22, 21, 3, -23, 94, 82, 122, 116, 75, 69, 80, 61, 85, 72, 71, 17, 66, -113, 58, -128, -117, 126, +-78, 46, 37, 67, 57, 82, 39, 44, 1, 37, 110, 118, 104, 75, 72, 20, 15, 32, 27, 27, 40, 13, 27, 82, 75, +-27, 92, 79, 87, 70, 74, -99, 76, 76, 86, 106, 0, -1, -1, 0, 74, -1, 70, 3, -23, 3, 112, 0, 22, 3, +-83, 0, 0, 0, 2, 0, 74, -1, 70, 3, -23, 5, 29, 0, 3, 0, 34, 0, -110, 64, 11, 23, 42, 9, 17, +52, 22, 42, 12, 17, 52, 8, -72, -1, -32, -77, 9, 17, 52, 7, -72, -1, -32, -77, 9, 17, 52, 6, -72, -1, +-42, 64, 11, 9, 17, 52, 28, 52, 12, 17, 52, 0, 2, 3, -72, 3, 2, -75, 1, 1, 30, 17, 16, 29, -70, +2, -17, 0, 30, 3, 9, -78, 16, 58, 20, -70, 3, 10, 0, 10, 3, 8, -78, 1, 3, 2, -72, 3, 1, -73, +0, 0, 29, 30, 30, 29, 29, 25, -70, 3, 3, 0, 4, 2, -16, -78, 36, 17, 16, -72, 1, 26, -123, 47, 51, +16, -12, -3, 50, 47, 25, 57, 47, 17, 51, 24, 47, -3, 57, 57, 0, 63, -3, 25, -28, 24, 63, -19, 17, 57, +17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 43, 43, 43, 1, 7, 39, 55, 1, 20, 7, 6, 7, 6, +35, 34, 39, 38, 39, 38, 39, 55, 22, 22, 51, 50, 55, 54, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, +3, 83, 77, -95, 75, 1, 57, 94, 82, 122, 116, 75, 69, 80, 61, 85, 72, 71, 17, 66, -113, 58, -128, -117, 126, +-78, 46, 37, 67, 57, 82, 39, 44, 4, -56, -111, 84, -110, -4, 8, 110, 118, 104, 75, 72, 20, 15, 32, 27, 27, +40, 13, 27, 82, 75, -27, 92, 79, 87, 70, 74, -99, 76, 76, 86, 106, 0, -1, -1, 0, 74, -1, 70, 3, -23, +5, 29, 0, 22, 3, -81, 0, 0, 0, 1, 0, 62, -1, 108, 6, -110, 3, 87, 0, 70, 0, -7, -75, 64, 32, +16, 17, 52, 30, -72, -1, -32, 64, 26, 14, 17, 52, 33, 32, 11, 17, 52, 38, 52, 11, 17, 52, 65, 65, 66, +58, 52, 53, 44, 66, 66, 40, 53, 53, 39, -70, 2, -17, 0, 40, 3, 9, -78, 25, 31, 24, -70, 3, 7, 0, +58, 2, -17, -78, 0, 0, 44, -66, 2, -17, 0, 9, 2, -21, 0, 31, 2, -17, 0, 15, 3, 17, -77, 4, 65, +49, 52, -70, 2, -6, 0, 53, -1, -64, 64, 17, 9, 17, 52, 53, 53, 65, 9, 40, 40, 15, 39, 31, 39, 2, +39, 39, 35, -69, 3, 5, 0, 44, 0, 9, -1, -64, 64, 15, 9, 13, 52, 9, 9, 65, 28, 66, 66, 63, 65, +1, 65, 65, 61, 65, 10, 3, 5, 0, 64, 0, 0, 2, -16, 0, 72, 0, 25, 2, -5, 0, 32, 0, 24, -1, +-64, -75, 9, 11, 52, 24, 24, 28, -72, 3, 3, -77, 0, 19, 1, 19, -72, 1, 42, -123, 47, 93, -3, 50, 25, +47, 43, 26, -19, 24, 16, -11, 26, -3, 50, 47, 93, 25, 57, 47, 24, 17, 18, 57, 47, 43, 60, -3, 50, 47, +93, 25, 57, 47, 17, 18, 57, 47, 43, -12, 57, 18, 57, 0, 24, 63, -19, 63, -19, 60, 16, -19, 63, 18, 57, +63, -3, 57, 47, 18, 57, 47, 17, 18, 57, 17, 18, 57, 47, 49, 48, 1, 43, 43, 43, 43, 1, 35, 34, 38, +39, 6, 7, 6, 35, 35, 20, 7, 6, 7, 6, 35, 34, 39, 38, 53, 52, 54, 55, 54, 55, 23, 6, 6, 21, +20, 22, 51, 50, 55, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, 51, 50, 55, 54, 53, 52, 38, 39, 55, +23, 22, 23, 22, 51, 50, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, 6, -110, 79, 60, 91, 47, 42, 33, +47, 90, 123, 44, 57, 117, -109, -35, -56, 106, 116, 42, 36, 22, 54, 40, 70, 45, -79, -92, -64, -105, -68, 37, 29, +53, 83, 50, 18, 25, 123, 95, 40, 35, 7, 7, 40, 16, 22, 37, 41, 75, 23, 25, 31, 23, 38, 67, 47, 10, +22, 1, 37, 33, 36, 38, 13, 18, 92, 87, 113, 66, 83, 70, 77, -97, 86, -80, 89, 54, 112, 18, -112, -90, 69, +124, -127, 67, 83, -107, 100, 90, 71, 65, -51, 82, 63, 89, -102, 29, 25, 52, 29, 59, 35, 60, 97, 98, 43, 48, +29, 22, 50, 57, 42, 42, 109, 77, 28, 63, 120, 0, -1, -1, 0, 62, -1, 108, 6, -110, 3, 87, 0, 22, 3, +-79, 0, 0, 0, 1, -1, -70, 1, 37, 4, 63, 3, 53, 0, 59, 0, -86, 64, 23, 53, 32, 16, 17, 52, 4, +13, 18, 17, 41, 42, 34, 26, 18, 27, 27, 54, 42, 42, 55, 54, 54, 55, -70, 3, 9, 0, 47, 2, -17, -78, +0, 0, 34, -72, 2, -17, -78, 9, 9, 18, -70, 2, -17, 0, 17, 2, -21, -74, 4, 50, 42, 13, 27, 38, 41, +-70, 2, -6, 0, 42, -1, -64, -73, 9, 14, 52, 42, 42, 54, 23, 26, -70, 2, -6, 0, 27, -1, -64, 64, 17, +9, 10, 52, 27, 27, 54, 17, 55, 55, 54, 64, 12, 14, 52, 54, 54, 50, -70, 3, 5, 0, 0, 2, -16, -79, +61, 17, 47, 16, -11, -3, 50, 47, 43, 25, 57, 47, 17, 18, 57, 47, 43, -12, 57, 18, 57, 47, 43, -12, 57, +17, 57, 17, 18, 57, 0, 24, 63, -19, 60, 16, -19, 60, 16, -19, 63, 57, 47, 18, 57, 47, 17, 57, 47, 18, +57, 17, 18, 57, 17, 18, 57, 57, 49, 48, 1, 43, 1, 35, 34, 38, 39, 6, 7, 6, 35, 35, 34, 39, 38, +39, 6, 6, 35, 35, 53, 51, 50, 55, 54, 53, 52, 38, 39, 55, 22, 23, 22, 23, 22, 51, 51, 50, 55, 54, +53, 52, 38, 39, 55, 23, 22, 23, 22, 51, 50, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, 4, 63, 77, +64, 92, 38, 47, 35, 51, 89, 65, 52, 52, 34, 50, 48, 80, 90, -63, -63, 81, 35, 58, 6, 8, 41, 28, 18, +32, 38, 46, 64, 67, 75, 36, 40, 8, 7, 42, 21, 27, 39, 34, 58, 27, 33, 41, 7, 42, 65, 41, 15, 22, +1, 37, 35, 32, 37, 12, 18, 20, 13, 30, 36, 27, -82, 14, 23, 69, 29, 58, 36, 60, 92, 42, 73, 37, 45, +23, 26, 57, 31, 58, 34, 60, 94, 111, 43, 38, 33, 26, 56, 62, 10, 55, 109, 62, 45, 68, 113, -1, -1, -1, +-70, 1, 37, 4, 63, 3, 53, 0, 22, 3, -77, 0, 0, 0, 4, 0, 62, -1, 108, 6, -110, 5, -71, 0, 3, +0, 7, 0, 11, 0, 82, 1, 111, 64, 11, 11, 16, 18, 21, 52, 5, 16, 18, 21, 52, 1, -72, -1, -16, 64, +9, 18, 21, 52, 76, 32, 16, 17, 52, 42, -72, -1, -32, 64, 16, 14, 17, 52, 45, 32, 11, 17, 52, 50, 52, +11, 17, 52, 0, 2, 3, -72, 3, 2, -75, 1, 1, 11, 4, 6, 7, -72, 3, 2, -76, 5, 5, 8, 10, 11, +-72, 3, 2, 64, 16, 9, 9, 52, 77, 77, 78, 70, 64, 65, 56, 78, 78, 52, 65, 65, 51, -70, 2, -17, 0, +52, 3, 9, -78, 37, 43, 36, -70, 3, 7, 0, 70, 2, -17, -78, 12, 12, 56, -66, 2, -17, 0, 21, 2, -21, +0, 43, 2, -17, 0, 27, 3, 17, -78, 1, 3, 2, -72, 3, 1, -75, 0, 0, 8, 5, 7, 4, -72, 3, 1, +-76, 6, 6, 9, 11, 10, -72, 3, 1, -73, 8, 8, 73, 21, 16, 77, 61, 64, -70, 2, -6, 0, 65, -1, -64, +64, 17, 9, 17, 52, 65, 65, 77, 21, 52, 52, 15, 51, 31, 51, 2, 51, 51, 47, -69, 3, 5, 0, 56, 0, +21, -1, -64, 64, 15, 9, 13, 52, 21, 21, 77, 40, 78, 78, 63, 77, 1, 77, 77, 73, 65, 10, 3, 5, 0, +64, 0, 12, 2, -16, 0, 84, 0, 37, 2, -5, 0, 32, 0, 36, -1, -64, -75, 9, 11, 52, 36, 36, 40, -72, +3, 3, -77, 0, 31, 1, 31, -72, 1, 42, -123, 47, 93, -3, 50, 25, 47, 43, 26, -19, 24, 16, -11, 26, -3, +50, 47, 93, 25, 57, 47, 24, 17, 18, 57, 47, 43, 60, -3, 50, 47, 93, 25, 57, 47, 17, 18, 57, 47, 43, +-12, 57, 18, 57, 24, 17, 18, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -3, 57, 57, 0, 63, +-19, 63, -19, 60, 16, -19, 63, 18, 57, 63, -3, 57, 47, 18, 57, 47, 17, 18, 57, 17, 18, 57, 47, 17, 51, +47, -19, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 43, 43, 43, 43, +1, 7, 39, 55, 1, 7, 39, 55, 7, 7, 39, 55, 1, 35, 34, 38, 39, 6, 7, 6, 35, 35, 20, 7, 6, +7, 6, 35, 34, 39, 38, 53, 52, 54, 55, 54, 55, 23, 6, 6, 21, 20, 22, 51, 50, 55, 54, 53, 52, 39, +38, 39, 55, 22, 23, 22, 21, 51, 50, 55, 54, 53, 52, 38, 39, 55, 23, 22, 23, 22, 51, 50, 54, 53, 52, +39, 38, 39, 55, 22, 23, 22, 21, 5, 126, 77, -96, 74, 1, 104, 78, -94, 75, 65, 76, -94, 74, 1, -39, 79, +60, 91, 47, 42, 33, 47, 90, 123, 44, 57, 117, -109, -35, -56, 106, 116, 42, 36, 22, 54, 40, 70, 45, -79, -92, +-64, -105, -68, 37, 29, 53, 83, 50, 18, 25, 123, 95, 40, 35, 7, 7, 40, 16, 22, 37, 41, 75, 23, 25, 31, +23, 38, 67, 47, 10, 22, 5, 99, -110, 86, -110, -2, -8, -112, 86, -113, -81, -111, 84, -111, -4, 122, 33, 36, 38, +13, 18, 92, 87, 113, 66, 83, 70, 77, -97, 86, -80, 89, 54, 112, 18, -112, -90, 69, 124, -127, 67, 83, -107, 100, +90, 71, 65, -51, 82, 63, 89, -102, 29, 25, 52, 29, 59, 35, 60, 97, 98, 43, 48, 29, 22, 50, 57, 42, 42, +109, 77, 28, 63, 120, 0, -1, -1, 0, 62, -1, 108, 6, -110, 5, -71, 0, 22, 3, -75, 0, 0, 0, 4, -1, +-70, 1, 37, 4, 63, 5, -71, 0, 3, 0, 7, 0, 11, 0, 71, 1, 30, 64, 11, 11, 16, 18, 21, 52, 5, +16, 18, 21, 52, 1, -72, -1, -16, 64, 11, 18, 21, 52, 65, 32, 16, 17, 52, 0, 2, 3, -72, 3, 2, -75, +1, 1, 11, 4, 6, 7, -72, 3, 2, -76, 5, 5, 8, 10, 11, -72, 3, 2, 64, 21, 9, 9, 67, 16, 25, +30, 29, 53, 54, 46, 38, 30, 39, 39, 66, 54, 54, 67, 66, 66, 67, -70, 3, 9, 0, 59, 2, -17, -78, 12, +12, 46, -72, 2, -17, -78, 21, 21, 30, -70, 2, -17, 0, 29, 2, -21, -78, 1, 3, 2, -72, 3, 1, -75, 0, +0, 8, 5, 7, 4, -72, 3, 1, -76, 6, 6, 9, 11, 10, -72, 3, 1, 64, 10, 8, 8, 53, 16, 62, 54, +25, 39, 50, 53, -70, 2, -6, 0, 54, -1, -64, -73, 9, 14, 52, 54, 54, 66, 35, 38, -70, 2, -6, 0, 39, +-1, -64, 64, 17, 9, 10, 52, 39, 39, 66, 29, 67, 67, 66, 64, 12, 14, 52, 66, 66, 62, -70, 3, 5, 0, +12, 2, -16, -79, 73, 29, 47, 16, -11, -3, 50, 47, 43, 25, 57, 47, 17, 18, 57, 47, 43, -12, 57, 18, 57, +47, 43, -12, 57, 17, 57, 17, 18, 57, 24, 18, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -3, +57, 57, 0, 63, -19, 60, 16, -19, 60, 16, -19, 63, 57, 47, 18, 57, 47, 17, 57, 47, 18, 57, 17, 18, 57, +17, 18, 57, 57, 17, 51, 47, -19, 57, 57, 51, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, +43, 43, 43, 1, 7, 39, 55, 1, 7, 39, 55, 7, 7, 39, 55, 1, 35, 34, 38, 39, 6, 7, 6, 35, 35, +34, 39, 38, 39, 6, 6, 35, 35, 53, 51, 50, 55, 54, 53, 52, 38, 39, 55, 22, 23, 22, 23, 22, 51, 51, +50, 55, 54, 53, 52, 38, 39, 55, 23, 22, 23, 22, 51, 50, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, +3, 33, 77, -96, 74, 1, 104, 78, -94, 75, 65, 76, -94, 74, 1, -29, 77, 64, 92, 38, 47, 35, 51, 89, 65, +52, 52, 34, 50, 48, 80, 90, -63, -63, 81, 35, 58, 6, 8, 41, 28, 18, 32, 38, 46, 64, 67, 75, 36, 40, +8, 7, 42, 21, 27, 39, 34, 58, 27, 33, 41, 7, 42, 65, 41, 15, 22, 5, 99, -110, 86, -110, -2, -8, -112, +86, -113, -81, -111, 84, -111, -4, 122, 35, 32, 37, 12, 18, 20, 13, 30, 36, 27, -82, 14, 23, 69, 29, 58, 36, +60, 92, 42, 73, 37, 45, 23, 26, 57, 31, 58, 34, 60, 94, 111, 43, 38, 33, 26, 56, 62, 10, 55, 109, 62, +45, 68, 113, -1, -1, -1, -70, 1, 37, 4, 63, 5, -71, 0, 22, 3, -73, 0, 0, 0, 2, 0, 62, -1, 108, +8, -55, 3, 87, 0, 49, 0, 62, 0, -83, -71, 0, 20, -1, -42, 64, 14, 14, 17, 52, 23, 52, 11, 17, 52, +28, 52, 11, 17, 52, 53, -72, 2, -17, -78, 45, 45, 29, -70, 2, -17, 0, 30, 3, 9, -78, 15, 21, 14, -70, +3, 7, 0, 60, 2, -17, -78, 0, 0, 34, -66, 2, -17, 0, 1, 2, -21, 0, 21, 2, -17, 0, 5, 3, 17, +-73, 59, 50, 1, 30, 30, 29, 29, 25, -72, 3, 5, -74, 1, 34, 34, 1, 1, 18, 50, 65, 10, 2, -4, 0, +64, 0, 0, 2, -16, 0, 64, 0, 15, 2, -5, 0, 32, 0, 14, -1, -64, -75, 9, 11, 52, 14, 14, 18, -70, +3, 3, 0, 9, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -11, 26, -19, 17, 57, 47, 51, 47, +16, -3, 50, 47, 25, 57, 47, 17, 18, 57, 0, 24, 63, -19, 63, -19, 60, 16, -19, 63, 18, 57, 63, -3, 57, +47, -19, 49, 48, 1, 43, 43, 43, 1, 33, 6, 7, 6, 33, 34, 39, 38, 53, 52, 54, 55, 54, 55, 23, 6, +6, 21, 20, 22, 51, 50, 55, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, 51, 50, 55, 54, 55, 54, 55, +54, 55, 54, 51, 50, 23, 22, 21, 7, 52, 38, 35, 34, 7, 6, 7, 6, 7, 33, 50, 54, 8, -55, -5, 92, +30, 114, -114, -2, -35, -56, 106, 116, 42, 36, 22, 54, 40, 70, 45, -79, -92, -64, -105, -68, 37, 29, 53, 83, 50, +18, 25, 18, 119, 102, 88, 97, -108, 29, 82, 65, 74, 89, -119, 68, 63, -94, 123, 82, 72, 89, 63, 97, 73, 72, +1, -51, 96, 114, 1, 37, -48, 104, -127, 70, 77, -97, 86, -80, 89, 54, 112, 18, -112, -90, 69, 124, -127, 67, 83, +-107, 100, 90, 71, 65, -51, 82, 63, 89, -102, 38, 33, 71, 103, 19, 52, 22, 25, 79, 73, -124, 2, 49, 55, 32, +23, 50, 38, 38, 39, 0, -1, -1, 0, 62, -1, 108, 8, -55, 3, 87, 0, 22, 3, -71, 0, 0, 0, 2, -1, +-70, 1, 37, 6, -59, 3, 62, 0, 37, 0, 48, 0, 91, -73, 18, 19, 5, 10, 9, 19, 19, 33, -72, 2, -17, +-78, 41, 41, 45, -70, 2, -17, 0, 23, 2, -17, -78, 1, 1, 10, -70, 2, -17, 0, 9, 2, -21, -76, 45, 5, +38, 15, 18, -72, 2, -6, -77, 19, 19, 9, 38, -70, 2, -4, 0, 0, 2, -16, -79, 50, 9, 47, 16, -11, -19, +25, 17, 57, 47, -12, 57, 18, 57, 57, 0, 24, 63, -19, 60, 16, -19, -3, 50, 47, -19, 57, 47, 17, 18, 57, +17, 57, 49, 48, 1, 33, 34, 39, 38, 39, 6, 6, 35, 35, 53, 51, 50, 55, 54, 53, 52, 38, 39, 55, 22, +23, 22, 51, 50, 55, 54, 55, 54, 55, 54, 55, 54, 51, 50, 23, 22, 21, 7, 52, 38, 35, 34, 7, 6, 7, +33, 50, 54, 6, -59, -5, 78, 54, 49, 37, 50, 42, 84, 92, -63, -63, 81, 35, 58, 7, 7, 41, 35, 61, 65, +88, 84, 113, 122, 88, -113, 32, 81, 66, 74, 88, -120, 69, 64, -93, 122, 81, 100, -114, 113, 112, 1, -51, 109, 100, +1, 37, 18, 14, 31, 36, 27, -82, 14, 23, 69, 29, 59, 35, 60, -120, 74, 79, 38, 41, 63, 102, 20, 52, 22, +25, 79, 73, -124, 2, 49, 55, 67, 57, 57, 38, 0, -1, -1, -1, -70, 1, 37, 6, -59, 3, 62, 0, 22, 3, +-69, 0, 0, 0, 3, 0, 62, -1, 108, 8, -55, 4, -71, 0, 3, 0, 53, 0, 66, 0, -52, -71, 0, 24, -1, +-42, 64, 16, 14, 17, 52, 27, 52, 11, 17, 52, 32, 52, 11, 17, 52, 0, 2, 3, -72, 3, 2, -77, 1, 1, +34, 57, -72, 2, -17, -78, 49, 49, 33, -70, 2, -17, 0, 34, 3, 9, -78, 19, 25, 18, -70, 3, 7, 0, 64, +2, -17, -78, 4, 4, 38, -66, 2, -17, 0, 5, 2, -21, 0, 25, 2, -17, 0, 9, 3, 17, -78, 1, 3, 2, +-72, 3, 1, 64, 10, 0, 0, 63, 54, 5, 34, 34, 33, 33, 29, -72, 3, 5, -74, 5, 38, 38, 5, 5, 22, +54, 65, 10, 2, -4, 0, 64, 0, 4, 2, -16, 0, 68, 0, 19, 2, -5, 0, 32, 0, 18, -1, -64, -75, 9, +11, 52, 18, 18, 22, -70, 3, 3, 0, 13, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -11, 26, +-19, 17, 57, 47, 51, 47, 16, -3, 50, 47, 25, 57, 47, 17, 18, 57, 24, 57, 47, -3, 57, 57, 0, 63, -19, +63, -19, 60, 16, -19, 63, 18, 57, 63, -3, 57, 47, -19, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, +1, 7, 39, 55, 1, 33, 6, 7, 6, 33, 34, 39, 38, 53, 52, 54, 55, 54, 55, 23, 6, 6, 21, 20, 22, +51, 50, 55, 54, 53, 52, 39, 38, 39, 55, 22, 23, 22, 21, 51, 50, 55, 54, 55, 54, 55, 54, 55, 54, 51, +50, 23, 22, 21, 7, 52, 38, 35, 34, 7, 6, 7, 6, 7, 33, 50, 54, 6, 47, 76, -94, 74, 3, 62, -5, +92, 30, 114, -114, -2, -35, -56, 106, 116, 42, 36, 22, 54, 40, 70, 45, -79, -92, -64, -105, -68, 37, 29, 53, 83, +50, 18, 25, 18, 119, 102, 88, 97, -108, 29, 82, 65, 74, 89, -119, 68, 63, -94, 123, 82, 72, 89, 63, 97, 73, +72, 1, -51, 96, 114, 4, 100, -111, 84, -110, -4, 108, -48, 104, -127, 70, 77, -97, 86, -80, 89, 54, 112, 18, -112, +-90, 69, 124, -127, 67, 83, -107, 100, 90, 71, 65, -51, 82, 63, 89, -102, 38, 33, 71, 103, 19, 52, 22, 25, 79, +73, -124, 2, 49, 55, 32, 23, 50, 38, 38, 39, -1, -1, 0, 62, -1, 108, 8, -55, 4, -71, 0, 22, 3, -67, +0, 0, 0, 3, -1, -70, 1, 37, 6, -59, 4, -71, 0, 3, 0, 41, 0, 52, 0, 122, -78, 0, 2, 3, -72, +3, 2, 64, 11, 1, 1, 37, 22, 23, 9, 14, 13, 23, 23, 37, -72, 2, -17, -78, 45, 45, 49, -70, 2, -17, +0, 27, 2, -17, -78, 5, 5, 14, -70, 2, -17, 0, 13, 2, -21, -78, 1, 3, 2, -72, 3, 1, -74, 0, 0, +49, 9, 42, 19, 22, -72, 2, -6, -77, 23, 23, 13, 42, -70, 2, -4, 0, 4, 2, -16, -79, 54, 13, 47, 16, +-11, -19, 25, 17, 57, 47, -12, 57, 18, 57, 57, 24, 57, 47, -3, 57, 57, 0, 63, -19, 60, 16, -19, -3, 50, +47, -19, 57, 47, 17, 18, 57, 17, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 7, 39, 55, 1, 33, 34, 39, +38, 39, 6, 6, 35, 35, 53, 51, 50, 55, 54, 53, 52, 38, 39, 55, 22, 23, 22, 51, 50, 55, 54, 55, 54, +55, 54, 55, 54, 51, 50, 23, 22, 21, 7, 52, 38, 35, 34, 7, 6, 7, 33, 50, 54, 4, 73, 76, -94, 74, +3, 32, -5, 78, 54, 49, 37, 50, 42, 84, 92, -63, -63, 81, 35, 58, 7, 7, 41, 35, 61, 65, 88, 84, 113, +122, 88, -113, 32, 81, 66, 74, 88, -120, 69, 64, -93, 122, 81, 100, -114, 113, 112, 1, -51, 109, 100, 4, 100, -111, +84, -110, -4, 108, 18, 14, 31, 36, 27, -82, 14, 23, 69, 29, 59, 35, 60, -120, 74, 79, 38, 41, 63, 102, 20, +52, 22, 25, 79, 73, -124, 2, 49, 55, 67, 57, 57, 38, -1, -1, -1, -70, 1, 37, 6, -59, 4, -71, 0, 22, +3, -65, 0, 0, 0, 2, -1, -70, 1, 37, 4, -89, 6, 89, 0, 45, 0, 57, 0, -115, -71, 0, 31, -1, -16, +64, 13, 15, 17, 52, 37, 7, 49, 55, 17, 16, 24, 27, 41, 30, -67, 2, -17, 0, 20, 0, 24, 3, 11, 0, +41, 2, -17, -76, 49, 49, 55, 55, 2, -70, 2, -17, 0, 1, 2, -21, 64, 16, 37, 33, 55, 7, 10, 1, 27, +24, 30, 20, 20, 17, 17, 24, 24, 16, -72, 3, 18, -78, 30, 30, 33, -72, 3, 18, -77, 10, 10, 1, 46, -70, +2, -4, 0, 0, 2, -16, -79, 59, 1, 47, 16, -11, -19, 17, 57, 47, -19, 51, 47, -19, 51, 47, 50, 47, 25, +57, 47, 17, 18, 57, 17, 18, 57, 57, 17, 57, 0, 24, 63, -3, 60, 17, 51, 47, -19, 63, 51, -19, 17, 57, +17, 57, 57, 17, 18, 57, 57, 49, 48, 1, 43, 1, 33, 53, 55, 50, 55, 54, 55, 54, 54, 53, 52, 39, 38, +39, 38, 39, 39, 54, 54, 55, 22, 23, 22, 23, 6, 6, 7, 38, 39, 39, 22, 22, 21, 20, 7, 6, 7, 54, +55, 54, 51, 50, 23, 22, 21, 7, 52, 38, 35, 34, 7, 6, 7, 6, 7, 33, 50, 4, -89, -5, 19, -103, 68, +59, 68, 86, 18, 22, 20, 15, 30, 16, 26, 62, 7, 27, 24, 16, 57, 47, 73, 10, 10, 14, 7, 30, 13, 35, +45, 14, 5, 13, -81, 49, -108, 106, -121, 67, 61, -98, 105, 98, 73, 95, 78, 88, 65, 69, 1, -77, -20, 1, 37, +-82, 1, 18, 21, 53, 44, 101, 47, 107, -127, 94, 127, 66, 95, 31, 60, 112, 52, 47, 26, 21, 7, 103, 56, 41, +1, 9, 4, 117, -9, 84, 71, 87, 31, 65, 101, 23, 70, 79, 72, -123, 2, 51, 53, 32, 26, 46, 34, 43, -1, +-1, -1, -70, 1, 37, 4, -89, 6, 89, 0, 22, 3, -63, 0, 0, -1, -1, -1, -70, 1, 37, 4, -89, 6, 89, +0, 22, 3, -63, 0, 0, -1, -1, -1, -70, 1, 37, 4, -89, 6, 89, 0, 22, 3, -63, 0, 0, 0, 3, -1, +-70, 1, 37, 4, -89, 6, 89, 0, 3, 0, 49, 0, 61, 0, -75, -71, 0, 35, -1, -16, -75, 15, 17, 52, 0, +2, 3, -72, 3, 2, 64, 13, 1, 1, 45, 41, 11, 53, 59, 21, 20, 28, 31, 45, 34, -67, 2, -17, 0, 24, +0, 28, 3, 11, 0, 45, 2, -17, -76, 53, 53, 59, 59, 6, -70, 2, -17, 0, 5, 2, -21, -78, 1, 3, 2, +-72, 3, 1, 64, 25, 0, 64, 9, 11, 52, 0, 0, 50, 28, 41, 37, 59, 11, 14, 5, 31, 28, 34, 24, 24, +21, 21, 28, 28, 20, -72, 3, 18, -78, 34, 34, 37, -72, 3, 18, -77, 14, 14, 5, 50, -70, 2, -4, 0, 4, +2, -16, -79, 63, 5, 47, 16, -11, -19, 17, 57, 47, -19, 51, 47, -19, 51, 47, 50, 47, 25, 57, 47, 17, 18, +57, 17, 18, 57, 57, 17, 57, 24, 17, 18, 57, 47, 43, -3, 57, 57, 0, 63, -3, 60, 17, 51, 47, -19, 63, +51, -19, 17, 57, 17, 57, 57, 17, 18, 57, 57, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 1, 7, 39, 55, +1, 33, 53, 55, 50, 55, 54, 55, 54, 54, 53, 52, 39, 38, 39, 38, 39, 39, 54, 54, 55, 22, 23, 22, 23, +6, 6, 7, 38, 39, 39, 22, 22, 21, 20, 7, 6, 7, 54, 55, 54, 51, 50, 23, 22, 21, 7, 52, 38, 35, +34, 7, 6, 7, 6, 7, 33, 50, 3, -105, 77, -94, 74, 1, -75, -5, 19, -103, 68, 59, 68, 86, 18, 22, 20, +15, 30, 16, 26, 62, 7, 27, 24, 16, 57, 47, 73, 10, 10, 14, 7, 30, 13, 35, 45, 14, 5, 13, -81, 49, +-108, 106, -121, 67, 61, -98, 105, 98, 73, 95, 78, 88, 65, 69, 1, -77, -20, 4, -56, -111, 84, -110, -4, 8, -82, +1, 18, 21, 53, 44, 101, 47, 107, -127, 94, 127, 66, 95, 31, 60, 112, 52, 47, 26, 21, 7, 103, 56, 41, 1, +9, 4, 117, -9, 84, 71, 87, 31, 65, 101, 23, 70, 79, 72, -123, 2, 51, 53, 32, 26, 46, 34, 43, -1, -1, +-1, -70, 1, 37, 4, -89, 6, 89, 0, 22, 3, -59, 0, 0, -1, -1, -1, -70, 1, 37, 4, -89, 6, 89, 0, +22, 3, -59, 0, 0, -1, -1, -1, -70, 1, 37, 4, -89, 6, 89, 0, 22, 3, -59, 0, 0, 0, 1, 0, 42, +-2, 78, 4, 32, 4, 70, 0, 55, 0, -89, -77, -128, 43, 1, 29, -72, -1, -32, -77, 14, 17, 52, 49, -72, -1, +-52, -77, 11, 17, 52, 48, -72, -1, -32, 64, 9, 11, 17, 52, 13, 32, 14, 17, 52, 13, -70, 2, -17, 0, 35, +-1, -38, -73, 14, 17, 52, 35, 35, 40, 0, 55, -68, 2, -17, 0, 1, 3, 6, 0, 21, 2, -17, -78, 25, 25, +39, -70, 2, -17, 0, 40, 3, 7, 64, 20, 13, 52, 14, 17, 52, 35, 13, 39, 31, 1, 0, 46, 25, 25, 39, +55, 0, 0, 40, 39, -72, -1, -64, -74, 12, 13, 52, 39, 39, 57, 31, -72, 3, 12, -78, 17, 17, 46, -70, 3, +12, 0, 7, 1, 31, -123, 47, -19, 51, 47, -19, 17, 51, 47, 43, 51, 51, 47, 60, 17, 57, 47, 17, 18, 57, +17, 18, 57, 57, 43, 0, 63, -3, 50, 47, -19, 63, -19, 57, 17, 57, 47, 43, -19, 43, 49, 48, 1, 43, 43, +43, 93, 1, 7, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, +23, 22, 23, 34, 7, 6, 7, 6, 21, 20, 23, 22, 23, 54, 55, 54, 55, 7, 6, 7, 6, 7, 6, 21, 20, +23, 22, 23, 22, 51, 50, 54, 55, 4, 32, -3, -48, 114, -59, 107, -121, 38, 31, 58, 28, 70, 96, 37, 82, 89, +102, -111, 65, 73, 49, 74, 98, 103, -123, 82, 100, 115, 97, 123, 100, 95, 106, 114, 42, -48, 92, -70, 99, 127, 106, +92, -77, -114, -36, 47, 94, 47, -2, -11, -89, 17, 29, 87, 109, -52, 124, 99, 81, 72, 34, 69, 48, 35, 77, 118, +106, 102, 117, 38, 25, 58, 13, 17, 32, 39, 57, 61, 55, 46, 19, 54, 38, 42, 28, -100, 81, 43, 88, 92, 118, +-121, -115, 81, 70, 29, 23, 2, 1, 0, 0, 1, 0, 54, -2, 78, 3, -29, 3, 115, 0, 52, 0, -79, 64, 9, +-24, 4, 1, 5, 32, 12, 14, 52, 49, -72, -1, -70, -77, 9, 17, 52, 48, -72, -1, -52, 64, 16, 9, 17, 52, +11, 10, 27, 10, 2, 40, 31, 13, 3, 19, 35, 0, 52, -70, 2, -17, 0, 1, 3, 6, -75, 16, 16, 23, 19, +19, 23, -72, -1, -64, -75, 13, 17, 52, 23, 23, 35, -70, 2, -17, 0, 37, 2, -21, 64, 15, 52, 1, 0, 46, +40, 31, 13, 27, 27, 36, 31, 13, 13, 18, 31, -72, -1, -64, 64, 9, 15, 17, 52, 31, 31, 18, 0, 0, 36, +-69, 2, -16, 0, 54, 0, 18, 2, -7, -78, 19, 19, 46, -70, 3, 12, 0, 7, 1, 30, -123, 47, -19, 51, 47, +-19, 16, -11, 50, 47, 17, 57, 47, 43, 18, 57, 47, 17, 18, 57, 47, 17, 18, 57, 17, 18, 57, 57, 0, 63, +-3, 50, 47, 43, 57, 47, 18, 57, 47, 63, -19, 57, 17, 18, 23, 57, 49, 48, 1, 93, 43, 43, 43, 0, 93, +1, 7, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 54, 55, 38, 38, 35, 34, 7, 35, 54, 55, 54, 51, 50, +23, 22, 21, 20, 7, 6, 7, 22, 22, 51, 51, 21, 35, 34, 38, 39, 6, 7, 6, 7, 6, 21, 20, 23, 22, +23, 22, 51, 3, -29, -54, -69, 107, -62, 110, -115, 53, 42, 84, 40, 107, 10, 37, 21, 26, 25, 17, 21, 23, 56, +-128, 86, 62, 69, 38, 35, 22, 56, 103, 77, 92, 92, -103, -87, 51, 73, 59, 80, 45, 56, -87, -126, -29, 120, -55, +-2, -18, -96, 17, 31, 89, 115, -49, -119, 117, 93, 94, 45, 100, 34, 32, 35, 105, 40, 96, 42, 47, 75, 49, 34, +28, 18, 67, 56, -82, 92, 106, 47, 50, 68, 65, 81, 75, -87, 93, 71, 25, 13, 0, 1, -1, -70, 1, 37, 3, +-61, 3, -57, 0, 29, 0, 110, -71, 0, 22, -1, -32, -73, 16, 17, 52, 17, 18, 18, 0, 21, -72, 2, -17, -77, +47, 13, 1, 13, -70, 3, 4, 0, 0, 2, -17, -74, 0, 1, 1, 1, 1, 6, 27, -68, 2, -17, 0, 6, 2, +-17, 0, 5, 2, -21, 64, 17, 18, 27, 17, 7, 52, 13, 17, 52, 7, 10, 17, 17, 1, 0, 0, 31, 24, -72, +3, 0, -78, 10, 10, 5, 47, 51, 47, -19, 17, 51, 47, 51, 51, 47, 17, 57, 43, 17, 57, 57, 0, 63, -19, +-19, 18, 57, 47, 93, -19, 63, 93, -19, 17, 57, 47, 57, 49, 48, 1, 43, 1, 7, 6, 4, 35, 35, 53, 51, +38, 38, 53, 52, 54, 51, 50, 23, 22, 23, 7, 38, 38, 35, 34, 6, 21, 20, 22, 23, 54, 54, 3, -61, 69, +-105, -2, 115, -89, -7, -16, 29, 36, -59, -101, 123, 80, 34, 81, 19, 69, 110, 59, -118, -99, 99, 78, -92, -46, 2, +93, -74, 55, 75, -82, 47, 119, 56, 118, -96, 60, 25, 98, 17, 19, 19, 61, 50, 49, 121, 47, 25, 47, 0, 0, +1, -1, -70, 1, 37, 3, 39, 3, 88, 0, 40, 0, 106, 64, 12, 16, 36, 23, 5, 40, 0, 19, 19, 28, 23, +23, 28, -72, -1, -64, -75, 14, 17, 52, 28, 28, 40, -72, 2, -17, -78, 0, 0, 11, -70, 2, -17, 0, 10, 2, +-21, 64, 15, 5, 36, 16, 16, 36, 36, 22, 80, 32, -128, 32, 2, 32, 32, 0, -69, 2, -16, 0, 42, 0, 22, +2, -7, -78, 23, 23, 10, 47, 51, 47, -19, 16, -12, 50, 47, 93, 18, 57, 47, 57, 47, 18, 57, 0, 63, -19, +60, 16, -3, 50, 47, 43, 57, 47, 18, 57, 47, 17, 18, 57, 17, 57, 57, 49, 48, 1, 35, 34, 39, 38, 39, +6, 7, 6, 35, 35, 53, 51, 50, 55, 54, 55, 39, 38, 35, 34, 6, 7, 35, 53, 52, 55, 54, 51, 50, 23, +22, 21, 20, 7, 6, 7, 22, 22, 51, 51, 3, 39, -109, 65, 67, 80, 36, 67, 86, 105, -122, 90, 90, 84, 72, +82, 79, 42, 32, 40, 18, 28, 17, 21, 58, 53, -125, 113, 71, 93, 37, 27, 72, 16, 91, 31, -109, 1, 37, 31, +37, 66, 60, 33, 41, -82, 18, 21, 46, 54, 38, 13, 22, 59, 110, 41, 37, 30, 39, 81, 43, 46, 34, 60, 24, +32, 0, 0, 2, 0, 42, -2, 78, 4, 32, 5, -27, 0, 3, 0, 59, 0, -59, -77, -128, 47, 1, 33, -72, -1, +-32, -77, 14, 17, 52, 53, -72, -1, -52, -77, 11, 17, 52, 52, -72, -1, -32, -75, 11, 17, 52, 0, 2, 3, -72, +3, 2, 64, 9, 1, 1, 25, 17, 32, 14, 17, 52, 17, -70, 2, -17, 0, 39, -1, -38, -73, 14, 17, 52, 39, +39, 44, 4, 59, -68, 2, -17, 0, 5, 3, 6, 0, 25, 2, -17, -78, 29, 29, 43, -70, 2, -17, 0, 44, 3, +7, -78, 1, 3, 2, -72, 3, 1, 64, 22, 0, 0, 17, 52, 14, 17, 52, 39, 17, 43, 35, 5, 4, 50, 29, +29, 43, 59, 4, 4, 44, 43, -72, -1, -64, -74, 12, 13, 52, 43, 43, 61, 35, -72, 3, 12, -78, 21, 21, 50, +-70, 3, 12, 0, 11, 1, 31, -123, 47, -19, 51, 47, -19, 17, 51, 47, 43, 51, 51, 47, 60, 17, 57, 47, 17, +18, 57, 17, 18, 57, 57, 43, 57, 47, -3, 57, 57, 0, 63, -3, 50, 47, -19, 63, -19, 57, 17, 57, 47, 43, +-19, 43, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 93, 1, 7, 39, 55, 1, 7, 34, 39, 38, 39, +38, 53, 52, 55, 54, 55, 54, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 23, 34, 7, 6, 7, 6, +21, 20, 23, 22, 23, 54, 55, 54, 55, 7, 6, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 51, 50, 54, 55, +1, -14, 81, -100, 81, 2, -54, -3, -48, 114, -59, 107, -121, 38, 31, 58, 28, 70, 96, 37, 82, 89, 102, -111, 65, +73, 49, 74, 98, 103, -123, 82, 100, 115, 97, 123, 100, 95, 106, 114, 42, -48, 92, -70, 99, 127, 106, 92, -77, -114, +-36, 47, 94, 47, 5, -112, -112, 83, -110, -7, 16, -89, 17, 29, 87, 109, -52, 124, 99, 81, 72, 34, 69, 48, 35, +77, 118, 106, 102, 117, 38, 25, 58, 13, 17, 32, 39, 57, 61, 55, 46, 19, 54, 38, 42, 28, -100, 81, 43, 88, +92, 118, -121, -115, 81, 70, 29, 23, 2, 1, 0, 0, 2, 0, 54, -2, 78, 3, -29, 5, 29, 0, 3, 0, 56, +0, -44, 64, 9, -24, 8, 1, 9, 32, 12, 14, 52, 53, -72, -1, -70, -77, 9, 17, 52, 52, -72, -1, -52, 64, +11, 9, 17, 52, 11, 14, 27, 14, 2, 0, 2, 3, -72, 3, 2, 64, 11, 1, 1, 27, 44, 35, 17, 3, 23, +39, 4, 56, -70, 2, -17, 0, 5, 3, 6, -75, 20, 20, 27, 23, 23, 27, -72, -1, -64, -75, 13, 17, 52, 27, +27, 39, -70, 2, -17, 0, 41, 2, -21, -78, 1, 3, 2, -72, 3, 1, 64, 19, 0, 0, 31, 35, 56, 5, 4, +50, 44, 35, 17, 31, 31, 40, 35, 17, 17, 22, 35, -72, -1, -64, 64, 9, 15, 17, 52, 35, 35, 22, 4, 4, +40, -69, 2, -16, 0, 58, 0, 22, 2, -7, -78, 23, 23, 50, -70, 3, 12, 0, 11, 1, 30, -123, 47, -19, 51, +47, -19, 16, -11, 50, 47, 17, 57, 47, 43, 18, 57, 47, 17, 18, 57, 47, 17, 18, 57, 17, 18, 57, 57, 17, +18, 57, 47, -3, 57, 57, 0, 63, -3, 50, 47, 43, 57, 47, 18, 57, 47, 63, -19, 57, 17, 18, 23, 57, 17, +51, 47, -19, 57, 57, 49, 48, 1, 93, 43, 43, 43, 0, 93, 1, 7, 39, 55, 1, 7, 34, 39, 38, 39, 38, +53, 52, 55, 54, 55, 54, 55, 38, 38, 35, 34, 7, 35, 54, 55, 54, 51, 50, 23, 22, 21, 20, 7, 6, 7, +22, 22, 51, 51, 21, 35, 34, 38, 39, 6, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 51, 2, 87, 76, -94, +75, 2, 47, -54, -69, 107, -62, 110, -115, 53, 42, 84, 40, 107, 10, 37, 21, 26, 25, 17, 21, 23, 56, -128, 86, +62, 69, 38, 35, 22, 56, 103, 77, 92, 92, -103, -87, 51, 73, 59, 80, 45, 56, -87, -126, -29, 120, -55, 4, -56, +-111, 84, -110, -7, -47, -96, 17, 31, 89, 115, -49, -119, 117, 93, 94, 45, 100, 34, 32, 35, 105, 40, 96, 42, 47, +75, 49, 34, 28, 18, 67, 56, -82, 92, 106, 47, 50, 68, 65, 81, 75, -87, 93, 71, 25, 13, 0, 0, 2, -1, +-70, 1, 37, 3, -61, 5, 29, 0, 3, 0, 33, 0, -111, -71, 0, 26, -1, -32, -75, 16, 17, 52, 0, 2, 3, +-72, 3, 2, 64, 11, 15, 1, 1, 1, 1, 17, 21, 22, 22, 4, 25, -72, 2, -17, -77, 47, 17, 1, 17, -70, +3, 4, 0, 4, 2, -17, -74, 0, 5, 1, 5, 5, 10, 31, -68, 2, -17, 0, 10, 2, -17, 0, 9, 2, -21, +-78, 1, 3, 2, -72, 3, 1, 64, 19, 0, 0, 22, 31, 21, 11, 52, 13, 17, 52, 11, 14, 21, 21, 5, 4, +4, 35, 28, -72, 3, 0, -78, 14, 14, 9, 47, 51, 47, -19, 17, 51, 47, 51, 51, 47, 17, 57, 43, 17, 57, +57, 57, 47, -3, 57, 57, 0, 63, -19, -19, 18, 57, 47, 93, -19, 63, 93, -19, 17, 57, 47, 57, 17, 51, 47, +93, -19, 57, 57, 49, 48, 1, 43, 1, 7, 39, 55, 1, 7, 6, 4, 35, 35, 53, 51, 38, 38, 53, 52, 54, +51, 50, 23, 22, 23, 7, 38, 38, 35, 34, 6, 21, 20, 22, 23, 54, 54, 2, 31, 75, -93, 76, 2, 70, 69, +-105, -2, 115, -89, -7, -16, 29, 36, -59, -101, 123, 80, 34, 81, 19, 69, 110, 59, -118, -99, 99, 78, -92, -46, 4, +-56, -111, 84, -110, -3, 64, -74, 55, 75, -82, 47, 119, 56, 118, -96, 60, 25, 98, 17, 19, 19, 61, 50, 49, 121, +47, 25, 47, 0, 2, -1, -70, 1, 37, 3, 39, 5, 29, 0, 3, 0, 44, 0, -118, -78, 0, 2, 3, -72, 3, +2, 64, 15, 1, 1, 32, 20, 40, 27, 9, 44, 4, 23, 23, 32, 27, 27, 32, -72, -1, -64, -75, 14, 17, 52, +32, 32, 44, -72, 2, -17, -78, 4, 4, 15, -70, 2, -17, 0, 14, 2, -21, -78, 1, 3, 2, -72, 3, 1, 64, +18, 0, 0, 36, 9, 40, 20, 20, 40, 40, 26, 80, 36, -128, 36, 2, 36, 36, 4, -69, 2, -16, 0, 46, 0, +26, 2, -7, -78, 27, 27, 14, 47, 51, 47, -19, 16, -11, 50, 47, 93, 18, 57, 47, 57, 47, 18, 57, 18, 57, +47, -3, 57, 57, 0, 63, -19, 60, 16, -3, 50, 47, 43, 57, 47, 18, 57, 47, 17, 18, 57, 17, 57, 57, 17, +51, 47, -19, 57, 57, 49, 48, 1, 7, 39, 55, 1, 35, 34, 39, 38, 39, 6, 7, 6, 35, 35, 53, 51, 50, +55, 54, 55, 39, 38, 35, 34, 6, 7, 35, 53, 52, 55, 54, 51, 50, 23, 22, 21, 20, 7, 6, 7, 22, 22, +51, 51, 1, -46, 76, -94, 75, 1, -8, -109, 65, 67, 80, 36, 67, 86, 105, -122, 90, 90, 84, 72, 82, 79, 42, +32, 40, 18, 28, 17, 21, 58, 53, -125, 113, 71, 93, 37, 27, 72, 16, 91, 31, -109, 4, -56, -111, 84, -110, -4, +8, 31, 37, 66, 60, 33, 41, -82, 18, 21, 46, 54, 38, 13, 22, 59, 110, 41, 37, 30, 39, 81, 43, 46, 34, +60, 24, 32, 0, 0, 3, 0, 39, 1, 37, 6, 79, 5, 115, 0, 3, 0, 35, 0, 46, 0, -81, -75, 9, 32, +16, 17, 52, 21, -72, -1, -52, -77, 12, 17, 52, 20, -72, -1, -32, -75, 12, 17, 52, 0, 2, 3, -72, 3, 2, +-77, 1, 1, 31, 36, -72, -1, -64, 64, 9, 16, 17, 52, 36, 36, 40, 16, 22, 15, 65, 9, 3, 4, 0, 40, +2, -17, 0, 31, 3, 4, 0, 22, 2, -17, 0, 5, 2, -21, -78, 1, 3, 2, -72, 3, 1, -74, 0, 0, 43, +23, 23, 36, 27, -72, 2, -13, -78, 43, 43, 36, 65, 10, 3, 16, 0, 64, 0, 4, 2, -16, 0, 48, 0, 16, +2, -5, 0, 32, 0, 15, -1, -64, -75, 9, 11, 52, 15, 15, 19, -70, 3, 3, 0, 11, 1, 42, -123, 47, -3, +50, 25, 47, 43, 26, -19, 24, 16, -11, 26, -3, 50, 47, -19, 18, 57, 47, 17, 57, 47, -3, 57, 57, 0, 63, +-19, 63, -19, 63, 18, 57, 17, 57, 47, 43, 17, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 1, 7, 39, +55, 1, 33, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 23, 6, 6, 21, 20, 4, 33, 33, 38, 39, 38, 53, +52, 55, 54, 51, 50, 23, 22, 21, 39, 52, 39, 38, 35, 34, 6, 21, 20, 23, 22, 5, -120, 82, -94, 83, 1, +104, -4, 107, -45, -127, -102, 79, 86, 51, 37, 18, 40, 43, 28, 1, 32, 1, 58, 2, -31, 117, 55, 63, 62, 70, +85, 99, 44, 37, 104, 19, 23, 47, 34, 33, 41, 30, 5, 29, -108, 88, -110, -5, -78, 26, 31, 72, 78, -122, 89, +119, 81, 40, 23, 87, 91, 37, -124, 126, 32, 42, 48, 71, 93, 106, 119, 117, 98, -75, 14, 87, 47, 56, 41, 37, +49, 25, 18, -1, -1, 0, 39, 1, 37, 6, 79, 5, 115, 0, 22, 3, -47, 0, 0, 0, 3, -1, -70, 1, 37, +2, 36, 5, -49, 0, 3, 0, 25, 0, 37, 0, 116, -78, 0, 2, 3, -72, 3, 2, 64, 9, 1, 1, 21, 26, +30, 9, 35, 13, 21, -72, 2, -17, -78, 30, 30, 35, -72, 2, -17, -78, 13, 13, 6, -70, 2, -17, 0, 5, 2, +-21, -78, 1, 3, 2, -72, 3, 1, 64, 11, 0, 0, 26, 32, 14, 17, 52, 9, 26, 7, 17, -72, 3, 12, -77, +33, 33, 5, 7, -70, 3, 12, 0, 4, 2, -16, -79, 39, 5, 47, 16, -11, -19, 17, 57, 47, -19, 18, 57, 57, +43, 57, 47, -3, 57, 57, 0, 63, -3, 50, 47, -3, 50, 47, -19, 17, 18, 57, 17, 57, 17, 51, 47, -19, 57, +57, 49, 48, 1, 7, 39, 55, 1, 33, 53, 33, 52, 39, 6, 7, 6, 35, 34, 39, 38, 53, 52, 55, 54, 51, +50, 23, 22, 21, 3, 38, 39, 38, 35, 34, 6, 21, 20, 51, 50, 54, 1, -97, 77, -95, 74, 1, 41, -3, -106, +2, 21, 21, 52, 28, 46, 35, 73, 46, 53, 50, 56, 90, 122, 66, 55, -93, 14, 31, 42, 38, 27, 35, 88, 23, +52, 5, 121, -110, 86, -110, -5, 86, -82, 89, 78, 17, 7, 12, 37, 42, 79, -117, 104, 116, -65, -98, -43, 1, 4, +36, 37, 50, 45, 31, 80, 18, 0, 3, -1, -70, 1, 37, 2, 26, 5, -89, 0, 3, 0, 22, 0, 33, 0, 106, +64, 11, 11, 12, 1, 25, 32, 16, 17, 52, 0, 2, 3, -72, 3, 2, -78, 1, 1, 18, -72, 2, -17, -75, 27, +27, 10, 23, 23, 6, -70, 2, -17, 0, 5, 2, -21, -78, 1, 3, 2, -72, 3, 1, -74, 0, 0, 30, 10, 4, +23, 14, -72, 3, 12, -77, 30, 30, 5, 23, -70, 3, 12, 0, 4, 2, -16, -79, 35, 5, 47, 16, -11, -19, 17, +57, 47, -19, 17, 18, 57, 18, 57, 47, -3, 57, 57, 0, 63, -3, 50, 47, 57, 51, 47, -3, 50, 47, -19, 57, +57, 49, 48, 1, 43, 93, 1, 7, 39, 55, 19, 33, 53, 33, 50, 54, 55, 38, 39, 38, 53, 52, 55, 54, 51, +50, 23, 22, 21, 39, 38, 39, 38, 35, 34, 6, 21, 20, 23, 22, 1, -61, 88, -116, 83, -24, -3, -96, 1, 87, +62, 87, 51, -84, 51, 115, 55, 62, 89, 102, 53, 42, 90, 23, 21, 41, 58, 28, 40, 79, 28, 5, 75, -112, 96, +-116, -5, 126, -82, 9, 15, 25, 22, 50, 120, 105, 93, 105, -126, 103, -116, 4, 80, 39, 75, 44, 30, 76, 26, 9, +0, 4, 0, 70, -1, 103, 4, -89, 5, 119, 0, 3, 0, 7, 0, 53, 0, 66, 0, -47, -77, 84, 10, 1, 9, +-72, -1, -32, -77, 14, 17, 52, 29, -72, -1, -32, 64, 11, 14, 17, 52, 33, 64, 9, 17, 52, 0, 2, 3, -72, +3, 2, -76, 1, 1, 4, 6, 7, -72, 3, 2, -78, 5, 5, 49, -72, 2, -17, -78, 58, 58, 41, -72, 2, -17, +-77, 64, 64, 21, 20, -68, 3, 7, 0, 31, 2, -17, 0, 12, 3, 17, -78, 1, 3, 0, -72, 3, 1, -76, 2, +2, 5, 7, 6, -72, 3, 1, 64, 11, 4, 4, 54, 32, 13, 17, 52, 38, 54, 35, 45, -72, 2, -3, -77, 61, +61, 27, 35, 65, 10, 3, 3, 0, 64, 0, 8, 2, -16, 0, 68, 0, 21, 2, -5, 0, 32, 0, 20, -1, -64, +-75, 9, 11, 52, 20, 20, 27, -72, 3, 3, -77, 0, 16, 1, 16, -72, 1, 42, -123, 47, 93, -3, 50, 25, 47, +43, 26, -19, 24, 16, -11, 26, -19, 17, 57, 47, -19, 18, 57, 57, 43, 57, 47, -3, 57, 57, 51, 47, -19, 57, +57, 0, 63, -19, 63, 57, 57, 47, -19, 51, 47, -3, 50, 47, -19, 57, 57, 51, 47, -19, 57, 57, 49, 48, 1, +43, 43, 43, 93, 1, 7, 39, 55, 7, 7, 39, 55, 1, 20, 7, 6, 33, 34, 39, 38, 53, 52, 55, 54, 55, +23, 6, 7, 6, 7, 6, 21, 20, 23, 22, 51, 50, 55, 54, 53, 52, 38, 39, 6, 6, 35, 34, 39, 38, 53, +52, 55, 54, 51, 50, 23, 22, 21, 39, 38, 39, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 4, 50, 78, -94, +75, 65, 76, -94, 74, 1, -1, -66, -85, -2, -27, -33, 122, -124, 38, 35, 65, 42, 29, 20, 27, 12, 15, 110, 102, +-57, -43, -96, -71, 7, 9, 38, 77, 39, 88, 55, 67, 58, 65, 89, 117, 68, 58, -97, 26, 11, 28, 42, 48, 45, +58, 37, 26, 45, 5, 34, -112, 86, -113, -81, -111, 84, -111, -5, -42, -58, 104, 93, 80, 87, -85, 118, -126, 120, 120, +18, 70, 54, 74, 53, 67, 63, -126, 62, 57, 70, 81, -118, 51, 45, 23, 18, 21, 40, 48, 97, 113, 103, 116, -96, +-120, -77, -79, 62, 15, 41, 46, 35, 31, 36, 15, 0, -1, -1, 0, 70, -1, 103, 4, -89, 5, 119, 0, 22, 3, +-43, 0, 0, 0, 4, -1, -70, 1, 37, 2, 36, 5, -20, 0, 3, 0, 7, 0, 29, 0, 41, 0, -106, -78, 0, +2, 3, -72, 3, 2, -76, 1, 1, 4, 6, 7, -72, 3, 2, 64, 14, 5, 64, 9, 12, 52, 5, 5, 25, 30, +34, 13, 39, 17, 25, -72, 2, -17, -78, 34, 34, 39, -72, 2, -17, -78, 17, 17, 10, -70, 2, -17, 0, 9, 2, +-21, -78, 1, 3, 0, -72, 3, 1, -76, 2, 2, 5, 7, 6, -72, 3, 1, 64, 11, 4, 4, 30, 32, 14, 17, +52, 13, 30, 11, 21, -72, 3, 12, -77, 37, 37, 9, 11, -70, 3, 12, 0, 8, 2, -16, -79, 43, 9, 47, 16, +-11, -19, 17, 57, 47, -19, 18, 57, 57, 43, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -3, 50, 47, +-3, 50, 47, -19, 17, 18, 57, 17, 57, 17, 51, 47, 43, -19, 57, 57, 51, 47, -19, 57, 57, 49, 48, 1, 7, +39, 55, 7, 7, 39, 55, 1, 33, 53, 33, 52, 39, 6, 7, 6, 35, 34, 39, 38, 53, 52, 55, 54, 51, 50, +23, 22, 21, 3, 38, 39, 38, 35, 34, 6, 21, 20, 51, 50, 54, 2, 4, 78, -94, 75, 65, 76, -94, 74, 1, +-86, -3, -106, 2, 21, 21, 52, 28, 46, 35, 73, 46, 53, 50, 56, 90, 122, 66, 55, -93, 14, 31, 42, 38, 27, +35, 88, 23, 52, 5, -105, -112, 86, -113, -81, -111, 84, -111, -5, -108, -82, 89, 78, 17, 7, 12, 37, 42, 79, -117, +104, 116, -65, -98, -43, 1, 4, 36, 37, 50, 45, 31, 80, 18, 0, 4, -1, -70, 1, 37, 2, 26, 5, -48, 0, +3, 0, 7, 0, 26, 0, 37, 0, -122, 64, 11, 11, 16, 1, 29, 32, 16, 17, 52, 0, 2, 3, -72, 3, 2, +-76, 1, 1, 4, 6, 7, -72, 3, 2, -78, 5, 5, 22, -72, 2, -17, -75, 31, 31, 14, 27, 27, 10, -70, 2, +-17, 0, 9, 2, -21, -78, 1, 3, 0, -72, 3, 1, -76, 2, 2, 5, 7, 6, -72, 3, 1, -74, 4, 4, 34, +14, 8, 27, 18, -72, 3, 12, -77, 34, 34, 9, 27, -70, 3, 12, 0, 8, 2, -16, -79, 39, 9, 47, 16, -11, +-19, 17, 57, 47, -19, 17, 18, 57, 18, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -3, 50, 47, 57, +51, 47, -3, 50, 47, -19, 57, 57, 51, 47, -19, 57, 57, 49, 48, 1, 43, 93, 1, 7, 39, 55, 7, 7, 39, +55, 1, 33, 53, 33, 50, 54, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 21, 39, 38, 39, 38, 35, +34, 6, 21, 20, 23, 22, 1, -17, 85, 125, 86, 105, 79, 123, 83, 1, -121, -3, -96, 1, 87, 62, 87, 51, -84, +51, 115, 55, 62, 89, 102, 53, 42, 90, 23, 21, 41, 58, 28, 40, 79, 28, 5, 127, -122, 82, -123, -115, -120, 81, +-122, -5, -109, -82, 9, 15, 25, 22, 50, 120, 105, 93, 105, -126, 103, -116, 4, 80, 39, 75, 44, 30, 76, 26, 9, +0, 0, 2, 0, 45, 1, 37, 4, -49, 6, 51, 0, 40, 0, 73, 1, 37, -71, 0, 56, -1, -32, -77, 16, 17, +52, 27, -72, 3, 10, 64, 9, 47, 28, 1, 28, 28, 72, 35, 18, 21, -72, 3, 10, -74, 47, 38, 1, 38, 38, +72, 3, -72, 2, -15, 64, 15, 12, 64, 9, 12, 52, 12, 12, 50, 58, 61, 60, 68, 71, 50, 72, -72, 2, -17, +-78, 65, 64, 68, -65, 3, 11, 0, 51, 0, 50, 3, 9, 0, 58, 2, -17, 0, 42, 2, -21, 64, 21, 28, 15, +27, 64, 11, 14, 52, 27, 27, 0, 15, 8, 7, 64, 9, 14, 52, 7, 7, 54, 24, -72, 2, -3, 64, 9, 32, +64, 9, 10, 52, 32, 32, 54, 0, -69, 2, -3, 0, 64, 0, 15, -1, -64, -73, 9, 17, 52, 15, 15, 61, 54, +65, -72, 2, -5, 64, 11, 32, 64, 64, 61, 61, 60, 71, 72, 68, 68, 60, -72, 3, 16, -75, 15, 72, 1, 72, +72, 59, -65, 3, 16, 0, 41, 2, -16, 0, 75, 0, 51, 2, -5, 0, 50, -1, -64, -75, 9, 17, 52, 50, 50, +54, -70, 3, 12, 0, 46, 1, 36, -123, 47, -3, 50, 47, 43, -19, 16, -11, -19, 51, 47, 93, -19, 51, 47, 18, +57, 17, 51, 47, 51, 25, 47, 26, -19, 24, 17, 18, 57, 47, 43, 26, -19, 18, 57, 47, 43, -19, 17, 57, 47, +43, 57, 17, 18, 57, 47, 43, 18, 57, 0, 63, -19, 63, 57, 63, 51, 51, -19, 17, 57, 17, 57, 57, 17, 18, +57, 47, 43, -19, 18, 57, 47, 93, -79, 6, 2, 67, 84, 88, -76, 11, 38, 27, 38, 2, 0, 93, 89, -3, 57, +57, 18, 57, 47, 93, -19, 49, 48, 1, 43, 1, 20, 6, 35, 34, 39, 38, 39, 55, 50, 23, 22, 51, 50, 54, +53, 52, 38, 35, 34, 7, 7, 34, 38, 53, 52, 54, 55, 7, 6, 7, 6, 21, 20, 22, 51, 50, 55, 55, 50, +22, 1, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 6, 21, 20, 23, 22, 51, 33, 3, 39, 52, 54, 55, +23, 20, 23, 23, 20, 6, 7, 39, 19, 3, 97, -110, -124, 61, 74, 45, 87, 17, 24, 34, 79, 19, 115, -91, 34, +23, 26, 14, 70, 25, 35, -81, 96, 19, 69, 37, 60, 32, 21, 18, 14, 54, 52, 42, 1, 110, -3, 30, -17, 101, +108, 47, 13, 42, 34, 34, 21, 115, 86, -90, 2, 125, 125, 52, 24, 24, 15, 72, 108, 23, 12, 48, 118, 3, -120, +109, 120, 17, 10, 27, 21, 3, 7, 67, 46, 21, 30, 1, 5, 26, 31, 84, -22, 32, -125, 19, 22, 35, 49, 17, +15, 2, 7, 54, -3, 89, 57, 61, -109, 88, 112, 31, 84, 20, 78, 84, 38, 109, 44, 33, 3, 80, 25, 69, 121, +57, 11, 58, 29, 40, 46, 114, 32, 16, -4, -16, -1, -1, 0, 45, 1, 37, 4, -49, 6, 51, 0, 22, 3, -39, +0, 0, -1, -1, -1, -70, 1, 37, 3, 39, 5, -33, 0, 22, 3, 47, 0, 0, -1, -1, -1, -70, 1, 37, 3, +39, 5, -33, 0, 22, 3, 47, 0, 0, 0, 1, 0, 71, 0, 14, 4, 13, 6, 51, 0, 55, 0, -96, -71, 0, +2, -1, -32, -77, 15, 17, 52, 53, -72, -1, -16, -77, 13, 17, 52, 25, -72, -1, -52, 64, 14, 13, 17, 52, 28, +32, 12, 17, 52, 36, 35, 46, 49, 16, 50, -72, 2, -17, -78, 39, 38, 46, 65, 9, 3, 11, 0, 17, 0, 16, +3, 9, 0, 26, 2, -17, 0, 6, 0, 39, 2, -5, 64, 10, 38, 38, 36, 36, 35, 49, 50, 46, 46, 35, -72, +3, 16, -78, 50, 50, 30, -65, 3, 12, 0, 0, 2, -16, 0, 57, 0, 17, 2, -5, 0, 16, -1, -64, -75, 9, +11, 52, 16, 16, 23, -70, 3, 12, 0, 10, 1, 37, -123, 47, -3, 50, 47, 43, -19, 16, -11, -19, 51, 47, -19, +51, 47, 18, 57, 17, 51, 47, 51, 25, 47, -27, 0, 24, 47, -19, 63, 57, 63, 51, 51, -19, 17, 57, 17, 57, +57, 49, 48, 1, 43, 43, 43, 43, 1, 20, 7, 6, 7, 6, 35, 34, 39, 38, 53, 52, 55, 54, 55, 54, 55, +23, 6, 7, 6, 7, 6, 21, 20, 22, 51, 50, 55, 54, 53, 52, 39, 38, 47, 2, 52, 55, 51, 22, 22, 23, +22, 23, 22, 23, 20, 6, 7, 39, 22, 23, 22, 23, 22, 4, 13, 75, 67, -126, 110, -87, -63, 106, 116, 25, 21, +43, 31, 53, 32, 37, 25, 33, 16, 19, -77, -97, -87, -112, -98, 31, 24, 35, 33, 46, 55, 17, 4, 20, 23, 31, +37, 27, 20, 10, 15, 57, 2, 27, 31, 15, 24, 1, -95, -96, 94, 83, 36, 30, 71, 78, -101, 86, 93, 79, 94, +68, 96, 19, 67, 53, 71, 56, 68, 64, 123, 126, 58, 64, 89, 97, -24, -78, -36, -62, 24, -122, 110, 38, 37, 9, +13, 18, 13, 10, 70, 64, 58, 18, 22, -77, -47, -126, -48, 0, -1, -1, 0, 71, 0, 14, 4, 13, 6, 51, 0, +22, 3, -35, 0, 0, 0, 1, -1, -70, 1, 37, 1, -88, 6, 51, 0, 18, 0, 113, -71, 0, 18, -1, -16, 64, +10, 28, 29, 52, 5, 4, 13, 16, 18, 3, 17, -72, 2, -17, -78, 9, 8, 13, -65, 3, 11, 0, 3, 2, -17, +0, 64, 0, 1, 2, -21, 0, 9, 2, -5, 64, 11, 32, 8, 8, 5, 5, 4, 16, 17, 13, 13, 4, -72, 3, +16, -78, 17, 17, 3, -67, 3, 16, 0, 0, 2, -16, 0, 20, 0, 1, 1, 37, -123, 47, 16, -11, -19, 51, 47, +-19, 51, 47, 18, 57, 17, 51, 47, 51, 25, 47, 26, -19, 0, 24, 63, 26, -19, 63, 51, 51, -19, 17, 57, 57, +17, 57, 57, 49, 48, 0, 43, 1, 33, 53, 33, 3, 39, 52, 54, 55, 23, 20, 23, 22, 23, 20, 6, 7, 39, +19, 1, -88, -2, 18, 1, -119, 119, 52, 24, 24, 15, 65, 50, 51, 16, 11, 48, 118, 1, 37, -82, 3, 80, 25, +69, 121, 57, 11, 58, 29, 20, 20, 50, 114, 28, 16, -4, -16, -1, -1, -1, -70, 1, 37, 1, -88, 6, 51, 0, +22, 3, -33, 0, 0, 0, 1, 0, 35, -2, 78, 2, -76, 2, -37, 0, 42, 0, -120, -71, 0, 8, -1, -32, -77, +28, 31, 52, 7, -72, -1, -8, 64, 19, 17, 25, 52, -117, 19, -117, 24, 2, 32, 27, 31, 64, 9, 24, 52, 31, +31, 23, 36, -72, 2, -17, 64, 9, 27, 64, 25, 26, 52, 27, 27, 23, 42, -66, 2, -17, 0, 23, 2, -17, 0, +1, 2, -21, 0, 12, 3, 6, -77, 23, 23, 0, 31, -72, 2, -6, -77, 32, 32, 5, 0, -72, 2, -16, -74, 44, +12, 12, 18, 9, 9, 5, -72, 2, -3, -77, 16, 18, 1, 18, 47, 93, -19, 51, 47, 25, 18, 57, 47, 24, 16, +-28, 17, 57, 47, -3, 17, 57, 47, 0, 63, 63, -19, -19, 17, 51, 47, 43, -19, 18, 57, 47, 43, 18, 57, 49, +48, 1, 93, 43, 43, 1, 35, 34, 7, 6, 21, 20, 22, 22, 21, 20, 6, 7, 38, 39, 38, 39, 38, 53, 52, +54, 55, 54, 55, 38, 39, 38, 35, 34, 7, 6, 7, 39, 54, 55, 54, 51, 50, 23, 22, 23, 22, 23, 2, -76, +119, -90, 124, -99, 45, 47, 11, 14, 26, 25, 48, 23, 36, 107, 111, 88, -79, 63, 15, 51, 52, 33, 30, 24, 34, +46, 30, 38, 63, 86, 62, 62, 51, 53, 26, 51, 1, 37, 31, 39, 73, 66, -106, -102, 64, 38, 62, 50, 83, 83, +-98, 81, -128, 26, -128, -119, 33, 26, 18, 64, 12, 40, 20, 16, 39, 29, 75, 45, 74, 46, 38, 68, 33, 79, 0, +-1, -1, 0, 35, -2, 78, 2, -76, 2, -37, 0, 22, 3, -31, 0, 0, 0, 2, -1, -70, 1, 37, 3, 39, 3, +73, 0, 23, 0, 35, 0, 118, 64, 11, 30, 32, 12, 13, 52, 27, 32, 12, 17, 52, 33, -72, -1, -32, -77, 12, +17, 52, 19, -72, 3, 10, -78, 28, 28, 32, -72, 2, -17, -76, 5, 5, 10, 9, 35, -72, 2, -17, -78, 0, 0, +10, -70, 2, -17, 0, 9, 2, -21, -73, 28, 32, 19, 19, 24, 5, 9, 32, -72, -1, -32, -74, 17, 21, 52, 32, +32, 9, 24, -70, 3, 0, 0, 0, 2, -16, -79, 37, 9, 47, 16, -11, -19, 17, 57, 47, 43, 18, 57, 25, 18, +57, 47, 18, 57, 0, 24, 63, -19, 60, 16, -19, 17, 18, 57, 47, -3, 50, 47, -19, 49, 48, 1, 43, 43, 43, +1, 35, 34, 39, 38, 39, 6, 6, 35, 35, 53, 51, 50, 55, 54, 55, 54, 55, 54, 55, 22, 23, 22, 21, 39, +38, 39, 38, 39, 6, 7, 6, 7, 22, 22, 23, 3, 39, 104, 67, 84, 97, 74, 58, 121, 116, -100, -103, 91, 71, +55, 45, 61, 89, 80, 67, 69, 41, 55, 115, 13, 27, 23, 38, 48, 33, 22, 30, 36, -125, 58, 1, 37, 30, 35, +61, 71, 55, -82, 46, 36, 65, 88, 65, 58, 16, 105, 84, 114, 71, 23, 58, 56, 47, 50, 12, 33, 21, 50, 39, +62, 7, -1, -1, -1, -70, 1, 37, 3, 39, 3, 73, 0, 22, 3, -29, 0, 0, 0, 2, 0, 69, -1, 108, 4, +53, 4, 118, 0, 3, 0, 36, 0, -90, -71, 0, 6, -1, -32, -77, 13, 17, 52, 23, -72, -1, -42, 64, 16, 14, +17, 52, 26, 32, 11, 17, 52, 31, 32, 11, 17, 52, 0, 2, 3, -72, 3, 2, -78, 1, 1, 32, 65, 10, 2, +-17, 0, 33, 3, 9, 0, 18, 0, 17, 3, 7, 0, 24, 2, -17, 0, 8, 3, 17, -78, 1, 3, 2, -70, 3, +1, 0, 0, -1, -64, 64, 11, 10, 14, 52, 0, 0, 21, 33, 33, 32, 32, 28, 65, 10, 3, 3, 0, 64, 0, +4, 2, -16, 0, 38, 0, 18, 2, -5, 0, 32, 0, 17, -1, -64, -75, 9, 11, 52, 17, 17, 21, -70, 3, 3, +0, 12, 1, 42, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -11, 26, -3, 50, 47, 25, 57, 47, 24, 17, +57, 47, 43, -3, 57, 57, 0, 63, -19, 63, 57, 63, -19, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 43, +1, 7, 39, 55, 1, 20, 7, 6, 33, 34, 39, 38, 53, 52, 54, 55, 54, 55, 23, 6, 6, 21, 20, 22, 51, +50, 55, 54, 53, 52, 39, 38, 39, 55, 22, 22, 21, 2, -63, 75, -100, 72, 2, 19, -125, -115, -2, -58, -56, 106, +116, 42, 36, 22, 54, 40, 70, 45, -79, -92, -67, -110, -75, 30, 26, 48, 83, 53, 40, 4, 36, -113, 86, -117, -4, +-81, -33, 105, 113, 70, 77, -97, 86, -80, 89, 54, 112, 18, -112, -90, 69, 124, -127, 67, 83, -107, 102, 88, 78, 58, +-51, 81, -88, -117, -1, -1, 0, 69, -1, 108, 4, 53, 4, 118, 0, 22, 3, -27, 0, 0, 0, 2, -1, -70, 1, +37, 1, -12, 5, 22, 0, 3, 0, 16, 0, 91, -73, 10, 52, 12, 17, 52, 0, 2, 3, -72, 3, 2, -78, 1, +1, 11, -66, 2, -17, 0, 12, 3, 4, 0, 6, 2, -17, 0, 5, 2, -21, -78, 1, 3, 0, -72, 3, 1, -73, +2, 2, 5, 12, 12, 11, 11, 7, -67, 3, 3, 0, 4, 2, -16, 0, 18, 0, 5, 1, 42, -123, 47, 16, -11, +-3, 50, 47, 25, 57, 47, 24, 17, 57, 47, -19, 57, 57, 0, 63, -19, 63, -19, 51, 47, -19, 57, 57, 49, 48, +1, 43, 1, 7, 39, 55, 19, 33, 53, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 1, -92, 76, -94, 74, -12, +-3, -58, 1, -15, 28, 19, 75, 78, 72, 18, 27, 4, -62, -111, 84, -111, -4, 15, -82, 118, 62, 43, 81, -93, 91, +51, 77, -78, -1, -1, -1, -70, 1, 37, 1, -12, 5, 22, 0, 22, 3, -25, 0, 0, -1, -1, 0, 54, 1, 10, +2, 24, 3, 113, 0, 22, 3, 8, 0, 0, 0, 2, -1, -9, 1, 37, 3, 0, 4, -87, 0, 30, 0, 39, 0, +110, 64, 12, 4, 3, 1, 31, 35, 32, 5, 38, 8, 21, 21, 14, -72, 3, 10, -78, 32, 32, 38, -72, 2, -17, +-78, 8, 8, 30, -69, 2, -17, 0, 64, 0, 1, 2, -21, -73, 27, 0, 14, 32, 31, 5, 4, 17, -72, 2, -2, +-73, 32, 15, 21, 1, 21, 21, 35, 0, -67, 2, -16, 0, 41, 0, 35, 3, 19, 0, 11, 1, 19, -123, 47, -19, +16, -27, 25, 17, 57, 47, 93, 26, -3, 23, 57, 18, 57, 0, 24, 63, 26, -3, 50, 47, -3, 50, 47, -3, 50, +47, 17, 18, 57, 17, 57, 57, 49, 48, 1, 93, 1, 35, 34, 39, 38, 39, 6, 6, 35, 34, 38, 53, 52, 54, +55, 38, 38, 53, 52, 55, 54, 55, 22, 22, 23, 23, 22, 23, 22, 51, 51, 1, 39, 6, 6, 7, 22, 22, 51, +50, 3, 0, -113, 72, 55, 41, 25, 30, 92, 51, 115, -103, -32, -88, 2, 13, 23, 19, 31, 10, 21, 14, 30, 25, +20, 31, 33, -113, -2, -93, 19, 87, 100, 34, 21, 56, 49, 60, 1, 37, 123, 92, -111, 56, 62, 31, 24, 86, -47, +78, 8, 68, 8, 34, 42, 34, 36, 62, 116, 62, -84, -114, 68, 104, 1, 17, 109, 31, 67, 55, 9, 10, 0, 3, +-1, -70, 1, 0, 3, 20, 4, 112, 0, 40, 0, 53, 0, 67, 0, -89, 64, 15, 58, 32, 15, 17, 52, 58, 45, +61, 18, 50, 14, 29, 29, 45, 35, -72, -1, -64, -73, 15, 17, 52, 35, 35, 45, 45, 50, -72, 2, -17, -76, 8, +8, 14, 13, 65, -66, 2, -17, 0, 4, 2, -21, 0, 14, 2, -17, 0, 13, 2, -21, 64, 20, 61, 58, 8, 50, +41, 29, 31, 35, 18, 32, 9, 14, 52, 18, 48, 22, 35, 35, 41, 22, -72, 3, 0, -77, 48, 48, 13, 41, -72, +2, -3, 64, 9, 58, 64, 9, 12, 52, 58, 58, 13, 54, -72, 3, 0, -77, 0, 0, 69, 13, -72, 1, 31, -123, +47, 17, 51, 47, -19, 17, 57, 47, 43, -19, 17, 57, 47, -19, 25, 18, 57, 47, 17, 18, 57, 43, 17, 57, 57, +17, 57, 57, 18, 57, 0, 24, 63, -19, 63, -19, 17, 18, 57, 47, -3, 50, 47, 51, 47, 43, 18, 57, 47, 17, +18, 57, 57, 17, 57, 43, 49, 48, 1, 20, 7, 6, 35, 34, 39, 38, 39, 6, 7, 6, 35, 35, 53, 51, 50, +54, 55, 38, 39, 38, 53, 52, 54, 55, 55, 54, 54, 55, 38, 53, 52, 55, 54, 55, 22, 23, 22, 23, 22, 37, +52, 39, 38, 35, 34, 6, 21, 20, 23, 54, 55, 54, 23, 52, 39, 38, 39, 20, 6, 7, 22, 23, 22, 51, 50, +54, 3, 20, 36, 39, 39, 41, 112, 103, 71, 116, 53, 67, 91, 90, 90, 41, 76, 65, 26, 26, 28, 3, 12, 99, +20, 33, 29, 69, 44, 15, 31, 64, 97, 123, 71, 94, -2, -96, 18, 21, 46, 46, 80, 122, 43, 21, 25, -15, 56, +35, 51, 41, 37, 60, 61, 50, 21, 12, 16, 1, -50, 58, 71, 77, 52, 48, 46, 66, 19, 24, -82, 13, 17, 19, +20, 25, 24, 17, 16, 22, -83, 35, 27, 8, 47, 20, 20, 83, 28, 55, 61, 116, -110, 115, -104, -123, 43, 25, 30, +61, 43, 41, 67, 28, 26, 30, -57, 35, 74, 47, 53, 49, 85, 23, 31, 30, 22, 18, 0, 0, 3, -1, -70, -1, +-126, 3, 39, 3, 111, 0, 31, 0, 41, 0, 52, 0, -118, -75, 38, 34, 46, 16, 15, 23, -72, 2, -17, -77, 34, +34, 16, 9, -72, 2, -17, -77, 50, 50, 15, 31, -72, 2, -17, -78, 0, 0, 16, -70, 2, -17, 0, 15, 2, -21, +64, 10, 1, 42, 46, 30, 32, 38, 14, 46, 13, 38, -72, 3, 3, -78, 17, 17, 46, -72, 3, 3, -76, 13, 13, +42, 15, 32, -72, 2, -3, -78, 26, 26, 5, -72, 2, -3, -77, 42, 42, 15, 0, -69, 2, -16, 0, 54, 0, 15, +1, 27, -123, 47, 16, -28, 17, 57, 47, -19, 57, 47, -19, 17, 18, 57, 47, -19, 51, 47, -19, 17, 18, 57, 17, +18, 57, 17, 18, 57, 0, 63, -19, 60, 16, -19, 17, 51, 47, -19, 17, 51, 47, -19, 17, 18, 57, 17, 57, 49, +48, 1, 33, 22, 23, 22, 21, 20, 7, 6, 35, 34, 39, 38, 53, 55, 35, 53, 51, 54, 55, 54, 55, 54, 51, +50, 22, 21, 20, 7, 6, 7, 33, 37, 52, 35, 34, 7, 6, 7, 54, 55, 54, 19, 52, 39, 38, 39, 20, 23, +22, 51, 50, 54, 3, 39, -2, -110, 64, 45, 57, 24, 30, 64, 120, 100, 120, 2, -35, -3, 35, 42, 53, 58, 67, +59, 31, 47, 46, 27, -121, 1, -72, -2, -75, 40, 43, 60, 29, 53, 91, 62, 72, 40, 116, 95, 92, 53, 64, 127, +24, 35, 1, 37, 30, 55, 69, 81, 78, 47, 59, 83, 100, -92, 72, -82, 93, 80, 101, 64, 74, 108, 61, 88, 55, +33, 67, -87, 95, 94, 45, 105, 25, 38, 44, -3, -8, 79, 73, 60, 16, 110, 71, 86, 20, 0, 2, 0, 50, -1, +99, 3, 117, 3, 20, 0, 32, 0, 42, 0, 117, -75, 16, 64, 11, 17, 52, 3, -72, -1, -32, 64, 12, 11, 18, +52, 18, 64, 9, 17, 52, 11, 20, 10, 28, -72, 2, -17, -78, 37, 37, 33, -70, 2, -17, 0, 20, 2, -21, -78, +10, 10, 14, -68, 3, 10, 0, 4, 3, 8, 0, 24, 2, -3, -77, 40, 40, 10, 33, -68, 3, 3, 0, 20, 3, +3, 0, 0, 2, -16, -78, 44, 11, 10, -72, -1, -64, -77, 9, 12, 52, 10, -72, 1, 31, -123, 47, 43, 51, 16, +-11, -19, -19, 17, 57, 47, -19, 0, 63, -3, 50, 25, 47, 24, 63, -3, 50, 47, -19, 17, 18, 57, 49, 48, 1, +43, 43, 43, 1, 20, 7, 6, 35, 34, 39, 38, 39, 38, 39, 55, 22, 22, 51, 50, 55, 54, 55, 54, 55, 34, +39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 21, 7, 38, 39, 38, 35, 34, 6, 21, 20, 22, 3, 117, 122, -120, +-78, 66, 70, 51, 82, 65, 65, 17, 56, 123, 49, 122, 109, 85, 85, 43, 79, -121, 67, 76, 48, 56, 86, 87, 38, +30, 63, 22, 31, 27, 39, 28, 41, 88, 1, 97, -91, -93, -74, 15, 11, 27, 23, 22, 35, 13, 29, 62, 49, 93, +47, 106, 43, 49, 112, 103, 88, 102, 101, 79, -115, 5, 96, 37, 32, 37, 28, 49, 51, 0, -1, -1, 0, 50, -1, +99, 3, 117, 3, 20, 0, 22, 3, -19, 0, 0, -1, -1, 0, 50, -1, -89, 4, -39, 3, -78, 0, 22, 3, 53, +0, 0, -1, -1, 0, 36, -1, 31, 4, -75, 2, 5, 0, 22, 3, 54, 0, 0, 0, 3, 0, 50, -2, 86, 4, +-39, 3, -78, 0, 59, 0, 63, 0, 67, 0, -43, -71, 0, 38, -1, -42, 64, 16, 14, 17, 52, 41, 52, 14, 17, +52, 42, 52, 11, 17, 52, 60, 62, 63, -72, 3, 2, -76, 61, 61, 64, 66, 67, -70, 3, 2, 0, 65, 3, 6, +-75, 3, 6, 14, 33, 39, 32, 65, 9, 3, 7, 0, 6, 2, -17, 0, 57, 3, 4, 0, 39, 2, -17, 0, 22, +-1, -64, -77, 9, 11, 52, 22, -68, 3, 13, 0, 14, 2, -17, 0, 48, 2, -21, -78, 61, 63, 60, -72, 3, 1, +-76, 62, 62, 65, 67, 66, -72, 3, 1, -77, 64, 64, 36, 51, -72, 3, 12, 64, 9, 10, 10, 44, 36, 3, 18, +0, 0, 44, -72, 2, -3, -76, 64, 18, 18, 69, 33, -69, 2, -5, 0, 32, 0, 32, -1, -64, -75, 9, 11, 52, +32, 32, 36, -70, 3, 12, 0, 26, 1, 57, -123, 47, -3, 50, 25, 47, 43, 26, -19, 17, 51, 24, 47, 26, -19, +51, 47, 18, 57, 17, 18, 57, 47, -19, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -19, 63, 43, +-19, 63, -19, 63, 18, 57, 17, 18, 57, 63, -19, 57, 57, 51, 47, -19, 57, 57, 49, 48, 1, 43, 43, 43, 1, +20, 6, 7, 38, 38, 35, 34, 7, 6, 21, 20, 22, 51, 51, 50, 22, 22, 21, 20, 7, 6, 33, 34, 39, 38, +53, 52, 55, 54, 55, 54, 55, 23, 6, 6, 21, 20, 22, 51, 50, 55, 54, 54, 53, 52, 38, 35, 35, 34, 38, +53, 52, 55, 54, 55, 54, 51, 50, 22, 1, 7, 39, 55, 7, 7, 39, 55, 4, -39, 12, 2, 35, 97, 50, 87, +96, 88, 43, 53, 80, 72, 69, 96, -37, -55, -2, -87, -78, 94, 102, 34, 26, 46, 3, 60, 42, 63, 67, -87, -99, +120, -97, -120, -38, 25, 28, -22, 43, 66, 55, 60, 85, 102, 103, 66, 76, -2, -121, 78, -94, 75, 65, 76, -94, 74, +3, 32, 32, 67, 14, 45, 52, 101, 93, 55, 19, 19, 3, 16, 65, -5, -125, 120, 69, 75, -105, 104, 114, 87, 95, +6, 113, 17, 112, -61, 75, 122, 122, 48, 41, 114, 27, 19, 12, 62, 49, 67, 115, 125, 84, 101, 80, -5, -33, -112, +86, -113, -81, -111, 84, -111, 0, 0, 3, 0, 36, -2, 78, 4, -75, 2, 5, 0, 54, 0, 58, 0, 62, 0, -2, +-75, -122, 51, -106, 51, 2, 32, -72, -1, -32, 64, 19, 12, 24, 52, 58, 16, 18, 21, 52, 20, 24, 18, 20, 52, +-106, 15, -89, 15, 2, 6, -72, -1, -64, -74, 9, 10, 52, 6, 6, 1, 44, -72, -1, -64, -74, 46, 47, 52, 44, +44, 1, 34, -72, 2, -17, 64, 12, -17, 17, 1, 17, 17, 62, 55, 57, -97, 58, 1, 58, -72, 3, 20, -73, 56, +56, 59, 61, -97, 62, 1, 62, -70, 3, 20, 0, 60, -1, -64, -77, 9, 12, 52, 60, -72, 3, 6, -77, 26, 25, +25, 53, -70, 2, -17, 0, 1, 2, -21, -78, 56, 58, 55, -72, 3, 1, -76, 57, 57, 60, 62, 61, -72, 3, 1, +-73, 48, 59, 1, 59, 59, 47, 30, 38, -72, 3, 12, -77, 13, 13, 0, 47, -72, 3, 12, -76, 64, 4, 4, 30, +0, -66, 2, -16, 0, 64, 0, 26, 2, -5, 0, 32, 0, 25, -1, -64, -75, 9, 11, 52, 25, 25, 30, -70, 3, +12, 0, 21, 1, 57, -123, 47, -3, 50, 25, 47, 43, 26, -19, 24, 16, -28, 17, 57, 47, 26, -19, 18, 57, 47, +-19, 17, 18, 57, 47, 93, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -3, 50, 47, 57, 63, 43, -19, 93, 57, +57, 51, 47, -19, 93, 57, 57, 17, 51, 47, 93, -3, 17, 57, 47, 43, 18, 57, 47, 43, 49, 48, 1, 93, 43, +43, 43, 0, 113, 1, 35, 34, 6, 21, 20, 51, 50, 22, 23, 22, 23, 22, 21, 20, 7, 6, 33, 34, 39, 38, +53, 52, 55, 54, 55, 23, 6, 7, 6, 21, 20, 23, 22, 51, 50, 55, 54, 53, 52, 38, 35, 38, 38, 35, 34, +38, 53, 52, 55, 54, 55, 54, 51, 51, 1, 7, 39, 55, 7, 7, 39, 55, 4, -75, -81, -102, -101, 93, 41, 48, +81, 48, 18, 29, 123, -122, -2, -53, -41, 127, -121, 64, 23, 98, 40, 38, 37, 57, -128, 122, -43, -113, 109, -122, 30, +35, 27, 115, 18, 63, 54, 73, 60, 101, 76, 84, -81, -2, 98, 93, 112, 90, 92, 91, 116, 93, 1, 37, 16, 24, +33, 4, 9, 6, 9, 15, 37, -69, 85, 93, 73, 78, -112, 116, -126, 47, -102, 20, 65, 64, 110, 70, 123, 64, 61, +22, 27, 47, 17, 17, 3, 7, 33, 33, 124, 79, 64, 31, 23, -4, -47, 86, 71, 94, 79, 86, 71, 94, 0, 0, +3, -1, -70, -1, 114, 1, -12, 3, -90, 0, 12, 0, 16, 0, 20, 0, 125, -73, 6, 52, 12, 17, 52, 17, 19, +18, -72, 3, 2, -76, 20, 20, 15, 13, 14, -72, 3, 2, -74, 0, 16, 1, 16, 16, 1, 7, -66, 2, -17, 0, +8, 3, 4, 0, 2, 2, -17, 0, 1, 2, -21, -78, 14, 16, 13, -72, 3, 1, -76, 15, 15, 18, 20, 19, -72, +3, 1, -73, 17, 17, 1, 8, 8, 7, 7, 3, -67, 3, 3, 0, 0, 2, -16, 0, 22, 0, 1, 1, 42, -123, +47, 16, -12, -3, 50, 47, 25, 57, 47, 24, 17, 57, 47, -3, 57, 57, 51, 47, -19, 57, 57, 0, 63, -19, 63, +-19, 17, 51, 47, 93, -19, 57, 57, 51, 47, -3, 57, 57, 49, 48, 1, 43, 1, 33, 53, 33, 52, 39, 38, 39, +55, 22, 23, 22, 21, 3, 7, 39, 55, 7, 7, 39, 55, 1, -12, -3, -58, 1, -15, 28, 19, 75, 78, 72, 18, +27, 5, 78, -94, 75, 65, 76, -94, 74, 1, 37, -82, 118, 62, 43, 81, -93, 91, 51, 77, -78, -2, 68, -112, 86, +-113, -81, -111, 84, -111, -1, -1, -1, -70, -1, 114, 1, -12, 3, -90, 0, 22, 3, -13, 0, 0, 0, 3, 0, 64, +0, -94, 4, 14, 6, -99, 0, 68, 0, 78, 0, 101, 1, 48, 64, 19, 84, 8, 86, 74, 2, 79, 99, 101, 64, +22, 63, 52, 101, 101, 95, 99, 91, 87, 90, -72, -1, -64, -74, 22, 63, 52, 90, 90, 83, 95, -72, 2, -15, -78, +87, 87, 99, -72, 2, -15, 64, 39, 83, 83, 46, 60, 59, 0, 1, 2, 75, 31, 46, 55, 32, 12, 17, 52, 21, +72, 23, 7, 55, 5, 35, 14, 75, 17, -113, 35, 1, 35, 64, 9, 17, 52, 35, 35, 46, 75, 2, -72, 2, -17, +-77, 0, 0, 75, 63, -65, 2, -14, 0, 46, 2, -14, 0, 17, 2, -17, 0, 64, 0, 75, 2, -21, 64, 19, 101, +101, 79, 90, 79, 90, 91, 91, 31, 35, 42, 55, 72, 7, 75, 21, 23, 17, 64, -72, 2, -5, 64, 11, 32, 63, +63, 60, 60, 59, 1, 2, 0, 0, 59, -72, 3, 12, -78, 2, 2, 7, -70, 3, 12, 0, 23, -1, -64, 64, 9, +9, 10, 52, 23, 23, 17, 17, 42, 69, -72, 3, 3, 64, 17, 11, 64, 13, 15, 52, 11, 64, 9, 11, 52, 11, +11, 103, 64, 42, 1, 42, -72, 1, 21, -123, 47, 93, 17, 51, 47, 43, 43, -19, 17, 57, 47, 57, 47, 43, -3, +50, 47, -19, 51, 47, 18, 57, 17, 51, 47, 51, 25, 47, 26, -19, 17, 18, 57, 57, 17, 57, 57, 17, 57, 57, +51, 24, 47, 51, 51, 25, 47, 24, 47, 51, 25, 47, 0, 24, 63, 26, -19, 63, 63, 18, 57, 47, -19, 17, 18, +57, 47, 43, 93, 17, 18, 57, 17, 23, 57, 43, 18, 57, 17, 18, 57, 17, 57, 57, 17, 51, 47, -19, 51, 47, +-19, 18, 57, 47, 43, 18, 57, 17, 18, 57, 47, 43, 18, 57, 49, 48, 0, 93, 1, 7, 39, 23, 20, 7, 6, +7, 22, 23, 22, 21, 20, 6, 7, 6, 6, 35, 54, 53, 54, 55, 54, 55, 38, 39, 38, 39, 38, 39, 38, 35, +34, 7, 6, 35, 34, 39, 38, 39, 38, 38, 53, 52, 55, 54, 51, 50, 23, 22, 23, 22, 23, 23, 22, 23, 54, +55, 54, 53, 39, 52, 54, 55, 23, 22, 23, 22, 22, 3, 52, 38, 39, 6, 6, 7, 50, 55, 54, 1, 6, 7, +6, 35, 34, 39, 38, 35, 34, 6, 7, 39, 54, 55, 54, 51, 50, 23, 22, 51, 50, 55, 4, 14, 48, 59, 2, +34, 37, 80, 38, 15, 23, 4, 7, 106, -15, 114, 1, 5, 19, -86, 117, 70, 32, 35, 84, 31, 24, 33, 19, 13, +30, 16, 11, 22, 47, 41, 45, 36, 26, 8, 12, 29, 41, 78, 69, 85, 75, 73, 102, 45, 47, 67, 25, 22, 57, +23, 21, 23, 4, 44, 24, 75, -16, 17, 29, 30, 119, 58, 118, 50, 85, -2, -50, 28, 29, 41, 48, 50, 45, 99, +6, 12, 24, 15, 11, 25, 11, 23, 38, 9, 100, 50, 33, 53, 52, 5, 70, -76, 29, 91, -122, 126, -118, -121, 70, +40, 63, 65, 37, 52, 35, 24, 27, 19, 13, 76, 65, 91, -111, -124, 55, 60, 127, 43, 26, 35, 15, 8, 44, 39, +57, 46, 61, 43, 62, 35, 53, 78, 70, 114, 101, 117, -92, 74, 94, -121, -118, 120, -70, 33, 66, 107, 44, 6, 43, +26, 14, 36, -4, 43, 22, 47, 54, 39, 102, 36, 7, 12, 5, 32, 32, 17, 24, 15, 33, 7, 7, 13, 36, 9, +20, 32, 16, 23, 0, 3, 0, 73, 0, -14, 4, -50, 6, -99, 0, 23, 0, 62, 0, 85, 1, 68, -71, 0, 22, +-1, -32, -77, 15, 17, 52, 20, -72, -1, -32, -77, 15, 17, 52, 21, -72, -1, -42, -77, 14, 17, 52, 41, -72, -1, +-42, -77, 11, 17, 52, 40, -72, -1, -32, 64, 9, 11, 17, 52, 91, 28, -119, 43, 2, 34, -72, -1, -32, 64, 37, +9, 10, 52, 43, 42, 9, 17, 52, 42, 74, 9, 17, 52, 41, 84, 9, 17, 52, 40, 64, 9, 17, 52, 63, 83, +85, 64, 22, 63, 52, 85, 85, 79, 83, 75, 71, 74, -72, -1, -64, -74, 22, 63, 52, 74, 74, 67, 79, -72, 2, +-15, -78, 71, 71, 83, -72, 2, -15, 64, 24, 67, 67, 7, 10, 64, 10, 17, 52, 10, 10, 18, 3, 32, 32, 48, +3, 64, 9, 24, 52, 3, 3, 62, 18, -66, 2, -14, 0, 48, 2, -17, 0, 51, 2, -14, 0, 39, 2, -5, -78, +38, 38, 62, -70, 2, -17, 0, 25, 2, -21, 64, 13, 85, 85, 63, 74, 63, 63, 74, 75, 75, 7, 10, 0, 3, +-72, -1, -64, -77, 24, 32, 52, 3, -72, -1, -64, 64, 13, 10, 15, 52, 3, 3, 16, 32, 55, 45, 11, 48, 1, +48, -72, 3, 16, -78, 51, 51, 45, -72, 3, 16, -78, 55, 55, 24, -72, 2, -16, -77, 87, 38, 38, 16, -72, 1, +29, -123, 47, 51, 47, 16, -11, 50, 47, -19, 51, 25, 47, 24, -19, 93, 17, 18, 57, 25, 18, 57, 47, 43, 43, +51, 57, 57, 50, 24, 47, 51, 51, 47, 25, 47, 17, 51, 47, 0, 24, 63, -19, 51, 47, -19, 63, -19, 63, 18, +57, 47, 43, 17, 57, 47, 17, 18, 57, 47, 43, 57, 50, 47, -19, 51, 47, -19, 18, 57, 47, 43, 18, 57, 17, +18, 57, 47, 43, 18, 57, 49, 48, 1, 43, 43, 43, 43, 43, 93, 0, 43, 43, 43, 43, 43, 1, 20, 6, 7, +38, 39, 38, 35, 34, 6, 35, 34, 39, 38, 39, 38, 53, 52, 51, 50, 23, 22, 23, 22, 1, 35, 34, 39, 38, +53, 52, 38, 53, 2, 7, 6, 7, 6, 33, 53, 36, 55, 54, 55, 54, 53, 52, 38, 39, 55, 54, 55, 22, 23, +22, 23, 22, 23, 22, 23, 22, 51, 51, 1, 6, 7, 6, 35, 34, 39, 38, 35, 34, 6, 7, 39, 54, 55, 54, +51, 50, 23, 22, 51, 50, 55, 3, 48, 4, 8, 56, 110, 122, 70, 15, 30, 20, 27, 58, 73, 44, 59, 41, 72, +-103, -85, 116, -113, 1, -98, 61, 84, 51, 61, 7, 96, 75, 89, -94, -118, -2, -76, 1, 13, -124, -43, 110, -123, 25, +22, 33, 20, 17, 26, 23, 16, 15, 19, 14, 18, 36, 24, 24, 61, -3, 19, 28, 29, 41, 48, 50, 45, 99, 6, +12, 24, 15, 11, 25, 11, 23, 38, 9, 100, 50, 33, 53, 52, 3, 48, 20, 28, 21, 125, -123, -109, 52, 35, 44, +58, 78, 88, 63, 91, 101, -121, -91, -3, 87, 91, 110, -33, 16, 54, 7, -2, -11, 99, 116, 38, 32, 28, 81, 59, +94, 123, -108, -53, 98, -86, 89, 84, 49, 34, -112, -89, 115, -124, -94, 99, 126, 54, 36, 4, -93, 32, 17, 24, 15, +33, 7, 7, 13, 36, 9, 20, 32, 16, 23, 0, 0, 3, 0, 38, 0, -94, 4, 14, 7, 10, 0, 68, 0, 78, +0, 110, 1, 64, -71, 0, 81, -1, -32, 64, 44, 11, 17, 52, 84, 8, 86, 74, 2, 60, 59, 0, 1, 2, 75, +31, 46, 55, 32, 12, 17, 52, 21, 72, 23, 7, 55, 5, 35, 14, 75, 17, -113, 35, 1, 35, 64, 9, 17, 52, +35, 35, 46, 75, 2, -72, 2, -17, -76, 0, 0, 63, 75, 46, -72, -1, -64, -74, 9, 29, 52, 46, 46, 84, 63, +-72, 2, -14, -74, 79, 100, 102, 86, 108, 84, 84, -72, -1, -64, -74, 18, 25, 52, 84, 108, 108, 102, -72, 2, -11, +-75, 94, 64, 9, 14, 52, 94, -68, 3, 21, 0, 17, 2, -17, 0, 75, 2, -21, 64, 11, 100, 86, 97, 97, 105, +79, 79, 105, 84, 84, 90, -72, 3, 5, 64, 14, 64, 105, 105, 31, 35, 42, 55, 72, 7, 75, 21, 23, 17, 64, +-72, 2, -5, 64, 11, 32, 63, 63, 60, 60, 59, 1, 2, 0, 0, 59, -72, 3, 12, -78, 2, 2, 7, -70, 3, +12, 0, 23, -1, -64, 64, 9, 9, 10, 52, 23, 23, 17, 17, 42, 69, -72, 3, 3, 64, 17, 11, 64, 13, 15, +52, 11, 64, 9, 11, 52, 11, 11, 112, 64, 42, 1, 42, -72, 1, 59, -123, 47, 93, 17, 51, 47, 43, 43, -19, +17, 57, 47, 57, 47, 43, -3, 50, 47, -19, 51, 47, 18, 57, 17, 51, 47, 51, 25, 47, 26, -19, 17, 18, 57, +57, 17, 57, 57, 17, 57, 57, 51, 24, 47, 26, -3, 50, 47, 17, 51, 47, 18, 57, 47, 57, 57, 0, 63, -19, +63, 43, -3, 50, 47, 51, 43, 47, 18, 57, 17, 57, 57, 63, 17, 51, 47, 43, 17, 18, 57, 47, -19, 17, 18, +57, 47, 43, 93, 17, 18, 57, 17, 23, 57, 43, 18, 57, 17, 18, 57, 17, 57, 57, 49, 48, 0, 93, 43, 1, +7, 39, 23, 20, 7, 6, 7, 22, 23, 22, 21, 20, 6, 7, 6, 6, 35, 54, 53, 54, 55, 54, 55, 38, 39, +38, 39, 38, 39, 38, 35, 34, 7, 6, 35, 34, 39, 38, 39, 38, 38, 53, 52, 55, 54, 51, 50, 23, 22, 23, +22, 23, 23, 22, 23, 54, 55, 54, 53, 39, 52, 54, 55, 23, 22, 23, 22, 22, 3, 52, 38, 39, 6, 6, 7, +50, 55, 54, 1, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, +38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 4, 14, 48, 59, 2, 34, 37, 80, 38, 15, 23, 4, 7, 106, -15, +114, 1, 5, 19, -86, 117, 70, 32, 35, 84, 31, 24, 33, 19, 13, 30, 16, 11, 22, 47, 41, 45, 36, 26, 8, +12, 29, 41, 78, 69, 85, 75, 73, 102, 45, 47, 67, 25, 22, 57, 23, 21, 23, 4, 44, 24, 75, -16, 17, 29, +30, 119, 58, 118, 50, 85, -2, 52, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, +22, 43, 93, 33, 22, 19, 5, 70, -76, 29, 91, -122, 126, -118, -121, 70, 40, 63, 65, 37, 52, 35, 24, 27, 19, +13, 76, 65, 91, -111, -124, 55, 60, 127, 43, 26, 35, 15, 8, 44, 39, 57, 46, 61, 43, 62, 35, 53, 78, 70, +114, 101, 117, -92, 74, 94, -121, -118, 120, -70, 33, 66, 107, 44, 6, 43, 26, 14, 36, -4, 43, 22, 47, 54, 39, +102, 36, 7, 12, 5, 16, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, +28, 18, 12, 15, 52, 3, 0, 0, 3, 0, 57, 0, -14, 4, -50, 7, 10, 0, 23, 0, 62, 0, 94, 1, 78, +-71, 0, 65, -1, -32, -77, 11, 17, 52, 41, -72, -1, -42, -77, 11, 17, 52, 40, -72, -1, -32, 64, 18, 11, 17, +52, -123, 20, -122, 21, -122, 22, -57, 20, 4, 91, 28, -119, 43, 2, 34, -72, -1, -32, 64, 47, 9, 10, 52, 43, +42, 9, 17, 52, 42, 74, 9, 17, 52, 41, 84, 9, 17, 52, 40, 64, 9, 17, 52, 7, 32, 10, 1, 10, 64, +10, 17, 52, 10, 10, 3, 64, 9, 24, 52, 3, 3, 18, 62, 32, 32, 62, 48, -68, 2, -17, 0, 51, 2, -14, +0, 39, 2, -5, -78, 38, 38, 62, -68, 2, -17, 0, 25, 2, -21, 0, 18, -1, -64, -77, 23, 29, 52, 18, -72, +-1, -64, 64, 13, 9, 17, 52, 18, 18, 68, 84, 63, 86, 70, 92, 68, 68, -72, -1, -64, -74, 18, 25, 52, 68, +92, 92, 86, -72, 2, -11, -75, 78, 64, 9, 14, 52, 78, -72, 3, 21, 64, 11, 84, 70, 81, 81, 89, 63, 63, +89, 68, 68, 74, -72, 3, 5, -75, 89, 89, 7, 10, 0, 3, -72, -1, -64, -77, 24, 32, 52, 3, -72, -1, -64, +64, 13, 10, 15, 52, 3, 3, 16, 32, 55, 45, 11, 48, 1, 48, -72, 3, 16, -78, 51, 51, 45, -72, 3, 16, +-78, 55, 55, 24, -72, 2, -16, -77, 96, 38, 38, 16, -72, 1, 59, -123, 47, 51, 47, 16, -11, 50, 47, -19, 51, +25, 47, 24, -19, 93, 17, 18, 57, 25, 18, 57, 47, 43, 43, 51, 57, 57, 50, 24, 47, -3, 50, 47, 17, 51, +47, 18, 57, 47, 57, 57, 0, 63, 43, -3, 50, 47, 51, 43, 47, 18, 57, 17, 57, 57, 17, 51, 47, 43, 43, +63, -19, 51, 47, -19, 63, -19, 17, 57, 47, 17, 18, 57, 47, 43, 57, 47, 43, 93, 57, 49, 48, 1, 43, 43, +43, 43, 43, 93, 0, 93, 43, 43, 43, 1, 20, 6, 7, 38, 39, 38, 35, 34, 6, 35, 34, 39, 38, 39, 38, +53, 52, 51, 50, 23, 22, 23, 22, 1, 35, 34, 39, 38, 53, 52, 38, 53, 2, 7, 6, 7, 6, 33, 53, 36, +55, 54, 55, 54, 53, 52, 38, 39, 55, 54, 55, 22, 23, 22, 23, 22, 23, 22, 23, 22, 51, 51, 1, 20, 7, +6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, +22, 51, 50, 54, 3, 48, 4, 8, 56, 110, 122, 70, 15, 30, 20, 27, 58, 73, 44, 59, 41, 72, -103, -85, 116, +-113, 1, -98, 61, 84, 51, 61, 7, 96, 75, 89, -94, -118, -2, -76, 1, 13, -124, -43, 110, -123, 25, 22, 33, 20, +17, 26, 23, 16, 15, 19, 14, 18, 36, 24, 24, 61, -4, -125, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, +20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 3, 48, 20, 28, 21, 125, -123, -109, 52, 35, 44, 58, 78, +88, 63, 91, 101, -121, -91, -3, 87, 91, 110, -33, 16, 54, 7, -2, -11, 99, 116, 38, 32, 28, 81, 59, 94, 123, +-108, -53, 98, -86, 89, 84, 49, 34, -112, -89, 115, -124, -94, 99, 126, 54, 36, 4, -109, 25, 20, 13, 15, 64, 46, +35, 16, 15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 0, 3, 0, 83, -1, 29, +4, 14, 5, -53, 0, 68, 0, 78, 0, 110, 1, 64, -71, 0, 81, -1, -32, 64, 15, 11, 17, 52, 84, 8, 86, +74, 2, 100, 79, 102, 86, 108, 84, 94, -72, 2, -11, 64, 15, 102, 102, 108, 64, 18, 25, 52, 108, 108, 64, 84, +-112, 84, 2, 84, -72, -1, -64, 64, 42, 11, 23, 52, 84, 84, 17, 60, 59, 0, 1, 2, 75, 31, 46, 55, 32, +12, 17, 52, 21, 72, 23, 7, 55, 5, 35, 14, 75, 17, -113, 35, 1, 35, 64, 9, 17, 52, 35, 35, 46, 75, +2, -72, 2, -17, -77, 0, 0, 75, 63, -66, 2, -14, 0, 46, 2, -14, 0, 17, 2, -17, 0, 75, 2, -21, 64, +11, 100, 86, 97, 97, 105, 79, 79, 105, 84, 84, 90, -72, 3, 5, 64, 15, 64, 105, 105, 17, 31, 35, 42, 55, +72, 7, 75, 21, 23, 17, 64, -72, 2, -5, 64, 11, 32, 63, 63, 60, 60, 59, 1, 2, 0, 0, 59, -72, 3, +12, -78, 2, 2, 7, -70, 3, 12, 0, 23, -1, -64, 64, 9, 9, 10, 52, 23, 23, 17, 17, 42, 69, -72, 3, +3, 64, 17, 11, 64, 13, 15, 52, 11, 64, 9, 11, 52, 11, 11, 112, 64, 42, 1, 42, -72, 1, 59, -123, 47, +93, 17, 51, 47, 43, 43, -19, 17, 57, 47, 57, 47, 43, -3, 50, 47, -19, 51, 47, 18, 57, 17, 51, 47, 51, +25, 47, 26, -19, 17, 18, 57, 57, 17, 57, 57, 17, 57, 57, 17, 51, 24, 47, 26, -3, 50, 47, 17, 51, 47, +18, 57, 47, 57, 57, 0, 63, -19, 63, 63, 18, 57, 47, -19, 17, 18, 57, 47, 43, 93, 17, 18, 57, 17, 23, +57, 43, 18, 57, 17, 18, 57, 17, 57, 57, 17, 51, 47, 43, 93, 51, 47, 43, 51, 47, -19, 17, 18, 57, 17, +57, 57, 49, 48, 0, 93, 43, 1, 7, 39, 23, 20, 7, 6, 7, 22, 23, 22, 21, 20, 6, 7, 6, 6, 35, +54, 53, 54, 55, 54, 55, 38, 39, 38, 39, 38, 39, 38, 35, 34, 7, 6, 35, 34, 39, 38, 39, 38, 38, 53, +52, 55, 54, 51, 50, 23, 22, 23, 22, 23, 23, 22, 23, 54, 55, 54, 53, 39, 52, 54, 55, 23, 22, 23, 22, +22, 3, 52, 38, 39, 6, 6, 7, 50, 55, 54, 3, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, +54, 51, 50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 4, 14, 48, 59, 2, 34, 37, +80, 38, 15, 23, 4, 7, 106, -15, 114, 1, 5, 19, -86, 117, 70, 32, 35, 84, 31, 24, 33, 19, 13, 30, 16, +11, 22, 47, 41, 45, 36, 26, 8, 12, 29, 41, 78, 69, 85, 75, 73, 102, 45, 47, 67, 25, 22, 57, 23, 21, +23, 4, 44, 24, 75, -16, 17, 29, 30, 119, 58, 118, 50, 85, -101, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, +45, 20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 5, 70, -76, 29, 91, -122, 126, -118, -121, 70, 40, 63, +65, 37, 52, 35, 24, 27, 19, 13, 76, 65, 91, -111, -124, 55, 60, 127, 43, 26, 35, 15, 8, 44, 39, 57, 46, +61, 43, 62, 35, 53, 78, 70, 114, 101, 117, -92, 74, 94, -121, -118, 120, -70, 33, 66, 107, 44, 6, 43, 26, 14, +36, -4, 43, 22, 47, 54, 39, 102, 36, 7, 12, -2, 80, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, +56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 0, 3, 0, 74, -1, 29, 4, -50, 5, -34, 0, 23, +0, 62, 0, 94, 1, 91, -71, 0, 65, -1, -32, -77, 11, 17, 52, 22, -72, -1, -32, -77, 15, 17, 52, 20, -72, +-1, -32, -77, 15, 17, 52, 21, -72, -1, -42, -77, 14, 17, 52, 41, -72, -1, -42, -77, 11, 17, 52, 40, -72, -1, +-32, 64, 9, 11, 17, 52, 91, 28, -119, 43, 2, 34, -72, -1, -32, 64, 30, 9, 10, 52, 43, 42, 9, 17, 52, +42, 74, 9, 17, 52, 41, 84, 9, 17, 52, 40, 64, 9, 17, 52, 84, 63, 86, 70, 92, 68, 78, -72, 2, -11, +64, 10, 86, 86, 92, 64, 18, 25, 52, 92, 92, 68, -72, -1, -64, -77, 18, 19, 52, 68, -72, -1, -64, 64, 28, +9, 15, 52, 68, 68, 38, 7, 10, 64, 10, 17, 52, 10, 10, 18, 3, 32, 32, 48, 3, 64, 9, 24, 52, 3, +3, 62, 18, -66, 2, -14, 0, 48, 2, -17, 0, 51, 2, -14, 0, 39, 2, -5, -78, 38, 38, 62, -70, 2, -17, +0, 25, 2, -21, 64, 11, 84, 70, 81, 81, 89, 63, 63, 89, 68, 68, 74, -72, 3, 5, -73, 89, 89, 45, 38, +7, 10, 0, 3, -72, -1, -64, -77, 24, 32, 52, 3, -72, -1, -64, 64, 13, 10, 15, 52, 3, 3, 16, 32, 55, +45, 11, 48, 1, 48, -72, 3, 16, -78, 51, 51, 45, -72, 3, 16, -78, 55, 55, 24, -72, 2, -16, -77, 96, 38, +38, 16, -72, 1, 59, -123, 47, 51, 47, 16, -11, 50, 47, -19, 51, 25, 47, 24, -19, 93, 17, 18, 57, 25, 18, +57, 47, 43, 43, 51, 57, 57, 24, 17, 18, 57, 47, -3, 50, 47, 17, 51, 47, 18, 57, 47, 57, 57, 0, 63, +-19, 51, 47, -19, 63, -19, 63, 18, 57, 47, 43, 17, 57, 47, 17, 18, 57, 47, 43, 57, 17, 51, 47, 43, 43, +51, 47, 43, 51, 47, -19, 17, 18, 57, 17, 57, 57, 49, 48, 1, 43, 43, 43, 43, 43, 93, 0, 43, 43, 43, +43, 43, 43, 1, 20, 6, 7, 38, 39, 38, 35, 34, 6, 35, 34, 39, 38, 39, 38, 53, 52, 51, 50, 23, 22, +23, 22, 1, 35, 34, 39, 38, 53, 52, 38, 53, 2, 7, 6, 7, 6, 33, 53, 36, 55, 54, 55, 54, 53, 52, +38, 39, 55, 54, 55, 22, 23, 22, 23, 22, 23, 22, 23, 22, 51, 51, 1, 20, 7, 6, 7, 7, 52, 55, 38, +39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 3, 48, +4, 8, 56, 110, 122, 70, 15, 30, 20, 27, 58, 73, 44, 59, 41, 72, -103, -85, 116, -113, 1, -98, 61, 84, 51, +61, 7, 96, 75, 89, -94, -118, -2, -76, 1, 13, -124, -43, 110, -123, 25, 22, 33, 20, 17, 26, 23, 16, 15, 19, +14, 18, 36, 24, 24, 61, -3, 11, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, 12, 11, 31, 36, +22, 43, 93, 33, 22, 19, 3, 48, 20, 28, 21, 125, -123, -109, 52, 35, 44, 58, 78, 88, 63, 91, 101, -121, -91, +-3, 87, 91, 110, -33, 16, 54, 7, -2, -11, 99, 116, 38, 32, 28, 81, 59, 94, 123, -108, -53, 98, -86, 89, 84, +49, 34, -112, -89, 115, -124, -94, 99, 126, 54, 36, -3, -45, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, +56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 0, 0, 2, 0, 83, 0, -94, 4, 14, 5, -53, 0, +68, 0, 78, 0, -32, 64, 41, 84, 8, 86, 74, 2, 60, 59, 0, 1, 2, 75, 31, 46, 55, 32, 12, 17, 52, +21, 72, 23, 7, 55, 5, 35, 14, 75, 17, -113, 35, 1, 35, 64, 9, 17, 52, 35, 35, 46, 75, 2, -72, 2, +-17, -77, 0, 0, 75, 63, -65, 2, -14, 0, 46, 2, -14, 0, 17, 2, -17, 0, 64, 0, 75, 2, -21, 64, 11, +31, 35, 42, 55, 72, 7, 75, 21, 23, 17, 64, -72, 2, -5, 64, 11, 32, 63, 63, 60, 60, 59, 1, 2, 0, +0, 59, -72, 3, 12, -78, 2, 2, 7, -70, 3, 12, 0, 23, -1, -64, 64, 9, 9, 10, 52, 23, 23, 17, 17, +42, 69, -72, 3, 3, 64, 17, 11, 64, 13, 15, 52, 11, 64, 9, 11, 52, 11, 11, 80, 64, 42, 1, 42, -72, +1, 21, -123, 47, 93, 17, 51, 47, 43, 43, -19, 17, 57, 47, 57, 47, 43, -3, 50, 47, -19, 51, 47, 18, 57, +17, 51, 47, 51, 25, 47, 26, -19, 17, 18, 57, 57, 17, 57, 57, 17, 57, 57, 0, 24, 63, 26, -19, 63, 63, +18, 57, 47, -19, 17, 18, 57, 47, 43, 93, 17, 18, 57, 17, 23, 57, 43, 18, 57, 17, 18, 57, 17, 57, 57, +49, 48, 0, 93, 1, 7, 39, 23, 20, 7, 6, 7, 22, 23, 22, 21, 20, 6, 7, 6, 6, 35, 54, 53, 54, +55, 54, 55, 38, 39, 38, 39, 38, 39, 38, 35, 34, 7, 6, 35, 34, 39, 38, 39, 38, 38, 53, 52, 55, 54, +51, 50, 23, 22, 23, 22, 23, 23, 22, 23, 54, 55, 54, 53, 39, 52, 54, 55, 23, 22, 23, 22, 22, 3, 52, +38, 39, 6, 6, 7, 50, 55, 54, 4, 14, 48, 59, 2, 34, 37, 80, 38, 15, 23, 4, 7, 106, -15, 114, 1, +5, 19, -86, 117, 70, 32, 35, 84, 31, 24, 33, 19, 13, 30, 16, 11, 22, 47, 41, 45, 36, 26, 8, 12, 29, +41, 78, 69, 85, 75, 73, 102, 45, 47, 67, 25, 22, 57, 23, 21, 23, 4, 44, 24, 75, -16, 17, 29, 30, 119, +58, 118, 50, 85, 5, 70, -76, 29, 91, -122, 126, -118, -121, 70, 40, 63, 65, 37, 52, 35, 24, 27, 19, 13, 76, +65, 91, -111, -124, 55, 60, 127, 43, 26, 35, 15, 8, 44, 39, 57, 46, 61, 43, 62, 35, 53, 78, 70, 114, 101, +117, -92, 74, 94, -121, -118, 120, -70, 33, 66, 107, 44, 6, 43, 26, 14, 36, -4, 43, 22, 47, 54, 39, 102, 36, +7, 12, 0, 0, 2, 0, 74, 0, -14, 4, -50, 5, -34, 0, 23, 0, 62, 0, -11, -71, 0, 22, -1, -32, -77, +15, 17, 52, 20, -72, -1, -32, -77, 15, 17, 52, 21, -72, -1, -42, -77, 14, 17, 52, 41, -72, -1, -42, -77, 11, +17, 52, 40, -72, -1, -32, 64, 9, 11, 17, 52, 91, 28, -119, 43, 2, 34, -72, -1, -32, 64, 45, 9, 10, 52, +43, 42, 9, 17, 52, 42, 74, 9, 17, 52, 41, 84, 9, 17, 52, 40, 64, 9, 17, 52, 7, 10, 64, 10, 17, +52, 10, 10, 18, 3, 32, 32, 48, 3, 64, 9, 24, 52, 3, 3, 62, 18, -66, 2, -14, 0, 48, 2, -17, 0, +51, 2, -14, 0, 39, 2, -5, -78, 38, 38, 62, -70, 2, -17, 0, 25, 2, -21, -77, 7, 10, 0, 3, -72, -1, +-64, -77, 24, 32, 52, 3, -72, -1, -64, 64, 13, 10, 15, 52, 3, 3, 16, 32, 55, 45, 11, 48, 1, 48, -72, +3, 16, -78, 51, 51, 45, -72, 3, 16, -78, 55, 55, 24, -72, 2, -16, -77, 64, 38, 38, 16, -72, 1, 29, -123, +47, 51, 47, 16, -11, 50, 47, -19, 51, 25, 47, 24, -19, 93, 17, 18, 57, 25, 18, 57, 47, 43, 43, 51, 57, +57, 0, 24, 63, -19, 51, 47, -19, 63, -19, 63, 18, 57, 47, 43, 17, 57, 47, 17, 18, 57, 47, 43, 57, 49, +48, 1, 43, 43, 43, 43, 43, 93, 0, 43, 43, 43, 43, 43, 1, 20, 6, 7, 38, 39, 38, 35, 34, 6, 35, +34, 39, 38, 39, 38, 53, 52, 51, 50, 23, 22, 23, 22, 1, 35, 34, 39, 38, 53, 52, 38, 53, 2, 7, 6, +7, 6, 33, 53, 36, 55, 54, 55, 54, 53, 52, 38, 39, 55, 54, 55, 22, 23, 22, 23, 22, 23, 22, 23, 22, +51, 51, 3, 48, 4, 8, 56, 110, 122, 70, 15, 30, 20, 27, 58, 73, 44, 59, 41, 72, -103, -85, 116, -113, 1, +-98, 61, 84, 51, 61, 7, 96, 75, 89, -94, -118, -2, -76, 1, 13, -124, -43, 110, -123, 25, 22, 33, 20, 17, 26, +23, 16, 15, 19, 14, 18, 36, 24, 24, 61, 3, 48, 20, 28, 21, 125, -123, -109, 52, 35, 44, 58, 78, 88, 63, +91, 101, -121, -91, -3, 87, 91, 110, -33, 16, 54, 7, -2, -11, 99, 116, 38, 32, 28, 81, 59, 94, 123, -108, -53, +98, -86, 89, 84, 49, 34, -112, -89, 115, -124, -94, 99, 126, 54, 36, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +-1, -1, 0, 70, 5, 98, 1, -100, 6, 49, 0, 22, 2, -12, 0, 0, -1, -1, 0, 70, 4, -41, 1, -100, 6, +61, 0, 22, 2, -15, 0, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, +4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, -1, -1, 0, 70, 4, -41, 1, 81, 6, 13, 0, 22, 2, -8, 0, 0, -1, +-1, 0, 70, 4, -41, 1, -79, 6, 25, 0, 22, 2, -9, 0, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, -1, +-1, 0, 72, 4, -41, 1, -83, 6, -118, 0, 22, 2, -11, 0, 0, -1, -1, 0, 70, 4, -41, 1, -27, 6, 90, +0, 22, 2, -14, 0, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, +17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, +1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, +0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, -1, -1, 0, 70, 4, -41, 1, -79, 6, -71, 0, 22, 3, 73, 0, 0, -1, -1, +0, 70, 4, -41, 1, -79, 7, 87, 0, 22, 3, 18, 0, 0, -1, -1, 0, 70, 4, -41, 1, -79, 6, -45, 0, +22, 3, 75, 0, 0, -1, -1, 0, 70, 4, -41, 1, -79, 7, 61, 0, 22, 3, 72, 0, 0, -1, -1, 0, 64, +4, -39, 1, -79, 7, 46, 0, 22, 3, 74, 0, 0, -1, -1, 0, 48, 4, -41, 1, -49, 7, 119, 0, 22, 3, +71, 0, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, -1, -1, 0, 70, -1, +-43, 1, -100, 0, -92, 0, 22, 2, -10, 0, 0, -1, -1, 0, 70, -2, -10, 1, -100, 0, 91, 0, 22, 2, -13, +0, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, +0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, +3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, +7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, +32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, +33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, +0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, +32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, +0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, +0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, +37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, +0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, +-4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, +3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, +-5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, +17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, +1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, +0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, +4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, +0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, +0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, +-64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, +0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, +3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, +7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, +32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, +33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, +0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, +32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, +0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, +0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, +37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, +0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, +-4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, +3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, +-5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, +17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, +1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, +0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, +4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, +0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, +0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, +-64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 0, -54, 1, +24, 1, -55, 5, -73, 0, 18, 0, 30, 0, 62, -71, 0, 16, 2, -14, -73, 7, 64, 9, 10, 52, 7, 7, 28, +-68, 2, -18, 0, 22, 2, -20, 0, 6, 2, -15, -76, 7, 7, 19, 25, 0, -72, 2, -19, -78, 13, 13, 19, -71, +2, -19, 0, 25, 47, -19, 51, 47, -19, 17, 18, 57, 47, -19, 0, 63, -3, 50, 47, 43, 63, 49, 48, 1, 20, +7, 6, 7, 6, 21, 35, 52, 39, 38, 39, 38, 53, 52, 54, 51, 50, 22, 3, 20, 6, 35, 34, 38, 53, 52, +54, 51, 50, 22, 1, -55, 26, 43, 5, 26, 57, 25, 10, 37, 26, 70, 55, 57, 73, 6, 72, 52, 50, 72, 72, +52, 50, 72, 5, 29, 67, 118, -61, 28, -110, -120, 126, -103, 58, -74, 126, 45, 61, 93, 92, -4, 55, 50, 72, 72, +50, 51, 74, 74, 0, 0, 1, 0, -57, 1, 24, 1, -49, 2, 34, 0, 11, 0, 22, -66, 0, 9, 2, -18, 0, +3, 2, -20, 0, 0, 2, -19, 0, 6, 47, -19, 0, 63, -19, 49, 48, 1, 20, 6, 35, 34, 38, 53, 52, 54, +51, 50, 22, 1, -49, 79, 55, 54, 76, 77, 53, 56, 78, 1, -99, 54, 79, 78, 55, 54, 79, 78, 0, 0, 2, +0, -58, 1, 24, 1, -51, 4, 87, 0, 11, 0, 23, 0, 42, -71, 0, 9, 2, -18, -78, 3, 3, 21, -68, 2, +-18, 0, 15, 2, -20, 0, 0, 2, -19, -78, 6, 6, 12, -71, 2, -19, 0, 18, 47, -19, 51, 47, -19, 0, 63, +-3, 50, 47, -19, 49, 48, 1, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 17, 20, 6, 35, 34, 38, 53, +52, 54, 51, 50, 22, 1, -51, 78, 56, 53, 76, 74, 55, 56, 78, 79, 55, 53, 76, 75, 54, 56, 78, 3, -46, +56, 78, 78, 56, 55, 78, 78, -3, -108, 54, 79, 78, 55, 54, 79, 78, 0, 2, 1, 0, 0, 0, 5, 0, 5, +0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, +5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, +17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, +0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, +0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, +5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, +64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, +33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, +0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, +1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, +0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, +-4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, +0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, +-64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, +33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, +5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, +-64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, +0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, +4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, +17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, +0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, +3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, +7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, +32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, +33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, +0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, +32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, +0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, +0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, +37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, +0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, +-4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, +3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, +-5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, +17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, +1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, +0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, +0, 3, 0, 7, 0, 0, 33, 17, 33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, +0, -5, 0, 32, 4, -64, 0, 0, 2, 1, 0, 0, 0, 5, 0, 5, 0, 0, 3, 0, 7, 0, 0, 33, 17, +33, 17, 37, 33, 17, 33, 1, 0, 4, 0, -4, 32, 3, -64, -4, 64, 5, 0, -5, 0, 32, 4, -64, 0, 0, +1, -1, -70, 1, 37, 1, 0, 1, -45, 0, 3, 0, 24, -67, 0, 2, 2, -17, 0, 1, 2, -21, 0, 0, 2, +-16, -79, 5, 1, 47, 16, -27, 0, 63, -19, 49, 48, 1, 33, 53, 33, 1, 0, -2, -70, 1, 70, 1, 37, -82, +0, 0, 1, -1, -70, 1, 37, 8, 0, 1, -45, 0, 3, 0, 24, -67, 0, 2, 2, -17, 0, 1, 2, -21, 0, +0, 2, -16, -79, 5, 1, 47, 16, -27, 0, 63, -19, 49, 48, 1, 33, 53, 33, 8, 0, -9, -70, 8, 70, 1, +37, -82, 0, 0, 1, -1, -70, 1, 37, 16, 0, 1, -45, 0, 3, 0, 24, -67, 0, 2, 2, -17, 0, 1, 2, +-21, 0, 0, 2, -16, -79, 5, 1, 47, 16, -27, 0, 63, -19, 49, 48, 1, 33, 53, 33, 16, 0, -17, -70, 16, +70, 1, 37, -82, 0, 0, 2, 0, 99, -1, -25, 6, -84, 5, -44, 0, 15, 0, 44, 1, 1, -75, 27, 16, 13, +14, 52, 39, -72, -1, -32, 64, 19, 16, 17, 52, 39, 32, 9, 10, 52, 10, 32, 9, 14, 52, 6, 32, 9, 14, +52, 2, -72, -1, -32, -77, 9, 14, 52, 14, -72, -1, -32, 64, 70, 9, 14, 52, 40, 16, 23, 23, 12, 4, 16, +30, 17, 3, 12, 30, 37, 3, 4, 30, 29, 9, 23, 40, 25, 8, 44, 44, 18, 38, 17, 26, 16, 16, 2, 85, +17, 35, 11, 11, 6, 85, 17, 28, 12, 12, 6, 85, 17, 22, 13, 13, 6, 85, 17, 12, 15, 15, 6, 85, 17, +56, 16, 16, 6, 85, 17, 17, 8, 38, 25, -72, -1, -26, -76, 16, 16, 2, 85, 25, -72, -1, -32, -76, 13, 13, +2, 85, 25, -72, -1, -34, -76, 12, 12, 2, 85, 25, -72, -1, -32, -76, 11, 11, 6, 85, 25, -72, -1, -28, -76, +12, 12, 6, 85, 25, -72, -1, -24, -76, 13, 13, 6, 85, 25, -72, -1, -46, -76, 16, 16, 6, 85, 25, -72, -1, +-64, 64, 21, 11, 13, 52, 0, 25, 1, 25, 0, 38, 33, 8, 11, 11, 6, 85, 32, 33, 1, 33, 99, 45, 16, +-10, 93, 43, -19, 47, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, 51, 47, 43, 43, 43, 43, 43, 43, -19, 57, +47, 17, 18, 57, 57, 0, 63, -19, 63, -19, 63, -19, 17, 18, 57, 47, 18, 57, 49, 48, 1, 43, 43, 43, 43, +43, 43, 43, 1, 16, 23, 22, 51, 50, 55, 54, 17, 16, 39, 38, 35, 34, 7, 6, 37, 53, 51, 21, 20, 7, +6, 7, 22, 21, 20, 2, 4, 35, 34, 36, 2, 53, 16, 55, 54, 33, 50, 4, 23, 54, 55, 54, 39, 1, 43, +-113, -118, -37, -32, -119, -115, -19, 117, -111, -33, -125, -107, 4, -64, -63, 38, 52, -113, 26, -75, -2, -73, -65, -50, -2, +-71, -88, -60, -65, 1, 59, -29, 1, 95, 73, 91, 37, 30, 1, 2, -57, -2, -4, -98, -104, -102, -96, 1, 21, 1, +114, -106, 73, -115, -96, -7, -47, -91, 124, 66, 91, 76, 108, 121, -32, -2, -95, -75, -57, 1, 91, -63, 1, 104, -44, +-50, -9, -48, 49, 56, 45, 86, 0, 2, 0, 68, -1, -24, 5, 0, 4, 64, 0, 15, 0, 44, 1, 19, 64, 14, +89, 39, 1, 6, 32, 12, 14, 52, 10, 32, 12, 14, 52, 2, -72, -1, -32, -77, 12, 14, 52, 14, -72, -1, -32, +64, 52, 12, 14, 52, 41, 16, 23, 23, 12, 4, 16, 28, 17, 7, 12, 28, 37, 7, 4, 28, 29, 11, 23, 40, +25, 8, 44, 44, 18, 38, 17, 32, 16, 16, 6, 85, 17, 48, 15, 15, 6, 85, 17, 18, 11, 13, 6, 85, 17, +17, 8, 36, 25, -72, -1, -26, 64, 17, 15, 15, 2, 85, 25, 24, 13, 13, 2, 85, 25, 16, 11, 11, 2, 85, +25, -72, -1, -15, -76, 16, 16, 6, 85, 25, -72, -1, -45, -76, 15, 15, 6, 85, 25, -72, -1, -42, -76, 13, 13, +6, 85, 25, -72, -1, -8, 64, 48, 11, 12, 6, 85, 0, 25, 32, 25, 2, 25, 0, 36, 0, 64, 36, 37, 52, +33, 12, 14, 15, 2, 85, 33, 18, 13, 13, 2, 85, 33, 12, 12, 12, 2, 85, 33, 28, 11, 11, 2, 85, 33, +8, 16, 16, 6, 85, 33, -72, -1, -4, 64, 30, 15, 15, 6, 85, 33, 8, 13, 13, 6, 85, 33, 22, 12, 12, +6, 85, 33, 14, 11, 11, 6, 85, 31, 33, 63, 33, 2, 33, 49, 45, 16, -10, 93, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, -19, 47, 93, 43, 43, 43, 43, 43, 43, 43, -19, 51, 47, 43, 43, 43, -19, 57, 47, 17, 18, +57, 57, 0, 63, -19, 63, -19, 63, -19, 17, 18, 57, 47, 18, 57, 49, 48, 1, 43, 43, 43, 43, 93, 19, 20, +23, 22, 51, 50, 55, 54, 53, 52, 39, 38, 35, 34, 7, 6, 37, 53, 51, 21, 20, 7, 6, 7, 20, 21, 16, +7, 6, 35, 34, 39, 38, 17, 16, 55, 54, 51, 50, 23, 22, 23, 54, 54, 39, -3, 89, 84, -116, -116, 83, 89, +90, 84, -118, -115, 83, 89, 3, 66, -63, 38, 49, -126, -16, 118, -117, -28, -123, -119, -92, -119, -59, -37, -117, 105, 26, +68, 59, 1, 2, 19, -59, 108, 102, 102, 109, -54, -65, 107, 102, 101, 108, -105, -47, -91, 124, 66, 86, 72, 14, 15, +-2, -116, -123, 65, -113, -108, 1, 8, 1, 39, -114, 118, -113, 109, -84, 42, 90, 85, 0, 0, 1, 0, -95, -1, -25, +6, -126, 5, -70, 0, 37, 1, 37, -75, 15, 52, 12, 14, 52, 12, -72, -1, -32, 64, 19, 12, 14, 52, 38, 24, +1, 33, 7, 7, 26, 0, 28, 1, 2, 31, 2, 19, 2, 26, -72, 2, -69, 64, 54, 14, 9, 37, 37, 2, 14, +9, 13, 2, 85, 2, 38, 1, 18, 10, 10, 2, 85, 1, 68, 11, 11, 6, 85, 1, 8, 12, 12, 6, 85, 1, +30, 13, 13, 6, 85, 1, 68, 15, 15, 6, 85, 1, 68, 16, 16, 6, 85, 1, 1, 30, 38, 32, 8, -72, -1, +-20, -76, 15, 15, 2, 85, 8, -72, -1, -18, 64, 11, 13, 13, 2, 85, 8, 16, 12, 12, 2, 85, 8, -72, -1, +-59, 64, 11, 11, 11, 6, 85, 8, 28, 12, 12, 6, 85, 8, -72, -1, -15, -76, 13, 13, 6, 85, 8, -72, -1, +-45, -76, 15, 15, 6, 85, 8, -72, -1, -45, 64, 14, 16, 16, 6, 85, 8, 21, 38, 18, 32, 16, 16, 2, 85, +18, -72, -1, -10, -76, 15, 15, 2, 85, 18, -72, -1, -10, -76, 13, 13, 2, 85, 18, -72, -1, -6, -76, 12, 12, +2, 85, 18, -72, -1, -6, -76, 12, 12, 6, 85, 18, -72, -1, -10, -76, 13, 13, 6, 85, 18, -72, -1, -15, -76, +15, 15, 6, 85, 18, -72, -1, -8, -76, 16, 16, 6, 85, 18, -72, -1, -64, -75, 19, 21, 52, 18, 93, 38, 16, +-10, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 47, 43, 43, 43, 43, 43, 43, 43, 43, 60, -19, 51, 47, 43, +43, 43, 43, 43, 43, -19, 43, 57, 47, 0, 63, -19, 63, 63, 63, -19, 17, 57, 47, 57, 49, 48, 1, 93, 43, +43, 1, 53, 51, 21, 20, 7, 6, 7, 17, 20, 7, 6, 7, 6, 35, 32, 3, 38, 53, 17, 51, 17, 20, 23, +22, 22, 51, 50, 55, 54, 17, 17, 51, 17, 54, 55, 54, 53, 5, -63, -63, 36, 99, -39, 50, 52, -128, -125, -44, +-2, 103, 115, 56, -62, 36, 34, -82, 125, -37, 86, 91, -62, -100, 70, 27, 4, -23, -47, -91, -99, 62, -83, 10, -2, +-24, -31, 126, -125, 80, 82, 1, 21, -122, -23, 3, 79, -4, -78, -67, 93, 89, 99, 97, 102, 1, 15, 3, 78, -2, +19, 16, 108, 42, 118, 0, 0, 1, 0, -125, -1, -24, 5, 29, 4, 38, 0, 36, 1, 28, -75, 27, 16, 11, 13, +52, 24, -72, -1, -32, 64, 83, 16, 17, 52, 14, 32, 9, 10, 52, 10, 19, 25, 32, 7, 7, 25, 0, 28, 1, +6, 30, 6, 19, 6, 9, 10, 25, 28, 12, 36, 36, 2, 38, 1, 30, 11, 11, 6, 85, 1, 20, 12, 12, 6, +85, 1, 45, 13, 13, 6, 85, 1, 12, 15, 15, 6, 85, 1, 32, 16, 16, 6, 85, 1, 1, 8, 9, 51, 29, +37, 31, 8, 44, 16, 16, 2, 85, 8, 18, 14, 14, 2, 85, 8, -72, -1, -16, 64, 11, 13, 13, 2, 85, 8, +10, 12, 12, 2, 85, 8, -72, -1, -12, 64, 11, 11, 11, 6, 85, 8, 10, 12, 12, 6, 85, 8, -72, -1, -30, +-76, 13, 13, 6, 85, 8, -72, -1, -34, -73, 16, 16, 6, 85, 8, 21, 37, 18, -72, -1, -8, -76, 16, 16, 2, +85, 18, -72, -1, -8, 64, 23, 14, 14, 2, 85, 18, 4, 12, 12, 2, 85, 18, 10, 11, 11, 6, 85, 18, 4, +12, 12, 6, 85, 18, -72, -1, -4, -76, 13, 13, 6, 85, 18, -72, -1, -14, -76, 15, 16, 6, 85, 18, -72, -1, +-64, 64, 18, 51, 54, 52, -16, 18, 1, 0, 18, 32, 18, -48, 18, -32, 18, 4, 18, 78, 37, 16, -10, 93, 113, +43, 43, 43, 43, 43, 43, 43, 43, -19, 47, 43, 43, 43, 43, 43, 43, 43, 43, 60, -3, -28, 17, 51, 47, 43, +43, 43, 43, 43, -19, 57, 47, 0, 47, -19, 63, 63, 63, 63, -19, 17, 57, 47, 57, 17, 18, 57, 49, 48, 1, +43, 43, 0, 43, 1, 53, 51, 21, 20, 7, 6, 7, 17, 35, 53, 6, 35, 34, 38, 38, 39, 38, 53, 17, 51, +17, 20, 23, 22, 51, 50, 54, 54, 53, 17, 51, 17, 54, 55, 54, 53, 4, 92, -63, 36, 92, -67, -95, 124, -43, +93, -93, 80, 16, 11, -76, 11, 35, -83, 83, -115, 58, -76, 127, 63, 28, 3, 85, -47, -91, -99, 62, -96, 20, -2, +14, -100, -76, 71, 110, 79, 54, 114, 2, -110, -3, -77, -113, 47, -104, 84, -114, -120, 2, 57, -2, 24, 22, 97, 42, +118, 0, 0, 1, -3, -36, 6, -115, -1, 69, 7, 43, 0, 3, 0, 44, -73, 1, 32, 14, 17, 52, 1, -128, 2, +-70, 3, 23, 0, 0, 2, 83, -73, 1, -122, 64, 3, -48, 3, 2, 3, -71, 2, 96, 0, 2, 47, -19, 93, -3, +-19, 0, 125, 63, 26, -51, 49, 48, 1, 43, 3, 35, 39, 51, -69, -126, -25, -30, 6, -115, -98, 0, 0, 1, -4, +47, 6, -115, -3, -104, 7, 43, 0, 3, 0, 44, -73, 1, 32, 14, 17, 52, 1, -128, 2, -70, 3, 23, 0, 0, +2, 83, -73, 1, -122, 64, 3, -48, 3, 2, 3, -71, 2, 96, 0, 2, 47, -19, 93, -3, -19, 0, 125, 63, 26, +-51, 49, 48, 1, 43, 1, 35, 39, 51, -3, -104, -126, -25, -30, 6, -115, -98, 0, 1, -4, -90, 6, 11, -2, 30, +7, 35, 0, 3, 0, 83, -75, 1, 32, 14, 17, 52, 1, -72, -1, -64, 64, 31, 9, 10, 52, 1, -121, 31, 2, +47, 2, 2, 31, 2, 47, 2, -113, 2, -97, 2, 4, -81, 2, -65, 2, 2, 2, 64, 9, 16, 52, 2, 0, -72, +2, 83, -73, 1, -122, 64, 3, -48, 3, 2, 3, -72, 2, 96, -75, 112, 2, -80, 2, 2, 2, 47, 93, -19, 93, +-3, -19, 0, 47, 43, 93, 113, 114, -19, 43, 49, 48, 1, 43, 1, 35, 3, 51, -2, 30, -111, -25, -15, 6, 11, +1, 24, 0, 1, -2, 84, 6, -115, -1, -67, 7, 43, 0, 3, 0, 65, -71, 0, 2, -1, -32, -77, 14, 17, 52, +1, -72, -1, -32, -75, 14, 17, 52, 2, -128, 0, -70, 3, 23, 0, 3, -1, -12, -77, 9, 18, 52, 3, -72, 2, +83, -73, 2, -122, 79, 0, -33, 0, 2, 0, -71, 2, 96, 0, 1, 47, -19, 93, -3, -19, 43, 0, 125, 63, 26, +-51, 49, 48, 1, 43, 43, 1, 51, 7, 35, -2, -37, -30, -25, -126, 7, 43, -98, 0, 0, 1, -4, -41, 6, -115, +-2, 64, 7, 43, 0, 3, 0, 56, -71, 0, 2, -1, -32, -75, 14, 17, 52, 2, -128, 0, -70, 3, 23, 0, 3, +-1, -12, -77, 9, 18, 52, 3, -72, 2, 83, -73, 2, -122, 79, 0, -33, 0, 2, 0, -71, 2, 96, 0, 1, 47, +-19, 93, -3, -19, 43, 0, 125, 63, 26, -51, 49, 48, 1, 43, 1, 51, 7, 35, -3, 94, -30, -25, -126, 7, 43, +-98, 0, 1, -3, 115, 6, 11, -2, -21, 7, 35, 0, 3, 0, 84, -77, -103, 2, 1, 2, -72, -1, -32, -77, 14, +17, 52, 2, -72, -1, -64, 64, 31, 9, 10, 52, 2, -121, 31, 1, 47, 1, 2, 31, 1, 47, 1, -113, 1, -97, +1, 4, -81, 1, -65, 1, 2, 1, 64, 9, 16, 52, 1, 3, -72, 2, 83, -73, 2, -122, 79, 0, -33, 0, 2, +0, -71, 2, 96, 0, 1, 47, -19, 93, -3, -19, 0, 47, 43, 93, 113, 114, -19, 43, 49, 48, 1, 43, 93, 1, +51, 3, 35, -3, -6, -15, -25, -111, 7, 35, -2, -24, 0, 0, 1, -2, 41, 5, -24, -1, -34, 7, 44, 0, 21, +0, -117, -71, 0, 17, -1, -64, 64, 9, 9, 24, 52, 10, 12, 9, 7, 21, 18, -72, -1, -64, 64, 14, 18, 24, +52, 18, -112, 20, 1, 127, 20, 1, -112, 20, 1, 20, -72, -1, -64, -77, 9, 12, 52, 20, -72, -1, -64, -77, 25, +37, 52, 20, -72, -1, -64, 64, 10, 55, 57, 52, 20, 64, 83, 90, 52, 20, 7, -70, 3, 22, 0, 12, 3, 23, +64, 12, 16, -55, 3, 3, 19, 9, 20, 10, 10, 19, 87, 20, -72, -1, -64, 64, 9, 11, 13, 52, 0, 20, 112, +20, 2, 20, 47, 93, 43, -19, 51, 47, 18, 57, 17, 51, 47, -19, 0, 125, 63, 24, -19, 125, -44, 43, 43, 43, +43, 93, 113, 114, 24, -35, 43, -51, 17, 57, 18, 57, 49, 48, 1, 43, 0, 55, 54, 55, 54, 39, 38, 35, 34, +7, 39, 54, 23, 22, 23, 22, 23, 22, 7, 21, 35, 53, -2, -19, 16, 53, 1, 1, 29, 42, 91, 31, 63, 11, +39, 105, 123, 78, 86, 2, 4, -70, 112, 6, 94, 5, 13, 28, 23, 16, 23, 4, 94, 8, 1, 1, 39, 42, 67, +101, 23, 50, 112, 0, 1, -2, 13, 6, 109, -1, -95, 7, 44, 0, 20, 0, -128, -71, 0, 16, -1, -64, 64, 42, +9, 32, 52, 11, 13, 10, 7, 17, 17, 20, 64, 19, 64, 124, -118, 52, 19, 64, 82, 85, 52, 19, 64, 75, 76, +52, 19, 64, 60, 62, 52, 19, 64, 38, 54, 52, 16, 19, 1, 19, -128, 7, -68, 1, -113, 0, 13, 3, 23, 0, +15, -1, -64, 64, 15, 22, 24, 52, 15, -8, 3, 3, 18, 10, 19, 11, 11, 18, -112, 19, 47, -19, 51, 47, 18, +57, 17, 51, 47, -19, 43, 0, 125, 63, 24, -19, 26, -36, 113, 43, 43, 43, 43, 43, 26, -51, 57, 47, 17, 57, +18, 57, -79, 6, 2, 67, 84, 88, -76, 17, 64, 9, 25, 52, 0, 43, 89, 49, 48, 1, 43, 0, 55, 54, 55, +54, 39, 38, 35, 34, 6, 7, 39, 54, 23, 4, 23, 22, 7, 21, 35, 53, -2, -65, 18, 49, 1, 1, 27, 39, +84, 8, 60, 18, 11, 36, 98, 1, 6, 5, 3, -84, 93, 6, -90, 4, 11, 22, 13, 9, 13, 5, 3, 65, 5, +1, 1, 90, 63, 14, 22, 55, 0, 0, 1, -3, 17, 5, -24, -2, -58, 7, 44, 0, 21, 0, -117, -71, 0, 17, +-1, -64, 64, 9, 9, 24, 52, 10, 12, 9, 7, 21, 18, -72, -1, -64, 64, 14, 18, 24, 52, 18, -112, 20, 1, +127, 20, 1, -112, 20, 1, 20, -72, -1, -64, -77, 9, 12, 52, 20, -72, -1, -64, -77, 25, 37, 52, 20, -72, -1, +-64, 64, 10, 55, 57, 52, 20, 64, 83, 90, 52, 20, 7, -70, 3, 22, 0, 12, 3, 23, 64, 12, 16, -55, 3, +3, 19, 9, 20, 10, 10, 19, 87, 20, -72, -1, -64, 64, 9, 11, 13, 52, 0, 20, 112, 20, 2, 20, 47, 93, +43, -19, 51, 47, 18, 57, 17, 51, 47, -19, 0, 125, 63, 24, -19, 125, -44, 43, 43, 43, 43, 93, 113, 114, 24, +-35, 43, -51, 17, 57, 18, 57, 49, 48, 1, 43, 0, 55, 54, 55, 54, 39, 38, 35, 34, 7, 39, 54, 23, 22, +23, 22, 23, 22, 7, 21, 35, 53, -3, -43, 16, 53, 1, 1, 29, 42, 91, 31, 63, 11, 39, 105, 123, 78, 86, +2, 4, -70, 112, 6, 94, 5, 13, 28, 23, 16, 23, 4, 94, 8, 1, 1, 39, 42, 75, 93, 23, 50, 112, 0, +1, -4, 103, 6, 109, -3, -5, 7, 44, 0, 20, 0, -128, -71, 0, 16, -1, -64, 64, 42, 9, 32, 52, 11, 13, +10, 7, 17, 17, 20, 64, 19, 64, 124, -118, 52, 19, 64, 82, 85, 52, 19, 64, 75, 76, 52, 19, 64, 60, 62, +52, 19, 64, 38, 54, 52, 16, 19, 1, 19, -128, 7, -68, 1, -113, 0, 13, 3, 23, 0, 15, -1, -64, 64, 15, +22, 24, 52, 15, -8, 3, 3, 18, 10, 19, 11, 11, 18, -112, 19, 47, -19, 51, 47, 18, 57, 17, 51, 47, -19, +43, 0, 125, 63, 24, -19, 26, -36, 113, 43, 43, 43, 43, 43, 26, -51, 57, 47, 17, 57, 18, 57, -79, 6, 2, +67, 84, 88, -76, 17, 64, 9, 25, 52, 0, 43, 89, 49, 48, 1, 43, 0, 55, 54, 55, 54, 39, 38, 35, 34, +6, 7, 39, 54, 23, 4, 23, 22, 7, 21, 35, 53, -3, 25, 18, 49, 1, 1, 27, 39, 84, 8, 60, 18, 11, +36, 98, 1, 6, 5, 3, -84, 93, 6, -90, 4, 11, 22, 13, 9, 13, 5, 3, 65, 5, 1, 1, 90, 63, 14, +22, 55, 0, 0, 1, -3, -99, 6, 73, 0, 59, 7, 48, 0, 18, 0, 95, -75, 14, 32, 9, 17, 52, 11, -72, +-1, -32, 64, 55, 9, 19, 52, 2, 32, 9, 17, 52, 0, 0, -17, 12, 1, 12, 69, 7, 7, -17, 16, 1, 16, +69, 3, 3, 31, 9, -33, 9, 2, -113, 9, 1, 9, 64, 9, 16, 52, 63, 9, -65, 9, 2, 9, 10, 118, 9, +9, 0, 118, 64, 18, 111, 18, 2, 18, 47, 93, -19, 51, 47, -19, 0, 47, 93, 43, 113, 114, 51, 47, -19, 93, +57, 47, -19, 93, 50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, +34, 39, 38, 35, 34, 23, -3, -98, 1, 113, 91, 62, 107, 59, 35, 61, 12, -126, 6, -66, 63, 103, 67, 31, 78, +2, 6, 73, 102, 126, 54, 30, 87, -28, 56, 36, 95, 0, 0, 1, -5, -11, 6, 124, -2, -109, 7, 43, 0, 18, +0, -39, -77, 75, 14, 1, 11, -72, -1, -32, 64, 11, 10, 19, 52, 2, 32, 10, 17, 52, 0, 0, 7, -72, 3, +22, 64, 31, 64, 12, 64, 94, 53, 12, 64, 79, 83, 52, 12, 64, 67, 69, 52, 12, 64, 43, 45, 52, 111, 12, +127, 12, 2, 15, 12, 1, 12, -128, 16, -72, 3, 22, 64, 97, 3, 3, 15, 9, -17, 9, 2, 31, 9, 47, 9, +79, 9, 95, 9, -113, 9, -97, 9, 6, 15, 9, 95, 9, 111, 9, 127, 9, -65, 9, -16, 9, 6, 9, 64, -117, +53, 9, 64, 106, 108, 52, 9, 64, 97, 53, 9, 64, 92, 93, 52, 9, 64, 87, 89, 52, 9, 64, 77, 81, 52, +9, 64, 68, 73, 52, 9, 64, 58, 53, 9, 64, 49, 52, 52, 9, 64, 46, 66, 52, 9, 64, 39, 44, 52, 9, +64, 18, 37, 52, 9, -128, 10, 13, 52, 9, 10, -72, 3, 22, -78, 9, 9, 0, -71, 3, 22, 0, 18, 47, -19, +51, 47, -19, 0, 125, 47, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 51, 24, 47, +-19, 26, -35, 93, 113, 43, 43, 43, 43, 26, -19, 51, 47, 49, 48, 1, 43, 43, 93, 1, 38, 54, 51, 50, 23, +22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -5, -10, 1, 113, 91, 62, 107, 59, 68, 61, 12, 97, +6, -66, 63, 103, 67, 67, 78, 2, 6, 124, 82, 91, 44, 24, 70, -84, 44, 29, 76, 0, 0, 1, -4, 114, 6, +11, -1, 16, 6, -14, 0, 18, 0, 115, -75, 14, 32, 9, 17, 52, 11, -72, -1, -32, 64, 16, 9, 19, 52, 2, +32, 9, 17, 52, 0, 0, -17, 12, 1, 12, 69, 7, -72, -1, -64, 64, 52, 33, 38, 52, 7, 7, -17, 16, 1, +16, 69, 3, 3, 31, 9, 47, 9, 63, 9, 3, 47, 9, -113, 9, 2, 9, 64, 9, 16, 52, 9, 64, 54, 62, +52, 63, 9, -65, 9, 2, 9, 10, 118, 9, 9, 0, 118, 64, 18, 111, 18, 2, 18, 47, 93, -19, 51, 47, -19, +0, 47, 93, 43, 43, 113, 114, 51, 47, -19, 93, 57, 47, 43, -19, 93, 50, 47, 49, 48, 1, 43, 43, 43, 1, +38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -4, 115, 1, 113, 91, 62, 107, +59, 35, 61, 12, -126, 6, -66, 63, 103, 67, 31, 78, 2, 6, 11, 102, 126, 54, 30, 87, -28, 56, 36, 95, 0, +0, 1, -2, -43, 5, -44, 1, 28, 6, 102, 0, 19, 0, 61, -71, 0, 10, -1, -16, -77, 22, 31, 52, 4, -72, +-1, -16, -76, 22, 31, 52, 11, 2, -72, -1, -64, 64, 19, 35, 40, 52, 2, -128, -16, 7, 1, 7, -128, 16, 3, +12, -128, 11, 11, 2, -128, 3, 47, -19, 51, 47, -19, 0, 63, -19, 113, 26, -35, 43, -64, 49, 48, 0, 43, 43, +3, 38, 39, 51, 22, 23, 22, 51, 50, 55, 54, 55, 51, 6, 7, 6, 35, 34, 39, 38, -4, 30, 17, 78, 24, +59, 64, 65, 67, 64, 59, 24, 79, 31, 73, 77, 112, 35, 31, 118, 6, 35, 30, 37, 29, 19, 20, 20, 18, 30, +72, 36, 38, 4, 14, 0, 1, -2, -43, 5, -44, 1, 57, 6, 79, 0, 6, 0, 57, 64, 17, 0, 3, 6, 15, +3, 1, 3, -128, 2, 3, 3, 4, 0, 3, 1, 5, 6, -72, -1, -64, -77, 20, 24, 52, 6, -72, -1, -64, -75, +12, 17, 52, 6, 2, 1, 47, -51, -42, 43, 43, -51, 18, 23, 57, 0, 63, 26, -51, 114, -64, 18, 57, 49, 48, +1, 19, 7, 35, 55, 51, 23, 35, 7, -125, -81, -47, -61, -48, -81, 6, 23, 67, 123, 123, 0, 1, -1, 2, -2, +-69, -1, -49, -1, -120, 0, 3, 0, 40, 64, 19, 0, 60, 80, 1, -112, 1, -48, 1, 3, 0, 1, 1, 1, 3, +60, 64, 0, 1, 0, -72, -1, -64, -77, 9, 10, 52, 0, 47, 43, 113, -19, 0, 47, 113, 114, -19, 49, 48, 3, +53, 51, 21, -2, -51, -2, -69, -51, -51, 0, 3, 0, -96, 0, -10, 3, -119, 5, -70, 0, 24, 0, 36, 0, 40, +0, -92, 64, 21, -113, 16, -128, 20, 2, -119, 12, -122, 24, 2, 7, 2, 46, 8, 1, 1, 4, 22, 38, 46, 39, +-72, -1, -64, 64, 23, 9, 11, 52, 39, 39, 14, 24, 12, 34, 11, 11, 28, -111, 14, 64, 10, 12, 52, 14, 14, +34, -111, 22, -72, -1, -64, 64, 14, 10, 12, 52, 22, 22, 4, 2, 31, 0, 11, 11, 10, 0, 2, -72, -1, -64, +64, 12, 10, 22, 52, 2, 2, 4, 25, 7, 37, 37, 4, 0, -72, 2, -114, 64, 10, 5, 32, 10, 1, 10, 10, +42, 38, 38, 25, -71, 2, -114, 0, 18, 47, -19, 51, 47, 17, 51, 47, 93, 60, -3, 60, 51, 47, 60, 17, 18, +57, 47, 43, 17, 18, 57, 47, 18, 57, 0, 63, 51, 47, 43, -19, 51, 47, 43, -19, 57, 47, 17, 57, 57, 17, +51, 47, 43, -19, 17, 18, 57, 47, 60, -3, 60, 49, 48, 0, 93, 93, 1, 35, 53, 51, 53, 51, 21, 51, 21, +35, 17, 35, 53, 6, 35, 34, 39, 38, 53, 52, 55, 54, 51, 50, 23, 1, 20, 22, 51, 50, 54, 53, 52, 38, +35, 34, 6, 1, 33, 53, 33, 2, -90, 94, 94, 125, 102, 102, 116, 71, -119, -65, 87, 41, -108, 74, 92, -126, 74, +-2, 123, 111, 91, 91, 107, 109, 95, 92, 104, 2, 104, -3, 23, 2, -23, 5, 13, 92, 81, 81, 92, -4, -83, 93, +111, -69, 87, 114, -12, 96, 49, 103, -2, -30, -126, -102, -109, 126, -116, -100, -106, -3, 67, 91, 0, 3, 0, 107, -1, +-57, 6, -106, 5, -45, 0, 3, 0, 12, 0, 48, 0, -79, 64, 21, 2, 3, 3, 63, 0, 1, 20, 0, 0, 1, +34, 33, 33, 31, 27, 13, 14, 14, 18, 41, 27, -72, 2, 97, -77, 26, 26, 18, 31, -68, 2, 97, 0, 37, 1, +31, 0, 18, 2, 97, 64, 9, 47, -30, 3, 0, 9, 5, 7, -24, 8, -70, 2, -93, 0, 4, 1, 31, 64, 22, +10, -30, 2, 1, 1, 2, 1, 14, 41, 21, 27, 26, 26, 29, 14, 33, 41, 34, 34, 14, 41, 13, -72, 2, 40, +64, 20, 43, 29, 41, 39, 39, 21, 41, 43, 43, 50, 3, 12, 0, 7, 10, 12, 41, 7, -53, 4, 47, -26, -19, +57, 18, 57, 18, 57, 17, 51, 47, -3, 57, 47, -19, 16, -3, -19, 51, 47, -19, 17, 18, 57, 47, 57, 17, 57, +18, 57, 57, 0, 63, 60, -12, -19, -12, -3, 57, 63, 60, -10, -19, -3, -19, 17, 57, 47, -20, 57, 18, 57, 47, +57, 17, 18, 57, 47, 57, -121, 5, 46, 43, 125, 16, -60, 49, 48, 23, 1, 51, 1, 3, 17, 6, 7, 53, 54, +55, 51, 17, 1, 55, 22, 23, 22, 51, 50, 54, 53, 52, 35, 34, 6, 35, 55, 22, 53, 52, 35, 34, 7, 39, +54, 54, 51, 32, 21, 20, 7, 22, 21, 20, 7, 6, 35, 32, -28, 4, 77, -99, -5, -77, 54, 102, 122, -100, 105, +108, 2, 85, -110, 20, 32, 43, 59, 70, 87, -97, 7, 41, 7, 22, -100, 119, 101, 41, -113, 41, 125, 120, 1, 19, +-118, -83, 79, 84, -115, -2, -9, 57, 6, 12, -7, -12, 3, 22, 2, 42, 81, 32, 123, 50, -119, -3, 17, -3, -54, +15, 59, 23, 30, 77, 56, 110, 3, 110, 2, 104, 89, 102, 23, 107, 83, -69, 120, 40, 42, -107, 97, 65, 69, 0, +0, 3, 0, 25, -1, -57, 6, -116, 5, -45, 0, 3, 0, 39, 0, 66, 0, -48, 64, 21, 2, 3, 3, 63, 0, +1, 20, 0, 0, 1, 25, 24, 24, 22, 18, 4, 5, 5, 9, 32, 18, -72, 2, 97, -77, 17, 17, 9, 22, -68, +2, 97, 0, 28, 1, 31, 0, 9, 2, 97, 64, 11, 38, -30, 3, 0, 9, 52, 51, 51, 48, 65, 64, -68, 2, +97, 0, 66, 1, 31, 0, 48, 2, 97, 64, 22, 54, -30, 2, 1, 1, 2, 1, 24, 32, 12, 18, 17, 17, 20, +5, 24, 41, 25, 25, 5, 41, 4, -72, 2, 40, 64, 13, 34, 20, 41, 30, 30, 12, 41, 34, 34, 68, 3, 0, +64, -72, -1, -32, 64, 18, 15, 17, 52, 64, 46, 40, 66, 58, 46, 41, 58, -65, 40, 51, 41, 52, 39, 40, 47, +-12, -19, 16, -3, -19, -28, 17, 18, 57, 43, 57, 57, 17, 51, 47, -3, 57, 47, -19, 16, -3, -19, 51, 47, -19, +17, 18, 57, 47, 57, 17, 57, 17, 57, 57, 0, 63, 60, -12, -19, -3, -19, 17, 18, 57, 47, 57, 63, 60, -10, +-19, -3, -19, 17, 57, 47, -20, 57, 18, 57, 47, 57, 17, 18, 57, 47, 57, -121, 5, 46, 43, 125, 16, -60, 49, +48, 23, 1, 51, 1, 37, 55, 22, 23, 22, 51, 50, 54, 53, 52, 35, 34, 6, 35, 55, 22, 53, 52, 35, 34, +7, 39, 54, 54, 51, 32, 21, 20, 7, 22, 21, 20, 7, 6, 35, 32, 1, 54, 55, 54, 55, 54, 53, 52, 35, +34, 6, 7, 39, 54, 51, 50, 23, 22, 21, 20, 7, 6, 7, 6, 7, 33, 21, -28, 4, 77, -99, -5, -77, 2, +-90, -110, 20, 32, 43, 59, 70, 87, -97, 7, 41, 7, 22, -100, 119, 101, 41, -113, 41, 125, 120, 1, 19, -118, -83, +79, 84, -115, -2, -9, -5, -58, 14, -16, -112, 27, 37, -118, 67, 64, 21, -105, 56, -6, -112, 78, 70, 59, 42, -93, +80, 38, 1, -126, 57, 6, 12, -7, -12, -32, 15, 59, 23, 30, 77, 56, 110, 3, 110, 2, 104, 89, 102, 23, 107, +83, -69, 120, 40, 42, -107, 97, 65, 69, 3, 12, -126, -81, 104, 30, 41, 43, 110, 48, 66, 16, -40, 59, 54, 90, +85, 74, 53, 118, 58, 39, 121, 0, 0, 1, -2, -74, 4, -86, 0, 46, 5, -62, 0, 3, 0, 66, -77, -103, 1, +1, 2, -72, -1, -32, -77, 14, 17, 52, 2, -72, -1, -64, 64, 15, 9, 10, 52, 2, -121, -113, 1, 1, 1, 64, +9, 16, 52, 1, 3, -72, 2, 83, -73, 2, -122, 79, 0, -33, 0, 2, 0, -71, 2, 96, 0, 1, 47, -19, 93, +-3, -19, 0, 47, 43, 113, -19, 43, 49, 48, 1, 43, 93, 3, 51, 3, 35, -61, -15, -25, -111, 5, -62, -2, -24, +0, 1, -3, 115, 4, -86, -2, -21, 5, -62, 0, 3, 0, 66, -77, -103, 1, 1, 2, -72, -1, -32, -77, 14, 17, +52, 2, -72, -1, -64, 64, 15, 9, 10, 52, 2, -121, -113, 1, 1, 1, 64, 9, 16, 52, 1, 3, -72, 2, 83, +-73, 2, -122, 79, 0, -33, 0, 2, 0, -71, 2, 96, 0, 1, 47, -19, 93, -3, -19, 0, 47, 43, 113, -19, 43, +49, 48, 1, 43, 93, 1, 51, 3, 35, -3, -6, -15, -25, -111, 5, -62, -2, -24, 0, 0, 1, -2, 8, 4, -86, +-1, -128, 5, -62, 0, 3, 0, 65, -75, 1, 32, 14, 17, 52, 1, -72, -1, -64, 64, 15, 9, 10, 52, 1, -121, +-113, 2, 1, 2, 64, 9, 16, 52, 2, 0, -72, 2, 83, -73, 1, -122, 64, 3, -48, 3, 2, 3, -72, 2, 96, +-75, 112, 2, -80, 2, 2, 2, 47, 93, -19, 93, -12, -19, 0, 47, 43, 113, -19, 43, 49, 48, 1, 43, 3, 35, +3, 51, -128, -111, -25, -15, 4, -86, 1, 24, 0, 0, 1, -4, -90, 4, -86, -2, 30, 5, -62, 0, 3, 0, 65, +-75, 1, 32, 14, 17, 52, 1, -72, -1, -64, 64, 15, 9, 10, 52, 1, -121, -113, 2, 1, 2, 64, 9, 16, 52, +2, 0, -72, 2, 83, -73, 1, -122, 64, 3, -48, 3, 2, 3, -72, 2, 96, -75, 112, 2, -80, 2, 2, 2, 47, +93, -19, 93, -12, -19, 0, 47, 43, 113, -19, 43, 49, 48, 1, 43, 1, 35, 3, 51, -2, 30, -111, -25, -15, 4, +-86, 1, 24, 0, 1, -2, 83, 4, -86, 0, 8, 6, 13, 0, 21, 0, 104, -71, 0, 17, -1, -64, -73, 9, 23, +52, 10, 12, 9, 21, 7, -72, 3, 22, -77, 12, 21, 52, 18, -72, -1, -64, -76, 9, 26, 52, 18, 20, -72, 2, +-61, 64, 12, 16, -55, 3, 3, 19, 9, 20, 10, 10, 19, 87, 20, -72, -1, -64, 64, 9, 11, 13, 52, 0, 20, +112, 20, 2, 20, 47, 93, 43, -19, 51, 47, 18, 57, 17, 51, 47, -19, 0, 63, -35, 43, -3, -44, -19, 17, 57, +17, 57, -79, 6, 2, 67, 84, 88, -76, 18, 64, 9, 13, 52, 0, 43, 89, 49, 48, 1, 43, 2, 55, 54, 55, +54, 39, 38, 35, 34, 7, 39, 54, 23, 22, 23, 22, 23, 22, 7, 21, 35, 53, -23, 16, 53, 1, 1, 29, 42, +91, 31, 63, 11, 39, 105, 123, 78, 86, 2, 4, -70, 112, 5, 40, 5, 18, 38, 23, 16, 23, 4, 102, 8, 1, +1, 39, 42, 75, 124, 23, 50, 120, 0, 1, -3, 17, 4, -86, -2, -58, 6, 13, 0, 21, 0, 104, -71, 0, 17, +-1, -64, -73, 9, 23, 52, 10, 12, 9, 21, 7, -72, 3, 22, -77, 12, 21, 52, 18, -72, -1, -64, -76, 9, 26, +52, 18, 20, -72, 2, -61, 64, 12, 16, -55, 3, 3, 19, 9, 20, 10, 10, 19, 87, 20, -72, -1, -64, 64, 9, +11, 13, 52, 0, 20, 112, 20, 2, 20, 47, 93, 43, -19, 51, 47, 18, 57, 17, 51, 47, -19, 0, 63, -35, 43, +-3, -44, -19, 17, 57, 17, 57, -79, 6, 2, 67, 84, 88, -76, 18, 64, 9, 13, 52, 0, 43, 89, 49, 48, 1, +43, 0, 55, 54, 55, 54, 39, 38, 35, 34, 7, 39, 54, 23, 22, 23, 22, 23, 22, 7, 21, 35, 53, -3, -43, +16, 53, 1, 1, 29, 42, 91, 31, 63, 11, 39, 105, 123, 78, 86, 2, 4, -70, 112, 5, 40, 5, 18, 38, 23, +16, 23, 4, 102, 8, 1, 1, 39, 42, 75, 124, 23, 50, 120, 0, 0, 1, -5, -56, 6, 73, -2, 102, 7, 48, +0, 18, 0, 107, -75, 14, 32, 9, 17, 52, 11, -72, -1, -32, 64, 65, 9, 19, 52, 2, 32, 9, 17, 52, 0, +0, -17, 12, 1, 12, 69, 7, 7, -17, 16, 1, 16, 69, 3, 3, 31, 9, -33, 9, 2, 79, 9, 1, 9, 64, +9, 16, 52, 63, 9, 79, 9, -65, 9, 3, 9, 10, 118, 9, 9, 0, 118, -128, 18, 1, 64, 18, -48, 18, -32, +18, 3, 80, 18, 1, 18, 47, 93, 93, 113, -19, 51, 47, -19, 0, 47, 93, 43, 113, 114, 51, 47, -3, 93, 57, +47, -3, 93, 50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, +39, 38, 35, 34, 23, -5, -55, 1, 113, 91, 62, 107, 59, 35, 61, 12, -126, 6, -66, 63, 103, 67, 31, 78, 2, +6, 73, 102, 126, 54, 30, 87, -28, 56, 36, 95, 0, 0, 1, -6, -12, 6, 73, -3, -110, 7, 48, 0, 18, 0, +107, -75, 14, 32, 9, 17, 52, 11, -72, -1, -32, 64, 65, 9, 19, 52, 2, 32, 9, 17, 52, 0, 0, -17, 12, +1, 12, 69, 7, 7, -17, 16, 1, 16, 69, 3, 3, 31, 9, -33, 9, 2, 79, 9, 1, 9, 64, 9, 16, 52, +63, 9, 79, 9, -65, 9, 3, 9, 10, 118, 9, 9, 0, 118, -128, 18, 1, 64, 18, -48, 18, -32, 18, 3, 80, +18, 1, 18, 47, 93, 93, 113, -19, 51, 47, -19, 0, 47, 93, 43, 113, 114, 51, 47, -3, 93, 57, 47, -3, 93, +50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, +34, 23, -6, -11, 1, 113, 91, 62, 107, 59, 35, 61, 12, -126, 6, -66, 63, 103, 67, 31, 78, 2, 6, 73, 102, +126, 54, 30, 87, -28, 56, 36, 95, 0, 0, 1, -6, -81, 6, 73, -3, 77, 7, 48, 0, 18, 0, 107, -75, 14, +32, 9, 17, 52, 11, -72, -1, -32, 64, 65, 9, 19, 52, 2, 32, 9, 17, 52, 0, 0, -17, 12, 1, 12, 69, +7, 7, -17, 16, 1, 16, 69, 3, 3, 31, 9, -33, 9, 2, 79, 9, 1, 9, 64, 9, 16, 52, 63, 9, 79, +9, -65, 9, 3, 9, 10, 118, 9, 9, 0, 118, -128, 18, 1, 64, 18, -48, 18, -32, 18, 3, 80, 18, 1, 18, +47, 93, 93, 113, -19, 51, 47, -19, 0, 47, 93, 43, 113, 114, 51, 47, -3, 93, 57, 47, -3, 93, 50, 47, 49, +48, 1, 43, 43, 43, 1, 38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -6, +-80, 1, 113, 91, 62, 107, 59, 35, 61, 12, -126, 6, -66, 63, 103, 67, 31, 78, 2, 6, 73, 102, 126, 54, 30, +87, -28, 56, 36, 95, 0, 0, 1, -4, 114, 4, -61, -1, 16, 5, -86, 0, 23, 0, 105, -71, 0, 14, -1, -32, +64, 50, 9, 17, 52, 17, 32, 9, 17, 52, 2, 32, 9, 17, 52, 0, 0, -17, 15, 1, 15, 69, 8, 8, -17, +19, 1, 19, 69, 4, 4, -33, 11, 1, 15, 11, 127, 11, 2, 11, 64, 9, 14, 52, 11, 12, 118, 11, 11, 0, +118, 23, -72, -1, -64, -77, 19, 23, 52, 23, -72, -1, -64, -74, 13, 14, 52, 111, 23, 1, 23, 47, 93, 43, 43, +-19, 51, 47, -19, 0, 47, 43, 93, 114, 51, 47, -3, 93, 57, 47, -3, 93, 50, 47, 49, 48, 1, 43, 43, 43, +1, 38, 55, 54, 51, 50, 23, 22, 51, 50, 54, 55, 51, 6, 6, 35, 34, 39, 38, 35, 34, 7, 6, 23, -4, +115, 1, 58, 57, 89, 62, 107, 59, 35, 32, 34, 7, -126, 3, 109, 84, 63, 103, 67, 31, 34, 21, 22, 1, 4, +-61, 104, 62, 62, 54, 30, 35, 52, 114, 114, 56, 36, 24, 24, 47, 0, 1, -5, -86, 4, -61, -2, 72, 5, -86, +0, 23, 0, 105, -71, 0, 14, -1, -32, 64, 50, 9, 17, 52, 17, 32, 9, 17, 52, 2, 32, 9, 17, 52, 0, +0, -17, 15, 1, 15, 69, 8, 8, -17, 19, 1, 19, 69, 4, 4, -33, 11, 1, 15, 11, 127, 11, 2, 11, 64, +9, 14, 52, 11, 12, 118, 11, 11, 0, 118, 23, -72, -1, -64, -77, 19, 23, 52, 23, -72, -1, -64, -74, 13, 14, +52, 111, 23, 1, 23, 47, 93, 43, 43, -19, 51, 47, -19, 0, 47, 43, 93, 114, 51, 47, -3, 93, 57, 47, -3, +93, 50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 55, 54, 51, 50, 23, 22, 51, 50, 54, 55, 51, 6, 6, 35, +34, 39, 38, 35, 34, 7, 6, 23, -5, -85, 1, 58, 57, 89, 62, 107, 59, 35, 32, 34, 7, -126, 3, 109, 84, +63, 103, 67, 31, 34, 21, 22, 1, 4, -61, 104, 62, 62, 54, 30, 35, 52, 114, 114, 56, 36, 24, 24, 47, 0, +1, -5, 106, 4, -61, -2, 8, 5, -86, 0, 23, 0, 105, -71, 0, 14, -1, -32, 64, 50, 9, 17, 52, 17, 32, +9, 17, 52, 2, 32, 9, 17, 52, 0, 0, -17, 15, 1, 15, 69, 8, 8, -17, 19, 1, 19, 69, 4, 4, -33, +11, 1, 15, 11, 127, 11, 2, 11, 64, 9, 14, 52, 11, 12, 118, 11, 11, 0, 118, 23, -72, -1, -64, -77, 19, +23, 52, 23, -72, -1, -64, -74, 13, 14, 52, 111, 23, 1, 23, 47, 93, 43, 43, -19, 51, 47, -19, 0, 47, 43, +93, 114, 51, 47, -3, 93, 57, 47, -3, 93, 50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 55, 54, 51, 50, 23, +22, 51, 50, 54, 55, 51, 6, 6, 35, 34, 39, 38, 35, 34, 7, 6, 23, -5, 107, 1, 58, 57, 89, 62, 107, +59, 35, 32, 34, 7, -126, 3, 109, 84, 63, 103, 67, 31, 34, 21, 22, 1, 4, -61, 104, 62, 62, 54, 30, 35, +52, 114, 114, 56, 36, 24, 24, 47, -1, -1, -4, -15, -2, -69, -3, -66, -1, -120, 2, 23, 4, 125, -3, -17, 0, +0, -1, -1, -4, 125, -2, -69, -3, 74, -1, -120, 2, 23, 4, 125, -3, 123, 0, 0, -1, -1, -5, -35, -2, -69, +-4, -86, -1, -120, 2, 23, 4, 125, -4, -37, 0, 0, -1, -1, -4, -63, -2, -69, -3, -114, -1, -120, 2, 23, 4, +125, -3, -65, 0, 0, -1, -1, -5, -104, -2, -69, -4, 101, -1, -120, 2, 23, 4, 125, -4, -106, 0, 0, 0, 1, +-3, -22, 6, 11, -1, 98, 7, 35, 0, 3, 0, 83, -75, 1, 32, 14, 17, 52, 1, -72, -1, -64, 64, 31, 9, +10, 52, 1, -121, 31, 2, 47, 2, 2, 31, 2, 47, 2, -113, 2, -97, 2, 4, -81, 2, -65, 2, 2, 2, 64, +9, 16, 52, 2, 0, -72, 2, 83, -73, 1, -122, 64, 3, -48, 3, 2, 3, -72, 2, 96, -75, 112, 2, -80, 2, +2, 2, 47, 93, -19, 93, -3, -19, 0, 47, 43, 93, 113, 114, -19, 43, 49, 48, 1, 43, 3, 35, 3, 51, -98, +-111, -25, -15, 6, 11, 1, 24, 0, 0, 1, -2, -124, 6, 11, -1, -4, 7, 35, 0, 3, 0, 84, -77, -103, 1, +1, 2, -72, -1, -32, -77, 14, 17, 52, 2, -72, -1, -64, 64, 31, 9, 10, 52, 2, -121, 31, 1, 47, 1, 2, +31, 1, 47, 1, -113, 1, -97, 1, 4, -81, 1, -65, 1, 2, 1, 64, 9, 16, 52, 1, 3, -72, 2, 83, -73, +2, -122, 79, 0, -33, 0, 2, 0, -71, 2, 96, 0, 1, 47, -19, 93, -3, -19, 0, 47, 43, 93, 113, 114, -19, +43, 49, 48, 1, 43, 93, 3, 51, 3, 35, -11, -15, -25, -111, 7, 35, -2, -24, 0, 1, -3, -62, 4, -61, 0, +96, 5, -86, 0, 23, 0, 105, -71, 0, 14, -1, -32, 64, 50, 9, 17, 52, 17, 32, 9, 17, 52, 2, 32, 9, +17, 52, 0, 0, -17, 15, 1, 15, 69, 8, 8, -17, 19, 1, 19, 69, 4, 4, -33, 11, 1, 15, 11, 127, 11, +2, 11, 64, 9, 14, 52, 11, 12, 118, 11, 11, 0, 118, 23, -72, -1, -64, -77, 19, 23, 52, 23, -72, -1, -64, +-74, 13, 14, 52, 111, 23, 1, 23, 47, 93, 43, 43, -19, 51, 47, -19, 0, 47, 43, 93, 114, 51, 47, -3, 93, +57, 47, -3, 93, 50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 55, 54, 51, 50, 23, 22, 51, 50, 54, 55, 51, +6, 6, 35, 34, 39, 38, 35, 34, 7, 6, 23, -3, -61, 1, 58, 57, 89, 62, 107, 59, 35, 32, 34, 7, -126, +3, 109, 84, 63, 103, 67, 31, 34, 21, 22, 1, 4, -61, 104, 62, 62, 54, 30, 35, 52, 114, 114, 56, 36, 24, +24, 47, -1, -1, -4, -15, -2, -69, -3, -66, -1, -120, 2, 23, 4, 125, -3, -17, 0, 0, -1, -1, -3, 95, -2, +-69, -2, 44, -1, -120, 2, 23, 4, 125, -2, 93, 0, 0, -1, -1, -2, 118, -2, -69, -1, 67, -1, -120, 2, 23, +4, 125, -1, 116, 0, 0, -1, -1, -2, -68, -2, -69, -1, -119, -1, -120, 2, 22, 4, 125, -70, 0, -1, -1, -4, +-21, -2, -69, -3, -72, -1, -120, 2, 23, 4, 125, -3, -23, 0, 0, -1, -1, -3, 108, -2, -69, -2, 57, -1, -120, +2, 23, 4, 125, -2, 106, 0, 0, -1, -1, -3, 88, -2, -69, -2, 37, -1, -120, 2, 23, 4, 125, -2, 86, 0, +0, -1, -1, -4, -112, -2, -69, -3, 93, -1, -120, 2, 23, 4, 125, -3, -114, 0, 0, -1, -1, -3, 21, -2, -69, +-3, -30, -1, -120, 2, 23, 4, 125, -2, 19, 0, 0, -1, -1, -4, 44, -2, -69, -4, -7, -1, -120, 2, 23, 4, +125, -3, 42, 0, 0, 0, 1, -4, 19, 6, 124, -2, -80, 7, 43, 0, 18, 0, 110, -77, 75, 14, 1, 11, -72, +-1, -32, 64, 11, 10, 19, 52, 2, 32, 10, 17, 52, 0, 0, 7, -72, 3, 22, 64, 31, 64, 12, 64, 94, 53, +12, 64, 79, 83, 52, 12, 64, 67, 69, 52, 12, 64, 43, 45, 52, 111, 12, 127, 12, 2, 15, 12, 1, 12, -128, +16, -72, 3, 22, -78, 3, 3, 9, -70, 3, 23, 0, 10, 3, 22, -78, 9, 9, 0, -71, 3, 22, 0, 18, 47, +-19, 51, 47, -19, 0, 125, 63, 51, 24, 47, -19, 26, -35, 93, 113, 43, 43, 43, 43, 26, -19, 51, 47, 49, 48, +1, 43, 43, 93, 1, 52, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -4, 19, +112, 91, 62, 107, 59, 68, 61, 12, 97, 6, -66, 63, 103, 67, 64, 81, 2, 6, 124, 82, 91, 44, 24, 70, -84, +44, 29, 76, 0, 0, 1, -4, 18, 6, 73, -2, -80, 7, 48, 0, 18, 0, 107, -75, 14, 32, 9, 17, 52, 11, +-72, -1, -32, 64, 65, 9, 19, 52, 2, 32, 9, 17, 52, 0, 0, -17, 12, 1, 12, 69, 7, 7, -17, 16, 1, +16, 69, 3, 3, 31, 9, -33, 9, 2, 79, 9, 1, 9, 64, 9, 16, 52, 63, 9, 79, 9, -65, 9, 3, 9, +10, 118, 9, 9, 0, 118, -128, 18, 1, 64, 18, -48, 18, -32, 18, 3, 80, 18, 1, 18, 47, 93, 93, 113, -19, +51, 47, -19, 0, 47, 93, 43, 113, 114, 51, 47, -3, 93, 57, 47, -3, 93, 50, 47, 49, 48, 1, 43, 43, 43, +1, 38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -4, 19, 1, 113, 91, 62, +107, 59, 35, 61, 12, -126, 6, -66, 63, 103, 67, 31, 78, 2, 6, 73, 102, 126, 54, 30, 87, -28, 56, 36, 95, +0, 0, 1, -5, -106, 6, 124, -2, 52, 7, 43, 0, 18, 0, 110, -77, 75, 14, 1, 11, -72, -1, -32, 64, 11, +10, 19, 52, 2, 32, 10, 17, 52, 0, 0, 7, -72, 3, 22, 64, 31, 64, 12, 64, 94, 53, 12, 64, 79, 83, +52, 12, 64, 67, 69, 52, 12, 64, 43, 45, 52, 111, 12, 127, 12, 2, 15, 12, 1, 12, -128, 16, -72, 3, 22, +-78, 3, 3, 9, -70, 3, 23, 0, 10, 3, 22, -78, 9, 9, 0, -71, 3, 22, 0, 18, 47, -19, 51, 47, -19, +0, 125, 63, 51, 24, 47, -19, 26, -35, 93, 113, 43, 43, 43, 43, 26, -19, 51, 47, 49, 48, 1, 43, 43, 93, +1, 38, 54, 51, 50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -5, -105, 1, 113, 91, 62, +107, 59, 68, 61, 12, 97, 6, -66, 63, 103, 67, 67, 78, 2, 6, 124, 82, 91, 44, 24, 70, -84, 44, 29, 76, +0, 1, -5, -106, 6, 73, -2, 52, 7, 48, 0, 18, 0, 107, -75, 14, 32, 9, 17, 52, 11, -72, -1, -32, 64, +65, 9, 19, 52, 2, 32, 9, 17, 52, 0, 0, -17, 12, 1, 12, 69, 7, 7, -17, 16, 1, 16, 69, 3, 3, +31, 9, -33, 9, 2, 79, 9, 1, 9, 64, 9, 16, 52, 63, 9, 79, 9, -65, 9, 3, 9, 10, 118, 9, 9, +0, 118, -128, 18, 1, 64, 18, -48, 18, -32, 18, 3, 80, 18, 1, 18, 47, 93, 93, 113, -19, 51, 47, -19, 0, +47, 93, 43, 113, 114, 51, 47, -3, 93, 57, 47, -3, 93, 50, 47, 49, 48, 1, 43, 43, 43, 1, 38, 54, 51, +50, 23, 22, 51, 50, 55, 51, 6, 35, 34, 39, 38, 35, 34, 23, -5, -105, 1, 113, 91, 62, 107, 59, 35, 61, +12, -126, 6, -66, 63, 103, 67, 31, 78, 2, 6, 73, 102, 126, 54, 30, 87, -28, 56, 36, 95, 0, 0, 1, 0, +-120, 0, 0, 1, 60, 4, 38, 0, 3, 0, 127, 64, 64, 79, 5, -112, 5, -96, 5, -80, 5, -64, 5, -33, 5, +-16, 5, 7, 0, 5, 31, 5, 112, 5, -128, 5, -97, 5, -80, 5, -64, 5, -33, 5, -32, 5, -1, 5, 10, 31, +5, 1, 1, 6, 0, 10, 3, 37, 5, 32, 11, 11, 2, 85, 0, 6, 12, 12, 2, 85, 0, 10, 11, 11, 2, +85, 0, -72, -1, -20, 64, 11, 10, 10, 2, 85, 0, 20, 11, 11, 6, 85, 0, -72, -1, -4, -76, 12, 13, 6, +85, 0, -72, -1, -18, 64, 12, 16, 16, 6, 85, 0, 0, 32, 0, -32, 0, 3, 0, 47, 93, 43, 43, 43, 43, +43, 43, 43, -19, 0, 63, 63, 49, 48, 1, 93, 114, 113, 51, 17, 51, 17, -120, -76, 4, 38, -5, -38, 0, -1, +-1, -1, -3, -2, -69, 5, 89, 5, -70, 2, 38, 0, 36, 0, 0, 1, 7, 4, 125, 3, 52, 0, 0, 0, 32, +-79, 2, 16, -72, -1, -64, -77, 53, 60, 52, 16, -72, -1, -64, -78, 18, 23, 52, -72, -1, -20, -76, 16, 17, 7, +4, 65, 1, 43, 43, 43, 53, -1, -1, 0, 74, -2, -69, 4, 28, 4, 62, 2, 38, 0, 68, 0, 0, 1, 7, +4, 125, 2, -56, 0, 0, 0, 16, 64, 10, 2, 31, 57, 1, 0, 57, 58, 47, 55, 65, 1, 43, 93, 53, -1, +-1, -1, -3, 0, 0, 5, 89, 7, 44, 2, 38, 0, 36, 0, 0, 1, 7, 4, 116, 3, -84, 0, 0, 0, 16, +64, 10, 2, 127, 35, 1, 0, 35, 34, 1, 2, 65, 1, 43, 93, 53, -1, -1, 0, 74, -1, -24, 4, 28, 6, +13, 2, 38, 0, 68, 0, 0, 1, 7, 4, -123, 3, 52, 0, 0, 0, 58, -79, 2, 76, -72, -1, -64, -76, 18, +18, 6, 85, 76, -72, -1, -64, 64, 27, 14, 16, 6, 85, -112, 76, 1, 112, 76, -128, 76, 2, 80, 76, 96, 76, +-96, 76, -80, 76, -32, 76, -16, 76, 6, 76, 28, -72, -1, -54, -79, 72, 43, 1, 43, 93, 113, 114, 43, 43, 53, +-1, -1, -1, -3, 0, 0, 5, 89, 7, 43, 2, 38, 0, 36, 0, 0, 0, 39, 4, 124, 2, -115, 0, 25, 1, +7, 4, 113, 3, -33, 0, 0, 0, 48, -73, 3, -48, 25, 1, 0, 25, 1, 25, -72, -1, -64, 64, 22, 31, 42, +52, 25, 18, 0, 72, 43, 2, 0, 17, 20, 1, 2, 65, 2, 17, 64, 25, 40, 52, 17, 0, 47, 43, 53, 1, +43, 53, 43, 43, 93, 113, 53, -1, -1, 0, 74, -1, -24, 4, 28, 7, 35, 2, 38, 0, 68, 0, 0, 0, 39, +0, -42, 0, -34, 0, 0, 1, 7, 4, -109, 3, 75, 0, 0, 0, 90, -76, 3, 95, 66, 1, 66, -72, -1, -64, +64, 61, 23, 25, 52, 66, 59, 0, 72, 43, 2, -97, 58, 1, 32, 58, 48, 58, 112, 58, -128, 58, 4, -112, 58, +-96, 58, -80, 58, -32, 58, -16, 58, 5, 58, 64, 46, 50, 52, 0, 58, 61, 28, 28, 65, 2, 31, 62, 47, 62, +2, -16, 62, 1, 95, 62, 1, 62, 64, 9, 12, 52, 62, 0, 47, 43, 93, 113, 114, 53, 1, 43, 43, 93, 113, +114, 53, 43, 43, 93, 53, -1, -1, -1, -3, 0, 0, 5, 89, 7, 43, 2, 38, 0, 36, 0, 0, 0, 39, 4, +124, 2, -115, 0, 25, 1, 7, 4, 110, 3, -79, 0, 0, 0, 39, 64, 26, 3, -33, 22, 1, 15, 22, 1, 22, +19, 0, 72, 43, 2, 0, 17, 20, 1, 2, 65, 2, 17, 64, 25, 40, 52, 17, 0, 47, 43, 53, 1, 43, 53, +43, 93, 113, 53, 0, -1, -1, 0, 74, -1, -24, 4, 28, 7, 35, 2, 38, 0, 68, 0, 0, 0, 39, 0, -42, +0, -34, 0, 0, 1, 7, 4, -110, 3, 45, 0, 0, 0, 89, 64, 69, 3, 63, 64, 38, 51, 52, 63, 64, 23, +30, 52, 63, 60, 0, 72, 43, 2, -97, 58, 1, 32, 58, 48, 58, 112, 58, -128, 58, 4, -112, 58, -96, 58, -80, +58, -32, 58, -16, 58, 5, 58, 64, 46, 50, 52, 0, 58, 61, 28, 28, 65, 2, 31, 62, 47, 62, 2, -16, 62, +1, 95, 62, 1, 62, 64, 9, 12, 52, 62, 0, 47, 43, 93, 113, 114, 53, 1, 43, 43, 93, 113, 114, 53, 43, +43, 43, 53, 0, -1, -1, -1, -3, 0, 0, 5, 89, 7, 44, 2, 38, 0, 36, 0, 0, 0, 39, 4, 124, 2, +-115, 0, 25, 1, 7, 4, 117, 3, -44, 0, 0, 0, 49, -79, 3, 41, -72, -1, -64, 64, 29, 29, 31, 52, -80, +41, 1, 0, 41, 1, 0, 41, 40, 18, 19, 65, 2, 0, 17, 20, 1, 2, 65, 2, 16, 64, 25, 40, 52, 16, +0, 47, 43, 53, 1, 43, 53, 43, 93, 113, 43, 53, 0, -1, -1, 0, 74, -1, -24, 4, 28, 7, 44, 2, 38, +0, 68, 0, 0, 0, 39, 0, -42, 0, -34, 0, 0, 1, 7, 4, 116, 3, 72, 0, 0, 0, 98, 64, 10, 3, +-128, 83, 1, 79, 83, 127, 83, 2, 83, -72, -1, -64, 64, 62, 18, 27, 52, 0, 83, 82, 59, 60, 65, 2, -97, +58, 1, 32, 58, 48, 58, 112, 58, -128, 58, 4, -112, 58, -96, 58, -80, 58, -32, 58, -16, 58, 5, 58, 64, 46, +50, 52, 0, 58, 61, 28, 28, 65, 2, 31, 62, 47, 62, 2, -16, 62, 1, 95, 62, 1, 62, 64, 9, 12, 52, +62, 0, 47, 43, 93, 113, 114, 53, 1, 43, 43, 93, 113, 114, 53, 43, 43, 93, 113, 53, -1, -1, -1, -3, 0, +0, 5, 89, 7, 43, 2, 38, 0, 36, 0, 0, 0, 39, 4, 124, 2, -115, 0, 25, 1, 7, 4, -97, 5, 60, +0, 0, 0, 48, 64, 34, 3, 22, 64, 29, 32, 52, 22, 64, 20, 23, 52, 16, 22, 1, 0, 22, 32, 1, 2, +65, 2, 0, 17, 20, 1, 2, 65, 2, 17, 64, 25, 40, 52, 17, 0, 47, 43, 53, 1, 43, 53, 43, 93, 43, +43, 53, -1, -1, 0, 74, -1, -24, 4, 28, 6, -14, 2, 38, 0, 68, 0, 0, 0, 39, 0, -42, 0, -34, 0, +0, 1, 7, 4, 122, 4, 116, 0, 0, 0, 84, 64, 65, 3, 0, 63, 79, 63, 2, 0, 63, 73, 58, 61, 65, +2, -97, 58, 1, 32, 58, 48, 58, 112, 58, -128, 58, 4, -112, 58, -96, 58, -80, 58, -32, 58, -16, 58, 5, 58, +64, 46, 50, 52, 0, 58, 61, 28, 28, 65, 2, 31, 62, 47, 62, 2, -16, 62, 1, 95, 62, 1, 62, 64, 9, +12, 52, 62, 0, 47, 43, 93, 113, 114, 53, 1, 43, 43, 93, 113, 114, 53, 43, 93, 53, -1, -1, -1, -3, -2, +-69, 5, 89, 6, 104, 2, 38, 0, 36, 0, 0, 0, 39, 4, 124, 2, -115, 0, 25, 1, 7, 4, 125, 3, 52, +0, 0, 0, 53, -79, 3, 23, -72, -1, -64, -77, 53, 60, 52, 23, -72, -1, -64, -78, 18, 23, 52, -72, -1, -20, +64, 19, 23, 24, 7, 4, 65, 2, 0, 17, 20, 1, 2, 65, 2, 17, 64, 10, 40, 52, 17, 0, 47, 43, 53, +1, 43, 53, 43, 43, 43, 53, 0, -1, -1, 0, 74, -2, -69, 4, 28, 5, -62, 2, 38, 0, 68, 0, 0, 0, +39, 0, -42, 0, -34, 0, 0, 1, 7, 4, 125, 2, -56, 0, 0, 0, 67, 64, 48, 3, 31, 64, 1, 0, 64, +65, 47, 55, 65, 2, -97, 58, 1, 32, 58, 48, 58, 112, 58, -128, 58, 4, -112, 58, -96, 58, -80, 58, -32, 58, +-16, 58, 5, 58, 64, 46, 50, 52, 0, 58, 61, 28, 28, 65, 2, 1, 62, -71, 2, 34, 0, 41, 0, 43, 1, +43, 43, 93, 113, 114, 53, 43, 93, 53, 0, -1, -1, -1, -3, 0, 0, 5, 89, 7, 43, 2, 38, 0, 36, 0, +0, 0, 39, 4, 123, 2, -85, 0, 0, 1, 7, 4, 113, 3, -33, 0, 0, 0, 52, -79, 3, 35, -72, -1, -64, +-77, 65, 66, 52, 35, -72, -1, -64, 64, 24, 57, 53, -1, 35, 1, 35, 22, 19, 72, 43, 2, 0, 17, 27, 1, +2, 65, 2, 32, 64, 25, 45, 52, 32, 0, 47, 43, 53, 1, 43, 53, 43, 113, 43, 43, 53, -1, -1, 0, 74, +-1, -24, 4, 28, 7, 35, 2, 38, 0, 68, 0, 0, 0, 39, 0, -39, 0, -11, 0, 0, 1, 7, 4, -109, 3, +72, 0, 0, 0, 55, 64, 12, 3, 96, 72, 112, 72, 2, 0, 72, 91, 72, 2, 72, -72, -1, -32, 64, 20, 15, +17, 52, 72, 67, 24, 72, 43, 2, -49, 60, 1, 60, 28, 3, 104, 43, 2, 1, 60, -71, 2, 34, 0, 41, 0, +43, 1, 43, 93, 53, 43, 43, 93, 113, 53, 0, -1, -1, -1, -3, 0, 0, 5, 89, 7, 43, 2, 38, 0, 36, +0, 0, 0, 39, 4, 123, 2, -85, 0, 0, 1, 7, 4, 110, 3, -79, 0, 0, 0, 92, -74, 2, 32, 64, 25, +45, 52, 32, 0, 47, 43, 53, 1, -79, 6, 2, 67, 84, 88, 64, 14, 3, 84, 35, 35, 22, 22, 65, 2, 0, +31, 31, 1, 2, 65, 43, 53, 43, 53, 27, 64, 27, 3, 35, 64, 56, 57, 52, 35, 64, 41, 49, 52, 35, 64, +9, 17, 52, 64, 35, 111, 35, -33, 35, -17, 35, 4, 35, 2, -72, -1, -11, 64, 9, 72, 43, 2, 0, 17, 27, +1, 2, 65, 43, 53, 43, 113, 43, 43, 43, 53, 89, -1, -1, 0, 74, -1, -24, 4, 28, 7, 35, 2, 38, 0, +68, 0, 0, 0, 39, 0, -39, 0, -11, 0, 0, 1, 7, 4, -110, 3, 92, 0, 0, 0, 42, -73, 3, 15, 73, +80, 73, 2, 73, 67, -72, -1, -14, 64, 14, 72, 43, 2, -49, 60, 1, 60, 28, 3, 104, 43, 2, 1, 60, -71, +2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 43, 93, 53, -1, -1, -1, -3, 0, 0, 5, 89, 7, 44, 2, 38, +0, 36, 0, 0, 0, 39, 4, 123, 2, -85, 0, 0, 1, 7, 4, 117, 3, -44, 0, 0, 0, 59, 64, 9, 3, +-80, 54, -64, 54, -48, 54, 3, 54, -72, -1, -64, -77, 42, 50, 52, 54, -72, -1, -64, 64, 23, 33, 40, 52, 0, +54, 53, 1, 2, 65, 2, 0, 17, 27, 1, 2, 65, 2, 32, 64, 25, 45, 52, 32, 0, 47, 43, 53, 1, 43, +53, 43, 43, 43, 114, 53, 0, -1, -1, 0, 74, -1, -24, 4, 28, 7, 44, 2, 38, 0, 68, 0, 0, 0, 39, +0, -39, 0, -11, 0, 0, 1, 7, 4, 116, 3, 92, 0, 0, 0, 66, 64, 48, 3, 80, 90, 96, 90, -112, 90, +-96, 90, 4, 0, 90, 16, 90, 48, 90, 112, 90, -128, 90, 5, 0, 90, -128, 90, -64, 90, -48, 90, 4, 0, 90, +89, 28, 28, 65, 2, -49, 60, 1, 60, 28, 3, 104, 43, 2, 1, 60, -71, 2, 34, 0, 41, 0, 43, 1, 43, +93, 53, 43, 93, 113, 114, 53, -1, -1, -1, -3, 0, 0, 5, 89, 7, 43, 2, 38, 0, 36, 0, 0, 0, 39, +4, 123, 2, -85, 0, 0, 1, 7, 4, -97, 5, 80, 0, 0, 0, 44, 64, 31, 3, -49, 35, -33, 35, -17, 35, +3, 47, 35, 1, 0, 35, 45, 1, 2, 65, 2, 0, 17, 27, 1, 2, 65, 2, 32, 64, 25, 45, 52, 32, 0, +47, 43, 53, 1, 43, 53, 43, 93, 113, 53, -1, -1, 0, 74, -1, -24, 4, 28, 6, -14, 2, 38, 0, 68, 0, +0, 0, 39, 0, -39, 0, -11, 0, 0, 1, 7, 4, 122, 4, -100, 0, 0, 0, 43, -79, 3, 70, -72, -1, -64, +64, 21, 10, 12, 52, 0, 70, 80, 63, 57, 65, 2, -49, 60, 1, 60, 28, 3, 104, 43, 2, 1, 60, -71, 2, +34, 0, 41, 0, 43, 1, 43, 93, 53, 43, 43, 53, 0, -1, -1, -1, -3, -2, -69, 5, 89, 6, 102, 2, 38, +0, 36, 0, 0, 0, 39, 4, 123, 2, -85, 0, 0, 1, 7, 4, 125, 3, 52, 0, 0, 0, 53, -79, 3, 36, +-72, -1, -64, -77, 53, 60, 52, 36, -72, -1, -64, -78, 18, 23, 52, -72, -1, -20, 64, 19, 36, 37, 7, 4, 65, +2, 0, 17, 27, 1, 2, 65, 2, 32, 64, 10, 45, 52, 32, 0, 47, 43, 53, 1, 43, 53, 43, 43, 43, 53, +0, -1, -1, 0, 74, -2, -69, 4, 28, 5, -72, 2, 38, 0, 68, 0, 0, 0, 39, 0, -39, 0, -11, 0, 0, +1, 7, 4, 125, 2, -56, 0, 0, 0, 38, 64, 22, 3, 31, 71, 1, 0, 71, 72, 47, 55, 65, 2, -49, 60, +1, 60, 28, 3, 104, 43, 2, 1, 60, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 53, 43, 93, 53, -1, -1, +0, -94, -2, -69, 4, -24, 5, -70, 2, 38, 0, 40, 0, 0, 1, 7, 4, 125, 3, 92, 0, 0, 0, 16, 64, +10, 1, 32, 13, 1, 0, 13, 14, 0, 11, 65, 1, 43, 93, 53, -1, -1, 0, 75, -2, -69, 4, 30, 4, 62, +2, 38, 0, 72, 0, 0, 1, 7, 4, 125, 2, -38, 0, 0, 0, 20, -75, 2, 80, 31, 96, 31, 2, -72, -1, +-40, -76, 31, 32, 4, 4, 65, 1, 43, 93, 53, -1, -1, 0, -94, 0, 0, 4, -24, 7, 44, 2, 38, 0, 40, +0, 0, 1, 7, 4, 116, 3, -44, 0, 0, 0, 11, -74, 1, 0, 22, 28, 1, 2, 65, 1, 43, 53, 0, -1, +-1, 0, 75, -1, -24, 4, 30, 6, 13, 2, 38, 0, 72, 0, 0, 1, 7, 4, -123, 3, 42, 0, 0, 0, 26, +64, 19, 2, 0, 50, 16, 50, 2, -112, 50, -64, 50, -48, 50, 3, 0, 50, 49, 10, 10, 65, 1, 43, 93, 113, +53, -1, -1, 0, -94, 0, 0, 4, -24, 7, 20, 2, 38, 0, 40, 0, 0, 1, 7, 0, -41, 1, 124, 1, 106, +0, 22, 64, 10, 1, 0, 12, 24, 1, 2, 65, 1, 1, 12, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, +-1, 0, 75, -1, -24, 4, 30, 5, -86, 2, 38, 0, 72, 0, 0, 1, 7, 0, -41, 0, -16, 0, 0, 0, 22, +64, 10, 2, 0, 30, 42, 10, 10, 65, 2, 1, 30, -71, 2, -61, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, +-94, 0, 0, 4, -24, 7, 43, 2, 38, 0, 40, 0, 0, 0, 39, 4, 124, 2, -85, 0, 25, 1, 7, 4, 113, +3, -3, 0, 0, 0, 48, -73, 2, -48, 22, 1, 0, 22, 1, 22, -72, -1, -64, 64, 22, 31, 42, 52, 22, 15, +0, 72, 43, 1, 0, 14, 17, 1, 2, 65, 1, 14, 64, 25, 40, 52, 14, 0, 47, 43, 53, 1, 43, 53, 43, +43, 93, 113, 53, -1, -1, 0, 75, -1, -24, 4, 30, 7, 35, 2, 38, 0, 72, 0, 0, 0, 39, 0, -42, 0, +-33, 0, 0, 1, 7, 4, -109, 3, 76, 0, 0, 0, 75, -76, 3, 95, 40, 1, 40, -72, -1, -64, 64, 47, 23, +25, 52, 40, 33, 0, 72, 43, 2, 32, 64, 59, 53, 32, 64, 45, 50, 52, 15, 32, -97, 32, 2, 0, 32, 35, +10, 10, 65, 2, 31, 32, 47, 32, 2, -16, 32, 1, 95, 32, 1, 32, 64, 9, 12, 52, 32, 0, 47, 43, 93, +113, 114, 53, 1, 43, 114, 43, 43, 53, 43, 43, 93, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 7, 43, 2, +38, 0, 40, 0, 0, 0, 39, 4, 124, 2, -85, 0, 25, 1, 7, 4, 110, 3, -49, 0, 0, 0, 52, 64, 37, +2, 19, 64, 58, 53, 15, 19, 31, 19, 2, -33, 19, -1, 19, 2, 15, 19, 1, 19, 16, 0, 72, 43, 1, 0, +14, 17, 1, 2, 65, 1, 14, 64, 25, 40, 52, 14, 0, 47, 43, 53, 1, 43, 53, 43, 93, 113, 114, 43, 53, +-1, -1, 0, 75, -1, -24, 4, 30, 7, 35, 2, 38, 0, 72, 0, 0, 0, 39, 0, -42, 0, -33, 0, 0, 1, +7, 4, -110, 3, 46, 0, 0, 0, 81, 64, 61, 3, 37, 64, 17, 17, 6, 85, 37, 64, 38, 51, 52, 37, 64, +23, 30, 52, 37, 34, 0, 72, 43, 2, 32, 64, 59, 53, 32, 64, 45, 50, 52, 15, 32, -97, 32, 2, 0, 32, +35, 10, 10, 65, 2, 31, 32, 47, 32, 2, -16, 32, 1, 95, 32, 1, 32, 64, 9, 12, 52, 32, 0, 47, 43, +93, 113, 114, 53, 1, 43, 114, 43, 43, 53, 43, 43, 43, 43, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 7, +44, 2, 38, 0, 40, 0, 0, 0, 39, 4, 124, 2, -85, 0, 25, 1, 7, 4, 117, 3, -24, 0, 0, 0, 49, +-79, 2, 38, -72, -1, -64, 64, 29, 28, 32, 52, -80, 38, 1, 0, 38, 1, 0, 38, 37, 15, 16, 65, 1, 0, +14, 17, 1, 2, 65, 1, 14, 64, 25, 40, 52, 14, 0, 47, 43, 53, 1, 43, 53, 43, 93, 113, 43, 53, 0, +-1, -1, 0, 75, -1, -24, 4, 30, 7, 44, 2, 38, 0, 72, 0, 0, 0, 39, 0, -42, 0, -33, 0, 0, 1, +7, 4, 116, 3, 72, 0, 0, 0, 81, 64, 9, 3, 79, 57, 127, 57, -17, 57, 3, 57, -72, -1, -64, 64, 48, +18, 27, 52, 0, 57, 56, 33, 34, 65, 2, 32, 64, 59, 53, 32, 64, 45, 50, 52, 15, 32, -97, 32, 2, 0, +32, 35, 10, 10, 65, 2, 31, 32, 47, 32, 2, -16, 32, 1, 95, 32, 1, 32, 64, 9, 12, 52, 32, 0, 47, +43, 93, 113, 114, 53, 1, 43, 114, 43, 43, 53, 43, 43, 93, 53, 0, -1, -1, 0, -94, 0, 0, 4, -24, 7, +43, 2, 38, 0, 40, 0, 0, 0, 39, 4, 124, 2, -85, 0, 25, 1, 7, 4, -97, 5, 80, 0, 0, 0, 36, +64, 24, 2, -80, 19, 1, 0, 19, 29, 14, 17, 65, 1, 0, 14, 17, 1, 2, 65, 1, 14, 64, 25, 40, 52, +14, 0, 47, 43, 53, 1, 43, 53, 43, 113, 53, -1, -1, 0, 75, -1, -24, 4, 30, 6, -14, 2, 38, 0, 72, +0, 0, 0, 39, 0, -42, 0, -33, 0, 0, 1, 7, 4, 122, 4, 116, 0, 0, 0, 69, 64, 51, 3, 0, 37, +79, 37, 2, 0, 37, 47, 32, 35, 65, 2, 32, 64, 59, 53, 32, 64, 45, 50, 52, 15, 32, -97, 32, 2, 0, +32, 35, 10, 10, 65, 2, 31, 32, 47, 32, 2, -16, 32, 1, 95, 32, 1, 32, 64, 9, 12, 52, 32, 0, 47, +43, 93, 113, 114, 53, 1, 43, 114, 43, 43, 53, 43, 93, 53, 0, -1, -1, 0, -94, -2, -69, 4, -24, 6, 104, +2, 38, 0, 40, 0, 0, 0, 39, 4, 124, 2, -85, 0, 25, 1, 7, 4, 125, 3, 92, 0, 0, 0, 36, 64, +24, 2, 32, 20, 1, 0, 20, 21, 0, 11, 65, 1, 0, 14, 17, 1, 2, 65, 1, 14, 64, 10, 40, 52, 14, +0, 47, 43, 53, 1, 43, 53, 43, 93, 53, -1, -1, 0, 75, -2, -69, 4, 30, 5, -62, 2, 38, 0, 72, 0, +0, 0, 39, 0, -42, 0, -33, 0, 0, 1, 7, 4, 125, 2, -38, 0, 0, 0, 57, -75, 3, 80, 38, 96, 38, +2, -72, -1, -40, 64, 29, 38, 39, 4, 4, 65, 2, 32, 64, 59, 53, 32, 64, 45, 50, 52, 15, 32, -97, 32, +2, 0, 32, 35, 10, 10, 65, 2, 1, 36, -71, 2, 34, 0, 41, 0, 43, 1, 43, 114, 43, 43, 53, 43, 93, +53, 0, -1, -1, 0, 99, 0, 0, 2, 24, 7, 44, 2, 38, 0, 44, 0, 0, 1, 7, 4, 116, 2, 58, 0, +0, 0, 22, -79, 1, 14, -72, -1, -64, 64, 10, 16, 16, 6, 85, 0, 14, 20, 1, 2, 65, 1, 43, 43, 53, +-1, -1, 0, 31, 0, 0, 1, -44, 6, 13, 2, 38, 4, -93, 0, 0, 1, 7, 4, -123, 1, -52, 0, 0, 0, +31, -80, 1, 1, -79, 6, 2, 67, 84, 88, -75, 0, 24, 23, 1, 2, 65, 43, 27, -73, 79, 24, 1, 24, 1, +34, 72, 43, 43, 113, 89, 53, 0, -1, -1, 0, -70, -2, -69, 1, -121, 5, -70, 2, 38, 0, 44, 0, 0, 1, +7, 4, 125, 1, -72, 0, 0, 0, 11, -74, 1, 0, 5, 6, 0, 3, 65, 1, 43, 53, 0, -1, -1, 0, 124, +-2, -69, 1, 73, 5, -70, 2, 38, 0, 76, 0, 0, 1, 7, 4, 125, 1, 122, 0, 0, 0, 22, 64, 15, 2, +9, 64, 109, 111, 52, 79, 9, 1, 0, 9, 10, 4, 7, 65, 1, 43, 113, 43, 53, -1, -1, 0, 99, -2, -69, +5, -35, 5, -44, 2, 38, 0, 50, 0, 0, 1, 7, 4, 125, 3, -84, 0, 0, 0, 11, -74, 2, 0, 29, 30, +11, 11, 65, 1, 43, 53, 0, -1, -1, 0, 68, -2, -69, 4, 39, 4, 62, 2, 38, 0, 82, 0, 0, 1, 7, +4, 125, 2, -58, 0, 0, 0, 11, -74, 2, 0, 27, 28, 11, 11, 65, 1, 43, 53, 0, -1, -1, 0, 99, -1, +-25, 5, -35, 7, 44, 2, 38, 0, 50, 0, 0, 1, 7, 4, 116, 4, 56, 0, 0, 0, 24, 64, 17, 2, 112, +48, 1, -112, 48, -80, 48, -64, 48, 3, 0, 48, 47, 3, 3, 65, 1, 43, 93, 113, 53, -1, -1, 0, 68, -1, +-24, 4, 39, 6, 13, 2, 38, 0, 82, 0, 0, 1, 7, 4, -123, 3, 42, 0, 0, 0, 22, 64, 15, 2, 0, +46, 16, 46, 2, -112, 46, 1, 0, 46, 45, 4, 4, 65, 1, 43, 93, 113, 53, -1, -1, 0, 99, -1, -25, 5, +-35, 7, 43, 2, 38, 0, 50, 0, 0, 0, 39, 4, 124, 3, 28, 0, 25, 1, 7, 4, 113, 4, 110, 0, 0, +0, 48, -73, 3, -48, 38, 1, 0, 38, 1, 38, -72, -1, -64, 64, 22, 31, 42, 52, 38, 31, 0, 72, 43, 2, +0, 30, 33, 0, 7, 65, 2, 30, 64, 25, 40, 52, 30, 0, 47, 43, 53, 1, 43, 53, 43, 43, 93, 113, 53, +-1, -1, 0, 68, -1, -24, 4, 39, 7, 35, 2, 38, 0, 82, 0, 0, 0, 39, 0, -42, 0, -32, 0, 0, 1, +7, 4, -109, 3, 77, 0, 0, 0, 68, -76, 3, 95, 36, 1, 36, -72, -1, -64, 64, 41, 23, 25, 52, 36, 29, +0, 72, 43, 2, 28, 64, 46, 50, 52, -97, 28, 1, 0, 28, 31, 0, 7, 65, 2, 31, 28, 47, 28, 2, -16, +28, 1, 95, 28, 1, 28, 64, 9, 12, 52, 28, 0, 47, 43, 93, 113, 114, 53, 1, 43, 114, 43, 53, 43, 43, +93, 53, -1, -1, 0, 99, -1, -25, 5, -35, 7, 43, 2, 38, 0, 50, 0, 0, 0, 39, 4, 124, 3, 28, 0, +25, 1, 7, 4, 110, 4, 64, 0, 0, 0, 52, 64, 37, 3, 35, 64, 58, 53, 15, 35, 31, 35, 2, -33, 35, +-1, 35, 2, 15, 35, 1, 35, 32, 0, 72, 43, 2, 0, 30, 33, 0, 7, 65, 2, 30, 64, 25, 40, 52, 30, +0, 47, 43, 53, 1, 43, 53, 43, 93, 113, 114, 43, 53, -1, -1, 0, 68, -1, -24, 4, 39, 7, 35, 2, 38, +0, 82, 0, 0, 0, 39, 0, -42, 0, -32, 0, 0, 1, 7, 4, -110, 3, 47, 0, 0, 0, 67, 64, 49, 3, +33, 64, 38, 51, 52, 33, 64, 23, 30, 52, 33, 30, 0, 72, 43, 2, 28, 64, 46, 50, 52, -97, 28, 1, 0, +28, 31, 0, 7, 65, 2, 31, 28, 47, 28, 2, -16, 28, 1, 95, 28, 1, 28, 64, 9, 12, 52, 28, 0, 47, +43, 93, 113, 114, 53, 1, 43, 114, 43, 53, 43, 43, 43, 53, 0, -1, -1, 0, 99, -1, -25, 5, -35, 7, 44, +2, 38, 0, 50, 0, 0, 0, 39, 4, 124, 3, 28, 0, 25, 1, 7, 4, 117, 4, 96, 0, 0, 0, 49, -79, +3, 54, -72, -1, -64, 64, 29, 28, 32, 52, -80, 54, 1, 0, 54, 1, 0, 54, 53, 30, 33, 65, 2, 0, 30, +33, 0, 7, 65, 2, 30, 64, 25, 40, 52, 30, 0, 47, 43, 53, 1, 43, 53, 43, 93, 113, 43, 53, 0, -1, +-1, 0, 68, -1, -24, 4, 39, 7, 44, 2, 38, 0, 82, 0, 0, 0, 39, 0, -42, 0, -32, 0, 0, 1, 7, +4, 116, 3, 72, 0, 0, 0, 76, 64, 11, 3, 79, 53, 127, 53, -33, 53, -17, 53, 4, 53, -72, -1, -64, 64, +42, 18, 27, 52, 0, 53, 52, 29, 30, 65, 2, 28, 64, 46, 50, 52, -97, 28, 1, 0, 28, 31, 0, 7, 65, +2, 31, 28, 47, 28, 2, -16, 28, 1, 95, 28, 1, 28, 64, 9, 12, 52, 28, 0, 47, 43, 93, 113, 114, 53, +1, 43, 114, 43, 53, 43, 43, 93, 53, -1, -1, 0, 99, -1, -25, 5, -35, 7, 43, 2, 38, 0, 50, 0, 0, +0, 39, 4, 124, 3, 28, 0, 25, 1, 7, 4, -97, 5, -56, 0, 0, 0, 32, 64, 21, 3, 0, 35, 45, 30, +33, 65, 2, 0, 30, 33, 0, 7, 65, 2, 29, 64, 25, 40, 52, 29, 0, 47, 43, 53, 1, 43, 53, 43, 53, +-1, -1, 0, 68, -1, -24, 4, 39, 6, -14, 2, 38, 0, 82, 0, 0, 0, 39, 0, -42, 0, -32, 0, 0, 1, +7, 4, 122, 4, 116, 0, 0, 0, 62, 64, 45, 3, 0, 33, 79, 33, 2, 0, 33, 43, 28, 31, 65, 2, 28, +64, 46, 50, 52, -97, 28, 1, 0, 28, 31, 0, 7, 65, 2, 31, 28, 47, 28, 2, -16, 28, 1, 95, 28, 1, +28, 64, 9, 12, 52, 28, 0, 47, 43, 93, 113, 114, 53, 1, 43, 114, 43, 53, 43, 93, 53, -1, -1, 0, 99, +-2, -69, 5, -35, 6, 104, 2, 38, 0, 50, 0, 0, 0, 39, 4, 124, 3, 28, 0, 25, 1, 7, 4, 125, 3, +-84, 0, 0, 0, 32, 64, 21, 3, 0, 36, 37, 11, 11, 65, 2, 0, 30, 33, 0, 7, 65, 2, 30, 64, 10, +40, 52, 30, 0, 47, 43, 53, 1, 43, 53, 43, 53, -1, -1, 0, 68, -2, -69, 4, 39, 5, -62, 2, 38, 0, +82, 0, 0, 0, 39, 0, -42, 0, -32, 0, 0, 1, 7, 4, 125, 2, -58, 0, 0, 0, 41, 64, 25, 3, 0, +34, 35, 11, 11, 65, 2, 28, 64, 46, 50, 52, -97, 28, 1, 0, 28, 31, 0, 7, 65, 2, 1, 32, -71, 2, +34, 0, 41, 0, 43, 1, 43, 114, 43, 53, 43, 53, 0, -1, -1, 0, 99, -1, -25, 6, -84, 7, 44, 2, 38, +4, 106, 0, 0, 1, 7, 0, -115, 1, -57, 1, 106, 0, 31, 64, 17, 2, 0, 48, 1, 111, 48, -16, 48, 2, +48, 37, 25, 72, 43, 2, 1, 45, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 53, 0, -1, -1, 0, 68, +-1, -24, 5, 0, 5, -62, 2, 38, 4, 107, 0, 0, 1, 7, 0, -115, 0, -12, 0, 0, 0, 33, 64, 19, 2, +0, 48, 1, 79, 48, 95, 48, -113, 48, 3, 48, 37, 49, 72, 43, 2, 1, 45, -71, 2, 34, 0, 41, 0, 43, +1, 43, 93, 113, 53, 0, -1, -1, 0, 99, -1, -25, 6, -84, 7, 44, 2, 38, 4, 106, 0, 0, 1, 7, 0, +67, 1, -61, 1, 106, 0, 32, 64, 9, 2, 15, 46, 1, -1, 46, 1, 46, 37, -72, -1, -30, -76, 72, 43, 2, +1, 45, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 53, -1, -1, 0, 68, -1, -24, 5, 0, 5, -62, 2, +38, 4, 107, 0, 0, 1, 7, 0, 67, 0, -34, 0, 0, 0, 33, 64, 19, 2, 95, 46, 111, 46, 2, 32, 46, +48, 46, 2, 46, 37, 0, 72, 43, 2, 1, 45, -71, 2, 34, 0, 41, 0, 43, 1, 43, 93, 113, 53, 0, -1, +-1, 0, 99, -1, -25, 6, -84, 7, 69, 2, 38, 4, 106, 0, 0, 1, 7, 4, 116, 4, 56, 0, 25, 0, 26, +64, 19, 2, 80, 65, 1, 127, 65, -112, 65, -80, 65, -64, 65, 4, 0, 65, 64, 37, 37, 65, 1, 43, 93, 113, +53, -1, -1, 0, 68, -1, -24, 5, 0, 6, 13, 2, 38, 4, 107, 0, 0, 1, 7, 4, -123, 3, 42, 0, 0, +0, 24, 64, 17, 2, 0, 65, 1, -112, 65, -64, 65, -48, 65, 3, 0, 65, 64, 37, 37, 65, 1, 43, 93, 113, +53, -1, -1, 0, 99, -1, -25, 6, -84, 6, -5, 2, 38, 4, 106, 0, 0, 1, 7, 0, -41, 1, -53, 1, 81, +0, 22, 64, 10, 2, 0, 45, 57, 37, 37, 65, 2, 1, 45, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, +-1, 0, 68, -1, -24, 5, 0, 5, -86, 2, 38, 4, 107, 0, 0, 1, 7, 0, -41, 0, -32, 0, 0, 0, 22, +64, 10, 2, 0, 45, 57, 37, 37, 65, 2, 1, 45, -71, 2, 34, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, +99, -2, -69, 6, -84, 5, -44, 2, 38, 4, 106, 0, 0, 1, 7, 4, 125, 3, -84, 0, 0, 0, 16, 64, 10, +2, 0, 46, 1, 0, 46, 47, 29, 29, 65, 1, 43, 113, 53, -1, -1, 0, 68, -2, -69, 5, 0, 4, 64, 2, +38, 4, 107, 0, 0, 1, 7, 4, 125, 2, -58, 0, 0, 0, 11, -74, 2, 0, 46, 47, 29, 29, 65, 1, 43, +53, 0, -1, -1, 0, -95, -2, -69, 5, 34, 5, -70, 2, 38, 0, 56, 0, 0, 1, 7, 4, 125, 3, 112, 0, +0, 0, 16, 64, 10, 1, 79, 22, 1, 0, 22, 23, 17, 6, 65, 1, 43, 113, 53, -1, -1, 0, -125, -2, -69, +3, -32, 4, 38, 2, 38, 0, 88, 0, 0, 1, 7, 4, 125, 2, -88, 0, 0, 0, 20, 64, 14, 1, 80, 26, +96, 26, 112, 26, 3, 0, 26, 27, 12, 21, 65, 1, 43, 93, 53, -1, -1, 0, -95, -1, -25, 5, 34, 7, 44, +2, 38, 0, 56, 0, 0, 1, 7, 4, 116, 3, -24, 0, 0, 0, 16, 64, 10, 1, -48, 31, 1, 0, 31, 37, +12, 0, 65, 1, 43, 93, 53, -1, -1, 0, -125, -1, -24, 3, -32, 6, 13, 2, 38, 0, 88, 0, 0, 1, 7, +4, -123, 3, 27, 0, 0, 0, 50, 64, 28, 1, 80, 45, -112, 45, -96, 45, -80, 45, 4, 0, 45, 16, 45, 80, +45, 96, 45, 112, 45, -112, 45, -96, 45, -80, 45, 8, 45, -72, -1, -64, 64, 9, 23, 26, 52, 0, 45, 44, 11, +22, 65, 1, 43, 43, 93, 113, 53, -1, -1, 0, -95, -1, -25, 6, -126, 7, 44, 2, 38, 4, 108, 0, 0, 1, +7, 0, -115, 1, -120, 1, 106, 0, 41, -79, 1, 39, -72, -1, -64, 64, 20, 57, 53, 112, 39, 1, 47, 39, 95, +39, -113, 39, 3, 39, 26, 23, 72, 43, 1, 1, 38, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 114, 43, 53, +0, -1, -1, 0, -125, -1, -24, 5, 29, 5, -62, 2, 38, 4, 109, 0, 0, 1, 7, 0, -115, 0, -25, 0, 0, +0, 27, 64, 14, 1, 79, 40, -112, 40, 2, 40, 25, 60, 72, 43, 1, 1, 37, -71, 2, 34, 0, 41, 0, 43, +1, 43, 113, 53, 0, -1, -1, 0, -95, -1, -25, 6, -126, 7, 44, 2, 38, 4, 108, 0, 0, 1, 7, 0, 67, +1, -123, 1, 106, 0, 33, 64, 18, 1, 127, 41, 1, 111, 41, 1, -97, 41, 1, 41, 26, 0, 72, 43, 1, 1, +39, -71, 2, 33, 0, 41, 0, 43, 1, 43, 93, 113, 114, 53, 0, -1, -1, 0, -125, -1, -24, 5, 29, 5, -62, +2, 38, 4, 109, 0, 0, 1, 7, 0, 67, 0, -34, 0, 0, 0, 25, 64, 12, 1, -32, 38, 1, 38, 25, 12, +72, 43, 1, 1, 38, -71, 2, 34, 0, 41, 0, 43, 1, 43, 113, 53, 0, -1, -1, 0, -95, -1, -25, 6, -126, +7, 44, 2, 38, 4, 108, 0, 0, 1, 7, 4, 116, 3, -24, 0, 0, 0, 20, 64, 14, 1, 47, 48, -128, 48, +-48, 48, 3, 0, 48, 54, 20, 31, 65, 1, 43, 93, 53, -1, -1, 0, -125, -1, -24, 5, 29, 6, 13, 2, 38, +4, 109, 0, 0, 1, 7, 4, -123, 3, 27, 0, 0, 0, 36, -79, 1, 57, -72, -1, -64, 64, 16, 22, 24, 6, +85, 80, 57, -96, 57, 2, -112, 57, -96, 57, 2, 57, 25, -72, -1, -25, -79, 72, 43, 1, 43, 93, 113, 43, 53, +-1, -1, 0, -95, -1, -25, 6, -126, 6, -5, 2, 38, 4, 108, 0, 0, 1, 7, 0, -41, 1, -103, 1, 81, 0, +22, 64, 10, 1, 0, 38, 50, 20, 31, 65, 1, 1, 38, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, +0, -125, -1, -24, 5, 29, 5, -86, 2, 38, 4, 109, 0, 0, 1, 7, 0, -41, 0, -26, 0, 0, 0, 32, 64, +18, 1, -17, 37, 1, 37, 64, 83, 84, 52, 0, 37, 49, 19, 31, 65, 1, 1, 37, -71, 2, 34, 0, 41, 0, +43, 1, 43, 43, 113, 53, -1, -1, 0, -95, -2, -69, 6, -126, 5, -70, 2, 38, 4, 108, 0, 0, 1, 7, 4, +125, 3, 112, 0, 0, 0, 16, 64, 10, 1, 79, 39, 1, 0, 39, 40, 26, 14, 65, 1, 43, 113, 53, -1, -1, +0, -125, -2, -69, 5, 29, 4, 38, 2, 38, 4, 109, 0, 0, 1, 7, 4, 125, 2, -88, 0, 0, 0, 20, 64, +14, 1, 80, 38, 96, 38, 112, 38, 3, 0, 38, 39, 21, 29, 65, 1, 43, 93, 53, -1, -1, 0, 6, -2, -69, +5, 70, 5, -70, 2, 38, 0, 60, 0, 0, 1, 7, 4, 125, 3, 52, 0, 0, 0, 11, -74, 1, 0, 14, 15, +0, 12, 65, 1, 43, 53, 0, -1, -1, 0, 33, -2, 81, 3, -18, 4, 38, 2, 38, 0, 92, 0, 0, 1, 7, +4, 125, 3, -84, 0, 0, 0, 11, -74, 1, 0, 28, 28, 18, 18, 65, 1, 43, 53, 0, -1, -1, 0, 6, 0, +0, 5, 70, 7, 44, 2, 38, 0, 60, 0, 0, 1, 7, 4, 116, 3, -74, 0, 0, 0, 18, 64, 12, 1, -48, +23, -32, 23, 2, 0, 23, 29, 3, 9, 65, 1, 43, 93, 53, -1, -1, 0, 33, -2, 81, 3, -18, 6, 13, 2, +38, 0, 92, 0, 0, 1, 7, 4, -123, 2, -8, 0, 0, 0, 65, -79, 1, 47, -72, -1, -64, -76, 24, 24, 6, +85, 47, -72, -1, -64, -76, 20, 21, 6, 85, 47, -72, -1, -64, 64, 15, 15, 17, 6, 85, 31, 47, 112, 47, 2, +-112, 47, -96, 47, 2, 47, -72, -1, -64, -76, 43, 48, 52, 47, 15, -72, -1, -55, -79, 72, 43, 1, 43, 43, 93, +113, 43, 43, 43, 53, 0, -1, -1, 0, 6, 0, 0, 5, 70, 6, -5, 2, 38, 0, 60, 0, 0, 1, 7, 0, +-41, 1, 104, 1, 81, 0, 22, 64, 10, 1, 0, 13, 25, 3, 9, 65, 1, 1, 13, -71, 2, 33, 0, 41, 0, +43, 1, 43, 53, -1, -1, 0, 33, -2, 81, 3, -18, 5, -86, 2, 38, 0, 92, 0, 0, 1, 7, 0, -41, 0, +-66, 0, 0, 0, 22, 64, 10, 1, 0, 27, 39, 12, 18, 65, 1, 1, 27, -71, 2, 34, 0, 41, 0, 43, 1, +43, 53, -1, -1, -1, -3, 0, 0, 5, 89, 7, 33, 2, 54, 0, 36, 0, 0, 1, 23, 0, -33, 1, 54, 1, +95, 0, 22, 64, 10, 2, 0, 20, 17, 1, 2, 65, 2, 1, 19, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, +-1, -1, 0, 74, -1, -24, 4, 28, 5, -62, 2, 54, 0, 68, 0, 0, 1, 23, 0, -33, 0, -11, 0, 0, 0, +30, 64, 16, 2, 96, 61, 1, -32, 61, 1, 0, 61, 58, 28, 28, 65, 2, 1, 60, -71, 2, -61, 0, 41, 0, +43, 1, 43, 93, 113, 53, -1, -1, -1, -30, 0, 0, 2, 91, 7, 33, 2, 54, 0, 44, 0, 0, 1, 23, 0, +-33, -1, -70, 1, 95, 0, 26, 64, 13, 1, 32, 9, 1, 0, 9, 6, 1, 2, 65, 1, 1, 8, -71, 2, 33, +0, 41, 0, 43, 1, 43, 93, 53, -1, -1, -1, -80, 0, 0, 2, 41, 5, -62, 2, 54, 4, -93, 0, 0, 1, +22, 0, -33, -120, 0, 0, 22, 64, 10, 1, 0, 9, 6, 1, 2, 65, 1, 1, 8, -71, 2, -61, 0, 41, 0, +43, 1, 43, 53, -1, -1, 0, 99, -1, -25, 5, -35, 7, 33, 2, 54, 0, 50, 0, 0, 1, 23, 0, -33, 1, +-62, 1, 95, 0, 22, 64, 10, 2, 0, 33, 30, 3, 3, 65, 2, 1, 32, -71, 2, 33, 0, 41, 0, 43, 1, +43, 53, -1, -1, 0, 68, -1, -24, 4, 39, 5, -62, 2, 54, 0, 82, 0, 0, 1, 23, 0, -33, 0, -46, 0, +0, 0, 22, 64, 10, 2, 0, 31, 28, 4, 4, 65, 2, 1, 30, -71, 2, -61, 0, 41, 0, 43, 1, 43, 53, +-1, -1, 0, -95, -1, -25, 5, 34, 7, 33, 2, 54, 0, 56, 0, 0, 1, 23, 0, -33, 1, -112, 1, 95, 0, +22, 64, 10, 1, 0, 26, 23, 11, 1, 65, 1, 1, 25, -71, 2, 33, 0, 41, 0, 43, 1, 43, 53, -1, -1, +0, -125, -1, -24, 3, -32, 5, -62, 2, 54, 0, 88, 0, 0, 1, 23, 0, -33, 0, -36, 0, 0, 0, 22, 64, +10, 1, 0, 30, 27, 10, 23, 65, 1, 1, 29, -71, 2, -61, 0, 41, 0, 43, 1, 43, 53, -1, -1, 0, -95, +-1, -25, 5, 34, 7, 51, 2, 54, 0, 56, 0, 0, 1, 23, 5, 12, 2, -18, 0, 0, 0, 25, 64, 13, 3, +2, 1, 0, 30, 25, 11, 1, 65, 3, 2, 1, 23, 0, 47, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, +0, -125, -1, -24, 3, -32, 6, -47, 2, 38, 0, 88, 0, 0, 0, 39, 0, -114, 0, -36, 0, 0, 1, 7, 0, +-40, 0, -36, 1, 114, 0, 52, 64, 32, 3, 0, 33, 36, 25, 32, 65, 2, 1, 112, 25, 1, 0, 25, 31, 17, +17, 65, 3, -64, 33, 1, 15, 33, 63, 33, 2, 33, 1, 2, 2, 32, -71, 2, 34, 0, 41, 0, 43, 47, 93, +93, 53, 1, 43, 93, 53, 53, 43, 53, -1, -1, 0, -95, -1, -25, 5, 34, 7, 52, 2, 54, 0, 56, 0, 0, +1, 23, 5, 13, 2, -18, 0, 0, 0, 25, 64, 13, 3, 2, 1, 0, 30, 25, 11, 1, 65, 3, 2, 1, 30, +0, 47, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, -125, -1, -24, 3, -32, 7, 52, 2, 38, 0, 88, +0, 0, 0, 39, 0, -114, 0, -36, 0, 0, 1, 7, 0, -115, 0, -25, 1, 114, 0, 61, -71, 0, 3, -1, -16, +64, 18, 33, 33, 27, 27, 65, 2, 1, 112, 25, 1, 0, 25, 31, 17, 17, 65, 3, 33, -72, -1, -64, 64, 13, +15, 17, 52, 33, 64, 10, 12, 52, 33, 1, 2, 2, 25, -71, 2, 34, 0, 41, 0, 43, 47, 43, 43, 53, 1, +43, 93, 53, 53, 43, 53, 0, -1, -1, 0, -95, -1, -25, 5, 34, 7, 52, 2, 54, 0, 56, 0, 0, 1, 23, +5, 14, 2, -18, 0, 0, 0, 25, 64, 13, 3, 2, 1, 0, 33, 21, 11, 1, 65, 3, 2, 1, 33, 0, 47, +53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, -125, -1, -24, 3, -32, 7, 52, 2, 38, 0, 88, 0, 0, +0, 39, 0, -114, 0, -36, 0, 0, 1, 7, 0, -33, 0, -36, 1, 114, 0, 54, 64, 34, 3, 0, 37, 36, 25, +32, 65, 2, 1, 112, 25, 1, 0, 25, 31, 17, 17, 65, 3, 96, 37, -128, 37, 2, 37, 64, 11, 12, 52, 37, +1, 2, 2, 25, -71, 2, 34, 0, 41, 0, 43, 47, 43, 93, 53, 1, 43, 93, 53, 53, 43, 53, -1, -1, 0, +-95, -1, -25, 5, 34, 7, 52, 2, 54, 0, 56, 0, 0, 1, 23, 5, 15, 2, -18, 0, 0, 0, 25, 64, 13, +3, 2, 1, 0, 30, 21, 11, 1, 65, 3, 2, 1, 30, 0, 47, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, +-1, 0, -125, -1, -24, 3, -32, 7, 52, 2, 38, 0, 88, 0, 0, 0, 39, 0, -114, 0, -36, 0, 0, 1, 7, +0, 67, 0, -51, 1, 114, 0, 58, 64, 20, 3, 16, 33, 33, 30, 30, 65, 2, 1, 112, 25, 1, 0, 25, 31, +17, 17, 65, 3, 34, -72, -1, -64, 64, 13, 15, 17, 52, 34, 64, 10, 12, 52, 34, 1, 2, 2, 25, -71, 2, +34, 0, 41, 0, 43, 47, 43, 43, 53, 1, 43, 93, 53, 53, 43, 53, 0, 3, -2, -2, 5, -40, 1, 2, 7, +51, 0, 3, 0, 7, 0, 11, 0, 108, 64, 75, 2, 10, 8, 3, 7, 5, 8, 8, 4, 64, 35, 37, 52, 4, +64, 21, 22, 52, 4, 11, 15, 6, 1, 6, 0, 2, 64, -120, -119, 52, 2, 64, 79, 115, 52, 2, 64, 62, 69, +52, 2, 64, 46, 51, 52, 2, 64, 36, 41, 52, 47, 2, 1, 2, 64, 26, 30, 52, -16, 2, 1, 2, 64, 18, +20, 52, 127, 2, 1, 2, 64, 9, 13, 52, 2, 0, 47, 43, 93, 43, 93, 43, 113, 43, 43, 43, 43, 43, -35, +-34, 93, 60, -35, 43, 43, 60, 1, 47, -34, -35, 60, 16, -35, 60, 49, 48, 1, 33, 53, 33, 17, 35, 53, 51, +5, 35, 53, 51, 1, 2, -3, -4, 2, 4, -121, -121, -2, -125, -121, -121, 6, -66, 117, -2, -91, -109, -109, -109, 0, +3, -2, -2, 5, -40, 1, 2, 7, 52, 0, 3, 0, 7, 0, 11, 0, -100, -77, 3, 1, 2, 0, -72, -1, -64, +-77, 21, 22, 52, 0, -72, -1, -64, 64, 37, 12, 20, 52, 0, 7, 5, 64, 11, 20, 52, 63, 5, 1, 5, 2, +64, 11, 28, 52, 2, 10, 8, 8, 5, 64, 35, 37, 52, 5, 64, 21, 22, 52, 5, 10, 7, 1, -72, -1, -64, +64, 57, 10, 17, 52, 1, 0, 64, -120, -119, 52, 0, 64, 79, 115, 52, 0, 64, 62, 69, 52, 0, 64, 46, 58, +52, 15, 0, 1, 0, 64, 36, 37, 52, 47, 0, 1, 0, 64, 26, 30, 52, -16, 0, 1, 0, 64, 18, 20, 52, +127, 0, 1, 0, 64, 9, 13, 52, 0, 0, 47, 43, 93, 43, 93, 43, 113, 43, 114, 43, 43, 43, 43, -35, 43, +-42, 60, -35, 43, 43, 60, 1, 47, -51, -58, 43, -34, 93, 43, -35, -58, 43, 43, 17, 57, 57, 49, 48, 19, 7, +35, 55, 19, 35, 53, 51, 5, 35, 53, 51, -3, -25, -126, -121, -25, -121, -121, -2, -125, -121, -121, 7, 52, -78, -78, +-2, -92, -109, -109, -109, 0, 3, -2, -2, 5, -40, 1, 2, 7, 52, 0, 3, 0, 10, 0, 14, 0, -27, -78, 9, +10, 8, -72, -1, -64, -77, 48, 52, 52, 8, -72, -1, -100, -73, 21, 22, 52, 8, 6, 5, 4, 7, -72, -1, -64, +64, 28, 35, 37, 52, 7, 64, 11, 22, 52, 7, 13, 11, 10, 64, 49, 52, 52, 10, 100, 21, 22, 52, 10, 4, +64, 35, 37, 52, 4, -72, -1, -64, 64, 20, 12, 22, 52, 4, 3, 1, 64, 15, 20, 52, 1, 64, 11, 14, 52, +63, 1, 1, 1, 11, -72, -1, -64, 64, 25, 12, 22, 52, 11, 12, 1, 64, 35, 37, 52, 1, 64, 21, 22, 52, +1, 14, 3, 64, 43, 44, 52, 3, 9, 5, -72, -1, -64, 64, 58, 9, 17, 52, 5, 4, 8, 64, -120, -119, 52, +8, 64, 79, 115, 52, 8, 64, 62, 69, 52, 8, 64, 46, 58, 52, 15, 8, 1, 8, 64, 36, 37, 52, 47, 8, +1, 8, 64, 26, 30, 52, -16, 8, 1, 8, 64, 18, 20, 52, 127, 8, 1, 8, 64, 9, 13, 52, 8, 0, 47, +43, 93, 43, 93, 43, 113, 43, 114, 43, 43, 43, 43, 60, -35, 43, 57, -42, 43, 60, -35, 43, 43, 60, 1, 47, +43, -34, 93, 43, 43, -35, -42, 43, 43, -51, 43, 43, 16, -35, -42, 43, 43, 17, 57, 57, -51, 43, 43, 17, 57, +49, 48, 1, 35, 53, 51, 39, 7, 35, 39, 51, 23, 55, 3, 35, 53, 51, 1, 2, -121, -121, 30, -94, -118, -100, +-107, 81, 79, -52, -121, -121, 5, -40, -109, -55, -79, -79, 98, 98, -2, -92, -109, 0, 0, 3, -2, -2, 5, -40, 1, +2, 7, 52, 0, 3, 0, 7, 0, 11, 0, -106, 64, 12, 5, 7, 4, 6, 64, 12, 22, 52, 6, 10, 8, 4, +-72, -1, -64, 64, 30, 11, 28, 52, 4, 3, 1, 64, 11, 20, 52, 63, 1, 1, 1, 8, 9, 1, 64, 35, 37, +52, 1, 64, 21, 22, 52, 1, 11, 3, 5, -72, -1, -64, 64, 57, 10, 17, 52, 5, 7, 64, -120, -119, 52, 7, +64, 79, 115, 52, 7, 64, 62, 69, 52, 7, 64, 46, 58, 52, 15, 7, 1, 7, 64, 36, 37, 52, 47, 7, 1, +7, 64, 26, 30, 52, -16, 7, 1, 7, 64, 18, 20, 52, 127, 7, 1, 7, 64, 9, 13, 52, 7, 0, 47, 43, +93, 43, 93, 43, 113, 43, 114, 43, 43, 43, 43, -35, 43, -42, 60, -35, 43, 43, 60, 1, 47, -34, 93, 43, -51, +-58, 43, 16, -35, -58, 43, 17, 57, 57, 49, 48, 1, 35, 53, 51, 39, 35, 39, 51, 3, 35, 53, 51, 1, 2, +-121, -121, -106, -126, -25, -30, 96, -121, -121, 5, -40, -109, 23, -78, -2, -92, -109, 0, 0, 1, -1, -3, 0, 0, 4, +85, 5, -70, 0, 13, 0, 90, 64, 17, 3, 3, 5, 0, 15, 1, 5, 32, 11, 9, 7, 32, 16, 16, 2, 85, +7, -72, -1, -12, -76, 15, 15, 2, 85, 7, -72, -1, -10, -76, 13, 13, 2, 85, 7, -72, -1, -6, 64, 20, 12, +12, 2, 85, 7, 93, 14, 10, 2, 30, 4, 8, 8, 7, 1, 30, 13, 2, 7, 8, 0, 63, 63, -19, 17, 57, +47, -64, -3, -64, 1, 16, -10, 43, 43, 43, 43, -50, -64, -3, -64, 16, -64, 17, 57, 47, 49, 48, 1, 33, 17, +33, 21, 33, 17, 35, 17, 35, 53, 51, 17, 33, 4, 85, -3, 14, 1, -111, -2, 111, -62, -92, -92, 3, -76, 5, +13, -2, 18, -124, -3, 101, 2, -101, -124, 2, -101, 0, 0, 1, 0, 12, 0, 0, 2, -21, 4, 38, 0, 13, 0, +98, 64, 11, 3, 3, 5, 0, 15, 2, 5, 37, 11, 9, 7, -72, -1, -8, -76, 16, 17, 2, 85, 7, -72, -1, +-6, 64, 24, 14, 14, 2, 85, 7, 4, 12, 12, 2, 85, 7, 10, 11, 11, 2, 85, 7, 78, 14, 10, 2, 43, +4, 8, -72, -1, -64, 64, 13, 16, 19, 2, 85, 8, 8, 7, 1, 43, 13, 6, 7, 10, 0, 63, 63, -19, 17, +57, 47, 43, -64, -3, -64, 1, 16, -10, 43, 43, 43, 43, -50, -64, -3, -64, 16, -64, 17, 57, 47, 49, 48, 1, +33, 17, 51, 21, 35, 17, 35, 17, 35, 53, 51, 17, 33, 2, -21, -2, 81, -25, -25, -76, 124, 124, 2, 99, 3, +-111, -2, -11, -124, -3, -2, 2, 2, -124, 1, -96, 0, 0, 1, 0, 7, -2, 105, 7, 91, 5, -69, 0, 70, 1, +19, 64, 95, 56, 49, 1, 55, 36, 71, 36, 2, 8, 20, 24, 20, 2, 69, 13, 1, 41, 6, 57, 6, 2, 36, +38, 38, 32, 25, 27, 20, 25, 25, 27, 27, 25, 30, 41, 17, 18, 18, 32, 19, 20, 20, 19, 19, 20, 20, 22, +19, 41, 10, 30, 19, 10, 5, 3, 3, 32, 69, 68, 20, 69, 69, 68, 66, 68, 8, 69, 49, 47, 47, 32, 63, +61, 20, 63, 63, 61, 63, 61, 43, 54, 2, 32, 0, 69, 43, 8, 32, 10, 12, 16, 16, 2, 85, 10, -72, -1, +-8, -76, 15, 15, 2, 85, 10, -72, -1, -2, -76, 12, 12, 2, 85, 10, -72, -1, -3, 64, 51, 15, 15, 6, 85, +10, 38, 47, 49, 36, 4, 44, 55, 30, 54, 42, 25, 63, 61, 27, 4, 11, 30, 30, 31, 42, 20, 68, 70, 44, +66, 22, 41, 30, 17, 5, 3, 8, 11, 11, 10, 42, 2, 69, 70, 30, 3, 19, 18, 1, 10, 8, 0, 63, -50, +-64, -64, -48, -3, -64, 63, 18, 57, 47, -64, 17, 57, 57, -3, 57, 57, -64, 17, 57, 57, 16, -44, -19, 17, 23, +57, 16, -44, -19, 18, 23, 57, 1, 47, 43, 43, 43, 43, -3, -64, -44, -35, -19, -60, 17, 57, 57, -121, 16, 43, +125, 16, -60, 1, 17, 18, 57, 57, -121, 24, 16, 43, 125, 16, -60, 1, 24, 16, -44, -58, 16, -64, 17, 57, 57, +-121, 16, 43, 125, 16, -60, 1, 17, 18, 57, 57, -121, 24, 16, 43, 125, 16, -60, 49, 48, 1, 93, 93, 93, 93, +93, 1, 35, 17, 35, 3, 38, 39, 38, 35, 17, 35, 17, 34, 7, 6, 7, 55, 6, 3, 35, 1, 54, 55, 38, +39, 38, 39, 38, 38, 7, 7, 53, 54, 51, 50, 23, 22, 23, 22, 23, 22, 23, 17, 51, 17, 50, 55, 54, 55, +54, 55, 54, 51, 50, 23, 21, 34, 38, 35, 34, 7, 6, 7, 6, 7, 6, 7, 22, 23, 19, 51, 7, 91, -84, +69, -12, 93, 46, 90, 124, -57, 96, 73, 66, 106, 1, 11, -9, -15, 1, 46, -118, -114, 100, 58, 36, 54, 63, 92, +87, 78, 11, 101, -72, 93, 41, 62, 77, 36, 68, -104, -57, -106, 70, 37, 76, 62, 39, 93, -77, 95, 23, 13, 51, +13, 103, 57, 32, 51, 54, 35, 58, 100, -115, -118, -61, 107, -2, 105, 1, -105, 1, -114, -104, 46, 90, -3, 82, 2, +-82, 50, 45, -83, 2, 18, -2, 110, 1, -24, -33, 39, 41, 84, 51, -120, -99, 82, 2, 2, -88, 2, -118, 60, -110, +-76, 40, 77, 2, 2, -126, -3, 126, 79, 42, -78, -111, 59, -116, 2, -88, 2, 71, 38, -128, -121, 51, 83, 43, 39, +-33, -2, -59, 0, 0, 1, -1, -5, -2, -45, 5, 80, 4, 38, 0, 66, 1, 49, 64, 59, 7, 35, 1, 104, 6, +1, 36, 38, 38, 12, 16, 16, 2, 85, 38, 12, 15, 16, 6, 85, 38, 37, 23, 25, 20, 23, 23, 25, 25, 23, +29, 41, 15, 16, 16, 15, 12, 13, 6, 85, 16, 37, 17, 18, 20, 17, 17, 18, 18, 20, 17, 41, 10, 29, 17, +10, 48, 47, 47, -72, -1, -12, 64, 23, 15, 16, 6, 85, 47, 37, 59, 57, 20, 59, 59, 57, 59, 57, 44, 53, +2, 37, 66, 65, 5, 3, 3, -72, -1, -15, 64, 25, 12, 13, 6, 85, 3, 37, 65, 63, 20, 65, 63, 63, 62, +44, 65, 44, 9, 37, 10, 14, 15, 16, 2, 85, 10, -72, -1, -10, 64, 11, 14, 14, 2, 85, 10, 8, 13, 13, +2, 85, 10, -72, -1, -14, 64, 59, 11, 11, 2, 85, 10, 9, 16, 16, 6, 85, 10, 25, 57, 23, 59, 4, 8, +53, 43, 48, 36, 38, 47, 4, 44, 52, 42, 29, 43, 30, 42, 63, 65, 44, 20, 62, 41, 43, 5, 18, 15, 3, +3, 8, 11, 11, 10, 42, 6, 17, 16, 10, 66, 65, 43, 3, 1, 10, 10, 0, 63, -50, -48, -3, -64, 16, -48, +-64, 63, 18, 57, 47, -64, 17, 23, 57, -3, 57, 57, -64, 17, 57, 16, -48, -19, 16, -48, 17, 23, 57, -19, 17, +23, 57, 1, 47, 43, 43, 43, 43, 43, -3, -64, -44, 17, 57, 57, -121, 43, 43, 125, 16, -60, 1, 24, 16, -35, +-19, -58, 17, 57, 57, -121, 16, 43, 43, 125, 16, -60, 1, 24, 16, -44, -58, 16, -64, 17, 57, 57, -121, 16, 43, +43, 125, 16, -60, 1, 17, 18, 57, 57, -121, 24, 16, 43, 43, 43, 125, 16, -60, 49, 48, 1, 93, 93, 1, 35, +17, 35, 3, 38, 39, 38, 35, 17, 35, 17, 34, 7, 6, 7, 3, 35, 19, 54, 55, 38, 39, 38, 39, 38, 38, +35, 34, 7, 53, 51, 50, 23, 22, 23, 22, 23, 22, 23, 22, 51, 17, 51, 17, 50, 55, 54, 18, 55, 54, 51, +51, 21, 39, 38, 7, 6, 7, 6, 7, 6, 7, 22, 23, 23, 51, 5, 80, -108, 34, -63, 48, 34, 53, 73, -72, +74, 52, 32, 49, -63, -58, -59, 111, 118, 90, 45, 17, 56, 20, 48, 56, 13, 40, 25, 106, 41, 57, 46, 19, 41, +57, 17, 49, 99, -72, 100, 48, 18, 113, 37, 58, 118, 66, 49, 76, 30, 11, 39, 37, 27, 38, 78, 117, 111, 109, +73, -2, -45, 1, 45, 1, 73, 81, 32, 49, -2, 21, 1, -21, 48, 31, 83, -2, -73, 1, 73, -71, 31, 41, 76, +28, -113, 51, 30, 1, -107, 12, 17, 75, 32, 98, -120, 23, 66, 1, -53, -2, 53, 65, 24, 1, 14, 39, 61, -107, +1, 2, 41, 14, 99, 95, 36, 50, 36, 31, -71, -75, 0, 1, 0, -95, -2, 105, 4, -94, 5, -69, 0, 39, 0, +-5, 64, 15, 23, 37, 1, -119, 20, 1, 8, 19, 1, -119, 6, 1, 5, 3, 3, -72, -1, -12, 64, 47, 11, 11, +6, 85, 3, 12, 14, 16, 6, 85, 3, 32, 38, 36, 20, 38, 38, 36, 103, 36, 1, 38, 36, 35, 3, 8, 39, +18, 16, 16, 32, 32, 30, 20, 32, 32, 30, 55, 30, 1, 32, 30, 13, 24, 2, 32, 39, -72, -1, -10, 64, 10, +11, 11, 2, 85, 39, 41, 13, 8, 32, 10, -72, -1, -26, -76, 16, 16, 2, 85, 10, -72, -1, -10, -76, 15, 15, +2, 85, 10, -72, -1, -10, -76, 13, 13, 2, 85, 10, -72, -1, -6, -76, 12, 12, 2, 85, 10, -72, -1, -8, -76, +12, 12, 6, 85, 10, -72, -1, -16, -76, 13, 13, 6, 85, 10, -72, -1, -12, 64, 35, 15, 15, 6, 85, 10, 93, +40, 32, 30, 8, 27, 30, 16, 18, 13, 21, 12, 36, 38, 35, 13, 30, 5, 3, 8, 8, 9, 12, 2, 38, 30, +3, 1, 9, 8, 0, 63, -50, -48, -19, 63, 18, 57, 47, 18, 57, -19, 57, 17, 57, 16, -44, 17, 57, 57, -19, +17, 57, 57, 1, 16, -10, 43, 43, 43, 43, 43, 43, 43, -3, -64, 16, -42, 43, -19, -58, 17, 57, 57, 93, -121, +16, 43, 125, 16, -60, 1, 17, 18, 23, 57, 93, -121, 24, 16, 43, 43, 43, 125, 16, -60, 49, 48, 1, 93, 93, +93, 93, 1, 35, 17, 35, 3, 38, 39, 38, 35, 17, 35, 17, 51, 17, 50, 55, 54, 55, 54, 55, 54, 51, 50, +23, 21, 34, 38, 35, 34, 7, 6, 7, 6, 7, 6, 7, 22, 23, 19, 51, 4, -94, -84, 69, -11, 92, 44, 90, +119, -62, -62, -112, 70, 37, 74, 62, 39, 93, -76, 112, 6, 13, 52, 13, 103, 57, 32, 51, 55, 34, 57, 101, -114, +-118, -61, 107, -2, 105, 1, -105, 1, -114, -106, 46, 92, -3, 82, 5, -70, -3, 126, 82, 43, -82, -111, 59, -116, 2, +-88, 2, 71, 39, 127, -117, 49, 83, 41, 39, -33, -2, -59, 0, 1, 0, -122, -2, -45, 3, 118, 4, 38, 0, 38, +0, -1, -78, 5, 3, 3, -72, -1, -18, 64, 24, 13, 13, 6, 85, 3, 37, 37, 35, 20, 37, 37, 35, 70, 35, +1, 34, 35, 37, 3, 38, 8, 18, 16, 16, -72, -1, -18, 64, 19, 15, 16, 6, 85, 16, 37, 31, 29, 20, 31, +31, 29, 31, 29, 13, 25, 2, 37, 38, -72, -1, -16, 64, 13, 10, 10, 2, 85, 32, 38, 1, 38, 40, 13, 8, +37, 10, -72, -1, -8, -76, 16, 16, 2, 85, 10, -72, -1, -6, 64, 17, 14, 14, 2, 85, 10, 6, 12, 12, 2, +85, 10, 6, 11, 11, 2, 85, 10, -72, -1, -16, -76, 10, 10, 2, 85, 10, -72, -1, -10, -76, 16, 16, 6, 85, +10, -72, -1, -18, -76, 15, 15, 6, 85, 10, -72, -1, -4, 64, 46, 13, 13, 6, 85, 10, 10, 12, 12, 6, 85, +0, 10, 32, 10, 2, 10, 78, 39, 31, 29, 8, 25, 43, 16, 18, 13, 24, 12, 35, 37, 34, 13, 43, 5, 3, +8, 8, 9, 12, 6, 37, 43, 3, 1, 9, 10, 0, 63, -50, -48, -19, 63, 18, 57, 47, 18, 57, -19, 57, 17, +57, 16, -48, 17, 57, 57, -19, 17, 57, 57, 1, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, -3, -64, +16, -42, 93, 43, -19, -58, 17, 57, 57, -121, 16, 43, 43, 125, 16, -60, 1, 17, 18, 23, 57, 93, -121, 24, 16, +43, 43, 125, 16, -60, 49, 48, 1, 35, 17, 35, 3, 38, 39, 38, 35, 17, 35, 17, 51, 17, 50, 55, 54, 55, +54, 55, 54, 55, 54, 51, 51, 21, 39, 38, 7, 6, 7, 6, 7, 6, 7, 22, 23, 23, 51, 3, 118, -108, 24, +-64, 47, 35, 53, 73, -76, -76, 100, 48, 16, 58, 40, 20, 44, 58, 43, 95, 36, 50, 75, 31, 10, 39, 37, 28, +38, 77, 117, 111, 109, 62, -2, -45, 1, 45, 1, 73, 81, 32, 49, -2, 21, 4, 38, -2, 53, 65, 21, -117, 96, +32, 73, 19, 14, -107, 1, 1, 40, 13, 100, 94, 37, 50, 36, 31, -71, -75, 0, 0, 1, 0, -95, 0, 0, 4, +-94, 5, -69, 0, 43, 1, 36, -74, 4, 38, 1, 22, 38, 36, 38, -72, -1, -28, 64, 56, 13, 16, 6, 85, 38, +32, 20, 22, 20, 20, 20, 22, 73, 20, 89, 20, 105, 20, 3, -122, 36, 1, 20, 36, 30, 18, 5, 42, 1, 3, +1, 18, 13, 16, 6, 85, 1, 32, 0, 42, 20, 0, 0, 42, 3, 0, 41, 5, 10, 11, 12, 2, 85, 5, 17, +6, -72, -1, -18, 64, 23, 16, 16, 2, 85, 6, 10, 11, 12, 2, 85, 6, 6, 9, 30, 15, 0, 1, 0, 45, +14, 9, 32, 11, -72, -1, -26, -76, 16, 16, 2, 85, 11, -72, -1, -10, -76, 15, 15, 2, 85, 11, -72, -1, -10, +-76, 13, 13, 2, 85, 11, -72, -1, -6, -76, 12, 12, 2, 85, 11, -72, -1, -8, -76, 12, 12, 6, 85, 11, -72, +-1, -16, -76, 13, 13, 6, 85, 11, -72, -1, -12, 64, 49, 15, 15, 6, 85, 32, 11, 1, 11, 93, 44, 38, 36, +9, 33, 30, 22, 14, 27, 13, 42, 1, 41, 9, 20, 19, 16, 3, 17, 17, 13, 14, 30, 9, 7, 4, 3, 3, +9, 6, 9, 6, 9, 10, 13, 2, 0, 1, 10, 8, 0, 63, -48, -64, 63, 18, 57, 57, 47, 47, 18, 23, 57, +16, -19, 17, 57, 47, 23, 57, 17, 57, 17, 57, 16, -44, 17, 57, -19, 17, 57, 57, 1, 16, -10, 93, 43, 43, +43, 43, 43, 43, 43, -3, -64, 16, -42, 93, -58, 17, 57, 47, 43, 43, -64, -51, 43, 50, 17, 57, -121, 16, 43, +43, -121, 125, -60, 1, 16, -64, 17, 57, 57, 93, 93, -121, 24, 16, 43, 43, -121, 125, -60, 1, 93, 49, 48, 33, +35, 3, 38, 39, 17, 35, 17, 38, 35, 17, 35, 17, 51, 17, 50, 55, 17, 51, 17, 54, 55, 54, 55, 54, 55, +54, 51, 50, 23, 21, 34, 38, 35, 34, 7, 6, 7, 6, 7, 6, 7, 22, 23, 4, -94, -15, -11, 58, 47, 120, +51, 69, -62, -62, 71, 49, 120, 38, 47, 55, 26, 54, 78, 72, 89, 112, 6, 13, 52, 13, 103, 57, 32, 51, 55, +34, 57, 101, -114, -118, 1, -114, 95, 60, -2, -58, 1, -89, 24, -3, 82, 5, -70, -3, 126, 15, 1, -109, -2, -38, +65, 110, -126, 42, 88, 44, 40, 2, -88, 2, 71, 39, 127, -117, 49, 83, 41, 39, -33, 0, 1, 0, -122, 0, 0, +3, -112, 4, 38, 0, 40, 1, 52, -74, 105, 21, 1, 22, 35, 33, 35, -72, -1, -18, 64, 74, 13, 17, 6, 85, +35, 37, 20, 22, 20, 20, 20, 22, -65, 33, 1, -21, 33, 1, -97, 33, -33, 33, 2, 20, 33, 29, 19, 5, 39, +1, 3, 1, 8, 15, 16, 6, 85, 1, 37, 0, 39, 20, 0, 0, 39, 3, 0, 38, 5, 16, 6, 6, 11, 14, +2, 85, 6, 6, 9, -81, 29, -65, 29, 2, 29, -49, 0, 1, 0, 42, 14, 9, 37, 11, -72, -1, -8, -76, 16, +16, 2, 85, 11, -72, -1, -6, 64, 17, 14, 14, 2, 85, 11, 6, 12, 12, 2, 85, 11, 6, 11, 11, 2, 85, +11, -72, -1, -10, -76, 16, 16, 6, 85, 11, -72, -1, -18, -76, 15, 15, 6, 85, 11, -72, -1, -4, 64, 59, 13, +13, 6, 85, 11, 10, 12, 12, 6, 85, 0, 11, 32, 11, 48, 11, 3, 11, 78, 41, 35, 33, 9, 29, 43, 22, +14, 28, 13, 39, 0, 38, 9, 20, 19, 16, 3, 17, 17, 13, 14, 43, 9, 7, 4, 3, 3, 9, 6, 9, 6, +9, 10, 13, 6, 0, 1, 10, 10, 0, 63, -48, -64, 63, 18, 57, 57, 47, 47, 18, 23, 57, 16, -19, 17, 57, +47, 23, 57, 17, 57, 17, 57, 16, -48, 17, 57, -19, 17, 57, 57, 1, 16, -10, 93, 43, 43, 43, 43, 43, 43, +43, 43, -3, -64, 16, -43, 114, -58, 114, 17, 57, 47, 43, -64, -51, 50, 17, 57, -121, 16, 43, 43, -121, 125, -60, +1, 16, -64, 17, 57, 57, 93, 93, 114, -121, 24, 16, 43, 43, -121, 125, -60, -79, 6, 2, 67, 84, 88, 64, 9, +45, 6, 34, 17, 61, 6, 50, 17, 4, 0, 93, 89, 49, 48, 1, 93, 33, 35, 3, 38, 39, 21, 35, 17, 38, +35, 17, 35, 17, 51, 17, 50, 55, 17, 51, 21, 54, 55, 54, 55, 54, 55, 54, 51, 51, 21, 39, 38, 7, 6, +7, 6, 7, 6, 7, 22, 23, 3, -112, -58, -64, 14, 17, 99, 35, 43, -76, -76, 45, 33, 99, 21, 24, 40, 20, +44, 58, 43, 95, 36, 50, 75, 31, 10, 39, 41, 34, 41, 54, 106, 112, 1, 73, 24, 25, -42, 1, 55, 16, -2, +21, 4, 38, -2, 53, 10, 1, 68, -47, 43, 57, 96, 32, 73, 19, 14, -107, 1, 1, 40, 13, 100, 104, 40, 48, +25, 28, -68, 0, 1, 0, -92, -2, 105, 5, -88, 5, -70, 0, 15, 0, -82, 64, 20, 11, 4, 32, 14, 2, 32, +0, 12, 12, 12, 2, 85, 0, 10, 12, 13, 6, 85, 0, 14, -72, -1, -18, -76, 15, 15, 2, 85, 14, -72, -1, +-14, 64, 11, 13, 13, 2, 85, 14, 16, 12, 12, 2, 85, 14, -72, -1, -14, 64, 22, 11, 11, 6, 85, 14, 10, +15, 15, 6, 85, 14, 17, 10, 5, 32, 7, 32, 16, 16, 2, 85, 7, -72, -1, -10, -76, 15, 15, 2, 85, 7, +-72, -1, -10, -76, 13, 13, 2, 85, 7, -72, -1, -6, -76, 12, 12, 2, 85, 7, -72, -1, -9, -76, 12, 13, 6, +85, 7, -72, -1, -14, 64, 21, 15, 16, 6, 85, 7, 93, 16, 11, 30, 5, 5, 6, 12, 9, 2, 14, 30, 3, +1, 6, 8, 0, 63, -50, -48, -19, 63, -64, 18, 57, 47, -19, 1, 16, -10, 43, 43, 43, 43, 43, 43, -3, -64, +16, -44, 43, 43, 43, 43, 43, -35, 43, 43, -19, 16, -3, -64, 49, 48, 1, 35, 17, 35, 17, 33, 17, 35, 17, +51, 17, 33, 17, 51, 17, 51, 5, -88, -84, -100, -3, 6, -62, -62, 2, -6, -62, -122, -2, 105, 1, -105, 2, -77, +-3, 77, 5, -70, -3, -90, 2, 90, -6, -13, 0, 1, 0, -120, -2, -45, 4, 87, 4, 38, 0, 15, 0, -5, 64, +44, 11, 3, 37, 14, 2, 37, 17, 64, 11, 11, 2, 85, 0, 20, 13, 13, 2, 85, 0, 12, 11, 11, 2, 85, +0, 12, 15, 15, 6, 85, 0, 14, 12, 13, 6, 85, 0, 10, 11, 11, 6, 85, 0, 14, -72, -1, -6, -76, 17, +17, 2, 85, 14, -72, -1, -20, 64, 11, 16, 16, 2, 85, 14, 20, 14, 14, 2, 85, 14, -72, -1, -20, 64, 17, +13, 13, 2, 85, 14, 10, 12, 12, 2, 85, 14, 34, 11, 11, 2, 85, 14, -72, -1, -33, -76, 16, 16, 6, 85, +14, -72, -1, -10, -76, 12, 13, 6, 85, 14, -72, -1, -8, 64, 10, 11, 11, 6, 85, 14, 17, 10, 5, 37, 7, +-72, -1, -10, -76, 17, 17, 2, 85, 7, -72, -1, -6, -76, 16, 16, 2, 85, 7, -72, -1, -6, 64, 17, 14, 14, +2, 85, 7, 4, 12, 12, 2, 85, 7, 10, 11, 11, 2, 85, 7, -72, -1, -13, 64, 32, 15, 16, 6, 85, 7, +10, 11, 11, 6, 85, 0, 7, 32, 7, 2, 7, 78, 16, 11, 43, 5, 5, 6, 12, 9, 6, 15, 43, 3, 1, +6, 8, 0, 63, -50, -48, -19, 63, -64, 18, 57, 47, -19, 1, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, -3, +-64, 16, -44, 43, 43, 43, 43, 43, 43, 43, 43, 43, -35, 43, 43, 43, 43, 43, 43, -19, 16, -3, -64, 49, 48, +1, 35, 17, 35, 17, 33, 17, 35, 17, 51, 17, 33, 17, 51, 17, 51, 4, 87, -108, -108, -2, 13, -76, -76, 1, +-13, -76, 116, -2, -45, 1, 45, 1, -41, -2, 41, 4, 38, -2, 70, 1, -70, -4, 110, 0, 0, 1, -1, -3, 0, +0, 4, 109, 5, -70, 0, 12, 0, -70, -71, 0, 9, -1, -22, -76, 13, 16, 2, 85, 9, -72, -1, -12, 64, 58, +13, 16, 6, 85, 9, 12, 16, 16, 6, 85, 9, 12, 9, 6, 12, 32, 0, 1, 20, 0, 0, 1, 9, 6, 6, +18, 13, 13, 2, 85, 6, 8, 12, 13, 6, 85, 6, 32, 5, 4, 20, 5, 4, 111, 5, 1, 5, 4, 0, 1, +32, 4, 4, 16, 16, 2, 85, 4, -72, -1, -28, -76, 15, 15, 2, 85, 4, -72, -1, -12, 64, 11, 13, 13, 2, +85, 4, 6, 12, 12, 2, 85, 4, -72, -1, -4, -76, 12, 13, 6, 85, 4, -72, -1, -6, 64, 24, 16, 16, 6, +85, 4, 0, 12, 6, 1, 9, 6, 38, 4, 54, 4, 2, 4, 4, 3, 5, 6, 2, 3, 8, 0, 63, 63, -64, +18, 57, 47, 93, 18, 57, -64, 16, -48, -64, 1, 47, 43, 43, 43, 43, 43, 43, -3, -51, 16, -35, 93, -121, 43, +43, 43, 125, 16, -60, -121, 24, 16, 43, 8, 125, 16, -60, 1, 43, 0, 43, 43, 49, 48, 1, 1, 17, 35, 17, +1, 51, 1, 22, 23, 54, 55, 1, 4, 109, -2, 36, -76, -2, 32, -56, 1, 34, 48, 28, 25, 57, 1, 18, 5, +-70, -4, -72, -3, -114, 2, 114, 3, 72, -3, -4, 85, 69, 57, 106, 1, -5, 0, 0, 1, 0, 20, -2, 105, 3, +-19, 4, 38, 0, 12, 0, -42, -71, 0, 9, -1, -18, 64, 11, 15, 17, 2, 85, 9, 10, 13, 13, 2, 85, 9, +-72, -1, -20, -76, 9, 11, 2, 85, 9, -72, -1, -12, 64, 61, 14, 16, 6, 85, 9, 11, 11, 11, 6, 85, 9, +12, 9, 6, 12, 15, 15, 15, 6, 85, 12, 37, 0, 1, 20, 0, 0, 1, 9, 6, 6, 4, 11, 11, 6, 85, +6, 15, 13, 13, 6, 85, 6, 37, 5, 4, 20, 5, 4, 5, 4, 0, 1, 37, 4, 18, 17, 17, 2, 85, 4, +-72, -1, -16, -76, 16, 16, 2, 85, 4, -72, -1, -8, 64, 17, 15, 15, 2, 85, 4, 10, 13, 13, 2, 85, 4, +10, 9, 9, 2, 85, 4, -72, -1, -4, -76, 13, 13, 6, 85, 4, -72, -1, -2, 64, 27, 16, 16, 6, 85, 4, +9, 4, 12, 5, 0, 6, 6, 1, 36, 4, 52, 4, 68, 4, 116, 4, -124, 4, 5, 4, 10, 2, 0, 47, 63, +93, -64, 63, -64, -64, -64, 18, 57, 1, 47, 43, 43, 43, 43, 43, 43, 43, -3, -51, 16, -35, -121, 43, 43, 43, +125, 16, -60, -121, 24, 16, 43, 43, 8, 125, 16, -60, 1, 43, 0, 43, 43, 43, 43, 49, 48, 1, 1, 17, 35, +17, 1, 51, 19, 22, 23, 54, 55, 19, 3, -19, -2, 110, -76, -2, 109, -62, -35, 46, 31, 29, 49, -35, 4, 38, +-5, -38, -2, 105, 1, -105, 4, 38, -3, -103, 127, 119, 109, -119, 2, 103, 0, 0, 1, -1, -3, 0, 0, 4, 109, +5, -70, 0, 18, 0, -47, -71, 0, 15, -1, -22, -76, 13, 17, 2, 85, 15, -72, -1, -18, 64, 72, 15, 16, 6, +85, 1, 0, 4, 15, 18, 15, 12, 18, 8, 16, 17, 2, 85, 18, 8, 13, 16, 6, 85, 18, 32, 0, 4, 20, +0, 0, 4, 10, 11, 7, 15, 12, 12, 18, 13, 13, 2, 85, 12, 4, 12, 13, 6, 85, 12, 32, 11, 7, 20, +11, 7, 9, 11, 7, 1, 4, 18, 2, 0, 4, 32, 7, 4, 16, 16, 2, 85, 7, -72, -1, -28, -76, 15, 15, +2, 85, 7, -72, -1, -12, 64, 11, 13, 13, 2, 85, 7, 6, 12, 12, 2, 85, 7, -72, -1, -4, -76, 16, 16, +6, 85, 7, -72, -1, -4, 64, 21, 12, 13, 6, 85, 7, 15, 12, 2, 9, 30, 4, 7, 7, 6, 18, 11, 0, +12, 2, 6, 8, 0, 63, 63, -64, -64, -64, 18, 57, 47, -64, -3, -64, 18, 57, 1, 47, 43, 43, 43, 43, 43, +43, -3, -36, -58, 51, 18, 57, 16, -36, -58, -121, 43, 43, 43, 125, 16, -60, 1, 17, 18, 57, -121, 24, 16, 43, +43, 43, 8, 125, 16, -60, 1, 17, 18, 57, 0, 43, 43, 49, 48, 1, 1, 33, 21, 33, 17, 35, 17, 33, 53, +33, 1, 51, 1, 22, 23, 54, 55, 1, 4, 109, -2, 107, 1, 85, -2, 100, -76, -2, 97, 1, 85, -2, 106, -56, +1, 34, 48, 28, 25, 57, 1, 18, 5, -70, -3, 57, -108, -3, -95, 2, 95, -108, 2, -57, -3, -4, 85, 69, 57, +106, 1, -5, 0, 1, 0, 20, -2, 105, 3, -19, 4, 38, 0, 18, 0, -22, 64, 19, 38, 13, 70, 13, 118, 13, +-122, 13, 4, 38, 17, 70, 17, 118, 17, -122, 17, 4, 15, -72, -1, -18, 64, 11, 15, 17, 2, 85, 15, 10, 13, +13, 2, 85, 15, -72, -1, -20, -76, 9, 11, 2, 85, 15, -72, -1, -30, 64, 71, 14, 16, 6, 85, 15, 11, 13, +13, 6, 85, 15, 11, 11, 11, 6, 85, 15, 18, 15, 12, 18, 15, 15, 15, 6, 85, 18, 37, 0, 1, 20, 0, +0, 1, 15, 12, 12, 4, 11, 11, 6, 85, 12, 10, 13, 13, 6, 85, 12, 37, 11, 10, 20, 11, 10, 9, 11, +10, 2, 0, 5, 1, 37, 6, 10, 18, 17, 17, 2, 85, 10, -72, -1, -16, -76, 16, 16, 2, 85, 10, -72, -1, +-8, 64, 17, 15, 15, 2, 85, 10, 10, 13, 13, 2, 85, 10, 10, 9, 9, 2, 85, 10, -72, -1, -4, 64, 19, +13, 13, 6, 85, 10, 15, 10, 18, 11, 0, 12, 6, 3, 8, 43, 1, 10, 10, 6, 0, 47, 63, -64, -3, -64, +63, -64, -64, -64, 18, 57, 1, 47, 43, 43, 43, 43, 43, 43, -64, -3, -64, -35, -58, 16, -35, -58, -121, 43, 43, +43, 125, 16, -60, -121, 24, 16, 43, 43, 8, 125, 16, -60, 1, 43, 43, 0, 43, 43, 43, 43, 49, 48, 0, 93, +93, 1, 1, 33, 21, 33, 17, 35, 17, 33, 53, 33, 1, 51, 19, 22, 23, 54, 55, 19, 3, -19, -2, 110, 1, +66, -2, -66, -76, -2, -67, 1, 67, -2, 109, -62, -35, 46, 31, 29, 49, -35, 4, 38, -5, -38, -124, -2, -19, 1, +19, -124, 4, 38, -3, -103, 127, 119, 109, -119, 2, 103, 0, 0, 1, 0, 9, -2, 105, 5, 73, 5, -70, 0, 23, +1, 8, -71, 0, 16, -1, -12, 64, 27, 11, 11, 2, 85, 105, 3, 1, 68, 21, 116, 21, -124, 21, 3, 73, 11, +1, 22, 13, 1, 6, 14, 12, 17, 2, 85, 16, -72, -1, -14, -76, 12, 17, 2, 85, 21, -72, -1, -8, 64, 10, +12, 17, 2, 85, 11, 8, 12, 17, 2, 85, -79, 6, 2, 67, 84, 88, -73, 2, 32, 23, 23, 10, 25, 24, 16, +-72, -1, -24, 64, 21, 10, 17, 52, 6, 24, 10, 17, 52, 6, 11, 21, 16, 4, 10, 12, 3, 10, 8, 19, 12, +2, 0, 63, 60, 63, 60, 17, 18, 23, 57, 43, 43, 1, 17, 18, 57, 57, 47, -19, 27, 64, 48, 6, 9, 20, +3, 12, 21, 9, 20, 22, 13, 16, 10, 19, 22, 13, 11, 10, 19, 3, 12, 13, 3, 12, 3, 32, 22, 13, 20, +22, 22, 13, 2, 32, 0, 22, 20, 19, 9, 20, 9, 32, 10, 19, 20, 10, 10, 19, 20, -72, -1, -18, 64, 33, +9, 12, 2, 85, 20, 16, 10, 12, 4, 9, 12, 2, 85, 12, 16, 16, 21, 11, 6, 4, 9, 20, 19, 12, 13, +2, 22, 30, 3, 10, 9, 8, 1, 0, 47, 63, -64, -48, -19, 63, -64, -64, -64, 18, 23, 57, 1, 47, -35, 43, +-58, 16, -51, 43, -121, 16, 43, -121, 125, -60, 1, 24, 16, -42, -35, -19, -121, 16, 43, -121, 125, -60, 15, 15, 15, +15, 89, 43, 43, 0, 43, 43, 49, 48, 1, 93, 93, 93, 93, 0, 43, 1, 35, 17, 35, 1, 38, 39, 6, 7, +1, 35, 1, 1, 51, 1, 22, 23, 54, 55, 1, 51, 1, 1, 51, 5, 73, -84, 68, -2, -113, 25, 39, 52, 18, +-2, -112, -23, 2, 55, -2, 12, -25, 1, 10, 84, 34, 45, 71, 1, 39, -45, -3, -3, 1, -82, 125, -2, 105, 1, +-105, 2, 11, 36, 62, 86, 24, -2, 1, 2, -4, 2, -66, -2, -120, 119, 61, 73, 94, 1, -123, -3, 77, -3, -90, +0, 1, 0, 15, -2, -45, 3, -15, 4, 38, 0, 19, 1, 28, 64, 21, 38, 17, 70, 17, -122, 17, 3, 38, 4, +70, 4, 2, 88, 7, 1, 38, 17, 70, 17, 2, 12, -72, -1, -20, 64, 11, 11, 11, 6, 85, 4, 40, 13, 17, +6, 85, 12, -72, -1, -40, 64, 40, 13, 17, 6, 85, 12, 20, 11, 11, 6, 85, 12, 10, 13, 13, 6, 85, 4, +5, 16, 3, 8, 17, 5, 16, 18, 9, 12, 6, 15, 18, 9, 7, 6, 15, 3, 8, 3, 9, 18, 9, -72, -1, +-8, 64, 15, 13, 17, 2, 85, 9, 37, 8, 3, 20, 8, 8, 3, 2, 37, 0, -72, -1, -3, 64, 29, 12, 12, +6, 85, 0, 10, 13, 13, 6, 85, 0, 12, 15, 16, 6, 85, 0, -107, 18, 1, 48, 18, 1, 18, 16, 15, 5, +16, 5, -72, -1, -8, 64, 30, 13, 17, 2, 85, 5, 37, 6, 15, 20, 6, 6, 15, 95, 16, 111, 16, -97, 16, +3, 16, 12, 6, -96, 8, 1, 8, 17, 7, 4, 12, -72, -1, -10, -76, 13, 13, 2, 85, 12, -72, -1, -10, 64, +26, 10, 10, 2, 85, 32, 12, 1, 12, 12, 17, 7, 4, 4, 5, 16, 15, 8, 9, 6, 18, 43, 3, 6, 5, +10, 1, 0, 47, 63, -64, -48, -19, 63, -64, -64, -64, 18, 23, 57, 1, 47, 93, 43, 43, 51, 51, 51, -35, 93, +-58, 16, -51, 93, -121, 16, 43, 43, -121, 125, -60, 1, 24, 16, -42, 93, 93, -35, 43, 43, 43, -19, -121, 16, 43, +43, -121, 125, -60, 15, 15, 15, 15, 1, 43, 43, 0, 43, 43, 43, 49, 48, 0, 93, 93, 93, 1, 93, 1, 35, +17, 35, 1, 1, 35, 1, 1, 51, 23, 22, 23, 54, 55, 55, 51, 1, 1, 51, 3, -15, -108, 73, -2, -20, -2, +-23, -38, 1, -124, -2, -103, -31, -93, 42, 32, 35, 46, -77, -41, -2, -111, 1, 36, 103, -2, -45, 1, 45, 1, -93, +-2, 93, 2, 40, 1, -2, -7, 64, 55, 52, 65, -5, -2, 12, -2, 98, 0, 1, 0, 87, 0, 0, 4, -76, 5, +-70, 0, 29, 1, 56, 64, 15, 100, 20, 1, 69, 20, 85, 20, 2, 54, 20, 1, 24, 4, 23, 6, -72, -1, -14, +64, 11, 16, 16, 2, 85, 6, 4, 13, 13, 2, 85, 6, -72, -1, -14, 64, 11, 12, 12, 2, 85, 6, 14, 16, +16, 6, 85, 6, -72, -1, -8, -76, 15, 15, 6, 85, 6, -72, -1, -14, 64, 11, 12, 12, 6, 85, 6, 6, 17, +27, 29, 32, 1, -72, -1, -8, -76, 16, 16, 2, 85, 1, -72, -1, -28, 64, 11, 15, 15, 2, 85, 1, 30, 13, +13, 2, 85, 1, -72, -1, -2, -76, 12, 12, 2, 85, 1, -72, -1, -24, 64, 23, 11, 11, 2, 85, 1, 10, 16, +16, 6, 85, 1, 18, 15, 15, 6, 85, 1, 8, 13, 13, 6, 85, 1, -72, -1, -2, 64, 45, 12, 12, 6, 85, +1, 14, 11, 11, 6, 85, 1, 31, 17, 32, 15, 10, 16, 16, 2, 85, 15, 20, 15, 15, 2, 85, 15, 22, 13, +13, 2, 85, 15, 26, 12, 12, 2, 85, 15, 18, 11, 11, 2, 85, 15, -72, -1, -20, 64, 17, 16, 16, 6, 85, +15, 14, 13, 13, 6, 85, 15, 24, 12, 12, 6, 85, 15, -72, -1, -4, 64, 33, 11, 11, 6, 85, 0, 15, 1, +15, 93, 30, 24, 24, 28, 27, 25, 22, 21, 30, 9, 7, 4, 2, 9, 6, 9, 6, 9, 1, 17, 28, 2, 1, +8, 0, 63, 63, -64, 18, 57, 57, 47, 47, 17, 51, 51, 51, 16, -19, 50, 50, 50, 17, 57, 47, 1, 16, -10, +93, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, -44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, -64, +17, 57, 47, 43, 43, 43, 43, 43, 43, -64, -35, -64, 49, 48, 93, 93, 93, 33, 35, 17, 6, 7, 17, 35, 17, +6, 35, 34, 39, 38, 39, 38, 53, 17, 51, 17, 20, 22, 55, 51, 17, 51, 17, 54, 55, 17, 51, 4, -76, -62, +-94, -118, 120, 22, 15, -118, 116, -128, 44, 40, -62, -79, 121, 11, 120, -111, -101, -62, 2, 79, 60, 23, -2, -23, 1, +10, 1, 62, 70, 121, 111, -79, 1, -81, -2, 99, -17, -103, 1, 1, -62, -2, 71, 20, 62, 2, -55, 0, 1, 0, +69, 0, 0, 3, -93, 4, 38, 0, 30, 1, 28, 64, 30, 116, 21, -124, 21, 2, 101, 21, 1, 25, 4, 14, 12, +12, 2, 85, 4, 14, 11, 12, 6, 85, 4, 24, 6, 10, 15, 16, 2, 85, 6, -72, -1, -10, -76, 12, 12, 2, +85, 6, -72, -1, -8, 64, 17, 11, 12, 6, 85, 6, 14, 15, 15, 6, 85, 6, 6, 17, 28, 30, 37, 1, -72, +-1, -52, 64, 17, 16, 16, 2, 85, 1, 32, 15, 15, 2, 85, 1, 8, 13, 13, 2, 85, 1, -72, -1, -10, -76, +10, 11, 2, 85, 1, -72, -1, -8, -76, 11, 12, 6, 85, 1, -72, -1, -4, 64, 27, 13, 13, 6, 85, 1, 14, +15, 15, 6, 85, 1, 24, 16, 16, 6, 85, 31, 1, 1, 0, 1, 1, 1, 32, 17, 37, 14, -72, -1, -32, 64, +17, 16, 16, 2, 85, 14, 28, 15, 15, 2, 85, 14, 22, 13, 13, 2, 85, 14, -72, -1, -4, 64, 58, 12, 12, +2, 85, 14, 22, 11, 12, 6, 85, 14, 24, 13, 13, 6, 85, 14, 24, 15, 15, 6, 85, 14, 28, 16, 16, 6, +85, 79, 14, 95, 14, 2, 14, 31, 25, 25, 23, 29, 16, 28, 26, 23, 43, 8, 7, 4, 2, 8, 6, 8, 6, +8, 1, 16, 6, 1, 10, 0, 63, 63, 18, 57, 57, 47, 47, 17, 51, 51, 51, 16, -19, 50, 50, 16, -64, 17, +57, 47, 1, 16, -42, 93, 43, 43, 43, 43, 43, 43, 43, 43, -19, 16, -44, 93, 93, 43, 43, 43, 43, 43, 43, +43, 43, -19, -64, 17, 57, 47, 43, 43, 43, 43, -64, -35, 43, 43, -64, 49, 48, 93, 93, 33, 35, 17, 6, 7, +21, 35, 53, 35, 34, 39, 38, 39, 38, 53, 17, 51, 21, 20, 23, 22, 23, 22, 23, 17, 51, 17, 54, 55, 17, +51, 3, -93, -76, 110, 100, 99, 21, 89, 94, 100, 36, 33, -76, 9, 18, 63, 44, 59, 99, 87, 123, -76, 1, -84, +34, 12, -42, -48, 55, 59, 98, 89, 107, 1, 22, -55, 116, 43, 84, 47, 33, 8, 1, 21, -2, -21, 10, 41, 1, +-31, 0, 0, 1, 0, -95, 0, 0, 4, -2, 5, -70, 0, 21, 0, -57, 64, 24, 103, 19, 1, 91, 4, 1, 74, +4, 1, 21, 32, 1, 20, 16, 16, 2, 85, 1, 2, 13, 13, 2, 85, 1, -72, -1, -32, -76, 12, 12, 2, 85, +1, -72, -1, -48, -76, 11, 11, 6, 85, 1, -72, -1, -30, -76, 12, 12, 6, 85, 1, -72, -1, -16, -76, 13, 13, +6, 85, 1, -72, -1, -16, -76, 15, 15, 6, 85, 1, -72, -1, -24, 64, 16, 16, 16, 6, 85, 1, 23, 9, 13, +32, 11, 32, 16, 16, 2, 85, 11, -72, -1, -10, -76, 15, 15, 2, 85, 11, -72, -1, -10, -76, 13, 13, 2, 85, +11, -72, -1, -6, -76, 12, 12, 2, 85, 11, -72, -1, -8, -76, 12, 12, 6, 85, 11, -72, -1, -19, -76, 13, 13, +6, 85, 11, -72, -1, -29, 64, 19, 15, 15, 6, 85, 11, 93, 22, 8, 6, 30, 13, 15, 15, 9, 12, 2, 1, +9, 8, 0, 63, -64, 63, 18, 57, 47, 51, -19, 50, 1, 16, -10, 43, 43, 43, 43, 43, 43, 43, -3, -64, 16, +-44, 43, 43, 43, 43, 43, 43, 43, 43, -19, 49, 48, 93, 93, 93, 33, 35, 17, 52, 39, 38, 35, 34, 7, 17, +35, 17, 51, 17, 36, 51, 50, 23, 22, 23, 22, 21, 4, -2, -62, 56, 71, -85, -51, -30, -62, -62, 1, 5, -60, +-117, 115, -127, 44, 39, 1, -99, -72, 92, 115, 91, -3, 55, 5, -70, -3, -79, 97, 62, 69, 122, 109, -77, 0, -1, +-1, 0, -121, 0, 0, 3, -24, 5, -70, 2, 22, 0, 75, 0, 0, 0, 2, 0, 99, -1, -25, 5, -80, 5, -45, +0, 26, 0, 33, 0, -75, 64, 53, -118, 32, 1, 109, 32, 1, 92, 32, 1, 26, 32, 74, 32, 2, 98, 30, 1, +85, 30, 1, 68, 30, 1, 21, 30, 1, -122, 29, 1, 119, 24, 1, 57, 19, 73, 19, 2, -124, 15, 1, 118, 15, +1, 106, 12, 1, 25, 12, 1, 10, 27, 38, 0, -72, -1, -22, -76, 15, 15, 2, 85, 0, -72, -1, -20, -76, 11, +11, 2, 85, 0, -72, -1, -8, -76, 12, 12, 6, 85, 0, -72, -1, -21, -76, 11, 11, 6, 85, 0, -72, -1, -13, +64, 38, 13, 13, 6, 85, 0, 92, 35, 16, 38, 17, 28, 38, 32, 8, 1, 8, 99, 34, 28, 30, 17, 16, 47, +16, 1, 9, 16, 9, 16, 31, 14, 30, 21, 3, 31, 30, 4, 9, 0, 63, -19, 63, -19, 17, 57, 57, 47, 47, +93, 17, 51, -19, 1, 16, -10, 93, -19, -44, -19, 16, -10, 43, 43, 43, 43, 43, -3, -59, 49, 48, 93, 93, 93, +93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 1, 18, 7, 6, 33, 32, 39, 38, 17, 53, 33, 38, 39, +38, 35, 32, 3, 39, 54, 55, 54, 51, 50, 23, 22, 23, 22, 3, 33, 22, 18, 51, 50, 18, 5, -87, 7, -91, +-86, -2, -91, -2, -90, -86, -97, 4, 117, 12, 117, 124, -40, -2, -61, 83, -66, 56, -96, -103, -36, -56, -97, -93, 82, +71, -59, -4, 76, 11, -4, -45, -45, -4, 2, -19, -2, -77, -39, -32, -32, -46, 1, 84, 94, -36, 126, -124, -2, -51, +50, -48, 112, 107, 98, 99, -76, -102, -2, -34, -10, -2, -30, 1, 30, 0, 2, 0, 85, -1, -24, 4, 40, 4, 62, +0, 23, 0, 32, 0, -50, 64, 45, 56, 31, 72, 31, 2, 85, 21, 101, 21, 2, -118, 19, 1, 121, 19, 1, 92, +19, 108, 19, 2, 74, 13, 1, 40, 13, 56, 13, 2, 108, 6, 1, 91, 6, 1, 99, 3, 1, 85, 3, 1, 24, +11, 36, 0, -72, -1, -26, -76, 15, 15, 2, 85, 0, -72, -1, -22, -76, 13, 13, 2, 85, 0, -72, -1, -22, -76, +11, 11, 2, 85, 0, -72, -1, -18, -76, 15, 15, 6, 85, 0, -72, -1, -14, 64, 71, 11, 13, 6, 85, 0, 7, +34, 17, 36, 18, 25, 36, 10, 12, 14, 15, 2, 85, 10, 20, 12, 13, 2, 85, 10, 28, 11, 13, 6, 85, 31, +10, 63, 10, 79, 10, 3, 10, 52, 33, 25, 43, -97, 11, -81, 11, 2, 18, 17, 15, 17, 31, 17, -97, 17, -81, +17, 4, 11, 17, 11, 17, 29, 15, 28, 20, 7, 29, 28, 4, 11, 0, 63, -19, 63, -19, 17, 57, 57, 47, 47, +93, 17, 51, 93, -19, 1, 16, -10, 93, 43, 43, 43, -19, -42, -19, 16, -2, 43, 43, 43, 43, 43, -19, 50, 49, +48, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 1, 20, 7, 6, 35, 34, 39, 38, 53, 52, 55, 33, 38, +39, 38, 35, 34, 7, 39, 18, 33, 50, 23, 22, 3, 33, 22, 23, 22, 51, 50, 55, 54, 4, 40, 123, -123, -16, +-22, -126, 119, 1, 3, 24, 9, 76, 86, -106, -54, 78, -70, 93, 1, 118, -11, -122, 127, -60, -3, -81, 12, 56, 86, +-119, -125, 83, 79, 2, 28, -10, -103, -91, -93, -106, -16, 16, 32, -100, 96, 109, -38, 23, 1, 87, -104, -111, -2, -104, +-122, 67, 104, 88, 84, 0, 0, 3, 0, 96, -1, -25, 5, -38, 5, -44, 0, 17, 0, 26, 0, 35, 0, -57, 64, +56, 89, 34, 1, 26, 34, 1, 22, 30, 86, 30, 2, -124, 24, 1, 117, 24, 1, 84, 24, 1, 22, 24, 70, 24, +2, 86, 23, 1, -118, 20, 1, 121, 20, 1, 92, 20, 1, 73, 20, 1, 26, 20, 1, 89, 16, 1, 120, 12, 1, +89, 2, 1, 27, 18, 38, 0, -72, -1, -24, 64, 11, 16, 16, 2, 85, 0, 8, 15, 15, 2, 85, 0, -72, -1, +-18, -76, 13, 13, 2, 85, 0, -72, -1, -16, -76, 12, 12, 2, 85, 0, -72, -1, -12, -76, 13, 13, 6, 85, 0, +-72, -1, -6, 64, 47, 12, 12, 6, 85, 0, 92, 37, 26, 28, 38, 10, 6, 12, 12, 6, 85, 32, 10, 1, 10, +99, 36, 18, 30, 28, 64, 16, 17, 2, 85, 28, 64, 13, 14, 2, 85, 28, 28, 32, 22, 30, 14, 3, 32, 30, +4, 9, 0, 63, -19, 63, -19, 17, 57, 47, 43, 43, -19, 1, 16, -10, 93, 43, -3, -59, 16, -10, 43, 43, 43, +43, 43, 43, -3, -64, 49, 48, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 1, 16, +7, 6, 33, 34, 39, 38, 39, 38, 53, 16, 55, 54, 33, 32, 23, 22, 7, 38, 39, 38, 35, 34, 7, 6, 7, +5, 33, 22, 23, 22, 51, 50, 55, 54, 5, -38, -71, -62, -2, -66, -49, -89, -82, 79, 74, -78, -65, 1, 77, 1, +69, -64, -73, -52, 19, 117, -116, -37, -41, -112, 118, 21, 3, -31, -4, 28, 15, 119, -120, -28, -37, -122, 126, 2, -37, +-2, -71, -47, -36, 103, 106, -70, -81, -87, 1, 84, -44, -30, -35, -46, -14, -37, -125, -100, -109, 120, -17, -84, -49, -117, +-96, -109, -120, 0, 3, 0, 68, -1, -24, 4, 39, 4, 62, 0, 15, 0, 24, 0, 33, 1, 18, 64, 68, 92, 32, +108, 32, 2, 83, 28, 99, 28, 2, 100, 22, 1, 85, 22, 1, 55, 22, 71, 22, 2, 91, 18, 107, 18, 2, 72, +18, 1, 57, 18, 1, 105, 14, 1, 88, 14, 1, 102, 10, 1, 102, 6, 1, 85, 6, 1, 90, 2, 106, 2, 2, +16, 25, 36, 35, 64, 13, 13, 2, 85, 35, 64, 11, 11, 2, 85, 0, -72, -1, -14, 64, 17, 15, 15, 2, 85, +0, 18, 13, 13, 2, 85, 0, 16, 11, 11, 2, 85, 0, -72, -1, -16, -76, 11, 11, 6, 85, 0, -72, -1, -25, +-76, 13, 13, 6, 85, 0, -72, -1, -8, -76, 15, 15, 6, 85, 0, -72, -1, -22, 64, 47, 12, 12, 6, 85, 0, +55, 35, 24, 26, 36, 8, 8, 14, 15, 2, 85, 8, 32, 13, 13, 2, 85, 8, 24, 12, 12, 2, 85, 8, 28, +11, 11, 2, 85, 8, 18, 11, 11, 6, 85, 8, 28, 13, 13, 6, 85, 8, -72, -1, -4, 64, 44, 15, 15, 6, +85, 8, 4, 16, 16, 6, 85, 8, 32, 12, 12, 6, 85, 31, 8, 63, 8, 79, 8, 3, 8, 52, 34, 16, 43, +-112, 26, -96, 26, 2, 26, 26, 30, 20, 28, 12, 7, 30, 28, 4, 11, 0, 63, -19, 63, -19, 17, 57, 47, 93, +-19, 1, 16, -10, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, -3, -59, 16, -10, 43, 43, 43, 43, 43, 43, 43, +43, 43, -3, -59, 49, 48, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 1, 16, 7, 6, 35, +34, 39, 38, 53, 16, 55, 54, 51, 50, 23, 22, 7, 38, 39, 38, 35, 34, 7, 6, 7, 5, 33, 22, 23, 22, +51, 50, 55, 54, 4, 39, -16, 117, -116, -14, -123, 123, -92, -119, -59, -21, -122, -128, -65, 17, 66, 89, -122, -121, 89, +66, 17, 2, 106, -3, -111, 8, 73, 84, -109, -109, 83, 72, 2, 34, -2, -116, -123, 65, -97, -108, -8, 1, 39, -114, +118, -101, -109, -105, -127, 74, 101, 101, 74, -127, -108, -102, 97, 110, 111, 96, 0, 1, 0, 58, 1, 37, 5, -75, 3, +-64, 0, 28, 0, 124, 64, 33, 121, 22, -119, 22, 2, 88, 22, 104, 22, 2, -127, 16, 1, 114, 16, 1, 100, 16, +1, 85, 16, 1, 40, 3, 1, 9, 3, 1, 24, 24, 0, 23, 19, -72, 3, 3, -77, 64, 0, 30, 10, -72, 2, +-5, 64, 9, 32, 0, 9, 16, 9, 2, 9, 9, 14, 65, 14, 3, 3, 0, 5, 0, 23, 2, -17, 0, 24, 3, +4, 0, 10, 0, 9, 3, 4, 0, 18, 2, -17, 0, 1, 2, -21, 1, 42, -123, 0, 63, -19, 63, 51, 63, -19, +1, 47, -19, 50, 25, 47, 93, 26, -19, 16, -48, 26, 24, -3, -50, 17, 57, 25, 47, 49, 48, 93, 93, 93, 93, +93, 93, 93, 93, 1, 33, 34, 39, 38, 53, 52, 55, 54, 55, 23, 6, 7, 6, 21, 20, 23, 22, 51, 33, 53, +52, 38, 39, 55, 22, 23, 22, 21, 5, -75, -4, 70, -64, 114, -113, 42, 15, 57, 30, 22, 21, 29, 124, 111, -86, +3, 79, 54, 65, 77, 44, 9, 68, 1, 37, 67, 84, -77, 93, 97, 35, 98, 19, 46, 46, 71, 56, 118, 65, 58, +27, 112, -115, 50, -93, 55, 14, 112, -42, 0, 1, -1, -70, 1, 37, 1, -12, 3, -90, 0, 12, 0, 66, 64, 18, +-116, 6, 1, 125, 6, 1, 90, 6, 106, 6, 2, 8, 8, 31, 7, 1, 7, 3, -72, 3, 3, -77, 0, 14, 1, +7, -65, 2, -17, 0, 8, 3, 4, 0, 3, 2, -17, 0, 1, 2, -21, 1, 42, -123, 0, 63, -19, 63, -19, 1, +47, 16, -48, -3, -50, 114, 57, 25, 47, 49, 48, 93, 93, 93, 1, 33, 53, 33, 52, 39, 38, 39, 55, 22, 23, +22, 21, 1, -12, -3, -58, 1, -15, 28, 19, 75, 78, 72, 18, 27, 1, 37, -82, 118, 62, 43, 81, -93, 91, 51, +77, -78, 0, 2, -1, -70, 1, 37, 2, 36, 4, 91, 0, 21, 0, 33, 0, 76, -71, 0, 13, 3, 12, 64, 14, +-116, 22, 1, 107, 22, 123, 22, 2, 22, 5, 29, 29, 2, 3, -72, 3, 12, -77, 0, 35, 2, 17, -72, 2, -17, +-77, 26, 26, 5, 31, -72, 2, -17, -78, 9, 9, 3, -70, 2, -17, 0, 1, 2, -21, 0, 63, -19, 50, 47, -19, +57, 50, 47, -19, 1, 47, 16, -48, -19, 17, 57, 47, 57, 57, 93, 93, -19, 49, 48, 1, 33, 53, 33, 52, 39, +6, 7, 6, 35, 34, 39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 21, 3, 38, 39, 38, 35, 34, 6, 21, 20, +51, 50, 54, 2, 36, -3, -106, 2, 21, 21, 52, 28, 46, 35, 73, 46, 53, 50, 56, 90, 122, 66, 55, -93, 14, +31, 42, 38, 27, 35, 88, 23, 52, 1, 37, -82, 89, 78, 17, 7, 12, 37, 42, 79, -117, 104, 116, -65, -98, -43, +1, 4, 36, 37, 50, 45, 31, 80, 18, 0, 2, -1, -70, 1, 37, 2, 26, 3, -13, 0, 18, 0, 29, 0, 68, +-75, 120, 21, -120, 21, 2, 10, -72, 3, 12, -76, 26, 26, 2, 6, 19, -72, 3, 12, -77, 0, 31, 2, 14, -72, +2, -17, 64, 9, 23, 23, 11, 6, 1, 6, 19, 19, 3, -70, 2, -17, 0, 1, 2, -21, 0, 63, -19, 50, 47, +57, 93, 51, 47, -19, 1, 47, 16, -48, -19, 57, 17, 57, 47, -19, 49, 48, 93, 1, 33, 53, 33, 50, 54, 55, +38, 39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 21, 39, 38, 39, 38, 35, 34, 6, 21, 20, 23, 22, 2, 26, +-3, -96, 1, 87, 62, 87, 51, -84, 51, 115, 55, 62, 89, 102, 53, 42, 90, 23, 21, 41, 58, 28, 40, 79, 28, +1, 37, -82, 9, 15, 25, 22, 50, 120, 105, 93, 105, -126, 103, -116, 4, 80, 39, 75, 44, 30, 76, 26, 9, 0, +0, 2, 0, 70, -1, 103, 4, -89, 3, -113, 0, 45, 0, 58, 0, -60, 64, 51, -117, 25, 1, 76, 25, 1, 58, +25, 1, 41, 25, 1, 24, 25, 1, -124, 21, 1, 118, 21, 1, 101, 21, 1, 86, 21, 1, 87, 16, 103, 16, 119, +16, 3, -123, 15, 1, 87, 10, 1, 8, 6, 1, 84, 1, 100, 1, 116, 1, 3, 37, -72, 2, -3, 64, 19, -118, +46, 1, 124, 46, 1, 75, 46, 91, 46, 107, 46, 3, 46, 30, 53, 53, 19, 27, -72, 3, 3, -74, 64, 0, 60, +4, 13, 1, 13, -72, 2, -5, 64, 11, 32, 0, 12, 16, 12, 32, 12, 3, 12, 12, 19, -72, 3, 3, -77, 8, +46, 56, 41, -72, 2, -17, -77, 50, 50, 30, 33, -72, 2, -17, -77, 56, 56, 13, 12, -67, 3, 7, 0, 23, 2, +-17, 0, 4, 3, 17, 1, 42, -123, 0, 63, -19, 63, 51, 57, 47, -19, 57, 51, 47, -19, 18, 57, 1, 47, -19, +50, 25, 47, 93, 26, -19, 93, 16, -48, 26, 24, -19, 17, 57, 47, 57, 57, 93, 93, 93, -19, 49, 48, 93, 93, +93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 37, 20, 7, 6, 33, 34, 39, 38, 53, 52, 55, 54, 55, +23, 6, 7, 6, 7, 6, 21, 20, 23, 22, 51, 50, 55, 54, 53, 52, 38, 39, 6, 6, 35, 34, 39, 38, 53, +52, 55, 54, 51, 50, 23, 22, 21, 39, 38, 39, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 4, -89, -66, -85, +-2, -27, -33, 122, -124, 38, 35, 65, 42, 29, 20, 27, 12, 15, 110, 102, -57, -43, -96, -71, 7, 9, 38, 77, 39, +88, 55, 67, 58, 65, 89, 117, 68, 58, -97, 26, 11, 28, 42, 48, 45, 58, 37, 26, 45, -14, -58, 104, 93, 80, +87, -85, 118, -126, 120, 120, 18, 70, 54, 74, 53, 67, 63, -126, 62, 57, 70, 81, -118, 51, 45, 23, 18, 21, 40, +48, 97, 113, 103, 116, -96, -120, -77, -79, 62, 15, 41, 46, 35, 31, 36, 15, 0, 0, 1, 0, -98, -1, -95, 1, +-114, 0, -121, 0, 3, 0, 29, -78, 3, 1, 0, -72, 3, 1, -77, 2, 2, 0, 3, -71, 3, 2, 0, 1, 0, +47, -19, 57, 57, 1, 47, -19, 57, 57, 49, 48, 37, 7, 39, 55, 1, -114, 78, -94, 74, 50, -111, 84, -110, 0, +2, 0, 16, -1, 76, 1, -28, 0, -116, 0, 3, 0, 7, 0, 80, 64, 21, 103, 5, 119, 5, -121, 5, -89, 5, +4, -104, 4, -72, 4, -56, 4, -40, 4, 4, 7, 5, 6, -72, 3, 1, -77, 4, 3, 1, 0, -72, 3, 1, -75, +2, 2, 4, 6, 4, 5, -72, 3, 2, -77, 7, 2, 0, 3, -71, 3, 2, 0, 1, 0, 47, -3, 57, 57, -42, +-19, 57, 57, 1, 47, 51, 47, -19, 57, 57, 16, -19, 57, 57, 49, 48, 0, 113, 1, 113, 37, 7, 39, 55, 7, +7, 39, 55, 1, -28, 74, -92, 76, 66, 75, -91, 78, 56, -111, 84, -111, -79, -113, 85, -112, 0, 0, 3, 0, 27, +-2, -103, 1, -17, 0, -116, 0, 3, 0, 7, 0, 11, 0, -119, 64, 13, -87, 11, -71, 11, -55, 11, 3, -102, 11, +1, 9, 11, 10, -72, 3, 1, 64, 14, 8, -87, 5, -71, 5, -55, 5, 3, -102, 5, 1, 7, 5, 4, -72, 3, +1, 64, 16, 6, 6, 8, -59, 1, 1, -106, 1, -90, 1, -74, 1, 3, 1, 3, 2, -72, 3, 1, -75, 0, 0, +8, 10, 8, 9, -72, 3, 2, -75, 11, 11, 1, 4, 6, 5, -72, 3, 2, 64, 10, -97, 7, -81, 7, 2, 7, +7, 2, 0, 3, -71, 3, 2, 0, 1, 0, 47, -19, 57, 57, 51, 47, 93, -19, 57, 57, 17, 51, 47, -19, 57, +57, 1, 47, 51, 47, -19, 57, 57, 93, 93, 17, 51, 47, -19, 57, 57, 93, 93, 16, -19, 57, 57, 93, 93, 49, +48, 37, 7, 39, 55, 1, 7, 39, 55, 7, 7, 39, 55, 1, 42, 77, -96, 74, 1, 104, 78, -94, 75, 65, 76, +-94, 74, 54, -110, 86, -110, -2, -8, -112, 86, -113, -81, -111, 84, -111, 0, 3, 0, 16, -2, -103, 1, -28, 0, -116, +0, 3, 0, 7, 0, 11, 0, -126, 64, 13, -59, 11, 1, -106, 11, -90, 11, -74, 11, 3, 11, 9, 10, -72, 3, +1, 64, 14, 8, -54, 7, 1, -103, 7, -87, 7, -71, 7, 3, 7, 5, 4, -72, 3, 1, 64, 16, 6, 6, 8, +-59, 1, 1, -106, 1, -90, 1, -74, 1, 3, 3, 1, 0, -72, 3, 1, -75, 2, 2, 8, 4, 6, 5, -72, 3, +2, -75, 7, 7, 1, 10, 8, 9, -72, 3, 2, -76, 11, 11, 2, 0, 3, -71, 3, 2, 0, 1, 0, 47, -19, +57, 57, 50, 47, -19, 57, 57, 17, 51, 47, -19, 57, 57, 1, 47, 51, 47, -19, 57, 57, 93, 93, 17, 51, 47, +-19, 57, 57, 93, 93, 16, -19, 57, 57, 93, 93, 49, 48, 37, 7, 39, 55, 19, 7, 39, 55, 39, 7, 39, 55, +1, -28, 74, -92, 76, -128, 74, -93, 77, 34, 75, -91, 78, 56, -111, 84, -111, -2, -97, -110, 86, -110, 90, -113, 85, +-112, 0, 2, 0, 107, -2, -84, 1, -121, 0, -116, 0, 3, 0, 7, 0, 62, -78, 7, 5, 4, -72, 3, 1, -77, +6, 3, 1, 0, -72, 3, 1, 64, 9, 16, 2, 32, 2, 2, 2, 6, 4, 5, -72, 3, 2, -76, 7, 7, 2, +0, 3, -71, 3, 2, 0, 1, 0, 47, -19, 57, 57, 51, 47, -19, 57, 57, 1, 47, 93, -19, 57, 57, -34, -19, +57, 57, 49, 48, 37, 7, 39, 55, 19, 7, 39, 55, 1, 89, 74, -92, 76, -48, 74, -93, 77, 56, -111, 84, -111, +-2, -78, -110, 86, -110, 0, 4, -1, -7, -2, 81, 1, -5, 0, -116, 0, 3, 0, 7, 0, 11, 0, 15, 0, -64, +64, 13, 58, 12, 1, 9, 12, 25, 12, 41, 12, 3, 14, 12, 13, -72, 3, 1, 64, 14, 15, 53, 11, 1, 6, +11, 22, 11, 38, 11, 3, 11, 9, 10, -72, 3, 1, 64, 14, 8, 53, 7, 1, 6, 7, 22, 7, 38, 7, 3, +7, 5, 4, -72, 3, 1, 64, 21, 6, 6, 8, 8, 15, 58, 1, 1, 3, 15, 1, 31, 1, 47, 1, 3, 18, +5, 3, 1, 0, -72, 3, 1, -75, 2, 2, 15, 6, 4, 7, -72, 3, 2, -75, 5, 5, 9, 2, 0, 3, -72, +3, 2, -76, 1, 1, 13, 15, 14, -72, 3, 2, -76, 12, 12, 10, 8, 11, -72, 3, 2, -73, 9, 64, 9, 64, +12, 17, 52, 9, 0, 47, 43, 0, 26, 24, 16, 77, -19, 57, 57, 50, 47, -19, 57, 57, 51, 47, -19, 57, 57, +17, 51, 47, -19, 57, 57, 1, 47, 51, 47, -19, 57, 57, 95, 94, 93, 95, 93, 17, 51, 47, 51, 47, -19, 57, +57, 93, 93, 16, -19, 57, 57, 93, 93, 16, -19, 57, 57, 93, 93, 49, 48, 37, 7, 39, 55, 19, 7, 39, 55, +7, 7, 39, 55, 55, 39, 55, 23, 1, -53, 77, -96, 74, -45, 78, -94, 75, 65, 76, -94, 74, 40, -96, 70, -89, +54, -110, 86, -110, -2, -80, -112, 86, -113, -81, -111, 84, -111, 19, 90, -112, 90, 0, 2, -1, -50, 4, 38, 2, 39, +6, -96, 0, 37, 0, 46, 0, -90, 64, 22, 38, 0, 37, 48, 37, 64, 37, 112, 37, -128, 37, 5, 10, 3, 37, +48, 22, 25, 16, 16, 14, 20, -72, -1, -64, 64, 52, 7, 14, 52, 20, 25, 64, 14, 13, 7, 44, 40, 9, 20, +52, 44, 5, 7, 31, 79, 27, 95, 27, 2, 27, 27, 48, -17, 2, -1, 2, 2, 2, 25, 13, 14, 20, 14, 20, +22, 15, 16, 31, 16, 2, 7, 16, 1, 5, 31, 3, 35, 40, -72, -1, -64, 64, 18, 7, 14, 52, 40, 3, 44, +31, 1, 63, 1, 95, 1, 127, 1, -97, 1, 5, 1, -72, 1, 42, -123, 0, 47, 93, -35, -64, -34, 43, -51, 17, +57, 57, 16, -36, 94, 93, -52, 57, 57, 47, 47, 57, 57, 1, 47, 93, 18, 57, 47, 93, 51, -51, 50, 50, 43, +1, 24, 16, -42, -59, 26, -35, -51, 43, 17, 57, 25, 47, 17, 57, 16, -48, 95, 94, 93, 24, -51, 49, 48, 1, +33, 53, 51, 50, 55, 54, 53, 52, 39, 38, 39, 38, 39, 39, 54, 55, 22, 23, 22, 23, 6, 7, 38, 39, 39, +22, 21, 20, 7, 6, 7, 54, 55, 54, 51, 50, 21, 7, 52, 35, 34, 7, 6, 7, 51, 50, 2, 39, -3, -89, +73, 63, 71, 19, 10, 8, 13, 7, 13, 29, 8, 19, 8, 32, 20, 32, 2, 14, 4, 14, 6, 38, 7, 2, 6, +81, 26, 72, 48, 126, 76, 96, 63, 96, 39, 25, -49, 112, 4, 38, 83, 44, 46, 45, 49, 64, 49, 56, 30, 47, +14, 65, 42, 24, 13, 8, 3, 31, 64, 1, 3, 2, 127, 86, 32, 43, 13, 33, 47, 12, 34, -120, 1, 50, 50, +20, 16, 0, 2, 0, 15, 5, -37, 1, -81, 7, 33, 0, 19, 0, 26, 0, 124, 64, 82, 7, 23, 23, 23, 39, +23, 3, -26, 23, -10, 23, 2, 24, 15, 16, 31, 16, 47, 16, 3, 8, 16, 16, 13, 127, 20, -113, 20, 2, 20, +0, 28, 11, 7, 0, 13, 16, 13, 2, 11, 13, 22, 0, 18, 1, 68, 0, 18, 1, 112, 18, 1, 18, 126, 11, +1, 79, 11, 95, 11, 111, 11, 3, 11, 5, 16, -16, 25, 1, 95, 25, 111, 25, -81, 25, 3, -81, 25, -65, 25, +2, 25, -72, 1, 52, -123, 0, 47, 93, 113, 93, -64, -35, -58, 93, 93, 47, 113, 114, 94, 93, -51, 1, 47, 94, +93, -51, 50, 16, -44, -51, 113, 18, 57, 47, 94, 93, -51, 49, 48, 93, 113, 1, 20, 7, 6, 35, 35, 34, 21, +20, 23, 22, 7, 38, 53, 52, 51, 51, 54, 51, 50, 7, 52, 35, 34, 7, 51, 50, 1, -81, 48, 52, 72, -89, +31, 2, 1, 1, 48, 76, 24, 118, 116, 82, 90, 32, 55, 85, 82, 90, 6, -67, 53, 44, 48, 45, 5, 13, 12, +6, 49, 52, 66, -97, 99, 38, 98, 0, 1, -1, -11, 5, -8, 1, 110, 7, 30, 0, 38, 0, -18, -71, 0, 1, +-1, -32, 64, 124, 16, 20, 52, -102, 23, -86, 23, 2, 4, 1, 20, 1, -60, 1, -44, 1, 4, 37, 1, 53, 1, +69, 1, 3, 29, 33, 27, 19, 21, 27, 27, 0, 12, 33, 0, 21, 16, 21, 2, 21, 21, 12, -97, 0, 1, -113, +0, -97, 0, -81, 0, 3, 126, 0, 1, 0, 40, 11, 0, 12, 16, 12, 2, 11, 12, 29, 8, 29, 51, 52, 0, +29, 37, 31, 25, 57, 19, 73, 19, 89, 19, -103, 19, -87, 19, 5, 8, 19, 24, 19, 40, 19, 104, 19, 120, 19, +-120, 19, 6, 18, 19, 17, 37, 12, 11, 14, 9, 9, 6, 64, 15, 17, 31, 17, 79, 17, 95, 17, 4, 19, 3, +17, 37, 37, -72, -1, -64, 64, 33, 14, 17, 52, 15, 37, 31, 37, 95, 37, 3, 64, 63, 37, 79, 37, -113, 37, +-97, 37, -81, 37, 5, -96, 37, -80, 37, 2, 32, 37, 48, 37, 2, 37, -72, 1, 74, -123, 0, 47, 93, 114, 113, +94, 93, 43, 0, 24, 16, -44, 95, 94, 93, 26, -51, 57, 47, -51, -58, 50, 17, 18, 57, 94, 93, 93, 47, -51, +17, 57, 57, 43, 1, 47, 94, 93, 51, 16, -58, 93, 93, 113, 17, 57, 47, 113, -51, 17, 18, 57, 47, 17, 57, +17, 18, 57, 49, 48, 0, 93, 93, 113, 43, 1, 20, 7, 6, 7, 6, 35, 34, 38, 35, 34, 7, 39, 54, 51, +50, 22, 51, 50, 55, 38, 53, 52, 55, 54, 51, 50, 21, 20, 7, 38, 35, 34, 21, 20, 23, 22, 51, 50, 1, +110, 94, 76, 53, 7, 9, 16, 57, 11, 17, 26, 11, 40, 30, 20, 48, 19, 22, 18, 68, 53, 59, 45, 49, 23, +31, 36, 65, 53, 49, 24, 33, 6, 122, 40, 33, 26, 17, 2, 23, 35, 13, 70, 22, 13, 35, 36, 31, 56, 62, +49, 23, 38, 28, 30, 19, 25, 23, 0, 1, 0, -92, 4, -41, 1, -20, 5, -67, 0, 6, 0, 87, 64, 58, -42, +2, -26, 2, -10, 2, 3, 4, 2, -64, 3, 1, 53, 3, 1, 4, 3, 20, 3, 36, 3, 3, 3, -39, 1, -23, +1, -7, 1, 3, 1, 6, -49, 0, 1, 58, 0, 1, 11, 0, 27, 0, 43, 0, 3, 0, 64, 5, 0, -32, 3, +-16, 3, 2, 3, -128, 5, 2, 0, 47, -51, 26, -35, 93, -64, 1, 25, 47, 26, -51, 93, 93, 113, 57, 57, 93, +-51, 93, 93, 113, 57, 57, 93, 49, 48, 1, 7, 35, 39, 51, 23, 55, 1, -20, -120, 56, -120, 87, 77, 77, 5, +-67, -26, -26, -116, -116, 0, 1, 0, -92, 4, -41, 1, -20, 5, -67, 0, 6, 0, 87, 64, 58, -42, 5, -26, 5, +-10, 5, 3, 3, 5, -64, 4, 1, 53, 4, 1, 4, 4, 20, 4, 36, 4, 3, 4, -39, 6, -23, 6, -7, 6, +3, 6, 1, -49, 0, 1, 58, 0, 1, 11, 0, 27, 0, 43, 0, 3, 0, 2, 2, 64, -32, 5, -16, 5, 2, +5, -128, 0, 4, 0, 47, -64, 26, -35, 93, 26, -51, 1, 25, 47, -51, 93, 93, 113, 57, 57, 93, -51, 93, 93, +113, 57, 57, 93, 49, 48, 1, 35, 39, 7, 35, 55, 51, 1, -20, 87, 77, 77, 87, -120, 56, 4, -41, -116, -116, +-26, 0, 0, 1, 0, 14, 5, -119, 1, -90, 5, -7, 0, 15, 0, -113, 64, 101, 23, 12, 1, 6, 12, 1, -25, +12, -9, 12, 2, 105, 3, 1, 90, 3, 1, 41, 3, 57, 3, 73, 3, 3, -37, 3, 1, -55, 3, 1, -69, 3, +1, -103, 3, -87, 3, 2, 122, 3, -118, 3, 2, 107, 3, 1, 58, 3, 74, 3, 90, 3, 3, -39, 3, 1, -54, +3, 1, -103, 3, -87, 3, -71, 3, 3, 15, 0, 7, 8, 0, 2, 15, 13, 2, 8, 7, 10, 112, 7, 1, 97, +7, 1, 48, 7, 64, 7, 80, 7, 3, 7, -97, 5, -81, 5, -65, 5, 3, 5, 2, 0, 47, -44, 93, -58, 114, +114, 114, -51, 17, 57, 16, -35, -58, 17, 57, 1, 47, 51, -52, 50, 49, 48, 0, 93, 93, 93, 113, 113, 113, 113, +113, 113, 113, 114, 114, 114, 113, 114, 114, 1, 6, 35, 34, 38, 35, 34, 7, 39, 54, 51, 50, 22, 51, 50, 55, +1, -90, 64, 82, 60, 118, 22, 19, 32, 11, 46, 51, 17, -123, 42, 53, 52, 5, -46, 73, 48, 14, 13, 65, 48, +23, 0, 0, 1, 0, 86, 5, -35, 1, 110, 7, 10, 0, 31, 0, 87, -71, 0, 2, -1, -32, 64, 14, 11, 17, +52, 21, 7, 18, 18, 26, 0, 0, 26, 5, 5, 11, -72, 3, 5, -73, 26, 21, 0, 23, 7, 29, 5, 5, -72, +-1, -64, -74, 18, 25, 52, 5, 29, 29, 23, -72, 2, -11, -77, 79, 15, 1, 15, -72, 1, 74, -123, 0, 47, 93, +-19, 50, 47, 51, 43, 47, 18, 57, 17, 57, 57, 1, 47, -19, 50, 47, 17, 51, 47, 18, 57, 47, 57, 57, 49, +48, 0, 43, 1, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, 50, 22, 21, 20, 6, 7, +38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 1, 110, 31, 21, 42, -70, 100, 31, 16, 21, 53, 59, 45, 20, 29, +12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 6, 102, 25, 20, 13, 15, 64, 46, 35, 16, 15, 19, 21, 31, 56, +62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 0, 0, 1, 0, 86, -1, 95, 1, 110, 0, -116, 0, 31, +0, 82, -71, 0, 2, -1, -32, 64, 14, 11, 17, 52, 21, 7, 18, 18, 26, 0, 0, 26, 5, 5, 11, -72, 3, +5, -73, 26, 21, 0, 23, 7, 29, 5, 5, -72, -1, -64, -74, 18, 24, 52, 5, 29, 29, 23, -70, 2, -11, 0, +15, 1, 42, -123, 0, 47, -19, 50, 47, 51, 43, 47, 18, 57, 17, 57, 57, 1, 47, -19, 50, 47, 17, 51, 47, +18, 57, 47, 57, 57, 49, 48, 0, 43, 5, 20, 7, 6, 7, 7, 52, 55, 38, 39, 38, 53, 52, 55, 54, 51, +50, 22, 21, 20, 6, 7, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 1, 110, 31, 21, 42, -70, 100, 31, 16, +21, 53, 59, 45, 20, 29, 12, 11, 31, 36, 22, 43, 93, 33, 22, 19, 24, 25, 20, 13, 15, 64, 46, 35, 16, +15, 19, 21, 31, 56, 62, 27, 22, 14, 29, 18, 28, 18, 12, 15, 52, 3, 0, 0, 1, -1, -49, 4, 38, 0, +50, 6, 121, 0, 10, 0, 45, 64, 26, 2, 16, 26, 31, 52, 9, 7, 3, 2, 5, 0, 7, 9, 3, 31, 2, +63, 2, 95, 2, 127, 2, -97, 2, 5, 2, 0, 47, 93, 51, -51, 50, 1, 47, -35, 50, 50, -42, -51, 49, 48, +1, 43, 19, 20, 7, 39, 54, 53, 52, 3, 54, 55, 18, 50, 47, 9, 4, 47, 19, 28, 52, 4, -89, 54, 75, +4, 37, 17, 124, 1, 70, 38, 49, -2, -78, -1, -1, 0, 15, 1, 10, 1, -81, 7, 33, 2, 54, 3, -115, 0, +0, 1, 22, 5, 52, 0, 0, 0, 65, -78, 2, 1, 34, -72, -1, -64, 64, 10, 22, 26, 52, 0, 34, 21, 13, +16, 65, 16, -72, -1, -64, -77, 9, 16, 52, 15, -72, -1, -64, 64, 21, 9, 16, 52, 0, 13, 0, 14, 0, 15, +0, 16, 0, 17, -16, 15, -16, 16, 7, 2, 1, 25, 0, 47, 53, 53, 93, 43, 43, 1, 43, 43, 53, 53, 0, +-1, -1, -1, -65, 1, 37, 1, -42, 7, 33, 2, 54, 3, -114, 0, 0, 1, 22, 5, 52, -80, 0, 0, 47, 64, +9, 2, 1, 0, 36, 23, 13, 13, 65, 13, -72, -1, -64, 64, 21, 9, 16, 52, 0, 10, 0, 11, 0, 12, 0, +13, 0, 14, 0, 15, -16, 13, 7, 2, 1, 27, 0, 47, 53, 53, 93, 43, 1, 43, 53, 53, 0, -1, -1, -1, +-11, 1, 10, 1, 110, 7, 30, 2, 54, 3, -115, 0, 0, 1, 22, 5, 53, 0, 0, 0, 88, 64, 14, 1, 48, +33, 1, 0, 33, 21, 13, 16, 65, 25, 16, 1, 17, -72, -1, -100, -77, 9, 16, 52, 16, -72, -1, -100, -77, 9, +16, 52, 15, -72, -1, -100, -77, 9, 16, 52, 14, -72, -1, -64, -77, 9, 16, 52, 13, -72, -1, -64, -77, 9, 16, +52, 16, -72, -1, -64, -77, 17, 28, 52, 15, -72, -1, -64, -76, 17, 18, 52, 1, 58, 0, 47, 53, 43, 43, 43, +43, 43, 43, 43, 93, 1, 43, 113, 53, -1, -1, -1, -51, 1, 37, 1, -42, 7, 30, 2, 54, 3, -114, 0, 0, +1, 22, 5, 53, -40, 0, 0, 100, -79, 1, 35, -72, -1, -64, 64, 10, 18, 26, 52, 0, 35, 23, 13, 13, 65, +15, -72, -1, -64, -77, 9, 16, 52, 14, -72, -1, -100, -77, 9, 16, 52, 13, -72, -1, -100, -77, 9, 16, 52, 12, +-72, -1, -100, -77, 9, 16, 52, 11, -72, -1, -64, -77, 9, 16, 52, 10, -72, -1, -64, -77, 9, 16, 52, 13, -72, +-1, -64, 64, 13, 17, 31, 52, -48, 13, -32, 13, 2, 25, 13, 1, 1, 60, 0, 47, 53, 93, 113, 43, 43, 43, +43, 43, 43, 43, 1, 43, 43, 53, -1, -1, 0, 29, -1, 84, 1, -106, 5, -20, 2, 54, 3, -115, 0, 0, 1, +23, 5, 53, 0, 40, -7, 92, 0, 47, -76, 1, 48, 21, 1, 21, -72, -1, -64, -77, 14, 16, 52, 21, -72, -1, +-64, 64, 18, 8, 10, 52, 68, 21, 21, 0, 0, 65, 1, 0, 58, 16, 58, 95, 58, 3, 58, 0, 47, 93, 53, +1, 43, 43, 43, 93, 53, 0, -1, -1, -1, -11, -1, 84, 1, -42, 5, -20, 2, 54, 3, -114, 0, 0, 1, 23, +5, 53, 0, 0, -7, 92, 0, 31, 64, 21, 1, 35, 64, 13, 15, 52, 0, 35, 23, 6, 17, 65, 1, 0, 60, +16, 60, 95, 60, 3, 60, 0, 47, 93, 53, 1, 43, 43, 53, 0, -1, -1, 0, -109, 1, 10, 2, 94, 5, -20, +2, 54, 3, -115, 0, 0, 1, 23, 5, 57, 0, -16, -2, -44, 0, 43, -76, 1, 112, 32, 1, 32, -72, -1, -64, +64, 11, 14, 20, 52, 117, 32, 32, 16, 16, 65, 0, 0, -72, -1, -64, -75, 9, 49, 52, 0, 1, 50, 0, 47, +53, 1, 47, 43, 53, 43, 43, 113, 53, 0, -1, -1, 0, 19, 1, 37, 2, 54, 5, -20, 2, 54, 3, -114, 0, +0, 1, 23, 5, 57, 0, -56, -2, -44, 0, 41, -79, 1, 34, -72, -1, -64, -77, 26, 32, 52, 34, -72, -1, -64, +64, 16, 13, 20, 52, 0, 34, 16, 34, 2, 101, 34, 34, 17, 17, 65, 1, 52, 0, 47, 53, 1, 43, 93, 43, +43, 53, 0, -1, -1, 0, 50, -1, 99, 4, 22, 4, -58, 2, 54, 3, -19, 0, 0, 1, 23, 5, 57, 2, -88, +-3, -68, 0, 55, 64, 41, 2, 0, 48, 48, 24, 0, 65, 2, 95, 48, 1, 48, 48, 64, 48, 127, 48, 3, 15, +48, 47, 48, -128, 48, 3, 48, -128, 18, 21, 52, 48, 64, 22, 23, 52, 48, 64, 9, 14, 52, 48, 0, 47, 43, +43, 43, 93, 113, 114, 53, 1, 43, 53, 0, -1, -1, 0, 50, -1, 99, 4, 22, 4, -58, 2, 54, 3, -19, 0, +0, 1, 23, 5, 57, 2, -88, -3, -68, 0, 55, 64, 41, 2, 0, 48, 48, 24, 0, 65, 2, 95, 48, 1, 48, +48, 64, 48, 127, 48, 3, 15, 48, 47, 48, -128, 48, 3, 48, -128, 18, 21, 52, 48, 64, 22, 23, 52, 48, 64, +9, 14, 52, 48, 0, 47, 43, 43, 43, 93, 113, 114, 53, 1, 43, 53, 0, -1, -1, 0, 50, -1, 99, 4, 22, +4, -19, 2, 54, 3, -19, 0, 0, 0, 55, 5, 57, 2, -88, -3, -68, 1, 23, 2, -11, 0, -56, -2, 99, 0, +96, 64, 18, 4, 3, 0, 98, 98, 24, 40, 65, 2, 0, 48, 48, 24, 0, 65, 4, 3, 78, -72, -1, -64, 64, +50, 15, 17, 52, 96, 78, 1, 15, 78, -97, 78, -81, 78, -65, 78, 4, 78, 2, 95, 48, 1, 48, 48, 64, 48, +127, 48, 3, 15, 48, 47, 48, -128, 48, 3, 48, -128, 18, 21, 52, 48, 64, 22, 23, 52, 48, 64, 9, 14, 52, +48, 0, 47, 43, 43, 43, 93, 113, 114, 53, 47, 93, 113, 43, 53, 53, 1, 43, 53, 43, 53, 53, -1, -1, 0, +50, -1, 99, 4, 22, 4, -19, 2, 54, 3, -19, 0, 0, 0, 55, 5, 57, 2, -88, -3, -68, 1, 23, 2, -11, +0, -56, -2, 99, 0, 96, 64, 18, 4, 3, 0, 98, 98, 24, 40, 65, 2, 0, 48, 48, 24, 0, 65, 4, 3, +78, -72, -1, -64, 64, 50, 15, 17, 52, 96, 78, 1, 15, 78, -97, 78, -81, 78, -65, 78, 4, 78, 2, 95, 48, +1, 48, 48, 64, 48, 127, 48, 3, 15, 48, 47, 48, -128, 48, 3, 48, -128, 18, 21, 52, 48, 64, 22, 23, 52, +48, 64, 9, 14, 52, 48, 0, 47, 43, 43, 43, 93, 113, 114, 53, 47, 93, 113, 43, 53, 53, 1, 43, 53, 43, +53, 53, -1, -1, 0, 50, -1, -89, 5, 86, 5, 122, 2, 54, 3, 53, 0, 0, 1, 23, 5, 57, 3, -24, -2, +112, 0, 39, 64, 28, 1, -64, 60, -48, 60, -16, 60, 3, 125, 60, 60, 0, 0, 65, 1, 95, 89, -97, 89, -49, +89, 3, 89, 64, 9, 19, 52, 89, 0, 47, 43, 93, 53, 1, 43, 93, 53, 0, -1, -1, 0, 36, -1, 31, 4, +-75, 3, -122, 2, 54, 3, 54, 0, 0, 1, 23, 5, 57, 3, 32, -4, 124, 0, 37, 64, 26, 1, 0, 60, 55, +38, 13, 65, 1, 15, 84, 47, 84, -97, 84, 3, 84, 64, 18, 22, 52, 84, 64, 11, 15, 52, 84, 0, 47, 43, +43, 93, 53, 1, 43, 53, 0, -1, -1, 0, 58, 1, 37, 5, -75, 6, -96, 2, 54, 5, 40, 0, 0, 1, 23, +5, 51, 1, -12, 0, 0, 0, 27, 64, 16, 2, 1, 16, 30, 32, 30, 2, 0, 30, 29, 14, 19, 65, 2, 1, +30, 0, 47, 53, 53, 1, 43, 93, 53, 53, 0, -1, -1, 0, 58, 1, 37, 5, -75, 6, -96, 2, 54, 5, 40, +0, 0, 1, 23, 5, 51, 1, -12, 0, 0, 0, 27, 64, 16, 2, 1, 16, 30, 32, 30, 2, 0, 30, 29, 14, +19, 65, 2, 1, 30, 0, 47, 53, 53, 1, 43, 93, 53, 53, 0, -1, -1, -1, -70, 1, 37, 2, 39, 6, -96, +2, 54, 5, 41, 0, 0, 1, 22, 5, 51, 0, 0, 0, 21, 64, 11, 2, 1, 31, 14, 13, 1, 0, 65, 2, +1, 14, 0, 47, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, 1, 37, 2, 39, 6, -96, 2, 54, 5, 41, +0, 0, 1, 22, 5, 51, 0, 0, 0, 21, 64, 11, 2, 1, 31, 14, 13, 1, 0, 65, 2, 1, 14, 0, 47, +53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 58, 1, 37, 5, -75, 6, 4, 2, 54, 5, 40, 0, 0, 1, 23, +5, 49, 1, -12, 5, 120, 0, 25, 64, 14, 2, 1, 0, 35, 33, 14, 19, 65, 2, 1, 32, 34, 1, 34, 0, +47, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 58, 1, 37, 5, -75, 6, 4, 2, 54, 5, 40, 0, 0, +1, 23, 5, 49, 1, -12, 5, 120, 0, 25, 64, 14, 2, 1, 0, 35, 33, 14, 19, 65, 2, 1, 32, 34, 1, +34, 0, 47, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, 1, 37, 1, -12, 6, 4, 2, 54, 5, 41, +0, 0, 1, 23, 5, 49, -1, -40, 5, 120, 0, 40, -78, 2, 1, 15, -72, -1, -64, 64, 21, 11, 14, 52, 0, +15, 17, 1, 0, 65, 2, 1, 32, 18, 63, 18, -128, 18, -97, 18, 4, 18, 0, 47, 93, 53, 53, 1, 43, 43, +53, 53, -1, -1, -1, -70, 1, 37, 1, -12, 6, 4, 2, 54, 5, 41, 0, 0, 1, 23, 5, 49, -1, -40, 5, +120, 0, 40, -78, 2, 1, 15, -72, -1, -64, 64, 21, 11, 14, 52, 0, 15, 17, 1, 0, 65, 2, 1, 32, 18, +63, 18, -128, 18, -97, 18, 4, 18, 0, 47, 93, 53, 53, 1, 43, 43, 53, 53, -1, -1, 0, 58, -2, -84, 5, +-75, 3, -64, 2, 54, 5, 40, 0, 0, 1, 23, 5, 49, 2, 48, 0, 0, 0, 33, 64, 21, 2, 1, 0, 31, +29, 14, 19, 65, 2, 1, 32, 64, 12, 21, 52, 0, 32, 16, 32, 2, 32, 0, 47, 93, 43, 53, 53, 1, 43, +53, 53, 0, -1, -1, 0, 58, -2, -84, 5, -75, 3, -64, 2, 54, 5, 40, 0, 0, 1, 23, 5, 49, 2, 48, +0, 0, 0, 33, 64, 21, 2, 1, 0, 31, 29, 14, 19, 65, 2, 1, 32, 64, 12, 21, 52, 0, 32, 16, 32, +2, 32, 0, 47, 93, 43, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, -2, -84, 1, -12, 3, -90, 2, 54, +5, 41, 0, 0, 1, 22, 5, 49, 0, 0, 0, 33, 64, 21, 2, 1, 0, 15, 17, 1, 0, 65, 2, 1, 16, +64, 12, 21, 52, 0, 16, 16, 16, 2, 16, 0, 47, 93, 43, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, +-2, -84, 1, -12, 3, -90, 2, 54, 5, 41, 0, 0, 1, 22, 5, 49, 0, 0, 0, 33, 64, 21, 2, 1, 0, +15, 17, 1, 0, 65, 2, 1, 16, 64, 12, 21, 52, 0, 16, 16, 16, 2, 16, 0, 47, 93, 43, 53, 53, 1, +43, 53, 53, 0, -1, -1, 0, 58, 0, 64, 5, -75, 5, 6, 2, 54, 3, -107, 0, 0, 1, 23, 2, -8, 2, +88, -5, 105, 0, 24, 64, 11, 4, 3, 0, 43, 37, 22, 27, 65, 4, 3, 52, -72, 2, -21, 0, 63, 53, 53, +1, 43, 53, 53, -1, -1, 0, 58, 0, 64, 5, -75, 5, 6, 2, 54, 3, -107, 0, 0, 1, 23, 2, -8, 2, +88, -5, 105, 0, 24, 64, 11, 4, 3, 0, 43, 37, 22, 27, 65, 4, 3, 52, -72, 2, -21, 0, 63, 53, 53, +1, 43, 53, 53, -1, -1, -1, -70, 0, 64, 1, -12, 5, 86, 2, 54, 3, -105, 0, 0, 1, 23, 2, -8, 0, +40, -5, 105, 0, 24, 64, 11, 4, 3, 0, 27, 21, 9, 8, 65, 4, 3, 36, -72, 2, -21, 0, 63, 53, 53, +1, 43, 53, 53, -1, -1, -1, -70, 0, 64, 1, -12, 5, 86, 2, 54, 3, -105, 0, 0, 1, 23, 2, -8, 0, +40, -5, 105, 0, 24, 64, 11, 4, 3, 0, 27, 21, 9, 8, 65, 4, 3, 36, -72, 2, -21, 0, 63, 53, 53, +1, 43, 53, 53, -1, -1, 0, 58, 1, 37, 5, -75, 6, 4, 2, 54, 5, 40, 0, 0, 1, 23, 5, 48, 1, +-12, 5, 120, 0, 31, 64, 18, 3, 2, 1, 0, 35, 33, 14, 19, 65, 3, 2, 1, 32, 34, 63, 34, 2, 34, +0, 47, 93, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, 58, 1, 37, 5, -75, 6, 4, 2, 54, 5, +40, 0, 0, 1, 23, 5, 48, 1, -12, 5, 120, 0, 31, 64, 18, 3, 2, 1, 0, 35, 33, 14, 19, 65, 3, +2, 1, 32, 34, 63, 34, 2, 34, 0, 47, 93, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, -1, -70, 1, +37, 1, -12, 6, 4, 2, 54, 5, 41, 0, 0, 1, 23, 5, 48, -1, -40, 5, 120, 0, 39, 64, 25, 3, 2, +1, 0, 23, 13, 1, 0, 65, 3, 2, 1, 111, 18, 1, 32, 18, 63, 18, -128, 18, -97, 18, 4, 18, 0, 47, +93, 113, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 1, -12, 6, 4, 2, 54, 5, 41, +0, 0, 1, 23, 5, 48, -1, -40, 5, 120, 0, 39, 64, 25, 3, 2, 1, 0, 23, 13, 1, 0, 65, 3, 2, +1, 111, 18, 1, 32, 18, 63, 18, -128, 18, -97, 18, 4, 18, 0, 47, 93, 113, 53, 53, 53, 1, 43, 53, 53, +53, 0, -1, -1, 0, 58, 1, 37, 5, -75, 6, 4, 2, 54, 5, 40, 0, 0, 1, 23, 5, 50, 1, -12, 5, +120, 0, 39, 64, 23, 4, 3, 2, 1, 16, 39, 1, 0, 39, 33, 14, 19, 65, 4, 3, 2, 1, 15, 38, 31, +38, 2, 38, 0, 47, 93, 53, 53, 53, 53, 1, 43, 93, 53, 53, 53, 53, 0, -1, -1, 0, 58, 1, 37, 5, +-75, 6, 4, 2, 54, 5, 40, 0, 0, 1, 23, 5, 50, 1, -12, 5, 120, 0, 39, 64, 23, 4, 3, 2, 1, +16, 39, 1, 0, 39, 33, 14, 19, 65, 4, 3, 2, 1, 15, 38, 31, 38, 2, 38, 0, 47, 93, 53, 53, 53, +53, 1, 43, 93, 53, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 1, -12, 6, 4, 2, 54, 5, 41, 0, 0, +1, 23, 5, 50, -1, -40, 5, 120, 0, 51, 64, 33, 4, 3, 2, 1, -33, 23, 1, 0, 23, 17, 1, 0, 65, +4, 3, 2, 1, 22, 64, 8, 10, 52, 47, 22, 111, 22, 2, 63, 22, -97, 22, 2, 22, 0, 47, 93, 113, 43, +53, 53, 53, 53, 1, 43, 93, 53, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 1, -12, 6, 4, 2, 54, 5, +41, 0, 0, 1, 23, 5, 50, -1, -40, 5, 120, 0, 51, 64, 33, 4, 3, 2, 1, -33, 23, 1, 0, 23, 17, +1, 0, 65, 4, 3, 2, 1, 22, 64, 8, 10, 52, 47, 22, 111, 22, 2, 63, 22, -97, 22, 2, 22, 0, 47, +93, 113, 43, 53, 53, 53, 53, 1, 43, 93, 53, 53, 53, 53, 0, -1, -1, 0, 58, -2, 81, 5, -75, 3, -64, +2, 54, 5, 40, 0, 0, 1, 23, 5, 50, 2, 28, 0, 0, 0, 39, 64, 23, 4, 3, 2, 1, 0, 39, 33, +14, 19, 65, 4, 3, 2, 1, 32, 64, 17, 21, 52, 47, 32, 1, 32, 0, 47, 93, 43, 53, 53, 53, 53, 1, +43, 53, 53, 53, 53, 0, -1, -1, 0, 58, -2, 81, 5, -75, 3, -64, 2, 54, 5, 40, 0, 0, 1, 23, 5, +50, 2, 28, 0, 0, 0, 39, 64, 23, 4, 3, 2, 1, 0, 39, 33, 14, 19, 65, 4, 3, 2, 1, 32, 64, +17, 21, 52, 47, 32, 1, 32, 0, 47, 93, 43, 53, 53, 53, 53, 1, 43, 53, 53, 53, 53, 0, -1, -1, -1, +-70, -2, 81, 1, -5, 3, -90, 2, 54, 5, 41, 0, 0, 1, 22, 5, 50, 0, 0, 0, 39, 64, 23, 4, 3, +2, 1, 0, 26, 17, 1, 0, 65, 4, 3, 2, 1, 16, 64, 17, 21, 52, 47, 16, 1, 16, 0, 47, 93, 43, +53, 53, 53, 53, 1, 43, 53, 53, 53, 53, 0, -1, -1, -1, -70, -2, 81, 1, -5, 3, -90, 2, 54, 5, 41, +0, 0, 1, 22, 5, 50, 0, 0, 0, 39, 64, 23, 4, 3, 2, 1, 0, 26, 17, 1, 0, 65, 4, 3, 2, +1, 16, 64, 17, 21, 52, 47, 16, 1, 16, 0, 47, 93, 43, 53, 53, 53, 53, 1, 43, 53, 53, 53, 53, 0, +-1, -1, 0, 54, -2, 78, 4, 32, 5, 122, 2, 54, 3, -95, 0, 0, 1, 23, 5, 57, 1, -112, -2, 112, 0, +31, 64, 22, 1, 0, 50, 45, 7, 18, 65, 1, 15, 74, 47, 74, 95, 74, 112, 74, -128, 74, -97, 74, 6, 74, +0, 47, 93, 53, 1, 43, 53, 0, -1, -1, 0, 54, -2, 78, 4, 53, 5, 122, 2, 54, 3, -94, 0, 0, 1, +23, 5, 57, 1, -112, -2, 112, 0, 31, 64, 22, 1, 0, 68, 63, 41, 51, 65, 1, 15, 92, 47, 92, 95, 92, +112, 92, -128, 92, -97, 92, 6, 92, 0, 47, 93, 53, 1, 43, 53, 0, -1, -1, -1, -70, 1, 37, 4, 61, 5, +122, 2, 54, 3, -93, 0, 0, 1, 23, 5, 57, 1, 44, -2, 112, 0, 50, 64, 30, 1, 0, 28, 23, 1, 0, +65, 1, 48, 52, 64, 52, 2, 15, 52, 47, 52, 95, 52, 111, 52, -97, 52, 5, 52, 64, 18, 19, 52, 52, -72, +-1, -64, -77, 15, 17, 52, 52, 0, 47, 43, 43, 93, 113, 53, 1, 43, 53, -1, -1, -1, -70, 1, 37, 4, 61, +5, 122, 2, 54, 3, -93, 0, 0, 1, 23, 5, 57, 1, 44, -2, 112, 0, 50, 64, 30, 1, 0, 28, 23, 1, +0, 65, 1, 48, 52, 64, 52, 2, 15, 52, 47, 52, 95, 52, 111, 52, -97, 52, 5, 52, 64, 18, 19, 52, 52, +-72, -1, -64, -77, 15, 17, 52, 52, 0, 47, 43, 43, 93, 113, 53, 1, 43, 53, -1, -1, 0, 54, -2, 78, 4, +32, 6, 4, 2, 54, 3, -95, 0, 0, 1, 23, 5, 49, 1, 44, 5, 120, 0, 36, 64, 16, 2, 1, 0, 51, +49, 7, 18, 65, 2, 1, 16, 50, 32, 50, 2, 50, -72, -1, -64, -77, 13, 17, 52, 50, 0, 47, 43, 93, 53, +53, 1, 43, 53, 53, -1, -1, 0, 54, -2, 78, 4, 53, 6, 4, 2, 54, 3, -94, 0, 0, 1, 23, 5, 49, +1, 44, 5, 120, 0, 37, 64, 11, 2, 1, 0, 69, 67, 41, 51, 65, 2, 1, 68, -72, -1, -64, 64, 9, 13, +17, 52, 16, 68, 32, 68, 2, 68, 0, 47, 93, 43, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, 1, 37, +4, 61, 6, 4, 2, 54, 3, -93, 0, 0, 1, 23, 5, 49, 0, -56, 5, 120, 0, 44, 64, 23, 2, 1, 0, +29, 27, 1, 0, 65, 2, 1, 16, 28, 32, 28, -128, 28, 3, 28, 64, 18, 19, 52, 28, -72, -1, -64, -77, 13, +17, 52, 28, 0, 47, 43, 43, 93, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, 1, 37, 4, 61, 6, 4, 2, +54, 3, -93, 0, 0, 1, 23, 5, 49, 0, -56, 5, 120, 0, 44, 64, 23, 2, 1, 0, 29, 27, 1, 0, 65, +2, 1, 16, 28, 32, 28, -128, 28, 3, 28, 64, 18, 19, 52, 28, -72, -1, -64, -77, 13, 17, 52, 28, 0, 47, +43, 43, 93, 53, 53, 1, 43, 53, 53, -1, -1, 0, 54, -2, 78, 4, 32, 3, 117, 2, 54, 3, -95, 0, 0, +1, 23, 5, 46, 1, 124, 0, -56, 0, 33, 64, 21, 2, 1, 0, 51, 49, 25, 18, 65, 2, 1, 0, 50, 16, +50, 2, 50, 64, 12, 15, 52, 50, 0, 47, 43, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 54, -2, 78, +4, 53, 3, 105, 2, 54, 3, -94, 0, 0, 1, 23, 5, 46, 0, -16, 0, -76, 0, 59, 64, 29, -101, 2, -85, +2, 2, 2, 1, 15, 69, -81, 69, 2, -97, 69, -81, 69, 2, 0, 69, 63, 14, 4, 65, 2, 1, 64, 68, 1, +68, -72, -1, -64, 64, 9, 7, 11, 52, 68, 64, 12, 16, 52, 68, 0, 47, 43, 43, 93, 53, 53, 1, 43, 93, +113, 53, 53, 93, 0, -1, -1, -1, -70, -1, 76, 4, 61, 3, 107, 2, 54, 3, -93, 0, 0, 1, 23, 5, 46, +1, 4, 0, 0, 0, 33, 64, 21, 2, 1, 0, 29, 23, 1, 0, 65, 2, 1, 0, 28, 16, 28, 2, 28, 64, +12, 21, 52, 28, 0, 47, 43, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, -1, 76, 4, 61, 3, 107, +2, 54, 3, -93, 0, 0, 1, 23, 5, 46, 1, 4, 0, 0, 0, 33, 64, 21, 2, 1, 0, 29, 23, 1, 0, +65, 2, 1, 0, 28, 16, 28, 2, 28, 64, 12, 21, 52, 28, 0, 47, 43, 93, 53, 53, 1, 43, 53, 53, 0, +-1, -1, 0, 54, -2, 78, 4, 32, 3, 117, 2, 54, 3, -95, 0, 0, 1, 23, 5, 49, 1, 124, 1, 4, 0, +37, 64, 25, 2, 1, -97, 51, -81, 51, -33, 51, -17, 51, 4, 51, 64, 9, 10, 52, 0, 51, 49, 25, 18, 65, +2, 1, 50, 0, 47, 53, 53, 1, 43, 43, 93, 53, 53, 0, -1, -1, 0, 54, -2, 78, 4, 53, 3, 105, 2, +54, 3, -94, 0, 0, 1, 23, 5, 49, 1, 24, 0, -16, 0, 38, 64, 18, 2, 1, 0, 65, 63, 14, 4, 65, +2, 1, 63, 68, -65, 68, -49, 68, 3, 68, -72, -1, -64, -77, 9, 10, 52, 68, 0, 47, 43, 93, 53, 53, 1, +43, 53, 53, -1, -1, -1, -70, -2, -84, 4, 61, 3, 107, 2, 54, 3, -93, 0, 0, 1, 23, 5, 49, 1, 4, +0, 0, 0, 33, 64, 21, 2, 1, 0, 29, 23, 1, 0, 65, 2, 1, 0, 28, 16, 28, 2, 28, 64, 12, 21, +52, 28, 0, 47, 43, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, -1, -70, -2, -84, 4, 61, 3, 107, 2, 54, +3, -93, 0, 0, 1, 23, 5, 49, 1, 4, 0, 0, 0, 33, 64, 21, 2, 1, 0, 29, 23, 1, 0, 65, 2, +1, 0, 28, 16, 28, 2, 28, 64, 12, 21, 52, 28, 0, 47, 43, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, +0, 54, -2, 78, 4, 32, 6, 4, 2, 54, 3, -95, 0, 0, 1, 23, 5, 47, 1, 84, 5, 120, 0, 38, 64, +16, 3, 2, 1, 0, 55, 49, 7, 18, 65, 3, 2, 1, 16, 54, 1, 54, -72, -1, -64, -77, 13, 17, 52, 54, +0, 47, 43, 93, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, 0, 54, -2, 78, 4, 53, 6, 4, 2, 54, 3, +-94, 0, 0, 1, 23, 5, 47, 1, 84, 5, 120, 0, 38, 64, 16, 3, 2, 1, 0, 73, 67, 41, 51, 65, 3, +2, 1, 16, 72, 1, 72, -72, -1, -64, -77, 13, 17, 52, 72, 0, 47, 43, 93, 53, 53, 53, 1, 43, 53, 53, +53, -1, -1, -1, -70, 1, 37, 4, 61, 6, 4, 2, 54, 3, -93, 0, 0, 1, 23, 5, 47, 1, 24, 5, 120, +0, 42, 64, 20, 3, 2, 1, 0, 33, 27, 1, 0, 65, 3, 2, 1, 16, 32, -128, 32, -97, 32, 3, 32, -72, +-1, -64, -77, 13, 17, 52, 32, 0, 47, 43, 93, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, -1, -70, 1, 37, +4, 61, 6, 4, 2, 54, 3, -93, 0, 0, 1, 23, 5, 47, 1, 24, 5, 120, 0, 42, 64, 20, 3, 2, 1, +0, 33, 27, 1, 0, 65, 3, 2, 1, 16, 32, -128, 32, -97, 32, 3, 32, -72, -1, -64, -77, 13, 17, 52, 32, +0, 47, 43, 93, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, 0, 54, -2, 78, 4, 32, 3, 117, 2, 54, 3, +-95, 0, 0, 1, 23, 5, 50, 1, -92, 1, 84, 0, 57, 64, 38, 4, 3, 2, 1, 111, 58, 1, -33, 58, 1, +0, 58, 49, 25, 18, 65, -105, 27, -89, 27, 2, 4, 3, 2, 1, 47, 54, 1, 64, 54, 112, 54, -65, 54, -49, +54, 4, 54, 0, 47, 93, 113, 53, 53, 53, 53, 93, 1, 43, 93, 113, 53, 53, 53, 53, 0, -1, -1, 0, 54, +-2, 78, 4, 53, 3, 105, 2, 54, 3, -94, 0, 0, 1, 23, 5, 50, 1, 14, 1, 34, 0, 116, 64, 83, 4, +3, 2, 1, 76, 64, 56, 57, 52, 76, 64, 41, 45, 52, 76, 64, 17, 22, 52, -112, 76, 1, 15, 76, 31, 76, +95, 76, 111, 76, -17, 76, 5, 0, 76, 67, 14, 4, 65, 4, 3, 2, 1, 95, 72, 111, 72, -97, 72, 3, 0, +72, 47, 72, -65, 72, -49, 72, -33, 72, 5, 15, 72, 31, 72, 48, 72, -17, 72, -1, 72, 5, 72, 64, 52, 67, +52, 72, 64, 30, 32, 52, 72, -72, -1, -64, -77, 13, 16, 52, 72, 0, 47, 43, 43, 43, 93, 113, 114, 53, 53, +53, 53, 1, 43, 113, 114, 43, 43, 43, 53, 53, 53, 53, -1, -1, -1, -70, -2, 81, 4, 61, 3, 107, 2, 54, +3, -93, 0, 0, 1, 23, 5, 50, 1, 24, 0, 0, 0, 39, 64, 23, 4, 3, 2, 1, 0, 36, 27, 1, 0, +65, 4, 3, 2, 1, 47, 32, 1, 32, 64, 17, 21, 52, 32, 0, 47, 43, 93, 53, 53, 53, 53, 1, 43, 53, +53, 53, 53, 0, -1, -1, -1, -70, -2, 81, 4, 61, 3, 107, 2, 54, 3, -93, 0, 0, 1, 23, 5, 50, 1, +24, 0, 0, 0, 39, 64, 23, 4, 3, 2, 1, 0, 36, 27, 1, 0, 65, 4, 3, 2, 1, 47, 32, 1, 32, +64, 17, 21, 52, 32, 0, 47, 43, 93, 53, 53, 53, 53, 1, 43, 53, 53, 53, 53, 0, -1, -1, 0, 50, 1, +37, 2, -77, 7, 33, 2, 54, 3, -87, 0, 0, 1, 23, 5, 51, 0, 100, 0, -127, 0, 78, -79, 2, 1, -72, +-1, -40, 64, 26, 23, 23, 0, 0, 65, 2, 18, 34, 16, 34, 18, 36, 19, 36, 20, -110, 18, 6, 2, 1, 24, +64, 18, 22, 52, 24, -72, -1, -64, 64, 25, 14, 17, 52, 0, 24, -49, 24, 2, 48, 24, -113, 24, -16, 24, 3, +0, 24, 16, 24, -112, 24, -65, 24, 4, 24, 0, 47, 93, 113, 114, 43, 43, 53, 53, 93, 1, 43, 53, 53, -1, +-1, 0, 50, 1, 37, 2, -77, 7, 33, 2, 54, 3, -87, 0, 0, 1, 23, 5, 51, 0, 100, 0, -127, 0, 78, +-79, 2, 1, -72, -1, -40, 64, 26, 23, 23, 0, 0, 65, 2, 18, 34, 16, 34, 18, 36, 19, 36, 20, -110, 18, +6, 2, 1, 24, 64, 18, 22, 52, 24, -72, -1, -64, 64, 25, 14, 17, 52, 0, 24, -49, 24, 2, 48, 24, -113, +24, -16, 24, 3, 0, 24, 16, 24, -112, 24, -65, 24, 4, 24, 0, 47, 93, 113, 114, 43, 43, 53, 53, 93, 1, +43, 53, 53, -1, -1, 0, 95, 0, 64, 2, -77, 4, 106, 2, 54, 3, -87, 0, 0, 1, 23, 2, -8, 0, -36, +-5, 105, 0, 24, 64, 11, 2, 1, 0, 29, 23, 4, 0, 65, 2, 1, 38, -72, 2, -21, 0, 63, 53, 53, 1, +43, 53, 53, -1, -1, 0, 95, 0, 64, 2, -77, 4, 106, 2, 54, 3, -87, 0, 0, 1, 23, 2, -8, 0, -36, +-5, 105, 0, 24, 64, 11, 2, 1, 0, 29, 23, 4, 0, 65, 2, 1, 38, -72, 2, -21, 0, 63, 53, 53, 1, +43, 53, 53, -1, -1, 0, 95, -1, -95, 2, -77, 4, 106, 2, 54, 3, -87, 0, 0, 1, 23, 5, 45, 0, -116, +0, 0, 0, 29, 64, 19, 1, 0, 25, 23, 4, 0, 65, 1, 0, 24, 16, 24, 2, 24, 64, 11, 21, 52, 24, +0, 47, 43, 93, 53, 1, 43, 53, 0, -1, -1, 0, 95, -1, -95, 2, -77, 4, 106, 2, 54, 3, -87, 0, 0, +1, 23, 5, 45, 0, -116, 0, 0, 0, 29, 64, 19, 1, 0, 25, 23, 4, 0, 65, 1, 0, 24, 16, 24, 2, +24, 64, 11, 21, 52, 24, 0, 47, 43, 93, 53, 1, 43, 53, 0, -1, -1, 0, 50, -1, -95, 2, -77, 7, 33, +2, 54, 3, -87, 0, 0, 0, 55, 5, 51, 0, 100, 0, -127, 1, 23, 5, 45, 0, -116, 0, 0, 0, 116, 64, +9, 3, 0, 72, 70, 4, 0, 65, 2, 1, -72, -1, -40, 64, 49, 23, 23, 0, 0, 65, 2, 18, 34, 16, 34, +18, 36, 19, 36, 20, 5, 3, 0, 71, 16, 71, 2, 71, 64, 11, 21, 52, 71, 2, 18, 34, 16, 34, 18, 36, +19, 36, 20, -110, 18, 6, 2, 1, 24, 64, 18, 22, 52, 24, -72, -1, -64, 64, 25, 14, 17, 52, 0, 24, -49, +24, 2, 48, 24, -113, 24, -16, 24, 3, 0, 24, 16, 24, -112, 24, -65, 24, 4, 24, 0, 47, 93, 113, 114, 43, +43, 53, 53, 93, 47, 43, 93, 53, 93, 1, 43, 53, 53, 43, 53, -1, -1, 0, 50, -1, -95, 2, -77, 7, 33, +2, 54, 3, -87, 0, 0, 0, 55, 5, 51, 0, 100, 0, -127, 1, 23, 5, 45, 0, -116, 0, 0, 0, 116, 64, +9, 3, 0, 72, 70, 4, 0, 65, 2, 1, -72, -1, -40, 64, 49, 23, 23, 0, 0, 65, 2, 18, 34, 16, 34, +18, 36, 19, 36, 20, 5, 3, 0, 71, 16, 71, 2, 71, 64, 11, 21, 52, 71, 2, 18, 34, 16, 34, 18, 36, +19, 36, 20, -110, 18, 6, 2, 1, 24, 64, 18, 22, 52, 24, -72, -1, -64, 64, 25, 14, 17, 52, 0, 24, -49, +24, 2, 48, 24, -113, 24, -16, 24, 3, 0, 24, 16, 24, -112, 24, -65, 24, 4, 24, 0, 47, 93, 113, 114, 43, +43, 53, 53, 93, 47, 43, 93, 53, 93, 1, 43, 53, 53, 43, 53, -1, -1, 0, 95, 1, 37, 2, -77, 6, 4, +2, 54, 3, -87, 0, 0, 1, 23, 5, 46, 0, 80, 5, 120, 0, 47, 64, 33, 2, 1, 48, 29, 64, 29, -128, +29, 3, 0, 29, 23, 4, 0, 65, 2, 1, 63, 28, -97, 28, 2, 28, 64, 18, 21, 52, 28, 64, 12, 13, 52, +28, 0, 47, 43, 43, 93, 53, 53, 1, 43, 93, 53, 53, 0, -1, -1, 0, 95, 1, 37, 2, -77, 6, 4, 2, +54, 3, -87, 0, 0, 1, 23, 5, 46, 0, 80, 5, 120, 0, 47, 64, 33, 2, 1, 48, 29, 64, 29, -128, 29, +3, 0, 29, 23, 4, 0, 65, 2, 1, 63, 28, -97, 28, 2, 28, 64, 18, 21, 52, 28, 64, 12, 13, 52, 28, +0, 47, 43, 43, 93, 53, 53, 1, 43, 93, 53, 53, 0, -1, -1, 0, 95, -1, 76, 2, -77, 4, 106, 2, 54, +3, -87, 0, 0, 1, 23, 5, 46, 0, -116, 0, 0, 0, 33, 64, 21, 2, 1, 0, 29, 23, 4, 0, 65, 2, +1, 0, 28, 16, 28, 2, 28, 64, 12, 21, 52, 28, 0, 47, 43, 93, 53, 53, 1, 43, 53, 53, 0, -1, -1, +0, 95, -1, 76, 2, -77, 4, 106, 2, 54, 3, -87, 0, 0, 1, 23, 5, 46, 0, -116, 0, 0, 0, 33, 64, +21, 2, 1, 0, 29, 23, 4, 0, 65, 2, 1, 0, 28, 16, 28, 2, 28, 64, 12, 21, 52, 28, 0, 47, 43, +93, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 95, 1, 37, 2, -77, 6, -52, 2, 54, 3, -87, 0, 0, 1, +23, 5, 47, 0, 100, 6, 64, 0, 59, -77, 3, 2, 1, 29, -72, -1, -64, -78, 11, 16, 52, -72, -1, -33, 64, +9, 29, 29, 18, 18, 65, 3, 2, 1, 32, -72, -1, -64, 64, 14, 13, 17, 52, 16, 32, -97, 32, 2, 32, 64, +11, 13, 52, 32, 0, 47, 43, 93, 43, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, 0, 95, 1, 37, +2, -77, 6, -52, 2, 54, 3, -87, 0, 0, 1, 23, 5, 47, 0, 100, 6, 64, 0, 59, -77, 3, 2, 1, 29, +-72, -1, -64, -78, 11, 16, 52, -72, -1, -33, 64, 9, 29, 29, 18, 18, 65, 3, 2, 1, 32, -72, -1, -64, 64, +14, 13, 17, 52, 16, 32, -97, 32, 2, 32, 64, 11, 13, 52, 32, 0, 47, 43, 93, 43, 53, 53, 53, 1, 43, +43, 53, 53, 53, 0, -1, -1, 0, 56, 1, 37, 2, -77, 6, -52, 2, 54, 3, -87, 0, 0, 1, 23, 5, 48, +0, 40, 6, 64, 0, 47, 64, 18, 3, 2, 1, 28, 28, 28, 18, 18, 65, 3, 2, 1, 16, 28, -97, 28, 2, +28, -72, -1, -64, 64, 9, 14, 17, 52, 28, 64, 12, 12, 52, 28, 0, 47, 43, 43, 93, 53, 53, 53, 1, 43, +53, 53, 53, 0, -1, -1, 0, 56, 1, 37, 2, -77, 6, -52, 2, 54, 3, -87, 0, 0, 1, 23, 5, 48, 0, +40, 6, 64, 0, 47, 64, 18, 3, 2, 1, 28, 28, 28, 18, 18, 65, 3, 2, 1, 16, 28, -97, 28, 2, 28, +-72, -1, -64, 64, 9, 14, 17, 52, 28, 64, 12, 12, 52, 28, 0, 47, 43, 43, 93, 53, 53, 53, 1, 43, 53, +53, 53, 0, -1, -1, 0, 73, 1, 37, 2, -77, 6, -52, 2, 54, 3, -87, 0, 0, 1, 23, 5, 50, 0, 80, +6, 64, 0, 62, -77, 4, 3, 2, 1, -72, -1, -41, 64, 22, 29, 29, 18, 18, 65, 4, 3, 2, 1, 15, 32, +96, 32, 112, 32, 3, 32, 64, 18, 22, 52, 32, -72, -1, -64, 64, 9, 14, 16, 52, 32, 64, 11, 12, 52, 32, +0, 47, 43, 43, 43, 93, 53, 53, 53, 53, 1, 43, 53, 53, 53, 53, -1, -1, 0, 73, 1, 37, 2, -77, 6, +-52, 2, 54, 3, -87, 0, 0, 1, 23, 5, 50, 0, 80, 6, 64, 0, 62, -77, 4, 3, 2, 1, -72, -1, -41, +64, 22, 29, 29, 18, 18, 65, 4, 3, 2, 1, 15, 32, 96, 32, 112, 32, 3, 32, 64, 18, 22, 52, 32, -72, +-1, -64, 64, 9, 14, 16, 52, 32, 64, 11, 12, 52, 32, 0, 47, 43, 43, 43, 93, 53, 53, 53, 53, 1, 43, +53, 53, 53, 53, -1, -1, 0, 74, -1, 70, 3, -23, 6, -96, 2, 54, 3, -83, 0, 0, 1, 23, 5, 51, 1, +-112, 0, 0, 0, 37, 64, 11, 2, 1, 0, 31, 31, 21, 0, 65, 2, 1, 32, -72, -1, -64, 64, 9, 12, 19, +52, 16, 32, 79, 32, 2, 32, 0, 47, 93, 43, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 74, -1, 70, 3, +-23, 6, -96, 2, 54, 3, -83, 0, 0, 1, 23, 5, 51, 1, -112, 0, 0, 0, 37, 64, 11, 2, 1, 0, 31, +31, 21, 0, 65, 2, 1, 32, -72, -1, -64, 64, 9, 12, 19, 52, 16, 32, 79, 32, 2, 32, 0, 47, 93, 43, +53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 74, -1, 70, 3, -23, 5, 19, 2, 54, 3, -83, 0, 0, 1, 23, +5, 54, 1, -112, -1, 86, 0, 30, 64, 9, 1, 56, 31, 31, 26, 26, 65, 1, 33, -72, -1, -64, -74, 15, 19, +52, 15, 33, 1, 33, 0, 47, 93, 43, 53, 1, 43, 53, -1, -1, 0, 74, -1, 70, 3, -23, 5, 19, 2, 54, +3, -83, 0, 0, 1, 23, 5, 54, 1, -112, -1, 86, 0, 30, 64, 9, 1, 56, 31, 31, 26, 26, 65, 1, 33, +-72, -1, -64, -74, 15, 19, 52, 15, 33, 1, 33, 0, 47, 93, 43, 53, 1, 43, 53, -1, -1, 0, 74, -2, -5, +3, -23, 3, 112, 2, 54, 3, -83, 0, 0, 1, 23, 2, -8, 2, -108, -6, 36, 0, 47, 64, 17, 2, 1, 0, +31, 31, 0, 0, 65, 2, 1, -81, 34, 1, -64, 34, 1, 34, -72, -1, -64, -77, 17, 19, 52, 34, -72, -1, -64, +-77, 10, 11, 52, 34, 0, 47, 43, 43, 93, 113, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 74, -2, -5, 3, +-23, 3, 112, 2, 54, 3, -83, 0, 0, 1, 23, 2, -8, 2, -108, -6, 36, 0, 47, 64, 17, 2, 1, 0, 31, +31, 0, 0, 65, 2, 1, -81, 34, 1, -64, 34, 1, 34, -72, -1, -64, -77, 17, 19, 52, 34, -72, -1, -64, -77, +10, 11, 52, 34, 0, 47, 43, 43, 93, 113, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 74, -2, -39, 4, 14, +3, 112, 2, 54, 3, -83, 0, 0, 1, 23, 5, 45, 2, -128, -1, 56, 0, 36, -79, 1, 31, -72, -1, -64, 64, +19, 18, 21, 52, 96, 31, 1, 37, 31, 31, 0, 0, 65, 1, 127, 32, -113, 32, 2, 32, 0, 47, 93, 53, 1, +43, 93, 43, 53, -1, -1, 0, 74, -2, -39, 4, 14, 3, 112, 2, 54, 3, -83, 0, 0, 1, 23, 5, 45, 2, +-128, -1, 56, 0, 36, -79, 1, 31, -72, -1, -64, 64, 19, 18, 21, 52, 96, 31, 1, 37, 31, 31, 0, 0, 65, +1, 127, 32, -113, 32, 2, 32, 0, 47, 93, 53, 1, 43, 93, 43, 53, -1, -1, 0, 74, -2, 111, 3, -23, 3, +112, 2, 54, 3, -83, 0, 0, 1, 23, 5, 54, 1, -12, -7, -104, 0, 39, 64, 9, 1, 0, 37, 31, 21, 0, +65, 1, 33, -72, -1, -64, 64, 14, 18, 19, 52, 48, 33, 64, 33, 2, 64, 33, -33, 33, 2, 33, 0, 47, 93, +113, 43, 53, 1, 43, 53, 0, -1, -1, 0, 74, -2, 111, 3, -23, 3, 112, 2, 54, 3, -83, 0, 0, 1, 23, +5, 54, 1, -12, -7, -104, 0, 39, 64, 9, 1, 0, 37, 31, 21, 0, 65, 1, 33, -72, -1, -64, 64, 14, 18, +19, 52, 48, 33, 64, 33, 2, 64, 33, -33, 33, 2, 33, 0, 47, 93, 113, 43, 53, 1, 43, 53, 0, -1, -1, +0, 74, -2, -39, 4, 14, 3, 112, 2, 54, 3, -83, 0, 0, 0, 55, 5, 45, 2, -128, -1, 56, 1, 23, 5, +45, 0, -56, 1, 44, 0, 50, 64, 9, 2, 0, 35, 35, 12, 21, 65, 1, 31, -72, -1, -64, 64, 21, 18, 21, +52, 96, 31, 1, 37, 31, 31, 0, 0, 65, 2, 36, 1, 127, 32, -113, 32, 2, 32, 0, 47, 93, 53, 47, 53, +1, 43, 93, 43, 53, 43, 53, -1, -1, 0, 74, -2, -39, 4, 14, 3, 112, 2, 54, 3, -83, 0, 0, 0, 55, +5, 45, 2, -128, -1, 56, 1, 23, 5, 45, 0, -56, 1, 44, 0, 50, 64, 9, 2, 0, 35, 35, 12, 21, 65, +1, 31, -72, -1, -64, 64, 21, 18, 21, 52, 96, 31, 1, 37, 31, 31, 0, 0, 65, 2, 36, 1, 127, 32, -113, +32, 2, 32, 0, 47, 93, 53, 47, 53, 1, 43, 93, 43, 53, 43, 53, -1, -1, 0, 74, -1, 70, 3, -23, 5, +22, 2, 54, 3, -83, 0, 0, 1, 23, 5, 46, 1, -112, 4, -118, 0, 43, 64, 30, 2, 1, 0, 31, 31, 21, +21, 65, 2, 1, 36, 64, 20, 21, 52, 36, 64, 12, 14, 52, 16, 36, 79, 36, 127, 36, -97, 36, 4, 36, 0, +47, 93, 43, 43, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 74, -1, 70, 3, -23, 5, 22, 2, 54, 3, -83, +0, 0, 1, 23, 5, 46, 1, -112, 4, -118, 0, 43, 64, 30, 2, 1, 0, 31, 31, 21, 21, 65, 2, 1, 36, +64, 20, 21, 52, 36, 64, 12, 14, 52, 16, 36, 79, 36, 127, 36, -97, 36, 4, 36, 0, 47, 93, 43, 43, 53, +53, 1, 43, 53, 53, 0, -1, -1, 0, 74, -1, 70, 3, -23, 6, 17, 2, 54, 3, -83, 0, 0, 1, 23, 5, +50, 1, 124, 5, -123, 0, 44, 64, 20, 4, 3, 2, 1, 0, 35, 35, 21, 21, 65, 4, 3, 2, 1, 15, 40, +-49, 40, 2, 40, -72, -1, -64, -77, 14, 17, 52, 40, 0, 47, 43, 93, 53, 53, 53, 53, 1, 43, 53, 53, 53, +53, -1, -1, 0, 74, -1, 70, 3, -23, 6, 17, 2, 54, 3, -83, 0, 0, 1, 23, 5, 50, 1, 124, 5, -123, +0, 44, 64, 20, 4, 3, 2, 1, 0, 35, 35, 21, 21, 65, 4, 3, 2, 1, 15, 40, -49, 40, 2, 40, -72, +-1, -64, -77, 14, 17, 52, 40, 0, 47, 43, 93, 53, 53, 53, 53, 1, 43, 53, 53, 53, 53, -1, -1, 0, 62, +-1, 108, 6, -110, 4, -65, 2, 54, 3, -79, 0, 0, 0, 55, 5, 45, 3, -24, 4, 56, 1, 23, 5, 45, 4, +-80, 0, 0, 0, 52, 64, 21, 2, 0, 77, 75, 9, 0, 65, 1, 0, 73, 71, 35, 0, 65, 2, 76, 64, 11, +21, 52, 76, -72, -1, -64, 64, 11, 9, 10, 52, 76, 1, 72, 64, 11, 16, 52, 72, 0, 47, 43, 53, 47, 43, +43, 53, 1, 43, 53, 43, 53, -1, -1, 0, 62, -1, 108, 6, -110, 4, -65, 2, 54, 3, -79, 0, 0, 0, 55, +5, 45, 3, -24, 4, 56, 1, 23, 5, 45, 4, -80, 0, 0, 0, 52, 64, 21, 2, 0, 77, 75, 9, 0, 65, +1, 0, 73, 71, 35, 0, 65, 2, 76, 64, 11, 21, 52, 76, -72, -1, -64, 64, 11, 9, 10, 52, 76, 1, 72, +64, 11, 16, 52, 72, 0, 47, 43, 53, 47, 43, 43, 53, 1, 43, 53, 43, 53, -1, -1, -1, -70, -1, -95, 4, +63, 4, -65, 2, 54, 3, -77, 0, 0, 0, 55, 5, 45, 1, -112, 4, 56, 1, 23, 5, 45, 2, 88, 0, 0, +0, 52, 64, 21, 2, 0, 64, 64, 54, 54, 65, 1, 0, 62, 60, 26, 0, 65, 2, 65, 64, 11, 21, 52, 65, +-72, -1, -64, 64, 11, 9, 10, 52, 65, 1, 61, 64, 11, 16, 52, 61, 0, 47, 43, 53, 47, 43, 43, 53, 1, +43, 53, 43, 53, -1, -1, -1, -70, -1, -95, 4, 63, 4, -65, 2, 54, 3, -77, 0, 0, 0, 55, 5, 45, 1, +-112, 4, 56, 1, 23, 5, 45, 2, 88, 0, 0, 0, 52, 64, 21, 2, 0, 64, 64, 54, 54, 65, 1, 0, 62, +60, 26, 0, 65, 2, 65, 64, 11, 21, 52, 65, -72, -1, -64, 64, 11, 9, 10, 52, 65, 1, 61, 64, 11, 16, +52, 61, 0, 47, 43, 53, 47, 43, 43, 53, 1, 43, 53, 43, 53, -1, -1, 0, 62, -2, -103, 6, -108, 3, 87, +2, 54, 3, -79, 0, 0, 1, 23, 5, 48, 4, -80, 0, 0, 0, 49, -77, 3, 2, 1, 71, -72, -1, -64, 64, +18, 9, 17, 52, 0, 71, 71, 0, 0, 65, 3, 2, 1, 76, 64, 12, 21, 52, 76, -72, -1, -64, -77, 9, 10, +52, 76, 0, 47, 43, 43, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, 0, 62, -2, -103, 6, -108, 3, +87, 2, 54, 3, -79, 0, 0, 1, 23, 5, 48, 4, -80, 0, 0, 0, 49, -77, 3, 2, 1, 71, -72, -1, -64, +64, 18, 9, 17, 52, 0, 71, 71, 0, 0, 65, 3, 2, 1, 76, 64, 12, 21, 52, 76, -72, -1, -64, -77, 9, +10, 52, 76, 0, 47, 43, 43, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, -1, -70, -2, -103, 4, 63, +3, 53, 2, 54, 3, -77, 0, 0, 1, 23, 5, 48, 2, 88, 0, 0, 0, 49, -77, 3, 2, 1, 60, -72, -1, +-64, 64, 18, 9, 17, 52, 0, 60, 60, 0, 0, 65, 3, 2, 1, 65, 64, 12, 21, 52, 65, -72, -1, -64, -77, +9, 10, 52, 65, 0, 47, 43, 43, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, -1, -70, -2, -103, 4, +63, 3, 53, 2, 54, 3, -77, 0, 0, 1, 23, 5, 48, 2, 88, 0, 0, 0, 49, -77, 3, 2, 1, 60, -72, +-1, -64, 64, 18, 9, 17, 52, 0, 60, 60, 0, 0, 65, 3, 2, 1, 65, 64, 12, 21, 52, 65, -72, -1, -64, +-77, 9, 10, 52, 65, 0, 47, 43, 43, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, 0, 62, -2, -103, +6, -108, 5, -56, 2, 54, 3, -79, 0, 0, 0, 55, 5, 48, 4, -80, 0, 0, 1, 23, 5, 47, 3, -24, 5, +60, 0, 81, 64, 13, 6, 5, 4, 0, 93, 87, 35, 0, 65, 3, 2, 1, 71, -72, -1, -64, 64, 31, 9, 17, +52, 0, 71, 71, 0, 0, 65, 6, 5, 4, 16, 92, 47, 92, 96, 92, -128, 92, 4, 92, 3, 2, 1, 76, 64, +12, 21, 52, 76, -72, -1, -64, -77, 9, 10, 52, 76, 0, 47, 43, 43, 53, 53, 53, 47, 93, 53, 53, 53, 1, +43, 43, 53, 53, 53, 43, 53, 53, 53, 0, -1, -1, 0, 62, -2, -103, 6, -108, 5, -56, 2, 54, 3, -79, 0, +0, 0, 55, 5, 48, 4, -80, 0, 0, 1, 23, 5, 47, 3, -24, 5, 60, 0, 81, 64, 13, 6, 5, 4, 0, +93, 87, 35, 0, 65, 3, 2, 1, 71, -72, -1, -64, 64, 31, 9, 17, 52, 0, 71, 71, 0, 0, 65, 6, 5, +4, 16, 92, 47, 92, 96, 92, -128, 92, 4, 92, 3, 2, 1, 76, 64, 12, 21, 52, 76, -72, -1, -64, -77, 9, +10, 52, 76, 0, 47, 43, 43, 53, 53, 53, 47, 93, 53, 53, 53, 1, 43, 43, 53, 53, 53, 43, 53, 53, 53, +0, -1, -1, -1, -70, -2, -103, 4, 63, 5, -56, 2, 54, 3, -77, 0, 0, 0, 55, 5, 48, 2, 88, 0, 0, +1, 23, 5, 47, 1, -112, 5, 60, 0, 81, 64, 13, 6, 5, 4, 0, 82, 76, 26, 0, 65, 3, 2, 1, 60, +-72, -1, -64, 64, 31, 9, 17, 52, 0, 60, 60, 0, 0, 65, 6, 5, 4, 16, 81, 47, 81, 96, 81, -128, 81, +4, 81, 3, 2, 1, 65, 64, 12, 21, 52, 65, -72, -1, -64, -77, 9, 10, 52, 65, 0, 47, 43, 43, 53, 53, +53, 47, 93, 53, 53, 53, 1, 43, 43, 53, 53, 53, 43, 53, 53, 53, 0, -1, -1, -1, -70, -2, -103, 4, 63, +5, -56, 2, 54, 3, -77, 0, 0, 0, 55, 5, 48, 2, 88, 0, 0, 1, 23, 5, 47, 1, -112, 5, 60, 0, +81, 64, 13, 6, 5, 4, 0, 82, 76, 26, 0, 65, 3, 2, 1, 60, -72, -1, -64, 64, 31, 9, 17, 52, 0, +60, 60, 0, 0, 65, 6, 5, 4, 16, 81, 47, 81, 96, 81, -128, 81, 4, 81, 3, 2, 1, 65, 64, 12, 21, +52, 65, -72, -1, -64, -77, 9, 10, 52, 65, 0, 47, 43, 43, 53, 53, 53, 47, 93, 53, 53, 53, 1, 43, 43, +53, 53, 53, 43, 53, 53, 53, 0, -1, -1, 0, 62, -1, 76, 8, -55, 3, 87, 2, 54, 3, -71, 0, 0, 1, +23, 5, 46, 5, 120, 0, 0, 0, 36, 64, 16, 3, 2, 0, 69, 63, 25, 0, 65, 3, 2, 68, 64, 12, 21, +52, 68, -72, -1, -64, -77, 9, 10, 52, 68, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, 0, 62, -1, +76, 8, -55, 3, 87, 2, 54, 3, -71, 0, 0, 1, 23, 5, 46, 5, 120, 0, 0, 0, 36, 64, 16, 3, 2, +0, 69, 63, 25, 0, 65, 3, 2, 68, 64, 12, 21, 52, 68, -72, -1, -64, -77, 9, 10, 52, 68, 0, 47, 43, +43, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, -1, 76, 6, -59, 3, 62, 2, 54, 3, -69, 0, 0, 1, 23, +5, 46, 3, -24, 0, 0, 0, 36, 64, 16, 3, 2, 0, 55, 49, 18, 0, 65, 3, 2, 54, 64, 12, 21, 52, +54, -72, -1, -64, -77, 9, 10, 52, 54, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, -1, 76, +6, -59, 3, 62, 2, 54, 3, -69, 0, 0, 1, 23, 5, 46, 3, -24, 0, 0, 0, 36, 64, 16, 3, 2, 0, +55, 49, 18, 0, 65, 3, 2, 54, 64, 12, 21, 52, 54, -72, -1, -64, -77, 9, 10, 52, 54, 0, 47, 43, 43, +53, 53, 1, 43, 53, 53, -1, -1, 0, 62, -1, 108, 8, -55, 5, -56, 2, 54, 3, -71, 0, 0, 1, 23, 5, +47, 5, 120, 5, 60, 0, 35, 64, 22, 4, 3, 2, 0, 73, 67, 25, 0, 65, 4, 3, 2, 16, 72, 47, 72, +96, 72, -128, 72, 4, 72, 0, 47, 93, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, 62, -1, 108, 8, +-55, 5, -56, 2, 54, 3, -71, 0, 0, 1, 23, 5, 47, 5, 120, 5, 60, 0, 35, 64, 22, 4, 3, 2, 0, +73, 67, 25, 0, 65, 4, 3, 2, 16, 72, 47, 72, 96, 72, -128, 72, 4, 72, 0, 47, 93, 53, 53, 53, 1, +43, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 6, -59, 5, -56, 2, 54, 3, -69, 0, 0, 1, 23, 5, 47, +3, -24, 5, 60, 0, 41, 64, 13, 4, 3, 2, 0, 59, 53, 18, 0, 65, 4, 3, 2, 58, -72, -1, -64, 64, +9, 13, 17, 52, 16, 58, 47, 58, 2, 58, 0, 47, 93, 43, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, +-1, -70, 1, 37, 6, -59, 5, -56, 2, 54, 3, -69, 0, 0, 1, 23, 5, 47, 3, -24, 5, 60, 0, 41, 64, +13, 4, 3, 2, 0, 59, 53, 18, 0, 65, 4, 3, 2, 58, -72, -1, -64, 64, 9, 13, 17, 52, 16, 58, 47, +58, 2, 58, 0, 47, 93, 43, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 4, -89, 6, +89, 2, 54, 3, -63, 0, 0, 1, 23, 5, 47, 2, 88, 5, 60, 0, 49, 64, 16, 4, 3, 2, 0, 68, 1, +-111, 68, 68, 33, 33, 65, 4, 3, 2, 67, -72, -1, -64, 64, 13, 13, 17, 52, 16, 67, 47, 67, -97, 67, -81, +67, 4, 67, 0, 47, 93, 43, 53, 53, 53, 1, 43, 93, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 4, -89, +6, 89, 2, 54, 3, -63, 0, 0, 1, 23, 5, 47, 2, 88, 5, 60, 0, 49, 64, 16, 4, 3, 2, 0, 68, +1, -111, 68, 68, 33, 33, 65, 4, 3, 2, 67, -72, -1, -64, 64, 13, 13, 17, 52, 16, 67, 47, 67, -97, 67, +-81, 67, 4, 67, 0, 47, 93, 43, 53, 53, 53, 1, 43, 93, 53, 53, 53, 0, -1, -1, 0, 42, -2, 78, 4, +32, 6, -52, 2, 54, 3, -55, 0, 0, 1, 23, 5, 47, 0, 100, 6, 64, 0, 70, -77, 3, 2, 1, 66, -72, +-1, -64, 64, 44, 30, 67, 52, -112, 66, -32, 66, 2, 0, 66, 60, 17, 25, 65, 3, 2, 1, 65, 64, 35, 91, +52, 65, 64, 18, 22, 52, 95, 65, 111, 65, 127, 65, -97, 65, 4, 47, 65, 63, 65, 112, 65, 3, 65, 0, 47, +93, 113, 43, 43, 53, 53, 53, 1, 43, 93, 43, 53, 53, 53, -1, -1, 0, 54, -2, 78, 3, -29, 5, -56, 2, +54, 3, -54, 0, 0, 1, 23, 5, 47, 0, -96, 5, 60, 0, 50, 64, 27, 3, 2, 1, 0, 63, 57, 7, 27, +65, 3, 2, 1, 31, 62, 1, 16, 62, 47, 62, -128, 62, -97, 62, -81, 62, 5, 62, -72, -1, -64, -77, 13, 17, +52, 62, 0, 47, 43, 93, 114, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, -1, -70, 1, 37, 3, -61, 6, 44, +2, 54, 3, -53, 0, 0, 1, 23, 5, 47, 0, 120, 5, -96, 0, 35, 64, 22, 3, 2, 1, 0, 40, 34, 10, +17, 65, 3, 2, 1, 47, 39, 63, 39, 96, 39, -128, 39, 4, 39, 0, 47, 93, 53, 53, 53, 1, 43, 53, 53, +53, 0, -1, -1, -1, -70, 1, 37, 3, 39, 5, -56, 2, 54, 3, -52, 0, 0, 1, 23, 5, 47, 0, 100, 5, +60, 0, 52, 64, 13, 3, 2, 1, 0, 51, 45, 23, 32, 65, 3, 2, 1, 50, -72, -1, -128, -77, 15, 17, 52, +50, -72, -1, -64, 64, 11, 13, 14, 52, 16, 50, 47, 50, -81, 50, 3, 50, 0, 47, 93, 43, 43, 53, 53, 53, +1, 43, 53, 53, 53, 0, 2, 0, 39, 1, 37, 6, 79, 3, -46, 0, 31, 0, 42, 0, -118, 64, 23, 98, 17, +1, 2, 80, 17, 1, 68, 17, 1, 54, 17, 1, 121, 5, 1, -119, 5, 1, 19, 19, 32, 23, -69, 2, -13, 0, +39, 0, 32, 3, 16, -77, 64, 0, 44, 12, -72, 2, -5, 64, 12, 32, 33, 11, 1, 0, 11, 16, 11, 2, 11, +11, 15, -72, 3, 3, 64, 10, 7, 112, 32, -128, 32, 2, 32, 32, 19, 36, 65, 11, 2, -17, 0, 27, 3, 4, +0, 12, 0, 11, 3, 4, 0, 19, 2, -17, 0, 1, 2, -21, 1, 42, -123, 0, 63, -19, 63, 51, 63, -19, 17, +57, 47, 93, 1, 47, -19, 50, 25, 47, 93, 93, 26, -19, 16, -48, 26, 24, -3, -34, -19, 18, 57, 47, 49, 48, +0, 93, 1, 93, 93, 93, 93, 95, 93, 1, 33, 34, 39, 38, 39, 38, 53, 52, 55, 54, 55, 23, 6, 6, 21, +20, 4, 33, 33, 38, 39, 38, 53, 52, 55, 54, 51, 50, 23, 22, 21, 39, 52, 39, 38, 35, 34, 6, 21, 20, +23, 22, 6, 79, -4, 107, -45, -127, -102, 79, 86, 51, 37, 18, 40, 43, 28, 1, 32, 1, 58, 2, -31, 117, 55, +63, 62, 70, 85, 99, 44, 37, 104, 19, 23, 47, 34, 33, 41, 30, 1, 37, 26, 31, 72, 78, -122, 89, 119, 81, +40, 23, 87, 91, 37, -124, 126, 32, 42, 48, 71, 93, 106, 119, 117, 98, -75, 14, 87, 47, 56, 41, 37, 49, 25, +18, 0, -1, -1, 0, 39, -1, -95, 6, 79, 3, -46, 2, 54, 5, -70, 0, 0, 1, 23, 5, 45, 4, -120, 0, +0, 0, 53, -79, 2, 43, -72, -1, -64, -77, 17, 27, 52, 43, -72, -1, -64, -78, 9, 15, 52, -72, -1, -57, 64, +12, 43, 43, 0, 0, 65, 2, 44, 64, 11, 21, 52, 44, -72, -1, -64, -77, 9, 10, 52, 44, 0, 47, 43, 43, +53, 1, 43, 43, 43, 53, 0, -1, -1, 0, 39, -1, -95, 6, 79, 3, -46, 2, 54, 5, -70, 0, 0, 1, 23, +5, 45, 4, -120, 0, 0, 0, 53, -79, 2, 43, -72, -1, -64, -77, 17, 27, 52, 43, -72, -1, -64, -78, 9, 15, +52, -72, -1, -57, 64, 12, 43, 43, 0, 0, 65, 2, 44, 64, 11, 21, 52, 44, -72, -1, -64, -77, 9, 10, 52, +44, 0, 47, 43, 43, 53, 1, 43, 43, 43, 53, 0, -1, -1, -1, -70, -1, -95, 2, 36, 4, 91, 2, 54, 5, +42, 0, 0, 1, 22, 5, 45, 0, 0, 0, 32, 64, 14, 2, 0, 36, 34, 13, 0, 65, 2, 35, 64, 11, 21, +52, 35, -72, -1, -64, -77, 9, 10, 52, 35, 0, 47, 43, 43, 53, 1, 43, 53, -1, -1, -1, -70, -1, -95, 2, +26, 3, -13, 2, 54, 5, 43, 0, 0, 1, 22, 5, 45, 0, 0, 0, 32, 64, 14, 2, 20, 32, 30, 1, 0, +65, 2, 31, 64, 11, 21, 52, 31, -72, -1, -64, -77, 9, 10, 52, 31, 0, 47, 43, 43, 53, 1, 43, 53, -1, +-1, 0, 39, -1, -95, 6, 79, 5, 35, 2, 54, 5, -70, 0, 0, 0, 55, 5, 45, 2, 88, 0, 0, 1, 23, +5, 45, 4, 76, 4, -100, 0, 51, 64, 28, 3, 0, 49, 47, 23, 0, 65, 2, 0, 45, 43, 7, 0, 65, 3, +48, 64, 11, 18, 52, 48, 2, 44, 64, 11, 21, 52, 44, -72, -1, -64, -77, 9, 10, 52, 44, 0, 47, 43, 43, +53, 47, 43, 53, 1, 43, 53, 43, 53, 0, -1, -1, 0, 39, -1, -95, 6, 79, 5, 35, 2, 54, 5, -70, 0, +0, 0, 55, 5, 45, 2, 88, 0, 0, 1, 23, 5, 45, 4, 76, 4, -100, 0, 51, 64, 28, 3, 0, 49, 47, +23, 0, 65, 2, 0, 45, 43, 7, 0, 65, 3, 48, 64, 11, 18, 52, 48, 2, 44, 64, 11, 21, 52, 44, -72, +-1, -64, -77, 9, 10, 52, 44, 0, 47, 43, 43, 53, 47, 43, 53, 1, 43, 53, 43, 53, 0, -1, -1, -1, -70, +-1, -95, 2, 36, 5, -121, 2, 54, 5, 42, 0, 0, 0, 54, 5, 45, 0, 0, 1, 23, 5, 45, -1, -60, 5, +0, 0, 83, 64, 55, 3, 40, 64, 10, 17, 52, 0, 40, 40, 13, 13, 65, 2, 0, 36, 34, 13, 0, 65, 3, +31, 39, -17, 39, 2, -113, 39, -97, 39, 2, 47, 39, -128, 39, -97, 39, 3, 39, 64, 18, 21, 52, 39, 64, 9, +13, 52, 39, 2, 35, 64, 11, 21, 52, 35, -72, -1, -64, -77, 9, 10, 52, 35, 0, 47, 43, 43, 53, 47, 43, +43, 93, 113, 114, 53, 1, 43, 53, 43, 43, 53, 0, -1, -1, -1, -70, -1, -95, 2, 26, 5, -121, 2, 54, 5, +43, 0, 0, 0, 54, 5, 45, 0, 0, 1, 23, 5, 45, -1, -60, 5, 0, 0, 67, 64, 41, 3, 36, 64, 10, +17, 52, 0, 36, 36, 10, 10, 65, 2, 0, 32, 30, 10, 0, 65, 3, -97, 35, 1, 35, 64, 18, 19, 52, 35, +64, 11, 11, 52, 35, 2, 31, 64, 11, 21, 52, 31, -72, -1, -64, -77, 9, 10, 52, 31, 0, 47, 43, 43, 53, +47, 43, 43, 93, 53, 1, 43, 53, 43, 43, 53, 0, -1, -1, 0, 39, 1, 37, 6, 79, 6, 44, 2, 54, 5, +-70, 0, 0, 1, 23, 5, 47, 4, 76, 5, -96, 0, 40, -75, 4, 3, 2, -48, 53, 1, -72, -1, -91, 64, 16, +53, 53, 23, 23, 65, 4, 3, 2, 63, 52, 96, 52, -128, 52, 3, 52, 0, 47, 93, 53, 53, 53, 1, 43, 93, +53, 53, 53, -1, -1, 0, 39, 1, 37, 6, 79, 6, 44, 2, 54, 5, -70, 0, 0, 1, 23, 5, 47, 4, 76, +5, -96, 0, 40, -75, 4, 3, 2, -48, 53, 1, -72, -1, -91, 64, 16, 53, 53, 23, 23, 65, 4, 3, 2, 63, +52, 96, 52, -128, 52, 3, 52, 0, 47, 93, 53, 53, 53, 1, 43, 93, 53, 53, 53, -1, -1, -1, -70, 1, 37, +2, 36, 6, -112, 2, 54, 5, 42, 0, 0, 1, 23, 5, 47, -1, -40, 6, 4, 0, 60, -77, 4, 3, 2, 44, +-72, -1, -64, 64, 22, 10, 13, 52, 0, 44, 38, 1, 0, 65, 4, 3, 2, 15, 43, 47, 43, 80, 43, 96, 43, +4, 43, -72, -1, -128, 64, 9, 16, 17, 52, 43, 64, 11, 12, 52, 43, 0, 47, 43, 43, 93, 53, 53, 53, 1, +43, 43, 53, 53, 53, -1, -1, -1, -70, 1, 37, 2, 26, 6, -112, 2, 54, 5, 43, 0, 0, 1, 23, 5, 47, +-1, -20, 6, 4, 0, 51, 64, 20, 4, 3, 2, 0, 40, 34, 1, 0, 65, 4, 3, 2, 16, 39, 47, 39, 64, +39, 3, 39, -72, -1, -64, -77, 24, 30, 52, 39, -72, -1, -128, -77, 14, 17, 52, 39, 0, 47, 43, 43, 93, 53, +53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, 39, -2, -103, 6, -108, 3, -46, 2, 54, 5, -70, 0, 0, 1, +23, 5, 48, 4, -80, 0, 0, 0, 49, -77, 4, 3, 2, 53, -72, -1, -64, 64, 18, 18, 19, 52, 0, 53, 43, +23, 0, 65, 4, 3, 2, 48, 64, 12, 21, 52, 48, -72, -1, -64, -77, 9, 10, 52, 48, 0, 47, 43, 43, 53, +53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, 0, 39, -2, -103, 6, -108, 3, -46, 2, 54, 5, -70, 0, 0, +1, 23, 5, 48, 4, -80, 0, 0, 0, 49, -77, 4, 3, 2, 53, -72, -1, -64, 64, 18, 18, 19, 52, 0, 53, +43, 23, 0, 65, 4, 3, 2, 48, 64, 12, 21, 52, 48, -72, -1, -64, -77, 9, 10, 52, 48, 0, 47, 43, 43, +53, 53, 53, 1, 43, 43, 53, 53, 53, 0, -1, -1, -1, -70, -2, -103, 2, 36, 4, 91, 2, 54, 5, 42, 0, +0, 1, 22, 5, 48, 40, 0, 0, 40, 64, 18, 4, 3, 2, 0, 44, 34, 1, 0, 65, 4, 3, 2, 39, 64, +12, 21, 52, 39, -72, -1, -64, -77, 9, 10, 52, 39, 0, 47, 43, 43, 53, 53, 53, 1, 43, 53, 53, 53, -1, +-1, -1, -70, -2, -103, 2, 26, 3, -13, 2, 54, 5, 43, 0, 0, 1, 22, 5, 48, 40, 0, 0, 40, 64, 18, +4, 3, 2, 0, 40, 30, 1, 0, 65, 4, 3, 2, 35, 64, 12, 21, 52, 35, -72, -1, -64, -77, 9, 10, 52, +35, 0, 47, 43, 43, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, 0, 39, 1, 37, 6, 79, 6, 104, 2, 54, +5, -70, 0, 0, 1, 23, 5, 50, 4, 76, 5, -36, 0, 45, 64, 29, 5, 4, 3, 2, -112, 53, 1, 0, 53, +47, 23, 0, 65, 5, 4, 3, 2, 31, 52, 64, 52, 96, 52, 112, 52, -97, 52, 5, 52, 0, 47, 93, 53, 53, +53, 53, 1, 43, 93, 53, 53, 53, 53, 0, -1, -1, 0, 39, 1, 37, 6, 79, 6, 104, 2, 54, 5, -70, 0, +0, 1, 23, 5, 50, 4, 76, 5, -36, 0, 45, 64, 29, 5, 4, 3, 2, -112, 53, 1, 0, 53, 47, 23, 0, +65, 5, 4, 3, 2, 31, 52, 64, 52, 96, 52, 112, 52, -97, 52, 5, 52, 0, 47, 93, 53, 53, 53, 53, 1, +43, 93, 53, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 2, 36, 6, -72, 2, 54, 5, 42, 0, 0, 1, 23, +5, 50, -1, -40, 6, 44, 0, 82, -76, 5, 4, 3, 2, 44, -72, -1, -64, 64, 38, 10, 13, 52, 0, 44, 38, +1, 0, 65, 5, 4, 3, 2, 31, 43, 47, 43, 95, 43, -17, 43, 4, -113, 43, 1, 15, 43, 47, 43, 80, 43, +3, 43, 64, 18, 22, 52, 43, -72, -1, -128, 64, 9, 15, 17, 52, 43, 64, 9, 12, 52, 43, 0, 47, 43, 43, +43, 93, 113, 114, 53, 53, 53, 53, 1, 43, 43, 53, 53, 53, 53, -1, -1, -1, -70, 1, 37, 2, 26, 6, -72, +2, 54, 5, 43, 0, 0, 1, 23, 5, 50, -1, -40, 6, 44, 0, 63, -76, 5, 4, 3, 2, 40, -72, -1, -64, +64, 29, 10, 13, 52, 0, 40, 34, 1, 0, 65, 5, 4, 3, 2, 15, 39, 47, 39, 64, 39, 96, 39, -97, 39, +-81, 39, -16, 39, 7, 39, -72, -1, -128, -77, 14, 17, 52, 39, 0, 47, 43, 93, 53, 53, 53, 53, 1, 43, 43, +53, 53, 53, 53, 0, -1, -1, 0, 70, -1, 103, 4, -89, 5, 5, 2, 54, 5, 44, 0, 0, 1, 23, 5, 45, +2, 68, 4, 126, 0, 29, 64, 19, 2, 48, 59, 1, 30, 59, 59, 41, 41, 65, 2, 15, 60, 47, 60, 112, 60, +3, 60, 0, 47, 93, 53, 1, 43, 93, 53, 0, -1, -1, 0, 70, -1, 103, 4, -89, 5, 5, 2, 54, 5, 44, +0, 0, 1, 23, 5, 45, 2, 68, 4, 126, 0, 29, 64, 19, 2, 48, 59, 1, 30, 59, 59, 41, 41, 65, 2, +15, 60, 47, 60, 112, 60, 3, 60, 0, 47, 93, 53, 1, 43, 93, 53, 0, -1, -1, 0, 70, -1, 103, 4, -89, +5, -56, 2, 54, 5, 44, 0, 0, 1, 23, 5, 47, 2, 48, 5, 60, 0, 37, 64, 24, 4, 3, 2, 107, 63, +63, 41, 41, 65, 4, 3, 2, 15, 68, 47, 68, 64, 68, 96, 68, 112, 68, 5, 68, 0, 47, 93, 53, 53, 53, +1, 43, 53, 53, 53, 0, -1, -1, 0, 70, -1, 103, 4, -89, 5, -56, 2, 54, 5, 44, 0, 0, 1, 23, 5, +47, 2, 48, 5, 60, 0, 37, 64, 24, 4, 3, 2, 107, 63, 63, 41, 41, 65, 4, 3, 2, 15, 68, 47, 68, +64, 68, 96, 68, 112, 68, 5, 68, 0, 47, 93, 53, 53, 53, 1, 43, 53, 53, 53, 0, 0, 1, 0, 20, 1, +37, 6, 127, 5, 99, 0, 43, 0, -116, -71, 0, 13, 3, 0, -77, 0, 45, 27, 33, -72, 2, -13, -78, 22, 8, +10, -72, 3, 3, 64, 23, 7, 5, 11, 24, 1, 24, 27, 121, 15, 1, 26, 15, 42, 15, 58, 15, 3, 9, 15, +1, 15, 12, 19, -72, 2, -17, 64, 27, -122, 41, 1, 26, 41, 42, 41, 58, 41, 3, 9, 41, 1, 41, 12, 31, +-97, 37, -81, 37, -65, 37, 3, 37, 37, 12, 28, -72, 2, -17, 64, 10, 47, 27, -97, 27, 2, 27, 8, 7, 43, +12, -70, 2, -17, 0, 1, 2, -21, 0, 63, -3, 50, -52, 50, 47, 93, -19, 17, 57, 47, 93, 57, 18, 57, 93, +93, 93, -19, 17, 57, 93, 93, 93, 17, 57, 93, 1, 47, 51, -3, 50, -34, -3, -52, 16, -48, -19, 49, 48, 1, +33, 34, 39, 38, 53, 52, 55, 23, 6, 21, 20, 33, 33, 38, 39, 38, 37, 36, 37, 38, 38, 53, 52, 55, 54, +55, 55, 21, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 23, 4, 23, 22, 23, 6, 127, -5, 85, -53, 94, -105, +52, 37, 8, 1, 111, 4, 55, 37, 92, 65, -2, -45, -2, -2, -2, -1, 90, -124, 109, 117, -50, -33, -47, -124, 70, +116, 68, 16, 79, -28, -28, 1, 106, 58, 124, 57, 1, 37, 37, 59, -87, 71, 107, 20, 34, 29, -70, 61, 39, 28, +58, 50, 49, 18, 90, 47, 88, 103, 111, 82, 88, -83, 70, 44, 31, 51, 34, 42, 26, 6, 18, 43, 44, 70, 37, +78, -111, 0, 1, 0, 20, 1, 37, 7, 118, 5, 99, 0, 52, 0, -89, -73, 24, 5, 5, 43, 0, 54, 37, 43, +-72, 2, -13, -78, 32, 17, 19, -72, 3, 3, 64, 47, 16, 14, -124, 47, 1, 118, 47, 1, 25, 47, 57, 47, 2, +47, 45, 51, 11, 34, 1, 34, 37, -118, 26, 1, 121, 26, 1, 106, 26, 1, 89, 26, 1, 75, 26, 1, 56, 26, +1, 25, 26, 41, 26, 2, 26, 22, 28, -72, 2, -17, 64, 12, 41, -97, 45, -81, 45, -65, 45, 3, 45, 45, 22, +38, -72, 2, -17, 64, 9, 47, 37, -97, 37, 2, 37, 17, 16, 22, -65, 2, -17, 0, 10, 2, -21, 0, 51, 2, +-17, 0, 5, 0, 0, 2, -21, 0, 63, 50, -19, 63, -3, -50, 50, 47, 93, -19, 17, 57, 47, 93, 57, -19, 17, +57, 93, 93, 93, 93, 93, 93, 93, 17, 57, 93, 17, 18, 57, 93, 93, 93, 1, 47, 51, -3, 50, -34, -3, -52, +16, -64, 17, 57, 47, -51, 49, 48, 1, 35, 34, 39, 38, 39, 20, 7, 6, 35, 33, 34, 39, 38, 53, 52, 55, +23, 6, 21, 20, 33, 33, 32, 53, 52, 39, 38, 37, 38, 39, 38, 53, 52, 55, 54, 55, 55, 21, 7, 6, 7, +6, 21, 20, 23, 4, 23, 22, 23, 22, 51, 51, 7, 118, 123, 94, -113, 57, -76, -112, -128, 118, -2, 57, -53, 94, +-105, 52, 37, 8, 1, 111, 1, -4, 1, 8, 104, -105, -2, 64, 91, 64, 67, 109, 118, -51, -33, -47, -124, 70, 116, +-93, 2, 17, -107, 120, 121, -65, 63, -125, 1, 37, 78, 31, 117, 90, 72, 64, 37, 59, -87, 71, 107, 20, 34, 29, +-70, 61, 41, 34, 49, 100, 20, 43, 45, 47, 88, 103, 112, 81, 88, -83, 70, 44, 31, 51, 34, 54, 38, 123, 66, +64, 64, 100, 0, 1, -1, -70, 1, 37, 3, 39, 4, -24, 0, 29, 0, -117, -76, 88, 8, 1, 16, 3, -72, 3, +0, -78, 0, 31, 21, -72, 2, -13, 64, 24, 10, 2, 60, 12, 1, 11, 12, 27, 12, 43, 12, 3, 12, 15, 57, +5, 89, 5, 105, 5, 3, 5, 3, 7, -72, 2, -17, 64, 33, 117, 25, 1, 104, 25, 1, 25, 3, 57, 19, 1, +19, -97, 23, -81, 23, -65, 23, 3, 61, 23, 1, 15, 23, 31, 23, 47, 23, 3, 23, 23, 3, 16, -72, 2, -17, +-75, -97, 15, 1, 15, 29, 3, -69, 2, -17, 0, 1, 2, -21, 1, 42, -123, 0, 63, -19, 50, 47, 93, -19, 17, +57, 47, 93, 93, 93, 57, 93, 18, 57, 93, 93, -19, 17, 57, 93, 17, 57, 93, 93, 1, 47, -42, -19, 16, -48, +-19, -60, 49, 48, 0, 93, 1, 33, 53, 33, 38, 39, 38, 39, 38, 38, 53, 52, 55, 54, 55, 55, 21, 7, 6, +7, 6, 21, 20, 23, 22, 23, 22, 23, 22, 23, 3, 39, -4, -109, 2, -7, 35, 94, 37, -17, 90, -124, 109, 118, +-51, -33, -47, -124, 70, 116, -93, -99, 112, 72, 55, 42, 14, 1, 37, -82, 58, 39, 15, 50, 19, 89, 47, 88, 103, +112, 81, 88, -83, 70, 44, 31, 51, 34, 59, 33, 31, 47, 30, 75, 58, 53, 0, 0, 1, -1, -70, 1, 37, 4, +30, 4, -24, 0, 39, 0, -106, 64, 14, 89, 17, 1, 40, 2, 1, 12, 3, 3, 30, 25, 0, 41, 30, -72, 2, +-13, 64, 29, 19, 9, -128, 34, 1, 116, 34, 1, 53, 34, 1, 36, 34, 1, 34, 32, 38, 11, 21, 43, 21, 59, +21, 3, 21, 24, 14, 10, 16, -72, 2, -17, 64, 23, 28, -66, 32, 1, -97, 32, -81, 32, 2, 62, 32, 1, 15, +32, 31, 32, 47, 32, 3, 32, 32, 10, 25, -72, 2, -17, -76, -97, 24, 1, 24, 10, -65, 2, -17, 0, 8, 2, +-21, 0, 38, 2, -17, 0, 3, 0, 0, 2, -21, 0, 63, 50, -19, 63, -19, 47, 93, -19, 17, 57, 47, 93, 93, +93, 93, 57, -19, 17, 57, 17, 57, 93, 17, 18, 57, 93, 93, 93, 93, 1, 47, -42, -19, 16, -48, -60, 18, 57, +47, -51, 49, 48, 0, 93, 93, 1, 35, 34, 39, 20, 7, 6, 35, 33, 53, 33, 50, 53, 52, 39, 38, 39, 38, +38, 53, 52, 55, 54, 55, 55, 21, 7, 6, 7, 6, 21, 20, 23, 22, 23, 22, 23, 22, 51, 51, 4, 30, 122, +117, -104, 113, 90, 102, -2, 84, 1, -70, -15, 81, 51, -61, 90, -124, 109, 118, -51, -33, -47, -124, 70, 116, -93, -71, +84, 48, 107, 88, 57, -126, 1, 37, -62, 96, 55, 43, -82, 49, 30, 26, 16, 41, 19, 89, 47, 88, 103, 112, 81, +88, -83, 70, 44, 31, 51, 34, 59, 33, 37, 41, 23, 106, 87, 0, -1, -1, 0, 20, 1, 37, 6, 127, 5, -33, +2, 54, 3, 45, 0, 0, 1, 23, 2, -8, 4, -50, -1, 60, 0, 60, 64, 37, 2, 1, -81, 45, -65, 45, -49, +45, 3, 45, 64, 12, 15, 52, 0, 45, 45, 13, 13, 65, 2, 1, 47, 48, 63, 48, -81, 48, 3, 16, 48, 32, +48, -64, 48, 3, 48, -72, -1, -64, -77, 9, 10, 52, 48, 0, 47, 43, 93, 113, 53, 53, 1, 43, 43, 93, 53, +53, -1, -1, 0, 20, 1, 37, 7, 118, 5, -33, 2, 54, 3, 46, 0, 0, 1, 23, 2, -8, 4, -50, -1, 60, +0, 60, 64, 37, 2, 1, 32, 70, -81, 70, -65, 70, -49, 70, 4, 70, 64, 12, 14, 52, 0, 70, 70, 35, 35, +65, 2, 1, 47, 73, 63, 73, -81, 73, 3, 96, 73, -64, 73, 2, 73, -72, -1, -64, -77, 9, 11, 52, 73, 0, +47, 43, 93, 113, 53, 53, 1, 43, 43, 93, 53, 53, -1, -1, -1, -70, 1, 37, 3, 39, 5, -33, 2, 54, 3, +47, 0, 0, 1, 23, 2, -8, 1, 124, -1, 60, 0, 56, 64, 33, 2, 1, -65, 30, -49, 30, 2, 30, 64, 12, +15, 52, 0, 30, 30, 15, 15, 65, 2, 1, 47, 33, 63, 33, -81, 33, 3, 96, 33, -64, 33, 2, 33, -72, -1, +-64, -77, 9, 11, 52, 33, 0, 47, 43, 93, 113, 53, 53, 1, 43, 43, 93, 53, 53, -1, -1, -1, -70, 1, 37, +4, 30, 5, -33, 2, 54, 3, 48, 0, 0, 1, 23, 2, -8, 1, 124, -1, 60, 0, 58, 64, 35, 2, 1, -81, +55, -65, 55, -49, 55, 3, 55, 64, 12, 14, 52, 0, 55, 55, 39, 39, 65, 2, 1, 47, 58, 63, 58, -81, 58, +3, 96, 58, -64, 58, 2, 58, -72, -1, -64, -77, 9, 11, 52, 58, 0, 47, 43, 93, 113, 53, 53, 1, 43, 43, +93, 53, 53, -1, -1, 0, 45, 1, 37, 4, -49, 6, 51, 2, 54, 3, -39, 0, 0, 1, 23, 5, 45, 1, 104, +5, -84, 0, 73, -76, 2, 16, 74, 1, 74, -72, -1, -64, -78, 11, 14, 52, -72, -1, -59, 64, 42, 74, 74, 27, +27, 65, 0, 26, 0, 27, 16, 26, 16, 27, 4, 2, 15, 75, 127, 75, -81, 75, -65, 75, -17, 75, 5, 75, 64, +33, 47, 52, 75, 64, 11, 13, 52, 75, 64, 11, 17, 52, 75, 0, 47, 43, 43, 43, 93, 53, 93, 1, 43, 43, +113, 53, 0, -1, -1, 0, 45, 1, 37, 4, -49, 6, 51, 2, 54, 3, -39, 0, 0, 1, 23, 5, 45, 1, 104, +5, -84, 0, 73, -76, 2, 16, 74, 1, 74, -72, -1, -64, -78, 11, 14, 52, -72, -1, -59, 64, 42, 74, 74, 27, +27, 65, 0, 26, 0, 27, 16, 26, 16, 27, 4, 2, 15, 75, 127, 75, -81, 75, -65, 75, -17, 75, 5, 75, 64, +33, 47, 52, 75, 64, 11, 13, 52, 75, 64, 11, 17, 52, 75, 0, 47, 43, 43, 43, 93, 53, 93, 1, 43, 43, +113, 53, 0, -1, -1, -1, -70, 1, 37, 3, 39, 6, -65, 2, 54, 3, 47, 0, 0, 1, 23, 5, 45, 0, 80, +6, 56, 0, 59, -73, 1, -32, 30, 1, 16, 30, 1, 30, -72, -1, -64, -77, 31, 35, 52, 30, -72, -1, -64, 64, +25, 9, 15, 52, 50, 30, 30, 14, 14, 65, 1, 16, 31, 63, 31, 79, 31, 127, 31, 4, 31, 64, 54, 62, 52, +31, 0, 47, 43, 93, 53, 1, 43, 43, 43, 93, 113, 53, 0, -1, -1, -1, -70, 1, 37, 3, 39, 6, -65, 2, +54, 3, 47, 0, 0, 1, 23, 5, 45, 0, 80, 6, 56, 0, 59, -73, 1, -32, 30, 1, 16, 30, 1, 30, -72, +-1, -64, -77, 31, 35, 52, 30, -72, -1, -64, 64, 25, 9, 15, 52, 50, 30, 30, 14, 14, 65, 1, 16, 31, 63, +31, 79, 31, 127, 31, 4, 31, 64, 54, 62, 52, 31, 0, 47, 43, 93, 53, 1, 43, 43, 43, 93, 113, 53, 0, +-1, -1, 0, 45, 1, 37, 4, -49, 7, 8, 2, 54, 3, -39, 0, 0, 1, 23, 5, 47, 1, 104, 6, 124, 0, +92, 64, 10, 4, 3, 2, -32, 84, 1, 111, 84, 1, 84, -72, -1, -64, 64, 25, 9, 19, 52, 0, 84, 78, 51, +61, 65, 0, 26, 0, 27, 16, 26, 16, 27, 4, 4, 3, 2, -81, 83, 1, 83, -72, -1, -64, 64, 16, 23, 39, +52, 83, 64, 61, 62, 52, 83, 64, 11, 16, 52, 83, 0, 3, -72, -1, -64, -77, 23, 45, 52, 3, 0, 47, 43, +53, 47, 43, 43, 43, 113, 53, 53, 53, 93, 1, 43, 43, 93, 113, 53, 53, 53, -1, -1, 0, 45, 1, 37, 4, +-49, 7, 8, 2, 54, 3, -39, 0, 0, 1, 23, 5, 47, 1, 104, 6, 124, 0, 92, 64, 10, 4, 3, 2, -32, +84, 1, 111, 84, 1, 84, -72, -1, -64, 64, 25, 9, 19, 52, 0, 84, 78, 51, 61, 65, 0, 26, 0, 27, 16, +26, 16, 27, 4, 4, 3, 2, -81, 83, 1, 83, -72, -1, -64, 64, 16, 23, 39, 52, 83, 64, 61, 62, 52, 83, +64, 11, 16, 52, 83, 0, 3, -72, -1, -64, -77, 23, 45, 52, 3, 0, 47, 43, 53, 47, 43, 43, 43, 113, 53, +53, 53, 93, 1, 43, 43, 93, 113, 53, 53, 53, -1, -1, -1, -70, 1, 37, 3, 39, 6, -47, 2, 54, 3, 47, +0, 0, 1, 23, 6, 110, 0, 40, 6, -7, 0, 39, 64, 25, 3, 2, 1, -17, 40, 1, 0, 40, 40, 10, 10, +65, 3, 2, 1, 63, 39, 79, 39, -128, 39, -65, 39, 4, 39, 0, 47, 93, 53, 53, 53, 1, 43, 93, 53, 53, +53, 0, -1, -1, -1, -70, 1, 37, 3, 39, 6, -47, 2, 54, 3, 47, 0, 0, 1, 23, 6, 110, 0, 40, 6, +-7, 0, 39, 64, 25, 3, 2, 1, -17, 40, 1, 0, 40, 40, 10, 10, 65, 3, 2, 1, 63, 39, 79, 39, -128, +39, -65, 39, 4, 39, 0, 47, 93, 53, 53, 53, 1, 43, 93, 53, 53, 53, 0, -1, -1, 0, 45, -2, -103, 4, +-49, 6, 51, 2, 54, 3, -39, 0, 0, 1, 23, 5, 48, 1, -112, 0, 0, 0, 40, 64, 18, 4, 3, 2, 0, +84, 78, 46, 41, 65, 4, 3, 2, 79, 64, 12, 19, 52, 79, -72, -1, -64, -77, 9, 10, 52, 79, 0, 47, 43, +43, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, 0, 45, -2, -103, 4, -49, 6, 51, 2, 54, 3, -39, 0, 0, +1, 23, 5, 48, 1, -112, 0, 0, 0, 40, 64, 18, 4, 3, 2, 0, 84, 78, 46, 41, 65, 4, 3, 2, 79, +64, 12, 19, 52, 79, -72, -1, -64, -77, 9, 10, 52, 79, 0, 47, 43, 43, 53, 53, 53, 1, 43, 53, 53, 53, +-1, -1, -1, -70, -2, -103, 3, 39, 5, -33, 2, 54, 3, 47, 0, 0, 1, 23, 5, 48, 0, -116, 0, 0, 0, +40, 64, 18, 3, 2, 1, 0, 40, 30, 1, 0, 65, 3, 2, 1, 35, 64, 12, 19, 52, 35, -72, -1, -64, -77, +9, 10, 52, 35, 0, 47, 43, 43, 53, 53, 53, 1, 43, 53, 53, 53, -1, -1, -1, -70, -2, -103, 3, 39, 5, +-33, 2, 54, 3, 47, 0, 0, 1, 23, 5, 48, 0, -116, 0, 0, 0, 40, 64, 18, 3, 2, 1, 0, 40, 30, +1, 0, 65, 3, 2, 1, 35, 64, 12, 19, 52, 35, -72, -1, -64, -77, 9, 10, 52, 35, 0, 47, 43, 43, 53, +53, 53, 1, 43, 53, 53, 53, -1, -1, 0, 20, 1, 37, 6, 127, 6, -16, 2, 54, 3, 49, 0, 0, 1, 23, +2, -8, 4, -50, -1, 60, 0, 60, 64, 37, 3, 2, -81, 56, -65, 56, -49, 56, 3, 56, 64, 12, 15, 52, 0, +56, 56, 13, 13, 65, 3, 2, 47, 59, 63, 59, -81, 59, 3, 16, 59, 32, 59, -64, 59, 3, 59, -72, -1, -64, +-77, 9, 10, 52, 59, 0, 47, 43, 93, 113, 53, 53, 1, 43, 43, 93, 53, 53, -1, -1, 0, 20, 1, 37, 7, +118, 6, -16, 2, 54, 3, 50, 0, 0, 1, 23, 2, -8, 4, -50, -1, 60, 0, 60, 64, 37, 3, 2, 32, 81, +-81, 81, -65, 81, -49, 81, 4, 81, 64, 12, 14, 52, 0, 81, 81, 35, 35, 65, 3, 2, 47, 84, 63, 84, -81, +84, 3, 96, 84, -64, 84, 2, 84, -72, -1, -64, -77, 9, 11, 52, 84, 0, 47, 43, 93, 113, 53, 53, 1, 43, +43, 93, 53, 53, -1, -1, -1, -70, 1, 37, 3, 39, 7, 2, 2, 54, 3, 51, 0, 0, 1, 23, 2, -8, 1, +124, -1, 60, 0, 56, 64, 33, 3, 2, -65, 41, -49, 41, 2, 41, 64, 12, 15, 52, 0, 41, 41, 15, 15, 65, +3, 2, 47, 44, 63, 44, -81, 44, 3, 96, 44, -64, 44, 2, 44, -72, -1, -64, -77, 9, 11, 52, 44, 0, 47, +43, 93, 113, 53, 53, 1, 43, 43, 93, 53, 53, -1, -1, -1, -70, 1, 37, 4, 30, 7, 2, 2, 54, 3, 52, +0, 0, 1, 23, 2, -8, 1, 124, -1, 60, 0, 58, 64, 35, 3, 2, -81, 66, -65, 66, -49, 66, 3, 66, 64, +12, 14, 52, 0, 66, 66, 40, 40, 65, 3, 2, 47, 69, 63, 69, -81, 69, 3, 96, 69, -64, 69, 2, 69, -72, +-1, -64, -77, 9, 11, 52, 69, 0, 47, 43, 93, 113, 53, 53, 1, 43, 43, 93, 53, 53, -1, -1, 0, 20, 1, +37, 6, 127, 7, 33, 2, 54, 3, 49, 0, 0, 1, 23, 6, 109, 3, 112, 6, -67, 0, 110, 64, 9, 3, 2, +16, 62, 1, -96, 62, 1, 62, -72, -1, -64, -77, 49, 92, 52, 62, -72, -1, -64, -77, 18, 21, 52, 62, -72, -1, +-64, 64, 19, 9, 16, 52, 0, 62, 62, 7, 7, 65, 7, 49, -25, 54, -9, 54, 3, 3, 2, 61, -72, -1, -64, +64, 25, 60, -1, 52, -96, 61, -80, 61, -64, 61, 3, 95, 61, 111, 61, 2, 0, 61, 80, 61, 96, 61, 3, 61, +1, 46, -72, -1, -64, -77, 60, -1, 52, 46, 0, 47, 43, 53, 47, 93, 113, 114, 43, 53, 53, 93, 1, 43, 43, +43, 43, 113, 114, 53, 53, -1, -1, 0, 20, 1, 37, 7, 118, 7, 33, 2, 54, 3, 50, 0, 0, 1, 23, 6, +109, 3, 112, 6, -67, 0, 103, -78, 3, 2, 87, -72, -1, -64, 64, 36, 49, 92, 52, 16, 87, -64, 87, 2, 79, +87, 1, 32, 87, 64, 87, -81, 87, -32, 87, 4, 0, 87, 81, 29, 29, 65, 7, 74, -25, 79, -9, 79, 3, 3, +2, 86, -72, -1, -64, 64, 25, 60, -1, 52, -96, 86, -80, 86, -64, 86, 3, 95, 86, 111, 86, 2, 0, 86, 80, +86, 96, 86, 3, 86, 1, 71, -72, -1, -64, -77, 60, -1, 52, 71, 0, 47, 43, 53, 47, 93, 113, 114, 43, 53, +53, 93, 1, 43, 93, 113, 114, 43, 53, 53, 0, -1, -1, -1, -70, 1, 37, 3, 39, 7, 33, 2, 54, 3, 51, +0, 0, 1, 23, 6, 109, 0, 0, 6, -67, 0, -122, -78, 3, 2, 47, -72, -1, -128, 64, 21, 60, -1, 52, 16, +47, 1, -96, 47, 1, 0, 47, 80, 47, 96, 47, -80, 47, -64, 47, 5, 47, -72, -1, -64, -77, 27, 29, 52, 47, +-72, -1, -64, 64, 26, 37, 39, 52, 0, 47, 47, 10, 10, 65, -26, 38, -25, 39, -10, 38, -9, 39, 4, 3, 63, +46, 79, 46, 2, 2, 46, -72, -1, -64, 64, 25, 60, -1, 52, -96, 46, -80, 46, -64, 46, 3, 95, 46, 111, 46, +2, 0, 46, 80, 46, 96, 46, 3, 46, 1, 31, -72, -1, -64, -74, 42, -1, 52, 116, 31, 1, 31, 0, 47, 93, +43, 53, 47, 93, 113, 114, 43, 53, 93, 53, 93, 1, 43, 43, 43, 93, 113, 114, 43, 53, 53, -1, -1, -1, -70, +1, 37, 4, 30, 7, 33, 2, 54, 3, 52, 0, 0, 1, 23, 6, 109, 0, 0, 6, -67, 0, -120, -78, 3, 2, +72, -72, -1, -128, -77, 60, -1, 52, 72, -72, -1, -64, 64, 19, 27, 30, 52, 16, 72, 1, -96, 72, 1, 0, 72, +80, 72, -80, 72, -64, 72, 4, 72, -72, -1, -64, 64, 30, 37, 39, 52, 0, 72, 72, 34, 34, 65, 123, 55, 122, +56, -26, 63, -25, 64, -10, 63, -9, 64, 6, 3, 63, 71, 79, 71, 2, 2, 71, -72, -1, -64, 64, 25, 60, -1, +52, -96, 71, -80, 71, -64, 71, 3, 95, 71, 111, 71, 2, 0, 71, 80, 71, 96, 71, 3, 71, 1, 56, -72, -1, +-64, -74, 42, -1, 52, 116, 56, 1, 56, 0, 47, 93, 43, 53, 47, 93, 113, 114, 43, 53, 93, 53, 93, 1, 43, +43, 93, 113, 114, 43, 43, 53, 53, -1, -1, 0, 20, -1, 76, 6, 127, 6, -16, 2, 54, 3, 49, 0, 0, 1, +23, 5, 46, 2, -108, 0, 0, 0, 36, 64, 16, 3, 2, 0, 62, 56, 32, 27, 65, 3, 2, 61, 64, 12, 21, +52, 61, -72, -1, -64, -77, 9, 10, 52, 61, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, 0, 20, -1, +76, 7, 118, 6, -16, 2, 54, 3, 50, 0, 0, 1, 23, 5, 46, 1, -92, 0, 0, 0, 36, 64, 16, 3, 2, +0, 87, 81, 4, 65, 65, 3, 2, 86, 64, 12, 21, 52, 86, -72, -1, -64, -77, 9, 10, 52, 86, 0, 47, 43, +43, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, -1, 76, 3, 39, 7, 2, 2, 54, 3, 51, 0, 0, 1, 23, +5, 46, 0, -96, 0, 0, 0, 36, 64, 16, 3, 2, 0, 47, 41, 1, 0, 65, 3, 2, 46, 64, 12, 21, 52, +46, -72, -1, -64, -77, 9, 10, 52, 46, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, -1, 76, +4, 30, 7, 2, 2, 54, 3, 52, 0, 0, 1, 22, 5, 46, 20, 0, 0, 36, 64, 16, 3, 2, 0, 72, 66, +21, 15, 65, 3, 2, 71, 64, 12, 21, 52, 71, -72, -1, -64, -77, 9, 10, 52, 71, 0, 47, 43, 43, 53, 53, +1, 43, 53, 53, -1, -1, 0, 20, -2, -84, 6, 127, 6, -16, 2, 54, 3, 49, 0, 0, 1, 23, 5, 49, 2, +-108, 0, 0, 0, 36, 64, 16, 3, 2, 0, 62, 56, 32, 27, 65, 3, 2, 61, 64, 12, 21, 52, 61, -72, -1, +-64, -77, 9, 10, 52, 61, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, 0, 20, -2, -84, 7, 118, 6, +-16, 2, 54, 3, 50, 0, 0, 1, 23, 5, 49, 1, -52, 0, 0, 0, 36, 64, 16, 3, 2, 0, 87, 81, 4, +65, 65, 3, 2, 86, 64, 12, 21, 52, 86, -72, -1, -64, -77, 9, 10, 52, 86, 0, 47, 43, 43, 53, 53, 1, +43, 53, 53, -1, -1, -1, -70, -2, -84, 3, 39, 7, 2, 2, 54, 3, 51, 0, 0, 1, 23, 5, 49, 0, -96, +0, 0, 0, 36, 64, 16, 3, 2, 0, 47, 41, 1, 0, 65, 3, 2, 46, 64, 12, 21, 52, 46, -72, -1, -64, +-77, 9, 10, 52, 46, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, -2, -84, 4, 30, 7, 2, +2, 54, 3, 52, 0, 0, 1, 22, 5, 49, 0, 0, 0, 36, 64, 16, 3, 2, 0, 72, 66, 21, 15, 65, 3, +2, 71, 64, 12, 21, 52, 71, -72, -1, -64, -77, 9, 10, 52, 71, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, +-1, -1, 0, 20, 1, 37, 6, 127, 7, 33, 2, 54, 3, 49, 0, 0, 1, 23, 6, 110, 3, 72, 7, 73, 0, +-55, -77, 4, 3, 2, 66, -72, -1, -128, -77, 55, -1, 52, 66, -72, -1, -64, -77, 50, 54, 52, 66, -72, -1, -64, +-77, 38, 43, 52, 66, -72, -1, -64, -77, 33, 36, 52, 66, -72, -1, -64, -77, 18, 20, 52, 66, -72, -1, -64, 64, +16, 13, 15, 52, 0, 66, 1, 0, 66, 1, 0, 66, 66, 7, 7, 65, 54, -72, -1, -24, 64, 22, 18, 28, 52, +7, 49, 119, 52, 2, 4, 3, 2, -33, 65, 1, 95, 65, 111, 65, -32, 65, 3, 65, -72, -1, -64, 64, 9, 14, +16, 52, 65, 64, 18, 22, 52, 65, -72, -1, -64, -77, 24, 28, 52, 65, -72, -1, -64, -77, 60, 61, 52, 65, -72, +-1, -64, 64, 10, 70, -1, 52, 65, 64, 73, 53, 65, 1, 46, -72, -1, -128, -77, 100, -1, 52, 46, -72, -1, -64, +-77, 49, 99, 52, 46, -72, -1, -32, -73, 30, 48, 52, 118, 46, 1, 0, 46, 0, 47, 53, 93, 43, 43, 43, 53, +47, 43, 43, 43, 43, 43, 43, 113, 114, 53, 53, 53, 93, 43, 1, 43, 93, 113, 43, 43, 43, 43, 43, 43, 53, +53, 53, 0, -1, -1, 0, 20, 1, 37, 7, 118, 7, 33, 2, 54, 3, 50, 0, 0, 1, 23, 6, 110, 3, 72, +7, 73, 0, -46, -77, 4, 3, 2, 91, -72, -1, -128, -77, 55, -1, 52, 91, -72, -1, -64, -78, 61, 53, 91, -72, +-1, -64, -77, 50, 54, 52, 91, -72, -1, -64, -77, 38, 45, 52, 91, -72, -1, -64, -77, 33, 36, 52, 91, -72, -1, +-64, 64, 22, 18, 20, 52, 0, 91, 96, 91, 2, 0, 91, 64, 91, 80, 91, 3, 0, 91, 91, 29, 29, 65, 79, +-72, -1, -24, 64, 29, 18, 28, 52, 8, 73, 1, 7, 74, 100, 77, 116, 77, -73, 79, 4, 4, 3, 2, -33, 90, +1, 95, 90, 111, 90, -32, 90, 3, 90, -72, -1, -64, 64, 9, 14, 16, 52, 90, 64, 18, 22, 52, 90, -72, -1, +-64, -77, 24, 28, 52, 90, -72, -1, -64, -77, 60, 61, 52, 90, -72, -1, -64, 64, 10, 70, -1, 52, 90, 64, 73, +53, 90, 1, 71, -72, -1, -128, -77, 100, -1, 52, 71, -72, -1, -64, -77, 49, 99, 52, 71, -72, -1, -32, -76, 30, +48, 52, 0, 71, 0, 47, 53, 43, 43, 43, 53, 47, 43, 43, 43, 43, 43, 43, 113, 114, 53, 53, 53, 93, 113, +43, 1, 43, 93, 113, 43, 43, 43, 43, 43, 43, 53, 53, 53, -1, -1, -1, -70, 1, 37, 3, 39, 7, 33, 2, +54, 3, 51, 0, 0, 1, 23, 6, 110, -1, -15, 7, 73, 0, -5, -77, 4, 3, 2, 51, -72, -1, -128, -77, 58, +-1, 52, 51, -72, -1, -64, -77, 61, 62, 52, 51, -72, -1, -64, -77, 39, 57, 52, 51, -72, -1, -64, -77, 33, 36, +52, 51, -72, -1, -64, 64, 17, 18, 20, 52, 0, 51, 80, 51, 96, 51, 3, 0, 51, 51, 10, 10, 65, 40, -72, +-1, -48, -77, 55, -1, 52, 39, -72, -1, -48, -77, 55, -1, 52, 38, -72, -1, -48, -77, 55, -1, 52, 39, -72, -1, +-8, -77, 29, 39, 52, 39, -72, -1, -32, 64, 38, 18, 28, 52, 20, 39, 36, 39, 2, 25, 34, 1, 6, 34, 115, +35, 115, 36, 115, 37, -26, 38, -10, 38, 6, 4, 3, 2, -33, 50, 1, 95, 50, 111, 50, -32, 50, 3, 50, -72, +-1, -64, 64, 9, 14, 16, 52, 50, 64, 18, 22, 52, 50, -72, -1, -64, -77, 24, 28, 52, 50, -72, -1, -64, -77, +60, 61, 52, 50, -72, -1, -64, 64, 10, 70, -1, 52, 50, 64, 73, 53, 50, 1, 31, -72, -1, -128, -77, 100, -1, +52, 31, -72, -1, -64, -77, 42, 99, 52, 31, -72, -1, -32, -77, 29, 41, 52, 31, -72, -1, -40, -76, 25, 28, 52, +0, 31, 0, 47, 53, 43, 43, 43, 43, 53, 47, 43, 43, 43, 43, 43, 43, 113, 114, 53, 53, 53, 93, 113, 114, +43, 43, 43, 43, 43, 1, 43, 93, 43, 43, 43, 43, 43, 53, 53, 53, 0, -1, -1, -1, -70, 1, 37, 4, 30, +7, 33, 2, 54, 3, 52, 0, 0, 1, 23, 6, 110, -1, -15, 7, 73, 1, 1, 64, 20, 4, 3, 2, 80, 76, +1, 0, 76, 64, 76, 80, 76, -112, 76, -96, 76, -80, 76, 6, 76, -72, -1, -128, -77, 59, -1, 52, 76, -72, -1, +-64, -77, 61, 62, 52, 76, -72, -1, -64, -77, 39, 58, 52, 76, -72, -1, -64, 64, 10, 33, 36, 52, 0, 76, 76, +34, 34, 65, 65, -72, -1, -48, -77, 55, -1, 52, 64, -72, -1, -48, -77, 55, -1, 52, 63, -72, -1, -48, -77, 55, +-1, 52, 64, -72, -1, -8, -77, 29, 39, 52, 64, -72, -1, -32, 64, 43, 18, 28, 52, 20, 64, 36, 64, 2, 6, +59, 100, 60, 100, 61, 100, 62, 116, 60, 116, 61, 116, 62, -74, 64, -26, 63, -10, 63, 10, 4, 3, 2, -33, 75, +1, 95, 75, 111, 75, -32, 75, 3, 75, -72, -1, -64, 64, 9, 14, 16, 52, 75, 64, 18, 22, 52, 75, -72, -1, +-64, -77, 24, 28, 52, 75, -72, -1, -64, -77, 60, 61, 52, 75, -72, -1, -64, 64, 10, 70, -1, 52, 75, 64, 73, +53, 75, 1, 56, -72, -1, -128, -77, 100, -1, 52, 56, -72, -1, -64, -77, 42, 99, 52, 56, -72, -1, -32, -77, 29, +41, 52, 56, -72, -1, -40, -76, 25, 28, 52, 0, 56, 0, 47, 53, 43, 43, 43, 43, 53, 47, 43, 43, 43, 43, +43, 43, 113, 114, 53, 53, 53, 93, 114, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, 93, 113, 53, 53, 53, +0, -1, -1, 0, 71, 0, 14, 4, 13, 7, 32, 2, 54, 3, -35, 0, 0, 1, 23, 5, 54, 1, -12, 1, 99, +0, -81, 64, 11, 1, 0, 57, 16, 57, -96, 57, -80, 57, 4, 57, -72, -1, -128, 64, 10, 11, 16, 52, 0, 57, +57, 39, 39, 65, 40, -72, -1, -64, -77, 37, -1, 52, 39, -72, -1, -128, -77, 37, -1, 52, 38, -72, -1, -128, -77, +37, -1, 52, 42, -72, -1, -16, -77, 9, -1, 52, 41, -72, -1, -16, -77, 9, -1, 52, 40, -72, -1, -48, -77, 9, +36, 52, 39, -72, -1, -80, -77, 9, 36, 52, 38, -72, -1, -80, 64, 10, 9, 36, 52, 1, 58, 64, 83, 99, 52, +58, -72, -1, -64, 64, 39, 32, 34, 52, 0, 58, 48, 58, -128, 58, -96, 58, 4, 15, 58, 47, 58, 95, 58, 111, +58, 4, 0, 58, 16, 58, 32, 58, 96, 58, 112, 58, -65, 58, -64, 58, 7, 58, 0, 6, -72, -1, -64, -77, 28, +-1, 52, 6, 0, 47, 43, 53, 47, 93, 113, 114, 43, 43, 53, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, +93, 53, 0, -1, -1, 0, 71, 0, 14, 4, 13, 7, 32, 2, 54, 3, -35, 0, 0, 1, 23, 5, 54, 1, -12, +1, 99, 0, -81, 64, 11, 1, 0, 57, 16, 57, -96, 57, -80, 57, 4, 57, -72, -1, -128, 64, 10, 11, 16, 52, +0, 57, 57, 39, 39, 65, 40, -72, -1, -64, -77, 37, -1, 52, 39, -72, -1, -128, -77, 37, -1, 52, 38, -72, -1, +-128, -77, 37, -1, 52, 42, -72, -1, -16, -77, 9, -1, 52, 41, -72, -1, -16, -77, 9, -1, 52, 40, -72, -1, -48, +-77, 9, 36, 52, 39, -72, -1, -80, -77, 9, 36, 52, 38, -72, -1, -80, 64, 10, 9, 36, 52, 1, 58, 64, 83, +99, 52, 58, -72, -1, -64, 64, 39, 32, 34, 52, 0, 58, 48, 58, -128, 58, -96, 58, 4, 15, 58, 47, 58, 95, +58, 111, 58, 4, 0, 58, 16, 58, 32, 58, 96, 58, 112, 58, -65, 58, -64, 58, 7, 58, 0, 6, -72, -1, -64, +-77, 28, -1, 52, 6, 0, 47, 43, 53, 47, 93, 113, 114, 43, 43, 53, 43, 43, 43, 43, 43, 43, 43, 43, 1, +43, 43, 93, 53, 0, -1, -1, -1, -70, 1, 37, 1, -88, 7, 32, 2, 54, 3, -33, 0, 0, 1, 23, 5, 54, +-1, -100, 1, 99, 0, -32, -74, 1, 0, 23, 16, 23, 2, 23, -72, -1, -64, 64, 40, 13, 16, 52, 0, 23, 19, +4, 17, 65, 24, 64, 40, 66, 52, 21, 64, 40, 66, 52, 20, 64, 40, 66, 52, 24, -128, 67, -1, 52, 21, -128, +67, -1, 52, 20, -128, 67, -1, 52, 14, -72, -1, -64, -77, 9, -1, 52, 13, -72, -1, -64, -77, 9, -1, 52, 12, +-72, -1, -64, -77, 9, -1, 52, 11, -72, -1, -64, -77, 9, -1, 52, 10, -72, -1, -64, -77, 9, -1, 52, 9, -72, +-1, -128, -77, 23, -1, 52, 8, -72, -1, -128, -77, 23, -1, 52, 7, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, +-64, -77, 9, 22, 52, 8, -72, -1, -64, -76, 9, 22, 52, 1, 21, -72, -1, -64, -77, 67, 69, 52, 21, -72, -1, +-64, -77, 61, 62, 52, 21, -72, -1, -64, -78, 59, 53, 21, -72, -1, -64, 64, 31, 9, 11, 52, 0, 21, 48, 21, +-128, 21, -96, 21, 4, 16, 21, 112, 21, -128, 21, -112, 21, -49, 21, 5, 96, 21, 112, 21, -65, 21, 3, 21, 0, +47, 93, 113, 114, 43, 43, 43, 43, 53, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +1, 43, 43, 113, 53, -1, -1, -1, -70, 1, 37, 1, -88, 7, 32, 2, 54, 3, -33, 0, 0, 1, 23, 5, 54, +-1, -100, 1, 99, 0, -32, -74, 1, 0, 23, 16, 23, 2, 23, -72, -1, -64, 64, 40, 13, 16, 52, 0, 23, 19, +4, 17, 65, 24, 64, 40, 66, 52, 21, 64, 40, 66, 52, 20, 64, 40, 66, 52, 24, -128, 67, -1, 52, 21, -128, +67, -1, 52, 20, -128, 67, -1, 52, 14, -72, -1, -64, -77, 9, -1, 52, 13, -72, -1, -64, -77, 9, -1, 52, 12, +-72, -1, -64, -77, 9, -1, 52, 11, -72, -1, -64, -77, 9, -1, 52, 10, -72, -1, -64, -77, 9, -1, 52, 9, -72, +-1, -128, -77, 23, -1, 52, 8, -72, -1, -128, -77, 23, -1, 52, 7, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, +-64, -77, 9, 22, 52, 8, -72, -1, -64, -76, 9, 22, 52, 1, 21, -72, -1, -64, -77, 67, 69, 52, 21, -72, -1, +-64, -77, 61, 62, 52, 21, -72, -1, -64, -78, 59, 53, 21, -72, -1, -64, 64, 31, 9, 11, 52, 0, 21, 48, 21, +-128, 21, -96, 21, 4, 16, 21, 112, 21, -128, 21, -112, 21, -49, 21, 5, 96, 21, 112, 21, -65, 21, 3, 21, 0, +47, 93, 113, 114, 43, 43, 43, 43, 53, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +1, 43, 43, 113, 53, -1, -1, 0, 71, 0, 14, 4, 13, 7, 33, 2, 54, 3, -35, 0, 0, 1, 23, 5, 45, +2, 78, 6, -102, 0, -28, -73, 1, 0, 58, -81, 58, -48, 58, 3, -72, -1, -38, 64, 16, 58, 58, 36, 36, 65, +57, 64, 65, 100, 52, 56, 64, 65, 100, 52, 40, -72, -1, -64, -77, 37, -1, 52, 39, -72, -1, -128, -77, 37, -1, +52, 38, -72, -1, -128, -77, 37, -1, 52, 42, -72, -1, -16, -77, 9, -1, 52, 41, -72, -1, -16, -77, 9, -1, 52, +40, -72, -1, -48, -77, 9, 36, 52, 39, -72, -1, -80, -77, 9, 36, 52, 38, -72, -1, -80, 64, 37, 11, 36, 52, +0, 38, 16, 38, 2, 1, 16, 57, 112, 57, -96, 57, -80, 57, -64, 57, 5, 0, 57, 96, 57, 112, 57, 3, 111, +57, 127, 57, -32, 57, -16, 57, 4, 57, -72, -1, -64, -78, 88, 53, 57, -72, -1, -64, -78, 82, 53, 57, -72, -1, +-64, -77, 74, 75, 52, 57, -72, -1, -64, -77, 68, 71, 52, 57, -72, -1, -64, -78, 65, 53, 57, -72, -1, -64, -78, +60, 53, 57, -72, -1, -64, 64, 11, 91, -1, 52, 57, 64, 11, 13, 52, 57, 0, 6, -72, -1, -64, -77, 28, -1, +52, 6, 0, 47, 43, 53, 47, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 53, 93, 43, 43, 43, 43, 43, +43, 43, 43, 43, 43, 1, 43, 93, 53, -1, -1, 0, 71, 0, 14, 4, 13, 7, 33, 2, 54, 3, -35, 0, 0, +1, 23, 5, 45, 2, 78, 6, -102, 0, -28, -73, 1, 0, 58, -81, 58, -48, 58, 3, -72, -1, -38, 64, 16, 58, +58, 36, 36, 65, 57, 64, 65, 100, 52, 56, 64, 65, 100, 52, 40, -72, -1, -64, -77, 37, -1, 52, 39, -72, -1, +-128, -77, 37, -1, 52, 38, -72, -1, -128, -77, 37, -1, 52, 42, -72, -1, -16, -77, 9, -1, 52, 41, -72, -1, -16, +-77, 9, -1, 52, 40, -72, -1, -48, -77, 9, 36, 52, 39, -72, -1, -80, -77, 9, 36, 52, 38, -72, -1, -80, 64, +37, 11, 36, 52, 0, 38, 16, 38, 2, 1, 16, 57, 112, 57, -96, 57, -80, 57, -64, 57, 5, 0, 57, 96, 57, +112, 57, 3, 111, 57, 127, 57, -32, 57, -16, 57, 4, 57, -72, -1, -64, -78, 88, 53, 57, -72, -1, -64, -78, 82, +53, 57, -72, -1, -64, -77, 74, 75, 52, 57, -72, -1, -64, -77, 68, 71, 52, 57, -72, -1, -64, -78, 65, 53, 57, +-72, -1, -64, -78, 60, 53, 57, -72, -1, -64, 64, 11, 91, -1, 52, 57, 64, 11, 13, 52, 57, 0, 6, -72, -1, +-64, -77, 28, -1, 52, 6, 0, 47, 43, 53, 47, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 53, 93, 43, +43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 93, 53, -1, -1, -1, -70, 1, 37, 1, -88, 7, 33, 2, 54, +3, -33, 0, 0, 1, 23, 5, 45, -1, -53, 6, -102, 1, 3, -73, 1, 0, 19, 1, 80, 19, 1, 19, -72, -1, +-64, -77, 44, 46, 52, 19, -72, -1, -64, -78, 14, 16, 52, -72, -1, -32, 64, 21, 19, 19, 13, 13, 65, 20, -128, +82, 99, 52, 20, 64, 39, 81, 52, 19, 64, 39, 99, 52, 14, -72, -1, -64, -77, 9, -1, 52, 13, -72, -1, -64, +-77, 9, -1, 52, 12, -72, -1, -64, -77, 9, -1, 52, 11, -72, -1, -64, -77, 9, -1, 52, 10, -72, -1, -64, -77, +9, -1, 52, 9, -72, -1, -128, -77, 23, -1, 52, 8, -72, -1, -128, -77, 23, -1, 52, 7, -72, -1, -64, -77, 9, +-1, 52, 9, -72, -1, -64, -77, 9, 22, 52, 8, -72, -1, -64, 64, 39, 9, 22, 52, 4, 6, 4, 8, 4, 9, +3, 1, 16, 20, 112, 20, -96, 20, -80, 20, -64, 20, 5, 0, 20, 96, 20, 112, 20, 3, 111, 20, 127, 20, -32, +20, -16, 20, 4, 20, -72, -1, -64, -78, 88, 53, 20, -72, -1, -64, -78, 82, 53, 20, -72, -1, -64, -77, 74, 75, +52, 20, -72, -1, -64, -77, 68, 71, 52, 20, -72, -1, -64, -78, 65, 53, 20, -72, -1, -64, -78, 60, 53, 20, -72, +-1, -64, 64, 9, 91, -1, 52, 20, 64, 11, 13, 52, 20, 0, 47, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, +114, 53, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 113, 114, 53, 0, -1, +-1, -1, -70, 1, 37, 1, -88, 7, 33, 2, 54, 3, -33, 0, 0, 1, 23, 5, 45, -1, -53, 6, -102, 1, 3, +-73, 1, 0, 19, 1, 80, 19, 1, 19, -72, -1, -64, -77, 44, 46, 52, 19, -72, -1, -64, -78, 14, 16, 52, -72, +-1, -32, 64, 21, 19, 19, 13, 13, 65, 20, -128, 82, 99, 52, 20, 64, 39, 81, 52, 19, 64, 39, 99, 52, 14, +-72, -1, -64, -77, 9, -1, 52, 13, -72, -1, -64, -77, 9, -1, 52, 12, -72, -1, -64, -77, 9, -1, 52, 11, -72, +-1, -64, -77, 9, -1, 52, 10, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, -128, -77, 23, -1, 52, 8, -72, -1, +-128, -77, 23, -1, 52, 7, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, -64, -77, 9, 22, 52, 8, -72, -1, -64, +64, 39, 9, 22, 52, 4, 6, 4, 8, 4, 9, 3, 1, 16, 20, 112, 20, -96, 20, -80, 20, -64, 20, 5, 0, +20, 96, 20, 112, 20, 3, 111, 20, 127, 20, -32, 20, -16, 20, 4, 20, -72, -1, -64, -78, 88, 53, 20, -72, -1, +-64, -78, 82, 53, 20, -72, -1, -64, -77, 74, 75, 52, 20, -72, -1, -64, -77, 68, 71, 52, 20, -72, -1, -64, -78, +65, 53, 20, -72, -1, -64, -78, 60, 53, 20, -72, -1, -64, 64, 9, 91, -1, 52, 20, 64, 11, 13, 52, 20, 0, +47, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 53, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, +43, 43, 1, 43, 43, 43, 113, 114, 53, 0, -1, -1, 0, 71, 0, 14, 4, 13, 7, 33, 2, 54, 3, -35, 0, +0, 1, 23, 6, 110, 2, 48, 7, 73, 1, 11, -77, 3, 2, 1, 62, -72, -1, -64, -78, 70, 53, 62, -72, -1, +-64, -77, 46, 48, 52, 62, -72, -1, -64, -77, 39, 44, 52, 62, -72, -1, -64, -77, 21, 23, 52, 62, -72, -1, -64, +-78, 10, 18, 52, -72, -1, -22, -75, 62, 62, 39, 39, 65, 41, -72, -1, -8, -77, 24, 27, 52, 40, -72, -1, -8, +-77, 24, 27, 52, 39, -72, -1, -8, -77, 24, 27, 52, 38, -72, -1, -8, -77, 24, 27, 52, 40, -72, -1, -64, -77, +37, -1, 52, 39, -72, -1, -128, -77, 37, -1, 52, 38, -72, -1, -128, -77, 37, -1, 52, 42, -72, -1, -16, -77, 9, +-1, 52, 41, -72, -1, -16, -77, 9, -1, 52, 40, -72, -1, -48, -77, 9, 36, 52, 39, -72, -1, -80, -77, 9, 36, +52, 38, -72, -1, -80, 64, 25, 11, 36, 52, 0, 38, 1, 3, 2, -1, 65, 1, 1, -32, 65, 1, 80, 65, 96, +65, 112, 65, -16, 65, 4, 65, -72, -1, -64, -77, 101, -1, 52, 65, -72, -1, -64, -77, 88, 89, 52, 65, -72, -1, +-64, -77, 70, 72, 52, 65, -72, -1, -64, -77, 60, 61, 52, 65, -72, -1, -64, 64, 11, 25, 28, 52, 65, 64, 18, +22, 52, 65, 0, 6, -72, -1, -64, -77, 28, -1, 52, 6, 0, 47, 43, 53, 47, 43, 43, 43, 43, 43, 43, 93, +113, 53, 93, 53, 53, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, 43, +53, 53, 53, 0, -1, -1, 0, 71, 0, 14, 4, 13, 7, 33, 2, 54, 3, -35, 0, 0, 1, 23, 6, 110, 2, +48, 7, 73, 1, 11, -77, 3, 2, 1, 62, -72, -1, -64, -78, 70, 53, 62, -72, -1, -64, -77, 46, 48, 52, 62, +-72, -1, -64, -77, 39, 44, 52, 62, -72, -1, -64, -77, 21, 23, 52, 62, -72, -1, -64, -78, 10, 18, 52, -72, -1, +-22, -75, 62, 62, 39, 39, 65, 41, -72, -1, -8, -77, 24, 27, 52, 40, -72, -1, -8, -77, 24, 27, 52, 39, -72, +-1, -8, -77, 24, 27, 52, 38, -72, -1, -8, -77, 24, 27, 52, 40, -72, -1, -64, -77, 37, -1, 52, 39, -72, -1, +-128, -77, 37, -1, 52, 38, -72, -1, -128, -77, 37, -1, 52, 42, -72, -1, -16, -77, 9, -1, 52, 41, -72, -1, -16, +-77, 9, -1, 52, 40, -72, -1, -48, -77, 9, 36, 52, 39, -72, -1, -80, -77, 9, 36, 52, 38, -72, -1, -80, 64, +25, 11, 36, 52, 0, 38, 1, 3, 2, -1, 65, 1, 1, -32, 65, 1, 80, 65, 96, 65, 112, 65, -16, 65, 4, +65, -72, -1, -64, -77, 101, -1, 52, 65, -72, -1, -64, -77, 88, 89, 52, 65, -72, -1, -64, -77, 70, 72, 52, 65, +-72, -1, -64, -77, 60, 61, 52, 65, -72, -1, -64, 64, 11, 25, 28, 52, 65, 64, 18, 22, 52, 65, 0, 6, -72, +-1, -64, -77, 28, -1, 52, 6, 0, 47, 43, 53, 47, 43, 43, 43, 43, 43, 43, 93, 113, 53, 93, 53, 53, 93, +43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, 43, 43, 43, 53, 53, 53, 0, -1, -1, +-1, -70, 1, 37, 1, -88, 7, 33, 2, 54, 3, -33, 0, 0, 1, 23, 6, 110, -1, -60, 7, 73, 0, -24, 64, +10, 3, 2, 1, 32, 27, 1, -64, 27, 1, 27, -72, -1, -64, -77, 54, 59, 52, 27, -72, -1, -64, -77, 23, 29, +52, 27, -72, -1, -64, -78, 13, 17, 52, -72, -1, -14, -75, 27, 27, 8, 8, 65, 14, -72, -1, -64, -77, 9, -1, +52, 13, -72, -1, -64, -77, 9, -1, 52, 12, -72, -1, -64, -77, 9, -1, 52, 11, -72, -1, -64, -77, 9, -1, 52, +10, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, -128, -77, 23, -1, 52, 8, -72, -1, -128, -77, 23, -1, 52, 7, +-72, -1, -64, -77, 9, -1, 52, 9, -72, -1, -64, -77, 9, 22, 52, 8, -72, -1, -64, 64, 30, 9, 22, 52, 4, +6, 4, 8, 4, 9, 3, 3, 2, 1, 95, 28, 111, 28, -32, 28, 3, 80, 28, 96, 28, 112, 28, -16, 28, 4, +28, -72, -1, -64, -77, 101, -1, 52, 28, -72, -1, -64, -77, 88, 89, 52, 28, -72, -1, -64, -77, 70, 72, 52, 28, +-72, -1, -64, -77, 60, 61, 52, 28, -72, -1, -64, 64, 9, 25, 28, 52, 28, 64, 18, 22, 52, 28, 0, 47, 43, +43, 43, 43, 43, 43, 93, 113, 53, 53, 53, 93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43, 43, +43, 113, 114, 53, 53, 53, -1, -1, -1, -70, 1, 37, 1, -88, 7, 33, 2, 54, 3, -33, 0, 0, 1, 23, 6, +110, -1, -60, 7, 73, 0, -24, 64, 10, 3, 2, 1, 32, 27, 1, -64, 27, 1, 27, -72, -1, -64, -77, 54, 59, +52, 27, -72, -1, -64, -77, 23, 29, 52, 27, -72, -1, -64, -78, 13, 17, 52, -72, -1, -14, -75, 27, 27, 8, 8, +65, 14, -72, -1, -64, -77, 9, -1, 52, 13, -72, -1, -64, -77, 9, -1, 52, 12, -72, -1, -64, -77, 9, -1, 52, +11, -72, -1, -64, -77, 9, -1, 52, 10, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, -128, -77, 23, -1, 52, 8, +-72, -1, -128, -77, 23, -1, 52, 7, -72, -1, -64, -77, 9, -1, 52, 9, -72, -1, -64, -77, 9, 22, 52, 8, -72, +-1, -64, 64, 30, 9, 22, 52, 4, 6, 4, 8, 4, 9, 3, 3, 2, 1, 95, 28, 111, 28, -32, 28, 3, 80, +28, 96, 28, 112, 28, -16, 28, 4, 28, -72, -1, -64, -77, 101, -1, 52, 28, -72, -1, -64, -77, 88, 89, 52, 28, +-72, -1, -64, -77, 70, 72, 52, 28, -72, -1, -64, -77, 60, 61, 52, 28, -72, -1, -64, 64, 9, 25, 28, 52, 28, +64, 18, 22, 52, 28, 0, 47, 43, 43, 43, 43, 43, 43, 93, 113, 53, 53, 53, 93, 43, 43, 43, 43, 43, 43, +43, 43, 43, 43, 1, 43, 43, 43, 43, 113, 114, 53, 53, 53, -1, -1, 0, 71, -2, 93, 4, 13, 6, 51, 2, +54, 3, -35, 0, 0, 1, 23, 6, 111, 1, 44, -1, 116, 0, 120, -73, 3, 2, 1, 0, 62, 16, 62, 2, -72, +-1, -42, 64, 38, 62, 62, 10, 0, 65, 3, 2, 61, 64, 71, 53, 61, 64, 60, 65, 52, 61, 64, 49, 54, 52, +1, -65, 61, -49, 61, -33, 61, 3, -48, 61, 1, 61, 64, 82, 82, 52, 61, -72, -1, -64, -78, 71, 53, 61, -72, +-1, -64, -77, 60, 65, 52, 61, -72, -1, -64, -77, 50, 54, 52, 61, -72, -1, -64, -77, 41, 44, 52, 61, -72, -1, +-64, 64, 9, 31, 36, 52, 61, 64, 9, 11, 52, 61, 0, 47, 43, 43, 43, 43, 43, 43, 43, 93, 114, 53, 43, +43, 43, 53, 53, 1, 43, 93, 53, 53, 53, -1, -1, 0, 71, -2, 93, 4, 13, 6, 51, 2, 54, 3, -35, 0, +0, 1, 23, 6, 111, 1, 44, -1, 116, 0, 120, -73, 3, 2, 1, 0, 62, 16, 62, 2, -72, -1, -42, 64, 38, +62, 62, 10, 0, 65, 3, 2, 61, 64, 71, 53, 61, 64, 60, 65, 52, 61, 64, 49, 54, 52, 1, -65, 61, -49, +61, -33, 61, 3, -48, 61, 1, 61, 64, 82, 82, 52, 61, -72, -1, -64, -78, 71, 53, 61, -72, -1, -64, -77, 60, +65, 52, 61, -72, -1, -64, -77, 50, 54, 52, 61, -72, -1, -64, -77, 41, 44, 52, 61, -72, -1, -64, 64, 9, 31, +36, 52, 61, 64, 9, 11, 52, 61, 0, 47, 43, 43, 43, 43, 43, 43, 43, 93, 114, 53, 43, 43, 43, 53, 53, +1, 43, 93, 53, 53, 53, -1, -1, -1, -70, -2, -103, 1, -68, 6, 51, 2, 54, 3, -33, 0, 0, 1, 22, 5, +48, -40, 0, 0, 37, 64, 23, 3, 2, 1, 33, 29, 19, 1, 0, 65, 3, 2, 1, 0, 24, 16, 24, 2, 24, +64, 12, 21, 52, 24, 0, 47, 43, 93, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, -1, -70, -2, -103, 1, +-68, 6, 51, 2, 54, 3, -33, 0, 0, 1, 22, 5, 48, -40, 0, 0, 37, 64, 23, 3, 2, 1, 33, 29, 19, +1, 0, 65, 3, 2, 1, 0, 24, 16, 24, 2, 24, 64, 12, 21, 52, 24, 0, 47, 43, 93, 53, 53, 53, 1, +43, 53, 53, 53, 0, -1, -1, 0, 69, -2, 82, 4, 53, 4, 118, 2, 54, 3, -27, 0, 0, 1, 23, 5, 45, +1, 60, -2, -79, 0, 63, 64, 19, 2, 0, 39, 37, 12, 4, 65, 2, 38, 64, 77, 78, 52, 38, 64, 59, 59, +52, 38, -72, -1, -64, 64, 25, 50, 52, 52, -33, 38, 1, -97, 38, -81, 38, -1, 38, 3, 0, 38, 47, 38, 63, +38, 127, 38, -113, 38, 5, 38, 0, 47, 93, 113, 114, 43, 43, 43, 53, 1, 43, 53, 0, -1, -1, 0, 69, -2, +82, 4, 53, 4, 118, 2, 54, 3, -27, 0, 0, 1, 23, 5, 45, 1, 60, -2, -79, 0, 63, 64, 19, 2, 0, +39, 37, 12, 4, 65, 2, 38, 64, 77, 78, 52, 38, 64, 59, 59, 52, 38, -72, -1, -64, 64, 25, 50, 52, 52, +-33, 38, 1, -97, 38, -81, 38, -1, 38, 3, 0, 38, 47, 38, 63, 38, 127, 38, -113, 38, 5, 38, 0, 47, 93, +113, 114, 43, 43, 43, 53, 1, 43, 53, 0, -1, -1, -1, -70, -1, -95, 1, -12, 5, 22, 2, 54, 3, -25, 0, +0, 1, 22, 5, 45, 0, 0, 0, 32, 64, 14, 2, 0, 19, 17, 5, 4, 65, 2, 18, 64, 11, 21, 52, 18, +-72, -1, -64, -77, 9, 10, 52, 18, 0, 47, 43, 43, 53, 1, 43, 53, -1, -1, -1, -70, -1, -95, 1, -12, 5, +22, 2, 54, 3, -25, 0, 0, 1, 22, 5, 45, 0, 0, 0, 32, 64, 14, 2, 0, 19, 17, 5, 4, 65, 2, +18, 64, 11, 21, 52, 18, -72, -1, -64, -77, 9, 10, 52, 18, 0, 47, 43, 43, 53, 1, 43, 53, 0, 1, 0, +69, -1, 108, 4, 53, 3, 87, 0, 32, 0, -88, 64, 64, 122, 27, -118, 27, 2, 107, 27, 1, 73, 27, 89, 27, +2, 40, 27, 56, 27, 2, -120, 22, 1, 42, 22, 58, 22, 2, -124, 19, 1, 118, 19, 1, 101, 19, 1, 86, 19, +1, -122, 15, 1, 119, 15, 1, 119, 11, 1, 117, 2, 1, 83, 2, 99, 2, 2, 68, 2, 1, 29, 29, 0, 28, +28, 24, -72, 3, 3, -77, 64, 0, 34, 14, -72, 2, -5, 64, 12, 32, 33, 13, 1, 0, 13, 16, 13, 2, 13, +13, 17, 65, 14, 3, 3, 0, 8, 0, 28, 2, -17, 0, 29, 3, 9, 0, 14, 0, 13, 3, 7, 0, 20, 2, +-17, 0, 4, 3, 17, 1, 42, -123, 0, 63, -19, 63, 51, 63, -19, 1, 47, -19, 50, 25, 47, 93, 93, 26, -19, +16, -48, 26, 24, -19, 50, 47, 18, 57, 25, 47, 49, 48, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, +93, 93, 93, 93, 1, 20, 7, 6, 33, 34, 39, 38, 53, 52, 54, 55, 54, 55, 23, 6, 6, 21, 20, 22, 51, +50, 55, 54, 53, 52, 39, 38, 39, 55, 22, 22, 21, 4, 53, -125, -115, -2, -58, -56, 106, 116, 42, 36, 22, 54, +40, 70, 45, -79, -92, -67, -110, -75, 30, 26, 48, 83, 53, 40, 1, 37, -33, 105, 113, 70, 77, -97, 86, -80, 89, +54, 112, 18, -112, -90, 69, 124, -127, 67, 83, -107, 102, 88, 78, 58, -51, 81, -88, -117, -1, -1, 0, 69, -1, 108, +4, 53, 3, 87, 2, 22, 6, 15, 0, 0, -1, -1, 0, 69, -1, 108, 4, 53, 6, 80, 2, 54, 6, 15, 0, +0, 1, 23, 5, 51, 1, 84, -1, -80, 0, 45, 64, 10, 2, 1, 96, 34, 112, 34, -80, 34, 3, 34, -72, -1, +-64, 64, 17, 9, 12, 52, 15, 34, 33, 17, 24, 65, 2, 1, 16, 34, 48, 34, 2, 34, 0, 47, 93, 53, 53, +1, 43, 43, 93, 53, 53, 0, -1, -1, 0, 69, -1, 108, 4, 53, 6, 80, 2, 54, 6, 15, 0, 0, 1, 23, +5, 51, 1, 84, -1, -80, 0, 45, 64, 10, 2, 1, 96, 34, 112, 34, -80, 34, 3, 34, -72, -1, -64, 64, 17, +9, 12, 52, 15, 34, 33, 17, 24, 65, 2, 1, 16, 34, 48, 34, 2, 34, 0, 47, 93, 53, 53, 1, 43, 43, +93, 53, 53, 0, -1, -1, 0, 69, -2, -121, 4, 53, 4, 118, 2, 54, 3, -27, 0, 0, 1, 23, 2, -8, 1, +84, -7, -80, 0, 62, 64, 12, 3, 2, -128, 43, 1, 0, 43, 37, 22, 27, 65, 45, -72, -1, -64, -77, 9, 11, +52, 47, -72, -1, -64, -77, 9, 11, 52, 46, -72, -1, -64, 64, 11, 9, 11, 52, 3, 2, 52, 64, 9, 11, 52, +52, -72, 3, 17, 0, 63, 43, 53, 53, 43, 43, 43, 1, 43, 93, 53, 53, -1, -1, 0, 69, -2, -121, 4, 53, +4, 118, 2, 54, 3, -27, 0, 0, 1, 23, 2, -8, 1, 84, -7, -80, 0, 62, 64, 12, 3, 2, -128, 43, 1, +0, 43, 37, 22, 27, 65, 45, -72, -1, -64, -77, 9, 11, 52, 47, -72, -1, -64, -77, 9, 11, 52, 46, -72, -1, +-64, 64, 11, 9, 11, 52, 3, 2, 52, 64, 9, 11, 52, 52, -72, 3, 17, 0, 63, 43, 53, 53, 43, 43, 43, +1, 43, 93, 53, 53, -1, -1, -1, -70, 0, 64, 1, -12, 5, 22, 2, 54, 3, -25, 0, 0, 1, 23, 2, -8, +0, 40, -5, 105, 0, 24, 64, 11, 3, 2, 0, 23, 17, 5, 4, 65, 3, 2, 32, -72, 2, -21, 0, 63, 53, +53, 1, 43, 53, 53, -1, -1, -1, -70, 0, 64, 1, -12, 5, 22, 2, 54, 3, -25, 0, 0, 1, 23, 2, -8, +0, 40, -5, 105, 0, 24, 64, 11, 3, 2, 0, 23, 17, 5, 4, 65, 3, 2, 32, -72, 2, -21, 0, 63, 53, +53, 1, 43, 53, 53, -1, -1, 0, 69, -1, 108, 4, 53, 5, -56, 2, 54, 6, 15, 0, 0, 1, 23, 5, 47, +1, 44, 5, 60, 0, 40, -75, 3, 2, 1, 0, 43, 1, -72, -1, -10, 64, 16, 43, 37, 8, 0, 65, 3, 2, +1, 0, 42, 16, 42, 47, 42, 3, 42, 0, 47, 93, 53, 53, 53, 1, 43, 93, 53, 53, 53, -1, -1, 0, 69, +-1, 108, 4, 53, 5, -56, 2, 54, 6, 15, 0, 0, 1, 23, 5, 47, 1, 44, 5, 60, 0, 40, -75, 3, 2, +1, 0, 43, 1, -72, -1, -10, 64, 16, 43, 37, 8, 0, 65, 3, 2, 1, 0, 42, 16, 42, 47, 42, 3, 42, +0, 47, 93, 53, 53, 53, 1, 43, 93, 53, 53, 53, -1, -1, 0, 54, -2, 78, 4, 32, 5, 29, 2, 54, 3, +39, 0, 0, 1, 23, 5, 45, 1, 24, 4, -106, 0, 31, 64, 22, 4, 0, 59, 57, 7, 18, 65, 4, 16, 58, +47, 58, 96, 58, -97, 58, -65, 58, -48, 58, 6, 58, 0, 47, 93, 53, 1, 43, 53, 0, -1, -1, 0, 54, -2, +78, 4, 53, 5, 29, 2, 54, 3, 40, 0, 0, 1, 23, 5, 45, 1, 28, 4, -106, 0, 31, 64, 22, 4, 0, +77, 75, 41, 51, 65, 4, 16, 76, 47, 76, 96, 76, -97, 76, -65, 76, -48, 76, 6, 76, 0, 47, 93, 53, 1, +43, 53, 0, -1, -1, -1, -70, -2, -103, 4, 61, 5, 29, 2, 54, 3, 41, 0, 0, 1, 23, 5, 45, 0, -46, +4, -106, 0, 42, -71, 0, 4, -1, -27, 64, 27, 37, 37, 15, 15, 65, 4, 16, 36, 47, 36, -128, 36, -97, 36, +-65, 36, -48, 36, -16, 36, 7, 36, 64, 18, 19, 52, 36, 0, 47, 43, 93, 53, 1, 43, 53, -1, -1, -1, -70, +-2, -103, 4, 61, 5, 29, 2, 54, 3, 41, 0, 0, 1, 23, 5, 45, 0, -46, 4, -106, 0, 42, -71, 0, 4, +-1, -27, 64, 27, 37, 37, 15, 15, 65, 4, 16, 36, 47, 36, -128, 36, -97, 36, -65, 36, -48, 36, -16, 36, 7, +36, 64, 18, 19, 52, 36, 0, 47, 43, 93, 53, 1, 43, 53, -1, -1, 0, 54, 1, 10, 2, 24, 5, 22, 2, +54, 3, 8, 0, 0, 1, 23, 5, 57, 0, 60, -2, 12, 0, 93, -74, 2, 32, 37, -96, 37, 2, 37, -72, -1, +-64, -78, 37, 47, 52, -72, -1, -54, 64, 57, 37, 37, 14, 14, 65, 2, 37, -128, 32, 32, 52, 37, -128, 20, 21, +52, 37, -64, 18, 19, 52, 37, 64, 13, 15, 52, 37, -128, 11, 12, 52, 95, 37, -49, 37, 2, 15, 37, 64, 37, +-113, 37, -17, 37, 4, 15, 37, 47, 37, -128, 37, -33, 37, -17, 37, 5, 37, 0, 47, 93, 113, 114, 43, 43, 43, +43, 43, 53, 1, 43, 43, 93, 53, 0, -1, -1, -1, -9, 1, 37, 3, 0, 5, -34, 2, 54, 3, -22, 0, 0, +1, 23, 5, 57, 0, 60, -2, -44, 0, 95, -73, 2, 32, 40, -112, 40, -96, 40, 3, -72, -1, -15, 64, 64, 40, +40, 21, 21, 65, 2, -113, 45, 1, 15, 45, 47, 45, 63, 45, 95, 45, 111, 45, -128, 45, -97, 45, 7, 45, 64, +67, 53, 45, 64, 53, 55, 52, 45, 64, 46, 47, 52, 45, 64, 42, 43, 52, 45, -128, 32, 32, 52, 45, 64, 30, +35, 52, 45, 64, 18, 21, 52, 45, 64, 11, 27, 52, 45, 0, 47, 43, 43, 43, 43, 43, 43, 43, 43, 93, 113, +53, 1, 43, 93, 53, 0, 0, 1, 0, 26, 0, -111, 3, 26, 2, -97, 0, 20, 0, 71, 64, 32, -122, 16, -106, +16, 2, -103, 14, -87, 14, 2, -117, 14, 1, 89, 4, 1, 56, 4, 72, 4, 2, 121, 3, 1, 104, 3, 1, 0, +22, 12, 13, 8, -69, 2, -17, 0, 15, 0, 19, 2, -17, -78, 13, 12, 0, -72, 2, -21, 0, 63, -58, 50, -3, +-36, -19, 1, 47, -51, 16, -64, 49, 48, 93, 93, 93, 93, 93, 93, 93, 1, 35, 34, 38, 39, 38, 39, 38, 35, +34, 7, 6, 7, 39, 18, 51, 50, 23, 22, 51, 51, 3, 26, 72, 66, 93, 64, 56, 5, 32, 33, 67, 102, 71, +61, 46, -57, -47, 57, 84, 92, 67, 60, 1, 37, 53, 71, 62, 5, 29, -113, 100, 125, 29, 1, -15, 97, 107, 0, +-1, -1, 0, 26, 0, -111, 3, 26, 4, 78, 2, 54, 6, 31, 0, 0, 1, 23, 5, 57, 0, -116, -3, 68, 0, +42, -71, 0, 1, -1, -44, 64, 26, 26, 21, 13, 0, 65, 1, 15, 26, 63, 26, 95, 26, 111, 26, 4, 26, -128, +11, 11, 52, 26, 64, 18, 22, 52, 26, 0, 47, 43, 43, 93, 53, 1, 43, 53, -1, -1, 0, 26, 0, -111, 3, +26, 4, 116, 2, 54, 6, 31, 0, 0, 1, 23, 5, 46, 0, 100, 3, -24, 0, 38, -79, 2, 1, -72, -1, -60, +64, 21, 27, 21, 13, 0, 65, 2, 1, 16, 26, 63, 26, 79, 26, 111, 26, -97, 26, -81, 26, 6, 26, 0, 47, +93, 53, 53, 1, 43, 53, 53, -1, -1, 0, 50, -1, 99, 3, 117, 3, 20, 2, 54, 3, -19, 0, 0, 1, 23, +2, -8, 1, 54, -6, -40, 0, 103, 64, 11, 3, 2, 16, 55, 1, -80, 55, 1, 16, 55, 1, -72, -1, -24, 64, +14, 55, 55, 17, 17, 65, -118, 45, 1, 45, 24, 11, 13, 52, 53, -72, -1, -24, 64, 30, 11, 17, 52, 22, 16, +11, 15, 52, 3, 2, 0, 46, 1, 127, 46, -81, 46, -32, 46, 3, 64, 46, 112, 46, -128, 46, -96, 46, 4, 46, +-72, -1, -128, -77, 24, 24, 52, 46, -72, -1, -64, -77, 10, 11, 52, 46, 0, 47, 43, 43, 93, 113, 114, 53, 53, +43, 43, 43, 93, 1, 43, 93, 114, 113, 53, 53, 0, -1, -1, 0, 50, -1, 99, 3, 117, 3, 20, 2, 54, 3, +-19, 0, 0, 1, 23, 2, -8, 1, 54, -6, -40, 0, 103, 64, 11, 3, 2, 16, 55, 1, -80, 55, 1, 16, 55, +1, -72, -1, -24, 64, 14, 55, 55, 17, 17, 65, -118, 45, 1, 45, 24, 11, 13, 52, 53, -72, -1, -24, 64, 30, +11, 17, 52, 22, 16, 11, 15, 52, 3, 2, 0, 46, 1, 127, 46, -81, 46, -32, 46, 3, 64, 46, 112, 46, -128, +46, -96, 46, 4, 46, -72, -1, -128, -77, 24, 24, 52, 46, -72, -1, -64, -77, 10, 11, 52, 46, 0, 47, 43, 43, +93, 113, 114, 53, 53, 43, 43, 43, 93, 1, 43, 93, 114, 113, 53, 53, 0, 0, 2, 0, 50, -1, 99, 3, 117, +3, 20, 0, 46, 0, 52, 0, -68, 64, 36, 23, 15, 13, 15, 52, 39, 32, 11, 17, 52, 48, 16, 19, 28, 52, +89, 23, 105, 23, 2, 96, 17, 1, 13, 3, 29, 3, 2, 11, 4, 19, 36, 38, 27, 28, 28, -72, -1, -64, -74, +13, 15, 52, 28, 28, 10, 40, -72, 2, -3, -77, 51, 51, 10, 47, -70, 3, 3, 0, 38, 3, 3, -76, 0, 54, +11, 10, 44, -72, 2, -17, -78, 49, 49, 47, -72, 2, -17, 64, 28, 38, 19, 21, 36, 47, 34, 63, 34, 2, 34, +34, 28, 27, 25, 0, 30, 1, -32, 30, -16, 30, 2, 30, 30, 14, 11, 10, 38, -72, 2, -21, -78, 10, 10, 14, +-69, 3, 10, 0, 4, 3, 8, 1, 42, -123, 0, 63, -19, 50, 25, 47, 24, 63, 18, 57, 18, 57, 47, 113, 114, +-51, 50, 50, 57, 47, 93, 51, -51, 50, 16, -19, 50, 47, -19, 1, 47, 51, 16, -48, -19, -19, 17, 57, 47, -19, +17, 57, 47, 43, 1, 17, 51, 18, 57, 57, 49, 48, 0, 95, 94, 93, 93, 93, 43, 43, 43, 1, 20, 7, 6, +35, 34, 39, 38, 39, 38, 39, 55, 23, 22, 51, 50, 55, 54, 55, 55, 6, 35, 34, 39, 38, 35, 34, 7, 39, +54, 51, 50, 23, 22, 51, 50, 55, 54, 55, 32, 53, 52, 55, 54, 51, 50, 17, 7, 38, 35, 34, 21, 20, 3, +117, 122, -120, -78, 66, 70, 58, 75, 43, 87, 17, 118, 66, 44, 123, 108, 82, 78, 11, 17, 16, 46, 92, 121, 11, +21, 30, 11, 48, 59, 21, 120, 91, 30, 31, 31, 29, 26, -2, -22, 48, 56, 86, -101, 63, 38, 81, 69, 1, 97, +-91, -93, -74, 15, 12, 26, 15, 30, 35, 27, 15, 62, 47, 85, 12, 3, 25, 33, 14, 13, 75, 33, 25, 8, 37, +35, -52, 103, 88, 102, -2, -65, 5, -91, 65, 100, -1, -1, 0, 50, -1, 99, 3, 117, 3, 20, 2, 22, 6, 36, +0, 0, -1, -1, 0, 50, -1, 99, 3, 124, 4, -81, 2, 54, 3, -19, 0, 0, 1, 23, 5, 54, 1, -112, -2, +-14, 0, 52, -79, 2, 43, -72, -1, -64, 64, 11, 18, 24, 52, 0, 43, 43, 0, 0, 65, 2, 45, -72, -1, -128, +64, 18, 16, 17, 52, 64, 45, 127, 45, 2, 15, 45, 63, 45, 96, 45, -65, 45, 4, 45, 0, 47, 93, 113, 43, +53, 1, 43, 43, 53, -1, -1, 0, 50, -1, 99, 3, 124, 4, -81, 2, 54, 3, -19, 0, 0, 1, 23, 5, 54, +1, -112, -2, -14, 0, 52, -79, 2, 43, -72, -1, -64, 64, 11, 18, 24, 52, 0, 43, 43, 0, 0, 65, 2, 45, +-72, -1, -128, 64, 18, 16, 17, 52, 64, 45, 127, 45, 2, 15, 45, 63, 45, 96, 45, -65, 45, 4, 45, 0, 47, +93, 113, 43, 53, 1, 43, 43, 53, -1, -1, 0, 50, -1, 99, 3, 117, 5, 81, 2, 54, 3, -19, 0, 0, 1, +23, 2, -11, 1, -92, -2, -57, 0, 33, 64, 21, 3, 2, 0, 60, 66, 24, 0, 65, 3, 2, 51, 64, 18, 20, +52, 51, 64, 9, 12, 52, 51, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, 0, -1, -1, 0, 50, -1, 99, 3, +117, 5, 81, 2, 54, 3, -19, 0, 0, 1, 23, 2, -11, 1, -92, -2, -57, 0, 33, 64, 21, 3, 2, 0, 60, +66, 24, 0, 65, 3, 2, 51, 64, 18, 20, 52, 51, 64, 9, 12, 52, 51, 0, 47, 43, 43, 53, 53, 1, 43, +53, 53, 0, -1, -1, 0, 50, -1, 99, 3, 117, 5, -19, 2, 54, 3, -19, 0, 0, 1, 23, 5, 59, 2, -88, +-1, 116, 0, 44, 64, 25, 2, 0, 43, 43, 28, 28, 65, 2, 47, 45, 112, 45, -128, 45, -81, 45, -65, 45, 5, +45, 64, 8, 9, 52, 45, -72, -1, -64, -77, 14, 17, 52, 45, 0, 47, 43, 43, 93, 53, 1, 43, 53, -1, -1, +0, 50, -1, 99, 3, 117, 5, -19, 2, 54, 3, -19, 0, 0, 1, 23, 5, 59, 2, -88, -1, 116, 0, 44, 64, +25, 2, 0, 43, 43, 28, 28, 65, 2, 47, 45, 112, 45, -128, 45, -81, 45, -65, 45, 5, 45, 64, 8, 9, 52, +45, -72, -1, -64, -77, 14, 17, 52, 45, 0, 47, 43, 43, 93, 53, 1, 43, 53, -1, -1, 0, 50, -1, 99, 3, +124, 4, -81, 2, 54, 3, -19, 0, 0, 1, 23, 5, 55, 1, -112, -2, -14, 0, 52, -79, 2, 43, -72, -1, -64, +64, 11, 18, 24, 52, 0, 43, 43, 0, 0, 65, 2, 47, -72, -1, -128, 64, 18, 16, 17, 52, 64, 47, 127, 47, +2, 15, 47, 63, 47, 96, 47, -65, 47, 4, 47, 0, 47, 93, 113, 43, 53, 1, 43, 43, 53, -1, -1, 0, 50, +-1, 99, 3, 124, 4, -81, 2, 54, 3, -19, 0, 0, 1, 23, 5, 55, 1, -112, -2, -14, 0, 52, -79, 2, 43, +-72, -1, -64, 64, 11, 18, 24, 52, 0, 43, 43, 0, 0, 65, 2, 47, -72, -1, -128, 64, 18, 16, 17, 52, 64, +47, 127, 47, 2, 15, 47, 63, 47, 96, 47, -65, 47, 4, 47, 0, 47, 93, 113, 43, 53, 1, 43, 43, 53, -1, +-1, 0, 50, -1, 99, 3, 117, 4, -4, 2, 54, 3, -19, 0, 0, 1, 23, 5, 46, 1, -112, 4, 112, 0, 54, +-78, 3, 2, 43, -72, -1, -64, 64, 33, 9, 17, 52, 0, 43, 43, 0, 0, 65, 3, 2, 48, 64, 18, 20, 52, +48, 48, 64, 48, 2, 16, 48, 63, 48, 79, 48, 112, 48, -128, 48, 5, 48, 0, 47, 93, 113, 43, 53, 53, 1, +43, 43, 53, 53, -1, -1, 0, 50, -1, 99, 3, 117, 4, -4, 2, 54, 3, -19, 0, 0, 1, 23, 5, 46, 1, +-112, 4, 112, 0, 54, -78, 3, 2, 43, -72, -1, -64, 64, 33, 9, 17, 52, 0, 43, 43, 0, 0, 65, 3, 2, +48, 64, 18, 20, 52, 48, 48, 64, 48, 2, 16, 48, 63, 48, 79, 48, 112, 48, -128, 48, 5, 48, 0, 47, 93, +113, 43, 53, 53, 1, 43, 43, 53, 53, -1, -1, 0, 50, -1, 99, 3, 127, 5, -81, 2, 54, 3, -19, 0, 0, +1, 23, 5, 47, 1, -112, 5, 35, 0, 66, -77, 4, 3, 2, 47, -72, -1, -64, 64, 25, 9, 21, 52, 0, 47, +47, 0, 0, 65, 4, 3, 2, 16, 52, 48, 52, 64, 52, 3, 47, 52, -81, 52, 2, 52, -72, -1, -64, -77, 15, +17, 52, 52, -72, -1, -64, -77, 14, 17, 52, 52, 0, 47, 43, 43, 93, 113, 53, 53, 53, 1, 43, 43, 53, 53, +53, -1, -1, 0, 50, -1, 99, 3, 127, 5, -81, 2, 54, 3, -19, 0, 0, 1, 23, 5, 47, 1, -112, 5, 35, +0, 66, -77, 4, 3, 2, 47, -72, -1, -64, 64, 25, 9, 21, 52, 0, 47, 47, 0, 0, 65, 4, 3, 2, 16, +52, 48, 52, 64, 52, 3, 47, 52, -81, 52, 2, 52, -72, -1, -64, -77, 15, 17, 52, 52, -72, -1, -64, -77, 14, +17, 52, 52, 0, 47, 43, 43, 93, 113, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, 1, -1, -70, -1, -89, 4, +-39, 3, -78, 0, 54, 0, -42, 64, 48, 73, 38, 1, 58, 38, 1, 101, 39, 117, 39, 2, -121, 38, 1, 116, 38, +1, 99, 38, 1, 84, 38, 1, -125, 34, 1, 102, 34, 118, 34, 2, -114, 32, 1, 3, 104, 32, 120, 32, 2, 9, +20, 25, 20, 41, 20, 3, 47, -72, 3, 12, -77, 8, 8, 33, 41, -72, 2, -3, 64, 15, 15, 2, 2, 15, 0, +0, 15, 15, 56, 89, 26, 1, 26, 21, 31, -72, 2, -5, 64, 17, 54, 29, 70, 29, 2, 36, 29, 1, 2, 29, +18, 29, 2, 2, 29, 29, 33, -72, 3, 12, -76, 27, 21, 2, 11, 4, -66, 2, -17, 0, 53, 3, 4, 0, 11, +2, -17, 0, 44, 2, -21, -77, 28, 27, 31, 29, -70, 3, 7, 0, 35, 2, -17, -73, 0, 19, 16, 19, 32, 19, +3, 19, -71, 3, 13, 1, 57, -123, 0, 63, 93, -19, 63, 51, -51, 57, 63, -19, 63, -19, 17, 57, 1, 47, -50, +-19, 50, 25, 47, 95, 93, 93, 93, -19, 18, 57, 93, 17, 51, 24, 47, 51, 47, 18, 57, 61, 47, 24, 16, -19, +17, 57, 47, -19, 49, 48, 0, 93, 93, 95, 93, 93, 93, 93, 93, 93, 93, 93, 1, 93, 93, 1, 20, 7, 38, +35, 34, 7, 6, 21, 20, 51, 51, 50, 23, 22, 21, 16, 5, 6, 33, 32, 17, 52, 55, 54, 55, 55, 7, 53, +37, 22, 23, 6, 21, 20, 33, 50, 55, 54, 55, 54, 53, 52, 35, 35, 34, 38, 53, 52, 55, 54, 55, 54, 51, +50, 4, -39, 14, 75, 107, 87, 96, 88, 96, 80, 123, 66, 48, -2, -3, -59, -2, -51, -2, -118, 34, 31, 41, 18, +-12, 1, 32, 17, 26, -126, 1, 70, 120, -97, 83, 113, -98, 53, -22, 46, 63, 55, 60, 85, 102, 103, -114, 3, 32, +15, 98, 97, 101, 93, 55, 38, 11, 8, 65, -2, -20, -128, 98, 1, 39, 104, 114, 104, 78, 33, 126, 61, -106, 5, +11, -25, -105, -12, 48, 25, 50, 70, 37, 31, 65, 46, 67, 115, 125, 84, 101, 0, 1, -1, -70, -1, 31, 4, -75, +2, 5, 0, 54, 0, -54, 64, 28, 24, 50, 1, 7, 50, 1, 54, 33, 1, -125, 32, 1, 100, 32, 116, 32, 2, +86, 32, 1, 69, 32, 1, 8, 17, 1, 3, 49, -69, 3, 12, 0, 3, 0, 39, 3, 12, 64, 14, 11, 4, 11, +1, 3, 11, 3, 11, 31, 0, 56, 23, 19, 27, -72, 2, -5, 64, 12, 20, 26, 36, 26, 2, 2, 26, 1, 2, +26, 26, 31, -72, 3, 12, 64, 13, 24, 19, 0, 5, 16, 5, 2, 45, 5, 45, 5, 1, 35, -72, 2, -17, 64, +14, 64, 15, 1, 49, 15, 1, 0, 15, 16, 15, 32, 15, 3, 15, -72, 3, 14, 64, 16, 89, 25, 1, 72, 25, +1, 57, 25, 1, 25, 23, 24, 27, 26, 26, 54, -69, 2, -17, 0, 1, 2, -21, 1, 57, -123, 0, 63, -19, 50, +47, 51, -51, 57, 57, 93, 93, 93, 63, 93, 93, 93, -19, 17, 57, 57, 47, 47, 93, 1, 47, -50, -19, 50, 25, +47, 95, 93, 93, -19, 18, 57, 16, -64, 17, 57, 57, 24, 47, 47, 93, 16, -19, 16, -19, 49, 48, 0, 95, 93, +93, 93, 93, 93, 93, 93, 1, 93, 1, 35, 32, 21, 20, 51, 50, 23, 22, 23, 22, 21, 20, 7, 6, 35, 34, +39, 38, 53, 52, 55, 54, 55, 7, 53, 37, 23, 6, 7, 6, 21, 20, 23, 22, 51, 50, 55, 54, 53, 52, 39, +38, 39, 38, 39, 38, 35, 34, 53, 52, 55, 54, 51, 51, 4, -75, -81, -2, -53, 93, 58, 112, 47, 19, 29, -72, +127, -1, -71, 124, -88, 64, 18, 46, -22, 1, 35, 40, 26, 49, 57, -84, 116, -81, -113, 109, -122, 15, 8, 42, 17, +67, 54, 22, 117, -22, 75, 85, -81, 1, 37, 40, 33, 13, 6, 9, 15, 37, -34, 84, 59, 56, 76, -93, 116, -126, +36, 75, 121, 61, -106, 20, 43, 86, 106, 74, -112, 62, 42, 22, 27, 47, 18, 8, 5, 3, 3, 4, 3, 66, -29, +71, 23, -1, -1, 0, 50, -1, -89, 4, -39, 4, 45, 2, 54, 3, 53, 0, 0, 1, 23, 5, 54, 0, -56, -2, +112, 0, 29, 64, 19, 1, 0, 63, 16, 63, 2, 0, 63, 60, 36, 10, 65, 1, 15, 62, 95, 62, 2, 62, 0, +47, 93, 53, 1, 43, 93, 53, 0, -1, -1, 0, 36, -1, 31, 4, -75, 3, 101, 2, 54, 3, 54, 0, 0, 1, +23, 5, 54, 0, -56, -3, -88, 0, 31, 64, 21, 1, -112, 55, -96, 55, -48, 55, 3, 56, 55, 55, 47, 47, 65, +1, 15, 57, 63, 57, 2, 57, 0, 47, 93, 53, 1, 43, 93, 53, 0, -1, -1, -1, -70, -1, 114, 1, -12, 4, +-11, 2, 54, 3, -13, 0, 0, 1, 23, 5, 54, 0, 8, -1, 56, 0, 49, 64, 36, 3, 0, 21, 21, 0, 0, +65, 3, 111, 23, 127, 23, 2, 47, 23, 1, 15, 23, 31, 23, 63, 23, 95, 23, 4, 23, 64, 16, 18, 52, 23, +64, 38, 42, 52, 23, 0, 47, 43, 43, 93, 113, 114, 53, 1, 43, 53, 0, -1, -1, -1, -70, -1, 114, 1, -12, +4, -11, 2, 54, 3, -13, 0, 0, 1, 23, 5, 54, 0, 8, -1, 56, 0, 49, 64, 36, 3, 0, 21, 21, 0, +0, 65, 3, 111, 23, 127, 23, 2, 47, 23, 1, 15, 23, 31, 23, 63, 23, 95, 23, 4, 23, 64, 16, 18, 52, +23, 64, 38, 42, 52, 23, 0, 47, 43, 43, 93, 113, 114, 53, 1, 43, 53, 0, -1, -1, 0, 50, -1, 99, 3, +117, 4, -79, 2, 54, 3, -19, 0, 0, 1, 23, 5, 45, 1, 84, 4, 42, 0, 56, -71, 0, 2, -1, -15, 64, +25, 45, 43, 40, 40, 65, 2, 48, 44, 64, 44, -113, 44, 3, 47, 44, 63, 44, -128, 44, -32, 44, -16, 44, 5, +44, -72, -1, -64, 64, 9, 15, 17, 52, 44, 64, 18, 20, 52, 44, 0, 47, 43, 43, 93, 113, 53, 1, 43, 53, +-1, -1, 0, 50, -1, 99, 3, 117, 4, -79, 2, 54, 3, -19, 0, 0, 1, 23, 5, 45, 1, 84, 4, 42, 0, +56, -71, 0, 2, -1, -15, 64, 25, 45, 43, 40, 40, 65, 2, 48, 44, 64, 44, -113, 44, 3, 47, 44, 63, 44, +-128, 44, -32, 44, -16, 44, 5, 44, -72, -1, -64, 64, 9, 15, 17, 52, 44, 64, 18, 20, 52, 44, 0, 47, 43, +43, 93, 113, 53, 1, 43, 53, -1, -1, 0, 50, -2, -116, 4, -39, 3, -78, 2, 54, 3, 53, 0, 0, 1, 23, +6, 112, 1, 44, -1, 16, 0, 56, -74, 2, 1, -64, 62, -48, 62, 2, -72, -1, -64, 64, 15, 62, 64, 26, 18, +65, 2, 1, -80, 65, -64, 65, -48, 65, 3, 65, -72, -1, -64, -77, 18, 21, 52, 65, -72, -1, -64, -77, 9, 12, +52, 65, 0, 47, 43, 43, 113, 53, 53, 1, 43, 93, 53, 53, -1, -1, 0, 36, -2, 78, 4, -75, 2, 5, 2, +54, 3, 54, 0, 0, 1, 23, 6, 112, 1, 64, -2, -46, 0, 59, 64, 14, 2, 1, 0, 57, 1, 0, 57, 59, +21, 13, 65, 2, 1, 58, -72, -1, -64, -77, 74, 76, 52, 58, -72, -1, -64, -77, 64, 71, 52, 58, -72, -1, -64, +-74, 45, 54, 52, -48, 58, 1, 58, -72, 3, 14, 0, 63, 93, 43, 43, 43, 53, 53, 1, 43, 93, 53, 53, 0, +-1, -1, -1, -70, -2, -84, 1, -12, 3, -90, 2, 54, 5, 41, 0, 0, 1, 22, 5, 49, 0, 0, 0, 36, 64, +16, 2, 1, 35, 15, 17, 1, 0, 65, 2, 1, 18, 64, 12, 21, 52, 18, -72, -1, -64, -77, 9, 10, 52, 18, +0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, -1, -70, -2, -84, 1, -12, 3, -90, 2, 54, 5, 41, 0, +0, 1, 22, 5, 49, 0, 0, 0, 36, 64, 16, 2, 1, 35, 15, 17, 1, 0, 65, 2, 1, 18, 64, 12, 21, +52, 18, -72, -1, -64, -77, 9, 10, 52, 18, 0, 47, 43, 43, 53, 53, 1, 43, 53, 53, -1, -1, 0, 50, -2, +-88, 4, -39, 3, -78, 2, 54, 3, 53, 0, 0, 1, 23, 6, 113, 1, 84, -1, 56, 0, 59, -77, 3, 2, 1, +70, -72, -1, -64, -78, 9, 24, 52, -72, -1, -20, 64, 12, 70, 60, 26, 18, 65, 3, 2, 1, 31, 65, 1, 65, +-72, -1, -64, -77, 17, 22, 52, 65, -72, -1, -64, -77, 9, 15, 52, 65, 0, 47, 43, 43, 113, 53, 53, 53, 1, +43, 43, 53, 53, 53, 0, -1, -1, 0, 36, -2, 78, 4, -75, 2, 5, 2, 54, 3, 54, 0, 0, 1, 23, 6, +113, 1, 64, -2, -34, 0, 57, -77, 3, 2, 1, 65, -72, -1, -64, 64, 22, 10, 14, 52, 0, 65, 55, 21, 13, +65, 3, 2, 1, 58, 64, 73, 53, -49, 58, -33, 58, 2, 58, -72, -1, -64, -77, 9, 13, 52, 58, -72, 3, 14, +0, 63, 43, 114, 43, 53, 53, 53, 1, 43, 43, 53, 53, 53, 0, 0, 1, 0, 69, -1, -51, 6, 127, 2, -5, +0, 40, 0, -73, 64, 64, 11, 15, 27, 15, 2, 21, 3, 0, 11, 16, 11, 2, 26, 5, 23, 25, 25, 64, 23, +25, 52, 25, 25, 37, 1, 40, 42, 37, 64, 30, 37, 52, 37, 6, 41, 35, 1, 15, 33, 1, -1, 33, 1, 42, +33, 1, 3, 15, 33, 63, 33, 79, 33, -81, 33, -65, 33, 5, 11, 5, 35, 33, 39, 27, -72, 2, -17, 64, 25, +19, 64, 13, 32, 28, 37, 52, 13, 32, 23, 25, 52, 13, 32, 18, 22, 52, 15, 13, 31, 13, 2, 26, 3, 9, +-72, -1, -24, 64, 17, 9, 12, 52, -75, 9, -59, 9, -43, 9, 3, 9, 13, 39, 25, 19, 0, 39, -71, 2, -17, +0, 2, 0, 47, -19, 57, 47, -51, 18, 57, 57, 93, 43, 0, 95, 94, 93, 43, 43, 43, 0, 26, 24, 16, 77, +-19, 17, 57, 57, 95, 94, 93, 95, 113, 93, 113, 113, 1, 47, -51, 43, 1, 16, -64, 50, 17, 57, 25, 47, 43, +1, 17, 51, 49, 48, 0, 95, 94, 93, 95, 94, 93, 37, 7, 33, 34, 39, 38, 39, 38, 54, 55, 54, 55, 54, +55, 54, 55, 54, 55, 54, 51, 50, 23, 22, 21, 20, 7, 38, 35, 34, 7, 6, 7, 6, 7, 6, 7, 6, 21, +20, 51, 33, 6, 127, -3, -5, 111, 116, 25, 28, 1, 2, 53, 34, 24, -124, 89, 89, 81, 100, 70, 4, 31, 33, +42, 25, 22, 11, 61, 61, 54, 65, 4, 50, 36, 30, 101, -104, 120, 94, 5, -120, 114, -91, 14, 16, 32, 64, -73, +40, 27, 73, 48, 48, 47, 111, 78, 4, 29, 54, 48, 71, 77, 46, 124, 76, 5, 77, 55, 14, 52, 77, 58, 25, +29, 0, 0, 1, 0, 69, -2, 87, 6, 127, 1, -45, 0, 24, 0, 73, 64, 15, -119, 17, 1, 71, 12, 87, 12, +103, 12, 3, 0, 23, 15, 26, 20, -72, 3, 12, 64, 10, 5, 18, 16, 118, 11, 1, 9, 11, 22, 14, -65, 2, +-17, 0, 16, 2, -21, 0, 24, 0, 22, 2, -17, 0, 1, 3, 6, 0, 63, -19, 57, 63, -19, 17, 57, 57, 93, +18, 57, 1, 47, -19, 16, -48, -64, 50, 49, 48, 0, 93, 93, 1, 33, 34, 39, 38, 39, 38, 55, 54, 55, 54, +55, 0, 33, 51, 21, 35, 32, 1, 6, 21, 20, 51, 33, 21, 5, -126, -5, 111, 116, 25, 28, 1, 2, 30, 29, +28, 49, 112, 1, -76, 2, -94, -20, -14, -3, 87, -2, 42, 117, 94, 5, -120, -2, 87, 14, 16, 32, 60, 98, 117, +44, 72, 100, 1, 83, -82, -2, -108, 106, 45, 29, 9, -1, -1, 0, 69, -1, -51, 6, 127, 3, -22, 2, 54, 6, +64, 0, 0, 1, 23, 5, 57, 1, 44, -4, -32, 0, 51, -79, 1, 41, -72, -1, -64, -75, 11, 27, 52, -48, 41, +1, -72, -1, 113, 64, 22, 41, 41, 19, 19, 65, 1, 111, 46, -97, 46, 2, 46, 64, 21, 23, 52, 46, 64, 9, +12, 52, 46, 0, 47, 43, 43, 93, 53, 1, 43, 113, 43, 53, 0, -1, -1, 0, 69, -2, 87, 6, 127, 3, -102, +2, 54, 6, 65, 0, 0, 1, 23, 5, 57, 3, -24, -4, -112, 0, 37, 64, 26, 1, 0, 30, 35, 5, 14, 65, +1, 16, 30, 47, 30, 95, 30, 3, 30, 64, 18, 21, 52, 30, 64, 9, 13, 52, 30, 0, 47, 43, 43, 93, 53, +1, 43, 53, 0, 0, 1, 0, 40, 1, 37, 1, -128, 1, -45, 0, 3, 0, 30, -71, 0, 0, -1, -64, -74, 9, +25, 52, 0, 5, 1, 3, -70, 2, -17, 0, 1, 2, -21, 0, 63, -19, 1, 47, 16, -58, 43, 49, 48, 1, 33, +53, 33, 1, -128, -2, -88, 1, 88, 1, 37, -82, 0, 0, 2, -2, 41, 4, 38, 1, -38, 7, 22, 0, 49, 0, +58, 0, -21, -71, 0, 42, -1, -16, 64, 40, 33, 36, 52, 20, 16, 9, 15, 52, 9, 20, 25, 20, 41, 20, 3, +22, 56, 50, 12, 12, 50, 42, 40, 37, 3, 15, 39, 1, 38, 3, 39, 35, 64, 33, 34, 26, 27, 24, 31, 31, +-72, -1, -64, 64, 31, 7, 19, 52, 31, 34, 64, 24, 64, 7, 18, 52, 24, 23, 34, 22, 35, 35, 17, 50, 49, +9, 17, 0, 47, 1, 36, 3, 47, 52, 64, 52, -72, -1, -64, 64, 30, 12, 19, 52, 52, 39, 40, 56, 27, 31, +24, 23, 34, 5, 33, 0, 26, 1, 13, 3, 26, 3, 1, 44, 35, 22, 56, 64, 5, 1, 1, -72, -1, -64, 64, +22, 21, 24, 52, 47, 1, 63, 1, 2, 1, 12, 31, 13, 63, 13, 95, 13, 127, 13, -97, 13, 5, 13, -72, 1, +87, -123, 0, 47, 93, -51, -60, 93, 43, 0, 16, -64, 26, 24, -35, -64, -64, -64, 18, 57, 47, 95, 94, 93, -52, +23, 57, 16, -52, 57, -60, 43, 0, 26, 24, 16, -51, 95, 94, 93, 1, 47, -51, 47, -51, 18, 57, 47, -51, -42, +-35, -51, 43, 1, 26, 24, 16, -51, 43, 1, 17, 18, 57, 57, 18, 57, 26, 24, 16, -34, 95, 94, 93, 50, 50, +-51, 50, 17, 57, 47, 17, 57, 49, 48, 94, 93, 43, 43, 1, 33, 34, 39, 6, 35, 35, 34, 6, 21, 20, 51, +33, 21, 33, 34, 38, 39, 38, 55, 54, 51, 51, 3, 39, 52, 55, 23, 20, 23, 22, 23, 20, 7, 39, 19, 50, +53, 52, 39, 55, 22, 23, 22, 51, 50, 54, 51, 50, 21, 7, 52, 35, 34, 7, 6, 7, 51, 50, 1, -38, -2, +101, 34, 27, 35, 69, 99, 91, -119, 45, 2, -108, -3, 105, 56, 24, 1, 3, 41, 105, -115, 31, 47, 25, 23, 7, +31, 5, 43, 13, 23, 47, 86, 7, 19, 22, 2, 21, 45, 43, -75, 58, 109, 78, 54, 38, 44, 72, 16, -98, 66, +5, 28, 30, 30, 98, 52, 13, 83, 14, 15, 74, 63, -93, 1, 38, 12, 62, 55, 5, 28, 13, 2, 17, 59, 33, +8, -2, -18, 51, 23, 35, 29, 86, 4, 48, -83, -121, 1, 49, 29, 49, 8, 0, 0, 4, -2, -94, 4, 38, 1, +-115, 7, 22, 0, 3, 0, 7, 0, 55, 0, 65, 1, -96, 64, 67, 40, 8, 24, 31, 52, 15, 16, 22, 26, 52, +15, 16, 11, 17, 52, 28, 22, 21, 3, 19, 26, 7, 5, 6, 4, 3, 1, 2, 0, 47, 6, 1, 15, 6, 1, +28, 3, 6, 4, 64, 4, 64, 9, 14, 52, 4, 32, 0, 1, 0, 0, 1, 28, 3, 0, 2, 64, 2, 64, 35, +36, 52, 2, 2, 47, 38, 26, -72, -1, -64, -77, 28, 32, 52, 26, -72, -1, -64, 64, 18, 9, 21, 52, 26, 29, +64, 19, 64, 7, 18, 52, 19, 18, 29, 17, 30, 64, 30, -72, -1, -64, 64, 101, 15, 17, 52, 0, 30, 16, 30, +32, 30, 3, 64, -48, 30, -32, 30, -16, 30, 3, 0, 30, 16, 30, -64, 30, -48, 30, 4, 0, 30, 16, 30, -16, +30, 3, 9, 3, 30, 30, 47, 12, 56, 24, 32, 36, 52, 56, 33, 31, 62, -112, 38, 1, 15, 38, 31, 38, 2, +15, 3, 38, 31, 55, 47, 52, 64, 12, 15, 60, 47, 60, 79, 60, 95, 60, 4, 54, 5, 64, 60, 36, 42, 5, +36, 64, 19, 23, 52, 36, 30, 6, 4, 5, 7, 2, 0, 1, 3, 5, 7, 64, 7, -72, -1, -64, 64, 24, 17, +23, 52, 7, 1, 3, 22, 26, 19, 18, 29, 5, 28, 0, 21, 1, 13, 3, 21, 17, 30, 48, 64, 48, -72, -1, +-64, 64, 29, 21, 25, 52, 80, 48, 96, 48, 112, 48, 3, 47, 48, 63, 48, 2, 48, 55, 31, 8, 63, 8, 95, +8, 127, 8, -97, 8, 5, 8, -72, 1, 87, -123, 0, 47, 93, -51, -60, 93, 113, 43, 0, 26, 24, 16, -35, -64, +47, 95, 94, 93, -52, 23, 57, -48, -51, -58, 43, 0, 26, 24, 16, -51, 17, 18, 57, 57, 17, 18, 57, 57, 16, +-58, 43, 0, 24, 16, -58, 17, 57, 57, 95, 94, 93, 1, 47, 26, -51, 47, -58, -51, -36, 95, 94, 93, 93, -51, +17, 57, 57, 43, 1, 17, 18, 57, 24, 47, 95, 94, 93, 113, 114, 94, 93, 43, 1, 26, 24, 16, -51, -42, -35, +-51, 43, 1, 26, 24, 16, -51, 43, 43, 1, 17, 18, 57, 24, 47, 43, 1, 26, 24, 16, -51, 95, 94, 93, 113, +-58, 43, 1, 26, 24, 16, -51, 95, 94, 93, 113, 17, 18, 57, 57, 17, 18, 57, 57, 17, 18, 23, 57, 49, 48, +1, 43, 43, 43, 1, 7, 39, 55, 7, 7, 39, 55, 1, 33, 34, 38, 39, 38, 55, 54, 51, 51, 3, 39, 52, +55, 23, 20, 23, 22, 23, 20, 7, 39, 19, 51, 52, 39, 6, 6, 35, 34, 53, 52, 55, 54, 51, 50, 23, 22, +21, 21, 33, 34, 7, 6, 21, 20, 51, 33, 3, 38, 39, 38, 35, 34, 21, 20, 51, 50, 1, 15, 36, 77, 35, +30, 36, 77, 35, 1, 56, -3, 105, 56, 24, 1, 3, 42, 105, -116, 32, 46, 25, 23, 7, 31, 5, 43, 13, 23, +46, -13, 10, 15, 46, 16, 82, 20, 26, 48, 57, 32, 26, -2, -124, 90, 71, 66, 44, 2, -108, -82, 6, 16, 19, +19, 29, 42, 21, 6, -18, 69, 40, 69, 83, 69, 40, 69, -3, 59, 14, 15, 73, 64, -93, 1, 38, 12, 62, 55, +5, 28, 13, 2, 17, 59, 33, 8, -2, -18, 23, 37, 5, 13, 66, 46, 50, 65, 91, 75, 82, 104, 50, 48, 52, +13, 1, 125, 16, 19, 23, 46, 28, 0, 0, 2, -1, 48, 4, 38, 0, -47, 5, 42, 0, 14, 0, 23, 0, 115, +64, 11, 10, 16, 57, 66, 52, 16, 16, 29, 36, 52, 22, -72, -1, -46, 64, 29, 29, 47, 52, 17, 21, 15, 12, +0, 3, 10, 21, 64, 21, 64, 7, 17, 52, 21, 21, 6, 15, 0, 6, 21, 23, 12, 17, 64, 17, -72, -1, -64, +64, 21, 7, 17, 52, 17, 3, 0, 23, 8, 5, 31, 0, 63, 0, 95, 0, 127, 0, -97, 0, 5, 0, 0, 47, +93, -48, -35, -44, 17, 57, -50, 43, 0, 26, 24, 16, -51, 18, 57, 1, 47, -44, -51, 17, 57, 47, 43, 1, 26, +24, 16, -51, 57, 17, 57, 17, 18, 57, 49, 48, 1, 43, 43, 43, 19, 35, 34, 39, 6, 35, 35, 53, 51, 50, +55, 54, 55, 22, 21, 39, 38, 39, 6, 7, 6, 7, 22, 23, -47, 49, 81, 73, 49, 91, 74, 73, 76, 48, 62, +80, 78, 55, 12, 36, 21, 17, 13, 12, 41, 66, 4, 38, 60, 60, 83, 69, 89, 19, 119, 59, 11, 54, 47, 5, +17, 12, 21, 44, 8, 0, 2, -1, 29, 4, 38, 0, -28, 6, -101, 0, 49, 0, 57, 0, -26, 64, 20, 13, 41, +29, 41, 2, 46, 4, 35, 9, 24, 31, 50, 19, 40, 42, 17, 13, 54, 64, 52, -72, -1, -24, 64, 17, 22, 25, +52, 0, 5, 16, 5, 32, 5, 3, 29, 5, 52, 5, 54, 3, 54, -72, -1, -32, 64, 45, 46, 59, 52, 54, 64, +7, 11, 52, 54, 50, 64, 45, 46, 43, 0, 43, 64, 9, 24, 52, 43, 42, 3, 1, 3, 0, 50, 64, 11, 9, +2, 3, 0, 31, 27, 24, 24, 54, 33, 19, 16, 32, 37, 52, 5, -72, -1, -32, 64, 44, 15, 21, 52, 40, 5, +19, 52, 4, 54, 46, 0, 43, 42, 2, 5, 1, 45, 33, 13, 11, 11, 56, 17, 15, 54, 31, 54, 47, 54, 3, +64, 54, 31, 13, 63, 13, 95, 13, 127, 13, -97, 13, 5, 13, -72, 1, 87, -123, 0, 47, 93, -51, 94, 93, 50, +50, 57, 47, 16, -44, -42, -51, 23, 57, 17, 23, 57, 43, 43, 0, 17, 18, 57, 24, 47, 51, 1, 47, -44, -44, +50, -44, 50, 26, -51, 17, 18, 57, 16, -35, -51, 43, 1, 17, 18, 57, 57, 26, 24, 16, -50, 43, 43, 1, 17, +18, 57, 57, 95, 94, 93, 43, 1, 26, 24, 16, -51, 50, 17, 57, 57, 17, 18, 57, 17, 57, 49, 48, 95, 94, +93, 19, 7, 39, 23, 22, 7, 22, 23, 22, 21, 20, 7, 6, 35, 52, 55, 54, 55, 54, 55, 38, 39, 38, 38, +35, 34, 6, 35, 34, 39, 38, 53, 52, 51, 50, 23, 22, 23, 23, 22, 23, 54, 53, 39, 52, 55, 23, 22, 23, +22, 3, 52, 39, 6, 7, 50, 55, 54, -28, 23, 28, 1, 3, 75, 17, 8, 11, 5, 106, 114, 1, 2, 9, 81, +56, 29, 20, 23, 66, 18, 6, 23, 4, 21, 53, 30, 24, 36, 93, 40, 31, 48, 21, 23, 55, 28, 21, 11, 2, +50, 10, 106, 22, 34, 64, 59, 21, 40, 6, 92, 86, 14, 44, 127, 126, 31, 22, 30, 31, 34, 25, 24, 5, 10, +36, 31, 43, 70, 55, 34, 40, 98, 11, 67, 38, 33, 72, 125, 54, 50, 78, 35, 45, 111, -91, 16, 59, 44, 3, +24, 24, 5, -2, 41, 18, 41, 44, 40, 3, 6, 0, 2, -1, 18, 4, 38, 0, -18, 6, -103, 0, 3, 0, 38, +0, -26, 64, 23, 34, 16, 21, 24, 52, 0, 36, 32, 36, 2, 18, 5, 8, 32, 21, 28, 52, 7, 16, 21, 28, +52, 36, -72, -1, -16, 64, 116, 30, 33, 52, 33, 16, 30, 33, 52, 3, 1, 0, 0, 1, 28, 3, 0, 2, 64, +2, 64, 21, 24, 52, 63, 2, 1, 0, 2, 1, 12, 3, 2, 2, 30, 10, 14, 24, 34, 47, 52, 14, 24, 21, +24, 52, 10, 14, 26, 14, 2, 10, 14, 19, 30, 5, 10, 38, 31, 30, 19, 35, 10, 2, 0, 15, 1, 1, 28, +3, 1, 3, 64, 3, 64, 9, 14, 52, 3, 3, 31, 37, 27, 23, 30, 19, 14, 17, 31, 4, 37, -49, 31, 1, +-128, 31, 1, 16, 31, 80, 31, -96, 31, 3, 31, 31, 5, 63, 5, 95, 5, 127, 5, -97, 5, 5, 5, -72, 1, +107, -123, 0, 47, 93, -60, 93, 113, 93, -51, 57, 16, -60, 50, 50, -35, -60, 51, 17, 18, 57, 47, 43, 0, 26, +24, 16, -51, 95, 94, 93, 57, 57, 1, 47, -51, -60, -44, 50, -58, 17, 57, 17, 18, 57, 94, 93, 43, 43, 1, +17, 18, 57, 24, 47, 95, 94, 93, 93, 43, 1, 26, 24, 16, -51, 95, 94, 93, 57, 57, 49, 48, 0, 43, 43, +43, 43, 1, 95, 94, 93, 43, 19, 7, 39, 55, 19, 7, 35, 34, 39, 38, 53, 52, 55, 54, 55, 34, 38, 35, +34, 7, 54, 55, 54, 51, 50, 23, 22, 51, 50, 54, 51, 7, 6, 7, 6, 21, 20, 33, 51, 102, 40, 73, 37, +-44, 107, 28, -38, 76, 47, 120, 12, 72, 9, 37, 9, 46, 90, 19, 17, 36, 84, 33, 95, 44, 35, 13, 54, 13, +18, 98, 72, -19, 1, 99, 88, 5, 113, 72, 43, 69, -2, -37, 78, 92, 57, 95, -115, 95, 9, 48, 3, 18, 53, +17, 35, 11, 6, 7, 83, 17, 22, 73, -113, -60, 0, 3, -1, -110, 4, 38, 0, 111, 5, 19, 0, 3, 0, 7, +0, 11, 0, -106, -71, 0, 5, -1, -16, -77, 29, 46, 52, 8, -72, -1, -8, 64, 83, 29, 46, 52, 2, 8, 29, +46, 52, 11, 9, 47, 10, 1, 15, 10, 1, 10, 8, 7, 5, 47, 6, 1, 15, 6, 1, 6, 48, 4, 64, 4, +80, 4, 3, 4, 8, 3, 1, 32, 0, 1, 0, 0, 1, 0, 2, 0, 8, 1, 28, 3, 8, 6, 4, 7, 5, +0, 2, 1, 3, 64, 3, 64, 29, 40, 52, 3, 5, 10, 8, 11, 31, 9, 63, 9, 95, 9, 127, 9, -97, 9, +5, 9, 0, 47, 93, -35, 57, 57, -42, -58, 43, 0, 26, 24, 16, -51, 57, 57, 16, -51, 57, 57, 1, 47, 95, +94, 93, -42, -51, 93, 113, 57, 57, 16, -44, 114, -51, 93, 113, 57, 57, 16, -51, 93, 113, 57, 57, 49, 48, 0, +43, 43, 1, 43, 19, 7, 39, 55, 39, 7, 39, 55, 23, 7, 39, 55, 111, 37, 76, 35, 14, 37, 76, 35, 62, +37, 76, 35, 4, -105, 69, 40, 69, 44, 69, 40, 69, -88, 69, 40, 69, 0, 0, 1, -2, 126, 4, 38, 1, -126, +6, 4, 0, 51, 1, 19, -75, 11, 32, 19, 25, 52, 8, -72, -1, -24, -77, 25, 33, 52, 7, -72, -1, -16, 64, +61, 25, 34, 52, 59, 11, 75, 11, 91, 11, 3, 15, 26, 31, 26, 47, 26, 3, 25, 5, 47, 47, 0, 46, 46, +38, 44, 28, 28, 27, 32, 27, 64, 18, 25, 52, 27, 25, 64, 6, 32, 32, 64, 26, 29, 52, 32, 64, 9, 18, +52, 32, 32, 12, 3, 35, 37, 38, 64, 39, 38, 38, -72, -1, -64, 64, 35, 14, 23, 52, 38, 38, 12, 44, 0, +64, 0, 64, 9, 13, 52, 0, 7, 16, 23, 16, 39, 16, 3, 17, 16, 12, 0, 17, 1, 19, 3, 17, 19, 64, +12, 38, -72, -1, -64, 64, 49, 8, 13, 52, 46, 47, 42, 33, 47, 38, 37, 38, 27, -128, 28, 1, 28, 33, 17, +-65, 16, -49, 16, -33, 16, 3, 0, 16, 16, 16, 2, 16, 38, 3, 33, 1, 6, 21, 31, 10, 63, 10, 95, 10, +127, 10, -97, 10, 5, 10, -72, 1, 87, -123, 0, 47, 93, -51, -44, -64, -35, 57, -34, -60, 93, 93, 50, 16, -60, +93, 57, 18, 57, 16, -58, 16, -60, 17, 57, 43, 1, 24, 47, 26, -35, -58, 95, 94, 93, 17, 57, 94, 93, 47, +43, 1, 26, 24, 16, -51, 18, 57, 47, 43, 1, 17, 51, 26, 24, 16, -51, 50, 50, 17, 57, 47, 43, 43, 1, +16, -64, 26, 24, -35, -58, 43, 1, 17, 18, 57, 25, 47, 17, 18, 57, 24, 47, 18, 57, 25, 47, 49, 48, 95, +94, 93, 113, 43, 43, 43, 1, 35, 34, 39, 6, 35, 35, 20, 7, 6, 35, 34, 53, 52, 55, 54, 55, 23, 6, +21, 20, 51, 50, 55, 54, 53, 52, 39, 55, 22, 23, 22, 21, 51, 50, 53, 52, 39, 55, 23, 22, 22, 51, 50, +53, 52, 39, 55, 22, 23, 22, 21, 1, -126, 38, 51, 43, 36, 65, 59, 104, 71, 104, -55, 38, 11, 25, 19, 55, +-94, 92, 72, 89, 57, 40, 23, 9, 12, 59, 81, 7, 19, 8, 7, 41, 35, 23, 44, 32, 22, 5, 11, 4, -8, +33, 33, 111, 59, 40, -110, 73, 94, 27, 52, 9, 113, 67, 120, 32, 39, 71, 85, 70, 98, 38, 31, 42, 74, 50, +24, 35, 29, 47, 43, 47, 25, 42, 49, 52, 36, 14, 31, 57, 0, 8, 0, 50, -2, 127, 8, -54, 7, 22, 0, +51, 0, 63, 0, 68, 0, 80, 0, 110, 0, 122, 0, 127, 0, -117, 0, -60, 64, 103, 89, 58, 41, 64, 46, 117, +105, 11, 123, 111, 109, 4, 6, 85, 52, 48, 63, 46, 1, 46, 46, 1, 15, 46, 31, 46, 2, 46, 81, 0, -115, +90, 69, 37, 68, 32, -128, 104, 15, 124, -122, 100, 22, 20, 94, 75, 30, 48, 32, 1, 33, 32, 1, 0, 32, 16, +32, 2, 32, 98, 26, 85, 61, 48, 87, 94, 78, 30, 92, 90, 68, 55, 41, 43, 72, 37, 35, 35, 39, 68, 66, +39, -125, 100, 22, 102, 114, 109, 4, 107, 105, 123, -119, 15, 17, 120, 11, 9, 9, 13, 123, 126, 13, 0, 47, -35, +-50, 17, 57, 47, 51, -51, -48, 50, -51, 16, -35, -35, 50, 50, -51, -48, 50, 50, -51, 47, -35, -50, 17, 57, 47, +51, -51, -48, 50, -51, 16, -35, -35, 50, -51, 51, -48, 50, -51, 51, 1, 47, -51, -44, 93, 93, 93, 50, -51, 51, +-48, 50, 50, -51, -36, 50, 50, -51, 16, -36, 50, -51, 51, 16, -42, -51, -44, 93, 93, 93, 50, -51, 51, -48, 50, +50, -51, -36, 50, 50, -51, 16, -36, 50, -51, 51, 49, 48, 1, 20, 7, 6, 7, 22, 21, 20, 6, 35, 34, 39, +6, 33, 32, 39, 6, 35, 34, 38, 53, 52, 55, 38, 39, 38, 53, 52, 55, 54, 55, 38, 53, 52, 54, 51, 50, +23, 54, 33, 32, 23, 54, 51, 50, 22, 21, 20, 7, 22, 23, 22, 1, 52, 38, 35, 34, 6, 21, 20, 22, 51, +50, 54, 39, 38, 35, 34, 7, 7, 52, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 1, 52, 39, 38, 39, 6, +35, 34, 39, 33, 6, 35, 34, 39, 6, 7, 6, 21, 16, 1, 54, 51, 50, 23, 33, 54, 51, 50, 23, 0, 1, +52, 38, 35, 34, 6, 21, 20, 22, 51, 50, 54, 39, 33, 22, 51, 50, 37, 52, 38, 35, 34, 6, 21, 20, 22, +51, 50, 54, 8, -54, 104, 100, -77, 3, 78, 55, 40, 33, -16, -2, -19, -2, -17, -16, 33, 40, 55, 78, 3, -77, +100, 104, 104, 100, -77, 3, 78, 55, 40, 33, -16, 1, 19, 1, 17, -16, 33, 40, 55, 78, 3, -77, 100, 104, -2, +78, 46, 32, 32, 47, 46, 33, 32, 46, -42, -44, -17, -15, -44, 57, 47, 32, 32, 46, 46, 32, 33, 46, 5, -37, +92, 88, -97, 29, 35, 56, 39, -4, 40, 39, 56, 35, 29, -97, 88, 92, 1, 83, 29, 35, 56, 39, 3, -40, 39, +56, 35, 29, 1, 83, -2, -68, 46, 32, 33, 46, 47, 32, 32, 46, -42, -4, 120, -44, -15, -17, -3, 19, 46, 33, +32, 46, 46, 32, 32, 47, 2, -53, -10, -36, -42, -102, 14, 15, 55, 77, 22, 127, 127, 22, 77, 55, 15, 14, -102, +-42, -36, -10, -10, -36, -43, -102, 14, 15, 55, 77, 22, 127, 127, 22, 77, 55, 15, 14, -102, -43, -36, 2, 103, 33, +46, 47, 32, 32, 46, 46, 51, 109, 109, 19, 32, 47, 46, 33, 32, 46, 46, -4, -62, -37, -58, -66, -117, 16, 41, +41, 16, -117, -66, -58, -37, -2, 63, -2, -40, 16, 41, 41, 16, 1, 40, -2, 100, 32, 46, 46, 32, 32, 47, 46, +14, 109, -128, 32, 46, 46, 32, 33, 46, 47, 0, 12, 0, 50, -2, -55, 8, 123, 7, 19, 0, 15, 0, 18, 0, +21, 0, 24, 0, 27, 0, 30, 0, 33, 0, 36, 0, 44, 0, 47, 0, 59, 0, 71, 1, 34, 64, 69, 12, 27, +28, 27, 44, 27, 3, 12, 24, 28, 24, 44, 24, 3, 39, 12, 1, 37, 1, 1, -55, 16, 1, -55, 26, 1, 20, +26, 36, 26, 2, -58, 22, 1, 27, 22, 43, 22, 2, -58, 21, 1, 8, 29, 1, 7, 35, 1, 9, 45, 16, 0, +1, 0, 15, 2, 47, 64, 25, 22, 44, 0, 44, 32, 44, 2, 16, 3, 44, -72, -1, -64, 64, 54, 7, 14, 52, +44, 48, 29, 4, 12, 35, 4, 60, 66, 32, 15, 8, 1, 17, 3, 8, 9, 6, 33, 64, 21, 17, 41, 41, 64, +7, 13, 52, 41, 54, 66, 35, 16, 12, 1, 12, 13, 10, 36, 64, 24, 20, 39, 0, 39, 32, 39, 2, 16, 3, +39, -72, -1, -64, 64, 51, 7, 14, 52, 39, 57, 45, 0, 32, 8, 4, 63, 69, 29, 15, 4, 1, 17, 3, 4, +5, 2, 30, 64, 25, 18, 43, 43, 64, 7, 13, 52, 43, 51, 0, 69, 1, 70, 32, 69, 1, 16, 69, 1, 48, +69, -96, 69, -32, 69, 3, 69, 0, 47, 93, 113, 114, 94, 93, -35, -50, 43, 0, 16, -64, -64, 26, 24, -35, -64, +-64, -51, 95, 94, 93, 50, 16, -34, 23, 57, -35, -50, 43, 0, 95, 94, 93, 16, -64, -64, 26, 24, -35, -64, -64, +-51, 93, 50, 1, 47, -35, -50, 43, 1, 16, -64, -64, 26, 24, -35, -64, -64, -51, 95, 94, 93, 50, 16, -34, 23, +57, -35, -50, 43, 1, 95, 94, 93, 16, -64, -64, 26, 24, -35, -64, -64, -51, 93, 50, 49, 48, 0, 94, 93, 93, +93, 93, 93, 93, 93, 93, 93, 1, 93, 93, 93, 1, 1, 17, 33, 1, 1, 33, 17, 1, 1, 17, 33, 1, 1, +33, 17, 1, 17, 33, 17, 33, 17, 33, 17, 33, 1, 17, 1, 5, 23, 55, 1, 7, 23, 1, 39, 7, 1, 1, +33, 1, 17, 1, 33, 1, 1, 39, 17, 37, 20, 6, 35, 34, 38, 53, 52, 54, 51, 50, 22, 7, 52, 38, 35, +34, 6, 21, 20, 22, 51, 50, 54, 8, 123, -2, -54, -2, 72, -2, -54, -2, -55, -2, 73, -2, -55, 1, 55, 1, +-73, 1, 55, 1, 54, 1, -72, -6, 111, 1, 33, -2, -33, 5, 70, -2, -34, 1, 34, -2, -34, -3, -78, -51, -52, +-4, 70, -51, -51, 3, -70, -52, -51, 3, 112, -2, 116, -3, -47, -2, 117, 1, -117, 2, 47, 1, -116, 1, 23, -52, +-3, -21, 127, 90, 90, -128, -128, 90, 90, 127, 75, 84, 59, 59, 83, 83, 59, 59, 84, 2, -18, -2, -55, -2, 73, +-2, -55, 1, 55, 1, -73, 1, 55, 1, 55, 1, -73, 1, 55, -2, -55, -2, 73, -3, 71, -2, -33, 5, 70, -2, +-33, 1, 33, -6, -70, 1, 33, -2, -33, 75, -51, -51, 3, -69, -51, -51, 3, -69, -51, -51, -2, 42, 1, -117, -2, +117, -3, -48, -2, 117, 1, -117, 1, 24, -51, -2, 102, -51, 90, -128, -128, 90, 90, 127, 127, 90, 59, 83, 83, 59, +59, 84, 84, 0, 1, -1, -75, 4, 38, 0, 75, 4, -68, 0, 11, 0, 26, 64, 15, 0, 6, 9, 31, 3, 63, +3, 95, 3, 127, 3, -97, 3, 5, 3, 0, 47, 93, -51, 1, 47, -51, 49, 48, 19, 20, 6, 35, 34, 38, 53, +52, 54, 51, 50, 22, 75, 44, 31, 31, 44, 44, 31, 31, 44, 4, 113, 31, 44, 44, 31, 31, 44, 44, 0, 1, +-1, -74, 4, 38, 0, 74, 4, -70, 0, 3, 0, 26, 64, 15, 3, 1, 3, 31, 1, 63, 1, 95, 1, 127, 1, +-97, 1, 5, 1, 0, 47, 93, -51, 1, 47, -51, 49, 48, 19, 35, 53, 51, 74, -108, -108, 4, 38, -108, 0, 1, +-2, -19, 4, 38, 1, 18, 5, 60, 0, 18, 0, 103, -71, 0, 17, -1, -38, 64, 38, 25, 36, 52, 3, 24, 58, +65, 52, 3, 24, 36, 39, 52, 3, 24, 21, 24, 52, 0, 17, 16, 17, 32, 17, 3, 14, 5, 17, 3, 9, 9, +0, 1, 9, 7, 11, 64, 11, -72, -1, -64, 64, 23, 27, 31, 52, 95, 11, 111, 11, 2, 11, 17, 3, 31, 1, +63, 1, 95, 1, 127, 1, -97, 1, 5, 1, 0, 47, 93, -35, -64, -51, 93, 43, 0, 26, 24, 16, -51, 50, 1, +47, -51, 57, 47, 57, 57, 95, 94, 93, 43, 43, 43, 43, 49, 48, 1, 33, 53, 33, 38, 39, 38, 35, 34, 7, +54, 51, 50, 23, 22, 23, 22, 23, 51, 1, 18, -3, -37, 1, -124, 99, 59, 38, 40, 27, 22, 34, 84, 48, 67, +29, 78, 58, 20, 28, 4, 38, 83, 78, 21, 13, 3, 86, 48, 21, 70, 52, 4, 0, 1, -1, 100, 4, 38, 0, +-99, 6, 81, 0, 31, 0, -64, -71, 0, 30, -1, -16, 64, 9, 36, 43, 52, 15, 32, 17, 22, 52, 5, -72, -1, +-8, 64, 25, 27, 32, 52, 26, 15, 42, 15, 2, 3, 0, 15, 1, 36, 5, 18, 8, 56, 62, 52, 18, 0, 24, +25, 64, 25, -72, -1, -64, 64, 31, 17, 22, 52, 25, 64, 9, 16, 52, 25, 25, 15, 0, 1, 9, 3, 0, 14, +9, 9, 11, 7, 3, 14, 25, 24, 24, 18, 27, 22, 64, 22, -72, -1, -64, 64, 9, 7, 16, 52, 22, 31, 18, +1, 64, 1, -72, -1, -64, 64, 27, 9, 12, 52, 96, 1, 112, 1, -128, 1, -64, 1, -48, 1, 5, 1, 31, 9, +63, 9, 95, 9, 127, 9, -97, 9, 5, 9, -72, 1, 42, -123, 0, 47, 93, -50, 93, 43, 0, 26, 24, 16, -35, +50, -50, 43, 0, 26, 24, 16, -51, 18, 57, 47, 51, 1, 47, -35, -44, -51, 57, 25, 47, 24, 16, -60, 95, 94, +93, 57, 47, 43, 43, 1, 26, 24, 16, -51, 17, 57, 43, 49, 48, 1, 95, 94, 93, 95, 93, 43, 43, 43, 19, +35, 34, 21, 20, 23, 22, 21, 20, 7, 38, 39, 39, 38, 53, 52, 55, 54, 55, 38, 39, 38, 35, 34, 7, 39, +54, 51, 50, 23, 22, 23, -99, 57, -43, 33, 11, 12, 2, 22, 34, 17, 104, 42, 84, 30, 7, 24, 25, 27, 31, +22, 37, 67, 51, 57, 16, 21, 5, -128, 68, 31, 108, 36, 31, 29, 43, 7, 72, 114, 60, 13, 111, 31, 12, 9, +31, 5, 19, 35, 13, 93, 73, 20, 33, 0, -1, -1, -2, 126, -2, -111, 1, -126, 0, 111, 3, 23, 6, 75, 0, +0, -6, 107, 0, 15, -74, 0, 10, 64, 67, 68, 52, 10, -72, 3, 6, 0, 63, 43, 53, 0, 0, 1, -1, -97, +4, 38, 0, 97, 4, 92, 0, 15, 0, 98, 64, 28, 5, 10, 2, 13, 4, 7, 15, 0, 64, 7, 8, 0, 2, +15, 15, 64, 37, 91, 52, 15, 13, 2, 8, 7, 10, 5, 64, 7, -72, -1, -64, 64, 23, 37, -88, 52, 7, 5, +5, 64, 37, 43, 52, 5, 31, 2, 63, 2, 95, 2, 127, 2, -97, 2, 5, 2, 0, 47, 93, -60, 43, 0, 24, +16, -58, 43, 0, 26, 24, 16, -51, 17, 57, 16, -35, -58, 43, 0, 17, 18, 57, 1, 24, 47, 25, -59, 26, 24, +-36, 25, -59, 17, 23, 57, 49, 48, 19, 6, 35, 34, 38, 35, 34, 7, 39, 54, 51, 50, 22, 51, 50, 55, 97, +31, 38, 20, 63, 12, 11, 14, 5, 22, 24, 11, 63, 18, 25, 25, 4, 73, 35, 23, 6, 6, 31, 23, 11, 0, +0, 2, 0, 0, 4, 38, 1, -115, 5, -25, 0, 25, 0, 31, 0, -87, 64, 11, 15, 24, 19, 23, 52, 14, 24, +29, 33, 52, 3, -72, -1, -42, -77, 24, 28, 52, 3, -72, -1, -42, 64, 31, 9, 12, 52, -110, 3, -94, 3, -78, +3, 3, -109, 2, -93, 2, -77, 2, 3, 3, 0, 2, 16, 2, 32, 2, 3, 9, 5, 19, 30, 64, 30, -72, -1, +-64, 64, 19, 20, 25, 52, 30, 64, 9, 11, 52, 30, 0, 17, 26, 0, 10, 9, 23, 28, 64, 28, -72, -1, -64, +64, 30, 13, 19, 52, 28, 26, 25, 17, 64, 17, 64, 12, 14, 52, 17, 4, 10, 9, 13, 31, 4, 63, 4, 95, +4, 127, 4, -97, 4, 5, 4, -72, 1, 87, -123, 0, 47, 93, -51, -35, -59, 16, -60, 43, 0, 26, 24, 16, -35, +-43, -58, 43, 0, 26, 24, 16, -51, 1, 47, 51, -44, -35, -59, 16, -60, 43, 43, 1, 26, 24, 16, -51, 49, 48, +95, 94, 93, 95, 113, 113, 43, 43, 43, 43, 1, 20, 7, 6, 35, 34, 39, 38, 39, 39, 55, 23, 22, 51, 50, +55, 54, 55, 34, 53, 52, 55, 54, 51, 50, 21, 7, 38, 35, 34, 21, 20, 1, -115, 58, 64, 85, 32, 33, 27, +36, 62, 8, 56, 30, 22, 102, 89, 19, 39, -124, 23, 26, 41, 74, 30, 18, 38, 33, 5, 24, 78, 78, 86, 7, +6, 12, 21, 17, 13, 7, 97, 21, 52, 97, 49, 42, 48, -103, 2, 79, 31, 48, 0, 1, -1, -3, 4, 38, 2, +-10, 5, -86, 0, 28, 0, -78, -71, 0, 21, -1, -16, 64, 108, 23, 27, 52, 15, 13, 1, 14, 6, 13, 15, 15, +8, 15, 18, 52, -97, 15, -65, 15, 2, 3, 11, 15, 1, 20, 15, 15, 0, 28, 25, 64, 4, 15, 23, 31, 23, +47, 23, 3, 21, 5, 21, 24, 10, 14, 52, 23, 21, 27, 17, 15, 8, 31, 8, 47, 8, 3, 21, 4, 8, 16, +10, 14, 52, 6, 8, 27, 11, 15, 64, 7, 14, 52, 15, 17, 11, 64, 11, 64, 15, 18, 52, 11, 64, 9, 13, +52, 80, 11, -96, 11, -80, 11, 3, 11, 27, 31, 1, 63, 1, 95, 1, 127, 1, -97, 1, 5, 1, -72, 1, 87, +-123, 0, 47, 93, -51, -60, 113, 43, 43, 0, 26, 24, 16, -35, -50, 43, 0, 17, 18, 57, 57, 43, 0, 95, 94, +93, 17, 18, 57, 57, 43, 0, 95, 94, 93, 1, 24, 47, 26, -51, -51, 50, 57, 25, 47, 94, 93, 95, 93, 43, +1, 17, 51, 49, 48, 1, 95, 94, 93, 43, 1, 33, 34, 38, 39, 38, 55, 54, 55, 54, 54, 51, 50, 21, 20, +7, 38, 35, 34, 7, 6, 7, 6, 7, 6, 21, 20, 51, 33, 2, -110, -3, -65, 55, 25, 1, 3, 44, 5, -102, +39, 94, 18, 43, 6, 29, 29, 25, 31, 16, 41, 49, 72, 57, 45, 2, -94, 4, 38, 15, 15, 85, 51, 6, 88, +22, 106, 84, 33, 25, 59, 36, 30, 41, 25, 37, 27, 12, 14, 0, 0, 1, -2, -126, 4, 38, 1, 123, 5, -86, +0, 28, 0, -78, -71, 0, 21, -1, -16, 64, 108, 23, 27, 52, 15, 13, 1, 14, 6, 13, 15, 15, 8, 15, 18, +52, -97, 15, -65, 15, 2, 3, 11, 15, 1, 20, 15, 15, 0, 28, 25, 64, 4, 15, 23, 31, 23, 47, 23, 3, +21, 5, 21, 24, 10, 14, 52, 23, 21, 27, 17, 15, 8, 31, 8, 47, 8, 3, 21, 4, 8, 16, 10, 14, 52, +6, 8, 27, 11, 15, 64, 7, 14, 52, 15, 17, 11, 64, 11, 64, 15, 18, 52, 11, 64, 9, 13, 52, 80, 11, +-96, 11, -80, 11, 3, 11, 27, 31, 1, 63, 1, 95, 1, 127, 1, -97, 1, 5, 1, -72, 1, 87, -123, 0, 47, +93, -51, -60, 113, 43, 43, 0, 26, 24, 16, -35, -50, 43, 0, 17, 18, 57, 57, 43, 0, 95, 94, 93, 17, 18, +57, 57, 43, 0, 95, 94, 93, 1, 24, 47, 26, -51, -51, 50, 57, 25, 47, 94, 93, 95, 93, 43, 1, 17, 51, +49, 48, 1, 95, 94, 93, 43, 1, 33, 34, 38, 39, 38, 55, 54, 55, 54, 54, 51, 50, 21, 20, 7, 38, 35, +34, 7, 6, 7, 6, 7, 6, 21, 20, 51, 33, 1, 23, -3, -65, 55, 25, 1, 3, 44, 5, -102, 39, 94, 18, +43, 6, 29, 29, 25, 31, 16, 41, 49, 72, 57, 45, 2, -94, 4, 38, 15, 15, 85, 51, 6, 88, 22, 106, 84, +33, 25, 59, 36, 30, 41, 25, 37, 27, 12, 14, 0, 0, 2, -1, 16, 4, 38, 0, -16, 6, -115, 0, 3, 0, +26, 0, -75, -71, 0, 5, -1, -24, 64, 79, 28, 34, 52, 7, 32, 17, 25, 52, 19, 22, 24, 27, 52, 22, 8, +25, 27, 52, 24, 24, 23, 26, 3, 1, 15, 2, 1, 46, 3, 2, 64, 0, 0, 13, 23, 23, 64, 21, 23, 52, +23, 21, 15, 26, 31, 26, 2, 9, 26, 8, 12, 0, 13, 1, 19, 3, 13, 15, 8, 2, 0, 3, 1, 64, 1, +64, 11, 14, 52, 1, 24, 13, 12, 12, 6, 23, 26, 24, 24, -72, -1, -64, 64, 19, 9, 14, 52, 24, 26, 4, +17, 31, 6, 63, 6, 95, 6, 127, 6, -97, 6, 5, 6, -72, 1, 87, -123, 0, 47, 93, -51, -44, -35, -51, 43, +0, 17, 18, 57, 18, 57, 24, 47, 51, 16, -58, 43, 0, 26, 24, 16, -51, 57, 57, 1, 47, -35, -42, 95, 94, +93, -51, 16, -44, 94, 93, -35, -58, 43, 1, 17, 18, 57, 24, 47, 26, -51, 95, 94, 93, 57, 57, 17, 18, 57, +25, 47, 49, 48, 1, 43, 43, 43, 43, 19, 7, 39, 55, 19, 20, 33, 34, 53, 52, 55, 54, 55, 23, 6, 21, +20, 51, 50, 55, 54, 53, 52, 39, 55, 22, 21, 64, 36, 77, 35, -2, -2, -23, -55, 37, 11, 25, 19, 54, -94, +85, 70, 91, 50, 40, 44, 6, 101, 69, 40, 69, -2, 107, -46, -110, 76, 91, 27, 52, 9, 111, 69, 120, 30, 39, +73, 95, 60, 97, 67, 117, 0, 0, 6, 0, 50, 0, 0, 4, -101, 6, -116, 0, 8, 0, 17, 0, 24, 0, 31, +0, 38, 0, 45, 0, -45, 64, 123, 32, 39, 39, 33, 31, 15, 17, 0, 6, 9, 16, 18, 32, 18, 48, 18, 3, +18, 25, 25, 19, 7, 0, 17, 1, 17, 65, 19, 81, 19, 2, 16, 19, 32, 19, 48, 19, 3, 19, 0, 31, 1, +31, 33, 45, 40, 37, 41, 41, 28, 36, 14, 12, 1, 4, 11, 31, 23, 47, 23, 63, 23, 3, 23, 27, 27, 22, +3, 15, 12, 1, 12, 31, 22, 63, 22, 79, 22, 3, 22, 94, 28, 1, 15, 28, 47, 28, 2, 28, 36, 42, 38, +26, 24, 10, 5, 40, 40, 38, 26, 5, 16, 10, 32, 10, 80, 10, 3, 10, 24, 26, 8, 2, 16, 13, 4, 1, +43, 35, 29, 21, 14, 1, -72, 1, 42, -123, 0, 47, -35, -42, -35, -42, -51, 17, 23, 57, 47, -35, -42, 93, -51, +16, -42, -51, 1, 25, 47, 50, 50, 50, 50, 50, -42, 24, -35, -42, 93, 93, -35, 93, -42, 93, -51, 17, 57, 47, +-35, 93, -42, -35, -64, 17, 57, 17, 18, 57, 47, -51, 25, 16, -42, 24, -35, -42, 93, -35, 93, 93, -42, 93, -51, +17, 57, 47, -35, 93, -42, -35, -64, 17, 57, 17, 18, 57, 47, -51, 49, 48, 33, 33, 19, 17, 3, 1, 1, 3, +17, 19, 1, 1, 23, 17, 7, 33, 39, 17, 55, 7, 17, 33, 17, 39, 9, 3, 23, 17, 33, 17, 55, 7, 17, +33, 17, 39, 55, 23, 39, 7, 23, 17, 51, 17, 4, -101, -5, -105, -28, -28, 2, 52, 2, 53, -28, -106, -2, 25, +-2, 26, -46, -96, 3, 105, -96, 104, -106, -2, 51, -106, 1, 124, 1, 52, -2, -52, -2, -51, 126, 1, 107, 37, 88, +-2, -5, 88, -38, -90, -90, -91, 74, -74, 1, 5, 2, 76, 1, 3, 2, 56, -3, -56, -2, -3, -3, -76, 3, 79, +1, -22, -2, 22, -19, -3, -120, -73, -73, 2, 120, -19, -85, -4, -38, 3, 38, -85, 1, 125, -2, -125, 1, 52, -2, +-52, -116, -4, -14, 3, 14, -116, 97, -3, 24, 2, -24, 97, -33, -33, -86, -86, 81, -3, 50, 2, -50, -1, -1, -1, +88, -2, -82, 0, -88, -1, -2, 1, 23, 6, 90, 0, 0, -6, -120, 0, 30, -78, 1, 0, 1, -72, -1, -64, 64, +14, 12, 16, 52, 31, 1, 1, 16, 1, -112, 1, -65, 1, 3, 1, 0, 47, 93, 113, 43, 53, 53, 0, 2, -1, +88, 4, 38, 0, -88, 5, 118, 0, 3, 0, 7, 0, 120, 64, 10, 3, 7, 5, 1, 4, 6, 4, 0, 64, 0, +-72, -1, -64, 64, 17, 34, 39, 52, 15, 0, 31, 0, 47, 0, 3, 13, 3, 0, 6, 2, 64, 2, -72, -1, -1, +64, 14, 22, 27, 52, 2, 0, 4, 2, 6, 4, 7, 5, 3, 64, 3, -72, -1, -64, 64, 24, 34, 39, 52, 79, +3, 95, 3, 111, 3, 3, 3, 7, 31, 1, 63, 1, 95, 1, 127, 1, -97, 1, 5, 1, 0, 47, 93, -51, -60, +93, 43, 0, 26, 24, 16, -51, 17, 23, 57, 1, 47, 43, 1, 26, 24, 16, -51, -60, 95, 94, 93, 43, 1, 26, +24, 16, -51, 17, 23, 57, 49, 48, 19, 7, 39, 55, 23, 39, 7, 23, -88, -88, -88, -88, 104, 104, 104, 104, 4, +-50, -88, -88, -88, -88, 104, 104, 104, 0, -1, -1, -1, 100, -2, -111, 0, -99, 0, -68, 3, 23, 6, 81, 0, 0, +-6, 107, 0, 20, 64, 10, 0, 9, 64, 67, 68, 52, -128, 9, 1, 9, -72, 3, 6, 0, 63, 93, 43, 53, -1, +-1, 0, 62, -1, 108, 6, -110, 5, -56, 2, 54, 3, -79, 0, 0, 0, 55, 5, 45, 4, -80, 0, 0, 1, 23, +5, 47, 3, -24, 5, 60, 0, 63, 64, 36, 4, 3, 2, 0, 85, 79, 35, 0, 65, 1, 0, 73, 71, 9, 0, +65, 4, 3, 2, 16, 84, 47, 84, 96, 84, -128, 84, 4, 84, 1, 72, 64, 11, 19, 52, 72, -72, -1, -64, -77, +9, 10, 52, 72, 0, 47, 43, 43, 53, 47, 93, 53, 53, 53, 1, 43, 53, 43, 53, 53, 53, 0, -1, -1, 0, +62, -1, 108, 6, -110, 5, -56, 2, 54, 3, -79, 0, 0, 0, 55, 5, 45, 4, -80, 0, 0, 1, 23, 5, 47, +3, -24, 5, 60, 0, 63, 64, 36, 4, 3, 2, 0, 85, 79, 35, 0, 65, 1, 0, 73, 71, 9, 0, 65, 4, +3, 2, 16, 84, 47, 84, 96, 84, -128, 84, 4, 84, 1, 72, 64, 11, 19, 52, 72, -72, -1, -64, -77, 9, 10, +52, 72, 0, 47, 43, 43, 53, 47, 93, 53, 53, 53, 1, 43, 53, 43, 53, 53, 53, 0, -1, -1, -1, -70, -1, +-95, 4, 63, 5, -56, 2, 54, 3, -77, 0, 0, 0, 55, 5, 45, 2, 88, 0, 0, 1, 23, 5, 47, 1, -112, +5, 60, 0, 63, 64, 36, 4, 3, 2, 0, 74, 68, 26, 0, 65, 1, 0, 60, 60, 54, 54, 65, 4, 3, 2, +16, 73, 47, 73, 96, 73, -128, 73, 4, 73, 1, 61, 64, 11, 19, 52, 61, -72, -1, -64, -77, 9, 10, 52, 61, +0, 47, 43, 43, 53, 47, 93, 53, 53, 53, 1, 43, 53, 43, 53, 53, 53, 0, -1, -1, -1, -70, -1, -95, 4, +63, 5, -56, 2, 54, 3, -77, 0, 0, 0, 55, 5, 45, 2, 88, 0, 0, 1, 23, 5, 47, 1, -112, 5, 60, +0, 63, 64, 36, 4, 3, 2, 0, 74, 68, 26, 0, 65, 1, 0, 60, 60, 54, 54, 65, 4, 3, 2, 16, 73, +47, 73, 96, 73, -128, 73, 4, 73, 1, 61, 64, 11, 19, 52, 61, -72, -1, -64, -77, 9, 10, 52, 61, 0, 47, +43, 43, 53, 47, 93, 53, 53, 53, 1, 43, 53, 43, 53, 53, 53, 0, -1, -1, 0, 62, -1, 108, 8, -55, 4, +-71, 2, 54, 3, -67, 0, 0, 1, 23, 5, 45, 5, 97, 0, 0, 0, 36, 64, 17, 3, -113, 69, 1, 0, 69, +67, 5, 4, 65, 3, 68, 64, 11, 21, 52, 68, -72, -1, -64, -77, 9, 10, 52, 68, 0, 47, 43, 43, 53, 1, +43, 93, 53, -1, -1, 0, 62, -1, 108, 8, -55, 4, -71, 2, 54, 3, -67, 0, 0, 1, 23, 5, 45, 5, 97, +0, 0, 0, 36, 64, 17, 3, -113, 69, 1, 0, 69, 67, 5, 4, 65, 3, 68, 64, 11, 21, 52, 68, -72, -1, +-64, -77, 9, 10, 52, 68, 0, 47, 43, 43, 53, 1, 43, 93, 53, -1, -1, -1, -70, -1, -95, 6, -59, 4, -71, +2, 54, 3, -65, 0, 0, 1, 23, 5, 45, 2, -8, 0, 0, 0, 32, 64, 14, 3, 0, 55, 53, 23, 4, 65, +3, 54, 64, 11, 21, 52, 54, -72, -1, -64, -77, 9, 10, 52, 54, 0, 47, 43, 43, 53, 1, 43, 53, -1, -1, +-1, -70, -1, -95, 6, -59, 4, -71, 2, 54, 3, -65, 0, 0, 1, 23, 5, 45, 2, -8, 0, 0, 0, 32, 64, +14, 3, 0, 55, 53, 23, 4, 65, 3, 54, 64, 11, 21, 52, 54, -72, -1, -64, -77, 9, 10, 52, 54, 0, 47, +43, 43, 53, 1, 43, 53, -1, -1, 0, 42, -2, 78, 4, 32, 5, -27, 2, 54, 3, -51, 0, 0, 1, 23, 5, +45, 1, -112, 0, 100, 0, 17, 64, 9, 2, 0, 62, 62, 50, 43, 65, 2, 61, 0, 47, 53, 1, 43, 53, 0, +-1, -1, 0, 54, -2, 78, 3, -29, 5, 29, 2, 54, 3, -50, 0, 0, 1, 23, 5, 45, 1, 64, 0, 40, 0, +49, -79, 2, 59, -72, -1, -64, -77, 28, 32, 52, 59, -72, -1, -64, 64, 22, 14, 17, 52, 16, 59, 1, 0, 59, +57, 50, 56, 65, 2, 96, 58, 1, 58, 64, 11, 21, 52, 58, 0, 47, 43, 113, 53, 1, 43, 93, 43, 43, 53, +0, -1, -1, -1, -70, -1, -95, 3, -61, 5, 29, 2, 54, 3, -49, 0, 0, 1, 23, 5, 45, 1, 44, 0, 0, +0, 32, 64, 14, 2, 0, 36, 36, 9, 4, 65, 2, 35, 64, 11, 21, 52, 35, -72, -1, -64, -77, 9, 10, 52, +35, 0, 47, 43, 43, 53, 1, 43, 53, -1, -1, -1, -70, -1, -95, 3, 39, 5, 29, 2, 54, 3, -48, 0, 0, +1, 23, 5, 45, 0, -106, 0, 0, 0, 32, 64, 14, 2, 15, 47, 45, 9, 9, 65, 2, 46, 64, 11, 21, 52, +46, -72, -1, -64, -77, 9, 10, 52, 46, 0, 47, 43, 43, 53, 1, 43, 53, 0, 3, 0, 121, -2, -40, 2, -24, +3, 51, 0, 36, 0, 40, 0, 44, 0, -53, 64, 37, 9, 11, 25, 11, 2, 6, 33, 22, 33, 2, 42, 44, 39, +64, 15, 37, 31, 37, 47, 37, 3, 16, 3, 37, 37, 13, 0, 35, 35, 24, 24, 1, 23, 23, 31, 1, 0, -72, +-1, -64, 64, 17, 9, 21, 52, 0, 1, 46, 2, 6, 18, 6, 2, 9, 3, 6, 5, 5, 31, -72, 2, -13, 64, +14, 64, 13, 23, 28, 19, 24, 64, 14, 21, 52, 24, 24, 35, 19, -72, 2, -17, -78, 28, 35, 0, -72, 2, -17, +-78, 1, 64, 1, -72, -1, -64, -75, 9, 13, 52, 1, 1, 35, -72, 2, -17, 64, 15, 10, 44, 39, 42, 32, 37, +48, 37, 64, 37, 3, 37, 6, 5, 10, -71, 2, -21, 1, 22, -123, 0, 63, -35, 57, -42, 93, -64, -35, -64, 16, +-19, 57, 47, 43, 0, 26, 24, 16, 77, -19, 16, -34, -19, 18, 57, 47, 43, 0, 17, 18, 57, 1, 24, 47, 26, +77, -19, 57, 47, 51, 95, 94, 93, 16, -42, -51, 43, 1, 17, 18, 57, 24, 47, 17, 57, 47, 57, 47, 17, 18, +57, 47, 95, 94, 93, 26, -51, -34, -51, 49, 48, 93, 93, 1, 7, 6, 7, 6, 7, 39, 54, 55, 54, 55, 39, +38, 53, 52, 55, 54, 55, 54, 51, 50, 23, 22, 23, 7, 38, 39, 38, 35, 34, 6, 21, 20, 23, 22, 23, 54, +3, 17, 35, 17, 51, 51, 17, 35, 2, -24, 48, -104, 98, 113, 93, 31, 13, 22, 19, 25, 116, 51, 40, 48, 62, +80, 81, 75, 49, 11, 40, 52, 37, 7, 61, 39, 48, 104, 60, 47, 95, -117, -64, 95, -70, 95, 95, 2, 25, -92, +38, 47, 54, 87, 17, 46, 39, 34, 27, 66, 34, 40, 32, 84, 100, 67, 86, 43, 9, 46, -125, 25, 5, 39, 54, +34, 41, 38, 29, 34, 67, -2, -127, -2, 103, 1, -103, -2, 103, 0, 0, 3, 0, 35, -2, 78, 2, -76, 2, -37, +0, 42, 0, 46, 0, 50, 0, -78, 64, 18, -119, 24, 1, 9, 20, 1, -121, 7, 1, 0, 23, 1, 9, 3, 23, +23, 0, 31, -72, 2, -6, 64, 9, 32, 32, 5, 0, 52, 48, 50, 64, 50, -72, -1, -64, 64, 18, 9, 13, 52, +0, 50, 1, 34, 3, 50, 44, 46, 64, 46, 64, 23, 32, 52, 46, -72, -1, -64, 64, 9, 9, 9, 52, 46, 9, +12, 12, 9, 5, -72, 2, -3, -76, 16, 18, 1, 18, 12, -72, 3, 6, 64, 9, 44, 49, 50, 43, 1, 32, 31, +23, 36, -72, 2, -17, -74, 15, 27, 31, 27, 2, 27, 23, -68, 2, -17, 0, 42, 2, -17, 0, 1, 2, -21, 0, +63, -19, -3, -34, 113, -19, 16, -50, 50, 16, -34, -64, -34, -64, 63, 1, 47, 93, -19, -51, 57, 25, 47, 24, 16, +-50, 43, 43, 1, 26, 24, 16, -35, -50, 95, 94, 93, 43, 1, 26, 24, 16, -51, 16, -64, 17, 57, 47, 77, -19, +17, 57, 47, 95, 94, 93, 49, 48, 93, 93, 93, 1, 35, 34, 7, 6, 21, 20, 22, 22, 21, 20, 6, 7, 38, +39, 38, 39, 38, 53, 52, 54, 55, 54, 55, 38, 39, 38, 35, 34, 7, 6, 7, 39, 54, 55, 54, 51, 50, 23, +22, 23, 22, 23, 1, 17, 35, 17, 33, 17, 35, 17, 2, -76, 119, -90, 124, -99, 45, 47, 11, 14, 26, 25, 48, +23, 36, 107, 111, 88, -79, 63, 15, 51, 52, 33, 30, 24, 34, 46, 30, 38, 63, 86, 62, 62, 51, 53, 26, 51, +-2, -28, 95, 1, 25, 95, 1, 37, 31, 39, 73, 66, -106, -102, 64, 38, 62, 50, 83, 83, -98, 81, -128, 26, -128, +-119, 33, 26, 18, 64, 12, 40, 20, 16, 39, 29, 75, 45, 74, 46, 38, 68, 33, 79, -2, -98, -2, 103, 1, -103, +-2, 103, 1, -103, 0, -1, -1, 0, 54, 1, 10, 2, 24, 3, 113, 2, 22, 3, 8, 0, 0, 0, 2, -1, -70, +-2, -15, 1, -12, 3, -90, 0, 12, 0, 27, 0, 96, 64, 30, -39, 18, 1, -116, 6, 1, 125, 6, 1, 90, 6, +106, 6, 2, 22, 23, 20, 13, 25, 25, 1, 0, 8, 8, 0, 31, 7, 1, 7, 3, -72, 3, 3, -77, 0, 29, +1, 7, -70, 2, -17, 0, 8, 3, 4, -77, 23, 16, 22, 3, -69, 2, -17, 0, 1, 2, -21, 1, 44, -123, 0, +63, -19, -34, -52, 51, 63, -19, 1, 47, 16, -48, -3, -50, 114, 17, 57, 25, 47, 17, 18, 57, 24, 47, -52, -51, +-50, 50, 49, 48, 93, 93, 93, 93, 1, 33, 53, 33, 52, 39, 38, 39, 55, 22, 23, 22, 21, 3, 20, 6, 35, +34, 39, 38, 53, 52, 55, 23, 6, 21, 20, 22, 1, -12, -3, -58, 1, -15, 28, 19, 75, 78, 72, 18, 27, -113, +54, 38, 56, 33, 27, -116, 22, 94, -116, 1, 37, -82, 117, 63, 44, 80, -93, 91, 51, 77, -78, -3, 48, 38, 50, +55, 47, 60, -111, 99, 35, 86, 56, 28, 45, 0, 0, 2, -1, -70, -2, 92, 2, -112, 2, -20, 0, 30, 0, 45, +0, -85, 64, 16, 11, 27, 1, 21, 13, 36, 29, 36, 45, 36, 3, 22, 4, 40, 41, 41, -72, -1, -32, 64, 22, +9, 17, 52, 41, 38, 0, 31, 16, 31, 2, 9, 3, 31, 43, 23, 13, 11, 20, 21, 9, 5, 11, -72, 3, 3, +64, 16, 25, 5, 23, 23, 16, 0, 47, 16, 25, 30, 7, 40, 64, 41, 40, 40, -72, -1, -64, 64, 24, 13, 17, +52, 0, 40, 16, 40, -32, 40, -16, 40, 4, 40, 34, 107, 13, 123, 13, 2, 13, 16, 21, 20, 18, -66, 2, -17, +0, 16, 0, 30, 2, -17, 0, 0, 0, 16, 1, 44, -123, 0, 47, -48, -19, 16, -3, -50, 50, 17, 57, 93, 47, +-52, 93, 43, 0, 17, 51, 26, 24, 16, -50, 17, 57, 1, 47, 16, -64, 17, 57, 47, -60, 57, 77, -19, 17, 57, +-42, -51, 17, 57, 16, -44, -52, 95, 94, 93, -51, -50, 43, 1, 17, 51, 49, 48, 95, 94, 93, 94, 93, 1, 35, +34, 7, 6, 7, 6, 35, 34, 39, 38, 39, 38, 55, 6, 35, 35, 53, 51, 50, 19, 23, 6, 21, 20, 23, 54, +55, 54, 51, 51, 3, 20, 6, 35, 34, 39, 38, 53, 52, 55, 23, 6, 21, 20, 22, 2, -112, 40, 104, 50, 63, +19, 17, 10, 39, 31, 27, 5, 4, 8, 80, -101, 90, 90, -48, 101, 52, 60, 22, 2, 50, 76, -111, 40, -79, 54, +38, 56, 33, 27, -116, 22, 94, -116, 1, 37, 36, 46, 94, 81, 107, 90, 91, 87, 46, -92, -82, 1, 25, 18, -81, +-104, 113, 60, 77, 65, 95, -4, -31, 38, 50, 55, 47, 60, -111, 99, 35, 86, 56, 28, 45, 0, 0, 2, 0, 47, +-1, 116, 1, -58, 0, 100, 0, 3, 0, 7, 0, 52, 64, 25, 7, 5, 6, 4, 3, 1, 0, 2, 2, 4, 6, +4, 112, 5, 1, 5, -97, 7, 1, 7, 7, 2, 0, 3, 1, 0, 47, -51, 57, 57, 50, 47, 113, -51, 114, 57, +57, 1, 47, 51, 47, -51, 57, 57, 16, -51, 57, 57, 49, 48, 37, 7, 39, 55, 7, 7, 39, 55, 1, -58, 54, +-112, 56, 67, 54, -112, 56, 56, 105, 44, 105, -121, 105, 44, 105, 0, 0, 3, 0, 59, -2, -53, 1, -49, -1, -40, +0, 3, 0, 7, 0, 11, 0, -33, 64, 52, 1, 3, 0, 2, 2, 64, 28, 32, 52, 15, 2, 1, 17, 3, 2, +0, 64, 0, 64, 72, 84, 52, 0, 64, 61, 69, 52, 0, 0, 6, 9, 11, 8, 10, 10, 64, 28, 32, 52, 15, +10, 1, 17, 3, 10, 8, 64, 7, 5, 6, 4, 4, -72, -1, -64, 64, 30, 28, 32, 52, 0, 4, 1, 17, 3, +4, 6, 64, 6, 64, 50, 69, 52, 6, 64, 24, 33, 52, 6, 6, 8, 10, 8, 9, 11, 64, 11, -72, -1, -64, +-77, 33, 38, 52, 11, -72, -1, -64, 64, 12, 18, 23, 52, 11, 11, 1, 4, 6, 5, 7, 64, 7, -72, -1, -64, +-77, 62, 69, 52, 7, -72, -1, -64, 64, 12, 18, 23, 52, -48, 7, 1, 7, 7, 2, 0, 3, 1, 0, 47, -51, +57, 57, 51, 47, 113, 43, 43, 0, 26, 24, 16, -51, 57, 57, 17, 51, 47, 43, 43, 0, 26, 24, 16, -51, 57, +57, 1, 47, 51, 47, 43, 43, 1, 26, 24, 16, -51, 95, 94, 93, 43, 1, 17, 18, 57, 57, 26, 24, 16, -51, +95, 94, 93, 43, 1, 17, 18, 57, 57, 17, 51, 24, 47, 43, 43, 1, 26, 24, 16, -51, 95, 94, 93, 43, 1, +17, 18, 57, 57, 49, 48, 5, 7, 39, 55, 5, 7, 39, 55, 7, 7, 39, 55, 1, 32, 57, -126, 54, 1, 52, +57, -126, 54, 84, 57, -126, 54, 76, 96, 36, 96, 85, 96, 36, 96, 124, 96, 36, 96, 0, 0, 3, 0, 18, -2, +-23, 1, -28, 0, 120, 0, 3, 0, 7, 0, 11, 1, 86, 64, 60, 11, 9, 10, 8, 10, 64, 13, 17, 52, -113, +10, -97, 10, 2, 126, 10, 1, 79, 10, 95, 10, 111, 10, 3, 10, 8, 64, 121, 7, -119, 7, -103, 7, 3, 106, +7, 1, 57, 7, 73, 7, 89, 7, 3, 42, 7, 1, 3, 15, 7, 31, 7, 2, 18, 5, 7, 5, 6, 4, 4, +-72, -1, -64, 64, 64, 13, 17, 52, 64, 4, 80, 4, 2, 49, 4, 1, 0, 4, 16, 4, 32, 4, 3, 22, 3, +4, 6, 64, 6, 64, 24, 27, 52, 6, 6, 8, -122, 1, -106, 1, 2, 101, 1, 117, 1, 2, 54, 1, 70, 1, +86, 1, 3, 37, 1, 1, 3, 0, 1, 16, 1, 2, 18, 5, 3, 1, 2, 0, 0, -72, -1, -64, 64, 67, 13, +17, 52, -112, 0, -96, 0, 2, -127, 0, 1, 80, 0, 96, 0, 112, 0, 3, 0, 2, 2, 8, 4, 6, 15, 5, +1, 5, 7, 7, 1, -106, 8, -90, 8, 2, 117, 8, -123, 8, 2, 70, 8, 86, 8, 102, 8, 3, 53, 8, 1, +22, 8, 38, 8, 2, 10, 8, 15, 9, 1, 17, 3, 9, 11, 64, 11, -72, -1, -64, 64, 21, 49, 55, 52, 11, +64, 34, 37, 52, 11, 11, 2, 0, 0, 3, 1, 17, 3, 3, 1, 64, 1, -72, -1, -64, -77, 9, 14, 52, 1, +0, 47, 43, 0, 26, 24, 16, -51, 95, 94, 93, 57, 57, 50, 47, 43, 43, 0, 26, 24, 16, -51, 95, 94, 93, +57, 57, 93, 93, 93, 93, 93, 17, 51, 47, -51, 93, 57, 57, 1, 47, 51, 47, -51, 93, 93, 93, 43, 1, 17, +18, 57, 57, 95, 94, 93, 95, 93, 93, 93, 93, 17, 51, 24, 47, 43, 1, 26, 24, 16, -51, 95, 94, 93, 93, +93, 43, 1, 17, 18, 57, 57, 95, 94, 93, 95, 93, 93, 93, 93, 26, 24, 16, -51, 93, 93, 93, 43, 1, 17, +18, 57, 57, 49, 48, 37, 7, 39, 55, 19, 7, 39, 55, 39, 7, 39, 55, 1, -28, 74, -92, 76, -128, 74, -92, +76, 32, 74, -92, 76, 56, 125, 64, 125, -2, -18, 125, 64, 125, 55, 125, 64, 125, 0, 2, 0, -79, -1, 124, 1, +75, 0, 70, 0, 3, 0, 7, 0, 124, 64, 49, 7, 5, 6, 4, 4, 64, 36, 55, 52, 4, 64, 6, 6, 3, +1, 2, 0, 0, 64, 36, 55, 52, 0, 2, 6, 4, 15, 5, 31, 5, 47, 5, 3, 33, 3, 5, 7, 64, 7, +64, 98, -112, 52, 7, 64, 77, 87, 52, 7, -72, -1, -64, -77, 72, 72, 52, 7, -72, -1, -64, 64, 16, 27, 35, +52, 7, 7, 2, 0, -128, 3, -112, 3, -96, 3, 3, 3, 1, 0, 47, -51, 113, 57, 57, 51, 47, 43, 43, 43, +43, 0, 26, 24, 16, -51, 95, 94, 93, 57, 57, 1, 47, -51, 43, 1, 17, 18, 57, 57, 50, 24, 47, 26, -51, +43, 1, 17, 18, 57, 57, 49, 48, 37, 7, 39, 55, 23, 7, 39, 55, 1, 49, 34, 94, 36, 118, 34, 94, 36, +46, 70, 24, 70, -124, 70, 24, 70, 0, 0, 3, 0, 109, -1, 112, 1, -108, 0, 55, 0, 3, 0, 7, 0, 11, +1, 14, 64, 22, 11, 9, 10, 8, 10, 64, 23, 25, 52, 10, 64, 38, 45, 52, 10, 8, 64, 7, 5, 6, 4, +4, -72, -1, -64, -77, 23, 25, 52, 4, -72, -1, -64, 64, 13, 38, 45, 52, 4, 64, 6, 6, 8, 3, 1, 2, +0, 0, -72, -1, -64, -77, 23, 25, 52, 0, -72, -1, -64, 64, 25, 38, 45, 52, 0, 2, 64, 2, 64, 46, 67, +52, 2, 64, 31, 43, 52, 2, 64, 18, 25, 52, 2, 2, 8, 8, -72, -1, -64, -77, 38, 67, 52, 8, -72, -1, +-64, 64, 17, 21, 25, 52, 8, 4, 6, 7, 5, 5, 64, 31, 35, 52, 5, 7, 64, 7, -72, -1, -64, -77, 46, +51, 52, 7, -72, -1, -64, 64, 35, 26, 35, 52, 15, 7, 1, 52, 3, 7, 7, 1, 10, 8, 9, 11, 9, 64, +31, 35, 52, 9, 11, 64, 11, 64, 21, 25, 52, 11, 11, 2, 0, 1, 3, 3, -72, -1, -64, -76, 31, 35, 52, +3, 1, 0, 47, -51, 43, 0, 17, 18, 57, 57, 51, 24, 47, 43, 0, 26, 24, 16, -51, 43, 0, 17, 18, 57, +57, 17, 51, 24, 47, 95, 94, 93, 43, 43, 0, 26, 24, 16, -51, 43, 0, 17, 18, 57, 57, 1, 24, 47, 43, +43, 1, 17, 51, 24, 47, 43, 43, 43, 1, 26, 24, 16, -51, 43, 43, 1, 17, 18, 57, 57, 17, 51, 24, 47, +26, -51, 43, 43, 1, 17, 18, 57, 57, 26, 24, 16, -51, 43, 43, 1, 17, 18, 57, 57, 49, 48, 37, 7, 39, +55, 23, 7, 39, 55, 39, 7, 39, 55, 1, -108, 34, 102, 34, 68, 34, 102, 34, 23, 34, 102, 34, 26, 70, 29, +70, -127, 70, 29, 70, 20, 70, 29, 70, 0, -1, -1, 0, 20, 1, 37, 6, 127, 6, -47, 2, 54, 3, 45, 0, +0, 1, 23, 6, 110, 3, 112, 6, -7, 0, 35, 64, 22, 3, 2, 1, 8, 55, 55, 7, 7, 65, 3, 2, 1, +63, 54, 79, 54, -128, 54, -65, 54, 4, 54, 0, 47, 93, 53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, +20, 1, 37, 7, 118, 6, -47, 2, 54, 3, 46, 0, 0, 1, 23, 6, 110, 3, 112, 6, -7, 0, 35, 64, 22, +3, 2, 1, 0, 80, 80, 29, 29, 65, 3, 2, 1, 63, 79, 79, 79, -128, 79, -65, 79, 4, 79, 0, 47, 93, +53, 53, 53, 1, 43, 53, 53, 53, 0, -1, -1, 0, -101, 0, -33, 1, 94, 4, 37, 2, 54, 2, -87, 0, 0, +1, 23, 2, -104, -1, -88, -2, -15, 0, 35, 64, 9, 1, 0, 14, 7, 2, 1, 65, 1, 4, -72, -1, -64, -77, +17, 18, 52, 4, -72, -1, -64, -77, 10, 11, 52, 4, 0, 47, 43, 43, 53, 1, 43, 53, 0, 0, 1, -2, -39, +4, -29, 1, 40, 5, -26, 0, 13, 0, 33, -68, 0, 1, 2, -97, 0, 0, 0, 7, 2, -97, -77, 8, 0, 8, +11, -71, 2, -97, 0, 4, 0, 47, -3, -34, -64, 1, 47, -19, -34, -19, 49, 48, 19, 51, 6, 6, 35, 34, 38, +39, 51, 22, 22, 51, 50, 54, -83, 123, 15, -103, 127, -128, -103, 15, 123, 14, 83, 70, 81, 83, 5, -26, 125, -122, +-123, 126, 68, 67, 65, 0, 1, 0, 0, 1, 31, 2, -68, 1, -121, 0, 3, 0, 16, -75, 3, 5, 0, 2, 100, +0, 0, 47, -19, 1, 47, 16, -64, 49, 48, 17, 53, 33, 21, 2, -68, 1, 31, 104, 104, -1, -1, 0, -101, 1, +31, 3, 87, 4, 37, 2, 54, 2, -67, 0, 0, 1, 23, 6, 118, 0, -101, 0, 0, 0, 64, -71, 0, 11, -1, +-64, -77, 14, 17, 52, 10, -72, -1, -64, 64, 26, 14, 17, 52, 80, 8, 80, 9, 2, 16, 8, 16, 9, -112, 8, +-112, 9, 4, 2, 0, 9, 10, 6, 1, 65, 2, 9, -72, -1, -64, -74, 11, 13, 52, 0, 9, 1, 9, 0, 47, +93, 43, 53, 1, 43, 53, 93, 113, 43, 43, -1, -1, -1, -11, 0, -94, 4, 14, 7, 30, 2, 54, 3, -5, 0, +0, 1, 22, 5, 53, 0, 0, 0, 75, 64, 14, 3, 45, 3, 46, 3, 47, 19, 45, 19, 46, 19, 47, 6, 48, +-72, -1, -40, -77, 12, 22, 52, 47, -72, -1, -40, -77, 12, 22, 52, 46, -72, -1, -40, -77, 12, 22, 52, 45, -72, +-1, -40, -77, 12, 22, 52, 44, -72, -1, -40, -77, 12, 22, 52, 2, -72, -1, -11, -76, 91, 91, 118, 118, 65, 1, +43, 53, 0, 43, 43, 43, 43, 43, 113, 0, -1, -1, -1, -11, 0, -14, 4, -50, 7, 30, 2, 54, 3, -4, 0, +0, 1, 22, 5, 53, 0, 0, 0, 48, 64, 11, 0, 32, 10, 48, 10, 80, 10, 96, 10, 4, 10, -72, -1, -64, +64, 10, 9, 26, 52, 10, 0, 47, 16, 1, 16, 2, -72, -1, -11, -76, 75, 75, 102, 102, 65, 1, 43, 53, 46, +93, 53, 0, 46, 43, 93, 53, -1, -1, 0, 83, -1, 36, 4, 14, 5, -53, 2, 54, 3, -5, 0, 0, 1, 23, +5, 53, 0, -56, -7, 44, 0, 72, -71, 0, 2, -1, -69, -74, 100, 100, 19, 19, 65, 2, 104, -72, -1, -64, -77, +18, 22, 52, 104, -72, -1, -128, -78, 31, 53, 104, -72, -1, -64, -78, 58, 53, 104, -72, -1, -64, 64, 19, 65, 66, +52, 64, 104, 1, 80, 104, -48, 104, 2, 48, 104, 64, 104, -16, 104, 3, 104, 0, 46, 93, 113, 114, 43, 43, 43, +43, 53, 1, 43, 53, -1, -1, 0, 74, -1, 36, 4, -50, 5, -34, 2, 54, 3, -4, 0, 0, 1, 23, 5, 53, +0, 100, -7, 44, 0, 70, 64, 9, 2, 15, 75, 75, 38, 38, 65, 2, 88, -72, -1, -64, -77, 18, 22, 52, 88, +-72, -1, -128, -78, 31, 53, 88, -72, -1, -64, -78, 58, 53, 88, -72, -1, -64, 64, 19, 65, 66, 52, 64, 88, 1, +80, 88, -48, 88, 2, 48, 88, 64, 88, -16, 88, 3, 88, 0, 46, 93, 113, 114, 43, 43, 43, 43, 53, 1, 43, +53, -1, -1, 0, 83, 0, -94, 4, 14, 6, 66, 2, 54, 3, -5, 0, 0, 1, 23, 5, 57, 1, 84, -1, 56, +0, 87, -74, -90, 50, -58, 50, 2, 2, 84, -72, -1, -64, -77, 33, 36, 52, 84, -72, -1, -64, 64, 28, 20, 21, +52, 0, 84, 32, 84, 64, 84, 3, 0, 84, 96, 84, 2, 32, 84, 48, 84, 64, 84, 112, 84, -128, 84, -112, 84, +6, -72, -1, -38, 64, 19, 84, 79, 50, 60, 65, -93, 62, -93, 63, -93, 64, 3, 2, 94, 64, 9, 22, 52, 94, +0, 46, 43, 53, 93, 1, 43, 93, 113, 114, 43, 43, 53, 93, 0, -1, -1, 0, 74, 0, -14, 4, -50, 6, 66, +2, 54, 3, -4, 0, 0, 1, 23, 5, 57, 1, -32, -1, 56, 0, 97, -74, 48, 8, 11, 17, 52, 2, 68, -72, +-1, -64, -77, 37, 40, 52, 68, -72, -1, -64, -77, 32, 34, 52, 68, -72, -1, -64, -77, 23, 27, 52, 68, -72, -1, +-64, 64, 10, 11, 19, 52, 112, 68, -128, 68, -112, 68, 3, -72, -1, -15, 64, 12, 68, 63, 21, 48, 65, -106, 21, +-90, 21, 2, 0, 10, -72, -1, -64, 64, 11, 11, 26, 52, 10, 2, 78, 64, 9, 72, 52, 78, 0, 46, 43, 53, +46, 43, 53, 93, 1, 43, 113, 43, 43, 43, 43, 53, 43, 0, -1, -1, 0, 83, 0, -94, 4, 28, 7, 32, 2, +54, 3, -5, 0, 0, 1, 23, 5, 54, 2, 48, 1, 99, 0, 98, -79, 2, 79, -72, -1, -64, 64, 16, 10, 12, +52, 80, 79, 96, 79, 2, 14, 79, 79, 0, 0, 65, 2, 81, -72, -1, -64, -77, 67, 69, 52, 81, -72, -1, -64, +-77, 61, 62, 52, 81, -72, -1, -64, -78, 59, 53, 81, -72, -1, -64, 64, 31, 9, 11, 52, 0, 81, 48, 81, -128, +81, -96, 81, 4, 16, 81, 112, 81, -128, 81, -112, 81, -49, 81, 5, 96, 81, 112, 81, -65, 81, 3, 81, 0, 47, +93, 113, 114, 43, 43, 43, 43, 53, 1, 43, 93, 43, 53, -1, -1, 0, 74, 0, -14, 4, -50, 7, 32, 2, 54, +3, -4, 0, 0, 1, 23, 5, 54, 2, 48, 1, 99, 0, 103, -79, 2, 66, -72, -1, -64, -78, 10, 15, 52, -72, +-1, -30, 64, 14, 66, 63, 48, 51, 65, 3, 49, 3, 50, 3, 51, 3, 2, 65, -72, -1, -64, -77, 67, 69, 52, +65, -72, -1, -64, -77, 61, 62, 52, 65, -72, -1, -64, -78, 59, 53, 65, -72, -1, -64, 64, 31, 9, 11, 52, 0, +65, 48, 65, -128, 65, -96, 65, 4, 16, 65, 112, 65, -128, 65, -112, 65, -49, 65, 5, 96, 65, 112, 65, -65, 65, +3, 65, 0, 47, 93, 113, 114, 43, 43, 43, 43, 53, 93, 1, 43, 43, 53, 0, -1, -1, 0, 83, 0, -94, 4, +14, 7, 33, 2, 54, 3, -5, 0, 0, 1, 23, 5, 45, 2, 78, 6, -102, 0, 113, -71, 0, 2, -1, -56, 64, +38, 81, 81, 60, 60, 65, 2, 16, 82, 112, 82, -96, 82, -80, 82, -64, 82, 5, 0, 82, 96, 82, 112, 82, 3, +47, 82, 63, 82, 111, 82, -80, 82, -32, 82, -16, 82, 6, 82, -72, -1, -64, -78, 88, 53, 82, -72, -1, -64, -78, +82, 53, 82, -72, -1, -64, -77, 74, 75, 52, 82, -72, -1, -64, -77, 68, 71, 52, 82, -72, -1, -64, -78, 65, 53, +82, -72, -1, -64, -78, 60, 53, 82, -72, -1, -64, -77, 91, -1, 52, 82, 0, 46, 43, 43, 43, 43, 43, 43, 43, +93, 113, 114, 53, 1, 43, 53, 0, -1, -1, 0, 74, 0, -14, 4, -50, 7, 33, 2, 54, 3, -4, 0, 0, 1, +23, 5, 45, 2, 78, 6, -102, 0, 114, 64, 43, 2, 111, 63, 1, 34, 63, 63, 51, 51, 65, 2, 16, 66, 112, +66, -96, 66, -80, 66, -64, 66, 5, 0, 66, 96, 66, 112, 66, 3, 47, 66, 63, 66, 111, 66, -80, 66, -32, 66, +-16, 66, 6, 66, -72, -1, -64, -78, 88, 53, 66, -72, -1, -64, -78, 82, 53, 66, -72, -1, -64, -77, 74, 75, 52, +66, -72, -1, -64, -77, 68, 71, 52, 66, -72, -1, -64, -78, 65, 53, 66, -72, -1, -64, -78, 60, 53, 66, -72, -1, +-64, -77, 91, -1, 52, 66, 0, 46, 43, 43, 43, 43, 43, 43, 43, 93, 113, 114, 53, 1, 43, 93, 53, -1, -1, +0, 83, 0, -94, 4, 14, 7, 33, 2, 54, 3, -5, 0, 0, 1, 23, 6, 110, 2, 48, 7, 73, 0, 111, 64, +14, 4, 3, 2, 16, 83, 63, 83, 80, 83, 96, 83, -96, 83, 5, -72, -1, -15, 64, 25, 83, 83, 0, 0, 65, +4, 3, 2, 95, 82, 111, 82, -32, 82, 3, 80, 82, 96, 82, 112, 82, -16, 82, 4, 82, -72, -1, -64, -77, 101, +-1, 52, 82, -72, -1, -64, -77, 88, 89, 52, 82, -72, -1, -64, -77, 70, 72, 52, 82, -72, -1, -64, -77, 60, 61, +52, 82, -72, -1, -64, 64, 9, 25, 28, 52, 82, 64, 18, 22, 52, 82, 0, 47, 43, 43, 43, 43, 43, 43, 93, +113, 53, 53, 53, 1, 43, 93, 53, 53, 53, 0, -1, -1, 0, 74, 0, -14, 4, -50, 7, 33, 2, 54, 3, -4, +0, 0, 1, 23, 6, 110, 2, 88, 7, 73, 0, 102, -75, 4, 3, 2, 15, 73, 1, -72, -1, -58, 64, 25, 73, +67, 48, 51, 65, 4, 3, 2, 95, 66, 111, 66, -32, 66, 3, 80, 66, 96, 66, 112, 66, -16, 66, 4, 66, -72, +-1, -64, -77, 101, -1, 52, 66, -72, -1, -64, -77, 88, 89, 52, 66, -72, -1, -64, -77, 70, 72, 52, 66, -72, -1, +-64, -77, 60, 61, 52, 66, -72, -1, -64, 64, 9, 25, 28, 52, 66, 64, 18, 22, 52, 66, 0, 47, 43, 43, 43, +43, 43, 43, 93, 113, 53, 53, 53, 1, 43, 93, 53, 53, 53, -1, -1, 0, 83, -2, -69, 4, 14, 5, -53, 2, +54, 3, -5, 0, 0, 1, 23, 6, 111, 1, -12, -1, -46, 0, 31, -77, 4, 3, 2, 79, -72, -1, -64, 64, 14, +15, 17, 52, 48, 79, 64, 79, 2, 126, 79, 79, 11, 11, 65, 1, 43, 93, 43, 53, 53, 53, 0, -1, -1, 0, +74, -2, -69, 4, -50, 5, -34, 2, 54, 3, -4, 0, 0, 1, 23, 6, 111, 2, -68, -1, -46, 0, 34, -78, 4, +3, 2, -72, -1, -46, 64, 14, 63, 63, 24, 24, 65, 4, 3, 2, 74, 64, 11, 17, 52, 74, 0, 46, 43, 53, +53, 53, 1, 43, 53, 53, 53, 0, 1, 0, 113, 1, 37, 3, -30, 5, -75, 0, 36, 0, -18, -75, 24, 32, 18, +25, 52, 32, -72, -1, -32, -77, 22, 33, 52, 18, -72, -1, -64, -77, 17, 21, 52, 18, -72, -1, -79, 64, 24, 12, +16, 52, 31, 9, 1, 3, 9, 9, 15, 23, 15, 29, 31, 29, 47, 29, 3, 13, 4, 29, 31, 32, 1, -72, -1, +-32, -74, 9, 31, 52, 1, 0, 3, 3, -72, -1, -64, 64, 17, 24, 27, 52, 3, 35, 15, 15, 31, 15, 2, 16, +3, 15, 31, 33, 33, 7, -72, 2, -5, -78, 11, 64, 11, -72, -1, -64, 64, 11, 12, 17, 52, 0, 11, 1, 19, +3, 11, 22, 17, -72, -1, -64, -77, 22, 64, 52, 17, -72, -1, -38, -77, 18, 21, 52, 17, -72, -1, -64, -75, 12, +17, 52, 17, 29, 23, -72, 2, -5, 64, 13, 64, 0, 22, 16, 22, 64, 22, 3, 17, 3, 22, 29, 1, -72, -1, +-32, -74, 9, 31, 52, 1, 0, 38, 29, 47, 16, -58, 50, 43, 1, 24, 16, -44, 95, 94, 93, 26, 77, -19, 18, +57, 43, 43, 43, 1, 24, 16, -58, 95, 94, 93, 43, 1, 26, 24, 16, 77, -19, 57, 25, 47, 0, 24, 47, -51, +95, 94, 93, -48, -51, 43, 0, 25, 16, -60, 50, 43, 0, 26, 25, 16, -51, 95, 94, 93, 24, 47, 18, 57, 47, +95, 93, 49, 48, 1, 43, 43, 43, 43, 1, 7, 38, 35, 34, 7, 6, 7, 6, 35, 34, 39, 38, 39, 38, 35, +34, 7, 18, 17, 20, 7, 7, 35, 2, 39, 38, 39, 38, 39, 54, 51, 50, 23, 54, 51, 50, 3, -30, 10, 63, +64, -100, 29, 1, 7, 7, 14, 12, 6, 11, 23, 37, 97, 31, 40, -84, 2, 2, 30, 75, 26, 51, 71, 64, 124, +-97, -56, 126, 40, 25, -107, 88, 5, 38, 16, 47, -44, 9, 92, 12, 14, 117, 43, 67, 20, -2, -4, -3, -2, 30, +71, 77, 1, 62, 90, -79, -127, 115, -100, -73, -123, -123, 0, 0, 1, 0, -83, 0, -36, 3, -79, 5, -75, 0, 28, +0, 107, 64, 11, 13, 16, 14, 20, 52, 14, 16, 17, 31, 52, 21, -72, -1, -24, 64, 16, 12, 17, 52, 2, 21, +1, 22, 4, 4, 64, 9, 12, 52, 4, 9, 25, -72, 2, -1, 64, 10, 64, 6, 8, 15, 0, 23, 1, 21, 5, +23, -72, -1, -64, -75, 12, 60, 52, 23, 9, 15, -72, 2, -5, -78, 16, 9, 4, -72, 2, -5, -78, 0, 30, 9, +47, 16, -42, -19, 16, -44, -19, 18, 57, 43, 1, 95, 94, 93, 0, 24, 47, 47, -42, 26, 77, -19, 50, -58, 43, +49, 48, 1, 95, 94, 93, 43, 43, 43, 1, 20, 6, 21, 7, 38, 35, 34, 7, 39, 54, 55, 54, 55, 54, 19, +51, 20, 22, 21, 20, 7, 6, 7, 54, 51, 50, 23, 22, 3, -79, 6, 36, 48, -66, -14, -73, 67, 122, 65, 72, +51, 26, 75, 30, 4, 48, 51, 82, 90, -120, -118, 46, 98, 1, -85, 33, -119, 33, 4, 114, 41, -50, -103, 109, -125, +-86, 90, 1, 53, 30, 118, 30, -88, -52, -33, -117, 13, 13, 31, 0, -1, -1, 0, 15, 0, -94, 4, 14, 7, 33, +2, 54, 3, -5, 0, 0, 1, 22, 5, 52, 0, 0, 0, 23, -76, 3, 2, 83, 3, 2, -72, -1, -68, -76, 92, +92, 42, 42, 65, 1, 43, 53, 53, 0, 47, 53, 53, 0, -1, -1, 0, 15, 0, -14, 4, -50, 7, 33, 2, 54, +3, -4, 0, 0, 1, 22, 5, 52, 0, 0, 0, 23, -76, 3, 2, 67, 3, 2, -72, -1, -105, -76, 76, 76, 16, +16, 65, 1, 43, 53, 53, 0, 47, 53, 53, 0, 0, 0, 0, 0, 0, 1, 0, 0, 21, 92, 0, 1, 3, -115, +12, 0, 0, 9, 9, 78, 0, 3, 0, 36, -1, -113, 0, 3, 0, 55, -1, -37, 0, 3, 0, 60, -1, -37, 0, +3, 1, -15, -1, -113, 0, 3, 1, -7, -1, -113, 0, 3, 1, -5, -1, -113, 0, 3, 2, 1, -1, -113, 0, 3, +2, 9, -1, -37, 0, 3, 2, 10, -1, -37, 0, 3, 2, 15, -1, -37, 0, 20, 0, 20, -1, 104, 0, 36, 0, +3, -1, -113, 0, 36, 0, 55, -1, 104, 0, 36, 0, 57, -1, 104, 0, 36, 0, 58, -1, -76, 0, 36, 0, 60, +-1, 104, 0, 36, 0, 89, -1, -37, 0, 36, 0, 90, -1, -37, 0, 36, 0, 92, -1, -37, 0, 36, 0, -74, -1, +104, 0, 41, 0, 15, -1, 29, 0, 41, 0, 17, -1, 29, 0, 41, 0, 36, -1, -113, 0, 47, 0, 3, -1, -76, +0, 47, 0, 55, -1, 104, 0, 47, 0, 57, -1, 104, 0, 47, 0, 58, -1, 104, 0, 47, 0, 60, -1, 104, 0, +47, 0, 92, -1, -76, 0, 47, 0, -74, -1, -113, 0, 51, 0, 3, -1, -37, 0, 51, 0, 15, -2, -8, 0, 51, +0, 17, -2, -8, 0, 51, 0, 36, -1, 104, 0, 53, 0, 55, -1, -37, 0, 53, 0, 57, -1, -37, 0, 53, 0, +58, -1, -37, 0, 53, 0, 60, -1, -37, 0, 55, 0, 3, -1, -37, 0, 55, 0, 15, -1, 29, 0, 55, 0, 16, +-1, -113, 0, 55, 0, 17, -1, 29, 0, 55, 0, 29, -1, 29, 0, 55, 0, 30, -1, 29, 0, 55, 0, 36, -1, +104, 0, 55, 0, 50, -1, -37, 0, 55, 0, 68, -1, 29, 0, 55, 0, 70, -1, 29, 0, 55, 0, 72, -1, 29, +0, 55, 0, 76, -1, -76, 0, 55, 0, 82, -1, 29, 0, 55, 0, 85, -1, -76, 0, 55, 0, 86, -1, 29, 0, +55, 0, 88, -1, -76, 0, 55, 0, 90, -1, -113, 0, 55, 0, 92, -1, -113, 0, 57, 0, 15, -1, 68, 0, 57, +0, 16, -1, -113, 0, 57, 0, 17, -1, 68, 0, 57, 0, 29, -1, -76, 0, 57, 0, 30, -1, -76, 0, 57, 0, +36, -1, 104, 0, 57, 0, 68, -1, 104, 0, 57, 0, 72, -1, -113, 0, 57, 0, 76, -1, -37, 0, 57, 0, 82, +-1, -113, 0, 57, 0, 85, -1, -76, 0, 57, 0, 88, -1, -76, 0, 57, 0, 92, -1, -76, 0, 58, 0, 15, -1, +-113, 0, 58, 0, 16, -1, -37, 0, 58, 0, 17, -1, -113, 0, 58, 0, 29, -1, -37, 0, 58, 0, 30, -1, -37, +0, 58, 0, 36, -1, -76, 0, 58, 0, 68, -1, -76, 0, 58, 0, 72, -1, -37, 0, 58, 0, 76, 0, 0, 0, +58, 0, 82, -1, -37, 0, 58, 0, 85, -1, -37, 0, 58, 0, 88, -1, -37, 0, 58, 0, 92, -1, -18, 0, 60, +0, 3, -1, -37, 0, 60, 0, 15, -2, -8, 0, 60, 0, 16, -1, 68, 0, 60, 0, 17, -2, -8, 0, 60, 0, +29, -1, -113, 0, 60, 0, 30, -1, 123, 0, 60, 0, 36, -1, 104, 0, 60, 0, 68, -1, 104, 0, 60, 0, 72, +-1, 68, 0, 60, 0, 76, -1, -76, 0, 60, 0, 82, -1, 68, 0, 60, 0, 83, -1, 104, 0, 60, 0, 84, -1, +68, 0, 60, 0, 88, -1, -113, 0, 60, 0, 89, -1, -113, 0, 73, 0, 73, -1, -37, 0, 73, 0, -74, 0, 37, +0, 85, 0, 15, -1, -113, 0, 85, 0, 17, -1, -113, 0, 85, 0, -74, 0, 76, 0, 89, 0, 15, -1, 104, 0, +89, 0, 17, -1, 104, 0, 90, 0, 15, -1, -113, 0, 90, 0, 17, -1, -113, 0, 92, 0, 15, -1, 104, 0, 92, +0, 17, -1, 104, 0, -75, 0, -75, -1, -37, 0, -74, 0, 3, -1, -76, 0, -74, 0, 86, -1, -37, 0, -74, 0, +-74, -1, -37, 0, -60, 2, 45, -1, 96, 0, -60, 2, 54, -1, 96, 0, -60, 2, 76, -1, 96, 0, -60, 2, 81, +-1, -68, 0, -60, 2, 84, -1, -68, 1, 43, 0, 15, -1, 31, 1, 43, 0, 17, -1, 31, 1, 43, 1, -8, 0, +-92, 1, 43, 1, -7, -1, 68, 1, 43, 1, -5, -1, 68, 1, 43, 2, 1, -1, 68, 1, 43, 2, 26, -1, -88, +1, 43, 2, 39, 0, 88, 1, 44, 1, -7, -1, -37, 1, 44, 1, -5, -1, -37, 1, 44, 2, 1, -1, -37, 1, +44, 2, 10, -1, -66, 1, 44, 2, 15, -1, -66, 1, 45, 1, -7, -1, -59, 1, 45, 2, 10, -1, -66, 1, 45, +2, 15, -1, -66, 1, 47, 1, 50, -1, -29, 1, 47, 2, 28, -1, -39, 1, 47, 2, 36, -1, -55, 1, 47, 2, +-116, -1, -29, 1, 50, 1, 46, -1, -29, 1, 50, 1, 47, -1, -29, 1, 50, 1, 49, -1, -29, 1, 50, 1, 51, +-1, -29, 1, 50, 2, 16, -1, -29, 1, 50, 2, 23, -1, -29, 1, 50, 2, 32, -1, -29, 1, 50, 2, 34, -1, +-29, 1, 50, 2, 38, -1, -29, 1, 50, 2, 43, -1, -29, 1, 51, 1, 50, -1, -29, 1, 51, 2, 28, -1, -39, +1, 51, 2, 36, -1, -55, 1, 51, 2, -116, -1, -29, 1, -15, 1, 44, -1, -43, 1, -15, 1, 45, -1, -59, 1, +-15, 2, 5, -1, -43, 1, -15, 2, 9, -1, 104, 1, -15, 2, 10, -1, 104, 1, -15, 2, 15, -1, 104, 1, -15, +2, 22, -1, -37, 1, -15, 2, 30, -1, -37, 1, -15, 2, 36, -1, -37, 1, -11, 2, 10, -1, -66, 1, -10, 1, +44, -1, -115, 1, -10, 1, 45, -1, -115, 1, -10, 1, 46, -1, 70, 1, -10, 1, 49, -1, 70, 1, -10, 1, 51, +-1, 70, 1, -10, 1, -8, 0, -86, 1, -10, 1, -7, -1, 104, 1, -10, 1, -5, -1, 104, 1, -10, 2, 1, -1, +104, 1, -10, 2, 5, -1, -115, 1, -10, 2, 13, -1, -98, 1, -10, 2, 18, -1, 104, 1, -10, 2, 19, -1, -76, +1, -10, 2, 24, -1, 104, 1, -10, 2, 26, -1, -76, 1, -10, 2, 27, -1, 104, 1, -10, 2, 29, -1, 104, 1, +-10, 2, 32, -1, 70, 1, -10, 2, 39, 0, 98, 1, -10, 2, 41, -1, 70, 1, -9, 2, 10, -1, -47, 1, -9, +2, 15, -1, -47, 1, -7, 0, 3, -1, -113, 1, -7, 0, -74, -1, 104, 1, -7, 1, 44, -1, -43, 1, -7, 1, +45, -1, -59, 1, -7, 2, 5, -1, -43, 1, -7, 2, 9, -1, 104, 1, -7, 2, 10, -1, 104, 1, -7, 2, 15, +-1, 104, 1, -7, 2, 22, -1, -37, 1, -7, 2, 30, -1, -37, 1, -7, 2, 36, -1, -37, 1, -5, 0, 3, -1, +-113, 1, -5, 1, 44, -1, -43, 1, -5, 2, 5, -1, -43, 1, -5, 2, 9, -1, -119, 1, -5, 2, 10, -1, 104, +1, -5, 2, 15, -1, 104, 2, 0, 1, 44, -1, -63, 2, 0, 1, 45, -1, -113, 2, 0, 1, 46, -1, -25, 2, +0, 1, 47, -1, -25, 2, 0, 1, 49, -1, -25, 2, 0, 1, 51, -1, -25, 2, 0, 2, 5, -1, -63, 2, 0, +2, 16, -1, -25, 2, 0, 2, 23, -1, -25, 2, 0, 2, 25, -1, -25, 2, 0, 2, 31, -1, -25, 2, 0, 2, +32, -1, -25, 2, 0, 2, 38, -1, -25, 2, 0, 2, 41, -1, -25, 2, 0, 2, 43, -1, -25, 2, 1, 0, 3, +-1, -113, 2, 1, 1, 44, -1, -43, 2, 1, 2, 5, -1, -43, 2, 1, 2, 9, -1, 104, 2, 1, 2, 10, -1, +104, 2, 1, 2, 15, -1, 104, 2, 5, 1, -7, -1, -37, 2, 5, 1, -5, -1, -43, 2, 5, 2, 1, -1, -37, +2, 5, 2, 10, -1, -66, 2, 5, 2, 15, -1, -66, 2, 7, 0, 3, -1, -37, 2, 7, 0, 15, -2, -6, 2, +7, 0, 17, -2, -6, 2, 7, 1, -7, -1, 104, 2, 7, 1, -5, -1, 104, 2, 7, 2, 1, -1, 104, 2, 8, +1, 50, -1, -98, 2, 8, 2, -116, -1, -98, 2, 9, 0, 3, -1, -37, 2, 9, 0, 15, -1, 31, 2, 9, 0, +17, -1, 31, 2, 9, 0, 29, -1, 31, 2, 9, 0, 30, -1, 31, 2, 9, 1, 44, -1, -37, 2, 9, 1, 45, +-1, -37, 2, 9, 1, 46, -1, 31, 2, 9, 1, 48, -1, 31, 2, 9, 1, 49, -1, 31, 2, 9, 1, 51, -1, +31, 2, 9, 1, -8, 0, -68, 2, 9, 1, -7, -1, 104, 2, 9, 1, -5, -1, 104, 2, 9, 2, 1, -1, 104, +2, 9, 2, 5, -1, -37, 2, 9, 2, 13, -1, -37, 2, 9, 2, 16, -1, 31, 2, 9, 2, 17, -1, 31, 2, +9, 2, 20, -1, 78, 2, 9, 2, 22, -1, 78, 2, 9, 2, 24, -1, 106, 2, 9, 2, 26, -1, -76, 2, 9, +2, 29, -1, 106, 2, 9, 2, 30, -1, -113, 2, 9, 2, 32, -1, 31, 2, 9, 2, 35, -1, 80, 2, 9, 2, +36, -1, -113, 2, 9, 2, 37, -1, 106, 2, 9, 2, 39, 0, -68, 2, 9, 2, 40, -1, 78, 2, 9, 2, 41, +-1, 31, 2, 9, 2, 42, -1, 78, 2, 10, 0, 3, -1, -37, 2, 10, 0, 15, -2, -6, 2, 10, 0, 16, -1, +70, 2, 10, 0, 17, -2, -6, 2, 10, 0, 29, -1, -113, 2, 10, 0, 30, -1, -113, 2, 10, 1, 44, -1, -115, +2, 10, 1, 45, -1, -115, 2, 10, 1, 46, -1, 70, 2, 10, 1, 49, -1, 70, 2, 10, 1, 51, -1, 70, 2, +10, 1, -8, 0, -68, 2, 10, 1, -7, -1, 104, 2, 10, 1, -5, -1, 104, 2, 10, 2, 1, -1, 104, 2, 10, +2, 5, -1, -115, 2, 10, 2, 13, -1, -98, 2, 10, 2, 18, -1, 104, 2, 10, 2, 19, -1, -76, 2, 10, 2, +22, -1, -98, 2, 10, 2, 24, -1, 104, 2, 10, 2, 26, -1, -76, 2, 10, 2, 27, -1, 104, 2, 10, 2, 29, +-1, 104, 2, 10, 2, 32, -1, 70, 2, 10, 2, 39, 0, 121, 2, 10, 2, 41, -1, 70, 2, 12, 1, 46, -1, +-78, 2, 12, 1, 47, -1, -78, 2, 12, 1, 49, -1, -78, 2, 12, 1, 51, -1, -78, 2, 12, 2, 16, -1, -78, +2, 12, 2, 25, -1, -39, 2, 12, 2, 32, -1, -78, 2, 12, 2, 38, -1, -78, 2, 12, 2, 41, -1, -78, 2, +12, 2, 43, -1, -78, 2, 13, 2, 10, -1, -47, 2, 13, 2, 15, -1, -47, 2, 15, 0, 3, -1, -37, 2, 15, +1, 44, -1, -115, 2, 15, 1, 45, -1, -115, 2, 15, 1, 46, -1, 70, 2, 15, 1, 49, -1, 70, 2, 15, 1, +51, -1, 70, 2, 15, 1, -8, 0, -86, 2, 15, 1, -7, -1, 104, 2, 15, 1, -5, -1, 104, 2, 15, 2, 1, +-1, 104, 2, 15, 2, 5, -1, -115, 2, 15, 2, 13, -1, -98, 2, 15, 2, 18, -1, 104, 2, 15, 2, 19, -1, +-76, 2, 15, 2, 24, -1, 104, 2, 15, 2, 26, -1, -76, 2, 15, 2, 27, -1, 104, 2, 15, 2, 29, -1, 104, +2, 15, 2, 32, -1, 70, 2, 15, 2, 39, 0, 98, 2, 15, 2, 41, -1, 70, 2, 23, 1, 46, -1, 119, 2, +23, 1, 47, -1, -76, 2, 23, 1, 49, -1, 119, 2, 23, 1, 50, -1, -86, 2, 23, 1, 51, -1, 119, 2, 23, +2, 16, -1, 119, 2, 23, 2, 18, -1, -37, 2, 23, 2, 22, -1, -86, 2, 23, 2, 24, -1, -37, 2, 23, 2, +25, -1, -98, 2, 23, 2, 26, -1, -37, 2, 23, 2, 27, -1, -37, 2, 23, 2, 30, -1, -86, 2, 23, 2, 32, +-1, 119, 2, 23, 2, 38, -1, 119, 2, 23, 2, 41, -1, 119, 2, 23, 2, 43, -1, 119, 2, 23, 2, -116, -1, +-86, 2, 25, 2, 28, -1, -39, 2, 27, 1, 46, -1, -25, 2, 27, 1, 47, -1, -25, 2, 27, 1, 49, -1, -25, +2, 27, 1, 51, -1, -25, 2, 27, 2, 16, -1, -25, 2, 27, 2, 23, -1, -25, 2, 27, 2, 25, -1, -25, 2, +27, 2, 31, -1, -25, 2, 27, 2, 32, -1, -25, 2, 27, 2, 34, -1, -25, 2, 27, 2, 38, -1, -25, 2, 27, +2, 41, -1, -25, 2, 27, 2, 43, -1, -25, 2, 28, 1, 46, -1, -31, 2, 28, 1, 47, -1, -31, 2, 28, 1, +49, -1, -31, 2, 28, 1, 51, -1, -37, 2, 28, 2, 16, -1, -31, 2, 28, 2, 31, -1, -31, 2, 28, 2, 32, +-1, -31, 2, 28, 2, 34, -1, -47, 2, 28, 2, 35, -1, -49, 2, 28, 2, 38, -1, -31, 2, 28, 2, 41, -1, +-31, 2, 28, 2, 42, -1, -49, 2, 28, 2, 43, -1, -31, 2, 31, 1, 46, -1, -55, 2, 31, 1, 47, -1, -55, +2, 31, 1, 49, -1, -55, 2, 31, 1, 51, -1, -55, 2, 31, 2, 16, -1, -55, 2, 31, 2, 23, -1, -55, 2, +31, 2, 31, -1, -55, 2, 31, 2, 32, -1, -55, 2, 31, 2, 34, -1, -55, 2, 31, 2, 41, -1, -55, 2, 32, +1, 50, -1, -29, 2, 32, 2, 28, -1, -39, 2, 32, 2, 36, -1, -55, 2, 32, 2, -116, -1, -29, 2, 33, 1, +50, -1, -29, 2, 33, 2, 28, -1, -39, 2, 33, 2, -116, -1, -29, 2, 36, 1, 46, -1, -55, 2, 36, 1, 47, +-1, -55, 2, 36, 1, 49, -1, -55, 2, 36, 1, 51, -1, -55, 2, 36, 2, 16, -1, -55, 2, 36, 2, 23, -1, +-55, 2, 36, 2, 32, -1, -55, 2, 36, 2, 34, -1, -55, 2, 36, 2, 38, -1, -55, 2, 36, 2, 41, -1, -55, +2, 36, 2, 43, -1, -55, 2, 38, 1, 50, -1, -29, 2, 38, 2, 28, -1, -39, 2, 38, 2, 36, -1, -55, 2, +38, 2, -116, -1, -29, 2, 41, 1, 50, -1, -29, 2, 41, 2, 28, -1, -39, 2, 41, 2, 36, -1, -55, 2, 41, +2, -116, -1, -29, 2, 43, 1, 50, -1, -29, 2, 43, 2, 28, -1, -39, 2, 43, 2, 36, -1, -55, 2, 43, 2, +-116, -1, -29, 2, 46, 0, 15, -1, 6, 2, 46, 0, 17, -1, 6, 2, 46, 0, -87, -1, 119, 2, 46, 0, -86, +-1, 119, 2, 46, 0, -78, -1, -45, 2, 52, 0, -74, -1, 96, 2, 53, 0, -74, -1, 119, 2, 58, 0, -74, -1, +-115, 2, 58, 2, 62, 0, 68, 2, 58, 2, 65, -1, -23, 2, 58, 2, 69, 0, 45, 2, 58, 2, 72, -1, -45, +2, 58, 2, 73, -1, -23, 2, 58, 2, 75, -1, -45, 2, 58, 2, 76, -1, 96, 2, 58, 2, 77, -1, -90, 2, +58, 2, 78, -1, -68, 2, 58, 2, 81, -1, 96, 2, 58, 2, 87, -1, -45, 2, 58, 2, 90, 0, 23, 2, 58, +2, 108, -1, -45, 2, 58, 2, 109, -1, -23, 2, 58, 2, 110, 0, 23, 2, 58, 2, 119, 0, 45, 2, 59, 2, +58, -1, -45, 2, 59, 2, 65, -1, -23, 2, 59, 2, 72, -1, -23, 2, 59, 2, 75, -1, -23, 2, 59, 2, 76, +-1, -92, 2, 59, 2, 77, -1, -47, 2, 59, 2, 78, -1, -23, 2, 59, 2, 79, -1, -45, 2, 59, 2, 81, -1, +-92, 2, 59, 2, 84, -1, -68, 2, 59, 2, 87, -1, -23, 2, 59, 2, 89, -1, -23, 2, 59, 2, 101, -1, -23, +2, 59, 2, 109, -1, -45, 2, 60, 2, 58, -1, -68, 2, 60, 2, 62, -1, -45, 2, 60, 2, 64, -1, -45, 2, +60, 2, 65, -1, -68, 2, 60, 2, 69, -1, -23, 2, 60, 2, 72, -1, -68, 2, 60, 2, 75, -1, -68, 2, 60, +2, 76, -1, 119, 2, 60, 2, 77, -1, -68, 2, 60, 2, 78, -1, -68, 2, 60, 2, 79, -1, -90, 2, 60, 2, +81, -1, -92, 2, 60, 2, 84, -1, -115, 2, 60, 2, 89, -1, -68, 2, 60, 2, 94, -1, -23, 2, 60, 2, 102, +-1, -23, 2, 60, 2, 108, -1, -68, 2, 60, 2, 109, -1, -23, 2, 60, 2, 111, -1, -23, 2, 60, 2, 113, -1, +-68, 2, 60, 2, 121, -1, -23, 2, 61, 0, 15, -1, 6, 2, 61, 0, 17, -1, 6, 2, 61, 0, -87, -1, 119, +2, 61, 0, -86, -1, 119, 2, 61, 0, -78, -1, -45, 2, 61, 2, 58, -1, 119, 2, 61, 2, 62, -1, 119, 2, +61, 2, 65, -1, -45, 2, 61, 2, 69, -1, -115, 2, 61, 2, 70, -1, -47, 2, 61, 2, 72, -1, -115, 2, 61, +2, 75, -1, -92, 2, 61, 2, 89, -1, -68, 2, 61, 2, 90, -1, -115, 2, 61, 2, 92, -1, -115, 2, 61, 2, +94, -1, 119, 2, 61, 2, 95, -1, 119, 2, 61, 2, 98, -1, -115, 2, 61, 2, 101, -1, -115, 2, 61, 2, 102, +-1, -115, 2, 61, 2, 103, -1, -115, 2, 61, 2, 104, -1, 119, 2, 61, 2, 106, -1, -115, 2, 61, 2, 109, -1, +119, 2, 61, 2, 117, -1, -115, 2, 61, 2, 118, -1, -115, 2, 61, 2, 120, -1, -115, 2, 61, 2, 121, -1, 119, +2, 62, 2, 77, 0, 23, 2, 62, 2, 78, -1, -45, 2, 62, 2, 81, -1, -70, 2, 62, 2, 97, 0, 68, 2, +62, 2, 104, 0, 23, 2, 62, 2, 109, 0, 45, 2, 63, 2, 65, -1, -45, 2, 63, 2, 107, -1, -23, 2, 64, +2, 65, -1, -23, 2, 64, 2, 72, -1, -45, 2, 64, 2, 75, -1, -23, 2, 64, 2, 76, 0, 23, 2, 64, 2, +77, 0, 45, 2, 64, 2, 84, 0, 45, 2, 64, 2, 90, 0, 23, 2, 64, 2, 95, -1, -25, 2, 64, 2, 104, +-1, -23, 2, 64, 2, 109, -1, -23, 2, 65, 2, 69, -1, -23, 2, 65, 2, 72, -1, -23, 2, 65, 2, 75, -1, +-23, 2, 65, 2, 76, -1, -45, 2, 65, 2, 77, -1, -23, 2, 65, 2, 78, -1, -23, 2, 65, 2, 81, -1, -45, +2, 65, 2, 89, -1, -23, 2, 68, 2, 65, -1, -23, 2, 68, 2, 72, -1, -23, 2, 68, 2, 75, -1, -23, 2, +68, 2, 77, 0, 23, 2, 68, 2, 78, -1, -70, 2, 69, 2, 78, -1, -23, 2, 69, 2, 91, 0, 23, 2, 69, +2, 109, 0, 23, 2, 70, 2, 78, -1, -23, 2, 70, 2, 81, -1, -23, 2, 70, 2, 90, 0, 23, 2, 70, 2, +95, 0, 23, 2, 70, 2, 104, 0, 23, 2, 70, 2, 107, 0, 23, 2, 70, 2, 109, 0, 23, 2, 70, 2, 113, +-1, -23, 2, 70, 2, 119, 0, 23, 2, 72, 2, 58, -1, -45, 2, 72, 2, 62, -1, -45, 2, 72, 2, 64, -1, +-45, 2, 72, 2, 69, -1, -23, 2, 72, 2, 77, -1, -45, 2, 72, 2, 79, -1, -92, 2, 72, 2, 81, -1, -45, +2, 72, 2, 89, -1, -45, 2, 72, 2, 94, -1, -45, 2, 72, 2, 101, -1, -23, 2, 72, 2, 111, -1, -23, 2, +74, 0, 15, -2, 125, 2, 74, 0, 17, -2, 125, 2, 74, 0, 29, -1, -45, 2, 74, 0, 30, -1, -45, 2, 74, +0, -86, -1, -115, 2, 74, 2, 58, -1, 119, 2, 74, 2, 62, -1, 119, 2, 74, 2, 64, -1, -23, 2, 74, 2, +65, -1, -45, 2, 74, 2, 69, -1, -115, 2, 74, 2, 70, -1, -23, 2, 74, 2, 72, -1, -45, 2, 74, 2, 75, +-1, -23, 2, 74, 2, 76, -1, -92, 2, 74, 2, 77, -1, -45, 2, 74, 2, 78, -1, -23, 2, 74, 2, 79, -1, +-92, 2, 74, 2, 89, -1, -45, 2, 74, 2, 90, -1, -68, 2, 74, 2, 94, -1, 96, 2, 74, 2, 95, -1, -90, +2, 74, 2, 104, -1, -90, 2, 74, 2, 119, -1, -45, 2, 74, 2, 121, -1, -68, 2, 75, 2, 58, -1, -45, 2, +75, 2, 62, -1, -45, 2, 75, 2, 65, -1, -23, 2, 75, 2, 69, -1, -68, 2, 75, 2, 70, -1, -23, 2, 75, +2, 72, -1, -45, 2, 75, 2, 76, -1, -68, 2, 75, 2, 77, -1, -68, 2, 75, 2, 79, -1, -115, 2, 75, 2, +81, -1, -68, 2, 75, 2, 84, -1, -70, 2, 75, 2, 87, -1, -23, 2, 75, 2, 90, 0, 23, 2, 75, 2, 96, +0, 45, 2, 75, 2, 113, -1, -23, 2, 76, 0, 15, -1, 29, 2, 76, 0, 17, -1, 29, 2, 76, 0, -87, -1, +-90, 2, 76, 0, -86, -1, -90, 2, 76, 0, -78, -1, -45, 2, 76, 2, 58, -1, -68, 2, 76, 2, 62, -1, -68, +2, 76, 2, 64, 0, 23, 2, 76, 2, 65, -1, -23, 2, 76, 2, 69, -1, -45, 2, 76, 2, 72, -1, -92, 2, +76, 2, 78, -1, -68, 2, 76, 2, 89, -1, -45, 2, 76, 2, 90, -1, -92, 2, 76, 2, 92, -1, -90, 2, 76, +2, 95, -1, -115, 2, 76, 2, 98, -1, -90, 2, 76, 2, 100, -1, -90, 2, 76, 2, 101, -1, -92, 2, 76, 2, +102, -1, -90, 2, 76, 2, 104, -1, 96, 2, 76, 2, 105, -1, -90, 2, 76, 2, 106, -1, -115, 2, 76, 2, 107, +-1, -115, 2, 76, 2, 109, -1, -115, 2, 76, 2, 111, -1, -90, 2, 76, 2, 115, -1, -90, 2, 76, 2, 117, -1, +-90, 2, 76, 2, 118, -1, -90, 2, 76, 2, 120, -1, -90, 2, 76, 2, 121, -1, -115, 2, 77, 0, 15, -2, -16, +2, 77, 0, 17, -2, -16, 2, 77, 0, 29, -1, -45, 2, 77, 0, 30, -1, -45, 2, 77, 0, -87, -1, -90, 2, +77, 0, -86, -1, -92, 2, 77, 0, -78, -1, -23, 2, 77, 2, 58, -1, 119, 2, 77, 2, 62, -1, -92, 2, 77, +2, 65, -1, -45, 2, 77, 2, 69, -1, -68, 2, 77, 2, 72, -1, -68, 2, 77, 2, 78, -1, -68, 2, 77, 2, +87, -1, -45, 2, 77, 2, 89, -1, -45, 2, 77, 2, 91, -1, -45, 2, 77, 2, 92, -1, -115, 2, 77, 2, 93, +-1, -92, 2, 77, 2, 94, -1, 96, 2, 77, 2, 95, -1, 119, 2, 77, 2, 96, -1, -68, 2, 77, 2, 97, -1, +-115, 2, 77, 2, 98, -1, -92, 2, 77, 2, 99, -1, -68, 2, 77, 2, 100, -1, -92, 2, 77, 2, 101, -1, 119, +2, 77, 2, 102, -1, -92, 2, 77, 2, 103, -1, -92, 2, 77, 2, 104, -1, 119, 2, 77, 2, 105, -1, -92, 2, +77, 2, 106, -1, -92, 2, 77, 2, 107, -1, 119, 2, 77, 2, 111, -1, -92, 2, 77, 2, 112, -1, -92, 2, 77, +2, 114, -1, -92, 2, 77, 2, 115, -1, -92, 2, 77, 2, 120, -1, -92, 2, 77, 2, 121, -1, 119, 2, 78, 2, +58, -1, -45, 2, 78, 2, 62, -1, -68, 2, 78, 2, 69, -1, -68, 2, 78, 2, 76, -1, -115, 2, 78, 2, 77, +-1, -92, 2, 78, 2, 81, -1, -45, 2, 78, 2, 89, -1, -70, 2, 78, 2, 101, -1, -68, 2, 79, 2, 65, -1, +-45, 2, 79, 2, 72, -1, -68, 2, 79, 2, 75, -1, -68, 2, 79, 2, 78, -1, -68, 2, 79, 2, 87, -1, -70, +2, 79, 2, 104, -1, -23, 2, 79, 2, 109, -1, -45, 2, 80, 2, 72, -1, -45, 2, 80, 2, 90, 0, 45, 2, +83, 2, 90, 0, 23, 2, 83, 2, 109, 0, 45, 2, 84, 0, -74, -1, 119, 2, 84, 2, 89, -1, -68, 2, 86, +0, -74, -1, 96, 2, 86, 2, 58, -1, -45, 2, 86, 2, 62, -1, -45, 2, 86, 2, 64, -1, -68, 2, 86, 2, +65, -1, -23, 2, 86, 2, 69, -1, -70, 2, 86, 2, 70, -1, -45, 2, 86, 2, 72, -1, -45, 2, 86, 2, 75, +-1, -45, 2, 86, 2, 76, -1, 51, 2, 86, 2, 79, -1, -92, 2, 86, 2, 81, -1, 96, 2, 86, 2, 87, -1, +-23, 2, 86, 2, 89, -1, -92, 2, 87, 2, 62, -1, -68, 2, 87, 2, 64, -1, -25, 2, 87, 2, 65, -1, -23, +2, 87, 2, 69, -1, -68, 2, 87, 2, 79, -1, -70, 2, 87, 2, 89, -1, -45, 2, 87, 2, 94, -1, -68, 2, +87, 2, 96, 0, 23, 2, 87, 2, 101, -1, -68, 2, 87, 2, 102, -1, -23, 2, 87, 2, 121, -1, -23, 2, 88, +2, 58, -1, -68, 2, 88, 2, 62, -1, -90, 2, 88, 2, 64, -1, -45, 2, 88, 2, 69, -1, -92, 2, 88, 2, +72, -1, -23, 2, 88, 2, 75, -1, -23, 2, 88, 2, 76, -1, -115, 2, 88, 2, 79, -1, -92, 2, 88, 2, 81, +-1, -68, 2, 88, 2, 94, -1, -92, 2, 88, 2, 101, -1, -92, 2, 88, 2, 102, -1, -23, 2, 90, 2, 97, -1, +-23, 2, 90, 2, 108, -1, -45, 2, 90, 2, 109, -1, -23, 2, 90, 2, 113, -1, -45, 2, 91, 2, 90, -1, -47, +2, 91, 2, 94, -1, -92, 2, 91, 2, 95, -1, -23, 2, 91, 2, 96, -1, -23, 2, 91, 2, 97, -1, -45, 2, +91, 2, 101, -1, -92, 2, 91, 2, 102, -1, -45, 2, 91, 2, 107, -1, -23, 2, 91, 2, 109, -1, -45, 2, 91, +2, 110, -1, -23, 2, 91, 2, 111, -1, -68, 2, 91, 2, 113, -1, -68, 2, 91, 2, 116, -1, -68, 2, 91, 2, +119, -1, -23, 2, 91, 2, 121, -1, -45, 2, 92, 2, 90, -1, -23, 2, 92, 2, 91, -1, -23, 2, 92, 2, 94, +-1, -23, 2, 92, 2, 95, -1, -23, 2, 92, 2, 96, -1, -23, 2, 92, 2, 97, -1, -23, 2, 92, 2, 101, -1, +-47, 2, 92, 2, 102, -1, -23, 2, 92, 2, 104, -1, -23, 2, 92, 2, 107, -1, -23, 2, 92, 2, 108, -1, -45, +2, 92, 2, 109, -1, -45, 2, 92, 2, 110, -1, -23, 2, 92, 2, 113, -1, -92, 2, 92, 2, 116, -1, -68, 2, +92, 2, 121, -1, -23, 2, 93, 0, 15, -1, 6, 2, 93, 0, 17, -1, 6, 2, 93, 2, 90, -1, -45, 2, 93, +2, 94, -1, -92, 2, 93, 2, 95, -1, -45, 2, 93, 2, 97, -1, -23, 2, 93, 2, 101, -1, -45, 2, 93, 2, +104, -1, -45, 2, 93, 2, 107, -1, -45, 2, 93, 2, 121, -1, -23, 2, 94, 2, 116, -1, -45, 2, 94, 2, 119, +0, 23, 2, 95, 2, 91, -1, -23, 2, 95, 2, 94, -1, -45, 2, 95, 2, 96, -1, -23, 2, 95, 2, 97, -1, +-45, 2, 95, 2, 101, -1, -68, 2, 95, 2, 108, -1, -68, 2, 95, 2, 109, -1, -23, 2, 95, 2, 111, -1, -45, +2, 95, 2, 113, -1, -68, 2, 96, 2, 91, 0, 23, 2, 96, 2, 109, 0, 23, 2, 96, 2, 113, -1, -23, 2, +96, 2, 116, 0, 45, 2, 97, 2, 91, -1, -23, 2, 97, 2, 94, -1, -45, 2, 97, 2, 95, -1, -23, 2, 97, +2, 97, -1, -23, 2, 97, 2, 101, -1, -23, 2, 97, 2, 104, -1, -23, 2, 97, 2, 107, -1, -23, 2, 97, 2, +109, -1, -23, 2, 97, 2, 110, -1, -23, 2, 97, 2, 113, -1, -68, 2, 97, 2, 116, -1, -45, 2, 100, 2, 90, +0, 45, 2, 100, 2, 91, 0, 45, 2, 100, 2, 95, 0, 23, 2, 100, 2, 97, 0, 23, 2, 100, 2, 101, 0, +23, 2, 100, 2, 104, 0, 23, 2, 100, 2, 107, 0, 23, 2, 100, 2, 108, 0, 23, 2, 100, 2, 109, 0, 23, +2, 100, 2, 119, 0, 23, 2, 101, 2, 104, 0, 23, 2, 101, 2, 113, -1, -45, 2, 102, 2, 91, -1, -23, 2, +102, 2, 97, -1, -23, 2, 102, 2, 109, 0, 23, 2, 104, 2, 94, -1, -45, 2, 104, 2, 96, -1, -23, 2, 104, +2, 97, -1, -23, 2, 104, 2, 101, -1, -45, 2, 104, 2, 108, -1, -45, 2, 104, 2, 109, -1, -23, 2, 104, 2, +111, -1, -23, 2, 104, 2, 113, -1, -45, 2, 106, 2, 94, -1, -47, 2, 106, 2, 97, -1, -23, 2, 106, 2, 101, +-1, -70, 2, 106, 2, 108, -1, -45, 2, 106, 2, 109, -1, -23, 2, 106, 2, 111, -1, -23, 2, 106, 2, 113, -1, +-45, 2, 106, 2, 121, -1, -23, 2, 107, 2, 96, 0, 23, 2, 107, 2, 104, 0, 23, 2, 107, 2, 113, -1, -23, +2, 107, 2, 119, 0, 23, 2, 108, 0, 15, -1, 29, 2, 108, 0, 17, -1, 29, 2, 108, 2, 90, -1, -23, 2, +108, 2, 94, -1, -68, 2, 108, 2, 95, -1, -23, 2, 108, 2, 96, 0, 68, 2, 108, 2, 101, -1, -45, 2, 108, +2, 104, -1, -23, 2, 108, 2, 107, -1, -23, 2, 108, 2, 109, 0, 23, 2, 109, 0, 15, -1, 51, 2, 109, 0, +17, -1, 51, 2, 109, 0, -86, 0, 23, 2, 109, 2, 90, -1, -23, 2, 109, 2, 91, 0, 23, 2, 109, 2, 94, +-1, -68, 2, 109, 2, 95, -1, -23, 2, 109, 2, 96, 0, 23, 2, 109, 2, 101, -1, -45, 2, 109, 2, 102, -1, +-23, 2, 109, 2, 104, -1, -25, 2, 109, 2, 106, -1, -23, 2, 109, 2, 107, -1, -23, 2, 109, 2, 110, -1, -23, +2, 109, 2, 119, -1, -23, 2, 109, 2, 121, -1, -23, 2, 110, 2, 91, -1, -23, 2, 110, 2, 94, -1, -45, 2, +110, 2, 101, -1, -45, 2, 110, 2, 108, -1, -45, 2, 110, 2, 109, -1, -23, 2, 110, 2, 113, -1, -45, 2, 110, +2, 121, -1, -23, 2, 111, 2, 90, -1, -23, 2, 111, 2, 91, -1, -23, 2, 111, 2, 95, -1, -23, 2, 111, 2, +97, -1, -23, 2, 111, 2, 104, -1, -23, 2, 111, 2, 107, -1, -23, 2, 111, 2, 108, -1, -23, 2, 111, 2, 110, +-1, -23, 2, 111, 2, 113, -1, -45, 2, 112, 2, 95, -1, -23, 2, 112, 2, 97, -1, -23, 2, 112, 2, 104, -1, +-23, 2, 112, 2, 107, -1, -23, 2, 115, 2, 95, -1, -23, 2, 115, 2, 104, -1, -23, 2, 115, 2, 109, 0, 23, +2, 118, 2, 108, -1, 96, 2, 118, 2, 113, -1, 119, 2, 119, 2, 94, -1, -45, 2, 119, 2, 95, 0, 23, 2, +119, 2, 97, -1, -23, 2, 119, 2, 101, -1, -45, 2, 119, 2, 104, 0, 23, 2, 119, 2, 108, -1, -45, 2, 119, +2, 111, -1, -23, 2, 119, 2, 121, -1, -23, 2, 120, 2, 94, -1, -45, 2, 120, 2, 96, -1, -23, 2, 120, 2, +101, -1, -45, 2, 120, 2, 102, -1, -23, 2, 120, 2, 108, -1, -45, 2, 120, 2, 111, -1, -23, 2, 120, 2, 113, +-1, -45, 2, -122, 0, 15, -1, 51, 2, -122, 0, 17, -1, 51, 2, -120, 0, 15, -1, 6, 2, -120, 0, 17, -1, +6, 2, -120, 0, 29, -1, -45, 2, -120, 0, 30, -1, -45, 2, -120, 0, -87, -1, 96, 2, -120, 0, -86, -1, 96, +2, -120, 0, -78, -1, -45, 2, -116, 1, 46, -1, -29, 2, -116, 1, 49, -1, -29, 2, -116, 1, 51, -1, -29, 2, +-116, 2, 16, -1, -29, 2, -116, 2, 23, -1, -29, 2, -116, 2, 32, -1, -29, 2, -116, 2, 34, -1, -29, 2, -116, +2, 38, -1, -29, 2, -116, 2, 43, -1, -29, 0, 0, 0, 70, 3, 78, 0, 0, 0, 3, 0, 0, 0, 0, 0, +-2, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 10, 1, 62, 0, 0, 0, 3, 0, 0, 0, 2, 0, 14, +5, -34, 0, 0, 0, 3, 0, 0, 0, 3, 0, 94, 5, -64, 0, 0, 0, 3, 0, 0, 0, 4, 0, 10, 1, +62, 0, 0, 0, 3, 0, 0, 0, 5, 0, 24, 5, -18, 0, 0, 0, 3, 0, 0, 0, 6, 0, 14, 6, 30, +0, 0, 0, 3, 0, 0, 0, 7, 0, -60, 6, 44, 0, 0, 0, 3, 0, 0, 0, 8, 0, 38, 7, 124, 0, +0, 0, 3, 0, 0, 0, 9, 0, -118, 13, -92, 0, 0, 0, 3, 0, 0, 0, 10, 4, -62, 0, -2, 0, 0, +0, 3, 0, 0, 0, 11, 0, 98, 14, 46, 0, 0, 0, 3, 0, 0, 0, 12, 0, 102, 14, -112, 0, 0, 0, +3, 0, 0, 0, 13, 6, -76, 6, -16, 0, 0, 0, 3, 0, 0, 0, 14, 0, 92, 14, -10, 0, 1, 0, 0, +0, 0, 0, 0, 0, 127, 15, 82, 0, 1, 0, 0, 0, 0, 0, 1, 0, 5, 15, -15, 0, 1, 0, 0, 0, +0, 0, 2, 0, 7, 18, 65, 0, 1, 0, 0, 0, 0, 0, 3, 0, 47, 18, 50, 0, 1, 0, 0, 0, 0, +0, 4, 0, 5, 15, -15, 0, 1, 0, 0, 0, 0, 0, 5, 0, 12, 18, 73, 0, 1, 0, 0, 0, 0, 0, +6, 0, 7, 18, 97, 0, 1, 0, 0, 0, 0, 0, 7, 0, 98, 18, 104, 0, 1, 0, 0, 0, 0, 0, 8, +0, 19, 19, 16, 0, 1, 0, 0, 0, 0, 0, 9, 0, 69, 22, 36, 0, 1, 0, 0, 0, 0, 0, 10, 2, +97, 15, -47, 0, 1, 0, 0, 0, 0, 0, 11, 0, 49, 22, 105, 0, 1, 0, 0, 0, 0, 0, 12, 0, 51, +22, -102, 0, 1, 0, 0, 0, 0, 0, 13, 3, 90, 18, -54, 0, 1, 0, 0, 0, 0, 0, 14, 0, 46, 22, +-51, 0, 3, 0, 1, 4, 3, 0, 2, 0, 12, 22, -5, 0, 3, 0, 1, 4, 5, 0, 2, 0, 16, 23, 11, +0, 3, 0, 1, 4, 6, 0, 2, 0, 12, 23, 27, 0, 3, 0, 1, 4, 7, 0, 2, 0, 16, 23, 39, 0, +3, 0, 1, 4, 8, 0, 2, 0, 16, 23, 55, 0, 3, 0, 1, 4, 9, 0, 0, 0, -2, 0, 0, 0, 3, +0, 1, 4, 9, 0, 1, 0, 10, 1, 62, 0, 3, 0, 1, 4, 9, 0, 2, 0, 14, 5, -34, 0, 3, 0, +1, 4, 9, 0, 3, 0, 94, 5, -64, 0, 3, 0, 1, 4, 9, 0, 4, 0, 10, 1, 62, 0, 3, 0, 1, +4, 9, 0, 5, 0, 24, 5, -18, 0, 3, 0, 1, 4, 9, 0, 6, 0, 14, 6, 30, 0, 3, 0, 1, 4, +9, 0, 7, 0, -60, 6, 44, 0, 3, 0, 1, 4, 9, 0, 8, 0, 38, 7, 124, 0, 3, 0, 1, 4, 9, +0, 9, 0, -118, 13, -92, 0, 3, 0, 1, 4, 9, 0, 10, 4, -62, 0, -2, 0, 3, 0, 1, 4, 9, 0, +11, 0, 98, 14, 46, 0, 3, 0, 1, 4, 9, 0, 12, 0, 102, 14, -112, 0, 3, 0, 1, 4, 9, 0, 13, +6, -76, 6, -16, 0, 3, 0, 1, 4, 9, 0, 14, 0, 92, 14, -10, 0, 3, 0, 1, 4, 10, 0, 2, 0, +12, 22, -5, 0, 3, 0, 1, 4, 11, 0, 2, 0, 16, 23, 71, 0, 3, 0, 1, 4, 12, 0, 2, 0, 12, +22, -5, 0, 3, 0, 1, 4, 14, 0, 2, 0, 12, 23, 87, 0, 3, 0, 1, 4, 16, 0, 2, 0, 14, 23, +103, 0, 3, 0, 1, 4, 19, 0, 2, 0, 18, 23, 117, 0, 3, 0, 1, 4, 20, 0, 2, 0, 12, 22, -5, +0, 3, 0, 1, 4, 21, 0, 2, 0, 16, 22, -5, 0, 3, 0, 1, 4, 22, 0, 2, 0, 12, 22, -5, 0, +3, 0, 1, 4, 25, 0, 2, 0, 14, 23, -121, 0, 3, 0, 1, 4, 27, 0, 2, 0, 16, 23, 87, 0, 3, +0, 1, 4, 29, 0, 2, 0, 12, 22, -5, 0, 3, 0, 1, 4, 31, 0, 2, 0, 12, 22, -5, 0, 3, 0, +1, 4, 36, 0, 2, 0, 14, 23, -107, 0, 3, 0, 1, 4, 42, 0, 2, 0, 14, 23, -93, 0, 3, 0, 1, +4, 45, 0, 2, 0, 14, 23, -79, 0, 3, 0, 1, 8, 10, 0, 2, 0, 12, 22, -5, 0, 3, 0, 1, 8, +22, 0, 2, 0, 12, 22, -5, 0, 3, 0, 1, 12, 10, 0, 2, 0, 12, 22, -5, 0, 3, 0, 1, 12, 12, +0, 2, 0, 12, 22, -5, 0, 84, 0, 121, 0, 112, 0, 101, 0, 102, 0, 97, 0, 99, 0, 101, 0, 32, 0, +-87, 0, 32, 0, 84, 0, 104, 0, 101, 0, 32, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, +0, 101, 0, 32, 0, 67, 0, 111, 0, 114, 0, 112, 0, 111, 0, 114, 0, 97, 0, 116, 0, 105, 0, 111, 0, +110, 0, 32, 0, 112, 0, 108, 0, 99, 0, 46, 0, 32, 0, 68, 0, 97, 0, 116, 0, 97, 0, 32, 0, -87, +0, 32, 0, 84, 0, 104, 0, 101, 0, 32, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, +101, 0, 32, 0, 67, 0, 111, 0, 114, 0, 112, 0, 111, 0, 114, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, +0, 32, 0, 112, 0, 108, 0, 99, 0, 47, 0, 84, 0, 121, 0, 112, 0, 101, 0, 32, 0, 83, 0, 111, 0, +108, 0, 117, 0, 116, 0, 105, 0, 111, 0, 110, 0, 115, 0, 32, 0, 73, 0, 110, 0, 99, 0, 46, 0, 32, +0, 49, 0, 57, 0, 57, 0, 48, 0, 45, 0, 49, 0, 57, 0, 57, 0, 50, 0, 46, 0, 32, 0, 65, 0, +108, 0, 108, 0, 32, 0, 82, 0, 105, 0, 103, 0, 104, 0, 116, 0, 115, 0, 32, 0, 82, 0, 101, 0, 115, +0, 101, 0, 114, 0, 118, 0, 101, 0, 100, 0, 67, 0, 111, 0, 110, 0, 116, 0, 101, 0, 109, 0, 112, 0, +111, 0, 114, 0, 97, 0, 114, 0, 121, 0, 32, 0, 115, 0, 97, 0, 110, 0, 115, 0, 32, 0, 115, 0, 101, +0, 114, 0, 105, 0, 102, 0, 32, 0, 100, 0, 101, 0, 115, 0, 105, 0, 103, 0, 110, 0, 44, 0, 32, 0, +65, 0, 114, 0, 105, 0, 97, 0, 108, 0, 32, 0, 99, 0, 111, 0, 110, 0, 116, 0, 97, 0, 105, 0, 110, +0, 115, 0, 32, 0, 109, 0, 111, 0, 114, 0, 101, 0, 32, 0, 104, 0, 117, 0, 109, 0, 97, 0, 110, 0, +105, 0, 115, 0, 116, 0, 32, 0, 99, 0, 104, 0, 97, 0, 114, 0, 97, 0, 99, 0, 116, 0, 101, 0, 114, +0, 105, 0, 115, 0, 116, 0, 105, 0, 99, 0, 115, 0, 32, 0, 116, 0, 104, 0, 97, 0, 110, 0, 32, 0, +109, 0, 97, 0, 110, 0, 121, 0, 32, 0, 111, 0, 102, 0, 32, 0, 105, 0, 116, 0, 115, 0, 32, 0, 112, +0, 114, 0, 101, 0, 100, 0, 101, 0, 99, 0, 101, 0, 115, 0, 115, 0, 111, 0, 114, 0, 115, 0, 32, 0, +97, 0, 110, 0, 100, 0, 32, 0, 97, 0, 115, 0, 32, 0, 115, 0, 117, 0, 99, 0, 104, 0, 32, 0, 105, +0, 115, 0, 32, 0, 109, 0, 111, 0, 114, 0, 101, 0, 32, 0, 105, 0, 110, 0, 32, 0, 116, 0, 117, 0, +110, 0, 101, 0, 32, 0, 119, 0, 105, 0, 116, 0, 104, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 109, +0, 111, 0, 111, 0, 100, 0, 32, 0, 111, 0, 102, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 108, 0, +97, 0, 115, 0, 116, 0, 32, 0, 100, 0, 101, 0, 99, 0, 97, 0, 100, 0, 101, 0, 115, 0, 32, 0, 111, +0, 102, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 116, 0, 119, 0, 101, 0, 110, 0, 116, 0, 105, 0, +101, 0, 116, 0, 104, 0, 32, 0, 99, 0, 101, 0, 110, 0, 116, 0, 117, 0, 114, 0, 121, 0, 46, 0, 32, +0, 32, 0, 84, 0, 104, 0, 101, 0, 32, 0, 111, 0, 118, 0, 101, 0, 114, 0, 97, 0, 108, 0, 108, 0, +32, 0, 116, 0, 114, 0, 101, 0, 97, 0, 116, 0, 109, 0, 101, 0, 110, 0, 116, 0, 32, 0, 111, 0, 102, +0, 32, 0, 99, 0, 117, 0, 114, 0, 118, 0, 101, 0, 115, 0, 32, 0, 105, 0, 115, 0, 32, 0, 115, 0, +111, 0, 102, 0, 116, 0, 101, 0, 114, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 102, 0, 117, 0, 108, +0, 108, 0, 101, 0, 114, 0, 32, 0, 116, 0, 104, 0, 97, 0, 110, 0, 32, 0, 105, 0, 110, 0, 32, 0, +109, 0, 111, 0, 115, 0, 116, 0, 32, 0, 105, 0, 110, 0, 100, 0, 117, 0, 115, 0, 116, 0, 114, 0, 105, +0, 97, 0, 108, 0, 32, 0, 115, 0, 116, 0, 121, 0, 108, 0, 101, 0, 32, 0, 115, 0, 97, 0, 110, 0, +115, 0, 32, 0, 115, 0, 101, 0, 114, 0, 105, 0, 102, 0, 32, 0, 102, 0, 97, 0, 99, 0, 101, 0, 115, +0, 46, 0, 32, 0, 32, 0, 84, 0, 101, 0, 114, 0, 109, 0, 105, 0, 110, 0, 97, 0, 108, 0, 32, 0, +115, 0, 116, 0, 114, 0, 111, 0, 107, 0, 101, 0, 115, 0, 32, 0, 97, 0, 114, 0, 101, 0, 32, 0, 99, +0, 117, 0, 116, 0, 32, 0, 111, 0, 110, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 100, 0, 105, 0, +97, 0, 103, 0, 111, 0, 110, 0, 97, 0, 108, 0, 32, 0, 119, 0, 104, 0, 105, 0, 99, 0, 104, 0, 32, +0, 104, 0, 101, 0, 108, 0, 112, 0, 115, 0, 32, 0, 116, 0, 111, 0, 32, 0, 103, 0, 105, 0, 118, 0, +101, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 102, 0, 97, 0, 99, 0, 101, 0, 32, 0, 97, 0, 32, +0, 108, 0, 101, 0, 115, 0, 115, 0, 32, 0, 109, 0, 101, 0, 99, 0, 104, 0, 97, 0, 110, 0, 105, 0, +99, 0, 97, 0, 108, 0, 32, 0, 97, 0, 112, 0, 112, 0, 101, 0, 97, 0, 114, 0, 97, 0, 110, 0, 99, +0, 101, 0, 46, 0, 32, 0, 32, 0, 65, 0, 114, 0, 105, 0, 97, 0, 108, 0, 32, 0, 105, 0, 115, 0, +32, 0, 97, 0, 110, 0, 32, 0, 101, 0, 120, 0, 116, 0, 114, 0, 101, 0, 109, 0, 101, 0, 108, 0, 121, +0, 32, 0, 118, 0, 101, 0, 114, 0, 115, 0, 97, 0, 116, 0, 105, 0, 108, 0, 101, 0, 32, 0, 102, 0, +97, 0, 109, 0, 105, 0, 108, 0, 121, 0, 32, 0, 111, 0, 102, 0, 32, 0, 116, 0, 121, 0, 112, 0, 101, +0, 102, 0, 97, 0, 99, 0, 101, 0, 115, 0, 32, 0, 119, 0, 104, 0, 105, 0, 99, 0, 104, 0, 32, 0, +99, 0, 97, 0, 110, 0, 32, 0, 98, 0, 101, 0, 32, 0, 117, 0, 115, 0, 101, 0, 100, 0, 32, 0, 119, +0, 105, 0, 116, 0, 104, 0, 32, 0, 101, 0, 113, 0, 117, 0, 97, 0, 108, 0, 32, 0, 115, 0, 117, 0, +99, 0, 99, 0, 101, 0, 115, 0, 115, 0, 32, 0, 102, 0, 111, 0, 114, 0, 32, 0, 116, 0, 101, 0, 120, +0, 116, 0, 32, 0, 115, 0, 101, 0, 116, 0, 116, 0, 105, 0, 110, 0, 103, 0, 32, 0, 105, 0, 110, 0, +32, 0, 114, 0, 101, 0, 112, 0, 111, 0, 114, 0, 116, 0, 115, 0, 44, 0, 32, 0, 112, 0, 114, 0, 101, +0, 115, 0, 101, 0, 110, 0, 116, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, 115, 0, 44, 0, 32, 0, +109, 0, 97, 0, 103, 0, 97, 0, 122, 0, 105, 0, 110, 0, 101, 0, 115, 0, 32, 0, 101, 0, 116, 0, 99, +0, 44, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 102, 0, 111, 0, 114, 0, 32, 0, 100, 0, 105, 0, +115, 0, 112, 0, 108, 0, 97, 0, 121, 0, 32, 0, 117, 0, 115, 0, 101, 0, 32, 0, 105, 0, 110, 0, 32, +0, 110, 0, 101, 0, 119, 0, 115, 0, 112, 0, 97, 0, 112, 0, 101, 0, 114, 0, 115, 0, 44, 0, 32, 0, +97, 0, 100, 0, 118, 0, 101, 0, 114, 0, 116, 0, 105, 0, 115, 0, 105, 0, 110, 0, 103, 0, 32, 0, 97, +0, 110, 0, 100, 0, 32, 0, 112, 0, 114, 0, 111, 0, 109, 0, 111, 0, 116, 0, 105, 0, 111, 0, 110, 0, +115, 0, 46, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 58, 0, 65, 0, 114, +0, 105, 0, 97, 0, 108, 0, 32, 0, 82, 0, 101, 0, 103, 0, 117, 0, 108, 0, 97, 0, 114, 0, 58, 0, +86, 0, 101, 0, 114, 0, 115, 0, 105, 0, 111, 0, 110, 0, 32, 0, 51, 0, 46, 0, 48, 0, 48, 0, 32, +0, 40, 0, 77, 0, 105, 0, 99, 0, 114, 0, 111, 0, 115, 0, 111, 0, 102, 0, 116, 0, 41, 0, 65, 0, +114, 0, 105, 0, 97, 0, 108, 0, 77, 0, 84, 0, 65, 0, 114, 0, 105, 0, 97, 0, 108, 0, -82, 0, 32, +0, 84, 0, 114, 0, 97, 0, 100, 0, 101, 0, 109, 0, 97, 0, 114, 0, 107, 0, 32, 0, 111, 0, 102, 0, +32, 0, 84, 0, 104, 0, 101, 0, 32, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, +0, 32, 0, 67, 0, 111, 0, 114, 0, 112, 0, 111, 0, 114, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, +32, 0, 112, 0, 108, 0, 99, 0, 32, 0, 114, 0, 101, 0, 103, 0, 105, 0, 115, 0, 116, 0, 101, 0, 114, +0, 101, 0, 100, 0, 32, 0, 105, 0, 110, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 85, 0, 83, 0, +32, 0, 80, 0, 97, 0, 116, 0, 32, 0, 38, 0, 32, 0, 84, 0, 77, 0, 32, 0, 79, 0, 102, 0, 102, +0, 46, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 101, 0, 108, 0, 115, 0, 101, 0, 119, 0, 104, 0, +101, 0, 114, 0, 101, 0, 46, 0, 78, 0, 79, 0, 84, 0, 73, 0, 70, 0, 73, 0, 67, 0, 65, 0, 84, +0, 73, 0, 79, 0, 78, 0, 32, 0, 79, 0, 70, 0, 32, 0, 76, 0, 73, 0, 67, 0, 69, 0, 78, 0, +83, 0, 69, 0, 32, 0, 65, 0, 71, 0, 82, 0, 69, 0, 69, 0, 77, 0, 69, 0, 78, 0, 84, 0, 13, +0, 10, 0, 13, 0, 10, 0, 84, 0, 104, 0, 105, 0, 115, 0, 32, 0, 116, 0, 121, 0, 112, 0, 101, 0, +102, 0, 97, 0, 99, 0, 101, 0, 32, 0, 105, 0, 115, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 112, +0, 114, 0, 111, 0, 112, 0, 101, 0, 114, 0, 116, 0, 121, 0, 32, 0, 111, 0, 102, 0, 32, 0, 77, 0, +111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 32, 0, 84, 0, 121, 0, 112, 0, 111, 0, 103, +0, 114, 0, 97, 0, 112, 0, 104, 0, 121, 0, 32, 0, 97, 0, 110, 0, 100, 0, 32, 0, 105, 0, 116, 0, +115, 0, 32, 0, 117, 0, 115, 0, 101, 0, 32, 0, 98, 0, 121, 0, 32, 0, 121, 0, 111, 0, 117, 0, 32, +0, 105, 0, 115, 0, 32, 0, 99, 0, 111, 0, 118, 0, 101, 0, 114, 0, 101, 0, 100, 0, 32, 0, 117, 0, +110, 0, 100, 0, 101, 0, 114, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 116, 0, 101, 0, 114, 0, 109, +0, 115, 0, 32, 0, 111, 0, 102, 0, 32, 0, 97, 0, 32, 0, 108, 0, 105, 0, 99, 0, 101, 0, 110, 0, +115, 0, 101, 0, 32, 0, 97, 0, 103, 0, 114, 0, 101, 0, 101, 0, 109, 0, 101, 0, 110, 0, 116, 0, 46, +0, 32, 0, 89, 0, 111, 0, 117, 0, 32, 0, 104, 0, 97, 0, 118, 0, 101, 0, 32, 0, 111, 0, 98, 0, +116, 0, 97, 0, 105, 0, 110, 0, 101, 0, 100, 0, 32, 0, 116, 0, 104, 0, 105, 0, 115, 0, 32, 0, 116, +0, 121, 0, 112, 0, 101, 0, 102, 0, 97, 0, 99, 0, 101, 0, 32, 0, 115, 0, 111, 0, 102, 0, 116, 0, +119, 0, 97, 0, 114, 0, 101, 0, 32, 0, 101, 0, 105, 0, 116, 0, 104, 0, 101, 0, 114, 0, 32, 0, 100, +0, 105, 0, 114, 0, 101, 0, 99, 0, 116, 0, 108, 0, 121, 0, 32, 0, 102, 0, 114, 0, 111, 0, 109, 0, +32, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 32, 0, 111, 0, 114, 0, 32, +0, 116, 0, 111, 0, 103, 0, 101, 0, 116, 0, 104, 0, 101, 0, 114, 0, 32, 0, 119, 0, 105, 0, 116, 0, +104, 0, 32, 0, 115, 0, 111, 0, 102, 0, 116, 0, 119, 0, 97, 0, 114, 0, 101, 0, 32, 0, 100, 0, 105, +0, 115, 0, 116, 0, 114, 0, 105, 0, 98, 0, 117, 0, 116, 0, 101, 0, 100, 0, 32, 0, 98, 0, 121, 0, +32, 0, 111, 0, 110, 0, 101, 0, 32, 0, 111, 0, 102, 0, 32, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, +0, 121, 0, 112, 0, 101, 0, 39, 0, 115, 0, 32, 0, 108, 0, 105, 0, 99, 0, 101, 0, 110, 0, 115, 0, +101, 0, 101, 0, 115, 0, 46, 0, 13, 0, 10, 0, 13, 0, 10, 0, 84, 0, 104, 0, 105, 0, 115, 0, 32, +0, 115, 0, 111, 0, 102, 0, 116, 0, 119, 0, 97, 0, 114, 0, 101, 0, 32, 0, 105, 0, 115, 0, 32, 0, +97, 0, 32, 0, 118, 0, 97, 0, 108, 0, 117, 0, 97, 0, 98, 0, 108, 0, 101, 0, 32, 0, 97, 0, 115, +0, 115, 0, 101, 0, 116, 0, 32, 0, 111, 0, 102, 0, 32, 0, 77, 0, 111, 0, 110, 0, 111, 0, 116, 0, +121, 0, 112, 0, 101, 0, 46, 0, 32, 0, 85, 0, 110, 0, 108, 0, 101, 0, 115, 0, 115, 0, 32, 0, 121, +0, 111, 0, 117, 0, 32, 0, 104, 0, 97, 0, 118, 0, 101, 0, 32, 0, 101, 0, 110, 0, 116, 0, 101, 0, +114, 0, 101, 0, 100, 0, 32, 0, 105, 0, 110, 0, 116, 0, 111, 0, 32, 0, 97, 0, 32, 0, 115, 0, 112, +0, 101, 0, 99, 0, 105, 0, 102, 0, 105, 0, 99, 0, 32, 0, 108, 0, 105, 0, 99, 0, 101, 0, 110, 0, +115, 0, 101, 0, 32, 0, 97, 0, 103, 0, 114, 0, 101, 0, 101, 0, 109, 0, 101, 0, 110, 0, 116, 0, 32, +0, 103, 0, 114, 0, 97, 0, 110, 0, 116, 0, 105, 0, 110, 0, 103, 0, 32, 0, 121, 0, 111, 0, 117, 0, +32, 0, 97, 0, 100, 0, 100, 0, 105, 0, 116, 0, 105, 0, 111, 0, 110, 0, 97, 0, 108, 0, 32, 0, 114, +0, 105, 0, 103, 0, 104, 0, 116, 0, 115, 0, 44, 0, 32, 0, 121, 0, 111, 0, 117, 0, 114, 0, 32, 0, +117, 0, 115, 0, 101, 0, 32, 0, 111, 0, 102, 0, 32, 0, 116, 0, 104, 0, 105, 0, 115, 0, 32, 0, 115, +0, 111, 0, 102, 0, 116, 0, 119, 0, 97, 0, 114, 0, 101, 0, 32, 0, 105, 0, 115, 0, 32, 0, 108, 0, +105, 0, 109, 0, 105, 0, 116, 0, 101, 0, 100, 0, 32, 0, 116, 0, 111, 0, 32, 0, 121, 0, 111, 0, 117, +0, 114, 0, 32, 0, 119, 0, 111, 0, 114, 0, 107, 0, 115, 0, 116, 0, 97, 0, 116, 0, 105, 0, 111, 0, +110, 0, 32, 0, 102, 0, 111, 0, 114, 0, 32, 0, 121, 0, 111, 0, 117, 0, 114, 0, 32, 0, 111, 0, 119, +0, 110, 0, 32, 0, 112, 0, 117, 0, 98, 0, 108, 0, 105, 0, 115, 0, 104, 0, 105, 0, 110, 0, 103, 0, +32, 0, 117, 0, 115, 0, 101, 0, 46, 0, 32, 0, 89, 0, 111, 0, 117, 0, 32, 0, 109, 0, 97, 0, 121, +0, 32, 0, 110, 0, 111, 0, 116, 0, 32, 0, 99, 0, 111, 0, 112, 0, 121, 0, 32, 0, 111, 0, 114, 0, +32, 0, 100, 0, 105, 0, 115, 0, 116, 0, 114, 0, 105, 0, 98, 0, 117, 0, 116, 0, 101, 0, 32, 0, 116, +0, 104, 0, 105, 0, 115, 0, 32, 0, 115, 0, 111, 0, 102, 0, 116, 0, 119, 0, 97, 0, 114, 0, 101, 0, +46, 0, 13, 0, 10, 0, 13, 0, 10, 0, 73, 0, 102, 0, 32, 0, 121, 0, 111, 0, 117, 0, 32, 0, 104, +0, 97, 0, 118, 0, 101, 0, 32, 0, 97, 0, 110, 0, 121, 0, 32, 0, 113, 0, 117, 0, 101, 0, 115, 0, +116, 0, 105, 0, 111, 0, 110, 0, 32, 0, 99, 0, 111, 0, 110, 0, 99, 0, 101, 0, 114, 0, 110, 0, 105, +0, 110, 0, 103, 0, 32, 0, 121, 0, 111, 0, 117, 0, 114, 0, 32, 0, 114, 0, 105, 0, 103, 0, 104, 0, +116, 0, 115, 0, 32, 0, 121, 0, 111, 0, 117, 0, 32, 0, 115, 0, 104, 0, 111, 0, 117, 0, 108, 0, 100, +0, 32, 0, 114, 0, 101, 0, 118, 0, 105, 0, 101, 0, 119, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, +108, 0, 105, 0, 99, 0, 101, 0, 110, 0, 115, 0, 101, 0, 32, 0, 97, 0, 103, 0, 114, 0, 101, 0, 101, +0, 109, 0, 101, 0, 110, 0, 116, 0, 32, 0, 121, 0, 111, 0, 117, 0, 32, 0, 114, 0, 101, 0, 99, 0, +101, 0, 105, 0, 118, 0, 101, 0, 100, 0, 32, 0, 119, 0, 105, 0, 116, 0, 104, 0, 32, 0, 116, 0, 104, +0, 101, 0, 32, 0, 115, 0, 111, 0, 102, 0, 116, 0, 119, 0, 97, 0, 114, 0, 101, 0, 32, 0, 111, 0, +114, 0, 32, 0, 99, 0, 111, 0, 110, 0, 116, 0, 97, 0, 99, 0, 116, 0, 32, 0, 77, 0, 111, 0, 110, +0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 32, 0, 102, 0, 111, 0, 114, 0, 32, 0, 97, 0, 32, 0, +99, 0, 111, 0, 112, 0, 121, 0, 32, 0, 111, 0, 102, 0, 32, 0, 116, 0, 104, 0, 101, 0, 32, 0, 108, +0, 105, 0, 99, 0, 101, 0, 110, 0, 115, 0, 101, 0, 32, 0, 97, 0, 103, 0, 114, 0, 101, 0, 101, 0, +109, 0, 101, 0, 110, 0, 116, 0, 46, 0, 13, 0, 10, 0, 13, 0, 10, 0, 77, 0, 111, 0, 110, 0, 111, +0, 116, 0, 121, 0, 112, 0, 101, 0, 32, 0, 99, 0, 97, 0, 110, 0, 32, 0, 98, 0, 101, 0, 32, 0, +99, 0, 111, 0, 110, 0, 116, 0, 97, 0, 99, 0, 116, 0, 101, 0, 100, 0, 32, 0, 97, 0, 116, 0, 58, +0, 13, 0, 10, 0, 13, 0, 10, 0, 85, 0, 83, 0, 65, 0, 32, 0, 45, 0, 32, 0, 40, 0, 56, 0, +52, 0, 55, 0, 41, 0, 32, 0, 55, 0, 49, 0, 56, 0, 45, 0, 48, 0, 52, 0, 48, 0, 48, 0, 9, +0, 9, 0, 85, 0, 75, 0, 32, 0, 45, 0, 32, 0, 48, 0, 49, 0, 49, 0, 52, 0, 52, 0, 32, 0, +48, 0, 49, 0, 55, 0, 51, 0, 55, 0, 32, 0, 55, 0, 54, 0, 53, 0, 57, 0, 53, 0, 57, 0, 13, +0, 10, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0, 47, 0, 119, 0, 119, 0, 119, 0, 46, 0, +109, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 46, 0, 99, 0, 111, 0, 109, 0, 77, +0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 32, 0, 84, 0, 121, 0, 112, 0, 101, 0, +32, 0, 68, 0, 114, 0, 97, 0, 119, 0, 105, 0, 110, 0, 103, 0, 32, 0, 79, 0, 102, 0, 102, 0, 105, +0, 99, 0, 101, 0, 32, 0, 45, 0, 32, 0, 82, 0, 111, 0, 98, 0, 105, 0, 110, 0, 32, 0, 78, 0, +105, 0, 99, 0, 104, 0, 111, 0, 108, 0, 97, 0, 115, 0, 44, 0, 32, 0, 80, 0, 97, 0, 116, 0, 114, +0, 105, 0, 99, 0, 105, 0, 97, 0, 32, 0, 83, 0, 97, 0, 117, 0, 110, 0, 100, 0, 101, 0, 114, 0, +115, 0, 32, 0, 49, 0, 57, 0, 56, 0, 50, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0, 47, +0, 119, 0, 119, 0, 119, 0, 46, 0, 109, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, +46, 0, 99, 0, 111, 0, 109, 0, 47, 0, 104, 0, 116, 0, 109, 0, 108, 0, 47, 0, 109, 0, 116, 0, 110, +0, 97, 0, 109, 0, 101, 0, 47, 0, 109, 0, 115, 0, 95, 0, 97, 0, 114, 0, 105, 0, 97, 0, 108, 0, +46, 0, 104, 0, 116, 0, 109, 0, 108, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0, 47, 0, 119, +0, 119, 0, 119, 0, 46, 0, 109, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, 46, 0, +99, 0, 111, 0, 109, 0, 47, 0, 104, 0, 116, 0, 109, 0, 108, 0, 47, 0, 109, 0, 116, 0, 110, 0, 97, +0, 109, 0, 101, 0, 47, 0, 109, 0, 115, 0, 95, 0, 119, 0, 101, 0, 108, 0, 99, 0, 111, 0, 109, 0, +101, 0, 46, 0, 104, 0, 116, 0, 109, 0, 108, 0, 104, 0, 116, 0, 116, 0, 112, 0, 58, 0, 47, 0, 47, +0, 119, 0, 119, 0, 119, 0, 46, 0, 109, 0, 111, 0, 110, 0, 111, 0, 116, 0, 121, 0, 112, 0, 101, 0, +46, 0, 99, 0, 111, 0, 109, 0, 47, 0, 104, 0, 116, 0, 109, 0, 108, 0, 47, 0, 116, 0, 121, 0, 112, +0, 101, 0, 47, 0, 108, 0, 105, 0, 99, 0, 101, 0, 110, 0, 115, 0, 101, 0, 46, 0, 104, 0, 116, 0, +109, 0, 108, 84, 121, 112, 101, 102, 97, 99, 101, 32, -87, 32, 84, 104, 101, 32, 77, 111, 110, 111, 116, 121, 112, +101, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 32, 112, 108, 99, 46, 32, 68, 97, 116, 97, 32, -87, +32, 84, 104, 101, 32, 77, 111, 110, 111, 116, 121, 112, 101, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, +32, 112, 108, 99, 47, 84, 121, 112, 101, 32, 83, 111, 108, 117, 116, 105, 111, 110, 115, 32, 73, 110, 99, 46, 32, +49, 57, 57, 48, 45, 49, 57, 57, 50, 46, 32, 65, 108, 108, 32, 82, 105, 103, 104, 116, 115, 32, 82, 101, 115, +101, 114, 118, 101, 100, 67, 111, 110, 116, 101, 109, 112, 111, 114, 97, 114, 121, 32, 115, 97, 110, 115, 32, 115, 101, +114, 105, 102, 32, 100, 101, 115, 105, 103, 110, 44, 32, 65, 114, 105, 97, 108, 32, 99, 111, 110, 116, 97, 105, 110, +115, 32, 109, 111, 114, 101, 32, 104, 117, 109, 97, 110, 105, 115, 116, 32, 99, 104, 97, 114, 97, 99, 116, 101, 114, +105, 115, 116, 105, 99, 115, 32, 116, 104, 97, 110, 32, 109, 97, 110, 121, 32, 111, 102, 32, 105, 116, 115, 32, 112, +114, 101, 100, 101, 99, 101, 115, 115, 111, 114, 115, 32, 97, 110, 100, 32, 97, 115, 32, 115, 117, 99, 104, 32, 105, +115, 32, 109, 111, 114, 101, 32, 105, 110, 32, 116, 117, 110, 101, 32, 119, 105, 116, 104, 32, 116, 104, 101, 32, 109, +111, 111, 100, 32, 111, 102, 32, 116, 104, 101, 32, 108, 97, 115, 116, 32, 100, 101, 99, 97, 100, 101, 115, 32, 111, +102, 32, 116, 104, 101, 32, 116, 119, 101, 110, 116, 105, 101, 116, 104, 32, 99, 101, 110, 116, 117, 114, 121, 46, 32, +32, 84, 104, 101, 32, 111, 118, 101, 114, 97, 108, 108, 32, 116, 114, 101, 97, 116, 109, 101, 110, 116, 32, 111, 102, +32, 99, 117, 114, 118, 101, 115, 32, 105, 115, 32, 115, 111, 102, 116, 101, 114, 32, 97, 110, 100, 32, 102, 117, 108, +108, 101, 114, 32, 116, 104, 97, 110, 32, 105, 110, 32, 109, 111, 115, 116, 32, 105, 110, 100, 117, 115, 116, 114, 105, +97, 108, 32, 115, 116, 121, 108, 101, 32, 115, 97, 110, 115, 32, 115, 101, 114, 105, 102, 32, 102, 97, 99, 101, 115, +46, 32, 32, 84, 101, 114, 109, 105, 110, 97, 108, 32, 115, 116, 114, 111, 107, 101, 115, 32, 97, 114, 101, 32, 99, +117, 116, 32, 111, 110, 32, 116, 104, 101, 32, 100, 105, 97, 103, 111, 110, 97, 108, 32, 119, 104, 105, 99, 104, 32, +104, 101, 108, 112, 115, 32, 116, 111, 32, 103, 105, 118, 101, 32, 116, 104, 101, 32, 102, 97, 99, 101, 32, 97, 32, +108, 101, 115, 115, 32, 109, 101, 99, 104, 97, 110, 105, 99, 97, 108, 32, 97, 112, 112, 101, 97, 114, 97, 110, 99, +101, 46, 32, 32, 65, 114, 105, 97, 108, 32, 105, 115, 32, 97, 110, 32, 101, 120, 116, 114, 101, 109, 101, 108, 121, +32, 118, 101, 114, 115, 97, 116, 105, 108, 101, 32, 102, 97, 109, 105, 108, 121, 32, 111, 102, 32, 116, 121, 112, 101, +102, 97, 99, 101, 115, 32, 119, 104, 105, 99, 104, 32, 99, 97, 110, 32, 98, 101, 32, 117, 115, 101, 100, 32, 119, +105, 116, 104, 32, 101, 113, 117, 97, 108, 32, 115, 117, 99, 99, 101, 115, 115, 32, 102, 111, 114, 32, 116, 101, 120, +116, 32, 115, 101, 116, 116, 105, 110, 103, 32, 105, 110, 32, 114, 101, 112, 111, 114, 116, 115, 44, 32, 112, 114, 101, +115, 101, 110, 116, 97, 116, 105, 111, 110, 115, 44, 32, 109, 97, 103, 97, 122, 105, 110, 101, 115, 32, 101, 116, 99, +44, 32, 97, 110, 100, 32, 102, 111, 114, 32, 100, 105, 115, 112, 108, 97, 121, 32, 117, 115, 101, 32, 105, 110, 32, +110, 101, 119, 115, 112, 97, 112, 101, 114, 115, 44, 32, 97, 100, 118, 101, 114, 116, 105, 115, 105, 110, 103, 32, 97, +110, 100, 32, 112, 114, 111, 109, 111, 116, 105, 111, 110, 115, 46, 77, 111, 110, 111, 116, 121, 112, 101, 58, 65, 114, +105, 97, 108, 32, 82, 101, 103, 117, 108, 97, 114, 58, 86, 101, 114, 115, 105, 111, 110, 32, 51, 46, 48, 48, 32, +40, 77, 105, 99, 114, 111, 115, 111, 102, 116, 41, 65, 114, 105, 97, 108, 77, 84, 65, 114, 105, 97, 108, -88, 32, +84, 114, 97, 100, 101, 109, 97, 114, 107, 32, 111, 102, 32, 84, 104, 101, 32, 77, 111, 110, 111, 116, 121, 112, 101, +32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 32, 112, 108, 99, 32, 114, 101, 103, 105, 115, 116, 101, 114, +101, 100, 32, 105, 110, 32, 116, 104, 101, 32, 85, 83, 32, 80, 97, 116, 32, 38, 32, 84, 77, 32, 79, 102, 102, +46, 32, 97, 110, 100, 32, 101, 108, 115, 101, 119, 104, 101, 114, 101, 46, 78, 79, 84, 73, 70, 73, 67, 65, 84, +73, 79, 78, 32, 79, 70, 32, 76, 73, 67, 69, 78, 83, 69, 32, 65, 71, 82, 69, 69, 77, 69, 78, 84, 13, +10, 13, 10, 84, 104, 105, 115, 32, 116, 121, 112, 101, 102, 97, 99, 101, 32, 105, 115, 32, 116, 104, 101, 32, 112, +114, 111, 112, 101, 114, 116, 121, 32, 111, 102, 32, 77, 111, 110, 111, 116, 121, 112, 101, 32, 84, 121, 112, 111, 103, +114, 97, 112, 104, 121, 32, 97, 110, 100, 32, 105, 116, 115, 32, 117, 115, 101, 32, 98, 121, 32, 121, 111, 117, 32, +105, 115, 32, 99, 111, 118, 101, 114, 101, 100, 32, 117, 110, 100, 101, 114, 32, 116, 104, 101, 32, 116, 101, 114, 109, +115, 32, 111, 102, 32, 97, 32, 108, 105, 99, 101, 110, 115, 101, 32, 97, 103, 114, 101, 101, 109, 101, 110, 116, 46, +32, 89, 111, 117, 32, 104, 97, 118, 101, 32, 111, 98, 116, 97, 105, 110, 101, 100, 32, 116, 104, 105, 115, 32, 116, +121, 112, 101, 102, 97, 99, 101, 32, 115, 111, 102, 116, 119, 97, 114, 101, 32, 101, 105, 116, 104, 101, 114, 32, 100, +105, 114, 101, 99, 116, 108, 121, 32, 102, 114, 111, 109, 32, 77, 111, 110, 111, 116, 121, 112, 101, 32, 111, 114, 32, +116, 111, 103, 101, 116, 104, 101, 114, 32, 119, 105, 116, 104, 32, 115, 111, 102, 116, 119, 97, 114, 101, 32, 100, 105, +115, 116, 114, 105, 98, 117, 116, 101, 100, 32, 98, 121, 32, 111, 110, 101, 32, 111, 102, 32, 77, 111, 110, 111, 116, +121, 112, 101, 39, 115, 32, 108, 105, 99, 101, 110, 115, 101, 101, 115, 46, 13, 10, 13, 10, 84, 104, 105, 115, 32, +115, 111, 102, 116, 119, 97, 114, 101, 32, 105, 115, 32, 97, 32, 118, 97, 108, 117, 97, 98, 108, 101, 32, 97, 115, +115, 101, 116, 32, 111, 102, 32, 77, 111, 110, 111, 116, 121, 112, 101, 46, 32, 85, 110, 108, 101, 115, 115, 32, 121, +111, 117, 32, 104, 97, 118, 101, 32, 101, 110, 116, 101, 114, 101, 100, 32, 105, 110, 116, 111, 32, 97, 32, 115, 112, +101, 99, 105, 102, 105, 99, 32, 108, 105, 99, 101, 110, 115, 101, 32, 97, 103, 114, 101, 101, 109, 101, 110, 116, 32, +103, 114, 97, 110, 116, 105, 110, 103, 32, 121, 111, 117, 32, 97, 100, 100, 105, 116, 105, 111, 110, 97, 108, 32, 114, +105, 103, 104, 116, 115, 44, 32, 121, 111, 117, 114, 32, 117, 115, 101, 32, 111, 102, 32, 116, 104, 105, 115, 32, 115, +111, 102, 116, 119, 97, 114, 101, 32, 105, 115, 32, 108, 105, 109, 105, 116, 101, 100, 32, 116, 111, 32, 121, 111, 117, +114, 32, 119, 111, 114, 107, 115, 116, 97, 116, 105, 111, 110, 32, 102, 111, 114, 32, 121, 111, 117, 114, 32, 111, 119, +110, 32, 112, 117, 98, 108, 105, 115, 104, 105, 110, 103, 32, 117, 115, 101, 46, 32, 89, 111, 117, 32, 109, 97, 121, +32, 110, 111, 116, 32, 99, 111, 112, 121, 32, 111, 114, 32, 100, 105, 115, 116, 114, 105, 98, 117, 116, 101, 32, 116, +104, 105, 115, 32, 115, 111, 102, 116, 119, 97, 114, 101, 46, 13, 10, 13, 10, 73, 102, 32, 121, 111, 117, 32, 104, +97, 118, 101, 32, 97, 110, 121, 32, 113, 117, 101, 115, 116, 105, 111, 110, 32, 99, 111, 110, 99, 101, 114, 110, 105, +110, 103, 32, 121, 111, 117, 114, 32, 114, 105, 103, 104, 116, 115, 32, 121, 111, 117, 32, 115, 104, 111, 117, 108, 100, +32, 114, 101, 118, 105, 101, 119, 32, 116, 104, 101, 32, 108, 105, 99, 101, 110, 115, 101, 32, 97, 103, 114, 101, 101, +109, 101, 110, 116, 32, 121, 111, 117, 32, 114, 101, 99, 101, 105, 118, 101, 100, 32, 119, 105, 116, 104, 32, 116, 104, +101, 32, 115, 111, 102, 116, 119, 97, 114, 101, 32, 111, 114, 32, 99, 111, 110, 116, 97, 99, 116, 32, 77, 111, 110, +111, 116, 121, 112, 101, 32, 102, 111, 114, 32, 97, 32, 99, 111, 112, 121, 32, 111, 102, 32, 116, 104, 101, 32, 108, +105, 99, 101, 110, 115, 101, 32, 97, 103, 114, 101, 101, 109, 101, 110, 116, 46, 13, 10, 13, 10, 77, 111, 110, 111, +116, 121, 112, 101, 32, 99, 97, 110, 32, 98, 101, 32, 99, 111, 110, 116, 97, 99, 116, 101, 100, 32, 97, 116, 58, +13, 10, 13, 10, 85, 83, 65, 32, 45, 32, 40, 56, 52, 55, 41, 32, 55, 49, 56, 45, 48, 52, 48, 48, 9, +9, 85, 75, 32, 45, 32, 48, 49, 49, 52, 52, 32, 48, 49, 55, 51, 55, 32, 55, 54, 53, 57, 53, 57, 13, +10, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 109, 111, 110, 111, 116, 121, 112, 101, 46, 99, 111, 109, 77, +111, 110, 111, 116, 121, 112, 101, 32, 84, 121, 112, 101, 32, 68, 114, 97, 119, 105, 110, 103, 32, 79, 102, 102, 105, +99, 101, 32, 45, 32, 82, 111, 98, 105, 110, 32, 78, 105, 99, 104, 111, 108, 97, 115, 44, 32, 80, 97, 116, 114, +105, 99, 105, 97, 32, 83, 97, 117, 110, 100, 101, 114, 115, 32, 49, 57, 56, 50, 104, 116, 116, 112, 58, 47, 47, +119, 119, 119, 46, 109, 111, 110, 111, 116, 121, 112, 101, 46, 99, 111, 109, 47, 104, 116, 109, 108, 47, 109, 116, 110, +97, 109, 101, 47, 109, 115, 95, 97, 114, 105, 97, 108, 46, 104, 116, 109, 108, 104, 116, 116, 112, 58, 47, 47, 119, +119, 119, 46, 109, 111, 110, 111, 116, 121, 112, 101, 46, 99, 111, 109, 47, 104, 116, 109, 108, 47, 109, 116, 110, 97, +109, 101, 47, 109, 115, 95, 119, 101, 108, 99, 111, 109, 101, 46, 104, 116, 109, 108, 104, 116, 116, 112, 58, 47, 47, +119, 119, 119, 46, 109, 111, 110, 111, 116, 121, 112, 101, 46, 99, 111, 109, 47, 104, 116, 109, 108, 47, 116, 121, 112, +101, 47, 108, 105, 99, 101, 110, 115, 101, 46, 104, 116, 109, 108, 0, 78, 0, 111, 0, 114, 0, 109, 0, 97, 0, +108, 0, 110, 0, 121, 0, 111, 0, 98, 0, 121, 1, 13, 0, 101, 0, 106, 0, 110, 0, -23, 0, 110, 0, 111, +0, 114, 0, 109, 0, 97, 0, 108, 0, 83, 0, 116, 0, 97, 0, 110, 0, 100, 0, 97, 0, 114, 0, 100, 3, +-102, 3, -79, 3, -67, 3, -65, 3, -67, 3, -71, 3, -70, 3, -84, 0, 78, 0, 111, 0, 114, 0, 109, 0, 97, +0, 97, 0, 108, 0, 105, 0, 78, 0, 111, 0, 114, 0, 109, 0, -31, 0, 108, 0, 110, 0, 101, 0, 78, 0, +111, 0, 114, 0, 109, 0, 97, 0, 108, 0, 101, 0, 83, 0, 116, 0, 97, 0, 110, 0, 100, 0, 97, 0, 97, +0, 114, 0, 100, 4, 30, 4, 49, 4, 75, 4, 71, 4, 61, 4, 75, 4, 57, 0, 78, 0, 97, 0, 118, 0, +97, 0, 100, 0, 110, 0, 111, 0, 116, 0, 104, 1, -80, 1, -95, 3, 0, 0, 110, 0, 103, 0, 65, 0, 114, +0, 114, 0, 117, 0, 110, 0, 116, 0, 97, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, -1, 39, 0, -106, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, -118, 0, 0, 1, +2, 1, 3, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, +0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, +26, 0, 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, +0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0, 49, 0, 50, 0, +51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, +0, 64, 0, 65, 0, 66, 0, 67, 0, 68, 0, 69, 0, 70, 0, 71, 0, 72, 0, 73, 0, 74, 0, 75, 0, +76, 0, 77, 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, +0, 89, 0, 90, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 96, 0, 97, 0, 98, 0, 99, 0, 100, 0, +101, 0, 102, 0, 103, 0, 104, 0, 105, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 112, 0, 113, +0, 114, 0, 115, 0, 116, 0, 117, 0, 118, 0, 119, 0, 120, 0, 121, 0, 122, 0, 123, 0, 124, 0, 125, 0, +126, 0, 127, 0, -128, 0, -127, 0, -126, 0, -125, 0, -124, 0, -123, 0, -122, 0, -121, 0, -120, 0, -119, 0, -118, +0, -117, 0, -116, 0, -115, 0, -114, 0, -113, 0, -112, 0, -111, 0, -110, 0, -109, 0, -108, 0, -107, 0, -106, 1, +4, 0, -104, 0, -103, 0, -102, 1, 5, 0, -100, 0, -99, 0, -98, 1, 6, 0, -96, 0, -95, 0, -94, 0, -93, +0, -92, 0, -91, 0, -90, 0, -89, 0, -88, 0, -87, 0, -86, 0, -85, 0, -83, 0, -82, 0, -81, 0, -80, 0, +-79, 0, -78, 0, -77, 0, -76, 0, -75, 0, -74, 0, -73, 0, -72, 0, -71, 0, -70, 0, -69, 0, -68, 1, 7, +0, -66, 0, -65, 0, -64, 0, -63, 0, -62, 0, -61, 0, -60, 0, -59, 0, -58, 0, -57, 0, -56, 0, -55, 0, +-54, 0, -53, 0, -52, 0, -51, 0, -50, 0, -49, 0, -48, 0, -47, 0, -45, 0, -44, 0, -43, 0, -42, 0, -41, +0, -40, 0, -39, 0, -38, 0, -37, 0, -36, 0, -35, 0, -34, 0, -33, 0, -32, 0, -31, 0, -30, 0, -29, 0, +-28, 0, -27, 0, -26, 0, -25, 0, -24, 0, -23, 0, -22, 0, -21, 0, -20, 0, -19, 0, -18, 0, -17, 0, -16, +0, -15, 0, -14, 0, -13, 0, -12, 0, -11, 0, -10, 0, -9, 0, -8, 0, -7, 0, -6, 0, -5, 0, -4, 0, +-3, 0, -2, 0, -1, 1, 0, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 1, 13, 1, 14, 1, 15, 1, 16, +1, 17, 1, 18, 1, 19, 1, 20, 1, 21, 1, 22, 1, 23, 1, 24, 1, 25, 1, 26, 1, 27, 1, 28, 1, +29, 1, 30, 1, 31, 1, 32, 1, 33, 1, 34, 1, 35, 1, 36, 1, 37, 1, 38, 1, 39, 1, 40, 1, 41, +1, 42, 1, 43, 1, 44, 1, 45, 1, 46, 1, 47, 1, 48, 1, 49, 1, 50, 1, 51, 1, 52, 1, 53, 1, +54, 1, 55, 1, 56, 1, 57, 1, 58, 1, 59, 1, 60, 1, 61, 1, 62, 1, 63, 1, 64, 1, 65, 1, 66, +1, 67, 1, 68, 1, 69, 1, 70, 1, 71, 1, 72, 1, 73, 1, 74, 1, 75, 1, 76, 1, 77, 1, 78, 1, +79, 1, 80, 1, 81, 1, 82, 1, 83, 1, 84, 1, 85, 1, 86, 1, 87, 1, 88, 1, 89, 1, 90, 1, 91, +1, 92, 1, 93, 1, 94, 1, 95, 1, 96, 1, 97, 1, 98, 1, 99, 1, 100, 1, 101, 1, 102, 1, 103, 1, +104, 1, 105, 1, 106, 1, 107, 1, 108, 1, 109, 1, 110, 1, 111, 1, 112, 1, 113, 1, 114, 1, 115, 1, 116, +1, 117, 1, 118, 1, 119, 1, 120, 1, 121, 1, 122, 1, 123, 1, 124, 1, 125, 1, 126, 1, 127, 1, -128, 1, +-127, 1, -126, 1, -125, 1, -124, 1, -123, 1, -122, 1, -121, 1, -120, 1, -119, 1, -118, 1, -117, 1, -116, 1, -115, +1, -114, 1, -113, 1, -112, 1, -111, 1, -110, 1, -109, 1, -108, 1, -107, 1, -106, 1, -105, 1, -104, 1, -103, 1, +-102, 1, -101, 1, -100, 1, -99, 1, -98, 1, -97, 1, -96, 1, -95, 1, -94, 1, -93, 1, -92, 1, -91, 1, -90, +1, -89, 1, -88, 1, -87, 1, -86, 1, -85, 1, -84, 1, -83, 1, -82, 1, -81, 1, -80, 1, -79, 1, -78, 1, +-77, 1, -76, 1, -75, 1, -74, 1, -73, 1, -72, 1, -71, 1, -70, 1, -69, 1, -68, 1, -67, 1, -66, 1, -65, +1, -64, 1, -63, 1, -62, 1, -61, 1, -60, 1, -59, 1, -58, 1, -57, 1, -56, 1, -55, 1, -54, 1, -53, 1, +-52, 1, -51, 1, -50, 1, -49, 1, -48, 1, -47, 1, -46, 1, -45, 1, -44, 1, -43, 1, -42, 1, -41, 1, -40, +1, -39, 1, -38, 1, -37, 1, -36, 1, -35, 1, -34, 1, -33, 1, -32, 1, -31, 1, -30, 1, -29, 1, -28, 1, +-27, 1, -26, 1, -25, 1, -24, 1, -23, 1, -22, 1, -21, 1, -20, 1, -19, 1, -18, 1, -17, 1, -16, 1, -15, +1, -14, 1, -13, 1, -12, 1, -11, 1, -10, 1, -9, 1, -8, 1, -7, 1, -6, 1, -5, 1, -4, 1, -3, 1, +-2, 1, -1, 2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, +2, 11, 2, 12, 2, 13, 2, 14, 2, 15, 2, 16, 2, 17, 2, 18, 2, 19, 2, 20, 2, 21, 0, -97, 2, +22, 2, 23, 2, 24, 2, 25, 2, 26, 2, 27, 2, 28, 2, 29, 2, 30, 2, 31, 2, 32, 2, 33, 2, 34, +2, 35, 2, 36, 0, -105, 2, 37, 2, 38, 2, 39, 2, 40, 2, 41, 2, 42, 2, 43, 2, 44, 2, 45, 2, +46, 2, 47, 2, 48, 2, 49, 2, 50, 2, 51, 2, 52, 2, 53, 2, 54, 2, 55, 2, 56, 2, 57, 2, 58, +2, 59, 2, 60, 2, 61, 2, 62, 2, 63, 2, 64, 2, 65, 2, 66, 2, 67, 2, 68, 2, 69, 2, 70, 2, +71, 2, 72, 2, 73, 2, 74, 2, 75, 2, 76, 2, 77, 2, 78, 2, 79, 2, 80, 2, 81, 2, 82, 2, 83, +2, 84, 2, 85, 2, 86, 2, 87, 2, 88, 2, 89, 2, 90, 2, 91, 2, 92, 2, 93, 2, 94, 2, 95, 2, +96, 2, 97, 2, 98, 2, 99, 2, 100, 2, 101, 2, 102, 2, 103, 2, 104, 2, 105, 2, 106, 2, 107, 2, 108, +2, 109, 2, 110, 2, 111, 2, 112, 2, 113, 2, 114, 2, 115, 2, 116, 2, 117, 2, 118, 2, 119, 2, 120, 2, +121, 2, 122, 2, 123, 2, 124, 2, 125, 2, 126, 2, 127, 2, -128, 2, -127, 2, -126, 2, -125, 2, -124, 2, -123, +2, -122, 2, -121, 2, -120, 2, -119, 2, -118, 2, -117, 2, -116, 2, -115, 2, -114, 2, -113, 2, -112, 2, -111, 2, +-110, 0, -101, 2, -109, 2, -108, 2, -107, 2, -106, 2, -105, 2, -104, 2, -103, 2, -102, 2, -101, 2, -100, 2, -99, +2, -98, 2, -97, 2, -96, 2, -95, 2, -94, 2, -93, 2, -92, 2, -91, 2, -90, 2, -89, 2, -88, 2, -87, 2, +-86, 2, -85, 2, -84, 2, -83, 2, -82, 2, -81, 2, -80, 2, -79, 2, -78, 2, -77, 2, -76, 2, -75, 2, -74, +2, -73, 2, -72, 2, -71, 2, -70, 2, -69, 2, -68, 2, -67, 2, -66, 2, -65, 2, -64, 2, -63, 2, -62, 2, +-61, 2, -60, 2, -59, 2, -58, 2, -57, 2, -56, 2, -55, 2, -54, 2, -53, 2, -52, 2, -51, 2, -50, 2, -49, +2, -48, 2, -47, 2, -46, 2, -45, 2, -44, 2, -43, 2, -42, 2, -41, 2, -40, 2, -39, 2, -38, 2, -37, 2, +-36, 2, -35, 2, -34, 2, -33, 2, -32, 2, -31, 2, -30, 2, -29, 2, -28, 2, -27, 2, -26, 2, -25, 2, -24, +2, -23, 2, -22, 2, -21, 2, -20, 2, -19, 2, -18, 2, -17, 2, -16, 2, -15, 2, -14, 2, -13, 2, -12, 2, +-11, 2, -10, 2, -9, 2, -8, 2, -7, 2, -6, 2, -5, 2, -4, 2, -3, 2, -2, 2, -1, 3, 0, 3, 1, +3, 2, 3, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3, 10, 3, 11, 3, 12, 3, 13, 3, +14, 3, 15, 3, 16, 3, 17, 3, 18, 3, 19, 3, 20, 3, 21, 3, 22, 3, 23, 3, 24, 3, 25, 3, 26, +3, 27, 3, 28, 3, 29, 3, 30, 3, 31, 3, 32, 3, 33, 3, 34, 3, 35, 3, 36, 3, 37, 3, 38, 3, +39, 3, 40, 3, 41, 3, 42, 3, 43, 3, 44, 3, 45, 3, 46, 3, 47, 3, 48, 3, 49, 3, 50, 3, 51, +3, 52, 3, 53, 3, 54, 3, 55, 3, 56, 3, 57, 3, 58, 3, 59, 3, 60, 3, 61, 3, 62, 3, 63, 3, +64, 3, 65, 3, 66, 3, 67, 3, 68, 3, 69, 3, 70, 3, 71, 3, 72, 3, 73, 3, 74, 3, 75, 3, 76, +3, 77, 3, 78, 3, 79, 3, 80, 3, 81, 3, 82, 3, 83, 3, 84, 3, 85, 3, 86, 3, 87, 3, 88, 3, +89, 3, 90, 3, 91, 3, 92, 3, 93, 3, 94, 3, 95, 3, 96, 3, 97, 3, 98, 3, 99, 0, -67, 3, 100, +3, 101, 3, 102, 3, 103, 3, 104, 3, 105, 3, 106, 3, 107, 3, 108, 3, 109, 3, 110, 3, 111, 3, 112, 3, +113, 3, 114, 3, 115, 3, 116, 3, 117, 3, 118, 3, 119, 3, 120, 3, 121, 3, 122, 3, 123, 3, 124, 3, 125, +3, 126, 3, 127, 3, -128, 3, -127, 3, -126, 3, -125, 3, -124, 3, -123, 3, -122, 3, -121, 3, -120, 3, -119, 3, +-118, 3, -117, 3, -116, 3, -115, 3, -114, 3, -113, 3, -112, 3, -111, 3, -110, 3, -109, 3, -108, 3, -107, 3, -106, +3, -105, 3, -104, 3, -103, 3, -102, 3, -101, 3, -100, 3, -99, 3, -98, 3, -97, 3, -96, 3, -95, 3, -94, 3, +-93, 3, -92, 3, -91, 3, -90, 3, -89, 3, -88, 3, -87, 3, -86, 3, -85, 3, -84, 3, -83, 3, -82, 3, -81, +3, -80, 3, -79, 3, -78, 3, -77, 3, -76, 3, -75, 3, -74, 3, -73, 3, -72, 3, -71, 3, -70, 3, -69, 3, +-68, 3, -67, 3, -66, 3, -65, 3, -64, 3, -63, 3, -62, 3, -61, 3, -60, 3, -59, 3, -58, 3, -57, 3, -56, +3, -55, 3, -54, 3, -53, 3, -52, 3, -51, 3, -50, 3, -49, 3, -48, 3, -47, 3, -46, 3, -45, 3, -44, 3, +-43, 3, -42, 3, -41, 3, -40, 3, -39, 3, -38, 3, -37, 3, -36, 3, -35, 3, -34, 3, -33, 3, -32, 3, -31, +3, -30, 3, -29, 3, -28, 3, -27, 3, -26, 3, -25, 3, -24, 3, -23, 3, -22, 3, -21, 3, -20, 3, -19, 3, +-18, 3, -17, 3, -16, 3, -15, 3, -14, 3, -13, 3, -12, 3, -11, 3, -10, 3, -9, 3, -8, 3, -7, 3, -6, +3, -5, 3, -4, 3, -3, 3, -2, 3, -1, 4, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4, 5, 4, 6, 4, +7, 4, 8, 4, 9, 4, 10, 4, 11, 4, 12, 4, 13, 4, 14, 4, 15, 4, 16, 4, 17, 4, 18, 4, 19, +4, 20, 4, 21, 4, 22, 4, 23, 4, 24, 4, 25, 4, 26, 4, 27, 4, 28, 4, 29, 4, 30, 4, 31, 4, +32, 4, 33, 4, 34, 4, 35, 4, 36, 4, 37, 4, 38, 4, 39, 4, 40, 4, 41, 4, 42, 4, 43, 4, 44, +4, 45, 4, 46, 4, 47, 4, 48, 4, 49, 4, 50, 4, 51, 4, 52, 4, 53, 4, 54, 4, 55, 4, 56, 4, +57, 4, 58, 4, 59, 4, 60, 4, 61, 4, 62, 4, 63, 4, 64, 4, 65, 4, 66, 4, 67, 4, 68, 4, 69, +4, 70, 4, 71, 4, 72, 4, 73, 4, 74, 4, 75, 4, 76, 4, 77, 4, 78, 4, 79, 4, 80, 4, 81, 4, +82, 4, 83, 4, 84, 4, 85, 4, 86, 4, 87, 4, 88, 4, 89, 4, 90, 4, 91, 4, 92, 4, 93, 4, 94, +4, 95, 4, 96, 4, 97, 4, 98, 4, 99, 4, 100, 4, 101, 4, 102, 4, 103, 4, 104, 4, 105, 4, 106, 4, +107, 4, 108, 4, 109, 4, 110, 4, 111, 4, 112, 4, 113, 4, 114, 4, 115, 4, 116, 4, 117, 4, 118, 4, 119, +4, 120, 4, 121, 4, 122, 4, 123, 4, 124, 4, 125, 4, 126, 4, 127, 4, -128, 4, -127, 4, -126, 4, -125, 4, +-124, 4, -123, 4, -122, 4, -121, 4, -120, 4, -119, 4, -118, 4, -117, 4, -116, 4, -115, 4, -114, 4, -113, 4, -112, +4, -111, 4, -110, 4, -109, 4, -108, 4, -107, 4, -106, 4, -105, 4, -104, 4, -103, 4, -102, 4, -101, 4, -100, 4, +-99, 4, -98, 4, -97, 4, -96, 4, -95, 4, -94, 4, -93, 4, -92, 4, -91, 4, -90, 4, -89, 4, -88, 4, -87, +4, -86, 4, -85, 4, -84, 4, -83, 4, -82, 4, -81, 4, -80, 4, -79, 4, -78, 4, -77, 4, -76, 4, -75, 4, +-74, 4, -73, 4, -72, 4, -71, 4, -70, 4, -69, 4, -68, 4, -67, 4, -66, 4, -65, 4, -64, 4, -63, 4, -62, +4, -61, 4, -60, 4, -59, 4, -58, 4, -57, 4, -56, 4, -55, 4, -54, 4, -53, 4, -52, 4, -51, 4, -50, 4, +-49, 4, -48, 4, -47, 4, -46, 4, -45, 4, -44, 4, -43, 4, -42, 4, -41, 4, -40, 4, -39, 4, -38, 4, -37, +4, -36, 4, -35, 4, -34, 4, -33, 4, -32, 4, -31, 4, -30, 4, -29, 4, -28, 4, -27, 4, -26, 4, -25, 4, +-24, 4, -23, 4, -22, 4, -21, 4, -20, 4, -19, 4, -18, 4, -17, 4, -16, 4, -15, 4, -14, 4, -13, 4, -12, +4, -11, 4, -10, 4, -9, 4, -8, 4, -7, 4, -6, 4, -5, 4, -4, 4, -3, 4, -2, 4, -1, 5, 0, 5, +1, 5, 2, 5, 3, 5, 4, 5, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5, 10, 5, 11, 5, 12, 5, 13, +5, 14, 5, 15, 5, 16, 5, 17, 5, 18, 5, 19, 5, 20, 5, 21, 5, 22, 5, 23, 5, 24, 5, 25, 5, +26, 5, 27, 5, 28, 5, 29, 5, 30, 5, 31, 5, 32, 5, 33, 5, 34, 5, 35, 5, 36, 5, 37, 5, 38, +5, 39, 5, 40, 5, 41, 5, 42, 5, 43, 5, 44, 5, 45, 5, 46, 5, 47, 5, 48, 5, 49, 5, 50, 5, +51, 5, 52, 5, 53, 5, 54, 5, 55, 5, 56, 5, 57, 5, 58, 5, 59, 5, 60, 5, 61, 5, 62, 5, 63, +5, 64, 5, 65, 5, 66, 5, 67, 5, 68, 5, 69, 5, 70, 5, 71, 5, 72, 5, 73, 5, 74, 5, 75, 5, +76, 5, 77, 5, 78, 5, 79, 5, 80, 5, 81, 5, 82, 5, 83, 5, 84, 5, 85, 5, 86, 5, 87, 5, 88, +5, 89, 5, 90, 5, 91, 5, 92, 5, 93, 5, 94, 5, 95, 5, 96, 5, 97, 5, 98, 5, 99, 5, 100, 5, +101, 5, 102, 5, 103, 5, 104, 5, 105, 5, 106, 5, 107, 5, 108, 5, 109, 5, 110, 5, 111, 5, 112, 5, 113, +5, 114, 5, 115, 5, 116, 5, 117, 5, 118, 5, 119, 5, 120, 5, 121, 5, 122, 5, 123, 5, 124, 5, 125, 5, +126, 5, 127, 5, -128, 5, -127, 5, -126, 5, -125, 5, -124, 5, -123, 5, -122, 5, -121, 5, -120, 5, -119, 5, -118, +5, -117, 5, -116, 5, -115, 5, -114, 5, -113, 5, -112, 5, -111, 5, -110, 5, -109, 5, -108, 5, -107, 5, -106, 5, +-105, 5, -104, 5, -103, 5, -102, 5, -101, 5, -100, 5, -99, 5, -98, 5, -97, 5, -96, 5, -95, 5, -94, 5, -93, +5, -92, 5, -91, 5, -90, 5, -89, 5, -88, 5, -87, 5, -86, 5, -85, 5, -84, 5, -83, 5, -82, 5, -81, 5, +-80, 5, -79, 5, -78, 5, -77, 5, -76, 5, -75, 5, -74, 5, -73, 5, -72, 5, -71, 5, -70, 5, -69, 5, -68, +5, -67, 5, -66, 5, -65, 5, -64, 5, -63, 5, -62, 5, -61, 5, -60, 5, -59, 5, -58, 5, -57, 5, -56, 5, +-55, 5, -54, 5, -53, 5, -52, 5, -51, 5, -50, 5, -49, 5, -48, 5, -47, 5, -46, 5, -45, 5, -44, 5, -43, +5, -42, 5, -41, 5, -40, 5, -39, 5, -38, 5, -37, 5, -36, 5, -35, 5, -34, 5, -33, 5, -32, 5, -31, 5, +-30, 5, -29, 5, -28, 5, -27, 5, -26, 5, -25, 5, -24, 5, -23, 5, -22, 5, -21, 5, -20, 5, -19, 5, -18, +5, -17, 5, -16, 5, -15, 5, -14, 5, -13, 5, -12, 5, -11, 5, -10, 5, -9, 5, -8, 5, -7, 5, -6, 5, +-5, 5, -4, 5, -3, 5, -2, 5, -1, 6, 0, 6, 1, 6, 2, 6, 3, 6, 4, 6, 5, 6, 6, 6, 7, +6, 8, 6, 9, 6, 10, 6, 11, 6, 12, 6, 13, 6, 14, 6, 15, 6, 16, 6, 17, 6, 18, 6, 19, 6, +20, 6, 21, 6, 22, 6, 23, 6, 24, 6, 25, 6, 26, 6, 27, 6, 28, 6, 29, 6, 30, 6, 31, 6, 32, +6, 33, 6, 34, 6, 35, 6, 36, 6, 37, 6, 38, 6, 39, 6, 40, 6, 41, 6, 42, 6, 43, 6, 44, 6, +45, 6, 46, 6, 47, 6, 48, 6, 49, 6, 50, 6, 51, 6, 52, 6, 53, 6, 54, 6, 55, 6, 56, 6, 57, +6, 58, 6, 59, 6, 60, 6, 61, 6, 62, 6, 63, 6, 64, 6, 65, 6, 66, 6, 67, 6, 68, 6, 69, 6, +70, 6, 71, 6, 72, 6, 73, 6, 74, 6, 75, 6, 76, 6, 77, 6, 78, 6, 79, 6, 80, 6, 81, 6, 82, +6, 83, 6, 84, 6, 85, 6, 86, 6, 87, 6, 88, 6, 89, 6, 90, 6, 91, 6, 92, 6, 93, 6, 94, 6, +95, 6, 96, 6, 97, 6, 98, 6, 99, 6, 100, 6, 101, 6, 102, 6, 103, 6, 104, 6, 105, 6, 106, 6, 107, +6, 108, 6, 109, 6, 110, 6, 111, 6, 112, 6, 113, 6, 114, 6, 115, 6, 116, 6, 117, 6, 118, 6, 119, 6, +120, 6, 121, 6, 122, 6, 123, 6, 124, 6, 125, 6, 126, 6, 127, 6, -128, 6, -127, 6, -126, 6, -125, 6, -124, +6, -123, 6, -122, 6, -121, 6, -120, 6, -119, 6, -118, 6, -117, 6, -116, 6, -115, 6, -114, 5, 46, 110, 117, 108, +108, 16, 110, 111, 110, 109, 97, 114, 107, 105, 110, 103, 114, 101, 116, 117, 114, 110, 3, 109, 117, 49, 3, 112, 105, +49, 3, 79, 104, 109, 4, 69, 117, 114, 111, 7, 100, 109, 97, 99, 114, 111, 110, 9, 111, 118, 101, 114, 115, 99, +111, 114, 101, 6, 109, 105, 100, 100, 111, 116, 6, 65, 98, 114, 101, 118, 101, 6, 97, 98, 114, 101, 118, 101, 7, +65, 111, 103, 111, 110, 101, 107, 7, 97, 111, 103, 111, 110, 101, 107, 6, 68, 99, 97, 114, 111, 110, 6, 100, 99, +97, 114, 111, 110, 6, 68, 115, 108, 97, 115, 104, 7, 69, 111, 103, 111, 110, 101, 107, 7, 101, 111, 103, 111, 110, +101, 107, 6, 69, 99, 97, 114, 111, 110, 6, 101, 99, 97, 114, 111, 110, 6, 76, 97, 99, 117, 116, 101, 6, 108, +97, 99, 117, 116, 101, 6, 76, 99, 97, 114, 111, 110, 6, 108, 99, 97, 114, 111, 110, 4, 76, 100, 111, 116, 4, +108, 100, 111, 116, 6, 78, 97, 99, 117, 116, 101, 6, 110, 97, 99, 117, 116, 101, 6, 78, 99, 97, 114, 111, 110, +6, 110, 99, 97, 114, 111, 110, 9, 79, 100, 98, 108, 97, 99, 117, 116, 101, 9, 111, 100, 98, 108, 97, 99, 117, +116, 101, 6, 82, 97, 99, 117, 116, 101, 6, 114, 97, 99, 117, 116, 101, 6, 82, 99, 97, 114, 111, 110, 6, 114, +99, 97, 114, 111, 110, 6, 83, 97, 99, 117, 116, 101, 6, 115, 97, 99, 117, 116, 101, 8, 84, 99, 101, 100, 105, +108, 108, 97, 8, 116, 99, 101, 100, 105, 108, 108, 97, 6, 84, 99, 97, 114, 111, 110, 6, 116, 99, 97, 114, 111, +110, 5, 85, 114, 105, 110, 103, 5, 117, 114, 105, 110, 103, 9, 85, 100, 98, 108, 97, 99, 117, 116, 101, 9, 117, +100, 98, 108, 97, 99, 117, 116, 101, 6, 90, 97, 99, 117, 116, 101, 6, 122, 97, 99, 117, 116, 101, 4, 90, 100, +111, 116, 4, 122, 100, 111, 116, 5, 71, 97, 109, 109, 97, 5, 84, 104, 101, 116, 97, 3, 80, 104, 105, 5, 97, +108, 112, 104, 97, 5, 100, 101, 108, 116, 97, 7, 101, 112, 115, 105, 108, 111, 110, 5, 115, 105, 103, 109, 97, 3, +116, 97, 117, 3, 112, 104, 105, 13, 117, 110, 100, 101, 114, 115, 99, 111, 114, 101, 100, 98, 108, 9, 101, 120, 99, +108, 97, 109, 100, 98, 108, 9, 110, 115, 117, 112, 101, 114, 105, 111, 114, 6, 112, 101, 115, 101, 116, 97, 9, 97, +114, 114, 111, 119, 108, 101, 102, 116, 7, 97, 114, 114, 111, 119, 117, 112, 10, 97, 114, 114, 111, 119, 114, 105, 103, +104, 116, 9, 97, 114, 114, 111, 119, 100, 111, 119, 110, 9, 97, 114, 114, 111, 119, 98, 111, 116, 104, 9, 97, 114, +114, 111, 119, 117, 112, 100, 110, 12, 97, 114, 114, 111, 119, 117, 112, 100, 110, 98, 115, 101, 10, 111, 114, 116, 104, +111, 103, 111, 110, 97, 108, 12, 105, 110, 116, 101, 114, 115, 101, 99, 116, 105, 111, 110, 11, 101, 113, 117, 105, 118, +97, 108, 101, 110, 99, 101, 5, 104, 111, 117, 115, 101, 13, 114, 101, 118, 108, 111, 103, 105, 99, 97, 108, 110, 111, +116, 10, 105, 110, 116, 101, 103, 114, 97, 108, 116, 112, 10, 105, 110, 116, 101, 103, 114, 97, 108, 98, 116, 8, 83, +70, 49, 48, 48, 48, 48, 48, 8, 83, 70, 49, 49, 48, 48, 48, 48, 8, 83, 70, 48, 49, 48, 48, 48, 48, +8, 83, 70, 48, 51, 48, 48, 48, 48, 8, 83, 70, 48, 50, 48, 48, 48, 48, 8, 83, 70, 48, 52, 48, 48, +48, 48, 8, 83, 70, 48, 56, 48, 48, 48, 48, 8, 83, 70, 48, 57, 48, 48, 48, 48, 8, 83, 70, 48, 54, +48, 48, 48, 48, 8, 83, 70, 48, 55, 48, 48, 48, 48, 8, 83, 70, 48, 53, 48, 48, 48, 48, 8, 83, 70, +52, 51, 48, 48, 48, 48, 8, 83, 70, 50, 52, 48, 48, 48, 48, 8, 83, 70, 53, 49, 48, 48, 48, 48, 8, +83, 70, 53, 50, 48, 48, 48, 48, 8, 83, 70, 51, 57, 48, 48, 48, 48, 8, 83, 70, 50, 50, 48, 48, 48, +48, 8, 83, 70, 50, 49, 48, 48, 48, 48, 8, 83, 70, 50, 53, 48, 48, 48, 48, 8, 83, 70, 53, 48, 48, +48, 48, 48, 8, 83, 70, 52, 57, 48, 48, 48, 48, 8, 83, 70, 51, 56, 48, 48, 48, 48, 8, 83, 70, 50, +56, 48, 48, 48, 48, 8, 83, 70, 50, 55, 48, 48, 48, 48, 8, 83, 70, 50, 54, 48, 48, 48, 48, 8, 83, +70, 51, 54, 48, 48, 48, 48, 8, 83, 70, 51, 55, 48, 48, 48, 48, 8, 83, 70, 52, 50, 48, 48, 48, 48, +8, 83, 70, 49, 57, 48, 48, 48, 48, 8, 83, 70, 50, 48, 48, 48, 48, 48, 8, 83, 70, 50, 51, 48, 48, +48, 48, 8, 83, 70, 52, 55, 48, 48, 48, 48, 8, 83, 70, 52, 56, 48, 48, 48, 48, 8, 83, 70, 52, 49, +48, 48, 48, 48, 8, 83, 70, 52, 53, 48, 48, 48, 48, 8, 83, 70, 52, 54, 48, 48, 48, 48, 8, 83, 70, +52, 48, 48, 48, 48, 48, 8, 83, 70, 53, 52, 48, 48, 48, 48, 8, 83, 70, 53, 51, 48, 48, 48, 48, 8, +83, 70, 52, 52, 48, 48, 48, 48, 7, 117, 112, 98, 108, 111, 99, 107, 7, 100, 110, 98, 108, 111, 99, 107, 5, +98, 108, 111, 99, 107, 7, 108, 102, 98, 108, 111, 99, 107, 7, 114, 116, 98, 108, 111, 99, 107, 7, 108, 116, 115, +104, 97, 100, 101, 5, 115, 104, 97, 100, 101, 7, 100, 107, 115, 104, 97, 100, 101, 9, 102, 105, 108, 108, 101, 100, +98, 111, 120, 10, 102, 105, 108, 108, 101, 100, 114, 101, 99, 116, 7, 116, 114, 105, 97, 103, 117, 112, 7, 116, 114, +105, 97, 103, 114, 116, 7, 116, 114, 105, 97, 103, 100, 110, 7, 116, 114, 105, 97, 103, 108, 102, 6, 99, 105, 114, +99, 108, 101, 9, 105, 110, 118, 98, 117, 108, 108, 101, 116, 9, 105, 110, 118, 99, 105, 114, 99, 108, 101, 9, 115, +109, 105, 108, 101, 102, 97, 99, 101, 12, 105, 110, 118, 115, 109, 105, 108, 101, 102, 97, 99, 101, 3, 115, 117, 110, +6, 102, 101, 109, 97, 108, 101, 4, 109, 97, 108, 101, 5, 115, 112, 97, 100, 101, 4, 99, 108, 117, 98, 5, 104, +101, 97, 114, 116, 7, 100, 105, 97, 109, 111, 110, 100, 11, 109, 117, 115, 105, 99, 97, 108, 110, 111, 116, 101, 14, +109, 117, 115, 105, 99, 97, 108, 110, 111, 116, 101, 100, 98, 108, 2, 73, 74, 2, 105, 106, 11, 110, 97, 112, 111, +115, 116, 114, 111, 112, 104, 101, 6, 109, 105, 110, 117, 116, 101, 6, 115, 101, 99, 111, 110, 100, 9, 97, 102, 105, +105, 54, 49, 50, 52, 56, 9, 97, 102, 105, 105, 54, 49, 50, 56, 57, 6, 72, 50, 50, 48, 55, 51, 6, 72, +49, 56, 53, 52, 51, 6, 72, 49, 56, 53, 53, 49, 6, 72, 49, 56, 53, 51, 51, 10, 111, 112, 101, 110, 98, +117, 108, 108, 101, 116, 7, 65, 109, 97, 99, 114, 111, 110, 7, 97, 109, 97, 99, 114, 111, 110, 11, 67, 99, 105, +114, 99, 117, 109, 102, 108, 101, 120, 11, 99, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 4, 67, 100, 111, 116, +4, 99, 100, 111, 116, 7, 69, 109, 97, 99, 114, 111, 110, 7, 101, 109, 97, 99, 114, 111, 110, 6, 69, 98, 114, +101, 118, 101, 6, 101, 98, 114, 101, 118, 101, 4, 69, 100, 111, 116, 4, 101, 100, 111, 116, 11, 71, 99, 105, 114, +99, 117, 109, 102, 108, 101, 120, 11, 103, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 4, 71, 100, 111, 116, 4, +103, 100, 111, 116, 8, 71, 99, 101, 100, 105, 108, 108, 97, 8, 103, 99, 101, 100, 105, 108, 108, 97, 11, 72, 99, +105, 114, 99, 117, 109, 102, 108, 101, 120, 11, 104, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 4, 72, 98, 97, +114, 4, 104, 98, 97, 114, 6, 73, 116, 105, 108, 100, 101, 6, 105, 116, 105, 108, 100, 101, 7, 73, 109, 97, 99, +114, 111, 110, 7, 105, 109, 97, 99, 114, 111, 110, 6, 73, 98, 114, 101, 118, 101, 6, 105, 98, 114, 101, 118, 101, +7, 73, 111, 103, 111, 110, 101, 107, 7, 105, 111, 103, 111, 110, 101, 107, 11, 74, 99, 105, 114, 99, 117, 109, 102, +108, 101, 120, 11, 106, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 8, 75, 99, 101, 100, 105, 108, 108, 97, 8, +107, 99, 101, 100, 105, 108, 108, 97, 12, 107, 103, 114, 101, 101, 110, 108, 97, 110, 100, 105, 99, 8, 76, 99, 101, +100, 105, 108, 108, 97, 8, 108, 99, 101, 100, 105, 108, 108, 97, 8, 78, 99, 101, 100, 105, 108, 108, 97, 8, 110, +99, 101, 100, 105, 108, 108, 97, 3, 69, 110, 103, 3, 101, 110, 103, 7, 79, 109, 97, 99, 114, 111, 110, 7, 111, +109, 97, 99, 114, 111, 110, 6, 79, 98, 114, 101, 118, 101, 6, 111, 98, 114, 101, 118, 101, 8, 82, 99, 101, 100, +105, 108, 108, 97, 8, 114, 99, 101, 100, 105, 108, 108, 97, 11, 83, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, +11, 115, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 4, 84, 98, 97, 114, 4, 116, 98, 97, 114, 6, 85, 116, +105, 108, 100, 101, 6, 117, 116, 105, 108, 100, 101, 7, 85, 109, 97, 99, 114, 111, 110, 7, 117, 109, 97, 99, 114, +111, 110, 6, 85, 98, 114, 101, 118, 101, 6, 117, 98, 114, 101, 118, 101, 7, 85, 111, 103, 111, 110, 101, 107, 7, +117, 111, 103, 111, 110, 101, 107, 11, 87, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 11, 119, 99, 105, 114, 99, +117, 109, 102, 108, 101, 120, 11, 89, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 11, 121, 99, 105, 114, 99, 117, +109, 102, 108, 101, 120, 5, 108, 111, 110, 103, 115, 10, 65, 114, 105, 110, 103, 97, 99, 117, 116, 101, 10, 97, 114, +105, 110, 103, 97, 99, 117, 116, 101, 7, 65, 69, 97, 99, 117, 116, 101, 7, 97, 101, 97, 99, 117, 116, 101, 11, +79, 115, 108, 97, 115, 104, 97, 99, 117, 116, 101, 11, 111, 115, 108, 97, 115, 104, 97, 99, 117, 116, 101, 9, 97, +110, 111, 116, 101, 108, 101, 105, 97, 6, 87, 103, 114, 97, 118, 101, 6, 119, 103, 114, 97, 118, 101, 6, 87, 97, +99, 117, 116, 101, 6, 119, 97, 99, 117, 116, 101, 9, 87, 100, 105, 101, 114, 101, 115, 105, 115, 9, 119, 100, 105, +101, 114, 101, 115, 105, 115, 6, 89, 103, 114, 97, 118, 101, 6, 121, 103, 114, 97, 118, 101, 13, 113, 117, 111, 116, +101, 114, 101, 118, 101, 114, 115, 101, 100, 9, 114, 97, 100, 105, 99, 97, 108, 101, 120, 9, 97, 102, 105, 105, 48, +56, 57, 52, 49, 9, 101, 115, 116, 105, 109, 97, 116, 101, 100, 9, 111, 110, 101, 101, 105, 103, 104, 116, 104, 12, +116, 104, 114, 101, 101, 101, 105, 103, 104, 116, 104, 115, 11, 102, 105, 118, 101, 101, 105, 103, 104, 116, 104, 115, 12, +115, 101, 118, 101, 110, 101, 105, 103, 104, 116, 104, 115, 11, 99, 111, 109, 109, 97, 97, 99, 99, 101, 110, 116, 16, +117, 110, 100, 101, 114, 99, 111, 109, 109, 97, 97, 99, 99, 101, 110, 116, 5, 116, 111, 110, 111, 115, 13, 100, 105, +101, 114, 101, 115, 105, 115, 116, 111, 110, 111, 115, 10, 65, 108, 112, 104, 97, 116, 111, 110, 111, 115, 12, 69, 112, +115, 105, 108, 111, 110, 116, 111, 110, 111, 115, 8, 69, 116, 97, 116, 111, 110, 111, 115, 9, 73, 111, 116, 97, 116, +111, 110, 111, 115, 12, 79, 109, 105, 99, 114, 111, 110, 116, 111, 110, 111, 115, 12, 85, 112, 115, 105, 108, 111, 110, +116, 111, 110, 111, 115, 10, 79, 109, 101, 103, 97, 116, 111, 110, 111, 115, 17, 105, 111, 116, 97, 100, 105, 101, 114, +101, 115, 105, 115, 116, 111, 110, 111, 115, 5, 65, 108, 112, 104, 97, 4, 66, 101, 116, 97, 5, 68, 101, 108, 116, +97, 7, 69, 112, 115, 105, 108, 111, 110, 4, 90, 101, 116, 97, 3, 69, 116, 97, 4, 73, 111, 116, 97, 5, 75, +97, 112, 112, 97, 6, 76, 97, 109, 98, 100, 97, 2, 77, 117, 2, 78, 117, 2, 88, 105, 7, 79, 109, 105, 99, +114, 111, 110, 2, 80, 105, 3, 82, 104, 111, 5, 83, 105, 103, 109, 97, 3, 84, 97, 117, 7, 85, 112, 115, 105, +108, 111, 110, 3, 67, 104, 105, 3, 80, 115, 105, 12, 73, 111, 116, 97, 100, 105, 101, 114, 101, 115, 105, 115, 15, +85, 112, 115, 105, 108, 111, 110, 100, 105, 101, 114, 101, 115, 105, 115, 10, 97, 108, 112, 104, 97, 116, 111, 110, 111, +115, 12, 101, 112, 115, 105, 108, 111, 110, 116, 111, 110, 111, 115, 8, 101, 116, 97, 116, 111, 110, 111, 115, 9, 105, +111, 116, 97, 116, 111, 110, 111, 115, 20, 117, 112, 115, 105, 108, 111, 110, 100, 105, 101, 114, 101, 115, 105, 115, 116, +111, 110, 111, 115, 4, 98, 101, 116, 97, 5, 103, 97, 109, 109, 97, 4, 122, 101, 116, 97, 3, 101, 116, 97, 5, +116, 104, 101, 116, 97, 4, 105, 111, 116, 97, 5, 107, 97, 112, 112, 97, 6, 108, 97, 109, 98, 100, 97, 2, 110, +117, 2, 120, 105, 7, 111, 109, 105, 99, 114, 111, 110, 3, 114, 104, 111, 6, 115, 105, 103, 109, 97, 49, 7, 117, +112, 115, 105, 108, 111, 110, 3, 99, 104, 105, 3, 112, 115, 105, 5, 111, 109, 101, 103, 97, 12, 105, 111, 116, 97, +100, 105, 101, 114, 101, 115, 105, 115, 15, 117, 112, 115, 105, 108, 111, 110, 100, 105, 101, 114, 101, 115, 105, 115, 12, +111, 109, 105, 99, 114, 111, 110, 116, 111, 110, 111, 115, 12, 117, 112, 115, 105, 108, 111, 110, 116, 111, 110, 111, 115, +10, 111, 109, 101, 103, 97, 116, 111, 110, 111, 115, 9, 97, 102, 105, 105, 49, 48, 48, 50, 51, 9, 97, 102, 105, +105, 49, 48, 48, 53, 49, 9, 97, 102, 105, 105, 49, 48, 48, 53, 50, 9, 97, 102, 105, 105, 49, 48, 48, 53, +51, 9, 97, 102, 105, 105, 49, 48, 48, 53, 52, 9, 97, 102, 105, 105, 49, 48, 48, 53, 53, 9, 97, 102, 105, +105, 49, 48, 48, 53, 54, 9, 97, 102, 105, 105, 49, 48, 48, 53, 55, 9, 97, 102, 105, 105, 49, 48, 48, 53, +56, 9, 97, 102, 105, 105, 49, 48, 48, 53, 57, 9, 97, 102, 105, 105, 49, 48, 48, 54, 48, 9, 97, 102, 105, +105, 49, 48, 48, 54, 49, 9, 97, 102, 105, 105, 49, 48, 48, 54, 50, 9, 97, 102, 105, 105, 49, 48, 49, 52, +53, 9, 97, 102, 105, 105, 49, 48, 48, 49, 55, 9, 97, 102, 105, 105, 49, 48, 48, 49, 56, 9, 97, 102, 105, +105, 49, 48, 48, 49, 57, 9, 97, 102, 105, 105, 49, 48, 48, 50, 48, 9, 97, 102, 105, 105, 49, 48, 48, 50, +49, 9, 97, 102, 105, 105, 49, 48, 48, 50, 50, 9, 97, 102, 105, 105, 49, 48, 48, 50, 52, 9, 97, 102, 105, +105, 49, 48, 48, 50, 53, 9, 97, 102, 105, 105, 49, 48, 48, 50, 54, 9, 97, 102, 105, 105, 49, 48, 48, 50, +55, 9, 97, 102, 105, 105, 49, 48, 48, 50, 56, 9, 97, 102, 105, 105, 49, 48, 48, 50, 57, 9, 97, 102, 105, +105, 49, 48, 48, 51, 48, 9, 97, 102, 105, 105, 49, 48, 48, 51, 49, 9, 97, 102, 105, 105, 49, 48, 48, 51, +50, 9, 97, 102, 105, 105, 49, 48, 48, 51, 51, 9, 97, 102, 105, 105, 49, 48, 48, 51, 52, 9, 97, 102, 105, +105, 49, 48, 48, 51, 53, 9, 97, 102, 105, 105, 49, 48, 48, 51, 54, 9, 97, 102, 105, 105, 49, 48, 48, 51, +55, 9, 97, 102, 105, 105, 49, 48, 48, 51, 56, 9, 97, 102, 105, 105, 49, 48, 48, 51, 57, 9, 97, 102, 105, +105, 49, 48, 48, 52, 48, 9, 97, 102, 105, 105, 49, 48, 48, 52, 49, 9, 97, 102, 105, 105, 49, 48, 48, 52, +50, 9, 97, 102, 105, 105, 49, 48, 48, 52, 51, 9, 97, 102, 105, 105, 49, 48, 48, 52, 52, 9, 97, 102, 105, +105, 49, 48, 48, 52, 53, 9, 97, 102, 105, 105, 49, 48, 48, 52, 54, 9, 97, 102, 105, 105, 49, 48, 48, 52, +55, 9, 97, 102, 105, 105, 49, 48, 48, 52, 56, 9, 97, 102, 105, 105, 49, 48, 48, 52, 57, 9, 97, 102, 105, +105, 49, 48, 48, 54, 53, 9, 97, 102, 105, 105, 49, 48, 48, 54, 54, 9, 97, 102, 105, 105, 49, 48, 48, 54, +55, 9, 97, 102, 105, 105, 49, 48, 48, 54, 56, 9, 97, 102, 105, 105, 49, 48, 48, 54, 57, 9, 97, 102, 105, +105, 49, 48, 48, 55, 48, 9, 97, 102, 105, 105, 49, 48, 48, 55, 50, 9, 97, 102, 105, 105, 49, 48, 48, 55, +51, 9, 97, 102, 105, 105, 49, 48, 48, 55, 52, 9, 97, 102, 105, 105, 49, 48, 48, 55, 53, 9, 97, 102, 105, +105, 49, 48, 48, 55, 54, 9, 97, 102, 105, 105, 49, 48, 48, 55, 55, 9, 97, 102, 105, 105, 49, 48, 48, 55, +56, 9, 97, 102, 105, 105, 49, 48, 48, 55, 57, 9, 97, 102, 105, 105, 49, 48, 48, 56, 48, 9, 97, 102, 105, +105, 49, 48, 48, 56, 49, 9, 97, 102, 105, 105, 49, 48, 48, 56, 50, 9, 97, 102, 105, 105, 49, 48, 48, 56, +51, 9, 97, 102, 105, 105, 49, 48, 48, 56, 52, 9, 97, 102, 105, 105, 49, 48, 48, 56, 53, 9, 97, 102, 105, +105, 49, 48, 48, 56, 54, 9, 97, 102, 105, 105, 49, 48, 48, 56, 55, 9, 97, 102, 105, 105, 49, 48, 48, 56, +56, 9, 97, 102, 105, 105, 49, 48, 48, 56, 57, 9, 97, 102, 105, 105, 49, 48, 48, 57, 48, 9, 97, 102, 105, +105, 49, 48, 48, 57, 49, 9, 97, 102, 105, 105, 49, 48, 48, 57, 50, 9, 97, 102, 105, 105, 49, 48, 48, 57, +51, 9, 97, 102, 105, 105, 49, 48, 48, 57, 52, 9, 97, 102, 105, 105, 49, 48, 48, 57, 53, 9, 97, 102, 105, +105, 49, 48, 48, 57, 54, 9, 97, 102, 105, 105, 49, 48, 48, 57, 55, 9, 97, 102, 105, 105, 49, 48, 48, 55, +49, 9, 97, 102, 105, 105, 49, 48, 48, 57, 57, 9, 97, 102, 105, 105, 49, 48, 49, 48, 48, 9, 97, 102, 105, +105, 49, 48, 49, 48, 49, 9, 97, 102, 105, 105, 49, 48, 49, 48, 50, 9, 97, 102, 105, 105, 49, 48, 49, 48, +51, 9, 97, 102, 105, 105, 49, 48, 49, 48, 52, 9, 97, 102, 105, 105, 49, 48, 49, 48, 53, 9, 97, 102, 105, +105, 49, 48, 49, 48, 54, 9, 97, 102, 105, 105, 49, 48, 49, 48, 55, 9, 97, 102, 105, 105, 49, 48, 49, 48, +56, 9, 97, 102, 105, 105, 49, 48, 49, 48, 57, 9, 97, 102, 105, 105, 49, 48, 49, 49, 48, 9, 97, 102, 105, +105, 49, 48, 49, 57, 51, 9, 97, 102, 105, 105, 49, 48, 48, 53, 48, 9, 97, 102, 105, 105, 49, 48, 48, 57, +56, 9, 97, 102, 105, 105, 48, 48, 50, 48, 56, 9, 97, 102, 105, 105, 54, 49, 51, 53, 50, 5, 115, 104, 101, +118, 97, 10, 104, 97, 116, 97, 102, 115, 101, 103, 111, 108, 10, 104, 97, 116, 97, 102, 112, 97, 116, 97, 104, 11, +104, 97, 116, 97, 102, 113, 97, 109, 97, 116, 115, 5, 104, 105, 114, 105, 113, 5, 116, 115, 101, 114, 101, 5, 115, +101, 103, 111, 108, 5, 112, 97, 116, 97, 104, 6, 113, 97, 109, 97, 116, 115, 5, 104, 111, 108, 97, 109, 6, 113, +117, 98, 117, 116, 115, 6, 100, 97, 103, 101, 115, 104, 5, 109, 101, 116, 101, 103, 5, 109, 97, 113, 97, 102, 4, +114, 97, 102, 101, 5, 112, 97, 115, 101, 113, 7, 115, 104, 105, 110, 100, 111, 116, 6, 115, 105, 110, 100, 111, 116, +8, 115, 111, 102, 112, 97, 115, 117, 113, 4, 97, 108, 101, 102, 3, 98, 101, 116, 5, 103, 105, 109, 101, 108, 5, +100, 97, 108, 101, 116, 2, 104, 101, 3, 118, 97, 118, 5, 122, 97, 121, 105, 110, 3, 104, 101, 116, 3, 116, 101, +116, 3, 121, 111, 100, 8, 102, 105, 110, 97, 108, 107, 97, 102, 3, 107, 97, 102, 5, 108, 97, 109, 101, 100, 8, +102, 105, 110, 97, 108, 109, 101, 109, 3, 109, 101, 109, 8, 102, 105, 110, 97, 108, 110, 117, 110, 3, 110, 117, 110, +6, 115, 97, 109, 101, 107, 104, 4, 97, 121, 105, 110, 7, 102, 105, 110, 97, 108, 112, 101, 2, 112, 101, 10, 102, +105, 110, 97, 108, 116, 115, 97, 100, 105, 5, 116, 115, 97, 100, 105, 3, 113, 111, 102, 4, 114, 101, 115, 104, 4, +115, 104, 105, 110, 3, 116, 97, 118, 9, 100, 111, 117, 98, 108, 101, 118, 97, 118, 6, 118, 97, 118, 121, 111, 100, +9, 100, 111, 117, 98, 108, 101, 121, 111, 100, 6, 103, 101, 114, 101, 115, 104, 9, 103, 101, 114, 115, 104, 97, 121, +105, 109, 13, 110, 101, 119, 115, 104, 101, 113, 101, 108, 115, 105, 103, 110, 10, 118, 97, 118, 115, 104, 105, 110, 100, +111, 116, 13, 102, 105, 110, 97, 108, 107, 97, 102, 115, 104, 101, 118, 97, 14, 102, 105, 110, 97, 108, 107, 97, 102, +113, 97, 109, 97, 116, 115, 10, 108, 97, 109, 101, 100, 104, 111, 108, 97, 109, 16, 108, 97, 109, 101, 100, 104, 111, +108, 97, 109, 100, 97, 103, 101, 115, 104, 7, 97, 108, 116, 97, 121, 105, 110, 11, 115, 104, 105, 110, 115, 104, 105, +110, 100, 111, 116, 10, 115, 104, 105, 110, 115, 105, 110, 100, 111, 116, 17, 115, 104, 105, 110, 100, 97, 103, 101, 115, +104, 115, 104, 105, 110, 100, 111, 116, 16, 115, 104, 105, 110, 100, 97, 103, 101, 115, 104, 115, 105, 110, 100, 111, 116, +9, 97, 108, 101, 102, 112, 97, 116, 97, 104, 10, 97, 108, 101, 102, 113, 97, 109, 97, 116, 115, 9, 97, 108, 101, +102, 109, 97, 112, 105, 113, 9, 98, 101, 116, 100, 97, 103, 101, 115, 104, 11, 103, 105, 109, 101, 108, 100, 97, 103, +101, 115, 104, 11, 100, 97, 108, 101, 116, 100, 97, 103, 101, 115, 104, 8, 104, 101, 100, 97, 103, 101, 115, 104, 9, +118, 97, 118, 100, 97, 103, 101, 115, 104, 11, 122, 97, 121, 105, 110, 100, 97, 103, 101, 115, 104, 9, 116, 101, 116, +100, 97, 103, 101, 115, 104, 9, 121, 111, 100, 100, 97, 103, 101, 115, 104, 14, 102, 105, 110, 97, 108, 107, 97, 102, +100, 97, 103, 101, 115, 104, 9, 107, 97, 102, 100, 97, 103, 101, 115, 104, 11, 108, 97, 109, 101, 100, 100, 97, 103, +101, 115, 104, 9, 109, 101, 109, 100, 97, 103, 101, 115, 104, 9, 110, 117, 110, 100, 97, 103, 101, 115, 104, 12, 115, +97, 109, 101, 107, 104, 100, 97, 103, 101, 115, 104, 13, 102, 105, 110, 97, 108, 112, 101, 100, 97, 103, 101, 115, 104, +8, 112, 101, 100, 97, 103, 101, 115, 104, 11, 116, 115, 97, 100, 105, 100, 97, 103, 101, 115, 104, 9, 113, 111, 102, +100, 97, 103, 101, 115, 104, 10, 114, 101, 115, 104, 100, 97, 103, 101, 115, 104, 10, 115, 104, 105, 110, 100, 97, 103, +101, 115, 104, 8, 116, 97, 118, 100, 97, 103, 101, 115, 8, 118, 97, 118, 104, 111, 108, 97, 109, 7, 98, 101, 116, +114, 97, 102, 101, 7, 107, 97, 102, 114, 97, 102, 101, 6, 112, 101, 114, 97, 102, 101, 9, 97, 108, 101, 102, 108, +97, 109, 101, 100, 18, 122, 101, 114, 111, 119, 105, 100, 116, 104, 110, 111, 110, 106, 111, 105, 110, 101, 114, 15, 122, +101, 114, 111, 119, 105, 100, 116, 104, 106, 111, 105, 110, 101, 114, 15, 108, 101, 102, 116, 116, 111, 114, 105, 103, 104, +116, 109, 97, 114, 107, 15, 114, 105, 103, 104, 116, 116, 111, 108, 101, 102, 116, 109, 97, 114, 107, 9, 97, 102, 105, +105, 53, 55, 51, 56, 56, 9, 97, 102, 105, 105, 53, 55, 52, 48, 51, 9, 97, 102, 105, 105, 53, 55, 52, 48, +55, 9, 97, 102, 105, 105, 53, 55, 52, 48, 57, 9, 97, 102, 105, 105, 53, 55, 52, 52, 48, 9, 97, 102, 105, +105, 53, 55, 52, 53, 49, 9, 97, 102, 105, 105, 53, 55, 52, 53, 50, 9, 97, 102, 105, 105, 53, 55, 52, 53, +51, 9, 97, 102, 105, 105, 53, 55, 52, 53, 52, 9, 97, 102, 105, 105, 53, 55, 52, 53, 53, 9, 97, 102, 105, +105, 53, 55, 52, 53, 54, 9, 97, 102, 105, 105, 53, 55, 52, 53, 55, 9, 97, 102, 105, 105, 53, 55, 52, 53, +56, 9, 97, 102, 105, 105, 53, 55, 51, 57, 50, 9, 97, 102, 105, 105, 53, 55, 51, 57, 51, 9, 97, 102, 105, +105, 53, 55, 51, 57, 52, 9, 97, 102, 105, 105, 53, 55, 51, 57, 53, 9, 97, 102, 105, 105, 53, 55, 51, 57, +54, 9, 97, 102, 105, 105, 53, 55, 51, 57, 55, 9, 97, 102, 105, 105, 53, 55, 51, 57, 56, 9, 97, 102, 105, +105, 53, 55, 51, 57, 57, 9, 97, 102, 105, 105, 53, 55, 52, 48, 48, 9, 97, 102, 105, 105, 53, 55, 52, 48, +49, 9, 97, 102, 105, 105, 53, 55, 51, 56, 49, 9, 97, 102, 105, 105, 53, 55, 52, 54, 49, 9, 97, 102, 105, +105, 54, 51, 49, 54, 55, 9, 97, 102, 105, 105, 53, 55, 52, 53, 57, 9, 97, 102, 105, 105, 53, 55, 53, 52, +51, 9, 97, 102, 105, 105, 53, 55, 53, 51, 52, 9, 97, 102, 105, 105, 53, 55, 52, 57, 52, 9, 97, 102, 105, +105, 54, 50, 56, 52, 51, 9, 97, 102, 105, 105, 54, 50, 56, 52, 52, 9, 97, 102, 105, 105, 54, 50, 56, 52, +53, 9, 97, 102, 105, 105, 54, 52, 50, 52, 48, 9, 97, 102, 105, 105, 54, 52, 50, 52, 49, 9, 97, 102, 105, +105, 54, 51, 57, 53, 52, 9, 97, 102, 105, 105, 53, 55, 51, 56, 50, 9, 97, 102, 105, 105, 54, 52, 50, 52, +50, 9, 97, 102, 105, 105, 54, 50, 56, 56, 49, 9, 97, 102, 105, 105, 53, 55, 53, 48, 52, 9, 97, 102, 105, +105, 53, 55, 51, 54, 57, 9, 97, 102, 105, 105, 53, 55, 51, 55, 48, 9, 97, 102, 105, 105, 53, 55, 51, 55, +49, 9, 97, 102, 105, 105, 53, 55, 51, 55, 50, 9, 97, 102, 105, 105, 53, 55, 51, 55, 51, 9, 97, 102, 105, +105, 53, 55, 51, 55, 52, 9, 97, 102, 105, 105, 53, 55, 51, 55, 53, 9, 97, 102, 105, 105, 53, 55, 51, 57, +49, 9, 97, 102, 105, 105, 53, 55, 52, 55, 49, 9, 97, 102, 105, 105, 53, 55, 52, 54, 48, 9, 97, 102, 105, +105, 53, 50, 50, 53, 56, 9, 97, 102, 105, 105, 53, 55, 53, 48, 54, 9, 97, 102, 105, 105, 54, 50, 57, 53, +56, 9, 97, 102, 105, 105, 54, 50, 57, 53, 54, 9, 97, 102, 105, 105, 53, 50, 57, 53, 55, 9, 97, 102, 105, +105, 53, 55, 53, 48, 53, 9, 97, 102, 105, 105, 54, 50, 56, 56, 57, 9, 97, 102, 105, 105, 54, 50, 56, 56, +55, 9, 97, 102, 105, 105, 54, 50, 56, 56, 56, 9, 97, 102, 105, 105, 53, 55, 53, 48, 55, 9, 97, 102, 105, +105, 54, 50, 57, 54, 49, 9, 97, 102, 105, 105, 54, 50, 57, 53, 57, 9, 97, 102, 105, 105, 54, 50, 57, 54, +48, 9, 97, 102, 105, 105, 53, 55, 53, 48, 56, 9, 97, 102, 105, 105, 54, 50, 57, 54, 50, 9, 97, 102, 105, +105, 53, 55, 53, 54, 55, 9, 97, 102, 105, 105, 54, 50, 57, 54, 52, 9, 97, 102, 105, 105, 53, 50, 51, 48, +53, 9, 97, 102, 105, 105, 53, 50, 51, 48, 54, 9, 97, 102, 105, 105, 53, 55, 53, 48, 57, 9, 97, 102, 105, +105, 54, 50, 57, 54, 55, 9, 97, 102, 105, 105, 54, 50, 57, 54, 53, 9, 97, 102, 105, 105, 54, 50, 57, 54, +54, 9, 97, 102, 105, 105, 53, 55, 53, 53, 53, 9, 97, 102, 105, 105, 53, 50, 51, 54, 52, 9, 97, 102, 105, +105, 54, 51, 55, 53, 51, 9, 97, 102, 105, 105, 54, 51, 55, 53, 52, 9, 97, 102, 105, 105, 54, 51, 55, 53, +57, 9, 97, 102, 105, 105, 54, 51, 55, 54, 51, 9, 97, 102, 105, 105, 54, 51, 55, 57, 53, 9, 97, 102, 105, +105, 54, 50, 56, 57, 49, 9, 97, 102, 105, 105, 54, 51, 56, 48, 56, 9, 97, 102, 105, 105, 54, 50, 57, 51, +56, 9, 97, 102, 105, 105, 54, 51, 56, 49, 48, 9, 97, 102, 105, 105, 54, 50, 57, 52, 50, 9, 97, 102, 105, +105, 54, 50, 57, 52, 55, 9, 97, 102, 105, 105, 54, 51, 56, 49, 51, 9, 97, 102, 105, 105, 54, 51, 56, 50, +51, 9, 97, 102, 105, 105, 54, 51, 56, 50, 52, 9, 97, 102, 105, 105, 54, 51, 56, 51, 51, 9, 97, 102, 105, +105, 54, 51, 56, 52, 52, 9, 97, 102, 105, 105, 54, 50, 56, 56, 50, 9, 97, 102, 105, 105, 54, 50, 56, 56, +51, 9, 97, 102, 105, 105, 54, 50, 56, 56, 52, 9, 97, 102, 105, 105, 54, 50, 56, 56, 53, 9, 97, 102, 105, +105, 54, 50, 56, 56, 54, 9, 97, 102, 105, 105, 54, 51, 56, 52, 54, 9, 97, 102, 105, 105, 54, 51, 56, 52, +57, 7, 117, 110, 105, 50, 48, 50, 65, 7, 117, 110, 105, 50, 48, 50, 66, 7, 117, 110, 105, 50, 48, 50, 68, +7, 117, 110, 105, 50, 48, 50, 69, 7, 117, 110, 105, 50, 48, 50, 67, 7, 117, 110, 105, 50, 48, 54, 69, 8, +117, 110, 105, 50, 48, 54, 70, 59, 7, 117, 110, 105, 50, 48, 54, 65, 7, 117, 110, 105, 50, 48, 54, 66, 8, +117, 110, 105, 50, 48, 54, 67, 59, 7, 117, 110, 105, 50, 48, 54, 68, 7, 117, 110, 105, 70, 48, 48, 65, 7, +117, 110, 105, 70, 48, 48, 66, 7, 117, 110, 105, 70, 48, 48, 67, 7, 117, 110, 105, 70, 48, 48, 68, 7, 117, +110, 105, 70, 48, 48, 69, 7, 117, 110, 105, 70, 70, 70, 67, 9, 97, 102, 105, 105, 54, 51, 57, 48, 52, 9, +97, 102, 105, 105, 54, 51, 57, 48, 53, 9, 97, 102, 105, 105, 54, 51, 57, 48, 54, 9, 97, 102, 105, 105, 54, +51, 57, 48, 56, 9, 97, 102, 105, 105, 54, 51, 57, 49, 48, 9, 97, 102, 105, 105, 54, 51, 57, 49, 50, 9, +97, 102, 105, 105, 54, 50, 57, 50, 55, 9, 97, 102, 105, 105, 54, 51, 57, 52, 49, 9, 97, 102, 105, 105, 54, +50, 57, 51, 57, 9, 97, 102, 105, 105, 54, 51, 57, 52, 51, 9, 97, 102, 105, 105, 54, 50, 57, 52, 51, 9, +97, 102, 105, 105, 54, 50, 57, 52, 54, 9, 97, 102, 105, 105, 54, 51, 57, 52, 54, 9, 97, 102, 105, 105, 54, +50, 57, 53, 49, 9, 97, 102, 105, 105, 54, 51, 57, 52, 56, 9, 97, 102, 105, 105, 54, 50, 57, 53, 51, 9, +97, 102, 105, 105, 54, 51, 57, 53, 48, 9, 97, 102, 105, 105, 54, 51, 57, 53, 49, 9, 97, 102, 105, 105, 54, +51, 57, 53, 50, 9, 97, 102, 105, 105, 54, 51, 57, 53, 51, 9, 97, 102, 105, 105, 54, 51, 57, 53, 54, 9, +97, 102, 105, 105, 54, 51, 57, 53, 56, 9, 97, 102, 105, 105, 54, 51, 57, 53, 57, 9, 97, 102, 105, 105, 54, +51, 57, 54, 48, 9, 97, 102, 105, 105, 54, 51, 57, 54, 49, 9, 97, 102, 105, 105, 54, 52, 48, 52, 54, 9, +97, 102, 105, 105, 54, 52, 48, 53, 56, 9, 97, 102, 105, 105, 54, 52, 48, 53, 57, 9, 97, 102, 105, 105, 54, +52, 48, 54, 48, 9, 97, 102, 105, 105, 54, 52, 48, 54, 49, 9, 97, 102, 105, 105, 54, 50, 57, 52, 53, 9, +97, 102, 105, 105, 54, 52, 49, 56, 52, 9, 97, 102, 105, 105, 53, 50, 51, 57, 57, 9, 97, 102, 105, 105, 53, +50, 52, 48, 48, 9, 97, 102, 105, 105, 54, 50, 55, 53, 51, 9, 97, 102, 105, 105, 53, 55, 52, 49, 49, 9, +97, 102, 105, 105, 54, 50, 55, 53, 52, 9, 97, 102, 105, 105, 53, 55, 52, 49, 50, 9, 97, 102, 105, 105, 54, +50, 55, 53, 53, 9, 97, 102, 105, 105, 53, 55, 52, 49, 51, 9, 97, 102, 105, 105, 54, 50, 55, 53, 54, 9, +97, 102, 105, 105, 53, 55, 52, 49, 52, 9, 97, 102, 105, 105, 54, 50, 55, 53, 57, 9, 97, 102, 105, 105, 54, +50, 55, 53, 55, 9, 97, 102, 105, 105, 54, 50, 55, 53, 56, 9, 97, 102, 105, 105, 53, 55, 52, 49, 53, 9, +97, 102, 105, 105, 54, 50, 55, 54, 48, 9, 97, 102, 105, 105, 53, 55, 52, 49, 54, 9, 97, 102, 105, 105, 54, +50, 55, 54, 51, 9, 97, 102, 105, 105, 54, 50, 55, 54, 49, 9, 97, 102, 105, 105, 54, 50, 55, 54, 50, 9, +97, 102, 105, 105, 53, 55, 52, 49, 55, 9, 97, 102, 105, 105, 54, 50, 55, 54, 52, 9, 97, 102, 105, 105, 53, +55, 52, 49, 56, 9, 97, 102, 105, 105, 54, 50, 55, 54, 55, 9, 97, 102, 105, 105, 54, 50, 55, 54, 53, 9, +97, 102, 105, 105, 54, 50, 55, 54, 54, 9, 97, 102, 105, 105, 53, 55, 52, 49, 57, 9, 97, 102, 105, 105, 54, +50, 55, 55, 48, 9, 97, 102, 105, 105, 54, 50, 55, 54, 56, 9, 97, 102, 105, 105, 54, 50, 55, 54, 57, 9, +97, 102, 105, 105, 53, 55, 52, 50, 48, 9, 97, 102, 105, 105, 54, 50, 55, 55, 51, 9, 97, 102, 105, 105, 54, +50, 55, 55, 49, 9, 97, 102, 105, 105, 54, 50, 55, 55, 50, 9, 97, 102, 105, 105, 53, 55, 52, 50, 49, 9, +97, 102, 105, 105, 54, 50, 55, 55, 54, 9, 97, 102, 105, 105, 54, 50, 55, 55, 52, 9, 97, 102, 105, 105, 54, +50, 55, 55, 53, 9, 97, 102, 105, 105, 53, 55, 52, 50, 50, 9, 97, 102, 105, 105, 54, 50, 55, 55, 57, 9, +97, 102, 105, 105, 54, 50, 55, 55, 55, 9, 97, 102, 105, 105, 54, 50, 55, 55, 56, 9, 97, 102, 105, 105, 53, +55, 52, 50, 51, 9, 97, 102, 105, 105, 54, 50, 55, 56, 48, 9, 97, 102, 105, 105, 53, 55, 52, 50, 52, 9, +97, 102, 105, 105, 54, 50, 55, 56, 49, 9, 97, 102, 105, 105, 53, 55, 52, 50, 53, 9, 97, 102, 105, 105, 54, +50, 55, 56, 50, 9, 97, 102, 105, 105, 53, 55, 52, 50, 54, 9, 97, 102, 105, 105, 54, 50, 55, 56, 51, 9, +97, 102, 105, 105, 53, 55, 52, 50, 55, 9, 97, 102, 105, 105, 54, 50, 55, 56, 54, 9, 97, 102, 105, 105, 54, +50, 55, 56, 52, 9, 97, 102, 105, 105, 54, 50, 55, 56, 53, 9, 97, 102, 105, 105, 53, 55, 52, 50, 56, 9, +97, 102, 105, 105, 54, 50, 55, 56, 57, 9, 97, 102, 105, 105, 54, 50, 55, 56, 55, 9, 97, 102, 105, 105, 54, +50, 55, 56, 56, 9, 97, 102, 105, 105, 53, 55, 52, 50, 57, 9, 97, 102, 105, 105, 54, 50, 55, 57, 50, 9, +97, 102, 105, 105, 54, 50, 55, 57, 48, 9, 97, 102, 105, 105, 54, 50, 55, 57, 49, 9, 97, 102, 105, 105, 53, +55, 52, 51, 48, 9, 97, 102, 105, 105, 54, 50, 55, 57, 53, 9, 97, 102, 105, 105, 54, 50, 55, 57, 51, 9, +97, 102, 105, 105, 54, 50, 55, 57, 52, 9, 97, 102, 105, 105, 53, 55, 52, 51, 49, 9, 97, 102, 105, 105, 54, +50, 55, 57, 56, 9, 97, 102, 105, 105, 54, 50, 55, 57, 54, 9, 97, 102, 105, 105, 54, 50, 55, 57, 55, 9, +97, 102, 105, 105, 53, 55, 52, 51, 50, 9, 97, 102, 105, 105, 54, 50, 56, 48, 49, 9, 97, 102, 105, 105, 54, +50, 55, 57, 57, 9, 97, 102, 105, 105, 54, 50, 56, 48, 48, 9, 97, 102, 105, 105, 53, 55, 52, 51, 51, 9, +97, 102, 105, 105, 54, 50, 56, 48, 52, 9, 97, 102, 105, 105, 54, 50, 56, 48, 50, 9, 97, 102, 105, 105, 54, +50, 56, 48, 51, 9, 97, 102, 105, 105, 53, 55, 52, 51, 52, 9, 97, 102, 105, 105, 54, 50, 56, 48, 55, 9, +97, 102, 105, 105, 54, 50, 56, 48, 53, 9, 97, 102, 105, 105, 54, 50, 56, 48, 54, 9, 97, 102, 105, 105, 53, +55, 52, 52, 49, 9, 97, 102, 105, 105, 54, 50, 56, 49, 48, 9, 97, 102, 105, 105, 54, 50, 56, 48, 56, 9, +97, 102, 105, 105, 54, 50, 56, 48, 57, 9, 97, 102, 105, 105, 53, 55, 52, 52, 50, 9, 97, 102, 105, 105, 54, +50, 56, 49, 51, 9, 97, 102, 105, 105, 54, 50, 56, 49, 49, 9, 97, 102, 105, 105, 54, 50, 56, 49, 50, 9, +97, 102, 105, 105, 53, 55, 52, 52, 51, 9, 97, 102, 105, 105, 54, 50, 56, 49, 54, 9, 97, 102, 105, 105, 53, +55, 52, 49, 48, 9, 97, 102, 105, 105, 54, 50, 56, 49, 53, 9, 97, 102, 105, 105, 53, 55, 52, 52, 52, 9, +97, 102, 105, 105, 54, 50, 56, 49, 57, 9, 97, 102, 105, 105, 54, 50, 56, 49, 55, 9, 97, 102, 105, 105, 54, +50, 56, 49, 56, 9, 97, 102, 105, 105, 53, 55, 52, 52, 53, 9, 97, 102, 105, 105, 54, 50, 56, 50, 50, 9, +97, 102, 105, 105, 54, 50, 56, 50, 48, 9, 97, 102, 105, 105, 54, 50, 56, 50, 49, 9, 97, 102, 105, 105, 53, +55, 52, 52, 54, 9, 97, 102, 105, 105, 54, 50, 56, 50, 53, 9, 97, 102, 105, 105, 54, 50, 56, 50, 51, 9, +97, 102, 105, 105, 54, 50, 56, 50, 52, 9, 97, 102, 105, 105, 53, 55, 52, 52, 55, 9, 97, 102, 105, 105, 54, +50, 56, 50, 56, 9, 97, 102, 105, 105, 53, 55, 52, 55, 48, 9, 97, 102, 105, 105, 54, 50, 56, 50, 55, 9, +97, 102, 105, 105, 53, 55, 52, 52, 56, 9, 97, 102, 105, 105, 54, 50, 56, 50, 57, 9, 97, 102, 105, 105, 53, +55, 52, 52, 57, 9, 97, 102, 105, 105, 54, 50, 56, 51, 48, 9, 97, 102, 105, 105, 53, 55, 52, 53, 48, 9, +97, 102, 105, 105, 54, 50, 56, 51, 51, 9, 97, 102, 105, 105, 54, 50, 56, 51, 49, 9, 97, 102, 105, 105, 54, +50, 56, 51, 50, 9, 97, 102, 105, 105, 54, 50, 56, 51, 52, 9, 97, 102, 105, 105, 54, 50, 56, 51, 53, 9, +97, 102, 105, 105, 54, 50, 56, 51, 54, 9, 97, 102, 105, 105, 54, 50, 56, 51, 55, 9, 97, 102, 105, 105, 54, +50, 56, 51, 56, 9, 97, 102, 105, 105, 54, 50, 56, 51, 57, 9, 97, 102, 105, 105, 54, 50, 56, 52, 48, 9, +97, 102, 105, 105, 54, 50, 56, 52, 49, 9, 103, 108, 121, 112, 104, 49, 48, 50, 49, 11, 97, 102, 105, 105, 53, +55, 53, 52, 51, 45, 50, 11, 97, 102, 105, 105, 53, 55, 52, 53, 52, 45, 50, 11, 97, 102, 105, 105, 53, 55, +52, 53, 49, 45, 50, 9, 103, 108, 121, 112, 104, 49, 48, 50, 53, 9, 103, 108, 121, 112, 104, 49, 48, 50, 54, +11, 97, 102, 105, 105, 53, 55, 52, 55, 49, 45, 50, 11, 97, 102, 105, 105, 53, 55, 52, 53, 56, 45, 50, 11, +97, 102, 105, 105, 53, 55, 52, 53, 55, 45, 50, 11, 97, 102, 105, 105, 53, 55, 52, 57, 52, 45, 50, 11, 97, +102, 105, 105, 53, 55, 52, 53, 57, 45, 50, 11, 97, 102, 105, 105, 53, 55, 52, 53, 53, 45, 50, 11, 97, 102, +105, 105, 53, 55, 52, 53, 50, 45, 50, 9, 103, 108, 121, 112, 104, 49, 48, 51, 52, 9, 103, 108, 121, 112, 104, +49, 48, 51, 53, 9, 103, 108, 121, 112, 104, 49, 48, 51, 54, 11, 97, 102, 105, 105, 54, 50, 56, 56, 52, 45, +50, 11, 97, 102, 105, 105, 54, 50, 56, 56, 49, 45, 50, 11, 97, 102, 105, 105, 54, 50, 56, 56, 54, 45, 50, +11, 97, 102, 105, 105, 54, 50, 56, 56, 51, 45, 50, 11, 97, 102, 105, 105, 54, 50, 56, 56, 53, 45, 50, 11, +97, 102, 105, 105, 54, 50, 56, 56, 50, 45, 50, 11, 97, 102, 105, 105, 53, 55, 53, 48, 52, 45, 50, 11, 97, +102, 105, 105, 53, 55, 52, 53, 54, 45, 50, 11, 97, 102, 105, 105, 53, 55, 52, 53, 51, 45, 50, 9, 103, 108, +121, 112, 104, 49, 48, 52, 54, 9, 103, 108, 121, 112, 104, 49, 48, 52, 55, 11, 97, 102, 105, 105, 53, 55, 53, +52, 51, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 53, 52, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 53, +49, 45, 51, 9, 103, 108, 121, 112, 104, 49, 48, 53, 49, 9, 103, 108, 121, 112, 104, 49, 48, 53, 50, 11, 97, +102, 105, 105, 53, 55, 52, 55, 49, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 53, 56, 45, 51, 11, 97, 102, +105, 105, 53, 55, 52, 53, 55, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 57, 52, 45, 51, 11, 97, 102, 105, +105, 53, 55, 52, 53, 57, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 53, 53, 45, 51, 11, 97, 102, 105, 105, +53, 55, 52, 53, 50, 45, 51, 9, 103, 108, 121, 112, 104, 49, 48, 54, 48, 9, 103, 108, 121, 112, 104, 49, 48, +54, 49, 9, 103, 108, 121, 112, 104, 49, 48, 54, 50, 11, 97, 102, 105, 105, 54, 50, 56, 56, 52, 45, 51, 11, +97, 102, 105, 105, 54, 50, 56, 56, 49, 45, 51, 11, 97, 102, 105, 105, 54, 50, 56, 56, 54, 45, 51, 11, 97, +102, 105, 105, 54, 50, 56, 56, 51, 45, 51, 11, 97, 102, 105, 105, 54, 50, 56, 56, 53, 45, 51, 11, 97, 102, +105, 105, 54, 50, 56, 56, 50, 45, 51, 11, 97, 102, 105, 105, 53, 55, 53, 48, 52, 45, 51, 11, 97, 102, 105, +105, 53, 55, 52, 53, 54, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 53, 51, 45, 51, 9, 103, 108, 121, 112, +104, 49, 48, 55, 50, 9, 103, 108, 121, 112, 104, 49, 48, 55, 51, 11, 97, 102, 105, 105, 53, 55, 53, 52, 51, +45, 52, 11, 97, 102, 105, 105, 53, 55, 52, 53, 52, 45, 52, 11, 97, 102, 105, 105, 53, 55, 52, 53, 49, 45, +52, 9, 103, 108, 121, 112, 104, 49, 48, 55, 55, 9, 103, 108, 121, 112, 104, 49, 48, 55, 56, 11, 97, 102, 105, +105, 53, 55, 52, 55, 49, 45, 52, 11, 97, 102, 105, 105, 53, 55, 52, 53, 56, 45, 52, 11, 97, 102, 105, 105, +53, 55, 52, 53, 55, 45, 52, 11, 97, 102, 105, 105, 53, 55, 52, 57, 52, 45, 52, 11, 97, 102, 105, 105, 53, +55, 52, 53, 57, 45, 52, 11, 97, 102, 105, 105, 53, 55, 52, 53, 53, 45, 52, 11, 97, 102, 105, 105, 53, 55, +52, 53, 50, 45, 52, 9, 103, 108, 121, 112, 104, 49, 48, 56, 54, 9, 103, 108, 121, 112, 104, 49, 48, 56, 55, +9, 103, 108, 121, 112, 104, 49, 48, 56, 56, 11, 97, 102, 105, 105, 54, 50, 56, 56, 52, 45, 52, 11, 97, 102, +105, 105, 54, 50, 56, 56, 49, 45, 52, 11, 97, 102, 105, 105, 54, 50, 56, 56, 54, 45, 52, 11, 97, 102, 105, +105, 54, 50, 56, 56, 51, 45, 52, 11, 97, 102, 105, 105, 54, 50, 56, 56, 53, 45, 52, 11, 97, 102, 105, 105, +54, 50, 56, 56, 50, 45, 52, 11, 97, 102, 105, 105, 53, 55, 53, 48, 52, 45, 52, 11, 97, 102, 105, 105, 53, +55, 52, 53, 54, 45, 52, 11, 97, 102, 105, 105, 53, 55, 52, 53, 51, 45, 52, 9, 103, 108, 121, 112, 104, 49, +48, 57, 56, 9, 103, 108, 121, 112, 104, 49, 48, 57, 57, 9, 103, 108, 121, 112, 104, 49, 49, 48, 48, 9, 103, +108, 121, 112, 104, 49, 49, 48, 49, 9, 103, 108, 121, 112, 104, 49, 49, 48, 50, 9, 103, 108, 121, 112, 104, 49, +49, 48, 51, 9, 103, 108, 121, 112, 104, 49, 49, 48, 52, 9, 103, 108, 121, 112, 104, 49, 49, 48, 53, 9, 103, +108, 121, 112, 104, 49, 49, 48, 54, 9, 103, 108, 121, 112, 104, 49, 49, 48, 55, 9, 103, 108, 121, 112, 104, 49, +49, 48, 56, 9, 103, 108, 121, 112, 104, 49, 49, 48, 57, 9, 103, 108, 121, 112, 104, 49, 49, 49, 48, 9, 103, +108, 121, 112, 104, 49, 49, 49, 49, 9, 103, 108, 121, 112, 104, 49, 49, 49, 50, 9, 103, 108, 121, 112, 104, 49, +49, 49, 51, 9, 103, 108, 121, 112, 104, 49, 49, 49, 52, 9, 103, 108, 121, 112, 104, 49, 49, 49, 53, 9, 103, +108, 121, 112, 104, 49, 49, 49, 54, 9, 103, 108, 121, 112, 104, 49, 49, 49, 55, 9, 103, 108, 121, 112, 104, 49, +49, 49, 56, 9, 103, 108, 121, 112, 104, 49, 49, 49, 57, 9, 103, 108, 121, 112, 104, 49, 49, 50, 48, 9, 103, +108, 121, 112, 104, 49, 49, 50, 49, 9, 103, 108, 121, 112, 104, 49, 49, 50, 50, 9, 103, 108, 121, 112, 104, 49, +49, 50, 51, 9, 103, 108, 121, 112, 104, 49, 49, 50, 52, 9, 103, 108, 121, 112, 104, 49, 49, 50, 53, 9, 103, +108, 121, 112, 104, 49, 49, 50, 54, 11, 97, 102, 105, 105, 53, 55, 52, 52, 48, 45, 50, 11, 97, 102, 105, 105, +53, 55, 52, 52, 48, 45, 51, 11, 97, 102, 105, 105, 53, 55, 52, 52, 48, 45, 52, 5, 79, 104, 111, 114, 110, +5, 111, 104, 111, 114, 110, 5, 85, 104, 111, 114, 110, 5, 117, 104, 111, 114, 110, 9, 103, 108, 121, 112, 104, 49, +49, 51, 52, 9, 103, 108, 121, 112, 104, 49, 49, 51, 53, 9, 103, 108, 121, 112, 104, 49, 49, 51, 54, 7, 117, +110, 105, 70, 48, 48, 54, 7, 117, 110, 105, 70, 48, 48, 55, 7, 117, 110, 105, 70, 48, 48, 57, 18, 99, 111, +109, 98, 105, 110, 105, 110, 103, 104, 111, 111, 107, 97, 98, 111, 118, 101, 7, 117, 110, 105, 70, 48, 49, 48, 7, +117, 110, 105, 70, 48, 49, 51, 7, 117, 110, 105, 70, 48, 49, 49, 7, 117, 110, 105, 70, 48, 49, 67, 7, 117, +110, 105, 70, 48, 49, 53, 20, 99, 111, 109, 98, 105, 110, 105, 110, 103, 116, 105, 108, 100, 101, 97, 99, 99, 101, +110, 116, 9, 103, 108, 121, 112, 104, 49, 49, 52, 55, 9, 103, 108, 121, 112, 104, 49, 49, 52, 56, 7, 117, 110, +105, 70, 48, 50, 67, 8, 100, 111, 110, 103, 115, 105, 103, 110, 8, 111, 110, 101, 116, 104, 105, 114, 100, 9, 116, +119, 111, 116, 104, 105, 114, 100, 115, 7, 117, 110, 105, 70, 48, 48, 56, 9, 103, 108, 121, 112, 104, 49, 49, 53, +52, 9, 103, 108, 121, 112, 104, 49, 49, 53, 53, 7, 117, 110, 105, 70, 48, 48, 70, 7, 117, 110, 105, 70, 48, +49, 50, 7, 117, 110, 105, 70, 48, 49, 52, 7, 117, 110, 105, 70, 48, 49, 54, 7, 117, 110, 105, 70, 48, 49, +55, 7, 117, 110, 105, 70, 48, 49, 56, 7, 117, 110, 105, 70, 48, 49, 57, 7, 117, 110, 105, 70, 48, 49, 65, +7, 117, 110, 105, 70, 48, 49, 66, 7, 117, 110, 105, 70, 48, 49, 69, 7, 117, 110, 105, 70, 48, 49, 70, 7, +117, 110, 105, 70, 48, 50, 48, 7, 117, 110, 105, 70, 48, 50, 49, 7, 117, 110, 105, 70, 48, 50, 50, 20, 99, +111, 109, 98, 105, 110, 105, 110, 103, 103, 114, 97, 118, 101, 97, 99, 99, 101, 110, 116, 20, 99, 111, 109, 98, 105, +110, 105, 110, 103, 97, 99, 117, 116, 101, 97, 99, 99, 101, 110, 116, 7, 117, 110, 105, 70, 48, 49, 68, 17, 99, +111, 109, 98, 105, 110, 105, 110, 103, 100, 111, 116, 98, 101, 108, 111, 119, 7, 117, 110, 105, 70, 48, 50, 51, 7, +117, 110, 105, 70, 48, 50, 57, 7, 117, 110, 105, 70, 48, 50, 65, 7, 117, 110, 105, 70, 48, 50, 66, 7, 117, +110, 105, 70, 48, 50, 52, 7, 117, 110, 105, 70, 48, 50, 53, 7, 117, 110, 105, 70, 48, 50, 54, 7, 117, 110, +105, 70, 48, 50, 55, 7, 117, 110, 105, 70, 48, 50, 56, 7, 117, 110, 105, 70, 48, 50, 68, 7, 117, 110, 105, +70, 48, 50, 69, 7, 117, 110, 105, 70, 48, 50, 70, 7, 117, 110, 105, 70, 48, 51, 48, 7, 117, 110, 105, 70, +48, 51, 49, 9, 65, 100, 111, 116, 98, 101, 108, 111, 119, 9, 97, 100, 111, 116, 98, 101, 108, 111, 119, 10, 65, +104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 97, 104, 111, 111, 107, 97, 98, 111, 118, 101, 16, 65, 99, 105, 114, +99, 117, 109, 102, 108, 101, 120, 97, 99, 117, 116, 101, 16, 97, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 97, +99, 117, 116, 101, 16, 65, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 103, 114, 97, 118, 101, 16, 97, 99, 105, +114, 99, 117, 109, 102, 108, 101, 120, 103, 114, 97, 118, 101, 20, 65, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, +104, 111, 111, 107, 97, 98, 111, 118, 101, 20, 97, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 104, 111, 111, 107, +97, 98, 111, 118, 101, 16, 65, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 116, 105, 108, 100, 101, 16, 97, 99, +105, 114, 99, 117, 109, 102, 108, 101, 120, 116, 105, 108, 100, 101, 19, 65, 99, 105, 114, 99, 117, 109, 102, 108, 101, +120, 100, 111, 116, 98, 101, 108, 111, 119, 19, 97, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 100, 111, 116, 98, +101, 108, 111, 119, 11, 65, 98, 114, 101, 118, 101, 97, 99, 117, 116, 101, 11, 97, 98, 114, 101, 118, 101, 97, 99, +117, 116, 101, 11, 65, 98, 114, 101, 118, 101, 103, 114, 97, 118, 101, 11, 97, 98, 114, 101, 118, 101, 103, 114, 97, +118, 101, 15, 65, 98, 114, 101, 118, 101, 104, 111, 111, 107, 97, 98, 111, 118, 101, 15, 97, 98, 114, 101, 118, 101, +104, 111, 111, 107, 97, 98, 111, 118, 101, 11, 65, 98, 114, 101, 118, 101, 116, 105, 108, 100, 101, 11, 97, 98, 114, +101, 118, 101, 116, 105, 108, 100, 101, 14, 65, 98, 114, 101, 118, 101, 100, 111, 116, 98, 101, 108, 111, 119, 14, 97, +98, 114, 101, 118, 101, 100, 111, 116, 98, 101, 108, 111, 119, 9, 69, 100, 111, 116, 98, 101, 108, 111, 119, 9, 101, +100, 111, 116, 98, 101, 108, 111, 119, 10, 69, 104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 101, 104, 111, 111, 107, +97, 98, 111, 118, 101, 6, 69, 116, 105, 108, 100, 101, 6, 101, 116, 105, 108, 100, 101, 16, 69, 99, 105, 114, 99, +117, 109, 102, 108, 101, 120, 97, 99, 117, 116, 101, 16, 101, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 97, 99, +117, 116, 101, 16, 69, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 103, 114, 97, 118, 101, 16, 101, 99, 105, 114, +99, 117, 109, 102, 108, 101, 120, 103, 114, 97, 118, 101, 20, 69, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 104, +111, 111, 107, 97, 98, 111, 118, 101, 20, 101, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 104, 111, 111, 107, 97, +98, 111, 118, 101, 16, 69, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 116, 105, 108, 100, 101, 16, 101, 99, 105, +114, 99, 117, 109, 102, 108, 101, 120, 116, 105, 108, 100, 101, 19, 69, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, +100, 111, 116, 98, 101, 108, 111, 119, 19, 101, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 100, 111, 116, 98, 101, +108, 111, 119, 10, 73, 104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 105, 104, 111, 111, 107, 97, 98, 111, 118, 101, +9, 73, 100, 111, 116, 98, 101, 108, 111, 119, 9, 105, 100, 111, 116, 98, 101, 108, 111, 119, 9, 79, 100, 111, 116, +98, 101, 108, 111, 119, 9, 111, 100, 111, 116, 98, 101, 108, 111, 119, 10, 79, 104, 111, 111, 107, 97, 98, 111, 118, +101, 10, 111, 104, 111, 111, 107, 97, 98, 111, 118, 101, 16, 79, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 97, +99, 117, 116, 101, 16, 111, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 97, 99, 117, 116, 101, 16, 79, 99, 105, +114, 99, 117, 109, 102, 108, 101, 120, 103, 114, 97, 118, 101, 16, 111, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, +103, 114, 97, 118, 101, 20, 79, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 104, 111, 111, 107, 97, 98, 111, 118, +101, 20, 111, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 104, 111, 111, 107, 97, 98, 111, 118, 101, 16, 79, 99, +105, 114, 99, 117, 109, 102, 108, 101, 120, 116, 105, 108, 100, 101, 16, 111, 99, 105, 114, 99, 117, 109, 102, 108, 101, +120, 116, 105, 108, 100, 101, 19, 79, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 100, 111, 116, 98, 101, 108, 111, +119, 19, 111, 99, 105, 114, 99, 117, 109, 102, 108, 101, 120, 100, 111, 116, 98, 101, 108, 111, 119, 10, 79, 104, 111, +114, 110, 97, 99, 117, 116, 101, 10, 111, 104, 111, 114, 110, 97, 99, 117, 116, 101, 10, 79, 104, 111, 114, 110, 103, +114, 97, 118, 101, 10, 111, 104, 111, 114, 110, 103, 114, 97, 118, 101, 14, 79, 104, 111, 114, 110, 104, 111, 111, 107, +97, 98, 111, 118, 101, 14, 111, 104, 111, 114, 110, 104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 79, 104, 111, 114, +110, 116, 105, 108, 100, 101, 10, 111, 104, 111, 114, 110, 116, 105, 108, 100, 101, 13, 79, 104, 111, 114, 110, 100, 111, +116, 98, 101, 108, 111, 119, 13, 111, 104, 111, 114, 110, 100, 111, 116, 98, 101, 108, 111, 119, 9, 85, 100, 111, 116, +98, 101, 108, 111, 119, 9, 117, 100, 111, 116, 98, 101, 108, 111, 119, 10, 85, 104, 111, 111, 107, 97, 98, 111, 118, +101, 10, 117, 104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 85, 104, 111, 114, 110, 97, 99, 117, 116, 101, 10, 117, +104, 111, 114, 110, 97, 99, 117, 116, 101, 10, 85, 104, 111, 114, 110, 103, 114, 97, 118, 101, 10, 117, 104, 111, 114, +110, 103, 114, 97, 118, 101, 14, 85, 104, 111, 114, 110, 104, 111, 111, 107, 97, 98, 111, 118, 101, 14, 117, 104, 111, +114, 110, 104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 85, 104, 111, 114, 110, 116, 105, 108, 100, 101, 10, 117, 104, +111, 114, 110, 116, 105, 108, 100, 101, 13, 85, 104, 111, 114, 110, 100, 111, 116, 98, 101, 108, 111, 119, 13, 117, 104, +111, 114, 110, 100, 111, 116, 98, 101, 108, 111, 119, 9, 89, 100, 111, 116, 98, 101, 108, 111, 119, 9, 121, 100, 111, +116, 98, 101, 108, 111, 119, 10, 89, 104, 111, 111, 107, 97, 98, 111, 118, 101, 10, 121, 104, 111, 111, 107, 97, 98, +111, 118, 101, 6, 89, 116, 105, 108, 100, 101, 6, 121, 116, 105, 108, 100, 101, 7, 117, 110, 105, 48, 49, 67, 68, +7, 117, 110, 105, 48, 49, 67, 69, 7, 117, 110, 105, 48, 49, 67, 70, 7, 117, 110, 105, 48, 49, 68, 48, 7, +117, 110, 105, 48, 49, 68, 49, 7, 117, 110, 105, 48, 49, 68, 50, 7, 117, 110, 105, 48, 49, 68, 51, 7, 117, +110, 105, 48, 49, 68, 52, 7, 117, 110, 105, 48, 49, 68, 53, 7, 117, 110, 105, 48, 49, 68, 54, 7, 117, 110, +105, 48, 49, 68, 55, 7, 117, 110, 105, 48, 49, 68, 56, 7, 117, 110, 105, 48, 49, 68, 57, 7, 117, 110, 105, +48, 49, 68, 65, 7, 117, 110, 105, 48, 49, 68, 66, 7, 117, 110, 105, 48, 49, 68, 67, 9, 103, 108, 121, 112, +104, 49, 50, 57, 50, 9, 103, 108, 121, 112, 104, 49, 50, 57, 51, 9, 103, 108, 121, 112, 104, 49, 50, 57, 52, +9, 103, 108, 121, 112, 104, 49, 50, 57, 53, 7, 117, 110, 105, 48, 52, 57, 50, 7, 117, 110, 105, 48, 52, 57, +51, 7, 117, 110, 105, 48, 52, 57, 54, 7, 117, 110, 105, 48, 52, 57, 55, 7, 117, 110, 105, 48, 52, 57, 65, +7, 117, 110, 105, 48, 52, 57, 66, 7, 117, 110, 105, 48, 52, 57, 67, 7, 117, 110, 105, 48, 52, 57, 68, 7, +117, 110, 105, 48, 52, 65, 50, 7, 117, 110, 105, 48, 52, 65, 51, 7, 117, 110, 105, 48, 52, 65, 69, 7, 117, +110, 105, 48, 52, 65, 70, 7, 117, 110, 105, 48, 52, 66, 48, 7, 117, 110, 105, 48, 52, 66, 49, 7, 117, 110, +105, 48, 52, 66, 50, 7, 117, 110, 105, 48, 52, 66, 51, 7, 117, 110, 105, 48, 52, 66, 56, 7, 117, 110, 105, +48, 52, 66, 57, 7, 117, 110, 105, 48, 52, 66, 65, 7, 117, 110, 105, 48, 52, 66, 66, 7, 117, 110, 105, 48, +49, 56, 70, 7, 117, 110, 105, 48, 50, 53, 57, 7, 117, 110, 105, 48, 52, 69, 56, 7, 117, 110, 105, 48, 52, +69, 57, 9, 103, 108, 121, 112, 104, 49, 51, 50, 48, 9, 103, 108, 121, 112, 104, 49, 51, 50, 49, 9, 103, 108, +121, 112, 104, 49, 51, 50, 50, 9, 103, 108, 121, 112, 104, 49, 51, 50, 51, 9, 103, 108, 121, 112, 104, 49, 51, +50, 52, 9, 103, 108, 121, 112, 104, 49, 51, 50, 53, 9, 103, 108, 121, 112, 104, 49, 51, 50, 54, 9, 103, 108, +121, 112, 104, 49, 51, 50, 55, 9, 103, 108, 121, 112, 104, 49, 51, 50, 56, 9, 103, 108, 121, 112, 104, 49, 51, +50, 57, 9, 103, 108, 121, 112, 104, 49, 51, 51, 48, 9, 103, 108, 121, 112, 104, 49, 51, 51, 49, 9, 103, 108, +121, 112, 104, 49, 51, 51, 50, 9, 103, 108, 121, 112, 104, 49, 51, 51, 51, 9, 103, 108, 121, 112, 104, 49, 51, +51, 52, 9, 103, 108, 121, 112, 104, 49, 51, 51, 53, 7, 117, 110, 105, 48, 54, 53, 51, 7, 117, 110, 105, 48, +54, 53, 52, 7, 117, 110, 105, 48, 54, 53, 53, 7, 117, 110, 105, 48, 54, 55, 48, 7, 117, 110, 105, 48, 54, +55, 49, 7, 117, 110, 105, 70, 66, 53, 49, 7, 117, 110, 105, 48, 54, 55, 50, 9, 103, 108, 121, 112, 104, 49, +51, 52, 51, 7, 117, 110, 105, 48, 54, 55, 51, 9, 103, 108, 121, 112, 104, 49, 51, 52, 53, 7, 117, 110, 105, +48, 54, 55, 53, 7, 103, 108, 121, 112, 104, 52, 55, 7, 117, 110, 105, 48, 54, 55, 54, 9, 103, 108, 121, 112, +104, 49, 51, 52, 57, 7, 117, 110, 105, 48, 54, 55, 55, 9, 103, 108, 121, 112, 104, 49, 51, 53, 49, 7, 117, +110, 105, 48, 54, 55, 56, 5, 103, 108, 121, 112, 104, 7, 117, 110, 105, 48, 54, 55, 57, 7, 117, 110, 105, 70, +66, 54, 55, 7, 117, 110, 105, 70, 66, 54, 56, 7, 117, 110, 105, 70, 66, 54, 57, 7, 117, 110, 105, 48, 54, +55, 65, 7, 117, 110, 105, 70, 66, 53, 70, 7, 117, 110, 105, 70, 66, 54, 48, 7, 117, 110, 105, 70, 66, 54, +49, 7, 117, 110, 105, 48, 54, 55, 66, 7, 117, 110, 105, 70, 66, 53, 51, 7, 117, 110, 105, 70, 66, 53, 52, +7, 117, 110, 105, 70, 66, 53, 53, 7, 117, 110, 105, 48, 54, 55, 67, 9, 103, 108, 121, 112, 104, 49, 51, 54, +55, 9, 103, 108, 121, 112, 104, 49, 51, 54, 56, 9, 103, 108, 121, 112, 104, 49, 51, 54, 57, 7, 117, 110, 105, +48, 54, 55, 68, 9, 103, 108, 121, 112, 104, 49, 51, 55, 49, 9, 103, 108, 121, 112, 104, 49, 51, 55, 50, 9, +103, 108, 121, 112, 104, 49, 51, 55, 51, 7, 117, 110, 105, 48, 54, 55, 70, 7, 117, 110, 105, 70, 66, 54, 51, +7, 117, 110, 105, 70, 66, 54, 52, 7, 117, 110, 105, 70, 66, 54, 53, 7, 117, 110, 105, 48, 54, 56, 48, 7, +117, 110, 105, 70, 66, 53, 66, 7, 117, 110, 105, 70, 66, 53, 67, 7, 117, 110, 105, 70, 66, 53, 68, 7, 117, +110, 105, 48, 54, 56, 49, 9, 103, 108, 121, 112, 104, 49, 51, 56, 51, 9, 103, 108, 121, 112, 104, 49, 51, 56, +52, 9, 103, 108, 121, 112, 104, 49, 51, 56, 53, 7, 117, 110, 105, 48, 54, 56, 50, 9, 103, 108, 121, 112, 104, +49, 51, 56, 55, 9, 103, 108, 121, 112, 104, 49, 51, 56, 56, 9, 103, 108, 121, 112, 104, 49, 51, 56, 57, 7, +117, 110, 105, 48, 54, 56, 51, 7, 117, 110, 105, 70, 66, 55, 55, 7, 117, 110, 105, 70, 66, 55, 56, 7, 117, +110, 105, 70, 66, 55, 57, 7, 117, 110, 105, 48, 54, 56, 52, 7, 117, 110, 105, 70, 66, 55, 51, 7, 117, 110, +105, 70, 66, 55, 52, 7, 117, 110, 105, 70, 66, 55, 53, 7, 117, 110, 105, 48, 54, 56, 53, 9, 103, 108, 121, +112, 104, 49, 51, 57, 57, 9, 103, 108, 121, 112, 104, 49, 52, 48, 48, 9, 103, 108, 121, 112, 104, 49, 52, 48, +49, 7, 117, 110, 105, 48, 54, 56, 55, 7, 117, 110, 105, 70, 66, 55, 102, 7, 117, 110, 105, 70, 66, 56, 48, +7, 117, 110, 105, 70, 66, 56, 49, 7, 117, 110, 105, 48, 54, 56, 56, 7, 117, 110, 105, 70, 66, 56, 57, 7, +117, 110, 105, 48, 54, 56, 57, 9, 103, 108, 121, 112, 104, 49, 52, 48, 57, 7, 117, 110, 105, 48, 54, 56, 65, +9, 103, 108, 121, 112, 104, 49, 52, 49, 49, 7, 117, 110, 105, 48, 54, 56, 66, 9, 103, 108, 121, 112, 104, 49, +52, 49, 51, 7, 117, 110, 105, 48, 54, 56, 67, 7, 117, 110, 105, 70, 66, 56, 53, 7, 117, 110, 105, 48, 54, +56, 68, 7, 117, 110, 105, 70, 66, 56, 51, 7, 117, 110, 105, 48, 54, 56, 69, 7, 117, 110, 105, 70, 66, 56, +55, 7, 117, 110, 105, 48, 54, 56, 70, 9, 103, 108, 121, 112, 104, 49, 52, 50, 49, 7, 117, 110, 105, 48, 54, +57, 48, 9, 103, 108, 121, 112, 104, 49, 52, 50, 51, 7, 117, 110, 105, 48, 54, 57, 49, 7, 117, 110, 105, 70, +66, 56, 68, 7, 117, 110, 105, 48, 54, 57, 50, 9, 103, 108, 121, 112, 104, 49, 52, 50, 54, 7, 117, 110, 105, +48, 54, 57, 51, 9, 103, 108, 121, 112, 104, 49, 52, 50, 57, 7, 117, 110, 105, 48, 54, 57, 52, 9, 103, 108, +121, 112, 104, 49, 52, 51, 49, 7, 117, 110, 105, 48, 54, 57, 53, 9, 103, 108, 121, 112, 104, 49, 52, 51, 51, +7, 117, 110, 105, 48, 54, 57, 54, 9, 103, 108, 121, 112, 104, 49, 52, 51, 53, 7, 117, 110, 105, 48, 54, 57, +55, 9, 103, 108, 121, 112, 104, 49, 52, 51, 55, 7, 117, 110, 105, 48, 54, 57, 57, 9, 103, 108, 121, 112, 104, +49, 52, 51, 57, 7, 117, 110, 105, 48, 54, 57, 65, 9, 103, 108, 121, 112, 104, 49, 52, 52, 49, 9, 103, 108, +121, 112, 104, 49, 52, 52, 50, 9, 103, 108, 121, 112, 104, 49, 52, 52, 51, 7, 117, 110, 105, 48, 54, 57, 66, +9, 103, 108, 121, 112, 104, 49, 52, 52, 53, 9, 103, 108, 121, 112, 104, 49, 52, 52, 54, 9, 103, 108, 121, 112, +104, 49, 52, 52, 55, 7, 117, 110, 105, 48, 54, 57, 67, 9, 103, 108, 121, 112, 104, 49, 52, 52, 57, 9, 103, +108, 121, 112, 104, 49, 52, 53, 48, 9, 103, 108, 121, 112, 104, 49, 52, 53, 49, 7, 117, 110, 105, 48, 54, 57, +68, 9, 103, 108, 121, 112, 104, 49, 52, 53, 51, 9, 103, 108, 121, 112, 104, 49, 52, 53, 52, 9, 103, 108, 121, +112, 104, 49, 52, 53, 53, 7, 117, 110, 105, 48, 54, 57, 69, 9, 103, 108, 121, 112, 104, 49, 52, 53, 55, 9, +103, 108, 121, 112, 104, 49, 52, 53, 56, 9, 103, 108, 121, 112, 104, 49, 52, 53, 57, 7, 117, 110, 105, 48, 54, +57, 70, 9, 103, 108, 121, 112, 104, 49, 52, 54, 49, 7, 117, 110, 105, 48, 54, 65, 48, 9, 103, 108, 121, 112, +104, 49, 52, 54, 51, 9, 103, 108, 121, 112, 104, 49, 52, 54, 52, 9, 103, 108, 121, 112, 104, 49, 52, 54, 53, +7, 117, 110, 105, 48, 54, 65, 49, 7, 117, 110, 105, 48, 54, 65, 50, 9, 103, 108, 121, 112, 104, 49, 52, 54, +56, 9, 103, 108, 121, 112, 104, 49, 52, 54, 57, 9, 103, 108, 121, 112, 104, 49, 52, 55, 48, 7, 117, 110, 105, +48, 54, 65, 51, 9, 103, 108, 121, 112, 104, 49, 52, 55, 50, 9, 103, 108, 121, 112, 104, 49, 52, 55, 51, 9, +103, 108, 121, 112, 104, 49, 52, 55, 52, 7, 117, 110, 105, 48, 54, 65, 52, 7, 117, 110, 105, 70, 66, 54, 66, +7, 117, 110, 105, 70, 66, 54, 67, 7, 117, 110, 105, 70, 66, 54, 68, 7, 117, 110, 105, 48, 54, 65, 53, 9, +103, 108, 121, 112, 104, 49, 52, 56, 48, 9, 103, 108, 121, 112, 104, 49, 52, 56, 49, 9, 103, 108, 121, 112, 104, +49, 52, 56, 50, 7, 117, 110, 105, 48, 54, 65, 54, 7, 117, 110, 105, 70, 66, 54, 70, 7, 117, 110, 105, 70, +66, 55, 48, 7, 117, 110, 105, 70, 66, 55, 49, 7, 117, 110, 105, 48, 54, 65, 55, 9, 103, 108, 121, 112, 104, +49, 52, 56, 56, 7, 117, 110, 105, 48, 54, 65, 56, 9, 103, 108, 121, 112, 104, 49, 52, 57, 48, 7, 117, 110, +105, 48, 54, 65, 65, 9, 103, 108, 121, 112, 104, 49, 52, 57, 50, 9, 103, 108, 121, 112, 104, 49, 52, 57, 51, +9, 103, 108, 121, 112, 104, 49, 52, 57, 52, 7, 117, 110, 105, 48, 54, 65, 66, 9, 103, 108, 121, 112, 104, 49, +52, 57, 54, 9, 103, 108, 121, 112, 104, 49, 52, 57, 55, 9, 103, 108, 121, 112, 104, 49, 52, 57, 56, 7, 117, +110, 105, 48, 54, 65, 67, 9, 103, 108, 121, 112, 104, 49, 53, 48, 48, 9, 103, 108, 121, 112, 104, 49, 53, 48, +49, 9, 103, 108, 121, 112, 104, 49, 53, 48, 50, 7, 117, 110, 105, 48, 54, 65, 68, 7, 117, 110, 105, 70, 66, +68, 52, 7, 117, 110, 105, 70, 66, 68, 53, 7, 117, 110, 105, 70, 66, 68, 54, 7, 117, 110, 105, 48, 54, 65, +69, 9, 103, 108, 121, 112, 104, 49, 53, 48, 56, 9, 103, 108, 121, 112, 104, 49, 53, 48, 57, 9, 103, 108, 121, +112, 104, 49, 53, 49, 48, 7, 117, 110, 105, 48, 54, 66, 48, 9, 103, 108, 121, 112, 104, 49, 53, 49, 50, 9, +103, 108, 121, 112, 104, 49, 53, 49, 51, 9, 103, 108, 121, 112, 104, 49, 53, 49, 52, 7, 117, 110, 105, 48, 54, +66, 49, 7, 117, 110, 105, 70, 66, 57, 66, 7, 117, 110, 105, 70, 66, 57, 67, 7, 117, 110, 105, 70, 66, 57, +68, 7, 117, 110, 105, 48, 54, 66, 50, 9, 103, 108, 121, 112, 104, 49, 53, 50, 48, 9, 103, 108, 121, 112, 104, +49, 53, 50, 49, 9, 103, 108, 121, 112, 104, 49, 53, 50, 50, 7, 117, 110, 105, 48, 54, 66, 51, 7, 117, 110, +105, 70, 66, 57, 55, 7, 117, 110, 105, 70, 66, 57, 56, 7, 117, 110, 105, 70, 66, 57, 57, 7, 117, 110, 105, +48, 54, 66, 52, 9, 103, 108, 121, 112, 104, 49, 53, 50, 56, 9, 103, 108, 121, 112, 104, 49, 53, 50, 57, 9, +103, 108, 121, 112, 104, 49, 53, 51, 48, 7, 117, 110, 105, 48, 54, 66, 53, 9, 103, 108, 121, 112, 104, 49, 53, +51, 50, 9, 103, 108, 121, 112, 104, 49, 53, 51, 51, 9, 103, 108, 121, 112, 104, 49, 53, 51, 52, 7, 117, 110, +105, 48, 54, 66, 54, 9, 103, 108, 121, 112, 104, 49, 53, 51, 54, 9, 103, 108, 121, 112, 104, 49, 53, 51, 55, +9, 103, 108, 121, 112, 104, 49, 53, 51, 56, 7, 117, 110, 105, 48, 54, 66, 55, 9, 103, 108, 121, 112, 104, 49, +53, 52, 48, 9, 103, 108, 121, 112, 104, 49, 53, 52, 49, 9, 103, 108, 121, 112, 104, 49, 53, 52, 50, 7, 117, +110, 105, 48, 54, 66, 56, 9, 103, 108, 121, 112, 104, 49, 53, 52, 52, 9, 103, 108, 121, 112, 104, 49, 53, 52, +53, 9, 103, 108, 121, 112, 104, 49, 53, 52, 54, 7, 117, 110, 105, 48, 54, 66, 57, 9, 103, 108, 121, 112, 104, +49, 53, 52, 56, 9, 103, 108, 121, 112, 104, 49, 53, 52, 57, 9, 103, 108, 121, 112, 104, 49, 53, 53, 48, 7, +117, 110, 105, 48, 54, 66, 65, 7, 117, 110, 105, 70, 66, 57, 70, 7, 117, 110, 105, 48, 54, 66, 66, 7, 117, +110, 105, 70, 66, 65, 49, 7, 117, 110, 105, 48, 54, 66, 67, 9, 103, 108, 121, 112, 104, 49, 53, 53, 54, 9, +103, 108, 121, 112, 104, 49, 53, 53, 55, 9, 103, 108, 121, 112, 104, 49, 53, 53, 56, 7, 117, 110, 105, 48, 54, +66, 68, 9, 103, 108, 121, 112, 104, 49, 53, 54, 48, 7, 117, 110, 105, 48, 54, 66, 70, 9, 103, 108, 121, 112, +104, 49, 53, 54, 50, 9, 103, 108, 121, 112, 104, 49, 53, 54, 51, 9, 103, 108, 121, 112, 104, 49, 53, 54, 52, +7, 117, 110, 105, 48, 54, 67, 48, 7, 117, 110, 105, 70, 66, 65, 53, 7, 117, 110, 105, 48, 54, 67, 49, 7, +117, 110, 105, 48, 54, 67, 50, 7, 117, 110, 105, 48, 54, 67, 51, 7, 117, 110, 105, 48, 54, 67, 52, 9, 103, +108, 121, 112, 104, 49, 53, 55, 49, 7, 117, 110, 105, 48, 54, 67, 53, 7, 117, 110, 105, 70, 66, 69, 49, 7, +117, 110, 105, 48, 54, 67, 54, 7, 117, 110, 105, 70, 66, 68, 65, 7, 117, 110, 105, 48, 54, 67, 55, 7, 117, +110, 105, 70, 66, 68, 56, 7, 117, 110, 105, 48, 54, 67, 56, 7, 117, 110, 105, 70, 66, 68, 67, 7, 117, 110, +105, 48, 54, 67, 57, 7, 117, 110, 105, 70, 66, 69, 51, 7, 117, 110, 105, 48, 54, 67, 65, 9, 103, 108, 121, +112, 104, 49, 53, 56, 51, 7, 117, 110, 105, 48, 54, 67, 66, 7, 117, 110, 105, 70, 66, 68, 70, 7, 117, 110, +105, 48, 54, 67, 68, 9, 103, 108, 121, 112, 104, 49, 53, 56, 55, 7, 117, 110, 105, 48, 54, 67, 69, 9, 103, +108, 121, 112, 104, 49, 53, 56, 57, 9, 103, 108, 121, 112, 104, 49, 53, 57, 48, 9, 103, 108, 121, 112, 104, 49, +53, 57, 49, 7, 117, 110, 105, 48, 54, 67, 70, 9, 103, 108, 121, 112, 104, 49, 53, 57, 51, 7, 117, 110, 105, +48, 54, 68, 48, 7, 117, 110, 105, 70, 66, 69, 53, 7, 117, 110, 105, 70, 66, 69, 54, 7, 117, 110, 105, 70, +66, 69, 55, 7, 117, 110, 105, 48, 54, 68, 49, 9, 103, 108, 121, 112, 104, 49, 53, 57, 57, 7, 117, 110, 105, +48, 54, 68, 50, 7, 117, 110, 105, 70, 66, 65, 70, 7, 117, 110, 105, 48, 54, 68, 51, 7, 117, 110, 105, 70, +66, 66, 49, 7, 117, 110, 105, 48, 54, 68, 52, 7, 117, 110, 105, 48, 54, 68, 54, 7, 117, 110, 105, 48, 54, +68, 55, 7, 117, 110, 105, 48, 54, 68, 56, 7, 117, 110, 105, 48, 54, 68, 57, 7, 117, 110, 105, 48, 54, 68, +65, 7, 117, 110, 105, 48, 54, 68, 66, 7, 117, 110, 105, 48, 54, 68, 67, 7, 117, 110, 105, 48, 54, 68, 68, +7, 117, 110, 105, 48, 54, 68, 69, 7, 117, 110, 105, 48, 54, 68, 70, 7, 117, 110, 105, 48, 54, 69, 48, 7, +117, 110, 105, 48, 54, 69, 49, 7, 117, 110, 105, 48, 54, 69, 50, 7, 117, 110, 105, 48, 54, 69, 51, 7, 117, +110, 105, 48, 54, 69, 52, 7, 117, 110, 105, 48, 54, 69, 53, 7, 117, 110, 105, 48, 54, 69, 54, 7, 117, 110, +105, 48, 54, 69, 55, 7, 117, 110, 105, 48, 54, 69, 56, 7, 117, 110, 105, 48, 54, 69, 57, 7, 117, 110, 105, +48, 54, 69, 65, 7, 117, 110, 105, 48, 54, 69, 66, 7, 117, 110, 105, 48, 54, 69, 68, 7, 117, 110, 105, 48, +54, 70, 65, 9, 103, 108, 121, 112, 104, 49, 54, 50, 57, 9, 103, 108, 121, 112, 104, 49, 54, 51, 48, 9, 103, +108, 121, 112, 104, 49, 54, 51, 49, 7, 117, 110, 105, 48, 54, 70, 66, 9, 103, 108, 121, 112, 104, 49, 54, 51, +51, 9, 103, 108, 121, 112, 104, 49, 54, 51, 52, 9, 103, 108, 121, 112, 104, 49, 54, 51, 53, 7, 117, 110, 105, +48, 54, 70, 67, 9, 103, 108, 121, 112, 104, 49, 54, 51, 55, 9, 103, 108, 121, 112, 104, 49, 54, 51, 56, 9, +103, 108, 121, 112, 104, 49, 54, 51, 57, 7, 117, 110, 105, 48, 54, 70, 68, 7, 117, 110, 105, 48, 54, 70, 69, +7, 117, 110, 105, 70, 66, 65, 54, 7, 117, 110, 105, 70, 66, 65, 56, 7, 117, 110, 105, 70, 66, 65, 57, 9, +103, 108, 121, 112, 104, 49, 54, 52, 53, 9, 103, 108, 121, 112, 104, 49, 54, 52, 54, 9, 103, 108, 121, 112, 104, +49, 54, 52, 55, 9, 103, 108, 121, 112, 104, 49, 54, 52, 56, 9, 103, 108, 121, 112, 104, 49, 54, 52, 57, 9, +103, 108, 121, 112, 104, 49, 54, 53, 48, 9, 103, 108, 121, 112, 104, 49, 54, 53, 49, 7, 117, 110, 105, 70, 66, +49, 68, 7, 117, 110, 105, 70, 66, 49, 69, 9, 103, 108, 121, 112, 104, 49, 54, 53, 52, 7, 117, 110, 105, 70, +66, 49, 70, 9, 103, 108, 121, 112, 104, 49, 54, 53, 54, 9, 103, 108, 121, 112, 104, 49, 54, 53, 55, 9, 103, +108, 121, 112, 104, 49, 54, 53, 56, 9, 103, 108, 121, 112, 104, 49, 54, 53, 57, 9, 103, 108, 121, 112, 104, 49, +54, 54, 48, 9, 103, 108, 121, 112, 104, 49, 54, 54, 49, 9, 103, 108, 121, 112, 104, 49, 54, 54, 50, 9, 103, +108, 121, 112, 104, 49, 54, 54, 51, 9, 103, 108, 121, 112, 104, 49, 54, 54, 52, 9, 103, 108, 121, 112, 104, 49, +54, 54, 53, 9, 103, 108, 121, 112, 104, 49, 54, 54, 54, 9, 103, 108, 121, 112, 104, 49, 54, 54, 55, 9, 103, +108, 121, 112, 104, 49, 54, 54, 56, 9, 103, 108, 121, 112, 104, 49, 54, 54, 57, 9, 103, 108, 121, 112, 104, 49, +54, 55, 48, 9, 103, 108, 121, 112, 104, 49, 54, 55, 49, 9, 103, 108, 121, 112, 104, 49, 54, 55, 50, 9, 103, +108, 121, 112, 104, 49, 54, 55, 51, 0, 0, 0, 0, 3, 0, 8, 0, 2, 0, 17, 0, 1, -1, -1, 0, 3, +0, 1, 0, 0, 77, 2, -65, 34, 2, 57, 4, 38, 0, 0, 64, -38, 5, -70, 0, 0, 77, 32, 65, 114, 105, +97, 108, 32, 32, 32, 32, 32, 32, 32, 32, 32, -1, -1, -1, -1, 0, 63, -1, -2, 65, 82, 76, 82, 48, 48, +0, 0, 64, 0, 0, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 2, 0, 25, 2, -24, 2, +-16, 0, 1, 2, -15, 2, -8, 0, 3, 2, -7, 3, 5, 0, 1, 3, 8, 3, 8, 0, 1, 3, 10, 3, 12, +0, 1, 3, 18, 3, 18, 0, 3, 3, 27, 3, 27, 0, 1, 3, 31, 3, 34, 0, 1, 3, 39, 3, 54, 0, +1, 3, 71, 3, 75, 0, 3, 3, 124, 3, 125, 0, 1, 3, 127, 3, 127, 0, 2, 3, -128, 3, -128, 0, 1, +3, -127, 3, -116, 0, 2, 3, -115, 3, -12, 0, 1, 3, -11, 3, -4, 0, 2, 3, -1, 4, 0, 0, 3, 4, +4, 4, 5, 0, 3, 4, 8, 4, 9, 0, 3, 4, 13, 4, 18, 0, 3, 4, 20, 4, 21, 0, 3, 4, 76, +4, 78, 0, 1, 4, 103, 4, 105, 0, 1, 5, 42, 6, 108, 0, 1, 6, 114, 6, -119, 0, 1, 0, 0, 0, +1, 0, 0, 0, 10, 0, 62, 0, -94, 0, 1, 97, 114, 97, 98, 0, 8, 0, 10, 0, 1, 77, 65, 82, 32, +0, 26, 0, 0, 0, 7, 0, 5, 0, 1, 0, 2, 0, 3, 0, 5, 0, 6, 0, 0, 0, 7, 0, 6, 0, +0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 6, 0, 8, 105, 115, 111, 108, 0, 50, 105, 115, 111, 108, 0, 56, +105, 110, 105, 116, 0, 62, 109, 101, 100, 105, 0, 68, 102, 105, 110, 97, 0, 74, 102, 105, 110, 97, 0, 80, 108, +105, 103, 97, 0, 86, 114, 108, 105, 103, 0, 94, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, +0, 1, 0, 2, 0, 0, 0, 1, 0, 3, 0, 0, 0, 1, 0, 4, 0, 0, 0, 1, 0, 5, 0, 0, 0, +2, 0, 6, 0, 7, 0, 0, 0, 1, 0, 6, 0, 8, 0, 18, 0, 40, 0, 70, 1, -88, 3, 10, 5, 84, +7, -98, 8, -64, 0, 1, 0, 1, 0, 1, 0, 8, 0, 2, 0, 8, 0, 1, 6, 114, 0, 1, 0, 1, 5, +-33, 0, 1, 0, 1, 0, 1, 0, 8, 0, 2, 0, 12, 0, 3, 6, 106, 6, 29, 3, -109, 0, 1, 0, 3, +6, 31, 6, 32, 6, 33, 0, 1, 0, 1, 0, 1, 0, 8, 0, 2, 0, -82, 0, 84, 3, 33, 3, 41, 3, +47, 3, 51, 3, -13, 3, -117, 3, -111, 3, -105, 3, -101, 3, -97, 3, -93, 3, -89, 3, -77, 3, -73, 3, -69, +3, -65, 3, -61, 3, -57, 3, -53, 3, -49, 3, -45, 3, -41, 3, -37, 3, -33, 3, -29, 3, -25, 3, -21, 3, +-21, 3, -13, 5, 41, 5, 42, 5, 76, 5, 80, 5, 84, 5, 88, 5, 92, 5, 96, 5, 100, 5, 104, 5, 108, +5, 112, 5, 116, 5, 120, 5, 124, 5, -94, 5, -90, 5, -86, 5, -82, 5, -78, 5, -76, 5, -72, 5, 42, 5, +-67, 5, -63, 5, -59, 5, -55, 5, -51, 3, -45, 5, -59, 5, -43, 5, -39, 5, -35, 5, -31, 5, -27, 5, -23, +5, -19, 5, -15, 5, -11, 5, -7, 5, -3, 6, 1, 6, 5, 6, 9, 6, 13, 5, 76, 6, 21, 3, 33, 6, +27, 6, 107, 6, 54, 6, 60, 6, 94, 6, 98, 6, 102, 0, 1, 0, 84, 3, 31, 3, 39, 3, 45, 3, 49, +3, 53, 3, -119, 3, -113, 3, -107, 3, -103, 3, -99, 3, -95, 3, -91, 3, -79, 3, -75, 3, -71, 3, -67, 3, +-63, 3, -59, 3, -55, 3, -51, 3, -47, 3, -43, 3, -39, 3, -35, 3, -31, 3, -27, 3, -23, 3, -21, 3, -15, +5, 40, 5, 44, 5, 74, 5, 78, 5, 82, 5, 86, 5, 90, 5, 94, 5, 98, 5, 102, 5, 106, 5, 110, 5, +114, 5, 118, 5, 122, 5, -96, 5, -92, 5, -88, 5, -84, 5, -80, 5, -76, 5, -74, 5, -70, 5, -69, 5, -65, +5, -61, 5, -57, 5, -53, 5, -49, 5, -47, 5, -45, 5, -41, 5, -37, 5, -33, 5, -29, 5, -25, 5, -21, 5, +-17, 5, -13, 5, -9, 5, -5, 5, -1, 6, 3, 6, 7, 6, 11, 6, 17, 6, 19, 6, 23, 6, 25, 6, 31, +6, 52, 6, 58, 6, 92, 6, 96, 6, 100, 0, 1, 0, 1, 0, 1, 0, 8, 0, 2, 0, -82, 0, 84, 3, +34, 3, 42, 3, 48, 3, 52, 3, -12, 3, -116, 3, -110, 3, -104, 3, -100, 3, -96, 3, -92, 3, -88, 3, -76, +3, -72, 3, -68, 3, -64, 3, -60, 3, -56, 3, -52, 3, -48, 3, -44, 3, -40, 3, -36, 3, -32, 3, -28, 3, +-24, 3, -20, 3, -20, 3, -12, 5, 41, 5, 43, 5, 77, 5, 81, 5, 85, 5, 89, 5, 93, 5, 97, 5, 101, +5, 105, 5, 109, 5, 113, 5, 117, 5, 121, 5, 125, 5, -93, 5, -89, 5, -85, 5, -81, 5, -77, 5, -75, 5, +-71, 5, 43, 5, -66, 5, -62, 5, -58, 5, -54, 5, -50, 3, -44, 5, -58, 5, -42, 5, -38, 5, -34, 5, -30, +5, -26, 5, -22, 5, -18, 5, -14, 5, -10, 5, -6, 5, -2, 6, 2, 6, 6, 6, 10, 6, 14, 5, 76, 6, +22, 3, 34, 6, 28, 6, 108, 6, 55, 6, 61, 6, 95, 6, 99, 6, 103, 0, 1, 0, 84, 3, 31, 3, 39, +3, 45, 3, 49, 3, 53, 3, -119, 3, -113, 3, -107, 3, -103, 3, -99, 3, -95, 3, -91, 3, -79, 3, -75, 3, +-71, 3, -67, 3, -63, 3, -59, 3, -55, 3, -51, 3, -47, 3, -43, 3, -39, 3, -35, 3, -31, 3, -27, 3, -23, +3, -21, 3, -15, 5, 40, 5, 44, 5, 74, 5, 78, 5, 82, 5, 86, 5, 90, 5, 94, 5, 98, 5, 102, 5, +106, 5, 110, 5, 114, 5, 118, 5, 122, 5, -96, 5, -92, 5, -88, 5, -84, 5, -80, 5, -76, 5, -74, 5, -70, +5, -69, 5, -65, 5, -61, 5, -57, 5, -53, 5, -49, 5, -47, 5, -45, 5, -41, 5, -37, 5, -33, 5, -29, 5, +-25, 5, -21, 5, -17, 5, -13, 5, -9, 5, -5, 5, -1, 6, 3, 6, 7, 6, 11, 6, 17, 6, 19, 6, 23, +6, 25, 6, 31, 6, 52, 6, 58, 6, 92, 6, 96, 6, 100, 0, 1, 0, 1, 0, 1, 0, 8, 0, 2, 1, +34, 0, -114, 3, 32, 3, 40, 3, 44, 3, 46, 3, 50, 3, 54, 3, -126, 3, -124, 3, -122, 3, -120, 3, -118, +3, -114, 3, -112, 3, -108, 3, -106, 3, -102, 3, -98, 3, -94, 3, -90, 3, -86, 3, -84, 3, -82, 3, -80, 3, +-78, 3, -74, 3, -70, 3, -66, 3, -62, 3, -58, 3, -54, 3, -50, 3, -46, 3, -42, 3, -38, 3, -34, 3, -30, +3, -26, 3, -22, 3, -22, 3, -18, 3, -16, 3, -14, 3, -10, 3, -8, 3, -6, 3, -4, 5, 40, 5, 44, 5, +61, 5, 63, 5, 65, 5, 67, 5, 69, 5, 71, 5, 73, 5, 75, 5, 79, 5, 83, 5, 87, 5, 91, 5, 95, +5, 99, 5, 103, 5, 107, 5, 111, 5, 115, 5, 119, 5, 123, 5, 127, 5, -127, 5, -125, 5, -123, 5, -121, 5, +-119, 5, -117, 5, -115, 5, -113, 5, -111, 5, -109, 5, -107, 5, -105, 5, -103, 5, -101, 5, -99, 5, -97, 5, -95, +5, -91, 5, -87, 5, -83, 5, -79, 5, -75, 5, -73, 5, -70, 5, -68, 5, -64, 5, -60, 5, -56, 5, -52, 5, +-48, 5, -46, 5, -44, 5, -40, 5, -36, 6, 115, 5, -28, 5, -24, 5, -20, 5, -16, 5, -12, 5, -8, 5, -4, +6, 0, 6, 4, 6, 8, 6, 12, 6, 16, 6, 18, 6, 20, 6, 24, 6, 26, 6, 30, 6, 31, 6, 32, 6, +33, 6, 35, 6, 37, 6, 39, 6, 41, 6, 43, 6, 45, 6, 47, 6, 49, 6, 51, 6, 53, 6, 57, 6, 59, +6, 63, 6, 65, 6, 67, 6, 93, 6, 97, 6, 101, 0, 1, 0, -114, 3, 31, 3, 39, 3, 43, 3, 45, 3, +49, 3, 53, 3, -127, 3, -125, 3, -123, 3, -121, 3, -119, 3, -115, 3, -113, 3, -109, 3, -107, 3, -103, 3, -99, +3, -95, 3, -91, 3, -87, 3, -85, 3, -83, 3, -81, 3, -79, 3, -75, 3, -71, 3, -67, 3, -63, 3, -59, 3, +-55, 3, -51, 3, -47, 3, -43, 3, -39, 3, -35, 3, -31, 3, -27, 3, -23, 3, -21, 3, -19, 3, -17, 3, -15, +3, -11, 3, -9, 3, -7, 3, -5, 5, 40, 5, 44, 5, 60, 5, 62, 5, 64, 5, 66, 5, 68, 5, 70, 5, +72, 5, 74, 5, 78, 5, 82, 5, 86, 5, 90, 5, 94, 5, 98, 5, 102, 5, 106, 5, 110, 5, 114, 5, 118, +5, 122, 5, 126, 5, -128, 5, -126, 5, -124, 5, -122, 5, -120, 5, -118, 5, -116, 5, -114, 5, -112, 5, -110, 5, +-108, 5, -106, 5, -104, 5, -102, 5, -100, 5, -98, 5, -96, 5, -92, 5, -88, 5, -84, 5, -80, 5, -76, 5, -74, +5, -70, 5, -69, 5, -65, 5, -61, 5, -57, 5, -53, 5, -49, 5, -47, 5, -45, 5, -41, 5, -37, 5, -33, 5, +-29, 5, -25, 5, -21, 5, -17, 5, -13, 5, -9, 5, -5, 5, -1, 6, 3, 6, 7, 6, 11, 6, 15, 6, 17, +6, 19, 6, 23, 6, 25, 6, 29, 6, 31, 6, 32, 6, 33, 6, 34, 6, 36, 6, 38, 6, 40, 6, 42, 6, +44, 6, 46, 6, 48, 6, 50, 6, 52, 6, 56, 6, 58, 6, 62, 6, 64, 6, 66, 6, 92, 6, 96, 6, 100, +0, 1, 0, 1, 0, 1, 0, 8, 0, 2, 1, 34, 0, -114, 3, 32, 3, 40, 3, 44, 3, 46, 3, 50, 3, +54, 3, -126, 3, -124, 3, -122, 3, -120, 3, -118, 3, -114, 3, -112, 3, -108, 3, -106, 3, -102, 3, -98, 3, -94, +3, -90, 3, -86, 3, -84, 3, -82, 3, -80, 3, -78, 3, -74, 3, -70, 3, -66, 3, -62, 3, -58, 3, -54, 3, +-50, 3, -46, 3, -42, 3, -38, 3, -34, 3, -30, 3, -26, 3, -22, 3, -22, 3, -18, 3, -16, 3, -14, 3, -10, +3, -8, 3, -6, 3, -4, 5, 40, 5, 44, 5, 61, 5, 63, 5, 65, 5, 67, 5, 69, 5, 71, 5, 73, 5, +75, 5, 79, 5, 83, 5, 87, 5, 91, 5, 95, 5, 99, 5, 103, 5, 107, 5, 111, 5, 115, 5, 119, 5, 123, +5, 127, 5, -127, 5, -125, 5, -123, 5, -121, 5, -119, 5, -117, 5, -115, 5, -113, 5, -111, 5, -109, 5, -107, 5, +-105, 5, -103, 5, -101, 5, -99, 5, -97, 5, -95, 5, -91, 5, -87, 5, -83, 5, -79, 5, -75, 5, -73, 5, -70, +5, -68, 5, -64, 5, -60, 5, -56, 5, -52, 5, -48, 5, -46, 5, -44, 5, -40, 5, -36, 5, -32, 5, -28, 5, +-24, 5, -20, 5, -16, 5, -12, 5, -8, 5, -4, 6, 0, 6, 4, 6, 8, 6, 12, 6, 16, 6, 18, 6, 20, +6, 24, 6, 26, 6, 30, 6, 31, 6, 32, 6, 33, 6, 35, 6, 37, 6, 39, 6, 41, 6, 43, 6, 45, 6, +47, 6, 49, 6, 51, 6, 53, 6, 57, 6, 59, 6, 63, 6, 65, 6, 67, 6, 93, 6, 97, 6, 101, 0, 1, +0, -114, 3, 31, 3, 39, 3, 43, 3, 45, 3, 49, 3, 53, 3, -127, 3, -125, 3, -123, 3, -121, 3, -119, 3, +-115, 3, -113, 3, -109, 3, -107, 3, -103, 3, -99, 3, -95, 3, -91, 3, -87, 3, -85, 3, -83, 3, -81, 3, -79, +3, -75, 3, -71, 3, -67, 3, -63, 3, -59, 3, -55, 3, -51, 3, -47, 3, -43, 3, -39, 3, -35, 3, -31, 3, +-27, 3, -23, 3, -21, 3, -19, 3, -17, 3, -15, 3, -11, 3, -9, 3, -7, 3, -5, 5, 40, 5, 44, 5, 60, +5, 62, 5, 64, 5, 66, 5, 68, 5, 70, 5, 72, 5, 74, 5, 78, 5, 82, 5, 86, 5, 90, 5, 94, 5, +98, 5, 102, 5, 106, 5, 110, 5, 114, 5, 118, 5, 122, 5, 126, 5, -128, 5, -126, 5, -124, 5, -122, 5, -120, +5, -118, 5, -116, 5, -114, 5, -112, 5, -110, 5, -108, 5, -106, 5, -104, 5, -102, 5, -100, 5, -98, 5, -96, 5, +-92, 5, -88, 5, -84, 5, -80, 5, -76, 5, -74, 5, -70, 5, -69, 5, -65, 5, -61, 5, -57, 5, -53, 5, -49, +5, -47, 5, -45, 5, -41, 5, -37, 5, -33, 5, -29, 5, -25, 5, -21, 5, -17, 5, -13, 5, -9, 5, -5, 5, +-1, 6, 3, 6, 7, 6, 11, 6, 15, 6, 17, 6, 19, 6, 23, 6, 25, 6, 29, 6, 31, 6, 32, 6, 33, +6, 34, 6, 36, 6, 38, 6, 40, 6, 42, 6, 44, 6, 46, 6, 48, 6, 50, 6, 52, 6, 56, 6, 58, 6, +62, 6, 64, 6, 66, 6, 92, 6, 96, 6, 100, 0, 4, 0, 9, 0, 1, 0, 8, 0, 1, 1, 2, 0, 10, +0, 26, 0, 112, 0, -78, 0, -68, 0, -58, 0, -48, 0, -38, 0, -28, 0, -18, 0, -8, 0, 10, 0, 22, 0, +30, 0, 38, 0, 44, 0, 50, 0, 56, 0, 62, 0, 68, 0, 74, 0, 80, 3, 127, 0, 3, 3, -32, 3, -22, +3, 127, 0, 3, 3, -32, 6, 31, 3, -11, 0, 2, 3, -126, 3, -9, 0, 2, 3, -124, 3, -7, 0, 2, 3, +-120, 3, -5, 0, 2, 3, -114, 6, 120, 0, 2, 5, 63, 6, 122, 0, 2, 5, 65, 6, 124, 0, 2, 5, 67, +6, -120, 0, 2, 5, 61, 0, 8, 0, 18, 0, 24, 0, 30, 0, 36, 0, 42, 0, 48, 0, 54, 0, 60, 3, +-10, 0, 2, 3, -126, 3, -8, 0, 2, 3, -124, 3, -6, 0, 2, 3, -120, 3, -4, 0, 2, 3, -114, 6, 121, +0, 2, 5, 63, 6, 123, 0, 2, 5, 65, 6, 125, 0, 2, 5, 67, 6, -119, 0, 2, 5, 61, 0, 1, 0, +4, 6, 126, 0, 2, 3, -114, 0, 1, 0, 4, 6, 127, 0, 2, 3, -114, 0, 1, 0, 4, 6, -128, 0, 2, +3, -114, 0, 1, 0, 4, 6, -127, 0, 2, 3, -114, 0, 1, 0, 4, 6, -126, 0, 2, 3, -114, 0, 1, 0, +4, 6, -125, 0, 2, 3, -114, 0, 1, 0, 4, 6, -124, 0, 2, 3, -114, 0, 1, 0, 4, 6, -123, 0, 2, +3, -114, 0, 1, 0, 10, 3, -33, 3, -32, 5, -3, 5, -2, 6, 1, 6, 2, 6, 5, 6, 6, 6, 9, 6, +10, 0, 4, 0, 7, 0, 1, 0, 8, 0, 1, 0, 58, 0, 1, 0, 8, 0, 6, 0, 14, 0, 20, 0, 26, +0, 32, 0, 38, 0, 44, 3, 18, 0, 2, 2, -15, 3, 71, 0, 2, 2, -14, 3, 72, 0, 2, 2, -13, 3, +73, 0, 2, 2, -12, 3, 74, 0, 2, 2, -11, 3, 75, 0, 2, 2, -10, 0, 1, 0, 1, 2, -9, 0, 0, +0, 1, 0, 0, 0, 1, 97, 114, 97, 98, 0, 12, 0, 6, 0, 0, 0, 0, 0, 5, 2, -16, 3, 27, 4, +103, 4, 104, 4, 105, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 26, 103, 0, 0, +0, 20, 0, 0, 0, 0, 0, 0, 26, 95, 48, -126, 26, 91, 6, 9, 42, -122, 72, -122, -9, 13, 1, 7, 2, +-96, -126, 26, 76, 48, -126, 26, 72, 2, 1, 1, 49, 14, 48, 12, 6, 8, 42, -122, 72, -122, -9, 13, 2, 5, +5, 0, 48, 96, 6, 10, 43, 6, 1, 4, 1, -126, 55, 2, 1, 4, -96, 82, 48, 80, 48, 44, 6, 10, 43, +6, 1, 4, 1, -126, 55, 2, 1, 28, -94, 30, -128, 28, 0, 60, 0, 60, 0, 60, 0, 79, 0, 98, 0, 115, +0, 111, 0, 108, 0, 101, 0, 116, 0, 101, 0, 62, 0, 62, 0, 62, 48, 32, 48, 12, 6, 8, 42, -122, 72, +-122, -9, 13, 2, 5, 5, 0, 4, 16, -92, 69, -51, -68, -104, -28, -120, 70, -6, -83, -17, -8, 84, -30, 96, 35, +-96, -126, 20, -68, 48, -126, 2, -68, 48, -126, 2, 37, 2, 16, 74, 25, -46, 56, -116, -126, 89, 28, -91, 93, 115, +95, 21, 93, -36, -93, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 4, 5, 0, 48, -127, -98, 49, 31, +48, 29, 6, 3, 85, 4, 10, 19, 22, 86, 101, 114, 105, 83, 105, 103, 110, 32, 84, 114, 117, 115, 116, 32, 78, +101, 116, 119, 111, 114, 107, 49, 23, 48, 21, 6, 3, 85, 4, 11, 19, 14, 86, 101, 114, 105, 83, 105, 103, 110, +44, 32, 73, 110, 99, 46, 49, 44, 48, 42, 6, 3, 85, 4, 11, 19, 35, 86, 101, 114, 105, 83, 105, 103, 110, +32, 84, 105, 109, 101, 32, 83, 116, 97, 109, 112, 105, 110, 103, 32, 83, 101, 114, 118, 105, 99, 101, 32, 82, 111, +111, 116, 49, 52, 48, 50, 6, 3, 85, 4, 11, 19, 43, 78, 79, 32, 76, 73, 65, 66, 73, 76, 73, 84, 89, +32, 65, 67, 67, 69, 80, 84, 69, 68, 44, 32, 40, 99, 41, 57, 55, 32, 86, 101, 114, 105, 83, 105, 103, 110, +44, 32, 73, 110, 99, 46, 48, 30, 23, 13, 57, 55, 48, 53, 49, 50, 48, 48, 48, 48, 48, 48, 90, 23, 13, +48, 52, 48, 49, 48, 55, 50, 51, 53, 57, 53, 57, 90, 48, -127, -98, 49, 31, 48, 29, 6, 3, 85, 4, 10, +19, 22, 86, 101, 114, 105, 83, 105, 103, 110, 32, 84, 114, 117, 115, 116, 32, 78, 101, 116, 119, 111, 114, 107, 49, +23, 48, 21, 6, 3, 85, 4, 11, 19, 14, 86, 101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, 49, +44, 48, 42, 6, 3, 85, 4, 11, 19, 35, 86, 101, 114, 105, 83, 105, 103, 110, 32, 84, 105, 109, 101, 32, 83, +116, 97, 109, 112, 105, 110, 103, 32, 83, 101, 114, 118, 105, 99, 101, 32, 82, 111, 111, 116, 49, 52, 48, 50, 6, +3, 85, 4, 11, 19, 43, 78, 79, 32, 76, 73, 65, 66, 73, 76, 73, 84, 89, 32, 65, 67, 67, 69, 80, 84, +69, 68, 44, 32, 40, 99, 41, 57, 55, 32, 86, 101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, 48, +-127, -97, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -127, -115, 0, 48, -127, -119, 2, +-127, -127, 0, -45, 46, 32, -16, 104, 124, 44, 45, 46, -127, 28, -79, 6, -78, -89, 11, -73, 17, 13, 87, -38, 83, +-40, 117, -29, -55, 51, 42, -78, -44, -10, 9, 91, 52, -13, -23, -112, -2, 9, 12, -48, -37, 27, 90, -71, -51, -25, +-10, -120, -79, -99, -64, -121, 37, -21, 125, 88, 16, 115, 106, 120, -53, 113, 21, -3, -58, 88, -10, 41, -85, 88, 94, +-106, 4, -3, 45, 98, 17, 88, -127, 28, -54, 113, -108, -43, 34, 88, 47, -43, -52, 20, 5, -124, 54, -70, -108, -86, +-76, 77, 74, -23, -18, 59, 34, -83, 86, -103, 126, 33, -100, 108, -122, -64, 74, 71, -105, 106, -76, -90, 54, -43, -4, +9, 45, -45, -76, 57, -101, 2, 3, 1, 0, 1, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 4, 5, +0, 3, -127, -127, 0, 97, 85, 14, 62, 123, -57, -110, 18, 126, 17, 16, -114, 34, -52, -44, -77, 19, 43, 91, -24, +68, -28, 11, 120, -98, -92, 126, -13, -89, 7, 114, 30, -30, 89, -17, -52, -124, -29, -119, -108, 76, -37, 78, 97, -17, +-77, -92, -5, 70, 61, 80, 52, 11, -97, 112, 86, -10, -114, 42, 127, 23, -50, -27, 99, -65, 121, 105, 7, 115, 46, +-80, -107, 40, -118, -11, -19, -86, -87, -46, 93, -51, 10, -54, 16, 9, -113, -50, -77, -81, 40, -106, -60, 121, 41, -124, +-110, -36, -1, -70, 103, 66, 72, -90, -112, 16, -28, -65, 97, -8, -100, 83, -27, -109, -47, 115, 63, -8, -3, -99, 79, +-124, -84, 85, -47, -3, 17, 99, 99, 48, -126, 4, 2, 48, -126, 3, 107, -96, 3, 2, 1, 2, 2, 16, 8, 122, +109, 92, 111, 98, -109, 79, -70, -60, -3, 67, -31, 20, 24, -99, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, +1, 4, 5, 0, 48, -127, -98, 49, 31, 48, 29, 6, 3, 85, 4, 10, 19, 22, 86, 101, 114, 105, 83, 105, 103, +110, 32, 84, 114, 117, 115, 116, 32, 78, 101, 116, 119, 111, 114, 107, 49, 23, 48, 21, 6, 3, 85, 4, 11, 19, +14, 86, 101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, 49, 44, 48, 42, 6, 3, 85, 4, 11, 19, +35, 86, 101, 114, 105, 83, 105, 103, 110, 32, 84, 105, 109, 101, 32, 83, 116, 97, 109, 112, 105, 110, 103, 32, 83, +101, 114, 118, 105, 99, 101, 32, 82, 111, 111, 116, 49, 52, 48, 50, 6, 3, 85, 4, 11, 19, 43, 78, 79, 32, +76, 73, 65, 66, 73, 76, 73, 84, 89, 32, 65, 67, 67, 69, 80, 84, 69, 68, 44, 32, 40, 99, 41, 57, 55, +32, 86, 101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, 48, 30, 23, 13, 48, 49, 48, 50, 50, 56, +48, 48, 48, 48, 48, 48, 90, 23, 13, 48, 52, 48, 49, 48, 54, 50, 51, 53, 57, 53, 57, 90, 48, -127, -96, +49, 23, 48, 21, 6, 3, 85, 4, 10, 19, 14, 86, 101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, +49, 31, 48, 29, 6, 3, 85, 4, 11, 19, 22, 86, 101, 114, 105, 83, 105, 103, 110, 32, 84, 114, 117, 115, 116, +32, 78, 101, 116, 119, 111, 114, 107, 49, 59, 48, 57, 6, 3, 85, 4, 11, 19, 50, 84, 101, 114, 109, 115, 32, +111, 102, 32, 117, 115, 101, 32, 97, 116, 32, 104, 116, 116, 112, 115, 58, 47, 47, 119, 119, 119, 46, 118, 101, 114, +105, 115, 105, 103, 110, 46, 99, 111, 109, 47, 114, 112, 97, 32, 40, 99, 41, 48, 49, 49, 39, 48, 37, 6, 3, +85, 4, 3, 19, 30, 86, 101, 114, 105, 83, 105, 103, 110, 32, 84, 105, 109, 101, 32, 83, 116, 97, 109, 112, 105, +110, 103, 32, 83, 101, 114, 118, 105, 99, 101, 48, -126, 1, 34, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, +1, 1, 5, 0, 3, -126, 1, 15, 0, 48, -126, 1, 10, 2, -126, 1, 1, 0, -64, 122, 97, -121, -21, -78, -89, +3, 99, 27, 43, 26, 97, -34, -128, -73, 21, 29, -96, -117, -112, 61, -69, 39, -110, -124, 20, 57, -21, -123, -50, 41, +-110, 6, 102, 72, -92, 3, 79, -115, -24, 79, -89, -16, -81, 94, -47, 47, 25, -57, -111, -15, -75, -98, 123, -111, 33, +-50, -23, -1, -29, 78, -16, -4, -81, -107, 88, -72, 99, 45, -26, -114, -10, 41, 24, -51, 112, -114, 80, -61, -19, -106, +-69, 64, -37, -66, 37, -24, 66, 85, -42, -10, -123, -14, 6, -25, -117, -103, 28, 49, -13, 3, 15, -44, 76, -100, 36, +42, -36, 27, 27, -113, -126, -13, -80, -17, -89, 77, -29, 20, -89, -32, -113, -42, -57, 104, -62, 97, 88, -87, 114, -44, +-8, 48, 72, 79, -39, 47, 111, 99, 32, -39, -119, -54, -126, 123, -62, 75, -68, 40, -59, -127, 104, -25, -26, -126, 64, +-84, 70, 58, -96, -7, 63, 54, -51, 76, -69, 84, 66, 90, 122, 101, 123, -2, -124, -28, -57, 71, 84, -84, -71, 61, +-20, -128, -57, 26, -9, -60, 51, -127, -127, -55, 42, -107, -5, 127, 94, 58, -121, -112, 20, -37, -52, 46, 117, -14, -17, +107, -26, 61, -87, 96, -66, 66, 1, -86, 79, -86, 91, -88, 63, 34, 49, -97, 18, 21, -7, 115, -95, 30, -126, -117, +4, 43, -22, 70, 2, 76, 109, -113, 31, 80, 46, -107, 75, 42, 120, 6, -124, 116, 61, -111, -113, 44, 71, 49, 2, +3, 1, 0, 1, -93, -127, -72, 48, -127, -75, 48, 64, 6, 8, 43, 6, 1, 5, 5, 7, 1, 1, 4, 52, 48, +50, 48, 48, 6, 8, 43, 6, 1, 5, 5, 7, 48, 1, -122, 36, 104, 116, 116, 112, 58, 47, 47, 111, 99, 115, +112, 46, 118, 101, 114, 105, 115, 105, 103, 110, 46, 99, 111, 109, 47, 111, 99, 115, 112, 47, 115, 116, 97, 116, 117, +115, 48, 9, 6, 3, 85, 29, 19, 4, 2, 48, 0, 48, 68, 6, 3, 85, 29, 32, 4, 61, 48, 59, 48, 57, +6, 11, 96, -122, 72, 1, -122, -8, 69, 1, 7, 1, 1, 48, 42, 48, 40, 6, 8, 43, 6, 1, 5, 5, 7, +2, 1, 22, 28, 104, 116, 116, 112, 115, 58, 47, 47, 119, 119, 119, 46, 118, 101, 114, 105, 115, 105, 103, 110, 46, +99, 111, 109, 47, 114, 112, 97, 48, 19, 6, 3, 85, 29, 37, 4, 12, 48, 10, 6, 8, 43, 6, 1, 5, 5, +7, 3, 8, 48, 11, 6, 3, 85, 29, 15, 4, 4, 3, 2, 6, -64, 48, 13, 6, 9, 42, -122, 72, -122, -9, +13, 1, 1, 4, 5, 0, 3, -127, -127, 0, 45, -13, 79, 99, 96, 44, 24, -38, -11, 36, 15, 82, -77, 12, -21, +-77, -68, 103, -123, -62, 35, -19, -113, 70, 13, -49, 26, 77, -66, -13, 124, 122, 32, 48, 50, 24, 104, -117, -110, -69, +50, -103, -16, -109, -72, 59, 21, 6, 39, 123, 62, 2, 6, 0, -92, 33, -110, -124, 19, 10, -59, -104, -27, 64, 87, +-59, 5, 37, -24, -81, -81, 17, 106, -87, -27, 59, -53, -23, 35, -10, -108, 41, 93, 64, 85, -13, -91, 83, -99, -56, +54, 58, 57, 101, 8, 115, 115, -92, 50, -46, -81, -84, -65, -57, 5, 60, -1, 69, -20, -61, -24, -38, 36, -47, -50, +99, -82, 9, -89, -5, -30, 27, -29, -3, 65, 10, 106, -106, 48, -126, 4, 18, 48, -126, 2, -6, -96, 3, 2, 1, +2, 2, 15, 0, -63, 0, -117, 60, 60, -120, 17, -47, 62, -10, 99, -20, -33, 64, 48, 13, 6, 9, 42, -122, 72, +-122, -9, 13, 1, 1, 4, 5, 0, 48, 112, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, 111, 112, 121, +114, 105, 103, 104, 116, 32, 40, 99, 41, 32, 49, 57, 57, 55, 32, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, +67, 111, 114, 112, 46, 49, 30, 48, 28, 6, 3, 85, 4, 11, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, 116, +32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 49, 33, 48, 31, 6, 3, 85, 4, 3, 19, 24, 77, 105, +99, 114, 111, 115, 111, 102, 116, 32, 82, 111, 111, 116, 32, 65, 117, 116, 104, 111, 114, 105, 116, 121, 48, 30, 23, +13, 57, 55, 48, 49, 49, 48, 48, 55, 48, 48, 48, 48, 90, 23, 13, 50, 48, 49, 50, 51, 49, 48, 55, 48, +48, 48, 48, 90, 48, 112, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, 111, 112, 121, 114, 105, 103, 104, +116, 32, 40, 99, 41, 32, 49, 57, 57, 55, 32, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, +46, 49, 30, 48, 28, 6, 3, 85, 4, 11, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, +112, 111, 114, 97, 116, 105, 111, 110, 49, 33, 48, 31, 6, 3, 85, 4, 3, 19, 24, 77, 105, 99, 114, 111, 115, +111, 102, 116, 32, 82, 111, 111, 116, 32, 65, 117, 116, 104, 111, 114, 105, 116, 121, 48, -126, 1, 34, 48, 13, 6, +9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -126, 1, 15, 0, 48, -126, 1, 10, 2, -126, 1, 1, +0, -87, 2, -67, -63, 112, -26, 59, -14, 78, 27, 40, -97, -105, 120, 94, 48, -22, -94, -87, -115, 37, 95, -8, -2, +-107, 76, -93, -73, -2, -99, -94, 32, 62, 124, 81, -94, -101, -94, -113, 96, 50, 107, -47, 66, 100, 121, -18, -84, 118, +-55, 84, -38, -14, -21, -100, -122, 28, -113, -97, -124, 102, -77, -59, 107, 122, 98, 35, -42, 29, 60, -34, 15, 1, -110, +-24, -106, -60, -65, 45, 102, -102, -102, 104, 38, -103, -48, 58, 44, -65, 12, -75, 88, 38, -63, 70, -25, 10, 62, 56, +-106, 44, -87, 40, 57, -88, -20, 73, -125, 66, -29, -124, 15, -69, -102, 108, 85, 97, -84, -126, 124, -95, 96, 45, 119, +76, -23, -103, -76, 100, 59, -102, 80, 28, 49, 8, 36, 20, -97, -87, -25, -111, 43, 24, -26, 61, -104, 99, 20, 96, +88, 5, 101, -97, 29, 55, 82, -121, -9, -89, -17, -108, 2, -58, 27, -45, -65, 85, 69, -77, -119, -128, -65, 58, -20, +84, -108, 78, -82, -3, -89, 122, 109, 116, 78, -81, 24, -52, -106, 9, 40, 33, 0, 87, -112, 96, 105, 55, -69, 75, +18, 7, 60, 86, -1, 91, -5, -92, 102, 10, 8, -90, -46, -127, 86, 87, -17, -74, 59, 94, 22, -127, 119, 4, -38, +-10, -66, -82, -128, -107, -2, -80, -51, 127, -42, -89, 26, 114, 92, 60, -54, -68, -16, 8, -93, 34, 48, -77, 6, -123, +-55, -77, 32, 119, 19, -123, -33, 2, 3, 1, 0, 1, -93, -127, -88, 48, -127, -91, 48, -127, -94, 6, 3, 85, 29, +1, 4, -127, -102, 48, -127, -105, -128, 16, 91, -48, 112, -17, 105, 114, -98, 35, 81, 126, 20, -78, 77, -114, -1, -53, +-95, 114, 48, 112, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, 111, 112, 121, 114, 105, 103, 104, 116, 32, +40, 99, 41, 32, 49, 57, 57, 55, 32, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 46, 49, +30, 48, 28, 6, 3, 85, 4, 11, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 111, +114, 97, 116, 105, 111, 110, 49, 33, 48, 31, 6, 3, 85, 4, 3, 19, 24, 77, 105, 99, 114, 111, 115, 111, 102, +116, 32, 82, 111, 111, 116, 32, 65, 117, 116, 104, 111, 114, 105, 116, 121, -126, 15, 0, -63, 0, -117, 60, 60, -120, +17, -47, 62, -10, 99, -20, -33, 64, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 4, 5, 0, 3, -126, +1, 1, 0, -107, -24, 11, -64, -115, -13, -105, 24, 53, -19, -72, 1, 36, -40, 119, 17, -13, 92, 96, 50, -97, -98, +11, -53, 62, 5, -111, -120, -113, -55, 58, -26, 33, -14, -16, 87, -109, 44, -75, -96, 71, -56, 98, -17, -4, -41, -52, +59, 59, 90, -87, 54, 84, 105, -2, 36, 109, 63, -55, -52, -86, -34, 5, 124, -35, 49, -115, 61, -97, 16, 112, 106, +-69, -2, 18, 79, 24, 105, -64, -4, -48, 67, -29, 17, 90, 32, 79, -22, 98, 123, -81, -86, 25, -56, 43, 55, 37, +45, -66, 101, -95, 18, -118, 37, 15, 99, -93, -9, 84, 28, -7, 33, -55, -42, 21, -13, 82, -84, 110, 67, 50, 7, +-3, -126, 23, -8, -27, 103, 108, 13, 81, -10, -67, -15, 82, -57, -67, -25, -60, 48, -4, 32, 49, 9, -120, 29, -107, +41, 26, 77, -43, 29, 2, -91, -15, -128, -32, 3, -76, 91, -12, -79, -35, -56, 87, -18, 101, 73, -57, 82, 84, -74, +-76, 3, 40, 18, -1, -112, -42, -16, 8, -113, 126, -72, -105, -59, -85, 55, 44, -28, 122, -28, -88, 119, -29, 118, -96, +0, -48, 106, 63, -63, -46, 54, -118, -32, 65, 18, -88, 53, 106, 27, 106, -37, 53, -31, -44, 28, 4, -28, -88, 69, +4, -56, 90, 51, 56, 110, 77, 28, 13, 98, -73, 10, -94, -116, -45, -43, 84, 63, 70, -51, 28, 85, -90, 112, -37, +18, 58, -121, -109, 117, -97, -89, -46, -96, 48, -126, 4, -55, 48, -126, 3, -79, -96, 3, 2, 1, 2, 2, 16, 106, +11, -103, 79, -64, 0, -34, -86, 17, -44, -40, 64, -102, -88, -66, -26, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, +1, 1, 4, 5, 0, 48, 112, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, 111, 112, 121, 114, 105, 103, +104, 116, 32, 40, 99, 41, 32, 49, 57, 57, 55, 32, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, +112, 46, 49, 30, 48, 28, 6, 3, 85, 4, 11, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, +114, 112, 111, 114, 97, 116, 105, 111, 110, 49, 33, 48, 31, 6, 3, 85, 4, 3, 19, 24, 77, 105, 99, 114, 111, +115, 111, 102, 116, 32, 82, 111, 111, 116, 32, 65, 117, 116, 104, 111, 114, 105, 116, 121, 48, 30, 23, 13, 48, 48, +49, 50, 49, 48, 48, 56, 48, 48, 48, 48, 90, 23, 13, 48, 53, 49, 49, 49, 50, 48, 56, 48, 48, 48, 48, +90, 48, -127, -90, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 19, 48, 17, 6, 3, 85, 4, +8, 19, 10, 87, 97, 115, 104, 105, 110, 103, 116, 111, 110, 49, 16, 48, 14, 6, 3, 85, 4, 7, 19, 7, 82, +101, 100, 109, 111, 110, 100, 49, 30, 48, 28, 6, 3, 85, 4, 10, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, +116, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, +111, 112, 121, 114, 105, 103, 104, 116, 32, 40, 99, 41, 32, 50, 48, 48, 48, 32, 77, 105, 99, 114, 111, 115, 111, +102, 116, 32, 67, 111, 114, 112, 46, 49, 35, 48, 33, 6, 3, 85, 4, 3, 19, 26, 77, 105, 99, 114, 111, 115, +111, 102, 116, 32, 67, 111, 100, 101, 32, 83, 105, 103, 110, 105, 110, 103, 32, 80, 67, 65, 48, -126, 1, 32, 48, +13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -126, 1, 13, 0, 48, -126, 1, 8, 2, -126, +1, 1, 0, -94, -124, 21, 83, -40, 11, 48, 14, 52, -107, -1, 58, 27, -62, -13, 47, 123, 109, 55, 35, 77, -13, +-46, -116, -27, -3, -81, -3, -59, 2, 52, 31, 36, -57, -27, -95, -36, 84, -20, 126, 2, 116, 71, -85, -37, 50, 88, +22, 20, 81, 41, 56, -15, 126, -78, -76, -116, 58, 71, -75, 57, 78, 110, 84, -62, 49, 12, 58, 109, -5, -51, -51, +-53, 80, -100, 27, -82, -89, -40, -39, 74, 38, 63, -75, -59, -53, -113, -106, -30, 73, -14, 109, -40, -23, -106, 62, -34, +5, -49, -16, -90, 85, 55, -83, 47, 96, -51, -128, 97, 66, -95, 73, 84, 74, 15, 24, -73, 75, -39, -109, -103, 48, +90, 71, 117, 100, -76, -45, -69, -35, -74, -85, 12, -99, 79, -72, 115, 59, 24, 58, -86, -76, -121, -116, -80, -120, -80, +77, 79, 31, 78, 17, -75, 51, -128, -33, 13, 58, 100, 111, 68, -57, 52, -67, 74, -109, -101, -68, -90, 29, -7, 5, +35, 78, 96, 41, -113, -52, 42, -14, -124, -102, -103, -83, -88, -37, 10, 112, 123, -42, 52, 65, -112, -91, -73, 102, -57, +92, 27, 29, -93, 51, 14, -101, 84, 3, 26, 63, -104, -112, -72, -52, -25, 61, 4, 116, 67, 28, -113, -9, 57, -26, +-77, -84, 72, 122, 107, 42, 14, 98, 1, 97, 57, 118, 110, -3, 62, -104, 7, 75, 20, -15, 1, 70, -3, 21, 0, +-32, 71, -38, 79, -28, 5, -28, -128, 37, 2, 1, 3, -93, -126, 1, 40, 48, -126, 1, 36, 48, 19, 6, 3, 85, +29, 37, 4, 12, 48, 10, 6, 8, 43, 6, 1, 5, 5, 7, 3, 3, 48, -127, -94, 6, 3, 85, 29, 1, 4, +-127, -102, 48, -127, -105, -128, 16, 91, -48, 112, -17, 105, 114, -98, 35, 81, 126, 20, -78, 77, -114, -1, -53, -95, 114, +48, 112, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, 111, 112, 121, 114, 105, 103, 104, 116, 32, 40, 99, +41, 32, 49, 57, 57, 55, 32, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 46, 49, 30, 48, +28, 6, 3, 85, 4, 11, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 111, 114, 97, +116, 105, 111, 110, 49, 33, 48, 31, 6, 3, 85, 4, 3, 19, 24, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, +82, 111, 111, 116, 32, 65, 117, 116, 104, 111, 114, 105, 116, 121, -126, 15, 0, -63, 0, -117, 60, 60, -120, 17, -47, +62, -10, 99, -20, -33, 64, 48, 16, 6, 9, 43, 6, 1, 4, 1, -126, 55, 21, 1, 4, 3, 2, 1, 0, 48, +29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 41, 92, -71, 27, -74, -51, 51, -18, -69, -98, 89, 125, -9, -27, -54, +46, -60, 13, 52, 40, 48, 25, 6, 9, 43, 6, 1, 4, 1, -126, 55, 20, 2, 4, 12, 30, 10, 0, 83, 0, +117, 0, 98, 0, 67, 0, 65, 48, 11, 6, 3, 85, 29, 15, 4, 4, 3, 2, 1, 70, 48, 15, 6, 3, 85, +29, 19, 1, 1, -1, 4, 5, 48, 3, 1, 1, -1, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 4, +5, 0, 3, -126, 1, 1, 0, 69, 88, -30, -102, 65, 127, -4, -99, -65, 72, 119, 119, -82, -116, -39, -26, 25, -59, +87, -76, 26, -67, -76, -71, 95, 2, -95, 69, 106, 57, 89, -7, -71, 39, -100, 45, 77, -98, -4, -94, -28, 56, -118, +56, 100, 34, 66, -33, -71, 47, 42, -49, -73, -42, 6, -54, -21, 42, -65, -32, 26, -123, 124, -37, 81, 8, 61, -12, +34, -45, -44, -64, 109, -120, -127, 21, 68, 95, 100, -125, 100, -60, -87, -108, 44, -118, -37, -112, 55, 74, 15, -73, -24, +-44, 97, -113, 118, 118, -31, -39, 37, -1, 36, -124, -107, -115, 4, 86, 84, -108, -95, 28, 58, 62, -126, -68, -18, -91, +-121, -116, 28, -116, 75, 121, 95, -75, 73, -6, 94, 50, 105, 58, 31, 84, -83, 117, 77, -33, 100, -25, 48, 60, -37, +100, 73, 68, -5, -5, -60, 28, 66, 113, -26, -96, 61, 69, -18, 107, 0, -97, -84, 66, -67, -70, 17, -77, 86, -28, +-5, -43, -94, 42, -127, -40, 31, 78, -94, 85, -66, 39, -113, 112, -90, -94, 108, 27, -1, 84, -118, -126, -68, -127, 75, +-90, -95, -79, 102, 122, -87, 23, -89, -53, 6, -64, 71, -21, -90, -77, -23, 49, 21, 83, 61, 42, 4, -65, -1, 115, +72, -36, -117, 39, 67, -4, 99, -24, -18, 36, -121, 91, -66, 54, -47, -24, 49, -11, 50, -39, 94, -33, 121, 122, -70, +48, -84, 105, -122, 74, -5, -116, 17, -65, 27, -115, 84, 89, 48, -126, 5, 15, 48, -126, 3, -9, -96, 3, 2, 1, +2, 2, 10, 97, 7, 17, 67, 0, 0, 0, 0, 0, 52, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, +5, 5, 0, 48, -127, -90, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 19, 48, 17, 6, 3, +85, 4, 8, 19, 10, 87, 97, 115, 104, 105, 110, 103, 116, 111, 110, 49, 16, 48, 14, 6, 3, 85, 4, 7, 19, +7, 82, 101, 100, 109, 111, 110, 100, 49, 30, 48, 28, 6, 3, 85, 4, 10, 19, 21, 77, 105, 99, 114, 111, 115, +111, 102, 116, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, +34, 67, 111, 112, 121, 114, 105, 103, 104, 116, 32, 40, 99, 41, 32, 50, 48, 48, 48, 32, 77, 105, 99, 114, 111, +115, 111, 102, 116, 32, 67, 111, 114, 112, 46, 49, 35, 48, 33, 6, 3, 85, 4, 3, 19, 26, 77, 105, 99, 114, +111, 115, 111, 102, 116, 32, 67, 111, 100, 101, 32, 83, 105, 103, 110, 105, 110, 103, 32, 80, 67, 65, 48, 30, 23, +13, 48, 50, 48, 53, 50, 53, 48, 48, 53, 53, 52, 56, 90, 23, 13, 48, 51, 49, 49, 50, 53, 48, 49, 48, +53, 52, 56, 90, 48, -127, -95, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 19, 48, 17, 6, +3, 85, 4, 8, 19, 10, 87, 97, 115, 104, 105, 110, 103, 116, 111, 110, 49, 16, 48, 14, 6, 3, 85, 4, 7, +19, 7, 82, 101, 100, 109, 111, 110, 100, 49, 30, 48, 28, 6, 3, 85, 4, 10, 19, 21, 77, 105, 99, 114, 111, +115, 111, 102, 116, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 49, 43, 48, 41, 6, 3, 85, 4, 11, +19, 34, 67, 111, 112, 121, 114, 105, 103, 104, 116, 32, 40, 99, 41, 32, 50, 48, 48, 50, 32, 77, 105, 99, 114, +111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 46, 49, 30, 48, 28, 6, 3, 85, 4, 3, 19, 21, 77, 105, 99, +114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 48, -126, 1, 34, 48, 13, 6, +9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -126, 1, 15, 0, 48, -126, 1, 10, 2, -126, 1, 1, +0, -86, -103, -67, 57, -88, 24, 39, -12, 43, 61, 11, 76, 63, 124, 119, 46, -89, -53, -75, -47, -116, 13, -62, 58, +116, -41, -109, -75, -32, -96, 75, 63, 89, 94, -50, 69, 79, -102, 121, 41, -15, 73, -52, 26, 71, -18, 85, -62, 8, +62, 18, 32, -8, 85, -14, -18, 95, -45, -32, -54, -106, -68, 48, -34, -2, 88, -56, 39, 50, -48, -123, 84, -24, -16, +-111, 16, -69, -13, 43, -66, 25, -27, 3, -101, 11, -122, 29, -13, -80, 57, -116, -72, -3, 11, 29, 60, 115, 38, -84, +87, 43, -54, 41, -94, 21, -112, -126, 21, -30, 119, -93, 64, 82, 3, -117, -99, -62, 112, -70, 31, -23, 52, -10, -13, +53, -110, 78, 85, -125, -8, -38, 48, -74, 32, -34, 87, 6, -75, 90, 66, 6, -34, 89, -53, -14, -33, -90, -67, 21, +71, 113, 25, 37, 35, -46, -53, 111, -101, 25, 121, -33, 106, 91, -15, 118, 5, 121, 41, -4, -61, 86, -54, -113, 68, +8, -123, 85, -118, -53, -56, 15, 70, 75, 85, -53, -116, -106, 119, 74, -121, -24, -87, 65, 6, -57, -1, 13, -23, 104, +87, 99, 114, -61, 105, 87, -76, 67, -49, 50, 58, 48, -36, 27, -23, -43, 67, 38, 42, 121, -2, -107, -37, 34, 103, +36, -55, 47, -48, 52, -29, -26, -5, 81, 73, -122, -72, 60, -48, 37, 95, -42, -20, -98, 3, 97, -121, -87, 104, 64, +-57, -8, -30, 3, -26, -49, 5, 2, 3, 1, 0, 1, -93, -126, 1, 64, 48, -126, 1, 60, 48, 14, 6, 3, 85, +29, 15, 1, 1, -1, 4, 4, 3, 2, 6, -64, 48, 19, 6, 3, 85, 29, 37, 4, 12, 48, 10, 6, 8, 43, +6, 1, 5, 5, 7, 3, 3, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 107, -56, -58, 81, 32, -16, -76, +47, -45, -96, -74, -82, 127, 94, 38, -78, -72, -121, 82, 41, 48, -127, -87, 6, 3, 85, 29, 35, 4, -127, -95, 48, +-127, -98, -128, 20, 41, 92, -71, 27, -74, -51, 51, -18, -69, -98, 89, 125, -9, -27, -54, 46, -60, 13, 52, 40, -95, +116, -92, 114, 48, 112, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, 111, 112, 121, 114, 105, 103, 104, 116, +32, 40, 99, 41, 32, 49, 57, 57, 55, 32, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, 46, +49, 30, 48, 28, 6, 3, 85, 4, 11, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 67, 111, 114, 112, +111, 114, 97, 116, 105, 111, 110, 49, 33, 48, 31, 6, 3, 85, 4, 3, 19, 24, 77, 105, 99, 114, 111, 115, 111, +102, 116, 32, 82, 111, 111, 116, 32, 65, 117, 116, 104, 111, 114, 105, 116, 121, -126, 16, 106, 11, -103, 79, -64, 0, +-34, -86, 17, -44, -40, 64, -102, -88, -66, -26, 48, 74, 6, 3, 85, 29, 31, 4, 67, 48, 65, 48, 63, -96, 61, +-96, 59, -122, 57, 104, 116, 116, 112, 58, 47, 47, 99, 114, 108, 46, 109, 105, 99, 114, 111, 115, 111, 102, 116, 46, +99, 111, 109, 47, 112, 107, 105, 47, 99, 114, 108, 47, 112, 114, 111, 100, 117, 99, 116, 115, 47, 67, 111, 100, 101, +83, 105, 103, 110, 80, 67, 65, 46, 99, 114, 108, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 5, 5, +0, 3, -126, 1, 1, 0, 53, 35, -3, 19, 84, -4, -23, -36, -16, -35, 12, 20, 122, -6, -89, -77, -50, -3, -89, +58, -56, -70, -27, -25, -10, 3, -5, 83, -37, -89, -103, -87, -96, -101, 54, -100, 3, -21, -126, 71, 28, 33, -67, 20, +-53, -25, 103, 64, 9, -57, 22, -111, 2, 85, -50, 67, 66, -76, -51, 27, 93, -80, -13, 50, 4, 61, 18, -27, 29, +-89, 7, -89, -113, -93, 126, 69, 85, 118, 27, -106, -107, -111, 105, -16, -35, 56, -13, 72, -119, -17, 112, 64, -73, -37, +-75, 85, -128, -64, 3, -60, 46, -74, 40, -36, 10, -126, 14, -57, 67, -29, 122, 72, 93, -72, 6, -119, -110, 64, 108, +110, -59, -36, -8, -102, -17, 11, -66, 33, 10, -116, 47, 58, -75, -19, -89, -50, 113, -121, 104, 35, -31, -77, -28, 24, +125, -72, 71, 1, -91, 43, -60, 88, -53, -78, -119, 108, 95, -3, -45, 44, -60, 111, -72, 35, -78, 13, -1, 60, -14, +17, 69, 116, -14, 9, 6, -103, 24, -35, 111, -64, -122, 1, 24, 18, 29, 43, 22, -81, 86, -17, 101, 51, -95, -22, +103, 78, -12, 75, -126, -85, -23, 15, -36, 1, -6, -33, 96, 127, 102, 71, 93, -53, 44, 112, -52, 123, 78, -39, 6, +-72, 110, -116, 12, -2, 98, 30, 66, -7, -109, 124, -94, -85, 10, -98, -48, 35, 16, -82, 77, 123, 39, -111, 111, 38, +-66, 104, -6, -90, 63, -97, 35, -21, -56, -99, -69, -121, 49, -126, 5, 15, 48, -126, 5, 11, 2, 1, 1, 48, -127, +-75, 48, -127, -90, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 19, 48, 17, 6, 3, 85, 4, +8, 19, 10, 87, 97, 115, 104, 105, 110, 103, 116, 111, 110, 49, 16, 48, 14, 6, 3, 85, 4, 7, 19, 7, 82, +101, 100, 109, 111, 110, 100, 49, 30, 48, 28, 6, 3, 85, 4, 10, 19, 21, 77, 105, 99, 114, 111, 115, 111, 102, +116, 32, 67, 111, 114, 112, 111, 114, 97, 116, 105, 111, 110, 49, 43, 48, 41, 6, 3, 85, 4, 11, 19, 34, 67, +111, 112, 121, 114, 105, 103, 104, 116, 32, 40, 99, 41, 32, 50, 48, 48, 48, 32, 77, 105, 99, 114, 111, 115, 111, +102, 116, 32, 67, 111, 114, 112, 46, 49, 35, 48, 33, 6, 3, 85, 4, 3, 19, 26, 77, 105, 99, 114, 111, 115, +111, 102, 116, 32, 67, 111, 100, 101, 32, 83, 105, 103, 110, 105, 110, 103, 32, 80, 67, 65, 2, 10, 97, 7, 17, +67, 0, 0, 0, 0, 0, 52, 48, 12, 6, 8, 42, -122, 72, -122, -9, 13, 2, 5, 5, 0, -96, -127, -36, 48, +20, 6, 9, 43, 6, 1, 4, 1, -126, 55, 40, 1, 49, 7, 3, 5, 0, 3, 0, 0, 0, 48, 25, 6, 9, +42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 12, 6, 10, 43, 6, 1, 4, 1, -126, 55, 2, 1, 4, 48, 28, +6, 10, 43, 6, 1, 4, 1, -126, 55, 2, 1, 11, 49, 14, 48, 12, 6, 10, 43, 6, 1, 4, 1, -126, 55, +2, 1, 21, 48, 31, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 18, 4, 16, 90, 7, 4, -83, -45, +91, -18, 73, 48, 65, -96, -43, -40, -66, -122, -48, 48, 106, 6, 10, 43, 6, 1, 4, 1, -126, 55, 2, 1, 12, +49, 92, 48, 90, -96, 48, -128, 46, 0, 65, 0, 114, 0, 105, 0, 97, 0, 108, 0, 32, 0, 70, 0, 111, 0, +110, 0, 116, 0, 32, 0, 86, 0, 101, 0, 114, 0, 115, 0, 105, 0, 111, 0, 110, 0, 32, 0, 51, 0, 46, +0, 48, 0, 48, -95, 38, -128, 36, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 109, 105, 99, 114, 111, 115, +111, 102, 116, 46, 99, 111, 109, 47, 116, 121, 112, 111, 103, 114, 97, 112, 104, 121, 32, 48, 13, 6, 9, 42, -122, +72, -122, -9, 13, 1, 1, 1, 5, 0, 4, -126, 1, 0, 78, 55, 23, -30, 26, 55, -103, 89, 39, 11, -55, -105, +42, -21, 80, -32, 97, 2, -42, 35, -122, 72, -99, -16, -108, -67, -103, 29, 96, -63, 42, 71, -81, -73, -113, 89, 56, +5, -13, -92, -125, -105, -107, 123, -15, 4, 36, 8, 83, -52, 109, -54, -57, -57, 25, 64, -111, 43, 79, -57, -68, -105, +-82, 28, 58, -38, 124, 119, -44, -127, 117, -114, 92, 34, 60, -103, 7, 82, -118, -2, -29, -80, 103, -25, 14, 30, -12, +-19, 46, 116, -109, 70, -118, 18, -106, 76, 72, 11, 13, -1, 95, -61, -118, 59, -22, -69, -33, 91, 8, 10, 92, -1, +-93, 12, 77, -23, 81, 71, 84, -68, -126, -43, 36, -27, -127, -22, -67, -63, -73, -79, -62, 10, 121, 114, -106, 100, -83, +-14, 102, -126, -6, -11, 0, -122, 28, -17, -43, -91, -90, 35, -107, 19, 61, 33, -86, -102, -13, -78, 76, -23, 60, -31, +80, -106, -105, -123, -9, 80, -103, -41, -120, 21, 63, -104, -111, 88, 18, 66, -38, 84, 122, -124, -101, -92, 50, 54, 68, +-64, -85, -9, -93, -98, 8, 21, 23, -4, 104, 85, -96, 83, 60, 88, -19, -58, 42, -12, -102, 125, -51, 48, 66, -116, +-122, 5, 6, -46, -58, -27, 27, -102, -17, -11, 50, -48, -45, -119, -33, -68, -97, 117, -115, -50, -101, 121, 98, 43, -6, +20, 43, 19, -77, -92, 30, 8, -92, 87, 63, -116, 89, -6, -5, -59, -6, -80, -45, -4, -95, -126, 2, 76, 48, -126, +2, 72, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 6, 49, -126, 2, 57, 48, -126, 2, 53, 2, 1, 1, 48, +-127, -77, 48, -127, -98, 49, 31, 48, 29, 6, 3, 85, 4, 10, 19, 22, 86, 101, 114, 105, 83, 105, 103, 110, 32, +84, 114, 117, 115, 116, 32, 78, 101, 116, 119, 111, 114, 107, 49, 23, 48, 21, 6, 3, 85, 4, 11, 19, 14, 86, +101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, 49, 44, 48, 42, 6, 3, 85, 4, 11, 19, 35, 86, +101, 114, 105, 83, 105, 103, 110, 32, 84, 105, 109, 101, 32, 83, 116, 97, 109, 112, 105, 110, 103, 32, 83, 101, 114, +118, 105, 99, 101, 32, 82, 111, 111, 116, 49, 52, 48, 50, 6, 3, 85, 4, 11, 19, 43, 78, 79, 32, 76, 73, +65, 66, 73, 76, 73, 84, 89, 32, 65, 67, 67, 69, 80, 84, 69, 68, 44, 32, 40, 99, 41, 57, 55, 32, 86, +101, 114, 105, 83, 105, 103, 110, 44, 32, 73, 110, 99, 46, 2, 16, 8, 122, 109, 92, 111, 98, -109, 79, -70, -60, +-3, 67, -31, 20, 24, -99, 48, 12, 6, 8, 42, -122, 72, -122, -9, 13, 2, 5, 5, 0, -96, 89, 48, 24, 6, +9, 42, -122, 72, -122, -9, 13, 1, 9, 3, 49, 11, 6, 9, 42, -122, 72, -122, -9, 13, 1, 7, 1, 48, 28, +6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 5, 49, 15, 23, 13, 48, 50, 49, 48, 49, 56, 50, 49, 49, 55, +51, 52, 90, 48, 31, 6, 9, 42, -122, 72, -122, -9, 13, 1, 9, 4, 49, 18, 4, 16, 12, 105, -5, 26, 94, +53, 104, 20, -112, -111, 115, 35, 117, -35, -128, 95, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, +0, 4, -126, 1, 0, -90, 107, 37, 59, -30, 84, -46, -81, -9, -25, 55, -113, -111, 79, -41, 0, 87, 17, 54, -96, +-93, 84, -24, -86, 9, 21, 10, -79, -30, 15, 4, 120, 56, -48, -23, -66, -34, 10, 63, -116, 65, -104, -80, 44, 88, +59, 86, -11, -48, 67, 68, -45, -34, 28, 38, -86, 122, -25, -17, 41, -34, 30, -120, 64, 111, 106, -112, 66, -33, 18, +123, 18, -79, -70, 113, 20, -88, -21, -89, -93, 14, -119, 115, -23, 3, -128, -76, -106, -61, 16, -27, -26, -29, 51, 118, +-101, -38, -25, 126, 109, -20, 56, 21, 49, -63, -3, -20, 33, 106, -119, 84, -4, 80, -45, -2, 98, -115, 56, 5, 102, +-16, 120, 56, -29, -127, 31, 107, -114, 43, 44, 50, -111, -72, -40, -1, 7, 10, -124, -119, 76, -106, 63, 109, -40, -99, +-123, 97, 59, 38, -103, 62, -69, 115, -105, -95, 10, -78, -98, -87, 46, 56, -93, 14, 95, -77, 83, -23, -37, -97, 3, +-90, 28, 29, -85, 74, 71, 99, 14, 21, -102, -112, 2, -3, 32, -11, 80, -48, -108, 34, 120, 9, -123, 116, -101, 77, +-17, -21, 34, 64, -84, -72, -82, 117, 93, -84, -64, -114, 58, -7, -9, -73, 52, 91, 92, -31, -101, -6, -17, -60, 36, +52, 74, 94, -107, -5, -31, 116, 28, -102, 78, -84, 118, -82, 127, 22, 6, 66, -14, -11, 113, 77, -70, -44, -14, 52, +-9, 24, -43, -104, 68, 80, -14, 99, -5, 114, 75, 0 diff --git a/src/SFML/Graphics/Color.cpp b/src/SFML/Graphics/Color.cpp new file mode 100644 index 00000000..3623e924 --- /dev/null +++ b/src/SFML/Graphics/Color.cpp @@ -0,0 +1,142 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +const Color Color::Black(0, 0, 0); +const Color Color::White(255, 255, 255); +const Color Color::Red(255, 0, 0); +const Color Color::Green(0, 255, 0); +const Color Color::Blue(0, 0, 255); +const Color Color::Yellow(255, 255, 0); +const Color Color::Magenta(255, 0, 255); +const Color Color::Cyan(0, 255, 255); + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Color::Color() : +r(0), +g(0), +b(0), +a(255) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the color from its 4 RGBA components +//////////////////////////////////////////////////////////// +Color::Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A) : +r(R), +g(G), +b(B), +a(A) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Operator += overload to add a color +//////////////////////////////////////////////////////////// +Color& Color::operator +=(const Color& Other) +{ + r = static_cast(std::min(r + Other.r, 255)); + g = static_cast(std::min(g + Other.g, 255)); + b = static_cast(std::min(b + Other.b, 255)); + a = static_cast(std::min(a + Other.a, 255)); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Operator *= overload to modulate a color +//////////////////////////////////////////////////////////// +Color& Color::operator *=(const Color& Other) +{ + r = static_cast(r * Other.r / 255); + g = static_cast(g * Other.g / 255); + b = static_cast(b * Other.b / 255); + a = static_cast(a * Other.a / 255); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Compare two colors (for equality) +//////////////////////////////////////////////////////////// +bool Color::operator ==(const Color& Other) const +{ + return (r == Other.r) && (g == Other.g) && (b == Other.b) && (a == Other.a); +} + + +//////////////////////////////////////////////////////////// +/// Compare two colors (for difference) +//////////////////////////////////////////////////////////// +bool Color::operator !=(const Color& Other) const +{ + return (r != Other.r) || (g != Other.g) || (b != Other.b) || (a != Other.a); +} + + +//////////////////////////////////////////////////////////// +/// Operator + overload to add two colors +//////////////////////////////////////////////////////////// +Color operator +(const Color& Color1, const Color& Color2) +{ + Color c = Color1; + c += Color2; + + return c; +} + + +//////////////////////////////////////////////////////////// +/// Operator * overload to modulate two colors +//////////////////////////////////////////////////////////// +Color operator *(const Color& Color1, const Color& Color2) +{ + Color c = Color1; + c *= Color2; + + return c; +} + +} // namespace sf diff --git a/src/SFML/Graphics/Drawable.cpp b/src/SFML/Graphics/Drawable.cpp new file mode 100644 index 00000000..04f31678 --- /dev/null +++ b/src/SFML/Graphics/Drawable.cpp @@ -0,0 +1,402 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Drawable::Drawable(const Vector2f& Position, const Vector2f& Scale, float Rotation, const Color& Col) : +myPosition (Position), +myScale (Scale), +myCenter (0, 0), +myRotation (Rotation), +myColor (Col), +myBlendMode (Blend::Alpha), +myNeedUpdate (true), +myInvNeedUpdate(true) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +Drawable::~Drawable() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Set the position of the object (take 2 values) +//////////////////////////////////////////////////////////// +void Drawable::SetPosition(float X, float Y) +{ + SetX(X); + SetY(Y); +} + + +//////////////////////////////////////////////////////////// +/// Set the position of the object (take a 2D vector) +//////////////////////////////////////////////////////////// +void Drawable::SetPosition(const Vector2f& Position) +{ + SetX(Position.x); + SetY(Position.y); +} + + +//////////////////////////////////////////////////////////// +/// Set the X position of the object +//////////////////////////////////////////////////////////// +void Drawable::SetX(float X) +{ + myPosition.x = X; + myNeedUpdate = true; + myInvNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Set the Y position of the object +//////////////////////////////////////////////////////////// +void Drawable::SetY(float Y) +{ + myPosition.y = Y; + myNeedUpdate = true; + myInvNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Set the scale of the object (take 2 values) +//////////////////////////////////////////////////////////// +void Drawable::SetScale(float ScaleX, float ScaleY) +{ + SetScaleX(ScaleX); + SetScaleY(ScaleY); +} + + +//////////////////////////////////////////////////////////// +/// Set the scale of the object (take a 2D vector) +//////////////////////////////////////////////////////////// +void Drawable::SetScale(const Vector2f& Scale) +{ + SetScaleX(Scale.x); + SetScaleY(Scale.y); +} + + +//////////////////////////////////////////////////////////// +/// Set the X scale factor of the object +//////////////////////////////////////////////////////////// +void Drawable::SetScaleX(float FactorX) +{ + if (FactorX > 0) + { + myScale.x = FactorX; + myNeedUpdate = true; + myInvNeedUpdate = true; + } +} + + +//////////////////////////////////////////////////////////// +/// Set the Y scale factor of the object +//////////////////////////////////////////////////////////// +void Drawable::SetScaleY(float FactorY) +{ + if (FactorY > 0) + { + myScale.y = FactorY; + myNeedUpdate = true; + myInvNeedUpdate = true; + } +} + + +//////////////////////////////////////////////////////////// +/// Set the center of the object, in coordinates relative to the +/// top-left of the object (take 2 values). +/// The default center is (0, 0) +//////////////////////////////////////////////////////////// +void Drawable::SetCenter(float CenterX, float CenterY) +{ + myCenter.x = CenterX; + myCenter.y = CenterY; + myNeedUpdate = true; + myInvNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Set the center of the object, in coordinates relative to the +/// top-left of the object (take a 2D vector). +/// The default center is (0, 0) +//////////////////////////////////////////////////////////// +void Drawable::SetCenter(const Vector2f& Center) +{ + SetCenter(Center.x, Center.y); +} + + +//////////////////////////////////////////////////////////// +/// Set the orientation of the object +//////////////////////////////////////////////////////////// +void Drawable::SetRotation(float Rotation) +{ + myRotation = static_cast(fmod(Rotation, 360)); + if (myRotation < 0) + myRotation += 360.f; + myNeedUpdate = true; + myInvNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Set the color of the object. +/// The default color is white +//////////////////////////////////////////////////////////// +void Drawable::SetColor(const Color& Col) +{ + myColor = Col; +} + + +//////////////////////////////////////////////////////////// +/// Set the blending mode for the object. +/// The default blend mode is Blend::Alpha +//////////////////////////////////////////////////////////// +void Drawable::SetBlendMode(Blend::Mode Mode) +{ + myBlendMode = Mode; +} + + +//////////////////////////////////////////////////////////// +/// Get the position of the object +//////////////////////////////////////////////////////////// +const Vector2f& Drawable::GetPosition() const +{ + return myPosition; +} + + +//////////////////////////////////////////////////////////// +/// Get the current scale of the object +//////////////////////////////////////////////////////////// +const Vector2f& Drawable::GetScale() const +{ + return myScale; +} + + +//////////////////////////////////////////////////////////// +/// Get the center of the object +//////////////////////////////////////////////////////////// +const Vector2f& Drawable::GetCenter() const +{ + return myCenter; +} + + +//////////////////////////////////////////////////////////// +/// Get the orientation of the object +//////////////////////////////////////////////////////////// +float Drawable::GetRotation() const +{ + return myRotation; +} + + +//////////////////////////////////////////////////////////// +/// Get the color of the object +//////////////////////////////////////////////////////////// +const Color& Drawable::GetColor() const +{ + return myColor; +} + + +//////////////////////////////////////////////////////////// +/// Get the current blending mode +//////////////////////////////////////////////////////////// +Blend::Mode Drawable::GetBlendMode() const +{ + return myBlendMode; +} + + +//////////////////////////////////////////////////////////// +/// Move the object of a given offset (take 2 values) +/// +//////////////////////////////////////////////////////////// +void Drawable::Move(float OffsetX, float OffsetY) +{ + SetX(myPosition.x + OffsetX); + SetY(myPosition.y + OffsetY); +} + + +//////////////////////////////////////////////////////////// +/// Move the object of a given offset (take a 2D vector) +//////////////////////////////////////////////////////////// +void Drawable::Move(const Vector2f& Offset) +{ + Move(Offset.x, Offset.y); +} + + +//////////////////////////////////////////////////////////// +/// Scale the object (take 2 values) +//////////////////////////////////////////////////////////// +void Drawable::Scale(float FactorX, float FactorY) +{ + SetScaleX(myScale.x * FactorX); + SetScaleY(myScale.y * FactorY); +} + + +//////////////////////////////////////////////////////////// +/// Scale the object (take a 2D vector) +//////////////////////////////////////////////////////////// +void Drawable::Scale(const Vector2f& Factor) +{ + Scale(Factor.x, Factor.y); +} + + +//////////////////////////////////////////////////////////// +/// Rotate the object +//////////////////////////////////////////////////////////// +void Drawable::Rotate(float Angle) +{ + SetRotation(myRotation + Angle); +} + + +//////////////////////////////////////////////////////////// +/// Transform a point from global coordinates into local coordinates +/// (ie it applies the inverse of object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +sf::Vector2f Drawable::TransformToLocal(const sf::Vector2f& Point) const +{ + return GetInverseMatrix().Transform(Point); +} + +//////////////////////////////////////////////////////////// +/// Transform a point from local coordinates into global coordinates +/// (ie it applies the object's center, translation, rotation and scale to the point) +//////////////////////////////////////////////////////////// +sf::Vector2f Drawable::TransformToGlobal(const sf::Vector2f& Point) const +{ + return GetMatrix().Transform(Point); +} + + +//////////////////////////////////////////////////////////// +/// Get the transform matrix of the drawable +//////////////////////////////////////////////////////////// +const Matrix3& Drawable::GetMatrix() const +{ + // First recompute it if needed + if (myNeedUpdate) + { + myMatrix.SetFromTransformations(myCenter, myPosition, myRotation, myScale); + myNeedUpdate = false; + } + + return myMatrix; +} + + +//////////////////////////////////////////////////////////// +/// Get the inverse transform matrix of the drawable +//////////////////////////////////////////////////////////// +const Matrix3& Drawable::GetInverseMatrix() const +{ + // First recompute it if needed + if (myInvNeedUpdate) + { + myInvMatrix = GetMatrix().GetInverse(); + myInvNeedUpdate = false; + } + + return myInvMatrix; +} + + +//////////////////////////////////////////////////////////// +/// Draw the object into the specified window +//////////////////////////////////////////////////////////// +void Drawable::Draw(RenderTarget& Target) const +{ + // Save the current modelview matrix and set the new one + GLCheck(glMatrixMode(GL_MODELVIEW)); + GLCheck(glPushMatrix()); + GLCheck(glMultMatrixf(GetMatrix().Get4x4Elements())); + + // Setup alpha-blending + if (myBlendMode == Blend::None) + { + GLCheck(glDisable(GL_BLEND)); + } + else + { + GLCheck(glEnable(GL_BLEND)); + + switch (myBlendMode) + { + case Blend::Alpha : GLCheck(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); break; + case Blend::Add : GLCheck(glBlendFunc(GL_ONE, GL_ONE)); break; + case Blend::Multiply : GLCheck(glBlendFunc(GL_DST_COLOR, GL_ZERO)); break; + default : break; + } + } + + // Set color + GLCheck(glColor4f(myColor.r / 255.f, myColor.g / 255.f, myColor.b / 255.f, myColor.a / 255.f)); + + // Let the derived class render the object geometry + Render(Target); + + // Restore the previous modelview matrix + GLCheck(glMatrixMode(GL_MODELVIEW)); + GLCheck(glPopMatrix()); +} + +} // namespace sf diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp new file mode 100644 index 00000000..cc22f30d --- /dev/null +++ b/src/SFML/Graphics/Font.cpp @@ -0,0 +1,178 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +Uint32 Font::ourDefaultCharset[] = +{ + // Printable characters in ASCII range + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, + + // Printable characters in extended ASCII range + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0x2A, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, + + // To make it a valid string + 0x00 +}; + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Font::Font() : +myCharSize(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Load the font from a file +//////////////////////////////////////////////////////////// +bool Font::LoadFromFile(const std::string& Filename, unsigned int CharSize, const Unicode::Text& Charset) +{ + // Clear the previous character map + myGlyphs.clear(); + + // Always add these special characters + Unicode::UTF32String UTFCharset = Charset; + if (UTFCharset.find(L' ') != Unicode::UTF32String::npos) UTFCharset += L' '; + if (UTFCharset.find(L'\n') != Unicode::UTF32String::npos) UTFCharset += L'\n'; + if (UTFCharset.find(L'\v') != Unicode::UTF32String::npos) UTFCharset += L'\v'; + if (UTFCharset.find(L'\t') != Unicode::UTF32String::npos) UTFCharset += L'\t'; + + return priv::FontLoader::GetInstance().LoadFontFromFile(Filename, CharSize, UTFCharset, *this); +} + + +//////////////////////////////////////////////////////////// +/// Load the font from a file in memory +//////////////////////////////////////////////////////////// +bool Font::LoadFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize, const Unicode::Text& Charset) +{ + // Clear the previous character map + myGlyphs.clear(); + + // Check parameters + if (!Data || (SizeInBytes == 0)) + { + std::cerr << "Failed to load font from memory, no data provided" << std::endl; + return false; + } + + // Always add these special characters + Unicode::UTF32String UTFCharset = Charset; + if (UTFCharset.find(L' ') != Unicode::UTF32String::npos) UTFCharset += L' '; + if (UTFCharset.find(L'\n') != Unicode::UTF32String::npos) UTFCharset += L'\n'; + if (UTFCharset.find(L'\v') != Unicode::UTF32String::npos) UTFCharset += L'\v'; + if (UTFCharset.find(L'\t') != Unicode::UTF32String::npos) UTFCharset += L'\t'; + + return priv::FontLoader::GetInstance().LoadFontFromMemory(Data, SizeInBytes, CharSize, UTFCharset, *this); +} + + +//////////////////////////////////////////////////////////// +/// Get the base size of characters in the font; +/// All glyphs dimensions are based on this value +//////////////////////////////////////////////////////////// +unsigned int Font::GetCharacterSize() const +{ + return myCharSize; +} + + +//////////////////////////////////////////////////////////// +/// Get the description of a glyph (character) +/// given by its unicode value +//////////////////////////////////////////////////////////// +const Glyph& Font::GetGlyph(Uint32 CodePoint) const +{ + std::map::const_iterator It = myGlyphs.find(CodePoint); + if (It != myGlyphs.end()) + { + // Valid glyph + return It->second; + } + else + { + // Invalid glyph -- return an invalid glyph + static const Glyph InvalidGlyph; + return InvalidGlyph; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the image containing the rendered characters (glyphs) +//////////////////////////////////////////////////////////// +const Image& Font::GetImage() const +{ + return myTexture; +} + + +//////////////////////////////////////////////////////////// +/// Get the SFML default built-in font (Arial) +//////////////////////////////////////////////////////////// +const Font& Font::GetDefaultFont() +{ + static Font DefaultFont; + static bool DefaultFontLoaded = false; + static const char DefaultFontData[] = + { + #include + }; + + // Load the default font on first call + if (!DefaultFontLoaded) + { + DefaultFont.LoadFromMemory(DefaultFontData, sizeof(DefaultFontData), 30); + DefaultFontLoaded = true; + } + + return DefaultFont; +} + +} // namespace sf diff --git a/src/SFML/Graphics/FontLoader.cpp b/src/SFML/Graphics/FontLoader.cpp new file mode 100644 index 00000000..fbf0dfa6 --- /dev/null +++ b/src/SFML/Graphics/FontLoader.cpp @@ -0,0 +1,423 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include FT_GLYPH_H +#include +#include +#include +#include + + +namespace +{ + //////////////////////////////////////////////////////////// + // Functor to sort glyphs by size + //////////////////////////////////////////////////////////// + struct SizeCompare + { + bool operator ()(FT_BitmapGlyph Glyph1, FT_BitmapGlyph Glyph2) const + { + return Glyph2->bitmap.rows < Glyph1->bitmap.rows; + } + }; +} + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get the unique instance of the class +//////////////////////////////////////////////////////////// +FontLoader& FontLoader::GetInstance() +{ + static FontLoader Instance; + + return Instance; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +FontLoader::FontLoader() +{ + // Initialize FreeType library + FT_Error Error = FT_Init_FreeType(&myLibrary); + if (Error) + { + std::cerr << "Failed to initialize FreeType library (error code : " << Error << ")" << std::endl; + return; + } +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +FontLoader::~FontLoader() +{ + // Shutdown FreeType library + if (myLibrary) + FT_Done_FreeType(myLibrary); +} + + +//////////////////////////////////////////////////////////// +/// Load a font from a file +//////////////////////////////////////////////////////////// +bool FontLoader::LoadFontFromFile(const std::string& Filename, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont) +{ + // Check if Freetype is correctly initialized + if (!myLibrary) + { + std::cerr << "Failed to load font \"" << Filename << "\", FreeType has not been initialized" << std::endl; + return false; + } + + // Create a new font face from the specified file + FT_Face FontFace; + FT_Error Error = FT_New_Face(myLibrary, Filename.c_str(), 0, &FontFace); + if (Error) + { + std::cerr << "Failed to load font \"" << Filename << "\" (" << GetErrorDesc(Error) << ")" << std::endl; + return false; + } + + // Create the bitmap font + Error = CreateBitmapFont(FontFace, CharSize, Charset, LoadedFont); + if (Error) + std::cerr << "Failed to load font \"" << Filename << "\" (" << GetErrorDesc(Error) << ")" << std::endl; + + // Delete the font + FT_Done_Face(FontFace); + + return Error == 0; +} + + +//////////////////////////////////////////////////////////// +/// Load the font from a file in memory +//////////////////////////////////////////////////////////// +bool FontLoader::LoadFontFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont) +{ + // Check if Freetype is correctly initialized + if (!myLibrary) + { + std::cerr << "Failed to load font from memory, FreeType has not been initialized" << std::endl; + return false; + } + + // Create a new font face from the specified memory data + FT_Face FontFace; + FT_Error Error = FT_New_Memory_Face(myLibrary, reinterpret_cast(Data), static_cast(SizeInBytes), 0, &FontFace); + if (Error) + { + std::cerr << "Failed to load font from memory (" << GetErrorDesc(Error) << ")" << std::endl; + return false; + } + + // Create the bitmap font + Error = CreateBitmapFont(FontFace, CharSize, Charset, LoadedFont); + if (Error) + std::cerr << "Failed to load font from memory (" << GetErrorDesc(Error) << ")" << std::endl; + + // Delete the font + FT_Done_Face(FontFace); + + return Error == 0; +} + + +//////////////////////////////////////////////////////////// +/// Create a bitmap font from a font face and a characters set +//////////////////////////////////////////////////////////// +FT_Error FontLoader::CreateBitmapFont(FT_Face FontFace, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont) +{ + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + // Let's find how many characters to put in each row to make them fit into a squared texture + GLint MaxSize; + GLCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxSize)); + int NbChars = static_cast(sqrt(static_cast(Charset.length())) * 0.75); + + // Clamp the character size to make sure we won't create a texture too big + if (NbChars * CharSize >= static_cast(MaxSize)) + CharSize = MaxSize / NbChars; + + // Initialize the dimensions + unsigned int Left = 0; + unsigned int Top = 0; + unsigned int TexWidth = Image::GetValidTextureSize(CharSize * NbChars); + unsigned int TexHeight = CharSize * NbChars; + std::vector Tops(TexWidth, 0); + + // Create a pixel buffer for rendering every glyph + std::vector GlyphsBuffer(TexWidth * TexHeight * 4); + + // Setup the font size + FT_Error Error = FT_Set_Pixel_Sizes(FontFace, CharSize, CharSize); + if (Error) + return Error; + + // Select the unicode character map + Error = FT_Select_Charmap(FontFace, FT_ENCODING_UNICODE); + if (Error) + return Error; + + // Render all glyphs and sort them by size to optimize texture space + typedef std::multimap GlyphTable; + GlyphTable Glyphs; + for (std::size_t i = 0; i < Charset.length(); ++i) + { + // Load the glyph corresponding to the current character + Error = FT_Load_Char(FontFace, Charset[i], FT_LOAD_TARGET_NORMAL); + if (Error) + return Error; + + // Convert the glyph to a bitmap (ie. rasterize it) + FT_Glyph Glyph; + Error = FT_Get_Glyph(FontFace->glyph, &Glyph); + if (Error) + return Error; + FT_Glyph_To_Bitmap(&Glyph, FT_RENDER_MODE_NORMAL, 0, 1); + FT_BitmapGlyph BitmapGlyph = (FT_BitmapGlyph)Glyph; + + // Should we handle other pixel modes ? + if (BitmapGlyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY) + return FT_Err_Cannot_Render_Glyph; + + // Add it to the sorted table of glyphs + Glyphs.insert(std::make_pair(BitmapGlyph, Charset[i])); + } + + // Copy the rendered glyphs into the texture + unsigned int MaxHeight = 0; + std::map Coords; + for (GlyphTable::const_iterator i = Glyphs.begin(); i != Glyphs.end(); ++i) + { + // Get the bitmap of the current glyph + Glyph& CurGlyph = LoadedFont.myGlyphs[i->second]; + FT_BitmapGlyph BitmapGlyph = i->first; + FT_Bitmap& Bitmap = BitmapGlyph->bitmap; + + // Make sure we don't go over the texture width + if (Left + Bitmap.width + 1 >= TexWidth) + Left = 0; + + // Compute the top coordinate + Top = Tops[Left]; + for (int x = 0; x < Bitmap.width + 1; ++x) + Top = std::max(Top, Tops[Left + x]); + Top++; + + // Make sure we don't go over the texture height -- resize it if we need more space + if (Top + Bitmap.rows + 1 >= TexHeight) + { + TexHeight *= 2; + GlyphsBuffer.resize(TexWidth * TexHeight * 4); + } + + // Store the character's position and size + CurGlyph.Rectangle.Left = BitmapGlyph->left; + CurGlyph.Rectangle.Top = -BitmapGlyph->top; + CurGlyph.Rectangle.Right = CurGlyph.Rectangle.Left + Bitmap.width; + CurGlyph.Rectangle.Bottom = Bitmap.rows - BitmapGlyph->top; + CurGlyph.Advance = BitmapGlyph->root.advance.x >> 16; + + // Texture size may change, so let the texture coordinates be calculated later + Coords[i->second] = IntRect(Left + 1, Top + 1, Left + Bitmap.width + 1, Top + Bitmap.rows + 1); + + // Draw the glyph into our bitmap font + const Uint8* Pixels = Bitmap.buffer; + for (int y = 0; y < Bitmap.rows; ++y) + { + for (int x = 0; x < Bitmap.width; ++x) + { + std::size_t Index = x + Left + 1 + (y + Top + 1) * TexWidth; + GlyphsBuffer[Index * 4 + 0] = 255; + GlyphsBuffer[Index * 4 + 1] = 255; + GlyphsBuffer[Index * 4 + 2] = 255; + GlyphsBuffer[Index * 4 + 3] = Pixels[x]; + } + Pixels += Bitmap.pitch; + } + + // Update the rendering coordinates + for (int x = 0; x < Bitmap.width + 1; ++x) + Tops[Left + x] = Top + Bitmap.rows; + Left += Bitmap.width + 1; + if (Top + Bitmap.rows > MaxHeight) + MaxHeight = Top + Bitmap.rows; + + // Delete the glyph + FT_Done_Glyph((FT_Glyph)BitmapGlyph); + } + + // Create the font's texture + TexHeight = MaxHeight + 1; + GlyphsBuffer.resize(TexWidth * TexHeight * 4); + LoadedFont.myTexture.LoadFromPixels(TexWidth, TexHeight, &GlyphsBuffer[0]); + + // Now that the texture is created, we can precompute texture coordinates + for (std::size_t i = 0; i < Charset.size(); ++i) + { + Uint32 CurChar = Charset[i]; + LoadedFont.myGlyphs[CurChar].TexCoords = LoadedFont.myTexture.GetTexCoords(Coords[CurChar], false); + } + + // Update the character size (it may have been changed by the function) + LoadedFont.myCharSize = CharSize; + + return 0; +} + + +//////////////////////////////////////////////////////////// +/// Get a description from a FT error code +//////////////////////////////////////////////////////////// +std::string FontLoader::GetErrorDesc(FT_Error Error) +{ + switch (Error) + { + // Generic errors + case FT_Err_Cannot_Open_Resource : return "cannot open resource"; + case FT_Err_Unknown_File_Format : return "unknown file format"; + case FT_Err_Invalid_File_Format : return "broken file"; + case FT_Err_Invalid_Version : return "invalid FreeType version"; + case FT_Err_Lower_Module_Version : return "module version is too low"; + case FT_Err_Invalid_Argument : return "invalid argument"; + case FT_Err_Unimplemented_Feature : return "unimplemented feature"; + case FT_Err_Invalid_Table : return "broken table"; + case FT_Err_Invalid_Offset : return "broken offset within table"; + + // Glyph / character errors + case FT_Err_Invalid_Glyph_Index : return "invalid glyph index"; + case FT_Err_Invalid_Character_Code : return "invalid character code"; + case FT_Err_Invalid_Glyph_Format : return "unsupported glyph image format"; + case FT_Err_Cannot_Render_Glyph : return "cannot render this glyph format"; + case FT_Err_Invalid_Outline : return "invalid outline"; + case FT_Err_Invalid_Composite : return "invalid composite glyph"; + case FT_Err_Too_Many_Hints : return "too many hints"; + case FT_Err_Invalid_Pixel_Size : return "invalid pixel size"; + + // Handle errors + case FT_Err_Invalid_Handle : return "invalid object handle"; + case FT_Err_Invalid_Library_Handle : return "invalid library handle"; + case FT_Err_Invalid_Driver_Handle : return "invalid module handle"; + case FT_Err_Invalid_Face_Handle : return "invalid face handle"; + case FT_Err_Invalid_Size_Handle : return "invalid size handle"; + case FT_Err_Invalid_Slot_Handle : return "invalid glyph slot handle"; + case FT_Err_Invalid_CharMap_Handle : return "invalid charmap handle"; + case FT_Err_Invalid_Cache_Handle : return "invalid cache manager handle"; + case FT_Err_Invalid_Stream_Handle : return "invalid stream handle"; + + // Driver errors + case FT_Err_Too_Many_Drivers : return "too many modules"; + case FT_Err_Too_Many_Extensions : return "too many extensions"; + + // Memory errors + case FT_Err_Out_Of_Memory : return "out of memory"; + case FT_Err_Unlisted_Object : return "unlisted object"; + + // Stream errors + case FT_Err_Cannot_Open_Stream : return "cannot open stream"; + case FT_Err_Invalid_Stream_Seek : return "invalid stream seek"; + case FT_Err_Invalid_Stream_Skip : return "invalid stream skip"; + case FT_Err_Invalid_Stream_Read : return "invalid stream read"; + case FT_Err_Invalid_Stream_Operation : return "invalid stream operation"; + case FT_Err_Invalid_Frame_Operation : return "invalid frame operation"; + case FT_Err_Nested_Frame_Access : return "nested frame access"; + case FT_Err_Invalid_Frame_Read : return "invalid frame read"; + + // Raster errors + case FT_Err_Raster_Uninitialized : return "raster uninitialized"; + case FT_Err_Raster_Corrupted : return "raster corrupted"; + case FT_Err_Raster_Overflow : return "raster overflow"; + case FT_Err_Raster_Negative_Height : return "negative height while rastering"; + + // Cache errors + case FT_Err_Too_Many_Caches : return "too many registered caches"; + + // TrueType and SFNT errors + case FT_Err_Invalid_Opcode : return "invalid opcode"; + case FT_Err_Too_Few_Arguments : return "too few arguments"; + case FT_Err_Stack_Overflow : return "stack overflow"; + case FT_Err_Code_Overflow : return "code overflow"; + case FT_Err_Bad_Argument : return "bad argument"; + case FT_Err_Divide_By_Zero : return "division by zero"; + case FT_Err_Invalid_Reference : return "invalid reference"; + case FT_Err_Debug_OpCode : return "found debug opcode"; + case FT_Err_ENDF_In_Exec_Stream : return "found ENDF opcode in execution stream"; + case FT_Err_Nested_DEFS : return "nested DEFS"; + case FT_Err_Invalid_CodeRange : return "invalid code range"; + case FT_Err_Execution_Too_Long : return "execution context too long"; + case FT_Err_Too_Many_Function_Defs : return "too many function definitions"; + case FT_Err_Too_Many_Instruction_Defs : return "too many instruction definitions"; + case FT_Err_Table_Missing : return "SFNT font table missing"; + case FT_Err_Horiz_Header_Missing : return "horizontal header (hhea) table missing"; + case FT_Err_Locations_Missing : return "locations (loca) table missing"; + case FT_Err_Name_Table_Missing : return "name table missing"; + case FT_Err_CMap_Table_Missing : return "character map (cmap) table missing"; + case FT_Err_Hmtx_Table_Missing : return "horizontal metrics (hmtx) table missing"; + case FT_Err_Post_Table_Missing : return "PostScript (post) table missing"; + case FT_Err_Invalid_Horiz_Metrics : return "invalid horizontal metrics"; + case FT_Err_Invalid_CharMap_Format : return "invalid character map (cmap) format"; + case FT_Err_Invalid_PPem : return "invalid ppem value"; + case FT_Err_Invalid_Vert_Metrics : return "invalid vertical metrics"; + case FT_Err_Could_Not_Find_Context : return "could not find context"; + case FT_Err_Invalid_Post_Table_Format : return "invalid PostScript (post) table format"; + case FT_Err_Invalid_Post_Table : return "invalid PostScript (post) table"; + + // CCF, CID and Type 1 errors + case FT_Err_Syntax_Error : return "opcode syntax error"; + case FT_Err_Stack_Underflow : return "argument stack underflow"; + case FT_Err_Ignore : return "ignore"; + + // BDF errors + case FT_Err_Missing_Startfont_Field : return "`STARTFONT' field missing"; + case FT_Err_Missing_Font_Field : return "`FONT' field missing"; + case FT_Err_Missing_Size_Field : return "`SIZE' field missing"; + case FT_Err_Missing_Chars_Field : return "`CHARS' field missing"; + case FT_Err_Missing_Startchar_Field : return "`STARTCHAR' field missing"; + case FT_Err_Missing_Encoding_Field : return "`ENCODING' field missing"; + case FT_Err_Missing_Bbx_Field : return "`BBX' field missing"; + } + + return "unknown error"; +} + +} // namespace priv + +} // namespace sf + diff --git a/src/SFML/Graphics/FontLoader.hpp b/src/SFML/Graphics/FontLoader.hpp new file mode 100644 index 00000000..0b6a10c8 --- /dev/null +++ b/src/SFML/Graphics/FontLoader.hpp @@ -0,0 +1,132 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FONTLOADER_HPP +#define SFML_FONTLOADER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include FT_FREETYPE_H +#include + + +namespace sf +{ +class Font; + +namespace priv +{ +//////////////////////////////////////////////////////////// +/// FontLoader loads and saves character fonts +//////////////////////////////////////////////////////////// +class FontLoader : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Get the unique instance of the class + /// + /// \return Reference to the FontLoader instance + /// + //////////////////////////////////////////////////////////// + static FontLoader& GetInstance(); + + //////////////////////////////////////////////////////////// + /// Load a font from a file + /// + /// \param Filename : Path of the font file to load + /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality + /// \param Charset : Characters set to generate + /// \param LoadedFont : Font object to fill up + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFontFromFile(const std::string& Filename, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont); + + //////////////////////////////////////////////////////////// + /// Load the font from a file in memory + /// + /// \param Data : Pointer to the data to load + /// \param SizeInBytes : Size of the data, in bytes + /// \param CharSize : Size of characters in bitmap - the bigger, the higher quality + /// \param Charset : Characters set to generate + /// \param LoadedFont : Font object to fill up + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadFontFromMemory(const char* Data, std::size_t SizeInBytes, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont); + +private : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + FontLoader(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~FontLoader(); + + //////////////////////////////////////////////////////////// + /// Create a bitmap font from a font face and a characters set + /// + /// \param FontFace : Font face containing the loaded font + /// \param CharSize : Size of characters in bitmap + /// \param Charset : Characters set to generate + /// \param LoadedFont : Font object to fill up + /// + //////////////////////////////////////////////////////////// + FT_Error CreateBitmapFont(FT_Face FontFace, unsigned int CharSize, const Unicode::UTF32String& Charset, Font& LoadedFont); + + //////////////////////////////////////////////////////////// + /// Get a description from a FT error code + /// + /// \param Error : FreeType error code + /// + /// \return Error description + /// + //////////////////////////////////////////////////////////// + static std::string GetErrorDesc(FT_Error Error); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FT_Library myLibrary; ///< Handle to the Freetype library +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_FONTLOADER_HPP diff --git a/src/SFML/Graphics/GLEW/glew.c b/src/SFML/Graphics/GLEW/glew.c new file mode 100644 index 00000000..f356799b --- /dev/null +++ b/src/SFML/Graphics/GLEW/glew.c @@ -0,0 +1,9752 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2002-2006, Milan Ikits +** Copyright (C) 2002-2006, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "glew.h" +#if defined(_WIN32) +# include "wglew.h" +#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) +# include "glxew.h" +#endif + +/* + * Define glewGetContext and related helper macros. + */ +#ifdef GLEW_MX +# define glewGetContext() ctx +# ifdef _WIN32 +# define GLEW_CONTEXT_ARG_DEF_INIT GLEWContext* ctx +# define GLEW_CONTEXT_ARG_VAR_INIT ctx +# define wglewGetContext() ctx +# define WGLEW_CONTEXT_ARG_DEF_INIT WGLEWContext* ctx +# define WGLEW_CONTEXT_ARG_DEF_LIST WGLEWContext* ctx +# else /* _WIN32 */ +# define GLEW_CONTEXT_ARG_DEF_INIT void +# define GLEW_CONTEXT_ARG_VAR_INIT +# define glxewGetContext() ctx +# define GLXEW_CONTEXT_ARG_DEF_INIT void +# define GLXEW_CONTEXT_ARG_DEF_LIST GLXEWContext* ctx +# endif /* _WIN32 */ +# define GLEW_CONTEXT_ARG_DEF_LIST GLEWContext* ctx +#else /* GLEW_MX */ +# define GLEW_CONTEXT_ARG_DEF_INIT void +# define GLEW_CONTEXT_ARG_VAR_INIT +# define GLEW_CONTEXT_ARG_DEF_LIST void +# define WGLEW_CONTEXT_ARG_DEF_INIT void +# define WGLEW_CONTEXT_ARG_DEF_LIST void +# define GLXEW_CONTEXT_ARG_DEF_INIT void +# define GLXEW_CONTEXT_ARG_DEF_LIST void +#endif /* GLEW_MX */ + +#if defined(__APPLE__) +#include +#include +#include + +void* NSGLGetProcAddress (const GLubyte *name) +{ + NSSymbol symbol; + char* symbolName; + /* prepend a '_' for the Unix C symbol mangling convention */ + symbolName = malloc(strlen((const char*)name) + 2); + strcpy(symbolName+1, (const char*)name); + symbolName[0] = '_'; + symbol = NULL; + if (NSIsSymbolNameDefined(symbolName)) + symbol = NSLookupAndBindSymbol(symbolName); + free(symbolName); + return symbol ? NSAddressOfSymbol(symbol) : NULL; +} +#endif /* __APPLE__ */ + +#if defined(__sgi) || defined (__sun) +#include +#include +#include + +void* dlGetProcAddress (const GLubyte* name) +{ + static void* h = NULL; + static void* gpa; + + if (h == NULL) + { + if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL; + gpa = dlsym(h, "glXGetProcAddress"); + } + + if (gpa != NULL) + return ((void*(*)(const GLubyte*))gpa)(name); + else + return dlsym(h, (const char*)name); +} +#endif /* __sgi || __sun */ + +/* + * Define glewGetProcAddress. + */ +#if defined(_WIN32) +# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) +#else +# if defined(__APPLE__) +# define glewGetProcAddress(name) NSGLGetProcAddress(name) +# else +# if defined(__sgi) || defined(__sun) +# define glewGetProcAddress(name) dlGetProcAddress(name) +# else /* __linux */ +# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) +# endif +# endif +#endif + +/* + * GLEW, just like OpenGL or GLU, does not rely on the standard C library. + * These functions implement the functionality required in this file. + */ + +static GLuint _glewStrLen (const GLubyte* s) +{ + GLuint i=0; + if (s == NULL) return 0; + while (s[i] != '\0') i++; + return i; +} + +static GLuint _glewStrCLen (const GLubyte* s, GLubyte c) +{ + GLuint i=0; + if (s == NULL) return 0; + while (s[i] != '\0' && s[i] != c) i++; + return s[i] == c ? i : 0; +} + +static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n) +{ + GLuint i=0; + if(a == NULL || b == NULL) + return (a == NULL && b == NULL && n == 0) ? GL_TRUE : GL_FALSE; + while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++; + return i == n ? GL_TRUE : GL_FALSE; +} + +static GLboolean _glewStrSame1 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) +{ + while (*na > 0 && (**a == ' ' || **a == '\n' || **a == '\r' || **a == '\t')) + { + (*a)++; + (*na)--; + } + if(*na >= nb) + { + GLuint i=0; + while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; + if(i == nb) + { + *a = *a + nb; + *na = *na - nb; + return GL_TRUE; + } + } + return GL_FALSE; +} + +static GLboolean _glewStrSame2 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) +{ + if(*na >= nb) + { + GLuint i=0; + while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; + if(i == nb) + { + *a = *a + nb; + *na = *na - nb; + return GL_TRUE; + } + } + return GL_FALSE; +} + +static GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuint nb) +{ + if(*na >= nb) + { + GLuint i=0; + while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++; + if (i == nb && (*na == nb || (*a)[i] == ' ' || (*a)[i] == '\n' || (*a)[i] == '\r' || (*a)[i] == '\t')) + { + *a = *a + nb; + *na = *na - nb; + return GL_TRUE; + } + } + return GL_FALSE; +} + +#if !defined(_WIN32) || !defined(GLEW_MX) + +PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D = NULL; +PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements = NULL; +PFNGLTEXIMAGE3DPROC __glewTexImage3D = NULL; +PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D = NULL; + +PFNGLACTIVETEXTUREPROC __glewActiveTexture = NULL; +PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture = NULL; +PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage = NULL; +PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd = NULL; +PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf = NULL; +PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd = NULL; +PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf = NULL; +PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d = NULL; +PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv = NULL; +PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f = NULL; +PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv = NULL; +PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i = NULL; +PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv = NULL; +PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s = NULL; +PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv = NULL; +PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d = NULL; +PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv = NULL; +PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f = NULL; +PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv = NULL; +PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i = NULL; +PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv = NULL; +PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s = NULL; +PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv = NULL; +PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d = NULL; +PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv = NULL; +PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f = NULL; +PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv = NULL; +PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i = NULL; +PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv = NULL; +PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s = NULL; +PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv = NULL; +PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d = NULL; +PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv = NULL; +PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f = NULL; +PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv = NULL; +PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i = NULL; +PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv = NULL; +PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s = NULL; +PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv = NULL; +PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage = NULL; + +PFNGLBLENDCOLORPROC __glewBlendColor = NULL; +PFNGLBLENDEQUATIONPROC __glewBlendEquation = NULL; +PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate = NULL; +PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer = NULL; +PFNGLFOGCOORDDPROC __glewFogCoordd = NULL; +PFNGLFOGCOORDDVPROC __glewFogCoorddv = NULL; +PFNGLFOGCOORDFPROC __glewFogCoordf = NULL; +PFNGLFOGCOORDFVPROC __glewFogCoordfv = NULL; +PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays = NULL; +PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements = NULL; +PFNGLPOINTPARAMETERFPROC __glewPointParameterf = NULL; +PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv = NULL; +PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b = NULL; +PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv = NULL; +PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d = NULL; +PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv = NULL; +PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f = NULL; +PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv = NULL; +PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i = NULL; +PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv = NULL; +PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s = NULL; +PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv = NULL; +PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub = NULL; +PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv = NULL; +PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui = NULL; +PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv = NULL; +PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us = NULL; +PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv = NULL; +PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer = NULL; +PFNGLWINDOWPOS2DPROC __glewWindowPos2d = NULL; +PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv = NULL; +PFNGLWINDOWPOS2FPROC __glewWindowPos2f = NULL; +PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv = NULL; +PFNGLWINDOWPOS2IPROC __glewWindowPos2i = NULL; +PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv = NULL; +PFNGLWINDOWPOS2SPROC __glewWindowPos2s = NULL; +PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv = NULL; +PFNGLWINDOWPOS3DPROC __glewWindowPos3d = NULL; +PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv = NULL; +PFNGLWINDOWPOS3FPROC __glewWindowPos3f = NULL; +PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv = NULL; +PFNGLWINDOWPOS3IPROC __glewWindowPos3i = NULL; +PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv = NULL; +PFNGLWINDOWPOS3SPROC __glewWindowPos3s = NULL; +PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv = NULL; + +PFNGLBEGINQUERYPROC __glewBeginQuery = NULL; +PFNGLBINDBUFFERPROC __glewBindBuffer = NULL; +PFNGLBUFFERDATAPROC __glewBufferData = NULL; +PFNGLBUFFERSUBDATAPROC __glewBufferSubData = NULL; +PFNGLDELETEBUFFERSPROC __glewDeleteBuffers = NULL; +PFNGLDELETEQUERIESPROC __glewDeleteQueries = NULL; +PFNGLENDQUERYPROC __glewEndQuery = NULL; +PFNGLGENBUFFERSPROC __glewGenBuffers = NULL; +PFNGLGENQUERIESPROC __glewGenQueries = NULL; +PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv = NULL; +PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv = NULL; +PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData = NULL; +PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv = NULL; +PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv = NULL; +PFNGLGETQUERYIVPROC __glewGetQueryiv = NULL; +PFNGLISBUFFERPROC __glewIsBuffer = NULL; +PFNGLISQUERYPROC __glewIsQuery = NULL; +PFNGLMAPBUFFERPROC __glewMapBuffer = NULL; +PFNGLUNMAPBUFFERPROC __glewUnmapBuffer = NULL; + +PFNGLATTACHSHADERPROC __glewAttachShader = NULL; +PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate = NULL; +PFNGLCOMPILESHADERPROC __glewCompileShader = NULL; +PFNGLCREATEPROGRAMPROC __glewCreateProgram = NULL; +PFNGLCREATESHADERPROC __glewCreateShader = NULL; +PFNGLDELETEPROGRAMPROC __glewDeleteProgram = NULL; +PFNGLDELETESHADERPROC __glewDeleteShader = NULL; +PFNGLDETACHSHADERPROC __glewDetachShader = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray = NULL; +PFNGLDRAWBUFFERSPROC __glewDrawBuffers = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray = NULL; +PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib = NULL; +PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform = NULL; +PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation = NULL; +PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog = NULL; +PFNGLGETPROGRAMIVPROC __glewGetProgramiv = NULL; +PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog = NULL; +PFNGLGETSHADERSOURCEPROC __glewGetShaderSource = NULL; +PFNGLGETSHADERIVPROC __glewGetShaderiv = NULL; +PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation = NULL; +PFNGLGETUNIFORMFVPROC __glewGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC __glewGetUniformiv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv = NULL; +PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv = NULL; +PFNGLISPROGRAMPROC __glewIsProgram = NULL; +PFNGLISSHADERPROC __glewIsShader = NULL; +PFNGLLINKPROGRAMPROC __glewLinkProgram = NULL; +PFNGLSHADERSOURCEPROC __glewShaderSource = NULL; +PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate = NULL; +PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate = NULL; +PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate = NULL; +PFNGLUNIFORM1FPROC __glewUniform1f = NULL; +PFNGLUNIFORM1FVPROC __glewUniform1fv = NULL; +PFNGLUNIFORM1IPROC __glewUniform1i = NULL; +PFNGLUNIFORM1IVPROC __glewUniform1iv = NULL; +PFNGLUNIFORM2FPROC __glewUniform2f = NULL; +PFNGLUNIFORM2FVPROC __glewUniform2fv = NULL; +PFNGLUNIFORM2IPROC __glewUniform2i = NULL; +PFNGLUNIFORM2IVPROC __glewUniform2iv = NULL; +PFNGLUNIFORM3FPROC __glewUniform3f = NULL; +PFNGLUNIFORM3FVPROC __glewUniform3fv = NULL; +PFNGLUNIFORM3IPROC __glewUniform3i = NULL; +PFNGLUNIFORM3IVPROC __glewUniform3iv = NULL; +PFNGLUNIFORM4FPROC __glewUniform4f = NULL; +PFNGLUNIFORM4FVPROC __glewUniform4fv = NULL; +PFNGLUNIFORM4IPROC __glewUniform4i = NULL; +PFNGLUNIFORM4IVPROC __glewUniform4iv = NULL; +PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv = NULL; +PFNGLUSEPROGRAMPROC __glewUseProgram = NULL; +PFNGLVALIDATEPROGRAMPROC __glewValidateProgram = NULL; +PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d = NULL; +PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv = NULL; +PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s = NULL; +PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv = NULL; +PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d = NULL; +PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv = NULL; +PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s = NULL; +PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv = NULL; +PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d = NULL; +PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv = NULL; +PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s = NULL; +PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv = NULL; +PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv = NULL; +PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv = NULL; +PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv = NULL; +PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub = NULL; +PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv = NULL; +PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv = NULL; +PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv = NULL; +PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv = NULL; +PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d = NULL; +PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv = NULL; +PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv = NULL; +PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s = NULL; +PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv = NULL; +PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv = NULL; +PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv = NULL; +PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer = NULL; + +PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX = NULL; + +PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE = NULL; +PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE = NULL; +PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE = NULL; +PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE = NULL; +PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE = NULL; + +PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE = NULL; +PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE = NULL; +PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE = NULL; +PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE = NULL; +PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE = NULL; +PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE = NULL; +PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE = NULL; +PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE = NULL; + +PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE = NULL; +PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE = NULL; + +PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE = NULL; +PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE = NULL; +PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE = NULL; +PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE = NULL; + +PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE = NULL; +PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE = NULL; +PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE = NULL; + +PFNGLCLAMPCOLORARBPROC __glewClampColorARB = NULL; + +PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB = NULL; + +PFNGLCOLORSUBTABLEPROC __glewColorSubTable = NULL; +PFNGLCOLORTABLEPROC __glewColorTable = NULL; +PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv = NULL; +PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv = NULL; +PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D = NULL; +PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D = NULL; +PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf = NULL; +PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv = NULL; +PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri = NULL; +PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv = NULL; +PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable = NULL; +PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable = NULL; +PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D = NULL; +PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D = NULL; +PFNGLGETCOLORTABLEPROC __glewGetColorTable = NULL; +PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv = NULL; +PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv = NULL; +PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter = NULL; +PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv = NULL; +PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv = NULL; +PFNGLGETHISTOGRAMPROC __glewGetHistogram = NULL; +PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv = NULL; +PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv = NULL; +PFNGLGETMINMAXPROC __glewGetMinmax = NULL; +PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv = NULL; +PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv = NULL; +PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter = NULL; +PFNGLHISTOGRAMPROC __glewHistogram = NULL; +PFNGLMINMAXPROC __glewMinmax = NULL; +PFNGLRESETHISTOGRAMPROC __glewResetHistogram = NULL; +PFNGLRESETMINMAXPROC __glewResetMinmax = NULL; +PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D = NULL; + +PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB = NULL; +PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB = NULL; +PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB = NULL; +PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB = NULL; +PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB = NULL; + +PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB = NULL; + +PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB = NULL; +PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB = NULL; +PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB = NULL; +PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB = NULL; +PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB = NULL; +PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB = NULL; +PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB = NULL; +PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB = NULL; +PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB = NULL; +PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB = NULL; +PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB = NULL; +PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB = NULL; +PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB = NULL; +PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB = NULL; +PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB = NULL; +PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB = NULL; +PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB = NULL; +PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB = NULL; +PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB = NULL; +PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB = NULL; +PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB = NULL; +PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB = NULL; +PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB = NULL; +PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB = NULL; +PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB = NULL; +PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB = NULL; +PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB = NULL; +PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB = NULL; +PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB = NULL; +PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB = NULL; +PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB = NULL; +PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB = NULL; +PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB = NULL; +PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB = NULL; + +PFNGLBEGINQUERYARBPROC __glewBeginQueryARB = NULL; +PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB = NULL; +PFNGLENDQUERYARBPROC __glewEndQueryARB = NULL; +PFNGLGENQUERIESARBPROC __glewGenQueriesARB = NULL; +PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB = NULL; +PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB = NULL; +PFNGLGETQUERYIVARBPROC __glewGetQueryivARB = NULL; +PFNGLISQUERYARBPROC __glewIsQueryARB = NULL; + +PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB = NULL; +PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB = NULL; + +PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB = NULL; +PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB = NULL; +PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB = NULL; +PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB = NULL; +PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB = NULL; +PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB = NULL; +PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB = NULL; +PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB = NULL; +PFNGLGETHANDLEARBPROC __glewGetHandleARB = NULL; +PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB = NULL; +PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB = NULL; +PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB = NULL; +PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB = NULL; +PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB = NULL; +PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB = NULL; +PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB = NULL; +PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB = NULL; +PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB = NULL; +PFNGLUNIFORM1FARBPROC __glewUniform1fARB = NULL; +PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB = NULL; +PFNGLUNIFORM1IARBPROC __glewUniform1iARB = NULL; +PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB = NULL; +PFNGLUNIFORM2FARBPROC __glewUniform2fARB = NULL; +PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB = NULL; +PFNGLUNIFORM2IARBPROC __glewUniform2iARB = NULL; +PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB = NULL; +PFNGLUNIFORM3FARBPROC __glewUniform3fARB = NULL; +PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB = NULL; +PFNGLUNIFORM3IARBPROC __glewUniform3iARB = NULL; +PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB = NULL; +PFNGLUNIFORM4FARBPROC __glewUniform4fARB = NULL; +PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB = NULL; +PFNGLUNIFORM4IARBPROC __glewUniform4iARB = NULL; +PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB = NULL; +PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB = NULL; +PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB = NULL; +PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB = NULL; +PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB = NULL; +PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB = NULL; + +PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB = NULL; + +PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB = NULL; +PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB = NULL; +PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB = NULL; +PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB = NULL; + +PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB = NULL; +PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB = NULL; +PFNGLWEIGHTBVARBPROC __glewWeightbvARB = NULL; +PFNGLWEIGHTDVARBPROC __glewWeightdvARB = NULL; +PFNGLWEIGHTFVARBPROC __glewWeightfvARB = NULL; +PFNGLWEIGHTIVARBPROC __glewWeightivARB = NULL; +PFNGLWEIGHTSVARBPROC __glewWeightsvARB = NULL; +PFNGLWEIGHTUBVARBPROC __glewWeightubvARB = NULL; +PFNGLWEIGHTUIVARBPROC __glewWeightuivARB = NULL; +PFNGLWEIGHTUSVARBPROC __glewWeightusvARB = NULL; + +PFNGLBINDBUFFERARBPROC __glewBindBufferARB = NULL; +PFNGLBUFFERDATAARBPROC __glewBufferDataARB = NULL; +PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB = NULL; +PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB = NULL; +PFNGLGENBUFFERSARBPROC __glewGenBuffersARB = NULL; +PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB = NULL; +PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB = NULL; +PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB = NULL; +PFNGLISBUFFERARBPROC __glewIsBufferARB = NULL; +PFNGLMAPBUFFERARBPROC __glewMapBufferARB = NULL; +PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB = NULL; + +PFNGLBINDPROGRAMARBPROC __glewBindProgramARB = NULL; +PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB = NULL; +PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB = NULL; +PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB = NULL; +PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB = NULL; +PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB = NULL; +PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB = NULL; +PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB = NULL; +PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB = NULL; +PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB = NULL; +PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB = NULL; +PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB = NULL; +PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB = NULL; +PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB = NULL; +PFNGLISPROGRAMARBPROC __glewIsProgramARB = NULL; +PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB = NULL; +PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB = NULL; +PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB = NULL; +PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB = NULL; +PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB = NULL; +PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB = NULL; +PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB = NULL; +PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB = NULL; +PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB = NULL; +PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB = NULL; +PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB = NULL; +PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB = NULL; +PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB = NULL; +PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB = NULL; +PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB = NULL; +PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB = NULL; +PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB = NULL; +PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB = NULL; +PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB = NULL; +PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB = NULL; +PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB = NULL; +PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB = NULL; +PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB = NULL; +PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB = NULL; +PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB = NULL; +PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB = NULL; +PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB = NULL; +PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB = NULL; +PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB = NULL; +PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB = NULL; +PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB = NULL; +PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB = NULL; +PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB = NULL; +PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB = NULL; +PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB = NULL; +PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB = NULL; +PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB = NULL; +PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB = NULL; +PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB = NULL; +PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB = NULL; +PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB = NULL; +PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB = NULL; +PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB = NULL; + +PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB = NULL; +PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB = NULL; +PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB = NULL; + +PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB = NULL; +PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB = NULL; +PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB = NULL; +PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB = NULL; +PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB = NULL; +PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB = NULL; +PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB = NULL; +PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB = NULL; +PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB = NULL; +PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB = NULL; +PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB = NULL; +PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB = NULL; +PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB = NULL; +PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB = NULL; +PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB = NULL; +PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB = NULL; + +PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI = NULL; + +PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI = NULL; +PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI = NULL; +PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI = NULL; + +PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI = NULL; +PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI = NULL; +PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI = NULL; +PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI = NULL; + +PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI = NULL; +PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI = NULL; +PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI = NULL; +PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI = NULL; +PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI = NULL; +PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI = NULL; +PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI = NULL; +PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI = NULL; +PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI = NULL; +PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI = NULL; +PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI = NULL; +PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI = NULL; +PFNGLSAMPLEMAPATIPROC __glewSampleMapATI = NULL; +PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI = NULL; + +PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI = NULL; +PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI = NULL; + +PFNGLPNTRIANGLESFATIPROC __glPNTrianglewesfATI = NULL; +PFNGLPNTRIANGLESIATIPROC __glPNTrianglewesiATI = NULL; + +PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI = NULL; +PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI = NULL; + +PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI = NULL; +PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI = NULL; +PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI = NULL; +PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI = NULL; +PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI = NULL; +PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI = NULL; +PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI = NULL; +PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI = NULL; +PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI = NULL; +PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI = NULL; +PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI = NULL; +PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI = NULL; + +PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI = NULL; +PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI = NULL; +PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI = NULL; + +PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI = NULL; +PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI = NULL; +PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI = NULL; +PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI = NULL; +PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI = NULL; +PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI = NULL; +PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI = NULL; +PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI = NULL; +PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI = NULL; +PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI = NULL; +PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI = NULL; +PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI = NULL; +PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI = NULL; +PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI = NULL; +PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI = NULL; +PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI = NULL; +PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI = NULL; +PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI = NULL; +PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI = NULL; +PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI = NULL; +PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI = NULL; +PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI = NULL; +PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI = NULL; +PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI = NULL; +PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI = NULL; +PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI = NULL; +PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI = NULL; +PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI = NULL; +PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI = NULL; +PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI = NULL; +PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI = NULL; +PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI = NULL; +PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI = NULL; +PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI = NULL; +PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI = NULL; +PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI = NULL; +PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI = NULL; + +PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT = NULL; + +PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT = NULL; + +PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT = NULL; + +PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT = NULL; + +PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT = NULL; +PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT = NULL; + +PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT = NULL; +PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT = NULL; + +PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT = NULL; +PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT = NULL; +PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT = NULL; +PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT = NULL; +PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT = NULL; +PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT = NULL; +PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT = NULL; +PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT = NULL; +PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT = NULL; +PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT = NULL; +PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT = NULL; +PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT = NULL; +PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT = NULL; + +PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT = NULL; +PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT = NULL; + +PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT = NULL; +PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT = NULL; +PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT = NULL; +PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT = NULL; +PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT = NULL; + +PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT = NULL; +PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT = NULL; + +PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT = NULL; + +PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT = NULL; + +PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT = NULL; +PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT = NULL; +PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT = NULL; +PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT = NULL; +PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT = NULL; + +PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT = NULL; +PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT = NULL; +PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT = NULL; +PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT = NULL; +PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT = NULL; +PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT = NULL; +PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT = NULL; +PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT = NULL; +PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT = NULL; +PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT = NULL; +PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT = NULL; +PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT = NULL; +PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT = NULL; +PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT = NULL; +PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT = NULL; +PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT = NULL; +PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT = NULL; +PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT = NULL; + +PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT = NULL; + +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT = NULL; + +PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT = NULL; +PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT = NULL; +PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT = NULL; +PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT = NULL; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT = NULL; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT = NULL; +PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT = NULL; +PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT = NULL; +PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT = NULL; +PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT = NULL; +PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT = NULL; + +PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT = NULL; +PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT = NULL; +PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT = NULL; +PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT = NULL; +PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT = NULL; +PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT = NULL; +PFNGLHISTOGRAMEXTPROC __glewHistogramEXT = NULL; +PFNGLMINMAXEXTPROC __glewMinmaxEXT = NULL; +PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT = NULL; +PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT = NULL; + +PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT = NULL; + +PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT = NULL; + +PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT = NULL; +PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT = NULL; +PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT = NULL; + +PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT = NULL; +PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT = NULL; + +PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT = NULL; +PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT = NULL; + +PFNGLCOLORTABLEEXTPROC __glewColorTableEXT = NULL; +PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT = NULL; +PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT = NULL; +PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT = NULL; + +PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT = NULL; +PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT = NULL; +PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT = NULL; + +PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT = NULL; +PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT = NULL; + +PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT = NULL; + +PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT = NULL; +PFNGLENDSCENEEXTPROC __glewEndSceneEXT = NULL; + +PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT = NULL; +PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT = NULL; +PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT = NULL; +PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT = NULL; +PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT = NULL; +PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT = NULL; +PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT = NULL; +PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT = NULL; +PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT = NULL; +PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT = NULL; +PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT = NULL; +PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT = NULL; +PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT = NULL; +PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT = NULL; +PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT = NULL; +PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT = NULL; +PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT = NULL; + +PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT = NULL; + +PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT = NULL; +PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT = NULL; +PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT = NULL; + +PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT = NULL; + +PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT = NULL; +PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT = NULL; +PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT = NULL; +PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT = NULL; +PFNGLISTEXTUREEXTPROC __glewIsTextureEXT = NULL; +PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT = NULL; + +PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT = NULL; + +PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT = NULL; +PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT = NULL; +PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT = NULL; +PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT = NULL; +PFNGLGETPOINTERVEXTPROC __glewGetPointervEXT = NULL; +PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT = NULL; +PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT = NULL; +PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT = NULL; +PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT = NULL; + +PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT = NULL; +PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT = NULL; +PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT = NULL; +PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT = NULL; +PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT = NULL; +PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT = NULL; +PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT = NULL; +PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT = NULL; +PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT = NULL; +PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT = NULL; +PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT = NULL; +PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT = NULL; +PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT = NULL; +PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT = NULL; +PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT = NULL; +PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT = NULL; +PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT = NULL; +PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT = NULL; +PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT = NULL; +PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT = NULL; +PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT = NULL; +PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT = NULL; +PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT = NULL; +PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT = NULL; +PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT = NULL; +PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT = NULL; +PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT = NULL; +PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT = NULL; +PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT = NULL; +PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT = NULL; +PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT = NULL; +PFNGLSWIZZLEEXTPROC __glewSwizzleEXT = NULL; +PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT = NULL; +PFNGLVARIANTBVEXTPROC __glewVariantbvEXT = NULL; +PFNGLVARIANTDVEXTPROC __glewVariantdvEXT = NULL; +PFNGLVARIANTFVEXTPROC __glewVariantfvEXT = NULL; +PFNGLVARIANTIVEXTPROC __glewVariantivEXT = NULL; +PFNGLVARIANTSVEXTPROC __glewVariantsvEXT = NULL; +PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT = NULL; +PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT = NULL; +PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT = NULL; +PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT = NULL; + +PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT = NULL; +PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT = NULL; +PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT = NULL; + +PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY = NULL; + +PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP = NULL; +PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP = NULL; +PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP = NULL; + +PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM = NULL; +PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM = NULL; + +PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM = NULL; +PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM = NULL; +PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM = NULL; +PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM = NULL; +PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM = NULL; +PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM = NULL; +PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM = NULL; +PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM = NULL; + +PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL = NULL; +PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL = NULL; +PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL = NULL; +PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL = NULL; + +PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL = NULL; +PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL = NULL; + +PFNGLBUFFERREGIONENABLEDEXTPROC __glewBufferRegionEnabledEXT = NULL; +PFNGLDELETEBUFFERREGIONEXTPROC __glewDeleteBufferRegionEXT = NULL; +PFNGLDRAWBUFFERREGIONEXTPROC __glewDrawBufferRegionEXT = NULL; +PFNGLNEWBUFFERREGIONEXTPROC __glewNewBufferRegionEXT = NULL; +PFNGLREADBUFFERREGIONEXTPROC __glewReadBufferRegionEXT = NULL; + +PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA = NULL; + +PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA = NULL; +PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA = NULL; +PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA = NULL; +PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA = NULL; +PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA = NULL; +PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA = NULL; +PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA = NULL; +PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA = NULL; +PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA = NULL; +PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA = NULL; +PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA = NULL; +PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA = NULL; +PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA = NULL; +PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA = NULL; +PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA = NULL; +PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA = NULL; +PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA = NULL; +PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA = NULL; +PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA = NULL; +PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA = NULL; +PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA = NULL; +PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA = NULL; +PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA = NULL; +PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA = NULL; + +PFNGLEVALMAPSNVPROC __glewEvalMapsNV = NULL; +PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV = NULL; +PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV = NULL; +PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV = NULL; +PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV = NULL; +PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV = NULL; +PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV = NULL; +PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV = NULL; +PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV = NULL; + +PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV = NULL; +PFNGLFINISHFENCENVPROC __glewFinishFenceNV = NULL; +PFNGLGENFENCESNVPROC __glewGenFencesNV = NULL; +PFNGLGETFENCEIVNVPROC __glewGetFenceivNV = NULL; +PFNGLISFENCENVPROC __glewIsFenceNV = NULL; +PFNGLSETFENCENVPROC __glewSetFenceNV = NULL; +PFNGLTESTFENCENVPROC __glewTestFenceNV = NULL; + +PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV = NULL; +PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV = NULL; +PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV = NULL; + +PFNGLCOLOR3HNVPROC __glewColor3hNV = NULL; +PFNGLCOLOR3HVNVPROC __glewColor3hvNV = NULL; +PFNGLCOLOR4HNVPROC __glewColor4hNV = NULL; +PFNGLCOLOR4HVNVPROC __glewColor4hvNV = NULL; +PFNGLFOGCOORDHNVPROC __glewFogCoordhNV = NULL; +PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV = NULL; +PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV = NULL; +PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV = NULL; +PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV = NULL; +PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV = NULL; +PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV = NULL; +PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV = NULL; +PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV = NULL; +PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV = NULL; +PFNGLNORMAL3HNVPROC __glewNormal3hNV = NULL; +PFNGLNORMAL3HVNVPROC __glewNormal3hvNV = NULL; +PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV = NULL; +PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV = NULL; +PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV = NULL; +PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV = NULL; +PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV = NULL; +PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV = NULL; +PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV = NULL; +PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV = NULL; +PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV = NULL; +PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV = NULL; +PFNGLVERTEX2HNVPROC __glewVertex2hNV = NULL; +PFNGLVERTEX2HVNVPROC __glewVertex2hvNV = NULL; +PFNGLVERTEX3HNVPROC __glewVertex3hNV = NULL; +PFNGLVERTEX3HVNVPROC __glewVertex3hvNV = NULL; +PFNGLVERTEX4HNVPROC __glewVertex4hNV = NULL; +PFNGLVERTEX4HVNVPROC __glewVertex4hvNV = NULL; +PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV = NULL; +PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV = NULL; +PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV = NULL; +PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV = NULL; +PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV = NULL; +PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV = NULL; +PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV = NULL; +PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV = NULL; +PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV = NULL; +PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV = NULL; +PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV = NULL; +PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV = NULL; +PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV = NULL; +PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV = NULL; + +PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV = NULL; +PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV = NULL; +PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV = NULL; +PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV = NULL; +PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV = NULL; +PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV = NULL; +PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV = NULL; + +PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV = NULL; +PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV = NULL; + +PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV = NULL; +PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV = NULL; + +PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV = NULL; +PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV = NULL; + +PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV = NULL; +PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV = NULL; +PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV = NULL; +PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV = NULL; +PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV = NULL; +PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV = NULL; +PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV = NULL; +PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV = NULL; +PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV = NULL; +PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV = NULL; +PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV = NULL; +PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV = NULL; +PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV = NULL; + +PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV = NULL; +PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV = NULL; + +PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV = NULL; +PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV = NULL; + +PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV = NULL; +PFNGLBINDPROGRAMNVPROC __glewBindProgramNV = NULL; +PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV = NULL; +PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV = NULL; +PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV = NULL; +PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV = NULL; +PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV = NULL; +PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV = NULL; +PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV = NULL; +PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV = NULL; +PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV = NULL; +PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV = NULL; +PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV = NULL; +PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV = NULL; +PFNGLISPROGRAMNVPROC __glewIsProgramNV = NULL; +PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV = NULL; +PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV = NULL; +PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV = NULL; +PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV = NULL; +PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV = NULL; +PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV = NULL; +PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV = NULL; +PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV = NULL; +PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV = NULL; +PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV = NULL; +PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV = NULL; +PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV = NULL; +PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV = NULL; +PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV = NULL; +PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV = NULL; +PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV = NULL; +PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV = NULL; +PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV = NULL; +PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV = NULL; +PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV = NULL; +PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV = NULL; +PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV = NULL; +PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV = NULL; +PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV = NULL; +PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV = NULL; +PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV = NULL; +PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV = NULL; +PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV = NULL; +PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV = NULL; +PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV = NULL; +PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV = NULL; +PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV = NULL; +PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV = NULL; +PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV = NULL; +PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV = NULL; +PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV = NULL; +PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV = NULL; +PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV = NULL; +PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV = NULL; +PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV = NULL; +PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV = NULL; +PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV = NULL; +PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV = NULL; +PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV = NULL; +PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV = NULL; +PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV = NULL; +PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV = NULL; +PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV = NULL; +PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV = NULL; + +PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS = NULL; +PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS = NULL; + +PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS = NULL; +PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS = NULL; + +PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS = NULL; +PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS = NULL; + +PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS = NULL; +PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS = NULL; + +PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS = NULL; +PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS = NULL; + +PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS = NULL; +PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS = NULL; + +PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX = NULL; +PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX = NULL; +PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX = NULL; +PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX = NULL; +PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX = NULL; +PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX = NULL; + +PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX = NULL; + +PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX = NULL; + +PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX = NULL; +PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX = NULL; +PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX = NULL; +PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX = NULL; +PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX = NULL; +PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX = NULL; +PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX = NULL; +PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX = NULL; +PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX = NULL; +PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX = NULL; +PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX = NULL; +PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX = NULL; +PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX = NULL; +PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX = NULL; + +PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX = NULL; + +PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX = NULL; + +PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX = NULL; + +PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX = NULL; +PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX = NULL; +PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX = NULL; +PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX = NULL; + +PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX = NULL; + +PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI = NULL; +PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI = NULL; +PFNGLCOLORTABLESGIPROC __glewColorTableSGI = NULL; +PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI = NULL; +PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI = NULL; +PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI = NULL; +PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI = NULL; + +PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX = NULL; + +PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN = NULL; +PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN = NULL; +PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN = NULL; +PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN = NULL; +PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN = NULL; +PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN = NULL; +PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN = NULL; +PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN = NULL; + +PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN = NULL; + +PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN = NULL; +PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN = NULL; +PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN = NULL; +PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN = NULL; +PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN = NULL; +PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN = NULL; +PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN = NULL; + +PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN = NULL; +PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN = NULL; +PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN = NULL; +PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN = NULL; +PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN = NULL; +PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN = NULL; +PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN = NULL; +PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN = NULL; +PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN = NULL; +PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN = NULL; +PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN = NULL; +PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN = NULL; +PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN = NULL; +PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN = NULL; +PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN = NULL; +PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN = NULL; +PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN = NULL; +PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN = NULL; +PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN = NULL; +PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN = NULL; +PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN = NULL; +PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN = NULL; +PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN = NULL; +PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN = NULL; +PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN = NULL; +PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN = NULL; + +PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN = NULL; + +#endif /* !WIN32 || !GLEW_MX */ + +#if !defined(GLEW_MX) + +GLboolean __GLEW_VERSION_1_1 = GL_FALSE; +GLboolean __GLEW_VERSION_1_2 = GL_FALSE; +GLboolean __GLEW_VERSION_1_3 = GL_FALSE; +GLboolean __GLEW_VERSION_1_4 = GL_FALSE; +GLboolean __GLEW_VERSION_1_5 = GL_FALSE; +GLboolean __GLEW_VERSION_2_0 = GL_FALSE; +GLboolean __GLEW_3DFX_multisample = GL_FALSE; +GLboolean __GLEW_3DFX_tbuffer = GL_FALSE; +GLboolean __GLEW_3DFX_texture_compression_FXT1 = GL_FALSE; +GLboolean __GLEW_APPLE_client_storage = GL_FALSE; +GLboolean __GLEW_APPLE_element_array = GL_FALSE; +GLboolean __GLEW_APPLE_fence = GL_FALSE; +GLboolean __GLEW_APPLE_float_pixels = GL_FALSE; +GLboolean __GLEW_APPLE_pixel_buffer = GL_FALSE; +GLboolean __GLEW_APPLE_specular_vector = GL_FALSE; +GLboolean __GLEW_APPLE_texture_range = GL_FALSE; +GLboolean __GLEW_APPLE_transform_hint = GL_FALSE; +GLboolean __GLEW_APPLE_vertex_array_object = GL_FALSE; +GLboolean __GLEW_APPLE_vertex_array_range = GL_FALSE; +GLboolean __GLEW_APPLE_ycbcr_422 = GL_FALSE; +GLboolean __GLEW_ARB_color_buffer_float = GL_FALSE; +GLboolean __GLEW_ARB_depth_texture = GL_FALSE; +GLboolean __GLEW_ARB_draw_buffers = GL_FALSE; +GLboolean __GLEW_ARB_fragment_program = GL_FALSE; +GLboolean __GLEW_ARB_fragment_program_shadow = GL_FALSE; +GLboolean __GLEW_ARB_fragment_shader = GL_FALSE; +GLboolean __GLEW_ARB_half_float_pixel = GL_FALSE; +GLboolean __GLEW_ARB_imaging = GL_FALSE; +GLboolean __GLEW_ARB_matrix_palette = GL_FALSE; +GLboolean __GLEW_ARB_multisample = GL_FALSE; +GLboolean __GLEW_ARB_multitexture = GL_FALSE; +GLboolean __GLEW_ARB_occlusion_query = GL_FALSE; +GLboolean __GLEW_ARB_pixel_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_point_parameters = GL_FALSE; +GLboolean __GLEW_ARB_point_sprite = GL_FALSE; +GLboolean __GLEW_ARB_shader_objects = GL_FALSE; +GLboolean __GLEW_ARB_shading_language_100 = GL_FALSE; +GLboolean __GLEW_ARB_shadow = GL_FALSE; +GLboolean __GLEW_ARB_shadow_ambient = GL_FALSE; +GLboolean __GLEW_ARB_texture_border_clamp = GL_FALSE; +GLboolean __GLEW_ARB_texture_compression = GL_FALSE; +GLboolean __GLEW_ARB_texture_cube_map = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_add = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_combine = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_crossbar = GL_FALSE; +GLboolean __GLEW_ARB_texture_env_dot3 = GL_FALSE; +GLboolean __GLEW_ARB_texture_float = GL_FALSE; +GLboolean __GLEW_ARB_texture_mirrored_repeat = GL_FALSE; +GLboolean __GLEW_ARB_texture_non_power_of_two = GL_FALSE; +GLboolean __GLEW_ARB_texture_rectangle = GL_FALSE; +GLboolean __GLEW_ARB_transpose_matrix = GL_FALSE; +GLboolean __GLEW_ARB_vertex_blend = GL_FALSE; +GLboolean __GLEW_ARB_vertex_buffer_object = GL_FALSE; +GLboolean __GLEW_ARB_vertex_program = GL_FALSE; +GLboolean __GLEW_ARB_vertex_shader = GL_FALSE; +GLboolean __GLEW_ARB_window_pos = GL_FALSE; +GLboolean __GLEW_ATIX_point_sprites = GL_FALSE; +GLboolean __GLEW_ATIX_texture_env_combine3 = GL_FALSE; +GLboolean __GLEW_ATIX_texture_env_route = GL_FALSE; +GLboolean __GLEW_ATIX_vertex_shader_output_point_size = GL_FALSE; +GLboolean __GLEW_ATI_draw_buffers = GL_FALSE; +GLboolean __GLEW_ATI_element_array = GL_FALSE; +GLboolean __GLEW_ATI_envmap_bumpmap = GL_FALSE; +GLboolean __GLEW_ATI_fragment_shader = GL_FALSE; +GLboolean __GLEW_ATI_map_object_buffer = GL_FALSE; +GLboolean __GLEW_ATI_pn_triangles = GL_FALSE; +GLboolean __GLEW_ATI_separate_stencil = GL_FALSE; +GLboolean __GLEW_ATI_text_fragment_shader = GL_FALSE; +GLboolean __GLEW_ATI_texture_compression_3dc = GL_FALSE; +GLboolean __GLEW_ATI_texture_env_combine3 = GL_FALSE; +GLboolean __GLEW_ATI_texture_float = GL_FALSE; +GLboolean __GLEW_ATI_texture_mirror_once = GL_FALSE; +GLboolean __GLEW_ATI_vertex_array_object = GL_FALSE; +GLboolean __GLEW_ATI_vertex_attrib_array_object = GL_FALSE; +GLboolean __GLEW_ATI_vertex_streams = GL_FALSE; +GLboolean __GLEW_EXT_422_pixels = GL_FALSE; +GLboolean __GLEW_EXT_Cg_shader = GL_FALSE; +GLboolean __GLEW_EXT_abgr = GL_FALSE; +GLboolean __GLEW_EXT_bgra = GL_FALSE; +GLboolean __GLEW_EXT_blend_color = GL_FALSE; +GLboolean __GLEW_EXT_blend_equation_separate = GL_FALSE; +GLboolean __GLEW_EXT_blend_func_separate = GL_FALSE; +GLboolean __GLEW_EXT_blend_logic_op = GL_FALSE; +GLboolean __GLEW_EXT_blend_minmax = GL_FALSE; +GLboolean __GLEW_EXT_blend_subtract = GL_FALSE; +GLboolean __GLEW_EXT_clip_volume_hint = GL_FALSE; +GLboolean __GLEW_EXT_cmyka = GL_FALSE; +GLboolean __GLEW_EXT_color_subtable = GL_FALSE; +GLboolean __GLEW_EXT_compiled_vertex_array = GL_FALSE; +GLboolean __GLEW_EXT_convolution = GL_FALSE; +GLboolean __GLEW_EXT_coordinate_frame = GL_FALSE; +GLboolean __GLEW_EXT_copy_texture = GL_FALSE; +GLboolean __GLEW_EXT_cull_vertex = GL_FALSE; +GLboolean __GLEW_EXT_depth_bounds_test = GL_FALSE; +GLboolean __GLEW_EXT_draw_range_elements = GL_FALSE; +GLboolean __GLEW_EXT_fog_coord = GL_FALSE; +GLboolean __GLEW_EXT_fragment_lighting = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_blit = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_multisample = GL_FALSE; +GLboolean __GLEW_EXT_framebuffer_object = GL_FALSE; +GLboolean __GLEW_EXT_histogram = GL_FALSE; +GLboolean __GLEW_EXT_index_array_formats = GL_FALSE; +GLboolean __GLEW_EXT_index_func = GL_FALSE; +GLboolean __GLEW_EXT_index_material = GL_FALSE; +GLboolean __GLEW_EXT_index_texture = GL_FALSE; +GLboolean __GLEW_EXT_light_texture = GL_FALSE; +GLboolean __GLEW_EXT_misc_attribute = GL_FALSE; +GLboolean __GLEW_EXT_multi_draw_arrays = GL_FALSE; +GLboolean __GLEW_EXT_multisample = GL_FALSE; +GLboolean __GLEW_EXT_packed_depth_stencil = GL_FALSE; +GLboolean __GLEW_EXT_packed_pixels = GL_FALSE; +GLboolean __GLEW_EXT_paletted_texture = GL_FALSE; +GLboolean __GLEW_EXT_pixel_buffer_object = GL_FALSE; +GLboolean __GLEW_EXT_pixel_transform = GL_FALSE; +GLboolean __GLEW_EXT_pixel_transform_color_table = GL_FALSE; +GLboolean __GLEW_EXT_point_parameters = GL_FALSE; +GLboolean __GLEW_EXT_polygon_offset = GL_FALSE; +GLboolean __GLEW_EXT_rescale_normal = GL_FALSE; +GLboolean __GLEW_EXT_scene_marker = GL_FALSE; +GLboolean __GLEW_EXT_secondary_color = GL_FALSE; +GLboolean __GLEW_EXT_separate_specular_color = GL_FALSE; +GLboolean __GLEW_EXT_shadow_funcs = GL_FALSE; +GLboolean __GLEW_EXT_shared_texture_palette = GL_FALSE; +GLboolean __GLEW_EXT_stencil_clear_tag = GL_FALSE; +GLboolean __GLEW_EXT_stencil_two_side = GL_FALSE; +GLboolean __GLEW_EXT_stencil_wrap = GL_FALSE; +GLboolean __GLEW_EXT_subtexture = GL_FALSE; +GLboolean __GLEW_EXT_texture = GL_FALSE; +GLboolean __GLEW_EXT_texture3D = GL_FALSE; +GLboolean __GLEW_EXT_texture_compression_dxt1 = GL_FALSE; +GLboolean __GLEW_EXT_texture_compression_s3tc = GL_FALSE; +GLboolean __GLEW_EXT_texture_cube_map = GL_FALSE; +GLboolean __GLEW_EXT_texture_edge_clamp = GL_FALSE; +GLboolean __GLEW_EXT_texture_env = GL_FALSE; +GLboolean __GLEW_EXT_texture_env_add = GL_FALSE; +GLboolean __GLEW_EXT_texture_env_combine = GL_FALSE; +GLboolean __GLEW_EXT_texture_env_dot3 = GL_FALSE; +GLboolean __GLEW_EXT_texture_filter_anisotropic = GL_FALSE; +GLboolean __GLEW_EXT_texture_lod_bias = GL_FALSE; +GLboolean __GLEW_EXT_texture_mirror_clamp = GL_FALSE; +GLboolean __GLEW_EXT_texture_object = GL_FALSE; +GLboolean __GLEW_EXT_texture_perturb_normal = GL_FALSE; +GLboolean __GLEW_EXT_texture_rectangle = GL_FALSE; +GLboolean __GLEW_EXT_texture_sRGB = GL_FALSE; +GLboolean __GLEW_EXT_vertex_array = GL_FALSE; +GLboolean __GLEW_EXT_vertex_shader = GL_FALSE; +GLboolean __GLEW_EXT_vertex_weighting = GL_FALSE; +GLboolean __GLEW_GREMEDY_string_marker = GL_FALSE; +GLboolean __GLEW_HP_convolution_border_modes = GL_FALSE; +GLboolean __GLEW_HP_image_transform = GL_FALSE; +GLboolean __GLEW_HP_occlusion_test = GL_FALSE; +GLboolean __GLEW_HP_texture_lighting = GL_FALSE; +GLboolean __GLEW_IBM_cull_vertex = GL_FALSE; +GLboolean __GLEW_IBM_multimode_draw_arrays = GL_FALSE; +GLboolean __GLEW_IBM_rasterpos_clip = GL_FALSE; +GLboolean __GLEW_IBM_static_data = GL_FALSE; +GLboolean __GLEW_IBM_texture_mirrored_repeat = GL_FALSE; +GLboolean __GLEW_IBM_vertex_array_lists = GL_FALSE; +GLboolean __GLEW_INGR_color_clamp = GL_FALSE; +GLboolean __GLEW_INGR_interlace_read = GL_FALSE; +GLboolean __GLEW_INTEL_parallel_arrays = GL_FALSE; +GLboolean __GLEW_INTEL_texture_scissor = GL_FALSE; +GLboolean __GLEW_KTX_buffer_region = GL_FALSE; +GLboolean __GLEW_MESAX_texture_stack = GL_FALSE; +GLboolean __GLEW_MESA_pack_invert = GL_FALSE; +GLboolean __GLEW_MESA_resize_buffers = GL_FALSE; +GLboolean __GLEW_MESA_window_pos = GL_FALSE; +GLboolean __GLEW_MESA_ycbcr_texture = GL_FALSE; +GLboolean __GLEW_NV_blend_square = GL_FALSE; +GLboolean __GLEW_NV_copy_depth_to_color = GL_FALSE; +GLboolean __GLEW_NV_depth_clamp = GL_FALSE; +GLboolean __GLEW_NV_evaluators = GL_FALSE; +GLboolean __GLEW_NV_fence = GL_FALSE; +GLboolean __GLEW_NV_float_buffer = GL_FALSE; +GLboolean __GLEW_NV_fog_distance = GL_FALSE; +GLboolean __GLEW_NV_fragment_program = GL_FALSE; +GLboolean __GLEW_NV_fragment_program2 = GL_FALSE; +GLboolean __GLEW_NV_fragment_program_option = GL_FALSE; +GLboolean __GLEW_NV_half_float = GL_FALSE; +GLboolean __GLEW_NV_light_max_exponent = GL_FALSE; +GLboolean __GLEW_NV_multisample_filter_hint = GL_FALSE; +GLboolean __GLEW_NV_occlusion_query = GL_FALSE; +GLboolean __GLEW_NV_packed_depth_stencil = GL_FALSE; +GLboolean __GLEW_NV_pixel_data_range = GL_FALSE; +GLboolean __GLEW_NV_point_sprite = GL_FALSE; +GLboolean __GLEW_NV_primitive_restart = GL_FALSE; +GLboolean __GLEW_NV_register_combiners = GL_FALSE; +GLboolean __GLEW_NV_register_combiners2 = GL_FALSE; +GLboolean __GLEW_NV_texgen_emboss = GL_FALSE; +GLboolean __GLEW_NV_texgen_reflection = GL_FALSE; +GLboolean __GLEW_NV_texture_compression_vtc = GL_FALSE; +GLboolean __GLEW_NV_texture_env_combine4 = GL_FALSE; +GLboolean __GLEW_NV_texture_expand_normal = GL_FALSE; +GLboolean __GLEW_NV_texture_rectangle = GL_FALSE; +GLboolean __GLEW_NV_texture_shader = GL_FALSE; +GLboolean __GLEW_NV_texture_shader2 = GL_FALSE; +GLboolean __GLEW_NV_texture_shader3 = GL_FALSE; +GLboolean __GLEW_NV_vertex_array_range = GL_FALSE; +GLboolean __GLEW_NV_vertex_array_range2 = GL_FALSE; +GLboolean __GLEW_NV_vertex_program = GL_FALSE; +GLboolean __GLEW_NV_vertex_program1_1 = GL_FALSE; +GLboolean __GLEW_NV_vertex_program2 = GL_FALSE; +GLboolean __GLEW_NV_vertex_program2_option = GL_FALSE; +GLboolean __GLEW_NV_vertex_program3 = GL_FALSE; +GLboolean __GLEW_OML_interlace = GL_FALSE; +GLboolean __GLEW_OML_resample = GL_FALSE; +GLboolean __GLEW_OML_subsample = GL_FALSE; +GLboolean __GLEW_PGI_misc_hints = GL_FALSE; +GLboolean __GLEW_PGI_vertex_hints = GL_FALSE; +GLboolean __GLEW_REND_screen_coordinates = GL_FALSE; +GLboolean __GLEW_S3_s3tc = GL_FALSE; +GLboolean __GLEW_SGIS_color_range = GL_FALSE; +GLboolean __GLEW_SGIS_detail_texture = GL_FALSE; +GLboolean __GLEW_SGIS_fog_function = GL_FALSE; +GLboolean __GLEW_SGIS_generate_mipmap = GL_FALSE; +GLboolean __GLEW_SGIS_multisample = GL_FALSE; +GLboolean __GLEW_SGIS_pixel_texture = GL_FALSE; +GLboolean __GLEW_SGIS_sharpen_texture = GL_FALSE; +GLboolean __GLEW_SGIS_texture4D = GL_FALSE; +GLboolean __GLEW_SGIS_texture_border_clamp = GL_FALSE; +GLboolean __GLEW_SGIS_texture_edge_clamp = GL_FALSE; +GLboolean __GLEW_SGIS_texture_filter4 = GL_FALSE; +GLboolean __GLEW_SGIS_texture_lod = GL_FALSE; +GLboolean __GLEW_SGIS_texture_select = GL_FALSE; +GLboolean __GLEW_SGIX_async = GL_FALSE; +GLboolean __GLEW_SGIX_async_histogram = GL_FALSE; +GLboolean __GLEW_SGIX_async_pixel = GL_FALSE; +GLboolean __GLEW_SGIX_blend_alpha_minmax = GL_FALSE; +GLboolean __GLEW_SGIX_clipmap = GL_FALSE; +GLboolean __GLEW_SGIX_depth_texture = GL_FALSE; +GLboolean __GLEW_SGIX_flush_raster = GL_FALSE; +GLboolean __GLEW_SGIX_fog_offset = GL_FALSE; +GLboolean __GLEW_SGIX_fog_texture = GL_FALSE; +GLboolean __GLEW_SGIX_fragment_specular_lighting = GL_FALSE; +GLboolean __GLEW_SGIX_framezoom = GL_FALSE; +GLboolean __GLEW_SGIX_interlace = GL_FALSE; +GLboolean __GLEW_SGIX_ir_instrument1 = GL_FALSE; +GLboolean __GLEW_SGIX_list_priority = GL_FALSE; +GLboolean __GLEW_SGIX_pixel_texture = GL_FALSE; +GLboolean __GLEW_SGIX_pixel_texture_bits = GL_FALSE; +GLboolean __GLEW_SGIX_reference_plane = GL_FALSE; +GLboolean __GLEW_SGIX_resample = GL_FALSE; +GLboolean __GLEW_SGIX_shadow = GL_FALSE; +GLboolean __GLEW_SGIX_shadow_ambient = GL_FALSE; +GLboolean __GLEW_SGIX_sprite = GL_FALSE; +GLboolean __GLEW_SGIX_tag_sample_buffer = GL_FALSE; +GLboolean __GLEW_SGIX_texture_add_env = GL_FALSE; +GLboolean __GLEW_SGIX_texture_coordinate_clamp = GL_FALSE; +GLboolean __GLEW_SGIX_texture_lod_bias = GL_FALSE; +GLboolean __GLEW_SGIX_texture_multi_buffer = GL_FALSE; +GLboolean __GLEW_SGIX_texture_range = GL_FALSE; +GLboolean __GLEW_SGIX_texture_scale_bias = GL_FALSE; +GLboolean __GLEW_SGIX_vertex_preclip = GL_FALSE; +GLboolean __GLEW_SGIX_vertex_preclip_hint = GL_FALSE; +GLboolean __GLEW_SGIX_ycrcb = GL_FALSE; +GLboolean __GLEW_SGI_color_matrix = GL_FALSE; +GLboolean __GLEW_SGI_color_table = GL_FALSE; +GLboolean __GLEW_SGI_texture_color_table = GL_FALSE; +GLboolean __GLEW_SUNX_constant_data = GL_FALSE; +GLboolean __GLEW_SUN_convolution_border_modes = GL_FALSE; +GLboolean __GLEW_SUN_global_alpha = GL_FALSE; +GLboolean __GLEW_SUN_mesh_array = GL_FALSE; +GLboolean __GLEW_SUN_read_video_pixels = GL_FALSE; +GLboolean __GLEW_SUN_slice_accum = GL_FALSE; +GLboolean __GLEW_SUN_triangle_list = GL_FALSE; +GLboolean __GLEW_SUN_vertex = GL_FALSE; +GLboolean __GLEW_WIN_phong_shading = GL_FALSE; +GLboolean __GLEW_WIN_specular_fog = GL_FALSE; +GLboolean __GLEW_WIN_swap_hint = GL_FALSE; + +#endif /* !GLEW_MX */ + +#ifdef GL_VERSION_1_2 + +static GLboolean _glewInit_GL_VERSION_1_2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3D")) == NULL) || r; + r = ((glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElements")) == NULL) || r; + r = ((glTexImage3D = (PFNGLTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexImage3D")) == NULL) || r; + r = ((glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3D")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_2 */ + +#ifdef GL_VERSION_1_3 + +static GLboolean _glewInit_GL_VERSION_1_3 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveTexture = (PFNGLACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glActiveTexture")) == NULL) || r; + r = ((glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTexture")) == NULL) || r; + r = ((glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1D")) == NULL) || r; + r = ((glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2D")) == NULL) || r; + r = ((glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3D")) == NULL) || r; + r = ((glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1D")) == NULL) || r; + r = ((glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2D")) == NULL) || r; + r = ((glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3D")) == NULL) || r; + r = ((glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImage")) == NULL) || r; + r = ((glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixd")) == NULL) || r; + r = ((glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixf")) == NULL) || r; + r = ((glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixd")) == NULL) || r; + r = ((glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixf")) == NULL) || r; + r = ((glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1d")) == NULL) || r; + r = ((glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dv")) == NULL) || r; + r = ((glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1f")) == NULL) || r; + r = ((glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fv")) == NULL) || r; + r = ((glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1i")) == NULL) || r; + r = ((glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iv")) == NULL) || r; + r = ((glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1s")) == NULL) || r; + r = ((glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sv")) == NULL) || r; + r = ((glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2d")) == NULL) || r; + r = ((glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dv")) == NULL) || r; + r = ((glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2f")) == NULL) || r; + r = ((glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fv")) == NULL) || r; + r = ((glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2i")) == NULL) || r; + r = ((glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iv")) == NULL) || r; + r = ((glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2s")) == NULL) || r; + r = ((glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sv")) == NULL) || r; + r = ((glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3d")) == NULL) || r; + r = ((glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dv")) == NULL) || r; + r = ((glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3f")) == NULL) || r; + r = ((glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fv")) == NULL) || r; + r = ((glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3i")) == NULL) || r; + r = ((glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iv")) == NULL) || r; + r = ((glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3s")) == NULL) || r; + r = ((glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sv")) == NULL) || r; + r = ((glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4d")) == NULL) || r; + r = ((glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dv")) == NULL) || r; + r = ((glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4f")) == NULL) || r; + r = ((glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fv")) == NULL) || r; + r = ((glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4i")) == NULL) || r; + r = ((glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iv")) == NULL) || r; + r = ((glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4s")) == NULL) || r; + r = ((glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sv")) == NULL) || r; + r = ((glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverage")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_3 */ + +#ifdef GL_VERSION_1_4 + +static GLboolean _glewInit_GL_VERSION_1_4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendColor = (PFNGLBLENDCOLORPROC)glewGetProcAddress((const GLubyte*)"glBlendColor")) == NULL) || r; + r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r; + r = ((glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparate")) == NULL) || r; + r = ((glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointer")) == NULL) || r; + r = ((glFogCoordd = (PFNGLFOGCOORDDPROC)glewGetProcAddress((const GLubyte*)"glFogCoordd")) == NULL) || r; + r = ((glFogCoorddv = (PFNGLFOGCOORDDVPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddv")) == NULL) || r; + r = ((glFogCoordf = (PFNGLFOGCOORDFPROC)glewGetProcAddress((const GLubyte*)"glFogCoordf")) == NULL) || r; + r = ((glFogCoordfv = (PFNGLFOGCOORDFVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfv")) == NULL) || r; + r = ((glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArrays")) == NULL) || r; + r = ((glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElements")) == NULL) || r; + r = ((glPointParameterf = (PFNGLPOINTPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glPointParameterf")) == NULL) || r; + r = ((glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfv")) == NULL) || r; + r = ((glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3b")) == NULL) || r; + r = ((glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bv")) == NULL) || r; + r = ((glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3d")) == NULL) || r; + r = ((glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dv")) == NULL) || r; + r = ((glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3f")) == NULL) || r; + r = ((glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fv")) == NULL) || r; + r = ((glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3i")) == NULL) || r; + r = ((glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iv")) == NULL) || r; + r = ((glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3s")) == NULL) || r; + r = ((glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sv")) == NULL) || r; + r = ((glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ub")) == NULL) || r; + r = ((glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubv")) == NULL) || r; + r = ((glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ui")) == NULL) || r; + r = ((glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiv")) == NULL) || r; + r = ((glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3us")) == NULL) || r; + r = ((glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usv")) == NULL) || r; + r = ((glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointer")) == NULL) || r; + r = ((glWindowPos2d = (PFNGLWINDOWPOS2DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2d")) == NULL) || r; + r = ((glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dv")) == NULL) || r; + r = ((glWindowPos2f = (PFNGLWINDOWPOS2FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2f")) == NULL) || r; + r = ((glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fv")) == NULL) || r; + r = ((glWindowPos2i = (PFNGLWINDOWPOS2IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2i")) == NULL) || r; + r = ((glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iv")) == NULL) || r; + r = ((glWindowPos2s = (PFNGLWINDOWPOS2SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2s")) == NULL) || r; + r = ((glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sv")) == NULL) || r; + r = ((glWindowPos3d = (PFNGLWINDOWPOS3DPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3d")) == NULL) || r; + r = ((glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dv")) == NULL) || r; + r = ((glWindowPos3f = (PFNGLWINDOWPOS3FPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3f")) == NULL) || r; + r = ((glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fv")) == NULL) || r; + r = ((glWindowPos3i = (PFNGLWINDOWPOS3IPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3i")) == NULL) || r; + r = ((glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iv")) == NULL) || r; + r = ((glWindowPos3s = (PFNGLWINDOWPOS3SPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3s")) == NULL) || r; + r = ((glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sv")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_4 */ + +#ifdef GL_VERSION_1_5 + +static GLboolean _glewInit_GL_VERSION_1_5 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginQuery = (PFNGLBEGINQUERYPROC)glewGetProcAddress((const GLubyte*)"glBeginQuery")) == NULL) || r; + r = ((glBindBuffer = (PFNGLBINDBUFFERPROC)glewGetProcAddress((const GLubyte*)"glBindBuffer")) == NULL) || r; + r = ((glBufferData = (PFNGLBUFFERDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferData")) == NULL) || r; + r = ((glBufferSubData = (PFNGLBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glBufferSubData")) == NULL) || r; + r = ((glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffers")) == NULL) || r; + r = ((glDeleteQueries = (PFNGLDELETEQUERIESPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueries")) == NULL) || r; + r = ((glEndQuery = (PFNGLENDQUERYPROC)glewGetProcAddress((const GLubyte*)"glEndQuery")) == NULL) || r; + r = ((glGenBuffers = (PFNGLGENBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glGenBuffers")) == NULL) || r; + r = ((glGenQueries = (PFNGLGENQUERIESPROC)glewGetProcAddress((const GLubyte*)"glGenQueries")) == NULL) || r; + r = ((glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameteriv")) == NULL) || r; + r = ((glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointerv")) == NULL) || r; + r = ((glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubData")) == NULL) || r; + r = ((glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectiv")) == NULL) || r; + r = ((glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuiv")) == NULL) || r; + r = ((glGetQueryiv = (PFNGLGETQUERYIVPROC)glewGetProcAddress((const GLubyte*)"glGetQueryiv")) == NULL) || r; + r = ((glIsBuffer = (PFNGLISBUFFERPROC)glewGetProcAddress((const GLubyte*)"glIsBuffer")) == NULL) || r; + r = ((glIsQuery = (PFNGLISQUERYPROC)glewGetProcAddress((const GLubyte*)"glIsQuery")) == NULL) || r; + r = ((glMapBuffer = (PFNGLMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glMapBuffer")) == NULL) || r; + r = ((glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glUnmapBuffer")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_1_5 */ + +#ifdef GL_VERSION_2_0 + +static GLboolean _glewInit_GL_VERSION_2_0 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r; + r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r; + r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r; + r = ((glCompileShader = (PFNGLCOMPILESHADERPROC)glewGetProcAddress((const GLubyte*)"glCompileShader")) == NULL) || r; + r = ((glCreateProgram = (PFNGLCREATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glCreateProgram")) == NULL) || r; + r = ((glCreateShader = (PFNGLCREATESHADERPROC)glewGetProcAddress((const GLubyte*)"glCreateShader")) == NULL) || r; + r = ((glDeleteProgram = (PFNGLDELETEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgram")) == NULL) || r; + r = ((glDeleteShader = (PFNGLDELETESHADERPROC)glewGetProcAddress((const GLubyte*)"glDeleteShader")) == NULL) || r; + r = ((glDetachShader = (PFNGLDETACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glDetachShader")) == NULL) || r; + r = ((glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArray")) == NULL) || r; + r = ((glDrawBuffers = (PFNGLDRAWBUFFERSPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffers")) == NULL) || r; + r = ((glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArray")) == NULL) || r; + r = ((glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttrib")) == NULL) || r; + r = ((glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniform")) == NULL) || r; + r = ((glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedShaders")) == NULL) || r; + r = ((glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocation")) == NULL) || r; + r = ((glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetProgramInfoLog")) == NULL) || r; + r = ((glGetProgramiv = (PFNGLGETPROGRAMIVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramiv")) == NULL) || r; + r = ((glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)glewGetProcAddress((const GLubyte*)"glGetShaderInfoLog")) == NULL) || r; + r = ((glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSource")) == NULL) || r; + r = ((glGetShaderiv = (PFNGLGETSHADERIVPROC)glewGetProcAddress((const GLubyte*)"glGetShaderiv")) == NULL) || r; + r = ((glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocation")) == NULL) || r; + r = ((glGetUniformfv = (PFNGLGETUNIFORMFVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfv")) == NULL) || r; + r = ((glGetUniformiv = (PFNGLGETUNIFORMIVPROC)glewGetProcAddress((const GLubyte*)"glGetUniformiv")) == NULL) || r; + r = ((glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointerv")) == NULL) || r; + r = ((glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdv")) == NULL) || r; + r = ((glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfv")) == NULL) || r; + r = ((glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribiv")) == NULL) || r; + r = ((glIsProgram = (PFNGLISPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glIsProgram")) == NULL) || r; + r = ((glIsShader = (PFNGLISSHADERPROC)glewGetProcAddress((const GLubyte*)"glIsShader")) == NULL) || r; + r = ((glLinkProgram = (PFNGLLINKPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glLinkProgram")) == NULL) || r; + r = ((glShaderSource = (PFNGLSHADERSOURCEPROC)glewGetProcAddress((const GLubyte*)"glShaderSource")) == NULL) || r; + r = ((glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparate")) == NULL) || r; + r = ((glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilMaskSeparate")) == NULL) || r; + r = ((glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparate")) == NULL) || r; + r = ((glUniform1f = (PFNGLUNIFORM1FPROC)glewGetProcAddress((const GLubyte*)"glUniform1f")) == NULL) || r; + r = ((glUniform1fv = (PFNGLUNIFORM1FVPROC)glewGetProcAddress((const GLubyte*)"glUniform1fv")) == NULL) || r; + r = ((glUniform1i = (PFNGLUNIFORM1IPROC)glewGetProcAddress((const GLubyte*)"glUniform1i")) == NULL) || r; + r = ((glUniform1iv = (PFNGLUNIFORM1IVPROC)glewGetProcAddress((const GLubyte*)"glUniform1iv")) == NULL) || r; + r = ((glUniform2f = (PFNGLUNIFORM2FPROC)glewGetProcAddress((const GLubyte*)"glUniform2f")) == NULL) || r; + r = ((glUniform2fv = (PFNGLUNIFORM2FVPROC)glewGetProcAddress((const GLubyte*)"glUniform2fv")) == NULL) || r; + r = ((glUniform2i = (PFNGLUNIFORM2IPROC)glewGetProcAddress((const GLubyte*)"glUniform2i")) == NULL) || r; + r = ((glUniform2iv = (PFNGLUNIFORM2IVPROC)glewGetProcAddress((const GLubyte*)"glUniform2iv")) == NULL) || r; + r = ((glUniform3f = (PFNGLUNIFORM3FPROC)glewGetProcAddress((const GLubyte*)"glUniform3f")) == NULL) || r; + r = ((glUniform3fv = (PFNGLUNIFORM3FVPROC)glewGetProcAddress((const GLubyte*)"glUniform3fv")) == NULL) || r; + r = ((glUniform3i = (PFNGLUNIFORM3IPROC)glewGetProcAddress((const GLubyte*)"glUniform3i")) == NULL) || r; + r = ((glUniform3iv = (PFNGLUNIFORM3IVPROC)glewGetProcAddress((const GLubyte*)"glUniform3iv")) == NULL) || r; + r = ((glUniform4f = (PFNGLUNIFORM4FPROC)glewGetProcAddress((const GLubyte*)"glUniform4f")) == NULL) || r; + r = ((glUniform4fv = (PFNGLUNIFORM4FVPROC)glewGetProcAddress((const GLubyte*)"glUniform4fv")) == NULL) || r; + r = ((glUniform4i = (PFNGLUNIFORM4IPROC)glewGetProcAddress((const GLubyte*)"glUniform4i")) == NULL) || r; + r = ((glUniform4iv = (PFNGLUNIFORM4IVPROC)glewGetProcAddress((const GLubyte*)"glUniform4iv")) == NULL) || r; + r = ((glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fv")) == NULL) || r; + r = ((glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fv")) == NULL) || r; + r = ((glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fv")) == NULL) || r; + r = ((glUseProgram = (PFNGLUSEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glUseProgram")) == NULL) || r; + r = ((glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)glewGetProcAddress((const GLubyte*)"glValidateProgram")) == NULL) || r; + r = ((glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1d")) == NULL) || r; + r = ((glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dv")) == NULL) || r; + r = ((glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1f")) == NULL) || r; + r = ((glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fv")) == NULL) || r; + r = ((glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1s")) == NULL) || r; + r = ((glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sv")) == NULL) || r; + r = ((glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2d")) == NULL) || r; + r = ((glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dv")) == NULL) || r; + r = ((glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2f")) == NULL) || r; + r = ((glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fv")) == NULL) || r; + r = ((glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2s")) == NULL) || r; + r = ((glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sv")) == NULL) || r; + r = ((glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3d")) == NULL) || r; + r = ((glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dv")) == NULL) || r; + r = ((glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3f")) == NULL) || r; + r = ((glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fv")) == NULL) || r; + r = ((glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3s")) == NULL) || r; + r = ((glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sv")) == NULL) || r; + r = ((glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nbv")) == NULL) || r; + r = ((glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Niv")) == NULL) || r; + r = ((glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nsv")) == NULL) || r; + r = ((glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nub")) == NULL) || r; + r = ((glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nubv")) == NULL) || r; + r = ((glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nuiv")) == NULL) || r; + r = ((glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4Nusv")) == NULL) || r; + r = ((glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bv")) == NULL) || r; + r = ((glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4d")) == NULL) || r; + r = ((glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dv")) == NULL) || r; + r = ((glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4f")) == NULL) || r; + r = ((glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fv")) == NULL) || r; + r = ((glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4iv")) == NULL) || r; + r = ((glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4s")) == NULL) || r; + r = ((glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sv")) == NULL) || r; + r = ((glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubv")) == NULL) || r; + r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r; + r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r; + r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r; + + return r; +} + +#endif /* GL_VERSION_2_0 */ + +#ifdef GL_3DFX_multisample + +#endif /* GL_3DFX_multisample */ + +#ifdef GL_3DFX_tbuffer + +static GLboolean _glewInit_GL_3DFX_tbuffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTbufferMask3DFX = (PFNGLTBUFFERMASK3DFXPROC)glewGetProcAddress((const GLubyte*)"glTbufferMask3DFX")) == NULL) || r; + + return r; +} + +#endif /* GL_3DFX_tbuffer */ + +#ifdef GL_3DFX_texture_compression_FXT1 + +#endif /* GL_3DFX_texture_compression_FXT1 */ + +#ifdef GL_APPLE_client_storage + +#endif /* GL_APPLE_client_storage */ + +#ifdef GL_APPLE_element_array + +static GLboolean _glewInit_GL_APPLE_element_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawElementArrayAPPLE = (PFNGLDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayAPPLE")) == NULL) || r; + r = ((glDrawRangeElementArrayAPPLE = (PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayAPPLE")) == NULL) || r; + r = ((glElementPointerAPPLE = (PFNGLELEMENTPOINTERAPPLEPROC)glewGetProcAddress((const GLubyte*)"glElementPointerAPPLE")) == NULL) || r; + r = ((glMultiDrawElementArrayAPPLE = (PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementArrayAPPLE")) == NULL) || r; + r = ((glMultiDrawRangeElementArrayAPPLE = (PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawRangeElementArrayAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_element_array */ + +#ifdef GL_APPLE_fence + +static GLboolean _glewInit_GL_APPLE_fence (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDeleteFencesAPPLE = (PFNGLDELETEFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesAPPLE")) == NULL) || r; + r = ((glFinishFenceAPPLE = (PFNGLFINISHFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceAPPLE")) == NULL) || r; + r = ((glFinishObjectAPPLE = (PFNGLFINISHOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFinishObjectAPPLE")) == NULL) || r; + r = ((glGenFencesAPPLE = (PFNGLGENFENCESAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenFencesAPPLE")) == NULL) || r; + r = ((glIsFenceAPPLE = (PFNGLISFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsFenceAPPLE")) == NULL) || r; + r = ((glSetFenceAPPLE = (PFNGLSETFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glSetFenceAPPLE")) == NULL) || r; + r = ((glTestFenceAPPLE = (PFNGLTESTFENCEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestFenceAPPLE")) == NULL) || r; + r = ((glTestObjectAPPLE = (PFNGLTESTOBJECTAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTestObjectAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_fence */ + +#ifdef GL_APPLE_float_pixels + +#endif /* GL_APPLE_float_pixels */ + +#ifdef GL_APPLE_pixel_buffer + +#endif /* GL_APPLE_pixel_buffer */ + +#ifdef GL_APPLE_specular_vector + +#endif /* GL_APPLE_specular_vector */ + +#ifdef GL_APPLE_texture_range + +static GLboolean _glewInit_GL_APPLE_texture_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTexParameterPointervAPPLE = (PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterPointervAPPLE")) == NULL) || r; + r = ((glTextureRangeAPPLE = (PFNGLTEXTURERANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glTextureRangeAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_texture_range */ + +#ifdef GL_APPLE_transform_hint + +#endif /* GL_APPLE_transform_hint */ + +#ifdef GL_APPLE_vertex_array_object + +static GLboolean _glewInit_GL_APPLE_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindVertexArrayAPPLE = (PFNGLBINDVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glBindVertexArrayAPPLE")) == NULL) || r; + r = ((glDeleteVertexArraysAPPLE = (PFNGLDELETEVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexArraysAPPLE")) == NULL) || r; + r = ((glGenVertexArraysAPPLE = (PFNGLGENVERTEXARRAYSAPPLEPROC)glewGetProcAddress((const GLubyte*)"glGenVertexArraysAPPLE")) == NULL) || r; + r = ((glIsVertexArrayAPPLE = (PFNGLISVERTEXARRAYAPPLEPROC)glewGetProcAddress((const GLubyte*)"glIsVertexArrayAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_vertex_array_object */ + +#ifdef GL_APPLE_vertex_array_range + +static GLboolean _glewInit_GL_APPLE_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushVertexArrayRangeAPPLE = (PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeAPPLE")) == NULL) || r; + r = ((glVertexArrayParameteriAPPLE = (PFNGLVERTEXARRAYPARAMETERIAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayParameteriAPPLE")) == NULL) || r; + r = ((glVertexArrayRangeAPPLE = (PFNGLVERTEXARRAYRANGEAPPLEPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeAPPLE")) == NULL) || r; + + return r; +} + +#endif /* GL_APPLE_vertex_array_range */ + +#ifdef GL_APPLE_ycbcr_422 + +#endif /* GL_APPLE_ycbcr_422 */ + +#ifdef GL_ARB_color_buffer_float + +static GLboolean _glewInit_GL_ARB_color_buffer_float (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClampColorARB = (PFNGLCLAMPCOLORARBPROC)glewGetProcAddress((const GLubyte*)"glClampColorARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_color_buffer_float */ + +#ifdef GL_ARB_depth_texture + +#endif /* GL_ARB_depth_texture */ + +#ifdef GL_ARB_draw_buffers + +static GLboolean _glewInit_GL_ARB_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_draw_buffers */ + +#ifdef GL_ARB_fragment_program + +#endif /* GL_ARB_fragment_program */ + +#ifdef GL_ARB_fragment_program_shadow + +#endif /* GL_ARB_fragment_program_shadow */ + +#ifdef GL_ARB_fragment_shader + +#endif /* GL_ARB_fragment_shader */ + +#ifdef GL_ARB_half_float_pixel + +#endif /* GL_ARB_half_float_pixel */ + +#ifdef GL_ARB_imaging + +static GLboolean _glewInit_GL_ARB_imaging (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)"glBlendEquation")) == NULL) || r; + r = ((glColorSubTable = (PFNGLCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorSubTable")) == NULL) || r; + r = ((glColorTable = (PFNGLCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glColorTable")) == NULL) || r; + r = ((glColorTableParameterfv = (PFNGLCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfv")) == NULL) || r; + r = ((glColorTableParameteriv = (PFNGLCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameteriv")) == NULL) || r; + r = ((glConvolutionFilter1D = (PFNGLCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1D")) == NULL) || r; + r = ((glConvolutionFilter2D = (PFNGLCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2D")) == NULL) || r; + r = ((glConvolutionParameterf = (PFNGLCONVOLUTIONPARAMETERFPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterf")) == NULL) || r; + r = ((glConvolutionParameterfv = (PFNGLCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfv")) == NULL) || r; + r = ((glConvolutionParameteri = (PFNGLCONVOLUTIONPARAMETERIPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteri")) == NULL) || r; + r = ((glConvolutionParameteriv = (PFNGLCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriv")) == NULL) || r; + r = ((glCopyColorSubTable = (PFNGLCOPYCOLORSUBTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTable")) == NULL) || r; + r = ((glCopyColorTable = (PFNGLCOPYCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTable")) == NULL) || r; + r = ((glCopyConvolutionFilter1D = (PFNGLCOPYCONVOLUTIONFILTER1DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1D")) == NULL) || r; + r = ((glCopyConvolutionFilter2D = (PFNGLCOPYCONVOLUTIONFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2D")) == NULL) || r; + r = ((glGetColorTable = (PFNGLGETCOLORTABLEPROC)glewGetProcAddress((const GLubyte*)"glGetColorTable")) == NULL) || r; + r = ((glGetColorTableParameterfv = (PFNGLGETCOLORTABLEPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfv")) == NULL) || r; + r = ((glGetColorTableParameteriv = (PFNGLGETCOLORTABLEPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameteriv")) == NULL) || r; + r = ((glGetConvolutionFilter = (PFNGLGETCONVOLUTIONFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilter")) == NULL) || r; + r = ((glGetConvolutionParameterfv = (PFNGLGETCONVOLUTIONPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfv")) == NULL) || r; + r = ((glGetConvolutionParameteriv = (PFNGLGETCONVOLUTIONPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameteriv")) == NULL) || r; + r = ((glGetHistogram = (PFNGLGETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glGetHistogram")) == NULL) || r; + r = ((glGetHistogramParameterfv = (PFNGLGETHISTOGRAMPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfv")) == NULL) || r; + r = ((glGetHistogramParameteriv = (PFNGLGETHISTOGRAMPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameteriv")) == NULL) || r; + r = ((glGetMinmax = (PFNGLGETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glGetMinmax")) == NULL) || r; + r = ((glGetMinmaxParameterfv = (PFNGLGETMINMAXPARAMETERFVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfv")) == NULL) || r; + r = ((glGetMinmaxParameteriv = (PFNGLGETMINMAXPARAMETERIVPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameteriv")) == NULL) || r; + r = ((glGetSeparableFilter = (PFNGLGETSEPARABLEFILTERPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilter")) == NULL) || r; + r = ((glHistogram = (PFNGLHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glHistogram")) == NULL) || r; + r = ((glMinmax = (PFNGLMINMAXPROC)glewGetProcAddress((const GLubyte*)"glMinmax")) == NULL) || r; + r = ((glResetHistogram = (PFNGLRESETHISTOGRAMPROC)glewGetProcAddress((const GLubyte*)"glResetHistogram")) == NULL) || r; + r = ((glResetMinmax = (PFNGLRESETMINMAXPROC)glewGetProcAddress((const GLubyte*)"glResetMinmax")) == NULL) || r; + r = ((glSeparableFilter2D = (PFNGLSEPARABLEFILTER2DPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2D")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_imaging */ + +#ifdef GL_ARB_matrix_palette + +static GLboolean _glewInit_GL_ARB_matrix_palette (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCurrentPaletteMatrixARB = (PFNGLCURRENTPALETTEMATRIXARBPROC)glewGetProcAddress((const GLubyte*)"glCurrentPaletteMatrixARB")) == NULL) || r; + r = ((glMatrixIndexPointerARB = (PFNGLMATRIXINDEXPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexPointerARB")) == NULL) || r; + r = ((glMatrixIndexubvARB = (PFNGLMATRIXINDEXUBVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexubvARB")) == NULL) || r; + r = ((glMatrixIndexuivARB = (PFNGLMATRIXINDEXUIVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexuivARB")) == NULL) || r; + r = ((glMatrixIndexusvARB = (PFNGLMATRIXINDEXUSVARBPROC)glewGetProcAddress((const GLubyte*)"glMatrixIndexusvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_matrix_palette */ + +#ifdef GL_ARB_multisample + +static GLboolean _glewInit_GL_ARB_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC)glewGetProcAddress((const GLubyte*)"glSampleCoverageARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_multisample */ + +#ifdef GL_ARB_multitexture + +static GLboolean _glewInit_GL_ARB_multitexture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glActiveTextureARB")) == NULL) || r; + r = ((glClientActiveTextureARB = (PFNGLCLIENTACTIVETEXTUREARBPROC)glewGetProcAddress((const GLubyte*)"glClientActiveTextureARB")) == NULL) || r; + r = ((glMultiTexCoord1dARB = (PFNGLMULTITEXCOORD1DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dARB")) == NULL) || r; + r = ((glMultiTexCoord1dvARB = (PFNGLMULTITEXCOORD1DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1dvARB")) == NULL) || r; + r = ((glMultiTexCoord1fARB = (PFNGLMULTITEXCOORD1FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fARB")) == NULL) || r; + r = ((glMultiTexCoord1fvARB = (PFNGLMULTITEXCOORD1FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1fvARB")) == NULL) || r; + r = ((glMultiTexCoord1iARB = (PFNGLMULTITEXCOORD1IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1iARB")) == NULL) || r; + r = ((glMultiTexCoord1ivARB = (PFNGLMULTITEXCOORD1IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1ivARB")) == NULL) || r; + r = ((glMultiTexCoord1sARB = (PFNGLMULTITEXCOORD1SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1sARB")) == NULL) || r; + r = ((glMultiTexCoord1svARB = (PFNGLMULTITEXCOORD1SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1svARB")) == NULL) || r; + r = ((glMultiTexCoord2dARB = (PFNGLMULTITEXCOORD2DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dARB")) == NULL) || r; + r = ((glMultiTexCoord2dvARB = (PFNGLMULTITEXCOORD2DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2dvARB")) == NULL) || r; + r = ((glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fARB")) == NULL) || r; + r = ((glMultiTexCoord2fvARB = (PFNGLMULTITEXCOORD2FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2fvARB")) == NULL) || r; + r = ((glMultiTexCoord2iARB = (PFNGLMULTITEXCOORD2IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2iARB")) == NULL) || r; + r = ((glMultiTexCoord2ivARB = (PFNGLMULTITEXCOORD2IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2ivARB")) == NULL) || r; + r = ((glMultiTexCoord2sARB = (PFNGLMULTITEXCOORD2SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2sARB")) == NULL) || r; + r = ((glMultiTexCoord2svARB = (PFNGLMULTITEXCOORD2SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2svARB")) == NULL) || r; + r = ((glMultiTexCoord3dARB = (PFNGLMULTITEXCOORD3DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dARB")) == NULL) || r; + r = ((glMultiTexCoord3dvARB = (PFNGLMULTITEXCOORD3DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3dvARB")) == NULL) || r; + r = ((glMultiTexCoord3fARB = (PFNGLMULTITEXCOORD3FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fARB")) == NULL) || r; + r = ((glMultiTexCoord3fvARB = (PFNGLMULTITEXCOORD3FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3fvARB")) == NULL) || r; + r = ((glMultiTexCoord3iARB = (PFNGLMULTITEXCOORD3IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3iARB")) == NULL) || r; + r = ((glMultiTexCoord3ivARB = (PFNGLMULTITEXCOORD3IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3ivARB")) == NULL) || r; + r = ((glMultiTexCoord3sARB = (PFNGLMULTITEXCOORD3SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3sARB")) == NULL) || r; + r = ((glMultiTexCoord3svARB = (PFNGLMULTITEXCOORD3SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3svARB")) == NULL) || r; + r = ((glMultiTexCoord4dARB = (PFNGLMULTITEXCOORD4DARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dARB")) == NULL) || r; + r = ((glMultiTexCoord4dvARB = (PFNGLMULTITEXCOORD4DVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4dvARB")) == NULL) || r; + r = ((glMultiTexCoord4fARB = (PFNGLMULTITEXCOORD4FARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fARB")) == NULL) || r; + r = ((glMultiTexCoord4fvARB = (PFNGLMULTITEXCOORD4FVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4fvARB")) == NULL) || r; + r = ((glMultiTexCoord4iARB = (PFNGLMULTITEXCOORD4IARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4iARB")) == NULL) || r; + r = ((glMultiTexCoord4ivARB = (PFNGLMULTITEXCOORD4IVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4ivARB")) == NULL) || r; + r = ((glMultiTexCoord4sARB = (PFNGLMULTITEXCOORD4SARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4sARB")) == NULL) || r; + r = ((glMultiTexCoord4svARB = (PFNGLMULTITEXCOORD4SVARBPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4svARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_multitexture */ + +#ifdef GL_ARB_occlusion_query + +static GLboolean _glewInit_GL_ARB_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glBeginQueryARB")) == NULL) || r; + r = ((glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteQueriesARB")) == NULL) || r; + r = ((glEndQueryARB = (PFNGLENDQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glEndQueryARB")) == NULL) || r; + r = ((glGenQueriesARB = (PFNGLGENQUERIESARBPROC)glewGetProcAddress((const GLubyte*)"glGenQueriesARB")) == NULL) || r; + r = ((glGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectivARB")) == NULL) || r; + r = ((glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryObjectuivARB")) == NULL) || r; + r = ((glGetQueryivARB = (PFNGLGETQUERYIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetQueryivARB")) == NULL) || r; + r = ((glIsQueryARB = (PFNGLISQUERYARBPROC)glewGetProcAddress((const GLubyte*)"glIsQueryARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_occlusion_query */ + +#ifdef GL_ARB_pixel_buffer_object + +#endif /* GL_ARB_pixel_buffer_object */ + +#ifdef GL_ARB_point_parameters + +static GLboolean _glewInit_GL_ARB_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfARB")) == NULL) || r; + r = ((glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_point_parameters */ + +#ifdef GL_ARB_point_sprite + +#endif /* GL_ARB_point_sprite */ + +#ifdef GL_ARB_shader_objects + +static GLboolean _glewInit_GL_ARB_shader_objects (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glAttachObjectARB")) == NULL) || r; + r = ((glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)glewGetProcAddress((const GLubyte*)"glCompileShaderARB")) == NULL) || r; + r = ((glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateProgramObjectARB")) == NULL) || r; + r = ((glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glCreateShaderObjectARB")) == NULL) || r; + r = ((glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteObjectARB")) == NULL) || r; + r = ((glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glDetachObjectARB")) == NULL) || r; + r = ((glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveUniformARB")) == NULL) || r; + r = ((glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttachedObjectsARB")) == NULL) || r; + r = ((glGetHandleARB = (PFNGLGETHANDLEARBPROC)glewGetProcAddress((const GLubyte*)"glGetHandleARB")) == NULL) || r; + r = ((glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)glewGetProcAddress((const GLubyte*)"glGetInfoLogARB")) == NULL) || r; + r = ((glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterfvARB")) == NULL) || r; + r = ((glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetObjectParameterivARB")) == NULL) || r; + r = ((glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glGetShaderSourceARB")) == NULL) || r; + r = ((glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformLocationARB")) == NULL) || r; + r = ((glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformfvARB")) == NULL) || r; + r = ((glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetUniformivARB")) == NULL) || r; + r = ((glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glLinkProgramARB")) == NULL) || r; + r = ((glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)glewGetProcAddress((const GLubyte*)"glShaderSourceARB")) == NULL) || r; + r = ((glUniform1fARB = (PFNGLUNIFORM1FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fARB")) == NULL) || r; + r = ((glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1fvARB")) == NULL) || r; + r = ((glUniform1iARB = (PFNGLUNIFORM1IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1iARB")) == NULL) || r; + r = ((glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform1ivARB")) == NULL) || r; + r = ((glUniform2fARB = (PFNGLUNIFORM2FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fARB")) == NULL) || r; + r = ((glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2fvARB")) == NULL) || r; + r = ((glUniform2iARB = (PFNGLUNIFORM2IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2iARB")) == NULL) || r; + r = ((glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform2ivARB")) == NULL) || r; + r = ((glUniform3fARB = (PFNGLUNIFORM3FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fARB")) == NULL) || r; + r = ((glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3fvARB")) == NULL) || r; + r = ((glUniform3iARB = (PFNGLUNIFORM3IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3iARB")) == NULL) || r; + r = ((glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform3ivARB")) == NULL) || r; + r = ((glUniform4fARB = (PFNGLUNIFORM4FARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fARB")) == NULL) || r; + r = ((glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4fvARB")) == NULL) || r; + r = ((glUniform4iARB = (PFNGLUNIFORM4IARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4iARB")) == NULL) || r; + r = ((glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)glewGetProcAddress((const GLubyte*)"glUniform4ivARB")) == NULL) || r; + r = ((glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix2fvARB")) == NULL) || r; + r = ((glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix3fvARB")) == NULL) || r; + r = ((glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)glewGetProcAddress((const GLubyte*)"glUniformMatrix4fvARB")) == NULL) || r; + r = ((glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)glewGetProcAddress((const GLubyte*)"glUseProgramObjectARB")) == NULL) || r; + r = ((glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glValidateProgramARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_shader_objects */ + +#ifdef GL_ARB_shading_language_100 + +#endif /* GL_ARB_shading_language_100 */ + +#ifdef GL_ARB_shadow + +#endif /* GL_ARB_shadow */ + +#ifdef GL_ARB_shadow_ambient + +#endif /* GL_ARB_shadow_ambient */ + +#ifdef GL_ARB_texture_border_clamp + +#endif /* GL_ARB_texture_border_clamp */ + +#ifdef GL_ARB_texture_compression + +static GLboolean _glewInit_GL_ARB_texture_compression (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCompressedTexImage1DARB = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage1DARB")) == NULL) || r; + r = ((glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage2DARB")) == NULL) || r; + r = ((glCompressedTexImage3DARB = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexImage3DARB")) == NULL) || r; + r = ((glCompressedTexSubImage1DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage1DARB")) == NULL) || r; + r = ((glCompressedTexSubImage2DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage2DARB")) == NULL) || r; + r = ((glCompressedTexSubImage3DARB = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)glewGetProcAddress((const GLubyte*)"glCompressedTexSubImage3DARB")) == NULL) || r; + r = ((glGetCompressedTexImageARB = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"glGetCompressedTexImageARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_texture_compression */ + +#ifdef GL_ARB_texture_cube_map + +#endif /* GL_ARB_texture_cube_map */ + +#ifdef GL_ARB_texture_env_add + +#endif /* GL_ARB_texture_env_add */ + +#ifdef GL_ARB_texture_env_combine + +#endif /* GL_ARB_texture_env_combine */ + +#ifdef GL_ARB_texture_env_crossbar + +#endif /* GL_ARB_texture_env_crossbar */ + +#ifdef GL_ARB_texture_env_dot3 + +#endif /* GL_ARB_texture_env_dot3 */ + +#ifdef GL_ARB_texture_float + +#endif /* GL_ARB_texture_float */ + +#ifdef GL_ARB_texture_mirrored_repeat + +#endif /* GL_ARB_texture_mirrored_repeat */ + +#ifdef GL_ARB_texture_non_power_of_two + +#endif /* GL_ARB_texture_non_power_of_two */ + +#ifdef GL_ARB_texture_rectangle + +#endif /* GL_ARB_texture_rectangle */ + +#ifdef GL_ARB_transpose_matrix + +static GLboolean _glewInit_GL_ARB_transpose_matrix (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glLoadTransposeMatrixdARB = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixdARB")) == NULL) || r; + r = ((glLoadTransposeMatrixfARB = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glLoadTransposeMatrixfARB")) == NULL) || r; + r = ((glMultTransposeMatrixdARB = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixdARB")) == NULL) || r; + r = ((glMultTransposeMatrixfARB = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)glewGetProcAddress((const GLubyte*)"glMultTransposeMatrixfARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_transpose_matrix */ + +#ifdef GL_ARB_vertex_blend + +static GLboolean _glewInit_GL_ARB_vertex_blend (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVertexBlendARB = (PFNGLVERTEXBLENDARBPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendARB")) == NULL) || r; + r = ((glWeightPointerARB = (PFNGLWEIGHTPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glWeightPointerARB")) == NULL) || r; + r = ((glWeightbvARB = (PFNGLWEIGHTBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightbvARB")) == NULL) || r; + r = ((glWeightdvARB = (PFNGLWEIGHTDVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightdvARB")) == NULL) || r; + r = ((glWeightfvARB = (PFNGLWEIGHTFVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightfvARB")) == NULL) || r; + r = ((glWeightivARB = (PFNGLWEIGHTIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightivARB")) == NULL) || r; + r = ((glWeightsvARB = (PFNGLWEIGHTSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightsvARB")) == NULL) || r; + r = ((glWeightubvARB = (PFNGLWEIGHTUBVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightubvARB")) == NULL) || r; + r = ((glWeightuivARB = (PFNGLWEIGHTUIVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightuivARB")) == NULL) || r; + r = ((glWeightusvARB = (PFNGLWEIGHTUSVARBPROC)glewGetProcAddress((const GLubyte*)"glWeightusvARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_blend */ + +#ifdef GL_ARB_vertex_buffer_object + +static GLboolean _glewInit_GL_ARB_vertex_buffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindBufferARB = (PFNGLBINDBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glBindBufferARB")) == NULL) || r; + r = ((glBufferDataARB = (PFNGLBUFFERDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferDataARB")) == NULL) || r; + r = ((glBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glBufferSubDataARB")) == NULL) || r; + r = ((glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteBuffersARB")) == NULL) || r; + r = ((glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)glewGetProcAddress((const GLubyte*)"glGenBuffersARB")) == NULL) || r; + r = ((glGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferParameterivARB")) == NULL) || r; + r = ((glGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferPointervARB")) == NULL) || r; + r = ((glGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC)glewGetProcAddress((const GLubyte*)"glGetBufferSubDataARB")) == NULL) || r; + r = ((glIsBufferARB = (PFNGLISBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glIsBufferARB")) == NULL) || r; + r = ((glMapBufferARB = (PFNGLMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glMapBufferARB")) == NULL) || r; + r = ((glUnmapBufferARB = (PFNGLUNMAPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"glUnmapBufferARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_buffer_object */ + +#ifdef GL_ARB_vertex_program + +static GLboolean _glewInit_GL_ARB_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glBindProgramARB")) == NULL) || r; + r = ((glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsARB")) == NULL) || r; + r = ((glDisableVertexAttribArrayARB = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glDisableVertexAttribArrayARB")) == NULL) || r; + r = ((glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)glewGetProcAddress((const GLubyte*)"glEnableVertexAttribArrayARB")) == NULL) || r; + r = ((glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsARB")) == NULL) || r; + r = ((glGetProgramEnvParameterdvARB = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterdvARB")) == NULL) || r; + r = ((glGetProgramEnvParameterfvARB = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramEnvParameterfvARB")) == NULL) || r; + r = ((glGetProgramLocalParameterdvARB = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterdvARB")) == NULL) || r; + r = ((glGetProgramLocalParameterfvARB = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramLocalParameterfvARB")) == NULL) || r; + r = ((glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringARB")) == NULL) || r; + r = ((glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivARB")) == NULL) || r; + r = ((glGetVertexAttribPointervARB = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervARB")) == NULL) || r; + r = ((glGetVertexAttribdvARB = (PFNGLGETVERTEXATTRIBDVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvARB")) == NULL) || r; + r = ((glGetVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvARB")) == NULL) || r; + r = ((glGetVertexAttribivARB = (PFNGLGETVERTEXATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivARB")) == NULL) || r; + r = ((glIsProgramARB = (PFNGLISPROGRAMARBPROC)glewGetProcAddress((const GLubyte*)"glIsProgramARB")) == NULL) || r; + r = ((glProgramEnvParameter4dARB = (PFNGLPROGRAMENVPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dARB")) == NULL) || r; + r = ((glProgramEnvParameter4dvARB = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4dvARB")) == NULL) || r; + r = ((glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fARB")) == NULL) || r; + r = ((glProgramEnvParameter4fvARB = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramEnvParameter4fvARB")) == NULL) || r; + r = ((glProgramLocalParameter4dARB = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dARB")) == NULL) || r; + r = ((glProgramLocalParameter4dvARB = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4dvARB")) == NULL) || r; + r = ((glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fARB")) == NULL) || r; + r = ((glProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)glewGetProcAddress((const GLubyte*)"glProgramLocalParameter4fvARB")) == NULL) || r; + r = ((glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"glProgramStringARB")) == NULL) || r; + r = ((glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dARB")) == NULL) || r; + r = ((glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvARB")) == NULL) || r; + r = ((glVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fARB")) == NULL) || r; + r = ((glVertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvARB")) == NULL) || r; + r = ((glVertexAttrib1sARB = (PFNGLVERTEXATTRIB1SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sARB")) == NULL) || r; + r = ((glVertexAttrib1svARB = (PFNGLVERTEXATTRIB1SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svARB")) == NULL) || r; + r = ((glVertexAttrib2dARB = (PFNGLVERTEXATTRIB2DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dARB")) == NULL) || r; + r = ((glVertexAttrib2dvARB = (PFNGLVERTEXATTRIB2DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvARB")) == NULL) || r; + r = ((glVertexAttrib2fARB = (PFNGLVERTEXATTRIB2FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fARB")) == NULL) || r; + r = ((glVertexAttrib2fvARB = (PFNGLVERTEXATTRIB2FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvARB")) == NULL) || r; + r = ((glVertexAttrib2sARB = (PFNGLVERTEXATTRIB2SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sARB")) == NULL) || r; + r = ((glVertexAttrib2svARB = (PFNGLVERTEXATTRIB2SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svARB")) == NULL) || r; + r = ((glVertexAttrib3dARB = (PFNGLVERTEXATTRIB3DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dARB")) == NULL) || r; + r = ((glVertexAttrib3dvARB = (PFNGLVERTEXATTRIB3DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvARB")) == NULL) || r; + r = ((glVertexAttrib3fARB = (PFNGLVERTEXATTRIB3FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fARB")) == NULL) || r; + r = ((glVertexAttrib3fvARB = (PFNGLVERTEXATTRIB3FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvARB")) == NULL) || r; + r = ((glVertexAttrib3sARB = (PFNGLVERTEXATTRIB3SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sARB")) == NULL) || r; + r = ((glVertexAttrib3svARB = (PFNGLVERTEXATTRIB3SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svARB")) == NULL) || r; + r = ((glVertexAttrib4NbvARB = (PFNGLVERTEXATTRIB4NBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NbvARB")) == NULL) || r; + r = ((glVertexAttrib4NivARB = (PFNGLVERTEXATTRIB4NIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NivARB")) == NULL) || r; + r = ((glVertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NsvARB")) == NULL) || r; + r = ((glVertexAttrib4NubARB = (PFNGLVERTEXATTRIB4NUBARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubARB")) == NULL) || r; + r = ((glVertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NubvARB")) == NULL) || r; + r = ((glVertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NuivARB")) == NULL) || r; + r = ((glVertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4NusvARB")) == NULL) || r; + r = ((glVertexAttrib4bvARB = (PFNGLVERTEXATTRIB4BVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4bvARB")) == NULL) || r; + r = ((glVertexAttrib4dARB = (PFNGLVERTEXATTRIB4DARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dARB")) == NULL) || r; + r = ((glVertexAttrib4dvARB = (PFNGLVERTEXATTRIB4DVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvARB")) == NULL) || r; + r = ((glVertexAttrib4fARB = (PFNGLVERTEXATTRIB4FARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fARB")) == NULL) || r; + r = ((glVertexAttrib4fvARB = (PFNGLVERTEXATTRIB4FVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvARB")) == NULL) || r; + r = ((glVertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ivARB")) == NULL) || r; + r = ((glVertexAttrib4sARB = (PFNGLVERTEXATTRIB4SARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sARB")) == NULL) || r; + r = ((glVertexAttrib4svARB = (PFNGLVERTEXATTRIB4SVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svARB")) == NULL) || r; + r = ((glVertexAttrib4ubvARB = (PFNGLVERTEXATTRIB4UBVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvARB")) == NULL) || r; + r = ((glVertexAttrib4uivARB = (PFNGLVERTEXATTRIB4UIVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uivARB")) == NULL) || r; + r = ((glVertexAttrib4usvARB = (PFNGLVERTEXATTRIB4USVARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usvARB")) == NULL) || r; + r = ((glVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_program */ + +#ifdef GL_ARB_vertex_shader + +static GLboolean _glewInit_GL_ARB_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocationARB")) == NULL) || r; + r = ((glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"glGetActiveAttribARB")) == NULL) || r; + r = ((glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)glewGetProcAddress((const GLubyte*)"glGetAttribLocationARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_vertex_shader */ + +#ifdef GL_ARB_window_pos + +static GLboolean _glewInit_GL_ARB_window_pos (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glWindowPos2dARB = (PFNGLWINDOWPOS2DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dARB")) == NULL) || r; + r = ((glWindowPos2dvARB = (PFNGLWINDOWPOS2DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvARB")) == NULL) || r; + r = ((glWindowPos2fARB = (PFNGLWINDOWPOS2FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fARB")) == NULL) || r; + r = ((glWindowPos2fvARB = (PFNGLWINDOWPOS2FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvARB")) == NULL) || r; + r = ((glWindowPos2iARB = (PFNGLWINDOWPOS2IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iARB")) == NULL) || r; + r = ((glWindowPos2ivARB = (PFNGLWINDOWPOS2IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivARB")) == NULL) || r; + r = ((glWindowPos2sARB = (PFNGLWINDOWPOS2SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sARB")) == NULL) || r; + r = ((glWindowPos2svARB = (PFNGLWINDOWPOS2SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svARB")) == NULL) || r; + r = ((glWindowPos3dARB = (PFNGLWINDOWPOS3DARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dARB")) == NULL) || r; + r = ((glWindowPos3dvARB = (PFNGLWINDOWPOS3DVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvARB")) == NULL) || r; + r = ((glWindowPos3fARB = (PFNGLWINDOWPOS3FARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fARB")) == NULL) || r; + r = ((glWindowPos3fvARB = (PFNGLWINDOWPOS3FVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvARB")) == NULL) || r; + r = ((glWindowPos3iARB = (PFNGLWINDOWPOS3IARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iARB")) == NULL) || r; + r = ((glWindowPos3ivARB = (PFNGLWINDOWPOS3IVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivARB")) == NULL) || r; + r = ((glWindowPos3sARB = (PFNGLWINDOWPOS3SARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sARB")) == NULL) || r; + r = ((glWindowPos3svARB = (PFNGLWINDOWPOS3SVARBPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svARB")) == NULL) || r; + + return r; +} + +#endif /* GL_ARB_window_pos */ + +#ifdef GL_ATIX_point_sprites + +#endif /* GL_ATIX_point_sprites */ + +#ifdef GL_ATIX_texture_env_combine3 + +#endif /* GL_ATIX_texture_env_combine3 */ + +#ifdef GL_ATIX_texture_env_route + +#endif /* GL_ATIX_texture_env_route */ + +#ifdef GL_ATIX_vertex_shader_output_point_size + +#endif /* GL_ATIX_vertex_shader_output_point_size */ + +#ifdef GL_ATI_draw_buffers + +static GLboolean _glewInit_GL_ATI_draw_buffers (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC)glewGetProcAddress((const GLubyte*)"glDrawBuffersATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_draw_buffers */ + +#ifdef GL_ATI_element_array + +static GLboolean _glewInit_GL_ATI_element_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawElementArrayATI = (PFNGLDRAWELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawElementArrayATI")) == NULL) || r; + r = ((glDrawRangeElementArrayATI = (PFNGLDRAWRANGEELEMENTARRAYATIPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementArrayATI")) == NULL) || r; + r = ((glElementPointerATI = (PFNGLELEMENTPOINTERATIPROC)glewGetProcAddress((const GLubyte*)"glElementPointerATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_element_array */ + +#ifdef GL_ATI_envmap_bumpmap + +static GLboolean _glewInit_GL_ATI_envmap_bumpmap (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTexBumpParameterfvATI = (PFNGLGETTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterfvATI")) == NULL) || r; + r = ((glGetTexBumpParameterivATI = (PFNGLGETTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetTexBumpParameterivATI")) == NULL) || r; + r = ((glTexBumpParameterfvATI = (PFNGLTEXBUMPPARAMETERFVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterfvATI")) == NULL) || r; + r = ((glTexBumpParameterivATI = (PFNGLTEXBUMPPARAMETERIVATIPROC)glewGetProcAddress((const GLubyte*)"glTexBumpParameterivATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_envmap_bumpmap */ + +#ifdef GL_ATI_fragment_shader + +static GLboolean _glewInit_GL_ATI_fragment_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAlphaFragmentOp1ATI = (PFNGLALPHAFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp1ATI")) == NULL) || r; + r = ((glAlphaFragmentOp2ATI = (PFNGLALPHAFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp2ATI")) == NULL) || r; + r = ((glAlphaFragmentOp3ATI = (PFNGLALPHAFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glAlphaFragmentOp3ATI")) == NULL) || r; + r = ((glBeginFragmentShaderATI = (PFNGLBEGINFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBeginFragmentShaderATI")) == NULL) || r; + r = ((glBindFragmentShaderATI = (PFNGLBINDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glBindFragmentShaderATI")) == NULL) || r; + r = ((glColorFragmentOp1ATI = (PFNGLCOLORFRAGMENTOP1ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp1ATI")) == NULL) || r; + r = ((glColorFragmentOp2ATI = (PFNGLCOLORFRAGMENTOP2ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp2ATI")) == NULL) || r; + r = ((glColorFragmentOp3ATI = (PFNGLCOLORFRAGMENTOP3ATIPROC)glewGetProcAddress((const GLubyte*)"glColorFragmentOp3ATI")) == NULL) || r; + r = ((glDeleteFragmentShaderATI = (PFNGLDELETEFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glDeleteFragmentShaderATI")) == NULL) || r; + r = ((glEndFragmentShaderATI = (PFNGLENDFRAGMENTSHADERATIPROC)glewGetProcAddress((const GLubyte*)"glEndFragmentShaderATI")) == NULL) || r; + r = ((glGenFragmentShadersATI = (PFNGLGENFRAGMENTSHADERSATIPROC)glewGetProcAddress((const GLubyte*)"glGenFragmentShadersATI")) == NULL) || r; + r = ((glPassTexCoordATI = (PFNGLPASSTEXCOORDATIPROC)glewGetProcAddress((const GLubyte*)"glPassTexCoordATI")) == NULL) || r; + r = ((glSampleMapATI = (PFNGLSAMPLEMAPATIPROC)glewGetProcAddress((const GLubyte*)"glSampleMapATI")) == NULL) || r; + r = ((glSetFragmentShaderConstantATI = (PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)glewGetProcAddress((const GLubyte*)"glSetFragmentShaderConstantATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_fragment_shader */ + +#ifdef GL_ATI_map_object_buffer + +static GLboolean _glewInit_GL_ATI_map_object_buffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMapObjectBufferATI = (PFNGLMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glMapObjectBufferATI")) == NULL) || r; + r = ((glUnmapObjectBufferATI = (PFNGLUNMAPOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUnmapObjectBufferATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_map_object_buffer */ + +#ifdef GL_ATI_pn_triangles + +static GLboolean _glewInit_GL_ATI_pn_triangles (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPNTrianglesfATI = (PFNGLPNTRIANGLESFATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesfATI")) == NULL) || r; + r = ((glPNTrianglesiATI = (PFNGLPNTRIANGLESIATIPROC)glewGetProcAddress((const GLubyte*)"glPNTrianglesiATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_pn_triangles */ + +#ifdef GL_ATI_separate_stencil + +static GLboolean _glewInit_GL_ATI_separate_stencil (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glStencilFuncSeparateATI = (PFNGLSTENCILFUNCSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilFuncSeparateATI")) == NULL) || r; + r = ((glStencilOpSeparateATI = (PFNGLSTENCILOPSEPARATEATIPROC)glewGetProcAddress((const GLubyte*)"glStencilOpSeparateATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_separate_stencil */ + +#ifdef GL_ATI_text_fragment_shader + +#endif /* GL_ATI_text_fragment_shader */ + +#ifdef GL_ATI_texture_compression_3dc + +#endif /* GL_ATI_texture_compression_3dc */ + +#ifdef GL_ATI_texture_env_combine3 + +#endif /* GL_ATI_texture_env_combine3 */ + +#ifdef GL_ATI_texture_float + +#endif /* GL_ATI_texture_float */ + +#ifdef GL_ATI_texture_mirror_once + +#endif /* GL_ATI_texture_mirror_once */ + +#ifdef GL_ATI_vertex_array_object + +static GLboolean _glewInit_GL_ATI_vertex_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glArrayObjectATI = (PFNGLARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glArrayObjectATI")) == NULL) || r; + r = ((glFreeObjectBufferATI = (PFNGLFREEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glFreeObjectBufferATI")) == NULL) || r; + r = ((glGetArrayObjectfvATI = (PFNGLGETARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectfvATI")) == NULL) || r; + r = ((glGetArrayObjectivATI = (PFNGLGETARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetArrayObjectivATI")) == NULL) || r; + r = ((glGetObjectBufferfvATI = (PFNGLGETOBJECTBUFFERFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferfvATI")) == NULL) || r; + r = ((glGetObjectBufferivATI = (PFNGLGETOBJECTBUFFERIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetObjectBufferivATI")) == NULL) || r; + r = ((glGetVariantArrayObjectfvATI = (PFNGLGETVARIANTARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectfvATI")) == NULL) || r; + r = ((glGetVariantArrayObjectivATI = (PFNGLGETVARIANTARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVariantArrayObjectivATI")) == NULL) || r; + r = ((glIsObjectBufferATI = (PFNGLISOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glIsObjectBufferATI")) == NULL) || r; + r = ((glNewObjectBufferATI = (PFNGLNEWOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glNewObjectBufferATI")) == NULL) || r; + r = ((glUpdateObjectBufferATI = (PFNGLUPDATEOBJECTBUFFERATIPROC)glewGetProcAddress((const GLubyte*)"glUpdateObjectBufferATI")) == NULL) || r; + r = ((glVariantArrayObjectATI = (PFNGLVARIANTARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVariantArrayObjectATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_vertex_array_object */ + +#ifdef GL_ATI_vertex_attrib_array_object + +static GLboolean _glewInit_GL_ATI_vertex_attrib_array_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetVertexAttribArrayObjectfvATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectfvATI")) == NULL) || r; + r = ((glGetVertexAttribArrayObjectivATI = (PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribArrayObjectivATI")) == NULL) || r; + r = ((glVertexAttribArrayObjectATI = (PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribArrayObjectATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_vertex_attrib_array_object */ + +#ifdef GL_ATI_vertex_streams + +static GLboolean _glewInit_GL_ATI_vertex_streams (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glClientActiveVertexStreamATI = (PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC)glewGetProcAddress((const GLubyte*)"glClientActiveVertexStreamATI")) == NULL) || r; + r = ((glNormalStream3bATI = (PFNGLNORMALSTREAM3BATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bATI")) == NULL) || r; + r = ((glNormalStream3bvATI = (PFNGLNORMALSTREAM3BVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3bvATI")) == NULL) || r; + r = ((glNormalStream3dATI = (PFNGLNORMALSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dATI")) == NULL) || r; + r = ((glNormalStream3dvATI = (PFNGLNORMALSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3dvATI")) == NULL) || r; + r = ((glNormalStream3fATI = (PFNGLNORMALSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fATI")) == NULL) || r; + r = ((glNormalStream3fvATI = (PFNGLNORMALSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3fvATI")) == NULL) || r; + r = ((glNormalStream3iATI = (PFNGLNORMALSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3iATI")) == NULL) || r; + r = ((glNormalStream3ivATI = (PFNGLNORMALSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3ivATI")) == NULL) || r; + r = ((glNormalStream3sATI = (PFNGLNORMALSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3sATI")) == NULL) || r; + r = ((glNormalStream3svATI = (PFNGLNORMALSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glNormalStream3svATI")) == NULL) || r; + r = ((glVertexBlendEnvfATI = (PFNGLVERTEXBLENDENVFATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnvfATI")) == NULL) || r; + r = ((glVertexBlendEnviATI = (PFNGLVERTEXBLENDENVIATIPROC)glewGetProcAddress((const GLubyte*)"glVertexBlendEnviATI")) == NULL) || r; + r = ((glVertexStream2dATI = (PFNGLVERTEXSTREAM2DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dATI")) == NULL) || r; + r = ((glVertexStream2dvATI = (PFNGLVERTEXSTREAM2DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2dvATI")) == NULL) || r; + r = ((glVertexStream2fATI = (PFNGLVERTEXSTREAM2FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fATI")) == NULL) || r; + r = ((glVertexStream2fvATI = (PFNGLVERTEXSTREAM2FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2fvATI")) == NULL) || r; + r = ((glVertexStream2iATI = (PFNGLVERTEXSTREAM2IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2iATI")) == NULL) || r; + r = ((glVertexStream2ivATI = (PFNGLVERTEXSTREAM2IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2ivATI")) == NULL) || r; + r = ((glVertexStream2sATI = (PFNGLVERTEXSTREAM2SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2sATI")) == NULL) || r; + r = ((glVertexStream2svATI = (PFNGLVERTEXSTREAM2SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream2svATI")) == NULL) || r; + r = ((glVertexStream3dATI = (PFNGLVERTEXSTREAM3DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dATI")) == NULL) || r; + r = ((glVertexStream3dvATI = (PFNGLVERTEXSTREAM3DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3dvATI")) == NULL) || r; + r = ((glVertexStream3fATI = (PFNGLVERTEXSTREAM3FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fATI")) == NULL) || r; + r = ((glVertexStream3fvATI = (PFNGLVERTEXSTREAM3FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3fvATI")) == NULL) || r; + r = ((glVertexStream3iATI = (PFNGLVERTEXSTREAM3IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3iATI")) == NULL) || r; + r = ((glVertexStream3ivATI = (PFNGLVERTEXSTREAM3IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3ivATI")) == NULL) || r; + r = ((glVertexStream3sATI = (PFNGLVERTEXSTREAM3SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3sATI")) == NULL) || r; + r = ((glVertexStream3svATI = (PFNGLVERTEXSTREAM3SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream3svATI")) == NULL) || r; + r = ((glVertexStream4dATI = (PFNGLVERTEXSTREAM4DATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dATI")) == NULL) || r; + r = ((glVertexStream4dvATI = (PFNGLVERTEXSTREAM4DVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4dvATI")) == NULL) || r; + r = ((glVertexStream4fATI = (PFNGLVERTEXSTREAM4FATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fATI")) == NULL) || r; + r = ((glVertexStream4fvATI = (PFNGLVERTEXSTREAM4FVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4fvATI")) == NULL) || r; + r = ((glVertexStream4iATI = (PFNGLVERTEXSTREAM4IATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4iATI")) == NULL) || r; + r = ((glVertexStream4ivATI = (PFNGLVERTEXSTREAM4IVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4ivATI")) == NULL) || r; + r = ((glVertexStream4sATI = (PFNGLVERTEXSTREAM4SATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4sATI")) == NULL) || r; + r = ((glVertexStream4svATI = (PFNGLVERTEXSTREAM4SVATIPROC)glewGetProcAddress((const GLubyte*)"glVertexStream4svATI")) == NULL) || r; + + return r; +} + +#endif /* GL_ATI_vertex_streams */ + +#ifdef GL_EXT_422_pixels + +#endif /* GL_EXT_422_pixels */ + +#ifdef GL_EXT_Cg_shader + +#endif /* GL_EXT_Cg_shader */ + +#ifdef GL_EXT_abgr + +#endif /* GL_EXT_abgr */ + +#ifdef GL_EXT_bgra + +#endif /* GL_EXT_bgra */ + +#ifdef GL_EXT_blend_color + +static GLboolean _glewInit_GL_EXT_blend_color (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendColorEXT = (PFNGLBLENDCOLOREXTPROC)glewGetProcAddress((const GLubyte*)"glBlendColorEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_color */ + +#ifdef GL_EXT_blend_equation_separate + +static GLboolean _glewInit_GL_EXT_blend_equation_separate (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationSeparateEXT = (PFNGLBLENDEQUATIONSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparateEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_equation_separate */ + +#ifdef GL_EXT_blend_func_separate + +static GLboolean _glewInit_GL_EXT_blend_func_separate (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendFuncSeparateEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_func_separate */ + +#ifdef GL_EXT_blend_logic_op + +#endif /* GL_EXT_blend_logic_op */ + +#ifdef GL_EXT_blend_minmax + +static GLboolean _glewInit_GL_EXT_blend_minmax (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_blend_minmax */ + +#ifdef GL_EXT_blend_subtract + +#endif /* GL_EXT_blend_subtract */ + +#ifdef GL_EXT_clip_volume_hint + +#endif /* GL_EXT_clip_volume_hint */ + +#ifdef GL_EXT_cmyka + +#endif /* GL_EXT_cmyka */ + +#ifdef GL_EXT_color_subtable + +static GLboolean _glewInit_GL_EXT_color_subtable (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorSubTableEXT = (PFNGLCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorSubTableEXT")) == NULL) || r; + r = ((glCopyColorSubTableEXT = (PFNGLCOPYCOLORSUBTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyColorSubTableEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_color_subtable */ + +#ifdef GL_EXT_compiled_vertex_array + +static GLboolean _glewInit_GL_EXT_compiled_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glLockArraysEXT = (PFNGLLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glLockArraysEXT")) == NULL) || r; + r = ((glUnlockArraysEXT = (PFNGLUNLOCKARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glUnlockArraysEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_compiled_vertex_array */ + +#ifdef GL_EXT_convolution + +static GLboolean _glewInit_GL_EXT_convolution (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glConvolutionFilter1DEXT = (PFNGLCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter1DEXT")) == NULL) || r; + r = ((glConvolutionFilter2DEXT = (PFNGLCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionFilter2DEXT")) == NULL) || r; + r = ((glConvolutionParameterfEXT = (PFNGLCONVOLUTIONPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfEXT")) == NULL) || r; + r = ((glConvolutionParameterfvEXT = (PFNGLCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterfvEXT")) == NULL) || r; + r = ((glConvolutionParameteriEXT = (PFNGLCONVOLUTIONPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameteriEXT")) == NULL) || r; + r = ((glConvolutionParameterivEXT = (PFNGLCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glConvolutionParameterivEXT")) == NULL) || r; + r = ((glCopyConvolutionFilter1DEXT = (PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter1DEXT")) == NULL) || r; + r = ((glCopyConvolutionFilter2DEXT = (PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyConvolutionFilter2DEXT")) == NULL) || r; + r = ((glGetConvolutionFilterEXT = (PFNGLGETCONVOLUTIONFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionFilterEXT")) == NULL) || r; + r = ((glGetConvolutionParameterfvEXT = (PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterfvEXT")) == NULL) || r; + r = ((glGetConvolutionParameterivEXT = (PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetConvolutionParameterivEXT")) == NULL) || r; + r = ((glGetSeparableFilterEXT = (PFNGLGETSEPARABLEFILTEREXTPROC)glewGetProcAddress((const GLubyte*)"glGetSeparableFilterEXT")) == NULL) || r; + r = ((glSeparableFilter2DEXT = (PFNGLSEPARABLEFILTER2DEXTPROC)glewGetProcAddress((const GLubyte*)"glSeparableFilter2DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_convolution */ + +#ifdef GL_EXT_coordinate_frame + +static GLboolean _glewInit_GL_EXT_coordinate_frame (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBinormalPointerEXT = (PFNGLBINORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glBinormalPointerEXT")) == NULL) || r; + r = ((glTangentPointerEXT = (PFNGLTANGENTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTangentPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_coordinate_frame */ + +#ifdef GL_EXT_copy_texture + +static GLboolean _glewInit_GL_EXT_copy_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCopyTexImage1DEXT = (PFNGLCOPYTEXIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage1DEXT")) == NULL) || r; + r = ((glCopyTexImage2DEXT = (PFNGLCOPYTEXIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexImage2DEXT")) == NULL) || r; + r = ((glCopyTexSubImage1DEXT = (PFNGLCOPYTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage1DEXT")) == NULL) || r; + r = ((glCopyTexSubImage2DEXT = (PFNGLCOPYTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage2DEXT")) == NULL) || r; + r = ((glCopyTexSubImage3DEXT = (PFNGLCOPYTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glCopyTexSubImage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_copy_texture */ + +#ifdef GL_EXT_cull_vertex + +static GLboolean _glewInit_GL_EXT_cull_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCullParameterdvEXT = (PFNGLCULLPARAMETERDVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterdvEXT")) == NULL) || r; + r = ((glCullParameterfvEXT = (PFNGLCULLPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glCullParameterfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_cull_vertex */ + +#ifdef GL_EXT_depth_bounds_test + +static GLboolean _glewInit_GL_EXT_depth_bounds_test (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDepthBoundsEXT = (PFNGLDEPTHBOUNDSEXTPROC)glewGetProcAddress((const GLubyte*)"glDepthBoundsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_depth_bounds_test */ + +#ifdef GL_EXT_draw_range_elements + +static GLboolean _glewInit_GL_EXT_draw_range_elements (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDrawRangeElementsEXT = (PFNGLDRAWRANGEELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawRangeElementsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_draw_range_elements */ + +#ifdef GL_EXT_fog_coord + +static GLboolean _glewInit_GL_EXT_fog_coord (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerEXT")) == NULL) || r; + r = ((glFogCoorddEXT = (PFNGLFOGCOORDDEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddEXT")) == NULL) || r; + r = ((glFogCoorddvEXT = (PFNGLFOGCOORDDVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoorddvEXT")) == NULL) || r; + r = ((glFogCoordfEXT = (PFNGLFOGCOORDFEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfEXT")) == NULL) || r; + r = ((glFogCoordfvEXT = (PFNGLFOGCOORDFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFogCoordfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_fog_coord */ + +#ifdef GL_EXT_fragment_lighting + +static GLboolean _glewInit_GL_EXT_fragment_lighting (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFragmentColorMaterialEXT = (PFNGLFRAGMENTCOLORMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialEXT")) == NULL) || r; + r = ((glFragmentLightModelfEXT = (PFNGLFRAGMENTLIGHTMODELFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfEXT")) == NULL) || r; + r = ((glFragmentLightModelfvEXT = (PFNGLFRAGMENTLIGHTMODELFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvEXT")) == NULL) || r; + r = ((glFragmentLightModeliEXT = (PFNGLFRAGMENTLIGHTMODELIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliEXT")) == NULL) || r; + r = ((glFragmentLightModelivEXT = (PFNGLFRAGMENTLIGHTMODELIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivEXT")) == NULL) || r; + r = ((glFragmentLightfEXT = (PFNGLFRAGMENTLIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfEXT")) == NULL) || r; + r = ((glFragmentLightfvEXT = (PFNGLFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvEXT")) == NULL) || r; + r = ((glFragmentLightiEXT = (PFNGLFRAGMENTLIGHTIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiEXT")) == NULL) || r; + r = ((glFragmentLightivEXT = (PFNGLFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivEXT")) == NULL) || r; + r = ((glFragmentMaterialfEXT = (PFNGLFRAGMENTMATERIALFEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfEXT")) == NULL) || r; + r = ((glFragmentMaterialfvEXT = (PFNGLFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvEXT")) == NULL) || r; + r = ((glFragmentMaterialiEXT = (PFNGLFRAGMENTMATERIALIEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiEXT")) == NULL) || r; + r = ((glFragmentMaterialivEXT = (PFNGLFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivEXT")) == NULL) || r; + r = ((glGetFragmentLightfvEXT = (PFNGLGETFRAGMENTLIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvEXT")) == NULL) || r; + r = ((glGetFragmentLightivEXT = (PFNGLGETFRAGMENTLIGHTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivEXT")) == NULL) || r; + r = ((glGetFragmentMaterialfvEXT = (PFNGLGETFRAGMENTMATERIALFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvEXT")) == NULL) || r; + r = ((glGetFragmentMaterialivEXT = (PFNGLGETFRAGMENTMATERIALIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivEXT")) == NULL) || r; + r = ((glLightEnviEXT = (PFNGLLIGHTENVIEXTPROC)glewGetProcAddress((const GLubyte*)"glLightEnviEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_fragment_lighting */ + +#ifdef GL_EXT_framebuffer_blit + +static GLboolean _glewInit_GL_EXT_framebuffer_blit (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBlitFramebufferEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_blit */ + +#ifdef GL_EXT_framebuffer_multisample + +static GLboolean _glewInit_GL_EXT_framebuffer_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageMultisampleEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_multisample */ + +#ifdef GL_EXT_framebuffer_object + +static GLboolean _glewInit_GL_EXT_framebuffer_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindFramebufferEXT")) == NULL) || r; + r = ((glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindRenderbufferEXT")) == NULL) || r; + r = ((glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)glewGetProcAddress((const GLubyte*)"glCheckFramebufferStatusEXT")) == NULL) || r; + r = ((glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteFramebuffersEXT")) == NULL) || r; + r = ((glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteRenderbuffersEXT")) == NULL) || r; + r = ((glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferRenderbufferEXT")) == NULL) || r; + r = ((glFramebufferTexture1DEXT = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture1DEXT")) == NULL) || r; + r = ((glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture2DEXT")) == NULL) || r; + r = ((glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glFramebufferTexture3DEXT")) == NULL) || r; + r = ((glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenFramebuffersEXT")) == NULL) || r; + r = ((glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenRenderbuffersEXT")) == NULL) || r; + r = ((glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)glewGetProcAddress((const GLubyte*)"glGenerateMipmapEXT")) == NULL) || r; + r = ((glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetFramebufferAttachmentParameterivEXT")) == NULL) || r; + r = ((glGetRenderbufferParameterivEXT = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetRenderbufferParameterivEXT")) == NULL) || r; + r = ((glIsFramebufferEXT = (PFNGLISFRAMEBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsFramebufferEXT")) == NULL) || r; + r = ((glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"glIsRenderbufferEXT")) == NULL) || r; + r = ((glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)glewGetProcAddress((const GLubyte*)"glRenderbufferStorageEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_framebuffer_object */ + +#ifdef GL_EXT_histogram + +static GLboolean _glewInit_GL_EXT_histogram (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetHistogramEXT = (PFNGLGETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramEXT")) == NULL) || r; + r = ((glGetHistogramParameterfvEXT = (PFNGLGETHISTOGRAMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterfvEXT")) == NULL) || r; + r = ((glGetHistogramParameterivEXT = (PFNGLGETHISTOGRAMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetHistogramParameterivEXT")) == NULL) || r; + r = ((glGetMinmaxEXT = (PFNGLGETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxEXT")) == NULL) || r; + r = ((glGetMinmaxParameterfvEXT = (PFNGLGETMINMAXPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterfvEXT")) == NULL) || r; + r = ((glGetMinmaxParameterivEXT = (PFNGLGETMINMAXPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetMinmaxParameterivEXT")) == NULL) || r; + r = ((glHistogramEXT = (PFNGLHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glHistogramEXT")) == NULL) || r; + r = ((glMinmaxEXT = (PFNGLMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glMinmaxEXT")) == NULL) || r; + r = ((glResetHistogramEXT = (PFNGLRESETHISTOGRAMEXTPROC)glewGetProcAddress((const GLubyte*)"glResetHistogramEXT")) == NULL) || r; + r = ((glResetMinmaxEXT = (PFNGLRESETMINMAXEXTPROC)glewGetProcAddress((const GLubyte*)"glResetMinmaxEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_histogram */ + +#ifdef GL_EXT_index_array_formats + +#endif /* GL_EXT_index_array_formats */ + +#ifdef GL_EXT_index_func + +static GLboolean _glewInit_GL_EXT_index_func (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glIndexFuncEXT = (PFNGLINDEXFUNCEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexFuncEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_index_func */ + +#ifdef GL_EXT_index_material + +static GLboolean _glewInit_GL_EXT_index_material (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glIndexMaterialEXT = (PFNGLINDEXMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glIndexMaterialEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_index_material */ + +#ifdef GL_EXT_index_texture + +#endif /* GL_EXT_index_texture */ + +#ifdef GL_EXT_light_texture + +static GLboolean _glewInit_GL_EXT_light_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glApplyTextureEXT = (PFNGLAPPLYTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glApplyTextureEXT")) == NULL) || r; + r = ((glTextureLightEXT = (PFNGLTEXTURELIGHTEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureLightEXT")) == NULL) || r; + r = ((glTextureMaterialEXT = (PFNGLTEXTUREMATERIALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureMaterialEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_light_texture */ + +#ifdef GL_EXT_misc_attribute + +#endif /* GL_EXT_misc_attribute */ + +#ifdef GL_EXT_multi_draw_arrays + +static GLboolean _glewInit_GL_EXT_multi_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawArraysEXT")) == NULL) || r; + r = ((glMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC)glewGetProcAddress((const GLubyte*)"glMultiDrawElementsEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_multi_draw_arrays */ + +#ifdef GL_EXT_multisample + +static GLboolean _glewInit_GL_EXT_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSampleMaskEXT = (PFNGLSAMPLEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskEXT")) == NULL) || r; + r = ((glSamplePatternEXT = (PFNGLSAMPLEPATTERNEXTPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_multisample */ + +#ifdef GL_EXT_packed_depth_stencil + +#endif /* GL_EXT_packed_depth_stencil */ + +#ifdef GL_EXT_packed_pixels + +#endif /* GL_EXT_packed_pixels */ + +#ifdef GL_EXT_paletted_texture + +static GLboolean _glewInit_GL_EXT_paletted_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glColorTableEXT")) == NULL) || r; + r = ((glGetColorTableEXT = (PFNGLGETCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableEXT")) == NULL) || r; + r = ((glGetColorTableParameterfvEXT = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvEXT")) == NULL) || r; + r = ((glGetColorTableParameterivEXT = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_paletted_texture */ + +#ifdef GL_EXT_pixel_buffer_object + +#endif /* GL_EXT_pixel_buffer_object */ + +#ifdef GL_EXT_pixel_transform + +static GLboolean _glewInit_GL_EXT_pixel_transform (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetPixelTransformParameterfvEXT = (PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterfvEXT")) == NULL) || r; + r = ((glGetPixelTransformParameterivEXT = (PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPixelTransformParameterivEXT")) == NULL) || r; + r = ((glPixelTransformParameterfEXT = (PFNGLPIXELTRANSFORMPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfEXT")) == NULL) || r; + r = ((glPixelTransformParameterfvEXT = (PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterfvEXT")) == NULL) || r; + r = ((glPixelTransformParameteriEXT = (PFNGLPIXELTRANSFORMPARAMETERIEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameteriEXT")) == NULL) || r; + r = ((glPixelTransformParameterivEXT = (PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC)glewGetProcAddress((const GLubyte*)"glPixelTransformParameterivEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_pixel_transform */ + +#ifdef GL_EXT_pixel_transform_color_table + +#endif /* GL_EXT_pixel_transform_color_table */ + +#ifdef GL_EXT_point_parameters + +static GLboolean _glewInit_GL_EXT_point_parameters (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfEXT")) == NULL) || r; + r = ((glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)glewGetProcAddress((const GLubyte*)"glPointParameterfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_point_parameters */ + +#ifdef GL_EXT_polygon_offset + +static GLboolean _glewInit_GL_EXT_polygon_offset (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPolygonOffsetEXT = (PFNGLPOLYGONOFFSETEXTPROC)glewGetProcAddress((const GLubyte*)"glPolygonOffsetEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_polygon_offset */ + +#ifdef GL_EXT_rescale_normal + +#endif /* GL_EXT_rescale_normal */ + +#ifdef GL_EXT_scene_marker + +static GLboolean _glewInit_GL_EXT_scene_marker (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginSceneEXT = (PFNGLBEGINSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glBeginSceneEXT")) == NULL) || r; + r = ((glEndSceneEXT = (PFNGLENDSCENEEXTPROC)glewGetProcAddress((const GLubyte*)"glEndSceneEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_scene_marker */ + +#ifdef GL_EXT_secondary_color + +static GLboolean _glewInit_GL_EXT_secondary_color (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSecondaryColor3bEXT = (PFNGLSECONDARYCOLOR3BEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bEXT")) == NULL) || r; + r = ((glSecondaryColor3bvEXT = (PFNGLSECONDARYCOLOR3BVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3bvEXT")) == NULL) || r; + r = ((glSecondaryColor3dEXT = (PFNGLSECONDARYCOLOR3DEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dEXT")) == NULL) || r; + r = ((glSecondaryColor3dvEXT = (PFNGLSECONDARYCOLOR3DVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3dvEXT")) == NULL) || r; + r = ((glSecondaryColor3fEXT = (PFNGLSECONDARYCOLOR3FEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fEXT")) == NULL) || r; + r = ((glSecondaryColor3fvEXT = (PFNGLSECONDARYCOLOR3FVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3fvEXT")) == NULL) || r; + r = ((glSecondaryColor3iEXT = (PFNGLSECONDARYCOLOR3IEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3iEXT")) == NULL) || r; + r = ((glSecondaryColor3ivEXT = (PFNGLSECONDARYCOLOR3IVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ivEXT")) == NULL) || r; + r = ((glSecondaryColor3sEXT = (PFNGLSECONDARYCOLOR3SEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3sEXT")) == NULL) || r; + r = ((glSecondaryColor3svEXT = (PFNGLSECONDARYCOLOR3SVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3svEXT")) == NULL) || r; + r = ((glSecondaryColor3ubEXT = (PFNGLSECONDARYCOLOR3UBEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubEXT")) == NULL) || r; + r = ((glSecondaryColor3ubvEXT = (PFNGLSECONDARYCOLOR3UBVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3ubvEXT")) == NULL) || r; + r = ((glSecondaryColor3uiEXT = (PFNGLSECONDARYCOLOR3UIEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uiEXT")) == NULL) || r; + r = ((glSecondaryColor3uivEXT = (PFNGLSECONDARYCOLOR3UIVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3uivEXT")) == NULL) || r; + r = ((glSecondaryColor3usEXT = (PFNGLSECONDARYCOLOR3USEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usEXT")) == NULL) || r; + r = ((glSecondaryColor3usvEXT = (PFNGLSECONDARYCOLOR3USVEXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3usvEXT")) == NULL) || r; + r = ((glSecondaryColorPointerEXT = (PFNGLSECONDARYCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_secondary_color */ + +#ifdef GL_EXT_separate_specular_color + +#endif /* GL_EXT_separate_specular_color */ + +#ifdef GL_EXT_shadow_funcs + +#endif /* GL_EXT_shadow_funcs */ + +#ifdef GL_EXT_shared_texture_palette + +#endif /* GL_EXT_shared_texture_palette */ + +#ifdef GL_EXT_stencil_clear_tag + +#endif /* GL_EXT_stencil_clear_tag */ + +#ifdef GL_EXT_stencil_two_side + +static GLboolean _glewInit_GL_EXT_stencil_two_side (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glActiveStencilFaceEXT = (PFNGLACTIVESTENCILFACEEXTPROC)glewGetProcAddress((const GLubyte*)"glActiveStencilFaceEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_stencil_two_side */ + +#ifdef GL_EXT_stencil_wrap + +#endif /* GL_EXT_stencil_wrap */ + +#ifdef GL_EXT_subtexture + +static GLboolean _glewInit_GL_EXT_subtexture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexSubImage1DEXT = (PFNGLTEXSUBIMAGE1DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage1DEXT")) == NULL) || r; + r = ((glTexSubImage2DEXT = (PFNGLTEXSUBIMAGE2DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage2DEXT")) == NULL) || r; + r = ((glTexSubImage3DEXT = (PFNGLTEXSUBIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_subtexture */ + +#ifdef GL_EXT_texture + +#endif /* GL_EXT_texture */ + +#ifdef GL_EXT_texture3D + +static GLboolean _glewInit_GL_EXT_texture3D (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexImage3DEXT = (PFNGLTEXIMAGE3DEXTPROC)glewGetProcAddress((const GLubyte*)"glTexImage3DEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture3D */ + +#ifdef GL_EXT_texture_compression_dxt1 + +#endif /* GL_EXT_texture_compression_dxt1 */ + +#ifdef GL_EXT_texture_compression_s3tc + +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifdef GL_EXT_texture_cube_map + +#endif /* GL_EXT_texture_cube_map */ + +#ifdef GL_EXT_texture_edge_clamp + +#endif /* GL_EXT_texture_edge_clamp */ + +#ifdef GL_EXT_texture_env + +#endif /* GL_EXT_texture_env */ + +#ifdef GL_EXT_texture_env_add + +#endif /* GL_EXT_texture_env_add */ + +#ifdef GL_EXT_texture_env_combine + +#endif /* GL_EXT_texture_env_combine */ + +#ifdef GL_EXT_texture_env_dot3 + +#endif /* GL_EXT_texture_env_dot3 */ + +#ifdef GL_EXT_texture_filter_anisotropic + +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifdef GL_EXT_texture_lod_bias + +#endif /* GL_EXT_texture_lod_bias */ + +#ifdef GL_EXT_texture_mirror_clamp + +#endif /* GL_EXT_texture_mirror_clamp */ + +#ifdef GL_EXT_texture_object + +static GLboolean _glewInit_GL_EXT_texture_object (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAreTexturesResidentEXT = (PFNGLARETEXTURESRESIDENTEXTPROC)glewGetProcAddress((const GLubyte*)"glAreTexturesResidentEXT")) == NULL) || r; + r = ((glBindTextureEXT = (PFNGLBINDTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureEXT")) == NULL) || r; + r = ((glDeleteTexturesEXT = (PFNGLDELETETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteTexturesEXT")) == NULL) || r; + r = ((glGenTexturesEXT = (PFNGLGENTEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glGenTexturesEXT")) == NULL) || r; + r = ((glIsTextureEXT = (PFNGLISTEXTUREEXTPROC)glewGetProcAddress((const GLubyte*)"glIsTextureEXT")) == NULL) || r; + r = ((glPrioritizeTexturesEXT = (PFNGLPRIORITIZETEXTURESEXTPROC)glewGetProcAddress((const GLubyte*)"glPrioritizeTexturesEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_object */ + +#ifdef GL_EXT_texture_perturb_normal + +static GLboolean _glewInit_GL_EXT_texture_perturb_normal (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureNormalEXT = (PFNGLTEXTURENORMALEXTPROC)glewGetProcAddress((const GLubyte*)"glTextureNormalEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_texture_perturb_normal */ + +#ifdef GL_EXT_texture_rectangle + +#endif /* GL_EXT_texture_rectangle */ + +#ifdef GL_EXT_texture_sRGB + +#endif /* GL_EXT_texture_sRGB */ + +#ifdef GL_EXT_vertex_array + +static GLboolean _glewInit_GL_EXT_vertex_array (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glArrayElementEXT = (PFNGLARRAYELEMENTEXTPROC)glewGetProcAddress((const GLubyte*)"glArrayElementEXT")) == NULL) || r; + r = ((glColorPointerEXT = (PFNGLCOLORPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glColorPointerEXT")) == NULL) || r; + r = ((glDrawArraysEXT = (PFNGLDRAWARRAYSEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawArraysEXT")) == NULL) || r; + r = ((glEdgeFlagPointerEXT = (PFNGLEDGEFLAGPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerEXT")) == NULL) || r; + r = ((glGetPointervEXT = (PFNGLGETPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetPointervEXT")) == NULL) || r; + r = ((glIndexPointerEXT = (PFNGLINDEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerEXT")) == NULL) || r; + r = ((glNormalPointerEXT = (PFNGLNORMALPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerEXT")) == NULL) || r; + r = ((glTexCoordPointerEXT = (PFNGLTEXCOORDPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerEXT")) == NULL) || r; + r = ((glVertexPointerEXT = (PFNGLVERTEXPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_array */ + +#ifdef GL_EXT_vertex_shader + +static GLboolean _glewInit_GL_EXT_vertex_shader (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginVertexShaderEXT = (PFNGLBEGINVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBeginVertexShaderEXT")) == NULL) || r; + r = ((glBindLightParameterEXT = (PFNGLBINDLIGHTPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindLightParameterEXT")) == NULL) || r; + r = ((glBindMaterialParameterEXT = (PFNGLBINDMATERIALPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindMaterialParameterEXT")) == NULL) || r; + r = ((glBindParameterEXT = (PFNGLBINDPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindParameterEXT")) == NULL) || r; + r = ((glBindTexGenParameterEXT = (PFNGLBINDTEXGENPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTexGenParameterEXT")) == NULL) || r; + r = ((glBindTextureUnitParameterEXT = (PFNGLBINDTEXTUREUNITPARAMETEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindTextureUnitParameterEXT")) == NULL) || r; + r = ((glBindVertexShaderEXT = (PFNGLBINDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glBindVertexShaderEXT")) == NULL) || r; + r = ((glDeleteVertexShaderEXT = (PFNGLDELETEVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteVertexShaderEXT")) == NULL) || r; + r = ((glDisableVariantClientStateEXT = (PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glDisableVariantClientStateEXT")) == NULL) || r; + r = ((glEnableVariantClientStateEXT = (PFNGLENABLEVARIANTCLIENTSTATEEXTPROC)glewGetProcAddress((const GLubyte*)"glEnableVariantClientStateEXT")) == NULL) || r; + r = ((glEndVertexShaderEXT = (PFNGLENDVERTEXSHADEREXTPROC)glewGetProcAddress((const GLubyte*)"glEndVertexShaderEXT")) == NULL) || r; + r = ((glExtractComponentEXT = (PFNGLEXTRACTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glExtractComponentEXT")) == NULL) || r; + r = ((glGenSymbolsEXT = (PFNGLGENSYMBOLSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenSymbolsEXT")) == NULL) || r; + r = ((glGenVertexShadersEXT = (PFNGLGENVERTEXSHADERSEXTPROC)glewGetProcAddress((const GLubyte*)"glGenVertexShadersEXT")) == NULL) || r; + r = ((glGetInvariantBooleanvEXT = (PFNGLGETINVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantBooleanvEXT")) == NULL) || r; + r = ((glGetInvariantFloatvEXT = (PFNGLGETINVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantFloatvEXT")) == NULL) || r; + r = ((glGetInvariantIntegervEXT = (PFNGLGETINVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetInvariantIntegervEXT")) == NULL) || r; + r = ((glGetLocalConstantBooleanvEXT = (PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantBooleanvEXT")) == NULL) || r; + r = ((glGetLocalConstantFloatvEXT = (PFNGLGETLOCALCONSTANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantFloatvEXT")) == NULL) || r; + r = ((glGetLocalConstantIntegervEXT = (PFNGLGETLOCALCONSTANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetLocalConstantIntegervEXT")) == NULL) || r; + r = ((glGetVariantBooleanvEXT = (PFNGLGETVARIANTBOOLEANVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantBooleanvEXT")) == NULL) || r; + r = ((glGetVariantFloatvEXT = (PFNGLGETVARIANTFLOATVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantFloatvEXT")) == NULL) || r; + r = ((glGetVariantIntegervEXT = (PFNGLGETVARIANTINTEGERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantIntegervEXT")) == NULL) || r; + r = ((glGetVariantPointervEXT = (PFNGLGETVARIANTPOINTERVEXTPROC)glewGetProcAddress((const GLubyte*)"glGetVariantPointervEXT")) == NULL) || r; + r = ((glInsertComponentEXT = (PFNGLINSERTCOMPONENTEXTPROC)glewGetProcAddress((const GLubyte*)"glInsertComponentEXT")) == NULL) || r; + r = ((glIsVariantEnabledEXT = (PFNGLISVARIANTENABLEDEXTPROC)glewGetProcAddress((const GLubyte*)"glIsVariantEnabledEXT")) == NULL) || r; + r = ((glSetInvariantEXT = (PFNGLSETINVARIANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetInvariantEXT")) == NULL) || r; + r = ((glSetLocalConstantEXT = (PFNGLSETLOCALCONSTANTEXTPROC)glewGetProcAddress((const GLubyte*)"glSetLocalConstantEXT")) == NULL) || r; + r = ((glShaderOp1EXT = (PFNGLSHADEROP1EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp1EXT")) == NULL) || r; + r = ((glShaderOp2EXT = (PFNGLSHADEROP2EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp2EXT")) == NULL) || r; + r = ((glShaderOp3EXT = (PFNGLSHADEROP3EXTPROC)glewGetProcAddress((const GLubyte*)"glShaderOp3EXT")) == NULL) || r; + r = ((glSwizzleEXT = (PFNGLSWIZZLEEXTPROC)glewGetProcAddress((const GLubyte*)"glSwizzleEXT")) == NULL) || r; + r = ((glVariantPointerEXT = (PFNGLVARIANTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVariantPointerEXT")) == NULL) || r; + r = ((glVariantbvEXT = (PFNGLVARIANTBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantbvEXT")) == NULL) || r; + r = ((glVariantdvEXT = (PFNGLVARIANTDVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantdvEXT")) == NULL) || r; + r = ((glVariantfvEXT = (PFNGLVARIANTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantfvEXT")) == NULL) || r; + r = ((glVariantivEXT = (PFNGLVARIANTIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantivEXT")) == NULL) || r; + r = ((glVariantsvEXT = (PFNGLVARIANTSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantsvEXT")) == NULL) || r; + r = ((glVariantubvEXT = (PFNGLVARIANTUBVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantubvEXT")) == NULL) || r; + r = ((glVariantuivEXT = (PFNGLVARIANTUIVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantuivEXT")) == NULL) || r; + r = ((glVariantusvEXT = (PFNGLVARIANTUSVEXTPROC)glewGetProcAddress((const GLubyte*)"glVariantusvEXT")) == NULL) || r; + r = ((glWriteMaskEXT = (PFNGLWRITEMASKEXTPROC)glewGetProcAddress((const GLubyte*)"glWriteMaskEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_shader */ + +#ifdef GL_EXT_vertex_weighting + +static GLboolean _glewInit_GL_EXT_vertex_weighting (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glVertexWeightPointerEXT = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightPointerEXT")) == NULL) || r; + r = ((glVertexWeightfEXT = (PFNGLVERTEXWEIGHTFEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfEXT")) == NULL) || r; + r = ((glVertexWeightfvEXT = (PFNGLVERTEXWEIGHTFVEXTPROC)glewGetProcAddress((const GLubyte*)"glVertexWeightfvEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_EXT_vertex_weighting */ + +#ifdef GL_GREMEDY_string_marker + +static GLboolean _glewInit_GL_GREMEDY_string_marker (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glStringMarkerGREMEDY = (PFNGLSTRINGMARKERGREMEDYPROC)glewGetProcAddress((const GLubyte*)"glStringMarkerGREMEDY")) == NULL) || r; + + return r; +} + +#endif /* GL_GREMEDY_string_marker */ + +#ifdef GL_HP_convolution_border_modes + +#endif /* GL_HP_convolution_border_modes */ + +#ifdef GL_HP_image_transform + +static GLboolean _glewInit_GL_HP_image_transform (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetImageTransformParameterfvHP = (PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterfvHP")) == NULL) || r; + r = ((glGetImageTransformParameterivHP = (PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glGetImageTransformParameterivHP")) == NULL) || r; + r = ((glImageTransformParameterfHP = (PFNGLIMAGETRANSFORMPARAMETERFHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfHP")) == NULL) || r; + r = ((glImageTransformParameterfvHP = (PFNGLIMAGETRANSFORMPARAMETERFVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterfvHP")) == NULL) || r; + r = ((glImageTransformParameteriHP = (PFNGLIMAGETRANSFORMPARAMETERIHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameteriHP")) == NULL) || r; + r = ((glImageTransformParameterivHP = (PFNGLIMAGETRANSFORMPARAMETERIVHPPROC)glewGetProcAddress((const GLubyte*)"glImageTransformParameterivHP")) == NULL) || r; + + return r; +} + +#endif /* GL_HP_image_transform */ + +#ifdef GL_HP_occlusion_test + +#endif /* GL_HP_occlusion_test */ + +#ifdef GL_HP_texture_lighting + +#endif /* GL_HP_texture_lighting */ + +#ifdef GL_IBM_cull_vertex + +#endif /* GL_IBM_cull_vertex */ + +#ifdef GL_IBM_multimode_draw_arrays + +static GLboolean _glewInit_GL_IBM_multimode_draw_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glMultiModeDrawArraysIBM = (PFNGLMULTIMODEDRAWARRAYSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawArraysIBM")) == NULL) || r; + r = ((glMultiModeDrawElementsIBM = (PFNGLMULTIMODEDRAWELEMENTSIBMPROC)glewGetProcAddress((const GLubyte*)"glMultiModeDrawElementsIBM")) == NULL) || r; + + return r; +} + +#endif /* GL_IBM_multimode_draw_arrays */ + +#ifdef GL_IBM_rasterpos_clip + +#endif /* GL_IBM_rasterpos_clip */ + +#ifdef GL_IBM_static_data + +#endif /* GL_IBM_static_data */ + +#ifdef GL_IBM_texture_mirrored_repeat + +#endif /* GL_IBM_texture_mirrored_repeat */ + +#ifdef GL_IBM_vertex_array_lists + +static GLboolean _glewInit_GL_IBM_vertex_array_lists (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorPointerListIBM = (PFNGLCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glColorPointerListIBM")) == NULL) || r; + r = ((glEdgeFlagPointerListIBM = (PFNGLEDGEFLAGPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glEdgeFlagPointerListIBM")) == NULL) || r; + r = ((glFogCoordPointerListIBM = (PFNGLFOGCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glFogCoordPointerListIBM")) == NULL) || r; + r = ((glIndexPointerListIBM = (PFNGLINDEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glIndexPointerListIBM")) == NULL) || r; + r = ((glNormalPointerListIBM = (PFNGLNORMALPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glNormalPointerListIBM")) == NULL) || r; + r = ((glSecondaryColorPointerListIBM = (PFNGLSECONDARYCOLORPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColorPointerListIBM")) == NULL) || r; + r = ((glTexCoordPointerListIBM = (PFNGLTEXCOORDPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointerListIBM")) == NULL) || r; + r = ((glVertexPointerListIBM = (PFNGLVERTEXPOINTERLISTIBMPROC)glewGetProcAddress((const GLubyte*)"glVertexPointerListIBM")) == NULL) || r; + + return r; +} + +#endif /* GL_IBM_vertex_array_lists */ + +#ifdef GL_INGR_color_clamp + +#endif /* GL_INGR_color_clamp */ + +#ifdef GL_INGR_interlace_read + +#endif /* GL_INGR_interlace_read */ + +#ifdef GL_INTEL_parallel_arrays + +static GLboolean _glewInit_GL_INTEL_parallel_arrays (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorPointervINTEL = (PFNGLCOLORPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glColorPointervINTEL")) == NULL) || r; + r = ((glNormalPointervINTEL = (PFNGLNORMALPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glNormalPointervINTEL")) == NULL) || r; + r = ((glTexCoordPointervINTEL = (PFNGLTEXCOORDPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glTexCoordPointervINTEL")) == NULL) || r; + r = ((glVertexPointervINTEL = (PFNGLVERTEXPOINTERVINTELPROC)glewGetProcAddress((const GLubyte*)"glVertexPointervINTEL")) == NULL) || r; + + return r; +} + +#endif /* GL_INTEL_parallel_arrays */ + +#ifdef GL_INTEL_texture_scissor + +static GLboolean _glewInit_GL_INTEL_texture_scissor (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexScissorFuncINTEL = (PFNGLTEXSCISSORFUNCINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorFuncINTEL")) == NULL) || r; + r = ((glTexScissorINTEL = (PFNGLTEXSCISSORINTELPROC)glewGetProcAddress((const GLubyte*)"glTexScissorINTEL")) == NULL) || r; + + return r; +} + +#endif /* GL_INTEL_texture_scissor */ + +#ifdef GL_KTX_buffer_region + +static GLboolean _glewInit_GL_KTX_buffer_region (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBufferRegionEnabledEXT = (PFNGLBUFFERREGIONENABLEDEXTPROC)glewGetProcAddress((const GLubyte*)"glBufferRegionEnabledEXT")) == NULL) || r; + r = ((glDeleteBufferRegionEXT = (PFNGLDELETEBUFFERREGIONEXTPROC)glewGetProcAddress((const GLubyte*)"glDeleteBufferRegionEXT")) == NULL) || r; + r = ((glDrawBufferRegionEXT = (PFNGLDRAWBUFFERREGIONEXTPROC)glewGetProcAddress((const GLubyte*)"glDrawBufferRegionEXT")) == NULL) || r; + r = ((glNewBufferRegionEXT = (PFNGLNEWBUFFERREGIONEXTPROC)glewGetProcAddress((const GLubyte*)"glNewBufferRegionEXT")) == NULL) || r; + r = ((glReadBufferRegionEXT = (PFNGLREADBUFFERREGIONEXTPROC)glewGetProcAddress((const GLubyte*)"glReadBufferRegionEXT")) == NULL) || r; + + return r; +} + +#endif /* GL_KTX_buffer_region */ + +#ifdef GL_MESAX_texture_stack + +#endif /* GL_MESAX_texture_stack */ + +#ifdef GL_MESA_pack_invert + +#endif /* GL_MESA_pack_invert */ + +#ifdef GL_MESA_resize_buffers + +static GLboolean _glewInit_GL_MESA_resize_buffers (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glResizeBuffersMESA = (PFNGLRESIZEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glResizeBuffersMESA")) == NULL) || r; + + return r; +} + +#endif /* GL_MESA_resize_buffers */ + +#ifdef GL_MESA_window_pos + +static GLboolean _glewInit_GL_MESA_window_pos (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glWindowPos2dMESA = (PFNGLWINDOWPOS2DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dMESA")) == NULL) || r; + r = ((glWindowPos2dvMESA = (PFNGLWINDOWPOS2DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2dvMESA")) == NULL) || r; + r = ((glWindowPos2fMESA = (PFNGLWINDOWPOS2FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fMESA")) == NULL) || r; + r = ((glWindowPos2fvMESA = (PFNGLWINDOWPOS2FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2fvMESA")) == NULL) || r; + r = ((glWindowPos2iMESA = (PFNGLWINDOWPOS2IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2iMESA")) == NULL) || r; + r = ((glWindowPos2ivMESA = (PFNGLWINDOWPOS2IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2ivMESA")) == NULL) || r; + r = ((glWindowPos2sMESA = (PFNGLWINDOWPOS2SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2sMESA")) == NULL) || r; + r = ((glWindowPos2svMESA = (PFNGLWINDOWPOS2SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos2svMESA")) == NULL) || r; + r = ((glWindowPos3dMESA = (PFNGLWINDOWPOS3DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dMESA")) == NULL) || r; + r = ((glWindowPos3dvMESA = (PFNGLWINDOWPOS3DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3dvMESA")) == NULL) || r; + r = ((glWindowPos3fMESA = (PFNGLWINDOWPOS3FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fMESA")) == NULL) || r; + r = ((glWindowPos3fvMESA = (PFNGLWINDOWPOS3FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3fvMESA")) == NULL) || r; + r = ((glWindowPos3iMESA = (PFNGLWINDOWPOS3IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3iMESA")) == NULL) || r; + r = ((glWindowPos3ivMESA = (PFNGLWINDOWPOS3IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3ivMESA")) == NULL) || r; + r = ((glWindowPos3sMESA = (PFNGLWINDOWPOS3SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3sMESA")) == NULL) || r; + r = ((glWindowPos3svMESA = (PFNGLWINDOWPOS3SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos3svMESA")) == NULL) || r; + r = ((glWindowPos4dMESA = (PFNGLWINDOWPOS4DMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dMESA")) == NULL) || r; + r = ((glWindowPos4dvMESA = (PFNGLWINDOWPOS4DVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4dvMESA")) == NULL) || r; + r = ((glWindowPos4fMESA = (PFNGLWINDOWPOS4FMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fMESA")) == NULL) || r; + r = ((glWindowPos4fvMESA = (PFNGLWINDOWPOS4FVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4fvMESA")) == NULL) || r; + r = ((glWindowPos4iMESA = (PFNGLWINDOWPOS4IMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4iMESA")) == NULL) || r; + r = ((glWindowPos4ivMESA = (PFNGLWINDOWPOS4IVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4ivMESA")) == NULL) || r; + r = ((glWindowPos4sMESA = (PFNGLWINDOWPOS4SMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4sMESA")) == NULL) || r; + r = ((glWindowPos4svMESA = (PFNGLWINDOWPOS4SVMESAPROC)glewGetProcAddress((const GLubyte*)"glWindowPos4svMESA")) == NULL) || r; + + return r; +} + +#endif /* GL_MESA_window_pos */ + +#ifdef GL_MESA_ycbcr_texture + +#endif /* GL_MESA_ycbcr_texture */ + +#ifdef GL_NV_blend_square + +#endif /* GL_NV_blend_square */ + +#ifdef GL_NV_copy_depth_to_color + +#endif /* GL_NV_copy_depth_to_color */ + +#ifdef GL_NV_depth_clamp + +#endif /* GL_NV_depth_clamp */ + +#ifdef GL_NV_evaluators + +static GLboolean _glewInit_GL_NV_evaluators (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glEvalMapsNV = (PFNGLEVALMAPSNVPROC)glewGetProcAddress((const GLubyte*)"glEvalMapsNV")) == NULL) || r; + r = ((glGetMapAttribParameterfvNV = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterfvNV")) == NULL) || r; + r = ((glGetMapAttribParameterivNV = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapAttribParameterivNV")) == NULL) || r; + r = ((glGetMapControlPointsNV = (PFNGLGETMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapControlPointsNV")) == NULL) || r; + r = ((glGetMapParameterfvNV = (PFNGLGETMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterfvNV")) == NULL) || r; + r = ((glGetMapParameterivNV = (PFNGLGETMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetMapParameterivNV")) == NULL) || r; + r = ((glMapControlPointsNV = (PFNGLMAPCONTROLPOINTSNVPROC)glewGetProcAddress((const GLubyte*)"glMapControlPointsNV")) == NULL) || r; + r = ((glMapParameterfvNV = (PFNGLMAPPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterfvNV")) == NULL) || r; + r = ((glMapParameterivNV = (PFNGLMAPPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glMapParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_evaluators */ + +#ifdef GL_NV_fence + +static GLboolean _glewInit_GL_NV_fence (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDeleteFencesNV = (PFNGLDELETEFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteFencesNV")) == NULL) || r; + r = ((glFinishFenceNV = (PFNGLFINISHFENCENVPROC)glewGetProcAddress((const GLubyte*)"glFinishFenceNV")) == NULL) || r; + r = ((glGenFencesNV = (PFNGLGENFENCESNVPROC)glewGetProcAddress((const GLubyte*)"glGenFencesNV")) == NULL) || r; + r = ((glGetFenceivNV = (PFNGLGETFENCEIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFenceivNV")) == NULL) || r; + r = ((glIsFenceNV = (PFNGLISFENCENVPROC)glewGetProcAddress((const GLubyte*)"glIsFenceNV")) == NULL) || r; + r = ((glSetFenceNV = (PFNGLSETFENCENVPROC)glewGetProcAddress((const GLubyte*)"glSetFenceNV")) == NULL) || r; + r = ((glTestFenceNV = (PFNGLTESTFENCENVPROC)glewGetProcAddress((const GLubyte*)"glTestFenceNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_fence */ + +#ifdef GL_NV_float_buffer + +#endif /* GL_NV_float_buffer */ + +#ifdef GL_NV_fog_distance + +#endif /* GL_NV_fog_distance */ + +#ifdef GL_NV_fragment_program + +static GLboolean _glewInit_GL_NV_fragment_program (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetProgramNamedParameterdvNV = (PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterdvNV")) == NULL) || r; + r = ((glGetProgramNamedParameterfvNV = (PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramNamedParameterfvNV")) == NULL) || r; + r = ((glProgramNamedParameter4dNV = (PFNGLPROGRAMNAMEDPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dNV")) == NULL) || r; + r = ((glProgramNamedParameter4dvNV = (PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4dvNV")) == NULL) || r; + r = ((glProgramNamedParameter4fNV = (PFNGLPROGRAMNAMEDPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fNV")) == NULL) || r; + r = ((glProgramNamedParameter4fvNV = (PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramNamedParameter4fvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_fragment_program */ + +#ifdef GL_NV_fragment_program2 + +#endif /* GL_NV_fragment_program2 */ + +#ifdef GL_NV_fragment_program_option + +#endif /* GL_NV_fragment_program_option */ + +#ifdef GL_NV_half_float + +static GLboolean _glewInit_GL_NV_half_float (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColor3hNV = (PFNGLCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hNV")) == NULL) || r; + r = ((glColor3hvNV = (PFNGLCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor3hvNV")) == NULL) || r; + r = ((glColor4hNV = (PFNGLCOLOR4HNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hNV")) == NULL) || r; + r = ((glColor4hvNV = (PFNGLCOLOR4HVNVPROC)glewGetProcAddress((const GLubyte*)"glColor4hvNV")) == NULL) || r; + r = ((glFogCoordhNV = (PFNGLFOGCOORDHNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhNV")) == NULL) || r; + r = ((glFogCoordhvNV = (PFNGLFOGCOORDHVNVPROC)glewGetProcAddress((const GLubyte*)"glFogCoordhvNV")) == NULL) || r; + r = ((glMultiTexCoord1hNV = (PFNGLMULTITEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hNV")) == NULL) || r; + r = ((glMultiTexCoord1hvNV = (PFNGLMULTITEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord1hvNV")) == NULL) || r; + r = ((glMultiTexCoord2hNV = (PFNGLMULTITEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hNV")) == NULL) || r; + r = ((glMultiTexCoord2hvNV = (PFNGLMULTITEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord2hvNV")) == NULL) || r; + r = ((glMultiTexCoord3hNV = (PFNGLMULTITEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hNV")) == NULL) || r; + r = ((glMultiTexCoord3hvNV = (PFNGLMULTITEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord3hvNV")) == NULL) || r; + r = ((glMultiTexCoord4hNV = (PFNGLMULTITEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hNV")) == NULL) || r; + r = ((glMultiTexCoord4hvNV = (PFNGLMULTITEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glMultiTexCoord4hvNV")) == NULL) || r; + r = ((glNormal3hNV = (PFNGLNORMAL3HNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hNV")) == NULL) || r; + r = ((glNormal3hvNV = (PFNGLNORMAL3HVNVPROC)glewGetProcAddress((const GLubyte*)"glNormal3hvNV")) == NULL) || r; + r = ((glSecondaryColor3hNV = (PFNGLSECONDARYCOLOR3HNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hNV")) == NULL) || r; + r = ((glSecondaryColor3hvNV = (PFNGLSECONDARYCOLOR3HVNVPROC)glewGetProcAddress((const GLubyte*)"glSecondaryColor3hvNV")) == NULL) || r; + r = ((glTexCoord1hNV = (PFNGLTEXCOORD1HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hNV")) == NULL) || r; + r = ((glTexCoord1hvNV = (PFNGLTEXCOORD1HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord1hvNV")) == NULL) || r; + r = ((glTexCoord2hNV = (PFNGLTEXCOORD2HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hNV")) == NULL) || r; + r = ((glTexCoord2hvNV = (PFNGLTEXCOORD2HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2hvNV")) == NULL) || r; + r = ((glTexCoord3hNV = (PFNGLTEXCOORD3HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hNV")) == NULL) || r; + r = ((glTexCoord3hvNV = (PFNGLTEXCOORD3HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord3hvNV")) == NULL) || r; + r = ((glTexCoord4hNV = (PFNGLTEXCOORD4HNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hNV")) == NULL) || r; + r = ((glTexCoord4hvNV = (PFNGLTEXCOORD4HVNVPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4hvNV")) == NULL) || r; + r = ((glVertex2hNV = (PFNGLVERTEX2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hNV")) == NULL) || r; + r = ((glVertex2hvNV = (PFNGLVERTEX2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex2hvNV")) == NULL) || r; + r = ((glVertex3hNV = (PFNGLVERTEX3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hNV")) == NULL) || r; + r = ((glVertex3hvNV = (PFNGLVERTEX3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex3hvNV")) == NULL) || r; + r = ((glVertex4hNV = (PFNGLVERTEX4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hNV")) == NULL) || r; + r = ((glVertex4hvNV = (PFNGLVERTEX4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertex4hvNV")) == NULL) || r; + r = ((glVertexAttrib1hNV = (PFNGLVERTEXATTRIB1HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hNV")) == NULL) || r; + r = ((glVertexAttrib1hvNV = (PFNGLVERTEXATTRIB1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1hvNV")) == NULL) || r; + r = ((glVertexAttrib2hNV = (PFNGLVERTEXATTRIB2HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hNV")) == NULL) || r; + r = ((glVertexAttrib2hvNV = (PFNGLVERTEXATTRIB2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2hvNV")) == NULL) || r; + r = ((glVertexAttrib3hNV = (PFNGLVERTEXATTRIB3HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hNV")) == NULL) || r; + r = ((glVertexAttrib3hvNV = (PFNGLVERTEXATTRIB3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3hvNV")) == NULL) || r; + r = ((glVertexAttrib4hNV = (PFNGLVERTEXATTRIB4HNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hNV")) == NULL) || r; + r = ((glVertexAttrib4hvNV = (PFNGLVERTEXATTRIB4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4hvNV")) == NULL) || r; + r = ((glVertexAttribs1hvNV = (PFNGLVERTEXATTRIBS1HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1hvNV")) == NULL) || r; + r = ((glVertexAttribs2hvNV = (PFNGLVERTEXATTRIBS2HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2hvNV")) == NULL) || r; + r = ((glVertexAttribs3hvNV = (PFNGLVERTEXATTRIBS3HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3hvNV")) == NULL) || r; + r = ((glVertexAttribs4hvNV = (PFNGLVERTEXATTRIBS4HVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4hvNV")) == NULL) || r; + r = ((glVertexWeighthNV = (PFNGLVERTEXWEIGHTHNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthNV")) == NULL) || r; + r = ((glVertexWeighthvNV = (PFNGLVERTEXWEIGHTHVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexWeighthvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_half_float */ + +#ifdef GL_NV_light_max_exponent + +#endif /* GL_NV_light_max_exponent */ + +#ifdef GL_NV_multisample_filter_hint + +#endif /* GL_NV_multisample_filter_hint */ + +#ifdef GL_NV_occlusion_query + +static GLboolean _glewInit_GL_NV_occlusion_query (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glBeginOcclusionQueryNV = (PFNGLBEGINOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glBeginOcclusionQueryNV")) == NULL) || r; + r = ((glDeleteOcclusionQueriesNV = (PFNGLDELETEOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteOcclusionQueriesNV")) == NULL) || r; + r = ((glEndOcclusionQueryNV = (PFNGLENDOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glEndOcclusionQueryNV")) == NULL) || r; + r = ((glGenOcclusionQueriesNV = (PFNGLGENOCCLUSIONQUERIESNVPROC)glewGetProcAddress((const GLubyte*)"glGenOcclusionQueriesNV")) == NULL) || r; + r = ((glGetOcclusionQueryivNV = (PFNGLGETOCCLUSIONQUERYIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryivNV")) == NULL) || r; + r = ((glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetOcclusionQueryuivNV")) == NULL) || r; + r = ((glIsOcclusionQueryNV = (PFNGLISOCCLUSIONQUERYNVPROC)glewGetProcAddress((const GLubyte*)"glIsOcclusionQueryNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_occlusion_query */ + +#ifdef GL_NV_packed_depth_stencil + +#endif /* GL_NV_packed_depth_stencil */ + +#ifdef GL_NV_pixel_data_range + +static GLboolean _glewInit_GL_NV_pixel_data_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushPixelDataRangeNV = (PFNGLFLUSHPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushPixelDataRangeNV")) == NULL) || r; + r = ((glPixelDataRangeNV = (PFNGLPIXELDATARANGENVPROC)glewGetProcAddress((const GLubyte*)"glPixelDataRangeNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_pixel_data_range */ + +#ifdef GL_NV_point_sprite + +static GLboolean _glewInit_GL_NV_point_sprite (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPointParameteriNV = (PFNGLPOINTPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glPointParameteriNV")) == NULL) || r; + r = ((glPointParameterivNV = (PFNGLPOINTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glPointParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_point_sprite */ + +#ifdef GL_NV_primitive_restart + +static GLboolean _glewInit_GL_NV_primitive_restart (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPrimitiveRestartIndexNV = (PFNGLPRIMITIVERESTARTINDEXNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartIndexNV")) == NULL) || r; + r = ((glPrimitiveRestartNV = (PFNGLPRIMITIVERESTARTNVPROC)glewGetProcAddress((const GLubyte*)"glPrimitiveRestartNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_primitive_restart */ + +#ifdef GL_NV_register_combiners + +static GLboolean _glewInit_GL_NV_register_combiners (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCombinerInputNV = (PFNGLCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerInputNV")) == NULL) || r; + r = ((glCombinerOutputNV = (PFNGLCOMBINEROUTPUTNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerOutputNV")) == NULL) || r; + r = ((glCombinerParameterfNV = (PFNGLCOMBINERPARAMETERFNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfNV")) == NULL) || r; + r = ((glCombinerParameterfvNV = (PFNGLCOMBINERPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterfvNV")) == NULL) || r; + r = ((glCombinerParameteriNV = (PFNGLCOMBINERPARAMETERINVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameteriNV")) == NULL) || r; + r = ((glCombinerParameterivNV = (PFNGLCOMBINERPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerParameterivNV")) == NULL) || r; + r = ((glFinalCombinerInputNV = (PFNGLFINALCOMBINERINPUTNVPROC)glewGetProcAddress((const GLubyte*)"glFinalCombinerInputNV")) == NULL) || r; + r = ((glGetCombinerInputParameterfvNV = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterfvNV")) == NULL) || r; + r = ((glGetCombinerInputParameterivNV = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerInputParameterivNV")) == NULL) || r; + r = ((glGetCombinerOutputParameterfvNV = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterfvNV")) == NULL) || r; + r = ((glGetCombinerOutputParameterivNV = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerOutputParameterivNV")) == NULL) || r; + r = ((glGetFinalCombinerInputParameterfvNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterfvNV")) == NULL) || r; + r = ((glGetFinalCombinerInputParameterivNV = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetFinalCombinerInputParameterivNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_register_combiners */ + +#ifdef GL_NV_register_combiners2 + +static GLboolean _glewInit_GL_NV_register_combiners2 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glCombinerStageParameterfvNV = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glCombinerStageParameterfvNV")) == NULL) || r; + r = ((glGetCombinerStageParameterfvNV = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetCombinerStageParameterfvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_register_combiners2 */ + +#ifdef GL_NV_texgen_emboss + +#endif /* GL_NV_texgen_emboss */ + +#ifdef GL_NV_texgen_reflection + +#endif /* GL_NV_texgen_reflection */ + +#ifdef GL_NV_texture_compression_vtc + +#endif /* GL_NV_texture_compression_vtc */ + +#ifdef GL_NV_texture_env_combine4 + +#endif /* GL_NV_texture_env_combine4 */ + +#ifdef GL_NV_texture_expand_normal + +#endif /* GL_NV_texture_expand_normal */ + +#ifdef GL_NV_texture_rectangle + +#endif /* GL_NV_texture_rectangle */ + +#ifdef GL_NV_texture_shader + +#endif /* GL_NV_texture_shader */ + +#ifdef GL_NV_texture_shader2 + +#endif /* GL_NV_texture_shader2 */ + +#ifdef GL_NV_texture_shader3 + +#endif /* GL_NV_texture_shader3 */ + +#ifdef GL_NV_vertex_array_range + +static GLboolean _glewInit_GL_NV_vertex_array_range (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushVertexArrayRangeNV = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glFlushVertexArrayRangeNV")) == NULL) || r; + r = ((glVertexArrayRangeNV = (PFNGLVERTEXARRAYRANGENVPROC)glewGetProcAddress((const GLubyte*)"glVertexArrayRangeNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vertex_array_range */ + +#ifdef GL_NV_vertex_array_range2 + +#endif /* GL_NV_vertex_array_range2 */ + +#ifdef GL_NV_vertex_program + +static GLboolean _glewInit_GL_NV_vertex_program (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAreProgramsResidentNV = (PFNGLAREPROGRAMSRESIDENTNVPROC)glewGetProcAddress((const GLubyte*)"glAreProgramsResidentNV")) == NULL) || r; + r = ((glBindProgramNV = (PFNGLBINDPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glBindProgramNV")) == NULL) || r; + r = ((glDeleteProgramsNV = (PFNGLDELETEPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glDeleteProgramsNV")) == NULL) || r; + r = ((glExecuteProgramNV = (PFNGLEXECUTEPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glExecuteProgramNV")) == NULL) || r; + r = ((glGenProgramsNV = (PFNGLGENPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glGenProgramsNV")) == NULL) || r; + r = ((glGetProgramParameterdvNV = (PFNGLGETPROGRAMPARAMETERDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterdvNV")) == NULL) || r; + r = ((glGetProgramParameterfvNV = (PFNGLGETPROGRAMPARAMETERFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramParameterfvNV")) == NULL) || r; + r = ((glGetProgramStringNV = (PFNGLGETPROGRAMSTRINGNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramStringNV")) == NULL) || r; + r = ((glGetProgramivNV = (PFNGLGETPROGRAMIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetProgramivNV")) == NULL) || r; + r = ((glGetTrackMatrixivNV = (PFNGLGETTRACKMATRIXIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetTrackMatrixivNV")) == NULL) || r; + r = ((glGetVertexAttribPointervNV = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribPointervNV")) == NULL) || r; + r = ((glGetVertexAttribdvNV = (PFNGLGETVERTEXATTRIBDVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribdvNV")) == NULL) || r; + r = ((glGetVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribfvNV")) == NULL) || r; + r = ((glGetVertexAttribivNV = (PFNGLGETVERTEXATTRIBIVNVPROC)glewGetProcAddress((const GLubyte*)"glGetVertexAttribivNV")) == NULL) || r; + r = ((glIsProgramNV = (PFNGLISPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glIsProgramNV")) == NULL) || r; + r = ((glLoadProgramNV = (PFNGLLOADPROGRAMNVPROC)glewGetProcAddress((const GLubyte*)"glLoadProgramNV")) == NULL) || r; + r = ((glProgramParameter4dNV = (PFNGLPROGRAMPARAMETER4DNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dNV")) == NULL) || r; + r = ((glProgramParameter4dvNV = (PFNGLPROGRAMPARAMETER4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4dvNV")) == NULL) || r; + r = ((glProgramParameter4fNV = (PFNGLPROGRAMPARAMETER4FNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fNV")) == NULL) || r; + r = ((glProgramParameter4fvNV = (PFNGLPROGRAMPARAMETER4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameter4fvNV")) == NULL) || r; + r = ((glProgramParameters4dvNV = (PFNGLPROGRAMPARAMETERS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4dvNV")) == NULL) || r; + r = ((glProgramParameters4fvNV = (PFNGLPROGRAMPARAMETERS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glProgramParameters4fvNV")) == NULL) || r; + r = ((glRequestResidentProgramsNV = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)glewGetProcAddress((const GLubyte*)"glRequestResidentProgramsNV")) == NULL) || r; + r = ((glTrackMatrixNV = (PFNGLTRACKMATRIXNVPROC)glewGetProcAddress((const GLubyte*)"glTrackMatrixNV")) == NULL) || r; + r = ((glVertexAttrib1dNV = (PFNGLVERTEXATTRIB1DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dNV")) == NULL) || r; + r = ((glVertexAttrib1dvNV = (PFNGLVERTEXATTRIB1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1dvNV")) == NULL) || r; + r = ((glVertexAttrib1fNV = (PFNGLVERTEXATTRIB1FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fNV")) == NULL) || r; + r = ((glVertexAttrib1fvNV = (PFNGLVERTEXATTRIB1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1fvNV")) == NULL) || r; + r = ((glVertexAttrib1sNV = (PFNGLVERTEXATTRIB1SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1sNV")) == NULL) || r; + r = ((glVertexAttrib1svNV = (PFNGLVERTEXATTRIB1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib1svNV")) == NULL) || r; + r = ((glVertexAttrib2dNV = (PFNGLVERTEXATTRIB2DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dNV")) == NULL) || r; + r = ((glVertexAttrib2dvNV = (PFNGLVERTEXATTRIB2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2dvNV")) == NULL) || r; + r = ((glVertexAttrib2fNV = (PFNGLVERTEXATTRIB2FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fNV")) == NULL) || r; + r = ((glVertexAttrib2fvNV = (PFNGLVERTEXATTRIB2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2fvNV")) == NULL) || r; + r = ((glVertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2sNV")) == NULL) || r; + r = ((glVertexAttrib2svNV = (PFNGLVERTEXATTRIB2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib2svNV")) == NULL) || r; + r = ((glVertexAttrib3dNV = (PFNGLVERTEXATTRIB3DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dNV")) == NULL) || r; + r = ((glVertexAttrib3dvNV = (PFNGLVERTEXATTRIB3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3dvNV")) == NULL) || r; + r = ((glVertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fNV")) == NULL) || r; + r = ((glVertexAttrib3fvNV = (PFNGLVERTEXATTRIB3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3fvNV")) == NULL) || r; + r = ((glVertexAttrib3sNV = (PFNGLVERTEXATTRIB3SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3sNV")) == NULL) || r; + r = ((glVertexAttrib3svNV = (PFNGLVERTEXATTRIB3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib3svNV")) == NULL) || r; + r = ((glVertexAttrib4dNV = (PFNGLVERTEXATTRIB4DNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dNV")) == NULL) || r; + r = ((glVertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4dvNV")) == NULL) || r; + r = ((glVertexAttrib4fNV = (PFNGLVERTEXATTRIB4FNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fNV")) == NULL) || r; + r = ((glVertexAttrib4fvNV = (PFNGLVERTEXATTRIB4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4fvNV")) == NULL) || r; + r = ((glVertexAttrib4sNV = (PFNGLVERTEXATTRIB4SNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4sNV")) == NULL) || r; + r = ((glVertexAttrib4svNV = (PFNGLVERTEXATTRIB4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4svNV")) == NULL) || r; + r = ((glVertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubNV")) == NULL) || r; + r = ((glVertexAttrib4ubvNV = (PFNGLVERTEXATTRIB4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4ubvNV")) == NULL) || r; + r = ((glVertexAttribPointerNV = (PFNGLVERTEXATTRIBPOINTERNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointerNV")) == NULL) || r; + r = ((glVertexAttribs1dvNV = (PFNGLVERTEXATTRIBS1DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1dvNV")) == NULL) || r; + r = ((glVertexAttribs1fvNV = (PFNGLVERTEXATTRIBS1FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1fvNV")) == NULL) || r; + r = ((glVertexAttribs1svNV = (PFNGLVERTEXATTRIBS1SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs1svNV")) == NULL) || r; + r = ((glVertexAttribs2dvNV = (PFNGLVERTEXATTRIBS2DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2dvNV")) == NULL) || r; + r = ((glVertexAttribs2fvNV = (PFNGLVERTEXATTRIBS2FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2fvNV")) == NULL) || r; + r = ((glVertexAttribs2svNV = (PFNGLVERTEXATTRIBS2SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs2svNV")) == NULL) || r; + r = ((glVertexAttribs3dvNV = (PFNGLVERTEXATTRIBS3DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3dvNV")) == NULL) || r; + r = ((glVertexAttribs3fvNV = (PFNGLVERTEXATTRIBS3FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3fvNV")) == NULL) || r; + r = ((glVertexAttribs3svNV = (PFNGLVERTEXATTRIBS3SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs3svNV")) == NULL) || r; + r = ((glVertexAttribs4dvNV = (PFNGLVERTEXATTRIBS4DVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4dvNV")) == NULL) || r; + r = ((glVertexAttribs4fvNV = (PFNGLVERTEXATTRIBS4FVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4fvNV")) == NULL) || r; + r = ((glVertexAttribs4svNV = (PFNGLVERTEXATTRIBS4SVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4svNV")) == NULL) || r; + r = ((glVertexAttribs4ubvNV = (PFNGLVERTEXATTRIBS4UBVNVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribs4ubvNV")) == NULL) || r; + + return r; +} + +#endif /* GL_NV_vertex_program */ + +#ifdef GL_NV_vertex_program1_1 + +#endif /* GL_NV_vertex_program1_1 */ + +#ifdef GL_NV_vertex_program2 + +#endif /* GL_NV_vertex_program2 */ + +#ifdef GL_NV_vertex_program2_option + +#endif /* GL_NV_vertex_program2_option */ + +#ifdef GL_NV_vertex_program3 + +#endif /* GL_NV_vertex_program3 */ + +#ifdef GL_OML_interlace + +#endif /* GL_OML_interlace */ + +#ifdef GL_OML_resample + +#endif /* GL_OML_resample */ + +#ifdef GL_OML_subsample + +#endif /* GL_OML_subsample */ + +#ifdef GL_PGI_misc_hints + +#endif /* GL_PGI_misc_hints */ + +#ifdef GL_PGI_vertex_hints + +#endif /* GL_PGI_vertex_hints */ + +#ifdef GL_REND_screen_coordinates + +#endif /* GL_REND_screen_coordinates */ + +#ifdef GL_S3_s3tc + +#endif /* GL_S3_s3tc */ + +#ifdef GL_SGIS_color_range + +#endif /* GL_SGIS_color_range */ + +#ifdef GL_SGIS_detail_texture + +static GLboolean _glewInit_GL_SGIS_detail_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glDetailTexFuncSGIS = (PFNGLDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glDetailTexFuncSGIS")) == NULL) || r; + r = ((glGetDetailTexFuncSGIS = (PFNGLGETDETAILTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetDetailTexFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_detail_texture */ + +#ifdef GL_SGIS_fog_function + +static GLboolean _glewInit_GL_SGIS_fog_function (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFogFuncSGIS = (PFNGLFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glFogFuncSGIS")) == NULL) || r; + r = ((glGetFogFuncSGIS = (PFNGLGETFOGFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetFogFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_fog_function */ + +#ifdef GL_SGIS_generate_mipmap + +#endif /* GL_SGIS_generate_mipmap */ + +#ifdef GL_SGIS_multisample + +static GLboolean _glewInit_GL_SGIS_multisample (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSampleMaskSGIS = (PFNGLSAMPLEMASKSGISPROC)glewGetProcAddress((const GLubyte*)"glSampleMaskSGIS")) == NULL) || r; + r = ((glSamplePatternSGIS = (PFNGLSAMPLEPATTERNSGISPROC)glewGetProcAddress((const GLubyte*)"glSamplePatternSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_multisample */ + +#ifdef GL_SGIS_pixel_texture + +#endif /* GL_SGIS_pixel_texture */ + +#ifdef GL_SGIS_sharpen_texture + +static GLboolean _glewInit_GL_SGIS_sharpen_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetSharpenTexFuncSGIS = (PFNGLGETSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetSharpenTexFuncSGIS")) == NULL) || r; + r = ((glSharpenTexFuncSGIS = (PFNGLSHARPENTEXFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glSharpenTexFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_sharpen_texture */ + +#ifdef GL_SGIS_texture4D + +static GLboolean _glewInit_GL_SGIS_texture4D (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTexImage4DSGIS = (PFNGLTEXIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexImage4DSGIS")) == NULL) || r; + r = ((glTexSubImage4DSGIS = (PFNGLTEXSUBIMAGE4DSGISPROC)glewGetProcAddress((const GLubyte*)"glTexSubImage4DSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_texture4D */ + +#ifdef GL_SGIS_texture_border_clamp + +#endif /* GL_SGIS_texture_border_clamp */ + +#ifdef GL_SGIS_texture_edge_clamp + +#endif /* GL_SGIS_texture_edge_clamp */ + +#ifdef GL_SGIS_texture_filter4 + +static GLboolean _glewInit_GL_SGIS_texture_filter4 (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGetTexFilterFuncSGIS = (PFNGLGETTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glGetTexFilterFuncSGIS")) == NULL) || r; + r = ((glTexFilterFuncSGIS = (PFNGLTEXFILTERFUNCSGISPROC)glewGetProcAddress((const GLubyte*)"glTexFilterFuncSGIS")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIS_texture_filter4 */ + +#ifdef GL_SGIS_texture_lod + +#endif /* GL_SGIS_texture_lod */ + +#ifdef GL_SGIS_texture_select + +#endif /* GL_SGIS_texture_select */ + +#ifdef GL_SGIX_async + +static GLboolean _glewInit_GL_SGIX_async (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAsyncMarkerSGIX = (PFNGLASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glAsyncMarkerSGIX")) == NULL) || r; + r = ((glDeleteAsyncMarkersSGIX = (PFNGLDELETEASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glDeleteAsyncMarkersSGIX")) == NULL) || r; + r = ((glFinishAsyncSGIX = (PFNGLFINISHASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glFinishAsyncSGIX")) == NULL) || r; + r = ((glGenAsyncMarkersSGIX = (PFNGLGENASYNCMARKERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glGenAsyncMarkersSGIX")) == NULL) || r; + r = ((glIsAsyncMarkerSGIX = (PFNGLISASYNCMARKERSGIXPROC)glewGetProcAddress((const GLubyte*)"glIsAsyncMarkerSGIX")) == NULL) || r; + r = ((glPollAsyncSGIX = (PFNGLPOLLASYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glPollAsyncSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_async */ + +#ifdef GL_SGIX_async_histogram + +#endif /* GL_SGIX_async_histogram */ + +#ifdef GL_SGIX_async_pixel + +#endif /* GL_SGIX_async_pixel */ + +#ifdef GL_SGIX_blend_alpha_minmax + +#endif /* GL_SGIX_blend_alpha_minmax */ + +#ifdef GL_SGIX_clipmap + +#endif /* GL_SGIX_clipmap */ + +#ifdef GL_SGIX_depth_texture + +#endif /* GL_SGIX_depth_texture */ + +#ifdef GL_SGIX_flush_raster + +static GLboolean _glewInit_GL_SGIX_flush_raster (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFlushRasterSGIX = (PFNGLFLUSHRASTERSGIXPROC)glewGetProcAddress((const GLubyte*)"glFlushRasterSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_flush_raster */ + +#ifdef GL_SGIX_fog_offset + +#endif /* GL_SGIX_fog_offset */ + +#ifdef GL_SGIX_fog_texture + +static GLboolean _glewInit_GL_SGIX_fog_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTextureFogSGIX = (PFNGLTEXTUREFOGSGIXPROC)glewGetProcAddress((const GLubyte*)"glTextureFogSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_fog_texture */ + +#ifdef GL_SGIX_fragment_specular_lighting + +static GLboolean _glewInit_GL_SGIX_fragment_specular_lighting (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFragmentColorMaterialSGIX = (PFNGLFRAGMENTCOLORMATERIALSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentColorMaterialSGIX")) == NULL) || r; + r = ((glFragmentLightModelfSGIX = (PFNGLFRAGMENTLIGHTMODELFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfSGIX")) == NULL) || r; + r = ((glFragmentLightModelfvSGIX = (PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelfvSGIX")) == NULL) || r; + r = ((glFragmentLightModeliSGIX = (PFNGLFRAGMENTLIGHTMODELISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModeliSGIX")) == NULL) || r; + r = ((glFragmentLightModelivSGIX = (PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightModelivSGIX")) == NULL) || r; + r = ((glFragmentLightfSGIX = (PFNGLFRAGMENTLIGHTFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfSGIX")) == NULL) || r; + r = ((glFragmentLightfvSGIX = (PFNGLFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightfvSGIX")) == NULL) || r; + r = ((glFragmentLightiSGIX = (PFNGLFRAGMENTLIGHTISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightiSGIX")) == NULL) || r; + r = ((glFragmentLightivSGIX = (PFNGLFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentLightivSGIX")) == NULL) || r; + r = ((glFragmentMaterialfSGIX = (PFNGLFRAGMENTMATERIALFSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfSGIX")) == NULL) || r; + r = ((glFragmentMaterialfvSGIX = (PFNGLFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialfvSGIX")) == NULL) || r; + r = ((glFragmentMaterialiSGIX = (PFNGLFRAGMENTMATERIALISGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialiSGIX")) == NULL) || r; + r = ((glFragmentMaterialivSGIX = (PFNGLFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glFragmentMaterialivSGIX")) == NULL) || r; + r = ((glGetFragmentLightfvSGIX = (PFNGLGETFRAGMENTLIGHTFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightfvSGIX")) == NULL) || r; + r = ((glGetFragmentLightivSGIX = (PFNGLGETFRAGMENTLIGHTIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentLightivSGIX")) == NULL) || r; + r = ((glGetFragmentMaterialfvSGIX = (PFNGLGETFRAGMENTMATERIALFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialfvSGIX")) == NULL) || r; + r = ((glGetFragmentMaterialivSGIX = (PFNGLGETFRAGMENTMATERIALIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glGetFragmentMaterialivSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_fragment_specular_lighting */ + +#ifdef GL_SGIX_framezoom + +static GLboolean _glewInit_GL_SGIX_framezoom (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFrameZoomSGIX = (PFNGLFRAMEZOOMSGIXPROC)glewGetProcAddress((const GLubyte*)"glFrameZoomSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_framezoom */ + +#ifdef GL_SGIX_interlace + +#endif /* GL_SGIX_interlace */ + +#ifdef GL_SGIX_ir_instrument1 + +#endif /* GL_SGIX_ir_instrument1 */ + +#ifdef GL_SGIX_list_priority + +#endif /* GL_SGIX_list_priority */ + +#ifdef GL_SGIX_pixel_texture + +static GLboolean _glewInit_GL_SGIX_pixel_texture (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glPixelTexGenSGIX = (PFNGLPIXELTEXGENSGIXPROC)glewGetProcAddress((const GLubyte*)"glPixelTexGenSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_pixel_texture */ + +#ifdef GL_SGIX_pixel_texture_bits + +#endif /* GL_SGIX_pixel_texture_bits */ + +#ifdef GL_SGIX_reference_plane + +static GLboolean _glewInit_GL_SGIX_reference_plane (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glReferencePlaneSGIX = (PFNGLREFERENCEPLANESGIXPROC)glewGetProcAddress((const GLubyte*)"glReferencePlaneSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_reference_plane */ + +#ifdef GL_SGIX_resample + +#endif /* GL_SGIX_resample */ + +#ifdef GL_SGIX_shadow + +#endif /* GL_SGIX_shadow */ + +#ifdef GL_SGIX_shadow_ambient + +#endif /* GL_SGIX_shadow_ambient */ + +#ifdef GL_SGIX_sprite + +static GLboolean _glewInit_GL_SGIX_sprite (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glSpriteParameterfSGIX = (PFNGLSPRITEPARAMETERFSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfSGIX")) == NULL) || r; + r = ((glSpriteParameterfvSGIX = (PFNGLSPRITEPARAMETERFVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterfvSGIX")) == NULL) || r; + r = ((glSpriteParameteriSGIX = (PFNGLSPRITEPARAMETERISGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameteriSGIX")) == NULL) || r; + r = ((glSpriteParameterivSGIX = (PFNGLSPRITEPARAMETERIVSGIXPROC)glewGetProcAddress((const GLubyte*)"glSpriteParameterivSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_sprite */ + +#ifdef GL_SGIX_tag_sample_buffer + +static GLboolean _glewInit_GL_SGIX_tag_sample_buffer (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glTagSampleBufferSGIX = (PFNGLTAGSAMPLEBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glTagSampleBufferSGIX")) == NULL) || r; + + return r; +} + +#endif /* GL_SGIX_tag_sample_buffer */ + +#ifdef GL_SGIX_texture_add_env + +#endif /* GL_SGIX_texture_add_env */ + +#ifdef GL_SGIX_texture_coordinate_clamp + +#endif /* GL_SGIX_texture_coordinate_clamp */ + +#ifdef GL_SGIX_texture_lod_bias + +#endif /* GL_SGIX_texture_lod_bias */ + +#ifdef GL_SGIX_texture_multi_buffer + +#endif /* GL_SGIX_texture_multi_buffer */ + +#ifdef GL_SGIX_texture_range + +#endif /* GL_SGIX_texture_range */ + +#ifdef GL_SGIX_texture_scale_bias + +#endif /* GL_SGIX_texture_scale_bias */ + +#ifdef GL_SGIX_vertex_preclip + +#endif /* GL_SGIX_vertex_preclip */ + +#ifdef GL_SGIX_vertex_preclip_hint + +#endif /* GL_SGIX_vertex_preclip_hint */ + +#ifdef GL_SGIX_ycrcb + +#endif /* GL_SGIX_ycrcb */ + +#ifdef GL_SGI_color_matrix + +#endif /* GL_SGI_color_matrix */ + +#ifdef GL_SGI_color_table + +static GLboolean _glewInit_GL_SGI_color_table (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColorTableParameterfvSGI = (PFNGLCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterfvSGI")) == NULL) || r; + r = ((glColorTableParameterivSGI = (PFNGLCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableParameterivSGI")) == NULL) || r; + r = ((glColorTableSGI = (PFNGLCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glColorTableSGI")) == NULL) || r; + r = ((glCopyColorTableSGI = (PFNGLCOPYCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glCopyColorTableSGI")) == NULL) || r; + r = ((glGetColorTableParameterfvSGI = (PFNGLGETCOLORTABLEPARAMETERFVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterfvSGI")) == NULL) || r; + r = ((glGetColorTableParameterivSGI = (PFNGLGETCOLORTABLEPARAMETERIVSGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableParameterivSGI")) == NULL) || r; + r = ((glGetColorTableSGI = (PFNGLGETCOLORTABLESGIPROC)glewGetProcAddress((const GLubyte*)"glGetColorTableSGI")) == NULL) || r; + + return r; +} + +#endif /* GL_SGI_color_table */ + +#ifdef GL_SGI_texture_color_table + +#endif /* GL_SGI_texture_color_table */ + +#ifdef GL_SUNX_constant_data + +static GLboolean _glewInit_GL_SUNX_constant_data (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glFinishTextureSUNX = (PFNGLFINISHTEXTURESUNXPROC)glewGetProcAddress((const GLubyte*)"glFinishTextureSUNX")) == NULL) || r; + + return r; +} + +#endif /* GL_SUNX_constant_data */ + +#ifdef GL_SUN_convolution_border_modes + +#endif /* GL_SUN_convolution_border_modes */ + +#ifdef GL_SUN_global_alpha + +static GLboolean _glewInit_GL_SUN_global_alpha (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glGlobalAlphaFactorbSUN = (PFNGLGLOBALALPHAFACTORBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorbSUN")) == NULL) || r; + r = ((glGlobalAlphaFactordSUN = (PFNGLGLOBALALPHAFACTORDSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactordSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorfSUN = (PFNGLGLOBALALPHAFACTORFSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorfSUN")) == NULL) || r; + r = ((glGlobalAlphaFactoriSUN = (PFNGLGLOBALALPHAFACTORISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoriSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorsSUN = (PFNGLGLOBALALPHAFACTORSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorsSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorubSUN = (PFNGLGLOBALALPHAFACTORUBSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorubSUN")) == NULL) || r; + r = ((glGlobalAlphaFactoruiSUN = (PFNGLGLOBALALPHAFACTORUISUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactoruiSUN")) == NULL) || r; + r = ((glGlobalAlphaFactorusSUN = (PFNGLGLOBALALPHAFACTORUSSUNPROC)glewGetProcAddress((const GLubyte*)"glGlobalAlphaFactorusSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_global_alpha */ + +#ifdef GL_SUN_mesh_array + +#endif /* GL_SUN_mesh_array */ + +#ifdef GL_SUN_read_video_pixels + +static GLboolean _glewInit_GL_SUN_read_video_pixels (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glReadVideoPixelsSUN = (PFNGLREADVIDEOPIXELSSUNPROC)glewGetProcAddress((const GLubyte*)"glReadVideoPixelsSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_read_video_pixels */ + +#ifdef GL_SUN_slice_accum + +#endif /* GL_SUN_slice_accum */ + +#ifdef GL_SUN_triangle_list + +static GLboolean _glewInit_GL_SUN_triangle_list (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glReplacementCodePointerSUN = (PFNGLREPLACEMENTCODEPOINTERSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodePointerSUN")) == NULL) || r; + r = ((glReplacementCodeubSUN = (PFNGLREPLACEMENTCODEUBSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubSUN")) == NULL) || r; + r = ((glReplacementCodeubvSUN = (PFNGLREPLACEMENTCODEUBVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeubvSUN")) == NULL) || r; + r = ((glReplacementCodeuiSUN = (PFNGLREPLACEMENTCODEUISUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiSUN")) == NULL) || r; + r = ((glReplacementCodeuivSUN = (PFNGLREPLACEMENTCODEUIVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuivSUN")) == NULL) || r; + r = ((glReplacementCodeusSUN = (PFNGLREPLACEMENTCODEUSSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusSUN")) == NULL) || r; + r = ((glReplacementCodeusvSUN = (PFNGLREPLACEMENTCODEUSVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeusvSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_triangle_list */ + +#ifdef GL_SUN_vertex + +static GLboolean _glewInit_GL_SUN_vertex (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glColor3fVertex3fSUN = (PFNGLCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fSUN")) == NULL) || r; + r = ((glColor3fVertex3fvSUN = (PFNGLCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor3fVertex3fvSUN")) == NULL) || r; + r = ((glColor4fNormal3fVertex3fSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glColor4fNormal3fVertex3fvSUN = (PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glColor4ubVertex2fSUN = (PFNGLCOLOR4UBVERTEX2FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fSUN")) == NULL) || r; + r = ((glColor4ubVertex2fvSUN = (PFNGLCOLOR4UBVERTEX2FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex2fvSUN")) == NULL) || r; + r = ((glColor4ubVertex3fSUN = (PFNGLCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fSUN")) == NULL) || r; + r = ((glColor4ubVertex3fvSUN = (PFNGLCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glColor4ubVertex3fvSUN")) == NULL) || r; + r = ((glNormal3fVertex3fSUN = (PFNGLNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fSUN")) == NULL) || r; + r = ((glNormal3fVertex3fvSUN = (PFNGLNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4ubVertex3fSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiColor4ubVertex3fvSUN = (PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiColor4ubVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fVertex3fSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiTexCoord2fVertex3fvSUN = (PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiTexCoord2fVertex3fvSUN")) == NULL) || r; + r = ((glReplacementCodeuiVertex3fSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fSUN")) == NULL) || r; + r = ((glReplacementCodeuiVertex3fvSUN = (PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glReplacementCodeuiVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fColor3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fColor3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor3fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fColor4fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fColor4fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fColor4ubVertex3fSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fColor4ubVertex3fvSUN = (PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fColor4ubVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fNormal3fVertex3fSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fNormal3fVertex3fvSUN = (PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fNormal3fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord2fVertex3fSUN = (PFNGLTEXCOORD2FVERTEX3FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fSUN")) == NULL) || r; + r = ((glTexCoord2fVertex3fvSUN = (PFNGLTEXCOORD2FVERTEX3FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord2fVertex3fvSUN")) == NULL) || r; + r = ((glTexCoord4fColor4fNormal3fVertex4fSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fSUN")) == NULL) || r; + r = ((glTexCoord4fColor4fNormal3fVertex4fvSUN = (PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fColor4fNormal3fVertex4fvSUN")) == NULL) || r; + r = ((glTexCoord4fVertex4fSUN = (PFNGLTEXCOORD4FVERTEX4FSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fSUN")) == NULL) || r; + r = ((glTexCoord4fVertex4fvSUN = (PFNGLTEXCOORD4FVERTEX4FVSUNPROC)glewGetProcAddress((const GLubyte*)"glTexCoord4fVertex4fvSUN")) == NULL) || r; + + return r; +} + +#endif /* GL_SUN_vertex */ + +#ifdef GL_WIN_phong_shading + +#endif /* GL_WIN_phong_shading */ + +#ifdef GL_WIN_specular_fog + +#endif /* GL_WIN_specular_fog */ + +#ifdef GL_WIN_swap_hint + +static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glAddSwapHintRectWIN = (PFNGLADDSWAPHINTRECTWINPROC)glewGetProcAddress((const GLubyte*)"glAddSwapHintRectWIN")) == NULL) || r; + + return r; +} + +#endif /* GL_WIN_swap_hint */ + +/* ------------------------------------------------------------------------- */ + +/* + * Search for name in the extensions string. Use of strstr() + * is not sufficient because extension names can be prefixes of + * other extension names. Could use strtok() but the constant + * string returned by glGetString might be in read-only memory. + */ +GLboolean glewGetExtension (const char* name) +{ + GLubyte* p; + GLubyte* end; + GLuint len = _glewStrLen((const GLubyte*)name); + p = (GLubyte*)glGetString(GL_EXTENSIONS); + if (0 == p) return GL_FALSE; + end = p + _glewStrLen(p); + while (p < end) + { + GLuint n = _glewStrCLen(p, ' '); + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; + p += n+1; + } + return GL_FALSE; +} + +/* ------------------------------------------------------------------------- */ + +#ifndef GLEW_MX +static +#endif +GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) +{ + const GLubyte* s; + GLuint dot, major, minor; + /* query opengl version */ + s = glGetString(GL_VERSION); + dot = _glewStrCLen(s, '.'); + major = dot-1; + minor = dot+1; + if (dot == 0 || s[minor] == '\0') + return GLEW_ERROR_NO_GL_VERSION; + if (s[major] == '1' && s[minor] == '0') + { + return GLEW_ERROR_GL_VERSION_10_ONLY; + } + else + { + if (s[major] >= '2') + { + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_TRUE; + GLEW_VERSION_1_5 = GL_TRUE; + GLEW_VERSION_2_0 = GL_TRUE; + } + else + { + if (s[minor] >= '5') + { + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_TRUE; + GLEW_VERSION_1_5 = GL_TRUE; + GLEW_VERSION_2_0 = GL_FALSE; + } + if (s[minor] == '4') + { + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_TRUE; + GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_2_0 = GL_FALSE; + } + if (s[minor] == '3') + { + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_FALSE; + GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_2_0 = GL_FALSE; + } + if (s[minor] == '2') + { + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_FALSE; + GLEW_VERSION_1_4 = GL_FALSE; + GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_2_0 = GL_FALSE; + } + if (s[minor] < '2') + { + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_FALSE; + GLEW_VERSION_1_3 = GL_FALSE; + GLEW_VERSION_1_4 = GL_FALSE; + GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_2_0 = GL_FALSE; + } + } + } + /* initialize extensions */ +#ifdef GL_VERSION_1_2 + if (glewExperimental || GLEW_VERSION_1_2) GLEW_VERSION_1_2 = !_glewInit_GL_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_2 */ +#ifdef GL_VERSION_1_3 + if (glewExperimental || GLEW_VERSION_1_3) GLEW_VERSION_1_3 = !_glewInit_GL_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_3 */ +#ifdef GL_VERSION_1_4 + if (glewExperimental || GLEW_VERSION_1_4) GLEW_VERSION_1_4 = !_glewInit_GL_VERSION_1_4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_4 */ +#ifdef GL_VERSION_1_5 + if (glewExperimental || GLEW_VERSION_1_5) GLEW_VERSION_1_5 = !_glewInit_GL_VERSION_1_5(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_1_5 */ +#ifdef GL_VERSION_2_0 + if (glewExperimental || GLEW_VERSION_2_0) GLEW_VERSION_2_0 = !_glewInit_GL_VERSION_2_0(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_VERSION_2_0 */ +#ifdef GL_3DFX_multisample + GLEW_3DFX_multisample = glewGetExtension("GL_3DFX_multisample"); +#endif /* GL_3DFX_multisample */ +#ifdef GL_3DFX_tbuffer + GLEW_3DFX_tbuffer = glewGetExtension("GL_3DFX_tbuffer"); + if (glewExperimental || GLEW_3DFX_tbuffer) GLEW_3DFX_tbuffer = !_glewInit_GL_3DFX_tbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_3DFX_tbuffer */ +#ifdef GL_3DFX_texture_compression_FXT1 + GLEW_3DFX_texture_compression_FXT1 = glewGetExtension("GL_3DFX_texture_compression_FXT1"); +#endif /* GL_3DFX_texture_compression_FXT1 */ +#ifdef GL_APPLE_client_storage + GLEW_APPLE_client_storage = glewGetExtension("GL_APPLE_client_storage"); +#endif /* GL_APPLE_client_storage */ +#ifdef GL_APPLE_element_array + GLEW_APPLE_element_array = glewGetExtension("GL_APPLE_element_array"); + if (glewExperimental || GLEW_APPLE_element_array) GLEW_APPLE_element_array = !_glewInit_GL_APPLE_element_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_element_array */ +#ifdef GL_APPLE_fence + GLEW_APPLE_fence = glewGetExtension("GL_APPLE_fence"); + if (glewExperimental || GLEW_APPLE_fence) GLEW_APPLE_fence = !_glewInit_GL_APPLE_fence(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_fence */ +#ifdef GL_APPLE_float_pixels + GLEW_APPLE_float_pixels = glewGetExtension("GL_APPLE_float_pixels"); +#endif /* GL_APPLE_float_pixels */ +#ifdef GL_APPLE_pixel_buffer + GLEW_APPLE_pixel_buffer = glewGetExtension("GL_APPLE_pixel_buffer"); +#endif /* GL_APPLE_pixel_buffer */ +#ifdef GL_APPLE_specular_vector + GLEW_APPLE_specular_vector = glewGetExtension("GL_APPLE_specular_vector"); +#endif /* GL_APPLE_specular_vector */ +#ifdef GL_APPLE_texture_range + GLEW_APPLE_texture_range = glewGetExtension("GL_APPLE_texture_range"); + if (glewExperimental || GLEW_APPLE_texture_range) GLEW_APPLE_texture_range = !_glewInit_GL_APPLE_texture_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_texture_range */ +#ifdef GL_APPLE_transform_hint + GLEW_APPLE_transform_hint = glewGetExtension("GL_APPLE_transform_hint"); +#endif /* GL_APPLE_transform_hint */ +#ifdef GL_APPLE_vertex_array_object + GLEW_APPLE_vertex_array_object = glewGetExtension("GL_APPLE_vertex_array_object"); + if (glewExperimental || GLEW_APPLE_vertex_array_object) GLEW_APPLE_vertex_array_object = !_glewInit_GL_APPLE_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_vertex_array_object */ +#ifdef GL_APPLE_vertex_array_range + GLEW_APPLE_vertex_array_range = glewGetExtension("GL_APPLE_vertex_array_range"); + if (glewExperimental || GLEW_APPLE_vertex_array_range) GLEW_APPLE_vertex_array_range = !_glewInit_GL_APPLE_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_APPLE_vertex_array_range */ +#ifdef GL_APPLE_ycbcr_422 + GLEW_APPLE_ycbcr_422 = glewGetExtension("GL_APPLE_ycbcr_422"); +#endif /* GL_APPLE_ycbcr_422 */ +#ifdef GL_ARB_color_buffer_float + GLEW_ARB_color_buffer_float = glewGetExtension("GL_ARB_color_buffer_float"); + if (glewExperimental || GLEW_ARB_color_buffer_float) GLEW_ARB_color_buffer_float = !_glewInit_GL_ARB_color_buffer_float(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_color_buffer_float */ +#ifdef GL_ARB_depth_texture + GLEW_ARB_depth_texture = glewGetExtension("GL_ARB_depth_texture"); +#endif /* GL_ARB_depth_texture */ +#ifdef GL_ARB_draw_buffers + GLEW_ARB_draw_buffers = glewGetExtension("GL_ARB_draw_buffers"); + if (glewExperimental || GLEW_ARB_draw_buffers) GLEW_ARB_draw_buffers = !_glewInit_GL_ARB_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_draw_buffers */ +#ifdef GL_ARB_fragment_program + GLEW_ARB_fragment_program = glewGetExtension("GL_ARB_fragment_program"); +#endif /* GL_ARB_fragment_program */ +#ifdef GL_ARB_fragment_program_shadow + GLEW_ARB_fragment_program_shadow = glewGetExtension("GL_ARB_fragment_program_shadow"); +#endif /* GL_ARB_fragment_program_shadow */ +#ifdef GL_ARB_fragment_shader + GLEW_ARB_fragment_shader = glewGetExtension("GL_ARB_fragment_shader"); +#endif /* GL_ARB_fragment_shader */ +#ifdef GL_ARB_half_float_pixel + GLEW_ARB_half_float_pixel = glewGetExtension("GL_ARB_half_float_pixel"); +#endif /* GL_ARB_half_float_pixel */ +#ifdef GL_ARB_imaging + GLEW_ARB_imaging = glewGetExtension("GL_ARB_imaging"); + if (glewExperimental || GLEW_ARB_imaging) GLEW_ARB_imaging = !_glewInit_GL_ARB_imaging(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_imaging */ +#ifdef GL_ARB_matrix_palette + GLEW_ARB_matrix_palette = glewGetExtension("GL_ARB_matrix_palette"); + if (glewExperimental || GLEW_ARB_matrix_palette) GLEW_ARB_matrix_palette = !_glewInit_GL_ARB_matrix_palette(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_matrix_palette */ +#ifdef GL_ARB_multisample + GLEW_ARB_multisample = glewGetExtension("GL_ARB_multisample"); + if (glewExperimental || GLEW_ARB_multisample) GLEW_ARB_multisample = !_glewInit_GL_ARB_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_multisample */ +#ifdef GL_ARB_multitexture + GLEW_ARB_multitexture = glewGetExtension("GL_ARB_multitexture"); + if (glewExperimental || GLEW_ARB_multitexture) GLEW_ARB_multitexture = !_glewInit_GL_ARB_multitexture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_multitexture */ +#ifdef GL_ARB_occlusion_query + GLEW_ARB_occlusion_query = glewGetExtension("GL_ARB_occlusion_query"); + if (glewExperimental || GLEW_ARB_occlusion_query) GLEW_ARB_occlusion_query = !_glewInit_GL_ARB_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_occlusion_query */ +#ifdef GL_ARB_pixel_buffer_object + GLEW_ARB_pixel_buffer_object = glewGetExtension("GL_ARB_pixel_buffer_object"); +#endif /* GL_ARB_pixel_buffer_object */ +#ifdef GL_ARB_point_parameters + GLEW_ARB_point_parameters = glewGetExtension("GL_ARB_point_parameters"); + if (glewExperimental || GLEW_ARB_point_parameters) GLEW_ARB_point_parameters = !_glewInit_GL_ARB_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_point_parameters */ +#ifdef GL_ARB_point_sprite + GLEW_ARB_point_sprite = glewGetExtension("GL_ARB_point_sprite"); +#endif /* GL_ARB_point_sprite */ +#ifdef GL_ARB_shader_objects + GLEW_ARB_shader_objects = glewGetExtension("GL_ARB_shader_objects"); + if (glewExperimental || GLEW_ARB_shader_objects) GLEW_ARB_shader_objects = !_glewInit_GL_ARB_shader_objects(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_shader_objects */ +#ifdef GL_ARB_shading_language_100 + GLEW_ARB_shading_language_100 = glewGetExtension("GL_ARB_shading_language_100"); +#endif /* GL_ARB_shading_language_100 */ +#ifdef GL_ARB_shadow + GLEW_ARB_shadow = glewGetExtension("GL_ARB_shadow"); +#endif /* GL_ARB_shadow */ +#ifdef GL_ARB_shadow_ambient + GLEW_ARB_shadow_ambient = glewGetExtension("GL_ARB_shadow_ambient"); +#endif /* GL_ARB_shadow_ambient */ +#ifdef GL_ARB_texture_border_clamp + GLEW_ARB_texture_border_clamp = glewGetExtension("GL_ARB_texture_border_clamp"); +#endif /* GL_ARB_texture_border_clamp */ +#ifdef GL_ARB_texture_compression + GLEW_ARB_texture_compression = glewGetExtension("GL_ARB_texture_compression"); + if (glewExperimental || GLEW_ARB_texture_compression) GLEW_ARB_texture_compression = !_glewInit_GL_ARB_texture_compression(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_texture_compression */ +#ifdef GL_ARB_texture_cube_map + GLEW_ARB_texture_cube_map = glewGetExtension("GL_ARB_texture_cube_map"); +#endif /* GL_ARB_texture_cube_map */ +#ifdef GL_ARB_texture_env_add + GLEW_ARB_texture_env_add = glewGetExtension("GL_ARB_texture_env_add"); +#endif /* GL_ARB_texture_env_add */ +#ifdef GL_ARB_texture_env_combine + GLEW_ARB_texture_env_combine = glewGetExtension("GL_ARB_texture_env_combine"); +#endif /* GL_ARB_texture_env_combine */ +#ifdef GL_ARB_texture_env_crossbar + GLEW_ARB_texture_env_crossbar = glewGetExtension("GL_ARB_texture_env_crossbar"); +#endif /* GL_ARB_texture_env_crossbar */ +#ifdef GL_ARB_texture_env_dot3 + GLEW_ARB_texture_env_dot3 = glewGetExtension("GL_ARB_texture_env_dot3"); +#endif /* GL_ARB_texture_env_dot3 */ +#ifdef GL_ARB_texture_float + GLEW_ARB_texture_float = glewGetExtension("GL_ARB_texture_float"); +#endif /* GL_ARB_texture_float */ +#ifdef GL_ARB_texture_mirrored_repeat + GLEW_ARB_texture_mirrored_repeat = glewGetExtension("GL_ARB_texture_mirrored_repeat"); +#endif /* GL_ARB_texture_mirrored_repeat */ +#ifdef GL_ARB_texture_non_power_of_two + GLEW_ARB_texture_non_power_of_two = glewGetExtension("GL_ARB_texture_non_power_of_two"); +#endif /* GL_ARB_texture_non_power_of_two */ +#ifdef GL_ARB_texture_rectangle + GLEW_ARB_texture_rectangle = glewGetExtension("GL_ARB_texture_rectangle"); +#endif /* GL_ARB_texture_rectangle */ +#ifdef GL_ARB_transpose_matrix + GLEW_ARB_transpose_matrix = glewGetExtension("GL_ARB_transpose_matrix"); + if (glewExperimental || GLEW_ARB_transpose_matrix) GLEW_ARB_transpose_matrix = !_glewInit_GL_ARB_transpose_matrix(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_transpose_matrix */ +#ifdef GL_ARB_vertex_blend + GLEW_ARB_vertex_blend = glewGetExtension("GL_ARB_vertex_blend"); + if (glewExperimental || GLEW_ARB_vertex_blend) GLEW_ARB_vertex_blend = !_glewInit_GL_ARB_vertex_blend(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_blend */ +#ifdef GL_ARB_vertex_buffer_object + GLEW_ARB_vertex_buffer_object = glewGetExtension("GL_ARB_vertex_buffer_object"); + if (glewExperimental || GLEW_ARB_vertex_buffer_object) GLEW_ARB_vertex_buffer_object = !_glewInit_GL_ARB_vertex_buffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_buffer_object */ +#ifdef GL_ARB_vertex_program + GLEW_ARB_vertex_program = glewGetExtension("GL_ARB_vertex_program"); + if (glewExperimental || GLEW_ARB_vertex_program) GLEW_ARB_vertex_program = !_glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_vertex_program */ +#ifdef GL_ARB_vertex_shader + GLEW_ARB_vertex_shader = glewGetExtension("GL_ARB_vertex_shader"); + if (glewExperimental || GLEW_ARB_vertex_shader) { GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); _glewInit_GL_ARB_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); } +#endif /* GL_ARB_vertex_shader */ +#ifdef GL_ARB_window_pos + GLEW_ARB_window_pos = glewGetExtension("GL_ARB_window_pos"); + if (glewExperimental || GLEW_ARB_window_pos) GLEW_ARB_window_pos = !_glewInit_GL_ARB_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ARB_window_pos */ +#ifdef GL_ATIX_point_sprites + GLEW_ATIX_point_sprites = glewGetExtension("GL_ATIX_point_sprites"); +#endif /* GL_ATIX_point_sprites */ +#ifdef GL_ATIX_texture_env_combine3 + GLEW_ATIX_texture_env_combine3 = glewGetExtension("GL_ATIX_texture_env_combine3"); +#endif /* GL_ATIX_texture_env_combine3 */ +#ifdef GL_ATIX_texture_env_route + GLEW_ATIX_texture_env_route = glewGetExtension("GL_ATIX_texture_env_route"); +#endif /* GL_ATIX_texture_env_route */ +#ifdef GL_ATIX_vertex_shader_output_point_size + GLEW_ATIX_vertex_shader_output_point_size = glewGetExtension("GL_ATIX_vertex_shader_output_point_size"); +#endif /* GL_ATIX_vertex_shader_output_point_size */ +#ifdef GL_ATI_draw_buffers + GLEW_ATI_draw_buffers = glewGetExtension("GL_ATI_draw_buffers"); + if (glewExperimental || GLEW_ATI_draw_buffers) GLEW_ATI_draw_buffers = !_glewInit_GL_ATI_draw_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_draw_buffers */ +#ifdef GL_ATI_element_array + GLEW_ATI_element_array = glewGetExtension("GL_ATI_element_array"); + if (glewExperimental || GLEW_ATI_element_array) GLEW_ATI_element_array = !_glewInit_GL_ATI_element_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_element_array */ +#ifdef GL_ATI_envmap_bumpmap + GLEW_ATI_envmap_bumpmap = glewGetExtension("GL_ATI_envmap_bumpmap"); + if (glewExperimental || GLEW_ATI_envmap_bumpmap) GLEW_ATI_envmap_bumpmap = !_glewInit_GL_ATI_envmap_bumpmap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_envmap_bumpmap */ +#ifdef GL_ATI_fragment_shader + GLEW_ATI_fragment_shader = glewGetExtension("GL_ATI_fragment_shader"); + if (glewExperimental || GLEW_ATI_fragment_shader) GLEW_ATI_fragment_shader = !_glewInit_GL_ATI_fragment_shader(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_fragment_shader */ +#ifdef GL_ATI_map_object_buffer + GLEW_ATI_map_object_buffer = glewGetExtension("GL_ATI_map_object_buffer"); + if (glewExperimental || GLEW_ATI_map_object_buffer) GLEW_ATI_map_object_buffer = !_glewInit_GL_ATI_map_object_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_map_object_buffer */ +#ifdef GL_ATI_pn_triangles + GLEW_ATI_pn_triangles = glewGetExtension("GL_ATI_pn_triangles"); + if (glewExperimental || GLEW_ATI_pn_triangles) GLEW_ATI_pn_triangles = !_glewInit_GL_ATI_pn_triangles(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_pn_triangles */ +#ifdef GL_ATI_separate_stencil + GLEW_ATI_separate_stencil = glewGetExtension("GL_ATI_separate_stencil"); + if (glewExperimental || GLEW_ATI_separate_stencil) GLEW_ATI_separate_stencil = !_glewInit_GL_ATI_separate_stencil(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_separate_stencil */ +#ifdef GL_ATI_text_fragment_shader + GLEW_ATI_text_fragment_shader = glewGetExtension("GL_ATI_text_fragment_shader"); +#endif /* GL_ATI_text_fragment_shader */ +#ifdef GL_ATI_texture_compression_3dc + GLEW_ATI_texture_compression_3dc = glewGetExtension("GL_ATI_texture_compression_3dc"); +#endif /* GL_ATI_texture_compression_3dc */ +#ifdef GL_ATI_texture_env_combine3 + GLEW_ATI_texture_env_combine3 = glewGetExtension("GL_ATI_texture_env_combine3"); +#endif /* GL_ATI_texture_env_combine3 */ +#ifdef GL_ATI_texture_float + GLEW_ATI_texture_float = glewGetExtension("GL_ATI_texture_float"); +#endif /* GL_ATI_texture_float */ +#ifdef GL_ATI_texture_mirror_once + GLEW_ATI_texture_mirror_once = glewGetExtension("GL_ATI_texture_mirror_once"); +#endif /* GL_ATI_texture_mirror_once */ +#ifdef GL_ATI_vertex_array_object + GLEW_ATI_vertex_array_object = glewGetExtension("GL_ATI_vertex_array_object"); + if (glewExperimental || GLEW_ATI_vertex_array_object) GLEW_ATI_vertex_array_object = !_glewInit_GL_ATI_vertex_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_vertex_array_object */ +#ifdef GL_ATI_vertex_attrib_array_object + GLEW_ATI_vertex_attrib_array_object = glewGetExtension("GL_ATI_vertex_attrib_array_object"); + if (glewExperimental || GLEW_ATI_vertex_attrib_array_object) GLEW_ATI_vertex_attrib_array_object = !_glewInit_GL_ATI_vertex_attrib_array_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_vertex_attrib_array_object */ +#ifdef GL_ATI_vertex_streams + GLEW_ATI_vertex_streams = glewGetExtension("GL_ATI_vertex_streams"); + if (glewExperimental || GLEW_ATI_vertex_streams) GLEW_ATI_vertex_streams = !_glewInit_GL_ATI_vertex_streams(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_ATI_vertex_streams */ +#ifdef GL_EXT_422_pixels + GLEW_EXT_422_pixels = glewGetExtension("GL_EXT_422_pixels"); +#endif /* GL_EXT_422_pixels */ +#ifdef GL_EXT_Cg_shader + GLEW_EXT_Cg_shader = glewGetExtension("GL_EXT_Cg_shader"); +#endif /* GL_EXT_Cg_shader */ +#ifdef GL_EXT_abgr + GLEW_EXT_abgr = glewGetExtension("GL_EXT_abgr"); +#endif /* GL_EXT_abgr */ +#ifdef GL_EXT_bgra + GLEW_EXT_bgra = glewGetExtension("GL_EXT_bgra"); +#endif /* GL_EXT_bgra */ +#ifdef GL_EXT_blend_color + GLEW_EXT_blend_color = glewGetExtension("GL_EXT_blend_color"); + if (glewExperimental || GLEW_EXT_blend_color) GLEW_EXT_blend_color = !_glewInit_GL_EXT_blend_color(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_color */ +#ifdef GL_EXT_blend_equation_separate + GLEW_EXT_blend_equation_separate = glewGetExtension("GL_EXT_blend_equation_separate"); + if (glewExperimental || GLEW_EXT_blend_equation_separate) GLEW_EXT_blend_equation_separate = !_glewInit_GL_EXT_blend_equation_separate(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_equation_separate */ +#ifdef GL_EXT_blend_func_separate + GLEW_EXT_blend_func_separate = glewGetExtension("GL_EXT_blend_func_separate"); + if (glewExperimental || GLEW_EXT_blend_func_separate) GLEW_EXT_blend_func_separate = !_glewInit_GL_EXT_blend_func_separate(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_func_separate */ +#ifdef GL_EXT_blend_logic_op + GLEW_EXT_blend_logic_op = glewGetExtension("GL_EXT_blend_logic_op"); +#endif /* GL_EXT_blend_logic_op */ +#ifdef GL_EXT_blend_minmax + GLEW_EXT_blend_minmax = glewGetExtension("GL_EXT_blend_minmax"); + if (glewExperimental || GLEW_EXT_blend_minmax) GLEW_EXT_blend_minmax = !_glewInit_GL_EXT_blend_minmax(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_blend_minmax */ +#ifdef GL_EXT_blend_subtract + GLEW_EXT_blend_subtract = glewGetExtension("GL_EXT_blend_subtract"); +#endif /* GL_EXT_blend_subtract */ +#ifdef GL_EXT_clip_volume_hint + GLEW_EXT_clip_volume_hint = glewGetExtension("GL_EXT_clip_volume_hint"); +#endif /* GL_EXT_clip_volume_hint */ +#ifdef GL_EXT_cmyka + GLEW_EXT_cmyka = glewGetExtension("GL_EXT_cmyka"); +#endif /* GL_EXT_cmyka */ +#ifdef GL_EXT_color_subtable + GLEW_EXT_color_subtable = glewGetExtension("GL_EXT_color_subtable"); + if (glewExperimental || GLEW_EXT_color_subtable) GLEW_EXT_color_subtable = !_glewInit_GL_EXT_color_subtable(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_color_subtable */ +#ifdef GL_EXT_compiled_vertex_array + GLEW_EXT_compiled_vertex_array = glewGetExtension("GL_EXT_compiled_vertex_array"); + if (glewExperimental || GLEW_EXT_compiled_vertex_array) GLEW_EXT_compiled_vertex_array = !_glewInit_GL_EXT_compiled_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_compiled_vertex_array */ +#ifdef GL_EXT_convolution + GLEW_EXT_convolution = glewGetExtension("GL_EXT_convolution"); + if (glewExperimental || GLEW_EXT_convolution) GLEW_EXT_convolution = !_glewInit_GL_EXT_convolution(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_convolution */ +#ifdef GL_EXT_coordinate_frame + GLEW_EXT_coordinate_frame = glewGetExtension("GL_EXT_coordinate_frame"); + if (glewExperimental || GLEW_EXT_coordinate_frame) GLEW_EXT_coordinate_frame = !_glewInit_GL_EXT_coordinate_frame(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_coordinate_frame */ +#ifdef GL_EXT_copy_texture + GLEW_EXT_copy_texture = glewGetExtension("GL_EXT_copy_texture"); + if (glewExperimental || GLEW_EXT_copy_texture) GLEW_EXT_copy_texture = !_glewInit_GL_EXT_copy_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_copy_texture */ +#ifdef GL_EXT_cull_vertex + GLEW_EXT_cull_vertex = glewGetExtension("GL_EXT_cull_vertex"); + if (glewExperimental || GLEW_EXT_cull_vertex) GLEW_EXT_cull_vertex = !_glewInit_GL_EXT_cull_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_cull_vertex */ +#ifdef GL_EXT_depth_bounds_test + GLEW_EXT_depth_bounds_test = glewGetExtension("GL_EXT_depth_bounds_test"); + if (glewExperimental || GLEW_EXT_depth_bounds_test) GLEW_EXT_depth_bounds_test = !_glewInit_GL_EXT_depth_bounds_test(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_depth_bounds_test */ +#ifdef GL_EXT_draw_range_elements + GLEW_EXT_draw_range_elements = glewGetExtension("GL_EXT_draw_range_elements"); + if (glewExperimental || GLEW_EXT_draw_range_elements) GLEW_EXT_draw_range_elements = !_glewInit_GL_EXT_draw_range_elements(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_draw_range_elements */ +#ifdef GL_EXT_fog_coord + GLEW_EXT_fog_coord = glewGetExtension("GL_EXT_fog_coord"); + if (glewExperimental || GLEW_EXT_fog_coord) GLEW_EXT_fog_coord = !_glewInit_GL_EXT_fog_coord(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_fog_coord */ +#ifdef GL_EXT_fragment_lighting + GLEW_EXT_fragment_lighting = glewGetExtension("GL_EXT_fragment_lighting"); + if (glewExperimental || GLEW_EXT_fragment_lighting) GLEW_EXT_fragment_lighting = !_glewInit_GL_EXT_fragment_lighting(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_fragment_lighting */ +#ifdef GL_EXT_framebuffer_blit + GLEW_EXT_framebuffer_blit = glewGetExtension("GL_EXT_framebuffer_blit"); + if (glewExperimental || GLEW_EXT_framebuffer_blit) GLEW_EXT_framebuffer_blit = !_glewInit_GL_EXT_framebuffer_blit(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_framebuffer_blit */ +#ifdef GL_EXT_framebuffer_multisample + GLEW_EXT_framebuffer_multisample = glewGetExtension("GL_EXT_framebuffer_multisample"); + if (glewExperimental || GLEW_EXT_framebuffer_multisample) GLEW_EXT_framebuffer_multisample = !_glewInit_GL_EXT_framebuffer_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_framebuffer_multisample */ +#ifdef GL_EXT_framebuffer_object + GLEW_EXT_framebuffer_object = glewGetExtension("GL_EXT_framebuffer_object"); + if (glewExperimental || GLEW_EXT_framebuffer_object) GLEW_EXT_framebuffer_object = !_glewInit_GL_EXT_framebuffer_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_framebuffer_object */ +#ifdef GL_EXT_histogram + GLEW_EXT_histogram = glewGetExtension("GL_EXT_histogram"); + if (glewExperimental || GLEW_EXT_histogram) GLEW_EXT_histogram = !_glewInit_GL_EXT_histogram(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_histogram */ +#ifdef GL_EXT_index_array_formats + GLEW_EXT_index_array_formats = glewGetExtension("GL_EXT_index_array_formats"); +#endif /* GL_EXT_index_array_formats */ +#ifdef GL_EXT_index_func + GLEW_EXT_index_func = glewGetExtension("GL_EXT_index_func"); + if (glewExperimental || GLEW_EXT_index_func) GLEW_EXT_index_func = !_glewInit_GL_EXT_index_func(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_index_func */ +#ifdef GL_EXT_index_material + GLEW_EXT_index_material = glewGetExtension("GL_EXT_index_material"); + if (glewExperimental || GLEW_EXT_index_material) GLEW_EXT_index_material = !_glewInit_GL_EXT_index_material(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_index_material */ +#ifdef GL_EXT_index_texture + GLEW_EXT_index_texture = glewGetExtension("GL_EXT_index_texture"); +#endif /* GL_EXT_index_texture */ +#ifdef GL_EXT_light_texture + GLEW_EXT_light_texture = glewGetExtension("GL_EXT_light_texture"); + if (glewExperimental || GLEW_EXT_light_texture) GLEW_EXT_light_texture = !_glewInit_GL_EXT_light_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_light_texture */ +#ifdef GL_EXT_misc_attribute + GLEW_EXT_misc_attribute = glewGetExtension("GL_EXT_misc_attribute"); +#endif /* GL_EXT_misc_attribute */ +#ifdef GL_EXT_multi_draw_arrays + GLEW_EXT_multi_draw_arrays = glewGetExtension("GL_EXT_multi_draw_arrays"); + if (glewExperimental || GLEW_EXT_multi_draw_arrays) GLEW_EXT_multi_draw_arrays = !_glewInit_GL_EXT_multi_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_multi_draw_arrays */ +#ifdef GL_EXT_multisample + GLEW_EXT_multisample = glewGetExtension("GL_EXT_multisample"); + if (glewExperimental || GLEW_EXT_multisample) GLEW_EXT_multisample = !_glewInit_GL_EXT_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_multisample */ +#ifdef GL_EXT_packed_depth_stencil + GLEW_EXT_packed_depth_stencil = glewGetExtension("GL_EXT_packed_depth_stencil"); +#endif /* GL_EXT_packed_depth_stencil */ +#ifdef GL_EXT_packed_pixels + GLEW_EXT_packed_pixels = glewGetExtension("GL_EXT_packed_pixels"); +#endif /* GL_EXT_packed_pixels */ +#ifdef GL_EXT_paletted_texture + GLEW_EXT_paletted_texture = glewGetExtension("GL_EXT_paletted_texture"); + if (glewExperimental || GLEW_EXT_paletted_texture) GLEW_EXT_paletted_texture = !_glewInit_GL_EXT_paletted_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_paletted_texture */ +#ifdef GL_EXT_pixel_buffer_object + GLEW_EXT_pixel_buffer_object = glewGetExtension("GL_EXT_pixel_buffer_object"); +#endif /* GL_EXT_pixel_buffer_object */ +#ifdef GL_EXT_pixel_transform + GLEW_EXT_pixel_transform = glewGetExtension("GL_EXT_pixel_transform"); + if (glewExperimental || GLEW_EXT_pixel_transform) GLEW_EXT_pixel_transform = !_glewInit_GL_EXT_pixel_transform(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_pixel_transform */ +#ifdef GL_EXT_pixel_transform_color_table + GLEW_EXT_pixel_transform_color_table = glewGetExtension("GL_EXT_pixel_transform_color_table"); +#endif /* GL_EXT_pixel_transform_color_table */ +#ifdef GL_EXT_point_parameters + GLEW_EXT_point_parameters = glewGetExtension("GL_EXT_point_parameters"); + if (glewExperimental || GLEW_EXT_point_parameters) GLEW_EXT_point_parameters = !_glewInit_GL_EXT_point_parameters(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_point_parameters */ +#ifdef GL_EXT_polygon_offset + GLEW_EXT_polygon_offset = glewGetExtension("GL_EXT_polygon_offset"); + if (glewExperimental || GLEW_EXT_polygon_offset) GLEW_EXT_polygon_offset = !_glewInit_GL_EXT_polygon_offset(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_polygon_offset */ +#ifdef GL_EXT_rescale_normal + GLEW_EXT_rescale_normal = glewGetExtension("GL_EXT_rescale_normal"); +#endif /* GL_EXT_rescale_normal */ +#ifdef GL_EXT_scene_marker + GLEW_EXT_scene_marker = glewGetExtension("GL_EXT_scene_marker"); + if (glewExperimental || GLEW_EXT_scene_marker) GLEW_EXT_scene_marker = !_glewInit_GL_EXT_scene_marker(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_scene_marker */ +#ifdef GL_EXT_secondary_color + GLEW_EXT_secondary_color = glewGetExtension("GL_EXT_secondary_color"); + if (glewExperimental || GLEW_EXT_secondary_color) GLEW_EXT_secondary_color = !_glewInit_GL_EXT_secondary_color(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_secondary_color */ +#ifdef GL_EXT_separate_specular_color + GLEW_EXT_separate_specular_color = glewGetExtension("GL_EXT_separate_specular_color"); +#endif /* GL_EXT_separate_specular_color */ +#ifdef GL_EXT_shadow_funcs + GLEW_EXT_shadow_funcs = glewGetExtension("GL_EXT_shadow_funcs"); +#endif /* GL_EXT_shadow_funcs */ +#ifdef GL_EXT_shared_texture_palette + GLEW_EXT_shared_texture_palette = glewGetExtension("GL_EXT_shared_texture_palette"); +#endif /* GL_EXT_shared_texture_palette */ +#ifdef GL_EXT_stencil_clear_tag + GLEW_EXT_stencil_clear_tag = glewGetExtension("GL_EXT_stencil_clear_tag"); +#endif /* GL_EXT_stencil_clear_tag */ +#ifdef GL_EXT_stencil_two_side + GLEW_EXT_stencil_two_side = glewGetExtension("GL_EXT_stencil_two_side"); + if (glewExperimental || GLEW_EXT_stencil_two_side) GLEW_EXT_stencil_two_side = !_glewInit_GL_EXT_stencil_two_side(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_stencil_two_side */ +#ifdef GL_EXT_stencil_wrap + GLEW_EXT_stencil_wrap = glewGetExtension("GL_EXT_stencil_wrap"); +#endif /* GL_EXT_stencil_wrap */ +#ifdef GL_EXT_subtexture + GLEW_EXT_subtexture = glewGetExtension("GL_EXT_subtexture"); + if (glewExperimental || GLEW_EXT_subtexture) GLEW_EXT_subtexture = !_glewInit_GL_EXT_subtexture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_subtexture */ +#ifdef GL_EXT_texture + GLEW_EXT_texture = glewGetExtension("GL_EXT_texture"); +#endif /* GL_EXT_texture */ +#ifdef GL_EXT_texture3D + GLEW_EXT_texture3D = glewGetExtension("GL_EXT_texture3D"); + if (glewExperimental || GLEW_EXT_texture3D) GLEW_EXT_texture3D = !_glewInit_GL_EXT_texture3D(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture3D */ +#ifdef GL_EXT_texture_compression_dxt1 + GLEW_EXT_texture_compression_dxt1 = glewGetExtension("GL_EXT_texture_compression_dxt1"); +#endif /* GL_EXT_texture_compression_dxt1 */ +#ifdef GL_EXT_texture_compression_s3tc + GLEW_EXT_texture_compression_s3tc = glewGetExtension("GL_EXT_texture_compression_s3tc"); +#endif /* GL_EXT_texture_compression_s3tc */ +#ifdef GL_EXT_texture_cube_map + GLEW_EXT_texture_cube_map = glewGetExtension("GL_EXT_texture_cube_map"); +#endif /* GL_EXT_texture_cube_map */ +#ifdef GL_EXT_texture_edge_clamp + GLEW_EXT_texture_edge_clamp = glewGetExtension("GL_EXT_texture_edge_clamp"); +#endif /* GL_EXT_texture_edge_clamp */ +#ifdef GL_EXT_texture_env + GLEW_EXT_texture_env = glewGetExtension("GL_EXT_texture_env"); +#endif /* GL_EXT_texture_env */ +#ifdef GL_EXT_texture_env_add + GLEW_EXT_texture_env_add = glewGetExtension("GL_EXT_texture_env_add"); +#endif /* GL_EXT_texture_env_add */ +#ifdef GL_EXT_texture_env_combine + GLEW_EXT_texture_env_combine = glewGetExtension("GL_EXT_texture_env_combine"); +#endif /* GL_EXT_texture_env_combine */ +#ifdef GL_EXT_texture_env_dot3 + GLEW_EXT_texture_env_dot3 = glewGetExtension("GL_EXT_texture_env_dot3"); +#endif /* GL_EXT_texture_env_dot3 */ +#ifdef GL_EXT_texture_filter_anisotropic + GLEW_EXT_texture_filter_anisotropic = glewGetExtension("GL_EXT_texture_filter_anisotropic"); +#endif /* GL_EXT_texture_filter_anisotropic */ +#ifdef GL_EXT_texture_lod_bias + GLEW_EXT_texture_lod_bias = glewGetExtension("GL_EXT_texture_lod_bias"); +#endif /* GL_EXT_texture_lod_bias */ +#ifdef GL_EXT_texture_mirror_clamp + GLEW_EXT_texture_mirror_clamp = glewGetExtension("GL_EXT_texture_mirror_clamp"); +#endif /* GL_EXT_texture_mirror_clamp */ +#ifdef GL_EXT_texture_object + GLEW_EXT_texture_object = glewGetExtension("GL_EXT_texture_object"); + if (glewExperimental || GLEW_EXT_texture_object) GLEW_EXT_texture_object = !_glewInit_GL_EXT_texture_object(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_object */ +#ifdef GL_EXT_texture_perturb_normal + GLEW_EXT_texture_perturb_normal = glewGetExtension("GL_EXT_texture_perturb_normal"); + if (glewExperimental || GLEW_EXT_texture_perturb_normal) GLEW_EXT_texture_perturb_normal = !_glewInit_GL_EXT_texture_perturb_normal(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_texture_perturb_normal */ +#ifdef GL_EXT_texture_rectangle + GLEW_EXT_texture_rectangle = glewGetExtension("GL_EXT_texture_rectangle"); +#endif /* GL_EXT_texture_rectangle */ +#ifdef GL_EXT_texture_sRGB + GLEW_EXT_texture_sRGB = glewGetExtension("GL_EXT_texture_sRGB"); +#endif /* GL_EXT_texture_sRGB */ +#ifdef GL_EXT_vertex_array + GLEW_EXT_vertex_array = glewGetExtension("GL_EXT_vertex_array"); + if (glewExperimental || GLEW_EXT_vertex_array) GLEW_EXT_vertex_array = !_glewInit_GL_EXT_vertex_array(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_array */ +#ifdef GL_EXT_vertex_shader + GLEW_EXT_vertex_shader = glewGetExtension("GL_EXT_vertex_shader"); + if (glewExperimental || GLEW_EXT_vertex_shader) GLEW_EXT_vertex_shader = !_glewInit_GL_EXT_vertex_shader(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_shader */ +#ifdef GL_EXT_vertex_weighting + GLEW_EXT_vertex_weighting = glewGetExtension("GL_EXT_vertex_weighting"); + if (glewExperimental || GLEW_EXT_vertex_weighting) GLEW_EXT_vertex_weighting = !_glewInit_GL_EXT_vertex_weighting(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_EXT_vertex_weighting */ +#ifdef GL_GREMEDY_string_marker + GLEW_GREMEDY_string_marker = glewGetExtension("GL_GREMEDY_string_marker"); + if (glewExperimental || GLEW_GREMEDY_string_marker) GLEW_GREMEDY_string_marker = !_glewInit_GL_GREMEDY_string_marker(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_GREMEDY_string_marker */ +#ifdef GL_HP_convolution_border_modes + GLEW_HP_convolution_border_modes = glewGetExtension("GL_HP_convolution_border_modes"); +#endif /* GL_HP_convolution_border_modes */ +#ifdef GL_HP_image_transform + GLEW_HP_image_transform = glewGetExtension("GL_HP_image_transform"); + if (glewExperimental || GLEW_HP_image_transform) GLEW_HP_image_transform = !_glewInit_GL_HP_image_transform(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_HP_image_transform */ +#ifdef GL_HP_occlusion_test + GLEW_HP_occlusion_test = glewGetExtension("GL_HP_occlusion_test"); +#endif /* GL_HP_occlusion_test */ +#ifdef GL_HP_texture_lighting + GLEW_HP_texture_lighting = glewGetExtension("GL_HP_texture_lighting"); +#endif /* GL_HP_texture_lighting */ +#ifdef GL_IBM_cull_vertex + GLEW_IBM_cull_vertex = glewGetExtension("GL_IBM_cull_vertex"); +#endif /* GL_IBM_cull_vertex */ +#ifdef GL_IBM_multimode_draw_arrays + GLEW_IBM_multimode_draw_arrays = glewGetExtension("GL_IBM_multimode_draw_arrays"); + if (glewExperimental || GLEW_IBM_multimode_draw_arrays) GLEW_IBM_multimode_draw_arrays = !_glewInit_GL_IBM_multimode_draw_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_IBM_multimode_draw_arrays */ +#ifdef GL_IBM_rasterpos_clip + GLEW_IBM_rasterpos_clip = glewGetExtension("GL_IBM_rasterpos_clip"); +#endif /* GL_IBM_rasterpos_clip */ +#ifdef GL_IBM_static_data + GLEW_IBM_static_data = glewGetExtension("GL_IBM_static_data"); +#endif /* GL_IBM_static_data */ +#ifdef GL_IBM_texture_mirrored_repeat + GLEW_IBM_texture_mirrored_repeat = glewGetExtension("GL_IBM_texture_mirrored_repeat"); +#endif /* GL_IBM_texture_mirrored_repeat */ +#ifdef GL_IBM_vertex_array_lists + GLEW_IBM_vertex_array_lists = glewGetExtension("GL_IBM_vertex_array_lists"); + if (glewExperimental || GLEW_IBM_vertex_array_lists) GLEW_IBM_vertex_array_lists = !_glewInit_GL_IBM_vertex_array_lists(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_IBM_vertex_array_lists */ +#ifdef GL_INGR_color_clamp + GLEW_INGR_color_clamp = glewGetExtension("GL_INGR_color_clamp"); +#endif /* GL_INGR_color_clamp */ +#ifdef GL_INGR_interlace_read + GLEW_INGR_interlace_read = glewGetExtension("GL_INGR_interlace_read"); +#endif /* GL_INGR_interlace_read */ +#ifdef GL_INTEL_parallel_arrays + GLEW_INTEL_parallel_arrays = glewGetExtension("GL_INTEL_parallel_arrays"); + if (glewExperimental || GLEW_INTEL_parallel_arrays) GLEW_INTEL_parallel_arrays = !_glewInit_GL_INTEL_parallel_arrays(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_INTEL_parallel_arrays */ +#ifdef GL_INTEL_texture_scissor + GLEW_INTEL_texture_scissor = glewGetExtension("GL_INTEL_texture_scissor"); + if (glewExperimental || GLEW_INTEL_texture_scissor) GLEW_INTEL_texture_scissor = !_glewInit_GL_INTEL_texture_scissor(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_INTEL_texture_scissor */ +#ifdef GL_KTX_buffer_region + GLEW_KTX_buffer_region = glewGetExtension("GL_KTX_buffer_region"); + if (glewExperimental || GLEW_KTX_buffer_region) GLEW_KTX_buffer_region = !_glewInit_GL_KTX_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_KTX_buffer_region */ +#ifdef GL_MESAX_texture_stack + GLEW_MESAX_texture_stack = glewGetExtension("GL_MESAX_texture_stack"); +#endif /* GL_MESAX_texture_stack */ +#ifdef GL_MESA_pack_invert + GLEW_MESA_pack_invert = glewGetExtension("GL_MESA_pack_invert"); +#endif /* GL_MESA_pack_invert */ +#ifdef GL_MESA_resize_buffers + GLEW_MESA_resize_buffers = glewGetExtension("GL_MESA_resize_buffers"); + if (glewExperimental || GLEW_MESA_resize_buffers) GLEW_MESA_resize_buffers = !_glewInit_GL_MESA_resize_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_MESA_resize_buffers */ +#ifdef GL_MESA_window_pos + GLEW_MESA_window_pos = glewGetExtension("GL_MESA_window_pos"); + if (glewExperimental || GLEW_MESA_window_pos) GLEW_MESA_window_pos = !_glewInit_GL_MESA_window_pos(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_MESA_window_pos */ +#ifdef GL_MESA_ycbcr_texture + GLEW_MESA_ycbcr_texture = glewGetExtension("GL_MESA_ycbcr_texture"); +#endif /* GL_MESA_ycbcr_texture */ +#ifdef GL_NV_blend_square + GLEW_NV_blend_square = glewGetExtension("GL_NV_blend_square"); +#endif /* GL_NV_blend_square */ +#ifdef GL_NV_copy_depth_to_color + GLEW_NV_copy_depth_to_color = glewGetExtension("GL_NV_copy_depth_to_color"); +#endif /* GL_NV_copy_depth_to_color */ +#ifdef GL_NV_depth_clamp + GLEW_NV_depth_clamp = glewGetExtension("GL_NV_depth_clamp"); +#endif /* GL_NV_depth_clamp */ +#ifdef GL_NV_evaluators + GLEW_NV_evaluators = glewGetExtension("GL_NV_evaluators"); + if (glewExperimental || GLEW_NV_evaluators) GLEW_NV_evaluators = !_glewInit_GL_NV_evaluators(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_evaluators */ +#ifdef GL_NV_fence + GLEW_NV_fence = glewGetExtension("GL_NV_fence"); + if (glewExperimental || GLEW_NV_fence) GLEW_NV_fence = !_glewInit_GL_NV_fence(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_fence */ +#ifdef GL_NV_float_buffer + GLEW_NV_float_buffer = glewGetExtension("GL_NV_float_buffer"); +#endif /* GL_NV_float_buffer */ +#ifdef GL_NV_fog_distance + GLEW_NV_fog_distance = glewGetExtension("GL_NV_fog_distance"); +#endif /* GL_NV_fog_distance */ +#ifdef GL_NV_fragment_program + GLEW_NV_fragment_program = glewGetExtension("GL_NV_fragment_program"); + if (glewExperimental || GLEW_NV_fragment_program) GLEW_NV_fragment_program = !_glewInit_GL_NV_fragment_program(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_fragment_program */ +#ifdef GL_NV_fragment_program2 + GLEW_NV_fragment_program2 = glewGetExtension("GL_NV_fragment_program2"); +#endif /* GL_NV_fragment_program2 */ +#ifdef GL_NV_fragment_program_option + GLEW_NV_fragment_program_option = glewGetExtension("GL_NV_fragment_program_option"); +#endif /* GL_NV_fragment_program_option */ +#ifdef GL_NV_half_float + GLEW_NV_half_float = glewGetExtension("GL_NV_half_float"); + if (glewExperimental || GLEW_NV_half_float) GLEW_NV_half_float = !_glewInit_GL_NV_half_float(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_half_float */ +#ifdef GL_NV_light_max_exponent + GLEW_NV_light_max_exponent = glewGetExtension("GL_NV_light_max_exponent"); +#endif /* GL_NV_light_max_exponent */ +#ifdef GL_NV_multisample_filter_hint + GLEW_NV_multisample_filter_hint = glewGetExtension("GL_NV_multisample_filter_hint"); +#endif /* GL_NV_multisample_filter_hint */ +#ifdef GL_NV_occlusion_query + GLEW_NV_occlusion_query = glewGetExtension("GL_NV_occlusion_query"); + if (glewExperimental || GLEW_NV_occlusion_query) GLEW_NV_occlusion_query = !_glewInit_GL_NV_occlusion_query(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_occlusion_query */ +#ifdef GL_NV_packed_depth_stencil + GLEW_NV_packed_depth_stencil = glewGetExtension("GL_NV_packed_depth_stencil"); +#endif /* GL_NV_packed_depth_stencil */ +#ifdef GL_NV_pixel_data_range + GLEW_NV_pixel_data_range = glewGetExtension("GL_NV_pixel_data_range"); + if (glewExperimental || GLEW_NV_pixel_data_range) GLEW_NV_pixel_data_range = !_glewInit_GL_NV_pixel_data_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_pixel_data_range */ +#ifdef GL_NV_point_sprite + GLEW_NV_point_sprite = glewGetExtension("GL_NV_point_sprite"); + if (glewExperimental || GLEW_NV_point_sprite) GLEW_NV_point_sprite = !_glewInit_GL_NV_point_sprite(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_point_sprite */ +#ifdef GL_NV_primitive_restart + GLEW_NV_primitive_restart = glewGetExtension("GL_NV_primitive_restart"); + if (glewExperimental || GLEW_NV_primitive_restart) GLEW_NV_primitive_restart = !_glewInit_GL_NV_primitive_restart(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_primitive_restart */ +#ifdef GL_NV_register_combiners + GLEW_NV_register_combiners = glewGetExtension("GL_NV_register_combiners"); + if (glewExperimental || GLEW_NV_register_combiners) GLEW_NV_register_combiners = !_glewInit_GL_NV_register_combiners(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_register_combiners */ +#ifdef GL_NV_register_combiners2 + GLEW_NV_register_combiners2 = glewGetExtension("GL_NV_register_combiners2"); + if (glewExperimental || GLEW_NV_register_combiners2) GLEW_NV_register_combiners2 = !_glewInit_GL_NV_register_combiners2(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_register_combiners2 */ +#ifdef GL_NV_texgen_emboss + GLEW_NV_texgen_emboss = glewGetExtension("GL_NV_texgen_emboss"); +#endif /* GL_NV_texgen_emboss */ +#ifdef GL_NV_texgen_reflection + GLEW_NV_texgen_reflection = glewGetExtension("GL_NV_texgen_reflection"); +#endif /* GL_NV_texgen_reflection */ +#ifdef GL_NV_texture_compression_vtc + GLEW_NV_texture_compression_vtc = glewGetExtension("GL_NV_texture_compression_vtc"); +#endif /* GL_NV_texture_compression_vtc */ +#ifdef GL_NV_texture_env_combine4 + GLEW_NV_texture_env_combine4 = glewGetExtension("GL_NV_texture_env_combine4"); +#endif /* GL_NV_texture_env_combine4 */ +#ifdef GL_NV_texture_expand_normal + GLEW_NV_texture_expand_normal = glewGetExtension("GL_NV_texture_expand_normal"); +#endif /* GL_NV_texture_expand_normal */ +#ifdef GL_NV_texture_rectangle + GLEW_NV_texture_rectangle = glewGetExtension("GL_NV_texture_rectangle"); +#endif /* GL_NV_texture_rectangle */ +#ifdef GL_NV_texture_shader + GLEW_NV_texture_shader = glewGetExtension("GL_NV_texture_shader"); +#endif /* GL_NV_texture_shader */ +#ifdef GL_NV_texture_shader2 + GLEW_NV_texture_shader2 = glewGetExtension("GL_NV_texture_shader2"); +#endif /* GL_NV_texture_shader2 */ +#ifdef GL_NV_texture_shader3 + GLEW_NV_texture_shader3 = glewGetExtension("GL_NV_texture_shader3"); +#endif /* GL_NV_texture_shader3 */ +#ifdef GL_NV_vertex_array_range + GLEW_NV_vertex_array_range = glewGetExtension("GL_NV_vertex_array_range"); + if (glewExperimental || GLEW_NV_vertex_array_range) GLEW_NV_vertex_array_range = !_glewInit_GL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vertex_array_range */ +#ifdef GL_NV_vertex_array_range2 + GLEW_NV_vertex_array_range2 = glewGetExtension("GL_NV_vertex_array_range2"); +#endif /* GL_NV_vertex_array_range2 */ +#ifdef GL_NV_vertex_program + GLEW_NV_vertex_program = glewGetExtension("GL_NV_vertex_program"); + if (glewExperimental || GLEW_NV_vertex_program) GLEW_NV_vertex_program = !_glewInit_GL_NV_vertex_program(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_NV_vertex_program */ +#ifdef GL_NV_vertex_program1_1 + GLEW_NV_vertex_program1_1 = glewGetExtension("GL_NV_vertex_program1_1"); +#endif /* GL_NV_vertex_program1_1 */ +#ifdef GL_NV_vertex_program2 + GLEW_NV_vertex_program2 = glewGetExtension("GL_NV_vertex_program2"); +#endif /* GL_NV_vertex_program2 */ +#ifdef GL_NV_vertex_program2_option + GLEW_NV_vertex_program2_option = glewGetExtension("GL_NV_vertex_program2_option"); +#endif /* GL_NV_vertex_program2_option */ +#ifdef GL_NV_vertex_program3 + GLEW_NV_vertex_program3 = glewGetExtension("GL_NV_vertex_program3"); +#endif /* GL_NV_vertex_program3 */ +#ifdef GL_OML_interlace + GLEW_OML_interlace = glewGetExtension("GL_OML_interlace"); +#endif /* GL_OML_interlace */ +#ifdef GL_OML_resample + GLEW_OML_resample = glewGetExtension("GL_OML_resample"); +#endif /* GL_OML_resample */ +#ifdef GL_OML_subsample + GLEW_OML_subsample = glewGetExtension("GL_OML_subsample"); +#endif /* GL_OML_subsample */ +#ifdef GL_PGI_misc_hints + GLEW_PGI_misc_hints = glewGetExtension("GL_PGI_misc_hints"); +#endif /* GL_PGI_misc_hints */ +#ifdef GL_PGI_vertex_hints + GLEW_PGI_vertex_hints = glewGetExtension("GL_PGI_vertex_hints"); +#endif /* GL_PGI_vertex_hints */ +#ifdef GL_REND_screen_coordinates + GLEW_REND_screen_coordinates = glewGetExtension("GL_REND_screen_coordinates"); +#endif /* GL_REND_screen_coordinates */ +#ifdef GL_S3_s3tc + GLEW_S3_s3tc = glewGetExtension("GL_S3_s3tc"); +#endif /* GL_S3_s3tc */ +#ifdef GL_SGIS_color_range + GLEW_SGIS_color_range = glewGetExtension("GL_SGIS_color_range"); +#endif /* GL_SGIS_color_range */ +#ifdef GL_SGIS_detail_texture + GLEW_SGIS_detail_texture = glewGetExtension("GL_SGIS_detail_texture"); + if (glewExperimental || GLEW_SGIS_detail_texture) GLEW_SGIS_detail_texture = !_glewInit_GL_SGIS_detail_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_detail_texture */ +#ifdef GL_SGIS_fog_function + GLEW_SGIS_fog_function = glewGetExtension("GL_SGIS_fog_function"); + if (glewExperimental || GLEW_SGIS_fog_function) GLEW_SGIS_fog_function = !_glewInit_GL_SGIS_fog_function(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_fog_function */ +#ifdef GL_SGIS_generate_mipmap + GLEW_SGIS_generate_mipmap = glewGetExtension("GL_SGIS_generate_mipmap"); +#endif /* GL_SGIS_generate_mipmap */ +#ifdef GL_SGIS_multisample + GLEW_SGIS_multisample = glewGetExtension("GL_SGIS_multisample"); + if (glewExperimental || GLEW_SGIS_multisample) GLEW_SGIS_multisample = !_glewInit_GL_SGIS_multisample(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_multisample */ +#ifdef GL_SGIS_pixel_texture + GLEW_SGIS_pixel_texture = glewGetExtension("GL_SGIS_pixel_texture"); +#endif /* GL_SGIS_pixel_texture */ +#ifdef GL_SGIS_sharpen_texture + GLEW_SGIS_sharpen_texture = glewGetExtension("GL_SGIS_sharpen_texture"); + if (glewExperimental || GLEW_SGIS_sharpen_texture) GLEW_SGIS_sharpen_texture = !_glewInit_GL_SGIS_sharpen_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_sharpen_texture */ +#ifdef GL_SGIS_texture4D + GLEW_SGIS_texture4D = glewGetExtension("GL_SGIS_texture4D"); + if (glewExperimental || GLEW_SGIS_texture4D) GLEW_SGIS_texture4D = !_glewInit_GL_SGIS_texture4D(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_texture4D */ +#ifdef GL_SGIS_texture_border_clamp + GLEW_SGIS_texture_border_clamp = glewGetExtension("GL_SGIS_texture_border_clamp"); +#endif /* GL_SGIS_texture_border_clamp */ +#ifdef GL_SGIS_texture_edge_clamp + GLEW_SGIS_texture_edge_clamp = glewGetExtension("GL_SGIS_texture_edge_clamp"); +#endif /* GL_SGIS_texture_edge_clamp */ +#ifdef GL_SGIS_texture_filter4 + GLEW_SGIS_texture_filter4 = glewGetExtension("GL_SGIS_texture_filter4"); + if (glewExperimental || GLEW_SGIS_texture_filter4) GLEW_SGIS_texture_filter4 = !_glewInit_GL_SGIS_texture_filter4(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIS_texture_filter4 */ +#ifdef GL_SGIS_texture_lod + GLEW_SGIS_texture_lod = glewGetExtension("GL_SGIS_texture_lod"); +#endif /* GL_SGIS_texture_lod */ +#ifdef GL_SGIS_texture_select + GLEW_SGIS_texture_select = glewGetExtension("GL_SGIS_texture_select"); +#endif /* GL_SGIS_texture_select */ +#ifdef GL_SGIX_async + GLEW_SGIX_async = glewGetExtension("GL_SGIX_async"); + if (glewExperimental || GLEW_SGIX_async) GLEW_SGIX_async = !_glewInit_GL_SGIX_async(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_async */ +#ifdef GL_SGIX_async_histogram + GLEW_SGIX_async_histogram = glewGetExtension("GL_SGIX_async_histogram"); +#endif /* GL_SGIX_async_histogram */ +#ifdef GL_SGIX_async_pixel + GLEW_SGIX_async_pixel = glewGetExtension("GL_SGIX_async_pixel"); +#endif /* GL_SGIX_async_pixel */ +#ifdef GL_SGIX_blend_alpha_minmax + GLEW_SGIX_blend_alpha_minmax = glewGetExtension("GL_SGIX_blend_alpha_minmax"); +#endif /* GL_SGIX_blend_alpha_minmax */ +#ifdef GL_SGIX_clipmap + GLEW_SGIX_clipmap = glewGetExtension("GL_SGIX_clipmap"); +#endif /* GL_SGIX_clipmap */ +#ifdef GL_SGIX_depth_texture + GLEW_SGIX_depth_texture = glewGetExtension("GL_SGIX_depth_texture"); +#endif /* GL_SGIX_depth_texture */ +#ifdef GL_SGIX_flush_raster + GLEW_SGIX_flush_raster = glewGetExtension("GL_SGIX_flush_raster"); + if (glewExperimental || GLEW_SGIX_flush_raster) GLEW_SGIX_flush_raster = !_glewInit_GL_SGIX_flush_raster(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_flush_raster */ +#ifdef GL_SGIX_fog_offset + GLEW_SGIX_fog_offset = glewGetExtension("GL_SGIX_fog_offset"); +#endif /* GL_SGIX_fog_offset */ +#ifdef GL_SGIX_fog_texture + GLEW_SGIX_fog_texture = glewGetExtension("GL_SGIX_fog_texture"); + if (glewExperimental || GLEW_SGIX_fog_texture) GLEW_SGIX_fog_texture = !_glewInit_GL_SGIX_fog_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_fog_texture */ +#ifdef GL_SGIX_fragment_specular_lighting + GLEW_SGIX_fragment_specular_lighting = glewGetExtension("GL_SGIX_fragment_specular_lighting"); + if (glewExperimental || GLEW_SGIX_fragment_specular_lighting) GLEW_SGIX_fragment_specular_lighting = !_glewInit_GL_SGIX_fragment_specular_lighting(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_fragment_specular_lighting */ +#ifdef GL_SGIX_framezoom + GLEW_SGIX_framezoom = glewGetExtension("GL_SGIX_framezoom"); + if (glewExperimental || GLEW_SGIX_framezoom) GLEW_SGIX_framezoom = !_glewInit_GL_SGIX_framezoom(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_framezoom */ +#ifdef GL_SGIX_interlace + GLEW_SGIX_interlace = glewGetExtension("GL_SGIX_interlace"); +#endif /* GL_SGIX_interlace */ +#ifdef GL_SGIX_ir_instrument1 + GLEW_SGIX_ir_instrument1 = glewGetExtension("GL_SGIX_ir_instrument1"); +#endif /* GL_SGIX_ir_instrument1 */ +#ifdef GL_SGIX_list_priority + GLEW_SGIX_list_priority = glewGetExtension("GL_SGIX_list_priority"); +#endif /* GL_SGIX_list_priority */ +#ifdef GL_SGIX_pixel_texture + GLEW_SGIX_pixel_texture = glewGetExtension("GL_SGIX_pixel_texture"); + if (glewExperimental || GLEW_SGIX_pixel_texture) GLEW_SGIX_pixel_texture = !_glewInit_GL_SGIX_pixel_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_pixel_texture */ +#ifdef GL_SGIX_pixel_texture_bits + GLEW_SGIX_pixel_texture_bits = glewGetExtension("GL_SGIX_pixel_texture_bits"); +#endif /* GL_SGIX_pixel_texture_bits */ +#ifdef GL_SGIX_reference_plane + GLEW_SGIX_reference_plane = glewGetExtension("GL_SGIX_reference_plane"); + if (glewExperimental || GLEW_SGIX_reference_plane) GLEW_SGIX_reference_plane = !_glewInit_GL_SGIX_reference_plane(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_reference_plane */ +#ifdef GL_SGIX_resample + GLEW_SGIX_resample = glewGetExtension("GL_SGIX_resample"); +#endif /* GL_SGIX_resample */ +#ifdef GL_SGIX_shadow + GLEW_SGIX_shadow = glewGetExtension("GL_SGIX_shadow"); +#endif /* GL_SGIX_shadow */ +#ifdef GL_SGIX_shadow_ambient + GLEW_SGIX_shadow_ambient = glewGetExtension("GL_SGIX_shadow_ambient"); +#endif /* GL_SGIX_shadow_ambient */ +#ifdef GL_SGIX_sprite + GLEW_SGIX_sprite = glewGetExtension("GL_SGIX_sprite"); + if (glewExperimental || GLEW_SGIX_sprite) GLEW_SGIX_sprite = !_glewInit_GL_SGIX_sprite(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_sprite */ +#ifdef GL_SGIX_tag_sample_buffer + GLEW_SGIX_tag_sample_buffer = glewGetExtension("GL_SGIX_tag_sample_buffer"); + if (glewExperimental || GLEW_SGIX_tag_sample_buffer) GLEW_SGIX_tag_sample_buffer = !_glewInit_GL_SGIX_tag_sample_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGIX_tag_sample_buffer */ +#ifdef GL_SGIX_texture_add_env + GLEW_SGIX_texture_add_env = glewGetExtension("GL_SGIX_texture_add_env"); +#endif /* GL_SGIX_texture_add_env */ +#ifdef GL_SGIX_texture_coordinate_clamp + GLEW_SGIX_texture_coordinate_clamp = glewGetExtension("GL_SGIX_texture_coordinate_clamp"); +#endif /* GL_SGIX_texture_coordinate_clamp */ +#ifdef GL_SGIX_texture_lod_bias + GLEW_SGIX_texture_lod_bias = glewGetExtension("GL_SGIX_texture_lod_bias"); +#endif /* GL_SGIX_texture_lod_bias */ +#ifdef GL_SGIX_texture_multi_buffer + GLEW_SGIX_texture_multi_buffer = glewGetExtension("GL_SGIX_texture_multi_buffer"); +#endif /* GL_SGIX_texture_multi_buffer */ +#ifdef GL_SGIX_texture_range + GLEW_SGIX_texture_range = glewGetExtension("GL_SGIX_texture_range"); +#endif /* GL_SGIX_texture_range */ +#ifdef GL_SGIX_texture_scale_bias + GLEW_SGIX_texture_scale_bias = glewGetExtension("GL_SGIX_texture_scale_bias"); +#endif /* GL_SGIX_texture_scale_bias */ +#ifdef GL_SGIX_vertex_preclip + GLEW_SGIX_vertex_preclip = glewGetExtension("GL_SGIX_vertex_preclip"); +#endif /* GL_SGIX_vertex_preclip */ +#ifdef GL_SGIX_vertex_preclip_hint + GLEW_SGIX_vertex_preclip_hint = glewGetExtension("GL_SGIX_vertex_preclip_hint"); +#endif /* GL_SGIX_vertex_preclip_hint */ +#ifdef GL_SGIX_ycrcb + GLEW_SGIX_ycrcb = glewGetExtension("GL_SGIX_ycrcb"); +#endif /* GL_SGIX_ycrcb */ +#ifdef GL_SGI_color_matrix + GLEW_SGI_color_matrix = glewGetExtension("GL_SGI_color_matrix"); +#endif /* GL_SGI_color_matrix */ +#ifdef GL_SGI_color_table + GLEW_SGI_color_table = glewGetExtension("GL_SGI_color_table"); + if (glewExperimental || GLEW_SGI_color_table) GLEW_SGI_color_table = !_glewInit_GL_SGI_color_table(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SGI_color_table */ +#ifdef GL_SGI_texture_color_table + GLEW_SGI_texture_color_table = glewGetExtension("GL_SGI_texture_color_table"); +#endif /* GL_SGI_texture_color_table */ +#ifdef GL_SUNX_constant_data + GLEW_SUNX_constant_data = glewGetExtension("GL_SUNX_constant_data"); + if (glewExperimental || GLEW_SUNX_constant_data) GLEW_SUNX_constant_data = !_glewInit_GL_SUNX_constant_data(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUNX_constant_data */ +#ifdef GL_SUN_convolution_border_modes + GLEW_SUN_convolution_border_modes = glewGetExtension("GL_SUN_convolution_border_modes"); +#endif /* GL_SUN_convolution_border_modes */ +#ifdef GL_SUN_global_alpha + GLEW_SUN_global_alpha = glewGetExtension("GL_SUN_global_alpha"); + if (glewExperimental || GLEW_SUN_global_alpha) GLEW_SUN_global_alpha = !_glewInit_GL_SUN_global_alpha(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_global_alpha */ +#ifdef GL_SUN_mesh_array + GLEW_SUN_mesh_array = glewGetExtension("GL_SUN_mesh_array"); +#endif /* GL_SUN_mesh_array */ +#ifdef GL_SUN_read_video_pixels + GLEW_SUN_read_video_pixels = glewGetExtension("GL_SUN_read_video_pixels"); + if (glewExperimental || GLEW_SUN_read_video_pixels) GLEW_SUN_read_video_pixels = !_glewInit_GL_SUN_read_video_pixels(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_read_video_pixels */ +#ifdef GL_SUN_slice_accum + GLEW_SUN_slice_accum = glewGetExtension("GL_SUN_slice_accum"); +#endif /* GL_SUN_slice_accum */ +#ifdef GL_SUN_triangle_list + GLEW_SUN_triangle_list = glewGetExtension("GL_SUN_triangle_list"); + if (glewExperimental || GLEW_SUN_triangle_list) GLEW_SUN_triangle_list = !_glewInit_GL_SUN_triangle_list(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_triangle_list */ +#ifdef GL_SUN_vertex + GLEW_SUN_vertex = glewGetExtension("GL_SUN_vertex"); + if (glewExperimental || GLEW_SUN_vertex) GLEW_SUN_vertex = !_glewInit_GL_SUN_vertex(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_SUN_vertex */ +#ifdef GL_WIN_phong_shading + GLEW_WIN_phong_shading = glewGetExtension("GL_WIN_phong_shading"); +#endif /* GL_WIN_phong_shading */ +#ifdef GL_WIN_specular_fog + GLEW_WIN_specular_fog = glewGetExtension("GL_WIN_specular_fog"); +#endif /* GL_WIN_specular_fog */ +#ifdef GL_WIN_swap_hint + GLEW_WIN_swap_hint = glewGetExtension("GL_WIN_swap_hint"); + if (glewExperimental || GLEW_WIN_swap_hint) GLEW_WIN_swap_hint = !_glewInit_GL_WIN_swap_hint(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GL_WIN_swap_hint */ + + return GLEW_OK; +} + + +#if defined(_WIN32) + +#if !defined(GLEW_MX) + +PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL; + +PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB = NULL; +PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB = NULL; +PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB = NULL; +PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB = NULL; + +PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB = NULL; + +PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB = NULL; +PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB = NULL; + +PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB = NULL; +PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB = NULL; +PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB = NULL; +PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB = NULL; +PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB = NULL; + +PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB = NULL; +PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB = NULL; +PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB = NULL; + +PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB = NULL; +PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB = NULL; +PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB = NULL; + +PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT = NULL; +PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT = NULL; +PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT = NULL; +PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT = NULL; + +PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT = NULL; + +PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT = NULL; +PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT = NULL; + +PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT = NULL; +PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT = NULL; +PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT = NULL; +PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT = NULL; +PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT = NULL; + +PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT = NULL; +PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT = NULL; +PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT = NULL; + +PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT = NULL; +PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT = NULL; + +PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D = NULL; +PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D = NULL; + +PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D = NULL; +PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D = NULL; +PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D = NULL; +PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D = NULL; + +PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D = NULL; +PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D = NULL; +PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D = NULL; +PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D = NULL; +PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D = NULL; +PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D = NULL; +PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D = NULL; +PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D = NULL; +PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D = NULL; +PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D = NULL; +PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D = NULL; +PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D = NULL; + +PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D = NULL; +PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D = NULL; +PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D = NULL; +PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D = NULL; + +PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D = NULL; +PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D = NULL; +PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D = NULL; +PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D = NULL; + +PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D = NULL; +PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D = NULL; +PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D = NULL; +PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D = NULL; + +PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV = NULL; +PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV = NULL; + +PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML = NULL; +PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML = NULL; +PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML = NULL; +PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML = NULL; +PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML = NULL; +PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML = NULL; +GLboolean __WGLEW_3DFX_multisample = GL_FALSE; +GLboolean __WGLEW_3DL_stereo_control = GL_FALSE; +GLboolean __WGLEW_ARB_buffer_region = GL_FALSE; +GLboolean __WGLEW_ARB_extensions_string = GL_FALSE; +GLboolean __WGLEW_ARB_make_current_read = GL_FALSE; +GLboolean __WGLEW_ARB_multisample = GL_FALSE; +GLboolean __WGLEW_ARB_pbuffer = GL_FALSE; +GLboolean __WGLEW_ARB_pixel_format = GL_FALSE; +GLboolean __WGLEW_ARB_pixel_format_float = GL_FALSE; +GLboolean __WGLEW_ARB_render_texture = GL_FALSE; +GLboolean __WGLEW_ATI_pixel_format_float = GL_FALSE; +GLboolean __WGLEW_ATI_render_texture_rectangle = GL_FALSE; +GLboolean __WGLEW_EXT_depth_float = GL_FALSE; +GLboolean __WGLEW_EXT_display_color_table = GL_FALSE; +GLboolean __WGLEW_EXT_extensions_string = GL_FALSE; +GLboolean __WGLEW_EXT_make_current_read = GL_FALSE; +GLboolean __WGLEW_EXT_multisample = GL_FALSE; +GLboolean __WGLEW_EXT_pbuffer = GL_FALSE; +GLboolean __WGLEW_EXT_pixel_format = GL_FALSE; +GLboolean __WGLEW_EXT_swap_control = GL_FALSE; +GLboolean __WGLEW_I3D_digital_video_control = GL_FALSE; +GLboolean __WGLEW_I3D_gamma = GL_FALSE; +GLboolean __WGLEW_I3D_genlock = GL_FALSE; +GLboolean __WGLEW_I3D_image_buffer = GL_FALSE; +GLboolean __WGLEW_I3D_swap_frame_lock = GL_FALSE; +GLboolean __WGLEW_I3D_swap_frame_usage = GL_FALSE; +GLboolean __WGLEW_NV_float_buffer = GL_FALSE; +GLboolean __WGLEW_NV_render_depth_texture = GL_FALSE; +GLboolean __WGLEW_NV_render_texture_rectangle = GL_FALSE; +GLboolean __WGLEW_NV_vertex_array_range = GL_FALSE; +GLboolean __WGLEW_OML_sync_control = GL_FALSE; + +#endif /* !GLEW_MX */ + +#ifdef WGL_3DFX_multisample + +#endif /* WGL_3DFX_multisample */ + +#ifdef WGL_3DL_stereo_control + +static GLboolean _glewInit_WGL_3DL_stereo_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglSetStereoEmitterState3DL = (PFNWGLSETSTEREOEMITTERSTATE3DLPROC)glewGetProcAddress((const GLubyte*)"wglSetStereoEmitterState3DL")) == NULL) || r; + + return r; +} + +#endif /* WGL_3DL_stereo_control */ + +#ifdef WGL_ARB_buffer_region + +static GLboolean _glewInit_WGL_ARB_buffer_region (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreateBufferRegionARB = (PFNWGLCREATEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglCreateBufferRegionARB")) == NULL) || r; + r = ((wglDeleteBufferRegionARB = (PFNWGLDELETEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglDeleteBufferRegionARB")) == NULL) || r; + r = ((wglRestoreBufferRegionARB = (PFNWGLRESTOREBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglRestoreBufferRegionARB")) == NULL) || r; + r = ((wglSaveBufferRegionARB = (PFNWGLSAVEBUFFERREGIONARBPROC)glewGetProcAddress((const GLubyte*)"wglSaveBufferRegionARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_buffer_region */ + +#ifdef WGL_ARB_extensions_string + +static GLboolean _glewInit_WGL_ARB_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_extensions_string */ + +#ifdef WGL_ARB_make_current_read + +static GLboolean _glewInit_WGL_ARB_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetCurrentReadDCARB = (PFNWGLGETCURRENTREADDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCARB")) == NULL) || r; + r = ((wglMakeContextCurrentARB = (PFNWGLMAKECONTEXTCURRENTARBPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_make_current_read */ + +#ifdef WGL_ARB_multisample + +#endif /* WGL_ARB_multisample */ + +#ifdef WGL_ARB_pbuffer + +static GLboolean _glewInit_WGL_ARB_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferARB")) == NULL) || r; + r = ((wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferARB")) == NULL) || r; + r = ((wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCARB")) == NULL) || r; + r = ((wglQueryPbufferARB = (PFNWGLQUERYPBUFFERARBPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferARB")) == NULL) || r; + r = ((wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_pbuffer */ + +#ifdef WGL_ARB_pixel_format + +static GLboolean _glewInit_WGL_ARB_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatARB")) == NULL) || r; + r = ((wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvARB")) == NULL) || r; + r = ((wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_pixel_format */ + +#ifdef WGL_ARB_pixel_format_float + +#endif /* WGL_ARB_pixel_format_float */ + +#ifdef WGL_ARB_render_texture + +static GLboolean _glewInit_WGL_ARB_render_texture (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindTexImageARB = (PFNWGLBINDTEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglBindTexImageARB")) == NULL) || r; + r = ((wglReleaseTexImageARB = (PFNWGLRELEASETEXIMAGEARBPROC)glewGetProcAddress((const GLubyte*)"wglReleaseTexImageARB")) == NULL) || r; + r = ((wglSetPbufferAttribARB = (PFNWGLSETPBUFFERATTRIBARBPROC)glewGetProcAddress((const GLubyte*)"wglSetPbufferAttribARB")) == NULL) || r; + + return r; +} + +#endif /* WGL_ARB_render_texture */ + +#ifdef WGL_ATI_pixel_format_float + +#endif /* WGL_ATI_pixel_format_float */ + +#ifdef WGL_ATI_render_texture_rectangle + +#endif /* WGL_ATI_render_texture_rectangle */ + +#ifdef WGL_EXT_depth_float + +#endif /* WGL_EXT_depth_float */ + +#ifdef WGL_EXT_display_color_table + +static GLboolean _glewInit_WGL_EXT_display_color_table (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBindDisplayColorTableEXT = (PFNWGLBINDDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglBindDisplayColorTableEXT")) == NULL) || r; + r = ((wglCreateDisplayColorTableEXT = (PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglCreateDisplayColorTableEXT")) == NULL) || r; + r = ((wglDestroyDisplayColorTableEXT = (PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyDisplayColorTableEXT")) == NULL) || r; + r = ((wglLoadDisplayColorTableEXT = (PFNWGLLOADDISPLAYCOLORTABLEEXTPROC)glewGetProcAddress((const GLubyte*)"wglLoadDisplayColorTableEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_display_color_table */ + +#ifdef WGL_EXT_extensions_string + +static GLboolean _glewInit_WGL_EXT_extensions_string (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_extensions_string */ + +#ifdef WGL_EXT_make_current_read + +static GLboolean _glewInit_WGL_EXT_make_current_read (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetCurrentReadDCEXT = (PFNWGLGETCURRENTREADDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetCurrentReadDCEXT")) == NULL) || r; + r = ((wglMakeContextCurrentEXT = (PFNWGLMAKECONTEXTCURRENTEXTPROC)glewGetProcAddress((const GLubyte*)"wglMakeContextCurrentEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_make_current_read */ + +#ifdef WGL_EXT_multisample + +#endif /* WGL_EXT_multisample */ + +#ifdef WGL_EXT_pbuffer + +static GLboolean _glewInit_WGL_EXT_pbuffer (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglCreatePbufferEXT = (PFNWGLCREATEPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglCreatePbufferEXT")) == NULL) || r; + r = ((wglDestroyPbufferEXT = (PFNWGLDESTROYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglDestroyPbufferEXT")) == NULL) || r; + r = ((wglGetPbufferDCEXT = (PFNWGLGETPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPbufferDCEXT")) == NULL) || r; + r = ((wglQueryPbufferEXT = (PFNWGLQUERYPBUFFEREXTPROC)glewGetProcAddress((const GLubyte*)"wglQueryPbufferEXT")) == NULL) || r; + r = ((wglReleasePbufferDCEXT = (PFNWGLRELEASEPBUFFERDCEXTPROC)glewGetProcAddress((const GLubyte*)"wglReleasePbufferDCEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_pbuffer */ + +#ifdef WGL_EXT_pixel_format + +static GLboolean _glewInit_WGL_EXT_pixel_format (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglChoosePixelFormatEXT = (PFNWGLCHOOSEPIXELFORMATEXTPROC)glewGetProcAddress((const GLubyte*)"wglChoosePixelFormatEXT")) == NULL) || r; + r = ((wglGetPixelFormatAttribfvEXT = (PFNWGLGETPIXELFORMATATTRIBFVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribfvEXT")) == NULL) || r; + r = ((wglGetPixelFormatAttribivEXT = (PFNWGLGETPIXELFORMATATTRIBIVEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetPixelFormatAttribivEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_pixel_format */ + +#ifdef WGL_EXT_swap_control + +static GLboolean _glewInit_WGL_EXT_swap_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetSwapIntervalEXT")) == NULL) || r; + r = ((wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)glewGetProcAddress((const GLubyte*)"wglSwapIntervalEXT")) == NULL) || r; + + return r; +} + +#endif /* WGL_EXT_swap_control */ + +#ifdef WGL_I3D_digital_video_control + +static GLboolean _glewInit_WGL_I3D_digital_video_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetDigitalVideoParametersI3D = (PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetDigitalVideoParametersI3D")) == NULL) || r; + r = ((wglSetDigitalVideoParametersI3D = (PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetDigitalVideoParametersI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_digital_video_control */ + +#ifdef WGL_I3D_gamma + +static GLboolean _glewInit_WGL_I3D_gamma (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetGammaTableI3D = (PFNWGLGETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableI3D")) == NULL) || r; + r = ((wglGetGammaTableParametersI3D = (PFNWGLGETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGammaTableParametersI3D")) == NULL) || r; + r = ((wglSetGammaTableI3D = (PFNWGLSETGAMMATABLEI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableI3D")) == NULL) || r; + r = ((wglSetGammaTableParametersI3D = (PFNWGLSETGAMMATABLEPARAMETERSI3DPROC)glewGetProcAddress((const GLubyte*)"wglSetGammaTableParametersI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_gamma */ + +#ifdef WGL_I3D_genlock + +static GLboolean _glewInit_WGL_I3D_genlock (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDisableGenlockI3D = (PFNWGLDISABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableGenlockI3D")) == NULL) || r; + r = ((wglEnableGenlockI3D = (PFNWGLENABLEGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableGenlockI3D")) == NULL) || r; + r = ((wglGenlockSampleRateI3D = (PFNWGLGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSampleRateI3D")) == NULL) || r; + r = ((wglGenlockSourceDelayI3D = (PFNWGLGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceDelayI3D")) == NULL) || r; + r = ((wglGenlockSourceEdgeI3D = (PFNWGLGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceEdgeI3D")) == NULL) || r; + r = ((wglGenlockSourceI3D = (PFNWGLGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGenlockSourceI3D")) == NULL) || r; + r = ((wglGetGenlockSampleRateI3D = (PFNWGLGETGENLOCKSAMPLERATEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSampleRateI3D")) == NULL) || r; + r = ((wglGetGenlockSourceDelayI3D = (PFNWGLGETGENLOCKSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceDelayI3D")) == NULL) || r; + r = ((wglGetGenlockSourceEdgeI3D = (PFNWGLGETGENLOCKSOURCEEDGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceEdgeI3D")) == NULL) || r; + r = ((wglGetGenlockSourceI3D = (PFNWGLGETGENLOCKSOURCEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetGenlockSourceI3D")) == NULL) || r; + r = ((wglIsEnabledGenlockI3D = (PFNWGLISENABLEDGENLOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledGenlockI3D")) == NULL) || r; + r = ((wglQueryGenlockMaxSourceDelayI3D = (PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryGenlockMaxSourceDelayI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_genlock */ + +#ifdef WGL_I3D_image_buffer + +static GLboolean _glewInit_WGL_I3D_image_buffer (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglAssociateImageBufferEventsI3D = (PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglAssociateImageBufferEventsI3D")) == NULL) || r; + r = ((wglCreateImageBufferI3D = (PFNWGLCREATEIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglCreateImageBufferI3D")) == NULL) || r; + r = ((wglDestroyImageBufferI3D = (PFNWGLDESTROYIMAGEBUFFERI3DPROC)glewGetProcAddress((const GLubyte*)"wglDestroyImageBufferI3D")) == NULL) || r; + r = ((wglReleaseImageBufferEventsI3D = (PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC)glewGetProcAddress((const GLubyte*)"wglReleaseImageBufferEventsI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_image_buffer */ + +#ifdef WGL_I3D_swap_frame_lock + +static GLboolean _glewInit_WGL_I3D_swap_frame_lock (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglDisableFrameLockI3D = (PFNWGLDISABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglDisableFrameLockI3D")) == NULL) || r; + r = ((wglEnableFrameLockI3D = (PFNWGLENABLEFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglEnableFrameLockI3D")) == NULL) || r; + r = ((wglIsEnabledFrameLockI3D = (PFNWGLISENABLEDFRAMELOCKI3DPROC)glewGetProcAddress((const GLubyte*)"wglIsEnabledFrameLockI3D")) == NULL) || r; + r = ((wglQueryFrameLockMasterI3D = (PFNWGLQUERYFRAMELOCKMASTERI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameLockMasterI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_swap_frame_lock */ + +#ifdef WGL_I3D_swap_frame_usage + +static GLboolean _glewInit_WGL_I3D_swap_frame_usage (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglBeginFrameTrackingI3D = (PFNWGLBEGINFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglBeginFrameTrackingI3D")) == NULL) || r; + r = ((wglEndFrameTrackingI3D = (PFNWGLENDFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglEndFrameTrackingI3D")) == NULL) || r; + r = ((wglGetFrameUsageI3D = (PFNWGLGETFRAMEUSAGEI3DPROC)glewGetProcAddress((const GLubyte*)"wglGetFrameUsageI3D")) == NULL) || r; + r = ((wglQueryFrameTrackingI3D = (PFNWGLQUERYFRAMETRACKINGI3DPROC)glewGetProcAddress((const GLubyte*)"wglQueryFrameTrackingI3D")) == NULL) || r; + + return r; +} + +#endif /* WGL_I3D_swap_frame_usage */ + +#ifdef WGL_NV_float_buffer + +#endif /* WGL_NV_float_buffer */ + +#ifdef WGL_NV_render_depth_texture + +#endif /* WGL_NV_render_depth_texture */ + +#ifdef WGL_NV_render_texture_rectangle + +#endif /* WGL_NV_render_texture_rectangle */ + +#ifdef WGL_NV_vertex_array_range + +static GLboolean _glewInit_WGL_NV_vertex_array_range (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglAllocateMemoryNV = (PFNWGLALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglAllocateMemoryNV")) == NULL) || r; + r = ((wglFreeMemoryNV = (PFNWGLFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"wglFreeMemoryNV")) == NULL) || r; + + return r; +} + +#endif /* WGL_NV_vertex_array_range */ + +#ifdef WGL_OML_sync_control + +static GLboolean _glewInit_WGL_OML_sync_control (WGLEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((wglGetMscRateOML = (PFNWGLGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetMscRateOML")) == NULL) || r; + r = ((wglGetSyncValuesOML = (PFNWGLGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"wglGetSyncValuesOML")) == NULL) || r; + r = ((wglSwapBuffersMscOML = (PFNWGLSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapBuffersMscOML")) == NULL) || r; + r = ((wglSwapLayerBuffersMscOML = (PFNWGLSWAPLAYERBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglSwapLayerBuffersMscOML")) == NULL) || r; + r = ((wglWaitForMscOML = (PFNWGLWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForMscOML")) == NULL) || r; + r = ((wglWaitForSbcOML = (PFNWGLWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"wglWaitForSbcOML")) == NULL) || r; + + return r; +} + +#endif /* WGL_OML_sync_control */ + +/* ------------------------------------------------------------------------- */ + +static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; +static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; + +GLboolean wglewGetExtension (const char* name) +{ + GLubyte* p; + GLubyte* end; + GLuint len = _glewStrLen((const GLubyte*)name); + if (_wglewGetExtensionsStringARB == NULL) + if (_wglewGetExtensionsStringEXT == NULL) + return GL_FALSE; + else + p = (GLubyte*)_wglewGetExtensionsStringEXT(); + else + p = (GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); + if (0 == p) return GL_FALSE; + end = p + _glewStrLen(p); + while (p < end) + { + GLuint n = _glewStrCLen(p, ' '); + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; + p += n+1; + } + return GL_FALSE; +} + +GLenum wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST) +{ + GLboolean crippled; + /* find wgl extension string query functions */ + if (_wglewGetExtensionsStringARB == NULL) + _wglewGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB"); + if (_wglewGetExtensionsStringEXT == NULL) + _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); + /* initialize extensions */ + crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; +#ifdef WGL_3DFX_multisample + WGLEW_3DFX_multisample = wglewGetExtension("WGL_3DFX_multisample"); +#endif /* WGL_3DFX_multisample */ +#ifdef WGL_3DL_stereo_control + WGLEW_3DL_stereo_control = wglewGetExtension("WGL_3DL_stereo_control"); + if (glewExperimental || WGLEW_3DL_stereo_control|| crippled) WGLEW_3DL_stereo_control= !_glewInit_WGL_3DL_stereo_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_3DL_stereo_control */ +#ifdef WGL_ARB_buffer_region + WGLEW_ARB_buffer_region = wglewGetExtension("WGL_ARB_buffer_region"); + if (glewExperimental || WGLEW_ARB_buffer_region|| crippled) WGLEW_ARB_buffer_region= !_glewInit_WGL_ARB_buffer_region(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_buffer_region */ +#ifdef WGL_ARB_extensions_string + WGLEW_ARB_extensions_string = wglewGetExtension("WGL_ARB_extensions_string"); + if (glewExperimental || WGLEW_ARB_extensions_string|| crippled) WGLEW_ARB_extensions_string= !_glewInit_WGL_ARB_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_extensions_string */ +#ifdef WGL_ARB_make_current_read + WGLEW_ARB_make_current_read = wglewGetExtension("WGL_ARB_make_current_read"); + if (glewExperimental || WGLEW_ARB_make_current_read|| crippled) WGLEW_ARB_make_current_read= !_glewInit_WGL_ARB_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_make_current_read */ +#ifdef WGL_ARB_multisample + WGLEW_ARB_multisample = wglewGetExtension("WGL_ARB_multisample"); +#endif /* WGL_ARB_multisample */ +#ifdef WGL_ARB_pbuffer + WGLEW_ARB_pbuffer = wglewGetExtension("WGL_ARB_pbuffer"); + if (glewExperimental || WGLEW_ARB_pbuffer|| crippled) WGLEW_ARB_pbuffer= !_glewInit_WGL_ARB_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_pbuffer */ +#ifdef WGL_ARB_pixel_format + WGLEW_ARB_pixel_format = wglewGetExtension("WGL_ARB_pixel_format"); + if (glewExperimental || WGLEW_ARB_pixel_format|| crippled) WGLEW_ARB_pixel_format= !_glewInit_WGL_ARB_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_pixel_format */ +#ifdef WGL_ARB_pixel_format_float + WGLEW_ARB_pixel_format_float = wglewGetExtension("WGL_ARB_pixel_format_float"); +#endif /* WGL_ARB_pixel_format_float */ +#ifdef WGL_ARB_render_texture + WGLEW_ARB_render_texture = wglewGetExtension("WGL_ARB_render_texture"); + if (glewExperimental || WGLEW_ARB_render_texture|| crippled) WGLEW_ARB_render_texture= !_glewInit_WGL_ARB_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_ARB_render_texture */ +#ifdef WGL_ATI_pixel_format_float + WGLEW_ATI_pixel_format_float = wglewGetExtension("WGL_ATI_pixel_format_float"); +#endif /* WGL_ATI_pixel_format_float */ +#ifdef WGL_ATI_render_texture_rectangle + WGLEW_ATI_render_texture_rectangle = wglewGetExtension("WGL_ATI_render_texture_rectangle"); +#endif /* WGL_ATI_render_texture_rectangle */ +#ifdef WGL_EXT_depth_float + WGLEW_EXT_depth_float = wglewGetExtension("WGL_EXT_depth_float"); +#endif /* WGL_EXT_depth_float */ +#ifdef WGL_EXT_display_color_table + WGLEW_EXT_display_color_table = wglewGetExtension("WGL_EXT_display_color_table"); + if (glewExperimental || WGLEW_EXT_display_color_table|| crippled) WGLEW_EXT_display_color_table= !_glewInit_WGL_EXT_display_color_table(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_display_color_table */ +#ifdef WGL_EXT_extensions_string + WGLEW_EXT_extensions_string = wglewGetExtension("WGL_EXT_extensions_string"); + if (glewExperimental || WGLEW_EXT_extensions_string|| crippled) WGLEW_EXT_extensions_string= !_glewInit_WGL_EXT_extensions_string(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_extensions_string */ +#ifdef WGL_EXT_make_current_read + WGLEW_EXT_make_current_read = wglewGetExtension("WGL_EXT_make_current_read"); + if (glewExperimental || WGLEW_EXT_make_current_read|| crippled) WGLEW_EXT_make_current_read= !_glewInit_WGL_EXT_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_make_current_read */ +#ifdef WGL_EXT_multisample + WGLEW_EXT_multisample = wglewGetExtension("WGL_EXT_multisample"); +#endif /* WGL_EXT_multisample */ +#ifdef WGL_EXT_pbuffer + WGLEW_EXT_pbuffer = wglewGetExtension("WGL_EXT_pbuffer"); + if (glewExperimental || WGLEW_EXT_pbuffer|| crippled) WGLEW_EXT_pbuffer= !_glewInit_WGL_EXT_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_pbuffer */ +#ifdef WGL_EXT_pixel_format + WGLEW_EXT_pixel_format = wglewGetExtension("WGL_EXT_pixel_format"); + if (glewExperimental || WGLEW_EXT_pixel_format|| crippled) WGLEW_EXT_pixel_format= !_glewInit_WGL_EXT_pixel_format(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_pixel_format */ +#ifdef WGL_EXT_swap_control + WGLEW_EXT_swap_control = wglewGetExtension("WGL_EXT_swap_control"); + if (glewExperimental || WGLEW_EXT_swap_control|| crippled) WGLEW_EXT_swap_control= !_glewInit_WGL_EXT_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_EXT_swap_control */ +#ifdef WGL_I3D_digital_video_control + WGLEW_I3D_digital_video_control = wglewGetExtension("WGL_I3D_digital_video_control"); + if (glewExperimental || WGLEW_I3D_digital_video_control|| crippled) WGLEW_I3D_digital_video_control= !_glewInit_WGL_I3D_digital_video_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_digital_video_control */ +#ifdef WGL_I3D_gamma + WGLEW_I3D_gamma = wglewGetExtension("WGL_I3D_gamma"); + if (glewExperimental || WGLEW_I3D_gamma|| crippled) WGLEW_I3D_gamma= !_glewInit_WGL_I3D_gamma(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_gamma */ +#ifdef WGL_I3D_genlock + WGLEW_I3D_genlock = wglewGetExtension("WGL_I3D_genlock"); + if (glewExperimental || WGLEW_I3D_genlock|| crippled) WGLEW_I3D_genlock= !_glewInit_WGL_I3D_genlock(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_genlock */ +#ifdef WGL_I3D_image_buffer + WGLEW_I3D_image_buffer = wglewGetExtension("WGL_I3D_image_buffer"); + if (glewExperimental || WGLEW_I3D_image_buffer|| crippled) WGLEW_I3D_image_buffer= !_glewInit_WGL_I3D_image_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_image_buffer */ +#ifdef WGL_I3D_swap_frame_lock + WGLEW_I3D_swap_frame_lock = wglewGetExtension("WGL_I3D_swap_frame_lock"); + if (glewExperimental || WGLEW_I3D_swap_frame_lock|| crippled) WGLEW_I3D_swap_frame_lock= !_glewInit_WGL_I3D_swap_frame_lock(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_swap_frame_lock */ +#ifdef WGL_I3D_swap_frame_usage + WGLEW_I3D_swap_frame_usage = wglewGetExtension("WGL_I3D_swap_frame_usage"); + if (glewExperimental || WGLEW_I3D_swap_frame_usage|| crippled) WGLEW_I3D_swap_frame_usage= !_glewInit_WGL_I3D_swap_frame_usage(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_I3D_swap_frame_usage */ +#ifdef WGL_NV_float_buffer + WGLEW_NV_float_buffer = wglewGetExtension("WGL_NV_float_buffer"); +#endif /* WGL_NV_float_buffer */ +#ifdef WGL_NV_render_depth_texture + WGLEW_NV_render_depth_texture = wglewGetExtension("WGL_NV_render_depth_texture"); +#endif /* WGL_NV_render_depth_texture */ +#ifdef WGL_NV_render_texture_rectangle + WGLEW_NV_render_texture_rectangle = wglewGetExtension("WGL_NV_render_texture_rectangle"); +#endif /* WGL_NV_render_texture_rectangle */ +#ifdef WGL_NV_vertex_array_range + WGLEW_NV_vertex_array_range = wglewGetExtension("WGL_NV_vertex_array_range"); + if (glewExperimental || WGLEW_NV_vertex_array_range|| crippled) WGLEW_NV_vertex_array_range= !_glewInit_WGL_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_NV_vertex_array_range */ +#ifdef WGL_OML_sync_control + WGLEW_OML_sync_control = wglewGetExtension("WGL_OML_sync_control"); + if (glewExperimental || WGLEW_OML_sync_control|| crippled) WGLEW_OML_sync_control= !_glewInit_WGL_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* WGL_OML_sync_control */ + + return GLEW_OK; +} + +#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) + +PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay = NULL; + +PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig = NULL; +PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext = NULL; +PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer = NULL; +PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap = NULL; +PFNGLXCREATEWINDOWPROC __glewXCreateWindow = NULL; +PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer = NULL; +PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap = NULL; +PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow = NULL; +PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable = NULL; +PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib = NULL; +PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs = NULL; +PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent = NULL; +PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig = NULL; +PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent = NULL; +PFNGLXQUERYCONTEXTPROC __glewXQueryContext = NULL; +PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable = NULL; +PFNGLXSELECTEVENTPROC __glewXSelectEvent = NULL; + +PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI = NULL; +PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI = NULL; +PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI = NULL; + +PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT = NULL; +PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT = NULL; +PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT = NULL; +PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT = NULL; + +PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA = NULL; + +PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA = NULL; + +PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA = NULL; + +PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA = NULL; + +PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA = NULL; + +PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV = NULL; +PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV = NULL; + +#ifdef GLX_OML_sync_control +PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML = NULL; +PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML = NULL; +PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML = NULL; +PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML = NULL; +PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML = NULL; +#endif + +PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX = NULL; +PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX = NULL; +PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX = NULL; +PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX = NULL; +PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX = NULL; +PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX = NULL; + +PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX = NULL; +PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX = NULL; +PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX = NULL; +PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX = NULL; +PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX = NULL; + +PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX = NULL; +PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX = NULL; + +PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX = NULL; + +PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX = NULL; +PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX = NULL; +PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX = NULL; +PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX = NULL; +PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX = NULL; + +PFNGLXCUSHIONSGIPROC __glewXCushionSGI = NULL; + +PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI = NULL; +PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI = NULL; + +PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI = NULL; + +PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI = NULL; +PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI = NULL; + +PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN = NULL; + +PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN = NULL; +PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN = NULL; + +#if !defined(GLEW_MX) + +GLboolean __GLXEW_VERSION_1_0 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_1 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_2 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_3 = GL_FALSE; +GLboolean __GLXEW_VERSION_1_4 = GL_FALSE; +GLboolean __GLXEW_3DFX_multisample = GL_FALSE; +GLboolean __GLXEW_ARB_fbconfig_float = GL_FALSE; +GLboolean __GLXEW_ARB_get_proc_address = GL_FALSE; +GLboolean __GLXEW_ARB_multisample = GL_FALSE; +GLboolean __GLXEW_ATI_pixel_format_float = GL_FALSE; +GLboolean __GLXEW_ATI_render_texture = GL_FALSE; +GLboolean __GLXEW_EXT_import_context = GL_FALSE; +GLboolean __GLXEW_EXT_scene_marker = GL_FALSE; +GLboolean __GLXEW_EXT_visual_info = GL_FALSE; +GLboolean __GLXEW_EXT_visual_rating = GL_FALSE; +GLboolean __GLXEW_MESA_agp_offset = GL_FALSE; +GLboolean __GLXEW_MESA_copy_sub_buffer = GL_FALSE; +GLboolean __GLXEW_MESA_pixmap_colormap = GL_FALSE; +GLboolean __GLXEW_MESA_release_buffers = GL_FALSE; +GLboolean __GLXEW_MESA_set_3dfx_mode = GL_FALSE; +GLboolean __GLXEW_NV_float_buffer = GL_FALSE; +GLboolean __GLXEW_NV_vertex_array_range = GL_FALSE; +GLboolean __GLXEW_OML_swap_method = GL_FALSE; +#ifdef GLX_OML_sync_control +GLboolean __GLXEW_OML_sync_control = GL_FALSE; +#endif +GLboolean __GLXEW_SGIS_blended_overlay = GL_FALSE; +GLboolean __GLXEW_SGIS_color_range = GL_FALSE; +GLboolean __GLXEW_SGIS_multisample = GL_FALSE; +GLboolean __GLXEW_SGIS_shared_multisample = GL_FALSE; +GLboolean __GLXEW_SGIX_fbconfig = GL_FALSE; +GLboolean __GLXEW_SGIX_pbuffer = GL_FALSE; +GLboolean __GLXEW_SGIX_swap_barrier = GL_FALSE; +GLboolean __GLXEW_SGIX_swap_group = GL_FALSE; +GLboolean __GLXEW_SGIX_video_resize = GL_FALSE; +GLboolean __GLXEW_SGIX_visual_select_group = GL_FALSE; +GLboolean __GLXEW_SGI_cushion = GL_FALSE; +GLboolean __GLXEW_SGI_make_current_read = GL_FALSE; +GLboolean __GLXEW_SGI_swap_control = GL_FALSE; +GLboolean __GLXEW_SGI_video_sync = GL_FALSE; +GLboolean __GLXEW_SUN_get_transparent_index = GL_FALSE; +GLboolean __GLXEW_SUN_video_resize = GL_FALSE; + +#endif /* !GLEW_MX */ + +#ifdef GLX_VERSION_1_2 + +static GLboolean _glewInit_GLX_VERSION_1_2 (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentDisplay")) == NULL) || r; + + return r; +} + +#endif /* GLX_VERSION_1_2 */ + +#ifdef GLX_VERSION_1_3 + +static GLboolean _glewInit_GLX_VERSION_1_3 (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfig")) == NULL) || r; + r = ((glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXCreateNewContext")) == NULL) || r; + r = ((glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXCreatePbuffer")) == NULL) || r; + r = ((glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXCreatePixmap")) == NULL) || r; + r = ((glXCreateWindow = (PFNGLXCREATEWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXCreateWindow")) == NULL) || r; + r = ((glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPbuffer")) == NULL) || r; + r = ((glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)glewGetProcAddress((const GLubyte*)"glXDestroyPixmap")) == NULL) || r; + r = ((glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)glewGetProcAddress((const GLubyte*)"glXDestroyWindow")) == NULL) || r; + r = ((glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawable")) == NULL) || r; + r = ((glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttrib")) == NULL) || r; + r = ((glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigs")) == NULL) || r; + r = ((glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEvent")) == NULL) || r; + r = ((glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfig")) == NULL) || r; + r = ((glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)glewGetProcAddress((const GLubyte*)"glXMakeContextCurrent")) == NULL) || r; + r = ((glXQueryContext = (PFNGLXQUERYCONTEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContext")) == NULL) || r; + r = ((glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)glewGetProcAddress((const GLubyte*)"glXQueryDrawable")) == NULL) || r; + r = ((glXSelectEvent = (PFNGLXSELECTEVENTPROC)glewGetProcAddress((const GLubyte*)"glXSelectEvent")) == NULL) || r; + + return r; +} + +#endif /* GLX_VERSION_1_3 */ + +#ifdef GLX_VERSION_1_4 + +#endif /* GLX_VERSION_1_4 */ + +#ifdef GLX_3DFX_multisample + +#endif /* GLX_3DFX_multisample */ + +#ifdef GLX_ARB_fbconfig_float + +#endif /* GLX_ARB_fbconfig_float */ + +#ifdef GLX_ARB_get_proc_address + +#endif /* GLX_ARB_get_proc_address */ + +#ifdef GLX_ARB_multisample + +#endif /* GLX_ARB_multisample */ + +#ifdef GLX_ATI_pixel_format_float + +#endif /* GLX_ATI_pixel_format_float */ + +#ifdef GLX_ATI_render_texture + +static GLboolean _glewInit_GLX_ATI_render_texture (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindTexImageATI = (PFNGLXBINDTEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXBindTexImageATI")) == NULL) || r; + r = ((glXDrawableAttribATI = (PFNGLXDRAWABLEATTRIBATIPROC)glewGetProcAddress((const GLubyte*)"glXDrawableAttribATI")) == NULL) || r; + r = ((glXReleaseTexImageATI = (PFNGLXRELEASETEXIMAGEATIPROC)glewGetProcAddress((const GLubyte*)"glXReleaseTexImageATI")) == NULL) || r; + + return r; +} + +#endif /* GLX_ATI_render_texture */ + +#ifdef GLX_EXT_import_context + +static GLboolean _glewInit_GLX_EXT_import_context (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXFreeContextEXT = (PFNGLXFREECONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXFreeContextEXT")) == NULL) || r; + r = ((glXGetContextIDEXT = (PFNGLXGETCONTEXTIDEXTPROC)glewGetProcAddress((const GLubyte*)"glXGetContextIDEXT")) == NULL) || r; + r = ((glXImportContextEXT = (PFNGLXIMPORTCONTEXTEXTPROC)glewGetProcAddress((const GLubyte*)"glXImportContextEXT")) == NULL) || r; + r = ((glXQueryContextInfoEXT = (PFNGLXQUERYCONTEXTINFOEXTPROC)glewGetProcAddress((const GLubyte*)"glXQueryContextInfoEXT")) == NULL) || r; + + return r; +} + +#endif /* GLX_EXT_import_context */ + +#ifdef GLX_EXT_scene_marker + +#endif /* GLX_EXT_scene_marker */ + +#ifdef GLX_EXT_visual_info + +#endif /* GLX_EXT_visual_info */ + +#ifdef GLX_EXT_visual_rating + +#endif /* GLX_EXT_visual_rating */ + +#ifdef GLX_MESA_agp_offset + +static GLboolean _glewInit_GLX_MESA_agp_offset (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)glewGetProcAddress((const GLubyte*)"glXGetAGPOffsetMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_agp_offset */ + +#ifdef GLX_MESA_copy_sub_buffer + +static GLboolean _glewInit_GLX_MESA_copy_sub_buffer (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)glewGetProcAddress((const GLubyte*)"glXCopySubBufferMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_copy_sub_buffer */ + +#ifdef GLX_MESA_pixmap_colormap + +static GLboolean _glewInit_GLX_MESA_pixmap_colormap (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_pixmap_colormap */ + +#ifdef GLX_MESA_release_buffers + +static GLboolean _glewInit_GLX_MESA_release_buffers (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)glewGetProcAddress((const GLubyte*)"glXReleaseBuffersMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_release_buffers */ + +#ifdef GLX_MESA_set_3dfx_mode + +static GLboolean _glewInit_GLX_MESA_set_3dfx_mode (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)glewGetProcAddress((const GLubyte*)"glXSet3DfxModeMESA")) == NULL) || r; + + return r; +} + +#endif /* GLX_MESA_set_3dfx_mode */ + +#ifdef GLX_NV_float_buffer + +#endif /* GLX_NV_float_buffer */ + +#ifdef GLX_NV_vertex_array_range + +static GLboolean _glewInit_GLX_NV_vertex_array_range (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXAllocateMemoryNV = (PFNGLXALLOCATEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXAllocateMemoryNV")) == NULL) || r; + r = ((glXFreeMemoryNV = (PFNGLXFREEMEMORYNVPROC)glewGetProcAddress((const GLubyte*)"glXFreeMemoryNV")) == NULL) || r; + + return r; +} + +#endif /* GLX_NV_vertex_array_range */ + +#ifdef GLX_OML_swap_method + +#endif /* GLX_OML_swap_method */ + +#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#include + +static GLboolean _glewInit_GLX_OML_sync_control (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetMscRateOML = (PFNGLXGETMSCRATEOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetMscRateOML")) == NULL) || r; + r = ((glXGetSyncValuesOML = (PFNGLXGETSYNCVALUESOMLPROC)glewGetProcAddress((const GLubyte*)"glXGetSyncValuesOML")) == NULL) || r; + r = ((glXSwapBuffersMscOML = (PFNGLXSWAPBUFFERSMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXSwapBuffersMscOML")) == NULL) || r; + r = ((glXWaitForMscOML = (PFNGLXWAITFORMSCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForMscOML")) == NULL) || r; + r = ((glXWaitForSbcOML = (PFNGLXWAITFORSBCOMLPROC)glewGetProcAddress((const GLubyte*)"glXWaitForSbcOML")) == NULL) || r; + + return r; +} + +#endif /* GLX_OML_sync_control */ + +#ifdef GLX_SGIS_blended_overlay + +#endif /* GLX_SGIS_blended_overlay */ + +#ifdef GLX_SGIS_color_range + +#endif /* GLX_SGIS_color_range */ + +#ifdef GLX_SGIS_multisample + +#endif /* GLX_SGIS_multisample */ + +#ifdef GLX_SGIS_shared_multisample + +#endif /* GLX_SGIS_shared_multisample */ + +#ifdef GLX_SGIX_fbconfig + +static GLboolean _glewInit_GLX_SGIX_fbconfig (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChooseFBConfigSGIX")) == NULL) || r; + r = ((glXCreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateContextWithConfigSGIX")) == NULL) || r; + r = ((glXCreateGLXPixmapWithConfigSGIX = (PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPixmapWithConfigSGIX")) == NULL) || r; + r = ((glXGetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigAttribSGIX")) == NULL) || r; + r = ((glXGetFBConfigFromVisualSGIX = (PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetFBConfigFromVisualSGIX")) == NULL) || r; + r = ((glXGetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetVisualFromFBConfigSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_fbconfig */ + +#ifdef GLX_SGIX_pbuffer + +static GLboolean _glewInit_GLX_SGIX_pbuffer (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXCreateGLXPbufferSGIX")) == NULL) || r; + r = ((glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXDestroyGLXPbufferSGIX")) == NULL) || r; + r = ((glXGetSelectedEventSGIX = (PFNGLXGETSELECTEDEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXGetSelectedEventSGIX")) == NULL) || r; + r = ((glXQueryGLXPbufferSGIX = (PFNGLXQUERYGLXPBUFFERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryGLXPbufferSGIX")) == NULL) || r; + r = ((glXSelectEventSGIX = (PFNGLXSELECTEVENTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXSelectEventSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_pbuffer */ + +#ifdef GLX_SGIX_swap_barrier + +static GLboolean _glewInit_GLX_SGIX_swap_barrier (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindSwapBarrierSGIX")) == NULL) || r; + r = ((glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryMaxSwapBarriersSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_swap_barrier */ + +#ifdef GLX_SGIX_swap_group + +static GLboolean _glewInit_GLX_SGIX_swap_group (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)glewGetProcAddress((const GLubyte*)"glXJoinSwapGroupSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_swap_group */ + +#ifdef GLX_SGIX_video_resize + +static GLboolean _glewInit_GLX_SGIX_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXBindChannelToWindowSGIX = (PFNGLXBINDCHANNELTOWINDOWSGIXPROC)glewGetProcAddress((const GLubyte*)"glXBindChannelToWindowSGIX")) == NULL) || r; + r = ((glXChannelRectSGIX = (PFNGLXCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSGIX")) == NULL) || r; + r = ((glXChannelRectSyncSGIX = (PFNGLXCHANNELRECTSYNCSGIXPROC)glewGetProcAddress((const GLubyte*)"glXChannelRectSyncSGIX")) == NULL) || r; + r = ((glXQueryChannelDeltasSGIX = (PFNGLXQUERYCHANNELDELTASSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelDeltasSGIX")) == NULL) || r; + r = ((glXQueryChannelRectSGIX = (PFNGLXQUERYCHANNELRECTSGIXPROC)glewGetProcAddress((const GLubyte*)"glXQueryChannelRectSGIX")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGIX_video_resize */ + +#ifdef GLX_SGIX_visual_select_group + +#endif /* GLX_SGIX_visual_select_group */ + +#ifdef GLX_SGI_cushion + +static GLboolean _glewInit_GLX_SGI_cushion (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXCushionSGI = (PFNGLXCUSHIONSGIPROC)glewGetProcAddress((const GLubyte*)"glXCushionSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_cushion */ + +#ifdef GLX_SGI_make_current_read + +static GLboolean _glewInit_GLX_SGI_make_current_read (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)glewGetProcAddress((const GLubyte*)"glXGetCurrentReadDrawableSGI")) == NULL) || r; + r = ((glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)glewGetProcAddress((const GLubyte*)"glXMakeCurrentReadSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_make_current_read */ + +#ifdef GLX_SGI_swap_control + +static GLboolean _glewInit_GLX_SGI_swap_control (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)glewGetProcAddress((const GLubyte*)"glXSwapIntervalSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_swap_control */ + +#ifdef GLX_SGI_video_sync + +static GLboolean _glewInit_GLX_SGI_video_sync (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI")) == NULL) || r; + r = ((glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glewGetProcAddress((const GLubyte*)"glXWaitVideoSyncSGI")) == NULL) || r; + + return r; +} + +#endif /* GLX_SGI_video_sync */ + +#ifdef GLX_SUN_get_transparent_index + +static GLboolean _glewInit_GLX_SUN_get_transparent_index (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)glewGetProcAddress((const GLubyte*)"glXGetTransparentIndexSUN")) == NULL) || r; + + return r; +} + +#endif /* GLX_SUN_get_transparent_index */ + +#ifdef GLX_SUN_video_resize + +static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) +{ + GLboolean r = GL_FALSE; + + r = ((glXGetVideoResizeSUN = (PFNGLXGETVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXGetVideoResizeSUN")) == NULL) || r; + r = ((glXVideoResizeSUN = (PFNGLXVIDEORESIZESUNPROC)glewGetProcAddress((const GLubyte*)"glXVideoResizeSUN")) == NULL) || r; + + return r; +} + +#endif /* GLX_SUN_video_resize */ + +/* ------------------------------------------------------------------------ */ + +GLboolean glxewGetExtension (const char* name) +{ + GLubyte* p; + GLubyte* end; + GLuint len = _glewStrLen((const GLubyte*)name); +/* if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; */ +/* p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); */ + if (glXGetClientString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; + p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); + if (0 == p) return GL_FALSE; + end = p + _glewStrLen(p); + while (p < end) + { + GLuint n = _glewStrCLen(p, ' '); + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; + p += n+1; + } + return GL_FALSE; +} + +GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) +{ + int major, minor; + /* initialize core GLX 1.2 */ + if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY; + /* initialize flags */ + GLXEW_VERSION_1_0 = GL_TRUE; + GLXEW_VERSION_1_1 = GL_TRUE; + GLXEW_VERSION_1_2 = GL_TRUE; + GLXEW_VERSION_1_3 = GL_TRUE; + GLXEW_VERSION_1_4 = GL_TRUE; + /* query GLX version */ + glXQueryVersion(glXGetCurrentDisplay(), &major, &minor); + if (major == 1 && minor <= 3) + { + switch (minor) + { + case 3: + GLXEW_VERSION_1_4 = GL_FALSE; + break; + case 2: + GLXEW_VERSION_1_4 = GL_FALSE; + GLXEW_VERSION_1_3 = GL_FALSE; + break; + default: + return GLEW_ERROR_GLX_VERSION_11_ONLY; + break; + } + } + /* initialize extensions */ +#ifdef GLX_VERSION_1_3 + if (glewExperimental || GLXEW_VERSION_1_3) GLXEW_VERSION_1_3 = !_glewInit_GLX_VERSION_1_3(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_VERSION_1_3 */ +#ifdef GLX_3DFX_multisample + GLXEW_3DFX_multisample = glxewGetExtension("GLX_3DFX_multisample"); +#endif /* GLX_3DFX_multisample */ +#ifdef GLX_ARB_fbconfig_float + GLXEW_ARB_fbconfig_float = glxewGetExtension("GLX_ARB_fbconfig_float"); +#endif /* GLX_ARB_fbconfig_float */ +#ifdef GLX_ARB_get_proc_address + GLXEW_ARB_get_proc_address = glxewGetExtension("GLX_ARB_get_proc_address"); +#endif /* GLX_ARB_get_proc_address */ +#ifdef GLX_ARB_multisample + GLXEW_ARB_multisample = glxewGetExtension("GLX_ARB_multisample"); +#endif /* GLX_ARB_multisample */ +#ifdef GLX_ATI_pixel_format_float + GLXEW_ATI_pixel_format_float = glxewGetExtension("GLX_ATI_pixel_format_float"); +#endif /* GLX_ATI_pixel_format_float */ +#ifdef GLX_ATI_render_texture + GLXEW_ATI_render_texture = glxewGetExtension("GLX_ATI_render_texture"); + if (glewExperimental || GLXEW_ATI_render_texture) GLXEW_ATI_render_texture = !_glewInit_GLX_ATI_render_texture(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_ATI_render_texture */ +#ifdef GLX_EXT_import_context + GLXEW_EXT_import_context = glxewGetExtension("GLX_EXT_import_context"); + if (glewExperimental || GLXEW_EXT_import_context) GLXEW_EXT_import_context = !_glewInit_GLX_EXT_import_context(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_EXT_import_context */ +#ifdef GLX_EXT_scene_marker + GLXEW_EXT_scene_marker = glxewGetExtension("GLX_EXT_scene_marker"); +#endif /* GLX_EXT_scene_marker */ +#ifdef GLX_EXT_visual_info + GLXEW_EXT_visual_info = glxewGetExtension("GLX_EXT_visual_info"); +#endif /* GLX_EXT_visual_info */ +#ifdef GLX_EXT_visual_rating + GLXEW_EXT_visual_rating = glxewGetExtension("GLX_EXT_visual_rating"); +#endif /* GLX_EXT_visual_rating */ +#ifdef GLX_MESA_agp_offset + GLXEW_MESA_agp_offset = glxewGetExtension("GLX_MESA_agp_offset"); + if (glewExperimental || GLXEW_MESA_agp_offset) GLXEW_MESA_agp_offset = !_glewInit_GLX_MESA_agp_offset(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_agp_offset */ +#ifdef GLX_MESA_copy_sub_buffer + GLXEW_MESA_copy_sub_buffer = glxewGetExtension("GLX_MESA_copy_sub_buffer"); + if (glewExperimental || GLXEW_MESA_copy_sub_buffer) GLXEW_MESA_copy_sub_buffer = !_glewInit_GLX_MESA_copy_sub_buffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_copy_sub_buffer */ +#ifdef GLX_MESA_pixmap_colormap + GLXEW_MESA_pixmap_colormap = glxewGetExtension("GLX_MESA_pixmap_colormap"); + if (glewExperimental || GLXEW_MESA_pixmap_colormap) GLXEW_MESA_pixmap_colormap = !_glewInit_GLX_MESA_pixmap_colormap(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_pixmap_colormap */ +#ifdef GLX_MESA_release_buffers + GLXEW_MESA_release_buffers = glxewGetExtension("GLX_MESA_release_buffers"); + if (glewExperimental || GLXEW_MESA_release_buffers) GLXEW_MESA_release_buffers = !_glewInit_GLX_MESA_release_buffers(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_release_buffers */ +#ifdef GLX_MESA_set_3dfx_mode + GLXEW_MESA_set_3dfx_mode = glxewGetExtension("GLX_MESA_set_3dfx_mode"); + if (glewExperimental || GLXEW_MESA_set_3dfx_mode) GLXEW_MESA_set_3dfx_mode = !_glewInit_GLX_MESA_set_3dfx_mode(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_MESA_set_3dfx_mode */ +#ifdef GLX_NV_float_buffer + GLXEW_NV_float_buffer = glxewGetExtension("GLX_NV_float_buffer"); +#endif /* GLX_NV_float_buffer */ +#ifdef GLX_NV_vertex_array_range + GLXEW_NV_vertex_array_range = glxewGetExtension("GLX_NV_vertex_array_range"); + if (glewExperimental || GLXEW_NV_vertex_array_range) GLXEW_NV_vertex_array_range = !_glewInit_GLX_NV_vertex_array_range(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_NV_vertex_array_range */ +#ifdef GLX_OML_swap_method + GLXEW_OML_swap_method = glxewGetExtension("GLX_OML_swap_method"); +#endif /* GLX_OML_swap_method */ +#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#include + GLXEW_OML_sync_control = glxewGetExtension("GLX_OML_sync_control"); + if (glewExperimental || GLXEW_OML_sync_control) GLXEW_OML_sync_control = !_glewInit_GLX_OML_sync_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_OML_sync_control */ +#ifdef GLX_SGIS_blended_overlay + GLXEW_SGIS_blended_overlay = glxewGetExtension("GLX_SGIS_blended_overlay"); +#endif /* GLX_SGIS_blended_overlay */ +#ifdef GLX_SGIS_color_range + GLXEW_SGIS_color_range = glxewGetExtension("GLX_SGIS_color_range"); +#endif /* GLX_SGIS_color_range */ +#ifdef GLX_SGIS_multisample + GLXEW_SGIS_multisample = glxewGetExtension("GLX_SGIS_multisample"); +#endif /* GLX_SGIS_multisample */ +#ifdef GLX_SGIS_shared_multisample + GLXEW_SGIS_shared_multisample = glxewGetExtension("GLX_SGIS_shared_multisample"); +#endif /* GLX_SGIS_shared_multisample */ +#ifdef GLX_SGIX_fbconfig + GLXEW_SGIX_fbconfig = glxewGetExtension("GLX_SGIX_fbconfig"); + if (glewExperimental || GLXEW_SGIX_fbconfig) GLXEW_SGIX_fbconfig = !_glewInit_GLX_SGIX_fbconfig(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_fbconfig */ +#ifdef GLX_SGIX_pbuffer + GLXEW_SGIX_pbuffer = glxewGetExtension("GLX_SGIX_pbuffer"); + if (glewExperimental || GLXEW_SGIX_pbuffer) GLXEW_SGIX_pbuffer = !_glewInit_GLX_SGIX_pbuffer(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_pbuffer */ +#ifdef GLX_SGIX_swap_barrier + GLXEW_SGIX_swap_barrier = glxewGetExtension("GLX_SGIX_swap_barrier"); + if (glewExperimental || GLXEW_SGIX_swap_barrier) GLXEW_SGIX_swap_barrier = !_glewInit_GLX_SGIX_swap_barrier(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_swap_barrier */ +#ifdef GLX_SGIX_swap_group + GLXEW_SGIX_swap_group = glxewGetExtension("GLX_SGIX_swap_group"); + if (glewExperimental || GLXEW_SGIX_swap_group) GLXEW_SGIX_swap_group = !_glewInit_GLX_SGIX_swap_group(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_swap_group */ +#ifdef GLX_SGIX_video_resize + GLXEW_SGIX_video_resize = glxewGetExtension("GLX_SGIX_video_resize"); + if (glewExperimental || GLXEW_SGIX_video_resize) GLXEW_SGIX_video_resize = !_glewInit_GLX_SGIX_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGIX_video_resize */ +#ifdef GLX_SGIX_visual_select_group + GLXEW_SGIX_visual_select_group = glxewGetExtension("GLX_SGIX_visual_select_group"); +#endif /* GLX_SGIX_visual_select_group */ +#ifdef GLX_SGI_cushion + GLXEW_SGI_cushion = glxewGetExtension("GLX_SGI_cushion"); + if (glewExperimental || GLXEW_SGI_cushion) GLXEW_SGI_cushion = !_glewInit_GLX_SGI_cushion(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_cushion */ +#ifdef GLX_SGI_make_current_read + GLXEW_SGI_make_current_read = glxewGetExtension("GLX_SGI_make_current_read"); + if (glewExperimental || GLXEW_SGI_make_current_read) GLXEW_SGI_make_current_read = !_glewInit_GLX_SGI_make_current_read(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_make_current_read */ +#ifdef GLX_SGI_swap_control + GLXEW_SGI_swap_control = glxewGetExtension("GLX_SGI_swap_control"); + if (glewExperimental || GLXEW_SGI_swap_control) GLXEW_SGI_swap_control = !_glewInit_GLX_SGI_swap_control(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_swap_control */ +#ifdef GLX_SGI_video_sync + GLXEW_SGI_video_sync = glxewGetExtension("GLX_SGI_video_sync"); + if (glewExperimental || GLXEW_SGI_video_sync) GLXEW_SGI_video_sync = !_glewInit_GLX_SGI_video_sync(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SGI_video_sync */ +#ifdef GLX_SUN_get_transparent_index + GLXEW_SUN_get_transparent_index = glxewGetExtension("GLX_SUN_get_transparent_index"); + if (glewExperimental || GLXEW_SUN_get_transparent_index) GLXEW_SUN_get_transparent_index = !_glewInit_GLX_SUN_get_transparent_index(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SUN_get_transparent_index */ +#ifdef GLX_SUN_video_resize + GLXEW_SUN_video_resize = glxewGetExtension("GLX_SUN_video_resize"); + if (glewExperimental || GLXEW_SUN_video_resize) GLXEW_SUN_video_resize = !_glewInit_GLX_SUN_video_resize(GLEW_CONTEXT_ARG_VAR_INIT); +#endif /* GLX_SUN_video_resize */ + + return GLEW_OK; +} + +#endif /* !__APPLE__ || GLEW_APPLE_GLX */ + +/* ------------------------------------------------------------------------ */ + +const GLubyte* glewGetErrorString (GLenum error) +{ + static const GLubyte* _glewErrorString[] = + { + (const GLubyte*)"No error", + (const GLubyte*)"Missing GL version", + (const GLubyte*)"GL 1.1 and up are not supported", + (const GLubyte*)"GLX 1.2 and up are not supported", + (const GLubyte*)"Unknown error" + }; + const int max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1; + return _glewErrorString[(int)error > max_error ? max_error : (int)error]; +} + +const GLubyte* glewGetString (GLenum name) +{ + static const GLubyte* _glewString[] = + { + (const GLubyte*)NULL, + (const GLubyte*)"1.3.4" + }; + const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1; + return _glewString[(int)name > max_string ? 0 : (int)name]; +} + +/* ------------------------------------------------------------------------ */ + +GLboolean glewExperimental = GL_FALSE; + +#if !defined(GLEW_MX) + +#if defined(_WIN32) +extern GLenum wglewContextInit (void); +#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */ +extern GLenum glxewContextInit (void); +#endif /* _WIN32 */ + +GLenum glewInit () +{ + GLenum r; + if ( (r = glewContextInit()) ) return r; +#if defined(_WIN32) + return wglewContextInit(); +#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */ + return glxewContextInit(); +#else + return r; +#endif /* _WIN32 */ +} + +#endif /* !GLEW_MX */ +#ifdef GLEW_MX +GLboolean glewContextIsSupported (GLEWContext* ctx, const char* name) +#else +GLboolean glewIsSupported (const char* name) +#endif +{ + GLubyte* pos = (GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if (_glewStrSame1(&pos, &len, (const GLubyte*)"GL_", 3)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) + { +#ifdef GL_VERSION_1_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) + { + ret = GLEW_VERSION_1_2; + continue; + } +#endif +#ifdef GL_VERSION_1_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) + { + ret = GLEW_VERSION_1_3; + continue; + } +#endif +#ifdef GL_VERSION_1_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) + { + ret = GLEW_VERSION_1_4; + continue; + } +#endif +#ifdef GL_VERSION_1_5 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_5", 3)) + { + ret = GLEW_VERSION_1_5; + continue; + } +#endif +#ifdef GL_VERSION_2_0 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"2_0", 3)) + { + ret = GLEW_VERSION_2_0; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef GL_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_3DFX_multisample; + continue; + } +#endif +#ifdef GL_3DFX_tbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tbuffer", 7)) + { + ret = GLEW_3DFX_tbuffer; + continue; + } +#endif +#ifdef GL_3DFX_texture_compression_FXT1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_FXT1", 24)) + { + ret = GLEW_3DFX_texture_compression_FXT1; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"APPLE_", 6)) + { +#ifdef GL_APPLE_client_storage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"client_storage", 14)) + { + ret = GLEW_APPLE_client_storage; + continue; + } +#endif +#ifdef GL_APPLE_element_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) + { + ret = GLEW_APPLE_element_array; + continue; + } +#endif +#ifdef GL_APPLE_fence + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) + { + ret = GLEW_APPLE_fence; + continue; + } +#endif +#ifdef GL_APPLE_float_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_pixels", 12)) + { + ret = GLEW_APPLE_float_pixels; + continue; + } +#endif +#ifdef GL_APPLE_pixel_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer", 12)) + { + ret = GLEW_APPLE_pixel_buffer; + continue; + } +#endif +#ifdef GL_APPLE_specular_vector + if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_vector", 15)) + { + ret = GLEW_APPLE_specular_vector; + continue; + } +#endif +#ifdef GL_APPLE_texture_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) + { + ret = GLEW_APPLE_texture_range; + continue; + } +#endif +#ifdef GL_APPLE_transform_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transform_hint", 14)) + { + ret = GLEW_APPLE_transform_hint; + continue; + } +#endif +#ifdef GL_APPLE_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) + { + ret = GLEW_APPLE_vertex_array_object; + continue; + } +#endif +#ifdef GL_APPLE_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = GLEW_APPLE_vertex_array_range; + continue; + } +#endif +#ifdef GL_APPLE_ycbcr_422 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_422", 9)) + { + ret = GLEW_APPLE_ycbcr_422; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef GL_ARB_color_buffer_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_buffer_float", 18)) + { + ret = GLEW_ARB_color_buffer_float; + continue; + } +#endif +#ifdef GL_ARB_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) + { + ret = GLEW_ARB_depth_texture; + continue; + } +#endif +#ifdef GL_ARB_draw_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) + { + ret = GLEW_ARB_draw_buffers; + continue; + } +#endif +#ifdef GL_ARB_fragment_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) + { + ret = GLEW_ARB_fragment_program; + continue; + } +#endif +#ifdef GL_ARB_fragment_program_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_shadow", 23)) + { + ret = GLEW_ARB_fragment_program_shadow; + continue; + } +#endif +#ifdef GL_ARB_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) + { + ret = GLEW_ARB_fragment_shader; + continue; + } +#endif +#ifdef GL_ARB_half_float_pixel + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float_pixel", 16)) + { + ret = GLEW_ARB_half_float_pixel; + continue; + } +#endif +#ifdef GL_ARB_imaging + if (_glewStrSame3(&pos, &len, (const GLubyte*)"imaging", 7)) + { + ret = GLEW_ARB_imaging; + continue; + } +#endif +#ifdef GL_ARB_matrix_palette + if (_glewStrSame3(&pos, &len, (const GLubyte*)"matrix_palette", 14)) + { + ret = GLEW_ARB_matrix_palette; + continue; + } +#endif +#ifdef GL_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_ARB_multisample; + continue; + } +#endif +#ifdef GL_ARB_multitexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multitexture", 12)) + { + ret = GLEW_ARB_multitexture; + continue; + } +#endif +#ifdef GL_ARB_occlusion_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) + { + ret = GLEW_ARB_occlusion_query; + continue; + } +#endif +#ifdef GL_ARB_pixel_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) + { + ret = GLEW_ARB_pixel_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_point_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) + { + ret = GLEW_ARB_point_parameters; + continue; + } +#endif +#ifdef GL_ARB_point_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) + { + ret = GLEW_ARB_point_sprite; + continue; + } +#endif +#ifdef GL_ARB_shader_objects + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shader_objects", 14)) + { + ret = GLEW_ARB_shader_objects; + continue; + } +#endif +#ifdef GL_ARB_shading_language_100 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shading_language_100", 20)) + { + ret = GLEW_ARB_shading_language_100; + continue; + } +#endif +#ifdef GL_ARB_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) + { + ret = GLEW_ARB_shadow; + continue; + } +#endif +#ifdef GL_ARB_shadow_ambient + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) + { + ret = GLEW_ARB_shadow_ambient; + continue; + } +#endif +#ifdef GL_ARB_texture_border_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) + { + ret = GLEW_ARB_texture_border_clamp; + continue; + } +#endif +#ifdef GL_ARB_texture_compression + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression", 19)) + { + ret = GLEW_ARB_texture_compression; + continue; + } +#endif +#ifdef GL_ARB_texture_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) + { + ret = GLEW_ARB_texture_cube_map; + continue; + } +#endif +#ifdef GL_ARB_texture_env_add + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) + { + ret = GLEW_ARB_texture_env_add; + continue; + } +#endif +#ifdef GL_ARB_texture_env_combine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) + { + ret = GLEW_ARB_texture_env_combine; + continue; + } +#endif +#ifdef GL_ARB_texture_env_crossbar + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_crossbar", 20)) + { + ret = GLEW_ARB_texture_env_crossbar; + continue; + } +#endif +#ifdef GL_ARB_texture_env_dot3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) + { + ret = GLEW_ARB_texture_env_dot3; + continue; + } +#endif +#ifdef GL_ARB_texture_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) + { + ret = GLEW_ARB_texture_float; + continue; + } +#endif +#ifdef GL_ARB_texture_mirrored_repeat + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) + { + ret = GLEW_ARB_texture_mirrored_repeat; + continue; + } +#endif +#ifdef GL_ARB_texture_non_power_of_two + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_non_power_of_two", 24)) + { + ret = GLEW_ARB_texture_non_power_of_two; + continue; + } +#endif +#ifdef GL_ARB_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) + { + ret = GLEW_ARB_texture_rectangle; + continue; + } +#endif +#ifdef GL_ARB_transpose_matrix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"transpose_matrix", 16)) + { + ret = GLEW_ARB_transpose_matrix; + continue; + } +#endif +#ifdef GL_ARB_vertex_blend + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_blend", 12)) + { + ret = GLEW_ARB_vertex_blend; + continue; + } +#endif +#ifdef GL_ARB_vertex_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_buffer_object", 20)) + { + ret = GLEW_ARB_vertex_buffer_object; + continue; + } +#endif +#ifdef GL_ARB_vertex_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) + { + ret = GLEW_ARB_vertex_program; + continue; + } +#endif +#ifdef GL_ARB_vertex_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) + { + ret = GLEW_ARB_vertex_shader; + continue; + } +#endif +#ifdef GL_ARB_window_pos + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) + { + ret = GLEW_ARB_window_pos; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATIX_", 5)) + { +#ifdef GL_ATIX_point_sprites + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprites", 13)) + { + ret = GLEW_ATIX_point_sprites; + continue; + } +#endif +#ifdef GL_ATIX_texture_env_combine3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) + { + ret = GLEW_ATIX_texture_env_combine3; + continue; + } +#endif +#ifdef GL_ATIX_texture_env_route + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_route", 17)) + { + ret = GLEW_ATIX_texture_env_route; + continue; + } +#endif +#ifdef GL_ATIX_vertex_shader_output_point_size + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader_output_point_size", 31)) + { + ret = GLEW_ATIX_vertex_shader_output_point_size; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef GL_ATI_draw_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_buffers", 12)) + { + ret = GLEW_ATI_draw_buffers; + continue; + } +#endif +#ifdef GL_ATI_element_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"element_array", 13)) + { + ret = GLEW_ATI_element_array; + continue; + } +#endif +#ifdef GL_ATI_envmap_bumpmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"envmap_bumpmap", 14)) + { + ret = GLEW_ATI_envmap_bumpmap; + continue; + } +#endif +#ifdef GL_ATI_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_shader", 15)) + { + ret = GLEW_ATI_fragment_shader; + continue; + } +#endif +#ifdef GL_ATI_map_object_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"map_object_buffer", 17)) + { + ret = GLEW_ATI_map_object_buffer; + continue; + } +#endif +#ifdef GL_ATI_pn_triangles + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pn_triangles", 12)) + { + ret = GLEW_ATI_pn_triangles; + continue; + } +#endif +#ifdef GL_ATI_separate_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_stencil", 16)) + { + ret = GLEW_ATI_separate_stencil; + continue; + } +#endif +#ifdef GL_ATI_text_fragment_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"text_fragment_shader", 20)) + { + ret = GLEW_ATI_text_fragment_shader; + continue; + } +#endif +#ifdef GL_ATI_texture_compression_3dc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_3dc", 23)) + { + ret = GLEW_ATI_texture_compression_3dc; + continue; + } +#endif +#ifdef GL_ATI_texture_env_combine3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine3", 20)) + { + ret = GLEW_ATI_texture_env_combine3; + continue; + } +#endif +#ifdef GL_ATI_texture_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_float", 13)) + { + ret = GLEW_ATI_texture_float; + continue; + } +#endif +#ifdef GL_ATI_texture_mirror_once + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_once", 19)) + { + ret = GLEW_ATI_texture_mirror_once; + continue; + } +#endif +#ifdef GL_ATI_vertex_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_object", 19)) + { + ret = GLEW_ATI_vertex_array_object; + continue; + } +#endif +#ifdef GL_ATI_vertex_attrib_array_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_attrib_array_object", 26)) + { + ret = GLEW_ATI_vertex_attrib_array_object; + continue; + } +#endif +#ifdef GL_ATI_vertex_streams + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_streams", 14)) + { + ret = GLEW_ATI_vertex_streams; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef GL_EXT_422_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"422_pixels", 10)) + { + ret = GLEW_EXT_422_pixels; + continue; + } +#endif +#ifdef GL_EXT_Cg_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"Cg_shader", 9)) + { + ret = GLEW_EXT_Cg_shader; + continue; + } +#endif +#ifdef GL_EXT_abgr + if (_glewStrSame3(&pos, &len, (const GLubyte*)"abgr", 4)) + { + ret = GLEW_EXT_abgr; + continue; + } +#endif +#ifdef GL_EXT_bgra + if (_glewStrSame3(&pos, &len, (const GLubyte*)"bgra", 4)) + { + ret = GLEW_EXT_bgra; + continue; + } +#endif +#ifdef GL_EXT_blend_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_color", 11)) + { + ret = GLEW_EXT_blend_color; + continue; + } +#endif +#ifdef GL_EXT_blend_equation_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_equation_separate", 23)) + { + ret = GLEW_EXT_blend_equation_separate; + continue; + } +#endif +#ifdef GL_EXT_blend_func_separate + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_func_separate", 19)) + { + ret = GLEW_EXT_blend_func_separate; + continue; + } +#endif +#ifdef GL_EXT_blend_logic_op + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_logic_op", 14)) + { + ret = GLEW_EXT_blend_logic_op; + continue; + } +#endif +#ifdef GL_EXT_blend_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_minmax", 12)) + { + ret = GLEW_EXT_blend_minmax; + continue; + } +#endif +#ifdef GL_EXT_blend_subtract + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_subtract", 14)) + { + ret = GLEW_EXT_blend_subtract; + continue; + } +#endif +#ifdef GL_EXT_clip_volume_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clip_volume_hint", 16)) + { + ret = GLEW_EXT_clip_volume_hint; + continue; + } +#endif +#ifdef GL_EXT_cmyka + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cmyka", 5)) + { + ret = GLEW_EXT_cmyka; + continue; + } +#endif +#ifdef GL_EXT_color_subtable + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_subtable", 14)) + { + ret = GLEW_EXT_color_subtable; + continue; + } +#endif +#ifdef GL_EXT_compiled_vertex_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"compiled_vertex_array", 21)) + { + ret = GLEW_EXT_compiled_vertex_array; + continue; + } +#endif +#ifdef GL_EXT_convolution + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution", 11)) + { + ret = GLEW_EXT_convolution; + continue; + } +#endif +#ifdef GL_EXT_coordinate_frame + if (_glewStrSame3(&pos, &len, (const GLubyte*)"coordinate_frame", 16)) + { + ret = GLEW_EXT_coordinate_frame; + continue; + } +#endif +#ifdef GL_EXT_copy_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_texture", 12)) + { + ret = GLEW_EXT_copy_texture; + continue; + } +#endif +#ifdef GL_EXT_cull_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) + { + ret = GLEW_EXT_cull_vertex; + continue; + } +#endif +#ifdef GL_EXT_depth_bounds_test + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_bounds_test", 17)) + { + ret = GLEW_EXT_depth_bounds_test; + continue; + } +#endif +#ifdef GL_EXT_draw_range_elements + if (_glewStrSame3(&pos, &len, (const GLubyte*)"draw_range_elements", 19)) + { + ret = GLEW_EXT_draw_range_elements; + continue; + } +#endif +#ifdef GL_EXT_fog_coord + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_coord", 9)) + { + ret = GLEW_EXT_fog_coord; + continue; + } +#endif +#ifdef GL_EXT_fragment_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_lighting", 17)) + { + ret = GLEW_EXT_fragment_lighting; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_blit + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_blit", 16)) + { + ret = GLEW_EXT_framebuffer_blit; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_multisample", 23)) + { + ret = GLEW_EXT_framebuffer_multisample; + continue; + } +#endif +#ifdef GL_EXT_framebuffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framebuffer_object", 18)) + { + ret = GLEW_EXT_framebuffer_object; + continue; + } +#endif +#ifdef GL_EXT_histogram + if (_glewStrSame3(&pos, &len, (const GLubyte*)"histogram", 9)) + { + ret = GLEW_EXT_histogram; + continue; + } +#endif +#ifdef GL_EXT_index_array_formats + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_array_formats", 19)) + { + ret = GLEW_EXT_index_array_formats; + continue; + } +#endif +#ifdef GL_EXT_index_func + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_func", 10)) + { + ret = GLEW_EXT_index_func; + continue; + } +#endif +#ifdef GL_EXT_index_material + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_material", 14)) + { + ret = GLEW_EXT_index_material; + continue; + } +#endif +#ifdef GL_EXT_index_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"index_texture", 13)) + { + ret = GLEW_EXT_index_texture; + continue; + } +#endif +#ifdef GL_EXT_light_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_texture", 13)) + { + ret = GLEW_EXT_light_texture; + continue; + } +#endif +#ifdef GL_EXT_misc_attribute + if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_attribute", 14)) + { + ret = GLEW_EXT_misc_attribute; + continue; + } +#endif +#ifdef GL_EXT_multi_draw_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multi_draw_arrays", 17)) + { + ret = GLEW_EXT_multi_draw_arrays; + continue; + } +#endif +#ifdef GL_EXT_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_EXT_multisample; + continue; + } +#endif +#ifdef GL_EXT_packed_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) + { + ret = GLEW_EXT_packed_depth_stencil; + continue; + } +#endif +#ifdef GL_EXT_packed_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_pixels", 13)) + { + ret = GLEW_EXT_packed_pixels; + continue; + } +#endif +#ifdef GL_EXT_paletted_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"paletted_texture", 16)) + { + ret = GLEW_EXT_paletted_texture; + continue; + } +#endif +#ifdef GL_EXT_pixel_buffer_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_buffer_object", 19)) + { + ret = GLEW_EXT_pixel_buffer_object; + continue; + } +#endif +#ifdef GL_EXT_pixel_transform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform", 15)) + { + ret = GLEW_EXT_pixel_transform; + continue; + } +#endif +#ifdef GL_EXT_pixel_transform_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_transform_color_table", 27)) + { + ret = GLEW_EXT_pixel_transform_color_table; + continue; + } +#endif +#ifdef GL_EXT_point_parameters + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_parameters", 16)) + { + ret = GLEW_EXT_point_parameters; + continue; + } +#endif +#ifdef GL_EXT_polygon_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"polygon_offset", 14)) + { + ret = GLEW_EXT_polygon_offset; + continue; + } +#endif +#ifdef GL_EXT_rescale_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rescale_normal", 14)) + { + ret = GLEW_EXT_rescale_normal; + continue; + } +#endif +#ifdef GL_EXT_scene_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) + { + ret = GLEW_EXT_scene_marker; + continue; + } +#endif +#ifdef GL_EXT_secondary_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"secondary_color", 15)) + { + ret = GLEW_EXT_secondary_color; + continue; + } +#endif +#ifdef GL_EXT_separate_specular_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"separate_specular_color", 23)) + { + ret = GLEW_EXT_separate_specular_color; + continue; + } +#endif +#ifdef GL_EXT_shadow_funcs + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_funcs", 12)) + { + ret = GLEW_EXT_shadow_funcs; + continue; + } +#endif +#ifdef GL_EXT_shared_texture_palette + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_texture_palette", 22)) + { + ret = GLEW_EXT_shared_texture_palette; + continue; + } +#endif +#ifdef GL_EXT_stencil_clear_tag + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_clear_tag", 17)) + { + ret = GLEW_EXT_stencil_clear_tag; + continue; + } +#endif +#ifdef GL_EXT_stencil_two_side + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_two_side", 16)) + { + ret = GLEW_EXT_stencil_two_side; + continue; + } +#endif +#ifdef GL_EXT_stencil_wrap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stencil_wrap", 12)) + { + ret = GLEW_EXT_stencil_wrap; + continue; + } +#endif +#ifdef GL_EXT_subtexture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"subtexture", 10)) + { + ret = GLEW_EXT_subtexture; + continue; + } +#endif +#ifdef GL_EXT_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture", 7)) + { + ret = GLEW_EXT_texture; + continue; + } +#endif +#ifdef GL_EXT_texture3D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture3D", 9)) + { + ret = GLEW_EXT_texture3D; + continue; + } +#endif +#ifdef GL_EXT_texture_compression_dxt1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_dxt1", 24)) + { + ret = GLEW_EXT_texture_compression_dxt1; + continue; + } +#endif +#ifdef GL_EXT_texture_compression_s3tc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_s3tc", 24)) + { + ret = GLEW_EXT_texture_compression_s3tc; + continue; + } +#endif +#ifdef GL_EXT_texture_cube_map + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_cube_map", 16)) + { + ret = GLEW_EXT_texture_cube_map; + continue; + } +#endif +#ifdef GL_EXT_texture_edge_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) + { + ret = GLEW_EXT_texture_edge_clamp; + continue; + } +#endif +#ifdef GL_EXT_texture_env + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env", 11)) + { + ret = GLEW_EXT_texture_env; + continue; + } +#endif +#ifdef GL_EXT_texture_env_add + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_add", 15)) + { + ret = GLEW_EXT_texture_env_add; + continue; + } +#endif +#ifdef GL_EXT_texture_env_combine + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine", 19)) + { + ret = GLEW_EXT_texture_env_combine; + continue; + } +#endif +#ifdef GL_EXT_texture_env_dot3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_dot3", 16)) + { + ret = GLEW_EXT_texture_env_dot3; + continue; + } +#endif +#ifdef GL_EXT_texture_filter_anisotropic + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter_anisotropic", 26)) + { + ret = GLEW_EXT_texture_filter_anisotropic; + continue; + } +#endif +#ifdef GL_EXT_texture_lod_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) + { + ret = GLEW_EXT_texture_lod_bias; + continue; + } +#endif +#ifdef GL_EXT_texture_mirror_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirror_clamp", 20)) + { + ret = GLEW_EXT_texture_mirror_clamp; + continue; + } +#endif +#ifdef GL_EXT_texture_object + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_object", 14)) + { + ret = GLEW_EXT_texture_object; + continue; + } +#endif +#ifdef GL_EXT_texture_perturb_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_perturb_normal", 22)) + { + ret = GLEW_EXT_texture_perturb_normal; + continue; + } +#endif +#ifdef GL_EXT_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) + { + ret = GLEW_EXT_texture_rectangle; + continue; + } +#endif +#ifdef GL_EXT_texture_sRGB + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_sRGB", 12)) + { + ret = GLEW_EXT_texture_sRGB; + continue; + } +#endif +#ifdef GL_EXT_vertex_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array", 12)) + { + ret = GLEW_EXT_vertex_array; + continue; + } +#endif +#ifdef GL_EXT_vertex_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_shader", 13)) + { + ret = GLEW_EXT_vertex_shader; + continue; + } +#endif +#ifdef GL_EXT_vertex_weighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_weighting", 16)) + { + ret = GLEW_EXT_vertex_weighting; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"GREMEDY_", 8)) + { +#ifdef GL_GREMEDY_string_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"string_marker", 13)) + { + ret = GLEW_GREMEDY_string_marker; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"HP_", 3)) + { +#ifdef GL_HP_convolution_border_modes + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) + { + ret = GLEW_HP_convolution_border_modes; + continue; + } +#endif +#ifdef GL_HP_image_transform + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_transform", 15)) + { + ret = GLEW_HP_image_transform; + continue; + } +#endif +#ifdef GL_HP_occlusion_test + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_test", 14)) + { + ret = GLEW_HP_occlusion_test; + continue; + } +#endif +#ifdef GL_HP_texture_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lighting", 16)) + { + ret = GLEW_HP_texture_lighting; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"IBM_", 4)) + { +#ifdef GL_IBM_cull_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cull_vertex", 11)) + { + ret = GLEW_IBM_cull_vertex; + continue; + } +#endif +#ifdef GL_IBM_multimode_draw_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multimode_draw_arrays", 21)) + { + ret = GLEW_IBM_multimode_draw_arrays; + continue; + } +#endif +#ifdef GL_IBM_rasterpos_clip + if (_glewStrSame3(&pos, &len, (const GLubyte*)"rasterpos_clip", 14)) + { + ret = GLEW_IBM_rasterpos_clip; + continue; + } +#endif +#ifdef GL_IBM_static_data + if (_glewStrSame3(&pos, &len, (const GLubyte*)"static_data", 11)) + { + ret = GLEW_IBM_static_data; + continue; + } +#endif +#ifdef GL_IBM_texture_mirrored_repeat + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_mirrored_repeat", 23)) + { + ret = GLEW_IBM_texture_mirrored_repeat; + continue; + } +#endif +#ifdef GL_IBM_vertex_array_lists + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_lists", 18)) + { + ret = GLEW_IBM_vertex_array_lists; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INGR_", 5)) + { +#ifdef GL_INGR_color_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_clamp", 11)) + { + ret = GLEW_INGR_color_clamp; + continue; + } +#endif +#ifdef GL_INGR_interlace_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace_read", 14)) + { + ret = GLEW_INGR_interlace_read; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"INTEL_", 6)) + { +#ifdef GL_INTEL_parallel_arrays + if (_glewStrSame3(&pos, &len, (const GLubyte*)"parallel_arrays", 15)) + { + ret = GLEW_INTEL_parallel_arrays; + continue; + } +#endif +#ifdef GL_INTEL_texture_scissor + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scissor", 15)) + { + ret = GLEW_INTEL_texture_scissor; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"KTX_", 4)) + { +#ifdef GL_KTX_buffer_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) + { + ret = GLEW_KTX_buffer_region; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESAX_", 6)) + { +#ifdef GL_MESAX_texture_stack + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_stack", 13)) + { + ret = GLEW_MESAX_texture_stack; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef GL_MESA_pack_invert + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pack_invert", 11)) + { + ret = GLEW_MESA_pack_invert; + continue; + } +#endif +#ifdef GL_MESA_resize_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resize_buffers", 14)) + { + ret = GLEW_MESA_resize_buffers; + continue; + } +#endif +#ifdef GL_MESA_window_pos + if (_glewStrSame3(&pos, &len, (const GLubyte*)"window_pos", 10)) + { + ret = GLEW_MESA_window_pos; + continue; + } +#endif +#ifdef GL_MESA_ycbcr_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycbcr_texture", 13)) + { + ret = GLEW_MESA_ycbcr_texture; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef GL_NV_blend_square + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_square", 12)) + { + ret = GLEW_NV_blend_square; + continue; + } +#endif +#ifdef GL_NV_copy_depth_to_color + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_depth_to_color", 19)) + { + ret = GLEW_NV_copy_depth_to_color; + continue; + } +#endif +#ifdef GL_NV_depth_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_clamp", 11)) + { + ret = GLEW_NV_depth_clamp; + continue; + } +#endif +#ifdef GL_NV_evaluators + if (_glewStrSame3(&pos, &len, (const GLubyte*)"evaluators", 10)) + { + ret = GLEW_NV_evaluators; + continue; + } +#endif +#ifdef GL_NV_fence + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fence", 5)) + { + ret = GLEW_NV_fence; + continue; + } +#endif +#ifdef GL_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) + { + ret = GLEW_NV_float_buffer; + continue; + } +#endif +#ifdef GL_NV_fog_distance + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_distance", 12)) + { + ret = GLEW_NV_fog_distance; + continue; + } +#endif +#ifdef GL_NV_fragment_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program", 16)) + { + ret = GLEW_NV_fragment_program; + continue; + } +#endif +#ifdef GL_NV_fragment_program2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program2", 17)) + { + ret = GLEW_NV_fragment_program2; + continue; + } +#endif +#ifdef GL_NV_fragment_program_option + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_program_option", 23)) + { + ret = GLEW_NV_fragment_program_option; + continue; + } +#endif +#ifdef GL_NV_half_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"half_float", 10)) + { + ret = GLEW_NV_half_float; + continue; + } +#endif +#ifdef GL_NV_light_max_exponent + if (_glewStrSame3(&pos, &len, (const GLubyte*)"light_max_exponent", 18)) + { + ret = GLEW_NV_light_max_exponent; + continue; + } +#endif +#ifdef GL_NV_multisample_filter_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample_filter_hint", 23)) + { + ret = GLEW_NV_multisample_filter_hint; + continue; + } +#endif +#ifdef GL_NV_occlusion_query + if (_glewStrSame3(&pos, &len, (const GLubyte*)"occlusion_query", 15)) + { + ret = GLEW_NV_occlusion_query; + continue; + } +#endif +#ifdef GL_NV_packed_depth_stencil + if (_glewStrSame3(&pos, &len, (const GLubyte*)"packed_depth_stencil", 20)) + { + ret = GLEW_NV_packed_depth_stencil; + continue; + } +#endif +#ifdef GL_NV_pixel_data_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_data_range", 16)) + { + ret = GLEW_NV_pixel_data_range; + continue; + } +#endif +#ifdef GL_NV_point_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"point_sprite", 12)) + { + ret = GLEW_NV_point_sprite; + continue; + } +#endif +#ifdef GL_NV_primitive_restart + if (_glewStrSame3(&pos, &len, (const GLubyte*)"primitive_restart", 17)) + { + ret = GLEW_NV_primitive_restart; + continue; + } +#endif +#ifdef GL_NV_register_combiners + if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners", 18)) + { + ret = GLEW_NV_register_combiners; + continue; + } +#endif +#ifdef GL_NV_register_combiners2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"register_combiners2", 19)) + { + ret = GLEW_NV_register_combiners2; + continue; + } +#endif +#ifdef GL_NV_texgen_emboss + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_emboss", 13)) + { + ret = GLEW_NV_texgen_emboss; + continue; + } +#endif +#ifdef GL_NV_texgen_reflection + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texgen_reflection", 17)) + { + ret = GLEW_NV_texgen_reflection; + continue; + } +#endif +#ifdef GL_NV_texture_compression_vtc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_compression_vtc", 23)) + { + ret = GLEW_NV_texture_compression_vtc; + continue; + } +#endif +#ifdef GL_NV_texture_env_combine4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_env_combine4", 20)) + { + ret = GLEW_NV_texture_env_combine4; + continue; + } +#endif +#ifdef GL_NV_texture_expand_normal + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_expand_normal", 21)) + { + ret = GLEW_NV_texture_expand_normal; + continue; + } +#endif +#ifdef GL_NV_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_rectangle", 17)) + { + ret = GLEW_NV_texture_rectangle; + continue; + } +#endif +#ifdef GL_NV_texture_shader + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader", 14)) + { + ret = GLEW_NV_texture_shader; + continue; + } +#endif +#ifdef GL_NV_texture_shader2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader2", 15)) + { + ret = GLEW_NV_texture_shader2; + continue; + } +#endif +#ifdef GL_NV_texture_shader3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_shader3", 15)) + { + ret = GLEW_NV_texture_shader3; + continue; + } +#endif +#ifdef GL_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = GLEW_NV_vertex_array_range; + continue; + } +#endif +#ifdef GL_NV_vertex_array_range2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range2", 19)) + { + ret = GLEW_NV_vertex_array_range2; + continue; + } +#endif +#ifdef GL_NV_vertex_program + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program", 14)) + { + ret = GLEW_NV_vertex_program; + continue; + } +#endif +#ifdef GL_NV_vertex_program1_1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program1_1", 17)) + { + ret = GLEW_NV_vertex_program1_1; + continue; + } +#endif +#ifdef GL_NV_vertex_program2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2", 15)) + { + ret = GLEW_NV_vertex_program2; + continue; + } +#endif +#ifdef GL_NV_vertex_program2_option + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program2_option", 22)) + { + ret = GLEW_NV_vertex_program2_option; + continue; + } +#endif +#ifdef GL_NV_vertex_program3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_program3", 15)) + { + ret = GLEW_NV_vertex_program3; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef GL_OML_interlace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) + { + ret = GLEW_OML_interlace; + continue; + } +#endif +#ifdef GL_OML_resample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) + { + ret = GLEW_OML_resample; + continue; + } +#endif +#ifdef GL_OML_subsample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"subsample", 9)) + { + ret = GLEW_OML_subsample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"PGI_", 4)) + { +#ifdef GL_PGI_misc_hints + if (_glewStrSame3(&pos, &len, (const GLubyte*)"misc_hints", 10)) + { + ret = GLEW_PGI_misc_hints; + continue; + } +#endif +#ifdef GL_PGI_vertex_hints + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_hints", 12)) + { + ret = GLEW_PGI_vertex_hints; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"REND_", 5)) + { +#ifdef GL_REND_screen_coordinates + if (_glewStrSame3(&pos, &len, (const GLubyte*)"screen_coordinates", 18)) + { + ret = GLEW_REND_screen_coordinates; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"S3_", 3)) + { +#ifdef GL_S3_s3tc + if (_glewStrSame3(&pos, &len, (const GLubyte*)"s3tc", 4)) + { + ret = GLEW_S3_s3tc; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) + { +#ifdef GL_SGIS_color_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) + { + ret = GLEW_SGIS_color_range; + continue; + } +#endif +#ifdef GL_SGIS_detail_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"detail_texture", 14)) + { + ret = GLEW_SGIS_detail_texture; + continue; + } +#endif +#ifdef GL_SGIS_fog_function + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_function", 12)) + { + ret = GLEW_SGIS_fog_function; + continue; + } +#endif +#ifdef GL_SGIS_generate_mipmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"generate_mipmap", 15)) + { + ret = GLEW_SGIS_generate_mipmap; + continue; + } +#endif +#ifdef GL_SGIS_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLEW_SGIS_multisample; + continue; + } +#endif +#ifdef GL_SGIS_pixel_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) + { + ret = GLEW_SGIS_pixel_texture; + continue; + } +#endif +#ifdef GL_SGIS_sharpen_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sharpen_texture", 15)) + { + ret = GLEW_SGIS_sharpen_texture; + continue; + } +#endif +#ifdef GL_SGIS_texture4D + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture4D", 9)) + { + ret = GLEW_SGIS_texture4D; + continue; + } +#endif +#ifdef GL_SGIS_texture_border_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_border_clamp", 20)) + { + ret = GLEW_SGIS_texture_border_clamp; + continue; + } +#endif +#ifdef GL_SGIS_texture_edge_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_edge_clamp", 18)) + { + ret = GLEW_SGIS_texture_edge_clamp; + continue; + } +#endif +#ifdef GL_SGIS_texture_filter4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_filter4", 15)) + { + ret = GLEW_SGIS_texture_filter4; + continue; + } +#endif +#ifdef GL_SGIS_texture_lod + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod", 11)) + { + ret = GLEW_SGIS_texture_lod; + continue; + } +#endif +#ifdef GL_SGIS_texture_select + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_select", 14)) + { + ret = GLEW_SGIS_texture_select; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + { +#ifdef GL_SGIX_async + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async", 5)) + { + ret = GLEW_SGIX_async; + continue; + } +#endif +#ifdef GL_SGIX_async_histogram + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_histogram", 15)) + { + ret = GLEW_SGIX_async_histogram; + continue; + } +#endif +#ifdef GL_SGIX_async_pixel + if (_glewStrSame3(&pos, &len, (const GLubyte*)"async_pixel", 11)) + { + ret = GLEW_SGIX_async_pixel; + continue; + } +#endif +#ifdef GL_SGIX_blend_alpha_minmax + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blend_alpha_minmax", 18)) + { + ret = GLEW_SGIX_blend_alpha_minmax; + continue; + } +#endif +#ifdef GL_SGIX_clipmap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"clipmap", 7)) + { + ret = GLEW_SGIX_clipmap; + continue; + } +#endif +#ifdef GL_SGIX_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_texture", 13)) + { + ret = GLEW_SGIX_depth_texture; + continue; + } +#endif +#ifdef GL_SGIX_flush_raster + if (_glewStrSame3(&pos, &len, (const GLubyte*)"flush_raster", 12)) + { + ret = GLEW_SGIX_flush_raster; + continue; + } +#endif +#ifdef GL_SGIX_fog_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_offset", 10)) + { + ret = GLEW_SGIX_fog_offset; + continue; + } +#endif +#ifdef GL_SGIX_fog_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fog_texture", 11)) + { + ret = GLEW_SGIX_fog_texture; + continue; + } +#endif +#ifdef GL_SGIX_fragment_specular_lighting + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fragment_specular_lighting", 26)) + { + ret = GLEW_SGIX_fragment_specular_lighting; + continue; + } +#endif +#ifdef GL_SGIX_framezoom + if (_glewStrSame3(&pos, &len, (const GLubyte*)"framezoom", 9)) + { + ret = GLEW_SGIX_framezoom; + continue; + } +#endif +#ifdef GL_SGIX_interlace + if (_glewStrSame3(&pos, &len, (const GLubyte*)"interlace", 9)) + { + ret = GLEW_SGIX_interlace; + continue; + } +#endif +#ifdef GL_SGIX_ir_instrument1 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ir_instrument1", 14)) + { + ret = GLEW_SGIX_ir_instrument1; + continue; + } +#endif +#ifdef GL_SGIX_list_priority + if (_glewStrSame3(&pos, &len, (const GLubyte*)"list_priority", 13)) + { + ret = GLEW_SGIX_list_priority; + continue; + } +#endif +#ifdef GL_SGIX_pixel_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture", 13)) + { + ret = GLEW_SGIX_pixel_texture; + continue; + } +#endif +#ifdef GL_SGIX_pixel_texture_bits + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_texture_bits", 18)) + { + ret = GLEW_SGIX_pixel_texture_bits; + continue; + } +#endif +#ifdef GL_SGIX_reference_plane + if (_glewStrSame3(&pos, &len, (const GLubyte*)"reference_plane", 15)) + { + ret = GLEW_SGIX_reference_plane; + continue; + } +#endif +#ifdef GL_SGIX_resample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"resample", 8)) + { + ret = GLEW_SGIX_resample; + continue; + } +#endif +#ifdef GL_SGIX_shadow + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow", 6)) + { + ret = GLEW_SGIX_shadow; + continue; + } +#endif +#ifdef GL_SGIX_shadow_ambient + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shadow_ambient", 14)) + { + ret = GLEW_SGIX_shadow_ambient; + continue; + } +#endif +#ifdef GL_SGIX_sprite + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sprite", 6)) + { + ret = GLEW_SGIX_sprite; + continue; + } +#endif +#ifdef GL_SGIX_tag_sample_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"tag_sample_buffer", 17)) + { + ret = GLEW_SGIX_tag_sample_buffer; + continue; + } +#endif +#ifdef GL_SGIX_texture_add_env + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_add_env", 15)) + { + ret = GLEW_SGIX_texture_add_env; + continue; + } +#endif +#ifdef GL_SGIX_texture_coordinate_clamp + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_coordinate_clamp", 24)) + { + ret = GLEW_SGIX_texture_coordinate_clamp; + continue; + } +#endif +#ifdef GL_SGIX_texture_lod_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_lod_bias", 16)) + { + ret = GLEW_SGIX_texture_lod_bias; + continue; + } +#endif +#ifdef GL_SGIX_texture_multi_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_multi_buffer", 20)) + { + ret = GLEW_SGIX_texture_multi_buffer; + continue; + } +#endif +#ifdef GL_SGIX_texture_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_range", 13)) + { + ret = GLEW_SGIX_texture_range; + continue; + } +#endif +#ifdef GL_SGIX_texture_scale_bias + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_scale_bias", 18)) + { + ret = GLEW_SGIX_texture_scale_bias; + continue; + } +#endif +#ifdef GL_SGIX_vertex_preclip + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip", 14)) + { + ret = GLEW_SGIX_vertex_preclip; + continue; + } +#endif +#ifdef GL_SGIX_vertex_preclip_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_preclip_hint", 19)) + { + ret = GLEW_SGIX_vertex_preclip_hint; + continue; + } +#endif +#ifdef GL_SGIX_ycrcb + if (_glewStrSame3(&pos, &len, (const GLubyte*)"ycrcb", 5)) + { + ret = GLEW_SGIX_ycrcb; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) + { +#ifdef GL_SGI_color_matrix + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_matrix", 12)) + { + ret = GLEW_SGI_color_matrix; + continue; + } +#endif +#ifdef GL_SGI_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_table", 11)) + { + ret = GLEW_SGI_color_table; + continue; + } +#endif +#ifdef GL_SGI_texture_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"texture_color_table", 19)) + { + ret = GLEW_SGI_texture_color_table; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUNX_", 5)) + { +#ifdef GL_SUNX_constant_data + if (_glewStrSame3(&pos, &len, (const GLubyte*)"constant_data", 13)) + { + ret = GLEW_SUNX_constant_data; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) + { +#ifdef GL_SUN_convolution_border_modes + if (_glewStrSame3(&pos, &len, (const GLubyte*)"convolution_border_modes", 24)) + { + ret = GLEW_SUN_convolution_border_modes; + continue; + } +#endif +#ifdef GL_SUN_global_alpha + if (_glewStrSame3(&pos, &len, (const GLubyte*)"global_alpha", 12)) + { + ret = GLEW_SUN_global_alpha; + continue; + } +#endif +#ifdef GL_SUN_mesh_array + if (_glewStrSame3(&pos, &len, (const GLubyte*)"mesh_array", 10)) + { + ret = GLEW_SUN_mesh_array; + continue; + } +#endif +#ifdef GL_SUN_read_video_pixels + if (_glewStrSame3(&pos, &len, (const GLubyte*)"read_video_pixels", 17)) + { + ret = GLEW_SUN_read_video_pixels; + continue; + } +#endif +#ifdef GL_SUN_slice_accum + if (_glewStrSame3(&pos, &len, (const GLubyte*)"slice_accum", 11)) + { + ret = GLEW_SUN_slice_accum; + continue; + } +#endif +#ifdef GL_SUN_triangle_list + if (_glewStrSame3(&pos, &len, (const GLubyte*)"triangle_list", 13)) + { + ret = GLEW_SUN_triangle_list; + continue; + } +#endif +#ifdef GL_SUN_vertex + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex", 6)) + { + ret = GLEW_SUN_vertex; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"WIN_", 4)) + { +#ifdef GL_WIN_phong_shading + if (_glewStrSame3(&pos, &len, (const GLubyte*)"phong_shading", 13)) + { + ret = GLEW_WIN_phong_shading; + continue; + } +#endif +#ifdef GL_WIN_specular_fog + if (_glewStrSame3(&pos, &len, (const GLubyte*)"specular_fog", 12)) + { + ret = GLEW_WIN_specular_fog; + continue; + } +#endif +#ifdef GL_WIN_swap_hint + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_hint", 9)) + { + ret = GLEW_WIN_swap_hint; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + +#if defined(_WIN32) + +#if defined(GLEW_MX) +GLboolean wglewContextIsSupported (WGLEWContext* ctx, const char* name) +#else +GLboolean wglewIsSupported (const char* name) +#endif +{ + GLubyte* pos = (GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if (_glewStrSame1(&pos, &len, (const GLubyte*)"WGL_", 4)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef WGL_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = WGLEW_3DFX_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DL_", 4)) + { +#ifdef WGL_3DL_stereo_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"stereo_control", 14)) + { + ret = WGLEW_3DL_stereo_control; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef WGL_ARB_buffer_region + if (_glewStrSame3(&pos, &len, (const GLubyte*)"buffer_region", 13)) + { + ret = WGLEW_ARB_buffer_region; + continue; + } +#endif +#ifdef WGL_ARB_extensions_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) + { + ret = WGLEW_ARB_extensions_string; + continue; + } +#endif +#ifdef WGL_ARB_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + { + ret = WGLEW_ARB_make_current_read; + continue; + } +#endif +#ifdef WGL_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = WGLEW_ARB_multisample; + continue; + } +#endif +#ifdef WGL_ARB_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) + { + ret = WGLEW_ARB_pbuffer; + continue; + } +#endif +#ifdef WGL_ARB_pixel_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) + { + ret = WGLEW_ARB_pixel_format; + continue; + } +#endif +#ifdef WGL_ARB_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + { + ret = WGLEW_ARB_pixel_format_float; + continue; + } +#endif +#ifdef WGL_ARB_render_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) + { + ret = WGLEW_ARB_render_texture; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef WGL_ATI_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + { + ret = WGLEW_ATI_pixel_format_float; + continue; + } +#endif +#ifdef WGL_ATI_render_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) + { + ret = WGLEW_ATI_render_texture_rectangle; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef WGL_EXT_depth_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"depth_float", 11)) + { + ret = WGLEW_EXT_depth_float; + continue; + } +#endif +#ifdef WGL_EXT_display_color_table + if (_glewStrSame3(&pos, &len, (const GLubyte*)"display_color_table", 19)) + { + ret = WGLEW_EXT_display_color_table; + continue; + } +#endif +#ifdef WGL_EXT_extensions_string + if (_glewStrSame3(&pos, &len, (const GLubyte*)"extensions_string", 17)) + { + ret = WGLEW_EXT_extensions_string; + continue; + } +#endif +#ifdef WGL_EXT_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + { + ret = WGLEW_EXT_make_current_read; + continue; + } +#endif +#ifdef WGL_EXT_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = WGLEW_EXT_multisample; + continue; + } +#endif +#ifdef WGL_EXT_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) + { + ret = WGLEW_EXT_pbuffer; + continue; + } +#endif +#ifdef WGL_EXT_pixel_format + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format", 12)) + { + ret = WGLEW_EXT_pixel_format; + continue; + } +#endif +#ifdef WGL_EXT_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) + { + ret = WGLEW_EXT_swap_control; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"I3D_", 4)) + { +#ifdef WGL_I3D_digital_video_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"digital_video_control", 21)) + { + ret = WGLEW_I3D_digital_video_control; + continue; + } +#endif +#ifdef WGL_I3D_gamma + if (_glewStrSame3(&pos, &len, (const GLubyte*)"gamma", 5)) + { + ret = WGLEW_I3D_gamma; + continue; + } +#endif +#ifdef WGL_I3D_genlock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"genlock", 7)) + { + ret = WGLEW_I3D_genlock; + continue; + } +#endif +#ifdef WGL_I3D_image_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"image_buffer", 12)) + { + ret = WGLEW_I3D_image_buffer; + continue; + } +#endif +#ifdef WGL_I3D_swap_frame_lock + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_lock", 15)) + { + ret = WGLEW_I3D_swap_frame_lock; + continue; + } +#endif +#ifdef WGL_I3D_swap_frame_usage + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_frame_usage", 16)) + { + ret = WGLEW_I3D_swap_frame_usage; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef WGL_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) + { + ret = WGLEW_NV_float_buffer; + continue; + } +#endif +#ifdef WGL_NV_render_depth_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_depth_texture", 20)) + { + ret = WGLEW_NV_render_depth_texture; + continue; + } +#endif +#ifdef WGL_NV_render_texture_rectangle + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture_rectangle", 24)) + { + ret = WGLEW_NV_render_texture_rectangle; + continue; + } +#endif +#ifdef WGL_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = WGLEW_NV_vertex_array_range; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef WGL_OML_sync_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) + { + ret = WGLEW_OML_sync_control; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + +#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) + +#if defined(GLEW_MX) +GLboolean glxewContextIsSupported (GLXEWContext* ctx, const char* name) +#else +GLboolean glxewIsSupported (const char* name) +#endif +{ + GLubyte* pos = (GLubyte*)name; + GLuint len = _glewStrLen(pos); + GLboolean ret = GL_TRUE; + while (ret && len > 0) + { + if(_glewStrSame1(&pos, &len, (const GLubyte*)"GLX_", 4)) + { + if (_glewStrSame2(&pos, &len, (const GLubyte*)"VERSION_", 8)) + { +#ifdef GLX_VERSION_1_2 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_2", 3)) + { + ret = GLXEW_VERSION_1_2; + continue; + } +#endif +#ifdef GLX_VERSION_1_3 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_3", 3)) + { + ret = GLXEW_VERSION_1_3; + continue; + } +#endif +#ifdef GLX_VERSION_1_4 + if (_glewStrSame3(&pos, &len, (const GLubyte*)"1_4", 3)) + { + ret = GLXEW_VERSION_1_4; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"3DFX_", 5)) + { +#ifdef GLX_3DFX_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLXEW_3DFX_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ARB_", 4)) + { +#ifdef GLX_ARB_fbconfig_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig_float", 14)) + { + ret = GLXEW_ARB_fbconfig_float; + continue; + } +#endif +#ifdef GLX_ARB_get_proc_address + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_proc_address", 16)) + { + ret = GLXEW_ARB_get_proc_address; + continue; + } +#endif +#ifdef GLX_ARB_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLXEW_ARB_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"ATI_", 4)) + { +#ifdef GLX_ATI_pixel_format_float + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixel_format_float", 18)) + { + ret = GLXEW_ATI_pixel_format_float; + continue; + } +#endif +#ifdef GLX_ATI_render_texture + if (_glewStrSame3(&pos, &len, (const GLubyte*)"render_texture", 14)) + { + ret = GLXEW_ATI_render_texture; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"EXT_", 4)) + { +#ifdef GLX_EXT_import_context + if (_glewStrSame3(&pos, &len, (const GLubyte*)"import_context", 14)) + { + ret = GLXEW_EXT_import_context; + continue; + } +#endif +#ifdef GLX_EXT_scene_marker + if (_glewStrSame3(&pos, &len, (const GLubyte*)"scene_marker", 12)) + { + ret = GLXEW_EXT_scene_marker; + continue; + } +#endif +#ifdef GLX_EXT_visual_info + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_info", 11)) + { + ret = GLXEW_EXT_visual_info; + continue; + } +#endif +#ifdef GLX_EXT_visual_rating + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_rating", 13)) + { + ret = GLXEW_EXT_visual_rating; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"MESA_", 5)) + { +#ifdef GLX_MESA_agp_offset + if (_glewStrSame3(&pos, &len, (const GLubyte*)"agp_offset", 10)) + { + ret = GLXEW_MESA_agp_offset; + continue; + } +#endif +#ifdef GLX_MESA_copy_sub_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"copy_sub_buffer", 15)) + { + ret = GLXEW_MESA_copy_sub_buffer; + continue; + } +#endif +#ifdef GLX_MESA_pixmap_colormap + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pixmap_colormap", 15)) + { + ret = GLXEW_MESA_pixmap_colormap; + continue; + } +#endif +#ifdef GLX_MESA_release_buffers + if (_glewStrSame3(&pos, &len, (const GLubyte*)"release_buffers", 15)) + { + ret = GLXEW_MESA_release_buffers; + continue; + } +#endif +#ifdef GLX_MESA_set_3dfx_mode + if (_glewStrSame3(&pos, &len, (const GLubyte*)"set_3dfx_mode", 13)) + { + ret = GLXEW_MESA_set_3dfx_mode; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"NV_", 3)) + { +#ifdef GLX_NV_float_buffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"float_buffer", 12)) + { + ret = GLXEW_NV_float_buffer; + continue; + } +#endif +#ifdef GLX_NV_vertex_array_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"vertex_array_range", 18)) + { + ret = GLXEW_NV_vertex_array_range; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"OML_", 4)) + { +#ifdef GLX_OML_swap_method + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_method", 11)) + { + ret = GLXEW_OML_swap_method; + continue; + } +#endif +#if defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#include + if (_glewStrSame3(&pos, &len, (const GLubyte*)"sync_control", 12)) + { + ret = GLXEW_OML_sync_control; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIS_", 5)) + { +#ifdef GLX_SGIS_blended_overlay + if (_glewStrSame3(&pos, &len, (const GLubyte*)"blended_overlay", 15)) + { + ret = GLXEW_SGIS_blended_overlay; + continue; + } +#endif +#ifdef GLX_SGIS_color_range + if (_glewStrSame3(&pos, &len, (const GLubyte*)"color_range", 11)) + { + ret = GLXEW_SGIS_color_range; + continue; + } +#endif +#ifdef GLX_SGIS_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"multisample", 11)) + { + ret = GLXEW_SGIS_multisample; + continue; + } +#endif +#ifdef GLX_SGIS_shared_multisample + if (_glewStrSame3(&pos, &len, (const GLubyte*)"shared_multisample", 18)) + { + ret = GLXEW_SGIS_shared_multisample; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGIX_", 5)) + { +#ifdef GLX_SGIX_fbconfig + if (_glewStrSame3(&pos, &len, (const GLubyte*)"fbconfig", 8)) + { + ret = GLXEW_SGIX_fbconfig; + continue; + } +#endif +#ifdef GLX_SGIX_pbuffer + if (_glewStrSame3(&pos, &len, (const GLubyte*)"pbuffer", 7)) + { + ret = GLXEW_SGIX_pbuffer; + continue; + } +#endif +#ifdef GLX_SGIX_swap_barrier + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_barrier", 12)) + { + ret = GLXEW_SGIX_swap_barrier; + continue; + } +#endif +#ifdef GLX_SGIX_swap_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_group", 10)) + { + ret = GLXEW_SGIX_swap_group; + continue; + } +#endif +#ifdef GLX_SGIX_video_resize + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) + { + ret = GLXEW_SGIX_video_resize; + continue; + } +#endif +#ifdef GLX_SGIX_visual_select_group + if (_glewStrSame3(&pos, &len, (const GLubyte*)"visual_select_group", 19)) + { + ret = GLXEW_SGIX_visual_select_group; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SGI_", 4)) + { +#ifdef GLX_SGI_cushion + if (_glewStrSame3(&pos, &len, (const GLubyte*)"cushion", 7)) + { + ret = GLXEW_SGI_cushion; + continue; + } +#endif +#ifdef GLX_SGI_make_current_read + if (_glewStrSame3(&pos, &len, (const GLubyte*)"make_current_read", 17)) + { + ret = GLXEW_SGI_make_current_read; + continue; + } +#endif +#ifdef GLX_SGI_swap_control + if (_glewStrSame3(&pos, &len, (const GLubyte*)"swap_control", 12)) + { + ret = GLXEW_SGI_swap_control; + continue; + } +#endif +#ifdef GLX_SGI_video_sync + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_sync", 10)) + { + ret = GLXEW_SGI_video_sync; + continue; + } +#endif + } + if (_glewStrSame2(&pos, &len, (const GLubyte*)"SUN_", 4)) + { +#ifdef GLX_SUN_get_transparent_index + if (_glewStrSame3(&pos, &len, (const GLubyte*)"get_transparent_index", 21)) + { + ret = GLXEW_SUN_get_transparent_index; + continue; + } +#endif +#ifdef GLX_SUN_video_resize + if (_glewStrSame3(&pos, &len, (const GLubyte*)"video_resize", 12)) + { + ret = GLXEW_SUN_video_resize; + continue; + } +#endif + } + } + ret = (len == 0); + } + return ret; +} + +#endif /* _WIN32 */ diff --git a/src/SFML/Graphics/GLEW/glew.h b/src/SFML/Graphics/GLEW/glew.h new file mode 100644 index 00000000..f516bf3b --- /dev/null +++ b/src/SFML/Graphics/GLEW/glew.h @@ -0,0 +1,9793 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2002-2006, Milan Ikits +** Copyright (C) 2002-2006, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#ifndef __glew_h__ +#define __glew_h__ +#define __GLEW_H__ + +#if defined(__gl_h_) || defined(__GL_H__) +#error gl.h included before glew.h +#endif +#if defined(__glext_h_) || defined(__GLEXT_H_) +#error glext.h included before glew.h +#endif +#if defined(__gl_ATI_h_) +#error glATI.h included before glew.h +#endif + +#define __gl_h_ +#define __GL_H__ +#define __glext_h_ +#define __GLEXT_H_ +#define __gl_ATI_h_ + + +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) + +/* + * GLEW does not include to avoid name space pollution. + * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t + * defined properly. + */ +/* */ +#ifndef APIENTRY +#define GLEW_APIENTRY_DEFINED +# if defined(__CYGWIN__) || defined(__MINGW32__) +# define APIENTRY __stdcall +# elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif +#endif +#ifndef GLAPI +# if defined(__CYGWIN__) || defined(__MINGW32__) +# define GLAPI extern +# endif +#endif +/* */ +#ifndef CALLBACK +#define GLEW_CALLBACK_DEFINED +# if defined(__CYGWIN__) || defined(__MINGW32__) +# define CALLBACK __attribute__ ((__stdcall__)) +# elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) +# define CALLBACK __stdcall +# else +# define CALLBACK +# endif +#endif +/* and */ +#ifndef WINGDIAPI +#define GLEW_WINGDIAPI_DEFINED +#define WINGDIAPI __declspec(dllimport) +#endif +/* */ +#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED) +typedef unsigned short wchar_t; +# define _WCHAR_T_DEFINED +#endif +/* */ +#if !defined(_W64) +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif +#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) +# ifdef _WIN64 +typedef __int64 ptrdiff_t; +# else +typedef _W64 int ptrdiff_t; +# endif +# define _PTRDIFF_T_DEFINED +# define _PTRDIFF_T_ +#endif + +#ifndef GLAPI +# if defined(__CYGWIN__) || defined(__MINGW32__) +# define GLAPI extern +# else +# define GLAPI WINGDIAPI +# endif +#endif + +#ifndef GLAPIENTRY +#define GLAPIENTRY APIENTRY +#endif + +/* + * GLEW_STATIC needs to be set when using the static version. + * GLEW_BUILD is set when building the DLL version. + */ +#ifdef GLEW_STATIC +# define GLEWAPI extern +#else +# ifdef GLEW_BUILD +# define GLEWAPI extern __declspec(dllexport) +# else +# define GLEWAPI extern __declspec(dllimport) +# endif +#endif + +#else /* _UNIX */ + +/* + * Needed for ptrdiff_t in turn needed by VBO. This is defined by ISO + * C. On my system, this amounts to _3 lines_ of included code, all of + * them pretty much harmless. If you know of a way of detecting 32 vs + * 64 _targets_ at compile time you are free to replace this with + * something that's portable. For now, _this_ is the portable solution. + * (mem, 2004-01-04) + */ + +#include + +#define GLEW_APIENTRY_DEFINED +#define APIENTRY +#define GLEWAPI extern + +/* */ +#ifndef GLAPI +#define GLAPI extern +#endif +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#endif /* _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ----------------------------- GL_VERSION_1_1 ---------------------------- */ + +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 + +#if defined(__APPLE__) +typedef unsigned long GLenum; +typedef unsigned long GLbitfield; +typedef unsigned long GLuint; +typedef long GLint; +typedef long GLsizei; +#else +typedef unsigned int GLenum; +typedef unsigned int GLbitfield; +typedef unsigned int GLuint; +typedef int GLint; +typedef int GLsizei; +#endif +typedef unsigned char GLboolean; +typedef signed char GLbyte; +typedef short GLshort; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef float GLfloat; +typedef float GLclampf; +typedef double GLdouble; +typedef double GLclampd; +typedef void GLvoid; + +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000fffff +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_TRUE 1 +#define GL_FALSE 0 +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LIST_MODE 0x0B30 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG 0x0B60 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_INDEX_BITS 0x0D51 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_COLOR_INDEX 0x1900 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_BITMAP 0x1A00 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_ENV 0x2300 +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_CLAMP 0x2900 +#define GL_REPEAT 0x2901 +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_LOGIC_OP GL_INDEX_LOGIC_OP +#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 + +GLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value); +GLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref); +GLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI void GLAPIENTRY glArrayElement (GLint i); +GLAPI void GLAPIENTRY glBegin (GLenum mode); +GLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture); +GLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +GLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GLAPI void GLAPIENTRY glCallList (GLuint list); +GLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists); +GLAPI void GLAPIENTRY glClear (GLbitfield mask); +GLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void GLAPIENTRY glClearDepth (GLclampd depth); +GLAPI void GLAPIENTRY glClearIndex (GLfloat c); +GLAPI void GLAPIENTRY glClearStencil (GLint s); +GLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation); +GLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void GLAPIENTRY glColor3bv (const GLbyte *v); +GLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void GLAPIENTRY glColor3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void GLAPIENTRY glColor3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue); +GLAPI void GLAPIENTRY glColor3iv (const GLint *v); +GLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void GLAPIENTRY glColor3sv (const GLshort *v); +GLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v); +GLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void GLAPIENTRY glColor3uiv (const GLuint *v); +GLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void GLAPIENTRY glColor3usv (const GLushort *v); +GLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI void GLAPIENTRY glColor4bv (const GLbyte *v); +GLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI void GLAPIENTRY glColor4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void GLAPIENTRY glColor4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void GLAPIENTRY glColor4iv (const GLint *v); +GLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI void GLAPIENTRY glColor4sv (const GLshort *v); +GLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v); +GLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI void GLAPIENTRY glColor4uiv (const GLuint *v); +GLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI void GLAPIENTRY glColor4usv (const GLushort *v); +GLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode); +GLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +GLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void GLAPIENTRY glCullFace (GLenum mode); +GLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range); +GLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GLAPI void GLAPIENTRY glDepthFunc (GLenum func); +GLAPI void GLAPIENTRY glDepthMask (GLboolean flag); +GLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar); +GLAPI void GLAPIENTRY glDisable (GLenum cap); +GLAPI void GLAPIENTRY glDisableClientState (GLenum array); +GLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GLAPI void GLAPIENTRY glDrawBuffer (GLenum mode); +GLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag); +GLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag); +GLAPI void GLAPIENTRY glEnable (GLenum cap); +GLAPI void GLAPIENTRY glEnableClientState (GLenum array); +GLAPI void GLAPIENTRY glEnd (void); +GLAPI void GLAPIENTRY glEndList (void); +GLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u); +GLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u); +GLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u); +GLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u); +GLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v); +GLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u); +GLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v); +GLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u); +GLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2); +GLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +GLAPI void GLAPIENTRY glEvalPoint1 (GLint i); +GLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j); +GLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); +GLAPI void GLAPIENTRY glFinish (void); +GLAPI void GLAPIENTRY glFlush (void); +GLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glFrontFace (GLenum mode); +GLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI GLuint GLAPIENTRY glGenLists (GLsizei range); +GLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures); +GLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +GLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation); +GLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params); +GLAPI GLenum GLAPIENTRY glGetError (void); +GLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v); +GLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v); +GLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v); +GLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values); +GLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values); +GLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values); +GLAPI void GLAPIENTRY glGetPointerv (GLenum pname, GLvoid* *params); +GLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask); +GLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name); +GLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); +GLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode); +GLAPI void GLAPIENTRY glIndexMask (GLuint mask); +GLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glIndexd (GLdouble c); +GLAPI void GLAPIENTRY glIndexdv (const GLdouble *c); +GLAPI void GLAPIENTRY glIndexf (GLfloat c); +GLAPI void GLAPIENTRY glIndexfv (const GLfloat *c); +GLAPI void GLAPIENTRY glIndexi (GLint c); +GLAPI void GLAPIENTRY glIndexiv (const GLint *c); +GLAPI void GLAPIENTRY glIndexs (GLshort c); +GLAPI void GLAPIENTRY glIndexsv (const GLshort *c); +GLAPI void GLAPIENTRY glIndexub (GLubyte c); +GLAPI void GLAPIENTRY glIndexubv (const GLubyte *c); +GLAPI void GLAPIENTRY glInitNames (void); +GLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer); +GLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap); +GLAPI GLboolean GLAPIENTRY glIsList (GLuint list); +GLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture); +GLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern); +GLAPI void GLAPIENTRY glLineWidth (GLfloat width); +GLAPI void GLAPIENTRY glListBase (GLuint base); +GLAPI void GLAPIENTRY glLoadIdentity (void); +GLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m); +GLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m); +GLAPI void GLAPIENTRY glLoadName (GLuint name); +GLAPI void GLAPIENTRY glLogicOp (GLenum opcode); +GLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +GLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); +GLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); +GLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +GLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +GLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glMatrixMode (GLenum mode); +GLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m); +GLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m); +GLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode); +GLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v); +GLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz); +GLAPI void GLAPIENTRY glNormal3iv (const GLint *v); +GLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz); +GLAPI void GLAPIENTRY glNormal3sv (const GLshort *v); +GLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void GLAPIENTRY glPassThrough (GLfloat token); +GLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values); +GLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values); +GLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values); +GLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param); +GLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor); +GLAPI void GLAPIENTRY glPointSize (GLfloat size); +GLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode); +GLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask); +GLAPI void GLAPIENTRY glPopAttrib (void); +GLAPI void GLAPIENTRY glPopClientAttrib (void); +GLAPI void GLAPIENTRY glPopMatrix (void); +GLAPI void GLAPIENTRY glPopName (void); +GLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities); +GLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask); +GLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask); +GLAPI void GLAPIENTRY glPushMatrix (void); +GLAPI void GLAPIENTRY glPushName (GLuint name); +GLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y); +GLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v); +GLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y); +GLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v); +GLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y); +GLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v); +GLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y); +GLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v); +GLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z); +GLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v); +GLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v); +GLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w); +GLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v); +GLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v); +GLAPI void GLAPIENTRY glReadBuffer (GLenum mode); +GLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +GLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2); +GLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +GLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2); +GLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2); +GLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2); +GLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); +GLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2); +GLAPI GLint GLAPIENTRY glRenderMode (GLenum mode); +GLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer); +GLAPI void GLAPIENTRY glShadeModel (GLenum mode); +GLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GLAPI void GLAPIENTRY glStencilMask (GLuint mask); +GLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GLAPI void GLAPIENTRY glTexCoord1d (GLdouble s); +GLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord1f (GLfloat s); +GLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord1i (GLint s); +GLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord1s (GLshort s); +GLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t); +GLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t); +GLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v); +GLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v); +GLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param); +GLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params); +GLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y); +GLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v); +GLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y); +GLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v); +GLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y); +GLAPI void GLAPIENTRY glVertex2iv (const GLint *v); +GLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y); +GLAPI void GLAPIENTRY glVertex2sv (const GLshort *v); +GLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v); +GLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v); +GLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z); +GLAPI void GLAPIENTRY glVertex3iv (const GLint *v); +GLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z); +GLAPI void GLAPIENTRY glVertex3sv (const GLshort *v); +GLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v); +GLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v); +GLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w); +GLAPI void GLAPIENTRY glVertex4iv (const GLint *v); +GLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void GLAPIENTRY glVertex4sv (const GLshort *v); +GLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1) + +#endif /* GL_VERSION_1_1 */ + +/* ---------------------------------- GL and GLU ---------------------------------- */ + +/* this is where we can safely include GL and GLU */ +#if defined(__APPLE__) && defined(__MACH__) +#include +#include +#else +#include +#include +#endif + +/* ----------------------------- GL_VERSION_1_2 ---------------------------- */ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 + +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E + +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + +#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D) +#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements) +#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D) +#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D) + +#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2) + +#endif /* GL_VERSION_1_2 */ + +/* ----------------------------- GL_VERSION_1_3 ---------------------------- */ + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 + +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_SUBTRACT 0x84E7 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#define GL_MULTISAMPLE_BIT 0x20000000 + +typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLvoid *img); +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); + +#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture) +#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture) +#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D) +#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D) +#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D) +#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D) +#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D) +#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D) +#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage) +#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd) +#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf) +#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd) +#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf) +#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d) +#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv) +#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f) +#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv) +#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i) +#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv) +#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s) +#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv) +#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d) +#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv) +#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f) +#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv) +#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i) +#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv) +#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s) +#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv) +#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d) +#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv) +#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f) +#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv) +#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i) +#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv) +#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s) +#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv) +#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d) +#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv) +#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f) +#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv) +#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i) +#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv) +#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s) +#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv) +#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage) + +#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3) + +#endif /* GL_VERSION_1_3 */ + +/* ----------------------------- GL_VERSION_1_4 ---------------------------- */ + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 + +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E + +typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p); + +#define glBlendColor GLEW_GET_FUN(__glewBlendColor) +#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation) +#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate) +#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer) +#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd) +#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv) +#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf) +#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv) +#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays) +#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements) +#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf) +#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv) +#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b) +#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv) +#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d) +#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv) +#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f) +#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv) +#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i) +#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv) +#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s) +#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv) +#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub) +#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv) +#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui) +#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv) +#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us) +#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv) +#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer) +#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d) +#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv) +#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f) +#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv) +#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i) +#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv) +#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s) +#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv) +#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d) +#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv) +#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f) +#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv) +#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i) +#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv) +#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s) +#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv) + +#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4) + +#endif /* GL_VERSION_1_4 */ + +/* ----------------------------- GL_VERSION_1_5 ---------------------------- */ + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 + +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 + +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid** params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer); +typedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id); +typedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target); + +#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery) +#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer) +#define glBufferData GLEW_GET_FUN(__glewBufferData) +#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData) +#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers) +#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries) +#define glEndQuery GLEW_GET_FUN(__glewEndQuery) +#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers) +#define glGenQueries GLEW_GET_FUN(__glewGenQueries) +#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv) +#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv) +#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData) +#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv) +#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv) +#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv) +#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer) +#define glIsQuery GLEW_GET_FUN(__glewIsQuery) +#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer) +#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer) + +#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5) + +#endif /* GL_VERSION_1_5 */ + +/* ----------------------------- GL_VERSION_2_0 ---------------------------- */ + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 + +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 + +typedef char GLchar; + +typedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum, GLenum); +typedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint); +typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders); +typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param); +typedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog); +typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLint obj, GLsizei maxLength, GLsizei* length, GLchar* source); +typedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param); +typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLint programObj, const GLchar* name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint, GLenum, GLvoid*); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint, GLenum, GLdouble*); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint, GLenum, GLint*); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader); +typedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths); +typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum, GLuint); +typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer); + +#define glAttachShader GLEW_GET_FUN(__glewAttachShader) +#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation) +#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate) +#define glCompileShader GLEW_GET_FUN(__glewCompileShader) +#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram) +#define glCreateShader GLEW_GET_FUN(__glewCreateShader) +#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram) +#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader) +#define glDetachShader GLEW_GET_FUN(__glewDetachShader) +#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray) +#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers) +#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray) +#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib) +#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform) +#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders) +#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation) +#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog) +#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv) +#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog) +#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource) +#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv) +#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation) +#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv) +#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv) +#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv) +#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv) +#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv) +#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv) +#define glIsProgram GLEW_GET_FUN(__glewIsProgram) +#define glIsShader GLEW_GET_FUN(__glewIsShader) +#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram) +#define glShaderSource GLEW_GET_FUN(__glewShaderSource) +#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate) +#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate) +#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate) +#define glUniform1f GLEW_GET_FUN(__glewUniform1f) +#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv) +#define glUniform1i GLEW_GET_FUN(__glewUniform1i) +#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv) +#define glUniform2f GLEW_GET_FUN(__glewUniform2f) +#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv) +#define glUniform2i GLEW_GET_FUN(__glewUniform2i) +#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv) +#define glUniform3f GLEW_GET_FUN(__glewUniform3f) +#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv) +#define glUniform3i GLEW_GET_FUN(__glewUniform3i) +#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv) +#define glUniform4f GLEW_GET_FUN(__glewUniform4f) +#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv) +#define glUniform4i GLEW_GET_FUN(__glewUniform4i) +#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv) +#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv) +#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv) +#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv) +#define glUseProgram GLEW_GET_FUN(__glewUseProgram) +#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram) +#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d) +#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv) +#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f) +#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv) +#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s) +#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv) +#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d) +#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv) +#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f) +#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv) +#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s) +#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv) +#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d) +#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv) +#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f) +#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv) +#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s) +#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv) +#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv) +#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv) +#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv) +#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub) +#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv) +#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv) +#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv) +#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv) +#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d) +#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv) +#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f) +#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv) +#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv) +#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s) +#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv) +#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv) +#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv) +#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv) +#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer) + +#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0) + +#endif /* GL_VERSION_2_0 */ + +/* -------------------------- GL_3DFX_multisample -------------------------- */ + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 + +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 + +#define GLEW_3DFX_multisample GLEW_GET_VAR(__GLEW_3DFX_multisample) + +#endif /* GL_3DFX_multisample */ + +/* ---------------------------- GL_3DFX_tbuffer ---------------------------- */ + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 + +typedef void (GLAPIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); + +#define glTbufferMask3DFX GLEW_GET_FUN(__glewTbufferMask3DFX) + +#define GLEW_3DFX_tbuffer GLEW_GET_VAR(__GLEW_3DFX_tbuffer) + +#endif /* GL_3DFX_tbuffer */ + +/* -------------------- GL_3DFX_texture_compression_FXT1 ------------------- */ + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 + +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 + +#define GLEW_3DFX_texture_compression_FXT1 GLEW_GET_VAR(__GLEW_3DFX_texture_compression_FXT1) + +#endif /* GL_3DFX_texture_compression_FXT1 */ + +/* ------------------------ GL_APPLE_client_storage ------------------------ */ + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 + +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 + +#define GLEW_APPLE_client_storage GLEW_GET_VAR(__GLEW_APPLE_client_storage) + +#endif /* GL_APPLE_client_storage */ + +/* ------------------------- GL_APPLE_element_array ------------------------ */ + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 + +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A + +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void* pointer); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint* first, const GLsizei *count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint* first, const GLsizei *count, GLsizei primcount); + +#define glDrawElementArrayAPPLE GLEW_GET_FUN(__glewDrawElementArrayAPPLE) +#define glDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewDrawRangeElementArrayAPPLE) +#define glElementPointerAPPLE GLEW_GET_FUN(__glewElementPointerAPPLE) +#define glMultiDrawElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawElementArrayAPPLE) +#define glMultiDrawRangeElementArrayAPPLE GLEW_GET_FUN(__glewMultiDrawRangeElementArrayAPPLE) + +#define GLEW_APPLE_element_array GLEW_GET_VAR(__GLEW_APPLE_element_array) + +#endif /* GL_APPLE_element_array */ + +/* ----------------------------- GL_APPLE_fence ---------------------------- */ + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 + +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B + +typedef void (GLAPIENTRY * PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint* fences); +typedef void (GLAPIENTRY * PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +typedef void (GLAPIENTRY * PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint* fences); +typedef GLboolean (GLAPIENTRY * PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (GLAPIENTRY * PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); + +#define glDeleteFencesAPPLE GLEW_GET_FUN(__glewDeleteFencesAPPLE) +#define glFinishFenceAPPLE GLEW_GET_FUN(__glewFinishFenceAPPLE) +#define glFinishObjectAPPLE GLEW_GET_FUN(__glewFinishObjectAPPLE) +#define glGenFencesAPPLE GLEW_GET_FUN(__glewGenFencesAPPLE) +#define glIsFenceAPPLE GLEW_GET_FUN(__glewIsFenceAPPLE) +#define glSetFenceAPPLE GLEW_GET_FUN(__glewSetFenceAPPLE) +#define glTestFenceAPPLE GLEW_GET_FUN(__glewTestFenceAPPLE) +#define glTestObjectAPPLE GLEW_GET_FUN(__glewTestObjectAPPLE) + +#define GLEW_APPLE_fence GLEW_GET_VAR(__GLEW_APPLE_fence) + +#endif /* GL_APPLE_fence */ + +/* ------------------------- GL_APPLE_float_pixels ------------------------- */ + +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 + +#define GL_HALF_APPLE 0x140B +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_COLOR_FLOAT_APPLE 0x8A0F + +#define GLEW_APPLE_float_pixels GLEW_GET_VAR(__GLEW_APPLE_float_pixels) + +#endif /* GL_APPLE_float_pixels */ + +/* ------------------------- GL_APPLE_pixel_buffer ------------------------- */ + +#ifndef GL_APPLE_pixel_buffer +#define GL_APPLE_pixel_buffer 1 + +#define GL_MIN_PBUFFER_VIEWPORT_DIMS_APPLE 0x8A10 + +#define GLEW_APPLE_pixel_buffer GLEW_GET_VAR(__GLEW_APPLE_pixel_buffer) + +#endif /* GL_APPLE_pixel_buffer */ + +/* ------------------------ GL_APPLE_specular_vector ----------------------- */ + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 + +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 + +#define GLEW_APPLE_specular_vector GLEW_GET_VAR(__GLEW_APPLE_specular_vector) + +#endif /* GL_APPLE_specular_vector */ + +/* ------------------------- GL_APPLE_texture_range ------------------------ */ + +#ifndef GL_APPLE_texture_range +#define GL_APPLE_texture_range 1 + +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF + +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid **params); +typedef void (GLAPIENTRY * PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, GLvoid *pointer); + +#define glGetTexParameterPointervAPPLE GLEW_GET_FUN(__glewGetTexParameterPointervAPPLE) +#define glTextureRangeAPPLE GLEW_GET_FUN(__glewTextureRangeAPPLE) + +#define GLEW_APPLE_texture_range GLEW_GET_VAR(__GLEW_APPLE_texture_range) + +#endif /* GL_APPLE_texture_range */ + +/* ------------------------ GL_APPLE_transform_hint ------------------------ */ + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 + +#define GL_TRANSFORM_HINT_APPLE 0x85B1 + +#define GLEW_APPLE_transform_hint GLEW_GET_VAR(__GLEW_APPLE_transform_hint) + +#endif /* GL_APPLE_transform_hint */ + +/* ---------------------- GL_APPLE_vertex_array_object --------------------- */ + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 + +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 + +typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays); +typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint* arrays); +typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); + +#define glBindVertexArrayAPPLE GLEW_GET_FUN(__glewBindVertexArrayAPPLE) +#define glDeleteVertexArraysAPPLE GLEW_GET_FUN(__glewDeleteVertexArraysAPPLE) +#define glGenVertexArraysAPPLE GLEW_GET_FUN(__glewGenVertexArraysAPPLE) +#define glIsVertexArrayAPPLE GLEW_GET_FUN(__glewIsVertexArrayAPPLE) + +#define GLEW_APPLE_vertex_array_object GLEW_GET_VAR(__GLEW_APPLE_vertex_array_object) + +#endif /* GL_APPLE_vertex_array_object */ + +/* ---------------------- GL_APPLE_vertex_array_range ---------------------- */ + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 + +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF + +typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void* pointer); + +#define glFlushVertexArrayRangeAPPLE GLEW_GET_FUN(__glewFlushVertexArrayRangeAPPLE) +#define glVertexArrayParameteriAPPLE GLEW_GET_FUN(__glewVertexArrayParameteriAPPLE) +#define glVertexArrayRangeAPPLE GLEW_GET_FUN(__glewVertexArrayRangeAPPLE) + +#define GLEW_APPLE_vertex_array_range GLEW_GET_VAR(__GLEW_APPLE_vertex_array_range) + +#endif /* GL_APPLE_vertex_array_range */ + +/* --------------------------- GL_APPLE_ycbcr_422 -------------------------- */ + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 + +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB + +#define GLEW_APPLE_ycbcr_422 GLEW_GET_VAR(__GLEW_APPLE_ycbcr_422) + +#endif /* GL_APPLE_ycbcr_422 */ + +/* ----------------------- GL_ARB_color_buffer_float ----------------------- */ + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 + +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D + +typedef void (GLAPIENTRY * PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); + +#define glClampColorARB GLEW_GET_FUN(__glewClampColorARB) + +#define GLEW_ARB_color_buffer_float GLEW_GET_VAR(__GLEW_ARB_color_buffer_float) + +#endif /* GL_ARB_color_buffer_float */ + +/* -------------------------- GL_ARB_depth_texture ------------------------- */ + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 + +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B + +#define GLEW_ARB_depth_texture GLEW_GET_VAR(__GLEW_ARB_depth_texture) + +#endif /* GL_ARB_depth_texture */ + +/* -------------------------- GL_ARB_draw_buffers -------------------------- */ + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 + +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 + +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum* bufs); + +#define glDrawBuffersARB GLEW_GET_FUN(__glewDrawBuffersARB) + +#define GLEW_ARB_draw_buffers GLEW_GET_VAR(__GLEW_ARB_draw_buffers) + +#endif /* GL_ARB_draw_buffers */ + +/* ------------------------ GL_ARB_fragment_program ------------------------ */ + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 + +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 + +#define GLEW_ARB_fragment_program GLEW_GET_VAR(__GLEW_ARB_fragment_program) + +#endif /* GL_ARB_fragment_program */ + +/* --------------------- GL_ARB_fragment_program_shadow -------------------- */ + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 + +#define GLEW_ARB_fragment_program_shadow GLEW_GET_VAR(__GLEW_ARB_fragment_program_shadow) + +#endif /* GL_ARB_fragment_program_shadow */ + +/* ------------------------- GL_ARB_fragment_shader ------------------------ */ + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 + +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B + +#define GLEW_ARB_fragment_shader GLEW_GET_VAR(__GLEW_ARB_fragment_shader) + +#endif /* GL_ARB_fragment_shader */ + +/* ------------------------ GL_ARB_half_float_pixel ------------------------ */ + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 + +#define GL_HALF_FLOAT_ARB 0x140B + +#define GLEW_ARB_half_float_pixel GLEW_GET_VAR(__GLEW_ARB_half_float_pixel) + +#endif /* GL_ARB_half_float_pixel */ + +/* ----------------------------- GL_ARB_imaging ---------------------------- */ + +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 + +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_IGNORE_BORDER 0x8150 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_WRAP_BORDER 0x8152 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 + +typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (GLAPIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); + +#define glColorSubTable GLEW_GET_FUN(__glewColorSubTable) +#define glColorTable GLEW_GET_FUN(__glewColorTable) +#define glColorTableParameterfv GLEW_GET_FUN(__glewColorTableParameterfv) +#define glColorTableParameteriv GLEW_GET_FUN(__glewColorTableParameteriv) +#define glConvolutionFilter1D GLEW_GET_FUN(__glewConvolutionFilter1D) +#define glConvolutionFilter2D GLEW_GET_FUN(__glewConvolutionFilter2D) +#define glConvolutionParameterf GLEW_GET_FUN(__glewConvolutionParameterf) +#define glConvolutionParameterfv GLEW_GET_FUN(__glewConvolutionParameterfv) +#define glConvolutionParameteri GLEW_GET_FUN(__glewConvolutionParameteri) +#define glConvolutionParameteriv GLEW_GET_FUN(__glewConvolutionParameteriv) +#define glCopyColorSubTable GLEW_GET_FUN(__glewCopyColorSubTable) +#define glCopyColorTable GLEW_GET_FUN(__glewCopyColorTable) +#define glCopyConvolutionFilter1D GLEW_GET_FUN(__glewCopyConvolutionFilter1D) +#define glCopyConvolutionFilter2D GLEW_GET_FUN(__glewCopyConvolutionFilter2D) +#define glGetColorTable GLEW_GET_FUN(__glewGetColorTable) +#define glGetColorTableParameterfv GLEW_GET_FUN(__glewGetColorTableParameterfv) +#define glGetColorTableParameteriv GLEW_GET_FUN(__glewGetColorTableParameteriv) +#define glGetConvolutionFilter GLEW_GET_FUN(__glewGetConvolutionFilter) +#define glGetConvolutionParameterfv GLEW_GET_FUN(__glewGetConvolutionParameterfv) +#define glGetConvolutionParameteriv GLEW_GET_FUN(__glewGetConvolutionParameteriv) +#define glGetHistogram GLEW_GET_FUN(__glewGetHistogram) +#define glGetHistogramParameterfv GLEW_GET_FUN(__glewGetHistogramParameterfv) +#define glGetHistogramParameteriv GLEW_GET_FUN(__glewGetHistogramParameteriv) +#define glGetMinmax GLEW_GET_FUN(__glewGetMinmax) +#define glGetMinmaxParameterfv GLEW_GET_FUN(__glewGetMinmaxParameterfv) +#define glGetMinmaxParameteriv GLEW_GET_FUN(__glewGetMinmaxParameteriv) +#define glGetSeparableFilter GLEW_GET_FUN(__glewGetSeparableFilter) +#define glHistogram GLEW_GET_FUN(__glewHistogram) +#define glMinmax GLEW_GET_FUN(__glewMinmax) +#define glResetHistogram GLEW_GET_FUN(__glewResetHistogram) +#define glResetMinmax GLEW_GET_FUN(__glewResetMinmax) +#define glSeparableFilter2D GLEW_GET_FUN(__glewSeparableFilter2D) + +#define GLEW_ARB_imaging GLEW_GET_VAR(__GLEW_ARB_imaging) + +#endif /* GL_ARB_imaging */ + +/* ------------------------- GL_ARB_matrix_palette ------------------------- */ + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 + +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 + +typedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, GLubyte *indices); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, GLuint *indices); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, GLushort *indices); + +#define glCurrentPaletteMatrixARB GLEW_GET_FUN(__glewCurrentPaletteMatrixARB) +#define glMatrixIndexPointerARB GLEW_GET_FUN(__glewMatrixIndexPointerARB) +#define glMatrixIndexubvARB GLEW_GET_FUN(__glewMatrixIndexubvARB) +#define glMatrixIndexuivARB GLEW_GET_FUN(__glewMatrixIndexuivARB) +#define glMatrixIndexusvARB GLEW_GET_FUN(__glewMatrixIndexusvARB) + +#define GLEW_ARB_matrix_palette GLEW_GET_VAR(__GLEW_ARB_matrix_palette) + +#endif /* GL_ARB_matrix_palette */ + +/* --------------------------- GL_ARB_multisample -------------------------- */ + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 + +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 + +typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); + +#define glSampleCoverageARB GLEW_GET_FUN(__glewSampleCoverageARB) + +#define GLEW_ARB_multisample GLEW_GET_VAR(__GLEW_ARB_multisample) + +#endif /* GL_ARB_multisample */ + +/* -------------------------- GL_ARB_multitexture -------------------------- */ + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); + +#define glActiveTextureARB GLEW_GET_FUN(__glewActiveTextureARB) +#define glClientActiveTextureARB GLEW_GET_FUN(__glewClientActiveTextureARB) +#define glMultiTexCoord1dARB GLEW_GET_FUN(__glewMultiTexCoord1dARB) +#define glMultiTexCoord1dvARB GLEW_GET_FUN(__glewMultiTexCoord1dvARB) +#define glMultiTexCoord1fARB GLEW_GET_FUN(__glewMultiTexCoord1fARB) +#define glMultiTexCoord1fvARB GLEW_GET_FUN(__glewMultiTexCoord1fvARB) +#define glMultiTexCoord1iARB GLEW_GET_FUN(__glewMultiTexCoord1iARB) +#define glMultiTexCoord1ivARB GLEW_GET_FUN(__glewMultiTexCoord1ivARB) +#define glMultiTexCoord1sARB GLEW_GET_FUN(__glewMultiTexCoord1sARB) +#define glMultiTexCoord1svARB GLEW_GET_FUN(__glewMultiTexCoord1svARB) +#define glMultiTexCoord2dARB GLEW_GET_FUN(__glewMultiTexCoord2dARB) +#define glMultiTexCoord2dvARB GLEW_GET_FUN(__glewMultiTexCoord2dvARB) +#define glMultiTexCoord2fARB GLEW_GET_FUN(__glewMultiTexCoord2fARB) +#define glMultiTexCoord2fvARB GLEW_GET_FUN(__glewMultiTexCoord2fvARB) +#define glMultiTexCoord2iARB GLEW_GET_FUN(__glewMultiTexCoord2iARB) +#define glMultiTexCoord2ivARB GLEW_GET_FUN(__glewMultiTexCoord2ivARB) +#define glMultiTexCoord2sARB GLEW_GET_FUN(__glewMultiTexCoord2sARB) +#define glMultiTexCoord2svARB GLEW_GET_FUN(__glewMultiTexCoord2svARB) +#define glMultiTexCoord3dARB GLEW_GET_FUN(__glewMultiTexCoord3dARB) +#define glMultiTexCoord3dvARB GLEW_GET_FUN(__glewMultiTexCoord3dvARB) +#define glMultiTexCoord3fARB GLEW_GET_FUN(__glewMultiTexCoord3fARB) +#define glMultiTexCoord3fvARB GLEW_GET_FUN(__glewMultiTexCoord3fvARB) +#define glMultiTexCoord3iARB GLEW_GET_FUN(__glewMultiTexCoord3iARB) +#define glMultiTexCoord3ivARB GLEW_GET_FUN(__glewMultiTexCoord3ivARB) +#define glMultiTexCoord3sARB GLEW_GET_FUN(__glewMultiTexCoord3sARB) +#define glMultiTexCoord3svARB GLEW_GET_FUN(__glewMultiTexCoord3svARB) +#define glMultiTexCoord4dARB GLEW_GET_FUN(__glewMultiTexCoord4dARB) +#define glMultiTexCoord4dvARB GLEW_GET_FUN(__glewMultiTexCoord4dvARB) +#define glMultiTexCoord4fARB GLEW_GET_FUN(__glewMultiTexCoord4fARB) +#define glMultiTexCoord4fvARB GLEW_GET_FUN(__glewMultiTexCoord4fvARB) +#define glMultiTexCoord4iARB GLEW_GET_FUN(__glewMultiTexCoord4iARB) +#define glMultiTexCoord4ivARB GLEW_GET_FUN(__glewMultiTexCoord4ivARB) +#define glMultiTexCoord4sARB GLEW_GET_FUN(__glewMultiTexCoord4sARB) +#define glMultiTexCoord4svARB GLEW_GET_FUN(__glewMultiTexCoord4svARB) + +#define GLEW_ARB_multitexture GLEW_GET_VAR(__GLEW_ARB_multitexture) + +#endif /* GL_ARB_multitexture */ + +/* ------------------------- GL_ARB_occlusion_query ------------------------ */ + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 + +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id); + +#define glBeginQueryARB GLEW_GET_FUN(__glewBeginQueryARB) +#define glDeleteQueriesARB GLEW_GET_FUN(__glewDeleteQueriesARB) +#define glEndQueryARB GLEW_GET_FUN(__glewEndQueryARB) +#define glGenQueriesARB GLEW_GET_FUN(__glewGenQueriesARB) +#define glGetQueryObjectivARB GLEW_GET_FUN(__glewGetQueryObjectivARB) +#define glGetQueryObjectuivARB GLEW_GET_FUN(__glewGetQueryObjectuivARB) +#define glGetQueryivARB GLEW_GET_FUN(__glewGetQueryivARB) +#define glIsQueryARB GLEW_GET_FUN(__glewIsQueryARB) + +#define GLEW_ARB_occlusion_query GLEW_GET_VAR(__GLEW_ARB_occlusion_query) + +#endif /* GL_ARB_occlusion_query */ + +/* ----------------------- GL_ARB_pixel_buffer_object ---------------------- */ + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 + +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF + +#define GLEW_ARB_pixel_buffer_object GLEW_GET_VAR(__GLEW_ARB_pixel_buffer_object) + +#endif /* GL_ARB_pixel_buffer_object */ + +/* ------------------------ GL_ARB_point_parameters ------------------------ */ + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 + +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 + +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, GLfloat* params); + +#define glPointParameterfARB GLEW_GET_FUN(__glewPointParameterfARB) +#define glPointParameterfvARB GLEW_GET_FUN(__glewPointParameterfvARB) + +#define GLEW_ARB_point_parameters GLEW_GET_VAR(__GLEW_ARB_point_parameters) + +#endif /* GL_ARB_point_parameters */ + +/* -------------------------- GL_ARB_point_sprite -------------------------- */ + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 + +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 + +#define GLEW_ARB_point_sprite GLEW_GET_VAR(__GLEW_ARB_point_sprite) + +#endif /* GL_ARB_point_sprite */ + +/* ------------------------- GL_ARB_shader_objects ------------------------- */ + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 + +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 + +typedef char GLcharARB; +typedef unsigned int GLhandleARB; + +typedef void (GLAPIENTRY * PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (GLAPIENTRY * PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (GLAPIENTRY * PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef GLhandleARB (GLAPIENTRY * PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (GLAPIENTRY * PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef void (GLAPIENTRY * PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (GLAPIENTRY * PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei* count, GLhandleARB *obj); +typedef GLhandleARB (GLAPIENTRY * PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (GLAPIENTRY * PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *infoLog); +typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei* length, GLcharARB *source); +typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint* params); +typedef void (GLAPIENTRY * PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (GLAPIENTRY * PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint *length); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (GLAPIENTRY * PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (GLAPIENTRY * PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAPIENTRY * PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAPIENTRY * PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +typedef void (GLAPIENTRY * PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); + +#define glAttachObjectARB GLEW_GET_FUN(__glewAttachObjectARB) +#define glCompileShaderARB GLEW_GET_FUN(__glewCompileShaderARB) +#define glCreateProgramObjectARB GLEW_GET_FUN(__glewCreateProgramObjectARB) +#define glCreateShaderObjectARB GLEW_GET_FUN(__glewCreateShaderObjectARB) +#define glDeleteObjectARB GLEW_GET_FUN(__glewDeleteObjectARB) +#define glDetachObjectARB GLEW_GET_FUN(__glewDetachObjectARB) +#define glGetActiveUniformARB GLEW_GET_FUN(__glewGetActiveUniformARB) +#define glGetAttachedObjectsARB GLEW_GET_FUN(__glewGetAttachedObjectsARB) +#define glGetHandleARB GLEW_GET_FUN(__glewGetHandleARB) +#define glGetInfoLogARB GLEW_GET_FUN(__glewGetInfoLogARB) +#define glGetObjectParameterfvARB GLEW_GET_FUN(__glewGetObjectParameterfvARB) +#define glGetObjectParameterivARB GLEW_GET_FUN(__glewGetObjectParameterivARB) +#define glGetShaderSourceARB GLEW_GET_FUN(__glewGetShaderSourceARB) +#define glGetUniformLocationARB GLEW_GET_FUN(__glewGetUniformLocationARB) +#define glGetUniformfvARB GLEW_GET_FUN(__glewGetUniformfvARB) +#define glGetUniformivARB GLEW_GET_FUN(__glewGetUniformivARB) +#define glLinkProgramARB GLEW_GET_FUN(__glewLinkProgramARB) +#define glShaderSourceARB GLEW_GET_FUN(__glewShaderSourceARB) +#define glUniform1fARB GLEW_GET_FUN(__glewUniform1fARB) +#define glUniform1fvARB GLEW_GET_FUN(__glewUniform1fvARB) +#define glUniform1iARB GLEW_GET_FUN(__glewUniform1iARB) +#define glUniform1ivARB GLEW_GET_FUN(__glewUniform1ivARB) +#define glUniform2fARB GLEW_GET_FUN(__glewUniform2fARB) +#define glUniform2fvARB GLEW_GET_FUN(__glewUniform2fvARB) +#define glUniform2iARB GLEW_GET_FUN(__glewUniform2iARB) +#define glUniform2ivARB GLEW_GET_FUN(__glewUniform2ivARB) +#define glUniform3fARB GLEW_GET_FUN(__glewUniform3fARB) +#define glUniform3fvARB GLEW_GET_FUN(__glewUniform3fvARB) +#define glUniform3iARB GLEW_GET_FUN(__glewUniform3iARB) +#define glUniform3ivARB GLEW_GET_FUN(__glewUniform3ivARB) +#define glUniform4fARB GLEW_GET_FUN(__glewUniform4fARB) +#define glUniform4fvARB GLEW_GET_FUN(__glewUniform4fvARB) +#define glUniform4iARB GLEW_GET_FUN(__glewUniform4iARB) +#define glUniform4ivARB GLEW_GET_FUN(__glewUniform4ivARB) +#define glUniformMatrix2fvARB GLEW_GET_FUN(__glewUniformMatrix2fvARB) +#define glUniformMatrix3fvARB GLEW_GET_FUN(__glewUniformMatrix3fvARB) +#define glUniformMatrix4fvARB GLEW_GET_FUN(__glewUniformMatrix4fvARB) +#define glUseProgramObjectARB GLEW_GET_FUN(__glewUseProgramObjectARB) +#define glValidateProgramARB GLEW_GET_FUN(__glewValidateProgramARB) + +#define GLEW_ARB_shader_objects GLEW_GET_VAR(__GLEW_ARB_shader_objects) + +#endif /* GL_ARB_shader_objects */ + +/* ---------------------- GL_ARB_shading_language_100 ---------------------- */ + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 + +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C + +#define GLEW_ARB_shading_language_100 GLEW_GET_VAR(__GLEW_ARB_shading_language_100) + +#endif /* GL_ARB_shading_language_100 */ + +/* ----------------------------- GL_ARB_shadow ----------------------------- */ + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 + +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E + +#define GLEW_ARB_shadow GLEW_GET_VAR(__GLEW_ARB_shadow) + +#endif /* GL_ARB_shadow */ + +/* ------------------------- GL_ARB_shadow_ambient ------------------------- */ + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 + +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF + +#define GLEW_ARB_shadow_ambient GLEW_GET_VAR(__GLEW_ARB_shadow_ambient) + +#endif /* GL_ARB_shadow_ambient */ + +/* ---------------------- GL_ARB_texture_border_clamp ---------------------- */ + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 + +#define GL_CLAMP_TO_BORDER_ARB 0x812D + +#define GLEW_ARB_texture_border_clamp GLEW_GET_VAR(__GLEW_ARB_texture_border_clamp) + +#endif /* GL_ARB_texture_border_clamp */ + +/* ----------------------- GL_ARB_texture_compression ---------------------- */ + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 + +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 + +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void* data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data); +typedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, void* img); + +#define glCompressedTexImage1DARB GLEW_GET_FUN(__glewCompressedTexImage1DARB) +#define glCompressedTexImage2DARB GLEW_GET_FUN(__glewCompressedTexImage2DARB) +#define glCompressedTexImage3DARB GLEW_GET_FUN(__glewCompressedTexImage3DARB) +#define glCompressedTexSubImage1DARB GLEW_GET_FUN(__glewCompressedTexSubImage1DARB) +#define glCompressedTexSubImage2DARB GLEW_GET_FUN(__glewCompressedTexSubImage2DARB) +#define glCompressedTexSubImage3DARB GLEW_GET_FUN(__glewCompressedTexSubImage3DARB) +#define glGetCompressedTexImageARB GLEW_GET_FUN(__glewGetCompressedTexImageARB) + +#define GLEW_ARB_texture_compression GLEW_GET_VAR(__GLEW_ARB_texture_compression) + +#endif /* GL_ARB_texture_compression */ + +/* ------------------------ GL_ARB_texture_cube_map ------------------------ */ + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 + +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C + +#define GLEW_ARB_texture_cube_map GLEW_GET_VAR(__GLEW_ARB_texture_cube_map) + +#endif /* GL_ARB_texture_cube_map */ + +/* ------------------------- GL_ARB_texture_env_add ------------------------ */ + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 + +#define GLEW_ARB_texture_env_add GLEW_GET_VAR(__GLEW_ARB_texture_env_add) + +#endif /* GL_ARB_texture_env_add */ + +/* ----------------------- GL_ARB_texture_env_combine ---------------------- */ + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 + +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A + +#define GLEW_ARB_texture_env_combine GLEW_GET_VAR(__GLEW_ARB_texture_env_combine) + +#endif /* GL_ARB_texture_env_combine */ + +/* ---------------------- GL_ARB_texture_env_crossbar ---------------------- */ + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 + +#define GLEW_ARB_texture_env_crossbar GLEW_GET_VAR(__GLEW_ARB_texture_env_crossbar) + +#endif /* GL_ARB_texture_env_crossbar */ + +/* ------------------------ GL_ARB_texture_env_dot3 ------------------------ */ + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 + +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF + +#define GLEW_ARB_texture_env_dot3 GLEW_GET_VAR(__GLEW_ARB_texture_env_dot3) + +#endif /* GL_ARB_texture_env_dot3 */ + +/* -------------------------- GL_ARB_texture_float ------------------------- */ + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 + +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 + +#define GLEW_ARB_texture_float GLEW_GET_VAR(__GLEW_ARB_texture_float) + +#endif /* GL_ARB_texture_float */ + +/* --------------------- GL_ARB_texture_mirrored_repeat -------------------- */ + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 + +#define GL_MIRRORED_REPEAT_ARB 0x8370 + +#define GLEW_ARB_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_ARB_texture_mirrored_repeat) + +#endif /* GL_ARB_texture_mirrored_repeat */ + +/* -------------------- GL_ARB_texture_non_power_of_two -------------------- */ + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 + +#define GLEW_ARB_texture_non_power_of_two GLEW_GET_VAR(__GLEW_ARB_texture_non_power_of_two) + +#endif /* GL_ARB_texture_non_power_of_two */ + +/* ------------------------ GL_ARB_texture_rectangle ----------------------- */ + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 + +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 + +#define GLEW_ARB_texture_rectangle GLEW_GET_VAR(__GLEW_ARB_texture_rectangle) + +#endif /* GL_ARB_texture_rectangle */ + +/* ------------------------ GL_ARB_transpose_matrix ------------------------ */ + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 + +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 + +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (GLdouble m[16]); +typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (GLfloat m[16]); + +#define glLoadTransposeMatrixdARB GLEW_GET_FUN(__glewLoadTransposeMatrixdARB) +#define glLoadTransposeMatrixfARB GLEW_GET_FUN(__glewLoadTransposeMatrixfARB) +#define glMultTransposeMatrixdARB GLEW_GET_FUN(__glewMultTransposeMatrixdARB) +#define glMultTransposeMatrixfARB GLEW_GET_FUN(__glewMultTransposeMatrixfARB) + +#define GLEW_ARB_transpose_matrix GLEW_GET_VAR(__GLEW_ARB_transpose_matrix) + +#endif /* GL_ARB_transpose_matrix */ + +/* -------------------------- GL_ARB_vertex_blend -------------------------- */ + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 + +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F + +typedef void (GLAPIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count); +typedef void (GLAPIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (GLAPIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, GLbyte *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, GLdouble *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, GLfloat *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, GLint *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, GLshort *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, GLubyte *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, GLuint *weights); +typedef void (GLAPIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, GLushort *weights); + +#define glVertexBlendARB GLEW_GET_FUN(__glewVertexBlendARB) +#define glWeightPointerARB GLEW_GET_FUN(__glewWeightPointerARB) +#define glWeightbvARB GLEW_GET_FUN(__glewWeightbvARB) +#define glWeightdvARB GLEW_GET_FUN(__glewWeightdvARB) +#define glWeightfvARB GLEW_GET_FUN(__glewWeightfvARB) +#define glWeightivARB GLEW_GET_FUN(__glewWeightivARB) +#define glWeightsvARB GLEW_GET_FUN(__glewWeightsvARB) +#define glWeightubvARB GLEW_GET_FUN(__glewWeightubvARB) +#define glWeightuivARB GLEW_GET_FUN(__glewWeightuivARB) +#define glWeightusvARB GLEW_GET_FUN(__glewWeightusvARB) + +#define GLEW_ARB_vertex_blend GLEW_GET_VAR(__GLEW_ARB_vertex_blend) + +#endif /* GL_ARB_vertex_blend */ + +/* ---------------------- GL_ARB_vertex_buffer_object ---------------------- */ + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 + +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA + +typedef ptrdiff_t GLsizeiptrARB; +typedef ptrdiff_t GLintptrARB; + +typedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid* data, GLenum usage); +typedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid* data); +typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint* buffers); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid** params); +typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid* data); +typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef GLvoid * (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target); + +#define glBindBufferARB GLEW_GET_FUN(__glewBindBufferARB) +#define glBufferDataARB GLEW_GET_FUN(__glewBufferDataARB) +#define glBufferSubDataARB GLEW_GET_FUN(__glewBufferSubDataARB) +#define glDeleteBuffersARB GLEW_GET_FUN(__glewDeleteBuffersARB) +#define glGenBuffersARB GLEW_GET_FUN(__glewGenBuffersARB) +#define glGetBufferParameterivARB GLEW_GET_FUN(__glewGetBufferParameterivARB) +#define glGetBufferPointervARB GLEW_GET_FUN(__glewGetBufferPointervARB) +#define glGetBufferSubDataARB GLEW_GET_FUN(__glewGetBufferSubDataARB) +#define glIsBufferARB GLEW_GET_FUN(__glewIsBufferARB) +#define glMapBufferARB GLEW_GET_FUN(__glewMapBufferARB) +#define glUnmapBufferARB GLEW_GET_FUN(__glewUnmapBufferARB) + +#define GLEW_ARB_vertex_buffer_object GLEW_GET_VAR(__GLEW_ARB_vertex_buffer_object) + +#endif /* GL_ARB_vertex_buffer_object */ + +/* ------------------------- GL_ARB_vertex_program ------------------------- */ + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 + +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF + +typedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint* programs); +typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint* programs); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void* string); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid** pointer); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void* string); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer); + +#define glBindProgramARB GLEW_GET_FUN(__glewBindProgramARB) +#define glDeleteProgramsARB GLEW_GET_FUN(__glewDeleteProgramsARB) +#define glDisableVertexAttribArrayARB GLEW_GET_FUN(__glewDisableVertexAttribArrayARB) +#define glEnableVertexAttribArrayARB GLEW_GET_FUN(__glewEnableVertexAttribArrayARB) +#define glGenProgramsARB GLEW_GET_FUN(__glewGenProgramsARB) +#define glGetProgramEnvParameterdvARB GLEW_GET_FUN(__glewGetProgramEnvParameterdvARB) +#define glGetProgramEnvParameterfvARB GLEW_GET_FUN(__glewGetProgramEnvParameterfvARB) +#define glGetProgramLocalParameterdvARB GLEW_GET_FUN(__glewGetProgramLocalParameterdvARB) +#define glGetProgramLocalParameterfvARB GLEW_GET_FUN(__glewGetProgramLocalParameterfvARB) +#define glGetProgramStringARB GLEW_GET_FUN(__glewGetProgramStringARB) +#define glGetProgramivARB GLEW_GET_FUN(__glewGetProgramivARB) +#define glGetVertexAttribPointervARB GLEW_GET_FUN(__glewGetVertexAttribPointervARB) +#define glGetVertexAttribdvARB GLEW_GET_FUN(__glewGetVertexAttribdvARB) +#define glGetVertexAttribfvARB GLEW_GET_FUN(__glewGetVertexAttribfvARB) +#define glGetVertexAttribivARB GLEW_GET_FUN(__glewGetVertexAttribivARB) +#define glIsProgramARB GLEW_GET_FUN(__glewIsProgramARB) +#define glProgramEnvParameter4dARB GLEW_GET_FUN(__glewProgramEnvParameter4dARB) +#define glProgramEnvParameter4dvARB GLEW_GET_FUN(__glewProgramEnvParameter4dvARB) +#define glProgramEnvParameter4fARB GLEW_GET_FUN(__glewProgramEnvParameter4fARB) +#define glProgramEnvParameter4fvARB GLEW_GET_FUN(__glewProgramEnvParameter4fvARB) +#define glProgramLocalParameter4dARB GLEW_GET_FUN(__glewProgramLocalParameter4dARB) +#define glProgramLocalParameter4dvARB GLEW_GET_FUN(__glewProgramLocalParameter4dvARB) +#define glProgramLocalParameter4fARB GLEW_GET_FUN(__glewProgramLocalParameter4fARB) +#define glProgramLocalParameter4fvARB GLEW_GET_FUN(__glewProgramLocalParameter4fvARB) +#define glProgramStringARB GLEW_GET_FUN(__glewProgramStringARB) +#define glVertexAttrib1dARB GLEW_GET_FUN(__glewVertexAttrib1dARB) +#define glVertexAttrib1dvARB GLEW_GET_FUN(__glewVertexAttrib1dvARB) +#define glVertexAttrib1fARB GLEW_GET_FUN(__glewVertexAttrib1fARB) +#define glVertexAttrib1fvARB GLEW_GET_FUN(__glewVertexAttrib1fvARB) +#define glVertexAttrib1sARB GLEW_GET_FUN(__glewVertexAttrib1sARB) +#define glVertexAttrib1svARB GLEW_GET_FUN(__glewVertexAttrib1svARB) +#define glVertexAttrib2dARB GLEW_GET_FUN(__glewVertexAttrib2dARB) +#define glVertexAttrib2dvARB GLEW_GET_FUN(__glewVertexAttrib2dvARB) +#define glVertexAttrib2fARB GLEW_GET_FUN(__glewVertexAttrib2fARB) +#define glVertexAttrib2fvARB GLEW_GET_FUN(__glewVertexAttrib2fvARB) +#define glVertexAttrib2sARB GLEW_GET_FUN(__glewVertexAttrib2sARB) +#define glVertexAttrib2svARB GLEW_GET_FUN(__glewVertexAttrib2svARB) +#define glVertexAttrib3dARB GLEW_GET_FUN(__glewVertexAttrib3dARB) +#define glVertexAttrib3dvARB GLEW_GET_FUN(__glewVertexAttrib3dvARB) +#define glVertexAttrib3fARB GLEW_GET_FUN(__glewVertexAttrib3fARB) +#define glVertexAttrib3fvARB GLEW_GET_FUN(__glewVertexAttrib3fvARB) +#define glVertexAttrib3sARB GLEW_GET_FUN(__glewVertexAttrib3sARB) +#define glVertexAttrib3svARB GLEW_GET_FUN(__glewVertexAttrib3svARB) +#define glVertexAttrib4NbvARB GLEW_GET_FUN(__glewVertexAttrib4NbvARB) +#define glVertexAttrib4NivARB GLEW_GET_FUN(__glewVertexAttrib4NivARB) +#define glVertexAttrib4NsvARB GLEW_GET_FUN(__glewVertexAttrib4NsvARB) +#define glVertexAttrib4NubARB GLEW_GET_FUN(__glewVertexAttrib4NubARB) +#define glVertexAttrib4NubvARB GLEW_GET_FUN(__glewVertexAttrib4NubvARB) +#define glVertexAttrib4NuivARB GLEW_GET_FUN(__glewVertexAttrib4NuivARB) +#define glVertexAttrib4NusvARB GLEW_GET_FUN(__glewVertexAttrib4NusvARB) +#define glVertexAttrib4bvARB GLEW_GET_FUN(__glewVertexAttrib4bvARB) +#define glVertexAttrib4dARB GLEW_GET_FUN(__glewVertexAttrib4dARB) +#define glVertexAttrib4dvARB GLEW_GET_FUN(__glewVertexAttrib4dvARB) +#define glVertexAttrib4fARB GLEW_GET_FUN(__glewVertexAttrib4fARB) +#define glVertexAttrib4fvARB GLEW_GET_FUN(__glewVertexAttrib4fvARB) +#define glVertexAttrib4ivARB GLEW_GET_FUN(__glewVertexAttrib4ivARB) +#define glVertexAttrib4sARB GLEW_GET_FUN(__glewVertexAttrib4sARB) +#define glVertexAttrib4svARB GLEW_GET_FUN(__glewVertexAttrib4svARB) +#define glVertexAttrib4ubvARB GLEW_GET_FUN(__glewVertexAttrib4ubvARB) +#define glVertexAttrib4uivARB GLEW_GET_FUN(__glewVertexAttrib4uivARB) +#define glVertexAttrib4usvARB GLEW_GET_FUN(__glewVertexAttrib4usvARB) +#define glVertexAttribPointerARB GLEW_GET_FUN(__glewVertexAttribPointerARB) + +#define GLEW_ARB_vertex_program GLEW_GET_VAR(__GLEW_ARB_vertex_program) + +#endif /* GL_ARB_vertex_program */ + +/* -------------------------- GL_ARB_vertex_shader ------------------------- */ + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 + +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A + +typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB* name); +typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei* length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB* name); + +#define glBindAttribLocationARB GLEW_GET_FUN(__glewBindAttribLocationARB) +#define glGetActiveAttribARB GLEW_GET_FUN(__glewGetActiveAttribARB) +#define glGetAttribLocationARB GLEW_GET_FUN(__glewGetAttribLocationARB) + +#define GLEW_ARB_vertex_shader GLEW_GET_VAR(__GLEW_ARB_vertex_shader) + +#endif /* GL_ARB_vertex_shader */ + +/* --------------------------- GL_ARB_window_pos --------------------------- */ + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 + +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p); + +#define glWindowPos2dARB GLEW_GET_FUN(__glewWindowPos2dARB) +#define glWindowPos2dvARB GLEW_GET_FUN(__glewWindowPos2dvARB) +#define glWindowPos2fARB GLEW_GET_FUN(__glewWindowPos2fARB) +#define glWindowPos2fvARB GLEW_GET_FUN(__glewWindowPos2fvARB) +#define glWindowPos2iARB GLEW_GET_FUN(__glewWindowPos2iARB) +#define glWindowPos2ivARB GLEW_GET_FUN(__glewWindowPos2ivARB) +#define glWindowPos2sARB GLEW_GET_FUN(__glewWindowPos2sARB) +#define glWindowPos2svARB GLEW_GET_FUN(__glewWindowPos2svARB) +#define glWindowPos3dARB GLEW_GET_FUN(__glewWindowPos3dARB) +#define glWindowPos3dvARB GLEW_GET_FUN(__glewWindowPos3dvARB) +#define glWindowPos3fARB GLEW_GET_FUN(__glewWindowPos3fARB) +#define glWindowPos3fvARB GLEW_GET_FUN(__glewWindowPos3fvARB) +#define glWindowPos3iARB GLEW_GET_FUN(__glewWindowPos3iARB) +#define glWindowPos3ivARB GLEW_GET_FUN(__glewWindowPos3ivARB) +#define glWindowPos3sARB GLEW_GET_FUN(__glewWindowPos3sARB) +#define glWindowPos3svARB GLEW_GET_FUN(__glewWindowPos3svARB) + +#define GLEW_ARB_window_pos GLEW_GET_VAR(__GLEW_ARB_window_pos) + +#endif /* GL_ARB_window_pos */ + +/* ------------------------- GL_ATIX_point_sprites ------------------------- */ + +#ifndef GL_ATIX_point_sprites +#define GL_ATIX_point_sprites 1 + +#define GLEW_ATIX_point_sprites GLEW_GET_VAR(__GLEW_ATIX_point_sprites) + +#endif /* GL_ATIX_point_sprites */ + +/* ---------------------- GL_ATIX_texture_env_combine3 --------------------- */ + +#ifndef GL_ATIX_texture_env_combine3 +#define GL_ATIX_texture_env_combine3 1 + +#define GL_MODULATE_ADD_ATIX 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATIX 0x8745 +#define GL_MODULATE_SUBTRACT_ATIX 0x8746 + +#define GLEW_ATIX_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATIX_texture_env_combine3) + +#endif /* GL_ATIX_texture_env_combine3 */ + +/* ----------------------- GL_ATIX_texture_env_route ----------------------- */ + +#ifndef GL_ATIX_texture_env_route +#define GL_ATIX_texture_env_route 1 + +#define GL_SECONDARY_COLOR_ATIX 0x8747 +#define GL_TEXTURE_OUTPUT_RGB_ATIX 0x8748 +#define GL_TEXTURE_OUTPUT_ALPHA_ATIX 0x8749 + +#define GLEW_ATIX_texture_env_route GLEW_GET_VAR(__GLEW_ATIX_texture_env_route) + +#endif /* GL_ATIX_texture_env_route */ + +/* ---------------- GL_ATIX_vertex_shader_output_point_size ---------------- */ + +#ifndef GL_ATIX_vertex_shader_output_point_size +#define GL_ATIX_vertex_shader_output_point_size 1 + +#define GL_OUTPUT_POINT_SIZE_ATIX 0x610E + +#define GLEW_ATIX_vertex_shader_output_point_size GLEW_GET_VAR(__GLEW_ATIX_vertex_shader_output_point_size) + +#endif /* GL_ATIX_vertex_shader_output_point_size */ + +/* -------------------------- GL_ATI_draw_buffers -------------------------- */ + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 + +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 + +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum* bufs); + +#define glDrawBuffersATI GLEW_GET_FUN(__glewDrawBuffersATI) + +#define GLEW_ATI_draw_buffers GLEW_GET_VAR(__GLEW_ATI_draw_buffers) + +#endif /* GL_ATI_draw_buffers */ + +/* -------------------------- GL_ATI_element_array ------------------------- */ + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 + +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A + +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +typedef void (GLAPIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void* pointer); + +#define glDrawElementArrayATI GLEW_GET_FUN(__glewDrawElementArrayATI) +#define glDrawRangeElementArrayATI GLEW_GET_FUN(__glewDrawRangeElementArrayATI) +#define glElementPointerATI GLEW_GET_FUN(__glewElementPointerATI) + +#define GLEW_ATI_element_array GLEW_GET_VAR(__GLEW_ATI_element_array) + +#endif /* GL_ATI_element_array */ + +/* ------------------------- GL_ATI_envmap_bumpmap ------------------------- */ + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 + +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C + +typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +typedef void (GLAPIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +typedef void (GLAPIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); + +#define glGetTexBumpParameterfvATI GLEW_GET_FUN(__glewGetTexBumpParameterfvATI) +#define glGetTexBumpParameterivATI GLEW_GET_FUN(__glewGetTexBumpParameterivATI) +#define glTexBumpParameterfvATI GLEW_GET_FUN(__glewTexBumpParameterfvATI) +#define glTexBumpParameterivATI GLEW_GET_FUN(__glewTexBumpParameterivATI) + +#define GLEW_ATI_envmap_bumpmap GLEW_GET_VAR(__GLEW_ATI_envmap_bumpmap) + +#endif /* GL_ATI_envmap_bumpmap */ + +/* ------------------------- GL_ATI_fragment_shader ------------------------ */ + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 + +#define GL_RED_BIT_ATI 0x00000001 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B + +typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (GLAPIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (GLAPIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (GLAPIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (GLAPIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (GLAPIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef GLuint (GLAPIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (GLAPIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (GLAPIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (GLAPIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat* value); + +#define glAlphaFragmentOp1ATI GLEW_GET_FUN(__glewAlphaFragmentOp1ATI) +#define glAlphaFragmentOp2ATI GLEW_GET_FUN(__glewAlphaFragmentOp2ATI) +#define glAlphaFragmentOp3ATI GLEW_GET_FUN(__glewAlphaFragmentOp3ATI) +#define glBeginFragmentShaderATI GLEW_GET_FUN(__glewBeginFragmentShaderATI) +#define glBindFragmentShaderATI GLEW_GET_FUN(__glewBindFragmentShaderATI) +#define glColorFragmentOp1ATI GLEW_GET_FUN(__glewColorFragmentOp1ATI) +#define glColorFragmentOp2ATI GLEW_GET_FUN(__glewColorFragmentOp2ATI) +#define glColorFragmentOp3ATI GLEW_GET_FUN(__glewColorFragmentOp3ATI) +#define glDeleteFragmentShaderATI GLEW_GET_FUN(__glewDeleteFragmentShaderATI) +#define glEndFragmentShaderATI GLEW_GET_FUN(__glewEndFragmentShaderATI) +#define glGenFragmentShadersATI GLEW_GET_FUN(__glewGenFragmentShadersATI) +#define glPassTexCoordATI GLEW_GET_FUN(__glewPassTexCoordATI) +#define glSampleMapATI GLEW_GET_FUN(__glewSampleMapATI) +#define glSetFragmentShaderConstantATI GLEW_GET_FUN(__glewSetFragmentShaderConstantATI) + +#define GLEW_ATI_fragment_shader GLEW_GET_VAR(__GLEW_ATI_fragment_shader) + +#endif /* GL_ATI_fragment_shader */ + +/* ------------------------ GL_ATI_map_object_buffer ----------------------- */ + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 + +typedef void* (GLAPIENTRY * PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); + +#define glMapObjectBufferATI GLEW_GET_FUN(__glewMapObjectBufferATI) +#define glUnmapObjectBufferATI GLEW_GET_FUN(__glewUnmapObjectBufferATI) + +#define GLEW_ATI_map_object_buffer GLEW_GET_VAR(__GLEW_ATI_map_object_buffer) + +#endif /* GL_ATI_map_object_buffer */ + +/* -------------------------- GL_ATI_pn_triangles -------------------------- */ + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 + +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 + +typedef void (GLAPIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); + +#define glPNTrianglesfATI GLEW_GET_FUN(__glPNTrianglewesfATI) +#define glPNTrianglesiATI GLEW_GET_FUN(__glPNTrianglewesiATI) + +#define GLEW_ATI_pn_triangles GLEW_GET_VAR(__GLEW_ATI_pn_triangles) + +#endif /* GL_ATI_pn_triangles */ + +/* ------------------------ GL_ATI_separate_stencil ------------------------ */ + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 + +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 + +typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + +#define glStencilFuncSeparateATI GLEW_GET_FUN(__glewStencilFuncSeparateATI) +#define glStencilOpSeparateATI GLEW_GET_FUN(__glewStencilOpSeparateATI) + +#define GLEW_ATI_separate_stencil GLEW_GET_VAR(__GLEW_ATI_separate_stencil) + +#endif /* GL_ATI_separate_stencil */ + +/* ---------------------- GL_ATI_text_fragment_shader ---------------------- */ + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 + +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 + +#define GLEW_ATI_text_fragment_shader GLEW_GET_VAR(__GLEW_ATI_text_fragment_shader) + +#endif /* GL_ATI_text_fragment_shader */ + +/* --------------------- GL_ATI_texture_compression_3dc -------------------- */ + +#ifndef GL_ATI_texture_compression_3dc +#define GL_ATI_texture_compression_3dc 1 + +#define GL_COMPRESSED_RGB_3DC_ATI 0x8837 + +#define GLEW_ATI_texture_compression_3dc GLEW_GET_VAR(__GLEW_ATI_texture_compression_3dc) + +#endif /* GL_ATI_texture_compression_3dc */ + +/* ---------------------- GL_ATI_texture_env_combine3 ---------------------- */ + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 + +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 + +#define GLEW_ATI_texture_env_combine3 GLEW_GET_VAR(__GLEW_ATI_texture_env_combine3) + +#endif /* GL_ATI_texture_env_combine3 */ + +/* -------------------------- GL_ATI_texture_float ------------------------- */ + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 + +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F + +#define GLEW_ATI_texture_float GLEW_GET_VAR(__GLEW_ATI_texture_float) + +#endif /* GL_ATI_texture_float */ + +/* ----------------------- GL_ATI_texture_mirror_once ---------------------- */ + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 + +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 + +#define GLEW_ATI_texture_mirror_once GLEW_GET_VAR(__GLEW_ATI_texture_mirror_once) + +#endif /* GL_ATI_texture_mirror_once */ + +/* ----------------------- GL_ATI_vertex_array_object ---------------------- */ + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 + +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 + +typedef void (GLAPIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (GLAPIENTRY * PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef GLuint (GLAPIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void* pointer, GLenum usage); +typedef void (GLAPIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void* pointer, GLenum preserve); +typedef void (GLAPIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); + +#define glArrayObjectATI GLEW_GET_FUN(__glewArrayObjectATI) +#define glFreeObjectBufferATI GLEW_GET_FUN(__glewFreeObjectBufferATI) +#define glGetArrayObjectfvATI GLEW_GET_FUN(__glewGetArrayObjectfvATI) +#define glGetArrayObjectivATI GLEW_GET_FUN(__glewGetArrayObjectivATI) +#define glGetObjectBufferfvATI GLEW_GET_FUN(__glewGetObjectBufferfvATI) +#define glGetObjectBufferivATI GLEW_GET_FUN(__glewGetObjectBufferivATI) +#define glGetVariantArrayObjectfvATI GLEW_GET_FUN(__glewGetVariantArrayObjectfvATI) +#define glGetVariantArrayObjectivATI GLEW_GET_FUN(__glewGetVariantArrayObjectivATI) +#define glIsObjectBufferATI GLEW_GET_FUN(__glewIsObjectBufferATI) +#define glNewObjectBufferATI GLEW_GET_FUN(__glewNewObjectBufferATI) +#define glUpdateObjectBufferATI GLEW_GET_FUN(__glewUpdateObjectBufferATI) +#define glVariantArrayObjectATI GLEW_GET_FUN(__glewVariantArrayObjectATI) + +#define GLEW_ATI_vertex_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_array_object) + +#endif /* GL_ATI_vertex_array_object */ + +/* ------------------- GL_ATI_vertex_attrib_array_object ------------------- */ + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 + +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); + +#define glGetVertexAttribArrayObjectfvATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectfvATI) +#define glGetVertexAttribArrayObjectivATI GLEW_GET_FUN(__glewGetVertexAttribArrayObjectivATI) +#define glVertexAttribArrayObjectATI GLEW_GET_FUN(__glewVertexAttribArrayObjectATI) + +#define GLEW_ATI_vertex_attrib_array_object GLEW_GET_VAR(__GLEW_ATI_vertex_attrib_array_object) + +#endif /* GL_ATI_vertex_attrib_array_object */ + +/* ------------------------- GL_ATI_vertex_streams ------------------------- */ + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 + +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_SOURCE_ATI 0x876C +#define GL_VERTEX_STREAM0_ATI 0x876D +#define GL_VERTEX_STREAM1_ATI 0x876E +#define GL_VERTEX_STREAM2_ATI 0x876F +#define GL_VERTEX_STREAM3_ATI 0x8770 +#define GL_VERTEX_STREAM4_ATI 0x8771 +#define GL_VERTEX_STREAM5_ATI 0x8772 +#define GL_VERTEX_STREAM6_ATI 0x8773 +#define GL_VERTEX_STREAM7_ATI 0x8774 + +typedef void (GLAPIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte x, GLbyte y, GLbyte z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *v); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *v); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *v); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *v); + +#define glClientActiveVertexStreamATI GLEW_GET_FUN(__glewClientActiveVertexStreamATI) +#define glNormalStream3bATI GLEW_GET_FUN(__glewNormalStream3bATI) +#define glNormalStream3bvATI GLEW_GET_FUN(__glewNormalStream3bvATI) +#define glNormalStream3dATI GLEW_GET_FUN(__glewNormalStream3dATI) +#define glNormalStream3dvATI GLEW_GET_FUN(__glewNormalStream3dvATI) +#define glNormalStream3fATI GLEW_GET_FUN(__glewNormalStream3fATI) +#define glNormalStream3fvATI GLEW_GET_FUN(__glewNormalStream3fvATI) +#define glNormalStream3iATI GLEW_GET_FUN(__glewNormalStream3iATI) +#define glNormalStream3ivATI GLEW_GET_FUN(__glewNormalStream3ivATI) +#define glNormalStream3sATI GLEW_GET_FUN(__glewNormalStream3sATI) +#define glNormalStream3svATI GLEW_GET_FUN(__glewNormalStream3svATI) +#define glVertexBlendEnvfATI GLEW_GET_FUN(__glewVertexBlendEnvfATI) +#define glVertexBlendEnviATI GLEW_GET_FUN(__glewVertexBlendEnviATI) +#define glVertexStream2dATI GLEW_GET_FUN(__glewVertexStream2dATI) +#define glVertexStream2dvATI GLEW_GET_FUN(__glewVertexStream2dvATI) +#define glVertexStream2fATI GLEW_GET_FUN(__glewVertexStream2fATI) +#define glVertexStream2fvATI GLEW_GET_FUN(__glewVertexStream2fvATI) +#define glVertexStream2iATI GLEW_GET_FUN(__glewVertexStream2iATI) +#define glVertexStream2ivATI GLEW_GET_FUN(__glewVertexStream2ivATI) +#define glVertexStream2sATI GLEW_GET_FUN(__glewVertexStream2sATI) +#define glVertexStream2svATI GLEW_GET_FUN(__glewVertexStream2svATI) +#define glVertexStream3dATI GLEW_GET_FUN(__glewVertexStream3dATI) +#define glVertexStream3dvATI GLEW_GET_FUN(__glewVertexStream3dvATI) +#define glVertexStream3fATI GLEW_GET_FUN(__glewVertexStream3fATI) +#define glVertexStream3fvATI GLEW_GET_FUN(__glewVertexStream3fvATI) +#define glVertexStream3iATI GLEW_GET_FUN(__glewVertexStream3iATI) +#define glVertexStream3ivATI GLEW_GET_FUN(__glewVertexStream3ivATI) +#define glVertexStream3sATI GLEW_GET_FUN(__glewVertexStream3sATI) +#define glVertexStream3svATI GLEW_GET_FUN(__glewVertexStream3svATI) +#define glVertexStream4dATI GLEW_GET_FUN(__glewVertexStream4dATI) +#define glVertexStream4dvATI GLEW_GET_FUN(__glewVertexStream4dvATI) +#define glVertexStream4fATI GLEW_GET_FUN(__glewVertexStream4fATI) +#define glVertexStream4fvATI GLEW_GET_FUN(__glewVertexStream4fvATI) +#define glVertexStream4iATI GLEW_GET_FUN(__glewVertexStream4iATI) +#define glVertexStream4ivATI GLEW_GET_FUN(__glewVertexStream4ivATI) +#define glVertexStream4sATI GLEW_GET_FUN(__glewVertexStream4sATI) +#define glVertexStream4svATI GLEW_GET_FUN(__glewVertexStream4svATI) + +#define GLEW_ATI_vertex_streams GLEW_GET_VAR(__GLEW_ATI_vertex_streams) + +#endif /* GL_ATI_vertex_streams */ + +/* --------------------------- GL_EXT_422_pixels --------------------------- */ + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 + +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF + +#define GLEW_EXT_422_pixels GLEW_GET_VAR(__GLEW_EXT_422_pixels) + +#endif /* GL_EXT_422_pixels */ + +/* ---------------------------- GL_EXT_Cg_shader --------------------------- */ + +#ifndef GL_EXT_Cg_shader +#define GL_EXT_Cg_shader 1 + +#define GL_CG_VERTEX_SHADER_EXT 0x890E +#define GL_CG_FRAGMENT_SHADER_EXT 0x890F + +#define GLEW_EXT_Cg_shader GLEW_GET_VAR(__GLEW_EXT_Cg_shader) + +#endif /* GL_EXT_Cg_shader */ + +/* ------------------------------ GL_EXT_abgr ------------------------------ */ + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 + +#define GL_ABGR_EXT 0x8000 + +#define GLEW_EXT_abgr GLEW_GET_VAR(__GLEW_EXT_abgr) + +#endif /* GL_EXT_abgr */ + +/* ------------------------------ GL_EXT_bgra ------------------------------ */ + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 + +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 + +#define GLEW_EXT_bgra GLEW_GET_VAR(__GLEW_EXT_bgra) + +#endif /* GL_EXT_bgra */ + +/* --------------------------- GL_EXT_blend_color -------------------------- */ + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 + +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 + +typedef void (GLAPIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + +#define glBlendColorEXT GLEW_GET_FUN(__glewBlendColorEXT) + +#define GLEW_EXT_blend_color GLEW_GET_VAR(__GLEW_EXT_blend_color) + +#endif /* GL_EXT_blend_color */ + +/* --------------------- GL_EXT_blend_equation_separate -------------------- */ + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 + +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); + +#define glBlendEquationSeparateEXT GLEW_GET_FUN(__glewBlendEquationSeparateEXT) + +#define GLEW_EXT_blend_equation_separate GLEW_GET_VAR(__GLEW_EXT_blend_equation_separate) + +#endif /* GL_EXT_blend_equation_separate */ + +/* ----------------------- GL_EXT_blend_func_separate ---------------------- */ + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 + +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB + +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + +#define glBlendFuncSeparateEXT GLEW_GET_FUN(__glewBlendFuncSeparateEXT) + +#define GLEW_EXT_blend_func_separate GLEW_GET_VAR(__GLEW_EXT_blend_func_separate) + +#endif /* GL_EXT_blend_func_separate */ + +/* ------------------------- GL_EXT_blend_logic_op ------------------------- */ + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 + +#define GLEW_EXT_blend_logic_op GLEW_GET_VAR(__GLEW_EXT_blend_logic_op) + +#endif /* GL_EXT_blend_logic_op */ + +/* -------------------------- GL_EXT_blend_minmax -------------------------- */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 + +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); + +#define glBlendEquationEXT GLEW_GET_FUN(__glewBlendEquationEXT) + +#define GLEW_EXT_blend_minmax GLEW_GET_VAR(__GLEW_EXT_blend_minmax) + +#endif /* GL_EXT_blend_minmax */ + +/* ------------------------- GL_EXT_blend_subtract ------------------------- */ + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 + +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B + +#define GLEW_EXT_blend_subtract GLEW_GET_VAR(__GLEW_EXT_blend_subtract) + +#endif /* GL_EXT_blend_subtract */ + +/* ------------------------ GL_EXT_clip_volume_hint ------------------------ */ + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 + +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 + +#define GLEW_EXT_clip_volume_hint GLEW_GET_VAR(__GLEW_EXT_clip_volume_hint) + +#endif /* GL_EXT_clip_volume_hint */ + +/* ------------------------------ GL_EXT_cmyka ----------------------------- */ + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 + +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F + +#define GLEW_EXT_cmyka GLEW_GET_VAR(__GLEW_EXT_cmyka) + +#endif /* GL_EXT_cmyka */ + +/* ------------------------- GL_EXT_color_subtable ------------------------- */ + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 + +typedef void (GLAPIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void* data); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); + +#define glColorSubTableEXT GLEW_GET_FUN(__glewColorSubTableEXT) +#define glCopyColorSubTableEXT GLEW_GET_FUN(__glewCopyColorSubTableEXT) + +#define GLEW_EXT_color_subtable GLEW_GET_VAR(__GLEW_EXT_color_subtable) + +#endif /* GL_EXT_color_subtable */ + +/* ---------------------- GL_EXT_compiled_vertex_array --------------------- */ + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 + +typedef void (GLAPIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void); + +#define glLockArraysEXT GLEW_GET_FUN(__glewLockArraysEXT) +#define glUnlockArraysEXT GLEW_GET_FUN(__glewUnlockArraysEXT) + +#define GLEW_EXT_compiled_vertex_array GLEW_GET_VAR(__GLEW_EXT_compiled_vertex_array) + +#endif /* GL_EXT_compiled_vertex_array */ + +/* --------------------------- GL_EXT_convolution -------------------------- */ + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 + +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 + +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* image); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* image); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void* row, void* column, void* span); +typedef void (GLAPIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* row, const void* column); + +#define glConvolutionFilter1DEXT GLEW_GET_FUN(__glewConvolutionFilter1DEXT) +#define glConvolutionFilter2DEXT GLEW_GET_FUN(__glewConvolutionFilter2DEXT) +#define glConvolutionParameterfEXT GLEW_GET_FUN(__glewConvolutionParameterfEXT) +#define glConvolutionParameterfvEXT GLEW_GET_FUN(__glewConvolutionParameterfvEXT) +#define glConvolutionParameteriEXT GLEW_GET_FUN(__glewConvolutionParameteriEXT) +#define glConvolutionParameterivEXT GLEW_GET_FUN(__glewConvolutionParameterivEXT) +#define glCopyConvolutionFilter1DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter1DEXT) +#define glCopyConvolutionFilter2DEXT GLEW_GET_FUN(__glewCopyConvolutionFilter2DEXT) +#define glGetConvolutionFilterEXT GLEW_GET_FUN(__glewGetConvolutionFilterEXT) +#define glGetConvolutionParameterfvEXT GLEW_GET_FUN(__glewGetConvolutionParameterfvEXT) +#define glGetConvolutionParameterivEXT GLEW_GET_FUN(__glewGetConvolutionParameterivEXT) +#define glGetSeparableFilterEXT GLEW_GET_FUN(__glewGetSeparableFilterEXT) +#define glSeparableFilter2DEXT GLEW_GET_FUN(__glewSeparableFilter2DEXT) + +#define GLEW_EXT_convolution GLEW_GET_VAR(__GLEW_EXT_convolution) + +#endif /* GL_EXT_convolution */ + +/* ------------------------ GL_EXT_coordinate_frame ------------------------ */ + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 + +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 + +typedef void (GLAPIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer); +typedef void (GLAPIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, void* pointer); + +#define glBinormalPointerEXT GLEW_GET_FUN(__glewBinormalPointerEXT) +#define glTangentPointerEXT GLEW_GET_FUN(__glewTangentPointerEXT) + +#define GLEW_EXT_coordinate_frame GLEW_GET_VAR(__GLEW_EXT_coordinate_frame) + +#endif /* GL_EXT_coordinate_frame */ + +/* -------------------------- GL_EXT_copy_texture -------------------------- */ + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 + +typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + +#define glCopyTexImage1DEXT GLEW_GET_FUN(__glewCopyTexImage1DEXT) +#define glCopyTexImage2DEXT GLEW_GET_FUN(__glewCopyTexImage2DEXT) +#define glCopyTexSubImage1DEXT GLEW_GET_FUN(__glewCopyTexSubImage1DEXT) +#define glCopyTexSubImage2DEXT GLEW_GET_FUN(__glewCopyTexSubImage2DEXT) +#define glCopyTexSubImage3DEXT GLEW_GET_FUN(__glewCopyTexSubImage3DEXT) + +#define GLEW_EXT_copy_texture GLEW_GET_VAR(__GLEW_EXT_copy_texture) + +#endif /* GL_EXT_copy_texture */ + +/* --------------------------- GL_EXT_cull_vertex -------------------------- */ + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 + +typedef void (GLAPIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params); + +#define glCullParameterdvEXT GLEW_GET_FUN(__glewCullParameterdvEXT) +#define glCullParameterfvEXT GLEW_GET_FUN(__glewCullParameterfvEXT) + +#define GLEW_EXT_cull_vertex GLEW_GET_VAR(__GLEW_EXT_cull_vertex) + +#endif /* GL_EXT_cull_vertex */ + +/* ------------------------ GL_EXT_depth_bounds_test ----------------------- */ + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 + +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 + +typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); + +#define glDepthBoundsEXT GLEW_GET_FUN(__glewDepthBoundsEXT) + +#define GLEW_EXT_depth_bounds_test GLEW_GET_VAR(__GLEW_EXT_depth_bounds_test) + +#endif /* GL_EXT_depth_bounds_test */ + +/* ----------------------- GL_EXT_draw_range_elements ---------------------- */ + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 + +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 + +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); + +#define glDrawRangeElementsEXT GLEW_GET_FUN(__glewDrawRangeElementsEXT) + +#define GLEW_EXT_draw_range_elements GLEW_GET_VAR(__GLEW_EXT_draw_range_elements) + +#endif /* GL_EXT_draw_range_elements */ + +/* ---------------------------- GL_EXT_fog_coord --------------------------- */ + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 + +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 + +typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (GLAPIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); + +#define glFogCoordPointerEXT GLEW_GET_FUN(__glewFogCoordPointerEXT) +#define glFogCoorddEXT GLEW_GET_FUN(__glewFogCoorddEXT) +#define glFogCoorddvEXT GLEW_GET_FUN(__glewFogCoorddvEXT) +#define glFogCoordfEXT GLEW_GET_FUN(__glewFogCoordfEXT) +#define glFogCoordfvEXT GLEW_GET_FUN(__glewFogCoordfvEXT) + +#define GLEW_EXT_fog_coord GLEW_GET_VAR(__GLEW_EXT_fog_coord) + +#endif /* GL_EXT_fog_coord */ + +/* ------------------------ GL_EXT_fragment_lighting ----------------------- */ + +#ifndef GL_EXT_fragment_lighting +#define GL_EXT_fragment_lighting 1 + +#define GL_FRAGMENT_LIGHTING_EXT 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_EXT 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_EXT 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_EXT 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_EXT 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_EXT 0x8405 +#define GL_CURRENT_RASTER_NORMAL_EXT 0x8406 +#define GL_LIGHT_ENV_MODE_EXT 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_EXT 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_EXT 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_EXT 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_EXT 0x840B +#define GL_FRAGMENT_LIGHT0_EXT 0x840C +#define GL_FRAGMENT_LIGHT7_EXT 0x8413 + +typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALEXTPROC) (GLenum face, GLenum mode); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFEXTPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVEXTPROC) (GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIEXTPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVEXTPROC) (GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFEXTPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIEXTPROC) (GLenum light, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFEXTPROC) (GLenum face, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIEXTPROC) (GLenum face, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVEXTPROC) (GLenum light, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVEXTPROC) (GLenum light, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVEXTPROC) (GLenum face, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVEXTPROC) (GLenum face, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLLIGHTENVIEXTPROC) (GLenum pname, GLint param); + +#define glFragmentColorMaterialEXT GLEW_GET_FUN(__glewFragmentColorMaterialEXT) +#define glFragmentLightModelfEXT GLEW_GET_FUN(__glewFragmentLightModelfEXT) +#define glFragmentLightModelfvEXT GLEW_GET_FUN(__glewFragmentLightModelfvEXT) +#define glFragmentLightModeliEXT GLEW_GET_FUN(__glewFragmentLightModeliEXT) +#define glFragmentLightModelivEXT GLEW_GET_FUN(__glewFragmentLightModelivEXT) +#define glFragmentLightfEXT GLEW_GET_FUN(__glewFragmentLightfEXT) +#define glFragmentLightfvEXT GLEW_GET_FUN(__glewFragmentLightfvEXT) +#define glFragmentLightiEXT GLEW_GET_FUN(__glewFragmentLightiEXT) +#define glFragmentLightivEXT GLEW_GET_FUN(__glewFragmentLightivEXT) +#define glFragmentMaterialfEXT GLEW_GET_FUN(__glewFragmentMaterialfEXT) +#define glFragmentMaterialfvEXT GLEW_GET_FUN(__glewFragmentMaterialfvEXT) +#define glFragmentMaterialiEXT GLEW_GET_FUN(__glewFragmentMaterialiEXT) +#define glFragmentMaterialivEXT GLEW_GET_FUN(__glewFragmentMaterialivEXT) +#define glGetFragmentLightfvEXT GLEW_GET_FUN(__glewGetFragmentLightfvEXT) +#define glGetFragmentLightivEXT GLEW_GET_FUN(__glewGetFragmentLightivEXT) +#define glGetFragmentMaterialfvEXT GLEW_GET_FUN(__glewGetFragmentMaterialfvEXT) +#define glGetFragmentMaterialivEXT GLEW_GET_FUN(__glewGetFragmentMaterialivEXT) +#define glLightEnviEXT GLEW_GET_FUN(__glewLightEnviEXT) + +#define GLEW_EXT_fragment_lighting GLEW_GET_VAR(__GLEW_EXT_fragment_lighting) + +#endif /* GL_EXT_fragment_lighting */ + +/* ------------------------ GL_EXT_framebuffer_blit ------------------------ */ + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 + +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA + +typedef void (GLAPIENTRY * PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + +#define glBlitFramebufferEXT GLEW_GET_FUN(__glewBlitFramebufferEXT) + +#define GLEW_EXT_framebuffer_blit GLEW_GET_VAR(__GLEW_EXT_framebuffer_blit) + +#endif /* GL_EXT_framebuffer_blit */ + +/* --------------------- GL_EXT_framebuffer_multisample -------------------- */ + +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 + +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB + +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glRenderbufferStorageMultisampleEXT GLEW_GET_FUN(__glewRenderbufferStorageMultisampleEXT) + +#define GLEW_EXT_framebuffer_multisample GLEW_GET_VAR(__GLEW_EXT_framebuffer_multisample) + +#endif /* GL_EXT_framebuffer_multisample */ + +/* ----------------------- GL_EXT_framebuffer_object ----------------------- */ + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 + +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 + +typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + +#define glBindFramebufferEXT GLEW_GET_FUN(__glewBindFramebufferEXT) +#define glBindRenderbufferEXT GLEW_GET_FUN(__glewBindRenderbufferEXT) +#define glCheckFramebufferStatusEXT GLEW_GET_FUN(__glewCheckFramebufferStatusEXT) +#define glDeleteFramebuffersEXT GLEW_GET_FUN(__glewDeleteFramebuffersEXT) +#define glDeleteRenderbuffersEXT GLEW_GET_FUN(__glewDeleteRenderbuffersEXT) +#define glFramebufferRenderbufferEXT GLEW_GET_FUN(__glewFramebufferRenderbufferEXT) +#define glFramebufferTexture1DEXT GLEW_GET_FUN(__glewFramebufferTexture1DEXT) +#define glFramebufferTexture2DEXT GLEW_GET_FUN(__glewFramebufferTexture2DEXT) +#define glFramebufferTexture3DEXT GLEW_GET_FUN(__glewFramebufferTexture3DEXT) +#define glGenFramebuffersEXT GLEW_GET_FUN(__glewGenFramebuffersEXT) +#define glGenRenderbuffersEXT GLEW_GET_FUN(__glewGenRenderbuffersEXT) +#define glGenerateMipmapEXT GLEW_GET_FUN(__glewGenerateMipmapEXT) +#define glGetFramebufferAttachmentParameterivEXT GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivEXT) +#define glGetRenderbufferParameterivEXT GLEW_GET_FUN(__glewGetRenderbufferParameterivEXT) +#define glIsFramebufferEXT GLEW_GET_FUN(__glewIsFramebufferEXT) +#define glIsRenderbufferEXT GLEW_GET_FUN(__glewIsRenderbufferEXT) +#define glRenderbufferStorageEXT GLEW_GET_FUN(__glewRenderbufferStorageEXT) + +#define GLEW_EXT_framebuffer_object GLEW_GET_VAR(__GLEW_EXT_framebuffer_object) + +#endif /* GL_EXT_framebuffer_object */ + +/* ---------------------------- GL_EXT_histogram --------------------------- */ + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 + +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 + +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void* values); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (GLAPIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target); + +#define glGetHistogramEXT GLEW_GET_FUN(__glewGetHistogramEXT) +#define glGetHistogramParameterfvEXT GLEW_GET_FUN(__glewGetHistogramParameterfvEXT) +#define glGetHistogramParameterivEXT GLEW_GET_FUN(__glewGetHistogramParameterivEXT) +#define glGetMinmaxEXT GLEW_GET_FUN(__glewGetMinmaxEXT) +#define glGetMinmaxParameterfvEXT GLEW_GET_FUN(__glewGetMinmaxParameterfvEXT) +#define glGetMinmaxParameterivEXT GLEW_GET_FUN(__glewGetMinmaxParameterivEXT) +#define glHistogramEXT GLEW_GET_FUN(__glewHistogramEXT) +#define glMinmaxEXT GLEW_GET_FUN(__glewMinmaxEXT) +#define glResetHistogramEXT GLEW_GET_FUN(__glewResetHistogramEXT) +#define glResetMinmaxEXT GLEW_GET_FUN(__glewResetMinmaxEXT) + +#define GLEW_EXT_histogram GLEW_GET_VAR(__GLEW_EXT_histogram) + +#endif /* GL_EXT_histogram */ + +/* ----------------------- GL_EXT_index_array_formats ---------------------- */ + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 + +#define GLEW_EXT_index_array_formats GLEW_GET_VAR(__GLEW_EXT_index_array_formats) + +#endif /* GL_EXT_index_array_formats */ + +/* --------------------------- GL_EXT_index_func --------------------------- */ + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 + +typedef void (GLAPIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref); + +#define glIndexFuncEXT GLEW_GET_FUN(__glewIndexFuncEXT) + +#define GLEW_EXT_index_func GLEW_GET_VAR(__GLEW_EXT_index_func) + +#endif /* GL_EXT_index_func */ + +/* ------------------------- GL_EXT_index_material ------------------------- */ + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 + +typedef void (GLAPIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); + +#define glIndexMaterialEXT GLEW_GET_FUN(__glewIndexMaterialEXT) + +#define GLEW_EXT_index_material GLEW_GET_VAR(__GLEW_EXT_index_material) + +#endif /* GL_EXT_index_material */ + +/* -------------------------- GL_EXT_index_texture ------------------------- */ + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 + +#define GLEW_EXT_index_texture GLEW_GET_VAR(__GLEW_EXT_index_texture) + +#endif /* GL_EXT_index_texture */ + +/* -------------------------- GL_EXT_light_texture ------------------------- */ + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 + +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 + +typedef void (GLAPIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (GLAPIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (GLAPIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); + +#define glApplyTextureEXT GLEW_GET_FUN(__glewApplyTextureEXT) +#define glTextureLightEXT GLEW_GET_FUN(__glewTextureLightEXT) +#define glTextureMaterialEXT GLEW_GET_FUN(__glewTextureMaterialEXT) + +#define GLEW_EXT_light_texture GLEW_GET_VAR(__GLEW_EXT_light_texture) + +#endif /* GL_EXT_light_texture */ + +/* ------------------------- GL_EXT_misc_attribute ------------------------- */ + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 + +#define GLEW_EXT_misc_attribute GLEW_GET_VAR(__GLEW_EXT_misc_attribute) + +#endif /* GL_EXT_misc_attribute */ + +/* ------------------------ GL_EXT_multi_draw_arrays ----------------------- */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 + +typedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint* first, GLsizei *count, GLsizei primcount); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, GLsizei* count, GLenum type, const GLvoid **indices, GLsizei primcount); + +#define glMultiDrawArraysEXT GLEW_GET_FUN(__glewMultiDrawArraysEXT) +#define glMultiDrawElementsEXT GLEW_GET_FUN(__glewMultiDrawElementsEXT) + +#define GLEW_EXT_multi_draw_arrays GLEW_GET_VAR(__GLEW_EXT_multi_draw_arrays) + +#endif /* GL_EXT_multi_draw_arrays */ + +/* --------------------------- GL_EXT_multisample -------------------------- */ + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 + +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 + +typedef void (GLAPIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); + +#define glSampleMaskEXT GLEW_GET_FUN(__glewSampleMaskEXT) +#define glSamplePatternEXT GLEW_GET_FUN(__glewSamplePatternEXT) + +#define GLEW_EXT_multisample GLEW_GET_VAR(__GLEW_EXT_multisample) + +#endif /* GL_EXT_multisample */ + +/* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */ + +#ifndef GL_EXT_packed_depth_stencil +#define GL_EXT_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 + +#define GLEW_EXT_packed_depth_stencil GLEW_GET_VAR(__GLEW_EXT_packed_depth_stencil) + +#endif /* GL_EXT_packed_depth_stencil */ + +/* -------------------------- GL_EXT_packed_pixels ------------------------- */ + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 + +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 + +#define GLEW_EXT_packed_pixels GLEW_GET_VAR(__GLEW_EXT_packed_pixels) + +#endif /* GL_EXT_packed_pixels */ + +/* ------------------------ GL_EXT_paletted_texture ------------------------ */ + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 + +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 +#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B + +typedef void (GLAPIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void* data); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void* data); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint* params); + +#define glColorTableEXT GLEW_GET_FUN(__glewColorTableEXT) +#define glGetColorTableEXT GLEW_GET_FUN(__glewGetColorTableEXT) +#define glGetColorTableParameterfvEXT GLEW_GET_FUN(__glewGetColorTableParameterfvEXT) +#define glGetColorTableParameterivEXT GLEW_GET_FUN(__glewGetColorTableParameterivEXT) + +#define GLEW_EXT_paletted_texture GLEW_GET_VAR(__GLEW_EXT_paletted_texture) + +#endif /* GL_EXT_paletted_texture */ + +/* ----------------------- GL_EXT_pixel_buffer_object ---------------------- */ + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 + +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF + +#define GLEW_EXT_pixel_buffer_object GLEW_GET_VAR(__GLEW_EXT_pixel_buffer_object) + +#endif /* GL_EXT_pixel_buffer_object */ + +/* ------------------------- GL_EXT_pixel_transform ------------------------ */ + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 + +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 + +typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint* params); + +#define glGetPixelTransformParameterfvEXT GLEW_GET_FUN(__glewGetPixelTransformParameterfvEXT) +#define glGetPixelTransformParameterivEXT GLEW_GET_FUN(__glewGetPixelTransformParameterivEXT) +#define glPixelTransformParameterfEXT GLEW_GET_FUN(__glewPixelTransformParameterfEXT) +#define glPixelTransformParameterfvEXT GLEW_GET_FUN(__glewPixelTransformParameterfvEXT) +#define glPixelTransformParameteriEXT GLEW_GET_FUN(__glewPixelTransformParameteriEXT) +#define glPixelTransformParameterivEXT GLEW_GET_FUN(__glewPixelTransformParameterivEXT) + +#define GLEW_EXT_pixel_transform GLEW_GET_VAR(__GLEW_EXT_pixel_transform) + +#endif /* GL_EXT_pixel_transform */ + +/* ------------------- GL_EXT_pixel_transform_color_table ------------------ */ + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 + +#define GLEW_EXT_pixel_transform_color_table GLEW_GET_VAR(__GLEW_EXT_pixel_transform_color_table) + +#endif /* GL_EXT_pixel_transform_color_table */ + +/* ------------------------ GL_EXT_point_parameters ------------------------ */ + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 + +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 + +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, GLfloat* params); + +#define glPointParameterfEXT GLEW_GET_FUN(__glewPointParameterfEXT) +#define glPointParameterfvEXT GLEW_GET_FUN(__glewPointParameterfvEXT) + +#define GLEW_EXT_point_parameters GLEW_GET_VAR(__GLEW_EXT_point_parameters) + +#endif /* GL_EXT_point_parameters */ + +/* ------------------------- GL_EXT_polygon_offset ------------------------- */ + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 + +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 + +typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); + +#define glPolygonOffsetEXT GLEW_GET_FUN(__glewPolygonOffsetEXT) + +#define GLEW_EXT_polygon_offset GLEW_GET_VAR(__GLEW_EXT_polygon_offset) + +#endif /* GL_EXT_polygon_offset */ + +/* ------------------------- GL_EXT_rescale_normal ------------------------- */ + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 + +#define GLEW_EXT_rescale_normal GLEW_GET_VAR(__GLEW_EXT_rescale_normal) + +#endif /* GL_EXT_rescale_normal */ + +/* -------------------------- GL_EXT_scene_marker -------------------------- */ + +#ifndef GL_EXT_scene_marker +#define GL_EXT_scene_marker 1 + +typedef void (GLAPIENTRY * PFNGLBEGINSCENEEXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLENDSCENEEXTPROC) (void); + +#define glBeginSceneEXT GLEW_GET_FUN(__glewBeginSceneEXT) +#define glEndSceneEXT GLEW_GET_FUN(__glewEndSceneEXT) + +#define GLEW_EXT_scene_marker GLEW_GET_VAR(__GLEW_EXT_scene_marker) + +#endif /* GL_EXT_scene_marker */ + +/* ------------------------- GL_EXT_secondary_color ------------------------ */ + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 + +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E + +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); + +#define glSecondaryColor3bEXT GLEW_GET_FUN(__glewSecondaryColor3bEXT) +#define glSecondaryColor3bvEXT GLEW_GET_FUN(__glewSecondaryColor3bvEXT) +#define glSecondaryColor3dEXT GLEW_GET_FUN(__glewSecondaryColor3dEXT) +#define glSecondaryColor3dvEXT GLEW_GET_FUN(__glewSecondaryColor3dvEXT) +#define glSecondaryColor3fEXT GLEW_GET_FUN(__glewSecondaryColor3fEXT) +#define glSecondaryColor3fvEXT GLEW_GET_FUN(__glewSecondaryColor3fvEXT) +#define glSecondaryColor3iEXT GLEW_GET_FUN(__glewSecondaryColor3iEXT) +#define glSecondaryColor3ivEXT GLEW_GET_FUN(__glewSecondaryColor3ivEXT) +#define glSecondaryColor3sEXT GLEW_GET_FUN(__glewSecondaryColor3sEXT) +#define glSecondaryColor3svEXT GLEW_GET_FUN(__glewSecondaryColor3svEXT) +#define glSecondaryColor3ubEXT GLEW_GET_FUN(__glewSecondaryColor3ubEXT) +#define glSecondaryColor3ubvEXT GLEW_GET_FUN(__glewSecondaryColor3ubvEXT) +#define glSecondaryColor3uiEXT GLEW_GET_FUN(__glewSecondaryColor3uiEXT) +#define glSecondaryColor3uivEXT GLEW_GET_FUN(__glewSecondaryColor3uivEXT) +#define glSecondaryColor3usEXT GLEW_GET_FUN(__glewSecondaryColor3usEXT) +#define glSecondaryColor3usvEXT GLEW_GET_FUN(__glewSecondaryColor3usvEXT) +#define glSecondaryColorPointerEXT GLEW_GET_FUN(__glewSecondaryColorPointerEXT) + +#define GLEW_EXT_secondary_color GLEW_GET_VAR(__GLEW_EXT_secondary_color) + +#endif /* GL_EXT_secondary_color */ + +/* --------------------- GL_EXT_separate_specular_color -------------------- */ + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 + +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA + +#define GLEW_EXT_separate_specular_color GLEW_GET_VAR(__GLEW_EXT_separate_specular_color) + +#endif /* GL_EXT_separate_specular_color */ + +/* -------------------------- GL_EXT_shadow_funcs -------------------------- */ + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 + +#define GLEW_EXT_shadow_funcs GLEW_GET_VAR(__GLEW_EXT_shadow_funcs) + +#endif /* GL_EXT_shadow_funcs */ + +/* --------------------- GL_EXT_shared_texture_palette --------------------- */ + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 + +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB + +#define GLEW_EXT_shared_texture_palette GLEW_GET_VAR(__GLEW_EXT_shared_texture_palette) + +#endif /* GL_EXT_shared_texture_palette */ + +/* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */ + +#ifndef GL_EXT_stencil_clear_tag +#define GL_EXT_stencil_clear_tag 1 + +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 + +#define GLEW_EXT_stencil_clear_tag GLEW_GET_VAR(__GLEW_EXT_stencil_clear_tag) + +#endif /* GL_EXT_stencil_clear_tag */ + +/* ------------------------ GL_EXT_stencil_two_side ------------------------ */ + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 + +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 + +typedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); + +#define glActiveStencilFaceEXT GLEW_GET_FUN(__glewActiveStencilFaceEXT) + +#define GLEW_EXT_stencil_two_side GLEW_GET_VAR(__GLEW_EXT_stencil_two_side) + +#endif /* GL_EXT_stencil_two_side */ + +/* -------------------------- GL_EXT_stencil_wrap -------------------------- */ + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 + +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 + +#define GLEW_EXT_stencil_wrap GLEW_GET_VAR(__GLEW_EXT_stencil_wrap) + +#endif /* GL_EXT_stencil_wrap */ + +/* --------------------------- GL_EXT_subtexture --------------------------- */ + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 + +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels); + +#define glTexSubImage1DEXT GLEW_GET_FUN(__glewTexSubImage1DEXT) +#define glTexSubImage2DEXT GLEW_GET_FUN(__glewTexSubImage2DEXT) +#define glTexSubImage3DEXT GLEW_GET_FUN(__glewTexSubImage3DEXT) + +#define GLEW_EXT_subtexture GLEW_GET_VAR(__GLEW_EXT_subtexture) + +#endif /* GL_EXT_subtexture */ + +/* ----------------------------- GL_EXT_texture ---------------------------- */ + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 + +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 + +#define GLEW_EXT_texture GLEW_GET_VAR(__GLEW_EXT_texture) + +#endif /* GL_EXT_texture */ + +/* ---------------------------- GL_EXT_texture3D --------------------------- */ + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 + +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 + +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels); + +#define glTexImage3DEXT GLEW_GET_FUN(__glewTexImage3DEXT) + +#define GLEW_EXT_texture3D GLEW_GET_VAR(__GLEW_EXT_texture3D) + +#endif /* GL_EXT_texture3D */ + +/* -------------------- GL_EXT_texture_compression_dxt1 -------------------- */ + +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 + +#define GLEW_EXT_texture_compression_dxt1 GLEW_GET_VAR(__GLEW_EXT_texture_compression_dxt1) + +#endif /* GL_EXT_texture_compression_dxt1 */ + +/* -------------------- GL_EXT_texture_compression_s3tc -------------------- */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 + +#define GLEW_EXT_texture_compression_s3tc GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc) + +#endif /* GL_EXT_texture_compression_s3tc */ + +/* ------------------------ GL_EXT_texture_cube_map ------------------------ */ + +#ifndef GL_EXT_texture_cube_map +#define GL_EXT_texture_cube_map 1 + +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C + +#define GLEW_EXT_texture_cube_map GLEW_GET_VAR(__GLEW_EXT_texture_cube_map) + +#endif /* GL_EXT_texture_cube_map */ + +/* ----------------------- GL_EXT_texture_edge_clamp ----------------------- */ + +#ifndef GL_EXT_texture_edge_clamp +#define GL_EXT_texture_edge_clamp 1 + +#define GL_CLAMP_TO_EDGE_EXT 0x812F + +#define GLEW_EXT_texture_edge_clamp GLEW_GET_VAR(__GLEW_EXT_texture_edge_clamp) + +#endif /* GL_EXT_texture_edge_clamp */ + +/* --------------------------- GL_EXT_texture_env -------------------------- */ + +#ifndef GL_EXT_texture_env +#define GL_EXT_texture_env 1 + +#define GL_TEXTURE_ENV0_EXT 0 +#define GL_ENV_BLEND_EXT 0 +#define GL_TEXTURE_ENV_SHIFT_EXT 0 +#define GL_ENV_REPLACE_EXT 0 +#define GL_ENV_ADD_EXT 0 +#define GL_ENV_SUBTRACT_EXT 0 +#define GL_TEXTURE_ENV_MODE_ALPHA_EXT 0 +#define GL_ENV_REVERSE_SUBTRACT_EXT 0 +#define GL_ENV_REVERSE_BLEND_EXT 0 +#define GL_ENV_COPY_EXT 0 +#define GL_ENV_MODULATE_EXT 0 + +#define GLEW_EXT_texture_env GLEW_GET_VAR(__GLEW_EXT_texture_env) + +#endif /* GL_EXT_texture_env */ + +/* ------------------------- GL_EXT_texture_env_add ------------------------ */ + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 + +#define GLEW_EXT_texture_env_add GLEW_GET_VAR(__GLEW_EXT_texture_env_add) + +#endif /* GL_EXT_texture_env_add */ + +/* ----------------------- GL_EXT_texture_env_combine ---------------------- */ + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 + +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A + +#define GLEW_EXT_texture_env_combine GLEW_GET_VAR(__GLEW_EXT_texture_env_combine) + +#endif /* GL_EXT_texture_env_combine */ + +/* ------------------------ GL_EXT_texture_env_dot3 ------------------------ */ + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 + +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 + +#define GLEW_EXT_texture_env_dot3 GLEW_GET_VAR(__GLEW_EXT_texture_env_dot3) + +#endif /* GL_EXT_texture_env_dot3 */ + +/* ------------------- GL_EXT_texture_filter_anisotropic ------------------- */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 + +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF + +#define GLEW_EXT_texture_filter_anisotropic GLEW_GET_VAR(__GLEW_EXT_texture_filter_anisotropic) + +#endif /* GL_EXT_texture_filter_anisotropic */ + +/* ------------------------ GL_EXT_texture_lod_bias ------------------------ */ + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 + +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 + +#define GLEW_EXT_texture_lod_bias GLEW_GET_VAR(__GLEW_EXT_texture_lod_bias) + +#endif /* GL_EXT_texture_lod_bias */ + +/* ---------------------- GL_EXT_texture_mirror_clamp ---------------------- */ + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 + +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 + +#define GLEW_EXT_texture_mirror_clamp GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp) + +#endif /* GL_EXT_texture_mirror_clamp */ + +/* ------------------------- GL_EXT_texture_object ------------------------- */ + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 + +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A + +typedef GLboolean (GLAPIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint* textures, GLboolean* residences); +typedef void (GLAPIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (GLAPIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint* textures); +typedef void (GLAPIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint* textures); +typedef GLboolean (GLAPIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (GLAPIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint* textures, const GLclampf* priorities); + +#define glAreTexturesResidentEXT GLEW_GET_FUN(__glewAreTexturesResidentEXT) +#define glBindTextureEXT GLEW_GET_FUN(__glewBindTextureEXT) +#define glDeleteTexturesEXT GLEW_GET_FUN(__glewDeleteTexturesEXT) +#define glGenTexturesEXT GLEW_GET_FUN(__glewGenTexturesEXT) +#define glIsTextureEXT GLEW_GET_FUN(__glewIsTextureEXT) +#define glPrioritizeTexturesEXT GLEW_GET_FUN(__glewPrioritizeTexturesEXT) + +#define GLEW_EXT_texture_object GLEW_GET_VAR(__GLEW_EXT_texture_object) + +#endif /* GL_EXT_texture_object */ + +/* --------------------- GL_EXT_texture_perturb_normal --------------------- */ + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 + +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF + +typedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); + +#define glTextureNormalEXT GLEW_GET_FUN(__glewTextureNormalEXT) + +#define GLEW_EXT_texture_perturb_normal GLEW_GET_VAR(__GLEW_EXT_texture_perturb_normal) + +#endif /* GL_EXT_texture_perturb_normal */ + +/* ------------------------ GL_EXT_texture_rectangle ----------------------- */ + +#ifndef GL_EXT_texture_rectangle +#define GL_EXT_texture_rectangle 1 + +#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8 + +#define GLEW_EXT_texture_rectangle GLEW_GET_VAR(__GLEW_EXT_texture_rectangle) + +#endif /* GL_EXT_texture_rectangle */ + +/* -------------------------- GL_EXT_texture_sRGB -------------------------- */ + +#ifndef GL_EXT_texture_sRGB +#define GL_EXT_texture_sRGB 1 + +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F + +#define GLEW_EXT_texture_sRGB GLEW_GET_VAR(__GLEW_EXT_texture_sRGB) + +#endif /* GL_EXT_texture_sRGB */ + +/* -------------------------- GL_EXT_vertex_array -------------------------- */ + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 + +#define GL_DOUBLE_EXT 0x140A +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 + +typedef void (GLAPIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (GLAPIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer); +typedef void (GLAPIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean* pointer); +typedef void (GLAPIENTRY * PFNGLGETPOINTERVEXTPROC) (GLenum pname, void** params); +typedef void (GLAPIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer); +typedef void (GLAPIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void* pointer); +typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void* pointer); + +#define glArrayElementEXT GLEW_GET_FUN(__glewArrayElementEXT) +#define glColorPointerEXT GLEW_GET_FUN(__glewColorPointerEXT) +#define glDrawArraysEXT GLEW_GET_FUN(__glewDrawArraysEXT) +#define glEdgeFlagPointerEXT GLEW_GET_FUN(__glewEdgeFlagPointerEXT) +#define glGetPointervEXT GLEW_GET_FUN(__glewGetPointervEXT) +#define glIndexPointerEXT GLEW_GET_FUN(__glewIndexPointerEXT) +#define glNormalPointerEXT GLEW_GET_FUN(__glewNormalPointerEXT) +#define glTexCoordPointerEXT GLEW_GET_FUN(__glewTexCoordPointerEXT) +#define glVertexPointerEXT GLEW_GET_FUN(__glewVertexPointerEXT) + +#define GLEW_EXT_vertex_array GLEW_GET_VAR(__GLEW_EXT_vertex_array) + +#endif /* GL_EXT_vertex_array */ + +/* -------------------------- GL_EXT_vertex_shader ------------------------- */ + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 + +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED + +typedef void (GLAPIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef GLuint (GLAPIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (GLAPIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef void (GLAPIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (GLAPIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum dataType, GLenum storageType, GLenum range, GLuint components); +typedef GLuint (GLAPIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (GLAPIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (GLAPIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (GLAPIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (GLAPIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (GLAPIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid **data); +typedef void (GLAPIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLboolean (GLAPIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (GLAPIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr); +typedef void (GLAPIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, GLvoid *addr); +typedef void (GLAPIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (GLAPIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (GLAPIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (GLAPIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (GLAPIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, GLvoid *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, GLbyte *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, GLdouble *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, GLfloat *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, GLint *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, GLshort *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, GLubyte *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, GLuint *addr); +typedef void (GLAPIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, GLushort *addr); +typedef void (GLAPIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); + +#define glBeginVertexShaderEXT GLEW_GET_FUN(__glewBeginVertexShaderEXT) +#define glBindLightParameterEXT GLEW_GET_FUN(__glewBindLightParameterEXT) +#define glBindMaterialParameterEXT GLEW_GET_FUN(__glewBindMaterialParameterEXT) +#define glBindParameterEXT GLEW_GET_FUN(__glewBindParameterEXT) +#define glBindTexGenParameterEXT GLEW_GET_FUN(__glewBindTexGenParameterEXT) +#define glBindTextureUnitParameterEXT GLEW_GET_FUN(__glewBindTextureUnitParameterEXT) +#define glBindVertexShaderEXT GLEW_GET_FUN(__glewBindVertexShaderEXT) +#define glDeleteVertexShaderEXT GLEW_GET_FUN(__glewDeleteVertexShaderEXT) +#define glDisableVariantClientStateEXT GLEW_GET_FUN(__glewDisableVariantClientStateEXT) +#define glEnableVariantClientStateEXT GLEW_GET_FUN(__glewEnableVariantClientStateEXT) +#define glEndVertexShaderEXT GLEW_GET_FUN(__glewEndVertexShaderEXT) +#define glExtractComponentEXT GLEW_GET_FUN(__glewExtractComponentEXT) +#define glGenSymbolsEXT GLEW_GET_FUN(__glewGenSymbolsEXT) +#define glGenVertexShadersEXT GLEW_GET_FUN(__glewGenVertexShadersEXT) +#define glGetInvariantBooleanvEXT GLEW_GET_FUN(__glewGetInvariantBooleanvEXT) +#define glGetInvariantFloatvEXT GLEW_GET_FUN(__glewGetInvariantFloatvEXT) +#define glGetInvariantIntegervEXT GLEW_GET_FUN(__glewGetInvariantIntegervEXT) +#define glGetLocalConstantBooleanvEXT GLEW_GET_FUN(__glewGetLocalConstantBooleanvEXT) +#define glGetLocalConstantFloatvEXT GLEW_GET_FUN(__glewGetLocalConstantFloatvEXT) +#define glGetLocalConstantIntegervEXT GLEW_GET_FUN(__glewGetLocalConstantIntegervEXT) +#define glGetVariantBooleanvEXT GLEW_GET_FUN(__glewGetVariantBooleanvEXT) +#define glGetVariantFloatvEXT GLEW_GET_FUN(__glewGetVariantFloatvEXT) +#define glGetVariantIntegervEXT GLEW_GET_FUN(__glewGetVariantIntegervEXT) +#define glGetVariantPointervEXT GLEW_GET_FUN(__glewGetVariantPointervEXT) +#define glInsertComponentEXT GLEW_GET_FUN(__glewInsertComponentEXT) +#define glIsVariantEnabledEXT GLEW_GET_FUN(__glewIsVariantEnabledEXT) +#define glSetInvariantEXT GLEW_GET_FUN(__glewSetInvariantEXT) +#define glSetLocalConstantEXT GLEW_GET_FUN(__glewSetLocalConstantEXT) +#define glShaderOp1EXT GLEW_GET_FUN(__glewShaderOp1EXT) +#define glShaderOp2EXT GLEW_GET_FUN(__glewShaderOp2EXT) +#define glShaderOp3EXT GLEW_GET_FUN(__glewShaderOp3EXT) +#define glSwizzleEXT GLEW_GET_FUN(__glewSwizzleEXT) +#define glVariantPointerEXT GLEW_GET_FUN(__glewVariantPointerEXT) +#define glVariantbvEXT GLEW_GET_FUN(__glewVariantbvEXT) +#define glVariantdvEXT GLEW_GET_FUN(__glewVariantdvEXT) +#define glVariantfvEXT GLEW_GET_FUN(__glewVariantfvEXT) +#define glVariantivEXT GLEW_GET_FUN(__glewVariantivEXT) +#define glVariantsvEXT GLEW_GET_FUN(__glewVariantsvEXT) +#define glVariantubvEXT GLEW_GET_FUN(__glewVariantubvEXT) +#define glVariantuivEXT GLEW_GET_FUN(__glewVariantuivEXT) +#define glVariantusvEXT GLEW_GET_FUN(__glewVariantusvEXT) +#define glWriteMaskEXT GLEW_GET_FUN(__glewWriteMaskEXT) + +#define GLEW_EXT_vertex_shader GLEW_GET_VAR(__GLEW_EXT_vertex_shader) + +#endif /* GL_EXT_vertex_shader */ + +/* ------------------------ GL_EXT_vertex_weighting ------------------------ */ + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 + +#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 +#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 +#define GL_MODELVIEW0_EXT 0x1700 +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 + +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, void* pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (GLfloat* weight); + +#define glVertexWeightPointerEXT GLEW_GET_FUN(__glewVertexWeightPointerEXT) +#define glVertexWeightfEXT GLEW_GET_FUN(__glewVertexWeightfEXT) +#define glVertexWeightfvEXT GLEW_GET_FUN(__glewVertexWeightfvEXT) + +#define GLEW_EXT_vertex_weighting GLEW_GET_VAR(__GLEW_EXT_vertex_weighting) + +#endif /* GL_EXT_vertex_weighting */ + +/* ------------------------ GL_GREMEDY_string_marker ----------------------- */ + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 + +typedef void (GLAPIENTRY * PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void* string); + +#define glStringMarkerGREMEDY GLEW_GET_FUN(__glewStringMarkerGREMEDY) + +#define GLEW_GREMEDY_string_marker GLEW_GET_VAR(__GLEW_GREMEDY_string_marker) + +#endif /* GL_GREMEDY_string_marker */ + +/* --------------------- GL_HP_convolution_border_modes -------------------- */ + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 + +#define GLEW_HP_convolution_border_modes GLEW_GET_VAR(__GLEW_HP_convolution_border_modes) + +#endif /* GL_HP_convolution_border_modes */ + +/* ------------------------- GL_HP_image_transform ------------------------- */ + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 + +typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint* params); + +#define glGetImageTransformParameterfvHP GLEW_GET_FUN(__glewGetImageTransformParameterfvHP) +#define glGetImageTransformParameterivHP GLEW_GET_FUN(__glewGetImageTransformParameterivHP) +#define glImageTransformParameterfHP GLEW_GET_FUN(__glewImageTransformParameterfHP) +#define glImageTransformParameterfvHP GLEW_GET_FUN(__glewImageTransformParameterfvHP) +#define glImageTransformParameteriHP GLEW_GET_FUN(__glewImageTransformParameteriHP) +#define glImageTransformParameterivHP GLEW_GET_FUN(__glewImageTransformParameterivHP) + +#define GLEW_HP_image_transform GLEW_GET_VAR(__GLEW_HP_image_transform) + +#endif /* GL_HP_image_transform */ + +/* -------------------------- GL_HP_occlusion_test ------------------------- */ + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 + +#define GLEW_HP_occlusion_test GLEW_GET_VAR(__GLEW_HP_occlusion_test) + +#endif /* GL_HP_occlusion_test */ + +/* ------------------------- GL_HP_texture_lighting ------------------------ */ + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 + +#define GLEW_HP_texture_lighting GLEW_GET_VAR(__GLEW_HP_texture_lighting) + +#endif /* GL_HP_texture_lighting */ + +/* --------------------------- GL_IBM_cull_vertex -------------------------- */ + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 + +#define GL_CULL_VERTEX_IBM 103050 + +#define GLEW_IBM_cull_vertex GLEW_GET_VAR(__GLEW_IBM_cull_vertex) + +#endif /* GL_IBM_cull_vertex */ + +/* ---------------------- GL_IBM_multimode_draw_arrays --------------------- */ + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 + +typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum* mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (GLAPIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum* mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride); + +#define glMultiModeDrawArraysIBM GLEW_GET_FUN(__glewMultiModeDrawArraysIBM) +#define glMultiModeDrawElementsIBM GLEW_GET_FUN(__glewMultiModeDrawElementsIBM) + +#define GLEW_IBM_multimode_draw_arrays GLEW_GET_VAR(__GLEW_IBM_multimode_draw_arrays) + +#endif /* GL_IBM_multimode_draw_arrays */ + +/* ------------------------- GL_IBM_rasterpos_clip ------------------------- */ + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 + +#define GL_RASTER_POSITION_UNCLIPPED_IBM 103010 + +#define GLEW_IBM_rasterpos_clip GLEW_GET_VAR(__GLEW_IBM_rasterpos_clip) + +#endif /* GL_IBM_rasterpos_clip */ + +/* --------------------------- GL_IBM_static_data -------------------------- */ + +#ifndef GL_IBM_static_data +#define GL_IBM_static_data 1 + +#define GL_ALL_STATIC_DATA_IBM 103060 +#define GL_STATIC_VERTEX_ARRAY_IBM 103061 + +#define GLEW_IBM_static_data GLEW_GET_VAR(__GLEW_IBM_static_data) + +#endif /* GL_IBM_static_data */ + +/* --------------------- GL_IBM_texture_mirrored_repeat -------------------- */ + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_IBM_texture_mirrored_repeat 1 + +#define GL_MIRRORED_REPEAT_IBM 0x8370 + +#define GLEW_IBM_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_IBM_texture_mirrored_repeat) + +#endif /* GL_IBM_texture_mirrored_repeat */ + +/* ----------------------- GL_IBM_vertex_array_lists ----------------------- */ + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 + +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 + +typedef void (GLAPIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); +typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid ** pointer, GLint ptrstride); + +#define glColorPointerListIBM GLEW_GET_FUN(__glewColorPointerListIBM) +#define glEdgeFlagPointerListIBM GLEW_GET_FUN(__glewEdgeFlagPointerListIBM) +#define glFogCoordPointerListIBM GLEW_GET_FUN(__glewFogCoordPointerListIBM) +#define glIndexPointerListIBM GLEW_GET_FUN(__glewIndexPointerListIBM) +#define glNormalPointerListIBM GLEW_GET_FUN(__glewNormalPointerListIBM) +#define glSecondaryColorPointerListIBM GLEW_GET_FUN(__glewSecondaryColorPointerListIBM) +#define glTexCoordPointerListIBM GLEW_GET_FUN(__glewTexCoordPointerListIBM) +#define glVertexPointerListIBM GLEW_GET_FUN(__glewVertexPointerListIBM) + +#define GLEW_IBM_vertex_array_lists GLEW_GET_VAR(__GLEW_IBM_vertex_array_lists) + +#endif /* GL_IBM_vertex_array_lists */ + +/* -------------------------- GL_INGR_color_clamp -------------------------- */ + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 + +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 + +#define GLEW_INGR_color_clamp GLEW_GET_VAR(__GLEW_INGR_color_clamp) + +#endif /* GL_INGR_color_clamp */ + +/* ------------------------- GL_INGR_interlace_read ------------------------ */ + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 + +#define GL_INTERLACE_READ_INGR 0x8568 + +#define GLEW_INGR_interlace_read GLEW_GET_VAR(__GLEW_INGR_interlace_read) + +#endif /* GL_INGR_interlace_read */ + +/* ------------------------ GL_INTEL_parallel_arrays ----------------------- */ + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 + +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 + +typedef void (GLAPIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); +typedef void (GLAPIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer); +typedef void (GLAPIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); + +#define glColorPointervINTEL GLEW_GET_FUN(__glewColorPointervINTEL) +#define glNormalPointervINTEL GLEW_GET_FUN(__glewNormalPointervINTEL) +#define glTexCoordPointervINTEL GLEW_GET_FUN(__glewTexCoordPointervINTEL) +#define glVertexPointervINTEL GLEW_GET_FUN(__glewVertexPointervINTEL) + +#define GLEW_INTEL_parallel_arrays GLEW_GET_VAR(__GLEW_INTEL_parallel_arrays) + +#endif /* GL_INTEL_parallel_arrays */ + +/* ------------------------ GL_INTEL_texture_scissor ----------------------- */ + +#ifndef GL_INTEL_texture_scissor +#define GL_INTEL_texture_scissor 1 + +typedef void (GLAPIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc); +typedef void (GLAPIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh); + +#define glTexScissorFuncINTEL GLEW_GET_FUN(__glewTexScissorFuncINTEL) +#define glTexScissorINTEL GLEW_GET_FUN(__glewTexScissorINTEL) + +#define GLEW_INTEL_texture_scissor GLEW_GET_VAR(__GLEW_INTEL_texture_scissor) + +#endif /* GL_INTEL_texture_scissor */ + +/* -------------------------- GL_KTX_buffer_region ------------------------- */ + +#ifndef GL_KTX_buffer_region +#define GL_KTX_buffer_region 1 + +#define GL_KTX_FRONT_REGION 0x0 +#define GL_KTX_BACK_REGION 0x1 +#define GL_KTX_Z_REGION 0x2 +#define GL_KTX_STENCIL_REGION 0x3 + +typedef GLuint (GLAPIENTRY * PFNGLBUFFERREGIONENABLEDEXTPROC) (void); +typedef void (GLAPIENTRY * PFNGLDELETEBUFFERREGIONEXTPROC) (GLenum region); +typedef void (GLAPIENTRY * PFNGLDRAWBUFFERREGIONEXTPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height, GLint xDest, GLint yDest); +typedef GLuint (GLAPIENTRY * PFNGLNEWBUFFERREGIONEXTPROC) (GLenum region); +typedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONEXTPROC) (GLuint region, GLint x, GLint y, GLsizei width, GLsizei height); + +#define glBufferRegionEnabledEXT GLEW_GET_FUN(__glewBufferRegionEnabledEXT) +#define glDeleteBufferRegionEXT GLEW_GET_FUN(__glewDeleteBufferRegionEXT) +#define glDrawBufferRegionEXT GLEW_GET_FUN(__glewDrawBufferRegionEXT) +#define glNewBufferRegionEXT GLEW_GET_FUN(__glewNewBufferRegionEXT) +#define glReadBufferRegionEXT GLEW_GET_FUN(__glewReadBufferRegionEXT) + +#define GLEW_KTX_buffer_region GLEW_GET_VAR(__GLEW_KTX_buffer_region) + +#endif /* GL_KTX_buffer_region */ + +/* ------------------------- GL_MESAX_texture_stack ------------------------ */ + +#ifndef GL_MESAX_texture_stack +#define GL_MESAX_texture_stack 1 + +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E + +#define GLEW_MESAX_texture_stack GLEW_GET_VAR(__GLEW_MESAX_texture_stack) + +#endif /* GL_MESAX_texture_stack */ + +/* -------------------------- GL_MESA_pack_invert -------------------------- */ + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 + +#define GL_PACK_INVERT_MESA 0x8758 + +#define GLEW_MESA_pack_invert GLEW_GET_VAR(__GLEW_MESA_pack_invert) + +#endif /* GL_MESA_pack_invert */ + +/* ------------------------- GL_MESA_resize_buffers ------------------------ */ + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 + +typedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); + +#define glResizeBuffersMESA GLEW_GET_FUN(__glewResizeBuffersMESA) + +#define GLEW_MESA_resize_buffers GLEW_GET_VAR(__GLEW_MESA_resize_buffers) + +#endif /* GL_MESA_resize_buffers */ + +/* --------------------------- GL_MESA_window_pos -------------------------- */ + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 + +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint* p); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort* p); + +#define glWindowPos2dMESA GLEW_GET_FUN(__glewWindowPos2dMESA) +#define glWindowPos2dvMESA GLEW_GET_FUN(__glewWindowPos2dvMESA) +#define glWindowPos2fMESA GLEW_GET_FUN(__glewWindowPos2fMESA) +#define glWindowPos2fvMESA GLEW_GET_FUN(__glewWindowPos2fvMESA) +#define glWindowPos2iMESA GLEW_GET_FUN(__glewWindowPos2iMESA) +#define glWindowPos2ivMESA GLEW_GET_FUN(__glewWindowPos2ivMESA) +#define glWindowPos2sMESA GLEW_GET_FUN(__glewWindowPos2sMESA) +#define glWindowPos2svMESA GLEW_GET_FUN(__glewWindowPos2svMESA) +#define glWindowPos3dMESA GLEW_GET_FUN(__glewWindowPos3dMESA) +#define glWindowPos3dvMESA GLEW_GET_FUN(__glewWindowPos3dvMESA) +#define glWindowPos3fMESA GLEW_GET_FUN(__glewWindowPos3fMESA) +#define glWindowPos3fvMESA GLEW_GET_FUN(__glewWindowPos3fvMESA) +#define glWindowPos3iMESA GLEW_GET_FUN(__glewWindowPos3iMESA) +#define glWindowPos3ivMESA GLEW_GET_FUN(__glewWindowPos3ivMESA) +#define glWindowPos3sMESA GLEW_GET_FUN(__glewWindowPos3sMESA) +#define glWindowPos3svMESA GLEW_GET_FUN(__glewWindowPos3svMESA) +#define glWindowPos4dMESA GLEW_GET_FUN(__glewWindowPos4dMESA) +#define glWindowPos4dvMESA GLEW_GET_FUN(__glewWindowPos4dvMESA) +#define glWindowPos4fMESA GLEW_GET_FUN(__glewWindowPos4fMESA) +#define glWindowPos4fvMESA GLEW_GET_FUN(__glewWindowPos4fvMESA) +#define glWindowPos4iMESA GLEW_GET_FUN(__glewWindowPos4iMESA) +#define glWindowPos4ivMESA GLEW_GET_FUN(__glewWindowPos4ivMESA) +#define glWindowPos4sMESA GLEW_GET_FUN(__glewWindowPos4sMESA) +#define glWindowPos4svMESA GLEW_GET_FUN(__glewWindowPos4svMESA) + +#define GLEW_MESA_window_pos GLEW_GET_VAR(__GLEW_MESA_window_pos) + +#endif /* GL_MESA_window_pos */ + +/* ------------------------- GL_MESA_ycbcr_texture ------------------------- */ + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 + +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 + +#define GLEW_MESA_ycbcr_texture GLEW_GET_VAR(__GLEW_MESA_ycbcr_texture) + +#endif /* GL_MESA_ycbcr_texture */ + +/* --------------------------- GL_NV_blend_square -------------------------- */ + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 + +#define GLEW_NV_blend_square GLEW_GET_VAR(__GLEW_NV_blend_square) + +#endif /* GL_NV_blend_square */ + +/* ----------------------- GL_NV_copy_depth_to_color ----------------------- */ + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 + +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F + +#define GLEW_NV_copy_depth_to_color GLEW_GET_VAR(__GLEW_NV_copy_depth_to_color) + +#endif /* GL_NV_copy_depth_to_color */ + +/* --------------------------- GL_NV_depth_clamp --------------------------- */ + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 + +#define GL_DEPTH_CLAMP_NV 0x864F + +#define GLEW_NV_depth_clamp GLEW_GET_VAR(__GLEW_NV_depth_clamp) + +#endif /* GL_NV_depth_clamp */ + +/* ---------------------------- GL_NV_evaluators --------------------------- */ + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 + +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 + +typedef void (GLAPIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void* points); +typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void* points); +typedef void (GLAPIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint* params); + +#define glEvalMapsNV GLEW_GET_FUN(__glewEvalMapsNV) +#define glGetMapAttribParameterfvNV GLEW_GET_FUN(__glewGetMapAttribParameterfvNV) +#define glGetMapAttribParameterivNV GLEW_GET_FUN(__glewGetMapAttribParameterivNV) +#define glGetMapControlPointsNV GLEW_GET_FUN(__glewGetMapControlPointsNV) +#define glGetMapParameterfvNV GLEW_GET_FUN(__glewGetMapParameterfvNV) +#define glGetMapParameterivNV GLEW_GET_FUN(__glewGetMapParameterivNV) +#define glMapControlPointsNV GLEW_GET_FUN(__glewMapControlPointsNV) +#define glMapParameterfvNV GLEW_GET_FUN(__glewMapParameterfvNV) +#define glMapParameterivNV GLEW_GET_FUN(__glewMapParameterivNV) + +#define GLEW_NV_evaluators GLEW_GET_VAR(__GLEW_NV_evaluators) + +#endif /* GL_NV_evaluators */ + +/* ------------------------------ GL_NV_fence ------------------------------ */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 + +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 + +typedef void (GLAPIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint* fences); +typedef void (GLAPIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint* fences); +typedef void (GLAPIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISFENCENVPROC) (GLuint fence); +typedef void (GLAPIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +typedef GLboolean (GLAPIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence); + +#define glDeleteFencesNV GLEW_GET_FUN(__glewDeleteFencesNV) +#define glFinishFenceNV GLEW_GET_FUN(__glewFinishFenceNV) +#define glGenFencesNV GLEW_GET_FUN(__glewGenFencesNV) +#define glGetFenceivNV GLEW_GET_FUN(__glewGetFenceivNV) +#define glIsFenceNV GLEW_GET_FUN(__glewIsFenceNV) +#define glSetFenceNV GLEW_GET_FUN(__glewSetFenceNV) +#define glTestFenceNV GLEW_GET_FUN(__glewTestFenceNV) + +#define GLEW_NV_fence GLEW_GET_VAR(__GLEW_NV_fence) + +#endif /* GL_NV_fence */ + +/* --------------------------- GL_NV_float_buffer -------------------------- */ + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 + +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E + +#define GLEW_NV_float_buffer GLEW_GET_VAR(__GLEW_NV_float_buffer) + +#endif /* GL_NV_float_buffer */ + +/* --------------------------- GL_NV_fog_distance -------------------------- */ + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 + +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C + +#define GLEW_NV_fog_distance GLEW_GET_VAR(__GLEW_NV_fog_distance) + +#endif /* GL_NV_fog_distance */ + +/* ------------------------- GL_NV_fragment_program ------------------------ */ + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 + +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 + +typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble *params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat *params); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLdouble v[]); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte* name, const GLfloat v[]); + +#define glGetProgramNamedParameterdvNV GLEW_GET_FUN(__glewGetProgramNamedParameterdvNV) +#define glGetProgramNamedParameterfvNV GLEW_GET_FUN(__glewGetProgramNamedParameterfvNV) +#define glProgramNamedParameter4dNV GLEW_GET_FUN(__glewProgramNamedParameter4dNV) +#define glProgramNamedParameter4dvNV GLEW_GET_FUN(__glewProgramNamedParameter4dvNV) +#define glProgramNamedParameter4fNV GLEW_GET_FUN(__glewProgramNamedParameter4fNV) +#define glProgramNamedParameter4fvNV GLEW_GET_FUN(__glewProgramNamedParameter4fvNV) + +#define GLEW_NV_fragment_program GLEW_GET_VAR(__GLEW_NV_fragment_program) + +#endif /* GL_NV_fragment_program */ + +/* ------------------------ GL_NV_fragment_program2 ------------------------ */ + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 + +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 + +#define GLEW_NV_fragment_program2 GLEW_GET_VAR(__GLEW_NV_fragment_program2) + +#endif /* GL_NV_fragment_program2 */ + +/* --------------------- GL_NV_fragment_program_option --------------------- */ + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 + +#define GLEW_NV_fragment_program_option GLEW_GET_VAR(__GLEW_NV_fragment_program_option) + +#endif /* GL_NV_fragment_program_option */ + +/* ---------------------------- GL_NV_half_float --------------------------- */ + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 + +#define GL_HALF_FLOAT_NV 0x140B + +typedef unsigned short GLhalf; + +typedef void (GLAPIENTRY * PFNGLCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue); +typedef void (GLAPIENTRY * PFNGLCOLOR3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLCOLOR4HNVPROC) (GLhalf red, GLhalf green, GLhalf blue, GLhalf alpha); +typedef void (GLAPIENTRY * PFNGLCOLOR4HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLFOGCOORDHNVPROC) (GLhalf fog); +typedef void (GLAPIENTRY * PFNGLFOGCOORDHVNVPROC) (const GLhalf* fog); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalf s); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalf s, GLhalf t); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalf s, GLhalf t, GLhalf r, GLhalf q); +typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLNORMAL3HNVPROC) (GLhalf nx, GLhalf ny, GLhalf nz); +typedef void (GLAPIENTRY * PFNGLNORMAL3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HNVPROC) (GLhalf red, GLhalf green, GLhalf blue); +typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD1HNVPROC) (GLhalf s); +typedef void (GLAPIENTRY * PFNGLTEXCOORD1HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2HNVPROC) (GLhalf s, GLhalf t); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD3HNVPROC) (GLhalf s, GLhalf t, GLhalf r); +typedef void (GLAPIENTRY * PFNGLTEXCOORD3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4HNVPROC) (GLhalf s, GLhalf t, GLhalf r, GLhalf q); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEX2HNVPROC) (GLhalf x, GLhalf y); +typedef void (GLAPIENTRY * PFNGLVERTEX2HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEX3HNVPROC) (GLhalf x, GLhalf y, GLhalf z); +typedef void (GLAPIENTRY * PFNGLVERTEX3HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEX4HNVPROC) (GLhalf x, GLhalf y, GLhalf z, GLhalf w); +typedef void (GLAPIENTRY * PFNGLVERTEX4HVNVPROC) (const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalf x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalf x, GLhalf y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalf x, GLhalf y, GLhalf z, GLhalf w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalf* v); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHNVPROC) (GLhalf weight); +typedef void (GLAPIENTRY * PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalf* weight); + +#define glColor3hNV GLEW_GET_FUN(__glewColor3hNV) +#define glColor3hvNV GLEW_GET_FUN(__glewColor3hvNV) +#define glColor4hNV GLEW_GET_FUN(__glewColor4hNV) +#define glColor4hvNV GLEW_GET_FUN(__glewColor4hvNV) +#define glFogCoordhNV GLEW_GET_FUN(__glewFogCoordhNV) +#define glFogCoordhvNV GLEW_GET_FUN(__glewFogCoordhvNV) +#define glMultiTexCoord1hNV GLEW_GET_FUN(__glewMultiTexCoord1hNV) +#define glMultiTexCoord1hvNV GLEW_GET_FUN(__glewMultiTexCoord1hvNV) +#define glMultiTexCoord2hNV GLEW_GET_FUN(__glewMultiTexCoord2hNV) +#define glMultiTexCoord2hvNV GLEW_GET_FUN(__glewMultiTexCoord2hvNV) +#define glMultiTexCoord3hNV GLEW_GET_FUN(__glewMultiTexCoord3hNV) +#define glMultiTexCoord3hvNV GLEW_GET_FUN(__glewMultiTexCoord3hvNV) +#define glMultiTexCoord4hNV GLEW_GET_FUN(__glewMultiTexCoord4hNV) +#define glMultiTexCoord4hvNV GLEW_GET_FUN(__glewMultiTexCoord4hvNV) +#define glNormal3hNV GLEW_GET_FUN(__glewNormal3hNV) +#define glNormal3hvNV GLEW_GET_FUN(__glewNormal3hvNV) +#define glSecondaryColor3hNV GLEW_GET_FUN(__glewSecondaryColor3hNV) +#define glSecondaryColor3hvNV GLEW_GET_FUN(__glewSecondaryColor3hvNV) +#define glTexCoord1hNV GLEW_GET_FUN(__glewTexCoord1hNV) +#define glTexCoord1hvNV GLEW_GET_FUN(__glewTexCoord1hvNV) +#define glTexCoord2hNV GLEW_GET_FUN(__glewTexCoord2hNV) +#define glTexCoord2hvNV GLEW_GET_FUN(__glewTexCoord2hvNV) +#define glTexCoord3hNV GLEW_GET_FUN(__glewTexCoord3hNV) +#define glTexCoord3hvNV GLEW_GET_FUN(__glewTexCoord3hvNV) +#define glTexCoord4hNV GLEW_GET_FUN(__glewTexCoord4hNV) +#define glTexCoord4hvNV GLEW_GET_FUN(__glewTexCoord4hvNV) +#define glVertex2hNV GLEW_GET_FUN(__glewVertex2hNV) +#define glVertex2hvNV GLEW_GET_FUN(__glewVertex2hvNV) +#define glVertex3hNV GLEW_GET_FUN(__glewVertex3hNV) +#define glVertex3hvNV GLEW_GET_FUN(__glewVertex3hvNV) +#define glVertex4hNV GLEW_GET_FUN(__glewVertex4hNV) +#define glVertex4hvNV GLEW_GET_FUN(__glewVertex4hvNV) +#define glVertexAttrib1hNV GLEW_GET_FUN(__glewVertexAttrib1hNV) +#define glVertexAttrib1hvNV GLEW_GET_FUN(__glewVertexAttrib1hvNV) +#define glVertexAttrib2hNV GLEW_GET_FUN(__glewVertexAttrib2hNV) +#define glVertexAttrib2hvNV GLEW_GET_FUN(__glewVertexAttrib2hvNV) +#define glVertexAttrib3hNV GLEW_GET_FUN(__glewVertexAttrib3hNV) +#define glVertexAttrib3hvNV GLEW_GET_FUN(__glewVertexAttrib3hvNV) +#define glVertexAttrib4hNV GLEW_GET_FUN(__glewVertexAttrib4hNV) +#define glVertexAttrib4hvNV GLEW_GET_FUN(__glewVertexAttrib4hvNV) +#define glVertexAttribs1hvNV GLEW_GET_FUN(__glewVertexAttribs1hvNV) +#define glVertexAttribs2hvNV GLEW_GET_FUN(__glewVertexAttribs2hvNV) +#define glVertexAttribs3hvNV GLEW_GET_FUN(__glewVertexAttribs3hvNV) +#define glVertexAttribs4hvNV GLEW_GET_FUN(__glewVertexAttribs4hvNV) +#define glVertexWeighthNV GLEW_GET_FUN(__glewVertexWeighthNV) +#define glVertexWeighthvNV GLEW_GET_FUN(__glewVertexWeighthvNV) + +#define GLEW_NV_half_float GLEW_GET_VAR(__GLEW_NV_half_float) + +#endif /* GL_NV_half_float */ + +/* ------------------------ GL_NV_light_max_exponent ----------------------- */ + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 + +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 + +#define GLEW_NV_light_max_exponent GLEW_GET_VAR(__GLEW_NV_light_max_exponent) + +#endif /* GL_NV_light_max_exponent */ + +/* --------------------- GL_NV_multisample_filter_hint --------------------- */ + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 + +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 + +#define GLEW_NV_multisample_filter_hint GLEW_GET_VAR(__GLEW_NV_multisample_filter_hint) + +#endif /* GL_NV_multisample_filter_hint */ + +/* ------------------------- GL_NV_occlusion_query ------------------------- */ + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 + +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 + +typedef void (GLAPIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (GLAPIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); + +#define glBeginOcclusionQueryNV GLEW_GET_FUN(__glewBeginOcclusionQueryNV) +#define glDeleteOcclusionQueriesNV GLEW_GET_FUN(__glewDeleteOcclusionQueriesNV) +#define glEndOcclusionQueryNV GLEW_GET_FUN(__glewEndOcclusionQueryNV) +#define glGenOcclusionQueriesNV GLEW_GET_FUN(__glewGenOcclusionQueriesNV) +#define glGetOcclusionQueryivNV GLEW_GET_FUN(__glewGetOcclusionQueryivNV) +#define glGetOcclusionQueryuivNV GLEW_GET_FUN(__glewGetOcclusionQueryuivNV) +#define glIsOcclusionQueryNV GLEW_GET_FUN(__glewIsOcclusionQueryNV) + +#define GLEW_NV_occlusion_query GLEW_GET_VAR(__GLEW_NV_occlusion_query) + +#endif /* GL_NV_occlusion_query */ + +/* ----------------------- GL_NV_packed_depth_stencil ---------------------- */ + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA + +#define GLEW_NV_packed_depth_stencil GLEW_GET_VAR(__GLEW_NV_packed_depth_stencil) + +#endif /* GL_NV_packed_depth_stencil */ + +/* ------------------------- GL_NV_pixel_data_range ------------------------ */ + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 + +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D + +typedef void (GLAPIENTRY * PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, void* pointer); + +#define glFlushPixelDataRangeNV GLEW_GET_FUN(__glewFlushPixelDataRangeNV) +#define glPixelDataRangeNV GLEW_GET_FUN(__glewPixelDataRangeNV) + +#define GLEW_NV_pixel_data_range GLEW_GET_VAR(__GLEW_NV_pixel_data_range) + +#endif /* GL_NV_pixel_data_range */ + +/* --------------------------- GL_NV_point_sprite -------------------------- */ + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 + +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 + +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint* params); + +#define glPointParameteriNV GLEW_GET_FUN(__glewPointParameteriNV) +#define glPointParameterivNV GLEW_GET_FUN(__glewPointParameterivNV) + +#define GLEW_NV_point_sprite GLEW_GET_VAR(__GLEW_NV_point_sprite) + +#endif /* GL_NV_point_sprite */ + +/* ------------------------ GL_NV_primitive_restart ------------------------ */ + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 + +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 + +typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void); + +#define glPrimitiveRestartIndexNV GLEW_GET_FUN(__glewPrimitiveRestartIndexNV) +#define glPrimitiveRestartNV GLEW_GET_FUN(__glewPrimitiveRestartNV) + +#define GLEW_NV_primitive_restart GLEW_GET_VAR(__GLEW_NV_primitive_restart) + +#endif /* GL_NV_primitive_restart */ + +/* ------------------------ GL_NV_register_combiners ----------------------- */ + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 + +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 + +typedef void (GLAPIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (GLAPIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint* params); + +#define glCombinerInputNV GLEW_GET_FUN(__glewCombinerInputNV) +#define glCombinerOutputNV GLEW_GET_FUN(__glewCombinerOutputNV) +#define glCombinerParameterfNV GLEW_GET_FUN(__glewCombinerParameterfNV) +#define glCombinerParameterfvNV GLEW_GET_FUN(__glewCombinerParameterfvNV) +#define glCombinerParameteriNV GLEW_GET_FUN(__glewCombinerParameteriNV) +#define glCombinerParameterivNV GLEW_GET_FUN(__glewCombinerParameterivNV) +#define glFinalCombinerInputNV GLEW_GET_FUN(__glewFinalCombinerInputNV) +#define glGetCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetCombinerInputParameterfvNV) +#define glGetCombinerInputParameterivNV GLEW_GET_FUN(__glewGetCombinerInputParameterivNV) +#define glGetCombinerOutputParameterfvNV GLEW_GET_FUN(__glewGetCombinerOutputParameterfvNV) +#define glGetCombinerOutputParameterivNV GLEW_GET_FUN(__glewGetCombinerOutputParameterivNV) +#define glGetFinalCombinerInputParameterfvNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterfvNV) +#define glGetFinalCombinerInputParameterivNV GLEW_GET_FUN(__glewGetFinalCombinerInputParameterivNV) + +#define GLEW_NV_register_combiners GLEW_GET_VAR(__GLEW_NV_register_combiners) + +#endif /* GL_NV_register_combiners */ + +/* ----------------------- GL_NV_register_combiners2 ----------------------- */ + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 + +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 + +typedef void (GLAPIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat* params); + +#define glCombinerStageParameterfvNV GLEW_GET_FUN(__glewCombinerStageParameterfvNV) +#define glGetCombinerStageParameterfvNV GLEW_GET_FUN(__glewGetCombinerStageParameterfvNV) + +#define GLEW_NV_register_combiners2 GLEW_GET_VAR(__GLEW_NV_register_combiners2) + +#endif /* GL_NV_register_combiners2 */ + +/* -------------------------- GL_NV_texgen_emboss -------------------------- */ + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 + +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F + +#define GLEW_NV_texgen_emboss GLEW_GET_VAR(__GLEW_NV_texgen_emboss) + +#endif /* GL_NV_texgen_emboss */ + +/* ------------------------ GL_NV_texgen_reflection ------------------------ */ + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 + +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 + +#define GLEW_NV_texgen_reflection GLEW_GET_VAR(__GLEW_NV_texgen_reflection) + +#endif /* GL_NV_texgen_reflection */ + +/* --------------------- GL_NV_texture_compression_vtc --------------------- */ + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 + +#define GLEW_NV_texture_compression_vtc GLEW_GET_VAR(__GLEW_NV_texture_compression_vtc) + +#endif /* GL_NV_texture_compression_vtc */ + +/* ----------------------- GL_NV_texture_env_combine4 ---------------------- */ + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 + +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B + +#define GLEW_NV_texture_env_combine4 GLEW_GET_VAR(__GLEW_NV_texture_env_combine4) + +#endif /* GL_NV_texture_env_combine4 */ + +/* ---------------------- GL_NV_texture_expand_normal ---------------------- */ + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 + +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F + +#define GLEW_NV_texture_expand_normal GLEW_GET_VAR(__GLEW_NV_texture_expand_normal) + +#endif /* GL_NV_texture_expand_normal */ + +/* ------------------------ GL_NV_texture_rectangle ------------------------ */ + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 + +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 + +#define GLEW_NV_texture_rectangle GLEW_GET_VAR(__GLEW_NV_texture_rectangle) + +#endif /* GL_NV_texture_rectangle */ + +/* -------------------------- GL_NV_texture_shader ------------------------- */ + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 + +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F + +#define GLEW_NV_texture_shader GLEW_GET_VAR(__GLEW_NV_texture_shader) + +#endif /* GL_NV_texture_shader */ + +/* ------------------------- GL_NV_texture_shader2 ------------------------- */ + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 + +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D + +#define GLEW_NV_texture_shader2 GLEW_GET_VAR(__GLEW_NV_texture_shader2) + +#endif /* GL_NV_texture_shader2 */ + +/* ------------------------- GL_NV_texture_shader3 ------------------------- */ + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 + +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 + +#define GLEW_NV_texture_shader3 GLEW_GET_VAR(__GLEW_NV_texture_shader3) + +#endif /* GL_NV_texture_shader3 */ + +/* ------------------------ GL_NV_vertex_array_range ----------------------- */ + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 + +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 + +typedef void (GLAPIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (GLAPIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, void* pointer); + +#define glFlushVertexArrayRangeNV GLEW_GET_FUN(__glewFlushVertexArrayRangeNV) +#define glVertexArrayRangeNV GLEW_GET_FUN(__glewVertexArrayRangeNV) + +#define GLEW_NV_vertex_array_range GLEW_GET_VAR(__GLEW_NV_vertex_array_range) + +#endif /* GL_NV_vertex_array_range */ + +/* ----------------------- GL_NV_vertex_array_range2 ----------------------- */ + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 + +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 + +#define GLEW_NV_vertex_array_range2 GLEW_GET_VAR(__GLEW_NV_vertex_array_range2) + +#endif /* GL_NV_vertex_array_range2 */ + +/* -------------------------- GL_NV_vertex_program ------------------------- */ + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 + +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F + +typedef GLboolean (GLAPIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint* ids, GLboolean *residences); +typedef void (GLAPIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte* program); +typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid** pointer); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte* program); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint num, const GLdouble* params); +typedef void (GLAPIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint num, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei n, const GLdouble* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei n, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei n, const GLshort* v); +typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei n, const GLubyte* v); + +#define glAreProgramsResidentNV GLEW_GET_FUN(__glewAreProgramsResidentNV) +#define glBindProgramNV GLEW_GET_FUN(__glewBindProgramNV) +#define glDeleteProgramsNV GLEW_GET_FUN(__glewDeleteProgramsNV) +#define glExecuteProgramNV GLEW_GET_FUN(__glewExecuteProgramNV) +#define glGenProgramsNV GLEW_GET_FUN(__glewGenProgramsNV) +#define glGetProgramParameterdvNV GLEW_GET_FUN(__glewGetProgramParameterdvNV) +#define glGetProgramParameterfvNV GLEW_GET_FUN(__glewGetProgramParameterfvNV) +#define glGetProgramStringNV GLEW_GET_FUN(__glewGetProgramStringNV) +#define glGetProgramivNV GLEW_GET_FUN(__glewGetProgramivNV) +#define glGetTrackMatrixivNV GLEW_GET_FUN(__glewGetTrackMatrixivNV) +#define glGetVertexAttribPointervNV GLEW_GET_FUN(__glewGetVertexAttribPointervNV) +#define glGetVertexAttribdvNV GLEW_GET_FUN(__glewGetVertexAttribdvNV) +#define glGetVertexAttribfvNV GLEW_GET_FUN(__glewGetVertexAttribfvNV) +#define glGetVertexAttribivNV GLEW_GET_FUN(__glewGetVertexAttribivNV) +#define glIsProgramNV GLEW_GET_FUN(__glewIsProgramNV) +#define glLoadProgramNV GLEW_GET_FUN(__glewLoadProgramNV) +#define glProgramParameter4dNV GLEW_GET_FUN(__glewProgramParameter4dNV) +#define glProgramParameter4dvNV GLEW_GET_FUN(__glewProgramParameter4dvNV) +#define glProgramParameter4fNV GLEW_GET_FUN(__glewProgramParameter4fNV) +#define glProgramParameter4fvNV GLEW_GET_FUN(__glewProgramParameter4fvNV) +#define glProgramParameters4dvNV GLEW_GET_FUN(__glewProgramParameters4dvNV) +#define glProgramParameters4fvNV GLEW_GET_FUN(__glewProgramParameters4fvNV) +#define glRequestResidentProgramsNV GLEW_GET_FUN(__glewRequestResidentProgramsNV) +#define glTrackMatrixNV GLEW_GET_FUN(__glewTrackMatrixNV) +#define glVertexAttrib1dNV GLEW_GET_FUN(__glewVertexAttrib1dNV) +#define glVertexAttrib1dvNV GLEW_GET_FUN(__glewVertexAttrib1dvNV) +#define glVertexAttrib1fNV GLEW_GET_FUN(__glewVertexAttrib1fNV) +#define glVertexAttrib1fvNV GLEW_GET_FUN(__glewVertexAttrib1fvNV) +#define glVertexAttrib1sNV GLEW_GET_FUN(__glewVertexAttrib1sNV) +#define glVertexAttrib1svNV GLEW_GET_FUN(__glewVertexAttrib1svNV) +#define glVertexAttrib2dNV GLEW_GET_FUN(__glewVertexAttrib2dNV) +#define glVertexAttrib2dvNV GLEW_GET_FUN(__glewVertexAttrib2dvNV) +#define glVertexAttrib2fNV GLEW_GET_FUN(__glewVertexAttrib2fNV) +#define glVertexAttrib2fvNV GLEW_GET_FUN(__glewVertexAttrib2fvNV) +#define glVertexAttrib2sNV GLEW_GET_FUN(__glewVertexAttrib2sNV) +#define glVertexAttrib2svNV GLEW_GET_FUN(__glewVertexAttrib2svNV) +#define glVertexAttrib3dNV GLEW_GET_FUN(__glewVertexAttrib3dNV) +#define glVertexAttrib3dvNV GLEW_GET_FUN(__glewVertexAttrib3dvNV) +#define glVertexAttrib3fNV GLEW_GET_FUN(__glewVertexAttrib3fNV) +#define glVertexAttrib3fvNV GLEW_GET_FUN(__glewVertexAttrib3fvNV) +#define glVertexAttrib3sNV GLEW_GET_FUN(__glewVertexAttrib3sNV) +#define glVertexAttrib3svNV GLEW_GET_FUN(__glewVertexAttrib3svNV) +#define glVertexAttrib4dNV GLEW_GET_FUN(__glewVertexAttrib4dNV) +#define glVertexAttrib4dvNV GLEW_GET_FUN(__glewVertexAttrib4dvNV) +#define glVertexAttrib4fNV GLEW_GET_FUN(__glewVertexAttrib4fNV) +#define glVertexAttrib4fvNV GLEW_GET_FUN(__glewVertexAttrib4fvNV) +#define glVertexAttrib4sNV GLEW_GET_FUN(__glewVertexAttrib4sNV) +#define glVertexAttrib4svNV GLEW_GET_FUN(__glewVertexAttrib4svNV) +#define glVertexAttrib4ubNV GLEW_GET_FUN(__glewVertexAttrib4ubNV) +#define glVertexAttrib4ubvNV GLEW_GET_FUN(__glewVertexAttrib4ubvNV) +#define glVertexAttribPointerNV GLEW_GET_FUN(__glewVertexAttribPointerNV) +#define glVertexAttribs1dvNV GLEW_GET_FUN(__glewVertexAttribs1dvNV) +#define glVertexAttribs1fvNV GLEW_GET_FUN(__glewVertexAttribs1fvNV) +#define glVertexAttribs1svNV GLEW_GET_FUN(__glewVertexAttribs1svNV) +#define glVertexAttribs2dvNV GLEW_GET_FUN(__glewVertexAttribs2dvNV) +#define glVertexAttribs2fvNV GLEW_GET_FUN(__glewVertexAttribs2fvNV) +#define glVertexAttribs2svNV GLEW_GET_FUN(__glewVertexAttribs2svNV) +#define glVertexAttribs3dvNV GLEW_GET_FUN(__glewVertexAttribs3dvNV) +#define glVertexAttribs3fvNV GLEW_GET_FUN(__glewVertexAttribs3fvNV) +#define glVertexAttribs3svNV GLEW_GET_FUN(__glewVertexAttribs3svNV) +#define glVertexAttribs4dvNV GLEW_GET_FUN(__glewVertexAttribs4dvNV) +#define glVertexAttribs4fvNV GLEW_GET_FUN(__glewVertexAttribs4fvNV) +#define glVertexAttribs4svNV GLEW_GET_FUN(__glewVertexAttribs4svNV) +#define glVertexAttribs4ubvNV GLEW_GET_FUN(__glewVertexAttribs4ubvNV) + +#define GLEW_NV_vertex_program GLEW_GET_VAR(__GLEW_NV_vertex_program) + +#endif /* GL_NV_vertex_program */ + +/* ------------------------ GL_NV_vertex_program1_1 ------------------------ */ + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 + +#define GLEW_NV_vertex_program1_1 GLEW_GET_VAR(__GLEW_NV_vertex_program1_1) + +#endif /* GL_NV_vertex_program1_1 */ + +/* ------------------------- GL_NV_vertex_program2 ------------------------- */ + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 + +#define GLEW_NV_vertex_program2 GLEW_GET_VAR(__GLEW_NV_vertex_program2) + +#endif /* GL_NV_vertex_program2 */ + +/* ---------------------- GL_NV_vertex_program2_option --------------------- */ + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 + +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 + +#define GLEW_NV_vertex_program2_option GLEW_GET_VAR(__GLEW_NV_vertex_program2_option) + +#endif /* GL_NV_vertex_program2_option */ + +/* ------------------------- GL_NV_vertex_program3 ------------------------- */ + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 + +#define MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C + +#define GLEW_NV_vertex_program3 GLEW_GET_VAR(__GLEW_NV_vertex_program3) + +#endif /* GL_NV_vertex_program3 */ + +/* ---------------------------- GL_OML_interlace --------------------------- */ + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 + +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 + +#define GLEW_OML_interlace GLEW_GET_VAR(__GLEW_OML_interlace) + +#endif /* GL_OML_interlace */ + +/* ---------------------------- GL_OML_resample ---------------------------- */ + +#ifndef GL_OML_resample +#define GL_OML_resample 1 + +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 + +#define GLEW_OML_resample GLEW_GET_VAR(__GLEW_OML_resample) + +#endif /* GL_OML_resample */ + +/* ---------------------------- GL_OML_subsample --------------------------- */ + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 + +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 + +#define GLEW_OML_subsample GLEW_GET_VAR(__GLEW_OML_subsample) + +#endif /* GL_OML_subsample */ + +/* --------------------------- GL_PGI_misc_hints --------------------------- */ + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 + +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000 +#define GL_CONSERVE_MEMORY_HINT_PGI 107005 +#define GL_RECLAIM_MEMORY_HINT_PGI 107006 +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012 +#define GL_ALWAYS_FAST_HINT_PGI 107020 +#define GL_ALWAYS_SOFT_HINT_PGI 107021 +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022 +#define GL_ALLOW_DRAW_WIN_HINT_PGI 107023 +#define GL_ALLOW_DRAW_FRG_HINT_PGI 107024 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 107025 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 107030 +#define GL_STRICT_LIGHTING_HINT_PGI 107031 +#define GL_STRICT_SCISSOR_HINT_PGI 107032 +#define GL_FULL_STIPPLE_HINT_PGI 107033 +#define GL_CLIP_NEAR_HINT_PGI 107040 +#define GL_CLIP_FAR_HINT_PGI 107041 +#define GL_WIDE_LINE_HINT_PGI 107042 +#define GL_BACK_NORMALS_HINT_PGI 107043 + +#define GLEW_PGI_misc_hints GLEW_GET_VAR(__GLEW_PGI_misc_hints) + +#endif /* GL_PGI_misc_hints */ + +/* -------------------------- GL_PGI_vertex_hints -------------------------- */ + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 + +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_VERTEX_DATA_HINT_PGI 107050 +#define GL_VERTEX_CONSISTENT_HINT_PGI 107051 +#define GL_MATERIAL_SIDE_HINT_PGI 107052 +#define GL_MAX_VERTEX_HINT_PGI 107053 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 + +#define GLEW_PGI_vertex_hints GLEW_GET_VAR(__GLEW_PGI_vertex_hints) + +#endif /* GL_PGI_vertex_hints */ + +/* ----------------------- GL_REND_screen_coordinates ---------------------- */ + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 + +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 + +#define GLEW_REND_screen_coordinates GLEW_GET_VAR(__GLEW_REND_screen_coordinates) + +#endif /* GL_REND_screen_coordinates */ + +/* ------------------------------- GL_S3_s3tc ------------------------------ */ + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 + +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA4_DXT5_S3TC 0x83A5 + +#define GLEW_S3_s3tc GLEW_GET_VAR(__GLEW_S3_s3tc) + +#endif /* GL_S3_s3tc */ + +/* -------------------------- GL_SGIS_color_range -------------------------- */ + +#ifndef GL_SGIS_color_range +#define GL_SGIS_color_range 1 + +#define GL_EXTENDED_RANGE_SGIS 0x85A5 +#define GL_MIN_RED_SGIS 0x85A6 +#define GL_MAX_RED_SGIS 0x85A7 +#define GL_MIN_GREEN_SGIS 0x85A8 +#define GL_MAX_GREEN_SGIS 0x85A9 +#define GL_MIN_BLUE_SGIS 0x85AA +#define GL_MAX_BLUE_SGIS 0x85AB +#define GL_MIN_ALPHA_SGIS 0x85AC +#define GL_MAX_ALPHA_SGIS 0x85AD + +#define GLEW_SGIS_color_range GLEW_GET_VAR(__GLEW_SGIS_color_range) + +#endif /* GL_SGIS_color_range */ + +/* ------------------------- GL_SGIS_detail_texture ------------------------ */ + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 + +typedef void (GLAPIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points); +typedef void (GLAPIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat* points); + +#define glDetailTexFuncSGIS GLEW_GET_FUN(__glewDetailTexFuncSGIS) +#define glGetDetailTexFuncSGIS GLEW_GET_FUN(__glewGetDetailTexFuncSGIS) + +#define GLEW_SGIS_detail_texture GLEW_GET_VAR(__GLEW_SGIS_detail_texture) + +#endif /* GL_SGIS_detail_texture */ + +/* -------------------------- GL_SGIS_fog_function ------------------------- */ + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 + +typedef void (GLAPIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat* points); +typedef void (GLAPIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat* points); + +#define glFogFuncSGIS GLEW_GET_FUN(__glewFogFuncSGIS) +#define glGetFogFuncSGIS GLEW_GET_FUN(__glewGetFogFuncSGIS) + +#define GLEW_SGIS_fog_function GLEW_GET_VAR(__GLEW_SGIS_fog_function) + +#endif /* GL_SGIS_fog_function */ + +/* ------------------------ GL_SGIS_generate_mipmap ------------------------ */ + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 + +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 + +#define GLEW_SGIS_generate_mipmap GLEW_GET_VAR(__GLEW_SGIS_generate_mipmap) + +#endif /* GL_SGIS_generate_mipmap */ + +/* -------------------------- GL_SGIS_multisample -------------------------- */ + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 + +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 + +typedef void (GLAPIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (GLAPIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); + +#define glSampleMaskSGIS GLEW_GET_FUN(__glewSampleMaskSGIS) +#define glSamplePatternSGIS GLEW_GET_FUN(__glewSamplePatternSGIS) + +#define GLEW_SGIS_multisample GLEW_GET_VAR(__GLEW_SGIS_multisample) + +#endif /* GL_SGIS_multisample */ + +/* ------------------------- GL_SGIS_pixel_texture ------------------------- */ + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 + +#define GLEW_SGIS_pixel_texture GLEW_GET_VAR(__GLEW_SGIS_pixel_texture) + +#endif /* GL_SGIS_pixel_texture */ + +/* ------------------------ GL_SGIS_sharpen_texture ------------------------ */ + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 + +typedef void (GLAPIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat* points); +typedef void (GLAPIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat* points); + +#define glGetSharpenTexFuncSGIS GLEW_GET_FUN(__glewGetSharpenTexFuncSGIS) +#define glSharpenTexFuncSGIS GLEW_GET_FUN(__glewSharpenTexFuncSGIS) + +#define GLEW_SGIS_sharpen_texture GLEW_GET_VAR(__GLEW_SGIS_sharpen_texture) + +#endif /* GL_SGIS_sharpen_texture */ + +/* --------------------------- GL_SGIS_texture4D --------------------------- */ + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 + +typedef void (GLAPIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void* pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void* pixels); + +#define glTexImage4DSGIS GLEW_GET_FUN(__glewTexImage4DSGIS) +#define glTexSubImage4DSGIS GLEW_GET_FUN(__glewTexSubImage4DSGIS) + +#define GLEW_SGIS_texture4D GLEW_GET_VAR(__GLEW_SGIS_texture4D) + +#endif /* GL_SGIS_texture4D */ + +/* ---------------------- GL_SGIS_texture_border_clamp --------------------- */ + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 + +#define GL_CLAMP_TO_BORDER_SGIS 0x812D + +#define GLEW_SGIS_texture_border_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_border_clamp) + +#endif /* GL_SGIS_texture_border_clamp */ + +/* ----------------------- GL_SGIS_texture_edge_clamp ---------------------- */ + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 + +#define GL_CLAMP_TO_EDGE_SGIS 0x812F + +#define GLEW_SGIS_texture_edge_clamp GLEW_GET_VAR(__GLEW_SGIS_texture_edge_clamp) + +#endif /* GL_SGIS_texture_edge_clamp */ + +/* ------------------------ GL_SGIS_texture_filter4 ------------------------ */ + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 + +typedef void (GLAPIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat* weights); +typedef void (GLAPIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat* weights); + +#define glGetTexFilterFuncSGIS GLEW_GET_FUN(__glewGetTexFilterFuncSGIS) +#define glTexFilterFuncSGIS GLEW_GET_FUN(__glewTexFilterFuncSGIS) + +#define GLEW_SGIS_texture_filter4 GLEW_GET_VAR(__GLEW_SGIS_texture_filter4) + +#endif /* GL_SGIS_texture_filter4 */ + +/* -------------------------- GL_SGIS_texture_lod -------------------------- */ + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 + +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D + +#define GLEW_SGIS_texture_lod GLEW_GET_VAR(__GLEW_SGIS_texture_lod) + +#endif /* GL_SGIS_texture_lod */ + +/* ------------------------- GL_SGIS_texture_select ------------------------ */ + +#ifndef GL_SGIS_texture_select +#define GL_SGIS_texture_select 1 + +#define GLEW_SGIS_texture_select GLEW_GET_VAR(__GLEW_SGIS_texture_select) + +#endif /* GL_SGIS_texture_select */ + +/* ----------------------------- GL_SGIX_async ----------------------------- */ + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 + +#define GL_ASYNC_MARKER_SGIX 0x8329 + +typedef void (GLAPIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef void (GLAPIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLint (GLAPIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint* markerp); +typedef GLuint (GLAPIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef GLboolean (GLAPIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (GLAPIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint* markerp); + +#define glAsyncMarkerSGIX GLEW_GET_FUN(__glewAsyncMarkerSGIX) +#define glDeleteAsyncMarkersSGIX GLEW_GET_FUN(__glewDeleteAsyncMarkersSGIX) +#define glFinishAsyncSGIX GLEW_GET_FUN(__glewFinishAsyncSGIX) +#define glGenAsyncMarkersSGIX GLEW_GET_FUN(__glewGenAsyncMarkersSGIX) +#define glIsAsyncMarkerSGIX GLEW_GET_FUN(__glewIsAsyncMarkerSGIX) +#define glPollAsyncSGIX GLEW_GET_FUN(__glewPollAsyncSGIX) + +#define GLEW_SGIX_async GLEW_GET_VAR(__GLEW_SGIX_async) + +#endif /* GL_SGIX_async */ + +/* ------------------------ GL_SGIX_async_histogram ------------------------ */ + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 + +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D + +#define GLEW_SGIX_async_histogram GLEW_GET_VAR(__GLEW_SGIX_async_histogram) + +#endif /* GL_SGIX_async_histogram */ + +/* -------------------------- GL_SGIX_async_pixel -------------------------- */ + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 + +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 + +#define GLEW_SGIX_async_pixel GLEW_GET_VAR(__GLEW_SGIX_async_pixel) + +#endif /* GL_SGIX_async_pixel */ + +/* ----------------------- GL_SGIX_blend_alpha_minmax ---------------------- */ + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 + +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 + +#define GLEW_SGIX_blend_alpha_minmax GLEW_GET_VAR(__GLEW_SGIX_blend_alpha_minmax) + +#endif /* GL_SGIX_blend_alpha_minmax */ + +/* ---------------------------- GL_SGIX_clipmap ---------------------------- */ + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 + +#define GLEW_SGIX_clipmap GLEW_GET_VAR(__GLEW_SGIX_clipmap) + +#endif /* GL_SGIX_clipmap */ + +/* ------------------------- GL_SGIX_depth_texture ------------------------- */ + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 + +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 + +#define GLEW_SGIX_depth_texture GLEW_GET_VAR(__GLEW_SGIX_depth_texture) + +#endif /* GL_SGIX_depth_texture */ + +/* -------------------------- GL_SGIX_flush_raster ------------------------- */ + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 + +typedef void (GLAPIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); + +#define glFlushRasterSGIX GLEW_GET_FUN(__glewFlushRasterSGIX) + +#define GLEW_SGIX_flush_raster GLEW_GET_VAR(__GLEW_SGIX_flush_raster) + +#endif /* GL_SGIX_flush_raster */ + +/* --------------------------- GL_SGIX_fog_offset -------------------------- */ + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 + +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 + +#define GLEW_SGIX_fog_offset GLEW_GET_VAR(__GLEW_SGIX_fog_offset) + +#endif /* GL_SGIX_fog_offset */ + +/* -------------------------- GL_SGIX_fog_texture -------------------------- */ + +#ifndef GL_SGIX_fog_texture +#define GL_SGIX_fog_texture 1 + +#define GL_TEXTURE_FOG_SGIX 0 +#define GL_FOG_PATCHY_FACTOR_SGIX 0 +#define GL_FRAGMENT_FOG_SGIX 0 + +typedef void (GLAPIENTRY * PFNGLTEXTUREFOGSGIXPROC) (GLenum pname); + +#define glTextureFogSGIX GLEW_GET_FUN(__glewTextureFogSGIX) + +#define GLEW_SGIX_fog_texture GLEW_GET_VAR(__GLEW_SGIX_fog_texture) + +#endif /* GL_SGIX_fog_texture */ + +/* ------------------- GL_SGIX_fragment_specular_lighting ------------------ */ + +#ifndef GL_SGIX_fragment_specular_lighting +#define GL_SGIX_fragment_specular_lighting 1 + +typedef void (GLAPIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, const GLfloat param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, const GLint param); +typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data); + +#define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX) +#define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX) +#define glFragmentLightModelfvSGIX GLEW_GET_FUN(__glewFragmentLightModelfvSGIX) +#define glFragmentLightModeliSGIX GLEW_GET_FUN(__glewFragmentLightModeliSGIX) +#define glFragmentLightModelivSGIX GLEW_GET_FUN(__glewFragmentLightModelivSGIX) +#define glFragmentLightfSGIX GLEW_GET_FUN(__glewFragmentLightfSGIX) +#define glFragmentLightfvSGIX GLEW_GET_FUN(__glewFragmentLightfvSGIX) +#define glFragmentLightiSGIX GLEW_GET_FUN(__glewFragmentLightiSGIX) +#define glFragmentLightivSGIX GLEW_GET_FUN(__glewFragmentLightivSGIX) +#define glFragmentMaterialfSGIX GLEW_GET_FUN(__glewFragmentMaterialfSGIX) +#define glFragmentMaterialfvSGIX GLEW_GET_FUN(__glewFragmentMaterialfvSGIX) +#define glFragmentMaterialiSGIX GLEW_GET_FUN(__glewFragmentMaterialiSGIX) +#define glFragmentMaterialivSGIX GLEW_GET_FUN(__glewFragmentMaterialivSGIX) +#define glGetFragmentLightfvSGIX GLEW_GET_FUN(__glewGetFragmentLightfvSGIX) +#define glGetFragmentLightivSGIX GLEW_GET_FUN(__glewGetFragmentLightivSGIX) +#define glGetFragmentMaterialfvSGIX GLEW_GET_FUN(__glewGetFragmentMaterialfvSGIX) +#define glGetFragmentMaterialivSGIX GLEW_GET_FUN(__glewGetFragmentMaterialivSGIX) + +#define GLEW_SGIX_fragment_specular_lighting GLEW_GET_VAR(__GLEW_SGIX_fragment_specular_lighting) + +#endif /* GL_SGIX_fragment_specular_lighting */ + +/* --------------------------- GL_SGIX_framezoom --------------------------- */ + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 + +typedef void (GLAPIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor); + +#define glFrameZoomSGIX GLEW_GET_FUN(__glewFrameZoomSGIX) + +#define GLEW_SGIX_framezoom GLEW_GET_VAR(__GLEW_SGIX_framezoom) + +#endif /* GL_SGIX_framezoom */ + +/* --------------------------- GL_SGIX_interlace --------------------------- */ + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 + +#define GL_INTERLACE_SGIX 0x8094 + +#define GLEW_SGIX_interlace GLEW_GET_VAR(__GLEW_SGIX_interlace) + +#endif /* GL_SGIX_interlace */ + +/* ------------------------- GL_SGIX_ir_instrument1 ------------------------ */ + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 + +#define GLEW_SGIX_ir_instrument1 GLEW_GET_VAR(__GLEW_SGIX_ir_instrument1) + +#endif /* GL_SGIX_ir_instrument1 */ + +/* ------------------------- GL_SGIX_list_priority ------------------------- */ + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 + +#define GLEW_SGIX_list_priority GLEW_GET_VAR(__GLEW_SGIX_list_priority) + +#endif /* GL_SGIX_list_priority */ + +/* ------------------------- GL_SGIX_pixel_texture ------------------------- */ + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 + +typedef void (GLAPIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); + +#define glPixelTexGenSGIX GLEW_GET_FUN(__glewPixelTexGenSGIX) + +#define GLEW_SGIX_pixel_texture GLEW_GET_VAR(__GLEW_SGIX_pixel_texture) + +#endif /* GL_SGIX_pixel_texture */ + +/* ----------------------- GL_SGIX_pixel_texture_bits ---------------------- */ + +#ifndef GL_SGIX_pixel_texture_bits +#define GL_SGIX_pixel_texture_bits 1 + +#define GLEW_SGIX_pixel_texture_bits GLEW_GET_VAR(__GLEW_SGIX_pixel_texture_bits) + +#endif /* GL_SGIX_pixel_texture_bits */ + +/* ------------------------ GL_SGIX_reference_plane ------------------------ */ + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 + +typedef void (GLAPIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble* equation); + +#define glReferencePlaneSGIX GLEW_GET_FUN(__glewReferencePlaneSGIX) + +#define GLEW_SGIX_reference_plane GLEW_GET_VAR(__GLEW_SGIX_reference_plane) + +#endif /* GL_SGIX_reference_plane */ + +/* ---------------------------- GL_SGIX_resample --------------------------- */ + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 + +#define GL_PACK_RESAMPLE_SGIX 0x842E +#define GL_UNPACK_RESAMPLE_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 + +#define GLEW_SGIX_resample GLEW_GET_VAR(__GLEW_SGIX_resample) + +#endif /* GL_SGIX_resample */ + +/* ----------------------------- GL_SGIX_shadow ---------------------------- */ + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 + +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D + +#define GLEW_SGIX_shadow GLEW_GET_VAR(__GLEW_SGIX_shadow) + +#endif /* GL_SGIX_shadow */ + +/* ------------------------- GL_SGIX_shadow_ambient ------------------------ */ + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 + +#define GL_SHADOW_AMBIENT_SGIX 0x80BF + +#define GLEW_SGIX_shadow_ambient GLEW_GET_VAR(__GLEW_SGIX_shadow_ambient) + +#endif /* GL_SGIX_shadow_ambient */ + +/* ----------------------------- GL_SGIX_sprite ---------------------------- */ + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 + +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, GLint* params); + +#define glSpriteParameterfSGIX GLEW_GET_FUN(__glewSpriteParameterfSGIX) +#define glSpriteParameterfvSGIX GLEW_GET_FUN(__glewSpriteParameterfvSGIX) +#define glSpriteParameteriSGIX GLEW_GET_FUN(__glewSpriteParameteriSGIX) +#define glSpriteParameterivSGIX GLEW_GET_FUN(__glewSpriteParameterivSGIX) + +#define GLEW_SGIX_sprite GLEW_GET_VAR(__GLEW_SGIX_sprite) + +#endif /* GL_SGIX_sprite */ + +/* ----------------------- GL_SGIX_tag_sample_buffer ----------------------- */ + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 + +typedef void (GLAPIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); + +#define glTagSampleBufferSGIX GLEW_GET_FUN(__glewTagSampleBufferSGIX) + +#define GLEW_SGIX_tag_sample_buffer GLEW_GET_VAR(__GLEW_SGIX_tag_sample_buffer) + +#endif /* GL_SGIX_tag_sample_buffer */ + +/* ------------------------ GL_SGIX_texture_add_env ------------------------ */ + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 + +#define GLEW_SGIX_texture_add_env GLEW_GET_VAR(__GLEW_SGIX_texture_add_env) + +#endif /* GL_SGIX_texture_add_env */ + +/* -------------------- GL_SGIX_texture_coordinate_clamp ------------------- */ + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 + +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B + +#define GLEW_SGIX_texture_coordinate_clamp GLEW_GET_VAR(__GLEW_SGIX_texture_coordinate_clamp) + +#endif /* GL_SGIX_texture_coordinate_clamp */ + +/* ------------------------ GL_SGIX_texture_lod_bias ----------------------- */ + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 + +#define GLEW_SGIX_texture_lod_bias GLEW_GET_VAR(__GLEW_SGIX_texture_lod_bias) + +#endif /* GL_SGIX_texture_lod_bias */ + +/* ---------------------- GL_SGIX_texture_multi_buffer --------------------- */ + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 + +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E + +#define GLEW_SGIX_texture_multi_buffer GLEW_GET_VAR(__GLEW_SGIX_texture_multi_buffer) + +#endif /* GL_SGIX_texture_multi_buffer */ + +/* ------------------------- GL_SGIX_texture_range ------------------------- */ + +#ifndef GL_SGIX_texture_range +#define GL_SGIX_texture_range 1 + +#define GL_RGB_SIGNED_SGIX 0x85E0 +#define GL_RGBA_SIGNED_SGIX 0x85E1 +#define GL_ALPHA_SIGNED_SGIX 0x85E2 +#define GL_LUMINANCE_SIGNED_SGIX 0x85E3 +#define GL_INTENSITY_SIGNED_SGIX 0x85E4 +#define GL_LUMINANCE_ALPHA_SIGNED_SGIX 0x85E5 +#define GL_RGB16_SIGNED_SGIX 0x85E6 +#define GL_RGBA16_SIGNED_SGIX 0x85E7 +#define GL_ALPHA16_SIGNED_SGIX 0x85E8 +#define GL_LUMINANCE16_SIGNED_SGIX 0x85E9 +#define GL_INTENSITY16_SIGNED_SGIX 0x85EA +#define GL_LUMINANCE16_ALPHA16_SIGNED_SGIX 0x85EB +#define GL_RGB_EXTENDED_RANGE_SGIX 0x85EC +#define GL_RGBA_EXTENDED_RANGE_SGIX 0x85ED +#define GL_ALPHA_EXTENDED_RANGE_SGIX 0x85EE +#define GL_LUMINANCE_EXTENDED_RANGE_SGIX 0x85EF +#define GL_INTENSITY_EXTENDED_RANGE_SGIX 0x85F0 +#define GL_LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX 0x85F1 +#define GL_RGB16_EXTENDED_RANGE_SGIX 0x85F2 +#define GL_RGBA16_EXTENDED_RANGE_SGIX 0x85F3 +#define GL_ALPHA16_EXTENDED_RANGE_SGIX 0x85F4 +#define GL_LUMINANCE16_EXTENDED_RANGE_SGIX 0x85F5 +#define GL_INTENSITY16_EXTENDED_RANGE_SGIX 0x85F6 +#define GL_LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX 0x85F7 +#define GL_MIN_LUMINANCE_SGIS 0x85F8 +#define GL_MAX_LUMINANCE_SGIS 0x85F9 +#define GL_MIN_INTENSITY_SGIS 0x85FA +#define GL_MAX_INTENSITY_SGIS 0x85FB + +#define GLEW_SGIX_texture_range GLEW_GET_VAR(__GLEW_SGIX_texture_range) + +#endif /* GL_SGIX_texture_range */ + +/* ----------------------- GL_SGIX_texture_scale_bias ---------------------- */ + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 + +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C + +#define GLEW_SGIX_texture_scale_bias GLEW_GET_VAR(__GLEW_SGIX_texture_scale_bias) + +#endif /* GL_SGIX_texture_scale_bias */ + +/* ------------------------- GL_SGIX_vertex_preclip ------------------------ */ + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 + +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF + +#define GLEW_SGIX_vertex_preclip GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip) + +#endif /* GL_SGIX_vertex_preclip */ + +/* ---------------------- GL_SGIX_vertex_preclip_hint ---------------------- */ + +#ifndef GL_SGIX_vertex_preclip_hint +#define GL_SGIX_vertex_preclip_hint 1 + +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF + +#define GLEW_SGIX_vertex_preclip_hint GLEW_GET_VAR(__GLEW_SGIX_vertex_preclip_hint) + +#endif /* GL_SGIX_vertex_preclip_hint */ + +/* ----------------------------- GL_SGIX_ycrcb ----------------------------- */ + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 + +#define GLEW_SGIX_ycrcb GLEW_GET_VAR(__GLEW_SGIX_ycrcb) + +#endif /* GL_SGIX_ycrcb */ + +/* -------------------------- GL_SGI_color_matrix -------------------------- */ + +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 + +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB + +#define GLEW_SGI_color_matrix GLEW_GET_VAR(__GLEW_SGI_color_matrix) + +#endif /* GL_SGI_color_matrix */ + +/* --------------------------- GL_SGI_color_table -------------------------- */ + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 + +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF + +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* table); +typedef void (GLAPIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void* table); + +#define glColorTableParameterfvSGI GLEW_GET_FUN(__glewColorTableParameterfvSGI) +#define glColorTableParameterivSGI GLEW_GET_FUN(__glewColorTableParameterivSGI) +#define glColorTableSGI GLEW_GET_FUN(__glewColorTableSGI) +#define glCopyColorTableSGI GLEW_GET_FUN(__glewCopyColorTableSGI) +#define glGetColorTableParameterfvSGI GLEW_GET_FUN(__glewGetColorTableParameterfvSGI) +#define glGetColorTableParameterivSGI GLEW_GET_FUN(__glewGetColorTableParameterivSGI) +#define glGetColorTableSGI GLEW_GET_FUN(__glewGetColorTableSGI) + +#define GLEW_SGI_color_table GLEW_GET_VAR(__GLEW_SGI_color_table) + +#endif /* GL_SGI_color_table */ + +/* ----------------------- GL_SGI_texture_color_table ---------------------- */ + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 + +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD + +#define GLEW_SGI_texture_color_table GLEW_GET_VAR(__GLEW_SGI_texture_color_table) + +#endif /* GL_SGI_texture_color_table */ + +/* ------------------------- GL_SUNX_constant_data ------------------------- */ + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 + +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 + +typedef void (GLAPIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void); + +#define glFinishTextureSUNX GLEW_GET_FUN(__glewFinishTextureSUNX) + +#define GLEW_SUNX_constant_data GLEW_GET_VAR(__GLEW_SUNX_constant_data) + +#endif /* GL_SUNX_constant_data */ + +/* -------------------- GL_SUN_convolution_border_modes -------------------- */ + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 + +#define GL_WRAP_BORDER_SUN 0x81D4 + +#define GLEW_SUN_convolution_border_modes GLEW_GET_VAR(__GLEW_SUN_convolution_border_modes) + +#endif /* GL_SUN_convolution_border_modes */ + +/* -------------------------- GL_SUN_global_alpha -------------------------- */ + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 + +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA + +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +typedef void (GLAPIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); + +#define glGlobalAlphaFactorbSUN GLEW_GET_FUN(__glewGlobalAlphaFactorbSUN) +#define glGlobalAlphaFactordSUN GLEW_GET_FUN(__glewGlobalAlphaFactordSUN) +#define glGlobalAlphaFactorfSUN GLEW_GET_FUN(__glewGlobalAlphaFactorfSUN) +#define glGlobalAlphaFactoriSUN GLEW_GET_FUN(__glewGlobalAlphaFactoriSUN) +#define glGlobalAlphaFactorsSUN GLEW_GET_FUN(__glewGlobalAlphaFactorsSUN) +#define glGlobalAlphaFactorubSUN GLEW_GET_FUN(__glewGlobalAlphaFactorubSUN) +#define glGlobalAlphaFactoruiSUN GLEW_GET_FUN(__glewGlobalAlphaFactoruiSUN) +#define glGlobalAlphaFactorusSUN GLEW_GET_FUN(__glewGlobalAlphaFactorusSUN) + +#define GLEW_SUN_global_alpha GLEW_GET_VAR(__GLEW_SUN_global_alpha) + +#endif /* GL_SUN_global_alpha */ + +/* --------------------------- GL_SUN_mesh_array --------------------------- */ + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 + +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 + +#define GLEW_SUN_mesh_array GLEW_GET_VAR(__GLEW_SUN_mesh_array) + +#endif /* GL_SUN_mesh_array */ + +/* ------------------------ GL_SUN_read_video_pixels ----------------------- */ + +#ifndef GL_SUN_read_video_pixels +#define GL_SUN_read_video_pixels 1 + +typedef void (GLAPIENTRY * PFNGLREADVIDEOPIXELSSUNPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); + +#define glReadVideoPixelsSUN GLEW_GET_FUN(__glewReadVideoPixelsSUN) + +#define GLEW_SUN_read_video_pixels GLEW_GET_VAR(__GLEW_SUN_read_video_pixels) + +#endif /* GL_SUN_read_video_pixels */ + +/* --------------------------- GL_SUN_slice_accum -------------------------- */ + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 + +#define GL_SLICE_ACCUM_SUN 0x85CC + +#define GLEW_SUN_slice_accum GLEW_GET_VAR(__GLEW_SUN_slice_accum) + +#endif /* GL_SUN_slice_accum */ + +/* -------------------------- GL_SUN_triangle_list ------------------------- */ + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 + +#define GL_RESTART_SUN 0x01 +#define GL_REPLACE_MIDDLE_SUN 0x02 +#define GL_REPLACE_OLDEST_SUN 0x03 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB + +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void* pointer); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte* code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint* code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort* code); + +#define glReplacementCodePointerSUN GLEW_GET_FUN(__glewReplacementCodePointerSUN) +#define glReplacementCodeubSUN GLEW_GET_FUN(__glewReplacementCodeubSUN) +#define glReplacementCodeubvSUN GLEW_GET_FUN(__glewReplacementCodeubvSUN) +#define glReplacementCodeuiSUN GLEW_GET_FUN(__glewReplacementCodeuiSUN) +#define glReplacementCodeuivSUN GLEW_GET_FUN(__glewReplacementCodeuivSUN) +#define glReplacementCodeusSUN GLEW_GET_FUN(__glewReplacementCodeusSUN) +#define glReplacementCodeusvSUN GLEW_GET_FUN(__glewReplacementCodeusvSUN) + +#define GLEW_SUN_triangle_list GLEW_GET_VAR(__GLEW_SUN_triangle_list) + +#endif /* GL_SUN_triangle_list */ + +/* ----------------------------- GL_SUN_vertex ----------------------------- */ + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 + +typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte* c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte* c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint* rc, const GLubyte *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *tc, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint* rc, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat* tc, const GLubyte *c, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAPIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat* tc, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, const GLfloat *v); + +#define glColor3fVertex3fSUN GLEW_GET_FUN(__glewColor3fVertex3fSUN) +#define glColor3fVertex3fvSUN GLEW_GET_FUN(__glewColor3fVertex3fvSUN) +#define glColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fSUN) +#define glColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewColor4fNormal3fVertex3fvSUN) +#define glColor4ubVertex2fSUN GLEW_GET_FUN(__glewColor4ubVertex2fSUN) +#define glColor4ubVertex2fvSUN GLEW_GET_FUN(__glewColor4ubVertex2fvSUN) +#define glColor4ubVertex3fSUN GLEW_GET_FUN(__glewColor4ubVertex3fSUN) +#define glColor4ubVertex3fvSUN GLEW_GET_FUN(__glewColor4ubVertex3fvSUN) +#define glNormal3fVertex3fSUN GLEW_GET_FUN(__glewNormal3fVertex3fSUN) +#define glNormal3fVertex3fvSUN GLEW_GET_FUN(__glewNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fSUN) +#define glReplacementCodeuiColor3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor3fVertex3fvSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor4ubVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fSUN) +#define glReplacementCodeuiColor4ubVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiColor4ubVertex3fvSUN) +#define glReplacementCodeuiNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fSUN) +#define glReplacementCodeuiNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiTexCoord2fVertex3fvSUN) +#define glReplacementCodeuiVertex3fSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fSUN) +#define glReplacementCodeuiVertex3fvSUN GLEW_GET_FUN(__glewReplacementCodeuiVertex3fvSUN) +#define glTexCoord2fColor3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fSUN) +#define glTexCoord2fColor3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor3fVertex3fvSUN) +#define glTexCoord2fColor4fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fSUN) +#define glTexCoord2fColor4fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glTexCoord2fColor4ubVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fSUN) +#define glTexCoord2fColor4ubVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fColor4ubVertex3fvSUN) +#define glTexCoord2fNormal3fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fSUN) +#define glTexCoord2fNormal3fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fNormal3fVertex3fvSUN) +#define glTexCoord2fVertex3fSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fSUN) +#define glTexCoord2fVertex3fvSUN GLEW_GET_FUN(__glewTexCoord2fVertex3fvSUN) +#define glTexCoord4fColor4fNormal3fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fSUN) +#define glTexCoord4fColor4fNormal3fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fColor4fNormal3fVertex4fvSUN) +#define glTexCoord4fVertex4fSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fSUN) +#define glTexCoord4fVertex4fvSUN GLEW_GET_FUN(__glewTexCoord4fVertex4fvSUN) + +#define GLEW_SUN_vertex GLEW_GET_VAR(__GLEW_SUN_vertex) + +#endif /* GL_SUN_vertex */ + +/* -------------------------- GL_WIN_phong_shading ------------------------- */ + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 + +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB + +#define GLEW_WIN_phong_shading GLEW_GET_VAR(__GLEW_WIN_phong_shading) + +#endif /* GL_WIN_phong_shading */ + +/* -------------------------- GL_WIN_specular_fog -------------------------- */ + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 + +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC + +#define GLEW_WIN_specular_fog GLEW_GET_VAR(__GLEW_WIN_specular_fog) + +#endif /* GL_WIN_specular_fog */ + +/* ---------------------------- GL_WIN_swap_hint --------------------------- */ + +#ifndef GL_WIN_swap_hint +#define GL_WIN_swap_hint 1 + +typedef void (GLAPIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); + +#define glAddSwapHintRectWIN GLEW_GET_FUN(__glewAddSwapHintRectWIN) + +#define GLEW_WIN_swap_hint GLEW_GET_VAR(__GLEW_WIN_swap_hint) + +#endif /* GL_WIN_swap_hint */ + +/* ------------------------------------------------------------------------- */ + +#if defined(GLEW_MX) && defined(_WIN32) +#define GLEW_FUN_EXPORT +#else +#define GLEW_FUN_EXPORT GLEWAPI +#endif /* GLEW_MX */ + +#if defined(GLEW_MX) +#define GLEW_VAR_EXPORT +#else +#define GLEW_VAR_EXPORT GLEWAPI +#endif /* GLEW_MX */ + +#if defined(GLEW_MX) && defined(_WIN32) +struct GLEWContextStruct +{ +#endif /* GLEW_MX */ + +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSPROC __glewDrawRangeElements; +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DPROC __glewTexImage3D; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DPROC __glewTexSubImage3D; + +GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture; +GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DPROC __glewCompressedTexImage1D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DPROC __glewCompressedTexImage2D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DPROC __glewCompressedTexImage3D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC __glewCompressedTexSubImage1D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC __glewCompressedTexSubImage2D; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC __glewCompressedTexSubImage3D; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEPROC __glewGetCompressedTexImage; +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDPROC __glewLoadTransposeMatrixd; +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFPROC __glewLoadTransposeMatrixf; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDPROC __glewMultTransposeMatrixd; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFPROC __glewMultTransposeMatrixf; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DPROC __glewMultiTexCoord1d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVPROC __glewMultiTexCoord1dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FPROC __glewMultiTexCoord1f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVPROC __glewMultiTexCoord1fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IPROC __glewMultiTexCoord1i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVPROC __glewMultiTexCoord1iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SPROC __glewMultiTexCoord1s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVPROC __glewMultiTexCoord1sv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DPROC __glewMultiTexCoord2d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVPROC __glewMultiTexCoord2dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FPROC __glewMultiTexCoord2f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVPROC __glewMultiTexCoord2fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IPROC __glewMultiTexCoord2i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVPROC __glewMultiTexCoord2iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SPROC __glewMultiTexCoord2s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVPROC __glewMultiTexCoord2sv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DPROC __glewMultiTexCoord3d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVPROC __glewMultiTexCoord3dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FPROC __glewMultiTexCoord3f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVPROC __glewMultiTexCoord3fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IPROC __glewMultiTexCoord3i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVPROC __glewMultiTexCoord3iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SPROC __glewMultiTexCoord3s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVPROC __glewMultiTexCoord3sv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DPROC __glewMultiTexCoord4d; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVPROC __glewMultiTexCoord4dv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FPROC __glewMultiTexCoord4f; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVPROC __glewMultiTexCoord4fv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IPROC __glewMultiTexCoord4i; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVPROC __glewMultiTexCoord4iv; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SPROC __glewMultiTexCoord4s; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVPROC __glewMultiTexCoord4sv; +GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEPROC __glewSampleCoverage; + +GLEW_FUN_EXPORT PFNGLBLENDCOLORPROC __glewBlendColor; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONPROC __glewBlendEquation; +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEPROC __glewBlendFuncSeparate; +GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERPROC __glewFogCoordPointer; +GLEW_FUN_EXPORT PFNGLFOGCOORDDPROC __glewFogCoordd; +GLEW_FUN_EXPORT PFNGLFOGCOORDDVPROC __glewFogCoorddv; +GLEW_FUN_EXPORT PFNGLFOGCOORDFPROC __glewFogCoordf; +GLEW_FUN_EXPORT PFNGLFOGCOORDFVPROC __glewFogCoordfv; +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSPROC __glewMultiDrawArrays; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSPROC __glewMultiDrawElements; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFPROC __glewPointParameterf; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVPROC __glewPointParameterfv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BPROC __glewSecondaryColor3b; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVPROC __glewSecondaryColor3bv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DPROC __glewSecondaryColor3d; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVPROC __glewSecondaryColor3dv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FPROC __glewSecondaryColor3f; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVPROC __glewSecondaryColor3fv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IPROC __glewSecondaryColor3i; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVPROC __glewSecondaryColor3iv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SPROC __glewSecondaryColor3s; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVPROC __glewSecondaryColor3sv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBPROC __glewSecondaryColor3ub; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVPROC __glewSecondaryColor3ubv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIPROC __glewSecondaryColor3ui; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVPROC __glewSecondaryColor3uiv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USPROC __glewSecondaryColor3us; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVPROC __glewSecondaryColor3usv; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERPROC __glewSecondaryColorPointer; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DPROC __glewWindowPos2d; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVPROC __glewWindowPos2dv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FPROC __glewWindowPos2f; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVPROC __glewWindowPos2fv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IPROC __glewWindowPos2i; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVPROC __glewWindowPos2iv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SPROC __glewWindowPos2s; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVPROC __glewWindowPos2sv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DPROC __glewWindowPos3d; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVPROC __glewWindowPos3dv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FPROC __glewWindowPos3f; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVPROC __glewWindowPos3fv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IPROC __glewWindowPos3i; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVPROC __glewWindowPos3iv; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SPROC __glewWindowPos3s; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVPROC __glewWindowPos3sv; + +GLEW_FUN_EXPORT PFNGLBEGINQUERYPROC __glewBeginQuery; +GLEW_FUN_EXPORT PFNGLBINDBUFFERPROC __glewBindBuffer; +GLEW_FUN_EXPORT PFNGLBUFFERDATAPROC __glewBufferData; +GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAPROC __glewBufferSubData; +GLEW_FUN_EXPORT PFNGLDELETEBUFFERSPROC __glewDeleteBuffers; +GLEW_FUN_EXPORT PFNGLDELETEQUERIESPROC __glewDeleteQueries; +GLEW_FUN_EXPORT PFNGLENDQUERYPROC __glewEndQuery; +GLEW_FUN_EXPORT PFNGLGENBUFFERSPROC __glewGenBuffers; +GLEW_FUN_EXPORT PFNGLGENQUERIESPROC __glewGenQueries; +GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVPROC __glewGetBufferParameteriv; +GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVPROC __glewGetBufferPointerv; +GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAPROC __glewGetBufferSubData; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVPROC __glewGetQueryObjectiv; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVPROC __glewGetQueryObjectuiv; +GLEW_FUN_EXPORT PFNGLGETQUERYIVPROC __glewGetQueryiv; +GLEW_FUN_EXPORT PFNGLISBUFFERPROC __glewIsBuffer; +GLEW_FUN_EXPORT PFNGLISQUERYPROC __glewIsQuery; +GLEW_FUN_EXPORT PFNGLMAPBUFFERPROC __glewMapBuffer; +GLEW_FUN_EXPORT PFNGLUNMAPBUFFERPROC __glewUnmapBuffer; + +GLEW_FUN_EXPORT PFNGLATTACHSHADERPROC __glewAttachShader; +GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONPROC __glewBindAttribLocation; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEPROC __glewBlendEquationSeparate; +GLEW_FUN_EXPORT PFNGLCOMPILESHADERPROC __glewCompileShader; +GLEW_FUN_EXPORT PFNGLCREATEPROGRAMPROC __glewCreateProgram; +GLEW_FUN_EXPORT PFNGLCREATESHADERPROC __glewCreateShader; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMPROC __glewDeleteProgram; +GLEW_FUN_EXPORT PFNGLDELETESHADERPROC __glewDeleteShader; +GLEW_FUN_EXPORT PFNGLDETACHSHADERPROC __glewDetachShader; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYPROC __glewDisableVertexAttribArray; +GLEW_FUN_EXPORT PFNGLDRAWBUFFERSPROC __glewDrawBuffers; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYPROC __glewEnableVertexAttribArray; +GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBPROC __glewGetActiveAttrib; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMPROC __glewGetActiveUniform; +GLEW_FUN_EXPORT PFNGLGETATTACHEDSHADERSPROC __glewGetAttachedShaders; +GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONPROC __glewGetAttribLocation; +GLEW_FUN_EXPORT PFNGLGETPROGRAMINFOLOGPROC __glewGetProgramInfoLog; +GLEW_FUN_EXPORT PFNGLGETPROGRAMIVPROC __glewGetProgramiv; +GLEW_FUN_EXPORT PFNGLGETSHADERINFOLOGPROC __glewGetShaderInfoLog; +GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEPROC __glewGetShaderSource; +GLEW_FUN_EXPORT PFNGLGETSHADERIVPROC __glewGetShaderiv; +GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONPROC __glewGetUniformLocation; +GLEW_FUN_EXPORT PFNGLGETUNIFORMFVPROC __glewGetUniformfv; +GLEW_FUN_EXPORT PFNGLGETUNIFORMIVPROC __glewGetUniformiv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVPROC __glewGetVertexAttribPointerv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVPROC __glewGetVertexAttribdv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVPROC __glewGetVertexAttribfv; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVPROC __glewGetVertexAttribiv; +GLEW_FUN_EXPORT PFNGLISPROGRAMPROC __glewIsProgram; +GLEW_FUN_EXPORT PFNGLISSHADERPROC __glewIsShader; +GLEW_FUN_EXPORT PFNGLLINKPROGRAMPROC __glewLinkProgram; +GLEW_FUN_EXPORT PFNGLSHADERSOURCEPROC __glewShaderSource; +GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEPROC __glewStencilFuncSeparate; +GLEW_FUN_EXPORT PFNGLSTENCILMASKSEPARATEPROC __glewStencilMaskSeparate; +GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEPROC __glewStencilOpSeparate; +GLEW_FUN_EXPORT PFNGLUNIFORM1FPROC __glewUniform1f; +GLEW_FUN_EXPORT PFNGLUNIFORM1FVPROC __glewUniform1fv; +GLEW_FUN_EXPORT PFNGLUNIFORM1IPROC __glewUniform1i; +GLEW_FUN_EXPORT PFNGLUNIFORM1IVPROC __glewUniform1iv; +GLEW_FUN_EXPORT PFNGLUNIFORM2FPROC __glewUniform2f; +GLEW_FUN_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv; +GLEW_FUN_EXPORT PFNGLUNIFORM2IPROC __glewUniform2i; +GLEW_FUN_EXPORT PFNGLUNIFORM2IVPROC __glewUniform2iv; +GLEW_FUN_EXPORT PFNGLUNIFORM3FPROC __glewUniform3f; +GLEW_FUN_EXPORT PFNGLUNIFORM3FVPROC __glewUniform3fv; +GLEW_FUN_EXPORT PFNGLUNIFORM3IPROC __glewUniform3i; +GLEW_FUN_EXPORT PFNGLUNIFORM3IVPROC __glewUniform3iv; +GLEW_FUN_EXPORT PFNGLUNIFORM4FPROC __glewUniform4f; +GLEW_FUN_EXPORT PFNGLUNIFORM4FVPROC __glewUniform4fv; +GLEW_FUN_EXPORT PFNGLUNIFORM4IPROC __glewUniform4i; +GLEW_FUN_EXPORT PFNGLUNIFORM4IVPROC __glewUniform4iv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVPROC __glewUniformMatrix2fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVPROC __glewUniformMatrix3fv; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVPROC __glewUniformMatrix4fv; +GLEW_FUN_EXPORT PFNGLUSEPROGRAMPROC __glewUseProgram; +GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMPROC __glewValidateProgram; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DPROC __glewVertexAttrib1d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVPROC __glewVertexAttrib1dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FPROC __glewVertexAttrib1f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVPROC __glewVertexAttrib1fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SPROC __glewVertexAttrib1s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVPROC __glewVertexAttrib1sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DPROC __glewVertexAttrib2d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVPROC __glewVertexAttrib2dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FPROC __glewVertexAttrib2f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVPROC __glewVertexAttrib2fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SPROC __glewVertexAttrib2s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVPROC __glewVertexAttrib2sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DPROC __glewVertexAttrib3d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVPROC __glewVertexAttrib3dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FPROC __glewVertexAttrib3f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVPROC __glewVertexAttrib3fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SPROC __glewVertexAttrib3s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVPROC __glewVertexAttrib3sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVPROC __glewVertexAttrib4Nbv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVPROC __glewVertexAttrib4Niv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVPROC __glewVertexAttrib4Nsv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBPROC __glewVertexAttrib4Nub; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVPROC __glewVertexAttrib4Nubv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVPROC __glewVertexAttrib4Nuiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVPROC __glewVertexAttrib4Nusv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVPROC __glewVertexAttrib4bv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DPROC __glewVertexAttrib4d; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVPROC __glewVertexAttrib4dv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FPROC __glewVertexAttrib4f; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVPROC __glewVertexAttrib4fv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVPROC __glewVertexAttrib4iv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SPROC __glewVertexAttrib4s; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVPROC __glewVertexAttrib4sv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVPROC __glewVertexAttrib4ubv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVPROC __glewVertexAttrib4uiv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVPROC __glewVertexAttrib4usv; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERPROC __glewVertexAttribPointer; + +GLEW_FUN_EXPORT PFNGLTBUFFERMASK3DFXPROC __glewTbufferMask3DFX; + +GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYAPPLEPROC __glewDrawElementArrayAPPLE; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC __glewDrawRangeElementArrayAPPLE; +GLEW_FUN_EXPORT PFNGLELEMENTPOINTERAPPLEPROC __glewElementPointerAPPLE; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC __glewMultiDrawElementArrayAPPLE; +GLEW_FUN_EXPORT PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC __glewMultiDrawRangeElementArrayAPPLE; + +GLEW_FUN_EXPORT PFNGLDELETEFENCESAPPLEPROC __glewDeleteFencesAPPLE; +GLEW_FUN_EXPORT PFNGLFINISHFENCEAPPLEPROC __glewFinishFenceAPPLE; +GLEW_FUN_EXPORT PFNGLFINISHOBJECTAPPLEPROC __glewFinishObjectAPPLE; +GLEW_FUN_EXPORT PFNGLGENFENCESAPPLEPROC __glewGenFencesAPPLE; +GLEW_FUN_EXPORT PFNGLISFENCEAPPLEPROC __glewIsFenceAPPLE; +GLEW_FUN_EXPORT PFNGLSETFENCEAPPLEPROC __glewSetFenceAPPLE; +GLEW_FUN_EXPORT PFNGLTESTFENCEAPPLEPROC __glewTestFenceAPPLE; +GLEW_FUN_EXPORT PFNGLTESTOBJECTAPPLEPROC __glewTestObjectAPPLE; + +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC __glewGetTexParameterPointervAPPLE; +GLEW_FUN_EXPORT PFNGLTEXTURERANGEAPPLEPROC __glewTextureRangeAPPLE; + +GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYAPPLEPROC __glewBindVertexArrayAPPLE; +GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSAPPLEPROC __glewDeleteVertexArraysAPPLE; +GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSAPPLEPROC __glewGenVertexArraysAPPLE; +GLEW_FUN_EXPORT PFNGLISVERTEXARRAYAPPLEPROC __glewIsVertexArrayAPPLE; + +GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC __glewFlushVertexArrayRangeAPPLE; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYPARAMETERIAPPLEPROC __glewVertexArrayParameteriAPPLE; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGEAPPLEPROC __glewVertexArrayRangeAPPLE; + +GLEW_FUN_EXPORT PFNGLCLAMPCOLORARBPROC __glewClampColorARB; + +GLEW_FUN_EXPORT PFNGLDRAWBUFFERSARBPROC __glewDrawBuffersARB; + +GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEPROC __glewColorSubTable; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPROC __glewColorTable; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVPROC __glewColorTableParameterfv; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVPROC __glewColorTableParameteriv; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DPROC __glewConvolutionFilter1D; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DPROC __glewConvolutionFilter2D; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFPROC __glewConvolutionParameterf; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVPROC __glewConvolutionParameterfv; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIPROC __glewConvolutionParameteri; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVPROC __glewConvolutionParameteriv; +GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEPROC __glewCopyColorSubTable; +GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLEPROC __glewCopyColorTable; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DPROC __glewCopyConvolutionFilter1D; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DPROC __glewCopyConvolutionFilter2D; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPROC __glewGetColorTable; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVPROC __glewGetColorTableParameterfv; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVPROC __glewGetColorTableParameteriv; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTERPROC __glewGetConvolutionFilter; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVPROC __glewGetConvolutionParameterfv; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVPROC __glewGetConvolutionParameteriv; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPROC __glewGetHistogram; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVPROC __glewGetHistogramParameterfv; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVPROC __glewGetHistogramParameteriv; +GLEW_FUN_EXPORT PFNGLGETMINMAXPROC __glewGetMinmax; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVPROC __glewGetMinmaxParameterfv; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVPROC __glewGetMinmaxParameteriv; +GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTERPROC __glewGetSeparableFilter; +GLEW_FUN_EXPORT PFNGLHISTOGRAMPROC __glewHistogram; +GLEW_FUN_EXPORT PFNGLMINMAXPROC __glewMinmax; +GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMPROC __glewResetHistogram; +GLEW_FUN_EXPORT PFNGLRESETMINMAXPROC __glewResetMinmax; +GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DPROC __glewSeparableFilter2D; + +GLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXARBPROC __glewCurrentPaletteMatrixARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTERARBPROC __glewMatrixIndexPointerARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXUBVARBPROC __glewMatrixIndexubvARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXUIVARBPROC __glewMatrixIndexuivARB; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXUSVARBPROC __glewMatrixIndexusvARB; + +GLEW_FUN_EXPORT PFNGLSAMPLECOVERAGEARBPROC __glewSampleCoverageARB; + +GLEW_FUN_EXPORT PFNGLACTIVETEXTUREARBPROC __glewActiveTextureARB; +GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREARBPROC __glewClientActiveTextureARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DARBPROC __glewMultiTexCoord1dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1DVARBPROC __glewMultiTexCoord1dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FARBPROC __glewMultiTexCoord1fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1FVARBPROC __glewMultiTexCoord1fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IARBPROC __glewMultiTexCoord1iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1IVARBPROC __glewMultiTexCoord1ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SARBPROC __glewMultiTexCoord1sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1SVARBPROC __glewMultiTexCoord1svARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DARBPROC __glewMultiTexCoord2dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2DVARBPROC __glewMultiTexCoord2dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FARBPROC __glewMultiTexCoord2fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2FVARBPROC __glewMultiTexCoord2fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IARBPROC __glewMultiTexCoord2iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2IVARBPROC __glewMultiTexCoord2ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SARBPROC __glewMultiTexCoord2sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2SVARBPROC __glewMultiTexCoord2svARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DARBPROC __glewMultiTexCoord3dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3DVARBPROC __glewMultiTexCoord3dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FARBPROC __glewMultiTexCoord3fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3FVARBPROC __glewMultiTexCoord3fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IARBPROC __glewMultiTexCoord3iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3IVARBPROC __glewMultiTexCoord3ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SARBPROC __glewMultiTexCoord3sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3SVARBPROC __glewMultiTexCoord3svARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DARBPROC __glewMultiTexCoord4dARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4DVARBPROC __glewMultiTexCoord4dvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FARBPROC __glewMultiTexCoord4fARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4FVARBPROC __glewMultiTexCoord4fvARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IARBPROC __glewMultiTexCoord4iARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4IVARBPROC __glewMultiTexCoord4ivARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SARBPROC __glewMultiTexCoord4sARB; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4SVARBPROC __glewMultiTexCoord4svARB; + +GLEW_FUN_EXPORT PFNGLBEGINQUERYARBPROC __glewBeginQueryARB; +GLEW_FUN_EXPORT PFNGLDELETEQUERIESARBPROC __glewDeleteQueriesARB; +GLEW_FUN_EXPORT PFNGLENDQUERYARBPROC __glewEndQueryARB; +GLEW_FUN_EXPORT PFNGLGENQUERIESARBPROC __glewGenQueriesARB; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVARBPROC __glewGetQueryObjectivARB; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVARBPROC __glewGetQueryObjectuivARB; +GLEW_FUN_EXPORT PFNGLGETQUERYIVARBPROC __glewGetQueryivARB; +GLEW_FUN_EXPORT PFNGLISQUERYARBPROC __glewIsQueryARB; + +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFARBPROC __glewPointParameterfARB; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVARBPROC __glewPointParameterfvARB; + +GLEW_FUN_EXPORT PFNGLATTACHOBJECTARBPROC __glewAttachObjectARB; +GLEW_FUN_EXPORT PFNGLCOMPILESHADERARBPROC __glewCompileShaderARB; +GLEW_FUN_EXPORT PFNGLCREATEPROGRAMOBJECTARBPROC __glewCreateProgramObjectARB; +GLEW_FUN_EXPORT PFNGLCREATESHADEROBJECTARBPROC __glewCreateShaderObjectARB; +GLEW_FUN_EXPORT PFNGLDELETEOBJECTARBPROC __glewDeleteObjectARB; +GLEW_FUN_EXPORT PFNGLDETACHOBJECTARBPROC __glewDetachObjectARB; +GLEW_FUN_EXPORT PFNGLGETACTIVEUNIFORMARBPROC __glewGetActiveUniformARB; +GLEW_FUN_EXPORT PFNGLGETATTACHEDOBJECTSARBPROC __glewGetAttachedObjectsARB; +GLEW_FUN_EXPORT PFNGLGETHANDLEARBPROC __glewGetHandleARB; +GLEW_FUN_EXPORT PFNGLGETINFOLOGARBPROC __glewGetInfoLogARB; +GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERFVARBPROC __glewGetObjectParameterfvARB; +GLEW_FUN_EXPORT PFNGLGETOBJECTPARAMETERIVARBPROC __glewGetObjectParameterivARB; +GLEW_FUN_EXPORT PFNGLGETSHADERSOURCEARBPROC __glewGetShaderSourceARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMLOCATIONARBPROC __glewGetUniformLocationARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMFVARBPROC __glewGetUniformfvARB; +GLEW_FUN_EXPORT PFNGLGETUNIFORMIVARBPROC __glewGetUniformivARB; +GLEW_FUN_EXPORT PFNGLLINKPROGRAMARBPROC __glewLinkProgramARB; +GLEW_FUN_EXPORT PFNGLSHADERSOURCEARBPROC __glewShaderSourceARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1FARBPROC __glewUniform1fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1FVARBPROC __glewUniform1fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1IARBPROC __glewUniform1iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM1IVARBPROC __glewUniform1ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2FARBPROC __glewUniform2fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2FVARBPROC __glewUniform2fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2IARBPROC __glewUniform2iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM2IVARBPROC __glewUniform2ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3FARBPROC __glewUniform3fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3FVARBPROC __glewUniform3fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3IARBPROC __glewUniform3iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM3IVARBPROC __glewUniform3ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4FARBPROC __glewUniform4fARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4FVARBPROC __glewUniform4fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4IARBPROC __glewUniform4iARB; +GLEW_FUN_EXPORT PFNGLUNIFORM4IVARBPROC __glewUniform4ivARB; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2FVARBPROC __glewUniformMatrix2fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3FVARBPROC __glewUniformMatrix3fvARB; +GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX4FVARBPROC __glewUniformMatrix4fvARB; +GLEW_FUN_EXPORT PFNGLUSEPROGRAMOBJECTARBPROC __glewUseProgramObjectARB; +GLEW_FUN_EXPORT PFNGLVALIDATEPROGRAMARBPROC __glewValidateProgramARB; + +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE1DARBPROC __glewCompressedTexImage1DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE2DARBPROC __glewCompressedTexImage2DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DARBPROC __glewCompressedTexImage3DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __glewCompressedTexSubImage1DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __glewCompressedTexSubImage2DARB; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __glewCompressedTexSubImage3DARB; +GLEW_FUN_EXPORT PFNGLGETCOMPRESSEDTEXIMAGEARBPROC __glewGetCompressedTexImageARB; + +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXDARBPROC __glewLoadTransposeMatrixdARB; +GLEW_FUN_EXPORT PFNGLLOADTRANSPOSEMATRIXFARBPROC __glewLoadTransposeMatrixfARB; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXDARBPROC __glewMultTransposeMatrixdARB; +GLEW_FUN_EXPORT PFNGLMULTTRANSPOSEMATRIXFARBPROC __glewMultTransposeMatrixfARB; + +GLEW_FUN_EXPORT PFNGLVERTEXBLENDARBPROC __glewVertexBlendARB; +GLEW_FUN_EXPORT PFNGLWEIGHTPOINTERARBPROC __glewWeightPointerARB; +GLEW_FUN_EXPORT PFNGLWEIGHTBVARBPROC __glewWeightbvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTDVARBPROC __glewWeightdvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTFVARBPROC __glewWeightfvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTIVARBPROC __glewWeightivARB; +GLEW_FUN_EXPORT PFNGLWEIGHTSVARBPROC __glewWeightsvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTUBVARBPROC __glewWeightubvARB; +GLEW_FUN_EXPORT PFNGLWEIGHTUIVARBPROC __glewWeightuivARB; +GLEW_FUN_EXPORT PFNGLWEIGHTUSVARBPROC __glewWeightusvARB; + +GLEW_FUN_EXPORT PFNGLBINDBUFFERARBPROC __glewBindBufferARB; +GLEW_FUN_EXPORT PFNGLBUFFERDATAARBPROC __glewBufferDataARB; +GLEW_FUN_EXPORT PFNGLBUFFERSUBDATAARBPROC __glewBufferSubDataARB; +GLEW_FUN_EXPORT PFNGLDELETEBUFFERSARBPROC __glewDeleteBuffersARB; +GLEW_FUN_EXPORT PFNGLGENBUFFERSARBPROC __glewGenBuffersARB; +GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERIVARBPROC __glewGetBufferParameterivARB; +GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVARBPROC __glewGetBufferPointervARB; +GLEW_FUN_EXPORT PFNGLGETBUFFERSUBDATAARBPROC __glewGetBufferSubDataARB; +GLEW_FUN_EXPORT PFNGLISBUFFERARBPROC __glewIsBufferARB; +GLEW_FUN_EXPORT PFNGLMAPBUFFERARBPROC __glewMapBufferARB; +GLEW_FUN_EXPORT PFNGLUNMAPBUFFERARBPROC __glewUnmapBufferARB; + +GLEW_FUN_EXPORT PFNGLBINDPROGRAMARBPROC __glewBindProgramARB; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSARBPROC __glewDeleteProgramsARB; +GLEW_FUN_EXPORT PFNGLDISABLEVERTEXATTRIBARRAYARBPROC __glewDisableVertexAttribArrayARB; +GLEW_FUN_EXPORT PFNGLENABLEVERTEXATTRIBARRAYARBPROC __glewEnableVertexAttribArrayARB; +GLEW_FUN_EXPORT PFNGLGENPROGRAMSARBPROC __glewGenProgramsARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERDVARBPROC __glewGetProgramEnvParameterdvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMENVPARAMETERFVARBPROC __glewGetProgramEnvParameterfvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC __glewGetProgramLocalParameterdvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC __glewGetProgramLocalParameterfvARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGARBPROC __glewGetProgramStringARB; +GLEW_FUN_EXPORT PFNGLGETPROGRAMIVARBPROC __glewGetProgramivARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVARBPROC __glewGetVertexAttribPointervARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVARBPROC __glewGetVertexAttribdvARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVARBPROC __glewGetVertexAttribfvARB; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVARBPROC __glewGetVertexAttribivARB; +GLEW_FUN_EXPORT PFNGLISPROGRAMARBPROC __glewIsProgramARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DARBPROC __glewProgramEnvParameter4dARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4DVARBPROC __glewProgramEnvParameter4dvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FARBPROC __glewProgramEnvParameter4fARB; +GLEW_FUN_EXPORT PFNGLPROGRAMENVPARAMETER4FVARBPROC __glewProgramEnvParameter4fvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DARBPROC __glewProgramLocalParameter4dARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4DVARBPROC __glewProgramLocalParameter4dvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FARBPROC __glewProgramLocalParameter4fARB; +GLEW_FUN_EXPORT PFNGLPROGRAMLOCALPARAMETER4FVARBPROC __glewProgramLocalParameter4fvARB; +GLEW_FUN_EXPORT PFNGLPROGRAMSTRINGARBPROC __glewProgramStringARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DARBPROC __glewVertexAttrib1dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVARBPROC __glewVertexAttrib1dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FARBPROC __glewVertexAttrib1fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVARBPROC __glewVertexAttrib1fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SARBPROC __glewVertexAttrib1sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVARBPROC __glewVertexAttrib1svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DARBPROC __glewVertexAttrib2dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVARBPROC __glewVertexAttrib2dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FARBPROC __glewVertexAttrib2fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVARBPROC __glewVertexAttrib2fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SARBPROC __glewVertexAttrib2sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVARBPROC __glewVertexAttrib2svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DARBPROC __glewVertexAttrib3dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVARBPROC __glewVertexAttrib3dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FARBPROC __glewVertexAttrib3fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVARBPROC __glewVertexAttrib3fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SARBPROC __glewVertexAttrib3sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVARBPROC __glewVertexAttrib3svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NBVARBPROC __glewVertexAttrib4NbvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NIVARBPROC __glewVertexAttrib4NivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NSVARBPROC __glewVertexAttrib4NsvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBARBPROC __glewVertexAttrib4NubARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUBVARBPROC __glewVertexAttrib4NubvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUIVARBPROC __glewVertexAttrib4NuivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4NUSVARBPROC __glewVertexAttrib4NusvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4BVARBPROC __glewVertexAttrib4bvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DARBPROC __glewVertexAttrib4dARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVARBPROC __glewVertexAttrib4dvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FARBPROC __glewVertexAttrib4fARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVARBPROC __glewVertexAttrib4fvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4IVARBPROC __glewVertexAttrib4ivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SARBPROC __glewVertexAttrib4sARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVARBPROC __glewVertexAttrib4svARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVARBPROC __glewVertexAttrib4ubvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UIVARBPROC __glewVertexAttrib4uivARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4USVARBPROC __glewVertexAttrib4usvARB; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERARBPROC __glewVertexAttribPointerARB; + +GLEW_FUN_EXPORT PFNGLBINDATTRIBLOCATIONARBPROC __glewBindAttribLocationARB; +GLEW_FUN_EXPORT PFNGLGETACTIVEATTRIBARBPROC __glewGetActiveAttribARB; +GLEW_FUN_EXPORT PFNGLGETATTRIBLOCATIONARBPROC __glewGetAttribLocationARB; + +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DARBPROC __glewWindowPos2dARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVARBPROC __glewWindowPos2dvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FARBPROC __glewWindowPos2fARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVARBPROC __glewWindowPos2fvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IARBPROC __glewWindowPos2iARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVARBPROC __glewWindowPos2ivARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SARBPROC __glewWindowPos2sARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVARBPROC __glewWindowPos2svARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DARBPROC __glewWindowPos3dARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVARBPROC __glewWindowPos3dvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FARBPROC __glewWindowPos3fARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVARBPROC __glewWindowPos3fvARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IARBPROC __glewWindowPos3iARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVARBPROC __glewWindowPos3ivARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SARBPROC __glewWindowPos3sARB; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVARBPROC __glewWindowPos3svARB; + +GLEW_FUN_EXPORT PFNGLDRAWBUFFERSATIPROC __glewDrawBuffersATI; + +GLEW_FUN_EXPORT PFNGLDRAWELEMENTARRAYATIPROC __glewDrawElementArrayATI; +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTARRAYATIPROC __glewDrawRangeElementArrayATI; +GLEW_FUN_EXPORT PFNGLELEMENTPOINTERATIPROC __glewElementPointerATI; + +GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERFVATIPROC __glewGetTexBumpParameterfvATI; +GLEW_FUN_EXPORT PFNGLGETTEXBUMPPARAMETERIVATIPROC __glewGetTexBumpParameterivATI; +GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERFVATIPROC __glewTexBumpParameterfvATI; +GLEW_FUN_EXPORT PFNGLTEXBUMPPARAMETERIVATIPROC __glewTexBumpParameterivATI; + +GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP1ATIPROC __glewAlphaFragmentOp1ATI; +GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP2ATIPROC __glewAlphaFragmentOp2ATI; +GLEW_FUN_EXPORT PFNGLALPHAFRAGMENTOP3ATIPROC __glewAlphaFragmentOp3ATI; +GLEW_FUN_EXPORT PFNGLBEGINFRAGMENTSHADERATIPROC __glewBeginFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLBINDFRAGMENTSHADERATIPROC __glewBindFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP1ATIPROC __glewColorFragmentOp1ATI; +GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP2ATIPROC __glewColorFragmentOp2ATI; +GLEW_FUN_EXPORT PFNGLCOLORFRAGMENTOP3ATIPROC __glewColorFragmentOp3ATI; +GLEW_FUN_EXPORT PFNGLDELETEFRAGMENTSHADERATIPROC __glewDeleteFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLENDFRAGMENTSHADERATIPROC __glewEndFragmentShaderATI; +GLEW_FUN_EXPORT PFNGLGENFRAGMENTSHADERSATIPROC __glewGenFragmentShadersATI; +GLEW_FUN_EXPORT PFNGLPASSTEXCOORDATIPROC __glewPassTexCoordATI; +GLEW_FUN_EXPORT PFNGLSAMPLEMAPATIPROC __glewSampleMapATI; +GLEW_FUN_EXPORT PFNGLSETFRAGMENTSHADERCONSTANTATIPROC __glewSetFragmentShaderConstantATI; + +GLEW_FUN_EXPORT PFNGLMAPOBJECTBUFFERATIPROC __glewMapObjectBufferATI; +GLEW_FUN_EXPORT PFNGLUNMAPOBJECTBUFFERATIPROC __glewUnmapObjectBufferATI; + +GLEW_FUN_EXPORT PFNGLPNTRIANGLESFATIPROC __glPNTrianglewesfATI; +GLEW_FUN_EXPORT PFNGLPNTRIANGLESIATIPROC __glPNTrianglewesiATI; + +GLEW_FUN_EXPORT PFNGLSTENCILFUNCSEPARATEATIPROC __glewStencilFuncSeparateATI; +GLEW_FUN_EXPORT PFNGLSTENCILOPSEPARATEATIPROC __glewStencilOpSeparateATI; + +GLEW_FUN_EXPORT PFNGLARRAYOBJECTATIPROC __glewArrayObjectATI; +GLEW_FUN_EXPORT PFNGLFREEOBJECTBUFFERATIPROC __glewFreeObjectBufferATI; +GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTFVATIPROC __glewGetArrayObjectfvATI; +GLEW_FUN_EXPORT PFNGLGETARRAYOBJECTIVATIPROC __glewGetArrayObjectivATI; +GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERFVATIPROC __glewGetObjectBufferfvATI; +GLEW_FUN_EXPORT PFNGLGETOBJECTBUFFERIVATIPROC __glewGetObjectBufferivATI; +GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTFVATIPROC __glewGetVariantArrayObjectfvATI; +GLEW_FUN_EXPORT PFNGLGETVARIANTARRAYOBJECTIVATIPROC __glewGetVariantArrayObjectivATI; +GLEW_FUN_EXPORT PFNGLISOBJECTBUFFERATIPROC __glewIsObjectBufferATI; +GLEW_FUN_EXPORT PFNGLNEWOBJECTBUFFERATIPROC __glewNewObjectBufferATI; +GLEW_FUN_EXPORT PFNGLUPDATEOBJECTBUFFERATIPROC __glewUpdateObjectBufferATI; +GLEW_FUN_EXPORT PFNGLVARIANTARRAYOBJECTATIPROC __glewVariantArrayObjectATI; + +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC __glewGetVertexAttribArrayObjectfvATI; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC __glewGetVertexAttribArrayObjectivATI; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBARRAYOBJECTATIPROC __glewVertexAttribArrayObjectATI; + +GLEW_FUN_EXPORT PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC __glewClientActiveVertexStreamATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BATIPROC __glewNormalStream3bATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3BVATIPROC __glewNormalStream3bvATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DATIPROC __glewNormalStream3dATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3DVATIPROC __glewNormalStream3dvATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FATIPROC __glewNormalStream3fATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3FVATIPROC __glewNormalStream3fvATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IATIPROC __glewNormalStream3iATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3IVATIPROC __glewNormalStream3ivATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SATIPROC __glewNormalStream3sATI; +GLEW_FUN_EXPORT PFNGLNORMALSTREAM3SVATIPROC __glewNormalStream3svATI; +GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVFATIPROC __glewVertexBlendEnvfATI; +GLEW_FUN_EXPORT PFNGLVERTEXBLENDENVIATIPROC __glewVertexBlendEnviATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DATIPROC __glewVertexStream2dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2DVATIPROC __glewVertexStream2dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FATIPROC __glewVertexStream2fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2FVATIPROC __glewVertexStream2fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IATIPROC __glewVertexStream2iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2IVATIPROC __glewVertexStream2ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SATIPROC __glewVertexStream2sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM2SVATIPROC __glewVertexStream2svATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DATIPROC __glewVertexStream3dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3DVATIPROC __glewVertexStream3dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FATIPROC __glewVertexStream3fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3FVATIPROC __glewVertexStream3fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IATIPROC __glewVertexStream3iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3IVATIPROC __glewVertexStream3ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SATIPROC __glewVertexStream3sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM3SVATIPROC __glewVertexStream3svATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DATIPROC __glewVertexStream4dATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4DVATIPROC __glewVertexStream4dvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FATIPROC __glewVertexStream4fATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4FVATIPROC __glewVertexStream4fvATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IATIPROC __glewVertexStream4iATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI; +GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI; + +GLEW_FUN_EXPORT PFNGLBLENDCOLOREXTPROC __glewBlendColorEXT; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEEXTPROC __glewBlendEquationSeparateEXT; + +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEEXTPROC __glewBlendFuncSeparateEXT; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONEXTPROC __glewBlendEquationEXT; + +GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT; +GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT; + +GLEW_FUN_EXPORT PFNGLLOCKARRAYSEXTPROC __glewLockArraysEXT; +GLEW_FUN_EXPORT PFNGLUNLOCKARRAYSEXTPROC __glewUnlockArraysEXT; + +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER1DEXTPROC __glewConvolutionFilter1DEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONFILTER2DEXTPROC __glewConvolutionFilter2DEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFEXTPROC __glewConvolutionParameterfEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERFVEXTPROC __glewConvolutionParameterfvEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIEXTPROC __glewConvolutionParameteriEXT; +GLEW_FUN_EXPORT PFNGLCONVOLUTIONPARAMETERIVEXTPROC __glewConvolutionParameterivEXT; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC __glewCopyConvolutionFilter1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC __glewCopyConvolutionFilter2DEXT; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONFILTEREXTPROC __glewGetConvolutionFilterEXT; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC __glewGetConvolutionParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC __glewGetConvolutionParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETSEPARABLEFILTEREXTPROC __glewGetSeparableFilterEXT; +GLEW_FUN_EXPORT PFNGLSEPARABLEFILTER2DEXTPROC __glewSeparableFilter2DEXT; + +GLEW_FUN_EXPORT PFNGLBINORMALPOINTEREXTPROC __glewBinormalPointerEXT; +GLEW_FUN_EXPORT PFNGLTANGENTPOINTEREXTPROC __glewTangentPointerEXT; + +GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE1DEXTPROC __glewCopyTexImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXIMAGE2DEXTPROC __glewCopyTexImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE1DEXTPROC __glewCopyTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE2DEXTPROC __glewCopyTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DEXTPROC __glewCopyTexSubImage3DEXT; + +GLEW_FUN_EXPORT PFNGLCULLPARAMETERDVEXTPROC __glewCullParameterdvEXT; +GLEW_FUN_EXPORT PFNGLCULLPARAMETERFVEXTPROC __glewCullParameterfvEXT; + +GLEW_FUN_EXPORT PFNGLDEPTHBOUNDSEXTPROC __glewDepthBoundsEXT; + +GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT; + +GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTEREXTPROC __glewFogCoordPointerEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDDEXTPROC __glewFogCoorddEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDDVEXTPROC __glewFogCoorddvEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDFEXTPROC __glewFogCoordfEXT; +GLEW_FUN_EXPORT PFNGLFOGCOORDFVEXTPROC __glewFogCoordfvEXT; + +GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALEXTPROC __glewFragmentColorMaterialEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFEXTPROC __glewFragmentLightModelfEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVEXTPROC __glewFragmentLightModelfvEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIEXTPROC __glewFragmentLightModeliEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVEXTPROC __glewFragmentLightModelivEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFEXTPROC __glewFragmentLightfEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVEXTPROC __glewFragmentLightfvEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIEXTPROC __glewFragmentLightiEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVEXTPROC __glewFragmentLightivEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFEXTPROC __glewFragmentMaterialfEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVEXTPROC __glewFragmentMaterialfvEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIEXTPROC __glewFragmentMaterialiEXT; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVEXTPROC __glewFragmentMaterialivEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVEXTPROC __glewGetFragmentLightfvEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVEXTPROC __glewGetFragmentLightivEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVEXTPROC __glewGetFragmentMaterialfvEXT; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVEXTPROC __glewGetFragmentMaterialivEXT; +GLEW_FUN_EXPORT PFNGLLIGHTENVIEXTPROC __glewLightEnviEXT; + +GLEW_FUN_EXPORT PFNGLBLITFRAMEBUFFEREXTPROC __glewBlitFramebufferEXT; + +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __glewRenderbufferStorageMultisampleEXT; + +GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEREXTPROC __glewBindFramebufferEXT; +GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEREXTPROC __glewBindRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC __glewCheckFramebufferStatusEXT; +GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSEXTPROC __glewDeleteFramebuffersEXT; +GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSEXTPROC __glewDeleteRenderbuffersEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC __glewFramebufferRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DEXTPROC __glewFramebufferTexture1DEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DEXTPROC __glewFramebufferTexture2DEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DEXTPROC __glewFramebufferTexture3DEXT; +GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSEXTPROC __glewGenFramebuffersEXT; +GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSEXTPROC __glewGenRenderbuffersEXT; +GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPEXTPROC __glewGenerateMipmapEXT; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC __glewGetFramebufferAttachmentParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC __glewGetRenderbufferParameterivEXT; +GLEW_FUN_EXPORT PFNGLISFRAMEBUFFEREXTPROC __glewIsFramebufferEXT; +GLEW_FUN_EXPORT PFNGLISRENDERBUFFEREXTPROC __glewIsRenderbufferEXT; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEEXTPROC __glewRenderbufferStorageEXT; + +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMEXTPROC __glewGetHistogramEXT; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERFVEXTPROC __glewGetHistogramParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETHISTOGRAMPARAMETERIVEXTPROC __glewGetHistogramParameterivEXT; +GLEW_FUN_EXPORT PFNGLGETMINMAXEXTPROC __glewGetMinmaxEXT; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERFVEXTPROC __glewGetMinmaxParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETMINMAXPARAMETERIVEXTPROC __glewGetMinmaxParameterivEXT; +GLEW_FUN_EXPORT PFNGLHISTOGRAMEXTPROC __glewHistogramEXT; +GLEW_FUN_EXPORT PFNGLMINMAXEXTPROC __glewMinmaxEXT; +GLEW_FUN_EXPORT PFNGLRESETHISTOGRAMEXTPROC __glewResetHistogramEXT; +GLEW_FUN_EXPORT PFNGLRESETMINMAXEXTPROC __glewResetMinmaxEXT; + +GLEW_FUN_EXPORT PFNGLINDEXFUNCEXTPROC __glewIndexFuncEXT; + +GLEW_FUN_EXPORT PFNGLINDEXMATERIALEXTPROC __glewIndexMaterialEXT; + +GLEW_FUN_EXPORT PFNGLAPPLYTEXTUREEXTPROC __glewApplyTextureEXT; +GLEW_FUN_EXPORT PFNGLTEXTURELIGHTEXTPROC __glewTextureLightEXT; +GLEW_FUN_EXPORT PFNGLTEXTUREMATERIALEXTPROC __glewTextureMaterialEXT; + +GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSEXTPROC __glewMultiDrawArraysEXT; +GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSEXTPROC __glewMultiDrawElementsEXT; + +GLEW_FUN_EXPORT PFNGLSAMPLEMASKEXTPROC __glewSampleMaskEXT; +GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNEXTPROC __glewSamplePatternEXT; + +GLEW_FUN_EXPORT PFNGLCOLORTABLEEXTPROC __glewColorTableEXT; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEEXTPROC __glewGetColorTableEXT; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVEXTPROC __glewGetColorTableParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVEXTPROC __glewGetColorTableParameterivEXT; + +GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC __glewGetPixelTransformParameterfvEXT; +GLEW_FUN_EXPORT PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC __glewGetPixelTransformParameterivEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFEXTPROC __glewPixelTransformParameterfEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC __glewPixelTransformParameterfvEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIEXTPROC __glewPixelTransformParameteriEXT; +GLEW_FUN_EXPORT PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC __glewPixelTransformParameterivEXT; + +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFEXTPROC __glewPointParameterfEXT; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERFVEXTPROC __glewPointParameterfvEXT; + +GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT; + +GLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT; +GLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT; + +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BEXTPROC __glewSecondaryColor3bEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3BVEXTPROC __glewSecondaryColor3bvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DEXTPROC __glewSecondaryColor3dEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3DVEXTPROC __glewSecondaryColor3dvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FEXTPROC __glewSecondaryColor3fEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3FVEXTPROC __glewSecondaryColor3fvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IEXTPROC __glewSecondaryColor3iEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3IVEXTPROC __glewSecondaryColor3ivEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SEXTPROC __glewSecondaryColor3sEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3SVEXTPROC __glewSecondaryColor3svEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBEXTPROC __glewSecondaryColor3ubEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UBVEXTPROC __glewSecondaryColor3ubvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIEXTPROC __glewSecondaryColor3uiEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3UIVEXTPROC __glewSecondaryColor3uivEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USEXTPROC __glewSecondaryColor3usEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3USVEXTPROC __glewSecondaryColor3usvEXT; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTEREXTPROC __glewSecondaryColorPointerEXT; + +GLEW_FUN_EXPORT PFNGLACTIVESTENCILFACEEXTPROC __glewActiveStencilFaceEXT; + +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT; + +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT; + +GLEW_FUN_EXPORT PFNGLARETEXTURESRESIDENTEXTPROC __glewAreTexturesResidentEXT; +GLEW_FUN_EXPORT PFNGLBINDTEXTUREEXTPROC __glewBindTextureEXT; +GLEW_FUN_EXPORT PFNGLDELETETEXTURESEXTPROC __glewDeleteTexturesEXT; +GLEW_FUN_EXPORT PFNGLGENTEXTURESEXTPROC __glewGenTexturesEXT; +GLEW_FUN_EXPORT PFNGLISTEXTUREEXTPROC __glewIsTextureEXT; +GLEW_FUN_EXPORT PFNGLPRIORITIZETEXTURESEXTPROC __glewPrioritizeTexturesEXT; + +GLEW_FUN_EXPORT PFNGLTEXTURENORMALEXTPROC __glewTextureNormalEXT; + +GLEW_FUN_EXPORT PFNGLARRAYELEMENTEXTPROC __glewArrayElementEXT; +GLEW_FUN_EXPORT PFNGLCOLORPOINTEREXTPROC __glewColorPointerEXT; +GLEW_FUN_EXPORT PFNGLDRAWARRAYSEXTPROC __glewDrawArraysEXT; +GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTEREXTPROC __glewEdgeFlagPointerEXT; +GLEW_FUN_EXPORT PFNGLGETPOINTERVEXTPROC __glewGetPointervEXT; +GLEW_FUN_EXPORT PFNGLINDEXPOINTEREXTPROC __glewIndexPointerEXT; +GLEW_FUN_EXPORT PFNGLNORMALPOINTEREXTPROC __glewNormalPointerEXT; +GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTEREXTPROC __glewTexCoordPointerEXT; +GLEW_FUN_EXPORT PFNGLVERTEXPOINTEREXTPROC __glewVertexPointerEXT; + +GLEW_FUN_EXPORT PFNGLBEGINVERTEXSHADEREXTPROC __glewBeginVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLBINDLIGHTPARAMETEREXTPROC __glewBindLightParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDMATERIALPARAMETEREXTPROC __glewBindMaterialParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDPARAMETEREXTPROC __glewBindParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDTEXGENPARAMETEREXTPROC __glewBindTexGenParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDTEXTUREUNITPARAMETEREXTPROC __glewBindTextureUnitParameterEXT; +GLEW_FUN_EXPORT PFNGLBINDVERTEXSHADEREXTPROC __glewBindVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLDELETEVERTEXSHADEREXTPROC __glewDeleteVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC __glewDisableVariantClientStateEXT; +GLEW_FUN_EXPORT PFNGLENABLEVARIANTCLIENTSTATEEXTPROC __glewEnableVariantClientStateEXT; +GLEW_FUN_EXPORT PFNGLENDVERTEXSHADEREXTPROC __glewEndVertexShaderEXT; +GLEW_FUN_EXPORT PFNGLEXTRACTCOMPONENTEXTPROC __glewExtractComponentEXT; +GLEW_FUN_EXPORT PFNGLGENSYMBOLSEXTPROC __glewGenSymbolsEXT; +GLEW_FUN_EXPORT PFNGLGENVERTEXSHADERSEXTPROC __glewGenVertexShadersEXT; +GLEW_FUN_EXPORT PFNGLGETINVARIANTBOOLEANVEXTPROC __glewGetInvariantBooleanvEXT; +GLEW_FUN_EXPORT PFNGLGETINVARIANTFLOATVEXTPROC __glewGetInvariantFloatvEXT; +GLEW_FUN_EXPORT PFNGLGETINVARIANTINTEGERVEXTPROC __glewGetInvariantIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC __glewGetLocalConstantBooleanvEXT; +GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTFLOATVEXTPROC __glewGetLocalConstantFloatvEXT; +GLEW_FUN_EXPORT PFNGLGETLOCALCONSTANTINTEGERVEXTPROC __glewGetLocalConstantIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTBOOLEANVEXTPROC __glewGetVariantBooleanvEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTFLOATVEXTPROC __glewGetVariantFloatvEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTINTEGERVEXTPROC __glewGetVariantIntegervEXT; +GLEW_FUN_EXPORT PFNGLGETVARIANTPOINTERVEXTPROC __glewGetVariantPointervEXT; +GLEW_FUN_EXPORT PFNGLINSERTCOMPONENTEXTPROC __glewInsertComponentEXT; +GLEW_FUN_EXPORT PFNGLISVARIANTENABLEDEXTPROC __glewIsVariantEnabledEXT; +GLEW_FUN_EXPORT PFNGLSETINVARIANTEXTPROC __glewSetInvariantEXT; +GLEW_FUN_EXPORT PFNGLSETLOCALCONSTANTEXTPROC __glewSetLocalConstantEXT; +GLEW_FUN_EXPORT PFNGLSHADEROP1EXTPROC __glewShaderOp1EXT; +GLEW_FUN_EXPORT PFNGLSHADEROP2EXTPROC __glewShaderOp2EXT; +GLEW_FUN_EXPORT PFNGLSHADEROP3EXTPROC __glewShaderOp3EXT; +GLEW_FUN_EXPORT PFNGLSWIZZLEEXTPROC __glewSwizzleEXT; +GLEW_FUN_EXPORT PFNGLVARIANTPOINTEREXTPROC __glewVariantPointerEXT; +GLEW_FUN_EXPORT PFNGLVARIANTBVEXTPROC __glewVariantbvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTDVEXTPROC __glewVariantdvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTFVEXTPROC __glewVariantfvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTIVEXTPROC __glewVariantivEXT; +GLEW_FUN_EXPORT PFNGLVARIANTSVEXTPROC __glewVariantsvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTUBVEXTPROC __glewVariantubvEXT; +GLEW_FUN_EXPORT PFNGLVARIANTUIVEXTPROC __glewVariantuivEXT; +GLEW_FUN_EXPORT PFNGLVARIANTUSVEXTPROC __glewVariantusvEXT; +GLEW_FUN_EXPORT PFNGLWRITEMASKEXTPROC __glewWriteMaskEXT; + +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTPOINTEREXTPROC __glewVertexWeightPointerEXT; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFEXTPROC __glewVertexWeightfEXT; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTFVEXTPROC __glewVertexWeightfvEXT; + +GLEW_FUN_EXPORT PFNGLSTRINGMARKERGREMEDYPROC __glewStringMarkerGREMEDY; + +GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC __glewGetImageTransformParameterfvHP; +GLEW_FUN_EXPORT PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC __glewGetImageTransformParameterivHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFHPPROC __glewImageTransformParameterfHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERFVHPPROC __glewImageTransformParameterfvHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIHPPROC __glewImageTransformParameteriHP; +GLEW_FUN_EXPORT PFNGLIMAGETRANSFORMPARAMETERIVHPPROC __glewImageTransformParameterivHP; + +GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWARRAYSIBMPROC __glewMultiModeDrawArraysIBM; +GLEW_FUN_EXPORT PFNGLMULTIMODEDRAWELEMENTSIBMPROC __glewMultiModeDrawElementsIBM; + +GLEW_FUN_EXPORT PFNGLCOLORPOINTERLISTIBMPROC __glewColorPointerListIBM; +GLEW_FUN_EXPORT PFNGLEDGEFLAGPOINTERLISTIBMPROC __glewEdgeFlagPointerListIBM; +GLEW_FUN_EXPORT PFNGLFOGCOORDPOINTERLISTIBMPROC __glewFogCoordPointerListIBM; +GLEW_FUN_EXPORT PFNGLINDEXPOINTERLISTIBMPROC __glewIndexPointerListIBM; +GLEW_FUN_EXPORT PFNGLNORMALPOINTERLISTIBMPROC __glewNormalPointerListIBM; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointerListIBM; +GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM; +GLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM; + +GLEW_FUN_EXPORT PFNGLCOLORPOINTERVINTELPROC __glewColorPointervINTEL; +GLEW_FUN_EXPORT PFNGLNORMALPOINTERVINTELPROC __glewNormalPointervINTEL; +GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERVINTELPROC __glewTexCoordPointervINTEL; +GLEW_FUN_EXPORT PFNGLVERTEXPOINTERVINTELPROC __glewVertexPointervINTEL; + +GLEW_FUN_EXPORT PFNGLTEXSCISSORFUNCINTELPROC __glewTexScissorFuncINTEL; +GLEW_FUN_EXPORT PFNGLTEXSCISSORINTELPROC __glewTexScissorINTEL; + +GLEW_FUN_EXPORT PFNGLBUFFERREGIONENABLEDEXTPROC __glewBufferRegionEnabledEXT; +GLEW_FUN_EXPORT PFNGLDELETEBUFFERREGIONEXTPROC __glewDeleteBufferRegionEXT; +GLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONEXTPROC __glewDrawBufferRegionEXT; +GLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONEXTPROC __glewNewBufferRegionEXT; +GLEW_FUN_EXPORT PFNGLREADBUFFERREGIONEXTPROC __glewReadBufferRegionEXT; + +GLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA; + +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2DVMESAPROC __glewWindowPos2dvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FMESAPROC __glewWindowPos2fMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2FVMESAPROC __glewWindowPos2fvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IMESAPROC __glewWindowPos2iMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2IVMESAPROC __glewWindowPos2ivMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SMESAPROC __glewWindowPos2sMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS2SVMESAPROC __glewWindowPos2svMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DMESAPROC __glewWindowPos3dMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3DVMESAPROC __glewWindowPos3dvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FMESAPROC __glewWindowPos3fMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3FVMESAPROC __glewWindowPos3fvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IMESAPROC __glewWindowPos3iMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3IVMESAPROC __glewWindowPos3ivMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SMESAPROC __glewWindowPos3sMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS3SVMESAPROC __glewWindowPos3svMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4DMESAPROC __glewWindowPos4dMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4DVMESAPROC __glewWindowPos4dvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4FMESAPROC __glewWindowPos4fMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4FVMESAPROC __glewWindowPos4fvMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4IMESAPROC __glewWindowPos4iMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4IVMESAPROC __glewWindowPos4ivMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4SMESAPROC __glewWindowPos4sMESA; +GLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA; + +GLEW_FUN_EXPORT PFNGLEVALMAPSNVPROC __glewEvalMapsNV; +GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERFVNVPROC __glewGetMapAttribParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETMAPATTRIBPARAMETERIVNVPROC __glewGetMapAttribParameterivNV; +GLEW_FUN_EXPORT PFNGLGETMAPCONTROLPOINTSNVPROC __glewGetMapControlPointsNV; +GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERFVNVPROC __glewGetMapParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETMAPPARAMETERIVNVPROC __glewGetMapParameterivNV; +GLEW_FUN_EXPORT PFNGLMAPCONTROLPOINTSNVPROC __glewMapControlPointsNV; +GLEW_FUN_EXPORT PFNGLMAPPARAMETERFVNVPROC __glewMapParameterfvNV; +GLEW_FUN_EXPORT PFNGLMAPPARAMETERIVNVPROC __glewMapParameterivNV; + +GLEW_FUN_EXPORT PFNGLDELETEFENCESNVPROC __glewDeleteFencesNV; +GLEW_FUN_EXPORT PFNGLFINISHFENCENVPROC __glewFinishFenceNV; +GLEW_FUN_EXPORT PFNGLGENFENCESNVPROC __glewGenFencesNV; +GLEW_FUN_EXPORT PFNGLGETFENCEIVNVPROC __glewGetFenceivNV; +GLEW_FUN_EXPORT PFNGLISFENCENVPROC __glewIsFenceNV; +GLEW_FUN_EXPORT PFNGLSETFENCENVPROC __glewSetFenceNV; +GLEW_FUN_EXPORT PFNGLTESTFENCENVPROC __glewTestFenceNV; + +GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC __glewGetProgramNamedParameterdvNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC __glewGetProgramNamedParameterfvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DNVPROC __glewProgramNamedParameter4dNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC __glewProgramNamedParameter4dvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FNVPROC __glewProgramNamedParameter4fNV; +GLEW_FUN_EXPORT PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC __glewProgramNamedParameter4fvNV; + +GLEW_FUN_EXPORT PFNGLCOLOR3HNVPROC __glewColor3hNV; +GLEW_FUN_EXPORT PFNGLCOLOR3HVNVPROC __glewColor3hvNV; +GLEW_FUN_EXPORT PFNGLCOLOR4HNVPROC __glewColor4hNV; +GLEW_FUN_EXPORT PFNGLCOLOR4HVNVPROC __glewColor4hvNV; +GLEW_FUN_EXPORT PFNGLFOGCOORDHNVPROC __glewFogCoordhNV; +GLEW_FUN_EXPORT PFNGLFOGCOORDHVNVPROC __glewFogCoordhvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HNVPROC __glewMultiTexCoord1hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD1HVNVPROC __glewMultiTexCoord1hvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HNVPROC __glewMultiTexCoord2hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD2HVNVPROC __glewMultiTexCoord2hvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HNVPROC __glewMultiTexCoord3hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD3HVNVPROC __glewMultiTexCoord3hvNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HNVPROC __glewMultiTexCoord4hNV; +GLEW_FUN_EXPORT PFNGLMULTITEXCOORD4HVNVPROC __glewMultiTexCoord4hvNV; +GLEW_FUN_EXPORT PFNGLNORMAL3HNVPROC __glewNormal3hNV; +GLEW_FUN_EXPORT PFNGLNORMAL3HVNVPROC __glewNormal3hvNV; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HNVPROC __glewSecondaryColor3hNV; +GLEW_FUN_EXPORT PFNGLSECONDARYCOLOR3HVNVPROC __glewSecondaryColor3hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD1HNVPROC __glewTexCoord1hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD1HVNVPROC __glewTexCoord1hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD2HNVPROC __glewTexCoord2hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD2HVNVPROC __glewTexCoord2hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD3HNVPROC __glewTexCoord3hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD3HVNVPROC __glewTexCoord3hvNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD4HNVPROC __glewTexCoord4hNV; +GLEW_FUN_EXPORT PFNGLTEXCOORD4HVNVPROC __glewTexCoord4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEX2HNVPROC __glewVertex2hNV; +GLEW_FUN_EXPORT PFNGLVERTEX2HVNVPROC __glewVertex2hvNV; +GLEW_FUN_EXPORT PFNGLVERTEX3HNVPROC __glewVertex3hNV; +GLEW_FUN_EXPORT PFNGLVERTEX3HVNVPROC __glewVertex3hvNV; +GLEW_FUN_EXPORT PFNGLVERTEX4HNVPROC __glewVertex4hNV; +GLEW_FUN_EXPORT PFNGLVERTEX4HVNVPROC __glewVertex4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HNVPROC __glewVertexAttrib1hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1HVNVPROC __glewVertexAttrib1hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HNVPROC __glewVertexAttrib2hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2HVNVPROC __glewVertexAttrib2hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HNVPROC __glewVertexAttrib3hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3HVNVPROC __glewVertexAttrib3hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HNVPROC __glewVertexAttrib4hNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4HVNVPROC __glewVertexAttrib4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1HVNVPROC __glewVertexAttribs1hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2HVNVPROC __glewVertexAttribs2hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3HVNVPROC __glewVertexAttribs3hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4HVNVPROC __glewVertexAttribs4hvNV; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHNVPROC __glewVertexWeighthNV; +GLEW_FUN_EXPORT PFNGLVERTEXWEIGHTHVNVPROC __glewVertexWeighthvNV; + +GLEW_FUN_EXPORT PFNGLBEGINOCCLUSIONQUERYNVPROC __glewBeginOcclusionQueryNV; +GLEW_FUN_EXPORT PFNGLDELETEOCCLUSIONQUERIESNVPROC __glewDeleteOcclusionQueriesNV; +GLEW_FUN_EXPORT PFNGLENDOCCLUSIONQUERYNVPROC __glewEndOcclusionQueryNV; +GLEW_FUN_EXPORT PFNGLGENOCCLUSIONQUERIESNVPROC __glewGenOcclusionQueriesNV; +GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYIVNVPROC __glewGetOcclusionQueryivNV; +GLEW_FUN_EXPORT PFNGLGETOCCLUSIONQUERYUIVNVPROC __glewGetOcclusionQueryuivNV; +GLEW_FUN_EXPORT PFNGLISOCCLUSIONQUERYNVPROC __glewIsOcclusionQueryNV; + +GLEW_FUN_EXPORT PFNGLFLUSHPIXELDATARANGENVPROC __glewFlushPixelDataRangeNV; +GLEW_FUN_EXPORT PFNGLPIXELDATARANGENVPROC __glewPixelDataRangeNV; + +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERINVPROC __glewPointParameteriNV; +GLEW_FUN_EXPORT PFNGLPOINTPARAMETERIVNVPROC __glewPointParameterivNV; + +GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV; +GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV; + +GLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV; +GLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFVNVPROC __glewCombinerParameterfvNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERINVPROC __glewCombinerParameteriNV; +GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERIVNVPROC __glewCombinerParameterivNV; +GLEW_FUN_EXPORT PFNGLFINALCOMBINERINPUTNVPROC __glewFinalCombinerInputNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC __glewGetCombinerInputParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC __glewGetCombinerInputParameterivNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC __glewGetCombinerOutputParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC __glewGetCombinerOutputParameterivNV; +GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC __glewGetFinalCombinerInputParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC __glewGetFinalCombinerInputParameterivNV; + +GLEW_FUN_EXPORT PFNGLCOMBINERSTAGEPARAMETERFVNVPROC __glewCombinerStageParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStageParameterfvNV; + +GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV; +GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV; + +GLEW_FUN_EXPORT PFNGLAREPROGRAMSRESIDENTNVPROC __glewAreProgramsResidentNV; +GLEW_FUN_EXPORT PFNGLBINDPROGRAMNVPROC __glewBindProgramNV; +GLEW_FUN_EXPORT PFNGLDELETEPROGRAMSNVPROC __glewDeleteProgramsNV; +GLEW_FUN_EXPORT PFNGLEXECUTEPROGRAMNVPROC __glewExecuteProgramNV; +GLEW_FUN_EXPORT PFNGLGENPROGRAMSNVPROC __glewGenProgramsNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERDVNVPROC __glewGetProgramParameterdvNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMPARAMETERFVNVPROC __glewGetProgramParameterfvNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMSTRINGNVPROC __glewGetProgramStringNV; +GLEW_FUN_EXPORT PFNGLGETPROGRAMIVNVPROC __glewGetProgramivNV; +GLEW_FUN_EXPORT PFNGLGETTRACKMATRIXIVNVPROC __glewGetTrackMatrixivNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBPOINTERVNVPROC __glewGetVertexAttribPointervNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBDVNVPROC __glewGetVertexAttribdvNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBFVNVPROC __glewGetVertexAttribfvNV; +GLEW_FUN_EXPORT PFNGLGETVERTEXATTRIBIVNVPROC __glewGetVertexAttribivNV; +GLEW_FUN_EXPORT PFNGLISPROGRAMNVPROC __glewIsProgramNV; +GLEW_FUN_EXPORT PFNGLLOADPROGRAMNVPROC __glewLoadProgramNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DNVPROC __glewProgramParameter4dNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4DVNVPROC __glewProgramParameter4dvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FNVPROC __glewProgramParameter4fNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETER4FVNVPROC __glewProgramParameter4fvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4DVNVPROC __glewProgramParameters4dvNV; +GLEW_FUN_EXPORT PFNGLPROGRAMPARAMETERS4FVNVPROC __glewProgramParameters4fvNV; +GLEW_FUN_EXPORT PFNGLREQUESTRESIDENTPROGRAMSNVPROC __glewRequestResidentProgramsNV; +GLEW_FUN_EXPORT PFNGLTRACKMATRIXNVPROC __glewTrackMatrixNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DNVPROC __glewVertexAttrib1dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1DVNVPROC __glewVertexAttrib1dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FNVPROC __glewVertexAttrib1fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1FVNVPROC __glewVertexAttrib1fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SNVPROC __glewVertexAttrib1sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB1SVNVPROC __glewVertexAttrib1svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DNVPROC __glewVertexAttrib2dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2DVNVPROC __glewVertexAttrib2dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FNVPROC __glewVertexAttrib2fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2FVNVPROC __glewVertexAttrib2fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SNVPROC __glewVertexAttrib2sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB2SVNVPROC __glewVertexAttrib2svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DNVPROC __glewVertexAttrib3dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3DVNVPROC __glewVertexAttrib3dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FNVPROC __glewVertexAttrib3fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3FVNVPROC __glewVertexAttrib3fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SNVPROC __glewVertexAttrib3sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB3SVNVPROC __glewVertexAttrib3svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DNVPROC __glewVertexAttrib4dNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4DVNVPROC __glewVertexAttrib4dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FNVPROC __glewVertexAttrib4fNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4FVNVPROC __glewVertexAttrib4fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SNVPROC __glewVertexAttrib4sNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4SVNVPROC __glewVertexAttrib4svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBNVPROC __glewVertexAttrib4ubNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIB4UBVNVPROC __glewVertexAttrib4ubvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBPOINTERNVPROC __glewVertexAttribPointerNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1DVNVPROC __glewVertexAttribs1dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1FVNVPROC __glewVertexAttribs1fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS1SVNVPROC __glewVertexAttribs1svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2DVNVPROC __glewVertexAttribs2dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2FVNVPROC __glewVertexAttribs2fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS2SVNVPROC __glewVertexAttribs2svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3DVNVPROC __glewVertexAttribs3dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3FVNVPROC __glewVertexAttribs3fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS3SVNVPROC __glewVertexAttribs3svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4DVNVPROC __glewVertexAttribs4dvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4FVNVPROC __glewVertexAttribs4fvNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4SVNVPROC __glewVertexAttribs4svNV; +GLEW_FUN_EXPORT PFNGLVERTEXATTRIBS4UBVNVPROC __glewVertexAttribs4ubvNV; + +GLEW_FUN_EXPORT PFNGLDETAILTEXFUNCSGISPROC __glewDetailTexFuncSGIS; +GLEW_FUN_EXPORT PFNGLGETDETAILTEXFUNCSGISPROC __glewGetDetailTexFuncSGIS; + +GLEW_FUN_EXPORT PFNGLFOGFUNCSGISPROC __glewFogFuncSGIS; +GLEW_FUN_EXPORT PFNGLGETFOGFUNCSGISPROC __glewGetFogFuncSGIS; + +GLEW_FUN_EXPORT PFNGLSAMPLEMASKSGISPROC __glewSampleMaskSGIS; +GLEW_FUN_EXPORT PFNGLSAMPLEPATTERNSGISPROC __glewSamplePatternSGIS; + +GLEW_FUN_EXPORT PFNGLGETSHARPENTEXFUNCSGISPROC __glewGetSharpenTexFuncSGIS; +GLEW_FUN_EXPORT PFNGLSHARPENTEXFUNCSGISPROC __glewSharpenTexFuncSGIS; + +GLEW_FUN_EXPORT PFNGLTEXIMAGE4DSGISPROC __glewTexImage4DSGIS; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE4DSGISPROC __glewTexSubImage4DSGIS; + +GLEW_FUN_EXPORT PFNGLGETTEXFILTERFUNCSGISPROC __glewGetTexFilterFuncSGIS; +GLEW_FUN_EXPORT PFNGLTEXFILTERFUNCSGISPROC __glewTexFilterFuncSGIS; + +GLEW_FUN_EXPORT PFNGLASYNCMARKERSGIXPROC __glewAsyncMarkerSGIX; +GLEW_FUN_EXPORT PFNGLDELETEASYNCMARKERSSGIXPROC __glewDeleteAsyncMarkersSGIX; +GLEW_FUN_EXPORT PFNGLFINISHASYNCSGIXPROC __glewFinishAsyncSGIX; +GLEW_FUN_EXPORT PFNGLGENASYNCMARKERSSGIXPROC __glewGenAsyncMarkersSGIX; +GLEW_FUN_EXPORT PFNGLISASYNCMARKERSGIXPROC __glewIsAsyncMarkerSGIX; +GLEW_FUN_EXPORT PFNGLPOLLASYNCSGIXPROC __glewPollAsyncSGIX; + +GLEW_FUN_EXPORT PFNGLFLUSHRASTERSGIXPROC __glewFlushRasterSGIX; + +GLEW_FUN_EXPORT PFNGLTEXTUREFOGSGIXPROC __glewTextureFogSGIX; + +GLEW_FUN_EXPORT PFNGLFRAGMENTCOLORMATERIALSGIXPROC __glewFragmentColorMaterialSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFSGIXPROC __glewFragmentLightModelfSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELFVSGIXPROC __glewFragmentLightModelfvSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELISGIXPROC __glewFragmentLightModeliSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTMODELIVSGIXPROC __glewFragmentLightModelivSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFSGIXPROC __glewFragmentLightfSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTFVSGIXPROC __glewFragmentLightfvSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTISGIXPROC __glewFragmentLightiSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTLIGHTIVSGIXPROC __glewFragmentLightivSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFSGIXPROC __glewFragmentMaterialfSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALFVSGIXPROC __glewFragmentMaterialfvSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALISGIXPROC __glewFragmentMaterialiSGIX; +GLEW_FUN_EXPORT PFNGLFRAGMENTMATERIALIVSGIXPROC __glewFragmentMaterialivSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTFVSGIXPROC __glewGetFragmentLightfvSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTLIGHTIVSGIXPROC __glewGetFragmentLightivSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALFVSGIXPROC __glewGetFragmentMaterialfvSGIX; +GLEW_FUN_EXPORT PFNGLGETFRAGMENTMATERIALIVSGIXPROC __glewGetFragmentMaterialivSGIX; + +GLEW_FUN_EXPORT PFNGLFRAMEZOOMSGIXPROC __glewFrameZoomSGIX; + +GLEW_FUN_EXPORT PFNGLPIXELTEXGENSGIXPROC __glewPixelTexGenSGIX; + +GLEW_FUN_EXPORT PFNGLREFERENCEPLANESGIXPROC __glewReferencePlaneSGIX; + +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFSGIXPROC __glewSpriteParameterfSGIX; +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERFVSGIXPROC __glewSpriteParameterfvSGIX; +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERISGIXPROC __glewSpriteParameteriSGIX; +GLEW_FUN_EXPORT PFNGLSPRITEPARAMETERIVSGIXPROC __glewSpriteParameterivSGIX; + +GLEW_FUN_EXPORT PFNGLTAGSAMPLEBUFFERSGIXPROC __glewTagSampleBufferSGIX; + +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERFVSGIPROC __glewColorTableParameterfvSGI; +GLEW_FUN_EXPORT PFNGLCOLORTABLEPARAMETERIVSGIPROC __glewColorTableParameterivSGI; +GLEW_FUN_EXPORT PFNGLCOLORTABLESGIPROC __glewColorTableSGI; +GLEW_FUN_EXPORT PFNGLCOPYCOLORTABLESGIPROC __glewCopyColorTableSGI; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERFVSGIPROC __glewGetColorTableParameterfvSGI; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLEPARAMETERIVSGIPROC __glewGetColorTableParameterivSGI; +GLEW_FUN_EXPORT PFNGLGETCOLORTABLESGIPROC __glewGetColorTableSGI; + +GLEW_FUN_EXPORT PFNGLFINISHTEXTURESUNXPROC __glewFinishTextureSUNX; + +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORBSUNPROC __glewGlobalAlphaFactorbSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORDSUNPROC __glewGlobalAlphaFactordSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORFSUNPROC __glewGlobalAlphaFactorfSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORISUNPROC __glewGlobalAlphaFactoriSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORSSUNPROC __glewGlobalAlphaFactorsSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUBSUNPROC __glewGlobalAlphaFactorubSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUISUNPROC __glewGlobalAlphaFactoruiSUN; +GLEW_FUN_EXPORT PFNGLGLOBALALPHAFACTORUSSUNPROC __glewGlobalAlphaFactorusSUN; + +GLEW_FUN_EXPORT PFNGLREADVIDEOPIXELSSUNPROC __glewReadVideoPixelsSUN; + +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEPOINTERSUNPROC __glewReplacementCodePointerSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBSUNPROC __glewReplacementCodeubSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUBVSUNPROC __glewReplacementCodeubvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUISUNPROC __glewReplacementCodeuiSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVSUNPROC __glewReplacementCodeuivSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSSUNPROC __glewReplacementCodeusSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUSVSUNPROC __glewReplacementCodeusvSUN; + +GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FSUNPROC __glewColor3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR3FVERTEX3FVSUNPROC __glewColor3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FSUNPROC __glewColor4ubVertex2fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX2FVSUNPROC __glewColor4ubVertex2fvSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FSUNPROC __glewColor4ubVertex3fSUN; +GLEW_FUN_EXPORT PFNGLCOLOR4UBVERTEX3FVSUNPROC __glewColor4ubVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FSUNPROC __glewNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLNORMAL3FVERTEX3FVSUNPROC __glewNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC __glewReplacementCodeuiColor3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC __glewReplacementCodeuiColor4ubVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC __glewReplacementCodeuiColor4ubVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC __glewReplacementCodeuiTexCoord2fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC __glewReplacementCodeuiVertex3fSUN; +GLEW_FUN_EXPORT PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC __glewReplacementCodeuiVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC __glewTexCoord2fColor3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC __glewTexCoord2fColor3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fColor4fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC __glewTexCoord2fColor4ubVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC __glewTexCoord2fColor4ubVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC __glewTexCoord2fNormal3fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC __glewTexCoord2fNormal3fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FSUNPROC __glewTexCoord2fVertex3fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD2FVERTEX3FVSUNPROC __glewTexCoord2fVertex3fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC __glewTexCoord4fColor4fNormal3fVertex4fvSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FSUNPROC __glewTexCoord4fVertex4fSUN; +GLEW_FUN_EXPORT PFNGLTEXCOORD4FVERTEX4FVSUNPROC __glewTexCoord4fVertex4fvSUN; + +GLEW_FUN_EXPORT PFNGLADDSWAPHINTRECTWINPROC __glewAddSwapHintRectWIN; + +#if defined(GLEW_MX) && !defined(_WIN32) +struct GLEWContextStruct +{ +#endif /* GLEW_MX */ + +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5; +GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0; +GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_tbuffer; +GLEW_VAR_EXPORT GLboolean __GLEW_3DFX_texture_compression_FXT1; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_client_storage; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_element_array; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_fence; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_float_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_pixel_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_specular_vector; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_texture_range; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_transform_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_vertex_array_range; +GLEW_VAR_EXPORT GLboolean __GLEW_APPLE_ycbcr_422; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_color_buffer_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_depth_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_draw_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_program_shadow; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_fragment_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_half_float_pixel; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_imaging; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_matrix_palette; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_multitexture; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_occlusion_query; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_pixel_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_point_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shader_objects; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shading_language_100; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_shadow_ambient; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_border_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_compression; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_add; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_combine; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_crossbar; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_env_dot3; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_mirrored_repeat; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_non_power_of_two; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_texture_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_transpose_matrix; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_blend; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_program; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_vertex_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ARB_window_pos; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route; +GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_vertex_shader_output_point_size; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_draw_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_element_array; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_envmap_bumpmap; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_fragment_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_map_object_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_pn_triangles; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_separate_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_text_fragment_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_compression_3dc; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_env_combine3; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_float; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_bgra; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_color; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_equation_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_func_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_logic_op; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_color_subtable; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_compiled_vertex_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_convolution; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_coordinate_frame; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_copy_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fragment_lighting; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_blit; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_framebuffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_histogram; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_array_formats; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_func; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_material; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_index_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_light_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_misc_attribute; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multi_draw_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_paletted_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pixel_transform_color_table; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_secondary_color; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_funcs; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_add; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_combine; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting; +GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_image_transform; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_occlusion_test; +GLEW_VAR_EXPORT GLboolean __GLEW_HP_texture_lighting; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_cull_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_multimode_draw_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat; +GLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists; +GLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor; +GLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region; +GLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_evaluators; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fence; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_float_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fog_distance; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_half_float; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_occlusion_query; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_packed_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_pixel_data_range; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_emboss; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texgen_reflection; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_compression_vtc; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_env_combine4; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_expand_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_rectangle; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_texture_shader3; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program1_1; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program2_option; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_program3; +GLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace; +GLEW_VAR_EXPORT GLboolean __GLEW_OML_resample; +GLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample; +GLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints; +GLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints; +GLEW_VAR_EXPORT GLboolean __GLEW_REND_screen_coordinates; +GLEW_VAR_EXPORT GLboolean __GLEW_S3_s3tc; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_color_range; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_detail_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_fog_function; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_generate_mipmap; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_pixel_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_sharpen_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture4D; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_border_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_edge_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_filter4; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_lod; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIS_texture_select; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_histogram; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_async_pixel; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_blend_alpha_minmax; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_clipmap; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_depth_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_flush_raster; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_offset; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fog_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_fragment_specular_lighting; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_framezoom; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_interlace; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ir_instrument1; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_list_priority; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_pixel_texture_bits; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_reference_plane; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_resample; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_shadow_ambient; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_tag_sample_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_add_env; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_coordinate_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_lod_bias; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_multi_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_range; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_texture_scale_bias; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_vertex_preclip_hint; +GLEW_VAR_EXPORT GLboolean __GLEW_SGIX_ycrcb; +GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_matrix; +GLEW_VAR_EXPORT GLboolean __GLEW_SGI_color_table; +GLEW_VAR_EXPORT GLboolean __GLEW_SGI_texture_color_table; +GLEW_VAR_EXPORT GLboolean __GLEW_SUNX_constant_data; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_convolution_border_modes; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_global_alpha; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_mesh_array; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list; +GLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading; +GLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog; +GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; + +#ifdef GLEW_MX +}; /* GLEWContextStruct */ +#endif /* GLEW_MX */ + +/* ------------------------------------------------------------------------- */ + +/* error codes */ +#define GLEW_OK 0 +#define GLEW_NO_ERROR 0 +#define GLEW_ERROR_NO_GL_VERSION 1 /* missing GL version */ +#define GLEW_ERROR_GL_VERSION_10_ONLY 2 /* GL 1.1 and up are not supported */ +#define GLEW_ERROR_GLX_VERSION_11_ONLY 3 /* GLX 1.2 and up are not supported */ + +/* string codes */ +#define GLEW_VERSION 1 + +/* API */ +#ifdef GLEW_MX + +typedef struct GLEWContextStruct GLEWContext; +GLEWAPI GLenum glewContextInit (GLEWContext* ctx); +GLEWAPI GLboolean glewContextIsSupported (GLEWContext* ctx, const char* name); + +#define glewInit() glewContextInit(glewGetContext()) +#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x) +#define glewIsExtensionSupported(x) glewIsSupported(x) + +#ifdef _WIN32 +# define GLEW_GET_VAR(x) glewGetContext()->x +# define GLEW_GET_FUN(x) glewGetContext()->x +#else +# define GLEW_GET_VAR(x) glewGetContext()->x +# define GLEW_GET_FUN(x) x +#endif + +#else /* GLEW_MX */ + +GLEWAPI GLenum glewInit (); +GLEWAPI GLboolean glewIsSupported (const char* name); +#define glewIsExtensionSupported(x) glewIsSupported(x) + +#define GLEW_GET_VAR(x) x +#define GLEW_GET_FUN(x) x + +#endif /* GLEW_MX */ + +GLEWAPI GLboolean glewExperimental; +GLEWAPI GLboolean glewGetExtension (const char* name); +GLEWAPI const GLubyte* glewGetErrorString (GLenum error); +GLEWAPI const GLubyte* glewGetString (GLenum name); + +#ifdef __cplusplus +} +#endif + +#ifdef GLEW_APIENTRY_DEFINED +#undef GLEW_APIENTRY_DEFINED +#undef APIENTRY +#undef GLAPIENTRY +#endif + +#ifdef GLEW_CALLBACK_DEFINED +#undef GLEW_CALLBACK_DEFINED +#undef CALLBACK +#endif + +#ifdef GLEW_WINGDIAPI_DEFINED +#undef GLEW_WINGDIAPI_DEFINED +#undef WINGDIAPI +#endif + +#undef GLAPI +/* #undef GLEWAPI */ + +#endif /* __glew_h__ */ diff --git a/src/SFML/Graphics/GLEW/glxew.h b/src/SFML/Graphics/GLEW/glxew.h new file mode 100644 index 00000000..205c051b --- /dev/null +++ b/src/SFML/Graphics/GLEW/glxew.h @@ -0,0 +1,1062 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2002-2006, Milan Ikits +** Copyright (C) 2002-2006, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* +** The contents of this file are subject to the GLX Public License Version 1.0 +** (the "License"). You may not use this file except in compliance with the +** License. You may obtain a copy of the License at Silicon Graphics, Inc., +** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +** or at http://www.sgi.com/software/opensource/glx/license.html. +** +** Software distributed under the License is distributed on an "AS IS" +** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY +** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR +** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific +** language governing rights and limitations under the License. +** +** The Original Software is GLX version 1.2 source code, released February, +** 1999. The developer of the Original Software is Silicon Graphics, Inc. +** Those portions of the Subject Software created by Silicon Graphics, Inc. +** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. +*/ + +#ifndef __glxew_h__ +#define __glxew_h__ +#define __GLXEW_H__ + +#ifdef __glxext_h_ +#error glxext.h included before glxew.h +#endif + +#define __glxext_h_ +#define __GLX_glx_h__ + +#include +#include +#include +#include "glew.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ---------------------------- GLX_VERSION_1_0 --------------------------- */ + +#ifndef GLX_VERSION_1_0 +#define GLX_VERSION_1_0 1 + +#define GLX_USE_GL 1 +#define GLX_BUFFER_SIZE 2 +#define GLX_LEVEL 3 +#define GLX_RGBA 4 +#define GLX_DOUBLEBUFFER 5 +#define GLX_STEREO 6 +#define GLX_AUX_BUFFERS 7 +#define GLX_RED_SIZE 8 +#define GLX_GREEN_SIZE 9 +#define GLX_BLUE_SIZE 10 +#define GLX_ALPHA_SIZE 11 +#define GLX_DEPTH_SIZE 12 +#define GLX_STENCIL_SIZE 13 +#define GLX_ACCUM_RED_SIZE 14 +#define GLX_ACCUM_GREEN_SIZE 15 +#define GLX_ACCUM_BLUE_SIZE 16 +#define GLX_ACCUM_ALPHA_SIZE 17 +#define GLX_BAD_SCREEN 1 +#define GLX_BAD_ATTRIBUTE 2 +#define GLX_NO_EXTENSION 3 +#define GLX_BAD_VISUAL 4 +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + +typedef XID GLXDrawable; +typedef XID GLXPixmap; +typedef struct __GLXcontextRec *GLXContext; + +extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); +extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); +extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value); +extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList); +extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap); +extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix); +extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); +extern void glXDestroyContext (Display *dpy, GLXContext ctx); +extern Bool glXIsDirect (Display *dpy, GLXContext ctx); +extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLuint mask); +extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx); +extern GLXContext glXGetCurrentContext (void); +extern GLXDrawable glXGetCurrentDrawable (void); +extern void glXWaitGL (void); +extern void glXWaitX (void); +extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); +extern void glXUseXFont (Font font, int first, int count, int listBase); + +#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0) + +#endif /* GLX_VERSION_1_0 */ + +/* ---------------------------- GLX_VERSION_1_1 --------------------------- */ + +#ifndef GLX_VERSION_1_1 +#define GLX_VERSION_1_1 + +#define GLX_VENDOR 0x1 +#define GLX_VERSION 0x2 +#define GLX_EXTENSIONS 0x3 + +extern const char* glXQueryExtensionsString (Display *dpy, int screen); +extern const char* glXGetClientString (Display *dpy, int name); +extern const char* glXQueryServerString (Display *dpy, int screen, int name); + +#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1) + +#endif /* GLX_VERSION_1_1 */ + +/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */ + +#ifndef GLX_VERSION_1_2 +#define GLX_VERSION_1_2 1 + +typedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void); + +#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay) + +#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2) + +#endif /* GLX_VERSION_1_2 */ + +/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */ + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 + +#define GLX_RGBA_BIT 0x00000001 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_DONT_CARE 0xFFFFFFFF + +typedef XID GLXFBConfigID; +typedef XID GLXWindow; +typedef XID GLXPbuffer; +typedef struct __GLXFBConfigRec *GLXFBConfig; +typedef struct { int event_type; int draw_type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; unsigned int buffer_mask; unsigned int aux_buffer; int x, y; int width, height; int count; } GLXPbufferClobberEvent; +typedef union __GLXEvent { GLXPbufferClobberEvent glxpbufferclobber; long pad[24]; } GLXEvent; + +typedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); + +#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig) +#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext) +#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer) +#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap) +#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow) +#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer) +#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap) +#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow) +#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable) +#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib) +#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs) +#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent) +#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig) +#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent) +#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext) +#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable) +#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent) + +#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3) + +#endif /* GLX_VERSION_1_3 */ + +/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */ + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 + +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 + +extern void ( * glXGetProcAddress (const GLubyte *procName)) (void); + +#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4) + +#endif /* GLX_VERSION_1_4 */ + +/* -------------------------- GLX_3DFX_multisample ------------------------- */ + +#ifndef GLX_3DFX_multisample +#define GLX_3DFX_multisample 1 + +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 + +#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample) + +#endif /* GLX_3DFX_multisample */ + +/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */ + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 + +#define GLX_RGBA_FLOAT_BIT 0x00000004 +#define GLX_RGBA_FLOAT_TYPE 0x20B9 + +#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float) + +#endif /* GLX_ARB_fbconfig_float */ + +/* ------------------------ GLX_ARB_get_proc_address ----------------------- */ + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 + +extern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void); + +#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address) + +#endif /* GLX_ARB_get_proc_address */ + +/* -------------------------- GLX_ARB_multisample -------------------------- */ + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 + +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 + +#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample) + +#endif /* GLX_ARB_multisample */ + +/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */ + +#ifndef GLX_ATI_pixel_format_float +#define GLX_ATI_pixel_format_float 1 + +#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100 + +#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float) + +#endif /* GLX_ATI_pixel_format_float */ + +/* ------------------------- GLX_ATI_render_texture ------------------------ */ + +#ifndef GLX_ATI_render_texture +#define GLX_ATI_render_texture 1 + +#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800 +#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801 +#define GLX_TEXTURE_FORMAT_ATI 0x9802 +#define GLX_TEXTURE_TARGET_ATI 0x9803 +#define GLX_MIPMAP_TEXTURE_ATI 0x9804 +#define GLX_TEXTURE_RGB_ATI 0x9805 +#define GLX_TEXTURE_RGBA_ATI 0x9806 +#define GLX_NO_TEXTURE_ATI 0x9807 +#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808 +#define GLX_TEXTURE_1D_ATI 0x9809 +#define GLX_TEXTURE_2D_ATI 0x980A +#define GLX_MIPMAP_LEVEL_ATI 0x980B +#define GLX_CUBE_MAP_FACE_ATI 0x980C +#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D +#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E +#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F +#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810 +#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811 +#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812 +#define GLX_FRONT_LEFT_ATI 0x9813 +#define GLX_FRONT_RIGHT_ATI 0x9814 +#define GLX_BACK_LEFT_ATI 0x9815 +#define GLX_BACK_RIGHT_ATI 0x9816 +#define GLX_AUX0_ATI 0x9817 +#define GLX_AUX1_ATI 0x9818 +#define GLX_AUX2_ATI 0x9819 +#define GLX_AUX3_ATI 0x981A +#define GLX_AUX4_ATI 0x981B +#define GLX_AUX5_ATI 0x981C +#define GLX_AUX6_ATI 0x981D +#define GLX_AUX7_ATI 0x981E +#define GLX_AUX8_ATI 0x981F +#define GLX_AUX9_ATI 0x9820 +#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821 +#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822 + +typedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer); +typedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer); + +#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI) +#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI) +#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI) + +#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture) + +#endif /* GLX_ATI_render_texture */ + +/* ------------------------- GLX_EXT_import_context ------------------------ */ + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 + +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C + +typedef XID GLXContextID; + +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value); + +#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT) +#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT) +#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT) +#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT) + +#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context) + +#endif /* GLX_EXT_import_context */ + +/* -------------------------- GLX_EXT_scene_marker ------------------------- */ + +#ifndef GLX_EXT_scene_marker +#define GLX_EXT_scene_marker 1 + +#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker) + +#endif /* GLX_EXT_scene_marker */ + +/* -------------------------- GLX_EXT_visual_info -------------------------- */ + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 + +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 + +#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info) + +#endif /* GLX_EXT_visual_info */ + +/* ------------------------- GLX_EXT_visual_rating ------------------------- */ + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 + +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + +#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating) + +#endif /* GLX_EXT_visual_rating */ + +/* -------------------------- GLX_MESA_agp_offset -------------------------- */ + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 + +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer); + +#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA) + +#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset) + +#endif /* GLX_MESA_agp_offset */ + +/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */ + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 + +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height); + +#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA) + +#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer) + +#endif /* GLX_MESA_copy_sub_buffer */ + +/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */ + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 + +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); + +#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA) + +#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap) + +#endif /* GLX_MESA_pixmap_colormap */ + +/* ------------------------ GLX_MESA_release_buffers ----------------------- */ + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 + +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d); + +#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA) + +#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers) + +#endif /* GLX_MESA_release_buffers */ + +/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */ + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 + +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 + +typedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode); + +#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA) + +#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode) + +#endif /* GLX_MESA_set_3dfx_mode */ + +/* -------------------------- GLX_NV_float_buffer -------------------------- */ + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 + +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 + +#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer) + +#endif /* GLX_NV_float_buffer */ + +/* ----------------------- GLX_NV_vertex_array_range ----------------------- */ + +#ifndef GLX_NV_vertex_array_range +#define GLX_NV_vertex_array_range 1 + +typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); +typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer); + +#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV) +#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV) + +#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range) + +#endif /* GLX_NV_vertex_array_range */ + +/* -------------------------- GLX_OML_swap_method -------------------------- */ + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 + +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method) + +#endif /* GLX_OML_swap_method */ + +/* -------------------------- GLX_OML_sync_control ------------------------- */ + +#if !defined(GLX_OML_sync_control) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#include +#define GLX_OML_sync_control 1 + +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator); +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc); + +#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML) +#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML) +#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML) +#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML) +#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML) + +#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control) + +#endif /* GLX_OML_sync_control */ + +/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */ + +#ifndef GLX_SGIS_blended_overlay +#define GLX_SGIS_blended_overlay 1 + +#define GLX_BLENDED_RGBA_SGIS 0x8025 + +#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay) + +#endif /* GLX_SGIS_blended_overlay */ + +/* -------------------------- GLX_SGIS_color_range ------------------------- */ + +#ifndef GLX_SGIS_color_range +#define GLX_SGIS_color_range 1 + +#define GLX_MIN_RED_SGIS 0 +#define GLX_MAX_GREEN_SGIS 0 +#define GLX_MIN_BLUE_SGIS 0 +#define GLX_MAX_ALPHA_SGIS 0 +#define GLX_MIN_GREEN_SGIS 0 +#define GLX_MIN_ALPHA_SGIS 0 +#define GLX_MAX_RED_SGIS 0 +#define GLX_EXTENDED_RANGE_SGIS 0 +#define GLX_MAX_BLUE_SGIS 0 + +#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range) + +#endif /* GLX_SGIS_color_range */ + +/* -------------------------- GLX_SGIS_multisample ------------------------- */ + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 + +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 + +#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample) + +#endif /* GLX_SGIS_multisample */ + +/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */ + +#ifndef GLX_SGIS_shared_multisample +#define GLX_SGIS_shared_multisample 1 + +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 + +#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample) + +#endif /* GLX_SGIS_shared_multisample */ + +/* --------------------------- GLX_SGIX_fbconfig --------------------------- */ + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 + +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_SCREEN_EXT 0x800C +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 + +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; + +typedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap); +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis); +typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config); + +#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX) +#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX) +#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX) +#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX) +#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX) +#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX) + +#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig) + +#endif /* GLX_SGIX_fbconfig */ + +/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */ + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 + +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 + +typedef XID GLXPbufferSGIX; +typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX; + +typedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask); +typedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask); + +#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX) +#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX) +#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX) +#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX) +#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX) + +#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer) + +#endif /* GLX_SGIX_pbuffer */ + +/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */ + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 + +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); + +#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX) +#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX) + +#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier) + +#endif /* GLX_SGIX_swap_barrier */ + +/* -------------------------- GLX_SGIX_swap_group -------------------------- */ + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 + +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); + +#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX) + +#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group) + +#endif /* GLX_SGIX_swap_group */ + +/* ------------------------- GLX_SGIX_video_resize ------------------------- */ + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 + +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 + +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); + +#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX) +#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX) +#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX) +#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX) +#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX) + +#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize) + +#endif /* GLX_SGIX_video_resize */ + +/* ---------------------- GLX_SGIX_visual_select_group --------------------- */ + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 + +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 + +#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group) + +#endif /* GLX_SGIX_visual_select_group */ + +/* ---------------------------- GLX_SGI_cushion ---------------------------- */ + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 + +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion); + +#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI) + +#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion) + +#endif /* GLX_SGI_cushion */ + +/* ----------------------- GLX_SGI_make_current_read ----------------------- */ + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 + +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); + +#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI) +#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI) + +#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read) + +#endif /* GLX_SGI_make_current_read */ + +/* -------------------------- GLX_SGI_swap_control ------------------------- */ + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 + +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); + +#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI) + +#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control) + +#endif /* GLX_SGI_swap_control */ + +/* --------------------------- GLX_SGI_video_sync -------------------------- */ + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 + +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (uint* count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count); + +#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI) +#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI) + +#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync) + +#endif /* GLX_SGI_video_sync */ + +/* --------------------- GLX_SUN_get_transparent_index --------------------- */ + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 + +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); + +#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN) + +#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index) + +#endif /* GLX_SUN_get_transparent_index */ + +/* -------------------------- GLX_SUN_video_resize ------------------------- */ + +#ifndef GLX_SUN_video_resize +#define GLX_SUN_video_resize 1 + +#define GLX_VIDEO_RESIZE_SUN 0x8171 +#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD + +typedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor); +typedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor); + +#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN) +#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN) + +#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize) + +#endif /* GLX_SUN_video_resize */ + +/* ------------------------------------------------------------------------- */ + +#ifdef GLEW_MX +#define GLXEW_EXPORT +#else +#define GLXEW_EXPORT extern +#endif /* GLEW_MX */ + +extern PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay; + +extern PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig; +extern PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext; +extern PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer; +extern PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap; +extern PFNGLXCREATEWINDOWPROC __glewXCreateWindow; +extern PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer; +extern PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap; +extern PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow; +extern PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable; +extern PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib; +extern PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs; +extern PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent; +extern PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig; +extern PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent; +extern PFNGLXQUERYCONTEXTPROC __glewXQueryContext; +extern PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable; +extern PFNGLXSELECTEVENTPROC __glewXSelectEvent; + +extern PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI; +extern PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI; +extern PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI; + +extern PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT; +extern PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT; +extern PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT; +extern PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT; + +extern PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA; + +extern PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA; + +extern PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA; + +extern PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA; + +extern PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA; + +extern PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV; +extern PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV; + +#ifdef GLX_OML_sync_control +extern PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML; +extern PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML; +extern PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML; +extern PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML; +extern PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML; +#endif + +extern PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX; +extern PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX; +extern PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX; +extern PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX; +extern PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX; +extern PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX; + +extern PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX; +extern PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX; +extern PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX; +extern PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX; +extern PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX; + +extern PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX; +extern PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX; + +extern PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX; + +extern PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX; +extern PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX; +extern PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX; +extern PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX; +extern PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX; + +extern PFNGLXCUSHIONSGIPROC __glewXCushionSGI; + +extern PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI; +extern PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI; + +extern PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI; + +extern PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI; +extern PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI; + +extern PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN; + +extern PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN; +extern PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN; + +#if defined(GLEW_MX) +struct GLXEWContextStruct +{ +#endif /* GLEW_MX */ + +GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_0; +GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_1; +GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_2; +GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_3; +GLXEW_EXPORT GLboolean __GLXEW_VERSION_1_4; +GLXEW_EXPORT GLboolean __GLXEW_3DFX_multisample; +GLXEW_EXPORT GLboolean __GLXEW_ARB_fbconfig_float; +GLXEW_EXPORT GLboolean __GLXEW_ARB_get_proc_address; +GLXEW_EXPORT GLboolean __GLXEW_ARB_multisample; +GLXEW_EXPORT GLboolean __GLXEW_ATI_pixel_format_float; +GLXEW_EXPORT GLboolean __GLXEW_ATI_render_texture; +GLXEW_EXPORT GLboolean __GLXEW_EXT_import_context; +GLXEW_EXPORT GLboolean __GLXEW_EXT_scene_marker; +GLXEW_EXPORT GLboolean __GLXEW_EXT_visual_info; +GLXEW_EXPORT GLboolean __GLXEW_EXT_visual_rating; +GLXEW_EXPORT GLboolean __GLXEW_MESA_agp_offset; +GLXEW_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer; +GLXEW_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap; +GLXEW_EXPORT GLboolean __GLXEW_MESA_release_buffers; +GLXEW_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode; +GLXEW_EXPORT GLboolean __GLXEW_NV_float_buffer; +GLXEW_EXPORT GLboolean __GLXEW_NV_vertex_array_range; +GLXEW_EXPORT GLboolean __GLXEW_OML_swap_method; +GLXEW_EXPORT GLboolean __GLXEW_OML_sync_control; +GLXEW_EXPORT GLboolean __GLXEW_SGIS_blended_overlay; +GLXEW_EXPORT GLboolean __GLXEW_SGIS_color_range; +GLXEW_EXPORT GLboolean __GLXEW_SGIS_multisample; +GLXEW_EXPORT GLboolean __GLXEW_SGIS_shared_multisample; +GLXEW_EXPORT GLboolean __GLXEW_SGIX_fbconfig; +GLXEW_EXPORT GLboolean __GLXEW_SGIX_pbuffer; +GLXEW_EXPORT GLboolean __GLXEW_SGIX_swap_barrier; +GLXEW_EXPORT GLboolean __GLXEW_SGIX_swap_group; +GLXEW_EXPORT GLboolean __GLXEW_SGIX_video_resize; +GLXEW_EXPORT GLboolean __GLXEW_SGIX_visual_select_group; +GLXEW_EXPORT GLboolean __GLXEW_SGI_cushion; +GLXEW_EXPORT GLboolean __GLXEW_SGI_make_current_read; +GLXEW_EXPORT GLboolean __GLXEW_SGI_swap_control; +GLXEW_EXPORT GLboolean __GLXEW_SGI_video_sync; +GLXEW_EXPORT GLboolean __GLXEW_SUN_get_transparent_index; +GLXEW_EXPORT GLboolean __GLXEW_SUN_video_resize; + +#ifdef GLEW_MX +}; /* GLXEWContextStruct */ +#endif /* GLEW_MX */ + +/* ------------------------------------------------------------------------ */ + +#ifdef GLEW_MX + +typedef struct GLXEWContextStruct GLXEWContext; +extern GLenum glxewContextInit (GLXEWContext* ctx); +extern GLboolean glxewContextIsSupported (GLXEWContext* ctx, const char* name); + +#define glxewInit() glxewContextInit(glxewGetContext()) +#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x) + +#define GLXEW_GET_VAR(x) glxewGetContext()->x +#define GLXEW_GET_FUN(x) x + +#else /* GLEW_MX */ + +#define GLXEW_GET_VAR(x) x +#define GLXEW_GET_FUN(x) x + +extern GLboolean glxewIsSupported (const char* name); + +#endif /* GLEW_MX */ + +extern GLboolean glxewGetExtension (const char* name); + +#ifdef __cplusplus +} +#endif + +#endif /* __glxew_h__ */ diff --git a/src/SFML/Graphics/GLEW/wglew.h b/src/SFML/Graphics/GLEW/wglew.h new file mode 100644 index 00000000..a2bb0f7c --- /dev/null +++ b/src/SFML/Graphics/GLEW/wglew.h @@ -0,0 +1,934 @@ +/* +** The OpenGL Extension Wrangler Library +** Copyright (C) 2002-2006, Milan Ikits +** Copyright (C) 2002-2006, Marcelo E. Magallon +** Copyright (C) 2002, Lev Povalahev +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** * The name of the author may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef __wglew_h__ +#define __wglew_h__ +#define __WGLEW_H__ + +#ifdef __wglext_h_ +#error wglext.h included before wglew.h +#endif + +#define __wglext_h_ + +#if !defined(APIENTRY) && !defined(__CYGWIN__) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +#include +#endif + +/* + * GLEW_STATIC needs to be set when using the static version. + * GLEW_BUILD is set when building the DLL version. + */ +#ifdef GLEW_STATIC +# define GLEWAPI extern +#else +# ifdef GLEW_BUILD +# define GLEWAPI extern __declspec(dllexport) +# else +# define GLEWAPI extern __declspec(dllimport) +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* -------------------------- WGL_3DFX_multisample ------------------------- */ + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 + +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 + +#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample) + +#endif /* WGL_3DFX_multisample */ + +/* ------------------------- WGL_3DL_stereo_control ------------------------ */ + +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 + +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 + +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); + +#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL) + +#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control) + +#endif /* WGL_3DL_stereo_control */ + +/* ------------------------- WGL_ARB_buffer_region ------------------------- */ + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 + +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 + +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); + +#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB) +#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB) +#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB) +#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB) + +#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region) + +#endif /* WGL_ARB_buffer_region */ + +/* ----------------------- WGL_ARB_extensions_string ----------------------- */ + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 + +typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); + +#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB) + +#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string) + +#endif /* WGL_ARB_extensions_string */ + +/* ----------------------- WGL_ARB_make_current_read ----------------------- */ + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 + +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); + +#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) +#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB) + +#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read) + +#endif /* WGL_ARB_make_current_read */ + +/* -------------------------- WGL_ARB_multisample -------------------------- */ + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 + +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 + +#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample) + +#endif /* WGL_ARB_multisample */ + +/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */ + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 + +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 + +DECLARE_HANDLE(HPBUFFERARB); + +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); + +#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB) +#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB) +#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB) +#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB) +#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB) + +#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer) + +#endif /* WGL_ARB_pbuffer */ + +/* -------------------------- WGL_ARB_pixel_format ------------------------- */ + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 + +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B + +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); + +#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) +#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) +#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB) + +#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format) + +#endif /* WGL_ARB_pixel_format */ + +/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */ + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 + +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 + +#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float) + +#endif /* WGL_ARB_pixel_format_float */ + +/* ------------------------- WGL_ARB_render_texture ------------------------ */ + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 + +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 + +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList); + +#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB) +#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB) +#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB) + +#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture) + +#endif /* WGL_ARB_render_texture */ + +/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */ + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 + +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 + +#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float) + +#endif /* WGL_ATI_pixel_format_float */ + +/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */ + +#ifndef WGL_ATI_render_texture_rectangle +#define WGL_ATI_render_texture_rectangle 1 + +#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5 + +#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle) + +#endif /* WGL_ATI_render_texture_rectangle */ + +/* -------------------------- WGL_EXT_depth_float -------------------------- */ + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 + +#define WGL_DEPTH_FLOAT_EXT 0x2040 + +#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float) + +#endif /* WGL_EXT_depth_float */ + +/* ---------------------- WGL_EXT_display_color_table ---------------------- */ + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 + +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); + +#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) +#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) +#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT) +#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT) + +#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table) + +#endif /* WGL_EXT_display_color_table */ + +/* ----------------------- WGL_EXT_extensions_string ----------------------- */ + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 + +typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); + +#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT) + +#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string) + +#endif /* WGL_EXT_extensions_string */ + +/* ----------------------- WGL_EXT_make_current_read ----------------------- */ + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 + +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); + +#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) +#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT) + +#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read) + +#endif /* WGL_EXT_make_current_read */ + +/* -------------------------- WGL_EXT_multisample -------------------------- */ + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 + +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 + +#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample) + +#endif /* WGL_EXT_multisample */ + +/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */ + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 + +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 + +DECLARE_HANDLE(HPBUFFEREXT); + +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); + +#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT) +#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT) +#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT) +#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT) +#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT) + +#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer) + +#endif /* WGL_EXT_pbuffer */ + +/* -------------------------- WGL_EXT_pixel_format ------------------------- */ + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 + +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C + +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); + +#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) +#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) +#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT) + +#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format) + +#endif /* WGL_EXT_pixel_format */ + +/* -------------------------- WGL_EXT_swap_control ------------------------- */ + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 + +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); + +#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT) +#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT) + +#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control) + +#endif /* WGL_EXT_swap_control */ + +/* --------------------- WGL_I3D_digital_video_control --------------------- */ + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 + +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 + +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); + +#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D) +#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D) + +#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control) + +#endif /* WGL_I3D_digital_video_control */ + +/* ----------------------------- WGL_I3D_gamma ----------------------------- */ + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 + +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F + +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); + +#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) +#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D) +#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D) +#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D) + +#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma) + +#endif /* WGL_I3D_gamma */ + +/* ---------------------------- WGL_I3D_genlock ---------------------------- */ + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 + +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C + +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); + +#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) +#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) +#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D) +#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D) +#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D) +#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D) +#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D) +#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D) +#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D) +#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D) +#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D) +#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D) + +#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock) + +#endif /* WGL_I3D_genlock */ + +/* -------------------------- WGL_I3D_image_buffer ------------------------- */ + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 + +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 + +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); + +#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) +#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) +#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D) +#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D) + +#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer) + +#endif /* WGL_I3D_image_buffer */ + +/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */ + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 + +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); + +#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D) +#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D) +#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D) +#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D) + +#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock) + +#endif /* WGL_I3D_swap_frame_lock */ + +/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */ + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 + +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); + +#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) +#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) +#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D) +#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D) + +#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage) + +#endif /* WGL_I3D_swap_frame_usage */ + +/* -------------------------- WGL_NV_float_buffer -------------------------- */ + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 + +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 + +#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer) + +#endif /* WGL_NV_float_buffer */ + +/* ---------------------- WGL_NV_render_depth_texture ---------------------- */ + +#ifndef WGL_NV_render_depth_texture +#define WGL_NV_render_depth_texture 1 + +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 + +#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture) + +#endif /* WGL_NV_render_depth_texture */ + +/* -------------------- WGL_NV_render_texture_rectangle -------------------- */ + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_NV_render_texture_rectangle 1 + +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 + +#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle) + +#endif /* WGL_NV_render_texture_rectangle */ + +/* ----------------------- WGL_NV_vertex_array_range ----------------------- */ + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 + +typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); + +#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) +#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) + +#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range) + +#endif /* WGL_NV_vertex_array_range */ + +/* -------------------------- WGL_OML_sync_control ------------------------- */ + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 + +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); + +#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) +#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) +#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML) +#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML) +#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML) +#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML) + +#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control) + +#endif /* WGL_OML_sync_control */ + +/* ------------------------------------------------------------------------- */ + +#ifdef GLEW_MX +#define WGLEW_EXPORT +#else +#define WGLEW_EXPORT GLEWAPI +#endif /* GLEW_MX */ + +#ifdef GLEW_MX +struct WGLEWContextStruct +{ +#endif /* GLEW_MX */ + +WGLEW_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL; + +WGLEW_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB; +WGLEW_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB; +WGLEW_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB; +WGLEW_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB; + +WGLEW_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB; + +WGLEW_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB; +WGLEW_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB; + +WGLEW_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB; +WGLEW_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB; +WGLEW_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB; +WGLEW_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB; +WGLEW_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB; + +WGLEW_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB; +WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB; +WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB; + +WGLEW_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB; +WGLEW_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB; +WGLEW_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB; + +WGLEW_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT; +WGLEW_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT; +WGLEW_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT; +WGLEW_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT; + +WGLEW_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT; + +WGLEW_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT; +WGLEW_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT; + +WGLEW_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT; +WGLEW_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT; +WGLEW_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT; +WGLEW_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT; +WGLEW_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT; + +WGLEW_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT; +WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT; +WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT; + +WGLEW_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT; +WGLEW_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT; + +WGLEW_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D; +WGLEW_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D; + +WGLEW_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D; +WGLEW_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D; +WGLEW_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D; +WGLEW_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D; + +WGLEW_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D; +WGLEW_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D; +WGLEW_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D; +WGLEW_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D; +WGLEW_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D; +WGLEW_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D; +WGLEW_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D; +WGLEW_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D; +WGLEW_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D; +WGLEW_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D; +WGLEW_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D; +WGLEW_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D; + +WGLEW_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D; +WGLEW_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D; +WGLEW_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D; +WGLEW_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D; + +WGLEW_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D; +WGLEW_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D; +WGLEW_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D; +WGLEW_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D; + +WGLEW_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D; +WGLEW_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D; +WGLEW_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D; +WGLEW_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D; + +WGLEW_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV; +WGLEW_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV; + +WGLEW_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML; +WGLEW_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML; +WGLEW_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML; +WGLEW_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML; +WGLEW_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML; +WGLEW_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML; +WGLEW_EXPORT GLboolean __WGLEW_3DFX_multisample; +WGLEW_EXPORT GLboolean __WGLEW_3DL_stereo_control; +WGLEW_EXPORT GLboolean __WGLEW_ARB_buffer_region; +WGLEW_EXPORT GLboolean __WGLEW_ARB_extensions_string; +WGLEW_EXPORT GLboolean __WGLEW_ARB_make_current_read; +WGLEW_EXPORT GLboolean __WGLEW_ARB_multisample; +WGLEW_EXPORT GLboolean __WGLEW_ARB_pbuffer; +WGLEW_EXPORT GLboolean __WGLEW_ARB_pixel_format; +WGLEW_EXPORT GLboolean __WGLEW_ARB_pixel_format_float; +WGLEW_EXPORT GLboolean __WGLEW_ARB_render_texture; +WGLEW_EXPORT GLboolean __WGLEW_ATI_pixel_format_float; +WGLEW_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle; +WGLEW_EXPORT GLboolean __WGLEW_EXT_depth_float; +WGLEW_EXPORT GLboolean __WGLEW_EXT_display_color_table; +WGLEW_EXPORT GLboolean __WGLEW_EXT_extensions_string; +WGLEW_EXPORT GLboolean __WGLEW_EXT_make_current_read; +WGLEW_EXPORT GLboolean __WGLEW_EXT_multisample; +WGLEW_EXPORT GLboolean __WGLEW_EXT_pbuffer; +WGLEW_EXPORT GLboolean __WGLEW_EXT_pixel_format; +WGLEW_EXPORT GLboolean __WGLEW_EXT_swap_control; +WGLEW_EXPORT GLboolean __WGLEW_I3D_digital_video_control; +WGLEW_EXPORT GLboolean __WGLEW_I3D_gamma; +WGLEW_EXPORT GLboolean __WGLEW_I3D_genlock; +WGLEW_EXPORT GLboolean __WGLEW_I3D_image_buffer; +WGLEW_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock; +WGLEW_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage; +WGLEW_EXPORT GLboolean __WGLEW_NV_float_buffer; +WGLEW_EXPORT GLboolean __WGLEW_NV_render_depth_texture; +WGLEW_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle; +WGLEW_EXPORT GLboolean __WGLEW_NV_vertex_array_range; +WGLEW_EXPORT GLboolean __WGLEW_OML_sync_control; + +#ifdef GLEW_MX +}; /* WGLEWContextStruct */ +#endif /* GLEW_MX */ + +/* ------------------------------------------------------------------------- */ + +#ifdef GLEW_MX + +typedef struct WGLEWContextStruct WGLEWContext; +GLEWAPI GLenum wglewContextInit (WGLEWContext* ctx); +GLEWAPI GLboolean wglewContextIsSupported (WGLEWContext* ctx, const char* name); + +#define wglewInit() wglewContextInit(wglewGetContext()) +#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x) + +#define WGLEW_GET_VAR(x) wglewGetContext()->x +#define WGLEW_GET_FUN(x) wglewGetContext()->x + +#else /* GLEW_MX */ + +#define WGLEW_GET_VAR(x) x +#define WGLEW_GET_FUN(x) x + +GLEWAPI GLboolean wglewIsSupported (const char* name); + +#endif /* GLEW_MX */ + +GLEWAPI GLboolean wglewGetExtension (const char* name); + +#ifdef __cplusplus +} +#endif + +#undef GLEWAPI + +#endif /* __wglew_h__ */ diff --git a/src/SFML/Graphics/GraphicsContext.cpp b/src/SFML/Graphics/GraphicsContext.cpp new file mode 100644 index 00000000..d9a9c2f9 --- /dev/null +++ b/src/SFML/Graphics/GraphicsContext.cpp @@ -0,0 +1,94 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace +{ + //////////////////////////////////////////////////////////// + // One time initialization of 3rd party libraries. + // We use a global function with a static boolean rather + // than directly a global boolean, to avoid the randomness + // of global variables initializations across compile units. + //////////////////////////////////////////////////////////// + void InitGraphicsLibs() + { + static bool InitDone = false; + if (!InitDone) + { + // Initialize GLEW + glewInit(); + + InitDone = true; + } + } + +} + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Default constructor, activate the global context +/// if no other context is bound to the current thread +//////////////////////////////////////////////////////////// +GraphicsContext::GraphicsContext() +{ + // Activate the global context + if (!Context::IsContextActive()) + { + Context::GetGlobal().SetActive(true); + myActivated = true; + } + else + { + myActivated = false; + } + + // Make sure third party libraries are initialized + InitGraphicsLibs(); +} + + +//////////////////////////////////////////////////////////// +/// Destructor, deactivate the global context +/// if no other context was previously bound to the current thread +//////////////////////////////////////////////////////////// +GraphicsContext::~GraphicsContext() +{ + // Deactivate the global context + if (myActivated) + Context::GetGlobal().SetActive(false); +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Graphics/GraphicsContext.hpp b/src/SFML/Graphics/GraphicsContext.hpp new file mode 100644 index 00000000..0a76001b --- /dev/null +++ b/src/SFML/Graphics/GraphicsContext.hpp @@ -0,0 +1,176 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICSCONTEXT_HPP +#define SFML_GRAPHICSCONTEXT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class Context; + +namespace priv +{ +//////////////////////////////////////////////////////////// +/// RAII class ensuring a valid shared OpenGL context is bound +/// to the current thread for all the lifetime of the instance. +/// It also ensures all third party libraries (like GLEW) +/// are properly initialized +/// This class is for internal use only, it is required +/// to solve tricky problems involving multi-threading +//////////////////////////////////////////////////////////// +class GraphicsContext : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor, activate the global context + /// if no other context is bound to the current thread + /// + //////////////////////////////////////////////////////////// + GraphicsContext(); + + //////////////////////////////////////////////////////////// + /// Destructor, deactivate the global context + /// if no other context was previously bound to the current thread + /// + //////////////////////////////////////////////////////////// + ~GraphicsContext(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + bool myActivated; ///< Keep track of the activation state of the global context +}; + +} // namespace priv + + +//////////////////////////////////////////////////////////// +/// Let's define a macro to quickly check every OpenGL +/// API calls +//////////////////////////////////////////////////////////// +#ifdef SFML_DEBUG + + // In debug mode, perform a test on every OpenGL call + #define GLCheck(Func) ((Func), GLCheckError(__FILE__, __LINE__)) + +#else + + // Else, we don't add any overhead + #define GLCheck(Func) (Func) + +#endif + + +//////////////////////////////////////////////////////////// +/// Check the last OpenGL error +/// +//////////////////////////////////////////////////////////// +inline void GLCheckError(const std::string& File, unsigned int Line) +{ + // Get the last error + GLenum ErrorCode = glGetError(); + + if (ErrorCode != GL_NO_ERROR) + { + std::string Error = "unknown error"; + std::string Desc = "no description"; + + // Decode the error code + switch (ErrorCode) + { + case GL_INVALID_ENUM : + { + Error = "GL_INVALID_ENUM"; + Desc = "an unacceptable value has been specified for an enumerated argument"; + break; + } + + case GL_INVALID_VALUE : + { + Error = "GL_INVALID_VALUE"; + Desc = "a numeric argument is out of range"; + break; + } + + case GL_INVALID_OPERATION : + { + Error = "GL_INVALID_OPERATION"; + Desc = "the specified operation is not allowed in the current state"; + break; + } + + case GL_STACK_OVERFLOW : + { + Error = "GL_STACK_OVERFLOW"; + Desc = "this command would cause a stack overflow"; + break; + } + + case GL_STACK_UNDERFLOW : + { + Error = "GL_STACK_UNDERFLOW"; + Desc = "this command would cause a stack underflow"; + break; + } + + case GL_OUT_OF_MEMORY : + { + Error = "GL_OUT_OF_MEMORY"; + Desc = "there is not enough memory left to execute the command"; + break; + } + + case GL_INVALID_FRAMEBUFFER_OPERATION_EXT : + { + Error = "GL_INVALID_FRAMEBUFFER_OPERATION_EXT"; + Desc = "the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\""; + break; + } + } + + // Log the error + std::cerr << "An internal OpenGL call failed in " + << File.substr(File.find_last_of("\\/") + 1) << " (" << Line << ") : " + << Error << ", " << Desc + << std::endl; + } +} + +} // namespace sf + + +#endif // SFML_GRAPHICSCONTEXT_HPP diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp new file mode 100644 index 00000000..62e64a1f --- /dev/null +++ b/src/SFML/Graphics/Image.cpp @@ -0,0 +1,760 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Image::Image() : +myWidth (0), +myHeight (0), +myTextureWidth (0), +myTextureHeight (0), +myTexture (0), +myIsSmooth (true), +myNeedTextureUpdate(false), +myNeedArrayUpdate (false) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +Image::Image(const Image& Copy) : +Resource (Copy), +myWidth (Copy.myWidth), +myHeight (Copy.myHeight), +myTextureWidth (Copy.myTextureWidth), +myTextureHeight (Copy.myTextureHeight), +myTexture (0), +myIsSmooth (Copy.myIsSmooth), +myPixels (Copy.myPixels), +myNeedTextureUpdate(false), +myNeedArrayUpdate (false) +{ + CreateTexture(); +} + + +//////////////////////////////////////////////////////////// +/// Construct an empty image +//////////////////////////////////////////////////////////// +Image::Image(unsigned int Width, unsigned int Height, const Color& Col) : +myWidth (0), +myHeight (0), +myTextureWidth (0), +myTextureHeight (0), +myTexture (0), +myIsSmooth (true), +myNeedTextureUpdate(false), +myNeedArrayUpdate (false) +{ + Create(Width, Height, Col); +} + + +//////////////////////////////////////////////////////////// +/// Construct the image from pixels in memory +//////////////////////////////////////////////////////////// +Image::Image(unsigned int Width, unsigned int Height, const Uint8* Data) : +myWidth (0), +myHeight (0), +myTextureWidth (0), +myTextureHeight (0), +myTexture (0), +myIsSmooth (true), +myNeedTextureUpdate(false), +myNeedArrayUpdate (false) +{ + LoadFromPixels(Width, Height, Data); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Image::~Image() +{ + // Destroy the OpenGL texture + DestroyTexture(); +} + + +//////////////////////////////////////////////////////////// +/// Load the image from a file +//////////////////////////////////////////////////////////// +bool Image::LoadFromFile(const std::string& Filename) +{ + // Let the image loader load the image into our pixel array + bool Success = priv::ImageLoader::GetInstance().LoadImageFromFile(Filename, myPixels, myWidth, myHeight); + + if (Success) + { + // Loading succeeded : we can create the texture + if (CreateTexture()) + return true; + } + + // Oops... something failed + Reset(); + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Load the image from a file in memory +//////////////////////////////////////////////////////////// +bool Image::LoadFromMemory(const char* Data, std::size_t SizeInBytes) +{ + // Check parameters + if (!Data || (SizeInBytes == 0)) + { + std::cerr << "Failed to image font from memory, no data provided" << std::endl; + return false; + } + + // Let the image loader load the image into our pixel array + bool Success = priv::ImageLoader::GetInstance().LoadImageFromMemory(Data, SizeInBytes, myPixels, myWidth, myHeight); + + if (Success) + { + // Loading succeeded : we can create the texture + if (CreateTexture()) + return true; + } + + // Oops... something failed + Reset(); + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Load the image directly from an array of pixels +//////////////////////////////////////////////////////////// +bool Image::LoadFromPixels(unsigned int Width, unsigned int Height, const Uint8* Data) +{ + if (Data) + { + // Store the texture dimensions + myWidth = Width; + myHeight = Height; + + // Fill the pixel buffer with the specified raw data + const Color* Ptr = reinterpret_cast(Data); + myPixels.assign(Ptr, Ptr + Width * Height); + + // We can create the texture + if (CreateTexture()) + { + return true; + } + else + { + // Oops... something failed + Reset(); + return false; + } + } + else + { + // No data provided : create a white image + return Create(Width, Height, Color(255, 255, 255, 255)); + } +} + + +//////////////////////////////////////////////////////////// +/// Save the content of the image to a file +//////////////////////////////////////////////////////////// +bool Image::SaveToFile(const std::string& Filename) const +{ + // Check if the array of pixels needs to be updated + EnsureArrayUpdate(); + + // Let the image loader save our pixel array into the image + return priv::ImageLoader::GetInstance().SaveImageToFile(Filename, myPixels, myWidth, myHeight); +} + + +//////////////////////////////////////////////////////////// +/// Create an empty image +//////////////////////////////////////////////////////////// +bool Image::Create(unsigned int Width, unsigned int Height, Color Col) +{ + // Store the texture dimensions + myWidth = Width; + myHeight = Height; + + // Recreate the pixel buffer and fill it with the specified color + myPixels.clear(); + myPixels.resize(Width * Height, Col); + + // We can create the texture + if (CreateTexture()) + { + return true; + } + else + { + // Oops... something failed + Reset(); + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Create transparency mask from a specified colorkey +//////////////////////////////////////////////////////////// +void Image::CreateMaskFromColor(Color ColorKey, Uint8 Alpha) +{ + // Check if the array of pixels needs to be updated + EnsureArrayUpdate(); + + // Calculate the new color (old color with no alpha) + Color NewColor(ColorKey.r, ColorKey.g, ColorKey.b, Alpha); + + // Replace the old color by the new one + std::replace(myPixels.begin(), myPixels.end(), ColorKey, NewColor); + + // The texture will need to be updated + myNeedTextureUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Copy pixels from another image onto this one. +/// This function does a slow pixel copy and should only +/// be used at initialization time +//////////////////////////////////////////////////////////// +void Image::Copy(const Image& Source, unsigned int DestX, unsigned int DestY, const IntRect& SourceRect) +{ + // Make sure both images are valid + if ((Source.myWidth == 0) || (Source.myHeight == 0) || (myWidth == 0) || (myHeight == 0)) + return; + + // Make sure both images have up-to-date arrays + EnsureArrayUpdate(); + Source.EnsureArrayUpdate(); + + // Adjust the source rectangle + IntRect SrcRect = SourceRect; + if (SrcRect.GetWidth() == 0 || (SrcRect.GetHeight() == 0)) + { + SrcRect.Left = 0; + SrcRect.Top = 0; + SrcRect.Right = Source.myWidth; + SrcRect.Bottom = Source.myHeight; + } + else + { + if (SrcRect.Left < 0) SrcRect.Left = 0; + if (SrcRect.Top < 0) SrcRect.Top = 0; + if (SrcRect.Right > static_cast(Source.myWidth)) SrcRect.Right = Source.myWidth; + if (SrcRect.Bottom > static_cast(Source.myHeight)) SrcRect.Bottom = Source.myHeight; + } + + // Then find the valid bounds of the destination rectangle + int Width = SrcRect.GetWidth(); + int Height = SrcRect.GetHeight(); + if (DestX + Width > myWidth) Width = myWidth - DestX; + if (DestY + Height > myHeight) Height = myHeight - DestY; + + // Make sure the destination area is valid + if ((Width <= 0) || (Height <= 0)) + return; + + // Precompute as much as possible + int Pitch = Width * 4; + int Rows = Height; + int SrcStride = Source.myWidth * 4; + int DstStride = myWidth * 4; + const Uint8* SrcPixels = Source.GetPixelsPtr() + (SrcRect.Left + SrcRect.Top * Source.myWidth) * 4; + Uint8* DstPixels = reinterpret_cast(&myPixels[0]) + (DestX + DestY * myWidth) * 4; + + // Copy the pixels + for (int i = 0; i < Rows; ++i) + { + memcpy(DstPixels, SrcPixels, Pitch); + SrcPixels += SrcStride; + DstPixels += DstStride; + } + + // The texture will need an update + myNeedTextureUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Create the image from the current contents of the +/// given window +//////////////////////////////////////////////////////////// +bool Image::CopyScreen(RenderWindow& Window, const IntRect& SourceRect) +{ + // Adjust the source rectangle + IntRect SrcRect = SourceRect; + if (SrcRect.GetWidth() == 0 || (SrcRect.GetHeight() == 0)) + { + SrcRect.Left = 0; + SrcRect.Top = 0; + SrcRect.Right = Window.GetWidth(); + SrcRect.Bottom = Window.GetHeight(); + } + else + { + if (SrcRect.Left < 0) SrcRect.Left = 0; + if (SrcRect.Top < 0) SrcRect.Top = 0; + if (SrcRect.Right > static_cast(Window.GetWidth())) SrcRect.Right = Window.GetWidth(); + if (SrcRect.Bottom > static_cast(Window.GetHeight())) SrcRect.Bottom = Window.GetHeight(); + } + + // Store the texture dimensions + myWidth = SrcRect.GetWidth(); + myHeight = SrcRect.GetHeight(); + + // We can then create the texture + if (Window.SetActive() && CreateTexture()) + { + GLint PreviousTexture; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + + GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); + GLCheck(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, SrcRect.Left, SrcRect.Top, myWidth, myHeight)); + + GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + + myNeedTextureUpdate = false; + myNeedArrayUpdate = true; + + return true; + } + else + { + Reset(); + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Change the color of a pixel +//////////////////////////////////////////////////////////// +void Image::SetPixel(unsigned int X, unsigned int Y, const Color& Col) +{ + // First check if the array of pixels needs to be updated + EnsureArrayUpdate(); + + // Check if pixel is whithin the image bounds + if ((X >= myWidth) || (Y >= myHeight)) + { + std::cerr << "Cannot set pixel (" << X << "," << Y << ") for image " + << "(width = " << myWidth << ", height = " << myHeight << ")" << std::endl; + return; + } + + myPixels[X + Y * myWidth] = Col; + + // The texture will need to be updated + myNeedTextureUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Get a pixel from the image +//////////////////////////////////////////////////////////// +const Color& Image::GetPixel(unsigned int X, unsigned int Y) const +{ + // First check if the array of pixels needs to be updated + EnsureArrayUpdate(); + + // Check if pixel is whithin the image bounds + if ((X >= myWidth) || (Y >= myHeight)) + { + std::cerr << "Cannot get pixel (" << X << "," << Y << ") for image " + << "(width = " << myWidth << ", height = " << myHeight << ")" << std::endl; + return Color::Black; + } + + return myPixels[X + Y * myWidth]; +} + + +//////////////////////////////////////////////////////////// +/// Get a read-only pointer to the array of pixels (RGBA 8 bits integers components) +/// Array size is GetWidth() x GetHeight() x 4 +/// This pointer becomes invalid if you reload or resize the image +//////////////////////////////////////////////////////////// +const Uint8* Image::GetPixelsPtr() const +{ + // First check if the array of pixels needs to be updated + EnsureArrayUpdate(); + + if (!myPixels.empty()) + { + return reinterpret_cast(&myPixels[0]); + } + else + { + std::cerr << "Trying to access the pixels of an empty image" << std::endl; + return NULL; + } +} + + +//////////////////////////////////////////////////////////// +/// Bind the image for rendering +//////////////////////////////////////////////////////////// +void Image::Bind() const +{ + // First check if the texture needs to be updated + EnsureTextureUpdate(); + + // Bind it + if (myTexture) + { + GLCheck(glEnable(GL_TEXTURE_2D)); + GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); + } +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable image smoothing filter +//////////////////////////////////////////////////////////// +void Image::SetSmooth(bool Smooth) +{ + if (Smooth != myIsSmooth) + { + myIsSmooth = Smooth; + + if (myTexture) + { + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + GLint PreviousTexture; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + + GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); + GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); + GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); + + GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + } + } +} + + +//////////////////////////////////////////////////////////// +/// Return the width of the image +//////////////////////////////////////////////////////////// +unsigned int Image::GetWidth() const +{ + return myWidth; +} + + +//////////////////////////////////////////////////////////// +/// Return the height of the image +//////////////////////////////////////////////////////////// +unsigned int Image::GetHeight() const +{ + return myHeight; +} + + +//////////////////////////////////////////////////////////// +/// Tells whether the smooth filtering is enabled or not +//////////////////////////////////////////////////////////// +bool Image::IsSmooth() const +{ + return myIsSmooth; +} + + +//////////////////////////////////////////////////////////// +/// Convert a subrect expressed in pixels, into float +/// texture coordinates +//////////////////////////////////////////////////////////// +FloatRect Image::GetTexCoords(const IntRect& Rect, bool Adjust) const +{ + float Width = static_cast(myTextureWidth); + float Height = static_cast(myTextureHeight); + + if (Adjust && myIsSmooth) + { + return FloatRect((Rect.Left + 0.5f) / Width, + (Rect.Top + 0.5f) / Height, + (Rect.Right - 0.5f) / Width, + (Rect.Bottom - 0.5f) / Height); + } + else + { + return FloatRect(Rect.Left / Width, + Rect.Top / Height, + Rect.Right / Width, + Rect.Bottom / Height); + } +} + + +//////////////////////////////////////////////////////////// +/// Get a valid texture size according to hardware support +//////////////////////////////////////////////////////////// +unsigned int Image::GetValidTextureSize(unsigned int Size) +{ + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + if (glewIsSupported("GL_ARB_texture_non_power_of_two") != 0) + { + // If hardware supports NPOT textures, then just return the unmodified size + return Size; + } + else + { + // If hardware doesn't support NPOT textures, we calculate the nearest power of two + unsigned int PowerOfTwo = 1; + while (PowerOfTwo < Size) + PowerOfTwo *= 2; + + return PowerOfTwo; + } +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator +//////////////////////////////////////////////////////////// +Image& Image::operator =(const Image& Other) +{ + Image Temp(Other); + + std::swap(myWidth, Temp.myWidth); + std::swap(myHeight, Temp.myHeight); + std::swap(myTextureWidth, Temp.myTextureWidth); + std::swap(myTextureHeight, Temp.myTextureHeight); + std::swap(myTexture, Temp.myTexture); + std::swap(myIsSmooth, Temp.myIsSmooth); + std::swap(myNeedArrayUpdate, Temp.myNeedArrayUpdate); + std::swap(myNeedTextureUpdate, Temp.myNeedTextureUpdate); + myPixels.swap(Temp.myPixels); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Create the OpenGL texture +//////////////////////////////////////////////////////////// +bool Image::CreateTexture() +{ + // Check if texture parameters are valid before creating it + if (!myWidth || !myHeight) + return false; + + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + // Adjust internal texture dimensions depending on NPOT textures support + unsigned int TextureWidth = GetValidTextureSize(myWidth); + unsigned int TextureHeight = GetValidTextureSize(myHeight); + + // Check the maximum texture size + GLint MaxSize; + GLCheck(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxSize)); + if ((TextureWidth > static_cast(MaxSize)) || (TextureHeight > static_cast(MaxSize))) + { + std::cerr << "Failed to create image, its internal size is too high (" << TextureWidth << "x" << TextureHeight << ")" << std::endl; + return false; + } + + // Destroy the previous OpenGL texture if it already exists with another size + if ((TextureWidth != myTextureWidth) || (TextureHeight != myTextureHeight)) + { + DestroyTexture(); + myTextureWidth = TextureWidth; + myTextureHeight = TextureHeight; + } + + // Create the OpenGL texture + if (!myTexture) + { + GLint PreviousTexture; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + + GLuint Texture = 0; + GLCheck(glGenTextures(1, &Texture)); + GLCheck(glBindTexture(GL_TEXTURE_2D, Texture)); + GLCheck(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, myTextureWidth, myTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL)); + GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)); + GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)); + GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); + GLCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myIsSmooth ? GL_LINEAR : GL_NEAREST)); + myTexture = static_cast(Texture); + + GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + } + + myNeedTextureUpdate = true; + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Make sure the texture in video memory is updated with the +/// array of pixels +//////////////////////////////////////////////////////////// +void Image::EnsureTextureUpdate() const +{ + if (myNeedTextureUpdate) + { + // Copy the pixels + if (myTexture && !myPixels.empty()) + { + GLint PreviousTexture; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + + // Update the texture with the pixels array in RAM + GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); + GLCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, myWidth, myHeight, GL_RGBA, GL_UNSIGNED_BYTE, &myPixels[0])); + + GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + } + + myNeedTextureUpdate = false; + } +} + + +//////////////////////////////////////////////////////////// +/// Make sure the array of pixels is updated with the +/// texture in video memory +//////////////////////////////////////////////////////////// +void Image::EnsureArrayUpdate() const +{ + if (myNeedArrayUpdate) + { + // Save the previous texture + GLint PreviousTexture; + GLCheck(glGetIntegerv(GL_TEXTURE_BINDING_2D, &PreviousTexture)); + + // Resize the destination array of pixels + myPixels.resize(myWidth * myHeight); + + if ((myWidth == myTextureWidth) && (myHeight == myTextureHeight)) + { + // Texture and array have the same size, we can use a direct copy + + // Copy pixels from texture to array + GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); + GLCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &myPixels[0])); + } + else + { + // Texture and array don't have the same size, we have to use a slower algorithm + + // All the pixels will first be copied to a temporary array + std::vector AllPixels(myTextureWidth * myTextureHeight); + GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture)); + GLCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &AllPixels[0])); + + // The we copy the useful pixels from the temporary array to the final one + const Color* Src = &AllPixels[0]; + Color* Dst = &myPixels[0]; + for (unsigned int i = 0; i < myHeight; ++i) + { + std::copy(Src, Src + myWidth, Dst); + Src += myTextureWidth; + Dst += myWidth; + } + } + + // Restore the previous texture + GLCheck(glBindTexture(GL_TEXTURE_2D, PreviousTexture)); + + myNeedArrayUpdate = false; + } +} + + +//////////////////////////////////////////////////////////// +/// Reset the image attributes +//////////////////////////////////////////////////////////// +void Image::Reset() +{ + DestroyTexture(); + + myWidth = 0; + myHeight = 0; + myTextureWidth = 0; + myTextureHeight = 0; + myTexture = 0; + myIsSmooth = true; + myNeedTextureUpdate = false; + myNeedArrayUpdate = false; + myPixels.clear(); +} + + +//////////////////////////////////////////////////////////// +/// Destroy the OpenGL texture +//////////////////////////////////////////////////////////// +void Image::DestroyTexture() +{ + // Destroy the internal texture + if (myTexture) + { + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + GLuint Texture = static_cast(myTexture); + GLCheck(glDeleteTextures(1, &Texture)); + myTexture = 0; + myNeedTextureUpdate = false; + myNeedArrayUpdate = false; + } +} + +} // namespace sf diff --git a/src/SFML/Graphics/ImageLoader.cpp b/src/SFML/Graphics/ImageLoader.cpp new file mode 100644 index 00000000..b9c6a1be --- /dev/null +++ b/src/SFML/Graphics/ImageLoader.cpp @@ -0,0 +1,332 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +extern "C" +{ + #include + #include +} +#include +#include +#include + + +namespace +{ + //////////////////////////////////////////////////////////// + /// Error callback for PNG writing + //////////////////////////////////////////////////////////// + void PngErrorHandler(png_structp Png, png_const_charp Message) + { + std::cerr << "Failed to write PNG image. Reason : " << Message << std::endl; + longjmp(Png->jmpbuf, 1); + } +} + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get the unique instance of the class +//////////////////////////////////////////////////////////// +ImageLoader& ImageLoader::GetInstance() +{ + static ImageLoader Instance; + + return Instance; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +ImageLoader::ImageLoader() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +ImageLoader::~ImageLoader() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Load pixels from an image file +//////////////////////////////////////////////////////////// +bool ImageLoader::LoadImageFromFile(const std::string& Filename, std::vector& Pixels, unsigned int& Width, unsigned int& Height) +{ + // Clear the array (just in case) + Pixels.clear(); + + // Load the image and get a pointer to the pixels in memory + int ImgWidth, ImgHeight, ImgChannels; + unsigned char* PixelsPtr = SOIL_load_image(Filename.c_str(), &ImgWidth, &ImgHeight, &ImgChannels, SOIL_LOAD_RGBA); + + if (PixelsPtr) + { + // Assign the image properties + Width = ImgWidth; + Height = ImgHeight; + + // Copy the loaded pixels to the pixel buffer + Pixels.resize(Width * Height); + memcpy(&Pixels[0], PixelsPtr, Width * Height * 4); + + // Free the loaded pixels (they are now in our own pixel buffer) + SOIL_free_image_data(PixelsPtr); + + return true; + } + else + { + // Error, failed to load the image + std::cerr << "Failed to load image \"" << Filename << "\". Reason : " << SOIL_last_result() << std::endl; + + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Load pixels from an image file in memory +//////////////////////////////////////////////////////////// +bool ImageLoader::LoadImageFromMemory(const char* Data, std::size_t SizeInBytes, std::vector& Pixels, unsigned int& Width, unsigned int& Height) +{ + // Clear the array (just in case) + Pixels.clear(); + + // Load the image and get a pointer to the pixels in memory + const unsigned char* Buffer = reinterpret_cast(Data); + int Size = static_cast(SizeInBytes); + int ImgWidth, ImgHeight, ImgChannels; + unsigned char* PixelsPtr = SOIL_load_image_from_memory(Buffer, Size, &ImgWidth, &ImgHeight, &ImgChannels, SOIL_LOAD_RGBA); + + if (PixelsPtr) + { + // Assign the image properties + Width = ImgWidth; + Height = ImgHeight; + + // Copy the loaded pixels to the pixel buffer + Pixels.resize(Width * Height); + memcpy(&Pixels[0], PixelsPtr, Width * Height * 4); + + // Free the loaded pixels (they are now in our own pixel buffer) + SOIL_free_image_data(PixelsPtr); + + return true; + } + else + { + // Error, failed to load the image + std::cerr << "Failed to load image from memory. Reason : " << SOIL_last_result() << std::endl; + + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Save pixels to an image file +//////////////////////////////////////////////////////////// +bool ImageLoader::SaveImageToFile(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height) +{ + // Deduce the image type from its extension + int Type = -1; + if (Filename.size() > 3) + { + std::string Extension = Filename.substr(Filename.size() - 3); + if (Extension == "bmp" || Extension == "BMP") Type = SOIL_SAVE_TYPE_BMP; + else if (Extension == "tga" || Extension == "TGA") Type = SOIL_SAVE_TYPE_TGA; + else if (Extension == "dds" || Extension == "DDS") Type = SOIL_SAVE_TYPE_DDS; + + // Special handling for PNG and JPG -- not handled by SOIL + else if (Extension == "png" || Extension == "PNG") return WritePng(Filename, Pixels, Width, Height); + else if (Extension == "jpg" || Extension == "JPG") return WriteJpg(Filename, Pixels, Width, Height); + } + + if (Type == -1) + { + // Error, incompatible type + std::cerr << "Failed to save image \"" << Filename << "\". Reason : this image format is not supported" << std::endl; + return false; + } + + // Finally save the image + const unsigned char* PixelsPtr = reinterpret_cast(&Pixels[0]); + if (!SOIL_save_image(Filename.c_str(), Type, static_cast(Width), static_cast(Height), 4, PixelsPtr)) + { + // Error, failed to save the image + std::cerr << "Failed to save image \"" << Filename << "\". Reason : " << SOIL_last_result() << std::endl; + return false; + } + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Save a JPG image file +//////////////////////////////////////////////////////////// +bool ImageLoader::WriteJpg(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height) +{ + // Open the file to write in + FILE* File = fopen(Filename.c_str(), "wb"); + if (!File) + { + std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot open file" << std::endl; + return false; + } + + // Initialize the error handler + jpeg_compress_struct CompressInfo; + jpeg_error_mgr ErrorManager; + CompressInfo.err = jpeg_std_error(&ErrorManager); + + // Initialize all the writing and compression infos + jpeg_create_compress(&CompressInfo); + CompressInfo.image_width = Width; + CompressInfo.image_height = Height; + CompressInfo.input_components = 3; + CompressInfo.in_color_space = JCS_RGB; + jpeg_stdio_dest(&CompressInfo, File); + jpeg_set_defaults(&CompressInfo); + jpeg_set_quality(&CompressInfo, 90, TRUE); + + // Get rid of the aplha channel + std::vector PixelsBuffer(Width * Height * 3); + for (std::size_t i = 0; i < Pixels.size(); ++i) + { + PixelsBuffer[i * 3 + 0] = Pixels[i].r; + PixelsBuffer[i * 3 + 1] = Pixels[i].g; + PixelsBuffer[i * 3 + 2] = Pixels[i].b; + } + Uint8* PixelsPtr = &PixelsBuffer[0]; + + // Start compression + jpeg_start_compress(&CompressInfo, TRUE); + + // Write each row of the image + while (CompressInfo.next_scanline < CompressInfo.image_height) + { + JSAMPROW RowPointer = PixelsPtr + (CompressInfo.next_scanline * Width * 3); + jpeg_write_scanlines(&CompressInfo, &RowPointer, 1); + } + + // Finish compression + jpeg_finish_compress(&CompressInfo); + jpeg_destroy_compress(&CompressInfo); + + // Close the file + fclose(File); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Save a PNG image file +//////////////////////////////////////////////////////////// +bool ImageLoader::WritePng(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height) +{ + // Open the file to write in + FILE* File = fopen(Filename.c_str(), "wb"); + if (!File) + { + std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot open file" << std::endl; + return false; + } + + // Create the main PNG structure + png_structp Png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, &PngErrorHandler, NULL); + if (!Png) + { + fclose(File); + std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot allocate PNG write structure" << std::endl; + return false; + } + + // Initialize the image informations + png_infop PngInfo = png_create_info_struct(Png); + if (!PngInfo) + { + fclose(File); + png_destroy_write_struct(&Png, NULL); + std::cerr << "Failed to save image file \"" << Filename << "\". Reason : cannot allocate PNG info structure" << std::endl; + return false; + } + + // For proper error handling... + if (setjmp(Png->jmpbuf)) + { + png_destroy_write_struct(&Png, &PngInfo); + return false; + } + + // Link the file to the PNG structure + png_init_io(Png, File); + + // Set the image informations + png_set_IHDR(Png, PngInfo, Width, Height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + // Write the header + png_write_info(Png, PngInfo); + + // Get the pointers to the pixels rows into an array + png_byte* PixelsPtr = (png_byte*)&Pixels[0]; + std::vector RowPointers(Height); + for (unsigned int i = 0; i < Height; ++i) + { + RowPointers[i] = PixelsPtr; + PixelsPtr += Width * 4; + } + + // Write pixels row by row + png_set_rows(Png, PngInfo, &RowPointers[0]); + png_write_png(Png, PngInfo, PNG_TRANSFORM_IDENTITY, NULL); + + // Finish writing the file + png_write_end(Png, PngInfo); + + // Cleanup resources + png_destroy_write_struct(&Png, &PngInfo); + fclose(File); + + return true; +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Graphics/ImageLoader.hpp b/src/SFML/Graphics/ImageLoader.hpp new file mode 100644 index 00000000..45b2b205 --- /dev/null +++ b/src/SFML/Graphics/ImageLoader.hpp @@ -0,0 +1,143 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IMAGELOADER_HPP +#define SFML_IMAGELOADER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// ImageLoader load and save images from files ; +/// Supported formats are : bmp, dds, jpg, png, tga, psd +//////////////////////////////////////////////////////////// +class ImageLoader : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Get the unique instance of the class + /// + /// \return Reference to the ImageLoader instance + /// + //////////////////////////////////////////////////////////// + static ImageLoader& GetInstance(); + + //////////////////////////////////////////////////////////// + /// Load pixels from an image file + /// + /// \param Filename : Path of image file to load + /// \param Pixels : Array of pixels to fill with loaded image + /// \param Width : Width of loaded image, in pixels + /// \param Height : Height of loaded image, in pixels + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadImageFromFile(const std::string& Filename, std::vector& Pixels, unsigned int& Width, unsigned int& Height); + + //////////////////////////////////////////////////////////// + /// Load pixels from an image file in memory + /// + /// \param Data : Pointer to the file data in memory + /// \param SizeInBytes : Size of the data to load, in bytes + /// \param Pixels : Array of pixels to fill with loaded image + /// \param Width : Width of loaded image, in pixels + /// \param Height : Height of loaded image, in pixels + /// + /// \return True if loading was successful + /// + //////////////////////////////////////////////////////////// + bool LoadImageFromMemory(const char* Data, std::size_t SizeInBytes, std::vector& Pixels, unsigned int& Width, unsigned int& Height); + + //////////////////////////////////////////////////////////// + /// Save pixels to an image file + /// + /// \param Filename : Path of image file to save + /// \param Pixels : Array of pixels to save to image + /// \param Width : Width of image to save, in pixels + /// \param Height : Height of image to save, in pixels + /// + /// \return True if saving was successful + /// + //////////////////////////////////////////////////////////// + bool SaveImageToFile(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height); + +private : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + ImageLoader(); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~ImageLoader(); + + //////////////////////////////////////////////////////////// + /// Save a JPG image file + /// + /// \param Filename : Path of image file to save + /// \param Pixels : Array of pixels to save to image + /// \param Width : Width of image to save, in pixels + /// \param Height : Height of image to save, in pixels + /// + /// \return True if saving was successful + /// + //////////////////////////////////////////////////////////// + bool WriteJpg(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height); + + //////////////////////////////////////////////////////////// + /// Save a PNG image file + /// + /// \param Filename : Path of image file to save + /// \param Pixels : Array of pixels to save to image + /// \param Width : Width of image to save, in pixels + /// \param Height : Height of image to save, in pixels + /// + /// \return True if saving was successful + /// + //////////////////////////////////////////////////////////// + bool WritePng(const std::string& Filename, const std::vector& Pixels, unsigned int Width, unsigned int Height); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_IMAGELOADER_HPP diff --git a/src/SFML/Graphics/Makefile b/src/SFML/Graphics/Makefile new file mode 100644 index 00000000..f1cc6ffa --- /dev/null +++ b/src/SFML/Graphics/Makefile @@ -0,0 +1,47 @@ +SRC = $(wildcard *.cpp) +SRCGLEW = $(wildcard ./GLEW/*.c) +SRCJPEG = $(wildcard ./libjpeg/*.c) +SRCPNG = $(wildcard ./libpng/*.c) +SRCSOIL = $(wildcard ./SOIL/*.c) +SRCZLIB = $(wildcard ./zlib/*.c) +OBJ = $(SRC:.cpp=.o) +OBJGLEW = $(SRCGLEW:.c=.o) +OBJJPEG = $(SRCJPEG:.c=.o) +OBJPNG = $(SRCPNG:.c=.o) +OBJSOIL = $(SRCSOIL:.c=.o) +OBJZLIB = $(SRCZLIB:.c=.o) + +ifeq ($(STATIC), yes) + LIB = libsfml-graphics-s.a + LIBNAME = $(LIBPATH)/$(LIB) + INSTALL = +else + LIB = libsfml-graphics.so + LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + INSTALL = && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) +endif + +all: $(LIB) + +libsfml-graphics-s.a: $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) + $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) + +libsfml-graphics.so: $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) -lfreetype + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) -I/usr/include/freetype2 + +$(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB): %.o: %.c + $(CC) -o $@ -c $< $(CFLAGSEXT) -DSTBI_FAILURE_USERMSG + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) diff --git a/src/SFML/Graphics/Matrix3.cpp b/src/SFML/Graphics/Matrix3.cpp new file mode 100644 index 00000000..705e06fa --- /dev/null +++ b/src/SFML/Graphics/Matrix3.cpp @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +const Matrix3 Matrix3::Identity(1, 0, 0, + 0, 1, 0, + 0, 0, 1); + +} // namespace sf diff --git a/src/SFML/Graphics/PostFX.cpp b/src/SFML/Graphics/PostFX.cpp new file mode 100644 index 00000000..49948e2d --- /dev/null +++ b/src/SFML/Graphics/PostFX.cpp @@ -0,0 +1,506 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +PostFX::PostFX() : +myShaderProgram(0) +{ + // No filtering on frame buffer + myFrameBuffer.SetSmooth(false); +} + + +//////////////////////////////////////////////////////////// +/// Copy constructor +//////////////////////////////////////////////////////////// +PostFX::PostFX(const PostFX& Copy) : +Drawable (Copy), +myShaderProgram (0), +myTextures (Copy.myTextures), +myFragmentShader(Copy.myFragmentShader), +myFrameBuffer (Copy.myFrameBuffer) +{ + // No filtering on frame buffer + myFrameBuffer.SetSmooth(false); + + // Create the shaders and the program + if (Copy.myShaderProgram) + CreateProgram(); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +PostFX::~PostFX() +{ + // Destroy effect program + if (myShaderProgram) + { + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + GLCheck(glDeleteObjectARB(myShaderProgram)); + } +} + + +//////////////////////////////////////////////////////////// +/// Load the effect from a file +//////////////////////////////////////////////////////////// +bool PostFX::LoadFromFile(const std::string& Filename) +{ + // Open the file + std::ifstream File(Filename.c_str()); + if (!File) + { + std::cerr << "Failed to open effect file \"" << Filename << "\"" << std::endl; + return false; + } + + // Apply the preprocessing pass to the fragment shader code + myFragmentShader = PreprocessEffect(File); + + // Create the shaders and the program + CreateProgram(); + + return myShaderProgram != 0; +} + + +//////////////////////////////////////////////////////////// +/// Load the effect from a text in memory +//////////////////////////////////////////////////////////// +bool PostFX::LoadFromMemory(const std::string& Effect) +{ + // Open a stream and copy the effect code + std::istringstream Stream(Effect.c_str()); + + // Apply the preprocessing pass to the fragment shader code + myFragmentShader = PreprocessEffect(Stream); + + // Create the shaders and the program + CreateProgram(); + + return myShaderProgram != 0; +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of the effect (1 float) +//////////////////////////////////////////////////////////// +void PostFX::SetParameter(const std::string& Name, float X) +{ + if (myShaderProgram) + { + // Enable program + GLCheck(glUseProgramObjectARB(myShaderProgram)); + + // Get parameter location and assign it new values + GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); + if (Location != -1) + GLCheck(glUniform1fARB(Location, X)); + else + std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + + // Disable program + GLCheck(glUseProgramObjectARB(0)); + } +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of the effect (2 floats) +//////////////////////////////////////////////////////////// +void PostFX::SetParameter(const std::string& Name, float X, float Y) +{ + if (myShaderProgram) + { + // Enable program + GLCheck(glUseProgramObjectARB(myShaderProgram)); + + // Get parameter location and assign it new values + GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); + if (Location != -1) + GLCheck(glUniform2fARB(Location, X, Y)); + else + std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + + // Disable program + GLCheck(glUseProgramObjectARB(0)); + } +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of the effect (3 floats) +//////////////////////////////////////////////////////////// +void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z) +{ + if (myShaderProgram) + { + // Enable program + GLCheck(glUseProgramObjectARB(myShaderProgram)); + + // Get parameter location and assign it new values + GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); + if (Location != -1) + GLCheck(glUniform3fARB(Location, X, Y, Z)); + else + std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + + // Disable program + GLCheck(glUseProgramObjectARB(0)); + } +} + + +//////////////////////////////////////////////////////////// +/// Change a parameter of the effect (4 floats) +//////////////////////////////////////////////////////////// +void PostFX::SetParameter(const std::string& Name, float X, float Y, float Z, float W) +{ + if (myShaderProgram) + { + // Enable program + GLCheck(glUseProgramObjectARB(myShaderProgram)); + + // Get parameter location and assign it new values + GLint Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); + if (Location != -1) + GLCheck(glUniform4fARB(Location, X, Y, Z, W)); + else + std::cerr << "Parameter \"" << Name << "\" not found in post-effect" << std::endl; + + // Disable program + GLCheck(glUseProgramObjectARB(0)); + } +} + + +//////////////////////////////////////////////////////////// +/// Set a texture parameter +//////////////////////////////////////////////////////////// +void PostFX::SetTexture(const std::string& Name, Image* Texture) +{ + // Check that the current texture unit is available + GLint MaxUnits; + GLCheck(glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &MaxUnits)); + if (myTextures.size() >= static_cast(MaxUnits)) + { + std::cerr << "Impossible to use texture \"" << Name << "\" for post-effect : all available texture units are used" << std::endl; + return; + } + + // Make sure the given name is a valid variable in the effect + int Location = glGetUniformLocationARB(myShaderProgram, Name.c_str()); + if (Location == -1) + { + std::cerr << "Texture \"" << Name << "\" not found in post-effect" << std::endl; + return; + } + + // Store the texture for later use + myTextures[Name] = Texture ? Texture : &myFrameBuffer; +} + + +//////////////////////////////////////////////////////////// +/// Assignment operator +//////////////////////////////////////////////////////////// +PostFX& PostFX::operator =(const PostFX& Other) +{ + PostFX Temp(Other); + + std::swap(myShaderProgram, Temp.myShaderProgram); + std::swap(myTextures, Temp.myTextures); + std::swap(myFragmentShader, Temp.myFragmentShader); + std::swap(myFrameBuffer, Temp.myFrameBuffer); + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the system supports post-effects +//////////////////////////////////////////////////////////// +bool PostFX::CanUsePostFX() +{ + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + return glewIsSupported("GL_ARB_shading_language_100") != 0 && + glewIsSupported("GL_ARB_shader_objects") != 0 && + glewIsSupported("GL_ARB_vertex_shader") != 0 && + glewIsSupported("GL_ARB_fragment_shader") != 0; +} + + +//////////////////////////////////////////////////////////// +/// /see Drawable::Render +//////////////////////////////////////////////////////////// +void PostFX::Render(RenderTarget& Target) const +{ + // Check that we have a valid program + if (!myShaderProgram) + return; + + // Copy the current framebuffer pixels to our frame buffer texture + // The ugly cast is temporary until PostFx are rewritten :) + myFrameBuffer.CopyScreen((RenderWindow&)Target); + + // Enable program + GLCheck(glUseProgramObjectARB(myShaderProgram)); + + // Bind textures + TextureTable::const_iterator ItTex = myTextures.begin(); + for (std::size_t i = 0; i < myTextures.size(); ++i) + { + int Location = glGetUniformLocationARB(myShaderProgram, ItTex->first.c_str()); + GLCheck(glUniform1iARB(Location, static_cast(i))); + GLCheck(glActiveTextureARB(static_cast(GL_TEXTURE0_ARB + i))); + ItTex->second->Bind(); + ItTex++; + } + + // Compute the texture coordinates (in case the texture is larger than the screen, or flipped) + IntRect FrameBufferRect(0, 0, myFrameBuffer.GetWidth(), myFrameBuffer.GetHeight()); + FloatRect TexCoords = myFrameBuffer.GetTexCoords(FrameBufferRect); + + // Render a fullscreen quad using the effect on our framebuffer + FloatRect Screen = Target.GetView().GetRect(); + glBegin(GL_QUADS); + glTexCoord2f(TexCoords.Left, TexCoords.Top); glVertex2f(Screen.Left, Screen.Bottom); + glTexCoord2f(TexCoords.Right, TexCoords.Top); glVertex2f(Screen.Right, Screen.Bottom); + glTexCoord2f(TexCoords.Right, TexCoords.Bottom); glVertex2f(Screen.Right, Screen.Top); + glTexCoord2f(TexCoords.Left, TexCoords.Bottom); glVertex2f(Screen.Left, Screen.Top); + glEnd(); + + // Disable program + GLCheck(glUseProgramObjectARB(0)); + + // Disable texture units + for (std::size_t i = 0; i < myTextures.size(); ++i) + { + GLCheck(glActiveTextureARB(static_cast(GL_TEXTURE0_ARB + i))); + GLCheck(glBindTexture(GL_TEXTURE_2D, 0)); + } + GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB)); +} + + +//////////////////////////////////////////////////////////// +/// Preprocess a SFML effect file +/// to convert it to a valid GLSL fragment shader +//////////////////////////////////////////////////////////// +std::string PostFX::PreprocessEffect(std::istream& File) +{ + // Initialize output string + std::set myTextures; + std::string Out = ""; + + // Variable declarations + std::string Line; + while (std::getline(File, Line) && (Line.substr(0, 6) != "effect")) + { + // Remove the ending '\r', if any + if (!Line.empty() && (Line[Line.size() - 1] == '\r')) + Line.erase(Line.size() - 1); + + // Skip empty lines + if (Line == "") + continue; + + // Extract variables type and name and convert them + std::string Type, Name; + std::istringstream iss(Line); + if (!(iss >> Type >> Name)) + { + std::cerr << "Post-effect error : invalid declaration (should be \"[type][name]\")" << std::endl + << "> " << Line << std::endl; + return ""; + } + + if (Type == "texture") + { + // Textures need some checking and conversion + if (myTextures.find(Name) != myTextures.end()) + { + std::cerr << "Post-effect error : texture \"" << Name << "\" already exists" << std::endl; + return ""; + } + + Out += "uniform sampler2D " + Name + ";\n"; + myTextures.insert(Name); + } + else + { + // Other types are just copied to output with "uniform" prefix + Out += "uniform " + Type + " " + Name + ";\n"; + } + } + + // Effect code + Out += "void main()\n"; + while (std::getline(File, Line)) + { + // Replace any texture lookup "T(" by "texture2D(T, " + for (std::set::const_iterator i = myTextures.begin(); i != myTextures.end(); ++i) + { + std::string::size_type Pos = Line.find(*i); + if (Pos != std::string::npos) + Line.replace(Pos, i->size() + 1, "texture2D(" + *i + ", "); + } + + // Replace "_in" by "gl_TexCoord[0].xy" + for (std::string::size_type Pos = Line.find("_in"); Pos != std::string::npos; Pos = Line.find("_in")) + Line.replace(Pos, 3, "gl_TexCoord[0].xy"); + + // Replace "_out" by "gl_FragColor" + for (std::string::size_type Pos = Line.find("_out"); Pos != std::string::npos; Pos = Line.find("_out")) + Line.replace(Pos, 4, "gl_FragColor"); + + // Write modified line to output string + Out += Line + "\n"; + } + + return Out; +} + + +//////////////////////////////////////////////////////////// +/// Create the program and attach the shaders +//////////////////////////////////////////////////////////// +void PostFX::CreateProgram() +{ + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + // Check that we can use post-FX ! + if (!CanUsePostFX()) + { + std::cerr << "Failed to create a PostFX : your system doesn't support effects" << std::endl; + return; + } + + // Destroy effect program if it was already created + if (myShaderProgram) + GLCheck(glDeleteObjectARB(myShaderProgram)); + + // Define vertex shader source (we provide it directly as it doesn't have to change) + static const std::string VertexShaderSrc = + "void main()" + "{" + " gl_TexCoord[0] = gl_MultiTexCoord0;" + " gl_Position = ftransform();" + "}"; + + // Create the program + myShaderProgram = glCreateProgramObjectARB(); + + // Create the shaders + GLhandleARB VertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + GLhandleARB FragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + + // Compile them + const char* VertexSrc = VertexShaderSrc.c_str(); + const char* FragmentSrc = myFragmentShader.c_str(); + GLCheck(glShaderSourceARB(VertexShader, 1, &VertexSrc, NULL)); + GLCheck(glShaderSourceARB(FragmentShader, 1, &FragmentSrc, NULL)); + GLCheck(glCompileShaderARB(VertexShader)); + GLCheck(glCompileShaderARB(FragmentShader)); + + // Check the compile logs + GLint Success; + GLCheck(glGetObjectParameterivARB(VertexShader, GL_OBJECT_COMPILE_STATUS_ARB, &Success)); + if (Success == GL_FALSE) + { + char CompileLog[1024]; + GLCheck(glGetInfoLogARB(VertexShader, sizeof(CompileLog), 0, CompileLog)); + std::cerr << "Failed to compile post-effect :" << std::endl + << CompileLog << std::endl; + GLCheck(glDeleteObjectARB(VertexShader)); + GLCheck(glDeleteObjectARB(FragmentShader)); + GLCheck(glDeleteObjectARB(myShaderProgram)); + myShaderProgram = 0; + return; + } + GLCheck(glGetObjectParameterivARB(FragmentShader, GL_OBJECT_COMPILE_STATUS_ARB, &Success)); + if (Success == GL_FALSE) + { + char CompileLog[1024]; + GLCheck(glGetInfoLogARB(FragmentShader, sizeof(CompileLog), 0, CompileLog)); + std::cerr << "Failed to compile post-effect :" << std::endl + << CompileLog << std::endl; + GLCheck(glDeleteObjectARB(VertexShader)); + GLCheck(glDeleteObjectARB(FragmentShader)); + GLCheck(glDeleteObjectARB(myShaderProgram)); + myShaderProgram = 0; + return; + } + + // Attach the shaders to the program + GLCheck(glAttachObjectARB(myShaderProgram, VertexShader)); + GLCheck(glAttachObjectARB(myShaderProgram, FragmentShader)); + + // We can now delete the shaders + GLCheck(glDeleteObjectARB(VertexShader)); + GLCheck(glDeleteObjectARB(FragmentShader)); + + // Link the program + GLCheck(glLinkProgramARB(myShaderProgram)); + + // Get link log + GLCheck(glGetObjectParameterivARB(myShaderProgram, GL_OBJECT_LINK_STATUS_ARB, &Success)); + if (Success == GL_FALSE) + { + // Oops... link errors + char LinkLog[1024]; + GLCheck(glGetInfoLogARB(myShaderProgram, sizeof(LinkLog), 0, LinkLog)); + std::cerr << "Failed to link post-effect :" << std::endl + << LinkLog << std::endl; + GLCheck(glDeleteObjectARB(myShaderProgram)); + myShaderProgram = 0; + return; + } +} + +} // namespace sf diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp new file mode 100644 index 00000000..58c1c977 --- /dev/null +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -0,0 +1,191 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +RenderTarget::RenderTarget() : +myCurrentView (&myDefaultView), +myPreserveStates(false), +myIsDrawing (false) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +RenderTarget::~RenderTarget() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Clear the entire target with a single color +//////////////////////////////////////////////////////////// +void RenderTarget::Clear(const Color& FillColor) +{ + if (Activate(true)) + { + // Clear the frame buffer + GLCheck(glClearColor(FillColor.r / 255.f, FillColor.g / 255.f, FillColor.b / 255.f, FillColor.a / 255.f)); + GLCheck(glClear(GL_COLOR_BUFFER_BIT)); + + Activate(false); + } +} + + +//////////////////////////////////////////////////////////// +/// Draw something on the window +//////////////////////////////////////////////////////////// +void RenderTarget::Draw(const Drawable& Object) +{ + // Check whether we are called from the outside or from a previous call to Draw + if (!myIsDrawing) + { + myIsDrawing = true; + + // Set our target as the current target for rendering + if (Activate(true)) + { + // Save the current render states and set the SFML ones + if (myPreserveStates) + { + GLCheck(glMatrixMode(GL_MODELVIEW)); GLCheck(glPushMatrix()); + GLCheck(glMatrixMode(GL_PROJECTION)); GLCheck(glPushMatrix()); + GLCheck(glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_ENABLE_BIT | + GL_TEXTURE_BIT | GL_TRANSFORM_BIT | GL_VIEWPORT_BIT)); + SetRenderStates(); + } + + // Set the window viewport and transform matrices + GLCheck(glViewport(0, 0, GetWidth(), GetHeight())); + GLCheck(glMatrixMode(GL_PROJECTION)); GLCheck(glLoadMatrixf(myCurrentView->GetMatrix().Get4x4Elements())); + GLCheck(glMatrixMode(GL_MODELVIEW)); GLCheck(glLoadIdentity()); + + // Let the object draw itself + Object.Draw(*this); + + // Restore render states + if (myPreserveStates) + { + GLCheck(glMatrixMode(GL_PROJECTION)); GLCheck(glPopMatrix()); + GLCheck(glMatrixMode(GL_MODELVIEW)); GLCheck(glPopMatrix()); + GLCheck(glPopAttrib()); + } + + // Deactivate rendering on this target + Activate(false); + } + + myIsDrawing = false; + } + else + { + // We are already called from a previous Draw : we don't need to set the states again, just draw the object + Object.Draw(*this); + } +} + + +//////////////////////////////////////////////////////////// +/// Change the current active view +//////////////////////////////////////////////////////////// +void RenderTarget::SetView(const View& NewView) +{ + myCurrentView = &NewView; +} + + +//////////////////////////////////////////////////////////// +/// Get the current view +//////////////////////////////////////////////////////////// +const View& RenderTarget::GetView() const +{ + return *myCurrentView; +} + + +//////////////////////////////////////////////////////////// +/// Get the default view of the window for read / write +//////////////////////////////////////////////////////////// +View& RenderTarget::GetDefaultView() +{ + return myDefaultView; +} + + +//////////////////////////////////////////////////////////// +/// Tell SFML to preserve external OpenGL states, at the expense of +/// more CPU charge. Use this function if you don't want SFML +/// to mess up your own OpenGL states (if any). +/// Don't enable state preservation if not needed, as it will allow +/// SFML to do internal optimizations and improve performances. +/// This parameter is false by default +//////////////////////////////////////////////////////////// +void RenderTarget::PreserveOpenGLStates(bool Preserve) +{ + myPreserveStates = Preserve; +} + + +//////////////////////////////////////////////////////////// +/// Called by the derived class when it's ready to be initialized +//////////////////////////////////////////////////////////// +void RenderTarget::Initialize() +{ + // Set the default rendering states + SetRenderStates(); + + // Setup the default view + myDefaultView.SetFromRect(FloatRect(0, 0, static_cast(GetWidth()), static_cast(GetHeight()))); + SetView(myDefaultView); +} + + +//////////////////////////////////////////////////////////// +/// Set the OpenGL render states needed for the SFML rendering +//////////////////////////////////////////////////////////// +void RenderTarget::SetRenderStates() +{ + GLCheck(glDisable(GL_ALPHA_TEST)); + GLCheck(glDisable(GL_DEPTH_TEST)); + GLCheck(glDisable(GL_LIGHTING)); +} + +} // namespace sf diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp new file mode 100644 index 00000000..9ef4e8d5 --- /dev/null +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +RenderWindow::RenderWindow() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Construct the window +//////////////////////////////////////////////////////////// +RenderWindow::RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const WindowSettings& Params) +{ + Create(Mode, Title, WindowStyle, Params); +} + + +//////////////////////////////////////////////////////////// +/// Construct the window from an existing control +//////////////////////////////////////////////////////////// +RenderWindow::RenderWindow(WindowHandle Handle, const WindowSettings& Params) +{ + Create(Handle, Params); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +RenderWindow::~RenderWindow() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// /see RenderTarget::Activate +//////////////////////////////////////////////////////////// +bool RenderWindow::Activate(bool Active) +{ + // For performances and consistency reasons, we only handle activation + if (Active) + return SetActive(); + else + return true; +} + + +//////////////////////////////////////////////////////////// +/// Get the width of the rendering region of the window +//////////////////////////////////////////////////////////// +unsigned int RenderWindow::GetWidth() const +{ + return sf::Window::GetWidth(); +} + + +//////////////////////////////////////////////////////////// +/// Get the height of the rendering region of the window +//////////////////////////////////////////////////////////// +unsigned int RenderWindow::GetHeight() const +{ + return sf::Window::GetHeight(); +} + + +//////////////////////////////////////////////////////////// +/// Save the content of the window to an image +//////////////////////////////////////////////////////////// +Image RenderWindow::Capture() const +{ + // Get the window dimensions + const unsigned int Width = GetWidth(); + const unsigned int Height = GetHeight(); + + // Set our window as the current target for rendering + if (SetActive()) + { + // Make sure we have a valid context + priv::GraphicsContext Ctx; + + // Get pixels from the backbuffer + std::vector Pixels(Width * Height * 4); + Uint8* PixelsPtr = &Pixels[0]; + GLCheck(glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, PixelsPtr)); + + // Flip the pixels + unsigned int Pitch = Width * 4; + for (unsigned int y = 0; y < Height / 2; ++y) + std::swap_ranges(PixelsPtr + y * Pitch, PixelsPtr + (y + 1) * Pitch, PixelsPtr + (Height - y - 1) * Pitch); + + // Create an image from the pixel buffer and return it + return Image(Width, Height, PixelsPtr); + } + else + { + return Image(Width, Height, Color::White); + } +} + + +//////////////////////////////////////////////////////////// +/// Convert a point in window coordinates into view coordinates +//////////////////////////////////////////////////////////// +sf::Vector2f RenderWindow::ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View* TargetView) const +{ + // Use the current view if none has been passed + if (!TargetView) + TargetView = &GetView(); + + float Left = TargetView->GetCenter().x - TargetView->GetHalfSize().x; + float Top = TargetView->GetCenter().y - TargetView->GetHalfSize().y; + float Right = TargetView->GetCenter().x + TargetView->GetHalfSize().x; + float Bottom = TargetView->GetCenter().y + TargetView->GetHalfSize().y; + + return sf::Vector2f(Left + WindowX * (Right - Left) / GetWidth(), + Top + WindowY * (Bottom - Top) / GetHeight()); +} + + +//////////////////////////////////////////////////////////// +/// Called after the window has been created +//////////////////////////////////////////////////////////// +void RenderWindow::OnCreate() +{ + // We can now initialize the render target part + RenderTarget::Initialize(); +} + +} // namespace sf diff --git a/src/SFML/Graphics/SOIL/SOIL.c b/src/SFML/Graphics/SOIL/SOIL.c new file mode 100644 index 00000000..b46eccc9 --- /dev/null +++ b/src/SFML/Graphics/SOIL/SOIL.c @@ -0,0 +1,145 @@ +/* + Jonathan Dummer + 2007-07-26-10.36 + + Simple OpenGL Image Library + + Public Domain + using Sean Barret's stb_image as a base + + Thanks to: + * Sean Barret - for the awesome stb_image + * Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts + * everybody at gamedev.net +*/ + +#define SOIL_CHECK_FOR_GL_ERRORS 0 + +#ifdef WIN32 + #define WIN32_LEAN_AND_MEAN + #include + #include +#elif defined(__APPLE__) || defined(__APPLE_CC__) + /* I can't test this Apple stuff! */ + #define APIENTRY +#else +#endif + +#include "SOIL.h" +#include "stb_image_aug.h" +#include "image_DXT.h" + +#include +#include + +/* error reporting */ +char *result_string_pointer = "SOIL initialized"; + + +unsigned char* + SOIL_load_image + ( + const char *filename, + int *width, int *height, int *channels, + int force_channels + ) +{ + unsigned char *result = stbi_load( (char*)filename, + width, height, channels, force_channels ); + if( result == NULL ) + { + result_string_pointer = stbi_failure_reason(); + } else + { + result_string_pointer = "Image loaded"; + } + return result; +} + +unsigned char* + SOIL_load_image_from_memory + ( + const unsigned char *const buffer, + int buffer_length, + int *width, int *height, int *channels, + int force_channels + ) +{ + unsigned char *result = stbi_load_from_memory( + (stbi_uc *)buffer, buffer_length, + width, height, channels, + force_channels ); + if( result == NULL ) + { + result_string_pointer = stbi_failure_reason(); + } else + { + result_string_pointer = "Image loaded from memory"; + } + return result; +} + +int + SOIL_save_image + ( + const char *filename, + int image_type, + int width, int height, int channels, + const unsigned char *const data + ) +{ + int save_result; + + /* error check */ + if( (width < 1) || (height < 1) || + (channels < 1) || (channels > 4) || + (data == NULL) || + (filename == NULL) ) + { + return 0; + } + if( image_type == SOIL_SAVE_TYPE_BMP ) + { + save_result = stbi_write_bmp( (char*)filename, + width, height, channels, (void*)data ); + } else + if( image_type == SOIL_SAVE_TYPE_TGA ) + { + save_result = stbi_write_tga( (char*)filename, + width, height, channels, (void*)data ); + } else + if( image_type == SOIL_SAVE_TYPE_DDS ) + { + save_result = save_image_as_DDS( (const char*)filename, + width, height, channels, (const unsigned char *const)data ); + } else + { + save_result = 0; + } + if( save_result == 0 ) + { + result_string_pointer = "Saving the image failed"; + } else + { + result_string_pointer = "Image saved"; + } + return save_result; +} + +void + SOIL_free_image_data + ( + unsigned char *img_data + ) +{ + free( (void*)img_data ); +} + +const char* + SOIL_last_result + ( + void + ) +{ + return result_string_pointer; +} diff --git a/src/SFML/Graphics/SOIL/SOIL.h b/src/SFML/Graphics/SOIL/SOIL.h new file mode 100644 index 00000000..22f2bdc1 --- /dev/null +++ b/src/SFML/Graphics/SOIL/SOIL.h @@ -0,0 +1,152 @@ +/** + @mainpage SOIL + + Jonathan Dummer + 2007-07-26-10.36 + + Simple OpenGL Image Library + + A tiny c library for uploading images as + textures into OpenGL. Also saving and + loading of images is supported. + + I'm using Sean's Tool Box image loader as a base: + http://www.nothings.org/ + + I'm upgrading it to load TGA and DDS files, and a direct + path for loading DDS files straight into OpenGL textures, + when applicable. + + Image Formats: + - BMP load & save + - TGA load & save + - DDS load & save + - PNG load + - JPG load + + OpenGL Texture Features: + - resample to power-of-two sizes + - MIPmap generation + - compressed texture S3TC formats (if supported) + - can pre-multiply alpha for you, for better compositing + - can flip image about the y-axis (except pre-compressed DDS files) + + Thanks to: + * Sean Barret - for the awesome stb_image + * Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts + * everybody at gamedev.net +**/ + +#ifndef HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY +#define HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY + +#ifdef __cplusplus +extern "C" { +#endif + +/** + The format of images that may be loaded (force_channels). + SOIL_LOAD_AUTO leaves the image in whatever format it was found. + SOIL_LOAD_L forces the image to load as Luminous (greyscale) + SOIL_LOAD_LA forces the image to load as Luminous with Alpha + SOIL_LOAD_RGB forces the image to load as Red Green Blue + SOIL_LOAD_RGBA forces the image to load as Red Green Blue Alpha +**/ +enum +{ + SOIL_LOAD_AUTO = 0, + SOIL_LOAD_L = 1, + SOIL_LOAD_LA = 2, + SOIL_LOAD_RGB = 3, + SOIL_LOAD_RGBA = 4 +}; + +/** + The types of images that may be saved. + (TGA supports uncompressed RGB / RGBA) + (BMP supports uncompressed RGB) + (DDS supports DXT1 and DXT5) +**/ +enum +{ + SOIL_SAVE_TYPE_TGA = 0, + SOIL_SAVE_TYPE_BMP = 1, + SOIL_SAVE_TYPE_DDS = 2 +}; + +/** + Loads an image from disk into an array of unsigned chars. + Note that *channels return the original channel count of the + image. If force_channels was other than SOIL_LOAD_AUTO, + the resulting image has force_channels, but *channels may be + different (if the original image had a different channel + count). + \return 0 if failed, otherwise returns 1 +**/ +unsigned char* + SOIL_load_image + ( + const char *filename, + int *width, int *height, int *channels, + int force_channels + ); + +/** + Loads an image from memory into an array of unsigned chars. + Note that *channels return the original channel count of the + image. If force_channels was other than SOIL_LOAD_AUTO, + the resulting image has force_channels, but *channels may be + different (if the original image had a different channel + count). + \return 0 if failed, otherwise returns 1 +**/ +unsigned char* + SOIL_load_image_from_memory + ( + const unsigned char *const buffer, + int buffer_length, + int *width, int *height, int *channels, + int force_channels + ); + +/** + Saves an image from an array of unsigned chars (RGBA) to disk + \return 0 if failed, otherwise returns 1 +**/ +int + SOIL_save_image + ( + const char *filename, + int image_type, + int width, int height, int channels, + const unsigned char *const data + ); + +/** + Frees the image data (note, this is just C's "free()"...this function is + present mostly so C++ programmers don't forget to use "free()" and call + "delete []" instead [8^) +**/ +void + SOIL_free_image_data + ( + unsigned char *img_data + ); + +/** + This function resturn a pointer to a string describing the last thing + that happened inside SOIL. It can be used to determine why an image + failed to load. +**/ +const char* + SOIL_last_result + ( + void + ); + + +#ifdef __cplusplus +} +#endif + +#endif /* HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY */ diff --git a/src/SFML/Graphics/SOIL/image_DXT.c b/src/SFML/Graphics/SOIL/image_DXT.c new file mode 100644 index 00000000..eb90be67 --- /dev/null +++ b/src/SFML/Graphics/SOIL/image_DXT.c @@ -0,0 +1,632 @@ +/* + Jonathan Dummer + 2007-07-31-10.32 + + simple DXT compression / decompression code + + public domain +*/ + +#include "image_DXT.h" +#include +#include +#include +#include + +/* set this =1 if you want to use the covarince matrix method... + which is better than my method of using standard deviations + overall, except on the infintesimal chance that the power + method fails for finding the largest eigenvector */ +#define USE_COV_MAT 1 + +/********* Function Prototypes *********/ +/* + Takes a 4x4 block of pixels and compresses it into 8 bytes + in DXT1 format (color only, no alpha). Speed is valued + over prettyness, at least for now. +*/ +void compress_DDS_color_block( + int channels, + const unsigned char *const uncompressed, + unsigned char compressed[8] ); +/* + Takes a 4x4 block of pixels and compresses the alpha + component it into 8 bytes for use in DXT5 DDS files. + Speed is valued over prettyness, at least for now. +*/ +void compress_DDS_alpha_block( + const unsigned char *const uncompressed, + unsigned char compressed[8] ); + +/********* Actual Exposed Functions *********/ +int + save_image_as_DDS + ( + const char *filename, + int width, int height, int channels, + const unsigned char *const data + ) +{ + /* variables */ + FILE *fout; + unsigned char *DDS_data; + DDS_header header; + int DDS_size; + /* error check */ + if( (NULL == filename) || + (width < 1) || (height < 1) || + (channels < 1) || (channels > 4) || + (data == NULL ) ) + { + return 0; + } + /* Convert the image */ + if( (channels & 1) == 1 ) + { + /* no alpha, just use DXT1 */ + DDS_data = convert_image_to_DXT1( data, width, height, channels, &DDS_size ); + } else + { + /* has alpha, so use DXT5 */ + DDS_data = convert_image_to_DXT5( data, width, height, channels, &DDS_size ); + } + /* save it */ + memset( &header, 0, sizeof( DDS_header ) ); + header.dwMagic = ('D' << 0) | ('D' << 8) | ('S' << 16) | (' ' << 24); + header.dwSize = 124; + header.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_LINEARSIZE; + header.dwWidth = width; + header.dwHeight = height; + header.dwPitchOrLinearSize = DDS_size; + header.sPixelFormat.dwSize = 32; + header.sPixelFormat.dwFlags = DDPF_FOURCC; + if( (channels & 1) == 1 ) + { + header.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('1' << 24); + } else + { + header.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('5' << 24); + } + header.sCaps.dwCaps1 = DDSCAPS_TEXTURE; + /* write it out */ + fout = fopen( filename, "wb"); + fwrite( &header, sizeof( DDS_header ), 1, fout ); + fwrite( DDS_data, 1, DDS_size, fout ); + fclose( fout ); + /* done */ + free( DDS_data ); + return 1; +} + +unsigned char* convert_image_to_DXT1( + const unsigned char *const uncompressed, + int width, int height, int channels, + int *out_size ) +{ + unsigned char *compressed; + int i, j, x, y; + unsigned char ublock[16*3]; + unsigned char cblock[8]; + int index = 0, chan_step = 1; + int block_count = 0; + /* error check */ + *out_size = 0; + if( (width < 1) || (height < 1) || + (NULL == uncompressed) || + (channels < 1) || (channels > 4) ) + { + return NULL; + } + /* for channels == 1 or 2, I do not step forward for R,G,B values */ + if( channels < 3 ) + { + chan_step = 0; + } + /* get the RAM for the compressed image + (8 bytes per 4x4 pixel block) */ + *out_size = ((width+3) >> 2) * ((height+3) >> 2) * 8; + compressed = (unsigned char*)malloc( *out_size ); + /* go through each block */ + for( j = 0; j < height; j += 4 ) + { + for( i = 0; i < width; i += 4 ) + { + /* copy this block into a new one */ + int idx = 0; + int mx = 4, my = 4; + if( j+4 >= height ) + { + my = height - j; + } + if( i+4 >= width ) + { + mx = width - i; + } + for( y = 0; y < my; ++y ) + { + for( x = 0; x < mx; ++x ) + { + ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels]; + ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step]; + ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step]; + } + for( x = mx; x < 4; ++x ) + { + ublock[idx++] = ublock[0]; + ublock[idx++] = ublock[1]; + ublock[idx++] = ublock[2]; + } + } + for( y = my; y < 4; ++y ) + { + for( x = 0; x < 4; ++x ) + { + ublock[idx++] = ublock[0]; + ublock[idx++] = ublock[1]; + ublock[idx++] = ublock[2]; + } + } + /* compress the block */ + ++block_count; + compress_DDS_color_block( 3, ublock, cblock ); + /* copy the data from the block into the main block */ + for( x = 0; x < 8; ++x ) + { + compressed[index++] = cblock[x]; + } + } + } + return compressed; +} + +unsigned char* convert_image_to_DXT5( + const unsigned char *const uncompressed, + int width, int height, int channels, + int *out_size ) +{ + unsigned char *compressed; + int i, j, x, y; + unsigned char ublock[16*4]; + unsigned char cblock[8]; + int index = 0, chan_step = 1; + int block_count = 0, has_alpha; + /* error check */ + *out_size = 0; + if( (width < 1) || (height < 1) || + (NULL == uncompressed) || + (channels < 1) || ( channels > 4) ) + { + return NULL; + } + /* for channels == 1 or 2, I do not step forward for R,G,B vales */ + if( channels < 3 ) + { + chan_step = 0; + } + /* # channels = 1 or 3 have no alpha, 2 & 4 do have alpha */ + has_alpha = 1 - (channels & 1); + /* get the RAM for the compressed image + (16 bytes per 4x4 pixel block) */ + *out_size = ((width+3) >> 2) * ((height+3) >> 2) * 16; + compressed = (unsigned char*)malloc( *out_size ); + /* go through each block */ + for( j = 0; j < height; j += 4 ) + { + for( i = 0; i < width; i += 4 ) + { + /* local variables, and my block counter */ + int idx = 0; + int mx = 4, my = 4; + if( j+4 >= height ) + { + my = height - j; + } + if( i+4 >= width ) + { + mx = width - i; + } + for( y = 0; y < my; ++y ) + { + for( x = 0; x < mx; ++x ) + { + ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels]; + ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step]; + ublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step]; + ublock[idx++] = + has_alpha * uncompressed[(j+y)*width*channels+(i+x)*channels+channels-1] + + (1-has_alpha)*255; + } + for( x = mx; x < 4; ++x ) + { + ublock[idx++] = ublock[0]; + ublock[idx++] = ublock[1]; + ublock[idx++] = ublock[2]; + ublock[idx++] = ublock[3]; + } + } + for( y = my; y < 4; ++y ) + { + for( x = 0; x < 4; ++x ) + { + ublock[idx++] = ublock[0]; + ublock[idx++] = ublock[1]; + ublock[idx++] = ublock[2]; + ublock[idx++] = ublock[3]; + } + } + /* now compress the alpha block */ + compress_DDS_alpha_block( ublock, cblock ); + /* copy the data from the compressed alpha block into the main buffer */ + for( x = 0; x < 8; ++x ) + { + compressed[index++] = cblock[x]; + } + /* then compress the color block */ + ++block_count; + compress_DDS_color_block( 4, ublock, cblock ); + /* copy the data from the compressed color block into the main buffer */ + for( x = 0; x < 8; ++x ) + { + compressed[index++] = cblock[x]; + } + } + } + return compressed; +} + +/********* Helper Functions *********/ +int convert_bit_range( int c, int from_bits, int to_bits ) +{ + int b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1); + return (b + (b >> from_bits)) >> from_bits; +} + +int rgb_to_565( int r, int g, int b ) +{ + return + (convert_bit_range( r, 8, 5 ) << 11) | + (convert_bit_range( g, 8, 6 ) << 05) | + (convert_bit_range( b, 8, 5 ) << 00); +} + +void rgb_888_from_565( unsigned int c, int *r, int *g, int *b ) +{ + *r = convert_bit_range( (c >> 11) & 31, 5, 8 ); + *g = convert_bit_range( (c >> 05) & 63, 6, 8 ); + *b = convert_bit_range( (c >> 00) & 31, 5, 8 ); +} + +void compute_color_line_STDEV( + const unsigned char *const uncompressed, + int channels, + float point[3], float direction[3] ) +{ + const float inv_16 = 1.0f / 16.0f; + int i; + float sum_r = 0.0f, sum_g = 0.0f, sum_b = 0.0f; + float sum_rr = 0.0f, sum_gg = 0.0f, sum_bb = 0.0f; + float sum_rg = 0.0f, sum_rb = 0.0f, sum_gb = 0.0f; + /* calculate all data needed for the covariance matrix + ( to compare with _rygdxt code) */ + for( i = 0; i < 16*channels; i += channels ) + { + sum_r += uncompressed[i+0]; + sum_rr += uncompressed[i+0] * uncompressed[i+0]; + sum_g += uncompressed[i+1]; + sum_gg += uncompressed[i+1] * uncompressed[i+1]; + sum_b += uncompressed[i+2]; + sum_bb += uncompressed[i+2] * uncompressed[i+2]; + sum_rg += uncompressed[i+0] * uncompressed[i+1]; + sum_rb += uncompressed[i+0] * uncompressed[i+2]; + sum_gb += uncompressed[i+1] * uncompressed[i+2]; + } + /* convert the sums to averages */ + sum_r *= inv_16; + sum_g *= inv_16; + sum_b *= inv_16; + /* and convert the squares to the squares of the value - avg_value */ + sum_rr -= 16.0f * sum_r * sum_r; + sum_gg -= 16.0f * sum_g * sum_g; + sum_bb -= 16.0f * sum_b * sum_b; + sum_rg -= 16.0f * sum_r * sum_g; + sum_rb -= 16.0f * sum_r * sum_b; + sum_gb -= 16.0f * sum_g * sum_b; + /* the point on the color line is the average */ + point[0] = sum_r; + point[1] = sum_g; + point[2] = sum_b; + #if USE_COV_MAT + /* + The following idea was from ryg. + (https://mollyrocket.com/forums/viewtopic.php?t=392) + The method worked great (less RMSE than mine) most of + the time, but had some issues handling some simple + boundary cases, like full green next to full red, + which would generate a covariance matrix like this: + + | 1 -1 0 | + | -1 1 0 | + | 0 0 0 | + + For a given starting vector, the power method can + generate all zeros! So no starting with {1,1,1} + as I was doing! This kind of error is still a + slight posibillity, but will be very rare. + */ + /* use the covariance matrix directly + (1st iteration, don't use all 1.0 values!) */ + sum_r = 1.0f; + sum_g = 2.718281828f; + sum_b = 3.141592654f; + direction[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb; + direction[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb; + direction[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb; + /* 2nd iteration, use results from the 1st guy */ + sum_r = direction[0]; + sum_g = direction[1]; + sum_b = direction[2]; + direction[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb; + direction[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb; + direction[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb; + /* 3rd iteration, use results from the 2nd guy */ + sum_r = direction[0]; + sum_g = direction[1]; + sum_b = direction[2]; + direction[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb; + direction[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb; + direction[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb; + #else + /* use my standard deviation method + (very robust, a tiny bit slower and less accurate) */ + direction[0] = sqrt( sum_rr ); + direction[1] = sqrt( sum_gg ); + direction[2] = sqrt( sum_bb ); + /* which has a greater component */ + if( sum_gg > sum_rr ) + { + /* green has greater component, so base the other signs off of green */ + if( sum_rg < 0.0f ) + { + direction[0] = -direction[0]; + } + if( sum_gb < 0.0f ) + { + direction[2] = -direction[2]; + } + } else + { + /* red has a greater component */ + if( sum_rg < 0.0f ) + { + direction[1] = -direction[1]; + } + if( sum_rb < 0.0f ) + { + direction[2] = -direction[2]; + } + } + #endif +} + +void LSE_master_colors_max_min( + int *cmax, int *cmin, + int channels, + const unsigned char *const uncompressed ) +{ + int i, j; + /* the master colors */ + int c0[3], c1[3]; + /* used for fitting the line */ + float sum_x[] = { 0.0f, 0.0f, 0.0f }; + float sum_x2[] = { 0.0f, 0.0f, 0.0f }; + float dot_max = 1.0f, dot_min = -1.0f; + float vec_len2 = 0.0f; + float dot; + /* error check */ + if( (channels < 3) || (channels > 4) ) + { + return; + } + compute_color_line_STDEV( uncompressed, channels, sum_x, sum_x2 ); + vec_len2 = 1.0f / ( 0.00001f + + sum_x2[0]*sum_x2[0] + sum_x2[1]*sum_x2[1] + sum_x2[2]*sum_x2[2] ); + /* finding the max and min vector values */ + dot_max = + ( + sum_x2[0] * uncompressed[0] + + sum_x2[1] * uncompressed[1] + + sum_x2[2] * uncompressed[2] + ); + dot_min = dot_max; + for( i = 1; i < 16; ++i ) + { + dot = + ( + sum_x2[0] * uncompressed[i*channels+0] + + sum_x2[1] * uncompressed[i*channels+1] + + sum_x2[2] * uncompressed[i*channels+2] + ); + if( dot < dot_min ) + { + dot_min = dot; + } else if( dot > dot_max ) + { + dot_max = dot; + } + } + /* and the offset (from the average location) */ + dot = sum_x2[0]*sum_x[0] + sum_x2[1]*sum_x[1] + sum_x2[2]*sum_x[2]; + dot_min -= dot; + dot_max -= dot; + /* post multiply by the scaling factor */ + dot_min *= vec_len2; + dot_max *= vec_len2; + /* OK, build the master colors */ + for( i = 0; i < 3; ++i ) + { + /* color 0 */ + c0[i] = (int)(0.5f + sum_x[i] + dot_max * sum_x2[i]); + if( c0[i] < 0 ) + { + c0[i] = 0; + } else if( c0[i] > 255 ) + { + c0[i] = 255; + } + /* color 1 */ + c1[i] = (int)(0.5f + sum_x[i] + dot_min * sum_x2[i]); + if( c1[i] < 0 ) + { + c1[i] = 0; + } else if( c1[i] > 255 ) + { + c1[i] = 255; + } + } + /* down_sample (with rounding?) */ + i = rgb_to_565( c0[0], c0[1], c0[2] ); + j = rgb_to_565( c1[0], c1[1], c1[2] ); + if( i > j ) + { + *cmax = i; + *cmin = j; + } else + { + *cmax = j; + *cmin = i; + } +} + +void + compress_DDS_color_block + ( + int channels, + const unsigned char *const uncompressed, + unsigned char compressed[8] + ) +{ + /* variables */ + int i; + int next_bit; + int enc_c0, enc_c1; + int c0[4], c1[4]; + float color_line[] = { 0.0f, 0.0f, 0.0f, 0.0f }; + float vec_len2 = 0.0f, dot_offset = 0.0f; + /* stupid order */ + int swizzle4[] = { 0, 2, 3, 1 }; + /* get the master colors */ + LSE_master_colors_max_min( &enc_c0, &enc_c1, channels, uncompressed ); + /* store the 565 color 0 and color 1 */ + compressed[0] = (enc_c0 >> 0) & 255; + compressed[1] = (enc_c0 >> 8) & 255; + compressed[2] = (enc_c1 >> 0) & 255; + compressed[3] = (enc_c1 >> 8) & 255; + /* zero out the compressed data */ + compressed[4] = 0; + compressed[5] = 0; + compressed[6] = 0; + compressed[7] = 0; + /* reconstitute the master color vectors */ + rgb_888_from_565( enc_c0, &c0[0], &c0[1], &c0[2] ); + rgb_888_from_565( enc_c1, &c1[0], &c1[1], &c1[2] ); + /* the new vector */ + vec_len2 = 0.0f; + for( i = 0; i < 3; ++i ) + { + color_line[i] = (float)(c1[i] - c0[i]); + vec_len2 += color_line[i] * color_line[i]; + } + if( vec_len2 > 0.0f ) + { + vec_len2 = 1.0f / vec_len2; + } + /* pre-proform the scaling */ + color_line[0] *= vec_len2; + color_line[1] *= vec_len2; + color_line[2] *= vec_len2; + /* compute the offset (constant) portion of the dot product */ + dot_offset = color_line[0]*c0[0] + color_line[1]*c0[1] + color_line[2]*c0[2]; + /* store the rest of the bits */ + next_bit = 8*4; + for( i = 0; i < 16; ++i ) + { + /* find the dot product of this color, to place it on the line + (should be [-1,1]) */ + int next_value = 0; + float dot_product = + color_line[0] * uncompressed[i*channels+0] + + color_line[1] * uncompressed[i*channels+1] + + color_line[2] * uncompressed[i*channels+2] - + dot_offset; + /* map to [0,3] */ + next_value = (int)( dot_product * 3.0f + 0.5f ); + if( next_value > 3 ) + { + next_value = 3; + } else if( next_value < 0 ) + { + next_value = 0; + } + /* OK, store this value */ + compressed[next_bit >> 3] |= swizzle4[ next_value ] << (next_bit & 7); + next_bit += 2; + } + /* done compressing to DXT1 */ +} + +void + compress_DDS_alpha_block + ( + const unsigned char *const uncompressed, + unsigned char compressed[8] + ) +{ + /* variables */ + int i; + int next_bit; + int a0, a1; + float scale_me; + /* stupid order */ + int swizzle8[] = { 1, 7, 6, 5, 4, 3, 2, 0 }; + /* get the alpha limits (a0 > a1) */ + a0 = a1 = uncompressed[3]; + for( i = 4+3; i < 16*4; i += 4 ) + { + if( uncompressed[i] > a0 ) + { + a0 = uncompressed[i]; + } else if( uncompressed[i] < a1 ) + { + a1 = uncompressed[i]; + } + } + /* store those limits, and zero the rest of the compressed dataset */ + compressed[0] = a0; + compressed[1] = a1; + /* zero out the compressed data */ + compressed[2] = 0; + compressed[3] = 0; + compressed[4] = 0; + compressed[5] = 0; + compressed[6] = 0; + compressed[7] = 0; + /* store the all of the alpha values */ + next_bit = 8*2; + scale_me = 7.9999f / (a0 - a1); + for( i = 3; i < 16*4; i += 4 ) + { + /* convert this alpha value to a 3 bit number */ + int svalue; + int value = (int)((uncompressed[i] - a1) * scale_me); + svalue = swizzle8[ value&7 ]; + /* OK, store this value, start with the 1st byte */ + compressed[next_bit >> 3] |= svalue << (next_bit & 7); + if( (next_bit & 7) > 5 ) + { + /* spans 2 bytes, fill in the start of the 2nd byte */ + compressed[1 + (next_bit >> 3)] |= svalue >> (8 - (next_bit & 7) ); + } + next_bit += 3; + } + /* done compressing to DXT1 */ +} diff --git a/src/SFML/Graphics/SOIL/image_DXT.h b/src/SFML/Graphics/SOIL/image_DXT.h new file mode 100644 index 00000000..ce771642 --- /dev/null +++ b/src/SFML/Graphics/SOIL/image_DXT.h @@ -0,0 +1,123 @@ +/* + Jonathan Dummer + 2007-07-31-10.32 + + simple DXT compression / decompression code + + public domain +*/ + +#ifndef HEADER_IMAGE_DXT +#define HEADER_IMAGE_DXT + +/** + Converts an image from an array of unsigned chars (RGB or RGBA) to + DXT1 or DXT5, then saves the converted image to disk. + \return 0 if failed, otherwise returns 1 +**/ +int +save_image_as_DDS +( + const char *filename, + int width, int height, int channels, + const unsigned char *const data +); + +/** + take an image and convert it to DXT1 (no alpha) +**/ +unsigned char* +convert_image_to_DXT1 +( + const unsigned char *const uncompressed, + int width, int height, int channels, + int *out_size +); + +/** + take an image and convert it to DXT5 (with alpha) +**/ +unsigned char* +convert_image_to_DXT5 +( + const unsigned char *const uncompressed, + int width, int height, int channels, + int *out_size +); + +/** A bunch of DirectDraw Surface structures and flags **/ +typedef struct +{ + unsigned int dwMagic; + unsigned int dwSize; + unsigned int dwFlags; + unsigned int dwHeight; + unsigned int dwWidth; + unsigned int dwPitchOrLinearSize; + unsigned int dwDepth; + unsigned int dwMipMapCount; + unsigned int dwReserved1[ 11 ]; + + /* DDPIXELFORMAT */ + struct + { + unsigned int dwSize; + unsigned int dwFlags; + unsigned int dwFourCC; + unsigned int dwRGBBitCount; + unsigned int dwRBitMask; + unsigned int dwGBitMask; + unsigned int dwBBitMask; + unsigned int dwAlphaBitMask; + } + sPixelFormat; + + /* DDCAPS2 */ + struct + { + unsigned int dwCaps1; + unsigned int dwCaps2; + unsigned int dwDDSX; + unsigned int dwReserved; + } + sCaps; + unsigned int dwReserved2; +} +DDS_header ; + +/* the following constants were copied directly off the MSDN website */ + +/* The dwFlags member of the original DDSURFACEDESC2 structure + can be set to one or more of the following values. */ +#define DDSD_CAPS 0x00000001 +#define DDSD_HEIGHT 0x00000002 +#define DDSD_WIDTH 0x00000004 +#define DDSD_PITCH 0x00000008 +#define DDSD_PIXELFORMAT 0x00001000 +#define DDSD_MIPMAPCOUNT 0x00020000 +#define DDSD_LINEARSIZE 0x00080000 +#define DDSD_DEPTH 0x00800000 + +/* DirectDraw Pixel Format */ +#define DDPF_ALPHAPIXELS 0x00000001 +#define DDPF_FOURCC 0x00000004 +#define DDPF_RGB 0x00000040 + +/* The dwCaps1 member of the DDSCAPS2 structure can be + set to one or more of the following values. */ +#define DDSCAPS_COMPLEX 0x00000008 +#define DDSCAPS_TEXTURE 0x00001000 +#define DDSCAPS_MIPMAP 0x00400000 + +/* The dwCaps2 member of the DDSCAPS2 structure can be + set to one or more of the following values. */ +#define DDSCAPS2_CUBEMAP 0x00000200 +#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 +#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 +#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 +#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 +#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 +#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 +#define DDSCAPS2_VOLUME 0x00200000 + +#endif /* HEADER_IMAGE_DXT */ diff --git a/src/SFML/Graphics/SOIL/stb_image_aug.c b/src/SFML/Graphics/SOIL/stb_image_aug.c new file mode 100644 index 00000000..c92f833b --- /dev/null +++ b/src/SFML/Graphics/SOIL/stb_image_aug.c @@ -0,0 +1,3382 @@ +/* stbi-1.08 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c + when you control the images you're loading + + QUICK NOTES: + Primarily of interest to game developers and other people who can + avoid problematic images and only need the trivial interface + + JPEG baseline (no JPEG progressive, no oddball channel decimations) + PNG non-interlaced + BMP non-1bpp, non-RLE + TGA (not sure what subset, if a subset) + PSD (composite view only, no extra channels) + HDR (radiance rgbE format) + writes BMP,TGA (define STBI_NO_WRITE to remove code) + decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code) + + TODO: + stbi_info_* + + history: + 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz + 1.07 attempt to fix C++ warning/errors again + 1.06 attempt to fix C++ warning/errors again + 1.05 fix TGA loading to return correct *comp and use good luminance calc + 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free + 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR + 1.02 support for (subset of) HDR files, float interface for preferred access to them + 1.01 fix bug: possible bug in handling right-side up bmps... not sure + fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all + 1.00 interface to zlib that skips zlib header + 0.99 correct handling of alpha in palette + 0.98 TGA loader by lonesock; dynamically add loaders (untested) + 0.97 jpeg errors on too large a file; also catch another malloc failure + 0.96 fix detection of invalid v value - particleman@mollyrocket forum + 0.95 during header scan, seek to markers in case of padding + 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same + 0.93 handle jpegtran output; verbose errors + 0.92 read 4,8,16,24,32-bit BMP files of several formats + 0.91 output 24-bit Windows 3.0 BMP files + 0.90 fix a few more warnings; bump version number to approach 1.0 + 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd + 0.60 fix compiling as c++ + 0.59 fix warnings: merge Dave Moore's -Wall fixes + 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian + 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less + than 16 available + 0.56 fix bug: zlib uncompressed mode len vs. nlen + 0.55 fix bug: restart_interval not initialized to 0 + 0.54 allow NULL for 'int *comp' + 0.53 fix bug in png 3->4; speedup png decoding + 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments + 0.51 obey req_comp requests, 1-component jpegs return as 1-component, + on 'test' only check type, not whether we support this variant +*/ + +#include "stb_image_aug.h" + +#ifndef STBI_NO_STDIO +#include +#endif +#include +#include +#include +#include + +#ifndef _MSC_VER +#define __forceinline +#endif + +// implementation: +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef signed short int16; +typedef unsigned int uint32; +typedef signed int int32; +typedef unsigned int uint; + +// should produce compiler error if size is wrong +typedef unsigned char validate_uint32[sizeof(uint32)==4]; + +#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE) +#define STBI_NO_WRITE +#endif + +#ifndef STBI_NO_DDS +#include "stbi_DDS_aug.h" +#endif + +// I (JLD) want full messages for SOIL +//#define STBI_FAILURE_USERMSG 1 + +////////////////////////////////////////////////////////////////////////////// +// +// Generic API that works on all image types +// + +static char *failure_reason; + +char *stbi_failure_reason(void) +{ + return failure_reason; +} + +static int e(char *str) +{ + failure_reason = str; + return 0; +} + +#ifdef STBI_NO_FAILURE_STRINGS + #define e(x,y) 0 +#elif defined(STBI_FAILURE_USERMSG) + #define e(x,y) e(y) +#else + #define e(x,y) e(x) +#endif + +#define epf(x,y) ((float *) (e(x,y)?NULL:NULL)) +#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL)) + +void stbi_image_free(void *retval_from_stbi_load) +{ + free(retval_from_stbi_load); +} + +#define MAX_LOADERS 32 +stbi_loader *loaders[MAX_LOADERS]; +static int max_loaders = 0; + +int stbi_register_loader(stbi_loader *loader) +{ + int i; + for (i=0; i < MAX_LOADERS; ++i) { + // already present? + if (loaders[i] == loader) + return 1; + // end of the list? + if (loaders[i] == NULL) { + loaders[i] = loader; + max_loaders = i+1; + return 1; + } + } + // no room for it + return 0; +} + +#ifndef STBI_NO_HDR +static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp); +static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp); +#endif + +#ifndef STBI_NO_STDIO +unsigned char *stbi_load(char *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = fopen(filename, "rb"); + unsigned char *result; + if (!f) return epuc("can't fopen", "Unable to open file"); + result = stbi_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +unsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + int i; + if (stbi_jpeg_test_file(f)) + return stbi_jpeg_load_from_file(f,x,y,comp,req_comp); + if (stbi_png_test_file(f)) + return stbi_png_load_from_file(f,x,y,comp,req_comp); + if (stbi_bmp_test_file(f)) + return stbi_bmp_load_from_file(f,x,y,comp,req_comp); + if (stbi_psd_test_file(f)) + return stbi_psd_load_from_file(f,x,y,comp,req_comp); + #ifndef STBI_NO_DDS + if (stbi_dds_test_file(f)) + return stbi_dds_load_from_file(f,x,y,comp,req_comp); + #endif + #ifndef STBI_NO_HDR + if (stbi_hdr_test_file(f)) { + float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp); + return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); + } + #endif + for (i=0; i < max_loaders; ++i) + if (loaders[i]->test_file(f)) + return loaders[i]->load_from_file(f,x,y,comp,req_comp); + // test tga last because it's a crappy test! + if (stbi_tga_test_file(f)) + return stbi_tga_load_from_file(f,x,y,comp,req_comp); + return epuc("unknown image type", "Image not of any known type, or corrupt"); +} +#endif + +unsigned char *stbi_load_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + int i; + if (stbi_jpeg_test_memory(buffer,len)) + return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp); + if (stbi_png_test_memory(buffer,len)) + return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp); + if (stbi_bmp_test_memory(buffer,len)) + return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp); + if (stbi_psd_test_memory(buffer,len)) + return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp); + #ifndef STBI_NO_DDS + if (stbi_dds_test_memory(buffer,len)) + return stbi_dds_load_from_memory(buffer,len,x,y,comp,req_comp); + #endif + #ifndef STBI_NO_HDR + if (stbi_hdr_test_memory(buffer, len)) { + float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp); + return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); + } + #endif + for (i=0; i < max_loaders; ++i) + if (loaders[i]->test_memory(buffer,len)) + return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp); + // test tga last because it's a crappy test! + if (stbi_tga_test_memory(buffer,len)) + return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp); + return epuc("unknown image type", "Image not of any known type, or corrupt"); +} + +#ifndef STBI_NO_HDR + +#ifndef STBI_NO_STDIO +float *stbi_loadf(char *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = fopen(filename, "rb"); + float *result; + if (!f) return epf("can't fopen", "Unable to open file"); + result = stbi_loadf_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + #ifndef STBI_NO_HDR + if (stbi_hdr_test_file(f)) + return stbi_hdr_load_from_file(f,x,y,comp,req_comp); + #endif + data = stbi_load_from_file(f, x, y, comp, req_comp); + if (data) + return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); + return epf("unknown image type", "Image not of any known type, or corrupt"); +} +#endif + +float *stbi_loadf_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + #ifndef STBI_NO_HDR + if (stbi_hdr_test_memory(buffer, len)) + return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp); + #endif + data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp); + if (data) + return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); + return epf("unknown image type", "Image not of any known type, or corrupt"); +} +#endif + +// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is +// defined, for API simplicity; if STBI_NO_HDR is defined, it always +// reports false! + +extern int stbi_is_hdr_from_memory(stbi_uc *buffer, int len) +{ + #ifndef STBI_NO_HDR + return stbi_hdr_test_memory(buffer, len); + #else + return 0; + #endif +} + +#ifndef STBI_NO_STDIO +extern int stbi_is_hdr (char *filename) +{ + FILE *f = fopen(filename, "rb"); + int result=0; + if (f) { + result = stbi_is_hdr_from_file(f); + fclose(f); + } + return result; +} + +extern int stbi_is_hdr_from_file(FILE *f) +{ + #ifndef STBI_NO_HDR + return stbi_hdr_test_file(f); + #else + return 0; + #endif +} + +#endif + +// @TODO: get image dimensions & components without fully decoding +#ifndef STBI_NO_STDIO +extern int stbi_info (char *filename, int *x, int *y, int *comp); +extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern int stbi_info_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp); + +#ifndef STBI_NO_HDR +static float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f; +static float l2h_gamma=2.2f, l2h_scale=1.0f; + +void stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; } +void stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; } + +void stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; } +void stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; } +#endif + + +////////////////////////////////////////////////////////////////////////////// +// +// Common code used by all image loaders +// + +// image width, height, # components +static uint32 img_x, img_y; +static int img_n, img_out_n; + +enum +{ + SCAN_load=0, + SCAN_type, + SCAN_header, +}; + +// An API for reading either from memory or file. +#ifndef STBI_NO_STDIO +static FILE *img_file; +#endif +static uint8 *img_buffer, *img_buffer_end; + +#ifndef STBI_NO_STDIO +static void start_file(FILE *f) +{ + img_file = f; +} +#endif + +static void start_mem(uint8 *buffer, int len) +{ +#ifndef STBI_NO_STDIO + img_file = NULL; +#endif + img_buffer = buffer; + img_buffer_end = buffer+len; +} + +static int get8(void) +{ +#ifndef STBI_NO_STDIO + if (img_file) { + int c = fgetc(img_file); + return c == EOF ? 0 : c; + } +#endif + if (img_buffer < img_buffer_end) + return *img_buffer++; + return 0; +} + +static int at_eof(void) +{ +#ifndef STBI_NO_STDIO + if (img_file) + return feof(img_file); +#endif + return img_buffer >= img_buffer_end; +} + +static uint8 get8u(void) +{ + return (uint8) get8(); +} + +static void skip(int n) +{ +#ifndef STBI_NO_STDIO + if (img_file) + fseek(img_file, n, SEEK_CUR); + else +#endif + img_buffer += n; +} + +static int get16(void) +{ + int z = get8(); + return (z << 8) + get8(); +} + +static uint32 get32(void) +{ + uint32 z = get16(); + return (z << 16) + get16(); +} + +static int get16le(void) +{ + int z = get8(); + return z + (get8() << 8); +} + +static uint32 get32le(void) +{ + uint32 z = get16le(); + return z + (get16le() << 16); +} + +static void getn(stbi_uc *buffer, int n) +{ +#ifndef STBI_NO_STDIO + if (img_file) { + fread(buffer, 1, n, img_file); + return; + } +#endif + memcpy(buffer, img_buffer, n); + img_buffer += n; +} + +////////////////////////////////////////////////////////////////////////////// +// +// generic converter from built-in img_n to req_comp +// individual types do this automatically as much as possible (e.g. jpeg +// does all cases internally since it needs to colorspace convert anyway, +// and it never has alpha, so very few cases ). png can automatically +// interleave an alpha=255 channel, but falls back to this for other cases +// +// assume data buffer is malloced, so malloc a new one and free that one +// only failure mode is malloc failing + +static uint8 compute_y(int r, int g, int b) +{ + return (uint8) (((r*77) + (g*150) + (29*b)) >> 8); +} + +static unsigned char *convert_format(unsigned char *data, int img_n, int req_comp) +{ + uint i,j; + unsigned char *good; + + if (req_comp == img_n) return data; + assert(req_comp >= 1 && req_comp <= 4); + + good = (unsigned char *) malloc(req_comp * img_x * img_y); + if (good == NULL) { + free(data); + return epuc("outofmem", "Out of memory"); + } + + for (j=0; j < img_y; ++j) { + unsigned char *src = data + j * img_x * img_n ; + unsigned char *dest = good + j * img_x * req_comp; + + #define COMBO(a,b) ((a)*8+(b)) + #define CASE(a,b) case COMBO(a,b): for(i=0; i < img_x; ++i, src += a, dest += b) + + // convert source image with img_n components to one with req_comp components; + // avoid switch per pixel, so use switch per scanline and massive macros + switch(COMBO(img_n, req_comp)) { + CASE(1,2) dest[0]=src[0], dest[1]=255; break; + CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break; + CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break; + CASE(2,1) dest[0]=src[0]; break; + CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break; + CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break; + CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break; + CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break; + CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break; + CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break; + CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break; + CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break; + default: assert(0); + } + #undef CASE + } + + free(data); + img_out_n = req_comp; + return good; +} + +#ifndef STBI_NO_HDR +static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp) +{ + int i,k,n; + float *output = (float *) malloc(x * y * comp * sizeof(float)); + if (output == NULL) { free(data); return epf("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale; + } + if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f; + } + free(data); + return output; +} + +#define float2int(x) ((int) (x)) +static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp) +{ + int i,k,n; + stbi_uc *output = (stbi_uc *) malloc(x * y * comp); + if (output == NULL) { free(data); return epuc("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = float2int(z); + } + if (k < comp) { + float z = data[i*comp+k] * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = float2int(z); + } + } + free(data); + return output; +} +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// "baseline" JPEG/JFIF decoder (not actually fully baseline implementation) +// +// simple implementation +// - channel subsampling of at most 2 in each dimension +// - doesn't support delayed output of y-dimension +// - simple interface (only one output format: 8-bit interleaved RGB) +// - doesn't try to recover corrupt jpegs +// - doesn't allow partial loading, loading multiple at once +// - still fast on x86 (copying globals into locals doesn't help x86) +// - allocates lots of intermediate memory (full size of all components) +// - non-interleaved case requires this anyway +// - allows good upsampling (see next) +// high-quality +// - upsampled channels are bilinearly interpolated, even across blocks +// - quality integer IDCT derived from IJG's 'slow' +// performance +// - fast huffman; reasonable integer IDCT +// - uses a lot of intermediate memory, could cache poorly +// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4 +// stb_jpeg: 1.34 seconds (MSVC6, default release build) +// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro) +// IJL11.dll: 1.08 seconds (compiled by intel) +// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG) +// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro) + +int stbi_jpeg_dc_only; + +// huffman decoding acceleration +#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache + +typedef struct +{ + uint8 fast[1 << FAST_BITS]; + // weirdly, repacking this into AoS is a 10% speed loss, instead of a win + uint16 code[256]; + uint8 values[256]; + uint8 size[257]; + unsigned int maxcode[18]; + int delta[17]; // old 'firstsymbol' - old 'firstcode' +} huffman; + +static huffman huff_dc[4]; // baseline is 2 tables, extended is 4 +static huffman huff_ac[4]; +static uint8 dequant[4][64]; + +static int build_huffman(huffman *h, int *count) +{ + int i,j,k=0,code; + // build size list for each symbol (from JPEG spec) + for (i=0; i < 16; ++i) + for (j=0; j < count[i]; ++j) + h->size[k++] = (uint8) (i+1); + h->size[k] = 0; + + // compute actual symbols (from jpeg spec) + code = 0; + k = 0; + for(j=1; j <= 16; ++j) { + // compute delta to add to code to compute symbol id + h->delta[j] = k - code; + if (h->size[k] == j) { + while (h->size[k] == j) + h->code[k++] = (uint16) (code++); + if (code-1 >= (1 << j)) return e("bad code lengths","Corrupt JPEG"); + } + // compute largest code + 1 for this size, preshifted as needed later + h->maxcode[j] = code << (16-j); + code <<= 1; + } + h->maxcode[j] = 0xffffffff; + + // build non-spec acceleration table; 255 is flag for not-accelerated + memset(h->fast, 255, 1 << FAST_BITS); + for (i=0; i < k; ++i) { + int s = h->size[i]; + if (s <= FAST_BITS) { + int c = h->code[i] << (FAST_BITS-s); + int m = 1 << (FAST_BITS-s); + for (j=0; j < m; ++j) { + h->fast[c+j] = (uint8) i; + } + } + } + return 1; +} + +// sizes for components, interleaved MCUs +static int img_h_max, img_v_max; +static int img_mcu_x, img_mcu_y; +static int img_mcu_w, img_mcu_h; + +// definition of jpeg image component +static struct +{ + int id; + int h,v; + int tq; + int hd,ha; + int dc_pred; + + int x,y,w2,h2; + uint8 *data; +} img_comp[4]; + +static uint32 code_buffer; // jpeg entropy-coded buffer +static int code_bits; // number of valid bits +static unsigned char marker; // marker seen while filling entropy buffer +static int nomore; // flag if we saw a marker so must stop + +static void grow_buffer_unsafe(void) +{ + do { + int b = nomore ? 0 : get8(); + if (b == 0xff) { + int c = get8(); + if (c != 0) { + marker = (unsigned char) c; + nomore = 1; + return; + } + } + code_buffer = (code_buffer << 8) | b; + code_bits += 8; + } while (code_bits <= 24); +} + +// (1 << n) - 1 +static uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; + +// decode a jpeg huffman value from the bitstream +__forceinline static int decode(huffman *h) +{ + unsigned int temp; + int c,k; + + if (code_bits < 16) grow_buffer_unsafe(); + + // look at the top FAST_BITS and determine what symbol ID it is, + // if the code is <= FAST_BITS + c = (code_buffer >> (code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1); + k = h->fast[c]; + if (k < 255) { + if (h->size[k] > code_bits) + return -1; + code_bits -= h->size[k]; + return h->values[k]; + } + + // naive test is to shift the code_buffer down so k bits are + // valid, then test against maxcode. To speed this up, we've + // preshifted maxcode left so that it has (16-k) 0s at the + // end; in other words, regardless of the number of bits, it + // wants to be compared against something shifted to have 16; + // that way we don't need to shift inside the loop. + if (code_bits < 16) + temp = (code_buffer << (16 - code_bits)) & 0xffff; + else + temp = (code_buffer >> (code_bits - 16)) & 0xffff; + for (k=FAST_BITS+1 ; ; ++k) + if (temp < h->maxcode[k]) + break; + if (k == 17) { + // error! code not found + code_bits -= 16; + return -1; + } + + if (k > code_bits) + return -1; + + // convert the huffman code to the symbol id + c = ((code_buffer >> (code_bits - k)) & bmask[k]) + h->delta[k]; + assert((((code_buffer) >> (code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]); + + // convert the id to a symbol + code_bits -= k; + return h->values[c]; +} + +// combined JPEG 'receive' and JPEG 'extend', since baseline +// always extends everything it receives. +__forceinline static int extend_receive(int n) +{ + unsigned int m = 1 << (n-1); + unsigned int k; + if (code_bits < n) grow_buffer_unsafe(); + k = (code_buffer >> (code_bits - n)) & bmask[n]; + code_bits -= n; + // the following test is probably a random branch that won't + // predict well. I tried to table accelerate it but failed. + // maybe it's compiling as a conditional move? + if (k < m) + return (-1 << n) + k + 1; + else + return k; +} + +// given a value that's at position X in the zigzag stream, +// where does it appear in the 8x8 matrix coded as row-major? +static uint8 dezigzag[64+15] = +{ + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63, + // let corrupt input sample past end + 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63 +}; + +// decode one 64-entry block-- +static int decode_block(short data[64], huffman *hdc, huffman *hac, int b) +{ + int diff,dc,k; + int t = decode(hdc); + if (t < 0) return e("bad huffman code","Corrupt JPEG"); + + // 0 all the ac values now so we can do it 32-bits at a time + memset(data,0,64*sizeof(data[0])); + + diff = t ? extend_receive(t) : 0; + dc = img_comp[b].dc_pred + diff; + img_comp[b].dc_pred = dc; + data[0] = (short) dc; + + // decode AC components, see JPEG spec + k = 1; + do { + int r,s; + int rs = decode(hac); + if (rs < 0) return e("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (rs != 0xf0) break; // end block + k += 16; + } else { + k += r; + // decode into unzigzag'd location + data[dezigzag[k++]] = (short) extend_receive(s); + } + } while (k < 64); + return 1; +} + +// take a -128..127 value and clamp it and convert to 0..255 +__forceinline static uint8 clamp(int x) +{ + x += 128; + // trick to use a single test to catch both cases + if ((unsigned int) x > 255) { + if (x < 0) return 0; + if (x > 255) return 255; + } + return (uint8) x; +} + +#define f2f(x) (int) (((x) * 4096 + 0.5)) +#define fsh(x) ((x) << 12) + +// derived from jidctint -- DCT_ISLOW +#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ + int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ + p2 = s2; \ + p3 = s6; \ + p1 = (p2+p3) * f2f(0.5411961f); \ + t2 = p1 + p3*f2f(-1.847759065f); \ + t3 = p1 + p2*f2f( 0.765366865f); \ + p2 = s0; \ + p3 = s4; \ + t0 = fsh(p2+p3); \ + t1 = fsh(p2-p3); \ + x0 = t0+t3; \ + x3 = t0-t3; \ + x1 = t1+t2; \ + x2 = t1-t2; \ + t0 = s7; \ + t1 = s5; \ + t2 = s3; \ + t3 = s1; \ + p3 = t0+t2; \ + p4 = t1+t3; \ + p1 = t0+t3; \ + p2 = t1+t2; \ + p5 = (p3+p4)*f2f( 1.175875602f); \ + t0 = t0*f2f( 0.298631336f); \ + t1 = t1*f2f( 2.053119869f); \ + t2 = t2*f2f( 3.072711026f); \ + t3 = t3*f2f( 1.501321110f); \ + p1 = p5 + p1*f2f(-0.899976223f); \ + p2 = p5 + p2*f2f(-2.562915447f); \ + p3 = p3*f2f(-1.961570560f); \ + p4 = p4*f2f(-0.390180644f); \ + t3 += p1+p4; \ + t2 += p2+p3; \ + t1 += p2+p4; \ + t0 += p1+p3; + +// .344 seconds on 3*anemones.jpg +static void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize) +{ + int i,val[64],*v=val; + uint8 *o,*dq = dequantize; + short *d = data; + + if (stbi_jpeg_dc_only) { + // ok, I don't really know why this is right, but it seems to be: + int z = 128 + ((d[0] * dq[0]) >> 3); + for (i=0; i < 8; ++i) { + out[0] = out[1] = out[2] = out[3] = out[4] = out[5] = out[6] = out[7] = z; + out += out_stride; + } + return; + } + + // columns + for (i=0; i < 8; ++i,++d,++dq, ++v) { + // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing + if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 + && d[40]==0 && d[48]==0 && d[56]==0) { + // no shortcut 0 seconds + // (1|2|3|4|5|6|7)==0 0 seconds + // all separate -0.047 seconds + // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds + int dcterm = d[0] * dq[0] << 2; + v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; + } else { + IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24], + d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56]) + // constants scaled things up by 1<<12; let's bring them back + // down, but keep 2 extra bits of precision + x0 += 512; x1 += 512; x2 += 512; x3 += 512; + v[ 0] = (x0+t3) >> 10; + v[56] = (x0-t3) >> 10; + v[ 8] = (x1+t2) >> 10; + v[48] = (x1-t2) >> 10; + v[16] = (x2+t1) >> 10; + v[40] = (x2-t1) >> 10; + v[24] = (x3+t0) >> 10; + v[32] = (x3-t0) >> 10; + } + } + + for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { + // no fast case since the first 1D IDCT spread components out + IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536; + o[0] = clamp((x0+t3) >> 17); + o[7] = clamp((x0-t3) >> 17); + o[1] = clamp((x1+t2) >> 17); + o[6] = clamp((x1-t2) >> 17); + o[2] = clamp((x2+t1) >> 17); + o[5] = clamp((x2-t1) >> 17); + o[3] = clamp((x3+t0) >> 17); + o[4] = clamp((x3-t0) >> 17); + } +} + +#define MARKER_none 0xff +// if there's a pending marker from the entropy stream, return that +// otherwise, fetch from the stream and get a marker. if there's no +// marker, return 0xff, which is never a valid marker value +static uint8 get_marker(void) +{ + uint8 x; + if (marker != MARKER_none) { x = marker; marker = MARKER_none; return x; } + x = get8u(); + if (x != 0xff) return MARKER_none; + while (x == 0xff) + x = get8u(); + return x; +} + +// in each scan, we'll have scan_n components, and the order +// of the components is specified by order[] +static int scan_n, order[4]; +static int restart_interval, todo; +#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) + +// after a restart interval, reset the entropy decoder and +// the dc prediction +static void reset(void) +{ + code_bits = 0; + code_buffer = 0; + nomore = 0; + img_comp[0].dc_pred = img_comp[1].dc_pred = img_comp[2].dc_pred = 0; + marker = MARKER_none; + todo = restart_interval ? restart_interval : 0x7fffffff; + // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, + // since we don't even allow 1<<30 pixels +} + +static int parse_entropy_coded_data(void) +{ + reset(); + if (scan_n == 1) { + int i,j; + short data[64]; + int n = order[0]; + // non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = (img_comp[n].x+7) >> 3; + int h = (img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + if (!decode_block(data, huff_dc+img_comp[n].hd, huff_ac+img_comp[n].ha, n)) return 0; + idct_block(img_comp[n].data+img_comp[n].w2*j*8+i*8, img_comp[n].w2, data, dequant[img_comp[n].tq]); + // every data block is an MCU, so countdown the restart interval + if (--todo <= 0) { + if (code_bits < 24) grow_buffer_unsafe(); + // if it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!RESTART(marker)) return 1; + reset(); + } + } + } + } else { // interleaved! + int i,j,k,x,y; + short data[64]; + for (j=0; j < img_mcu_y; ++j) { + for (i=0; i < img_mcu_x; ++i) { + // scan an interleaved mcu... process scan_n components in order + for (k=0; k < scan_n; ++k) { + int n = order[k]; + // scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (y=0; y < img_comp[n].v; ++y) { + for (x=0; x < img_comp[n].h; ++x) { + int x2 = (i*img_comp[n].h + x)*8; + int y2 = (j*img_comp[n].v + y)*8; + if (!decode_block(data, huff_dc+img_comp[n].hd, huff_ac+img_comp[n].ha, n)) return 0; + idct_block(img_comp[n].data+img_comp[n].w2*y2+x2, img_comp[n].w2, data, dequant[img_comp[n].tq]); + } + } + } + // after all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + if (--todo <= 0) { + if (code_bits < 24) grow_buffer_unsafe(); + // if it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!RESTART(marker)) return 1; + reset(); + } + } + } + } + return 1; +} + +static int process_marker(int m) +{ + int L; + switch (m) { + case MARKER_none: // no marker found + return e("expected marker","Corrupt JPEG"); + + case 0xC2: // SOF - progressive + return e("progressive jpeg","JPEG format not supported (progressive)"); + + case 0xDD: // DRI - specify restart interval + if (get16() != 4) return e("bad DRI len","Corrupt JPEG"); + restart_interval = get16(); + return 1; + + case 0xDB: // DQT - define quantization table + L = get16()-2; + while (L > 0) { + int z = get8(); + int p = z >> 4; + int t = z & 15,i; + if (p != 0) return e("bad DQT type","Corrupt JPEG"); + if (t > 3) return e("bad DQT table","Corrupt JPEG"); + for (i=0; i < 64; ++i) + dequant[t][dezigzag[i]] = get8u(); + L -= 65; + } + return L==0; + + case 0xC4: // DHT - define huffman table + L = get16()-2; + while (L > 0) { + uint8 *v; + int sizes[16],i,m=0; + int z = get8(); + int tc = z >> 4; + int th = z & 15; + if (tc > 1 || th > 3) return e("bad DHT header","Corrupt JPEG"); + for (i=0; i < 16; ++i) { + sizes[i] = get8(); + m += sizes[i]; + } + L -= 17; + if (tc == 0) { + if (!build_huffman(huff_dc+th, sizes)) return 0; + v = huff_dc[th].values; + } else { + if (!build_huffman(huff_ac+th, sizes)) return 0; + v = huff_ac[th].values; + } + for (i=0; i < m; ++i) + v[i] = get8u(); + L -= m; + } + return L==0; + } + // check for comment block or APP blocks + if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { + skip(get16()-2); + return 1; + } + return 0; +} + +// after we see SOS +static int process_scan_header(void) +{ + int i; + int Ls = get16(); + scan_n = get8(); + if (scan_n < 1 || scan_n > 4 || scan_n > (int) img_n) return e("bad SOS component count","Corrupt JPEG"); + if (Ls != 6+2*scan_n) return e("bad SOS len","Corrupt JPEG"); + for (i=0; i < scan_n; ++i) { + int id = get8(), which; + int z = get8(); + for (which = 0; which < img_n; ++which) + if (img_comp[which].id == id) + break; + if (which == img_n) return 0; + img_comp[which].hd = z >> 4; if (img_comp[which].hd > 3) return e("bad DC huff","Corrupt JPEG"); + img_comp[which].ha = z & 15; if (img_comp[which].ha > 3) return e("bad AC huff","Corrupt JPEG"); + order[i] = which; + } + if (get8() != 0) return e("bad SOS","Corrupt JPEG"); + get8(); // should be 63, but might be 0 + if (get8() != 0) return e("bad SOS","Corrupt JPEG"); + + return 1; +} + +static int process_frame_header(int scan) +{ + int Lf,p,i,z, h_max=1,v_max=1; + Lf = get16(); if (Lf < 11) return e("bad SOF len","Corrupt JPEG"); // JPEG + p = get8(); if (p != 8) return e("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline + img_y = get16(); if (img_y == 0) return e("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG + img_x = get16(); if (img_x == 0) return e("0 width","Corrupt JPEG"); // JPEG requires + img_n = get8(); + if (img_n != 3 && img_n != 1) return e("bad component count","Corrupt JPEG"); // JFIF requires + + if (Lf != 8+3*img_n) return e("bad SOF len","Corrupt JPEG"); + + for (i=0; i < img_n; ++i) { + img_comp[i].id = get8(); + if (img_comp[i].id != i+1) // JFIF requires + if (img_comp[i].id != i) // jpegtran outputs non-JFIF-compliant files! + return e("bad component ID","Corrupt JPEG"); + z = get8(); + img_comp[i].h = (z >> 4); if (!img_comp[i].h || img_comp[i].h > 4) return e("bad H","Corrupt JPEG"); + img_comp[i].v = z & 15; if (!img_comp[i].v || img_comp[i].v > 4) return e("bad V","Corrupt JPEG"); + img_comp[i].tq = get8(); if (img_comp[i].tq > 3) return e("bad TQ","Corrupt JPEG"); + } + + if (scan != SCAN_load) return 1; + + if ((1 << 30) / img_x / img_n < img_y) return e("too large", "Image too large to decode"); + + for (i=0; i < img_n; ++i) { + if (img_comp[i].h > h_max) h_max = img_comp[i].h; + if (img_comp[i].v > v_max) v_max = img_comp[i].v; + } + + // compute interleaved mcu info + img_h_max = h_max; + img_v_max = v_max; + img_mcu_w = h_max * 8; + img_mcu_h = v_max * 8; + img_mcu_x = (img_x + img_mcu_w-1) / img_mcu_w; + img_mcu_y = (img_y + img_mcu_h-1) / img_mcu_h; + + for (i=0; i < img_n; ++i) { + // number of effective pixels (e.g. for non-interleaved MCU) + img_comp[i].x = (img_x * img_comp[i].h + h_max-1) / h_max; + img_comp[i].y = (img_y * img_comp[i].v + v_max-1) / v_max; + // to simplify generation, we'll allocate enough memory to decode + // the bogus oversized data from using interleaved MCUs and their + // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't + // discard the extra data until colorspace conversion + img_comp[i].w2 = img_mcu_x * img_comp[i].h * 8; + img_comp[i].h2 = img_mcu_y * img_comp[i].v * 8; + img_comp[i].data = (uint8 *) malloc(img_comp[i].w2 * img_comp[i].h2); + if (img_comp[i].data == NULL) { + for(--i; i >= 0; --i) + free(img_comp[i].data); + return e("outofmem", "Out of memory"); + } + } + + return 1; +} + +// use comparisons since in some cases we handle more than one case (e.g. SOF) +#define DNL(x) ((x) == 0xdc) +#define SOI(x) ((x) == 0xd8) +#define EOI(x) ((x) == 0xd9) +#define SOF(x) ((x) == 0xc0 || (x) == 0xc1) +#define SOS(x) ((x) == 0xda) + +static int decode_jpeg_header(int scan) +{ + int m; + marker = MARKER_none; // initialize cached marker to empty + m = get_marker(); + if (!SOI(m)) return e("no SOI","Corrupt JPEG"); + if (scan == SCAN_type) return 1; + m = get_marker(); + while (!SOF(m)) { + if (!process_marker(m)) return 0; + m = get_marker(); + while (m == MARKER_none) { + // some files have extra padding after their blocks, so ok, we'll scan + if (at_eof()) return e("no SOF", "Corrupt JPEG"); + m = get_marker(); + } + } + if (!process_frame_header(scan)) return 0; + return 1; +} + +static int decode_jpeg_image(void) +{ + int m; + restart_interval = 0; + if (!decode_jpeg_header(SCAN_load)) return 0; + m = get_marker(); + while (!EOI(m)) { + if (SOS(m)) { + if (!process_scan_header()) return 0; + if (!parse_entropy_coded_data()) return 0; + } else { + if (!process_marker(m)) return 0; + } + m = get_marker(); + } + return 1; +} + +// static jfif-centered resampling with cross-block smoothing +// here by cross-block smoothing what I mean is that the resampling +// is bilerp and crosses blocks; I dunno what IJG means + +#define div4(x) ((uint8) ((x) >> 2)) + +static void resample_v_2(uint8 *out1, uint8 *input, int w, int h, int s) +{ + // need to generate two samples vertically for every one in input + uint8 *above; + uint8 *below; + uint8 *source; + uint8 *out2; + int i,j; + source = input; + out2 = out1+w; + for (j=0; j < h; ++j) { + above = source; + source = input + j*s; + below = source + s; if (j == h-1) below = source; + for (i=0; i < w; ++i) { + int n = source[i]*3; + out1[i] = div4(above[i] + n); + out2[i] = div4(below[i] + n); + } + out1 += w*2; + out2 += w*2; + } +} + +static void resample_h_2(uint8 *out, uint8 *input, int w, int h, int s) +{ + // need to generate two samples horizontally for every one in input + int i,j; + if (w == 1) { + for (j=0; j < h; ++j) + out[j*2+0] = out[j*2+1] = input[j*s]; + return; + } + for (j=0; j < h; ++j) { + out[0] = input[0]; + out[1] = div4(input[0]*3 + input[1]); + for (i=1; i < w-1; ++i) { + int n = input[i]*3; + out[i*2-2] = div4(input[i-1] + n); + out[i*2-1] = div4(input[i+1] + n); + } + out[w*2-2] = div4(input[w-2]*3 + input[w-1]); + out[w*2-1] = input[w-1]; + out += w*2; + input += s; + } +} + +// .172 seconds on 3*anemones.jpg +static void resample_hv_2(uint8 *out, uint8 *input, int w, int h, int s) +{ + // need to generate 2x2 samples for every one in input + int i,j; + int os = w*2; + // generate edge samples... @TODO lerp them! + for (i=0; i < w; ++i) { + out[i*2+0] = out[i*2+1] = input[i]; + out[i*2+(2*h-1)*os+0] = out[i*2+(2*h-1)*os+1] = input[i+(h-1)*w]; + } + for (j=0; j < h; ++j) { + out[j*os*2+0] = out[j*os*2+os+0] = input[j*w]; + out[j*os*2+os-1] = out[j*os*2+os+os-1] = input[j*w+i-1]; + } + // now generate interior samples; i & j point to top left of input + for (j=0; j < h-1; ++j) { + uint8 *in1 = input+j*s; + uint8 *in2 = in1 + s; + uint8 *out1 = out + (j*2+1)*os + 1; + uint8 *out2 = out1 + os; + for (i=0; i < w-1; ++i) { + int p00 = in1[0], p01=in1[1], p10=in2[0], p11=in2[1]; + int p00_3 = p00*3, p01_3 = p01*3, p10_3 = p10*3, p11_3 = p11*3; + + #define div16(x) ((uint8) ((x) >> 4)) + + out1[0] = div16(p00*9 + p01_3 + p10_3 + p11); + out1[1] = div16(p01*9 + p00_3 + p01_3 + p10); + out2[0] = div16(p10*9 + p11_3 + p00_3 + p01); + out2[1] = div16(p11*9 + p10_3 + p01_3 + p00); + out1 += 2; + out2 += 2; + ++in1; + ++in2; + } + } +} + +#define float2fixed(x) ((int) ((x) * 65536 + 0.5)) + +// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro) +// VC6 without processor=Pro is generating multiple LEAs per multiply! +static void YCbCr_to_RGB_row(uint8 *out, uint8 *y, uint8 *pcb, uint8 *pcr, int count, int step) +{ + int i; + for (i=0; i < count; ++i) { + int y_fixed = (y[i] << 16) + 32768; // rounding + int r,g,b; + int cr = pcr[i] - 128; + int cb = pcb[i] - 128; + r = y_fixed + cr*float2fixed(1.40200f); + g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f); + b = y_fixed + cb*float2fixed(1.77200f); + r >>= 16; + g >>= 16; + b >>= 16; + if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } + if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } + if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } + out[0] = (uint8)r; + out[1] = (uint8)g; + out[2] = (uint8)b; + if (step == 4) out[3] = 255; + out += step; + } +} + +// clean up the temporary component buffers +static void cleanup_jpeg(void) +{ + int i; + for (i=0; i < img_n; ++i) { + if (img_comp[i].data) { + free(img_comp[i].data); + img_comp[i].data = NULL; + } + } +} + +static uint8 *load_jpeg_image(int *out_x, int *out_y, int *comp, int req_comp) +{ + int i, n; + // validate req_comp + if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error"); + + // load a jpeg image from whichever source + if (!decode_jpeg_image()) { cleanup_jpeg(); return NULL; } + + // determine actual number of components to generate + n = req_comp ? req_comp : img_n; + + // resample components to full size... memory wasteful, but this + // lets us bilerp across blocks while upsampling + for (i=0; i < img_n; ++i) { + // if we're outputting fewer than 3 components, we're grey not RGB; + // in that case, don't bother upsampling Cb or Cr + if (n < 3 && i) continue; + + // check if the component scale is less than max; if so it needs upsampling + if (img_comp[i].h != img_h_max || img_comp[i].v != img_v_max) { + int stride = img_x; + // allocate final size; make sure it's big enough for upsampling off + // the edges with upsample up to 4x4 (although we only support 2x2 + // currently) + uint8 *new_data = (uint8 *) malloc((img_x+3)*(img_y+3)); + if (new_data == NULL) { + cleanup_jpeg(); + return epuc("outofmem", "Out of memory (image too large?)"); + } + if (img_comp[i].h*2 == img_h_max && img_comp[i].v*2 == img_v_max) { + int tx = (img_x+1)>>1; + resample_hv_2(new_data, img_comp[i].data, tx,(img_y+1)>>1, img_comp[i].w2); + stride = tx*2; + } else if (img_comp[i].h == img_h_max && img_comp[i].v*2 == img_v_max) { + resample_v_2(new_data, img_comp[i].data, img_x,(img_y+1)>>1, img_comp[i].w2); + } else if (img_comp[i].h*2 == img_h_max && img_comp[i].v == img_v_max) { + int tx = (img_x+1)>>1; + resample_h_2(new_data, img_comp[i].data, tx,img_y, img_comp[i].w2); + stride = tx*2; + } else { + // @TODO resample uncommon sampling pattern with nearest neighbor + free(new_data); + cleanup_jpeg(); + return epuc("uncommon H or V", "JPEG not supported: atypical downsampling mode"); + } + img_comp[i].w2 = stride; + free(img_comp[i].data); + img_comp[i].data = new_data; + } + } + + // now convert components to output image + { + uint32 i,j; + uint8 *output = (uint8 *) malloc(n * img_x * img_y + 1); + if (n >= 3) { // output STBI_rgb_* + for (j=0; j < img_y; ++j) { + uint8 *y = img_comp[0].data + j*img_comp[0].w2; + uint8 *out = output + n * img_x * j; + if (img_n == 3) { + uint8 *cb = img_comp[1].data + j*img_comp[1].w2; + uint8 *cr = img_comp[2].data + j*img_comp[2].w2; + YCbCr_to_RGB_row(out, y, cb, cr, img_x, n); + } else { + for (i=0; i < img_x; ++i) { + out[0] = out[1] = out[2] = y[i]; + out[3] = 255; // not used if n == 3 + out += n; + } + } + } + } else { // output STBI_grey_* + for (j=0; j < img_y; ++j) { + uint8 *y = img_comp[0].data + j*img_comp[0].w2; + uint8 *out = output + n * img_x * j; + if (n == 1) + for (i=0; i < img_x; ++i) *out++ = *y++; + else + for (i=0; i < img_x; ++i) *out++ = *y++, *out++ = 255; + } + } + cleanup_jpeg(); + *out_x = img_x; + *out_y = img_y; + if (comp) *comp = img_n; // report original components, not output + return output; + } +} + +#ifndef STBI_NO_STDIO +unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return load_jpeg_image(x,y,comp,req_comp); +} + +unsigned char *stbi_jpeg_load(char *filename, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return data; +} +#endif + +unsigned char *stbi_jpeg_load_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer,len); + return load_jpeg_image(x,y,comp,req_comp); +} + +#ifndef STBI_NO_STDIO +int stbi_jpeg_test_file(FILE *f) +{ + int n,r; + n = ftell(f); + start_file(f); + r = decode_jpeg_header(SCAN_type); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_jpeg_test_memory(unsigned char *buffer, int len) +{ + start_mem(buffer,len); + return decode_jpeg_header(SCAN_type); +} + +// @TODO: +#ifndef STBI_NO_STDIO +extern int stbi_jpeg_info (char *filename, int *x, int *y, int *comp); +extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern int stbi_jpeg_info_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp); + +// public domain zlib decode v0.2 Sean Barrett 2006-11-18 +// simple implementation +// - all input must be provided in an upfront buffer +// - all output is written to a single output buffer (can malloc/realloc) +// performance +// - fast huffman + +// fast-way is faster to check than jpeg huffman, but slow way is slower +#define ZFAST_BITS 9 // accelerate all cases in default tables +#define ZFAST_MASK ((1 << ZFAST_BITS) - 1) + +// zlib-style huffman encoding +// (jpegs packs from left, zlib from right, so can't share code) +typedef struct +{ + uint16 fast[1 << ZFAST_BITS]; + uint16 firstcode[16]; + int maxcode[17]; + uint16 firstsymbol[16]; + uint8 size[288]; + uint16 value[288]; +} zhuffman; + +__forceinline static int bitreverse16(int n) +{ + n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); + n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); + n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); + n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); + return n; +} + +__forceinline static int bit_reverse(int v, int bits) +{ + assert(bits <= 16); + // to bit reverse n bits, reverse 16 and shift + // e.g. 11 bits, bit reverse and shift away 5 + return bitreverse16(v) >> (16-bits); +} + +static int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num) +{ + int i,k=0; + int code, next_code[16], sizes[17]; + + // DEFLATE spec for generating codes + memset(sizes, 0, sizeof(sizes)); + memset(z->fast, 255, sizeof(z->fast)); + for (i=0; i < num; ++i) + ++sizes[sizelist[i]]; + sizes[0] = 0; + for (i=1; i < 16; ++i) + assert(sizes[i] <= (1 << i)); + code = 0; + for (i=1; i < 16; ++i) { + next_code[i] = code; + z->firstcode[i] = (uint16) code; + z->firstsymbol[i] = (uint16) k; + code = (code + sizes[i]); + if (sizes[i]) + if (code-1 >= (1 << i)) return e("bad codelengths","Corrupt JPEG"); + z->maxcode[i] = code << (16-i); // preshift for inner loop + code <<= 1; + k += sizes[i]; + } + z->maxcode[16] = 0x10000; // sentinel + for (i=0; i < num; ++i) { + int s = sizelist[i]; + if (s) { + int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; + z->size[c] = (uint8)s; + z->value[c] = (uint16)i; + if (s <= ZFAST_BITS) { + int k = bit_reverse(next_code[s],s); + while (k < (1 << ZFAST_BITS)) { + z->fast[k] = (uint16) c; + k += (1 << s); + } + } + ++next_code[s]; + } + } + return 1; +} + +// zlib-from-memory implementation for PNG reading +// because PNG allows splitting the zlib stream arbitrarily, +// and it's annoying structurally to have PNG call ZLIB call PNG, +// we require PNG read all the IDATs and combine them into a single +// memory buffer + +static uint8 *zbuffer, *zbuffer_end; + +__forceinline static int zget8(void) +{ + if (zbuffer >= zbuffer_end) return 0; + return *zbuffer++; +} + +//static unsigned long code_buffer; +static int num_bits; + +static void fill_bits(void) +{ + do { + assert(code_buffer < (1U << num_bits)); + code_buffer |= zget8() << num_bits; + num_bits += 8; + } while (num_bits <= 24); +} + +__forceinline static unsigned int zreceive(int n) +{ + unsigned int k; + if (num_bits < n) fill_bits(); + k = code_buffer & ((1 << n) - 1); + code_buffer >>= n; + num_bits -= n; + return k; +} + +__forceinline static int zhuffman_decode(zhuffman *z) +{ + int b,s,k; + if (num_bits < 16) fill_bits(); + b = z->fast[code_buffer & ZFAST_MASK]; + if (b < 0xffff) { + s = z->size[b]; + code_buffer >>= s; + num_bits -= s; + return z->value[b]; + } + + // not resolved by fast table, so compute it the slow way + // use jpeg approach, which requires MSbits at top + k = bit_reverse(code_buffer, 16); + for (s=ZFAST_BITS+1; ; ++s) + if (k < z->maxcode[s]) + break; + if (s == 16) return -1; // invalid code! + // code size is s, so: + b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; + assert(z->size[b] == s); + code_buffer >>= s; + num_bits -= s; + return z->value[b]; +} + +static char *zout; +static char *zout_start; +static char *zout_end; +static int z_expandable; + +static int expand(int n) // need to make room for n bytes +{ + char *q; + int cur, limit; + if (!z_expandable) return e("output buffer limit","Corrupt PNG"); + cur = (int) (zout - zout_start); + limit = (int) (zout_end - zout_start); + while (cur + n > limit) + limit *= 2; + q = (char *) realloc(zout_start, limit); + if (q == NULL) return e("outofmem", "Out of memory"); + zout_start = q; + zout = q + cur; + zout_end = q + limit; + return 1; +} + +static zhuffman z_length, z_distance; + +static int length_base[31] = { + 3,4,5,6,7,8,9,10,11,13, + 15,17,19,23,27,31,35,43,51,59, + 67,83,99,115,131,163,195,227,258,0,0 }; + +static int length_extra[31]= +{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; + +static int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, +257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; + +static int dist_extra[32] = +{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +static int parse_huffman_block(void) +{ + for(;;) { + int z = zhuffman_decode(&z_length); + if (z < 256) { + if (z < 0) return e("bad huffman code","Corrupt PNG"); // error in huffman codes + if (zout >= zout_end) if (!expand(1)) return 0; + *zout++ = (char) z; + } else { + uint8 *p; + int len,dist; + if (z == 256) return 1; + z -= 257; + len = length_base[z]; + if (length_extra[z]) len += zreceive(length_extra[z]); + z = zhuffman_decode(&z_distance); + if (z < 0) return e("bad huffman code","Corrupt PNG"); + dist = dist_base[z]; + if (dist_extra[z]) dist += zreceive(dist_extra[z]); + if (zout - zout_start < dist) return e("bad dist","Corrupt PNG"); + if (zout + len > zout_end) if (!expand(len)) return 0; + p = (uint8 *) (zout - dist); + while (len--) + *zout++ = *p++; + } + } +} + +static int compute_huffman_codes(void) +{ + static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; + static zhuffman z_codelength; // static just to save stack space + uint8 lencodes[286+32+137];//padding for maximum single op + uint8 codelength_sizes[19]; + int i,n; + + int hlit = zreceive(5) + 257; + int hdist = zreceive(5) + 1; + int hclen = zreceive(4) + 4; + + memset(codelength_sizes, 0, sizeof(codelength_sizes)); + for (i=0; i < hclen; ++i) { + int s = zreceive(3); + codelength_sizes[length_dezigzag[i]] = (uint8) s; + } + if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; + + n = 0; + while (n < hlit + hdist) { + int c = zhuffman_decode(&z_codelength); + assert(c >= 0 && c < 19); + if (c < 16) + lencodes[n++] = (uint8) c; + else if (c == 16) { + c = zreceive(2)+3; + memset(lencodes+n, lencodes[n-1], c); + n += c; + } else if (c == 17) { + c = zreceive(3)+3; + memset(lencodes+n, 0, c); + n += c; + } else { + assert(c == 18); + c = zreceive(7)+11; + memset(lencodes+n, 0, c); + n += c; + } + } + if (n != hlit+hdist) return e("bad codelengths","Corrupt PNG"); + if (!zbuild_huffman(&z_length, lencodes, hlit)) return 0; + if (!zbuild_huffman(&z_distance, lencodes+hlit, hdist)) return 0; + return 1; +} + +static int parse_uncompressed_block(void) +{ + uint8 header[4]; + int len,nlen,k; + if (num_bits & 7) + zreceive(num_bits & 7); // discard + // drain the bit-packed data into header + k = 0; + while (num_bits > 0) { + header[k++] = (uint8) (code_buffer & 255); // wtf this warns? + code_buffer >>= 8; + num_bits -= 8; + } + assert(num_bits == 0); + // now fill header the normal way + while (k < 4) + header[k++] = (uint8) zget8(); + len = header[1] * 256 + header[0]; + nlen = header[3] * 256 + header[2]; + if (nlen != (len ^ 0xffff)) return e("zlib corrupt","Corrupt PNG"); + if (zbuffer + len > zbuffer_end) return e("read past buffer","Corrupt PNG"); + if (zout + len > zout_end) + if (!expand(len)) return 0; + memcpy(zout, zbuffer, len); + zbuffer += len; + zout += len; + return 1; +} + +static int parse_zlib_header(void) +{ + int cmf = zget8(); + int cm = cmf & 15; + /* int cinfo = cmf >> 4; */ + int flg = zget8(); + if ((cmf*256+flg) % 31 != 0) return e("bad zlib header","Corrupt PNG"); // zlib spec + if (flg & 32) return e("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png + if (cm != 8) return e("bad compression","Corrupt PNG"); // DEFLATE required for png + // window = 1 << (8 + cinfo)... but who cares, we fully buffer output + return 1; +} + +static uint8 default_length[288], default_distance[32]; +static void init_defaults(void) +{ + int i; // use <= to match clearly with spec + for (i=0; i <= 143; ++i) default_length[i] = 8; + for ( ; i <= 255; ++i) default_length[i] = 9; + for ( ; i <= 279; ++i) default_length[i] = 7; + for ( ; i <= 287; ++i) default_length[i] = 8; + + for (i=0; i <= 31; ++i) default_distance[i] = 5; +} + +static int parse_zlib(int parse_header) +{ + int final, type; + if (parse_header) + if (!parse_zlib_header()) return 0; + num_bits = 0; + code_buffer = 0; + do { + final = zreceive(1); + type = zreceive(2); + if (type == 0) { + if (!parse_uncompressed_block()) return 0; + } else if (type == 3) { + return 0; + } else { + if (type == 1) { + // use fixed code lengths + if (!default_length[0]) init_defaults(); + if (!zbuild_huffman(&z_length , default_length , 288)) return 0; + if (!zbuild_huffman(&z_distance, default_distance, 32)) return 0; + } else { + if (!compute_huffman_codes()) return 0; + } + if (!parse_huffman_block()) return 0; + } + } while (!final); + return 1; +} + +static int do_zlib(char *obuf, int olen, int exp, int parse_header) +{ + zout_start = obuf; + zout = obuf; + zout_end = obuf + olen; + z_expandable = exp; + + return parse_zlib(parse_header); +} + +char *stbi_zlib_decode_malloc_guesssize(int initial_size, int *outlen) +{ + char *p = (char *) malloc(initial_size); + if (p == NULL) return NULL; + if (do_zlib(p, initial_size, 1, 1)) { + *outlen = (int) (zout - zout_start); + return zout_start; + } else { + free(zout_start); + return NULL; + } +} + +char *stbi_zlib_decode_malloc(char *buffer, int len, int *outlen) +{ + zbuffer = (uint8 *) buffer; + zbuffer_end = (uint8 *) buffer+len; + return stbi_zlib_decode_malloc_guesssize(16384, outlen); +} + +int stbi_zlib_decode_buffer(char *obuffer, int olen, char *ibuffer, int ilen) +{ + zbuffer = (uint8 *) ibuffer; + zbuffer_end = (uint8 *) ibuffer + ilen; + if (do_zlib(obuffer, olen, 0, 1)) + return (int) (zout - zout_start); + else + return -1; +} + +char *stbi_zlib_decode_noheader_malloc(char *buffer, int len, int *outlen) +{ + char *p = (char *) malloc(16384); + if (p == NULL) return NULL; + zbuffer = (uint8 *) buffer; + zbuffer_end = (uint8 *) buffer+len; + if (do_zlib(p, 16384, 1, 0)) { + *outlen = (int) (zout - zout_start); + return zout_start; + } else { + free(zout_start); + return NULL; + } +} + +int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, char *ibuffer, int ilen) +{ + zbuffer = (uint8 *) ibuffer; + zbuffer_end = (uint8 *) ibuffer + ilen; + if (do_zlib(obuffer, olen, 0, 0)) + return (int) (zout - zout_start); + else + return -1; +} + +// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 +// simple implementation +// - only 8-bit samples +// - no CRC checking +// - allocates lots of intermediate memory +// - avoids problem of streaming data between subsystems +// - avoids explicit window management +// performance +// - uses stb_zlib, a PD zlib implementation with fast huffman decoding + + +typedef struct +{ + uint32 length; + uint32 type; +} chunk; + +#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d)) + +static chunk get_chunk_header(void) +{ + chunk c; + c.length = get32(); + c.type = get32(); + return c; +} + +static int check_png_header(void) +{ + static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 }; + int i; + for (i=0; i < 8; ++i) + if (get8() != png_sig[i]) return e("bad png sig","Not a PNG"); + return 1; +} + +static uint8 *idata, *expanded, *out; + +enum { + F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4, + F_avg_first, F_paeth_first, +}; + +static uint8 first_row_filter[5] = +{ + F_none, F_sub, F_none, F_avg_first, F_paeth_first +}; + +static int paeth(int a, int b, int c) +{ + int p = a + b - c; + int pa = abs(p-a); + int pb = abs(p-b); + int pc = abs(p-c); + if (pa <= pb && pa <= pc) return a; + if (pb <= pc) return b; + return c; +} + +// create the png data from post-deflated data +static int create_png_image(uint8 *raw, uint32 raw_len, int out_n) +{ + uint32 i,j,stride = img_x*out_n; + int k; + assert(out_n == img_n || out_n == img_n+1); + out = (uint8 *) malloc(img_x * img_y * out_n); + if (!out) return e("outofmem", "Out of memory"); + if (raw_len != (img_n * img_x + 1) * img_y) return e("not enough pixels","Corrupt PNG"); + for (j=0; j < img_y; ++j) { + uint8 *cur = out + stride*j; + uint8 *prior = cur - stride; + int filter = *raw++; + if (filter > 4) return e("invalid filter","Corrupt PNG"); + // if first row, use special filter that doesn't sample previous row + if (j == 0) filter = first_row_filter[filter]; + // handle first pixel explicitly + for (k=0; k < img_n; ++k) { + switch(filter) { + case F_none : cur[k] = raw[k]; break; + case F_sub : cur[k] = raw[k]; break; + case F_up : cur[k] = raw[k] + prior[k]; break; + case F_avg : cur[k] = raw[k] + (prior[k]>>1); break; + case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break; + case F_avg_first : cur[k] = raw[k]; break; + case F_paeth_first: cur[k] = raw[k]; break; + } + } + if (img_n != out_n) cur[img_n] = 255; + raw += img_n; + cur += out_n; + prior += out_n; + // this is a little gross, so that we don't switch per-pixel or per-component + if (img_n == out_n) { + #define CASE(f) \ + case f: \ + for (i=1; i < img_x; ++i, raw+=img_n,cur+=img_n,prior+=img_n) \ + for (k=0; k < img_n; ++k) + switch(filter) { + CASE(F_none) cur[k] = raw[k]; break; + CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break; + CASE(F_up) cur[k] = raw[k] + prior[k]; break; + CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break; + CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break; + CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break; + CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break; + } + #undef CASE + } else { + assert(img_n+1 == out_n); + #define CASE(f) \ + case f: \ + for (i=1; i < img_x; ++i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \ + for (k=0; k < img_n; ++k) + switch(filter) { + CASE(F_none) cur[k] = raw[k]; break; + CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break; + CASE(F_up) cur[k] = raw[k] + prior[k]; break; + CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break; + CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break; + CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break; + CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break; + } + #undef CASE + } + } + return 1; +} + +static int compute_transparency(uint8 tc[3], int out_n) +{ + uint32 i, pixel_count = img_x * img_y; + uint8 *p = out; + + // compute color-based transparency, assuming we've + // already got 255 as the alpha value in the output + assert(out_n == 2 || out_n == 4); + + p = out; + if (out_n == 2) { + for (i=0; i < pixel_count; ++i) { + p[1] = (p[0] == tc[0] ? 0 : 255); + p += 2; + } + } else { + for (i=0; i < pixel_count; ++i) { + if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) + p[3] = 0; + p += 4; + } + } + return 1; +} + +static int expand_palette(uint8 *palette, int len, int pal_img_n) +{ + uint32 i, pixel_count = img_x * img_y; + uint8 *p, *temp_out, *orig = out; + + p = (uint8 *) malloc(pixel_count * pal_img_n); + if (p == NULL) return e("outofmem", "Out of memory"); + + // between here and free(out) below, exitting would leak + temp_out = p; + + if (pal_img_n == 3) { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p += 3; + } + } else { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p[3] = palette[n+3]; + p += 4; + } + } + free(out); + out = temp_out; + return 1; +} + +static int parse_png_file(int scan, int req_comp) +{ + uint8 palette[1024], pal_img_n=0; + uint8 has_trans=0, tc[3]; + uint32 ioff=0, idata_limit=0, i, pal_len=0; + int first=1,k; + + if (!check_png_header()) return 0; + + if (scan == SCAN_type) return 1; + + for(;;first=0) { + chunk c = get_chunk_header(); + if (first && c.type != PNG_TYPE('I','H','D','R')) + return e("first not IHDR","Corrupt PNG"); + switch (c.type) { + case PNG_TYPE('I','H','D','R'): { + int depth,color,interlace,comp,filter; + if (!first) return e("multiple IHDR","Corrupt PNG"); + if (c.length != 13) return e("bad IHDR len","Corrupt PNG"); + img_x = get32(); if (img_x > (1 << 24)) return e("too large","Very large image (corrupt?)"); + img_y = get32(); if (img_y > (1 << 24)) return e("too large","Very large image (corrupt?)"); + depth = get8(); if (depth != 8) return e("8bit only","PNG not supported: 8-bit only"); + color = get8(); if (color > 6) return e("bad ctype","Corrupt PNG"); + if (color == 3) pal_img_n = 3; else if (color & 1) return e("bad ctype","Corrupt PNG"); + comp = get8(); if (comp) return e("bad comp method","Corrupt PNG"); + filter= get8(); if (filter) return e("bad filter method","Corrupt PNG"); + interlace = get8(); if (interlace) return e("interlaced","PNG not supported: interlaced mode"); + if (!img_x || !img_y) return e("0-pixel image","Corrupt PNG"); + if (!pal_img_n) { + img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); + if ((1 << 30) / img_x / img_n < img_y) return e("too large", "Image too large to decode"); + if (scan == SCAN_header) return 1; + } else { + // if paletted, then pal_n is our final components, and + // img_n is # components to decompress/filter. + img_n = 1; + if ((1 << 30) / img_x / 4 < img_y) return e("too large","Corrupt PNG"); + // if SCAN_header, have to scan to see if we have a tRNS + } + break; + } + + case PNG_TYPE('P','L','T','E'): { + if (c.length > 256*3) return e("invalid PLTE","Corrupt PNG"); + pal_len = c.length / 3; + if (pal_len * 3 != c.length) return e("invalid PLTE","Corrupt PNG"); + for (i=0; i < pal_len; ++i) { + palette[i*4+0] = get8u(); + palette[i*4+1] = get8u(); + palette[i*4+2] = get8u(); + palette[i*4+3] = 255; + } + break; + } + + case PNG_TYPE('t','R','N','S'): { + if (idata) return e("tRNS after IDAT","Corrupt PNG"); + if (pal_img_n) { + if (scan == SCAN_header) { img_n = 4; return 1; } + if (pal_len == 0) return e("tRNS before PLTE","Corrupt PNG"); + if (c.length > pal_len) return e("bad tRNS len","Corrupt PNG"); + pal_img_n = 4; + for (i=0; i < c.length; ++i) + palette[i*4+3] = get8u(); + } else { + if (!(img_n & 1)) return e("tRNS with alpha","Corrupt PNG"); + if (c.length != (uint32) img_n*2) return e("bad tRNS len","Corrupt PNG"); + has_trans = 1; + for (k=0; k < img_n; ++k) + tc[k] = (uint8) get16(); // non 8-bit images will be larger + } + break; + } + + case PNG_TYPE('I','D','A','T'): { + if (pal_img_n && !pal_len) return e("no PLTE","Corrupt PNG"); + if (scan == SCAN_header) { img_n = pal_img_n; return 1; } + if (ioff + c.length > idata_limit) { + uint8 *p; + if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; + while (ioff + c.length > idata_limit) + idata_limit *= 2; + p = (uint8 *) realloc(idata, idata_limit); if (p == NULL) return e("outofmem", "Out of memory"); + idata = p; + } + #ifndef STBI_NO_STDIO + if (img_file) + { + if (fread(idata+ioff,1,c.length,img_file) != c.length) return e("outofdata","Corrupt PNG"); + } + else + #endif + { + memcpy(idata+ioff, img_buffer, c.length); + img_buffer += c.length; + } + ioff += c.length; + break; + } + + case PNG_TYPE('I','E','N','D'): { + uint32 raw_len; + if (scan != SCAN_load) return 1; + if (idata == NULL) return e("no IDAT","Corrupt PNG"); + expanded = (uint8 *) stbi_zlib_decode_malloc((char *) idata, ioff, (int *) &raw_len); + if (expanded == NULL) return 0; // zlib should set error + free(idata); idata = NULL; + if ((req_comp == img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) + img_out_n = img_n+1; + else + img_out_n = img_n; + if (!create_png_image(expanded, raw_len, img_out_n)) return 0; + if (has_trans) + if (!compute_transparency(tc, img_out_n)) return 0; + if (pal_img_n) { + // pal_img_n == 3 or 4 + img_n = pal_img_n; // record the actual colors we had + img_out_n = pal_img_n; + if (req_comp >= 3) img_out_n = req_comp; + if (!expand_palette(palette, pal_len, img_out_n)) + return 0; + } + free(expanded); expanded = NULL; + return 1; + } + + default: + // if critical, fail + if ((c.type & (1 << 29)) == 0) { + #ifndef STBI_NO_FAILURE_STRINGS + static char invalid_chunk[] = "XXXX chunk not known"; + invalid_chunk[0] = (uint8) (c.type >> 24); + invalid_chunk[1] = (uint8) (c.type >> 16); + invalid_chunk[2] = (uint8) (c.type >> 8); + invalid_chunk[3] = (uint8) (c.type >> 0); + #endif + return e(invalid_chunk, "PNG not supported: unknown chunk type"); + } + skip(c.length); + break; + } + // end of chunk, read and skip CRC + get8(); get8(); get8(); get8(); + } +} + +static unsigned char *do_png(int *x, int *y, int *n, int req_comp) +{ + unsigned char *result=NULL; + if (req_comp < 0 || req_comp > 4) return epuc("bad req_comp", "Internal error"); + if (parse_png_file(SCAN_load, req_comp)) { + result = out; + out = NULL; + if (req_comp && req_comp != img_out_n) { + result = convert_format(result, img_out_n, req_comp); + if (result == NULL) return result; + } + *x = img_x; + *y = img_y; + if (n) *n = img_n; + } + free(out); out = NULL; + free(expanded); expanded = NULL; + free(idata); idata = NULL; + + return result; +} + +#ifndef STBI_NO_STDIO +unsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return do_png(x,y,comp,req_comp); +} + +unsigned char *stbi_png_load(char *filename, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_png_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return data; +} +#endif + +unsigned char *stbi_png_load_from_memory(unsigned char *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer,len); + return do_png(x,y,comp,req_comp); +} + +#ifndef STBI_NO_STDIO +int stbi_png_test_file(FILE *f) +{ + int n,r; + n = ftell(f); + start_file(f); + r = parse_png_file(SCAN_type,STBI_default); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_png_test_memory(unsigned char *buffer, int len) +{ + start_mem(buffer, len); + return parse_png_file(SCAN_type,STBI_default); +} + +// TODO: load header from png +#ifndef STBI_NO_STDIO +extern int stbi_png_info (char *filename, int *x, int *y, int *comp); +extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern int stbi_png_info_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp); + +// Microsoft/Windows BMP image + +static int bmp_test(void) +{ + int sz; + if (get8() != 'B') return 0; + if (get8() != 'M') return 0; + get32le(); // discard filesize + get16le(); // discard reserved + get16le(); // discard reserved + get32le(); // discard data offset + sz = get32le(); + if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1; + return 0; +} + +#ifndef STBI_NO_STDIO +int stbi_bmp_test_file (FILE *f) +{ + int r,n = ftell(f); + start_file(f); + r = bmp_test(); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_bmp_test_memory (stbi_uc *buffer, int len) +{ + start_mem(buffer, len); + return bmp_test(); +} + +// returns 0..31 for the highest set bit +static int high_bit(unsigned int z) +{ + int n=0; + if (z == 0) return -1; + if (z >= 0x10000) n += 16, z >>= 16; + if (z >= 0x00100) n += 8, z >>= 8; + if (z >= 0x00010) n += 4, z >>= 4; + if (z >= 0x00004) n += 2, z >>= 2; + if (z >= 0x00002) n += 1, z >>= 1; + return n; +} + +static int bitcount(unsigned int a) +{ + a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 + a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 + a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits + a = (a + (a >> 8)); // max 16 per 8 bits + a = (a + (a >> 16)); // max 32 per 8 bits + return a & 0xff; +} + +static int shiftsigned(int v, int shift, int bits) +{ + int result; + int z=0; + + if (shift < 0) v <<= -shift; + else v >>= shift; + result = v; + + z = bits; + while (z < 8) { + result += v >> z; + z += bits; + } + return result; +} + +static stbi_uc *bmp_load(int *x, int *y, int *comp, int req_comp) +{ + unsigned int mr=0,mg=0,mb=0,ma=0; + stbi_uc pal[256][4]; + int psize=0,i,j,compress=0,width; + int bpp, flip_vertically, pad, target, offset, hsz; + if (get8() != 'B' || get8() != 'M') return epuc("not BMP", "Corrupt BMP"); + get32le(); // discard filesize + get16le(); // discard reserved + get16le(); // discard reserved + offset = get32le(); + hsz = get32le(); + if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc("unknown BMP", "BMP type not supported: unknown"); + failure_reason = "bad BMP"; + if (hsz == 12) { + img_x = get16le(); + img_y = get16le(); + } else { + img_x = get32le(); + img_y = get32le(); + } + if (get16le() != 1) return 0; + bpp = get16le(); + if (bpp == 1) return epuc("monochrome", "BMP type not supported: 1-bit"); + flip_vertically = ((int) img_y) > 0; + img_y = abs((int) img_y); + if (hsz == 12) { + if (bpp < 24) + psize = (offset - 14 - 24) / 3; + } else { + compress = get32le(); + if (compress == 1 || compress == 2) return epuc("BMP RLE", "BMP type not supported: RLE"); + get32le(); // discard sizeof + get32le(); // discard hres + get32le(); // discard vres + get32le(); // discard colorsused + get32le(); // discard max important + if (hsz == 40 || hsz == 56) { + if (hsz == 56) { + get32le(); + get32le(); + get32le(); + get32le(); + } + if (bpp == 16 || bpp == 32) { + mr = mg = mb = 0; + if (compress == 0) { + if (bpp == 32) { + mr = 0xff << 16; + mg = 0xff << 8; + mb = 0xff << 0; + } else { + mr = 31 << 10; + mg = 31 << 5; + mb = 31 << 0; + } + } else if (compress == 3) { + mr = get32le(); + mg = get32le(); + mb = get32le(); + // not documented, but generated by photoshop and handled by mspaint + if (mr == mg && mg == mb) { + // ?!?!? + return NULL; + } + } else + return NULL; + } + } else { + assert(hsz == 108); + mr = get32le(); + mg = get32le(); + mb = get32le(); + ma = get32le(); + get32le(); // discard color space + for (i=0; i < 12; ++i) + get32le(); // discard color space parameters + } + if (bpp < 16) + psize = (offset - 14 - hsz) >> 2; + } + img_n = ma ? 4 : 3; + if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 + target = req_comp; + else + target = img_n; // if they want monochrome, we'll post-convert + out = (stbi_uc *) malloc(target * img_x * img_y); + if (!out) return epuc("outofmem", "Out of memory"); + if (bpp < 16) { + int z=0; + if (psize == 0 || psize > 256) return epuc("invalid", "Corrupt BMP"); + for (i=0; i < psize; ++i) { + pal[i][2] = get8(); + pal[i][1] = get8(); + pal[i][0] = get8(); + if (hsz != 12) get8(); + pal[i][3] = 255; + } + skip(offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4)); + if (bpp == 4) width = (img_x + 1) >> 1; + else if (bpp == 8) width = img_x; + else return epuc("bad bpp", "Corrupt BMP"); + pad = (-width)&3; + for (j=0; j < (int) img_y; ++j) { + for (i=0; i < (int) img_x; i += 2) { + int v=get8(),v2=0; + if (bpp == 4) { + v2 = v & 15; + v >>= 4; + } + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + if (i+1 == (int) img_x) break; + v = (bpp == 8) ? get8() : v2; + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + } + skip(pad); + } + } else { + int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; + int z = 0; + int easy=0; + skip(offset - 14 - hsz); + if (bpp == 24) width = 3 * img_x; + else if (bpp == 16) width = 2*img_x; + else /* bpp = 32 and pad = 0 */ width=0; + pad = (-width) & 3; + if (bpp == 24) { + easy = 1; + } else if (bpp == 32) { + if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000) + easy = 2; + } + if (!easy) { + if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP"); + // right shift amt to put high bit in position #7 + rshift = high_bit(mr)-7; rcount = bitcount(mr); + gshift = high_bit(mg)-7; gcount = bitcount(mr); + bshift = high_bit(mb)-7; bcount = bitcount(mr); + ashift = high_bit(ma)-7; acount = bitcount(mr); + } + for (j=0; j < (int) img_y; ++j) { + if (easy) { + for (i=0; i < (int) img_x; ++i) { + int a; + out[z+2] = get8(); + out[z+1] = get8(); + out[z+0] = get8(); + z += 3; + a = (easy == 2 ? get8() : 255); + if (target == 4) out[z++] = a; + } + } else { + for (i=0; i < (int) img_x; ++i) { + uint32 v = (bpp == 16 ? get16le() : get32le()); + int a; + out[z++] = shiftsigned(v & mr, rshift, rcount); + out[z++] = shiftsigned(v & mg, gshift, gcount); + out[z++] = shiftsigned(v & mb, bshift, bcount); + a = (ma ? shiftsigned(v & ma, ashift, acount) : 255); + if (target == 4) out[z++] = a; + } + } + skip(pad); + } + } + if (flip_vertically) { + stbi_uc t; + for (j=0; j < (int) img_y>>1; ++j) { + stbi_uc *p1 = out + j *img_x*target; + stbi_uc *p2 = out + (img_y-1-j)*img_x*target; + for (i=0; i < (int) img_x*target; ++i) { + t = p1[i], p1[i] = p2[i], p2[i] = t; + } + } + } + + if (req_comp && req_comp != target) { + out = convert_format(out, target, req_comp); + if (out == NULL) return out; // convert_format frees input on failure + } + + *x = img_x; + *y = img_y; + if (comp) *comp = target; + return out; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_bmp_load (char *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_bmp_load_from_file(f, x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return bmp_load(x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_bmp_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer, len); + return bmp_load(x,y,comp,req_comp); +} + +// Targa Truevision - TGA +// by Jonathan Dummer + +static int tga_test(void) +{ + int sz; + get8u(); // discard Offset + sz = get8u(); // color type + if( sz > 1 ) return 0; // only RGB or indexed allowed + sz = get8u(); // image type + if( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE + get16(); // discard palette start + get16(); // discard palette length + get8(); // discard bits per palette color entry + get16(); // discard x origin + get16(); // discard y origin + if( get16() < 1 ) return 0; // test width + if( get16() < 1 ) return 0; // test height + sz = get8(); // bits per pixel + if( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0; // only RGB or RGBA or grey allowed + return 1; // seems to have passed everything +} + +#ifndef STBI_NO_STDIO +int stbi_tga_test_file (FILE *f) +{ + int r,n = ftell(f); + start_file(f); + r = tga_test(); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_tga_test_memory (stbi_uc *buffer, int len) +{ + start_mem(buffer, len); + return tga_test(); +} + +static stbi_uc *tga_load(int *x, int *y, int *comp, int req_comp) +{ + // read in the TGA header stuff + int tga_offset = get8u(); + int tga_indexed = get8u(); + int tga_image_type = get8u(); + int tga_is_RLE = 0; + int tga_palette_start = get16le(); + int tga_palette_len = get16le(); + int tga_palette_bits = get8u(); + int tga_x_origin = get16le(); + int tga_y_origin = get16le(); + int tga_width = get16le(); + int tga_height = get16le(); + int tga_bits_per_pixel = get8u(); + int tga_inverted = get8u(); + // image data + unsigned char *tga_data; + unsigned char *tga_palette = NULL; + int i, j; + unsigned char raw_data[4]; + unsigned char trans_data[] = {0, 0, 0, 0}; + int RLE_count = 0; + int RLE_repeating = 0; + int read_next_pixel = 1; + // do a tiny bit of precessing + if( tga_image_type >= 8 ) + { + tga_image_type -= 8; + tga_is_RLE = 1; + } + /* int tga_alpha_bits = tga_inverted & 15; */ + tga_inverted = 1 - ((tga_inverted >> 5) & 1); + + // error check + if( //(tga_indexed) || + (tga_width < 1) || (tga_height < 1) || + (tga_image_type < 1) || (tga_image_type > 3) || + ((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) && + (tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32)) + ) + { + return NULL; + } + + // If I'm paletted, then I'll use the number of bits from the palette + if( tga_indexed ) + { + tga_bits_per_pixel = tga_palette_bits; + } + + // tga info + *x = tga_width; + *y = tga_height; + if( (req_comp < 1) || (req_comp > 4) ) + { + // just use whatever the file was + req_comp = tga_bits_per_pixel / 8; + *comp = req_comp; + } else + { + // force a new number of components + *comp = tga_bits_per_pixel/8; + } + tga_data = (unsigned char*)malloc( tga_width * tga_height * req_comp ); + + // skip to the data's starting position (offset usually = 0) + skip( tga_offset ); + // do I need to load a palette? + if( tga_indexed ) + { + // any data to skip? (offset usually = 0) + skip( tga_palette_start ); + // load the palette + tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 ); + getn( tga_palette, tga_palette_len * tga_palette_bits / 8 ); + } + // load the data + for( i = 0; i < tga_width * tga_height; ++i ) + { + // if I'm in RLE mode, do I need to get a RLE chunk? + if( tga_is_RLE ) + { + if( RLE_count == 0 ) + { + // yep, get the next byte as a RLE command + int RLE_cmd = get8u(); + RLE_count = 1 + (RLE_cmd & 127); + RLE_repeating = RLE_cmd >> 7; + read_next_pixel = 1; + } else if( !RLE_repeating ) + { + read_next_pixel = 1; + } + } else + { + read_next_pixel = 1; + } + // OK, if I need to read a pixel, do it now + if( read_next_pixel ) + { + // load however much data we did have + if( tga_indexed ) + { + // read in 1 byte, then perform the lookup + int pal_idx = get8u(); + if( pal_idx >= tga_palette_len ) + { + // invalid index + pal_idx = 0; + } + pal_idx *= tga_bits_per_pixel / 8; + for( j = 0; j*8 < tga_bits_per_pixel; ++j ) + { + raw_data[j] = tga_palette[pal_idx+j]; + } + } else + { + // read in the data raw + for( j = 0; j*8 < tga_bits_per_pixel; ++j ) + { + raw_data[j] = get8u(); + } + } + // convert raw to the intermediate format + switch( tga_bits_per_pixel ) + { + case 8: + // Luminous => RGBA + trans_data[0] = raw_data[0]; + trans_data[1] = raw_data[0]; + trans_data[2] = raw_data[0]; + trans_data[3] = 255; + break; + case 16: + // Luminous,Alpha => RGBA + trans_data[0] = raw_data[0]; + trans_data[1] = raw_data[0]; + trans_data[2] = raw_data[0]; + trans_data[3] = raw_data[1]; + break; + case 24: + // BGR => RGBA + trans_data[0] = raw_data[2]; + trans_data[1] = raw_data[1]; + trans_data[2] = raw_data[0]; + trans_data[3] = 255; + break; + case 32: + // BGRA => RGBA + trans_data[0] = raw_data[2]; + trans_data[1] = raw_data[1]; + trans_data[2] = raw_data[0]; + trans_data[3] = raw_data[3]; + break; + } + // clear the reading flag for the next pixel + read_next_pixel = 0; + } // end of reading a pixel + // convert to final format + switch( req_comp ) + { + case 1: + // RGBA => Luminance + tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]); + break; + case 2: + // RGBA => Luminance,Alpha + tga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]); + tga_data[i*req_comp+1] = trans_data[3]; + break; + case 3: + // RGBA => RGB + tga_data[i*req_comp+0] = trans_data[0]; + tga_data[i*req_comp+1] = trans_data[1]; + tga_data[i*req_comp+2] = trans_data[2]; + break; + case 4: + // RGBA => RGBA + tga_data[i*req_comp+0] = trans_data[0]; + tga_data[i*req_comp+1] = trans_data[1]; + tga_data[i*req_comp+2] = trans_data[2]; + tga_data[i*req_comp+3] = trans_data[3]; + break; + } + // in case we're in RLE mode, keep counting down + --RLE_count; + } + // do I need to invert the image? + if( tga_inverted ) + { + for( j = 0; j*2 < tga_height; ++j ) + { + int index1 = j * tga_width * req_comp; + int index2 = (tga_height - 1 - j) * tga_width * req_comp; + for( i = tga_width * req_comp; i > 0; --i ) + { + unsigned char temp = tga_data[index1]; + tga_data[index1] = tga_data[index2]; + tga_data[index2] = temp; + ++index1; + ++index2; + } + } + } + // clear my palette, if I had one + if( tga_palette != NULL ) + { + free( tga_palette ); + } + // the things I do to get rid of an error message, and yet keep + // Microsoft's C compilers happy... [8^( + tga_palette_start = tga_palette_len = tga_palette_bits = + tga_x_origin = tga_y_origin = 0; + // OK, done + return tga_data; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_tga_load (char *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_tga_load_from_file(f, x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return tga_load(x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_tga_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer, len); + return tga_load(x,y,comp,req_comp); +} + + +// ************************************************************************************************* +// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicholas Schulz, tweaked by STB + +static int psd_test(void) +{ + if (get32() != 0x38425053) return 0; // "8BPS" + else return 1; +} + +#ifndef STBI_NO_STDIO +int stbi_psd_test_file(FILE *f) +{ + int r,n = ftell(f); + start_file(f); + r = psd_test(); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_psd_test_memory(stbi_uc *buffer, int len) +{ + start_mem(buffer, len); + return psd_test(); +} + +static stbi_uc *psd_load(int *x, int *y, int *comp, int req_comp) +{ + int pixelCount; + int channelCount, compression; + int channel, i, count, len; + int w,h; + + // Check identifier + if (get32() != 0x38425053) // "8BPS" + return epuc("not PSD", "Corrupt PSD image"); + + // Check file type version. + if (get16() != 1) + return epuc("wrong version", "Unsupported version of PSD image"); + + // Skip 6 reserved bytes. + skip( 6 ); + + // Read the number of channels (R, G, B, A, etc). + channelCount = get16(); + if (channelCount < 0 || channelCount > 16) + return epuc("wrong channel count", "Unsupported number of channels in PSD image"); + + // Read the rows and columns of the image. + h = get32(); + w = get32(); + + // Make sure the depth is 8 bits. + if (get16() != 8) + return epuc("unsupported bit depth", "PSD bit depth is not 8 bit"); + + // Make sure the color mode is RGB. + // Valid options are: + // 0: Bitmap + // 1: Grayscale + // 2: Indexed color + // 3: RGB color + // 4: CMYK color + // 7: Multichannel + // 8: Duotone + // 9: Lab color + if (get16() != 3) + return epuc("wrong color format", "PSD is not in RGB color format"); + + // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) + skip(get32() ); + + // Skip the image resources. (resolution, pen tool paths, etc) + skip( get32() ); + + // Skip the reserved data. + skip( get32() ); + + // Find out if the data is compressed. + // Known values: + // 0: no compression + // 1: RLE compressed + compression = get16(); + if (compression > 1) + return epuc("unknown compression type", "PSD has an unknown compression format"); + + // Create the destination image. + out = (stbi_uc *) malloc(4 * w*h); + if (!out) return epuc("outofmem", "Out of memory"); + pixelCount = w*h; + + // Initialize the data to zero. + //memset( out, 0, pixelCount * 4 ); + + // Finally, the image data. + if (compression) { + // RLE as used by .PSD and .TIFF + // Loop until you get the number of unpacked bytes you are expecting: + // Read the next source byte into n. + // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. + // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. + // Else if n is 128, noop. + // Endloop + + // The RLE-compressed data is preceeded by a 2-byte data count for each row in the data, + // which we're going to just skip. + skip( h * channelCount * 2 ); + + // Read the RLE data by channel. + for (channel = 0; channel < 4; channel++) { + uint8 *p; + + p = out+channel; + if (channel >= channelCount) { + // Fill this channel with default data. + for (i = 0; i < pixelCount; i++) *p = (channel == 3 ? 255 : 0), p += 4; + } else { + // Read the RLE data. + count = 0; + while (count < pixelCount) { + len = get8(); + if (len == 128) { + // No-op. + } else if (len < 128) { + // Copy next len+1 bytes literally. + len++; + count += len; + while (len) { + *p = get8(); + p += 4; + len--; + } + } else if (len > 128) { + uint32 val; + // Next -len+1 bytes in the dest are replicated from next source byte. + // (Interpret len as a negative 8-bit int.) + len ^= 0x0FF; + len += 2; + val = get8(); + count += len; + while (len) { + *p = val; + p += 4; + len--; + } + } + } + } + } + + } else { + // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) + // where each channel consists of an 8-bit value for each pixel in the image. + + // Read the data by channel. + for (channel = 0; channel < 4; channel++) { + uint8 *p; + + p = out + channel; + if (channel > channelCount) { + // Fill this channel with default data. + for (i = 0; i < pixelCount; i++) *p = channel == 3 ? 255 : 0, p += 4; + } else { + // Read the data. + count = 0; + for (i = 0; i < pixelCount; i++) + *p = get8(), p += 4; + } + } + } + + if (req_comp && req_comp != 4) { + out = convert_format(out, 4, req_comp); + if (out == NULL) return out; // convert_format frees input on failure + } + + if (comp) *comp = channelCount; + *y = h; + *x = w; + + return out; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_psd_load(char *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = stbi_psd_load_from_file(f, x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_psd_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return psd_load(x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_psd_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer, len); + return psd_load(x,y,comp,req_comp); +} + + +// ************************************************************************************************* +// Radiance RGBE HDR loader +// originally by Nicolas Schulz +#ifndef STBI_NO_HDR +static int hdr_test(void) +{ + char *signature = "#?RADIANCE\n"; + int i; + for (i=0; signature[i]; ++i) + if (get8() != signature[i]) + return 0; + return 1; +} + +int stbi_hdr_test_memory(stbi_uc *buffer, int len) +{ + start_mem(buffer, len); + return hdr_test(); +} + +#ifndef STBI_NO_STDIO +int stbi_hdr_test_file(FILE *f) +{ + int r,n = ftell(f); + start_file(f); + r = hdr_test(); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +#define HDR_BUFLEN 1024 +static char *hdr_gettoken(char *buffer) +{ + int len=0; + char *s = buffer, c = '\0'; + + c = get8(); + + while (!at_eof() && c != '\n') { + buffer[len++] = c; + if (len == HDR_BUFLEN-1) { + // flush to end of line + while (!at_eof() && get8() != '\n') + ; + break; + } + c = get8(); + } + + buffer[len] = 0; + return buffer; +} + +static void hdr_convert(float *output, stbi_uc *input, int req_comp) +{ + if( input[3] != 0 ) { + float f1; + // Exponent + f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); + if (req_comp <= 2) + output[0] = (input[0] + input[1] + input[2]) * f1 / 3; + else { + output[0] = input[0] * f1; + output[1] = input[1] * f1; + output[2] = input[2] * f1; + } + if (req_comp == 2) output[1] = 1; + if (req_comp == 4) output[3] = 1; + } else { + switch (req_comp) { + case 4: output[3] = 1; /* fallthrough */ + case 3: output[0] = output[1] = output[2] = 0; + break; + case 2: output[1] = 1; /* fallthrough */ + case 1: output[0] = 0; + break; + } + } +} + + +static float *hdr_load(int *x, int *y, int *comp, int req_comp) +{ + char buffer[HDR_BUFLEN]; + char *token; + int valid = 0; + int width, height; + stbi_uc *scanline; + float *hdr_data; + int len; + unsigned char count, value; + int i, j, k, c1,c2, z; + + + // Check identifier + if (strcmp(hdr_gettoken(buffer), "#?RADIANCE") != 0) + return epf("not HDR", "Corrupt HDR image"); + + // Parse header + while(1) { + token = hdr_gettoken(buffer); + if (token[0] == 0) break; + if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; + } + + if (!valid) return epf("unsupported format", "Unsupported HDR format"); + + // Parse width and height + // can't use sscanf() if we're not using stdio! + token = hdr_gettoken(buffer); + if (strncmp(token, "-Y ", 3)) return epf("unsupported data layout", "Unsupported HDR format"); + token += 3; + height = strtol(token, &token, 10); + while (*token == ' ') ++token; + if (strncmp(token, "+X ", 3)) return epf("unsupported data layout", "Unsupported HDR format"); + token += 3; + width = strtol(token, NULL, 10); + + *x = width; + *y = height; + + *comp = 3; + if (req_comp == 0) req_comp = 3; + + // Read data + hdr_data = (float *) malloc(height * width * req_comp * sizeof(float)); + + // Load image data + // image data is stored as some number of sca + if( width < 8 || width >= 32768) { + // Read flat data + for (j=0; j < height; ++j) { + for (i=0; i < width; ++i) { + stbi_uc rgbe[4]; + main_decode_loop: + getn(rgbe, 4); + hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); + } + } + } else { + // Read RLE-encoded data + scanline = NULL; + + for (j = 0; j < height; ++j) { + c1 = get8(); + c2 = get8(); + len = get8(); + if (c1 != 2 || c2 != 2 || (len & 0x80)) { + // not run-length encoded, so we have to actually use THIS data as a decoded + // pixel (note this can't be a valid pixel--one of RGB must be >= 128) + stbi_uc rgbe[4] = { c1,c2,len, get8() }; + hdr_convert(hdr_data, rgbe, req_comp); + i = 1; + j = 0; + free(scanline); + goto main_decode_loop; // yes, this is fucking insane; blame the fucking insane format + } + len <<= 8; + len |= get8(); + if (len != width) { free(hdr_data); free(scanline); return epf("invalid decoded scanline length", "corrupt HDR"); } + if (scanline == NULL) scanline = (stbi_uc *) malloc(width * 4); + + for (k = 0; k < 4; ++k) { + i = 0; + while (i < width) { + count = get8(); + if (count > 128) { + // Run + value = get8(); + count -= 128; + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = value; + } else { + // Dump + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = get8(); + } + } + } + for (i=0; i < width; ++i) + hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); + } + free(scanline); + } + + return hdr_data; +} + +#ifndef STBI_NO_STDIO +float *stbi_hdr_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return hdr_load(x,y,comp,req_comp); +} +#endif + +float *stbi_hdr_load_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer, len); + return hdr_load(x,y,comp,req_comp); +} + +#endif // STBI_NO_HDR + +/////////////////////// write image /////////////////////// + +#ifndef STBI_NO_WRITE + +static void write8(FILE *f, int x) { uint8 z = (uint8) x; fwrite(&z,1,1,f); } + +static void writefv(FILE *f, char *fmt, va_list v) +{ + while (*fmt) { + switch (*fmt++) { + case ' ': break; + case '1': { uint8 x = va_arg(v, int); write8(f,x); break; } + case '2': { int16 x = va_arg(v, int); write8(f,x); write8(f,x>>8); break; } + case '4': { int32 x = va_arg(v, int); write8(f,x); write8(f,x>>8); write8(f,x>>16); write8(f,x>>24); break; } + default: + assert(0); + va_end(v); + return; + } + } +} + +static void writef(FILE *f, char *fmt, ...) +{ + va_list v; + va_start(v, fmt); + writefv(f,fmt,v); + va_end(v); +} + +static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad) +{ + uint8 bg[3] = { 255, 0, 255}, px[3]; + uint32 zero = 0; + int i,j,k, j_end; + + if (vdir < 0) + j_end = -1, j = y-1; + else + j_end = y, j = 0; + + for (; j != j_end; j += vdir) { + for (i=0; i < x; ++i) { + uint8 *d = (uint8 *) data + (j*x+i)*comp; + if (write_alpha < 0) + fwrite(&d[comp-1], 1, 1, f); + switch (comp) { + case 1: + case 2: writef(f, "111", d[0],d[0],d[0]); + break; + case 4: + if (!write_alpha) { + for (k=0; k < 3; ++k) + px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255; + writef(f, "111", px[1-rgb_dir],px[1],px[1+rgb_dir]); + break; + } + /* FALLTHROUGH */ + case 3: + writef(f, "111", d[1-rgb_dir],d[1],d[1+rgb_dir]); + break; + } + if (write_alpha > 0) + fwrite(&d[comp-1], 1, 1, f); + } + fwrite(&zero,scanline_pad,1,f); + } +} + +static int outfile(char *filename, int rgb_dir, int vdir, int x, int y, int comp, void *data, int alpha, int pad, char *fmt, ...) +{ + FILE *f = fopen(filename, "wb"); + if (f) { + va_list v; + va_start(v, fmt); + writefv(f, fmt, v); + va_end(v); + write_pixels(f,rgb_dir,vdir,x,y,comp,data,alpha,pad); + fclose(f); + } + return f != NULL; +} + +int stbi_write_bmp(char *filename, int x, int y, int comp, void *data) +{ + int pad = (-x*3) & 3; + return outfile(filename,-1,-1,x,y,comp,data,0,pad, + "11 4 22 4" "4 44 22 444444", + 'B', 'M', 14+40+(x*3+pad)*y, 0,0, 14+40, // file header + 40, x,y, 1,24, 0,0,0,0,0,0); // bitmap header +} + +int stbi_write_tga(char *filename, int x, int y, int comp, void *data) +{ + int has_alpha = !(comp & 1); + return outfile(filename, -1,-1, x, y, comp, data, has_alpha, 0, + "111 221 2222 11", 0,0,2, 0,0,0, 0,0,x,y, 24+8*has_alpha, 8*has_alpha); +} + +// any other image formats that do interleaved rgb data? +// PNG: requires adler32,crc32 -- significant amount of code +// PSD: no, channels output separately +// TIFF: no, stripwise-interleaved... i think + +#endif // STBI_NO_WRITE + +// add in my DDS loading support +#ifndef STBI_NO_DDS +#include "stbi_DDS_aug_c.h" +#endif + diff --git a/src/SFML/Graphics/SOIL/stb_image_aug.h b/src/SFML/Graphics/SOIL/stb_image_aug.h new file mode 100644 index 00000000..279887a0 --- /dev/null +++ b/src/SFML/Graphics/SOIL/stb_image_aug.h @@ -0,0 +1,329 @@ +/* stbi-1.08 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c + when you control the images you're loading + + QUICK NOTES: + Primarily of interest to game developers and other people who can + avoid problematic images and only need the trivial interface + + JPEG baseline (no JPEG progressive, no oddball channel decimations) + PNG non-interlaced + BMP non-1bpp, non-RLE + TGA (not sure what subset, if a subset) + PSD (composite view only, no extra channels) + HDR (radiance rgbE format) + writes BMP,TGA (define STBI_NO_WRITE to remove code) + decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code) + + TODO: + stbi_info_* + + history: + 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz + 1.07 attempt to fix C++ warning/errors again + 1.06 attempt to fix C++ warning/errors again + 1.05 fix TGA loading to return correct *comp and use good luminance calc + 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free + 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR + 1.02 support for (subset of) HDR files, float interface for preferred access to them + 1.01 fix bug: possible bug in handling right-side up bmps... not sure + fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all + 1.00 interface to zlib that skips zlib header + 0.99 correct handling of alpha in palette + 0.98 TGA loader by lonesock; dynamically add loaders (untested) + 0.97 jpeg errors on too large a file; also catch another malloc failure + 0.96 fix detection of invalid v value - particleman@mollyrocket forum + 0.95 during header scan, seek to markers in case of padding + 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same + 0.93 handle jpegtran output; verbose errors + 0.92 read 4,8,16,24,32-bit BMP files of several formats + 0.91 output 24-bit Windows 3.0 BMP files + 0.90 fix a few more warnings; bump version number to approach 1.0 + 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd + 0.60 fix compiling as c++ + 0.59 fix warnings: merge Dave Moore's -Wall fixes + 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian + 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less + than 16 available + 0.56 fix bug: zlib uncompressed mode len vs. nlen + 0.55 fix bug: restart_interval not initialized to 0 + 0.54 allow NULL for 'int *comp' + 0.53 fix bug in png 3->4; speedup png decoding + 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments + 0.51 obey req_comp requests, 1-component jpegs return as 1-component, + on 'test' only check type, not whether we support this variant +*/ + +#ifndef HEADER_STB_IMAGE_AUGMENTED +#define HEADER_STB_IMAGE_AUGMENTED + +//// begin header file //////////////////////////////////////////////////// +// +// Limitations: +// - no progressive/interlaced support (jpeg, png) +// - 8-bit samples only (jpeg, png) +// - not threadsafe +// - channel subsampling of at most 2 in each dimension (jpeg) +// - no delayed line count (jpeg) -- IJG doesn't support either +// +// Basic usage (see HDR discussion below): +// int x,y,n; +// unsigned char *data = stbi_load(filename, &x, &y, &n, 0); +// // ... process data if not NULL ... +// // ... x = width, y = height, n = # 8-bit components per pixel ... +// // ... replace '0' with '1'..'4' to force that many components per pixel +// stbi_image_free(data) +// +// Standard parameters: +// int *x -- outputs image width in pixels +// int *y -- outputs image height in pixels +// int *comp -- outputs # of image components in image file +// int req_comp -- if non-zero, # of image components requested in result +// +// The return value from an image loader is an 'unsigned char *' which points +// to the pixel data. The pixel data consists of *y scanlines of *x pixels, +// with each pixel consisting of N interleaved 8-bit components; the first +// pixel pointed to is top-left-most in the image. There is no padding between +// image scanlines or between pixels, regardless of format. The number of +// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise. +// If req_comp is non-zero, *comp has the number of components that _would_ +// have been output otherwise. E.g. if you set req_comp to 4, you will always +// get RGBA output, but you can check *comp to easily see if it's opaque. +// +// An output image with N components has the following components interleaved +// in this order in each pixel: +// +// N=#comp components +// 1 grey +// 2 grey, alpha +// 3 red, green, blue +// 4 red, green, blue, alpha +// +// If image loading fails for any reason, the return value will be NULL, +// and *x, *y, *comp will be unchanged. The function stbi_failure_reason() +// can be queried for an extremely brief, end-user unfriendly explanation +// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid +// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly +// more user-friendly ones. +// +// Paletted PNG and BMP images are automatically depalettized. +// +// +// =========================================================================== +// +// HDR image support (disable by defining STBI_NO_HDR) +// +// stb_image now supports loading HDR images in general, and currently +// the Radiance .HDR file format, although the support is provided +// generically. You can still load any file through the existing interface; +// if you attempt to load an HDR file, it will be automatically remapped to +// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; +// both of these constants can be reconfigured through this interface: +// +// stbi_hdr_to_ldr_gamma(2.2f); +// stbi_hdr_to_ldr_scale(1.0f); +// +// (note, do not use _inverse_ constants; stbi_image will invert them +// appropriately). +// +// Additionally, there is a new, parallel interface for loading files as +// (linear) floats to preserve the full dynamic range: +// +// float *data = stbi_loadf(filename, &x, &y, &n, 0); +// +// If you load LDR images through this interface, those images will +// be promoted to floating point values, run through the inverse of +// constants corresponding to the above: +// +// stbi_ldr_to_hdr_scale(1.0f); +// stbi_ldr_to_hdr_gamma(2.2f); +// +// Finally, given a filename (or an open file or memory block--see header +// file for details) containing image data, you can query for the "most +// appropriate" interface to use (that is, whether the image is HDR or +// not), using: +// +// stbi_is_hdr(char *filename); + + +#ifndef STBI_NO_STDIO +#include +#endif + +#ifndef STBI_NO_HDR +#include // ldexp +#include // strcmp +#endif + +enum +{ + STBI_default = 0, // only used for req_comp + + STBI_grey = 1, + STBI_grey_alpha = 2, + STBI_rgb = 3, + STBI_rgb_alpha = 4, +}; + +typedef unsigned char stbi_uc; + +#ifdef __cplusplus +extern "C" { +#endif + +// WRITING API + +#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO) +// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding) +// (you must include the appropriate extension in the filename). +// returns TRUE on success, FALSE if couldn't open file, error writing file +extern int stbi_write_bmp (char *filename, int x, int y, int comp, void *data); +extern int stbi_write_tga (char *filename, int x, int y, int comp, void *data); +#endif + +// PRIMARY API - works on images of any type + +// load image by filename, open file, or memory buffer +#ifndef STBI_NO_STDIO +extern stbi_uc *stbi_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +extern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif +extern stbi_uc *stbi_load_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +// for stbi_load_from_file, file pointer is left pointing immediately after image + +#ifndef STBI_NO_HDR +#ifndef STBI_NO_STDIO +extern float *stbi_loadf (char *filename, int *x, int *y, int *comp, int req_comp); +extern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif +extern float *stbi_loadf_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); + +extern void stbi_hdr_to_ldr_gamma(float gamma); +extern void stbi_hdr_to_ldr_scale(float scale); + +extern void stbi_ldr_to_hdr_gamma(float gamma); +extern void stbi_ldr_to_hdr_scale(float scale); + +#endif // STBI_NO_HDR + +// get a VERY brief reason for failure +extern char *stbi_failure_reason (void); + +// free the loaded image -- this is just free() +extern void stbi_image_free (void *retval_from_stbi_load); + +// get image dimensions & components without fully decoding +extern int stbi_info_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp); +extern int stbi_is_hdr_from_memory(stbi_uc *buffer, int len); +#ifndef STBI_NO_STDIO +extern int stbi_info (char *filename, int *x, int *y, int *comp); +extern int stbi_is_hdr (char *filename); +extern int stbi_is_hdr_from_file(FILE *f); +#endif + +// ZLIB client - used by PNG, available for other purposes + +extern char *stbi_zlib_decode_malloc_guesssize(int initial_size, int *outlen); +extern char *stbi_zlib_decode_malloc(char *buffer, int len, int *outlen); +extern int stbi_zlib_decode_buffer(char *obuffer, int olen, char *ibuffer, int ilen); + +extern char *stbi_zlib_decode_noheader_malloc(char *buffer, int len, int *outlen); +extern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, char *ibuffer, int ilen); + + +// TYPE-SPECIFIC ACCESS + +// is it a jpeg? +extern int stbi_jpeg_test_memory (stbi_uc *buffer, int len); +extern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +extern int stbi_jpeg_info_from_memory(stbi_uc *buffer, int len, int *x, int *y, int *comp); + +#ifndef STBI_NO_STDIO +extern stbi_uc *stbi_jpeg_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern int stbi_jpeg_test_file (FILE *f); +extern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); + +extern int stbi_jpeg_info (char *filename, int *x, int *y, int *comp); +extern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif + +extern int stbi_jpeg_dc_only; // only decode DC component + +// is it a png? +extern int stbi_png_test_memory (stbi_uc *buffer, int len); +extern stbi_uc *stbi_png_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +extern int stbi_png_info_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp); + +#ifndef STBI_NO_STDIO +extern stbi_uc *stbi_png_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern int stbi_png_info (char *filename, int *x, int *y, int *comp); +extern int stbi_png_test_file (FILE *f); +extern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +extern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp); +#endif + +// is it a bmp? +extern int stbi_bmp_test_memory (stbi_uc *buffer, int len); + +extern stbi_uc *stbi_bmp_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_bmp_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_bmp_test_file (FILE *f); +extern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// is it a tga? +extern int stbi_tga_test_memory (stbi_uc *buffer, int len); + +extern stbi_uc *stbi_tga_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_tga_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_tga_test_file (FILE *f); +extern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// is it a psd? +extern int stbi_psd_test_memory (stbi_uc *buffer, int len); + +extern stbi_uc *stbi_psd_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_psd_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_psd_test_file (FILE *f); +extern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// is it an hdr? +extern int stbi_hdr_test_memory (stbi_uc *buffer, int len); + +extern float * stbi_hdr_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern float * stbi_hdr_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_hdr_test_file (FILE *f); +extern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// define new loaders +typedef struct +{ + int (*test_memory)(stbi_uc *buffer, int len); + stbi_uc * (*load_from_memory)(stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); + #ifndef STBI_NO_STDIO + int (*test_file)(FILE *f); + stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp); + #endif +} stbi_loader; + +// register a loader by filling out the above structure (you must defined ALL functions) +// returns 1 if added or already added, 0 if not added (too many loaders) +extern int stbi_register_loader(stbi_loader *loader); + +#ifdef __cplusplus +} +#endif + +// +// +//// end header file ///////////////////////////////////////////////////// + +#endif + diff --git a/src/SFML/Graphics/SOIL/stbi_DDS_aug.h b/src/SFML/Graphics/SOIL/stbi_DDS_aug.h new file mode 100644 index 00000000..c53e1a3b --- /dev/null +++ b/src/SFML/Graphics/SOIL/stbi_DDS_aug.h @@ -0,0 +1,21 @@ +/* + adding DDS loading support to stbi +*/ + +#ifndef HEADER_STB_IMAGE_DDS_AUGMENTATION +#define HEADER_STB_IMAGE_DDS_AUGMENTATION + +// is it a DDS file? +extern int stbi_dds_test_memory (stbi_uc *buffer, int len); + +extern stbi_uc *stbi_dds_load (char *filename, int *x, int *y, int *comp, int req_comp); +extern stbi_uc *stbi_dds_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp); +#ifndef STBI_NO_STDIO +extern int stbi_dds_test_file (FILE *f); +extern stbi_uc *stbi_dds_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp); +#endif + +// +// +//// end header file ///////////////////////////////////////////////////// +#endif // HEADER_STB_IMAGE_DDS_AUGMENTATION diff --git a/src/SFML/Graphics/SOIL/stbi_DDS_aug_c.h b/src/SFML/Graphics/SOIL/stbi_DDS_aug_c.h new file mode 100644 index 00000000..024efd6e --- /dev/null +++ b/src/SFML/Graphics/SOIL/stbi_DDS_aug_c.h @@ -0,0 +1,507 @@ + +/// DDS file support, does decoding, _not_ direct uploading +/// (use SOIL for that ;-) + +/// A bunch of DirectDraw Surface structures and flags +typedef struct { + unsigned int dwMagic; + unsigned int dwSize; + unsigned int dwFlags; + unsigned int dwHeight; + unsigned int dwWidth; + unsigned int dwPitchOrLinearSize; + unsigned int dwDepth; + unsigned int dwMipMapCount; + unsigned int dwReserved1[ 11 ]; + + // DDPIXELFORMAT + struct { + unsigned int dwSize; + unsigned int dwFlags; + unsigned int dwFourCC; + unsigned int dwRGBBitCount; + unsigned int dwRBitMask; + unsigned int dwGBitMask; + unsigned int dwBBitMask; + unsigned int dwAlphaBitMask; + } sPixelFormat; + + // DDCAPS2 + struct { + unsigned int dwCaps1; + unsigned int dwCaps2; + unsigned int dwDDSX; + unsigned int dwReserved; + } sCaps; + unsigned int dwReserved2; +} DDS_header ; + +// the following constants were copied directly off the MSDN website + +// The dwFlags member of the original DDSURFACEDESC2 structure +// can be set to one or more of the following values. +#define DDSD_CAPS 0x00000001 +#define DDSD_HEIGHT 0x00000002 +#define DDSD_WIDTH 0x00000004 +#define DDSD_PITCH 0x00000008 +#define DDSD_PIXELFORMAT 0x00001000 +#define DDSD_MIPMAPCOUNT 0x00020000 +#define DDSD_LINEARSIZE 0x00080000 +#define DDSD_DEPTH 0x00800000 + +// DirectDraw Pixel Format +#define DDPF_ALPHAPIXELS 0x00000001 +#define DDPF_FOURCC 0x00000004 +#define DDPF_RGB 0x00000040 + +// The dwCaps1 member of the DDSCAPS2 structure can be +// set to one or more of the following values. +#define DDSCAPS_COMPLEX 0x00000008 +#define DDSCAPS_TEXTURE 0x00001000 +#define DDSCAPS_MIPMAP 0x00400000 + +// The dwCaps2 member of the DDSCAPS2 structure can be +// set to one or more of the following values. +#define DDSCAPS2_CUBEMAP 0x00000200 +#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 +#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 +#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 +#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 +#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 +#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 +#define DDSCAPS2_VOLUME 0x00200000 + +static int dds_test(void) +{ + // check the magic number + if (get8() != 'D') return 0; + if (get8() != 'D') return 0; + if (get8() != 'S') return 0; + if (get8() != ' ') return 0; + // check header size + if (get32le() != 124) return 0; + return 1; +} +#ifndef STBI_NO_STDIO +int stbi_dds_test_file (FILE *f) +{ + int r,n = ftell(f); + start_file(f); + r = dds_test(); + fseek(f,n,SEEK_SET); + return r; +} +#endif + +int stbi_dds_test_memory (stbi_uc *buffer, int len) +{ + start_mem(buffer, len); + return dds_test(); +} + +// helper functions +int stbi_convert_bit_range( int c, int from_bits, int to_bits ) +{ + int b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1); + return (b + (b >> from_bits)) >> from_bits; +} +void stbi_rgb_888_from_565( unsigned int c, int *r, int *g, int *b ) +{ + *r = stbi_convert_bit_range( (c >> 11) & 31, 5, 8 ); + *g = stbi_convert_bit_range( (c >> 05) & 63, 6, 8 ); + *b = stbi_convert_bit_range( (c >> 00) & 31, 5, 8 ); +} +void stbi_decode_DXT1_block( + unsigned char uncompressed[16*4], + unsigned char compressed[8] ) +{ + int next_bit = 4*8; + int i, r, g, b; + int c0, c1; + unsigned char decode_colors[4*4]; + // find the 2 primary colors + c0 = compressed[0] + (compressed[1] << 8); + c1 = compressed[2] + (compressed[3] << 8); + stbi_rgb_888_from_565( c0, &r, &g, &b ); + decode_colors[0] = r; + decode_colors[1] = g; + decode_colors[2] = b; + decode_colors[3] = 255; + stbi_rgb_888_from_565( c1, &r, &g, &b ); + decode_colors[4] = r; + decode_colors[5] = g; + decode_colors[6] = b; + decode_colors[7] = 255; + if( c0 > c1 ) + { + // no alpha, 2 interpolated colors + decode_colors[8] = (2*decode_colors[0] + decode_colors[4]) / 3; + decode_colors[9] = (2*decode_colors[1] + decode_colors[5]) / 3; + decode_colors[10] = (2*decode_colors[2] + decode_colors[6]) / 3; + decode_colors[11] = 255; + decode_colors[12] = (decode_colors[0] + 2*decode_colors[4]) / 3; + decode_colors[13] = (decode_colors[1] + 2*decode_colors[5]) / 3; + decode_colors[14] = (decode_colors[2] + 2*decode_colors[6]) / 3; + decode_colors[15] = 255; + } else + { + // 1 interpolated color, alpha + decode_colors[8] = (decode_colors[0] + decode_colors[4]) / 2; + decode_colors[9] = (decode_colors[1] + decode_colors[5]) / 2; + decode_colors[10] = (decode_colors[2] + decode_colors[6]) / 2; + decode_colors[11] = 255; + decode_colors[12] = 0; + decode_colors[13] = 0; + decode_colors[14] = 0; + decode_colors[15] = 0; + } + // decode the block + for( i = 0; i < 16*4; i += 4 ) + { + int idx = ((compressed[next_bit>>3] >> (next_bit & 7)) & 3) * 4; + next_bit += 2; + uncompressed[i+0] = decode_colors[idx+0]; + uncompressed[i+1] = decode_colors[idx+1]; + uncompressed[i+2] = decode_colors[idx+2]; + uncompressed[i+3] = decode_colors[idx+3]; + } + // done +} +void stbi_decode_DXT23_alpha_block( + unsigned char uncompressed[16*4], + unsigned char compressed[8] ) +{ + int i, next_bit = 0; + // each alpha value gets 4 bits + for( i = 3; i < 16*4; i += 4 ) + { + uncompressed[i] = stbi_convert_bit_range( + (compressed[next_bit>>3] >> (next_bit&7)) & 15, + 4, 8 ); + next_bit += 4; + } +} +void stbi_decode_DXT45_alpha_block( + unsigned char uncompressed[16*4], + unsigned char compressed[8] ) +{ + int i, next_bit = 8*2; + unsigned char decode_alpha[8]; + // each alpha value gets 3 bits, and the 1st 2 bytes are the range + decode_alpha[0] = compressed[0]; + decode_alpha[1] = compressed[1]; + if( decode_alpha[0] > decode_alpha[1] ) + { + // 6 step intermediate + decode_alpha[2] = (6*decode_alpha[0] + 1*decode_alpha[1]) / 7; + decode_alpha[3] = (5*decode_alpha[0] + 2*decode_alpha[1]) / 7; + decode_alpha[4] = (4*decode_alpha[0] + 3*decode_alpha[1]) / 7; + decode_alpha[5] = (3*decode_alpha[0] + 4*decode_alpha[1]) / 7; + decode_alpha[6] = (2*decode_alpha[0] + 5*decode_alpha[1]) / 7; + decode_alpha[7] = (1*decode_alpha[0] + 6*decode_alpha[1]) / 7; + } else + { + // 4 step intermediate, pluss full and none + decode_alpha[2] = (4*decode_alpha[0] + 1*decode_alpha[1]) / 5; + decode_alpha[3] = (3*decode_alpha[0] + 2*decode_alpha[1]) / 5; + decode_alpha[4] = (2*decode_alpha[0] + 3*decode_alpha[1]) / 5; + decode_alpha[5] = (1*decode_alpha[0] + 4*decode_alpha[1]) / 5; + decode_alpha[6] = 0; + decode_alpha[7] = 255; + } + for( i = 3; i < 16*4; i += 4 ) + { + int idx = 0, bit; + bit = (compressed[next_bit>>3] >> (next_bit&7)) & 1; + idx += bit << 0; + ++next_bit; + bit = (compressed[next_bit>>3] >> (next_bit&7)) & 1; + idx += bit << 1; + ++next_bit; + bit = (compressed[next_bit>>3] >> (next_bit&7)) & 1; + idx += bit << 2; + ++next_bit; + uncompressed[i] = decode_alpha[idx & 7]; + } + // done +} +void stbi_decode_DXT_color_block( + unsigned char uncompressed[16*4], + unsigned char compressed[8] ) +{ + int next_bit = 4*8; + int i, r, g, b; + int c0, c1; + unsigned char decode_colors[4*3]; + // find the 2 primary colors + c0 = compressed[0] + (compressed[1] << 8); + c1 = compressed[2] + (compressed[3] << 8); + stbi_rgb_888_from_565( c0, &r, &g, &b ); + decode_colors[0] = r; + decode_colors[1] = g; + decode_colors[2] = b; + stbi_rgb_888_from_565( c1, &r, &g, &b ); + decode_colors[3] = r; + decode_colors[4] = g; + decode_colors[5] = b; + // Like DXT1, but no choicees: + // no alpha, 2 interpolated colors + decode_colors[6] = (2*decode_colors[0] + decode_colors[3]) / 3; + decode_colors[7] = (2*decode_colors[1] + decode_colors[4]) / 3; + decode_colors[8] = (2*decode_colors[2] + decode_colors[5]) / 3; + decode_colors[9] = (decode_colors[0] + 2*decode_colors[3]) / 3; + decode_colors[10] = (decode_colors[1] + 2*decode_colors[4]) / 3; + decode_colors[11] = (decode_colors[2] + 2*decode_colors[5]) / 3; + // decode the block + for( i = 0; i < 16*4; i += 4 ) + { + int idx = ((compressed[next_bit>>3] >> (next_bit & 7)) & 3) * 3; + next_bit += 2; + uncompressed[i+0] = decode_colors[idx+0]; + uncompressed[i+1] = decode_colors[idx+1]; + uncompressed[i+2] = decode_colors[idx+2]; + } + // done +} +static stbi_uc *dds_load(int *x, int *y, int *comp, int req_comp) +{ + // all variables go up front + stbi_uc *dds_data = NULL; + stbi_uc block[16*4]; + stbi_uc compressed[8]; + int flags, DXT_family; + int has_alpha, has_mipmap; + int is_compressed, cubemap_faces; + int block_pitch, num_blocks; + DDS_header header; + int i, sz, cf; + // load the header + if( sizeof( DDS_header ) != 128 ) + { + return NULL; + } + getn( (stbi_uc*)(&header), 128 ); + // and do some checking + if( header.dwMagic != (('D' << 0) | ('D' << 8) | ('S' << 16) | (' ' << 24)) ) return NULL; + if( header.dwSize != 124 ) return NULL; + flags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; + if( (header.dwFlags & flags) != flags ) return NULL; + /* According to the MSDN spec, the dwFlags should contain + DDSD_LINEARSIZE if it's compressed, or DDSD_PITCH if + uncompressed. Some DDS writers do not conform to the + spec, so I need to make my reader more tolerant */ + if( header.sPixelFormat.dwSize != 32 ) return NULL; + flags = DDPF_FOURCC | DDPF_RGB; + if( (header.sPixelFormat.dwFlags & flags) == 0 ) return NULL; + if( (header.sCaps.dwCaps1 & DDSCAPS_TEXTURE) == 0 ) return NULL; + // get the image data + img_x = header.dwWidth; + img_y = header.dwHeight; + img_n = 4; + is_compressed = (header.sPixelFormat.dwFlags & DDPF_FOURCC) / DDPF_FOURCC; + has_alpha = (header.sPixelFormat.dwFlags & DDPF_ALPHAPIXELS) / DDPF_ALPHAPIXELS; + has_mipmap = (header.sCaps.dwCaps1 & DDSCAPS_MIPMAP) && (header.dwMipMapCount > 1); + cubemap_faces = (header.sCaps.dwCaps2 & DDSCAPS2_CUBEMAP) / DDSCAPS2_CUBEMAP; + /* I need cubemaps to have square faces */ + cubemap_faces &= (img_x == img_y); + cubemap_faces *= 5; + cubemap_faces += 1; + block_pitch = (img_x+3) >> 2; + num_blocks = block_pitch * ((img_y+3) >> 2); + /* let the user know what's going on */ + *x = img_x; + *y = img_y; + *comp = img_n; + /* is this uncompressed? */ + if( is_compressed ) + { + /* compressed */ + // note: header.sPixelFormat.dwFourCC is something like (('D'<<0)|('X'<<8)|('T'<<16)|('1'<<24)) + DXT_family = 1 + (header.sPixelFormat.dwFourCC >> 24) - '1'; + if( (DXT_family < 1) || (DXT_family > 5) ) return NULL; + /* check the expected size...oops, nevermind... + those non-compliant writers leave + dwPitchOrLinearSize == 0 */ + // passed all the tests, get the RAM for decoding + sz = (img_x)*(img_y)*4*cubemap_faces; + dds_data = (unsigned char*)malloc( sz ); + /* do this once for each face */ + for( cf = 0; cf < cubemap_faces; ++ cf ) + { + // now read and decode all the blocks + for( i = 0; i < num_blocks; ++i ) + { + // where are we? + int bx, by, bw=4, bh=4; + int ref_x = 4 * (i % block_pitch); + int ref_y = 4 * (i / block_pitch); + // get the next block's worth of compressed data, and decompress it + if( DXT_family == 1 ) + { + // DXT1 + getn( compressed, 8 ); + stbi_decode_DXT1_block( block, compressed ); + } else if( DXT_family < 4 ) + { + // DXT2/3 + getn( compressed, 8 ); + stbi_decode_DXT23_alpha_block ( block, compressed ); + getn( compressed, 8 ); + stbi_decode_DXT_color_block ( block, compressed ); + } else + { + // DXT4/5 + getn( compressed, 8 ); + stbi_decode_DXT45_alpha_block ( block, compressed ); + getn( compressed, 8 ); + stbi_decode_DXT_color_block ( block, compressed ); + } + // is this a partial block? + if( ref_x + 4 > img_x ) + { + bw = img_x - ref_x; + } + if( ref_y + 4 > img_y ) + { + bh = img_y - ref_y; + } + // now drop our decompressed data into the buffer + for( by = 0; by < bh; ++by ) + { + int idx = 4*((ref_y+by+cf*img_x)*img_x + ref_x); + for( bx = 0; bx < bw*4; ++bx ) + { + + dds_data[idx+bx] = block[by*16+bx]; + } + } + } + /* done reading and decoding the main image... + skip MIPmaps if present */ + if( has_mipmap ) + { + int block_size = 16; + if( DXT_family == 1 ) + { + block_size = 8; + } + for( i = 1; i < header.dwMipMapCount; ++i ) + { + int mx = img_x >> (i + 2); + int my = img_y >> (i + 2); + if( mx < 1 ) + { + mx = 1; + } + if( my < 1 ) + { + my = 1; + } + skip( mx*my*block_size ); + } + } + }/* per cubemap face */ + } else + { + /* uncompressed */ + DXT_family = 0; + img_n = 3; + if( has_alpha ) + { + img_n = 4; + } + *comp = img_n; + sz = img_x*img_y*img_n*cubemap_faces; + dds_data = (unsigned char*)malloc( sz ); + /* do this once for each face */ + for( cf = 0; cf < cubemap_faces; ++ cf ) + { + /* read the main image for this face */ + getn( &dds_data[cf*img_x*img_y*img_n], img_x*img_y*img_n ); + /* done reading and decoding the main image... + skip MIPmaps if present */ + if( has_mipmap ) + { + for( i = 1; i < header.dwMipMapCount; ++i ) + { + int mx = img_x >> i; + int my = img_y >> i; + if( mx < 1 ) + { + mx = 1; + } + if( my < 1 ) + { + my = 1; + } + skip( mx*my*img_n ); + } + } + } + /* data was BGR, I need it RGB */ + for( i = 0; i < sz; i += img_n ) + { + unsigned char temp = dds_data[i]; + dds_data[i] = dds_data[i+2]; + dds_data[i+2] = temp; + } + } + /* finished decompressing into RGBA, + adjust the y size if we have a cubemap + note: sz is already up to date */ + img_y *= cubemap_faces; + *y = img_y; + // did the user want something else, or + // see if all the alpha values are 255 (i.e. no transparency) + has_alpha = 0; + if( img_n == 4) + { + for( i = 3; (i < sz) && (has_alpha == 0); i += 4 ) + { + has_alpha |= (dds_data[i] < 255); + } + } + if( (req_comp <= 4) && (req_comp >= 1) ) + { + // user has some requirements, meet them + if( req_comp != img_n ) + { + dds_data = convert_format( dds_data, img_n, req_comp ); + *comp = img_n; + } + } else + { + // user had no requirements, only drop to RGB is no alpha + if( (has_alpha == 0) && (img_n == 4) ) + { + dds_data = convert_format( dds_data, 4, 3 ); + *comp = 3; + } + } + // OK, done + return dds_data; +} + +#ifndef STBI_NO_STDIO +stbi_uc *stbi_dds_load (char *filename, int *x, int *y, int *comp, int req_comp) +{ + stbi_uc *data; + FILE *f = fopen(filename, "rb"); + if (!f) return NULL; + data = dds_load(x,y,comp,req_comp); + fclose(f); + return data; +} + +stbi_uc *stbi_dds_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp) +{ + start_file(f); + return dds_load(x,y,comp,req_comp); +} +#endif + +stbi_uc *stbi_dds_load_from_memory (stbi_uc *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + start_mem(buffer, len); + return dds_load(x,y,comp,req_comp); +} diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp new file mode 100644 index 00000000..a5c9524e --- /dev/null +++ b/src/SFML/Graphics/Shape.cpp @@ -0,0 +1,425 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Shape::Shape() : +myOutline (0.f), +myIsFillEnabled (true), +myIsOutlineEnabled(true), +myIsCompiled (false) +{ + // Put a placeholder for the center of the shape + myPoints.push_back(Point()); +} + + +//////////////////////////////////////////////////////////// +/// Add a point to the shape +//////////////////////////////////////////////////////////// +void Shape::AddPoint(float X, float Y, const Color& Col, const Color& OutlineCol) +{ + AddPoint(Vector2f(X, Y), Col, OutlineCol); +} + + +//////////////////////////////////////////////////////////// +/// Add a point to the shape +//////////////////////////////////////////////////////////// +void Shape::AddPoint(const Vector2f& Position, const Color& Col, const Color& OutlineCol) +{ + myPoints.push_back(Point(Position, Col, OutlineCol)); + myIsCompiled = false; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of points composing the shape +//////////////////////////////////////////////////////////// +unsigned int Shape::GetNbPoints() const +{ + return static_cast(myPoints.size() - 1); +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable filling the shape. +/// Fill is enabled by default +//////////////////////////////////////////////////////////// +void Shape::EnableFill(bool Enable) +{ + myIsFillEnabled = Enable; +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable drawing the shape outline. +/// Outline is enabled by default +//////////////////////////////////////////////////////////// +void Shape::EnableOutline(bool Enable) +{ + myIsOutlineEnabled = Enable; +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a point +//////////////////////////////////////////////////////////// +void Shape::SetPointPosition(unsigned int Index, const Vector2f& Position) +{ + myPoints[Index + 1].Position = Position; + myIsCompiled = false; +} + + +//////////////////////////////////////////////////////////// +/// Set the position of a point +//////////////////////////////////////////////////////////// +void Shape::SetPointPosition(unsigned int Index, float X, float Y) +{ + SetPointPosition(Index, Vector2f(X, Y)); +} + + +//////////////////////////////////////////////////////////// +/// Set the color of a point +//////////////////////////////////////////////////////////// +void Shape::SetPointColor(unsigned int Index, const Color& Col) +{ + myPoints[Index + 1].Col = Col; + myIsCompiled = false; +} + + +//////////////////////////////////////////////////////////// +/// Set the outline color of a point +//////////////////////////////////////////////////////////// +void Shape::SetPointOutlineColor(unsigned int Index, const Color& OutlineCol) +{ + myPoints[Index + 1].OutlineCol = OutlineCol; + myIsCompiled = false; +} + + +//////////////////////////////////////////////////////////// +/// Change the width of the shape outline +//////////////////////////////////////////////////////////// +void Shape::SetOutlineWidth(float Width) +{ + myOutline = Width; +} + + +//////////////////////////////////////////////////////////// +/// Get the position of a point +//////////////////////////////////////////////////////////// +const Vector2f& Shape::GetPointPosition(unsigned int Index) const +{ + return myPoints[Index + 1].Position; +} + + +//////////////////////////////////////////////////////////// +/// Get the color of a point +//////////////////////////////////////////////////////////// +const Color& Shape::GetPointColor(unsigned int Index) const +{ + return myPoints[Index + 1].Col; +} + + +//////////////////////////////////////////////////////////// +/// Get the outline color of a point +//////////////////////////////////////////////////////////// +const Color& Shape::GetPointOutlineColor(unsigned int Index) const +{ + return myPoints[Index + 1].OutlineCol; +} + + +//////////////////////////////////////////////////////////// +/// Get the width of the shape outline +//////////////////////////////////////////////////////////// +float Shape::GetOutlineWidth() const +{ + return myOutline; +} + + +//////////////////////////////////////////////////////////// +/// Create a shape made of a single line +//////////////////////////////////////////////////////////// +Shape Shape::Line(float P1X, float P1Y, float P2X, float P2Y, float Thickness, const Color& Col, float Outline, const Color& OutlineCol) +{ + Vector2f P1(P1X, P1Y); + Vector2f P2(P2X, P2Y); + + // Compute the extrusion direction + Vector2f Normal; + ComputeNormal(P1, P2, Normal); + Normal *= Thickness / 2; + + // Create the shape's points + Shape S; + S.AddPoint(P1 - Normal, Col, OutlineCol); + S.AddPoint(P2 - Normal, Col, OutlineCol); + S.AddPoint(P2 + Normal, Col, OutlineCol); + S.AddPoint(P1 + Normal, Col, OutlineCol); + S.SetOutlineWidth(Outline); + + // Compile it + S.Compile(); + + return S; +} + + +//////////////////////////////////////////////////////////// +/// Create a shape made of a single line (use vectors) +//////////////////////////////////////////////////////////// +Shape Shape::Line(const Vector2f& P1, const Vector2f& P2, float Thickness, const Color& Col, float Outline, const Color& OutlineCol) +{ + return Shape::Line(P1.x, P1.y, P2.x, P2.y, Thickness, Col, Outline, OutlineCol); +} + + +//////////////////////////////////////////////////////////// +/// Create a shape made of a single rectangle +//////////////////////////////////////////////////////////// +Shape Shape::Rectangle(float P1X, float P1Y, float P2X, float P2Y, const Color& Col, float Outline, const Color& OutlineCol) +{ + // Create the shape's points + Shape S; + S.AddPoint(Vector2f(P1X, P1Y), Col, OutlineCol); + S.AddPoint(Vector2f(P2X, P1Y), Col, OutlineCol); + S.AddPoint(Vector2f(P2X, P2Y), Col, OutlineCol); + S.AddPoint(Vector2f(P1X, P2Y), Col, OutlineCol); + S.SetOutlineWidth(Outline); + + // Compile it + S.Compile(); + + return S; +} + + +//////////////////////////////////////////////////////////// +/// Create a shape made of a single rectangle (use vectors) +//////////////////////////////////////////////////////////// +Shape Shape::Rectangle(const Vector2f& P1, const Vector2f& P2, const Color& Col, float Outline, const Color& OutlineCol) +{ + return Shape::Rectangle(P1.x, P1.y, P2.x, P2.y, Col, Outline, OutlineCol); +} + + +//////////////////////////////////////////////////////////// +/// Create a shape made of a single circle +//////////////////////////////////////////////////////////// +Shape Shape::Circle(float X, float Y, float Radius, const Color& Col, float Outline, const Color& OutlineCol) +{ + static const int NbSegments = 40; + + // Create the points set + Shape S; + Vector2f Center(X, Y); + for (int i = 0; i < NbSegments; ++i) + { + float Angle = i * 2 * 3.141592654f / NbSegments; + Vector2f Offset(cos(Angle), sin(Angle)); + + S.AddPoint(Center + Offset * Radius, Col, OutlineCol); + } + + // Compile it + S.SetOutlineWidth(Outline); + S.Compile(); + + return S; +} + + +//////////////////////////////////////////////////////////// +/// Create a shape made of a single circle (use vectors) +//////////////////////////////////////////////////////////// +Shape Shape::Circle(const Vector2f& Center, float Radius, const Color& Col, float Outline, const Color& OutlineCol) +{ + return Shape::Circle(Center.x, Center.y, Radius, Col, Outline, OutlineCol); +} + + +//////////////////////////////////////////////////////////// +/// /see Drawable::Render +//////////////////////////////////////////////////////////// +void Shape::Render(RenderTarget&) const +{ + // Make sure the shape has at least 3 points (4 if we count the center) + if (myPoints.size() < 4) + return; + + // Make sure the shape is compiled + if (!myIsCompiled) + const_cast(this)->Compile(); + + // Shapes only use color, no texture + GLCheck(glDisable(GL_TEXTURE_2D)); + + // Draw the shape + if (myIsFillEnabled) + { + glBegin(GL_TRIANGLE_FAN); + { + for (std::vector::const_iterator i = myPoints.begin(); i != myPoints.end(); ++i) + { + Color PointColor = i->Col * GetColor(); + glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glVertex2f(i->Position.x, i->Position.y); + } + + // Close the shape by duplicating the first point at the end + Color PointColor = myPoints[1].Col * GetColor(); + glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glVertex2f(myPoints[1].Position.x, myPoints[1].Position.y); + } + glEnd(); + } + + // Draw the outline + if (myIsOutlineEnabled) + { + glBegin(GL_TRIANGLE_STRIP); + { + for (std::size_t i = 1; i < myPoints.size(); ++i) + { + Color PointColor = myPoints[i].OutlineCol * GetColor(); + glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glVertex2f(myPoints[i].Position.x, myPoints[i].Position.y); + glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glVertex2f(myPoints[i].Position.x + myPoints[i].Normal.x * myOutline, myPoints[i].Position.y + myPoints[i].Normal.y * myOutline); + } + + // Close the shape by duplicating the first point at the end + Color PointColor = myPoints[1].OutlineCol * GetColor(); + glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glVertex2f(myPoints[1].Position.x, myPoints[1].Position.y); + glColor4f(PointColor.r / 255.f, PointColor.g / 255.f, PointColor.b / 255.f, PointColor.a / 255.f); + glVertex2f(myPoints[1].Position.x + myPoints[1].Normal.x * myOutline, myPoints[1].Position.y + myPoints[1].Normal.y * myOutline); + } + glEnd(); + } +} + + +//////////////////////////////////////////////////////////// +/// Compile the shape : compute its center and its outline +//////////////////////////////////////////////////////////// +void Shape::Compile() +{ + // Compute the center + float NbPoints = static_cast(myPoints.size() - 1); + float R = 0, G = 0, B = 0, A = 0; + Point Center(Vector2f(0, 0), Color(0, 0, 0, 0)); + for (std::size_t i = 1; i < myPoints.size(); ++i) + { + Center.Position += myPoints[i].Position / NbPoints; + R += myPoints[i].Col.r / NbPoints; + G += myPoints[i].Col.g / NbPoints; + B += myPoints[i].Col.b / NbPoints; + A += myPoints[i].Col.a / NbPoints; + } + Center.Col.r = static_cast(R); + Center.Col.g = static_cast(G); + Center.Col.b = static_cast(B); + Center.Col.a = static_cast(A); + myPoints[0] = Center; + + // Compute the outline + for (std::size_t i = 1; i < myPoints.size(); ++i) + { + // Get the two segments shared by the current point + Point& P0 = (i == 1) ? myPoints[myPoints.size() - 1] : myPoints[i - 1]; + Point& P1 = myPoints[i]; + Point& P2 = (i == myPoints.size() - 1) ? myPoints[1] : myPoints[i + 1]; + + // Compute their normal + Vector2f Normal1, Normal2; + if (!ComputeNormal(P0.Position, P1.Position, Normal1) || !ComputeNormal(P1.Position, P2.Position, Normal2)) + continue; + + // Add them to get the extrusion direction + float Factor = 1.f + (Normal1.x * Normal2.x + Normal1.y * Normal2.y); + P1.Normal = (Normal1 + Normal2) / Factor; + + // Make sure it points towards the outside of the shape + float Dot = (P1.Position.x - Center.Position.x) * P1.Normal.x + (P1.Position.y - Center.Position.y) * P1.Normal.y; + if (Dot < 0) + P1.Normal = -P1.Normal; + } + + myIsCompiled = true; +} + + +//////////////////////////////////////////////////////////// +/// Compute the normal of a given 2D segment +//////////////////////////////////////////////////////////// +bool Shape::ComputeNormal(const Vector2f& P1, const Vector2f& P2, Vector2f& Normal) +{ + Normal.x = P1.y - P2.y; + Normal.y = P2.x - P1.x; + + float Len = sqrt(Normal.x * Normal.x + Normal.y * Normal.y); + if (Len == 0.f) + return false; + + Normal.x /= Len; + Normal.y /= Len; + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor for Point +//////////////////////////////////////////////////////////// +Shape::Point::Point(const Vector2f& Pos, const Color& C, const Color& OutlineC) : +Position (Pos), +Normal (0.f, 0.f), +Col (C), +OutlineCol(OutlineC) +{ + +} + +} // namespace sf diff --git a/src/SFML/Graphics/Sprite.cpp b/src/SFML/Graphics/Sprite.cpp new file mode 100644 index 00000000..c1f65369 --- /dev/null +++ b/src/SFML/Graphics/Sprite.cpp @@ -0,0 +1,220 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Sprite::Sprite() : +mySubRect (0, 0, 1, 1), +myIsFlippedX(false), +myIsFlippedY(false) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the sprite from a source image +//////////////////////////////////////////////////////////// +Sprite::Sprite(const Image& Img, const Vector2f& Position, const Vector2f& Scale, float Rotation, const Color& Col) : +Drawable (Position, Scale, Rotation, Col), +myImage (&Img), +mySubRect (0, 0, Img.GetWidth(), Img.GetHeight()), +myIsFlippedX(false), +myIsFlippedY(false) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Set the image of the sprite +//////////////////////////////////////////////////////////// +void Sprite::SetImage(const Image& Img) +{ + // If there was no source image before, adjust the rectangle + if (!myImage) + SetSubRect(IntRect(0, 0, Img.GetWidth(), Img.GetHeight())); + + // Assign the new image + myImage = &Img; +} + + +//////////////////////////////////////////////////////////// +/// Set the sub-rectangle of the sprite inside the source image +//////////////////////////////////////////////////////////// +void Sprite::SetSubRect(const IntRect& SubRect) +{ + mySubRect = SubRect; +} + + +//////////////////////////////////////////////////////////// +/// Resize the sprite (by changing its scale factors) (take 2 values). +/// The default size is defined by the subrect +//////////////////////////////////////////////////////////// +void Sprite::Resize(float Width, float Height) +{ + if ((mySubRect.GetWidth() > 0) && (mySubRect.GetHeight() > 0)) + { + SetScale(Width / mySubRect.GetWidth(), Height / mySubRect.GetHeight()); + } +} + + +//////////////////////////////////////////////////////////// +/// Resize the object (by changing its scale factors) (take a 2D vector) +/// The default size is defined by the subrect +//////////////////////////////////////////////////////////// +void Sprite::Resize(const Vector2f& Size) +{ + Resize(Size.x, Size.y); +} + + +//////////////////////////////////////////////////////////// +/// Flip the sprite horizontally +//////////////////////////////////////////////////////////// +void Sprite::FlipX(bool Flipped) +{ + myIsFlippedX = Flipped; +} + + +//////////////////////////////////////////////////////////// +/// Flip the sprite vertically +//////////////////////////////////////////////////////////// +void Sprite::FlipY(bool Flipped) +{ + myIsFlippedY = Flipped; +} + + +//////////////////////////////////////////////////////////// +/// Get the source image of the sprite +//////////////////////////////////////////////////////////// +const Image* Sprite::GetImage() const +{ + return myImage; +} + + +//////////////////////////////////////////////////////////// +/// Get the sub-rectangle of the sprite inside the source image +//////////////////////////////////////////////////////////// +const IntRect& Sprite::GetSubRect() const +{ + return mySubRect; +} + + +//////////////////////////////////////////////////////////// +/// Get the sprite size +//////////////////////////////////////////////////////////// +Vector2f Sprite::GetSize() const +{ + return Vector2f(mySubRect.GetWidth() * GetScale().x, mySubRect.GetHeight() * GetScale().y); +} + + +//////////////////////////////////////////////////////////// +/// Get the color of a given pixel in the sprite +/// (point is in local coordinates) +//////////////////////////////////////////////////////////// +Color Sprite::GetPixel(unsigned int X, unsigned int Y) const +{ + if (myImage) + { + unsigned int ImageX = mySubRect.Left + X; + unsigned int ImageY = mySubRect.Top + Y; + + if (myIsFlippedX) ImageX = mySubRect.GetWidth() - ImageX; + if (myIsFlippedY) ImageY = mySubRect.GetHeight() - ImageY; + + return myImage->GetPixel(ImageX, ImageY) * GetColor(); + } + else + { + return GetColor(); + } +} + + +//////////////////////////////////////////////////////////// +/// /see sfDrawable::Render +//////////////////////////////////////////////////////////// +void Sprite::Render(RenderTarget&) const +{ + // Get the sprite size + float Width = static_cast(mySubRect.GetWidth()); + float Height = static_cast(mySubRect.GetHeight()); + + // Check if the image is valid + if (myImage) + { + // Set the texture + myImage->Bind(); + + // Calculate the texture coordinates + FloatRect TexCoords = myImage->GetTexCoords(mySubRect); + FloatRect Rect(myIsFlippedX ? TexCoords.Right : TexCoords.Left, + myIsFlippedY ? TexCoords.Bottom : TexCoords.Top, + myIsFlippedX ? TexCoords.Left : TexCoords.Right, + myIsFlippedY ? TexCoords.Top : TexCoords.Bottom); + + // Draw the sprite's triangles + glBegin(GL_QUADS); + glTexCoord2f(Rect.Left, Rect.Top); glVertex2f(0, 0); + glTexCoord2f(Rect.Left, Rect.Bottom); glVertex2f(0, Height); + glTexCoord2f(Rect.Right, Rect.Bottom); glVertex2f(Width, Height); + glTexCoord2f(Rect.Right, Rect.Top); glVertex2f(Width, 0) ; + glEnd(); + } + else + { + // Disable texturing + GLCheck(glDisable(GL_TEXTURE_2D)); + + // Draw the sprite's triangles + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(0, Height); + glVertex2f(Width, Height); + glVertex2f(Width, 0); + glEnd(); + } +} + +} // namespace sf diff --git a/src/SFML/Graphics/String.cpp b/src/SFML/Graphics/String.cpp new file mode 100644 index 00000000..bb20932d --- /dev/null +++ b/src/SFML/Graphics/String.cpp @@ -0,0 +1,412 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +String::String() : +myFont (&Font::GetDefaultFont()), +mySize (30.f), +myStyle (Regular), +myNeedRectUpdate(true) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the string from any kind of text +//////////////////////////////////////////////////////////// +String::String(const Unicode::Text& Text, const Font& CharFont, float Size) : +myFont (&CharFont), +mySize (Size), +myStyle (Regular), +myNeedRectUpdate(true) +{ + SetText(Text); +} + + +//////////////////////////////////////////////////////////// +/// Set the text (from any kind of string) +//////////////////////////////////////////////////////////// +void String::SetText(const Unicode::Text& Text) +{ + myNeedRectUpdate = true; + myText = Text; +} + + +//////////////////////////////////////////////////////////// +/// Set the font of the string +//////////////////////////////////////////////////////////// +void String::SetFont(const Font& CharFont) +{ + if (myFont != &CharFont) + { + myNeedRectUpdate = true; + myFont = &CharFont; + } +} + + +//////////////////////////////////////////////////////////// +/// Set the size of the string +//////////////////////////////////////////////////////////// +void String::SetSize(float Size) +{ + if (mySize != Size) + { + myNeedRectUpdate = true; + mySize = Size; + } +} + + +//////////////////////////////////////////////////////////// +/// Set the style of the text +/// The default style is Regular +//////////////////////////////////////////////////////////// +void String::SetStyle(unsigned long TextStyle) +{ + if (myStyle != TextStyle) + { + myNeedRectUpdate = true; + myStyle = TextStyle; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the text (the returned text can be converted implicitely to any kind of string) +//////////////////////////////////////////////////////////// +const Unicode::Text& String::GetText() const +{ + return myText; +} + + +//////////////////////////////////////////////////////////// +/// Get the font used by the string +//////////////////////////////////////////////////////////// +const Font& String::GetFont() const +{ + return *myFont; +} + + +//////////////////////////////////////////////////////////// +/// Get the size of the characters +//////////////////////////////////////////////////////////// +float String::GetSize() const +{ + return mySize; +} + + +//////////////////////////////////////////////////////////// +/// Get the style of the text +//////////////////////////////////////////////////////////// +unsigned long String::GetStyle() const +{ + return myStyle; +} + + +//////////////////////////////////////////////////////////// +/// Return the visual position of the Index-th character of the string, +/// in coordinates relative to the string +/// (note : translation, center, rotation and scale are not applied) +//////////////////////////////////////////////////////////// +sf::Vector2f String::GetCharacterPos(std::size_t Index) const +{ + // First get the UTF32 representation of the text + const Unicode::UTF32String& Text = myText; + + // Adjust the index if it's out of range + if (Index > Text.length()) + Index = Text.length(); + + // The final size is based on the text size + float FactorX = mySize / myFont->GetCharacterSize(); + float AdvanceY = mySize; + + // Compute the position + sf::Vector2f Position; + for (std::size_t i = 0; i < Index; ++i) + { + // Get the current character and its corresponding glyph + Uint32 CurChar = Text[i]; + const Glyph& CurGlyph = myFont->GetGlyph(CurChar); + float AdvanceX = CurGlyph.Advance * FactorX; + + switch (CurChar) + { + // Handle special characters + case L' ' : Position.x += AdvanceX; break; + case L'\t' : Position.x += AdvanceX * 4; break; + case L'\v' : Position.y += AdvanceY * 4; break; + case L'\n' : Position.y += AdvanceY; Position.x = 0; break; + + // Regular character : just add its advance value + default : Position.x += AdvanceX; break; + } + } + + return Position; +} + + +//////////////////////////////////////////////////////////// +/// Get the string rectangle on screen +//////////////////////////////////////////////////////////// +FloatRect String::GetRect() const +{ + if (myNeedRectUpdate) + const_cast(this)->RecomputeRect(); + + FloatRect Rect; + Rect.Left = (myBaseRect.Left - GetCenter().x) * GetScale().x + GetPosition().x; + Rect.Top = (myBaseRect.Top - GetCenter().y) * GetScale().y + GetPosition().y; + Rect.Right = (myBaseRect.Right - GetCenter().x) * GetScale().x + GetPosition().x; + Rect.Bottom = (myBaseRect.Bottom - GetCenter().y) * GetScale().y + GetPosition().y; + + return Rect; +} + + +//////////////////////////////////////////////////////////// +/// /see sfDrawable::Render +//////////////////////////////////////////////////////////// +void String::Render(RenderTarget&) const +{ + // First get the internal UTF-32 string of the text + const Unicode::UTF32String& Text = myText; + + // No text, no rendering :) + if (Text.empty()) + return; + + // Set the scaling factor to get the actual size + float CharSize = static_cast(myFont->GetCharacterSize()); + float Factor = mySize / CharSize; + GLCheck(glScalef(Factor, Factor, 1.f)); + + // Bind the font texture + myFont->GetImage().Bind(); + + // Initialize the rendering coordinates + float X = 0.f; + float Y = CharSize; + + // Holds the lines to draw later, for underlined style + std::vector UnderlineCoords; + UnderlineCoords.reserve(16); + + // Compute the shearing to apply if we're using the italic style + float ItalicCoeff = (myStyle & Italic) ? 0.208f : 0.f; // 12 degrees + + // Draw one quad for each character + glBegin(GL_QUADS); + for (std::size_t i = 0; i < Text.size(); ++i) + { + // Get the current character and its corresponding glyph + Uint32 CurChar = Text[i]; + const Glyph& CurGlyph = myFont->GetGlyph(CurChar); + int Advance = CurGlyph.Advance; + const IntRect& Rect = CurGlyph.Rectangle; + const FloatRect& Coord = CurGlyph.TexCoords; + + // If we're using the underlined style and there's a new line, + // we keep track of the previous line to draw it later + if ((CurChar == L'\n') && (myStyle & Underlined)) + { + UnderlineCoords.push_back(X); + UnderlineCoords.push_back(Y + 2); + } + + // Handle special characters + switch (CurChar) + { + case L' ' : X += Advance; continue; + case L'\n' : Y += CharSize; X = 0; continue; + case L'\t' : X += Advance * 4; continue; + case L'\v' : Y += CharSize * 4; continue; + } + + // Draw a textured quad for the current character + glTexCoord2f(Coord.Left, Coord.Top); glVertex2f(X + Rect.Left - ItalicCoeff * Rect.Top, Y + Rect.Top); + glTexCoord2f(Coord.Left, Coord.Bottom); glVertex2f(X + Rect.Left - ItalicCoeff * Rect.Bottom, Y + Rect.Bottom); + glTexCoord2f(Coord.Right, Coord.Bottom); glVertex2f(X + Rect.Right - ItalicCoeff * Rect.Bottom, Y + Rect.Bottom); + glTexCoord2f(Coord.Right, Coord.Top); glVertex2f(X + Rect.Right - ItalicCoeff * Rect.Top, Y + Rect.Top); + + // If we're using the bold style, we must render the character 4 more times, + // slightly offseted, to simulate a higher weight + if (myStyle & Bold) + { + static const float OffsetsX[] = {-0.5f, 0.5f, 0.f, 0.f}; + static const float OffsetsY[] = {0.f, 0.f, -0.5f, 0.5f}; + + for (int j = 0; j < 4; ++j) + { + glTexCoord2f(Coord.Left, Coord.Top); glVertex2f(X + OffsetsX[j] + Rect.Left - ItalicCoeff * Rect.Top, Y + OffsetsY[j] + Rect.Top); + glTexCoord2f(Coord.Left, Coord.Bottom); glVertex2f(X + OffsetsX[j] + Rect.Left - ItalicCoeff * Rect.Bottom, Y + OffsetsY[j] + Rect.Bottom); + glTexCoord2f(Coord.Right, Coord.Bottom); glVertex2f(X + OffsetsX[j] + Rect.Right - ItalicCoeff * Rect.Bottom, Y + OffsetsY[j] + Rect.Bottom); + glTexCoord2f(Coord.Right, Coord.Top); glVertex2f(X + OffsetsX[j] + Rect.Right - ItalicCoeff * Rect.Top, Y + OffsetsY[j] + Rect.Top); + } + } + + // Advance to the next character + X += Advance; + } + glEnd(); + + // Draw the underlines if needed + if (myStyle & Underlined) + { + // Compute the line thickness + float Thickness = (myStyle & Bold) ? 3.f : 2.f; + + // Add the last line (which was not finished with a \n) + UnderlineCoords.push_back(X); + UnderlineCoords.push_back(Y + 2); + + // Draw the underlines as quads + GLCheck(glDisable(GL_TEXTURE_2D)); + glBegin(GL_QUADS); + for (std::size_t i = 0; i < UnderlineCoords.size(); i += 2) + { + glVertex2f(0, UnderlineCoords[i + 1]); + glVertex2f(0, UnderlineCoords[i + 1] + Thickness); + glVertex2f(UnderlineCoords[i], UnderlineCoords[i + 1] + Thickness); + glVertex2f(UnderlineCoords[i], UnderlineCoords[i + 1]); + } + glEnd(); + } +} + + +//////////////////////////////////////////////////////////// +/// Recompute the bounding rectangle of the text +//////////////////////////////////////////////////////////// +void String::RecomputeRect() +{ + // First get the internal UTF-32 string of the text + const Unicode::UTF32String& Text = myText; + + // Reset the "need update" state + myNeedRectUpdate = false; + + // No text, empty box :) + if (Text.empty()) + { + myBaseRect = FloatRect(0, 0, 0, 0); + return; + } + + // Initial values + float CurWidth = 0; + float CurHeight = 0; + float Width = 0; + float Height = 0; + float Factor = mySize / myFont->GetCharacterSize(); + + // Go through each character + for (std::size_t i = 0; i < Text.size(); ++i) + { + // Get the current character and its corresponding glyph + Uint32 CurChar = Text[i]; + const Glyph& CurGlyph = myFont->GetGlyph(CurChar); + float Advance = CurGlyph.Advance * Factor; + const IntRect& Rect = CurGlyph.Rectangle; + + // Handle special characters + switch (CurChar) + { + case L' ' : CurWidth += Advance; continue; + case L'\t' : CurWidth += Advance * 4; continue; + case L'\v' : Height += mySize * 4; CurHeight = 0; continue; + + case L'\n' : + Height += mySize; + CurHeight = 0; + if (CurWidth > Width) + Width = CurWidth; + CurWidth = 0; + continue; + } + + // Advance to the next character + CurWidth += Advance; + + // Update the maximum height + float CharHeight = (myFont->GetCharacterSize() + Rect.Bottom) * Factor; + if (CharHeight > CurHeight) + CurHeight = CharHeight; + } + + // Update the last line + if (CurWidth > Width) + Width = CurWidth; + Height += CurHeight; + + // Add a slight width / height if we're using the bold style + if (myStyle & Bold) + { + Width += 1 * Factor; + Height += 1 * Factor; + } + + // Add a slight width if we're using the italic style + if (myStyle & Italic) + { + Width += 0.208f * mySize; + } + + // Add a slight height if we're using the underlined style + if (myStyle & Underlined) + { + if (CurHeight < mySize + 4 * Factor) + Height += 4 * Factor; + } + + // Finally update the rectangle + myBaseRect.Left = 0; + myBaseRect.Top = 0; + myBaseRect.Right = Width; + myBaseRect.Bottom = Height; +} + +} // namespace sf diff --git a/src/SFML/Graphics/View.cpp b/src/SFML/Graphics/View.cpp new file mode 100644 index 00000000..7801d220 --- /dev/null +++ b/src/SFML/Graphics/View.cpp @@ -0,0 +1,208 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Construct the view from a rectangle +//////////////////////////////////////////////////////////// +View::View(const FloatRect& ViewRect) +{ + SetFromRect(ViewRect); +} + + +//////////////////////////////////////////////////////////// +/// Construct the view from its center and half-size +//////////////////////////////////////////////////////////// +View::View(const sf::Vector2f& Center, const sf::Vector2f& HalfSize) : +myCenter (Center), +myHalfSize (HalfSize), +myNeedUpdate(true) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Change the center of the view (take 2 values) +//////////////////////////////////////////////////////////// +void View::SetCenter(float X, float Y) +{ + myCenter.x = X; + myCenter.y = Y; + myNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Change the center of the view (take a vector) +//////////////////////////////////////////////////////////// +void View::SetCenter(const sf::Vector2f& Center) +{ + SetCenter(Center.x, Center.y); +} + + +//////////////////////////////////////////////////////////// +/// Change the half-size of the view (take 2 values) +//////////////////////////////////////////////////////////// +void View::SetHalfSize(float HalfWidth, float HalfHeight) +{ + myHalfSize.x = HalfWidth; + myHalfSize.y = HalfHeight; + myNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Change the half-size of the view (take a vector) +//////////////////////////////////////////////////////////// +void View::SetHalfSize(const sf::Vector2f& HalfSize) +{ + SetHalfSize(HalfSize.x, HalfSize.y); +} + + +//////////////////////////////////////////////////////////// +/// Rebuild the view from a rectangle +//////////////////////////////////////////////////////////// +void View::SetFromRect(const FloatRect& ViewRect) +{ + SetCenter( (ViewRect.Right + ViewRect.Left) / 2, (ViewRect.Bottom + ViewRect.Top) / 2); + SetHalfSize((ViewRect.Right - ViewRect.Left) / 2, (ViewRect.Bottom - ViewRect.Top) / 2); +} + + +//////////////////////////////////////////////////////////// +/// Get the center of the view +//////////////////////////////////////////////////////////// +const sf::Vector2f& View::GetCenter() const +{ + return myCenter; +} + + +//////////////////////////////////////////////////////////// +/// Get the half-size of the view +//////////////////////////////////////////////////////////// +const sf::Vector2f& View::GetHalfSize() const +{ + return myHalfSize; +} + + +//////////////////////////////////////////////////////////// +/// Get the bounding rectangle of the view +//////////////////////////////////////////////////////////// +const sf::FloatRect& View::GetRect() const +{ + // Recompute it if needed + if (myNeedUpdate) + const_cast(this)->RecomputeMatrix(); + + return myRect; +} + + +//////////////////////////////////////////////////////////// +/// Move the view (take 2 values) +//////////////////////////////////////////////////////////// +void View::Move(float OffsetX, float OffsetY) +{ + myCenter.x += OffsetX; + myCenter.y += OffsetY; + myNeedUpdate = true; +} + + +//////////////////////////////////////////////////////////// +/// Move the view (take a vector) +//////////////////////////////////////////////////////////// +void View::Move(const sf::Vector2f& Offset) +{ + Move(Offset.x, Offset.y); +} + + +//////////////////////////////////////////////////////////// +/// Resize the view rectangle to simulate a zoom / unzoom effect +//////////////////////////////////////////////////////////// +void View::Zoom(float Factor) +{ + if (Factor != 0) + { + myHalfSize /= Factor; + myNeedUpdate = true; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the projection matrix of the view +//////////////////////////////////////////////////////////// +const Matrix3& View::GetMatrix() const +{ + // Recompute the matrix if needed + if (myNeedUpdate) + const_cast(this)->RecomputeMatrix(); + + return myMatrix; +} + + +//////////////////////////////////////////////////////////// +/// Recompute the view rectangle and the projection matrix +//////////////////////////////////////////////////////////// +void View::RecomputeMatrix() +{ + // Compute the 4 corners of the view + float Left = myCenter.x - myHalfSize.x; + float Top = myCenter.y - myHalfSize.y; + float Right = myCenter.x + myHalfSize.x; + float Bottom = myCenter.y + myHalfSize.y; + + // Update the view rectangle - be careful, reversed views are allowed ! + myRect.Left = std::min(Left, Right); + myRect.Top = std::min(Top, Bottom); + myRect.Right = std::max(Left, Right); + myRect.Bottom = std::max(Top, Bottom); + + // Update the projection matrix + myMatrix(0, 0) = 2.f / (Right - Left); + myMatrix(1, 1) = 2.f / (Top - Bottom); + myMatrix(0, 2) = (Left + Right) / (Left - Right); + myMatrix(1, 2) = (Bottom + Top) / (Bottom - Top); + + myNeedUpdate = false; +} + +} // namespace sf diff --git a/src/SFML/Graphics/libjpeg/cderror.h b/src/SFML/Graphics/libjpeg/cderror.h new file mode 100644 index 00000000..c19d38fb --- /dev/null +++ b/src/SFML/Graphics/libjpeg/cderror.h @@ -0,0 +1,132 @@ +/* + * cderror.h + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the error and message codes for the cjpeg/djpeg + * applications. These strings are not needed as part of the JPEG library + * proper. + * Edit this file to add new codes, or to translate the message strings to + * some other language. + */ + +/* + * To define the enum list of message codes, include this file without + * defining macro JMESSAGE. To create a message string table, include it + * again with a suitable JMESSAGE definition (see jerror.c for an example). + */ +#ifndef JMESSAGE +#ifndef CDERROR_H +#define CDERROR_H +/* First time through, define the enum list */ +#define JMAKE_ENUM_LIST +#else +/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ +#define JMESSAGE(code,string) +#endif /* CDERROR_H */ +#endif /* JMESSAGE */ + +#ifdef JMAKE_ENUM_LIST + +typedef enum { + +#define JMESSAGE(code,string) code , + +#endif /* JMAKE_ENUM_LIST */ + +JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */ + +#ifdef BMP_SUPPORTED +JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") +JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported") +JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") +JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") +JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") +JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") +JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") +JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image") +JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") +JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image") +JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") +#endif /* BMP_SUPPORTED */ + +#ifdef GIF_SUPPORTED +JMESSAGE(JERR_GIF_BUG, "GIF output got confused") +JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") +JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") +JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") +JMESSAGE(JERR_GIF_NOT, "Not a GIF file") +JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") +JMESSAGE(JTRC_GIF_BADVERSION, + "Warning: unexpected GIF version number '%c%c%c'") +JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") +JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") +JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") +JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") +JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") +JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") +#endif /* GIF_SUPPORTED */ + +#ifdef PPM_SUPPORTED +JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") +JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") +JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") +JMESSAGE(JTRC_PGM, "%ux%u PGM image") +JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") +JMESSAGE(JTRC_PPM, "%ux%u PPM image") +JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") +#endif /* PPM_SUPPORTED */ + +#ifdef RLE_SUPPORTED +JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library") +JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB") +JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE") +JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file") +JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header") +JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header") +JMESSAGE(JERR_RLE_NOT, "Not an RLE file") +JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") +JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") +JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file") +JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") +JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file") +JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d") +JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d") +#endif /* RLE_SUPPORTED */ + +#ifdef TARGA_SUPPORTED +JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") +JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") +JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") +JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") +JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") +JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") +#else +JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") +#endif /* TARGA_SUPPORTED */ + +JMESSAGE(JERR_BAD_CMAP_FILE, + "Color map file is invalid or of unsupported format") +JMESSAGE(JERR_TOO_MANY_COLORS, + "Output file format cannot handle %d colormap entries") +JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") +#ifdef TARGA_SUPPORTED +JMESSAGE(JERR_UNKNOWN_FORMAT, + "Unrecognized input file format --- perhaps you need -targa") +#else +JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") +#endif +JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") + +#ifdef JMAKE_ENUM_LIST + + JMSG_LASTADDONCODE +} ADDON_MESSAGE_CODE; + +#undef JMAKE_ENUM_LIST +#endif /* JMAKE_ENUM_LIST */ + +/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ +#undef JMESSAGE diff --git a/src/SFML/Graphics/libjpeg/jcapimin.c b/src/SFML/Graphics/libjpeg/jcapimin.c new file mode 100644 index 00000000..493af5c3 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcapimin.c @@ -0,0 +1,280 @@ +/* + * jcapimin.c + * + * Copyright (C) 1994-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains application interface code for the compression half + * of the JPEG library. These are the "minimum" API routines that may be + * needed in either the normal full-compression case or the transcoding-only + * case. + * + * Most of the routines intended to be called directly by an application + * are in this file or in jcapistd.c. But also see jcparam.c for + * parameter-setup helper routines, jcomapi.c for routines shared by + * compression and decompression, and jctrans.c for the transcoding case. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * Initialization of a JPEG compression object. + * The error manager must already be set up (in case memory manager fails). + */ + +GLOBAL(void) +jpeg_CreateCompress (j_compress_ptr cinfo, int version, size_t structsize) +{ + int i; + + /* Guard against version mismatches between library and caller. */ + cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ + if (version != JPEG_LIB_VERSION) + ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); + if (structsize != SIZEOF(struct jpeg_compress_struct)) + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + (int) SIZEOF(struct jpeg_compress_struct), (int) structsize); + + /* For debugging purposes, we zero the whole master structure. + * But the application has already set the err pointer, and may have set + * client_data, so we have to save and restore those fields. + * Note: if application hasn't set client_data, tools like Purify may + * complain here. + */ + { + struct jpeg_error_mgr * err = cinfo->err; + void * client_data = cinfo->client_data; /* ignore Purify complaint here */ + MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct)); + cinfo->err = err; + cinfo->client_data = client_data; + } + cinfo->is_decompressor = FALSE; + + /* Initialize a memory manager instance for this object */ + jinit_memory_mgr((j_common_ptr) cinfo); + + /* Zero out pointers to permanent structures. */ + cinfo->progress = NULL; + cinfo->dest = NULL; + + cinfo->comp_info = NULL; + + for (i = 0; i < NUM_QUANT_TBLS; i++) + cinfo->quant_tbl_ptrs[i] = NULL; + + for (i = 0; i < NUM_HUFF_TBLS; i++) { + cinfo->dc_huff_tbl_ptrs[i] = NULL; + cinfo->ac_huff_tbl_ptrs[i] = NULL; + } + + cinfo->script_space = NULL; + + cinfo->input_gamma = 1.0; /* in case application forgets */ + + /* OK, I'm ready */ + cinfo->global_state = CSTATE_START; +} + + +/* + * Destruction of a JPEG compression object + */ + +GLOBAL(void) +jpeg_destroy_compress (j_compress_ptr cinfo) +{ + jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ +} + + +/* + * Abort processing of a JPEG compression operation, + * but don't destroy the object itself. + */ + +GLOBAL(void) +jpeg_abort_compress (j_compress_ptr cinfo) +{ + jpeg_abort((j_common_ptr) cinfo); /* use common routine */ +} + + +/* + * Forcibly suppress or un-suppress all quantization and Huffman tables. + * Marks all currently defined tables as already written (if suppress) + * or not written (if !suppress). This will control whether they get emitted + * by a subsequent jpeg_start_compress call. + * + * This routine is exported for use by applications that want to produce + * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but + * since it is called by jpeg_start_compress, we put it here --- otherwise + * jcparam.o would be linked whether the application used it or not. + */ + +GLOBAL(void) +jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress) +{ + int i; + JQUANT_TBL * qtbl; + JHUFF_TBL * htbl; + + for (i = 0; i < NUM_QUANT_TBLS; i++) { + if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL) + qtbl->sent_table = suppress; + } + + for (i = 0; i < NUM_HUFF_TBLS; i++) { + if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL) + htbl->sent_table = suppress; + if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL) + htbl->sent_table = suppress; + } +} + + +/* + * Finish JPEG compression. + * + * If a multipass operating mode was selected, this may do a great deal of + * work including most of the actual output. + */ + +GLOBAL(void) +jpeg_finish_compress (j_compress_ptr cinfo) +{ + JDIMENSION iMCU_row; + + if (cinfo->global_state == CSTATE_SCANNING || + cinfo->global_state == CSTATE_RAW_OK) { + /* Terminate first pass */ + if (cinfo->next_scanline < cinfo->image_height) + ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); + (*cinfo->master->finish_pass) (cinfo); + } else if (cinfo->global_state != CSTATE_WRCOEFS) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + /* Perform any remaining passes */ + while (! cinfo->master->is_last_pass) { + (*cinfo->master->prepare_for_pass) (cinfo); + for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) { + if (cinfo->progress != NULL) { + cinfo->progress->pass_counter = (long) iMCU_row; + cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + } + /* We bypass the main controller and invoke coef controller directly; + * all work is being done from the coefficient buffer. + */ + if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL)) + ERREXIT(cinfo, JERR_CANT_SUSPEND); + } + (*cinfo->master->finish_pass) (cinfo); + } + /* Write EOI, do final cleanup */ + (*cinfo->marker->write_file_trailer) (cinfo); + (*cinfo->dest->term_destination) (cinfo); + /* We can use jpeg_abort to release memory and reset global_state */ + jpeg_abort((j_common_ptr) cinfo); +} + + +/* + * Write a special marker. + * This is only recommended for writing COM or APPn markers. + * Must be called after jpeg_start_compress() and before + * first call to jpeg_write_scanlines() or jpeg_write_raw_data(). + */ + +GLOBAL(void) +jpeg_write_marker (j_compress_ptr cinfo, int marker, + const JOCTET *dataptr, unsigned int datalen) +{ + JMETHOD(void, write_marker_byte, (j_compress_ptr info, int val)); + + if (cinfo->next_scanline != 0 || + (cinfo->global_state != CSTATE_SCANNING && + cinfo->global_state != CSTATE_RAW_OK && + cinfo->global_state != CSTATE_WRCOEFS)) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); + write_marker_byte = cinfo->marker->write_marker_byte; /* copy for speed */ + while (datalen--) { + (*write_marker_byte) (cinfo, *dataptr); + dataptr++; + } +} + +/* Same, but piecemeal. */ + +GLOBAL(void) +jpeg_write_m_header (j_compress_ptr cinfo, int marker, unsigned int datalen) +{ + if (cinfo->next_scanline != 0 || + (cinfo->global_state != CSTATE_SCANNING && + cinfo->global_state != CSTATE_RAW_OK && + cinfo->global_state != CSTATE_WRCOEFS)) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + (*cinfo->marker->write_marker_header) (cinfo, marker, datalen); +} + +GLOBAL(void) +jpeg_write_m_byte (j_compress_ptr cinfo, int val) +{ + (*cinfo->marker->write_marker_byte) (cinfo, val); +} + + +/* + * Alternate compression function: just write an abbreviated table file. + * Before calling this, all parameters and a data destination must be set up. + * + * To produce a pair of files containing abbreviated tables and abbreviated + * image data, one would proceed as follows: + * + * initialize JPEG object + * set JPEG parameters + * set destination to table file + * jpeg_write_tables(cinfo); + * set destination to image file + * jpeg_start_compress(cinfo, FALSE); + * write data... + * jpeg_finish_compress(cinfo); + * + * jpeg_write_tables has the side effect of marking all tables written + * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress + * will not re-emit the tables unless it is passed write_all_tables=TRUE. + */ + +GLOBAL(void) +jpeg_write_tables (j_compress_ptr cinfo) +{ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + /* (Re)initialize error mgr and destination modules */ + (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); + (*cinfo->dest->init_destination) (cinfo); + /* Initialize the marker writer ... bit of a crock to do it here. */ + jinit_marker_writer(cinfo); + /* Write them tables! */ + (*cinfo->marker->write_tables_only) (cinfo); + /* And clean up. */ + (*cinfo->dest->term_destination) (cinfo); + /* + * In library releases up through v6a, we called jpeg_abort() here to free + * any working memory allocated by the destination manager and marker + * writer. Some applications had a problem with that: they allocated space + * of their own from the library memory manager, and didn't want it to go + * away during write_tables. So now we do nothing. This will cause a + * memory leak if an app calls write_tables repeatedly without doing a full + * compression cycle or otherwise resetting the JPEG object. However, that + * seems less bad than unexpectedly freeing memory in the normal case. + * An app that prefers the old behavior can call jpeg_abort for itself after + * each call to jpeg_write_tables(). + */ +} diff --git a/src/SFML/Graphics/libjpeg/jcapistd.c b/src/SFML/Graphics/libjpeg/jcapistd.c new file mode 100644 index 00000000..fed66caf --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcapistd.c @@ -0,0 +1,161 @@ +/* + * jcapistd.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains application interface code for the compression half + * of the JPEG library. These are the "standard" API routines that are + * used in the normal full-compression case. They are not used by a + * transcoding-only application. Note that if an application links in + * jpeg_start_compress, it will end up linking in the entire compressor. + * We thus must separate this file from jcapimin.c to avoid linking the + * whole compression library into a transcoder. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * Compression initialization. + * Before calling this, all parameters and a data destination must be set up. + * + * We require a write_all_tables parameter as a failsafe check when writing + * multiple datastreams from the same compression object. Since prior runs + * will have left all the tables marked sent_table=TRUE, a subsequent run + * would emit an abbreviated stream (no tables) by default. This may be what + * is wanted, but for safety's sake it should not be the default behavior: + * programmers should have to make a deliberate choice to emit abbreviated + * images. Therefore the documentation and examples should encourage people + * to pass write_all_tables=TRUE; then it will take active thought to do the + * wrong thing. + */ + +GLOBAL(void) +jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables) +{ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + if (write_all_tables) + jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */ + + /* (Re)initialize error mgr and destination modules */ + (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); + (*cinfo->dest->init_destination) (cinfo); + /* Perform master selection of active modules */ + jinit_compress_master(cinfo); + /* Set up for the first pass */ + (*cinfo->master->prepare_for_pass) (cinfo); + /* Ready for application to drive first pass through jpeg_write_scanlines + * or jpeg_write_raw_data. + */ + cinfo->next_scanline = 0; + cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING); +} + + +/* + * Write some scanlines of data to the JPEG compressor. + * + * The return value will be the number of lines actually written. + * This should be less than the supplied num_lines only in case that + * the data destination module has requested suspension of the compressor, + * or if more than image_height scanlines are passed in. + * + * Note: we warn about excess calls to jpeg_write_scanlines() since + * this likely signals an application programmer error. However, + * excess scanlines passed in the last valid call are *silently* ignored, + * so that the application need not adjust num_lines for end-of-image + * when using a multiple-scanline buffer. + */ + +GLOBAL(JDIMENSION) +jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines, + JDIMENSION num_lines) +{ + JDIMENSION row_ctr, rows_left; + + if (cinfo->global_state != CSTATE_SCANNING) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + if (cinfo->next_scanline >= cinfo->image_height) + WARNMS(cinfo, JWRN_TOO_MUCH_DATA); + + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) { + cinfo->progress->pass_counter = (long) cinfo->next_scanline; + cinfo->progress->pass_limit = (long) cinfo->image_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + } + + /* Give master control module another chance if this is first call to + * jpeg_write_scanlines. This lets output of the frame/scan headers be + * delayed so that application can write COM, etc, markers between + * jpeg_start_compress and jpeg_write_scanlines. + */ + if (cinfo->master->call_pass_startup) + (*cinfo->master->pass_startup) (cinfo); + + /* Ignore any extra scanlines at bottom of image. */ + rows_left = cinfo->image_height - cinfo->next_scanline; + if (num_lines > rows_left) + num_lines = rows_left; + + row_ctr = 0; + (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines); + cinfo->next_scanline += row_ctr; + return row_ctr; +} + + +/* + * Alternate entry point to write raw data. + * Processes exactly one iMCU row per call, unless suspended. + */ + +GLOBAL(JDIMENSION) +jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION num_lines) +{ + JDIMENSION lines_per_iMCU_row; + + if (cinfo->global_state != CSTATE_RAW_OK) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + if (cinfo->next_scanline >= cinfo->image_height) { + WARNMS(cinfo, JWRN_TOO_MUCH_DATA); + return 0; + } + + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) { + cinfo->progress->pass_counter = (long) cinfo->next_scanline; + cinfo->progress->pass_limit = (long) cinfo->image_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + } + + /* Give master control module another chance if this is first call to + * jpeg_write_raw_data. This lets output of the frame/scan headers be + * delayed so that application can write COM, etc, markers between + * jpeg_start_compress and jpeg_write_raw_data. + */ + if (cinfo->master->call_pass_startup) + (*cinfo->master->pass_startup) (cinfo); + + /* Verify that at least one iMCU row has been passed. */ + lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE; + if (num_lines < lines_per_iMCU_row) + ERREXIT(cinfo, JERR_BUFFER_SIZE); + + /* Directly compress the row. */ + if (! (*cinfo->coef->compress_data) (cinfo, data)) { + /* If compressor did not consume the whole row, suspend processing. */ + return 0; + } + + /* OK, we processed one iMCU row. */ + cinfo->next_scanline += lines_per_iMCU_row; + return lines_per_iMCU_row; +} diff --git a/src/SFML/Graphics/libjpeg/jccoefct.c b/src/SFML/Graphics/libjpeg/jccoefct.c new file mode 100644 index 00000000..c713b858 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jccoefct.c @@ -0,0 +1,449 @@ +/* + * jccoefct.c + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the coefficient buffer controller for compression. + * This controller is the top level of the JPEG compressor proper. + * The coefficient buffer lies between forward-DCT and entropy encoding steps. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* We use a full-image coefficient buffer when doing Huffman optimization, + * and also for writing multiple-scan JPEG files. In all cases, the DCT + * step is run during the first pass, and subsequent passes need only read + * the buffered coefficients. + */ +#ifdef ENTROPY_OPT_SUPPORTED +#define FULL_COEF_BUFFER_SUPPORTED +#else +#ifdef C_MULTISCAN_FILES_SUPPORTED +#define FULL_COEF_BUFFER_SUPPORTED +#endif +#endif + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_c_coef_controller pub; /* public fields */ + + JDIMENSION iMCU_row_num; /* iMCU row # within image */ + JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ + + /* For single-pass compression, it's sufficient to buffer just one MCU + * (although this may prove a bit slow in practice). We allocate a + * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each + * MCU constructed and sent. (On 80x86, the workspace is FAR even though + * it's not really very big; this is to keep the module interfaces unchanged + * when a large coefficient buffer is necessary.) + * In multi-pass modes, this array points to the current MCU's blocks + * within the virtual arrays. + */ + JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]; + + /* In multi-pass modes, we need a virtual block array for each component. */ + jvirt_barray_ptr whole_image[MAX_COMPONENTS]; +} my_coef_controller; + +typedef my_coef_controller * my_coef_ptr; + + +/* Forward declarations */ +METHODDEF(boolean) compress_data + JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); +#ifdef FULL_COEF_BUFFER_SUPPORTED +METHODDEF(boolean) compress_first_pass + JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); +METHODDEF(boolean) compress_output + JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); +#endif + + +LOCAL(void) +start_iMCU_row (j_compress_ptr cinfo) +/* Reset within-iMCU-row counters for a new row */ +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + + /* In an interleaved scan, an MCU row is the same as an iMCU row. + * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. + * But at the bottom of the image, process only what's left. + */ + if (cinfo->comps_in_scan > 1) { + coef->MCU_rows_per_iMCU_row = 1; + } else { + if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; + else + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; + } + + coef->mcu_ctr = 0; + coef->MCU_vert_offset = 0; +} + + +/* + * Initialize for a processing pass. + */ + +METHODDEF(void) +start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + + coef->iMCU_row_num = 0; + start_iMCU_row(cinfo); + + switch (pass_mode) { + case JBUF_PASS_THRU: + if (coef->whole_image[0] != NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + coef->pub.compress_data = compress_data; + break; +#ifdef FULL_COEF_BUFFER_SUPPORTED + case JBUF_SAVE_AND_PASS: + if (coef->whole_image[0] == NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + coef->pub.compress_data = compress_first_pass; + break; + case JBUF_CRANK_DEST: + if (coef->whole_image[0] == NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + coef->pub.compress_data = compress_output; + break; +#endif + default: + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + break; + } +} + + +/* + * Process some data in the single-pass case. + * We process the equivalent of one fully interleaved MCU row ("iMCU" row) + * per call, ie, v_samp_factor block rows for each component in the image. + * Returns TRUE if the iMCU row is completed, FALSE if suspended. + * + * NB: input_buf contains a plane for each component in image, + * which we index according to the component's SOF position. + */ + +METHODDEF(boolean) +compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; + JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; + int blkn, bi, ci, yindex, yoffset, blockcnt; + JDIMENSION ypos, xpos; + jpeg_component_info *compptr; + + /* Loop to write as much as one whole iMCU row */ + for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; + yoffset++) { + for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col; + MCU_col_num++) { + /* Determine where data comes from in input_buf and do the DCT thing. + * Each call on forward_DCT processes a horizontal row of DCT blocks + * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks + * sequentially. Dummy blocks at the right or bottom edge are filled in + * specially. The data in them does not matter for image reconstruction, + * so we fill them with values that will encode to the smallest amount of + * data, viz: all zeroes in the AC entries, DC entries equal to previous + * block's DC value. (Thanks to Thomas Kinsman for this idea.) + */ + blkn = 0; + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width + : compptr->last_col_width; + xpos = MCU_col_num * compptr->MCU_sample_width; + ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + if (coef->iMCU_row_num < last_iMCU_row || + yoffset+yindex < compptr->last_row_height) { + (*cinfo->fdct->forward_DCT) (cinfo, compptr, + input_buf[compptr->component_index], + coef->MCU_buffer[blkn], + ypos, xpos, (JDIMENSION) blockcnt); + if (blockcnt < compptr->MCU_width) { + /* Create some dummy blocks at the right edge of the image. */ + jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], + (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); + for (bi = blockcnt; bi < compptr->MCU_width; bi++) { + coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; + } + } + } else { + /* Create a row of dummy blocks at the bottom of the image. */ + jzero_far((void FAR *) coef->MCU_buffer[blkn], + compptr->MCU_width * SIZEOF(JBLOCK)); + for (bi = 0; bi < compptr->MCU_width; bi++) { + coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; + } + } + blkn += compptr->MCU_width; + ypos += DCTSIZE; + } + } + /* Try to write the MCU. In event of a suspension failure, we will + * re-DCT the MCU on restart (a bit inefficient, could be fixed...) + */ + if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->mcu_ctr = MCU_col_num; + return FALSE; + } + } + /* Completed an MCU row, but perhaps not an iMCU row */ + coef->mcu_ctr = 0; + } + /* Completed the iMCU row, advance counters for next one */ + coef->iMCU_row_num++; + start_iMCU_row(cinfo); + return TRUE; +} + + +#ifdef FULL_COEF_BUFFER_SUPPORTED + +/* + * Process some data in the first pass of a multi-pass case. + * We process the equivalent of one fully interleaved MCU row ("iMCU" row) + * per call, ie, v_samp_factor block rows for each component in the image. + * This amount of data is read from the source buffer, DCT'd and quantized, + * and saved into the virtual arrays. We also generate suitable dummy blocks + * as needed at the right and lower edges. (The dummy blocks are constructed + * in the virtual arrays, which have been padded appropriately.) This makes + * it possible for subsequent passes not to worry about real vs. dummy blocks. + * + * We must also emit the data to the entropy encoder. This is conveniently + * done by calling compress_output() after we've loaded the current strip + * of the virtual arrays. + * + * NB: input_buf contains a plane for each component in image. All + * components are DCT'd and loaded into the virtual arrays in this pass. + * However, it may be that only a subset of the components are emitted to + * the entropy encoder during this first pass; be careful about looking + * at the scan-dependent variables (MCU dimensions, etc). + */ + +METHODDEF(boolean) +compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; + JDIMENSION blocks_across, MCUs_across, MCUindex; + int bi, ci, h_samp_factor, block_row, block_rows, ndummy; + JCOEF lastDC; + jpeg_component_info *compptr; + JBLOCKARRAY buffer; + JBLOCKROW thisblockrow, lastblockrow; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Align the virtual buffer for this component. */ + buffer = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[ci], + coef->iMCU_row_num * compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, TRUE); + /* Count non-dummy DCT block rows in this iMCU row. */ + if (coef->iMCU_row_num < last_iMCU_row) + block_rows = compptr->v_samp_factor; + else { + /* NB: can't use last_row_height here, since may not be set! */ + block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); + if (block_rows == 0) block_rows = compptr->v_samp_factor; + } + blocks_across = compptr->width_in_blocks; + h_samp_factor = compptr->h_samp_factor; + /* Count number of dummy blocks to be added at the right margin. */ + ndummy = (int) (blocks_across % h_samp_factor); + if (ndummy > 0) + ndummy = h_samp_factor - ndummy; + /* Perform DCT for all non-dummy blocks in this iMCU row. Each call + * on forward_DCT processes a complete horizontal row of DCT blocks. + */ + for (block_row = 0; block_row < block_rows; block_row++) { + thisblockrow = buffer[block_row]; + (*cinfo->fdct->forward_DCT) (cinfo, compptr, + input_buf[ci], thisblockrow, + (JDIMENSION) (block_row * DCTSIZE), + (JDIMENSION) 0, blocks_across); + if (ndummy > 0) { + /* Create dummy blocks at the right edge of the image. */ + thisblockrow += blocks_across; /* => first dummy block */ + jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); + lastDC = thisblockrow[-1][0]; + for (bi = 0; bi < ndummy; bi++) { + thisblockrow[bi][0] = lastDC; + } + } + } + /* If at end of image, create dummy block rows as needed. + * The tricky part here is that within each MCU, we want the DC values + * of the dummy blocks to match the last real block's DC value. + * This squeezes a few more bytes out of the resulting file... + */ + if (coef->iMCU_row_num == last_iMCU_row) { + blocks_across += ndummy; /* include lower right corner */ + MCUs_across = blocks_across / h_samp_factor; + for (block_row = block_rows; block_row < compptr->v_samp_factor; + block_row++) { + thisblockrow = buffer[block_row]; + lastblockrow = buffer[block_row-1]; + jzero_far((void FAR *) thisblockrow, + (size_t) (blocks_across * SIZEOF(JBLOCK))); + for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { + lastDC = lastblockrow[h_samp_factor-1][0]; + for (bi = 0; bi < h_samp_factor; bi++) { + thisblockrow[bi][0] = lastDC; + } + thisblockrow += h_samp_factor; /* advance to next MCU in row */ + lastblockrow += h_samp_factor; + } + } + } + } + /* NB: compress_output will increment iMCU_row_num if successful. + * A suspension return will result in redoing all the work above next time. + */ + + /* Emit data to the entropy encoder, sharing code with subsequent passes */ + return compress_output(cinfo, input_buf); +} + + +/* + * Process some data in subsequent passes of a multi-pass case. + * We process the equivalent of one fully interleaved MCU row ("iMCU" row) + * per call, ie, v_samp_factor block rows for each component in the scan. + * The data is obtained from the virtual arrays and fed to the entropy coder. + * Returns TRUE if the iMCU row is completed, FALSE if suspended. + * + * NB: input_buf is ignored; it is likely to be a NULL pointer. + */ + +METHODDEF(boolean) +compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION MCU_col_num; /* index of current MCU within row */ + int blkn, ci, xindex, yindex, yoffset; + JDIMENSION start_col; + JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; + JBLOCKROW buffer_ptr; + jpeg_component_info *compptr; + + /* Align the virtual buffers for the components used in this scan. + * NB: during first pass, this is safe only because the buffers will + * already be aligned properly, so jmemmgr.c won't need to do any I/O. + */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + buffer[ci] = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], + coef->iMCU_row_num * compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); + } + + /* Loop to process one whole iMCU row */ + for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; + yoffset++) { + for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; + MCU_col_num++) { + /* Construct list of pointers to DCT blocks belonging to this MCU */ + blkn = 0; /* index of current DCT block within MCU */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + start_col = MCU_col_num * compptr->MCU_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + for (xindex = 0; xindex < compptr->MCU_width; xindex++) { + coef->MCU_buffer[blkn++] = buffer_ptr++; + } + } + } + /* Try to write the MCU. */ + if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->mcu_ctr = MCU_col_num; + return FALSE; + } + } + /* Completed an MCU row, but perhaps not an iMCU row */ + coef->mcu_ctr = 0; + } + /* Completed the iMCU row, advance counters for next one */ + coef->iMCU_row_num++; + start_iMCU_row(cinfo); + return TRUE; +} + +#endif /* FULL_COEF_BUFFER_SUPPORTED */ + + +/* + * Initialize coefficient buffer controller. + */ + +GLOBAL(void) +jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) +{ + my_coef_ptr coef; + + coef = (my_coef_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_coef_controller)); + cinfo->coef = (struct jpeg_c_coef_controller *) coef; + coef->pub.start_pass = start_pass_coef; + + /* Create the coefficient buffer. */ + if (need_full_buffer) { +#ifdef FULL_COEF_BUFFER_SUPPORTED + /* Allocate a full-image virtual array for each component, */ + /* padded to a multiple of samp_factor DCT blocks in each direction. */ + int ci; + jpeg_component_info *compptr; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (long) compptr->h_samp_factor), + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor), + (JDIMENSION) compptr->v_samp_factor); + } +#else + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); +#endif + } else { + /* We only need a single-MCU buffer. */ + JBLOCKROW buffer; + int i; + + buffer = (JBLOCKROW) + (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { + coef->MCU_buffer[i] = buffer + i; + } + coef->whole_image[0] = NULL; /* flag for no virtual arrays */ + } +} diff --git a/src/SFML/Graphics/libjpeg/jccolor.c b/src/SFML/Graphics/libjpeg/jccolor.c new file mode 100644 index 00000000..26637245 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jccolor.c @@ -0,0 +1,459 @@ +/* + * jccolor.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains input colorspace conversion routines. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Private subobject */ + +typedef struct { + struct jpeg_color_converter pub; /* public fields */ + + /* Private state for RGB->YCC conversion */ + INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ +} my_color_converter; + +typedef my_color_converter * my_cconvert_ptr; + + +/**************** RGB -> YCbCr conversion: most common case **************/ + +/* + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + * The conversion equations to be implemented are therefore + * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B + * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE + * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE + * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) + * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2, + * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and + * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0) + * were not represented exactly. Now we sacrifice exact representation of + * maximum red and maximum blue in order to get exact grayscales. + * + * To avoid floating-point arithmetic, we represent the fractional constants + * as integers scaled up by 2^16 (about 4 digits precision); we have to divide + * the products by 2^16, with appropriate rounding, to get the correct answer. + * + * For even more speed, we avoid doing any multiplications in the inner loop + * by precalculating the constants times R,G,B for all possible values. + * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); + * for 12-bit samples it is still acceptable. It's not very reasonable for + * 16-bit samples, but if you want lossless storage you shouldn't be changing + * colorspace anyway. + * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included + * in the tables to save adding them separately in the inner loop. + */ + +#define SCALEBITS 16 /* speediest right-shift on some machines */ +#define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS) +#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) +#define FIX(x) ((INT32) ((x) * (1L< Y section */ +#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ +#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ +#define R_CB_OFF (3*(MAXJSAMPLE+1)) +#define G_CB_OFF (4*(MAXJSAMPLE+1)) +#define B_CB_OFF (5*(MAXJSAMPLE+1)) +#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */ +#define G_CR_OFF (6*(MAXJSAMPLE+1)) +#define B_CR_OFF (7*(MAXJSAMPLE+1)) +#define TABLE_SIZE (8*(MAXJSAMPLE+1)) + + +/* + * Initialize for RGB->YCC colorspace conversion. + */ + +METHODDEF(void) +rgb_ycc_start (j_compress_ptr cinfo) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + INT32 * rgb_ycc_tab; + INT32 i; + + /* Allocate and fill in the conversion tables. */ + cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (TABLE_SIZE * SIZEOF(INT32))); + + for (i = 0; i <= MAXJSAMPLE; i++) { + rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; + rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i; + rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF; + rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i; + rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i; + /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr. + * This ensures that the maximum output will round to MAXJSAMPLE + * not MAXJSAMPLE+1, and thus that we don't have to range-limit. + */ + rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; +/* B=>Cb and R=>Cr tables are the same + rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1; +*/ + rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i; + rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i; + } +} + + +/* + * Convert some rows of samples to the JPEG colorspace. + * + * Note that we change from the application's interleaved-pixel format + * to our internal noninterleaved, one-plane-per-component format. + * The input buffer is therefore three times as wide as the output buffer. + * + * A starting row offset is provided only for the output buffer. The caller + * can easily adjust the passed input_buf value to accommodate any row + * offset required on that side. + */ + +METHODDEF(void) +rgb_ycc_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int r, g, b; + register INT32 * ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr0, outptr1, outptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = GETJSAMPLE(inptr[RGB_RED]); + g = GETJSAMPLE(inptr[RGB_GREEN]); + b = GETJSAMPLE(inptr[RGB_BLUE]); + inptr += RGB_PIXELSIZE; + /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations + * must be too; we do not need an explicit range-limiting operation. + * Hence the value being shifted is never negative, and we don't + * need the general RIGHT_SHIFT macro. + */ + /* Y */ + outptr0[col] = (JSAMPLE) + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); + /* Cb */ + outptr1[col] = (JSAMPLE) + ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) + >> SCALEBITS); + /* Cr */ + outptr2[col] = (JSAMPLE) + ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) + >> SCALEBITS); + } + } +} + + +/**************** Cases other than RGB -> YCbCr **************/ + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles RGB->grayscale conversion, which is the same + * as the RGB->Y portion of RGB->YCbCr. + * We assume rgb_ycc_start has been called (we only use the Y tables). + */ + +METHODDEF(void) +rgb_gray_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int r, g, b; + register INT32 * ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr = output_buf[0][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = GETJSAMPLE(inptr[RGB_RED]); + g = GETJSAMPLE(inptr[RGB_GREEN]); + b = GETJSAMPLE(inptr[RGB_BLUE]); + inptr += RGB_PIXELSIZE; + /* Y */ + outptr[col] = (JSAMPLE) + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); + } + } +} + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles Adobe-style CMYK->YCCK conversion, + * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same + * conversion as above, while passing K (black) unchanged. + * We assume rgb_ycc_start has been called. + */ + +METHODDEF(void) +cmyk_ycck_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int r, g, b; + register INT32 * ctab = cconvert->rgb_ycc_tab; + register JSAMPROW inptr; + register JSAMPROW outptr0, outptr1, outptr2, outptr3; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr0 = output_buf[0][output_row]; + outptr1 = output_buf[1][output_row]; + outptr2 = output_buf[2][output_row]; + outptr3 = output_buf[3][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + r = MAXJSAMPLE - GETJSAMPLE(inptr[0]); + g = MAXJSAMPLE - GETJSAMPLE(inptr[1]); + b = MAXJSAMPLE - GETJSAMPLE(inptr[2]); + /* K passes through as-is */ + outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */ + inptr += 4; + /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations + * must be too; we do not need an explicit range-limiting operation. + * Hence the value being shifted is never negative, and we don't + * need the general RIGHT_SHIFT macro. + */ + /* Y */ + outptr0[col] = (JSAMPLE) + ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) + >> SCALEBITS); + /* Cb */ + outptr1[col] = (JSAMPLE) + ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) + >> SCALEBITS); + /* Cr */ + outptr2[col] = (JSAMPLE) + ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) + >> SCALEBITS); + } + } +} + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles grayscale output with no conversion. + * The source can be either plain grayscale or YCbCr (since Y == gray). + */ + +METHODDEF(void) +grayscale_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + register JSAMPROW inptr; + register JSAMPROW outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->image_width; + int instride = cinfo->input_components; + + while (--num_rows >= 0) { + inptr = *input_buf++; + outptr = output_buf[0][output_row]; + output_row++; + for (col = 0; col < num_cols; col++) { + outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */ + inptr += instride; + } + } +} + + +/* + * Convert some rows of samples to the JPEG colorspace. + * This version handles multi-component colorspaces without conversion. + * We assume input_components == num_components. + */ + +METHODDEF(void) +null_convert (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows) +{ + register JSAMPROW inptr; + register JSAMPROW outptr; + register JDIMENSION col; + register int ci; + int nc = cinfo->num_components; + JDIMENSION num_cols = cinfo->image_width; + + while (--num_rows >= 0) { + /* It seems fastest to make a separate pass for each component. */ + for (ci = 0; ci < nc; ci++) { + inptr = *input_buf; + outptr = output_buf[ci][output_row]; + for (col = 0; col < num_cols; col++) { + outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */ + inptr += nc; + } + } + input_buf++; + output_row++; + } +} + + +/* + * Empty method for start_pass. + */ + +METHODDEF(void) +null_method (j_compress_ptr cinfo) +{ + /* no work needed */ +} + + +/* + * Module initialization routine for input colorspace conversion. + */ + +GLOBAL(void) +jinit_color_converter (j_compress_ptr cinfo) +{ + my_cconvert_ptr cconvert; + + cconvert = (my_cconvert_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_color_converter)); + cinfo->cconvert = (struct jpeg_color_converter *) cconvert; + /* set start_pass to null method until we find out differently */ + cconvert->pub.start_pass = null_method; + + /* Make sure input_components agrees with in_color_space */ + switch (cinfo->in_color_space) { + case JCS_GRAYSCALE: + if (cinfo->input_components != 1) + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + break; + + case JCS_RGB: +#if RGB_PIXELSIZE != 3 + if (cinfo->input_components != RGB_PIXELSIZE) + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + break; +#endif /* else share code with YCbCr */ + + case JCS_YCbCr: + if (cinfo->input_components != 3) + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + break; + + case JCS_CMYK: + case JCS_YCCK: + if (cinfo->input_components != 4) + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + break; + + default: /* JCS_UNKNOWN can be anything */ + if (cinfo->input_components < 1) + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + break; + } + + /* Check num_components, set conversion method based on requested space */ + switch (cinfo->jpeg_color_space) { + case JCS_GRAYSCALE: + if (cinfo->num_components != 1) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + if (cinfo->in_color_space == JCS_GRAYSCALE) + cconvert->pub.color_convert = grayscale_convert; + else if (cinfo->in_color_space == JCS_RGB) { + cconvert->pub.start_pass = rgb_ycc_start; + cconvert->pub.color_convert = rgb_gray_convert; + } else if (cinfo->in_color_space == JCS_YCbCr) + cconvert->pub.color_convert = grayscale_convert; + else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + case JCS_RGB: + if (cinfo->num_components != 3) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3) + cconvert->pub.color_convert = null_convert; + else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + case JCS_YCbCr: + if (cinfo->num_components != 3) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + if (cinfo->in_color_space == JCS_RGB) { + cconvert->pub.start_pass = rgb_ycc_start; + cconvert->pub.color_convert = rgb_ycc_convert; + } else if (cinfo->in_color_space == JCS_YCbCr) + cconvert->pub.color_convert = null_convert; + else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + case JCS_CMYK: + if (cinfo->num_components != 4) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + if (cinfo->in_color_space == JCS_CMYK) + cconvert->pub.color_convert = null_convert; + else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + case JCS_YCCK: + if (cinfo->num_components != 4) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + if (cinfo->in_color_space == JCS_CMYK) { + cconvert->pub.start_pass = rgb_ycc_start; + cconvert->pub.color_convert = cmyk_ycck_convert; + } else if (cinfo->in_color_space == JCS_YCCK) + cconvert->pub.color_convert = null_convert; + else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + default: /* allow null conversion of JCS_UNKNOWN */ + if (cinfo->jpeg_color_space != cinfo->in_color_space || + cinfo->num_components != cinfo->input_components) + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + cconvert->pub.color_convert = null_convert; + break; + } +} diff --git a/src/SFML/Graphics/libjpeg/jcdctmgr.c b/src/SFML/Graphics/libjpeg/jcdctmgr.c new file mode 100644 index 00000000..e3f90dc3 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcdctmgr.c @@ -0,0 +1,387 @@ +/* + * jcdctmgr.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the forward-DCT management logic. + * This code selects a particular DCT implementation to be used, + * and it performs related housekeeping chores including coefficient + * quantization. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + + +/* Private subobject for this module */ + +typedef struct { + struct jpeg_forward_dct pub; /* public fields */ + + /* Pointer to the DCT routine actually in use */ + forward_DCT_method_ptr do_dct; + + /* The actual post-DCT divisors --- not identical to the quant table + * entries, because of scaling (especially for an unnormalized DCT). + * Each table is given in normal array order. + */ + DCTELEM * divisors[NUM_QUANT_TBLS]; + +#ifdef DCT_FLOAT_SUPPORTED + /* Same as above for the floating-point case. */ + float_DCT_method_ptr do_float_dct; + FAST_FLOAT * float_divisors[NUM_QUANT_TBLS]; +#endif +} my_fdct_controller; + +typedef my_fdct_controller * my_fdct_ptr; + + +/* + * Initialize for a processing pass. + * Verify that all referenced Q-tables are present, and set up + * the divisor table for each one. + * In the current implementation, DCT of all components is done during + * the first pass, even if only some components will be output in the + * first scan. Hence all components should be examined here. + */ + +METHODDEF(void) +start_pass_fdctmgr (j_compress_ptr cinfo) +{ + my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; + int ci, qtblno, i; + jpeg_component_info *compptr; + JQUANT_TBL * qtbl; + DCTELEM * dtbl; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + qtblno = compptr->quant_tbl_no; + /* Make sure specified quantization table is present */ + if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || + cinfo->quant_tbl_ptrs[qtblno] == NULL) + ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); + qtbl = cinfo->quant_tbl_ptrs[qtblno]; + /* Compute divisors for this quant table */ + /* We may do this more than once for same table, but it's not a big deal */ + switch (cinfo->dct_method) { +#ifdef DCT_ISLOW_SUPPORTED + case JDCT_ISLOW: + /* For LL&M IDCT method, divisors are equal to raw quantization + * coefficients multiplied by 8 (to counteract scaling). + */ + if (fdct->divisors[qtblno] == NULL) { + fdct->divisors[qtblno] = (DCTELEM *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + DCTSIZE2 * SIZEOF(DCTELEM)); + } + dtbl = fdct->divisors[qtblno]; + for (i = 0; i < DCTSIZE2; i++) { + dtbl[i] = ((DCTELEM) qtbl->quantval[i]) << 3; + } + break; +#endif +#ifdef DCT_IFAST_SUPPORTED + case JDCT_IFAST: + { + /* For AA&N IDCT method, divisors are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + * We apply a further scale factor of 8. + */ +#define CONST_BITS 14 + static const INT16 aanscales[DCTSIZE2] = { + /* precomputed values scaled up by 14 bits */ + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, + 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, + 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, + 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, + 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 + }; + SHIFT_TEMPS + + if (fdct->divisors[qtblno] == NULL) { + fdct->divisors[qtblno] = (DCTELEM *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + DCTSIZE2 * SIZEOF(DCTELEM)); + } + dtbl = fdct->divisors[qtblno]; + for (i = 0; i < DCTSIZE2; i++) { + dtbl[i] = (DCTELEM) + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], + (INT32) aanscales[i]), + CONST_BITS-3); + } + } + break; +#endif +#ifdef DCT_FLOAT_SUPPORTED + case JDCT_FLOAT: + { + /* For float AA&N IDCT method, divisors are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + * We apply a further scale factor of 8. + * What's actually stored is 1/divisor so that the inner loop can + * use a multiplication rather than a division. + */ + FAST_FLOAT * fdtbl; + int row, col; + static const double aanscalefactor[DCTSIZE] = { + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + }; + + if (fdct->float_divisors[qtblno] == NULL) { + fdct->float_divisors[qtblno] = (FAST_FLOAT *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + DCTSIZE2 * SIZEOF(FAST_FLOAT)); + } + fdtbl = fdct->float_divisors[qtblno]; + i = 0; + for (row = 0; row < DCTSIZE; row++) { + for (col = 0; col < DCTSIZE; col++) { + fdtbl[i] = (FAST_FLOAT) + (1.0 / (((double) qtbl->quantval[i] * + aanscalefactor[row] * aanscalefactor[col] * 8.0))); + i++; + } + } + } + break; +#endif + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; + } + } +} + + +/* + * Perform forward DCT on one or more blocks of a component. + * + * The input samples are taken from the sample_data[] array starting at + * position start_row/start_col, and moving to the right for any additional + * blocks. The quantized coefficients are returned in coef_blocks[]. + */ + +METHODDEF(void) +forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks) +/* This version is used for integer DCT implementations. */ +{ + /* This routine is heavily used, so it's worth coding it tightly. */ + my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; + forward_DCT_method_ptr do_dct = fdct->do_dct; + DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no]; + DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */ + JDIMENSION bi; + + sample_data += start_row; /* fold in the vertical offset once */ + + for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { + /* Load data into workspace, applying unsigned->signed conversion */ + { register DCTELEM *workspaceptr; + register JSAMPROW elemptr; + register int elemr; + + workspaceptr = workspace; + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = sample_data[elemr] + start_col; +#if DCTSIZE == 8 /* unroll the inner loop */ + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; +#else + { register int elemc; + for (elemc = DCTSIZE; elemc > 0; elemc--) { + *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE; + } + } +#endif + } + } + + /* Perform the DCT */ + (*do_dct) (workspace); + + /* Quantize/descale the coefficients, and store into coef_blocks[] */ + { register DCTELEM temp, qval; + register int i; + register JCOEFPTR output_ptr = coef_blocks[bi]; + + for (i = 0; i < DCTSIZE2; i++) { + qval = divisors[i]; + temp = workspace[i]; + /* Divide the coefficient value by qval, ensuring proper rounding. + * Since C does not specify the direction of rounding for negative + * quotients, we have to force the dividend positive for portability. + * + * In most files, at least half of the output values will be zero + * (at default quantization settings, more like three-quarters...) + * so we should ensure that this case is fast. On many machines, + * a comparison is enough cheaper than a divide to make a special test + * a win. Since both inputs will be nonnegative, we need only test + * for a < b to discover whether a/b is 0. + * If your machine's division is fast enough, define FAST_DIVIDE. + */ +#ifdef FAST_DIVIDE +#define DIVIDE_BY(a,b) a /= b +#else +#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 +#endif + if (temp < 0) { + temp = -temp; + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + temp = -temp; + } else { + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + } + output_ptr[i] = (JCOEF) temp; + } + } + } +} + + +#ifdef DCT_FLOAT_SUPPORTED + +METHODDEF(void) +forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks) +/* This version is used for floating-point DCT implementations. */ +{ + /* This routine is heavily used, so it's worth coding it tightly. */ + my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct; + float_DCT_method_ptr do_dct = fdct->do_float_dct; + FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no]; + FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */ + JDIMENSION bi; + + sample_data += start_row; /* fold in the vertical offset once */ + + for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) { + /* Load data into workspace, applying unsigned->signed conversion */ + { register FAST_FLOAT *workspaceptr; + register JSAMPROW elemptr; + register int elemr; + + workspaceptr = workspace; + for (elemr = 0; elemr < DCTSIZE; elemr++) { + elemptr = sample_data[elemr] + start_col; +#if DCTSIZE == 8 /* unroll the inner loop */ + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); +#else + { register int elemc; + for (elemc = DCTSIZE; elemc > 0; elemc--) { + *workspaceptr++ = (FAST_FLOAT) + (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE); + } + } +#endif + } + } + + /* Perform the DCT */ + (*do_dct) (workspace); + + /* Quantize/descale the coefficients, and store into coef_blocks[] */ + { register FAST_FLOAT temp; + register int i; + register JCOEFPTR output_ptr = coef_blocks[bi]; + + for (i = 0; i < DCTSIZE2; i++) { + /* Apply the quantization and scaling factor */ + temp = workspace[i] * divisors[i]; + /* Round to nearest integer. + * Since C does not specify the direction of rounding for negative + * quotients, we have to force the dividend positive for portability. + * The maximum coefficient size is +-16K (for 12-bit data), so this + * code should work for either 16-bit or 32-bit ints. + */ + output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384); + } + } + } +} + +#endif /* DCT_FLOAT_SUPPORTED */ + + +/* + * Initialize FDCT manager. + */ + +GLOBAL(void) +jinit_forward_dct (j_compress_ptr cinfo) +{ + my_fdct_ptr fdct; + int i; + + fdct = (my_fdct_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_fdct_controller)); + cinfo->fdct = (struct jpeg_forward_dct *) fdct; + fdct->pub.start_pass = start_pass_fdctmgr; + + switch (cinfo->dct_method) { +#ifdef DCT_ISLOW_SUPPORTED + case JDCT_ISLOW: + fdct->pub.forward_DCT = forward_DCT; + fdct->do_dct = jpeg_fdct_islow; + break; +#endif +#ifdef DCT_IFAST_SUPPORTED + case JDCT_IFAST: + fdct->pub.forward_DCT = forward_DCT; + fdct->do_dct = jpeg_fdct_ifast; + break; +#endif +#ifdef DCT_FLOAT_SUPPORTED + case JDCT_FLOAT: + fdct->pub.forward_DCT = forward_DCT_float; + fdct->do_float_dct = jpeg_fdct_float; + break; +#endif + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; + } + + /* Mark divisor tables unallocated */ + for (i = 0; i < NUM_QUANT_TBLS; i++) { + fdct->divisors[i] = NULL; +#ifdef DCT_FLOAT_SUPPORTED + fdct->float_divisors[i] = NULL; +#endif + } +} diff --git a/src/SFML/Graphics/libjpeg/jchuff.c b/src/SFML/Graphics/libjpeg/jchuff.c new file mode 100644 index 00000000..16d9366a --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jchuff.c @@ -0,0 +1,909 @@ +/* + * jchuff.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains Huffman entropy encoding routines. + * + * Much of the complexity here has to do with supporting output suspension. + * If the data destination module demands suspension, we want to be able to + * back up to the start of the current MCU. To do this, we copy state + * variables into local working storage, and update them back to the + * permanent JPEG objects only upon successful completion of an MCU. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jchuff.h" /* Declarations shared with jcphuff.c */ + + +/* Expanded entropy encoder object for Huffman encoding. + * + * The savable_state subrecord contains fields that change within an MCU, + * but must not be updated permanently until we complete the MCU. + */ + +typedef struct { + INT32 put_buffer; /* current bit-accumulation buffer */ + int put_bits; /* # of bits now in it */ + int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ +} savable_state; + +/* This macro is to work around compilers with missing or broken + * structure assignment. You'll need to fix this code if you have + * such a compiler and you change MAX_COMPS_IN_SCAN. + */ + +#ifndef NO_STRUCT_ASSIGN +#define ASSIGN_STATE(dest,src) ((dest) = (src)) +#else +#if MAX_COMPS_IN_SCAN == 4 +#define ASSIGN_STATE(dest,src) \ + ((dest).put_buffer = (src).put_buffer, \ + (dest).put_bits = (src).put_bits, \ + (dest).last_dc_val[0] = (src).last_dc_val[0], \ + (dest).last_dc_val[1] = (src).last_dc_val[1], \ + (dest).last_dc_val[2] = (src).last_dc_val[2], \ + (dest).last_dc_val[3] = (src).last_dc_val[3]) +#endif +#endif + + +typedef struct { + struct jpeg_entropy_encoder pub; /* public fields */ + + savable_state saved; /* Bit buffer & DC state at start of MCU */ + + /* These fields are NOT loaded into local working state. */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + int next_restart_num; /* next restart number to write (0-7) */ + + /* Pointers to derived tables (these workspaces have image lifespan) */ + c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; + c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; + +#ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */ + long * dc_count_ptrs[NUM_HUFF_TBLS]; + long * ac_count_ptrs[NUM_HUFF_TBLS]; +#endif +} huff_entropy_encoder; + +typedef huff_entropy_encoder * huff_entropy_ptr; + +/* Working state while writing an MCU. + * This struct contains all the fields that are needed by subroutines. + */ + +typedef struct { + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + savable_state cur; /* Current bit buffer & DC state */ + j_compress_ptr cinfo; /* dump_buffer needs access to this */ +} working_state; + + +/* Forward declarations */ +METHODDEF(boolean) encode_mcu_huff JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(void) finish_pass_huff JPP((j_compress_ptr cinfo)); +#ifdef ENTROPY_OPT_SUPPORTED +METHODDEF(boolean) encode_mcu_gather JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(void) finish_pass_gather JPP((j_compress_ptr cinfo)); +#endif + + +/* + * Initialize for a Huffman-compressed scan. + * If gather_statistics is TRUE, we do not output anything during the scan, + * just count the Huffman symbols used and generate Huffman code tables. + */ + +METHODDEF(void) +start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + int ci, dctbl, actbl; + jpeg_component_info * compptr; + + if (gather_statistics) { +#ifdef ENTROPY_OPT_SUPPORTED + entropy->pub.encode_mcu = encode_mcu_gather; + entropy->pub.finish_pass = finish_pass_gather; +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else { + entropy->pub.encode_mcu = encode_mcu_huff; + entropy->pub.finish_pass = finish_pass_huff; + } + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + dctbl = compptr->dc_tbl_no; + actbl = compptr->ac_tbl_no; + if (gather_statistics) { +#ifdef ENTROPY_OPT_SUPPORTED + /* Check for invalid table indexes */ + /* (make_c_derived_tbl does this in the other path) */ + if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl); + if (actbl < 0 || actbl >= NUM_HUFF_TBLS) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl); + /* Allocate and zero the statistics tables */ + /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ + if (entropy->dc_count_ptrs[dctbl] == NULL) + entropy->dc_count_ptrs[dctbl] = (long *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 257 * SIZEOF(long)); + MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long)); + if (entropy->ac_count_ptrs[actbl] == NULL) + entropy->ac_count_ptrs[actbl] = (long *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 257 * SIZEOF(long)); + MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long)); +#endif + } else { + /* Compute derived values for Huffman tables */ + /* We may do this more than once for a table, but it's not expensive */ + jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl, + & entropy->dc_derived_tbls[dctbl]); + jpeg_make_c_derived_tbl(cinfo, FALSE, actbl, + & entropy->ac_derived_tbls[actbl]); + } + /* Initialize DC predictions to 0 */ + entropy->saved.last_dc_val[ci] = 0; + } + + /* Initialize bit buffer to empty */ + entropy->saved.put_buffer = 0; + entropy->saved.put_bits = 0; + + /* Initialize restart stuff */ + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num = 0; +} + + +/* + * Compute the derived values for a Huffman table. + * This routine also performs some validation checks on the table. + * + * Note this is also used by jcphuff.c. + */ + +GLOBAL(void) +jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, + c_derived_tbl ** pdtbl) +{ + JHUFF_TBL *htbl; + c_derived_tbl *dtbl; + int p, i, l, lastp, si, maxsymbol; + char huffsize[257]; + unsigned int huffcode[257]; + unsigned int code; + + /* Note that huffsize[] and huffcode[] are filled in code-length order, + * paralleling the order of the symbols themselves in htbl->huffval[]. + */ + + /* Find the input Huffman table */ + if (tblno < 0 || tblno >= NUM_HUFF_TBLS) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); + htbl = + isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno]; + if (htbl == NULL) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); + + /* Allocate a workspace if we haven't already done so. */ + if (*pdtbl == NULL) + *pdtbl = (c_derived_tbl *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(c_derived_tbl)); + dtbl = *pdtbl; + + /* Figure C.1: make table of Huffman code length for each symbol */ + + p = 0; + for (l = 1; l <= 16; l++) { + i = (int) htbl->bits[l]; + if (i < 0 || p + i > 256) /* protect against table overrun */ + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + while (i--) + huffsize[p++] = (char) l; + } + huffsize[p] = 0; + lastp = p; + + /* Figure C.2: generate the codes themselves */ + /* We also validate that the counts represent a legal Huffman code tree. */ + + code = 0; + si = huffsize[0]; + p = 0; + while (huffsize[p]) { + while (((int) huffsize[p]) == si) { + huffcode[p++] = code; + code++; + } + /* code is now 1 more than the last code used for codelength si; but + * it must still fit in si bits, since no code is allowed to be all ones. + */ + if (((INT32) code) >= (((INT32) 1) << si)) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + code <<= 1; + si++; + } + + /* Figure C.3: generate encoding tables */ + /* These are code and size indexed by symbol value */ + + /* Set all codeless symbols to have code length 0; + * this lets us detect duplicate VAL entries here, and later + * allows emit_bits to detect any attempt to emit such symbols. + */ + MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi)); + + /* This is also a convenient place to check for out-of-range + * and duplicated VAL entries. We allow 0..255 for AC symbols + * but only 0..15 for DC. (We could constrain them further + * based on data depth and mode, but this seems enough.) + */ + maxsymbol = isDC ? 15 : 255; + + for (p = 0; p < lastp; p++) { + i = htbl->huffval[p]; + if (i < 0 || i > maxsymbol || dtbl->ehufsi[i]) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + dtbl->ehufco[i] = huffcode[p]; + dtbl->ehufsi[i] = huffsize[p]; + } +} + + +/* Outputting bytes to the file */ + +/* Emit a byte, taking 'action' if must suspend. */ +#define emit_byte(state,val,action) \ + { *(state)->next_output_byte++ = (JOCTET) (val); \ + if (--(state)->free_in_buffer == 0) \ + if (! dump_buffer(state)) \ + { action; } } + + +LOCAL(boolean) +dump_buffer (working_state * state) +/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */ +{ + struct jpeg_destination_mgr * dest = state->cinfo->dest; + + if (! (*dest->empty_output_buffer) (state->cinfo)) + return FALSE; + /* After a successful buffer dump, must reset buffer pointers */ + state->next_output_byte = dest->next_output_byte; + state->free_in_buffer = dest->free_in_buffer; + return TRUE; +} + + +/* Outputting bits to the file */ + +/* Only the right 24 bits of put_buffer are used; the valid bits are + * left-justified in this part. At most 16 bits can be passed to emit_bits + * in one call, and we never retain more than 7 bits in put_buffer + * between calls, so 24 bits are sufficient. + */ + +INLINE +LOCAL(boolean) +emit_bits (working_state * state, unsigned int code, int size) +/* Emit some bits; return TRUE if successful, FALSE if must suspend */ +{ + /* This routine is heavily used, so it's worth coding tightly. */ + register INT32 put_buffer = (INT32) code; + register int put_bits = state->cur.put_bits; + + /* if size is 0, caller used an invalid Huffman table entry */ + if (size == 0) + ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); + + put_buffer &= (((INT32) 1)<cur.put_buffer; /* and merge with old buffer contents */ + + while (put_bits >= 8) { + int c = (int) ((put_buffer >> 16) & 0xFF); + + emit_byte(state, c, return FALSE); + if (c == 0xFF) { /* need to stuff a zero byte? */ + emit_byte(state, 0, return FALSE); + } + put_buffer <<= 8; + put_bits -= 8; + } + + state->cur.put_buffer = put_buffer; /* update state variables */ + state->cur.put_bits = put_bits; + + return TRUE; +} + + +LOCAL(boolean) +flush_bits (working_state * state) +{ + if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */ + return FALSE; + state->cur.put_buffer = 0; /* and reset bit-buffer to empty */ + state->cur.put_bits = 0; + return TRUE; +} + + +/* Encode a single block's worth of coefficients */ + +LOCAL(boolean) +encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, + c_derived_tbl *dctbl, c_derived_tbl *actbl) +{ + register int temp, temp2; + register int nbits; + register int k, r, i; + + /* Encode the DC coefficient difference per section F.1.2.1 */ + + temp = temp2 = block[0] - last_dc_val; + + if (temp < 0) { + temp = -temp; /* temp is abs value of input */ + /* For a negative input, want temp2 = bitwise complement of abs(input) */ + /* This code assumes we are on a two's complement machine */ + temp2--; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + while (temp) { + nbits++; + temp >>= 1; + } + /* Check for out-of-range coefficient values. + * Since we're encoding a difference, the range limit is twice as much. + */ + if (nbits > MAX_COEF_BITS+1) + ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); + + /* Emit the Huffman-coded symbol for the number of bits */ + if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) + return FALSE; + + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + if (nbits) /* emit_bits rejects calls with size 0 */ + if (! emit_bits(state, (unsigned int) temp2, nbits)) + return FALSE; + + /* Encode the AC coefficients per section F.1.2.2 */ + + r = 0; /* r = run length of zeros */ + + for (k = 1; k < DCTSIZE2; k++) { + if ((temp = block[jpeg_natural_order[k]]) == 0) { + r++; + } else { + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) + return FALSE; + r -= 16; + } + + temp2 = temp; + if (temp < 0) { + temp = -temp; /* temp is abs value of input */ + /* This code assumes we are on a two's complement machine */ + temp2--; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 1; /* there must be at least one 1 bit */ + while ((temp >>= 1)) + nbits++; + /* Check for out-of-range coefficient values */ + if (nbits > MAX_COEF_BITS) + ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); + + /* Emit Huffman symbol for run length / number of bits */ + i = (r << 4) + nbits; + if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i])) + return FALSE; + + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + if (! emit_bits(state, (unsigned int) temp2, nbits)) + return FALSE; + + r = 0; + } + } + + /* If the last coef(s) were zero, emit an end-of-block code */ + if (r > 0) + if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0])) + return FALSE; + + return TRUE; +} + + +/* + * Emit a restart marker & resynchronize predictions. + */ + +LOCAL(boolean) +emit_restart (working_state * state, int restart_num) +{ + int ci; + + if (! flush_bits(state)) + return FALSE; + + emit_byte(state, 0xFF, return FALSE); + emit_byte(state, JPEG_RST0 + restart_num, return FALSE); + + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < state->cinfo->comps_in_scan; ci++) + state->cur.last_dc_val[ci] = 0; + + /* The restart counter is not updated until we successfully write the MCU. */ + + return TRUE; +} + + +/* + * Encode and output one MCU's worth of Huffman-compressed coefficients. + */ + +METHODDEF(boolean) +encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + working_state state; + int blkn, ci; + jpeg_component_info * compptr; + + /* Load up working state */ + state.next_output_byte = cinfo->dest->next_output_byte; + state.free_in_buffer = cinfo->dest->free_in_buffer; + ASSIGN_STATE(state.cur, entropy->saved); + state.cinfo = cinfo; + + /* Emit restart marker if needed */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) + if (! emit_restart(&state, entropy->next_restart_num)) + return FALSE; + } + + /* Encode the MCU data blocks */ + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + if (! encode_one_block(&state, + MCU_data[blkn][0], state.cur.last_dc_val[ci], + entropy->dc_derived_tbls[compptr->dc_tbl_no], + entropy->ac_derived_tbls[compptr->ac_tbl_no])) + return FALSE; + /* Update last_dc_val */ + state.cur.last_dc_val[ci] = MCU_data[blkn][0][0]; + } + + /* Completed MCU, so update state */ + cinfo->dest->next_output_byte = state.next_output_byte; + cinfo->dest->free_in_buffer = state.free_in_buffer; + ASSIGN_STATE(entropy->saved, state.cur); + + /* Update restart-interval state too */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) { + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num++; + entropy->next_restart_num &= 7; + } + entropy->restarts_to_go--; + } + + return TRUE; +} + + +/* + * Finish up at the end of a Huffman-compressed scan. + */ + +METHODDEF(void) +finish_pass_huff (j_compress_ptr cinfo) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + working_state state; + + /* Load up working state ... flush_bits needs it */ + state.next_output_byte = cinfo->dest->next_output_byte; + state.free_in_buffer = cinfo->dest->free_in_buffer; + ASSIGN_STATE(state.cur, entropy->saved); + state.cinfo = cinfo; + + /* Flush out the last data */ + if (! flush_bits(&state)) + ERREXIT(cinfo, JERR_CANT_SUSPEND); + + /* Update state */ + cinfo->dest->next_output_byte = state.next_output_byte; + cinfo->dest->free_in_buffer = state.free_in_buffer; + ASSIGN_STATE(entropy->saved, state.cur); +} + + +/* + * Huffman coding optimization. + * + * We first scan the supplied data and count the number of uses of each symbol + * that is to be Huffman-coded. (This process MUST agree with the code above.) + * Then we build a Huffman coding tree for the observed counts. + * Symbols which are not needed at all for the particular image are not + * assigned any code, which saves space in the DHT marker as well as in + * the compressed data. + */ + +#ifdef ENTROPY_OPT_SUPPORTED + + +/* Process a single block's worth of coefficients */ + +LOCAL(void) +htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, + long dc_counts[], long ac_counts[]) +{ + register int temp; + register int nbits; + register int k, r; + + /* Encode the DC coefficient difference per section F.1.2.1 */ + + temp = block[0] - last_dc_val; + if (temp < 0) + temp = -temp; + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + while (temp) { + nbits++; + temp >>= 1; + } + /* Check for out-of-range coefficient values. + * Since we're encoding a difference, the range limit is twice as much. + */ + if (nbits > MAX_COEF_BITS+1) + ERREXIT(cinfo, JERR_BAD_DCT_COEF); + + /* Count the Huffman symbol for the number of bits */ + dc_counts[nbits]++; + + /* Encode the AC coefficients per section F.1.2.2 */ + + r = 0; /* r = run length of zeros */ + + for (k = 1; k < DCTSIZE2; k++) { + if ((temp = block[jpeg_natural_order[k]]) == 0) { + r++; + } else { + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + ac_counts[0xF0]++; + r -= 16; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + if (temp < 0) + temp = -temp; + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 1; /* there must be at least one 1 bit */ + while ((temp >>= 1)) + nbits++; + /* Check for out-of-range coefficient values */ + if (nbits > MAX_COEF_BITS) + ERREXIT(cinfo, JERR_BAD_DCT_COEF); + + /* Count Huffman symbol for run length / number of bits */ + ac_counts[(r << 4) + nbits]++; + + r = 0; + } + } + + /* If the last coef(s) were zero, emit an end-of-block code */ + if (r > 0) + ac_counts[0]++; +} + + +/* + * Trial-encode one MCU's worth of Huffman-compressed coefficients. + * No data is actually output, so no suspension return is possible. + */ + +METHODDEF(boolean) +encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + int blkn, ci; + jpeg_component_info * compptr; + + /* Take care of restart intervals if needed */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) { + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) + entropy->saved.last_dc_val[ci] = 0; + /* Update restart state */ + entropy->restarts_to_go = cinfo->restart_interval; + } + entropy->restarts_to_go--; + } + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci], + entropy->dc_count_ptrs[compptr->dc_tbl_no], + entropy->ac_count_ptrs[compptr->ac_tbl_no]); + entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0]; + } + + return TRUE; +} + + +/* + * Generate the best Huffman code table for the given counts, fill htbl. + * Note this is also used by jcphuff.c. + * + * The JPEG standard requires that no symbol be assigned a codeword of all + * one bits (so that padding bits added at the end of a compressed segment + * can't look like a valid code). Because of the canonical ordering of + * codewords, this just means that there must be an unused slot in the + * longest codeword length category. Section K.2 of the JPEG spec suggests + * reserving such a slot by pretending that symbol 256 is a valid symbol + * with count 1. In theory that's not optimal; giving it count zero but + * including it in the symbol set anyway should give a better Huffman code. + * But the theoretically better code actually seems to come out worse in + * practice, because it produces more all-ones bytes (which incur stuffed + * zero bytes in the final file). In any case the difference is tiny. + * + * The JPEG standard requires Huffman codes to be no more than 16 bits long. + * If some symbols have a very small but nonzero probability, the Huffman tree + * must be adjusted to meet the code length restriction. We currently use + * the adjustment method suggested in JPEG section K.2. This method is *not* + * optimal; it may not choose the best possible limited-length code. But + * typically only very-low-frequency symbols will be given less-than-optimal + * lengths, so the code is almost optimal. Experimental comparisons against + * an optimal limited-length-code algorithm indicate that the difference is + * microscopic --- usually less than a hundredth of a percent of total size. + * So the extra complexity of an optimal algorithm doesn't seem worthwhile. + */ + +GLOBAL(void) +jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[]) +{ +#define MAX_CLEN 32 /* assumed maximum initial code length */ + UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */ + int codesize[257]; /* codesize[k] = code length of symbol k */ + int others[257]; /* next symbol in current branch of tree */ + int c1, c2; + int p, i, j; + long v; + + /* This algorithm is explained in section K.2 of the JPEG standard */ + + MEMZERO(bits, SIZEOF(bits)); + MEMZERO(codesize, SIZEOF(codesize)); + for (i = 0; i < 257; i++) + others[i] = -1; /* init links to empty */ + + freq[256] = 1; /* make sure 256 has a nonzero count */ + /* Including the pseudo-symbol 256 in the Huffman procedure guarantees + * that no real symbol is given code-value of all ones, because 256 + * will be placed last in the largest codeword category. + */ + + /* Huffman's basic algorithm to assign optimal code lengths to symbols */ + + for (;;) { + /* Find the smallest nonzero frequency, set c1 = its symbol */ + /* In case of ties, take the larger symbol number */ + c1 = -1; + v = 1000000000L; + for (i = 0; i <= 256; i++) { + if (freq[i] && freq[i] <= v) { + v = freq[i]; + c1 = i; + } + } + + /* Find the next smallest nonzero frequency, set c2 = its symbol */ + /* In case of ties, take the larger symbol number */ + c2 = -1; + v = 1000000000L; + for (i = 0; i <= 256; i++) { + if (freq[i] && freq[i] <= v && i != c1) { + v = freq[i]; + c2 = i; + } + } + + /* Done if we've merged everything into one frequency */ + if (c2 < 0) + break; + + /* Else merge the two counts/trees */ + freq[c1] += freq[c2]; + freq[c2] = 0; + + /* Increment the codesize of everything in c1's tree branch */ + codesize[c1]++; + while (others[c1] >= 0) { + c1 = others[c1]; + codesize[c1]++; + } + + others[c1] = c2; /* chain c2 onto c1's tree branch */ + + /* Increment the codesize of everything in c2's tree branch */ + codesize[c2]++; + while (others[c2] >= 0) { + c2 = others[c2]; + codesize[c2]++; + } + } + + /* Now count the number of symbols of each code length */ + for (i = 0; i <= 256; i++) { + if (codesize[i]) { + /* The JPEG standard seems to think that this can't happen, */ + /* but I'm paranoid... */ + if (codesize[i] > MAX_CLEN) + ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW); + + bits[codesize[i]]++; + } + } + + /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure + * Huffman procedure assigned any such lengths, we must adjust the coding. + * Here is what the JPEG spec says about how this next bit works: + * Since symbols are paired for the longest Huffman code, the symbols are + * removed from this length category two at a time. The prefix for the pair + * (which is one bit shorter) is allocated to one of the pair; then, + * skipping the BITS entry for that prefix length, a code word from the next + * shortest nonzero BITS entry is converted into a prefix for two code words + * one bit longer. + */ + + for (i = MAX_CLEN; i > 16; i--) { + while (bits[i] > 0) { + j = i - 2; /* find length of new prefix to be used */ + while (bits[j] == 0) + j--; + + bits[i] -= 2; /* remove two symbols */ + bits[i-1]++; /* one goes in this length */ + bits[j+1] += 2; /* two new symbols in this length */ + bits[j]--; /* symbol of this length is now a prefix */ + } + } + + /* Remove the count for the pseudo-symbol 256 from the largest codelength */ + while (bits[i] == 0) /* find largest codelength still in use */ + i--; + bits[i]--; + + /* Return final symbol counts (only for lengths 0..16) */ + MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits)); + + /* Return a list of the symbols sorted by code length */ + /* It's not real clear to me why we don't need to consider the codelength + * changes made above, but the JPEG spec seems to think this works. + */ + p = 0; + for (i = 1; i <= MAX_CLEN; i++) { + for (j = 0; j <= 255; j++) { + if (codesize[j] == i) { + htbl->huffval[p] = (UINT8) j; + p++; + } + } + } + + /* Set sent_table FALSE so updated table will be written to JPEG file. */ + htbl->sent_table = FALSE; +} + + +/* + * Finish up a statistics-gathering pass and create the new Huffman tables. + */ + +METHODDEF(void) +finish_pass_gather (j_compress_ptr cinfo) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + int ci, dctbl, actbl; + jpeg_component_info * compptr; + JHUFF_TBL **htblptr; + boolean did_dc[NUM_HUFF_TBLS]; + boolean did_ac[NUM_HUFF_TBLS]; + + /* It's important not to apply jpeg_gen_optimal_table more than once + * per table, because it clobbers the input frequency counts! + */ + MEMZERO(did_dc, SIZEOF(did_dc)); + MEMZERO(did_ac, SIZEOF(did_ac)); + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + dctbl = compptr->dc_tbl_no; + actbl = compptr->ac_tbl_no; + if (! did_dc[dctbl]) { + htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; + if (*htblptr == NULL) + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]); + did_dc[dctbl] = TRUE; + } + if (! did_ac[actbl]) { + htblptr = & cinfo->ac_huff_tbl_ptrs[actbl]; + if (*htblptr == NULL) + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]); + did_ac[actbl] = TRUE; + } + } +} + + +#endif /* ENTROPY_OPT_SUPPORTED */ + + +/* + * Module initialization routine for Huffman entropy encoding. + */ + +GLOBAL(void) +jinit_huff_encoder (j_compress_ptr cinfo) +{ + huff_entropy_ptr entropy; + int i; + + entropy = (huff_entropy_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(huff_entropy_encoder)); + cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; + entropy->pub.start_pass = start_pass_huff; + + /* Mark tables unallocated */ + for (i = 0; i < NUM_HUFF_TBLS; i++) { + entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; +#ifdef ENTROPY_OPT_SUPPORTED + entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL; +#endif + } +} diff --git a/src/SFML/Graphics/libjpeg/jchuff.h b/src/SFML/Graphics/libjpeg/jchuff.h new file mode 100644 index 00000000..8c02c09a --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jchuff.h @@ -0,0 +1,47 @@ +/* + * jchuff.h + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains declarations for Huffman entropy encoding routines + * that are shared between the sequential encoder (jchuff.c) and the + * progressive encoder (jcphuff.c). No other modules need to see these. + */ + +/* The legal range of a DCT coefficient is + * -1024 .. +1023 for 8-bit data; + * -16384 .. +16383 for 12-bit data. + * Hence the magnitude should always fit in 10 or 14 bits respectively. + */ + +#if BITS_IN_JSAMPLE == 8 +#define MAX_COEF_BITS 10 +#else +#define MAX_COEF_BITS 14 +#endif + +/* Derived data constructed for each Huffman table */ + +typedef struct { + unsigned int ehufco[256]; /* code for each symbol */ + char ehufsi[256]; /* length of code for each symbol */ + /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ +} c_derived_tbl; + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_make_c_derived_tbl jMkCDerived +#define jpeg_gen_optimal_table jGenOptTbl +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + +/* Expand a Huffman table definition into the derived format */ +EXTERN(void) jpeg_make_c_derived_tbl + JPP((j_compress_ptr cinfo, boolean isDC, int tblno, + c_derived_tbl ** pdtbl)); + +/* Generate an optimal table definition given the specified counts */ +EXTERN(void) jpeg_gen_optimal_table + JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); diff --git a/src/SFML/Graphics/libjpeg/jcinit.c b/src/SFML/Graphics/libjpeg/jcinit.c new file mode 100644 index 00000000..19de8d0e --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcinit.c @@ -0,0 +1,72 @@ +/* + * jcinit.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains initialization logic for the JPEG compressor. + * This routine is in charge of selecting the modules to be executed and + * making an initialization call to each one. + * + * Logically, this code belongs in jcmaster.c. It's split out because + * linking this routine implies linking the entire compression library. + * For a transcoding-only application, we want to be able to use jcmaster.c + * without linking in the whole library. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * Master selection of compression modules. + * This is done once at the start of processing an image. We determine + * which modules will be used and give them appropriate initialization calls. + */ + +GLOBAL(void) +jinit_compress_master (j_compress_ptr cinfo) +{ + /* Initialize master control (includes parameter checking/processing) */ + jinit_c_master_control(cinfo, FALSE /* full compression */); + + /* Preprocessing */ + if (! cinfo->raw_data_in) { + jinit_color_converter(cinfo); + jinit_downsampler(cinfo); + jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); + } + /* Forward DCT */ + jinit_forward_dct(cinfo); + /* Entropy encoding: either Huffman or arithmetic coding. */ + if (cinfo->arith_code) { + ERREXIT(cinfo, JERR_ARITH_NOTIMPL); + } else { + if (cinfo->progressive_mode) { +#ifdef C_PROGRESSIVE_SUPPORTED + jinit_phuff_encoder(cinfo); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else + jinit_huff_encoder(cinfo); + } + + /* Need a full-image coefficient buffer in any multi-pass mode. */ + jinit_c_coef_controller(cinfo, + (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); + jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); + + jinit_marker_writer(cinfo); + + /* We can now tell the memory manager to allocate virtual arrays. */ + (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); + + /* Write the datastream header (SOI) immediately. + * Frame and scan headers are postponed till later. + * This lets application insert special markers after the SOI. + */ + (*cinfo->marker->write_file_header) (cinfo); +} diff --git a/src/SFML/Graphics/libjpeg/jcmainct.c b/src/SFML/Graphics/libjpeg/jcmainct.c new file mode 100644 index 00000000..14aa4c75 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcmainct.c @@ -0,0 +1,293 @@ +/* + * jcmainct.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the main buffer controller for compression. + * The main buffer lies between the pre-processor and the JPEG + * compressor proper; it holds downsampled data in the JPEG colorspace. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Note: currently, there is no operating mode in which a full-image buffer + * is needed at this step. If there were, that mode could not be used with + * "raw data" input, since this module is bypassed in that case. However, + * we've left the code here for possible use in special applications. + */ +#undef FULL_MAIN_BUFFER_SUPPORTED + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_c_main_controller pub; /* public fields */ + + JDIMENSION cur_iMCU_row; /* number of current iMCU row */ + JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */ + boolean suspended; /* remember if we suspended output */ + J_BUF_MODE pass_mode; /* current operating mode */ + + /* If using just a strip buffer, this points to the entire set of buffers + * (we allocate one for each component). In the full-image case, this + * points to the currently accessible strips of the virtual arrays. + */ + JSAMPARRAY buffer[MAX_COMPONENTS]; + +#ifdef FULL_MAIN_BUFFER_SUPPORTED + /* If using full-image storage, this array holds pointers to virtual-array + * control blocks for each component. Unused if not full-image storage. + */ + jvirt_sarray_ptr whole_image[MAX_COMPONENTS]; +#endif +} my_main_controller; + +typedef my_main_controller * my_main_ptr; + + +/* Forward declarations */ +METHODDEF(void) process_data_simple_main + JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); +#ifdef FULL_MAIN_BUFFER_SUPPORTED +METHODDEF(void) process_data_buffer_main + JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); +#endif + + +/* + * Initialize for a processing pass. + */ + +METHODDEF(void) +start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + + /* Do nothing in raw-data mode. */ + if (cinfo->raw_data_in) + return; + + main->cur_iMCU_row = 0; /* initialize counters */ + main->rowgroup_ctr = 0; + main->suspended = FALSE; + main->pass_mode = pass_mode; /* save mode for use by process_data */ + + switch (pass_mode) { + case JBUF_PASS_THRU: +#ifdef FULL_MAIN_BUFFER_SUPPORTED + if (main->whole_image[0] != NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); +#endif + main->pub.process_data = process_data_simple_main; + break; +#ifdef FULL_MAIN_BUFFER_SUPPORTED + case JBUF_SAVE_SOURCE: + case JBUF_CRANK_DEST: + case JBUF_SAVE_AND_PASS: + if (main->whole_image[0] == NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + main->pub.process_data = process_data_buffer_main; + break; +#endif + default: + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + break; + } +} + + +/* + * Process some data. + * This routine handles the simple pass-through mode, + * where we have only a strip buffer. + */ + +METHODDEF(void) +process_data_simple_main (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail) +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + + while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { + /* Read input data if we haven't filled the main buffer yet */ + if (main->rowgroup_ctr < DCTSIZE) + (*cinfo->prep->pre_process_data) (cinfo, + input_buf, in_row_ctr, in_rows_avail, + main->buffer, &main->rowgroup_ctr, + (JDIMENSION) DCTSIZE); + + /* If we don't have a full iMCU row buffered, return to application for + * more data. Note that preprocessor will always pad to fill the iMCU row + * at the bottom of the image. + */ + if (main->rowgroup_ctr != DCTSIZE) + return; + + /* Send the completed row to the compressor */ + if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { + /* If compressor did not consume the whole row, then we must need to + * suspend processing and return to the application. In this situation + * we pretend we didn't yet consume the last input row; otherwise, if + * it happened to be the last row of the image, the application would + * think we were done. + */ + if (! main->suspended) { + (*in_row_ctr)--; + main->suspended = TRUE; + } + return; + } + /* We did finish the row. Undo our little suspension hack if a previous + * call suspended; then mark the main buffer empty. + */ + if (main->suspended) { + (*in_row_ctr)++; + main->suspended = FALSE; + } + main->rowgroup_ctr = 0; + main->cur_iMCU_row++; + } +} + + +#ifdef FULL_MAIN_BUFFER_SUPPORTED + +/* + * Process some data. + * This routine handles all of the modes that use a full-size buffer. + */ + +METHODDEF(void) +process_data_buffer_main (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail) +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + int ci; + jpeg_component_info *compptr; + boolean writing = (main->pass_mode != JBUF_CRANK_DEST); + + while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { + /* Realign the virtual buffers if at the start of an iMCU row. */ + if (main->rowgroup_ctr == 0) { + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + main->buffer[ci] = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, main->whole_image[ci], + main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE), + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing); + } + /* In a read pass, pretend we just read some source data. */ + if (! writing) { + *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE; + main->rowgroup_ctr = DCTSIZE; + } + } + + /* If a write pass, read input data until the current iMCU row is full. */ + /* Note: preprocessor will pad if necessary to fill the last iMCU row. */ + if (writing) { + (*cinfo->prep->pre_process_data) (cinfo, + input_buf, in_row_ctr, in_rows_avail, + main->buffer, &main->rowgroup_ctr, + (JDIMENSION) DCTSIZE); + /* Return to application if we need more data to fill the iMCU row. */ + if (main->rowgroup_ctr < DCTSIZE) + return; + } + + /* Emit data, unless this is a sink-only pass. */ + if (main->pass_mode != JBUF_SAVE_SOURCE) { + if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { + /* If compressor did not consume the whole row, then we must need to + * suspend processing and return to the application. In this situation + * we pretend we didn't yet consume the last input row; otherwise, if + * it happened to be the last row of the image, the application would + * think we were done. + */ + if (! main->suspended) { + (*in_row_ctr)--; + main->suspended = TRUE; + } + return; + } + /* We did finish the row. Undo our little suspension hack if a previous + * call suspended; then mark the main buffer empty. + */ + if (main->suspended) { + (*in_row_ctr)++; + main->suspended = FALSE; + } + } + + /* If get here, we are done with this iMCU row. Mark buffer empty. */ + main->rowgroup_ctr = 0; + main->cur_iMCU_row++; + } +} + +#endif /* FULL_MAIN_BUFFER_SUPPORTED */ + + +/* + * Initialize main buffer controller. + */ + +GLOBAL(void) +jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) +{ + my_main_ptr main; + int ci; + jpeg_component_info *compptr; + + main = (my_main_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_main_controller)); + cinfo->main = (struct jpeg_c_main_controller *) main; + main->pub.start_pass = start_pass_main; + + /* We don't need to create a buffer in raw-data mode. */ + if (cinfo->raw_data_in) + return; + + /* Create the buffer. It holds downsampled data, so each component + * may be of a different size. + */ + if (need_full_buffer) { +#ifdef FULL_MAIN_BUFFER_SUPPORTED + /* Allocate a full-image virtual array for each component */ + /* Note we pad the bottom to a multiple of the iMCU height */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + compptr->width_in_blocks * DCTSIZE, + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor) * DCTSIZE, + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); + } +#else + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); +#endif + } else { +#ifdef FULL_MAIN_BUFFER_SUPPORTED + main->whole_image[0] = NULL; /* flag for no virtual arrays */ +#endif + /* Allocate a strip buffer for each component */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + main->buffer[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + compptr->width_in_blocks * DCTSIZE, + (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); + } + } +} diff --git a/src/SFML/Graphics/libjpeg/jcmarker.c b/src/SFML/Graphics/libjpeg/jcmarker.c new file mode 100644 index 00000000..0d3ca5e5 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcmarker.c @@ -0,0 +1,664 @@ +/* + * jcmarker.c + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to write JPEG datastream markers. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +typedef enum { /* JPEG marker codes */ + M_SOF0 = 0xc0, + M_SOF1 = 0xc1, + M_SOF2 = 0xc2, + M_SOF3 = 0xc3, + + M_SOF5 = 0xc5, + M_SOF6 = 0xc6, + M_SOF7 = 0xc7, + + M_JPG = 0xc8, + M_SOF9 = 0xc9, + M_SOF10 = 0xca, + M_SOF11 = 0xcb, + + M_SOF13 = 0xcd, + M_SOF14 = 0xce, + M_SOF15 = 0xcf, + + M_DHT = 0xc4, + + M_DAC = 0xcc, + + M_RST0 = 0xd0, + M_RST1 = 0xd1, + M_RST2 = 0xd2, + M_RST3 = 0xd3, + M_RST4 = 0xd4, + M_RST5 = 0xd5, + M_RST6 = 0xd6, + M_RST7 = 0xd7, + + M_SOI = 0xd8, + M_EOI = 0xd9, + M_SOS = 0xda, + M_DQT = 0xdb, + M_DNL = 0xdc, + M_DRI = 0xdd, + M_DHP = 0xde, + M_EXP = 0xdf, + + M_APP0 = 0xe0, + M_APP1 = 0xe1, + M_APP2 = 0xe2, + M_APP3 = 0xe3, + M_APP4 = 0xe4, + M_APP5 = 0xe5, + M_APP6 = 0xe6, + M_APP7 = 0xe7, + M_APP8 = 0xe8, + M_APP9 = 0xe9, + M_APP10 = 0xea, + M_APP11 = 0xeb, + M_APP12 = 0xec, + M_APP13 = 0xed, + M_APP14 = 0xee, + M_APP15 = 0xef, + + M_JPG0 = 0xf0, + M_JPG13 = 0xfd, + M_COM = 0xfe, + + M_TEM = 0x01, + + M_ERROR = 0x100 +} JPEG_MARKER; + + +/* Private state */ + +typedef struct { + struct jpeg_marker_writer pub; /* public fields */ + + unsigned int last_restart_interval; /* last DRI value emitted; 0 after SOI */ +} my_marker_writer; + +typedef my_marker_writer * my_marker_ptr; + + +/* + * Basic output routines. + * + * Note that we do not support suspension while writing a marker. + * Therefore, an application using suspension must ensure that there is + * enough buffer space for the initial markers (typ. 600-700 bytes) before + * calling jpeg_start_compress, and enough space to write the trailing EOI + * (a few bytes) before calling jpeg_finish_compress. Multipass compression + * modes are not supported at all with suspension, so those two are the only + * points where markers will be written. + */ + +LOCAL(void) +emit_byte (j_compress_ptr cinfo, int val) +/* Emit a byte */ +{ + struct jpeg_destination_mgr * dest = cinfo->dest; + + *(dest->next_output_byte)++ = (JOCTET) val; + if (--dest->free_in_buffer == 0) { + if (! (*dest->empty_output_buffer) (cinfo)) + ERREXIT(cinfo, JERR_CANT_SUSPEND); + } +} + + +LOCAL(void) +emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) +/* Emit a marker code */ +{ + emit_byte(cinfo, 0xFF); + emit_byte(cinfo, (int) mark); +} + + +LOCAL(void) +emit_2bytes (j_compress_ptr cinfo, int value) +/* Emit a 2-byte integer; these are always MSB first in JPEG files */ +{ + emit_byte(cinfo, (value >> 8) & 0xFF); + emit_byte(cinfo, value & 0xFF); +} + + +/* + * Routines to write specific marker types. + */ + +LOCAL(int) +emit_dqt (j_compress_ptr cinfo, int index) +/* Emit a DQT marker */ +/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */ +{ + JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index]; + int prec; + int i; + + if (qtbl == NULL) + ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index); + + prec = 0; + for (i = 0; i < DCTSIZE2; i++) { + if (qtbl->quantval[i] > 255) + prec = 1; + } + + if (! qtbl->sent_table) { + emit_marker(cinfo, M_DQT); + + emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2); + + emit_byte(cinfo, index + (prec<<4)); + + for (i = 0; i < DCTSIZE2; i++) { + /* The table entries must be emitted in zigzag order. */ + unsigned int qval = qtbl->quantval[jpeg_natural_order[i]]; + if (prec) + emit_byte(cinfo, (int) (qval >> 8)); + emit_byte(cinfo, (int) (qval & 0xFF)); + } + + qtbl->sent_table = TRUE; + } + + return prec; +} + + +LOCAL(void) +emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) +/* Emit a DHT marker */ +{ + JHUFF_TBL * htbl; + int length, i; + + if (is_ac) { + htbl = cinfo->ac_huff_tbl_ptrs[index]; + index += 0x10; /* output index has AC bit set */ + } else { + htbl = cinfo->dc_huff_tbl_ptrs[index]; + } + + if (htbl == NULL) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); + + if (! htbl->sent_table) { + emit_marker(cinfo, M_DHT); + + length = 0; + for (i = 1; i <= 16; i++) + length += htbl->bits[i]; + + emit_2bytes(cinfo, length + 2 + 1 + 16); + emit_byte(cinfo, index); + + for (i = 1; i <= 16; i++) + emit_byte(cinfo, htbl->bits[i]); + + for (i = 0; i < length; i++) + emit_byte(cinfo, htbl->huffval[i]); + + htbl->sent_table = TRUE; + } +} + + +LOCAL(void) +emit_dac (j_compress_ptr cinfo) +/* Emit a DAC marker */ +/* Since the useful info is so small, we want to emit all the tables in */ +/* one DAC marker. Therefore this routine does its own scan of the table. */ +{ +#ifdef C_ARITH_CODING_SUPPORTED + char dc_in_use[NUM_ARITH_TBLS]; + char ac_in_use[NUM_ARITH_TBLS]; + int length, i; + jpeg_component_info *compptr; + + for (i = 0; i < NUM_ARITH_TBLS; i++) + dc_in_use[i] = ac_in_use[i] = 0; + + for (i = 0; i < cinfo->comps_in_scan; i++) { + compptr = cinfo->cur_comp_info[i]; + dc_in_use[compptr->dc_tbl_no] = 1; + ac_in_use[compptr->ac_tbl_no] = 1; + } + + length = 0; + for (i = 0; i < NUM_ARITH_TBLS; i++) + length += dc_in_use[i] + ac_in_use[i]; + + emit_marker(cinfo, M_DAC); + + emit_2bytes(cinfo, length*2 + 2); + + for (i = 0; i < NUM_ARITH_TBLS; i++) { + if (dc_in_use[i]) { + emit_byte(cinfo, i); + emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); + } + if (ac_in_use[i]) { + emit_byte(cinfo, i + 0x10); + emit_byte(cinfo, cinfo->arith_ac_K[i]); + } + } +#endif /* C_ARITH_CODING_SUPPORTED */ +} + + +LOCAL(void) +emit_dri (j_compress_ptr cinfo) +/* Emit a DRI marker */ +{ + emit_marker(cinfo, M_DRI); + + emit_2bytes(cinfo, 4); /* fixed length */ + + emit_2bytes(cinfo, (int) cinfo->restart_interval); +} + + +LOCAL(void) +emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) +/* Emit a SOF marker */ +{ + int ci; + jpeg_component_info *compptr; + + emit_marker(cinfo, code); + + emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ + + /* Make sure image isn't bigger than SOF field can handle */ + if ((long) cinfo->image_height > 65535L || + (long) cinfo->image_width > 65535L) + ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); + + emit_byte(cinfo, cinfo->data_precision); + emit_2bytes(cinfo, (int) cinfo->image_height); + emit_2bytes(cinfo, (int) cinfo->image_width); + + emit_byte(cinfo, cinfo->num_components); + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + emit_byte(cinfo, compptr->component_id); + emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); + emit_byte(cinfo, compptr->quant_tbl_no); + } +} + + +LOCAL(void) +emit_sos (j_compress_ptr cinfo) +/* Emit a SOS marker */ +{ + int i, td, ta; + jpeg_component_info *compptr; + + emit_marker(cinfo, M_SOS); + + emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ + + emit_byte(cinfo, cinfo->comps_in_scan); + + for (i = 0; i < cinfo->comps_in_scan; i++) { + compptr = cinfo->cur_comp_info[i]; + emit_byte(cinfo, compptr->component_id); + td = compptr->dc_tbl_no; + ta = compptr->ac_tbl_no; + if (cinfo->progressive_mode) { + /* Progressive mode: only DC or only AC tables are used in one scan; + * furthermore, Huffman coding of DC refinement uses no table at all. + * We emit 0 for unused field(s); this is recommended by the P&M text + * but does not seem to be specified in the standard. + */ + if (cinfo->Ss == 0) { + ta = 0; /* DC scan */ + if (cinfo->Ah != 0 && !cinfo->arith_code) + td = 0; /* no DC table either */ + } else { + td = 0; /* AC scan */ + } + } + emit_byte(cinfo, (td << 4) + ta); + } + + emit_byte(cinfo, cinfo->Ss); + emit_byte(cinfo, cinfo->Se); + emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al); +} + + +LOCAL(void) +emit_jfif_app0 (j_compress_ptr cinfo) +/* Emit a JFIF-compliant APP0 marker */ +{ + /* + * Length of APP0 block (2 bytes) + * Block ID (4 bytes - ASCII "JFIF") + * Zero byte (1 byte to terminate the ID string) + * Version Major, Minor (2 bytes - major first) + * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm) + * Xdpu (2 bytes - dots per unit horizontal) + * Ydpu (2 bytes - dots per unit vertical) + * Thumbnail X size (1 byte) + * Thumbnail Y size (1 byte) + */ + + emit_marker(cinfo, M_APP0); + + emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ + + emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ + emit_byte(cinfo, 0x46); + emit_byte(cinfo, 0x49); + emit_byte(cinfo, 0x46); + emit_byte(cinfo, 0); + emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */ + emit_byte(cinfo, cinfo->JFIF_minor_version); + emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ + emit_2bytes(cinfo, (int) cinfo->X_density); + emit_2bytes(cinfo, (int) cinfo->Y_density); + emit_byte(cinfo, 0); /* No thumbnail image */ + emit_byte(cinfo, 0); +} + + +LOCAL(void) +emit_adobe_app14 (j_compress_ptr cinfo) +/* Emit an Adobe APP14 marker */ +{ + /* + * Length of APP14 block (2 bytes) + * Block ID (5 bytes - ASCII "Adobe") + * Version Number (2 bytes - currently 100) + * Flags0 (2 bytes - currently 0) + * Flags1 (2 bytes - currently 0) + * Color transform (1 byte) + * + * Although Adobe TN 5116 mentions Version = 101, all the Adobe files + * now in circulation seem to use Version = 100, so that's what we write. + * + * We write the color transform byte as 1 if the JPEG color space is + * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with + * whether the encoder performed a transformation, which is pretty useless. + */ + + emit_marker(cinfo, M_APP14); + + emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ + + emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ + emit_byte(cinfo, 0x64); + emit_byte(cinfo, 0x6F); + emit_byte(cinfo, 0x62); + emit_byte(cinfo, 0x65); + emit_2bytes(cinfo, 100); /* Version */ + emit_2bytes(cinfo, 0); /* Flags0 */ + emit_2bytes(cinfo, 0); /* Flags1 */ + switch (cinfo->jpeg_color_space) { + case JCS_YCbCr: + emit_byte(cinfo, 1); /* Color transform = 1 */ + break; + case JCS_YCCK: + emit_byte(cinfo, 2); /* Color transform = 2 */ + break; + default: + emit_byte(cinfo, 0); /* Color transform = 0 */ + break; + } +} + + +/* + * These routines allow writing an arbitrary marker with parameters. + * The only intended use is to emit COM or APPn markers after calling + * write_file_header and before calling write_frame_header. + * Other uses are not guaranteed to produce desirable results. + * Counting the parameter bytes properly is the caller's responsibility. + */ + +METHODDEF(void) +write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen) +/* Emit an arbitrary marker header */ +{ + if (datalen > (unsigned int) 65533) /* safety check */ + ERREXIT(cinfo, JERR_BAD_LENGTH); + + emit_marker(cinfo, (JPEG_MARKER) marker); + + emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ +} + +METHODDEF(void) +write_marker_byte (j_compress_ptr cinfo, int val) +/* Emit one byte of marker parameters following write_marker_header */ +{ + emit_byte(cinfo, val); +} + + +/* + * Write datastream header. + * This consists of an SOI and optional APPn markers. + * We recommend use of the JFIF marker, but not the Adobe marker, + * when using YCbCr or grayscale data. The JFIF marker should NOT + * be used for any other JPEG colorspace. The Adobe marker is helpful + * to distinguish RGB, CMYK, and YCCK colorspaces. + * Note that an application can write additional header markers after + * jpeg_start_compress returns. + */ + +METHODDEF(void) +write_file_header (j_compress_ptr cinfo) +{ + my_marker_ptr marker = (my_marker_ptr) cinfo->marker; + + emit_marker(cinfo, M_SOI); /* first the SOI */ + + /* SOI is defined to reset restart interval to 0 */ + marker->last_restart_interval = 0; + + if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ + emit_jfif_app0(cinfo); + if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */ + emit_adobe_app14(cinfo); +} + + +/* + * Write frame header. + * This consists of DQT and SOFn markers. + * Note that we do not emit the SOF until we have emitted the DQT(s). + * This avoids compatibility problems with incorrect implementations that + * try to error-check the quant table numbers as soon as they see the SOF. + */ + +METHODDEF(void) +write_frame_header (j_compress_ptr cinfo) +{ + int ci, prec; + boolean is_baseline; + jpeg_component_info *compptr; + + /* Emit DQT for each quantization table. + * Note that emit_dqt() suppresses any duplicate tables. + */ + prec = 0; + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + prec += emit_dqt(cinfo, compptr->quant_tbl_no); + } + /* now prec is nonzero iff there are any 16-bit quant tables. */ + + /* Check for a non-baseline specification. + * Note we assume that Huffman table numbers won't be changed later. + */ + if (cinfo->arith_code || cinfo->progressive_mode || + cinfo->data_precision != 8) { + is_baseline = FALSE; + } else { + is_baseline = TRUE; + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1) + is_baseline = FALSE; + } + if (prec && is_baseline) { + is_baseline = FALSE; + /* If it's baseline except for quantizer size, warn the user */ + TRACEMS(cinfo, 0, JTRC_16BIT_TABLES); + } + } + + /* Emit the proper SOF marker */ + if (cinfo->arith_code) { + emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */ + } else { + if (cinfo->progressive_mode) + emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ + else if (is_baseline) + emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ + else + emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ + } +} + + +/* + * Write scan header. + * This consists of DHT or DAC markers, optional DRI, and SOS. + * Compressed data will be written following the SOS. + */ + +METHODDEF(void) +write_scan_header (j_compress_ptr cinfo) +{ + my_marker_ptr marker = (my_marker_ptr) cinfo->marker; + int i; + jpeg_component_info *compptr; + + if (cinfo->arith_code) { + /* Emit arith conditioning info. We may have some duplication + * if the file has multiple scans, but it's so small it's hardly + * worth worrying about. + */ + emit_dac(cinfo); + } else { + /* Emit Huffman tables. + * Note that emit_dht() suppresses any duplicate tables. + */ + for (i = 0; i < cinfo->comps_in_scan; i++) { + compptr = cinfo->cur_comp_info[i]; + if (cinfo->progressive_mode) { + /* Progressive mode: only DC or only AC tables are used in one scan */ + if (cinfo->Ss == 0) { + if (cinfo->Ah == 0) /* DC needs no table for refinement scan */ + emit_dht(cinfo, compptr->dc_tbl_no, FALSE); + } else { + emit_dht(cinfo, compptr->ac_tbl_no, TRUE); + } + } else { + /* Sequential mode: need both DC and AC tables */ + emit_dht(cinfo, compptr->dc_tbl_no, FALSE); + emit_dht(cinfo, compptr->ac_tbl_no, TRUE); + } + } + } + + /* Emit DRI if required --- note that DRI value could change for each scan. + * We avoid wasting space with unnecessary DRIs, however. + */ + if (cinfo->restart_interval != marker->last_restart_interval) { + emit_dri(cinfo); + marker->last_restart_interval = cinfo->restart_interval; + } + + emit_sos(cinfo); +} + + +/* + * Write datastream trailer. + */ + +METHODDEF(void) +write_file_trailer (j_compress_ptr cinfo) +{ + emit_marker(cinfo, M_EOI); +} + + +/* + * Write an abbreviated table-specification datastream. + * This consists of SOI, DQT and DHT tables, and EOI. + * Any table that is defined and not marked sent_table = TRUE will be + * emitted. Note that all tables will be marked sent_table = TRUE at exit. + */ + +METHODDEF(void) +write_tables_only (j_compress_ptr cinfo) +{ + int i; + + emit_marker(cinfo, M_SOI); + + for (i = 0; i < NUM_QUANT_TBLS; i++) { + if (cinfo->quant_tbl_ptrs[i] != NULL) + (void) emit_dqt(cinfo, i); + } + + if (! cinfo->arith_code) { + for (i = 0; i < NUM_HUFF_TBLS; i++) { + if (cinfo->dc_huff_tbl_ptrs[i] != NULL) + emit_dht(cinfo, i, FALSE); + if (cinfo->ac_huff_tbl_ptrs[i] != NULL) + emit_dht(cinfo, i, TRUE); + } + } + + emit_marker(cinfo, M_EOI); +} + + +/* + * Initialize the marker writer module. + */ + +GLOBAL(void) +jinit_marker_writer (j_compress_ptr cinfo) +{ + my_marker_ptr marker; + + /* Create the subobject */ + marker = (my_marker_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_marker_writer)); + cinfo->marker = (struct jpeg_marker_writer *) marker; + /* Initialize method pointers */ + marker->pub.write_file_header = write_file_header; + marker->pub.write_frame_header = write_frame_header; + marker->pub.write_scan_header = write_scan_header; + marker->pub.write_file_trailer = write_file_trailer; + marker->pub.write_tables_only = write_tables_only; + marker->pub.write_marker_header = write_marker_header; + marker->pub.write_marker_byte = write_marker_byte; + /* Initialize private state */ + marker->last_restart_interval = 0; +} diff --git a/src/SFML/Graphics/libjpeg/jcmaster.c b/src/SFML/Graphics/libjpeg/jcmaster.c new file mode 100644 index 00000000..e61138b1 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcmaster.c @@ -0,0 +1,590 @@ +/* + * jcmaster.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains master control logic for the JPEG compressor. + * These routines are concerned with parameter validation, initial setup, + * and inter-pass control (determining the number of passes and the work + * to be done in each pass). + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Private state */ + +typedef enum { + main_pass, /* input data, also do first output step */ + huff_opt_pass, /* Huffman code optimization pass */ + output_pass /* data output pass */ +} c_pass_type; + +typedef struct { + struct jpeg_comp_master pub; /* public fields */ + + c_pass_type pass_type; /* the type of the current pass */ + + int pass_number; /* # of passes completed */ + int total_passes; /* total # of passes needed */ + + int scan_number; /* current index in scan_info[] */ +} my_comp_master; + +typedef my_comp_master * my_master_ptr; + + +/* + * Support routines that do various essential calculations. + */ + +LOCAL(void) +initial_setup (j_compress_ptr cinfo) +/* Do computations that are needed before master selection phase */ +{ + int ci; + jpeg_component_info *compptr; + long samplesperrow; + JDIMENSION jd_samplesperrow; + + /* Sanity check on image dimensions */ + if (cinfo->image_height <= 0 || cinfo->image_width <= 0 + || cinfo->num_components <= 0 || cinfo->input_components <= 0) + ERREXIT(cinfo, JERR_EMPTY_IMAGE); + + /* Make sure image isn't bigger than I can handle */ + if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || + (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) + ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); + + /* Width of an input scanline must be representable as JDIMENSION. */ + samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components; + jd_samplesperrow = (JDIMENSION) samplesperrow; + if ((long) jd_samplesperrow != samplesperrow) + ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); + + /* For now, precision must match compiled-in value... */ + if (cinfo->data_precision != BITS_IN_JSAMPLE) + ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); + + /* Check that number of components won't exceed internal array sizes */ + if (cinfo->num_components > MAX_COMPONENTS) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, + MAX_COMPONENTS); + + /* Compute maximum sampling factors; check factor validity */ + cinfo->max_h_samp_factor = 1; + cinfo->max_v_samp_factor = 1; + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || + compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) + ERREXIT(cinfo, JERR_BAD_SAMPLING); + cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, + compptr->h_samp_factor); + cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, + compptr->v_samp_factor); + } + + /* Compute dimensions of components */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Fill in the correct component_index value; don't rely on application */ + compptr->component_index = ci; + /* For compression, we never do DCT scaling. */ + compptr->DCT_scaled_size = DCTSIZE; + /* Size in DCT blocks */ + compptr->width_in_blocks = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + compptr->height_in_blocks = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, + (long) (cinfo->max_v_samp_factor * DCTSIZE)); + /* Size in samples */ + compptr->downsampled_width = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, + (long) cinfo->max_h_samp_factor); + compptr->downsampled_height = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, + (long) cinfo->max_v_samp_factor); + /* Mark component needed (this flag isn't actually used for compression) */ + compptr->component_needed = TRUE; + } + + /* Compute number of fully interleaved MCU rows (number of times that + * main controller will call coefficient controller). + */ + cinfo->total_iMCU_rows = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, + (long) (cinfo->max_v_samp_factor*DCTSIZE)); +} + + +#ifdef C_MULTISCAN_FILES_SUPPORTED + +LOCAL(void) +validate_script (j_compress_ptr cinfo) +/* Verify that the scan script in cinfo->scan_info[] is valid; also + * determine whether it uses progressive JPEG, and set cinfo->progressive_mode. + */ +{ + const jpeg_scan_info * scanptr; + int scanno, ncomps, ci, coefi, thisi; + int Ss, Se, Ah, Al; + boolean component_sent[MAX_COMPONENTS]; +#ifdef C_PROGRESSIVE_SUPPORTED + int * last_bitpos_ptr; + int last_bitpos[MAX_COMPONENTS][DCTSIZE2]; + /* -1 until that coefficient has been seen; then last Al for it */ +#endif + + if (cinfo->num_scans <= 0) + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0); + + /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1; + * for progressive JPEG, no scan can have this. + */ + scanptr = cinfo->scan_info; + if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) { +#ifdef C_PROGRESSIVE_SUPPORTED + cinfo->progressive_mode = TRUE; + last_bitpos_ptr = & last_bitpos[0][0]; + for (ci = 0; ci < cinfo->num_components; ci++) + for (coefi = 0; coefi < DCTSIZE2; coefi++) + *last_bitpos_ptr++ = -1; +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else { + cinfo->progressive_mode = FALSE; + for (ci = 0; ci < cinfo->num_components; ci++) + component_sent[ci] = FALSE; + } + + for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) { + /* Validate component indexes */ + ncomps = scanptr->comps_in_scan; + if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN); + for (ci = 0; ci < ncomps; ci++) { + thisi = scanptr->component_index[ci]; + if (thisi < 0 || thisi >= cinfo->num_components) + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); + /* Components must appear in SOF order within each scan */ + if (ci > 0 && thisi <= scanptr->component_index[ci-1]) + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); + } + /* Validate progression parameters */ + Ss = scanptr->Ss; + Se = scanptr->Se; + Ah = scanptr->Ah; + Al = scanptr->Al; + if (cinfo->progressive_mode) { +#ifdef C_PROGRESSIVE_SUPPORTED + /* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that + * seems wrong: the upper bound ought to depend on data precision. + * Perhaps they really meant 0..N+1 for N-bit precision. + * Here we allow 0..10 for 8-bit data; Al larger than 10 results in + * out-of-range reconstructed DC values during the first DC scan, + * which might cause problems for some decoders. + */ +#if BITS_IN_JSAMPLE == 8 +#define MAX_AH_AL 10 +#else +#define MAX_AH_AL 13 +#endif + if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 || + Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + if (Ss == 0) { + if (Se != 0) /* DC and AC together not OK */ + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + } else { + if (ncomps != 1) /* AC scans must be for only one component */ + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + } + for (ci = 0; ci < ncomps; ci++) { + last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0]; + if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */ + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + for (coefi = Ss; coefi <= Se; coefi++) { + if (last_bitpos_ptr[coefi] < 0) { + /* first scan of this coefficient */ + if (Ah != 0) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + } else { + /* not first scan */ + if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + } + last_bitpos_ptr[coefi] = Al; + } + } +#endif + } else { + /* For sequential JPEG, all progression parameters must be these: */ + if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0) + ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); + /* Make sure components are not sent twice */ + for (ci = 0; ci < ncomps; ci++) { + thisi = scanptr->component_index[ci]; + if (component_sent[thisi]) + ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno); + component_sent[thisi] = TRUE; + } + } + } + + /* Now verify that everything got sent. */ + if (cinfo->progressive_mode) { +#ifdef C_PROGRESSIVE_SUPPORTED + /* For progressive mode, we only check that at least some DC data + * got sent for each component; the spec does not require that all bits + * of all coefficients be transmitted. Would it be wiser to enforce + * transmission of all coefficient bits?? + */ + for (ci = 0; ci < cinfo->num_components; ci++) { + if (last_bitpos[ci][0] < 0) + ERREXIT(cinfo, JERR_MISSING_DATA); + } +#endif + } else { + for (ci = 0; ci < cinfo->num_components; ci++) { + if (! component_sent[ci]) + ERREXIT(cinfo, JERR_MISSING_DATA); + } + } +} + +#endif /* C_MULTISCAN_FILES_SUPPORTED */ + + +LOCAL(void) +select_scan_parameters (j_compress_ptr cinfo) +/* Set up the scan parameters for the current scan */ +{ + int ci; + +#ifdef C_MULTISCAN_FILES_SUPPORTED + if (cinfo->scan_info != NULL) { + /* Prepare for current scan --- the script is already validated */ + my_master_ptr master = (my_master_ptr) cinfo->master; + const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number; + + cinfo->comps_in_scan = scanptr->comps_in_scan; + for (ci = 0; ci < scanptr->comps_in_scan; ci++) { + cinfo->cur_comp_info[ci] = + &cinfo->comp_info[scanptr->component_index[ci]]; + } + cinfo->Ss = scanptr->Ss; + cinfo->Se = scanptr->Se; + cinfo->Ah = scanptr->Ah; + cinfo->Al = scanptr->Al; + } + else +#endif + { + /* Prepare for single sequential-JPEG scan containing all components */ + if (cinfo->num_components > MAX_COMPS_IN_SCAN) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, + MAX_COMPS_IN_SCAN); + cinfo->comps_in_scan = cinfo->num_components; + for (ci = 0; ci < cinfo->num_components; ci++) { + cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci]; + } + cinfo->Ss = 0; + cinfo->Se = DCTSIZE2-1; + cinfo->Ah = 0; + cinfo->Al = 0; + } +} + + +LOCAL(void) +per_scan_setup (j_compress_ptr cinfo) +/* Do computations that are needed before processing a JPEG scan */ +/* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */ +{ + int ci, mcublks, tmp; + jpeg_component_info *compptr; + + if (cinfo->comps_in_scan == 1) { + + /* Noninterleaved (single-component) scan */ + compptr = cinfo->cur_comp_info[0]; + + /* Overall image size in MCUs */ + cinfo->MCUs_per_row = compptr->width_in_blocks; + cinfo->MCU_rows_in_scan = compptr->height_in_blocks; + + /* For noninterleaved scan, always one block per MCU */ + compptr->MCU_width = 1; + compptr->MCU_height = 1; + compptr->MCU_blocks = 1; + compptr->MCU_sample_width = DCTSIZE; + compptr->last_col_width = 1; + /* For noninterleaved scans, it is convenient to define last_row_height + * as the number of block rows present in the last iMCU row. + */ + tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); + if (tmp == 0) tmp = compptr->v_samp_factor; + compptr->last_row_height = tmp; + + /* Prepare array describing MCU composition */ + cinfo->blocks_in_MCU = 1; + cinfo->MCU_membership[0] = 0; + + } else { + + /* Interleaved (multi-component) scan */ + if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, + MAX_COMPS_IN_SCAN); + + /* Overall image size in MCUs */ + cinfo->MCUs_per_row = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width, + (long) (cinfo->max_h_samp_factor*DCTSIZE)); + cinfo->MCU_rows_in_scan = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, + (long) (cinfo->max_v_samp_factor*DCTSIZE)); + + cinfo->blocks_in_MCU = 0; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Sampling factors give # of blocks of component in each MCU */ + compptr->MCU_width = compptr->h_samp_factor; + compptr->MCU_height = compptr->v_samp_factor; + compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; + compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE; + /* Figure number of non-dummy blocks in last MCU column & row */ + tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); + if (tmp == 0) tmp = compptr->MCU_width; + compptr->last_col_width = tmp; + tmp = (int) (compptr->height_in_blocks % compptr->MCU_height); + if (tmp == 0) tmp = compptr->MCU_height; + compptr->last_row_height = tmp; + /* Prepare array describing MCU composition */ + mcublks = compptr->MCU_blocks; + if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU) + ERREXIT(cinfo, JERR_BAD_MCU_SIZE); + while (mcublks-- > 0) { + cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; + } + } + + } + + /* Convert restart specified in rows to actual MCU count. */ + /* Note that count must fit in 16 bits, so we provide limiting. */ + if (cinfo->restart_in_rows > 0) { + long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row; + cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L); + } +} + + +/* + * Per-pass setup. + * This is called at the beginning of each pass. We determine which modules + * will be active during this pass and give them appropriate start_pass calls. + * We also set is_last_pass to indicate whether any more passes will be + * required. + */ + +METHODDEF(void) +prepare_for_pass (j_compress_ptr cinfo) +{ + my_master_ptr master = (my_master_ptr) cinfo->master; + + switch (master->pass_type) { + case main_pass: + /* Initial pass: will collect input data, and do either Huffman + * optimization or data output for the first scan. + */ + select_scan_parameters(cinfo); + per_scan_setup(cinfo); + if (! cinfo->raw_data_in) { + (*cinfo->cconvert->start_pass) (cinfo); + (*cinfo->downsample->start_pass) (cinfo); + (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU); + } + (*cinfo->fdct->start_pass) (cinfo); + (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding); + (*cinfo->coef->start_pass) (cinfo, + (master->total_passes > 1 ? + JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); + (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); + if (cinfo->optimize_coding) { + /* No immediate data output; postpone writing frame/scan headers */ + master->pub.call_pass_startup = FALSE; + } else { + /* Will write frame/scan headers at first jpeg_write_scanlines call */ + master->pub.call_pass_startup = TRUE; + } + break; +#ifdef ENTROPY_OPT_SUPPORTED + case huff_opt_pass: + /* Do Huffman optimization for a scan after the first one. */ + select_scan_parameters(cinfo); + per_scan_setup(cinfo); + if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) { + (*cinfo->entropy->start_pass) (cinfo, TRUE); + (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); + master->pub.call_pass_startup = FALSE; + break; + } + /* Special case: Huffman DC refinement scans need no Huffman table + * and therefore we can skip the optimization pass for them. + */ + master->pass_type = output_pass; + master->pass_number++; + /*FALLTHROUGH*/ +#endif + case output_pass: + /* Do a data-output pass. */ + /* We need not repeat per-scan setup if prior optimization pass did it. */ + if (! cinfo->optimize_coding) { + select_scan_parameters(cinfo); + per_scan_setup(cinfo); + } + (*cinfo->entropy->start_pass) (cinfo, FALSE); + (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST); + /* We emit frame/scan headers now */ + if (master->scan_number == 0) + (*cinfo->marker->write_frame_header) (cinfo); + (*cinfo->marker->write_scan_header) (cinfo); + master->pub.call_pass_startup = FALSE; + break; + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + } + + master->pub.is_last_pass = (master->pass_number == master->total_passes-1); + + /* Set up progress monitor's pass info if present */ + if (cinfo->progress != NULL) { + cinfo->progress->completed_passes = master->pass_number; + cinfo->progress->total_passes = master->total_passes; + } +} + + +/* + * Special start-of-pass hook. + * This is called by jpeg_write_scanlines if call_pass_startup is TRUE. + * In single-pass processing, we need this hook because we don't want to + * write frame/scan headers during jpeg_start_compress; we want to let the + * application write COM markers etc. between jpeg_start_compress and the + * jpeg_write_scanlines loop. + * In multi-pass processing, this routine is not used. + */ + +METHODDEF(void) +pass_startup (j_compress_ptr cinfo) +{ + cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */ + + (*cinfo->marker->write_frame_header) (cinfo); + (*cinfo->marker->write_scan_header) (cinfo); +} + + +/* + * Finish up at end of pass. + */ + +METHODDEF(void) +finish_pass_master (j_compress_ptr cinfo) +{ + my_master_ptr master = (my_master_ptr) cinfo->master; + + /* The entropy coder always needs an end-of-pass call, + * either to analyze statistics or to flush its output buffer. + */ + (*cinfo->entropy->finish_pass) (cinfo); + + /* Update state for next pass */ + switch (master->pass_type) { + case main_pass: + /* next pass is either output of scan 0 (after optimization) + * or output of scan 1 (if no optimization). + */ + master->pass_type = output_pass; + if (! cinfo->optimize_coding) + master->scan_number++; + break; + case huff_opt_pass: + /* next pass is always output of current scan */ + master->pass_type = output_pass; + break; + case output_pass: + /* next pass is either optimization or output of next scan */ + if (cinfo->optimize_coding) + master->pass_type = huff_opt_pass; + master->scan_number++; + break; + } + + master->pass_number++; +} + + +/* + * Initialize master compression control. + */ + +GLOBAL(void) +jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only) +{ + my_master_ptr master; + + master = (my_master_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_comp_master)); + cinfo->master = (struct jpeg_comp_master *) master; + master->pub.prepare_for_pass = prepare_for_pass; + master->pub.pass_startup = pass_startup; + master->pub.finish_pass = finish_pass_master; + master->pub.is_last_pass = FALSE; + + /* Validate parameters, determine derived values */ + initial_setup(cinfo); + + if (cinfo->scan_info != NULL) { +#ifdef C_MULTISCAN_FILES_SUPPORTED + validate_script(cinfo); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else { + cinfo->progressive_mode = FALSE; + cinfo->num_scans = 1; + } + + if (cinfo->progressive_mode) /* TEMPORARY HACK ??? */ + cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */ + + /* Initialize my private state */ + if (transcode_only) { + /* no main pass in transcoding */ + if (cinfo->optimize_coding) + master->pass_type = huff_opt_pass; + else + master->pass_type = output_pass; + } else { + /* for normal compression, first pass is always this type: */ + master->pass_type = main_pass; + } + master->scan_number = 0; + master->pass_number = 0; + if (cinfo->optimize_coding) + master->total_passes = cinfo->num_scans * 2; + else + master->total_passes = cinfo->num_scans; +} diff --git a/src/SFML/Graphics/libjpeg/jcomapi.c b/src/SFML/Graphics/libjpeg/jcomapi.c new file mode 100644 index 00000000..1b1a340c --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcomapi.c @@ -0,0 +1,106 @@ +/* + * jcomapi.c + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains application interface routines that are used for both + * compression and decompression. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * Abort processing of a JPEG compression or decompression operation, + * but don't destroy the object itself. + * + * For this, we merely clean up all the nonpermanent memory pools. + * Note that temp files (virtual arrays) are not allowed to belong to + * the permanent pool, so we will be able to close all temp files here. + * Closing a data source or destination, if necessary, is the application's + * responsibility. + */ + +GLOBAL(void) +jpeg_abort (j_common_ptr cinfo) +{ + int pool; + + /* Do nothing if called on a not-initialized or destroyed JPEG object. */ + if (cinfo->mem == NULL) + return; + + /* Releasing pools in reverse order might help avoid fragmentation + * with some (brain-damaged) malloc libraries. + */ + for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) { + (*cinfo->mem->free_pool) (cinfo, pool); + } + + /* Reset overall state for possible reuse of object */ + if (cinfo->is_decompressor) { + cinfo->global_state = DSTATE_START; + /* Try to keep application from accessing now-deleted marker list. + * A bit kludgy to do it here, but this is the most central place. + */ + ((j_decompress_ptr) cinfo)->marker_list = NULL; + } else { + cinfo->global_state = CSTATE_START; + } +} + + +/* + * Destruction of a JPEG object. + * + * Everything gets deallocated except the master jpeg_compress_struct itself + * and the error manager struct. Both of these are supplied by the application + * and must be freed, if necessary, by the application. (Often they are on + * the stack and so don't need to be freed anyway.) + * Closing a data source or destination, if necessary, is the application's + * responsibility. + */ + +GLOBAL(void) +jpeg_destroy (j_common_ptr cinfo) +{ + /* We need only tell the memory manager to release everything. */ + /* NB: mem pointer is NULL if memory mgr failed to initialize. */ + if (cinfo->mem != NULL) + (*cinfo->mem->self_destruct) (cinfo); + cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ + cinfo->global_state = 0; /* mark it destroyed */ +} + + +/* + * Convenience routines for allocating quantization and Huffman tables. + * (Would jutils.c be a more reasonable place to put these?) + */ + +GLOBAL(JQUANT_TBL *) +jpeg_alloc_quant_table (j_common_ptr cinfo) +{ + JQUANT_TBL *tbl; + + tbl = (JQUANT_TBL *) + (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); + tbl->sent_table = FALSE; /* make sure this is false in any new table */ + return tbl; +} + + +GLOBAL(JHUFF_TBL *) +jpeg_alloc_huff_table (j_common_ptr cinfo) +{ + JHUFF_TBL *tbl; + + tbl = (JHUFF_TBL *) + (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); + tbl->sent_table = FALSE; /* make sure this is false in any new table */ + return tbl; +} diff --git a/src/SFML/Graphics/libjpeg/jconfig.h b/src/SFML/Graphics/libjpeg/jconfig.h new file mode 100644 index 00000000..2f4da14c --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jconfig.h @@ -0,0 +1,45 @@ +/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ +/* see jconfig.doc for explanations */ + +#define HAVE_PROTOTYPES +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT +/* #define void char */ +/* #define const */ +#undef CHAR_IS_UNSIGNED +#define HAVE_STDDEF_H +#define HAVE_STDLIB_H +#undef NEED_BSD_STRINGS +#undef NEED_SYS_TYPES_H +#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ +#undef NEED_SHORT_EXTERNAL_NAMES +#undef INCOMPLETE_TYPES_BROKEN + +/* Define "boolean" as unsigned char, not int, per Windows custom */ +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ + + +#ifdef JPEG_INTERNALS + +#undef RIGHT_SHIFT_IS_UNSIGNED + +#endif /* JPEG_INTERNALS */ + +#ifdef JPEG_CJPEG_DJPEG + +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +#undef RLE_SUPPORTED /* Utah RLE image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ + +#define TWO_FILE_COMMANDLINE /* optional */ +#define USE_SETMODE /* Microsoft has setmode() */ +#undef NEED_SIGNAL_CATCHER +#undef DONT_USE_B_MODE +#undef PROGRESS_REPORT /* optional */ + +#endif /* JPEG_CJPEG_DJPEG */ diff --git a/src/SFML/Graphics/libjpeg/jcparam.c b/src/SFML/Graphics/libjpeg/jcparam.c new file mode 100644 index 00000000..bbd175c8 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcparam.c @@ -0,0 +1,610 @@ +/* + * jcparam.c + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains optional default-setting code for the JPEG compressor. + * Applications do not have to use this file, but those that don't use it + * must know a lot more about the innards of the JPEG code. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * Quantization table setup routines + */ + +GLOBAL(void) +jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, boolean force_baseline) +/* Define a quantization table equal to the basic_table times + * a scale factor (given as a percentage). + * If force_baseline is TRUE, the computed quantization table entries + * are limited to 1..255 for JPEG baseline compatibility. + */ +{ + JQUANT_TBL ** qtblptr; + int i; + long temp; + + /* Safety check to ensure start_compress not called yet. */ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS) + ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl); + + qtblptr = & cinfo->quant_tbl_ptrs[which_tbl]; + + if (*qtblptr == NULL) + *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo); + + for (i = 0; i < DCTSIZE2; i++) { + temp = ((long) basic_table[i] * scale_factor + 50L) / 100L; + /* limit the values to the valid range */ + if (temp <= 0L) temp = 1L; + if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */ + if (force_baseline && temp > 255L) + temp = 255L; /* limit to baseline range if requested */ + (*qtblptr)->quantval[i] = (UINT16) temp; + } + + /* Initialize sent_table FALSE so table will be written to JPEG file. */ + (*qtblptr)->sent_table = FALSE; +} + + +GLOBAL(void) +jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor, + boolean force_baseline) +/* Set or change the 'quality' (quantization) setting, using default tables + * and a straight percentage-scaling quality scale. In most cases it's better + * to use jpeg_set_quality (below); this entry point is provided for + * applications that insist on a linear percentage scaling. + */ +{ + /* These are the sample quantization tables given in JPEG spec section K.1. + * The spec says that the values given produce "good" quality, and + * when divided by 2, "very good" quality. + */ + static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = { + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68, 109, 103, 77, + 24, 35, 55, 64, 81, 104, 113, 92, + 49, 64, 78, 87, 103, 121, 120, 101, + 72, 92, 95, 98, 112, 100, 103, 99 + }; + static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = { + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + }; + + /* Set up two quantization tables using the specified scaling */ + jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl, + scale_factor, force_baseline); + jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl, + scale_factor, force_baseline); +} + + +GLOBAL(int) +jpeg_quality_scaling (int quality) +/* Convert a user-specified quality rating to a percentage scaling factor + * for an underlying quantization table, using our recommended scaling curve. + * The input 'quality' factor should be 0 (terrible) to 100 (very good). + */ +{ + /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */ + if (quality <= 0) quality = 1; + if (quality > 100) quality = 100; + + /* The basic table is used as-is (scaling 100) for a quality of 50. + * Qualities 50..100 are converted to scaling percentage 200 - 2*Q; + * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table + * to make all the table entries 1 (hence, minimum quantization loss). + * Qualities 1..50 are converted to scaling percentage 5000/Q. + */ + if (quality < 50) + quality = 5000 / quality; + else + quality = 200 - quality*2; + + return quality; +} + + +GLOBAL(void) +jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline) +/* Set or change the 'quality' (quantization) setting, using default tables. + * This is the standard quality-adjusting entry point for typical user + * interfaces; only those who want detailed control over quantization tables + * would use the preceding three routines directly. + */ +{ + /* Convert user 0-100 rating to percentage scaling */ + quality = jpeg_quality_scaling(quality); + + /* Set up standard quality tables */ + jpeg_set_linear_quality(cinfo, quality, force_baseline); +} + + +/* + * Huffman table setup routines + */ + +LOCAL(void) +add_huff_table (j_compress_ptr cinfo, + JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) +/* Define a Huffman table */ +{ + int nsymbols, len; + + if (*htblptr == NULL) + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + + /* Copy the number-of-symbols-of-each-code-length counts */ + MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); + + /* Validate the counts. We do this here mainly so we can copy the right + * number of symbols from the val[] array, without risking marching off + * the end of memory. jchuff.c will do a more thorough test later. + */ + nsymbols = 0; + for (len = 1; len <= 16; len++) + nsymbols += bits[len]; + if (nsymbols < 1 || nsymbols > 256) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + + MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8)); + + /* Initialize sent_table FALSE so table will be written to JPEG file. */ + (*htblptr)->sent_table = FALSE; +} + + +LOCAL(void) +std_huff_tables (j_compress_ptr cinfo) +/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ +/* IMPORTANT: these are only valid for 8-bit data precision! */ +{ + static const UINT8 bits_dc_luminance[17] = + { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; + static const UINT8 val_dc_luminance[] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + + static const UINT8 bits_dc_chrominance[17] = + { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; + static const UINT8 val_dc_chrominance[] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + + static const UINT8 bits_ac_luminance[17] = + { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; + static const UINT8 val_ac_luminance[] = + { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa }; + + static const UINT8 bits_ac_chrominance[17] = + { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; + static const UINT8 val_ac_chrominance[] = + { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa }; + + add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0], + bits_dc_luminance, val_dc_luminance); + add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0], + bits_ac_luminance, val_ac_luminance); + add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1], + bits_dc_chrominance, val_dc_chrominance); + add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1], + bits_ac_chrominance, val_ac_chrominance); +} + + +/* + * Default parameter setup for compression. + * + * Applications that don't choose to use this routine must do their + * own setup of all these parameters. Alternately, you can call this + * to establish defaults and then alter parameters selectively. This + * is the recommended approach since, if we add any new parameters, + * your code will still work (they'll be set to reasonable defaults). + */ + +GLOBAL(void) +jpeg_set_defaults (j_compress_ptr cinfo) +{ + int i; + + /* Safety check to ensure start_compress not called yet. */ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + /* Allocate comp_info array large enough for maximum component count. + * Array is made permanent in case application wants to compress + * multiple images at same param settings. + */ + if (cinfo->comp_info == NULL) + cinfo->comp_info = (jpeg_component_info *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + MAX_COMPONENTS * SIZEOF(jpeg_component_info)); + + /* Initialize everything not dependent on the color space */ + + cinfo->data_precision = BITS_IN_JSAMPLE; + /* Set up two quantization tables using default quality of 75 */ + jpeg_set_quality(cinfo, 75, TRUE); + /* Set up two Huffman tables */ + std_huff_tables(cinfo); + + /* Initialize default arithmetic coding conditioning */ + for (i = 0; i < NUM_ARITH_TBLS; i++) { + cinfo->arith_dc_L[i] = 0; + cinfo->arith_dc_U[i] = 1; + cinfo->arith_ac_K[i] = 5; + } + + /* Default is no multiple-scan output */ + cinfo->scan_info = NULL; + cinfo->num_scans = 0; + + /* Expect normal source image, not raw downsampled data */ + cinfo->raw_data_in = FALSE; + + /* Use Huffman coding, not arithmetic coding, by default */ + cinfo->arith_code = FALSE; + + /* By default, don't do extra passes to optimize entropy coding */ + cinfo->optimize_coding = FALSE; + /* The standard Huffman tables are only valid for 8-bit data precision. + * If the precision is higher, force optimization on so that usable + * tables will be computed. This test can be removed if default tables + * are supplied that are valid for the desired precision. + */ + if (cinfo->data_precision > 8) + cinfo->optimize_coding = TRUE; + + /* By default, use the simpler non-cosited sampling alignment */ + cinfo->CCIR601_sampling = FALSE; + + /* No input smoothing */ + cinfo->smoothing_factor = 0; + + /* DCT algorithm preference */ + cinfo->dct_method = JDCT_DEFAULT; + + /* No restart markers */ + cinfo->restart_interval = 0; + cinfo->restart_in_rows = 0; + + /* Fill in default JFIF marker parameters. Note that whether the marker + * will actually be written is determined by jpeg_set_colorspace. + * + * By default, the library emits JFIF version code 1.01. + * An application that wants to emit JFIF 1.02 extension markers should set + * JFIF_minor_version to 2. We could probably get away with just defaulting + * to 1.02, but there may still be some decoders in use that will complain + * about that; saying 1.01 should minimize compatibility problems. + */ + cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */ + cinfo->JFIF_minor_version = 1; + cinfo->density_unit = 0; /* Pixel size is unknown by default */ + cinfo->X_density = 1; /* Pixel aspect ratio is square by default */ + cinfo->Y_density = 1; + + /* Choose JPEG colorspace based on input space, set defaults accordingly */ + + jpeg_default_colorspace(cinfo); +} + + +/* + * Select an appropriate JPEG colorspace for in_color_space. + */ + +GLOBAL(void) +jpeg_default_colorspace (j_compress_ptr cinfo) +{ + switch (cinfo->in_color_space) { + case JCS_GRAYSCALE: + jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); + break; + case JCS_RGB: + jpeg_set_colorspace(cinfo, JCS_YCbCr); + break; + case JCS_YCbCr: + jpeg_set_colorspace(cinfo, JCS_YCbCr); + break; + case JCS_CMYK: + jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */ + break; + case JCS_YCCK: + jpeg_set_colorspace(cinfo, JCS_YCCK); + break; + case JCS_UNKNOWN: + jpeg_set_colorspace(cinfo, JCS_UNKNOWN); + break; + default: + ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE); + } +} + + +/* + * Set the JPEG colorspace, and choose colorspace-dependent default values. + */ + +GLOBAL(void) +jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace) +{ + jpeg_component_info * compptr; + int ci; + +#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \ + (compptr = &cinfo->comp_info[index], \ + compptr->component_id = (id), \ + compptr->h_samp_factor = (hsamp), \ + compptr->v_samp_factor = (vsamp), \ + compptr->quant_tbl_no = (quant), \ + compptr->dc_tbl_no = (dctbl), \ + compptr->ac_tbl_no = (actbl) ) + + /* Safety check to ensure start_compress not called yet. */ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + /* For all colorspaces, we use Q and Huff tables 0 for luminance components, + * tables 1 for chrominance components. + */ + + cinfo->jpeg_color_space = colorspace; + + cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */ + cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */ + + switch (colorspace) { + case JCS_GRAYSCALE: + cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ + cinfo->num_components = 1; + /* JFIF specifies component ID 1 */ + SET_COMP(0, 1, 1,1, 0, 0,0); + break; + case JCS_RGB: + cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */ + cinfo->num_components = 3; + SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0); + SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0); + SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0); + break; + case JCS_YCbCr: + cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */ + cinfo->num_components = 3; + /* JFIF specifies component IDs 1,2,3 */ + /* We default to 2x2 subsamples of chrominance */ + SET_COMP(0, 1, 2,2, 0, 0,0); + SET_COMP(1, 2, 1,1, 1, 1,1); + SET_COMP(2, 3, 1,1, 1, 1,1); + break; + case JCS_CMYK: + cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */ + cinfo->num_components = 4; + SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0); + SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0); + SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0); + SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0); + break; + case JCS_YCCK: + cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */ + cinfo->num_components = 4; + SET_COMP(0, 1, 2,2, 0, 0,0); + SET_COMP(1, 2, 1,1, 1, 1,1); + SET_COMP(2, 3, 1,1, 1, 1,1); + SET_COMP(3, 4, 2,2, 0, 0,0); + break; + case JCS_UNKNOWN: + cinfo->num_components = cinfo->input_components; + if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, + MAX_COMPONENTS); + for (ci = 0; ci < cinfo->num_components; ci++) { + SET_COMP(ci, ci, 1,1, 0, 0,0); + } + break; + default: + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + } +} + + +#ifdef C_PROGRESSIVE_SUPPORTED + +LOCAL(jpeg_scan_info *) +fill_a_scan (jpeg_scan_info * scanptr, int ci, + int Ss, int Se, int Ah, int Al) +/* Support routine: generate one scan for specified component */ +{ + scanptr->comps_in_scan = 1; + scanptr->component_index[0] = ci; + scanptr->Ss = Ss; + scanptr->Se = Se; + scanptr->Ah = Ah; + scanptr->Al = Al; + scanptr++; + return scanptr; +} + +LOCAL(jpeg_scan_info *) +fill_scans (jpeg_scan_info * scanptr, int ncomps, + int Ss, int Se, int Ah, int Al) +/* Support routine: generate one scan for each component */ +{ + int ci; + + for (ci = 0; ci < ncomps; ci++) { + scanptr->comps_in_scan = 1; + scanptr->component_index[0] = ci; + scanptr->Ss = Ss; + scanptr->Se = Se; + scanptr->Ah = Ah; + scanptr->Al = Al; + scanptr++; + } + return scanptr; +} + +LOCAL(jpeg_scan_info *) +fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al) +/* Support routine: generate interleaved DC scan if possible, else N scans */ +{ + int ci; + + if (ncomps <= MAX_COMPS_IN_SCAN) { + /* Single interleaved DC scan */ + scanptr->comps_in_scan = ncomps; + for (ci = 0; ci < ncomps; ci++) + scanptr->component_index[ci] = ci; + scanptr->Ss = scanptr->Se = 0; + scanptr->Ah = Ah; + scanptr->Al = Al; + scanptr++; + } else { + /* Noninterleaved DC scan for each component */ + scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al); + } + return scanptr; +} + + +/* + * Create a recommended progressive-JPEG script. + * cinfo->num_components and cinfo->jpeg_color_space must be correct. + */ + +GLOBAL(void) +jpeg_simple_progression (j_compress_ptr cinfo) +{ + int ncomps = cinfo->num_components; + int nscans; + jpeg_scan_info * scanptr; + + /* Safety check to ensure start_compress not called yet. */ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + /* Figure space needed for script. Calculation must match code below! */ + if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { + /* Custom script for YCbCr color images. */ + nscans = 10; + } else { + /* All-purpose script for other color spaces. */ + if (ncomps > MAX_COMPS_IN_SCAN) + nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */ + else + nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */ + } + + /* Allocate space for script. + * We need to put it in the permanent pool in case the application performs + * multiple compressions without changing the settings. To avoid a memory + * leak if jpeg_simple_progression is called repeatedly for the same JPEG + * object, we try to re-use previously allocated space, and we allocate + * enough space to handle YCbCr even if initially asked for grayscale. + */ + if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) { + cinfo->script_space_size = MAX(nscans, 10); + cinfo->script_space = (jpeg_scan_info *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + cinfo->script_space_size * SIZEOF(jpeg_scan_info)); + } + scanptr = cinfo->script_space; + cinfo->scan_info = scanptr; + cinfo->num_scans = nscans; + + if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) { + /* Custom script for YCbCr color images. */ + /* Initial DC scan */ + scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); + /* Initial AC scan: get some luma data out in a hurry */ + scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2); + /* Chroma data is too small to be worth expending many scans on */ + scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1); + scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1); + /* Complete spectral selection for luma AC */ + scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2); + /* Refine next bit of luma AC */ + scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1); + /* Finish DC successive approximation */ + scanptr = fill_dc_scans(scanptr, ncomps, 1, 0); + /* Finish AC successive approximation */ + scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0); + scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0); + /* Luma bottom bit comes last since it's usually largest scan */ + scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0); + } else { + /* All-purpose script for other color spaces. */ + /* Successive approximation first pass */ + scanptr = fill_dc_scans(scanptr, ncomps, 0, 1); + scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2); + scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2); + /* Successive approximation second pass */ + scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1); + /* Successive approximation final pass */ + scanptr = fill_dc_scans(scanptr, ncomps, 1, 0); + scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0); + } +} + +#endif /* C_PROGRESSIVE_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jcphuff.c b/src/SFML/Graphics/libjpeg/jcphuff.c new file mode 100644 index 00000000..a4ee850e --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcphuff.c @@ -0,0 +1,833 @@ +/* + * jcphuff.c + * + * Copyright (C) 1995-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains Huffman entropy encoding routines for progressive JPEG. + * + * We do not support output suspension in this module, since the library + * currently does not allow multiple-scan files to be written with output + * suspension. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jchuff.h" /* Declarations shared with jchuff.c */ + +#ifdef C_PROGRESSIVE_SUPPORTED + +/* Expanded entropy encoder object for progressive Huffman encoding. */ + +typedef struct { + struct jpeg_entropy_encoder pub; /* public fields */ + + /* Mode flag: TRUE for optimization, FALSE for actual data output */ + boolean gather_statistics; + + /* Bit-level coding status. + * next_output_byte/free_in_buffer are local copies of cinfo->dest fields. + */ + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + INT32 put_buffer; /* current bit-accumulation buffer */ + int put_bits; /* # of bits now in it */ + j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ + + /* Coding status for DC components */ + int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ + + /* Coding status for AC components */ + int ac_tbl_no; /* the table number of the single component */ + unsigned int EOBRUN; /* run length of EOBs */ + unsigned int BE; /* # of buffered correction bits before MCU */ + char * bit_buffer; /* buffer for correction bits (1 per char) */ + /* packing correction bits tightly would save some space but cost time... */ + + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + int next_restart_num; /* next restart number to write (0-7) */ + + /* Pointers to derived tables (these workspaces have image lifespan). + * Since any one scan codes only DC or only AC, we only need one set + * of tables, not one for DC and one for AC. + */ + c_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; + + /* Statistics tables for optimization; again, one set is enough */ + long * count_ptrs[NUM_HUFF_TBLS]; +} phuff_entropy_encoder; + +typedef phuff_entropy_encoder * phuff_entropy_ptr; + +/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit + * buffer can hold. Larger sizes may slightly improve compression, but + * 1000 is already well into the realm of overkill. + * The minimum safe size is 64 bits. + */ + +#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ + +/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. + * We assume that int right shift is unsigned if INT32 right shift is, + * which should be safe. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define ISHIFT_TEMPS int ishift_temp; +#define IRIGHT_SHIFT(x,shft) \ + ((ishift_temp = (x)) < 0 ? \ + (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \ + (ishift_temp >> (shft))) +#else +#define ISHIFT_TEMPS +#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#endif + +/* Forward declarations */ +METHODDEF(boolean) encode_mcu_DC_first JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) encode_mcu_AC_first JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) encode_mcu_DC_refine JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) encode_mcu_AC_refine JPP((j_compress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo)); +METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo)); + + +/* + * Initialize for a Huffman-compressed scan using progressive JPEG. + */ + +METHODDEF(void) +start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + boolean is_DC_band; + int ci, tbl; + jpeg_component_info * compptr; + + entropy->cinfo = cinfo; + entropy->gather_statistics = gather_statistics; + + is_DC_band = (cinfo->Ss == 0); + + /* We assume jcmaster.c already validated the scan parameters. */ + + /* Select execution routines */ + if (cinfo->Ah == 0) { + if (is_DC_band) + entropy->pub.encode_mcu = encode_mcu_DC_first; + else + entropy->pub.encode_mcu = encode_mcu_AC_first; + } else { + if (is_DC_band) + entropy->pub.encode_mcu = encode_mcu_DC_refine; + else { + entropy->pub.encode_mcu = encode_mcu_AC_refine; + /* AC refinement needs a correction bit buffer */ + if (entropy->bit_buffer == NULL) + entropy->bit_buffer = (char *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + MAX_CORR_BITS * SIZEOF(char)); + } + } + if (gather_statistics) + entropy->pub.finish_pass = finish_pass_gather_phuff; + else + entropy->pub.finish_pass = finish_pass_phuff; + + /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1 + * for AC coefficients. + */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Initialize DC predictions to 0 */ + entropy->last_dc_val[ci] = 0; + /* Get table index */ + if (is_DC_band) { + if (cinfo->Ah != 0) /* DC refinement needs no table */ + continue; + tbl = compptr->dc_tbl_no; + } else { + entropy->ac_tbl_no = tbl = compptr->ac_tbl_no; + } + if (gather_statistics) { + /* Check for invalid table index */ + /* (make_c_derived_tbl does this in the other path) */ + if (tbl < 0 || tbl >= NUM_HUFF_TBLS) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl); + /* Allocate and zero the statistics tables */ + /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */ + if (entropy->count_ptrs[tbl] == NULL) + entropy->count_ptrs[tbl] = (long *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 257 * SIZEOF(long)); + MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long)); + } else { + /* Compute derived values for Huffman table */ + /* We may do this more than once for a table, but it's not expensive */ + jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl, + & entropy->derived_tbls[tbl]); + } + } + + /* Initialize AC stuff */ + entropy->EOBRUN = 0; + entropy->BE = 0; + + /* Initialize bit buffer to empty */ + entropy->put_buffer = 0; + entropy->put_bits = 0; + + /* Initialize restart stuff */ + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num = 0; +} + + +/* Outputting bytes to the file. + * NB: these must be called only when actually outputting, + * that is, entropy->gather_statistics == FALSE. + */ + +/* Emit a byte */ +#define emit_byte(entropy,val) \ + { *(entropy)->next_output_byte++ = (JOCTET) (val); \ + if (--(entropy)->free_in_buffer == 0) \ + dump_buffer(entropy); } + + +LOCAL(void) +dump_buffer (phuff_entropy_ptr entropy) +/* Empty the output buffer; we do not support suspension in this module. */ +{ + struct jpeg_destination_mgr * dest = entropy->cinfo->dest; + + if (! (*dest->empty_output_buffer) (entropy->cinfo)) + ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND); + /* After a successful buffer dump, must reset buffer pointers */ + entropy->next_output_byte = dest->next_output_byte; + entropy->free_in_buffer = dest->free_in_buffer; +} + + +/* Outputting bits to the file */ + +/* Only the right 24 bits of put_buffer are used; the valid bits are + * left-justified in this part. At most 16 bits can be passed to emit_bits + * in one call, and we never retain more than 7 bits in put_buffer + * between calls, so 24 bits are sufficient. + */ + +INLINE +LOCAL(void) +emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) +/* Emit some bits, unless we are in gather mode */ +{ + /* This routine is heavily used, so it's worth coding tightly. */ + register INT32 put_buffer = (INT32) code; + register int put_bits = entropy->put_bits; + + /* if size is 0, caller used an invalid Huffman table entry */ + if (size == 0) + ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); + + if (entropy->gather_statistics) + return; /* do nothing if we're only getting stats */ + + put_buffer &= (((INT32) 1)<put_buffer; /* and merge with old buffer contents */ + + while (put_bits >= 8) { + int c = (int) ((put_buffer >> 16) & 0xFF); + + emit_byte(entropy, c); + if (c == 0xFF) { /* need to stuff a zero byte? */ + emit_byte(entropy, 0); + } + put_buffer <<= 8; + put_bits -= 8; + } + + entropy->put_buffer = put_buffer; /* update variables */ + entropy->put_bits = put_bits; +} + + +LOCAL(void) +flush_bits (phuff_entropy_ptr entropy) +{ + emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */ + entropy->put_buffer = 0; /* and reset bit-buffer to empty */ + entropy->put_bits = 0; +} + + +/* + * Emit (or just count) a Huffman symbol. + */ + +INLINE +LOCAL(void) +emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) +{ + if (entropy->gather_statistics) + entropy->count_ptrs[tbl_no][symbol]++; + else { + c_derived_tbl * tbl = entropy->derived_tbls[tbl_no]; + emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); + } +} + + +/* + * Emit bits from a correction bit buffer. + */ + +LOCAL(void) +emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, + unsigned int nbits) +{ + if (entropy->gather_statistics) + return; /* no real work */ + + while (nbits > 0) { + emit_bits(entropy, (unsigned int) (*bufstart), 1); + bufstart++; + nbits--; + } +} + + +/* + * Emit any pending EOBRUN symbol. + */ + +LOCAL(void) +emit_eobrun (phuff_entropy_ptr entropy) +{ + register int temp, nbits; + + if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ + temp = entropy->EOBRUN; + nbits = 0; + while ((temp >>= 1)) + nbits++; + /* safety check: shouldn't happen given limited correction-bit buffer */ + if (nbits > 14) + ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); + + emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4); + if (nbits) + emit_bits(entropy, entropy->EOBRUN, nbits); + + entropy->EOBRUN = 0; + + /* Emit any buffered correction bits */ + emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE); + entropy->BE = 0; + } +} + + +/* + * Emit a restart marker & resynchronize predictions. + */ + +LOCAL(void) +emit_restart (phuff_entropy_ptr entropy, int restart_num) +{ + int ci; + + emit_eobrun(entropy); + + if (! entropy->gather_statistics) { + flush_bits(entropy); + emit_byte(entropy, 0xFF); + emit_byte(entropy, JPEG_RST0 + restart_num); + } + + if (entropy->cinfo->Ss == 0) { + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++) + entropy->last_dc_val[ci] = 0; + } else { + /* Re-initialize all AC-related fields to 0 */ + entropy->EOBRUN = 0; + entropy->BE = 0; + } +} + + +/* + * MCU encoding for DC initial scan (either spectral selection, + * or first pass of successive approximation). + */ + +METHODDEF(boolean) +encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + register int temp, temp2; + register int nbits; + int blkn, ci; + int Al = cinfo->Al; + JBLOCKROW block; + jpeg_component_info * compptr; + ISHIFT_TEMPS + + entropy->next_output_byte = cinfo->dest->next_output_byte; + entropy->free_in_buffer = cinfo->dest->free_in_buffer; + + /* Emit restart marker if needed */ + if (cinfo->restart_interval) + if (entropy->restarts_to_go == 0) + emit_restart(entropy, entropy->next_restart_num); + + /* Encode the MCU data blocks */ + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + block = MCU_data[blkn]; + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + + /* Compute the DC value after the required point transform by Al. + * This is simply an arithmetic right shift. + */ + temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al); + + /* DC differences are figured on the point-transformed values. */ + temp = temp2 - entropy->last_dc_val[ci]; + entropy->last_dc_val[ci] = temp2; + + /* Encode the DC coefficient difference per section G.1.2.1 */ + temp2 = temp; + if (temp < 0) { + temp = -temp; /* temp is abs value of input */ + /* For a negative input, want temp2 = bitwise complement of abs(input) */ + /* This code assumes we are on a two's complement machine */ + temp2--; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + while (temp) { + nbits++; + temp >>= 1; + } + /* Check for out-of-range coefficient values. + * Since we're encoding a difference, the range limit is twice as much. + */ + if (nbits > MAX_COEF_BITS+1) + ERREXIT(cinfo, JERR_BAD_DCT_COEF); + + /* Count/emit the Huffman-coded symbol for the number of bits */ + emit_symbol(entropy, compptr->dc_tbl_no, nbits); + + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + if (nbits) /* emit_bits rejects calls with size 0 */ + emit_bits(entropy, (unsigned int) temp2, nbits); + } + + cinfo->dest->next_output_byte = entropy->next_output_byte; + cinfo->dest->free_in_buffer = entropy->free_in_buffer; + + /* Update restart-interval state too */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) { + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num++; + entropy->next_restart_num &= 7; + } + entropy->restarts_to_go--; + } + + return TRUE; +} + + +/* + * MCU encoding for AC initial scan (either spectral selection, + * or first pass of successive approximation). + */ + +METHODDEF(boolean) +encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + register int temp, temp2; + register int nbits; + register int r, k; + int Se = cinfo->Se; + int Al = cinfo->Al; + JBLOCKROW block; + + entropy->next_output_byte = cinfo->dest->next_output_byte; + entropy->free_in_buffer = cinfo->dest->free_in_buffer; + + /* Emit restart marker if needed */ + if (cinfo->restart_interval) + if (entropy->restarts_to_go == 0) + emit_restart(entropy, entropy->next_restart_num); + + /* Encode the MCU data block */ + block = MCU_data[0]; + + /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ + + r = 0; /* r = run length of zeros */ + + for (k = cinfo->Ss; k <= Se; k++) { + if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { + r++; + continue; + } + /* We must apply the point transform by Al. For AC coefficients this + * is an integer division with rounding towards 0. To do this portably + * in C, we shift after obtaining the absolute value; so the code is + * interwoven with finding the abs value (temp) and output bits (temp2). + */ + if (temp < 0) { + temp = -temp; /* temp is abs value of input */ + temp >>= Al; /* apply the point transform */ + /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ + temp2 = ~temp; + } else { + temp >>= Al; /* apply the point transform */ + temp2 = temp; + } + /* Watch out for case that nonzero coef is zero after point transform */ + if (temp == 0) { + r++; + continue; + } + + /* Emit any pending EOBRUN */ + if (entropy->EOBRUN > 0) + emit_eobrun(entropy); + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); + r -= 16; + } + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 1; /* there must be at least one 1 bit */ + while ((temp >>= 1)) + nbits++; + /* Check for out-of-range coefficient values */ + if (nbits > MAX_COEF_BITS) + ERREXIT(cinfo, JERR_BAD_DCT_COEF); + + /* Count/emit Huffman symbol for run length / number of bits */ + emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); + + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + emit_bits(entropy, (unsigned int) temp2, nbits); + + r = 0; /* reset zero run length */ + } + + if (r > 0) { /* If there are trailing zeroes, */ + entropy->EOBRUN++; /* count an EOB */ + if (entropy->EOBRUN == 0x7FFF) + emit_eobrun(entropy); /* force it out to avoid overflow */ + } + + cinfo->dest->next_output_byte = entropy->next_output_byte; + cinfo->dest->free_in_buffer = entropy->free_in_buffer; + + /* Update restart-interval state too */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) { + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num++; + entropy->next_restart_num &= 7; + } + entropy->restarts_to_go--; + } + + return TRUE; +} + + +/* + * MCU encoding for DC successive approximation refinement scan. + * Note: we assume such scans can be multi-component, although the spec + * is not very clear on the point. + */ + +METHODDEF(boolean) +encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + register int temp; + int blkn; + int Al = cinfo->Al; + JBLOCKROW block; + + entropy->next_output_byte = cinfo->dest->next_output_byte; + entropy->free_in_buffer = cinfo->dest->free_in_buffer; + + /* Emit restart marker if needed */ + if (cinfo->restart_interval) + if (entropy->restarts_to_go == 0) + emit_restart(entropy, entropy->next_restart_num); + + /* Encode the MCU data blocks */ + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + block = MCU_data[blkn]; + + /* We simply emit the Al'th bit of the DC coefficient value. */ + temp = (*block)[0]; + emit_bits(entropy, (unsigned int) (temp >> Al), 1); + } + + cinfo->dest->next_output_byte = entropy->next_output_byte; + cinfo->dest->free_in_buffer = entropy->free_in_buffer; + + /* Update restart-interval state too */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) { + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num++; + entropy->next_restart_num &= 7; + } + entropy->restarts_to_go--; + } + + return TRUE; +} + + +/* + * MCU encoding for AC successive approximation refinement scan. + */ + +METHODDEF(boolean) +encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + register int temp; + register int r, k; + int EOB; + char *BR_buffer; + unsigned int BR; + int Se = cinfo->Se; + int Al = cinfo->Al; + JBLOCKROW block; + int absvalues[DCTSIZE2]; + + entropy->next_output_byte = cinfo->dest->next_output_byte; + entropy->free_in_buffer = cinfo->dest->free_in_buffer; + + /* Emit restart marker if needed */ + if (cinfo->restart_interval) + if (entropy->restarts_to_go == 0) + emit_restart(entropy, entropy->next_restart_num); + + /* Encode the MCU data block */ + block = MCU_data[0]; + + /* It is convenient to make a pre-pass to determine the transformed + * coefficients' absolute values and the EOB position. + */ + EOB = 0; + for (k = cinfo->Ss; k <= Se; k++) { + temp = (*block)[jpeg_natural_order[k]]; + /* We must apply the point transform by Al. For AC coefficients this + * is an integer division with rounding towards 0. To do this portably + * in C, we shift after obtaining the absolute value. + */ + if (temp < 0) + temp = -temp; /* temp is abs value of input */ + temp >>= Al; /* apply the point transform */ + absvalues[k] = temp; /* save abs value for main pass */ + if (temp == 1) + EOB = k; /* EOB = index of last newly-nonzero coef */ + } + + /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ + + r = 0; /* r = run length of zeros */ + BR = 0; /* BR = count of buffered bits added now */ + BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ + + for (k = cinfo->Ss; k <= Se; k++) { + if ((temp = absvalues[k]) == 0) { + r++; + continue; + } + + /* Emit any required ZRLs, but not if they can be folded into EOB */ + while (r > 15 && k <= EOB) { + /* emit any pending EOBRUN and the BE correction bits */ + emit_eobrun(entropy); + /* Emit ZRL */ + emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); + r -= 16; + /* Emit buffered correction bits that must be associated with ZRL */ + emit_buffered_bits(entropy, BR_buffer, BR); + BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ + BR = 0; + } + + /* If the coef was previously nonzero, it only needs a correction bit. + * NOTE: a straight translation of the spec's figure G.7 would suggest + * that we also need to test r > 15. But if r > 15, we can only get here + * if k > EOB, which implies that this coefficient is not 1. + */ + if (temp > 1) { + /* The correction bit is the next bit of the absolute value. */ + BR_buffer[BR++] = (char) (temp & 1); + continue; + } + + /* Emit any pending EOBRUN and the BE correction bits */ + emit_eobrun(entropy); + + /* Count/emit Huffman symbol for run length / number of bits */ + emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); + + /* Emit output bit for newly-nonzero coef */ + temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1; + emit_bits(entropy, (unsigned int) temp, 1); + + /* Emit buffered correction bits that must be associated with this code */ + emit_buffered_bits(entropy, BR_buffer, BR); + BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ + BR = 0; + r = 0; /* reset zero run length */ + } + + if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ + entropy->EOBRUN++; /* count an EOB */ + entropy->BE += BR; /* concat my correction bits to older ones */ + /* We force out the EOB if we risk either: + * 1. overflow of the EOB counter; + * 2. overflow of the correction bit buffer during the next MCU. + */ + if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1)) + emit_eobrun(entropy); + } + + cinfo->dest->next_output_byte = entropy->next_output_byte; + cinfo->dest->free_in_buffer = entropy->free_in_buffer; + + /* Update restart-interval state too */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) { + entropy->restarts_to_go = cinfo->restart_interval; + entropy->next_restart_num++; + entropy->next_restart_num &= 7; + } + entropy->restarts_to_go--; + } + + return TRUE; +} + + +/* + * Finish up at the end of a Huffman-compressed progressive scan. + */ + +METHODDEF(void) +finish_pass_phuff (j_compress_ptr cinfo) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + + entropy->next_output_byte = cinfo->dest->next_output_byte; + entropy->free_in_buffer = cinfo->dest->free_in_buffer; + + /* Flush out any buffered data */ + emit_eobrun(entropy); + flush_bits(entropy); + + cinfo->dest->next_output_byte = entropy->next_output_byte; + cinfo->dest->free_in_buffer = entropy->free_in_buffer; +} + + +/* + * Finish up a statistics-gathering pass and create the new Huffman tables. + */ + +METHODDEF(void) +finish_pass_gather_phuff (j_compress_ptr cinfo) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + boolean is_DC_band; + int ci, tbl; + jpeg_component_info * compptr; + JHUFF_TBL **htblptr; + boolean did[NUM_HUFF_TBLS]; + + /* Flush out buffered data (all we care about is counting the EOB symbol) */ + emit_eobrun(entropy); + + is_DC_band = (cinfo->Ss == 0); + + /* It's important not to apply jpeg_gen_optimal_table more than once + * per table, because it clobbers the input frequency counts! + */ + MEMZERO(did, SIZEOF(did)); + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + if (is_DC_band) { + if (cinfo->Ah != 0) /* DC refinement needs no table */ + continue; + tbl = compptr->dc_tbl_no; + } else { + tbl = compptr->ac_tbl_no; + } + if (! did[tbl]) { + if (is_DC_band) + htblptr = & cinfo->dc_huff_tbl_ptrs[tbl]; + else + htblptr = & cinfo->ac_huff_tbl_ptrs[tbl]; + if (*htblptr == NULL) + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]); + did[tbl] = TRUE; + } + } +} + + +/* + * Module initialization routine for progressive Huffman entropy encoding. + */ + +GLOBAL(void) +jinit_phuff_encoder (j_compress_ptr cinfo) +{ + phuff_entropy_ptr entropy; + int i; + + entropy = (phuff_entropy_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(phuff_entropy_encoder)); + cinfo->entropy = (struct jpeg_entropy_encoder *) entropy; + entropy->pub.start_pass = start_pass_phuff; + + /* Mark tables unallocated */ + for (i = 0; i < NUM_HUFF_TBLS; i++) { + entropy->derived_tbls[i] = NULL; + entropy->count_ptrs[i] = NULL; + } + entropy->bit_buffer = NULL; /* needed only in AC refinement scan */ +} + +#endif /* C_PROGRESSIVE_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jcprepct.c b/src/SFML/Graphics/libjpeg/jcprepct.c new file mode 100644 index 00000000..fdc4bc2d --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcprepct.c @@ -0,0 +1,354 @@ +/* + * jcprepct.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the compression preprocessing controller. + * This controller manages the color conversion, downsampling, + * and edge expansion steps. + * + * Most of the complexity here is associated with buffering input rows + * as required by the downsampler. See the comments at the head of + * jcsample.c for the downsampler's needs. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* At present, jcsample.c can request context rows only for smoothing. + * In the future, we might also need context rows for CCIR601 sampling + * or other more-complex downsampling procedures. The code to support + * context rows should be compiled only if needed. + */ +#ifdef INPUT_SMOOTHING_SUPPORTED +#define CONTEXT_ROWS_SUPPORTED +#endif + + +/* + * For the simple (no-context-row) case, we just need to buffer one + * row group's worth of pixels for the downsampling step. At the bottom of + * the image, we pad to a full row group by replicating the last pixel row. + * The downsampler's last output row is then replicated if needed to pad + * out to a full iMCU row. + * + * When providing context rows, we must buffer three row groups' worth of + * pixels. Three row groups are physically allocated, but the row pointer + * arrays are made five row groups high, with the extra pointers above and + * below "wrapping around" to point to the last and first real row groups. + * This allows the downsampler to access the proper context rows. + * At the top and bottom of the image, we create dummy context rows by + * copying the first or last real pixel row. This copying could be avoided + * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the + * trouble on the compression side. + */ + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_c_prep_controller pub; /* public fields */ + + /* Downsampling input buffer. This buffer holds color-converted data + * until we have enough to do a downsample step. + */ + JSAMPARRAY color_buf[MAX_COMPONENTS]; + + JDIMENSION rows_to_go; /* counts rows remaining in source image */ + int next_buf_row; /* index of next row to store in color_buf */ + +#ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */ + int this_row_group; /* starting row index of group to process */ + int next_buf_stop; /* downsample when we reach this index */ +#endif +} my_prep_controller; + +typedef my_prep_controller * my_prep_ptr; + + +/* + * Initialize for a processing pass. + */ + +METHODDEF(void) +start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode) +{ + my_prep_ptr prep = (my_prep_ptr) cinfo->prep; + + if (pass_mode != JBUF_PASS_THRU) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + + /* Initialize total-height counter for detecting bottom of image */ + prep->rows_to_go = cinfo->image_height; + /* Mark the conversion buffer empty */ + prep->next_buf_row = 0; +#ifdef CONTEXT_ROWS_SUPPORTED + /* Preset additional state variables for context mode. + * These aren't used in non-context mode, so we needn't test which mode. + */ + prep->this_row_group = 0; + /* Set next_buf_stop to stop after two row groups have been read in. */ + prep->next_buf_stop = 2 * cinfo->max_v_samp_factor; +#endif +} + + +/* + * Expand an image vertically from height input_rows to height output_rows, + * by duplicating the bottom row. + */ + +LOCAL(void) +expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, + int input_rows, int output_rows) +{ + register int row; + + for (row = input_rows; row < output_rows; row++) { + jcopy_sample_rows(image_data, input_rows-1, image_data, row, + 1, num_cols); + } +} + + +/* + * Process some data in the simple no-context case. + * + * Preprocessor output data is counted in "row groups". A row group + * is defined to be v_samp_factor sample rows of each component. + * Downsampling will produce this much data from each max_v_samp_factor + * input rows. + */ + +METHODDEF(void) +pre_process_data (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail) +{ + my_prep_ptr prep = (my_prep_ptr) cinfo->prep; + int numrows, ci; + JDIMENSION inrows; + jpeg_component_info * compptr; + + while (*in_row_ctr < in_rows_avail && + *out_row_group_ctr < out_row_groups_avail) { + /* Do color conversion to fill the conversion buffer. */ + inrows = in_rows_avail - *in_row_ctr; + numrows = cinfo->max_v_samp_factor - prep->next_buf_row; + numrows = (int) MIN((JDIMENSION) numrows, inrows); + (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, + prep->color_buf, + (JDIMENSION) prep->next_buf_row, + numrows); + *in_row_ctr += numrows; + prep->next_buf_row += numrows; + prep->rows_to_go -= numrows; + /* If at bottom of image, pad to fill the conversion buffer. */ + if (prep->rows_to_go == 0 && + prep->next_buf_row < cinfo->max_v_samp_factor) { + for (ci = 0; ci < cinfo->num_components; ci++) { + expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, + prep->next_buf_row, cinfo->max_v_samp_factor); + } + prep->next_buf_row = cinfo->max_v_samp_factor; + } + /* If we've filled the conversion buffer, empty it. */ + if (prep->next_buf_row == cinfo->max_v_samp_factor) { + (*cinfo->downsample->downsample) (cinfo, + prep->color_buf, (JDIMENSION) 0, + output_buf, *out_row_group_ctr); + prep->next_buf_row = 0; + (*out_row_group_ctr)++; + } + /* If at bottom of image, pad the output to a full iMCU height. + * Note we assume the caller is providing a one-iMCU-height output buffer! + */ + if (prep->rows_to_go == 0 && + *out_row_group_ctr < out_row_groups_avail) { + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + expand_bottom_edge(output_buf[ci], + compptr->width_in_blocks * DCTSIZE, + (int) (*out_row_group_ctr * compptr->v_samp_factor), + (int) (out_row_groups_avail * compptr->v_samp_factor)); + } + *out_row_group_ctr = out_row_groups_avail; + break; /* can exit outer loop without test */ + } + } +} + + +#ifdef CONTEXT_ROWS_SUPPORTED + +/* + * Process some data in the context case. + */ + +METHODDEF(void) +pre_process_context (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail) +{ + my_prep_ptr prep = (my_prep_ptr) cinfo->prep; + int numrows, ci; + int buf_height = cinfo->max_v_samp_factor * 3; + JDIMENSION inrows; + + while (*out_row_group_ctr < out_row_groups_avail) { + if (*in_row_ctr < in_rows_avail) { + /* Do color conversion to fill the conversion buffer. */ + inrows = in_rows_avail - *in_row_ctr; + numrows = prep->next_buf_stop - prep->next_buf_row; + numrows = (int) MIN((JDIMENSION) numrows, inrows); + (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr, + prep->color_buf, + (JDIMENSION) prep->next_buf_row, + numrows); + /* Pad at top of image, if first time through */ + if (prep->rows_to_go == cinfo->image_height) { + for (ci = 0; ci < cinfo->num_components; ci++) { + int row; + for (row = 1; row <= cinfo->max_v_samp_factor; row++) { + jcopy_sample_rows(prep->color_buf[ci], 0, + prep->color_buf[ci], -row, + 1, cinfo->image_width); + } + } + } + *in_row_ctr += numrows; + prep->next_buf_row += numrows; + prep->rows_to_go -= numrows; + } else { + /* Return for more data, unless we are at the bottom of the image. */ + if (prep->rows_to_go != 0) + break; + /* When at bottom of image, pad to fill the conversion buffer. */ + if (prep->next_buf_row < prep->next_buf_stop) { + for (ci = 0; ci < cinfo->num_components; ci++) { + expand_bottom_edge(prep->color_buf[ci], cinfo->image_width, + prep->next_buf_row, prep->next_buf_stop); + } + prep->next_buf_row = prep->next_buf_stop; + } + } + /* If we've gotten enough data, downsample a row group. */ + if (prep->next_buf_row == prep->next_buf_stop) { + (*cinfo->downsample->downsample) (cinfo, + prep->color_buf, + (JDIMENSION) prep->this_row_group, + output_buf, *out_row_group_ctr); + (*out_row_group_ctr)++; + /* Advance pointers with wraparound as necessary. */ + prep->this_row_group += cinfo->max_v_samp_factor; + if (prep->this_row_group >= buf_height) + prep->this_row_group = 0; + if (prep->next_buf_row >= buf_height) + prep->next_buf_row = 0; + prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor; + } + } +} + + +/* + * Create the wrapped-around downsampling input buffer needed for context mode. + */ + +LOCAL(void) +create_context_buffer (j_compress_ptr cinfo) +{ + my_prep_ptr prep = (my_prep_ptr) cinfo->prep; + int rgroup_height = cinfo->max_v_samp_factor; + int ci, i; + jpeg_component_info * compptr; + JSAMPARRAY true_buffer, fake_buffer; + + /* Grab enough space for fake row pointers for all the components; + * we need five row groups' worth of pointers for each component. + */ + fake_buffer = (JSAMPARRAY) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (cinfo->num_components * 5 * rgroup_height) * + SIZEOF(JSAMPROW)); + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Allocate the actual buffer space (3 row groups) for this component. + * We make the buffer wide enough to allow the downsampler to edge-expand + * horizontally within the buffer, if it so chooses. + */ + true_buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * + cinfo->max_h_samp_factor) / compptr->h_samp_factor), + (JDIMENSION) (3 * rgroup_height)); + /* Copy true buffer row pointers into the middle of the fake row array */ + MEMCOPY(fake_buffer + rgroup_height, true_buffer, + 3 * rgroup_height * SIZEOF(JSAMPROW)); + /* Fill in the above and below wraparound pointers */ + for (i = 0; i < rgroup_height; i++) { + fake_buffer[i] = true_buffer[2 * rgroup_height + i]; + fake_buffer[4 * rgroup_height + i] = true_buffer[i]; + } + prep->color_buf[ci] = fake_buffer + rgroup_height; + fake_buffer += 5 * rgroup_height; /* point to space for next component */ + } +} + +#endif /* CONTEXT_ROWS_SUPPORTED */ + + +/* + * Initialize preprocessing controller. + */ + +GLOBAL(void) +jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer) +{ + my_prep_ptr prep; + int ci; + jpeg_component_info * compptr; + + if (need_full_buffer) /* safety check */ + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + + prep = (my_prep_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_prep_controller)); + cinfo->prep = (struct jpeg_c_prep_controller *) prep; + prep->pub.start_pass = start_pass_prep; + + /* Allocate the color conversion buffer. + * We make the buffer wide enough to allow the downsampler to edge-expand + * horizontally within the buffer, if it so chooses. + */ + if (cinfo->downsample->need_context_rows) { + /* Set up to provide context rows */ +#ifdef CONTEXT_ROWS_SUPPORTED + prep->pub.pre_process_data = pre_process_context; + create_context_buffer(cinfo); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else { + /* No context, just make it tall enough for one row group */ + prep->pub.pre_process_data = pre_process_data; + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + prep->color_buf[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE * + cinfo->max_h_samp_factor) / compptr->h_samp_factor), + (JDIMENSION) cinfo->max_v_samp_factor); + } + } +} diff --git a/src/SFML/Graphics/libjpeg/jcsample.c b/src/SFML/Graphics/libjpeg/jcsample.c new file mode 100644 index 00000000..fe29fcab --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jcsample.c @@ -0,0 +1,519 @@ +/* + * jcsample.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains downsampling routines. + * + * Downsampling input data is counted in "row groups". A row group + * is defined to be max_v_samp_factor pixel rows of each component, + * from which the downsampler produces v_samp_factor sample rows. + * A single row group is processed in each call to the downsampler module. + * + * The downsampler is responsible for edge-expansion of its output data + * to fill an integral number of DCT blocks horizontally. The source buffer + * may be modified if it is helpful for this purpose (the source buffer is + * allocated wide enough to correspond to the desired output width). + * The caller (the prep controller) is responsible for vertical padding. + * + * The downsampler may request "context rows" by setting need_context_rows + * during startup. In this case, the input arrays will contain at least + * one row group's worth of pixels above and below the passed-in data; + * the caller will create dummy rows at image top and bottom by replicating + * the first or last real pixel row. + * + * An excellent reference for image resampling is + * Digital Image Warping, George Wolberg, 1990. + * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. + * + * The downsampling algorithm used here is a simple average of the source + * pixels covered by the output pixel. The hi-falutin sampling literature + * refers to this as a "box filter". In general the characteristics of a box + * filter are not very good, but for the specific cases we normally use (1:1 + * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not + * nearly so bad. If you intend to use other sampling ratios, you'd be well + * advised to improve this code. + * + * A simple input-smoothing capability is provided. This is mainly intended + * for cleaning up color-dithered GIF input files (if you find it inadequate, + * we suggest using an external filtering program such as pnmconvol). When + * enabled, each input pixel P is replaced by a weighted sum of itself and its + * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF, + * where SF = (smoothing_factor / 1024). + * Currently, smoothing is only supported for 2h2v sampling factors. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Pointer to routine to downsample a single component */ +typedef JMETHOD(void, downsample1_ptr, + (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data)); + +/* Private subobject */ + +typedef struct { + struct jpeg_downsampler pub; /* public fields */ + + /* Downsampling method pointers, one per component */ + downsample1_ptr methods[MAX_COMPONENTS]; +} my_downsampler; + +typedef my_downsampler * my_downsample_ptr; + + +/* + * Initialize for a downsampling pass. + */ + +METHODDEF(void) +start_pass_downsample (j_compress_ptr cinfo) +{ + /* no work for now */ +} + + +/* + * Expand a component horizontally from width input_cols to width output_cols, + * by duplicating the rightmost samples. + */ + +LOCAL(void) +expand_right_edge (JSAMPARRAY image_data, int num_rows, + JDIMENSION input_cols, JDIMENSION output_cols) +{ + register JSAMPROW ptr; + register JSAMPLE pixval; + register int count; + int row; + int numcols = (int) (output_cols - input_cols); + + if (numcols > 0) { + for (row = 0; row < num_rows; row++) { + ptr = image_data[row] + input_cols; + pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ + for (count = numcols; count > 0; count--) + *ptr++ = pixval; + } + } +} + + +/* + * Do downsampling for a whole row group (all components). + * + * In this version we simply downsample each component independently. + */ + +METHODDEF(void) +sep_downsample (j_compress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_index, + JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) +{ + my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; + int ci; + jpeg_component_info * compptr; + JSAMPARRAY in_ptr, out_ptr; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + in_ptr = input_buf[ci] + in_row_index; + out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); + (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); + } +} + + +/* + * Downsample pixel values of a single component. + * One row group is processed per call. + * This version handles arbitrary integral sampling ratios, without smoothing. + * Note that this version is not actually used for customary sampling ratios. + */ + +METHODDEF(void) +int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; + JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ + JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; + JSAMPROW inptr, outptr; + INT32 outvalue; + + h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; + v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; + numpix = h_expand * v_expand; + numpix2 = numpix/2; + + /* Expand input data enough to let all the output samples be generated + * by the standard loop. Special-casing padded output would be more + * efficient. + */ + expand_right_edge(input_data, cinfo->max_v_samp_factor, + cinfo->image_width, output_cols * h_expand); + + inrow = 0; + for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { + outptr = output_data[outrow]; + for (outcol = 0, outcol_h = 0; outcol < output_cols; + outcol++, outcol_h += h_expand) { + outvalue = 0; + for (v = 0; v < v_expand; v++) { + inptr = input_data[inrow+v] + outcol_h; + for (h = 0; h < h_expand; h++) { + outvalue += (INT32) GETJSAMPLE(*inptr++); + } + } + *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); + } + inrow += v_expand; + } +} + + +/* + * Downsample pixel values of a single component. + * This version handles the special case of a full-size component, + * without smoothing. + */ + +METHODDEF(void) +fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + /* Copy the data */ + jcopy_sample_rows(input_data, 0, output_data, 0, + cinfo->max_v_samp_factor, cinfo->image_width); + /* Edge-expand */ + expand_right_edge(output_data, cinfo->max_v_samp_factor, + cinfo->image_width, compptr->width_in_blocks * DCTSIZE); +} + + +/* + * Downsample pixel values of a single component. + * This version handles the common case of 2:1 horizontal and 1:1 vertical, + * without smoothing. + * + * A note about the "bias" calculations: when rounding fractional values to + * integer, we do not want to always round 0.5 up to the next integer. + * If we did that, we'd introduce a noticeable bias towards larger values. + * Instead, this code is arranged so that 0.5 will be rounded up or down at + * alternate pixel locations (a simple ordered dither pattern). + */ + +METHODDEF(void) +h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + int outrow; + JDIMENSION outcol; + JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; + register JSAMPROW inptr, outptr; + register int bias; + + /* Expand input data enough to let all the output samples be generated + * by the standard loop. Special-casing padded output would be more + * efficient. + */ + expand_right_edge(input_data, cinfo->max_v_samp_factor, + cinfo->image_width, output_cols * 2); + + for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { + outptr = output_data[outrow]; + inptr = input_data[outrow]; + bias = 0; /* bias = 0,1,0,1,... for successive samples */ + for (outcol = 0; outcol < output_cols; outcol++) { + *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + + bias) >> 1); + bias ^= 1; /* 0=>1, 1=>0 */ + inptr += 2; + } + } +} + + +/* + * Downsample pixel values of a single component. + * This version handles the standard case of 2:1 horizontal and 2:1 vertical, + * without smoothing. + */ + +METHODDEF(void) +h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + int inrow, outrow; + JDIMENSION outcol; + JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; + register JSAMPROW inptr0, inptr1, outptr; + register int bias; + + /* Expand input data enough to let all the output samples be generated + * by the standard loop. Special-casing padded output would be more + * efficient. + */ + expand_right_edge(input_data, cinfo->max_v_samp_factor, + cinfo->image_width, output_cols * 2); + + inrow = 0; + for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { + outptr = output_data[outrow]; + inptr0 = input_data[inrow]; + inptr1 = input_data[inrow+1]; + bias = 1; /* bias = 1,2,1,2,... for successive samples */ + for (outcol = 0; outcol < output_cols; outcol++) { + *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + + bias) >> 2); + bias ^= 3; /* 1=>2, 2=>1 */ + inptr0 += 2; inptr1 += 2; + } + inrow += 2; + } +} + + +#ifdef INPUT_SMOOTHING_SUPPORTED + +/* + * Downsample pixel values of a single component. + * This version handles the standard case of 2:1 horizontal and 2:1 vertical, + * with smoothing. One row of context is required. + */ + +METHODDEF(void) +h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + int inrow, outrow; + JDIMENSION colctr; + JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; + register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; + INT32 membersum, neighsum, memberscale, neighscale; + + /* Expand input data enough to let all the output samples be generated + * by the standard loop. Special-casing padded output would be more + * efficient. + */ + expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, + cinfo->image_width, output_cols * 2); + + /* We don't bother to form the individual "smoothed" input pixel values; + * we can directly compute the output which is the average of the four + * smoothed values. Each of the four member pixels contributes a fraction + * (1-8*SF) to its own smoothed image and a fraction SF to each of the three + * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final + * output. The four corner-adjacent neighbor pixels contribute a fraction + * SF to just one smoothed pixel, or SF/4 to the final output; while the + * eight edge-adjacent neighbors contribute SF to each of two smoothed + * pixels, or SF/2 overall. In order to use integer arithmetic, these + * factors are scaled by 2^16 = 65536. + * Also recall that SF = smoothing_factor / 1024. + */ + + memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */ + neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ + + inrow = 0; + for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { + outptr = output_data[outrow]; + inptr0 = input_data[inrow]; + inptr1 = input_data[inrow+1]; + above_ptr = input_data[inrow-1]; + below_ptr = input_data[inrow+2]; + + /* Special case for first column: pretend column -1 is same as column 0 */ + membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); + neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + + GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); + neighsum += neighsum; + neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); + membersum = membersum * memberscale + neighsum * neighscale; + *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); + inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; + + for (colctr = output_cols - 2; colctr > 0; colctr--) { + /* sum of pixels directly mapped to this output element */ + membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); + /* sum of edge-neighbor pixels */ + neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + + GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + + GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); + /* The edge-neighbors count twice as much as corner-neighbors */ + neighsum += neighsum; + /* Add in the corner-neighbors */ + neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + + GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); + /* form final output scaled up by 2^16 */ + membersum = membersum * memberscale + neighsum * neighscale; + /* round, descale and output it */ + *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); + inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; + } + + /* Special case for last column */ + membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + + GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); + neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + + GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + + GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + + GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); + neighsum += neighsum; + neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + + GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); + membersum = membersum * memberscale + neighsum * neighscale; + *outptr = (JSAMPLE) ((membersum + 32768) >> 16); + + inrow += 2; + } +} + + +/* + * Downsample pixel values of a single component. + * This version handles the special case of a full-size component, + * with smoothing. One row of context is required. + */ + +METHODDEF(void) +fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, + JSAMPARRAY input_data, JSAMPARRAY output_data) +{ + int outrow; + JDIMENSION colctr; + JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; + register JSAMPROW inptr, above_ptr, below_ptr, outptr; + INT32 membersum, neighsum, memberscale, neighscale; + int colsum, lastcolsum, nextcolsum; + + /* Expand input data enough to let all the output samples be generated + * by the standard loop. Special-casing padded output would be more + * efficient. + */ + expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, + cinfo->image_width, output_cols); + + /* Each of the eight neighbor pixels contributes a fraction SF to the + * smoothed pixel, while the main pixel contributes (1-8*SF). In order + * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. + * Also recall that SF = smoothing_factor / 1024. + */ + + memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */ + neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ + + for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { + outptr = output_data[outrow]; + inptr = input_data[outrow]; + above_ptr = input_data[outrow-1]; + below_ptr = input_data[outrow+1]; + + /* Special case for first column */ + colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + + GETJSAMPLE(*inptr); + membersum = GETJSAMPLE(*inptr++); + nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + + GETJSAMPLE(*inptr); + neighsum = colsum + (colsum - membersum) + nextcolsum; + membersum = membersum * memberscale + neighsum * neighscale; + *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); + lastcolsum = colsum; colsum = nextcolsum; + + for (colctr = output_cols - 2; colctr > 0; colctr--) { + membersum = GETJSAMPLE(*inptr++); + above_ptr++; below_ptr++; + nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + + GETJSAMPLE(*inptr); + neighsum = lastcolsum + (colsum - membersum) + nextcolsum; + membersum = membersum * memberscale + neighsum * neighscale; + *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); + lastcolsum = colsum; colsum = nextcolsum; + } + + /* Special case for last column */ + membersum = GETJSAMPLE(*inptr); + neighsum = lastcolsum + (colsum - membersum) + colsum; + membersum = membersum * memberscale + neighsum * neighscale; + *outptr = (JSAMPLE) ((membersum + 32768) >> 16); + + } +} + +#endif /* INPUT_SMOOTHING_SUPPORTED */ + + +/* + * Module initialization routine for downsampling. + * Note that we must select a routine for each component. + */ + +GLOBAL(void) +jinit_downsampler (j_compress_ptr cinfo) +{ + my_downsample_ptr downsample; + int ci; + jpeg_component_info * compptr; + boolean smoothok = TRUE; + + downsample = (my_downsample_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_downsampler)); + cinfo->downsample = (struct jpeg_downsampler *) downsample; + downsample->pub.start_pass = start_pass_downsample; + downsample->pub.downsample = sep_downsample; + downsample->pub.need_context_rows = FALSE; + + if (cinfo->CCIR601_sampling) + ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); + + /* Verify we can handle the sampling factors, and set up method pointers */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->h_samp_factor == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) { +#ifdef INPUT_SMOOTHING_SUPPORTED + if (cinfo->smoothing_factor) { + downsample->methods[ci] = fullsize_smooth_downsample; + downsample->pub.need_context_rows = TRUE; + } else +#endif + downsample->methods[ci] = fullsize_downsample; + } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && + compptr->v_samp_factor == cinfo->max_v_samp_factor) { + smoothok = FALSE; + downsample->methods[ci] = h2v1_downsample; + } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && + compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { +#ifdef INPUT_SMOOTHING_SUPPORTED + if (cinfo->smoothing_factor) { + downsample->methods[ci] = h2v2_smooth_downsample; + downsample->pub.need_context_rows = TRUE; + } else +#endif + downsample->methods[ci] = h2v2_downsample; + } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && + (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { + smoothok = FALSE; + downsample->methods[ci] = int_downsample; + } else + ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); + } + +#ifdef INPUT_SMOOTHING_SUPPORTED + if (cinfo->smoothing_factor && !smoothok) + TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL); +#endif +} diff --git a/src/SFML/Graphics/libjpeg/jctrans.c b/src/SFML/Graphics/libjpeg/jctrans.c new file mode 100644 index 00000000..8b36e363 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jctrans.c @@ -0,0 +1,388 @@ +/* + * jctrans.c + * + * Copyright (C) 1995-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains library routines for transcoding compression, + * that is, writing raw DCT coefficient arrays to an output JPEG file. + * The routines in jcapimin.c will also be needed by a transcoder. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Forward declarations */ +LOCAL(void) transencode_master_selection + JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); +LOCAL(void) transencode_coef_controller + JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)); + + +/* + * Compression initialization for writing raw-coefficient data. + * Before calling this, all parameters and a data destination must be set up. + * Call jpeg_finish_compress() to actually write the data. + * + * The number of passed virtual arrays must match cinfo->num_components. + * Note that the virtual arrays need not be filled or even realized at + * the time write_coefficients is called; indeed, if the virtual arrays + * were requested from this compression object's memory manager, they + * typically will be realized during this routine and filled afterwards. + */ + +GLOBAL(void) +jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays) +{ + if (cinfo->global_state != CSTATE_START) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + /* Mark all tables to be written */ + jpeg_suppress_tables(cinfo, FALSE); + /* (Re)initialize error mgr and destination modules */ + (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); + (*cinfo->dest->init_destination) (cinfo); + /* Perform master selection of active modules */ + transencode_master_selection(cinfo, coef_arrays); + /* Wait for jpeg_finish_compress() call */ + cinfo->next_scanline = 0; /* so jpeg_write_marker works */ + cinfo->global_state = CSTATE_WRCOEFS; +} + + +/* + * Initialize the compression object with default parameters, + * then copy from the source object all parameters needed for lossless + * transcoding. Parameters that can be varied without loss (such as + * scan script and Huffman optimization) are left in their default states. + */ + +GLOBAL(void) +jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, + j_compress_ptr dstinfo) +{ + JQUANT_TBL ** qtblptr; + jpeg_component_info *incomp, *outcomp; + JQUANT_TBL *c_quant, *slot_quant; + int tblno, ci, coefi; + + /* Safety check to ensure start_compress not called yet. */ + if (dstinfo->global_state != CSTATE_START) + ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state); + /* Copy fundamental image dimensions */ + dstinfo->image_width = srcinfo->image_width; + dstinfo->image_height = srcinfo->image_height; + dstinfo->input_components = srcinfo->num_components; + dstinfo->in_color_space = srcinfo->jpeg_color_space; + /* Initialize all parameters to default values */ + jpeg_set_defaults(dstinfo); + /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB. + * Fix it to get the right header markers for the image colorspace. + */ + jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space); + dstinfo->data_precision = srcinfo->data_precision; + dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling; + /* Copy the source's quantization tables. */ + for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { + if (srcinfo->quant_tbl_ptrs[tblno] != NULL) { + qtblptr = & dstinfo->quant_tbl_ptrs[tblno]; + if (*qtblptr == NULL) + *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo); + MEMCOPY((*qtblptr)->quantval, + srcinfo->quant_tbl_ptrs[tblno]->quantval, + SIZEOF((*qtblptr)->quantval)); + (*qtblptr)->sent_table = FALSE; + } + } + /* Copy the source's per-component info. + * Note we assume jpeg_set_defaults has allocated the dest comp_info array. + */ + dstinfo->num_components = srcinfo->num_components; + if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS) + ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components, + MAX_COMPONENTS); + for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info; + ci < dstinfo->num_components; ci++, incomp++, outcomp++) { + outcomp->component_id = incomp->component_id; + outcomp->h_samp_factor = incomp->h_samp_factor; + outcomp->v_samp_factor = incomp->v_samp_factor; + outcomp->quant_tbl_no = incomp->quant_tbl_no; + /* Make sure saved quantization table for component matches the qtable + * slot. If not, the input file re-used this qtable slot. + * IJG encoder currently cannot duplicate this. + */ + tblno = outcomp->quant_tbl_no; + if (tblno < 0 || tblno >= NUM_QUANT_TBLS || + srcinfo->quant_tbl_ptrs[tblno] == NULL) + ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno); + slot_quant = srcinfo->quant_tbl_ptrs[tblno]; + c_quant = incomp->quant_table; + if (c_quant != NULL) { + for (coefi = 0; coefi < DCTSIZE2; coefi++) { + if (c_quant->quantval[coefi] != slot_quant->quantval[coefi]) + ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno); + } + } + /* Note: we do not copy the source's Huffman table assignments; + * instead we rely on jpeg_set_colorspace to have made a suitable choice. + */ + } + /* Also copy JFIF version and resolution information, if available. + * Strictly speaking this isn't "critical" info, but it's nearly + * always appropriate to copy it if available. In particular, + * if the application chooses to copy JFIF 1.02 extension markers from + * the source file, we need to copy the version to make sure we don't + * emit a file that has 1.02 extensions but a claimed version of 1.01. + * We will *not*, however, copy version info from mislabeled "2.01" files. + */ + if (srcinfo->saw_JFIF_marker) { + if (srcinfo->JFIF_major_version == 1) { + dstinfo->JFIF_major_version = srcinfo->JFIF_major_version; + dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version; + } + dstinfo->density_unit = srcinfo->density_unit; + dstinfo->X_density = srcinfo->X_density; + dstinfo->Y_density = srcinfo->Y_density; + } +} + + +/* + * Master selection of compression modules for transcoding. + * This substitutes for jcinit.c's initialization of the full compressor. + */ + +LOCAL(void) +transencode_master_selection (j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays) +{ + /* Although we don't actually use input_components for transcoding, + * jcmaster.c's initial_setup will complain if input_components is 0. + */ + cinfo->input_components = 1; + /* Initialize master control (includes parameter checking/processing) */ + jinit_c_master_control(cinfo, TRUE /* transcode only */); + + /* Entropy encoding: either Huffman or arithmetic coding. */ + if (cinfo->arith_code) { + ERREXIT(cinfo, JERR_ARITH_NOTIMPL); + } else { + if (cinfo->progressive_mode) { +#ifdef C_PROGRESSIVE_SUPPORTED + jinit_phuff_encoder(cinfo); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else + jinit_huff_encoder(cinfo); + } + + /* We need a special coefficient buffer controller. */ + transencode_coef_controller(cinfo, coef_arrays); + + jinit_marker_writer(cinfo); + + /* We can now tell the memory manager to allocate virtual arrays. */ + (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); + + /* Write the datastream header (SOI, JFIF) immediately. + * Frame and scan headers are postponed till later. + * This lets application insert special markers after the SOI. + */ + (*cinfo->marker->write_file_header) (cinfo); +} + + +/* + * The rest of this file is a special implementation of the coefficient + * buffer controller. This is similar to jccoefct.c, but it handles only + * output from presupplied virtual arrays. Furthermore, we generate any + * dummy padding blocks on-the-fly rather than expecting them to be present + * in the arrays. + */ + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_c_coef_controller pub; /* public fields */ + + JDIMENSION iMCU_row_num; /* iMCU row # within image */ + JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ + + /* Virtual block array for each component. */ + jvirt_barray_ptr * whole_image; + + /* Workspace for constructing dummy blocks at right/bottom edges. */ + JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU]; +} my_coef_controller; + +typedef my_coef_controller * my_coef_ptr; + + +LOCAL(void) +start_iMCU_row (j_compress_ptr cinfo) +/* Reset within-iMCU-row counters for a new row */ +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + + /* In an interleaved scan, an MCU row is the same as an iMCU row. + * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. + * But at the bottom of the image, process only what's left. + */ + if (cinfo->comps_in_scan > 1) { + coef->MCU_rows_per_iMCU_row = 1; + } else { + if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; + else + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; + } + + coef->mcu_ctr = 0; + coef->MCU_vert_offset = 0; +} + + +/* + * Initialize for a processing pass. + */ + +METHODDEF(void) +start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + + if (pass_mode != JBUF_CRANK_DEST) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + + coef->iMCU_row_num = 0; + start_iMCU_row(cinfo); +} + + +/* + * Process some data. + * We process the equivalent of one fully interleaved MCU row ("iMCU" row) + * per call, ie, v_samp_factor block rows for each component in the scan. + * The data is obtained from the virtual arrays and fed to the entropy coder. + * Returns TRUE if the iMCU row is completed, FALSE if suspended. + * + * NB: input_buf is ignored; it is likely to be a NULL pointer. + */ + +METHODDEF(boolean) +compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; + JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; + int blkn, ci, xindex, yindex, yoffset, blockcnt; + JDIMENSION start_col; + JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; + JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]; + JBLOCKROW buffer_ptr; + jpeg_component_info *compptr; + + /* Align the virtual buffers for the components used in this scan. */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + buffer[ci] = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], + coef->iMCU_row_num * compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); + } + + /* Loop to process one whole iMCU row */ + for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; + yoffset++) { + for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; + MCU_col_num++) { + /* Construct list of pointers to DCT blocks belonging to this MCU */ + blkn = 0; /* index of current DCT block within MCU */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + start_col = MCU_col_num * compptr->MCU_width; + blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width + : compptr->last_col_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + if (coef->iMCU_row_num < last_iMCU_row || + yindex+yoffset < compptr->last_row_height) { + /* Fill in pointers to real blocks in this row */ + buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + for (xindex = 0; xindex < blockcnt; xindex++) + MCU_buffer[blkn++] = buffer_ptr++; + } else { + /* At bottom of image, need a whole row of dummy blocks */ + xindex = 0; + } + /* Fill in any dummy blocks needed in this row. + * Dummy blocks are filled in the same way as in jccoefct.c: + * all zeroes in the AC entries, DC entries equal to previous + * block's DC value. The init routine has already zeroed the + * AC entries, so we need only set the DC entries correctly. + */ + for (; xindex < compptr->MCU_width; xindex++) { + MCU_buffer[blkn] = coef->dummy_buffer[blkn]; + MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0]; + blkn++; + } + } + } + /* Try to write the MCU. */ + if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) { + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->mcu_ctr = MCU_col_num; + return FALSE; + } + } + /* Completed an MCU row, but perhaps not an iMCU row */ + coef->mcu_ctr = 0; + } + /* Completed the iMCU row, advance counters for next one */ + coef->iMCU_row_num++; + start_iMCU_row(cinfo); + return TRUE; +} + + +/* + * Initialize coefficient buffer controller. + * + * Each passed coefficient array must be the right size for that + * coefficient: width_in_blocks wide and height_in_blocks high, + * with unitheight at least v_samp_factor. + */ + +LOCAL(void) +transencode_coef_controller (j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays) +{ + my_coef_ptr coef; + JBLOCKROW buffer; + int i; + + coef = (my_coef_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_coef_controller)); + cinfo->coef = (struct jpeg_c_coef_controller *) coef; + coef->pub.start_pass = start_pass_coef; + coef->pub.compress_data = compress_output; + + /* Save pointer to virtual arrays */ + coef->whole_image = coef_arrays; + + /* Allocate and pre-zero space for dummy DCT blocks. */ + buffer = (JBLOCKROW) + (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { + coef->dummy_buffer[i] = buffer + i; + } +} diff --git a/src/SFML/Graphics/libjpeg/jdapimin.c b/src/SFML/Graphics/libjpeg/jdapimin.c new file mode 100644 index 00000000..bd1df927 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdapimin.c @@ -0,0 +1,395 @@ +/* + * jdapimin.c + * + * Copyright (C) 1994-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains application interface code for the decompression half + * of the JPEG library. These are the "minimum" API routines that may be + * needed in either the normal full-decompression case or the + * transcoding-only case. + * + * Most of the routines intended to be called directly by an application + * are in this file or in jdapistd.c. But also see jcomapi.c for routines + * shared by compression and decompression, and jdtrans.c for the transcoding + * case. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * Initialization of a JPEG decompression object. + * The error manager must already be set up (in case memory manager fails). + */ + +GLOBAL(void) +jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) +{ + int i; + + /* Guard against version mismatches between library and caller. */ + cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ + if (version != JPEG_LIB_VERSION) + ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); + if (structsize != SIZEOF(struct jpeg_decompress_struct)) + ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, + (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); + + /* For debugging purposes, we zero the whole master structure. + * But the application has already set the err pointer, and may have set + * client_data, so we have to save and restore those fields. + * Note: if application hasn't set client_data, tools like Purify may + * complain here. + */ + { + struct jpeg_error_mgr * err = cinfo->err; + void * client_data = cinfo->client_data; /* ignore Purify complaint here */ + MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct)); + cinfo->err = err; + cinfo->client_data = client_data; + } + cinfo->is_decompressor = TRUE; + + /* Initialize a memory manager instance for this object */ + jinit_memory_mgr((j_common_ptr) cinfo); + + /* Zero out pointers to permanent structures. */ + cinfo->progress = NULL; + cinfo->src = NULL; + + for (i = 0; i < NUM_QUANT_TBLS; i++) + cinfo->quant_tbl_ptrs[i] = NULL; + + for (i = 0; i < NUM_HUFF_TBLS; i++) { + cinfo->dc_huff_tbl_ptrs[i] = NULL; + cinfo->ac_huff_tbl_ptrs[i] = NULL; + } + + /* Initialize marker processor so application can override methods + * for COM, APPn markers before calling jpeg_read_header. + */ + cinfo->marker_list = NULL; + jinit_marker_reader(cinfo); + + /* And initialize the overall input controller. */ + jinit_input_controller(cinfo); + + /* OK, I'm ready */ + cinfo->global_state = DSTATE_START; +} + + +/* + * Destruction of a JPEG decompression object + */ + +GLOBAL(void) +jpeg_destroy_decompress (j_decompress_ptr cinfo) +{ + jpeg_destroy((j_common_ptr) cinfo); /* use common routine */ +} + + +/* + * Abort processing of a JPEG decompression operation, + * but don't destroy the object itself. + */ + +GLOBAL(void) +jpeg_abort_decompress (j_decompress_ptr cinfo) +{ + jpeg_abort((j_common_ptr) cinfo); /* use common routine */ +} + + +/* + * Set default decompression parameters. + */ + +LOCAL(void) +default_decompress_parms (j_decompress_ptr cinfo) +{ + /* Guess the input colorspace, and set output colorspace accordingly. */ + /* (Wish JPEG committee had provided a real way to specify this...) */ + /* Note application may override our guesses. */ + switch (cinfo->num_components) { + case 1: + cinfo->jpeg_color_space = JCS_GRAYSCALE; + cinfo->out_color_space = JCS_GRAYSCALE; + break; + + case 3: + if (cinfo->saw_JFIF_marker) { + cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ + } else if (cinfo->saw_Adobe_marker) { + switch (cinfo->Adobe_transform) { + case 0: + cinfo->jpeg_color_space = JCS_RGB; + break; + case 1: + cinfo->jpeg_color_space = JCS_YCbCr; + break; + default: + WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); + cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ + break; + } + } else { + /* Saw no special markers, try to guess from the component IDs */ + int cid0 = cinfo->comp_info[0].component_id; + int cid1 = cinfo->comp_info[1].component_id; + int cid2 = cinfo->comp_info[2].component_id; + + if (cid0 == 1 && cid1 == 2 && cid2 == 3) + cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ + else if (cid0 == 82 && cid1 == 71 && cid2 == 66) + cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ + else { + TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2); + cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ + } + } + /* Always guess RGB is proper output colorspace. */ + cinfo->out_color_space = JCS_RGB; + break; + + case 4: + if (cinfo->saw_Adobe_marker) { + switch (cinfo->Adobe_transform) { + case 0: + cinfo->jpeg_color_space = JCS_CMYK; + break; + case 2: + cinfo->jpeg_color_space = JCS_YCCK; + break; + default: + WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); + cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ + break; + } + } else { + /* No special markers, assume straight CMYK. */ + cinfo->jpeg_color_space = JCS_CMYK; + } + cinfo->out_color_space = JCS_CMYK; + break; + + default: + cinfo->jpeg_color_space = JCS_UNKNOWN; + cinfo->out_color_space = JCS_UNKNOWN; + break; + } + + /* Set defaults for other decompression parameters. */ + cinfo->scale_num = 1; /* 1:1 scaling */ + cinfo->scale_denom = 1; + cinfo->output_gamma = 1.0; + cinfo->buffered_image = FALSE; + cinfo->raw_data_out = FALSE; + cinfo->dct_method = JDCT_DEFAULT; + cinfo->do_fancy_upsampling = TRUE; + cinfo->do_block_smoothing = TRUE; + cinfo->quantize_colors = FALSE; + /* We set these in case application only sets quantize_colors. */ + cinfo->dither_mode = JDITHER_FS; +#ifdef QUANT_2PASS_SUPPORTED + cinfo->two_pass_quantize = TRUE; +#else + cinfo->two_pass_quantize = FALSE; +#endif + cinfo->desired_number_of_colors = 256; + cinfo->colormap = NULL; + /* Initialize for no mode change in buffered-image mode. */ + cinfo->enable_1pass_quant = FALSE; + cinfo->enable_external_quant = FALSE; + cinfo->enable_2pass_quant = FALSE; +} + + +/* + * Decompression startup: read start of JPEG datastream to see what's there. + * Need only initialize JPEG object and supply a data source before calling. + * + * This routine will read as far as the first SOS marker (ie, actual start of + * compressed data), and will save all tables and parameters in the JPEG + * object. It will also initialize the decompression parameters to default + * values, and finally return JPEG_HEADER_OK. On return, the application may + * adjust the decompression parameters and then call jpeg_start_decompress. + * (Or, if the application only wanted to determine the image parameters, + * the data need not be decompressed. In that case, call jpeg_abort or + * jpeg_destroy to release any temporary space.) + * If an abbreviated (tables only) datastream is presented, the routine will + * return JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then + * re-use the JPEG object to read the abbreviated image datastream(s). + * It is unnecessary (but OK) to call jpeg_abort in this case. + * The JPEG_SUSPENDED return code only occurs if the data source module + * requests suspension of the decompressor. In this case the application + * should load more source data and then re-call jpeg_read_header to resume + * processing. + * If a non-suspending data source is used and require_image is TRUE, then the + * return code need not be inspected since only JPEG_HEADER_OK is possible. + * + * This routine is now just a front end to jpeg_consume_input, with some + * extra error checking. + */ + +GLOBAL(int) +jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) +{ + int retcode; + + if (cinfo->global_state != DSTATE_START && + cinfo->global_state != DSTATE_INHEADER) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + retcode = jpeg_consume_input(cinfo); + + switch (retcode) { + case JPEG_REACHED_SOS: + retcode = JPEG_HEADER_OK; + break; + case JPEG_REACHED_EOI: + if (require_image) /* Complain if application wanted an image */ + ERREXIT(cinfo, JERR_NO_IMAGE); + /* Reset to start state; it would be safer to require the application to + * call jpeg_abort, but we can't change it now for compatibility reasons. + * A side effect is to free any temporary memory (there shouldn't be any). + */ + jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */ + retcode = JPEG_HEADER_TABLES_ONLY; + break; + case JPEG_SUSPENDED: + /* no work */ + break; + } + + return retcode; +} + + +/* + * Consume data in advance of what the decompressor requires. + * This can be called at any time once the decompressor object has + * been created and a data source has been set up. + * + * This routine is essentially a state machine that handles a couple + * of critical state-transition actions, namely initial setup and + * transition from header scanning to ready-for-start_decompress. + * All the actual input is done via the input controller's consume_input + * method. + */ + +GLOBAL(int) +jpeg_consume_input (j_decompress_ptr cinfo) +{ + int retcode = JPEG_SUSPENDED; + + /* NB: every possible DSTATE value should be listed in this switch */ + switch (cinfo->global_state) { + case DSTATE_START: + /* Start-of-datastream actions: reset appropriate modules */ + (*cinfo->inputctl->reset_input_controller) (cinfo); + /* Initialize application's data source module */ + (*cinfo->src->init_source) (cinfo); + cinfo->global_state = DSTATE_INHEADER; + /*FALLTHROUGH*/ + case DSTATE_INHEADER: + retcode = (*cinfo->inputctl->consume_input) (cinfo); + if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ + /* Set up default parameters based on header data */ + default_decompress_parms(cinfo); + /* Set global state: ready for start_decompress */ + cinfo->global_state = DSTATE_READY; + } + break; + case DSTATE_READY: + /* Can't advance past first SOS until start_decompress is called */ + retcode = JPEG_REACHED_SOS; + break; + case DSTATE_PRELOAD: + case DSTATE_PRESCAN: + case DSTATE_SCANNING: + case DSTATE_RAW_OK: + case DSTATE_BUFIMAGE: + case DSTATE_BUFPOST: + case DSTATE_STOPPING: + retcode = (*cinfo->inputctl->consume_input) (cinfo); + break; + default: + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + } + return retcode; +} + + +/* + * Have we finished reading the input file? + */ + +GLOBAL(boolean) +jpeg_input_complete (j_decompress_ptr cinfo) +{ + /* Check for valid jpeg object */ + if (cinfo->global_state < DSTATE_START || + cinfo->global_state > DSTATE_STOPPING) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + return cinfo->inputctl->eoi_reached; +} + + +/* + * Is there more than one scan? + */ + +GLOBAL(boolean) +jpeg_has_multiple_scans (j_decompress_ptr cinfo) +{ + /* Only valid after jpeg_read_header completes */ + if (cinfo->global_state < DSTATE_READY || + cinfo->global_state > DSTATE_STOPPING) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + return cinfo->inputctl->has_multiple_scans; +} + + +/* + * Finish JPEG decompression. + * + * This will normally just verify the file trailer and release temp storage. + * + * Returns FALSE if suspended. The return value need be inspected only if + * a suspending data source is used. + */ + +GLOBAL(boolean) +jpeg_finish_decompress (j_decompress_ptr cinfo) +{ + if ((cinfo->global_state == DSTATE_SCANNING || + cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) { + /* Terminate final pass of non-buffered mode */ + if (cinfo->output_scanline < cinfo->output_height) + ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); + (*cinfo->master->finish_output_pass) (cinfo); + cinfo->global_state = DSTATE_STOPPING; + } else if (cinfo->global_state == DSTATE_BUFIMAGE) { + /* Finishing after a buffered-image operation */ + cinfo->global_state = DSTATE_STOPPING; + } else if (cinfo->global_state != DSTATE_STOPPING) { + /* STOPPING = repeat call after a suspension, anything else is error */ + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + } + /* Read until EOI */ + while (! cinfo->inputctl->eoi_reached) { + if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) + return FALSE; /* Suspend, come back later */ + } + /* Do final cleanup */ + (*cinfo->src->term_source) (cinfo); + /* We can use jpeg_abort to release memory and reset global_state */ + jpeg_abort((j_common_ptr) cinfo); + return TRUE; +} diff --git a/src/SFML/Graphics/libjpeg/jdapistd.c b/src/SFML/Graphics/libjpeg/jdapistd.c new file mode 100644 index 00000000..f6c7fffe --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdapistd.c @@ -0,0 +1,275 @@ +/* + * jdapistd.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains application interface code for the decompression half + * of the JPEG library. These are the "standard" API routines that are + * used in the normal full-decompression case. They are not used by a + * transcoding-only application. Note that if an application links in + * jpeg_start_decompress, it will end up linking in the entire decompressor. + * We thus must separate this file from jdapimin.c to avoid linking the + * whole decompression library into a transcoder. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Forward declarations */ +LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); + + +/* + * Decompression initialization. + * jpeg_read_header must be completed before calling this. + * + * If a multipass operating mode was selected, this will do all but the + * last pass, and thus may take a great deal of time. + * + * Returns FALSE if suspended. The return value need be inspected only if + * a suspending data source is used. + */ + +GLOBAL(boolean) +jpeg_start_decompress (j_decompress_ptr cinfo) +{ + if (cinfo->global_state == DSTATE_READY) { + /* First call: initialize master control, select active modules */ + jinit_master_decompress(cinfo); + if (cinfo->buffered_image) { + /* No more work here; expecting jpeg_start_output next */ + cinfo->global_state = DSTATE_BUFIMAGE; + return TRUE; + } + cinfo->global_state = DSTATE_PRELOAD; + } + if (cinfo->global_state == DSTATE_PRELOAD) { + /* If file has multiple scans, absorb them all into the coef buffer */ + if (cinfo->inputctl->has_multiple_scans) { +#ifdef D_MULTISCAN_FILES_SUPPORTED + for (;;) { + int retcode; + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + /* Absorb some more input */ + retcode = (*cinfo->inputctl->consume_input) (cinfo); + if (retcode == JPEG_SUSPENDED) + return FALSE; + if (retcode == JPEG_REACHED_EOI) + break; + /* Advance progress counter if appropriate */ + if (cinfo->progress != NULL && + (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { + if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { + /* jdmaster underestimated number of scans; ratchet up one scan */ + cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; + } + } + } +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif /* D_MULTISCAN_FILES_SUPPORTED */ + } + cinfo->output_scan_number = cinfo->input_scan_number; + } else if (cinfo->global_state != DSTATE_PRESCAN) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + /* Perform any dummy output passes, and set up for the final pass */ + return output_pass_setup(cinfo); +} + + +/* + * Set up for an output pass, and perform any dummy pass(es) needed. + * Common subroutine for jpeg_start_decompress and jpeg_start_output. + * Entry: global_state = DSTATE_PRESCAN only if previously suspended. + * Exit: If done, returns TRUE and sets global_state for proper output mode. + * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. + */ + +LOCAL(boolean) +output_pass_setup (j_decompress_ptr cinfo) +{ + if (cinfo->global_state != DSTATE_PRESCAN) { + /* First call: do pass setup */ + (*cinfo->master->prepare_for_output_pass) (cinfo); + cinfo->output_scanline = 0; + cinfo->global_state = DSTATE_PRESCAN; + } + /* Loop over any required dummy passes */ + while (cinfo->master->is_dummy_pass) { +#ifdef QUANT_2PASS_SUPPORTED + /* Crank through the dummy pass */ + while (cinfo->output_scanline < cinfo->output_height) { + JDIMENSION last_scanline; + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) { + cinfo->progress->pass_counter = (long) cinfo->output_scanline; + cinfo->progress->pass_limit = (long) cinfo->output_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + } + /* Process some data */ + last_scanline = cinfo->output_scanline; + (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, + &cinfo->output_scanline, (JDIMENSION) 0); + if (cinfo->output_scanline == last_scanline) + return FALSE; /* No progress made, must suspend */ + } + /* Finish up dummy pass, and set up for another one */ + (*cinfo->master->finish_output_pass) (cinfo); + (*cinfo->master->prepare_for_output_pass) (cinfo); + cinfo->output_scanline = 0; +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif /* QUANT_2PASS_SUPPORTED */ + } + /* Ready for application to drive output pass through + * jpeg_read_scanlines or jpeg_read_raw_data. + */ + cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING; + return TRUE; +} + + +/* + * Read some scanlines of data from the JPEG decompressor. + * + * The return value will be the number of lines actually read. + * This may be less than the number requested in several cases, + * including bottom of image, data source suspension, and operating + * modes that emit multiple scanlines at a time. + * + * Note: we warn about excess calls to jpeg_read_scanlines() since + * this likely signals an application programmer error. However, + * an oversize buffer (max_lines > scanlines remaining) is not an error. + */ + +GLOBAL(JDIMENSION) +jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, + JDIMENSION max_lines) +{ + JDIMENSION row_ctr; + + if (cinfo->global_state != DSTATE_SCANNING) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + if (cinfo->output_scanline >= cinfo->output_height) { + WARNMS(cinfo, JWRN_TOO_MUCH_DATA); + return 0; + } + + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) { + cinfo->progress->pass_counter = (long) cinfo->output_scanline; + cinfo->progress->pass_limit = (long) cinfo->output_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + } + + /* Process some data */ + row_ctr = 0; + (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); + cinfo->output_scanline += row_ctr; + return row_ctr; +} + + +/* + * Alternate entry point to read raw data. + * Processes exactly one iMCU row per call, unless suspended. + */ + +GLOBAL(JDIMENSION) +jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION max_lines) +{ + JDIMENSION lines_per_iMCU_row; + + if (cinfo->global_state != DSTATE_RAW_OK) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + if (cinfo->output_scanline >= cinfo->output_height) { + WARNMS(cinfo, JWRN_TOO_MUCH_DATA); + return 0; + } + + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) { + cinfo->progress->pass_counter = (long) cinfo->output_scanline; + cinfo->progress->pass_limit = (long) cinfo->output_height; + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + } + + /* Verify that at least one iMCU row can be returned. */ + lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size; + if (max_lines < lines_per_iMCU_row) + ERREXIT(cinfo, JERR_BUFFER_SIZE); + + /* Decompress directly into user's buffer. */ + if (! (*cinfo->coef->decompress_data) (cinfo, data)) + return 0; /* suspension forced, can do nothing more */ + + /* OK, we processed one iMCU row. */ + cinfo->output_scanline += lines_per_iMCU_row; + return lines_per_iMCU_row; +} + + +/* Additional entry points for buffered-image mode. */ + +#ifdef D_MULTISCAN_FILES_SUPPORTED + +/* + * Initialize for an output pass in buffered-image mode. + */ + +GLOBAL(boolean) +jpeg_start_output (j_decompress_ptr cinfo, int scan_number) +{ + if (cinfo->global_state != DSTATE_BUFIMAGE && + cinfo->global_state != DSTATE_PRESCAN) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + /* Limit scan number to valid range */ + if (scan_number <= 0) + scan_number = 1; + if (cinfo->inputctl->eoi_reached && + scan_number > cinfo->input_scan_number) + scan_number = cinfo->input_scan_number; + cinfo->output_scan_number = scan_number; + /* Perform any dummy output passes, and set up for the real pass */ + return output_pass_setup(cinfo); +} + + +/* + * Finish up after an output pass in buffered-image mode. + * + * Returns FALSE if suspended. The return value need be inspected only if + * a suspending data source is used. + */ + +GLOBAL(boolean) +jpeg_finish_output (j_decompress_ptr cinfo) +{ + if ((cinfo->global_state == DSTATE_SCANNING || + cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) { + /* Terminate this pass. */ + /* We do not require the whole pass to have been completed. */ + (*cinfo->master->finish_output_pass) (cinfo); + cinfo->global_state = DSTATE_BUFPOST; + } else if (cinfo->global_state != DSTATE_BUFPOST) { + /* BUFPOST = repeat call after a suspension, anything else is error */ + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + } + /* Read markers looking for SOS or EOI */ + while (cinfo->input_scan_number <= cinfo->output_scan_number && + ! cinfo->inputctl->eoi_reached) { + if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) + return FALSE; /* Suspend, come back later */ + } + cinfo->global_state = DSTATE_BUFIMAGE; + return TRUE; +} + +#endif /* D_MULTISCAN_FILES_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jdatadst.c b/src/SFML/Graphics/libjpeg/jdatadst.c new file mode 100644 index 00000000..2ece4e95 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdatadst.c @@ -0,0 +1,151 @@ +/* + * jdatadst.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains compression data destination routines for the case of + * emitting JPEG data to a file (or any stdio stream). While these routines + * are sufficient for most applications, some will want to use a different + * destination manager. + * IMPORTANT: we assume that fwrite() will correctly transcribe an array of + * JOCTETs into 8-bit-wide elements on external storage. If char is wider + * than 8 bits on your machine, you may need to do some tweaking. + */ + +/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ +#include "jinclude.h" +#include "jpeglib.h" +#include "jerror.h" + + +/* Expanded data destination object for stdio output */ + +typedef struct { + struct jpeg_destination_mgr pub; /* public fields */ + + FILE * outfile; /* target stream */ + JOCTET * buffer; /* start of buffer */ +} my_destination_mgr; + +typedef my_destination_mgr * my_dest_ptr; + +#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ + + +/* + * Initialize destination --- called by jpeg_start_compress + * before any data is actually written. + */ + +METHODDEF(void) +init_destination (j_compress_ptr cinfo) +{ + my_dest_ptr dest = (my_dest_ptr) cinfo->dest; + + /* Allocate the output buffer --- it will be released when done with image */ + dest->buffer = (JOCTET *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); + + dest->pub.next_output_byte = dest->buffer; + dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; +} + + +/* + * Empty the output buffer --- called whenever buffer fills up. + * + * In typical applications, this should write the entire output buffer + * (ignoring the current state of next_output_byte & free_in_buffer), + * reset the pointer & count to the start of the buffer, and return TRUE + * indicating that the buffer has been dumped. + * + * In applications that need to be able to suspend compression due to output + * overrun, a FALSE return indicates that the buffer cannot be emptied now. + * In this situation, the compressor will return to its caller (possibly with + * an indication that it has not accepted all the supplied scanlines). The + * application should resume compression after it has made more room in the + * output buffer. Note that there are substantial restrictions on the use of + * suspension --- see the documentation. + * + * When suspending, the compressor will back up to a convenient restart point + * (typically the start of the current MCU). next_output_byte & free_in_buffer + * indicate where the restart point will be if the current call returns FALSE. + * Data beyond this point will be regenerated after resumption, so do not + * write it out when emptying the buffer externally. + */ + +METHODDEF(boolean) +empty_output_buffer (j_compress_ptr cinfo) +{ + my_dest_ptr dest = (my_dest_ptr) cinfo->dest; + + if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) != + (size_t) OUTPUT_BUF_SIZE) + ERREXIT(cinfo, JERR_FILE_WRITE); + + dest->pub.next_output_byte = dest->buffer; + dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; + + return TRUE; +} + + +/* + * Terminate destination --- called by jpeg_finish_compress + * after all data has been written. Usually needs to flush buffer. + * + * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding + * application must deal with any cleanup that should happen even + * for error exit. + */ + +METHODDEF(void) +term_destination (j_compress_ptr cinfo) +{ + my_dest_ptr dest = (my_dest_ptr) cinfo->dest; + size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer; + + /* Write any data remaining in the buffer */ + if (datacount > 0) { + if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount) + ERREXIT(cinfo, JERR_FILE_WRITE); + } + fflush(dest->outfile); + /* Make sure we wrote the output file OK */ + if (ferror(dest->outfile)) + ERREXIT(cinfo, JERR_FILE_WRITE); +} + + +/* + * Prepare for output to a stdio stream. + * The caller must have already opened the stream, and is responsible + * for closing it after finishing compression. + */ + +GLOBAL(void) +jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile) +{ + my_dest_ptr dest; + + /* The destination object is made permanent so that multiple JPEG images + * can be written to the same file without re-executing jpeg_stdio_dest. + * This makes it dangerous to use this manager and a different destination + * manager serially with the same JPEG object, because their private object + * sizes may be different. Caveat programmer. + */ + if (cinfo->dest == NULL) { /* first time for this JPEG object? */ + cinfo->dest = (struct jpeg_destination_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + SIZEOF(my_destination_mgr)); + } + + dest = (my_dest_ptr) cinfo->dest; + dest->pub.init_destination = init_destination; + dest->pub.empty_output_buffer = empty_output_buffer; + dest->pub.term_destination = term_destination; + dest->outfile = outfile; +} diff --git a/src/SFML/Graphics/libjpeg/jdatasrc.c b/src/SFML/Graphics/libjpeg/jdatasrc.c new file mode 100644 index 00000000..29b69832 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdatasrc.c @@ -0,0 +1,212 @@ +/* + * jdatasrc.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains decompression data source routines for the case of + * reading JPEG data from a file (or any stdio stream). While these routines + * are sufficient for most applications, some will want to use a different + * source manager. + * IMPORTANT: we assume that fread() will correctly transcribe an array of + * JOCTETs from 8-bit-wide elements on external storage. If char is wider + * than 8 bits on your machine, you may need to do some tweaking. + */ + +/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ +#include "jinclude.h" +#include "jpeglib.h" +#include "jerror.h" + + +/* Expanded data source object for stdio input */ + +typedef struct { + struct jpeg_source_mgr pub; /* public fields */ + + FILE * infile; /* source stream */ + JOCTET * buffer; /* start of buffer */ + boolean start_of_file; /* have we gotten any data yet? */ +} my_source_mgr; + +typedef my_source_mgr * my_src_ptr; + +#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ + + +/* + * Initialize source --- called by jpeg_read_header + * before any data is actually read. + */ + +METHODDEF(void) +init_source (j_decompress_ptr cinfo) +{ + my_src_ptr src = (my_src_ptr) cinfo->src; + + /* We reset the empty-input-file flag for each image, + * but we don't clear the input buffer. + * This is correct behavior for reading a series of images from one source. + */ + src->start_of_file = TRUE; +} + + +/* + * Fill the input buffer --- called whenever buffer is emptied. + * + * In typical applications, this should read fresh data into the buffer + * (ignoring the current state of next_input_byte & bytes_in_buffer), + * reset the pointer & count to the start of the buffer, and return TRUE + * indicating that the buffer has been reloaded. It is not necessary to + * fill the buffer entirely, only to obtain at least one more byte. + * + * There is no such thing as an EOF return. If the end of the file has been + * reached, the routine has a choice of ERREXIT() or inserting fake data into + * the buffer. In most cases, generating a warning message and inserting a + * fake EOI marker is the best course of action --- this will allow the + * decompressor to output however much of the image is there. However, + * the resulting error message is misleading if the real problem is an empty + * input file, so we handle that case specially. + * + * In applications that need to be able to suspend compression due to input + * not being available yet, a FALSE return indicates that no more data can be + * obtained right now, but more may be forthcoming later. In this situation, + * the decompressor will return to its caller (with an indication of the + * number of scanlines it has read, if any). The application should resume + * decompression after it has loaded more data into the input buffer. Note + * that there are substantial restrictions on the use of suspension --- see + * the documentation. + * + * When suspending, the decompressor will back up to a convenient restart point + * (typically the start of the current MCU). next_input_byte & bytes_in_buffer + * indicate where the restart point will be if the current call returns FALSE. + * Data beyond this point must be rescanned after resumption, so move it to + * the front of the buffer rather than discarding it. + */ + +METHODDEF(boolean) +fill_input_buffer (j_decompress_ptr cinfo) +{ + my_src_ptr src = (my_src_ptr) cinfo->src; + size_t nbytes; + + nbytes = JFREAD(src->infile, src->buffer, INPUT_BUF_SIZE); + + if (nbytes <= 0) { + if (src->start_of_file) /* Treat empty input file as fatal error */ + ERREXIT(cinfo, JERR_INPUT_EMPTY); + WARNMS(cinfo, JWRN_JPEG_EOF); + /* Insert a fake EOI marker */ + src->buffer[0] = (JOCTET) 0xFF; + src->buffer[1] = (JOCTET) JPEG_EOI; + nbytes = 2; + } + + src->pub.next_input_byte = src->buffer; + src->pub.bytes_in_buffer = nbytes; + src->start_of_file = FALSE; + + return TRUE; +} + + +/* + * Skip data --- used to skip over a potentially large amount of + * uninteresting data (such as an APPn marker). + * + * Writers of suspendable-input applications must note that skip_input_data + * is not granted the right to give a suspension return. If the skip extends + * beyond the data currently in the buffer, the buffer can be marked empty so + * that the next read will cause a fill_input_buffer call that can suspend. + * Arranging for additional bytes to be discarded before reloading the input + * buffer is the application writer's problem. + */ + +METHODDEF(void) +skip_input_data (j_decompress_ptr cinfo, long num_bytes) +{ + my_src_ptr src = (my_src_ptr) cinfo->src; + + /* Just a dumb implementation for now. Could use fseek() except + * it doesn't work on pipes. Not clear that being smart is worth + * any trouble anyway --- large skips are infrequent. + */ + if (num_bytes > 0) { + while (num_bytes > (long) src->pub.bytes_in_buffer) { + num_bytes -= (long) src->pub.bytes_in_buffer; + (void) fill_input_buffer(cinfo); + /* note we assume that fill_input_buffer will never return FALSE, + * so suspension need not be handled. + */ + } + src->pub.next_input_byte += (size_t) num_bytes; + src->pub.bytes_in_buffer -= (size_t) num_bytes; + } +} + + +/* + * An additional method that can be provided by data source modules is the + * resync_to_restart method for error recovery in the presence of RST markers. + * For the moment, this source module just uses the default resync method + * provided by the JPEG library. That method assumes that no backtracking + * is possible. + */ + + +/* + * Terminate source --- called by jpeg_finish_decompress + * after all data has been read. Often a no-op. + * + * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding + * application must deal with any cleanup that should happen even + * for error exit. + */ + +METHODDEF(void) +term_source (j_decompress_ptr cinfo) +{ + /* no work necessary here */ +} + + +/* + * Prepare for input from a stdio stream. + * The caller must have already opened the stream, and is responsible + * for closing it after finishing decompression. + */ + +GLOBAL(void) +jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) +{ + my_src_ptr src; + + /* The source object and input buffer are made permanent so that a series + * of JPEG images can be read from the same file by calling jpeg_stdio_src + * only before the first one. (If we discarded the buffer at the end of + * one image, we'd likely lose the start of the next one.) + * This makes it unsafe to use this manager and a different source + * manager serially with the same JPEG object. Caveat programmer. + */ + if (cinfo->src == NULL) { /* first time for this JPEG object? */ + cinfo->src = (struct jpeg_source_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + SIZEOF(my_source_mgr)); + src = (my_src_ptr) cinfo->src; + src->buffer = (JOCTET *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + INPUT_BUF_SIZE * SIZEOF(JOCTET)); + } + + src = (my_src_ptr) cinfo->src; + src->pub.init_source = init_source; + src->pub.fill_input_buffer = fill_input_buffer; + src->pub.skip_input_data = skip_input_data; + src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ + src->pub.term_source = term_source; + src->infile = infile; + src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ + src->pub.next_input_byte = NULL; /* until buffer loaded */ +} diff --git a/src/SFML/Graphics/libjpeg/jdcoefct.c b/src/SFML/Graphics/libjpeg/jdcoefct.c new file mode 100644 index 00000000..992bd105 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdcoefct.c @@ -0,0 +1,736 @@ +/* + * jdcoefct.c + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the coefficient buffer controller for decompression. + * This controller is the top level of the JPEG decompressor proper. + * The coefficient buffer lies between entropy decoding and inverse-DCT steps. + * + * In buffered-image mode, this controller is the interface between + * input-oriented processing and output-oriented processing. + * Also, the input side (only) is used when reading a file for transcoding. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + +/* Block smoothing is only applicable for progressive JPEG, so: */ +#ifndef D_PROGRESSIVE_SUPPORTED +#undef BLOCK_SMOOTHING_SUPPORTED +#endif + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_d_coef_controller pub; /* public fields */ + + /* These variables keep track of the current location of the input side. */ + /* cinfo->input_iMCU_row is also used for this. */ + JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ + int MCU_vert_offset; /* counts MCU rows within iMCU row */ + int MCU_rows_per_iMCU_row; /* number of such rows needed */ + + /* The output side's location is represented by cinfo->output_iMCU_row. */ + + /* In single-pass modes, it's sufficient to buffer just one MCU. + * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks, + * and let the entropy decoder write into that workspace each time. + * (On 80x86, the workspace is FAR even though it's not really very big; + * this is to keep the module interfaces unchanged when a large coefficient + * buffer is necessary.) + * In multi-pass modes, this array points to the current MCU's blocks + * within the virtual arrays; it is used only by the input side. + */ + JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU]; + +#ifdef D_MULTISCAN_FILES_SUPPORTED + /* In multi-pass modes, we need a virtual block array for each component. */ + jvirt_barray_ptr whole_image[MAX_COMPONENTS]; +#endif + +#ifdef BLOCK_SMOOTHING_SUPPORTED + /* When doing block smoothing, we latch coefficient Al values here */ + int * coef_bits_latch; +#define SAVED_COEFS 6 /* we save coef_bits[0..5] */ +#endif +} my_coef_controller; + +typedef my_coef_controller * my_coef_ptr; + +/* Forward declarations */ +METHODDEF(int) decompress_onepass + JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); +#ifdef D_MULTISCAN_FILES_SUPPORTED +METHODDEF(int) decompress_data + JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); +#endif +#ifdef BLOCK_SMOOTHING_SUPPORTED +LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); +METHODDEF(int) decompress_smooth_data + JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); +#endif + + +LOCAL(void) +start_iMCU_row (j_decompress_ptr cinfo) +/* Reset within-iMCU-row counters for a new row (input side) */ +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + + /* In an interleaved scan, an MCU row is the same as an iMCU row. + * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. + * But at the bottom of the image, process only what's left. + */ + if (cinfo->comps_in_scan > 1) { + coef->MCU_rows_per_iMCU_row = 1; + } else { + if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1)) + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; + else + coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; + } + + coef->MCU_ctr = 0; + coef->MCU_vert_offset = 0; +} + + +/* + * Initialize for an input processing pass. + */ + +METHODDEF(void) +start_input_pass (j_decompress_ptr cinfo) +{ + cinfo->input_iMCU_row = 0; + start_iMCU_row(cinfo); +} + + +/* + * Initialize for an output processing pass. + */ + +METHODDEF(void) +start_output_pass (j_decompress_ptr cinfo) +{ +#ifdef BLOCK_SMOOTHING_SUPPORTED + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + + /* If multipass, check to see whether to use block smoothing on this pass */ + if (coef->pub.coef_arrays != NULL) { + if (cinfo->do_block_smoothing && smoothing_ok(cinfo)) + coef->pub.decompress_data = decompress_smooth_data; + else + coef->pub.decompress_data = decompress_data; + } +#endif + cinfo->output_iMCU_row = 0; +} + + +/* + * Decompress and return some data in the single-pass case. + * Always attempts to emit one fully interleaved MCU row ("iMCU" row). + * Input and output must run in lockstep since we have only a one-MCU buffer. + * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. + * + * NB: output_buf contains a plane for each component in image, + * which we index according to the component's SOF position. + */ + +METHODDEF(int) +decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION MCU_col_num; /* index of current MCU within row */ + JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; + JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; + int blkn, ci, xindex, yindex, yoffset, useful_width; + JSAMPARRAY output_ptr; + JDIMENSION start_col, output_col; + jpeg_component_info *compptr; + inverse_DCT_method_ptr inverse_DCT; + + /* Loop to process as much as one whole iMCU row */ + for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; + yoffset++) { + for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; + MCU_col_num++) { + /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ + jzero_far((void FAR *) coef->MCU_buffer[0], + (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); + if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->MCU_ctr = MCU_col_num; + return JPEG_SUSPENDED; + } + /* Determine where data should go in output_buf and do the IDCT thing. + * We skip dummy blocks at the right and bottom edges (but blkn gets + * incremented past them!). Note the inner loop relies on having + * allocated the MCU_buffer[] blocks sequentially. + */ + blkn = 0; /* index of current DCT block within MCU */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Don't bother to IDCT an uninteresting component. */ + if (! compptr->component_needed) { + blkn += compptr->MCU_blocks; + continue; + } + inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; + useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width + : compptr->last_col_width; + output_ptr = output_buf[compptr->component_index] + + yoffset * compptr->DCT_scaled_size; + start_col = MCU_col_num * compptr->MCU_sample_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + if (cinfo->input_iMCU_row < last_iMCU_row || + yoffset+yindex < compptr->last_row_height) { + output_col = start_col; + for (xindex = 0; xindex < useful_width; xindex++) { + (*inverse_DCT) (cinfo, compptr, + (JCOEFPTR) coef->MCU_buffer[blkn+xindex], + output_ptr, output_col); + output_col += compptr->DCT_scaled_size; + } + } + blkn += compptr->MCU_width; + output_ptr += compptr->DCT_scaled_size; + } + } + } + /* Completed an MCU row, but perhaps not an iMCU row */ + coef->MCU_ctr = 0; + } + /* Completed the iMCU row, advance counters for next one */ + cinfo->output_iMCU_row++; + if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { + start_iMCU_row(cinfo); + return JPEG_ROW_COMPLETED; + } + /* Completed the scan */ + (*cinfo->inputctl->finish_input_pass) (cinfo); + return JPEG_SCAN_COMPLETED; +} + + +/* + * Dummy consume-input routine for single-pass operation. + */ + +METHODDEF(int) +dummy_consume_data (j_decompress_ptr cinfo) +{ + return JPEG_SUSPENDED; /* Always indicate nothing was done */ +} + + +#ifdef D_MULTISCAN_FILES_SUPPORTED + +/* + * Consume input data and store it in the full-image coefficient buffer. + * We read as much as one fully interleaved MCU row ("iMCU" row) per call, + * ie, v_samp_factor block rows for each component in the scan. + * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. + */ + +METHODDEF(int) +consume_data (j_decompress_ptr cinfo) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION MCU_col_num; /* index of current MCU within row */ + int blkn, ci, xindex, yindex, yoffset; + JDIMENSION start_col; + JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; + JBLOCKROW buffer_ptr; + jpeg_component_info *compptr; + + /* Align the virtual buffers for the components used in this scan. */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + buffer[ci] = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], + cinfo->input_iMCU_row * compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, TRUE); + /* Note: entropy decoder expects buffer to be zeroed, + * but this is handled automatically by the memory manager + * because we requested a pre-zeroed array. + */ + } + + /* Loop to process one whole iMCU row */ + for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; + yoffset++) { + for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row; + MCU_col_num++) { + /* Construct list of pointers to DCT blocks belonging to this MCU */ + blkn = 0; /* index of current DCT block within MCU */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + start_col = MCU_col_num * compptr->MCU_width; + for (yindex = 0; yindex < compptr->MCU_height; yindex++) { + buffer_ptr = buffer[ci][yindex+yoffset] + start_col; + for (xindex = 0; xindex < compptr->MCU_width; xindex++) { + coef->MCU_buffer[blkn++] = buffer_ptr++; + } + } + } + /* Try to fetch the MCU. */ + if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { + /* Suspension forced; update state counters and exit */ + coef->MCU_vert_offset = yoffset; + coef->MCU_ctr = MCU_col_num; + return JPEG_SUSPENDED; + } + } + /* Completed an MCU row, but perhaps not an iMCU row */ + coef->MCU_ctr = 0; + } + /* Completed the iMCU row, advance counters for next one */ + if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { + start_iMCU_row(cinfo); + return JPEG_ROW_COMPLETED; + } + /* Completed the scan */ + (*cinfo->inputctl->finish_input_pass) (cinfo); + return JPEG_SCAN_COMPLETED; +} + + +/* + * Decompress and return some data in the multi-pass case. + * Always attempts to emit one fully interleaved MCU row ("iMCU" row). + * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. + * + * NB: output_buf contains a plane for each component in image. + */ + +METHODDEF(int) +decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; + JDIMENSION block_num; + int ci, block_row, block_rows; + JBLOCKARRAY buffer; + JBLOCKROW buffer_ptr; + JSAMPARRAY output_ptr; + JDIMENSION output_col; + jpeg_component_info *compptr; + inverse_DCT_method_ptr inverse_DCT; + + /* Force some input to be done if we are getting ahead of the input. */ + while (cinfo->input_scan_number < cinfo->output_scan_number || + (cinfo->input_scan_number == cinfo->output_scan_number && + cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { + if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) + return JPEG_SUSPENDED; + } + + /* OK, output from the virtual arrays. */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Don't bother to IDCT an uninteresting component. */ + if (! compptr->component_needed) + continue; + /* Align the virtual buffer for this component. */ + buffer = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[ci], + cinfo->output_iMCU_row * compptr->v_samp_factor, + (JDIMENSION) compptr->v_samp_factor, FALSE); + /* Count non-dummy DCT block rows in this iMCU row. */ + if (cinfo->output_iMCU_row < last_iMCU_row) + block_rows = compptr->v_samp_factor; + else { + /* NB: can't use last_row_height here; it is input-side-dependent! */ + block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); + if (block_rows == 0) block_rows = compptr->v_samp_factor; + } + inverse_DCT = cinfo->idct->inverse_DCT[ci]; + output_ptr = output_buf[ci]; + /* Loop over all DCT blocks to be processed. */ + for (block_row = 0; block_row < block_rows; block_row++) { + buffer_ptr = buffer[block_row]; + output_col = 0; + for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { + (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, + output_ptr, output_col); + buffer_ptr++; + output_col += compptr->DCT_scaled_size; + } + output_ptr += compptr->DCT_scaled_size; + } + } + + if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) + return JPEG_ROW_COMPLETED; + return JPEG_SCAN_COMPLETED; +} + +#endif /* D_MULTISCAN_FILES_SUPPORTED */ + + +#ifdef BLOCK_SMOOTHING_SUPPORTED + +/* + * This code applies interblock smoothing as described by section K.8 + * of the JPEG standard: the first 5 AC coefficients are estimated from + * the DC values of a DCT block and its 8 neighboring blocks. + * We apply smoothing only for progressive JPEG decoding, and only if + * the coefficients it can estimate are not yet known to full precision. + */ + +/* Natural-order array positions of the first 5 zigzag-order coefficients */ +#define Q01_POS 1 +#define Q10_POS 8 +#define Q20_POS 16 +#define Q11_POS 9 +#define Q02_POS 2 + +/* + * Determine whether block smoothing is applicable and safe. + * We also latch the current states of the coef_bits[] entries for the + * AC coefficients; otherwise, if the input side of the decompressor + * advances into a new scan, we might think the coefficients are known + * more accurately than they really are. + */ + +LOCAL(boolean) +smoothing_ok (j_decompress_ptr cinfo) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + boolean smoothing_useful = FALSE; + int ci, coefi; + jpeg_component_info *compptr; + JQUANT_TBL * qtable; + int * coef_bits; + int * coef_bits_latch; + + if (! cinfo->progressive_mode || cinfo->coef_bits == NULL) + return FALSE; + + /* Allocate latch area if not already done */ + if (coef->coef_bits_latch == NULL) + coef->coef_bits_latch = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->num_components * + (SAVED_COEFS * SIZEOF(int))); + coef_bits_latch = coef->coef_bits_latch; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* All components' quantization values must already be latched. */ + if ((qtable = compptr->quant_table) == NULL) + return FALSE; + /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ + if (qtable->quantval[0] == 0 || + qtable->quantval[Q01_POS] == 0 || + qtable->quantval[Q10_POS] == 0 || + qtable->quantval[Q20_POS] == 0 || + qtable->quantval[Q11_POS] == 0 || + qtable->quantval[Q02_POS] == 0) + return FALSE; + /* DC values must be at least partly known for all components. */ + coef_bits = cinfo->coef_bits[ci]; + if (coef_bits[0] < 0) + return FALSE; + /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ + for (coefi = 1; coefi <= 5; coefi++) { + coef_bits_latch[coefi] = coef_bits[coefi]; + if (coef_bits[coefi] != 0) + smoothing_useful = TRUE; + } + coef_bits_latch += SAVED_COEFS; + } + + return smoothing_useful; +} + + +/* + * Variant of decompress_data for use when doing block smoothing. + */ + +METHODDEF(int) +decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) +{ + my_coef_ptr coef = (my_coef_ptr) cinfo->coef; + JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; + JDIMENSION block_num, last_block_column; + int ci, block_row, block_rows, access_rows; + JBLOCKARRAY buffer; + JBLOCKROW buffer_ptr, prev_block_row, next_block_row; + JSAMPARRAY output_ptr; + JDIMENSION output_col; + jpeg_component_info *compptr; + inverse_DCT_method_ptr inverse_DCT; + boolean first_row, last_row; + JBLOCK workspace; + int *coef_bits; + JQUANT_TBL *quanttbl; + INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; + int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; + int Al, pred; + + /* Force some input to be done if we are getting ahead of the input. */ + while (cinfo->input_scan_number <= cinfo->output_scan_number && + ! cinfo->inputctl->eoi_reached) { + if (cinfo->input_scan_number == cinfo->output_scan_number) { + /* If input is working on current scan, we ordinarily want it to + * have completed the current row. But if input scan is DC, + * we want it to keep one row ahead so that next block row's DC + * values are up to date. + */ + JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0; + if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta) + break; + } + if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) + return JPEG_SUSPENDED; + } + + /* OK, output from the virtual arrays. */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Don't bother to IDCT an uninteresting component. */ + if (! compptr->component_needed) + continue; + /* Count non-dummy DCT block rows in this iMCU row. */ + if (cinfo->output_iMCU_row < last_iMCU_row) { + block_rows = compptr->v_samp_factor; + access_rows = block_rows * 2; /* this and next iMCU row */ + last_row = FALSE; + } else { + /* NB: can't use last_row_height here; it is input-side-dependent! */ + block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); + if (block_rows == 0) block_rows = compptr->v_samp_factor; + access_rows = block_rows; /* this iMCU row only */ + last_row = TRUE; + } + /* Align the virtual buffer for this component. */ + if (cinfo->output_iMCU_row > 0) { + access_rows += compptr->v_samp_factor; /* prior iMCU row too */ + buffer = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[ci], + (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, + (JDIMENSION) access_rows, FALSE); + buffer += compptr->v_samp_factor; /* point to current iMCU row */ + first_row = FALSE; + } else { + buffer = (*cinfo->mem->access_virt_barray) + ((j_common_ptr) cinfo, coef->whole_image[ci], + (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); + first_row = TRUE; + } + /* Fetch component-dependent info */ + coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS); + quanttbl = compptr->quant_table; + Q00 = quanttbl->quantval[0]; + Q01 = quanttbl->quantval[Q01_POS]; + Q10 = quanttbl->quantval[Q10_POS]; + Q20 = quanttbl->quantval[Q20_POS]; + Q11 = quanttbl->quantval[Q11_POS]; + Q02 = quanttbl->quantval[Q02_POS]; + inverse_DCT = cinfo->idct->inverse_DCT[ci]; + output_ptr = output_buf[ci]; + /* Loop over all DCT blocks to be processed. */ + for (block_row = 0; block_row < block_rows; block_row++) { + buffer_ptr = buffer[block_row]; + if (first_row && block_row == 0) + prev_block_row = buffer_ptr; + else + prev_block_row = buffer[block_row-1]; + if (last_row && block_row == block_rows-1) + next_block_row = buffer_ptr; + else + next_block_row = buffer[block_row+1]; + /* We fetch the surrounding DC values using a sliding-register approach. + * Initialize all nine here so as to do the right thing on narrow pics. + */ + DC1 = DC2 = DC3 = (int) prev_block_row[0][0]; + DC4 = DC5 = DC6 = (int) buffer_ptr[0][0]; + DC7 = DC8 = DC9 = (int) next_block_row[0][0]; + output_col = 0; + last_block_column = compptr->width_in_blocks - 1; + for (block_num = 0; block_num <= last_block_column; block_num++) { + /* Fetch current DCT block into workspace so we can modify it. */ + jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); + /* Update DC values */ + if (block_num < last_block_column) { + DC3 = (int) prev_block_row[1][0]; + DC6 = (int) buffer_ptr[1][0]; + DC9 = (int) next_block_row[1][0]; + } + /* Compute coefficient estimates per K.8. + * An estimate is applied only if coefficient is still zero, + * and is not known to be fully accurate. + */ + /* AC01 */ + if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { + num = 36 * Q00 * (DC4 - DC6); + if (num >= 0) { + pred = (int) (((Q01<<7) + num) / (Q01<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q10<<7) + num) / (Q10<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q20<<7) + num) / (Q20<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q11<<7) + num) / (Q11<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) { + pred = (int) (((Q02<<7) + num) / (Q02<<8)); + if (Al > 0 && pred >= (1< 0 && pred >= (1<DCT_scaled_size; + } + output_ptr += compptr->DCT_scaled_size; + } + } + + if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) + return JPEG_ROW_COMPLETED; + return JPEG_SCAN_COMPLETED; +} + +#endif /* BLOCK_SMOOTHING_SUPPORTED */ + + +/* + * Initialize coefficient buffer controller. + */ + +GLOBAL(void) +jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) +{ + my_coef_ptr coef; + + coef = (my_coef_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_coef_controller)); + cinfo->coef = (struct jpeg_d_coef_controller *) coef; + coef->pub.start_input_pass = start_input_pass; + coef->pub.start_output_pass = start_output_pass; +#ifdef BLOCK_SMOOTHING_SUPPORTED + coef->coef_bits_latch = NULL; +#endif + + /* Create the coefficient buffer. */ + if (need_full_buffer) { +#ifdef D_MULTISCAN_FILES_SUPPORTED + /* Allocate a full-image virtual array for each component, */ + /* padded to a multiple of samp_factor DCT blocks in each direction. */ + /* Note we ask for a pre-zeroed array. */ + int ci, access_rows; + jpeg_component_info *compptr; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + access_rows = compptr->v_samp_factor; +#ifdef BLOCK_SMOOTHING_SUPPORTED + /* If block smoothing could be used, need a bigger window */ + if (cinfo->progressive_mode) + access_rows *= 3; +#endif + coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, + (JDIMENSION) jround_up((long) compptr->width_in_blocks, + (long) compptr->h_samp_factor), + (JDIMENSION) jround_up((long) compptr->height_in_blocks, + (long) compptr->v_samp_factor), + (JDIMENSION) access_rows); + } + coef->pub.consume_data = consume_data; + coef->pub.decompress_data = decompress_data; + coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */ +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else { + /* We only need a single-MCU buffer. */ + JBLOCKROW buffer; + int i; + + buffer = (JBLOCKROW) + (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); + for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) { + coef->MCU_buffer[i] = buffer + i; + } + coef->pub.consume_data = dummy_consume_data; + coef->pub.decompress_data = decompress_onepass; + coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ + } +} diff --git a/src/SFML/Graphics/libjpeg/jdcolor.c b/src/SFML/Graphics/libjpeg/jdcolor.c new file mode 100644 index 00000000..fd7b1388 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdcolor.c @@ -0,0 +1,396 @@ +/* + * jdcolor.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains output colorspace conversion routines. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Private subobject */ + +typedef struct { + struct jpeg_color_deconverter pub; /* public fields */ + + /* Private state for YCC->RGB conversion */ + int * Cr_r_tab; /* => table for Cr to R conversion */ + int * Cb_b_tab; /* => table for Cb to B conversion */ + INT32 * Cr_g_tab; /* => table for Cr to G conversion */ + INT32 * Cb_g_tab; /* => table for Cb to G conversion */ +} my_color_deconverter; + +typedef my_color_deconverter * my_cconvert_ptr; + + +/**************** YCbCr -> RGB conversion: most common case **************/ + +/* + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + * The conversion equations to be implemented are therefore + * R = Y + 1.40200 * Cr + * G = Y - 0.34414 * Cb - 0.71414 * Cr + * B = Y + 1.77200 * Cb + * where Cb and Cr represent the incoming values less CENTERJSAMPLE. + * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) + * + * To avoid floating-point arithmetic, we represent the fractional constants + * as integers scaled up by 2^16 (about 4 digits precision); we have to divide + * the products by 2^16, with appropriate rounding, to get the correct answer. + * Notice that Y, being an integral input, does not contribute any fraction + * so it need not participate in the rounding. + * + * For even more speed, we avoid doing any multiplications in the inner loop + * by precalculating the constants times Cb and Cr for all possible values. + * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); + * for 12-bit samples it is still acceptable. It's not very reasonable for + * 16-bit samples, but if you want lossless storage you shouldn't be changing + * colorspace anyway. + * The Cr=>R and Cb=>B values can be rounded to integers in advance; the + * values for the G calculation are left scaled up, since we must add them + * together before rounding. + */ + +#define SCALEBITS 16 /* speediest right-shift on some machines */ +#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) +#define FIX(x) ((INT32) ((x) * (1L<RGB colorspace conversion. + */ + +LOCAL(void) +build_ycc_rgb_table (j_decompress_ptr cinfo) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + int i; + INT32 x; + SHIFT_TEMPS + + cconvert->Cr_r_tab = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(int)); + cconvert->Cb_b_tab = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(int)); + cconvert->Cr_g_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(INT32)); + cconvert->Cb_g_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(INT32)); + + for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { + /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ + /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ + /* Cr=>R value is nearest int to 1.40200 * x */ + cconvert->Cr_r_tab[i] = (int) + RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); + /* Cb=>B value is nearest int to 1.77200 * x */ + cconvert->Cb_b_tab[i] = (int) + RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); + /* Cr=>G value is scaled-up -0.71414 * x */ + cconvert->Cr_g_tab[i] = (- FIX(0.71414)) * x; + /* Cb=>G value is scaled-up -0.34414 * x */ + /* We also add in ONE_HALF so that need not do it in inner loop */ + cconvert->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; + } +} + + +/* + * Convert some rows of samples to the output colorspace. + * + * Note that we change from noninterleaved, one-plane-per-component format + * to interleaved-pixel format. The output buffer is therefore three times + * as wide as the input buffer. + * A starting row offset is provided only for the input buffer. The caller + * can easily adjust the passed output_buf value to accommodate any row + * offset required on that side. + */ + +METHODDEF(void) +ycc_rgb_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + register int * Crrtab = cconvert->Cr_r_tab; + register int * Cbbtab = cconvert->Cb_b_tab; + register INT32 * Crgtab = cconvert->Cr_g_tab; + register INT32 * Cbgtab = cconvert->Cb_g_tab; + SHIFT_TEMPS + + while (--num_rows >= 0) { + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + y = GETJSAMPLE(inptr0[col]); + cb = GETJSAMPLE(inptr1[col]); + cr = GETJSAMPLE(inptr2[col]); + /* Range-limiting is essential due to noise introduced by DCT losses. */ + outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; + outptr[RGB_GREEN] = range_limit[y + + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; + outptr += RGB_PIXELSIZE; + } + } +} + + +/**************** Cases other than YCbCr -> RGB **************/ + + +/* + * Color conversion for no colorspace change: just copy the data, + * converting from separate-planes to interleaved representation. + */ + +METHODDEF(void) +null_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION count; + register int num_components = cinfo->num_components; + JDIMENSION num_cols = cinfo->output_width; + int ci; + + while (--num_rows >= 0) { + for (ci = 0; ci < num_components; ci++) { + inptr = input_buf[ci][input_row]; + outptr = output_buf[0] + ci; + for (count = num_cols; count > 0; count--) { + *outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */ + outptr += num_components; + } + } + input_row++; + output_buf++; + } +} + + +/* + * Color conversion for grayscale: just copy the data. + * This also works for YCbCr -> grayscale conversion, in which + * we just copy the Y (luminance) component and ignore chrominance. + */ + +METHODDEF(void) +grayscale_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, + num_rows, cinfo->output_width); +} + + +/* + * Convert grayscale to RGB: just duplicate the graylevel three times. + * This is provided to support applications that don't want to cope + * with grayscale as a separate case. + */ + +METHODDEF(void) +gray_rgb_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + register JSAMPROW inptr, outptr; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + + while (--num_rows >= 0) { + inptr = input_buf[0][input_row++]; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + /* We can dispense with GETJSAMPLE() here */ + outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; + outptr += RGB_PIXELSIZE; + } + } +} + + +/* + * Adobe-style YCCK->CMYK conversion. + * We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same + * conversion as above, while passing K (black) unchanged. + * We assume build_ycc_rgb_table has been called. + */ + +METHODDEF(void) +ycck_cmyk_convert (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; + register int y, cb, cr; + register JSAMPROW outptr; + register JSAMPROW inptr0, inptr1, inptr2, inptr3; + register JDIMENSION col; + JDIMENSION num_cols = cinfo->output_width; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + register int * Crrtab = cconvert->Cr_r_tab; + register int * Cbbtab = cconvert->Cb_b_tab; + register INT32 * Crgtab = cconvert->Cr_g_tab; + register INT32 * Cbgtab = cconvert->Cb_g_tab; + SHIFT_TEMPS + + while (--num_rows >= 0) { + inptr0 = input_buf[0][input_row]; + inptr1 = input_buf[1][input_row]; + inptr2 = input_buf[2][input_row]; + inptr3 = input_buf[3][input_row]; + input_row++; + outptr = *output_buf++; + for (col = 0; col < num_cols; col++) { + y = GETJSAMPLE(inptr0[col]); + cb = GETJSAMPLE(inptr1[col]); + cr = GETJSAMPLE(inptr2[col]); + /* Range-limiting is essential due to noise introduced by DCT losses. */ + outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */ + outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */ + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS)))]; + outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */ + /* K passes through unchanged */ + outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */ + outptr += 4; + } + } +} + + +/* + * Empty method for start_pass. + */ + +METHODDEF(void) +start_pass_dcolor (j_decompress_ptr cinfo) +{ + /* no work needed */ +} + + +/* + * Module initialization routine for output colorspace conversion. + */ + +GLOBAL(void) +jinit_color_deconverter (j_decompress_ptr cinfo) +{ + my_cconvert_ptr cconvert; + int ci; + + cconvert = (my_cconvert_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_color_deconverter)); + cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert; + cconvert->pub.start_pass = start_pass_dcolor; + + /* Make sure num_components agrees with jpeg_color_space */ + switch (cinfo->jpeg_color_space) { + case JCS_GRAYSCALE: + if (cinfo->num_components != 1) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + break; + + case JCS_RGB: + case JCS_YCbCr: + if (cinfo->num_components != 3) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + break; + + case JCS_CMYK: + case JCS_YCCK: + if (cinfo->num_components != 4) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + break; + + default: /* JCS_UNKNOWN can be anything */ + if (cinfo->num_components < 1) + ERREXIT(cinfo, JERR_BAD_J_COLORSPACE); + break; + } + + /* Set out_color_components and conversion method based on requested space. + * Also clear the component_needed flags for any unused components, + * so that earlier pipeline stages can avoid useless computation. + */ + + switch (cinfo->out_color_space) { + case JCS_GRAYSCALE: + cinfo->out_color_components = 1; + if (cinfo->jpeg_color_space == JCS_GRAYSCALE || + cinfo->jpeg_color_space == JCS_YCbCr) { + cconvert->pub.color_convert = grayscale_convert; + /* For color->grayscale conversion, only the Y (0) component is needed */ + for (ci = 1; ci < cinfo->num_components; ci++) + cinfo->comp_info[ci].component_needed = FALSE; + } else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + case JCS_RGB: + cinfo->out_color_components = RGB_PIXELSIZE; + if (cinfo->jpeg_color_space == JCS_YCbCr) { + cconvert->pub.color_convert = ycc_rgb_convert; + build_ycc_rgb_table(cinfo); + } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { + cconvert->pub.color_convert = gray_rgb_convert; + } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { + cconvert->pub.color_convert = null_convert; + } else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + case JCS_CMYK: + cinfo->out_color_components = 4; + if (cinfo->jpeg_color_space == JCS_YCCK) { + cconvert->pub.color_convert = ycck_cmyk_convert; + build_ycc_rgb_table(cinfo); + } else if (cinfo->jpeg_color_space == JCS_CMYK) { + cconvert->pub.color_convert = null_convert; + } else + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + + default: + /* Permit null conversion to same output space */ + if (cinfo->out_color_space == cinfo->jpeg_color_space) { + cinfo->out_color_components = cinfo->num_components; + cconvert->pub.color_convert = null_convert; + } else /* unsupported non-null conversion */ + ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); + break; + } + + if (cinfo->quantize_colors) + cinfo->output_components = 1; /* single colormapped output component */ + else + cinfo->output_components = cinfo->out_color_components; +} diff --git a/src/SFML/Graphics/libjpeg/jdct.h b/src/SFML/Graphics/libjpeg/jdct.h new file mode 100644 index 00000000..b664cab0 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdct.h @@ -0,0 +1,176 @@ +/* + * jdct.h + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This include file contains common declarations for the forward and + * inverse DCT modules. These declarations are private to the DCT managers + * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms. + * The individual DCT algorithms are kept in separate files to ease + * machine-dependent tuning (e.g., assembly coding). + */ + + +/* + * A forward DCT routine is given a pointer to a work area of type DCTELEM[]; + * the DCT is to be performed in-place in that buffer. Type DCTELEM is int + * for 8-bit samples, INT32 for 12-bit samples. (NOTE: Floating-point DCT + * implementations use an array of type FAST_FLOAT, instead.) + * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). + * The DCT outputs are returned scaled up by a factor of 8; they therefore + * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This + * convention improves accuracy in integer implementations and saves some + * work in floating-point ones. + * Quantization of the output coefficients is done by jcdctmgr.c. + */ + +#if BITS_IN_JSAMPLE == 8 +typedef int DCTELEM; /* 16 or 32 bits is fine */ +#else +typedef INT32 DCTELEM; /* must have 32 bits */ +#endif + +typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); +typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data)); + + +/* + * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer + * to an output sample array. The routine must dequantize the input data as + * well as perform the IDCT; for dequantization, it uses the multiplier table + * pointed to by compptr->dct_table. The output data is to be placed into the + * sample array starting at a specified column. (Any row offset needed will + * be applied to the array pointer before it is passed to the IDCT code.) + * Note that the number of samples emitted by the IDCT routine is + * DCT_scaled_size * DCT_scaled_size. + */ + +/* typedef inverse_DCT_method_ptr is declared in jpegint.h */ + +/* + * Each IDCT routine has its own ideas about the best dct_table element type. + */ + +typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ +#if BITS_IN_JSAMPLE == 8 +typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ +#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ +#else +typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ +#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ +#endif +typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ + + +/* + * Each IDCT routine is responsible for range-limiting its results and + * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could + * be quite far out of range if the input data is corrupt, so a bulletproof + * range-limiting step is required. We use a mask-and-table-lookup method + * to do the combined operations quickly. See the comments with + * prepare_range_limit_table (in jdmaster.c) for more info. + */ + +#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE) + +#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ + + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_fdct_islow jFDislow +#define jpeg_fdct_ifast jFDifast +#define jpeg_fdct_float jFDfloat +#define jpeg_idct_islow jRDislow +#define jpeg_idct_ifast jRDifast +#define jpeg_idct_float jRDfloat +#define jpeg_idct_4x4 jRD4x4 +#define jpeg_idct_2x2 jRD2x2 +#define jpeg_idct_1x1 jRD1x1 +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + +/* Extern declarations for the forward and inverse DCT routines. */ + +EXTERN(void) jpeg_fdct_islow JPP((DCTELEM * data)); +EXTERN(void) jpeg_fdct_ifast JPP((DCTELEM * data)); +EXTERN(void) jpeg_fdct_float JPP((FAST_FLOAT * data)); + +EXTERN(void) jpeg_idct_islow + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jpeg_idct_ifast + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jpeg_idct_float + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jpeg_idct_4x4 + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jpeg_idct_2x2 + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); +EXTERN(void) jpeg_idct_1x1 + JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); + + +/* + * Macros for handling fixed-point arithmetic; these are used by many + * but not all of the DCT/IDCT modules. + * + * All values are expected to be of type INT32. + * Fractional constants are scaled left by CONST_BITS bits. + * CONST_BITS is defined within each module using these macros, + * and may differ from one module to the next. + */ + +#define ONE ((INT32) 1) +#define CONST_SCALE (ONE << CONST_BITS) + +/* Convert a positive real constant to an integer scaled by CONST_SCALE. + * Caution: some C compilers fail to reduce "FIX(constant)" at compile time, + * thus causing a lot of useless floating-point operations at run time. + */ + +#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) + +/* Descale and correctly round an INT32 value that's scaled by N bits. + * We assume RIGHT_SHIFT rounds towards minus infinity, so adding + * the fudge factor is correct for either sign of X. + */ + +#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) + +/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. + * This macro is used only when the two inputs will actually be no more than + * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a + * full 32x32 multiply. This provides a useful speedup on many machines. + * Unfortunately there is no way to specify a 16x16->32 multiply portably + * in C, but some C compilers will do the right thing if you provide the + * correct combination of casts. + */ + +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) +#endif +#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ +#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const))) +#endif + +#ifndef MULTIPLY16C16 /* default definition */ +#define MULTIPLY16C16(var,const) ((var) * (const)) +#endif + +/* Same except both inputs are variables. */ + +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2))) +#endif + +#ifndef MULTIPLY16V16 /* default definition */ +#define MULTIPLY16V16(var1,var2) ((var1) * (var2)) +#endif diff --git a/src/SFML/Graphics/libjpeg/jddctmgr.c b/src/SFML/Graphics/libjpeg/jddctmgr.c new file mode 100644 index 00000000..0e44eb14 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jddctmgr.c @@ -0,0 +1,269 @@ +/* + * jddctmgr.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the inverse-DCT management logic. + * This code selects a particular IDCT implementation to be used, + * and it performs related housekeeping chores. No code in this file + * is executed per IDCT step, only during output pass setup. + * + * Note that the IDCT routines are responsible for performing coefficient + * dequantization as well as the IDCT proper. This module sets up the + * dequantization multiplier table needed by the IDCT routine. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + + +/* + * The decompressor input side (jdinput.c) saves away the appropriate + * quantization table for each component at the start of the first scan + * involving that component. (This is necessary in order to correctly + * decode files that reuse Q-table slots.) + * When we are ready to make an output pass, the saved Q-table is converted + * to a multiplier table that will actually be used by the IDCT routine. + * The multiplier table contents are IDCT-method-dependent. To support + * application changes in IDCT method between scans, we can remake the + * multiplier tables if necessary. + * In buffered-image mode, the first output pass may occur before any data + * has been seen for some components, and thus before their Q-tables have + * been saved away. To handle this case, multiplier tables are preset + * to zeroes; the result of the IDCT will be a neutral gray level. + */ + + +/* Private subobject for this module */ + +typedef struct { + struct jpeg_inverse_dct pub; /* public fields */ + + /* This array contains the IDCT method code that each multiplier table + * is currently set up for, or -1 if it's not yet set up. + * The actual multiplier tables are pointed to by dct_table in the + * per-component comp_info structures. + */ + int cur_method[MAX_COMPONENTS]; +} my_idct_controller; + +typedef my_idct_controller * my_idct_ptr; + + +/* Allocated multiplier tables: big enough for any supported variant */ + +typedef union { + ISLOW_MULT_TYPE islow_array[DCTSIZE2]; +#ifdef DCT_IFAST_SUPPORTED + IFAST_MULT_TYPE ifast_array[DCTSIZE2]; +#endif +#ifdef DCT_FLOAT_SUPPORTED + FLOAT_MULT_TYPE float_array[DCTSIZE2]; +#endif +} multiplier_table; + + +/* The current scaled-IDCT routines require ISLOW-style multiplier tables, + * so be sure to compile that code if either ISLOW or SCALING is requested. + */ +#ifdef DCT_ISLOW_SUPPORTED +#define PROVIDE_ISLOW_TABLES +#else +#ifdef IDCT_SCALING_SUPPORTED +#define PROVIDE_ISLOW_TABLES +#endif +#endif + + +/* + * Prepare for an output pass. + * Here we select the proper IDCT routine for each component and build + * a matching multiplier table. + */ + +METHODDEF(void) +start_pass (j_decompress_ptr cinfo) +{ + my_idct_ptr idct = (my_idct_ptr) cinfo->idct; + int ci, i; + jpeg_component_info *compptr; + int method = 0; + inverse_DCT_method_ptr method_ptr = NULL; + JQUANT_TBL * qtbl; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Select the proper IDCT routine for this component's scaling */ + switch (compptr->DCT_scaled_size) { +#ifdef IDCT_SCALING_SUPPORTED + case 1: + method_ptr = jpeg_idct_1x1; + method = JDCT_ISLOW; /* jidctred uses islow-style table */ + break; + case 2: + method_ptr = jpeg_idct_2x2; + method = JDCT_ISLOW; /* jidctred uses islow-style table */ + break; + case 4: + method_ptr = jpeg_idct_4x4; + method = JDCT_ISLOW; /* jidctred uses islow-style table */ + break; +#endif + case DCTSIZE: + switch (cinfo->dct_method) { +#ifdef DCT_ISLOW_SUPPORTED + case JDCT_ISLOW: + method_ptr = jpeg_idct_islow; + method = JDCT_ISLOW; + break; +#endif +#ifdef DCT_IFAST_SUPPORTED + case JDCT_IFAST: + method_ptr = jpeg_idct_ifast; + method = JDCT_IFAST; + break; +#endif +#ifdef DCT_FLOAT_SUPPORTED + case JDCT_FLOAT: + method_ptr = jpeg_idct_float; + method = JDCT_FLOAT; + break; +#endif + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; + } + break; + default: + ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size); + break; + } + idct->pub.inverse_DCT[ci] = method_ptr; + /* Create multiplier table from quant table. + * However, we can skip this if the component is uninteresting + * or if we already built the table. Also, if no quant table + * has yet been saved for the component, we leave the + * multiplier table all-zero; we'll be reading zeroes from the + * coefficient controller's buffer anyway. + */ + if (! compptr->component_needed || idct->cur_method[ci] == method) + continue; + qtbl = compptr->quant_table; + if (qtbl == NULL) /* happens if no data yet for component */ + continue; + idct->cur_method[ci] = method; + switch (method) { +#ifdef PROVIDE_ISLOW_TABLES + case JDCT_ISLOW: + { + /* For LL&M IDCT method, multipliers are equal to raw quantization + * coefficients, but are stored as ints to ensure access efficiency. + */ + ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table; + for (i = 0; i < DCTSIZE2; i++) { + ismtbl[i] = (ISLOW_MULT_TYPE) qtbl->quantval[i]; + } + } + break; +#endif +#ifdef DCT_IFAST_SUPPORTED + case JDCT_IFAST: + { + /* For AA&N IDCT method, multipliers are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + * For integer operation, the multiplier table is to be scaled by + * IFAST_SCALE_BITS. + */ + IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; +#define CONST_BITS 14 + static const INT16 aanscales[DCTSIZE2] = { + /* precomputed values scaled up by 14 bits */ + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, + 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906, + 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315, + 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, + 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552, + 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446, + 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 + }; + SHIFT_TEMPS + + for (i = 0; i < DCTSIZE2; i++) { + ifmtbl[i] = (IFAST_MULT_TYPE) + DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], + (INT32) aanscales[i]), + CONST_BITS-IFAST_SCALE_BITS); + } + } + break; +#endif +#ifdef DCT_FLOAT_SUPPORTED + case JDCT_FLOAT: + { + /* For float AA&N IDCT method, multipliers are equal to quantization + * coefficients scaled by scalefactor[row]*scalefactor[col], where + * scalefactor[0] = 1 + * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7 + */ + FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table; + int row, col; + static const double aanscalefactor[DCTSIZE] = { + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + }; + + i = 0; + for (row = 0; row < DCTSIZE; row++) { + for (col = 0; col < DCTSIZE; col++) { + fmtbl[i] = (FLOAT_MULT_TYPE) + ((double) qtbl->quantval[i] * + aanscalefactor[row] * aanscalefactor[col]); + i++; + } + } + } + break; +#endif + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; + } + } +} + + +/* + * Initialize IDCT manager. + */ + +GLOBAL(void) +jinit_inverse_dct (j_decompress_ptr cinfo) +{ + my_idct_ptr idct; + int ci; + jpeg_component_info *compptr; + + idct = (my_idct_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_idct_controller)); + cinfo->idct = (struct jpeg_inverse_dct *) idct; + idct->pub.start_pass = start_pass; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Allocate and pre-zero a multiplier table for each component */ + compptr->dct_table = + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(multiplier_table)); + MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); + /* Mark multiplier table not yet set up for any method */ + idct->cur_method[ci] = -1; + } +} diff --git a/src/SFML/Graphics/libjpeg/jdhuff.c b/src/SFML/Graphics/libjpeg/jdhuff.c new file mode 100644 index 00000000..b2ad66d4 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdhuff.c @@ -0,0 +1,651 @@ +/* + * jdhuff.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains Huffman entropy decoding routines. + * + * Much of the complexity here has to do with supporting input suspension. + * If the data source module demands suspension, we want to be able to back + * up to the start of the current MCU. To do this, we copy state variables + * into local working storage, and update them back to the permanent + * storage only upon successful completion of an MCU. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdhuff.h" /* Declarations shared with jdphuff.c */ + + +/* + * Expanded entropy decoder object for Huffman decoding. + * + * The savable_state subrecord contains fields that change within an MCU, + * but must not be updated permanently until we complete the MCU. + */ + +typedef struct { + int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ +} savable_state; + +/* This macro is to work around compilers with missing or broken + * structure assignment. You'll need to fix this code if you have + * such a compiler and you change MAX_COMPS_IN_SCAN. + */ + +#ifndef NO_STRUCT_ASSIGN +#define ASSIGN_STATE(dest,src) ((dest) = (src)) +#else +#if MAX_COMPS_IN_SCAN == 4 +#define ASSIGN_STATE(dest,src) \ + ((dest).last_dc_val[0] = (src).last_dc_val[0], \ + (dest).last_dc_val[1] = (src).last_dc_val[1], \ + (dest).last_dc_val[2] = (src).last_dc_val[2], \ + (dest).last_dc_val[3] = (src).last_dc_val[3]) +#endif +#endif + + +typedef struct { + struct jpeg_entropy_decoder pub; /* public fields */ + + /* These fields are loaded into local variables at start of each MCU. + * In case of suspension, we exit WITHOUT updating them. + */ + bitread_perm_state bitstate; /* Bit buffer at start of MCU */ + savable_state saved; /* Other state at start of MCU */ + + /* These fields are NOT loaded into local working state. */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + + /* Pointers to derived tables (these workspaces have image lifespan) */ + d_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]; + d_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]; + + /* Precalculated info set up by start_pass for use in decode_mcu: */ + + /* Pointers to derived tables to be used for each block within an MCU */ + d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU]; + d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU]; + /* Whether we care about the DC and AC coefficient values for each block */ + boolean dc_needed[D_MAX_BLOCKS_IN_MCU]; + boolean ac_needed[D_MAX_BLOCKS_IN_MCU]; +} huff_entropy_decoder; + +typedef huff_entropy_decoder * huff_entropy_ptr; + + +/* + * Initialize for a Huffman-compressed scan. + */ + +METHODDEF(void) +start_pass_huff_decoder (j_decompress_ptr cinfo) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + int ci, blkn, dctbl, actbl; + jpeg_component_info * compptr; + + /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG. + * This ought to be an error condition, but we make it a warning because + * there are some baseline files out there with all zeroes in these bytes. + */ + if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 || + cinfo->Ah != 0 || cinfo->Al != 0) + WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + dctbl = compptr->dc_tbl_no; + actbl = compptr->ac_tbl_no; + /* Compute derived values for Huffman tables */ + /* We may do this more than once for a table, but it's not expensive */ + jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, + & entropy->dc_derived_tbls[dctbl]); + jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, + & entropy->ac_derived_tbls[actbl]); + /* Initialize DC predictions to 0 */ + entropy->saved.last_dc_val[ci] = 0; + } + + /* Precalculate decoding info for each block in an MCU of this scan */ + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + /* Precalculate which table to use for each block */ + entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no]; + entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no]; + /* Decide whether we really care about the coefficient values */ + if (compptr->component_needed) { + entropy->dc_needed[blkn] = TRUE; + /* we don't need the ACs if producing a 1/8th-size image */ + entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1); + } else { + entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE; + } + } + + /* Initialize bitread state variables */ + entropy->bitstate.bits_left = 0; + entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ + entropy->pub.insufficient_data = FALSE; + + /* Initialize restart counter */ + entropy->restarts_to_go = cinfo->restart_interval; +} + + +/* + * Compute the derived values for a Huffman table. + * This routine also performs some validation checks on the table. + * + * Note this is also used by jdphuff.c. + */ + +GLOBAL(void) +jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, + d_derived_tbl ** pdtbl) +{ + JHUFF_TBL *htbl; + d_derived_tbl *dtbl; + int p, i, l, si, numsymbols; + int lookbits, ctr; + char huffsize[257]; + unsigned int huffcode[257]; + unsigned int code; + + /* Note that huffsize[] and huffcode[] are filled in code-length order, + * paralleling the order of the symbols themselves in htbl->huffval[]. + */ + + /* Find the input Huffman table */ + if (tblno < 0 || tblno >= NUM_HUFF_TBLS) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); + htbl = + isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno]; + if (htbl == NULL) + ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno); + + /* Allocate a workspace if we haven't already done so. */ + if (*pdtbl == NULL) + *pdtbl = (d_derived_tbl *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(d_derived_tbl)); + dtbl = *pdtbl; + dtbl->pub = htbl; /* fill in back link */ + + /* Figure C.1: make table of Huffman code length for each symbol */ + + p = 0; + for (l = 1; l <= 16; l++) { + i = (int) htbl->bits[l]; + if (i < 0 || p + i > 256) /* protect against table overrun */ + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + while (i--) + huffsize[p++] = (char) l; + } + huffsize[p] = 0; + numsymbols = p; + + /* Figure C.2: generate the codes themselves */ + /* We also validate that the counts represent a legal Huffman code tree. */ + + code = 0; + si = huffsize[0]; + p = 0; + while (huffsize[p]) { + while (((int) huffsize[p]) == si) { + huffcode[p++] = code; + code++; + } + /* code is now 1 more than the last code used for codelength si; but + * it must still fit in si bits, since no code is allowed to be all ones. + */ + if (((INT32) code) >= (((INT32) 1) << si)) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + code <<= 1; + si++; + } + + /* Figure F.15: generate decoding tables for bit-sequential decoding */ + + p = 0; + for (l = 1; l <= 16; l++) { + if (htbl->bits[l]) { + /* valoffset[l] = huffval[] index of 1st symbol of code length l, + * minus the minimum code of length l + */ + dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p]; + p += htbl->bits[l]; + dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ + } else { + dtbl->maxcode[l] = -1; /* -1 if no codes of this length */ + } + } + dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */ + + /* Compute lookahead tables to speed up decoding. + * First we set all the table entries to 0, indicating "too long"; + * then we iterate through the Huffman codes that are short enough and + * fill in all the entries that correspond to bit sequences starting + * with that code. + */ + + MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits)); + + p = 0; + for (l = 1; l <= HUFF_LOOKAHEAD; l++) { + for (i = 1; i <= (int) htbl->bits[l]; i++, p++) { + /* l = current code's length, p = its index in huffcode[] & huffval[]. */ + /* Generate left-justified code followed by all possible bit sequences */ + lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l); + for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) { + dtbl->look_nbits[lookbits] = l; + dtbl->look_sym[lookbits] = htbl->huffval[p]; + lookbits++; + } + } + } + + /* Validate symbols as being reasonable. + * For AC tables, we make no check, but accept all byte values 0..255. + * For DC tables, we require the symbols to be in range 0..15. + * (Tighter bounds could be applied depending on the data depth and mode, + * but this is sufficient to ensure safe decoding.) + */ + if (isDC) { + for (i = 0; i < numsymbols; i++) { + int sym = htbl->huffval[i]; + if (sym < 0 || sym > 15) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + } + } +} + + +/* + * Out-of-line code for bit fetching (shared with jdphuff.c). + * See jdhuff.h for info about usage. + * Note: current values of get_buffer and bits_left are passed as parameters, + * but are returned in the corresponding fields of the state struct. + * + * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width + * of get_buffer to be used. (On machines with wider words, an even larger + * buffer could be used.) However, on some machines 32-bit shifts are + * quite slow and take time proportional to the number of places shifted. + * (This is true with most PC compilers, for instance.) In this case it may + * be a win to set MIN_GET_BITS to the minimum value of 15. This reduces the + * average shift distance at the cost of more calls to jpeg_fill_bit_buffer. + */ + +#ifdef SLOW_SHIFT_32 +#define MIN_GET_BITS 15 /* minimum allowable value */ +#else +#define MIN_GET_BITS (BIT_BUF_SIZE-7) +#endif + + +GLOBAL(boolean) +jpeg_fill_bit_buffer (bitread_working_state * state, + register bit_buf_type get_buffer, register int bits_left, + int nbits) +/* Load up the bit buffer to a depth of at least nbits */ +{ + /* Copy heavily used state fields into locals (hopefully registers) */ + register const JOCTET * next_input_byte = state->next_input_byte; + register size_t bytes_in_buffer = state->bytes_in_buffer; + j_decompress_ptr cinfo = state->cinfo; + + /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */ + /* (It is assumed that no request will be for more than that many bits.) */ + /* We fail to do so only if we hit a marker or are forced to suspend. */ + + if (cinfo->unread_marker == 0) { /* cannot advance past a marker */ + while (bits_left < MIN_GET_BITS) { + register int c; + + /* Attempt to read a byte */ + if (bytes_in_buffer == 0) { + if (! (*cinfo->src->fill_input_buffer) (cinfo)) + return FALSE; + next_input_byte = cinfo->src->next_input_byte; + bytes_in_buffer = cinfo->src->bytes_in_buffer; + } + bytes_in_buffer--; + c = GETJOCTET(*next_input_byte++); + + /* If it's 0xFF, check and discard stuffed zero byte */ + if (c == 0xFF) { + /* Loop here to discard any padding FF's on terminating marker, + * so that we can save a valid unread_marker value. NOTE: we will + * accept multiple FF's followed by a 0 as meaning a single FF data + * byte. This data pattern is not valid according to the standard. + */ + do { + if (bytes_in_buffer == 0) { + if (! (*cinfo->src->fill_input_buffer) (cinfo)) + return FALSE; + next_input_byte = cinfo->src->next_input_byte; + bytes_in_buffer = cinfo->src->bytes_in_buffer; + } + bytes_in_buffer--; + c = GETJOCTET(*next_input_byte++); + } while (c == 0xFF); + + if (c == 0) { + /* Found FF/00, which represents an FF data byte */ + c = 0xFF; + } else { + /* Oops, it's actually a marker indicating end of compressed data. + * Save the marker code for later use. + * Fine point: it might appear that we should save the marker into + * bitread working state, not straight into permanent state. But + * once we have hit a marker, we cannot need to suspend within the + * current MCU, because we will read no more bytes from the data + * source. So it is OK to update permanent state right away. + */ + cinfo->unread_marker = c; + /* See if we need to insert some fake zero bits. */ + goto no_more_bytes; + } + } + + /* OK, load c into get_buffer */ + get_buffer = (get_buffer << 8) | c; + bits_left += 8; + } /* end while */ + } else { + no_more_bytes: + /* We get here if we've read the marker that terminates the compressed + * data segment. There should be enough bits in the buffer register + * to satisfy the request; if so, no problem. + */ + if (nbits > bits_left) { + /* Uh-oh. Report corrupted data to user and stuff zeroes into + * the data stream, so that we can produce some kind of image. + * We use a nonvolatile flag to ensure that only one warning message + * appears per data segment. + */ + if (! cinfo->entropy->insufficient_data) { + WARNMS(cinfo, JWRN_HIT_MARKER); + cinfo->entropy->insufficient_data = TRUE; + } + /* Fill the buffer with zero bits */ + get_buffer <<= MIN_GET_BITS - bits_left; + bits_left = MIN_GET_BITS; + } + } + + /* Unload the local registers */ + state->next_input_byte = next_input_byte; + state->bytes_in_buffer = bytes_in_buffer; + state->get_buffer = get_buffer; + state->bits_left = bits_left; + + return TRUE; +} + + +/* + * Out-of-line code for Huffman code decoding. + * See jdhuff.h for info about usage. + */ + +GLOBAL(int) +jpeg_huff_decode (bitread_working_state * state, + register bit_buf_type get_buffer, register int bits_left, + d_derived_tbl * htbl, int min_bits) +{ + register int l = min_bits; + register INT32 code; + + /* HUFF_DECODE has determined that the code is at least min_bits */ + /* bits long, so fetch that many bits in one swoop. */ + + CHECK_BIT_BUFFER(*state, l, return -1); + code = GET_BITS(l); + + /* Collect the rest of the Huffman code one bit at a time. */ + /* This is per Figure F.16 in the JPEG spec. */ + + while (code > htbl->maxcode[l]) { + code <<= 1; + CHECK_BIT_BUFFER(*state, 1, return -1); + code |= GET_BITS(1); + l++; + } + + /* Unload the local registers */ + state->get_buffer = get_buffer; + state->bits_left = bits_left; + + /* With garbage input we may reach the sentinel value l = 17. */ + + if (l > 16) { + WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE); + return 0; /* fake a zero as the safest result */ + } + + return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ]; +} + + +/* + * Figure F.12: extend sign bit. + * On some machines, a shift and add will be faster than a table lookup. + */ + +#ifdef AVOID_TABLES + +#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) + +#else + +#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) + +static const int extend_test[16] = /* entry n is 2**(n-1) */ + { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, + 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; + +static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ + { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, + ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, + ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, + ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; + +#endif /* AVOID_TABLES */ + + +/* + * Check for a restart marker & resynchronize decoder. + * Returns FALSE if must suspend. + */ + +LOCAL(boolean) +process_restart (j_decompress_ptr cinfo) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + int ci; + + /* Throw away any unused bits remaining in bit buffer; */ + /* include any full bytes in next_marker's count of discarded bytes */ + cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; + entropy->bitstate.bits_left = 0; + + /* Advance past the RSTn marker */ + if (! (*cinfo->marker->read_restart_marker) (cinfo)) + return FALSE; + + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) + entropy->saved.last_dc_val[ci] = 0; + + /* Reset restart counter */ + entropy->restarts_to_go = cinfo->restart_interval; + + /* Reset out-of-data flag, unless read_restart_marker left us smack up + * against a marker. In that case we will end up treating the next data + * segment as empty, and we can avoid producing bogus output pixels by + * leaving the flag set. + */ + if (cinfo->unread_marker == 0) + entropy->pub.insufficient_data = FALSE; + + return TRUE; +} + + +/* + * Decode and return one MCU's worth of Huffman-compressed coefficients. + * The coefficients are reordered from zigzag order into natural array order, + * but are not dequantized. + * + * The i'th block of the MCU is stored into the block pointed to by + * MCU_data[i]. WE ASSUME THIS AREA HAS BEEN ZEROED BY THE CALLER. + * (Wholesale zeroing is usually a little faster than retail...) + * + * Returns FALSE if data source requested suspension. In that case no + * changes have been made to permanent state. (Exception: some output + * coefficients may already have been assigned. This is harmless for + * this module, since we'll just re-assign them on the next call.) + */ + +METHODDEF(boolean) +decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + int blkn; + BITREAD_STATE_VARS; + savable_state state; + + /* Process restart marker if needed; may have to suspend */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) + if (! process_restart(cinfo)) + return FALSE; + } + + /* If we've run out of data, just leave the MCU set to zeroes. + * This way, we return uniform gray for the remainder of the segment. + */ + if (! entropy->pub.insufficient_data) { + + /* Load up working state */ + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(state, entropy->saved); + + /* Outer loop handles each block in the MCU */ + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + JBLOCKROW block = MCU_data[blkn]; + d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn]; + d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn]; + register int s, k, r; + + /* Decode a single block's worth of coefficients */ + + /* Section F.2.2.1: decode the DC coefficient difference */ + HUFF_DECODE(s, br_state, dctbl, return FALSE, label1); + if (s) { + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + } + + if (entropy->dc_needed[blkn]) { + /* Convert DC difference to actual value, update last_dc_val */ + int ci = cinfo->MCU_membership[blkn]; + s += state.last_dc_val[ci]; + state.last_dc_val[ci] = s; + /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ + (*block)[0] = (JCOEF) s; + } + + if (entropy->ac_needed[blkn]) { + + /* Section F.2.2.2: decode the AC coefficients */ + /* Since zeroes are skipped, output area must be cleared beforehand */ + for (k = 1; k < DCTSIZE2; k++) { + HUFF_DECODE(s, br_state, actbl, return FALSE, label2); + + r = s >> 4; + s &= 15; + + if (s) { + k += r; + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + /* Output coefficient in natural (dezigzagged) order. + * Note: the extra entries in jpeg_natural_order[] will save us + * if k >= DCTSIZE2, which could happen if the data is corrupted. + */ + (*block)[jpeg_natural_order[k]] = (JCOEF) s; + } else { + if (r != 15) + break; + k += 15; + } + } + + } else { + + /* Section F.2.2.2: decode the AC coefficients */ + /* In this path we just discard the values */ + for (k = 1; k < DCTSIZE2; k++) { + HUFF_DECODE(s, br_state, actbl, return FALSE, label3); + + r = s >> 4; + s &= 15; + + if (s) { + k += r; + CHECK_BIT_BUFFER(br_state, s, return FALSE); + DROP_BITS(s); + } else { + if (r != 15) + break; + k += 15; + } + } + + } + } + + /* Completed MCU, so update state */ + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(entropy->saved, state); + } + + /* Account for restart interval (no-op if not using restarts) */ + entropy->restarts_to_go--; + + return TRUE; +} + + +/* + * Module initialization routine for Huffman entropy decoding. + */ + +GLOBAL(void) +jinit_huff_decoder (j_decompress_ptr cinfo) +{ + huff_entropy_ptr entropy; + int i; + + entropy = (huff_entropy_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(huff_entropy_decoder)); + cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; + entropy->pub.start_pass = start_pass_huff_decoder; + entropy->pub.decode_mcu = decode_mcu; + + /* Mark tables unallocated */ + for (i = 0; i < NUM_HUFF_TBLS; i++) { + entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; + } +} diff --git a/src/SFML/Graphics/libjpeg/jdhuff.h b/src/SFML/Graphics/libjpeg/jdhuff.h new file mode 100644 index 00000000..12c07477 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdhuff.h @@ -0,0 +1,201 @@ +/* + * jdhuff.h + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains declarations for Huffman entropy decoding routines + * that are shared between the sequential decoder (jdhuff.c) and the + * progressive decoder (jdphuff.c). No other modules need to see these. + */ + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_make_d_derived_tbl jMkDDerived +#define jpeg_fill_bit_buffer jFilBitBuf +#define jpeg_huff_decode jHufDecode +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* Derived data constructed for each Huffman table */ + +#define HUFF_LOOKAHEAD 8 /* # of bits of lookahead */ + +typedef struct { + /* Basic tables: (element [0] of each array is unused) */ + INT32 maxcode[18]; /* largest code of length k (-1 if none) */ + /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ + INT32 valoffset[17]; /* huffval[] offset for codes of length k */ + /* valoffset[k] = huffval[] index of 1st symbol of code length k, less + * the smallest code of length k; so given a code of length k, the + * corresponding symbol is huffval[code + valoffset[k]] + */ + + /* Link to public Huffman table (needed only in jpeg_huff_decode) */ + JHUFF_TBL *pub; + + /* Lookahead tables: indexed by the next HUFF_LOOKAHEAD bits of + * the input data stream. If the next Huffman code is no more + * than HUFF_LOOKAHEAD bits long, we can obtain its length and + * the corresponding symbol directly from these tables. + */ + int look_nbits[1< 32 bits on your machine, and shifting/masking longs is + * reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE + * appropriately should be a win. Unfortunately we can't define the size + * with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) + * because not all machines measure sizeof in 8-bit bytes. + */ + +typedef struct { /* Bitreading state saved across MCUs */ + bit_buf_type get_buffer; /* current bit-extraction buffer */ + int bits_left; /* # of unused bits in it */ +} bitread_perm_state; + +typedef struct { /* Bitreading working state within an MCU */ + /* Current data source location */ + /* We need a copy, rather than munging the original, in case of suspension */ + const JOCTET * next_input_byte; /* => next byte to read from source */ + size_t bytes_in_buffer; /* # of bytes remaining in source buffer */ + /* Bit input buffer --- note these values are kept in register variables, + * not in this struct, inside the inner loops. + */ + bit_buf_type get_buffer; /* current bit-extraction buffer */ + int bits_left; /* # of unused bits in it */ + /* Pointer needed by jpeg_fill_bit_buffer. */ + j_decompress_ptr cinfo; /* back link to decompress master record */ +} bitread_working_state; + +/* Macros to declare and load/save bitread local variables. */ +#define BITREAD_STATE_VARS \ + register bit_buf_type get_buffer; \ + register int bits_left; \ + bitread_working_state br_state + +#define BITREAD_LOAD_STATE(cinfop,permstate) \ + br_state.cinfo = cinfop; \ + br_state.next_input_byte = cinfop->src->next_input_byte; \ + br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \ + get_buffer = permstate.get_buffer; \ + bits_left = permstate.bits_left; + +#define BITREAD_SAVE_STATE(cinfop,permstate) \ + cinfop->src->next_input_byte = br_state.next_input_byte; \ + cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \ + permstate.get_buffer = get_buffer; \ + permstate.bits_left = bits_left + +/* + * These macros provide the in-line portion of bit fetching. + * Use CHECK_BIT_BUFFER to ensure there are N bits in get_buffer + * before using GET_BITS, PEEK_BITS, or DROP_BITS. + * The variables get_buffer and bits_left are assumed to be locals, + * but the state struct might not be (jpeg_huff_decode needs this). + * CHECK_BIT_BUFFER(state,n,action); + * Ensure there are N bits in get_buffer; if suspend, take action. + * val = GET_BITS(n); + * Fetch next N bits. + * val = PEEK_BITS(n); + * Fetch next N bits without removing them from the buffer. + * DROP_BITS(n); + * Discard next N bits. + * The value N should be a simple variable, not an expression, because it + * is evaluated multiple times. + */ + +#define CHECK_BIT_BUFFER(state,nbits,action) \ + { if (bits_left < (nbits)) { \ + if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \ + { action; } \ + get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } + +#define GET_BITS(nbits) \ + (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1)) + +#define PEEK_BITS(nbits) \ + (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1)) + +#define DROP_BITS(nbits) \ + (bits_left -= (nbits)) + +/* Load up the bit buffer to a depth of at least nbits */ +EXTERN(boolean) jpeg_fill_bit_buffer + JPP((bitread_working_state * state, register bit_buf_type get_buffer, + register int bits_left, int nbits)); + + +/* + * Code for extracting next Huffman-coded symbol from input bit stream. + * Again, this is time-critical and we make the main paths be macros. + * + * We use a lookahead table to process codes of up to HUFF_LOOKAHEAD bits + * without looping. Usually, more than 95% of the Huffman codes will be 8 + * or fewer bits long. The few overlength codes are handled with a loop, + * which need not be inline code. + * + * Notes about the HUFF_DECODE macro: + * 1. Near the end of the data segment, we may fail to get enough bits + * for a lookahead. In that case, we do it the hard way. + * 2. If the lookahead table contains no entry, the next code must be + * more than HUFF_LOOKAHEAD bits long. + * 3. jpeg_huff_decode returns -1 if forced to suspend. + */ + +#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \ +{ register int nb, look; \ + if (bits_left < HUFF_LOOKAHEAD) { \ + if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \ + get_buffer = state.get_buffer; bits_left = state.bits_left; \ + if (bits_left < HUFF_LOOKAHEAD) { \ + nb = 1; goto slowlabel; \ + } \ + } \ + look = PEEK_BITS(HUFF_LOOKAHEAD); \ + if ((nb = htbl->look_nbits[look]) != 0) { \ + DROP_BITS(nb); \ + result = htbl->look_sym[look]; \ + } else { \ + nb = HUFF_LOOKAHEAD+1; \ +slowlabel: \ + if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ + { failaction; } \ + get_buffer = state.get_buffer; bits_left = state.bits_left; \ + } \ +} + +/* Out-of-line case for Huffman code fetching */ +EXTERN(int) jpeg_huff_decode + JPP((bitread_working_state * state, register bit_buf_type get_buffer, + register int bits_left, d_derived_tbl * htbl, int min_bits)); diff --git a/src/SFML/Graphics/libjpeg/jdinput.c b/src/SFML/Graphics/libjpeg/jdinput.c new file mode 100644 index 00000000..2d5c7470 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdinput.c @@ -0,0 +1,381 @@ +/* + * jdinput.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains input control logic for the JPEG decompressor. + * These routines are concerned with controlling the decompressor's input + * processing (marker reading and coefficient decoding). The actual input + * reading is done in jdmarker.c, jdhuff.c, and jdphuff.c. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Private state */ + +typedef struct { + struct jpeg_input_controller pub; /* public fields */ + + boolean inheaders; /* TRUE until first SOS is reached */ +} my_input_controller; + +typedef my_input_controller * my_inputctl_ptr; + + +/* Forward declarations */ +METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo)); + + +/* + * Routines to calculate various quantities related to the size of the image. + */ + +LOCAL(void) +initial_setup (j_decompress_ptr cinfo) +/* Called once, when first SOS marker is reached */ +{ + int ci; + jpeg_component_info *compptr; + + /* Make sure image isn't bigger than I can handle */ + if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION || + (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION) + ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION); + + /* For now, precision must match compiled-in value... */ + if (cinfo->data_precision != BITS_IN_JSAMPLE) + ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); + + /* Check that number of components won't exceed internal array sizes */ + if (cinfo->num_components > MAX_COMPONENTS) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components, + MAX_COMPONENTS); + + /* Compute maximum sampling factors; check factor validity */ + cinfo->max_h_samp_factor = 1; + cinfo->max_v_samp_factor = 1; + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || + compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) + ERREXIT(cinfo, JERR_BAD_SAMPLING); + cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, + compptr->h_samp_factor); + cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor, + compptr->v_samp_factor); + } + + /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE. + * In the full decompressor, this will be overridden by jdmaster.c; + * but in the transcoder, jdmaster.c is not used, so we must do it here. + */ + cinfo->min_DCT_scaled_size = DCTSIZE; + + /* Compute dimensions of components */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + compptr->DCT_scaled_size = DCTSIZE; + /* Size in DCT blocks */ + compptr->width_in_blocks = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + compptr->height_in_blocks = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, + (long) (cinfo->max_v_samp_factor * DCTSIZE)); + /* downsampled_width and downsampled_height will also be overridden by + * jdmaster.c if we are doing full decompression. The transcoder library + * doesn't use these values, but the calling application might. + */ + /* Size in samples */ + compptr->downsampled_width = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor, + (long) cinfo->max_h_samp_factor); + compptr->downsampled_height = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor, + (long) cinfo->max_v_samp_factor); + /* Mark component needed, until color conversion says otherwise */ + compptr->component_needed = TRUE; + /* Mark no quantization table yet saved for component */ + compptr->quant_table = NULL; + } + + /* Compute number of fully interleaved MCU rows. */ + cinfo->total_iMCU_rows = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, + (long) (cinfo->max_v_samp_factor*DCTSIZE)); + + /* Decide whether file contains multiple scans */ + if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode) + cinfo->inputctl->has_multiple_scans = TRUE; + else + cinfo->inputctl->has_multiple_scans = FALSE; +} + + +LOCAL(void) +per_scan_setup (j_decompress_ptr cinfo) +/* Do computations that are needed before processing a JPEG scan */ +/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */ +{ + int ci, mcublks, tmp; + jpeg_component_info *compptr; + + if (cinfo->comps_in_scan == 1) { + + /* Noninterleaved (single-component) scan */ + compptr = cinfo->cur_comp_info[0]; + + /* Overall image size in MCUs */ + cinfo->MCUs_per_row = compptr->width_in_blocks; + cinfo->MCU_rows_in_scan = compptr->height_in_blocks; + + /* For noninterleaved scan, always one block per MCU */ + compptr->MCU_width = 1; + compptr->MCU_height = 1; + compptr->MCU_blocks = 1; + compptr->MCU_sample_width = compptr->DCT_scaled_size; + compptr->last_col_width = 1; + /* For noninterleaved scans, it is convenient to define last_row_height + * as the number of block rows present in the last iMCU row. + */ + tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor); + if (tmp == 0) tmp = compptr->v_samp_factor; + compptr->last_row_height = tmp; + + /* Prepare array describing MCU composition */ + cinfo->blocks_in_MCU = 1; + cinfo->MCU_membership[0] = 0; + + } else { + + /* Interleaved (multi-component) scan */ + if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN) + ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan, + MAX_COMPS_IN_SCAN); + + /* Overall image size in MCUs */ + cinfo->MCUs_per_row = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width, + (long) (cinfo->max_h_samp_factor*DCTSIZE)); + cinfo->MCU_rows_in_scan = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, + (long) (cinfo->max_v_samp_factor*DCTSIZE)); + + cinfo->blocks_in_MCU = 0; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Sampling factors give # of blocks of component in each MCU */ + compptr->MCU_width = compptr->h_samp_factor; + compptr->MCU_height = compptr->v_samp_factor; + compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; + compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size; + /* Figure number of non-dummy blocks in last MCU column & row */ + tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); + if (tmp == 0) tmp = compptr->MCU_width; + compptr->last_col_width = tmp; + tmp = (int) (compptr->height_in_blocks % compptr->MCU_height); + if (tmp == 0) tmp = compptr->MCU_height; + compptr->last_row_height = tmp; + /* Prepare array describing MCU composition */ + mcublks = compptr->MCU_blocks; + if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU) + ERREXIT(cinfo, JERR_BAD_MCU_SIZE); + while (mcublks-- > 0) { + cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci; + } + } + + } +} + + +/* + * Save away a copy of the Q-table referenced by each component present + * in the current scan, unless already saved during a prior scan. + * + * In a multiple-scan JPEG file, the encoder could assign different components + * the same Q-table slot number, but change table definitions between scans + * so that each component uses a different Q-table. (The IJG encoder is not + * currently capable of doing this, but other encoders might.) Since we want + * to be able to dequantize all the components at the end of the file, this + * means that we have to save away the table actually used for each component. + * We do this by copying the table at the start of the first scan containing + * the component. + * The JPEG spec prohibits the encoder from changing the contents of a Q-table + * slot between scans of a component using that slot. If the encoder does so + * anyway, this decoder will simply use the Q-table values that were current + * at the start of the first scan for the component. + * + * The decompressor output side looks only at the saved quant tables, + * not at the current Q-table slots. + */ + +LOCAL(void) +latch_quant_tables (j_decompress_ptr cinfo) +{ + int ci, qtblno; + jpeg_component_info *compptr; + JQUANT_TBL * qtbl; + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* No work if we already saved Q-table for this component */ + if (compptr->quant_table != NULL) + continue; + /* Make sure specified quantization table is present */ + qtblno = compptr->quant_tbl_no; + if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS || + cinfo->quant_tbl_ptrs[qtblno] == NULL) + ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno); + /* OK, save away the quantization table */ + qtbl = (JQUANT_TBL *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(JQUANT_TBL)); + MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL)); + compptr->quant_table = qtbl; + } +} + + +/* + * Initialize the input modules to read a scan of compressed data. + * The first call to this is done by jdmaster.c after initializing + * the entire decompressor (during jpeg_start_decompress). + * Subsequent calls come from consume_markers, below. + */ + +METHODDEF(void) +start_input_pass (j_decompress_ptr cinfo) +{ + per_scan_setup(cinfo); + latch_quant_tables(cinfo); + (*cinfo->entropy->start_pass) (cinfo); + (*cinfo->coef->start_input_pass) (cinfo); + cinfo->inputctl->consume_input = cinfo->coef->consume_data; +} + + +/* + * Finish up after inputting a compressed-data scan. + * This is called by the coefficient controller after it's read all + * the expected data of the scan. + */ + +METHODDEF(void) +finish_input_pass (j_decompress_ptr cinfo) +{ + cinfo->inputctl->consume_input = consume_markers; +} + + +/* + * Read JPEG markers before, between, or after compressed-data scans. + * Change state as necessary when a new scan is reached. + * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. + * + * The consume_input method pointer points either here or to the + * coefficient controller's consume_data routine, depending on whether + * we are reading a compressed data segment or inter-segment markers. + */ + +METHODDEF(int) +consume_markers (j_decompress_ptr cinfo) +{ + my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; + int val; + + if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */ + return JPEG_REACHED_EOI; + + val = (*cinfo->marker->read_markers) (cinfo); + + switch (val) { + case JPEG_REACHED_SOS: /* Found SOS */ + if (inputctl->inheaders) { /* 1st SOS */ + initial_setup(cinfo); + inputctl->inheaders = FALSE; + /* Note: start_input_pass must be called by jdmaster.c + * before any more input can be consumed. jdapimin.c is + * responsible for enforcing this sequencing. + */ + } else { /* 2nd or later SOS marker */ + if (! inputctl->pub.has_multiple_scans) + ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ + start_input_pass(cinfo); + } + break; + case JPEG_REACHED_EOI: /* Found EOI */ + inputctl->pub.eoi_reached = TRUE; + if (inputctl->inheaders) { /* Tables-only datastream, apparently */ + if (cinfo->marker->saw_SOF) + ERREXIT(cinfo, JERR_SOF_NO_SOS); + } else { + /* Prevent infinite loop in coef ctlr's decompress_data routine + * if user set output_scan_number larger than number of scans. + */ + if (cinfo->output_scan_number > cinfo->input_scan_number) + cinfo->output_scan_number = cinfo->input_scan_number; + } + break; + case JPEG_SUSPENDED: + break; + } + + return val; +} + + +/* + * Reset state to begin a fresh datastream. + */ + +METHODDEF(void) +reset_input_controller (j_decompress_ptr cinfo) +{ + my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl; + + inputctl->pub.consume_input = consume_markers; + inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ + inputctl->pub.eoi_reached = FALSE; + inputctl->inheaders = TRUE; + /* Reset other modules */ + (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo); + (*cinfo->marker->reset_marker_reader) (cinfo); + /* Reset progression state -- would be cleaner if entropy decoder did this */ + cinfo->coef_bits = NULL; +} + + +/* + * Initialize the input controller module. + * This is called only once, when the decompression object is created. + */ + +GLOBAL(void) +jinit_input_controller (j_decompress_ptr cinfo) +{ + my_inputctl_ptr inputctl; + + /* Create subobject in permanent pool */ + inputctl = (my_inputctl_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + SIZEOF(my_input_controller)); + cinfo->inputctl = (struct jpeg_input_controller *) inputctl; + /* Initialize method pointers */ + inputctl->pub.consume_input = consume_markers; + inputctl->pub.reset_input_controller = reset_input_controller; + inputctl->pub.start_input_pass = start_input_pass; + inputctl->pub.finish_input_pass = finish_input_pass; + /* Initialize state: can't use reset_input_controller since we don't + * want to try to reset other modules yet. + */ + inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */ + inputctl->pub.eoi_reached = FALSE; + inputctl->inheaders = TRUE; +} diff --git a/src/SFML/Graphics/libjpeg/jdmainct.c b/src/SFML/Graphics/libjpeg/jdmainct.c new file mode 100644 index 00000000..6b0f06f5 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdmainct.c @@ -0,0 +1,512 @@ +/* + * jdmainct.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the main buffer controller for decompression. + * The main buffer lies between the JPEG decompressor proper and the + * post-processor; it holds downsampled data in the JPEG colorspace. + * + * Note that this code is bypassed in raw-data mode, since the application + * supplies the equivalent of the main buffer in that case. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * In the current system design, the main buffer need never be a full-image + * buffer; any full-height buffers will be found inside the coefficient or + * postprocessing controllers. Nonetheless, the main controller is not + * trivial. Its responsibility is to provide context rows for upsampling/ + * rescaling, and doing this in an efficient fashion is a bit tricky. + * + * Postprocessor input data is counted in "row groups". A row group + * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size) + * sample rows of each component. (We require DCT_scaled_size values to be + * chosen such that these numbers are integers. In practice DCT_scaled_size + * values will likely be powers of two, so we actually have the stronger + * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.) + * Upsampling will typically produce max_v_samp_factor pixel rows from each + * row group (times any additional scale factor that the upsampler is + * applying). + * + * The coefficient controller will deliver data to us one iMCU row at a time; + * each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or + * exactly min_DCT_scaled_size row groups. (This amount of data corresponds + * to one row of MCUs when the image is fully interleaved.) Note that the + * number of sample rows varies across components, but the number of row + * groups does not. Some garbage sample rows may be included in the last iMCU + * row at the bottom of the image. + * + * Depending on the vertical scaling algorithm used, the upsampler may need + * access to the sample row(s) above and below its current input row group. + * The upsampler is required to set need_context_rows TRUE at global selection + * time if so. When need_context_rows is FALSE, this controller can simply + * obtain one iMCU row at a time from the coefficient controller and dole it + * out as row groups to the postprocessor. + * + * When need_context_rows is TRUE, this controller guarantees that the buffer + * passed to postprocessing contains at least one row group's worth of samples + * above and below the row group(s) being processed. Note that the context + * rows "above" the first passed row group appear at negative row offsets in + * the passed buffer. At the top and bottom of the image, the required + * context rows are manufactured by duplicating the first or last real sample + * row; this avoids having special cases in the upsampling inner loops. + * + * The amount of context is fixed at one row group just because that's a + * convenient number for this controller to work with. The existing + * upsamplers really only need one sample row of context. An upsampler + * supporting arbitrary output rescaling might wish for more than one row + * group of context when shrinking the image; tough, we don't handle that. + * (This is justified by the assumption that downsizing will be handled mostly + * by adjusting the DCT_scaled_size values, so that the actual scale factor at + * the upsample step needn't be much less than one.) + * + * To provide the desired context, we have to retain the last two row groups + * of one iMCU row while reading in the next iMCU row. (The last row group + * can't be processed until we have another row group for its below-context, + * and so we have to save the next-to-last group too for its above-context.) + * We could do this most simply by copying data around in our buffer, but + * that'd be very slow. We can avoid copying any data by creating a rather + * strange pointer structure. Here's how it works. We allocate a workspace + * consisting of M+2 row groups (where M = min_DCT_scaled_size is the number + * of row groups per iMCU row). We create two sets of redundant pointers to + * the workspace. Labeling the physical row groups 0 to M+1, the synthesized + * pointer lists look like this: + * M+1 M-1 + * master pointer --> 0 master pointer --> 0 + * 1 1 + * ... ... + * M-3 M-3 + * M-2 M + * M-1 M+1 + * M M-2 + * M+1 M-1 + * 0 0 + * We read alternate iMCU rows using each master pointer; thus the last two + * row groups of the previous iMCU row remain un-overwritten in the workspace. + * The pointer lists are set up so that the required context rows appear to + * be adjacent to the proper places when we pass the pointer lists to the + * upsampler. + * + * The above pictures describe the normal state of the pointer lists. + * At top and bottom of the image, we diddle the pointer lists to duplicate + * the first or last sample row as necessary (this is cheaper than copying + * sample rows around). + * + * This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that + * situation each iMCU row provides only one row group so the buffering logic + * must be different (eg, we must read two iMCU rows before we can emit the + * first row group). For now, we simply do not support providing context + * rows when min_DCT_scaled_size is 1. That combination seems unlikely to + * be worth providing --- if someone wants a 1/8th-size preview, they probably + * want it quick and dirty, so a context-free upsampler is sufficient. + */ + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_d_main_controller pub; /* public fields */ + + /* Pointer to allocated workspace (M or M+2 row groups). */ + JSAMPARRAY buffer[MAX_COMPONENTS]; + + boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ + JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ + + /* Remaining fields are only used in the context case. */ + + /* These are the master pointers to the funny-order pointer lists. */ + JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ + + int whichptr; /* indicates which pointer set is now in use */ + int context_state; /* process_data state machine status */ + JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ + JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ +} my_main_controller; + +typedef my_main_controller * my_main_ptr; + +/* context_state values: */ +#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ +#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ +#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ + + +/* Forward declarations */ +METHODDEF(void) process_data_simple_main + JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); +METHODDEF(void) process_data_context_main + JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); +#ifdef QUANT_2PASS_SUPPORTED +METHODDEF(void) process_data_crank_post + JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); +#endif + + +LOCAL(void) +alloc_funny_pointers (j_decompress_ptr cinfo) +/* Allocate space for the funny pointer lists. + * This is done only once, not once per pass. + */ +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + int ci, rgroup; + int M = cinfo->min_DCT_scaled_size; + jpeg_component_info *compptr; + JSAMPARRAY xbuf; + + /* Get top-level space for component array pointers. + * We alloc both arrays with one call to save a few cycles. + */ + main->xbuffer[0] = (JSAMPIMAGE) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); + main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / + cinfo->min_DCT_scaled_size; /* height of a row group of component */ + /* Get space for pointer lists --- M+4 row groups in each list. + * We alloc both pointer lists with one call to save a few cycles. + */ + xbuf = (JSAMPARRAY) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); + xbuf += rgroup; /* want one row group at negative offsets */ + main->xbuffer[0][ci] = xbuf; + xbuf += rgroup * (M + 4); + main->xbuffer[1][ci] = xbuf; + } +} + + +LOCAL(void) +make_funny_pointers (j_decompress_ptr cinfo) +/* Create the funny pointer lists discussed in the comments above. + * The actual workspace is already allocated (in main->buffer), + * and the space for the pointer lists is allocated too. + * This routine just fills in the curiously ordered lists. + * This will be repeated at the beginning of each pass. + */ +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + int ci, i, rgroup; + int M = cinfo->min_DCT_scaled_size; + jpeg_component_info *compptr; + JSAMPARRAY buf, xbuf0, xbuf1; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / + cinfo->min_DCT_scaled_size; /* height of a row group of component */ + xbuf0 = main->xbuffer[0][ci]; + xbuf1 = main->xbuffer[1][ci]; + /* First copy the workspace pointers as-is */ + buf = main->buffer[ci]; + for (i = 0; i < rgroup * (M + 2); i++) { + xbuf0[i] = xbuf1[i] = buf[i]; + } + /* In the second list, put the last four row groups in swapped order */ + for (i = 0; i < rgroup * 2; i++) { + xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i]; + xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i]; + } + /* The wraparound pointers at top and bottom will be filled later + * (see set_wraparound_pointers, below). Initially we want the "above" + * pointers to duplicate the first actual data line. This only needs + * to happen in xbuffer[0]. + */ + for (i = 0; i < rgroup; i++) { + xbuf0[i - rgroup] = xbuf0[0]; + } + } +} + + +LOCAL(void) +set_wraparound_pointers (j_decompress_ptr cinfo) +/* Set up the "wraparound" pointers at top and bottom of the pointer lists. + * This changes the pointer list state from top-of-image to the normal state. + */ +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + int ci, i, rgroup; + int M = cinfo->min_DCT_scaled_size; + jpeg_component_info *compptr; + JSAMPARRAY xbuf0, xbuf1; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / + cinfo->min_DCT_scaled_size; /* height of a row group of component */ + xbuf0 = main->xbuffer[0][ci]; + xbuf1 = main->xbuffer[1][ci]; + for (i = 0; i < rgroup; i++) { + xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; + xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; + xbuf0[rgroup*(M+2) + i] = xbuf0[i]; + xbuf1[rgroup*(M+2) + i] = xbuf1[i]; + } + } +} + + +LOCAL(void) +set_bottom_pointers (j_decompress_ptr cinfo) +/* Change the pointer lists to duplicate the last sample row at the bottom + * of the image. whichptr indicates which xbuffer holds the final iMCU row. + * Also sets rowgroups_avail to indicate number of nondummy row groups in row. + */ +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + int ci, i, rgroup, iMCUheight, rows_left; + jpeg_component_info *compptr; + JSAMPARRAY xbuf; + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Count sample rows in one iMCU row and in one row group */ + iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size; + rgroup = iMCUheight / cinfo->min_DCT_scaled_size; + /* Count nondummy sample rows remaining for this component */ + rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); + if (rows_left == 0) rows_left = iMCUheight; + /* Count nondummy row groups. Should get same answer for each component, + * so we need only do it once. + */ + if (ci == 0) { + main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); + } + /* Duplicate the last real sample row rgroup*2 times; this pads out the + * last partial rowgroup and ensures at least one full rowgroup of context. + */ + xbuf = main->xbuffer[main->whichptr][ci]; + for (i = 0; i < rgroup * 2; i++) { + xbuf[rows_left + i] = xbuf[rows_left-1]; + } + } +} + + +/* + * Initialize for a processing pass. + */ + +METHODDEF(void) +start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + + switch (pass_mode) { + case JBUF_PASS_THRU: + if (cinfo->upsample->need_context_rows) { + main->pub.process_data = process_data_context_main; + make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ + main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ + main->context_state = CTX_PREPARE_FOR_IMCU; + main->iMCU_row_ctr = 0; + } else { + /* Simple case with no context needed */ + main->pub.process_data = process_data_simple_main; + } + main->buffer_full = FALSE; /* Mark buffer empty */ + main->rowgroup_ctr = 0; + break; +#ifdef QUANT_2PASS_SUPPORTED + case JBUF_CRANK_DEST: + /* For last pass of 2-pass quantization, just crank the postprocessor */ + main->pub.process_data = process_data_crank_post; + break; +#endif + default: + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + break; + } +} + + +/* + * Process some data. + * This handles the simple case where no context is required. + */ + +METHODDEF(void) +process_data_simple_main (j_decompress_ptr cinfo, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + JDIMENSION rowgroups_avail; + + /* Read input data if we haven't filled the main buffer yet */ + if (! main->buffer_full) { + if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer)) + return; /* suspension forced, can do nothing more */ + main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + } + + /* There are always min_DCT_scaled_size row groups in an iMCU row. */ + rowgroups_avail = (JDIMENSION) cinfo->min_DCT_scaled_size; + /* Note: at the bottom of the image, we may pass extra garbage row groups + * to the postprocessor. The postprocessor has to check for bottom + * of image anyway (at row resolution), so no point in us doing it too. + */ + + /* Feed the postprocessor */ + (*cinfo->post->post_process_data) (cinfo, main->buffer, + &main->rowgroup_ctr, rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); + + /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ + if (main->rowgroup_ctr >= rowgroups_avail) { + main->buffer_full = FALSE; + main->rowgroup_ctr = 0; + } +} + + +/* + * Process some data. + * This handles the case where context rows must be provided. + */ + +METHODDEF(void) +process_data_context_main (j_decompress_ptr cinfo, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + my_main_ptr main = (my_main_ptr) cinfo->main; + + /* Read input data if we haven't filled the main buffer yet */ + if (! main->buffer_full) { + if (! (*cinfo->coef->decompress_data) (cinfo, + main->xbuffer[main->whichptr])) + return; /* suspension forced, can do nothing more */ + main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ + main->iMCU_row_ctr++; /* count rows received */ + } + + /* Postprocessor typically will not swallow all the input data it is handed + * in one call (due to filling the output buffer first). Must be prepared + * to exit and restart. This switch lets us keep track of how far we got. + * Note that each case falls through to the next on successful completion. + */ + switch (main->context_state) { + case CTX_POSTPONED_ROW: + /* Call postprocessor using previously set pointers for postponed row */ + (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], + &main->rowgroup_ctr, main->rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); + if (main->rowgroup_ctr < main->rowgroups_avail) + return; /* Need to suspend */ + main->context_state = CTX_PREPARE_FOR_IMCU; + if (*out_row_ctr >= out_rows_avail) + return; /* Postprocessor exactly filled output buf */ + /*FALLTHROUGH*/ + case CTX_PREPARE_FOR_IMCU: + /* Prepare to process first M-1 row groups of this iMCU row */ + main->rowgroup_ctr = 0; + main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size - 1); + /* Check for bottom of image: if so, tweak pointers to "duplicate" + * the last sample row, and adjust rowgroups_avail to ignore padding rows. + */ + if (main->iMCU_row_ctr == cinfo->total_iMCU_rows) + set_bottom_pointers(cinfo); + main->context_state = CTX_PROCESS_IMCU; + /*FALLTHROUGH*/ + case CTX_PROCESS_IMCU: + /* Call postprocessor using previously set pointers */ + (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], + &main->rowgroup_ctr, main->rowgroups_avail, + output_buf, out_row_ctr, out_rows_avail); + if (main->rowgroup_ctr < main->rowgroups_avail) + return; /* Need to suspend */ + /* After the first iMCU, change wraparound pointers to normal state */ + if (main->iMCU_row_ctr == 1) + set_wraparound_pointers(cinfo); + /* Prepare to load new iMCU row using other xbuffer list */ + main->whichptr ^= 1; /* 0=>1 or 1=>0 */ + main->buffer_full = FALSE; + /* Still need to process last row group of this iMCU row, */ + /* which is saved at index M+1 of the other xbuffer */ + main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_scaled_size + 1); + main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size + 2); + main->context_state = CTX_POSTPONED_ROW; + } +} + + +/* + * Process some data. + * Final pass of two-pass quantization: just call the postprocessor. + * Source data will be the postprocessor controller's internal buffer. + */ + +#ifdef QUANT_2PASS_SUPPORTED + +METHODDEF(void) +process_data_crank_post (j_decompress_ptr cinfo, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL, + (JDIMENSION *) NULL, (JDIMENSION) 0, + output_buf, out_row_ctr, out_rows_avail); +} + +#endif /* QUANT_2PASS_SUPPORTED */ + + +/* + * Initialize main buffer controller. + */ + +GLOBAL(void) +jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) +{ + my_main_ptr main; + int ci, rgroup, ngroups; + jpeg_component_info *compptr; + + main = (my_main_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_main_controller)); + cinfo->main = (struct jpeg_d_main_controller *) main; + main->pub.start_pass = start_pass_main; + + if (need_full_buffer) /* shouldn't happen */ + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + + /* Allocate the workspace. + * ngroups is the number of row groups we need. + */ + if (cinfo->upsample->need_context_rows) { + if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */ + ERREXIT(cinfo, JERR_NOTIMPL); + alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ + ngroups = cinfo->min_DCT_scaled_size + 2; + } else { + ngroups = cinfo->min_DCT_scaled_size; + } + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / + cinfo->min_DCT_scaled_size; /* height of a row group of component */ + main->buffer[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + compptr->width_in_blocks * compptr->DCT_scaled_size, + (JDIMENSION) (rgroup * ngroups)); + } +} diff --git a/src/SFML/Graphics/libjpeg/jdmarker.c b/src/SFML/Graphics/libjpeg/jdmarker.c new file mode 100644 index 00000000..9811761d --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdmarker.c @@ -0,0 +1,1360 @@ +/* + * jdmarker.c + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to decode JPEG datastream markers. + * Most of the complexity arises from our desire to support input + * suspension: if not all of the data for a marker is available, + * we must exit back to the application. On resumption, we reprocess + * the marker. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +typedef enum { /* JPEG marker codes */ + M_SOF0 = 0xc0, + M_SOF1 = 0xc1, + M_SOF2 = 0xc2, + M_SOF3 = 0xc3, + + M_SOF5 = 0xc5, + M_SOF6 = 0xc6, + M_SOF7 = 0xc7, + + M_JPG = 0xc8, + M_SOF9 = 0xc9, + M_SOF10 = 0xca, + M_SOF11 = 0xcb, + + M_SOF13 = 0xcd, + M_SOF14 = 0xce, + M_SOF15 = 0xcf, + + M_DHT = 0xc4, + + M_DAC = 0xcc, + + M_RST0 = 0xd0, + M_RST1 = 0xd1, + M_RST2 = 0xd2, + M_RST3 = 0xd3, + M_RST4 = 0xd4, + M_RST5 = 0xd5, + M_RST6 = 0xd6, + M_RST7 = 0xd7, + + M_SOI = 0xd8, + M_EOI = 0xd9, + M_SOS = 0xda, + M_DQT = 0xdb, + M_DNL = 0xdc, + M_DRI = 0xdd, + M_DHP = 0xde, + M_EXP = 0xdf, + + M_APP0 = 0xe0, + M_APP1 = 0xe1, + M_APP2 = 0xe2, + M_APP3 = 0xe3, + M_APP4 = 0xe4, + M_APP5 = 0xe5, + M_APP6 = 0xe6, + M_APP7 = 0xe7, + M_APP8 = 0xe8, + M_APP9 = 0xe9, + M_APP10 = 0xea, + M_APP11 = 0xeb, + M_APP12 = 0xec, + M_APP13 = 0xed, + M_APP14 = 0xee, + M_APP15 = 0xef, + + M_JPG0 = 0xf0, + M_JPG13 = 0xfd, + M_COM = 0xfe, + + M_TEM = 0x01, + + M_ERROR = 0x100 +} JPEG_MARKER; + + +/* Private state */ + +typedef struct { + struct jpeg_marker_reader pub; /* public fields */ + + /* Application-overridable marker processing methods */ + jpeg_marker_parser_method process_COM; + jpeg_marker_parser_method process_APPn[16]; + + /* Limit on marker data length to save for each marker type */ + unsigned int length_limit_COM; + unsigned int length_limit_APPn[16]; + + /* Status of COM/APPn marker saving */ + jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */ + unsigned int bytes_read; /* data bytes read so far in marker */ + /* Note: cur_marker is not linked into marker_list until it's all read. */ +} my_marker_reader; + +typedef my_marker_reader * my_marker_ptr; + + +/* + * Macros for fetching data from the data source module. + * + * At all times, cinfo->src->next_input_byte and ->bytes_in_buffer reflect + * the current restart point; we update them only when we have reached a + * suitable place to restart if a suspension occurs. + */ + +/* Declare and initialize local copies of input pointer/count */ +#define INPUT_VARS(cinfo) \ + struct jpeg_source_mgr * datasrc = (cinfo)->src; \ + const JOCTET * next_input_byte = datasrc->next_input_byte; \ + size_t bytes_in_buffer = datasrc->bytes_in_buffer + +/* Unload the local copies --- do this only at a restart boundary */ +#define INPUT_SYNC(cinfo) \ + ( datasrc->next_input_byte = next_input_byte, \ + datasrc->bytes_in_buffer = bytes_in_buffer ) + +/* Reload the local copies --- used only in MAKE_BYTE_AVAIL */ +#define INPUT_RELOAD(cinfo) \ + ( next_input_byte = datasrc->next_input_byte, \ + bytes_in_buffer = datasrc->bytes_in_buffer ) + +/* Internal macro for INPUT_BYTE and INPUT_2BYTES: make a byte available. + * Note we do *not* do INPUT_SYNC before calling fill_input_buffer, + * but we must reload the local copies after a successful fill. + */ +#define MAKE_BYTE_AVAIL(cinfo,action) \ + if (bytes_in_buffer == 0) { \ + if (! (*datasrc->fill_input_buffer) (cinfo)) \ + { action; } \ + INPUT_RELOAD(cinfo); \ + } + +/* Read a byte into variable V. + * If must suspend, take the specified action (typically "return FALSE"). + */ +#define INPUT_BYTE(cinfo,V,action) \ + MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ + bytes_in_buffer--; \ + V = GETJOCTET(*next_input_byte++); ) + +/* As above, but read two bytes interpreted as an unsigned 16-bit integer. + * V should be declared unsigned int or perhaps INT32. + */ +#define INPUT_2BYTES(cinfo,V,action) \ + MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ + bytes_in_buffer--; \ + V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \ + MAKE_BYTE_AVAIL(cinfo,action); \ + bytes_in_buffer--; \ + V += GETJOCTET(*next_input_byte++); ) + + +/* + * Routines to process JPEG markers. + * + * Entry condition: JPEG marker itself has been read and its code saved + * in cinfo->unread_marker; input restart point is just after the marker. + * + * Exit: if return TRUE, have read and processed any parameters, and have + * updated the restart point to point after the parameters. + * If return FALSE, was forced to suspend before reaching end of + * marker parameters; restart point has not been moved. Same routine + * will be called again after application supplies more input data. + * + * This approach to suspension assumes that all of a marker's parameters + * can fit into a single input bufferload. This should hold for "normal" + * markers. Some COM/APPn markers might have large parameter segments + * that might not fit. If we are simply dropping such a marker, we use + * skip_input_data to get past it, and thereby put the problem on the + * source manager's shoulders. If we are saving the marker's contents + * into memory, we use a slightly different convention: when forced to + * suspend, the marker processor updates the restart point to the end of + * what it's consumed (ie, the end of the buffer) before returning FALSE. + * On resumption, cinfo->unread_marker still contains the marker code, + * but the data source will point to the next chunk of marker data. + * The marker processor must retain internal state to deal with this. + * + * Note that we don't bother to avoid duplicate trace messages if a + * suspension occurs within marker parameters. Other side effects + * require more care. + */ + + +LOCAL(boolean) +get_soi (j_decompress_ptr cinfo) +/* Process an SOI marker */ +{ + int i; + + TRACEMS(cinfo, 1, JTRC_SOI); + + if (cinfo->marker->saw_SOI) + ERREXIT(cinfo, JERR_SOI_DUPLICATE); + + /* Reset all parameters that are defined to be reset by SOI */ + + for (i = 0; i < NUM_ARITH_TBLS; i++) { + cinfo->arith_dc_L[i] = 0; + cinfo->arith_dc_U[i] = 1; + cinfo->arith_ac_K[i] = 5; + } + cinfo->restart_interval = 0; + + /* Set initial assumptions for colorspace etc */ + + cinfo->jpeg_color_space = JCS_UNKNOWN; + cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */ + + cinfo->saw_JFIF_marker = FALSE; + cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */ + cinfo->JFIF_minor_version = 1; + cinfo->density_unit = 0; + cinfo->X_density = 1; + cinfo->Y_density = 1; + cinfo->saw_Adobe_marker = FALSE; + cinfo->Adobe_transform = 0; + + cinfo->marker->saw_SOI = TRUE; + + return TRUE; +} + + +LOCAL(boolean) +get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) +/* Process a SOFn marker */ +{ + INT32 length; + int c, ci; + jpeg_component_info * compptr; + INPUT_VARS(cinfo); + + cinfo->progressive_mode = is_prog; + cinfo->arith_code = is_arith; + + INPUT_2BYTES(cinfo, length, return FALSE); + + INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE); + INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE); + INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE); + INPUT_BYTE(cinfo, cinfo->num_components, return FALSE); + + length -= 8; + + TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker, + (int) cinfo->image_width, (int) cinfo->image_height, + cinfo->num_components); + + if (cinfo->marker->saw_SOF) + ERREXIT(cinfo, JERR_SOF_DUPLICATE); + + /* We don't support files in which the image height is initially specified */ + /* as 0 and is later redefined by DNL. As long as we have to check that, */ + /* might as well have a general sanity check. */ + if (cinfo->image_height <= 0 || cinfo->image_width <= 0 + || cinfo->num_components <= 0) + ERREXIT(cinfo, JERR_EMPTY_IMAGE); + + if (length != (cinfo->num_components * 3)) + ERREXIT(cinfo, JERR_BAD_LENGTH); + + if (cinfo->comp_info == NULL) /* do only once, even if suspend */ + cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->num_components * SIZEOF(jpeg_component_info)); + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + compptr->component_index = ci; + INPUT_BYTE(cinfo, compptr->component_id, return FALSE); + INPUT_BYTE(cinfo, c, return FALSE); + compptr->h_samp_factor = (c >> 4) & 15; + compptr->v_samp_factor = (c ) & 15; + INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE); + + TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT, + compptr->component_id, compptr->h_samp_factor, + compptr->v_samp_factor, compptr->quant_tbl_no); + } + + cinfo->marker->saw_SOF = TRUE; + + INPUT_SYNC(cinfo); + return TRUE; +} + + +LOCAL(boolean) +get_sos (j_decompress_ptr cinfo) +/* Process a SOS marker */ +{ + INT32 length; + int i, ci, n, c, cc; + jpeg_component_info * compptr; + INPUT_VARS(cinfo); + + if (! cinfo->marker->saw_SOF) + ERREXIT(cinfo, JERR_SOS_NO_SOF); + + INPUT_2BYTES(cinfo, length, return FALSE); + + INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */ + + TRACEMS1(cinfo, 1, JTRC_SOS, n); + + if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN) + ERREXIT(cinfo, JERR_BAD_LENGTH); + + cinfo->comps_in_scan = n; + + /* Collect the component-spec parameters */ + + for (i = 0; i < n; i++) { + INPUT_BYTE(cinfo, cc, return FALSE); + INPUT_BYTE(cinfo, c, return FALSE); + + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + if (cc == compptr->component_id) + goto id_found; + } + + ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); + + id_found: + + cinfo->cur_comp_info[i] = compptr; + compptr->dc_tbl_no = (c >> 4) & 15; + compptr->ac_tbl_no = (c ) & 15; + + TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, + compptr->dc_tbl_no, compptr->ac_tbl_no); + } + + /* Collect the additional scan parameters Ss, Se, Ah/Al. */ + INPUT_BYTE(cinfo, c, return FALSE); + cinfo->Ss = c; + INPUT_BYTE(cinfo, c, return FALSE); + cinfo->Se = c; + INPUT_BYTE(cinfo, c, return FALSE); + cinfo->Ah = (c >> 4) & 15; + cinfo->Al = (c ) & 15; + + TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se, + cinfo->Ah, cinfo->Al); + + /* Prepare to scan data & restart markers */ + cinfo->marker->next_restart_num = 0; + + /* Count another SOS marker */ + cinfo->input_scan_number++; + + INPUT_SYNC(cinfo); + return TRUE; +} + + +#ifdef D_ARITH_CODING_SUPPORTED + +LOCAL(boolean) +get_dac (j_decompress_ptr cinfo) +/* Process a DAC marker */ +{ + INT32 length; + int index, val; + INPUT_VARS(cinfo); + + INPUT_2BYTES(cinfo, length, return FALSE); + length -= 2; + + while (length > 0) { + INPUT_BYTE(cinfo, index, return FALSE); + INPUT_BYTE(cinfo, val, return FALSE); + + length -= 2; + + TRACEMS2(cinfo, 1, JTRC_DAC, index, val); + + if (index < 0 || index >= (2*NUM_ARITH_TBLS)) + ERREXIT1(cinfo, JERR_DAC_INDEX, index); + + if (index >= NUM_ARITH_TBLS) { /* define AC table */ + cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; + } else { /* define DC table */ + cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); + cinfo->arith_dc_U[index] = (UINT8) (val >> 4); + if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) + ERREXIT1(cinfo, JERR_DAC_VALUE, val); + } + } + + if (length != 0) + ERREXIT(cinfo, JERR_BAD_LENGTH); + + INPUT_SYNC(cinfo); + return TRUE; +} + +#else /* ! D_ARITH_CODING_SUPPORTED */ + +#define get_dac(cinfo) skip_variable(cinfo) + +#endif /* D_ARITH_CODING_SUPPORTED */ + + +LOCAL(boolean) +get_dht (j_decompress_ptr cinfo) +/* Process a DHT marker */ +{ + INT32 length; + UINT8 bits[17]; + UINT8 huffval[256]; + int i, index, count; + JHUFF_TBL **htblptr; + INPUT_VARS(cinfo); + + INPUT_2BYTES(cinfo, length, return FALSE); + length -= 2; + + while (length > 16) { + INPUT_BYTE(cinfo, index, return FALSE); + + TRACEMS1(cinfo, 1, JTRC_DHT, index); + + bits[0] = 0; + count = 0; + for (i = 1; i <= 16; i++) { + INPUT_BYTE(cinfo, bits[i], return FALSE); + count += bits[i]; + } + + length -= 1 + 16; + + TRACEMS8(cinfo, 2, JTRC_HUFFBITS, + bits[1], bits[2], bits[3], bits[4], + bits[5], bits[6], bits[7], bits[8]); + TRACEMS8(cinfo, 2, JTRC_HUFFBITS, + bits[9], bits[10], bits[11], bits[12], + bits[13], bits[14], bits[15], bits[16]); + + /* Here we just do minimal validation of the counts to avoid walking + * off the end of our table space. jdhuff.c will check more carefully. + */ + if (count > 256 || ((INT32) count) > length) + ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); + + for (i = 0; i < count; i++) + INPUT_BYTE(cinfo, huffval[i], return FALSE); + + length -= count; + + if (index & 0x10) { /* AC table definition */ + index -= 0x10; + htblptr = &cinfo->ac_huff_tbl_ptrs[index]; + } else { /* DC table definition */ + htblptr = &cinfo->dc_huff_tbl_ptrs[index]; + } + + if (index < 0 || index >= NUM_HUFF_TBLS) + ERREXIT1(cinfo, JERR_DHT_INDEX, index); + + if (*htblptr == NULL) + *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); + + MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits)); + MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval)); + } + + if (length != 0) + ERREXIT(cinfo, JERR_BAD_LENGTH); + + INPUT_SYNC(cinfo); + return TRUE; +} + + +LOCAL(boolean) +get_dqt (j_decompress_ptr cinfo) +/* Process a DQT marker */ +{ + INT32 length; + int n, i, prec; + unsigned int tmp; + JQUANT_TBL *quant_ptr; + INPUT_VARS(cinfo); + + INPUT_2BYTES(cinfo, length, return FALSE); + length -= 2; + + while (length > 0) { + INPUT_BYTE(cinfo, n, return FALSE); + prec = n >> 4; + n &= 0x0F; + + TRACEMS2(cinfo, 1, JTRC_DQT, n, prec); + + if (n >= NUM_QUANT_TBLS) + ERREXIT1(cinfo, JERR_DQT_INDEX, n); + + if (cinfo->quant_tbl_ptrs[n] == NULL) + cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); + quant_ptr = cinfo->quant_tbl_ptrs[n]; + + for (i = 0; i < DCTSIZE2; i++) { + if (prec) + INPUT_2BYTES(cinfo, tmp, return FALSE); + else + INPUT_BYTE(cinfo, tmp, return FALSE); + /* We convert the zigzag-order table to natural array order. */ + quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp; + } + + if (cinfo->err->trace_level >= 2) { + for (i = 0; i < DCTSIZE2; i += 8) { + TRACEMS8(cinfo, 2, JTRC_QUANTVALS, + quant_ptr->quantval[i], quant_ptr->quantval[i+1], + quant_ptr->quantval[i+2], quant_ptr->quantval[i+3], + quant_ptr->quantval[i+4], quant_ptr->quantval[i+5], + quant_ptr->quantval[i+6], quant_ptr->quantval[i+7]); + } + } + + length -= DCTSIZE2+1; + if (prec) length -= DCTSIZE2; + } + + if (length != 0) + ERREXIT(cinfo, JERR_BAD_LENGTH); + + INPUT_SYNC(cinfo); + return TRUE; +} + + +LOCAL(boolean) +get_dri (j_decompress_ptr cinfo) +/* Process a DRI marker */ +{ + INT32 length; + unsigned int tmp; + INPUT_VARS(cinfo); + + INPUT_2BYTES(cinfo, length, return FALSE); + + if (length != 4) + ERREXIT(cinfo, JERR_BAD_LENGTH); + + INPUT_2BYTES(cinfo, tmp, return FALSE); + + TRACEMS1(cinfo, 1, JTRC_DRI, tmp); + + cinfo->restart_interval = tmp; + + INPUT_SYNC(cinfo); + return TRUE; +} + + +/* + * Routines for processing APPn and COM markers. + * These are either saved in memory or discarded, per application request. + * APP0 and APP14 are specially checked to see if they are + * JFIF and Adobe markers, respectively. + */ + +#define APP0_DATA_LEN 14 /* Length of interesting data in APP0 */ +#define APP14_DATA_LEN 12 /* Length of interesting data in APP14 */ +#define APPN_DATA_LEN 14 /* Must be the largest of the above!! */ + + +LOCAL(void) +examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, + unsigned int datalen, INT32 remaining) +/* Examine first few bytes from an APP0. + * Take appropriate action if it is a JFIF marker. + * datalen is # of bytes at data[], remaining is length of rest of marker data. + */ +{ + INT32 totallen = (INT32) datalen + remaining; + + if (datalen >= APP0_DATA_LEN && + GETJOCTET(data[0]) == 0x4A && + GETJOCTET(data[1]) == 0x46 && + GETJOCTET(data[2]) == 0x49 && + GETJOCTET(data[3]) == 0x46 && + GETJOCTET(data[4]) == 0) { + /* Found JFIF APP0 marker: save info */ + cinfo->saw_JFIF_marker = TRUE; + cinfo->JFIF_major_version = GETJOCTET(data[5]); + cinfo->JFIF_minor_version = GETJOCTET(data[6]); + cinfo->density_unit = GETJOCTET(data[7]); + cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]); + cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]); + /* Check version. + * Major version must be 1, anything else signals an incompatible change. + * (We used to treat this as an error, but now it's a nonfatal warning, + * because some bozo at Hijaak couldn't read the spec.) + * Minor version should be 0..2, but process anyway if newer. + */ + if (cinfo->JFIF_major_version != 1) + WARNMS2(cinfo, JWRN_JFIF_MAJOR, + cinfo->JFIF_major_version, cinfo->JFIF_minor_version); + /* Generate trace messages */ + TRACEMS5(cinfo, 1, JTRC_JFIF, + cinfo->JFIF_major_version, cinfo->JFIF_minor_version, + cinfo->X_density, cinfo->Y_density, cinfo->density_unit); + /* Validate thumbnail dimensions and issue appropriate messages */ + if (GETJOCTET(data[12]) | GETJOCTET(data[13])) + TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, + GETJOCTET(data[12]), GETJOCTET(data[13])); + totallen -= APP0_DATA_LEN; + if (totallen != + ((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3)) + TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); + } else if (datalen >= 6 && + GETJOCTET(data[0]) == 0x4A && + GETJOCTET(data[1]) == 0x46 && + GETJOCTET(data[2]) == 0x58 && + GETJOCTET(data[3]) == 0x58 && + GETJOCTET(data[4]) == 0) { + /* Found JFIF "JFXX" extension APP0 marker */ + /* The library doesn't actually do anything with these, + * but we try to produce a helpful trace message. + */ + switch (GETJOCTET(data[5])) { + case 0x10: + TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen); + break; + case 0x11: + TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen); + break; + case 0x13: + TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen); + break; + default: + TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, + GETJOCTET(data[5]), (int) totallen); + break; + } + } else { + /* Start of APP0 does not match "JFIF" or "JFXX", or too short */ + TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen); + } +} + + +LOCAL(void) +examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, + unsigned int datalen, INT32 remaining) +/* Examine first few bytes from an APP14. + * Take appropriate action if it is an Adobe marker. + * datalen is # of bytes at data[], remaining is length of rest of marker data. + */ +{ + unsigned int version, flags0, flags1, transform; + + if (datalen >= APP14_DATA_LEN && + GETJOCTET(data[0]) == 0x41 && + GETJOCTET(data[1]) == 0x64 && + GETJOCTET(data[2]) == 0x6F && + GETJOCTET(data[3]) == 0x62 && + GETJOCTET(data[4]) == 0x65) { + /* Found Adobe APP14 marker */ + version = (GETJOCTET(data[5]) << 8) + GETJOCTET(data[6]); + flags0 = (GETJOCTET(data[7]) << 8) + GETJOCTET(data[8]); + flags1 = (GETJOCTET(data[9]) << 8) + GETJOCTET(data[10]); + transform = GETJOCTET(data[11]); + TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); + cinfo->saw_Adobe_marker = TRUE; + cinfo->Adobe_transform = (UINT8) transform; + } else { + /* Start of APP14 does not match "Adobe", or too short */ + TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); + } +} + + +METHODDEF(boolean) +get_interesting_appn (j_decompress_ptr cinfo) +/* Process an APP0 or APP14 marker without saving it */ +{ + INT32 length; + JOCTET b[APPN_DATA_LEN]; + unsigned int i, numtoread; + INPUT_VARS(cinfo); + + INPUT_2BYTES(cinfo, length, return FALSE); + length -= 2; + + /* get the interesting part of the marker data */ + if (length >= APPN_DATA_LEN) + numtoread = APPN_DATA_LEN; + else if (length > 0) + numtoread = (unsigned int) length; + else + numtoread = 0; + for (i = 0; i < numtoread; i++) + INPUT_BYTE(cinfo, b[i], return FALSE); + length -= numtoread; + + /* process it */ + switch (cinfo->unread_marker) { + case M_APP0: + examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length); + break; + case M_APP14: + examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length); + break; + default: + /* can't get here unless jpeg_save_markers chooses wrong processor */ + ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); + break; + } + + /* skip any remaining data -- could be lots */ + INPUT_SYNC(cinfo); + if (length > 0) + (*cinfo->src->skip_input_data) (cinfo, (long) length); + + return TRUE; +} + + +#ifdef SAVE_MARKERS_SUPPORTED + +METHODDEF(boolean) +save_marker (j_decompress_ptr cinfo) +/* Save an APPn or COM marker into the marker list */ +{ + my_marker_ptr marker = (my_marker_ptr) cinfo->marker; + jpeg_saved_marker_ptr cur_marker = marker->cur_marker; + unsigned int bytes_read, data_length; + JOCTET FAR * data; + INT32 length = 0; + INPUT_VARS(cinfo); + + if (cur_marker == NULL) { + /* begin reading a marker */ + INPUT_2BYTES(cinfo, length, return FALSE); + length -= 2; + if (length >= 0) { /* watch out for bogus length word */ + /* figure out how much we want to save */ + unsigned int limit; + if (cinfo->unread_marker == (int) M_COM) + limit = marker->length_limit_COM; + else + limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0]; + if ((unsigned int) length < limit) + limit = (unsigned int) length; + /* allocate and initialize the marker item */ + cur_marker = (jpeg_saved_marker_ptr) + (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(struct jpeg_marker_struct) + limit); + cur_marker->next = NULL; + cur_marker->marker = (UINT8) cinfo->unread_marker; + cur_marker->original_length = (unsigned int) length; + cur_marker->data_length = limit; + /* data area is just beyond the jpeg_marker_struct */ + data = cur_marker->data = (JOCTET FAR *) (cur_marker + 1); + marker->cur_marker = cur_marker; + marker->bytes_read = 0; + bytes_read = 0; + data_length = limit; + } else { + /* deal with bogus length word */ + bytes_read = data_length = 0; + data = NULL; + } + } else { + /* resume reading a marker */ + bytes_read = marker->bytes_read; + data_length = cur_marker->data_length; + data = cur_marker->data + bytes_read; + } + + while (bytes_read < data_length) { + INPUT_SYNC(cinfo); /* move the restart point to here */ + marker->bytes_read = bytes_read; + /* If there's not at least one byte in buffer, suspend */ + MAKE_BYTE_AVAIL(cinfo, return FALSE); + /* Copy bytes with reasonable rapidity */ + while (bytes_read < data_length && bytes_in_buffer > 0) { + *data++ = *next_input_byte++; + bytes_in_buffer--; + bytes_read++; + } + } + + /* Done reading what we want to read */ + if (cur_marker != NULL) { /* will be NULL if bogus length word */ + /* Add new marker to end of list */ + if (cinfo->marker_list == NULL) { + cinfo->marker_list = cur_marker; + } else { + jpeg_saved_marker_ptr prev = cinfo->marker_list; + while (prev->next != NULL) + prev = prev->next; + prev->next = cur_marker; + } + /* Reset pointer & calc remaining data length */ + data = cur_marker->data; + length = cur_marker->original_length - data_length; + } + /* Reset to initial state for next marker */ + marker->cur_marker = NULL; + + /* Process the marker if interesting; else just make a generic trace msg */ + switch (cinfo->unread_marker) { + case M_APP0: + examine_app0(cinfo, data, data_length, length); + break; + case M_APP14: + examine_app14(cinfo, data, data_length, length); + break; + default: + TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, + (int) (data_length + length)); + break; + } + + /* skip any remaining data -- could be lots */ + INPUT_SYNC(cinfo); /* do before skip_input_data */ + if (length > 0) + (*cinfo->src->skip_input_data) (cinfo, (long) length); + + return TRUE; +} + +#endif /* SAVE_MARKERS_SUPPORTED */ + + +METHODDEF(boolean) +skip_variable (j_decompress_ptr cinfo) +/* Skip over an unknown or uninteresting variable-length marker */ +{ + INT32 length; + INPUT_VARS(cinfo); + + INPUT_2BYTES(cinfo, length, return FALSE); + length -= 2; + + TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); + + INPUT_SYNC(cinfo); /* do before skip_input_data */ + if (length > 0) + (*cinfo->src->skip_input_data) (cinfo, (long) length); + + return TRUE; +} + + +/* + * Find the next JPEG marker, save it in cinfo->unread_marker. + * Returns FALSE if had to suspend before reaching a marker; + * in that case cinfo->unread_marker is unchanged. + * + * Note that the result might not be a valid marker code, + * but it will never be 0 or FF. + */ + +LOCAL(boolean) +next_marker (j_decompress_ptr cinfo) +{ + int c; + INPUT_VARS(cinfo); + + for (;;) { + INPUT_BYTE(cinfo, c, return FALSE); + /* Skip any non-FF bytes. + * This may look a bit inefficient, but it will not occur in a valid file. + * We sync after each discarded byte so that a suspending data source + * can discard the byte from its buffer. + */ + while (c != 0xFF) { + cinfo->marker->discarded_bytes++; + INPUT_SYNC(cinfo); + INPUT_BYTE(cinfo, c, return FALSE); + } + /* This loop swallows any duplicate FF bytes. Extra FFs are legal as + * pad bytes, so don't count them in discarded_bytes. We assume there + * will not be so many consecutive FF bytes as to overflow a suspending + * data source's input buffer. + */ + do { + INPUT_BYTE(cinfo, c, return FALSE); + } while (c == 0xFF); + if (c != 0) + break; /* found a valid marker, exit loop */ + /* Reach here if we found a stuffed-zero data sequence (FF/00). + * Discard it and loop back to try again. + */ + cinfo->marker->discarded_bytes += 2; + INPUT_SYNC(cinfo); + } + + if (cinfo->marker->discarded_bytes != 0) { + WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c); + cinfo->marker->discarded_bytes = 0; + } + + cinfo->unread_marker = c; + + INPUT_SYNC(cinfo); + return TRUE; +} + + +LOCAL(boolean) +first_marker (j_decompress_ptr cinfo) +/* Like next_marker, but used to obtain the initial SOI marker. */ +/* For this marker, we do not allow preceding garbage or fill; otherwise, + * we might well scan an entire input file before realizing it ain't JPEG. + * If an application wants to process non-JFIF files, it must seek to the + * SOI before calling the JPEG library. + */ +{ + int c, c2; + INPUT_VARS(cinfo); + + INPUT_BYTE(cinfo, c, return FALSE); + INPUT_BYTE(cinfo, c2, return FALSE); + if (c != 0xFF || c2 != (int) M_SOI) + ERREXIT2(cinfo, JERR_NO_SOI, c, c2); + + cinfo->unread_marker = c2; + + INPUT_SYNC(cinfo); + return TRUE; +} + + +/* + * Read markers until SOS or EOI. + * + * Returns same codes as are defined for jpeg_consume_input: + * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. + */ + +METHODDEF(int) +read_markers (j_decompress_ptr cinfo) +{ + /* Outer loop repeats once for each marker. */ + for (;;) { + /* Collect the marker proper, unless we already did. */ + /* NB: first_marker() enforces the requirement that SOI appear first. */ + if (cinfo->unread_marker == 0) { + if (! cinfo->marker->saw_SOI) { + if (! first_marker(cinfo)) + return JPEG_SUSPENDED; + } else { + if (! next_marker(cinfo)) + return JPEG_SUSPENDED; + } + } + /* At this point cinfo->unread_marker contains the marker code and the + * input point is just past the marker proper, but before any parameters. + * A suspension will cause us to return with this state still true. + */ + switch (cinfo->unread_marker) { + case M_SOI: + if (! get_soi(cinfo)) + return JPEG_SUSPENDED; + break; + + case M_SOF0: /* Baseline */ + case M_SOF1: /* Extended sequential, Huffman */ + if (! get_sof(cinfo, FALSE, FALSE)) + return JPEG_SUSPENDED; + break; + + case M_SOF2: /* Progressive, Huffman */ + if (! get_sof(cinfo, TRUE, FALSE)) + return JPEG_SUSPENDED; + break; + + case M_SOF9: /* Extended sequential, arithmetic */ + if (! get_sof(cinfo, FALSE, TRUE)) + return JPEG_SUSPENDED; + break; + + case M_SOF10: /* Progressive, arithmetic */ + if (! get_sof(cinfo, TRUE, TRUE)) + return JPEG_SUSPENDED; + break; + + /* Currently unsupported SOFn types */ + case M_SOF3: /* Lossless, Huffman */ + case M_SOF5: /* Differential sequential, Huffman */ + case M_SOF6: /* Differential progressive, Huffman */ + case M_SOF7: /* Differential lossless, Huffman */ + case M_JPG: /* Reserved for JPEG extensions */ + case M_SOF11: /* Lossless, arithmetic */ + case M_SOF13: /* Differential sequential, arithmetic */ + case M_SOF14: /* Differential progressive, arithmetic */ + case M_SOF15: /* Differential lossless, arithmetic */ + ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker); + break; + + case M_SOS: + if (! get_sos(cinfo)) + return JPEG_SUSPENDED; + cinfo->unread_marker = 0; /* processed the marker */ + return JPEG_REACHED_SOS; + + case M_EOI: + TRACEMS(cinfo, 1, JTRC_EOI); + cinfo->unread_marker = 0; /* processed the marker */ + return JPEG_REACHED_EOI; + + case M_DAC: + if (! get_dac(cinfo)) + return JPEG_SUSPENDED; + break; + + case M_DHT: + if (! get_dht(cinfo)) + return JPEG_SUSPENDED; + break; + + case M_DQT: + if (! get_dqt(cinfo)) + return JPEG_SUSPENDED; + break; + + case M_DRI: + if (! get_dri(cinfo)) + return JPEG_SUSPENDED; + break; + + case M_APP0: + case M_APP1: + case M_APP2: + case M_APP3: + case M_APP4: + case M_APP5: + case M_APP6: + case M_APP7: + case M_APP8: + case M_APP9: + case M_APP10: + case M_APP11: + case M_APP12: + case M_APP13: + case M_APP14: + case M_APP15: + if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[ + cinfo->unread_marker - (int) M_APP0]) (cinfo)) + return JPEG_SUSPENDED; + break; + + case M_COM: + if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) + return JPEG_SUSPENDED; + break; + + case M_RST0: /* these are all parameterless */ + case M_RST1: + case M_RST2: + case M_RST3: + case M_RST4: + case M_RST5: + case M_RST6: + case M_RST7: + case M_TEM: + TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker); + break; + + case M_DNL: /* Ignore DNL ... perhaps the wrong thing */ + if (! skip_variable(cinfo)) + return JPEG_SUSPENDED; + break; + + default: /* must be DHP, EXP, JPGn, or RESn */ + /* For now, we treat the reserved markers as fatal errors since they are + * likely to be used to signal incompatible JPEG Part 3 extensions. + * Once the JPEG 3 version-number marker is well defined, this code + * ought to change! + */ + ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); + break; + } + /* Successfully processed marker, so reset state variable */ + cinfo->unread_marker = 0; + } /* end loop */ +} + + +/* + * Read a restart marker, which is expected to appear next in the datastream; + * if the marker is not there, take appropriate recovery action. + * Returns FALSE if suspension is required. + * + * This is called by the entropy decoder after it has read an appropriate + * number of MCUs. cinfo->unread_marker may be nonzero if the entropy decoder + * has already read a marker from the data source. Under normal conditions + * cinfo->unread_marker will be reset to 0 before returning; if not reset, + * it holds a marker which the decoder will be unable to read past. + */ + +METHODDEF(boolean) +read_restart_marker (j_decompress_ptr cinfo) +{ + /* Obtain a marker unless we already did. */ + /* Note that next_marker will complain if it skips any data. */ + if (cinfo->unread_marker == 0) { + if (! next_marker(cinfo)) + return FALSE; + } + + if (cinfo->unread_marker == + ((int) M_RST0 + cinfo->marker->next_restart_num)) { + /* Normal case --- swallow the marker and let entropy decoder continue */ + TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num); + cinfo->unread_marker = 0; + } else { + /* Uh-oh, the restart markers have been messed up. */ + /* Let the data source manager determine how to resync. */ + if (! (*cinfo->src->resync_to_restart) (cinfo, + cinfo->marker->next_restart_num)) + return FALSE; + } + + /* Update next-restart state */ + cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7; + + return TRUE; +} + + +/* + * This is the default resync_to_restart method for data source managers + * to use if they don't have any better approach. Some data source managers + * may be able to back up, or may have additional knowledge about the data + * which permits a more intelligent recovery strategy; such managers would + * presumably supply their own resync method. + * + * read_restart_marker calls resync_to_restart if it finds a marker other than + * the restart marker it was expecting. (This code is *not* used unless + * a nonzero restart interval has been declared.) cinfo->unread_marker is + * the marker code actually found (might be anything, except 0 or FF). + * The desired restart marker number (0..7) is passed as a parameter. + * This routine is supposed to apply whatever error recovery strategy seems + * appropriate in order to position the input stream to the next data segment. + * Note that cinfo->unread_marker is treated as a marker appearing before + * the current data-source input point; usually it should be reset to zero + * before returning. + * Returns FALSE if suspension is required. + * + * This implementation is substantially constrained by wanting to treat the + * input as a data stream; this means we can't back up. Therefore, we have + * only the following actions to work with: + * 1. Simply discard the marker and let the entropy decoder resume at next + * byte of file. + * 2. Read forward until we find another marker, discarding intervening + * data. (In theory we could look ahead within the current bufferload, + * without having to discard data if we don't find the desired marker. + * This idea is not implemented here, in part because it makes behavior + * dependent on buffer size and chance buffer-boundary positions.) + * 3. Leave the marker unread (by failing to zero cinfo->unread_marker). + * This will cause the entropy decoder to process an empty data segment, + * inserting dummy zeroes, and then we will reprocess the marker. + * + * #2 is appropriate if we think the desired marker lies ahead, while #3 is + * appropriate if the found marker is a future restart marker (indicating + * that we have missed the desired restart marker, probably because it got + * corrupted). + * We apply #2 or #3 if the found marker is a restart marker no more than + * two counts behind or ahead of the expected one. We also apply #2 if the + * found marker is not a legal JPEG marker code (it's certainly bogus data). + * If the found marker is a restart marker more than 2 counts away, we do #1 + * (too much risk that the marker is erroneous; with luck we will be able to + * resync at some future point). + * For any valid non-restart JPEG marker, we apply #3. This keeps us from + * overrunning the end of a scan. An implementation limited to single-scan + * files might find it better to apply #2 for markers other than EOI, since + * any other marker would have to be bogus data in that case. + */ + +GLOBAL(boolean) +jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) +{ + int marker = cinfo->unread_marker; + int action = 1; + + /* Always put up a warning. */ + WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); + + /* Outer loop handles repeated decision after scanning forward. */ + for (;;) { + if (marker < (int) M_SOF0) + action = 2; /* invalid marker */ + else if (marker < (int) M_RST0 || marker > (int) M_RST7) + action = 3; /* valid non-restart marker */ + else { + if (marker == ((int) M_RST0 + ((desired+1) & 7)) || + marker == ((int) M_RST0 + ((desired+2) & 7))) + action = 3; /* one of the next two expected restarts */ + else if (marker == ((int) M_RST0 + ((desired-1) & 7)) || + marker == ((int) M_RST0 + ((desired-2) & 7))) + action = 2; /* a prior restart, so advance */ + else + action = 1; /* desired restart or too far away */ + } + TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action); + switch (action) { + case 1: + /* Discard marker and let entropy decoder resume processing. */ + cinfo->unread_marker = 0; + return TRUE; + case 2: + /* Scan to the next marker, and repeat the decision loop. */ + if (! next_marker(cinfo)) + return FALSE; + marker = cinfo->unread_marker; + break; + case 3: + /* Return without advancing past this marker. */ + /* Entropy decoder will be forced to process an empty segment. */ + return TRUE; + } + } /* end loop */ +} + + +/* + * Reset marker processing state to begin a fresh datastream. + */ + +METHODDEF(void) +reset_marker_reader (j_decompress_ptr cinfo) +{ + my_marker_ptr marker = (my_marker_ptr) cinfo->marker; + + cinfo->comp_info = NULL; /* until allocated by get_sof */ + cinfo->input_scan_number = 0; /* no SOS seen yet */ + cinfo->unread_marker = 0; /* no pending marker */ + marker->pub.saw_SOI = FALSE; /* set internal state too */ + marker->pub.saw_SOF = FALSE; + marker->pub.discarded_bytes = 0; + marker->cur_marker = NULL; +} + + +/* + * Initialize the marker reader module. + * This is called only once, when the decompression object is created. + */ + +GLOBAL(void) +jinit_marker_reader (j_decompress_ptr cinfo) +{ + my_marker_ptr marker; + int i; + + /* Create subobject in permanent pool */ + marker = (my_marker_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, + SIZEOF(my_marker_reader)); + cinfo->marker = (struct jpeg_marker_reader *) marker; + /* Initialize public method pointers */ + marker->pub.reset_marker_reader = reset_marker_reader; + marker->pub.read_markers = read_markers; + marker->pub.read_restart_marker = read_restart_marker; + /* Initialize COM/APPn processing. + * By default, we examine and then discard APP0 and APP14, + * but simply discard COM and all other APPn. + */ + marker->process_COM = skip_variable; + marker->length_limit_COM = 0; + for (i = 0; i < 16; i++) { + marker->process_APPn[i] = skip_variable; + marker->length_limit_APPn[i] = 0; + } + marker->process_APPn[0] = get_interesting_appn; + marker->process_APPn[14] = get_interesting_appn; + /* Reset marker processing state */ + reset_marker_reader(cinfo); +} + + +/* + * Control saving of COM and APPn markers into marker_list. + */ + +#ifdef SAVE_MARKERS_SUPPORTED + +GLOBAL(void) +jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit) +{ + my_marker_ptr marker = (my_marker_ptr) cinfo->marker; + long maxlength; + jpeg_marker_parser_method processor; + + /* Length limit mustn't be larger than what we can allocate + * (should only be a concern in a 16-bit environment). + */ + maxlength = cinfo->mem->max_alloc_chunk - SIZEOF(struct jpeg_marker_struct); + if (((long) length_limit) > maxlength) + length_limit = (unsigned int) maxlength; + + /* Choose processor routine to use. + * APP0/APP14 have special requirements. + */ + if (length_limit) { + processor = save_marker; + /* If saving APP0/APP14, save at least enough for our internal use. */ + if (marker_code == (int) M_APP0 && length_limit < APP0_DATA_LEN) + length_limit = APP0_DATA_LEN; + else if (marker_code == (int) M_APP14 && length_limit < APP14_DATA_LEN) + length_limit = APP14_DATA_LEN; + } else { + processor = skip_variable; + /* If discarding APP0/APP14, use our regular on-the-fly processor. */ + if (marker_code == (int) M_APP0 || marker_code == (int) M_APP14) + processor = get_interesting_appn; + } + + if (marker_code == (int) M_COM) { + marker->process_COM = processor; + marker->length_limit_COM = length_limit; + } else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) { + marker->process_APPn[marker_code - (int) M_APP0] = processor; + marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit; + } else + ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); +} + +#endif /* SAVE_MARKERS_SUPPORTED */ + + +/* + * Install a special processing method for COM or APPn markers. + */ + +GLOBAL(void) +jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, + jpeg_marker_parser_method routine) +{ + my_marker_ptr marker = (my_marker_ptr) cinfo->marker; + + if (marker_code == (int) M_COM) + marker->process_COM = routine; + else if (marker_code >= (int) M_APP0 && marker_code <= (int) M_APP15) + marker->process_APPn[marker_code - (int) M_APP0] = routine; + else + ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); +} diff --git a/src/SFML/Graphics/libjpeg/jdmaster.c b/src/SFML/Graphics/libjpeg/jdmaster.c new file mode 100644 index 00000000..eda4b3fa --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdmaster.c @@ -0,0 +1,557 @@ +/* + * jdmaster.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains master control logic for the JPEG decompressor. + * These routines are concerned with selecting the modules to be executed + * and with determining the number of passes and the work to be done in each + * pass. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Private state */ + +typedef struct { + struct jpeg_decomp_master pub; /* public fields */ + + int pass_number; /* # of passes completed */ + + boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */ + + /* Saved references to initialized quantizer modules, + * in case we need to switch modes. + */ + struct jpeg_color_quantizer * quantizer_1pass; + struct jpeg_color_quantizer * quantizer_2pass; +} my_decomp_master; + +typedef my_decomp_master * my_master_ptr; + + +/* + * Determine whether merged upsample/color conversion should be used. + * CRUCIAL: this must match the actual capabilities of jdmerge.c! + */ + +LOCAL(boolean) +use_merged_upsample (j_decompress_ptr cinfo) +{ +#ifdef UPSAMPLE_MERGING_SUPPORTED + /* Merging is the equivalent of plain box-filter upsampling */ + if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) + return FALSE; + /* jdmerge.c only supports YCC=>RGB color conversion */ + if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || + cinfo->out_color_space != JCS_RGB || + cinfo->out_color_components != RGB_PIXELSIZE) + return FALSE; + /* and it only handles 2h1v or 2h2v sampling ratios */ + if (cinfo->comp_info[0].h_samp_factor != 2 || + cinfo->comp_info[1].h_samp_factor != 1 || + cinfo->comp_info[2].h_samp_factor != 1 || + cinfo->comp_info[0].v_samp_factor > 2 || + cinfo->comp_info[1].v_samp_factor != 1 || + cinfo->comp_info[2].v_samp_factor != 1) + return FALSE; + /* furthermore, it doesn't work if we've scaled the IDCTs differently */ + if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size || + cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size || + cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size) + return FALSE; + /* ??? also need to test for upsample-time rescaling, when & if supported */ + return TRUE; /* by golly, it'll work... */ +#else + return FALSE; +#endif +} + + +/* + * Compute output image dimensions and related values. + * NOTE: this is exported for possible use by application. + * Hence it mustn't do anything that can't be done twice. + * Also note that it may be called before the master module is initialized! + */ + +GLOBAL(void) +jpeg_calc_output_dimensions (j_decompress_ptr cinfo) +/* Do computations that are needed before master selection phase */ +{ +#ifdef IDCT_SCALING_SUPPORTED + int ci; + jpeg_component_info *compptr; +#endif + + /* Prevent application from calling me at wrong times */ + if (cinfo->global_state != DSTATE_READY) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + +#ifdef IDCT_SCALING_SUPPORTED + + /* Compute actual output image dimensions and DCT scaling choices. */ + if (cinfo->scale_num * 8 <= cinfo->scale_denom) { + /* Provide 1/8 scaling */ + cinfo->output_width = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width, 8L); + cinfo->output_height = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, 8L); + cinfo->min_DCT_scaled_size = 1; + } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) { + /* Provide 1/4 scaling */ + cinfo->output_width = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width, 4L); + cinfo->output_height = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, 4L); + cinfo->min_DCT_scaled_size = 2; + } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) { + /* Provide 1/2 scaling */ + cinfo->output_width = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width, 2L); + cinfo->output_height = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height, 2L); + cinfo->min_DCT_scaled_size = 4; + } else { + /* Provide 1/1 scaling */ + cinfo->output_width = cinfo->image_width; + cinfo->output_height = cinfo->image_height; + cinfo->min_DCT_scaled_size = DCTSIZE; + } + /* In selecting the actual DCT scaling for each component, we try to + * scale up the chroma components via IDCT scaling rather than upsampling. + * This saves time if the upsampler gets to use 1:1 scaling. + * Note this code assumes that the supported DCT scalings are powers of 2. + */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + int ssize = cinfo->min_DCT_scaled_size; + while (ssize < DCTSIZE && + (compptr->h_samp_factor * ssize * 2 <= + cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) && + (compptr->v_samp_factor * ssize * 2 <= + cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) { + ssize = ssize * 2; + } + compptr->DCT_scaled_size = ssize; + } + + /* Recompute downsampled dimensions of components; + * application needs to know these if using raw downsampled data. + */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Size in samples, after IDCT scaling */ + compptr->downsampled_width = (JDIMENSION) + jdiv_round_up((long) cinfo->image_width * + (long) (compptr->h_samp_factor * compptr->DCT_scaled_size), + (long) (cinfo->max_h_samp_factor * DCTSIZE)); + compptr->downsampled_height = (JDIMENSION) + jdiv_round_up((long) cinfo->image_height * + (long) (compptr->v_samp_factor * compptr->DCT_scaled_size), + (long) (cinfo->max_v_samp_factor * DCTSIZE)); + } + +#else /* !IDCT_SCALING_SUPPORTED */ + + /* Hardwire it to "no scaling" */ + cinfo->output_width = cinfo->image_width; + cinfo->output_height = cinfo->image_height; + /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE, + * and has computed unscaled downsampled_width and downsampled_height. + */ + +#endif /* IDCT_SCALING_SUPPORTED */ + + /* Report number of components in selected colorspace. */ + /* Probably this should be in the color conversion module... */ + switch (cinfo->out_color_space) { + case JCS_GRAYSCALE: + cinfo->out_color_components = 1; + break; + case JCS_RGB: +#if RGB_PIXELSIZE != 3 + cinfo->out_color_components = RGB_PIXELSIZE; + break; +#endif /* else share code with YCbCr */ + case JCS_YCbCr: + cinfo->out_color_components = 3; + break; + case JCS_CMYK: + case JCS_YCCK: + cinfo->out_color_components = 4; + break; + default: /* else must be same colorspace as in file */ + cinfo->out_color_components = cinfo->num_components; + break; + } + cinfo->output_components = (cinfo->quantize_colors ? 1 : + cinfo->out_color_components); + + /* See if upsampler will want to emit more than one row at a time */ + if (use_merged_upsample(cinfo)) + cinfo->rec_outbuf_height = cinfo->max_v_samp_factor; + else + cinfo->rec_outbuf_height = 1; +} + + +/* + * Several decompression processes need to range-limit values to the range + * 0..MAXJSAMPLE; the input value may fall somewhat outside this range + * due to noise introduced by quantization, roundoff error, etc. These + * processes are inner loops and need to be as fast as possible. On most + * machines, particularly CPUs with pipelines or instruction prefetch, + * a (subscript-check-less) C table lookup + * x = sample_range_limit[x]; + * is faster than explicit tests + * if (x < 0) x = 0; + * else if (x > MAXJSAMPLE) x = MAXJSAMPLE; + * These processes all use a common table prepared by the routine below. + * + * For most steps we can mathematically guarantee that the initial value + * of x is within MAXJSAMPLE+1 of the legal range, so a table running from + * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial + * limiting step (just after the IDCT), a wildly out-of-range value is + * possible if the input data is corrupt. To avoid any chance of indexing + * off the end of memory and getting a bad-pointer trap, we perform the + * post-IDCT limiting thus: + * x = range_limit[x & MASK]; + * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit + * samples. Under normal circumstances this is more than enough range and + * a correct output will be generated; with bogus input data the mask will + * cause wraparound, and we will safely generate a bogus-but-in-range output. + * For the post-IDCT step, we want to convert the data from signed to unsigned + * representation by adding CENTERJSAMPLE at the same time that we limit it. + * So the post-IDCT limiting table ends up looking like this: + * CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE, + * MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), + * 0 (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), + * 0,1,...,CENTERJSAMPLE-1 + * Negative inputs select values from the upper half of the table after + * masking. + * + * We can save some space by overlapping the start of the post-IDCT table + * with the simpler range limiting table. The post-IDCT table begins at + * sample_range_limit + CENTERJSAMPLE. + * + * Note that the table is allocated in near data space on PCs; it's small + * enough and used often enough to justify this. + */ + +LOCAL(void) +prepare_range_limit_table (j_decompress_ptr cinfo) +/* Allocate and fill in the sample_range_limit table */ +{ + JSAMPLE * table; + int i; + + table = (JSAMPLE *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); + table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ + cinfo->sample_range_limit = table; + /* First segment of "simple" table: limit[x] = 0 for x < 0 */ + MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); + /* Main part of "simple" table: limit[x] = x */ + for (i = 0; i <= MAXJSAMPLE; i++) + table[i] = (JSAMPLE) i; + table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ + /* End of simple table, rest of first half of post-IDCT table */ + for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) + table[i] = MAXJSAMPLE; + /* Second half of post-IDCT table */ + MEMZERO(table + (2 * (MAXJSAMPLE+1)), + (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); + MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), + cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); +} + + +/* + * Master selection of decompression modules. + * This is done once at jpeg_start_decompress time. We determine + * which modules will be used and give them appropriate initialization calls. + * We also initialize the decompressor input side to begin consuming data. + * + * Since jpeg_read_header has finished, we know what is in the SOF + * and (first) SOS markers. We also have all the application parameter + * settings. + */ + +LOCAL(void) +master_selection (j_decompress_ptr cinfo) +{ + my_master_ptr master = (my_master_ptr) cinfo->master; + boolean use_c_buffer; + long samplesperrow; + JDIMENSION jd_samplesperrow; + + /* Initialize dimensions and other stuff */ + jpeg_calc_output_dimensions(cinfo); + prepare_range_limit_table(cinfo); + + /* Width of an output scanline must be representable as JDIMENSION. */ + samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; + jd_samplesperrow = (JDIMENSION) samplesperrow; + if ((long) jd_samplesperrow != samplesperrow) + ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); + + /* Initialize my private state */ + master->pass_number = 0; + master->using_merged_upsample = use_merged_upsample(cinfo); + + /* Color quantizer selection */ + master->quantizer_1pass = NULL; + master->quantizer_2pass = NULL; + /* No mode changes if not using buffered-image mode. */ + if (! cinfo->quantize_colors || ! cinfo->buffered_image) { + cinfo->enable_1pass_quant = FALSE; + cinfo->enable_external_quant = FALSE; + cinfo->enable_2pass_quant = FALSE; + } + if (cinfo->quantize_colors) { + if (cinfo->raw_data_out) + ERREXIT(cinfo, JERR_NOTIMPL); + /* 2-pass quantizer only works in 3-component color space. */ + if (cinfo->out_color_components != 3) { + cinfo->enable_1pass_quant = TRUE; + cinfo->enable_external_quant = FALSE; + cinfo->enable_2pass_quant = FALSE; + cinfo->colormap = NULL; + } else if (cinfo->colormap != NULL) { + cinfo->enable_external_quant = TRUE; + } else if (cinfo->two_pass_quantize) { + cinfo->enable_2pass_quant = TRUE; + } else { + cinfo->enable_1pass_quant = TRUE; + } + + if (cinfo->enable_1pass_quant) { +#ifdef QUANT_1PASS_SUPPORTED + jinit_1pass_quantizer(cinfo); + master->quantizer_1pass = cinfo->cquantize; +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } + + /* We use the 2-pass code to map to external colormaps. */ + if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) { +#ifdef QUANT_2PASS_SUPPORTED + jinit_2pass_quantizer(cinfo); + master->quantizer_2pass = cinfo->cquantize; +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } + /* If both quantizers are initialized, the 2-pass one is left active; + * this is necessary for starting with quantization to an external map. + */ + } + + /* Post-processing: in particular, color conversion first */ + if (! cinfo->raw_data_out) { + if (master->using_merged_upsample) { +#ifdef UPSAMPLE_MERGING_SUPPORTED + jinit_merged_upsampler(cinfo); /* does color conversion too */ +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else { + jinit_color_deconverter(cinfo); + jinit_upsampler(cinfo); + } + jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant); + } + /* Inverse DCT */ + jinit_inverse_dct(cinfo); + /* Entropy decoding: either Huffman or arithmetic coding. */ + if (cinfo->arith_code) { + ERREXIT(cinfo, JERR_ARITH_NOTIMPL); + } else { + if (cinfo->progressive_mode) { +#ifdef D_PROGRESSIVE_SUPPORTED + jinit_phuff_decoder(cinfo); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else + jinit_huff_decoder(cinfo); + } + + /* Initialize principal buffer controllers. */ + use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image; + jinit_d_coef_controller(cinfo, use_c_buffer); + + if (! cinfo->raw_data_out) + jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */); + + /* We can now tell the memory manager to allocate virtual arrays. */ + (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); + + /* Initialize input side of decompressor to consume first scan. */ + (*cinfo->inputctl->start_input_pass) (cinfo); + +#ifdef D_MULTISCAN_FILES_SUPPORTED + /* If jpeg_start_decompress will read the whole file, initialize + * progress monitoring appropriately. The input step is counted + * as one pass. + */ + if (cinfo->progress != NULL && ! cinfo->buffered_image && + cinfo->inputctl->has_multiple_scans) { + int nscans; + /* Estimate number of scans to set pass_limit. */ + if (cinfo->progressive_mode) { + /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ + nscans = 2 + 3 * cinfo->num_components; + } else { + /* For a nonprogressive multiscan file, estimate 1 scan per component. */ + nscans = cinfo->num_components; + } + cinfo->progress->pass_counter = 0L; + cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; + cinfo->progress->completed_passes = 0; + cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2); + /* Count the input pass as done */ + master->pass_number++; + } +#endif /* D_MULTISCAN_FILES_SUPPORTED */ +} + + +/* + * Per-pass setup. + * This is called at the beginning of each output pass. We determine which + * modules will be active during this pass and give them appropriate + * start_pass calls. We also set is_dummy_pass to indicate whether this + * is a "real" output pass or a dummy pass for color quantization. + * (In the latter case, jdapistd.c will crank the pass to completion.) + */ + +METHODDEF(void) +prepare_for_output_pass (j_decompress_ptr cinfo) +{ + my_master_ptr master = (my_master_ptr) cinfo->master; + + if (master->pub.is_dummy_pass) { +#ifdef QUANT_2PASS_SUPPORTED + /* Final pass of 2-pass quantization */ + master->pub.is_dummy_pass = FALSE; + (*cinfo->cquantize->start_pass) (cinfo, FALSE); + (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST); + (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif /* QUANT_2PASS_SUPPORTED */ + } else { + if (cinfo->quantize_colors && cinfo->colormap == NULL) { + /* Select new quantization method */ + if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) { + cinfo->cquantize = master->quantizer_2pass; + master->pub.is_dummy_pass = TRUE; + } else if (cinfo->enable_1pass_quant) { + cinfo->cquantize = master->quantizer_1pass; + } else { + ERREXIT(cinfo, JERR_MODE_CHANGE); + } + } + (*cinfo->idct->start_pass) (cinfo); + (*cinfo->coef->start_output_pass) (cinfo); + if (! cinfo->raw_data_out) { + if (! master->using_merged_upsample) + (*cinfo->cconvert->start_pass) (cinfo); + (*cinfo->upsample->start_pass) (cinfo); + if (cinfo->quantize_colors) + (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass); + (*cinfo->post->start_pass) (cinfo, + (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU)); + (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU); + } + } + + /* Set up progress monitor's pass info if present */ + if (cinfo->progress != NULL) { + cinfo->progress->completed_passes = master->pass_number; + cinfo->progress->total_passes = master->pass_number + + (master->pub.is_dummy_pass ? 2 : 1); + /* In buffered-image mode, we assume one more output pass if EOI not + * yet reached, but no more passes if EOI has been reached. + */ + if (cinfo->buffered_image && ! cinfo->inputctl->eoi_reached) { + cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1); + } + } +} + + +/* + * Finish up at end of an output pass. + */ + +METHODDEF(void) +finish_output_pass (j_decompress_ptr cinfo) +{ + my_master_ptr master = (my_master_ptr) cinfo->master; + + if (cinfo->quantize_colors) + (*cinfo->cquantize->finish_pass) (cinfo); + master->pass_number++; +} + + +#ifdef D_MULTISCAN_FILES_SUPPORTED + +/* + * Switch to a new external colormap between output passes. + */ + +GLOBAL(void) +jpeg_new_colormap (j_decompress_ptr cinfo) +{ + my_master_ptr master = (my_master_ptr) cinfo->master; + + /* Prevent application from calling me at wrong times */ + if (cinfo->global_state != DSTATE_BUFIMAGE) + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + + if (cinfo->quantize_colors && cinfo->enable_external_quant && + cinfo->colormap != NULL) { + /* Select 2-pass quantizer for external colormap use */ + cinfo->cquantize = master->quantizer_2pass; + /* Notify quantizer of colormap change */ + (*cinfo->cquantize->new_color_map) (cinfo); + master->pub.is_dummy_pass = FALSE; /* just in case */ + } else + ERREXIT(cinfo, JERR_MODE_CHANGE); +} + +#endif /* D_MULTISCAN_FILES_SUPPORTED */ + + +/* + * Initialize master decompression control and select active modules. + * This is performed at the start of jpeg_start_decompress. + */ + +GLOBAL(void) +jinit_master_decompress (j_decompress_ptr cinfo) +{ + my_master_ptr master; + + master = (my_master_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_decomp_master)); + cinfo->master = (struct jpeg_decomp_master *) master; + master->pub.prepare_for_output_pass = prepare_for_output_pass; + master->pub.finish_output_pass = finish_output_pass; + + master->pub.is_dummy_pass = FALSE; + + master_selection(cinfo); +} diff --git a/src/SFML/Graphics/libjpeg/jdmerge.c b/src/SFML/Graphics/libjpeg/jdmerge.c new file mode 100644 index 00000000..9e3a595d --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdmerge.c @@ -0,0 +1,400 @@ +/* + * jdmerge.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains code for merged upsampling/color conversion. + * + * This file combines functions from jdsample.c and jdcolor.c; + * read those files first to understand what's going on. + * + * When the chroma components are to be upsampled by simple replication + * (ie, box filtering), we can save some work in color conversion by + * calculating all the output pixels corresponding to a pair of chroma + * samples at one time. In the conversion equations + * R = Y + K1 * Cr + * G = Y + K2 * Cb + K3 * Cr + * B = Y + K4 * Cb + * only the Y term varies among the group of pixels corresponding to a pair + * of chroma samples, so the rest of the terms can be calculated just once. + * At typical sampling ratios, this eliminates half or three-quarters of the + * multiplications needed for color conversion. + * + * This file currently provides implementations for the following cases: + * YCbCr => RGB color conversion only. + * Sampling ratios of 2h1v or 2h2v. + * No scaling needed at upsample time. + * Corner-aligned (non-CCIR601) sampling alignment. + * Other special cases could be added, but in most applications these are + * the only common cases. (For uncommon cases we fall back on the more + * general code in jdsample.c and jdcolor.c.) + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + +#ifdef UPSAMPLE_MERGING_SUPPORTED + + +/* Private subobject */ + +typedef struct { + struct jpeg_upsampler pub; /* public fields */ + + /* Pointer to routine to do actual upsampling/conversion of one row group */ + JMETHOD(void, upmethod, (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf)); + + /* Private state for YCC->RGB conversion */ + int * Cr_r_tab; /* => table for Cr to R conversion */ + int * Cb_b_tab; /* => table for Cb to B conversion */ + INT32 * Cr_g_tab; /* => table for Cr to G conversion */ + INT32 * Cb_g_tab; /* => table for Cb to G conversion */ + + /* For 2:1 vertical sampling, we produce two output rows at a time. + * We need a "spare" row buffer to hold the second output row if the + * application provides just a one-row buffer; we also use the spare + * to discard the dummy last row if the image height is odd. + */ + JSAMPROW spare_row; + boolean spare_full; /* T if spare buffer is occupied */ + + JDIMENSION out_row_width; /* samples per output row */ + JDIMENSION rows_to_go; /* counts rows remaining in image */ +} my_upsampler; + +typedef my_upsampler * my_upsample_ptr; + +#define SCALEBITS 16 /* speediest right-shift on some machines */ +#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) +#define FIX(x) ((INT32) ((x) * (1L<RGB colorspace conversion. + * This is taken directly from jdcolor.c; see that file for more info. + */ + +LOCAL(void) +build_ycc_rgb_table (j_decompress_ptr cinfo) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + int i; + INT32 x; + SHIFT_TEMPS + + upsample->Cr_r_tab = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(int)); + upsample->Cb_b_tab = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(int)); + upsample->Cr_g_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(INT32)); + upsample->Cb_g_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(INT32)); + + for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { + /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ + /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ + /* Cr=>R value is nearest int to 1.40200 * x */ + upsample->Cr_r_tab[i] = (int) + RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS); + /* Cb=>B value is nearest int to 1.77200 * x */ + upsample->Cb_b_tab[i] = (int) + RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS); + /* Cr=>G value is scaled-up -0.71414 * x */ + upsample->Cr_g_tab[i] = (- FIX(0.71414)) * x; + /* Cb=>G value is scaled-up -0.34414 * x */ + /* We also add in ONE_HALF so that need not do it in inner loop */ + upsample->Cb_g_tab[i] = (- FIX(0.34414)) * x + ONE_HALF; + } +} + + +/* + * Initialize for an upsampling pass. + */ + +METHODDEF(void) +start_pass_merged_upsample (j_decompress_ptr cinfo) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + + /* Mark the spare buffer empty */ + upsample->spare_full = FALSE; + /* Initialize total-height counter for detecting bottom of image */ + upsample->rows_to_go = cinfo->output_height; +} + + +/* + * Control routine to do upsampling (and color conversion). + * + * The control routine just handles the row buffering considerations. + */ + +METHODDEF(void) +merged_2v_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +/* 2:1 vertical sampling case: may need a spare row. */ +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + JSAMPROW work_ptrs[2]; + JDIMENSION num_rows; /* number of rows returned to caller */ + + if (upsample->spare_full) { + /* If we have a spare row saved from a previous cycle, just return it. */ + jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, + 1, upsample->out_row_width); + num_rows = 1; + upsample->spare_full = FALSE; + } else { + /* Figure number of rows to return to caller. */ + num_rows = 2; + /* Not more than the distance to the end of the image. */ + if (num_rows > upsample->rows_to_go) + num_rows = upsample->rows_to_go; + /* And not more than what the client can accept: */ + out_rows_avail -= *out_row_ctr; + if (num_rows > out_rows_avail) + num_rows = out_rows_avail; + /* Create output pointer array for upsampler. */ + work_ptrs[0] = output_buf[*out_row_ctr]; + if (num_rows > 1) { + work_ptrs[1] = output_buf[*out_row_ctr + 1]; + } else { + work_ptrs[1] = upsample->spare_row; + upsample->spare_full = TRUE; + } + /* Now do the upsampling. */ + (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, work_ptrs); + } + + /* Adjust counts */ + *out_row_ctr += num_rows; + upsample->rows_to_go -= num_rows; + /* When the buffer is emptied, declare this input row group consumed */ + if (! upsample->spare_full) + (*in_row_group_ctr)++; +} + + +METHODDEF(void) +merged_1v_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +/* 1:1 vertical sampling case: much easier, never need a spare row. */ +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + + /* Just do the upsampling. */ + (*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr, + output_buf + *out_row_ctr); + /* Adjust counts */ + (*out_row_ctr)++; + (*in_row_group_ctr)++; +} + + +/* + * These are the routines invoked by the control routines to do + * the actual upsampling/conversion. One row group is processed per call. + * + * Note: since we may be writing directly into application-supplied buffers, + * we have to be honest about the output width; we can't assume the buffer + * has been rounded up to an even width. + */ + + +/* + * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. + */ + +METHODDEF(void) +h2v1_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr; + JSAMPROW inptr0, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + SHIFT_TEMPS + + inptr0 = input_buf[0][in_row_group_ctr]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr = output_buf[0]; + /* Loop for each pair of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + /* Fetch 2 Y values and emit 2 pixels */ + y = GETJSAMPLE(*inptr0++); + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr0++); + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr += RGB_PIXELSIZE; + } + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = GETJSAMPLE(*inptr0); + outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_GREEN] = range_limit[y + cgreen]; + outptr[RGB_BLUE] = range_limit[y + cblue]; + } +} + + +/* + * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. + */ + +METHODDEF(void) +h2v2_merged_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, + JSAMPARRAY output_buf) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + register int y, cred, cgreen, cblue; + int cb, cr; + register JSAMPROW outptr0, outptr1; + JSAMPROW inptr00, inptr01, inptr1, inptr2; + JDIMENSION col; + /* copy these pointers into registers if possible */ + register JSAMPLE * range_limit = cinfo->sample_range_limit; + int * Crrtab = upsample->Cr_r_tab; + int * Cbbtab = upsample->Cb_b_tab; + INT32 * Crgtab = upsample->Cr_g_tab; + INT32 * Cbgtab = upsample->Cb_g_tab; + SHIFT_TEMPS + + inptr00 = input_buf[0][in_row_group_ctr*2]; + inptr01 = input_buf[0][in_row_group_ctr*2 + 1]; + inptr1 = input_buf[1][in_row_group_ctr]; + inptr2 = input_buf[2][in_row_group_ctr]; + outptr0 = output_buf[0]; + outptr1 = output_buf[1]; + /* Loop for each group of output pixels */ + for (col = cinfo->output_width >> 1; col > 0; col--) { + /* Do the chroma part of the calculation */ + cb = GETJSAMPLE(*inptr1++); + cr = GETJSAMPLE(*inptr2++); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + /* Fetch 4 Y values and emit 4 pixels */ + y = GETJSAMPLE(*inptr00++); + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0 += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr00++); + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0 += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr01++); + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1 += RGB_PIXELSIZE; + y = GETJSAMPLE(*inptr01++); + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1 += RGB_PIXELSIZE; + } + /* If image width is odd, do the last output column separately */ + if (cinfo->output_width & 1) { + cb = GETJSAMPLE(*inptr1); + cr = GETJSAMPLE(*inptr2); + cred = Crrtab[cr]; + cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); + cblue = Cbbtab[cb]; + y = GETJSAMPLE(*inptr00); + outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_GREEN] = range_limit[y + cgreen]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; + y = GETJSAMPLE(*inptr01); + outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_GREEN] = range_limit[y + cgreen]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; + } +} + + +/* + * Module initialization routine for merged upsampling/color conversion. + * + * NB: this is called under the conditions determined by use_merged_upsample() + * in jdmaster.c. That routine MUST correspond to the actual capabilities + * of this module; no safety checks are made here. + */ + +GLOBAL(void) +jinit_merged_upsampler (j_decompress_ptr cinfo) +{ + my_upsample_ptr upsample; + + upsample = (my_upsample_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_upsampler)); + cinfo->upsample = (struct jpeg_upsampler *) upsample; + upsample->pub.start_pass = start_pass_merged_upsample; + upsample->pub.need_context_rows = FALSE; + + upsample->out_row_width = cinfo->output_width * cinfo->out_color_components; + + if (cinfo->max_v_samp_factor == 2) { + upsample->pub.upsample = merged_2v_upsample; + upsample->upmethod = h2v2_merged_upsample; + /* Allocate a spare row buffer */ + upsample->spare_row = (JSAMPROW) + (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (size_t) (upsample->out_row_width * SIZEOF(JSAMPLE))); + } else { + upsample->pub.upsample = merged_1v_upsample; + upsample->upmethod = h2v1_merged_upsample; + /* No spare row needed */ + upsample->spare_row = NULL; + } + + build_ycc_rgb_table(cinfo); +} + +#endif /* UPSAMPLE_MERGING_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jdphuff.c b/src/SFML/Graphics/libjpeg/jdphuff.c new file mode 100644 index 00000000..24047432 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdphuff.c @@ -0,0 +1,668 @@ +/* + * jdphuff.c + * + * Copyright (C) 1995-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains Huffman entropy decoding routines for progressive JPEG. + * + * Much of the complexity here has to do with supporting input suspension. + * If the data source module demands suspension, we want to be able to back + * up to the start of the current MCU. To do this, we copy state variables + * into local working storage, and update them back to the permanent + * storage only upon successful completion of an MCU. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdhuff.h" /* Declarations shared with jdhuff.c */ + + +#ifdef D_PROGRESSIVE_SUPPORTED + +/* + * Expanded entropy decoder object for progressive Huffman decoding. + * + * The savable_state subrecord contains fields that change within an MCU, + * but must not be updated permanently until we complete the MCU. + */ + +typedef struct { + unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ + int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ +} savable_state; + +/* This macro is to work around compilers with missing or broken + * structure assignment. You'll need to fix this code if you have + * such a compiler and you change MAX_COMPS_IN_SCAN. + */ + +#ifndef NO_STRUCT_ASSIGN +#define ASSIGN_STATE(dest,src) ((dest) = (src)) +#else +#if MAX_COMPS_IN_SCAN == 4 +#define ASSIGN_STATE(dest,src) \ + ((dest).EOBRUN = (src).EOBRUN, \ + (dest).last_dc_val[0] = (src).last_dc_val[0], \ + (dest).last_dc_val[1] = (src).last_dc_val[1], \ + (dest).last_dc_val[2] = (src).last_dc_val[2], \ + (dest).last_dc_val[3] = (src).last_dc_val[3]) +#endif +#endif + + +typedef struct { + struct jpeg_entropy_decoder pub; /* public fields */ + + /* These fields are loaded into local variables at start of each MCU. + * In case of suspension, we exit WITHOUT updating them. + */ + bitread_perm_state bitstate; /* Bit buffer at start of MCU */ + savable_state saved; /* Other state at start of MCU */ + + /* These fields are NOT loaded into local working state. */ + unsigned int restarts_to_go; /* MCUs left in this restart interval */ + + /* Pointers to derived tables (these workspaces have image lifespan) */ + d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]; + + d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */ +} phuff_entropy_decoder; + +typedef phuff_entropy_decoder * phuff_entropy_ptr; + +/* Forward declarations */ +METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); +METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); + + +/* + * Initialize for a Huffman-compressed scan. + */ + +METHODDEF(void) +start_pass_phuff_decoder (j_decompress_ptr cinfo) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + boolean is_DC_band, bad; + int ci, coefi, tbl; + int *coef_bit_ptr; + jpeg_component_info * compptr; + + is_DC_band = (cinfo->Ss == 0); + + /* Validate scan parameters */ + bad = FALSE; + if (is_DC_band) { + if (cinfo->Se != 0) + bad = TRUE; + } else { + /* need not check Ss/Se < 0 since they came from unsigned bytes */ + if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2) + bad = TRUE; + /* AC scans may have only one component */ + if (cinfo->comps_in_scan != 1) + bad = TRUE; + } + if (cinfo->Ah != 0) { + /* Successive approximation refinement scan: must have Al = Ah-1. */ + if (cinfo->Al != cinfo->Ah-1) + bad = TRUE; + } + if (cinfo->Al > 13) /* need not check for < 0 */ + bad = TRUE; + /* Arguably the maximum Al value should be less than 13 for 8-bit precision, + * but the spec doesn't say so, and we try to be liberal about what we + * accept. Note: large Al values could result in out-of-range DC + * coefficients during early scans, leading to bizarre displays due to + * overflows in the IDCT math. But we won't crash. + */ + if (bad) + ERREXIT4(cinfo, JERR_BAD_PROGRESSION, + cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al); + /* Update progression status, and verify that scan order is legal. + * Note that inter-scan inconsistencies are treated as warnings + * not fatal errors ... not clear if this is right way to behave. + */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + int cindex = cinfo->cur_comp_info[ci]->component_index; + coef_bit_ptr = & cinfo->coef_bits[cindex][0]; + if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */ + WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0); + for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) { + int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi]; + if (cinfo->Ah != expected) + WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi); + coef_bit_ptr[coefi] = cinfo->Al; + } + } + + /* Select MCU decoding routine */ + if (cinfo->Ah == 0) { + if (is_DC_band) + entropy->pub.decode_mcu = decode_mcu_DC_first; + else + entropy->pub.decode_mcu = decode_mcu_AC_first; + } else { + if (is_DC_band) + entropy->pub.decode_mcu = decode_mcu_DC_refine; + else + entropy->pub.decode_mcu = decode_mcu_AC_refine; + } + + for (ci = 0; ci < cinfo->comps_in_scan; ci++) { + compptr = cinfo->cur_comp_info[ci]; + /* Make sure requested tables are present, and compute derived tables. + * We may build same derived table more than once, but it's not expensive. + */ + if (is_DC_band) { + if (cinfo->Ah == 0) { /* DC refinement needs no table */ + tbl = compptr->dc_tbl_no; + jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, + & entropy->derived_tbls[tbl]); + } + } else { + tbl = compptr->ac_tbl_no; + jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, + & entropy->derived_tbls[tbl]); + /* remember the single active table */ + entropy->ac_derived_tbl = entropy->derived_tbls[tbl]; + } + /* Initialize DC predictions to 0 */ + entropy->saved.last_dc_val[ci] = 0; + } + + /* Initialize bitread state variables */ + entropy->bitstate.bits_left = 0; + entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */ + entropy->pub.insufficient_data = FALSE; + + /* Initialize private state variables */ + entropy->saved.EOBRUN = 0; + + /* Initialize restart counter */ + entropy->restarts_to_go = cinfo->restart_interval; +} + + +/* + * Figure F.12: extend sign bit. + * On some machines, a shift and add will be faster than a table lookup. + */ + +#ifdef AVOID_TABLES + +#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) + +#else + +#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) + +static const int extend_test[16] = /* entry n is 2**(n-1) */ + { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, + 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; + +static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ + { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, + ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, + ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, + ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; + +#endif /* AVOID_TABLES */ + + +/* + * Check for a restart marker & resynchronize decoder. + * Returns FALSE if must suspend. + */ + +LOCAL(boolean) +process_restart (j_decompress_ptr cinfo) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + int ci; + + /* Throw away any unused bits remaining in bit buffer; */ + /* include any full bytes in next_marker's count of discarded bytes */ + cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8; + entropy->bitstate.bits_left = 0; + + /* Advance past the RSTn marker */ + if (! (*cinfo->marker->read_restart_marker) (cinfo)) + return FALSE; + + /* Re-initialize DC predictions to 0 */ + for (ci = 0; ci < cinfo->comps_in_scan; ci++) + entropy->saved.last_dc_val[ci] = 0; + /* Re-init EOB run count, too */ + entropy->saved.EOBRUN = 0; + + /* Reset restart counter */ + entropy->restarts_to_go = cinfo->restart_interval; + + /* Reset out-of-data flag, unless read_restart_marker left us smack up + * against a marker. In that case we will end up treating the next data + * segment as empty, and we can avoid producing bogus output pixels by + * leaving the flag set. + */ + if (cinfo->unread_marker == 0) + entropy->pub.insufficient_data = FALSE; + + return TRUE; +} + + +/* + * Huffman MCU decoding. + * Each of these routines decodes and returns one MCU's worth of + * Huffman-compressed coefficients. + * The coefficients are reordered from zigzag order into natural array order, + * but are not dequantized. + * + * The i'th block of the MCU is stored into the block pointed to by + * MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER. + * + * We return FALSE if data source requested suspension. In that case no + * changes have been made to permanent state. (Exception: some output + * coefficients may already have been assigned. This is harmless for + * spectral selection, since we'll just re-assign them on the next call. + * Successive approximation AC refinement has to be more careful, however.) + */ + +/* + * MCU decoding for DC initial scan (either spectral selection, + * or first pass of successive approximation). + */ + +METHODDEF(boolean) +decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + int Al = cinfo->Al; + register int s, r; + int blkn, ci; + JBLOCKROW block; + BITREAD_STATE_VARS; + savable_state state; + d_derived_tbl * tbl; + jpeg_component_info * compptr; + + /* Process restart marker if needed; may have to suspend */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) + if (! process_restart(cinfo)) + return FALSE; + } + + /* If we've run out of data, just leave the MCU set to zeroes. + * This way, we return uniform gray for the remainder of the segment. + */ + if (! entropy->pub.insufficient_data) { + + /* Load up working state */ + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(state, entropy->saved); + + /* Outer loop handles each block in the MCU */ + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + block = MCU_data[blkn]; + ci = cinfo->MCU_membership[blkn]; + compptr = cinfo->cur_comp_info[ci]; + tbl = entropy->derived_tbls[compptr->dc_tbl_no]; + + /* Decode a single block's worth of coefficients */ + + /* Section F.2.2.1: decode the DC coefficient difference */ + HUFF_DECODE(s, br_state, tbl, return FALSE, label1); + if (s) { + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + } + + /* Convert DC difference to actual value, update last_dc_val */ + s += state.last_dc_val[ci]; + state.last_dc_val[ci] = s; + /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ + (*block)[0] = (JCOEF) (s << Al); + } + + /* Completed MCU, so update state */ + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + ASSIGN_STATE(entropy->saved, state); + } + + /* Account for restart interval (no-op if not using restarts) */ + entropy->restarts_to_go--; + + return TRUE; +} + + +/* + * MCU decoding for AC initial scan (either spectral selection, + * or first pass of successive approximation). + */ + +METHODDEF(boolean) +decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + int Se = cinfo->Se; + int Al = cinfo->Al; + register int s, k, r; + unsigned int EOBRUN; + JBLOCKROW block; + BITREAD_STATE_VARS; + d_derived_tbl * tbl; + + /* Process restart marker if needed; may have to suspend */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) + if (! process_restart(cinfo)) + return FALSE; + } + + /* If we've run out of data, just leave the MCU set to zeroes. + * This way, we return uniform gray for the remainder of the segment. + */ + if (! entropy->pub.insufficient_data) { + + /* Load up working state. + * We can avoid loading/saving bitread state if in an EOB run. + */ + EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ + + /* There is always only one block per MCU */ + + if (EOBRUN > 0) /* if it's a band of zeroes... */ + EOBRUN--; /* ...process it now (we do nothing) */ + else { + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + block = MCU_data[0]; + tbl = entropy->ac_derived_tbl; + + for (k = cinfo->Ss; k <= Se; k++) { + HUFF_DECODE(s, br_state, tbl, return FALSE, label2); + r = s >> 4; + s &= 15; + if (s) { + k += r; + CHECK_BIT_BUFFER(br_state, s, return FALSE); + r = GET_BITS(s); + s = HUFF_EXTEND(r, s); + /* Scale and output coefficient in natural (dezigzagged) order */ + (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al); + } else { + if (r == 15) { /* ZRL */ + k += 15; /* skip 15 zeroes in band */ + } else { /* EOBr, run length is 2^r + appended bits */ + EOBRUN = 1 << r; + if (r) { /* EOBr, r > 0 */ + CHECK_BIT_BUFFER(br_state, r, return FALSE); + r = GET_BITS(r); + EOBRUN += r; + } + EOBRUN--; /* this band is processed at this moment */ + break; /* force end-of-band */ + } + } + } + + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + } + + /* Completed MCU, so update state */ + entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ + } + + /* Account for restart interval (no-op if not using restarts) */ + entropy->restarts_to_go--; + + return TRUE; +} + + +/* + * MCU decoding for DC successive approximation refinement scan. + * Note: we assume such scans can be multi-component, although the spec + * is not very clear on the point. + */ + +METHODDEF(boolean) +decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ + int blkn; + JBLOCKROW block; + BITREAD_STATE_VARS; + + /* Process restart marker if needed; may have to suspend */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) + if (! process_restart(cinfo)) + return FALSE; + } + + /* Not worth the cycles to check insufficient_data here, + * since we will not change the data anyway if we read zeroes. + */ + + /* Load up working state */ + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + + /* Outer loop handles each block in the MCU */ + + for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { + block = MCU_data[blkn]; + + /* Encoded data is simply the next bit of the two's-complement DC value */ + CHECK_BIT_BUFFER(br_state, 1, return FALSE); + if (GET_BITS(1)) + (*block)[0] |= p1; + /* Note: since we use |=, repeating the assignment later is safe */ + } + + /* Completed MCU, so update state */ + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + + /* Account for restart interval (no-op if not using restarts) */ + entropy->restarts_to_go--; + + return TRUE; +} + + +/* + * MCU decoding for AC successive approximation refinement scan. + */ + +METHODDEF(boolean) +decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +{ + phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; + int Se = cinfo->Se; + int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ + int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ + register int s, k, r; + unsigned int EOBRUN; + JBLOCKROW block; + JCOEFPTR thiscoef; + BITREAD_STATE_VARS; + d_derived_tbl * tbl; + int num_newnz; + int newnz_pos[DCTSIZE2]; + + /* Process restart marker if needed; may have to suspend */ + if (cinfo->restart_interval) { + if (entropy->restarts_to_go == 0) + if (! process_restart(cinfo)) + return FALSE; + } + + /* If we've run out of data, don't modify the MCU. + */ + if (! entropy->pub.insufficient_data) { + + /* Load up working state */ + BITREAD_LOAD_STATE(cinfo,entropy->bitstate); + EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */ + + /* There is always only one block per MCU */ + block = MCU_data[0]; + tbl = entropy->ac_derived_tbl; + + /* If we are forced to suspend, we must undo the assignments to any newly + * nonzero coefficients in the block, because otherwise we'd get confused + * next time about which coefficients were already nonzero. + * But we need not undo addition of bits to already-nonzero coefficients; + * instead, we can test the current bit to see if we already did it. + */ + num_newnz = 0; + + /* initialize coefficient loop counter to start of band */ + k = cinfo->Ss; + + if (EOBRUN == 0) { + for (; k <= Se; k++) { + HUFF_DECODE(s, br_state, tbl, goto undoit, label3); + r = s >> 4; + s &= 15; + if (s) { + if (s != 1) /* size of new coef should always be 1 */ + WARNMS(cinfo, JWRN_HUFF_BAD_CODE); + CHECK_BIT_BUFFER(br_state, 1, goto undoit); + if (GET_BITS(1)) + s = p1; /* newly nonzero coef is positive */ + else + s = m1; /* newly nonzero coef is negative */ + } else { + if (r != 15) { + EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */ + if (r) { + CHECK_BIT_BUFFER(br_state, r, goto undoit); + r = GET_BITS(r); + EOBRUN += r; + } + break; /* rest of block is handled by EOB logic */ + } + /* note s = 0 for processing ZRL */ + } + /* Advance over already-nonzero coefs and r still-zero coefs, + * appending correction bits to the nonzeroes. A correction bit is 1 + * if the absolute value of the coefficient must be increased. + */ + do { + thiscoef = *block + jpeg_natural_order[k]; + if (*thiscoef != 0) { + CHECK_BIT_BUFFER(br_state, 1, goto undoit); + if (GET_BITS(1)) { + if ((*thiscoef & p1) == 0) { /* do nothing if already set it */ + if (*thiscoef >= 0) + *thiscoef += p1; + else + *thiscoef += m1; + } + } + } else { + if (--r < 0) + break; /* reached target zero coefficient */ + } + k++; + } while (k <= Se); + if (s) { + int pos = jpeg_natural_order[k]; + /* Output newly nonzero coefficient */ + (*block)[pos] = (JCOEF) s; + /* Remember its position in case we have to suspend */ + newnz_pos[num_newnz++] = pos; + } + } + } + + if (EOBRUN > 0) { + /* Scan any remaining coefficient positions after the end-of-band + * (the last newly nonzero coefficient, if any). Append a correction + * bit to each already-nonzero coefficient. A correction bit is 1 + * if the absolute value of the coefficient must be increased. + */ + for (; k <= Se; k++) { + thiscoef = *block + jpeg_natural_order[k]; + if (*thiscoef != 0) { + CHECK_BIT_BUFFER(br_state, 1, goto undoit); + if (GET_BITS(1)) { + if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */ + if (*thiscoef >= 0) + *thiscoef += p1; + else + *thiscoef += m1; + } + } + } + } + /* Count one block completed in EOB run */ + EOBRUN--; + } + + /* Completed MCU, so update state */ + BITREAD_SAVE_STATE(cinfo,entropy->bitstate); + entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */ + } + + /* Account for restart interval (no-op if not using restarts) */ + entropy->restarts_to_go--; + + return TRUE; + +undoit: + /* Re-zero any output coefficients that we made newly nonzero */ + while (num_newnz > 0) + (*block)[newnz_pos[--num_newnz]] = 0; + + return FALSE; +} + + +/* + * Module initialization routine for progressive Huffman entropy decoding. + */ + +GLOBAL(void) +jinit_phuff_decoder (j_decompress_ptr cinfo) +{ + phuff_entropy_ptr entropy; + int *coef_bit_ptr; + int ci, i; + + entropy = (phuff_entropy_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(phuff_entropy_decoder)); + cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; + entropy->pub.start_pass = start_pass_phuff_decoder; + + /* Mark derived tables unallocated */ + for (i = 0; i < NUM_HUFF_TBLS; i++) { + entropy->derived_tbls[i] = NULL; + } + + /* Create progression status table */ + cinfo->coef_bits = (int (*)[DCTSIZE2]) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->num_components*DCTSIZE2*SIZEOF(int)); + coef_bit_ptr = & cinfo->coef_bits[0][0]; + for (ci = 0; ci < cinfo->num_components; ci++) + for (i = 0; i < DCTSIZE2; i++) + *coef_bit_ptr++ = -1; +} + +#endif /* D_PROGRESSIVE_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jdpostct.c b/src/SFML/Graphics/libjpeg/jdpostct.c new file mode 100644 index 00000000..7ba9eed5 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdpostct.c @@ -0,0 +1,290 @@ +/* + * jdpostct.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the decompression postprocessing controller. + * This controller manages the upsampling, color conversion, and color + * quantization/reduction steps; specifically, it controls the buffering + * between upsample/color conversion and color quantization/reduction. + * + * If no color quantization/reduction is required, then this module has no + * work to do, and it just hands off to the upsample/color conversion code. + * An integrated upsample/convert/quantize process would replace this module + * entirely. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Private buffer controller object */ + +typedef struct { + struct jpeg_d_post_controller pub; /* public fields */ + + /* Color quantization source buffer: this holds output data from + * the upsample/color conversion step to be passed to the quantizer. + * For two-pass color quantization, we need a full-image buffer; + * for one-pass operation, a strip buffer is sufficient. + */ + jvirt_sarray_ptr whole_image; /* virtual array, or NULL if one-pass */ + JSAMPARRAY buffer; /* strip buffer, or current strip of virtual */ + JDIMENSION strip_height; /* buffer size in rows */ + /* for two-pass mode only: */ + JDIMENSION starting_row; /* row # of first row in current strip */ + JDIMENSION next_row; /* index of next row to fill/empty in strip */ +} my_post_controller; + +typedef my_post_controller * my_post_ptr; + + +/* Forward declarations */ +METHODDEF(void) post_process_1pass + JPP((j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); +#ifdef QUANT_2PASS_SUPPORTED +METHODDEF(void) post_process_prepass + JPP((j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); +METHODDEF(void) post_process_2pass + JPP((j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); +#endif + + +/* + * Initialize for a processing pass. + */ + +METHODDEF(void) +start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) +{ + my_post_ptr post = (my_post_ptr) cinfo->post; + + switch (pass_mode) { + case JBUF_PASS_THRU: + if (cinfo->quantize_colors) { + /* Single-pass processing with color quantization. */ + post->pub.post_process_data = post_process_1pass; + /* We could be doing buffered-image output before starting a 2-pass + * color quantization; in that case, jinit_d_post_controller did not + * allocate a strip buffer. Use the virtual-array buffer as workspace. + */ + if (post->buffer == NULL) { + post->buffer = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, post->whole_image, + (JDIMENSION) 0, post->strip_height, TRUE); + } + } else { + /* For single-pass processing without color quantization, + * I have no work to do; just call the upsampler directly. + */ + post->pub.post_process_data = cinfo->upsample->upsample; + } + break; +#ifdef QUANT_2PASS_SUPPORTED + case JBUF_SAVE_AND_PASS: + /* First pass of 2-pass quantization */ + if (post->whole_image == NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + post->pub.post_process_data = post_process_prepass; + break; + case JBUF_CRANK_DEST: + /* Second pass of 2-pass quantization */ + if (post->whole_image == NULL) + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + post->pub.post_process_data = post_process_2pass; + break; +#endif /* QUANT_2PASS_SUPPORTED */ + default: + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); + break; + } + post->starting_row = post->next_row = 0; +} + + +/* + * Process some data in the one-pass (strip buffer) case. + * This is used for color precision reduction as well as one-pass quantization. + */ + +METHODDEF(void) +post_process_1pass (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + my_post_ptr post = (my_post_ptr) cinfo->post; + JDIMENSION num_rows, max_rows; + + /* Fill the buffer, but not more than what we can dump out in one go. */ + /* Note we rely on the upsampler to detect bottom of image. */ + max_rows = out_rows_avail - *out_row_ctr; + if (max_rows > post->strip_height) + max_rows = post->strip_height; + num_rows = 0; + (*cinfo->upsample->upsample) (cinfo, + input_buf, in_row_group_ctr, in_row_groups_avail, + post->buffer, &num_rows, max_rows); + /* Quantize and emit data. */ + (*cinfo->cquantize->color_quantize) (cinfo, + post->buffer, output_buf + *out_row_ctr, (int) num_rows); + *out_row_ctr += num_rows; +} + + +#ifdef QUANT_2PASS_SUPPORTED + +/* + * Process some data in the first pass of 2-pass quantization. + */ + +METHODDEF(void) +post_process_prepass (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + my_post_ptr post = (my_post_ptr) cinfo->post; + JDIMENSION old_next_row, num_rows; + + /* Reposition virtual buffer if at start of strip. */ + if (post->next_row == 0) { + post->buffer = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, post->whole_image, + post->starting_row, post->strip_height, TRUE); + } + + /* Upsample some data (up to a strip height's worth). */ + old_next_row = post->next_row; + (*cinfo->upsample->upsample) (cinfo, + input_buf, in_row_group_ctr, in_row_groups_avail, + post->buffer, &post->next_row, post->strip_height); + + /* Allow quantizer to scan new data. No data is emitted, */ + /* but we advance out_row_ctr so outer loop can tell when we're done. */ + if (post->next_row > old_next_row) { + num_rows = post->next_row - old_next_row; + (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row, + (JSAMPARRAY) NULL, (int) num_rows); + *out_row_ctr += num_rows; + } + + /* Advance if we filled the strip. */ + if (post->next_row >= post->strip_height) { + post->starting_row += post->strip_height; + post->next_row = 0; + } +} + + +/* + * Process some data in the second pass of 2-pass quantization. + */ + +METHODDEF(void) +post_process_2pass (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + my_post_ptr post = (my_post_ptr) cinfo->post; + JDIMENSION num_rows, max_rows; + + /* Reposition virtual buffer if at start of strip. */ + if (post->next_row == 0) { + post->buffer = (*cinfo->mem->access_virt_sarray) + ((j_common_ptr) cinfo, post->whole_image, + post->starting_row, post->strip_height, FALSE); + } + + /* Determine number of rows to emit. */ + num_rows = post->strip_height - post->next_row; /* available in strip */ + max_rows = out_rows_avail - *out_row_ctr; /* available in output area */ + if (num_rows > max_rows) + num_rows = max_rows; + /* We have to check bottom of image here, can't depend on upsampler. */ + max_rows = cinfo->output_height - post->starting_row; + if (num_rows > max_rows) + num_rows = max_rows; + + /* Quantize and emit data. */ + (*cinfo->cquantize->color_quantize) (cinfo, + post->buffer + post->next_row, output_buf + *out_row_ctr, + (int) num_rows); + *out_row_ctr += num_rows; + + /* Advance if we filled the strip. */ + post->next_row += num_rows; + if (post->next_row >= post->strip_height) { + post->starting_row += post->strip_height; + post->next_row = 0; + } +} + +#endif /* QUANT_2PASS_SUPPORTED */ + + +/* + * Initialize postprocessing controller. + */ + +GLOBAL(void) +jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) +{ + my_post_ptr post; + + post = (my_post_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_post_controller)); + cinfo->post = (struct jpeg_d_post_controller *) post; + post->pub.start_pass = start_pass_dpost; + post->whole_image = NULL; /* flag for no virtual arrays */ + post->buffer = NULL; /* flag for no strip buffer */ + + /* Create the quantization buffer, if needed */ + if (cinfo->quantize_colors) { + /* The buffer strip height is max_v_samp_factor, which is typically + * an efficient number of rows for upsampling to return. + * (In the presence of output rescaling, we might want to be smarter?) + */ + post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor; + if (need_full_buffer) { + /* Two-pass color quantization: need full-image storage. */ + /* We round up the number of rows to a multiple of the strip height. */ +#ifdef QUANT_2PASS_SUPPORTED + post->whole_image = (*cinfo->mem->request_virt_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, + cinfo->output_width * cinfo->out_color_components, + (JDIMENSION) jround_up((long) cinfo->output_height, + (long) post->strip_height), + post->strip_height); +#else + ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); +#endif /* QUANT_2PASS_SUPPORTED */ + } else { + /* One-pass color quantization: just make a strip buffer. */ + post->buffer = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + cinfo->output_width * cinfo->out_color_components, + post->strip_height); + } + } +} diff --git a/src/SFML/Graphics/libjpeg/jdsample.c b/src/SFML/Graphics/libjpeg/jdsample.c new file mode 100644 index 00000000..e0d9040a --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdsample.c @@ -0,0 +1,478 @@ +/* + * jdsample.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains upsampling routines. + * + * Upsampling input data is counted in "row groups". A row group + * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size) + * sample rows of each component. Upsampling will normally produce + * max_v_samp_factor pixel rows from each row group (but this could vary + * if the upsampler is applying a scale factor of its own). + * + * An excellent reference for image resampling is + * Digital Image Warping, George Wolberg, 1990. + * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Pointer to routine to upsample a single component */ +typedef JMETHOD(void, upsample1_ptr, + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr)); + +/* Private subobject */ + +typedef struct { + struct jpeg_upsampler pub; /* public fields */ + + /* Color conversion buffer. When using separate upsampling and color + * conversion steps, this buffer holds one upsampled row group until it + * has been color converted and output. + * Note: we do not allocate any storage for component(s) which are full-size, + * ie do not need rescaling. The corresponding entry of color_buf[] is + * simply set to point to the input data array, thereby avoiding copying. + */ + JSAMPARRAY color_buf[MAX_COMPONENTS]; + + /* Per-component upsampling method pointers */ + upsample1_ptr methods[MAX_COMPONENTS]; + + int next_row_out; /* counts rows emitted from color_buf */ + JDIMENSION rows_to_go; /* counts rows remaining in image */ + + /* Height of an input row group for each component. */ + int rowgroup_height[MAX_COMPONENTS]; + + /* These arrays save pixel expansion factors so that int_expand need not + * recompute them each time. They are unused for other upsampling methods. + */ + UINT8 h_expand[MAX_COMPONENTS]; + UINT8 v_expand[MAX_COMPONENTS]; +} my_upsampler; + +typedef my_upsampler * my_upsample_ptr; + + +/* + * Initialize for an upsampling pass. + */ + +METHODDEF(void) +start_pass_upsample (j_decompress_ptr cinfo) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + + /* Mark the conversion buffer empty */ + upsample->next_row_out = cinfo->max_v_samp_factor; + /* Initialize total-height counter for detecting bottom of image */ + upsample->rows_to_go = cinfo->output_height; +} + + +/* + * Control routine to do upsampling (and color conversion). + * + * In this version we upsample each component independently. + * We upsample one row group into the conversion buffer, then apply + * color conversion a row at a time. + */ + +METHODDEF(void) +sep_upsample (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + int ci; + jpeg_component_info * compptr; + JDIMENSION num_rows; + + /* Fill the conversion buffer, if it's empty */ + if (upsample->next_row_out >= cinfo->max_v_samp_factor) { + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Invoke per-component upsample method. Notice we pass a POINTER + * to color_buf[ci], so that fullsize_upsample can change it. + */ + (*upsample->methods[ci]) (cinfo, compptr, + input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]), + upsample->color_buf + ci); + } + upsample->next_row_out = 0; + } + + /* Color-convert and emit rows */ + + /* How many we have in the buffer: */ + num_rows = (JDIMENSION) (cinfo->max_v_samp_factor - upsample->next_row_out); + /* Not more than the distance to the end of the image. Need this test + * in case the image height is not a multiple of max_v_samp_factor: + */ + if (num_rows > upsample->rows_to_go) + num_rows = upsample->rows_to_go; + /* And not more than what the client can accept: */ + out_rows_avail -= *out_row_ctr; + if (num_rows > out_rows_avail) + num_rows = out_rows_avail; + + (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf, + (JDIMENSION) upsample->next_row_out, + output_buf + *out_row_ctr, + (int) num_rows); + + /* Adjust counts */ + *out_row_ctr += num_rows; + upsample->rows_to_go -= num_rows; + upsample->next_row_out += num_rows; + /* When the buffer is emptied, declare this input row group consumed */ + if (upsample->next_row_out >= cinfo->max_v_samp_factor) + (*in_row_group_ctr)++; +} + + +/* + * These are the routines invoked by sep_upsample to upsample pixel values + * of a single component. One row group is processed per call. + */ + + +/* + * For full-size components, we just make color_buf[ci] point at the + * input buffer, and thus avoid copying any data. Note that this is + * safe only because sep_upsample doesn't declare the input row group + * "consumed" until we are done color converting and emitting it. + */ + +METHODDEF(void) +fullsize_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + *output_data_ptr = input_data; +} + + +/* + * This is a no-op version used for "uninteresting" components. + * These components will not be referenced by color conversion. + */ + +METHODDEF(void) +noop_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + *output_data_ptr = NULL; /* safety check */ +} + + +/* + * This version handles any integral sampling ratios. + * This is not used for typical JPEG files, so it need not be fast. + * Nor, for that matter, is it particularly accurate: the algorithm is + * simple replication of the input pixel onto the corresponding output + * pixels. The hi-falutin sampling literature refers to this as a + * "box filter". A box filter tends to introduce visible artifacts, + * so if you are actually going to use 3:1 or 4:1 sampling ratios + * you would be well advised to improve this code. + */ + +METHODDEF(void) +int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + JSAMPARRAY output_data = *output_data_ptr; + register JSAMPROW inptr, outptr; + register JSAMPLE invalue; + register int h; + JSAMPROW outend; + int h_expand, v_expand; + int inrow, outrow; + + h_expand = upsample->h_expand[compptr->component_index]; + v_expand = upsample->v_expand[compptr->component_index]; + + inrow = outrow = 0; + while (outrow < cinfo->max_v_samp_factor) { + /* Generate one output row with proper horizontal expansion */ + inptr = input_data[inrow]; + outptr = output_data[outrow]; + outend = outptr + cinfo->output_width; + while (outptr < outend) { + invalue = *inptr++; /* don't need GETJSAMPLE() here */ + for (h = h_expand; h > 0; h--) { + *outptr++ = invalue; + } + } + /* Generate any additional output rows by duplicating the first one */ + if (v_expand > 1) { + jcopy_sample_rows(output_data, outrow, output_data, outrow+1, + v_expand-1, cinfo->output_width); + } + inrow++; + outrow += v_expand; + } +} + + +/* + * Fast processing for the common case of 2:1 horizontal and 1:1 vertical. + * It's still a box filter. + */ + +METHODDEF(void) +h2v1_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + JSAMPARRAY output_data = *output_data_ptr; + register JSAMPROW inptr, outptr; + register JSAMPLE invalue; + JSAMPROW outend; + int inrow; + + for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { + inptr = input_data[inrow]; + outptr = output_data[inrow]; + outend = outptr + cinfo->output_width; + while (outptr < outend) { + invalue = *inptr++; /* don't need GETJSAMPLE() here */ + *outptr++ = invalue; + *outptr++ = invalue; + } + } +} + + +/* + * Fast processing for the common case of 2:1 horizontal and 2:1 vertical. + * It's still a box filter. + */ + +METHODDEF(void) +h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + JSAMPARRAY output_data = *output_data_ptr; + register JSAMPROW inptr, outptr; + register JSAMPLE invalue; + JSAMPROW outend; + int inrow, outrow; + + inrow = outrow = 0; + while (outrow < cinfo->max_v_samp_factor) { + inptr = input_data[inrow]; + outptr = output_data[outrow]; + outend = outptr + cinfo->output_width; + while (outptr < outend) { + invalue = *inptr++; /* don't need GETJSAMPLE() here */ + *outptr++ = invalue; + *outptr++ = invalue; + } + jcopy_sample_rows(output_data, outrow, output_data, outrow+1, + 1, cinfo->output_width); + inrow++; + outrow += 2; + } +} + + +/* + * Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. + * + * The upsampling algorithm is linear interpolation between pixel centers, + * also known as a "triangle filter". This is a good compromise between + * speed and visual quality. The centers of the output pixels are 1/4 and 3/4 + * of the way between input pixel centers. + * + * A note about the "bias" calculations: when rounding fractional values to + * integer, we do not want to always round 0.5 up to the next integer. + * If we did that, we'd introduce a noticeable bias towards larger values. + * Instead, this code is arranged so that 0.5 will be rounded up or down at + * alternate pixel locations (a simple ordered dither pattern). + */ + +METHODDEF(void) +h2v1_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + JSAMPARRAY output_data = *output_data_ptr; + register JSAMPROW inptr, outptr; + register int invalue; + register JDIMENSION colctr; + int inrow; + + for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { + inptr = input_data[inrow]; + outptr = output_data[inrow]; + /* Special case for first column */ + invalue = GETJSAMPLE(*inptr++); + *outptr++ = (JSAMPLE) invalue; + *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2); + + for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { + /* General case: 3/4 * nearer pixel + 1/4 * further pixel */ + invalue = GETJSAMPLE(*inptr++) * 3; + *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2); + *outptr++ = (JSAMPLE) ((invalue + GETJSAMPLE(*inptr) + 2) >> 2); + } + + /* Special case for last column */ + invalue = GETJSAMPLE(*inptr); + *outptr++ = (JSAMPLE) ((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2); + *outptr++ = (JSAMPLE) invalue; + } +} + + +/* + * Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. + * Again a triangle filter; see comments for h2v1 case, above. + * + * It is OK for us to reference the adjacent input rows because we demanded + * context from the main buffer controller (see initialization code). + */ + +METHODDEF(void) +h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) +{ + JSAMPARRAY output_data = *output_data_ptr; + register JSAMPROW inptr0, inptr1, outptr; +#if BITS_IN_JSAMPLE == 8 + register int thiscolsum, lastcolsum, nextcolsum; +#else + register INT32 thiscolsum, lastcolsum, nextcolsum; +#endif + register JDIMENSION colctr; + int inrow, outrow, v; + + inrow = outrow = 0; + while (outrow < cinfo->max_v_samp_factor) { + for (v = 0; v < 2; v++) { + /* inptr0 points to nearest input row, inptr1 points to next nearest */ + inptr0 = input_data[inrow]; + if (v == 0) /* next nearest is row above */ + inptr1 = input_data[inrow-1]; + else /* next nearest is row below */ + inptr1 = input_data[inrow+1]; + outptr = output_data[outrow++]; + + /* Special case for first column */ + thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); + nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); + *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 8) >> 4); + *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + lastcolsum = thiscolsum; thiscolsum = nextcolsum; + + for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) { + /* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */ + /* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */ + nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++); + *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + *outptr++ = (JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4); + lastcolsum = thiscolsum; thiscolsum = nextcolsum; + } + + /* Special case for last column */ + *outptr++ = (JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4); + *outptr++ = (JSAMPLE) ((thiscolsum * 4 + 7) >> 4); + } + inrow++; + } +} + + +/* + * Module initialization routine for upsampling. + */ + +GLOBAL(void) +jinit_upsampler (j_decompress_ptr cinfo) +{ + my_upsample_ptr upsample; + int ci; + jpeg_component_info * compptr; + boolean need_buffer, do_fancy; + int h_in_group, v_in_group, h_out_group, v_out_group; + + upsample = (my_upsample_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_upsampler)); + cinfo->upsample = (struct jpeg_upsampler *) upsample; + upsample->pub.start_pass = start_pass_upsample; + upsample->pub.upsample = sep_upsample; + upsample->pub.need_context_rows = FALSE; /* until we find out differently */ + + if (cinfo->CCIR601_sampling) /* this isn't supported */ + ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); + + /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1, + * so don't ask for it. + */ + do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1; + + /* Verify we can handle the sampling factors, select per-component methods, + * and create storage as needed. + */ + for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; + ci++, compptr++) { + /* Compute size of an "input group" after IDCT scaling. This many samples + * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. + */ + h_in_group = (compptr->h_samp_factor * compptr->DCT_scaled_size) / + cinfo->min_DCT_scaled_size; + v_in_group = (compptr->v_samp_factor * compptr->DCT_scaled_size) / + cinfo->min_DCT_scaled_size; + h_out_group = cinfo->max_h_samp_factor; + v_out_group = cinfo->max_v_samp_factor; + upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ + need_buffer = TRUE; + if (! compptr->component_needed) { + /* Don't bother to upsample an uninteresting component. */ + upsample->methods[ci] = noop_upsample; + need_buffer = FALSE; + } else if (h_in_group == h_out_group && v_in_group == v_out_group) { + /* Fullsize components can be processed without any work. */ + upsample->methods[ci] = fullsize_upsample; + need_buffer = FALSE; + } else if (h_in_group * 2 == h_out_group && + v_in_group == v_out_group) { + /* Special cases for 2h1v upsampling */ + if (do_fancy && compptr->downsampled_width > 2) + upsample->methods[ci] = h2v1_fancy_upsample; + else + upsample->methods[ci] = h2v1_upsample; + } else if (h_in_group * 2 == h_out_group && + v_in_group * 2 == v_out_group) { + /* Special cases for 2h2v upsampling */ + if (do_fancy && compptr->downsampled_width > 2) { + upsample->methods[ci] = h2v2_fancy_upsample; + upsample->pub.need_context_rows = TRUE; + } else + upsample->methods[ci] = h2v2_upsample; + } else if ((h_out_group % h_in_group) == 0 && + (v_out_group % v_in_group) == 0) { + /* Generic integral-factors upsampling method */ + upsample->methods[ci] = int_upsample; + upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group); + upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); + } else + ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); + if (need_buffer) { + upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) jround_up((long) cinfo->output_width, + (long) cinfo->max_h_samp_factor), + (JDIMENSION) cinfo->max_v_samp_factor); + } + } +} diff --git a/src/SFML/Graphics/libjpeg/jdtrans.c b/src/SFML/Graphics/libjpeg/jdtrans.c new file mode 100644 index 00000000..12c193c8 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jdtrans.c @@ -0,0 +1,143 @@ +/* + * jdtrans.c + * + * Copyright (C) 1995-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains library routines for transcoding decompression, + * that is, reading raw DCT coefficient arrays from an input JPEG file. + * The routines in jdapimin.c will also be needed by a transcoder. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* Forward declarations */ +LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); + + +/* + * Read the coefficient arrays from a JPEG file. + * jpeg_read_header must be completed before calling this. + * + * The entire image is read into a set of virtual coefficient-block arrays, + * one per component. The return value is a pointer to the array of + * virtual-array descriptors. These can be manipulated directly via the + * JPEG memory manager, or handed off to jpeg_write_coefficients(). + * To release the memory occupied by the virtual arrays, call + * jpeg_finish_decompress() when done with the data. + * + * An alternative usage is to simply obtain access to the coefficient arrays + * during a buffered-image-mode decompression operation. This is allowed + * after any jpeg_finish_output() call. The arrays can be accessed until + * jpeg_finish_decompress() is called. (Note that any call to the library + * may reposition the arrays, so don't rely on access_virt_barray() results + * to stay valid across library calls.) + * + * Returns NULL if suspended. This case need be checked only if + * a suspending data source is used. + */ + +GLOBAL(jvirt_barray_ptr *) +jpeg_read_coefficients (j_decompress_ptr cinfo) +{ + if (cinfo->global_state == DSTATE_READY) { + /* First call: initialize active modules */ + transdecode_master_selection(cinfo); + cinfo->global_state = DSTATE_RDCOEFS; + } + if (cinfo->global_state == DSTATE_RDCOEFS) { + /* Absorb whole file into the coef buffer */ + for (;;) { + int retcode; + /* Call progress monitor hook if present */ + if (cinfo->progress != NULL) + (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); + /* Absorb some more input */ + retcode = (*cinfo->inputctl->consume_input) (cinfo); + if (retcode == JPEG_SUSPENDED) + return NULL; + if (retcode == JPEG_REACHED_EOI) + break; + /* Advance progress counter if appropriate */ + if (cinfo->progress != NULL && + (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { + if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { + /* startup underestimated number of scans; ratchet up one scan */ + cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; + } + } + } + /* Set state so that jpeg_finish_decompress does the right thing */ + cinfo->global_state = DSTATE_STOPPING; + } + /* At this point we should be in state DSTATE_STOPPING if being used + * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access + * to the coefficients during a full buffered-image-mode decompression. + */ + if ((cinfo->global_state == DSTATE_STOPPING || + cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { + return cinfo->coef->coef_arrays; + } + /* Oops, improper usage */ + ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); + return NULL; /* keep compiler happy */ +} + + +/* + * Master selection of decompression modules for transcoding. + * This substitutes for jdmaster.c's initialization of the full decompressor. + */ + +LOCAL(void) +transdecode_master_selection (j_decompress_ptr cinfo) +{ + /* This is effectively a buffered-image operation. */ + cinfo->buffered_image = TRUE; + + /* Entropy decoding: either Huffman or arithmetic coding. */ + if (cinfo->arith_code) { + ERREXIT(cinfo, JERR_ARITH_NOTIMPL); + } else { + if (cinfo->progressive_mode) { +#ifdef D_PROGRESSIVE_SUPPORTED + jinit_phuff_decoder(cinfo); +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } else + jinit_huff_decoder(cinfo); + } + + /* Always get a full-image coefficient buffer. */ + jinit_d_coef_controller(cinfo, TRUE); + + /* We can now tell the memory manager to allocate virtual arrays. */ + (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); + + /* Initialize input side of decompressor to consume first scan. */ + (*cinfo->inputctl->start_input_pass) (cinfo); + + /* Initialize progress monitoring. */ + if (cinfo->progress != NULL) { + int nscans; + /* Estimate number of scans to set pass_limit. */ + if (cinfo->progressive_mode) { + /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ + nscans = 2 + 3 * cinfo->num_components; + } else if (cinfo->inputctl->has_multiple_scans) { + /* For a nonprogressive multiscan file, estimate 1 scan per component. */ + nscans = cinfo->num_components; + } else { + nscans = 1; + } + cinfo->progress->pass_counter = 0L; + cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; + cinfo->progress->completed_passes = 0; + cinfo->progress->total_passes = 1; + } +} diff --git a/src/SFML/Graphics/libjpeg/jerror.c b/src/SFML/Graphics/libjpeg/jerror.c new file mode 100644 index 00000000..c98aed76 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jerror.c @@ -0,0 +1,252 @@ +/* + * jerror.c + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains simple error-reporting and trace-message routines. + * These are suitable for Unix-like systems and others where writing to + * stderr is the right thing to do. Many applications will want to replace + * some or all of these routines. + * + * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile, + * you get a Windows-specific hack to display error messages in a dialog box. + * It ain't much, but it beats dropping error messages into the bit bucket, + * which is what happens to output to stderr under most Windows C compilers. + * + * These routines are used by both the compression and decompression code. + */ + +/* this is not a core library module, so it doesn't define JPEG_INTERNALS */ +#include "jinclude.h" +#include "jpeglib.h" +#include "jversion.h" +#include "jerror.h" + +#ifdef USE_WINDOWS_MESSAGEBOX +#include +#endif + +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#define EXIT_FAILURE 1 +#endif + + +/* + * Create the message string table. + * We do this from the master message list in jerror.h by re-reading + * jerror.h with a suitable definition for macro JMESSAGE. + * The message table is made an external symbol just in case any applications + * want to refer to it directly. + */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_std_message_table jMsgTable +#endif + +#define JMESSAGE(code,string) string , + +const char * const jpeg_std_message_table[] = { +#include "jerror.h" + NULL +}; + + +/* + * Error exit handler: must not return to caller. + * + * Applications may override this if they want to get control back after + * an error. Typically one would longjmp somewhere instead of exiting. + * The setjmp buffer can be made a private field within an expanded error + * handler object. Note that the info needed to generate an error message + * is stored in the error object, so you can generate the message now or + * later, at your convenience. + * You should make sure that the JPEG object is cleaned up (with jpeg_abort + * or jpeg_destroy) at some point. + */ + +METHODDEF(void) +error_exit (j_common_ptr cinfo) +{ + /* Always display the message */ + (*cinfo->err->output_message) (cinfo); + + /* Let the memory manager delete any temp files before we die */ + jpeg_destroy(cinfo); + + exit(EXIT_FAILURE); +} + + +/* + * Actual output of an error or trace message. + * Applications may override this method to send JPEG messages somewhere + * other than stderr. + * + * On Windows, printing to stderr is generally completely useless, + * so we provide optional code to produce an error-dialog popup. + * Most Windows applications will still prefer to override this routine, + * but if they don't, it'll do something at least marginally useful. + * + * NOTE: to use the library in an environment that doesn't support the + * C stdio library, you may have to delete the call to fprintf() entirely, + * not just not use this routine. + */ + +METHODDEF(void) +output_message (j_common_ptr cinfo) +{ + char buffer[JMSG_LENGTH_MAX]; + + /* Create the message */ + (*cinfo->err->format_message) (cinfo, buffer); + +#ifdef USE_WINDOWS_MESSAGEBOX + /* Display it in a message dialog box */ + MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", + MB_OK | MB_ICONERROR); +#else + /* Send it to stderr, adding a newline */ + fprintf(stderr, "%s\n", buffer); +#endif +} + + +/* + * Decide whether to emit a trace or warning message. + * msg_level is one of: + * -1: recoverable corrupt-data warning, may want to abort. + * 0: important advisory messages (always display to user). + * 1: first level of tracing detail. + * 2,3,...: successively more detailed tracing messages. + * An application might override this method if it wanted to abort on warnings + * or change the policy about which messages to display. + */ + +METHODDEF(void) +emit_message (j_common_ptr cinfo, int msg_level) +{ + struct jpeg_error_mgr * err = cinfo->err; + + if (msg_level < 0) { + /* It's a warning message. Since corrupt files may generate many warnings, + * the policy implemented here is to show only the first warning, + * unless trace_level >= 3. + */ + if (err->num_warnings == 0 || err->trace_level >= 3) + (*err->output_message) (cinfo); + /* Always count warnings in num_warnings. */ + err->num_warnings++; + } else { + /* It's a trace message. Show it if trace_level >= msg_level. */ + if (err->trace_level >= msg_level) + (*err->output_message) (cinfo); + } +} + + +/* + * Format a message string for the most recent JPEG error or message. + * The message is stored into buffer, which should be at least JMSG_LENGTH_MAX + * characters. Note that no '\n' character is added to the string. + * Few applications should need to override this method. + */ + +METHODDEF(void) +format_message (j_common_ptr cinfo, char * buffer) +{ + struct jpeg_error_mgr * err = cinfo->err; + int msg_code = err->msg_code; + const char * msgtext = NULL; + const char * msgptr; + char ch; + boolean isstring; + + /* Look up message string in proper table */ + if (msg_code > 0 && msg_code <= err->last_jpeg_message) { + msgtext = err->jpeg_message_table[msg_code]; + } else if (err->addon_message_table != NULL && + msg_code >= err->first_addon_message && + msg_code <= err->last_addon_message) { + msgtext = err->addon_message_table[msg_code - err->first_addon_message]; + } + + /* Defend against bogus message number */ + if (msgtext == NULL) { + err->msg_parm.i[0] = msg_code; + msgtext = err->jpeg_message_table[0]; + } + + /* Check for string parameter, as indicated by %s in the message text */ + isstring = FALSE; + msgptr = msgtext; + while ((ch = *msgptr++) != '\0') { + if (ch == '%') { + if (*msgptr == 's') isstring = TRUE; + break; + } + } + + /* Format the message into the passed buffer */ + if (isstring) + sprintf(buffer, msgtext, err->msg_parm.s); + else + sprintf(buffer, msgtext, + err->msg_parm.i[0], err->msg_parm.i[1], + err->msg_parm.i[2], err->msg_parm.i[3], + err->msg_parm.i[4], err->msg_parm.i[5], + err->msg_parm.i[6], err->msg_parm.i[7]); +} + + +/* + * Reset error state variables at start of a new image. + * This is called during compression startup to reset trace/error + * processing to default state, without losing any application-specific + * method pointers. An application might possibly want to override + * this method if it has additional error processing state. + */ + +METHODDEF(void) +reset_error_mgr (j_common_ptr cinfo) +{ + cinfo->err->num_warnings = 0; + /* trace_level is not reset since it is an application-supplied parameter */ + cinfo->err->msg_code = 0; /* may be useful as a flag for "no error" */ +} + + +/* + * Fill in the standard error-handling methods in a jpeg_error_mgr object. + * Typical call is: + * struct jpeg_compress_struct cinfo; + * struct jpeg_error_mgr err; + * + * cinfo.err = jpeg_std_error(&err); + * after which the application may override some of the methods. + */ + +GLOBAL(struct jpeg_error_mgr *) +jpeg_std_error (struct jpeg_error_mgr * err) +{ + err->error_exit = error_exit; + err->emit_message = emit_message; + err->output_message = output_message; + err->format_message = format_message; + err->reset_error_mgr = reset_error_mgr; + + err->trace_level = 0; /* default = no tracing */ + err->num_warnings = 0; /* no warnings emitted yet */ + err->msg_code = 0; /* may be useful as a flag for "no error" */ + + /* Initialize message table pointers */ + err->jpeg_message_table = jpeg_std_message_table; + err->last_jpeg_message = (int) JMSG_LASTMSGCODE - 1; + + err->addon_message_table = NULL; + err->first_addon_message = 0; /* for safety */ + err->last_addon_message = 0; + + return err; +} diff --git a/src/SFML/Graphics/libjpeg/jerror.h b/src/SFML/Graphics/libjpeg/jerror.h new file mode 100644 index 00000000..79084f2e --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jerror.h @@ -0,0 +1,291 @@ +/* + * jerror.h + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the error and message codes for the JPEG library. + * Edit this file to add new codes, or to translate the message strings to + * some other language. + * A set of error-reporting macros are defined too. Some applications using + * the JPEG library may wish to include this file to get the error codes + * and/or the macros. + */ + +/* + * To define the enum list of message codes, include this file without + * defining macro JMESSAGE. To create a message string table, include it + * again with a suitable JMESSAGE definition (see jerror.c for an example). + */ +#ifndef JMESSAGE +#ifndef JERROR_H +/* First time through, define the enum list */ +#define JMAKE_ENUM_LIST +#else +/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ +#define JMESSAGE(code,string) +#endif /* JERROR_H */ +#endif /* JMESSAGE */ + +#ifdef JMAKE_ENUM_LIST + +typedef enum { + +#define JMESSAGE(code,string) code , + +#endif /* JMAKE_ENUM_LIST */ + +JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ + +/* For maintenance convenience, list is alphabetical by message code name */ +JMESSAGE(JERR_ARITH_NOTIMPL, + "Sorry, there are legal restrictions on arithmetic coding") +JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") +JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") +JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") +JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") +JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") +JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") +JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") +JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") +JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") +JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") +JMESSAGE(JERR_BAD_LIB_VERSION, + "Wrong JPEG library version: library is %d, caller expects %d") +JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") +JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") +JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") +JMESSAGE(JERR_BAD_PROGRESSION, + "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") +JMESSAGE(JERR_BAD_PROG_SCRIPT, + "Invalid progressive parameters at scan script entry %d") +JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") +JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") +JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") +JMESSAGE(JERR_BAD_STRUCT_SIZE, + "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") +JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") +JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") +JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") +JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") +JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") +JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") +JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") +JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") +JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") +JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") +JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") +JMESSAGE(JERR_EMS_READ, "Read from EMS failed") +JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") +JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") +JMESSAGE(JERR_FILE_READ, "Input file read error") +JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") +JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") +JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") +JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") +JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") +JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") +JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") +JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, + "Cannot transcode due to multiple use of quantization table %d") +JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") +JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") +JMESSAGE(JERR_NOTIMPL, "Not implemented yet") +JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") +JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") +JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") +JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") +JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") +JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") +JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") +JMESSAGE(JERR_QUANT_COMPONENTS, + "Cannot quantize more than %d color components") +JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") +JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") +JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") +JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") +JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") +JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") +JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") +JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") +JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") +JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") +JMESSAGE(JERR_TFILE_WRITE, + "Write failed on temporary file --- out of disk space?") +JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") +JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") +JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") +JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") +JMESSAGE(JERR_XMS_READ, "Read from XMS failed") +JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") +JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) +JMESSAGE(JMSG_VERSION, JVERSION) +JMESSAGE(JTRC_16BIT_TABLES, + "Caution: quantization tables are too coarse for baseline JPEG") +JMESSAGE(JTRC_ADOBE, + "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") +JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") +JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") +JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") +JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") +JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") +JMESSAGE(JTRC_DRI, "Define Restart Interval %u") +JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") +JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") +JMESSAGE(JTRC_EOI, "End Of Image") +JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") +JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") +JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, + "Warning: thumbnail image size does not match data length %u") +JMESSAGE(JTRC_JFIF_EXTENSION, + "JFIF extension marker: type 0x%02x, length %u") +JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") +JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") +JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") +JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") +JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") +JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") +JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") +JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") +JMESSAGE(JTRC_RST, "RST%d") +JMESSAGE(JTRC_SMOOTH_NOTIMPL, + "Smoothing not supported with nonstandard sampling ratios") +JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") +JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") +JMESSAGE(JTRC_SOI, "Start of Image") +JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") +JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") +JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") +JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") +JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") +JMESSAGE(JTRC_THUMB_JPEG, + "JFIF extension marker: JPEG-compressed thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_PALETTE, + "JFIF extension marker: palette thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_RGB, + "JFIF extension marker: RGB thumbnail image, length %u") +JMESSAGE(JTRC_UNKNOWN_IDS, + "Unrecognized component IDs %d %d %d, assuming YCbCr") +JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") +JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") +JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") +JMESSAGE(JWRN_BOGUS_PROGRESSION, + "Inconsistent progression sequence for component %d coefficient %d") +JMESSAGE(JWRN_EXTRANEOUS_DATA, + "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") +JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") +JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") +JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") +JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") +JMESSAGE(JWRN_MUST_RESYNC, + "Corrupt JPEG data: found marker 0x%02x instead of RST%d") +JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") +JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") + +#ifdef JMAKE_ENUM_LIST + + JMSG_LASTMSGCODE +} J_MESSAGE_CODE; + +#undef JMAKE_ENUM_LIST +#endif /* JMAKE_ENUM_LIST */ + +/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ +#undef JMESSAGE + + +#ifndef JERROR_H +#define JERROR_H + +/* Macros to simplify using the error and trace message stuff */ +/* The first parameter is either type of cinfo pointer */ + +/* Fatal errors (print message and exit) */ +#define ERREXIT(cinfo,code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT1(cinfo,code,p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT2(cinfo,code,p1,p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT3(cinfo,code,p1,p2,p3) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (cinfo)->err->msg_parm.i[3] = (p4), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXITS(cinfo,code,str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) + +#define MAKESTMT(stuff) do { stuff } while (0) + +/* Nonfatal errors (we can keep going, but the data is probably corrupt) */ +#define WARNMS(cinfo,code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) +#define WARNMS1(cinfo,code,p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) +#define WARNMS2(cinfo,code,p1,p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) + +/* Informational/debugging messages */ +#define TRACEMS(cinfo,lvl,code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) +#define TRACEMS1(cinfo,lvl,code,p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) +#define TRACEMS2(cinfo,lvl,code,p1,p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) +#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMSS(cinfo,lvl,code,str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) + +#endif /* JERROR_H */ diff --git a/src/SFML/Graphics/libjpeg/jfdctflt.c b/src/SFML/Graphics/libjpeg/jfdctflt.c new file mode 100644 index 00000000..7ccfb380 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jfdctflt.c @@ -0,0 +1,168 @@ +/* + * jfdctflt.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a floating-point implementation of the + * forward DCT (Discrete Cosine Transform). + * + * This implementation should be more accurate than either of the integer + * DCT implementations. However, it may not give the same results on all + * machines because of differences in roundoff behavior. Speed will depend + * on the hardware's floating point capacity. + * + * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT + * on each column. Direct algorithms are also available, but they are + * much more complex and seem not to be any faster when reduced to code. + * + * This implementation is based on Arai, Agui, and Nakajima's algorithm for + * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in + * Japanese, but the algorithm is described in the Pennebaker & Mitchell + * JPEG textbook (see REFERENCES section in file README). The following code + * is based directly on figure 4-8 in P&M. + * While an 8-point DCT cannot be done in less than 11 multiplies, it is + * possible to arrange the computation so that many of the multiplies are + * simple scalings of the final outputs. These multiplies can then be + * folded into the multiplications or divisions by the JPEG quantization + * table entries. The AA&N method leaves only 5 multiplies and 29 adds + * to be done in the DCT itself. + * The primary disadvantage of this method is that with a fixed-point + * implementation, accuracy is lost due to imprecise representation of the + * scaled quantization values. However, that problem does not arise if + * we use floating point arithmetic. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef DCT_FLOAT_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* + * Perform the forward DCT on one block of samples. + */ + +GLOBAL(void) +jpeg_fdct_float (FAST_FLOAT * data) +{ + FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + FAST_FLOAT tmp10, tmp11, tmp12, tmp13; + FAST_FLOAT z1, z2, z3, z4, z5, z11, z13; + FAST_FLOAT *dataptr; + int ctr; + + /* Pass 1: process rows. */ + + dataptr = data; + for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { + tmp0 = dataptr[0] + dataptr[7]; + tmp7 = dataptr[0] - dataptr[7]; + tmp1 = dataptr[1] + dataptr[6]; + tmp6 = dataptr[1] - dataptr[6]; + tmp2 = dataptr[2] + dataptr[5]; + tmp5 = dataptr[2] - dataptr[5]; + tmp3 = dataptr[3] + dataptr[4]; + tmp4 = dataptr[3] - dataptr[4]; + + /* Even part */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + dataptr[0] = tmp10 + tmp11; /* phase 3 */ + dataptr[4] = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ + dataptr[2] = tmp13 + z1; /* phase 5 */ + dataptr[6] = tmp13 - z1; + + /* Odd part */ + + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ + z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ + z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ + z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ + + z11 = tmp7 + z3; /* phase 5 */ + z13 = tmp7 - z3; + + dataptr[5] = z13 + z2; /* phase 6 */ + dataptr[3] = z13 - z2; + dataptr[1] = z11 + z4; + dataptr[7] = z11 - z4; + + dataptr += DCTSIZE; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + + dataptr = data; + for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { + tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; + tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; + tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; + tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; + tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; + tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; + tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; + tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; + + /* Even part */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ + dataptr[DCTSIZE*4] = tmp10 - tmp11; + + z1 = (tmp12 + tmp13) * ((FAST_FLOAT) 0.707106781); /* c4 */ + dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ + dataptr[DCTSIZE*6] = tmp13 - z1; + + /* Odd part */ + + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + z5 = (tmp10 - tmp12) * ((FAST_FLOAT) 0.382683433); /* c6 */ + z2 = ((FAST_FLOAT) 0.541196100) * tmp10 + z5; /* c2-c6 */ + z4 = ((FAST_FLOAT) 1.306562965) * tmp12 + z5; /* c2+c6 */ + z3 = tmp11 * ((FAST_FLOAT) 0.707106781); /* c4 */ + + z11 = tmp7 + z3; /* phase 5 */ + z13 = tmp7 - z3; + + dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ + dataptr[DCTSIZE*3] = z13 - z2; + dataptr[DCTSIZE*1] = z11 + z4; + dataptr[DCTSIZE*7] = z11 - z4; + + dataptr++; /* advance pointer to next column */ + } +} + +#endif /* DCT_FLOAT_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jfdctfst.c b/src/SFML/Graphics/libjpeg/jfdctfst.c new file mode 100644 index 00000000..005a74fe --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jfdctfst.c @@ -0,0 +1,224 @@ +/* + * jfdctfst.c + * + * Copyright (C) 1994-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a fast, not so accurate integer implementation of the + * forward DCT (Discrete Cosine Transform). + * + * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT + * on each column. Direct algorithms are also available, but they are + * much more complex and seem not to be any faster when reduced to code. + * + * This implementation is based on Arai, Agui, and Nakajima's algorithm for + * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in + * Japanese, but the algorithm is described in the Pennebaker & Mitchell + * JPEG textbook (see REFERENCES section in file README). The following code + * is based directly on figure 4-8 in P&M. + * While an 8-point DCT cannot be done in less than 11 multiplies, it is + * possible to arrange the computation so that many of the multiplies are + * simple scalings of the final outputs. These multiplies can then be + * folded into the multiplications or divisions by the JPEG quantization + * table entries. The AA&N method leaves only 5 multiplies and 29 adds + * to be done in the DCT itself. + * The primary disadvantage of this method is that with fixed-point math, + * accuracy is lost due to imprecise representation of the scaled + * quantization values. The smaller the quantization table entry, the less + * precise the scaled value, so this implementation does worse with high- + * quality-setting files than with low-quality ones. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef DCT_IFAST_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* Scaling decisions are generally the same as in the LL&M algorithm; + * see jfdctint.c for more details. However, we choose to descale + * (right shift) multiplication products as soon as they are formed, + * rather than carrying additional fractional bits into subsequent additions. + * This compromises accuracy slightly, but it lets us save a few shifts. + * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) + * everywhere except in the multiplications proper; this saves a good deal + * of work on 16-bit-int machines. + * + * Again to save a few shifts, the intermediate results between pass 1 and + * pass 2 are not upscaled, but are represented only to integral precision. + * + * A final compromise is to represent the multiplicative constants to only + * 8 fractional bits, rather than 13. This saves some shifting work on some + * machines, and may also reduce the cost of multiplication (since there + * are fewer one-bits in the constants). + */ + +#define CONST_BITS 8 + + +/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus + * causing a lot of useless floating-point operations at run time. + * To get around this we use the following pre-calculated constants. + * If you change CONST_BITS you may want to add appropriate values. + * (With a reasonable C compiler, you can just rely on the FIX() macro...) + */ + +#if CONST_BITS == 8 +#define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */ +#define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */ +#define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */ +#define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */ +#else +#define FIX_0_382683433 FIX(0.382683433) +#define FIX_0_541196100 FIX(0.541196100) +#define FIX_0_707106781 FIX(0.707106781) +#define FIX_1_306562965 FIX(1.306562965) +#endif + + +/* We can gain a little more speed, with a further compromise in accuracy, + * by omitting the addition in a descaling shift. This yields an incorrectly + * rounded result half the time... + */ + +#ifndef USE_ACCURATE_ROUNDING +#undef DESCALE +#define DESCALE(x,n) RIGHT_SHIFT(x, n) +#endif + + +/* Multiply a DCTELEM variable by an INT32 constant, and immediately + * descale to yield a DCTELEM result. + */ + +#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) + + +/* + * Perform the forward DCT on one block of samples. + */ + +GLOBAL(void) +jpeg_fdct_ifast (DCTELEM * data) +{ + DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + DCTELEM tmp10, tmp11, tmp12, tmp13; + DCTELEM z1, z2, z3, z4, z5, z11, z13; + DCTELEM *dataptr; + int ctr; + SHIFT_TEMPS + + /* Pass 1: process rows. */ + + dataptr = data; + for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { + tmp0 = dataptr[0] + dataptr[7]; + tmp7 = dataptr[0] - dataptr[7]; + tmp1 = dataptr[1] + dataptr[6]; + tmp6 = dataptr[1] - dataptr[6]; + tmp2 = dataptr[2] + dataptr[5]; + tmp5 = dataptr[2] - dataptr[5]; + tmp3 = dataptr[3] + dataptr[4]; + tmp4 = dataptr[3] - dataptr[4]; + + /* Even part */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + dataptr[0] = tmp10 + tmp11; /* phase 3 */ + dataptr[4] = tmp10 - tmp11; + + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ + dataptr[2] = tmp13 + z1; /* phase 5 */ + dataptr[6] = tmp13 - z1; + + /* Odd part */ + + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */ + z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */ + z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ + z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ + + z11 = tmp7 + z3; /* phase 5 */ + z13 = tmp7 - z3; + + dataptr[5] = z13 + z2; /* phase 6 */ + dataptr[3] = z13 - z2; + dataptr[1] = z11 + z4; + dataptr[7] = z11 - z4; + + dataptr += DCTSIZE; /* advance pointer to next row */ + } + + /* Pass 2: process columns. */ + + dataptr = data; + for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { + tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; + tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; + tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; + tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; + tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; + tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; + tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; + tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; + + /* Even part */ + + tmp10 = tmp0 + tmp3; /* phase 2 */ + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */ + dataptr[DCTSIZE*4] = tmp10 - tmp11; + + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */ + dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */ + dataptr[DCTSIZE*6] = tmp13 - z1; + + /* Odd part */ + + tmp10 = tmp4 + tmp5; /* phase 2 */ + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + /* The rotator is modified from fig 4-8 to avoid extra negations. */ + z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */ + z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */ + z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */ + z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */ + + z11 = tmp7 + z3; /* phase 5 */ + z13 = tmp7 - z3; + + dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */ + dataptr[DCTSIZE*3] = z13 - z2; + dataptr[DCTSIZE*1] = z11 + z4; + dataptr[DCTSIZE*7] = z11 - z4; + + dataptr++; /* advance pointer to next column */ + } +} + +#endif /* DCT_IFAST_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jfdctint.c b/src/SFML/Graphics/libjpeg/jfdctint.c new file mode 100644 index 00000000..d6269274 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jfdctint.c @@ -0,0 +1,283 @@ +/* + * jfdctint.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a slow-but-accurate integer implementation of the + * forward DCT (Discrete Cosine Transform). + * + * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT + * on each column. Direct algorithms are also available, but they are + * much more complex and seem not to be any faster when reduced to code. + * + * This implementation is based on an algorithm described in + * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT + * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, + * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. + * The primary algorithm described there uses 11 multiplies and 29 adds. + * We use their alternate method with 12 multiplies and 32 adds. + * The advantage of this method is that no data path contains more than one + * multiplication; this allows a very simple and accurate implementation in + * scaled fixed-point arithmetic, with a minimal number of shifts. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef DCT_ISLOW_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* + * The poop on this scaling stuff is as follows: + * + * Each 1-D DCT step produces outputs which are a factor of sqrt(N) + * larger than the true DCT outputs. The final outputs are therefore + * a factor of N larger than desired; since N=8 this can be cured by + * a simple right shift at the end of the algorithm. The advantage of + * this arrangement is that we save two multiplications per 1-D DCT, + * because the y0 and y4 outputs need not be divided by sqrt(N). + * In the IJG code, this factor of 8 is removed by the quantization step + * (in jcdctmgr.c), NOT in this module. + * + * We have to do addition and subtraction of the integer inputs, which + * is no problem, and multiplication by fractional constants, which is + * a problem to do in integer arithmetic. We multiply all the constants + * by CONST_SCALE and convert them to integer constants (thus retaining + * CONST_BITS bits of precision in the constants). After doing a + * multiplication we have to divide the product by CONST_SCALE, with proper + * rounding, to produce the correct output. This division can be done + * cheaply as a right shift of CONST_BITS bits. We postpone shifting + * as long as possible so that partial sums can be added together with + * full fractional precision. + * + * The outputs of the first pass are scaled up by PASS1_BITS bits so that + * they are represented to better-than-integral precision. These outputs + * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word + * with the recommended scaling. (For 12-bit sample data, the intermediate + * array is INT32 anyway.) + * + * To avoid overflow of the 32-bit intermediate results in pass 2, we must + * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis + * shows that the values given below are the most effective. + */ + +#if BITS_IN_JSAMPLE == 8 +#define CONST_BITS 13 +#define PASS1_BITS 2 +#else +#define CONST_BITS 13 +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#endif + +/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus + * causing a lot of useless floating-point operations at run time. + * To get around this we use the following pre-calculated constants. + * If you change CONST_BITS you may want to add appropriate values. + * (With a reasonable C compiler, you can just rely on the FIX() macro...) + */ + +#if CONST_BITS == 13 +#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#else +#define FIX_0_298631336 FIX(0.298631336) +#define FIX_0_390180644 FIX(0.390180644) +#define FIX_0_541196100 FIX(0.541196100) +#define FIX_0_765366865 FIX(0.765366865) +#define FIX_0_899976223 FIX(0.899976223) +#define FIX_1_175875602 FIX(1.175875602) +#define FIX_1_501321110 FIX(1.501321110) +#define FIX_1_847759065 FIX(1.847759065) +#define FIX_1_961570560 FIX(1.961570560) +#define FIX_2_053119869 FIX(2.053119869) +#define FIX_2_562915447 FIX(2.562915447) +#define FIX_3_072711026 FIX(3.072711026) +#endif + + +/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. + * For 8-bit samples with the recommended scaling, all the variable + * and constant values involved are no more than 16 bits wide, so a + * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. + * For 12-bit samples, a full 32-bit multiplication will be needed. + */ + +#if BITS_IN_JSAMPLE == 8 +#define MULTIPLY(var,const) MULTIPLY16C16(var,const) +#else +#define MULTIPLY(var,const) ((var) * (const)) +#endif + + +/* + * Perform the forward DCT on one block of samples. + */ + +GLOBAL(void) +jpeg_fdct_islow (DCTELEM * data) +{ + INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + INT32 tmp10, tmp11, tmp12, tmp13; + INT32 z1, z2, z3, z4, z5; + DCTELEM *dataptr; + int ctr; + SHIFT_TEMPS + + /* Pass 1: process rows. */ + /* Note results are scaled up by sqrt(8) compared to a true DCT; */ + /* furthermore, we scale the results by 2**PASS1_BITS. */ + + dataptr = data; + for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { + tmp0 = dataptr[0] + dataptr[7]; + tmp7 = dataptr[0] - dataptr[7]; + tmp1 = dataptr[1] + dataptr[6]; + tmp6 = dataptr[1] - dataptr[6]; + tmp2 = dataptr[2] + dataptr[5]; + tmp5 = dataptr[2] - dataptr[5]; + tmp3 = dataptr[3] + dataptr[4]; + tmp4 = dataptr[3] - dataptr[4]; + + /* Even part per LL&M figure 1 --- note that published figure is faulty; + * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". + */ + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS); + dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); + + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); + dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), + CONST_BITS-PASS1_BITS); + dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), + CONST_BITS-PASS1_BITS); + + /* Odd part per figure 8 --- note paper omits factor of sqrt(2). + * cK represents cos(K*pi/16). + * i0..i3 in the paper are tmp4..tmp7 here. + */ + + z1 = tmp4 + tmp7; + z2 = tmp5 + tmp6; + z3 = tmp4 + tmp6; + z4 = tmp5 + tmp7; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ + + tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ + tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ + tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ + tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ + z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ + z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ + z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ + z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ + + z3 += z5; + z4 += z5; + + dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS); + dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS); + dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS); + dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS); + + dataptr += DCTSIZE; /* advance pointer to next row */ + } + + /* Pass 2: process columns. + * We remove the PASS1_BITS scaling, but leave the results scaled up + * by an overall factor of 8. + */ + + dataptr = data; + for (ctr = DCTSIZE-1; ctr >= 0; ctr--) { + tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; + tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; + tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; + tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; + tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; + tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; + tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; + tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; + + /* Even part per LL&M figure 1 --- note that published figure is faulty; + * rotator "sqrt(2)*c1" should be "sqrt(2)*c6". + */ + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS); + dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS); + + z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); + dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), + CONST_BITS+PASS1_BITS); + dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), + CONST_BITS+PASS1_BITS); + + /* Odd part per figure 8 --- note paper omits factor of sqrt(2). + * cK represents cos(K*pi/16). + * i0..i3 in the paper are tmp4..tmp7 here. + */ + + z1 = tmp4 + tmp7; + z2 = tmp5 + tmp6; + z3 = tmp4 + tmp6; + z4 = tmp5 + tmp7; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ + + tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ + tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ + tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ + tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ + z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ + z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ + z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ + z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ + + z3 += z5; + z4 += z5; + + dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, + CONST_BITS+PASS1_BITS); + dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, + CONST_BITS+PASS1_BITS); + dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, + CONST_BITS+PASS1_BITS); + dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, + CONST_BITS+PASS1_BITS); + + dataptr++; /* advance pointer to next column */ + } +} + +#endif /* DCT_ISLOW_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jidctflt.c b/src/SFML/Graphics/libjpeg/jidctflt.c new file mode 100644 index 00000000..5fea54c2 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jidctflt.c @@ -0,0 +1,242 @@ +/* + * jidctflt.c + * + * Copyright (C) 1994-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a floating-point implementation of the + * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine + * must also perform dequantization of the input coefficients. + * + * This implementation should be more accurate than either of the integer + * IDCT implementations. However, it may not give the same results on all + * machines because of differences in roundoff behavior. Speed will depend + * on the hardware's floating point capacity. + * + * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT + * on each row (or vice versa, but it's more convenient to emit a row at + * a time). Direct algorithms are also available, but they are much more + * complex and seem not to be any faster when reduced to code. + * + * This implementation is based on Arai, Agui, and Nakajima's algorithm for + * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in + * Japanese, but the algorithm is described in the Pennebaker & Mitchell + * JPEG textbook (see REFERENCES section in file README). The following code + * is based directly on figure 4-8 in P&M. + * While an 8-point DCT cannot be done in less than 11 multiplies, it is + * possible to arrange the computation so that many of the multiplies are + * simple scalings of the final outputs. These multiplies can then be + * folded into the multiplications or divisions by the JPEG quantization + * table entries. The AA&N method leaves only 5 multiplies and 29 adds + * to be done in the DCT itself. + * The primary disadvantage of this method is that with a fixed-point + * implementation, accuracy is lost due to imprecise representation of the + * scaled quantization values. However, that problem does not arise if + * we use floating point arithmetic. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef DCT_FLOAT_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* Dequantize a coefficient by multiplying it by the multiplier-table + * entry; produce a float result. + */ + +#define DEQUANTIZE(coef,quantval) (((FAST_FLOAT) (coef)) * (quantval)) + + +/* + * Perform dequantization and inverse DCT on one block of coefficients. + */ + +GLOBAL(void) +jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) +{ + FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + FAST_FLOAT tmp10, tmp11, tmp12, tmp13; + FAST_FLOAT z5, z10, z11, z12, z13; + JCOEFPTR inptr; + FLOAT_MULT_TYPE * quantptr; + FAST_FLOAT * wsptr; + JSAMPROW outptr; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); + int ctr; + FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */ + SHIFT_TEMPS + + /* Pass 1: process columns from input, store into work array. */ + + inptr = coef_block; + quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table; + wsptr = workspace; + for (ctr = DCTSIZE; ctr > 0; ctr--) { + /* Due to quantization, we will usually find that many of the input + * coefficients are zero, especially the AC terms. We can exploit this + * by short-circuiting the IDCT calculation for any column in which all + * the AC terms are zero. In that case each output is equal to the + * DC coefficient (with scale factor as needed). + * With typical images and quantization tables, half or more of the + * column DCT calculations can be simplified this way. + */ + + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && + inptr[DCTSIZE*7] == 0) { + /* AC terms all zero */ + FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + + wsptr[DCTSIZE*0] = dcval; + wsptr[DCTSIZE*1] = dcval; + wsptr[DCTSIZE*2] = dcval; + wsptr[DCTSIZE*3] = dcval; + wsptr[DCTSIZE*4] = dcval; + wsptr[DCTSIZE*5] = dcval; + wsptr[DCTSIZE*6] = dcval; + wsptr[DCTSIZE*7] = dcval; + + inptr++; /* advance pointers to next column */ + quantptr++; + wsptr++; + continue; + } + + /* Even part */ + + tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); + tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); + tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); + + tmp10 = tmp0 + tmp2; /* phase 3 */ + tmp11 = tmp0 - tmp2; + + tmp13 = tmp1 + tmp3; /* phases 5-3 */ + tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */ + + tmp0 = tmp10 + tmp13; /* phase 2 */ + tmp3 = tmp10 - tmp13; + tmp1 = tmp11 + tmp12; + tmp2 = tmp11 - tmp12; + + /* Odd part */ + + tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); + tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); + tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); + tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); + + z13 = tmp6 + tmp5; /* phase 6 */ + z10 = tmp6 - tmp5; + z11 = tmp4 + tmp7; + z12 = tmp4 - tmp7; + + tmp7 = z11 + z13; /* phase 5 */ + tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */ + + z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ + tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ + tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ + + tmp6 = tmp12 - tmp7; /* phase 2 */ + tmp5 = tmp11 - tmp6; + tmp4 = tmp10 + tmp5; + + wsptr[DCTSIZE*0] = tmp0 + tmp7; + wsptr[DCTSIZE*7] = tmp0 - tmp7; + wsptr[DCTSIZE*1] = tmp1 + tmp6; + wsptr[DCTSIZE*6] = tmp1 - tmp6; + wsptr[DCTSIZE*2] = tmp2 + tmp5; + wsptr[DCTSIZE*5] = tmp2 - tmp5; + wsptr[DCTSIZE*4] = tmp3 + tmp4; + wsptr[DCTSIZE*3] = tmp3 - tmp4; + + inptr++; /* advance pointers to next column */ + quantptr++; + wsptr++; + } + + /* Pass 2: process rows from work array, store into output array. */ + /* Note that we must descale the results by a factor of 8 == 2**3. */ + + wsptr = workspace; + for (ctr = 0; ctr < DCTSIZE; ctr++) { + outptr = output_buf[ctr] + output_col; + /* Rows of zeroes can be exploited in the same way as we did with columns. + * However, the column calculation has created many nonzero AC terms, so + * the simplification applies less often (typically 5% to 10% of the time). + * And testing floats for zero is relatively expensive, so we don't bother. + */ + + /* Even part */ + + tmp10 = wsptr[0] + wsptr[4]; + tmp11 = wsptr[0] - wsptr[4]; + + tmp13 = wsptr[2] + wsptr[6]; + tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13; + + tmp0 = tmp10 + tmp13; + tmp3 = tmp10 - tmp13; + tmp1 = tmp11 + tmp12; + tmp2 = tmp11 - tmp12; + + /* Odd part */ + + z13 = wsptr[5] + wsptr[3]; + z10 = wsptr[5] - wsptr[3]; + z11 = wsptr[1] + wsptr[7]; + z12 = wsptr[1] - wsptr[7]; + + tmp7 = z11 + z13; + tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); + + z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ + tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */ + tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */ + + tmp6 = tmp12 - tmp7; + tmp5 = tmp11 - tmp6; + tmp4 = tmp10 + tmp5; + + /* Final output stage: scale down by a factor of 8 and range-limit */ + + outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3) + & RANGE_MASK]; + outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3) + & RANGE_MASK]; + outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3) + & RANGE_MASK]; + outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3) + & RANGE_MASK]; + outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3) + & RANGE_MASK]; + outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3) + & RANGE_MASK]; + outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3) + & RANGE_MASK]; + outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ + } +} + +#endif /* DCT_FLOAT_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jidctfst.c b/src/SFML/Graphics/libjpeg/jidctfst.c new file mode 100644 index 00000000..078b8c44 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jidctfst.c @@ -0,0 +1,368 @@ +/* + * jidctfst.c + * + * Copyright (C) 1994-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a fast, not so accurate integer implementation of the + * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine + * must also perform dequantization of the input coefficients. + * + * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT + * on each row (or vice versa, but it's more convenient to emit a row at + * a time). Direct algorithms are also available, but they are much more + * complex and seem not to be any faster when reduced to code. + * + * This implementation is based on Arai, Agui, and Nakajima's algorithm for + * scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in + * Japanese, but the algorithm is described in the Pennebaker & Mitchell + * JPEG textbook (see REFERENCES section in file README). The following code + * is based directly on figure 4-8 in P&M. + * While an 8-point DCT cannot be done in less than 11 multiplies, it is + * possible to arrange the computation so that many of the multiplies are + * simple scalings of the final outputs. These multiplies can then be + * folded into the multiplications or divisions by the JPEG quantization + * table entries. The AA&N method leaves only 5 multiplies and 29 adds + * to be done in the DCT itself. + * The primary disadvantage of this method is that with fixed-point math, + * accuracy is lost due to imprecise representation of the scaled + * quantization values. The smaller the quantization table entry, the less + * precise the scaled value, so this implementation does worse with high- + * quality-setting files than with low-quality ones. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef DCT_IFAST_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* Scaling decisions are generally the same as in the LL&M algorithm; + * see jidctint.c for more details. However, we choose to descale + * (right shift) multiplication products as soon as they are formed, + * rather than carrying additional fractional bits into subsequent additions. + * This compromises accuracy slightly, but it lets us save a few shifts. + * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples) + * everywhere except in the multiplications proper; this saves a good deal + * of work on 16-bit-int machines. + * + * The dequantized coefficients are not integers because the AA&N scaling + * factors have been incorporated. We represent them scaled up by PASS1_BITS, + * so that the first and second IDCT rounds have the same input scaling. + * For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to + * avoid a descaling shift; this compromises accuracy rather drastically + * for small quantization table entries, but it saves a lot of shifts. + * For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway, + * so we use a much larger scaling factor to preserve accuracy. + * + * A final compromise is to represent the multiplicative constants to only + * 8 fractional bits, rather than 13. This saves some shifting work on some + * machines, and may also reduce the cost of multiplication (since there + * are fewer one-bits in the constants). + */ + +#if BITS_IN_JSAMPLE == 8 +#define CONST_BITS 8 +#define PASS1_BITS 2 +#else +#define CONST_BITS 8 +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#endif + +/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus + * causing a lot of useless floating-point operations at run time. + * To get around this we use the following pre-calculated constants. + * If you change CONST_BITS you may want to add appropriate values. + * (With a reasonable C compiler, you can just rely on the FIX() macro...) + */ + +#if CONST_BITS == 8 +#define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */ +#define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */ +#define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */ +#define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */ +#else +#define FIX_1_082392200 FIX(1.082392200) +#define FIX_1_414213562 FIX(1.414213562) +#define FIX_1_847759065 FIX(1.847759065) +#define FIX_2_613125930 FIX(2.613125930) +#endif + + +/* We can gain a little more speed, with a further compromise in accuracy, + * by omitting the addition in a descaling shift. This yields an incorrectly + * rounded result half the time... + */ + +#ifndef USE_ACCURATE_ROUNDING +#undef DESCALE +#define DESCALE(x,n) RIGHT_SHIFT(x, n) +#endif + + +/* Multiply a DCTELEM variable by an INT32 constant, and immediately + * descale to yield a DCTELEM result. + */ + +#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS)) + + +/* Dequantize a coefficient by multiplying it by the multiplier-table + * entry; produce a DCTELEM result. For 8-bit data a 16x16->16 + * multiplication will do. For 12-bit data, the multiplier table is + * declared INT32, so a 32-bit multiply will be used. + */ + +#if BITS_IN_JSAMPLE == 8 +#define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval)) +#else +#define DEQUANTIZE(coef,quantval) \ + DESCALE((coef)*(quantval), IFAST_SCALE_BITS-PASS1_BITS) +#endif + + +/* Like DESCALE, but applies to a DCTELEM and produces an int. + * We assume that int right shift is unsigned if INT32 right shift is. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define ISHIFT_TEMPS DCTELEM ishift_temp; +#if BITS_IN_JSAMPLE == 8 +#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ +#else +#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ +#endif +#define IRIGHT_SHIFT(x,shft) \ + ((ishift_temp = (x)) < 0 ? \ + (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \ + (ishift_temp >> (shft))) +#else +#define ISHIFT_TEMPS +#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#endif + +#ifdef USE_ACCURATE_ROUNDING +#define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n)) +#else +#define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n)) +#endif + + +/* + * Perform dequantization and inverse DCT on one block of coefficients. + */ + +GLOBAL(void) +jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) +{ + DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + DCTELEM tmp10, tmp11, tmp12, tmp13; + DCTELEM z5, z10, z11, z12, z13; + JCOEFPTR inptr; + IFAST_MULT_TYPE * quantptr; + int * wsptr; + JSAMPROW outptr; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); + int ctr; + int workspace[DCTSIZE2]; /* buffers data between passes */ + SHIFT_TEMPS /* for DESCALE */ + ISHIFT_TEMPS /* for IDESCALE */ + + /* Pass 1: process columns from input, store into work array. */ + + inptr = coef_block; + quantptr = (IFAST_MULT_TYPE *) compptr->dct_table; + wsptr = workspace; + for (ctr = DCTSIZE; ctr > 0; ctr--) { + /* Due to quantization, we will usually find that many of the input + * coefficients are zero, especially the AC terms. We can exploit this + * by short-circuiting the IDCT calculation for any column in which all + * the AC terms are zero. In that case each output is equal to the + * DC coefficient (with scale factor as needed). + * With typical images and quantization tables, half or more of the + * column DCT calculations can be simplified this way. + */ + + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && + inptr[DCTSIZE*7] == 0) { + /* AC terms all zero */ + int dcval = (int) DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + + wsptr[DCTSIZE*0] = dcval; + wsptr[DCTSIZE*1] = dcval; + wsptr[DCTSIZE*2] = dcval; + wsptr[DCTSIZE*3] = dcval; + wsptr[DCTSIZE*4] = dcval; + wsptr[DCTSIZE*5] = dcval; + wsptr[DCTSIZE*6] = dcval; + wsptr[DCTSIZE*7] = dcval; + + inptr++; /* advance pointers to next column */ + quantptr++; + wsptr++; + continue; + } + + /* Even part */ + + tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); + tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); + tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); + + tmp10 = tmp0 + tmp2; /* phase 3 */ + tmp11 = tmp0 - tmp2; + + tmp13 = tmp1 + tmp3; /* phases 5-3 */ + tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; /* 2*c4 */ + + tmp0 = tmp10 + tmp13; /* phase 2 */ + tmp3 = tmp10 - tmp13; + tmp1 = tmp11 + tmp12; + tmp2 = tmp11 - tmp12; + + /* Odd part */ + + tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); + tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); + tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); + tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); + + z13 = tmp6 + tmp5; /* phase 6 */ + z10 = tmp6 - tmp5; + z11 = tmp4 + tmp7; + z12 = tmp4 - tmp7; + + tmp7 = z11 + z13; /* phase 5 */ + tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ + + z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ + tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ + tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ + + tmp6 = tmp12 - tmp7; /* phase 2 */ + tmp5 = tmp11 - tmp6; + tmp4 = tmp10 + tmp5; + + wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); + wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); + wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); + wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); + wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5); + wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); + wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); + wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); + + inptr++; /* advance pointers to next column */ + quantptr++; + wsptr++; + } + + /* Pass 2: process rows from work array, store into output array. */ + /* Note that we must descale the results by a factor of 8 == 2**3, */ + /* and also undo the PASS1_BITS scaling. */ + + wsptr = workspace; + for (ctr = 0; ctr < DCTSIZE; ctr++) { + outptr = output_buf[ctr] + output_col; + /* Rows of zeroes can be exploited in the same way as we did with columns. + * However, the column calculation has created many nonzero AC terms, so + * the simplification applies less often (typically 5% to 10% of the time). + * On machines with very fast multiplication, it's possible that the + * test takes more time than it's worth. In that case this section + * may be commented out. + */ + +#ifndef NO_ZERO_ROW_TEST + if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && + wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { + /* AC terms all zero */ + JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) + & RANGE_MASK]; + + outptr[0] = dcval; + outptr[1] = dcval; + outptr[2] = dcval; + outptr[3] = dcval; + outptr[4] = dcval; + outptr[5] = dcval; + outptr[6] = dcval; + outptr[7] = dcval; + + wsptr += DCTSIZE; /* advance pointer to next row */ + continue; + } +#endif + + /* Even part */ + + tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); + tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); + + tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); + tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) + - tmp13; + + tmp0 = tmp10 + tmp13; + tmp3 = tmp10 - tmp13; + tmp1 = tmp11 + tmp12; + tmp2 = tmp11 - tmp12; + + /* Odd part */ + + z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; + z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; + z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; + z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; + + tmp7 = z11 + z13; /* phase 5 */ + tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ + + z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ + tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ + tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ + + tmp6 = tmp12 - tmp7; /* phase 2 */ + tmp5 = tmp11 - tmp6; + tmp4 = tmp10 + tmp5; + + /* Final output stage: scale down by a factor of 8 and range-limit */ + + outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) + & RANGE_MASK]; + outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) + & RANGE_MASK]; + outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) + & RANGE_MASK]; + outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) + & RANGE_MASK]; + outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) + & RANGE_MASK]; + outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) + & RANGE_MASK]; + outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) + & RANGE_MASK]; + outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ + } +} + +#endif /* DCT_IFAST_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jidctint.c b/src/SFML/Graphics/libjpeg/jidctint.c new file mode 100644 index 00000000..4f47fe83 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jidctint.c @@ -0,0 +1,389 @@ +/* + * jidctint.c + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a slow-but-accurate integer implementation of the + * inverse DCT (Discrete Cosine Transform). In the IJG code, this routine + * must also perform dequantization of the input coefficients. + * + * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT + * on each row (or vice versa, but it's more convenient to emit a row at + * a time). Direct algorithms are also available, but they are much more + * complex and seem not to be any faster when reduced to code. + * + * This implementation is based on an algorithm described in + * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT + * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, + * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. + * The primary algorithm described there uses 11 multiplies and 29 adds. + * We use their alternate method with 12 multiplies and 32 adds. + * The advantage of this method is that no data path contains more than one + * multiplication; this allows a very simple and accurate implementation in + * scaled fixed-point arithmetic, with a minimal number of shifts. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef DCT_ISLOW_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* + * The poop on this scaling stuff is as follows: + * + * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) + * larger than the true IDCT outputs. The final outputs are therefore + * a factor of N larger than desired; since N=8 this can be cured by + * a simple right shift at the end of the algorithm. The advantage of + * this arrangement is that we save two multiplications per 1-D IDCT, + * because the y0 and y4 inputs need not be divided by sqrt(N). + * + * We have to do addition and subtraction of the integer inputs, which + * is no problem, and multiplication by fractional constants, which is + * a problem to do in integer arithmetic. We multiply all the constants + * by CONST_SCALE and convert them to integer constants (thus retaining + * CONST_BITS bits of precision in the constants). After doing a + * multiplication we have to divide the product by CONST_SCALE, with proper + * rounding, to produce the correct output. This division can be done + * cheaply as a right shift of CONST_BITS bits. We postpone shifting + * as long as possible so that partial sums can be added together with + * full fractional precision. + * + * The outputs of the first pass are scaled up by PASS1_BITS bits so that + * they are represented to better-than-integral precision. These outputs + * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word + * with the recommended scaling. (To scale up 12-bit sample data further, an + * intermediate INT32 array would be needed.) + * + * To avoid overflow of the 32-bit intermediate results in pass 2, we must + * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis + * shows that the values given below are the most effective. + */ + +#if BITS_IN_JSAMPLE == 8 +#define CONST_BITS 13 +#define PASS1_BITS 2 +#else +#define CONST_BITS 13 +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#endif + +/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus + * causing a lot of useless floating-point operations at run time. + * To get around this we use the following pre-calculated constants. + * If you change CONST_BITS you may want to add appropriate values. + * (With a reasonable C compiler, you can just rely on the FIX() macro...) + */ + +#if CONST_BITS == 13 +#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#else +#define FIX_0_298631336 FIX(0.298631336) +#define FIX_0_390180644 FIX(0.390180644) +#define FIX_0_541196100 FIX(0.541196100) +#define FIX_0_765366865 FIX(0.765366865) +#define FIX_0_899976223 FIX(0.899976223) +#define FIX_1_175875602 FIX(1.175875602) +#define FIX_1_501321110 FIX(1.501321110) +#define FIX_1_847759065 FIX(1.847759065) +#define FIX_1_961570560 FIX(1.961570560) +#define FIX_2_053119869 FIX(2.053119869) +#define FIX_2_562915447 FIX(2.562915447) +#define FIX_3_072711026 FIX(3.072711026) +#endif + + +/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. + * For 8-bit samples with the recommended scaling, all the variable + * and constant values involved are no more than 16 bits wide, so a + * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. + * For 12-bit samples, a full 32-bit multiplication will be needed. + */ + +#if BITS_IN_JSAMPLE == 8 +#define MULTIPLY(var,const) MULTIPLY16C16(var,const) +#else +#define MULTIPLY(var,const) ((var) * (const)) +#endif + + +/* Dequantize a coefficient by multiplying it by the multiplier-table + * entry; produce an int result. In this module, both inputs and result + * are 16 bits or less, so either int or short multiply will work. + */ + +#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) + + +/* + * Perform dequantization and inverse DCT on one block of coefficients. + */ + +GLOBAL(void) +jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) +{ + INT32 tmp0, tmp1, tmp2, tmp3; + INT32 tmp10, tmp11, tmp12, tmp13; + INT32 z1, z2, z3, z4, z5; + JCOEFPTR inptr; + ISLOW_MULT_TYPE * quantptr; + int * wsptr; + JSAMPROW outptr; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); + int ctr; + int workspace[DCTSIZE2]; /* buffers data between passes */ + SHIFT_TEMPS + + /* Pass 1: process columns from input, store into work array. */ + /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ + /* furthermore, we scale the results by 2**PASS1_BITS. */ + + inptr = coef_block; + quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; + wsptr = workspace; + for (ctr = DCTSIZE; ctr > 0; ctr--) { + /* Due to quantization, we will usually find that many of the input + * coefficients are zero, especially the AC terms. We can exploit this + * by short-circuiting the IDCT calculation for any column in which all + * the AC terms are zero. In that case each output is equal to the + * DC coefficient (with scale factor as needed). + * With typical images and quantization tables, half or more of the + * column DCT calculations can be simplified this way. + */ + + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && + inptr[DCTSIZE*7] == 0) { + /* AC terms all zero */ + int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; + + wsptr[DCTSIZE*0] = dcval; + wsptr[DCTSIZE*1] = dcval; + wsptr[DCTSIZE*2] = dcval; + wsptr[DCTSIZE*3] = dcval; + wsptr[DCTSIZE*4] = dcval; + wsptr[DCTSIZE*5] = dcval; + wsptr[DCTSIZE*6] = dcval; + wsptr[DCTSIZE*7] = dcval; + + inptr++; /* advance pointers to next column */ + quantptr++; + wsptr++; + continue; + } + + /* Even part: reverse the even part of the forward DCT. */ + /* The rotator is sqrt(2)*c(-6). */ + + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); + z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); + + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); + tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); + + z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); + + tmp0 = (z2 + z3) << CONST_BITS; + tmp1 = (z2 - z3) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + /* Odd part per figure 8; the matrix is unitary and hence its + * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. + */ + + tmp0 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); + tmp1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); + tmp2 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); + tmp3 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); + + z1 = tmp0 + tmp3; + z2 = tmp1 + tmp2; + z3 = tmp0 + tmp2; + z4 = tmp1 + tmp3; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ + + tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ + tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ + tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ + tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ + z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ + z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ + z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ + z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ + + wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*7] = (int) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*1] = (int) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*6] = (int) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*5] = (int) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*3] = (int) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); + wsptr[DCTSIZE*4] = (int) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); + + inptr++; /* advance pointers to next column */ + quantptr++; + wsptr++; + } + + /* Pass 2: process rows from work array, store into output array. */ + /* Note that we must descale the results by a factor of 8 == 2**3, */ + /* and also undo the PASS1_BITS scaling. */ + + wsptr = workspace; + for (ctr = 0; ctr < DCTSIZE; ctr++) { + outptr = output_buf[ctr] + output_col; + /* Rows of zeroes can be exploited in the same way as we did with columns. + * However, the column calculation has created many nonzero AC terms, so + * the simplification applies less often (typically 5% to 10% of the time). + * On machines with very fast multiplication, it's possible that the + * test takes more time than it's worth. In that case this section + * may be commented out. + */ + +#ifndef NO_ZERO_ROW_TEST + if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && + wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { + /* AC terms all zero */ + JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + & RANGE_MASK]; + + outptr[0] = dcval; + outptr[1] = dcval; + outptr[2] = dcval; + outptr[3] = dcval; + outptr[4] = dcval; + outptr[5] = dcval; + outptr[6] = dcval; + outptr[7] = dcval; + + wsptr += DCTSIZE; /* advance pointer to next row */ + continue; + } +#endif + + /* Even part: reverse the even part of the forward DCT. */ + /* The rotator is sqrt(2)*c(-6). */ + + z2 = (INT32) wsptr[2]; + z3 = (INT32) wsptr[6]; + + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); + tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); + tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); + + tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; + tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + /* Odd part per figure 8; the matrix is unitary and hence its + * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. + */ + + tmp0 = (INT32) wsptr[7]; + tmp1 = (INT32) wsptr[5]; + tmp2 = (INT32) wsptr[3]; + tmp3 = (INT32) wsptr[1]; + + z1 = tmp0 + tmp3; + z2 = tmp1 + tmp2; + z3 = tmp0 + tmp2; + z4 = tmp1 + tmp3; + z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ + + tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ + tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ + tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ + tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ + z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */ + z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ + z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ + z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */ + + z3 += z5; + z4 += z5; + + tmp0 += z1 + z3; + tmp1 += z2 + z4; + tmp2 += z2 + z3; + tmp3 += z1 + z4; + + /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ + + outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp3, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[7] = range_limit[(int) DESCALE(tmp10 - tmp3, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[1] = range_limit[(int) DESCALE(tmp11 + tmp2, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[6] = range_limit[(int) DESCALE(tmp11 - tmp2, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[2] = range_limit[(int) DESCALE(tmp12 + tmp1, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[5] = range_limit[(int) DESCALE(tmp12 - tmp1, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[3] = range_limit[(int) DESCALE(tmp13 + tmp0, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + outptr[4] = range_limit[(int) DESCALE(tmp13 - tmp0, + CONST_BITS+PASS1_BITS+3) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ + } +} + +#endif /* DCT_ISLOW_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jidctred.c b/src/SFML/Graphics/libjpeg/jidctred.c new file mode 100644 index 00000000..911899b8 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jidctred.c @@ -0,0 +1,398 @@ +/* + * jidctred.c + * + * Copyright (C) 1994-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains inverse-DCT routines that produce reduced-size output: + * either 4x4, 2x2, or 1x1 pixels from an 8x8 DCT block. + * + * The implementation is based on the Loeffler, Ligtenberg and Moschytz (LL&M) + * algorithm used in jidctint.c. We simply replace each 8-to-8 1-D IDCT step + * with an 8-to-4 step that produces the four averages of two adjacent outputs + * (or an 8-to-2 step producing two averages of four outputs, for 2x2 output). + * These steps were derived by computing the corresponding values at the end + * of the normal LL&M code, then simplifying as much as possible. + * + * 1x1 is trivial: just take the DC coefficient divided by 8. + * + * See jidctint.c for additional comments. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jdct.h" /* Private declarations for DCT subsystem */ + +#ifdef IDCT_SCALING_SUPPORTED + + +/* + * This module is specialized to the case DCTSIZE = 8. + */ + +#if DCTSIZE != 8 + Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ +#endif + + +/* Scaling is the same as in jidctint.c. */ + +#if BITS_IN_JSAMPLE == 8 +#define CONST_BITS 13 +#define PASS1_BITS 2 +#else +#define CONST_BITS 13 +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#endif + +/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus + * causing a lot of useless floating-point operations at run time. + * To get around this we use the following pre-calculated constants. + * If you change CONST_BITS you may want to add appropriate values. + * (With a reasonable C compiler, you can just rely on the FIX() macro...) + */ + +#if CONST_BITS == 13 +#define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */ +#define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */ +#define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */ +#define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */ +#define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */ +#define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */ +#else +#define FIX_0_211164243 FIX(0.211164243) +#define FIX_0_509795579 FIX(0.509795579) +#define FIX_0_601344887 FIX(0.601344887) +#define FIX_0_720959822 FIX(0.720959822) +#define FIX_0_765366865 FIX(0.765366865) +#define FIX_0_850430095 FIX(0.850430095) +#define FIX_0_899976223 FIX(0.899976223) +#define FIX_1_061594337 FIX(1.061594337) +#define FIX_1_272758580 FIX(1.272758580) +#define FIX_1_451774981 FIX(1.451774981) +#define FIX_1_847759065 FIX(1.847759065) +#define FIX_2_172734803 FIX(2.172734803) +#define FIX_2_562915447 FIX(2.562915447) +#define FIX_3_624509785 FIX(3.624509785) +#endif + + +/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. + * For 8-bit samples with the recommended scaling, all the variable + * and constant values involved are no more than 16 bits wide, so a + * 16x16->32 bit multiply can be used instead of a full 32x32 multiply. + * For 12-bit samples, a full 32-bit multiplication will be needed. + */ + +#if BITS_IN_JSAMPLE == 8 +#define MULTIPLY(var,const) MULTIPLY16C16(var,const) +#else +#define MULTIPLY(var,const) ((var) * (const)) +#endif + + +/* Dequantize a coefficient by multiplying it by the multiplier-table + * entry; produce an int result. In this module, both inputs and result + * are 16 bits or less, so either int or short multiply will work. + */ + +#define DEQUANTIZE(coef,quantval) (((ISLOW_MULT_TYPE) (coef)) * (quantval)) + + +/* + * Perform dequantization and inverse DCT on one block of coefficients, + * producing a reduced-size 4x4 output block. + */ + +GLOBAL(void) +jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) +{ + INT32 tmp0, tmp2, tmp10, tmp12; + INT32 z1, z2, z3, z4; + JCOEFPTR inptr; + ISLOW_MULT_TYPE * quantptr; + int * wsptr; + JSAMPROW outptr; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); + int ctr; + int workspace[DCTSIZE*4]; /* buffers data between passes */ + SHIFT_TEMPS + + /* Pass 1: process columns from input, store into work array. */ + + inptr = coef_block; + quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; + wsptr = workspace; + for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) { + /* Don't bother to process column 4, because second pass won't use it */ + if (ctr == DCTSIZE-4) + continue; + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && + inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*5] == 0 && + inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { + /* AC terms all zero; we need not examine term 4 for 4x4 output */ + int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; + + wsptr[DCTSIZE*0] = dcval; + wsptr[DCTSIZE*1] = dcval; + wsptr[DCTSIZE*2] = dcval; + wsptr[DCTSIZE*3] = dcval; + + continue; + } + + /* Even part */ + + tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + tmp0 <<= (CONST_BITS+1); + + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); + z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); + + tmp2 = MULTIPLY(z2, FIX_1_847759065) + MULTIPLY(z3, - FIX_0_765366865); + + tmp10 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + + /* Odd part */ + + z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); + z2 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); + z3 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); + z4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); + + tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ + + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ + + tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ + + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ + + /* Final output stage */ + + wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); + wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); + wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); + wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); + } + + /* Pass 2: process 4 rows from work array, store into output array. */ + + wsptr = workspace; + for (ctr = 0; ctr < 4; ctr++) { + outptr = output_buf[ctr] + output_col; + /* It's not clear whether a zero row test is worthwhile here ... */ + +#ifndef NO_ZERO_ROW_TEST + if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && + wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { + /* AC terms all zero */ + JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + & RANGE_MASK]; + + outptr[0] = dcval; + outptr[1] = dcval; + outptr[2] = dcval; + outptr[3] = dcval; + + wsptr += DCTSIZE; /* advance pointer to next row */ + continue; + } +#endif + + /* Even part */ + + tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1); + + tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065) + + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); + + tmp10 = tmp0 + tmp2; + tmp12 = tmp0 - tmp2; + + /* Odd part */ + + z1 = (INT32) wsptr[7]; + z2 = (INT32) wsptr[5]; + z3 = (INT32) wsptr[3]; + z4 = (INT32) wsptr[1]; + + tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ + + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + + MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ + + MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ + + tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ + + MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ + + MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ + + MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ + + /* Final output stage */ + + outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp2, + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; + outptr[3] = range_limit[(int) DESCALE(tmp10 - tmp2, + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; + outptr[1] = range_limit[(int) DESCALE(tmp12 + tmp0, + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; + outptr[2] = range_limit[(int) DESCALE(tmp12 - tmp0, + CONST_BITS+PASS1_BITS+3+1) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ + } +} + + +/* + * Perform dequantization and inverse DCT on one block of coefficients, + * producing a reduced-size 2x2 output block. + */ + +GLOBAL(void) +jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) +{ + INT32 tmp0, tmp10, z1; + JCOEFPTR inptr; + ISLOW_MULT_TYPE * quantptr; + int * wsptr; + JSAMPROW outptr; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); + int ctr; + int workspace[DCTSIZE*2]; /* buffers data between passes */ + SHIFT_TEMPS + + /* Pass 1: process columns from input, store into work array. */ + + inptr = coef_block; + quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; + wsptr = workspace; + for (ctr = DCTSIZE; ctr > 0; inptr++, quantptr++, wsptr++, ctr--) { + /* Don't bother to process columns 2,4,6 */ + if (ctr == DCTSIZE-2 || ctr == DCTSIZE-4 || ctr == DCTSIZE-6) + continue; + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*3] == 0 && + inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*7] == 0) { + /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ + int dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]) << PASS1_BITS; + + wsptr[DCTSIZE*0] = dcval; + wsptr[DCTSIZE*1] = dcval; + + continue; + } + + /* Even part */ + + z1 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); + tmp10 = z1 << (CONST_BITS+2); + + /* Odd part */ + + z1 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]); + tmp0 = MULTIPLY(z1, - FIX_0_720959822); /* sqrt(2) * (c7-c5+c3-c1) */ + z1 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]); + tmp0 += MULTIPLY(z1, FIX_0_850430095); /* sqrt(2) * (-c1+c3+c5+c7) */ + z1 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]); + tmp0 += MULTIPLY(z1, - FIX_1_272758580); /* sqrt(2) * (-c1+c3-c5-c7) */ + z1 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); + tmp0 += MULTIPLY(z1, FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ + + /* Final output stage */ + + wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); + wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); + } + + /* Pass 2: process 2 rows from work array, store into output array. */ + + wsptr = workspace; + for (ctr = 0; ctr < 2; ctr++) { + outptr = output_buf[ctr] + output_col; + /* It's not clear whether a zero row test is worthwhile here ... */ + +#ifndef NO_ZERO_ROW_TEST + if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { + /* AC terms all zero */ + JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + & RANGE_MASK]; + + outptr[0] = dcval; + outptr[1] = dcval; + + wsptr += DCTSIZE; /* advance pointer to next row */ + continue; + } +#endif + + /* Even part */ + + tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2); + + /* Odd part */ + + tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ + + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ + + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ + + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ + + /* Final output stage */ + + outptr[0] = range_limit[(int) DESCALE(tmp10 + tmp0, + CONST_BITS+PASS1_BITS+3+2) + & RANGE_MASK]; + outptr[1] = range_limit[(int) DESCALE(tmp10 - tmp0, + CONST_BITS+PASS1_BITS+3+2) + & RANGE_MASK]; + + wsptr += DCTSIZE; /* advance pointer to next row */ + } +} + + +/* + * Perform dequantization and inverse DCT on one block of coefficients, + * producing a reduced-size 1x1 output block. + */ + +GLOBAL(void) +jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col) +{ + int dcval; + ISLOW_MULT_TYPE * quantptr; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); + SHIFT_TEMPS + + /* We hardly need an inverse DCT routine for this: just take the + * average pixel value, which is one-eighth of the DC coefficient. + */ + quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; + dcval = DEQUANTIZE(coef_block[0], quantptr[0]); + dcval = (int) DESCALE((INT32) dcval, 3); + + output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; +} + +#endif /* IDCT_SCALING_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jinclude.h b/src/SFML/Graphics/libjpeg/jinclude.h new file mode 100644 index 00000000..5ff60fed --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jinclude.h @@ -0,0 +1,91 @@ +/* + * jinclude.h + * + * Copyright (C) 1991-1994, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file exists to provide a single place to fix any problems with + * including the wrong system include files. (Common problems are taken + * care of by the standard jconfig symbols, but on really weird systems + * you may have to edit this file.) + * + * NOTE: this file is NOT intended to be included by applications using the + * JPEG library. Most applications need only include jpeglib.h. + */ + + +/* Include auto-config file to find out which system include files we need. */ + +#include "jconfig.h" /* auto configuration options */ +#define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ + +/* + * We need the NULL macro and size_t typedef. + * On an ANSI-conforming system it is sufficient to include . + * Otherwise, we get them from or ; we may have to + * pull in as well. + * Note that the core JPEG library does not require ; + * only the default error handler and data source/destination modules do. + * But we must pull it in because of the references to FILE in jpeglib.h. + * You can remove those references if you want to compile without . + */ + +#ifdef HAVE_STDDEF_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef NEED_SYS_TYPES_H +#include +#endif + +#include + +/* + * We need memory copying and zeroing functions, plus strncpy(). + * ANSI and System V implementations declare these in . + * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). + * Some systems may declare memset and memcpy in . + * + * NOTE: we assume the size parameters to these functions are of type size_t. + * Change the casts in these macros if not! + */ + +#ifdef NEED_BSD_STRINGS + +#include +#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) +#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) + +#else /* not BSD, assume ANSI/SysV string lib */ + +#include +#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) +#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) + +#endif + +/* + * In ANSI C, and indeed any rational implementation, size_t is also the + * type returned by sizeof(). However, it seems there are some irrational + * implementations out there, in which sizeof() returns an int even though + * size_t is defined as long or unsigned long. To ensure consistent results + * we always use this SIZEOF() macro in place of using sizeof() directly. + */ + +#define SIZEOF(object) ((size_t) sizeof(object)) + +/* + * The modules that use fread() and fwrite() always invoke them through + * these macros. On some systems you may need to twiddle the argument casts. + * CAUTION: argument order is different from underlying functions! + */ + +#define JFREAD(file,buf,sizeofbuf) \ + ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) +#define JFWRITE(file,buf,sizeofbuf) \ + ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) diff --git a/src/SFML/Graphics/libjpeg/jmemmgr.c b/src/SFML/Graphics/libjpeg/jmemmgr.c new file mode 100644 index 00000000..b636f1be --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jmemmgr.c @@ -0,0 +1,1118 @@ +/* + * jmemmgr.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains the JPEG system-independent memory management + * routines. This code is usable across a wide variety of machines; most + * of the system dependencies have been isolated in a separate file. + * The major functions provided here are: + * * pool-based allocation and freeing of memory; + * * policy decisions about how to divide available memory among the + * virtual arrays; + * * control logic for swapping virtual arrays between main memory and + * backing storage. + * The separate system-dependent file provides the actual backing-storage + * access code, and it contains the policy decision about how much total + * main memory to use. + * This file is system-dependent in the sense that some of its functions + * are unnecessary in some systems. For example, if there is enough virtual + * memory so that backing storage will never be used, much of the virtual + * array control logic could be removed. (Of course, if you have that much + * memory then you shouldn't care about a little bit of unused code...) + */ + +#define JPEG_INTERNALS +#define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */ +#include "jinclude.h" +#include "jpeglib.h" +#include "jmemsys.h" /* import the system-dependent declarations */ + +#ifndef NO_GETENV +#ifndef HAVE_STDLIB_H /* should declare getenv() */ +extern char * getenv JPP((const char * name)); +#endif +#endif + + +/* + * Some important notes: + * The allocation routines provided here must never return NULL. + * They should exit to error_exit if unsuccessful. + * + * It's not a good idea to try to merge the sarray and barray routines, + * even though they are textually almost the same, because samples are + * usually stored as bytes while coefficients are shorts or ints. Thus, + * in machines where byte pointers have a different representation from + * word pointers, the resulting machine code could not be the same. + */ + + +/* + * Many machines require storage alignment: longs must start on 4-byte + * boundaries, doubles on 8-byte boundaries, etc. On such machines, malloc() + * always returns pointers that are multiples of the worst-case alignment + * requirement, and we had better do so too. + * There isn't any really portable way to determine the worst-case alignment + * requirement. This module assumes that the alignment requirement is + * multiples of sizeof(ALIGN_TYPE). + * By default, we define ALIGN_TYPE as double. This is necessary on some + * workstations (where doubles really do need 8-byte alignment) and will work + * fine on nearly everything. If your machine has lesser alignment needs, + * you can save a few bytes by making ALIGN_TYPE smaller. + * The only place I know of where this will NOT work is certain Macintosh + * 680x0 compilers that define double as a 10-byte IEEE extended float. + * Doing 10-byte alignment is counterproductive because longwords won't be + * aligned well. Put "#define ALIGN_TYPE long" in jconfig.h if you have + * such a compiler. + */ + +#ifndef ALIGN_TYPE /* so can override from jconfig.h */ +#define ALIGN_TYPE double +#endif + + +/* + * We allocate objects from "pools", where each pool is gotten with a single + * request to jpeg_get_small() or jpeg_get_large(). There is no per-object + * overhead within a pool, except for alignment padding. Each pool has a + * header with a link to the next pool of the same class. + * Small and large pool headers are identical except that the latter's + * link pointer must be FAR on 80x86 machines. + * Notice that the "real" header fields are union'ed with a dummy ALIGN_TYPE + * field. This forces the compiler to make SIZEOF(small_pool_hdr) a multiple + * of the alignment requirement of ALIGN_TYPE. + */ + +typedef union small_pool_struct * small_pool_ptr; + +typedef union small_pool_struct { + struct { + small_pool_ptr next; /* next in list of pools */ + size_t bytes_used; /* how many bytes already used within pool */ + size_t bytes_left; /* bytes still available in this pool */ + } hdr; + ALIGN_TYPE dummy; /* included in union to ensure alignment */ +} small_pool_hdr; + +typedef union large_pool_struct FAR * large_pool_ptr; + +typedef union large_pool_struct { + struct { + large_pool_ptr next; /* next in list of pools */ + size_t bytes_used; /* how many bytes already used within pool */ + size_t bytes_left; /* bytes still available in this pool */ + } hdr; + ALIGN_TYPE dummy; /* included in union to ensure alignment */ +} large_pool_hdr; + + +/* + * Here is the full definition of a memory manager object. + */ + +typedef struct { + struct jpeg_memory_mgr pub; /* public fields */ + + /* Each pool identifier (lifetime class) names a linked list of pools. */ + small_pool_ptr small_list[JPOOL_NUMPOOLS]; + large_pool_ptr large_list[JPOOL_NUMPOOLS]; + + /* Since we only have one lifetime class of virtual arrays, only one + * linked list is necessary (for each datatype). Note that the virtual + * array control blocks being linked together are actually stored somewhere + * in the small-pool list. + */ + jvirt_sarray_ptr virt_sarray_list; + jvirt_barray_ptr virt_barray_list; + + /* This counts total space obtained from jpeg_get_small/large */ + long total_space_allocated; + + /* alloc_sarray and alloc_barray set this value for use by virtual + * array routines. + */ + JDIMENSION last_rowsperchunk; /* from most recent alloc_sarray/barray */ +} my_memory_mgr; + +typedef my_memory_mgr * my_mem_ptr; + + +/* + * The control blocks for virtual arrays. + * Note that these blocks are allocated in the "small" pool area. + * System-dependent info for the associated backing store (if any) is hidden + * inside the backing_store_info struct. + */ + +struct jvirt_sarray_control { + JSAMPARRAY mem_buffer; /* => the in-memory buffer */ + JDIMENSION rows_in_array; /* total virtual array height */ + JDIMENSION samplesperrow; /* width of array (and of memory buffer) */ + JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */ + JDIMENSION rows_in_mem; /* height of memory buffer */ + JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ + JDIMENSION cur_start_row; /* first logical row # in the buffer */ + JDIMENSION first_undef_row; /* row # of first uninitialized row */ + boolean pre_zero; /* pre-zero mode requested? */ + boolean dirty; /* do current buffer contents need written? */ + boolean b_s_open; /* is backing-store data valid? */ + jvirt_sarray_ptr next; /* link to next virtual sarray control block */ + backing_store_info b_s_info; /* System-dependent control info */ +}; + +struct jvirt_barray_control { + JBLOCKARRAY mem_buffer; /* => the in-memory buffer */ + JDIMENSION rows_in_array; /* total virtual array height */ + JDIMENSION blocksperrow; /* width of array (and of memory buffer) */ + JDIMENSION maxaccess; /* max rows accessed by access_virt_barray */ + JDIMENSION rows_in_mem; /* height of memory buffer */ + JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ + JDIMENSION cur_start_row; /* first logical row # in the buffer */ + JDIMENSION first_undef_row; /* row # of first uninitialized row */ + boolean pre_zero; /* pre-zero mode requested? */ + boolean dirty; /* do current buffer contents need written? */ + boolean b_s_open; /* is backing-store data valid? */ + jvirt_barray_ptr next; /* link to next virtual barray control block */ + backing_store_info b_s_info; /* System-dependent control info */ +}; + + +#ifdef MEM_STATS /* optional extra stuff for statistics */ + +LOCAL(void) +print_mem_stats (j_common_ptr cinfo, int pool_id) +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + small_pool_ptr shdr_ptr; + large_pool_ptr lhdr_ptr; + + /* Since this is only a debugging stub, we can cheat a little by using + * fprintf directly rather than going through the trace message code. + * This is helpful because message parm array can't handle longs. + */ + fprintf(stderr, "Freeing pool %d, total space = %ld\n", + pool_id, mem->total_space_allocated); + + for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; + lhdr_ptr = lhdr_ptr->hdr.next) { + fprintf(stderr, " Large chunk used %ld\n", + (long) lhdr_ptr->hdr.bytes_used); + } + + for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; + shdr_ptr = shdr_ptr->hdr.next) { + fprintf(stderr, " Small chunk used %ld free %ld\n", + (long) shdr_ptr->hdr.bytes_used, + (long) shdr_ptr->hdr.bytes_left); + } +} + +#endif /* MEM_STATS */ + + +LOCAL(void) +out_of_memory (j_common_ptr cinfo, int which) +/* Report an out-of-memory error and stop execution */ +/* If we compiled MEM_STATS support, report alloc requests before dying */ +{ +#ifdef MEM_STATS + cinfo->err->trace_level = 2; /* force self_destruct to report stats */ +#endif + ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, which); +} + + +/* + * Allocation of "small" objects. + * + * For these, we use pooled storage. When a new pool must be created, + * we try to get enough space for the current request plus a "slop" factor, + * where the slop will be the amount of leftover space in the new pool. + * The speed vs. space tradeoff is largely determined by the slop values. + * A different slop value is provided for each pool class (lifetime), + * and we also distinguish the first pool of a class from later ones. + * NOTE: the values given work fairly well on both 16- and 32-bit-int + * machines, but may be too small if longs are 64 bits or more. + */ + +static const size_t first_pool_slop[JPOOL_NUMPOOLS] = +{ + 1600, /* first PERMANENT pool */ + 16000 /* first IMAGE pool */ +}; + +static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = +{ + 0, /* additional PERMANENT pools */ + 5000 /* additional IMAGE pools */ +}; + +#define MIN_SLOP 50 /* greater than 0 to avoid futile looping */ + + +METHODDEF(void *) +alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject) +/* Allocate a "small" object */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + small_pool_ptr hdr_ptr, prev_hdr_ptr; + char * data_ptr; + size_t odd_bytes, min_request, slop; + + /* Check for unsatisfiable request (do now to ensure no overflow below) */ + if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr))) + out_of_memory(cinfo, 1); /* request exceeds malloc's ability */ + + /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ + odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); + if (odd_bytes > 0) + sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; + + /* See if space is available in any existing pool */ + if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + prev_hdr_ptr = NULL; + hdr_ptr = mem->small_list[pool_id]; + while (hdr_ptr != NULL) { + if (hdr_ptr->hdr.bytes_left >= sizeofobject) + break; /* found pool with enough space */ + prev_hdr_ptr = hdr_ptr; + hdr_ptr = hdr_ptr->hdr.next; + } + + /* Time to make a new pool? */ + if (hdr_ptr == NULL) { + /* min_request is what we need now, slop is what will be leftover */ + min_request = sizeofobject + SIZEOF(small_pool_hdr); + if (prev_hdr_ptr == NULL) /* first pool in class? */ + slop = first_pool_slop[pool_id]; + else + slop = extra_pool_slop[pool_id]; + /* Don't ask for more than MAX_ALLOC_CHUNK */ + if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request)) + slop = (size_t) (MAX_ALLOC_CHUNK-min_request); + /* Try to get space, if fail reduce slop and try again */ + for (;;) { + hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop); + if (hdr_ptr != NULL) + break; + slop /= 2; + if (slop < MIN_SLOP) /* give up when it gets real small */ + out_of_memory(cinfo, 2); /* jpeg_get_small failed */ + } + mem->total_space_allocated += min_request + slop; + /* Success, initialize the new pool header and add to end of list */ + hdr_ptr->hdr.next = NULL; + hdr_ptr->hdr.bytes_used = 0; + hdr_ptr->hdr.bytes_left = sizeofobject + slop; + if (prev_hdr_ptr == NULL) /* first pool in class? */ + mem->small_list[pool_id] = hdr_ptr; + else + prev_hdr_ptr->hdr.next = hdr_ptr; + } + + /* OK, allocate the object from the current pool */ + data_ptr = (char *) (hdr_ptr + 1); /* point to first data byte in pool */ + data_ptr += hdr_ptr->hdr.bytes_used; /* point to place for object */ + hdr_ptr->hdr.bytes_used += sizeofobject; + hdr_ptr->hdr.bytes_left -= sizeofobject; + + return (void *) data_ptr; +} + + +/* + * Allocation of "large" objects. + * + * The external semantics of these are the same as "small" objects, + * except that FAR pointers are used on 80x86. However the pool + * management heuristics are quite different. We assume that each + * request is large enough that it may as well be passed directly to + * jpeg_get_large; the pool management just links everything together + * so that we can free it all on demand. + * Note: the major use of "large" objects is in JSAMPARRAY and JBLOCKARRAY + * structures. The routines that create these structures (see below) + * deliberately bunch rows together to ensure a large request size. + */ + +METHODDEF(void FAR *) +alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject) +/* Allocate a "large" object */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + large_pool_ptr hdr_ptr; + size_t odd_bytes; + + /* Check for unsatisfiable request (do now to ensure no overflow below) */ + if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr))) + out_of_memory(cinfo, 3); /* request exceeds malloc's ability */ + + /* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */ + odd_bytes = sizeofobject % SIZEOF(ALIGN_TYPE); + if (odd_bytes > 0) + sizeofobject += SIZEOF(ALIGN_TYPE) - odd_bytes; + + /* Always make a new pool */ + if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + + hdr_ptr = (large_pool_ptr) jpeg_get_large(cinfo, sizeofobject + + SIZEOF(large_pool_hdr)); + if (hdr_ptr == NULL) + out_of_memory(cinfo, 4); /* jpeg_get_large failed */ + mem->total_space_allocated += sizeofobject + SIZEOF(large_pool_hdr); + + /* Success, initialize the new pool header and add to list */ + hdr_ptr->hdr.next = mem->large_list[pool_id]; + /* We maintain space counts in each pool header for statistical purposes, + * even though they are not needed for allocation. + */ + hdr_ptr->hdr.bytes_used = sizeofobject; + hdr_ptr->hdr.bytes_left = 0; + mem->large_list[pool_id] = hdr_ptr; + + return (void FAR *) (hdr_ptr + 1); /* point to first data byte in pool */ +} + + +/* + * Creation of 2-D sample arrays. + * The pointers are in near heap, the samples themselves in FAR heap. + * + * To minimize allocation overhead and to allow I/O of large contiguous + * blocks, we allocate the sample rows in groups of as many rows as possible + * without exceeding MAX_ALLOC_CHUNK total bytes per allocation request. + * NB: the virtual array control routines, later in this file, know about + * this chunking of rows. The rowsperchunk value is left in the mem manager + * object so that it can be saved away if this sarray is the workspace for + * a virtual array. + */ + +METHODDEF(JSAMPARRAY) +alloc_sarray (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, JDIMENSION numrows) +/* Allocate a 2-D sample array */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + JSAMPARRAY result; + JSAMPROW workspace; + JDIMENSION rowsperchunk, currow, i; + long ltemp; + + /* Calculate max # of rows allowed in one allocation chunk */ + ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / + ((long) samplesperrow * SIZEOF(JSAMPLE)); + if (ltemp <= 0) + ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); + if (ltemp < (long) numrows) + rowsperchunk = (JDIMENSION) ltemp; + else + rowsperchunk = numrows; + mem->last_rowsperchunk = rowsperchunk; + + /* Get space for row pointers (small object) */ + result = (JSAMPARRAY) alloc_small(cinfo, pool_id, + (size_t) (numrows * SIZEOF(JSAMPROW))); + + /* Get the rows themselves (large objects) */ + currow = 0; + while (currow < numrows) { + rowsperchunk = MIN(rowsperchunk, numrows - currow); + workspace = (JSAMPROW) alloc_large(cinfo, pool_id, + (size_t) ((size_t) rowsperchunk * (size_t) samplesperrow + * SIZEOF(JSAMPLE))); + for (i = rowsperchunk; i > 0; i--) { + result[currow++] = workspace; + workspace += samplesperrow; + } + } + + return result; +} + + +/* + * Creation of 2-D coefficient-block arrays. + * This is essentially the same as the code for sample arrays, above. + */ + +METHODDEF(JBLOCKARRAY) +alloc_barray (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, JDIMENSION numrows) +/* Allocate a 2-D coefficient-block array */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + JBLOCKARRAY result; + JBLOCKROW workspace; + JDIMENSION rowsperchunk, currow, i; + long ltemp; + + /* Calculate max # of rows allowed in one allocation chunk */ + ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) / + ((long) blocksperrow * SIZEOF(JBLOCK)); + if (ltemp <= 0) + ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); + if (ltemp < (long) numrows) + rowsperchunk = (JDIMENSION) ltemp; + else + rowsperchunk = numrows; + mem->last_rowsperchunk = rowsperchunk; + + /* Get space for row pointers (small object) */ + result = (JBLOCKARRAY) alloc_small(cinfo, pool_id, + (size_t) (numrows * SIZEOF(JBLOCKROW))); + + /* Get the rows themselves (large objects) */ + currow = 0; + while (currow < numrows) { + rowsperchunk = MIN(rowsperchunk, numrows - currow); + workspace = (JBLOCKROW) alloc_large(cinfo, pool_id, + (size_t) ((size_t) rowsperchunk * (size_t) blocksperrow + * SIZEOF(JBLOCK))); + for (i = rowsperchunk; i > 0; i--) { + result[currow++] = workspace; + workspace += blocksperrow; + } + } + + return result; +} + + +/* + * About virtual array management: + * + * The above "normal" array routines are only used to allocate strip buffers + * (as wide as the image, but just a few rows high). Full-image-sized buffers + * are handled as "virtual" arrays. The array is still accessed a strip at a + * time, but the memory manager must save the whole array for repeated + * accesses. The intended implementation is that there is a strip buffer in + * memory (as high as is possible given the desired memory limit), plus a + * backing file that holds the rest of the array. + * + * The request_virt_array routines are told the total size of the image and + * the maximum number of rows that will be accessed at once. The in-memory + * buffer must be at least as large as the maxaccess value. + * + * The request routines create control blocks but not the in-memory buffers. + * That is postponed until realize_virt_arrays is called. At that time the + * total amount of space needed is known (approximately, anyway), so free + * memory can be divided up fairly. + * + * The access_virt_array routines are responsible for making a specific strip + * area accessible (after reading or writing the backing file, if necessary). + * Note that the access routines are told whether the caller intends to modify + * the accessed strip; during a read-only pass this saves having to rewrite + * data to disk. The access routines are also responsible for pre-zeroing + * any newly accessed rows, if pre-zeroing was requested. + * + * In current usage, the access requests are usually for nonoverlapping + * strips; that is, successive access start_row numbers differ by exactly + * num_rows = maxaccess. This means we can get good performance with simple + * buffer dump/reload logic, by making the in-memory buffer be a multiple + * of the access height; then there will never be accesses across bufferload + * boundaries. The code will still work with overlapping access requests, + * but it doesn't handle bufferload overlaps very efficiently. + */ + + +METHODDEF(jvirt_sarray_ptr) +request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, + JDIMENSION samplesperrow, JDIMENSION numrows, + JDIMENSION maxaccess) +/* Request a virtual 2-D sample array */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + jvirt_sarray_ptr result; + + /* Only IMAGE-lifetime virtual arrays are currently supported */ + if (pool_id != JPOOL_IMAGE) + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + + /* get control block */ + result = (jvirt_sarray_ptr) alloc_small(cinfo, pool_id, + SIZEOF(struct jvirt_sarray_control)); + + result->mem_buffer = NULL; /* marks array not yet realized */ + result->rows_in_array = numrows; + result->samplesperrow = samplesperrow; + result->maxaccess = maxaccess; + result->pre_zero = pre_zero; + result->b_s_open = FALSE; /* no associated backing-store object */ + result->next = mem->virt_sarray_list; /* add to list of virtual arrays */ + mem->virt_sarray_list = result; + + return result; +} + + +METHODDEF(jvirt_barray_ptr) +request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, + JDIMENSION blocksperrow, JDIMENSION numrows, + JDIMENSION maxaccess) +/* Request a virtual 2-D coefficient-block array */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + jvirt_barray_ptr result; + + /* Only IMAGE-lifetime virtual arrays are currently supported */ + if (pool_id != JPOOL_IMAGE) + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + + /* get control block */ + result = (jvirt_barray_ptr) alloc_small(cinfo, pool_id, + SIZEOF(struct jvirt_barray_control)); + + result->mem_buffer = NULL; /* marks array not yet realized */ + result->rows_in_array = numrows; + result->blocksperrow = blocksperrow; + result->maxaccess = maxaccess; + result->pre_zero = pre_zero; + result->b_s_open = FALSE; /* no associated backing-store object */ + result->next = mem->virt_barray_list; /* add to list of virtual arrays */ + mem->virt_barray_list = result; + + return result; +} + + +METHODDEF(void) +realize_virt_arrays (j_common_ptr cinfo) +/* Allocate the in-memory buffers for any unrealized virtual arrays */ +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + long space_per_minheight, maximum_space, avail_mem; + long minheights, max_minheights; + jvirt_sarray_ptr sptr; + jvirt_barray_ptr bptr; + + /* Compute the minimum space needed (maxaccess rows in each buffer) + * and the maximum space needed (full image height in each buffer). + * These may be of use to the system-dependent jpeg_mem_available routine. + */ + space_per_minheight = 0; + maximum_space = 0; + for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { + if (sptr->mem_buffer == NULL) { /* if not realized yet */ + space_per_minheight += (long) sptr->maxaccess * + (long) sptr->samplesperrow * SIZEOF(JSAMPLE); + maximum_space += (long) sptr->rows_in_array * + (long) sptr->samplesperrow * SIZEOF(JSAMPLE); + } + } + for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { + if (bptr->mem_buffer == NULL) { /* if not realized yet */ + space_per_minheight += (long) bptr->maxaccess * + (long) bptr->blocksperrow * SIZEOF(JBLOCK); + maximum_space += (long) bptr->rows_in_array * + (long) bptr->blocksperrow * SIZEOF(JBLOCK); + } + } + + if (space_per_minheight <= 0) + return; /* no unrealized arrays, no work */ + + /* Determine amount of memory to actually use; this is system-dependent. */ + avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space, + mem->total_space_allocated); + + /* If the maximum space needed is available, make all the buffers full + * height; otherwise parcel it out with the same number of minheights + * in each buffer. + */ + if (avail_mem >= maximum_space) + max_minheights = 1000000000L; + else { + max_minheights = avail_mem / space_per_minheight; + /* If there doesn't seem to be enough space, try to get the minimum + * anyway. This allows a "stub" implementation of jpeg_mem_available(). + */ + if (max_minheights <= 0) + max_minheights = 1; + } + + /* Allocate the in-memory buffers and initialize backing store as needed. */ + + for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { + if (sptr->mem_buffer == NULL) { /* if not realized yet */ + minheights = ((long) sptr->rows_in_array - 1L) / sptr->maxaccess + 1L; + if (minheights <= max_minheights) { + /* This buffer fits in memory */ + sptr->rows_in_mem = sptr->rows_in_array; + } else { + /* It doesn't fit in memory, create backing store. */ + sptr->rows_in_mem = (JDIMENSION) (max_minheights * sptr->maxaccess); + jpeg_open_backing_store(cinfo, & sptr->b_s_info, + (long) sptr->rows_in_array * + (long) sptr->samplesperrow * + (long) SIZEOF(JSAMPLE)); + sptr->b_s_open = TRUE; + } + sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE, + sptr->samplesperrow, sptr->rows_in_mem); + sptr->rowsperchunk = mem->last_rowsperchunk; + sptr->cur_start_row = 0; + sptr->first_undef_row = 0; + sptr->dirty = FALSE; + } + } + + for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { + if (bptr->mem_buffer == NULL) { /* if not realized yet */ + minheights = ((long) bptr->rows_in_array - 1L) / bptr->maxaccess + 1L; + if (minheights <= max_minheights) { + /* This buffer fits in memory */ + bptr->rows_in_mem = bptr->rows_in_array; + } else { + /* It doesn't fit in memory, create backing store. */ + bptr->rows_in_mem = (JDIMENSION) (max_minheights * bptr->maxaccess); + jpeg_open_backing_store(cinfo, & bptr->b_s_info, + (long) bptr->rows_in_array * + (long) bptr->blocksperrow * + (long) SIZEOF(JBLOCK)); + bptr->b_s_open = TRUE; + } + bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE, + bptr->blocksperrow, bptr->rows_in_mem); + bptr->rowsperchunk = mem->last_rowsperchunk; + bptr->cur_start_row = 0; + bptr->first_undef_row = 0; + bptr->dirty = FALSE; + } + } +} + + +LOCAL(void) +do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) +/* Do backing store read or write of a virtual sample array */ +{ + long bytesperrow, file_offset, byte_count, rows, thisrow, i; + + bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE); + file_offset = ptr->cur_start_row * bytesperrow; + /* Loop to read or write each allocation chunk in mem_buffer */ + for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { + /* One chunk, but check for short chunk at end of buffer */ + rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i); + /* Transfer no more than is currently defined */ + thisrow = (long) ptr->cur_start_row + i; + rows = MIN(rows, (long) ptr->first_undef_row - thisrow); + /* Transfer no more than fits in file */ + rows = MIN(rows, (long) ptr->rows_in_array - thisrow); + if (rows <= 0) /* this chunk might be past end of file! */ + break; + byte_count = rows * bytesperrow; + if (writing) + (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + else + (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + file_offset += byte_count; + } +} + + +LOCAL(void) +do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) +/* Do backing store read or write of a virtual coefficient-block array */ +{ + long bytesperrow, file_offset, byte_count, rows, thisrow, i; + + bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK); + file_offset = ptr->cur_start_row * bytesperrow; + /* Loop to read or write each allocation chunk in mem_buffer */ + for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) { + /* One chunk, but check for short chunk at end of buffer */ + rows = MIN((long) ptr->rowsperchunk, (long) ptr->rows_in_mem - i); + /* Transfer no more than is currently defined */ + thisrow = (long) ptr->cur_start_row + i; + rows = MIN(rows, (long) ptr->first_undef_row - thisrow); + /* Transfer no more than fits in file */ + rows = MIN(rows, (long) ptr->rows_in_array - thisrow); + if (rows <= 0) /* this chunk might be past end of file! */ + break; + byte_count = rows * bytesperrow; + if (writing) + (*ptr->b_s_info.write_backing_store) (cinfo, & ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + else + (*ptr->b_s_info.read_backing_store) (cinfo, & ptr->b_s_info, + (void FAR *) ptr->mem_buffer[i], + file_offset, byte_count); + file_offset += byte_count; + } +} + + +METHODDEF(JSAMPARRAY) +access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable) +/* Access the part of a virtual sample array starting at start_row */ +/* and extending for num_rows rows. writable is true if */ +/* caller intends to modify the accessed area. */ +{ + JDIMENSION end_row = start_row + num_rows; + JDIMENSION undef_row; + + /* debugging check */ + if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess || + ptr->mem_buffer == NULL) + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + + /* Make the desired part of the virtual array accessible */ + if (start_row < ptr->cur_start_row || + end_row > ptr->cur_start_row+ptr->rows_in_mem) { + if (! ptr->b_s_open) + ERREXIT(cinfo, JERR_VIRTUAL_BUG); + /* Flush old buffer contents if necessary */ + if (ptr->dirty) { + do_sarray_io(cinfo, ptr, TRUE); + ptr->dirty = FALSE; + } + /* Decide what part of virtual array to access. + * Algorithm: if target address > current window, assume forward scan, + * load starting at target address. If target address < current window, + * assume backward scan, load so that target area is top of window. + * Note that when switching from forward write to forward read, will have + * start_row = 0, so the limiting case applies and we load from 0 anyway. + */ + if (start_row > ptr->cur_start_row) { + ptr->cur_start_row = start_row; + } else { + /* use long arithmetic here to avoid overflow & unsigned problems */ + long ltemp; + + ltemp = (long) end_row - (long) ptr->rows_in_mem; + if (ltemp < 0) + ltemp = 0; /* don't fall off front end of file */ + ptr->cur_start_row = (JDIMENSION) ltemp; + } + /* Read in the selected part of the array. + * During the initial write pass, we will do no actual read + * because the selected part is all undefined. + */ + do_sarray_io(cinfo, ptr, FALSE); + } + /* Ensure the accessed part of the array is defined; prezero if needed. + * To improve locality of access, we only prezero the part of the array + * that the caller is about to access, not the entire in-memory array. + */ + if (ptr->first_undef_row < end_row) { + if (ptr->first_undef_row < start_row) { + if (writable) /* writer skipped over a section of array */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + undef_row = start_row; /* but reader is allowed to read ahead */ + } else { + undef_row = ptr->first_undef_row; + } + if (writable) + ptr->first_undef_row = end_row; + if (ptr->pre_zero) { + size_t bytesperrow = (size_t) ptr->samplesperrow * SIZEOF(JSAMPLE); + undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ + end_row -= ptr->cur_start_row; + while (undef_row < end_row) { + jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); + undef_row++; + } + } else { + if (! writable) /* reader looking at undefined data */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + } + } + /* Flag the buffer dirty if caller will write in it */ + if (writable) + ptr->dirty = TRUE; + /* Return address of proper part of the buffer */ + return ptr->mem_buffer + (start_row - ptr->cur_start_row); +} + + +METHODDEF(JBLOCKARRAY) +access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable) +/* Access the part of a virtual block array starting at start_row */ +/* and extending for num_rows rows. writable is true if */ +/* caller intends to modify the accessed area. */ +{ + JDIMENSION end_row = start_row + num_rows; + JDIMENSION undef_row; + + /* debugging check */ + if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess || + ptr->mem_buffer == NULL) + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + + /* Make the desired part of the virtual array accessible */ + if (start_row < ptr->cur_start_row || + end_row > ptr->cur_start_row+ptr->rows_in_mem) { + if (! ptr->b_s_open) + ERREXIT(cinfo, JERR_VIRTUAL_BUG); + /* Flush old buffer contents if necessary */ + if (ptr->dirty) { + do_barray_io(cinfo, ptr, TRUE); + ptr->dirty = FALSE; + } + /* Decide what part of virtual array to access. + * Algorithm: if target address > current window, assume forward scan, + * load starting at target address. If target address < current window, + * assume backward scan, load so that target area is top of window. + * Note that when switching from forward write to forward read, will have + * start_row = 0, so the limiting case applies and we load from 0 anyway. + */ + if (start_row > ptr->cur_start_row) { + ptr->cur_start_row = start_row; + } else { + /* use long arithmetic here to avoid overflow & unsigned problems */ + long ltemp; + + ltemp = (long) end_row - (long) ptr->rows_in_mem; + if (ltemp < 0) + ltemp = 0; /* don't fall off front end of file */ + ptr->cur_start_row = (JDIMENSION) ltemp; + } + /* Read in the selected part of the array. + * During the initial write pass, we will do no actual read + * because the selected part is all undefined. + */ + do_barray_io(cinfo, ptr, FALSE); + } + /* Ensure the accessed part of the array is defined; prezero if needed. + * To improve locality of access, we only prezero the part of the array + * that the caller is about to access, not the entire in-memory array. + */ + if (ptr->first_undef_row < end_row) { + if (ptr->first_undef_row < start_row) { + if (writable) /* writer skipped over a section of array */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + undef_row = start_row; /* but reader is allowed to read ahead */ + } else { + undef_row = ptr->first_undef_row; + } + if (writable) + ptr->first_undef_row = end_row; + if (ptr->pre_zero) { + size_t bytesperrow = (size_t) ptr->blocksperrow * SIZEOF(JBLOCK); + undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */ + end_row -= ptr->cur_start_row; + while (undef_row < end_row) { + jzero_far((void FAR *) ptr->mem_buffer[undef_row], bytesperrow); + undef_row++; + } + } else { + if (! writable) /* reader looking at undefined data */ + ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS); + } + } + /* Flag the buffer dirty if caller will write in it */ + if (writable) + ptr->dirty = TRUE; + /* Return address of proper part of the buffer */ + return ptr->mem_buffer + (start_row - ptr->cur_start_row); +} + + +/* + * Release all objects belonging to a specified pool. + */ + +METHODDEF(void) +free_pool (j_common_ptr cinfo, int pool_id) +{ + my_mem_ptr mem = (my_mem_ptr) cinfo->mem; + small_pool_ptr shdr_ptr; + large_pool_ptr lhdr_ptr; + size_t space_freed; + + if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS) + ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */ + +#ifdef MEM_STATS + if (cinfo->err->trace_level > 1) + print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */ +#endif + + /* If freeing IMAGE pool, close any virtual arrays first */ + if (pool_id == JPOOL_IMAGE) { + jvirt_sarray_ptr sptr; + jvirt_barray_ptr bptr; + + for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) { + if (sptr->b_s_open) { /* there may be no backing store */ + sptr->b_s_open = FALSE; /* prevent recursive close if error */ + (*sptr->b_s_info.close_backing_store) (cinfo, & sptr->b_s_info); + } + } + mem->virt_sarray_list = NULL; + for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) { + if (bptr->b_s_open) { /* there may be no backing store */ + bptr->b_s_open = FALSE; /* prevent recursive close if error */ + (*bptr->b_s_info.close_backing_store) (cinfo, & bptr->b_s_info); + } + } + mem->virt_barray_list = NULL; + } + + /* Release large objects */ + lhdr_ptr = mem->large_list[pool_id]; + mem->large_list[pool_id] = NULL; + + while (lhdr_ptr != NULL) { + large_pool_ptr next_lhdr_ptr = lhdr_ptr->hdr.next; + space_freed = lhdr_ptr->hdr.bytes_used + + lhdr_ptr->hdr.bytes_left + + SIZEOF(large_pool_hdr); + jpeg_free_large(cinfo, (void FAR *) lhdr_ptr, space_freed); + mem->total_space_allocated -= space_freed; + lhdr_ptr = next_lhdr_ptr; + } + + /* Release small objects */ + shdr_ptr = mem->small_list[pool_id]; + mem->small_list[pool_id] = NULL; + + while (shdr_ptr != NULL) { + small_pool_ptr next_shdr_ptr = shdr_ptr->hdr.next; + space_freed = shdr_ptr->hdr.bytes_used + + shdr_ptr->hdr.bytes_left + + SIZEOF(small_pool_hdr); + jpeg_free_small(cinfo, (void *) shdr_ptr, space_freed); + mem->total_space_allocated -= space_freed; + shdr_ptr = next_shdr_ptr; + } +} + + +/* + * Close up shop entirely. + * Note that this cannot be called unless cinfo->mem is non-NULL. + */ + +METHODDEF(void) +self_destruct (j_common_ptr cinfo) +{ + int pool; + + /* Close all backing store, release all memory. + * Releasing pools in reverse order might help avoid fragmentation + * with some (brain-damaged) malloc libraries. + */ + for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) { + free_pool(cinfo, pool); + } + + /* Release the memory manager control block too. */ + jpeg_free_small(cinfo, (void *) cinfo->mem, SIZEOF(my_memory_mgr)); + cinfo->mem = NULL; /* ensures I will be called only once */ + + jpeg_mem_term(cinfo); /* system-dependent cleanup */ +} + + +/* + * Memory manager initialization. + * When this is called, only the error manager pointer is valid in cinfo! + */ + +GLOBAL(void) +jinit_memory_mgr (j_common_ptr cinfo) +{ + my_mem_ptr mem; + long max_to_use; + int pool; + size_t test_mac; + + cinfo->mem = NULL; /* for safety if init fails */ + + /* Check for configuration errors. + * SIZEOF(ALIGN_TYPE) should be a power of 2; otherwise, it probably + * doesn't reflect any real hardware alignment requirement. + * The test is a little tricky: for X>0, X and X-1 have no one-bits + * in common if and only if X is a power of 2, ie has only one one-bit. + * Some compilers may give an "unreachable code" warning here; ignore it. + */ + if ((SIZEOF(ALIGN_TYPE) & (SIZEOF(ALIGN_TYPE)-1)) != 0) + ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE); + /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be + * a multiple of SIZEOF(ALIGN_TYPE). + * Again, an "unreachable code" warning may be ignored here. + * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK. + */ + test_mac = (size_t) MAX_ALLOC_CHUNK; + if ((long) test_mac != MAX_ALLOC_CHUNK || + (MAX_ALLOC_CHUNK % SIZEOF(ALIGN_TYPE)) != 0) + ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK); + + max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */ + + /* Attempt to allocate memory manager's control block */ + mem = (my_mem_ptr) jpeg_get_small(cinfo, SIZEOF(my_memory_mgr)); + + if (mem == NULL) { + jpeg_mem_term(cinfo); /* system-dependent cleanup */ + ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0); + } + + /* OK, fill in the method pointers */ + mem->pub.alloc_small = alloc_small; + mem->pub.alloc_large = alloc_large; + mem->pub.alloc_sarray = alloc_sarray; + mem->pub.alloc_barray = alloc_barray; + mem->pub.request_virt_sarray = request_virt_sarray; + mem->pub.request_virt_barray = request_virt_barray; + mem->pub.realize_virt_arrays = realize_virt_arrays; + mem->pub.access_virt_sarray = access_virt_sarray; + mem->pub.access_virt_barray = access_virt_barray; + mem->pub.free_pool = free_pool; + mem->pub.self_destruct = self_destruct; + + /* Make MAX_ALLOC_CHUNK accessible to other modules */ + mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK; + + /* Initialize working state */ + mem->pub.max_memory_to_use = max_to_use; + + for (pool = JPOOL_NUMPOOLS-1; pool >= JPOOL_PERMANENT; pool--) { + mem->small_list[pool] = NULL; + mem->large_list[pool] = NULL; + } + mem->virt_sarray_list = NULL; + mem->virt_barray_list = NULL; + + mem->total_space_allocated = SIZEOF(my_memory_mgr); + + /* Declare ourselves open for business */ + cinfo->mem = & mem->pub; + + /* Check for an environment variable JPEGMEM; if found, override the + * default max_memory setting from jpeg_mem_init. Note that the + * surrounding application may again override this value. + * If your system doesn't support getenv(), define NO_GETENV to disable + * this feature. + */ +#ifndef NO_GETENV + { char * memenv; + + if ((memenv = getenv("JPEGMEM")) != NULL) { + char ch = 'x'; + + if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) { + if (ch == 'm' || ch == 'M') + max_to_use *= 1000L; + mem->pub.max_memory_to_use = max_to_use * 1000L; + } + } + } +#endif + +} diff --git a/src/SFML/Graphics/libjpeg/jmemnobs.c b/src/SFML/Graphics/libjpeg/jmemnobs.c new file mode 100644 index 00000000..6aa1e929 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jmemnobs.c @@ -0,0 +1,109 @@ +/* + * jmemnobs.c + * + * Copyright (C) 1992-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file provides a really simple implementation of the system- + * dependent portion of the JPEG memory manager. This implementation + * assumes that no backing-store files are needed: all required space + * can be obtained from malloc(). + * This is very portable in the sense that it'll compile on almost anything, + * but you'd better have lots of main memory (or virtual memory) if you want + * to process big images. + * Note that the max_memory_to_use option is ignored by this implementation. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" +#include "jmemsys.h" /* import the system-dependent declarations */ + +#ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ +extern void * malloc JPP((size_t size)); +extern void free JPP((void *ptr)); +#endif + + +/* + * Memory allocation and freeing are controlled by the regular library + * routines malloc() and free(). + */ + +GLOBAL(void *) +jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) +{ + return (void *) malloc(sizeofobject); +} + +GLOBAL(void) +jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) +{ + free(object); +} + + +/* + * "Large" objects are treated the same as "small" ones. + * NB: although we include FAR keywords in the routine declarations, + * this file won't actually work in 80x86 small/medium model; at least, + * you probably won't be able to process useful-size images in only 64KB. + */ + +GLOBAL(void FAR *) +jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) +{ + return (void FAR *) malloc(sizeofobject); +} + +GLOBAL(void) +jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) +{ + free(object); +} + + +/* + * This routine computes the total memory space available for allocation. + * Here we always say, "we got all you want bud!" + */ + +GLOBAL(long) +jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, + long max_bytes_needed, long already_allocated) +{ + return max_bytes_needed; +} + + +/* + * Backing store (temporary file) management. + * Since jpeg_mem_available always promised the moon, + * this should never be called and we can just error out. + */ + +GLOBAL(void) +jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, + long total_bytes_needed) +{ + ERREXIT(cinfo, JERR_NO_BACKING_STORE); +} + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. Here, there isn't any. + */ + +GLOBAL(long) +jpeg_mem_init (j_common_ptr cinfo) +{ + return 0; /* just set max_memory_to_use to 0 */ +} + +GLOBAL(void) +jpeg_mem_term (j_common_ptr cinfo) +{ + /* no work */ +} diff --git a/src/SFML/Graphics/libjpeg/jmemsys.h b/src/SFML/Graphics/libjpeg/jmemsys.h new file mode 100644 index 00000000..2a879611 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jmemsys.h @@ -0,0 +1,198 @@ +/* + * jmemsys.h + * + * Copyright (C) 1992-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This include file defines the interface between the system-independent + * and system-dependent portions of the JPEG memory manager. No other + * modules need include it. (The system-independent portion is jmemmgr.c; + * there are several different versions of the system-dependent portion.) + * + * This file works as-is for the system-dependent memory managers supplied + * in the IJG distribution. You may need to modify it if you write a + * custom memory manager. If system-dependent changes are needed in + * this file, the best method is to #ifdef them based on a configuration + * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR + * and USE_MAC_MEMMGR. + */ + + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_get_small jGetSmall +#define jpeg_free_small jFreeSmall +#define jpeg_get_large jGetLarge +#define jpeg_free_large jFreeLarge +#define jpeg_mem_available jMemAvail +#define jpeg_open_backing_store jOpenBackStore +#define jpeg_mem_init jMemInit +#define jpeg_mem_term jMemTerm +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* + * These two functions are used to allocate and release small chunks of + * memory. (Typically the total amount requested through jpeg_get_small is + * no more than 20K or so; this will be requested in chunks of a few K each.) + * Behavior should be the same as for the standard library functions malloc + * and free; in particular, jpeg_get_small must return NULL on failure. + * On most systems, these ARE malloc and free. jpeg_free_small is passed the + * size of the object being freed, just in case it's needed. + * On an 80x86 machine using small-data memory model, these manage near heap. + */ + +EXTERN(void *) jpeg_get_small JPP((j_common_ptr cinfo, size_t sizeofobject)); +EXTERN(void) jpeg_free_small JPP((j_common_ptr cinfo, void * object, + size_t sizeofobject)); + +/* + * These two functions are used to allocate and release large chunks of + * memory (up to the total free space designated by jpeg_mem_available). + * The interface is the same as above, except that on an 80x86 machine, + * far pointers are used. On most other machines these are identical to + * the jpeg_get/free_small routines; but we keep them separate anyway, + * in case a different allocation strategy is desirable for large chunks. + */ + +EXTERN(void FAR *) jpeg_get_large JPP((j_common_ptr cinfo, + size_t sizeofobject)); +EXTERN(void) jpeg_free_large JPP((j_common_ptr cinfo, void FAR * object, + size_t sizeofobject)); + +/* + * The macro MAX_ALLOC_CHUNK designates the maximum number of bytes that may + * be requested in a single call to jpeg_get_large (and jpeg_get_small for that + * matter, but that case should never come into play). This macro is needed + * to model the 64Kb-segment-size limit of far addressing on 80x86 machines. + * On those machines, we expect that jconfig.h will provide a proper value. + * On machines with 32-bit flat address spaces, any large constant may be used. + * + * NB: jmemmgr.c expects that MAX_ALLOC_CHUNK will be representable as type + * size_t and will be a multiple of sizeof(align_type). + */ + +#ifndef MAX_ALLOC_CHUNK /* may be overridden in jconfig.h */ +#define MAX_ALLOC_CHUNK 1000000000L +#endif + +/* + * This routine computes the total space still available for allocation by + * jpeg_get_large. If more space than this is needed, backing store will be + * used. NOTE: any memory already allocated must not be counted. + * + * There is a minimum space requirement, corresponding to the minimum + * feasible buffer sizes; jmemmgr.c will request that much space even if + * jpeg_mem_available returns zero. The maximum space needed, enough to hold + * all working storage in memory, is also passed in case it is useful. + * Finally, the total space already allocated is passed. If no better + * method is available, cinfo->mem->max_memory_to_use - already_allocated + * is often a suitable calculation. + * + * It is OK for jpeg_mem_available to underestimate the space available + * (that'll just lead to more backing-store access than is really necessary). + * However, an overestimate will lead to failure. Hence it's wise to subtract + * a slop factor from the true available space. 5% should be enough. + * + * On machines with lots of virtual memory, any large constant may be returned. + * Conversely, zero may be returned to always use the minimum amount of memory. + */ + +EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo, + long min_bytes_needed, + long max_bytes_needed, + long already_allocated)); + + +/* + * This structure holds whatever state is needed to access a single + * backing-store object. The read/write/close method pointers are called + * by jmemmgr.c to manipulate the backing-store object; all other fields + * are private to the system-dependent backing store routines. + */ + +#define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ + + +#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ + +typedef unsigned short XMSH; /* type of extended-memory handles */ +typedef unsigned short EMSH; /* type of expanded-memory handles */ + +typedef union { + short file_handle; /* DOS file handle if it's a temp file */ + XMSH xms_handle; /* handle if it's a chunk of XMS */ + EMSH ems_handle; /* handle if it's a chunk of EMS */ +} handle_union; + +#endif /* USE_MSDOS_MEMMGR */ + +#ifdef USE_MAC_MEMMGR /* Mac-specific junk */ +#include +#endif /* USE_MAC_MEMMGR */ + + +typedef struct backing_store_struct * backing_store_ptr; + +typedef struct backing_store_struct { + /* Methods for reading/writing/closing this backing-store object */ + JMETHOD(void, read_backing_store, (j_common_ptr cinfo, + backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); + JMETHOD(void, write_backing_store, (j_common_ptr cinfo, + backing_store_ptr info, + void FAR * buffer_address, + long file_offset, long byte_count)); + JMETHOD(void, close_backing_store, (j_common_ptr cinfo, + backing_store_ptr info)); + + /* Private fields for system-dependent backing-store management */ +#ifdef USE_MSDOS_MEMMGR + /* For the MS-DOS manager (jmemdos.c), we need: */ + handle_union handle; /* reference to backing-store storage object */ + char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ +#else +#ifdef USE_MAC_MEMMGR + /* For the Mac manager (jmemmac.c), we need: */ + short temp_file; /* file reference number to temp file */ + FSSpec tempSpec; /* the FSSpec for the temp file */ + char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ +#else + /* For a typical implementation with temp files, we need: */ + FILE * temp_file; /* stdio reference to temp file */ + char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ +#endif +#endif +} backing_store_info; + + +/* + * Initial opening of a backing-store object. This must fill in the + * read/write/close pointers in the object. The read/write routines + * may take an error exit if the specified maximum file size is exceeded. + * (If jpeg_mem_available always returns a large value, this routine can + * just take an error exit.) + */ + +EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, + backing_store_ptr info, + long total_bytes_needed)); + + +/* + * These routines take care of any system-dependent initialization and + * cleanup required. jpeg_mem_init will be called before anything is + * allocated (and, therefore, nothing in cinfo is of use except the error + * manager pointer). It should return a suitable default value for + * max_memory_to_use; this may subsequently be overridden by the surrounding + * application. (Note that max_memory_to_use is only important if + * jpeg_mem_available chooses to consult it ... no one else will.) + * jpeg_mem_term may assume that all requested memory has been freed and that + * all opened backing-store objects have been closed. + */ + +EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); diff --git a/src/SFML/Graphics/libjpeg/jmorecfg.h b/src/SFML/Graphics/libjpeg/jmorecfg.h new file mode 100644 index 00000000..c856e226 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jmorecfg.h @@ -0,0 +1,363 @@ +/* + * jmorecfg.h + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains additional configuration options that customize the + * JPEG software for special applications or support machine-dependent + * optimizations. Most users will not need to touch this file. + */ + + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ + + +/* + * Maximum number of components (color channels) allowed in JPEG image. + * To meet the letter of the JPEG spec, set this to 255. However, darn + * few applications need more than 4 channels (maybe 5 for CMYK + alpha + * mask). We recommend 10 as a reasonable compromise; use 4 if you are + * really short on memory. (Each allowed component costs a hundred or so + * bytes of storage, whether actually used in an image or not.) + */ + +#define MAX_COMPONENTS 10 /* maximum number of image components */ + + +/* + * Basic data types. + * You may need to change these if you have a machine with unusual data + * type sizes; for example, "char" not 8 bits, "short" not 16 bits, + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, + * but it had better be at least 16. + */ + +/* Representation of a single sample (pixel element value). + * We frequently allocate large arrays of these, so it's important to keep + * them small. But if you have memory to burn and access to char or short + * arrays is very slow on your hardware, you might want to change these. + */ + +#if BITS_IN_JSAMPLE == 8 +/* JSAMPLE should be the smallest type that will hold the values 0..255. + * You can use a signed char by having GETJSAMPLE mask it with 0xFF. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JSAMPLE; +#define GETJSAMPLE(value) ((int) (value)) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JSAMPLE; +#ifdef CHAR_IS_UNSIGNED +#define GETJSAMPLE(value) ((int) (value)) +#else +#define GETJSAMPLE(value) ((int) (value) & 0xFF) +#endif /* CHAR_IS_UNSIGNED */ + +#endif /* HAVE_UNSIGNED_CHAR */ + +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 + +#endif /* BITS_IN_JSAMPLE == 8 */ + + +#if BITS_IN_JSAMPLE == 12 +/* JSAMPLE should be the smallest type that will hold the values 0..4095. + * On nearly all machines "short" will do nicely. + */ + +typedef short JSAMPLE; +#define GETJSAMPLE(value) ((int) (value)) + +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 + +#endif /* BITS_IN_JSAMPLE == 12 */ + + +/* Representation of a DCT frequency coefficient. + * This should be a signed value of at least 16 bits; "short" is usually OK. + * Again, we allocate large arrays of these, but you can change to int + * if you have memory to burn and "short" is really slow. + */ + +typedef short JCOEF; + + +/* Compressed datastreams are represented as arrays of JOCTET. + * These must be EXACTLY 8 bits wide, at least once they are written to + * external storage. Note that when using the stdio data source/destination + * managers, this is also the data type passed to fread/fwrite. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JOCTET; +#define GETJOCTET(value) (value) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JOCTET; +#ifdef CHAR_IS_UNSIGNED +#define GETJOCTET(value) (value) +#else +#define GETJOCTET(value) ((value) & 0xFF) +#endif /* CHAR_IS_UNSIGNED */ + +#endif /* HAVE_UNSIGNED_CHAR */ + + +/* These typedefs are used for various table entries and so forth. + * They must be at least as wide as specified; but making them too big + * won't cost a huge amount of memory, so we don't provide special + * extraction code like we did for JSAMPLE. (In other words, these + * typedefs live at a different point on the speed/space tradeoff curve.) + */ + +/* UINT8 must hold at least the values 0..255. */ + +#ifdef HAVE_UNSIGNED_CHAR +typedef unsigned char UINT8; +#else /* not HAVE_UNSIGNED_CHAR */ +#ifdef CHAR_IS_UNSIGNED +typedef char UINT8; +#else /* not CHAR_IS_UNSIGNED */ +typedef short UINT8; +#endif /* CHAR_IS_UNSIGNED */ +#endif /* HAVE_UNSIGNED_CHAR */ + +/* UINT16 must hold at least the values 0..65535. */ + +#ifdef HAVE_UNSIGNED_SHORT +typedef unsigned short UINT16; +#else /* not HAVE_UNSIGNED_SHORT */ +typedef unsigned int UINT16; +#endif /* HAVE_UNSIGNED_SHORT */ + +/* INT16 must hold at least the values -32768..32767. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ +typedef short INT16; +#endif + +/* INT32 must hold at least signed 32-bit values. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +typedef long INT32; +#endif + +/* Datatype used for image dimensions. The JPEG standard only supports + * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore + * "unsigned int" is sufficient on all machines. However, if you need to + * handle larger images and you don't mind deviating from the spec, you + * can change this datatype. + */ + +typedef unsigned int JDIMENSION; + +#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ + + +/* These macros are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions; + * in particular, you'll need to do that to make the library a Windows DLL. + * Another application is to make all functions global for use with debuggers + * or code profilers that require it. + */ + +/* a function called through method pointers: */ +#define METHODDEF(type) static type +/* a function used only in its module: */ +#define LOCAL(type) static type +/* a function referenced thru EXTERNs: */ +#define GLOBAL(type) type +/* a reference to a GLOBAL function: */ +#define EXTERN(type) extern type + + +/* This macro is used to declare a "method", that is, a function pointer. + * We want to supply prototype parameters if the compiler can cope. + * Note that the arglist parameter must be parenthesized! + * Again, you can customize this if you need special linkage keywords. + */ + +#ifdef HAVE_PROTOTYPES +#define JMETHOD(type,methodname,arglist) type (*methodname) arglist +#else +#define JMETHOD(type,methodname,arglist) type (*methodname) () +#endif + + +/* Here is the pseudo-keyword for declaring pointers that must be "far" + * on 80x86 machines. Most of the specialized coding for 80x86 is handled + * by just saying "FAR *" where such a pointer is needed. In a few places + * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. + */ + +#ifdef NEED_FAR_POINTERS +#define FAR far +#else +#define FAR +#endif + + +/* + * On a few systems, type boolean and/or its values FALSE, TRUE may appear + * in standard header files. Or you may have conflicts with application- + * specific header files that you want to include together with these files. + * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. + */ + +#ifndef HAVE_BOOLEAN +typedef int boolean; +#endif +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ +#endif +#ifndef TRUE +#define TRUE 1 +#endif + + +/* + * The remaining options affect code selection within the JPEG library, + * but they don't need to be visible to most applications using the library. + * To minimize application namespace pollution, the symbols won't be + * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. + */ + +#ifdef JPEG_INTERNALS +#define JPEG_INTERNAL_OPTIONS +#endif + +#ifdef JPEG_INTERNAL_OPTIONS + + +/* + * These defines indicate whether to include various optional functions. + * Undefining some of these symbols will produce a smaller but less capable + * library. Note that you can leave certain source files out of the + * compilation/linking process if you've #undef'd the corresponding symbols. + * (You may HAVE to do that if your compiler doesn't like null source files.) + */ + +/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ + +/* Capability options common to encoder and decoder: */ + +#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ +#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ +#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ + +/* Encoder capability options: */ + +#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +/* Note: if you selected 12-bit data precision, it is dangerous to turn off + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit + * precision, so jchuff.c normally uses entropy optimization to compute + * usable tables for higher precision. If you don't want to do optimization, + * you'll have to supply different default Huffman tables. + * The exact same statements apply for progressive JPEG: the default tables + * don't work for progressive mode. (This may get fixed, however.) + */ +#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ + +/* Decoder capability options: */ + +#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ +#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ +#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ + +/* more capability options later, no doubt */ + + +/* + * Ordering of RGB data in scanlines passed to or from the application. + * If your application wants to deal with data in the order B,G,R, just + * change these macros. You can also deal with formats such as R,G,B,X + * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing + * the offsets will also change the order in which colormap data is organized. + * RESTRICTIONS: + * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. + * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not + * useful if you are using JPEG color spaces other than YCbCr or grayscale. + * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE + * is not 3 (they don't understand about dummy color components!). So you + * can't use color quantization if you change that value. + */ + +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 2 /* Offset of Blue */ +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ + + +/* Definitions for speed-related optimizations. */ + + +/* If your compiler supports inline functions, define INLINE + * as the inline keyword; otherwise define it as empty. + */ + +#ifndef INLINE +#ifdef __GNUC__ /* for instance, GNU C knows about inline */ +#define INLINE __inline__ +#endif +#ifndef INLINE +#define INLINE /* default is to define it as empty */ +#endif +#endif + + +/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying + * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER + * as short on such a machine. MULTIPLIER must be at least 16 bits wide. + */ + +#ifndef MULTIPLIER +#define MULTIPLIER int /* type for fastest integer multiply */ +#endif + + +/* FAST_FLOAT should be either float or double, whichever is done faster + * by your compiler. (Note that this type is only used in the floating point + * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) + * Typically, float is faster in ANSI C compilers, while double is faster in + * pre-ANSI compilers (because they insist on converting to double anyway). + * The code below therefore chooses float if we have ANSI-style prototypes. + */ + +#ifndef FAST_FLOAT +#ifdef HAVE_PROTOTYPES +#define FAST_FLOAT float +#else +#define FAST_FLOAT double +#endif +#endif + +#endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/src/SFML/Graphics/libjpeg/jpegint.h b/src/SFML/Graphics/libjpeg/jpegint.h new file mode 100644 index 00000000..685a3610 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jpegint.h @@ -0,0 +1,392 @@ +/* + * jpegint.h + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file provides common declarations for the various JPEG modules. + * These declarations are considered internal to the JPEG library; most + * applications using the library shouldn't need to include this file. + */ + + +/* Declarations for both compression & decompression */ + +typedef enum { /* Operating modes for buffer controllers */ + JBUF_PASS_THRU, /* Plain stripwise operation */ + /* Remaining modes require a full-image buffer to have been created */ + JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ + JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ + JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ +} J_BUF_MODE; + +/* Values of global_state field (jdapi.c has some dependencies on ordering!) */ +#define CSTATE_START 100 /* after create_compress */ +#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ +#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ +#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ +#define DSTATE_START 200 /* after create_decompress */ +#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ +#define DSTATE_READY 202 /* found SOS, ready for start_decompress */ +#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ +#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ +#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ +#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ +#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ +#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ +#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ +#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ + + +/* Declarations for compression modules */ + +/* Master control module */ +struct jpeg_comp_master { + JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); + JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); + JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); + + /* State variables made visible to other modules */ + boolean call_pass_startup; /* True if pass_startup must be called */ + boolean is_last_pass; /* True during last pass */ +}; + +/* Main buffer control (downsampled-data buffer) */ +struct jpeg_c_main_controller { + JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); + JMETHOD(void, process_data, (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail)); +}; + +/* Compression preprocessing (downsampling input buffer control) */ +struct jpeg_c_prep_controller { + JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); + JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, + JSAMPARRAY input_buf, + JDIMENSION *in_row_ctr, + JDIMENSION in_rows_avail, + JSAMPIMAGE output_buf, + JDIMENSION *out_row_group_ctr, + JDIMENSION out_row_groups_avail)); +}; + +/* Coefficient buffer control */ +struct jpeg_c_coef_controller { + JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); + JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, + JSAMPIMAGE input_buf)); +}; + +/* Colorspace conversion */ +struct jpeg_color_converter { + JMETHOD(void, start_pass, (j_compress_ptr cinfo)); + JMETHOD(void, color_convert, (j_compress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPIMAGE output_buf, + JDIMENSION output_row, int num_rows)); +}; + +/* Downsampling */ +struct jpeg_downsampler { + JMETHOD(void, start_pass, (j_compress_ptr cinfo)); + JMETHOD(void, downsample, (j_compress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION in_row_index, + JSAMPIMAGE output_buf, + JDIMENSION out_row_group_index)); + + boolean need_context_rows; /* TRUE if need rows above & below */ +}; + +/* Forward DCT (also controls coefficient quantization) */ +struct jpeg_forward_dct { + JMETHOD(void, start_pass, (j_compress_ptr cinfo)); + /* perhaps this should be an array??? */ + JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, + jpeg_component_info * compptr, + JSAMPARRAY sample_data, JBLOCKROW coef_blocks, + JDIMENSION start_row, JDIMENSION start_col, + JDIMENSION num_blocks)); +}; + +/* Entropy encoding */ +struct jpeg_entropy_encoder { + JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); + JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); + JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); +}; + +/* Marker writing */ +struct jpeg_marker_writer { + JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); + JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); + JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); + JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); + JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); + /* These routines are exported to allow insertion of extra markers */ + /* Probably only COM and APPn markers should be written this way */ + JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, + unsigned int datalen)); + JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); +}; + + +/* Declarations for decompression modules */ + +/* Master control module */ +struct jpeg_decomp_master { + JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); + JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); + + /* State variables made visible to other modules */ + boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ +}; + +/* Input control module */ +struct jpeg_input_controller { + JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); + JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); + JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); + JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); + + /* State variables made visible to other modules */ + boolean has_multiple_scans; /* True if file has multiple scans */ + boolean eoi_reached; /* True when EOI has been consumed */ +}; + +/* Main buffer control (downsampled-data buffer) */ +struct jpeg_d_main_controller { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); + JMETHOD(void, process_data, (j_decompress_ptr cinfo, + JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); +}; + +/* Coefficient buffer control */ +struct jpeg_d_coef_controller { + JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); + JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); + JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); + JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, + JSAMPIMAGE output_buf)); + /* Pointer to array of coefficient virtual arrays, or NULL if none */ + jvirt_barray_ptr *coef_arrays; +}; + +/* Decompression postprocessing (color quantization buffer control) */ +struct jpeg_d_post_controller { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); + JMETHOD(void, post_process_data, (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); +}; + +/* Marker reading & parsing */ +struct jpeg_marker_reader { + JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); + /* Read markers until SOS or EOI. + * Returns same codes as are defined for jpeg_consume_input: + * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. + */ + JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); + /* Read a restart marker --- exported for use by entropy decoder only */ + jpeg_marker_parser_method read_restart_marker; + + /* State of marker reader --- nominally internal, but applications + * supplying COM or APPn handlers might like to know the state. + */ + boolean saw_SOI; /* found SOI? */ + boolean saw_SOF; /* found SOF? */ + int next_restart_num; /* next restart number expected (0-7) */ + unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ +}; + +/* Entropy decoding */ +struct jpeg_entropy_decoder { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, + JBLOCKROW *MCU_data)); + + /* This is here to share code between baseline and progressive decoders; */ + /* other modules probably should not use it */ + boolean insufficient_data; /* set TRUE after emitting warning */ +}; + +/* Inverse DCT (also performs dequantization) */ +typedef JMETHOD(void, inverse_DCT_method_ptr, + (j_decompress_ptr cinfo, jpeg_component_info * compptr, + JCOEFPTR coef_block, + JSAMPARRAY output_buf, JDIMENSION output_col)); + +struct jpeg_inverse_dct { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + /* It is useful to allow each component to have a separate IDCT method. */ + inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; +}; + +/* Upsampling (note that upsampler must also call color converter) */ +struct jpeg_upsampler { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + JMETHOD(void, upsample, (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, + JDIMENSION *in_row_group_ctr, + JDIMENSION in_row_groups_avail, + JSAMPARRAY output_buf, + JDIMENSION *out_row_ctr, + JDIMENSION out_rows_avail)); + + boolean need_context_rows; /* TRUE if need rows above & below */ +}; + +/* Colorspace conversion */ +struct jpeg_color_deconverter { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + JMETHOD(void, color_convert, (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +}; + +/* Color quantization or color precision reduction */ +struct jpeg_color_quantizer { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); + JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPARRAY output_buf, + int num_rows)); + JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); + JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); +}; + + +/* Miscellaneous useful macros */ + +#undef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#undef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + + +/* We assume that right shift corresponds to signed division by 2 with + * rounding towards minus infinity. This is correct for typical "arithmetic + * shift" instructions that shift in copies of the sign bit. But some + * C compilers implement >> with an unsigned shift. For these machines you + * must define RIGHT_SHIFT_IS_UNSIGNED. + * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. + * It is only applied with constant shift counts. SHIFT_TEMPS must be + * included in the variables of any routine using RIGHT_SHIFT. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define SHIFT_TEMPS INT32 shift_temp; +#define RIGHT_SHIFT(x,shft) \ + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ + (shift_temp >> (shft))) +#else +#define SHIFT_TEMPS +#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) +#endif + + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jinit_compress_master jICompress +#define jinit_c_master_control jICMaster +#define jinit_c_main_controller jICMainC +#define jinit_c_prep_controller jICPrepC +#define jinit_c_coef_controller jICCoefC +#define jinit_color_converter jICColor +#define jinit_downsampler jIDownsampler +#define jinit_forward_dct jIFDCT +#define jinit_huff_encoder jIHEncoder +#define jinit_phuff_encoder jIPHEncoder +#define jinit_marker_writer jIMWriter +#define jinit_master_decompress jIDMaster +#define jinit_d_main_controller jIDMainC +#define jinit_d_coef_controller jIDCoefC +#define jinit_d_post_controller jIDPostC +#define jinit_input_controller jIInCtlr +#define jinit_marker_reader jIMReader +#define jinit_huff_decoder jIHDecoder +#define jinit_phuff_decoder jIPHDecoder +#define jinit_inverse_dct jIIDCT +#define jinit_upsampler jIUpsampler +#define jinit_color_deconverter jIDColor +#define jinit_1pass_quantizer jI1Quant +#define jinit_2pass_quantizer jI2Quant +#define jinit_merged_upsampler jIMUpsampler +#define jinit_memory_mgr jIMemMgr +#define jdiv_round_up jDivRound +#define jround_up jRound +#define jcopy_sample_rows jCopySamples +#define jcopy_block_row jCopyBlocks +#define jzero_far jZeroFar +#define jpeg_zigzag_order jZIGTable +#define jpeg_natural_order jZAGTable +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* Compression module initialization routines */ +EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo, + boolean transcode_only)); +EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo)); +EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); +/* Decompression module initialization routines */ +EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, + boolean need_full_buffer)); +EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); +EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); +/* Memory manager initialization */ +EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); + +/* Utility routines in jutils.c */ +EXTERN(long) jdiv_round_up JPP((long a, long b)); +EXTERN(long) jround_up JPP((long a, long b)); +EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, JDIMENSION num_cols)); +EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row, + JDIMENSION num_blocks)); +EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero)); +/* Constant tables in jutils.c */ +#if 0 /* This table is not actually needed in v6a */ +extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ +#endif +extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ + +/* Suppress undefined-structure complaints if necessary. */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ +struct jvirt_sarray_control { long dummy; }; +struct jvirt_barray_control { long dummy; }; +#endif +#endif /* INCOMPLETE_TYPES_BROKEN */ diff --git a/src/SFML/Graphics/libjpeg/jpeglib.h b/src/SFML/Graphics/libjpeg/jpeglib.h new file mode 100644 index 00000000..b9356f39 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jpeglib.h @@ -0,0 +1,1096 @@ +/* + * jpeglib.h + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the application interface for the JPEG library. + * Most applications using the library need only include this file, + * and perhaps jerror.h if they want to know the exact error codes. + */ + +#ifndef JPEGLIB_H +#define JPEGLIB_H + +/* + * First we include the configuration files that record how this + * installation of the JPEG library is set up. jconfig.h can be + * generated automatically for many systems. jmorecfg.h contains + * manual configuration options that most people need not worry about. + */ + +#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ +#include "jconfig.h" /* widely used configuration options */ +#endif +#include "jmorecfg.h" /* seldom changed options */ + + +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ + +#define JPEG_LIB_VERSION 62 /* Version 6b */ + + +/* Various constants determining the sizes of things. + * All of these are specified by the JPEG standard, so don't change them + * if you want to be compatible. + */ + +#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ +#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; + * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. + * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU + * to handle it. We even let you do this from the jconfig.h file. However, + * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe + * sometimes emits noncompliant files doesn't mean you should too. + */ +#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ +#ifndef D_MAX_BLOCKS_IN_MCU +#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ +#endif + + +/* Data structures for images (arrays of samples and of DCT coefficients). + * On 80x86 machines, the image arrays are too big for near pointers, + * but the pointer arrays can fit in near memory. + */ + +typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ + +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ + +typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ + + +/* Types for JPEG compression parameters and working tables. */ + + +/* DCT coefficient quantization tables. */ + +typedef struct { + /* This array gives the coefficient quantizers in natural array order + * (not the zigzag order in which they are stored in a JPEG DQT marker). + * CAUTION: IJG versions prior to v6a kept this array in zigzag order. + */ + UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JQUANT_TBL; + + +/* Huffman coding tables. */ + +typedef struct { + /* These two fields directly represent the contents of a JPEG DHT marker */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JHUFF_TBL; + + +/* Basic info about one component (color channel). */ + +typedef struct { + /* These values are fixed over the whole image. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOF marker. */ + int component_id; /* identifier for this component (0..255) */ + int component_index; /* its index in SOF or cinfo->comp_info[] */ + int h_samp_factor; /* horizontal sampling factor (1..4) */ + int v_samp_factor; /* vertical sampling factor (1..4) */ + int quant_tbl_no; /* quantization table selector (0..3) */ + /* These values may vary between scans. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOS marker. */ + /* The decompressor output side may not use these variables. */ + int dc_tbl_no; /* DC entropy table selector (0..3) */ + int ac_tbl_no; /* AC entropy table selector (0..3) */ + + /* Remaining fields should be treated as private by applications. */ + + /* These values are computed during compression or decompression startup: */ + /* Component's size in DCT blocks. + * Any dummy blocks added to complete an MCU are not counted; therefore + * these values do not depend on whether a scan is interleaved or not. + */ + JDIMENSION width_in_blocks; + JDIMENSION height_in_blocks; + /* Size of a DCT block in samples. Always DCTSIZE for compression. + * For decompression this is the size of the output from one DCT block, + * reflecting any scaling we choose to apply during the IDCT step. + * Values of 1,2,4,8 are likely to be supported. Note that different + * components may receive different IDCT scalings. + */ + int DCT_scaled_size; + /* The downsampled dimensions are the component's actual, unpadded number + * of samples at the main buffer (preprocessing/compression interface), thus + * downsampled_width = ceil(image_width * Hi/Hmax) + * and similarly for height. For decompression, IDCT scaling is included, so + * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE) + */ + JDIMENSION downsampled_width; /* actual width in samples */ + JDIMENSION downsampled_height; /* actual height in samples */ + /* This flag is used only for decompression. In cases where some of the + * components will be ignored (eg grayscale output from YCbCr image), + * we can skip most computations for the unused components. + */ + boolean component_needed; /* do we need the value of this component? */ + + /* These values are computed before starting a scan of the component. */ + /* The decompressor output side may not use these variables. */ + int MCU_width; /* number of blocks per MCU, horizontally */ + int MCU_height; /* number of blocks per MCU, vertically */ + int MCU_blocks; /* MCU_width * MCU_height */ + int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_scaled_size */ + int last_col_width; /* # of non-dummy blocks across in last MCU */ + int last_row_height; /* # of non-dummy blocks down in last MCU */ + + /* Saved quantization table for component; NULL if none yet saved. + * See jdinput.c comments about the need for this information. + * This field is currently used only for decompression. + */ + JQUANT_TBL * quant_table; + + /* Private per-component storage for DCT or IDCT subsystem. */ + void * dct_table; +} jpeg_component_info; + + +/* The script for encoding a multiple-scan file is an array of these: */ + +typedef struct { + int comps_in_scan; /* number of components encoded in this scan */ + int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ + int Ss, Se; /* progressive JPEG spectral selection parms */ + int Ah, Al; /* progressive JPEG successive approx. parms */ +} jpeg_scan_info; + +/* The decompressor can save APPn and COM markers in a list of these: */ + +typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; + +struct jpeg_marker_struct { + jpeg_saved_marker_ptr next; /* next in list, or NULL */ + UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ + unsigned int original_length; /* # bytes of data in the file */ + unsigned int data_length; /* # bytes of data saved at data[] */ + JOCTET FAR * data; /* the data contained in the marker */ + /* the marker length word is not counted in data_length or original_length */ +}; + +/* Known color spaces. */ + +typedef enum { + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK /* Y/Cb/Cr/K */ +} J_COLOR_SPACE; + +/* DCT/IDCT algorithm options. */ + +typedef enum { + JDCT_ISLOW, /* slow but accurate integer algorithm */ + JDCT_IFAST, /* faster, less accurate integer method */ + JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ +} J_DCT_METHOD; + +#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ +#define JDCT_DEFAULT JDCT_ISLOW +#endif +#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ +#define JDCT_FASTEST JDCT_IFAST +#endif + +/* Dithering options for decompression. */ + +typedef enum { + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ +} J_DITHER_MODE; + + +/* Common fields between JPEG compression and decompression master structs. */ + +#define jpeg_common_fields \ + struct jpeg_error_mgr * err; /* Error handler module */\ + struct jpeg_memory_mgr * mem; /* Memory manager module */\ + struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ + void * client_data; /* Available for use by application */\ + boolean is_decompressor; /* So common code can tell which is which */\ + int global_state /* For checking call sequence validity */ + +/* Routines that are to be used by both halves of the library are declared + * to receive a pointer to this structure. There are no actual instances of + * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. + */ +struct jpeg_common_struct { + jpeg_common_fields; /* Fields common to both master struct types */ + /* Additional fields follow in an actual jpeg_compress_struct or + * jpeg_decompress_struct. All three structs must agree on these + * initial fields! (This would be a lot cleaner in C++.) + */ +}; + +typedef struct jpeg_common_struct * j_common_ptr; +typedef struct jpeg_compress_struct * j_compress_ptr; +typedef struct jpeg_decompress_struct * j_decompress_ptr; + + +/* Master record for a compression instance */ + +struct jpeg_compress_struct { + jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ + + /* Destination for compressed data */ + struct jpeg_destination_mgr * dest; + + /* Description of source image --- these fields must be filled in by + * outer application before starting compression. in_color_space must + * be correct before you can even call jpeg_set_defaults(). + */ + + JDIMENSION image_width; /* input image width */ + JDIMENSION image_height; /* input image height */ + int input_components; /* # of color components in input image */ + J_COLOR_SPACE in_color_space; /* colorspace of input image */ + + double input_gamma; /* image gamma of input image */ + + /* Compression parameters --- these fields must be set before calling + * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to + * initialize everything to reasonable defaults, then changing anything + * the application specifically wants to change. That way you won't get + * burnt when new parameters are added. Also note that there are several + * helper routines to simplify changing parameters. + */ + + int data_precision; /* bits of precision in image data */ + + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + int num_scans; /* # of entries in scan_info array */ + const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ + /* The default value of scan_info is NULL, which causes a single-scan + * sequential JPEG file to be emitted. To create a multi-scan file, + * set num_scans and scan_info to point to an array of scan definitions. + */ + + boolean raw_data_in; /* TRUE=caller supplies downsampled data */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + int smoothing_factor; /* 1..100, or 0 for no input smoothing */ + J_DCT_METHOD dct_method; /* DCT algorithm selector */ + + /* The restart interval can be specified in absolute MCUs by setting + * restart_interval, or in MCU rows by setting restart_in_rows + * (in which case the correct restart_interval will be figured + * for each scan). + */ + unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ + int restart_in_rows; /* if > 0, MCU rows per restart interval */ + + /* Parameters controlling emission of special markers. */ + + boolean write_JFIF_header; /* should a JFIF marker be written? */ + UINT8 JFIF_major_version; /* What to write for the JFIF version number */ + UINT8 JFIF_minor_version; + /* These three values are not used by the JPEG code, merely copied */ + /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ + /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ + /* ratio is defined by X_density/Y_density even when density_unit=0. */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean write_Adobe_marker; /* should an Adobe marker be written? */ + + /* State variable: index of next scanline to be written to + * jpeg_write_scanlines(). Application may use this to control its + * processing loop, e.g., "while (next_scanline < image_height)". + */ + + JDIMENSION next_scanline; /* 0 .. image_height-1 */ + + /* Remaining fields are known throughout compressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during compression startup + */ + boolean progressive_mode; /* TRUE if scan script uses progressive mode */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + + JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ + /* The coefficient controller receives data in units of MCU rows as defined + * for fully interleaved scans (whether the JPEG file is interleaved or not). + * There are v_samp_factor * DCTSIZE sample rows of each component in an + * "iMCU" (interleaved MCU) row. + */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[C_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + + /* + * Links to compression subobjects (methods and private variables of modules) + */ + struct jpeg_comp_master * master; + struct jpeg_c_main_controller * main; + struct jpeg_c_prep_controller * prep; + struct jpeg_c_coef_controller * coef; + struct jpeg_marker_writer * marker; + struct jpeg_color_converter * cconvert; + struct jpeg_downsampler * downsample; + struct jpeg_forward_dct * fdct; + struct jpeg_entropy_encoder * entropy; + jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ + int script_space_size; +}; + + +/* Master record for a decompression instance */ + +struct jpeg_decompress_struct { + jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ + + /* Source of compressed data */ + struct jpeg_source_mgr * src; + + /* Basic description of image --- filled in by jpeg_read_header(). */ + /* Application may inspect these values to decide how to process image. */ + + JDIMENSION image_width; /* nominal image width (from SOF marker) */ + JDIMENSION image_height; /* nominal image height */ + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + /* Decompression processing parameters --- these fields must be set before + * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes + * them to default values. + */ + + J_COLOR_SPACE out_color_space; /* colorspace for output */ + + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + double output_gamma; /* image gamma wanted in output */ + + boolean buffered_image; /* TRUE=multiple output passes */ + boolean raw_data_out; /* TRUE=downsampled data wanted */ + + J_DCT_METHOD dct_method; /* IDCT algorithm selector */ + boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ + boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ + + boolean quantize_colors; /* TRUE=colormapped output wanted */ + /* the following are ignored if not quantize_colors: */ + J_DITHER_MODE dither_mode; /* type of color dithering to use */ + boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ + int desired_number_of_colors; /* max # colors to use in created colormap */ + /* these are significant only in buffered-image mode: */ + boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ + boolean enable_external_quant;/* enable future use of external colormap */ + boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ + + /* Description of actual output image that will be returned to application. + * These fields are computed by jpeg_start_decompress(). + * You can also use jpeg_calc_output_dimensions() to determine these values + * in advance of calling jpeg_start_decompress(). + */ + + JDIMENSION output_width; /* scaled image width */ + JDIMENSION output_height; /* scaled image height */ + int out_color_components; /* # of color components in out_color_space */ + int output_components; /* # of color components returned */ + /* output_components is 1 (a colormap index) when quantizing colors; + * otherwise it equals out_color_components. + */ + int rec_outbuf_height; /* min recommended height of scanline buffer */ + /* If the buffer passed to jpeg_read_scanlines() is less than this many rows + * high, space and time will be wasted due to unnecessary data copying. + * Usually rec_outbuf_height will be 1 or 2, at most 4. + */ + + /* When quantizing colors, the output colormap is described by these fields. + * The application can supply a colormap by setting colormap non-NULL before + * calling jpeg_start_decompress; otherwise a colormap is created during + * jpeg_start_decompress or jpeg_start_output. + * The map has out_color_components rows and actual_number_of_colors columns. + */ + int actual_number_of_colors; /* number of entries in use */ + JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ + + /* State variables: these variables indicate the progress of decompression. + * The application may examine these but must not modify them. + */ + + /* Row index of next scanline to be read from jpeg_read_scanlines(). + * Application may use this to control its processing loop, e.g., + * "while (output_scanline < output_height)". + */ + JDIMENSION output_scanline; /* 0 .. output_height-1 */ + + /* Current input scan number and number of iMCU rows completed in scan. + * These indicate the progress of the decompressor input side. + */ + int input_scan_number; /* Number of SOS markers seen so far */ + JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ + + /* The "output scan number" is the notional scan being displayed by the + * output side. The decompressor will not allow output scan/row number + * to get ahead of input scan/row, but it can fall arbitrarily far behind. + */ + int output_scan_number; /* Nominal scan number being displayed */ + JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ + + /* Current progression status. coef_bits[c][i] indicates the precision + * with which component c's DCT coefficient i (in zigzag order) is known. + * It is -1 when no data has yet been received, otherwise it is the point + * transform (shift) value for the most recent scan of the coefficient + * (thus, 0 at completion of the progression). + * This pointer is NULL when reading a non-progressive file. + */ + int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ + + /* Internal JPEG parameters --- the application usually need not look at + * these fields. Note that the decompressor output side may not use + * any parameters that can change between scans. + */ + + /* Quantization and Huffman tables are carried forward across input + * datastreams when processing abbreviated JPEG datastreams. + */ + + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + /* These parameters are never carried across datastreams, since they + * are given in SOF/SOS markers or defined to be reset by SOI. + */ + + int data_precision; /* bits of precision in image data */ + + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ + + /* These fields record data obtained from optional markers recognized by + * the JPEG library. + */ + boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ + /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ + UINT8 JFIF_major_version; /* JFIF version number */ + UINT8 JFIF_minor_version; + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ + UINT8 Adobe_transform; /* Color transform code from Adobe marker */ + + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + /* Aside from the specific data retained from APPn markers known to the + * library, the uninterpreted contents of any or all APPn and COM markers + * can be saved in a list for examination by the application. + */ + jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ + + /* Remaining fields are known throughout decompressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during decompression startup + */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + + int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ + + JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ + /* The coefficient controller's input and output progress is measured in + * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows + * in fully interleaved JPEG scans, but are used whether the scan is + * interleaved or not. We define an iMCU row as v_samp_factor DCT block + * rows of each component. Therefore, the IDCT output contains + * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row. + */ + + JSAMPLE * sample_range_limit; /* table for fast range-limiting */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + * Note that the decompressor output side must not use these fields. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[D_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + + /* This field is shared between entropy decoder and marker parser. + * It is either zero or the code of a JPEG marker that has been + * read from the data source, but has not yet been processed. + */ + int unread_marker; + + /* + * Links to decompression subobjects (methods, private variables of modules) + */ + struct jpeg_decomp_master * master; + struct jpeg_d_main_controller * main; + struct jpeg_d_coef_controller * coef; + struct jpeg_d_post_controller * post; + struct jpeg_input_controller * inputctl; + struct jpeg_marker_reader * marker; + struct jpeg_entropy_decoder * entropy; + struct jpeg_inverse_dct * idct; + struct jpeg_upsampler * upsample; + struct jpeg_color_deconverter * cconvert; + struct jpeg_color_quantizer * cquantize; +}; + + +/* "Object" declarations for JPEG modules that may be supplied or called + * directly by the surrounding application. + * As with all objects in the JPEG library, these structs only define the + * publicly visible methods and state variables of a module. Additional + * private fields may exist after the public ones. + */ + + +/* Error handler object */ + +struct jpeg_error_mgr { + /* Error exit handler: does not return to caller */ + JMETHOD(void, error_exit, (j_common_ptr cinfo)); + /* Conditionally emit a trace or warning message */ + JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); + /* Routine that actually outputs a trace or error message */ + JMETHOD(void, output_message, (j_common_ptr cinfo)); + /* Format a message string for the most recent JPEG error or message */ + JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); +#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ + /* Reset error state variables at start of a new image */ + JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); + + /* The message ID code and any parameters are saved here. + * A message can have one string parameter or up to 8 int parameters. + */ + int msg_code; +#define JMSG_STR_PARM_MAX 80 + union { + int i[8]; + char s[JMSG_STR_PARM_MAX]; + } msg_parm; + + /* Standard state variables for error facility */ + + int trace_level; /* max msg_level that will be displayed */ + + /* For recoverable corrupt-data errors, we emit a warning message, + * but keep going unless emit_message chooses to abort. emit_message + * should count warnings in num_warnings. The surrounding application + * can check for bad data by seeing if num_warnings is nonzero at the + * end of processing. + */ + long num_warnings; /* number of corrupt-data warnings */ + + /* These fields point to the table(s) of error message strings. + * An application can change the table pointer to switch to a different + * message list (typically, to change the language in which errors are + * reported). Some applications may wish to add additional error codes + * that will be handled by the JPEG library error mechanism; the second + * table pointer is used for this purpose. + * + * First table includes all errors generated by JPEG library itself. + * Error code 0 is reserved for a "no such error string" message. + */ + const char * const * jpeg_message_table; /* Library errors */ + int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ + /* Second table can be added by application (see cjpeg/djpeg for example). + * It contains strings numbered first_addon_message..last_addon_message. + */ + const char * const * addon_message_table; /* Non-library errors */ + int first_addon_message; /* code for first string in addon table */ + int last_addon_message; /* code for last string in addon table */ +}; + + +/* Progress monitor object */ + +struct jpeg_progress_mgr { + JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); + + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ +}; + + +/* Data destination object for compression */ + +struct jpeg_destination_mgr { + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + + JMETHOD(void, init_destination, (j_compress_ptr cinfo)); + JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); + JMETHOD(void, term_destination, (j_compress_ptr cinfo)); +}; + + +/* Data source object for decompression */ + +struct jpeg_source_mgr { + const JOCTET * next_input_byte; /* => next byte to read from buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + + JMETHOD(void, init_source, (j_decompress_ptr cinfo)); + JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); + JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); + JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); + JMETHOD(void, term_source, (j_decompress_ptr cinfo)); +}; + + +/* Memory manager object. + * Allocates "small" objects (a few K total), "large" objects (tens of K), + * and "really big" objects (virtual arrays with backing store if needed). + * The memory manager does not allow individual objects to be freed; rather, + * each created object is assigned to a pool, and whole pools can be freed + * at once. This is faster and more convenient than remembering exactly what + * to free, especially where malloc()/free() are not too speedy. + * NB: alloc routines never return NULL. They exit to error_exit if not + * successful. + */ + +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 + +typedef struct jvirt_sarray_control * jvirt_sarray_ptr; +typedef struct jvirt_barray_control * jvirt_barray_ptr; + + +struct jpeg_memory_mgr { + /* Method pointers */ + JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, + size_t sizeofobject)); + JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, + size_t sizeofobject)); + JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, + JDIMENSION numrows)); + JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, + JDIMENSION numrows)); + JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, + int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); + JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, + int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); + JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); + JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, + jvirt_sarray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); + JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, + jvirt_barray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); + JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); + JMETHOD(void, self_destruct, (j_common_ptr cinfo)); + + /* Limit on memory allocation for this JPEG object. (Note that this is + * merely advisory, not a guaranteed maximum; it only affects the space + * used for virtual-array buffers.) May be changed by outer application + * after creating the JPEG object. + */ + long max_memory_to_use; + + /* Maximum allocation request accepted by alloc_large. */ + long max_alloc_chunk; +}; + + +/* Routine signature for application-supplied marker processing methods. + * Need not pass marker code since it is stored in cinfo->unread_marker. + */ +typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); + + +/* Declarations for routines called by application. + * The JPP macro hides prototype parameters from compilers that can't cope. + * Note JPP requires double parentheses. + */ + +#ifdef HAVE_PROTOTYPES +#define JPP(arglist) arglist +#else +#define JPP(arglist) () +#endif + + +/* Short forms of external names for systems with brain-damaged linkers. + * We shorten external names to be unique in the first six letters, which + * is good enough for all known systems. + * (If your compiler itself needs names to be unique in less than 15 + * characters, you are out of luck. Get a better compiler.) + */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_std_error jStdError +#define jpeg_CreateCompress jCreaCompress +#define jpeg_CreateDecompress jCreaDecompress +#define jpeg_destroy_compress jDestCompress +#define jpeg_destroy_decompress jDestDecompress +#define jpeg_stdio_dest jStdDest +#define jpeg_stdio_src jStdSrc +#define jpeg_set_defaults jSetDefaults +#define jpeg_set_colorspace jSetColorspace +#define jpeg_default_colorspace jDefColorspace +#define jpeg_set_quality jSetQuality +#define jpeg_set_linear_quality jSetLQuality +#define jpeg_add_quant_table jAddQuantTable +#define jpeg_quality_scaling jQualityScaling +#define jpeg_simple_progression jSimProgress +#define jpeg_suppress_tables jSuppressTables +#define jpeg_alloc_quant_table jAlcQTable +#define jpeg_alloc_huff_table jAlcHTable +#define jpeg_start_compress jStrtCompress +#define jpeg_write_scanlines jWrtScanlines +#define jpeg_finish_compress jFinCompress +#define jpeg_write_raw_data jWrtRawData +#define jpeg_write_marker jWrtMarker +#define jpeg_write_m_header jWrtMHeader +#define jpeg_write_m_byte jWrtMByte +#define jpeg_write_tables jWrtTables +#define jpeg_read_header jReadHeader +#define jpeg_start_decompress jStrtDecompress +#define jpeg_read_scanlines jReadScanlines +#define jpeg_finish_decompress jFinDecompress +#define jpeg_read_raw_data jReadRawData +#define jpeg_has_multiple_scans jHasMultScn +#define jpeg_start_output jStrtOutput +#define jpeg_finish_output jFinOutput +#define jpeg_input_complete jInComplete +#define jpeg_new_colormap jNewCMap +#define jpeg_consume_input jConsumeInput +#define jpeg_calc_output_dimensions jCalcDimensions +#define jpeg_save_markers jSaveMarkers +#define jpeg_set_marker_processor jSetMarker +#define jpeg_read_coefficients jReadCoefs +#define jpeg_write_coefficients jWrtCoefs +#define jpeg_copy_critical_parameters jCopyCrit +#define jpeg_abort_compress jAbrtCompress +#define jpeg_abort_decompress jAbrtDecompress +#define jpeg_abort jAbort +#define jpeg_destroy jDestroy +#define jpeg_resync_to_restart jResyncRestart +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* Default error-management setup */ +EXTERN(struct jpeg_error_mgr *) jpeg_std_error + JPP((struct jpeg_error_mgr * err)); + +/* Initialization of JPEG compression objects. + * jpeg_create_compress() and jpeg_create_decompress() are the exported + * names that applications should call. These expand to calls on + * jpeg_CreateCompress and jpeg_CreateDecompress with additional information + * passed for version mismatch checking. + * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. + */ +#define jpeg_create_compress(cinfo) \ + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_compress_struct)) +#define jpeg_create_decompress(cinfo) \ + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, + int version, size_t structsize)); +EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, + int version, size_t structsize)); +/* Destruction of JPEG compression objects */ +EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); + +/* Standard data source and destination managers: stdio streams. */ +/* Caller is responsible for opening the file before and closing after. */ +EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); +EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); + +/* Default parameter setup for compression */ +EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); +/* Compression parameter setup aids */ +EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, + J_COLOR_SPACE colorspace)); +EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, + boolean force_baseline)); +EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, + int scale_factor, + boolean force_baseline)); +EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, + boolean force_baseline)); +EXTERN(int) jpeg_quality_scaling JPP((int quality)); +EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, + boolean suppress)); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); + +/* Main entry points for compression */ +EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, + boolean write_all_tables)); +EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines)); +EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); + +/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION num_lines)); + +/* Write a special marker. See libjpeg.doc concerning safe usage. */ +EXTERN(void) jpeg_write_marker + JPP((j_compress_ptr cinfo, int marker, + const JOCTET * dataptr, unsigned int datalen)); +/* Same, but piecemeal. */ +EXTERN(void) jpeg_write_m_header + JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); +EXTERN(void) jpeg_write_m_byte + JPP((j_compress_ptr cinfo, int val)); + +/* Alternate compression function: just write an abbreviated table file */ +EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); + +/* Decompression startup: read start of JPEG datastream to see what's there */ +EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, + boolean require_image)); +/* Return value is one of: */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +/* If you pass require_image = TRUE (normal case), you need not check for + * a TABLES_ONLY return code; an abbreviated file will cause an error exit. + * JPEG_SUSPENDED is only possible if you use a data source module that can + * give a suspension return (the stdio source module doesn't). + */ + +/* Main entry points for decompression */ +EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines)); +EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); + +/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION max_lines)); + +/* Additional entry points for buffered-image mode. */ +EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, + int scan_number)); +EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); +EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); +/* Return value is one of: */ +/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ +#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ +#define JPEG_REACHED_EOI 2 /* Reached end of image */ +#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ +#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ + +/* Precalculate output dimensions for current decompression parameters. */ +EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); + +/* Control saving of COM and APPn markers into marker_list. */ +EXTERN(void) jpeg_save_markers + JPP((j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit)); + +/* Install a special processing method for COM or APPn markers. */ +EXTERN(void) jpeg_set_marker_processor + JPP((j_decompress_ptr cinfo, int marker_code, + jpeg_marker_parser_method routine)); + +/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays)); +EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, + j_compress_ptr dstinfo)); + +/* If you choose to abort compression or decompression before completing + * jpeg_finish_(de)compress, then you need to clean up to release memory, + * temporary files, etc. You can just call jpeg_destroy_(de)compress + * if you're done with the JPEG object, but if you want to clean it up and + * reuse it, call this: + */ +EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); + +/* Generic versions of jpeg_abort and jpeg_destroy that work on either + * flavor of JPEG object. These may be more convenient in some places. + */ +EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); + +/* Default restart-marker-resync procedure for use by data source modules */ +EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, + int desired)); + + +/* These marker codes are exported since applications and data source modules + * are likely to want to use them. + */ + +#define JPEG_RST0 0xD0 /* RST0 marker code */ +#define JPEG_EOI 0xD9 /* EOI marker code */ +#define JPEG_APP0 0xE0 /* APP0 marker code */ +#define JPEG_COM 0xFE /* COM marker code */ + + +/* If we have a brain-damaged compiler that emits warnings (or worse, errors) + * for structure definitions that are never filled in, keep it quiet by + * supplying dummy definitions for the various substructures. + */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ +struct jvirt_sarray_control { long dummy; }; +struct jvirt_barray_control { long dummy; }; +struct jpeg_comp_master { long dummy; }; +struct jpeg_c_main_controller { long dummy; }; +struct jpeg_c_prep_controller { long dummy; }; +struct jpeg_c_coef_controller { long dummy; }; +struct jpeg_marker_writer { long dummy; }; +struct jpeg_color_converter { long dummy; }; +struct jpeg_downsampler { long dummy; }; +struct jpeg_forward_dct { long dummy; }; +struct jpeg_entropy_encoder { long dummy; }; +struct jpeg_decomp_master { long dummy; }; +struct jpeg_d_main_controller { long dummy; }; +struct jpeg_d_coef_controller { long dummy; }; +struct jpeg_d_post_controller { long dummy; }; +struct jpeg_input_controller { long dummy; }; +struct jpeg_marker_reader { long dummy; }; +struct jpeg_entropy_decoder { long dummy; }; +struct jpeg_inverse_dct { long dummy; }; +struct jpeg_upsampler { long dummy; }; +struct jpeg_color_deconverter { long dummy; }; +struct jpeg_color_quantizer { long dummy; }; +#endif /* JPEG_INTERNALS */ +#endif /* INCOMPLETE_TYPES_BROKEN */ + + +/* + * The JPEG library modules define JPEG_INTERNALS before including this file. + * The internal structure declarations are read only when that is true. + * Applications using the library should not include jpegint.h, but may wish + * to include jerror.h. + */ + +#ifdef JPEG_INTERNALS +#include "jpegint.h" /* fetch private declarations */ +#include "jerror.h" /* fetch error codes too */ +#endif + +#endif /* JPEGLIB_H */ diff --git a/src/SFML/Graphics/libjpeg/jquant1.c b/src/SFML/Graphics/libjpeg/jquant1.c new file mode 100644 index 00000000..aaa34a18 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jquant1.c @@ -0,0 +1,856 @@ +/* + * jquant1.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains 1-pass color quantization (color mapping) routines. + * These routines provide mapping to a fixed color map using equally spaced + * color values. Optional Floyd-Steinberg or ordered dithering is available. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + +#ifdef QUANT_1PASS_SUPPORTED + + +/* + * The main purpose of 1-pass quantization is to provide a fast, if not very + * high quality, colormapped output capability. A 2-pass quantizer usually + * gives better visual quality; however, for quantized grayscale output this + * quantizer is perfectly adequate. Dithering is highly recommended with this + * quantizer, though you can turn it off if you really want to. + * + * In 1-pass quantization the colormap must be chosen in advance of seeing the + * image. We use a map consisting of all combinations of Ncolors[i] color + * values for the i'th component. The Ncolors[] values are chosen so that + * their product, the total number of colors, is no more than that requested. + * (In most cases, the product will be somewhat less.) + * + * Since the colormap is orthogonal, the representative value for each color + * component can be determined without considering the other components; + * then these indexes can be combined into a colormap index by a standard + * N-dimensional-array-subscript calculation. Most of the arithmetic involved + * can be precalculated and stored in the lookup table colorindex[]. + * colorindex[i][j] maps pixel value j in component i to the nearest + * representative value (grid plane) for that component; this index is + * multiplied by the array stride for component i, so that the + * index of the colormap entry closest to a given pixel value is just + * sum( colorindex[component-number][pixel-component-value] ) + * Aside from being fast, this scheme allows for variable spacing between + * representative values with no additional lookup cost. + * + * If gamma correction has been applied in color conversion, it might be wise + * to adjust the color grid spacing so that the representative colors are + * equidistant in linear space. At this writing, gamma correction is not + * implemented by jdcolor, so nothing is done here. + */ + + +/* Declarations for ordered dithering. + * + * We use a standard 16x16 ordered dither array. The basic concept of ordered + * dithering is described in many references, for instance Dale Schumacher's + * chapter II.2 of Graphics Gems II (James Arvo, ed. Academic Press, 1991). + * In place of Schumacher's comparisons against a "threshold" value, we add a + * "dither" value to the input pixel and then round the result to the nearest + * output value. The dither value is equivalent to (0.5 - threshold) times + * the distance between output values. For ordered dithering, we assume that + * the output colors are equally spaced; if not, results will probably be + * worse, since the dither may be too much or too little at a given point. + * + * The normal calculation would be to form pixel value + dither, range-limit + * this to 0..MAXJSAMPLE, and then index into the colorindex table as usual. + * We can skip the separate range-limiting step by extending the colorindex + * table in both directions. + */ + +#define ODITHER_SIZE 16 /* dimension of dither matrix */ +/* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */ +#define ODITHER_CELLS (ODITHER_SIZE*ODITHER_SIZE) /* # cells in matrix */ +#define ODITHER_MASK (ODITHER_SIZE-1) /* mask for wrapping around counters */ + +typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE]; +typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE]; + +static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { + /* Bayer's order-4 dither array. Generated by the code given in + * Stephen Hawley's article "Ordered Dithering" in Graphics Gems I. + * The values in this array must range from 0 to ODITHER_CELLS-1. + */ + { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }, + { 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 }, + { 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 }, + { 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 }, + { 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 }, + { 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 }, + { 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 }, + { 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 }, + { 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 }, + { 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 }, + { 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 }, + { 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 }, + { 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 }, + { 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 }, + { 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 }, + { 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 } +}; + + +/* Declarations for Floyd-Steinberg dithering. + * + * Errors are accumulated into the array fserrors[], at a resolution of + * 1/16th of a pixel count. The error at a given pixel is propagated + * to its not-yet-processed neighbors using the standard F-S fractions, + * ... (here) 7/16 + * 3/16 5/16 1/16 + * We work left-to-right on even rows, right-to-left on odd rows. + * + * We can get away with a single array (holding one row's worth of errors) + * by using it to store the current row's errors at pixel columns not yet + * processed, but the next row's errors at columns already processed. We + * need only a few extra variables to hold the errors immediately around the + * current column. (If we are lucky, those variables are in registers, but + * even if not, they're probably cheaper to access than array elements are.) + * + * The fserrors[] array is indexed [component#][position]. + * We provide (#columns + 2) entries per component; the extra entry at each + * end saves us from special-casing the first and last pixels. + * + * Note: on a wide image, we might not have enough room in a PC's near data + * segment to hold the error array; so it is allocated with alloc_large. + */ + +#if BITS_IN_JSAMPLE == 8 +typedef INT16 FSERROR; /* 16 bits should be enough */ +typedef int LOCFSERROR; /* use 'int' for calculation temps */ +#else +typedef INT32 FSERROR; /* may need more than 16 bits */ +typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ +#endif + +typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ + + +/* Private subobject */ + +#define MAX_Q_COMPS 4 /* max components I can handle */ + +typedef struct { + struct jpeg_color_quantizer pub; /* public fields */ + + /* Initially allocated colormap is saved here */ + JSAMPARRAY sv_colormap; /* The color map as a 2-D pixel array */ + int sv_actual; /* number of entries in use */ + + JSAMPARRAY colorindex; /* Precomputed mapping for speed */ + /* colorindex[i][j] = index of color closest to pixel value j in component i, + * premultiplied as described above. Since colormap indexes must fit into + * JSAMPLEs, the entries of this array will too. + */ + boolean is_padded; /* is the colorindex padded for odither? */ + + int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ + + /* Variables for ordered dithering */ + int row_index; /* cur row's vertical index in dither matrix */ + ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */ + + /* Variables for Floyd-Steinberg dithering */ + FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ + boolean on_odd_row; /* flag to remember which row we are on */ +} my_cquantizer; + +typedef my_cquantizer * my_cquantize_ptr; + + +/* + * Policy-making subroutines for create_colormap and create_colorindex. + * These routines determine the colormap to be used. The rest of the module + * only assumes that the colormap is orthogonal. + * + * * select_ncolors decides how to divvy up the available colors + * among the components. + * * output_value defines the set of representative values for a component. + * * largest_input_value defines the mapping from input values to + * representative values for a component. + * Note that the latter two routines may impose different policies for + * different components, though this is not currently done. + */ + + +LOCAL(int) +select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) +/* Determine allocation of desired colors to components, */ +/* and fill in Ncolors[] array to indicate choice. */ +/* Return value is total number of colors (product of Ncolors[] values). */ +{ + int nc = cinfo->out_color_components; /* number of color components */ + int max_colors = cinfo->desired_number_of_colors; + int total_colors, iroot, i, j; + boolean changed; + long temp; + static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE }; + + /* We can allocate at least the nc'th root of max_colors per component. */ + /* Compute floor(nc'th root of max_colors). */ + iroot = 1; + do { + iroot++; + temp = iroot; /* set temp = iroot ** nc */ + for (i = 1; i < nc; i++) + temp *= iroot; + } while (temp <= (long) max_colors); /* repeat till iroot exceeds root */ + iroot--; /* now iroot = floor(root) */ + + /* Must have at least 2 color values per component */ + if (iroot < 2) + ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, (int) temp); + + /* Initialize to iroot color values for each component */ + total_colors = 1; + for (i = 0; i < nc; i++) { + Ncolors[i] = iroot; + total_colors *= iroot; + } + /* We may be able to increment the count for one or more components without + * exceeding max_colors, though we know not all can be incremented. + * Sometimes, the first component can be incremented more than once! + * (Example: for 16 colors, we start at 2*2*2, go to 3*2*2, then 4*2*2.) + * In RGB colorspace, try to increment G first, then R, then B. + */ + do { + changed = FALSE; + for (i = 0; i < nc; i++) { + j = (cinfo->out_color_space == JCS_RGB ? RGB_order[i] : i); + /* calculate new total_colors if Ncolors[j] is incremented */ + temp = total_colors / Ncolors[j]; + temp *= Ncolors[j]+1; /* done in long arith to avoid oflo */ + if (temp > (long) max_colors) + break; /* won't fit, done with this pass */ + Ncolors[j]++; /* OK, apply the increment */ + total_colors = (int) temp; + changed = TRUE; + } + } while (changed); + + return total_colors; +} + + +LOCAL(int) +output_value (j_decompress_ptr cinfo, int ci, int j, int maxj) +/* Return j'th output value, where j will range from 0 to maxj */ +/* The output values must fall in 0..MAXJSAMPLE in increasing order */ +{ + /* We always provide values 0 and MAXJSAMPLE for each component; + * any additional values are equally spaced between these limits. + * (Forcing the upper and lower values to the limits ensures that + * dithering can't produce a color outside the selected gamut.) + */ + return (int) (((INT32) j * MAXJSAMPLE + maxj/2) / maxj); +} + + +LOCAL(int) +largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj) +/* Return largest input value that should map to j'th output value */ +/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ +{ + /* Breakpoints are halfway between values returned by output_value */ + return (int) (((INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj)); +} + + +/* + * Create the colormap. + */ + +LOCAL(void) +create_colormap (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + JSAMPARRAY colormap; /* Created colormap */ + int total_colors; /* Number of distinct output colors */ + int i,j,k, nci, blksize, blkdist, ptr, val; + + /* Select number of colors for each component */ + total_colors = select_ncolors(cinfo, cquantize->Ncolors); + + /* Report selected color counts */ + if (cinfo->out_color_components == 3) + TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, + total_colors, cquantize->Ncolors[0], + cquantize->Ncolors[1], cquantize->Ncolors[2]); + else + TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors); + + /* Allocate and fill in the colormap. */ + /* The colors are ordered in the map in standard row-major order, */ + /* i.e. rightmost (highest-indexed) color changes most rapidly. */ + + colormap = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) total_colors, (JDIMENSION) cinfo->out_color_components); + + /* blksize is number of adjacent repeated entries for a component */ + /* blkdist is distance between groups of identical entries for a component */ + blkdist = total_colors; + + for (i = 0; i < cinfo->out_color_components; i++) { + /* fill in colormap entries for i'th color component */ + nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ + blksize = blkdist / nci; + for (j = 0; j < nci; j++) { + /* Compute j'th output value (out of nci) for component */ + val = output_value(cinfo, i, j, nci-1); + /* Fill in all colormap entries that have this value of this component */ + for (ptr = j * blksize; ptr < total_colors; ptr += blkdist) { + /* fill in blksize entries beginning at ptr */ + for (k = 0; k < blksize; k++) + colormap[i][ptr+k] = (JSAMPLE) val; + } + } + blkdist = blksize; /* blksize of this color is blkdist of next */ + } + + /* Save the colormap in private storage, + * where it will survive color quantization mode changes. + */ + cquantize->sv_colormap = colormap; + cquantize->sv_actual = total_colors; +} + + +/* + * Create the color index table. + */ + +LOCAL(void) +create_colorindex (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + JSAMPROW indexptr; + int i,j,k, nci, blksize, val, pad; + + /* For ordered dither, we pad the color index tables by MAXJSAMPLE in + * each direction (input index values can be -MAXJSAMPLE .. 2*MAXJSAMPLE). + * This is not necessary in the other dithering modes. However, we + * flag whether it was done in case user changes dithering mode. + */ + if (cinfo->dither_mode == JDITHER_ORDERED) { + pad = MAXJSAMPLE*2; + cquantize->is_padded = TRUE; + } else { + pad = 0; + cquantize->is_padded = FALSE; + } + + cquantize->colorindex = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) (MAXJSAMPLE+1 + pad), + (JDIMENSION) cinfo->out_color_components); + + /* blksize is number of adjacent repeated entries for a component */ + blksize = cquantize->sv_actual; + + for (i = 0; i < cinfo->out_color_components; i++) { + /* fill in colorindex entries for i'th color component */ + nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ + blksize = blksize / nci; + + /* adjust colorindex pointers to provide padding at negative indexes. */ + if (pad) + cquantize->colorindex[i] += MAXJSAMPLE; + + /* in loop, val = index of current output value, */ + /* and k = largest j that maps to current val */ + indexptr = cquantize->colorindex[i]; + val = 0; + k = largest_input_value(cinfo, i, 0, nci-1); + for (j = 0; j <= MAXJSAMPLE; j++) { + while (j > k) /* advance val if past boundary */ + k = largest_input_value(cinfo, i, ++val, nci-1); + /* premultiply so that no multiplication needed in main processing */ + indexptr[j] = (JSAMPLE) (val * blksize); + } + /* Pad at both ends if necessary */ + if (pad) + for (j = 1; j <= MAXJSAMPLE; j++) { + indexptr[-j] = indexptr[0]; + indexptr[MAXJSAMPLE+j] = indexptr[MAXJSAMPLE]; + } + } +} + + +/* + * Create an ordered-dither array for a component having ncolors + * distinct output values. + */ + +LOCAL(ODITHER_MATRIX_PTR) +make_odither_array (j_decompress_ptr cinfo, int ncolors) +{ + ODITHER_MATRIX_PTR odither; + int j,k; + INT32 num,den; + + odither = (ODITHER_MATRIX_PTR) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(ODITHER_MATRIX)); + /* The inter-value distance for this color is MAXJSAMPLE/(ncolors-1). + * Hence the dither value for the matrix cell with fill order f + * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). + * On 16-bit-int machine, be careful to avoid overflow. + */ + den = 2 * ODITHER_CELLS * ((INT32) (ncolors - 1)); + for (j = 0; j < ODITHER_SIZE; j++) { + for (k = 0; k < ODITHER_SIZE; k++) { + num = ((INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) + * MAXJSAMPLE; + /* Ensure round towards zero despite C's lack of consistency + * about rounding negative values in integer division... + */ + odither[j][k] = (int) (num<0 ? -((-num)/den) : num/den); + } + } + return odither; +} + + +/* + * Create the ordered-dither tables. + * Components having the same number of representative colors may + * share a dither table. + */ + +LOCAL(void) +create_odither_tables (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + ODITHER_MATRIX_PTR odither; + int i, j, nci; + + for (i = 0; i < cinfo->out_color_components; i++) { + nci = cquantize->Ncolors[i]; /* # of distinct values for this color */ + odither = NULL; /* search for matching prior component */ + for (j = 0; j < i; j++) { + if (nci == cquantize->Ncolors[j]) { + odither = cquantize->odither[j]; + break; + } + } + if (odither == NULL) /* need a new table? */ + odither = make_odither_array(cinfo, nci); + cquantize->odither[i] = odither; + } +} + + +/* + * Map some rows of pixels to the output colormapped representation. + */ + +METHODDEF(void) +color_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows) +/* General case, no dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + JSAMPARRAY colorindex = cquantize->colorindex; + register int pixcode, ci; + register JSAMPROW ptrin, ptrout; + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + register int nc = cinfo->out_color_components; + + for (row = 0; row < num_rows; row++) { + ptrin = input_buf[row]; + ptrout = output_buf[row]; + for (col = width; col > 0; col--) { + pixcode = 0; + for (ci = 0; ci < nc; ci++) { + pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]); + } + *ptrout++ = (JSAMPLE) pixcode; + } + } +} + + +METHODDEF(void) +color_quantize3 (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows) +/* Fast path for out_color_components==3, no dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + register int pixcode; + register JSAMPROW ptrin, ptrout; + JSAMPROW colorindex0 = cquantize->colorindex[0]; + JSAMPROW colorindex1 = cquantize->colorindex[1]; + JSAMPROW colorindex2 = cquantize->colorindex[2]; + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + + for (row = 0; row < num_rows; row++) { + ptrin = input_buf[row]; + ptrout = output_buf[row]; + for (col = width; col > 0; col--) { + pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]); + pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]); + pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]); + *ptrout++ = (JSAMPLE) pixcode; + } + } +} + + +METHODDEF(void) +quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows) +/* General case, with ordered dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + register JSAMPROW input_ptr; + register JSAMPROW output_ptr; + JSAMPROW colorindex_ci; + int * dither; /* points to active row of dither matrix */ + int row_index, col_index; /* current indexes into dither matrix */ + int nc = cinfo->out_color_components; + int ci; + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + + for (row = 0; row < num_rows; row++) { + /* Initialize output values to 0 so can process components separately */ + jzero_far((void FAR *) output_buf[row], + (size_t) (width * SIZEOF(JSAMPLE))); + row_index = cquantize->row_index; + for (ci = 0; ci < nc; ci++) { + input_ptr = input_buf[row] + ci; + output_ptr = output_buf[row]; + colorindex_ci = cquantize->colorindex[ci]; + dither = cquantize->odither[ci][row_index]; + col_index = 0; + + for (col = width; col > 0; col--) { + /* Form pixel value + dither, range-limit to 0..MAXJSAMPLE, + * select output value, accumulate into output code for this pixel. + * Range-limiting need not be done explicitly, as we have extended + * the colorindex table to produce the right answers for out-of-range + * inputs. The maximum dither is +- MAXJSAMPLE; this sets the + * required amount of padding. + */ + *output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; + input_ptr += nc; + output_ptr++; + col_index = (col_index + 1) & ODITHER_MASK; + } + } + /* Advance row index for next row */ + row_index = (row_index + 1) & ODITHER_MASK; + cquantize->row_index = row_index; + } +} + + +METHODDEF(void) +quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows) +/* Fast path for out_color_components==3, with ordered dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + register int pixcode; + register JSAMPROW input_ptr; + register JSAMPROW output_ptr; + JSAMPROW colorindex0 = cquantize->colorindex[0]; + JSAMPROW colorindex1 = cquantize->colorindex[1]; + JSAMPROW colorindex2 = cquantize->colorindex[2]; + int * dither0; /* points to active row of dither matrix */ + int * dither1; + int * dither2; + int row_index, col_index; /* current indexes into dither matrix */ + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + + for (row = 0; row < num_rows; row++) { + row_index = cquantize->row_index; + input_ptr = input_buf[row]; + output_ptr = output_buf[row]; + dither0 = cquantize->odither[0][row_index]; + dither1 = cquantize->odither[1][row_index]; + dither2 = cquantize->odither[2][row_index]; + col_index = 0; + + for (col = width; col > 0; col--) { + pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + + dither0[col_index]]); + pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + + dither1[col_index]]); + pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + + dither2[col_index]]); + *output_ptr++ = (JSAMPLE) pixcode; + col_index = (col_index + 1) & ODITHER_MASK; + } + row_index = (row_index + 1) & ODITHER_MASK; + cquantize->row_index = row_index; + } +} + + +METHODDEF(void) +quantize_fs_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf, + JSAMPARRAY output_buf, int num_rows) +/* General case, with Floyd-Steinberg dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + register LOCFSERROR cur; /* current error or pixel value */ + LOCFSERROR belowerr; /* error for pixel below cur */ + LOCFSERROR bpreverr; /* error for below/prev col */ + LOCFSERROR bnexterr; /* error for below/next col */ + LOCFSERROR delta; + register FSERRPTR errorptr; /* => fserrors[] at column before current */ + register JSAMPROW input_ptr; + register JSAMPROW output_ptr; + JSAMPROW colorindex_ci; + JSAMPROW colormap_ci; + int pixcode; + int nc = cinfo->out_color_components; + int dir; /* 1 for left-to-right, -1 for right-to-left */ + int dirnc; /* dir * nc */ + int ci; + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + JSAMPLE *range_limit = cinfo->sample_range_limit; + SHIFT_TEMPS + + for (row = 0; row < num_rows; row++) { + /* Initialize output values to 0 so can process components separately */ + jzero_far((void FAR *) output_buf[row], + (size_t) (width * SIZEOF(JSAMPLE))); + for (ci = 0; ci < nc; ci++) { + input_ptr = input_buf[row] + ci; + output_ptr = output_buf[row]; + if (cquantize->on_odd_row) { + /* work right to left in this row */ + input_ptr += (width-1) * nc; /* so point to rightmost pixel */ + output_ptr += width-1; + dir = -1; + dirnc = -nc; + errorptr = cquantize->fserrors[ci] + (width+1); /* => entry after last column */ + } else { + /* work left to right in this row */ + dir = 1; + dirnc = nc; + errorptr = cquantize->fserrors[ci]; /* => entry before first column */ + } + colorindex_ci = cquantize->colorindex[ci]; + colormap_ci = cquantize->sv_colormap[ci]; + /* Preset error values: no error propagated to first pixel from left */ + cur = 0; + /* and no error propagated to row below yet */ + belowerr = bpreverr = 0; + + for (col = width; col > 0; col--) { + /* cur holds the error propagated from the previous pixel on the + * current line. Add the error propagated from the previous line + * to form the complete error correction term for this pixel, and + * round the error term (which is expressed * 16) to an integer. + * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct + * for either sign of the error value. + * Note: errorptr points to *previous* column's array entry. + */ + cur = RIGHT_SHIFT(cur + errorptr[dir] + 8, 4); + /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. + * The maximum error is +- MAXJSAMPLE; this sets the required size + * of the range_limit array. + */ + cur += GETJSAMPLE(*input_ptr); + cur = GETJSAMPLE(range_limit[cur]); + /* Select output value, accumulate into output code for this pixel */ + pixcode = GETJSAMPLE(colorindex_ci[cur]); + *output_ptr += (JSAMPLE) pixcode; + /* Compute actual representation error at this pixel */ + /* Note: we can do this even though we don't have the final */ + /* pixel code, because the colormap is orthogonal. */ + cur -= GETJSAMPLE(colormap_ci[pixcode]); + /* Compute error fractions to be propagated to adjacent pixels. + * Add these into the running sums, and simultaneously shift the + * next-line error sums left by 1 column. + */ + bnexterr = cur; + delta = cur * 2; + cur += delta; /* form error * 3 */ + errorptr[0] = (FSERROR) (bpreverr + cur); + cur += delta; /* form error * 5 */ + bpreverr = belowerr + cur; + belowerr = bnexterr; + cur += delta; /* form error * 7 */ + /* At this point cur contains the 7/16 error value to be propagated + * to the next pixel on the current line, and all the errors for the + * next line have been shifted over. We are therefore ready to move on. + */ + input_ptr += dirnc; /* advance input ptr to next column */ + output_ptr += dir; /* advance output ptr to next column */ + errorptr += dir; /* advance errorptr to current column */ + } + /* Post-loop cleanup: we must unload the final error value into the + * final fserrors[] entry. Note we need not unload belowerr because + * it is for the dummy column before or after the actual array. + */ + errorptr[0] = (FSERROR) bpreverr; /* unload prev err into array */ + } + cquantize->on_odd_row = (cquantize->on_odd_row ? FALSE : TRUE); + } +} + + +/* + * Allocate workspace for Floyd-Steinberg errors. + */ + +LOCAL(void) +alloc_fs_workspace (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + size_t arraysize; + int i; + + arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); + for (i = 0; i < cinfo->out_color_components; i++) { + cquantize->fserrors[i] = (FSERRPTR) + (*cinfo->mem->alloc_large)((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); + } +} + + +/* + * Initialize for one-pass color quantization. + */ + +METHODDEF(void) +start_pass_1_quant (j_decompress_ptr cinfo, boolean is_pre_scan) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + size_t arraysize; + int i; + + /* Install my colormap. */ + cinfo->colormap = cquantize->sv_colormap; + cinfo->actual_number_of_colors = cquantize->sv_actual; + + /* Initialize for desired dithering mode. */ + switch (cinfo->dither_mode) { + case JDITHER_NONE: + if (cinfo->out_color_components == 3) + cquantize->pub.color_quantize = color_quantize3; + else + cquantize->pub.color_quantize = color_quantize; + break; + case JDITHER_ORDERED: + if (cinfo->out_color_components == 3) + cquantize->pub.color_quantize = quantize3_ord_dither; + else + cquantize->pub.color_quantize = quantize_ord_dither; + cquantize->row_index = 0; /* initialize state for ordered dither */ + /* If user changed to ordered dither from another mode, + * we must recreate the color index table with padding. + * This will cost extra space, but probably isn't very likely. + */ + if (! cquantize->is_padded) + create_colorindex(cinfo); + /* Create ordered-dither tables if we didn't already. */ + if (cquantize->odither[0] == NULL) + create_odither_tables(cinfo); + break; + case JDITHER_FS: + cquantize->pub.color_quantize = quantize_fs_dither; + cquantize->on_odd_row = FALSE; /* initialize state for F-S dither */ + /* Allocate Floyd-Steinberg workspace if didn't already. */ + if (cquantize->fserrors[0] == NULL) + alloc_fs_workspace(cinfo); + /* Initialize the propagated errors to zero. */ + arraysize = (size_t) ((cinfo->output_width + 2) * SIZEOF(FSERROR)); + for (i = 0; i < cinfo->out_color_components; i++) + jzero_far((void FAR *) cquantize->fserrors[i], arraysize); + break; + default: + ERREXIT(cinfo, JERR_NOT_COMPILED); + break; + } +} + + +/* + * Finish up at the end of the pass. + */ + +METHODDEF(void) +finish_pass_1_quant (j_decompress_ptr cinfo) +{ + /* no work in 1-pass case */ +} + + +/* + * Switch to a new external colormap between output passes. + * Shouldn't get to this module! + */ + +METHODDEF(void) +new_color_map_1_quant (j_decompress_ptr cinfo) +{ + ERREXIT(cinfo, JERR_MODE_CHANGE); +} + + +/* + * Module initialization routine for 1-pass color quantization. + */ + +GLOBAL(void) +jinit_1pass_quantizer (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize; + + cquantize = (my_cquantize_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_cquantizer)); + cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; + cquantize->pub.start_pass = start_pass_1_quant; + cquantize->pub.finish_pass = finish_pass_1_quant; + cquantize->pub.new_color_map = new_color_map_1_quant; + cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */ + cquantize->odither[0] = NULL; /* Also flag odither arrays not allocated */ + + /* Make sure my internal arrays won't overflow */ + if (cinfo->out_color_components > MAX_Q_COMPS) + ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS); + /* Make sure colormap indexes can be represented by JSAMPLEs */ + if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1)) + ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE+1); + + /* Create the colormap and color index table. */ + create_colormap(cinfo); + create_colorindex(cinfo); + + /* Allocate Floyd-Steinberg workspace now if requested. + * We do this now since it is FAR storage and may affect the memory + * manager's space calculations. If the user changes to FS dither + * mode in a later pass, we will allocate the space then, and will + * possibly overrun the max_memory_to_use setting. + */ + if (cinfo->dither_mode == JDITHER_FS) + alloc_fs_workspace(cinfo); +} + +#endif /* QUANT_1PASS_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jquant2.c b/src/SFML/Graphics/libjpeg/jquant2.c new file mode 100644 index 00000000..87a3920b --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jquant2.c @@ -0,0 +1,1310 @@ +/* + * jquant2.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains 2-pass color quantization (color mapping) routines. + * These routines provide selection of a custom color map for an image, + * followed by mapping of the image to that color map, with optional + * Floyd-Steinberg dithering. + * It is also possible to use just the second pass to map to an arbitrary + * externally-given color map. + * + * Note: ordered dithering is not supported, since there isn't any fast + * way to compute intercolor distances; it's unclear that ordered dither's + * fundamental assumptions even hold with an irregularly spaced color map. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + +#ifdef QUANT_2PASS_SUPPORTED + + +/* + * This module implements the well-known Heckbert paradigm for color + * quantization. Most of the ideas used here can be traced back to + * Heckbert's seminal paper + * Heckbert, Paul. "Color Image Quantization for Frame Buffer Display", + * Proc. SIGGRAPH '82, Computer Graphics v.16 #3 (July 1982), pp 297-304. + * + * In the first pass over the image, we accumulate a histogram showing the + * usage count of each possible color. To keep the histogram to a reasonable + * size, we reduce the precision of the input; typical practice is to retain + * 5 or 6 bits per color, so that 8 or 4 different input values are counted + * in the same histogram cell. + * + * Next, the color-selection step begins with a box representing the whole + * color space, and repeatedly splits the "largest" remaining box until we + * have as many boxes as desired colors. Then the mean color in each + * remaining box becomes one of the possible output colors. + * + * The second pass over the image maps each input pixel to the closest output + * color (optionally after applying a Floyd-Steinberg dithering correction). + * This mapping is logically trivial, but making it go fast enough requires + * considerable care. + * + * Heckbert-style quantizers vary a good deal in their policies for choosing + * the "largest" box and deciding where to cut it. The particular policies + * used here have proved out well in experimental comparisons, but better ones + * may yet be found. + * + * In earlier versions of the IJG code, this module quantized in YCbCr color + * space, processing the raw upsampled data without a color conversion step. + * This allowed the color conversion math to be done only once per colormap + * entry, not once per pixel. However, that optimization precluded other + * useful optimizations (such as merging color conversion with upsampling) + * and it also interfered with desired capabilities such as quantizing to an + * externally-supplied colormap. We have therefore abandoned that approach. + * The present code works in the post-conversion color space, typically RGB. + * + * To improve the visual quality of the results, we actually work in scaled + * RGB space, giving G distances more weight than R, and R in turn more than + * B. To do everything in integer math, we must use integer scale factors. + * The 2/3/1 scale factors used here correspond loosely to the relative + * weights of the colors in the NTSC grayscale equation. + * If you want to use this code to quantize a non-RGB color space, you'll + * probably need to change these scale factors. + */ + +#define R_SCALE 2 /* scale R distances by this much */ +#define G_SCALE 3 /* scale G distances by this much */ +#define B_SCALE 1 /* and B by this much */ + +/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined + * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B + * and B,G,R orders. If you define some other weird order in jmorecfg.h, + * you'll get compile errors until you extend this logic. In that case + * you'll probably want to tweak the histogram sizes too. + */ + +#if RGB_RED == 0 +#define C0_SCALE R_SCALE +#endif +#if RGB_BLUE == 0 +#define C0_SCALE B_SCALE +#endif +#if RGB_GREEN == 1 +#define C1_SCALE G_SCALE +#endif +#if RGB_RED == 2 +#define C2_SCALE R_SCALE +#endif +#if RGB_BLUE == 2 +#define C2_SCALE B_SCALE +#endif + + +/* + * First we have the histogram data structure and routines for creating it. + * + * The number of bits of precision can be adjusted by changing these symbols. + * We recommend keeping 6 bits for G and 5 each for R and B. + * If you have plenty of memory and cycles, 6 bits all around gives marginally + * better results; if you are short of memory, 5 bits all around will save + * some space but degrade the results. + * To maintain a fully accurate histogram, we'd need to allocate a "long" + * (preferably unsigned long) for each cell. In practice this is overkill; + * we can get by with 16 bits per cell. Few of the cell counts will overflow, + * and clamping those that do overflow to the maximum value will give close- + * enough results. This reduces the recommended histogram size from 256Kb + * to 128Kb, which is a useful savings on PC-class machines. + * (In the second pass the histogram space is re-used for pixel mapping data; + * in that capacity, each cell must be able to store zero to the number of + * desired colors. 16 bits/cell is plenty for that too.) + * Since the JPEG code is intended to run in small memory model on 80x86 + * machines, we can't just allocate the histogram in one chunk. Instead + * of a true 3-D array, we use a row of pointers to 2-D arrays. Each + * pointer corresponds to a C0 value (typically 2^5 = 32 pointers) and + * each 2-D array has 2^6*2^5 = 2048 or 2^6*2^6 = 4096 entries. Note that + * on 80x86 machines, the pointer row is in near memory but the actual + * arrays are in far memory (same arrangement as we use for image arrays). + */ + +#define MAXNUMCOLORS (MAXJSAMPLE+1) /* maximum size of colormap */ + +/* These will do the right thing for either R,G,B or B,G,R color order, + * but you may not like the results for other color orders. + */ +#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ +#define HIST_C1_BITS 6 /* bits of precision in G histogram */ +#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ + +/* Number of elements along histogram axes. */ +#define HIST_C0_ELEMS (1<cquantize; + register JSAMPROW ptr; + register histptr histp; + register hist3d histogram = cquantize->histogram; + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + + for (row = 0; row < num_rows; row++) { + ptr = input_buf[row]; + for (col = width; col > 0; col--) { + /* get pixel value and index into the histogram */ + histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT] + [GETJSAMPLE(ptr[1]) >> C1_SHIFT] + [GETJSAMPLE(ptr[2]) >> C2_SHIFT]; + /* increment, check for overflow and undo increment if so. */ + if (++(*histp) <= 0) + (*histp)--; + ptr += 3; + } + } +} + + +/* + * Next we have the really interesting routines: selection of a colormap + * given the completed histogram. + * These routines work with a list of "boxes", each representing a rectangular + * subset of the input color space (to histogram precision). + */ + +typedef struct { + /* The bounds of the box (inclusive); expressed as histogram indexes */ + int c0min, c0max; + int c1min, c1max; + int c2min, c2max; + /* The volume (actually 2-norm) of the box */ + INT32 volume; + /* The number of nonzero histogram cells within this box */ + long colorcount; +} box; + +typedef box * boxptr; + + +LOCAL(boxptr) +find_biggest_color_pop (boxptr boxlist, int numboxes) +/* Find the splittable box with the largest color population */ +/* Returns NULL if no splittable boxes remain */ +{ + register boxptr boxp; + register int i; + register long maxc = 0; + boxptr which = NULL; + + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { + if (boxp->colorcount > maxc && boxp->volume > 0) { + which = boxp; + maxc = boxp->colorcount; + } + } + return which; +} + + +LOCAL(boxptr) +find_biggest_volume (boxptr boxlist, int numboxes) +/* Find the splittable box with the largest (scaled) volume */ +/* Returns NULL if no splittable boxes remain */ +{ + register boxptr boxp; + register int i; + register INT32 maxv = 0; + boxptr which = NULL; + + for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { + if (boxp->volume > maxv) { + which = boxp; + maxv = boxp->volume; + } + } + return which; +} + + +LOCAL(void) +update_box (j_decompress_ptr cinfo, boxptr boxp) +/* Shrink the min/max bounds of a box to enclose only nonzero elements, */ +/* and recompute its volume and population */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + hist3d histogram = cquantize->histogram; + histptr histp; + int c0,c1,c2; + int c0min,c0max,c1min,c1max,c2min,c2max; + INT32 dist0,dist1,dist2; + long ccount; + + c0min = boxp->c0min; c0max = boxp->c0max; + c1min = boxp->c1min; c1max = boxp->c1max; + c2min = boxp->c2min; c2max = boxp->c2max; + + if (c0max > c0min) + for (c0 = c0min; c0 <= c0max; c0++) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c0min = c0min = c0; + goto have_c0min; + } + } + have_c0min: + if (c0max > c0min) + for (c0 = c0max; c0 >= c0min; c0--) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c0max = c0max = c0; + goto have_c0max; + } + } + have_c0max: + if (c1max > c1min) + for (c1 = c1min; c1 <= c1max; c1++) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c1min = c1min = c1; + goto have_c1min; + } + } + have_c1min: + if (c1max > c1min) + for (c1 = c1max; c1 >= c1min; c1--) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) + if (*histp++ != 0) { + boxp->c1max = c1max = c1; + goto have_c1max; + } + } + have_c1max: + if (c2max > c2min) + for (c2 = c2min; c2 <= c2max; c2++) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1min][c2]; + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) + if (*histp != 0) { + boxp->c2min = c2min = c2; + goto have_c2min; + } + } + have_c2min: + if (c2max > c2min) + for (c2 = c2max; c2 >= c2min; c2--) + for (c0 = c0min; c0 <= c0max; c0++) { + histp = & histogram[c0][c1min][c2]; + for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) + if (*histp != 0) { + boxp->c2max = c2max = c2; + goto have_c2max; + } + } + have_c2max: + + /* Update box volume. + * We use 2-norm rather than real volume here; this biases the method + * against making long narrow boxes, and it has the side benefit that + * a box is splittable iff norm > 0. + * Since the differences are expressed in histogram-cell units, + * we have to shift back to JSAMPLE units to get consistent distances; + * after which, we scale according to the selected distance scale factors. + */ + dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE; + dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE; + dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE; + boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2; + + /* Now scan remaining volume of box and compute population */ + ccount = 0; + for (c0 = c0min; c0 <= c0max; c0++) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++, histp++) + if (*histp != 0) { + ccount++; + } + } + boxp->colorcount = ccount; +} + + +LOCAL(int) +median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, + int desired_colors) +/* Repeatedly select and split the largest box until we have enough boxes */ +{ + int n,lb; + int c0,c1,c2,cmax; + register boxptr b1,b2; + + while (numboxes < desired_colors) { + /* Select box to split. + * Current algorithm: by population for first half, then by volume. + */ + if (numboxes*2 <= desired_colors) { + b1 = find_biggest_color_pop(boxlist, numboxes); + } else { + b1 = find_biggest_volume(boxlist, numboxes); + } + if (b1 == NULL) /* no splittable boxes left! */ + break; + b2 = &boxlist[numboxes]; /* where new box will go */ + /* Copy the color bounds to the new box. */ + b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; + b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; + /* Choose which axis to split the box on. + * Current algorithm: longest scaled axis. + * See notes in update_box about scaling distances. + */ + c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE; + c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE; + c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE; + /* We want to break any ties in favor of green, then red, blue last. + * This code does the right thing for R,G,B or B,G,R color orders only. + */ +#if RGB_RED == 0 + cmax = c1; n = 1; + if (c0 > cmax) { cmax = c0; n = 0; } + if (c2 > cmax) { n = 2; } +#else + cmax = c1; n = 1; + if (c2 > cmax) { cmax = c2; n = 2; } + if (c0 > cmax) { n = 0; } +#endif + /* Choose split point along selected axis, and update box bounds. + * Current algorithm: split at halfway point. + * (Since the box has been shrunk to minimum volume, + * any split will produce two nonempty subboxes.) + * Note that lb value is max for lower box, so must be < old max. + */ + switch (n) { + case 0: + lb = (b1->c0max + b1->c0min) / 2; + b1->c0max = lb; + b2->c0min = lb+1; + break; + case 1: + lb = (b1->c1max + b1->c1min) / 2; + b1->c1max = lb; + b2->c1min = lb+1; + break; + case 2: + lb = (b1->c2max + b1->c2min) / 2; + b1->c2max = lb; + b2->c2min = lb+1; + break; + } + /* Update stats for boxes */ + update_box(cinfo, b1); + update_box(cinfo, b2); + numboxes++; + } + return numboxes; +} + + +LOCAL(void) +compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) +/* Compute representative color for a box, put it in colormap[icolor] */ +{ + /* Current algorithm: mean weighted by pixels (not colors) */ + /* Note it is important to get the rounding correct! */ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + hist3d histogram = cquantize->histogram; + histptr histp; + int c0,c1,c2; + int c0min,c0max,c1min,c1max,c2min,c2max; + long count; + long total = 0; + long c0total = 0; + long c1total = 0; + long c2total = 0; + + c0min = boxp->c0min; c0max = boxp->c0max; + c1min = boxp->c1min; c1max = boxp->c1max; + c2min = boxp->c2min; c2max = boxp->c2max; + + for (c0 = c0min; c0 <= c0max; c0++) + for (c1 = c1min; c1 <= c1max; c1++) { + histp = & histogram[c0][c1][c2min]; + for (c2 = c2min; c2 <= c2max; c2++) { + if ((count = *histp++) != 0) { + total += count; + c0total += ((c0 << C0_SHIFT) + ((1<>1)) * count; + c1total += ((c1 << C1_SHIFT) + ((1<>1)) * count; + c2total += ((c2 << C2_SHIFT) + ((1<>1)) * count; + } + } + } + + cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total); + cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total); + cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total); +} + + +LOCAL(void) +select_colors (j_decompress_ptr cinfo, int desired_colors) +/* Master routine for color selection */ +{ + boxptr boxlist; + int numboxes; + int i; + + /* Allocate workspace for box list */ + boxlist = (boxptr) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box)); + /* Initialize one box containing whole space */ + numboxes = 1; + boxlist[0].c0min = 0; + boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT; + boxlist[0].c1min = 0; + boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT; + boxlist[0].c2min = 0; + boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT; + /* Shrink it to actually-used volume and set its statistics */ + update_box(cinfo, & boxlist[0]); + /* Perform median-cut to produce final box list */ + numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors); + /* Compute the representative color for each box, fill colormap */ + for (i = 0; i < numboxes; i++) + compute_color(cinfo, & boxlist[i], i); + cinfo->actual_number_of_colors = numboxes; + TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes); +} + + +/* + * These routines are concerned with the time-critical task of mapping input + * colors to the nearest color in the selected colormap. + * + * We re-use the histogram space as an "inverse color map", essentially a + * cache for the results of nearest-color searches. All colors within a + * histogram cell will be mapped to the same colormap entry, namely the one + * closest to the cell's center. This may not be quite the closest entry to + * the actual input color, but it's almost as good. A zero in the cache + * indicates we haven't found the nearest color for that cell yet; the array + * is cleared to zeroes before starting the mapping pass. When we find the + * nearest color for a cell, its colormap index plus one is recorded in the + * cache for future use. The pass2 scanning routines call fill_inverse_cmap + * when they need to use an unfilled entry in the cache. + * + * Our method of efficiently finding nearest colors is based on the "locally + * sorted search" idea described by Heckbert and on the incremental distance + * calculation described by Spencer W. Thomas in chapter III.1 of Graphics + * Gems II (James Arvo, ed. Academic Press, 1991). Thomas points out that + * the distances from a given colormap entry to each cell of the histogram can + * be computed quickly using an incremental method: the differences between + * distances to adjacent cells themselves differ by a constant. This allows a + * fairly fast implementation of the "brute force" approach of computing the + * distance from every colormap entry to every histogram cell. Unfortunately, + * it needs a work array to hold the best-distance-so-far for each histogram + * cell (because the inner loop has to be over cells, not colormap entries). + * The work array elements have to be INT32s, so the work array would need + * 256Kb at our recommended precision. This is not feasible in DOS machines. + * + * To get around these problems, we apply Thomas' method to compute the + * nearest colors for only the cells within a small subbox of the histogram. + * The work array need be only as big as the subbox, so the memory usage + * problem is solved. Furthermore, we need not fill subboxes that are never + * referenced in pass2; many images use only part of the color gamut, so a + * fair amount of work is saved. An additional advantage of this + * approach is that we can apply Heckbert's locality criterion to quickly + * eliminate colormap entries that are far away from the subbox; typically + * three-fourths of the colormap entries are rejected by Heckbert's criterion, + * and we need not compute their distances to individual cells in the subbox. + * The speed of this approach is heavily influenced by the subbox size: too + * small means too much overhead, too big loses because Heckbert's criterion + * can't eliminate as many colormap entries. Empirically the best subbox + * size seems to be about 1/512th of the histogram (1/8th in each direction). + * + * Thomas' article also describes a refined method which is asymptotically + * faster than the brute-force method, but it is also far more complex and + * cannot efficiently be applied to small subboxes. It is therefore not + * useful for programs intended to be portable to DOS machines. On machines + * with plenty of memory, filling the whole histogram in one shot with Thomas' + * refined method might be faster than the present code --- but then again, + * it might not be any faster, and it's certainly more complicated. + */ + + +/* log2(histogram cells in update box) for each axis; this can be adjusted */ +#define BOX_C0_LOG (HIST_C0_BITS-3) +#define BOX_C1_LOG (HIST_C1_BITS-3) +#define BOX_C2_LOG (HIST_C2_BITS-3) + +#define BOX_C0_ELEMS (1<actual_number_of_colors; + int maxc0, maxc1, maxc2; + int centerc0, centerc1, centerc2; + int i, x, ncolors; + INT32 minmaxdist, min_dist, max_dist, tdist; + INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ + + /* Compute true coordinates of update box's upper corner and center. + * Actually we compute the coordinates of the center of the upper-corner + * histogram cell, which are the upper bounds of the volume we care about. + * Note that since ">>" rounds down, the "center" values may be closer to + * min than to max; hence comparisons to them must be "<=", not "<". + */ + maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT)); + centerc0 = (minc0 + maxc0) >> 1; + maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT)); + centerc1 = (minc1 + maxc1) >> 1; + maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT)); + centerc2 = (minc2 + maxc2) >> 1; + + /* For each color in colormap, find: + * 1. its minimum squared-distance to any point in the update box + * (zero if color is within update box); + * 2. its maximum squared-distance to any point in the update box. + * Both of these can be found by considering only the corners of the box. + * We save the minimum distance for each color in mindist[]; + * only the smallest maximum distance is of interest. + */ + minmaxdist = 0x7FFFFFFFL; + + for (i = 0; i < numcolors; i++) { + /* We compute the squared-c0-distance term, then add in the other two. */ + x = GETJSAMPLE(cinfo->colormap[0][i]); + if (x < minc0) { + tdist = (x - minc0) * C0_SCALE; + min_dist = tdist*tdist; + tdist = (x - maxc0) * C0_SCALE; + max_dist = tdist*tdist; + } else if (x > maxc0) { + tdist = (x - maxc0) * C0_SCALE; + min_dist = tdist*tdist; + tdist = (x - minc0) * C0_SCALE; + max_dist = tdist*tdist; + } else { + /* within cell range so no contribution to min_dist */ + min_dist = 0; + if (x <= centerc0) { + tdist = (x - maxc0) * C0_SCALE; + max_dist = tdist*tdist; + } else { + tdist = (x - minc0) * C0_SCALE; + max_dist = tdist*tdist; + } + } + + x = GETJSAMPLE(cinfo->colormap[1][i]); + if (x < minc1) { + tdist = (x - minc1) * C1_SCALE; + min_dist += tdist*tdist; + tdist = (x - maxc1) * C1_SCALE; + max_dist += tdist*tdist; + } else if (x > maxc1) { + tdist = (x - maxc1) * C1_SCALE; + min_dist += tdist*tdist; + tdist = (x - minc1) * C1_SCALE; + max_dist += tdist*tdist; + } else { + /* within cell range so no contribution to min_dist */ + if (x <= centerc1) { + tdist = (x - maxc1) * C1_SCALE; + max_dist += tdist*tdist; + } else { + tdist = (x - minc1) * C1_SCALE; + max_dist += tdist*tdist; + } + } + + x = GETJSAMPLE(cinfo->colormap[2][i]); + if (x < minc2) { + tdist = (x - minc2) * C2_SCALE; + min_dist += tdist*tdist; + tdist = (x - maxc2) * C2_SCALE; + max_dist += tdist*tdist; + } else if (x > maxc2) { + tdist = (x - maxc2) * C2_SCALE; + min_dist += tdist*tdist; + tdist = (x - minc2) * C2_SCALE; + max_dist += tdist*tdist; + } else { + /* within cell range so no contribution to min_dist */ + if (x <= centerc2) { + tdist = (x - maxc2) * C2_SCALE; + max_dist += tdist*tdist; + } else { + tdist = (x - minc2) * C2_SCALE; + max_dist += tdist*tdist; + } + } + + mindist[i] = min_dist; /* save away the results */ + if (max_dist < minmaxdist) + minmaxdist = max_dist; + } + + /* Now we know that no cell in the update box is more than minmaxdist + * away from some colormap entry. Therefore, only colors that are + * within minmaxdist of some part of the box need be considered. + */ + ncolors = 0; + for (i = 0; i < numcolors; i++) { + if (mindist[i] <= minmaxdist) + colorlist[ncolors++] = (JSAMPLE) i; + } + return ncolors; +} + + +LOCAL(void) +find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, + int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) +/* Find the closest colormap entry for each cell in the update box, + * given the list of candidate colors prepared by find_nearby_colors. + * Return the indexes of the closest entries in the bestcolor[] array. + * This routine uses Thomas' incremental distance calculation method to + * find the distance from a colormap entry to successive cells in the box. + */ +{ + int ic0, ic1, ic2; + int i, icolor; + register INT32 * bptr; /* pointer into bestdist[] array */ + JSAMPLE * cptr; /* pointer into bestcolor[] array */ + INT32 dist0, dist1; /* initial distance values */ + register INT32 dist2; /* current distance in inner loop */ + INT32 xx0, xx1; /* distance increments */ + register INT32 xx2; + INT32 inc0, inc1, inc2; /* initial values for increments */ + /* This array holds the distance to the nearest-so-far color for each cell */ + INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; + + /* Initialize best-distance for each cell of the update box */ + bptr = bestdist; + for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--) + *bptr++ = 0x7FFFFFFFL; + + /* For each color selected by find_nearby_colors, + * compute its distance to the center of each cell in the box. + * If that's less than best-so-far, update best distance and color number. + */ + + /* Nominal steps between cell centers ("x" in Thomas article) */ +#define STEP_C0 ((1 << C0_SHIFT) * C0_SCALE) +#define STEP_C1 ((1 << C1_SHIFT) * C1_SCALE) +#define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE) + + for (i = 0; i < numcolors; i++) { + icolor = GETJSAMPLE(colorlist[i]); + /* Compute (square of) distance from minc0/c1/c2 to this color */ + inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE; + dist0 = inc0*inc0; + inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE; + dist0 += inc1*inc1; + inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE; + dist0 += inc2*inc2; + /* Form the initial difference increments */ + inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0; + inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1; + inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2; + /* Now loop over all cells in box, updating distance per Thomas method */ + bptr = bestdist; + cptr = bestcolor; + xx0 = inc0; + for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) { + dist1 = dist0; + xx1 = inc1; + for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) { + dist2 = dist1; + xx2 = inc2; + for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { + if (dist2 < *bptr) { + *bptr = dist2; + *cptr = (JSAMPLE) icolor; + } + dist2 += xx2; + xx2 += 2 * STEP_C2 * STEP_C2; + bptr++; + cptr++; + } + dist1 += xx1; + xx1 += 2 * STEP_C1 * STEP_C1; + } + dist0 += xx0; + xx0 += 2 * STEP_C0 * STEP_C0; + } + } +} + + +LOCAL(void) +fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) +/* Fill the inverse-colormap entries in the update box that contains */ +/* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ +/* we can fill as many others as we wish.) */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + hist3d histogram = cquantize->histogram; + int minc0, minc1, minc2; /* lower left corner of update box */ + int ic0, ic1, ic2; + register JSAMPLE * cptr; /* pointer into bestcolor[] array */ + register histptr cachep; /* pointer into main cache array */ + /* This array lists the candidate colormap indexes. */ + JSAMPLE colorlist[MAXNUMCOLORS]; + int numcolors; /* number of candidate colors */ + /* This array holds the actually closest colormap index for each cell. */ + JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; + + /* Convert cell coordinates to update box ID */ + c0 >>= BOX_C0_LOG; + c1 >>= BOX_C1_LOG; + c2 >>= BOX_C2_LOG; + + /* Compute true coordinates of update box's origin corner. + * Actually we compute the coordinates of the center of the corner + * histogram cell, which are the lower bounds of the volume we care about. + */ + minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1); + minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1); + minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1); + + /* Determine which colormap entries are close enough to be candidates + * for the nearest entry to some cell in the update box. + */ + numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist); + + /* Determine the actually nearest colors. */ + find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, + bestcolor); + + /* Save the best color numbers (plus 1) in the main cache array */ + c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ + c1 <<= BOX_C1_LOG; + c2 <<= BOX_C2_LOG; + cptr = bestcolor; + for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) { + for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) { + cachep = & histogram[c0+ic0][c1+ic1][c2]; + for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) { + *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); + } + } + } +} + + +/* + * Map some rows of pixels to the output colormapped representation. + */ + +METHODDEF(void) +pass2_no_dither (j_decompress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) +/* This version performs no dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + hist3d histogram = cquantize->histogram; + register JSAMPROW inptr, outptr; + register histptr cachep; + register int c0, c1, c2; + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + + for (row = 0; row < num_rows; row++) { + inptr = input_buf[row]; + outptr = output_buf[row]; + for (col = width; col > 0; col--) { + /* get pixel value and index into the cache */ + c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT; + c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT; + c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT; + cachep = & histogram[c0][c1][c2]; + /* If we have not seen this color before, find nearest colormap entry */ + /* and update the cache */ + if (*cachep == 0) + fill_inverse_cmap(cinfo, c0,c1,c2); + /* Now emit the colormap index for this cell */ + *outptr++ = (JSAMPLE) (*cachep - 1); + } + } +} + + +METHODDEF(void) +pass2_fs_dither (j_decompress_ptr cinfo, + JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) +/* This version performs Floyd-Steinberg dithering */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + hist3d histogram = cquantize->histogram; + register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ + LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ + LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ + register FSERRPTR errorptr; /* => fserrors[] at column before current */ + JSAMPROW inptr; /* => current input pixel */ + JSAMPROW outptr; /* => current output pixel */ + histptr cachep; + int dir; /* +1 or -1 depending on direction */ + int dir3; /* 3*dir, for advancing inptr & errorptr */ + int row; + JDIMENSION col; + JDIMENSION width = cinfo->output_width; + JSAMPLE *range_limit = cinfo->sample_range_limit; + int *error_limit = cquantize->error_limiter; + JSAMPROW colormap0 = cinfo->colormap[0]; + JSAMPROW colormap1 = cinfo->colormap[1]; + JSAMPROW colormap2 = cinfo->colormap[2]; + SHIFT_TEMPS + + for (row = 0; row < num_rows; row++) { + inptr = input_buf[row]; + outptr = output_buf[row]; + if (cquantize->on_odd_row) { + /* work right to left in this row */ + inptr += (width-1) * 3; /* so point to rightmost pixel */ + outptr += width-1; + dir = -1; + dir3 = -3; + errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */ + cquantize->on_odd_row = FALSE; /* flip for next time */ + } else { + /* work left to right in this row */ + dir = 1; + dir3 = 3; + errorptr = cquantize->fserrors; /* => entry before first real column */ + cquantize->on_odd_row = TRUE; /* flip for next time */ + } + /* Preset error values: no error propagated to first pixel from left */ + cur0 = cur1 = cur2 = 0; + /* and no error propagated to row below yet */ + belowerr0 = belowerr1 = belowerr2 = 0; + bpreverr0 = bpreverr1 = bpreverr2 = 0; + + for (col = width; col > 0; col--) { + /* curN holds the error propagated from the previous pixel on the + * current line. Add the error propagated from the previous line + * to form the complete error correction term for this pixel, and + * round the error term (which is expressed * 16) to an integer. + * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct + * for either sign of the error value. + * Note: errorptr points to *previous* column's array entry. + */ + cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4); + cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4); + cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4); + /* Limit the error using transfer function set by init_error_limit. + * See comments with init_error_limit for rationale. + */ + cur0 = error_limit[cur0]; + cur1 = error_limit[cur1]; + cur2 = error_limit[cur2]; + /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE. + * The maximum error is +- MAXJSAMPLE (or less with error limiting); + * this sets the required size of the range_limit array. + */ + cur0 += GETJSAMPLE(inptr[0]); + cur1 += GETJSAMPLE(inptr[1]); + cur2 += GETJSAMPLE(inptr[2]); + cur0 = GETJSAMPLE(range_limit[cur0]); + cur1 = GETJSAMPLE(range_limit[cur1]); + cur2 = GETJSAMPLE(range_limit[cur2]); + /* Index into the cache with adjusted pixel value */ + cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT]; + /* If we have not seen this color before, find nearest colormap */ + /* entry and update the cache */ + if (*cachep == 0) + fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); + /* Now emit the colormap index for this cell */ + { register int pixcode = *cachep - 1; + *outptr = (JSAMPLE) pixcode; + /* Compute representation error for this pixel */ + cur0 -= GETJSAMPLE(colormap0[pixcode]); + cur1 -= GETJSAMPLE(colormap1[pixcode]); + cur2 -= GETJSAMPLE(colormap2[pixcode]); + } + /* Compute error fractions to be propagated to adjacent pixels. + * Add these into the running sums, and simultaneously shift the + * next-line error sums left by 1 column. + */ + { register LOCFSERROR bnexterr, delta; + + bnexterr = cur0; /* Process component 0 */ + delta = cur0 * 2; + cur0 += delta; /* form error * 3 */ + errorptr[0] = (FSERROR) (bpreverr0 + cur0); + cur0 += delta; /* form error * 5 */ + bpreverr0 = belowerr0 + cur0; + belowerr0 = bnexterr; + cur0 += delta; /* form error * 7 */ + bnexterr = cur1; /* Process component 1 */ + delta = cur1 * 2; + cur1 += delta; /* form error * 3 */ + errorptr[1] = (FSERROR) (bpreverr1 + cur1); + cur1 += delta; /* form error * 5 */ + bpreverr1 = belowerr1 + cur1; + belowerr1 = bnexterr; + cur1 += delta; /* form error * 7 */ + bnexterr = cur2; /* Process component 2 */ + delta = cur2 * 2; + cur2 += delta; /* form error * 3 */ + errorptr[2] = (FSERROR) (bpreverr2 + cur2); + cur2 += delta; /* form error * 5 */ + bpreverr2 = belowerr2 + cur2; + belowerr2 = bnexterr; + cur2 += delta; /* form error * 7 */ + } + /* At this point curN contains the 7/16 error value to be propagated + * to the next pixel on the current line, and all the errors for the + * next line have been shifted over. We are therefore ready to move on. + */ + inptr += dir3; /* Advance pixel pointers to next column */ + outptr += dir; + errorptr += dir3; /* advance errorptr to current column */ + } + /* Post-loop cleanup: we must unload the final error values into the + * final fserrors[] entry. Note we need not unload belowerrN because + * it is for the dummy column before or after the actual array. + */ + errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */ + errorptr[1] = (FSERROR) bpreverr1; + errorptr[2] = (FSERROR) bpreverr2; + } +} + + +/* + * Initialize the error-limiting transfer function (lookup table). + * The raw F-S error computation can potentially compute error values of up to + * +- MAXJSAMPLE. But we want the maximum correction applied to a pixel to be + * much less, otherwise obviously wrong pixels will be created. (Typical + * effects include weird fringes at color-area boundaries, isolated bright + * pixels in a dark area, etc.) The standard advice for avoiding this problem + * is to ensure that the "corners" of the color cube are allocated as output + * colors; then repeated errors in the same direction cannot cause cascading + * error buildup. However, that only prevents the error from getting + * completely out of hand; Aaron Giles reports that error limiting improves + * the results even with corner colors allocated. + * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty + * well, but the smoother transfer function used below is even better. Thanks + * to Aaron Giles for this idea. + */ + +LOCAL(void) +init_error_limit (j_decompress_ptr cinfo) +/* Allocate and fill in the error_limiter table */ +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + int * table; + int in, out; + + table = (int *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int)); + table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ + cquantize->error_limiter = table; + +#define STEPSIZE ((MAXJSAMPLE+1)/16) + /* Map errors 1:1 up to +- MAXJSAMPLE/16 */ + out = 0; + for (in = 0; in < STEPSIZE; in++, out++) { + table[in] = out; table[-in] = -out; + } + /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */ + for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) { + table[in] = out; table[-in] = -out; + } + /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */ + for (; in <= MAXJSAMPLE; in++) { + table[in] = out; table[-in] = -out; + } +#undef STEPSIZE +} + + +/* + * Finish up at the end of each pass. + */ + +METHODDEF(void) +finish_pass1 (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + + /* Select the representative colors and fill in cinfo->colormap */ + cinfo->colormap = cquantize->sv_colormap; + select_colors(cinfo, cquantize->desired); + /* Force next pass to zero the color index table */ + cquantize->needs_zeroed = TRUE; +} + + +METHODDEF(void) +finish_pass2 (j_decompress_ptr cinfo) +{ + /* no work */ +} + + +/* + * Initialize for each processing pass. + */ + +METHODDEF(void) +start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + hist3d histogram = cquantize->histogram; + int i; + + /* Only F-S dithering or no dithering is supported. */ + /* If user asks for ordered dither, give him F-S. */ + if (cinfo->dither_mode != JDITHER_NONE) + cinfo->dither_mode = JDITHER_FS; + + if (is_pre_scan) { + /* Set up method pointers */ + cquantize->pub.color_quantize = prescan_quantize; + cquantize->pub.finish_pass = finish_pass1; + cquantize->needs_zeroed = TRUE; /* Always zero histogram */ + } else { + /* Set up method pointers */ + if (cinfo->dither_mode == JDITHER_FS) + cquantize->pub.color_quantize = pass2_fs_dither; + else + cquantize->pub.color_quantize = pass2_no_dither; + cquantize->pub.finish_pass = finish_pass2; + + /* Make sure color count is acceptable */ + i = cinfo->actual_number_of_colors; + if (i < 1) + ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1); + if (i > MAXNUMCOLORS) + ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); + + if (cinfo->dither_mode == JDITHER_FS) { + size_t arraysize = (size_t) ((cinfo->output_width + 2) * + (3 * SIZEOF(FSERROR))); + /* Allocate Floyd-Steinberg workspace if we didn't already. */ + if (cquantize->fserrors == NULL) + cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) + ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize); + /* Initialize the propagated errors to zero. */ + jzero_far((void FAR *) cquantize->fserrors, arraysize); + /* Make the error-limit table if we didn't already. */ + if (cquantize->error_limiter == NULL) + init_error_limit(cinfo); + cquantize->on_odd_row = FALSE; + } + + } + /* Zero the histogram or inverse color map, if necessary */ + if (cquantize->needs_zeroed) { + for (i = 0; i < HIST_C0_ELEMS; i++) { + jzero_far((void FAR *) histogram[i], + HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); + } + cquantize->needs_zeroed = FALSE; + } +} + + +/* + * Switch to a new external colormap between output passes. + */ + +METHODDEF(void) +new_color_map_2_quant (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; + + /* Reset the inverse color map */ + cquantize->needs_zeroed = TRUE; +} + + +/* + * Module initialization routine for 2-pass color quantization. + */ + +GLOBAL(void) +jinit_2pass_quantizer (j_decompress_ptr cinfo) +{ + my_cquantize_ptr cquantize; + int i; + + cquantize = (my_cquantize_ptr) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + SIZEOF(my_cquantizer)); + cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; + cquantize->pub.start_pass = start_pass_2_quant; + cquantize->pub.new_color_map = new_color_map_2_quant; + cquantize->fserrors = NULL; /* flag optional arrays not allocated */ + cquantize->error_limiter = NULL; + + /* Make sure jdmaster didn't give me a case I can't handle */ + if (cinfo->out_color_components != 3) + ERREXIT(cinfo, JERR_NOTIMPL); + + /* Allocate the histogram/inverse colormap storage */ + cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d)); + for (i = 0; i < HIST_C0_ELEMS; i++) { + cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell)); + } + cquantize->needs_zeroed = TRUE; /* histogram is garbage now */ + + /* Allocate storage for the completed colormap, if required. + * We do this now since it is FAR storage and may affect + * the memory manager's space calculations. + */ + if (cinfo->enable_2pass_quant) { + /* Make sure color count is acceptable */ + int desired = cinfo->desired_number_of_colors; + /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */ + if (desired < 8) + ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8); + /* Make sure colormap indexes can be represented by JSAMPLEs */ + if (desired > MAXNUMCOLORS) + ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); + cquantize->sv_colormap = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3); + cquantize->desired = desired; + } else + cquantize->sv_colormap = NULL; + + /* Only F-S dithering or no dithering is supported. */ + /* If user asks for ordered dither, give him F-S. */ + if (cinfo->dither_mode != JDITHER_NONE) + cinfo->dither_mode = JDITHER_FS; + + /* Allocate Floyd-Steinberg workspace if necessary. + * This isn't really needed until pass 2, but again it is FAR storage. + * Although we will cope with a later change in dither_mode, + * we do not promise to honor max_memory_to_use if dither_mode changes. + */ + if (cinfo->dither_mode == JDITHER_FS) { + cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR)))); + /* Might as well create the error-limiting table too. */ + init_error_limit(cinfo); + } +} + +#endif /* QUANT_2PASS_SUPPORTED */ diff --git a/src/SFML/Graphics/libjpeg/jutils.c b/src/SFML/Graphics/libjpeg/jutils.c new file mode 100644 index 00000000..286cda20 --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jutils.c @@ -0,0 +1,179 @@ +/* + * jutils.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains tables and miscellaneous utility routines needed + * for both compression and decompression. + * Note we prefix all global names with "j" to minimize conflicts with + * a surrounding application. + */ + +#define JPEG_INTERNALS +#include "jinclude.h" +#include "jpeglib.h" + + +/* + * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element + * of a DCT block read in natural order (left to right, top to bottom). + */ + +#if 0 /* This table is not actually needed in v6a */ + +const int jpeg_zigzag_order[DCTSIZE2] = { + 0, 1, 5, 6, 14, 15, 27, 28, + 2, 4, 7, 13, 16, 26, 29, 42, + 3, 8, 12, 17, 25, 30, 41, 43, + 9, 11, 18, 24, 31, 40, 44, 53, + 10, 19, 23, 32, 39, 45, 52, 54, + 20, 22, 33, 38, 46, 51, 55, 60, + 21, 34, 37, 47, 50, 56, 59, 61, + 35, 36, 48, 49, 57, 58, 62, 63 +}; + +#endif + +/* + * jpeg_natural_order[i] is the natural-order position of the i'th element + * of zigzag order. + * + * When reading corrupted data, the Huffman decoders could attempt + * to reference an entry beyond the end of this array (if the decoded + * zero run length reaches past the end of the block). To prevent + * wild stores without adding an inner-loop test, we put some extra + * "63"s after the real entries. This will cause the extra coefficient + * to be stored in location 63 of the block, not somewhere random. + * The worst case would be a run-length of 15, which means we need 16 + * fake entries. + */ + +const int jpeg_natural_order[DCTSIZE2+16] = { + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63, + 63, 63, 63, 63, 63, 63, 63, 63, /* extra entries for safety in decoder */ + 63, 63, 63, 63, 63, 63, 63, 63 +}; + + +/* + * Arithmetic utilities + */ + +GLOBAL(long) +jdiv_round_up (long a, long b) +/* Compute a/b rounded up to next integer, ie, ceil(a/b) */ +/* Assumes a >= 0, b > 0 */ +{ + return (a + b - 1L) / b; +} + + +GLOBAL(long) +jround_up (long a, long b) +/* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ +/* Assumes a >= 0, b > 0 */ +{ + a += b - 1L; + return a - (a % b); +} + + +/* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays + * and coefficient-block arrays. This won't work on 80x86 because the arrays + * are FAR and we're assuming a small-pointer memory model. However, some + * DOS compilers provide far-pointer versions of memcpy() and memset() even + * in the small-model libraries. These will be used if USE_FMEM is defined. + * Otherwise, the routines below do it the hard way. (The performance cost + * is not all that great, because these routines aren't very heavily used.) + */ + +#ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */ +#define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size) +#define FMEMZERO(target,size) MEMZERO(target,size) +#else /* 80x86 case, define if we can */ +#ifdef USE_FMEM +#define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)(src), (size_t)(size)) +#define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size)) +#endif +#endif + + +GLOBAL(void) +jcopy_sample_rows (JSAMPARRAY input_array, int source_row, + JSAMPARRAY output_array, int dest_row, + int num_rows, JDIMENSION num_cols) +/* Copy some rows of samples from one place to another. + * num_rows rows are copied from input_array[source_row++] + * to output_array[dest_row++]; these areas may overlap for duplication. + * The source and destination arrays must be at least as wide as num_cols. + */ +{ + register JSAMPROW inptr, outptr; +#ifdef FMEMCOPY + register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE)); +#else + register JDIMENSION count; +#endif + register int row; + + input_array += source_row; + output_array += dest_row; + + for (row = num_rows; row > 0; row--) { + inptr = *input_array++; + outptr = *output_array++; +#ifdef FMEMCOPY + FMEMCOPY(outptr, inptr, count); +#else + for (count = num_cols; count > 0; count--) + *outptr++ = *inptr++; /* needn't bother with GETJSAMPLE() here */ +#endif + } +} + + +GLOBAL(void) +jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, + JDIMENSION num_blocks) +/* Copy a row of coefficient blocks from one place to another. */ +{ +#ifdef FMEMCOPY + FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF))); +#else + register JCOEFPTR inptr, outptr; + register long count; + + inptr = (JCOEFPTR) input_row; + outptr = (JCOEFPTR) output_row; + for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) { + *outptr++ = *inptr++; + } +#endif +} + + +GLOBAL(void) +jzero_far (void FAR * target, size_t bytestozero) +/* Zero out a chunk of FAR memory. */ +/* This might be sample-array data, block-array data, or alloc_large data. */ +{ +#ifdef FMEMZERO + FMEMZERO(target, bytestozero); +#else + register char FAR * ptr = (char FAR *) target; + register size_t count; + + for (count = bytestozero; count > 0; count--) { + *ptr++ = 0; + } +#endif +} diff --git a/src/SFML/Graphics/libjpeg/jversion.h b/src/SFML/Graphics/libjpeg/jversion.h new file mode 100644 index 00000000..dadd453a --- /dev/null +++ b/src/SFML/Graphics/libjpeg/jversion.h @@ -0,0 +1,14 @@ +/* + * jversion.h + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains software version identification. + */ + + +#define JVERSION "6b 27-Mar-1998" + +#define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" diff --git a/src/SFML/Graphics/libpng/png.c b/src/SFML/Graphics/libpng/png.c new file mode 100644 index 00000000..1b6db94d --- /dev/null +++ b/src/SFML/Graphics/libpng/png.c @@ -0,0 +1,828 @@ + +/* png.c - location for general purpose libpng functions + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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_8 Your_png_h_is_not_version_1_2_8; + +/* 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; + +/* 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}; + +/* 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; + +/* 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_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. + */ + +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 (0); + + if (start > 7) + return (0); + + if (start + num_to_check > 8) + num_to_check = 8 - start; + + return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check))); +} + +/* (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)); +} + +/* 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)); +} + +/* 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_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 + +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.8 - December 3, 2004\n\ + Copyright (c) 1998-2004 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) ""); +} + +#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)); +} + +/* 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_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 */ + +#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 */ diff --git a/src/SFML/Graphics/libpng/png.h b/src/SFML/Graphics/libpng/png.h new file mode 100644 index 00000000..12569236 --- /dev/null +++ b/src/SFML/Graphics/libpng/png.h @@ -0,0 +1,3419 @@ +/* png.h - header file for PNG reference library + * + * libpng version 1.2.8 - December 3, 2004 + * Copyright (c) 1998-2004 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.) + * + * Authors and maintainers: + * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat + * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger + * libpng versions 0.97, January 1998, through 1.2.8 - December 3, 2004: Glenn + * See also "Contributing Authors", below. + * + * Note about libpng version numbers: + * + * Due to various miscommunications, unforeseen code incompatibilities + * and occasional factors outside the authors' control, version numbering + * on the library has not always been consistent and straightforward. + * The following table summarizes matters since version 0.89c, which was + * the first widely used release: + * + * source png.h png.h shared-lib + * version string int version + * ------- ------ ----- ---------- + * 0.89c "1.0 beta 3" 0.89 89 1.0.89 + * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] + * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] + * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] + * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] + * 0.97c 0.97 97 2.0.97 + * 0.98 0.98 98 2.0.98 + * 0.99 0.99 98 2.0.99 + * 0.99a-m 0.99 99 2.0.99 + * 1.00 1.00 100 2.1.0 [100 should be 10000] + * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] + * 1.0.1 png.h string is 10001 2.1.0 + * 1.0.1a-e identical to the 10002 from here on, the shared library + * 1.0.2 source version) 10002 is 2.V where V is the source code + * 1.0.2a-b 10003 version, except as noted. + * 1.0.3 10003 + * 1.0.3a-d 10004 + * 1.0.4 10004 + * 1.0.4a-f 10005 + * 1.0.5 (+ 2 patches) 10005 + * 1.0.5a-d 10006 + * 1.0.5e-r 10100 (not source compatible) + * 1.0.5s-v 10006 (not binary compatible) + * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) + * 1.0.6d-f 10007 (still binary incompatible) + * 1.0.6g 10007 + * 1.0.6h 10007 10.6h (testing xy.z so-numbering) + * 1.0.6i 10007 10.6i + * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) + * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) + * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) + * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) + * 1.0.7 1 10007 (still compatible) + * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 + * 1.0.8rc1 1 10008 2.1.0.8rc1 + * 1.0.8 1 10008 2.1.0.8 + * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 + * 1.0.9rc1 1 10009 2.1.0.9rc1 + * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 + * 1.0.9rc2 1 10009 2.1.0.9rc2 + * 1.0.9 1 10009 2.1.0.9 + * 1.0.10beta1 1 10010 2.1.0.10beta1 + * 1.0.10rc1 1 10010 2.1.0.10rc1 + * 1.0.10 1 10010 2.1.0.10 + * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 + * 1.0.11rc1 1 10011 2.1.0.11rc1 + * 1.0.11 1 10011 2.1.0.11 + * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 + * 1.0.12rc1 2 10012 2.1.0.12rc1 + * 1.0.12 2 10012 2.1.0.12 + * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) + * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 + * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 + * 1.2.0rc1 3 10200 3.1.2.0rc1 + * 1.2.0 3 10200 3.1.2.0 + * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 + * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 + * 1.2.1 3 10201 3.1.2.1 + * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 + * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 + * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 + * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 + * 1.0.13 10 10013 10.so.0.1.0.13 + * 1.2.2 12 10202 12.so.0.1.2.2 + * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 + * 1.2.3 12 10203 12.so.0.1.2.3 + * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 + * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 + * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 + * 1.0.14 10 10014 10.so.0.1.0.14 + * 1.2.4 13 10204 12.so.0.1.2.4 + * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 + * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 + * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 + * 1.0.15 10 10015 10.so.0.1.0.15 + * 1.2.5 13 10205 12.so.0.1.2.5 + * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 + * 1.0.16 10 10016 10.so.0.1.0.16 + * 1.2.6 13 10206 12.so.0.1.2.6 + * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 + * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1 + * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 + * 1.0.17 10 10017 12.so.0.1.0.17 + * 1.2.7 13 10207 12.so.0.1.2.7 + * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 + * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5 + * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 + * 1.0.18 10 10018 12.so.0.1.0.18 + * 1.2.8 13 10208 12.so.0.1.2.8 + * + * Henceforth the source version will match the shared-library major + * and minor numbers; the shared-library major version number will be + * used for changes in backward compatibility, as it is intended. The + * PNG_LIBPNG_VER macro, which is not used within libpng but is available + * for applications, is an unsigned integer of the form xyyzz corresponding + * to the source version x.y.z (leading zeros in y and z). Beta versions + * were given the previous public release number plus a letter, until + * version 1.0.6j; from then on they were given the upcoming public + * release number plus "betaNN" or "rcN". + * + * Binary incompatibility exists only when applications make direct access + * to the info_ptr or png_ptr members through png.h, and the compiled + * application is loaded with a different version of the library. + * + * DLLNUM will change each time there are forward or backward changes + * in binary compatibility (e.g., when a new feature is added). + * + * See libpng.txt or libpng.3 for more information. The PNG specification + * is available as a W3C Recommendation and as an ISO Specification, + * defines should NOT be changed. + */ +#define PNG_INFO_gAMA 0x0001 +#define PNG_INFO_sBIT 0x0002 +#define PNG_INFO_cHRM 0x0004 +#define PNG_INFO_PLTE 0x0008 +#define PNG_INFO_tRNS 0x0010 +#define PNG_INFO_bKGD 0x0020 +#define PNG_INFO_hIST 0x0040 +#define PNG_INFO_pHYs 0x0080 +#define PNG_INFO_oFFs 0x0100 +#define PNG_INFO_tIME 0x0200 +#define PNG_INFO_pCAL 0x0400 +#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ +#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ +#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ +#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ +#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ + +/* This is used for the transformation routines, as some of them + * change these values for the row. It also should enable using + * the routines for other purposes. + */ +typedef struct png_row_info_struct +{ + png_uint_32 width; /* width of row */ + png_uint_32 rowbytes; /* number of bytes in row */ + png_byte color_type; /* color type of row */ + png_byte bit_depth; /* bit depth of row */ + png_byte channels; /* number of channels (1, 2, 3, or 4) */ + png_byte pixel_depth; /* bits per pixel (depth * channels) */ +} png_row_info; + +typedef png_row_info FAR * png_row_infop; +typedef png_row_info FAR * FAR * png_row_infopp; + +/* These are the function types for the I/O functions and for the functions + * that allow the user to override the default I/O functions with his or her + * own. The png_error_ptr type should match that of user-supplied warning + * and error functions, while the png_rw_ptr type should match that of the + * user read/write data functions. + */ +typedef struct png_struct_def png_struct; +typedef png_struct FAR * png_structp; + +typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); +typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); +typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); +typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, + int)); +typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, + int)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); +typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, + png_uint_32, int)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, + png_row_infop, png_bytep)); +#endif + +#if defined(PNG_USER_CHUNKS_SUPPORTED) +typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); +#endif +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); +#endif + +/* Transform masks for the high-level interface */ +#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ +#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ +#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ +#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ +#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ +#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ +#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ +#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ +#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ +#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ +#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ +#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ +#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ + +/* Flags for MNG supported features */ +#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 +#define PNG_FLAG_MNG_FILTER_64 0x04 +#define PNG_ALL_MNG_FEATURES 0x05 + +typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); +typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); + +/* The structure that holds the information to read and write PNG files. + * The only people who need to care about what is inside of this are the + * people who will be modifying the library for their own special needs. + * It should NOT be accessed directly by an application, except to store + * the jmp_buf. + */ + +struct png_struct_def +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf jmpbuf; /* used in png_error */ +#endif + png_error_ptr error_fn; /* function for printing errors and aborting */ + png_error_ptr warning_fn; /* function for printing warnings */ + png_voidp error_ptr; /* user supplied struct for error functions */ + png_rw_ptr write_data_fn; /* function for writing output data */ + png_rw_ptr read_data_fn; /* function for reading input data */ + png_voidp io_ptr; /* ptr to application struct for I/O functions */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) + png_user_transform_ptr read_user_transform_fn; /* user read transform */ +#endif + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_user_transform_ptr write_user_transform_fn; /* user write transform */ +#endif + +/* These were added in libpng-1.0.2 */ +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + png_voidp user_transform_ptr; /* user supplied struct for user transform */ + png_byte user_transform_depth; /* bit depth of user transformed pixels */ + png_byte user_transform_channels; /* channels in user transformed pixels */ +#endif +#endif + + png_uint_32 mode; /* tells us where we are in the PNG file */ + png_uint_32 flags; /* flags indicating various things to libpng */ + png_uint_32 transformations; /* which transformations to perform */ + + z_stream zstream; /* pointer to decompression structure (below) */ + png_bytep zbuf; /* buffer for zlib */ + png_size_t zbuf_size; /* size of zbuf */ + int zlib_level; /* holds zlib compression level */ + int zlib_method; /* holds zlib compression method */ + int zlib_window_bits; /* holds zlib compression window bits */ + int zlib_mem_level; /* holds zlib compression memory level */ + int zlib_strategy; /* holds zlib compression strategy */ + + png_uint_32 width; /* width of image in pixels */ + png_uint_32 height; /* height of image in pixels */ + png_uint_32 num_rows; /* number of rows in current pass */ + png_uint_32 usr_width; /* width of row at start of write */ + png_uint_32 rowbytes; /* size of row in bytes */ + png_uint_32 irowbytes; /* size of current interlaced row in bytes */ + png_uint_32 iwidth; /* width of current interlaced row in pixels */ + png_uint_32 row_number; /* current row in interlace pass */ + png_bytep prev_row; /* buffer to save previous (unfiltered) row */ + png_bytep row_buf; /* buffer to save current (unfiltered) row */ + png_bytep sub_row; /* buffer to save "sub" row when filtering */ + png_bytep up_row; /* buffer to save "up" row when filtering */ + png_bytep avg_row; /* buffer to save "avg" row when filtering */ + png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ + png_row_info row_info; /* used for transformation routines */ + + png_uint_32 idat_size; /* current IDAT size for read */ + png_uint_32 crc; /* current chunk CRC value */ + png_colorp palette; /* palette from the input file */ + png_uint_16 num_palette; /* number of color entries in palette */ + png_uint_16 num_trans; /* number of transparency values */ + png_byte chunk_name[5]; /* null-terminated name of current chunk */ + png_byte compression; /* file compression type (always 0) */ + png_byte filter; /* file filter type (always 0) */ + png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ + png_byte pass; /* current interlace pass (0 - 6) */ + png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ + png_byte color_type; /* color type of file */ + png_byte bit_depth; /* bit depth of file */ + png_byte usr_bit_depth; /* bit depth of users row */ + png_byte pixel_depth; /* number of bits per pixel */ + png_byte channels; /* number of channels in file */ + png_byte usr_channels; /* channels at start of write */ + png_byte sig_bytes; /* magic bytes read/written from start of file */ + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +#ifdef PNG_LEGACY_SUPPORTED + png_byte filler; /* filler byte for pixel expansion */ +#else + png_uint_16 filler; /* filler bytes for pixel expansion */ +#endif +#endif + +#if defined(PNG_bKGD_SUPPORTED) + png_byte background_gamma_type; +# ifdef PNG_FLOATING_POINT_SUPPORTED + float background_gamma; +# endif + png_color_16 background; /* background color in screen gamma space */ +#if defined(PNG_READ_GAMMA_SUPPORTED) + png_color_16 background_1; /* background normalized to gamma 1.0 */ +#endif +#endif /* PNG_bKGD_SUPPORTED */ + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) + png_flush_ptr output_flush_fn;/* Function for flushing output */ + png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ + png_uint_32 flush_rows; /* number of rows written since last flush */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ +#ifdef PNG_FLOATING_POINT_SUPPORTED + float gamma; /* file gamma value */ + float screen_gamma; /* screen gamma value (display_exponent) */ +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep gamma_table; /* gamma table for 8-bit depth files */ + png_bytep gamma_from_1; /* converts from 1.0 to screen */ + png_bytep gamma_to_1; /* converts from file to 1.0 */ + png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ + png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ + png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) + png_color_8 sig_bit; /* significant bits in each available channel */ +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) + png_color_8 shift; /* shift for significant bit tranformation */ +#endif + +#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ + || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_bytep trans; /* transparency values for paletted files */ + png_color_16 trans_values; /* transparency values for non-paletted files */ +#endif + + png_read_status_ptr read_row_fn; /* called after each row is decoded */ + png_write_status_ptr write_row_fn; /* called after each row is encoded */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED + png_progressive_info_ptr info_fn; /* called after header data fully read */ + png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ + png_progressive_end_ptr end_fn; /* called after image is complete */ + png_bytep save_buffer_ptr; /* current location in save_buffer */ + png_bytep save_buffer; /* buffer for previously read data */ + png_bytep current_buffer_ptr; /* current location in current_buffer */ + png_bytep current_buffer; /* buffer for recently used data */ + png_uint_32 push_length; /* size of current input chunk */ + png_uint_32 skip_length; /* bytes to skip in input data */ + png_size_t save_buffer_size; /* amount of data now in save_buffer */ + png_size_t save_buffer_max; /* total size of save_buffer */ + png_size_t buffer_size; /* total amount of available input data */ + png_size_t current_buffer_size; /* amount of data now in current_buffer */ + int process_mode; /* what push library is currently doing */ + int cur_palette; /* current push library palette index */ + +# if defined(PNG_TEXT_SUPPORTED) + png_size_t current_text_size; /* current size of text input data */ + png_size_t current_text_left; /* how much text left to read in input */ + png_charp current_text; /* current text chunk buffer */ + png_charp current_text_ptr; /* current location in current_text */ +# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */ + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) +/* for the Borland special 64K segment handler */ + png_bytepp offset_table_ptr; + png_bytep offset_table; + png_uint_16 offset_table_number; + png_uint_16 offset_table_count; + png_uint_16 offset_table_count_free; +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) + png_bytep palette_lookup; /* lookup table for dithering */ + png_bytep dither_index; /* index translation for palette files */ +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) + png_uint_16p hist; /* histogram */ +#endif + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + png_byte heuristic_method; /* heuristic for row filter selection */ + png_byte num_prev_filters; /* number of weights for previous rows */ + png_bytep prev_filters; /* filter type(s) of previous row(s) */ + png_uint_16p filter_weights; /* weight(s) for previous line(s) */ + png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ + png_uint_16p filter_costs; /* relative filter calculation cost */ + png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ +#endif + +#if defined(PNG_TIME_RFC1123_SUPPORTED) + png_charp time_buffer; /* String to hold RFC 1123 time text */ +#endif + +/* New members added in libpng-1.0.6 */ + +#ifdef PNG_FREE_ME_SUPPORTED + png_uint_32 free_me; /* flags items libpng is responsible for freeing */ +#endif + +#if defined(PNG_USER_CHUNKS_SUPPORTED) + png_voidp user_chunk_ptr; + png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ +#endif + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) + int num_chunk_list; + png_bytep chunk_list; +#endif + +/* New members added in libpng-1.0.3 */ +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + png_byte rgb_to_gray_status; + /* These were changed from png_byte in libpng-1.0.6 */ + png_uint_16 rgb_to_gray_red_coeff; + png_uint_16 rgb_to_gray_green_coeff; + png_uint_16 rgb_to_gray_blue_coeff; +#endif + +/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) || \ + defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* changed from png_byte to png_uint_32 at version 1.2.0 */ +#ifdef PNG_1_0_X + png_byte mng_features_permitted; +#else + png_uint_32 mng_features_permitted; +#endif /* PNG_1_0_X */ +#endif + +/* New member added in libpng-1.0.7 */ +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + png_fixed_point int_gamma; +#endif + +/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) + png_byte filter_type; +#endif + +#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)) +/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ + png_uint_32 row_buf_size; +#endif + +/* New members added in libpng-1.2.0 */ +#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) + png_byte mmx_bitdepth_threshold; + png_uint_32 mmx_rowbytes_threshold; + png_uint_32 asm_flags; +#endif + +/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ +#ifdef PNG_USER_MEM_SUPPORTED + png_voidp mem_ptr; /* user supplied struct for mem functions */ + png_malloc_ptr malloc_fn; /* function for allocating memory */ + png_free_ptr free_fn; /* function for freeing memory */ +#endif + +/* New member added in libpng-1.0.13 and 1.2.0 */ + png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* The following three members were added at version 1.0.14 and 1.2.4 */ + png_bytep dither_sort; /* working sort array */ + png_bytep index_to_palette; /* where the original index currently is */ + /* in the palette */ + png_bytep palette_to_index; /* which original index points to this */ + /* palette color */ +#endif + +/* New members added in libpng-1.0.16 and 1.2.6 */ + png_byte compression_type; + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_uint_32 user_width_max; + png_uint_32 user_height_max; +#endif + +}; + + +/* This triggers a compiler error in png.c, if png.c and png.h + * do not agree upon the version number. + */ +typedef png_structp version_1_2_8; + +typedef png_struct FAR * FAR * png_structpp; + +/* Here are the function definitions most commonly used. This is not + * the place to find out how to use libpng. See libpng.txt for the + * full explanation, see example.c for the summary. This just provides + * a simple one line description of the use of each function. + */ + +/* Returns the version number of the library */ +extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); + +/* Tell lib we have already handled the first magic bytes. + * Handling more than 8 bytes from the beginning of the file is an error. + */ +extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, + int num_bytes)); + +/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a + * PNG file. Returns zero if the supplied bytes match the 8-byte PNG + * signature, and non-zero otherwise. Having num_to_check == 0 or + * start > 7 will always fail (ie return non-zero). + */ +extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, + png_size_t num_to_check)); + +/* Simple signature checking function. This is the same as calling + * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). + */ +extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); + +/* Allocate and initialize png_ptr struct for reading, and any other memory. */ +extern PNG_EXPORT(png_structp,png_create_read_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)); + +/* Allocate and initialize png_ptr struct for writing, and any other memory */ +extern PNG_EXPORT(png_structp,png_create_write_struct) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn)); + +#ifdef PNG_WRITE_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_WRITE_SUPPORTED +extern PNG_EXPORT(void,png_set_compression_buffer_size) + PNGARG((png_structp png_ptr, png_uint_32 size)); +#endif + +/* Reset the compression stream */ +extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); + +/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_structp,png_create_read_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +extern PNG_EXPORT(png_structp,png_create_write_struct_2) + PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +#endif + +/* Write a PNG chunk - size, type, (optional) data, CRC. */ +extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_bytep data, png_size_t length)); + +/* Write the start of a PNG chunk - length and chunk name. */ +extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, + png_bytep chunk_name, png_uint_32 length)); + +/* Write the data of a PNG chunk started with png_write_chunk_start(). */ +extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ +extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); + +/* Allocate and initialize the info structure */ +extern PNG_EXPORT(png_infop,png_create_info_struct) + PNGARG((png_structp png_ptr)); + +/* Initialize the info structure (old interface - DEPRECATED) */ +extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); +#undef png_info_init +#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\ + png_sizeof(png_info)); +extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, + png_size_t png_info_struct_size)); + +/* Writes all the PNG information before the image. */ +extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the information before the actual image data. */ +extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#if defined(PNG_TIME_RFC1123_SUPPORTED) +extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) + PNGARG((png_structp png_ptr, png_timep ptime)); +#endif + +#if !defined(_WIN32_WCE) +/* "time.h" functions are not supported on WindowsCE */ +#if defined(PNG_WRITE_tIME_SUPPORTED) +/* convert from a struct tm to png_time */ +extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, + struct tm FAR * ttime)); + +/* convert from time_t to png_time. Uses gmtime() */ +extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, + time_t ttime)); +#endif /* PNG_WRITE_tIME_SUPPORTED */ +#endif /* _WIN32_WCE */ + +#if defined(PNG_READ_EXPAND_SUPPORTED) +/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ +extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +/* Use blue, green, red order for pixels. */ +extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +/* Expand the grayscale to 24-bit RGB if necessary. */ +extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +/* Reduce RGB to grayscale. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, + int error_action, double red, double green )); +#endif +extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, + int error_action, png_fixed_point red, png_fixed_point green )); +extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp + png_ptr)); +#endif + +extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, + png_colorp palette)); + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ + defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) +/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ +extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +/* The values of the PNG_FILLER_ defines should NOT be changed */ +#define PNG_FILLER_BEFORE 0 +#define PNG_FILLER_AFTER 1 +/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ +#if !defined(PNG_1_0_X) +extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, + png_uint_32 filler, int flags)); +#endif +#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +/* Swap bytes in 16-bit depth files. */ +extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) +/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ +extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) +/* Swap packing order of pixels in bytes. */ +extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) +/* Converts files to legal bit depths. */ +extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, + png_color_8p true_bits)); +#endif + +#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ + defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* Have the code handle the interlacing. Returns the number of passes. */ +extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +/* Invert monochrome files */ +extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +/* Handle alpha and tRNS by replacing with a background color. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, + png_color_16p background_color, int background_gamma_code, + int need_expand, double background_gamma)); +#endif +#define PNG_BACKGROUND_GAMMA_UNKNOWN 0 +#define PNG_BACKGROUND_GAMMA_SCREEN 1 +#define PNG_BACKGROUND_GAMMA_FILE 2 +#define PNG_BACKGROUND_GAMMA_UNIQUE 3 +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +/* strip the second byte of information from a 16-bit depth file. */ +extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* Turn on dithering, and reduce the palette to the number of colors available. */ +extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette, int maximum_colors, + png_uint_16p histogram, int full_dither)); +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +/* Handle gamma correction. Screen_gamma=(display_exponent) */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, + double screen_gamma, double default_file_gamma)); +#endif +#endif + +#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ +/* Deprecated and will be removed. Use png_permit_mng_features() instead. */ +extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, + int empty_plte_permitted)); +#endif + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +/* Set how many lines between output flushes - 0 for no flushing */ +extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); +/* Flush the current PNG output buffer */ +extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); +#endif + +/* optional update palette with requested transformations */ +extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); + +/* optional call to update the users info structure */ +extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read one or more rows of image data. */ +extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); +#endif + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read a row of data. */ +extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, + png_bytep row, + png_bytep display_row)); +#endif + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the whole image into memory at once. */ +extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, + png_bytepp image)); +#endif + +/* write a row of image data */ +extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, + png_bytep row)); + +/* write a few rows of image data */ +extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, + png_bytepp row, png_uint_32 num_rows)); + +/* write the image data */ +extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, + png_bytepp image)); + +/* writes the end of the PNG file. */ +extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* read the end of the PNG file. */ +extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +/* free any memory associated with the png_info_struct */ +extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, + png_infopp info_ptr_ptr)); + +/* free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp + png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); + +/* free all memory used by the read (old method - NOT DLL EXPORTED) */ +extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, + png_infop end_info_ptr)); + +/* free any memory associated with the png_struct and the png_info_structs */ +extern PNG_EXPORT(void,png_destroy_write_struct) + PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); + +/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ +extern void png_write_destroy PNGARG((png_structp png_ptr)); + +/* set the libpng method of handling chunk CRC errors */ +extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, + int crit_action, int ancil_action)); + +/* Values for png_set_crc_action() to say how to handle CRC errors in + * ancillary and critical chunks, and whether to use the data contained + * therein. Note that it is impossible to "discard" data in a critical + * chunk. For versions prior to 0.90, the action was always error/quit, + * whereas in version 0.90 and later, the action for CRC errors in ancillary + * chunks is warn/discard. These values should NOT be changed. + * + * value action:critical action:ancillary + */ +#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ +#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ +#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ +#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ +#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ +#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ + +/* These functions give the user control over the scan-line filtering in + * libpng and the compression methods used by zlib. These functions are + * mainly useful for testing, as the defaults should work with most users. + * Those users who are tight on memory or want faster performance at the + * expense of compression can modify them. See the compression library + * header file (zlib.h) for an explination of the compression functions. + */ + +/* set the filtering method(s) used by libpng. Currently, the only valid + * value for "method" is 0. + */ +extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, + int filters)); + +/* Flags for png_set_filter() to say which filters to use. The flags + * are chosen so that they don't conflict with real filter types + * below, in case they are supplied instead of the #defined constants. + * These values should NOT be changed. + */ +#define PNG_NO_FILTERS 0x00 +#define PNG_FILTER_NONE 0x08 +#define PNG_FILTER_SUB 0x10 +#define PNG_FILTER_UP 0x20 +#define PNG_FILTER_AVG 0x40 +#define PNG_FILTER_PAETH 0x80 +#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ + PNG_FILTER_AVG | PNG_FILTER_PAETH) + +/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. + * These defines should NOT be changed. + */ +#define PNG_FILTER_VALUE_NONE 0 +#define PNG_FILTER_VALUE_SUB 1 +#define PNG_FILTER_VALUE_UP 2 +#define PNG_FILTER_VALUE_AVG 3 +#define PNG_FILTER_VALUE_PAETH 4 +#define PNG_FILTER_VALUE_LAST 5 + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ +/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ + * defines, either the default (minimum-sum-of-absolute-differences), or + * the experimental method (weighted-minimum-sum-of-absolute-differences). + * + * Weights are factors >= 1.0, indicating how important it is to keep the + * filter type consistent between rows. Larger numbers mean the current + * filter is that many times as likely to be the same as the "num_weights" + * previous filters. This is cumulative for each previous row with a weight. + * There needs to be "num_weights" values in "filter_weights", or it can be + * NULL if the weights aren't being specified. Weights have no influence on + * the selection of the first row filter. Well chosen weights can (in theory) + * improve the compression for a given image. + * + * Costs are factors >= 1.0 indicating the relative decoding costs of a + * filter type. Higher costs indicate more decoding expense, and are + * therefore less likely to be selected over a filter with lower computational + * costs. There needs to be a value in "filter_costs" for each valid filter + * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't + * setting the costs. Costs try to improve the speed of decompression without + * unduly increasing the compressed image size. + * + * A negative weight or cost indicates the default value is to be used, and + * values in the range [0.0, 1.0) indicate the value is to remain unchanged. + * The default values for both weights and costs are currently 1.0, but may + * change if good general weighting/cost heuristics can be found. If both + * the weights and costs are set to 1.0, this degenerates the WEIGHTED method + * to the UNWEIGHTED method, but with added encoding time/computation. + */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, + int heuristic_method, int num_weights, png_doublep filter_weights, + png_doublep filter_costs)); +#endif +#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ + +/* Heuristic used for row filter selection. These defines should NOT be + * changed. + */ +#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ +#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ +#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ +#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ + +/* Set the library compression level. Currently, valid values range from + * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 + * (0 - no compression, 9 - "maximal" compression). Note that tests have + * shown that zlib compression levels 3-6 usually perform as well as level 9 + * for PNG images, and do considerably fewer caclulations. In the future, + * these values may not correspond directly to the zlib compression levels. + */ +extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, + int level)); + +extern PNG_EXPORT(void,png_set_compression_mem_level) + PNGARG((png_structp png_ptr, int mem_level)); + +extern PNG_EXPORT(void,png_set_compression_strategy) + PNGARG((png_structp png_ptr, int strategy)); + +extern PNG_EXPORT(void,png_set_compression_window_bits) + PNGARG((png_structp png_ptr, int window_bits)); + +extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, + int method)); + +/* These next functions are called for input/output, memory, and error + * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, + * and call standard C I/O routines such as fread(), fwrite(), and + * fprintf(). These functions can be made to use other I/O routines + * at run time for those applications that need to handle I/O in a + * different manner by calling png_set_???_fn(). See libpng.txt for + * more information. + */ + +#if !defined(PNG_NO_STDIO) +/* Initialize the input/output for the PNG file to the default functions. */ +extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); +#endif + +/* Replace the (error and abort), and warning functions with user + * supplied functions. If no messages are to be printed you must still + * write and use replacement functions. The replacement error_fn should + * still do a longjmp to the last setjmp location if you are using this + * method of error handling. If error_fn or warning_fn is NULL, the + * default function will be used. + */ + +extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); + +/* Return the user pointer associated with the error functions */ +extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); + +/* Replace the default data output functions with a user supplied one(s). + * If buffered output is not used, then output_flush_fn can be set to NULL. + * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time + * output_flush_fn will be ignored (and thus can be NULL). + */ +extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); + +/* Replace the default data input function with a user supplied one. */ +extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, + png_voidp io_ptr, png_rw_ptr read_data_fn)); + +/* Return the user pointer associated with the I/O functions */ +extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); + +extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, + png_read_status_ptr read_row_fn)); + +extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, + png_write_status_ptr write_row_fn)); + +#ifdef PNG_USER_MEM_SUPPORTED +/* Replace the default memory allocation functions with user supplied one(s). */ +extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, + png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +/* Return the user pointer associated with the memory functions */ +extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr read_user_transform_fn)); +#endif + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp + png_ptr, png_user_transform_ptr write_user_transform_fn)); +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp + png_ptr, png_voidp user_transform_ptr, int user_transform_depth, + int user_transform_channels)); +/* Return the user pointer associated with the user transform functions */ +extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) + PNGARG((png_structp png_ptr)); +#endif + +#ifdef PNG_USER_CHUNKS_SUPPORTED +extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, + png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); +extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp + png_ptr)); +#endif + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +/* Sets the function callbacks for the push reader, and a pointer to a + * user-defined structure available to the callback functions. + */ +extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, + png_voidp progressive_ptr, + png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, + png_progressive_end_ptr end_fn)); + +/* returns the user pointer associated with the push read functions */ +extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) + PNGARG((png_structp png_ptr)); + +/* function to be called when data becomes available */ +extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); + +/* function that combines rows. Not very much different than the + * png_combine_row() call. Is this even used????? + */ +extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, + png_bytep old_row, png_bytep new_row)); +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, + png_uint_32 size)); + +#if defined(PNG_1_0_X) +# define png_malloc_warn png_malloc +#else +/* Added at libpng version 1.2.4 */ +extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, + png_uint_32 size)); +#endif + +/* frees a pointer allocated by png_malloc() */ +extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); + +#if defined(PNG_1_0_X) +/* Function to allocate memory for zlib. */ +extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, + uInt size)); + +/* Function to free memory for zlib */ +extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); +#endif + +/* Free data that was allocated internally */ +extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 free_me, int num)); +#ifdef PNG_FREE_ME_SUPPORTED +/* Reassign responsibility for freeing existing data, whether allocated + * by libpng or by the application */ +extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, + png_infop info_ptr, int freer, png_uint_32 mask)); +#endif +/* assignments for png_data_freer */ +#define PNG_DESTROY_WILL_FREE_DATA 1 +#define PNG_SET_WILL_FREE_DATA 1 +#define PNG_USER_WILL_FREE_DATA 2 +/* Flags for png_ptr->free_me and info_ptr->free_me */ +#define PNG_FREE_HIST 0x0008 +#define PNG_FREE_ICCP 0x0010 +#define PNG_FREE_SPLT 0x0020 +#define PNG_FREE_ROWS 0x0040 +#define PNG_FREE_PCAL 0x0080 +#define PNG_FREE_SCAL 0x0100 +#define PNG_FREE_UNKN 0x0200 +#define PNG_FREE_LIST 0x0400 +#define PNG_FREE_PLTE 0x1000 +#define PNG_FREE_TRNS 0x2000 +#define PNG_FREE_TEXT 0x4000 +#define PNG_FREE_ALL 0x7fff +#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ + +#ifdef PNG_USER_MEM_SUPPORTED +extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, + png_uint_32 size)); +extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, + png_voidp ptr)); +#endif + +extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, + png_voidp s1, png_voidp s2, png_uint_32 size)); + +extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, + png_voidp s1, int value, png_uint_32 size)); + +#if defined(USE_FAR_KEYWORD) /* memory model conversion function */ +extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, + int check)); +#endif /* USE_FAR_KEYWORD */ + +/* Fatal error in PNG image of libpng - can't continue */ +extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)); + +/* The same, but the chunk name is prepended to the error string. */ +extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, + png_const_charp error_message)); + +/* Non-fatal error in libpng. Can continue, but may have a problem. */ +extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +/* Non-fatal error in libpng, chunk name is prepended to message. */ +extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, + png_const_charp warning_message)); + +/* The png_set_ functions are for storing values in the png_info_struct. + * Similarly, the png_get_ calls are used to read values from the + * png_info_struct, either storing the parameters in the passed variables, or + * setting pointers into the png_info_struct where the data is stored. The + * png_get_ functions return a non-zero value if the data was available + * in info_ptr, or return zero and do not change any of the parameters if the + * data was not available. + * + * These functions should be used instead of directly accessing png_info + * to avoid problems with future changes in the size and internal layout of + * png_info_struct. + */ +/* Returns "flag" if chunk data is valid in info_ptr. */ +extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, +png_infop info_ptr, png_uint_32 flag)); + +/* Returns number of bytes needed to hold a transformed row. */ +extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +/* Returns row_pointers, which is an array of pointers to scanlines that was +returned from png_read_png(). */ +extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, +png_infop info_ptr)); +/* Set row_pointers, which is an array of pointers to scanlines for use +by png_write_png(). */ +extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytepp row_pointers)); +#endif + +/* Returns number of color channels in image. */ +extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#ifdef PNG_EASY_ACCESS_SUPPORTED +/* Returns image width in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image height in pixels. */ +extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image bit_depth. */ +extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image color_type. */ +extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image filter_type. */ +extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image interlace_type. */ +extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image compression_type. */ +extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns image resolution in pixels per meter, from pHYs chunk data. */ +extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +/* Returns pixel aspect ratio, computed from pHYs chunk data. */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +#endif + +/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ +extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); +extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp +png_ptr, png_infop info_ptr)); + +#endif /* PNG_EASY_ACCESS_SUPPORTED */ + +/* Returns pointer to signature string read from PNG header */ +extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, +png_infop info_ptr)); + +#if defined(PNG_bKGD_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p *background)); +#endif + +#if defined(PNG_bKGD_SUPPORTED) +extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_16p background)); +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((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)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point + *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, + png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point + *int_blue_x, png_fixed_point *int_blue_y)); +#endif +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM) PNGARG((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)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double *file_gamma)); +#endif +extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point *int_file_gamma)); +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, + png_infop info_ptr, double file_gamma)); +#endif +extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_file_gamma)); +#endif + +#if defined(PNG_hIST_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p *hist)); +#endif + +#if defined(PNG_hIST_SUPPORTED) +extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_16p hist)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, + int *bit_depth, int *color_type, int *interlace_method, + int *compression_method, int *filter_method)); + +extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, + int color_type, int interlace_method, int compression_method, + int filter_method)); + +#if defined(PNG_oFFs_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, + int *unit_type)); +#endif + +#if defined(PNG_oFFs_SUPPORTED) +extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, + int unit_type)); +#endif + +#if defined(PNG_pCAL_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((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)); +#endif + +#if defined(PNG_pCAL_SUPPORTED) +extern PNG_EXPORT(void,png_set_pCAL) PNGARG((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)); +#endif + +#if defined(PNG_pHYs_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); +#endif + +#if defined(PNG_pHYs_SUPPORTED) +extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); +#endif + +extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp *palette, int *num_palette)); + +extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_colorp palette, int num_palette)); + +#if defined(PNG_sBIT_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p *sig_bit)); +#endif + +#if defined(PNG_sBIT_SUPPORTED) +extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_color_8p sig_bit)); +#endif + +#if defined(PNG_sRGB_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *intent)); +#endif + +#if defined(PNG_sRGB_SUPPORTED) +extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, + png_infop info_ptr, int intent)); +#endif + +#if defined(PNG_iCCP_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charpp name, int *compression_type, + png_charpp profile, png_uint_32 *proflen)); + /* Note to maintainer: profile should be png_bytepp */ +#endif + +#if defined(PNG_iCCP_SUPPORTED) +extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_charp name, int compression_type, + png_charp profile, png_uint_32 proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#if defined(PNG_sPLT_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tpp entries)); +#endif + +#if defined(PNG_sPLT_SUPPORTED) +extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_sPLT_tp entries, int nentries)); +#endif + +#if defined(PNG_TEXT_SUPPORTED) +/* png_get_text also returns the number of text chunks in *num_text */ +extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp *text_ptr, int *num_text)); +#endif + +/* + * Note while png_set_text() will accept a structure whose text, + * language, and translated keywords are NULL pointers, the structure + * returned by png_get_text will always contain regular + * zero-terminated C strings. They might be empty strings but + * they will never be NULL pointers. + */ + +#if defined(PNG_TEXT_SUPPORTED) +extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#if defined(PNG_tIME_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep *mod_time)); +#endif + +#if defined(PNG_tIME_SUPPORTED) +extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_timep mod_time)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep *trans, int *num_trans, + png_color_16p *trans_values)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_bytep trans, int num_trans, + png_color_16p trans_values)); +#endif + +#if defined(PNG_tRNS_SUPPORTED) +#endif + +#if defined(PNG_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, double *width, double *height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); +#endif +#endif +#endif /* PNG_sCAL_SUPPORTED */ + +#if defined(PNG_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, double width, double height)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, + png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); +#endif +#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +/* provide a list of chunks and how they are to be handled, if the built-in + handling or default unknown chunk handling is not desired. Any chunks not + listed will be handled in the default manner. The IHDR and IEND chunks + must not be listed. + keep = 0: follow default behavour + = 1: do not keep + = 2: keep only if safe-to-copy + = 3: keep even if unsafe-to-copy +*/ +extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp + png_ptr, int keep, png_bytep chunk_list, int num_chunks)); +extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, + png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); +extern PNG_EXPORT(void, png_set_unknown_chunk_location) + PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); +extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp + png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); +#endif +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep + chunk_name)); +#endif + +/* Png_free_data() will turn off the "valid" flag for anything it frees. + If you need to turn it off for a chunk that your application has freed, + you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ +extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, + png_infop info_ptr, int mask)); + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +/* The "params" pointer is currently not used and is for future expansion. */ +extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, + png_infop info_ptr, + int transforms, + png_voidp params)); +#endif + +/* Define PNG_DEBUG at compile time for debugging information. Higher + * numbers for PNG_DEBUG mean more debugging information. This has + * only been added since version 0.95 so it is not implemented throughout + * libpng yet, but more support will be added as needed. + */ +#ifdef PNG_DEBUG +#if (PNG_DEBUG > 0) +#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) +#include +#if (PNG_DEBUG > 1) +#define png_debug(l,m) _RPT0(_CRT_WARN,m) +#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) +#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) +#endif +#else /* PNG_DEBUG_FILE || !_MSC_VER */ +#ifndef PNG_DEBUG_FILE +#define PNG_DEBUG_FILE stderr +#endif /* PNG_DEBUG_FILE */ +#if (PNG_DEBUG > 1) +#define png_debug(l,m) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ +} +#define png_debug1(l,m,p1) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ +} +#define png_debug2(l,m,p1,p2) \ +{ \ + int num_tabs=l; \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ + (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ +} +#endif /* (PNG_DEBUG > 1) */ +#endif /* _MSC_VER */ +#endif /* (PNG_DEBUG > 0) */ +#endif /* PNG_DEBUG */ +#ifndef png_debug +#define png_debug(l, m) +#endif +#ifndef png_debug1 +#define png_debug1(l, m, p1) +#endif +#ifndef png_debug2 +#define png_debug2(l, m, p1, p2) +#endif + +extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void)); + +extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); +extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); + +#ifdef PNG_MNG_FEATURES_SUPPORTED +extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp + png_ptr, png_uint_32 mng_features_permitted)); +#endif + +/* For use in png_set_keep_unknown, added to version 1.2.6 */ +#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 +#define PNG_HANDLE_CHUNK_NEVER 1 +#define PNG_HANDLE_CHUNK_IF_SAFE 2 +#define PNG_HANDLE_CHUNK_ALWAYS 3 + +/* Added to version 1.2.0 */ +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ +#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ +#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 +#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 +#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 +#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 +#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 +#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 +#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ + +#define PNG_MMX_READ_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 ) +#define PNG_MMX_WRITE_FLAGS ( 0 ) + +#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ + | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ + | PNG_MMX_READ_FLAGS \ + | PNG_MMX_WRITE_FLAGS ) + +#define PNG_SELECT_READ 1 +#define PNG_SELECT_WRITE 2 + +#if !defined(PNG_1_0_X) +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) + PNGARG((int flag_select, int *compilerID)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) + PNGARG((int flag_select)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_asm_flags) + PNGARG((png_structp png_ptr)); + +/* pngget.c */ +extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) + PNGARG((png_structp png_ptr)); + +/* pngget.c */ +extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) + PNGARG((png_structp png_ptr)); + +/* pngset.c */ +extern PNG_EXPORT(void,png_set_asm_flags) + PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); + +/* pngset.c */ +extern PNG_EXPORT(void,png_set_mmx_thresholds) + PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, + png_uint_32 mmx_rowbytes_threshold)); + +#endif /* PNG_1_0_X */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + +#if !defined(PNG_1_0_X) +/* png.c, pnggccrd.c, or pngvcrd.c */ +extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); + +/* Strip the prepended error numbers ("#nnn ") from error and warning + * messages before passing them to the error or warning handler. */ +#ifdef PNG_ERROR_NUMBERS_SUPPORTED +extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp + png_ptr, png_uint_32 strip_mode)); +#endif + +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp + png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); +extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp + png_ptr)); +extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp + png_ptr)); +#endif + +/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ + +#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED +/* With these routines we avoid an integer divide, which will be slower on + * most machines. However, it does take more operations than the corresponding + * divide method, so it may be slower on a few RISC systems. There are two + * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. + * + * Note that the rounding factors are NOT supposed to be the same! 128 and + * 32768 are correct for the NODIV code; 127 and 32767 are correct for the + * standard method. + * + * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] + */ + + /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ + +# define png_composite(composite, fg, alpha, bg) \ + { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ + + (png_uint_16)(bg)*(png_uint_16)(255 - \ + (png_uint_16)(alpha)) + (png_uint_16)128); \ + (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } + +# define png_composite_16(composite, fg, alpha, bg) \ + { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ + + (png_uint_32)(bg)*(png_uint_32)(65535L - \ + (png_uint_32)(alpha)) + (png_uint_32)32768L); \ + (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } + +#else /* standard method using integer division */ + +# define png_composite(composite, fg, alpha, bg) \ + (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ + (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ + (png_uint_16)127) / 255) + +# define png_composite_16(composite, fg, alpha, bg) \ + (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ + (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ + (png_uint_32)32767) / (png_uint_32)65535L) + +#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ + +/* These next functions are used internally in the code. They generally + * shouldn't be used unless you are writing code to add or replace some + * functionality in libpng. More information about most functions can + * be found in the files where the functions are located. + */ + +#if defined(PNG_INTERNAL) + +/* Various modes of operation. Note that after an init, mode is set to + * zero automatically when the structure is created. + */ +#define PNG_HAVE_IHDR 0x01 +#define PNG_HAVE_PLTE 0x02 +#define PNG_HAVE_IDAT 0x04 +#define PNG_AFTER_IDAT 0x08 +#define PNG_HAVE_IEND 0x10 +#define PNG_HAVE_gAMA 0x20 +#define PNG_HAVE_cHRM 0x40 +#define PNG_HAVE_sRGB 0x80 +#define PNG_HAVE_CHUNK_HEADER 0x100 +#define PNG_WROTE_tIME 0x200 +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 +#define PNG_BACKGROUND_IS_GRAY 0x800 +#define PNG_HAVE_PNG_SIGNATURE 0x1000 + +/* flags for the transformations the PNG library does on the image data */ +#define PNG_BGR 0x0001 +#define PNG_INTERLACE 0x0002 +#define PNG_PACK 0x0004 +#define PNG_SHIFT 0x0008 +#define PNG_SWAP_BYTES 0x0010 +#define PNG_INVERT_MONO 0x0020 +#define PNG_DITHER 0x0040 +#define PNG_BACKGROUND 0x0080 +#define PNG_BACKGROUND_EXPAND 0x0100 + /* 0x0200 unused */ +#define PNG_16_TO_8 0x0400 +#define PNG_RGBA 0x0800 +#define PNG_EXPAND 0x1000 +#define PNG_GAMMA 0x2000 +#define PNG_GRAY_TO_RGB 0x4000 +#define PNG_FILLER 0x8000L +#define PNG_PACKSWAP 0x10000L +#define PNG_SWAP_ALPHA 0x20000L +#define PNG_STRIP_ALPHA 0x40000L +#define PNG_INVERT_ALPHA 0x80000L +#define PNG_USER_TRANSFORM 0x100000L +#define PNG_RGB_TO_GRAY_ERR 0x200000L +#define PNG_RGB_TO_GRAY_WARN 0x400000L +#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ + /* 0x800000L Unused */ +#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ + /* 0x2000000L unused */ + /* 0x4000000L unused */ + /* 0x8000000L unused */ + /* 0x10000000L unused */ + /* 0x20000000L unused */ + /* 0x40000000L unused */ + +/* flags for png_create_struct */ +#define PNG_STRUCT_PNG 0x0001 +#define PNG_STRUCT_INFO 0x0002 + +/* Scaling factor for filter heuristic weighting calculations */ +#define PNG_WEIGHT_SHIFT 8 +#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) +#define PNG_COST_SHIFT 3 +#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) + +/* flags for the png_ptr->flags rather than declaring a byte for each one */ +#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 +#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 +#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 +#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 +#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 +#define PNG_FLAG_ZLIB_FINISHED 0x0020 +#define PNG_FLAG_ROW_INIT 0x0040 +#define PNG_FLAG_FILLER_AFTER 0x0080 +#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 +#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 +#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 +#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 +#define PNG_FLAG_FREE_PLTE 0x1000 +#define PNG_FLAG_FREE_TRNS 0x2000 +#define PNG_FLAG_FREE_HIST 0x4000 +#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L +#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L +#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L +#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L +#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ +#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ + /* 0x800000L unused */ + /* 0x1000000L unused */ + /* 0x2000000L unused */ + /* 0x4000000L unused */ + /* 0x8000000L unused */ + /* 0x10000000L unused */ + /* 0x20000000L unused */ + /* 0x40000000L unused */ + +#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ + PNG_FLAG_CRC_ANCILLARY_NOWARN) + +#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ + PNG_FLAG_CRC_CRITICAL_IGNORE) + +#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ + PNG_FLAG_CRC_CRITICAL_MASK) + +/* save typing and make code easier to understand */ + +#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ + abs((int)((c1).green) - (int)((c2).green)) + \ + abs((int)((c1).blue) - (int)((c2).blue))) + +/* Added to libpng-1.2.6 JB */ +#define PNG_ROWBYTES(pixel_bits, width) \ + ((pixel_bits) >= 8 ? \ + ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \ + (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) ) + +/* PNG_OUT_OF_RANGE returns true if value is outside the range + ideal-delta..ideal+delta. Each argument is evaluated twice. + "ideal" and "delta" should be constants, normally simple + integers, "value" a variable. Added to libpng-1.2.6 JB */ +#define PNG_OUT_OF_RANGE(value, ideal, delta) \ + ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) + +/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ +#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) +/* place to hold the signature string for a PNG file. */ +#ifdef PNG_USE_GLOBAL_ARRAYS + PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; +#else +#define png_sig png_sig_bytes(NULL) +#endif +#endif /* PNG_NO_EXTERN */ + +/* Constant strings for known chunk types. If you need to add a chunk, + * define the name here, and add an invocation of the macro in png.c and + * wherever it's needed. + */ +#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} +#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} +#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} +#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} +#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} +#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} +#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} +#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} +#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} +#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} +#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} +#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} +#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} +#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} +#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} +#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} +#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} +#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} +#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} +#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} +#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} + +#ifdef PNG_USE_GLOBAL_ARRAYS +PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; +PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; +#endif /* PNG_USE_GLOBAL_ARRAYS */ + + +/* Inline macros to do direct reads of bytes from the input buffer. These + * require that you are using an architecture that uses PNG byte ordering + * (MSB first) and supports unaligned data storage. I think that PowerPC + * in big-endian mode and 680x0 are the only ones that will support this. + * The x86 line of processors definitely do not. The png_get_int_32() + * routine also assumes we are using two's complement format for negative + * values, which is almost certainly true. + */ +#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) +# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) +# define png_get_int_32(buf) ( *((png_int_32p) (buf))) +# endif +# define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) +# define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) +#else +# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED) +PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf)); +# endif +PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf)); +PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf)); +#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ +PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr, + png_bytep buf)); + +/* Initialize png_ptr struct for reading, and allocate any other memory. + * (old interface - DEPRECATED - use png_create_read_struct instead). + */ +extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); +#undef png_read_init +#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); +extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); +extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t + png_info_size)); + +/* Initialize png_ptr struct for writing, and allocate any other memory. + * (old interface - DEPRECATED - use png_create_write_struct instead). + */ +extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); +#undef png_write_init +#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ + PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); +extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size)); +extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, + png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t + png_info_size)); + +/* Allocate memory for an internal libpng struct */ +PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); + +/* Free memory from internal libpng struct */ +PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); + +PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr + malloc_fn, png_voidp mem_ptr)); +PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, + png_free_ptr free_fn, png_voidp mem_ptr)); + +/* Free any memory that info_ptr points to and reset struct. */ +PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +#ifndef PNG_1_0_X +/* Function to allocate memory for zlib. */ +PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); + +/* Function to free memory for zlib */ +PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); + +#ifdef PNG_SIZE_T +/* Function to convert a sizeof an item to png_sizeof item */ + PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); +#endif + +/* Next four functions are used internally as callbacks. PNGAPI is required + * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ + +PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif + +PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, + png_bytep data, png_size_t length)); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +#if !defined(PNG_NO_STDIO) +PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); +#endif +#endif +#else /* PNG_1_0_X */ +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t length)); +#endif +#endif /* PNG_1_0_X */ + +/* Reset the CRC variable */ +PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); + +/* Write the "data" buffer to whatever output you are using. */ +PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read data from whatever input you are using into the "data" buffer */ +PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +/* Read bytes into buf, and update png_ptr->crc */ +PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, + png_size_t length)); + +/* Decompress data in a chunk that uses compression */ +#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ + defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) +PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, + int comp_type, png_charp chunkdata, png_size_t chunklength, + png_size_t prefix_length, png_size_t *data_length)); +#endif + +/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ +PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); + +/* Read the CRC from the file and compare it to the libpng calculated CRC */ +PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); + +/* Calculate the CRC over a section of data. Note that we are only + * passing a maximum of 64K on systems that have this as a memory limit, + * since this is the maximum buffer size we can specify. + */ +PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, + png_size_t length)); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); +#endif + + +/* Place a 32-bit number into a buffer in PNG byte order (big-endian). + * The only currently known PNG chunks that use signed numbers are + * the ancillary extension chunks, oFFs and pCAL. + */ +PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i)); + +#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) +PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i)); +#endif + +/* Place a 16-bit number into a buffer in PNG byte order. + * The parameter is declared unsigned int, not png_uint_16, + * just to avoid potential problems on pre-ANSI C compilers. + */ +PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i)); + +/* simple function to write the signature */ +PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); + +/* write various chunks */ + +/* Write the IHDR chunk, and update the png_struct with the necessary + * information. + */ +PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, + png_uint_32 height, + int bit_depth, int color_type, int compression_method, int filter_method, + int interlace_method)); + +PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, + png_uint_32 num_pal)); + +PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, + png_size_t length)); + +PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); + +#if defined(PNG_WRITE_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point + file_gamma)); +#endif +#endif + +#if defined(PNG_WRITE_sBIT_SUPPORTED) +PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, + int color_type)); +#endif + +#if defined(PNG_WRITE_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_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)); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, + png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point + int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#endif + +#if defined(PNG_WRITE_sRGB_SUPPORTED) +PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, + int intent)); +#endif + +#if defined(PNG_WRITE_iCCP_SUPPORTED) +PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, + png_charp name, int compression_type, + png_charp profile, int proflen)); + /* Note to maintainer: profile should be png_bytep */ +#endif + +#if defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, + png_sPLT_tp palette)); +#endif + +#if defined(PNG_WRITE_tRNS_SUPPORTED) +PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, + png_color_16p values, int number, int color_type)); +#endif + +#if defined(PNG_WRITE_bKGD_SUPPORTED) +PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, + png_color_16p values, int color_type)); +#endif + +#if defined(PNG_WRITE_hIST_SUPPORTED) +PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, + int num_hist)); +#endif + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ + defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) +PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, + png_charp key, png_charpp new_key)); +#endif + +#if defined(PNG_WRITE_tEXt_SUPPORTED) +PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len)); +#endif + +#if defined(PNG_WRITE_zTXt_SUPPORTED) +PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, + png_charp text, png_size_t text_len, int compression)); +#endif + +#if defined(PNG_WRITE_iTXt_SUPPORTED) +PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, + int compression, png_charp key, png_charp lang, png_charp lang_key, + png_charp text)); +#endif + +#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ +PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, + png_infop info_ptr, png_textp text_ptr, int num_text)); +#endif + +#if defined(PNG_WRITE_oFFs_SUPPORTED) +PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, + png_int_32 x_offset, png_int_32 y_offset, int unit_type)); +#endif + +#if defined(PNG_WRITE_pCAL_SUPPORTED) +PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, + png_int_32 X0, png_int_32 X1, int type, int nparams, + png_charp units, png_charpp params)); +#endif + +#if defined(PNG_WRITE_pHYs_SUPPORTED) +PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, + png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, + int unit_type)); +#endif + +#if defined(PNG_WRITE_tIME_SUPPORTED) +PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, + png_timep mod_time)); +#endif + +#if defined(PNG_WRITE_sCAL_SUPPORTED) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, + int unit, double width, double height)); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, + int unit, png_charp width, png_charp height)); +#endif +#endif +#endif + +/* Called when finished processing a row of data */ +PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); + +/* Internal use only. Called before first row of data */ +PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); + +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); +#endif + +/* combine a row of data, dealing with alpha, etc. if requested */ +PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, + int mask)); + +#if defined(PNG_READ_INTERLACING_SUPPORTED) +/* expand an interlaced row */ +/* OLD pre-1.0.9 interface: +PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass, png_uint_32 transformations)); + */ +PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); +#endif + +/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ + +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* grab pixels out of a row for an interlaced pass */ +PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, + png_bytep row, int pass)); +#endif + +/* unfilter a row */ +PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, + png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); + +/* Choose the best filter to use and filter the row data */ +PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, + png_row_infop row_info)); + +/* Write out the filtered row. */ +PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, + png_bytep filtered_row)); +/* finish a row while reading, dealing with interlacing passes, etc. */ +PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); + +/* initialize the row buffers, etc. */ +PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); +/* optional call to update the users info structure */ +PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); + +/* these are the functions that do the transformations */ +#if defined(PNG_READ_FILLER_SUPPORTED) +PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 filler, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ + defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 flags)); +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) +PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) +PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop + row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) +PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) +PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p sig_bits)); +#endif + +#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) +PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, + png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); + +# if defined(PNG_CORRECT_PALETTE_SUPPORTED) +PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, + png_colorp palette, int num_palette)); +# endif +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) +PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); +#endif + +#if defined(PNG_WRITE_PACK_SUPPORTED) +PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, + png_bytep row, png_uint_32 bit_depth)); +#endif + +#if defined(PNG_WRITE_SHIFT_SUPPORTED) +PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, + png_color_8p bit_depth)); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background, + png_color_16p background_1, + png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, + png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, + png_uint_16pp gamma_16_to_1, int gamma_shift)); +#else +PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background)); +#endif +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, + png_bytep gamma_table, png_uint_16pp gamma_16_table, + int gamma_shift)); +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) +PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, + png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); +PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, + png_bytep row, png_color_16p trans_value)); +#endif + +/* The following decodes the appropriate chunks, and does error correction, + * then calls the appropriate callback for the chunk if it is valid. + */ + +/* decode the IHDR chunk */ +PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); + +#if defined(PNG_READ_bKGD_SUPPORTED) +PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_cHRM_SUPPORTED) +PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_gAMA_SUPPORTED) +PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_hIST_SUPPORTED) +PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_iCCP_SUPPORTED) +extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_iCCP_SUPPORTED */ + +#if defined(PNG_READ_iTXt_SUPPORTED) +PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_oFFs_SUPPORTED) +PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_pCAL_SUPPORTED) +PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_pHYs_SUPPORTED) +PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sBIT_SUPPORTED) +PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sCAL_SUPPORTED) +PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_sPLT_SUPPORTED) +extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif /* PNG_READ_sPLT_SUPPORTED */ + +#if defined(PNG_READ_sRGB_SUPPORTED) +PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tEXt_SUPPORTED) +PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tIME_SUPPORTED) +PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_tRNS_SUPPORTED) +PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +#if defined(PNG_READ_zTXt_SUPPORTED) +PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, + png_uint_32 length)); +#endif + +PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); + +PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, + png_bytep chunk_name)); + +/* handle the transformations for reading and writing */ +PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); + +PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, + png_uint_32 length)); +PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, + png_bytep buffer, png_size_t buffer_length)); +PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); +PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); +PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, + png_infop info_ptr)); +PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); +#if defined(PNG_READ_tEXt_SUPPORTED) +PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) +PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) +PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr, png_uint_32 length)); +PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, + png_infop info_ptr)); +#endif + +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + +#ifdef PNG_MNG_FEATURES_SUPPORTED +PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, + png_bytep row)); +#endif + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +/* png.c */ /* PRIVATE */ +PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); +#endif +/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + +#endif /* PNG_INTERNAL */ + +#ifdef __cplusplus +} +#endif + +#endif /* PNG_VERSION_INFO_ONLY */ +/* do not put anything past this line */ +#endif /* PNG_H */ diff --git a/src/SFML/Graphics/libpng/pngconf.h b/src/SFML/Graphics/libpng/pngconf.h new file mode 100644 index 00000000..8ea0f795 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngconf.h @@ -0,0 +1,1437 @@ + +/* pngconf.h - machine configurable file for libpng + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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.) + */ + +/* Any machine specific code is near the front of this file, so if you + * are configuring libpng for a machine, you may want to read the section + * starting here down to where it starts to typedef png_color, png_text, + * and png_info. + */ + +#ifndef PNGCONF_H +#define PNGCONF_H + +#define PNG_1_2_X + +/* + * PNG_USER_CONFIG has to be defined on the compiler command line. This + * includes the resource compiler for Windows DLL configurations. + */ +#ifdef PNG_USER_CONFIG +#include "pngusr.h" +#endif + +/* + * Added at libpng-1.2.8 + * + * If you create a private DLL you need to define in "pngusr.h" the followings: + * #define PNG_USER_PRIVATEBUILD + * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." + * #define PNG_USER_DLLFNAME_POSTFIX + * e.g. // private DLL "libpng13gx.dll" + * #define PNG_USER_DLLFNAME_POSTFIX "gx" + * + * The following macros are also at your disposal if you want to complete the + * DLL VERSIONINFO structure. + * - PNG_USER_VERSIONINFO_COMMENTS + * - PNG_USER_VERSIONINFO_COMPANYNAME + * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS + */ + +#ifdef __STDC__ +#ifdef SPECIALBUILD +# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ + are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") +#endif + +#ifdef PRIVATEBUILD +# pragma message("PRIVATEBUILD is deprecated. Use\ + PNG_USER_PRIVATEBUILD instead.") +# define PNG_USER_PRIVATEBUILD PRIVATEBUILD +#endif +#endif /* __STDC__ */ + +#ifndef PNG_VERSION_INFO_ONLY + +/* End of material added to libpng-1.2.8 */ + +/* This is the size of the compression buffer, and thus the size of + * an IDAT chunk. Make this whatever size you feel is best for your + * machine. One of these will be allocated per png_struct. When this + * is full, it writes the data to the disk, and does some other + * calculations. Making this an extremely small size will slow + * the library down, but you may want to experiment to determine + * where it becomes significant, if you are concerned with memory + * usage. Note that zlib allocates at least 32Kb also. For readers, + * this describes the size of the buffer available to read the data in. + * Unless this gets smaller than the size of a row (compressed), + * it should not make much difference how big this is. + */ + +#ifndef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 8192 +#endif + +/* Enable if you want a write-only libpng */ + +#ifndef PNG_NO_READ_SUPPORTED +# define PNG_READ_SUPPORTED +#endif + +/* Enable if you want a read-only libpng */ + +#ifndef PNG_NO_WRITE_SUPPORTED +# define PNG_WRITE_SUPPORTED +#endif + +/* Enabled by default in 1.2.0. You can disable this if you don't need to + support PNGs that are embedded in MNG datastreams */ +#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) +# ifndef PNG_MNG_FEATURES_SUPPORTED +# define PNG_MNG_FEATURES_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_FLOATING_POINT_SUPPORTED +# ifndef PNG_FLOATING_POINT_SUPPORTED +# define PNG_FLOATING_POINT_SUPPORTED +# endif +#endif + +/* If you are running on a machine where you cannot allocate more + * than 64K of memory at once, uncomment this. While libpng will not + * normally need that much memory in a chunk (unless you load up a very + * large file), zlib needs to know how big of a chunk it can use, and + * libpng thus makes sure to check any memory allocation to verify it + * will fit into memory. +#define PNG_MAX_MALLOC_64K + */ +#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) +# define PNG_MAX_MALLOC_64K +#endif + +/* Special munging to support doing things the 'cygwin' way: + * 'Normal' png-on-win32 defines/defaults: + * PNG_BUILD_DLL -- building dll + * PNG_USE_DLL -- building an application, linking to dll + * (no define) -- building static library, or building an + * application and linking to the static lib + * 'Cygwin' defines/defaults: + * PNG_BUILD_DLL -- (ignored) building the dll + * (no define) -- (ignored) building an application, linking to the dll + * PNG_STATIC -- (ignored) building the static lib, or building an + * application that links to the static lib. + * ALL_STATIC -- (ignored) building various static libs, or building an + * application that links to the static libs. + * Thus, + * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and + * this bit of #ifdefs will define the 'correct' config variables based on + * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but + * unnecessary. + * + * Also, the precedence order is: + * ALL_STATIC (since we can't #undef something outside our namespace) + * PNG_BUILD_DLL + * PNG_STATIC + * (nothing) == PNG_USE_DLL + * + * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent + * of auto-import in binutils, we no longer need to worry about + * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, + * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes + * to __declspec() stuff. However, we DO need to worry about + * PNG_BUILD_DLL and PNG_STATIC because those change some defaults + * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. + */ +#if defined(__CYGWIN__) +# if defined(ALL_STATIC) +# if defined(PNG_BUILD_DLL) +# undef PNG_BUILD_DLL +# endif +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# if !defined(PNG_STATIC) +# define PNG_STATIC +# endif +# else +# if defined (PNG_BUILD_DLL) +# if defined(PNG_STATIC) +# undef PNG_STATIC +# endif +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if !defined(PNG_DLL) +# define PNG_DLL +# endif +# else +# if defined(PNG_STATIC) +# if defined(PNG_USE_DLL) +# undef PNG_USE_DLL +# endif +# if defined(PNG_DLL) +# undef PNG_DLL +# endif +# else +# if !defined(PNG_USE_DLL) +# define PNG_USE_DLL +# endif +# if !defined(PNG_DLL) +# define PNG_DLL +# endif +# endif +# endif +# endif +#endif + +/* This protects us against compilers that run on a windowing system + * and thus don't have or would rather us not use the stdio types: + * stdin, stdout, and stderr. The only one currently used is stderr + * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will + * prevent these from being compiled and used. #defining PNG_NO_STDIO + * will also prevent these, plus will prevent the entire set of stdio + * macros and functions (FILE *, printf, etc.) from being compiled and used, + * unless (PNG_DEBUG > 0) has been #defined. + * + * #define PNG_NO_CONSOLE_IO + * #define PNG_NO_STDIO + */ + +#if defined(_WIN32_WCE) +# include + /* Console I/O functions are not supported on WindowsCE */ +# define PNG_NO_CONSOLE_IO +# ifdef PNG_DEBUG +# undef PNG_DEBUG +# endif +#endif + +#ifdef PNG_BUILD_DLL +# ifndef PNG_CONSOLE_IO_SUPPORTED +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# endif +#endif + +# ifdef PNG_NO_STDIO +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# ifdef PNG_DEBUG +# if (PNG_DEBUG > 0) +# include +# endif +# endif +# else +# if !defined(_WIN32_WCE) +/* "stdio.h" functions are not supported on WindowsCE */ +# include +# endif +# endif + +/* This macro protects us against machines that don't have function + * prototypes (ie K&R style headers). If your compiler does not handle + * function prototypes, define this macro and use the included ansi2knr. + * I've always been able to use _NO_PROTO as the indicator, but you may + * need to drag the empty declaration out in front of here, or change the + * ifdef to suit your own needs. + */ +#ifndef PNGARG + +#ifdef OF /* zlib prototype munger */ +# define PNGARG(arglist) OF(arglist) +#else + +#ifdef _NO_PROTO +# define PNGARG(arglist) () +# ifndef PNG_TYPECAST_NULL +# define PNG_TYPECAST_NULL +# endif +#else +# define PNGARG(arglist) arglist +#endif /* _NO_PROTO */ + +#endif /* OF */ + +#endif /* PNGARG */ + +/* Try to determine if we are compiling on a Mac. Note that testing for + * just __MWERKS__ is not good enough, because the Codewarrior is now used + * on non-Mac platforms. + */ +#ifndef MACOS +# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ + defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) +# define MACOS +# endif +#endif + +/* enough people need this for various reasons to include it here */ +#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) +# include +#endif + +#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) +# define PNG_SETJMP_SUPPORTED +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* This is an attempt to force a single setjmp behaviour on Linux. If + * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. + */ + +# ifdef __linux__ +# ifdef _BSD_SOURCE +# define PNG_SAVE_BSD_SOURCE +# undef _BSD_SOURCE +# endif +# ifdef _SETJMP_H + /* If you encounter a compiler error here, see the explanation + * near the end of INSTALL. + */ + __png.h__ already includes setjmp.h; + __dont__ include it again.; +# endif +# endif /* __linux__ */ + + /* include setjmp.h for error handling */ +# include + +# ifdef __linux__ +# ifdef PNG_SAVE_BSD_SOURCE +# define _BSD_SOURCE +# undef PNG_SAVE_BSD_SOURCE +# endif +# endif /* __linux__ */ +#endif /* PNG_SETJMP_SUPPORTED */ + +#ifdef BSD +# include +#else +# include +#endif + +/* Other defines for things like memory and the like can go here. */ +#ifdef PNG_INTERNAL + +#include + +/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which + * aren't usually used outside the library (as far as I know), so it is + * debatable if they should be exported at all. In the future, when it is + * possible to have run-time registry of chunk-handling functions, some of + * these will be made available again. +#define PNG_EXTERN extern + */ +#define PNG_EXTERN + +/* Other defines specific to compilers can go here. Try to keep + * them inside an appropriate ifdef/endif pair for portability. + */ + +#if defined(PNG_FLOATING_POINT_SUPPORTED) +# if defined(MACOS) + /* We need to check that hasn't already been included earlier + * as it seems it doesn't agree with , yet we should really use + * if possible. + */ +# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) +# include +# endif +# else +# include +# endif +# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) + /* Amiga SAS/C: We must include builtin FPU functions when compiling using + * MATH=68881 + */ +# include +# endif +#endif + +/* Codewarrior on NT has linking problems without this. */ +#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) +# define PNG_ALWAYS_EXTERN +#endif + +/* This provides the non-ANSI (far) memory allocation routines. */ +#if defined(__TURBOC__) && defined(__MSDOS__) +# include +# include +#endif + +/* I have no idea why is this necessary... */ +#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ + defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) +# include +#endif + +/* This controls how fine the dithering gets. As this allocates + * a largish chunk of memory (32K), those who are not as concerned + * with dithering quality can decrease some or all of these. + */ +#ifndef PNG_DITHER_RED_BITS +# define PNG_DITHER_RED_BITS 5 +#endif +#ifndef PNG_DITHER_GREEN_BITS +# define PNG_DITHER_GREEN_BITS 5 +#endif +#ifndef PNG_DITHER_BLUE_BITS +# define PNG_DITHER_BLUE_BITS 5 +#endif + +/* This controls how fine the gamma correction becomes when you + * are only interested in 8 bits anyway. Increasing this value + * results in more memory being used, and more pow() functions + * being called to fill in the gamma tables. Don't set this value + * less then 8, and even that may not work (I haven't tested it). + */ + +#ifndef PNG_MAX_GAMMA_8 +# define PNG_MAX_GAMMA_8 11 +#endif + +/* This controls how much a difference in gamma we can tolerate before + * we actually start doing gamma conversion. + */ +#ifndef PNG_GAMMA_THRESHOLD +# define PNG_GAMMA_THRESHOLD 0.05 +#endif + +#endif /* PNG_INTERNAL */ + +/* The following uses const char * instead of char * for error + * and warning message functions, so some compilers won't complain. + * If you do not want to use const, define PNG_NO_CONST here. + */ + +#ifndef PNG_NO_CONST +# define PNG_CONST const +#else +# define PNG_CONST +#endif + +/* The following defines give you the ability to remove code from the + * library that you will not be using. I wish I could figure out how to + * automate this, but I can't do that without making it seriously hard + * on the users. So if you are not using an ability, change the #define + * to and #undef, and that part of the library will not be compiled. If + * your linker can't find a function, you may want to make sure the + * ability is defined here. Some of these depend upon some others being + * defined. I haven't figured out all the interactions here, so you may + * have to experiment awhile to get everything to compile. If you are + * creating or using a shared library, you probably shouldn't touch this, + * as it will affect the size of the structures, and this will cause bad + * things to happen if the library and/or application ever change. + */ + +/* Any features you will not be using can be undef'ed here */ + +/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user + * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS + * on the compile line, then pick and choose which ones to define without + * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED + * if you only want to have a png-compliant reader/writer but don't need + * any of the extra transformations. This saves about 80 kbytes in a + * typical installation of the library. (PNG_NO_* form added in version + * 1.0.1c, for consistency) + */ + +/* The size of the png_text structure changed in libpng-1.0.6 when + * iTXt is supported. It is turned off by default, to support old apps + * that malloc the png_text structure instead of calling png_set_text() + * and letting libpng malloc it. It will be turned on by default in + * libpng-1.3.0. + */ + +#ifndef PNG_iTXt_SUPPORTED +# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) +# define PNG_NO_READ_iTXt +# endif +# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) +# define PNG_NO_WRITE_iTXt +# endif +#endif + +/* The following support, added after version 1.0.0, can be turned off here en + * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility + * with old applications that require the length of png_struct and png_info + * to remain unchanged. + */ + +#ifdef PNG_LEGACY_SUPPORTED +# define PNG_NO_FREE_ME +# define PNG_NO_READ_UNKNOWN_CHUNKS +# define PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_NO_READ_USER_CHUNKS +# define PNG_NO_READ_iCCP +# define PNG_NO_WRITE_iCCP +# define PNG_NO_READ_iTXt +# define PNG_NO_WRITE_iTXt +# define PNG_NO_READ_sCAL +# define PNG_NO_WRITE_sCAL +# define PNG_NO_READ_sPLT +# define PNG_NO_WRITE_sPLT +# define PNG_NO_INFO_IMAGE +# define PNG_NO_READ_RGB_TO_GRAY +# define PNG_NO_READ_USER_TRANSFORM +# define PNG_NO_WRITE_USER_TRANSFORM +# define PNG_NO_USER_MEM +# define PNG_NO_READ_EMPTY_PLTE +# define PNG_NO_MNG_FEATURES +# define PNG_NO_FIXED_POINT_SUPPORTED +#endif + +/* Ignore attempt to turn off both floating and fixed point support */ +#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ + !defined(PNG_NO_FIXED_POINT_SUPPORTED) +# define PNG_FIXED_POINT_SUPPORTED +#endif + +#ifndef PNG_NO_FREE_ME +# define PNG_FREE_ME_SUPPORTED +#endif + +#if defined(PNG_READ_SUPPORTED) + +#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_TRANSFORMS) +# define PNG_READ_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_READ_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_READ_EXPAND +# define PNG_READ_EXPAND_SUPPORTED +# endif +# ifndef PNG_NO_READ_SHIFT +# define PNG_READ_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACK +# define PNG_READ_PACK_SUPPORTED +# endif +# ifndef PNG_NO_READ_BGR +# define PNG_READ_BGR_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP +# define PNG_READ_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACKSWAP +# define PNG_READ_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT +# define PNG_READ_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_READ_DITHER +# define PNG_READ_DITHER_SUPPORTED +# endif +# ifndef PNG_NO_READ_BACKGROUND +# define PNG_READ_BACKGROUND_SUPPORTED +# endif +# ifndef PNG_NO_READ_16_TO_8 +# define PNG_READ_16_TO_8_SUPPORTED +# endif +# ifndef PNG_NO_READ_FILLER +# define PNG_READ_FILLER_SUPPORTED +# endif +# ifndef PNG_NO_READ_GAMMA +# define PNG_READ_GAMMA_SUPPORTED +# endif +# ifndef PNG_NO_READ_GRAY_TO_RGB +# define PNG_READ_GRAY_TO_RGB_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP_ALPHA +# define PNG_READ_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT_ALPHA +# define PNG_READ_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_STRIP_ALPHA +# define PNG_READ_STRIP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_USER_TRANSFORM +# define PNG_READ_USER_TRANSFORM_SUPPORTED +# endif +# ifndef PNG_NO_READ_RGB_TO_GRAY +# define PNG_READ_RGB_TO_GRAY_SUPPORTED +# endif +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ + +#if !defined(PNG_NO_PROGRESSIVE_READ) && \ + !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ +# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ +#endif /* about interlacing capability! You'll */ + /* still have interlacing unless you change the following line: */ + +#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ + +#ifndef PNG_NO_READ_COMPOSITE_NODIV +# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ +# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ +# endif +#endif + +/* Deprecated, will be removed from version 2.0.0. + Use PNG_MNG_FEATURES_SUPPORTED instead. */ +#ifndef PNG_NO_READ_EMPTY_PLTE +# define PNG_READ_EMPTY_PLTE_SUPPORTED +#endif + +#endif /* PNG_READ_SUPPORTED */ + +#if defined(PNG_WRITE_SUPPORTED) + +# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_TRANSFORMS) +# define PNG_WRITE_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_WRITE_SHIFT +# define PNG_WRITE_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACK +# define PNG_WRITE_PACK_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_BGR +# define PNG_WRITE_BGR_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_SWAP +# define PNG_WRITE_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACKSWAP +# define PNG_WRITE_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT +# define PNG_WRITE_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_FILLER +# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ +# endif +# ifndef PNG_NO_WRITE_SWAP_ALPHA +# define PNG_WRITE_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT_ALPHA +# define PNG_WRITE_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_USER_TRANSFORM +# define PNG_WRITE_USER_TRANSFORM_SUPPORTED +# endif +#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ + +#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant + encoders, but can cause trouble + if left undefined */ + +#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED +#endif + +#ifndef PNG_NO_WRITE_FLUSH +# define PNG_WRITE_FLUSH_SUPPORTED +#endif + +/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */ +#ifndef PNG_NO_WRITE_EMPTY_PLTE +# define PNG_WRITE_EMPTY_PLTE_SUPPORTED +#endif + +#endif /* PNG_WRITE_SUPPORTED */ + +#ifndef PNG_1_0_X +# ifndef PNG_NO_ERROR_NUMBERS +# define PNG_ERROR_NUMBERS_SUPPORTED +# endif +#endif /* PNG_1_0_X */ + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +# ifndef PNG_NO_USER_TRANSFORM_PTR +# define PNG_USER_TRANSFORM_PTR_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_STDIO +# define PNG_TIME_RFC1123_SUPPORTED +#endif + +/* This adds extra functions in pngget.c for accessing data from the + * info pointer (added in version 0.99) + * png_get_image_width() + * png_get_image_height() + * png_get_bit_depth() + * png_get_color_type() + * png_get_compression_type() + * png_get_filter_type() + * png_get_interlace_type() + * png_get_pixel_aspect_ratio() + * png_get_pixels_per_meter() + * png_get_x_offset_pixels() + * png_get_y_offset_pixels() + * png_get_x_offset_microns() + * png_get_y_offset_microns() + */ +#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) +# define PNG_EASY_ACCESS_SUPPORTED +#endif + +/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 + even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */ +#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) +# ifndef PNG_ASSEMBLER_CODE_SUPPORTED +# define PNG_ASSEMBLER_CODE_SUPPORTED +# endif +# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) +# define PNG_MMX_CODE_SUPPORTED +# endif +#endif + +/* If you are sure that you don't need thread safety and you are compiling + with PNG_USE_PNGCCRD for an MMX application, you can define this for + faster execution. See pnggccrd.c. +#define PNG_THREAD_UNSAFE_OK +*/ + +#if !defined(PNG_1_0_X) +#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) +# define PNG_USER_MEM_SUPPORTED +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.2.6 */ +#if !defined(PNG_1_0_X) +#ifndef PNG_SET_USER_LIMITS_SUPPORTED +#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) +# define PNG_SET_USER_LIMITS_SUPPORTED +#endif +#endif +#endif /* PNG_1_0_X */ + +/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter + * how large, set these limits to 0x7fffffffL + */ +#ifndef PNG_USER_WIDTH_MAX +# define PNG_USER_WIDTH_MAX 1000000L +#endif +#ifndef PNG_USER_HEIGHT_MAX +# define PNG_USER_HEIGHT_MAX 1000000L +#endif + +/* These are currently experimental features, define them if you want */ + +/* very little testing */ +/* +#ifdef PNG_READ_SUPPORTED +# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# endif +#endif +*/ + +/* This is only for PowerPC big-endian and 680x0 systems */ +/* some testing */ +/* +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +# define PNG_READ_BIG_ENDIAN_SUPPORTED +#endif +*/ + +/* Buggy compilers (e.g., gcc 2.7.2.2) need this */ +/* +#define PNG_NO_POINTER_INDEXING +*/ + +/* These functions are turned off by default, as they will be phased out. */ +/* +#define PNG_USELESS_TESTS_SUPPORTED +#define PNG_CORRECT_PALETTE_SUPPORTED +*/ + +/* Any chunks you are not interested in, you can undef here. The + * ones that allocate memory may be expecially important (hIST, + * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info + * a bit smaller. + */ + +#if defined(PNG_READ_SUPPORTED) && \ + !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_ANCILLARY_CHUNKS) +# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#if defined(PNG_WRITE_SUPPORTED) && \ + !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) +# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_READ_TEXT +# define PNG_NO_READ_iTXt +# define PNG_NO_READ_tEXt +# define PNG_NO_READ_zTXt +#endif +#ifndef PNG_NO_READ_bKGD +# define PNG_READ_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +#endif +#ifndef PNG_NO_READ_cHRM +# define PNG_READ_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +#endif +#ifndef PNG_NO_READ_gAMA +# define PNG_READ_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +#endif +#ifndef PNG_NO_READ_hIST +# define PNG_READ_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +#endif +#ifndef PNG_NO_READ_iCCP +# define PNG_READ_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +#endif +#ifndef PNG_NO_READ_iTXt +# ifndef PNG_READ_iTXt_SUPPORTED +# define PNG_READ_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_oFFs +# define PNG_READ_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +#endif +#ifndef PNG_NO_READ_pCAL +# define PNG_READ_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_sCAL +# define PNG_READ_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_pHYs +# define PNG_READ_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +#endif +#ifndef PNG_NO_READ_sBIT +# define PNG_READ_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sPLT +# define PNG_READ_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sRGB +# define PNG_READ_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +#endif +#ifndef PNG_NO_READ_tEXt +# define PNG_READ_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_tIME +# define PNG_READ_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +#endif +#ifndef PNG_NO_READ_tRNS +# define PNG_READ_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +#endif +#ifndef PNG_NO_READ_zTXt +# define PNG_READ_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_UNKNOWN_CHUNKS +# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_NO_HANDLE_AS_UNKNOWN +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif +#if !defined(PNG_NO_READ_USER_CHUNKS) && \ + defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) +# define PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_USER_CHUNKS_SUPPORTED +# ifdef PNG_NO_READ_UNKNOWN_CHUNKS +# undef PNG_NO_READ_UNKNOWN_CHUNKS +# endif +# ifdef PNG_NO_HANDLE_AS_UNKNOWN +# undef PNG_NO_HANDLE_AS_UNKNOWN +# endif +#endif +#ifndef PNG_NO_READ_OPT_PLTE +# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ +#endif /* optional PLTE chunk in RGB and RGBA images */ +#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ + defined(PNG_READ_zTXt_SUPPORTED) +# define PNG_READ_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +#endif + +#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_WRITE_TEXT +# define PNG_NO_WRITE_iTXt +# define PNG_NO_WRITE_tEXt +# define PNG_NO_WRITE_zTXt +#endif +#ifndef PNG_NO_WRITE_bKGD +# define PNG_WRITE_bKGD_SUPPORTED +# ifndef PNG_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_cHRM +# define PNG_WRITE_cHRM_SUPPORTED +# ifndef PNG_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_gAMA +# define PNG_WRITE_gAMA_SUPPORTED +# ifndef PNG_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_hIST +# define PNG_WRITE_hIST_SUPPORTED +# ifndef PNG_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iCCP +# define PNG_WRITE_iCCP_SUPPORTED +# ifndef PNG_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iTXt +# ifndef PNG_WRITE_iTXt_SUPPORTED +# define PNG_WRITE_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_oFFs +# define PNG_WRITE_oFFs_SUPPORTED +# ifndef PNG_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pCAL +# define PNG_WRITE_pCAL_SUPPORTED +# ifndef PNG_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sCAL +# define PNG_WRITE_sCAL_SUPPORTED +# ifndef PNG_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pHYs +# define PNG_WRITE_pHYs_SUPPORTED +# ifndef PNG_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sBIT +# define PNG_WRITE_sBIT_SUPPORTED +# ifndef PNG_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sPLT +# define PNG_WRITE_sPLT_SUPPORTED +# ifndef PNG_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sRGB +# define PNG_WRITE_sRGB_SUPPORTED +# ifndef PNG_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tEXt +# define PNG_WRITE_tEXt_SUPPORTED +# ifndef PNG_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tIME +# define PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tRNS +# define PNG_WRITE_tRNS_SUPPORTED +# ifndef PNG_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_zTXt +# define PNG_WRITE_zTXt_SUPPORTED +# ifndef PNG_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +# endif +#endif +#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ + defined(PNG_WRITE_zTXt_SUPPORTED) +# define PNG_WRITE_TEXT_SUPPORTED +# ifndef PNG_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +# endif +#endif + +#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ + +/* Turn this off to disable png_read_png() and + * png_write_png() and leave the row_pointers member + * out of the info structure. + */ +#ifndef PNG_NO_INFO_IMAGE +# define PNG_INFO_IMAGE_SUPPORTED +#endif + +/* need the time information for reading tIME chunks */ +#if defined(PNG_tIME_SUPPORTED) +# if !defined(_WIN32_WCE) + /* "time.h" functions are not supported on WindowsCE */ +# include +# endif +#endif + +/* Some typedefs to get us started. These should be safe on most of the + * common platforms. The typedefs should be at least as large as the + * numbers suggest (a png_uint_32 must be at least 32 bits long), but they + * don't have to be exactly that size. Some compilers dislike passing + * unsigned shorts as function parameters, so you may be better off using + * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may + * want to have unsigned int for png_uint_32 instead of unsigned long. + */ + +typedef unsigned long png_uint_32; +typedef long png_int_32; +typedef unsigned short png_uint_16; +typedef short png_int_16; +typedef unsigned char png_byte; + +/* This is usually size_t. It is typedef'ed just in case you need it to + change (I'm not sure if you will or not, so I thought I'd be safe) */ +#ifdef PNG_SIZE_T + typedef PNG_SIZE_T png_size_t; +# define png_sizeof(x) png_convert_size(sizeof (x)) +#else + typedef size_t png_size_t; +# define png_sizeof(x) sizeof (x) +#endif + +/* The following is needed for medium model support. It cannot be in the + * PNG_INTERNAL section. Needs modification for other compilers besides + * MSC. Model independent support declares all arrays and pointers to be + * large using the far keyword. The zlib version used must also support + * model independent data. As of version zlib 1.0.4, the necessary changes + * have been made in zlib. The USE_FAR_KEYWORD define triggers other + * changes that are needed. (Tim Wegner) + */ + +/* Separate compiler dependencies (problem here is that zlib.h always + defines FAR. (SJT) */ +#ifdef __BORLANDC__ +# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) +# define LDATA 1 +# else +# define LDATA 0 +# endif + /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ +# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) +# define PNG_MAX_MALLOC_64K +# if (LDATA != 1) +# ifndef FAR +# define FAR __far +# endif +# define USE_FAR_KEYWORD +# endif /* LDATA != 1 */ + /* Possibly useful for moving data out of default segment. + * Uncomment it if you want. Could also define FARDATA as + * const if your compiler supports it. (SJT) +# define FARDATA FAR + */ +# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ +#endif /* __BORLANDC__ */ + + +/* Suggest testing for specific compiler first before testing for + * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, + * making reliance oncertain keywords suspect. (SJT) + */ + +/* MSC Medium model */ +#if defined(FAR) +# if defined(M_I86MM) +# define USE_FAR_KEYWORD +# define FARDATA FAR +# include +# endif +#endif + +/* SJT: default case */ +#ifndef FAR +# define FAR +#endif + +/* At this point FAR is always defined */ +#ifndef FARDATA +# define FARDATA +#endif + +/* Typedef for floating-point numbers that are converted + to fixed-point with a multiple of 100,000, e.g., int_gamma */ +typedef png_int_32 png_fixed_point; + +/* Add typedefs for pointers */ +typedef void FAR * png_voidp; +typedef png_byte FAR * png_bytep; +typedef png_uint_32 FAR * png_uint_32p; +typedef png_int_32 FAR * png_int_32p; +typedef png_uint_16 FAR * png_uint_16p; +typedef png_int_16 FAR * png_int_16p; +typedef PNG_CONST char FAR * png_const_charp; +typedef char FAR * png_charp; +typedef png_fixed_point FAR * png_fixed_point_p; + +#ifndef PNG_NO_STDIO +#if defined(_WIN32_WCE) +typedef HANDLE png_FILE_p; +#else +typedef FILE * png_FILE_p; +#endif +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * png_doublep; +#endif + +/* Pointers to pointers; i.e. arrays */ +typedef png_byte FAR * FAR * png_bytepp; +typedef png_uint_32 FAR * FAR * png_uint_32pp; +typedef png_int_32 FAR * FAR * png_int_32pp; +typedef png_uint_16 FAR * FAR * png_uint_16pp; +typedef png_int_16 FAR * FAR * png_int_16pp; +typedef PNG_CONST char FAR * FAR * png_const_charpp; +typedef char FAR * FAR * png_charpp; +typedef png_fixed_point FAR * FAR * png_fixed_point_pp; +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * FAR * png_doublepp; +#endif + +/* Pointers to pointers to pointers; i.e., pointer to array */ +typedef char FAR * FAR * FAR * png_charppp; + +#if defined(PNG_1_0_X) || defined(PNG_1_2_X) +/* SPC - Is this stuff deprecated? */ +/* It'll be removed as of libpng-1.3.0 - GR-P */ +/* libpng typedefs for types in zlib. If zlib changes + * or another compression library is used, then change these. + * Eliminates need to change all the source files. + */ +typedef charf * png_zcharp; +typedef charf * FAR * png_zcharpp; +typedef z_stream FAR * png_zstreamp; +#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */ + +/* + * Define PNG_BUILD_DLL if the module being built is a Windows + * LIBPNG DLL. + * + * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. + * It is equivalent to Microsoft predefined macro _DLL that is + * automatically defined when you compile using the share + * version of the CRT (C Run-Time library) + * + * The cygwin mods make this behavior a little different: + * Define PNG_BUILD_DLL if you are building a dll for use with cygwin + * Define PNG_STATIC if you are building a static library for use with cygwin, + * -or- if you are building an application that you want to link to the + * static library. + * PNG_USE_DLL is defined by default (no user action needed) unless one of + * the other flags is defined. + */ + +#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) +# define PNG_DLL +#endif +/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. + * When building a static lib, default to no GLOBAL ARRAYS, but allow + * command-line override + */ +#if defined(__CYGWIN__) +# if !defined(PNG_STATIC) +# if defined(PNG_USE_GLOBAL_ARRAYS) +# undef PNG_USE_GLOBAL_ARRAYS +# endif +# if !defined(PNG_USE_LOCAL_ARRAYS) +# define PNG_USE_LOCAL_ARRAYS +# endif +# else +# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) +# if defined(PNG_USE_GLOBAL_ARRAYS) +# undef PNG_USE_GLOBAL_ARRAYS +# endif +# endif +# endif +# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) +# define PNG_USE_LOCAL_ARRAYS +# endif +#endif + +/* Do not use global arrays (helps with building DLL's) + * They are no longer used in libpng itself, since version 1.0.5c, + * but might be required for some pre-1.0.5c applications. + */ +#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) +# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL)) +# define PNG_USE_LOCAL_ARRAYS +# else +# define PNG_USE_GLOBAL_ARRAYS +# endif +#endif + +#if defined(__CYGWIN__) +# undef PNGAPI +# define PNGAPI __cdecl +# undef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", + * you may get warnings regarding the linkage of png_zalloc and png_zfree. + * Don't ignore those warnings; you must also reset the default calling + * convention in your compiler to match your PNGAPI, and you must build + * zlib and your applications the same way you build libpng. + */ + +#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) +# ifndef PNG_NO_MODULEDEF +# define PNG_NO_MODULEDEF +# endif +#endif + +#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) +# define PNG_IMPEXP +#endif + +#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ + (( defined(_Windows) || defined(_WINDOWS) || \ + defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) + +# ifndef PNGAPI +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# define PNGAPI __cdecl +# else +# define PNGAPI _cdecl +# endif +# endif + +# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ + 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) +# define PNG_IMPEXP +# endif + +# if !defined(PNG_IMPEXP) + +# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol +# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol + + /* Borland/Microsoft */ +# if defined(_MSC_VER) || defined(__BORLANDC__) +# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) +# define PNG_EXPORT PNG_EXPORT_TYPE1 +# else +# define PNG_EXPORT PNG_EXPORT_TYPE2 +# if defined(PNG_BUILD_DLL) +# define PNG_IMPEXP __export +# else +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in + VC++ */ +# endif /* Exists in Borland C++ for + C++ classes (== huge) */ +# endif +# endif + +# if !defined(PNG_IMPEXP) +# if defined(PNG_BUILD_DLL) +# define PNG_IMPEXP __declspec(dllexport) +# else +# define PNG_IMPEXP __declspec(dllimport) +# endif +# endif +# endif /* PNG_IMPEXP */ +#else /* !(DLL || non-cygwin WINDOWS) */ +# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) +# ifndef PNGAPI +# define PNGAPI _System +# endif +# else +# if 0 /* ... other platforms, with other meanings */ +# endif +# endif +#endif + +#ifndef PNGAPI +# define PNGAPI +#endif +#ifndef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#ifdef PNG_BUILDSYMS +# ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END +# endif +# ifdef PNG_USE_GLOBAL_ARRAYS +# ifndef PNG_EXPORT_VAR +# define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT +# endif +# endif +#endif + +#ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol +#endif + +#ifdef PNG_USE_GLOBAL_ARRAYS +# ifndef PNG_EXPORT_VAR +# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type +# endif +#endif + +/* User may want to use these so they are not in PNG_INTERNAL. Any library + * functions that are passed far data must be model independent. + */ + +#ifndef PNG_ABORT +# define PNG_ABORT() abort() +#endif + +#ifdef PNG_SETJMP_SUPPORTED +# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) +#else +# define png_jmpbuf(png_ptr) \ + (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) +#endif + +#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ +/* use this to make far-to-near assignments */ +# define CHECK 1 +# define NOCHECK 0 +# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) +# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) +# define png_strcpy _fstrcpy +# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ +# define png_strlen _fstrlen +# define png_memcmp _fmemcmp /* SJT: added */ +# define png_memcpy _fmemcpy +# define png_memset _fmemset +#else /* use the usual functions */ +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# define png_strcpy strcpy +# define png_strncpy strncpy /* Added to v 1.2.6 */ +# define png_strlen strlen +# define png_memcmp memcmp /* SJT: added */ +# define png_memcpy memcpy +# define png_memset memset +#endif +/* End of memory model independent support */ + +/* Just a little check that someone hasn't tried to define something + * contradictory. + */ +#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) +# undef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 65536L +#endif + +#ifdef PNG_READ_SUPPORTED +/* Prior to libpng-1.0.9, this block was in pngasmrd.h */ +#if defined(PNG_INTERNAL) + +/* These are the default thresholds before the MMX code kicks in; if either + * rowbytes or bitdepth is below the threshold, plain C code is used. These + * can be overridden at runtime via the png_set_mmx_thresholds() call in + * libpng 1.2.0 and later. The values below were chosen by Intel. + */ + +#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT +# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */ +#endif +#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT +# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */ +#endif + +/* Set this in the makefile for VC++ on Pentium, not here. */ +/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c . + * MMX will be detected at run time and used if present. + */ +#ifdef PNG_USE_PNGVCRD +# define PNG_HAVE_ASSEMBLER_COMBINE_ROW +# define PNG_HAVE_ASSEMBLER_READ_INTERLACE +# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +#endif + +/* Set this in the makefile for gcc/as on Pentium, not here. */ +/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c . + * MMX will be detected at run time and used if present. + */ +#ifdef PNG_USE_PNGGCCRD +# define PNG_HAVE_ASSEMBLER_COMBINE_ROW +# define PNG_HAVE_ASSEMBLER_READ_INTERLACE +# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +#endif +/* - see pnggccrd.c for info about what is currently enabled */ + +#endif /* PNG_INTERNAL */ +#endif /* PNG_READ_SUPPORTED */ + +/* Added at libpng-1.2.8 */ +#endif /* PNG_VERSION_INFO_ONLY */ + +#endif /* PNGCONF_H */ diff --git a/src/SFML/Graphics/libpng/pngerror.c b/src/SFML/Graphics/libpng/pngerror.c new file mode 100644 index 00000000..b06f55e0 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngerror.c @@ -0,0 +1,295 @@ + +/* pngerror.c - stub functions for i/o and memory allocation + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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" + +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->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; iflags&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; +#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]; + 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]; + 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) +{ + 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) +{ + 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 diff --git a/src/SFML/Graphics/libpng/pnggccrd.c b/src/SFML/Graphics/libpng/pnggccrd.c new file mode 100644 index 00000000..c7a3e8bd --- /dev/null +++ b/src/SFML/Graphics/libpng/pnggccrd.c @@ -0,0 +1,5408 @@ +/* pnggccrd.c - mixed C/assembler version of utilities to read a PNG file + * + * For Intel x86 CPU (Pentium-MMX or later) and GNU C compiler. + * + * See http://www.intel.com/drg/pentiumII/appnotes/916/916.htm + * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm + * for Intel's performance analysis of the MMX vs. non-MMX code. + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 Glenn Randers-Pehrson + * Copyright (c) 1998, Intel Corporation + * + * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998. + * Interface to libpng contributed by Gilles Vollant, 1999. + * GNU C port by Greg Roelofs, 1999-2001. + * + * Lines 2350-4300 converted in place with intel2gas 1.3.1: + * + * intel2gas -mdI pnggccrd.c.partially-msvc -o pnggccrd.c + * + * and then cleaned up by hand. See http://hermes.terminal.at/intel2gas/ . + * + * NOTE: A sufficiently recent version of GNU as (or as.exe under DOS/Windows) + * is required to assemble the newer MMX instructions such as movq. + * For djgpp, see + * + * ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu281b.zip + * + * (or a later version in the same directory). For Linux, check your + * distribution's web site(s) or try these links: + * + * http://rufus.w3.org/linux/RPM/binutils.html + * http://www.debian.org/Packages/stable/devel/binutils.html + * ftp://ftp.slackware.com/pub/linux/slackware/slackware/slakware/d1/ + * binutils.tgz + * + * For other platforms, see the main GNU site: + * + * ftp://ftp.gnu.org/pub/gnu/binutils/ + * + * Version 2.5.2l.15 is definitely too old... + */ + +/* + * TEMPORARY PORTING NOTES AND CHANGELOG (mostly by Greg Roelofs) + * ===================================== + * + * 19991006: + * - fixed sign error in post-MMX cleanup code (16- & 32-bit cases) + * + * 19991007: + * - additional optimizations (possible or definite): + * x [DONE] write MMX code for 64-bit case (pixel_bytes == 8) [not tested] + * - write MMX code for 48-bit case (pixel_bytes == 6) + * - figure out what's up with 24-bit case (pixel_bytes == 3): + * why subtract 8 from width_mmx in the pass 4/5 case? + * (only width_mmx case) (near line 1606) + * x [DONE] replace pixel_bytes within each block with the true + * constant value (or are compilers smart enough to do that?) + * - rewrite all MMX interlacing code so it's aligned with + * the *beginning* of the row buffer, not the end. This + * would not only allow one to eliminate half of the memory + * writes for odd passes (that is, pass == odd), it may also + * eliminate some unaligned-data-access exceptions (assuming + * there's a penalty for not aligning 64-bit accesses on + * 64-bit boundaries). The only catch is that the "leftover" + * pixel(s) at the end of the row would have to be saved, + * but there are enough unused MMX registers in every case, + * so this is not a problem. A further benefit is that the + * post-MMX cleanup code (C code) in at least some of the + * cases could be done within the assembler block. + * x [DONE] the "v3 v2 v1 v0 v7 v6 v5 v4" comments are confusing, + * inconsistent, and don't match the MMX Programmer's Reference + * Manual conventions anyway. They should be changed to + * "b7 b6 b5 b4 b3 b2 b1 b0," where b0 indicates the byte that + * was lowest in memory (e.g., corresponding to a left pixel) + * and b7 is the byte that was highest (e.g., a right pixel). + * + * 19991016: + * - Brennan's Guide notwithstanding, gcc under Linux does *not* + * want globals prefixed by underscores when referencing them-- + * i.e., if the variable is const4, then refer to it as const4, + * not _const4. This seems to be a djgpp-specific requirement. + * Also, such variables apparently *must* be declared outside + * of functions; neither static nor automatic variables work if + * defined within the scope of a single function, but both + * static and truly global (multi-module) variables work fine. + * + * 19991023: + * - fixed png_combine_row() non-MMX replication bug (odd passes only?) + * - switched from string-concatenation-with-macros to cleaner method of + * renaming global variables for djgpp--i.e., always use prefixes in + * inlined assembler code (== strings) and conditionally rename the + * variables, not the other way around. Hence _const4, _mask8_0, etc. + * + * 19991024: + * - fixed mmxsupport()/png_do_read_interlace() first-row bug + * This one was severely weird: even though mmxsupport() doesn't touch + * ebx (where "row" pointer was stored), it nevertheless managed to zero + * the register (even in static/non-fPIC code--see below), which in turn + * caused png_do_read_interlace() to return prematurely on the first row of + * interlaced images (i.e., without expanding the interlaced pixels). + * Inspection of the generated assembly code didn't turn up any clues, + * although it did point at a minor optimization (i.e., get rid of + * mmx_supported_local variable and just use eax). Possibly the CPUID + * instruction is more destructive than it looks? (Not yet checked.) + * - "info gcc" was next to useless, so compared fPIC and non-fPIC assembly + * listings... Apparently register spillage has to do with ebx, since + * it's used to index the global offset table. Commenting it out of the + * input-reg lists in png_combine_row() eliminated compiler barfage, so + * ifdef'd with __PIC__ macro: if defined, use a global for unmask + * + * 19991107: + * - verified CPUID clobberage: 12-char string constant ("GenuineIntel", + * "AuthenticAMD", etc.) placed in ebx:ecx:edx. Still need to polish. + * + * 19991120: + * - made "diff" variable (now "_dif") global to simplify conversion of + * filtering routines (running out of regs, sigh). "diff" is still used + * in interlacing routines, however. + * - fixed up both versions of mmxsupport() (ORIG_THAT_USED_TO_CLOBBER_EBX + * macro determines which is used); original not yet tested. + * + * 20000213: + * - when compiling with gcc, be sure to use -fomit-frame-pointer + * + * 20000319: + * - fixed a register-name typo in png_do_read_interlace(), default (MMX) case, + * pass == 4 or 5, that caused visible corruption of interlaced images + * + * 20000623: + * - Various problems were reported with gcc 2.95.2 in the Cygwin environment, + * many of the form "forbidden register 0 (ax) was spilled for class AREG." + * This is explained at http://gcc.gnu.org/fom_serv/cache/23.html, and + * Chuck Wilson supplied a patch involving dummy output registers. See + * http://sourceforge.net/bugs/?func=detailbug&bug_id=108741&group_id=5624 + * for the original (anonymous) SourceForge bug report. + * + * 20000706: + * - Chuck Wilson passed along these remaining gcc 2.95.2 errors: + * pnggccrd.c: In function `png_combine_row': + * pnggccrd.c:525: more than 10 operands in `asm' + * pnggccrd.c:669: more than 10 operands in `asm' + * pnggccrd.c:828: more than 10 operands in `asm' + * pnggccrd.c:994: more than 10 operands in `asm' + * pnggccrd.c:1177: more than 10 operands in `asm' + * They are all the same problem and can be worked around by using the + * global _unmask variable unconditionally, not just in the -fPIC case. + * Reportedly earlier versions of gcc also have the problem with more than + * 10 operands; they just don't report it. Much strangeness ensues, etc. + * + * 20000729: + * - enabled png_read_filter_row_mmx_up() (shortest remaining unconverted + * MMX routine); began converting png_read_filter_row_mmx_sub() + * - to finish remaining sections: + * - clean up indentation and comments + * - preload local variables + * - add output and input regs (order of former determines numerical + * mapping of latter) + * - avoid all usage of ebx (including bx, bh, bl) register [20000823] + * - remove "$" from addressing of Shift and Mask variables [20000823] + * + * 20000731: + * - global union vars causing segfaults in png_read_filter_row_mmx_sub()? + * + * 20000822: + * - ARGH, stupid png_read_filter_row_mmx_sub() segfault only happens with + * shared-library (-fPIC) version! Code works just fine as part of static + * library. Damn damn damn damn damn, should have tested that sooner. + * ebx is getting clobbered again (explicitly this time); need to save it + * on stack or rewrite asm code to avoid using it altogether. Blargh! + * + * 20000823: + * - first section was trickiest; all remaining sections have ebx -> edx now. + * (-fPIC works again.) Also added missing underscores to various Shift* + * and *Mask* globals and got rid of leading "$" signs. + * + * 20000826: + * - added visual separators to help navigate microscopic printed copies + * (http://pobox.com/~newt/code/gpr-latest.zip, mode 10); started working + * on png_read_filter_row_mmx_avg() + * + * 20000828: + * - finished png_read_filter_row_mmx_avg(): only Paeth left! (930 lines...) + * What the hell, did png_read_filter_row_mmx_paeth(), too. Comments not + * cleaned up/shortened in either routine, but functionality is complete + * and seems to be working fine. + * + * 20000829: + * - ahhh, figured out last(?) bit of gcc/gas asm-fu: if register is listed + * as an input reg (with dummy output variables, etc.), then it *cannot* + * also appear in the clobber list or gcc 2.95.2 will barf. The solution + * is simple enough... + * + * 20000914: + * - bug in png_read_filter_row_mmx_avg(): 16-bit grayscale not handled + * correctly (but 48-bit RGB just fine) + * + * 20000916: + * - fixed bug in png_read_filter_row_mmx_avg(), bpp == 2 case; three errors: + * - "_ShiftBpp.use = 24;" should have been "_ShiftBpp.use = 16;" + * - "_ShiftRem.use = 40;" should have been "_ShiftRem.use = 48;" + * - "psllq _ShiftRem, %%mm2" should have been "psrlq _ShiftRem, %%mm2" + * + * 20010101: + * - added new png_init_mmx_flags() function (here only because it needs to + * call mmxsupport(), which should probably become global png_mmxsupport()); + * modified other MMX routines to run conditionally (png_ptr->asm_flags) + * + * 20010103: + * - renamed mmxsupport() to png_mmx_support(), with auto-set of mmx_supported, + * and made it public; moved png_init_mmx_flags() to png.c as internal func + * + * 20010104: + * - removed dependency on png_read_filter_row_c() (C code already duplicated + * within MMX version of png_read_filter_row()) so no longer necessary to + * compile it into pngrutil.o + * + * 20010310: + * - fixed buffer-overrun bug in png_combine_row() C code (non-MMX) + * + * 20020304: + * - eliminated incorrect use of width_mmx in pixel_bytes == 8 case + * + * 20040724: + * - more tinkering with clobber list at lines 4529 and 5033, to get + * it to compile on gcc-3.4. + * + * STILL TO DO: + * - test png_do_read_interlace() 64-bit case (pixel_bytes == 8) + * - write MMX code for 48-bit case (pixel_bytes == 6) + * - figure out what's up with 24-bit case (pixel_bytes == 3): + * why subtract 8 from width_mmx in the pass 4/5 case? + * (only width_mmx case) (near line 1606) + * - rewrite all MMX interlacing code so it's aligned with beginning + * of the row buffer, not the end (see 19991007 for details) + * x pick one version of mmxsupport() and get rid of the other + * - add error messages to any remaining bogus default cases + * - enable pixel_depth == 8 cases in png_read_filter_row()? (test speed) + * x add support for runtime enable/disable/query of various MMX routines + */ + +#define PNG_INTERNAL +#include "png.h" + +#if defined(PNG_USE_PNGGCCRD) + +int PNGAPI png_mmx_support(void); + +#ifdef PNG_USE_LOCAL_ARRAYS +static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; +static const int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; +static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1}; +#endif + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +/* djgpp, Win32, and Cygwin add their own underscores to global variables, + * so define them without: */ +#if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__) +# define _mmx_supported mmx_supported +# define _const4 const4 +# define _const6 const6 +# define _mask8_0 mask8_0 +# define _mask16_1 mask16_1 +# define _mask16_0 mask16_0 +# define _mask24_2 mask24_2 +# define _mask24_1 mask24_1 +# define _mask24_0 mask24_0 +# define _mask32_3 mask32_3 +# define _mask32_2 mask32_2 +# define _mask32_1 mask32_1 +# define _mask32_0 mask32_0 +# define _mask48_5 mask48_5 +# define _mask48_4 mask48_4 +# define _mask48_3 mask48_3 +# define _mask48_2 mask48_2 +# define _mask48_1 mask48_1 +# define _mask48_0 mask48_0 +# define _LBCarryMask LBCarryMask +# define _HBClearMask HBClearMask +# define _ActiveMask ActiveMask +# define _ActiveMask2 ActiveMask2 +# define _ActiveMaskEnd ActiveMaskEnd +# define _ShiftBpp ShiftBpp +# define _ShiftRem ShiftRem +#ifdef PNG_THREAD_UNSAFE_OK +# define _unmask unmask +# define _FullLength FullLength +# define _MMXLength MMXLength +# define _dif dif +# define _patemp patemp +# define _pbtemp pbtemp +# define _pctemp pctemp +#endif +#endif + + +/* These constants are used in the inlined MMX assembly code. + Ignore gcc's "At top level: defined but not used" warnings. */ + +/* GRR 20000706: originally _unmask was needed only when compiling with -fPIC, + * since that case uses the %ebx register for indexing the Global Offset Table + * and there were no other registers available. But gcc 2.95 and later emit + * "more than 10 operands in `asm'" errors when %ebx is used to preload unmask + * in the non-PIC case, so we'll just use the global unconditionally now. + */ +#ifdef PNG_THREAD_UNSAFE_OK +static int _unmask; +#endif + +static unsigned long long _mask8_0 = 0x0102040810204080LL; + +static unsigned long long _mask16_1 = 0x0101020204040808LL; +static unsigned long long _mask16_0 = 0x1010202040408080LL; + +static unsigned long long _mask24_2 = 0x0101010202020404LL; +static unsigned long long _mask24_1 = 0x0408080810101020LL; +static unsigned long long _mask24_0 = 0x2020404040808080LL; + +static unsigned long long _mask32_3 = 0x0101010102020202LL; +static unsigned long long _mask32_2 = 0x0404040408080808LL; +static unsigned long long _mask32_1 = 0x1010101020202020LL; +static unsigned long long _mask32_0 = 0x4040404080808080LL; + +static unsigned long long _mask48_5 = 0x0101010101010202LL; +static unsigned long long _mask48_4 = 0x0202020204040404LL; +static unsigned long long _mask48_3 = 0x0404080808080808LL; +static unsigned long long _mask48_2 = 0x1010101010102020LL; +static unsigned long long _mask48_1 = 0x2020202040404040LL; +static unsigned long long _mask48_0 = 0x4040808080808080LL; + +static unsigned long long _const4 = 0x0000000000FFFFFFLL; +//static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED +static unsigned long long _const6 = 0x00000000000000FFLL; + +// These are used in the row-filter routines and should/would be local +// variables if not for gcc addressing limitations. +// WARNING: Their presence probably defeats the thread safety of libpng. + +#ifdef PNG_THREAD_UNSAFE_OK +static png_uint_32 _FullLength; +static png_uint_32 _MMXLength; +static int _dif; +static int _patemp; // temp variables for Paeth routine +static int _pbtemp; +static int _pctemp; +#endif + +void /* PRIVATE */ +png_squelch_warnings(void) +{ +#ifdef PNG_THREAD_UNSAFE_OK + _dif = _dif; + _patemp = _patemp; + _pbtemp = _pbtemp; + _pctemp = _pctemp; + _MMXLength = _MMXLength; +#endif + _const4 = _const4; + _const6 = _const6; + _mask8_0 = _mask8_0; + _mask16_1 = _mask16_1; + _mask16_0 = _mask16_0; + _mask24_2 = _mask24_2; + _mask24_1 = _mask24_1; + _mask24_0 = _mask24_0; + _mask32_3 = _mask32_3; + _mask32_2 = _mask32_2; + _mask32_1 = _mask32_1; + _mask32_0 = _mask32_0; + _mask48_5 = _mask48_5; + _mask48_4 = _mask48_4; + _mask48_3 = _mask48_3; + _mask48_2 = _mask48_2; + _mask48_1 = _mask48_1; + _mask48_0 = _mask48_0; +} +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + + +static int _mmx_supported = 2; + +/*===========================================================================*/ +/* */ +/* P N G _ C O M B I N E _ R O W */ +/* */ +/*===========================================================================*/ + +#if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW) + +#define BPP2 2 +#define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */ +#define BPP4 4 +#define BPP6 6 /* (defined only to help avoid cut-and-paste errors) */ +#define BPP8 8 + +/* Combines the row recently read in with the previous row. + This routine takes care of alpha and transparency if requested. + This routine also handles the two methods of progressive display + of interlaced images, depending on the mask value. + The mask value describes which pixels are to be combined with + the row. The pattern always repeats every 8 pixels, so just 8 + bits are needed. A one indicates the pixel is to be combined; a + zero indicates the pixel is to be skipped. This is in addition + to any alpha or transparency value associated with the pixel. + If you want all pixels to be combined, pass 0xff (255) in mask. */ + +/* Use this routine for the x86 platform - it uses a faster MMX routine + if the machine supports MMX. */ + +void /* PRIVATE */ +png_combine_row(png_structp png_ptr, png_bytep row, int mask) +{ + png_debug(1, "in png_combine_row (pnggccrd.c)\n"); + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) + if (_mmx_supported == 2) { +#if !defined(PNG_1_0_X) + /* this should have happened in png_init_mmx_flags() already */ + png_warning(png_ptr, "asm_flags may not have been initialized"); +#endif + png_mmx_support(); + } +#endif + + if (mask == 0xff) + { + png_debug(2,"mask == 0xff: doing single png_memcpy()\n"); + png_memcpy(row, png_ptr->row_buf + 1, + (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,png_ptr->width)); + } + else /* (png_combine_row() is never called with mask == 0) */ + { + switch (png_ptr->row_info.pixel_depth) + { + case 1: /* png_ptr->row_info.pixel_depth */ + { + png_bytep sp; + png_bytep dp; + int s_inc, s_start, s_end; + int m; + int shift; + png_uint_32 i; + + sp = png_ptr->row_buf + 1; + dp = row; + m = 0x80; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 7; + s_inc = 1; + } + else +#endif + { + s_start = 7; + s_end = 0; + s_inc = -1; + } + + shift = s_start; + + for (i = 0; i < png_ptr->width; i++) + { + if (m & mask) + { + int value; + + value = (*sp >> shift) & 0x1; + *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + + case 2: /* png_ptr->row_info.pixel_depth */ + { + png_bytep sp; + png_bytep dp; + int s_start, s_end, s_inc; + int m; + int shift; + png_uint_32 i; + int value; + + sp = png_ptr->row_buf + 1; + dp = row; + m = 0x80; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 6; + s_inc = 2; + } + else +#endif + { + s_start = 6; + s_end = 0; + s_inc = -2; + } + + shift = s_start; + + for (i = 0; i < png_ptr->width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0x3; + *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + + case 4: /* png_ptr->row_info.pixel_depth */ + { + png_bytep sp; + png_bytep dp; + int s_start, s_end, s_inc; + int m; + int shift; + png_uint_32 i; + int value; + + sp = png_ptr->row_buf + 1; + dp = row; + m = 0x80; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 4; + s_inc = 4; + } + else +#endif + { + s_start = 4; + s_end = 0; + s_inc = -4; + } + shift = s_start; + + for (i = 0; i < png_ptr->width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0xf; + *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + + case 8: /* png_ptr->row_info.pixel_depth */ + { + png_bytep srcptr; + png_bytep dstptr; + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && _mmx_supported */ ) +#else + if (_mmx_supported) +#endif + { + png_uint_32 len; + int diff; + int dummy_value_a; // fix 'forbidden register spilled' error + int dummy_value_d; + int dummy_value_c; + int dummy_value_S; + int dummy_value_D; + _unmask = ~mask; // global variable for -fPIC version + srcptr = png_ptr->row_buf + 1; + dstptr = row; + len = png_ptr->width &~7; // reduce to multiple of 8 + diff = (int) (png_ptr->width & 7); // amount lost + + __asm__ __volatile__ ( + "movd _unmask, %%mm7 \n\t" // load bit pattern + "psubb %%mm6, %%mm6 \n\t" // zero mm6 + "punpcklbw %%mm7, %%mm7 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks + + "movq _mask8_0, %%mm0 \n\t" + "pand %%mm7, %%mm0 \n\t" // nonzero if keep byte + "pcmpeqb %%mm6, %%mm0 \n\t" // zeros->1s, v versa + +// preload "movl len, %%ecx \n\t" // load length of line +// preload "movl srcptr, %%esi \n\t" // load source +// preload "movl dstptr, %%edi \n\t" // load dest + + "cmpl $0, %%ecx \n\t" // len == 0 ? + "je mainloop8end \n\t" + + "mainloop8: \n\t" + "movq (%%esi), %%mm4 \n\t" // *srcptr + "pand %%mm0, %%mm4 \n\t" + "movq %%mm0, %%mm6 \n\t" + "pandn (%%edi), %%mm6 \n\t" // *dstptr + "por %%mm6, %%mm4 \n\t" + "movq %%mm4, (%%edi) \n\t" + "addl $8, %%esi \n\t" // inc by 8 bytes processed + "addl $8, %%edi \n\t" + "subl $8, %%ecx \n\t" // dec by 8 pixels processed + "ja mainloop8 \n\t" + + "mainloop8end: \n\t" +// preload "movl diff, %%ecx \n\t" // (diff is in eax) + "movl %%eax, %%ecx \n\t" + "cmpl $0, %%ecx \n\t" + "jz end8 \n\t" +// preload "movl mask, %%edx \n\t" + "sall $24, %%edx \n\t" // make low byte, high byte + + "secondloop8: \n\t" + "sall %%edx \n\t" // move high bit to CF + "jnc skip8 \n\t" // if CF = 0 + "movb (%%esi), %%al \n\t" + "movb %%al, (%%edi) \n\t" + + "skip8: \n\t" + "incl %%esi \n\t" + "incl %%edi \n\t" + "decl %%ecx \n\t" + "jnz secondloop8 \n\t" + + "end8: \n\t" + "EMMS \n\t" // DONE + + : "=a" (dummy_value_a), // output regs (dummy) + "=d" (dummy_value_d), + "=c" (dummy_value_c), + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "3" (srcptr), // esi // input regs + "4" (dstptr), // edi + "0" (diff), // eax +// was (unmask) "b" RESERVED // ebx // Global Offset Table idx + "2" (len), // ecx + "1" (mask) // edx + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm4", "%mm6", "%mm7" // clobber list +#endif + ); + } + else /* mmx _not supported - Use modified C routine */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + register png_uint_32 i; + png_uint_32 initial_val = png_pass_start[png_ptr->pass]; + /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ + register int stride = png_pass_inc[png_ptr->pass]; + /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ + register int rep_bytes = png_pass_width[png_ptr->pass]; + /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ + png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ + int diff = (int) (png_ptr->width & 7); /* amount lost */ + register png_uint_32 final_val = len; /* GRR bugfix */ + + srcptr = png_ptr->row_buf + 1 + initial_val; + dstptr = row + initial_val; + + for (i = initial_val; i < final_val; i += stride) + { + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + if (diff) /* number of leftover pixels: 3 for pngtest */ + { + final_val+=diff /* *BPP1 */ ; + for (; i < final_val; i += stride) + { + if (rep_bytes > (int)(final_val-i)) + rep_bytes = (int)(final_val-i); + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + } + + } /* end of else (_mmx_supported) */ + + break; + } /* end 8 bpp */ + + case 16: /* png_ptr->row_info.pixel_depth */ + { + png_bytep srcptr; + png_bytep dstptr; + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && _mmx_supported */ ) +#else + if (_mmx_supported) +#endif + { + png_uint_32 len; + int diff; + int dummy_value_a; // fix 'forbidden register spilled' error + int dummy_value_d; + int dummy_value_c; + int dummy_value_S; + int dummy_value_D; + _unmask = ~mask; // global variable for -fPIC version + srcptr = png_ptr->row_buf + 1; + dstptr = row; + len = png_ptr->width &~7; // reduce to multiple of 8 + diff = (int) (png_ptr->width & 7); // amount lost // + + __asm__ __volatile__ ( + "movd _unmask, %%mm7 \n\t" // load bit pattern + "psubb %%mm6, %%mm6 \n\t" // zero mm6 + "punpcklbw %%mm7, %%mm7 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks + + "movq _mask16_0, %%mm0 \n\t" + "movq _mask16_1, %%mm1 \n\t" + + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + + "pcmpeqb %%mm6, %%mm0 \n\t" + "pcmpeqb %%mm6, %%mm1 \n\t" + +// preload "movl len, %%ecx \n\t" // load length of line +// preload "movl srcptr, %%esi \n\t" // load source +// preload "movl dstptr, %%edi \n\t" // load dest + + "cmpl $0, %%ecx \n\t" + "jz mainloop16end \n\t" + + "mainloop16: \n\t" + "movq (%%esi), %%mm4 \n\t" + "pand %%mm0, %%mm4 \n\t" + "movq %%mm0, %%mm6 \n\t" + "movq (%%edi), %%mm7 \n\t" + "pandn %%mm7, %%mm6 \n\t" + "por %%mm6, %%mm4 \n\t" + "movq %%mm4, (%%edi) \n\t" + + "movq 8(%%esi), %%mm5 \n\t" + "pand %%mm1, %%mm5 \n\t" + "movq %%mm1, %%mm7 \n\t" + "movq 8(%%edi), %%mm6 \n\t" + "pandn %%mm6, %%mm7 \n\t" + "por %%mm7, %%mm5 \n\t" + "movq %%mm5, 8(%%edi) \n\t" + + "addl $16, %%esi \n\t" // inc by 16 bytes processed + "addl $16, %%edi \n\t" + "subl $8, %%ecx \n\t" // dec by 8 pixels processed + "ja mainloop16 \n\t" + + "mainloop16end: \n\t" +// preload "movl diff, %%ecx \n\t" // (diff is in eax) + "movl %%eax, %%ecx \n\t" + "cmpl $0, %%ecx \n\t" + "jz end16 \n\t" +// preload "movl mask, %%edx \n\t" + "sall $24, %%edx \n\t" // make low byte, high byte + + "secondloop16: \n\t" + "sall %%edx \n\t" // move high bit to CF + "jnc skip16 \n\t" // if CF = 0 + "movw (%%esi), %%ax \n\t" + "movw %%ax, (%%edi) \n\t" + + "skip16: \n\t" + "addl $2, %%esi \n\t" + "addl $2, %%edi \n\t" + "decl %%ecx \n\t" + "jnz secondloop16 \n\t" + + "end16: \n\t" + "EMMS \n\t" // DONE + + : "=a" (dummy_value_a), // output regs (dummy) + "=c" (dummy_value_c), + "=d" (dummy_value_d), + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (diff), // eax // input regs +// was (unmask) " " RESERVED // ebx // Global Offset Table idx + "1" (len), // ecx + "2" (mask), // edx + "3" (srcptr), // esi + "4" (dstptr) // edi + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm4" // clobber list + , "%mm5", "%mm6", "%mm7" +#endif + ); + } + else /* mmx _not supported - Use modified C routine */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + register png_uint_32 i; + png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass]; + /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ + register int stride = BPP2 * png_pass_inc[png_ptr->pass]; + /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ + register int rep_bytes = BPP2 * png_pass_width[png_ptr->pass]; + /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ + png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ + int diff = (int) (png_ptr->width & 7); /* amount lost */ + register png_uint_32 final_val = BPP2 * len; /* GRR bugfix */ + + srcptr = png_ptr->row_buf + 1 + initial_val; + dstptr = row + initial_val; + + for (i = initial_val; i < final_val; i += stride) + { + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + if (diff) /* number of leftover pixels: 3 for pngtest */ + { + final_val+=diff*BPP2; + for (; i < final_val; i += stride) + { + if (rep_bytes > (int)(final_val-i)) + rep_bytes = (int)(final_val-i); + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + } + } /* end of else (_mmx_supported) */ + + break; + } /* end 16 bpp */ + + case 24: /* png_ptr->row_info.pixel_depth */ + { + png_bytep srcptr; + png_bytep dstptr; + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && _mmx_supported */ ) +#else + if (_mmx_supported) +#endif + { + png_uint_32 len; + int diff; + int dummy_value_a; // fix 'forbidden register spilled' error + int dummy_value_d; + int dummy_value_c; + int dummy_value_S; + int dummy_value_D; + _unmask = ~mask; // global variable for -fPIC version + srcptr = png_ptr->row_buf + 1; + dstptr = row; + len = png_ptr->width &~7; // reduce to multiple of 8 + diff = (int) (png_ptr->width & 7); // amount lost // + + __asm__ __volatile__ ( + "movd _unmask, %%mm7 \n\t" // load bit pattern + "psubb %%mm6, %%mm6 \n\t" // zero mm6 + "punpcklbw %%mm7, %%mm7 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks + + "movq _mask24_0, %%mm0 \n\t" + "movq _mask24_1, %%mm1 \n\t" + "movq _mask24_2, %%mm2 \n\t" + + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + + "pcmpeqb %%mm6, %%mm0 \n\t" + "pcmpeqb %%mm6, %%mm1 \n\t" + "pcmpeqb %%mm6, %%mm2 \n\t" + +// preload "movl len, %%ecx \n\t" // load length of line +// preload "movl srcptr, %%esi \n\t" // load source +// preload "movl dstptr, %%edi \n\t" // load dest + + "cmpl $0, %%ecx \n\t" + "jz mainloop24end \n\t" + + "mainloop24: \n\t" + "movq (%%esi), %%mm4 \n\t" + "pand %%mm0, %%mm4 \n\t" + "movq %%mm0, %%mm6 \n\t" + "movq (%%edi), %%mm7 \n\t" + "pandn %%mm7, %%mm6 \n\t" + "por %%mm6, %%mm4 \n\t" + "movq %%mm4, (%%edi) \n\t" + + "movq 8(%%esi), %%mm5 \n\t" + "pand %%mm1, %%mm5 \n\t" + "movq %%mm1, %%mm7 \n\t" + "movq 8(%%edi), %%mm6 \n\t" + "pandn %%mm6, %%mm7 \n\t" + "por %%mm7, %%mm5 \n\t" + "movq %%mm5, 8(%%edi) \n\t" + + "movq 16(%%esi), %%mm6 \n\t" + "pand %%mm2, %%mm6 \n\t" + "movq %%mm2, %%mm4 \n\t" + "movq 16(%%edi), %%mm7 \n\t" + "pandn %%mm7, %%mm4 \n\t" + "por %%mm4, %%mm6 \n\t" + "movq %%mm6, 16(%%edi) \n\t" + + "addl $24, %%esi \n\t" // inc by 24 bytes processed + "addl $24, %%edi \n\t" + "subl $8, %%ecx \n\t" // dec by 8 pixels processed + + "ja mainloop24 \n\t" + + "mainloop24end: \n\t" +// preload "movl diff, %%ecx \n\t" // (diff is in eax) + "movl %%eax, %%ecx \n\t" + "cmpl $0, %%ecx \n\t" + "jz end24 \n\t" +// preload "movl mask, %%edx \n\t" + "sall $24, %%edx \n\t" // make low byte, high byte + + "secondloop24: \n\t" + "sall %%edx \n\t" // move high bit to CF + "jnc skip24 \n\t" // if CF = 0 + "movw (%%esi), %%ax \n\t" + "movw %%ax, (%%edi) \n\t" + "xorl %%eax, %%eax \n\t" + "movb 2(%%esi), %%al \n\t" + "movb %%al, 2(%%edi) \n\t" + + "skip24: \n\t" + "addl $3, %%esi \n\t" + "addl $3, %%edi \n\t" + "decl %%ecx \n\t" + "jnz secondloop24 \n\t" + + "end24: \n\t" + "EMMS \n\t" // DONE + + : "=a" (dummy_value_a), // output regs (dummy) + "=d" (dummy_value_d), + "=c" (dummy_value_c), + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "3" (srcptr), // esi // input regs + "4" (dstptr), // edi + "0" (diff), // eax +// was (unmask) "b" RESERVED // ebx // Global Offset Table idx + "2" (len), // ecx + "1" (mask) // edx + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm2" // clobber list + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + else /* mmx _not supported - Use modified C routine */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + register png_uint_32 i; + png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass]; + /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ + register int stride = BPP3 * png_pass_inc[png_ptr->pass]; + /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ + register int rep_bytes = BPP3 * png_pass_width[png_ptr->pass]; + /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ + png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ + int diff = (int) (png_ptr->width & 7); /* amount lost */ + register png_uint_32 final_val = BPP3 * len; /* GRR bugfix */ + + srcptr = png_ptr->row_buf + 1 + initial_val; + dstptr = row + initial_val; + + for (i = initial_val; i < final_val; i += stride) + { + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + if (diff) /* number of leftover pixels: 3 for pngtest */ + { + final_val+=diff*BPP3; + for (; i < final_val; i += stride) + { + if (rep_bytes > (int)(final_val-i)) + rep_bytes = (int)(final_val-i); + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + } + } /* end of else (_mmx_supported) */ + + break; + } /* end 24 bpp */ + + case 32: /* png_ptr->row_info.pixel_depth */ + { + png_bytep srcptr; + png_bytep dstptr; + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && _mmx_supported */ ) +#else + if (_mmx_supported) +#endif + { + png_uint_32 len; + int diff; + int dummy_value_a; // fix 'forbidden register spilled' error + int dummy_value_d; + int dummy_value_c; + int dummy_value_S; + int dummy_value_D; + _unmask = ~mask; // global variable for -fPIC version + srcptr = png_ptr->row_buf + 1; + dstptr = row; + len = png_ptr->width &~7; // reduce to multiple of 8 + diff = (int) (png_ptr->width & 7); // amount lost // + + __asm__ __volatile__ ( + "movd _unmask, %%mm7 \n\t" // load bit pattern + "psubb %%mm6, %%mm6 \n\t" // zero mm6 + "punpcklbw %%mm7, %%mm7 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks + + "movq _mask32_0, %%mm0 \n\t" + "movq _mask32_1, %%mm1 \n\t" + "movq _mask32_2, %%mm2 \n\t" + "movq _mask32_3, %%mm3 \n\t" + + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + + "pcmpeqb %%mm6, %%mm0 \n\t" + "pcmpeqb %%mm6, %%mm1 \n\t" + "pcmpeqb %%mm6, %%mm2 \n\t" + "pcmpeqb %%mm6, %%mm3 \n\t" + +// preload "movl len, %%ecx \n\t" // load length of line +// preload "movl srcptr, %%esi \n\t" // load source +// preload "movl dstptr, %%edi \n\t" // load dest + + "cmpl $0, %%ecx \n\t" // lcr + "jz mainloop32end \n\t" + + "mainloop32: \n\t" + "movq (%%esi), %%mm4 \n\t" + "pand %%mm0, %%mm4 \n\t" + "movq %%mm0, %%mm6 \n\t" + "movq (%%edi), %%mm7 \n\t" + "pandn %%mm7, %%mm6 \n\t" + "por %%mm6, %%mm4 \n\t" + "movq %%mm4, (%%edi) \n\t" + + "movq 8(%%esi), %%mm5 \n\t" + "pand %%mm1, %%mm5 \n\t" + "movq %%mm1, %%mm7 \n\t" + "movq 8(%%edi), %%mm6 \n\t" + "pandn %%mm6, %%mm7 \n\t" + "por %%mm7, %%mm5 \n\t" + "movq %%mm5, 8(%%edi) \n\t" + + "movq 16(%%esi), %%mm6 \n\t" + "pand %%mm2, %%mm6 \n\t" + "movq %%mm2, %%mm4 \n\t" + "movq 16(%%edi), %%mm7 \n\t" + "pandn %%mm7, %%mm4 \n\t" + "por %%mm4, %%mm6 \n\t" + "movq %%mm6, 16(%%edi) \n\t" + + "movq 24(%%esi), %%mm7 \n\t" + "pand %%mm3, %%mm7 \n\t" + "movq %%mm3, %%mm5 \n\t" + "movq 24(%%edi), %%mm4 \n\t" + "pandn %%mm4, %%mm5 \n\t" + "por %%mm5, %%mm7 \n\t" + "movq %%mm7, 24(%%edi) \n\t" + + "addl $32, %%esi \n\t" // inc by 32 bytes processed + "addl $32, %%edi \n\t" + "subl $8, %%ecx \n\t" // dec by 8 pixels processed + "ja mainloop32 \n\t" + + "mainloop32end: \n\t" +// preload "movl diff, %%ecx \n\t" // (diff is in eax) + "movl %%eax, %%ecx \n\t" + "cmpl $0, %%ecx \n\t" + "jz end32 \n\t" +// preload "movl mask, %%edx \n\t" + "sall $24, %%edx \n\t" // low byte => high byte + + "secondloop32: \n\t" + "sall %%edx \n\t" // move high bit to CF + "jnc skip32 \n\t" // if CF = 0 + "movl (%%esi), %%eax \n\t" + "movl %%eax, (%%edi) \n\t" + + "skip32: \n\t" + "addl $4, %%esi \n\t" + "addl $4, %%edi \n\t" + "decl %%ecx \n\t" + "jnz secondloop32 \n\t" + + "end32: \n\t" + "EMMS \n\t" // DONE + + : "=a" (dummy_value_a), // output regs (dummy) + "=d" (dummy_value_d), + "=c" (dummy_value_c), + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "3" (srcptr), // esi // input regs + "4" (dstptr), // edi + "0" (diff), // eax +// was (unmask) "b" RESERVED // ebx // Global Offset Table idx + "2" (len), // ecx + "1" (mask) // edx + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm2", "%mm3" // clobber list + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + else /* mmx _not supported - Use modified C routine */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + register png_uint_32 i; + png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass]; + /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ + register int stride = BPP4 * png_pass_inc[png_ptr->pass]; + /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ + register int rep_bytes = BPP4 * png_pass_width[png_ptr->pass]; + /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ + png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ + int diff = (int) (png_ptr->width & 7); /* amount lost */ + register png_uint_32 final_val = BPP4 * len; /* GRR bugfix */ + + srcptr = png_ptr->row_buf + 1 + initial_val; + dstptr = row + initial_val; + + for (i = initial_val; i < final_val; i += stride) + { + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + if (diff) /* number of leftover pixels: 3 for pngtest */ + { + final_val+=diff*BPP4; + for (; i < final_val; i += stride) + { + if (rep_bytes > (int)(final_val-i)) + rep_bytes = (int)(final_val-i); + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + } + } /* end of else (_mmx_supported) */ + + break; + } /* end 32 bpp */ + + case 48: /* png_ptr->row_info.pixel_depth */ + { + png_bytep srcptr; + png_bytep dstptr; + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && _mmx_supported */ ) +#else + if (_mmx_supported) +#endif + { + png_uint_32 len; + int diff; + int dummy_value_a; // fix 'forbidden register spilled' error + int dummy_value_d; + int dummy_value_c; + int dummy_value_S; + int dummy_value_D; + _unmask = ~mask; // global variable for -fPIC version + srcptr = png_ptr->row_buf + 1; + dstptr = row; + len = png_ptr->width &~7; // reduce to multiple of 8 + diff = (int) (png_ptr->width & 7); // amount lost // + + __asm__ __volatile__ ( + "movd _unmask, %%mm7 \n\t" // load bit pattern + "psubb %%mm6, %%mm6 \n\t" // zero mm6 + "punpcklbw %%mm7, %%mm7 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks + + "movq _mask48_0, %%mm0 \n\t" + "movq _mask48_1, %%mm1 \n\t" + "movq _mask48_2, %%mm2 \n\t" + "movq _mask48_3, %%mm3 \n\t" + "movq _mask48_4, %%mm4 \n\t" + "movq _mask48_5, %%mm5 \n\t" + + "pand %%mm7, %%mm0 \n\t" + "pand %%mm7, %%mm1 \n\t" + "pand %%mm7, %%mm2 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pand %%mm7, %%mm4 \n\t" + "pand %%mm7, %%mm5 \n\t" + + "pcmpeqb %%mm6, %%mm0 \n\t" + "pcmpeqb %%mm6, %%mm1 \n\t" + "pcmpeqb %%mm6, %%mm2 \n\t" + "pcmpeqb %%mm6, %%mm3 \n\t" + "pcmpeqb %%mm6, %%mm4 \n\t" + "pcmpeqb %%mm6, %%mm5 \n\t" + +// preload "movl len, %%ecx \n\t" // load length of line +// preload "movl srcptr, %%esi \n\t" // load source +// preload "movl dstptr, %%edi \n\t" // load dest + + "cmpl $0, %%ecx \n\t" + "jz mainloop48end \n\t" + + "mainloop48: \n\t" + "movq (%%esi), %%mm7 \n\t" + "pand %%mm0, %%mm7 \n\t" + "movq %%mm0, %%mm6 \n\t" + "pandn (%%edi), %%mm6 \n\t" + "por %%mm6, %%mm7 \n\t" + "movq %%mm7, (%%edi) \n\t" + + "movq 8(%%esi), %%mm6 \n\t" + "pand %%mm1, %%mm6 \n\t" + "movq %%mm1, %%mm7 \n\t" + "pandn 8(%%edi), %%mm7 \n\t" + "por %%mm7, %%mm6 \n\t" + "movq %%mm6, 8(%%edi) \n\t" + + "movq 16(%%esi), %%mm6 \n\t" + "pand %%mm2, %%mm6 \n\t" + "movq %%mm2, %%mm7 \n\t" + "pandn 16(%%edi), %%mm7 \n\t" + "por %%mm7, %%mm6 \n\t" + "movq %%mm6, 16(%%edi) \n\t" + + "movq 24(%%esi), %%mm7 \n\t" + "pand %%mm3, %%mm7 \n\t" + "movq %%mm3, %%mm6 \n\t" + "pandn 24(%%edi), %%mm6 \n\t" + "por %%mm6, %%mm7 \n\t" + "movq %%mm7, 24(%%edi) \n\t" + + "movq 32(%%esi), %%mm6 \n\t" + "pand %%mm4, %%mm6 \n\t" + "movq %%mm4, %%mm7 \n\t" + "pandn 32(%%edi), %%mm7 \n\t" + "por %%mm7, %%mm6 \n\t" + "movq %%mm6, 32(%%edi) \n\t" + + "movq 40(%%esi), %%mm7 \n\t" + "pand %%mm5, %%mm7 \n\t" + "movq %%mm5, %%mm6 \n\t" + "pandn 40(%%edi), %%mm6 \n\t" + "por %%mm6, %%mm7 \n\t" + "movq %%mm7, 40(%%edi) \n\t" + + "addl $48, %%esi \n\t" // inc by 48 bytes processed + "addl $48, %%edi \n\t" + "subl $8, %%ecx \n\t" // dec by 8 pixels processed + + "ja mainloop48 \n\t" + + "mainloop48end: \n\t" +// preload "movl diff, %%ecx \n\t" // (diff is in eax) + "movl %%eax, %%ecx \n\t" + "cmpl $0, %%ecx \n\t" + "jz end48 \n\t" +// preload "movl mask, %%edx \n\t" + "sall $24, %%edx \n\t" // make low byte, high byte + + "secondloop48: \n\t" + "sall %%edx \n\t" // move high bit to CF + "jnc skip48 \n\t" // if CF = 0 + "movl (%%esi), %%eax \n\t" + "movl %%eax, (%%edi) \n\t" + + "skip48: \n\t" + "addl $4, %%esi \n\t" + "addl $4, %%edi \n\t" + "decl %%ecx \n\t" + "jnz secondloop48 \n\t" + + "end48: \n\t" + "EMMS \n\t" // DONE + + : "=a" (dummy_value_a), // output regs (dummy) + "=d" (dummy_value_d), + "=c" (dummy_value_c), + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "3" (srcptr), // esi // input regs + "4" (dstptr), // edi + "0" (diff), // eax +// was (unmask) "b" RESERVED // ebx // Global Offset Table idx + "2" (len), // ecx + "1" (mask) // edx + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm2", "%mm3" // clobber list + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + else /* mmx _not supported - Use modified C routine */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + register png_uint_32 i; + png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass]; + /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ + register int stride = BPP6 * png_pass_inc[png_ptr->pass]; + /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ + register int rep_bytes = BPP6 * png_pass_width[png_ptr->pass]; + /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ + png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ + int diff = (int) (png_ptr->width & 7); /* amount lost */ + register png_uint_32 final_val = BPP6 * len; /* GRR bugfix */ + + srcptr = png_ptr->row_buf + 1 + initial_val; + dstptr = row + initial_val; + + for (i = initial_val; i < final_val; i += stride) + { + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + if (diff) /* number of leftover pixels: 3 for pngtest */ + { + final_val+=diff*BPP6; + for (; i < final_val; i += stride) + { + if (rep_bytes > (int)(final_val-i)) + rep_bytes = (int)(final_val-i); + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + } + } /* end of else (_mmx_supported) */ + + break; + } /* end 48 bpp */ + + case 64: /* png_ptr->row_info.pixel_depth */ + { + png_bytep srcptr; + png_bytep dstptr; + register png_uint_32 i; + png_uint_32 initial_val = BPP8 * png_pass_start[png_ptr->pass]; + /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ + register int stride = BPP8 * png_pass_inc[png_ptr->pass]; + /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ + register int rep_bytes = BPP8 * png_pass_width[png_ptr->pass]; + /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ + png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ + int diff = (int) (png_ptr->width & 7); /* amount lost */ + register png_uint_32 final_val = BPP8 * len; /* GRR bugfix */ + + srcptr = png_ptr->row_buf + 1 + initial_val; + dstptr = row + initial_val; + + for (i = initial_val; i < final_val; i += stride) + { + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + if (diff) /* number of leftover pixels: 3 for pngtest */ + { + final_val+=diff*BPP8; + for (; i < final_val; i += stride) + { + if (rep_bytes > (int)(final_val-i)) + rep_bytes = (int)(final_val-i); + png_memcpy(dstptr, srcptr, rep_bytes); + srcptr += stride; + dstptr += stride; + } + } + + break; + } /* end 64 bpp */ + + default: /* png_ptr->row_info.pixel_depth != 1,2,4,8,16,24,32,48,64 */ + { + /* this should never happen */ + png_warning(png_ptr, "Invalid row_info.pixel_depth in pnggccrd"); + break; + } + } /* end switch (png_ptr->row_info.pixel_depth) */ + + } /* end if (non-trivial mask) */ + +} /* end png_combine_row() */ + +#endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */ + + + + +/*===========================================================================*/ +/* */ +/* P N G _ D O _ R E A D _ I N T E R L A C E */ +/* */ +/*===========================================================================*/ + +#if defined(PNG_READ_INTERLACING_SUPPORTED) +#if defined(PNG_HAVE_ASSEMBLER_READ_INTERLACE) + +/* png_do_read_interlace() is called after any 16-bit to 8-bit conversion + * has taken place. [GRR: what other steps come before and/or after?] + */ + +void /* PRIVATE */ +png_do_read_interlace(png_structp png_ptr) +{ + png_row_infop row_info = &(png_ptr->row_info); + png_bytep row = png_ptr->row_buf + 1; + int pass = png_ptr->pass; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + png_uint_32 transformations = png_ptr->transformations; +#endif + + png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n"); + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) + if (_mmx_supported == 2) { +#if !defined(PNG_1_0_X) + /* this should have happened in png_init_mmx_flags() already */ + png_warning(png_ptr, "asm_flags may not have been initialized"); +#endif + png_mmx_support(); + } +#endif + + if (row != NULL && row_info != NULL) + { + png_uint_32 final_width; + + final_width = row_info->width * png_pass_inc[pass]; + + switch (row_info->pixel_depth) + { + case 1: + { + png_bytep sp, dp; + int sshift, dshift; + int s_start, s_end, s_inc; + png_byte v; + png_uint_32 i; + int j; + + sp = row + (png_size_t)((row_info->width - 1) >> 3); + dp = row + (png_size_t)((final_width - 1) >> 3); +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (int)((row_info->width + 7) & 7); + dshift = (int)((final_width + 7) & 7); + s_start = 7; + s_end = 0; + s_inc = -1; + } + else +#endif + { + sshift = 7 - (int)((row_info->width + 7) & 7); + dshift = 7 - (int)((final_width + 7) & 7); + s_start = 0; + s_end = 7; + s_inc = 1; + } + + for (i = row_info->width; i; i--) + { + v = (png_byte)((*sp >> sshift) & 0x1); + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + + case 2: + { + png_bytep sp, dp; + int sshift, dshift; + int s_start, s_end, s_inc; + png_uint_32 i; + + sp = row + (png_size_t)((row_info->width - 1) >> 2); + dp = row + (png_size_t)((final_width - 1) >> 2); +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (png_size_t)(((row_info->width + 3) & 3) << 1); + dshift = (png_size_t)(((final_width + 3) & 3) << 1); + s_start = 6; + s_end = 0; + s_inc = -2; + } + else +#endif + { + sshift = (png_size_t)((3 - ((row_info->width + 3) & 3)) << 1); + dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1); + s_start = 0; + s_end = 6; + s_inc = 2; + } + + for (i = row_info->width; i; i--) + { + png_byte v; + int j; + + v = (png_byte)((*sp >> sshift) & 0x3); + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + + case 4: + { + png_bytep sp, dp; + int sshift, dshift; + int s_start, s_end, s_inc; + png_uint_32 i; + + sp = row + (png_size_t)((row_info->width - 1) >> 1); + dp = row + (png_size_t)((final_width - 1) >> 1); +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (png_size_t)(((row_info->width + 1) & 1) << 2); + dshift = (png_size_t)(((final_width + 1) & 1) << 2); + s_start = 4; + s_end = 0; + s_inc = -4; + } + else +#endif + { + sshift = (png_size_t)((1 - ((row_info->width + 1) & 1)) << 2); + dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2); + s_start = 0; + s_end = 4; + s_inc = 4; + } + + for (i = row_info->width; i; i--) + { + png_byte v; + int j; + + v = (png_byte)((*sp >> sshift) & 0xf); + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + + /*====================================================================*/ + + default: /* 8-bit or larger (this is where the routine is modified) */ + { +#if 0 +// static unsigned long long _const4 = 0x0000000000FFFFFFLL; no good +// static unsigned long long const4 = 0x0000000000FFFFFFLL; no good +// unsigned long long _const4 = 0x0000000000FFFFFFLL; no good +// unsigned long long const4 = 0x0000000000FFFFFFLL; no good +#endif + png_bytep sptr, dp; + png_uint_32 i; + png_size_t pixel_bytes; + int width = (int)row_info->width; + + pixel_bytes = (row_info->pixel_depth >> 3); + + /* point sptr at the last pixel in the pre-expanded row: */ + sptr = row + (width - 1) * pixel_bytes; + + /* point dp at the last pixel position in the expanded row: */ + dp = row + (final_width - 1) * pixel_bytes; + + /* New code by Nirav Chhatrapati - Intel Corporation */ + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE) + /* && _mmx_supported */ ) +#else + if (_mmx_supported) +#endif + { + //-------------------------------------------------------------- + if (pixel_bytes == 3) + { + if (((pass == 0) || (pass == 1)) && width) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $21, %%edi \n\t" + // (png_pass_inc[pass] - 1)*pixel_bytes + + ".loop3_pass0: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x x 2 1 0 + "pand _const4, %%mm0 \n\t" // z z z z z 2 1 0 + "movq %%mm0, %%mm1 \n\t" // z z z z z 2 1 0 + "psllq $16, %%mm0 \n\t" // z z z 2 1 0 z z + "movq %%mm0, %%mm2 \n\t" // z z z 2 1 0 z z + "psllq $24, %%mm0 \n\t" // 2 1 0 z z z z z + "psrlq $8, %%mm1 \n\t" // z z z z z z 2 1 + "por %%mm2, %%mm0 \n\t" // 2 1 0 2 1 0 z z + "por %%mm1, %%mm0 \n\t" // 2 1 0 2 1 0 2 1 + "movq %%mm0, %%mm3 \n\t" // 2 1 0 2 1 0 2 1 + "psllq $16, %%mm0 \n\t" // 0 2 1 0 2 1 z z + "movq %%mm3, %%mm4 \n\t" // 2 1 0 2 1 0 2 1 + "punpckhdq %%mm0, %%mm3 \n\t" // 0 2 1 0 2 1 0 2 + "movq %%mm4, 16(%%edi) \n\t" + "psrlq $32, %%mm0 \n\t" // z z z z 0 2 1 0 + "movq %%mm3, 8(%%edi) \n\t" + "punpckldq %%mm4, %%mm0 \n\t" // 1 0 2 1 0 2 1 0 + "subl $3, %%esi \n\t" + "movq %%mm0, (%%edi) \n\t" + "subl $24, %%edi \n\t" + "decl %%ecx \n\t" + "jnz .loop3_pass0 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width), // ecx + "rim" (_const4) // %1(?) (0x0000000000FFFFFFLL) + +#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm2" // clobber list + , "%mm3", "%mm4" +#endif + ); + } + else if (((pass == 2) || (pass == 3)) && width) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $9, %%edi \n\t" + // (png_pass_inc[pass] - 1)*pixel_bytes + + ".loop3_pass2: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x x 2 1 0 + "pand _const4, %%mm0 \n\t" // z z z z z 2 1 0 + "movq %%mm0, %%mm1 \n\t" // z z z z z 2 1 0 + "psllq $16, %%mm0 \n\t" // z z z 2 1 0 z z + "movq %%mm0, %%mm2 \n\t" // z z z 2 1 0 z z + "psllq $24, %%mm0 \n\t" // 2 1 0 z z z z z + "psrlq $8, %%mm1 \n\t" // z z z z z z 2 1 + "por %%mm2, %%mm0 \n\t" // 2 1 0 2 1 0 z z + "por %%mm1, %%mm0 \n\t" // 2 1 0 2 1 0 2 1 + "movq %%mm0, 4(%%edi) \n\t" + "psrlq $16, %%mm0 \n\t" // z z 2 1 0 2 1 0 + "subl $3, %%esi \n\t" + "movd %%mm0, (%%edi) \n\t" + "subl $12, %%edi \n\t" + "decl %%ecx \n\t" + "jnz .loop3_pass2 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width), // ecx + "rim" (_const4) // (0x0000000000FFFFFFLL) + +#if 0 /* %mm0, ..., %mm2 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm2" // clobber list +#endif + ); + } + else if (width) /* && ((pass == 4) || (pass == 5)) */ + { + int width_mmx = ((width >> 1) << 1) - 8; // GRR: huh? + if (width_mmx < 0) + width_mmx = 0; + width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes + if (width_mmx) + { + // png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; + // sptr points at last pixel in pre-expanded row + // dp points at last pixel position in expanded row + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $3, %%esi \n\t" + "subl $9, %%edi \n\t" + // (png_pass_inc[pass] + 1)*pixel_bytes + + ".loop3_pass4: \n\t" + "movq (%%esi), %%mm0 \n\t" // x x 5 4 3 2 1 0 + "movq %%mm0, %%mm1 \n\t" // x x 5 4 3 2 1 0 + "movq %%mm0, %%mm2 \n\t" // x x 5 4 3 2 1 0 + "psllq $24, %%mm0 \n\t" // 4 3 2 1 0 z z z + "pand _const4, %%mm1 \n\t" // z z z z z 2 1 0 + "psrlq $24, %%mm2 \n\t" // z z z x x 5 4 3 + "por %%mm1, %%mm0 \n\t" // 4 3 2 1 0 2 1 0 + "movq %%mm2, %%mm3 \n\t" // z z z x x 5 4 3 + "psllq $8, %%mm2 \n\t" // z z x x 5 4 3 z + "movq %%mm0, (%%edi) \n\t" + "psrlq $16, %%mm3 \n\t" // z z z z z x x 5 + "pand _const6, %%mm3 \n\t" // z z z z z z z 5 + "por %%mm3, %%mm2 \n\t" // z z x x 5 4 3 5 + "subl $6, %%esi \n\t" + "movd %%mm2, 8(%%edi) \n\t" + "subl $12, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop3_pass4 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx), // ecx + "rim" (_const4), // 0x0000000000FFFFFFLL + "rim" (_const6) // 0x00000000000000FFLL + +#if 0 /* %mm0, ..., %mm3 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list + , "%mm2", "%mm3" +#endif + ); + } + + sptr -= width_mmx*3; + dp -= width_mmx*6; + for (i = width; i; i--) + { + png_byte v[8]; + int j; + + png_memcpy(v, sptr, 3); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 3); + dp -= 3; + } + sptr -= 3; + } + } + } /* end of pixel_bytes == 3 */ + + //-------------------------------------------------------------- + else if (pixel_bytes == 1) + { + if (((pass == 0) || (pass == 1)) && width) + { + int width_mmx = ((width >> 2) << 2); + width -= width_mmx; // 0-3 pixels => 0-3 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $3, %%esi \n\t" + "subl $31, %%edi \n\t" + + ".loop1_pass0: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 + "movq %%mm0, %%mm1 \n\t" // x x x x 3 2 1 0 + "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0 + "movq %%mm0, %%mm2 \n\t" // 3 3 2 2 1 1 0 0 + "punpcklwd %%mm0, %%mm0 \n\t" // 1 1 1 1 0 0 0 0 + "movq %%mm0, %%mm3 \n\t" // 1 1 1 1 0 0 0 0 + "punpckldq %%mm0, %%mm0 \n\t" // 0 0 0 0 0 0 0 0 + "punpckhdq %%mm3, %%mm3 \n\t" // 1 1 1 1 1 1 1 1 + "movq %%mm0, (%%edi) \n\t" + "punpckhwd %%mm2, %%mm2 \n\t" // 3 3 3 3 2 2 2 2 + "movq %%mm3, 8(%%edi) \n\t" + "movq %%mm2, %%mm4 \n\t" // 3 3 3 3 2 2 2 2 + "punpckldq %%mm2, %%mm2 \n\t" // 2 2 2 2 2 2 2 2 + "punpckhdq %%mm4, %%mm4 \n\t" // 3 3 3 3 3 3 3 3 + "movq %%mm2, 16(%%edi) \n\t" + "subl $4, %%esi \n\t" + "movq %%mm4, 24(%%edi) \n\t" + "subl $32, %%edi \n\t" + "subl $4, %%ecx \n\t" + "jnz .loop1_pass0 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1", "%mm2" // clobber list + , "%mm3", "%mm4" +#endif + ); + } + + sptr -= width_mmx; + dp -= width_mmx*8; + for (i = width; i; i--) + { + int j; + + /* I simplified this part in version 1.0.4e + * here and in several other instances where + * pixel_bytes == 1 -- GR-P + * + * Original code: + * + * png_byte v[8]; + * png_memcpy(v, sptr, pixel_bytes); + * for (j = 0; j < png_pass_inc[pass]; j++) + * { + * png_memcpy(dp, v, pixel_bytes); + * dp -= pixel_bytes; + * } + * sptr -= pixel_bytes; + * + * Replacement code is in the next three lines: + */ + + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp-- = *sptr; + } + --sptr; + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + int width_mmx = ((width >> 2) << 2); + width -= width_mmx; // 0-3 pixels => 0-3 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $3, %%esi \n\t" + "subl $15, %%edi \n\t" + + ".loop1_pass2: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 + "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0 + "movq %%mm0, %%mm1 \n\t" // 3 3 2 2 1 1 0 0 + "punpcklwd %%mm0, %%mm0 \n\t" // 1 1 1 1 0 0 0 0 + "punpckhwd %%mm1, %%mm1 \n\t" // 3 3 3 3 2 2 2 2 + "movq %%mm0, (%%edi) \n\t" + "subl $4, %%esi \n\t" + "movq %%mm1, 8(%%edi) \n\t" + "subl $16, %%edi \n\t" + "subl $4, %%ecx \n\t" + "jnz .loop1_pass2 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= width_mmx; + dp -= width_mmx*4; + for (i = width; i; i--) + { + int j; + + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp-- = *sptr; + } + --sptr; + } + } + else if (width) /* && ((pass == 4) || (pass == 5)) */ + { + int width_mmx = ((width >> 3) << 3); + width -= width_mmx; // 0-3 pixels => 0-3 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $7, %%esi \n\t" + "subl $15, %%edi \n\t" + + ".loop1_pass4: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 + "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0 + "punpckhbw %%mm1, %%mm1 \n\t" // 7 7 6 6 5 5 4 4 + "movq %%mm1, 8(%%edi) \n\t" + "subl $8, %%esi \n\t" + "movq %%mm0, (%%edi) \n\t" + "subl $16, %%edi \n\t" + "subl $8, %%ecx \n\t" + "jnz .loop1_pass4 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (none) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= width_mmx; + dp -= width_mmx*2; + for (i = width; i; i--) + { + int j; + + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp-- = *sptr; + } + --sptr; + } + } + } /* end of pixel_bytes == 1 */ + + //-------------------------------------------------------------- + else if (pixel_bytes == 2) + { + if (((pass == 0) || (pass == 1)) && width) + { + int width_mmx = ((width >> 1) << 1); + width -= width_mmx; // 0,1 pixels => 0,2 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $2, %%esi \n\t" + "subl $30, %%edi \n\t" + + ".loop2_pass0: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 + "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0 + "movq %%mm0, %%mm1 \n\t" // 3 2 3 2 1 0 1 0 + "punpckldq %%mm0, %%mm0 \n\t" // 1 0 1 0 1 0 1 0 + "punpckhdq %%mm1, %%mm1 \n\t" // 3 2 3 2 3 2 3 2 + "movq %%mm0, (%%edi) \n\t" + "movq %%mm0, 8(%%edi) \n\t" + "movq %%mm1, 16(%%edi) \n\t" + "subl $4, %%esi \n\t" + "movq %%mm1, 24(%%edi) \n\t" + "subl $32, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop2_pass0 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= (width_mmx*2 - 2); // sign fixed + dp -= (width_mmx*16 - 2); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 2; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 2; + png_memcpy(dp, v, 2); + } + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; // 0,1 pixels => 0,2 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $2, %%esi \n\t" + "subl $14, %%edi \n\t" + + ".loop2_pass2: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 + "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0 + "movq %%mm0, %%mm1 \n\t" // 3 2 3 2 1 0 1 0 + "punpckldq %%mm0, %%mm0 \n\t" // 1 0 1 0 1 0 1 0 + "punpckhdq %%mm1, %%mm1 \n\t" // 3 2 3 2 3 2 3 2 + "movq %%mm0, (%%edi) \n\t" + "subl $4, %%esi \n\t" + "movq %%mm1, 8(%%edi) \n\t" + "subl $16, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop2_pass2 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= (width_mmx*2 - 2); // sign fixed + dp -= (width_mmx*8 - 2); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 2; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 2; + png_memcpy(dp, v, 2); + } + } + } + else if (width) // pass == 4 or 5 + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; // 0,1 pixels => 0,2 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $2, %%esi \n\t" + "subl $6, %%edi \n\t" + + ".loop2_pass4: \n\t" + "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 + "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0 + "subl $4, %%esi \n\t" + "movq %%mm0, (%%edi) \n\t" + "subl $8, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop2_pass4 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0" // clobber list +#endif + ); + } + + sptr -= (width_mmx*2 - 2); // sign fixed + dp -= (width_mmx*4 - 2); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 2; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 2; + png_memcpy(dp, v, 2); + } + } + } + } /* end of pixel_bytes == 2 */ + + //-------------------------------------------------------------- + else if (pixel_bytes == 4) + { + if (((pass == 0) || (pass == 1)) && width) + { + int width_mmx = ((width >> 1) << 1); + width -= width_mmx; // 0,1 pixels => 0,4 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $4, %%esi \n\t" + "subl $60, %%edi \n\t" + + ".loop4_pass0: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 + "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0 + "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4 + "movq %%mm0, (%%edi) \n\t" + "movq %%mm0, 8(%%edi) \n\t" + "movq %%mm0, 16(%%edi) \n\t" + "movq %%mm0, 24(%%edi) \n\t" + "movq %%mm1, 32(%%edi) \n\t" + "movq %%mm1, 40(%%edi) \n\t" + "movq %%mm1, 48(%%edi) \n\t" + "subl $8, %%esi \n\t" + "movq %%mm1, 56(%%edi) \n\t" + "subl $64, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop4_pass0 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= (width_mmx*4 - 4); // sign fixed + dp -= (width_mmx*32 - 4); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 4; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 4; + png_memcpy(dp, v, 4); + } + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + int width_mmx = ((width >> 1) << 1); + width -= width_mmx; // 0,1 pixels => 0,4 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $4, %%esi \n\t" + "subl $28, %%edi \n\t" + + ".loop4_pass2: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 + "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0 + "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4 + "movq %%mm0, (%%edi) \n\t" + "movq %%mm0, 8(%%edi) \n\t" + "movq %%mm1, 16(%%edi) \n\t" + "movq %%mm1, 24(%%edi) \n\t" + "subl $8, %%esi \n\t" + "subl $32, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop4_pass2 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= (width_mmx*4 - 4); // sign fixed + dp -= (width_mmx*16 - 4); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 4; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 4; + png_memcpy(dp, v, 4); + } + } + } + else if (width) // pass == 4 or 5 + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; // 0,1 pixels => 0,4 bytes + if (width_mmx) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $4, %%esi \n\t" + "subl $12, %%edi \n\t" + + ".loop4_pass4: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 + "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0 + "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4 + "movq %%mm0, (%%edi) \n\t" + "subl $8, %%esi \n\t" + "movq %%mm1, 8(%%edi) \n\t" + "subl $16, %%edi \n\t" + "subl $2, %%ecx \n\t" + "jnz .loop4_pass4 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width_mmx) // ecx + +#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0", "%mm1" // clobber list +#endif + ); + } + + sptr -= (width_mmx*4 - 4); // sign fixed + dp -= (width_mmx*8 - 4); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 4; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 4; + png_memcpy(dp, v, 4); + } + } + } + } /* end of pixel_bytes == 4 */ + + //-------------------------------------------------------------- + else if (pixel_bytes == 8) + { +// GRR TEST: should work, but needs testing (special 64-bit version of rpng2?) + // GRR NOTE: no need to combine passes here! + if (((pass == 0) || (pass == 1)) && width) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + // source is 8-byte RRGGBBAA + // dest is 64-byte RRGGBBAA RRGGBBAA RRGGBBAA RRGGBBAA ... + __asm__ __volatile__ ( + "subl $56, %%edi \n\t" // start of last block + + ".loop8_pass0: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, (%%edi) \n\t" + "movq %%mm0, 8(%%edi) \n\t" + "movq %%mm0, 16(%%edi) \n\t" + "movq %%mm0, 24(%%edi) \n\t" + "movq %%mm0, 32(%%edi) \n\t" + "movq %%mm0, 40(%%edi) \n\t" + "movq %%mm0, 48(%%edi) \n\t" + "subl $8, %%esi \n\t" + "movq %%mm0, 56(%%edi) \n\t" + "subl $64, %%edi \n\t" + "decl %%ecx \n\t" + "jnz .loop8_pass0 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width) // ecx + +#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0" // clobber list +#endif + ); + } + else if (((pass == 2) || (pass == 3)) && width) + { + // source is 8-byte RRGGBBAA + // dest is 32-byte RRGGBBAA RRGGBBAA RRGGBBAA RRGGBBAA + // (recall that expansion is _in place_: sptr and dp + // both point at locations within same row buffer) + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $24, %%edi \n\t" // start of last block + + ".loop8_pass2: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, (%%edi) \n\t" + "movq %%mm0, 8(%%edi) \n\t" + "movq %%mm0, 16(%%edi) \n\t" + "subl $8, %%esi \n\t" + "movq %%mm0, 24(%%edi) \n\t" + "subl $32, %%edi \n\t" + "decl %%ecx \n\t" + "jnz .loop8_pass2 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width) // ecx + +#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0" // clobber list +#endif + ); + } + } + else if (width) // pass == 4 or 5 + { + // source is 8-byte RRGGBBAA + // dest is 16-byte RRGGBBAA RRGGBBAA + { + int dummy_value_c; // fix 'forbidden register spilled' + int dummy_value_S; + int dummy_value_D; + + __asm__ __volatile__ ( + "subl $8, %%edi \n\t" // start of last block + + ".loop8_pass4: \n\t" + "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 + "movq %%mm0, (%%edi) \n\t" + "subl $8, %%esi \n\t" + "movq %%mm0, 8(%%edi) \n\t" + "subl $16, %%edi \n\t" + "decl %%ecx \n\t" + "jnz .loop8_pass4 \n\t" + "EMMS \n\t" // DONE + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "1" (sptr), // esi // input regs + "2" (dp), // edi + "0" (width) // ecx + +#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ + : "%mm0" // clobber list +#endif + ); + } + } + + } /* end of pixel_bytes == 8 */ + + //-------------------------------------------------------------- + else if (pixel_bytes == 6) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 6); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 6); + dp -= 6; + } + sptr -= 6; + } + } /* end of pixel_bytes == 6 */ + + //-------------------------------------------------------------- + else + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr-= pixel_bytes; + } + } + } // end of _mmx_supported ======================================== + + else /* MMX not supported: use modified C code - takes advantage + * of inlining of png_memcpy for a constant */ + /* GRR 19991007: does it? or should pixel_bytes in each + * block be replaced with immediate value (e.g., 1)? */ + /* GRR 19991017: replaced with constants in each case */ +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + if (pixel_bytes == 1) + { + for (i = width; i; i--) + { + int j; + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp-- = *sptr; + } + --sptr; + } + } + else if (pixel_bytes == 3) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 3); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 3); + dp -= 3; + } + sptr -= 3; + } + } + else if (pixel_bytes == 2) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 2); + dp -= 2; + } + sptr -= 2; + } + } + else if (pixel_bytes == 4) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { +#ifdef PNG_DEBUG + if (dp < row || dp+3 > row+png_ptr->row_buf_size) + { + printf("dp out of bounds: row=%d, dp=%d, rp=%d\n", + row, dp, row+png_ptr->row_buf_size); + printf("row_buf=%d\n",png_ptr->row_buf_size); + } +#endif + png_memcpy(dp, v, 4); + dp -= 4; + } + sptr -= 4; + } + } + else if (pixel_bytes == 6) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 6); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 6); + dp -= 6; + } + sptr -= 6; + } + } + else if (pixel_bytes == 8) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 8); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 8); + dp -= 8; + } + sptr -= 8; + } + } + else /* GRR: should never be reached */ + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr -= pixel_bytes; + } + } + + } /* end if (MMX not supported) */ + break; + } + } /* end switch (row_info->pixel_depth) */ + + row_info->width = final_width; + + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width); + } + +} /* end png_do_read_interlace() */ + +#endif /* PNG_HAVE_ASSEMBLER_READ_INTERLACE */ +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + + + +#if defined(PNG_HAVE_ASSEMBLER_READ_FILTER_ROW) +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) + +// These variables are utilized in the functions below. They are declared +// globally here to ensure alignment on 8-byte boundaries. + +union uAll { + long long use; + double align; +} _LBCarryMask = {0x0101010101010101LL}, + _HBClearMask = {0x7f7f7f7f7f7f7f7fLL}, + _ActiveMask, _ActiveMask2, _ActiveMaskEnd, _ShiftBpp, _ShiftRem; + +#ifdef PNG_THREAD_UNSAFE_OK +//===========================================================================// +// // +// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ A V G // +// // +//===========================================================================// + +// Optimized code for PNG Average filter decoder + +static void /* PRIVATE */ +png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row, + png_bytep prev_row) +{ + int bpp; + int dummy_value_c; // fix 'forbidden register 2 (cx) was spilled' error + int dummy_value_S; + int dummy_value_D; + + bpp = (row_info->pixel_depth + 7) >> 3; // get # bytes per pixel + _FullLength = row_info->rowbytes; // # of bytes to filter + + __asm__ __volatile__ ( + // initialize address pointers and offset +#ifdef __PIC__ + "pushl %%ebx \n\t" // save index to Global Offset Table +#endif +//pre "movl row, %%edi \n\t" // edi: Avg(x) + "xorl %%ebx, %%ebx \n\t" // ebx: x + "movl %%edi, %%edx \n\t" +//pre "movl prev_row, %%esi \n\t" // esi: Prior(x) +//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) + "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp) + + "xorl %%eax,%%eax \n\t" + + // Compute the Raw value for the first bpp bytes + // Raw(x) = Avg(x) + (Prior(x)/2) + "avg_rlp: \n\t" + "movb (%%esi,%%ebx,),%%al \n\t" // load al with Prior(x) + "incl %%ebx \n\t" + "shrb %%al \n\t" // divide by 2 + "addb -1(%%edi,%%ebx,),%%al \n\t" // add Avg(x); -1 to offset inc ebx +//pre "cmpl bpp, %%ebx \n\t" // (bpp is preloaded into ecx) + "cmpl %%ecx, %%ebx \n\t" + "movb %%al,-1(%%edi,%%ebx,) \n\t" // write Raw(x); -1 to offset inc ebx + "jb avg_rlp \n\t" // mov does not affect flags + + // get # of bytes to alignment + "movl %%edi, _dif \n\t" // take start of row + "addl %%ebx, _dif \n\t" // add bpp + "addl $0xf, _dif \n\t" // add 7+8 to incr past alignment bdry + "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary + "subl %%edi, _dif \n\t" // subtract from start => value ebx at + "jz avg_go \n\t" // alignment + + // fix alignment + // Compute the Raw value for the bytes up to the alignment boundary + // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) + "xorl %%ecx, %%ecx \n\t" + + "avg_lp1: \n\t" + "xorl %%eax, %%eax \n\t" + "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x) + "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp) + "addw %%cx, %%ax \n\t" + "incl %%ebx \n\t" + "shrw %%ax \n\t" // divide by 2 + "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset inc ebx + "cmpl _dif, %%ebx \n\t" // check if at alignment boundary + "movb %%al, -1(%%edi,%%ebx,) \n\t" // write Raw(x); -1 to offset inc ebx + "jb avg_lp1 \n\t" // repeat until at alignment boundary + + "avg_go: \n\t" + "movl _FullLength, %%eax \n\t" + "movl %%eax, %%ecx \n\t" + "subl %%ebx, %%eax \n\t" // subtract alignment fix + "andl $0x00000007, %%eax \n\t" // calc bytes over mult of 8 + "subl %%eax, %%ecx \n\t" // drop over bytes from original length + "movl %%ecx, _MMXLength \n\t" +#ifdef __PIC__ + "popl %%ebx \n\t" // restore index to Global Offset Table +#endif + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (bpp), // ecx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%edx" // clobber list +#ifndef __PIC__ + , "%ebx" +#endif + // GRR: INCLUDE "memory" as clobbered? (_dif, _MMXLength) + // (seems to work fine without...) + ); + + // now do the math for the rest of the row + switch (bpp) + { + case 3: + { + _ActiveMask.use = 0x0000000000ffffffLL; + _ShiftBpp.use = 24; // == 3 * 8 + _ShiftRem.use = 40; // == 64 - 24 + + __asm__ __volatile__ ( + // re-init address pointers and offset + "movq _ActiveMask, %%mm7 \n\t" + "movl _dif, %%ecx \n\t" // ecx: x = offset to + "movq _LBCarryMask, %%mm5 \n\t" // alignment boundary +// preload "movl row, %%edi \n\t" // edi: Avg(x) + "movq _HBClearMask, %%mm4 \n\t" +// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) + + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes + // (correct pos. in loop below) + "avg_3lp: \n\t" + "movq (%%edi,%%ecx,), %%mm0 \n\t" // load mm0 with Avg(x) + "movq %%mm5, %%mm3 \n\t" + "psrlq _ShiftRem, %%mm2 \n\t" // correct position Raw(x-bpp) + // data + "movq (%%esi,%%ecx,), %%mm1 \n\t" // load mm1 with Prior(x) + "movq %%mm7, %%mm6 \n\t" + "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte + "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 + "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for + // each byte + // add 1st active group (Raw(x-bpp)/2) to average with LBCarry + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 1 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active + // byte + // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry + "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover + // bytes 3-5 + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active + // byte + + // add 3rd active group (Raw(x-bpp)/2) to average with _LBCarry + "psllq _ShiftBpp, %%mm6 \n\t" // shift mm6 mask to cover last + // two + // bytes + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly + // Data only needs to be shifted once here to + // get the correct x-bpp offset. + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 + // bytes to add to Avg + "addl $8, %%ecx \n\t" + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active + // byte + // now ready to write back to memory + "movq %%mm0, -8(%%edi,%%ecx,) \n\t" + // move updated Raw(x) to use as Raw(x-bpp) for next loop + "cmpl _MMXLength, %%ecx \n\t" + "movq %%mm0, %%mm2 \n\t" // mov updated Raw(x) to mm2 + "jb avg_3lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 3 bpp + + case 6: + case 4: + //case 7: // who wrote this? PNG doesn't support 5 or 7 bytes/pixel + //case 5: // GRR BOGUS + { + _ActiveMask.use = 0xffffffffffffffffLL; // use shift below to clear + // appropriate inactive bytes + _ShiftBpp.use = bpp << 3; + _ShiftRem.use = 64 - _ShiftBpp.use; + + __asm__ __volatile__ ( + "movq _HBClearMask, %%mm4 \n\t" + + // re-init address pointers and offset + "movl _dif, %%ecx \n\t" // ecx: x = offset to + // alignment boundary + + // load _ActiveMask and clear all bytes except for 1st active group + "movq _ActiveMask, %%mm7 \n\t" +// preload "movl row, %%edi \n\t" // edi: Avg(x) + "psrlq _ShiftRem, %%mm7 \n\t" +// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) + "movq %%mm7, %%mm6 \n\t" + "movq _LBCarryMask, %%mm5 \n\t" + "psllq _ShiftBpp, %%mm6 \n\t" // create mask for 2nd active + // group + + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes + // (we correct pos. in loop below) + "avg_4lp: \n\t" + "movq (%%edi,%%ecx,), %%mm0 \n\t" + "psrlq _ShiftRem, %%mm2 \n\t" // shift data to pos. correctly + "movq (%%esi,%%ecx,), %%mm1 \n\t" + // add (Prev_row/2) to average + "movq %%mm5, %%mm3 \n\t" + "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte + "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 + "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for + // each byte + // add 1st active group (Raw(x-bpp)/2) to average with _LBCarry + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm7, %%mm2 \n\t" // leave only Active Group 1 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to Avg + // for each Active + // byte + // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly + "addl $8, %%ecx \n\t" + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active + // byte + "cmpl _MMXLength, %%ecx \n\t" + // now ready to write back to memory + "movq %%mm0, -8(%%edi,%%ecx,) \n\t" + // prep Raw(x-bpp) for next loop + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "jb avg_4lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 4,6 bpp + + case 2: + { + _ActiveMask.use = 0x000000000000ffffLL; + _ShiftBpp.use = 16; // == 2 * 8 + _ShiftRem.use = 48; // == 64 - 16 + + __asm__ __volatile__ ( + // load _ActiveMask + "movq _ActiveMask, %%mm7 \n\t" + // re-init address pointers and offset + "movl _dif, %%ecx \n\t" // ecx: x = offset to alignment + // boundary + "movq _LBCarryMask, %%mm5 \n\t" +// preload "movl row, %%edi \n\t" // edi: Avg(x) + "movq _HBClearMask, %%mm4 \n\t" +// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) + + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes + // (we correct pos. in loop below) + "avg_2lp: \n\t" + "movq (%%edi,%%ecx,), %%mm0 \n\t" + "psrlq _ShiftRem, %%mm2 \n\t" // shift data to pos. correctly + "movq (%%esi,%%ecx,), %%mm1 \n\t" // (GRR BUGFIX: was psllq) + // add (Prev_row/2) to average + "movq %%mm5, %%mm3 \n\t" + "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte + "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 + "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each + // byte + "movq %%mm7, %%mm6 \n\t" + "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for + // each byte + + // add 1st active group (Raw(x-bpp)/2) to average with _LBCarry + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid + // for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 1 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to Avg + // for each Active byte + + // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry + "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover + // bytes 2 & 3 + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid + // for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active byte + + // add 3rd active group (Raw(x-bpp)/2) to average with _LBCarry + "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover + // bytes 4 & 5 + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both lsb's were == 1 + // (only valid for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active byte + + // add 4th active group (Raw(x-bpp)/2) to average with _LBCarry + "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover + // bytes 6 & 7 + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly + "addl $8, %%ecx \n\t" + "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting + // LBCarrys + "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte + // where both + // lsb's were == 1 (only valid + // for active group) + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) + // for each byte + "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 + // bytes to add to Avg + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to + // Avg for each Active byte + + "cmpl _MMXLength, %%ecx \n\t" + // now ready to write back to memory + "movq %%mm0, -8(%%edi,%%ecx,) \n\t" + // prep Raw(x-bpp) for next loop + "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 + "jb avg_2lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 2 bpp + + case 1: + { + __asm__ __volatile__ ( + // re-init address pointers and offset +#ifdef __PIC__ + "pushl %%ebx \n\t" // save Global Offset Table index +#endif + "movl _dif, %%ebx \n\t" // ebx: x = offset to alignment + // boundary +// preload "movl row, %%edi \n\t" // edi: Avg(x) + "cmpl _FullLength, %%ebx \n\t" // test if offset at end of array + "jnb avg_1end \n\t" + // do Paeth decode for remaining bytes +// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) + "movl %%edi, %%edx \n\t" +// preload "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) + "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp) + "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx + // in loop below + "avg_1lp: \n\t" + // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) + "xorl %%eax, %%eax \n\t" + "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x) + "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp) + "addw %%cx, %%ax \n\t" + "incl %%ebx \n\t" + "shrw %%ax \n\t" // divide by 2 + "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset + // inc ebx + "cmpl _FullLength, %%ebx \n\t" // check if at end of array + "movb %%al, -1(%%edi,%%ebx,) \n\t" // write back Raw(x); + // mov does not affect flags; -1 to offset inc ebx + "jb avg_1lp \n\t" + + "avg_1end: \n\t" +#ifdef __PIC__ + "popl %%ebx \n\t" // Global Offset Table index +#endif + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (bpp), // ecx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%edx" // clobber list +#ifndef __PIC__ + , "%ebx" +#endif + ); + } + return; // end 1 bpp + + case 8: + { + __asm__ __volatile__ ( + // re-init address pointers and offset + "movl _dif, %%ecx \n\t" // ecx: x == offset to alignment + "movq _LBCarryMask, %%mm5 \n\t" // boundary +// preload "movl row, %%edi \n\t" // edi: Avg(x) + "movq _HBClearMask, %%mm4 \n\t" +// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) + + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes + // (NO NEED to correct pos. in loop below) + + "avg_8lp: \n\t" + "movq (%%edi,%%ecx,), %%mm0 \n\t" + "movq %%mm5, %%mm3 \n\t" + "movq (%%esi,%%ecx,), %%mm1 \n\t" + "addl $8, %%ecx \n\t" + "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte + "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 + "pand %%mm2, %%mm3 \n\t" // get LBCarrys for each byte + // where both lsb's were == 1 + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7, each byte + "paddb %%mm3, %%mm0 \n\t" // add LBCarrys to Avg, each byte + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7, each byte + "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg, each + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) to Avg for each + "cmpl _MMXLength, %%ecx \n\t" + "movq %%mm0, -8(%%edi,%%ecx,) \n\t" + "movq %%mm0, %%mm2 \n\t" // reuse as Raw(x-bpp) + "jb avg_8lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm5 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2" + , "%mm3", "%mm4", "%mm5" +#endif + ); + } + break; // end 8 bpp + + default: // bpp greater than 8 (!= 1,2,3,4,[5],6,[7],8) + { + +#ifdef PNG_DEBUG + // GRR: PRINT ERROR HERE: SHOULD NEVER BE REACHED + png_debug(1, + "Internal logic error in pnggccrd (png_read_filter_row_mmx_avg())\n"); +#endif + +#if 0 + __asm__ __volatile__ ( + "movq _LBCarryMask, %%mm5 \n\t" + // re-init address pointers and offset + "movl _dif, %%ebx \n\t" // ebx: x = offset to + // alignment boundary + "movl row, %%edi \n\t" // edi: Avg(x) + "movq _HBClearMask, %%mm4 \n\t" + "movl %%edi, %%edx \n\t" + "movl prev_row, %%esi \n\t" // esi: Prior(x) + "subl bpp, %%edx \n\t" // edx: Raw(x-bpp) + "avg_Alp: \n\t" + "movq (%%edi,%%ebx,), %%mm0 \n\t" + "movq %%mm5, %%mm3 \n\t" + "movq (%%esi,%%ebx,), %%mm1 \n\t" + "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte + "movq (%%edx,%%ebx,), %%mm2 \n\t" + "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 + "pand %%mm2, %%mm3 \n\t" // get LBCarrys for each byte + // where both lsb's were == 1 + "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 + "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm3, %%mm0 \n\t" // add LBCarrys to Avg for each + // byte + "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each + // byte + "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for + // each byte + "addl $8, %%ebx \n\t" + "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) to Avg for each + // byte + "cmpl _MMXLength, %%ebx \n\t" + "movq %%mm0, -8(%%edi,%%ebx,) \n\t" + "jb avg_Alp \n\t" + + : // FIXASM: output regs/vars go here, e.g.: "=m" (memory_var) + + : // FIXASM: input regs, e.g.: "c" (count), "S" (src), "D" (dest) + + : "%ebx", "%edx", "%edi", "%esi" // CHECKASM: clobber list + ); +#endif /* 0 - NEVER REACHED */ + } + break; + + } // end switch (bpp) + + __asm__ __volatile__ ( + // MMX acceleration complete; now do clean-up + // check if any remaining bytes left to decode +#ifdef __PIC__ + "pushl %%ebx \n\t" // save index to Global Offset Table +#endif + "movl _MMXLength, %%ebx \n\t" // ebx: x == offset bytes after MMX +//pre "movl row, %%edi \n\t" // edi: Avg(x) + "cmpl _FullLength, %%ebx \n\t" // test if offset at end of array + "jnb avg_end \n\t" + + // do Avg decode for remaining bytes +//pre "movl prev_row, %%esi \n\t" // esi: Prior(x) + "movl %%edi, %%edx \n\t" +//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) + "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp) + "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx below + + "avg_lp2: \n\t" + // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) + "xorl %%eax, %%eax \n\t" + "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x) + "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp) + "addw %%cx, %%ax \n\t" + "incl %%ebx \n\t" + "shrw %%ax \n\t" // divide by 2 + "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset inc ebx + "cmpl _FullLength, %%ebx \n\t" // check if at end of array + "movb %%al, -1(%%edi,%%ebx,) \n\t" // write back Raw(x) [mov does not + "jb avg_lp2 \n\t" // affect flags; -1 to offset inc ebx] + + "avg_end: \n\t" + "EMMS \n\t" // end MMX; prep for poss. FP instrs. +#ifdef __PIC__ + "popl %%ebx \n\t" // restore index to Global Offset Table +#endif + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (bpp), // ecx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%edx" // clobber list +#ifndef __PIC__ + , "%ebx" +#endif + ); + +} /* end png_read_filter_row_mmx_avg() */ +#endif + + + +#ifdef PNG_THREAD_UNSAFE_OK +//===========================================================================// +// // +// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ P A E T H // +// // +//===========================================================================// + +// Optimized code for PNG Paeth filter decoder + +static void /* PRIVATE */ +png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row, + png_bytep prev_row) +{ + int bpp; + int dummy_value_c; // fix 'forbidden register 2 (cx) was spilled' error + int dummy_value_S; + int dummy_value_D; + + bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel + _FullLength = row_info->rowbytes; // # of bytes to filter + + __asm__ __volatile__ ( +#ifdef __PIC__ + "pushl %%ebx \n\t" // save index to Global Offset Table +#endif + "xorl %%ebx, %%ebx \n\t" // ebx: x offset +//pre "movl row, %%edi \n\t" + "xorl %%edx, %%edx \n\t" // edx: x-bpp offset +//pre "movl prev_row, %%esi \n\t" + "xorl %%eax, %%eax \n\t" + + // Compute the Raw value for the first bpp bytes + // Note: the formula works out to be always + // Paeth(x) = Raw(x) + Prior(x) where x < bpp + "paeth_rlp: \n\t" + "movb (%%edi,%%ebx,), %%al \n\t" + "addb (%%esi,%%ebx,), %%al \n\t" + "incl %%ebx \n\t" +//pre "cmpl bpp, %%ebx \n\t" (bpp is preloaded into ecx) + "cmpl %%ecx, %%ebx \n\t" + "movb %%al, -1(%%edi,%%ebx,) \n\t" + "jb paeth_rlp \n\t" + // get # of bytes to alignment + "movl %%edi, _dif \n\t" // take start of row + "addl %%ebx, _dif \n\t" // add bpp + "xorl %%ecx, %%ecx \n\t" + "addl $0xf, _dif \n\t" // add 7 + 8 to incr past alignment + // boundary + "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary + "subl %%edi, _dif \n\t" // subtract from start ==> value ebx + // at alignment + "jz paeth_go \n\t" + // fix alignment + + "paeth_lp1: \n\t" + "xorl %%eax, %%eax \n\t" + // pav = p - a = (a + b - c) - a = b - c + "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) + "movl %%eax, _patemp \n\t" // Save pav for later use + "xorl %%eax, %%eax \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al + "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) + "movl %%eax, %%ecx \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "addl _patemp, %%eax \n\t" // pcv = pav + pbv + // pc = abs(pcv) + "testl $0x80000000, %%eax \n\t" + "jz paeth_pca \n\t" + "negl %%eax \n\t" // reverse sign of neg values + + "paeth_pca: \n\t" + "movl %%eax, _pctemp \n\t" // save pc for later use + // pb = abs(pbv) + "testl $0x80000000, %%ecx \n\t" + "jz paeth_pba \n\t" + "negl %%ecx \n\t" // reverse sign of neg values + + "paeth_pba: \n\t" + "movl %%ecx, _pbtemp \n\t" // save pb for later use + // pa = abs(pav) + "movl _patemp, %%eax \n\t" + "testl $0x80000000, %%eax \n\t" + "jz paeth_paa \n\t" + "negl %%eax \n\t" // reverse sign of neg values + + "paeth_paa: \n\t" + "movl %%eax, _patemp \n\t" // save pa for later use + // test if pa <= pb + "cmpl %%ecx, %%eax \n\t" + "jna paeth_abb \n\t" + // pa > pb; now test if pb <= pc + "cmpl _pctemp, %%ecx \n\t" + "jna paeth_bbc \n\t" + // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "jmp paeth_paeth \n\t" + + "paeth_bbc: \n\t" + // pb <= pc; Raw(x) = Paeth(x) + Prior(x) + "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl + "jmp paeth_paeth \n\t" + + "paeth_abb: \n\t" + // pa <= pb; now test if pa <= pc + "cmpl _pctemp, %%eax \n\t" + "jna paeth_abc \n\t" + // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "jmp paeth_paeth \n\t" + + "paeth_abc: \n\t" + // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) + "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl + + "paeth_paeth: \n\t" + "incl %%ebx \n\t" + "incl %%edx \n\t" + // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 + "addb %%cl, -1(%%edi,%%ebx,) \n\t" + "cmpl _dif, %%ebx \n\t" + "jb paeth_lp1 \n\t" + + "paeth_go: \n\t" + "movl _FullLength, %%ecx \n\t" + "movl %%ecx, %%eax \n\t" + "subl %%ebx, %%eax \n\t" // subtract alignment fix + "andl $0x00000007, %%eax \n\t" // calc bytes over mult of 8 + "subl %%eax, %%ecx \n\t" // drop over bytes from original length + "movl %%ecx, _MMXLength \n\t" +#ifdef __PIC__ + "popl %%ebx \n\t" // restore index to Global Offset Table +#endif + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (bpp), // ecx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%edx" // clobber list +#ifndef __PIC__ + , "%ebx" +#endif + ); + + // now do the math for the rest of the row + switch (bpp) + { + case 3: + { + _ActiveMask.use = 0x0000000000ffffffLL; + _ActiveMaskEnd.use = 0xffff000000000000LL; + _ShiftBpp.use = 24; // == bpp(3) * 8 + _ShiftRem.use = 40; // == 64 - 24 + + __asm__ __volatile__ ( + "movl _dif, %%ecx \n\t" +// preload "movl row, %%edi \n\t" +// preload "movl prev_row, %%esi \n\t" + "pxor %%mm0, %%mm0 \n\t" + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm1 \n\t" + "paeth_3lp: \n\t" + "psrlq _ShiftRem, %%mm1 \n\t" // shift last 3 bytes to 1st + // 3 bytes + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) + "punpcklbw %%mm0, %%mm1 \n\t" // unpack High bytes of a + "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // prep c=Prior(x-bpp) bytes + "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b + "psrlq _ShiftRem, %%mm3 \n\t" // shift last 3 bytes to 1st + // 3 bytes + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "packuswb %%mm1, %%mm7 \n\t" + "movq (%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp) + "pand _ActiveMask, %%mm7 \n\t" + "movq %%mm3, %%mm2 \n\t" // load b=Prior(x) step 1 + "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) + "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value + "movq %%mm7, %%mm1 \n\t" // now mm1 will be used as + // Raw(x-bpp) + // now do Paeth for 2nd set of bytes (3-5) + "psrlq _ShiftBpp, %%mm2 \n\t" // load b=Prior(x) step 2 + "punpcklbw %%mm0, %%mm1 \n\t" // unpack High bytes of a + "pxor %%mm7, %%mm7 \n\t" + "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + "psubw %%mm3, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = + // pav + pbv = pbv + pav + "movq %%mm5, %%mm6 \n\t" + "paddw %%mm4, %%mm6 \n\t" + + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm5, %%mm0 \n\t" // create mask pbv bytes < 0 + "pcmpgtw %%mm4, %%mm7 \n\t" // create mask pav bytes < 0 + "pand %%mm5, %%mm0 \n\t" // only pbv bytes < 0 in mm0 + "pand %%mm4, %%mm7 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm0, %%mm5 \n\t" + "psubw %%mm7, %%mm4 \n\t" + "psubw %%mm0, %%mm5 \n\t" + "psubw %%mm7, %%mm4 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "pxor %%mm1, %%mm1 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "packuswb %%mm1, %%mm7 \n\t" + "movq %%mm2, %%mm3 \n\t" // load c=Prior(x-bpp) step 1 + "pand _ActiveMask, %%mm7 \n\t" + "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b + "psllq _ShiftBpp, %%mm7 \n\t" // shift bytes to 2nd group of + // 3 bytes + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) + "psllq _ShiftBpp, %%mm3 \n\t" // load c=Prior(x-bpp) step 2 + "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value + "movq %%mm7, %%mm1 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + "psllq _ShiftBpp, %%mm1 \n\t" // shift bytes + // now mm1 will be used as Raw(x-bpp) + // now do Paeth for 3rd, and final, set of bytes (6-7) + "pxor %%mm7, %%mm7 \n\t" + "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a + "psubw %%mm3, %%mm4 \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "paddw %%mm5, %%mm6 \n\t" + + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm1, %%mm1 \n\t" + "packuswb %%mm7, %%mm1 \n\t" + // step ecx to next set of 8 bytes and repeat loop til done + "addl $8, %%ecx \n\t" + "pand _ActiveMaskEnd, %%mm1 \n\t" + "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with + // Raw(x) + + "cmpl _MMXLength, %%ecx \n\t" + "pxor %%mm0, %%mm0 \n\t" // pxor does not affect flags + "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + // mm3 ready to be used as Prior(x-bpp) next loop + "jb paeth_3lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 3 bpp + + case 6: + //case 7: // GRR BOGUS + //case 5: // GRR BOGUS + { + _ActiveMask.use = 0x00000000ffffffffLL; + _ActiveMask2.use = 0xffffffff00000000LL; + _ShiftBpp.use = bpp << 3; // == bpp * 8 + _ShiftRem.use = 64 - _ShiftBpp.use; + + __asm__ __volatile__ ( + "movl _dif, %%ecx \n\t" +// preload "movl row, %%edi \n\t" +// preload "movl prev_row, %%esi \n\t" + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm1 \n\t" + "pxor %%mm0, %%mm0 \n\t" + + "paeth_6lp: \n\t" + // must shift to position Raw(x-bpp) data + "psrlq _ShiftRem, %%mm1 \n\t" + // do first set of 4 bytes + "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes + "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) + "punpcklbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b + // must shift to position Prior(x-bpp) data + "psrlq _ShiftRem, %%mm3 \n\t" + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" // unpack Low bytes of c + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "packuswb %%mm1, %%mm7 \n\t" + "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp) + "pand _ActiveMask, %%mm7 \n\t" + "psrlq _ShiftRem, %%mm3 \n\t" + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) step 1 + "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor and Raw(x) + "movq %%mm2, %%mm6 \n\t" + "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value + "movq -8(%%edi,%%ecx,), %%mm1 \n\t" + "psllq _ShiftBpp, %%mm6 \n\t" + "movq %%mm7, %%mm5 \n\t" + "psrlq _ShiftRem, %%mm1 \n\t" + "por %%mm6, %%mm3 \n\t" + "psllq _ShiftBpp, %%mm5 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + "por %%mm5, %%mm1 \n\t" + // do second set of 4 bytes + "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b + "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "pxor %%mm1, %%mm1 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + // step ecx to next set of 8 bytes and repeat loop til done + "addl $8, %%ecx \n\t" + "packuswb %%mm7, %%mm1 \n\t" + "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with Raw(x) + "cmpl _MMXLength, %%ecx \n\t" + "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + "jb paeth_6lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 6 bpp + + case 4: + { + _ActiveMask.use = 0x00000000ffffffffLL; + + __asm__ __volatile__ ( + "movl _dif, %%ecx \n\t" +// preload "movl row, %%edi \n\t" +// preload "movl prev_row, %%esi \n\t" + "pxor %%mm0, %%mm0 \n\t" + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // only time should need to read + // a=Raw(x-bpp) bytes + "paeth_4lp: \n\t" + // do first set of 4 bytes + "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes + "punpckhbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) + "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "packuswb %%mm1, %%mm7 \n\t" + "movq (%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp) + "pand _ActiveMask, %%mm7 \n\t" + "movq %%mm3, %%mm2 \n\t" // load b=Prior(x) step 1 + "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) + "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value + "movq %%mm7, %%mm1 \n\t" // now mm1 will be used as Raw(x-bpp) + // do second set of 4 bytes + "punpckhbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b + "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "pxor %%mm1, %%mm1 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + // step ecx to next set of 8 bytes and repeat loop til done + "addl $8, %%ecx \n\t" + "packuswb %%mm7, %%mm1 \n\t" + "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add predictor with Raw(x) + "cmpl _MMXLength, %%ecx \n\t" + "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + "jb paeth_4lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 4 bpp + + case 8: // bpp == 8 + { + _ActiveMask.use = 0x00000000ffffffffLL; + + __asm__ __volatile__ ( + "movl _dif, %%ecx \n\t" +// preload "movl row, %%edi \n\t" +// preload "movl prev_row, %%esi \n\t" + "pxor %%mm0, %%mm0 \n\t" + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // only time should need to read + // a=Raw(x-bpp) bytes + "paeth_8lp: \n\t" + // do first set of 4 bytes + "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes + "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) + "punpcklbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" // unpack Low bytes of c + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "packuswb %%mm1, %%mm7 \n\t" + "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes + "pand _ActiveMask, %%mm7 \n\t" + "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) + "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) + "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c + "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value + "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // read a=Raw(x-bpp) bytes + + // do second set of 4 bytes + "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b + "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a + // pav = p - a = (a + b - c) - a = b - c + "movq %%mm2, %%mm4 \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movq %%mm1, %%mm5 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "movq %%mm4, %%mm6 \n\t" + "psubw %%mm3, %%mm5 \n\t" + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 + "paddw %%mm5, %%mm6 \n\t" + "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 + "psubw %%mm0, %%mm4 \n\t" + "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm7, %%mm5 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 + "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 + "psubw %%mm7, %%mm5 \n\t" + "psubw %%mm0, %%mm6 \n\t" + // test pa <= pb + "movq %%mm4, %%mm7 \n\t" + "psubw %%mm0, %%mm6 \n\t" + "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? + "movq %%mm7, %%mm0 \n\t" + // use mm7 mask to merge pa & pb + "pand %%mm7, %%mm5 \n\t" + // use mm0 mask copy to merge a & b + "pand %%mm0, %%mm2 \n\t" + "pandn %%mm4, %%mm7 \n\t" + "pandn %%mm1, %%mm0 \n\t" + "paddw %%mm5, %%mm7 \n\t" + "paddw %%mm2, %%mm0 \n\t" + // test ((pa <= pb)? pa:pb) <= pc + "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? + "pxor %%mm1, %%mm1 \n\t" + "pand %%mm7, %%mm3 \n\t" + "pandn %%mm0, %%mm7 \n\t" + "pxor %%mm1, %%mm1 \n\t" + "paddw %%mm3, %%mm7 \n\t" + "pxor %%mm0, %%mm0 \n\t" + // step ecx to next set of 8 bytes and repeat loop til done + "addl $8, %%ecx \n\t" + "packuswb %%mm7, %%mm1 \n\t" + "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with Raw(x) + "cmpl _MMXLength, %%ecx \n\t" + "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + "jb paeth_8lp \n\t" + + : "=S" (dummy_value_S), // output regs (dummy) + "=D" (dummy_value_D) + + : "0" (prev_row), // esi // input regs + "1" (row) // edi + + : "%ecx" // clobber list +#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; // end 8 bpp + + case 1: // bpp = 1 + case 2: // bpp = 2 + default: // bpp > 8 + { + __asm__ __volatile__ ( +#ifdef __PIC__ + "pushl %%ebx \n\t" // save Global Offset Table index +#endif + "movl _dif, %%ebx \n\t" + "cmpl _FullLength, %%ebx \n\t" + "jnb paeth_dend \n\t" + +// preload "movl row, %%edi \n\t" +// preload "movl prev_row, %%esi \n\t" + // do Paeth decode for remaining bytes + "movl %%ebx, %%edx \n\t" +// preload "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) + "subl %%ecx, %%edx \n\t" // edx = ebx - bpp + "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx + + "paeth_dlp: \n\t" + "xorl %%eax, %%eax \n\t" + // pav = p - a = (a + b - c) - a = b - c + "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) + "movl %%eax, _patemp \n\t" // Save pav for later use + "xorl %%eax, %%eax \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al + "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) + "movl %%eax, %%ecx \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "addl _patemp, %%eax \n\t" // pcv = pav + pbv + // pc = abs(pcv) + "testl $0x80000000, %%eax \n\t" + "jz paeth_dpca \n\t" + "negl %%eax \n\t" // reverse sign of neg values + + "paeth_dpca: \n\t" + "movl %%eax, _pctemp \n\t" // save pc for later use + // pb = abs(pbv) + "testl $0x80000000, %%ecx \n\t" + "jz paeth_dpba \n\t" + "negl %%ecx \n\t" // reverse sign of neg values + + "paeth_dpba: \n\t" + "movl %%ecx, _pbtemp \n\t" // save pb for later use + // pa = abs(pav) + "movl _patemp, %%eax \n\t" + "testl $0x80000000, %%eax \n\t" + "jz paeth_dpaa \n\t" + "negl %%eax \n\t" // reverse sign of neg values + + "paeth_dpaa: \n\t" + "movl %%eax, _patemp \n\t" // save pa for later use + // test if pa <= pb + "cmpl %%ecx, %%eax \n\t" + "jna paeth_dabb \n\t" + // pa > pb; now test if pb <= pc + "cmpl _pctemp, %%ecx \n\t" + "jna paeth_dbbc \n\t" + // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "jmp paeth_dpaeth \n\t" + + "paeth_dbbc: \n\t" + // pb <= pc; Raw(x) = Paeth(x) + Prior(x) + "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl + "jmp paeth_dpaeth \n\t" + + "paeth_dabb: \n\t" + // pa <= pb; now test if pa <= pc + "cmpl _pctemp, %%eax \n\t" + "jna paeth_dabc \n\t" + // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "jmp paeth_dpaeth \n\t" + + "paeth_dabc: \n\t" + // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) + "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl + + "paeth_dpaeth: \n\t" + "incl %%ebx \n\t" + "incl %%edx \n\t" + // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 + "addb %%cl, -1(%%edi,%%ebx,) \n\t" + "cmpl _FullLength, %%ebx \n\t" + "jb paeth_dlp \n\t" + + "paeth_dend: \n\t" +#ifdef __PIC__ + "popl %%ebx \n\t" // index to Global Offset Table +#endif + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (bpp), // ecx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%edx" // clobber list +#ifndef __PIC__ + , "%ebx" +#endif + ); + } + return; // No need to go further with this one + + } // end switch (bpp) + + __asm__ __volatile__ ( + // MMX acceleration complete; now do clean-up + // check if any remaining bytes left to decode +#ifdef __PIC__ + "pushl %%ebx \n\t" // save index to Global Offset Table +#endif + "movl _MMXLength, %%ebx \n\t" + "cmpl _FullLength, %%ebx \n\t" + "jnb paeth_end \n\t" +//pre "movl row, %%edi \n\t" +//pre "movl prev_row, %%esi \n\t" + // do Paeth decode for remaining bytes + "movl %%ebx, %%edx \n\t" +//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) + "subl %%ecx, %%edx \n\t" // edx = ebx - bpp + "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx below + + "paeth_lp2: \n\t" + "xorl %%eax, %%eax \n\t" + // pav = p - a = (a + b - c) - a = b - c + "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) + "movl %%eax, _patemp \n\t" // Save pav for later use + "xorl %%eax, %%eax \n\t" + // pbv = p - b = (a + b - c) - b = a - c + "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al + "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) + "movl %%eax, %%ecx \n\t" + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + "addl _patemp, %%eax \n\t" // pcv = pav + pbv + // pc = abs(pcv) + "testl $0x80000000, %%eax \n\t" + "jz paeth_pca2 \n\t" + "negl %%eax \n\t" // reverse sign of neg values + + "paeth_pca2: \n\t" + "movl %%eax, _pctemp \n\t" // save pc for later use + // pb = abs(pbv) + "testl $0x80000000, %%ecx \n\t" + "jz paeth_pba2 \n\t" + "negl %%ecx \n\t" // reverse sign of neg values + + "paeth_pba2: \n\t" + "movl %%ecx, _pbtemp \n\t" // save pb for later use + // pa = abs(pav) + "movl _patemp, %%eax \n\t" + "testl $0x80000000, %%eax \n\t" + "jz paeth_paa2 \n\t" + "negl %%eax \n\t" // reverse sign of neg values + + "paeth_paa2: \n\t" + "movl %%eax, _patemp \n\t" // save pa for later use + // test if pa <= pb + "cmpl %%ecx, %%eax \n\t" + "jna paeth_abb2 \n\t" + // pa > pb; now test if pb <= pc + "cmpl _pctemp, %%ecx \n\t" + "jna paeth_bbc2 \n\t" + // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "jmp paeth_paeth2 \n\t" + + "paeth_bbc2: \n\t" + // pb <= pc; Raw(x) = Paeth(x) + Prior(x) + "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl + "jmp paeth_paeth2 \n\t" + + "paeth_abb2: \n\t" + // pa <= pb; now test if pa <= pc + "cmpl _pctemp, %%eax \n\t" + "jna paeth_abc2 \n\t" + // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl + "jmp paeth_paeth2 \n\t" + + "paeth_abc2: \n\t" + // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) + "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl + + "paeth_paeth2: \n\t" + "incl %%ebx \n\t" + "incl %%edx \n\t" + // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 + "addb %%cl, -1(%%edi,%%ebx,) \n\t" + "cmpl _FullLength, %%ebx \n\t" + "jb paeth_lp2 \n\t" + + "paeth_end: \n\t" + "EMMS \n\t" // end MMX; prep for poss. FP instrs. +#ifdef __PIC__ + "popl %%ebx \n\t" // restore index to Global Offset Table +#endif + + : "=c" (dummy_value_c), // output regs (dummy) + "=S" (dummy_value_S), + "=D" (dummy_value_D) + + : "0" (bpp), // ecx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%edx" // clobber list (no input regs!) +#ifndef __PIC__ + , "%ebx" +#endif + ); + +} /* end png_read_filter_row_mmx_paeth() */ +#endif + + + + +#ifdef PNG_THREAD_UNSAFE_OK +//===========================================================================// +// // +// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ S U B // +// // +//===========================================================================// + +// Optimized code for PNG Sub filter decoder + +static void /* PRIVATE */ +png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row) +{ + int bpp; + int dummy_value_a; + int dummy_value_D; + + bpp = (row_info->pixel_depth + 7) >> 3; // calc number of bytes per pixel + _FullLength = row_info->rowbytes - bpp; // number of bytes to filter + + __asm__ __volatile__ ( +//pre "movl row, %%edi \n\t" + "movl %%edi, %%esi \n\t" // lp = row +//pre "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp +//irr "xorl %%eax, %%eax \n\t" + // get # of bytes to alignment + "movl %%edi, _dif \n\t" // take start of row + "addl $0xf, _dif \n\t" // add 7 + 8 to incr past + // alignment boundary + "xorl %%ecx, %%ecx \n\t" + "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary + "subl %%edi, _dif \n\t" // subtract from start ==> value + "jz sub_go \n\t" // ecx at alignment + + "sub_lp1: \n\t" // fix alignment + "movb (%%esi,%%ecx,), %%al \n\t" + "addb %%al, (%%edi,%%ecx,) \n\t" + "incl %%ecx \n\t" + "cmpl _dif, %%ecx \n\t" + "jb sub_lp1 \n\t" + + "sub_go: \n\t" + "movl _FullLength, %%eax \n\t" + "movl %%eax, %%edx \n\t" + "subl %%ecx, %%edx \n\t" // subtract alignment fix + "andl $0x00000007, %%edx \n\t" // calc bytes over mult of 8 + "subl %%edx, %%eax \n\t" // drop over bytes from length + "movl %%eax, _MMXLength \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%esi", "%ecx", "%edx" // clobber list + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + + // now do the math for the rest of the row + switch (bpp) + { + case 3: + { + _ActiveMask.use = 0x0000ffffff000000LL; + _ShiftBpp.use = 24; // == 3 * 8 + _ShiftRem.use = 40; // == 64 - 24 + + __asm__ __volatile__ ( +// preload "movl row, %%edi \n\t" + "movq _ActiveMask, %%mm7 \n\t" // load _ActiveMask for 2nd + // active byte group + "movl %%edi, %%esi \n\t" // lp = row +// preload "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + "movq %%mm7, %%mm6 \n\t" + "movl _dif, %%edx \n\t" + "psllq _ShiftBpp, %%mm6 \n\t" // move mask in mm6 to cover + // 3rd active byte group + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%edx,), %%mm1 \n\t" + + "sub_3lp: \n\t" // shift data for adding first + "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask; + // shift clears inactive bytes) + // add 1st active group + "movq (%%edi,%%edx,), %%mm0 \n\t" + "paddb %%mm1, %%mm0 \n\t" + + // add 2nd active group + "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 + "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly + "pand %%mm7, %%mm1 \n\t" // mask to use 2nd active group + "paddb %%mm1, %%mm0 \n\t" + + // add 3rd active group + "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 + "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly + "pand %%mm6, %%mm1 \n\t" // mask to use 3rd active group + "addl $8, %%edx \n\t" + "paddb %%mm1, %%mm0 \n\t" + + "cmpl _MMXLength, %%edx \n\t" + "movq %%mm0, -8(%%edi,%%edx,) \n\t" // write updated Raws to array + "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop + "jb sub_3lp \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%edx", "%esi" // clobber list +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm6", "%mm7" +#endif + ); + } + break; + + case 1: + { + __asm__ __volatile__ ( + "movl _dif, %%edx \n\t" +// preload "movl row, %%edi \n\t" + "cmpl _FullLength, %%edx \n\t" + "jnb sub_1end \n\t" + "movl %%edi, %%esi \n\t" // lp = row + "xorl %%eax, %%eax \n\t" +// preload "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + + "sub_1lp: \n\t" + "movb (%%esi,%%edx,), %%al \n\t" + "addb %%al, (%%edi,%%edx,) \n\t" + "incl %%edx \n\t" + "cmpl _FullLength, %%edx \n\t" + "jb sub_1lp \n\t" + + "sub_1end: \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%edx", "%esi" // clobber list + ); + } + return; + + case 6: + case 4: + //case 7: // GRR BOGUS + //case 5: // GRR BOGUS + { + _ShiftBpp.use = bpp << 3; + _ShiftRem.use = 64 - _ShiftBpp.use; + + __asm__ __volatile__ ( +// preload "movl row, %%edi \n\t" + "movl _dif, %%edx \n\t" + "movl %%edi, %%esi \n\t" // lp = row +// preload "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%edx,), %%mm1 \n\t" + + "sub_4lp: \n\t" // shift data for adding first + "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask; + // shift clears inactive bytes) + "movq (%%edi,%%edx,), %%mm0 \n\t" + "paddb %%mm1, %%mm0 \n\t" + + // add 2nd active group + "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 + "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly + "addl $8, %%edx \n\t" + "paddb %%mm1, %%mm0 \n\t" + + "cmpl _MMXLength, %%edx \n\t" + "movq %%mm0, -8(%%edi,%%edx,) \n\t" + "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop + "jb sub_4lp \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%edx", "%esi" // clobber list +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1" +#endif + ); + } + break; + + case 2: + { + _ActiveMask.use = 0x00000000ffff0000LL; + _ShiftBpp.use = 16; // == 2 * 8 + _ShiftRem.use = 48; // == 64 - 16 + + __asm__ __volatile__ ( + "movq _ActiveMask, %%mm7 \n\t" // load _ActiveMask for 2nd + // active byte group + "movl _dif, %%edx \n\t" + "movq %%mm7, %%mm6 \n\t" +// preload "movl row, %%edi \n\t" + "psllq _ShiftBpp, %%mm6 \n\t" // move mask in mm6 to cover + // 3rd active byte group + "movl %%edi, %%esi \n\t" // lp = row + "movq %%mm6, %%mm5 \n\t" +// preload "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + "psllq _ShiftBpp, %%mm5 \n\t" // move mask in mm5 to cover + // 4th active byte group + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%edx,), %%mm1 \n\t" + + "sub_2lp: \n\t" // shift data for adding first + "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask; + // shift clears inactive bytes) + // add 1st active group + "movq (%%edi,%%edx,), %%mm0 \n\t" + "paddb %%mm1, %%mm0 \n\t" + + // add 2nd active group + "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 + "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly + "pand %%mm7, %%mm1 \n\t" // mask to use 2nd active group + "paddb %%mm1, %%mm0 \n\t" + + // add 3rd active group + "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 + "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly + "pand %%mm6, %%mm1 \n\t" // mask to use 3rd active group + "paddb %%mm1, %%mm0 \n\t" + + // add 4th active group + "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 + "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly + "pand %%mm5, %%mm1 \n\t" // mask to use 4th active group + "addl $8, %%edx \n\t" + "paddb %%mm1, %%mm0 \n\t" + "cmpl _MMXLength, %%edx \n\t" + "movq %%mm0, -8(%%edi,%%edx,) \n\t" // write updated Raws to array + "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop + "jb sub_2lp \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%edx", "%esi" // clobber list +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; + + case 8: + { + __asm__ __volatile__ ( +// preload "movl row, %%edi \n\t" + "movl _dif, %%edx \n\t" + "movl %%edi, %%esi \n\t" // lp = row +// preload "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + "movl _MMXLength, %%ecx \n\t" + + // prime the pump: load the first Raw(x-bpp) data set + "movq -8(%%edi,%%edx,), %%mm7 \n\t" + "andl $0x0000003f, %%ecx \n\t" // calc bytes over mult of 64 + + "sub_8lp: \n\t" + "movq (%%edi,%%edx,), %%mm0 \n\t" // load Sub(x) for 1st 8 bytes + "paddb %%mm7, %%mm0 \n\t" + "movq 8(%%edi,%%edx,), %%mm1 \n\t" // load Sub(x) for 2nd 8 bytes + "movq %%mm0, (%%edi,%%edx,) \n\t" // write Raw(x) for 1st 8 bytes + + // Now mm0 will be used as Raw(x-bpp) for the 2nd group of 8 bytes. + // This will be repeated for each group of 8 bytes with the 8th + // group being used as the Raw(x-bpp) for the 1st group of the + // next loop. + + "paddb %%mm0, %%mm1 \n\t" + "movq 16(%%edi,%%edx,), %%mm2 \n\t" // load Sub(x) for 3rd 8 bytes + "movq %%mm1, 8(%%edi,%%edx,) \n\t" // write Raw(x) for 2nd 8 bytes + "paddb %%mm1, %%mm2 \n\t" + "movq 24(%%edi,%%edx,), %%mm3 \n\t" // load Sub(x) for 4th 8 bytes + "movq %%mm2, 16(%%edi,%%edx,) \n\t" // write Raw(x) for 3rd 8 bytes + "paddb %%mm2, %%mm3 \n\t" + "movq 32(%%edi,%%edx,), %%mm4 \n\t" // load Sub(x) for 5th 8 bytes + "movq %%mm3, 24(%%edi,%%edx,) \n\t" // write Raw(x) for 4th 8 bytes + "paddb %%mm3, %%mm4 \n\t" + "movq 40(%%edi,%%edx,), %%mm5 \n\t" // load Sub(x) for 6th 8 bytes + "movq %%mm4, 32(%%edi,%%edx,) \n\t" // write Raw(x) for 5th 8 bytes + "paddb %%mm4, %%mm5 \n\t" + "movq 48(%%edi,%%edx,), %%mm6 \n\t" // load Sub(x) for 7th 8 bytes + "movq %%mm5, 40(%%edi,%%edx,) \n\t" // write Raw(x) for 6th 8 bytes + "paddb %%mm5, %%mm6 \n\t" + "movq 56(%%edi,%%edx,), %%mm7 \n\t" // load Sub(x) for 8th 8 bytes + "movq %%mm6, 48(%%edi,%%edx,) \n\t" // write Raw(x) for 7th 8 bytes + "addl $64, %%edx \n\t" + "paddb %%mm6, %%mm7 \n\t" + "cmpl %%ecx, %%edx \n\t" + "movq %%mm7, -8(%%edi,%%edx,) \n\t" // write Raw(x) for 8th 8 bytes + "jb sub_8lp \n\t" + + "cmpl _MMXLength, %%edx \n\t" + "jnb sub_8lt8 \n\t" + + "sub_8lpA: \n\t" + "movq (%%edi,%%edx,), %%mm0 \n\t" + "addl $8, %%edx \n\t" + "paddb %%mm7, %%mm0 \n\t" + "cmpl _MMXLength, %%edx \n\t" + "movq %%mm0, -8(%%edi,%%edx,) \n\t" // -8 to offset early addl edx + "movq %%mm0, %%mm7 \n\t" // move calculated Raw(x) data + // to mm1 to be new Raw(x-bpp) + // for next loop + "jb sub_8lpA \n\t" + + "sub_8lt8: \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%ecx", "%edx", "%esi" // clobber list +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + } + break; + + default: // bpp greater than 8 bytes GRR BOGUS + { + __asm__ __volatile__ ( + "movl _dif, %%edx \n\t" +// preload "movl row, %%edi \n\t" + "movl %%edi, %%esi \n\t" // lp = row +// preload "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + + "sub_Alp: \n\t" + "movq (%%edi,%%edx,), %%mm0 \n\t" + "movq (%%esi,%%edx,), %%mm1 \n\t" + "addl $8, %%edx \n\t" + "paddb %%mm1, %%mm0 \n\t" + "cmpl _MMXLength, %%edx \n\t" + "movq %%mm0, -8(%%edi,%%edx,) \n\t" // mov does not affect flags; + // -8 to offset addl edx + "jb sub_Alp \n\t" + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%edx", "%esi" // clobber list +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1" +#endif + ); + } + break; + + } // end switch (bpp) + + __asm__ __volatile__ ( + "movl _MMXLength, %%edx \n\t" +//pre "movl row, %%edi \n\t" + "cmpl _FullLength, %%edx \n\t" + "jnb sub_end \n\t" + + "movl %%edi, %%esi \n\t" // lp = row +//pre "movl bpp, %%eax \n\t" + "addl %%eax, %%edi \n\t" // rp = row + bpp + "xorl %%eax, %%eax \n\t" + + "sub_lp2: \n\t" + "movb (%%esi,%%edx,), %%al \n\t" + "addb %%al, (%%edi,%%edx,) \n\t" + "incl %%edx \n\t" + "cmpl _FullLength, %%edx \n\t" + "jb sub_lp2 \n\t" + + "sub_end: \n\t" + "EMMS \n\t" // end MMX instructions + + : "=a" (dummy_value_a), // 0 // output regs (dummy) + "=D" (dummy_value_D) // 1 + + : "0" (bpp), // eax // input regs + "1" (row) // edi + + : "%edx", "%esi" // clobber list + ); + +} // end of png_read_filter_row_mmx_sub() +#endif + + + + +//===========================================================================// +// // +// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ U P // +// // +//===========================================================================// + +// Optimized code for PNG Up filter decoder + +static void /* PRIVATE */ +png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, + png_bytep prev_row) +{ + png_uint_32 len; + int dummy_value_d; // fix 'forbidden register 3 (dx) was spilled' error + int dummy_value_S; + int dummy_value_D; + + len = row_info->rowbytes; // number of bytes to filter + + __asm__ __volatile__ ( +//pre "movl row, %%edi \n\t" + // get # of bytes to alignment +#ifdef __PIC__ + "pushl %%ebx \n\t" +#endif + "movl %%edi, %%ecx \n\t" + "xorl %%ebx, %%ebx \n\t" + "addl $0x7, %%ecx \n\t" + "xorl %%eax, %%eax \n\t" + "andl $0xfffffff8, %%ecx \n\t" +//pre "movl prev_row, %%esi \n\t" + "subl %%edi, %%ecx \n\t" + "jz up_go \n\t" + + "up_lp1: \n\t" // fix alignment + "movb (%%edi,%%ebx,), %%al \n\t" + "addb (%%esi,%%ebx,), %%al \n\t" + "incl %%ebx \n\t" + "cmpl %%ecx, %%ebx \n\t" + "movb %%al, -1(%%edi,%%ebx,) \n\t" // mov does not affect flags; -1 to + "jb up_lp1 \n\t" // offset incl ebx + + "up_go: \n\t" +//pre "movl len, %%edx \n\t" + "movl %%edx, %%ecx \n\t" + "subl %%ebx, %%edx \n\t" // subtract alignment fix + "andl $0x0000003f, %%edx \n\t" // calc bytes over mult of 64 + "subl %%edx, %%ecx \n\t" // drop over bytes from length + + // unrolled loop - use all MMX registers and interleave to reduce + // number of branch instructions (loops) and reduce partial stalls + "up_loop: \n\t" + "movq (%%esi,%%ebx,), %%mm1 \n\t" + "movq (%%edi,%%ebx,), %%mm0 \n\t" + "movq 8(%%esi,%%ebx,), %%mm3 \n\t" + "paddb %%mm1, %%mm0 \n\t" + "movq 8(%%edi,%%ebx,), %%mm2 \n\t" + "movq %%mm0, (%%edi,%%ebx,) \n\t" + "paddb %%mm3, %%mm2 \n\t" + "movq 16(%%esi,%%ebx,), %%mm5 \n\t" + "movq %%mm2, 8(%%edi,%%ebx,) \n\t" + "movq 16(%%edi,%%ebx,), %%mm4 \n\t" + "movq 24(%%esi,%%ebx,), %%mm7 \n\t" + "paddb %%mm5, %%mm4 \n\t" + "movq 24(%%edi,%%ebx,), %%mm6 \n\t" + "movq %%mm4, 16(%%edi,%%ebx,) \n\t" + "paddb %%mm7, %%mm6 \n\t" + "movq 32(%%esi,%%ebx,), %%mm1 \n\t" + "movq %%mm6, 24(%%edi,%%ebx,) \n\t" + "movq 32(%%edi,%%ebx,), %%mm0 \n\t" + "movq 40(%%esi,%%ebx,), %%mm3 \n\t" + "paddb %%mm1, %%mm0 \n\t" + "movq 40(%%edi,%%ebx,), %%mm2 \n\t" + "movq %%mm0, 32(%%edi,%%ebx,) \n\t" + "paddb %%mm3, %%mm2 \n\t" + "movq 48(%%esi,%%ebx,), %%mm5 \n\t" + "movq %%mm2, 40(%%edi,%%ebx,) \n\t" + "movq 48(%%edi,%%ebx,), %%mm4 \n\t" + "movq 56(%%esi,%%ebx,), %%mm7 \n\t" + "paddb %%mm5, %%mm4 \n\t" + "movq 56(%%edi,%%ebx,), %%mm6 \n\t" + "movq %%mm4, 48(%%edi,%%ebx,) \n\t" + "addl $64, %%ebx \n\t" + "paddb %%mm7, %%mm6 \n\t" + "cmpl %%ecx, %%ebx \n\t" + "movq %%mm6, -8(%%edi,%%ebx,) \n\t" // (+56)movq does not affect flags; + "jb up_loop \n\t" // -8 to offset addl ebx + + "cmpl $0, %%edx \n\t" // test for bytes over mult of 64 + "jz up_end \n\t" + + "cmpl $8, %%edx \n\t" // test for less than 8 bytes + "jb up_lt8 \n\t" // [added by lcreeve at netins.net] + + "addl %%edx, %%ecx \n\t" + "andl $0x00000007, %%edx \n\t" // calc bytes over mult of 8 + "subl %%edx, %%ecx \n\t" // drop over bytes from length + "jz up_lt8 \n\t" + + "up_lpA: \n\t" // use MMX regs to update 8 bytes sim. + "movq (%%esi,%%ebx,), %%mm1 \n\t" + "movq (%%edi,%%ebx,), %%mm0 \n\t" + "addl $8, %%ebx \n\t" + "paddb %%mm1, %%mm0 \n\t" + "cmpl %%ecx, %%ebx \n\t" + "movq %%mm0, -8(%%edi,%%ebx,) \n\t" // movq does not affect flags; -8 to + "jb up_lpA \n\t" // offset add ebx + "cmpl $0, %%edx \n\t" // test for bytes over mult of 8 + "jz up_end \n\t" + + "up_lt8: \n\t" + "xorl %%eax, %%eax \n\t" + "addl %%edx, %%ecx \n\t" // move over byte count into counter + + "up_lp2: \n\t" // use x86 regs for remaining bytes + "movb (%%edi,%%ebx,), %%al \n\t" + "addb (%%esi,%%ebx,), %%al \n\t" + "incl %%ebx \n\t" + "cmpl %%ecx, %%ebx \n\t" + "movb %%al, -1(%%edi,%%ebx,) \n\t" // mov does not affect flags; -1 to + "jb up_lp2 \n\t" // offset inc ebx + + "up_end: \n\t" + "EMMS \n\t" // conversion of filtered row complete +#ifdef __PIC__ + "popl %%ebx \n\t" +#endif + + : "=d" (dummy_value_d), // 0 // output regs (dummy) + "=S" (dummy_value_S), // 1 + "=D" (dummy_value_D) // 2 + + : "0" (len), // edx // input regs + "1" (prev_row), // esi + "2" (row) // edi + + : "%eax", "%ecx" // clobber list (no input regs!) +#ifndef __PIC__ + , "%ebx" +#endif + +#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ + , "%mm0", "%mm1", "%mm2", "%mm3" + , "%mm4", "%mm5", "%mm6", "%mm7" +#endif + ); + +} // end of png_read_filter_row_mmx_up() + +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + + + + +/*===========================================================================*/ +/* */ +/* P N G _ R E A D _ F I L T E R _ R O W */ +/* */ +/*===========================================================================*/ + + +/* Optimized png_read_filter_row routines */ + +void /* PRIVATE */ +png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep + row, png_bytep prev_row, int filter) +{ +#ifdef PNG_DEBUG + char filnm[10]; +#endif + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +/* GRR: these are superseded by png_ptr->asm_flags: */ +#define UseMMX_sub 1 // GRR: converted 20000730 +#define UseMMX_up 1 // GRR: converted 20000729 +#define UseMMX_avg 1 // GRR: converted 20000828 (+ 16-bit bugfix 20000916) +#define UseMMX_paeth 1 // GRR: converted 20000828 + + if (_mmx_supported == 2) { + /* this should have happened in png_init_mmx_flags() already */ +#if !defined(PNG_1_0_X) + png_warning(png_ptr, "asm_flags may not have been initialized"); +#endif + png_mmx_support(); + } +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + +#ifdef PNG_DEBUG + png_debug(1, "in png_read_filter_row (pnggccrd.c)\n"); + switch (filter) + { + case 0: sprintf(filnm, "none"); + break; + case 1: sprintf(filnm, "sub-%s", +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : +#endif +#endif +"x86"); + break; + case 2: sprintf(filnm, "up-%s", +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +#if !defined(PNG_1_0_X) + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : +#endif +#endif + "x86"); + break; + case 3: sprintf(filnm, "avg-%s", +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : +#endif +#endif + "x86"); + break; + case 4: sprintf(filnm, "Paeth-%s", +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX": +#endif +#endif +"x86"); + break; + default: sprintf(filnm, "unknw"); + break; + } + png_debug2(0, "row_number=%5ld, %5s, ", png_ptr->row_number, filnm); + png_debug1(0, "row=0x%08lx, ", (unsigned long)row); + png_debug2(0, "pixdepth=%2d, bytes=%d, ", (int)row_info->pixel_depth, + (int)((row_info->pixel_depth + 7) >> 3)); + png_debug1(0,"rowbytes=%8ld\n", row_info->rowbytes); +#endif /* PNG_DEBUG */ + + switch (filter) + { + case PNG_FILTER_VALUE_NONE: + break; + + case PNG_FILTER_VALUE_SUB: +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (_mmx_supported) +#endif + { + png_read_filter_row_mmx_sub(row_info, row); + } + else +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_bytep rp = row + bpp; + png_bytep lp = row; + + for (i = bpp; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); + rp++; + } + } /* end !UseMMX_sub */ + break; + + case PNG_FILTER_VALUE_UP: +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (_mmx_supported) +#endif + { + png_read_filter_row_mmx_up(row_info, row, prev_row); + } + else +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_bytep rp = row; + png_bytep pp = prev_row; + + for (i = 0; i < istop; ++i) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + } /* end !UseMMX_up */ + break; + + case PNG_FILTER_VALUE_AVG: +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (_mmx_supported) +#endif + { + png_read_filter_row_mmx_avg(row_info, row, prev_row); + } + else +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop = row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + + ((int)(*pp++) >> 1)) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + + ((int)(*pp++ + *lp++) >> 1)) & 0xff); + rp++; + } + } /* end !UseMMX_avg */ + break; + + case PNG_FILTER_VALUE_PAETH: +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (_mmx_supported) +#endif + { + png_read_filter_row_mmx_paeth(row_info, row, prev_row); + } + else +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_bytep cp = prev_row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop = row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) /* use leftover rp,pp */ + { + int a, b, c, pa, pb, pc, p; + + a = *lp++; + b = *pp++; + c = *cp++; + + p = b - c; + pc = a - c; + +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + + /* + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; + */ + + p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c; + + *rp = (png_byte)(((int)(*rp) + p) & 0xff); + rp++; + } + } /* end !UseMMX_paeth */ + break; + + default: + png_warning(png_ptr, "Ignoring bad row-filter type"); + *row=0; + break; + } +} + +#endif /* PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */ + + +/*===========================================================================*/ +/* */ +/* P N G _ M M X _ S U P P O R T */ +/* */ +/*===========================================================================*/ + +/* GRR NOTES: (1) the following code assumes 386 or better (pushfl/popfl) + * (2) all instructions compile with gcc 2.7.2.3 and later + * (3) the function is moved down here to prevent gcc from + * inlining it in multiple places and then barfing be- + * cause the ".NOT_SUPPORTED" label is multiply defined + * [is there a way to signal that a *single* function should + * not be inlined? is there a way to modify the label for + * each inlined instance, e.g., by appending _1, _2, etc.? + * maybe if don't use leading "." in label name? (nope...sigh)] + */ + +int PNGAPI +png_mmx_support(void) +{ +#if defined(PNG_MMX_CODE_SUPPORTED) + __asm__ __volatile__ ( + "pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction + "pushl %%ecx \n\t" // so does ecx... + "pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux) +// ".byte 0x66 \n\t" // convert 16-bit pushf to 32-bit pushfd +// "pushf \n\t" // 16-bit pushf + "pushfl \n\t" // save Eflag to stack + "popl %%eax \n\t" // get Eflag from stack into eax + "movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx + "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21) + "pushl %%eax \n\t" // save modified Eflag back to stack +// ".byte 0x66 \n\t" // convert 16-bit popf to 32-bit popfd +// "popf \n\t" // 16-bit popf + "popfl \n\t" // restore modified value to Eflag reg + "pushfl \n\t" // save Eflag to stack + "popl %%eax \n\t" // get Eflag from stack + "pushl %%ecx \n\t" // save original Eflag to stack + "popfl \n\t" // restore original Eflag + "xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag + "jz 0f \n\t" // if same, CPUID instr. is not supported + + "xorl %%eax, %%eax \n\t" // set eax to zero +// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode) + "cpuid \n\t" // get the CPU identification info + "cmpl $1, %%eax \n\t" // make sure eax return non-zero value + "jl 0f \n\t" // if eax is zero, MMX is not supported + + "xorl %%eax, %%eax \n\t" // set eax to zero and... + "incl %%eax \n\t" // ...increment eax to 1. This pair is + // faster than the instruction "mov eax, 1" + "cpuid \n\t" // get the CPU identification info again + "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23) + "cmpl $0, %%edx \n\t" // 0 = MMX not supported + "jz 0f \n\t" // non-zero = yes, MMX IS supported + + "movl $1, %%eax \n\t" // set return value to 1 + "jmp 1f \n\t" // DONE: have MMX support + + "0: \n\t" // .NOT_SUPPORTED: target label for jump instructions + "movl $0, %%eax \n\t" // set return value to 0 + "1: \n\t" // .RETURN: target label for jump instructions + "movl %%eax, _mmx_supported \n\t" // save in global static variable, too + "popl %%edx \n\t" // restore edx + "popl %%ecx \n\t" // restore ecx + "popl %%ebx \n\t" // restore ebx + +// "ret \n\t" // DONE: no MMX support + // (fall through to standard C "ret") + + : // output list (none) + + : // any variables used on input (none) + + : "%eax" // clobber list +// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually +// , "memory" // if write to a variable gcc thought was in a reg +// , "cc" // "condition codes" (flag bits) + ); +#else + _mmx_supported = 0; +#endif /* PNG_MMX_CODE_SUPPORTED */ + + return _mmx_supported; +} + + +#endif /* PNG_USE_PNGGCCRD */ diff --git a/src/SFML/Graphics/libpng/pngget.c b/src/SFML/Graphics/libpng/pngget.c new file mode 100644 index 00000000..b538f749 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngget.c @@ -0,0 +1,934 @@ + +/* pngget.c - retrieval of values from info struct + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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" + +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 */ + +#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_1_0_X */ diff --git a/src/SFML/Graphics/libpng/pngmem.c b/src/SFML/Graphics/libpng/pngmem.c new file mode 100644 index 00000000..2f022789 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngmem.c @@ -0,0 +1,595 @@ + +/* pngmem.c - stub functions for memory allocation + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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" + +/* 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 */ diff --git a/src/SFML/Graphics/libpng/pngpread.c b/src/SFML/Graphics/libpng/pngpread.c new file mode 100644 index 00000000..e1e18d5a --- /dev/null +++ b/src/SFML/Graphics/libpng/pngpread.c @@ -0,0 +1,1573 @@ + +/* pngpread.c - read a png file in push mode + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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_PROGRESSIVE_READ_SUPPORTED + +/* push model modes */ +#define PNG_READ_SIG_MODE 0 +#define PNG_READ_CHUNK_MODE 1 +#define PNG_READ_IDAT_MODE 2 +#define PNG_SKIP_MODE 3 +#define PNG_READ_tEXt_MODE 4 +#define PNG_READ_zTXt_MODE 5 +#define PNG_READ_DONE_MODE 6 +#define PNG_READ_iTXt_MODE 7 +#define PNG_ERROR_MODE 8 + +void PNGAPI +png_process_data(png_structp png_ptr, png_infop info_ptr, + png_bytep buffer, png_size_t buffer_size) +{ + png_push_restore_buffer(png_ptr, buffer, buffer_size); + + while (png_ptr->buffer_size) + { + png_process_some_data(png_ptr, info_ptr); + } +} + +/* What we do with the incoming data depends on what we were previously + * doing before we ran out of data... + */ +void /* PRIVATE */ +png_process_some_data(png_structp png_ptr, png_infop info_ptr) +{ + switch (png_ptr->process_mode) + { + case PNG_READ_SIG_MODE: + { + png_push_read_sig(png_ptr, info_ptr); + break; + } + case PNG_READ_CHUNK_MODE: + { + png_push_read_chunk(png_ptr, info_ptr); + break; + } + case PNG_READ_IDAT_MODE: + { + png_push_read_IDAT(png_ptr); + break; + } +#if defined(PNG_READ_tEXt_SUPPORTED) + case PNG_READ_tEXt_MODE: + { + png_push_read_tEXt(png_ptr, info_ptr); + break; + } +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + case PNG_READ_zTXt_MODE: + { + png_push_read_zTXt(png_ptr, info_ptr); + break; + } +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + case PNG_READ_iTXt_MODE: + { + png_push_read_iTXt(png_ptr, info_ptr); + break; + } +#endif + case PNG_SKIP_MODE: + { + png_push_crc_finish(png_ptr); + break; + } + default: + { + png_ptr->buffer_size = 0; + break; + } + } +} + +/* Read any remaining signature bytes from the stream and compare them with + * the correct PNG signature. It is possible that this routine is called + * with bytes already read from the signature, either because they have been + * checked by the calling application, or because of multiple calls to this + * routine. + */ +void /* PRIVATE */ +png_push_read_sig(png_structp png_ptr, png_infop info_ptr) +{ + png_size_t num_checked = png_ptr->sig_bytes, + num_to_check = 8 - num_checked; + + if (png_ptr->buffer_size < num_to_check) + { + num_to_check = png_ptr->buffer_size; + } + + png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]), + num_to_check); + png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes+num_to_check); + + if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) + { + if (num_checked < 4 && + png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + png_error(png_ptr, "Not a PNG file"); + else + png_error(png_ptr, "PNG file corrupted by ASCII conversion"); + } + else + { + if (png_ptr->sig_bytes >= 8) + { + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + } + } +} + +void /* PRIVATE */ +png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IHDR; + PNG_IDAT; + PNG_IEND; + PNG_PLTE; +#if defined(PNG_READ_bKGD_SUPPORTED) + PNG_bKGD; +#endif +#if defined(PNG_READ_cHRM_SUPPORTED) + PNG_cHRM; +#endif +#if defined(PNG_READ_gAMA_SUPPORTED) + PNG_gAMA; +#endif +#if defined(PNG_READ_hIST_SUPPORTED) + PNG_hIST; +#endif +#if defined(PNG_READ_iCCP_SUPPORTED) + PNG_iCCP; +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + PNG_iTXt; +#endif +#if defined(PNG_READ_oFFs_SUPPORTED) + PNG_oFFs; +#endif +#if defined(PNG_READ_pCAL_SUPPORTED) + PNG_pCAL; +#endif +#if defined(PNG_READ_pHYs_SUPPORTED) + PNG_pHYs; +#endif +#if defined(PNG_READ_sBIT_SUPPORTED) + PNG_sBIT; +#endif +#if defined(PNG_READ_sCAL_SUPPORTED) + PNG_sCAL; +#endif +#if defined(PNG_READ_sRGB_SUPPORTED) + PNG_sRGB; +#endif +#if defined(PNG_READ_sPLT_SUPPORTED) + PNG_sPLT; +#endif +#if defined(PNG_READ_tEXt_SUPPORTED) + PNG_tEXt; +#endif +#if defined(PNG_READ_tIME_SUPPORTED) + PNG_tIME; +#endif +#if defined(PNG_READ_tRNS_SUPPORTED) + PNG_tRNS; +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + PNG_zTXt; +#endif +#endif /* PNG_USE_LOCAL_ARRAYS */ + /* First we make sure we have enough data for the 4 byte chunk name + * and the 4 byte chunk length before proceeding with decoding the + * chunk data. To fully decode each of these chunks, we also make + * sure we have enough data in the buffer for the 4 byte CRC at the + * end of every chunk (except IDAT, which is handled separately). + */ + if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) + { + png_byte chunk_length[4]; + + if (png_ptr->buffer_size < 8) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_fill_buffer(png_ptr, chunk_length, 4); + png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; + } + + if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); + } + else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); + + png_ptr->process_mode = PNG_READ_DONE_MODE; + png_push_have_end(png_ptr, info_ptr); + } +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + png_ptr->mode |= PNG_HAVE_IDAT; + png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); + if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + png_ptr->mode |= PNG_HAVE_PLTE; + else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + } + } +#endif + else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); + } + else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) + { + /* If we reach an IDAT chunk, this means we have read all of the + * header chunks, and we can start reading the image (or if this + * is called after the image has been read - we have an error). + */ + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + { + if (png_ptr->push_length == 0) + return; + + if (png_ptr->mode & PNG_AFTER_IDAT) + png_error(png_ptr, "Too many IDAT's found"); + } + + png_ptr->idat_size = png_ptr->push_length; + png_ptr->mode |= PNG_HAVE_IDAT; + png_ptr->process_mode = PNG_READ_IDAT_MODE; + png_push_have_info(png_ptr, info_ptr); + png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; + png_ptr->zstream.next_out = png_ptr->row_buf; + return; + } +#if defined(PNG_READ_gAMA_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_sBIT_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_cHRM_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_sRGB_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_iCCP_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_sPLT_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_tRNS_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_bKGD_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_hIST_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_pHYs_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_oFFs_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_pCAL_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_sCAL_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_tIME_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_tEXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); + } +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); + } +#endif + else + { + if (png_ptr->push_length + 4 > png_ptr->buffer_size) + { + png_push_save_buffer(png_ptr); + return; + } + png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); + } + + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; +} + +void /* PRIVATE */ +png_push_crc_skip(png_structp png_ptr, png_uint_32 skip) +{ + png_ptr->process_mode = PNG_SKIP_MODE; + png_ptr->skip_length = skip; +} + +void /* PRIVATE */ +png_push_crc_finish(png_structp png_ptr) +{ + if (png_ptr->skip_length && png_ptr->save_buffer_size) + { + png_size_t save_size; + + if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size) + save_size = (png_size_t)png_ptr->skip_length; + else + save_size = png_ptr->save_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); + + png_ptr->skip_length -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->save_buffer_size -= save_size; + png_ptr->save_buffer_ptr += save_size; + } + if (png_ptr->skip_length && png_ptr->current_buffer_size) + { + png_size_t save_size; + + if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size) + save_size = (png_size_t)png_ptr->skip_length; + else + save_size = png_ptr->current_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); + + png_ptr->skip_length -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->current_buffer_size -= save_size; + png_ptr->current_buffer_ptr += save_size; + } + if (!png_ptr->skip_length) + { + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_crc_finish(png_ptr, 0); + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + } +} + +void PNGAPI +png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) +{ + png_bytep ptr; + + ptr = buffer; + if (png_ptr->save_buffer_size) + { + png_size_t save_size; + + if (length < png_ptr->save_buffer_size) + save_size = length; + else + save_size = png_ptr->save_buffer_size; + + png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size); + length -= save_size; + ptr += save_size; + png_ptr->buffer_size -= save_size; + png_ptr->save_buffer_size -= save_size; + png_ptr->save_buffer_ptr += save_size; + } + if (length && png_ptr->current_buffer_size) + { + png_size_t save_size; + + if (length < png_ptr->current_buffer_size) + save_size = length; + else + save_size = png_ptr->current_buffer_size; + + png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size); + png_ptr->buffer_size -= save_size; + png_ptr->current_buffer_size -= save_size; + png_ptr->current_buffer_ptr += save_size; + } +} + +void /* PRIVATE */ +png_push_save_buffer(png_structp png_ptr) +{ + if (png_ptr->save_buffer_size) + { + if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) + { + png_size_t i,istop; + png_bytep sp; + png_bytep dp; + + istop = png_ptr->save_buffer_size; + for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; + i < istop; i++, sp++, dp++) + { + *dp = *sp; + } + } + } + if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > + png_ptr->save_buffer_max) + { + png_size_t new_max; + png_bytep old_buffer; + + if (png_ptr->save_buffer_size > PNG_SIZE_MAX - + (png_ptr->current_buffer_size + 256)) + { + png_error(png_ptr, "Potential overflow of save_buffer"); + } + new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; + old_buffer = png_ptr->save_buffer; + png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr, + (png_uint_32)new_max); + png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); + png_free(png_ptr, old_buffer); + png_ptr->save_buffer_max = new_max; + } + if (png_ptr->current_buffer_size) + { + png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size, + png_ptr->current_buffer_ptr, png_ptr->current_buffer_size); + png_ptr->save_buffer_size += png_ptr->current_buffer_size; + png_ptr->current_buffer_size = 0; + } + png_ptr->save_buffer_ptr = png_ptr->save_buffer; + png_ptr->buffer_size = 0; +} + +void /* PRIVATE */ +png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, + png_size_t buffer_length) +{ + png_ptr->current_buffer = buffer; + png_ptr->current_buffer_size = buffer_length; + png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; + png_ptr->current_buffer_ptr = png_ptr->current_buffer; +} + +void /* PRIVATE */ +png_push_read_IDAT(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IDAT; +#endif + if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) + { + png_byte chunk_length[4]; + + if (png_ptr->buffer_size < 8) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_fill_buffer(png_ptr, chunk_length, 4); + png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; + + if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) + { + png_ptr->process_mode = PNG_READ_CHUNK_MODE; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + png_error(png_ptr, "Not enough compressed data"); + return; + } + + png_ptr->idat_size = png_ptr->push_length; + } + if (png_ptr->idat_size && png_ptr->save_buffer_size) + { + png_size_t save_size; + + if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size) + { + save_size = (png_size_t)png_ptr->idat_size; + /* check for overflow */ + if((png_uint_32)save_size != png_ptr->idat_size) + png_error(png_ptr, "save_size overflowed in pngpread"); + } + else + save_size = png_ptr->save_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size); + png_ptr->idat_size -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->save_buffer_size -= save_size; + png_ptr->save_buffer_ptr += save_size; + } + if (png_ptr->idat_size && png_ptr->current_buffer_size) + { + png_size_t save_size; + + if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size) + { + save_size = (png_size_t)png_ptr->idat_size; + /* check for overflow */ + if((png_uint_32)save_size != png_ptr->idat_size) + png_error(png_ptr, "save_size overflowed in pngpread"); + } + else + save_size = png_ptr->current_buffer_size; + + png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size); + + png_ptr->idat_size -= save_size; + png_ptr->buffer_size -= save_size; + png_ptr->current_buffer_size -= save_size; + png_ptr->current_buffer_ptr += save_size; + } + if (!png_ptr->idat_size) + { + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_crc_finish(png_ptr, 0); + png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; + png_ptr->mode |= PNG_AFTER_IDAT; + } +} + +void /* PRIVATE */ +png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, + png_size_t buffer_length) +{ + int ret; + + if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length) + png_error(png_ptr, "Extra compression data"); + + png_ptr->zstream.next_in = buffer; + png_ptr->zstream.avail_in = (uInt)buffer_length; + for(;;) + { + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret != Z_OK) + { + if (ret == Z_STREAM_END) + { + if (png_ptr->zstream.avail_in) + png_error(png_ptr, "Extra compressed data"); + if (!(png_ptr->zstream.avail_out)) + { + png_push_process_row(png_ptr); + } + + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + else if (ret == Z_BUF_ERROR) + break; + else + png_error(png_ptr, "Decompression Error"); + } + if (!(png_ptr->zstream.avail_out)) + { + if (( +#if defined(PNG_READ_INTERLACING_SUPPORTED) + png_ptr->interlaced && png_ptr->pass > 6) || + (!png_ptr->interlaced && +#endif + png_ptr->row_number == png_ptr->num_rows)) + { + if (png_ptr->zstream.avail_in) + png_warning(png_ptr, "Too much data in IDAT chunks"); + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + png_push_process_row(png_ptr); + png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; + png_ptr->zstream.next_out = png_ptr->row_buf; + } + else + break; + } +} + +void /* PRIVATE */ +png_push_process_row(png_structp png_ptr) +{ + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->iwidth; + png_ptr->row_info.channels = png_ptr->channels; + png_ptr->row_info.bit_depth = png_ptr->bit_depth; + png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; + + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + png_read_filter_row(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->prev_row + 1, + (int)(png_ptr->row_buf[0])); + + png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf, + png_ptr->rowbytes + 1); + + if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + png_do_read_transformations(png_ptr); + +#if defined(PNG_READ_INTERLACING_SUPPORTED) + /* blow up interlaced rows to full size */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + if (png_ptr->pass < 6) +/* old interface (pre-1.0.9): + png_do_read_interlace(&(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); + */ + png_do_read_interlace(png_ptr); + + switch (png_ptr->pass) + { + case 0: + { + int i; + for (i = 0; i < 8 && png_ptr->pass == 0; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */ + } + if (png_ptr->pass == 2) /* pass 1 might be empty */ + { + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + } + if (png_ptr->pass == 4 && png_ptr->height <= 4) + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + } + if (png_ptr->pass == 6 && png_ptr->height <= 4) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + break; + } + case 1: + { + int i; + for (i = 0; i < 8 && png_ptr->pass == 1; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + if (png_ptr->pass == 2) /* skip top 4 generated rows */ + { + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + } + break; + } + case 2: + { + int i; + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + for (i = 0; i < 4 && png_ptr->pass == 2; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + if (png_ptr->pass == 4) /* pass 3 might be empty */ + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + } + break; + } + case 3: + { + int i; + for (i = 0; i < 4 && png_ptr->pass == 3; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + if (png_ptr->pass == 4) /* skip top two generated rows */ + { + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + } + break; + } + case 4: + { + int i; + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + for (i = 0; i < 2 && png_ptr->pass == 4; i++) + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + if (png_ptr->pass == 6) /* pass 5 might be empty */ + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + break; + } + case 5: + { + int i; + for (i = 0; i < 2 && png_ptr->pass == 5; i++) + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } + if (png_ptr->pass == 6) /* skip top generated row */ + { + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + break; + } + case 6: + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + if (png_ptr->pass != 6) + break; + png_push_have_row(png_ptr, png_bytep_NULL); + png_read_push_finish_row(png_ptr); + } + } + } + else +#endif + { + png_push_have_row(png_ptr, png_ptr->row_buf + 1); + png_read_push_finish_row(png_ptr); + } +} + +void /* PRIVATE */ +png_read_push_finish_row(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + /* 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. This is not currently used - if you need + * it, uncomment it here and in png.h + const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; + */ + + /* 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}; + */ +#endif + + png_ptr->row_number++; + if (png_ptr->row_number < png_ptr->num_rows) + return; + + if (png_ptr->interlaced) + { + png_ptr->row_number = 0; + png_memset_check(png_ptr, png_ptr->prev_row, 0, + png_ptr->rowbytes + 1); + do + { + png_ptr->pass++; + if ((png_ptr->pass == 1 && png_ptr->width < 5) || + (png_ptr->pass == 3 && png_ptr->width < 3) || + (png_ptr->pass == 5 && png_ptr->width < 2)) + png_ptr->pass++; + + if (png_ptr->pass > 7) + png_ptr->pass--; + if (png_ptr->pass >= 7) + break; + + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + + png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; + + if (png_ptr->transformations & PNG_INTERLACE) + break; + + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[png_ptr->pass] - 1 - + png_pass_ystart[png_ptr->pass]) / + png_pass_yinc[png_ptr->pass]; + + } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); + } +} + +#if defined(PNG_READ_tEXt_SUPPORTED) +void /* PRIVATE */ +png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) + { + png_error(png_ptr, "Out of place tEXt"); + /* to quiet some compiler warnings */ + if(info_ptr == NULL) return; + } + +#ifdef PNG_MAX_MALLOC_64K + png_ptr->skip_length = 0; /* This may not be necessary */ + + if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ + { + png_warning(png_ptr, "tEXt chunk too large to fit in memory"); + png_ptr->skip_length = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_ptr->current_text = (png_charp)png_malloc(png_ptr, + (png_uint_32)(length+1)); + png_ptr->current_text[length] = '\0'; + png_ptr->current_text_ptr = png_ptr->current_text; + png_ptr->current_text_size = (png_size_t)length; + png_ptr->current_text_left = (png_size_t)length; + png_ptr->process_mode = PNG_READ_tEXt_MODE; +} + +void /* PRIVATE */ +png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->buffer_size && png_ptr->current_text_left) + { + png_size_t text_size; + + if (png_ptr->buffer_size < png_ptr->current_text_left) + text_size = png_ptr->buffer_size; + else + text_size = png_ptr->current_text_left; + png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); + png_ptr->current_text_left -= text_size; + png_ptr->current_text_ptr += text_size; + } + if (!(png_ptr->current_text_left)) + { + png_textp text_ptr; + png_charp text; + png_charp key; + int ret; + + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_crc_finish(png_ptr); + +#if defined(PNG_MAX_MALLOC_64K) + if (png_ptr->skip_length) + return; +#endif + + key = png_ptr->current_text; + + for (text = key; *text; text++) + /* empty loop */ ; + + if (text != key + png_ptr->current_text_size) + text++; + + text_ptr = (png_textp)png_malloc(png_ptr, + (png_uint_32)png_sizeof(png_text)); + text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr->key = key; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; +#endif + text_ptr->text = text; + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, key); + png_free(png_ptr, text_ptr); + png_ptr->current_text = NULL; + + if (ret) + png_warning(png_ptr, "Insufficient memory to store text chunk."); + } +} +#endif + +#if defined(PNG_READ_zTXt_SUPPORTED) +void /* PRIVATE */ +png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) + { + png_error(png_ptr, "Out of place zTXt"); + /* to quiet some compiler warnings */ + if(info_ptr == NULL) return; + } + +#ifdef PNG_MAX_MALLOC_64K + /* We can't handle zTXt chunks > 64K, since we don't have enough space + * to be able to store the uncompressed data. Actually, the threshold + * is probably around 32K, but it isn't as definite as 64K is. + */ + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "zTXt chunk too large to fit in memory"); + png_push_crc_skip(png_ptr, length); + return; + } +#endif + + png_ptr->current_text = (png_charp)png_malloc(png_ptr, + (png_uint_32)(length+1)); + png_ptr->current_text[length] = '\0'; + png_ptr->current_text_ptr = png_ptr->current_text; + png_ptr->current_text_size = (png_size_t)length; + png_ptr->current_text_left = (png_size_t)length; + png_ptr->process_mode = PNG_READ_zTXt_MODE; +} + +void /* PRIVATE */ +png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->buffer_size && png_ptr->current_text_left) + { + png_size_t text_size; + + if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left) + text_size = png_ptr->buffer_size; + else + text_size = png_ptr->current_text_left; + png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); + png_ptr->current_text_left -= text_size; + png_ptr->current_text_ptr += text_size; + } + if (!(png_ptr->current_text_left)) + { + png_textp text_ptr; + png_charp text; + png_charp key; + int ret; + png_size_t text_size, key_size; + + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_crc_finish(png_ptr); + + key = png_ptr->current_text; + + for (text = key; *text; text++) + /* empty loop */ ; + + /* zTXt can't have zero text */ + if (text == key + png_ptr->current_text_size) + { + png_ptr->current_text = NULL; + png_free(png_ptr, key); + return; + } + + text++; + + if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */ + { + png_ptr->current_text = NULL; + png_free(png_ptr, key); + return; + } + + text++; + + png_ptr->zstream.next_in = (png_bytep )text; + png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size - + (text - key)); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + key_size = text - key; + text_size = 0; + text = NULL; + ret = Z_STREAM_END; + + while (png_ptr->zstream.avail_in) + { + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret != Z_OK && ret != Z_STREAM_END) + { + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + png_ptr->current_text = NULL; + png_free(png_ptr, key); + png_free(png_ptr, text); + return; + } + if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END) + { + if (text == NULL) + { + text = (png_charp)png_malloc(png_ptr, + (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out + + key_size + 1)); + png_memcpy(text + key_size, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + png_memcpy(text, key, key_size); + text_size = key_size + png_ptr->zbuf_size - + png_ptr->zstream.avail_out; + *(text + text_size) = '\0'; + } + else + { + png_charp tmp; + + tmp = text; + text = (png_charp)png_malloc(png_ptr, text_size + + (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out + + 1)); + png_memcpy(text, tmp, text_size); + png_free(png_ptr, tmp); + png_memcpy(text + text_size, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; + *(text + text_size) = '\0'; + } + if (ret != Z_STREAM_END) + { + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + } + else + { + break; + } + + if (ret == Z_STREAM_END) + break; + } + + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + + if (ret != Z_STREAM_END) + { + png_ptr->current_text = NULL; + png_free(png_ptr, key); + png_free(png_ptr, text); + return; + } + + png_ptr->current_text = NULL; + png_free(png_ptr, key); + key = text; + text += key_size; + + text_ptr = (png_textp)png_malloc(png_ptr, + (png_uint_32)png_sizeof(png_text)); + text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt; + text_ptr->key = key; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; +#endif + text_ptr->text = text; + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, key); + png_free(png_ptr, text_ptr); + + if (ret) + png_warning(png_ptr, "Insufficient memory to store text chunk."); + } +} +#endif + +#if defined(PNG_READ_iTXt_SUPPORTED) +void /* PRIVATE */ +png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) + { + png_error(png_ptr, "Out of place iTXt"); + /* to quiet some compiler warnings */ + if(info_ptr == NULL) return; + } + +#ifdef PNG_MAX_MALLOC_64K + png_ptr->skip_length = 0; /* This may not be necessary */ + + if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ + { + png_warning(png_ptr, "iTXt chunk too large to fit in memory"); + png_ptr->skip_length = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_ptr->current_text = (png_charp)png_malloc(png_ptr, + (png_uint_32)(length+1)); + png_ptr->current_text[length] = '\0'; + png_ptr->current_text_ptr = png_ptr->current_text; + png_ptr->current_text_size = (png_size_t)length; + png_ptr->current_text_left = (png_size_t)length; + png_ptr->process_mode = PNG_READ_iTXt_MODE; +} + +void /* PRIVATE */ +png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr) +{ + + if (png_ptr->buffer_size && png_ptr->current_text_left) + { + png_size_t text_size; + + if (png_ptr->buffer_size < png_ptr->current_text_left) + text_size = png_ptr->buffer_size; + else + text_size = png_ptr->current_text_left; + png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); + png_ptr->current_text_left -= text_size; + png_ptr->current_text_ptr += text_size; + } + if (!(png_ptr->current_text_left)) + { + png_textp text_ptr; + png_charp key; + int comp_flag; + png_charp lang; + png_charp lang_key; + png_charp text; + int ret; + + if (png_ptr->buffer_size < 4) + { + png_push_save_buffer(png_ptr); + return; + } + + png_push_crc_finish(png_ptr); + +#if defined(PNG_MAX_MALLOC_64K) + if (png_ptr->skip_length) + return; +#endif + + key = png_ptr->current_text; + + for (lang = key; *lang; lang++) + /* empty loop */ ; + + if (lang != key + png_ptr->current_text_size) + lang++; + + comp_flag = *lang++; + lang++; /* skip comp_type, always zero */ + + for (lang_key = lang; *lang_key; lang_key++) + /* empty loop */ ; + lang_key++; /* skip NUL separator */ + + for (text = lang_key; *text; text++) + /* empty loop */ ; + + if (text != key + png_ptr->current_text_size) + text++; + + text_ptr = (png_textp)png_malloc(png_ptr, + (png_uint_32)png_sizeof(png_text)); + text_ptr->compression = comp_flag + 2; + text_ptr->key = key; + text_ptr->lang = lang; + text_ptr->lang_key = lang_key; + text_ptr->text = text; + text_ptr->text_length = 0; + text_ptr->itxt_length = png_strlen(text); + + ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_ptr->current_text = NULL; + + png_free(png_ptr, text_ptr); + if (ret) + png_warning(png_ptr, "Insufficient memory to store iTXt chunk."); + } +} +#endif + +/* This function is called when we haven't found a handler for this + * chunk. If there isn't a problem with the chunk itself (ie a bad chunk + * name or a critical chunk), the chunk is (currently) silently ignored. + */ +void /* PRIVATE */ +png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 + length) +{ + png_uint_32 skip=0; + png_check_chunk_name(png_ptr, png_ptr->chunk_name); + + if (!(png_ptr->chunk_name[0] & 0x20)) + { +#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) + if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS +#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) + && png_ptr->read_user_chunk_fn == NULL +#endif + ) +#endif + png_chunk_error(png_ptr, "unknown critical chunk"); + + /* to quiet compiler warnings about unused info_ptr */ + if (info_ptr == NULL) + return; + } + +#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) + if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) + { + png_unknown_chunk chunk; + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "unknown chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name); + chunk.data = (png_bytep)png_malloc(png_ptr, length); + png_crc_read(png_ptr, chunk.data, length); + chunk.size = length; +#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) + if(png_ptr->read_user_chunk_fn != NULL) + { + /* callback to user unknown chunk handler */ + if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0) + { + if (!(png_ptr->chunk_name[0] & 0x20)) + if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS) + png_chunk_error(png_ptr, "unknown critical chunk"); + } + png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1); + } + else +#endif + png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1); + png_free(png_ptr, chunk.data); + } + else +#endif + skip=length; + png_push_crc_skip(png_ptr, skip); +} + +void /* PRIVATE */ +png_push_have_info(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->info_fn != NULL) + (*(png_ptr->info_fn))(png_ptr, info_ptr); +} + +void /* PRIVATE */ +png_push_have_end(png_structp png_ptr, png_infop info_ptr) +{ + if (png_ptr->end_fn != NULL) + (*(png_ptr->end_fn))(png_ptr, info_ptr); +} + +void /* PRIVATE */ +png_push_have_row(png_structp png_ptr, png_bytep row) +{ + if (png_ptr->row_fn != NULL) + (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, + (int)png_ptr->pass); +} + +void PNGAPI +png_progressive_combine_row (png_structp png_ptr, + png_bytep old_row, png_bytep new_row) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + const int FARDATA png_pass_dsp_mask[7] = + {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; +#endif + if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */ + png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); +} + +void PNGAPI +png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, + png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, + png_progressive_end_ptr end_fn) +{ + png_ptr->info_fn = info_fn; + png_ptr->row_fn = row_fn; + png_ptr->end_fn = end_fn; + + png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); +} + +png_voidp PNGAPI +png_get_progressive_ptr(png_structp png_ptr) +{ + return png_ptr->io_ptr; +} +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ diff --git a/src/SFML/Graphics/libpng/pngread.c b/src/SFML/Graphics/libpng/pngread.c new file mode 100644 index 00000000..984fd164 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngread.c @@ -0,0 +1,1456 @@ + +/* pngread.c - read a PNG file + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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 contains routines that an application calls directly to + * read a PNG file or stream. + */ + +#define PNG_INTERNAL +#include "png.h" + +/* Create a PNG structure for reading, and allocate any memory needed. */ +png_structp PNGAPI +png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn) +{ + +#ifdef PNG_USER_MEM_SUPPORTED + return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn, + warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL)); +} + +/* Alternate create PNG structure for reading, and allocate any memory needed. */ +png_structp PNGAPI +png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + + png_structp png_ptr; + +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + jmp_buf jmpbuf; +#endif +#endif + + int i; + + png_debug(1, "in png_create_read_struct\n"); +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, + (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); +#else + png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); +#endif + if (png_ptr == NULL) + return (NULL); + +#if !defined(PNG_1_0_X) +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED + png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ +#endif +#endif /* PNG_1_0_X */ + + /* added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_ptr->user_width_max=PNG_USER_WIDTH_MAX; + png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; +#endif + +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) +#else + if (setjmp(png_ptr->jmpbuf)) +#endif + { + png_free(png_ptr, png_ptr->zbuf); + png_ptr->zbuf=NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, + (png_free_ptr)free_fn, (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + return (NULL); + } +#ifdef USE_FAR_KEYWORD + png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); +#endif +#endif + +#ifdef PNG_USER_MEM_SUPPORTED + png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); +#endif + + png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); + + i=0; + do + { + if(user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + + if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) + { + /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so + * we must recompile any applications that use any older library version. + * For versions after libpng 1.0, we will be compatible, so we need + * only check the first digit. + */ + if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || + (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || + (user_png_ver[0] == '0' && user_png_ver[2] < '9')) + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char msg[80]; + if (user_png_ver) + { + sprintf(msg, "Application was compiled with png.h from libpng-%.20s", + user_png_ver); + png_warning(png_ptr, msg); + } + sprintf(msg, "Application is running with png.c from libpng-%.20s", + png_libpng_ver); + png_warning(png_ptr, msg); +#endif +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags=0; +#endif + png_error(png_ptr, + "Incompatible libpng version in application and library"); + } + } + + /* initialize zbuf - compression buffer */ + png_ptr->zbuf_size = PNG_ZBUF_SIZE; + png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, + (png_uint_32)png_ptr->zbuf_size); + png_ptr->zstream.zalloc = png_zalloc; + png_ptr->zstream.zfree = png_zfree; + png_ptr->zstream.opaque = (voidpf)png_ptr; + + switch (inflateInit(&png_ptr->zstream)) + { + case Z_OK: /* Do nothing */ break; + case Z_MEM_ERROR: + case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break; + case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); break; + default: png_error(png_ptr, "Unknown zlib error"); + } + + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL); + +#ifdef PNG_SETJMP_SUPPORTED +/* Applications that neglect to set up their own setjmp() and then encounter + a png_error() will longjmp here. Since the jmpbuf is then meaningless we + abort instead of returning. */ +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) + PNG_ABORT(); + png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); +#else + if (setjmp(png_ptr->jmpbuf)) + PNG_ABORT(); +#endif +#endif + return (png_ptr); +} + +/* Initialize PNG structure for reading, and allocate any memory needed. + This interface is deprecated in favour of the png_create_read_struct(), + and it will eventually disappear. */ +#if defined(PNG_1_0_X) || defined (PNG_1_2_X) +#undef png_read_init +void PNGAPI +png_read_init(png_structp png_ptr) +{ + /* We only come here via pre-1.0.7-compiled applications */ + png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0); +} +#endif + +void PNGAPI +png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver, + png_size_t png_struct_size, png_size_t png_info_size) +{ + /* We only come here via pre-1.0.12-compiled applications */ +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + if(png_sizeof(png_struct) > png_struct_size || + png_sizeof(png_info) > png_info_size) + { + char msg[80]; + png_ptr->warning_fn=NULL; + if (user_png_ver) + { + sprintf(msg, "Application was compiled with png.h from libpng-%.20s", + user_png_ver); + png_warning(png_ptr, msg); + } + sprintf(msg, "Application is running with png.c from libpng-%.20s", + png_libpng_ver); + png_warning(png_ptr, msg); + } +#endif + if(png_sizeof(png_struct) > png_struct_size) + { + png_ptr->error_fn=NULL; +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags=0; +#endif + png_error(png_ptr, + "The png struct allocated by the application for reading is too small."); + } + if(png_sizeof(png_info) > png_info_size) + { + png_ptr->error_fn=NULL; +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags=0; +#endif + png_error(png_ptr, + "The info struct allocated by application for reading is too small."); + } + png_read_init_3(&png_ptr, user_png_ver, png_struct_size); +} + +void PNGAPI +png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, + png_size_t png_struct_size) +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf tmp_jmp; /* to save current jump buffer */ +#endif + + int i=0; + + png_structp png_ptr=*ptr_ptr; + + do + { + if(user_png_ver[i] != png_libpng_ver[i]) + { +#ifdef PNG_LEGACY_SUPPORTED + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; +#else + png_ptr->warning_fn=NULL; + png_warning(png_ptr, + "Application uses deprecated png_read_init() and should be recompiled."); + break; +#endif + } + } while (png_libpng_ver[i++]); + + png_debug(1, "in png_read_init_3\n"); + +#ifdef PNG_SETJMP_SUPPORTED + /* save jump buffer and error functions */ + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); +#endif + + if(png_sizeof(png_struct) > png_struct_size) + { + png_destroy_struct(png_ptr); + *ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); + png_ptr = *ptr_ptr; + } + + /* reset all variables to 0 */ + png_memset(png_ptr, 0, png_sizeof (png_struct)); + +#ifdef PNG_SETJMP_SUPPORTED + /* restore jump buffer */ + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); +#endif + + /* added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_ptr->user_width_max=PNG_USER_WIDTH_MAX; + png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; +#endif + + /* initialize zbuf - compression buffer */ + png_ptr->zbuf_size = PNG_ZBUF_SIZE; + png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, + (png_uint_32)png_ptr->zbuf_size); + png_ptr->zstream.zalloc = png_zalloc; + png_ptr->zstream.zfree = png_zfree; + png_ptr->zstream.opaque = (voidpf)png_ptr; + + switch (inflateInit(&png_ptr->zstream)) + { + case Z_OK: /* Do nothing */ break; + case Z_MEM_ERROR: + case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory"); break; + case Z_VERSION_ERROR: png_error(png_ptr, "zlib version"); break; + default: png_error(png_ptr, "Unknown zlib error"); + } + + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL); +} + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* Read the information before the actual image data. This has been + * changed in v0.90 to allow reading a file that already has the magic + * bytes read from the stream. You can tell libpng how many bytes have + * been read from the beginning of the stream (up to the maximum of 8) + * via png_set_sig_bytes(), and we will only check the remaining bytes + * here. The application can then have access to the signature bytes we + * read if it is determined that this isn't a valid PNG file. + */ +void PNGAPI +png_read_info(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_info\n"); + /* If we haven't checked all of the PNG signature bytes, do so now. */ + if (png_ptr->sig_bytes < 8) + { + png_size_t num_checked = png_ptr->sig_bytes, + num_to_check = 8 - num_checked; + + png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check); + png_ptr->sig_bytes = 8; + + if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) + { + if (num_checked < 4 && + png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + png_error(png_ptr, "Not a PNG file"); + else + png_error(png_ptr, "PNG file corrupted by ASCII conversion"); + } + if (num_checked < 3) + png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; + } + + for(;;) + { +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IHDR; + PNG_IDAT; + PNG_IEND; + PNG_PLTE; +#if defined(PNG_READ_bKGD_SUPPORTED) + PNG_bKGD; +#endif +#if defined(PNG_READ_cHRM_SUPPORTED) + PNG_cHRM; +#endif +#if defined(PNG_READ_gAMA_SUPPORTED) + PNG_gAMA; +#endif +#if defined(PNG_READ_hIST_SUPPORTED) + PNG_hIST; +#endif +#if defined(PNG_READ_iCCP_SUPPORTED) + PNG_iCCP; +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + PNG_iTXt; +#endif +#if defined(PNG_READ_oFFs_SUPPORTED) + PNG_oFFs; +#endif +#if defined(PNG_READ_pCAL_SUPPORTED) + PNG_pCAL; +#endif +#if defined(PNG_READ_pHYs_SUPPORTED) + PNG_pHYs; +#endif +#if defined(PNG_READ_sBIT_SUPPORTED) + PNG_sBIT; +#endif +#if defined(PNG_READ_sCAL_SUPPORTED) + PNG_sCAL; +#endif +#if defined(PNG_READ_sPLT_SUPPORTED) + PNG_sPLT; +#endif +#if defined(PNG_READ_sRGB_SUPPORTED) + PNG_sRGB; +#endif +#if defined(PNG_READ_tEXt_SUPPORTED) + PNG_tEXt; +#endif +#if defined(PNG_READ_tIME_SUPPORTED) + PNG_tIME; +#endif +#if defined(PNG_READ_tRNS_SUPPORTED) + PNG_tRNS; +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + PNG_zTXt; +#endif +#endif /* PNG_USE_LOCAL_ARRAYS */ + png_byte chunk_length[4]; + png_uint_32 length; + + png_read_data(png_ptr, chunk_length, 4); + length = png_get_uint_31(png_ptr,chunk_length); + + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + + png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name, + length); + + /* This should be a binary subdivision search or a hash for + * matching the chunk name rather than a linear search. + */ + if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) + png_handle_IHDR(png_ptr, info_ptr, length); + else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) + png_handle_IEND(png_ptr, info_ptr, length); +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) + { + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + png_ptr->mode |= PNG_HAVE_IDAT; + png_handle_unknown(png_ptr, info_ptr, length); + if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + png_ptr->mode |= PNG_HAVE_PLTE; + else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + break; + } + } +#endif + else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + png_handle_PLTE(png_ptr, info_ptr, length); + else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before IDAT"); + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + png_error(png_ptr, "Missing PLTE before IDAT"); + + png_ptr->idat_size = length; + png_ptr->mode |= PNG_HAVE_IDAT; + break; + } +#if defined(PNG_READ_bKGD_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) + png_handle_bKGD(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_cHRM_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) + png_handle_cHRM(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_gAMA_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) + png_handle_gAMA(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_hIST_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) + png_handle_hIST(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_oFFs_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) + png_handle_oFFs(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_pCAL_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) + png_handle_pCAL(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sCAL_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) + png_handle_sCAL(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_pHYs_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) + png_handle_pHYs(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sBIT_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) + png_handle_sBIT(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sRGB_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) + png_handle_sRGB(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_iCCP_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) + png_handle_iCCP(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sPLT_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) + png_handle_sPLT(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_tEXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) + png_handle_tEXt(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_tIME_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) + png_handle_tIME(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_tRNS_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) + png_handle_tRNS(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) + png_handle_zTXt(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) + png_handle_iTXt(png_ptr, info_ptr, length); +#endif + else + png_handle_unknown(png_ptr, info_ptr, length); + } +} +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ + +/* optional call to update the users info_ptr structure */ +void PNGAPI +png_read_update_info(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_update_info\n"); + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + png_read_start_row(png_ptr); + else + png_warning(png_ptr, + "Ignoring extra png_read_update_info() call; row buffer not reallocated"); + png_read_transform_info(png_ptr, info_ptr); +} + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* Initialize palette, background, etc, after transformations + * are set, but before any reading takes place. This allows + * the user to obtain a gamma-corrected palette, for example. + * If the user doesn't call this, we will do it ourselves. + */ +void PNGAPI +png_start_read_image(png_structp png_ptr) +{ + png_debug(1, "in png_start_read_image\n"); + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + png_read_start_row(png_ptr); +} +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +void PNGAPI +png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IDAT; + const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; + const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; +#endif + int ret; + png_debug2(1, "in png_read_row (row %lu, pass %d)\n", + png_ptr->row_number, png_ptr->pass); + if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) + png_read_start_row(png_ptr); + if (png_ptr->row_number == 0 && png_ptr->pass == 0) + { + /* check for transforms that have been set but were defined out */ +#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_MONO) + png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined."); +#endif +#if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED) + if (png_ptr->transformations & PNG_FILLER) + png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined."); +#endif +#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && !defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined."); +#endif +#if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED) + if (png_ptr->transformations & PNG_PACK) + png_warning(png_ptr, "PNG_READ_PACK_SUPPORTED is not defined."); +#endif +#if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) + if (png_ptr->transformations & PNG_SHIFT) + png_warning(png_ptr, "PNG_READ_SHIFT_SUPPORTED is not defined."); +#endif +#if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED) + if (png_ptr->transformations & PNG_BGR) + png_warning(png_ptr, "PNG_READ_BGR_SUPPORTED is not defined."); +#endif +#if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED) + if (png_ptr->transformations & PNG_SWAP_BYTES) + png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined."); +#endif + } + +#if defined(PNG_READ_INTERLACING_SUPPORTED) + /* if interlaced and we do not need a new row, combine row and return */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + switch (png_ptr->pass) + { + case 0: + if (png_ptr->row_number & 0x07) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 1: + if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 2: + if ((png_ptr->row_number & 0x07) != 4) + { + if (dsp_row != NULL && (png_ptr->row_number & 4)) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 3: + if ((png_ptr->row_number & 3) || png_ptr->width < 3) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 4: + if ((png_ptr->row_number & 3) != 2) + { + if (dsp_row != NULL && (png_ptr->row_number & 2)) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 5: + if ((png_ptr->row_number & 1) || png_ptr->width < 2) + { + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + png_read_finish_row(png_ptr); + return; + } + break; + case 6: + if (!(png_ptr->row_number & 1)) + { + png_read_finish_row(png_ptr); + return; + } + break; + } + } +#endif + + if (!(png_ptr->mode & PNG_HAVE_IDAT)) + png_error(png_ptr, "Invalid attempt to read row data"); + + png_ptr->zstream.next_out = png_ptr->row_buf; + png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; + do + { + if (!(png_ptr->zstream.avail_in)) + { + while (!png_ptr->idat_size) + { + png_byte chunk_length[4]; + + png_crc_finish(png_ptr, 0); + + png_read_data(png_ptr, chunk_length, 4); + png_ptr->idat_size = png_get_uint_31(png_ptr,chunk_length); + + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + png_error(png_ptr, "Not enough image data"); + } + png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_in = png_ptr->zbuf; + if (png_ptr->zbuf_size > png_ptr->idat_size) + png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size; + png_crc_read(png_ptr, png_ptr->zbuf, + (png_size_t)png_ptr->zstream.avail_in); + png_ptr->idat_size -= png_ptr->zstream.avail_in; + } + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret == Z_STREAM_END) + { + if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in || + png_ptr->idat_size) + png_error(png_ptr, "Extra compressed data"); + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + if (ret != Z_OK) + png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + "Decompression error"); + + } while (png_ptr->zstream.avail_out); + + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->iwidth; + png_ptr->row_info.channels = png_ptr->channels; + png_ptr->row_info.bit_depth = png_ptr->bit_depth; + png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + if(png_ptr->row_buf[0]) + png_read_filter_row(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->prev_row + 1, + (int)(png_ptr->row_buf[0])); + + png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf, + png_ptr->rowbytes + 1); + +#if defined(PNG_MNG_FEATURES_SUPPORTED) + if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) + { + /* Intrapixel differencing */ + png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); + } +#endif + + + if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) + png_do_read_transformations(png_ptr); + +#if defined(PNG_READ_INTERLACING_SUPPORTED) + /* blow up interlaced rows to full size */ + if (png_ptr->interlaced && + (png_ptr->transformations & PNG_INTERLACE)) + { + if (png_ptr->pass < 6) +/* old interface (pre-1.0.9): + png_do_read_interlace(&(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); + */ + png_do_read_interlace(png_ptr); + + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, + png_pass_dsp_mask[png_ptr->pass]); + if (row != NULL) + png_combine_row(png_ptr, row, + png_pass_mask[png_ptr->pass]); + } + else +#endif + { + if (row != NULL) + png_combine_row(png_ptr, row, 0xff); + if (dsp_row != NULL) + png_combine_row(png_ptr, dsp_row, 0xff); + } + png_read_finish_row(png_ptr); + + if (png_ptr->read_row_fn != NULL) + (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); +} +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* Read one or more rows of image data. If the image is interlaced, + * and png_set_interlace_handling() has been called, the rows need to + * contain the contents of the rows from the previous pass. If the + * image has alpha or transparency, and png_handle_alpha()[*] has been + * called, the rows contents must be initialized to the contents of the + * screen. + * + * "row" holds the actual image, and pixels are placed in it + * as they arrive. If the image is displayed after each pass, it will + * appear to "sparkle" in. "display_row" can be used to display a + * "chunky" progressive image, with finer detail added as it becomes + * available. If you do not want this "chunky" display, you may pass + * NULL for display_row. If you do not want the sparkle display, and + * you have not called png_handle_alpha(), you may pass NULL for rows. + * If you have called png_handle_alpha(), and the image has either an + * alpha channel or a transparency chunk, you must provide a buffer for + * rows. In this case, you do not have to provide a display_row buffer + * also, but you may. If the image is not interlaced, or if you have + * not called png_set_interlace_handling(), the display_row buffer will + * be ignored, so pass NULL to it. + * + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.8 + */ + +void PNGAPI +png_read_rows(png_structp png_ptr, png_bytepp row, + png_bytepp display_row, png_uint_32 num_rows) +{ + png_uint_32 i; + png_bytepp rp; + png_bytepp dp; + + png_debug(1, "in png_read_rows\n"); + rp = row; + dp = display_row; + if (rp != NULL && dp != NULL) + for (i = 0; i < num_rows; i++) + { + png_bytep rptr = *rp++; + png_bytep dptr = *dp++; + + png_read_row(png_ptr, rptr, dptr); + } + else if(rp != NULL) + for (i = 0; i < num_rows; i++) + { + png_bytep rptr = *rp; + png_read_row(png_ptr, rptr, png_bytep_NULL); + rp++; + } + else if(dp != NULL) + for (i = 0; i < num_rows; i++) + { + png_bytep dptr = *dp; + png_read_row(png_ptr, png_bytep_NULL, dptr); + dp++; + } +} +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* Read the entire image. If the image has an alpha channel or a tRNS + * chunk, and you have called png_handle_alpha()[*], you will need to + * initialize the image to the current image that PNG will be overlaying. + * We set the num_rows again here, in case it was incorrectly set in + * png_read_start_row() by a call to png_read_update_info() or + * png_start_read_image() if png_set_interlace_handling() wasn't called + * prior to either of these functions like it should have been. You can + * only call this function once. If you desire to have an image for + * each pass of a interlaced image, use png_read_rows() instead. + * + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.8 + */ +void PNGAPI +png_read_image(png_structp png_ptr, png_bytepp image) +{ + png_uint_32 i,image_height; + int pass, j; + png_bytepp rp; + + png_debug(1, "in png_read_image\n"); + +#ifdef PNG_READ_INTERLACING_SUPPORTED + pass = png_set_interlace_handling(png_ptr); +#else + if (png_ptr->interlaced) + png_error(png_ptr, + "Cannot read interlaced image -- interlace handler disabled."); + pass = 1; +#endif + + + image_height=png_ptr->height; + png_ptr->num_rows = image_height; /* Make sure this is set correctly */ + + for (j = 0; j < pass; j++) + { + rp = image; + for (i = 0; i < image_height; i++) + { + png_read_row(png_ptr, *rp, png_bytep_NULL); + rp++; + } + } +} +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +/* Read the end of the PNG file. Will not read past the end of the + * file, will verify the end is accurate, and will read any comments + * or time information at the end of the file, if info is not NULL. + */ +void PNGAPI +png_read_end(png_structp png_ptr, png_infop info_ptr) +{ + png_byte chunk_length[4]; + png_uint_32 length; + + png_debug(1, "in png_read_end\n"); + png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ + + do + { +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IHDR; + PNG_IDAT; + PNG_IEND; + PNG_PLTE; +#if defined(PNG_READ_bKGD_SUPPORTED) + PNG_bKGD; +#endif +#if defined(PNG_READ_cHRM_SUPPORTED) + PNG_cHRM; +#endif +#if defined(PNG_READ_gAMA_SUPPORTED) + PNG_gAMA; +#endif +#if defined(PNG_READ_hIST_SUPPORTED) + PNG_hIST; +#endif +#if defined(PNG_READ_iCCP_SUPPORTED) + PNG_iCCP; +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + PNG_iTXt; +#endif +#if defined(PNG_READ_oFFs_SUPPORTED) + PNG_oFFs; +#endif +#if defined(PNG_READ_pCAL_SUPPORTED) + PNG_pCAL; +#endif +#if defined(PNG_READ_pHYs_SUPPORTED) + PNG_pHYs; +#endif +#if defined(PNG_READ_sBIT_SUPPORTED) + PNG_sBIT; +#endif +#if defined(PNG_READ_sCAL_SUPPORTED) + PNG_sCAL; +#endif +#if defined(PNG_READ_sPLT_SUPPORTED) + PNG_sPLT; +#endif +#if defined(PNG_READ_sRGB_SUPPORTED) + PNG_sRGB; +#endif +#if defined(PNG_READ_tEXt_SUPPORTED) + PNG_tEXt; +#endif +#if defined(PNG_READ_tIME_SUPPORTED) + PNG_tIME; +#endif +#if defined(PNG_READ_tRNS_SUPPORTED) + PNG_tRNS; +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + PNG_zTXt; +#endif +#endif /* PNG_USE_LOCAL_ARRAYS */ + + png_read_data(png_ptr, chunk_length, 4); + length = png_get_uint_31(png_ptr,chunk_length); + + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + + png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name); + + if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) + png_handle_IHDR(png_ptr, info_ptr, length); + else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) + png_handle_IEND(png_ptr, info_ptr, length); +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED + else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) + { + if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + if (length > 0 || png_ptr->mode & PNG_AFTER_IDAT) + png_error(png_ptr, "Too many IDAT's found"); + } + else + png_ptr->mode |= PNG_AFTER_IDAT; + png_handle_unknown(png_ptr, info_ptr, length); + if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + png_ptr->mode |= PNG_HAVE_PLTE; + } +#endif + else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) + { + /* Zero length IDATs are legal after the last IDAT has been + * read, but not after other chunks have been read. + */ + if (length > 0 || png_ptr->mode & PNG_AFTER_IDAT) + png_error(png_ptr, "Too many IDAT's found"); + png_crc_finish(png_ptr, length); + } + else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) + png_handle_PLTE(png_ptr, info_ptr, length); +#if defined(PNG_READ_bKGD_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) + png_handle_bKGD(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_cHRM_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) + png_handle_cHRM(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_gAMA_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) + png_handle_gAMA(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_hIST_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) + png_handle_hIST(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_oFFs_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) + png_handle_oFFs(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_pCAL_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) + png_handle_pCAL(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sCAL_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) + png_handle_sCAL(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_pHYs_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) + png_handle_pHYs(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sBIT_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) + png_handle_sBIT(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sRGB_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) + png_handle_sRGB(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_iCCP_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) + png_handle_iCCP(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_sPLT_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) + png_handle_sPLT(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_tEXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) + png_handle_tEXt(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_tIME_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) + png_handle_tIME(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_tRNS_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) + png_handle_tRNS(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_zTXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) + png_handle_zTXt(png_ptr, info_ptr, length); +#endif +#if defined(PNG_READ_iTXt_SUPPORTED) + else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) + png_handle_iTXt(png_ptr, info_ptr, length); +#endif + else + png_handle_unknown(png_ptr, info_ptr, length); + } while (!(png_ptr->mode & PNG_HAVE_IEND)); +} +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ + +/* free all memory used by the read */ +void PNGAPI +png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, + png_infopp end_info_ptr_ptr) +{ + png_structp png_ptr = NULL; + png_infop info_ptr = NULL, end_info_ptr = NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn; + png_voidp mem_ptr; +#endif + + png_debug(1, "in png_destroy_read_struct\n"); + if (png_ptr_ptr != NULL) + png_ptr = *png_ptr_ptr; + + if (info_ptr_ptr != NULL) + info_ptr = *info_ptr_ptr; + + if (end_info_ptr_ptr != NULL) + end_info_ptr = *end_info_ptr_ptr; + +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; +#endif + + png_read_destroy(png_ptr, info_ptr, end_info_ptr); + + if (info_ptr != NULL) + { +#if defined(PNG_TEXT_SUPPORTED) + png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1); +#endif + +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)info_ptr); +#endif + *info_ptr_ptr = NULL; + } + + if (end_info_ptr != NULL) + { +#if defined(PNG_READ_TEXT_SUPPORTED) + png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1); +#endif +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)end_info_ptr); +#endif + *end_info_ptr_ptr = NULL; + } + + if (png_ptr != NULL) + { +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + *png_ptr_ptr = NULL; + } +} + +/* free all memory used by the read (old method) */ +void /* PRIVATE */ +png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf tmp_jmp; +#endif + png_error_ptr error_fn; + png_error_ptr warning_fn; + png_voidp error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn; +#endif + + png_debug(1, "in png_read_destroy\n"); + if (info_ptr != NULL) + png_info_destroy(png_ptr, info_ptr); + + if (end_info_ptr != NULL) + png_info_destroy(png_ptr, end_info_ptr); + + png_free(png_ptr, png_ptr->zbuf); + png_free(png_ptr, png_ptr->big_row_buf); + png_free(png_ptr, png_ptr->prev_row); +#if defined(PNG_READ_DITHER_SUPPORTED) + png_free(png_ptr, png_ptr->palette_lookup); + png_free(png_ptr, png_ptr->dither_index); +#endif +#if defined(PNG_READ_GAMMA_SUPPORTED) + png_free(png_ptr, png_ptr->gamma_table); +#endif +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + png_free(png_ptr, png_ptr->gamma_from_1); + png_free(png_ptr, png_ptr->gamma_to_1); +#endif +#ifdef PNG_FREE_ME_SUPPORTED + if (png_ptr->free_me & PNG_FREE_PLTE) + png_zfree(png_ptr, png_ptr->palette); + png_ptr->free_me &= ~PNG_FREE_PLTE; +#else + if (png_ptr->flags & PNG_FLAG_FREE_PLTE) + png_zfree(png_ptr, png_ptr->palette); + png_ptr->flags &= ~PNG_FLAG_FREE_PLTE; +#endif +#if defined(PNG_tRNS_SUPPORTED) || \ + defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) +#ifdef PNG_FREE_ME_SUPPORTED + if (png_ptr->free_me & PNG_FREE_TRNS) + png_free(png_ptr, png_ptr->trans); + png_ptr->free_me &= ~PNG_FREE_TRNS; +#else + if (png_ptr->flags & PNG_FLAG_FREE_TRNS) + png_free(png_ptr, png_ptr->trans); + png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; +#endif +#endif +#if defined(PNG_READ_hIST_SUPPORTED) +#ifdef PNG_FREE_ME_SUPPORTED + if (png_ptr->free_me & PNG_FREE_HIST) + png_free(png_ptr, png_ptr->hist); + png_ptr->free_me &= ~PNG_FREE_HIST; +#else + if (png_ptr->flags & PNG_FLAG_FREE_HIST) + png_free(png_ptr, png_ptr->hist); + png_ptr->flags &= ~PNG_FLAG_FREE_HIST; +#endif +#endif +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (png_ptr->gamma_16_table != NULL) + { + int i; + int istop = (1 << (8 - png_ptr->gamma_shift)); + for (i = 0; i < istop; i++) + { + png_free(png_ptr, png_ptr->gamma_16_table[i]); + } + png_free(png_ptr, png_ptr->gamma_16_table); + } +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_16_from_1 != NULL) + { + int i; + int istop = (1 << (8 - png_ptr->gamma_shift)); + for (i = 0; i < istop; i++) + { + png_free(png_ptr, png_ptr->gamma_16_from_1[i]); + } + png_free(png_ptr, png_ptr->gamma_16_from_1); + } + if (png_ptr->gamma_16_to_1 != NULL) + { + int i; + int istop = (1 << (8 - png_ptr->gamma_shift)); + for (i = 0; i < istop; i++) + { + png_free(png_ptr, png_ptr->gamma_16_to_1[i]); + } + png_free(png_ptr, png_ptr->gamma_16_to_1); + } +#endif +#endif +#if defined(PNG_TIME_RFC1123_SUPPORTED) + png_free(png_ptr, png_ptr->time_buffer); +#endif + + inflateEnd(&png_ptr->zstream); +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED + png_free(png_ptr, png_ptr->save_buffer); +#endif + +#ifdef PNG_PROGRESSIVE_READ_SUPPORTED +#ifdef PNG_TEXT_SUPPORTED + png_free(png_ptr, png_ptr->current_text); +#endif /* PNG_TEXT_SUPPORTED */ +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ + + /* Save the important info out of the png_struct, in case it is + * being used again. + */ +#ifdef PNG_SETJMP_SUPPORTED + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); +#endif + + error_fn = png_ptr->error_fn; + warning_fn = png_ptr->warning_fn; + error_ptr = png_ptr->error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; +#endif + + png_memset(png_ptr, 0, png_sizeof (png_struct)); + + png_ptr->error_fn = error_fn; + png_ptr->warning_fn = warning_fn; + png_ptr->error_ptr = error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr->free_fn = free_fn; +#endif + +#ifdef PNG_SETJMP_SUPPORTED + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); +#endif + +} + +void PNGAPI +png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) +{ + png_ptr->read_row_fn = read_row_fn; +} + + +#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED +#if defined(PNG_INFO_IMAGE_SUPPORTED) +void PNGAPI +png_read_png(png_structp png_ptr, png_infop info_ptr, + int transforms, + voidp params) +{ + int row; + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) + /* invert the alpha channel from opacity to transparency + */ + if (transforms & PNG_TRANSFORM_INVERT_ALPHA) + png_set_invert_alpha(png_ptr); +#endif + + /* png_read_info() gives us all of the information from the + * PNG file before the first IDAT (image data chunk). + */ + png_read_info(png_ptr, info_ptr); + if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) + png_error(png_ptr,"Image is too high to process with png_read_png()"); + + /* -------------- image transformations start here ------------------- */ + +#if defined(PNG_READ_16_TO_8_SUPPORTED) + /* tell libpng to strip 16 bit/color files down to 8 bits per color + */ + if (transforms & PNG_TRANSFORM_STRIP_16) + png_set_strip_16(png_ptr); +#endif + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) + /* Strip alpha bytes from the input data without combining with + * the background (not recommended). + */ + if (transforms & PNG_TRANSFORM_STRIP_ALPHA) + png_set_strip_alpha(png_ptr); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED) + /* Extract multiple pixels with bit depths of 1, 2, or 4 from a single + * byte into separate bytes (useful for paletted and grayscale images). + */ + if (transforms & PNG_TRANSFORM_PACKING) + png_set_packing(png_ptr); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + /* Change the order of packed pixels to least significant bit first + * (not useful if you are using png_set_packing). + */ + if (transforms & PNG_TRANSFORM_PACKSWAP) + png_set_packswap(png_ptr); +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) + /* Expand paletted colors into true RGB triplets + * Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel + * Expand paletted or RGB images with transparency to full alpha + * channels so the data will be available as RGBA quartets. + */ + if (transforms & PNG_TRANSFORM_EXPAND) + if ((png_ptr->bit_depth < 8) || + (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) || + (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) + png_set_expand(png_ptr); +#endif + + /* We don't handle background color or gamma transformation or dithering. + */ + +#if defined(PNG_READ_INVERT_SUPPORTED) + /* invert monochrome files to have 0 as white and 1 as black + */ + if (transforms & PNG_TRANSFORM_INVERT_MONO) + png_set_invert_mono(png_ptr); +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) + /* If you want to shift the pixel values from the range [0,255] or + * [0,65535] to the original [0,7] or [0,31], or whatever range the + * colors were originally in: + */ + if ((transforms & PNG_TRANSFORM_SHIFT) + && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) + { + png_color_8p sig_bit; + + png_get_sBIT(png_ptr, info_ptr, &sig_bit); + png_set_shift(png_ptr, sig_bit); + } +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) + /* flip the RGB pixels to BGR (or RGBA to BGRA) + */ + if (transforms & PNG_TRANSFORM_BGR) + png_set_bgr(png_ptr); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) + /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) + */ + if (transforms & PNG_TRANSFORM_SWAP_ALPHA) + png_set_swap_alpha(png_ptr); +#endif + +#if defined(PNG_READ_SWAP_SUPPORTED) + /* swap bytes of 16 bit files to least significant byte first + */ + if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) + png_set_swap(png_ptr); +#endif + + /* We don't handle adding filler bytes */ + + /* Optional call to gamma correct and add the background to the palette + * and update info structure. REQUIRED if you are expecting libpng to + * update the palette for you (i.e., you selected such a transform above). + */ + png_read_update_info(png_ptr, info_ptr); + + /* -------------- image transformations end here ------------------- */ + +#ifdef PNG_FREE_ME_SUPPORTED + png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); +#endif + if(info_ptr->row_pointers == NULL) + { + info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, + info_ptr->height * png_sizeof(png_bytep)); +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_ROWS; +#endif + for (row = 0; row < (int)info_ptr->height; row++) + { + info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, + png_get_rowbytes(png_ptr, info_ptr)); + } + } + + png_read_image(png_ptr, info_ptr->row_pointers); + info_ptr->valid |= PNG_INFO_IDAT; + + /* read rest of file, and get additional chunks in info_ptr - REQUIRED */ + png_read_end(png_ptr, info_ptr); + + if(transforms == 0 || params == NULL) + /* quiet compiler warnings */ return; + +} +#endif +#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ diff --git a/src/SFML/Graphics/libpng/pngrio.c b/src/SFML/Graphics/libpng/pngrio.c new file mode 100644 index 00000000..241fcdce --- /dev/null +++ b/src/SFML/Graphics/libpng/pngrio.c @@ -0,0 +1,161 @@ + +/* pngrio.c - functions for data input + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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" + +/* 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 /* PRIVATE */ +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 +} diff --git a/src/SFML/Graphics/libpng/pngrtran.c b/src/SFML/Graphics/libpng/pngrtran.c new file mode 100644 index 00000000..2f0f31af --- /dev/null +++ b/src/SFML/Graphics/libpng/pngrtran.c @@ -0,0 +1,4177 @@ + +/* pngrtran.c - transforms the data in a row for PNG readers + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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 contains functions optionally called by an application + * in order to tell libpng how to handle data when reading a PNG. + * Transformations that are used in both reading and writing are + * in pngtrans.c. + */ + +#define PNG_INTERNAL +#include "png.h" + +/* Set the action on getting a CRC error for an ancillary or critical chunk. */ +void PNGAPI +png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) +{ + png_debug(1, "in png_set_crc_action\n"); + /* Tell libpng how we react to CRC errors in critical chunks */ + switch (crit_action) + { + case PNG_CRC_NO_CHANGE: /* leave setting as is */ + break; + case PNG_CRC_WARN_USE: /* warn/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE; + break; + case PNG_CRC_QUIET_USE: /* quiet/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE | + PNG_FLAG_CRC_CRITICAL_IGNORE; + break; + case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */ + png_warning(png_ptr, "Can't discard critical data on CRC error."); + case PNG_CRC_ERROR_QUIT: /* error/quit */ + case PNG_CRC_DEFAULT: + default: + png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; + break; + } + + switch (ancil_action) + { + case PNG_CRC_NO_CHANGE: /* leave setting as is */ + break; + case PNG_CRC_WARN_USE: /* warn/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE; + break; + case PNG_CRC_QUIET_USE: /* quiet/use data */ + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE | + PNG_FLAG_CRC_ANCILLARY_NOWARN; + break; + case PNG_CRC_ERROR_QUIT: /* error/quit */ + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN; + break; + case PNG_CRC_WARN_DISCARD: /* warn/discard data */ + case PNG_CRC_DEFAULT: + default: + png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; + break; + } +} + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +/* handle alpha and tRNS via a background color */ +void PNGAPI +png_set_background(png_structp png_ptr, + png_color_16p background_color, int background_gamma_code, + int need_expand, double background_gamma) +{ + png_debug(1, "in png_set_background\n"); + if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) + { + png_warning(png_ptr, "Application must supply a known background gamma"); + return; + } + + png_ptr->transformations |= PNG_BACKGROUND; + png_memcpy(&(png_ptr->background), background_color, + png_sizeof(png_color_16)); + png_ptr->background_gamma = (float)background_gamma; + png_ptr->background_gamma_type = (png_byte)(background_gamma_code); + png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0); + + /* Note: if need_expand is set and color_type is either RGB or RGB_ALPHA + * (in which case need_expand is superfluous anyway), the background color + * might actually be gray yet not be flagged as such. This is not a problem + * for the current code, which uses PNG_BACKGROUND_IS_GRAY only to + * decide when to do the png_do_gray_to_rgb() transformation. + */ + if ((need_expand && !(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) || + (!need_expand && background_color->red == background_color->green && + background_color->red == background_color->blue)) + png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; +} +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +/* strip 16 bit depth files to 8 bit depth */ +void PNGAPI +png_set_strip_16(png_structp png_ptr) +{ + png_debug(1, "in png_set_strip_16\n"); + png_ptr->transformations |= PNG_16_TO_8; +} +#endif + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) +void PNGAPI +png_set_strip_alpha(png_structp png_ptr) +{ + png_debug(1, "in png_set_strip_alpha\n"); + png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; +} +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +/* Dither file to 8 bit. Supply a palette, the current number + * of elements in the palette, the maximum number of elements + * allowed, and a histogram if possible. If the current number + * of colors is greater then the maximum number, the palette will be + * modified to fit in the maximum number. "full_dither" indicates + * whether we need a dithering cube set up for RGB images, or if we + * simply are reducing the number of colors in a paletted image. + */ + +typedef struct png_dsort_struct +{ + struct png_dsort_struct FAR * next; + png_byte left; + png_byte right; +} png_dsort; +typedef png_dsort FAR * png_dsortp; +typedef png_dsort FAR * FAR * png_dsortpp; + +void PNGAPI +png_set_dither(png_structp png_ptr, png_colorp palette, + int num_palette, int maximum_colors, png_uint_16p histogram, + int full_dither) +{ + png_debug(1, "in png_set_dither\n"); + png_ptr->transformations |= PNG_DITHER; + + if (!full_dither) + { + int i; + + png_ptr->dither_index = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof (png_byte))); + for (i = 0; i < num_palette; i++) + png_ptr->dither_index[i] = (png_byte)i; + } + + if (num_palette > maximum_colors) + { + if (histogram != NULL) + { + /* This is easy enough, just throw out the least used colors. + Perhaps not the best solution, but good enough. */ + + int i; + + /* initialize an array to sort colors */ + png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof (png_byte))); + + /* initialize the dither_sort array */ + for (i = 0; i < num_palette; i++) + png_ptr->dither_sort[i] = (png_byte)i; + + /* Find the least used palette entries by starting a + bubble sort, and running it until we have sorted + out enough colors. Note that we don't care about + sorting all the colors, just finding which are + least used. */ + + for (i = num_palette - 1; i >= maximum_colors; i--) + { + int done; /* to stop early if the list is pre-sorted */ + int j; + + done = 1; + for (j = 0; j < i; j++) + { + if (histogram[png_ptr->dither_sort[j]] + < histogram[png_ptr->dither_sort[j + 1]]) + { + png_byte t; + + t = png_ptr->dither_sort[j]; + png_ptr->dither_sort[j] = png_ptr->dither_sort[j + 1]; + png_ptr->dither_sort[j + 1] = t; + done = 0; + } + } + if (done) + break; + } + + /* swap the palette around, and set up a table, if necessary */ + if (full_dither) + { + int j = num_palette; + + /* put all the useful colors within the max, but don't + move the others */ + for (i = 0; i < maximum_colors; i++) + { + if ((int)png_ptr->dither_sort[i] >= maximum_colors) + { + do + j--; + while ((int)png_ptr->dither_sort[j] >= maximum_colors); + palette[i] = palette[j]; + } + } + } + else + { + int j = num_palette; + + /* move all the used colors inside the max limit, and + develop a translation table */ + for (i = 0; i < maximum_colors; i++) + { + /* only move the colors we need to */ + if ((int)png_ptr->dither_sort[i] >= maximum_colors) + { + png_color tmp_color; + + do + j--; + while ((int)png_ptr->dither_sort[j] >= maximum_colors); + + tmp_color = palette[j]; + palette[j] = palette[i]; + palette[i] = tmp_color; + /* indicate where the color went */ + png_ptr->dither_index[j] = (png_byte)i; + png_ptr->dither_index[i] = (png_byte)j; + } + } + + /* find closest color for those colors we are not using */ + for (i = 0; i < num_palette; i++) + { + if ((int)png_ptr->dither_index[i] >= maximum_colors) + { + int min_d, k, min_k, d_index; + + /* find the closest color to one we threw out */ + d_index = png_ptr->dither_index[i]; + min_d = PNG_COLOR_DIST(palette[d_index], palette[0]); + for (k = 1, min_k = 0; k < maximum_colors; k++) + { + int d; + + d = PNG_COLOR_DIST(palette[d_index], palette[k]); + + if (d < min_d) + { + min_d = d; + min_k = k; + } + } + /* point to closest color */ + png_ptr->dither_index[i] = (png_byte)min_k; + } + } + } + png_free(png_ptr, png_ptr->dither_sort); + png_ptr->dither_sort=NULL; + } + else + { + /* This is much harder to do simply (and quickly). Perhaps + we need to go through a median cut routine, but those + don't always behave themselves with only a few colors + as input. So we will just find the closest two colors, + and throw out one of them (chosen somewhat randomly). + [We don't understand this at all, so if someone wants to + work on improving it, be our guest - AED, GRP] + */ + int i; + int max_d; + int num_new_palette; + png_dsortp t; + png_dsortpp hash; + + t=NULL; + + /* initialize palette index arrays */ + png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof (png_byte))); + png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(num_palette * png_sizeof (png_byte))); + + /* initialize the sort array */ + for (i = 0; i < num_palette; i++) + { + png_ptr->index_to_palette[i] = (png_byte)i; + png_ptr->palette_to_index[i] = (png_byte)i; + } + + hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 * + png_sizeof (png_dsortp))); + for (i = 0; i < 769; i++) + hash[i] = NULL; +/* png_memset(hash, 0, 769 * png_sizeof (png_dsortp)); */ + + num_new_palette = num_palette; + + /* initial wild guess at how far apart the farthest pixel + pair we will be eliminating will be. Larger + numbers mean more areas will be allocated, Smaller + numbers run the risk of not saving enough data, and + having to do this all over again. + + I have not done extensive checking on this number. + */ + max_d = 96; + + while (num_new_palette > maximum_colors) + { + for (i = 0; i < num_new_palette - 1; i++) + { + int j; + + for (j = i + 1; j < num_new_palette; j++) + { + int d; + + d = PNG_COLOR_DIST(palette[i], palette[j]); + + if (d <= max_d) + { + + t = (png_dsortp)png_malloc_warn(png_ptr, + (png_uint_32)(png_sizeof(png_dsort))); + if (t == NULL) + break; + t->next = hash[d]; + t->left = (png_byte)i; + t->right = (png_byte)j; + hash[d] = t; + } + } + if (t == NULL) + break; + } + + if (t != NULL) + for (i = 0; i <= max_d; i++) + { + if (hash[i] != NULL) + { + png_dsortp p; + + for (p = hash[i]; p; p = p->next) + { + if ((int)png_ptr->index_to_palette[p->left] + < num_new_palette && + (int)png_ptr->index_to_palette[p->right] + < num_new_palette) + { + int j, next_j; + + if (num_new_palette & 0x01) + { + j = p->left; + next_j = p->right; + } + else + { + j = p->right; + next_j = p->left; + } + + num_new_palette--; + palette[png_ptr->index_to_palette[j]] + = palette[num_new_palette]; + if (!full_dither) + { + int k; + + for (k = 0; k < num_palette; k++) + { + if (png_ptr->dither_index[k] == + png_ptr->index_to_palette[j]) + png_ptr->dither_index[k] = + png_ptr->index_to_palette[next_j]; + if ((int)png_ptr->dither_index[k] == + num_new_palette) + png_ptr->dither_index[k] = + png_ptr->index_to_palette[j]; + } + } + + png_ptr->index_to_palette[png_ptr->palette_to_index + [num_new_palette]] = png_ptr->index_to_palette[j]; + png_ptr->palette_to_index[png_ptr->index_to_palette[j]] + = png_ptr->palette_to_index[num_new_palette]; + + png_ptr->index_to_palette[j] = (png_byte)num_new_palette; + png_ptr->palette_to_index[num_new_palette] = (png_byte)j; + } + if (num_new_palette <= maximum_colors) + break; + } + if (num_new_palette <= maximum_colors) + break; + } + } + + for (i = 0; i < 769; i++) + { + if (hash[i] != NULL) + { + png_dsortp p = hash[i]; + while (p) + { + t = p->next; + png_free(png_ptr, p); + p = t; + } + } + hash[i] = 0; + } + max_d += 96; + } + png_free(png_ptr, hash); + png_free(png_ptr, png_ptr->palette_to_index); + png_free(png_ptr, png_ptr->index_to_palette); + png_ptr->palette_to_index=NULL; + png_ptr->index_to_palette=NULL; + } + num_palette = maximum_colors; + } + if (png_ptr->palette == NULL) + { + png_ptr->palette = palette; + } + png_ptr->num_palette = (png_uint_16)num_palette; + + if (full_dither) + { + int i; + png_bytep distance; + int total_bits = PNG_DITHER_RED_BITS + PNG_DITHER_GREEN_BITS + + PNG_DITHER_BLUE_BITS; + int num_red = (1 << PNG_DITHER_RED_BITS); + int num_green = (1 << PNG_DITHER_GREEN_BITS); + int num_blue = (1 << PNG_DITHER_BLUE_BITS); + png_size_t num_entries = ((png_size_t)1 << total_bits); + + png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr, + (png_uint_32)(num_entries * png_sizeof (png_byte))); + + png_memset(png_ptr->palette_lookup, 0, num_entries * + png_sizeof (png_byte)); + + distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * + png_sizeof(png_byte))); + + png_memset(distance, 0xff, num_entries * png_sizeof(png_byte)); + + for (i = 0; i < num_palette; i++) + { + int ir, ig, ib; + int r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS)); + int g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS)); + int b = (palette[i].blue >> (8 - PNG_DITHER_BLUE_BITS)); + + for (ir = 0; ir < num_red; ir++) + { + /* int dr = abs(ir - r); */ + int dr = ((ir > r) ? ir - r : r - ir); + int index_r = (ir << (PNG_DITHER_BLUE_BITS + PNG_DITHER_GREEN_BITS)); + + for (ig = 0; ig < num_green; ig++) + { + /* int dg = abs(ig - g); */ + int dg = ((ig > g) ? ig - g : g - ig); + int dt = dr + dg; + int dm = ((dr > dg) ? dr : dg); + int index_g = index_r | (ig << PNG_DITHER_BLUE_BITS); + + for (ib = 0; ib < num_blue; ib++) + { + int d_index = index_g | ib; + /* int db = abs(ib - b); */ + int db = ((ib > b) ? ib - b : b - ib); + int dmax = ((dm > db) ? dm : db); + int d = dmax + dt + db; + + if (d < (int)distance[d_index]) + { + distance[d_index] = (png_byte)d; + png_ptr->palette_lookup[d_index] = (png_byte)i; + } + } + } + } + } + + png_free(png_ptr, distance); + } +} +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) +/* Transform the image from the file_gamma to the screen_gamma. We + * only do transformations on images where the file_gamma and screen_gamma + * are not close reciprocals, otherwise it slows things down slightly, and + * also needlessly introduces small errors. + * + * We will turn off gamma transformation later if no semitransparent entries + * are present in the tRNS array for palette images. We can't do it here + * because we don't necessarily have the tRNS chunk yet. + */ +void PNGAPI +png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) +{ + png_debug(1, "in png_set_gamma\n"); + if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || + (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || + (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)) + png_ptr->transformations |= PNG_GAMMA; + png_ptr->gamma = (float)file_gamma; + png_ptr->screen_gamma = (float)scrn_gamma; +} +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) +/* Expand paletted images to RGB, expand grayscale images of + * less than 8-bit depth to 8-bit depth, and expand tRNS chunks + * to alpha channels. + */ +void PNGAPI +png_set_expand(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand\n"); + png_ptr->transformations |= PNG_EXPAND; +} + +/* GRR 19990627: the following three functions currently are identical + * to png_set_expand(). However, it is entirely reasonable that someone + * might wish to expand an indexed image to RGB but *not* expand a single, + * fully transparent palette entry to a full alpha channel--perhaps instead + * convert tRNS to the grayscale/RGB format (16-bit RGB value), or replace + * the transparent color with a particular RGB value, or drop tRNS entirely. + * IOW, a future version of the library may make the transformations flag + * a bit more fine-grained, with separate bits for each of these three + * functions. + * + * More to the point, these functions make it obvious what libpng will be + * doing, whereas "expand" can (and does) mean any number of things. + */ + +/* Expand paletted images to RGB. */ +void PNGAPI +png_set_palette_to_rgb(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand\n"); + png_ptr->transformations |= PNG_EXPAND; +} + +/* Expand grayscale images of less than 8-bit depth to 8 bits. */ +void PNGAPI +png_set_gray_1_2_4_to_8(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand\n"); + png_ptr->transformations |= PNG_EXPAND; +} + +/* Expand tRNS chunks to alpha channels. */ +void PNGAPI +png_set_tRNS_to_alpha(png_structp png_ptr) +{ + png_debug(1, "in png_set_expand\n"); + png_ptr->transformations |= PNG_EXPAND; +} +#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +void PNGAPI +png_set_gray_to_rgb(png_structp png_ptr) +{ + png_debug(1, "in png_set_gray_to_rgb\n"); + png_ptr->transformations |= PNG_GRAY_TO_RGB; +} +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +#if defined(PNG_FLOATING_POINT_SUPPORTED) +/* Convert a RGB image to a grayscale of the same width. This allows us, + * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image. + */ + +void PNGAPI +png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, + double green) +{ + int red_fixed = (int)((float)red*100000.0 + 0.5); + int green_fixed = (int)((float)green*100000.0 + 0.5); + png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); +} +#endif + +void PNGAPI +png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, + png_fixed_point red, png_fixed_point green) +{ + png_debug(1, "in png_set_rgb_to_gray\n"); + switch(error_action) + { + case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY; + break; + case 2: png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN; + break; + case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR; + } + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) +#if defined(PNG_READ_EXPAND_SUPPORTED) + png_ptr->transformations |= PNG_EXPAND; +#else + { + png_warning(png_ptr, "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED."); + png_ptr->transformations &= ~PNG_RGB_TO_GRAY; + } +#endif + { + png_uint_16 red_int, green_int; + if(red < 0 || green < 0) + { + red_int = 6968; /* .212671 * 32768 + .5 */ + green_int = 23434; /* .715160 * 32768 + .5 */ + } + else if(red + green < 100000L) + { + red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L); + green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L); + } + else + { + png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients"); + red_int = 6968; + green_int = 23434; + } + png_ptr->rgb_to_gray_red_coeff = red_int; + png_ptr->rgb_to_gray_green_coeff = green_int; + png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(32768-red_int-green_int); + } +} +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) +void PNGAPI +png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr + read_user_transform_fn) +{ + png_debug(1, "in png_set_read_user_transform_fn\n"); +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) + png_ptr->transformations |= PNG_USER_TRANSFORM; + png_ptr->read_user_transform_fn = read_user_transform_fn; +#endif +#ifdef PNG_LEGACY_SUPPORTED + if(read_user_transform_fn) + png_warning(png_ptr, + "This version of libpng does not support user transforms"); +#endif +} +#endif + +/* Initialize everything needed for the read. This includes modifying + * the palette. + */ +void /* PRIVATE */ +png_init_read_transformations(png_structp png_ptr) +{ + png_debug(1, "in png_init_read_transformations\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if(png_ptr != NULL) +#endif + { +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \ + || defined(PNG_READ_GAMMA_SUPPORTED) + int color_type = png_ptr->color_type; +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) + if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && + (png_ptr->transformations & PNG_EXPAND)) + { + if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */ + { + /* expand background chunk. */ + switch (png_ptr->bit_depth) + { + case 1: + png_ptr->background.gray *= (png_uint_16)0xff; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + break; + case 2: + png_ptr->background.gray *= (png_uint_16)0x55; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + break; + case 4: + png_ptr->background.gray *= (png_uint_16)0x11; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + break; + case 8: + case 16: + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + break; + } + } + else if (color_type == PNG_COLOR_TYPE_PALETTE) + { + png_ptr->background.red = + png_ptr->palette[png_ptr->background.index].red; + png_ptr->background.green = + png_ptr->palette[png_ptr->background.index].green; + png_ptr->background.blue = + png_ptr->palette[png_ptr->background.index].blue; + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_ALPHA) + { +#if defined(PNG_READ_EXPAND_SUPPORTED) + if (!(png_ptr->transformations & PNG_EXPAND)) +#endif + { + /* invert the alpha channel (in tRNS) unless the pixels are + going to be expanded, in which case leave it for later */ + int i,istop; + istop=(int)png_ptr->num_trans; + for (i=0; itrans[i] = (png_byte)(255 - png_ptr->trans[i]); + } + } +#endif + + } + } +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) + png_ptr->background_1 = png_ptr->background; +#endif +#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) + + if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0) + && (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0) + < PNG_GAMMA_THRESHOLD)) + { + int i,k; + k=0; + for (i=0; inum_trans; i++) + { + if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) + k=1; /* partial transparency is present */ + } + if (k == 0) + png_ptr->transformations &= (~PNG_GAMMA); + } + + if (png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) + { + png_build_gamma_table(png_ptr); +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->transformations & PNG_BACKGROUND) + { + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + /* could skip if no transparency and + */ + png_color back, back_1; + png_colorp palette = png_ptr->palette; + int num_palette = png_ptr->num_palette; + int i; + if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE) + { + back.red = png_ptr->gamma_table[png_ptr->background.red]; + back.green = png_ptr->gamma_table[png_ptr->background.green]; + back.blue = png_ptr->gamma_table[png_ptr->background.blue]; + + back_1.red = png_ptr->gamma_to_1[png_ptr->background.red]; + back_1.green = png_ptr->gamma_to_1[png_ptr->background.green]; + back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue]; + } + else + { + double g, gs; + + switch (png_ptr->background_gamma_type) + { + case PNG_BACKGROUND_GAMMA_SCREEN: + g = (png_ptr->screen_gamma); + gs = 1.0; + break; + case PNG_BACKGROUND_GAMMA_FILE: + g = 1.0 / (png_ptr->gamma); + gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + break; + case PNG_BACKGROUND_GAMMA_UNIQUE: + g = 1.0 / (png_ptr->background_gamma); + gs = 1.0 / (png_ptr->background_gamma * + png_ptr->screen_gamma); + break; + default: + g = 1.0; /* back_1 */ + gs = 1.0; /* back */ + } + + if ( fabs(gs - 1.0) < PNG_GAMMA_THRESHOLD) + { + back.red = (png_byte)png_ptr->background.red; + back.green = (png_byte)png_ptr->background.green; + back.blue = (png_byte)png_ptr->background.blue; + } + else + { + back.red = (png_byte)(pow( + (double)png_ptr->background.red/255, gs) * 255.0 + .5); + back.green = (png_byte)(pow( + (double)png_ptr->background.green/255, gs) * 255.0 + .5); + back.blue = (png_byte)(pow( + (double)png_ptr->background.blue/255, gs) * 255.0 + .5); + } + + back_1.red = (png_byte)(pow( + (double)png_ptr->background.red/255, g) * 255.0 + .5); + back_1.green = (png_byte)(pow( + (double)png_ptr->background.green/255, g) * 255.0 + .5); + back_1.blue = (png_byte)(pow( + (double)png_ptr->background.blue/255, g) * 255.0 + .5); + } + for (i = 0; i < num_palette; i++) + { + if (i < (int)png_ptr->num_trans && png_ptr->trans[i] != 0xff) + { + if (png_ptr->trans[i] == 0) + { + palette[i] = back; + } + else /* if (png_ptr->trans[i] != 0xff) */ + { + png_byte v, w; + + v = png_ptr->gamma_to_1[palette[i].red]; + png_composite(w, v, png_ptr->trans[i], back_1.red); + palette[i].red = png_ptr->gamma_from_1[w]; + + v = png_ptr->gamma_to_1[palette[i].green]; + png_composite(w, v, png_ptr->trans[i], back_1.green); + palette[i].green = png_ptr->gamma_from_1[w]; + + v = png_ptr->gamma_to_1[palette[i].blue]; + png_composite(w, v, png_ptr->trans[i], back_1.blue); + palette[i].blue = png_ptr->gamma_from_1[w]; + } + } + else + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + } + } + /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ + else + /* color_type != PNG_COLOR_TYPE_PALETTE */ + { + double m = (double)(((png_uint_32)1 << png_ptr->bit_depth) - 1); + double g = 1.0; + double gs = 1.0; + + switch (png_ptr->background_gamma_type) + { + case PNG_BACKGROUND_GAMMA_SCREEN: + g = (png_ptr->screen_gamma); + gs = 1.0; + break; + case PNG_BACKGROUND_GAMMA_FILE: + g = 1.0 / (png_ptr->gamma); + gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + break; + case PNG_BACKGROUND_GAMMA_UNIQUE: + g = 1.0 / (png_ptr->background_gamma); + gs = 1.0 / (png_ptr->background_gamma * + png_ptr->screen_gamma); + break; + } + + png_ptr->background_1.gray = (png_uint_16)(pow( + (double)png_ptr->background.gray / m, g) * m + .5); + png_ptr->background.gray = (png_uint_16)(pow( + (double)png_ptr->background.gray / m, gs) * m + .5); + + if ((png_ptr->background.red != png_ptr->background.green) || + (png_ptr->background.red != png_ptr->background.blue) || + (png_ptr->background.red != png_ptr->background.gray)) + { + /* RGB or RGBA with color background */ + png_ptr->background_1.red = (png_uint_16)(pow( + (double)png_ptr->background.red / m, g) * m + .5); + png_ptr->background_1.green = (png_uint_16)(pow( + (double)png_ptr->background.green / m, g) * m + .5); + png_ptr->background_1.blue = (png_uint_16)(pow( + (double)png_ptr->background.blue / m, g) * m + .5); + png_ptr->background.red = (png_uint_16)(pow( + (double)png_ptr->background.red / m, gs) * m + .5); + png_ptr->background.green = (png_uint_16)(pow( + (double)png_ptr->background.green / m, gs) * m + .5); + png_ptr->background.blue = (png_uint_16)(pow( + (double)png_ptr->background.blue / m, gs) * m + .5); + } + else + { + /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */ + png_ptr->background_1.red = png_ptr->background_1.green + = png_ptr->background_1.blue = png_ptr->background_1.gray; + png_ptr->background.red = png_ptr->background.green + = png_ptr->background.blue = png_ptr->background.gray; + } + } + } + else + /* transformation does not include PNG_BACKGROUND */ +#endif /* PNG_READ_BACKGROUND_SUPPORTED */ + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + png_colorp palette = png_ptr->palette; + int num_palette = png_ptr->num_palette; + int i; + + for (i = 0; i < num_palette; i++) + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + } + } +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + else +#endif +#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */ +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + /* No GAMMA transformation */ + if ((png_ptr->transformations & PNG_BACKGROUND) && + (color_type == PNG_COLOR_TYPE_PALETTE)) + { + int i; + int istop = (int)png_ptr->num_trans; + png_color back; + png_colorp palette = png_ptr->palette; + + back.red = (png_byte)png_ptr->background.red; + back.green = (png_byte)png_ptr->background.green; + back.blue = (png_byte)png_ptr->background.blue; + + for (i = 0; i < istop; i++) + { + if (png_ptr->trans[i] == 0) + { + palette[i] = back; + } + else if (png_ptr->trans[i] != 0xff) + { + /* The png_composite() macro is defined in png.h */ + png_composite(palette[i].red, palette[i].red, + png_ptr->trans[i], back.red); + png_composite(palette[i].green, palette[i].green, + png_ptr->trans[i], back.green); + png_composite(palette[i].blue, palette[i].blue, + png_ptr->trans[i], back.blue); + } + } + } +#endif /* PNG_READ_BACKGROUND_SUPPORTED */ + +#if defined(PNG_READ_SHIFT_SUPPORTED) + if ((png_ptr->transformations & PNG_SHIFT) && + (color_type == PNG_COLOR_TYPE_PALETTE)) + { + png_uint_16 i; + png_uint_16 istop = png_ptr->num_palette; + int sr = 8 - png_ptr->sig_bit.red; + int sg = 8 - png_ptr->sig_bit.green; + int sb = 8 - png_ptr->sig_bit.blue; + + if (sr < 0 || sr > 8) + sr = 0; + if (sg < 0 || sg > 8) + sg = 0; + if (sb < 0 || sb > 8) + sb = 0; + for (i = 0; i < istop; i++) + { + png_ptr->palette[i].red >>= sr; + png_ptr->palette[i].green >>= sg; + png_ptr->palette[i].blue >>= sb; + } + } +#endif /* PNG_READ_SHIFT_SUPPORTED */ + } +#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \ + && !defined(PNG_READ_BACKGROUND_SUPPORTED) + if(png_ptr) + return; +#endif +} + +/* Modify the info structure to reflect the transformations. The + * info should be updated so a PNG file could be written with it, + * assuming the transformations result in valid PNG data. + */ +void /* PRIVATE */ +png_read_transform_info(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_read_transform_info\n"); +#if defined(PNG_READ_EXPAND_SUPPORTED) + if (png_ptr->transformations & PNG_EXPAND) + { + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (png_ptr->num_trans) + info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; + else + info_ptr->color_type = PNG_COLOR_TYPE_RGB; + info_ptr->bit_depth = 8; + info_ptr->num_trans = 0; + } + else + { + if (png_ptr->num_trans) + info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; + if (info_ptr->bit_depth < 8) + info_ptr->bit_depth = 8; + info_ptr->num_trans = 0; + } + } +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->transformations & PNG_BACKGROUND) + { + info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; + info_ptr->num_trans = 0; + info_ptr->background = png_ptr->background; + } +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (png_ptr->transformations & PNG_GAMMA) + { +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->gamma = png_ptr->gamma; +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_gamma = png_ptr->int_gamma; +#endif + } +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) + if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16)) + info_ptr->bit_depth = 8; +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) + if (png_ptr->transformations & PNG_DITHER) + { + if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || + (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) && + png_ptr->palette_lookup && info_ptr->bit_depth == 8) + { + info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; + } + } +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) + if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8)) + info_ptr->bit_depth = 8; +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) + if (png_ptr->transformations & PNG_GRAY_TO_RGB) + info_ptr->color_type |= PNG_COLOR_MASK_COLOR; +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + if (png_ptr->transformations & PNG_RGB_TO_GRAY) + info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR; +#endif + + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + info_ptr->channels = 1; + else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) + info_ptr->channels = 3; + else + info_ptr->channels = 1; + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) + if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) + info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; +#endif + + if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) + info_ptr->channels++; + +#if defined(PNG_READ_FILLER_SUPPORTED) + /* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */ + if ((png_ptr->transformations & PNG_FILLER) && + ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || + (info_ptr->color_type == PNG_COLOR_TYPE_GRAY))) + { + info_ptr->channels++; + /* if adding a true alpha channel not just filler */ +#if !defined(PNG_1_0_X) + if (png_ptr->transformations & PNG_ADD_ALPHA) + info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; +#endif + } +#endif + +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \ +defined(PNG_READ_USER_TRANSFORM_SUPPORTED) + if(png_ptr->transformations & PNG_USER_TRANSFORM) + { + if(info_ptr->bit_depth < png_ptr->user_transform_depth) + info_ptr->bit_depth = png_ptr->user_transform_depth; + if(info_ptr->channels < png_ptr->user_transform_channels) + info_ptr->channels = png_ptr->user_transform_channels; + } +#endif + + info_ptr->pixel_depth = (png_byte)(info_ptr->channels * + info_ptr->bit_depth); + + info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,info_ptr->width); + +#if !defined(PNG_READ_EXPAND_SUPPORTED) + if(png_ptr) + return; +#endif +} + +/* Transform the row. The order of transformations is significant, + * and is very touchy. If you add a transformation, take care to + * decide how it fits in with the other transformations here. + */ +void /* PRIVATE */ +png_do_read_transformations(png_structp png_ptr) +{ + png_debug(1, "in png_do_read_transformations\n"); +#if !defined(PNG_USELESS_TESTS_SUPPORTED) + if (png_ptr->row_buf == NULL) + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char msg[50]; + + sprintf(msg, "NULL row buffer for row %ld, pass %d", png_ptr->row_number, + png_ptr->pass); + png_error(png_ptr, msg); +#else + png_error(png_ptr, "NULL row buffer"); +#endif + } +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) + if (png_ptr->transformations & PNG_EXPAND) + { + if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE) + { + png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->palette, png_ptr->trans, png_ptr->num_trans); + } + else + { + if (png_ptr->num_trans) + png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->trans_values)); + else + png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, + NULL); + } + } +#endif + +#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) + if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) + png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, + PNG_FLAG_FILLER_AFTER | (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)); +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + if (png_ptr->transformations & PNG_RGB_TO_GRAY) + { + int rgb_error = + png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1); + if(rgb_error) + { + png_ptr->rgb_to_gray_status=1; + if(png_ptr->transformations == PNG_RGB_TO_GRAY_WARN) + png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel"); + if(png_ptr->transformations == PNG_RGB_TO_GRAY_ERR) + png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); + } + } +#endif + +/* +From Andreas Dilger e-mail to png-implement, 26 March 1998: + + In most cases, the "simple transparency" should be done prior to doing + gray-to-RGB, or you will have to test 3x as many bytes to check if a + pixel is transparent. You would also need to make sure that the + transparency information is upgraded to RGB. + + To summarize, the current flow is: + - Gray + simple transparency -> compare 1 or 2 gray bytes and composite + with background "in place" if transparent, + convert to RGB if necessary + - Gray + alpha -> composite with gray background and remove alpha bytes, + convert to RGB if necessary + + To support RGB backgrounds for gray images we need: + - Gray + simple transparency -> convert to RGB + simple transparency, compare + 3 or 6 bytes and composite with background + "in place" if transparent (3x compare/pixel + compared to doing composite with gray bkgrnd) + - Gray + alpha -> convert to RGB + alpha, composite with background and + remove alpha bytes (3x float operations/pixel + compared with composite on gray background) + + Greg's change will do this. The reason it wasn't done before is for + performance, as this increases the per-pixel operations. If we would check + in advance if the background was gray or RGB, and position the gray-to-RGB + transform appropriately, then it would save a lot of work/time. + */ + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) + /* if gray -> RGB, do so now only if background is non-gray; else do later + * for performance reasons */ + if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && + !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) + png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + if ((png_ptr->transformations & PNG_BACKGROUND) && + ((png_ptr->num_trans != 0 ) || + (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) + png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->trans_values), &(png_ptr->background) +#if defined(PNG_READ_GAMMA_SUPPORTED) + , &(png_ptr->background_1), + png_ptr->gamma_table, png_ptr->gamma_from_1, + png_ptr->gamma_to_1, png_ptr->gamma_16_table, + png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1, + png_ptr->gamma_shift +#endif +); +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) + if ((png_ptr->transformations & PNG_GAMMA) && +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + !((png_ptr->transformations & PNG_BACKGROUND) && + ((png_ptr->num_trans != 0) || + (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) && +#endif + (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)) + png_do_gamma(&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->gamma_table, png_ptr->gamma_16_table, + png_ptr->gamma_shift); +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) + if (png_ptr->transformations & PNG_16_TO_8) + png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) + if (png_ptr->transformations & PNG_DITHER) + { + png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1, + png_ptr->palette_lookup, png_ptr->dither_index); + if(png_ptr->row_info.rowbytes == (png_uint_32)0) + png_error(png_ptr, "png_do_dither returned rowbytes=0"); + } +#endif + +#if defined(PNG_READ_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_READ_SHIFT_SUPPORTED) + if (png_ptr->transformations & PNG_SHIFT) + png_do_unshift(&(png_ptr->row_info), png_ptr->row_buf + 1, + &(png_ptr->shift)); +#endif + +#if defined(PNG_READ_PACK_SUPPORTED) + if (png_ptr->transformations & PNG_PACK) + png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_BGR_SUPPORTED) + if (png_ptr->transformations & PNG_BGR) + png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) + /* if gray -> RGB, do so now only if we did not do so above */ + if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && + (png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) + png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) + if (png_ptr->transformations & PNG_FILLER) + png_do_read_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, + (png_uint_32)png_ptr->filler, png_ptr->flags); +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_ALPHA) + png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) + if (png_ptr->transformations & PNG_SWAP_ALPHA) + png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); +#endif + +#if defined(PNG_READ_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_READ_USER_TRANSFORM_SUPPORTED) + if (png_ptr->transformations & PNG_USER_TRANSFORM) + { + if(png_ptr->read_user_transform_fn != NULL) + (*(png_ptr->read_user_transform_fn)) /* user read 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 */ +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) + if(png_ptr->user_transform_depth) + png_ptr->row_info.bit_depth = png_ptr->user_transform_depth; + if(png_ptr->user_transform_channels) + png_ptr->row_info.channels = png_ptr->user_transform_channels; +#endif + png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * + png_ptr->row_info.channels); + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + } +#endif + +} + +#if defined(PNG_READ_PACK_SUPPORTED) +/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel, + * without changing the actual values. Thus, if you had a row with + * a bit depth of 1, you would end up with bytes that only contained + * the numbers 0 or 1. If you would rather they contain 0 and 255, use + * png_do_shift() after this. + */ +void /* PRIVATE */ +png_do_unpack(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_unpack\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL && row_info->bit_depth < 8) +#else + if (row_info->bit_depth < 8) +#endif + { + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + switch (row_info->bit_depth) + { + case 1: + { + png_bytep sp = row + (png_size_t)((row_width - 1) >> 3); + png_bytep dp = row + (png_size_t)row_width - 1; + png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07); + for (i = 0; i < row_width; i++) + { + *dp = (png_byte)((*sp >> shift) & 0x01); + if (shift == 7) + { + shift = 0; + sp--; + } + else + shift++; + + dp--; + } + break; + } + case 2: + { + + png_bytep sp = row + (png_size_t)((row_width - 1) >> 2); + png_bytep dp = row + (png_size_t)row_width - 1; + png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + for (i = 0; i < row_width; i++) + { + *dp = (png_byte)((*sp >> shift) & 0x03); + if (shift == 6) + { + shift = 0; + sp--; + } + else + shift += 2; + + dp--; + } + break; + } + case 4: + { + png_bytep sp = row + (png_size_t)((row_width - 1) >> 1); + png_bytep dp = row + (png_size_t)row_width - 1; + png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); + for (i = 0; i < row_width; i++) + { + *dp = (png_byte)((*sp >> shift) & 0x0f); + if (shift == 4) + { + shift = 0; + sp--; + } + else + shift = 4; + + dp--; + } + break; + } + } + row_info->bit_depth = 8; + row_info->pixel_depth = (png_byte)(8 * row_info->channels); + row_info->rowbytes = row_width * row_info->channels; + } +} +#endif + +#if defined(PNG_READ_SHIFT_SUPPORTED) +/* Reverse the effects of png_do_shift. This routine merely shifts the + * pixels back to their significant bits values. Thus, if you have + * a row of bit depth 8, but only 5 are significant, this will shift + * the values back to 0 through 31. + */ +void /* PRIVATE */ +png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits) +{ + png_debug(1, "in png_do_unshift\n"); + if ( +#if defined(PNG_USELESS_TESTS_SUPPORTED) + row != NULL && row_info != NULL && sig_bits != NULL && +#endif + row_info->color_type != PNG_COLOR_TYPE_PALETTE) + { + int shift[4]; + int channels = 0; + int c; + png_uint_16 value = 0; + png_uint_32 row_width = row_info->width; + + if (row_info->color_type & PNG_COLOR_MASK_COLOR) + { + shift[channels++] = row_info->bit_depth - sig_bits->red; + shift[channels++] = row_info->bit_depth - sig_bits->green; + shift[channels++] = row_info->bit_depth - sig_bits->blue; + } + else + { + shift[channels++] = row_info->bit_depth - sig_bits->gray; + } + if (row_info->color_type & PNG_COLOR_MASK_ALPHA) + { + shift[channels++] = row_info->bit_depth - sig_bits->alpha; + } + + for (c = 0; c < channels; c++) + { + if (shift[c] <= 0) + shift[c] = 0; + else + value = 1; + } + + if (!value) + return; + + switch (row_info->bit_depth) + { + case 2: + { + png_bytep bp; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + + for (bp = row, i = 0; i < istop; i++) + { + *bp >>= 1; + *bp++ &= 0x55; + } + break; + } + case 4: + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_byte mask = (png_byte)((((int)0xf0 >> shift[0]) & (int)0xf0) | + (png_byte)((int)0xf >> shift[0])); + + for (i = 0; i < istop; i++) + { + *bp >>= shift[0]; + *bp++ &= mask; + } + break; + } + case 8: + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = row_width * channels; + + for (i = 0; i < istop; i++) + { + *bp++ >>= shift[i%channels]; + } + break; + } + case 16: + { + png_bytep bp = row; + png_uint_32 i; + png_uint_32 istop = channels * row_width; + + for (i = 0; i < istop; i++) + { + value = (png_uint_16)((*bp << 8) + *(bp + 1)); + value >>= shift[i%channels]; + *bp++ = (png_byte)(value >> 8); + *bp++ = (png_byte)(value & 0xff); + } + break; + } + } + } +} +#endif + +#if defined(PNG_READ_16_TO_8_SUPPORTED) +/* chop rows of bit depth 16 down to 8 */ +void /* PRIVATE */ +png_do_chop(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_chop\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL && row_info->bit_depth == 16) +#else + if (row_info->bit_depth == 16) +#endif + { + png_bytep sp = row; + png_bytep dp = row; + png_uint_32 i; + png_uint_32 istop = row_info->width * row_info->channels; + + for (i = 0; i> 8)) >> 8; + * + * Approximate calculation with shift/add instead of multiply/divide: + * *dp = ((((png_uint_32)(*sp) << 8) | + * (png_uint_32)((int)(*(sp + 1)) - *sp)) + 128) >> 8; + * + * What we actually do to avoid extra shifting and conversion: + */ + + *dp = *sp + ((((int)(*(sp + 1)) - *sp) > 128) ? 1 : 0); +#else + /* Simply discard the low order byte */ + *dp = *sp; +#endif + } + row_info->bit_depth = 8; + row_info->pixel_depth = (png_byte)(8 * row_info->channels); + row_info->rowbytes = row_info->width * row_info->channels; + } +} +#endif + +#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) +void /* PRIVATE */ +png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_read_swap_alpha\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL) +#endif + { + png_uint_32 row_width = row_info->width; + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + /* This converts from RGBA to ARGB */ + if (row_info->bit_depth == 8) + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save; + } + } + /* This converts from RRGGBBAA to AARRGGBB */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save[2]; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + 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 GA to AG */ + if (row_info->bit_depth == 8) + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save; + } + } + /* This converts from GGAA to AAGG */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_byte save[2]; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + save[0] = *(--sp); + save[1] = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = save[0]; + *(--dp) = save[1]; + } + } + } + } +} +#endif + +#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) +void /* PRIVATE */ +png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_read_invert_alpha\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL) +#endif + { + png_uint_32 row_width = row_info->width; + 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 = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + +/* This does nothing: + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + We can replace it with: +*/ + sp-=3; + dp=sp; + } + } + /* This inverts the alpha channel in RRGGBBAA */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + *(--dp) = (png_byte)(255 - *(--sp)); + +/* This does nothing: + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + We can replace it with: +*/ + sp-=6; + dp=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 = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + *(--dp) = *(--sp); + } + } + /* This inverts the alpha channel in GGAA */ + else + { + png_bytep sp = row + row_info->rowbytes; + png_bytep dp = sp; + png_uint_32 i; + + for (i = 0; i < row_width; i++) + { + *(--dp) = (png_byte)(255 - *(--sp)); + *(--dp) = (png_byte)(255 - *(--sp)); +/* + *(--dp) = *(--sp); + *(--dp) = *(--sp); +*/ + sp-=2; + dp=sp; + } + } + } + } +} +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) +/* Add filler channel if we have RGB color */ +void /* PRIVATE */ +png_do_read_filler(png_row_infop row_info, png_bytep row, + png_uint_32 filler, png_uint_32 flags) +{ + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + png_byte hi_filler = (png_byte)((filler>>8) & 0xff); + png_byte lo_filler = (png_byte)(filler & 0xff); + + png_debug(1, "in png_do_read_filler\n"); + if ( +#if defined(PNG_USELESS_TESTS_SUPPORTED) + row != NULL && row_info != NULL && +#endif + row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + if(row_info->bit_depth == 8) + { + /* This changes the data from G to GX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 1; i < row_width; i++) + { + *(--dp) = lo_filler; + *(--dp) = *(--sp); + } + *(--dp) = lo_filler; + row_info->channels = 2; + row_info->pixel_depth = 16; + row_info->rowbytes = row_width * 2; + } + /* This changes the data from G to XG */ + else + { + png_bytep sp = row + (png_size_t)row_width; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = lo_filler; + } + row_info->channels = 2; + row_info->pixel_depth = 16; + row_info->rowbytes = row_width * 2; + } + } + else if(row_info->bit_depth == 16) + { + /* This changes the data from GG to GGXX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width * 2; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 1; i < row_width; i++) + { + *(--dp) = hi_filler; + *(--dp) = lo_filler; + *(--dp) = *(--sp); + *(--dp) = *(--sp); + } + *(--dp) = hi_filler; + *(--dp) = lo_filler; + row_info->channels = 2; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + /* This changes the data from GG to XXGG */ + else + { + png_bytep sp = row + (png_size_t)row_width * 2; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = hi_filler; + *(--dp) = lo_filler; + } + row_info->channels = 2; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + } + } /* COLOR_TYPE == GRAY */ + else if (row_info->color_type == PNG_COLOR_TYPE_RGB) + { + if(row_info->bit_depth == 8) + { + /* This changes the data from RGB to RGBX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width * 3; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 1; i < row_width; i++) + { + *(--dp) = lo_filler; + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + } + *(--dp) = lo_filler; + row_info->channels = 4; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + /* This changes the data from RGB to XRGB */ + else + { + png_bytep sp = row + (png_size_t)row_width * 3; + png_bytep dp = sp + (png_size_t)row_width; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = lo_filler; + } + row_info->channels = 4; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + } + } + else if(row_info->bit_depth == 16) + { + /* This changes the data from RRGGBB to RRGGBBXX */ + if (flags & PNG_FLAG_FILLER_AFTER) + { + png_bytep sp = row + (png_size_t)row_width * 6; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 1; i < row_width; i++) + { + *(--dp) = hi_filler; + *(--dp) = lo_filler; + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + } + *(--dp) = hi_filler; + *(--dp) = lo_filler; + row_info->channels = 4; + row_info->pixel_depth = 64; + row_info->rowbytes = row_width * 8; + } + /* This changes the data from RRGGBB to XXRRGGBB */ + else + { + png_bytep sp = row + (png_size_t)row_width * 6; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = *(--sp); + *(--dp) = hi_filler; + *(--dp) = lo_filler; + } + row_info->channels = 4; + row_info->pixel_depth = 64; + row_info->rowbytes = row_width * 8; + } + } + } /* COLOR_TYPE == RGB */ +} +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) +/* expand grayscale files to RGB, with or without alpha */ +void /* PRIVATE */ +png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) +{ + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + png_debug(1, "in png_do_gray_to_rgb\n"); + if (row_info->bit_depth >= 8 && +#if defined(PNG_USELESS_TESTS_SUPPORTED) + row != NULL && row_info != NULL && +#endif + !(row_info->color_type & PNG_COLOR_MASK_COLOR)) + { + if (row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + if (row_info->bit_depth == 8) + { + png_bytep sp = row + (png_size_t)row_width - 1; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(dp--) = *sp; + *(dp--) = *sp; + *(dp--) = *(sp--); + } + } + else + { + png_bytep sp = row + (png_size_t)row_width * 2 - 1; + png_bytep dp = sp + (png_size_t)row_width * 4; + for (i = 0; i < row_width; i++) + { + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *(sp--); + *(dp--) = *(sp--); + } + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + if (row_info->bit_depth == 8) + { + png_bytep sp = row + (png_size_t)row_width * 2 - 1; + png_bytep dp = sp + (png_size_t)row_width * 2; + for (i = 0; i < row_width; i++) + { + *(dp--) = *(sp--); + *(dp--) = *sp; + *(dp--) = *sp; + *(dp--) = *(sp--); + } + } + else + { + png_bytep sp = row + (png_size_t)row_width * 4 - 1; + png_bytep dp = sp + (png_size_t)row_width * 4; + for (i = 0; i < row_width; i++) + { + *(dp--) = *(sp--); + *(dp--) = *(sp--); + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *sp; + *(dp--) = *(sp - 1); + *(dp--) = *(sp--); + *(dp--) = *(sp--); + } + } + } + row_info->channels += (png_byte)2; + row_info->color_type |= PNG_COLOR_MASK_COLOR; + row_info->pixel_depth = (png_byte)(row_info->channels * + row_info->bit_depth); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + } +} +#endif + +#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) +/* reduce RGB files to grayscale, with or without alpha + * using the equation given in Poynton's ColorFAQ at + * + * Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net + * + * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B + * + * We approximate this with + * + * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B + * + * which can be expressed with integers as + * + * Y = (6969 * R + 23434 * G + 2365 * B)/32768 + * + * The calculation is to be done in a linear colorspace. + * + * Other integer coefficents can be used via png_set_rgb_to_gray(). + */ +int /* PRIVATE */ +png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) + +{ + png_uint_32 i; + + png_uint_32 row_width = row_info->width; + int rgb_error = 0; + + png_debug(1, "in png_do_rgb_to_gray\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 rc = png_ptr->rgb_to_gray_red_coeff; + png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; + png_uint_32 bc = png_ptr->rgb_to_gray_blue_coeff; + + if (row_info->color_type == PNG_COLOR_TYPE_RGB) + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + + for (i = 0; i < row_width; i++) + { + png_byte red = png_ptr->gamma_to_1[*(sp++)]; + png_byte green = png_ptr->gamma_to_1[*(sp++)]; + png_byte blue = png_ptr->gamma_to_1[*(sp++)]; + if(red != green || red != blue) + { + rgb_error |= 1; + *(dp++) = png_ptr->gamma_from_1[ + (rc*red+gc*green+bc*blue)>>15]; + } + else + *(dp++) = *(sp-1); + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_byte red = *(sp++); + png_byte green = *(sp++); + png_byte blue = *(sp++); + if(red != green || red != blue) + { + rgb_error |= 1; + *(dp++) = (png_byte)((rc*red+gc*green+bc*blue)>>15); + } + else + *(dp++) = *(sp-1); + } + } + } + + else /* RGB bit_depth == 16 */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_16_to_1 != NULL && + png_ptr->gamma_16_from_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, w; + + red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + + if(red == green && red == blue) + w = red; + else + { + png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> + png_ptr->gamma_shift][red>>8]; + png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> + png_ptr->gamma_shift][green>>8]; + png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> + png_ptr->gamma_shift][blue>>8]; + png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1 + + bc*blue_1)>>15); + w = png_ptr->gamma_16_from_1[(gray16&0xff) >> + png_ptr->gamma_shift][gray16 >> 8]; + rgb_error |= 1; + } + + *(dp++) = (png_byte)((w>>8) & 0xff); + *(dp++) = (png_byte)(w & 0xff); + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, gray16; + + red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + + if(red != green || red != blue) + rgb_error |= 1; + gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); + *(dp++) = (png_byte)((gray16>>8) & 0xff); + *(dp++) = (png_byte)(gray16 & 0xff); + } + } + } + } + if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_byte red = png_ptr->gamma_to_1[*(sp++)]; + png_byte green = png_ptr->gamma_to_1[*(sp++)]; + png_byte blue = png_ptr->gamma_to_1[*(sp++)]; + if(red != green || red != blue) + rgb_error |= 1; + *(dp++) = png_ptr->gamma_from_1 + [(rc*red + gc*green + bc*blue)>>15]; + *(dp++) = *(sp++); /* alpha */ + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_byte red = *(sp++); + png_byte green = *(sp++); + png_byte blue = *(sp++); + if(red != green || red != blue) + rgb_error |= 1; + *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); + *(dp++) = *(sp++); /* alpha */ + } + } + } + else /* RGBA bit_depth == 16 */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->gamma_16_to_1 != NULL && + png_ptr->gamma_16_from_1 != NULL) + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, w; + + red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; + + if(red == green && red == blue) + w = red; + else + { + png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> + png_ptr->gamma_shift][red>>8]; + png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> + png_ptr->gamma_shift][green>>8]; + png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> + png_ptr->gamma_shift][blue>>8]; + png_uint_16 gray16 = (png_uint_16)((rc * red_1 + + gc * green_1 + bc * blue_1)>>15); + w = png_ptr->gamma_16_from_1[(gray16&0xff) >> + png_ptr->gamma_shift][gray16 >> 8]; + rgb_error |= 1; + } + + *(dp++) = (png_byte)((w>>8) & 0xff); + *(dp++) = (png_byte)(w & 0xff); + *(dp++) = *(sp++); /* alpha */ + *(dp++) = *(sp++); + } + } + else +#endif + { + png_bytep sp = row; + png_bytep dp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 red, green, blue, gray16; + red = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; + green = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; + blue = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; + if(red != green || red != blue) + rgb_error |= 1; + gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); + *(dp++) = (png_byte)((gray16>>8) & 0xff); + *(dp++) = (png_byte)(gray16 & 0xff); + *(dp++) = *(sp++); /* alpha */ + *(dp++) = *(sp++); + } + } + } + } + row_info->channels -= (png_byte)2; + row_info->color_type &= ~PNG_COLOR_MASK_COLOR; + row_info->pixel_depth = (png_byte)(row_info->channels * + row_info->bit_depth); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + } + return rgb_error; +} +#endif + +/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth + * large of png_color. This lets grayscale images be treated as + * paletted. Most useful for gamma correction and simplification + * of code. + */ +void PNGAPI +png_build_grayscale_palette(int bit_depth, png_colorp palette) +{ + int num_palette; + int color_inc; + int i; + int v; + + png_debug(1, "in png_do_build_grayscale_palette\n"); + if (palette == NULL) + return; + + switch (bit_depth) + { + case 1: + num_palette = 2; + color_inc = 0xff; + break; + case 2: + num_palette = 4; + color_inc = 0x55; + break; + case 4: + num_palette = 16; + color_inc = 0x11; + break; + case 8: + num_palette = 256; + color_inc = 1; + break; + default: + num_palette = 0; + color_inc = 0; + break; + } + + for (i = 0, v = 0; i < num_palette; i++, v += color_inc) + { + palette[i].red = (png_byte)v; + palette[i].green = (png_byte)v; + palette[i].blue = (png_byte)v; + } +} + +/* This function is currently unused. Do we really need it? */ +#if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED) +void /* PRIVATE */ +png_correct_palette(png_structp png_ptr, png_colorp palette, + int num_palette) +{ + png_debug(1, "in png_correct_palette\n"); +#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ + defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) + if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND)) + { + png_color back, back_1; + + if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE) + { + back.red = png_ptr->gamma_table[png_ptr->background.red]; + back.green = png_ptr->gamma_table[png_ptr->background.green]; + back.blue = png_ptr->gamma_table[png_ptr->background.blue]; + + back_1.red = png_ptr->gamma_to_1[png_ptr->background.red]; + back_1.green = png_ptr->gamma_to_1[png_ptr->background.green]; + back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue]; + } + else + { + double g; + + g = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma); + + if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_SCREEN || + fabs(g - 1.0) < PNG_GAMMA_THRESHOLD) + { + back.red = png_ptr->background.red; + back.green = png_ptr->background.green; + back.blue = png_ptr->background.blue; + } + else + { + back.red = + (png_byte)(pow((double)png_ptr->background.red/255, g) * + 255.0 + 0.5); + back.green = + (png_byte)(pow((double)png_ptr->background.green/255, g) * + 255.0 + 0.5); + back.blue = + (png_byte)(pow((double)png_ptr->background.blue/255, g) * + 255.0 + 0.5); + } + + g = 1.0 / png_ptr->background_gamma; + + back_1.red = + (png_byte)(pow((double)png_ptr->background.red/255, g) * + 255.0 + 0.5); + back_1.green = + (png_byte)(pow((double)png_ptr->background.green/255, g) * + 255.0 + 0.5); + back_1.blue = + (png_byte)(pow((double)png_ptr->background.blue/255, g) * + 255.0 + 0.5); + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + png_uint_32 i; + + for (i = 0; i < (png_uint_32)num_palette; i++) + { + if (i < png_ptr->num_trans && png_ptr->trans[i] == 0) + { + palette[i] = back; + } + else if (i < png_ptr->num_trans && png_ptr->trans[i] != 0xff) + { + png_byte v, w; + + v = png_ptr->gamma_to_1[png_ptr->palette[i].red]; + png_composite(w, v, png_ptr->trans[i], back_1.red); + palette[i].red = png_ptr->gamma_from_1[w]; + + v = png_ptr->gamma_to_1[png_ptr->palette[i].green]; + png_composite(w, v, png_ptr->trans[i], back_1.green); + palette[i].green = png_ptr->gamma_from_1[w]; + + v = png_ptr->gamma_to_1[png_ptr->palette[i].blue]; + png_composite(w, v, png_ptr->trans[i], back_1.blue); + palette[i].blue = png_ptr->gamma_from_1[w]; + } + else + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + } + } + else + { + int i; + + for (i = 0; i < num_palette; i++) + { + if (palette[i].red == (png_byte)png_ptr->trans_values.gray) + { + palette[i] = back; + } + else + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + } + } + } + else +#endif +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (png_ptr->transformations & PNG_GAMMA) + { + int i; + + for (i = 0; i < num_palette; i++) + { + palette[i].red = png_ptr->gamma_table[palette[i].red]; + palette[i].green = png_ptr->gamma_table[palette[i].green]; + palette[i].blue = png_ptr->gamma_table[palette[i].blue]; + } + } +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + else +#endif +#endif +#if defined(PNG_READ_BACKGROUND_SUPPORTED) + if (png_ptr->transformations & PNG_BACKGROUND) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + png_color back; + + back.red = (png_byte)png_ptr->background.red; + back.green = (png_byte)png_ptr->background.green; + back.blue = (png_byte)png_ptr->background.blue; + + for (i = 0; i < (int)png_ptr->num_trans; i++) + { + if (png_ptr->trans[i] == 0) + { + palette[i].red = back.red; + palette[i].green = back.green; + palette[i].blue = back.blue; + } + else if (png_ptr->trans[i] != 0xff) + { + png_composite(palette[i].red, png_ptr->palette[i].red, + png_ptr->trans[i], back.red); + png_composite(palette[i].green, png_ptr->palette[i].green, + png_ptr->trans[i], back.green); + png_composite(palette[i].blue, png_ptr->palette[i].blue, + png_ptr->trans[i], back.blue); + } + } + } + else /* assume grayscale palette (what else could it be?) */ + { + int i; + + for (i = 0; i < num_palette; i++) + { + if (i == (png_byte)png_ptr->trans_values.gray) + { + palette[i].red = (png_byte)png_ptr->background.red; + palette[i].green = (png_byte)png_ptr->background.green; + palette[i].blue = (png_byte)png_ptr->background.blue; + } + } + } + } +#endif +} +#endif + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) +/* Replace any alpha or transparency with the supplied background color. + * "background" is already in the screen gamma, while "background_1" is + * at a gamma of 1.0. Paletted files have already been taken care of. + */ +void /* PRIVATE */ +png_do_background(png_row_infop row_info, png_bytep row, + png_color_16p trans_values, png_color_16p background +#if defined(PNG_READ_GAMMA_SUPPORTED) + , png_color_16p background_1, + png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, + png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, + png_uint_16pp gamma_16_to_1, int gamma_shift +#endif + ) +{ + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + int shift; + + png_debug(1, "in png_do_background\n"); + if (background != NULL && +#if defined(PNG_USELESS_TESTS_SUPPORTED) + row != NULL && row_info != NULL && +#endif + (!(row_info->color_type & PNG_COLOR_MASK_ALPHA) || + (row_info->color_type != PNG_COLOR_TYPE_PALETTE && trans_values))) + { + switch (row_info->color_type) + { + case PNG_COLOR_TYPE_GRAY: + { + switch (row_info->bit_depth) + { + case 1: + { + sp = row; + shift = 7; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x01) + == trans_values->gray) + { + *sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + if (!shift) + { + shift = 7; + sp++; + } + else + shift--; + } + break; + } + case 2: + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_table != NULL) + { + sp = row; + shift = 6; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x03) + == trans_values->gray) + { + *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + else + { + png_byte p = (png_byte)((*sp >> shift) & 0x03); + png_byte g = (png_byte)((gamma_table [p | (p << 2) | + (p << 4) | (p << 6)] >> 6) & 0x03); + *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *sp |= (png_byte)(g << shift); + } + if (!shift) + { + shift = 6; + sp++; + } + else + shift -= 2; + } + } + else +#endif + { + sp = row; + shift = 6; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x03) + == trans_values->gray) + { + *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + if (!shift) + { + shift = 6; + sp++; + } + else + shift -= 2; + } + } + break; + } + case 4: + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_table != NULL) + { + sp = row; + shift = 4; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x0f) + == trans_values->gray) + { + *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + else + { + png_byte p = (png_byte)((*sp >> shift) & 0x0f); + png_byte g = (png_byte)((gamma_table[p | + (p << 4)] >> 4) & 0x0f); + *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *sp |= (png_byte)(g << shift); + } + if (!shift) + { + shift = 4; + sp++; + } + else + shift -= 4; + } + } + else +#endif + { + sp = row; + shift = 4; + for (i = 0; i < row_width; i++) + { + if ((png_uint_16)((*sp >> shift) & 0x0f) + == trans_values->gray) + { + *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *sp |= (png_byte)(background->gray << shift); + } + if (!shift) + { + shift = 4; + sp++; + } + else + shift -= 4; + } + } + break; + } + case 8: + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_table != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp++) + { + if (*sp == trans_values->gray) + { + *sp = (png_byte)background->gray; + } + else + { + *sp = gamma_table[*sp]; + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp++) + { + if (*sp == trans_values->gray) + { + *sp = (png_byte)background->gray; + } + } + } + break; + } + case 16: + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_16 != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp += 2) + { + png_uint_16 v; + + v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + if (v == trans_values->gray) + { + /* background is already in screen gamma */ + *sp = (png_byte)((background->gray >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->gray & 0xff); + } + else + { + v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp += 2) + { + png_uint_16 v; + + v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + if (v == trans_values->gray) + { + *sp = (png_byte)((background->gray >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->gray & 0xff); + } + } + } + break; + } + } + break; + } + case PNG_COLOR_TYPE_RGB: + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_table != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp += 3) + { + if (*sp == trans_values->red && + *(sp + 1) == trans_values->green && + *(sp + 2) == trans_values->blue) + { + *sp = (png_byte)background->red; + *(sp + 1) = (png_byte)background->green; + *(sp + 2) = (png_byte)background->blue; + } + else + { + *sp = gamma_table[*sp]; + *(sp + 1) = gamma_table[*(sp + 1)]; + *(sp + 2) = gamma_table[*(sp + 2)]; + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp += 3) + { + if (*sp == trans_values->red && + *(sp + 1) == trans_values->green && + *(sp + 2) == trans_values->blue) + { + *sp = (png_byte)background->red; + *(sp + 1) = (png_byte)background->green; + *(sp + 2) = (png_byte)background->blue; + } + } + } + } + else /* if (row_info->bit_depth == 16) */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_16 != NULL) + { + sp = row; + for (i = 0; i < row_width; i++, sp += 6) + { + png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); + if (r == trans_values->red && g == trans_values->green && + b == trans_values->blue) + { + /* background is already in screen gamma */ + *sp = (png_byte)((background->red >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->red & 0xff); + *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(sp + 3) = (png_byte)(background->green & 0xff); + *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(sp + 5) = (png_byte)(background->blue & 0xff); + } + else + { + png_uint_16 v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)]; + *(sp + 2) = (png_byte)((v >> 8) & 0xff); + *(sp + 3) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)]; + *(sp + 4) = (png_byte)((v >> 8) & 0xff); + *(sp + 5) = (png_byte)(v & 0xff); + } + } + } + else +#endif + { + sp = row; + for (i = 0; i < row_width; i++, sp += 6) + { + png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp+1)); + png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); + + if (r == trans_values->red && g == trans_values->green && + b == trans_values->blue) + { + *sp = (png_byte)((background->red >> 8) & 0xff); + *(sp + 1) = (png_byte)(background->red & 0xff); + *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(sp + 3) = (png_byte)(background->green & 0xff); + *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(sp + 5) = (png_byte)(background->blue & 0xff); + } + } + } + } + break; + } + case PNG_COLOR_TYPE_GRAY_ALPHA: + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_to_1 != NULL && gamma_from_1 != NULL && + gamma_table != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 2, dp++) + { + png_uint_16 a = *(sp + 1); + + if (a == 0xff) + { + *dp = gamma_table[*sp]; + } + else if (a == 0) + { + /* background is already in screen gamma */ + *dp = (png_byte)background->gray; + } + else + { + png_byte v, w; + + v = gamma_to_1[*sp]; + png_composite(w, v, a, background_1->gray); + *dp = gamma_from_1[w]; + } + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 2, dp++) + { + png_byte a = *(sp + 1); + + if (a == 0xff) + { + *dp = *sp; + } +#if defined(PNG_READ_GAMMA_SUPPORTED) + else if (a == 0) + { + *dp = (png_byte)background->gray; + } + else + { + png_composite(*dp, *sp, a, background_1->gray); + } +#else + *dp = (png_byte)background->gray; +#endif + } + } + } + else /* if (png_ptr->bit_depth == 16) */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_16 != NULL && gamma_16_from_1 != NULL && + gamma_16_to_1 != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 2) + { + png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + + if (a == (png_uint_16)0xffff) + { + png_uint_16 v; + + v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + } +#if defined(PNG_READ_GAMMA_SUPPORTED) + else if (a == 0) +#else + else +#endif + { + /* background is already in screen gamma */ + *dp = (png_byte)((background->gray >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->gray & 0xff); + } +#if defined(PNG_READ_GAMMA_SUPPORTED) + else + { + png_uint_16 g, v, w; + + g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; + png_composite_16(v, g, a, background_1->gray); + w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8]; + *dp = (png_byte)((w >> 8) & 0xff); + *(dp + 1) = (png_byte)(w & 0xff); + } +#endif + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 2) + { + png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); + if (a == (png_uint_16)0xffff) + { + png_memcpy(dp, sp, 2); + } +#if defined(PNG_READ_GAMMA_SUPPORTED) + else if (a == 0) +#else + else +#endif + { + *dp = (png_byte)((background->gray >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->gray & 0xff); + } +#if defined(PNG_READ_GAMMA_SUPPORTED) + else + { + png_uint_16 g, v; + + g = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + png_composite_16(v, g, a, background_1->gray); + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + } +#endif + } + } + } + break; + } + case PNG_COLOR_TYPE_RGB_ALPHA: + { + if (row_info->bit_depth == 8) + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_to_1 != NULL && gamma_from_1 != NULL && + gamma_table != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 3) + { + png_byte a = *(sp + 3); + + if (a == 0xff) + { + *dp = gamma_table[*sp]; + *(dp + 1) = gamma_table[*(sp + 1)]; + *(dp + 2) = gamma_table[*(sp + 2)]; + } + else if (a == 0) + { + /* background is already in screen gamma */ + *dp = (png_byte)background->red; + *(dp + 1) = (png_byte)background->green; + *(dp + 2) = (png_byte)background->blue; + } + else + { + png_byte v, w; + + v = gamma_to_1[*sp]; + png_composite(w, v, a, background_1->red); + *dp = gamma_from_1[w]; + v = gamma_to_1[*(sp + 1)]; + png_composite(w, v, a, background_1->green); + *(dp + 1) = gamma_from_1[w]; + v = gamma_to_1[*(sp + 2)]; + png_composite(w, v, a, background_1->blue); + *(dp + 2) = gamma_from_1[w]; + } + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 4, dp += 3) + { + png_byte a = *(sp + 3); + + if (a == 0xff) + { + *dp = *sp; + *(dp + 1) = *(sp + 1); + *(dp + 2) = *(sp + 2); + } + else if (a == 0) + { + *dp = (png_byte)background->red; + *(dp + 1) = (png_byte)background->green; + *(dp + 2) = (png_byte)background->blue; + } + else + { + png_composite(*dp, *sp, a, background->red); + png_composite(*(dp + 1), *(sp + 1), a, + background->green); + png_composite(*(dp + 2), *(sp + 2), a, + background->blue); + } + } + } + } + else /* if (row_info->bit_depth == 16) */ + { +#if defined(PNG_READ_GAMMA_SUPPORTED) + if (gamma_16 != NULL && gamma_16_from_1 != NULL && + gamma_16_to_1 != NULL) + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 8, dp += 6) + { + png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6)) + << 8) + (png_uint_16)(*(sp + 7))); + if (a == (png_uint_16)0xffff) + { + png_uint_16 v; + + v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)]; + *(dp + 2) = (png_byte)((v >> 8) & 0xff); + *(dp + 3) = (png_byte)(v & 0xff); + v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)]; + *(dp + 4) = (png_byte)((v >> 8) & 0xff); + *(dp + 5) = (png_byte)(v & 0xff); + } + else if (a == 0) + { + /* background is already in screen gamma */ + *dp = (png_byte)((background->red >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->red & 0xff); + *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(dp + 3) = (png_byte)(background->green & 0xff); + *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(dp + 5) = (png_byte)(background->blue & 0xff); + } + else + { + png_uint_16 v, w, x; + + v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; + png_composite_16(w, v, a, background_1->red); + x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + *dp = (png_byte)((x >> 8) & 0xff); + *(dp + 1) = (png_byte)(x & 0xff); + v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; + png_composite_16(w, v, a, background_1->green); + x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + *(dp + 2) = (png_byte)((x >> 8) & 0xff); + *(dp + 3) = (png_byte)(x & 0xff); + v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; + png_composite_16(w, v, a, background_1->blue); + x = gamma_16_from_1[(w & 0xff) >> gamma_shift][w >> 8]; + *(dp + 4) = (png_byte)((x >> 8) & 0xff); + *(dp + 5) = (png_byte)(x & 0xff); + } + } + } + else +#endif + { + sp = row; + dp = row; + for (i = 0; i < row_width; i++, sp += 8, dp += 6) + { + png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6)) + << 8) + (png_uint_16)(*(sp + 7))); + if (a == (png_uint_16)0xffff) + { + png_memcpy(dp, sp, 6); + } + else if (a == 0) + { + *dp = (png_byte)((background->red >> 8) & 0xff); + *(dp + 1) = (png_byte)(background->red & 0xff); + *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); + *(dp + 3) = (png_byte)(background->green & 0xff); + *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); + *(dp + 5) = (png_byte)(background->blue & 0xff); + } + else + { + png_uint_16 v; + + png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1)); + png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8) + + *(sp + 3)); + png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8) + + *(sp + 5)); + + png_composite_16(v, r, a, background->red); + *dp = (png_byte)((v >> 8) & 0xff); + *(dp + 1) = (png_byte)(v & 0xff); + png_composite_16(v, g, a, background->green); + *(dp + 2) = (png_byte)((v >> 8) & 0xff); + *(dp + 3) = (png_byte)(v & 0xff); + png_composite_16(v, b, a, background->blue); + *(dp + 4) = (png_byte)((v >> 8) & 0xff); + *(dp + 5) = (png_byte)(v & 0xff); + } + } + } + } + break; + } + } + + if (row_info->color_type & PNG_COLOR_MASK_ALPHA) + { + row_info->color_type &= ~PNG_COLOR_MASK_ALPHA; + row_info->channels--; + row_info->pixel_depth = (png_byte)(row_info->channels * + row_info->bit_depth); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + } + } +} +#endif + +#if defined(PNG_READ_GAMMA_SUPPORTED) +/* Gamma correct the image, avoiding the alpha channel. Make sure + * you do this after you deal with the transparency issue on grayscale + * or RGB images. If your bit depth is 8, use gamma_table, if it + * is 16, use gamma_16_table and gamma_shift. Build these with + * build_gamma_table(). + */ +void /* PRIVATE */ +png_do_gamma(png_row_infop row_info, png_bytep row, + png_bytep gamma_table, png_uint_16pp gamma_16_table, + int gamma_shift) +{ + png_bytep sp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_gamma\n"); + if ( +#if defined(PNG_USELESS_TESTS_SUPPORTED) + row != NULL && row_info != NULL && +#endif + ((row_info->bit_depth <= 8 && gamma_table != NULL) || + (row_info->bit_depth == 16 && gamma_16_table != NULL))) + { + switch (row_info->color_type) + { + case PNG_COLOR_TYPE_RGB: + { + if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + } + } + else /* if (row_info->bit_depth == 16) */ + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v; + + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + } + } + break; + } + case PNG_COLOR_TYPE_RGB_ALPHA: + { + if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + *sp = gamma_table[*sp]; + sp++; + sp++; + } + } + else /* if (row_info->bit_depth == 16) */ + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 4; + } + } + break; + } + case PNG_COLOR_TYPE_GRAY_ALPHA: + { + if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp += 2; + } + } + else /* if (row_info->bit_depth == 16) */ + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 4; + } + } + break; + } + case PNG_COLOR_TYPE_GRAY: + { + if (row_info->bit_depth == 2) + { + sp = row; + for (i = 0; i < row_width; i += 4) + { + int a = *sp & 0xc0; + int b = *sp & 0x30; + int c = *sp & 0x0c; + int d = *sp & 0x03; + + *sp = (png_byte)( + ((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)| + ((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)| + ((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)| + ((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) )); + sp++; + } + } + if (row_info->bit_depth == 4) + { + sp = row; + for (i = 0; i < row_width; i += 2) + { + int msb = *sp & 0xf0; + int lsb = *sp & 0x0f; + + *sp = (png_byte)((((int)gamma_table[msb | (msb >> 4)]) & 0xf0) + | (((int)gamma_table[(lsb << 4) | lsb]) >> 4)); + sp++; + } + } + else if (row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++) + { + *sp = gamma_table[*sp]; + sp++; + } + } + else if (row_info->bit_depth == 16) + { + sp = row; + for (i = 0; i < row_width; i++) + { + png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; + *sp = (png_byte)((v >> 8) & 0xff); + *(sp + 1) = (png_byte)(v & 0xff); + sp += 2; + } + } + break; + } + } + } +} +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) +/* Expands a palette row to an RGB or RGBA row depending + * upon whether you supply trans and num_trans. + */ +void /* PRIVATE */ +png_do_expand_palette(png_row_infop row_info, png_bytep row, + png_colorp palette, png_bytep trans, int num_trans) +{ + int shift, value; + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_expand_palette\n"); + if ( +#if defined(PNG_USELESS_TESTS_SUPPORTED) + row != NULL && row_info != NULL && +#endif + row_info->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (row_info->bit_depth < 8) + { + switch (row_info->bit_depth) + { + case 1: + { + sp = row + (png_size_t)((row_width - 1) >> 3); + dp = row + (png_size_t)row_width - 1; + shift = 7 - (int)((row_width + 7) & 0x07); + for (i = 0; i < row_width; i++) + { + if ((*sp >> shift) & 0x01) + *dp = 1; + else + *dp = 0; + if (shift == 7) + { + shift = 0; + sp--; + } + else + shift++; + + dp--; + } + break; + } + case 2: + { + sp = row + (png_size_t)((row_width - 1) >> 2); + dp = row + (png_size_t)row_width - 1; + shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x03; + *dp = (png_byte)value; + if (shift == 6) + { + shift = 0; + sp--; + } + else + shift += 2; + + dp--; + } + break; + } + case 4: + { + sp = row + (png_size_t)((row_width - 1) >> 1); + dp = row + (png_size_t)row_width - 1; + shift = (int)((row_width & 0x01) << 2); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x0f; + *dp = (png_byte)value; + if (shift == 4) + { + shift = 0; + sp--; + } + else + shift += 4; + + dp--; + } + break; + } + } + row_info->bit_depth = 8; + row_info->pixel_depth = 8; + row_info->rowbytes = row_width; + } + switch (row_info->bit_depth) + { + case 8: + { + if (trans != NULL) + { + sp = row + (png_size_t)row_width - 1; + dp = row + (png_size_t)(row_width << 2) - 1; + + for (i = 0; i < row_width; i++) + { + if ((int)(*sp) >= num_trans) + *dp-- = 0xff; + else + *dp-- = trans[*sp]; + *dp-- = palette[*sp].blue; + *dp-- = palette[*sp].green; + *dp-- = palette[*sp].red; + sp--; + } + row_info->bit_depth = 8; + row_info->pixel_depth = 32; + row_info->rowbytes = row_width * 4; + row_info->color_type = 6; + row_info->channels = 4; + } + else + { + sp = row + (png_size_t)row_width - 1; + dp = row + (png_size_t)(row_width * 3) - 1; + + for (i = 0; i < row_width; i++) + { + *dp-- = palette[*sp].blue; + *dp-- = palette[*sp].green; + *dp-- = palette[*sp].red; + sp--; + } + row_info->bit_depth = 8; + row_info->pixel_depth = 24; + row_info->rowbytes = row_width * 3; + row_info->color_type = 2; + row_info->channels = 3; + } + break; + } + } + } +} + +/* If the bit depth < 8, it is expanded to 8. Also, if the + * transparency value is supplied, an alpha channel is built. + */ +void /* PRIVATE */ +png_do_expand(png_row_infop row_info, png_bytep row, + png_color_16p trans_value) +{ + int shift, value; + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_expand\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL) +#endif + { + if (row_info->color_type == PNG_COLOR_TYPE_GRAY) + { + png_uint_16 gray = (png_uint_16)(trans_value ? trans_value->gray : 0); + + if (row_info->bit_depth < 8) + { + switch (row_info->bit_depth) + { + case 1: + { + gray = (png_uint_16)(gray*0xff); + sp = row + (png_size_t)((row_width - 1) >> 3); + dp = row + (png_size_t)row_width - 1; + shift = 7 - (int)((row_width + 7) & 0x07); + for (i = 0; i < row_width; i++) + { + if ((*sp >> shift) & 0x01) + *dp = 0xff; + else + *dp = 0; + if (shift == 7) + { + shift = 0; + sp--; + } + else + shift++; + + dp--; + } + break; + } + case 2: + { + gray = (png_uint_16)(gray*0x55); + sp = row + (png_size_t)((row_width - 1) >> 2); + dp = row + (png_size_t)row_width - 1; + shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x03; + *dp = (png_byte)(value | (value << 2) | (value << 4) | + (value << 6)); + if (shift == 6) + { + shift = 0; + sp--; + } + else + shift += 2; + + dp--; + } + break; + } + case 4: + { + gray = (png_uint_16)(gray*0x11); + sp = row + (png_size_t)((row_width - 1) >> 1); + dp = row + (png_size_t)row_width - 1; + shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); + for (i = 0; i < row_width; i++) + { + value = (*sp >> shift) & 0x0f; + *dp = (png_byte)(value | (value << 4)); + if (shift == 4) + { + shift = 0; + sp--; + } + else + shift = 4; + + dp--; + } + break; + } + } + row_info->bit_depth = 8; + row_info->pixel_depth = 8; + row_info->rowbytes = row_width; + } + + if (trans_value != NULL) + { + if (row_info->bit_depth == 8) + { + sp = row + (png_size_t)row_width - 1; + dp = row + (png_size_t)(row_width << 1) - 1; + for (i = 0; i < row_width; i++) + { + if (*sp == gray) + *dp-- = 0; + else + *dp-- = 0xff; + *dp-- = *sp--; + } + } + else if (row_info->bit_depth == 16) + { + sp = row + row_info->rowbytes - 1; + dp = row + (row_info->rowbytes << 1) - 1; + for (i = 0; i < row_width; i++) + { + if (((png_uint_16)*(sp) | + ((png_uint_16)*(sp - 1) << 8)) == gray) + { + *dp-- = 0; + *dp-- = 0; + } + else + { + *dp-- = 0xff; + *dp-- = 0xff; + } + *dp-- = *sp--; + *dp-- = *sp--; + } + } + row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA; + row_info->channels = 2; + row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, + row_width); + } + } + else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_value) + { + if (row_info->bit_depth == 8) + { + sp = row + (png_size_t)row_info->rowbytes - 1; + dp = row + (png_size_t)(row_width << 2) - 1; + for (i = 0; i < row_width; i++) + { + if (*(sp - 2) == trans_value->red && + *(sp - 1) == trans_value->green && + *(sp - 0) == trans_value->blue) + *dp-- = 0; + else + *dp-- = 0xff; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + } + } + else if (row_info->bit_depth == 16) + { + sp = row + row_info->rowbytes - 1; + dp = row + (png_size_t)(row_width << 3) - 1; + for (i = 0; i < row_width; i++) + { + if ((((png_uint_16)*(sp - 4) | + ((png_uint_16)*(sp - 5) << 8)) == trans_value->red) && + (((png_uint_16)*(sp - 2) | + ((png_uint_16)*(sp - 3) << 8)) == trans_value->green) && + (((png_uint_16)*(sp - 0) | + ((png_uint_16)*(sp - 1) << 8)) == trans_value->blue)) + { + *dp-- = 0; + *dp-- = 0; + } + else + { + *dp-- = 0xff; + *dp-- = 0xff; + } + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + *dp-- = *sp--; + } + } + row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA; + row_info->channels = 4; + row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + } + } +} +#endif + +#if defined(PNG_READ_DITHER_SUPPORTED) +void /* PRIVATE */ +png_do_dither(png_row_infop row_info, png_bytep row, + png_bytep palette_lookup, png_bytep dither_lookup) +{ + png_bytep sp, dp; + png_uint_32 i; + png_uint_32 row_width=row_info->width; + + png_debug(1, "in png_do_dither\n"); +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL) +#endif + { + if (row_info->color_type == PNG_COLOR_TYPE_RGB && + palette_lookup && row_info->bit_depth == 8) + { + int r, g, b, p; + sp = row; + dp = row; + for (i = 0; i < row_width; i++) + { + r = *sp++; + g = *sp++; + b = *sp++; + + /* this looks real messy, but the compiler will reduce + it down to a reasonable formula. For example, with + 5 bits per color, we get: + p = (((r >> 3) & 0x1f) << 10) | + (((g >> 3) & 0x1f) << 5) | + ((b >> 3) & 0x1f); + */ + p = (((r >> (8 - PNG_DITHER_RED_BITS)) & + ((1 << PNG_DITHER_RED_BITS) - 1)) << + (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | + (((g >> (8 - PNG_DITHER_GREEN_BITS)) & + ((1 << PNG_DITHER_GREEN_BITS) - 1)) << + (PNG_DITHER_BLUE_BITS)) | + ((b >> (8 - PNG_DITHER_BLUE_BITS)) & + ((1 << PNG_DITHER_BLUE_BITS) - 1)); + + *dp++ = palette_lookup[p]; + } + row_info->color_type = PNG_COLOR_TYPE_PALETTE; + row_info->channels = 1; + row_info->pixel_depth = row_info->bit_depth; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + } + else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && + palette_lookup != NULL && row_info->bit_depth == 8) + { + int r, g, b, p; + sp = row; + dp = row; + for (i = 0; i < row_width; i++) + { + r = *sp++; + g = *sp++; + b = *sp++; + sp++; + + p = (((r >> (8 - PNG_DITHER_RED_BITS)) & + ((1 << PNG_DITHER_RED_BITS) - 1)) << + (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | + (((g >> (8 - PNG_DITHER_GREEN_BITS)) & + ((1 << PNG_DITHER_GREEN_BITS) - 1)) << + (PNG_DITHER_BLUE_BITS)) | + ((b >> (8 - PNG_DITHER_BLUE_BITS)) & + ((1 << PNG_DITHER_BLUE_BITS) - 1)); + + *dp++ = palette_lookup[p]; + } + row_info->color_type = PNG_COLOR_TYPE_PALETTE; + row_info->channels = 1; + row_info->pixel_depth = row_info->bit_depth; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + } + else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && + dither_lookup && row_info->bit_depth == 8) + { + sp = row; + for (i = 0; i < row_width; i++, sp++) + { + *sp = dither_lookup[*sp]; + } + } + } +} +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +#if defined(PNG_READ_GAMMA_SUPPORTED) +static int png_gamma_shift[] = + {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0}; + +/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit + * tables, we don't make a full table if we are reducing to 8-bit in + * the future. Note also how the gamma_16 tables are segmented so that + * we don't need to allocate > 64K chunks for a full 16-bit table. + */ +void /* PRIVATE */ +png_build_gamma_table(png_structp png_ptr) +{ + png_debug(1, "in png_build_gamma_table\n"); + if(png_ptr->gamma != 0.0) + { + if (png_ptr->bit_depth <= 8) + { + int i; + double g; + + if (png_ptr->screen_gamma > .000001) + g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + else + g = 1.0; + + png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + + for (i = 0; i < 256; i++) + { + png_ptr->gamma_table[i] = (png_byte)(pow((double)i / 255.0, + g) * 255.0 + .5); + } + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ + defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + if (png_ptr->transformations & ((PNG_BACKGROUND) | PNG_RGB_TO_GRAY)) + { + + g = 1.0 / (png_ptr->gamma); + + png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + + for (i = 0; i < 256; i++) + { + png_ptr->gamma_to_1[i] = (png_byte)(pow((double)i / 255.0, + g) * 255.0 + .5); + } + + + png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + + if(png_ptr->screen_gamma > 0.000001) + g = 1.0 / png_ptr->screen_gamma; + else + g = png_ptr->gamma; /* probably doing rgb_to_gray */ + + for (i = 0; i < 256; i++) + { + png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0, + g) * 255.0 + .5); + + } + } +#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */ + } + else + { + double g; + int i, j, shift, num; + int sig_bit; + png_uint_32 ig; + + if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) + { + sig_bit = (int)png_ptr->sig_bit.red; + if ((int)png_ptr->sig_bit.green > sig_bit) + sig_bit = png_ptr->sig_bit.green; + if ((int)png_ptr->sig_bit.blue > sig_bit) + sig_bit = png_ptr->sig_bit.blue; + } + else + { + sig_bit = (int)png_ptr->sig_bit.gray; + } + + if (sig_bit > 0) + shift = 16 - sig_bit; + else + shift = 0; + + if (png_ptr->transformations & PNG_16_TO_8) + { + if (shift < (16 - PNG_MAX_GAMMA_8)) + shift = (16 - PNG_MAX_GAMMA_8); + } + + if (shift > 8) + shift = 8; + if (shift < 0) + shift = 0; + + png_ptr->gamma_shift = (png_byte)shift; + + num = (1 << (8 - shift)); + + if (png_ptr->screen_gamma > .000001) + g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); + else + g = 1.0; + + png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr, + (png_uint_32)(num * png_sizeof (png_uint_16p))); + + if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND)) + { + double fin, fout; + png_uint_32 last, max; + + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof (png_uint_16))); + } + + g = 1.0 / g; + last = 0; + for (i = 0; i < 256; i++) + { + fout = ((double)i + 0.5) / 256.0; + fin = pow(fout, g); + max = (png_uint_32)(fin * (double)((png_uint_32)num << 8)); + while (last <= max) + { + png_ptr->gamma_16_table[(int)(last & (0xff >> shift))] + [(int)(last >> (8 - shift))] = (png_uint_16)( + (png_uint_16)i | ((png_uint_16)i << 8)); + last++; + } + } + while (last < ((png_uint_32)num << 8)) + { + png_ptr->gamma_16_table[(int)(last & (0xff >> shift))] + [(int)(last >> (8 - shift))] = (png_uint_16)65535L; + last++; + } + } + else + { + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof (png_uint_16))); + + ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4); + for (j = 0; j < 256; j++) + { + png_ptr->gamma_16_table[i][j] = + (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / + 65535.0, g) * 65535.0 + .5); + } + } + } + +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ + defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) + if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY)) + { + + g = 1.0 / (png_ptr->gamma); + + png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr, + (png_uint_32)(num * png_sizeof (png_uint_16p ))); + + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof (png_uint_16))); + + ig = (((png_uint_32)i * + (png_uint_32)png_gamma_shift[shift]) >> 4); + for (j = 0; j < 256; j++) + { + png_ptr->gamma_16_to_1[i][j] = + (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / + 65535.0, g) * 65535.0 + .5); + } + } + + if(png_ptr->screen_gamma > 0.000001) + g = 1.0 / png_ptr->screen_gamma; + else + g = png_ptr->gamma; /* probably doing rgb_to_gray */ + + png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr, + (png_uint_32)(num * png_sizeof (png_uint_16p))); + + for (i = 0; i < num; i++) + { + png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(256 * png_sizeof (png_uint_16))); + + ig = (((png_uint_32)i * + (png_uint_32)png_gamma_shift[shift]) >> 4); + for (j = 0; j < 256; j++) + { + png_ptr->gamma_16_from_1[i][j] = + (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / + 65535.0, g) * 65535.0 + .5); + } + } + } +#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */ + } + } +} +#endif +/* To do: install integer version of png_build_gamma_table here */ +#endif + +#if defined(PNG_MNG_FEATURES_SUPPORTED) +/* undoes intrapixel differencing */ +void /* PRIVATE */ +png_do_read_intrapixel(png_row_infop row_info, png_bytep row) +{ + png_debug(1, "in png_do_read_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)((256 + *rp + *(rp+1))&0xff); + *(rp+2) = (png_byte)((256 + *(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+65536L) & 0xffffL); + png_uint_32 blue = (png_uint_32)((s2+s1+65536L) & 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 */ diff --git a/src/SFML/Graphics/libpng/pngrutil.c b/src/SFML/Graphics/libpng/pngrutil.c new file mode 100644 index 00000000..6c1cdf76 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngrutil.c @@ -0,0 +1,3124 @@ +/* pngrutil.c - utilities to read a PNG file + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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 contains routines that are only called from within + * libpng itself during the course of reading an image. + */ + +#define PNG_INTERNAL +#include "png.h" + +#if defined(_WIN32_WCE) +/* strtod() function is not supported on WindowsCE */ +# ifdef PNG_FLOATING_POINT_SUPPORTED +__inline double strtod(const char *nptr, char **endptr) +{ + double result = 0; + int len; + wchar_t *str, *end; + + len = MultiByteToWideChar(CP_ACP, 0, nptr, -1, NULL, 0); + str = (wchar_t *)malloc(len * sizeof(wchar_t)); + if ( NULL != str ) + { + MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len); + result = wcstod(str, &end); + len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL); + *endptr = (char *)nptr + (png_strlen(nptr) - len + 1); + free(str); + } + return result; +} +# endif +#endif + +png_uint_32 /* PRIVATE */ +png_get_uint_31(png_structp png_ptr, png_bytep buf) +{ + png_uint_32 i = png_get_uint_32(buf); + if (i > PNG_UINT_31_MAX) + png_error(png_ptr, "PNG unsigned integer out of range.\n"); + return (i); +} +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ +png_uint_32 /* PRIVATE */ +png_get_uint_32(png_bytep buf) +{ + png_uint_32 i = ((png_uint_32)(*buf) << 24) + + ((png_uint_32)(*(buf + 1)) << 16) + + ((png_uint_32)(*(buf + 2)) << 8) + + (png_uint_32)(*(buf + 3)); + + return (i); +} + +#if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_oFFs_SUPPORTED) +/* Grab a signed 32-bit integer from a buffer in big-endian format. The + * data is stored in the PNG file in two's complement format, and it is + * assumed that the machine format for signed integers is the same. */ +png_int_32 /* PRIVATE */ +png_get_int_32(png_bytep buf) +{ + png_int_32 i = ((png_int_32)(*buf) << 24) + + ((png_int_32)(*(buf + 1)) << 16) + + ((png_int_32)(*(buf + 2)) << 8) + + (png_int_32)(*(buf + 3)); + + return (i); +} +#endif /* PNG_READ_pCAL_SUPPORTED */ + +/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ +png_uint_16 /* PRIVATE */ +png_get_uint_16(png_bytep buf) +{ + png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + + (png_uint_16)(*(buf + 1))); + + return (i); +} +#endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */ + +/* Read data, and (optionally) run it through the CRC. */ +void /* PRIVATE */ +png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) +{ + png_read_data(png_ptr, buf, length); + png_calculate_crc(png_ptr, buf, length); +} + +/* Optionally skip data and then check the CRC. Depending on whether we + are reading a ancillary or critical chunk, and how the program has set + things up, we may calculate the CRC on the data and print a message. + Returns '1' if there was a CRC error, '0' otherwise. */ +int /* PRIVATE */ +png_crc_finish(png_structp png_ptr, png_uint_32 skip) +{ + png_size_t i; + png_size_t istop = png_ptr->zbuf_size; + + for (i = (png_size_t)skip; i > istop; i -= istop) + { + png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); + } + if (i) + { + png_crc_read(png_ptr, png_ptr->zbuf, i); + } + + if (png_crc_error(png_ptr)) + { + if (((png_ptr->chunk_name[0] & 0x20) && /* Ancillary */ + !(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) || + (!(png_ptr->chunk_name[0] & 0x20) && /* Critical */ + (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE))) + { + png_chunk_warning(png_ptr, "CRC error"); + } + else + { + png_chunk_error(png_ptr, "CRC error"); + } + return (1); + } + + return (0); +} + +/* Compare the CRC stored in the PNG file with that calculated by libpng from + the data it has read thus far. */ +int /* PRIVATE */ +png_crc_error(png_structp png_ptr) +{ + png_byte crc_bytes[4]; + png_uint_32 crc; + 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; + } + + png_read_data(png_ptr, crc_bytes, 4); + + if (need_crc) + { + crc = png_get_uint_32(crc_bytes); + return ((int)(crc != png_ptr->crc)); + } + else + return (0); +} + +#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ + defined(PNG_READ_iCCP_SUPPORTED) +/* + * Decompress trailing data in a chunk. The assumption is that chunkdata + * points at an allocated area holding the contents of a chunk with a + * trailing compressed part. What we get back is an allocated area + * holding the original prefix part and an uncompressed version of the + * trailing part (the malloc area passed in is freed). + */ +png_charp /* PRIVATE */ +png_decompress_chunk(png_structp png_ptr, int comp_type, + png_charp chunkdata, png_size_t chunklength, + png_size_t prefix_size, png_size_t *newlength) +{ + static char msg[] = "Error decoding compressed text"; + png_charp text; + png_size_t text_size; + + if (comp_type == PNG_COMPRESSION_TYPE_BASE) + { + int ret = Z_OK; + png_ptr->zstream.next_in = (png_bytep)(chunkdata + prefix_size); + png_ptr->zstream.avail_in = (uInt)(chunklength - prefix_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + text_size = 0; + text = NULL; + + while (png_ptr->zstream.avail_in) + { + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret != Z_OK && ret != Z_STREAM_END) + { + if (png_ptr->zstream.msg != NULL) + png_warning(png_ptr, png_ptr->zstream.msg); + else + png_warning(png_ptr, msg); + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + + if (text == NULL) + { + text_size = prefix_size + png_sizeof(msg) + 1; + text = (png_charp)png_malloc_warn(png_ptr, text_size); + if (text == NULL) + { + png_free(png_ptr,chunkdata); + png_error(png_ptr,"Not enough memory to decompress chunk"); + } + png_memcpy(text, chunkdata, prefix_size); + } + + text[text_size - 1] = 0x00; + + /* Copy what we can of the error message into the text chunk */ + text_size = (png_size_t)(chunklength - (text - chunkdata) - 1); + text_size = png_sizeof(msg) > text_size ? text_size : + png_sizeof(msg); + png_memcpy(text + prefix_size, msg, text_size + 1); + break; + } + if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END) + { + if (text == NULL) + { + text_size = prefix_size + + png_ptr->zbuf_size - png_ptr->zstream.avail_out; + text = (png_charp)png_malloc_warn(png_ptr, text_size + 1); + if (text == NULL) + { + png_free(png_ptr,chunkdata); + png_error(png_ptr,"Not enough memory to decompress chunk."); + } + png_memcpy(text + prefix_size, png_ptr->zbuf, + text_size - prefix_size); + png_memcpy(text, chunkdata, prefix_size); + *(text + text_size) = 0x00; + } + else + { + png_charp tmp; + + tmp = text; + text = (png_charp)png_malloc_warn(png_ptr, + (png_uint_32)(text_size + + png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1)); + if (text == NULL) + { + png_free(png_ptr, tmp); + png_free(png_ptr, chunkdata); + png_error(png_ptr,"Not enough memory to decompress chunk.."); + } + png_memcpy(text, tmp, text_size); + png_free(png_ptr, tmp); + png_memcpy(text + text_size, png_ptr->zbuf, + (png_ptr->zbuf_size - png_ptr->zstream.avail_out)); + text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; + *(text + text_size) = 0x00; + } + if (ret == Z_STREAM_END) + break; + else + { + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + } + } + if (ret != Z_STREAM_END) + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char umsg[50]; + + if (ret == Z_BUF_ERROR) + sprintf(umsg,"Buffer error in compressed datastream in %s chunk", + png_ptr->chunk_name); + else if (ret == Z_DATA_ERROR) + sprintf(umsg,"Data error in compressed datastream in %s chunk", + png_ptr->chunk_name); + else + sprintf(umsg,"Incomplete compressed datastream in %s chunk", + png_ptr->chunk_name); + png_warning(png_ptr, umsg); +#else + png_warning(png_ptr, + "Incomplete compressed datastream in chunk other than IDAT"); +#endif + text_size=prefix_size; + if (text == NULL) + { + text = (png_charp)png_malloc_warn(png_ptr, text_size+1); + if (text == NULL) + { + png_free(png_ptr, chunkdata); + png_error(png_ptr,"Not enough memory for text."); + } + png_memcpy(text, chunkdata, prefix_size); + } + *(text + text_size) = 0x00; + } + + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + + png_free(png_ptr, chunkdata); + chunkdata = text; + *newlength=text_size; + } + else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */ + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char umsg[50]; + + sprintf(umsg, "Unknown zTXt compression type %d", comp_type); + png_warning(png_ptr, umsg); +#else + png_warning(png_ptr, "Unknown zTXt compression type"); +#endif + + *(chunkdata + prefix_size) = 0x00; + *newlength=prefix_size; + } + + return chunkdata; +} +#endif + +/* read and check the IDHR chunk */ +void /* PRIVATE */ +png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[13]; + png_uint_32 width, height; + int bit_depth, color_type, compression_type, filter_type; + int interlace_type; + + png_debug(1, "in png_handle_IHDR\n"); + + if (png_ptr->mode & PNG_HAVE_IHDR) + png_error(png_ptr, "Out of place IHDR"); + + /* check the length */ + if (length != 13) + png_error(png_ptr, "Invalid IHDR chunk"); + + png_ptr->mode |= PNG_HAVE_IHDR; + + png_crc_read(png_ptr, buf, 13); + png_crc_finish(png_ptr, 0); + + width = png_get_uint_31(png_ptr, buf); + height = png_get_uint_31(png_ptr, buf + 4); + bit_depth = buf[8]; + color_type = buf[9]; + compression_type = buf[10]; + filter_type = buf[11]; + interlace_type = buf[12]; + + /* set internal variables */ + png_ptr->width = width; + png_ptr->height = height; + png_ptr->bit_depth = (png_byte)bit_depth; + png_ptr->interlaced = (png_byte)interlace_type; + png_ptr->color_type = (png_byte)color_type; +#if defined(PNG_MNG_FEATURES_SUPPORTED) + png_ptr->filter_type = (png_byte)filter_type; +#endif + png_ptr->compression_type = (png_byte)compression_type; + + /* find number of channels */ + switch (png_ptr->color_type) + { + case PNG_COLOR_TYPE_GRAY: + case PNG_COLOR_TYPE_PALETTE: + png_ptr->channels = 1; + break; + case PNG_COLOR_TYPE_RGB: + png_ptr->channels = 3; + break; + case PNG_COLOR_TYPE_GRAY_ALPHA: + png_ptr->channels = 2; + break; + case PNG_COLOR_TYPE_RGB_ALPHA: + png_ptr->channels = 4; + break; + } + + /* set up other useful info */ + png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * + png_ptr->channels); + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width); + png_debug1(3,"bit_depth = %d\n", png_ptr->bit_depth); + png_debug1(3,"channels = %d\n", png_ptr->channels); + png_debug1(3,"rowbytes = %lu\n", png_ptr->rowbytes); + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, + color_type, interlace_type, compression_type, filter_type); +} + +/* read and check the palette */ +void /* PRIVATE */ +png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_color palette[PNG_MAX_PALETTE_LENGTH]; + int num, i; +#ifndef PNG_NO_POINTER_INDEXING + png_colorp pal_ptr; +#endif + + png_debug(1, "in png_handle_PLTE\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before PLTE"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid PLTE after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + png_error(png_ptr, "Duplicate PLTE chunk"); + + png_ptr->mode |= PNG_HAVE_PLTE; + + if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) + { + png_warning(png_ptr, + "Ignoring PLTE chunk in grayscale PNG"); + png_crc_finish(png_ptr, length); + return; + } +#if !defined(PNG_READ_OPT_PLTE_SUPPORTED) + if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) + { + png_crc_finish(png_ptr, length); + return; + } +#endif + + if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3) + { + if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) + { + png_warning(png_ptr, "Invalid palette chunk"); + png_crc_finish(png_ptr, length); + return; + } + else + { + png_error(png_ptr, "Invalid palette chunk"); + } + } + + num = (int)length / 3; + +#ifndef PNG_NO_POINTER_INDEXING + for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) + { + png_byte buf[3]; + + png_crc_read(png_ptr, buf, 3); + pal_ptr->red = buf[0]; + pal_ptr->green = buf[1]; + pal_ptr->blue = buf[2]; + } +#else + for (i = 0; i < num; i++) + { + png_byte buf[3]; + + png_crc_read(png_ptr, buf, 3); + /* don't depend upon png_color being any order */ + palette[i].red = buf[0]; + palette[i].green = buf[1]; + palette[i].blue = buf[2]; + } +#endif + + /* If we actually NEED the PLTE chunk (ie for a paletted image), we do + whatever the normal CRC configuration tells us. However, if we + have an RGB image, the PLTE can be considered ancillary, so + we will act as though it is. */ +#if !defined(PNG_READ_OPT_PLTE_SUPPORTED) + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) +#endif + { + png_crc_finish(png_ptr, 0); + } +#if !defined(PNG_READ_OPT_PLTE_SUPPORTED) + else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */ + { + /* If we don't want to use the data from an ancillary chunk, + we have two options: an error abort, or a warning and we + ignore the data in this chunk (which should be OK, since + it's considered ancillary for a RGB or RGBA image). */ + if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE)) + { + if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) + { + png_chunk_error(png_ptr, "CRC error"); + } + else + { + png_chunk_warning(png_ptr, "CRC error"); + return; + } + } + /* Otherwise, we (optionally) emit a warning and use the chunk. */ + else if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) + { + png_chunk_warning(png_ptr, "CRC error"); + } + } +#endif + + png_set_PLTE(png_ptr, info_ptr, palette, num); + +#if defined(PNG_READ_tRNS_SUPPORTED) + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) + { + if (png_ptr->num_trans > (png_uint_16)num) + { + png_warning(png_ptr, "Truncating incorrect tRNS chunk length"); + png_ptr->num_trans = (png_uint_16)num; + } + if (info_ptr->num_trans > (png_uint_16)num) + { + png_warning(png_ptr, "Truncating incorrect info tRNS chunk length"); + info_ptr->num_trans = (png_uint_16)num; + } + } + } +#endif + +} + +void /* PRIVATE */ +png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_debug(1, "in png_handle_IEND\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT)) + { + png_error(png_ptr, "No image in file"); + } + + png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND); + + if (length != 0) + { + png_warning(png_ptr, "Incorrect IEND chunk length"); + } + png_crc_finish(png_ptr, length); + + if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */ + return; +} + +#if defined(PNG_READ_gAMA_SUPPORTED) +void /* PRIVATE */ +png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_fixed_point igamma; +#ifdef PNG_FLOATING_POINT_SUPPORTED + float file_gamma; +#endif + png_byte buf[4]; + + png_debug(1, "in png_handle_gAMA\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before gAMA"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid gAMA after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place gAMA chunk"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) +#if defined(PNG_READ_sRGB_SUPPORTED) + && !(info_ptr->valid & PNG_INFO_sRGB) +#endif + ) + { + png_warning(png_ptr, "Duplicate gAMA chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 4) + { + png_warning(png_ptr, "Incorrect gAMA chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 4); + if (png_crc_finish(png_ptr, 0)) + return; + + igamma = (png_fixed_point)png_get_uint_32(buf); + /* check for zero gamma */ + if (igamma == 0) + { + png_warning(png_ptr, + "Ignoring gAMA chunk with gamma=0"); + return; + } + +#if defined(PNG_READ_sRGB_SUPPORTED) + if (info_ptr->valid & PNG_INFO_sRGB) + if (PNG_OUT_OF_RANGE(igamma, 45500L, 500)) + { + png_warning(png_ptr, + "Ignoring incorrect gAMA value when sRGB is also present"); +#ifndef PNG_NO_CONSOLE_IO + fprintf(stderr, "gamma = (%d/100000)\n", (int)igamma); +#endif + return; + } +#endif /* PNG_READ_sRGB_SUPPORTED */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED + file_gamma = (float)igamma / (float)100000.0; +# ifdef PNG_READ_GAMMA_SUPPORTED + png_ptr->gamma = file_gamma; +# endif + png_set_gAMA(png_ptr, info_ptr, file_gamma); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_gAMA_fixed(png_ptr, info_ptr, igamma); +#endif +} +#endif + +#if defined(PNG_READ_sBIT_SUPPORTED) +void /* PRIVATE */ +png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_size_t truelen; + png_byte buf[4]; + + png_debug(1, "in png_handle_sBIT\n"); + + buf[0] = buf[1] = buf[2] = buf[3] = 0; + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sBIT"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sBIT after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + { + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place sBIT chunk"); + } + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)) + { + png_warning(png_ptr, "Duplicate sBIT chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + truelen = 3; + else + truelen = (png_size_t)png_ptr->channels; + + if (length != truelen || length > 4) + { + png_warning(png_ptr, "Incorrect sBIT chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, truelen); + if (png_crc_finish(png_ptr, 0)) + return; + + if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) + { + png_ptr->sig_bit.red = buf[0]; + png_ptr->sig_bit.green = buf[1]; + png_ptr->sig_bit.blue = buf[2]; + png_ptr->sig_bit.alpha = buf[3]; + } + else + { + png_ptr->sig_bit.gray = buf[0]; + png_ptr->sig_bit.red = buf[0]; + png_ptr->sig_bit.green = buf[0]; + png_ptr->sig_bit.blue = buf[0]; + png_ptr->sig_bit.alpha = buf[1]; + } + png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit)); +} +#endif + +#if defined(PNG_READ_cHRM_SUPPORTED) +void /* PRIVATE */ +png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[4]; +#ifdef PNG_FLOATING_POINT_SUPPORTED + float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; +#endif + png_fixed_point int_x_white, int_y_white, int_x_red, int_y_red, int_x_green, + int_y_green, int_x_blue, int_y_blue; + + png_uint_32 uint_x, uint_y; + + png_debug(1, "in png_handle_cHRM\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before cHRM"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid cHRM after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Missing PLTE before cHRM"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM) +#if defined(PNG_READ_sRGB_SUPPORTED) + && !(info_ptr->valid & PNG_INFO_sRGB) +#endif + ) + { + png_warning(png_ptr, "Duplicate cHRM chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 32) + { + png_warning(png_ptr, "Incorrect cHRM chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 4); + uint_x = png_get_uint_32(buf); + + png_crc_read(png_ptr, buf, 4); + uint_y = png_get_uint_32(buf); + + if (uint_x > 80000L || uint_y > 80000L || + uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM white point"); + png_crc_finish(png_ptr, 24); + return; + } + int_x_white = (png_fixed_point)uint_x; + int_y_white = (png_fixed_point)uint_y; + + png_crc_read(png_ptr, buf, 4); + uint_x = png_get_uint_32(buf); + + png_crc_read(png_ptr, buf, 4); + uint_y = png_get_uint_32(buf); + + if (uint_x > 80000L || uint_y > 80000L || + uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM red point"); + png_crc_finish(png_ptr, 16); + return; + } + int_x_red = (png_fixed_point)uint_x; + int_y_red = (png_fixed_point)uint_y; + + png_crc_read(png_ptr, buf, 4); + uint_x = png_get_uint_32(buf); + + png_crc_read(png_ptr, buf, 4); + uint_y = png_get_uint_32(buf); + + if (uint_x > 80000L || uint_y > 80000L || + uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM green point"); + png_crc_finish(png_ptr, 8); + return; + } + int_x_green = (png_fixed_point)uint_x; + int_y_green = (png_fixed_point)uint_y; + + png_crc_read(png_ptr, buf, 4); + uint_x = png_get_uint_32(buf); + + png_crc_read(png_ptr, buf, 4); + uint_y = png_get_uint_32(buf); + + if (uint_x > 80000L || uint_y > 80000L || + uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM blue point"); + png_crc_finish(png_ptr, 0); + return; + } + int_x_blue = (png_fixed_point)uint_x; + int_y_blue = (png_fixed_point)uint_y; + +#ifdef PNG_FLOATING_POINT_SUPPORTED + white_x = (float)int_x_white / (float)100000.0; + white_y = (float)int_y_white / (float)100000.0; + red_x = (float)int_x_red / (float)100000.0; + red_y = (float)int_y_red / (float)100000.0; + green_x = (float)int_x_green / (float)100000.0; + green_y = (float)int_y_green / (float)100000.0; + blue_x = (float)int_x_blue / (float)100000.0; + blue_y = (float)int_y_blue / (float)100000.0; +#endif + +#if defined(PNG_READ_sRGB_SUPPORTED) + if (info_ptr->valid & PNG_INFO_sRGB) + { + if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) || + PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) || + PNG_OUT_OF_RANGE(int_x_red, 64000L, 1000) || + PNG_OUT_OF_RANGE(int_y_red, 33000, 1000) || + PNG_OUT_OF_RANGE(int_x_green, 30000, 1000) || + PNG_OUT_OF_RANGE(int_y_green, 60000L, 1000) || + PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) || + PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000)) + { + + png_warning(png_ptr, + "Ignoring incorrect cHRM value when sRGB is also present"); +#ifndef PNG_NO_CONSOLE_IO +#ifdef PNG_FLOATING_POINT_SUPPORTED + fprintf(stderr,"wx=%f, wy=%f, rx=%f, ry=%f\n", + white_x, white_y, red_x, red_y); + fprintf(stderr,"gx=%f, gy=%f, bx=%f, by=%f\n", + green_x, green_y, blue_x, blue_y); +#else + fprintf(stderr,"wx=%ld, wy=%ld, rx=%ld, ry=%ld\n", + int_x_white, int_y_white, int_x_red, int_y_red); + fprintf(stderr,"gx=%ld, gy=%ld, bx=%ld, by=%ld\n", + int_x_green, int_y_green, int_x_blue, int_y_blue); +#endif +#endif /* PNG_NO_CONSOLE_IO */ + } + png_crc_finish(png_ptr, 0); + return; + } +#endif /* PNG_READ_sRGB_SUPPORTED */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_set_cHRM(png_ptr, info_ptr, + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_cHRM_fixed(png_ptr, info_ptr, + int_x_white, int_y_white, int_x_red, int_y_red, int_x_green, + int_y_green, int_x_blue, int_y_blue); +#endif + if (png_crc_finish(png_ptr, 0)) + return; +} +#endif + +#if defined(PNG_READ_sRGB_SUPPORTED) +void /* PRIVATE */ +png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + int intent; + png_byte buf[1]; + + png_debug(1, "in png_handle_sRGB\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sRGB"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sRGB after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place sRGB chunk"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)) + { + png_warning(png_ptr, "Duplicate sRGB chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 1) + { + png_warning(png_ptr, "Incorrect sRGB chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 1); + if (png_crc_finish(png_ptr, 0)) + return; + + intent = buf[0]; + /* check for bad intent */ + if (intent >= PNG_sRGB_INTENT_LAST) + { + png_warning(png_ptr, "Unknown sRGB intent"); + return; + } + +#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) + if ((info_ptr->valid & PNG_INFO_gAMA)) + { + png_fixed_point igamma; +#ifdef PNG_FIXED_POINT_SUPPORTED + igamma=info_ptr->int_gamma; +#else +# ifdef PNG_FLOATING_POINT_SUPPORTED + igamma=(png_fixed_point)(info_ptr->gamma * 100000.); +# endif +#endif + if (PNG_OUT_OF_RANGE(igamma, 45500L, 500)) + { + png_warning(png_ptr, + "Ignoring incorrect gAMA value when sRGB is also present"); +#ifndef PNG_NO_CONSOLE_IO +# ifdef PNG_FIXED_POINT_SUPPORTED + fprintf(stderr,"incorrect gamma=(%d/100000)\n",(int)png_ptr->int_gamma); +# else +# ifdef PNG_FLOATING_POINT_SUPPORTED + fprintf(stderr,"incorrect gamma=%f\n",png_ptr->gamma); +# endif +# endif +#endif + } + } +#endif /* PNG_READ_gAMA_SUPPORTED */ + +#ifdef PNG_READ_cHRM_SUPPORTED +#ifdef PNG_FIXED_POINT_SUPPORTED + if (info_ptr->valid & PNG_INFO_cHRM) + if (PNG_OUT_OF_RANGE(info_ptr->int_x_white, 31270, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_white, 32900, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_x_red, 64000L, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_red, 33000, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_x_green, 30000, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_green, 60000L, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_x_blue, 15000, 1000) || + PNG_OUT_OF_RANGE(info_ptr->int_y_blue, 6000, 1000)) + { + png_warning(png_ptr, + "Ignoring incorrect cHRM value when sRGB is also present"); + } +#endif /* PNG_FIXED_POINT_SUPPORTED */ +#endif /* PNG_READ_cHRM_SUPPORTED */ + + png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent); +} +#endif /* PNG_READ_sRGB_SUPPORTED */ + +#if defined(PNG_READ_iCCP_SUPPORTED) +void /* PRIVATE */ +png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +/* Note: this does not properly handle chunks that are > 64K under DOS */ +{ + png_charp chunkdata; + png_byte compression_type; + png_bytep pC; + png_charp profile; + png_uint_32 skip = 0; + png_uint_32 profile_size, profile_length; + png_size_t slength, prefix_length, data_length; + + png_debug(1, "in png_handle_iCCP\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before iCCP"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid iCCP after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->mode & PNG_HAVE_PLTE) + /* Should be an error, but we can cope with it */ + png_warning(png_ptr, "Out of place iCCP chunk"); + + if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)) + { + png_warning(png_ptr, "Duplicate iCCP chunk"); + png_crc_finish(png_ptr, length); + return; + } + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "iCCP chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + chunkdata = (png_charp)png_malloc(png_ptr, length + 1); + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)chunkdata, slength); + + if (png_crc_finish(png_ptr, skip)) + { + png_free(png_ptr, chunkdata); + return; + } + + chunkdata[slength] = 0x00; + + for (profile = chunkdata; *profile; profile++) + /* empty loop to find end of name */ ; + + ++profile; + + /* there should be at least one zero (the compression type byte) + following the separator, and we should be on it */ + if ( profile >= chunkdata + slength) + { + png_free(png_ptr, chunkdata); + png_warning(png_ptr, "Malformed iCCP chunk"); + return; + } + + /* compression_type should always be zero */ + compression_type = *profile++; + if (compression_type) + { + png_warning(png_ptr, "Ignoring nonzero compression type in iCCP chunk"); + compression_type=0x00; /* Reset it to zero (libpng-1.0.6 through 1.0.8 + wrote nonzero) */ + } + + prefix_length = profile - chunkdata; + chunkdata = png_decompress_chunk(png_ptr, compression_type, chunkdata, + slength, prefix_length, &data_length); + + profile_length = data_length - prefix_length; + + if ( prefix_length > data_length || profile_length < 4) + { + png_free(png_ptr, chunkdata); + png_warning(png_ptr, "Profile size field missing from iCCP chunk"); + return; + } + + /* Check the profile_size recorded in the first 32 bits of the ICC profile */ + pC = (png_bytep)(chunkdata+prefix_length); + profile_size = ((*(pC ))<<24) | + ((*(pC+1))<<16) | + ((*(pC+2))<< 8) | + ((*(pC+3)) ); + + if(profile_size < profile_length) + profile_length = profile_size; + + if(profile_size > profile_length) + { + png_free(png_ptr, chunkdata); + png_warning(png_ptr, "Ignoring truncated iCCP profile.\n"); + return; + } + + png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type, + chunkdata + prefix_length, profile_length); + png_free(png_ptr, chunkdata); +} +#endif /* PNG_READ_iCCP_SUPPORTED */ + +#if defined(PNG_READ_sPLT_SUPPORTED) +void /* PRIVATE */ +png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +/* Note: this does not properly handle chunks that are > 64K under DOS */ +{ + png_bytep chunkdata; + png_bytep entry_start; + png_sPLT_t new_palette; +#ifdef PNG_NO_POINTER_INDEXING + png_sPLT_entryp pp; +#endif + int data_length, entry_size, i; + png_uint_32 skip = 0; + png_size_t slength; + + png_debug(1, "in png_handle_sPLT\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sPLT"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sPLT after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "sPLT chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + chunkdata = (png_bytep)png_malloc(png_ptr, length + 1); + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)chunkdata, slength); + + if (png_crc_finish(png_ptr, skip)) + { + png_free(png_ptr, chunkdata); + return; + } + + chunkdata[slength] = 0x00; + + for (entry_start = chunkdata; *entry_start; entry_start++) + /* empty loop to find end of name */ ; + ++entry_start; + + /* a sample depth should follow the separator, and we should be on it */ + if (entry_start > chunkdata + slength) + { + png_free(png_ptr, chunkdata); + png_warning(png_ptr, "malformed sPLT chunk"); + return; + } + + new_palette.depth = *entry_start++; + entry_size = (new_palette.depth == 8 ? 6 : 10); + data_length = (slength - (entry_start - chunkdata)); + + /* integrity-check the data length */ + if (data_length % entry_size) + { + png_free(png_ptr, chunkdata); + png_warning(png_ptr, "sPLT chunk has bad length"); + return; + } + + new_palette.nentries = (png_uint_32) (data_length / entry_size); + if ((png_uint_32) new_palette.nentries > (png_uint_32) (PNG_SIZE_MAX / + png_sizeof(png_sPLT_entry))) + { + png_warning(png_ptr, "sPLT chunk too long"); + return; + } + new_palette.entries = (png_sPLT_entryp)png_malloc_warn( + png_ptr, new_palette.nentries * png_sizeof(png_sPLT_entry)); + if (new_palette.entries == NULL) + { + png_warning(png_ptr, "sPLT chunk requires too much memory"); + return; + } + +#ifndef PNG_NO_POINTER_INDEXING + for (i = 0; i < new_palette.nentries; i++) + { + png_sPLT_entryp pp = new_palette.entries + i; + + if (new_palette.depth == 8) + { + pp->red = *entry_start++; + pp->green = *entry_start++; + pp->blue = *entry_start++; + pp->alpha = *entry_start++; + } + else + { + pp->red = png_get_uint_16(entry_start); entry_start += 2; + pp->green = png_get_uint_16(entry_start); entry_start += 2; + pp->blue = png_get_uint_16(entry_start); entry_start += 2; + pp->alpha = png_get_uint_16(entry_start); entry_start += 2; + } + pp->frequency = png_get_uint_16(entry_start); entry_start += 2; + } +#else + pp = new_palette.entries; + for (i = 0; i < new_palette.nentries; i++) + { + + if (new_palette.depth == 8) + { + pp[i].red = *entry_start++; + pp[i].green = *entry_start++; + pp[i].blue = *entry_start++; + pp[i].alpha = *entry_start++; + } + else + { + pp[i].red = png_get_uint_16(entry_start); entry_start += 2; + pp[i].green = png_get_uint_16(entry_start); entry_start += 2; + pp[i].blue = png_get_uint_16(entry_start); entry_start += 2; + pp[i].alpha = png_get_uint_16(entry_start); entry_start += 2; + } + pp->frequency = png_get_uint_16(entry_start); entry_start += 2; + } +#endif + + /* discard all chunk data except the name and stash that */ + new_palette.name = (png_charp)chunkdata; + + png_set_sPLT(png_ptr, info_ptr, &new_palette, 1); + + png_free(png_ptr, chunkdata); + png_free(png_ptr, new_palette.entries); +} +#endif /* PNG_READ_sPLT_SUPPORTED */ + +#if defined(PNG_READ_tRNS_SUPPORTED) +void /* PRIVATE */ +png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte readbuf[PNG_MAX_PALETTE_LENGTH]; + + png_debug(1, "in png_handle_tRNS\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before tRNS"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid tRNS after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) + { + png_warning(png_ptr, "Duplicate tRNS chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) + { + png_byte buf[2]; + + if (length != 2) + { + png_warning(png_ptr, "Incorrect tRNS chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 2); + png_ptr->num_trans = 1; + png_ptr->trans_values.gray = png_get_uint_16(buf); + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + png_byte buf[6]; + + if (length != 6) + { + png_warning(png_ptr, "Incorrect tRNS chunk length"); + png_crc_finish(png_ptr, length); + return; + } + png_crc_read(png_ptr, buf, (png_size_t)length); + png_ptr->num_trans = 1; + png_ptr->trans_values.red = png_get_uint_16(buf); + png_ptr->trans_values.green = png_get_uint_16(buf + 2); + png_ptr->trans_values.blue = png_get_uint_16(buf + 4); + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (!(png_ptr->mode & PNG_HAVE_PLTE)) + { + /* Should be an error, but we can cope with it. */ + png_warning(png_ptr, "Missing PLTE before tRNS"); + } + if (length > (png_uint_32)png_ptr->num_palette || + length > PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, "Incorrect tRNS chunk length"); + png_crc_finish(png_ptr, length); + return; + } + if (length == 0) + { + png_warning(png_ptr, "Zero length tRNS chunk"); + png_crc_finish(png_ptr, length); + return; + } + png_crc_read(png_ptr, readbuf, (png_size_t)length); + png_ptr->num_trans = (png_uint_16)length; + } + else + { + png_warning(png_ptr, "tRNS chunk not allowed with alpha channel"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_crc_finish(png_ptr, 0)) + return; + + png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans, + &(png_ptr->trans_values)); +} +#endif + +#if defined(PNG_READ_bKGD_SUPPORTED) +void /* PRIVATE */ +png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_size_t truelen; + png_byte buf[6]; + + png_debug(1, "in png_handle_bKGD\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before bKGD"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid bKGD after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + !(png_ptr->mode & PNG_HAVE_PLTE)) + { + png_warning(png_ptr, "Missing PLTE before bKGD"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)) + { + png_warning(png_ptr, "Duplicate bKGD chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + truelen = 1; + else if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) + truelen = 6; + else + truelen = 2; + + if (length != truelen) + { + png_warning(png_ptr, "Incorrect bKGD chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, truelen); + if (png_crc_finish(png_ptr, 0)) + return; + + /* We convert the index value into RGB components so that we can allow + * arbitrary RGB values for background when we have transparency, and + * so it is easy to determine the RGB values of the background color + * from the info_ptr struct. */ + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + png_ptr->background.index = buf[0]; + if(info_ptr->num_palette) + { + if(buf[0] > info_ptr->num_palette) + { + png_warning(png_ptr, "Incorrect bKGD chunk index value"); + return; + } + png_ptr->background.red = + (png_uint_16)png_ptr->palette[buf[0]].red; + png_ptr->background.green = + (png_uint_16)png_ptr->palette[buf[0]].green; + png_ptr->background.blue = + (png_uint_16)png_ptr->palette[buf[0]].blue; + } + } + else if (!(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) /* GRAY */ + { + png_ptr->background.red = + png_ptr->background.green = + png_ptr->background.blue = + png_ptr->background.gray = png_get_uint_16(buf); + } + else + { + png_ptr->background.red = png_get_uint_16(buf); + png_ptr->background.green = png_get_uint_16(buf + 2); + png_ptr->background.blue = png_get_uint_16(buf + 4); + } + + png_set_bKGD(png_ptr, info_ptr, &(png_ptr->background)); +} +#endif + +#if defined(PNG_READ_hIST_SUPPORTED) +void /* PRIVATE */ +png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + unsigned int num, i; + png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; + + png_debug(1, "in png_handle_hIST\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before hIST"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid hIST after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (!(png_ptr->mode & PNG_HAVE_PLTE)) + { + png_warning(png_ptr, "Missing PLTE before hIST"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)) + { + png_warning(png_ptr, "Duplicate hIST chunk"); + png_crc_finish(png_ptr, length); + return; + } + + num = length / 2 ; + if (num != (unsigned int) png_ptr->num_palette || num > + (unsigned int) PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, "Incorrect hIST chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + for (i = 0; i < num; i++) + { + png_byte buf[2]; + + png_crc_read(png_ptr, buf, 2); + readbuf[i] = png_get_uint_16(buf); + } + + if (png_crc_finish(png_ptr, 0)) + return; + + png_set_hIST(png_ptr, info_ptr, readbuf); +} +#endif + +#if defined(PNG_READ_pHYs_SUPPORTED) +void /* PRIVATE */ +png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[9]; + png_uint_32 res_x, res_y; + int unit_type; + + png_debug(1, "in png_handle_pHYs\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before pHYs"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid pHYs after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) + { + png_warning(png_ptr, "Duplicate pHYs chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 9) + { + png_warning(png_ptr, "Incorrect pHYs chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 9); + if (png_crc_finish(png_ptr, 0)) + return; + + res_x = png_get_uint_32(buf); + res_y = png_get_uint_32(buf + 4); + unit_type = buf[8]; + png_set_pHYs(png_ptr, info_ptr, res_x, res_y, unit_type); +} +#endif + +#if defined(PNG_READ_oFFs_SUPPORTED) +void /* PRIVATE */ +png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[9]; + png_int_32 offset_x, offset_y; + int unit_type; + + png_debug(1, "in png_handle_oFFs\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before oFFs"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid oFFs after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) + { + png_warning(png_ptr, "Duplicate oFFs chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (length != 9) + { + png_warning(png_ptr, "Incorrect oFFs chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 9); + if (png_crc_finish(png_ptr, 0)) + return; + + offset_x = png_get_int_32(buf); + offset_y = png_get_int_32(buf + 4); + unit_type = buf[8]; + png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, unit_type); +} +#endif + +#if defined(PNG_READ_pCAL_SUPPORTED) +/* read the pCAL chunk (described in the PNG Extensions document) */ +void /* PRIVATE */ +png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_charp purpose; + png_int_32 X0, X1; + png_byte type, nparams; + png_charp buf, units, endptr; + png_charpp params; + png_size_t slength; + int i; + + png_debug(1, "in png_handle_pCAL\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before pCAL"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid pCAL after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)) + { + png_warning(png_ptr, "Duplicate pCAL chunk"); + png_crc_finish(png_ptr, length); + return; + } + + png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n", + length + 1); + purpose = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (purpose == NULL) + { + png_warning(png_ptr, "No memory for pCAL purpose."); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)purpose, slength); + + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, purpose); + return; + } + + purpose[slength] = 0x00; /* null terminate the last string */ + + png_debug(3, "Finding end of pCAL purpose string\n"); + for (buf = purpose; *buf; buf++) + /* empty loop */ ; + + endptr = purpose + slength; + + /* We need to have at least 12 bytes after the purpose string + in order to get the parameter information. */ + if (endptr <= buf + 12) + { + png_warning(png_ptr, "Invalid pCAL data"); + png_free(png_ptr, purpose); + return; + } + + png_debug(3, "Reading pCAL X0, X1, type, nparams, and units\n"); + X0 = png_get_int_32((png_bytep)buf+1); + X1 = png_get_int_32((png_bytep)buf+5); + type = buf[9]; + nparams = buf[10]; + units = buf + 11; + + png_debug(3, "Checking pCAL equation type and number of parameters\n"); + /* Check that we have the right number of parameters for known + equation types. */ + if ((type == PNG_EQUATION_LINEAR && nparams != 2) || + (type == PNG_EQUATION_BASE_E && nparams != 3) || + (type == PNG_EQUATION_ARBITRARY && nparams != 3) || + (type == PNG_EQUATION_HYPERBOLIC && nparams != 4)) + { + png_warning(png_ptr, "Invalid pCAL parameters for equation type"); + png_free(png_ptr, purpose); + return; + } + else if (type >= PNG_EQUATION_LAST) + { + png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); + } + + for (buf = units; *buf; buf++) + /* Empty loop to move past the units string. */ ; + + png_debug(3, "Allocating pCAL parameters array\n"); + params = (png_charpp)png_malloc_warn(png_ptr, (png_uint_32)(nparams + *png_sizeof(png_charp))) ; + if (params == NULL) + { + png_free(png_ptr, purpose); + png_warning(png_ptr, "No memory for pCAL params."); + return; + } + + /* Get pointers to the start of each parameter string. */ + for (i = 0; i < (int)nparams; i++) + { + buf++; /* Skip the null string terminator from previous parameter. */ + + png_debug1(3, "Reading pCAL parameter %d\n", i); + for (params[i] = buf; *buf != 0x00 && buf <= endptr; buf++) + /* Empty loop to move past each parameter string */ ; + + /* Make sure we haven't run out of data yet */ + if (buf > endptr) + { + png_warning(png_ptr, "Invalid pCAL data"); + png_free(png_ptr, purpose); + png_free(png_ptr, params); + return; + } + } + + png_set_pCAL(png_ptr, info_ptr, purpose, X0, X1, type, nparams, + units, params); + + png_free(png_ptr, purpose); + png_free(png_ptr, params); +} +#endif + +#if defined(PNG_READ_sCAL_SUPPORTED) +/* read the sCAL chunk */ +void /* PRIVATE */ +png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_charp buffer, ep; +#ifdef PNG_FLOATING_POINT_SUPPORTED + double width, height; + png_charp vp; +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_charp swidth, sheight; +#endif +#endif + png_size_t slength; + + png_debug(1, "in png_handle_sCAL\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before sCAL"); + else if (png_ptr->mode & PNG_HAVE_IDAT) + { + png_warning(png_ptr, "Invalid sCAL after IDAT"); + png_crc_finish(png_ptr, length); + return; + } + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) + { + png_warning(png_ptr, "Duplicate sCAL chunk"); + png_crc_finish(png_ptr, length); + return; + } + + png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n", + length + 1); + buffer = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (buffer == NULL) + { + png_warning(png_ptr, "Out of memory while processing sCAL chunk"); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)buffer, slength); + + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, buffer); + return; + } + + buffer[slength] = 0x00; /* null terminate the last string */ + + ep = buffer + 1; /* skip unit byte */ + +#ifdef PNG_FLOATING_POINT_SUPPORTED + width = strtod(ep, &vp); + if (*vp) + { + png_warning(png_ptr, "malformed width string in sCAL chunk"); + return; + } +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + swidth = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); + if (swidth == NULL) + { + png_warning(png_ptr, "Out of memory while processing sCAL chunk width"); + return; + } + png_memcpy(swidth, ep, (png_size_t)png_strlen(ep)); +#endif +#endif + + for (ep = buffer; *ep; ep++) + /* empty loop */ ; + ep++; + +#ifdef PNG_FLOATING_POINT_SUPPORTED + height = strtod(ep, &vp); + if (*vp) + { + png_warning(png_ptr, "malformed height string in sCAL chunk"); + return; + } +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); + if (swidth == NULL) + { + png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); + return; + } + png_memcpy(sheight, ep, (png_size_t)png_strlen(ep)); +#endif +#endif + + if (buffer + slength < ep +#ifdef PNG_FLOATING_POINT_SUPPORTED + || width <= 0. || height <= 0. +#endif + ) + { + png_warning(png_ptr, "Invalid sCAL data"); + png_free(png_ptr, buffer); +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); + png_free(png_ptr, sheight); +#endif + return; + } + + +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_set_sCAL(png_ptr, info_ptr, buffer[0], width, height); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_set_sCAL_s(png_ptr, info_ptr, buffer[0], swidth, sheight); +#endif +#endif + + png_free(png_ptr, buffer); +#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) + png_free(png_ptr, swidth); + png_free(png_ptr, sheight); +#endif +} +#endif + +#if defined(PNG_READ_tIME_SUPPORTED) +void /* PRIVATE */ +png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_byte buf[7]; + png_time mod_time; + + png_debug(1, "in png_handle_tIME\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Out of place tIME chunk"); + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)) + { + png_warning(png_ptr, "Duplicate tIME chunk"); + png_crc_finish(png_ptr, length); + return; + } + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + + if (length != 7) + { + png_warning(png_ptr, "Incorrect tIME chunk length"); + png_crc_finish(png_ptr, length); + return; + } + + png_crc_read(png_ptr, buf, 7); + if (png_crc_finish(png_ptr, 0)) + return; + + mod_time.second = buf[6]; + mod_time.minute = buf[5]; + mod_time.hour = buf[4]; + mod_time.day = buf[3]; + mod_time.month = buf[2]; + mod_time.year = png_get_uint_16(buf); + + png_set_tIME(png_ptr, info_ptr, &mod_time); +} +#endif + +#if defined(PNG_READ_tEXt_SUPPORTED) +/* Note: this does not properly handle chunks that are > 64K under DOS */ +void /* PRIVATE */ +png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_textp text_ptr; + png_charp key; + png_charp text; + png_uint_32 skip = 0; + png_size_t slength; + int ret; + + png_debug(1, "in png_handle_tEXt\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before tEXt"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "tEXt chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + + key = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (key == NULL) + { + png_warning(png_ptr, "No memory to process text chunk."); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)key, slength); + + if (png_crc_finish(png_ptr, skip)) + { + png_free(png_ptr, key); + return; + } + + key[slength] = 0x00; + + for (text = key; *text; text++) + /* empty loop to find end of key */ ; + + if (text != key + slength) + text++; + + text_ptr = (png_textp)png_malloc_warn(png_ptr, + (png_uint_32)png_sizeof(png_text)); + if (text_ptr == NULL) + { + png_warning(png_ptr, "Not enough memory to process text chunk."); + png_free(png_ptr, key); + return; + } + text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr->key = key; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; + text_ptr->itxt_length = 0; +#endif + text_ptr->text = text; + text_ptr->text_length = png_strlen(text); + + ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, key); + png_free(png_ptr, text_ptr); + if (ret) + png_warning(png_ptr, "Insufficient memory to process text chunk."); +} +#endif + +#if defined(PNG_READ_zTXt_SUPPORTED) +/* note: this does not correctly handle chunks that are > 64K under DOS */ +void /* PRIVATE */ +png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_textp text_ptr; + png_charp chunkdata; + png_charp text; + int comp_type; + int ret; + png_size_t slength, prefix_len, data_len; + + png_debug(1, "in png_handle_zTXt\n"); + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before zTXt"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + +#ifdef PNG_MAX_MALLOC_64K + /* We will no doubt have problems with chunks even half this size, but + there is no hard and fast rule to tell us where to stop. */ + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr,"zTXt chunk too large to fit in memory"); + png_crc_finish(png_ptr, length); + return; + } +#endif + + chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (chunkdata == NULL) + { + png_warning(png_ptr,"Out of memory processing zTXt chunk."); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)chunkdata, slength); + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, chunkdata); + return; + } + + chunkdata[slength] = 0x00; + + for (text = chunkdata; *text; text++) + /* empty loop */ ; + + /* zTXt must have some text after the chunkdataword */ + if (text == chunkdata + slength) + { + comp_type = PNG_TEXT_COMPRESSION_NONE; + png_warning(png_ptr, "Zero length zTXt chunk"); + } + else + { + comp_type = *(++text); + if (comp_type != PNG_TEXT_COMPRESSION_zTXt) + { + png_warning(png_ptr, "Unknown compression type in zTXt chunk"); + comp_type = PNG_TEXT_COMPRESSION_zTXt; + } + text++; /* skip the compression_method byte */ + } + prefix_len = text - chunkdata; + + chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata, + (png_size_t)length, prefix_len, &data_len); + + text_ptr = (png_textp)png_malloc_warn(png_ptr, + (png_uint_32)png_sizeof(png_text)); + if (text_ptr == NULL) + { + png_warning(png_ptr,"Not enough memory to process zTXt chunk."); + png_free(png_ptr, chunkdata); + return; + } + text_ptr->compression = comp_type; + text_ptr->key = chunkdata; +#ifdef PNG_iTXt_SUPPORTED + text_ptr->lang = NULL; + text_ptr->lang_key = NULL; + text_ptr->itxt_length = 0; +#endif + text_ptr->text = chunkdata + prefix_len; + text_ptr->text_length = data_len; + + ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, text_ptr); + png_free(png_ptr, chunkdata); + if (ret) + png_error(png_ptr, "Insufficient memory to store zTXt chunk."); +} +#endif + +#if defined(PNG_READ_iTXt_SUPPORTED) +/* note: this does not correctly handle chunks that are > 64K under DOS */ +void /* PRIVATE */ +png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_textp text_ptr; + png_charp chunkdata; + png_charp key, lang, text, lang_key; + int comp_flag; + int comp_type = 0; + int ret; + png_size_t slength, prefix_len, data_len; + + png_debug(1, "in png_handle_iTXt\n"); + + if (!(png_ptr->mode & PNG_HAVE_IHDR)) + png_error(png_ptr, "Missing IHDR before iTXt"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + png_ptr->mode |= PNG_AFTER_IDAT; + +#ifdef PNG_MAX_MALLOC_64K + /* We will no doubt have problems with chunks even half this size, but + there is no hard and fast rule to tell us where to stop. */ + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr,"iTXt chunk too large to fit in memory"); + png_crc_finish(png_ptr, length); + return; + } +#endif + + chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (chunkdata == NULL) + { + png_warning(png_ptr, "No memory to process iTXt chunk."); + return; + } + slength = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)chunkdata, slength); + if (png_crc_finish(png_ptr, 0)) + { + png_free(png_ptr, chunkdata); + return; + } + + chunkdata[slength] = 0x00; + + for (lang = chunkdata; *lang; lang++) + /* empty loop */ ; + lang++; /* skip NUL separator */ + + /* iTXt must have a language tag (possibly empty), two compression bytes, + translated keyword (possibly empty), and possibly some text after the + keyword */ + + if (lang >= chunkdata + slength) + { + comp_flag = PNG_TEXT_COMPRESSION_NONE; + png_warning(png_ptr, "Zero length iTXt chunk"); + } + else + { + comp_flag = *lang++; + comp_type = *lang++; + } + + for (lang_key = lang; *lang_key; lang_key++) + /* empty loop */ ; + lang_key++; /* skip NUL separator */ + + for (text = lang_key; *text; text++) + /* empty loop */ ; + text++; /* skip NUL separator */ + + prefix_len = text - chunkdata; + + key=chunkdata; + if (comp_flag) + chunkdata = png_decompress_chunk(png_ptr, comp_type, chunkdata, + (size_t)length, prefix_len, &data_len); + else + data_len=png_strlen(chunkdata + prefix_len); + text_ptr = (png_textp)png_malloc_warn(png_ptr, + (png_uint_32)png_sizeof(png_text)); + if (text_ptr == NULL) + { + png_warning(png_ptr,"Not enough memory to process iTXt chunk."); + png_free(png_ptr, chunkdata); + return; + } + text_ptr->compression = (int)comp_flag + 1; + text_ptr->lang_key = chunkdata+(lang_key-key); + text_ptr->lang = chunkdata+(lang-key); + text_ptr->itxt_length = data_len; + text_ptr->text_length = 0; + text_ptr->key = chunkdata; + text_ptr->text = chunkdata + prefix_len; + + ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1); + + png_free(png_ptr, text_ptr); + png_free(png_ptr, chunkdata); + if (ret) + png_error(png_ptr, "Insufficient memory to store iTXt chunk."); +} +#endif + +/* This function is called when we haven't found a handler for a + chunk. If there isn't a problem with the chunk itself (ie bad + chunk name, CRC, or a critical chunk), the chunk is silently ignored + -- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which + case it will be saved away to be written out later. */ +void /* PRIVATE */ +png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) +{ + png_uint_32 skip = 0; + + png_debug(1, "in png_handle_unknown\n"); + + if (png_ptr->mode & PNG_HAVE_IDAT) + { +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IDAT; +#endif + if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* not an IDAT */ + png_ptr->mode |= PNG_AFTER_IDAT; + } + + png_check_chunk_name(png_ptr, png_ptr->chunk_name); + + if (!(png_ptr->chunk_name[0] & 0x20)) + { +#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) + if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS +#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) + && png_ptr->read_user_chunk_fn == NULL +#endif + ) +#endif + png_chunk_error(png_ptr, "unknown critical chunk"); + } + +#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) + if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) + { + png_unknown_chunk chunk; + +#ifdef PNG_MAX_MALLOC_64K + if (length > (png_uint_32)65535L) + { + png_warning(png_ptr, "unknown chunk too large to fit in memory"); + skip = length - (png_uint_32)65535L; + length = (png_uint_32)65535L; + } +#endif + png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name); + chunk.data = (png_bytep)png_malloc(png_ptr, length); + chunk.size = (png_size_t)length; + png_crc_read(png_ptr, (png_bytep)chunk.data, length); +#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) + if(png_ptr->read_user_chunk_fn != NULL) + { + /* callback to user unknown chunk handler */ + if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0) + { + if (!(png_ptr->chunk_name[0] & 0x20)) + if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != + PNG_HANDLE_CHUNK_ALWAYS) + { + png_free(png_ptr, chunk.data); + png_chunk_error(png_ptr, "unknown critical chunk"); + } + png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1); + } + } + else +#endif + png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1); + png_free(png_ptr, chunk.data); + } + else +#endif + skip = length; + + png_crc_finish(png_ptr, skip); + +#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED) + if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */ + return; +#endif +} + +/* This function is called to verify that a chunk name is valid. + This function can't have the "critical chunk check" incorporated + into it, since in the future we will need to be able to call user + functions to handle unknown critical chunks after we check that + the chunk name itself is valid. */ + +#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) + +void /* PRIVATE */ +png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) +{ + png_debug(1, "in png_check_chunk_name\n"); + if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) || + isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3])) + { + png_chunk_error(png_ptr, "invalid chunk type"); + } +} + +/* Combines the row recently read in with the existing pixels in the + row. This routine takes care of alpha and transparency if requested. + This routine also handles the two methods of progressive display + of interlaced images, depending on the mask value. + The mask value describes which pixels are to be combined with + the row. The pattern always repeats every 8 pixels, so just 8 + bits are needed. A one indicates the pixel is to be combined, + a zero indicates the pixel is to be skipped. This is in addition + to any alpha or transparency value associated with the pixel. If + you want all pixels to be combined, pass 0xff (255) in mask. */ +#ifndef PNG_HAVE_ASSEMBLER_COMBINE_ROW +void /* PRIVATE */ +png_combine_row(png_structp png_ptr, png_bytep row, int mask) +{ + png_debug(1,"in png_combine_row\n"); + if (mask == 0xff) + { + png_memcpy(row, png_ptr->row_buf + 1, + PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->width)); + } + else + { + switch (png_ptr->row_info.pixel_depth) + { + case 1: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + int s_inc, s_start, s_end; + int m = 0x80; + int shift; + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 7; + s_inc = 1; + } + else +#endif + { + s_start = 7; + s_end = 0; + s_inc = -1; + } + + shift = s_start; + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + int value; + + value = (*sp >> shift) & 0x01; + *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + case 2: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + int s_start, s_end, s_inc; + int m = 0x80; + int shift; + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + int value; + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 6; + s_inc = 2; + } + else +#endif + { + s_start = 6; + s_end = 0; + s_inc = -2; + } + + shift = s_start; + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0x03; + *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + case 4: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + int s_start, s_end, s_inc; + int m = 0x80; + int shift; + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + int value; + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 4; + s_inc = 4; + } + else +#endif + { + s_start = 4; + s_end = 0; + s_inc = -4; + } + shift = s_start; + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0xf; + *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + default: + { + png_bytep sp = png_ptr->row_buf + 1; + png_bytep dp = row; + png_size_t pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + png_uint_32 i; + png_uint_32 row_width = png_ptr->width; + png_byte m = 0x80; + + + for (i = 0; i < row_width; i++) + { + if (m & mask) + { + png_memcpy(dp, sp, pixel_bytes); + } + + sp += pixel_bytes; + dp += pixel_bytes; + + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + } + } +} +#endif /* !PNG_HAVE_ASSEMBLER_COMBINE_ROW */ + +#ifdef PNG_READ_INTERLACING_SUPPORTED +#ifndef PNG_HAVE_ASSEMBLER_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */ +/* OLD pre-1.0.9 interface: +void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, + png_uint_32 transformations) + */ +void /* PRIVATE */ +png_do_read_interlace(png_structp png_ptr) +{ + png_row_infop row_info = &(png_ptr->row_info); + png_bytep row = png_ptr->row_buf + 1; + int pass = png_ptr->pass; + png_uint_32 transformations = png_ptr->transformations; +#ifdef PNG_USE_LOCAL_ARRAYS + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + /* offset to next interlace block */ + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; +#endif + + png_debug(1,"in png_do_read_interlace (stock C version)\n"); + if (row != NULL && row_info != NULL) + { + png_uint_32 final_width; + + final_width = row_info->width * png_pass_inc[pass]; + + switch (row_info->pixel_depth) + { + case 1: + { + png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3); + png_bytep dp = row + (png_size_t)((final_width - 1) >> 3); + int sshift, dshift; + int s_start, s_end, s_inc; + int jstop = png_pass_inc[pass]; + png_byte v; + png_uint_32 i; + int j; + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (int)((row_info->width + 7) & 0x07); + dshift = (int)((final_width + 7) & 0x07); + s_start = 7; + s_end = 0; + s_inc = -1; + } + else +#endif + { + sshift = 7 - (int)((row_info->width + 7) & 0x07); + dshift = 7 - (int)((final_width + 7) & 0x07); + s_start = 0; + s_end = 7; + s_inc = 1; + } + + for (i = 0; i < row_info->width; i++) + { + v = (png_byte)((*sp >> sshift) & 0x01); + for (j = 0; j < jstop; j++) + { + *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + case 2: + { + png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2); + png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2); + int sshift, dshift; + int s_start, s_end, s_inc; + int jstop = png_pass_inc[pass]; + png_uint_32 i; + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (int)(((row_info->width + 3) & 0x03) << 1); + dshift = (int)(((final_width + 3) & 0x03) << 1); + s_start = 6; + s_end = 0; + s_inc = -2; + } + else +#endif + { + sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1); + dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1); + s_start = 0; + s_end = 6; + s_inc = 2; + } + + for (i = 0; i < row_info->width; i++) + { + png_byte v; + int j; + + v = (png_byte)((*sp >> sshift) & 0x03); + for (j = 0; j < jstop; j++) + { + *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + case 4: + { + png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1); + png_bytep dp = row + (png_size_t)((final_width - 1) >> 1); + int sshift, dshift; + int s_start, s_end, s_inc; + png_uint_32 i; + int jstop = png_pass_inc[pass]; + +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (int)(((row_info->width + 1) & 0x01) << 2); + dshift = (int)(((final_width + 1) & 0x01) << 2); + s_start = 4; + s_end = 0; + s_inc = -4; + } + else +#endif + { + sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2); + dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2); + s_start = 0; + s_end = 4; + s_inc = 4; + } + + for (i = 0; i < row_info->width; i++) + { + png_byte v = (png_byte)((*sp >> sshift) & 0xf); + int j; + + for (j = 0; j < jstop; j++) + { + *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + default: + { + png_size_t pixel_bytes = (row_info->pixel_depth >> 3); + png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes; + png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; + + int jstop = png_pass_inc[pass]; + png_uint_32 i; + + for (i = 0; i < row_info->width; i++) + { + png_byte v[8]; + int j; + + png_memcpy(v, sp, pixel_bytes); + for (j = 0; j < jstop; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sp -= pixel_bytes; + } + break; + } + } + row_info->width = final_width; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width); + } +#if !defined(PNG_READ_PACKSWAP_SUPPORTED) + if (&transformations == NULL) /* silence compiler warning */ + return; +#endif +} +#endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */ +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + +#ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW +void /* PRIVATE */ +png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, + png_bytep prev_row, int filter) +{ + png_debug(1, "in png_read_filter_row\n"); + png_debug2(2,"row = %lu, filter = %d\n", png_ptr->row_number, filter); + switch (filter) + { + case PNG_FILTER_VALUE_NONE: + break; + case PNG_FILTER_VALUE_SUB: + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_bytep rp = row + bpp; + png_bytep lp = row; + + for (i = bpp; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); + rp++; + } + break; + } + case PNG_FILTER_VALUE_UP: + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_bytep rp = row; + png_bytep pp = prev_row; + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + break; + } + case PNG_FILTER_VALUE_AVG: + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop = row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + + ((int)(*pp++) / 2 )) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + + (int)(*pp++ + *lp++) / 2 ) & 0xff); + rp++; + } + break; + } + case PNG_FILTER_VALUE_PAETH: + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_bytep cp = prev_row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop=row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) /* use leftover rp,pp */ + { + int a, b, c, pa, pb, pc, p; + + a = *lp++; + b = *pp++; + c = *cp++; + + p = b - c; + pc = a - c; + +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + + /* + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; + */ + + p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; + + *rp = (png_byte)(((int)(*rp) + p) & 0xff); + rp++; + } + break; + } + default: + png_warning(png_ptr, "Ignoring bad adaptive filter type"); + *row=0; + break; + } +} +#endif /* !PNG_HAVE_ASSEMBLER_READ_FILTER_ROW */ + +void /* PRIVATE */ +png_read_finish_row(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + png_debug(1, "in png_read_finish_row\n"); + png_ptr->row_number++; + if (png_ptr->row_number < png_ptr->num_rows) + return; + + if (png_ptr->interlaced) + { + png_ptr->row_number = 0; + png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); + do + { + png_ptr->pass++; + if (png_ptr->pass >= 7) + break; + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + + png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; + + if (!(png_ptr->transformations & PNG_INTERLACE)) + { + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[png_ptr->pass] - 1 - + png_pass_ystart[png_ptr->pass]) / + png_pass_yinc[png_ptr->pass]; + if (!(png_ptr->num_rows)) + continue; + } + else /* if (png_ptr->transformations & PNG_INTERLACE) */ + break; + } while (png_ptr->iwidth == 0); + + if (png_ptr->pass < 7) + return; + } + + if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) + { +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IDAT; +#endif + char extra; + int ret; + + png_ptr->zstream.next_out = (Byte *)&extra; + png_ptr->zstream.avail_out = (uInt)1; + for(;;) + { + if (!(png_ptr->zstream.avail_in)) + { + while (!png_ptr->idat_size) + { + png_byte chunk_length[4]; + + png_crc_finish(png_ptr, 0); + + png_read_data(png_ptr, chunk_length, 4); + png_ptr->idat_size = png_get_uint_31(png_ptr, chunk_length); + png_reset_crc(png_ptr); + png_crc_read(png_ptr, png_ptr->chunk_name, 4); + if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) + png_error(png_ptr, "Not enough image data"); + + } + png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_in = png_ptr->zbuf; + if (png_ptr->zbuf_size > png_ptr->idat_size) + png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size; + png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zstream.avail_in); + png_ptr->idat_size -= png_ptr->zstream.avail_in; + } + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret == Z_STREAM_END) + { + if (!(png_ptr->zstream.avail_out) || png_ptr->zstream.avail_in || + png_ptr->idat_size) + png_warning(png_ptr, "Extra compressed data"); + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + if (ret != Z_OK) + png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : + "Decompression Error"); + + if (!(png_ptr->zstream.avail_out)) + { + png_warning(png_ptr, "Extra compressed data."); + png_ptr->mode |= PNG_AFTER_IDAT; + png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; + break; + } + + } + png_ptr->zstream.avail_out = 0; + } + + if (png_ptr->idat_size || png_ptr->zstream.avail_in) + png_warning(png_ptr, "Extra compression data"); + + inflateReset(&png_ptr->zstream); + + png_ptr->mode |= PNG_AFTER_IDAT; +} + +void /* PRIVATE */ +png_read_start_row(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + int max_pixel_depth; + png_uint_32 row_bytes; + + png_debug(1, "in png_read_start_row\n"); + png_ptr->zstream.avail_in = 0; + png_init_read_transformations(png_ptr); + if (png_ptr->interlaced) + { + if (!(png_ptr->transformations & PNG_INTERLACE)) + png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 - + png_pass_ystart[0]) / png_pass_yinc[0]; + else + png_ptr->num_rows = png_ptr->height; + + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + + row_bytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->iwidth) + 1; + + png_ptr->irowbytes = (png_size_t)row_bytes; + if((png_uint_32)png_ptr->irowbytes != row_bytes) + png_error(png_ptr, "Rowbytes overflow in png_read_start_row"); + } + else + { + png_ptr->num_rows = png_ptr->height; + png_ptr->iwidth = png_ptr->width; + png_ptr->irowbytes = png_ptr->rowbytes + 1; + } + max_pixel_depth = png_ptr->pixel_depth; + +#if defined(PNG_READ_PACK_SUPPORTED) + if ((png_ptr->transformations & PNG_PACK) && png_ptr->bit_depth < 8) + max_pixel_depth = 8; +#endif + +#if defined(PNG_READ_EXPAND_SUPPORTED) + if (png_ptr->transformations & PNG_EXPAND) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + if (png_ptr->num_trans) + max_pixel_depth = 32; + else + max_pixel_depth = 24; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) + { + if (max_pixel_depth < 8) + max_pixel_depth = 8; + if (png_ptr->num_trans) + max_pixel_depth *= 2; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + if (png_ptr->num_trans) + { + max_pixel_depth *= 4; + max_pixel_depth /= 3; + } + } + } +#endif + +#if defined(PNG_READ_FILLER_SUPPORTED) + if (png_ptr->transformations & (PNG_FILLER)) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + max_pixel_depth = 32; + else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) + { + if (max_pixel_depth <= 8) + max_pixel_depth = 16; + else + max_pixel_depth = 32; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) + { + if (max_pixel_depth <= 32) + max_pixel_depth = 32; + else + max_pixel_depth = 64; + } + } +#endif + +#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) + if (png_ptr->transformations & PNG_GRAY_TO_RGB) + { + if ( +#if defined(PNG_READ_EXPAND_SUPPORTED) + (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) || +#endif +#if defined(PNG_READ_FILLER_SUPPORTED) + (png_ptr->transformations & (PNG_FILLER)) || +#endif + png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + { + if (max_pixel_depth <= 16) + max_pixel_depth = 32; + else + max_pixel_depth = 64; + } + else + { + if (max_pixel_depth <= 8) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + max_pixel_depth = 32; + else + max_pixel_depth = 24; + } + else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) + max_pixel_depth = 64; + else + max_pixel_depth = 48; + } + } +#endif + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \ +defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) + if(png_ptr->transformations & PNG_USER_TRANSFORM) + { + int user_pixel_depth=png_ptr->user_transform_depth* + png_ptr->user_transform_channels; + if(user_pixel_depth > max_pixel_depth) + max_pixel_depth=user_pixel_depth; + } +#endif + + /* align the width on the next larger 8 pixels. Mainly used + for interlacing */ + row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7)); + /* calculate the maximum bytes needed, adding a byte and a pixel + for safety's sake */ + row_bytes = PNG_ROWBYTES(max_pixel_depth,row_bytes) + + 1 + ((max_pixel_depth + 7) >> 3); +#ifdef PNG_MAX_MALLOC_64K + if (row_bytes > (png_uint_32)65536L) + png_error(png_ptr, "This image requires a row greater than 64KB"); +#endif + png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64); + png_ptr->row_buf = png_ptr->big_row_buf+32; +#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD) + png_ptr->row_buf_size = row_bytes; +#endif + +#ifdef PNG_MAX_MALLOC_64K + if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) + png_error(png_ptr, "This image requires a row greater than 64KB"); +#endif + if ((png_uint_32)png_ptr->rowbytes > PNG_SIZE_MAX - 1) + png_error(png_ptr, "Row has too many bytes to allocate in memory."); + png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( + png_ptr->rowbytes + 1)); + + png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); + + png_debug1(3, "width = %lu,\n", png_ptr->width); + png_debug1(3, "height = %lu,\n", png_ptr->height); + png_debug1(3, "iwidth = %lu,\n", png_ptr->iwidth); + png_debug1(3, "num_rows = %lu\n", png_ptr->num_rows); + png_debug1(3, "rowbytes = %lu,\n", png_ptr->rowbytes); + png_debug1(3, "irowbytes = %lu,\n", png_ptr->irowbytes); + + png_ptr->flags |= PNG_FLAG_ROW_INIT; +} diff --git a/src/SFML/Graphics/libpng/pngset.c b/src/SFML/Graphics/libpng/pngset.c new file mode 100644 index 00000000..d88363fc --- /dev/null +++ b/src/SFML/Graphics/libpng/pngset.c @@ -0,0 +1,1219 @@ + +/* pngset.c - storage of image information into info struct + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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.) + * + * The functions here are used during reads to store data from the file + * into the info struct, and during writes to store application data + * into the info struct for writing into the file. This abstracts the + * info struct and allows us to change the structure in the future. + */ + +#define PNG_INTERNAL +#include "png.h" + +#if defined(PNG_bKGD_SUPPORTED) +void PNGAPI +png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) +{ + png_debug1(1, "in %s storage function\n", "bKGD"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_memcpy(&(info_ptr->background), background, png_sizeof(png_color_16)); + info_ptr->valid |= PNG_INFO_bKGD; +} +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +void PNGAPI +png_set_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) +{ + png_debug1(1, "in %s storage function\n", "cHRM"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (white_x < 0.0 || white_y < 0.0 || + red_x < 0.0 || red_y < 0.0 || + green_x < 0.0 || green_y < 0.0 || + blue_x < 0.0 || blue_y < 0.0) + { + png_warning(png_ptr, + "Ignoring attempt to set negative chromaticity value"); + return; + } + if (white_x > 21474.83 || white_y > 21474.83 || + red_x > 21474.83 || red_y > 21474.83 || + green_x > 21474.83 || green_y > 21474.83 || + blue_x > 21474.83 || blue_y > 21474.83) + { + png_warning(png_ptr, + "Ignoring attempt to set chromaticity value exceeding 21474.83"); + return; + } + + info_ptr->x_white = (float)white_x; + info_ptr->y_white = (float)white_y; + info_ptr->x_red = (float)red_x; + info_ptr->y_red = (float)red_y; + info_ptr->x_green = (float)green_x; + info_ptr->y_green = (float)green_y; + info_ptr->x_blue = (float)blue_x; + info_ptr->y_blue = (float)blue_y; +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5); + info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5); + info_ptr->int_x_red = (png_fixed_point)( red_x*100000.+0.5); + info_ptr->int_y_red = (png_fixed_point)( red_y*100000.+0.5); + info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5); + info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5); + info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000.+0.5); + info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5); +#endif + info_ptr->valid |= PNG_INFO_cHRM; +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +void PNGAPI +png_set_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) +{ + png_debug1(1, "in %s storage function\n", "cHRM"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (white_x < 0 || white_y < 0 || + red_x < 0 || red_y < 0 || + green_x < 0 || green_y < 0 || + blue_x < 0 || blue_y < 0) + { + png_warning(png_ptr, + "Ignoring attempt to set negative chromaticity value"); + return; + } + if (white_x > (double) PNG_UINT_31_MAX || + white_y > (double) PNG_UINT_31_MAX || + red_x > (double) PNG_UINT_31_MAX || + red_y > (double) PNG_UINT_31_MAX || + green_x > (double) PNG_UINT_31_MAX || + green_y > (double) PNG_UINT_31_MAX || + blue_x > (double) PNG_UINT_31_MAX || + blue_y > (double) PNG_UINT_31_MAX) + { + png_warning(png_ptr, + "Ignoring attempt to set chromaticity value exceeding 21474.83"); + return; + } + info_ptr->int_x_white = white_x; + info_ptr->int_y_white = white_y; + info_ptr->int_x_red = red_x; + info_ptr->int_y_red = red_y; + info_ptr->int_x_green = green_x; + info_ptr->int_y_green = green_y; + info_ptr->int_x_blue = blue_x; + info_ptr->int_y_blue = blue_y; +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->x_white = (float)(white_x/100000.); + info_ptr->y_white = (float)(white_y/100000.); + info_ptr->x_red = (float)( red_x/100000.); + info_ptr->y_red = (float)( red_y/100000.); + info_ptr->x_green = (float)(green_x/100000.); + info_ptr->y_green = (float)(green_y/100000.); + info_ptr->x_blue = (float)( blue_x/100000.); + info_ptr->y_blue = (float)( blue_y/100000.); +#endif + info_ptr->valid |= PNG_INFO_cHRM; +} +#endif +#endif + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +void PNGAPI +png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) +{ + double gamma; + png_debug1(1, "in %s storage function\n", "gAMA"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + /* Check for overflow */ + if (file_gamma > 21474.83) + { + png_warning(png_ptr, "Limiting gamma to 21474.83"); + gamma=21474.83; + } + else + gamma=file_gamma; + info_ptr->gamma = (float)gamma; +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_gamma = (int)(gamma*100000.+.5); +#endif + info_ptr->valid |= PNG_INFO_gAMA; + if(gamma == 0.0) + png_warning(png_ptr, "Setting gamma=0"); +} +#endif +void PNGAPI +png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point + int_gamma) +{ + png_fixed_point gamma; + + png_debug1(1, "in %s storage function\n", "gAMA"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX) + { + png_warning(png_ptr, "Limiting gamma to 21474.83"); + gamma=PNG_UINT_31_MAX; + } + else + { + if (int_gamma < 0) + { + png_warning(png_ptr, "Setting negative gamma to zero"); + gamma=0; + } + else + gamma=int_gamma; + } +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->gamma = (float)(gamma/100000.); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + info_ptr->int_gamma = gamma; +#endif + info_ptr->valid |= PNG_INFO_gAMA; + if(gamma == 0) + png_warning(png_ptr, "Setting gamma=0"); +} +#endif + +#if defined(PNG_hIST_SUPPORTED) +void PNGAPI +png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) +{ + int i; + + png_debug1(1, "in %s storage function\n", "hIST"); + if (png_ptr == NULL || info_ptr == NULL) + return; + if (info_ptr->num_palette == 0) + { + png_warning(png_ptr, + "Palette size 0, hIST allocation skipped."); + return; + } + +#ifdef PNG_FREE_ME_SUPPORTED + png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); +#endif + /* Changed from info->num_palette to 256 in version 1.2.1 */ + png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr, + (png_uint_32)(256 * png_sizeof (png_uint_16))); + if (png_ptr->hist == NULL) + { + png_warning(png_ptr, "Insufficient memory for hIST chunk data."); + return; + } + + for (i = 0; i < info_ptr->num_palette; i++) + png_ptr->hist[i] = hist[i]; + info_ptr->hist = png_ptr->hist; + info_ptr->valid |= PNG_INFO_hIST; + +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_HIST; +#else + png_ptr->flags |= PNG_FLAG_FREE_HIST; +#endif +} +#endif + +void PNGAPI +png_set_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) +{ + png_debug1(1, "in %s storage function\n", "IHDR"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + /* check for width and height valid values */ + if (width == 0 || height == 0) + png_error(png_ptr, "Image width or height is zero in IHDR"); +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + if (width > png_ptr->user_width_max || height > png_ptr->user_height_max) + png_error(png_ptr, "image size exceeds user limits in IHDR"); +#else + if (width > PNG_USER_WIDTH_MAX || height > PNG_USER_HEIGHT_MAX) + png_error(png_ptr, "image size exceeds user limits in IHDR"); +#endif + if (width > PNG_UINT_31_MAX || height > PNG_UINT_31_MAX) + png_error(png_ptr, "Invalid image size in IHDR"); + if ( 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 is too large for libpng to process pixels"); + + /* check other values */ + if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && + bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth in IHDR"); + + if (color_type < 0 || color_type == 1 || + color_type == 5 || color_type > 6) + png_error(png_ptr, "Invalid color type in IHDR"); + + if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) || + ((color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8)) + png_error(png_ptr, "Invalid color type/bit depth combination in IHDR"); + + if (interlace_type >= PNG_INTERLACE_LAST) + png_error(png_ptr, "Unknown interlace method in IHDR"); + + if (compression_type != PNG_COMPRESSION_TYPE_BASE) + png_error(png_ptr, "Unknown compression method in IHDR"); + +#if defined(PNG_MNG_FEATURES_SUPPORTED) + /* Accept filter_method 64 (intrapixel differencing) only if + * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and + * 2. Libpng did not read a PNG signature (this filter_method is only + * used in PNG datastreams that are embedded in MNG datastreams) and + * 3. The application called png_permit_mng_features with a mask that + * included PNG_FLAG_MNG_FILTER_64 and + * 4. The filter_method is 64 and + * 5. The color_type is RGB or RGBA + */ + if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&png_ptr->mng_features_permitted) + png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n"); + if(filter_type != PNG_FILTER_TYPE_BASE) + { + if(!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (filter_type == PNG_INTRAPIXEL_DIFFERENCING) && + ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) && + (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA))) + png_error(png_ptr, "Unknown filter method in IHDR"); + if(png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) + png_warning(png_ptr, "Invalid filter method in IHDR"); + } +#else + if(filter_type != PNG_FILTER_TYPE_BASE) + png_error(png_ptr, "Unknown filter method in IHDR"); +#endif + + info_ptr->width = width; + info_ptr->height = height; + info_ptr->bit_depth = (png_byte)bit_depth; + info_ptr->color_type =(png_byte) color_type; + info_ptr->compression_type = (png_byte)compression_type; + info_ptr->filter_type = (png_byte)filter_type; + info_ptr->interlace_type = (png_byte)interlace_type; + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + info_ptr->channels = 1; + else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) + info_ptr->channels = 3; + else + info_ptr->channels = 1; + if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) + info_ptr->channels++; + info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); + + /* check for potential overflow */ + if ( 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 */ + info_ptr->rowbytes = (png_size_t)0; + else + info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,width); +} + +#if defined(PNG_oFFs_SUPPORTED) +void PNGAPI +png_set_oFFs(png_structp png_ptr, png_infop info_ptr, + png_int_32 offset_x, png_int_32 offset_y, int unit_type) +{ + png_debug1(1, "in %s storage function\n", "oFFs"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->x_offset = offset_x; + info_ptr->y_offset = offset_y; + info_ptr->offset_unit_type = (png_byte)unit_type; + info_ptr->valid |= PNG_INFO_oFFs; +} +#endif + +#if defined(PNG_pCAL_SUPPORTED) +void PNGAPI +png_set_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) +{ + png_uint_32 length; + int i; + + png_debug1(1, "in %s storage function\n", "pCAL"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + length = png_strlen(purpose) + 1; + png_debug1(3, "allocating purpose for info (%lu bytes)\n", length); + info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->pcal_purpose == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL purpose."); + return; + } + png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length); + + png_debug(3, "storing X0, X1, type, and nparams in info\n"); + info_ptr->pcal_X0 = X0; + info_ptr->pcal_X1 = X1; + info_ptr->pcal_type = (png_byte)type; + info_ptr->pcal_nparams = (png_byte)nparams; + + length = png_strlen(units) + 1; + png_debug1(3, "allocating units for info (%lu bytes)\n", length); + info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->pcal_units == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL units."); + return; + } + png_memcpy(info_ptr->pcal_units, units, (png_size_t)length); + + info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr, + (png_uint_32)((nparams + 1) * png_sizeof(png_charp))); + if (info_ptr->pcal_params == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL params."); + return; + } + + info_ptr->pcal_params[nparams] = NULL; + + for (i = 0; i < nparams; i++) + { + length = png_strlen(params[i]) + 1; + png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length); + info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->pcal_params[i] == NULL) + { + png_warning(png_ptr, "Insufficient memory for pCAL parameter."); + return; + } + png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length); + } + + info_ptr->valid |= PNG_INFO_pCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PCAL; +#endif +} +#endif + +#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED +void PNGAPI +png_set_sCAL(png_structp png_ptr, png_infop info_ptr, + int unit, double width, double height) +{ + png_debug1(1, "in %s storage function\n", "sCAL"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->scal_unit = (png_byte)unit; + info_ptr->scal_pixel_width = width; + info_ptr->scal_pixel_height = height; + + info_ptr->valid |= PNG_INFO_sCAL; +} +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +void PNGAPI +png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, + int unit, png_charp swidth, png_charp sheight) +{ + png_uint_32 length; + + png_debug1(1, "in %s storage function\n", "sCAL"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->scal_unit = (png_byte)unit; + + length = png_strlen(swidth) + 1; + png_debug1(3, "allocating unit for info (%d bytes)\n", length); + info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->scal_s_width == NULL) + { + png_warning(png_ptr, "Memory allocation failed while processing sCAL."); + } + png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); + + length = png_strlen(sheight) + 1; + png_debug1(3, "allocating unit for info (%d bytes)\n", length); + info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length); + if (info_ptr->scal_s_height == NULL) + { + png_free (png_ptr, info_ptr->scal_s_width); + png_warning(png_ptr, "Memory allocation failed while processing sCAL."); + } + png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); + + info_ptr->valid |= PNG_INFO_sCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_SCAL; +#endif +} +#endif +#endif +#endif + +#if defined(PNG_pHYs_SUPPORTED) +void PNGAPI +png_set_pHYs(png_structp png_ptr, png_infop info_ptr, + png_uint_32 res_x, png_uint_32 res_y, int unit_type) +{ + png_debug1(1, "in %s storage function\n", "pHYs"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->x_pixels_per_unit = res_x; + info_ptr->y_pixels_per_unit = res_y; + info_ptr->phys_unit_type = (png_byte)unit_type; + info_ptr->valid |= PNG_INFO_pHYs; +} +#endif + +void PNGAPI +png_set_PLTE(png_structp png_ptr, png_infop info_ptr, + png_colorp palette, int num_palette) +{ + + png_debug1(1, "in %s storage function\n", "PLTE"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + /* + * It may not actually be necessary to set png_ptr->palette here; + * we do it for backward compatibility with the way the png_handle_tRNS + * function used to do the allocation. + */ +#ifdef PNG_FREE_ME_SUPPORTED + png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0); +#endif + + /* Changed in libpng-1.2.1 to allocate 256 instead of num_palette entries, + in case of an invalid PNG file that has too-large sample values. */ + png_ptr->palette = (png_colorp)png_malloc(png_ptr, + 256 * png_sizeof(png_color)); + png_memset(png_ptr->palette, 0, 256 * png_sizeof(png_color)); + png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof (png_color)); + info_ptr->palette = png_ptr->palette; + info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette; + +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PLTE; +#else + png_ptr->flags |= PNG_FLAG_FREE_PLTE; +#endif + + info_ptr->valid |= PNG_INFO_PLTE; +} + +#if defined(PNG_sBIT_SUPPORTED) +void PNGAPI +png_set_sBIT(png_structp png_ptr, png_infop info_ptr, + png_color_8p sig_bit) +{ + png_debug1(1, "in %s storage function\n", "sBIT"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_memcpy(&(info_ptr->sig_bit), sig_bit, png_sizeof (png_color_8)); + info_ptr->valid |= PNG_INFO_sBIT; +} +#endif + +#if defined(PNG_sRGB_SUPPORTED) +void PNGAPI +png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) +{ + png_debug1(1, "in %s storage function\n", "sRGB"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + info_ptr->srgb_intent = (png_byte)intent; + info_ptr->valid |= PNG_INFO_sRGB; +} + +void PNGAPI +png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, + int intent) +{ +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED + float file_gamma; +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_fixed_point int_file_gamma; +#endif +#endif +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED + float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, + int_green_y, int_blue_x, int_blue_y; +#endif +#endif + png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_set_sRGB(png_ptr, info_ptr, intent); + +#if defined(PNG_gAMA_SUPPORTED) +#ifdef PNG_FLOATING_POINT_SUPPORTED + file_gamma = (float).45455; + png_set_gAMA(png_ptr, info_ptr, file_gamma); +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED + int_file_gamma = 45455L; + png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma); +#endif +#endif + +#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FIXED_POINT_SUPPORTED + int_white_x = 31270L; + int_white_y = 32900L; + int_red_x = 64000L; + int_red_y = 33000L; + int_green_x = 30000L; + int_green_y = 60000L; + int_blue_x = 15000L; + int_blue_y = 6000L; + + png_set_cHRM_fixed(png_ptr, info_ptr, + int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, + int_blue_x, int_blue_y); +#endif +#ifdef PNG_FLOATING_POINT_SUPPORTED + white_x = (float).3127; + white_y = (float).3290; + red_x = (float).64; + red_y = (float).33; + green_x = (float).30; + green_y = (float).60; + blue_x = (float).15; + blue_y = (float).06; + + png_set_cHRM(png_ptr, info_ptr, + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); +#endif +#endif +} +#endif + + +#if defined(PNG_iCCP_SUPPORTED) +void PNGAPI +png_set_iCCP(png_structp png_ptr, png_infop info_ptr, + png_charp name, int compression_type, + png_charp profile, png_uint_32 proflen) +{ + png_charp new_iccp_name; + png_charp new_iccp_profile; + + png_debug1(1, "in %s storage function\n", "iCCP"); + if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) + return; + + new_iccp_name = (png_charp)png_malloc_warn(png_ptr, png_strlen(name)+1); + if (new_iccp_name == NULL) + { + png_warning(png_ptr, "Insufficient memory to process iCCP chunk."); + return; + } + png_strcpy(new_iccp_name, name); + new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); + if (new_iccp_profile == NULL) + { + png_free (png_ptr, new_iccp_name); + png_warning(png_ptr, "Insufficient memory to process iCCP profile."); + return; + } + png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); + + png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0); + + info_ptr->iccp_proflen = proflen; + info_ptr->iccp_name = new_iccp_name; + info_ptr->iccp_profile = new_iccp_profile; + /* Compression is always zero but is here so the API and info structure + * does not have to change if we introduce multiple compression types */ + info_ptr->iccp_compression = (png_byte)compression_type; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_ICCP; +#endif + info_ptr->valid |= PNG_INFO_iCCP; +} +#endif + +#if defined(PNG_TEXT_SUPPORTED) +void PNGAPI +png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, + int num_text) +{ + int ret; + ret=png_set_text_2(png_ptr, info_ptr, text_ptr, num_text); + if (ret) + png_error(png_ptr, "Insufficient memory to store text"); +} + +int /* PRIVATE */ +png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, + int num_text) +{ + int i; + + png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ? + "text" : (png_const_charp)png_ptr->chunk_name)); + + if (png_ptr == NULL || info_ptr == NULL || num_text == 0) + return(0); + + /* Make sure we have enough space in the "text" array in info_struct + * to hold all of the incoming text_ptr objects. + */ + if (info_ptr->num_text + num_text > info_ptr->max_text) + { + if (info_ptr->text != NULL) + { + png_textp old_text; + int old_max; + + old_max = info_ptr->max_text; + info_ptr->max_text = info_ptr->num_text + num_text + 8; + old_text = info_ptr->text; + info_ptr->text = (png_textp)png_malloc_warn(png_ptr, + (png_uint_32)(info_ptr->max_text * png_sizeof (png_text))); + if (info_ptr->text == NULL) + { + png_free(png_ptr, old_text); + return(1); + } + png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max * + png_sizeof(png_text))); + png_free(png_ptr, old_text); + } + else + { + info_ptr->max_text = num_text + 8; + info_ptr->num_text = 0; + info_ptr->text = (png_textp)png_malloc_warn(png_ptr, + (png_uint_32)(info_ptr->max_text * png_sizeof (png_text))); + if (info_ptr->text == NULL) + return(1); +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_TEXT; +#endif + } + png_debug1(3, "allocated %d entries for info_ptr->text\n", + info_ptr->max_text); + } + for (i = 0; i < num_text; i++) + { + png_size_t text_length,key_len; + png_size_t lang_len,lang_key_len; + png_textp textp = &(info_ptr->text[info_ptr->num_text]); + + if (text_ptr[i].key == NULL) + continue; + + key_len = png_strlen(text_ptr[i].key); + + if(text_ptr[i].compression <= 0) + { + lang_len = 0; + lang_key_len = 0; + } + else +#ifdef PNG_iTXt_SUPPORTED + { + /* set iTXt data */ + if (text_ptr[i].lang != NULL) + lang_len = png_strlen(text_ptr[i].lang); + else + lang_len = 0; + if (text_ptr[i].lang_key != NULL) + lang_key_len = png_strlen(text_ptr[i].lang_key); + else + lang_key_len = 0; + } +#else + { + png_warning(png_ptr, "iTXt chunk not supported."); + continue; + } +#endif + + if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0') + { + text_length = 0; +#ifdef PNG_iTXt_SUPPORTED + if(text_ptr[i].compression > 0) + textp->compression = PNG_ITXT_COMPRESSION_NONE; + else +#endif + textp->compression = PNG_TEXT_COMPRESSION_NONE; + } + else + { + text_length = png_strlen(text_ptr[i].text); + textp->compression = text_ptr[i].compression; + } + + textp->key = (png_charp)png_malloc_warn(png_ptr, + (png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); + if (textp->key == NULL) + return(1); + png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", + (png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4), + (int)textp->key); + + png_memcpy(textp->key, text_ptr[i].key, + (png_size_t)(key_len)); + *(textp->key+key_len) = '\0'; +#ifdef PNG_iTXt_SUPPORTED + if (text_ptr[i].compression > 0) + { + textp->lang=textp->key + key_len + 1; + png_memcpy(textp->lang, text_ptr[i].lang, lang_len); + *(textp->lang+lang_len) = '\0'; + textp->lang_key=textp->lang + lang_len + 1; + png_memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len); + *(textp->lang_key+lang_key_len) = '\0'; + textp->text=textp->lang_key + lang_key_len + 1; + } + else +#endif + { +#ifdef PNG_iTXt_SUPPORTED + textp->lang=NULL; + textp->lang_key=NULL; +#endif + textp->text=textp->key + key_len + 1; + } + if(text_length) + png_memcpy(textp->text, text_ptr[i].text, + (png_size_t)(text_length)); + *(textp->text+text_length) = '\0'; + +#ifdef PNG_iTXt_SUPPORTED + if(textp->compression > 0) + { + textp->text_length = 0; + textp->itxt_length = text_length; + } + else +#endif + { + textp->text_length = text_length; +#ifdef PNG_iTXt_SUPPORTED + textp->itxt_length = 0; +#endif + } + info_ptr->text[info_ptr->num_text]= *textp; + info_ptr->num_text++; + png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); + } + return(0); +} +#endif + +#if defined(PNG_tIME_SUPPORTED) +void PNGAPI +png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) +{ + png_debug1(1, "in %s storage function\n", "tIME"); + if (png_ptr == NULL || info_ptr == NULL || + (png_ptr->mode & PNG_WROTE_tIME)) + return; + + png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof (png_time)); + info_ptr->valid |= PNG_INFO_tIME; +} +#endif + +#if defined(PNG_tRNS_SUPPORTED) +void PNGAPI +png_set_tRNS(png_structp png_ptr, png_infop info_ptr, + png_bytep trans, int num_trans, png_color_16p trans_values) +{ + png_debug1(1, "in %s storage function\n", "tRNS"); + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (trans != NULL) + { + /* + * It may not actually be necessary to set png_ptr->trans here; + * we do it for backward compatibility with the way the png_handle_tRNS + * function used to do the allocation. + */ +#ifdef PNG_FREE_ME_SUPPORTED + png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); +#endif + /* Changed from num_trans to 256 in version 1.2.1 */ + png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr, + (png_uint_32)256); + png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans); +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_TRNS; +#else + png_ptr->flags |= PNG_FLAG_FREE_TRNS; +#endif + } + + if (trans_values != NULL) + { + png_memcpy(&(info_ptr->trans_values), trans_values, + png_sizeof(png_color_16)); + if (num_trans == 0) + num_trans = 1; + } + info_ptr->num_trans = (png_uint_16)num_trans; + info_ptr->valid |= PNG_INFO_tRNS; +} +#endif + +#if defined(PNG_sPLT_SUPPORTED) +void PNGAPI +png_set_sPLT(png_structp png_ptr, + png_infop info_ptr, png_sPLT_tp entries, int nentries) +{ + png_sPLT_tp np; + int i; + + np = (png_sPLT_tp)png_malloc_warn(png_ptr, + (info_ptr->splt_palettes_num + nentries) * png_sizeof(png_sPLT_t)); + if (np == NULL) + { + png_warning(png_ptr, "No memory for sPLT palettes."); + return; + } + + png_memcpy(np, info_ptr->splt_palettes, + info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t)); + png_free(png_ptr, info_ptr->splt_palettes); + info_ptr->splt_palettes=NULL; + + for (i = 0; i < nentries; i++) + { + png_sPLT_tp to = np + info_ptr->splt_palettes_num + i; + png_sPLT_tp from = entries + i; + + to->name = (png_charp)png_malloc(png_ptr, + png_strlen(from->name) + 1); + /* TODO: use png_malloc_warn */ + png_strcpy(to->name, from->name); + to->entries = (png_sPLT_entryp)png_malloc(png_ptr, + from->nentries * png_sizeof(png_sPLT_t)); + /* TODO: use png_malloc_warn */ + png_memcpy(to->entries, from->entries, + from->nentries * png_sizeof(png_sPLT_t)); + to->nentries = from->nentries; + to->depth = from->depth; + } + + info_ptr->splt_palettes = np; + info_ptr->splt_palettes_num += nentries; + info_ptr->valid |= PNG_INFO_sPLT; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_SPLT; +#endif +} +#endif /* PNG_sPLT_SUPPORTED */ + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +void PNGAPI +png_set_unknown_chunks(png_structp png_ptr, + png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns) +{ + png_unknown_chunkp np; + int i; + + if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) + return; + + np = (png_unknown_chunkp)png_malloc_warn(png_ptr, + (info_ptr->unknown_chunks_num + num_unknowns) * + png_sizeof(png_unknown_chunk)); + if (np == NULL) + { + png_warning(png_ptr, "Out of memory while processing unknown chunk."); + return; + } + + png_memcpy(np, info_ptr->unknown_chunks, + info_ptr->unknown_chunks_num * png_sizeof(png_unknown_chunk)); + png_free(png_ptr, info_ptr->unknown_chunks); + info_ptr->unknown_chunks=NULL; + + for (i = 0; i < num_unknowns; i++) + { + png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i; + png_unknown_chunkp from = unknowns + i; + + png_strncpy((png_charp)to->name, (png_charp)from->name, 5); + to->data = (png_bytep)png_malloc_warn(png_ptr, from->size); + if (to->data == NULL) + { + png_warning(png_ptr, "Out of memory processing unknown chunk."); + } + else + { + png_memcpy(to->data, from->data, from->size); + to->size = from->size; + + /* note our location in the read or write sequence */ + to->location = (png_byte)(png_ptr->mode & 0xff); + } + } + + info_ptr->unknown_chunks = np; + info_ptr->unknown_chunks_num += num_unknowns; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_UNKN; +#endif +} +void PNGAPI +png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, + int chunk, int location) +{ + if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk < + (int)info_ptr->unknown_chunks_num) + info_ptr->unknown_chunks[chunk].location = (png_byte)location; +} +#endif + +#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ + defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) +void PNGAPI +png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted) +{ + /* This function is deprecated in favor of png_permit_mng_features() + and will be removed from libpng-2.0.0 */ + png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n"); + if (png_ptr == NULL) + return; + png_ptr->mng_features_permitted = (png_byte) + ((png_ptr->mng_features_permitted & (~(PNG_FLAG_MNG_EMPTY_PLTE))) | + ((empty_plte_permitted & PNG_FLAG_MNG_EMPTY_PLTE))); +} +#endif + +#if defined(PNG_MNG_FEATURES_SUPPORTED) +png_uint_32 PNGAPI +png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) +{ + png_debug(1, "in png_permit_mng_features\n"); + if (png_ptr == NULL) + return (png_uint_32)0; + png_ptr->mng_features_permitted = + (png_byte)(mng_features & PNG_ALL_MNG_FEATURES); + return (png_uint_32)png_ptr->mng_features_permitted; +} +#endif + +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +void PNGAPI +png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep + chunk_list, int num_chunks) +{ + png_bytep new_list, p; + int i, old_num_chunks; + if (num_chunks == 0) + { + if(keep == PNG_HANDLE_CHUNK_ALWAYS || keep == PNG_HANDLE_CHUNK_IF_SAFE) + png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS; + else + png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS; + + if(keep == PNG_HANDLE_CHUNK_ALWAYS) + png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS; + else + png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS; + return; + } + if (chunk_list == NULL) + return; + old_num_chunks=png_ptr->num_chunk_list; + new_list=(png_bytep)png_malloc(png_ptr, + (png_uint_32)(5*(num_chunks+old_num_chunks))); + if(png_ptr->chunk_list != NULL) + { + png_memcpy(new_list, png_ptr->chunk_list, + (png_size_t)(5*old_num_chunks)); + png_free(png_ptr, png_ptr->chunk_list); + png_ptr->chunk_list=NULL; + } + png_memcpy(new_list+5*old_num_chunks, chunk_list, + (png_size_t)(5*num_chunks)); + for (p=new_list+5*old_num_chunks+4, i=0; inum_chunk_list=old_num_chunks+num_chunks; + png_ptr->chunk_list=new_list; +#ifdef PNG_FREE_ME_SUPPORTED + png_ptr->free_me |= PNG_FREE_LIST; +#endif +} +#endif + +#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) +void PNGAPI +png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, + png_user_chunk_ptr read_user_chunk_fn) +{ + png_debug(1, "in png_set_read_user_chunk_fn\n"); + png_ptr->read_user_chunk_fn = read_user_chunk_fn; + png_ptr->user_chunk_ptr = user_chunk_ptr; +} +#endif + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +void PNGAPI +png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) +{ + png_debug1(1, "in %s storage function\n", "rows"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if(info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers)) + png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); + info_ptr->row_pointers = row_pointers; + if(row_pointers) + info_ptr->valid |= PNG_INFO_IDAT; +} +#endif + +#ifdef PNG_WRITE_SUPPORTED +void PNGAPI +png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) +{ + if(png_ptr->zbuf) + png_free(png_ptr, png_ptr->zbuf); + png_ptr->zbuf_size = (png_size_t)size; + png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; +} +#endif + +void PNGAPI +png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) +{ + if (png_ptr && info_ptr) + info_ptr->valid &= ~(mask); +} + + +#ifndef PNG_1_0_X +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +/* this function was added to libpng 1.2.0 and should always exist by default */ +void PNGAPI +png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags) +{ + png_uint_32 settable_asm_flags; + png_uint_32 settable_mmx_flags; + + settable_mmx_flags = +#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 +#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW + 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 | +#endif + 0; + + /* could be some non-MMX ones in the future, but not currently: */ + settable_asm_flags = settable_mmx_flags; + + if (!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED) || + !(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)) + { + /* clear all MMX flags if MMX isn't supported */ + settable_asm_flags &= ~settable_mmx_flags; + png_ptr->asm_flags &= ~settable_mmx_flags; + } + + /* we're replacing the settable bits with those passed in by the user, + * so first zero them out of the master copy, then logical-OR in the + * allowed subset that was requested */ + + png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */ + png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */ +} +#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ + +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED +/* this function was added to libpng 1.2.0 */ +void PNGAPI +png_set_mmx_thresholds (png_structp png_ptr, + png_byte mmx_bitdepth_threshold, + png_uint_32 mmx_rowbytes_threshold) +{ + png_ptr->mmx_bitdepth_threshold = mmx_bitdepth_threshold; + png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold; +} +#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ + +#ifdef PNG_SET_USER_LIMITS_SUPPORTED +/* this function was added to libpng 1.2.6 */ +void PNGAPI +png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max, + png_uint_32 user_height_max) +{ + /* Images with dimensions larger than these limits will be + * rejected by png_set_IHDR(). To accept any PNG datastream + * regardless of dimensions, set both limits to 0x7ffffffL. + */ + png_ptr->user_width_max = user_width_max; + png_ptr->user_height_max = user_height_max; +} +#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ + +#endif /* ?PNG_1_0_X */ diff --git a/src/SFML/Graphics/libpng/pngtrans.c b/src/SFML/Graphics/libpng/pngtrans.c new file mode 100644 index 00000000..92781312 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngtrans.c @@ -0,0 +1,650 @@ + +/* pngtrans.c - transforms the data in a row (used by both readers and writers) + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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_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_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_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_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 = onebppswaptable; + else if (row_info->bit_depth == 2) + table = twobppswaptable; + else if (row_info->bit_depth == 4) + table = 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 +} diff --git a/src/SFML/Graphics/libpng/pngvcrd.c b/src/SFML/Graphics/libpng/pngvcrd.c new file mode 100644 index 00000000..84f805b3 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngvcrd.c @@ -0,0 +1,3903 @@ +/* pngvcrd.c - mixed C/assembler version of utilities to read a PNG file + * + * For Intel x86 CPU and Microsoft Visual C++ compiler + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 Glenn Randers-Pehrson + * Copyright (c) 1998, Intel Corporation + * + * Contributed by Nirav Chhatrapati, Intel Corporation, 1998 + * Interface to libpng contributed by Gilles Vollant, 1999 + * + * + * In png_do_read_interlace() in libpng versions 1.0.3a through 1.0.4d, + * a sign error in the post-MMX cleanup code for each pixel_depth resulted + * in bad pixels at the beginning of some rows of some images, and also + * (due to out-of-range memory reads and writes) caused heap corruption + * when compiled with MSVC 6.0. The error was fixed in version 1.0.4e. + * + * [png_read_filter_row_mmx_avg() bpp == 2 bugfix, GRR 20000916] + * + * [runtime MMX configuration, GRR 20010102] + * + */ + +#define PNG_INTERNAL +#include "png.h" + +#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD) + +static int mmx_supported=2; + + +int PNGAPI +png_mmx_support(void) +{ + int mmx_supported_local = 0; + _asm { + push ebx //CPUID will trash these + push ecx + push edx + + pushfd //Save Eflag to stack + pop eax //Get Eflag from stack into eax + mov ecx, eax //Make another copy of Eflag in ecx + xor eax, 0x200000 //Toggle ID bit in Eflag [i.e. bit(21)] + push eax //Save modified Eflag back to stack + + popfd //Restored modified value back to Eflag reg + pushfd //Save Eflag to stack + pop eax //Get Eflag from stack + push ecx // save original Eflag to stack + popfd // restore original Eflag + xor eax, ecx //Compare the new Eflag with the original Eflag + jz NOT_SUPPORTED //If the same, CPUID instruction is not supported, + //skip following instructions and jump to + //NOT_SUPPORTED label + + xor eax, eax //Set eax to zero + + _asm _emit 0x0f //CPUID instruction (two bytes opcode) + _asm _emit 0xa2 + + cmp eax, 1 //make sure eax return non-zero value + jl NOT_SUPPORTED //If eax is zero, mmx not supported + + xor eax, eax //set eax to zero + inc eax //Now increment eax to 1. This instruction is + //faster than the instruction "mov eax, 1" + + _asm _emit 0x0f //CPUID instruction + _asm _emit 0xa2 + + and edx, 0x00800000 //mask out all bits but mmx bit(24) + cmp edx, 0 // 0 = mmx not supported + jz NOT_SUPPORTED // non-zero = Yes, mmx IS supported + + mov mmx_supported_local, 1 //set return value to 1 + +NOT_SUPPORTED: + mov eax, mmx_supported_local //move return value to eax + pop edx //CPUID trashed these + pop ecx + pop ebx + } + + //mmx_supported_local=0; // test code for force don't support MMX + //printf("MMX : %u (1=MMX supported)\n",mmx_supported_local); + + mmx_supported = mmx_supported_local; + return mmx_supported_local; +} + +/* Combines the row recently read in with the previous row. + This routine takes care of alpha and transparency if requested. + This routine also handles the two methods of progressive display + of interlaced images, depending on the mask value. + The mask value describes which pixels are to be combined with + the row. The pattern always repeats every 8 pixels, so just 8 + bits are needed. A one indicates the pixel is to be combined; a + zero indicates the pixel is to be skipped. This is in addition + to any alpha or transparency value associated with the pixel. If + you want all pixels to be combined, pass 0xff (255) in mask. */ + +/* Use this routine for x86 platform - uses faster MMX routine if machine + supports MMX */ + +void /* PRIVATE */ +png_combine_row(png_structp png_ptr, png_bytep row, int mask) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; +#endif + + png_debug(1,"in png_combine_row_asm\n"); + + if (mmx_supported == 2) { +#if !defined(PNG_1_0_X) + /* this should have happened in png_init_mmx_flags() already */ + png_warning(png_ptr, "asm_flags may not have been initialized"); +#endif + png_mmx_support(); + } + + if (mask == 0xff) + { + png_memcpy(row, png_ptr->row_buf + 1, + (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->width)); + } + /* GRR: add "else if (mask == 0)" case? + * or does png_combine_row() not even get called in that case? */ + else + { + switch (png_ptr->row_info.pixel_depth) + { + case 1: + { + png_bytep sp; + png_bytep dp; + int s_inc, s_start, s_end; + int m; + int shift; + png_uint_32 i; + + sp = png_ptr->row_buf + 1; + dp = row; + m = 0x80; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 7; + s_inc = 1; + } + else +#endif + { + s_start = 7; + s_end = 0; + s_inc = -1; + } + + shift = s_start; + + for (i = 0; i < png_ptr->width; i++) + { + if (m & mask) + { + int value; + + value = (*sp >> shift) & 0x1; + *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + + case 2: + { + png_bytep sp; + png_bytep dp; + int s_start, s_end, s_inc; + int m; + int shift; + png_uint_32 i; + int value; + + sp = png_ptr->row_buf + 1; + dp = row; + m = 0x80; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 6; + s_inc = 2; + } + else +#endif + { + s_start = 6; + s_end = 0; + s_inc = -2; + } + + shift = s_start; + + for (i = 0; i < png_ptr->width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0x3; + *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + + case 4: + { + png_bytep sp; + png_bytep dp; + int s_start, s_end, s_inc; + int m; + int shift; + png_uint_32 i; + int value; + + sp = png_ptr->row_buf + 1; + dp = row; + m = 0x80; +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + { + s_start = 0; + s_end = 4; + s_inc = 4; + } + else +#endif + { + s_start = 4; + s_end = 0; + s_inc = -4; + } + shift = s_start; + + for (i = 0; i < png_ptr->width; i++) + { + if (m & mask) + { + value = (*sp >> shift) & 0xf; + *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); + *dp |= (png_byte)(value << shift); + } + + if (shift == s_end) + { + shift = s_start; + sp++; + dp++; + } + else + shift += s_inc; + if (m == 1) + m = 0x80; + else + m >>= 1; + } + break; + } + + case 8: + { + png_bytep srcptr; + png_bytep dstptr; + png_uint_32 len; + int m; + int diff, unmask; + + __int64 mask0=0x0102040810204080; + +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && mmx_supported */ ) +#else + if (mmx_supported) +#endif + { + srcptr = png_ptr->row_buf + 1; + dstptr = row; + m = 0x80; + unmask = ~mask; + len = png_ptr->width &~7; //reduce to multiple of 8 + diff = png_ptr->width & 7; //amount lost + + _asm + { + movd mm7, unmask //load bit pattern + psubb mm6,mm6 //zero mm6 + punpcklbw mm7,mm7 + punpcklwd mm7,mm7 + punpckldq mm7,mm7 //fill register with 8 masks + + movq mm0,mask0 + + pand mm0,mm7 //nonzero if keep byte + pcmpeqb mm0,mm6 //zeros->1s, v versa + + mov ecx,len //load length of line (pixels) + mov esi,srcptr //load source + mov ebx,dstptr //load dest + cmp ecx,0 //lcr + je mainloop8end + +mainloop8: + movq mm4,[esi] + pand mm4,mm0 + movq mm6,mm0 + pandn mm6,[ebx] + por mm4,mm6 + movq [ebx],mm4 + + add esi,8 //inc by 8 bytes processed + add ebx,8 + sub ecx,8 //dec by 8 pixels processed + + ja mainloop8 +mainloop8end: + + mov ecx,diff + cmp ecx,0 + jz end8 + + mov edx,mask + sal edx,24 //make low byte the high byte + +secondloop8: + sal edx,1 //move high bit to CF + jnc skip8 //if CF = 0 + mov al,[esi] + mov [ebx],al +skip8: + inc esi + inc ebx + + dec ecx + jnz secondloop8 +end8: + emms + } + } + else /* mmx not supported - use modified C routine */ + { + register unsigned int incr1, initial_val, final_val; + png_size_t pixel_bytes; + png_uint_32 i; + register int disp = png_pass_inc[png_ptr->pass]; + int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; + + pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* + pixel_bytes; + dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; + initial_val = offset_table[png_ptr->pass]*pixel_bytes; + final_val = png_ptr->width*pixel_bytes; + incr1 = (disp)*pixel_bytes; + for (i = initial_val; i < final_val; i += incr1) + { + png_memcpy(dstptr, srcptr, pixel_bytes); + srcptr += incr1; + dstptr += incr1; + } + } /* end of else */ + + break; + } // end 8 bpp + + case 16: + { + png_bytep srcptr; + png_bytep dstptr; + png_uint_32 len; + int unmask, diff; + __int64 mask1=0x0101020204040808, + mask0=0x1010202040408080; + +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && mmx_supported */ ) +#else + if (mmx_supported) +#endif + { + srcptr = png_ptr->row_buf + 1; + dstptr = row; + + unmask = ~mask; + len = (png_ptr->width)&~7; + diff = (png_ptr->width)&7; + _asm + { + movd mm7, unmask //load bit pattern + psubb mm6,mm6 //zero mm6 + punpcklbw mm7,mm7 + punpcklwd mm7,mm7 + punpckldq mm7,mm7 //fill register with 8 masks + + movq mm0,mask0 + movq mm1,mask1 + + pand mm0,mm7 + pand mm1,mm7 + + pcmpeqb mm0,mm6 + pcmpeqb mm1,mm6 + + mov ecx,len //load length of line + mov esi,srcptr //load source + mov ebx,dstptr //load dest + cmp ecx,0 //lcr + jz mainloop16end + +mainloop16: + movq mm4,[esi] + pand mm4,mm0 + movq mm6,mm0 + movq mm7,[ebx] + pandn mm6,mm7 + por mm4,mm6 + movq [ebx],mm4 + + movq mm5,[esi+8] + pand mm5,mm1 + movq mm7,mm1 + movq mm6,[ebx+8] + pandn mm7,mm6 + por mm5,mm7 + movq [ebx+8],mm5 + + add esi,16 //inc by 16 bytes processed + add ebx,16 + sub ecx,8 //dec by 8 pixels processed + + ja mainloop16 + +mainloop16end: + mov ecx,diff + cmp ecx,0 + jz end16 + + mov edx,mask + sal edx,24 //make low byte the high byte +secondloop16: + sal edx,1 //move high bit to CF + jnc skip16 //if CF = 0 + mov ax,[esi] + mov [ebx],ax +skip16: + add esi,2 + add ebx,2 + + dec ecx + jnz secondloop16 +end16: + emms + } + } + else /* mmx not supported - use modified C routine */ + { + register unsigned int incr1, initial_val, final_val; + png_size_t pixel_bytes; + png_uint_32 i; + register int disp = png_pass_inc[png_ptr->pass]; + int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; + + pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* + pixel_bytes; + dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; + initial_val = offset_table[png_ptr->pass]*pixel_bytes; + final_val = png_ptr->width*pixel_bytes; + incr1 = (disp)*pixel_bytes; + for (i = initial_val; i < final_val; i += incr1) + { + png_memcpy(dstptr, srcptr, pixel_bytes); + srcptr += incr1; + dstptr += incr1; + } + } /* end of else */ + + break; + } // end 16 bpp + + case 24: + { + png_bytep srcptr; + png_bytep dstptr; + png_uint_32 len; + int unmask, diff; + + __int64 mask2=0x0101010202020404, //24bpp + mask1=0x0408080810101020, + mask0=0x2020404040808080; + + srcptr = png_ptr->row_buf + 1; + dstptr = row; + + unmask = ~mask; + len = (png_ptr->width)&~7; + diff = (png_ptr->width)&7; + +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && mmx_supported */ ) +#else + if (mmx_supported) +#endif + { + _asm + { + movd mm7, unmask //load bit pattern + psubb mm6,mm6 //zero mm6 + punpcklbw mm7,mm7 + punpcklwd mm7,mm7 + punpckldq mm7,mm7 //fill register with 8 masks + + movq mm0,mask0 + movq mm1,mask1 + movq mm2,mask2 + + pand mm0,mm7 + pand mm1,mm7 + pand mm2,mm7 + + pcmpeqb mm0,mm6 + pcmpeqb mm1,mm6 + pcmpeqb mm2,mm6 + + mov ecx,len //load length of line + mov esi,srcptr //load source + mov ebx,dstptr //load dest + cmp ecx,0 + jz mainloop24end + +mainloop24: + movq mm4,[esi] + pand mm4,mm0 + movq mm6,mm0 + movq mm7,[ebx] + pandn mm6,mm7 + por mm4,mm6 + movq [ebx],mm4 + + + movq mm5,[esi+8] + pand mm5,mm1 + movq mm7,mm1 + movq mm6,[ebx+8] + pandn mm7,mm6 + por mm5,mm7 + movq [ebx+8],mm5 + + movq mm6,[esi+16] + pand mm6,mm2 + movq mm4,mm2 + movq mm7,[ebx+16] + pandn mm4,mm7 + por mm6,mm4 + movq [ebx+16],mm6 + + add esi,24 //inc by 24 bytes processed + add ebx,24 + sub ecx,8 //dec by 8 pixels processed + + ja mainloop24 + +mainloop24end: + mov ecx,diff + cmp ecx,0 + jz end24 + + mov edx,mask + sal edx,24 //make low byte the high byte +secondloop24: + sal edx,1 //move high bit to CF + jnc skip24 //if CF = 0 + mov ax,[esi] + mov [ebx],ax + xor eax,eax + mov al,[esi+2] + mov [ebx+2],al +skip24: + add esi,3 + add ebx,3 + + dec ecx + jnz secondloop24 + +end24: + emms + } + } + else /* mmx not supported - use modified C routine */ + { + register unsigned int incr1, initial_val, final_val; + png_size_t pixel_bytes; + png_uint_32 i; + register int disp = png_pass_inc[png_ptr->pass]; + int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; + + pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* + pixel_bytes; + dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; + initial_val = offset_table[png_ptr->pass]*pixel_bytes; + final_val = png_ptr->width*pixel_bytes; + incr1 = (disp)*pixel_bytes; + for (i = initial_val; i < final_val; i += incr1) + { + png_memcpy(dstptr, srcptr, pixel_bytes); + srcptr += incr1; + dstptr += incr1; + } + } /* end of else */ + + break; + } // end 24 bpp + + case 32: + { + png_bytep srcptr; + png_bytep dstptr; + png_uint_32 len; + int unmask, diff; + + __int64 mask3=0x0101010102020202, //32bpp + mask2=0x0404040408080808, + mask1=0x1010101020202020, + mask0=0x4040404080808080; + + srcptr = png_ptr->row_buf + 1; + dstptr = row; + + unmask = ~mask; + len = (png_ptr->width)&~7; + diff = (png_ptr->width)&7; + +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && mmx_supported */ ) +#else + if (mmx_supported) +#endif + { + _asm + { + movd mm7, unmask //load bit pattern + psubb mm6,mm6 //zero mm6 + punpcklbw mm7,mm7 + punpcklwd mm7,mm7 + punpckldq mm7,mm7 //fill register with 8 masks + + movq mm0,mask0 + movq mm1,mask1 + movq mm2,mask2 + movq mm3,mask3 + + pand mm0,mm7 + pand mm1,mm7 + pand mm2,mm7 + pand mm3,mm7 + + pcmpeqb mm0,mm6 + pcmpeqb mm1,mm6 + pcmpeqb mm2,mm6 + pcmpeqb mm3,mm6 + + mov ecx,len //load length of line + mov esi,srcptr //load source + mov ebx,dstptr //load dest + + cmp ecx,0 //lcr + jz mainloop32end + +mainloop32: + movq mm4,[esi] + pand mm4,mm0 + movq mm6,mm0 + movq mm7,[ebx] + pandn mm6,mm7 + por mm4,mm6 + movq [ebx],mm4 + + movq mm5,[esi+8] + pand mm5,mm1 + movq mm7,mm1 + movq mm6,[ebx+8] + pandn mm7,mm6 + por mm5,mm7 + movq [ebx+8],mm5 + + movq mm6,[esi+16] + pand mm6,mm2 + movq mm4,mm2 + movq mm7,[ebx+16] + pandn mm4,mm7 + por mm6,mm4 + movq [ebx+16],mm6 + + movq mm7,[esi+24] + pand mm7,mm3 + movq mm5,mm3 + movq mm4,[ebx+24] + pandn mm5,mm4 + por mm7,mm5 + movq [ebx+24],mm7 + + add esi,32 //inc by 32 bytes processed + add ebx,32 + sub ecx,8 //dec by 8 pixels processed + + ja mainloop32 + +mainloop32end: + mov ecx,diff + cmp ecx,0 + jz end32 + + mov edx,mask + sal edx,24 //make low byte the high byte +secondloop32: + sal edx,1 //move high bit to CF + jnc skip32 //if CF = 0 + mov eax,[esi] + mov [ebx],eax +skip32: + add esi,4 + add ebx,4 + + dec ecx + jnz secondloop32 + +end32: + emms + } + } + else /* mmx _not supported - Use modified C routine */ + { + register unsigned int incr1, initial_val, final_val; + png_size_t pixel_bytes; + png_uint_32 i; + register int disp = png_pass_inc[png_ptr->pass]; + int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; + + pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* + pixel_bytes; + dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; + initial_val = offset_table[png_ptr->pass]*pixel_bytes; + final_val = png_ptr->width*pixel_bytes; + incr1 = (disp)*pixel_bytes; + for (i = initial_val; i < final_val; i += incr1) + { + png_memcpy(dstptr, srcptr, pixel_bytes); + srcptr += incr1; + dstptr += incr1; + } + } /* end of else */ + + break; + } // end 32 bpp + + case 48: + { + png_bytep srcptr; + png_bytep dstptr; + png_uint_32 len; + int unmask, diff; + + __int64 mask5=0x0101010101010202, + mask4=0x0202020204040404, + mask3=0x0404080808080808, + mask2=0x1010101010102020, + mask1=0x2020202040404040, + mask0=0x4040808080808080; + +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) + /* && mmx_supported */ ) +#else + if (mmx_supported) +#endif + { + srcptr = png_ptr->row_buf + 1; + dstptr = row; + + unmask = ~mask; + len = (png_ptr->width)&~7; + diff = (png_ptr->width)&7; + _asm + { + movd mm7, unmask //load bit pattern + psubb mm6,mm6 //zero mm6 + punpcklbw mm7,mm7 + punpcklwd mm7,mm7 + punpckldq mm7,mm7 //fill register with 8 masks + + movq mm0,mask0 + movq mm1,mask1 + movq mm2,mask2 + movq mm3,mask3 + movq mm4,mask4 + movq mm5,mask5 + + pand mm0,mm7 + pand mm1,mm7 + pand mm2,mm7 + pand mm3,mm7 + pand mm4,mm7 + pand mm5,mm7 + + pcmpeqb mm0,mm6 + pcmpeqb mm1,mm6 + pcmpeqb mm2,mm6 + pcmpeqb mm3,mm6 + pcmpeqb mm4,mm6 + pcmpeqb mm5,mm6 + + mov ecx,len //load length of line + mov esi,srcptr //load source + mov ebx,dstptr //load dest + + cmp ecx,0 + jz mainloop48end + +mainloop48: + movq mm7,[esi] + pand mm7,mm0 + movq mm6,mm0 + pandn mm6,[ebx] + por mm7,mm6 + movq [ebx],mm7 + + movq mm6,[esi+8] + pand mm6,mm1 + movq mm7,mm1 + pandn mm7,[ebx+8] + por mm6,mm7 + movq [ebx+8],mm6 + + movq mm6,[esi+16] + pand mm6,mm2 + movq mm7,mm2 + pandn mm7,[ebx+16] + por mm6,mm7 + movq [ebx+16],mm6 + + movq mm7,[esi+24] + pand mm7,mm3 + movq mm6,mm3 + pandn mm6,[ebx+24] + por mm7,mm6 + movq [ebx+24],mm7 + + movq mm6,[esi+32] + pand mm6,mm4 + movq mm7,mm4 + pandn mm7,[ebx+32] + por mm6,mm7 + movq [ebx+32],mm6 + + movq mm7,[esi+40] + pand mm7,mm5 + movq mm6,mm5 + pandn mm6,[ebx+40] + por mm7,mm6 + movq [ebx+40],mm7 + + add esi,48 //inc by 32 bytes processed + add ebx,48 + sub ecx,8 //dec by 8 pixels processed + + ja mainloop48 +mainloop48end: + + mov ecx,diff + cmp ecx,0 + jz end48 + + mov edx,mask + sal edx,24 //make low byte the high byte + +secondloop48: + sal edx,1 //move high bit to CF + jnc skip48 //if CF = 0 + mov eax,[esi] + mov [ebx],eax +skip48: + add esi,4 + add ebx,4 + + dec ecx + jnz secondloop48 + +end48: + emms + } + } + else /* mmx _not supported - Use modified C routine */ + { + register unsigned int incr1, initial_val, final_val; + png_size_t pixel_bytes; + png_uint_32 i; + register int disp = png_pass_inc[png_ptr->pass]; + int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; + + pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* + pixel_bytes; + dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; + initial_val = offset_table[png_ptr->pass]*pixel_bytes; + final_val = png_ptr->width*pixel_bytes; + incr1 = (disp)*pixel_bytes; + for (i = initial_val; i < final_val; i += incr1) + { + png_memcpy(dstptr, srcptr, pixel_bytes); + srcptr += incr1; + dstptr += incr1; + } + } /* end of else */ + + break; + } // end 48 bpp + + default: + { + png_bytep sptr; + png_bytep dp; + png_size_t pixel_bytes; + int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; + unsigned int i; + register int disp = png_pass_inc[png_ptr->pass]; // get the offset + register unsigned int incr1, initial_val, final_val; + + pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); + sptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* + pixel_bytes; + dp = row + offset_table[png_ptr->pass]*pixel_bytes; + initial_val = offset_table[png_ptr->pass]*pixel_bytes; + final_val = png_ptr->width*pixel_bytes; + incr1 = (disp)*pixel_bytes; + for (i = initial_val; i < final_val; i += incr1) + { + png_memcpy(dp, sptr, pixel_bytes); + sptr += incr1; + dp += incr1; + } + break; + } + } /* end switch (png_ptr->row_info.pixel_depth) */ + } /* end if (non-trivial mask) */ + +} /* end png_combine_row() */ + + +#if defined(PNG_READ_INTERLACING_SUPPORTED) + +void /* PRIVATE */ +png_do_read_interlace(png_structp png_ptr) +{ + png_row_infop row_info = &(png_ptr->row_info); + png_bytep row = png_ptr->row_buf + 1; + int pass = png_ptr->pass; + png_uint_32 transformations = png_ptr->transformations; +#ifdef PNG_USE_LOCAL_ARRAYS + const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; +#endif + + png_debug(1,"in png_do_read_interlace\n"); + + if (mmx_supported == 2) { +#if !defined(PNG_1_0_X) + /* this should have happened in png_init_mmx_flags() already */ + png_warning(png_ptr, "asm_flags may not have been initialized"); +#endif + png_mmx_support(); + } + + if (row != NULL && row_info != NULL) + { + png_uint_32 final_width; + + final_width = row_info->width * png_pass_inc[pass]; + + switch (row_info->pixel_depth) + { + case 1: + { + png_bytep sp, dp; + int sshift, dshift; + int s_start, s_end, s_inc; + png_byte v; + png_uint_32 i; + int j; + + sp = row + (png_size_t)((row_info->width - 1) >> 3); + dp = row + (png_size_t)((final_width - 1) >> 3); +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (int)((row_info->width + 7) & 7); + dshift = (int)((final_width + 7) & 7); + s_start = 7; + s_end = 0; + s_inc = -1; + } + else +#endif + { + sshift = 7 - (int)((row_info->width + 7) & 7); + dshift = 7 - (int)((final_width + 7) & 7); + s_start = 0; + s_end = 7; + s_inc = 1; + } + + for (i = row_info->width; i; i--) + { + v = (png_byte)((*sp >> sshift) & 0x1); + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + + case 2: + { + png_bytep sp, dp; + int sshift, dshift; + int s_start, s_end, s_inc; + png_uint_32 i; + + sp = row + (png_size_t)((row_info->width - 1) >> 2); + dp = row + (png_size_t)((final_width - 1) >> 2); +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (png_size_t)(((row_info->width + 3) & 3) << 1); + dshift = (png_size_t)(((final_width + 3) & 3) << 1); + s_start = 6; + s_end = 0; + s_inc = -2; + } + else +#endif + { + sshift = (png_size_t)((3 - ((row_info->width + 3) & 3)) << 1); + dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1); + s_start = 0; + s_end = 6; + s_inc = 2; + } + + for (i = row_info->width; i; i--) + { + png_byte v; + int j; + + v = (png_byte)((*sp >> sshift) & 0x3); + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + + case 4: + { + png_bytep sp, dp; + int sshift, dshift; + int s_start, s_end, s_inc; + png_uint_32 i; + + sp = row + (png_size_t)((row_info->width - 1) >> 1); + dp = row + (png_size_t)((final_width - 1) >> 1); +#if defined(PNG_READ_PACKSWAP_SUPPORTED) + if (transformations & PNG_PACKSWAP) + { + sshift = (png_size_t)(((row_info->width + 1) & 1) << 2); + dshift = (png_size_t)(((final_width + 1) & 1) << 2); + s_start = 4; + s_end = 0; + s_inc = -4; + } + else +#endif + { + sshift = (png_size_t)((1 - ((row_info->width + 1) & 1)) << 2); + dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2); + s_start = 0; + s_end = 4; + s_inc = 4; + } + + for (i = row_info->width; i; i--) + { + png_byte v; + int j; + + v = (png_byte)((*sp >> sshift) & 0xf); + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); + *dp |= (png_byte)(v << dshift); + if (dshift == s_end) + { + dshift = s_start; + dp--; + } + else + dshift += s_inc; + } + if (sshift == s_end) + { + sshift = s_start; + sp--; + } + else + sshift += s_inc; + } + break; + } + + default: // This is the place where the routine is modified + { + __int64 const4 = 0x0000000000FFFFFF; + // __int64 const5 = 0x000000FFFFFF0000; // unused... + __int64 const6 = 0x00000000000000FF; + png_bytep sptr, dp; + png_uint_32 i; + png_size_t pixel_bytes; + int width = row_info->width; + + pixel_bytes = (row_info->pixel_depth >> 3); + + sptr = row + (width - 1) * pixel_bytes; + dp = row + (final_width - 1) * pixel_bytes; + // New code by Nirav Chhatrapati - Intel Corporation + // sign fix by GRR + // NOTE: there is NO MMX code for 48-bit and 64-bit images + + // use MMX routine if machine supports it +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE) + /* && mmx_supported */ ) +#else + if (mmx_supported) +#endif + { + if (pixel_bytes == 3) + { + if (((pass == 0) || (pass == 1)) && width) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width + sub edi, 21 // (png_pass_inc[pass] - 1)*pixel_bytes +loop_pass0: + movd mm0, [esi] ; X X X X X v2 v1 v0 + pand mm0, const4 ; 0 0 0 0 0 v2 v1 v0 + movq mm1, mm0 ; 0 0 0 0 0 v2 v1 v0 + psllq mm0, 16 ; 0 0 0 v2 v1 v0 0 0 + movq mm2, mm0 ; 0 0 0 v2 v1 v0 0 0 + psllq mm0, 24 ; v2 v1 v0 0 0 0 0 0 + psrlq mm1, 8 ; 0 0 0 0 0 0 v2 v1 + por mm0, mm2 ; v2 v1 v0 v2 v1 v0 0 0 + por mm0, mm1 ; v2 v1 v0 v2 v1 v0 v2 v1 + movq mm3, mm0 ; v2 v1 v0 v2 v1 v0 v2 v1 + psllq mm0, 16 ; v0 v2 v1 v0 v2 v1 0 0 + movq mm4, mm3 ; v2 v1 v0 v2 v1 v0 v2 v1 + punpckhdq mm3, mm0 ; v0 v2 v1 v0 v2 v1 v0 v2 + movq [edi+16] , mm4 + psrlq mm0, 32 ; 0 0 0 0 v0 v2 v1 v0 + movq [edi+8] , mm3 + punpckldq mm0, mm4 ; v1 v0 v2 v1 v0 v2 v1 v0 + sub esi, 3 + movq [edi], mm0 + sub edi, 24 + //sub esi, 3 + dec ecx + jnz loop_pass0 + EMMS + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width + sub edi, 9 // (png_pass_inc[pass] - 1)*pixel_bytes +loop_pass2: + movd mm0, [esi] ; X X X X X v2 v1 v0 + pand mm0, const4 ; 0 0 0 0 0 v2 v1 v0 + movq mm1, mm0 ; 0 0 0 0 0 v2 v1 v0 + psllq mm0, 16 ; 0 0 0 v2 v1 v0 0 0 + movq mm2, mm0 ; 0 0 0 v2 v1 v0 0 0 + psllq mm0, 24 ; v2 v1 v0 0 0 0 0 0 + psrlq mm1, 8 ; 0 0 0 0 0 0 v2 v1 + por mm0, mm2 ; v2 v1 v0 v2 v1 v0 0 0 + por mm0, mm1 ; v2 v1 v0 v2 v1 v0 v2 v1 + movq [edi+4], mm0 ; move to memory + psrlq mm0, 16 ; 0 0 v2 v1 v0 v2 v1 v0 + movd [edi], mm0 ; move to memory + sub esi, 3 + sub edi, 12 + dec ecx + jnz loop_pass2 + EMMS + } + } + else if (width) /* && ((pass == 4) || (pass == 5)) */ + { + int width_mmx = ((width >> 1) << 1) - 8; + if (width_mmx < 0) + width_mmx = 0; + width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 3 + sub edi, 9 +loop_pass4: + movq mm0, [esi] ; X X v2 v1 v0 v5 v4 v3 + movq mm7, mm0 ; X X v2 v1 v0 v5 v4 v3 + movq mm6, mm0 ; X X v2 v1 v0 v5 v4 v3 + psllq mm0, 24 ; v1 v0 v5 v4 v3 0 0 0 + pand mm7, const4 ; 0 0 0 0 0 v5 v4 v3 + psrlq mm6, 24 ; 0 0 0 X X v2 v1 v0 + por mm0, mm7 ; v1 v0 v5 v4 v3 v5 v4 v3 + movq mm5, mm6 ; 0 0 0 X X v2 v1 v0 + psllq mm6, 8 ; 0 0 X X v2 v1 v0 0 + movq [edi], mm0 ; move quad to memory + psrlq mm5, 16 ; 0 0 0 0 0 X X v2 + pand mm5, const6 ; 0 0 0 0 0 0 0 v2 + por mm6, mm5 ; 0 0 X X v2 v1 v0 v2 + movd [edi+8], mm6 ; move double to memory + sub esi, 6 + sub edi, 12 + sub ecx, 2 + jnz loop_pass4 + EMMS + } + } + + sptr -= width_mmx*3; + dp -= width_mmx*6; + for (i = width; i; i--) + { + png_byte v[8]; + int j; + + png_memcpy(v, sptr, 3); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 3); + dp -= 3; + } + sptr -= 3; + } + } + } /* end of pixel_bytes == 3 */ + + else if (pixel_bytes == 1) + { + if (((pass == 0) || (pass == 1)) && width) + { + int width_mmx = ((width >> 2) << 2); + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub edi, 31 + sub esi, 3 +loop1_pass0: + movd mm0, [esi] ; X X X X v0 v1 v2 v3 + movq mm1, mm0 ; X X X X v0 v1 v2 v3 + punpcklbw mm0, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 + movq mm2, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 + punpcklwd mm0, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3 + movq mm3, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3 + punpckldq mm0, mm0 ; v3 v3 v3 v3 v3 v3 v3 v3 + punpckhdq mm3, mm3 ; v2 v2 v2 v2 v2 v2 v2 v2 + movq [edi], mm0 ; move to memory v3 + punpckhwd mm2, mm2 ; v0 v0 v0 v0 v1 v1 v1 v1 + movq [edi+8], mm3 ; move to memory v2 + movq mm4, mm2 ; v0 v0 v0 v0 v1 v1 v1 v1 + punpckldq mm2, mm2 ; v1 v1 v1 v1 v1 v1 v1 v1 + punpckhdq mm4, mm4 ; v0 v0 v0 v0 v0 v0 v0 v0 + movq [edi+16], mm2 ; move to memory v1 + movq [edi+24], mm4 ; move to memory v0 + sub esi, 4 + sub edi, 32 + sub ecx, 4 + jnz loop1_pass0 + EMMS + } + } + + sptr -= width_mmx; + dp -= width_mmx*8; + for (i = width; i; i--) + { + int j; + + /* I simplified this part in version 1.0.4e + * here and in several other instances where + * pixel_bytes == 1 -- GR-P + * + * Original code: + * + * png_byte v[8]; + * png_memcpy(v, sptr, pixel_bytes); + * for (j = 0; j < png_pass_inc[pass]; j++) + * { + * png_memcpy(dp, v, pixel_bytes); + * dp -= pixel_bytes; + * } + * sptr -= pixel_bytes; + * + * Replacement code is in the next three lines: + */ + + for (j = 0; j < png_pass_inc[pass]; j++) + *dp-- = *sptr; + sptr--; + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + int width_mmx = ((width >> 2) << 2); + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub edi, 15 + sub esi, 3 +loop1_pass2: + movd mm0, [esi] ; X X X X v0 v1 v2 v3 + punpcklbw mm0, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 + movq mm1, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 + punpcklwd mm0, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3 + punpckhwd mm1, mm1 ; v0 v0 v0 v0 v1 v1 v1 v1 + movq [edi], mm0 ; move to memory v2 and v3 + sub esi, 4 + movq [edi+8], mm1 ; move to memory v1 and v0 + sub edi, 16 + sub ecx, 4 + jnz loop1_pass2 + EMMS + } + } + + sptr -= width_mmx; + dp -= width_mmx*4; + for (i = width; i; i--) + { + int j; + + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp-- = *sptr; + } + sptr --; + } + } + else if (width) /* && ((pass == 4) || (pass == 5))) */ + { + int width_mmx = ((width >> 3) << 3); + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub edi, 15 + sub esi, 7 +loop1_pass4: + movq mm0, [esi] ; v0 v1 v2 v3 v4 v5 v6 v7 + movq mm1, mm0 ; v0 v1 v2 v3 v4 v5 v6 v7 + punpcklbw mm0, mm0 ; v4 v4 v5 v5 v6 v6 v7 v7 + //movq mm1, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 + punpckhbw mm1, mm1 ;v0 v0 v1 v1 v2 v2 v3 v3 + movq [edi+8], mm1 ; move to memory v0 v1 v2 and v3 + sub esi, 8 + movq [edi], mm0 ; move to memory v4 v5 v6 and v7 + //sub esi, 4 + sub edi, 16 + sub ecx, 8 + jnz loop1_pass4 + EMMS + } + } + + sptr -= width_mmx; + dp -= width_mmx*2; + for (i = width; i; i--) + { + int j; + + for (j = 0; j < png_pass_inc[pass]; j++) + { + *dp-- = *sptr; + } + sptr --; + } + } + } /* end of pixel_bytes == 1 */ + + else if (pixel_bytes == 2) + { + if (((pass == 0) || (pass == 1)) && width) + { + int width_mmx = ((width >> 1) << 1); + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 2 + sub edi, 30 +loop2_pass0: + movd mm0, [esi] ; X X X X v1 v0 v3 v2 + punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 + movq mm1, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 + punpckldq mm0, mm0 ; v3 v2 v3 v2 v3 v2 v3 v2 + punpckhdq mm1, mm1 ; v1 v0 v1 v0 v1 v0 v1 v0 + movq [edi], mm0 + movq [edi + 8], mm0 + movq [edi + 16], mm1 + movq [edi + 24], mm1 + sub esi, 4 + sub edi, 32 + sub ecx, 2 + jnz loop2_pass0 + EMMS + } + } + + sptr -= (width_mmx*2 - 2); // sign fixed + dp -= (width_mmx*16 - 2); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 2; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 2; + png_memcpy(dp, v, 2); + } + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 2 + sub edi, 14 +loop2_pass2: + movd mm0, [esi] ; X X X X v1 v0 v3 v2 + punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 + movq mm1, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 + punpckldq mm0, mm0 ; v3 v2 v3 v2 v3 v2 v3 v2 + punpckhdq mm1, mm1 ; v1 v0 v1 v0 v1 v0 v1 v0 + movq [edi], mm0 + sub esi, 4 + movq [edi + 8], mm1 + //sub esi, 4 + sub edi, 16 + sub ecx, 2 + jnz loop2_pass2 + EMMS + } + } + + sptr -= (width_mmx*2 - 2); // sign fixed + dp -= (width_mmx*8 - 2); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 2; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 2; + png_memcpy(dp, v, 2); + } + } + } + else if (width) // pass == 4 or 5 + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 2 + sub edi, 6 +loop2_pass4: + movd mm0, [esi] ; X X X X v1 v0 v3 v2 + punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 + sub esi, 4 + movq [edi], mm0 + sub edi, 8 + sub ecx, 2 + jnz loop2_pass4 + EMMS + } + } + + sptr -= (width_mmx*2 - 2); // sign fixed + dp -= (width_mmx*4 - 2); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 2; + png_memcpy(v, sptr, 2); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 2; + png_memcpy(dp, v, 2); + } + } + } + } /* end of pixel_bytes == 2 */ + + else if (pixel_bytes == 4) + { + if (((pass == 0) || (pass == 1)) && width) + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 4 + sub edi, 60 +loop4_pass0: + movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4 + movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4 + punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4 + punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0 + movq [edi], mm0 + movq [edi + 8], mm0 + movq [edi + 16], mm0 + movq [edi + 24], mm0 + movq [edi+32], mm1 + movq [edi + 40], mm1 + movq [edi+ 48], mm1 + sub esi, 8 + movq [edi + 56], mm1 + sub edi, 64 + sub ecx, 2 + jnz loop4_pass0 + EMMS + } + } + + sptr -= (width_mmx*4 - 4); // sign fixed + dp -= (width_mmx*32 - 4); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 4; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 4; + png_memcpy(dp, v, 4); + } + } + } + else if (((pass == 2) || (pass == 3)) && width) + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 4 + sub edi, 28 +loop4_pass2: + movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4 + movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4 + punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4 + punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0 + movq [edi], mm0 + movq [edi + 8], mm0 + movq [edi+16], mm1 + movq [edi + 24], mm1 + sub esi, 8 + sub edi, 32 + sub ecx, 2 + jnz loop4_pass2 + EMMS + } + } + + sptr -= (width_mmx*4 - 4); // sign fixed + dp -= (width_mmx*16 - 4); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 4; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 4; + png_memcpy(dp, v, 4); + } + } + } + else if (width) // pass == 4 or 5 + { + int width_mmx = ((width >> 1) << 1) ; + width -= width_mmx; + if (width_mmx) + { + _asm + { + mov esi, sptr + mov edi, dp + mov ecx, width_mmx + sub esi, 4 + sub edi, 12 +loop4_pass4: + movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4 + movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4 + punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4 + punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0 + movq [edi], mm0 + sub esi, 8 + movq [edi + 8], mm1 + sub edi, 16 + sub ecx, 2 + jnz loop4_pass4 + EMMS + } + } + + sptr -= (width_mmx*4 - 4); // sign fixed + dp -= (width_mmx*8 - 4); // sign fixed + for (i = width; i; i--) + { + png_byte v[8]; + int j; + sptr -= 4; + png_memcpy(v, sptr, 4); + for (j = 0; j < png_pass_inc[pass]; j++) + { + dp -= 4; + png_memcpy(dp, v, 4); + } + } + } + + } /* end of pixel_bytes == 4 */ + + else if (pixel_bytes == 6) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, 6); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, 6); + dp -= 6; + } + sptr -= 6; + } + } /* end of pixel_bytes == 6 */ + + else + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr-= pixel_bytes; + } + } + } /* end of mmx_supported */ + + else /* MMX not supported: use modified C code - takes advantage + * of inlining of memcpy for a constant */ + { + if (pixel_bytes == 1) + { + for (i = width; i; i--) + { + int j; + for (j = 0; j < png_pass_inc[pass]; j++) + *dp-- = *sptr; + sptr--; + } + } + else if (pixel_bytes == 3) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr -= pixel_bytes; + } + } + else if (pixel_bytes == 2) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr -= pixel_bytes; + } + } + else if (pixel_bytes == 4) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr -= pixel_bytes; + } + } + else if (pixel_bytes == 6) + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr -= pixel_bytes; + } + } + else + { + for (i = width; i; i--) + { + png_byte v[8]; + int j; + png_memcpy(v, sptr, pixel_bytes); + for (j = 0; j < png_pass_inc[pass]; j++) + { + png_memcpy(dp, v, pixel_bytes); + dp -= pixel_bytes; + } + sptr -= pixel_bytes; + } + } + + } /* end of MMX not supported */ + break; + } + } /* end switch (row_info->pixel_depth) */ + + row_info->width = final_width; + + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width); + } + +} + +#endif /* PNG_READ_INTERLACING_SUPPORTED */ + + +// These variables are utilized in the functions below. They are declared +// globally here to ensure alignment on 8-byte boundaries. + +union uAll { + __int64 use; + double align; +} LBCarryMask = {0x0101010101010101}, + HBClearMask = {0x7f7f7f7f7f7f7f7f}, + ActiveMask, ActiveMask2, ActiveMaskEnd, ShiftBpp, ShiftRem; + + +// Optimized code for PNG Average filter decoder +void /* PRIVATE */ +png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row + , png_bytep prev_row) +{ + int bpp; + png_uint_32 FullLength; + png_uint_32 MMXLength; + //png_uint_32 len; + int diff; + + bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel + FullLength = row_info->rowbytes; // # of bytes to filter + _asm { + // Init address pointers and offset + mov edi, row // edi ==> Avg(x) + xor ebx, ebx // ebx ==> x + mov edx, edi + mov esi, prev_row // esi ==> Prior(x) + sub edx, bpp // edx ==> Raw(x-bpp) + + xor eax, eax + // Compute the Raw value for the first bpp bytes + // Raw(x) = Avg(x) + (Prior(x)/2) +davgrlp: + mov al, [esi + ebx] // Load al with Prior(x) + inc ebx + shr al, 1 // divide by 2 + add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx + cmp ebx, bpp + mov [edi+ebx-1], al // Write back Raw(x); + // mov does not affect flags; -1 to offset inc ebx + jb davgrlp + // get # of bytes to alignment + mov diff, edi // take start of row + add diff, ebx // add bpp + add diff, 0xf // add 7 + 8 to incr past alignment boundary + and diff, 0xfffffff8 // mask to alignment boundary + sub diff, edi // subtract from start ==> value ebx at alignment + jz davggo + // fix alignment + // Compute the Raw value for the bytes upto the alignment boundary + // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) + xor ecx, ecx +davglp1: + xor eax, eax + mov cl, [esi + ebx] // load cl with Prior(x) + mov al, [edx + ebx] // load al with Raw(x-bpp) + add ax, cx + inc ebx + shr ax, 1 // divide by 2 + add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx + cmp ebx, diff // Check if at alignment boundary + mov [edi+ebx-1], al // Write back Raw(x); + // mov does not affect flags; -1 to offset inc ebx + jb davglp1 // Repeat until at alignment boundary +davggo: + mov eax, FullLength + mov ecx, eax + sub eax, ebx // subtract alignment fix + and eax, 0x00000007 // calc bytes over mult of 8 + sub ecx, eax // drop over bytes from original length + mov MMXLength, ecx + } // end _asm block + // Now do the math for the rest of the row + switch ( bpp ) + { + case 3: + { + ActiveMask.use = 0x0000000000ffffff; + ShiftBpp.use = 24; // == 3 * 8 + ShiftRem.use = 40; // == 64 - 24 + _asm { + // Re-init address pointers and offset + movq mm7, ActiveMask + mov ebx, diff // ebx ==> x = offset to alignment boundary + movq mm5, LBCarryMask + mov edi, row // edi ==> Avg(x) + movq mm4, HBClearMask + mov esi, prev_row // esi ==> Prior(x) + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes + // (we correct position in loop below) +davg3lp: + movq mm0, [edi + ebx] // Load mm0 with Avg(x) + // Add (Prev_row/2) to Average + movq mm3, mm5 + psrlq mm2, ShiftRem // Correct position Raw(x-bpp) data + movq mm1, [esi + ebx] // Load mm1 with Prior(x) + movq mm6, mm7 + pand mm3, mm1 // get lsb for each prev_row byte + psrlq mm1, 1 // divide prev_row bytes by 2 + pand mm1, mm4 // clear invalid bit 7 of each byte + paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte + // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 1 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active + // byte + // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry + psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 3-5 + movq mm2, mm0 // mov updated Raws to mm2 + psllq mm2, ShiftBpp // shift data to position correctly + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active + // byte + + // Add 3rd active group (Raw(x-bpp)/2) to Average with LBCarry + psllq mm6, ShiftBpp // shift the mm6 mask to cover the last two + // bytes + movq mm2, mm0 // mov updated Raws to mm2 + psllq mm2, ShiftBpp // shift data to position correctly + // Data only needs to be shifted once here to + // get the correct x-bpp offset. + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg + add ebx, 8 + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active + // byte + + // Now ready to write back to memory + movq [edi + ebx - 8], mm0 + // Move updated Raw(x) to use as Raw(x-bpp) for next loop + cmp ebx, MMXLength + movq mm2, mm0 // mov updated Raw(x) to mm2 + jb davg3lp + } // end _asm block + } + break; + + case 6: + case 4: + case 7: + case 5: + { + ActiveMask.use = 0xffffffffffffffff; // use shift below to clear + // appropriate inactive bytes + ShiftBpp.use = bpp << 3; + ShiftRem.use = 64 - ShiftBpp.use; + _asm { + movq mm4, HBClearMask + // Re-init address pointers and offset + mov ebx, diff // ebx ==> x = offset to alignment boundary + // Load ActiveMask and clear all bytes except for 1st active group + movq mm7, ActiveMask + mov edi, row // edi ==> Avg(x) + psrlq mm7, ShiftRem + mov esi, prev_row // esi ==> Prior(x) + movq mm6, mm7 + movq mm5, LBCarryMask + psllq mm6, ShiftBpp // Create mask for 2nd active group + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes + // (we correct position in loop below) +davg4lp: + movq mm0, [edi + ebx] + psrlq mm2, ShiftRem // shift data to position correctly + movq mm1, [esi + ebx] + // Add (Prev_row/2) to Average + movq mm3, mm5 + pand mm3, mm1 // get lsb for each prev_row byte + psrlq mm1, 1 // divide prev_row bytes by 2 + pand mm1, mm4 // clear invalid bit 7 of each byte + paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte + // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm7 // Leave only Active Group 1 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active + // byte + // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry + movq mm2, mm0 // mov updated Raws to mm2 + psllq mm2, ShiftBpp // shift data to position correctly + add ebx, 8 + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active + // byte + cmp ebx, MMXLength + // Now ready to write back to memory + movq [edi + ebx - 8], mm0 + // Prep Raw(x-bpp) for next loop + movq mm2, mm0 // mov updated Raws to mm2 + jb davg4lp + } // end _asm block + } + break; + case 2: + { + ActiveMask.use = 0x000000000000ffff; + ShiftBpp.use = 16; // == 2 * 8 [BUGFIX] + ShiftRem.use = 48; // == 64 - 16 [BUGFIX] + _asm { + // Load ActiveMask + movq mm7, ActiveMask + // Re-init address pointers and offset + mov ebx, diff // ebx ==> x = offset to alignment boundary + movq mm5, LBCarryMask + mov edi, row // edi ==> Avg(x) + movq mm4, HBClearMask + mov esi, prev_row // esi ==> Prior(x) + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes + // (we correct position in loop below) +davg2lp: + movq mm0, [edi + ebx] + psrlq mm2, ShiftRem // shift data to position correctly [BUGFIX] + movq mm1, [esi + ebx] + // Add (Prev_row/2) to Average + movq mm3, mm5 + pand mm3, mm1 // get lsb for each prev_row byte + psrlq mm1, 1 // divide prev_row bytes by 2 + pand mm1, mm4 // clear invalid bit 7 of each byte + movq mm6, mm7 + paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte + // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 1 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte + // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry + psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 2 & 3 + movq mm2, mm0 // mov updated Raws to mm2 + psllq mm2, ShiftBpp // shift data to position correctly + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte + + // Add rdd active group (Raw(x-bpp)/2) to Average with LBCarry + psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 4 & 5 + movq mm2, mm0 // mov updated Raws to mm2 + psllq mm2, ShiftBpp // shift data to position correctly + // Data only needs to be shifted once here to + // get the correct x-bpp offset. + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte + + // Add 4th active group (Raw(x-bpp)/2) to Average with LBCarry + psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 6 & 7 + movq mm2, mm0 // mov updated Raws to mm2 + psllq mm2, ShiftBpp // shift data to position correctly + // Data only needs to be shifted once here to + // get the correct x-bpp offset. + add ebx, 8 + movq mm1, mm3 // now use mm1 for getting LBCarrys + pand mm1, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 (Only valid for active group) + psrlq mm2, 1 // divide raw bytes by 2 + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte + pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg + paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte + + cmp ebx, MMXLength + // Now ready to write back to memory + movq [edi + ebx - 8], mm0 + // Prep Raw(x-bpp) for next loop + movq mm2, mm0 // mov updated Raws to mm2 + jb davg2lp + } // end _asm block + } + break; + + case 1: // bpp == 1 + { + _asm { + // Re-init address pointers and offset + mov ebx, diff // ebx ==> x = offset to alignment boundary + mov edi, row // edi ==> Avg(x) + cmp ebx, FullLength // Test if offset at end of array + jnb davg1end + // Do Paeth decode for remaining bytes + mov esi, prev_row // esi ==> Prior(x) + mov edx, edi + xor ecx, ecx // zero ecx before using cl & cx in loop below + sub edx, bpp // edx ==> Raw(x-bpp) +davg1lp: + // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) + xor eax, eax + mov cl, [esi + ebx] // load cl with Prior(x) + mov al, [edx + ebx] // load al with Raw(x-bpp) + add ax, cx + inc ebx + shr ax, 1 // divide by 2 + add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx + cmp ebx, FullLength // Check if at end of array + mov [edi+ebx-1], al // Write back Raw(x); + // mov does not affect flags; -1 to offset inc ebx + jb davg1lp +davg1end: + } // end _asm block + } + return; + + case 8: // bpp == 8 + { + _asm { + // Re-init address pointers and offset + mov ebx, diff // ebx ==> x = offset to alignment boundary + movq mm5, LBCarryMask + mov edi, row // edi ==> Avg(x) + movq mm4, HBClearMask + mov esi, prev_row // esi ==> Prior(x) + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes + // (NO NEED to correct position in loop below) +davg8lp: + movq mm0, [edi + ebx] + movq mm3, mm5 + movq mm1, [esi + ebx] + add ebx, 8 + pand mm3, mm1 // get lsb for each prev_row byte + psrlq mm1, 1 // divide prev_row bytes by 2 + pand mm3, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 + psrlq mm2, 1 // divide raw bytes by 2 + pand mm1, mm4 // clear invalid bit 7 of each byte + paddb mm0, mm3 // add LBCarrys to Avg for each byte + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte + paddb mm0, mm2 // add (Raw/2) to Avg for each byte + cmp ebx, MMXLength + movq [edi + ebx - 8], mm0 + movq mm2, mm0 // reuse as Raw(x-bpp) + jb davg8lp + } // end _asm block + } + break; + default: // bpp greater than 8 + { + _asm { + movq mm5, LBCarryMask + // Re-init address pointers and offset + mov ebx, diff // ebx ==> x = offset to alignment boundary + mov edi, row // edi ==> Avg(x) + movq mm4, HBClearMask + mov edx, edi + mov esi, prev_row // esi ==> Prior(x) + sub edx, bpp // edx ==> Raw(x-bpp) +davgAlp: + movq mm0, [edi + ebx] + movq mm3, mm5 + movq mm1, [esi + ebx] + pand mm3, mm1 // get lsb for each prev_row byte + movq mm2, [edx + ebx] + psrlq mm1, 1 // divide prev_row bytes by 2 + pand mm3, mm2 // get LBCarrys for each byte where both + // lsb's were == 1 + psrlq mm2, 1 // divide raw bytes by 2 + pand mm1, mm4 // clear invalid bit 7 of each byte + paddb mm0, mm3 // add LBCarrys to Avg for each byte + pand mm2, mm4 // clear invalid bit 7 of each byte + paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte + add ebx, 8 + paddb mm0, mm2 // add (Raw/2) to Avg for each byte + cmp ebx, MMXLength + movq [edi + ebx - 8], mm0 + jb davgAlp + } // end _asm block + } + break; + } // end switch ( bpp ) + + _asm { + // MMX acceleration complete now do clean-up + // Check if any remaining bytes left to decode + mov ebx, MMXLength // ebx ==> x = offset bytes remaining after MMX + mov edi, row // edi ==> Avg(x) + cmp ebx, FullLength // Test if offset at end of array + jnb davgend + // Do Paeth decode for remaining bytes + mov esi, prev_row // esi ==> Prior(x) + mov edx, edi + xor ecx, ecx // zero ecx before using cl & cx in loop below + sub edx, bpp // edx ==> Raw(x-bpp) +davglp2: + // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) + xor eax, eax + mov cl, [esi + ebx] // load cl with Prior(x) + mov al, [edx + ebx] // load al with Raw(x-bpp) + add ax, cx + inc ebx + shr ax, 1 // divide by 2 + add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx + cmp ebx, FullLength // Check if at end of array + mov [edi+ebx-1], al // Write back Raw(x); + // mov does not affect flags; -1 to offset inc ebx + jb davglp2 +davgend: + emms // End MMX instructions; prep for possible FP instrs. + } // end _asm block +} + +// Optimized code for PNG Paeth filter decoder +void /* PRIVATE */ +png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row, + png_bytep prev_row) +{ + png_uint_32 FullLength; + png_uint_32 MMXLength; + //png_uint_32 len; + int bpp; + int diff; + //int ptemp; + int patemp, pbtemp, pctemp; + + bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel + FullLength = row_info->rowbytes; // # of bytes to filter + _asm + { + xor ebx, ebx // ebx ==> x offset + mov edi, row + xor edx, edx // edx ==> x-bpp offset + mov esi, prev_row + xor eax, eax + + // Compute the Raw value for the first bpp bytes + // Note: the formula works out to be always + // Paeth(x) = Raw(x) + Prior(x) where x < bpp +dpthrlp: + mov al, [edi + ebx] + add al, [esi + ebx] + inc ebx + cmp ebx, bpp + mov [edi + ebx - 1], al + jb dpthrlp + // get # of bytes to alignment + mov diff, edi // take start of row + add diff, ebx // add bpp + xor ecx, ecx + add diff, 0xf // add 7 + 8 to incr past alignment boundary + and diff, 0xfffffff8 // mask to alignment boundary + sub diff, edi // subtract from start ==> value ebx at alignment + jz dpthgo + // fix alignment +dpthlp1: + xor eax, eax + // pav = p - a = (a + b - c) - a = b - c + mov al, [esi + ebx] // load Prior(x) into al + mov cl, [esi + edx] // load Prior(x-bpp) into cl + sub eax, ecx // subtract Prior(x-bpp) + mov patemp, eax // Save pav for later use + xor eax, eax + // pbv = p - b = (a + b - c) - b = a - c + mov al, [edi + edx] // load Raw(x-bpp) into al + sub eax, ecx // subtract Prior(x-bpp) + mov ecx, eax + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + add eax, patemp // pcv = pav + pbv + // pc = abs(pcv) + test eax, 0x80000000 + jz dpthpca + neg eax // reverse sign of neg values +dpthpca: + mov pctemp, eax // save pc for later use + // pb = abs(pbv) + test ecx, 0x80000000 + jz dpthpba + neg ecx // reverse sign of neg values +dpthpba: + mov pbtemp, ecx // save pb for later use + // pa = abs(pav) + mov eax, patemp + test eax, 0x80000000 + jz dpthpaa + neg eax // reverse sign of neg values +dpthpaa: + mov patemp, eax // save pa for later use + // test if pa <= pb + cmp eax, ecx + jna dpthabb + // pa > pb; now test if pb <= pc + cmp ecx, pctemp + jna dpthbbc + // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + mov cl, [esi + edx] // load Prior(x-bpp) into cl + jmp dpthpaeth +dpthbbc: + // pb <= pc; Raw(x) = Paeth(x) + Prior(x) + mov cl, [esi + ebx] // load Prior(x) into cl + jmp dpthpaeth +dpthabb: + // pa <= pb; now test if pa <= pc + cmp eax, pctemp + jna dpthabc + // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + mov cl, [esi + edx] // load Prior(x-bpp) into cl + jmp dpthpaeth +dpthabc: + // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) + mov cl, [edi + edx] // load Raw(x-bpp) into cl +dpthpaeth: + inc ebx + inc edx + // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 + add [edi + ebx - 1], cl + cmp ebx, diff + jb dpthlp1 +dpthgo: + mov ecx, FullLength + mov eax, ecx + sub eax, ebx // subtract alignment fix + and eax, 0x00000007 // calc bytes over mult of 8 + sub ecx, eax // drop over bytes from original length + mov MMXLength, ecx + } // end _asm block + // Now do the math for the rest of the row + switch ( bpp ) + { + case 3: + { + ActiveMask.use = 0x0000000000ffffff; + ActiveMaskEnd.use = 0xffff000000000000; + ShiftBpp.use = 24; // == bpp(3) * 8 + ShiftRem.use = 40; // == 64 - 24 + _asm + { + mov ebx, diff + mov edi, row + mov esi, prev_row + pxor mm0, mm0 + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] +dpth3lp: + psrlq mm1, ShiftRem // shift last 3 bytes to 1st 3 bytes + movq mm2, [esi + ebx] // load b=Prior(x) + punpcklbw mm1, mm0 // Unpack High bytes of a + movq mm3, [esi+ebx-8] // Prep c=Prior(x-bpp) bytes + punpcklbw mm2, mm0 // Unpack High bytes of b + psrlq mm3, ShiftRem // shift last 3 bytes to 1st 3 bytes + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + punpcklbw mm3, mm0 // Unpack High bytes of c + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + paddw mm7, mm3 + pxor mm0, mm0 + packuswb mm7, mm1 + movq mm3, [esi + ebx] // load c=Prior(x-bpp) + pand mm7, ActiveMask + movq mm2, mm3 // load b=Prior(x) step 1 + paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) + punpcklbw mm3, mm0 // Unpack High bytes of c + movq [edi + ebx], mm7 // write back updated value + movq mm1, mm7 // Now mm1 will be used as Raw(x-bpp) + // Now do Paeth for 2nd set of bytes (3-5) + psrlq mm2, ShiftBpp // load b=Prior(x) step 2 + punpcklbw mm1, mm0 // Unpack High bytes of a + pxor mm7, mm7 + punpcklbw mm2, mm0 // Unpack High bytes of b + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + psubw mm5, mm3 + psubw mm4, mm3 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = + // pav + pbv = pbv + pav + movq mm6, mm5 + paddw mm6, mm4 + + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm5 // Create mask pbv bytes < 0 + pcmpgtw mm7, mm4 // Create mask pav bytes < 0 + pand mm0, mm5 // Only pbv bytes < 0 in mm0 + pand mm7, mm4 // Only pav bytes < 0 in mm7 + psubw mm5, mm0 + psubw mm4, mm7 + psubw mm5, mm0 + psubw mm4, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + movq mm2, [esi + ebx] // load b=Prior(x) + pand mm3, mm7 + pandn mm7, mm0 + pxor mm1, mm1 + paddw mm7, mm3 + pxor mm0, mm0 + packuswb mm7, mm1 + movq mm3, mm2 // load c=Prior(x-bpp) step 1 + pand mm7, ActiveMask + punpckhbw mm2, mm0 // Unpack High bytes of b + psllq mm7, ShiftBpp // Shift bytes to 2nd group of 3 bytes + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) + psllq mm3, ShiftBpp // load c=Prior(x-bpp) step 2 + movq [edi + ebx], mm7 // write back updated value + movq mm1, mm7 + punpckhbw mm3, mm0 // Unpack High bytes of c + psllq mm1, ShiftBpp // Shift bytes + // Now mm1 will be used as Raw(x-bpp) + // Now do Paeth for 3rd, and final, set of bytes (6-7) + pxor mm7, mm7 + punpckhbw mm1, mm0 // Unpack High bytes of a + psubw mm4, mm3 + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + pxor mm0, mm0 + paddw mm6, mm5 + + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + pandn mm0, mm1 + pandn mm7, mm4 + paddw mm0, mm2 + paddw mm7, mm5 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pand mm3, mm7 + pandn mm7, mm0 + paddw mm7, mm3 + pxor mm1, mm1 + packuswb mm1, mm7 + // Step ebx to next set of 8 bytes and repeat loop til done + add ebx, 8 + pand mm1, ActiveMaskEnd + paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) + + cmp ebx, MMXLength + pxor mm0, mm0 // pxor does not affect flags + movq [edi + ebx - 8], mm1 // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + // mm3 ready to be used as Prior(x-bpp) next loop + jb dpth3lp + } // end _asm block + } + break; + + case 6: + case 7: + case 5: + { + ActiveMask.use = 0x00000000ffffffff; + ActiveMask2.use = 0xffffffff00000000; + ShiftBpp.use = bpp << 3; // == bpp * 8 + ShiftRem.use = 64 - ShiftBpp.use; + _asm + { + mov ebx, diff + mov edi, row + mov esi, prev_row + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] + pxor mm0, mm0 +dpth6lp: + // Must shift to position Raw(x-bpp) data + psrlq mm1, ShiftRem + // Do first set of 4 bytes + movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes + punpcklbw mm1, mm0 // Unpack Low bytes of a + movq mm2, [esi + ebx] // load b=Prior(x) + punpcklbw mm2, mm0 // Unpack Low bytes of b + // Must shift to position Prior(x-bpp) data + psrlq mm3, ShiftRem + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + punpcklbw mm3, mm0 // Unpack Low bytes of c + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + paddw mm7, mm3 + pxor mm0, mm0 + packuswb mm7, mm1 + movq mm3, [esi + ebx - 8] // load c=Prior(x-bpp) + pand mm7, ActiveMask + psrlq mm3, ShiftRem + movq mm2, [esi + ebx] // load b=Prior(x) step 1 + paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) + movq mm6, mm2 + movq [edi + ebx], mm7 // write back updated value + movq mm1, [edi+ebx-8] + psllq mm6, ShiftBpp + movq mm5, mm7 + psrlq mm1, ShiftRem + por mm3, mm6 + psllq mm5, ShiftBpp + punpckhbw mm3, mm0 // Unpack High bytes of c + por mm1, mm5 + // Do second set of 4 bytes + punpckhbw mm2, mm0 // Unpack High bytes of b + punpckhbw mm1, mm0 // Unpack High bytes of a + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + pxor mm1, mm1 + paddw mm7, mm3 + pxor mm0, mm0 + // Step ex to next set of 8 bytes and repeat loop til done + add ebx, 8 + packuswb mm1, mm7 + paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) + cmp ebx, MMXLength + movq [edi + ebx - 8], mm1 // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + jb dpth6lp + } // end _asm block + } + break; + + case 4: + { + ActiveMask.use = 0x00000000ffffffff; + _asm { + mov ebx, diff + mov edi, row + mov esi, prev_row + pxor mm0, mm0 + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] // Only time should need to read + // a=Raw(x-bpp) bytes +dpth4lp: + // Do first set of 4 bytes + movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes + punpckhbw mm1, mm0 // Unpack Low bytes of a + movq mm2, [esi + ebx] // load b=Prior(x) + punpcklbw mm2, mm0 // Unpack High bytes of b + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + punpckhbw mm3, mm0 // Unpack High bytes of c + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + paddw mm7, mm3 + pxor mm0, mm0 + packuswb mm7, mm1 + movq mm3, [esi + ebx] // load c=Prior(x-bpp) + pand mm7, ActiveMask + movq mm2, mm3 // load b=Prior(x) step 1 + paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) + punpcklbw mm3, mm0 // Unpack High bytes of c + movq [edi + ebx], mm7 // write back updated value + movq mm1, mm7 // Now mm1 will be used as Raw(x-bpp) + // Do second set of 4 bytes + punpckhbw mm2, mm0 // Unpack Low bytes of b + punpcklbw mm1, mm0 // Unpack Low bytes of a + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + pxor mm1, mm1 + paddw mm7, mm3 + pxor mm0, mm0 + // Step ex to next set of 8 bytes and repeat loop til done + add ebx, 8 + packuswb mm1, mm7 + paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) + cmp ebx, MMXLength + movq [edi + ebx - 8], mm1 // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + jb dpth4lp + } // end _asm block + } + break; + case 8: // bpp == 8 + { + ActiveMask.use = 0x00000000ffffffff; + _asm { + mov ebx, diff + mov edi, row + mov esi, prev_row + pxor mm0, mm0 + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] // Only time should need to read + // a=Raw(x-bpp) bytes +dpth8lp: + // Do first set of 4 bytes + movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes + punpcklbw mm1, mm0 // Unpack Low bytes of a + movq mm2, [esi + ebx] // load b=Prior(x) + punpcklbw mm2, mm0 // Unpack Low bytes of b + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + punpcklbw mm3, mm0 // Unpack Low bytes of c + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + paddw mm7, mm3 + pxor mm0, mm0 + packuswb mm7, mm1 + movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes + pand mm7, ActiveMask + movq mm2, [esi + ebx] // load b=Prior(x) + paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) + punpckhbw mm3, mm0 // Unpack High bytes of c + movq [edi + ebx], mm7 // write back updated value + movq mm1, [edi+ebx-8] // read a=Raw(x-bpp) bytes + + // Do second set of 4 bytes + punpckhbw mm2, mm0 // Unpack High bytes of b + punpckhbw mm1, mm0 // Unpack High bytes of a + // pav = p - a = (a + b - c) - a = b - c + movq mm4, mm2 + // pbv = p - b = (a + b - c) - b = a - c + movq mm5, mm1 + psubw mm4, mm3 + pxor mm7, mm7 + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + movq mm6, mm4 + psubw mm5, mm3 + // pa = abs(p-a) = abs(pav) + // pb = abs(p-b) = abs(pbv) + // pc = abs(p-c) = abs(pcv) + pcmpgtw mm0, mm4 // Create mask pav bytes < 0 + paddw mm6, mm5 + pand mm0, mm4 // Only pav bytes < 0 in mm7 + pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 + psubw mm4, mm0 + pand mm7, mm5 // Only pbv bytes < 0 in mm0 + psubw mm4, mm0 + psubw mm5, mm7 + pxor mm0, mm0 + pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 + pand mm0, mm6 // Only pav bytes < 0 in mm7 + psubw mm5, mm7 + psubw mm6, mm0 + // test pa <= pb + movq mm7, mm4 + psubw mm6, mm0 + pcmpgtw mm7, mm5 // pa > pb? + movq mm0, mm7 + // use mm7 mask to merge pa & pb + pand mm5, mm7 + // use mm0 mask copy to merge a & b + pand mm2, mm0 + pandn mm7, mm4 + pandn mm0, mm1 + paddw mm7, mm5 + paddw mm0, mm2 + // test ((pa <= pb)? pa:pb) <= pc + pcmpgtw mm7, mm6 // pab > pc? + pxor mm1, mm1 + pand mm3, mm7 + pandn mm7, mm0 + pxor mm1, mm1 + paddw mm7, mm3 + pxor mm0, mm0 + // Step ex to next set of 8 bytes and repeat loop til done + add ebx, 8 + packuswb mm1, mm7 + paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) + cmp ebx, MMXLength + movq [edi + ebx - 8], mm1 // write back updated value + // mm1 will be used as Raw(x-bpp) next loop + jb dpth8lp + } // end _asm block + } + break; + + case 1: // bpp = 1 + case 2: // bpp = 2 + default: // bpp > 8 + { + _asm { + mov ebx, diff + cmp ebx, FullLength + jnb dpthdend + mov edi, row + mov esi, prev_row + // Do Paeth decode for remaining bytes + mov edx, ebx + xor ecx, ecx // zero ecx before using cl & cx in loop below + sub edx, bpp // Set edx = ebx - bpp +dpthdlp: + xor eax, eax + // pav = p - a = (a + b - c) - a = b - c + mov al, [esi + ebx] // load Prior(x) into al + mov cl, [esi + edx] // load Prior(x-bpp) into cl + sub eax, ecx // subtract Prior(x-bpp) + mov patemp, eax // Save pav for later use + xor eax, eax + // pbv = p - b = (a + b - c) - b = a - c + mov al, [edi + edx] // load Raw(x-bpp) into al + sub eax, ecx // subtract Prior(x-bpp) + mov ecx, eax + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + add eax, patemp // pcv = pav + pbv + // pc = abs(pcv) + test eax, 0x80000000 + jz dpthdpca + neg eax // reverse sign of neg values +dpthdpca: + mov pctemp, eax // save pc for later use + // pb = abs(pbv) + test ecx, 0x80000000 + jz dpthdpba + neg ecx // reverse sign of neg values +dpthdpba: + mov pbtemp, ecx // save pb for later use + // pa = abs(pav) + mov eax, patemp + test eax, 0x80000000 + jz dpthdpaa + neg eax // reverse sign of neg values +dpthdpaa: + mov patemp, eax // save pa for later use + // test if pa <= pb + cmp eax, ecx + jna dpthdabb + // pa > pb; now test if pb <= pc + cmp ecx, pctemp + jna dpthdbbc + // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + mov cl, [esi + edx] // load Prior(x-bpp) into cl + jmp dpthdpaeth +dpthdbbc: + // pb <= pc; Raw(x) = Paeth(x) + Prior(x) + mov cl, [esi + ebx] // load Prior(x) into cl + jmp dpthdpaeth +dpthdabb: + // pa <= pb; now test if pa <= pc + cmp eax, pctemp + jna dpthdabc + // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + mov cl, [esi + edx] // load Prior(x-bpp) into cl + jmp dpthdpaeth +dpthdabc: + // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) + mov cl, [edi + edx] // load Raw(x-bpp) into cl +dpthdpaeth: + inc ebx + inc edx + // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 + add [edi + ebx - 1], cl + cmp ebx, FullLength + jb dpthdlp +dpthdend: + } // end _asm block + } + return; // No need to go further with this one + } // end switch ( bpp ) + _asm + { + // MMX acceleration complete now do clean-up + // Check if any remaining bytes left to decode + mov ebx, MMXLength + cmp ebx, FullLength + jnb dpthend + mov edi, row + mov esi, prev_row + // Do Paeth decode for remaining bytes + mov edx, ebx + xor ecx, ecx // zero ecx before using cl & cx in loop below + sub edx, bpp // Set edx = ebx - bpp +dpthlp2: + xor eax, eax + // pav = p - a = (a + b - c) - a = b - c + mov al, [esi + ebx] // load Prior(x) into al + mov cl, [esi + edx] // load Prior(x-bpp) into cl + sub eax, ecx // subtract Prior(x-bpp) + mov patemp, eax // Save pav for later use + xor eax, eax + // pbv = p - b = (a + b - c) - b = a - c + mov al, [edi + edx] // load Raw(x-bpp) into al + sub eax, ecx // subtract Prior(x-bpp) + mov ecx, eax + // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv + add eax, patemp // pcv = pav + pbv + // pc = abs(pcv) + test eax, 0x80000000 + jz dpthpca2 + neg eax // reverse sign of neg values +dpthpca2: + mov pctemp, eax // save pc for later use + // pb = abs(pbv) + test ecx, 0x80000000 + jz dpthpba2 + neg ecx // reverse sign of neg values +dpthpba2: + mov pbtemp, ecx // save pb for later use + // pa = abs(pav) + mov eax, patemp + test eax, 0x80000000 + jz dpthpaa2 + neg eax // reverse sign of neg values +dpthpaa2: + mov patemp, eax // save pa for later use + // test if pa <= pb + cmp eax, ecx + jna dpthabb2 + // pa > pb; now test if pb <= pc + cmp ecx, pctemp + jna dpthbbc2 + // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + mov cl, [esi + edx] // load Prior(x-bpp) into cl + jmp dpthpaeth2 +dpthbbc2: + // pb <= pc; Raw(x) = Paeth(x) + Prior(x) + mov cl, [esi + ebx] // load Prior(x) into cl + jmp dpthpaeth2 +dpthabb2: + // pa <= pb; now test if pa <= pc + cmp eax, pctemp + jna dpthabc2 + // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) + mov cl, [esi + edx] // load Prior(x-bpp) into cl + jmp dpthpaeth2 +dpthabc2: + // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) + mov cl, [edi + edx] // load Raw(x-bpp) into cl +dpthpaeth2: + inc ebx + inc edx + // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 + add [edi + ebx - 1], cl + cmp ebx, FullLength + jb dpthlp2 +dpthend: + emms // End MMX instructions; prep for possible FP instrs. + } // end _asm block +} + +// Optimized code for PNG Sub filter decoder +void /* PRIVATE */ +png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row) +{ + //int test; + int bpp; + png_uint_32 FullLength; + png_uint_32 MMXLength; + int diff; + + bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel + FullLength = row_info->rowbytes - bpp; // # of bytes to filter + _asm { + mov edi, row + mov esi, edi // lp = row + add edi, bpp // rp = row + bpp + xor eax, eax + // get # of bytes to alignment + mov diff, edi // take start of row + add diff, 0xf // add 7 + 8 to incr past + // alignment boundary + xor ebx, ebx + and diff, 0xfffffff8 // mask to alignment boundary + sub diff, edi // subtract from start ==> value + // ebx at alignment + jz dsubgo + // fix alignment +dsublp1: + mov al, [esi+ebx] + add [edi+ebx], al + inc ebx + cmp ebx, diff + jb dsublp1 +dsubgo: + mov ecx, FullLength + mov edx, ecx + sub edx, ebx // subtract alignment fix + and edx, 0x00000007 // calc bytes over mult of 8 + sub ecx, edx // drop over bytes from length + mov MMXLength, ecx + } // end _asm block + + // Now do the math for the rest of the row + switch ( bpp ) + { + case 3: + { + ActiveMask.use = 0x0000ffffff000000; + ShiftBpp.use = 24; // == 3 * 8 + ShiftRem.use = 40; // == 64 - 24 + _asm { + mov edi, row + movq mm7, ActiveMask // Load ActiveMask for 2nd active byte group + mov esi, edi // lp = row + add edi, bpp // rp = row + bpp + movq mm6, mm7 + mov ebx, diff + psllq mm6, ShiftBpp // Move mask in mm6 to cover 3rd active + // byte group + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] +dsub3lp: + psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes + // no need for mask; shift clears inactive bytes + // Add 1st active group + movq mm0, [edi+ebx] + paddb mm0, mm1 + // Add 2nd active group + movq mm1, mm0 // mov updated Raws to mm1 + psllq mm1, ShiftBpp // shift data to position correctly + pand mm1, mm7 // mask to use only 2nd active group + paddb mm0, mm1 + // Add 3rd active group + movq mm1, mm0 // mov updated Raws to mm1 + psllq mm1, ShiftBpp // shift data to position correctly + pand mm1, mm6 // mask to use only 3rd active group + add ebx, 8 + paddb mm0, mm1 + cmp ebx, MMXLength + movq [edi+ebx-8], mm0 // Write updated Raws back to array + // Prep for doing 1st add at top of loop + movq mm1, mm0 + jb dsub3lp + } // end _asm block + } + break; + + case 1: + { + // Placed here just in case this is a duplicate of the + // non-MMX code for the SUB filter in png_read_filter_row below + // + // png_bytep rp; + // png_bytep lp; + // png_uint_32 i; + // bpp = (row_info->pixel_depth + 7) >> 3; + // for (i = (png_uint_32)bpp, rp = row + bpp, lp = row; + // i < row_info->rowbytes; i++, rp++, lp++) + // { + // *rp = (png_byte)(((int)(*rp) + (int)(*lp)) & 0xff); + // } + _asm { + mov ebx, diff + mov edi, row + cmp ebx, FullLength + jnb dsub1end + mov esi, edi // lp = row + xor eax, eax + add edi, bpp // rp = row + bpp +dsub1lp: + mov al, [esi+ebx] + add [edi+ebx], al + inc ebx + cmp ebx, FullLength + jb dsub1lp +dsub1end: + } // end _asm block + } + return; + + case 6: + case 7: + case 4: + case 5: + { + ShiftBpp.use = bpp << 3; + ShiftRem.use = 64 - ShiftBpp.use; + _asm { + mov edi, row + mov ebx, diff + mov esi, edi // lp = row + add edi, bpp // rp = row + bpp + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] +dsub4lp: + psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes + // no need for mask; shift clears inactive bytes + movq mm0, [edi+ebx] + paddb mm0, mm1 + // Add 2nd active group + movq mm1, mm0 // mov updated Raws to mm1 + psllq mm1, ShiftBpp // shift data to position correctly + // there is no need for any mask + // since shift clears inactive bits/bytes + add ebx, 8 + paddb mm0, mm1 + cmp ebx, MMXLength + movq [edi+ebx-8], mm0 + movq mm1, mm0 // Prep for doing 1st add at top of loop + jb dsub4lp + } // end _asm block + } + break; + + case 2: + { + ActiveMask.use = 0x00000000ffff0000; + ShiftBpp.use = 16; // == 2 * 8 + ShiftRem.use = 48; // == 64 - 16 + _asm { + movq mm7, ActiveMask // Load ActiveMask for 2nd active byte group + mov ebx, diff + movq mm6, mm7 + mov edi, row + psllq mm6, ShiftBpp // Move mask in mm6 to cover 3rd active + // byte group + mov esi, edi // lp = row + movq mm5, mm6 + add edi, bpp // rp = row + bpp + psllq mm5, ShiftBpp // Move mask in mm5 to cover 4th active + // byte group + // PRIME the pump (load the first Raw(x-bpp) data set + movq mm1, [edi+ebx-8] +dsub2lp: + // Add 1st active group + psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes + // no need for mask; shift clears inactive + // bytes + movq mm0, [edi+ebx] + paddb mm0, mm1 + // Add 2nd active group + movq mm1, mm0 // mov updated Raws to mm1 + psllq mm1, ShiftBpp // shift data to position correctly + pand mm1, mm7 // mask to use only 2nd active group + paddb mm0, mm1 + // Add 3rd active group + movq mm1, mm0 // mov updated Raws to mm1 + psllq mm1, ShiftBpp // shift data to position correctly + pand mm1, mm6 // mask to use only 3rd active group + paddb mm0, mm1 + // Add 4th active group + movq mm1, mm0 // mov updated Raws to mm1 + psllq mm1, ShiftBpp // shift data to position correctly + pand mm1, mm5 // mask to use only 4th active group + add ebx, 8 + paddb mm0, mm1 + cmp ebx, MMXLength + movq [edi+ebx-8], mm0 // Write updated Raws back to array + movq mm1, mm0 // Prep for doing 1st add at top of loop + jb dsub2lp + } // end _asm block + } + break; + case 8: + { + _asm { + mov edi, row + mov ebx, diff + mov esi, edi // lp = row + add edi, bpp // rp = row + bpp + mov ecx, MMXLength + movq mm7, [edi+ebx-8] // PRIME the pump (load the first + // Raw(x-bpp) data set + and ecx, 0x0000003f // calc bytes over mult of 64 +dsub8lp: + movq mm0, [edi+ebx] // Load Sub(x) for 1st 8 bytes + paddb mm0, mm7 + movq mm1, [edi+ebx+8] // Load Sub(x) for 2nd 8 bytes + movq [edi+ebx], mm0 // Write Raw(x) for 1st 8 bytes + // Now mm0 will be used as Raw(x-bpp) for + // the 2nd group of 8 bytes. This will be + // repeated for each group of 8 bytes with + // the 8th group being used as the Raw(x-bpp) + // for the 1st group of the next loop. + paddb mm1, mm0 + movq mm2, [edi+ebx+16] // Load Sub(x) for 3rd 8 bytes + movq [edi+ebx+8], mm1 // Write Raw(x) for 2nd 8 bytes + paddb mm2, mm1 + movq mm3, [edi+ebx+24] // Load Sub(x) for 4th 8 bytes + movq [edi+ebx+16], mm2 // Write Raw(x) for 3rd 8 bytes + paddb mm3, mm2 + movq mm4, [edi+ebx+32] // Load Sub(x) for 5th 8 bytes + movq [edi+ebx+24], mm3 // Write Raw(x) for 4th 8 bytes + paddb mm4, mm3 + movq mm5, [edi+ebx+40] // Load Sub(x) for 6th 8 bytes + movq [edi+ebx+32], mm4 // Write Raw(x) for 5th 8 bytes + paddb mm5, mm4 + movq mm6, [edi+ebx+48] // Load Sub(x) for 7th 8 bytes + movq [edi+ebx+40], mm5 // Write Raw(x) for 6th 8 bytes + paddb mm6, mm5 + movq mm7, [edi+ebx+56] // Load Sub(x) for 8th 8 bytes + movq [edi+ebx+48], mm6 // Write Raw(x) for 7th 8 bytes + add ebx, 64 + paddb mm7, mm6 + cmp ebx, ecx + movq [edi+ebx-8], mm7 // Write Raw(x) for 8th 8 bytes + jb dsub8lp + cmp ebx, MMXLength + jnb dsub8lt8 +dsub8lpA: + movq mm0, [edi+ebx] + add ebx, 8 + paddb mm0, mm7 + cmp ebx, MMXLength + movq [edi+ebx-8], mm0 // use -8 to offset early add to ebx + movq mm7, mm0 // Move calculated Raw(x) data to mm1 to + // be the new Raw(x-bpp) for the next loop + jb dsub8lpA +dsub8lt8: + } // end _asm block + } + break; + + default: // bpp greater than 8 bytes + { + _asm { + mov ebx, diff + mov edi, row + mov esi, edi // lp = row + add edi, bpp // rp = row + bpp +dsubAlp: + movq mm0, [edi+ebx] + movq mm1, [esi+ebx] + add ebx, 8 + paddb mm0, mm1 + cmp ebx, MMXLength + movq [edi+ebx-8], mm0 // mov does not affect flags; -8 to offset + // add ebx + jb dsubAlp + } // end _asm block + } + break; + + } // end switch ( bpp ) + + _asm { + mov ebx, MMXLength + mov edi, row + cmp ebx, FullLength + jnb dsubend + mov esi, edi // lp = row + xor eax, eax + add edi, bpp // rp = row + bpp +dsublp2: + mov al, [esi+ebx] + add [edi+ebx], al + inc ebx + cmp ebx, FullLength + jb dsublp2 +dsubend: + emms // End MMX instructions; prep for possible FP instrs. + } // end _asm block +} + +// Optimized code for PNG Up filter decoder +void /* PRIVATE */ +png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, + png_bytep prev_row) +{ + png_uint_32 len; + len = row_info->rowbytes; // # of bytes to filter + _asm { + mov edi, row + // get # of bytes to alignment + mov ecx, edi + xor ebx, ebx + add ecx, 0x7 + xor eax, eax + and ecx, 0xfffffff8 + mov esi, prev_row + sub ecx, edi + jz dupgo + // fix alignment +duplp1: + mov al, [edi+ebx] + add al, [esi+ebx] + inc ebx + cmp ebx, ecx + mov [edi + ebx-1], al // mov does not affect flags; -1 to offset inc ebx + jb duplp1 +dupgo: + mov ecx, len + mov edx, ecx + sub edx, ebx // subtract alignment fix + and edx, 0x0000003f // calc bytes over mult of 64 + sub ecx, edx // drop over bytes from length + // Unrolled loop - use all MMX registers and interleave to reduce + // number of branch instructions (loops) and reduce partial stalls +duploop: + movq mm1, [esi+ebx] + movq mm0, [edi+ebx] + movq mm3, [esi+ebx+8] + paddb mm0, mm1 + movq mm2, [edi+ebx+8] + movq [edi+ebx], mm0 + paddb mm2, mm3 + movq mm5, [esi+ebx+16] + movq [edi+ebx+8], mm2 + movq mm4, [edi+ebx+16] + movq mm7, [esi+ebx+24] + paddb mm4, mm5 + movq mm6, [edi+ebx+24] + movq [edi+ebx+16], mm4 + paddb mm6, mm7 + movq mm1, [esi+ebx+32] + movq [edi+ebx+24], mm6 + movq mm0, [edi+ebx+32] + movq mm3, [esi+ebx+40] + paddb mm0, mm1 + movq mm2, [edi+ebx+40] + movq [edi+ebx+32], mm0 + paddb mm2, mm3 + movq mm5, [esi+ebx+48] + movq [edi+ebx+40], mm2 + movq mm4, [edi+ebx+48] + movq mm7, [esi+ebx+56] + paddb mm4, mm5 + movq mm6, [edi+ebx+56] + movq [edi+ebx+48], mm4 + add ebx, 64 + paddb mm6, mm7 + cmp ebx, ecx + movq [edi+ebx-8], mm6 // (+56)movq does not affect flags; + // -8 to offset add ebx + jb duploop + + cmp edx, 0 // Test for bytes over mult of 64 + jz dupend + + + // 2 lines added by lcreeve at netins.net + // (mail 11 Jul 98 in png-implement list) + cmp edx, 8 //test for less than 8 bytes + jb duplt8 + + + add ecx, edx + and edx, 0x00000007 // calc bytes over mult of 8 + sub ecx, edx // drop over bytes from length + jz duplt8 + // Loop using MMX registers mm0 & mm1 to update 8 bytes simultaneously +duplpA: + movq mm1, [esi+ebx] + movq mm0, [edi+ebx] + add ebx, 8 + paddb mm0, mm1 + cmp ebx, ecx + movq [edi+ebx-8], mm0 // movq does not affect flags; -8 to offset add ebx + jb duplpA + cmp edx, 0 // Test for bytes over mult of 8 + jz dupend +duplt8: + xor eax, eax + add ecx, edx // move over byte count into counter + // Loop using x86 registers to update remaining bytes +duplp2: + mov al, [edi + ebx] + add al, [esi + ebx] + inc ebx + cmp ebx, ecx + mov [edi + ebx-1], al // mov does not affect flags; -1 to offset inc ebx + jb duplp2 +dupend: + // Conversion of filtered row completed + emms // End MMX instructions; prep for possible FP instrs. + } // end _asm block +} + + +// Optimized png_read_filter_row routines +void /* PRIVATE */ +png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep + row, png_bytep prev_row, int filter) +{ +#ifdef PNG_DEBUG + char filnm[10]; +#endif + + if (mmx_supported == 2) { +#if !defined(PNG_1_0_X) + /* this should have happened in png_init_mmx_flags() already */ + png_warning(png_ptr, "asm_flags may not have been initialized"); +#endif + png_mmx_support(); + } + +#ifdef PNG_DEBUG + png_debug(1, "in png_read_filter_row\n"); + switch (filter) + { + case 0: sprintf(filnm, "none"); + break; +#if !defined(PNG_1_0_X) + case 1: sprintf(filnm, "sub-%s", + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : "x86"); + break; + case 2: sprintf(filnm, "up-%s", + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : "x86"); + break; + case 3: sprintf(filnm, "avg-%s", + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : "x86"); + break; + case 4: sprintf(filnm, "Paeth-%s", + (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":"x86"); + break; +#else + case 1: sprintf(filnm, "sub"); + break; + case 2: sprintf(filnm, "up"); + break; + case 3: sprintf(filnm, "avg"); + break; + case 4: sprintf(filnm, "Paeth"); + break; +#endif + default: sprintf(filnm, "unknw"); + break; + } + png_debug2(0,"row=%5d, %s, ", png_ptr->row_number, filnm); + png_debug2(0, "pd=%2d, b=%d, ", (int)row_info->pixel_depth, + (int)((row_info->pixel_depth + 7) >> 3)); + png_debug1(0,"len=%8d, ", row_info->rowbytes); +#endif /* PNG_DEBUG */ + + switch (filter) + { + case PNG_FILTER_VALUE_NONE: + break; + + case PNG_FILTER_VALUE_SUB: + { +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (mmx_supported) +#endif + { + png_read_filter_row_mmx_sub(row_info, row); + } + else + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_bytep rp = row + bpp; + png_bytep lp = row; + + for (i = bpp; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); + rp++; + } + } + break; + } + + case PNG_FILTER_VALUE_UP: + { +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (mmx_supported) +#endif + { + png_read_filter_row_mmx_up(row_info, row, prev_row); + } + else + { + png_uint_32 i; + png_uint_32 istop = row_info->rowbytes; + png_bytep rp = row; + png_bytep pp = prev_row; + + for (i = 0; i < istop; ++i) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + } + break; + } + + case PNG_FILTER_VALUE_AVG: + { +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (mmx_supported) +#endif + { + png_read_filter_row_mmx_avg(row_info, row, prev_row); + } + else + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop = row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + + ((int)(*pp++) >> 1)) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) + { + *rp = (png_byte)(((int)(*rp) + + ((int)(*pp++ + *lp++) >> 1)) & 0xff); + rp++; + } + } + break; + } + + case PNG_FILTER_VALUE_PAETH: + { +#if !defined(PNG_1_0_X) + if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && + (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && + (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) +#else + if (mmx_supported) +#endif + { + png_read_filter_row_mmx_paeth(row_info, row, prev_row); + } + else + { + png_uint_32 i; + png_bytep rp = row; + png_bytep pp = prev_row; + png_bytep lp = row; + png_bytep cp = prev_row; + png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; + png_uint_32 istop=row_info->rowbytes - bpp; + + for (i = 0; i < bpp; i++) + { + *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); + rp++; + } + + for (i = 0; i < istop; i++) // use leftover rp,pp + { + int a, b, c, pa, pb, pc, p; + + a = *lp++; + b = *pp++; + c = *cp++; + + p = b - c; + pc = a - c; + +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + + /* + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; + */ + + p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; + + *rp = (png_byte)(((int)(*rp) + p) & 0xff); + rp++; + } + } + break; + } + + default: + png_warning(png_ptr, "Ignoring bad row filter type"); + *row=0; + break; + } +} + +#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGVCRD */ diff --git a/src/SFML/Graphics/libpng/pngwio.c b/src/SFML/Graphics/libpng/pngwio.c new file mode 100644 index 00000000..dded699a --- /dev/null +++ b/src/SFML/Graphics/libpng/pngwio.c @@ -0,0 +1,228 @@ + +/* pngwio.c - functions for data output + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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 */ diff --git a/src/SFML/Graphics/libpng/pngwrite.c b/src/SFML/Graphics/libpng/pngwrite.c new file mode 100644 index 00000000..d9d27d61 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngwrite.c @@ -0,0 +1,1464 @@ + +/* pngwrite.c - general routines to write a PNG file + * + * libpng 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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.) + */ + +/* get internal access to png.h */ +#define PNG_INTERNAL +#include "png.h" +#ifdef PNG_WRITE_SUPPORTED + +/* Writes all the PNG information. This is the suggested way to use the + * library. If you have a new chunk to add, make a function to write it, + * and put it in the correct location here. If you want the chunk written + * after the image data, put it in png_write_end(). I strongly encourage + * you to supply a PNG_INFO_ flag, and check info_ptr->valid before writing + * the chunk, as that will keep the code from breaking if you want to just + * write a plain PNG file. If you have long comments, I suggest writing + * them in png_write_end(), and compressing them. + */ +void PNGAPI +png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_write_info_before_PLTE\n"); + if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) + { + png_write_sig(png_ptr); /* write PNG signature */ +#if defined(PNG_MNG_FEATURES_SUPPORTED) + if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) + { + png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n"); + png_ptr->mng_features_permitted=0; + } +#endif + /* write IHDR information. */ + png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height, + info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type, + info_ptr->filter_type, +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) + info_ptr->interlace_type); +#else + 0); +#endif + /* the rest of these check to see if the valid field has the appropriate + flag set, and if it does, writes the chunk. */ +#if defined(PNG_WRITE_gAMA_SUPPORTED) + if (info_ptr->valid & PNG_INFO_gAMA) + { +# ifdef PNG_FLOATING_POINT_SUPPORTED + png_write_gAMA(png_ptr, info_ptr->gamma); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_write_gAMA_fixed(png_ptr, info_ptr->int_gamma); +# endif +#endif + } +#endif +#if defined(PNG_WRITE_sRGB_SUPPORTED) + if (info_ptr->valid & PNG_INFO_sRGB) + png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent); +#endif +#if defined(PNG_WRITE_iCCP_SUPPORTED) + if (info_ptr->valid & PNG_INFO_iCCP) + png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE, + info_ptr->iccp_profile, (int)info_ptr->iccp_proflen); +#endif +#if defined(PNG_WRITE_sBIT_SUPPORTED) + if (info_ptr->valid & PNG_INFO_sBIT) + png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type); +#endif +#if defined(PNG_WRITE_cHRM_SUPPORTED) + if (info_ptr->valid & PNG_INFO_cHRM) + { +#ifdef PNG_FLOATING_POINT_SUPPORTED + png_write_cHRM(png_ptr, + info_ptr->x_white, info_ptr->y_white, + info_ptr->x_red, info_ptr->y_red, + info_ptr->x_green, info_ptr->y_green, + info_ptr->x_blue, info_ptr->y_blue); +#else +# ifdef PNG_FIXED_POINT_SUPPORTED + png_write_cHRM_fixed(png_ptr, + info_ptr->int_x_white, info_ptr->int_y_white, + info_ptr->int_x_red, info_ptr->int_y_red, + info_ptr->int_x_green, info_ptr->int_y_green, + info_ptr->int_x_blue, info_ptr->int_y_blue); +# endif +#endif + } +#endif +#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) + if (info_ptr->unknown_chunks_num) + { + png_unknown_chunk *up; + + png_debug(5, "writing extra chunks\n"); + + for (up = info_ptr->unknown_chunks; + up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; + up++) + { + int keep=png_handle_as_unknown(png_ptr, up->name); + if (keep != PNG_HANDLE_CHUNK_NEVER && + up->location && !(up->location & PNG_HAVE_PLTE) && + !(up->location & PNG_HAVE_IDAT) && + ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || + (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) + { + png_write_chunk(png_ptr, up->name, up->data, up->size); + } + } + } +#endif + png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE; + } +} + +void PNGAPI +png_write_info(png_structp png_ptr, png_infop info_ptr) +{ +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) + int i; +#endif + + png_debug(1, "in png_write_info\n"); + + png_write_info_before_PLTE(png_ptr, info_ptr); + + if (info_ptr->valid & PNG_INFO_PLTE) + png_write_PLTE(png_ptr, info_ptr->palette, + (png_uint_32)info_ptr->num_palette); + else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + png_error(png_ptr, "Valid palette required for paletted images\n"); + +#if defined(PNG_WRITE_tRNS_SUPPORTED) + if (info_ptr->valid & PNG_INFO_tRNS) + { +#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) + /* invert the alpha channel (in tRNS) */ + if ((png_ptr->transformations & PNG_INVERT_ALPHA) && + info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + int j; + for (j=0; j<(int)info_ptr->num_trans; j++) + info_ptr->trans[j] = (png_byte)(255 - info_ptr->trans[j]); + } +#endif + png_write_tRNS(png_ptr, info_ptr->trans, &(info_ptr->trans_values), + info_ptr->num_trans, info_ptr->color_type); + } +#endif +#if defined(PNG_WRITE_bKGD_SUPPORTED) + if (info_ptr->valid & PNG_INFO_bKGD) + png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); +#endif +#if defined(PNG_WRITE_hIST_SUPPORTED) + if (info_ptr->valid & PNG_INFO_hIST) + png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); +#endif +#if defined(PNG_WRITE_oFFs_SUPPORTED) + if (info_ptr->valid & PNG_INFO_oFFs) + png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset, + info_ptr->offset_unit_type); +#endif +#if defined(PNG_WRITE_pCAL_SUPPORTED) + if (info_ptr->valid & PNG_INFO_pCAL) + png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0, + info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams, + info_ptr->pcal_units, info_ptr->pcal_params); +#endif +#if defined(PNG_WRITE_sCAL_SUPPORTED) + if (info_ptr->valid & PNG_INFO_sCAL) +#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) + png_write_sCAL(png_ptr, (int)info_ptr->scal_unit, + info_ptr->scal_pixel_width, info_ptr->scal_pixel_height); +#else +#ifdef PNG_FIXED_POINT_SUPPORTED + png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit, + info_ptr->scal_s_width, info_ptr->scal_s_height); +#else + png_warning(png_ptr, + "png_write_sCAL not supported; sCAL chunk not written.\n"); +#endif +#endif +#endif +#if defined(PNG_WRITE_pHYs_SUPPORTED) + if (info_ptr->valid & PNG_INFO_pHYs) + png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit, + info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type); +#endif +#if defined(PNG_WRITE_tIME_SUPPORTED) + if (info_ptr->valid & PNG_INFO_tIME) + { + png_write_tIME(png_ptr, &(info_ptr->mod_time)); + png_ptr->mode |= PNG_WROTE_tIME; + } +#endif +#if defined(PNG_WRITE_sPLT_SUPPORTED) + if (info_ptr->valid & PNG_INFO_sPLT) + for (i = 0; i < (int)info_ptr->splt_palettes_num; i++) + png_write_sPLT(png_ptr, info_ptr->splt_palettes + i); +#endif +#if defined(PNG_WRITE_TEXT_SUPPORTED) + /* Check to see if we need to write text chunks */ + for (i = 0; i < info_ptr->num_text; i++) + { + png_debug2(2, "Writing header text chunk %d, type %d\n", i, + info_ptr->text[i].compression); + /* an internationalized chunk? */ + if (info_ptr->text[i].compression > 0) + { +#if defined(PNG_WRITE_iTXt_SUPPORTED) + /* write international chunk */ + png_write_iTXt(png_ptr, + info_ptr->text[i].compression, + info_ptr->text[i].key, + info_ptr->text[i].lang, + info_ptr->text[i].lang_key, + info_ptr->text[i].text); +#else + png_warning(png_ptr, "Unable to write international text\n"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + /* If we want a compressed text chunk */ + else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt) + { +#if defined(PNG_WRITE_zTXt_SUPPORTED) + /* write compressed chunk */ + png_write_zTXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, 0, + info_ptr->text[i].compression); +#else + png_warning(png_ptr, "Unable to write compressed text\n"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; + } + else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + { +#if defined(PNG_WRITE_tEXt_SUPPORTED) + /* write uncompressed chunk */ + png_write_tEXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, + 0); +#else + png_warning(png_ptr, "Unable to write uncompressed text\n"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + } +#endif +#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) + if (info_ptr->unknown_chunks_num) + { + png_unknown_chunk *up; + + png_debug(5, "writing extra chunks\n"); + + for (up = info_ptr->unknown_chunks; + up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; + up++) + { + int keep=png_handle_as_unknown(png_ptr, up->name); + if (keep != PNG_HANDLE_CHUNK_NEVER && + up->location && (up->location & PNG_HAVE_PLTE) && + !(up->location & PNG_HAVE_IDAT) && + ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || + (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) + { + png_write_chunk(png_ptr, up->name, up->data, up->size); + } + } + } +#endif +} + +/* Writes the end of the PNG file. If you don't want to write comments or + * time information, you can pass NULL for info. If you already wrote these + * in png_write_info(), do not write them again here. If you have long + * comments, I suggest writing them here, and compressing them. + */ +void PNGAPI +png_write_end(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_write_end\n"); + if (!(png_ptr->mode & PNG_HAVE_IDAT)) + png_error(png_ptr, "No IDATs written into file"); + + /* see if user wants us to write information chunks */ + if (info_ptr != NULL) + { +#if defined(PNG_WRITE_TEXT_SUPPORTED) + int i; /* local index variable */ +#endif +#if defined(PNG_WRITE_tIME_SUPPORTED) + /* check to see if user has supplied a time chunk */ + if ((info_ptr->valid & PNG_INFO_tIME) && + !(png_ptr->mode & PNG_WROTE_tIME)) + png_write_tIME(png_ptr, &(info_ptr->mod_time)); +#endif +#if defined(PNG_WRITE_TEXT_SUPPORTED) + /* loop through comment chunks */ + for (i = 0; i < info_ptr->num_text; i++) + { + png_debug2(2, "Writing trailer text chunk %d, type %d\n", i, + info_ptr->text[i].compression); + /* an internationalized chunk? */ + if (info_ptr->text[i].compression > 0) + { +#if defined(PNG_WRITE_iTXt_SUPPORTED) + /* write international chunk */ + png_write_iTXt(png_ptr, + info_ptr->text[i].compression, + info_ptr->text[i].key, + info_ptr->text[i].lang, + info_ptr->text[i].lang_key, + info_ptr->text[i].text); +#else + png_warning(png_ptr, "Unable to write international text\n"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt) + { +#if defined(PNG_WRITE_zTXt_SUPPORTED) + /* write compressed chunk */ + png_write_zTXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, 0, + info_ptr->text[i].compression); +#else + png_warning(png_ptr, "Unable to write compressed text\n"); +#endif + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; + } + else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + { +#if defined(PNG_WRITE_tEXt_SUPPORTED) + /* write uncompressed chunk */ + png_write_tEXt(png_ptr, info_ptr->text[i].key, + info_ptr->text[i].text, 0); +#else + png_warning(png_ptr, "Unable to write uncompressed text\n"); +#endif + + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + } + } +#endif +#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) + if (info_ptr->unknown_chunks_num) + { + png_unknown_chunk *up; + + png_debug(5, "writing extra chunks\n"); + + for (up = info_ptr->unknown_chunks; + up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; + up++) + { + int keep=png_handle_as_unknown(png_ptr, up->name); + if (keep != PNG_HANDLE_CHUNK_NEVER && + up->location && (up->location & PNG_AFTER_IDAT) && + ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || + (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) + { + png_write_chunk(png_ptr, up->name, up->data, up->size); + } + } + } +#endif + } + + png_ptr->mode |= PNG_AFTER_IDAT; + + /* write end of PNG file */ + png_write_IEND(png_ptr); +#if 0 +/* This flush, added in libpng-1.0.8, causes some applications to crash + because they do not set png_ptr->output_flush_fn */ + png_flush(png_ptr); +#endif +} + +#if defined(PNG_WRITE_tIME_SUPPORTED) +#if !defined(_WIN32_WCE) +/* "time.h" functions are not supported on WindowsCE */ +void PNGAPI +png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime) +{ + png_debug(1, "in png_convert_from_struct_tm\n"); + ptime->year = (png_uint_16)(1900 + ttime->tm_year); + ptime->month = (png_byte)(ttime->tm_mon + 1); + ptime->day = (png_byte)ttime->tm_mday; + ptime->hour = (png_byte)ttime->tm_hour; + ptime->minute = (png_byte)ttime->tm_min; + ptime->second = (png_byte)ttime->tm_sec; +} + +void PNGAPI +png_convert_from_time_t(png_timep ptime, time_t ttime) +{ + struct tm *tbuf; + + png_debug(1, "in png_convert_from_time_t\n"); + tbuf = gmtime(&ttime); + png_convert_from_struct_tm(ptime, tbuf); +} +#endif +#endif + +/* Initialize png_ptr structure, and allocate any memory needed */ +png_structp PNGAPI +png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn) +{ +#ifdef PNG_USER_MEM_SUPPORTED + return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn, + warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL)); +} + +/* Alternate initialize png_ptr structure, and allocate any memory needed */ +png_structp PNGAPI +png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, + png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn) +{ +#endif /* PNG_USER_MEM_SUPPORTED */ + png_structp png_ptr; +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + jmp_buf jmpbuf; +#endif +#endif + int i; + png_debug(1, "in png_create_write_struct\n"); +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, + (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); +#else + png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); +#endif /* PNG_USER_MEM_SUPPORTED */ + if (png_ptr == NULL) + return (NULL); + +#if !defined(PNG_1_0_X) +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED + png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ +#endif +#endif /* PNG_1_0_X */ + + /* added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_ptr->user_width_max=PNG_USER_WIDTH_MAX; + png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; +#endif + +#ifdef PNG_SETJMP_SUPPORTED +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) +#else + if (setjmp(png_ptr->jmpbuf)) +#endif + { + png_free(png_ptr, png_ptr->zbuf); + png_ptr->zbuf=NULL; + png_destroy_struct(png_ptr); + return (NULL); + } +#ifdef USE_FAR_KEYWORD + png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); +#endif +#endif + +#ifdef PNG_USER_MEM_SUPPORTED + png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); +#endif /* PNG_USER_MEM_SUPPORTED */ + png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); + + i=0; + do + { + if(user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + + if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) + { + /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so + * we must recompile any applications that use any older library version. + * For versions after libpng 1.0, we will be compatible, so we need + * only check the first digit. + */ + if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || + (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || + (user_png_ver[0] == '0' && user_png_ver[2] < '9')) + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char msg[80]; + if (user_png_ver) + { + sprintf(msg, "Application was compiled with png.h from libpng-%.20s", + user_png_ver); + png_warning(png_ptr, msg); + } + sprintf(msg, "Application is running with png.c from libpng-%.20s", + png_libpng_ver); + png_warning(png_ptr, msg); +#endif +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags=0; +#endif + png_error(png_ptr, + "Incompatible libpng version in application and library"); + } + } + + /* initialize zbuf - compression buffer */ + png_ptr->zbuf_size = PNG_ZBUF_SIZE; + png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, + (png_uint_32)png_ptr->zbuf_size); + + png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, + png_flush_ptr_NULL); + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, + 1, png_doublep_NULL, png_doublep_NULL); +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* Applications that neglect to set up their own setjmp() and then encounter + a png_error() will longjmp here. Since the jmpbuf is then meaningless we + abort instead of returning. */ +#ifdef USE_FAR_KEYWORD + if (setjmp(jmpbuf)) + PNG_ABORT(); + png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); +#else + if (setjmp(png_ptr->jmpbuf)) + PNG_ABORT(); +#endif +#endif + return (png_ptr); +} + +/* Initialize png_ptr structure, and allocate any memory needed */ +#undef png_write_init +void PNGAPI +png_write_init(png_structp png_ptr) +{ + /* We only come here via pre-1.0.7-compiled applications */ + png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0); +} + +void PNGAPI +png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, + png_size_t png_struct_size, png_size_t png_info_size) +{ + /* We only come here via pre-1.0.12-compiled applications */ +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + if(png_sizeof(png_struct) > png_struct_size || + png_sizeof(png_info) > png_info_size) + { + char msg[80]; + png_ptr->warning_fn=NULL; + if (user_png_ver) + { + sprintf(msg, "Application was compiled with png.h from libpng-%.20s", + user_png_ver); + png_warning(png_ptr, msg); + } + sprintf(msg, "Application is running with png.c from libpng-%.20s", + png_libpng_ver); + png_warning(png_ptr, msg); + } +#endif + if(png_sizeof(png_struct) > png_struct_size) + { + png_ptr->error_fn=NULL; +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags=0; +#endif + png_error(png_ptr, + "The png struct allocated by the application for writing is too small."); + } + if(png_sizeof(png_info) > png_info_size) + { + png_ptr->error_fn=NULL; +#ifdef PNG_ERROR_NUMBERS_SUPPORTED + png_ptr->flags=0; +#endif + png_error(png_ptr, + "The info struct allocated by the application for writing is too small."); + } + png_write_init_3(&png_ptr, user_png_ver, png_struct_size); +} + + +void PNGAPI +png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, + png_size_t png_struct_size) +{ + png_structp png_ptr=*ptr_ptr; +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf tmp_jmp; /* to save current jump buffer */ +#endif + int i = 0; + do + { + if (user_png_ver[i] != png_libpng_ver[i]) + { +#ifdef PNG_LEGACY_SUPPORTED + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; +#else + png_ptr->warning_fn=NULL; + png_warning(png_ptr, + "Application uses deprecated png_write_init() and should be recompiled."); + break; +#endif + } + } while (png_libpng_ver[i++]); + + png_debug(1, "in png_write_init_3\n"); + +#ifdef PNG_SETJMP_SUPPORTED + /* save jump buffer and error functions */ + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); +#endif + + if (png_sizeof(png_struct) > png_struct_size) + { + png_destroy_struct(png_ptr); + png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); + *ptr_ptr = png_ptr; + } + + /* reset all variables to 0 */ + png_memset(png_ptr, 0, png_sizeof (png_struct)); + + /* added at libpng-1.2.6 */ +#ifdef PNG_SET_USER_LIMITS_SUPPORTED + png_ptr->user_width_max=PNG_USER_WIDTH_MAX; + png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; +#endif + +#if !defined(PNG_1_0_X) +#ifdef PNG_ASSEMBLER_CODE_SUPPORTED + png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ +#endif +#endif /* PNG_1_0_X */ + +#ifdef PNG_SETJMP_SUPPORTED + /* restore jump buffer */ + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); +#endif + + png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, + png_flush_ptr_NULL); + + /* initialize zbuf - compression buffer */ + png_ptr->zbuf_size = PNG_ZBUF_SIZE; + png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, + (png_uint_32)png_ptr->zbuf_size); + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, + 1, png_doublep_NULL, png_doublep_NULL); +#endif +} + +/* Write a few rows of image data. If the image is interlaced, + * either you will have to write the 7 sub images, or, if you + * have called png_set_interlace_handling(), you will have to + * "write" the image seven times. + */ +void PNGAPI +png_write_rows(png_structp png_ptr, png_bytepp row, + png_uint_32 num_rows) +{ + png_uint_32 i; /* row counter */ + png_bytepp rp; /* row pointer */ + + png_debug(1, "in png_write_rows\n"); + /* loop through the rows */ + for (i = 0, rp = row; i < num_rows; i++, rp++) + { + png_write_row(png_ptr, *rp); + } +} + +/* Write the image. You only need to call this function once, even + * if you are writing an interlaced image. + */ +void PNGAPI +png_write_image(png_structp png_ptr, png_bytepp image) +{ + png_uint_32 i; /* row index */ + int pass, num_pass; /* pass variables */ + png_bytepp rp; /* points to current row */ + + png_debug(1, "in png_write_image\n"); +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) + /* intialize interlace handling. If image is not interlaced, + this will set pass to 1 */ + num_pass = png_set_interlace_handling(png_ptr); +#else + num_pass = 1; +#endif + /* loop through passes */ + for (pass = 0; pass < num_pass; pass++) + { + /* loop through image */ + for (i = 0, rp = image; i < png_ptr->height; i++, rp++) + { + png_write_row(png_ptr, *rp); + } + } +} + +/* called by user to write a row of image data */ +void PNGAPI +png_write_row(png_structp png_ptr, png_bytep row) +{ + png_debug2(1, "in png_write_row (row %ld, pass %d)\n", + png_ptr->row_number, png_ptr->pass); + /* initialize transformations and other stuff if first time */ + if (png_ptr->row_number == 0 && png_ptr->pass == 0) + { + /* make sure we wrote the header info */ + if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) + png_error(png_ptr, + "png_write_info was never called before png_write_row."); + + /* check for transforms that have been set but were defined out */ +#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) + if (png_ptr->transformations & PNG_INVERT_MONO) + png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined."); +#endif +#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED) + if (png_ptr->transformations & PNG_FILLER) + png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined."); +#endif +#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED) + if (png_ptr->transformations & PNG_PACKSWAP) + png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined."); +#endif +#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED) + if (png_ptr->transformations & PNG_PACK) + png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined."); +#endif +#if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED) + if (png_ptr->transformations & PNG_SHIFT) + png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined."); +#endif +#if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED) + if (png_ptr->transformations & PNG_BGR) + png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined."); +#endif +#if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED) + if (png_ptr->transformations & PNG_SWAP_BYTES) + png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined."); +#endif + + png_write_start_row(png_ptr); + } + +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) + /* if interlaced and not interested in row, return */ + if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) + { + switch (png_ptr->pass) + { + case 0: + if (png_ptr->row_number & 0x07) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 1: + if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 2: + if ((png_ptr->row_number & 0x07) != 4) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 3: + if ((png_ptr->row_number & 0x03) || png_ptr->width < 3) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 4: + if ((png_ptr->row_number & 0x03) != 2) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 5: + if ((png_ptr->row_number & 0x01) || png_ptr->width < 2) + { + png_write_finish_row(png_ptr); + return; + } + break; + case 6: + if (!(png_ptr->row_number & 0x01)) + { + png_write_finish_row(png_ptr); + return; + } + break; + } + } +#endif + + /* set up row info for transformations */ + png_ptr->row_info.color_type = png_ptr->color_type; + png_ptr->row_info.width = png_ptr->usr_width; + png_ptr->row_info.channels = png_ptr->usr_channels; + png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth; + png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * + png_ptr->row_info.channels); + + png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, + png_ptr->row_info.width); + + png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type); + png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width); + png_debug1(3, "row_info->channels = %d\n", png_ptr->row_info.channels); + png_debug1(3, "row_info->bit_depth = %d\n", png_ptr->row_info.bit_depth); + png_debug1(3, "row_info->pixel_depth = %d\n", png_ptr->row_info.pixel_depth); + png_debug1(3, "row_info->rowbytes = %lu\n", png_ptr->row_info.rowbytes); + + /* Copy user's row into buffer, leaving room for filter byte. */ + png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row, + png_ptr->row_info.rowbytes); + +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) + /* handle interlacing */ + if (png_ptr->interlaced && png_ptr->pass < 6 && + (png_ptr->transformations & PNG_INTERLACE)) + { + png_do_write_interlace(&(png_ptr->row_info), + png_ptr->row_buf + 1, png_ptr->pass); + /* this should always get caught above, but still ... */ + if (!(png_ptr->row_info.width)) + { + png_write_finish_row(png_ptr); + return; + } + } +#endif + + /* handle other transformations */ + if (png_ptr->transformations) + png_do_write_transformations(png_ptr); + +#if defined(PNG_MNG_FEATURES_SUPPORTED) + /* Write filter_method 64 (intrapixel differencing) only if + * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and + * 2. Libpng did not write a PNG signature (this filter_method is only + * used in PNG datastreams that are embedded in MNG datastreams) and + * 3. The application called png_permit_mng_features with a mask that + * included PNG_FLAG_MNG_FILTER_64 and + * 4. The filter_method is 64 and + * 5. The color_type is RGB or RGBA + */ + if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) + { + /* Intrapixel differencing */ + png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); + } +#endif + + /* Find a filter if necessary, filter the row and write it out. */ + png_write_find_filter(png_ptr, &(png_ptr->row_info)); + + if (png_ptr->write_row_fn != NULL) + (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); +} + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) +/* Set the automatic flush interval or 0 to turn flushing off */ +void PNGAPI +png_set_flush(png_structp png_ptr, int nrows) +{ + png_debug(1, "in png_set_flush\n"); + png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); +} + +/* flush the current output buffers now */ +void PNGAPI +png_write_flush(png_structp png_ptr) +{ + int wrote_IDAT; + + png_debug(1, "in png_write_flush\n"); + /* We have already written out all of the data */ + if (png_ptr->row_number >= png_ptr->num_rows) + return; + + do + { + int ret; + + /* compress the data */ + ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH); + wrote_IDAT = 0; + + /* check for compression errors */ + if (ret != Z_OK) + { + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + + if (!(png_ptr->zstream.avail_out)) + { + /* write the IDAT and reset the zlib output buffer */ + png_write_IDAT(png_ptr, png_ptr->zbuf, + png_ptr->zbuf_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + wrote_IDAT = 1; + } + } while(wrote_IDAT == 1); + + /* If there is any data left to be output, write it into a new IDAT */ + if (png_ptr->zbuf_size != png_ptr->zstream.avail_out) + { + /* write the IDAT and reset the zlib output buffer */ + png_write_IDAT(png_ptr, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + png_ptr->flush_rows = 0; + png_flush(png_ptr); +} +#endif /* PNG_WRITE_FLUSH_SUPPORTED */ + +/* free all memory used by the write */ +void PNGAPI +png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) +{ + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn = NULL; + png_voidp mem_ptr = NULL; +#endif + + png_debug(1, "in png_destroy_write_struct\n"); + if (png_ptr_ptr != NULL) + { + png_ptr = *png_ptr_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; +#endif + } + + if (info_ptr_ptr != NULL) + info_ptr = *info_ptr_ptr; + + if (info_ptr != NULL) + { + 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 + +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)info_ptr); +#endif + *info_ptr_ptr = NULL; + } + + if (png_ptr != NULL) + { + png_write_destroy(png_ptr); +#ifdef PNG_USER_MEM_SUPPORTED + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); +#else + png_destroy_struct((png_voidp)png_ptr); +#endif + *png_ptr_ptr = NULL; + } +} + + +/* Free any memory used in png_ptr struct (old method) */ +void /* PRIVATE */ +png_write_destroy(png_structp png_ptr) +{ +#ifdef PNG_SETJMP_SUPPORTED + jmp_buf tmp_jmp; /* save jump buffer */ +#endif + png_error_ptr error_fn; + png_error_ptr warning_fn; + png_voidp error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_free_ptr free_fn; +#endif + + png_debug(1, "in png_write_destroy\n"); + /* free any memory zlib uses */ + deflateEnd(&png_ptr->zstream); + + /* free our memory. png_free checks NULL for us. */ + png_free(png_ptr, png_ptr->zbuf); + png_free(png_ptr, png_ptr->row_buf); + png_free(png_ptr, png_ptr->prev_row); + png_free(png_ptr, png_ptr->sub_row); + png_free(png_ptr, png_ptr->up_row); + png_free(png_ptr, png_ptr->avg_row); + png_free(png_ptr, png_ptr->paeth_row); + +#if defined(PNG_TIME_RFC1123_SUPPORTED) + png_free(png_ptr, png_ptr->time_buffer); +#endif + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + png_free(png_ptr, png_ptr->prev_filters); + png_free(png_ptr, png_ptr->filter_weights); + png_free(png_ptr, png_ptr->inv_filter_weights); + png_free(png_ptr, png_ptr->filter_costs); + png_free(png_ptr, png_ptr->inv_filter_costs); +#endif + +#ifdef PNG_SETJMP_SUPPORTED + /* reset structure */ + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); +#endif + + error_fn = png_ptr->error_fn; + warning_fn = png_ptr->warning_fn; + error_ptr = png_ptr->error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; +#endif + + png_memset(png_ptr, 0, png_sizeof (png_struct)); + + png_ptr->error_fn = error_fn; + png_ptr->warning_fn = warning_fn; + png_ptr->error_ptr = error_ptr; +#ifdef PNG_USER_MEM_SUPPORTED + png_ptr->free_fn = free_fn; +#endif + +#ifdef PNG_SETJMP_SUPPORTED + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); +#endif +} + +/* Allow the application to select one or more row filters to use. */ +void PNGAPI +png_set_filter(png_structp png_ptr, int method, int filters) +{ + png_debug(1, "in png_set_filter\n"); +#if defined(PNG_MNG_FEATURES_SUPPORTED) + if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + (method == PNG_INTRAPIXEL_DIFFERENCING)) + method = PNG_FILTER_TYPE_BASE; +#endif + if (method == PNG_FILTER_TYPE_BASE) + { + switch (filters & (PNG_ALL_FILTERS | 0x07)) + { + case 5: + case 6: + case 7: png_warning(png_ptr, "Unknown row filter for method 0"); + case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break; + case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break; + case PNG_FILTER_VALUE_UP: png_ptr->do_filter=PNG_FILTER_UP; break; + case PNG_FILTER_VALUE_AVG: png_ptr->do_filter=PNG_FILTER_AVG; break; + case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter=PNG_FILTER_PAETH;break; + default: png_ptr->do_filter = (png_byte)filters; break; + } + + /* If we have allocated the row_buf, this means we have already started + * with the image and we should have allocated all of the filter buffers + * that have been selected. If prev_row isn't already allocated, then + * it is too late to start using the filters that need it, since we + * will be missing the data in the previous row. If an application + * wants to start and stop using particular filters during compression, + * it should start out with all of the filters, and then add and + * remove them after the start of compression. + */ + if (png_ptr->row_buf != NULL) + { + if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) + { + png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; + } + + if ((png_ptr->do_filter & PNG_FILTER_UP) && png_ptr->up_row == NULL) + { + if (png_ptr->prev_row == NULL) + { + png_warning(png_ptr, "Can't add Up filter after starting"); + png_ptr->do_filter &= ~PNG_FILTER_UP; + } + else + { + png_ptr->up_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; + } + } + + if ((png_ptr->do_filter & PNG_FILTER_AVG) && png_ptr->avg_row == NULL) + { + if (png_ptr->prev_row == NULL) + { + png_warning(png_ptr, "Can't add Average filter after starting"); + png_ptr->do_filter &= ~PNG_FILTER_AVG; + } + else + { + png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; + } + } + + if ((png_ptr->do_filter & PNG_FILTER_PAETH) && + png_ptr->paeth_row == NULL) + { + if (png_ptr->prev_row == NULL) + { + png_warning(png_ptr, "Can't add Paeth filter after starting"); + png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH); + } + else + { + png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; + } + } + + if (png_ptr->do_filter == PNG_NO_FILTERS) + png_ptr->do_filter = PNG_FILTER_NONE; + } + } + else + png_error(png_ptr, "Unknown custom filter method"); +} + +/* This allows us to influence the way in which libpng chooses the "best" + * filter for the current scanline. While the "minimum-sum-of-absolute- + * differences metric is relatively fast and effective, there is some + * question as to whether it can be improved upon by trying to keep the + * filtered data going to zlib more consistent, hopefully resulting in + * better compression. + */ +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* GRR 970116 */ +void PNGAPI +png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, + int num_weights, png_doublep filter_weights, + png_doublep filter_costs) +{ + int i; + + png_debug(1, "in png_set_filter_heuristics\n"); + if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST) + { + png_warning(png_ptr, "Unknown filter heuristic method"); + return; + } + + if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT) + { + heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED; + } + + if (num_weights < 0 || filter_weights == NULL || + heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED) + { + num_weights = 0; + } + + png_ptr->num_prev_filters = (png_byte)num_weights; + png_ptr->heuristic_method = (png_byte)heuristic_method; + + if (num_weights > 0) + { + if (png_ptr->prev_filters == NULL) + { + png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_byte) * num_weights)); + + /* To make sure that the weighting starts out fairly */ + for (i = 0; i < num_weights; i++) + { + png_ptr->prev_filters[i] = 255; + } + } + + if (png_ptr->filter_weights == NULL) + { + png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * num_weights)); + + png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * num_weights)); + for (i = 0; i < num_weights; i++) + { + png_ptr->inv_filter_weights[i] = + png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; + } + } + + for (i = 0; i < num_weights; i++) + { + if (filter_weights[i] < 0.0) + { + png_ptr->inv_filter_weights[i] = + png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; + } + else + { + png_ptr->inv_filter_weights[i] = + (png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5); + png_ptr->filter_weights[i] = + (png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5); + } + } + } + + /* If, in the future, there are other filter methods, this would + * need to be based on png_ptr->filter. + */ + if (png_ptr->filter_costs == NULL) + { + png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); + + png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr, + (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); + + for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) + { + png_ptr->inv_filter_costs[i] = + png_ptr->filter_costs[i] = PNG_COST_FACTOR; + } + } + + /* Here is where we set the relative costs of the different filters. We + * should take the desired compression level into account when setting + * the costs, so that Paeth, for instance, has a high relative cost at low + * compression levels, while it has a lower relative cost at higher + * compression settings. The filter types are in order of increasing + * relative cost, so it would be possible to do this with an algorithm. + */ + for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) + { + if (filter_costs == NULL || filter_costs[i] < 0.0) + { + png_ptr->inv_filter_costs[i] = + png_ptr->filter_costs[i] = PNG_COST_FACTOR; + } + else if (filter_costs[i] >= 1.0) + { + png_ptr->inv_filter_costs[i] = + (png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5); + png_ptr->filter_costs[i] = + (png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5); + } + } +} +#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ + +void PNGAPI +png_set_compression_level(png_structp png_ptr, int level) +{ + png_debug(1, "in png_set_compression_level\n"); + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL; + png_ptr->zlib_level = level; +} + +void PNGAPI +png_set_compression_mem_level(png_structp png_ptr, int mem_level) +{ + png_debug(1, "in png_set_compression_mem_level\n"); + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL; + png_ptr->zlib_mem_level = mem_level; +} + +void PNGAPI +png_set_compression_strategy(png_structp png_ptr, int strategy) +{ + png_debug(1, "in png_set_compression_strategy\n"); + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY; + png_ptr->zlib_strategy = strategy; +} + +void PNGAPI +png_set_compression_window_bits(png_structp png_ptr, int window_bits) +{ + if (window_bits > 15) + png_warning(png_ptr, "Only compression windows <= 32k supported by PNG"); + else if (window_bits < 8) + png_warning(png_ptr, "Only compression windows >= 256 supported by PNG"); +#ifndef WBITS_8_OK + /* avoid libpng bug with 256-byte windows */ + if (window_bits == 8) + { + png_warning(png_ptr, "Compression window is being reset to 512"); + window_bits=9; + } +#endif + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS; + png_ptr->zlib_window_bits = window_bits; +} + +void PNGAPI +png_set_compression_method(png_structp png_ptr, int method) +{ + png_debug(1, "in png_set_compression_method\n"); + if (method != 8) + png_warning(png_ptr, "Only compression method 8 is supported by PNG"); + png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_METHOD; + png_ptr->zlib_method = method; +} + +void PNGAPI +png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) +{ + png_ptr->write_row_fn = write_row_fn; +} + +#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +void PNGAPI +png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr + write_user_transform_fn) +{ + png_debug(1, "in png_set_write_user_transform_fn\n"); + png_ptr->transformations |= PNG_USER_TRANSFORM; + png_ptr->write_user_transform_fn = write_user_transform_fn; +} +#endif + + +#if defined(PNG_INFO_IMAGE_SUPPORTED) +void PNGAPI +png_write_png(png_structp png_ptr, png_infop info_ptr, + int transforms, voidp params) +{ +#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) + /* invert the alpha channel from opacity to transparency */ + if (transforms & PNG_TRANSFORM_INVERT_ALPHA) + png_set_invert_alpha(png_ptr); +#endif + + /* Write the file header information. */ + png_write_info(png_ptr, info_ptr); + + /* ------ these transformations don't touch the info structure ------- */ + +#if defined(PNG_WRITE_INVERT_SUPPORTED) + /* invert monochrome pixels */ + if (transforms & PNG_TRANSFORM_INVERT_MONO) + png_set_invert_mono(png_ptr); +#endif + +#if defined(PNG_WRITE_SHIFT_SUPPORTED) + /* Shift the pixels up to a legal bit depth and fill in + * as appropriate to correctly scale the image. + */ + if ((transforms & PNG_TRANSFORM_SHIFT) + && (info_ptr->valid & PNG_INFO_sBIT)) + png_set_shift(png_ptr, &info_ptr->sig_bit); +#endif + +#if defined(PNG_WRITE_PACK_SUPPORTED) + /* pack pixels into bytes */ + if (transforms & PNG_TRANSFORM_PACKING) + png_set_packing(png_ptr); +#endif + +#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) + /* swap location of alpha bytes from ARGB to RGBA */ + if (transforms & PNG_TRANSFORM_SWAP_ALPHA) + png_set_swap_alpha(png_ptr); +#endif + +#if defined(PNG_WRITE_FILLER_SUPPORTED) + /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into + * RGB (4 channels -> 3 channels). The second parameter is not used. + */ + if (transforms & PNG_TRANSFORM_STRIP_FILLER) + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); +#endif + +#if defined(PNG_WRITE_BGR_SUPPORTED) + /* flip BGR pixels to RGB */ + if (transforms & PNG_TRANSFORM_BGR) + png_set_bgr(png_ptr); +#endif + +#if defined(PNG_WRITE_SWAP_SUPPORTED) + /* swap bytes of 16-bit files to most significant byte first */ + if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) + png_set_swap(png_ptr); +#endif + +#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) + /* swap bits of 1, 2, 4 bit packed pixel formats */ + if (transforms & PNG_TRANSFORM_PACKSWAP) + png_set_packswap(png_ptr); +#endif + + /* ----------------------- end of transformations ------------------- */ + + /* write the bits */ + if (info_ptr->valid & PNG_INFO_IDAT) + png_write_image(png_ptr, info_ptr->row_pointers); + + /* It is REQUIRED to call this to finish writing the rest of the file */ + png_write_end(png_ptr, info_ptr); + + if(transforms == 0 || params == NULL) + /* quiet compiler warnings */ return; +} +#endif +#endif /* PNG_WRITE_SUPPORTED */ diff --git a/src/SFML/Graphics/libpng/pngwtran.c b/src/SFML/Graphics/libpng/pngwtran.c new file mode 100644 index 00000000..325fe276 --- /dev/null +++ b/src/SFML/Graphics/libpng/pngwtran.c @@ -0,0 +1,563 @@ + +/* pngwtran.c - transforms the data in a row for PNG writers + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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_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_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_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++) + { + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(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++) + { + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(dp++) = *(sp++); + *(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++) + { + *(dp++) = *(sp++); + *(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 */ diff --git a/src/SFML/Graphics/libpng/pngwutil.c b/src/SFML/Graphics/libpng/pngwutil.c new file mode 100644 index 00000000..7a94cc4c --- /dev/null +++ b/src/SFML/Graphics/libpng/pngwutil.c @@ -0,0 +1,2730 @@ + +/* pngwutil.c - utilities to write a PNG file + * + * libpng version 1.2.8 - December 3, 2004 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2004 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 + +/* Place a 32-bit number into a buffer in PNG byte order. We work + * with unsigned numbers for convenience, although one supported + * ancillary chunk uses signed (two's complement) numbers. + */ +void /* PRIVATE */ +png_save_uint_32(png_bytep buf, png_uint_32 i) +{ + buf[0] = (png_byte)((i >> 24) & 0xff); + buf[1] = (png_byte)((i >> 16) & 0xff); + buf[2] = (png_byte)((i >> 8) & 0xff); + buf[3] = (png_byte)(i & 0xff); +} + +#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED) +/* The png_save_int_32 function assumes integers are stored in two's + * complement format. If this isn't the case, then this routine needs to + * be modified to write data in two's complement format. + */ +void /* PRIVATE */ +png_save_int_32(png_bytep buf, png_int_32 i) +{ + buf[0] = (png_byte)((i >> 24) & 0xff); + buf[1] = (png_byte)((i >> 16) & 0xff); + buf[2] = (png_byte)((i >> 8) & 0xff); + buf[3] = (png_byte)(i & 0xff); +} +#endif + +/* Place a 16-bit number into a buffer in PNG byte order. + * The parameter is declared unsigned int, not png_uint_16, + * just to avoid potential problems on pre-ANSI C compilers. + */ +void /* PRIVATE */ +png_save_uint_16(png_bytep buf, unsigned int i) +{ + buf[0] = (png_byte)((i >> 8) & 0xff); + buf[1] = (png_byte)(i & 0xff); +} + +/* Write a PNG chunk all at once. The type is an array of ASCII characters + * representing the chunk name. The array must be at least 4 bytes in + * length, and does not need to be null terminated. To be safe, pass the + * pre-defined chunk names here, and if you need a new one, define it + * where the others are defined. The length is the length of the data. + * All the data must be present. If that is not possible, use the + * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end() + * functions instead. + */ +void PNGAPI +png_write_chunk(png_structp png_ptr, png_bytep chunk_name, + png_bytep data, png_size_t length) +{ + png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length); + png_write_chunk_data(png_ptr, data, length); + png_write_chunk_end(png_ptr); +} + +/* Write the start of a PNG chunk. The type is the chunk type. + * The total_length is the sum of the lengths of all the data you will be + * passing in png_write_chunk_data(). + */ +void PNGAPI +png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, + png_uint_32 length) +{ + png_byte buf[4]; + png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length); + + /* write the length */ + png_save_uint_32(buf, length); + png_write_data(png_ptr, buf, (png_size_t)4); + + /* write the chunk name */ + png_write_data(png_ptr, chunk_name, (png_size_t)4); + /* reset the crc and run it over the chunk name */ + png_reset_crc(png_ptr); + png_calculate_crc(png_ptr, chunk_name, (png_size_t)4); +} + +/* Write the data of a PNG chunk started with png_write_chunk_start(). + * Note that multiple calls to this function are allowed, and that the + * sum of the lengths from these calls *must* add up to the total_length + * given to png_write_chunk_start(). + */ +void PNGAPI +png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length) +{ + /* write the data, and run the CRC over it */ + if (data != NULL && length > 0) + { + png_calculate_crc(png_ptr, data, length); + png_write_data(png_ptr, data, length); + } +} + +/* Finish a chunk started with png_write_chunk_start(). */ +void PNGAPI +png_write_chunk_end(png_structp png_ptr) +{ + png_byte buf[4]; + + /* write the crc */ + png_save_uint_32(buf, png_ptr->crc); + + png_write_data(png_ptr, buf, (png_size_t)4); +} + +/* Simple function to write the signature. If we have already written + * the magic bytes of the signature, or more likely, the PNG stream is + * being embedded into another stream and doesn't need its own signature, + * we should call png_set_sig_bytes() to tell libpng how many of the + * bytes have already been written. + */ +void /* PRIVATE */ +png_write_sig(png_structp png_ptr) +{ + png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + /* write the rest of the 8 byte signature */ + png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes], + (png_size_t)8 - png_ptr->sig_bytes); + if(png_ptr->sig_bytes < 3) + png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; +} + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) +/* + * This pair of functions encapsulates the operation of (a) compressing a + * text string, and (b) issuing it later as a series of chunk data writes. + * The compression_state structure is shared context for these functions + * set up by the caller in order to make the whole mess thread-safe. + */ + +typedef struct +{ + char *input; /* the uncompressed input data */ + int input_len; /* its length */ + int num_output_ptr; /* number of output pointers used */ + int max_output_ptr; /* size of output_ptr */ + png_charpp output_ptr; /* array of pointers to output */ +} compression_state; + +/* compress given text into storage in the png_ptr structure */ +static int /* PRIVATE */ +png_text_compress(png_structp png_ptr, + png_charp text, png_size_t text_len, int compression, + compression_state *comp) +{ + int ret; + + comp->num_output_ptr = comp->max_output_ptr = 0; + comp->output_ptr = NULL; + comp->input = NULL; + + /* we may just want to pass the text right through */ + if (compression == PNG_TEXT_COMPRESSION_NONE) + { + comp->input = text; + comp->input_len = text_len; + return((int)text_len); + } + + if (compression >= PNG_TEXT_COMPRESSION_LAST) + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char msg[50]; + sprintf(msg, "Unknown compression type %d", compression); + png_warning(png_ptr, msg); +#else + png_warning(png_ptr, "Unknown compression type"); +#endif + } + + /* We can't write the chunk until we find out how much data we have, + * which means we need to run the compressor first and save the + * output. This shouldn't be a problem, as the vast majority of + * comments should be reasonable, but we will set up an array of + * malloc'd pointers to be sure. + * + * If we knew the application was well behaved, we could simplify this + * greatly by assuming we can always malloc an output buffer large + * enough to hold the compressed text ((1001 * text_len / 1000) + 12) + * and malloc this directly. The only time this would be a bad idea is + * if we can't malloc more than 64K and we have 64K of random input + * data, or if the input string is incredibly large (although this + * wouldn't cause a failure, just a slowdown due to swapping). + */ + + /* set up the compression buffers */ + png_ptr->zstream.avail_in = (uInt)text_len; + png_ptr->zstream.next_in = (Bytef *)text; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = (Bytef *)png_ptr->zbuf; + + /* this is the same compression loop as in png_write_row() */ + do + { + /* compress the data */ + ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); + if (ret != Z_OK) + { + /* error */ + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + /* check to see if we need more room */ + if (!(png_ptr->zstream.avail_out)) + { + /* make sure the output array has room */ + if (comp->num_output_ptr >= comp->max_output_ptr) + { + int old_max; + + old_max = comp->max_output_ptr; + comp->max_output_ptr = comp->num_output_ptr + 4; + if (comp->output_ptr != NULL) + { + png_charpp old_ptr; + + old_ptr = comp->output_ptr; + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_uint_32)(comp->max_output_ptr * + png_sizeof (png_charpp))); + png_memcpy(comp->output_ptr, old_ptr, old_max + * png_sizeof (png_charp)); + png_free(png_ptr, old_ptr); + } + else + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_uint_32)(comp->max_output_ptr * + png_sizeof (png_charp))); + } + + /* save the data */ + comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr, + (png_uint_32)png_ptr->zbuf_size); + png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, + png_ptr->zbuf_size); + comp->num_output_ptr++; + + /* and reset the buffer */ + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = png_ptr->zbuf; + } + /* continue until we don't have any more to compress */ + } while (png_ptr->zstream.avail_in); + + /* finish the compression */ + do + { + /* tell zlib we are finished */ + ret = deflate(&png_ptr->zstream, Z_FINISH); + + if (ret == Z_OK) + { + /* check to see if we need more room */ + if (!(png_ptr->zstream.avail_out)) + { + /* check to make sure our output array has room */ + if (comp->num_output_ptr >= comp->max_output_ptr) + { + int old_max; + + old_max = comp->max_output_ptr; + comp->max_output_ptr = comp->num_output_ptr + 4; + if (comp->output_ptr != NULL) + { + png_charpp old_ptr; + + old_ptr = comp->output_ptr; + /* This could be optimized to realloc() */ + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_uint_32)(comp->max_output_ptr * + png_sizeof (png_charpp))); + png_memcpy(comp->output_ptr, old_ptr, + old_max * png_sizeof (png_charp)); + png_free(png_ptr, old_ptr); + } + else + comp->output_ptr = (png_charpp)png_malloc(png_ptr, + (png_uint_32)(comp->max_output_ptr * + png_sizeof (png_charp))); + } + + /* save off the data */ + comp->output_ptr[comp->num_output_ptr] = + (png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); + png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, + png_ptr->zbuf_size); + comp->num_output_ptr++; + + /* and reset the buffer pointers */ + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = png_ptr->zbuf; + } + } + else if (ret != Z_STREAM_END) + { + /* we got an error */ + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + } while (ret != Z_STREAM_END); + + /* text length is number of buffers plus last buffer */ + text_len = png_ptr->zbuf_size * comp->num_output_ptr; + if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) + text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out; + + return((int)text_len); +} + +/* ship the compressed text out via chunk writes */ +static void /* PRIVATE */ +png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) +{ + int i; + + /* handle the no-compression case */ + if (comp->input) + { + png_write_chunk_data(png_ptr, (png_bytep)comp->input, + (png_size_t)comp->input_len); + return; + } + + /* write saved output buffers, if any */ + for (i = 0; i < comp->num_output_ptr; i++) + { + png_write_chunk_data(png_ptr,(png_bytep)comp->output_ptr[i], + png_ptr->zbuf_size); + png_free(png_ptr, comp->output_ptr[i]); + comp->output_ptr[i]=NULL; + } + if (comp->max_output_ptr != 0) + png_free(png_ptr, comp->output_ptr); + comp->output_ptr=NULL; + /* write anything left in zbuf */ + if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size) + png_write_chunk_data(png_ptr, png_ptr->zbuf, + png_ptr->zbuf_size - png_ptr->zstream.avail_out); + + /* reset zlib for another zTXt/iTXt or image data */ + deflateReset(&png_ptr->zstream); + png_ptr->zstream.data_type = Z_BINARY; +} +#endif + +/* Write the IHDR chunk, and update the png_struct with the necessary + * information. Note that the rest of this code depends upon this + * information being correct. + */ +void /* PRIVATE */ +png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, + int bit_depth, int color_type, int compression_type, int filter_type, + int interlace_type) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IHDR; +#endif + png_byte buf[13]; /* buffer to store the IHDR info */ + + png_debug(1, "in png_write_IHDR\n"); + /* Check that we have valid input data from the application info */ + switch (color_type) + { + case PNG_COLOR_TYPE_GRAY: + switch (bit_depth) + { + case 1: + case 2: + case 4: + case 8: + case 16: png_ptr->channels = 1; break; + default: png_error(png_ptr,"Invalid bit depth for grayscale image"); + } + break; + case PNG_COLOR_TYPE_RGB: + if (bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth for RGB image"); + png_ptr->channels = 3; + break; + case PNG_COLOR_TYPE_PALETTE: + switch (bit_depth) + { + case 1: + case 2: + case 4: + case 8: png_ptr->channels = 1; break; + default: png_error(png_ptr, "Invalid bit depth for paletted image"); + } + break; + case PNG_COLOR_TYPE_GRAY_ALPHA: + if (bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); + png_ptr->channels = 2; + break; + case PNG_COLOR_TYPE_RGB_ALPHA: + if (bit_depth != 8 && bit_depth != 16) + png_error(png_ptr, "Invalid bit depth for RGBA image"); + png_ptr->channels = 4; + break; + default: + png_error(png_ptr, "Invalid image color type specified"); + } + + if (compression_type != PNG_COMPRESSION_TYPE_BASE) + { + png_warning(png_ptr, "Invalid compression type specified"); + compression_type = PNG_COMPRESSION_TYPE_BASE; + } + + /* Write filter_method 64 (intrapixel differencing) only if + * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and + * 2. Libpng did not write a PNG signature (this filter_method is only + * used in PNG datastreams that are embedded in MNG datastreams) and + * 3. The application called png_permit_mng_features with a mask that + * included PNG_FLAG_MNG_FILTER_64 and + * 4. The filter_method is 64 and + * 5. The color_type is RGB or RGBA + */ + if ( +#if defined(PNG_MNG_FEATURES_SUPPORTED) + !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) && + (color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) && + (filter_type == PNG_INTRAPIXEL_DIFFERENCING)) && +#endif + filter_type != PNG_FILTER_TYPE_BASE) + { + png_warning(png_ptr, "Invalid filter type specified"); + filter_type = PNG_FILTER_TYPE_BASE; + } + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + if (interlace_type != PNG_INTERLACE_NONE && + interlace_type != PNG_INTERLACE_ADAM7) + { + png_warning(png_ptr, "Invalid interlace type specified"); + interlace_type = PNG_INTERLACE_ADAM7; + } +#else + interlace_type=PNG_INTERLACE_NONE; +#endif + + /* save off the relevent information */ + png_ptr->bit_depth = (png_byte)bit_depth; + png_ptr->color_type = (png_byte)color_type; + png_ptr->interlaced = (png_byte)interlace_type; +#if defined(PNG_MNG_FEATURES_SUPPORTED) + png_ptr->filter_type = (png_byte)filter_type; +#endif + png_ptr->compression_type = (png_byte)compression_type; + png_ptr->width = width; + png_ptr->height = height; + + png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels); + png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width); + /* set the usr info, so any transformations can modify it */ + png_ptr->usr_width = png_ptr->width; + png_ptr->usr_bit_depth = png_ptr->bit_depth; + png_ptr->usr_channels = png_ptr->channels; + + /* pack the header information into the buffer */ + png_save_uint_32(buf, width); + png_save_uint_32(buf + 4, height); + buf[8] = (png_byte)bit_depth; + buf[9] = (png_byte)color_type; + buf[10] = (png_byte)compression_type; + buf[11] = (png_byte)filter_type; + buf[12] = (png_byte)interlace_type; + + /* write the chunk */ + png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13); + + /* initialize zlib with PNG info */ + png_ptr->zstream.zalloc = png_zalloc; + png_ptr->zstream.zfree = png_zfree; + png_ptr->zstream.opaque = (voidpf)png_ptr; + if (!(png_ptr->do_filter)) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || + png_ptr->bit_depth < 8) + png_ptr->do_filter = PNG_FILTER_NONE; + else + png_ptr->do_filter = PNG_ALL_FILTERS; + } + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY)) + { + if (png_ptr->do_filter != PNG_FILTER_NONE) + png_ptr->zlib_strategy = Z_FILTERED; + else + png_ptr->zlib_strategy = Z_DEFAULT_STRATEGY; + } + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_LEVEL)) + png_ptr->zlib_level = Z_DEFAULT_COMPRESSION; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL)) + png_ptr->zlib_mem_level = 8; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS)) + png_ptr->zlib_window_bits = 15; + if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD)) + png_ptr->zlib_method = 8; + deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, + png_ptr->zlib_method, png_ptr->zlib_window_bits, + png_ptr->zlib_mem_level, png_ptr->zlib_strategy); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + /* libpng is not interested in zstream.data_type */ + /* set it to a predefined value, to avoid its evaluation inside zlib */ + png_ptr->zstream.data_type = Z_BINARY; + + png_ptr->mode = PNG_HAVE_IHDR; +} + +/* write the palette. We are careful not to trust png_color to be in the + * correct order for PNG, so people can redefine it to any convenient + * structure. + */ +void /* PRIVATE */ +png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_PLTE; +#endif + png_uint_32 i; + png_colorp pal_ptr; + png_byte buf[3]; + + png_debug(1, "in png_write_PLTE\n"); + if (( +#if defined(PNG_MNG_FEATURES_SUPPORTED) + !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && +#endif + num_pal == 0) || num_pal > 256) + { + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) + { + png_error(png_ptr, "Invalid number of colors in palette"); + } + else + { + png_warning(png_ptr, "Invalid number of colors in palette"); + return; + } + } + + if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) + { + png_warning(png_ptr, + "Ignoring request to write a PLTE chunk in grayscale PNG"); + return; + } + + png_ptr->num_palette = (png_uint_16)num_pal; + png_debug1(3, "num_palette = %d\n", png_ptr->num_palette); + + png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, num_pal * 3); +#ifndef PNG_NO_POINTER_INDEXING + for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) + { + buf[0] = pal_ptr->red; + buf[1] = pal_ptr->green; + buf[2] = pal_ptr->blue; + png_write_chunk_data(png_ptr, buf, (png_size_t)3); + } +#else + /* This is a little slower but some buggy compilers need to do this instead */ + pal_ptr=palette; + for (i = 0; i < num_pal; i++) + { + buf[0] = pal_ptr[i].red; + buf[1] = pal_ptr[i].green; + buf[2] = pal_ptr[i].blue; + png_write_chunk_data(png_ptr, buf, (png_size_t)3); + } +#endif + png_write_chunk_end(png_ptr); + png_ptr->mode |= PNG_HAVE_PLTE; +} + +/* write an IDAT chunk */ +void /* PRIVATE */ +png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IDAT; +#endif + png_debug(1, "in png_write_IDAT\n"); + + /* Optimize the CMF field in the zlib stream. */ + /* This hack of the zlib stream is compliant to the stream specification. */ + if (!(png_ptr->mode & PNG_HAVE_IDAT) && + png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE) + { + unsigned int z_cmf = data[0]; /* zlib compression method and flags */ + if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) + { + /* Avoid memory underflows and multiplication overflows. */ + /* The conditions below are practically always satisfied; + however, they still must be checked. */ + if (length >= 2 && + png_ptr->height < 16384 && png_ptr->width < 16384) + { + png_uint_32 uncompressed_idat_size = png_ptr->height * + ((png_ptr->width * + png_ptr->channels * png_ptr->bit_depth + 15) >> 3); + unsigned int z_cinfo = z_cmf >> 4; + unsigned int half_z_window_size = 1 << (z_cinfo + 7); + while (uncompressed_idat_size <= half_z_window_size && + half_z_window_size >= 256) + { + z_cinfo--; + half_z_window_size >>= 1; + } + z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4); + if (data[0] != (png_byte)z_cmf) + { + data[0] = (png_byte)z_cmf; + data[1] &= 0xe0; + data[1] += (png_byte)(0x1f - ((z_cmf << 8) + data[1]) % 0x1f); + } + } + } + else + png_error(png_ptr, + "Invalid zlib compression method or flags in IDAT"); + } + + png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); + png_ptr->mode |= PNG_HAVE_IDAT; +} + +/* write an IEND chunk */ +void /* PRIVATE */ +png_write_IEND(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_IEND; +#endif + png_debug(1, "in png_write_IEND\n"); + png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL, + (png_size_t)0); + png_ptr->mode |= PNG_HAVE_IEND; +} + +#if defined(PNG_WRITE_gAMA_SUPPORTED) +/* write a gAMA chunk */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +void /* PRIVATE */ +png_write_gAMA(png_structp png_ptr, double file_gamma) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_gAMA; +#endif + png_uint_32 igamma; + png_byte buf[4]; + + png_debug(1, "in png_write_gAMA\n"); + /* file_gamma is saved in 1/100,000ths */ + igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); + png_save_uint_32(buf, igamma); + png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +void /* PRIVATE */ +png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_gAMA; +#endif + png_byte buf[4]; + + png_debug(1, "in png_write_gAMA\n"); + /* file_gamma is saved in 1/100,000ths */ + png_save_uint_32(buf, (png_uint_32)file_gamma); + png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); +} +#endif +#endif + +#if defined(PNG_WRITE_sRGB_SUPPORTED) +/* write a sRGB chunk */ +void /* PRIVATE */ +png_write_sRGB(png_structp png_ptr, int srgb_intent) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_sRGB; +#endif + png_byte buf[1]; + + png_debug(1, "in png_write_sRGB\n"); + if(srgb_intent >= PNG_sRGB_INTENT_LAST) + png_warning(png_ptr, + "Invalid sRGB rendering intent specified"); + buf[0]=(png_byte)srgb_intent; + png_write_chunk(png_ptr, (png_bytep)png_sRGB, buf, (png_size_t)1); +} +#endif + +#if defined(PNG_WRITE_iCCP_SUPPORTED) +/* write an iCCP chunk */ +void /* PRIVATE */ +png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, + png_charp profile, int profile_len) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_iCCP; +#endif + png_size_t name_len; + png_charp new_name; + compression_state comp; + + png_debug(1, "in png_write_iCCP\n"); + if (name == NULL || (name_len = png_check_keyword(png_ptr, name, + &new_name)) == 0) + { + png_warning(png_ptr, "Empty keyword in iCCP chunk"); + return; + } + + if (compression_type != PNG_COMPRESSION_TYPE_BASE) + png_warning(png_ptr, "Unknown compression type in iCCP chunk"); + + if (profile == NULL) + profile_len = 0; + + if (profile_len) + profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len, + PNG_COMPRESSION_TYPE_BASE, &comp); + + /* make sure we include the NULL after the name and the compression type */ + png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, + (png_uint_32)name_len+profile_len+2); + new_name[name_len+1]=0x00; + png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 2); + + if (profile_len) + png_write_compressed_data_out(png_ptr, &comp); + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_name); +} +#endif + +#if defined(PNG_WRITE_sPLT_SUPPORTED) +/* write a sPLT chunk */ +void /* PRIVATE */ +png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_sPLT; +#endif + png_size_t name_len; + png_charp new_name; + png_byte entrybuf[10]; + int entry_size = (spalette->depth == 8 ? 6 : 10); + int palette_size = entry_size * spalette->nentries; + png_sPLT_entryp ep; +#ifdef PNG_NO_POINTER_INDEXING + int i; +#endif + + png_debug(1, "in png_write_sPLT\n"); + if (spalette->name == NULL || (name_len = png_check_keyword(png_ptr, + spalette->name, &new_name))==0) + { + png_warning(png_ptr, "Empty keyword in sPLT chunk"); + return; + } + + /* make sure we include the NULL after the name */ + png_write_chunk_start(png_ptr, (png_bytep)png_sPLT, + (png_uint_32)(name_len + 2 + palette_size)); + png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1); + png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1); + + /* loop through each palette entry, writing appropriately */ +#ifndef PNG_NO_POINTER_INDEXING + for (ep = spalette->entries; epentries+spalette->nentries; ep++) + { + if (spalette->depth == 8) + { + entrybuf[0] = (png_byte)ep->red; + entrybuf[1] = (png_byte)ep->green; + entrybuf[2] = (png_byte)ep->blue; + entrybuf[3] = (png_byte)ep->alpha; + png_save_uint_16(entrybuf + 4, ep->frequency); + } + else + { + png_save_uint_16(entrybuf + 0, ep->red); + png_save_uint_16(entrybuf + 2, ep->green); + png_save_uint_16(entrybuf + 4, ep->blue); + png_save_uint_16(entrybuf + 6, ep->alpha); + png_save_uint_16(entrybuf + 8, ep->frequency); + } + png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size); + } +#else + ep=spalette->entries; + for (i=0; i>spalette->nentries; i++) + { + if (spalette->depth == 8) + { + entrybuf[0] = (png_byte)ep[i].red; + entrybuf[1] = (png_byte)ep[i].green; + entrybuf[2] = (png_byte)ep[i].blue; + entrybuf[3] = (png_byte)ep[i].alpha; + png_save_uint_16(entrybuf + 4, ep[i].frequency); + } + else + { + png_save_uint_16(entrybuf + 0, ep[i].red); + png_save_uint_16(entrybuf + 2, ep[i].green); + png_save_uint_16(entrybuf + 4, ep[i].blue); + png_save_uint_16(entrybuf + 6, ep[i].alpha); + png_save_uint_16(entrybuf + 8, ep[i].frequency); + } + png_write_chunk_data(png_ptr, entrybuf, entry_size); + } +#endif + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_name); +} +#endif + +#if defined(PNG_WRITE_sBIT_SUPPORTED) +/* write the sBIT chunk */ +void /* PRIVATE */ +png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_sBIT; +#endif + png_byte buf[4]; + png_size_t size; + + png_debug(1, "in png_write_sBIT\n"); + /* make sure we don't depend upon the order of PNG_COLOR_8 */ + if (color_type & PNG_COLOR_MASK_COLOR) + { + png_byte maxbits; + + maxbits = (png_byte)(color_type==PNG_COLOR_TYPE_PALETTE ? 8 : + png_ptr->usr_bit_depth); + if (sbit->red == 0 || sbit->red > maxbits || + sbit->green == 0 || sbit->green > maxbits || + sbit->blue == 0 || sbit->blue > maxbits) + { + png_warning(png_ptr, "Invalid sBIT depth specified"); + return; + } + buf[0] = sbit->red; + buf[1] = sbit->green; + buf[2] = sbit->blue; + size = 3; + } + else + { + if (sbit->gray == 0 || sbit->gray > png_ptr->usr_bit_depth) + { + png_warning(png_ptr, "Invalid sBIT depth specified"); + return; + } + buf[0] = sbit->gray; + size = 1; + } + + if (color_type & PNG_COLOR_MASK_ALPHA) + { + if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth) + { + png_warning(png_ptr, "Invalid sBIT depth specified"); + return; + } + buf[size++] = sbit->alpha; + } + + png_write_chunk(png_ptr, (png_bytep)png_sBIT, buf, size); +} +#endif + +#if defined(PNG_WRITE_cHRM_SUPPORTED) +/* write the cHRM chunk */ +#ifdef PNG_FLOATING_POINT_SUPPORTED +void /* PRIVATE */ +png_write_cHRM(png_structp png_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) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_cHRM; +#endif + png_byte buf[32]; + png_uint_32 itemp; + + png_debug(1, "in png_write_cHRM\n"); + /* each value is saved in 1/100,000ths */ + if (white_x < 0 || white_x > 0.8 || white_y < 0 || white_y > 0.8 || + white_x + white_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM white point specified"); +#if !defined(PNG_NO_CONSOLE_IO) + fprintf(stderr,"white_x=%f, white_y=%f\n",white_x, white_y); +#endif + return; + } + itemp = (png_uint_32)(white_x * 100000.0 + 0.5); + png_save_uint_32(buf, itemp); + itemp = (png_uint_32)(white_y * 100000.0 + 0.5); + png_save_uint_32(buf + 4, itemp); + + if (red_x < 0 || red_x > 0.8 || red_y < 0 || red_y > 0.8 || + red_x + red_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM red point specified"); + return; + } + itemp = (png_uint_32)(red_x * 100000.0 + 0.5); + png_save_uint_32(buf + 8, itemp); + itemp = (png_uint_32)(red_y * 100000.0 + 0.5); + png_save_uint_32(buf + 12, itemp); + + if (green_x < 0 || green_x > 0.8 || green_y < 0 || green_y > 0.8 || + green_x + green_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM green point specified"); + return; + } + itemp = (png_uint_32)(green_x * 100000.0 + 0.5); + png_save_uint_32(buf + 16, itemp); + itemp = (png_uint_32)(green_y * 100000.0 + 0.5); + png_save_uint_32(buf + 20, itemp); + + if (blue_x < 0 || blue_x > 0.8 || blue_y < 0 || blue_y > 0.8 || + blue_x + blue_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM blue point specified"); + return; + } + itemp = (png_uint_32)(blue_x * 100000.0 + 0.5); + png_save_uint_32(buf + 24, itemp); + itemp = (png_uint_32)(blue_y * 100000.0 + 0.5); + png_save_uint_32(buf + 28, itemp); + + png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); +} +#endif +#ifdef PNG_FIXED_POINT_SUPPORTED +void /* PRIVATE */ +png_write_cHRM_fixed(png_structp png_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) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_cHRM; +#endif + png_byte buf[32]; + + png_debug(1, "in png_write_cHRM\n"); + /* each value is saved in 1/100,000ths */ + if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L) + { + png_warning(png_ptr, "Invalid fixed cHRM white point specified"); +#if !defined(PNG_NO_CONSOLE_IO) + fprintf(stderr,"white_x=%ld, white_y=%ld\n",white_x, white_y); +#endif + return; + } + png_save_uint_32(buf, (png_uint_32)white_x); + png_save_uint_32(buf + 4, (png_uint_32)white_y); + + if (red_x > 80000L || red_y > 80000L || red_x + red_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM fixed red point specified"); + return; + } + png_save_uint_32(buf + 8, (png_uint_32)red_x); + png_save_uint_32(buf + 12, (png_uint_32)red_y); + + if (green_x > 80000L || green_y > 80000L || green_x + green_y > 100000L) + { + png_warning(png_ptr, "Invalid fixed cHRM green point specified"); + return; + } + png_save_uint_32(buf + 16, (png_uint_32)green_x); + png_save_uint_32(buf + 20, (png_uint_32)green_y); + + if (blue_x > 80000L || blue_y > 80000L || blue_x + blue_y > 100000L) + { + png_warning(png_ptr, "Invalid fixed cHRM blue point specified"); + return; + } + png_save_uint_32(buf + 24, (png_uint_32)blue_x); + png_save_uint_32(buf + 28, (png_uint_32)blue_y); + + png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); +} +#endif +#endif + +#if defined(PNG_WRITE_tRNS_SUPPORTED) +/* write the tRNS chunk */ +void /* PRIVATE */ +png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, + int num_trans, int color_type) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_tRNS; +#endif + png_byte buf[6]; + + png_debug(1, "in png_write_tRNS\n"); + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) + { + png_warning(png_ptr,"Invalid number of transparent colors specified"); + return; + } + /* write the chunk out as it is */ + png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, (png_size_t)num_trans); + } + else if (color_type == PNG_COLOR_TYPE_GRAY) + { + /* one 16 bit value */ + if(tran->gray >= (1 << png_ptr->bit_depth)) + { + png_warning(png_ptr, + "Ignoring attempt to write tRNS chunk out-of-range for bit_depth"); + return; + } + png_save_uint_16(buf, tran->gray); + png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2); + } + else if (color_type == PNG_COLOR_TYPE_RGB) + { + /* three 16 bit values */ + png_save_uint_16(buf, tran->red); + png_save_uint_16(buf + 2, tran->green); + png_save_uint_16(buf + 4, tran->blue); + if(png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) + { + png_warning(png_ptr, + "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8"); + return; + } + png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6); + } + else + { + png_warning(png_ptr, "Can't write tRNS with an alpha channel"); + } +} +#endif + +#if defined(PNG_WRITE_bKGD_SUPPORTED) +/* write the background chunk */ +void /* PRIVATE */ +png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_bKGD; +#endif + png_byte buf[6]; + + png_debug(1, "in png_write_bKGD\n"); + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + if ( +#if defined(PNG_MNG_FEATURES_SUPPORTED) + (png_ptr->num_palette || + (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) && +#endif + back->index > png_ptr->num_palette) + { + png_warning(png_ptr, "Invalid background palette index"); + return; + } + buf[0] = back->index; + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)1); + } + else if (color_type & PNG_COLOR_MASK_COLOR) + { + png_save_uint_16(buf, back->red); + png_save_uint_16(buf + 2, back->green); + png_save_uint_16(buf + 4, back->blue); + if(png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) + { + png_warning(png_ptr, + "Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8"); + return; + } + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6); + } + else + { + if(back->gray >= (1 << png_ptr->bit_depth)) + { + png_warning(png_ptr, + "Ignoring attempt to write bKGD chunk out-of-range for bit_depth"); + return; + } + png_save_uint_16(buf, back->gray); + png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2); + } +} +#endif + +#if defined(PNG_WRITE_hIST_SUPPORTED) +/* write the histogram */ +void /* PRIVATE */ +png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_hIST; +#endif + int i; + png_byte buf[3]; + + png_debug(1, "in png_write_hIST\n"); + if (num_hist > (int)png_ptr->num_palette) + { + png_debug2(3, "num_hist = %d, num_palette = %d\n", num_hist, + png_ptr->num_palette); + png_warning(png_ptr, "Invalid number of histogram entries specified"); + return; + } + + png_write_chunk_start(png_ptr, (png_bytep)png_hIST, (png_uint_32)(num_hist * 2)); + for (i = 0; i < num_hist; i++) + { + png_save_uint_16(buf, hist[i]); + png_write_chunk_data(png_ptr, buf, (png_size_t)2); + } + png_write_chunk_end(png_ptr); +} +#endif + +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ + defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) +/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification, + * and if invalid, correct the keyword rather than discarding the entire + * chunk. The PNG 1.0 specification requires keywords 1-79 characters in + * length, forbids leading or trailing whitespace, multiple internal spaces, + * and the non-break space (0x80) from ISO 8859-1. Returns keyword length. + * + * The new_key is allocated to hold the corrected keyword and must be freed + * by the calling routine. This avoids problems with trying to write to + * static keywords without having to have duplicate copies of the strings. + */ +png_size_t /* PRIVATE */ +png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) +{ + png_size_t key_len; + png_charp kp, dp; + int kflag; + int kwarn=0; + + png_debug(1, "in png_check_keyword\n"); + *new_key = NULL; + + if (key == NULL || (key_len = png_strlen(key)) == 0) + { + png_warning(png_ptr, "zero length keyword"); + return ((png_size_t)0); + } + + png_debug1(2, "Keyword to be checked is '%s'\n", key); + + *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2)); + if (*new_key == NULL) + { + png_warning(png_ptr, "Out of memory while procesing keyword"); + return ((png_size_t)0); + } + + /* Replace non-printing characters with a blank and print a warning */ + for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++) + { + if (*kp < 0x20 || (*kp > 0x7E && (png_byte)*kp < 0xA1)) + { +#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) + char msg[40]; + + sprintf(msg, "invalid keyword character 0x%02X", *kp); + png_warning(png_ptr, msg); +#else + png_warning(png_ptr, "invalid character in keyword"); +#endif + *dp = ' '; + } + else + { + *dp = *kp; + } + } + *dp = '\0'; + + /* Remove any trailing white space. */ + kp = *new_key + key_len - 1; + if (*kp == ' ') + { + png_warning(png_ptr, "trailing spaces removed from keyword"); + + while (*kp == ' ') + { + *(kp--) = '\0'; + key_len--; + } + } + + /* Remove any leading white space. */ + kp = *new_key; + if (*kp == ' ') + { + png_warning(png_ptr, "leading spaces removed from keyword"); + + while (*kp == ' ') + { + kp++; + key_len--; + } + } + + png_debug1(2, "Checking for multiple internal spaces in '%s'\n", kp); + + /* Remove multiple internal spaces. */ + for (kflag = 0, dp = *new_key; *kp != '\0'; kp++) + { + if (*kp == ' ' && kflag == 0) + { + *(dp++) = *kp; + kflag = 1; + } + else if (*kp == ' ') + { + key_len--; + kwarn=1; + } + else + { + *(dp++) = *kp; + kflag = 0; + } + } + *dp = '\0'; + if(kwarn) + png_warning(png_ptr, "extra interior spaces removed from keyword"); + + if (key_len == 0) + { + png_free(png_ptr, *new_key); + *new_key=NULL; + png_warning(png_ptr, "Zero length keyword"); + } + + if (key_len > 79) + { + png_warning(png_ptr, "keyword length must be 1 - 79 characters"); + new_key[79] = '\0'; + key_len = 79; + } + + return (key_len); +} +#endif + +#if defined(PNG_WRITE_tEXt_SUPPORTED) +/* write a tEXt chunk */ +void /* PRIVATE */ +png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, + png_size_t text_len) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_tEXt; +#endif + png_size_t key_len; + png_charp new_key; + + png_debug(1, "in png_write_tEXt\n"); + if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) + { + png_warning(png_ptr, "Empty keyword in tEXt chunk"); + return; + } + + if (text == NULL || *text == '\0') + text_len = 0; + else + text_len = png_strlen(text); + + /* make sure we include the 0 after the key */ + png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, (png_uint_32)key_len+text_len+1); + /* + * We leave it to the application to meet PNG-1.0 requirements on the + * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of + * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. + * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. + */ + png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); + if (text_len) + png_write_chunk_data(png_ptr, (png_bytep)text, text_len); + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_key); +} +#endif + +#if defined(PNG_WRITE_zTXt_SUPPORTED) +/* write a compressed text chunk */ +void /* PRIVATE */ +png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, + png_size_t text_len, int compression) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_zTXt; +#endif + png_size_t key_len; + char buf[1]; + png_charp new_key; + compression_state comp; + + png_debug(1, "in png_write_zTXt\n"); + + if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) + { + png_warning(png_ptr, "Empty keyword in zTXt chunk"); + return; + } + + if (text == NULL || *text == '\0' || compression==PNG_TEXT_COMPRESSION_NONE) + { + png_write_tEXt(png_ptr, new_key, text, (png_size_t)0); + png_free(png_ptr, new_key); + return; + } + + text_len = png_strlen(text); + + png_free(png_ptr, new_key); + + /* compute the compressed data; do it now for the length */ + text_len = png_text_compress(png_ptr, text, text_len, compression, + &comp); + + /* write start of chunk */ + png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32) + (key_len+text_len+2)); + /* write key */ + png_write_chunk_data(png_ptr, (png_bytep)key, key_len + 1); + buf[0] = (png_byte)compression; + /* write compression */ + png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1); + /* write the compressed data */ + png_write_compressed_data_out(png_ptr, &comp); + + /* close the chunk */ + png_write_chunk_end(png_ptr); +} +#endif + +#if defined(PNG_WRITE_iTXt_SUPPORTED) +/* write an iTXt chunk */ +void /* PRIVATE */ +png_write_iTXt(png_structp png_ptr, int compression, png_charp key, + png_charp lang, png_charp lang_key, png_charp text) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_iTXt; +#endif + png_size_t lang_len, key_len, lang_key_len, text_len; + png_charp new_lang, new_key; + png_byte cbuf[2]; + compression_state comp; + + png_debug(1, "in png_write_iTXt\n"); + + if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) + { + png_warning(png_ptr, "Empty keyword in iTXt chunk"); + return; + } + if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0) + { + png_warning(png_ptr, "Empty language field in iTXt chunk"); + new_lang = NULL; + lang_len = 0; + } + + if (lang_key == NULL) + lang_key_len = 0; + else + lang_key_len = png_strlen(lang_key); + + if (text == NULL) + text_len = 0; + else + text_len = png_strlen(text); + + /* compute the compressed data; do it now for the length */ + text_len = png_text_compress(png_ptr, text, text_len, compression-2, + &comp); + + + /* make sure we include the compression flag, the compression byte, + * and the NULs after the key, lang, and lang_key parts */ + + png_write_chunk_start(png_ptr, (png_bytep)png_iTXt, + (png_uint_32)( + 5 /* comp byte, comp flag, terminators for key, lang and lang_key */ + + key_len + + lang_len + + lang_key_len + + text_len)); + + /* + * We leave it to the application to meet PNG-1.0 requirements on the + * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of + * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. + * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. + */ + png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); + + /* set the compression flag */ + if (compression == PNG_ITXT_COMPRESSION_NONE || \ + compression == PNG_TEXT_COMPRESSION_NONE) + cbuf[0] = 0; + else /* compression == PNG_ITXT_COMPRESSION_zTXt */ + cbuf[0] = 1; + /* set the compression method */ + cbuf[1] = 0; + png_write_chunk_data(png_ptr, cbuf, 2); + + cbuf[0] = 0; + png_write_chunk_data(png_ptr, (new_lang ? (png_bytep)new_lang : cbuf), lang_len + 1); + png_write_chunk_data(png_ptr, (lang_key ? (png_bytep)lang_key : cbuf), lang_key_len + 1); + png_write_compressed_data_out(png_ptr, &comp); + + png_write_chunk_end(png_ptr); + png_free(png_ptr, new_key); + if (new_lang) + png_free(png_ptr, new_lang); +} +#endif + +#if defined(PNG_WRITE_oFFs_SUPPORTED) +/* write the oFFs chunk */ +void /* PRIVATE */ +png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, + int unit_type) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_oFFs; +#endif + png_byte buf[9]; + + png_debug(1, "in png_write_oFFs\n"); + if (unit_type >= PNG_OFFSET_LAST) + png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); + + png_save_int_32(buf, x_offset); + png_save_int_32(buf + 4, y_offset); + buf[8] = (png_byte)unit_type; + + png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9); +} +#endif + +#if defined(PNG_WRITE_pCAL_SUPPORTED) +/* write the pCAL chunk (described in the PNG extensions document) */ +void /* PRIVATE */ +png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, + png_int_32 X1, int type, int nparams, png_charp units, png_charpp params) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_pCAL; +#endif + png_size_t purpose_len, units_len, total_len; + png_uint_32p params_len; + png_byte buf[10]; + png_charp new_purpose; + int i; + + png_debug1(1, "in png_write_pCAL (%d parameters)\n", nparams); + if (type >= PNG_EQUATION_LAST) + png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); + + purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1; + png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len); + units_len = png_strlen(units) + (nparams == 0 ? 0 : 1); + png_debug1(3, "pCAL units length = %d\n", (int)units_len); + total_len = purpose_len + units_len + 10; + + params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams + *png_sizeof(png_uint_32))); + + /* Find the length of each parameter, making sure we don't count the + null terminator for the last parameter. */ + for (i = 0; i < nparams; i++) + { + params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1); + png_debug2(3, "pCAL parameter %d length = %lu\n", i, params_len[i]); + total_len += (png_size_t)params_len[i]; + } + + png_debug1(3, "pCAL total length = %d\n", (int)total_len); + png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len); + png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len); + png_save_int_32(buf, X0); + png_save_int_32(buf + 4, X1); + buf[8] = (png_byte)type; + buf[9] = (png_byte)nparams; + png_write_chunk_data(png_ptr, buf, (png_size_t)10); + png_write_chunk_data(png_ptr, (png_bytep)units, (png_size_t)units_len); + + png_free(png_ptr, new_purpose); + + for (i = 0; i < nparams; i++) + { + png_write_chunk_data(png_ptr, (png_bytep)params[i], + (png_size_t)params_len[i]); + } + + png_free(png_ptr, params_len); + png_write_chunk_end(png_ptr); +} +#endif + +#if defined(PNG_WRITE_sCAL_SUPPORTED) +/* write the sCAL chunk */ +#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) +void /* PRIVATE */ +png_write_sCAL(png_structp png_ptr, int unit, double width,double height) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_sCAL; +#endif + png_size_t total_len; + char wbuf[32], hbuf[32]; + png_byte bunit = unit; + + png_debug(1, "in png_write_sCAL\n"); + +#if defined(_WIN32_WCE) +/* sprintf() function is not supported on WindowsCE */ + { + wchar_t wc_buf[32]; + swprintf(wc_buf, TEXT("%12.12e"), width); + WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, wbuf, 32, NULL, NULL); + swprintf(wc_buf, TEXT("%12.12e"), height); + WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, hbuf, 32, NULL, NULL); + } +#else + sprintf(wbuf, "%12.12e", width); + sprintf(hbuf, "%12.12e", height); +#endif + total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf); + + png_debug1(3, "sCAL total length = %d\n", (int)total_len); + png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len); + png_write_chunk_data(png_ptr, (png_bytep)&bunit, 1); + png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1); + png_write_chunk_data(png_ptr, (png_bytep)hbuf, png_strlen(hbuf)); + + png_write_chunk_end(png_ptr); +} +#else +#ifdef PNG_FIXED_POINT_SUPPORTED +void /* PRIVATE */ +png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width, + png_charp height) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_sCAL; +#endif + png_size_t total_len; + char wbuf[32], hbuf[32]; + png_byte bunit = unit; + + png_debug(1, "in png_write_sCAL_s\n"); + + png_strcpy(wbuf,(const char *)width); + png_strcpy(hbuf,(const char *)height); + total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf); + + png_debug1(3, "sCAL total length = %d\n", total_len); + png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len); + png_write_chunk_data(png_ptr, (png_bytep)&bunit, 1); + png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1); + png_write_chunk_data(png_ptr, (png_bytep)hbuf, png_strlen(hbuf)); + + png_write_chunk_end(png_ptr); +} +#endif +#endif +#endif + +#if defined(PNG_WRITE_pHYs_SUPPORTED) +/* write the pHYs chunk */ +void /* PRIVATE */ +png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, + png_uint_32 y_pixels_per_unit, + int unit_type) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_pHYs; +#endif + png_byte buf[9]; + + png_debug(1, "in png_write_pHYs\n"); + if (unit_type >= PNG_RESOLUTION_LAST) + png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); + + png_save_uint_32(buf, x_pixels_per_unit); + png_save_uint_32(buf + 4, y_pixels_per_unit); + buf[8] = (png_byte)unit_type; + + png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9); +} +#endif + +#if defined(PNG_WRITE_tIME_SUPPORTED) +/* Write the tIME chunk. Use either png_convert_from_struct_tm() + * or png_convert_from_time_t(), or fill in the structure yourself. + */ +void /* PRIVATE */ +png_write_tIME(png_structp png_ptr, png_timep mod_time) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + PNG_tIME; +#endif + png_byte buf[7]; + + png_debug(1, "in png_write_tIME\n"); + if (mod_time->month > 12 || mod_time->month < 1 || + mod_time->day > 31 || mod_time->day < 1 || + mod_time->hour > 23 || mod_time->second > 60) + { + png_warning(png_ptr, "Invalid time specified for tIME chunk"); + return; + } + + png_save_uint_16(buf, mod_time->year); + buf[2] = mod_time->month; + buf[3] = mod_time->day; + buf[4] = mod_time->hour; + buf[5] = mod_time->minute; + buf[6] = mod_time->second; + + png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7); +} +#endif + +/* initializes the row writing capability of libpng */ +void /* PRIVATE */ +png_write_start_row(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + png_size_t buf_size; + + png_debug(1, "in png_write_start_row\n"); + buf_size = (png_size_t)(PNG_ROWBYTES( + png_ptr->usr_channels*png_ptr->usr_bit_depth,png_ptr->width)+1); + + /* set up row buffer */ + png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); + png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; + + /* set up filtering buffer, if using this filter */ + if (png_ptr->do_filter & PNG_FILTER_SUB) + { + png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; + } + + /* We only need to keep the previous row if we are using one of these. */ + if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) + { + /* set up previous row buffer */ + png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); + png_memset(png_ptr->prev_row, 0, buf_size); + + if (png_ptr->do_filter & PNG_FILTER_UP) + { + png_ptr->up_row = (png_bytep )png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; + } + + if (png_ptr->do_filter & PNG_FILTER_AVG) + { + png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; + } + + if (png_ptr->do_filter & PNG_FILTER_PAETH) + { + png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr, + (png_ptr->rowbytes + 1)); + png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; + } + } + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* if interlaced, we need to set up width and height of pass */ + if (png_ptr->interlaced) + { + if (!(png_ptr->transformations & PNG_INTERLACE)) + { + png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 - + png_pass_ystart[0]) / png_pass_yinc[0]; + png_ptr->usr_width = (png_ptr->width + png_pass_inc[0] - 1 - + png_pass_start[0]) / png_pass_inc[0]; + } + else + { + png_ptr->num_rows = png_ptr->height; + png_ptr->usr_width = png_ptr->width; + } + } + else +#endif + { + png_ptr->num_rows = png_ptr->height; + png_ptr->usr_width = png_ptr->width; + } + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + png_ptr->zstream.next_out = png_ptr->zbuf; +} + +/* Internal use only. Called when finished processing a row of data. */ +void /* PRIVATE */ +png_write_finish_row(png_structp png_ptr) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + + /* start of interlace block in the y direction */ + int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; + + /* offset to next interlace block in the y direction */ + int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif + + int ret; + + png_debug(1, "in png_write_finish_row\n"); + /* next row */ + png_ptr->row_number++; + + /* see if we are done */ + if (png_ptr->row_number < png_ptr->num_rows) + return; + +#ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* if interlaced, go to next pass */ + if (png_ptr->interlaced) + { + png_ptr->row_number = 0; + if (png_ptr->transformations & PNG_INTERLACE) + { + png_ptr->pass++; + } + else + { + /* loop until we find a non-zero width or height pass */ + do + { + png_ptr->pass++; + if (png_ptr->pass >= 7) + break; + png_ptr->usr_width = (png_ptr->width + + png_pass_inc[png_ptr->pass] - 1 - + png_pass_start[png_ptr->pass]) / + png_pass_inc[png_ptr->pass]; + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[png_ptr->pass] - 1 - + png_pass_ystart[png_ptr->pass]) / + png_pass_yinc[png_ptr->pass]; + if (png_ptr->transformations & PNG_INTERLACE) + break; + } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0); + + } + + /* reset the row above the image for the next pass */ + if (png_ptr->pass < 7) + { + if (png_ptr->prev_row != NULL) + png_memset(png_ptr->prev_row, 0, + (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels* + png_ptr->usr_bit_depth,png_ptr->width))+1); + return; + } + } +#endif + + /* if we get here, we've just written the last row, so we need + to flush the compressor */ + do + { + /* tell the compressor we are done */ + ret = deflate(&png_ptr->zstream, Z_FINISH); + /* check for an error */ + if (ret == Z_OK) + { + /* check to see if we need more room */ + if (!(png_ptr->zstream.avail_out)) + { + png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + } + else if (ret != Z_STREAM_END) + { + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + } while (ret != Z_STREAM_END); + + /* write any extra space */ + if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) + { + png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size - + png_ptr->zstream.avail_out); + } + + deflateReset(&png_ptr->zstream); + png_ptr->zstream.data_type = Z_BINARY; +} + +#if defined(PNG_WRITE_INTERLACING_SUPPORTED) +/* Pick out the correct pixels for the interlace pass. + * The basic idea here is to go through the row with a source + * pointer and a destination pointer (sp and dp), and copy the + * correct pixels for the pass. As the row gets compacted, + * sp will always be >= dp, so we should never overwrite anything. + * See the default: case for the easiest code to understand. + */ +void /* PRIVATE */ +png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) +{ +#ifdef PNG_USE_LOCAL_ARRAYS + /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ + + /* start of interlace block */ + int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; + + /* offset to next interlace block */ + int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; +#endif + + png_debug(1, "in png_do_write_interlace\n"); + /* we don't have to do anything on the last pass (6) */ +#if defined(PNG_USELESS_TESTS_SUPPORTED) + if (row != NULL && row_info != NULL && pass < 6) +#else + if (pass < 6) +#endif + { + /* each pixel depth is handled separately */ + switch (row_info->pixel_depth) + { + case 1: + { + png_bytep sp; + png_bytep dp; + int shift; + int d; + int value; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + dp = row; + d = 0; + shift = 7; + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + sp = row + (png_size_t)(i >> 3); + value = (int)(*sp >> (7 - (int)(i & 0x07))) & 0x01; + d |= (value << shift); + + if (shift == 0) + { + shift = 7; + *dp++ = (png_byte)d; + d = 0; + } + else + shift--; + + } + if (shift != 7) + *dp = (png_byte)d; + break; + } + case 2: + { + png_bytep sp; + png_bytep dp; + int shift; + int d; + int value; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + dp = row; + shift = 6; + d = 0; + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + sp = row + (png_size_t)(i >> 2); + value = (*sp >> ((3 - (int)(i & 0x03)) << 1)) & 0x03; + d |= (value << shift); + + if (shift == 0) + { + shift = 6; + *dp++ = (png_byte)d; + d = 0; + } + else + shift -= 2; + } + if (shift != 6) + *dp = (png_byte)d; + break; + } + case 4: + { + png_bytep sp; + png_bytep dp; + int shift; + int d; + int value; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + + dp = row; + shift = 4; + d = 0; + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + sp = row + (png_size_t)(i >> 1); + value = (*sp >> ((1 - (int)(i & 0x01)) << 2)) & 0x0f; + d |= (value << shift); + + if (shift == 0) + { + shift = 4; + *dp++ = (png_byte)d; + d = 0; + } + else + shift -= 4; + } + if (shift != 4) + *dp = (png_byte)d; + break; + } + default: + { + png_bytep sp; + png_bytep dp; + png_uint_32 i; + png_uint_32 row_width = row_info->width; + png_size_t pixel_bytes; + + /* start at the beginning */ + dp = row; + /* find out how many bytes each pixel takes up */ + pixel_bytes = (row_info->pixel_depth >> 3); + /* loop through the row, only looking at the pixels that + matter */ + for (i = png_pass_start[pass]; i < row_width; + i += png_pass_inc[pass]) + { + /* find out where the original pixel is */ + sp = row + (png_size_t)i * pixel_bytes; + /* move the pixel */ + if (dp != sp) + png_memcpy(dp, sp, pixel_bytes); + /* next pixel */ + dp += pixel_bytes; + } + break; + } + } + /* set new row width */ + row_info->width = (row_info->width + + png_pass_inc[pass] - 1 - + png_pass_start[pass]) / + png_pass_inc[pass]; + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, + row_info->width); + } +} +#endif + +/* This filters the row, chooses which filter to use, if it has not already + * been specified by the application, and then writes the row out with the + * chosen filter. + */ +#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1) +#define PNG_HISHIFT 10 +#define PNG_LOMASK ((png_uint_32)0xffffL) +#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT)) +void /* PRIVATE */ +png_write_find_filter(png_structp png_ptr, png_row_infop row_info) +{ + png_bytep prev_row, best_row, row_buf; + png_uint_32 mins, bpp; + png_byte filter_to_do = png_ptr->do_filter; + png_uint_32 row_bytes = row_info->rowbytes; +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + int num_p_filters = (int)png_ptr->num_prev_filters; +#endif + + png_debug(1, "in png_write_find_filter\n"); + /* find out how many bytes offset each pixel is */ + bpp = (row_info->pixel_depth + 7) >> 3; + + prev_row = png_ptr->prev_row; + best_row = row_buf = png_ptr->row_buf; + mins = PNG_MAXSUM; + + /* The prediction method we use is to find which method provides the + * smallest value when summing the absolute values of the distances + * from zero, using anything >= 128 as negative numbers. This is known + * as the "minimum sum of absolute differences" heuristic. Other + * heuristics are the "weighted minimum sum of absolute differences" + * (experimental and can in theory improve compression), and the "zlib + * predictive" method (not implemented yet), which does test compressions + * of lines using different filter methods, and then chooses the + * (series of) filter(s) that give minimum compressed data size (VERY + * computationally expensive). + * + * GRR 980525: consider also + * (1) minimum sum of absolute differences from running average (i.e., + * keep running sum of non-absolute differences & count of bytes) + * [track dispersion, too? restart average if dispersion too large?] + * (1b) minimum sum of absolute differences from sliding average, probably + * with window size <= deflate window (usually 32K) + * (2) minimum sum of squared differences from zero or running average + * (i.e., ~ root-mean-square approach) + */ + + + /* We don't need to test the 'no filter' case if this is the only filter + * that has been chosen, as it doesn't actually do anything to the data. + */ + if ((filter_to_do & PNG_FILTER_NONE) && + filter_to_do != PNG_FILTER_NONE) + { + png_bytep rp; + png_uint_32 sum = 0; + png_uint_32 i; + int v; + + for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++) + { + v = *rp; + sum += (v < 128) ? v : 256 - v; + } + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + png_uint_32 sumhi, sumlo; + int j; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */ + + /* Reduce the sum if we match any of the previous rows */ + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + /* Factor in the cost of this filter (this is here for completeness, + * but it makes no sense to have a "cost" for the NONE filter, as + * it has the minimum possible computational cost - none). + */ + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + mins = sum; + } + + /* sub filter */ + if (filter_to_do == PNG_FILTER_SUB) + /* it's the only filter so no testing is needed */ + { + png_bytep rp, lp, dp; + png_uint_32 i; + for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; + i++, rp++, dp++) + { + *dp = *rp; + } + for (lp = row_buf + 1; i < row_bytes; + i++, rp++, lp++, dp++) + { + *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); + } + best_row = png_ptr->sub_row; + } + + else if (filter_to_do & PNG_FILTER_SUB) + { + png_bytep rp, dp, lp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + /* We temporarily increase the "minimum sum" by the factor we + * would reduce the sum of this filter, so that we can do the + * early exit comparison without scaling the sum each time. + */ + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; + i++, rp++, dp++) + { + v = *dp = *rp; + + sum += (v < 128) ? v : 256 - v; + } + for (lp = row_buf + 1; i < row_bytes; + i++, rp++, lp++, dp++) + { + v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB) + { + sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + mins = sum; + best_row = png_ptr->sub_row; + } + } + + /* up filter */ + if (filter_to_do == PNG_FILTER_UP) + { + png_bytep rp, dp, pp; + png_uint_32 i; + + for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, + pp = prev_row + 1; i < row_bytes; + i++, rp++, pp++, dp++) + { + *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff); + } + best_row = png_ptr->up_row; + } + + else if (filter_to_do & PNG_FILTER_UP) + { + png_bytep rp, dp, pp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, + pp = prev_row + 1; i < row_bytes; i++) + { + v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + mins = sum; + best_row = png_ptr->up_row; + } + } + + /* avg filter */ + if (filter_to_do == PNG_FILTER_AVG) + { + png_bytep rp, dp, pp, lp; + png_uint_32 i; + for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); + } + for (lp = row_buf + 1; i < row_bytes; i++) + { + *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) + & 0xff); + } + best_row = png_ptr->avg_row; + } + + else if (filter_to_do & PNG_FILTER_AVG) + { + png_bytep rp, dp, pp, lp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); + + sum += (v < 128) ? v : 256 - v; + } + for (lp = row_buf + 1; i < row_bytes; i++) + { + v = *dp++ = + (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + mins = sum; + best_row = png_ptr->avg_row; + } + } + + /* Paeth filter */ + if (filter_to_do == PNG_FILTER_PAETH) + { + png_bytep rp, dp, pp, cp, lp; + png_uint_32 i; + for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); + } + + for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++) + { + int a, b, c, pa, pb, pc, p; + + b = *pp++; + c = *cp++; + a = *lp++; + + p = b - c; + pc = a - c; + +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + + p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; + + *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); + } + best_row = png_ptr->paeth_row; + } + + else if (filter_to_do & PNG_FILTER_PAETH) + { + png_bytep rp, dp, pp, cp, lp; + png_uint_32 sum = 0, lmins = mins; + png_uint_32 i; + int v; + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 lmhi, lmlo; + lmlo = lmins & PNG_LOMASK; + lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH) + { + lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + + if (lmhi > PNG_HIMASK) + lmins = PNG_MAXSUM; + else + lmins = (lmhi << PNG_HISHIFT) + lmlo; + } +#endif + + for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, + pp = prev_row + 1; i < bpp; i++) + { + v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); + + sum += (v < 128) ? v : 256 - v; + } + + for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++) + { + int a, b, c, pa, pb, pc, p; + + b = *pp++; + c = *cp++; + a = *lp++; + +#ifndef PNG_SLOW_PAETH + p = b - c; + pc = a - c; +#ifdef PNG_USE_ABS + pa = abs(p); + pb = abs(pc); + pc = abs(p + pc); +#else + pa = p < 0 ? -p : p; + pb = pc < 0 ? -pc : pc; + pc = (p + pc) < 0 ? -(p + pc) : p + pc; +#endif + p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; +#else /* PNG_SLOW_PAETH */ + p = a + b - c; + pa = abs(p - a); + pb = abs(p - b); + pc = abs(p - c); + if (pa <= pb && pa <= pc) + p = a; + else if (pb <= pc) + p = b; + else + p = c; +#endif /* PNG_SLOW_PAETH */ + + v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); + + sum += (v < 128) ? v : 256 - v; + + if (sum > lmins) /* We are already worse, don't continue. */ + break; + } + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) + { + int j; + png_uint_32 sumhi, sumlo; + sumlo = sum & PNG_LOMASK; + sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; + + for (j = 0; j < num_p_filters; j++) + { + if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH) + { + sumlo = (sumlo * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + sumhi = (sumhi * png_ptr->filter_weights[j]) >> + PNG_WEIGHT_SHIFT; + } + } + + sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >> + PNG_COST_SHIFT; + + if (sumhi > PNG_HIMASK) + sum = PNG_MAXSUM; + else + sum = (sumhi << PNG_HISHIFT) + sumlo; + } +#endif + + if (sum < mins) + { + best_row = png_ptr->paeth_row; + } + } + + /* Do the actual writing of the filtered row data from the chosen filter. */ + + png_write_filtered_row(png_ptr, best_row); + +#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) + /* Save the type of filter we picked this time for future calculations */ + if (png_ptr->num_prev_filters > 0) + { + int j; + for (j = 1; j < num_p_filters; j++) + { + png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1]; + } + png_ptr->prev_filters[j] = best_row[0]; + } +#endif +} + + +/* Do the actual writing of a previously filtered row. */ +void /* PRIVATE */ +png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) +{ + png_debug(1, "in png_write_filtered_row\n"); + png_debug1(2, "filter = %d\n", filtered_row[0]); + /* set up the zlib input buffer */ + + png_ptr->zstream.next_in = filtered_row; + png_ptr->zstream.avail_in = (uInt)png_ptr->row_info.rowbytes + 1; + /* repeat until we have compressed all the data */ + do + { + int ret; /* return of zlib */ + + /* compress the data */ + ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); + /* check for compression errors */ + if (ret != Z_OK) + { + if (png_ptr->zstream.msg != NULL) + png_error(png_ptr, png_ptr->zstream.msg); + else + png_error(png_ptr, "zlib error"); + } + + /* see if it is time to write another IDAT */ + if (!(png_ptr->zstream.avail_out)) + { + /* write the IDAT and reset the zlib output buffer */ + png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + /* repeat until all data has been compressed */ + } while (png_ptr->zstream.avail_in); + + /* swap the current and previous rows */ + if (png_ptr->prev_row != NULL) + { + png_bytep tptr; + + tptr = png_ptr->prev_row; + png_ptr->prev_row = png_ptr->row_buf; + png_ptr->row_buf = tptr; + } + + /* finish row - updates counters and flushes zlib if last row */ + png_write_finish_row(png_ptr); + +#if defined(PNG_WRITE_FLUSH_SUPPORTED) + png_ptr->flush_rows++; + + if (png_ptr->flush_dist > 0 && + png_ptr->flush_rows >= png_ptr->flush_dist) + { + png_write_flush(png_ptr); + } +#endif +} +#endif /* PNG_WRITE_SUPPORTED */ diff --git a/src/SFML/Graphics/zlib/adler32.c b/src/SFML/Graphics/zlib/adler32.c new file mode 100644 index 00000000..f201d670 --- /dev/null +++ b/src/SFML/Graphics/zlib/adler32.c @@ -0,0 +1,149 @@ +/* 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$ */ + +#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); +} diff --git a/src/SFML/Graphics/zlib/compress.c b/src/SFML/Graphics/zlib/compress.c new file mode 100644 index 00000000..d37e84f5 --- /dev/null +++ b/src/SFML/Graphics/zlib/compress.c @@ -0,0 +1,79 @@ +/* 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$ */ + +#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; +} diff --git a/src/SFML/Graphics/zlib/crc32.c b/src/SFML/Graphics/zlib/crc32.c new file mode 100644 index 00000000..32814c20 --- /dev/null +++ b/src/SFML/Graphics/zlib/crc32.c @@ -0,0 +1,423 @@ +/* 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 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$ */ + +/* + 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 +# 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 +# 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; +} diff --git a/src/SFML/Graphics/zlib/crc32.h b/src/SFML/Graphics/zlib/crc32.h new file mode 100644 index 00000000..5de49bc9 --- /dev/null +++ b/src/SFML/Graphics/zlib/crc32.h @@ -0,0 +1,441 @@ +/* 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 + } +}; diff --git a/src/SFML/Graphics/zlib/deflate.c b/src/SFML/Graphics/zlib/deflate.c new file mode 100644 index 00000000..529f716b --- /dev/null +++ b/src/SFML/Graphics/zlib/deflate.c @@ -0,0 +1,1736 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://www.ietf.org/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id$ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifndef FASTEST +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif +#endif +local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +#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. + */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->gzhead = Z_NULL; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; + + s = strm->state; + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > MAX_DIST(s)) { + length = MAX_DIST(s); + dictionary += dictLength - length; /* use the tail of the dictionary */ + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if (func != configuration_table[level].func && strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_PARTIAL_FLUSH); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds + * for every combination of windowBits and memLevel, as well as wrap. + * But even the conservative upper bound of about 14% expansion does not + * seem onerous for output buffer allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong destLen; + + /* conservative upper bound */ + destLen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; + + /* if can't get parameters, return conservative bound */ + if (strm == Z_NULL || strm->state == Z_NULL) + return destLen; + + /* if not default parameters, return conservative bound */ + s = strm->state; + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return destLen; + + /* default settings: return tight bound for that case */ + return compressBound(sourceLen); +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_FINISH || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = (*(configuration_table[s->level].func))(s, flush); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + zmemcpy(dest, source, sizeof(z_stream)); + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + zmemcpy(ds, ss, sizeof(deflate_state)); + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifndef FASTEST +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ +#endif /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for level == 1 or strategy == Z_RLE only + */ +local uInt longest_match_fast(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + /* %%% avoid this when Z_RLE */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, eof) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (eof)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, eof) { \ + FLUSH_BLOCK_ONLY(s, eof); \ + if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head = NIL; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ +#ifdef FASTEST + if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) || + (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { + s->match_length = longest_match_fast (s, hash_head); + } +#else + if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { + s->match_length = longest_match (s, hash_head); + } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { + s->match_length = longest_match_fast (s, hash_head); + } +#endif + /* longest_match() or longest_match_fast() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head = NIL; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { + s->match_length = longest_match (s, hash_head); + } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { + s->match_length = longest_match_fast (s, hash_head); + } + /* longest_match() or longest_match_fast() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif /* FASTEST */ + +#if 0 +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt run; /* length of run */ + uInt max; /* maximum length of run */ + uInt prev; /* byte at distance one to match */ + Bytef *scan; /* scan for end of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest encodable run. + */ + if (s->lookahead < MAX_MATCH) { + fill_window(s); + if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + run = 0; + if (s->strstart > 0) { /* if there is a previous byte, that is */ + max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; + scan = s->window + s->strstart - 1; + prev = *scan++; + do { + if (*scan++ != prev) + break; + } while (++run < max); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (run >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, run); + _tr_tally_dist(s, 1, run - MIN_MATCH, bflush); + s->lookahead -= run; + s->strstart += run; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif diff --git a/src/SFML/Graphics/zlib/deflate.h b/src/SFML/Graphics/zlib/deflate.h new file mode 100644 index 00000000..222c53e0 --- /dev/null +++ b/src/SFML/Graphics/zlib/deflate.h @@ -0,0 +1,331 @@ +/* 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$ */ + +#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 */ diff --git a/src/SFML/Graphics/zlib/inffast.c b/src/SFML/Graphics/zlib/inffast.c new file mode 100644 index 00000000..fa31cad9 --- /dev/null +++ b/src/SFML/Graphics/zlib/inffast.c @@ -0,0 +1,318 @@ +/* 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 */ diff --git a/src/SFML/Graphics/zlib/inffast.h b/src/SFML/Graphics/zlib/inffast.h new file mode 100644 index 00000000..614fa787 --- /dev/null +++ b/src/SFML/Graphics/zlib/inffast.h @@ -0,0 +1,11 @@ +/* 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)); diff --git a/src/SFML/Graphics/zlib/inffixed.h b/src/SFML/Graphics/zlib/inffixed.h new file mode 100644 index 00000000..423d5c5b --- /dev/null +++ b/src/SFML/Graphics/zlib/inffixed.h @@ -0,0 +1,94 @@ + /* 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} + }; diff --git a/src/SFML/Graphics/zlib/inflate.c b/src/SFML/Graphics/zlib/inflate.c new file mode 100644 index 00000000..33ea9029 --- /dev/null +++ b/src/SFML/Graphics/zlib/inflate.c @@ -0,0 +1,1368 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common write == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + strm->adler = 1; /* to support ill-conceived Java test suite */ + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->wsize = 0; + state->whave = 0; + state->write = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +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) 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; + if (windowBits < 0) { + state->wrap = 0; + windowBits = -windowBits; + } + else { + state->wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) windowBits &= 15; +#endif + } + if (windowBits < 8 || windowBits > 15) { + ZFREE(strm, state); + strm->state = Z_NULL; + return Z_STREAM_ERROR; + } + state->wbits = (unsigned)windowBits; + state->window = Z_NULL; + return inflateReset(strm); +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +/* + 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; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->write = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->write = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->write; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->write, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->write = copy; + state->whave = state->wsize; + } + else { + state->write += dist; + if (state->write == state->wsize) state->write = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#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) + +/* Restore state from registers in inflate() */ +#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) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + 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 inflate(). */ +#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) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + 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 in, out; /* save starting available input and output */ + 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 */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + 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}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + 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: + 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(); + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + 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")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + 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")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + 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 = 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: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + break; + } + 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; + if ((int)(this.op) == 0) { + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + state->mode = LIT; + break; + } + if (this.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + if (this.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(this.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->mode = DIST; + case DIST: + 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; + state->extra = (unsigned)(this.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + if (state->offset > state->whave + out - left) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->write) { + copy -= state->write; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->write - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + if (state->mode == DICT) { + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy(copy, state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} diff --git a/src/SFML/Graphics/zlib/inflate.h b/src/SFML/Graphics/zlib/inflate.h new file mode 100644 index 00000000..fbbc8714 --- /dev/null +++ b/src/SFML/Graphics/zlib/inflate.h @@ -0,0 +1,115 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2004 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. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN, /* i: waiting for length/lit code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to the BAD or MEM mode -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME + NAME -> COMMENT -> HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + Read deflate blocks: + TYPE -> STORED or TABLE or LEN or CHECK + STORED -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN + Read deflate codes: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 7K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + 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 needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ +}; diff --git a/src/SFML/Graphics/zlib/inftrees.c b/src/SFML/Graphics/zlib/inftrees.c new file mode 100644 index 00000000..38ded81c --- /dev/null +++ b/src/SFML/Graphics/zlib/inftrees.c @@ -0,0 +1,329 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2005 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.3 Copyright 1995-2005 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code this; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + this.op = (unsigned char)64; /* invalid code marker */ + this.bits = (unsigned char)1; + this.val = (unsigned short)0; + *(*table)++ = this; /* make a table to force an error */ + *(*table)++ = this; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min <= MAXBITS; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked when a LENS table is being made + against the space in *table, ENOUGH, minus the maximum space needed by + the worst case distance code, MAXD. This should never happen, but the + sufficiency of ENOUGH has not been proven exhaustively, hence the check. + This assumes that when type == LENS, bits == 9. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if (type == LENS && used >= ENOUGH - MAXD) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + this.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + this.op = (unsigned char)0; + this.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + this.op = (unsigned char)(extra[work[sym]]); + this.val = base[work[sym]]; + } + else { + this.op = (unsigned char)(32 + 64); /* end of block */ + this.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = this; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if (type == LENS && used >= ENOUGH - MAXD) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + this.op = (unsigned char)64; /* invalid code marker */ + this.bits = (unsigned char)(len - drop); + this.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + this.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = this; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/src/SFML/Graphics/zlib/inftrees.h b/src/SFML/Graphics/zlib/inftrees.h new file mode 100644 index 00000000..dc0fd567 --- /dev/null +++ b/src/SFML/Graphics/zlib/inftrees.h @@ -0,0 +1,55 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005 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. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of dynamic tree. The maximum found in a long but non- + exhaustive search was 1444 code structures (852 for length/literals + and 592 for distances, the latter actually the result of an + exhaustive search). The true maximum is not known, but the value + below is more than safe. */ +#define ENOUGH 2048 +#define MAXD 592 + +/* Type of code to build for inftable() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +extern int inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/src/SFML/Graphics/zlib/trees.c b/src/SFML/Graphics/zlib/trees.c new file mode 100644 index 00000000..7a048028 --- /dev/null +++ b/src/SFML/Graphics/zlib/trees.c @@ -0,0 +1,1219 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2005 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local void set_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (value << s->bi_valid); + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (val << s->bi_valid);\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void _tr_stored_block(s, buf, stored_len, eof) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int eof; /* true if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void _tr_flush_block(s, buf, stored_len, eof) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int eof; /* true if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) + set_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, eof); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+eof, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+eof, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (eof) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*eof)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Set the data type to BINARY or TEXT, using a crude approximation: + * set it to Z_TEXT if all symbols are either printable characters (33 to 255) + * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local void set_data_type(s) + deflate_state *s; +{ + int n; + + for (n = 0; n < 9; n++) + if (s->dyn_ltree[n].Freq != 0) + break; + if (n == 9) + for (n = 14; n < 32; n++) + if (s->dyn_ltree[n].Freq != 0) + break; + s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/src/SFML/Graphics/zlib/trees.h b/src/SFML/Graphics/zlib/trees.h new file mode 100644 index 00000000..1ca868b8 --- /dev/null +++ b/src/SFML/Graphics/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/src/SFML/Graphics/zlib/uncompr.c b/src/SFML/Graphics/zlib/uncompr.c new file mode 100644 index 00000000..ad6db0a6 --- /dev/null +++ b/src/SFML/Graphics/zlib/uncompr.c @@ -0,0 +1,61 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress 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, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + 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; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/src/SFML/Graphics/zlib/zconf.h b/src/SFML/Graphics/zlib/zconf.h new file mode 100644 index 00000000..e3b0c962 --- /dev/null +++ b/src/SFML/Graphics/zlib/zconf.h @@ -0,0 +1,332 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/src/SFML/Graphics/zlib/zlib.h b/src/SFML/Graphics/zlib/zlib.h new file mode 100644 index 00000000..62d0e467 --- /dev/null +++ b/src/SFML/Graphics/zlib/zlib.h @@ -0,0 +1,1357 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. 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 the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress 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. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + 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 the value returned by + compressBound(sourceLen). 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. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress 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, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/src/SFML/Graphics/zlib/zutil.c b/src/SFML/Graphics/zlib/zutil.c new file mode 100644 index 00000000..0f4bd787 --- /dev/null +++ b/src/SFML/Graphics/zlib/zutil.c @@ -0,0 +1,318 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch (sizeof(uInt)) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch (sizeof(uLong)) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch (sizeof(voidpf)) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch (sizeof(z_off_t)) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int z_verbose = verbose; + +void z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/src/SFML/Graphics/zlib/zutil.h b/src/SFML/Graphics/zlib/zutil.h new file mode 100644 index 00000000..0ba6e020 --- /dev/null +++ b/src/SFML/Graphics/zlib/zutil.h @@ -0,0 +1,269 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2005 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$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#define ZLIB_INTERNAL +#include "zlib.h" + +#ifdef STDC +# ifndef _WIN32_WCE +# include +# endif +# include +# include +#endif +#ifdef NO_ERRNO_H +# ifdef _WIN32_WCE + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. We rename it to + * avoid conflict with other libraries that use the same workaround. + */ +# define errno z_errno +# endif + extern int errno; +#else +# ifndef _WIN32_WCE +# include +# endif +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 + #include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# define vsnprintf _vsnprintf +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + extern void zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int z_verbose; + extern void z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); +void zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */ diff --git a/src/SFML/Main/SFML_Main.cpp b/src/SFML/Main/SFML_Main.cpp new file mode 100644 index 00000000..0d64b03c --- /dev/null +++ b/src/SFML/Main/SFML_Main.cpp @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Windows specific : defines the WinMain entry function, +// so that developers can use the standard main function +// even in a Win32 Application project, and keep a portable code +//////////////////////////////////////////////////////////// + + +#if defined(_WIN32) + + #include + + extern int main(int argc, char* argv[]); + + int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT) + { + return main(__argc, __argv); + } + +#endif // _WIN32 diff --git a/src/SFML/Makefile b/src/SFML/Makefile new file mode 100644 index 00000000..dbc9d45c --- /dev/null +++ b/src/SFML/Makefile @@ -0,0 +1,62 @@ +export DEBUGBUILD = no +export STATIC = no + +ifeq ($(DEBUGBUILD), yes) + DEBUGFLAGS = -g -DDEBUG +else + DEBUGFLAGS = -O2 -DNDEBUG +endif + +ifeq ($(STATIC), no) + BUILDFLAGS = -fPIC + LINKFLAGS = -shared +else + BUILDFLAGS = + LINKFLAGS = +endif + +export CC = gcc +export CPP = g++ +export CFLAGS = -W -Wall -pedantic -I../../../include -I../../ $(DEBUGFLAGS) $(BUILDFLAGS) +export CFLAGSEXT = -I../../../include -I../.. $(DEBUGFLAGS) $(BUILDFLAGS) +export LDFLAGS = $(LINKFLAGS) +export LIBPATH = ../../../lib +export VERSION = 1.5 +export CP = cp +export LN = ln +export LNFLAGS = -s -f +export AR = ar +export ARFLAGS = rcs +export DESTDIR = /usr +export DESTLIBDIR = $(DESTDIR)/lib +export DESTINCDIR = $(DESTDIR)/include + +all: sfml-system sfml-window sfml-network sfml-graphics sfml-audio + +sfml-system: + @(cd ./System && $(MAKE)) + +sfml-window: + @(cd ./Window && $(MAKE)) + +sfml-network: + @(cd ./Network && $(MAKE)) + +sfml-graphics: + @(cd ./Graphics && $(MAKE)) + +sfml-audio: + @(cd ./Audio && $(MAKE)) + +.PHONY: clean mrproper + +clean: + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@) + +mrproper: clean + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@) + +install: + @(mkdir -p $(DESTLIBDIR)) + @(mkdir -p $(DESTINCDIR)) + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@ && $(CP) -r ../../../include/SFML/ $(DESTINCDIR)/) diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp new file mode 100644 index 00000000..df0976e2 --- /dev/null +++ b/src/SFML/Network/Ftp.cpp @@ -0,0 +1,709 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Utility class for exchanging stuff with the server +// on the data channel +//////////////////////////////////////////////////////////// +class Ftp::DataChannel : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + // Constructor + //////////////////////////////////////////////////////////// + DataChannel(Ftp& Owner); + + //////////////////////////////////////////////////////////// + // Destructor + //////////////////////////////////////////////////////////// + ~DataChannel(); + + //////////////////////////////////////////////////////////// + // Open the data channel using the specified mode and port + //////////////////////////////////////////////////////////// + Ftp::Response Open(Ftp::TransferMode Mode); + + //////////////////////////////////////////////////////////// + // Send data on the data channel + //////////////////////////////////////////////////////////// + void Send(const std::vector& Data); + + //////////////////////////////////////////////////////////// + // Receive data on the data channel until it is closed + //////////////////////////////////////////////////////////// + void Receive(std::vector& Data); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Ftp& myFtp; ///< Reference to the owner Ftp instance + SocketTCP myDataSocket; ///< Socket used for data transfers +}; + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Ftp::Response::Response(Status Code, const std::string& Message) : +myStatus (Code), +myMessage(Message) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Convenience function to check if the response status code +/// means a success +//////////////////////////////////////////////////////////// +bool Ftp::Response::IsOk() const +{ + return myStatus < 400; +} + + +//////////////////////////////////////////////////////////// +/// Get the response status code +//////////////////////////////////////////////////////////// +Ftp::Response::Status Ftp::Response::GetStatus() const +{ + return myStatus; +} + + +//////////////////////////////////////////////////////////// +/// Get the full message contained in the response +//////////////////////////////////////////////////////////// +const std::string& Ftp::Response::GetMessage() const +{ + return myMessage; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Ftp::DirectoryResponse::DirectoryResponse(Ftp::Response Resp) : +Ftp::Response(Resp) +{ + if (IsOk()) + { + // Extract the directory from the server response + std::string::size_type Begin = Resp.GetMessage().find('"', 0); + std::string::size_type End = Resp.GetMessage().find('"', Begin + 1); + myDirectory = Resp.GetMessage().substr(Begin + 1, End - Begin - 1); + } +} + + +//////////////////////////////////////////////////////////// +/// Get the directory returned in the response +//////////////////////////////////////////////////////////// +const std::string& Ftp::DirectoryResponse::GetDirectory() const +{ + return myDirectory; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Ftp::ListingResponse::ListingResponse(Ftp::Response Resp, const std::vector& Data) : +Ftp::Response(Resp) +{ + if (IsOk()) + { + // Fill the array of strings + std::string Paths(Data.begin(), Data.end()); + std::string::size_type LastPos = 0; + for (std::string::size_type Pos = Paths.find("\r\n"); Pos != std::string::npos; Pos = Paths.find("\r\n", LastPos)) + { + myFilenames.push_back(Paths.substr(LastPos, Pos - LastPos)); + LastPos = Pos + 2; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Get the number of filenames in the listing +//////////////////////////////////////////////////////////// +std::size_t Ftp::ListingResponse::GetCount() const +{ + return myFilenames.size(); +} + + +//////////////////////////////////////////////////////////// +/// Get the Index-th filename in the directory +//////////////////////////////////////////////////////////// +const std::string& Ftp::ListingResponse::GetFilename(std::size_t Index) const +{ + return myFilenames[Index]; +} + + +//////////////////////////////////////////////////////////// +/// Destructor -- close the connection with the server +//////////////////////////////////////////////////////////// +Ftp::~Ftp() +{ + Disconnect(); +} + + +//////////////////////////////////////////////////////////// +/// Connect to the specified FTP server +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::Connect(const IPAddress& Server, unsigned short Port, float Timeout) +{ + // Connect to the server + if (myCommandSocket.Connect(Port, Server, Timeout) != Socket::Done) + return Response(Response::ConnectionFailed); + + // Get the response to the connection + return GetResponse(); +} + + +//////////////////////////////////////////////////////////// +/// Log in using anonymous account +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::Login() +{ + return Login("anonymous", "user@sfml-dev.org"); +} + + +//////////////////////////////////////////////////////////// +/// Log in using a username and a password +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::Login(const std::string& UserName, const std::string& Password) +{ + Response Resp = SendCommand("USER", UserName); + if (Resp.IsOk()) + Resp = SendCommand("PASS", Password); + + return Resp; +} + + +//////////////////////////////////////////////////////////// +/// Close the connection with FTP server +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::Disconnect() +{ + // Send the exit command + Response Resp = SendCommand("QUIT"); + if (Resp.IsOk()) + myCommandSocket.Close(); + + return Resp; +} + + +//////////////////////////////////////////////////////////// +/// Send a null command just to prevent from being disconnected +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::KeepAlive() +{ + return SendCommand("NOOP"); +} + + +//////////////////////////////////////////////////////////// +/// Get the current working directory +//////////////////////////////////////////////////////////// +Ftp::DirectoryResponse Ftp::GetWorkingDirectory() +{ + return DirectoryResponse(SendCommand("PWD")); +} + + +//////////////////////////////////////////////////////////// +/// Get the contents of the given directory +/// (subdirectories and files) +//////////////////////////////////////////////////////////// +Ftp::ListingResponse Ftp::GetDirectoryListing(const std::string& Directory) +{ + // Open a data channel on default port (20) using ASCII transfer mode + std::vector DirData; + DataChannel Data(*this); + Response Resp = Data.Open(Ascii); + if (Resp.IsOk()) + { + // Tell the server to send us the listing + Resp = SendCommand("NLST", Directory); + if (Resp.IsOk()) + { + // Receive the listing + Data.Receive(DirData); + + // Get the response from the server + Resp = GetResponse(); + } + } + + return ListingResponse(Resp, DirData); +} + + +//////////////////////////////////////////////////////////// +/// Change the current working directory +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::ChangeDirectory(const std::string& Directory) +{ + return SendCommand("CWD", Directory); +} + + +//////////////////////////////////////////////////////////// +/// Go to the parent directory of the current one +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::ParentDirectory() +{ + return SendCommand("CDUP"); +} + + +//////////////////////////////////////////////////////////// +/// Create a new directory +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::MakeDirectory(const std::string& Name) +{ + return SendCommand("MKD", Name); +} + + +//////////////////////////////////////////////////////////// +/// Remove an existing directory +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::DeleteDirectory(const std::string& Name) +{ + return SendCommand("RMD", Name); +} + + +//////////////////////////////////////////////////////////// +/// Rename a file +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::RenameFile(const std::string& File, const std::string& NewName) +{ + Response Resp = SendCommand("RNFR", File); + if (Resp.IsOk()) + Resp = SendCommand("RNTO", NewName); + + return Resp; +} + + +//////////////////////////////////////////////////////////// +/// Remove an existing file +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::DeleteFile(const std::string& Name) +{ + return SendCommand("DELE", Name); +} + + +//////////////////////////////////////////////////////////// +/// Download a file from the server +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::Download(const std::string& DistantFile, const std::string& DestPath, TransferMode Mode) +{ + // Open a data channel using the given transfer mode + DataChannel Data(*this); + Response Resp = Data.Open(Mode); + if (Resp.IsOk()) + { + // Tell the server to start the transfer + Resp = SendCommand("RETR", DistantFile); + if (Resp.IsOk()) + { + // Receive the file data + std::vector FileData; + Data.Receive(FileData); + + // Get the response from the server + Resp = GetResponse(); + if (Resp.IsOk()) + { + // Extract the filename from the file path + std::string Filename = DistantFile; + std::string::size_type Pos = Filename.find_last_of("/\\"); + if (Pos != std::string::npos) + Filename = Filename.substr(Pos + 1); + + // Make sure the destination path ends with a slash + std::string Path = DestPath; + if (!Path.empty() && (Path[Path.size() - 1] != '\\') && (Path[Path.size() - 1] != '/')) + Path += "/"; + + // Create the file and copy the received data into it + std::ofstream File((Path + Filename).c_str(), std::ios_base::binary); + if (!File) + return Response(Response::InvalidFile); + File.write(&FileData[0], static_cast(FileData.size())); + } + } + } + + return Resp; +} + + +//////////////////////////////////////////////////////////// +/// Upload a file to the server +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::Upload(const std::string& LocalFile, const std::string& DestPath, TransferMode Mode) +{ + // Get the contents of the file to send + std::ifstream File(LocalFile.c_str(), std::ios_base::binary); + if (!File) + return Response(Response::InvalidFile); + File.seekg(0, std::ios::end); + std::size_t Length = File.tellg(); + File.seekg(0, std::ios::beg); + std::vector FileData(Length); + File.read(&FileData[0], static_cast(Length)); + + // Extract the filename from the file path + std::string Filename = LocalFile; + std::string::size_type Pos = Filename.find_last_of("/\\"); + if (Pos != std::string::npos) + Filename = Filename.substr(Pos + 1); + + // Make sure the destination path ends with a slash + std::string Path = DestPath; + if (!Path.empty() && (Path[Path.size() - 1] != '\\') && (Path[Path.size() - 1] != '/')) + Path += "/"; + + // Open a data channel using the given transfer mode + DataChannel Data(*this); + Response Resp = Data.Open(Mode); + if (Resp.IsOk()) + { + // Tell the server to start the transfer + Resp = SendCommand("STOR", Path + Filename); + if (Resp.IsOk()) + { + // Send the file data + Data.Send(FileData); + + // Get the response from the server + Resp = GetResponse(); + } + } + + return Resp; +} + + +//////////////////////////////////////////////////////////// +/// Send a command to the FTP server +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::SendCommand(const std::string& Command, const std::string& Parameter) +{ + // Build the command string + std::string CommandStr; + if (Parameter != "") + CommandStr = Command + " " + Parameter + "\r\n"; + else + CommandStr = Command + "\r\n"; + + // Send it to the server + if (myCommandSocket.Send(CommandStr.c_str(), CommandStr.length()) != sf::Socket::Done) + return Response(Response::ConnectionClosed); + + // Get the response + return GetResponse(); +} + + +//////////////////////////////////////////////////////////// +/// Receive a response from the server +/// (usually after a command has been sent) +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::GetResponse() +{ + // We'll use a variable to keep track of the last valid code. + // It is useful in case of multi-lines responses, because the end of such a response + // will start by the same code + unsigned int LastCode = 0; + bool IsInsideMultiline = false; + std::string Message; + + for (;;) + { + // Receive the response from the server + char Buffer[1024]; + std::size_t Length; + if (myCommandSocket.Receive(Buffer, sizeof(Buffer), Length) != sf::Socket::Done) + return Response(Response::ConnectionClosed); + + // There can be several lines inside the received buffer, extract them all + std::istringstream In(std::string(Buffer, Length), std::ios_base::binary); + while (In) + { + // Try to extract the code + unsigned int Code; + if (In >> Code) + { + // Extract the separator + char Sep; + In.get(Sep); + + // The '-' character means a multiline response + if ((Sep == '-') && !IsInsideMultiline) + { + // Set the multiline flag + IsInsideMultiline = true; + + // Keep track of the code + if (LastCode == 0) + LastCode = Code; + + // Extract the line + std::getline(In, Message); + + // Remove the ending '\r' (all lines are terminated by "\r\n") + Message.erase(Message.length() - 1); + Message = Sep + Message + "\n"; + } + else + { + // We must make sure that the code is the same, otherwise it means + // we haven't reached the end of the multiline response + if ((Sep != '-') && ((Code == LastCode) || (LastCode == 0))) + { + // Clear the multiline flag + IsInsideMultiline = false; + + // Extract the line + std::string Line; + std::getline(In, Line); + + // Remove the ending '\r' (all lines are terminated by "\r\n") + Line.erase(Line.length() - 1); + + // Append it to the message + if (Code == LastCode) + { + std::ostringstream Out; + Out << Code << Sep << Line; + Message += Out.str(); + } + else + { + Message = Sep + Line; + } + + // Return the response code and message + return Response(static_cast(Code), Message); + } + else + { + // The line we just read was actually not a response, + // only a new part of the current multiline response + + // Extract the line + std::string Line; + std::getline(In, Line); + + if (!Line.empty()) + { + // Remove the ending '\r' (all lines are terminated by "\r\n") + Line.erase(Line.length() - 1); + + // Append it to the current message + std::ostringstream Out; + Out << Code << Sep << Line << "\n"; + Message += Out.str(); + } + } + } + } + else if (LastCode != 0) + { + // It seems we are in the middle of a multiline response + + // Clear the error bits of the stream + In.clear(); + + // Extract the line + std::string Line; + std::getline(In, Line); + + if (!Line.empty()) + { + // Remove the ending '\r' (all lines are terminated by "\r\n") + Line.erase(Line.length() - 1); + + // Append it to the current message + Message += Line + "\n"; + } + } + else + { + // Error : cannot extract the code, and we are not in a multiline response + return Response(Response::InvalidResponse); + } + } + } + + // We never reach there +} + + +//////////////////////////////////////////////////////////// +/// Constructor +//////////////////////////////////////////////////////////// +Ftp::DataChannel::DataChannel(Ftp& Owner) : +myFtp(Owner) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Ftp::DataChannel::~DataChannel() +{ + // Close the data socket + myDataSocket.Close(); +} + + +//////////////////////////////////////////////////////////// +/// Open the data channel using the specified mode and port +//////////////////////////////////////////////////////////// +Ftp::Response Ftp::DataChannel::Open(Ftp::TransferMode Mode) +{ + // Open a data connection in active mode (we connect to the server) + Ftp::Response Resp = myFtp.SendCommand("PASV"); + if (Resp.IsOk()) + { + // Extract the connection address and port from the response + std::string::size_type begin = Resp.GetMessage().find_first_of("0123456789"); + if (begin != std::string::npos) + { + sf::Uint8 Data[6] = {0, 0, 0, 0, 0, 0}; + std::string Str = Resp.GetMessage().substr(begin); + std::size_t Index = 0; + for (int i = 0; i < 6; ++i) + { + // Extract the current number + while (isdigit(Str[Index])) + { + Data[i] = Data[i] * 10 + (Str[Index] - '0'); + Index++; + } + + // Skip separator + Index++; + } + + // Reconstruct connection port and address + unsigned short Port = Data[4] * 256 + Data[5]; + sf::IPAddress Address(static_cast(Data[0]), + static_cast(Data[1]), + static_cast(Data[2]), + static_cast(Data[3])); + + // Connect the data channel to the server + if (myDataSocket.Connect(Port, Address) == Socket::Done) + { + // Translate the transfer mode to the corresponding FTP parameter + std::string ModeStr; + switch (Mode) + { + case Ftp::Binary : ModeStr = "I"; break; + case Ftp::Ascii : ModeStr = "A"; break; + case Ftp::Ebcdic : ModeStr = "E"; break; + } + + // Set the transfer mode + Resp = myFtp.SendCommand("TYPE", ModeStr); + } + else + { + // Failed to connect to the server + Resp = Ftp::Response(Ftp::Response::ConnectionFailed); + } + } + } + + return Resp; +} + + +//////////////////////////////////////////////////////////// +/// Receive data on the data channel until it is closed +//////////////////////////////////////////////////////////// +void Ftp::DataChannel::Receive(std::vector& Data) +{ + // Receive data + Data.clear(); + char Buffer[1024]; + std::size_t Received; + while (myDataSocket.Receive(Buffer, sizeof(Buffer), Received) == sf::Socket::Done) + { + std::copy(Buffer, Buffer + Received, std::back_inserter(Data)); + } + + // Close the data socket + myDataSocket.Close(); +} + + +//////////////////////////////////////////////////////////// +/// Send data on the data channel +//////////////////////////////////////////////////////////// +void Ftp::DataChannel::Send(const std::vector& Data) +{ + // Send data + myDataSocket.Send(&Data[0], Data.size()); + + // Close the data socket + myDataSocket.Close(); +} + +} // namespace sf diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp new file mode 100644 index 00000000..a1873063 --- /dev/null +++ b/src/SFML/Network/Http.cpp @@ -0,0 +1,425 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace +{ + //////////////////////////////////////////////////////////// + // Convenience function to convert a string to lower case + //////////////////////////////////////////////////////////// + std::string ToLower(const std::string& Str) + { + std::string Ret = Str; + for (std::string::iterator i = Ret.begin(); i != Ret.end(); ++i) + *i = static_cast(tolower(*i)); + + return Ret; + } +} + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Http::Request::Request(Method RequestMethod, const std::string& URI, const std::string& Body) : +myMethod (RequestMethod), +myURI (URI), +myMajorVersion(1), +myMinorVersion(0), +myBody (Body) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Set the value of a field; the field is added if it doesn't exist +//////////////////////////////////////////////////////////// +void Http::Request::SetField(const std::string& Field, const std::string& Value) +{ + myFields[ToLower(Field)] = Value; +} + + +//////////////////////////////////////////////////////////// +/// Set the request method. +/// This parameter is Get by default +//////////////////////////////////////////////////////////// +void Http::Request::SetMethod(Http::Request::Method RequestMethod) +{ + myMethod = RequestMethod; +} + + +//////////////////////////////////////////////////////////// +/// Set the target URI of the request. +/// This parameter is "/" by default +//////////////////////////////////////////////////////////// +void Http::Request::SetURI(const std::string& URI) +{ + myURI = URI; + + // Make sure it starts with a '/' + if (myURI.empty() || (myURI[0] != '/')) + myURI.insert(0, "/"); +} + + +//////////////////////////////////////////////////////////// +/// Set the HTTP version of the request. +/// This parameter is 1.0 by default +//////////////////////////////////////////////////////////// +void Http::Request::SetHttpVersion(unsigned int Major, unsigned int Minor) +{ + myMajorVersion = Major; + myMinorVersion = Minor; +} + + +//////////////////////////////////////////////////////////// +/// Set the body of the request. This parameter is optional and +/// makes sense only for POST requests. +/// This parameter is empty by default +//////////////////////////////////////////////////////////// +void Http::Request::SetBody(const std::string& Body) +{ + myBody = Body; +} + + +//////////////////////////////////////////////////////////// +/// Get the string representation of a request header +//////////////////////////////////////////////////////////// +std::string Http::Request::ToString() const +{ + std::ostringstream Out; + + // Convert the method to its string representation + std::string RequestMethod; + switch (myMethod) + { + default : + case Get : RequestMethod = "GET"; break; + case Post : RequestMethod = "POST"; break; + case Head : RequestMethod = "HEAD"; break; + } + + // Write the first line containing the request type + Out << RequestMethod << " " << myURI << " "; + Out << "HTTP/" << myMajorVersion << "." << myMinorVersion << "\r\n"; + + // Write fields + for (FieldTable::const_iterator i = myFields.begin(); i != myFields.end(); ++i) + { + Out << i->first << ": " << i->second << "\r\n"; + } + + // Use an extra \r\n to separate the header from the body + Out << "\r\n"; + + // Add the body + Out << myBody; + + return Out.str(); +} + + +//////////////////////////////////////////////////////////// +/// Check if the given field has been defined +//////////////////////////////////////////////////////////// +bool Http::Request::HasField(const std::string& Field) const +{ + return myFields.find(Field) != myFields.end(); +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Http::Response::Response() : +myStatus (ConnectionFailed), +myMajorVersion(0), +myMinorVersion(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Get the value of a field +//////////////////////////////////////////////////////////// +const std::string& Http::Response::GetField(const std::string& Field) const +{ + FieldTable::const_iterator It = myFields.find(Field); + if (It != myFields.end()) + { + return It->second; + } + else + { + static const std::string Empty = ""; + return Empty; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the header's status code +//////////////////////////////////////////////////////////// +Http::Response::Status Http::Response::GetStatus() const +{ + return myStatus; +} + + +//////////////////////////////////////////////////////////// +/// Get the major HTTP version number of the response +//////////////////////////////////////////////////////////// +unsigned int Http::Response::GetMajorHttpVersion() const +{ + return myMajorVersion; +} + + +//////////////////////////////////////////////////////////// +/// Get the major HTTP version number of the response +//////////////////////////////////////////////////////////// +unsigned int Http::Response::GetMinorHttpVersion() const +{ + return myMinorVersion; +} + + +//////////////////////////////////////////////////////////// +/// Get the body of the response. The body can contain : +/// - the requested page (for GET requests) +/// - a response from the server (for POST requests) +/// - nothing (for HEAD requests) +/// - an error message (in case of an error) +//////////////////////////////////////////////////////////// +const std::string& Http::Response::GetBody() const +{ + return myBody; +} + + +//////////////////////////////////////////////////////////// +/// Construct the header from a response string +//////////////////////////////////////////////////////////// +void Http::Response::FromString(const std::string& Data) +{ + std::istringstream In(Data); + + // Extract the HTTP version from the first line + std::string Version; + if (In >> Version) + { + if ((Version.size() >= 8) && (Version[6] == '.') && + (ToLower(Version.substr(0, 5)) == "http/") && + isdigit(Version[5]) && isdigit(Version[7])) + { + myMajorVersion = Version[5] - '0'; + myMinorVersion = Version[7] - '0'; + } + else + { + // Invalid HTTP version + myStatus = InvalidResponse; + return; + } + } + + // Extract the status code from the first line + int StatusCode; + if (In >> StatusCode) + { + myStatus = static_cast(StatusCode); + } + else + { + // Invalid status code + myStatus = InvalidResponse; + return; + } + + // Ignore the end of the first line + In.ignore(10000, '\n'); + + // Parse the other lines, which contain fields, one by one + std::string Line; + while (std::getline(In, Line) && (Line.size() > 2)) + { + std::string::size_type Pos = Line.find(": "); + if (Pos != std::string::npos) + { + // Extract the field name and its value + std::string Field = Line.substr(0, Pos); + std::string Value = Line.substr(Pos + 2); + + // Remove any trailing \r + if (!Value.empty() && (*Value.rbegin() == '\r')) + Value.erase(Value.size() - 1); + + // Add the field + myFields[ToLower(Field)] = Value; + } + } + + // Finally extract the body + myBody.clear(); + while (std::getline(In, Line)) + myBody += Line + "\n"; +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Http::Http() : +myHost(), +myPort(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the Http instance with the target host +//////////////////////////////////////////////////////////// +Http::Http(const std::string& Host, unsigned short Port) +{ + SetHost(Host, Port); +} + + +//////////////////////////////////////////////////////////// +/// Set the target host +//////////////////////////////////////////////////////////// +void Http::SetHost(const std::string& Host, unsigned short Port) +{ + // Detect the protocol used + std::string Protocol = ToLower(Host.substr(0, 8)); + if (Protocol.substr(0, 7) == "http://") + { + // HTTP protocol + myHostName = Host.substr(7); + myPort = (Port != 0 ? Port : 80); + } + else if (Protocol == "https://") + { + // HTTPS protocol + myHostName = Host.substr(8); + myPort = (Port != 0 ? Port : 443); + } + else + { + // Undefined protocol - use HTTP + myHostName = Host; + myPort = (Port != 0 ? Port : 80); + } + + // Remove any trailing '/' from the host name + if (!myHostName.empty() && (*myHostName.rbegin() == '/')) + myHostName.erase(myHostName.size() - 1); + + myHost = sf::IPAddress(myHostName); +} + + +//////////////////////////////////////////////////////////// +/// Send a HTTP request and return the server's response. +/// You must be connected to a host before sending requests. +/// Any missing mandatory header field will be added with an appropriate value. +/// Warning : this function waits for the server's response and may +/// not return instantly; use a thread if you don't want to block your +/// application. +//////////////////////////////////////////////////////////// +Http::Response Http::SendRequest(const Http::Request& Req, float Timeout) +{ + // First make sure the request is valid -- add missing mandatory fields + Request ToSend(Req); + if (!ToSend.HasField("From")) + { + ToSend.SetField("From", "user@sfml-dev.org"); + } + if (!ToSend.HasField("User-Agent")) + { + ToSend.SetField("User-Agent", "libsfml-network/1.x"); + } + if (!ToSend.HasField("Host")) + { + ToSend.SetField("Host", myHostName); + } + if (!ToSend.HasField("Content-Length")) + { + std::ostringstream Out; + Out << ToSend.myBody.size(); + ToSend.SetField("Content-Length", Out.str()); + } + + // Prepare the response + Response Received; + + // Connect the socket to the host + if (myConnection.Connect(myPort, myHost, Timeout) == Socket::Done) + { + // Convert the request to string and send it through the connected socket + std::string RequestStr = ToSend.ToString(); + + if (!RequestStr.empty()) + { + // Send it through the socket + if (myConnection.Send(RequestStr.c_str(), RequestStr.size()) == sf::Socket::Done) + { + // Wait for the server's response + std::string ReceivedStr; + std::size_t Size = 0; + char Buffer[1024]; + while (myConnection.Receive(Buffer, sizeof(Buffer), Size) == sf::Socket::Done) + { + ReceivedStr.append(Buffer, Buffer + Size); + } + + // Build the Response object from the received data + Received.FromString(ReceivedStr); + } + } + + // Close the connection + myConnection.Close(); + } + + return Received; +} + +} // namespace sf diff --git a/src/SFML/Network/IPAddress.cpp b/src/SFML/Network/IPAddress.cpp new file mode 100644 index 00000000..65800bc8 --- /dev/null +++ b/src/SFML/Network/IPAddress.cpp @@ -0,0 +1,312 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Static member data +//////////////////////////////////////////////////////////// +const IPAddress IPAddress::LocalHost("127.0.0.1"); + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +IPAddress::IPAddress() : +myAddress(INADDR_NONE) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the address from a string +//////////////////////////////////////////////////////////// +IPAddress::IPAddress(const std::string& Address) +{ + // First try to convert it as a byte representation ("xxx.xxx.xxx.xxx") + myAddress = inet_addr(Address.c_str()); + + // If not successful, try to convert it as a host name + if (!IsValid()) + { + hostent* Host = gethostbyname(Address.c_str()); + if (Host) + { + // Host found, extract its IP address + myAddress = reinterpret_cast(Host->h_addr)->s_addr; + } + else + { + // Host name not found on the network + myAddress = INADDR_NONE; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Construct the address from a C-style string ; +/// Needed for implicit conversions from literal strings to IPAddress to work +//////////////////////////////////////////////////////////// +IPAddress::IPAddress(const char* Address) +{ + // First try to convert it as a byte representation ("xxx.xxx.xxx.xxx") + myAddress = inet_addr(Address); + + // If not successful, try to convert it as a host name + if (!IsValid()) + { + hostent* Host = gethostbyname(Address); + if (Host) + { + // Host found, extract its IP address + myAddress = reinterpret_cast(Host->h_addr)->s_addr; + } + else + { + // Host name not found on the network + myAddress = INADDR_NONE; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Construct the address from 4 bytes +//////////////////////////////////////////////////////////// +IPAddress::IPAddress(Uint8 Byte0, Uint8 Byte1, Uint8 Byte2, Uint8 Byte3) +{ + myAddress = htonl((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3); +} + + +//////////////////////////////////////////////////////////// +/// Construct the address from a 32-bits integer +//////////////////////////////////////////////////////////// +IPAddress::IPAddress(Uint32 Address) +{ + myAddress = htonl(Address); +} + + +//////////////////////////////////////////////////////////// +/// Tell if the address is a valid one +//////////////////////////////////////////////////////////// +bool IPAddress::IsValid() const +{ + return myAddress != INADDR_NONE; +} + + +//////////////////////////////////////////////////////////// +/// Get a string representation of the address +//////////////////////////////////////////////////////////// +std::string IPAddress::ToString() const +{ + in_addr InAddr; + InAddr.s_addr = myAddress; + + return inet_ntoa(InAddr); +} + + +//////////////////////////////////////////////////////////// +/// Get an integer representation of the address +//////////////////////////////////////////////////////////// +Uint32 IPAddress::ToInteger() const +{ + return ntohl(myAddress); +} + + +//////////////////////////////////////////////////////////// +/// Get the computer's local IP address (from the LAN point of view) +//////////////////////////////////////////////////////////// +IPAddress IPAddress::GetLocalAddress() +{ + // The method here is to connect a UDP socket to anyone (here to localhost), + // and get the local socket address with the getsockname function. + // UDP connection will not send anything to the network, so this function won't cause any overhead. + + IPAddress LocalAddress; + + // Create the socket + SocketHelper::SocketType Socket = socket(PF_INET, SOCK_DGRAM, 0); + if (Socket == SocketHelper::InvalidSocket()) + return LocalAddress; + + // Build the host address (use a random port) + sockaddr_in SockAddr; + memset(SockAddr.sin_zero, 0, sizeof(SockAddr.sin_zero)); + SockAddr.sin_addr.s_addr = INADDR_LOOPBACK; + SockAddr.sin_family = AF_INET; + SockAddr.sin_port = htons(4567); + + // Connect the socket + if (connect(Socket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) == -1) + { + SocketHelper::Close(Socket); + return LocalAddress; + } + + // Get the local address of the socket connection + SocketHelper::LengthType Size = sizeof(SockAddr); + if (getsockname(Socket, reinterpret_cast(&SockAddr), &Size) == -1) + { + SocketHelper::Close(Socket); + return LocalAddress; + } + + // Close the socket + SocketHelper::Close(Socket); + + // Finally build the IP address + LocalAddress.myAddress = SockAddr.sin_addr.s_addr; + + return LocalAddress; +} + + +//////////////////////////////////////////////////////////// +/// Get the computer's public IP address (from the web point of view) +//////////////////////////////////////////////////////////// +IPAddress IPAddress::GetPublicAddress(float Timeout) +{ + // The trick here is more complicated, because the only way + // to get our public IP address is to get it from a distant computer. + // Here we get the web page from http://www.whatismyip.org + // and parse the result to extract our IP address + // (not very hard : the web page contains only our IP address). + // If the server is not responding, we use a fallback server which + // is stored on the SFML website. + + // First try: www.whatismyip.org + { + Http Server("www.whatismyip.org"); + Http::Request Request(Http::Request::Get, "/"); + Http::Response Page = Server.SendRequest(Request, Timeout / 2); + if (Page.GetStatus() == Http::Response::Ok) + return IPAddress(Page.GetBody()); + } + + // Fallback: www.sfml-dev.org/ip-provider.php + { + Http Server("www.sfml-dev.org"); + Http::Request Request(Http::Request::Get, "/ip-provider.php"); + Http::Response Page = Server.SendRequest(Request, Timeout / 2); + if (Page.GetStatus() == Http::Response::Ok) + return IPAddress(Page.GetBody()); + } + + // Everything failed: return an invalid address + return IPAddress(); +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator == +//////////////////////////////////////////////////////////// +bool IPAddress::operator ==(const IPAddress& Other) const +{ + return myAddress == Other.myAddress; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator != +//////////////////////////////////////////////////////////// +bool IPAddress::operator !=(const IPAddress& Other) const +{ + return myAddress != Other.myAddress; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator < +//////////////////////////////////////////////////////////// +bool IPAddress::operator <(const IPAddress& Other) const +{ + return myAddress < Other.myAddress; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator > +//////////////////////////////////////////////////////////// +bool IPAddress::operator >(const IPAddress& Other) const +{ + return myAddress > Other.myAddress; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator <= +//////////////////////////////////////////////////////////// +bool IPAddress::operator <=(const IPAddress& Other) const +{ + return myAddress <= Other.myAddress; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator >= +//////////////////////////////////////////////////////////// +bool IPAddress::operator >=(const IPAddress& Other) const +{ + return myAddress >= Other.myAddress; +} + + +//////////////////////////////////////////////////////////// +/// Operator >> overload to extract an address from an input stream +//////////////////////////////////////////////////////////// +std::istream& operator >>(std::istream& Stream, IPAddress& Address) +{ + std::string Str; + Stream >> Str; + Address = IPAddress(Str); + + return Stream; +} + + +//////////////////////////////////////////////////////////// +/// Operator << overload to print an address to an output stream +//////////////////////////////////////////////////////////// +std::ostream& operator <<(std::ostream& Stream, const IPAddress& Address) +{ + return Stream << Address.ToString(); +} + +} // namespace sf diff --git a/src/SFML/Network/Makefile b/src/SFML/Network/Makefile new file mode 100644 index 00000000..d30da624 --- /dev/null +++ b/src/SFML/Network/Makefile @@ -0,0 +1,34 @@ +SRC = $(wildcard *.cpp ./Unix/*.cpp) +OBJ = $(SRC:.cpp=.o) + +ifeq ($(STATIC), yes) + LIB = libsfml-network-s.a + LIBNAME = $(LIBPATH)/$(LIB) + INSTALL = +else + LIB = libsfml-network.so + LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + INSTALL = && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) +endif + +all: $(LIB) + +libsfml-network-s.a: $(OBJ) + $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) + +libsfml-network.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp new file mode 100644 index 00000000..df693d5c --- /dev/null +++ b/src/SFML/Network/Packet.cpp @@ -0,0 +1,426 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Packet::Packet() : +myReadPos(0), +myIsValid(true) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +Packet::~Packet() +{ + +} + + +//////////////////////////////////////////////////////////// +/// Append data to the end of the packet +//////////////////////////////////////////////////////////// +void Packet::Append(const void* Data, std::size_t SizeInBytes) +{ + if (Data && (SizeInBytes > 0)) + { + std::size_t Start = myData.size(); + myData.resize(Start + SizeInBytes); + memcpy(&myData[Start], Data, SizeInBytes); + } +} + + +//////////////////////////////////////////////////////////// +/// Clear the packet data +//////////////////////////////////////////////////////////// +void Packet::Clear() +{ + myData.clear(); + myReadPos = 0; + myIsValid = true; +} + + +//////////////////////////////////////////////////////////// +/// Get a pointer to the data contained in the packet +/// Warning : the returned pointer may be invalid after you +/// append data to the packet +//////////////////////////////////////////////////////////// +const char* Packet::GetData() const +{ + return !myData.empty() ? &myData[0] : NULL; +} + + +//////////////////////////////////////////////////////////// +/// Get the size of the data contained in the packet +//////////////////////////////////////////////////////////// +std::size_t Packet::GetDataSize() const +{ + return myData.size(); +} + + +//////////////////////////////////////////////////////////// +/// Tell if the reading position has reached the end of the packet +//////////////////////////////////////////////////////////// +bool Packet::EndOfPacket() const +{ + return myReadPos >= myData.size(); +} + + +//////////////////////////////////////////////////////////// +/// Tell if the packet is valid for reading +//////////////////////////////////////////////////////////// +Packet::operator bool() const +{ + return myIsValid; +} + + +//////////////////////////////////////////////////////////// +/// Operator >> overloads to extract data from the packet +//////////////////////////////////////////////////////////// +Packet& Packet::operator >>(bool& Data) +{ + Uint8 Value; + if (*this >> Value) + Data = (Value != 0); + + return *this; +} +Packet& Packet::operator >>(Int8& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(Uint8& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(Int16& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = ntohs(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(Uint16& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = ntohs(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(Int32& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = ntohl(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(Uint32& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = ntohl(*reinterpret_cast(GetData() + myReadPos)); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(float& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(double& Data) +{ + if (CheckSize(sizeof(Data))) + { + Data = *reinterpret_cast(GetData() + myReadPos); + myReadPos += sizeof(Data); + } + + return *this; +} +Packet& Packet::operator >>(char* Data) +{ + // First extract string length + Uint32 Length; + *this >> Length; + + if ((Length > 0) && CheckSize(Length)) + { + // Then extract characters + memcpy(Data, GetData() + myReadPos, Length); + Data[Length] = '\0'; + + // Update reading position + myReadPos += Length; + } + + return *this; +} +Packet& Packet::operator >>(std::string& Data) +{ + // First extract string length + Uint32 Length; + *this >> Length; + + Data.clear(); + if ((Length > 0) && CheckSize(Length)) + { + // Then extract characters + Data.assign(GetData() + myReadPos, Length); + + // Update reading position + myReadPos += Length; + } + + return *this; +} +Packet& Packet::operator >>(wchar_t* Data) +{ + // First extract string length + Uint32 Length; + *this >> Length; + + if ((Length > 0) && CheckSize(Length * sizeof(Int32))) + { + // Then extract characters + for (Uint32 i = 0; i < Length; ++i) + { + Uint32 c; + *this >> c; + Data[i] = static_cast(c); + } + Data[Length] = L'\0'; + } + + return *this; +} +Packet& Packet::operator >>(std::wstring& Data) +{ + // First extract string length + Uint32 Length; + *this >> Length; + + Data.clear(); + if ((Length > 0) && CheckSize(Length * sizeof(Int32))) + { + // Then extract characters + for (Uint32 i = 0; i < Length; ++i) + { + Uint32 c; + *this >> c; + Data += static_cast(c); + } + } + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Operator << overloads to put data into the packet +//////////////////////////////////////////////////////////// +Packet& Packet::operator <<(bool Data) +{ + *this << static_cast(Data); + return *this; +} +Packet& Packet::operator <<(Int8 Data) +{ + Append(&Data, sizeof(Data)); + return *this; +} +Packet& Packet::operator <<(Uint8 Data) +{ + Append(&Data, sizeof(Data)); + return *this; +} +Packet& Packet::operator <<(Int16 Data) +{ + Int16 ToWrite = htons(Data); + Append(&ToWrite, sizeof(ToWrite)); + return *this; +} +Packet& Packet::operator <<(Uint16 Data) +{ + Uint16 ToWrite = htons(Data); + Append(&ToWrite, sizeof(ToWrite)); + return *this; +} +Packet& Packet::operator <<(Int32 Data) +{ + Int32 ToWrite = htonl(Data); + Append(&ToWrite, sizeof(ToWrite)); + return *this; +} +Packet& Packet::operator <<(Uint32 Data) +{ + Uint32 ToWrite = htonl(Data); + Append(&ToWrite, sizeof(ToWrite)); + return *this; +} +Packet& Packet::operator <<(float Data) +{ + Append(&Data, sizeof(Data)); + return *this; +} +Packet& Packet::operator <<(double Data) +{ + Append(&Data, sizeof(Data)); + return *this; +} +Packet& Packet::operator <<(const char* Data) +{ + // First insert string length + Uint32 Length = 0; + for (const char* c = Data; *c != '\0'; ++c) + ++Length; + *this << Length; + + // Then insert characters + Append(Data, Length * sizeof(char)); + + return *this; +} +Packet& Packet::operator <<(const std::string& Data) +{ + // First insert string length + Uint32 Length = static_cast(Data.size()); + *this << Length; + + // Then insert characters + if (Length > 0) + { + Append(Data.c_str(), Length * sizeof(std::string::value_type)); + } + + return *this; +} +Packet& Packet::operator <<(const wchar_t* Data) +{ + // First insert string length + Uint32 Length = 0; + for (const wchar_t* c = Data; *c != L'\0'; ++c) + ++Length; + *this << Length; + + // Then insert characters + for (const wchar_t* c = Data; *c != L'\0'; ++c) + *this << static_cast(*c); + + return *this; +} +Packet& Packet::operator <<(const std::wstring& Data) +{ + // First insert string length + Uint32 Length = static_cast(Data.size()); + *this << Length; + + // Then insert characters + if (Length > 0) + { + for (std::wstring::const_iterator c = Data.begin(); c != Data.end(); ++c) + *this << static_cast(*c); + } + + return *this; +} + + +//////////////////////////////////////////////////////////// +/// Check if the packet can extract a given size of bytes +//////////////////////////////////////////////////////////// +bool Packet::CheckSize(std::size_t Size) +{ + myIsValid = myIsValid && (myReadPos + Size <= myData.size()); + + return myIsValid; +} + + +//////////////////////////////////////////////////////////// +/// Called before the packet is sent to the network +//////////////////////////////////////////////////////////// +const char* Packet::OnSend(std::size_t& DataSize) +{ + DataSize = GetDataSize(); + return GetData(); +} + + +//////////////////////////////////////////////////////////// +/// Called after the packet has been received from the network +//////////////////////////////////////////////////////////// +void Packet::OnReceive(const char* Data, std::size_t DataSize) +{ + Append(Data, DataSize); +} + +} // namespace sf diff --git a/src/SFML/Network/SelectorBase.cpp b/src/SFML/Network/SelectorBase.cpp new file mode 100644 index 00000000..6631753c --- /dev/null +++ b/src/SFML/Network/SelectorBase.cpp @@ -0,0 +1,132 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifdef _MSC_VER + #pragma warning(disable : 4127) // "conditional expression is constant" generated by the FD_SET macro +#endif + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SelectorBase::SelectorBase() : +myMaxSocket(0) +{ + Clear(); +} + + +//////////////////////////////////////////////////////////// +/// Add a socket to watch +//////////////////////////////////////////////////////////// +void SelectorBase::Add(SocketHelper::SocketType Socket) +{ + FD_SET(Socket, &mySet); + + int Size = static_cast(Socket); + if (Size > myMaxSocket) + myMaxSocket = Size; +} + + +//////////////////////////////////////////////////////////// +/// Remove a socket +//////////////////////////////////////////////////////////// +void SelectorBase::Remove(SocketHelper::SocketType Socket) +{ + FD_CLR(Socket, &mySet); +} + + +//////////////////////////////////////////////////////////// +/// Remove all sockets +//////////////////////////////////////////////////////////// +void SelectorBase::Clear() +{ + FD_ZERO(&mySet); + FD_ZERO(&mySetReady); + + myMaxSocket = 0; +} + + +//////////////////////////////////////////////////////////// +/// Wait and collect sockets which are ready for reading. +/// This functions will return either when at least one socket +/// is ready, or when the given time is out +//////////////////////////////////////////////////////////// +unsigned int SelectorBase::Wait(float Timeout) +{ + // Setup the timeout structure + timeval Time; + Time.tv_sec = static_cast(Timeout); + Time.tv_usec = (static_cast(Timeout * 1000) % 1000) * 1000; + + // Prepare the set of sockets to return + mySetReady = mySet; + + // Wait until one of the sockets is ready for reading, or timeout is reached + int NbSockets = select(myMaxSocket + 1, &mySetReady, NULL, NULL, Timeout > 0 ? &Time : NULL); + + return NbSockets >= 0 ? static_cast(NbSockets) : 0; +} + + +//////////////////////////////////////////////////////////// +/// After a call to Wait(), get the Index-th socket which is +/// ready for reading. The total number of sockets ready +/// is the integer returned by the previous call to Wait() +//////////////////////////////////////////////////////////// +SocketHelper::SocketType SelectorBase::GetSocketReady(unsigned int Index) +{ + // The standard FD_xxx interface doesn't define a direct access, + // so we must go through the whole set to find the socket we're looking for + for (int i = 0; i < myMaxSocket + 1; ++i) + { + if (FD_ISSET(i, &mySetReady)) + { + // Current socket is ready, but is it the Index-th one ? + if (Index > 0) + { + Index--; + } + else + { + return static_cast(i); + } + } + } + + // Invalid index : return an invalid socket + return SocketHelper::InvalidSocket(); +} + +} // namespace sf diff --git a/src/SFML/Network/SocketTCP.cpp b/src/SFML/Network/SocketTCP.cpp new file mode 100644 index 00000000..b4724737 --- /dev/null +++ b/src/SFML/Network/SocketTCP.cpp @@ -0,0 +1,490 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + + +#ifdef _MSC_VER + #pragma warning(disable : 4127) // "conditional expression is constant" generated by the FD_SET macro +#endif + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SocketTCP::SocketTCP() +{ + Create(SocketHelper::InvalidSocket()); +} + + +//////////////////////////////////////////////////////////// +/// Change the blocking state of the socket +//////////////////////////////////////////////////////////// +void SocketTCP::SetBlocking(bool Blocking) +{ + // Make sure our socket is valid + if (!IsValid()) + Create(); + + SocketHelper::SetBlocking(mySocket, Blocking); + myIsBlocking = Blocking; +} + + +//////////////////////////////////////////////////////////// +/// Connect to another computer on a specified port +//////////////////////////////////////////////////////////// +Socket::Status SocketTCP::Connect(unsigned short Port, const IPAddress& HostAddress, float Timeout) +{ + // Make sure our socket is valid + if (!IsValid()) + Create(); + + // Build the host address + sockaddr_in SockAddr; + memset(SockAddr.sin_zero, 0, sizeof(SockAddr.sin_zero)); + SockAddr.sin_addr.s_addr = inet_addr(HostAddress.ToString().c_str()); + SockAddr.sin_family = AF_INET; + SockAddr.sin_port = htons(Port); + + if (Timeout <= 0) + { + // ----- We're not using a timeout : just try to connect ----- + + if (connect(mySocket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) == -1) + { + // Failed to connect + return SocketHelper::GetErrorStatus(); + } + + // Connection succeeded + return Socket::Done; + } + else + { + // ----- We're using a timeout : we'll need a few tricks to make it work ----- + + // Save the previous blocking state + bool IsBlocking = myIsBlocking; + + // Switch to non-blocking to enable our connection timeout + if (IsBlocking) + SetBlocking(false); + + // Try to connect to host + if (connect(mySocket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) >= 0) + { + // We got instantly connected! (it may no happen a lot...) + return Socket::Done; + } + + // Get the error status + Socket::Status Status = SocketHelper::GetErrorStatus(); + + // If we were in non-blocking mode, return immediatly + if (!IsBlocking) + return Status; + + // Otherwise, wait until something happens to our socket (success, timeout or error) + if (Status == Socket::NotReady) + { + // Setup the selector + fd_set Selector; + FD_ZERO(&Selector); + FD_SET(mySocket, &Selector); + + // Setup the timeout + timeval Time; + Time.tv_sec = static_cast(Timeout); + Time.tv_usec = (static_cast(Timeout * 1000) % 1000) * 1000; + + // Wait for something to write on our socket (would mean the connection has been accepted) + if (select(static_cast(mySocket + 1), NULL, &Selector, NULL, &Time) > 0) + { + // Connection succeeded + Status = Socket::Done; + } + else + { + // Failed to connect before timeout is over + Status = SocketHelper::GetErrorStatus(); + } + } + + // Switch back to blocking mode + SetBlocking(true); + + return Status; + } +} + + +//////////////////////////////////////////////////////////// +/// Listen to a specified port for incoming data or connections +//////////////////////////////////////////////////////////// +bool SocketTCP::Listen(unsigned short Port) +{ + // Make sure our socket is valid + if (!IsValid()) + Create(); + + // Build the address + sockaddr_in SockAddr; + memset(SockAddr.sin_zero, 0, sizeof(SockAddr.sin_zero)); + SockAddr.sin_addr.s_addr = htonl(INADDR_ANY); + SockAddr.sin_family = AF_INET; + SockAddr.sin_port = htons(Port); + + // Bind the socket to the specified port + if (bind(mySocket, reinterpret_cast(&SockAddr), sizeof(SockAddr)) == -1) + { + // Not likely to happen, but... + std::cerr << "Failed to bind socket to port " << Port << std::endl; + return false; + } + + // Listen to the bound port + if (listen(mySocket, 0) == -1) + { + // Oops, socket is deaf + std::cerr << "Failed to listen to port " << Port << std::endl; + return false; + } + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Wait for a connection (must be listening to a port). +/// This function will block if the socket is blocking +//////////////////////////////////////////////////////////// +Socket::Status SocketTCP::Accept(SocketTCP& Connected, IPAddress* Address) +{ + // Address that will be filled with client informations + sockaddr_in ClientAddress; + SocketHelper::LengthType Length = sizeof(ClientAddress); + + // Accept a new connection + Connected = accept(mySocket, reinterpret_cast(&ClientAddress), &Length); + + // Check errors + if (!Connected.IsValid()) + { + if (Address) + *Address = IPAddress(); + + return SocketHelper::GetErrorStatus(); + } + + // Fill address if requested + if (Address) + *Address = IPAddress(inet_ntoa(ClientAddress.sin_addr)); + + return Socket::Done; +} + + +//////////////////////////////////////////////////////////// +/// Send an array of bytes to the host (must be connected first) +//////////////////////////////////////////////////////////// +Socket::Status SocketTCP::Send(const char* Data, std::size_t Size) +{ + // First check that socket is valid + if (!IsValid()) + return Socket::Error; + + // Check parameters + if (Data && Size) + { + // Loop until every byte has been sent + int Sent = 0; + int SizeToSend = static_cast(Size); + for (int Length = 0; Length < SizeToSend; Length += Sent) + { + // Send a chunk of data + Sent = send(mySocket, Data + Length, SizeToSend - Length, 0); + + // Check if an error occured + if (Sent <= 0) + return SocketHelper::GetErrorStatus(); + } + + return Socket::Done; + } + else + { + // Error... + std::cerr << "Cannot send data over the network (invalid parameters)" << std::endl; + return Socket::Error; + } +} + + +//////////////////////////////////////////////////////////// +/// Receive an array of bytes from the host (must be connected first). +/// This function will block if the socket is blocking +//////////////////////////////////////////////////////////// +Socket::Status SocketTCP::Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived) +{ + // First clear the size received + SizeReceived = 0; + + // Check that socket is valid + if (!IsValid()) + return Socket::Error; + + // Check parameters + if (Data && MaxSize) + { + // Receive a chunk of bytes + int Received = recv(mySocket, Data, static_cast(MaxSize), 0); + + // Check the number of bytes received + if (Received > 0) + { + SizeReceived = static_cast(Received); + return Socket::Done; + } + else if (Received == 0) + { + return Socket::Disconnected; + } + else + { + return SocketHelper::GetErrorStatus(); + } + } + else + { + // Error... + std::cerr << "Cannot receive data from the network (invalid parameters)" << std::endl; + return Socket::Error; + } +} + + +//////////////////////////////////////////////////////////// +/// Send a packet of data to the host (must be connected first) +//////////////////////////////////////////////////////////// +Socket::Status SocketTCP::Send(Packet& PacketToSend) +{ + // Get the data to send from the packet + std::size_t DataSize = 0; + const char* Data = PacketToSend.OnSend(DataSize); + + // Send the packet size + Uint32 PacketSize = htonl(static_cast(DataSize)); + Send(reinterpret_cast(&PacketSize), sizeof(PacketSize)); + + // Send the packet data + if (PacketSize > 0) + { + return Send(Data, DataSize); + } + else + { + return Socket::Done; + } +} + + +//////////////////////////////////////////////////////////// +/// Receive a packet from the host (must be connected first). +/// This function will block if the socket is blocking +//////////////////////////////////////////////////////////// +Socket::Status SocketTCP::Receive(Packet& PacketToReceive) +{ + // We start by getting the size of the incoming packet + Uint32 PacketSize = 0; + std::size_t Received = 0; + if (myPendingPacketSize < 0) + { + Socket::Status Status = Receive(reinterpret_cast(&PacketSize), sizeof(PacketSize), Received); + if (Status != Socket::Done) + return Status; + + PacketSize = ntohl(PacketSize); + } + else + { + // There is a pending packet : we already know its size + PacketSize = myPendingPacketSize; + } + + // Then loop until we receive all the packet data + char Buffer[1024]; + while (myPendingPacket.size() < PacketSize) + { + // Receive a chunk of data + std::size_t SizeToGet = std::min(static_cast(PacketSize - myPendingPacket.size()), sizeof(Buffer)); + Socket::Status Status = Receive(Buffer, SizeToGet, Received); + if (Status != Socket::Done) + { + // We must save the size of the pending packet until we can receive its content + if (Status == Socket::NotReady) + myPendingPacketSize = PacketSize; + return Status; + } + + // Append it into the packet + if (Received > 0) + { + myPendingPacket.resize(myPendingPacket.size() + Received); + char* Begin = &myPendingPacket[0] + myPendingPacket.size() - Received; + memcpy(Begin, Buffer, Received); + } + } + + // We have received all the datas : we can copy it to the user packet, and clear our internal packet + PacketToReceive.Clear(); + if (!myPendingPacket.empty()) + PacketToReceive.OnReceive(&myPendingPacket[0], myPendingPacket.size()); + myPendingPacket.clear(); + myPendingPacketSize = -1; + + return Socket::Done; +} + + +//////////////////////////////////////////////////////////// +/// Close the socket +//////////////////////////////////////////////////////////// +bool SocketTCP::Close() +{ + if (IsValid()) + { + if (!SocketHelper::Close(mySocket)) + { + std::cerr << "Failed to close socket" << std::endl; + return false; + } + + mySocket = SocketHelper::InvalidSocket(); + } + + myIsBlocking = true; + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Check if the socket is in a valid state ; this function +/// can be called any time to check if the socket is OK +//////////////////////////////////////////////////////////// +bool SocketTCP::IsValid() const +{ + return mySocket != SocketHelper::InvalidSocket(); +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator == +//////////////////////////////////////////////////////////// +bool SocketTCP::operator ==(const SocketTCP& Other) const +{ + return mySocket == Other.mySocket; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator != +//////////////////////////////////////////////////////////// +bool SocketTCP::operator !=(const SocketTCP& Other) const +{ + return mySocket != Other.mySocket; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator <. +/// Provided for compatibility with standard containers, as +/// comparing two sockets doesn't make much sense... +//////////////////////////////////////////////////////////// +bool SocketTCP::operator <(const SocketTCP& Other) const +{ + return mySocket < Other.mySocket; +} + + +//////////////////////////////////////////////////////////// +/// Construct the socket from a socket descriptor +/// (for internal use only) +//////////////////////////////////////////////////////////// +SocketTCP::SocketTCP(SocketHelper::SocketType Descriptor) +{ + Create(Descriptor); +} + + +//////////////////////////////////////////////////////////// +/// Create the socket +//////////////////////////////////////////////////////////// +void SocketTCP::Create(SocketHelper::SocketType Descriptor) +{ + // Use the given socket descriptor, or get a new one + mySocket = Descriptor ? Descriptor : socket(PF_INET, SOCK_STREAM, 0); + myIsBlocking = true; + + // Reset the pending packet + myPendingPacket.clear(); + myPendingPacketSize = -1; + + // Setup default options + if (IsValid()) + { + // To avoid the "Address already in use" error message when trying to bind to the same port + int Yes = 1; + if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + { + std::cerr << "Failed to set socket option \"SO_REUSEADDR\" ; " + << "binding to a same port may fail if too fast" << std::endl; + } + + // Disable the Nagle algorithm (ie. removes buffering of TCP packets) + if (setsockopt(mySocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + { + std::cerr << "Failed to set socket option \"TCP_NODELAY\" ; " + << "all your TCP packets will be buffered" << std::endl; + } + + // Set blocking by default (should always be the case anyway) + SetBlocking(true); + } +} + +} // namespace sf diff --git a/src/SFML/Network/SocketUDP.cpp b/src/SFML/Network/SocketUDP.cpp new file mode 100644 index 00000000..4e717bfc --- /dev/null +++ b/src/SFML/Network/SocketUDP.cpp @@ -0,0 +1,430 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +SocketUDP::SocketUDP() +{ + Create(); +} + + +//////////////////////////////////////////////////////////// +/// Change the blocking state of the socket +//////////////////////////////////////////////////////////// +void SocketUDP::SetBlocking(bool Blocking) +{ + // Make sure our socket is valid + if (!IsValid()) + Create(); + + SocketHelper::SetBlocking(mySocket, Blocking); + myIsBlocking = Blocking; +} + + +//////////////////////////////////////////////////////////// +/// Bind the socket to a specific port +//////////////////////////////////////////////////////////// +bool SocketUDP::Bind(unsigned short Port) +{ + // Check if the socket is already bound to the specified port + if (myPort != Port) + { + // If the socket was previously bound to another port, we need to unbind it first + Unbind(); + + if (Port != 0) + { + // Build an address with the specified port + sockaddr_in Addr; + Addr.sin_family = AF_INET; + Addr.sin_port = htons(Port); + Addr.sin_addr.s_addr = INADDR_ANY; + memset(Addr.sin_zero, 0, sizeof(Addr.sin_zero)); + + // Bind the socket to the port + if (bind(mySocket, reinterpret_cast(&Addr), sizeof(Addr)) == -1) + { + std::cerr << "Failed to bind the socket to port " << Port << std::endl; + myPort = 0; + return false; + } + } + + // Save the new port + myPort = Port; + } + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Unbind the socket to its previous port +//////////////////////////////////////////////////////////// +bool SocketUDP::Unbind() +{ + // To unbind the socket, we just recreate it + if (myPort != 0) + { + Close(); + Create(); + myPort = 0; + } + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Send an array of bytes +//////////////////////////////////////////////////////////// +Socket::Status SocketUDP::Send(const char* Data, std::size_t Size, const IPAddress& Address, unsigned short Port) +{ + // Make sure the socket is valid + if (!IsValid()) + Create(); + + // Check parameters + if (Data && Size) + { + // Build the target address + sockaddr_in Target; + Target.sin_family = AF_INET; + Target.sin_port = htons(Port); + Target.sin_addr.s_addr = inet_addr(Address.ToString().c_str()); + memset(Target.sin_zero, 0, sizeof(Target.sin_zero)); + + // Loop until every byte has been sent + int Sent = 0; + int SizeToSend = static_cast(Size); + for (int Length = 0; Length < SizeToSend; Length += Sent) + { + // Send a chunk of data + Sent = sendto(mySocket, Data + Length, SizeToSend - Length, 0, reinterpret_cast(&Target), sizeof(Target)); + + // Check errors + if (Sent <= 0) + return SocketHelper::GetErrorStatus(); + } + + return Socket::Done; + } + else + { + // Error... + std::cerr << "Cannot send data over the network (invalid parameters)" << std::endl; + return Socket::Error; + } +} + + +//////////////////////////////////////////////////////////// +/// Receive an array of bytes. +/// This function will block if the socket is blocking +//////////////////////////////////////////////////////////// +Socket::Status SocketUDP::Receive(char* Data, std::size_t MaxSize, std::size_t& SizeReceived, IPAddress& Address, unsigned short& Port) +{ + // First clear the size received + SizeReceived = 0; + + // Make sure the socket is bound to a port + if (myPort == 0) + { + std::cerr << "Failed to receive data ; the UDP socket first needs to be bound to a port" << std::endl; + return Socket::Error; + } + + // Make sure the socket is valid + if (!IsValid()) + Create(); + + // Check parameters + if (Data && MaxSize) + { + // Data that will be filled with the other computer's address + sockaddr_in Sender; + Sender.sin_family = AF_INET; + Sender.sin_port = 0; + Sender.sin_addr.s_addr = INADDR_ANY; + memset(Sender.sin_zero, 0, sizeof(Sender.sin_zero)); + SocketHelper::LengthType SenderSize = sizeof(Sender); + + // Receive a chunk of bytes + int Received = recvfrom(mySocket, Data, static_cast(MaxSize), 0, reinterpret_cast(&Sender), &SenderSize); + + // Check the number of bytes received + if (Received > 0) + { + Address = IPAddress(inet_ntoa(Sender.sin_addr)); + Port = ntohs(Sender.sin_port); + SizeReceived = static_cast(Received); + return Socket::Done; + } + else + { + Address = IPAddress(); + Port = 0; + return Received == 0 ? Socket::Disconnected : SocketHelper::GetErrorStatus(); + } + } + else + { + // Error... + std::cerr << "Cannot receive data from the network (invalid parameters)" << std::endl; + return Socket::Error; + } +} + + +//////////////////////////////////////////////////////////// +/// Send a packet of data +//////////////////////////////////////////////////////////// +Socket::Status SocketUDP::Send(Packet& PacketToSend, const IPAddress& Address, unsigned short Port) +{ + // Get the data to send from the packet + std::size_t DataSize = 0; + const char* Data = PacketToSend.OnSend(DataSize); + + // Send the packet size + Uint32 PacketSize = htonl(static_cast(DataSize)); + Send(reinterpret_cast(&PacketSize), sizeof(PacketSize), Address, Port); + + // Send the packet data + if (PacketSize > 0) + { + return Send(Data, DataSize, Address, Port); + } + else + { + return Socket::Done; + } +} + + +//////////////////////////////////////////////////////////// +/// Receive a packet. +/// This function will block if the socket is blocking +//////////////////////////////////////////////////////////// +Socket::Status SocketUDP::Receive(Packet& PacketToReceive, IPAddress& Address, unsigned short& Port) +{ + // This is not safe at all, as data can be lost, duplicated, or arrive in a different order. + // So if a packet is split into more than one chunk, nobody knows what could happen... + // Conclusion : we shouldn't use packets with UDP, unless we build a more complex protocol on top of it. + + // We start by getting the size of the incoming packet + Uint32 PacketSize = 0; + std::size_t Received = 0; + if (myPendingPacketSize < 0) + { + Socket::Status Status = Receive(reinterpret_cast(&PacketSize), sizeof(PacketSize), Received, Address, Port); + if (Status != Socket::Done) + return Status; + + PacketSize = ntohl(PacketSize); + } + else + { + // There is a pending packet : we already know its size + PacketSize = myPendingPacketSize; + } + + // Clear the user packet + PacketToReceive.Clear(); + + // Use another address instance for receiving the packet data ; + // chunks of data coming from a different sender will be discarded (and lost...) + IPAddress Sender; + unsigned short SenderPort; + + // Then loop until we receive all the packet data + char Buffer[1024]; + while (myPendingPacket.size() < PacketSize) + { + // Receive a chunk of data + std::size_t SizeToGet = std::min(static_cast(PacketSize - myPendingPacket.size()), sizeof(Buffer)); + Socket::Status Status = Receive(Buffer, SizeToGet, Received, Sender, SenderPort); + if (Status != Socket::Done) + { + // We must save the size of the pending packet until we can receive its content + if (Status == Socket::NotReady) + myPendingPacketSize = PacketSize; + return Status; + } + + // Append it into the packet + if ((Sender == Address) && (SenderPort == Port) && (Received > 0)) + { + myPendingPacket.resize(myPendingPacket.size() + Received); + char* Begin = &myPendingPacket[0] + myPendingPacket.size() - Received; + memcpy(Begin, Buffer, Received); + } + } + + // We have received all the datas : we can copy it to the user packet, and clear our internal packet + PacketToReceive.Clear(); + if (!myPendingPacket.empty()) + PacketToReceive.OnReceive(&myPendingPacket[0], myPendingPacket.size()); + myPendingPacket.clear(); + myPendingPacketSize = -1; + + return Socket::Done; +} + + +//////////////////////////////////////////////////////////// +/// Close the socket +//////////////////////////////////////////////////////////// +bool SocketUDP::Close() +{ + if (IsValid()) + { + if (!SocketHelper::Close(mySocket)) + { + std::cerr << "Failed to close socket" << std::endl; + return false; + } + + mySocket = SocketHelper::InvalidSocket(); + } + + myPort = 0; + myIsBlocking = true; + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Check if the socket is in a valid state ; this function +/// can be called any time to check if the socket is OK +//////////////////////////////////////////////////////////// +bool SocketUDP::IsValid() const +{ + return mySocket != SocketHelper::InvalidSocket(); +} + + +//////////////////////////////////////////////////////////// +/// Get the port the socket is currently bound to +//////////////////////////////////////////////////////////// +unsigned short SocketUDP::GetPort() const +{ + return myPort; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator == +//////////////////////////////////////////////////////////// +bool SocketUDP::operator ==(const SocketUDP& Other) const +{ + return mySocket == Other.mySocket; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator != +//////////////////////////////////////////////////////////// +bool SocketUDP::operator !=(const SocketUDP& Other) const +{ + return mySocket != Other.mySocket; +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator <. +/// Provided for compatibility with standard containers, as +/// comparing two sockets doesn't make much sense... +//////////////////////////////////////////////////////////// +bool SocketUDP::operator <(const SocketUDP& Other) const +{ + return mySocket < Other.mySocket; +} + + +//////////////////////////////////////////////////////////// +/// Construct the socket from a socket descriptor +/// (for internal use only) +//////////////////////////////////////////////////////////// +SocketUDP::SocketUDP(SocketHelper::SocketType Descriptor) +{ + Create(Descriptor); +} + + +//////////////////////////////////////////////////////////// +/// Create the socket +//////////////////////////////////////////////////////////// +void SocketUDP::Create(SocketHelper::SocketType Descriptor) +{ + // Use the given socket descriptor, or get a new one + mySocket = Descriptor ? Descriptor : socket(PF_INET, SOCK_DGRAM, 0); + myIsBlocking = true; + + // Clear the last port used + myPort = 0; + + // Reset the pending packet + myPendingPacket.clear(); + myPendingPacketSize = -1; + + // Setup default options + if (IsValid()) + { + // To avoid the "Address already in use" error message when trying to bind to the same port + int Yes = 1; + if (setsockopt(mySocket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + { + std::cerr << "Failed to set socket option \"reuse address\" ; " + << "binding to a same port may fail if too fast" << std::endl; + } + + // Enable broadcast by default + if (setsockopt(mySocket, SOL_SOCKET, SO_BROADCAST, reinterpret_cast(&Yes), sizeof(Yes)) == -1) + { + std::cerr << "Failed to enable broadcast on UDP socket" << std::endl; + } + + // Set blocking by default (should always be the case anyway) + SetBlocking(true); + } +} + +} // namespace sf diff --git a/src/SFML/Network/Unix/SocketHelper.cpp b/src/SFML/Network/Unix/SocketHelper.cpp new file mode 100644 index 00000000..a96836bb --- /dev/null +++ b/src/SFML/Network/Unix/SocketHelper.cpp @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Return the value of the invalid socket +//////////////////////////////////////////////////////////// +SocketHelper::SocketType SocketHelper::InvalidSocket() +{ + return -1; +} + + +//////////////////////////////////////////////////////////// +/// Close / destroy a socket +//////////////////////////////////////////////////////////// +bool SocketHelper::Close(SocketHelper::SocketType Socket) +{ + return close(Socket) != -1; +} + + +//////////////////////////////////////////////////////////// +/// Set a socket as blocking or non-blocking +//////////////////////////////////////////////////////////// +void SocketHelper::SetBlocking(SocketHelper::SocketType Socket, bool Block) +{ + int Status = fcntl(Socket, F_GETFL); + if (Block) + fcntl(Socket, F_SETFL, Status & ~O_NONBLOCK); + else + fcntl(Socket, F_SETFL, Status | O_NONBLOCK); +} + + +//////////////////////////////////////////////////////////// +/// Get the last socket error status +//////////////////////////////////////////////////////////// +Socket::Status SocketHelper::GetErrorStatus() +{ + // The followings are sometimes equal to EWOULDBLOCK, + // so we have to make a special case for them in order + // to avoid having double values in the switch case + if ((errno == EAGAIN) || (errno == EINPROGRESS)) + return Socket::NotReady; + + switch (errno) + { + case EWOULDBLOCK : return Socket::NotReady; + case ECONNABORTED : return Socket::Disconnected; + case ECONNRESET : return Socket::Disconnected; + case ETIMEDOUT : return Socket::Disconnected; + case ENETRESET : return Socket::Disconnected; + case ENOTCONN : return Socket::Disconnected; + default : return Socket::Error; + } +} + +} // namespace sf diff --git a/src/SFML/Network/Win32/SocketHelper.cpp b/src/SFML/Network/Win32/SocketHelper.cpp new file mode 100644 index 00000000..972aeb77 --- /dev/null +++ b/src/SFML/Network/Win32/SocketHelper.cpp @@ -0,0 +1,100 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Return the value of the invalid socket +//////////////////////////////////////////////////////////// +SocketHelper::SocketType SocketHelper::InvalidSocket() +{ + return INVALID_SOCKET; +} + + +//////////////////////////////////////////////////////////// +/// Close / destroy a socket +//////////////////////////////////////////////////////////// +bool SocketHelper::Close(SocketHelper::SocketType Socket) +{ + return closesocket(Socket) != -1; +} + + +//////////////////////////////////////////////////////////// +/// Set a socket as blocking or non-blocking +//////////////////////////////////////////////////////////// +void SocketHelper::SetBlocking(SocketHelper::SocketType Socket, bool Block) +{ + unsigned long Blocking = Block ? 0 : 1; + ioctlsocket(Socket, FIONBIO, &Blocking); +} + + +//////////////////////////////////////////////////////////// +/// Get the last socket error status +//////////////////////////////////////////////////////////// +Socket::Status SocketHelper::GetErrorStatus() +{ + switch (WSAGetLastError()) + { + case WSAEWOULDBLOCK : return Socket::NotReady; + case WSAECONNABORTED : return Socket::Disconnected; + case WSAECONNRESET : return Socket::Disconnected; + case WSAETIMEDOUT : return Socket::Disconnected; + case WSAENETRESET : return Socket::Disconnected; + case WSAENOTCONN : return Socket::Disconnected; + default : return Socket::Error; + } +} + + +//////////////////////////////////////////////////////////// +// Windows needs some initialization and cleanup to get +// sockets working properly... so let's create a class that will +// do it automatically +//////////////////////////////////////////////////////////// +struct SocketInitializer +{ + SocketInitializer() + { + WSADATA InitData; + WSAStartup(MAKEWORD(2,2), &InitData); + } + + ~SocketInitializer() + { + WSACleanup(); + } +}; + +SocketInitializer GlobalInitializer; + +} // namespace sf diff --git a/src/SFML/System/Clock.cpp b/src/SFML/System/Clock.cpp new file mode 100644 index 00000000..1cbb5d9f --- /dev/null +++ b/src/SFML/System/Clock.cpp @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Clock::Clock() +{ + Reset(); +} + + +//////////////////////////////////////////////////////////// +/// Get the time elapsed since last reset +//////////////////////////////////////////////////////////// +float Clock::GetElapsedTime() const +{ + return static_cast(sf::priv::Platform::GetSystemTime() - myStartTime); +} + + +//////////////////////////////////////////////////////////// +/// Restart the timer +//////////////////////////////////////////////////////////// +void Clock::Reset() +{ + myStartTime = sf::priv::Platform::GetSystemTime(); +} + +} // namespace sf diff --git a/src/SFML/System/Lock.cpp b/src/SFML/System/Lock.cpp new file mode 100644 index 00000000..c31de5c0 --- /dev/null +++ b/src/SFML/System/Lock.cpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Construct the lock with a target mutex (lock it) +//////////////////////////////////////////////////////////// +Lock::Lock(Mutex& Mutex) : +myMutex(Mutex) +{ + myMutex.Lock(); +} + + +//////////////////////////////////////////////////////////// +/// Destructor (unlocks the mutex) +//////////////////////////////////////////////////////////// +Lock::~Lock() +{ + myMutex.Unlock(); +} + +} // namespace sf diff --git a/src/SFML/System/Makefile b/src/SFML/System/Makefile new file mode 100644 index 00000000..04514f5b --- /dev/null +++ b/src/SFML/System/Makefile @@ -0,0 +1,34 @@ +SRC = $(wildcard *.cpp ./Unix/*.cpp) +OBJ = $(SRC:.cpp=.o) + +ifeq ($(STATIC), yes) + LIB = libsfml-system-s.a + LIBNAME = $(LIBPATH)/$(LIB) + INSTALL = +else + LIB = libsfml-system.so + LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + INSTALL = && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) +endif + +all: $(LIB) + +libsfml-system-s.a: $(OBJ) + $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) + +libsfml-system.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lpthread + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) diff --git a/src/SFML/System/Platform.hpp b/src/SFML/System/Platform.hpp new file mode 100644 index 00000000..f716f166 --- /dev/null +++ b/src/SFML/System/Platform.hpp @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PLATFORM_HPP +#define SFML_PLATFORM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +#if defined(SFML_SYSTEM_WINDOWS) + + #include + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_MACOS) || defined(SFML_SYSTEM_FREEBSD) + + #include + +#endif + + +#endif // SFML_PLATFORM_HPP diff --git a/src/SFML/System/Randomizer.cpp b/src/SFML/System/Randomizer.cpp new file mode 100644 index 00000000..a3266fd6 --- /dev/null +++ b/src/SFML/System/Randomizer.cpp @@ -0,0 +1,96 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace +{ + // Set the random numbers sequence seed with the current system time, so that it is always different + unsigned int SetRandomSeed() + { + unsigned int Seed = static_cast(sf::priv::Platform::GetSystemTime() * 1000); + srand(Seed); + return Seed; + } +} + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Static member variables +//////////////////////////////////////////////////////////// +unsigned int Randomizer::ourSeed = SetRandomSeed(); + + +//////////////////////////////////////////////////////////// +/// Set the seed for the generator. Using a known seed +/// allows you to reproduce the same sequence of random number +//////////////////////////////////////////////////////////// +void Randomizer::SetSeed(unsigned int Seed) +{ + srand(Seed); + ourSeed = Seed; +} + + +//////////////////////////////////////////////////////////// +/// Get the seed used to generate random numbers the generator. +//////////////////////////////////////////////////////////// +unsigned int Randomizer::GetSeed() +{ + return ourSeed; +} + + +//////////////////////////////////////////////////////////// +/// Get a random float number in a given range +//////////////////////////////////////////////////////////// +float Randomizer::Random(float Begin, float End) +{ + // This is not the best algorithm, but it is fast and will be enough in most cases + // (see Google for best approaches) + + return static_cast(rand()) / RAND_MAX * (End - Begin) + Begin; +} + + +//////////////////////////////////////////////////////////// +/// Get a random integer number in a given range +//////////////////////////////////////////////////////////// +int Randomizer::Random(int Begin, int End) +{ + // This is not the best algorithm, but it is fast and will be enough in most cases + // (see Google for best approaches) + + return rand() % (End - Begin + 1) + Begin; +} + +} // namespace sf diff --git a/src/SFML/System/Sleep.cpp b/src/SFML/System/Sleep.cpp new file mode 100644 index 00000000..1c220541 --- /dev/null +++ b/src/SFML/System/Sleep.cpp @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Make the current thread sleep for a given time +//////////////////////////////////////////////////////////// +void Sleep(float Duration) +{ + priv::Platform::Sleep(Duration); +} + +} // namespace sf diff --git a/src/SFML/System/Unicode.cpp b/src/SFML/System/Unicode.cpp new file mode 100644 index 00000000..0b534527 --- /dev/null +++ b/src/SFML/System/Unicode.cpp @@ -0,0 +1,300 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +// References : +// +// http://www.unicode.org/ +// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c +// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h +// http://people.w3.org/rishida/scripts/uniview/conversion +// +//////////////////////////////////////////////////////////// + +namespace +{ + //////////////////////////////////////////////////////////// + // Generic utility function to compute the number + // of characters in a null-terminated string of any type + //////////////////////////////////////////////////////////// + template + std::size_t StrLen(const T* Str) + { + std::size_t Length = 0; + while (*Str++) Length++; + return Length; + } + + //////////////////////////////////////////////////////////// + // Get the current system locale + //////////////////////////////////////////////////////////// + std::locale GetCurrentLocale() + { + try + { + return std::locale(""); + } + catch (std::runtime_error&) + { + // It seems some implementations don't know the "" locale + // (Mac OS, MinGW) + + return std::locale(); + } + } +} + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +const char Unicode::UTF8TrailingBytes[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 +}; +const Uint32 Unicode::UTF8Offsets[6] = +{ + 0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080 +}; +const Uint8 Unicode::UTF8FirstBytes[7] = +{ + 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC +}; + + +//////////////////////////////////////////////////////////// +/// Default constructor (empty text) +//////////////////////////////////////////////////////////// +Unicode::Text::Text() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Construct the unicode text from any type of string +//////////////////////////////////////////////////////////// +Unicode::Text::Text(const char* Str) +{ + if (Str) + { + std::size_t Length = StrLen(Str); + if (Length > 0) + { + myUTF32String.reserve(Length + 1); + Unicode::ANSIToUTF32(Str, Str + Length, std::back_inserter(myUTF32String)); + } + } +} +Unicode::Text::Text(const wchar_t* Str) +{ + if (Str) + { + std::size_t Length = StrLen(Str); + if (Length > 0) + { + // See comments below, in Unicode::Text::Text(const std::wstring&) + myUTF32String.reserve(Length + 1); + switch (sizeof(wchar_t)) + { + case 2 : Unicode::UTF16ToUTF32(Str, Str + Length, std::back_inserter(myUTF32String), 0); break; + case 4 : std::copy(Str, Str + Length, std::back_inserter(myUTF32String)); break; + default : break; + } + } + } +} +Unicode::Text::Text(const Uint8* Str) +{ + if (Str) + { + std::size_t Length = StrLen(Str); + if (Length > 0) + { + myUTF32String.reserve(Length + 1); + Unicode::UTF8ToUTF32(Str, Str + Length, std::back_inserter(myUTF32String), 0); + } + } +} +Unicode::Text::Text(const Uint16* Str) +{ + if (Str) + { + std::size_t Length = StrLen(Str); + if (Length > 0) + { + myUTF32String.reserve(Length+ 1); + Unicode::UTF16ToUTF32(Str, Str + Length, std::back_inserter(myUTF32String), 0); + } + } +} +Unicode::Text::Text(const Uint32* Str) +{ + if (Str) + myUTF32String = Str; +} +Unicode::Text::Text(const std::string& Str) +{ + myUTF32String.reserve(Str.length() + 1); + Unicode::ANSIToUTF32(Str.begin(), Str.end(), std::back_inserter(myUTF32String)); +} +Unicode::Text::Text(const std::wstring& Str) +{ + // This function assumes that 2-byte large wchar_t are encoded in UTF-16 (Windows), and + // 4-byte large wchar_t are encoded using UTF-32 (Unix) + // Is that always true ? (some platforms may use JIS Japanese encoding) + // The macro __STDC_ISO_10646__ should help identifying UTF-32 compliant implementations + + myUTF32String.reserve(Str.length() + 1); + + // Select the proper function according to the (supposed) wchar_t system encoding + switch (sizeof(wchar_t)) + { + // wchar_t uses UTF-16 -- need a conversion + case 2 : + { + Unicode::UTF16ToUTF32(Str.begin(), Str.end(), std::back_inserter(myUTF32String), 0); + break; + } + + // wchar_t uses UTF-32 -- direct copy + case 4 : + { + std::copy(Str.begin(), Str.end(), std::back_inserter(myUTF32String)); + break; + } + + // This should never happen + default : break; + } +} +Unicode::Text::Text(const Unicode::UTF8String& Str) +{ + myUTF32String.reserve(Str.length() + 1); + Unicode::UTF8ToUTF32(Str.begin(), Str.end(), std::back_inserter(myUTF32String), 0); +} +Unicode::Text::Text(const Unicode::UTF16String& Str) +{ + myUTF32String.reserve(Str.length() + 1); + Unicode::UTF16ToUTF32(Str.begin(), Str.end(), std::back_inserter(myUTF32String), 0); +} +Unicode::Text::Text(const Unicode::UTF32String& Str) +{ + myUTF32String = Str; +} + + +//////////////////////////////////////////////////////////// +/// Operator to cast the text to any type of string +//////////////////////////////////////////////////////////// +Unicode::Text::operator std::string() const +{ + std::string Output; + Output.reserve(myUTF32String.length() + 1); + Unicode::UTF32ToANSI(myUTF32String.begin(), myUTF32String.end(), std::back_inserter(Output), 0, Unicode::GetDefaultLocale()); + return Output; +} +Unicode::Text::operator std::wstring() const +{ + // This function assumes that 2-byte large wchar_t are encoded in UTF-16 (Windows), and + // 4-byte large wchar_t are encoded using UTF-32 (Unix) + // Is that always true ? (some platforms may use JIS Japanese encoding) + // The macro __STDC_ISO_10646__ should help identifying UTF-32 compliant implementations + + std::wstring Output; + Output.reserve(myUTF32String.length() + 1); + + // Select the proper function according to the (supposed) wchar_t system encoding + switch (sizeof(wchar_t)) + { + // wchar_t uses UTF-16 -- need a conversion + case 2 : + { + UTF32ToUTF16(myUTF32String.begin(), myUTF32String.end(), std::back_inserter(Output), 0); + break; + } + + // wchar_t uses UTF-32 -- direct copy + case 4 : + { + std::copy(myUTF32String.begin(), myUTF32String.end(), std::back_inserter(Output)); + break; + } + + // This should never happen + default : break; + } + return Output; +} +Unicode::Text::operator sf::Unicode::UTF8String() const +{ + Unicode::UTF8String Output; + Output.reserve(myUTF32String.length() * 4 + 1); + Unicode::UTF32ToUTF8(myUTF32String.begin(), myUTF32String.end(), std::back_inserter(Output), 0); + return Output; +} +Unicode::Text::operator sf::Unicode::UTF16String() const +{ + Unicode::UTF16String Output; + Output.reserve(myUTF32String.length() * 2 + 1); + Unicode::UTF32ToUTF16(myUTF32String.begin(), myUTF32String.end(), std::back_inserter(Output), 0); + return Output; +} +Unicode::Text::operator const sf::Unicode::UTF32String&() const +{ + return myUTF32String; +} + + +//////////////////////////////////////////////////////////// +/// Get the default system locale +//////////////////////////////////////////////////////////// +const std::locale& Unicode::GetDefaultLocale() +{ + // It seems getting the default locale is a very expensive operation, + // so we only do it once and then store the locale for reuse. + // Warning : this code won't be aware of any change of the default locale during runtime + + static std::locale DefaultLocale = GetCurrentLocale(); + + return DefaultLocale; +} + +} // namespace sf diff --git a/src/SFML/System/Unix/Mutex.cpp b/src/SFML/System/Unix/Mutex.cpp new file mode 100644 index 00000000..9614361d --- /dev/null +++ b/src/SFML/System/Unix/Mutex.cpp @@ -0,0 +1,68 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Mutex::Mutex() +{ + pthread_mutex_init(&myMutex, NULL); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Mutex::~Mutex() +{ + pthread_mutex_destroy(&myMutex); +} + + +//////////////////////////////////////////////////////////// +/// Lock the mutex +//////////////////////////////////////////////////////////// +void Mutex::Lock() +{ + pthread_mutex_lock(&myMutex); +} + + +//////////////////////////////////////////////////////////// +/// Unlock the mutex +//////////////////////////////////////////////////////////// +void Mutex::Unlock() +{ + pthread_mutex_unlock(&myMutex); +} + +} // namespace sf diff --git a/src/SFML/System/Unix/Platform.cpp b/src/SFML/System/Unix/Platform.cpp new file mode 100644 index 00000000..0149c361 --- /dev/null +++ b/src/SFML/System/Unix/Platform.cpp @@ -0,0 +1,58 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get the current system time +//////////////////////////////////////////////////////////// +double Platform::GetSystemTime() +{ + timeval Time = {0, 0}; + gettimeofday(&Time, NULL); + + return Time.tv_sec + Time.tv_usec / 1000000.; +} + + +//////////////////////////////////////////////////////////// +/// Suspend the execution of the current thread for a specified time +//////////////////////////////////////////////////////////// +void Platform::Sleep(float Time) +{ + usleep(static_cast(Time * 1000000)); +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/System/Unix/Platform.hpp b/src/SFML/System/Unix/Platform.hpp new file mode 100644 index 00000000..0cd09904 --- /dev/null +++ b/src/SFML/System/Unix/Platform.hpp @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PLATFORMUNIX_HPP +#define SFML_PLATFORMUNIX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Unix implementation fo Platform +/// Give access to various global system functions +//////////////////////////////////////////////////////////// +class Platform +{ +public : + + //////////////////////////////////////////////////////////// + /// Get the current system time + /// + /// \return System time, in seconds + /// + //////////////////////////////////////////////////////////// + static double GetSystemTime(); + + //////////////////////////////////////////////////////////// + /// Suspend the execution of the current thread for a specified time + /// + /// \param Time : Time to sleep, in seconds + /// + //////////////////////////////////////////////////////////// + static void Sleep(float Time); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_PLATFORMUNIX_HPP diff --git a/src/SFML/System/Unix/Thread.cpp b/src/SFML/System/Unix/Thread.cpp new file mode 100644 index 00000000..3268f610 --- /dev/null +++ b/src/SFML/System/Unix/Thread.cpp @@ -0,0 +1,146 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Thread::Thread() : +myIsActive(false), +myFunction(NULL), +myUserData(NULL) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the thread from a function pointer +//////////////////////////////////////////////////////////// +Thread::Thread(Thread::FuncType Function, void* UserData) : +myIsActive(false), +myFunction(Function), +myUserData(UserData) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +Thread::~Thread() +{ + // Wait for the thread to finish before destroying the instance + if (myIsActive) + Wait(); +} + + +//////////////////////////////////////////////////////////// +/// Create and run the thread +//////////////////////////////////////////////////////////// +void Thread::Launch() +{ + // Create the thread + myIsActive = true; + int Error = pthread_create(&myThread, NULL, &Thread::ThreadFunc, this); + + // Error ? + if (Error != 0) + { + std::cerr << "Failed to create thread" << std::endl; + myIsActive = false; + } +} + + +//////////////////////////////////////////////////////////// +/// Wait until the thread finishes +//////////////////////////////////////////////////////////// +void Thread::Wait() +{ + if (myIsActive) + { + // Wait for the thread to finish, no timeout + pthread_join(myThread, NULL); + + // Reset the thread state + myIsActive = false; + } +} + + +//////////////////////////////////////////////////////////// +/// Terminate the thread +/// Terminating a thread with this function is not safe, +/// you should rather try to make the thread function +/// terminate by itself +//////////////////////////////////////////////////////////// +void Thread::Terminate() +{ + if (myIsActive) + { + pthread_cancel(myThread); + myIsActive = false; + } +} + + +//////////////////////////////////////////////////////////// +/// Function called as the thread entry point +//////////////////////////////////////////////////////////// +void Thread::Run() +{ + if (myFunction) + myFunction(myUserData); +} + + +//////////////////////////////////////////////////////////// +/// Actual thread entry point, dispatches to instances +//////////////////////////////////////////////////////////// +void* Thread::ThreadFunc(void* UserData) +{ + // The sfThread instance is stored in the user data + Thread* ThreadToRun = reinterpret_cast(UserData); + + // Tell the thread to handle cancel requests immediatly + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + + // Forward to the instance + ThreadToRun->Run(); + + return NULL; +} + +} // namespace sf diff --git a/src/SFML/System/Win32/Mutex.cpp b/src/SFML/System/Win32/Mutex.cpp new file mode 100644 index 00000000..6817a2a1 --- /dev/null +++ b/src/SFML/System/Win32/Mutex.cpp @@ -0,0 +1,68 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Mutex::Mutex() +{ + InitializeCriticalSection(&myHandle); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Mutex::~Mutex() +{ + DeleteCriticalSection(&myHandle); +} + + +//////////////////////////////////////////////////////////// +/// Lock the mutex +//////////////////////////////////////////////////////////// +void Mutex::Lock() +{ + EnterCriticalSection(&myHandle); +} + + +//////////////////////////////////////////////////////////// +/// Unlock the mutex +//////////////////////////////////////////////////////////// +void Mutex::Unlock() +{ + LeaveCriticalSection(&myHandle); +} + +} // namespace sf diff --git a/src/SFML/System/Win32/Platform.cpp b/src/SFML/System/Win32/Platform.cpp new file mode 100644 index 00000000..2a9c0842 --- /dev/null +++ b/src/SFML/System/Win32/Platform.cpp @@ -0,0 +1,70 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get the current system time +//////////////////////////////////////////////////////////// +double Platform::GetSystemTime() +{ + static LARGE_INTEGER Frequency; + static BOOL UseHighPerformanceTimer = QueryPerformanceFrequency(&Frequency); + + if (UseHighPerformanceTimer) + { + // High performance counter available : use it + LARGE_INTEGER CurrentTime; + QueryPerformanceCounter(&CurrentTime); + + return static_cast(CurrentTime.QuadPart) / Frequency.QuadPart; + } + else + { + // High performance counter not available : use GetTickCount (less accurate) + return GetTickCount() * 0.001; + } +} + + +//////////////////////////////////////////////////////////// +/// Suspend the execution of the current thread for a specified time +//////////////////////////////////////////////////////////// +void Platform::Sleep(float Time) +{ + ::Sleep(static_cast(Time * 1000)); +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/System/Win32/Platform.hpp b/src/SFML/System/Win32/Platform.hpp new file mode 100644 index 00000000..58c096b8 --- /dev/null +++ b/src/SFML/System/Win32/Platform.hpp @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PLATFORMWIN32_HPP +#define SFML_PLATFORMWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Win32 implementation of Platform. +/// Gives access to various global system functions +//////////////////////////////////////////////////////////// +class Platform +{ +public : + + //////////////////////////////////////////////////////////// + /// Get the current system time + /// + /// \return System time, in seconds + /// + //////////////////////////////////////////////////////////// + static double GetSystemTime(); + + //////////////////////////////////////////////////////////// + /// Suspend the execution of the current thread for a specified time + /// + /// \param Time : Time to sleep, in seconds + /// + //////////////////////////////////////////////////////////// + static void Sleep(float Time); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_PLATFORMWIN32_HPP diff --git a/src/SFML/System/Win32/Thread.cpp b/src/SFML/System/Win32/Thread.cpp new file mode 100644 index 00000000..67afb26b --- /dev/null +++ b/src/SFML/System/Win32/Thread.cpp @@ -0,0 +1,144 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Thread::Thread() : +myHandle (NULL), +myFunction(NULL), +myUserData(NULL) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the thread from a function pointer +//////////////////////////////////////////////////////////// +Thread::Thread(Thread::FuncType Function, void* UserData) : +myHandle (NULL), +myFunction(Function), +myUserData(UserData) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Virtual destructor +//////////////////////////////////////////////////////////// +Thread::~Thread() +{ + // Wait for the thread to finish before destroying the instance + if (myHandle) + Wait(); +} + + +//////////////////////////////////////////////////////////// +/// Create and run the thread +//////////////////////////////////////////////////////////// +void Thread::Launch() +{ + // Create the thread + myHandle = reinterpret_cast(_beginthreadex(NULL, 0, &Thread::ThreadFunc, this, 0, NULL)); + + // Error ? + if (myHandle == NULL) + std::cerr << "Failed to create thread" << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Wait until the thread finishes +//////////////////////////////////////////////////////////// +void Thread::Wait() +{ + if (myHandle) + { + // Wait for the thread to finish, no timeout + WaitForSingleObject(myHandle, INFINITE); + + // Don't forget to close the thread handle (__endthreadex doesn't do it) + CloseHandle(myHandle); + myHandle = NULL; + } +} + + +//////////////////////////////////////////////////////////// +/// Terminate the thread +/// Terminating a thread with this function is not safe, +/// you should rather try to make the thread function +/// terminate by itself +//////////////////////////////////////////////////////////// +void Thread::Terminate() +{ + if (myHandle) + { + TerminateThread(myHandle, 0); + myHandle = NULL; + } +} + + +//////////////////////////////////////////////////////////// +/// Function called as the thread entry point +//////////////////////////////////////////////////////////// +void Thread::Run() +{ + if (myFunction) + myFunction(myUserData); +} + + +//////////////////////////////////////////////////////////// +/// Actual thread entry point, dispatches to instances +//////////////////////////////////////////////////////////// +unsigned int __stdcall Thread::ThreadFunc(void* UserData) +{ + // The Thread instance is stored in the user data + Thread* ThreadInstance = reinterpret_cast(UserData); + + // Forward to the instance + ThreadInstance->Run(); + + // Optional, but it is cleaner + _endthreadex(0); + + return 0; +} + +} // namespace sf diff --git a/src/SFML/Window/Cocoa/AppController.h b/src/SFML/Window/Cocoa/AppController.h new file mode 100644 index 00000000..365afc9d --- /dev/null +++ b/src/SFML/Window/Cocoa/AppController.h @@ -0,0 +1,121 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#import +#import +#import +#import +#import +#import + + +#define SharedAppController [AppController sharedController] + +// Fade operations +enum { + FillScreen, + CleanScreen +}; + + +@interface AppController : NSObject { + // Note: objc allocation doesn't call C++ constructor + std::vector *windows; + + NSAutoreleasePool *mainPool; + sf::Clock *cleaner; + sf::VideoMode desktopMode; + sf::VideoMode prevMode; +} + +//////////////////////////////////////////////////////////// +/// Return the shared AppController object. Makes one if needed +//////////////////////////////////////////////////////////// ++ (AppController *)sharedController; + +//////////////////////////////////////////////////////////// +/// Reallocate main pool to release autoreleased objects +//////////////////////////////////////////////////////////// +- (void)resetPool; + +//////////////////////////////////////////////////////////// +/// Register our application and launch it if needed +//////////////////////////////////////////////////////////// +- (void)runApplication; + +//////////////////////////////////////////////////////////// +/// Terminate the current running application +//////////////////////////////////////////////////////////// +- (void)quitApplication:(id)sender; + +//////////////////////////////////////////////////////////// +/// Make menu bar +//////////////////////////////////////////////////////////// +- (void)makeMenuBar; + +//////////////////////////////////////////////////////////// +/// Get the events and put them into an array for each window +//////////////////////////////////////////////////////////// +- (void)processEvents; + +//////////////////////////////////////////////////////////// +/// Add the 'windowImplObj' object to the list of known windows +//////////////////////////////////////////////////////////// +- (void)registerWindow:(sf::priv::WindowImplCocoa *)windowImplObj; + +//////////////////////////////////////////////////////////// +/// Remove the 'windowImplObj' object from the list of known windows +//////////////////////////////////////////////////////////// +- (void)unregisterWindow:(sf::priv::WindowImplCocoa *)windowImplObj; + +//////////////////////////////////////////////////////////// +/// Return true is one of the registered window is a full screen one +//////////////////////////////////////////////////////////// +- (bool)isUsingFullscreen; + +//////////////////////////////////////////////////////////// +/// Perform fade operation where 'operation' is one of { FillScreen, CleanScreen} +/// and 'time' is the time during which you wish the operation to be performed. +/// Set 'sync' to true if you do not want the method to end before the end +/// of the fade operation. Pass the last used token or a new one if you are +/// using this method for the first time. This lets the method release some +/// resources when doing CleanScreen operation. +//////////////////////////////////////////////////////////// +- (void)doFadeOperation:(int)operation time:(float)time sync:(bool)sync token:(CGDisplayFadeReservationToken *)prevToken; + +@end + + +//////////////////////////////////////////////////////////// +/// check that ptr is valid, otherwise print msg in +/// std::cerr and throw std::bad_alloc. +/// Must be used to check alloc results +//////////////////////////////////////////////////////////// +template +T *massert(T *ptr); + diff --git a/src/SFML/Window/Cocoa/AppController.mm b/src/SFML/Window/Cocoa/AppController.mm new file mode 100644 index 00000000..a6b7310f --- /dev/null +++ b/src/SFML/Window/Cocoa/AppController.mm @@ -0,0 +1,599 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#import +#import +#import +#import +#import +#import + + +// AppController singleton +static AppController *shared = nil; + + +/* setAppleMenu disappeared from the headers in 10.4 */ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 +@interface NSApplication (SFML) +- (void)setAppleMenu:(NSMenu *)menu; +@end +#endif + +@implementation NSApplication (SFML) + +- (void)setRunning:(BOOL)flag +{ + // Note: _running is a short, not a BOOL + if (flag) + _running = 1; + else + _running = 0; +} + +@end + + +@implementation AppController + +- (id)init +{ + self = [super init]; + + if (self != nil) { + windows = new std::vector ; + cleaner = new sf::Clock; + } + + return self; +} + + +- (void)dealloc +{ + delete windows; + delete cleaner; + [super dealloc]; +} + + +//////////////////////////////////////////////////////////// +/// Return the shared AppController object. Makes one if needed +//////////////////////////////////////////////////////////// ++ (AppController *)sharedController +{ + if (nil == shared) { + shared = [massert([AppController alloc]) init]; + } + + return shared; +} + + +//////////////////////////////////////////////////////////// +/// Reallocate main pool to release autoreleased objects +//////////////////////////////////////////////////////////// +- (void)resetPool +{ + [mainPool release]; + + mainPool = [massert([NSAutoreleasePool alloc]) init]; +} + + +//////////////////////////////////////////////////////////// +/// Register our application and launch it if needed +//////////////////////////////////////////////////////////// +- (void)runApplication +{ + if ([NSApp isRunning]) + return; + + // We want our application to appear in the Dock and be able + // to get focus + ProcessSerialNumber psn; + + if (!GetCurrentProcess(&psn)) { + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess(&psn); + } + + if (NSApp == nil) { + massert([NSApplication sharedApplication]); + } + + if ([NSApp mainMenu] == nil) { + [self makeMenuBar]; + } + + [NSApp finishLaunching]; + [NSApp setRunning:YES]; + [NSApp setDelegate:self]; + + desktopMode = sf::VideoMode::GetDesktopMode(); +} + + +//////////////////////////////////////////////////////////// +/// Terminate the current running application +//////////////////////////////////////////////////////////// +- (void)quitApplication:(id)sender +{ + // Close all windows + // SFML user has to detect when all windows are closed + NSWindow *current = nil; + sf::priv::WindowImplCocoa *priv = NULL; + + while (windows->size()) { + priv = windows->at(0); + current = static_cast (priv->CocoaWindow()); + [current close]; + windows->erase(windows->begin()); + } +} + + +//////////////////////////////////////////////////////////// +/// Returns the first full screen window found or nil +//////////////////////////////////////////////////////////// +- (SFWindow *)fullscreenWindow +{ + SFWindow *window = nil; + std::vector::size_type sz = windows->size(); + std::vector::size_type idx; + + for (idx = 0; idx < sz; idx++) { + sf::priv::WindowImplCocoa *win = windows->at(idx); + if (win && win->IsFullscreen()) { + window = static_cast (win->CocoaWindow()); + break; + } + } + + return window; +} + + +//////////////////////////////////////////////////////////// +/// Hide all the fullscreen windows and switch to desktop display mode +//////////////////////////////////////////////////////////// +- (void)applicationWillHide:(NSNotification *)aNotification +{ + if ([self isUsingFullscreen]) { + prevMode = sf::VideoMode::GetDesktopMode(); + + CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay, + desktopMode.BitsPerPixel, + desktopMode.Width, + desktopMode.Height, + NULL); + + CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken; + + // Fade to black screen + [SharedAppController doFadeOperation:FillScreen time:0.2f sync:true token:&token]; + + // Make all the full screen SFML windows unvisible + std::vector::size_type sz = windows->size(); + std::vector::size_type idx; + + for (idx = 0; idx < sz; idx++) { + sf::priv::WindowImplCocoa *win = windows->at(idx); + + if (win->IsFullscreen()) { + [static_cast (win->CocoaWindow()) setAlphaValue:0.0f]; + } + } + + // Switch to the wished display mode + CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode); + + // Fade to normal screen + [SharedAppController doFadeOperation:CleanScreen time:0.5f sync:false token:&token]; + } +} + + +//////////////////////////////////////////////////////////// +/// Unhide all the fullscreen windows and switch to full screen display mode +//////////////////////////////////////////////////////////// +- (void)applicationWillUnhide:(NSNotification *)aNotification +{ + if ([self isUsingFullscreen]) { + CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay, + prevMode.BitsPerPixel, + prevMode.Width, + prevMode.Height, + NULL); + + CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken; + + // Fade to a black screen + [SharedAppController doFadeOperation:FillScreen time:0.5f sync:true token:&token]; + [NSMenu setMenuBarVisible:NO]; + + // Switch to the wished display mode + CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode); + + // Make all the SFML windows visible + std::vector::size_type sz = windows->size(); + std::vector::size_type idx; + + for (idx = 0; idx < sz; idx++) { + sf::priv::WindowImplCocoa *win = windows->at(idx); + + if (win->IsFullscreen()) { + [static_cast (win->CocoaWindow()) setAlphaValue:1.0f]; + [static_cast (win->CocoaWindow()) center]; + } + } + + // Fade to normal screen + [SharedAppController doFadeOperation:CleanScreen time:0.5f sync:false token:&token]; + } +} + + +//////////////////////////////////////////////////////////// +/// Make menu bar +//////////////////////////////////////////////////////////// +- (void)makeMenuBar +{ + // Source taken from SDL 1.3 + + NSString *appName = nil; + NSString *title = nil; + NSMenu *appleMenu = nil; + NSMenu *fileMenu = nil; + NSMenu *windowMenu = nil; + NSMenuItem *menuItem = nil; + NSMenuItem *quitMenuItem = nil; + + // Determine the application name + appName = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + + // Create the main menu bar + [NSApp setMainMenu:[massert([NSMenu alloc]) init]]; + + // Create the application menu + appleMenu = [massert([NSMenu alloc]) initWithTitle:@""]; + + // Put menu items + // + 'About' menu item + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title + action:@selector(orderFrontStandardAboutPanel:) + keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + // + 'Hide' menu item + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title + action:@selector(hide:) + keyEquivalent:@"h"]; + + // + 'Hide other' menu item + menuItem = static_cast ([appleMenu addItemWithTitle:@"Hide Others" + action:@selector(hideOtherApplications:) + keyEquivalent:@"h"]); + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + // + 'Show all' menu item + [appleMenu addItemWithTitle:@"Show All" + action:@selector(unhideAllApplications:) + keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + // + 'Quit' menu item + title = [@"Quit " stringByAppendingString:appName]; + quitMenuItem = [[massert([NSMenuItem alloc]) + initWithTitle:title + action:@selector(quitApplication:) + keyEquivalent:@"q"] autorelease]; + [quitMenuItem setTarget:self]; + [appleMenu addItem:quitMenuItem]; + + // Put the menu into the menubar + menuItem = [massert([NSMenuItem alloc]) + initWithTitle:@"" + action:nil + keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + [menuItem release]; + + // Tell the application object that this is now the application menu + [NSApp setAppleMenu:appleMenu]; + [appleMenu release]; + + // 'File' menu + fileMenu = [massert([NSMenu alloc]) + initWithTitle:@"File"]; + + // + 'Close' menu item + menuItem = [massert([NSMenuItem alloc]) + initWithTitle:@"Close" + action:@selector(performClose:) + keyEquivalent:@"w"]; + [fileMenu addItem:menuItem]; + [menuItem release]; + + // + 'File' menu item (head) + menuItem = [massert([NSMenuItem alloc]) + initWithTitle:@"File" + action:nil + keyEquivalent:@""]; + [menuItem setSubmenu:fileMenu]; + [[NSApp mainMenu] addItem:menuItem]; + [menuItem release]; + + // 'Window' menu + windowMenu = [massert([NSMenu alloc]) + initWithTitle:@"Window"]; + + // + 'Minimize' menu item + menuItem = [massert([NSMenuItem alloc]) + initWithTitle:@"Minimize" + action:@selector(performMiniaturize:) + keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + // + 'Window' menu item (head) + menuItem = [massert([NSMenuItem alloc]) + initWithTitle:@"Window" + action:nil keyEquivalent:@""]; + [menuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:menuItem]; + [menuItem release]; + + // Tell the application object that this is now the window menu + [NSApp setWindowsMenu:windowMenu]; + [windowMenu release]; +} + + +//////////////////////////////////////////////////////////// +/// Delegate method in order to prevent usual -terminate: +//////////////////////////////////////////////////////////// +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender +{ + [self quitApplication:nil]; + return NSTerminateCancel; +} + + +//////////////////////////////////////////////////////////// +/// Get the events and put them into an array for each window +//////////////////////////////////////////////////////////// +- (void)processEvents +{ + // Release the main autorelease pool every second + if (cleaner->GetElapsedTime() > 1.0f) { + cleaner->Reset(); + [self resetPool]; + } + + NSEvent *event = nil; + + while (nil != (event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSEventTrackingRunLoopMode + dequeue:YES])) { + NSWindow *keyWindow = [NSApp keyWindow]; + + if (keyWindow == nil) { + // Is there a fullscreen WindowImpl object ? + [NSApp sendEvent:event]; + } else { + + std::vector::size_type cnt = windows->size(); + std::vector::size_type idx; + + // is the key window a SFML window ? + for (idx = 0;idx < cnt; idx++) { + sf::priv::WindowImplCocoa *ptr = windows->at(idx);; + + if (ptr->CocoaWindow() == keyWindow) { + // yup, it is + ptr->HandleEvent(static_cast (event)); + break; + } + } + + // nop, it isn't + if (idx == cnt) { + [NSApp sendEvent:event]; + } + } + } +} + + +//////////////////////////////////////////////////////////// +/// Add the 'windowImplObj' object to the list of known windows +//////////////////////////////////////////////////////////// +- (void)registerWindow:(sf::priv::WindowImplCocoa *)windowImplObj +{ + + if (windowImplObj != NULL) { + std::vector::size_type sz = windows->size(); + std::vector::size_type idx; + + for (idx = 0; idx < sz; idx++) { + if (windows->at(idx) == windowImplObj) { + break; + } + } + + + // Register window only if not already registered + if (sz == idx) { + windows->push_back(windowImplObj); + } + } +} + + +//////////////////////////////////////////////////////////// +/// Remove the 'windowImplObj' object from the list of known windows +//////////////////////////////////////////////////////////// +- (void)unregisterWindow:(sf::priv::WindowImplCocoa *)windowImplObj +{ + if (windowImplObj != NULL) { + std::vector::size_type sz = windows->size(); + std::vector::size_type idx; + + for (idx = 0; idx < sz; idx++) { + if (windows->at(idx) == windowImplObj) { + break; + } + } + + if (idx < sz) { + windows->erase(windows->begin() + idx); + } + } +} + + +//////////////////////////////////////////////////////////// +/// Return true is one of the registered window is a full screen one +//////////////////////////////////////////////////////////// +- (bool)isUsingFullscreen +{ + bool isUsing = false; + std::vector::size_type sz = windows->size(); + std::vector::size_type idx; + + for (idx = 0; idx < sz; idx++) { + sf::priv::WindowImplCocoa *win = windows->at(idx); + if (win && win->IsFullscreen()) { + isUsing = true; + break; + } + } + + return isUsing; +} + + +//////////////////////////////////////////////////////////// +/// Perform fade operation where 'operation' is one of { FillScreen, CleanScreen} +/// and 'time' is the time during which you wish the operation to be performed. +/// Set 'sync' to true if you do not want the method to end before the end +/// of the fade operation. Pass the last used token or a new one if you are +/// using this method for the first time. This lets the method release some +/// resources when doing CleanScreen operation. +//////////////////////////////////////////////////////////// +- (void) doFadeOperation:(int)operation time:(float)time sync:(bool)sync token:(CGDisplayFadeReservationToken *)prevToken +{ + CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken; + if (prevToken) + token = *prevToken; + + CGError result = 0, capture = 0; + + if (operation == FillScreen) { + // Get access for the fade operation + result = CGAcquireDisplayFadeReservation((int)(3 + time), &token); + + if (!result) { + // Capture display but do not fill the screen with black + // so that we can see the fade operation + capture = CGDisplayCaptureWithOptions(kCGDirectMainDisplay, kCGCaptureNoFill); + + if (!capture) { + // Do the increasing fade operation + CGDisplayFade(token, time, + kCGDisplayBlendNormal, + kCGDisplayBlendSolidColor, + 0.0, 0.0, 0.0, sync); + + // Now, release the non black-filling capture + CGDisplayRelease(kCGDirectMainDisplay); + + // And capture with filling + // so that we don't see the switching in the meantime + CGDisplayCaptureWithOptions(kCGDirectMainDisplay, kCGCaptureNoOptions); + } + + if (prevToken) + *prevToken = token; + } + } else if (operation == CleanScreen) { + // Get access for the fade operation + if (token == kCGDisplayFadeReservationInvalidToken) + result = CGAcquireDisplayFadeReservation((int)(3 + time), &token); + + if (!result) { + if (!capture) { + // Release the black-filling capture + CGDisplayRelease(kCGDirectMainDisplay); + + // Capture the display but do not fill with black (still for the fade operation) + CGDisplayCaptureWithOptions(kCGDirectMainDisplay, kCGCaptureNoFill); + + // Do the decreasing fading + CGDisplayFade(token, time, + kCGDisplayBlendSolidColor, + kCGDisplayBlendNormal, + 0.0, 0.0, 0.0, sync); + + // Release the fade operation token + CGReleaseDisplayFadeReservation(token); + + // Invalidate the given token + if (prevToken) + *prevToken = kCGDisplayFadeReservationInvalidToken; + } + + // Release the captured display + CGDisplayRelease(kCGDirectMainDisplay); + } + } +} + +@end + + +template +T *massert(T *ptr) +{ + if (NULL == ptr) { + throw std::bad_alloc(); + } + + return ptr; +} diff --git a/src/SFML/Window/Cocoa/Joystick.cpp b/src/SFML/Window/Cocoa/Joystick.cpp new file mode 100644 index 00000000..6b456a19 --- /dev/null +++ b/src/SFML/Window/Cocoa/Joystick.cpp @@ -0,0 +1,78 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Initialize the instance and bind it to a physical joystick +//////////////////////////////////////////////////////////// +void Joystick::Initialize(unsigned int Index) +{ + // Reset the joystick state + + // Initialize the Index-th available joystick +} + + +//////////////////////////////////////////////////////////// +/// Update the current joystick and return its new state +//////////////////////////////////////////////////////////// +JoystickState Joystick::UpdateState() +{ + // Fill a JoystickState instance with the current joystick state + JoystickState s = {0}; + return s; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of axes supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetAxesCount() const +{ + // Return number of supported axes + return 0; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of buttons supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetButtonsCount() const +{ + // Return number of supported buttons + return 0; +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Cocoa/Joystick.hpp b/src/SFML/Window/Cocoa/Joystick.hpp new file mode 100644 index 00000000..7a78c936 --- /dev/null +++ b/src/SFML/Window/Cocoa/Joystick.hpp @@ -0,0 +1,82 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICKCARBON_HPP +#define SFML_JOYSTICKCARBON_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// ****** implementation of Joystick (unknown implementation kind for now) +//////////////////////////////////////////////////////////// +class Joystick +{ +public : + + //////////////////////////////////////////////////////////// + /// Initialize the instance and bind it to a physical joystick + /// + /// \param Index : Index of the physical joystick to bind to + /// + //////////////////////////////////////////////////////////// + void Initialize(unsigned int Index); + + //////////////////////////////////////////////////////////// + /// Update the current joystick and return its new state + /// + /// \return Current state of the joystick + /// + //////////////////////////////////////////////////////////// + JoystickState UpdateState(); + + //////////////////////////////////////////////////////////// + /// Get the number of axes supported by the joystick + /// + /// \return Number of axis + /// + //////////////////////////////////////////////////////////// + unsigned int GetAxesCount() const; + + //////////////////////////////////////////////////////////// + /// Get the number of buttons supported by the joystick + /// + /// \return Number of buttons + /// + //////////////////////////////////////////////////////////// + unsigned int GetButtonsCount() const; +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_JOYSTICKCARBON_HPP diff --git a/src/SFML/Window/Cocoa/VideoModeSupport.cpp b/src/SFML/Window/Cocoa/VideoModeSupport.cpp new file mode 100644 index 00000000..75f5d8e8 --- /dev/null +++ b/src/SFML/Window/Cocoa/VideoModeSupport.cpp @@ -0,0 +1,101 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get supported video modes +//////////////////////////////////////////////////////////// +void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) +{ + // Ceylo -- using same implementation as in OSXCarbon + + // First, clear array to fill + Modes.clear(); + + // Enumerate all available video modes for primary display adapter + CFArrayRef DisplayModes = CGDisplayAvailableModes( kCGDirectMainDisplay ); + CFIndex DisplayModeCount = CFArrayGetCount( DisplayModes ); + CFDictionaryRef CurrentMode; + + for (int Count = 0; Count < DisplayModeCount; ++Count) + { + CurrentMode = (CFDictionaryRef)CFArrayGetValueAtIndex( DisplayModes, Count ); + + VideoMode Mode; + + CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayWidth), kCFNumberIntType, &(Mode.Width)); + CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayHeight), kCFNumberIntType, &(Mode.Height)); + CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayBitsPerPixel), kCFNumberIntType, &(Mode.BitsPerPixel)); + + // Add it only if it is not already in the array + if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end()) + Modes.push_back(Mode); + } +} + + +//////////////////////////////////////////////////////////// +/// Get current desktop video mode +//////////////////////////////////////////////////////////// +VideoMode VideoModeSupport::GetDesktopVideoMode() +{ + // Ceylo -- using same implementation as in OSXCarbon + + CFDictionaryRef CurrentVideoMode = CGDisplayCurrentMode(kCGDirectMainDisplay); + + VideoMode DesktopMode; + + + // Get video mode width + CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayWidth), + kCFNumberIntType, + &(DesktopMode.Width)); + + // Get video mode height + CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayHeight), + kCFNumberIntType, + &(DesktopMode.Height)); + + // Get video mode depth + CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayBitsPerPixel), + kCFNumberIntType, + &(DesktopMode.BitsPerPixel)); + + + return DesktopMode; +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Cocoa/VideoModeSupport.hpp b/src/SFML/Window/Cocoa/VideoModeSupport.hpp new file mode 100644 index 00000000..2b64685e --- /dev/null +++ b/src/SFML/Window/Cocoa/VideoModeSupport.hpp @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODESUPPORTCOCOA_HPP +#define SFML_VIDEOMODESUPPORTCOCOA_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Cocoa implementation of VideoModeSupport +/// Give access to video mode related OS-specific functions +//////////////////////////////////////////////////////////// +class VideoModeSupport +{ +public : + + //////////////////////////////////////////////////////////// + /// Get supported video modes + /// + /// \param Modes : Array to fill with available video modes + /// + //////////////////////////////////////////////////////////// + static void GetSupportedVideoModes(std::vector& Modes); + + //////////////////////////////////////////////////////////// + /// Get current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode GetDesktopVideoMode(); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_VIDEOMODESUPPORTCOCOA_HPP diff --git a/src/SFML/Window/Cocoa/WindowController.h b/src/SFML/Window/Cocoa/WindowController.h new file mode 100644 index 00000000..4c40825d --- /dev/null +++ b/src/SFML/Window/Cocoa/WindowController.h @@ -0,0 +1,73 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#import +#import +#import + + +//////////////////////////////////////////////////////////// +/// WindowController is a Cocoa notification receiver +//////////////////////////////////////////////////////////// +@interface WindowController : NSObject { + sf::priv::WindowImplCocoa *parentWindow; +} + +//////////////////////////////////////////////////////////// +/// Return a new autoreleased WindowController object linked +/// to the 'window' WindowImplCocoa object. +//////////////////////////////////////////////////////////// ++ (WindowController *)controllerWithWindow:(sf::priv::WindowImplCocoa *)window; +- (WindowController *)initWithWindow:(sf::priv::WindowImplCocoa *)window; + +//////////////////////////////////////////////////////////// +/// Notification method receiver when OpenGL view size changes +//////////////////////////////////////////////////////////// +- (void)viewFrameDidChange:(NSNotification *)notification; + +//////////////////////////////////////////////////////////// +/// Notification method receiver when the window gains focus +//////////////////////////////////////////////////////////// +- (void)windowDidBecomeMain:(NSNotification *)notification; + +//////////////////////////////////////////////////////////// +/// Notification method receiver when the window loses focus +//////////////////////////////////////////////////////////// +- (void)windowDidResignMain:(NSNotification *)notification; + +//////////////////////////////////////////////////////////// +/// Notification method receiver when the window closes +//////////////////////////////////////////////////////////// +- (void)windowWillClose:(NSNotification *)notification; + +@end + +// NSWindow subclass used to allow full screen windows to receive events +@interface SFWindow : NSWindow +@end + diff --git a/src/SFML/Window/Cocoa/WindowController.mm b/src/SFML/Window/Cocoa/WindowController.mm new file mode 100644 index 00000000..286a3ed6 --- /dev/null +++ b/src/SFML/Window/Cocoa/WindowController.mm @@ -0,0 +1,157 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#import +#import +#import +#import +#import + +@implementation WindowController + +//////////////////////////////////////////////////////////// +/// Forbide use of WindowController without any linked WindowImplCocoa object +//////////////////////////////////////////////////////////// +- (id)init +{ + return [self initWithWindow:NULL]; +} + +//////////////////////////////////////////////////////////// +/// Initialize a new WindowController object and link it +/// to the 'window' object. +//////////////////////////////////////////////////////////// +- (WindowController *)initWithWindow:(sf::priv::WindowImplCocoa *)window +{ + if (window == NULL) { + std::cerr << "-[WindowController initWithWindow:NULL] -- initialization without any linked window is forbidden ; nil returned" << std::endl; + [self release]; + return nil; + } + + self = [super init]; + + if (self != nil) { + parentWindow = window; + } + + return self; +} + +//////////////////////////////////////////////////////////// +/// Return a new autoreleased WindowController object linked +/// to the 'window' WindowImplCocoa object. +//////////////////////////////////////////////////////////// ++ (WindowController *)controllerWithWindow:(sf::priv::WindowImplCocoa *)window +{ + WindowController *ctrl = + massert([WindowController alloc]); + return [[ctrl initWithWindow:window] autorelease]; +} + +//////////////////////////////////////////////////////////// +/// Send event to the linked window +//////////////////////////////////////////////////////////// +- (void)pushEvent:(sf::Event)sfEvent +{ + if (parentWindow != NULL) { + parentWindow->HandleNotifiedEvent(sfEvent); + } +} + +//////////////////////////////////////////////////////////// +/// Notification method receiver when OpenGL view size changes +//////////////////////////////////////////////////////////// +- (void)viewFrameDidChange:(NSNotification *)notification +{ + NSOpenGLView *glView = [notification object]; + [[glView openGLContext] update]; + + sf::Event ev; + ev.Type = sf::Event::Resized; + ev.Size.Width = (unsigned) [glView frame].size.width; + ev.Size.Height = (unsigned) [glView frame].size.height; + + [self pushEvent:ev]; +} + +//////////////////////////////////////////////////////////// +/// Notification method receiver when the window gains focus +//////////////////////////////////////////////////////////// +- (void)windowDidBecomeMain:(NSNotification *)notification +{ + sf::Event ev; + ev.Type = sf::Event::GainedFocus; + + [self pushEvent:ev]; +} + +//////////////////////////////////////////////////////////// +/// Notification method receiver when the window loses focus +//////////////////////////////////////////////////////////// +- (void)windowDidResignMain:(NSNotification *)notification +{ + sf::Event ev; + ev.Type = sf::Event::LostFocus; + + [self pushEvent:ev]; +} + +//////////////////////////////////////////////////////////// +/// Notification method receiver when the window closes +//////////////////////////////////////////////////////////// +- (void)windowWillClose:(NSNotification *)notification +{ + sf::Event ev; + ev.Type = sf::Event::Closed; + + [self pushEvent:ev]; +} + +- (void)windowDidMove:(NSNotification *)notification +{ + NSWindow *sender = [notification object]; + + if (!([sender styleMask] & NSTitledWindowMask)) + [sender center]; +} + +@end + + +@implementation SFWindow +- (BOOL)canBecomeKeyWindow +{ + return YES; +} + +- (BOOL)canBecomeMainWindow +{ + return YES; +} +@end diff --git a/src/SFML/Window/Cocoa/WindowImplCocoa.hpp b/src/SFML/Window/Cocoa/WindowImplCocoa.hpp new file mode 100644 index 00000000..1b2e96b4 --- /dev/null +++ b/src/SFML/Window/Cocoa/WindowImplCocoa.hpp @@ -0,0 +1,223 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWIMPLCOCOA_HPP +#define SFML_WINDOWIMPLCOCOA_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + +namespace sf +{ +namespace priv +{ + +typedef struct objc_members objc_members; + +//////////////////////////////////////////////////////////// +/// WindowImplCocoa is the Cocoa implementation of WindowImpl +//////////////////////////////////////////////////////////// +class WindowImplCocoa : public WindowImpl +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// (creates a dummy window to provide a valid OpenGL context) + /// + //////////////////////////////////////////////////////////// + WindowImplCocoa(); + + //////////////////////////////////////////////////////////// + /// Construct the window implementation from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation parameters + /// + /// Note: the NSWindow object must not be defered ! + //////////////////////////////////////////////////////////// + WindowImplCocoa(WindowHandle Handle, WindowSettings& params); + + //////////////////////////////////////////////////////////// + /// Create the window implementation + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style + /// \param Params : Creation parameters + /// + //////////////////////////////////////////////////////////// + WindowImplCocoa(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& params); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~WindowImplCocoa(); + + //////////////////////////////////////////////////////////// + /// Check if there's an active context on the current thread + /// + /// \return True if there's a context bound to the current thread + /// + //////////////////////////////////////////////////////////// + static bool IsContextActive(); + + //////////////////////////////////////////////////////////// + /// Handle Cocoa NSEvent + //////////////////////////////////////////////////////////// + void HandleEvent(void *eventRef); + + //////////////////////////////////////////////////////////// + /// Handle an event sent by the default NSNotificationCenter + //////////////////////////////////////////////////////////// + void HandleNotifiedEvent(Event& eventRef); + + //////////////////////////////////////////////////////////// + /// Return a pointer to the NSWindow (objc->windowHandle) object + //////////////////////////////////////////////////////////// + void *CocoaWindow(void); + + //////////////////////////////////////////////////////////// + /// Return whether the window is in full screen mode + //////////////////////////////////////////////////////////// + bool IsFullscreen(void); +private : + + //////////////////////////////////////////////////////////// + /// see WindowImpl::Display + /// + //////////////////////////////////////////////////////////// + virtual void Display(); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::ProcessEvents + /// + //////////////////////////////////////////////////////////// + virtual void ProcessEvents(); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::MakeActive + /// + //////////////////////////////////////////////////////////// + virtual void SetActive(bool Active = true) const; + + //////////////////////////////////////////////////////////// + /// see WindowImpl::UseVerticalSync + /// + //////////////////////////////////////////////////////////// + virtual void UseVerticalSync(bool Enabled); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::ShowMouseCursor + /// + //////////////////////////////////////////////////////////// + virtual void ShowMouseCursor(bool Show); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::SetCursorPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetCursorPosition(unsigned int Left, unsigned int Top); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::SetPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetPosition(int Left, int Top); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetSize + /// + //////////////////////////////////////////////////////////// + virtual void SetSize(unsigned int Width, unsigned int Height); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::Show + /// + //////////////////////////////////////////////////////////// + virtual void Show(bool State); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::EnableKeyRepeat + /// + //////////////////////////////////////////////////////////// + virtual void EnableKeyRepeat(bool Enabled); + + //////////////////////////////////////////////////////////// + /// see WindowImpl::SetIcon + /// + //////////////////////////////////////////////////////////// + virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + + + + //////////////////////////////////////////////////////////// + /// My own part starts here ! + //////////////////////////////////////////////////////////// + + + //////////////////////////////////////////////////////////// + /// Event handling for every event type. + /// 'eventRef' is a NSEvent. + //////////////////////////////////////////////////////////// + int HandleKeyDown(void *eventRef); + int HandleKeyUp(void *eventRef); + int HandleModifierKey(void *eventRef); + int HandleMouseDown(void *eventRef); + int HandleMouseUp(void *eventRef); + int HandleMouseMove(void *eventRef); + int HandleMouseWheel(void *eventRef); + + //////////////////////////////////////////////////////////// + /// Make some allocations and initializations + //////////////////////////////////////////////////////////// + void Initialize(void); + + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + + // An opaque structure that contains all obj-C objects + objc_members *members; + + bool useKeyRepeat; + bool mouseIn; + float wheelStatus; + + bool fullscreen; + VideoMode fullscreenMode; + VideoMode desktopMode; +}; + +} // namespace priv + +} // namespace sf + +#endif // SFML_WINDOWIMPLCOCOA_HPP diff --git a/src/SFML/Window/Cocoa/WindowImplCocoa.mm b/src/SFML/Window/Cocoa/WindowImplCocoa.mm new file mode 100644 index 00000000..04580352 --- /dev/null +++ b/src/SFML/Window/Cocoa/WindowImplCocoa.mm @@ -0,0 +1,1459 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#import +#import +#import +#import +#import +#import +#import +#import +#import + + +#pragma mark Notes + +// ENABLE_ANTIALIASING macro : +// +// I use this to prevent the use of antialiasing +// as OpenGL context sharing does not allow only one of the +// shared OpenGL context to be shared. That means +// antialiasing could not be used without re-compiling +// the whole sfml-window library. +// +// I've no way to fix this for now. + +// ENABLE_WINDOWIMPORT macro : +// +// I use this to disable the import of Cocoa windows +// as it does not work fine for now and is not +// a high priority. + + + + + +namespace sf +{ +namespace priv +{ + +// Do something only once (useful in loops) +#define ONCE(make) \ +{ static int __done = 0;\ +if (!__done) {\ +make;\ +__done = 1;\ +} } + +// Has the event been used or not ? If not, it must be sent to NSApp +enum { + UsedEvent, + UnusedEvent +}; + + +//////////////////////////////////////////////////////////// +/// Structure containing all the members I can't directly put in the class definition +/// because I would have to hide them in a #ifdef __OBJC__ block and the object +/// allocator would allocate space for it as it would be called from a C++ code +/// that wouldn't see these members +//////////////////////////////////////////////////////////// +struct objc_members { + WindowController *controller; + SFWindow *window; + NSOpenGLContext *context; + NSOpenGLView *view; +}; + +//////////////////////////////////////////////////////////// +/// Pointer to the shared OpenGL context +//////////////////////////////////////////////////////////// +static NSOpenGLContext *sharedContext = nil; + + +//////////////////////////////////////////////////////////// +/// Private function declarations +//////////////////////////////////////////////////////////// +static SFWindow * MakeWindow(WindowSettings& params, unsigned long style, VideoMode& mode, NSString *title); +static NSOpenGLContext *MakeOpenGLContext(WindowSettings& params); +static NSOpenGLView * MakeOpenGLView(SFWindow *window, NSOpenGLContext *context, WindowSettings& params); +static void ConfigureWindow(SFWindow *window, NSOpenGLView *view, WindowController *controller); +static Key::Code KeyForVirtualCode(unsigned short vCode); +static Key::Code KeyForUnicode(unsigned short uniCode); +static bool IsTextEvent(NSEvent *event); +static bool MouseInside(SFWindow *window, NSView *view); +static NSPoint MouseLocation(SFWindow *window); + + +//////////////////////////////////////////////////////////// +/// Default constructor +/// (creates a dummy window to provide a valid OpenGL context) +//////////////////////////////////////////////////////////// +WindowImplCocoa::WindowImplCocoa() : +members(NULL), +useKeyRepeat(false), +mouseIn(false), +wheelStatus(0.0f), +fullscreen(false), +fullscreenMode(0, 0, 0), +desktopMode(0, 0, 0) +{ + Initialize(); + + // We just want to have a valid support for an OpenGL context + + // So we create the OpenGL context + WindowSettings params(0, 0, 0); + members->context = MakeOpenGLContext(params); + + if (members->context != nil) { + // Increase the reference counter for the shared OpenGL context + sharedContext = [members->context retain]; + + // Then we make it the current active OpenGL context + SetActive(); + + // And set the current working directory to + // the Resources folder is it's a bundled app, + // or to the directory containing the executable otherwise + chdir([[[NSBundle mainBundle] resourcePath] UTF8String]); + + } else { + std::cerr << "*** SFML: Unable to make the main shared OpenGL context" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation from an existing control +//////////////////////////////////////////////////////////// +WindowImplCocoa::WindowImplCocoa(WindowHandle Handle, WindowSettings& params) : +members(NULL), +useKeyRepeat(false), +mouseIn(false), +wheelStatus(0.0f), +fullscreen(false), +fullscreenMode(0, 0, 0), +desktopMode(0, 0, 0) +{ + Initialize(); + +#if ENABLE_WINDOWIMPORT + // Register ourselves for event handling + [[AppController sharedController] registerWindow:this]; + + // Make a WindowController to handle notifications + members->controller = [[WindowController controllerWithWindow:this] retain]; + + // Use existing window + members->window = [static_cast (Handle) retain]; + + if (members->window != nil) { + // We make the OpenGL context, associate it to the OpenGL view + // and add the view to our window + members->context = MakeOpenGLContext(params); + + if (members->context != nil) { + members->view = MakeOpenGLView(members->window, members->context, params); + + if (members->view != nil) { + // initial mouse state + mouseIn = MouseInside(members->window, members->view); + + // Initialize myWidth and myHeight members from base class with the window size + myWidth = (unsigned) [members->window frame].size.width; + myHeight = (unsigned) [members->window frame].size.height; + } else { + //error(__FILE__, __LINE__, "failed to make the OpenGL view for the public window"); + } + } else { + //error(__FILE__, __LINE__, "failed to make the OpenGL context for the public window"); + } + } else { + //error(__FILE__, __LINE__, "invalid imported window"); + } +#else + std::cerr << "*** SFML: making a sf::Window from a Cocoa one is not available in this version of the SFML" << std::endl; +#endif +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation +//////////////////////////////////////////////////////////// +WindowImplCocoa::WindowImplCocoa(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& params) : +members(NULL), +useKeyRepeat(false), +mouseIn(false), +wheelStatus(0.0f), +fullscreen(WindowStyle & Style::Fullscreen), +fullscreenMode(0, 0, 0), +desktopMode(0, 0, 0) +{ + Initialize(); + + // Make a WindowController to handle notifications + members->controller = [[WindowController controllerWithWindow:this] retain]; + + // Create a new window with given size, title and style + // First we define some objects used for our window + NSString *title = massert([NSString stringWithUTF8String:Title.c_str()]); + + // We create the window + members->window = MakeWindow(params, WindowStyle, Mode, title); + + + if (members->window != nil) { + members->context = MakeOpenGLContext(params); + + if (members->context != nil) { + // We make the OpenGL context, associate it to the OpenGL view + // and add the view to our window + members->view = MakeOpenGLView(members->window, members->context, params); + + if (members->view != nil) { + // Set observers and some window settings + ConfigureWindow(members->window, members->view, members->controller); + + // initial mouse state + mouseIn = MouseInside(members->window, members->view); + + // We set the myWidth and myHeight members to the correct values + myWidth = Mode.Width; + myHeight = Mode.Height; + + if (WindowStyle & Style::Fullscreen) { + fullscreenMode = Mode; + + // Using this because full screen window was not always + // in front of the other application windows when unhiding app + [members->window setLevel:NSFloatingWindowLevel]; + } + } else { + std::cerr << "*** SFML: failed to make the OpenGL view for the public window" << std::endl; + [members->context release], members->context = nil; + [sharedContext release]; + [members->window release], members->window = nil; + } + } else { + std::cerr << "*** SFML: failed to make the OpenGL context for the public window" << std::endl; + [members->window release], members->window = nil; + } + } else { + std::cerr << "*** SFML: failed to make the public window" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +WindowImplCocoa::~WindowImplCocoa() +{ + + // Release the notification receiver + if (members) { + [[NSNotificationCenter defaultCenter] removeObserver:members->controller]; + [members->controller release]; + } + + // Make sure the window is closed + Show(false); + + // Decrement the shared context counter + [sharedContext release]; + + // Release the window objects + if (members) { + [members->context release]; + [members->view release]; + [members->window release]; + } + + // Free the private members struct + delete members; +} + + +//////////////////////////////////////////////////////////// +/// Check if there's an active context on the current thread +//////////////////////////////////////////////////////////// +bool WindowImplCocoa::IsContextActive() +{ + return ([NSOpenGLContext currentContext] != NULL); +} + + +//////////////////////////////////////////////////////////// +/// Handle a Cocoa NSEvent +//////////////////////////////////////////////////////////// +void WindowImplCocoa::HandleEvent(void *eventRef) +{ + if (eventRef == nil) { + std::cerr << "*** SFML: cannot handle a NULL event. Returning." << std::endl; + return; + } + + NSEvent *event = static_cast (eventRef); + int eventStatus = UnusedEvent; + + switch ([event type]) { + case NSKeyDown: + eventStatus = HandleKeyDown(eventRef); + break; + + case NSKeyUp: + eventStatus = HandleKeyUp(eventRef); + break; + + case NSFlagsChanged: + eventStatus = HandleModifierKey(eventRef); + break; + + case NSScrollWheel: + eventStatus = HandleMouseWheel(eventRef); + break; + + case NSLeftMouseDown: + case NSRightMouseDown: + eventStatus = HandleMouseDown(eventRef); + break; + + case NSLeftMouseUp: + case NSRightMouseUp: + eventStatus = HandleMouseUp(eventRef); + break; + + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + eventStatus = HandleMouseMove(eventRef); + break; + + default: + break; + } + + if (eventStatus == UnusedEvent) { + [NSApp sendEvent:event]; + } +} + + +//////////////////////////////////////////////////////////// +/// Handle event sent by the default NSNotificationCenter +//////////////////////////////////////////////////////////// +void WindowImplCocoa::HandleNotifiedEvent(Event& event) +{ + // Set myWidth and myHeight to correct value if + // window size changed + switch (event.Type) { + case Event::Resized: + myWidth = event.Size.Width; + myHeight = event.Size.Height; + break; + + default: + break; + } + + // And send the event + SendEvent(event); +} + + +//////////////////////////////////////////////////////////// +/// Handle a key down event (NSEvent) +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleKeyDown(void *eventRef) +{ + NSEvent *event = static_cast (eventRef); + + Event sfEvent; + unichar chr = 0, rawchr = 0; + unsigned long length = [[event characters] length]; + unsigned mods = [event modifierFlags]; + + if (length) { + chr = [[event characters] characterAtIndex:0]; + + // Note : I got a crash (out of bounds exception) while typing so now I test... + if ([[event charactersIgnoringModifiers] length]) + rawchr = [[event charactersIgnoringModifiers] characterAtIndex:0]; + + } + + if (mods & NSCommandKeyMask) { + // Application commands + [NSApp sendEvent:event]; + } + + // User events + + if (!useKeyRepeat && [event isARepeat]) { + return UsedEvent; + } + +#if 1 + // Is it also a text event ? + if (IsTextEvent(event)) { + // buffer for the UTF-8 characters + const char *utf8Characters = [[event characters] UTF8String]; + + // buffer for the UTF-32 characters + Uint32 utf32Characters[2]; + + // convert the characters + const Uint32 *addr = Unicode::UTF8ToUTF32(utf8Characters, + utf8Characters + length, + utf32Characters); + + // si il y a eu des caracteres convertis ? + if (addr > utf32Characters) { + sfEvent.Type = Event::TextEntered; + sfEvent.Text.Unicode = utf32Characters[0]; + + SendEvent(sfEvent); + } + } +#else + // Is it also a text event ? + if (IsTextEvent(event)) { + static NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:1]; + + sfEvent.Type = Event::TextEntered; + sfEvent.Text.Unicode = chr; + + NSText *field = [members->window fieldEditor:YES forObject:nil]; + [arr addObject:event]; + [field interpretKeyEvents:arr]; + + if ([[field string] length]) { + unichar unichr = [[field string] characterAtIndex:0]; + sfEvent.Text.Unicode = unichr; + SendEvent(sfEvent); + + unichar str[2] = {unichr, 0}; + NSLog(@"Char::%@", [NSString stringWithCharacters:str length:2]); + + [field setString:@""]; + [arr removeAllObjects]; + } + + + } +#endif + + // Anyway it's also a KeyPressed event + sfEvent.Type = Event::KeyPressed; + + // Get the keys + if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(rawchr))) { + sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); + } + + // Get the modifiers + sfEvent.Key.Alt = mods & NSAlternateKeyMask; + sfEvent.Key.Control = mods & NSControlKeyMask; + sfEvent.Key.Shift = mods & NSShiftKeyMask; + + // Send the event + SendEvent(sfEvent); + + return UsedEvent; +} + + +//////////////////////////////////////////////////////////// +/// Handle a key up event (NSEvent) +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleKeyUp(void *eventRef) +{ + NSEvent *event = static_cast (eventRef); + + Event sfEvent; + unsigned mods = [event modifierFlags]; + unichar chr = 0, rawchr = 0; + + if ([[event characters] length]) { + chr = [[event characters] characterAtIndex:0]; + + if ([[event charactersIgnoringModifiers] length]) + rawchr = [[event charactersIgnoringModifiers] characterAtIndex:0]; + + } + + if (mods & NSCommandKeyMask) { + [NSApp sendEvent:event]; + } + + sfEvent.Type = Event::KeyReleased; + + // Get the code + if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(rawchr))) { + sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); + } + + // Get the modifiers + sfEvent.Key.Alt = mods & NSAlternateKeyMask; + sfEvent.Key.Control = mods & NSControlKeyMask; + sfEvent.Key.Shift = mods & NSShiftKeyMask; + + SendEvent(sfEvent); + + return UsedEvent; +} + + +//////////////////////////////////////////////////////////// +/// Handle a key modifier event [Command, Option, Control, Shift] +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleModifierKey(void *eventRef) +{ + NSEvent *event = static_cast (eventRef); + Event sfEvent; + unsigned mods = [event modifierFlags]; + + sfEvent.Type = Event::KeyPressed; + sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); + + sfEvent.Key.Alt = mods & NSAlternateKeyMask; + sfEvent.Key.Control = mods & NSControlKeyMask; + sfEvent.Key.Shift = mods & NSShiftKeyMask; + + if (!(mods & NSAlternateKeyMask) && + (sfEvent.Key.Code == Key::LAlt || sfEvent.Key.Code == Key::RAlt)) { + sfEvent.Type = Event::KeyReleased; + } + + if (!(mods & NSControlKeyMask) && + (sfEvent.Key.Code == Key::LControl || sfEvent.Key.Code == Key::RControl)) { + sfEvent.Type = Event::KeyReleased; + } + + if (!(mods & NSShiftKeyMask) && + (sfEvent.Key.Code == Key::LShift || sfEvent.Key.Code == Key::RShift)) { + sfEvent.Type = Event::KeyReleased; + } + + if (!(mods & NSCommandKeyMask) && + (sfEvent.Key.Code == Key::LSystem || sfEvent.Key.Code == Key::RSystem)) { + sfEvent.Type = Event::KeyReleased; + } + + SendEvent(sfEvent); + + return UnusedEvent; +} + + +//////////////////////////////////////////////////////////// +/// Handle a mouse down event (NSEvent) +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleMouseDown(void *eventRef) +{ + NSEvent *event = static_cast (eventRef); + Event sfEvent; + NSPoint loc = {0, 0}; + unsigned mods = [event modifierFlags]; + + switch ([event type]) { + case NSLeftMouseDown: + sfEvent.Type = Event::MouseButtonPressed; + + if (mods & NSControlKeyMask) { + sfEvent.MouseButton.Button = Mouse::Right; + } else { + sfEvent.MouseButton.Button = Mouse::Left; + } + + // Get mouse position + loc = MouseLocation(members->window); + + sfEvent.MouseButton.X = (int) loc.x; + sfEvent.MouseButton.Y = (int) loc.y; + + SendEvent(sfEvent); + break; + + case NSRightMouseDown: + sfEvent.Type = Event::MouseButtonPressed; + sfEvent.MouseButton.Button = Mouse::Right; + + // Get mouse position + loc = MouseLocation(members->window); + + sfEvent.MouseButton.X = (int) loc.x; + sfEvent.MouseButton.Y = (int) loc.y; + + SendEvent(sfEvent); + break; + + default: + break; + } + + return UnusedEvent; + +} + + +//////////////////////////////////////////////////////////// +/// Handle a mouse up event (NSEvent) +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleMouseUp(void *eventRef) +{ + NSEvent *event = static_cast (eventRef); + Event sfEvent; + NSPoint loc = {0, 0}; + unsigned mods = [event modifierFlags]; + + switch ([event type]) { + case NSLeftMouseUp: + sfEvent.Type = Event::MouseButtonReleased; + + if (mods & NSControlKeyMask) { + sfEvent.MouseButton.Button = Mouse::Right; + } else { + sfEvent.MouseButton.Button = Mouse::Left; + } + + // Get mouse position + loc = MouseLocation(members->window); + + sfEvent.MouseButton.X = (int) loc.x; + sfEvent.MouseButton.Y = (int) loc.y; + + SendEvent(sfEvent); + break; + + case NSRightMouseUp: + sfEvent.Type = Event::MouseButtonReleased; + sfEvent.MouseButton.Button = Mouse::Right; + + // Get mouse position + loc = MouseLocation(members->window); + + sfEvent.MouseButton.X = (int) loc.x; + sfEvent.MouseButton.Y = (int) loc.y; + + SendEvent(sfEvent); + break; + + default: + break; + } + + return UnusedEvent; +} + + +//////////////////////////////////////////////////////////// +/// Handle a mouse move event (NSEvent) +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleMouseMove(void *eventRef) +{ + Event sfEvent; + NSPoint loc = {0, 0}; + + loc = MouseLocation(members->window); + sfEvent.Type = Event::MouseMoved; + + sfEvent.MouseMove.X = (int) loc.x; + sfEvent.MouseMove.Y = (int) loc.y; + + SendEvent(sfEvent); + + // MouseEntered and MouseLeft events + if (MouseInside(members->window, members->view) && !mouseIn) { + sfEvent.Type = Event::MouseEntered; + mouseIn = true; + SendEvent(sfEvent); + } else if (!MouseInside(members->window, members->view) && mouseIn) { + sfEvent.Type = Event::MouseLeft; + mouseIn = false; + SendEvent(sfEvent); + } + + return UnusedEvent; +} + + +//////////////////////////////////////////////////////////// +/// Handle a mouse wheel event (NSEvent) +//////////////////////////////////////////////////////////// +int WindowImplCocoa::HandleMouseWheel(void *eventRef) +{ + NSEvent *event = static_cast (eventRef); + + wheelStatus += [event deltaY]; + + if (fabs(wheelStatus) > 1.0f) { + Event sfEvent; + sfEvent.Type = Event::MouseWheelMoved; + sfEvent.MouseWheel.Delta = (int) wheelStatus; + SendEvent(sfEvent); + + wheelStatus -= (int) wheelStatus; + } + + return UnusedEvent; +} + + +//////////////////////////////////////////////////////////// +/// Return a pointer to the SFWindow object +//////////////////////////////////////////////////////////// +void *WindowImplCocoa::CocoaWindow(void) +{ + return static_cast (members->window); +} + +//////////////////////////////////////////////////////////// +/// Return whether the window is in full screen mode +//////////////////////////////////////////////////////////// +bool WindowImplCocoa::IsFullscreen(void) +{ + return fullscreen; +} + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::Display +//////////////////////////////////////////////////////////// +void WindowImplCocoa::Display() +{ + [members->context flushBuffer]; +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::ProcessEvents +//////////////////////////////////////////////////////////// +void WindowImplCocoa::ProcessEvents() +{ + if (![NSApp isRunning]) + return; + + [[AppController sharedController] processEvents]; +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::MakeActive +//////////////////////////////////////////////////////////// +void WindowImplCocoa::SetActive(bool Active) const +{ + if (Active) { + if ([NSOpenGLContext currentContext] != members->context) + [members->context makeCurrentContext]; + } else { + if ([NSOpenGLContext currentContext] == members->context) + [NSOpenGLContext clearCurrentContext]; + } +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::UseVerticalSync +//////////////////////////////////////////////////////////// +void WindowImplCocoa::UseVerticalSync(bool Enabled) +{ + GLint enable = (Enabled) ? 1 : 0; + [members->context setValues:&enable forParameter:NSOpenGLCPSwapInterval]; +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::ShowMouseCursor +//////////////////////////////////////////////////////////// +void WindowImplCocoa::ShowMouseCursor(bool flag) +{ + if (flag) { + [NSCursor unhide]; + } else { + [NSCursor hide]; + } +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::SetCursorPosition +//////////////////////////////////////////////////////////// +void WindowImplCocoa::SetCursorPosition(unsigned int Left, unsigned int Top) +{ + NSPoint pos = NSMakePoint ((float) Left, (float) Top); + + if (members->window) { + // Flip for SFML window coordinate system + pos.y = [members->window frame].size.height - pos.y; + + // Adjust for view reference instead of window + pos.y -= [members->window frame].size.height - [members->view frame].size.height; + + // Convert to screen coordinates + NSPoint absolute = [members->window convertBaseToScreen:pos]; + + // Flip screen coodinates + absolute.y = [[NSScreen mainScreen] frame].size.height - absolute.y; + + // Move cursor + CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, CGPointMake(absolute.x, absolute.y)); + } else { + std::cerr << "*** SFML: uninitialized 'members->window' member (objc_members) in " + << this << " (sf::priv::WindowImplCocoa)" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::SetPosition +//////////////////////////////////////////////////////////// +void WindowImplCocoa::SetPosition(int Left, int Top) +{ + if (members->window) { + if (!fullscreen) { + // Change the window position + Top = (int) [[members->window screen] frame].size.height - Top; + [members->window setFrameTopLeftPoint:NSMakePoint(Left, Top)]; + } + } else { + std::cerr << "*** SFML: uninitialized 'members->window' member (objc_members) in " + << this << " (sf::priv::WindowImplCocoa)"; + } +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetSize +/// +//////////////////////////////////////////////////////////// +void WindowImplCocoa::SetSize(unsigned int Width, unsigned int Height) +{ + if (members->window) { + if (!fullscreen) { + [members->window setFrame:NSMakeRect([members->window frame].origin.x, + [members->window frame].origin.y, + (float) Width, (float) Height) + display:YES]; + } + } else { + std::cerr << "*** SFML: uninitialized 'members->window' member (objc_members) in " + << this << " (sf::priv::WindowImplCocoa)" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::Show +//////////////////////////////////////////////////////////// +void WindowImplCocoa::Show(bool State) +{ + if (State && ![members->window isVisible]) { + // Wanna open the closed window + + // Register ourselves for event handling + [[AppController sharedController] registerWindow:this]; + + if (fullscreen) { + desktopMode = VideoMode::GetDesktopMode(); + + CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay, + fullscreenMode.BitsPerPixel, + fullscreenMode.Width, + fullscreenMode.Height, + NULL); + + CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken; + + // Fade to a black screen + [SharedAppController doFadeOperation:FillScreen time:0.5f sync:true token:&token]; + [NSMenu setMenuBarVisible:NO]; + + // Switch to the wished display mode + CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode); + + // Open the window + [members->window makeKeyAndOrderFront:nil]; + [members->window center]; + + // Fade to normal screen + [SharedAppController doFadeOperation:CleanScreen time:0.2f sync:false token:&token]; + + } else { + // Show the window + // Note: using these two lines instead of -[NSWindow makeKeyAndOrderFront:] + // in order to prevent the standard window buttons from not displaying + // the "mouse over" icons + [members->window orderFront:nil]; + [members->window makeKeyWindow]; + + } + } else if (!State && [members->window isVisible]) { + // Wanna close the opened window + + if (fullscreen) { + CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay, + desktopMode.BitsPerPixel, + desktopMode.Width, + desktopMode.Height, + NULL); + + CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken; + + // Fade to black screen + [SharedAppController doFadeOperation:FillScreen time:0.2f sync:true token:&token]; + + // Switch to the wished display mode + CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode); + + // Close the window + [members->window close]; + [NSMenu setMenuBarVisible:YES]; + + // Fade to normal screen + [SharedAppController doFadeOperation:CleanScreen time:0.5f sync:false token:&token]; + + // Do not sync but sleep so that the Dock and the Finder desktop go back to normal + // state before the end of the fade operation + sf::Sleep(0.5f); + } else { + // Close the window + [members->window close]; + + } + + // Unregister ourselves from the event handler + [[AppController sharedController] unregisterWindow:this]; + } +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::EnableKeyRepeat +//////////////////////////////////////////////////////////// +void WindowImplCocoa::EnableKeyRepeat(bool Enabled) +{ + useKeyRepeat = Enabled; +} + + +//////////////////////////////////////////////////////////// +/// see WindowImpl::SetIcon +//////////////////////////////////////////////////////////// +void WindowImplCocoa::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Make some allocations and initializations +//////////////////////////////////////////////////////////// +void WindowImplCocoa::Initialize(void) +{ + // Allocate mem for the private objc members + members = new objc_members; + bzero(members, sizeof(*members)); + + // Needed to always have an autorelease pool as soon as application is launched + ONCE([SharedAppController resetPool]); + + // Register application if needed and launch it + ONCE([SharedAppController runApplication]); +} + + +//////////////////////////////////////////////////////////// +/// Make the window +//////////////////////////////////////////////////////////// +static SFWindow *MakeWindow(WindowSettings& params, unsigned long style, VideoMode& mode, NSString *title) +{ + SFWindow *window = nil; + + NSRect frame = NSMakeRect (0.0f, 0.0f, (float) mode.Width, (float) mode.Height); + unsigned int mask = 0; + + // We grab options from WindowStyle and add them to our window mask + if (style & Style::None || style & Style::Fullscreen) { + mask |= NSBorderlessWindowMask; + + if (style & Style::Fullscreen) { + // Check display mode and put new values in 'mode' if needed + boolean_t exact = true; + CFDictionaryRef properties = CGDisplayBestModeForParameters(kCGDirectMainDisplay, mode.BitsPerPixel, + mode.Width, mode.Height, &exact); + + if (!properties) { + std::cerr << "*** SFML: unable to get a display mode with the given parameters" << std::endl; + return nil; + } + + if (exact == false) { + CFNumberGetValue((CFNumberRef) CFDictionaryGetValue(properties, kCGDisplayWidth), + kCFNumberIntType, &mode.Width); + + CFNumberGetValue((CFNumberRef) CFDictionaryGetValue(properties, kCGDisplayHeight), + kCFNumberIntType, &mode.Height); + + CFNumberGetValue((CFNumberRef) CFDictionaryGetValue(properties, kCGDisplayBitsPerPixel), + kCFNumberIntType, &mode.BitsPerPixel); + } + } + + } else { + if (style & Style::Titlebar) { + mask |= NSTitledWindowMask; + mask |= NSMiniaturizableWindowMask; + } + + if (style & Style::Resize) { + mask |= NSTitledWindowMask; + mask |= NSMiniaturizableWindowMask; + mask |= NSResizableWindowMask; + } + + if (style & Style::Close) { + mask |= NSTitledWindowMask; + mask |= NSClosableWindowMask; + mask |= NSMiniaturizableWindowMask; + } + } + + // Now we make the window with the values we got + // Note: defer flag set to NO to be able to use OpenGL in our window + window =[massert([SFWindow alloc]) initWithContentRect:frame + styleMask:mask + backing:NSBackingStoreBuffered + defer:NO]; + + if (window != nil) { + // We set title and window position + [window setTitle:title]; + [window center]; + } + + return window; +} + + +//////////////////////////////////////////////////////////// +/// Make the OpenGL pixel format from the given attributes +//////////////////////////////////////////////////////////// +static NSOpenGLContext *MakeOpenGLContext(WindowSettings& params) +{ + NSOpenGLPixelFormat *pixFormat = nil; + NSOpenGLContext *context = nil; + unsigned idx = 0; +#if ENABLE_ANTIALIASING + unsigned samplesIdx = 0; +#endif + + // Attributes list + NSOpenGLPixelFormatAttribute attribs[15] = {(NSOpenGLPixelFormatAttribute) 0}; + + // Accelerated, double buffered + attribs[idx++] = NSOpenGLPFAClosestPolicy; + attribs[idx++] = NSOpenGLPFADoubleBuffer; + attribs[idx++] = NSOpenGLPFAAccelerated; + + // windowed context + attribs[idx++] = NSOpenGLPFAWindow; + + // Color size ; usually 32 bits per pixel + attribs[idx++] = NSOpenGLPFAColorSize; + attribs[idx++] = (NSOpenGLPixelFormatAttribute) VideoMode::GetDesktopMode().BitsPerPixel; + + // Z-buffer size + attribs[idx++] = NSOpenGLPFADepthSize; + attribs[idx++] = (NSOpenGLPixelFormatAttribute) params.DepthBits; + + // Stencil bits (I don't really know what's that...) + attribs[idx++] = NSOpenGLPFAStencilSize; + attribs[idx++] = (NSOpenGLPixelFormatAttribute) params.StencilBits; + +#if ENABLE_ANTIALIASING + // Antialiasing settings + if (params.AntialiasingLevel) { + samplesIdx = idx; + + attribs[idx++] = NSOpenGLPFASamples; + attribs[idx++] = (NSOpenGLPixelFormatAttribute) params.AntialiasingLevel; + + attribs[idx++] = NSOpenGLPFASampleBuffers; + attribs[idx++] = (NSOpenGLPixelFormatAttribute) GL_TRUE; + } +#endif + + pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + +#if ENABLE_ANTIALIASING + // If pixel format creation fails and antialiasing level is + // greater than 2, we set it to 2. + if (pixFormat == nil && params.AntialiasingLevel > 2) { + std::cerr << "Failed to find a pixel format supporting " << params.AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl; + params.AntialiasingLevel = attribs[samplesIdx + 1] = (NSOpenGLPixelFormatAttribute) 2; + + pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + } + + // If pixel format creation fails and antialiasing is enabled, + // we disable it. + if (pixFormat == nil && params.AntialiasingLevel > 0) { + std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl; + attribs[samplesIdx] = (NSOpenGLPixelFormatAttribute) nil; + + pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; + } +#endif + + if (pixFormat) { + context = [[NSOpenGLContext alloc] initWithFormat:pixFormat + shareContext:[sharedContext retain]]; + + // Get the effective properties from our OpenGL context + GLint tmpDepthSize = 0, tmpStencilBits = 0, tmpAntialiasingLevel = 0; + + if (context) { + [pixFormat getValues:&tmpDepthSize + forAttribute:NSOpenGLPFADepthSize + forVirtualScreen:[context currentVirtualScreen]]; + + [pixFormat getValues:&tmpStencilBits + forAttribute:NSOpenGLPFAStencilSize + forVirtualScreen:[context currentVirtualScreen]]; + + [pixFormat getValues:&tmpAntialiasingLevel + forAttribute:NSOpenGLPFASamples + forVirtualScreen:[context currentVirtualScreen]]; + } + + + params.DepthBits = (unsigned) tmpDepthSize; + params.StencilBits = (unsigned) tmpStencilBits; + params.AntialiasingLevel = (unsigned) tmpAntialiasingLevel; + + [pixFormat release]; + } + + return context; +} + + +static NSOpenGLView * MakeOpenGLView(SFWindow *window, NSOpenGLContext *context, WindowSettings& params) +{ + assert(window != nil); + assert(context != nil); + + NSOpenGLView *view = nil; + + + // We make the NSOpenGLView + view = [[NSOpenGLView alloc] initWithFrame:[[window contentView] bounds] + pixelFormat:nil]; + + if (view) { + // We add the NSOpenGLView to the window + [[window contentView] addSubview:view]; + + [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + [view clearGLContext]; + [view setOpenGLContext:context]; + [context setView:view]; + } + + return view; +} + + +static void ConfigureWindow(SFWindow *window, NSOpenGLView *view, WindowController *controller) +{ + assert(window != nil); + assert(view != nil); + assert(controller != nil); + + // We need to update the OpenGL view when it changes + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:controller + selector:@selector(viewFrameDidChange:) + name:NSViewFrameDidChangeNotification + object:view]; + + // We want to know when our window got the focus + [nc addObserver:controller + selector:@selector(windowDidBecomeMain:) + name:NSWindowDidBecomeMainNotification + object:window]; + + // We want to know when our window lost the focus + [nc addObserver:controller + selector:@selector(windowDidResignMain:) + name:NSWindowDidResignMainNotification + object:window]; + + // We want to know when the user closes the window + [nc addObserver:controller + selector:@selector(windowWillClose:) + name:NSWindowWillCloseNotification + object:window]; + + // I want to re-center the window if it's a full screen one and moved by Spaces + [nc addObserver:controller + selector:@selector(windowDidMove:) + name:NSWindowDidMoveNotification + object:window]; + + + // Needed not to make application crash when releasing the window in our destructor + // (I prefer to take control of everything :P) + [window setReleasedWhenClosed:NO]; + [window setAcceptsMouseMovedEvents:YES]; +} + + +//////////////////////////////////////////////////////////// +/// Return the SFML key corresponding to a key code +//////////////////////////////////////////////////////////// +static Key::Code KeyForVirtualCode(unsigned short vCode) +{ + static struct { + unsigned short code; + Key::Code sfKey; + } virtualTable[] = + { + {0x35, Key::Escape}, + {0x31, Key::Space}, + {0x24, Key::Return}, // main Return key + {0x4C, Key::Return}, // pav Return key + {0x33, Key::Back}, + {0x30, Key::Tab}, + {0x74, Key::PageUp}, + {0x79, Key::PageDown}, + {0x77, Key::End}, + {0x73, Key::Home}, + {0x72, Key::Insert}, + {0x75, Key::Delete}, + {0x45, Key::Add}, + {0x4E, Key::Subtract}, + {0x43, Key::Multiply}, + {0x4B, Key::Divide}, + + {0x7A, Key::F1}, {0x78, Key::F2}, {0x63, Key::F3}, + {0x76, Key::F4}, {0x60, Key::F5}, {0x61, Key::F6}, + {0x62, Key::F7}, {0x64, Key::F8}, {0x65, Key::F9}, + {0x6D, Key::F10}, {0x67, Key::F11}, {0x6F, Key::F12}, + {0x69, Key::F13}, {0x6B, Key::F14}, {0x71, Key::F15}, + + {0x7B, Key::Left}, + {0x7C, Key::Right}, + {0x7E, Key::Up}, + {0x7D, Key::Down}, + + {0x52, Key::Numpad0}, {0x53, Key::Numpad1}, {0x54, Key::Numpad2}, + {0x55, Key::Numpad3}, {0x56, Key::Numpad4}, {0x57, Key::Numpad5}, + {0x58, Key::Numpad6}, {0x59, Key::Numpad7}, {0x5B, Key::Numpad8}, + {0x5C, Key::Numpad9}, + + {0x1D, Key::Num0}, {0x12, Key::Num1}, {0x13, Key::Num2}, + {0x14, Key::Num3}, {0x15, Key::Num4}, {0x17, Key::Num5}, + {0x16, Key::Num6}, {0x1A, Key::Num7}, {0x1C, Key::Num8}, + {0x19, Key::Num9}, + + {0x3B, Key::LControl}, //< Left Ctrl + {0x3A, Key::LAlt}, //< Left Option/Alt + {0x37, Key::LSystem}, //< Left Command + {0x38, Key::LShift}, //< Left Shift + {0x3E, Key::RControl}, //< Right Ctrl + {0x3D, Key::RAlt}, //< Right Option/Alt + {0x36, Key::RSystem}, //< Right Command + {0x3C, Key::RShift}, //< Right Shift + + {0x39, Key::Code(0)} //< Caps Lock + }; + + Key::Code result = Key::Code(0); + + for (unsigned i = 0;virtualTable[i].code;i++) { + if (virtualTable[i].code == vCode) { + result = virtualTable[i].sfKey; + break; + } + } + + return result; +} + + +//////////////////////////////////////////////////////////// +/// Return the SFML key corresponding to a unicode code +//////////////////////////////////////////////////////////// +static Key::Code KeyForUnicode(unsigned short uniCode) +{ + static struct { + unsigned short character; + Key::Code sfKey; + } unicodeTable[] = + { + {'!', Key::Code(0)}, //< No Key for this code + {'"', Key::Code(0)}, //< No Key for this code + {'#', Key::Code(0)}, //< No Key for this code + {'$', Key::Code(0)}, //< No Key for this code + {'%', Key::Code(0)}, //< No Key for this code + {'&', Key::Code(0)}, //< No Key for this code + {'\'', Key::Quote}, + {'(', Key::Code(0)}, //< No Key for this code + {')', Key::Code(0)}, //< No Key for this code + {'*', Key::Multiply}, + {'+', Key::Add}, + {',', Key::Comma}, + {'-', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'.', Key::Period}, + {'/', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'0', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'1', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'2', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'3', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'4', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'5', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'6', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'7', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'8', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {'9', Key::Code(0)}, //< Handled by KeyForVirtualCode() + {':', Key::Code(0)}, //< No Key for this code + {';', Key::SemiColon}, + {'<', Key::Code(0)}, //< No Key for this code + {'=', Key::Equal}, + {'>', Key::Code(0)}, //< No Key for this code + {'?', Key::Code(0)}, //< No Key for this code + {'@', Key::Code(0)}, //< No Key for this code + {'A', Key::A}, {'B', Key::B}, {'C', Key::C}, + {'D', Key::D}, {'E', Key::E}, {'F', Key::F}, + {'G', Key::G}, {'H', Key::H}, {'I', Key::I}, + {'J', Key::J}, {'K', Key::K}, {'L', Key::L}, + {'M', Key::M}, {'N', Key::N}, {'O', Key::O}, + {'P', Key::P}, {'Q', Key::Q}, {'R', Key::R}, + {'S', Key::S}, {'T', Key::T}, {'U', Key::U}, + {'V', Key::V}, {'W', Key::W}, {'X', Key::X}, + {'Y', Key::Y}, {'Z', Key::Z}, + {'[', Key::LBracket}, + {'\\', Key::BackSlash}, + {']', Key::RBracket}, + {'^', Key::Code(0)}, //< No Key for this code + {'_', Key::Code(0)}, //< No Key for this code + {'`', Key::Code(0)}, //< No Key for this code + {'a', Key::A}, {'b', Key::B}, {'c', Key::C}, + {'d', Key::D}, {'e', Key::E}, {'f', Key::F}, + {'g', Key::G}, {'h', Key::H}, {'i', Key::I}, + {'j', Key::J}, {'k', Key::K}, {'l', Key::L}, + {'m', Key::M}, {'n', Key::N}, {'o', Key::O}, + {'p', Key::P}, {'q', Key::Q}, {'r', Key::R}, + {'s', Key::S}, {'t', Key::T}, {'u', Key::U}, + {'v', Key::V}, {'w', Key::W}, {'x', Key::X}, + {'y', Key::Y}, {'z', Key::Z}, + {'{', Key::Code(0)}, //< No Key for this code + {'|', Key::Code(0)}, //< No Key for this code + {'}', Key::Code(0)}, //< No Key for this code + {'~', Key::Tilde}, + {0, Key::Code(0)} + }; + + Key::Code result = Key::Code(0); + + for (unsigned i = 0;unicodeTable[i].character;i++) { + if (unicodeTable[i].character == uniCode) { + result = unicodeTable[i].sfKey; + break; + } + } + + return result; +} + + +//////////////////////////////////////////////////////////// +/// Return whether 'ev' must be considered as a TextEntered event +//////////////////////////////////////////////////////////// +static bool IsTextEvent(NSEvent *event) +{ + bool res = false; + + if (event && [event type] == NSKeyDown && [[event characters] length]) { + unichar code = [[event characters] characterAtIndex:0]; + + // Codes from 0xF700 to 0xF8FF are non text keys (see NSEvent.h) + if (code < 0xF700 || code > 0xF8FF) + res = true; + } + + return res; +} + + +//////////////////////////////////////////////////////////// +/// Return whether the mouse is on our OpenGL view +//////////////////////////////////////////////////////////// +static bool MouseInside(SFWindow *window, NSView *view) +{ + bool res = false; + + if (window && view && [window isVisible]) { + NSPoint relativeToWindow = [window mouseLocationOutsideOfEventStream]; + NSPoint relativeToView = [view convertPoint:relativeToWindow fromView:nil]; + + if (NSPointInRect (relativeToView, [view bounds])) + res = true; + } + + return res; +} + + +//////////////////////////////////////////////////////////// +/// Return the mouse location in the SFML coordinates according to 'window' +//////////////////////////////////////////////////////////// +static NSPoint MouseLocation(SFWindow *window) +{ + NSPoint location = [NSEvent mouseLocation]; + NSPoint relativeLocation = {0, 0}; + + if (window) { + relativeLocation = [window convertScreenToBase:location]; + relativeLocation.y = [[window contentView] frame].size.height - relativeLocation.y; + } else { + std::cerr << "*** SFML: tried to get mouse location from no window" << std::endl; + } + + return relativeLocation; +} + +} // namespace priv + +} // namespace sf + diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp new file mode 100644 index 00000000..5f4cd74b --- /dev/null +++ b/src/SFML/Window/Context.cpp @@ -0,0 +1,87 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace +{ + // Make sure the dummy context is created at global startup + sf::Context& Dummy = sf::Context::GetGlobal(); +} + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor, create the context +//////////////////////////////////////////////////////////// +Context::Context() +{ + myDummyWindow = priv::WindowImpl::New(); +} + + +//////////////////////////////////////////////////////////// +/// Destructor, destroy the context +//////////////////////////////////////////////////////////// +Context::~Context() +{ + delete myDummyWindow; +} + + +//////////////////////////////////////////////////////////// +/// Activate or deactivate the context +//////////////////////////////////////////////////////////// +void Context::SetActive(bool Active) +{ + myDummyWindow->SetActive(Active); +} + + +//////////////////////////////////////////////////////////// +/// Check if there's a context bound to the current thread +//////////////////////////////////////////////////////////// +bool Context::IsContextActive() +{ + return priv::WindowImpl::IsContextActive(); +} + + +//////////////////////////////////////////////////////////// +/// Get the global context +//////////////////////////////////////////////////////////// +Context& Context::GetGlobal() +{ + static Context* GlobalContext = new Context; // Never deleted, on purpose + + return *GlobalContext; +} + +} // namespace sf diff --git a/src/SFML/Window/Input.cpp b/src/SFML/Window/Input.cpp new file mode 100644 index 00000000..d5fac6e0 --- /dev/null +++ b/src/SFML/Window/Input.cpp @@ -0,0 +1,169 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +Input::Input() : +myMouseX(0), +myMouseY(0) +{ + for (int i = 0; i < Key::Count; ++i) + myKeys[i] = false; + + for (int i = 0; i < Mouse::Count; ++i) + myMouseButtons[i] = false; + + for (int i = 0; i < 16; ++i) + { + myJoystickButtons[0][i] = false; + myJoystickButtons[1][i] = false; + } + + for (int i = 0; i < Joy::Count; ++i) + { + myJoystickAxis[0][i] = 0.f; + myJoystickAxis[1][i] = 0.f; + } +} + + +//////////////////////////////////////////////////////////// +/// Get the state of a key +//////////////////////////////////////////////////////////// +bool Input::IsKeyDown(Key::Code KeyCode) const +{ + return myKeys[KeyCode]; +} + + +//////////////////////////////////////////////////////////// +/// Get the state of a mouse button +//////////////////////////////////////////////////////////// +bool Input::IsMouseButtonDown(Mouse::Button Button) const +{ + return myMouseButtons[Button]; +} + + +//////////////////////////////////////////////////////////// +/// Get the state of a joystick button +//////////////////////////////////////////////////////////// +bool Input::IsJoystickButtonDown(unsigned int JoyId, unsigned int Button) const +{ + if ((JoyId < 2) && (Button < 16)) + return myJoystickButtons[JoyId][Button]; + else + return false; +} + + +//////////////////////////////////////////////////////////// +/// Get the mouse left position +//////////////////////////////////////////////////////////// +int Input::GetMouseX() const +{ + return myMouseX; +} + + +//////////////////////////////////////////////////////////// +/// Get the mouse top position +//////////////////////////////////////////////////////////// +int Input::GetMouseY() const +{ + return myMouseY; +} + + +//////////////////////////////////////////////////////////// +/// Get a joystick axis position +//////////////////////////////////////////////////////////// +float Input::GetJoystickAxis(unsigned int JoyId, Joy::Axis Axis) const +{ + return myJoystickAxis[JoyId][Axis]; +} + + +//////////////////////////////////////////////////////////// +/// /see WindowListener::OnEvent +//////////////////////////////////////////////////////////// +void Input::OnEvent(const Event& EventReceived) +{ + switch (EventReceived.Type) + { + // Key events + case Event::KeyPressed : myKeys[EventReceived.Key.Code] = true; break; + case Event::KeyReleased : myKeys[EventReceived.Key.Code] = false; break; + + // Mouse event + case Event::MouseButtonPressed : myMouseButtons[EventReceived.MouseButton.Button] = true; break; + case Event::MouseButtonReleased : myMouseButtons[EventReceived.MouseButton.Button] = false; break; + + // Mouse move event + case Event::MouseMoved : + myMouseX = EventReceived.MouseMove.X; + myMouseY = EventReceived.MouseMove.Y; + break; + + // Joystick button events + case Event::JoyButtonPressed : myJoystickButtons[EventReceived.JoyButton.JoystickId][EventReceived.JoyButton.Button] = true; break; + case Event::JoyButtonReleased : myJoystickButtons[EventReceived.JoyButton.JoystickId][EventReceived.JoyButton.Button] = false; break; + + // Joystick move event + case Event::JoyMoved : + myJoystickAxis[EventReceived.JoyMove.JoystickId][EventReceived.JoyMove.Axis] = EventReceived.JoyMove.Position; + break; + + // Lost focus event : we must reset all persistent states + case Event::LostFocus : + { + for (int i = 0; i < Key::Count; ++i) + myKeys[i] = false; + + for (int i = 0; i < Mouse::Count; ++i) + myMouseButtons[i] = false; + + for (int i = 0; i < 16; ++i) + { + myJoystickButtons[0][i] = false; + myJoystickButtons[1][i] = false; + } + break; + } + + default : + break; + } +} + +} // namespace sf diff --git a/src/SFML/Window/Joystick.hpp b/src/SFML/Window/Joystick.hpp new file mode 100644 index 00000000..0d07ec2e --- /dev/null +++ b/src/SFML/Window/Joystick.hpp @@ -0,0 +1,70 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICK_HPP +#define SFML_JOYSTICK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Structure holding the joystick state's parameters +//////////////////////////////////////////////////////////// +struct JoystickState +{ + enum {MaxButtons = 32}; + + float Axis[Joy::Count]; ///< Position on each axis in range [-100, 100] (except POV which is [0, 360]) + bool Buttons[MaxButtons]; ///< Status of each button (true = pressed) +}; + +} // namespace priv + +} // namespace sf + + +#if defined(SFML_SYSTEM_WINDOWS) + + #include + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + #include + +#elif defined(SFML_SYSTEM_MACOS) + + #include + +#endif + + +#endif // SFML_JOYSTICK_HPP diff --git a/src/SFML/Window/Linux/Joystick.cpp b/src/SFML/Window/Linux/Joystick.cpp new file mode 100644 index 00000000..25b1c32b --- /dev/null +++ b/src/SFML/Window/Linux/Joystick.cpp @@ -0,0 +1,171 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + +#if defined(SFML_SYSTEM_LINUX) + #include + #include +#elif defined(SFML_SYSTEM_FREEBSD) + // #include ? +#endif + + +namespace sf +{ +namespace priv +{ +#if defined(SFML_SYSTEM_LINUX) + +//////////////////////////////////////////////////////////// +/// Initialize the instance and bind it to a physical joystick +//////////////////////////////////////////////////////////// +void Joystick::Initialize(unsigned int Index) +{ + // Initial state + myNbAxes = 0; + myNbButtons = 0; + for (int i = 0; i < Joy::Count; ++i) + myState.Axis[i] = 0.f; + for (int i = 0; i < JoystickState::MaxButtons; ++i) + myState.Buttons[i] = false; + + // Open the joystick handle + std::ostringstream oss; + oss << "/dev/input/js" << Index; + myDescriptor = open(oss.str().c_str(), O_RDONLY); + if (myDescriptor > 0) + { + // Use non-blocking mode + fcntl(myDescriptor, F_SETFL, O_NONBLOCK); + + // Get number of axes and buttons + char NbAxes, NbButtons; + ioctl(myDescriptor, JSIOCGAXES, &NbAxes); + ioctl(myDescriptor, JSIOCGBUTTONS, &NbButtons); + myNbAxes = NbAxes; + myNbButtons = NbButtons; + } +} + + +//////////////////////////////////////////////////////////// +/// Update the current joystick and return its new state +//////////////////////////////////////////////////////////// +JoystickState Joystick::UpdateState() +{ + if (myDescriptor > 0) + { + js_event JoyState; + while (read(myDescriptor, &JoyState, sizeof(JoyState)) > 0) + { + switch (JoyState.type & ~JS_EVENT_INIT) + { + // An axis has been moved + case JS_EVENT_AXIS : + { + if (JoyState.number < Joy::Count) + myState.Axis[JoyState.number] = JoyState.value * 100.f / 32767.f; + break; + } + + // A button has been pressed + case JS_EVENT_BUTTON : + { + if (JoyState.number < GetButtonsCount()) + myState.Buttons[JoyState.number] = (JoyState.value != 0); + break; + } + } + } + } + + return myState; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of axes supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetAxesCount() const +{ + return myNbAxes; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of buttons supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetButtonsCount() const +{ + return myNbButtons; +} + + +#elif defined(SFML_SYSTEM_FREEBSD) + + +//////////////////////////////////////////////////////////// +/// Initialize the instance and bind it to a physical joystick +//////////////////////////////////////////////////////////// +void Joystick::Initialize(unsigned int Index) +{ +} + + +//////////////////////////////////////////////////////////// +/// Update the current joystick and return its new state +//////////////////////////////////////////////////////////// +JoystickState Joystick::UpdateState() +{ + return JoystickState(); +} + + +//////////////////////////////////////////////////////////// +/// Get the number of axes supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetAxesCount() const +{ + return 0; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of buttons supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetButtonsCount() const +{ + return 0; +} + +#endif // defined(SFML_SYSTEM_FREEBSD) + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Linux/Joystick.hpp b/src/SFML/Window/Linux/Joystick.hpp new file mode 100644 index 00000000..1c1e4a2f --- /dev/null +++ b/src/SFML/Window/Linux/Joystick.hpp @@ -0,0 +1,92 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICKLINUX_HPP +#define SFML_JOYSTICKLINUX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Linux implementation of Joystick +//////////////////////////////////////////////////////////// +class Joystick +{ +public : + + //////////////////////////////////////////////////////////// + /// Initialize the instance and bind it to a physical joystick + /// + /// \param Index : Index of the physical joystick to bind to + /// + //////////////////////////////////////////////////////////// + void Initialize(unsigned int Index); + + //////////////////////////////////////////////////////////// + /// Update the current joystick and return its new state + /// + /// \return Current state of the joystick + /// + //////////////////////////////////////////////////////////// + JoystickState UpdateState(); + + //////////////////////////////////////////////////////////// + /// Get the number of axes supported by the joystick + /// + /// \return Number of axis + /// + //////////////////////////////////////////////////////////// + unsigned int GetAxesCount() const; + + //////////////////////////////////////////////////////////// + /// Get the number of buttons supported by the joystick + /// + /// \return Number of buttons + /// + //////////////////////////////////////////////////////////// + unsigned int GetButtonsCount() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + int myDescriptor; ///< Linux descriptor of the joystick + unsigned int myNbAxes; ///< Number of axis supported by the joystick + unsigned int myNbButtons; ///< Number of buttons supported by the joystick + JoystickState myState; ///< Current state of the joystick +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_JOYSTICKLINUX_HPP diff --git a/src/SFML/Window/Linux/VideoModeSupport.cpp b/src/SFML/Window/Linux/VideoModeSupport.cpp new file mode 100644 index 00000000..d3287020 --- /dev/null +++ b/src/SFML/Window/Linux/VideoModeSupport.cpp @@ -0,0 +1,135 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get supported video modes +//////////////////////////////////////////////////////////// +void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) +{ + // First, clear array to fill + Modes.clear(); + + // Get the display and screen from sfWindowImplUnix + WindowImplX11::OpenDisplay(false); + Display* Disp = WindowImplX11::ourDisplay; + int Screen = WindowImplX11::ourScreen; + + // Check if the XRandR extension is present + int Version; + if (XQueryExtension(Disp, "RANDR", &Version, &Version, &Version)) + { + // Get the current configuration + XRRScreenConfiguration* Config = XRRGetScreenInfo(Disp, RootWindow(Disp, Screen)); + if (Config) + { + // Get the available screen sizes + int NbSizes; + XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes); + if (Sizes && (NbSizes > 0)) + { + // Add them to the video modes array + for (int i = 0; i < NbSizes; ++i) + { + // Convert to sfVideoMode + VideoMode Mode(Sizes[i].width, Sizes[i].height, 32); + + // Add it only if it is not already in the array + if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end()) + Modes.push_back(Mode); + } + } + + // Free the configuration instance + XRRFreeScreenConfigInfo(Config); + } + else + { + // Failed to get the screen configuration + std::cerr << "Failed to get the list of available video modes" << std::endl; + } + } + else + { + // XRandr extension is not supported : we cannot get the video modes + std::cerr << "Failed to get the list of available video modes" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Get current desktop video mode +//////////////////////////////////////////////////////////// +VideoMode VideoModeSupport::GetDesktopVideoMode() +{ + VideoMode DesktopMode; + + // Get the display and screen from sfWindowImplUnix + WindowImplX11::OpenDisplay(false); + Display* Disp = WindowImplX11::ourDisplay; + int Screen = WindowImplX11::ourScreen; + + // Check if the XRandR extension is present + int Version; + if (XQueryExtension(Disp, "RANDR", &Version, &Version, &Version)) + { + // Get the current configuration + XRRScreenConfiguration* Config = XRRGetScreenInfo(Disp, RootWindow(Disp, Screen)); + if (Config) + { + // Get the current video mode + Rotation CurrentRotation; + int CurrentMode = XRRConfigCurrentConfiguration(Config, &CurrentRotation); + + // Get the available screen sizes + int NbSizes; + XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes); + if (Sizes && (NbSizes > 0)) + DesktopMode = VideoMode(Sizes[CurrentMode].width, Sizes[CurrentMode].height, 32); + + // Free the configuration instance + XRRFreeScreenConfigInfo(Config); + } + } + + return DesktopMode; +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Linux/VideoModeSupport.hpp b/src/SFML/Window/Linux/VideoModeSupport.hpp new file mode 100644 index 00000000..87291fca --- /dev/null +++ b/src/SFML/Window/Linux/VideoModeSupport.hpp @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODESUPPORTLINUX_HPP +#define SFML_VIDEOMODESUPPORTLINUX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Linux implementation of VideoModeSupport +/// Give access to video mode related OS-specific functions +//////////////////////////////////////////////////////////// +class VideoModeSupport +{ +public : + + //////////////////////////////////////////////////////////// + /// Get supported video modes + /// + /// \param Modes : Array to fill with available video modes + /// + //////////////////////////////////////////////////////////// + static void GetSupportedVideoModes(std::vector& Modes); + + //////////////////////////////////////////////////////////// + /// Get current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode GetDesktopVideoMode(); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_VIDEOMODESUPPORTLINUX_HPP diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp new file mode 100644 index 00000000..590f90af --- /dev/null +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -0,0 +1,1221 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // important to be included first (conflict with None) +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +Display* WindowImplX11::ourDisplay = NULL; +int WindowImplX11::ourScreen = 0; +WindowImplX11* WindowImplX11::ourFullscreenWindow = NULL; +unsigned int WindowImplX11::ourWindowsCount = 0; +XIM WindowImplX11::ourInputMethod = NULL; +unsigned long WindowImplX11::ourEventMask = FocusChangeMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | + PointerMotionMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask | + EnterWindowMask | LeaveWindowMask; + + +//////////////////////////////////////////////////////////// +/// Default constructor +/// (creates a dummy window to provide a valid OpenGL context) +//////////////////////////////////////////////////////////// +WindowImplX11::WindowImplX11() : +myWindow (0), +myIsExternal (false), +myGLContext (NULL), +myAtomClose (0), +myOldVideoMode(-1), +myHiddenCursor(0), +myInputContext(NULL), +myKeyRepeat (true) +{ + // Open the display at first call + if (!OpenDisplay()) + return; + + // Use small dimensions + myWidth = 1; + myHeight = 1; + + // Create the rendering context + XVisualInfo Visual; + WindowSettings Params(0, 0, 0); + if (!CreateContext(VideoMode(myWidth, myHeight, 32), Visual, Params)) + return; + + // Create a new color map with the chosen visual + Colormap ColMap = XCreateColormap(ourDisplay, RootWindow(ourDisplay, ourScreen), Visual.visual, AllocNone); + + // Define the window attributes + XSetWindowAttributes Attributes; + Attributes.colormap = ColMap; + + // Create a dummy window (disabled and hidden) + myWindow = XCreateWindow(ourDisplay, + RootWindow(ourDisplay, ourScreen), + 0, 0, + myWidth, myHeight, + 0, + Visual.depth, + InputOutput, + Visual.visual, + CWColormap, &Attributes); + + // Don't activate the dummy context by default +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation from an existing control +//////////////////////////////////////////////////////////// +WindowImplX11::WindowImplX11(WindowHandle Handle, WindowSettings& Params) : +myWindow (0), +myIsExternal (true), +myGLContext (NULL), +myAtomClose (0), +myOldVideoMode(-1), +myHiddenCursor(0), +myInputContext(NULL), +myKeyRepeat (true) +{ + // Open the display at first call + if (!OpenDisplay()) + return; + + // Save the window handle + myWindow = Handle; + + if (myWindow) + { + // Get the window size + XWindowAttributes WindowAttributes; + if (XGetWindowAttributes(ourDisplay, myWindow, &WindowAttributes) == 0) + { + std::cerr << "Failed to get the window attributes" << std::endl; + return; + } + myWidth = WindowAttributes.width; + myHeight = WindowAttributes.height; + + // Setup the visual infos to match + XVisualInfo Template; + Template.depth = WindowAttributes.depth; + Template.visualid = XVisualIDFromVisual(WindowAttributes.visual); + unsigned long Mask = VisualDepthMask | VisualIDMask; + + // Create the rendering context + VideoMode Mode(myWidth, myHeight, VideoMode::GetDesktopMode().BitsPerPixel); + XVisualInfo Visual; + if (!CreateContext(Mode, Visual, Params, Template, Mask)) + return; + + // Create a new color map with the chosen visual + Colormap ColMap = XCreateColormap(ourDisplay, RootWindow(ourDisplay, ourScreen), Visual.visual, AllocNone); + XSetWindowColormap(ourDisplay, myWindow, ColMap); + + // Make sure the window is listening to all the requiered events + XSelectInput(ourDisplay, myWindow, ourEventMask & ~ButtonPressMask); + + // Do some common initializations + Initialize(); + } +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation +//////////////////////////////////////////////////////////// +WindowImplX11::WindowImplX11(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) : +myWindow (0), +myIsExternal (false), +myGLContext (NULL), +myAtomClose (0), +myOldVideoMode(-1), +myHiddenCursor(0), +myInputContext(NULL), +myKeyRepeat (true) +{ + // Open the display at first call + if (!OpenDisplay()) + return; + + // Compute position and size + int Left, Top; + bool Fullscreen = (WindowStyle & Style::Fullscreen) != 0; + if (!Fullscreen) + { + Left = (DisplayWidth(ourDisplay, ourScreen) - Mode.Width) / 2; + Top = (DisplayHeight(ourDisplay, ourScreen) - Mode.Height) / 2; + } + else + { + Left = 0; + Top = 0; + } + int Width = myWidth = Mode.Width; + int Height = myHeight = Mode.Height; + + // Switch to fullscreen if necessary + if (Fullscreen) + SwitchToFullscreen(Mode); + + // Create the rendering context + XVisualInfo Visual; + if (!CreateContext(Mode, Visual, Params)) + return; + + // Create a new color map with the chosen visual + Colormap ColMap = XCreateColormap(ourDisplay, RootWindow(ourDisplay, ourScreen), Visual.visual, AllocNone); + + // Define the window attributes + XSetWindowAttributes Attributes; + Attributes.event_mask = ourEventMask; + Attributes.colormap = ColMap; + Attributes.override_redirect = Fullscreen; + + // Create the window + myWindow = XCreateWindow(ourDisplay, + RootWindow(ourDisplay, ourScreen), + Left, Top, + Width, Height, + 0, + Visual.depth, + InputOutput, + Visual.visual, + CWEventMask | CWColormap | CWOverrideRedirect, &Attributes); + if (!myWindow) + { + std::cerr << "Failed to create window" << std::endl; + return; + } + + // Set the window's name + XStoreName(ourDisplay, myWindow, Title.c_str()); + + // Set the window's style (tell the windows manager to change our window's decorations and functions according to the requested style) + if (!Fullscreen) + { + Atom WMHintsAtom = XInternAtom(ourDisplay, "_MOTIF_WM_HINTS", false); + if (WMHintsAtom) + { + static const unsigned long MWM_HINTS_FUNCTIONS = 1 << 0; + static const unsigned long MWM_HINTS_DECORATIONS = 1 << 1; + + //static const unsigned long MWM_DECOR_ALL = 1 << 0; + static const unsigned long MWM_DECOR_BORDER = 1 << 1; + static const unsigned long MWM_DECOR_RESIZEH = 1 << 2; + static const unsigned long MWM_DECOR_TITLE = 1 << 3; + static const unsigned long MWM_DECOR_MENU = 1 << 4; + static const unsigned long MWM_DECOR_MINIMIZE = 1 << 5; + static const unsigned long MWM_DECOR_MAXIMIZE = 1 << 6; + + //static const unsigned long MWM_FUNC_ALL = 1 << 0; + static const unsigned long MWM_FUNC_RESIZE = 1 << 1; + static const unsigned long MWM_FUNC_MOVE = 1 << 2; + static const unsigned long MWM_FUNC_MINIMIZE = 1 << 3; + static const unsigned long MWM_FUNC_MAXIMIZE = 1 << 4; + static const unsigned long MWM_FUNC_CLOSE = 1 << 5; + + struct WMHints + { + unsigned long Flags; + unsigned long Functions; + unsigned long Decorations; + long InputMode; + unsigned long State; + }; + + WMHints Hints; + Hints.Flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; + Hints.Decorations = 0; + Hints.Functions = 0; + + if (WindowStyle & Style::Titlebar) + { + Hints.Decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU; + Hints.Functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE; + } + if (WindowStyle & Style::Resize) + { + Hints.Decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH; + Hints.Functions |= MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE; + } + if (WindowStyle & Style::Close) + { + Hints.Decorations |= 0; + Hints.Functions |= MWM_FUNC_CLOSE; + } + + const unsigned char* HintsPtr = reinterpret_cast(&Hints); + XChangeProperty(ourDisplay, myWindow, WMHintsAtom, WMHintsAtom, 32, PropModeReplace, HintsPtr, 5); + } + + // This is a hack to force some windows managers to disable resizing + if (!(WindowStyle & Style::Resize)) + { + XSizeHints XSizeHints; + XSizeHints.flags = PMinSize | PMaxSize; + XSizeHints.min_width = XSizeHints.max_width = Width; + XSizeHints.min_height = XSizeHints.max_height = Height; + XSetWMNormalHints(ourDisplay, myWindow, &XSizeHints); + } + } + + // Do some common initializations + Initialize(); + + // In fullscreen mode, we must grab keyboard and mouse inputs + if (Fullscreen) + { + XGrabPointer(ourDisplay, myWindow, true, 0, GrabModeAsync, GrabModeAsync, myWindow, None, CurrentTime); + XGrabKeyboard(ourDisplay, myWindow, true, GrabModeAsync, GrabModeAsync, CurrentTime); + } +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +WindowImplX11::~WindowImplX11() +{ + // Cleanup graphical resources + CleanUp(); + + // Destroy the input context + if (myInputContext) + { + XDestroyIC(myInputContext); + } + + // Destroy the window + if (myWindow && !myIsExternal) + { + XDestroyWindow(ourDisplay, myWindow); + XFlush(ourDisplay); + } + + // Close the display + CloseDisplay(); +} + + +//////////////////////////////////////////////////////////// +/// Check if there's an active context on the current thread +//////////////////////////////////////////////////////////// +bool WindowImplX11::IsContextActive() +{ + return glXGetCurrentContext() != NULL; +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::Display +//////////////////////////////////////////////////////////// +void WindowImplX11::Display() +{ + if (myWindow && myGLContext) + glXSwapBuffers(ourDisplay, myWindow); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::ProcessEvents +//////////////////////////////////////////////////////////// +void WindowImplX11::ProcessEvents() +{ + // Process any event in the queue matching our window + XEvent Event; + while (XCheckIfEvent(ourDisplay, &Event, &WindowImplX11::CheckEvent, reinterpret_cast(myWindow))) + { + // Filter repeated key events + if (Event.type == KeyRelease) + { + if (XPending(ourDisplay)) + { + XEvent NextEvent; + XPeekEvent(ourDisplay, &NextEvent); + if ((NextEvent.type == KeyPress) && + (NextEvent.xkey.keycode == Event.xkey.keycode) && + (NextEvent.xkey.time == Event.xkey.time)) + { + if (!myKeyRepeat) + XNextEvent(ourDisplay, &NextEvent); + continue; + } + } + } + + ProcessEvent(Event); + } +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetActive +//////////////////////////////////////////////////////////// +void WindowImplX11::SetActive(bool Active) const +{ + if (Active) + { + if (myWindow && myGLContext && (glXGetCurrentContext() != myGLContext)) + glXMakeCurrent(ourDisplay, myWindow, myGLContext); + } + else + { + if (glXGetCurrentContext() == myGLContext) + glXMakeCurrent(ourDisplay, None, NULL); + } +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::UseVerticalSync +//////////////////////////////////////////////////////////// +void WindowImplX11::UseVerticalSync(bool Enabled) +{ + const GLubyte* ProcAddress = reinterpret_cast("glXSwapIntervalSGI"); + PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast(glXGetProcAddress(ProcAddress)); + if (glXSwapIntervalSGI) + glXSwapIntervalSGI(Enabled ? 1 : 0); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::ShowMouseCursor +//////////////////////////////////////////////////////////// +void WindowImplX11::ShowMouseCursor(bool Show) +{ + XDefineCursor(ourDisplay, myWindow, Show ? None : myHiddenCursor); + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::SetCursorPosition +//////////////////////////////////////////////////////////// +void WindowImplX11::SetCursorPosition(unsigned int Left, unsigned int Top) +{ + XWarpPointer(ourDisplay, None, myWindow, 0, 0, 0, 0, Left, Top); + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::SetPosition +//////////////////////////////////////////////////////////// +void WindowImplX11::SetPosition(int Left, int Top) +{ + XMoveWindow(ourDisplay, myWindow, Left, Top); + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetSize +//////////////////////////////////////////////////////////// +void WindowImplX11::SetSize(unsigned int Width, unsigned int Height) +{ + XResizeWindow(ourDisplay, myWindow, Width, Height); + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::Show +//////////////////////////////////////////////////////////// +void WindowImplX11::Show(bool State) +{ + if (State) + XMapWindow(ourDisplay, myWindow); + else + XUnmapWindow(ourDisplay, myWindow); + + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// /see sfWindowImpl::EnableKeyRepeat +//////////////////////////////////////////////////////////// +void WindowImplX11::EnableKeyRepeat(bool Enabled) +{ + myKeyRepeat = Enabled; +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetIcon +//////////////////////////////////////////////////////////// +void WindowImplX11::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +{ + // X11 wants BGRA pixels : swap red and blue channels + // Note : this memory will never be freed, but it seems to cause a bug on exit if I do so + Uint8* IconPixels = new Uint8[Width * Height * 4]; + for (std::size_t i = 0; i < Width * Height; ++i) + { + IconPixels[i * 4 + 0] = Pixels[i * 4 + 2]; + IconPixels[i * 4 + 1] = Pixels[i * 4 + 1]; + IconPixels[i * 4 + 2] = Pixels[i * 4 + 0]; + IconPixels[i * 4 + 3] = Pixels[i * 4 + 3]; + } + + // Create the icon pixmap + Visual* DefVisual = DefaultVisual(ourDisplay, ourScreen); + unsigned int DefDepth = DefaultDepth(ourDisplay, ourScreen); + XImage* IconImage = XCreateImage(ourDisplay, DefVisual, DefDepth, ZPixmap, 0, (char*)IconPixels, Width, Height, 32, 0); + if (!IconImage) + { + std::cerr << "Failed to set the window's icon" << std::endl; + return; + } + Pixmap IconPixmap = XCreatePixmap(ourDisplay, RootWindow(ourDisplay, ourScreen), Width, Height, DefDepth); + XGCValues Values; + GC IconGC = XCreateGC(ourDisplay, IconPixmap, 0, &Values); + XPutImage(ourDisplay, IconPixmap, IconGC, IconImage, 0, 0, 0, 0, Width, Height); + XFreeGC(ourDisplay, IconGC); + XDestroyImage(IconImage); + + // Create the mask pixmap (must have 1 bit depth) + std::size_t Pitch = (Width + 7) / 8; + static std::vector MaskPixels(Pitch * Height, 0); + for (std::size_t j = 0; j < Height; ++j) + { + for (std::size_t i = 0; i < Pitch; ++i) + { + for (std::size_t k = 0; k < 8; ++k) + { + if (i * 8 + k < Width) + { + Uint8 Opacity = (Pixels[(i * 8 + k + j * Width) * 4 + 3] > 0) ? 1 : 0; + MaskPixels[i + j * Pitch] |= (Opacity << k); + } + } + } + } + Pixmap MaskPixmap = XCreatePixmapFromBitmapData(ourDisplay, myWindow, (char*)&MaskPixels[0], Width, Height, 1, 0, 1); + + // Send our new icon to the window through the WMHints + XWMHints* Hints = XAllocWMHints(); + Hints->flags = IconPixmapHint | IconMaskHint; + Hints->icon_pixmap = IconPixmap; + Hints->icon_mask = MaskPixmap; + XSetWMHints(ourDisplay, myWindow, Hints); + XFree(Hints); + + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// Switch to fullscreen mode +//////////////////////////////////////////////////////////// +void WindowImplX11::SwitchToFullscreen(const VideoMode& Mode) +{ + // Check if the XRandR extension is present + int Version; + if (XQueryExtension(ourDisplay, "RANDR", &Version, &Version, &Version)) + { + // Get the current configuration + XRRScreenConfiguration* Config = XRRGetScreenInfo(ourDisplay, RootWindow(ourDisplay, ourScreen)); + if (Config) + { + // Get the current rotation + Rotation CurrentRotation; + myOldVideoMode = XRRConfigCurrentConfiguration(Config, &CurrentRotation); + + // Get the available screen sizes + int NbSizes; + XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes); + if (Sizes && (NbSizes > 0)) + { + // Search a matching size + for (int i = 0; i < NbSizes; ++i) + { + if ((Sizes[i].width == static_cast(Mode.Width)) && (Sizes[i].height == static_cast(Mode.Height))) + { + // Switch to fullscreen mode + XRRSetScreenConfig(ourDisplay, Config, RootWindow(ourDisplay, ourScreen), i, CurrentRotation, CurrentTime); + + // Set "this" as the current fullscreen window + ourFullscreenWindow = this; + break; + } + } + } + + // Free the configuration instance + XRRFreeScreenConfigInfo(Config); + } + else + { + // Failed to get the screen configuration + std::cerr << "Failed to get the current screen configuration for fullscreen mode, switching to windiw mode" << std::endl; + } + } + else + { + // XRandr extension is not supported : we cannot use fullscreen mode + std::cerr << "Fullscreen is not supported, switching to window mode" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Create the OpenGL rendering context +//////////////////////////////////////////////////////////// +bool WindowImplX11::CreateContext(const VideoMode& Mode, XVisualInfo& ChosenVisual, WindowSettings& Params, XVisualInfo Template, unsigned long Mask) +{ + // Get all the visuals matching the template + Template.screen = ourScreen; + int NbVisuals = 0; + XVisualInfo* Visuals = XGetVisualInfo(ourDisplay, Mask | VisualScreenMask, &Template, &NbVisuals); + if (!Visuals || (NbVisuals == 0)) + { + if (Visuals) + XFree(Visuals); + std::cerr << "There is no valid visual for the selected screen" << std::endl; + return false; + } + + // Find the best visual + int BestScore = 0xFFFF; + XVisualInfo* BestVisual = NULL; + while (!BestVisual) + { + for (int i = 0; i < NbVisuals; ++i) + { + // Get the current visual attributes + int RGBA, DoubleBuffer, Red, Green, Blue, Alpha, Depth, Stencil, MultiSampling, Samples; + glXGetConfig(ourDisplay, &Visuals[i], GLX_RGBA, &RGBA); + glXGetConfig(ourDisplay, &Visuals[i], GLX_DOUBLEBUFFER, &DoubleBuffer); + glXGetConfig(ourDisplay, &Visuals[i], GLX_RED_SIZE, &Red); + glXGetConfig(ourDisplay, &Visuals[i], GLX_GREEN_SIZE, &Green); + glXGetConfig(ourDisplay, &Visuals[i], GLX_BLUE_SIZE, &Blue); + glXGetConfig(ourDisplay, &Visuals[i], GLX_ALPHA_SIZE, &Alpha); + glXGetConfig(ourDisplay, &Visuals[i], GLX_DEPTH_SIZE, &Depth); + glXGetConfig(ourDisplay, &Visuals[i], GLX_STENCIL_SIZE, &Stencil); + glXGetConfig(ourDisplay, &Visuals[i], GLX_SAMPLE_BUFFERS_ARB, &MultiSampling); + glXGetConfig(ourDisplay, &Visuals[i], GLX_SAMPLES_ARB, &Samples); + + // First check the mandatory parameters + if ((RGBA == 0) || (DoubleBuffer == 0)) + continue; + + // Evaluate the current configuration + int Color = Red + Green + Blue + Alpha; + int Score = EvaluateConfig(Mode, Params, Color, Depth, Stencil, MultiSampling ? Samples : 0); + + // Keep it if it's better than the current best + if (Score < BestScore) + { + BestScore = Score; + BestVisual = &Visuals[i]; + } + } + + // If no visual has been found, try a lower level of antialiasing + if (!BestVisual) + { + if (Params.AntialiasingLevel > 2) + { + std::cerr << "Failed to find a pixel format supporting " + << Params.AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl; + Params.AntialiasingLevel = 2; + } + else if (Params.AntialiasingLevel > 0) + { + std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl; + Params.AntialiasingLevel = 0; + } + else + { + std::cerr << "Failed to find a suitable pixel format for the window -- cannot create OpenGL context" << std::endl; + return false; + } + } + } + + // Create the OpenGL context + myGLContext = glXCreateContext(ourDisplay, BestVisual, glXGetCurrentContext(), true); + if (myGLContext == NULL) + { + std::cerr << "Failed to create an OpenGL context for this window" << std::endl; + return false; + } + + // Update the creation settings from the chosen format + int Depth, Stencil; + glXGetConfig(ourDisplay, BestVisual, GLX_DEPTH_SIZE, &Depth); + glXGetConfig(ourDisplay, BestVisual, GLX_STENCIL_SIZE, &Stencil); + Params.DepthBits = static_cast(Depth); + Params.StencilBits = static_cast(Stencil); + + // Assign the chosen visual, and free the temporary visuals array + ChosenVisual = *BestVisual; + XFree(Visuals); + + // Activate the context + SetActive(true); + + // Enable multisampling if needed + if (Params.AntialiasingLevel > 0) + glEnable(GL_MULTISAMPLE_ARB); + + return true; +} + + +//////////////////////////////////////////////////////////// +/// Do some common initializations after the window has been created +//////////////////////////////////////////////////////////// +void WindowImplX11::Initialize() +{ + // Get the atom defining the close event + myAtomClose = XInternAtom(ourDisplay, "WM_DELETE_WINDOW", false); + XSetWMProtocols(ourDisplay, myWindow, &myAtomClose, 1); + + // Create the input context + if (ourInputMethod) + { + myInputContext = XCreateIC(ourInputMethod, + XNClientWindow, myWindow, + XNFocusWindow, myWindow, + XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + NULL); + + if (!myInputContext) + std::cerr << "Failed to create input context for window -- TextEntered event won't be able to return unicode" << std::endl; + } + + // Show the window + XMapWindow(ourDisplay, myWindow); + XFlush(ourDisplay); + + // Create the hiden cursor + CreateHiddenCursor(); + + // Set our context as the current OpenGL context for rendering + SetActive(); + + // Flush the commands queue + XFlush(ourDisplay); +} + + +//////////////////////////////////////////////////////////// +/// Create a transparent mouse cursor +//////////////////////////////////////////////////////////// +void WindowImplX11::CreateHiddenCursor() +{ + // Create the cursor's pixmap (1x1 pixels) + Pixmap CursorPixmap = XCreatePixmap(ourDisplay, myWindow, 1, 1, 1); + GC GraphicsContext = XCreateGC(ourDisplay, CursorPixmap, 0, NULL); + XDrawPoint(ourDisplay, CursorPixmap, GraphicsContext, 0, 0); + XFreeGC(ourDisplay, GraphicsContext); + + // Create the cursor, using the pixmap as both the shape and the mask of the cursor + XColor Color; + Color.flags = DoRed | DoGreen | DoBlue; + Color.red = Color.blue = Color.green = 0; + myHiddenCursor = XCreatePixmapCursor(ourDisplay, CursorPixmap, CursorPixmap, &Color, &Color, 0, 0); + + // We don't need the pixmap any longer, free it + XFreePixmap(ourDisplay, CursorPixmap); +} + + +//////////////////////////////////////////////////////////// +/// Cleanup graphical resources attached to the window +//////////////////////////////////////////////////////////// +void WindowImplX11::CleanUp() +{ + // Restore the previous video mode (in case we were running in fullscreen) + if (ourFullscreenWindow == this) + { + // Get current screen info + XRRScreenConfiguration* Config = XRRGetScreenInfo(ourDisplay, RootWindow(ourDisplay, ourScreen)); + if (Config) + { + // Get the current rotation + Rotation CurrentRotation; + XRRConfigCurrentConfiguration(Config, &CurrentRotation); + + // Reset the video mode + XRRSetScreenConfig(ourDisplay, Config, RootWindow(ourDisplay, ourScreen), myOldVideoMode, CurrentRotation, CurrentTime); + + // Free the configuration instance + XRRFreeScreenConfigInfo(Config); + } + + // Reset the fullscreen window + ourFullscreenWindow = NULL; + } + + // Unhide the mouse cursor (in case it was hidden) + ShowMouseCursor(true); + + // Destroy the OpenGL context + if (myGLContext) + { + glXDestroyContext(ourDisplay, myGLContext); + myGLContext = NULL; + } +} + + +//////////////////////////////////////////////////////////// +/// Filter the received events +/// (only allow those matching a specific window) +//////////////////////////////////////////////////////////// +Bool WindowImplX11::CheckEvent(::Display*, XEvent* Event, XPointer UserData) +{ + // Just check if the event matches our window + return Event->xany.window == reinterpret_cast< ::Window >(UserData); +} + + +//////////////////////////////////////////////////////////// +/// Process an incoming event from the window +//////////////////////////////////////////////////////////// +void WindowImplX11::ProcessEvent(XEvent WinEvent) +{ + switch (WinEvent.type) + { + // Destroy event + case DestroyNotify : + { + // The window is about to be destroyed : we must cleanup resources + CleanUp(); + break; + } + + // Gain focus event + case FocusIn : + { + // Update the input context + if (myInputContext) + XSetICFocus(myInputContext); + + Event Evt; + Evt.Type = Event::GainedFocus; + SendEvent(Evt); + break; + } + + // Lost focus event + case FocusOut : + { + // Update the input context + if (myInputContext) + XUnsetICFocus(myInputContext); + + Event Evt; + Evt.Type = Event::LostFocus; + SendEvent(Evt); + break; + } + + // Resize event + case ConfigureNotify : + { + if ((WinEvent.xconfigure.width != static_cast(myWidth)) || (WinEvent.xconfigure.height != static_cast(myHeight))) + { + myWidth = WinEvent.xconfigure.width; + myHeight = WinEvent.xconfigure.height; + + Event Evt; + Evt.Type = Event::Resized; + Evt.Size.Width = myWidth; + Evt.Size.Height = myHeight; + SendEvent(Evt); + } + break; + } + + // Close event + case ClientMessage : + { + if ((WinEvent.xclient.format == 32) && (WinEvent.xclient.data.l[0]) == static_cast(myAtomClose)) + { + Event Evt; + Evt.Type = Event::Closed; + SendEvent(Evt); + } + break; + } + + // Key down event + case KeyPress : + { + // Get the keysym of the key that has been pressed + static XComposeStatus KeyboardStatus; + char Buffer[32]; + KeySym Sym; + XLookupString(&WinEvent.xkey, Buffer, sizeof(Buffer), &Sym, &KeyboardStatus); + + // Fill the event parameters + Event Evt; + Evt.Type = Event::KeyPressed; + Evt.Key.Code = KeysymToSF(Sym); + Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask; + Evt.Key.Control = WinEvent.xkey.state & ControlMask; + Evt.Key.Shift = WinEvent.xkey.state & ShiftMask; + SendEvent(Evt); + + // Generate a TextEntered event + if (!XFilterEvent(&WinEvent, None)) + { + #ifdef X_HAVE_UTF8_STRING + if (myInputContext) + { + Status ReturnedStatus; + Uint8 KeyBuffer[16]; + int Length = Xutf8LookupString(myInputContext, &WinEvent.xkey, reinterpret_cast(KeyBuffer), sizeof(KeyBuffer), NULL, &ReturnedStatus); + if (Length > 0) + { + Uint32 Unicode[2]; // just in case, but 1 character should be enough + const Uint32* End = Unicode::UTF8ToUTF32(KeyBuffer, KeyBuffer + Length, Unicode); + + if (End > Unicode) + { + Event TextEvt; + TextEvt.Type = Event::TextEntered; + TextEvt.Text.Unicode = Unicode[0]; + SendEvent(TextEvt); + } + } + } + else + #endif + { + static XComposeStatus ComposeStatus; + char KeyBuffer[16]; + if (XLookupString(&WinEvent.xkey, KeyBuffer, sizeof(KeyBuffer), NULL, &ComposeStatus)) + { + Event TextEvt; + TextEvt.Type = Event::TextEntered; + TextEvt.Text.Unicode = static_cast(KeyBuffer[0]); + SendEvent(TextEvt); + } + } + } + + break; + } + + // Key up event + case KeyRelease : + { + // Get the keysym of the key that has been pressed + char Buffer[32]; + KeySym Sym; + XLookupString(&WinEvent.xkey, Buffer, 32, &Sym, NULL); + + // Fill the event parameters + Event Evt; + Evt.Type = Event::KeyReleased; + Evt.Key.Code = KeysymToSF(Sym); + Evt.Key.Alt = WinEvent.xkey.state & Mod1Mask; + Evt.Key.Control = WinEvent.xkey.state & ControlMask; + Evt.Key.Shift = WinEvent.xkey.state & ShiftMask; + + SendEvent(Evt); + break; + } + + // Mouse button pressed + case ButtonPress : + { + unsigned int Button = WinEvent.xbutton.button; + if ((Button == Button1) || (Button == Button2) || (Button == Button3) || (Button == 8) || (Button == 9)) + { + Event Evt; + Evt.Type = Event::MouseButtonPressed; + Evt.MouseButton.X = WinEvent.xbutton.x; + Evt.MouseButton.Y = WinEvent.xbutton.y; + switch (Button) + { + case Button1 : Evt.MouseButton.Button = Mouse::Left; break; + case Button2 : Evt.MouseButton.Button = Mouse::Middle; break; + case Button3 : Evt.MouseButton.Button = Mouse::Right; break; + case 8 : Evt.MouseButton.Button = Mouse::XButton1; break; + case 9 : Evt.MouseButton.Button = Mouse::XButton2; break; + } + SendEvent(Evt); + } + break; + } + + // Mouse button released + case ButtonRelease : + { + unsigned int Button = WinEvent.xbutton.button; + if ((Button == Button1) || (Button == Button2) || (Button == Button3) || (Button == 8) || (Button == 9)) + { + Event Evt; + Evt.Type = Event::MouseButtonReleased; + Evt.MouseButton.X = WinEvent.xbutton.x; + Evt.MouseButton.Y = WinEvent.xbutton.y; + switch (Button) + { + case Button1 : Evt.MouseButton.Button = Mouse::Left; break; + case Button2 : Evt.MouseButton.Button = Mouse::Middle; break; + case Button3 : Evt.MouseButton.Button = Mouse::Right; break; + case 8 : Evt.MouseButton.Button = Mouse::XButton1; break; + case 9 : Evt.MouseButton.Button = Mouse::XButton2; break; + } + SendEvent(Evt); + } + else if ((Button == Button4) || (Button == Button5)) + { + Event Evt; + Evt.Type = Event::MouseWheelMoved; + Evt.MouseWheel.Delta = WinEvent.xbutton.button == Button4 ? 1 : -1; + SendEvent(Evt); + } + break; + } + + // Mouse moved + case MotionNotify : + { + Event Evt; + Evt.Type = Event::MouseMoved; + Evt.MouseMove.X = WinEvent.xmotion.x; + Evt.MouseMove.Y = WinEvent.xmotion.y; + SendEvent(Evt); + break; + } + + // Mouse entered + case EnterNotify : + { + Event Evt; + Evt.Type = Event::MouseEntered; + SendEvent(Evt); + break; + } + + // Mouse left + case LeaveNotify : + { + Event Evt; + Evt.Type = Event::MouseLeft; + SendEvent(Evt); + break; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Convert a X11 keysym to SFML key code +//////////////////////////////////////////////////////////// +Key::Code WindowImplX11::KeysymToSF(KeySym Sym) +{ + // First convert to uppercase (to avoid dealing with two different keysyms for the same key) + KeySym Lower, Key; + XConvertCase(Sym, &Lower, &Key); + + switch (Key) + { + case XK_Shift_L : return Key::LShift; + case XK_Shift_R : return Key::RShift; + case XK_Control_L : return Key::LControl; + case XK_Control_R : return Key::RControl; + case XK_Alt_L : return Key::LAlt; + case XK_Alt_R : return Key::RAlt; + case XK_Super_L : return Key::LSystem; + case XK_Super_R : return Key::RSystem; + case XK_Menu : return Key::Menu; + case XK_Escape : return Key::Escape; + case XK_semicolon : return Key::SemiColon; + case XK_slash : return Key::Slash; + case XK_equal : return Key::Equal; + case XK_minus : return Key::Dash; + case XK_bracketleft : return Key::LBracket; + case XK_bracketright : return Key::RBracket; + case XK_comma : return Key::Comma; + case XK_period : return Key::Period; + case XK_dead_acute : return Key::Quote; + case XK_backslash : return Key::BackSlash; + case XK_dead_grave : return Key::Tilde; + case XK_space : return Key::Space; + case XK_Return : return Key::Return; + case XK_KP_Enter : return Key::Return; + case XK_BackSpace : return Key::Back; + case XK_Tab : return Key::Tab; + case XK_Prior : return Key::PageUp; + case XK_Next : return Key::PageDown; + case XK_End : return Key::End; + case XK_Home : return Key::Home; + case XK_Insert : return Key::Insert; + case XK_Delete : return Key::Delete; + case XK_KP_Add : return Key::Add; + case XK_KP_Subtract : return Key::Subtract; + case XK_KP_Multiply : return Key::Multiply; + case XK_KP_Divide : return Key::Divide; + case XK_Pause : return Key::Pause; + case XK_F1 : return Key::F1; + case XK_F2 : return Key::F2; + case XK_F3 : return Key::F3; + case XK_F4 : return Key::F4; + case XK_F5 : return Key::F5; + case XK_F6 : return Key::F6; + case XK_F7 : return Key::F7; + case XK_F8 : return Key::F8; + case XK_F9 : return Key::F9; + case XK_F10 : return Key::F10; + case XK_F11 : return Key::F11; + case XK_F12 : return Key::F12; + case XK_F13 : return Key::F13; + case XK_F14 : return Key::F14; + case XK_F15 : return Key::F15; + case XK_Left : return Key::Left; + case XK_Right : return Key::Right; + case XK_Up : return Key::Up; + case XK_Down : return Key::Down; + case XK_KP_0 : return Key::Numpad0; + case XK_KP_1 : return Key::Numpad1; + case XK_KP_2 : return Key::Numpad2; + case XK_KP_3 : return Key::Numpad3; + case XK_KP_4 : return Key::Numpad4; + case XK_KP_5 : return Key::Numpad5; + case XK_KP_6 : return Key::Numpad6; + case XK_KP_7 : return Key::Numpad7; + case XK_KP_8 : return Key::Numpad8; + case XK_KP_9 : return Key::Numpad9; + case XK_A : return Key::A; + case XK_Z : return Key::Z; + case XK_E : return Key::E; + case XK_R : return Key::R; + case XK_T : return Key::T; + case XK_Y : return Key::Y; + case XK_U : return Key::U; + case XK_I : return Key::I; + case XK_O : return Key::O; + case XK_P : return Key::P; + case XK_Q : return Key::Q; + case XK_S : return Key::S; + case XK_D : return Key::D; + case XK_F : return Key::F; + case XK_G : return Key::G; + case XK_H : return Key::H; + case XK_J : return Key::J; + case XK_K : return Key::K; + case XK_L : return Key::L; + case XK_M : return Key::M; + case XK_W : return Key::W; + case XK_X : return Key::X; + case XK_C : return Key::C; + case XK_V : return Key::V; + case XK_B : return Key::B; + case XK_N : return Key::N; + case XK_0 : return Key::Num0; + case XK_1 : return Key::Num1; + case XK_2 : return Key::Num2; + case XK_3 : return Key::Num3; + case XK_4 : return Key::Num4; + case XK_5 : return Key::Num5; + case XK_6 : return Key::Num6; + case XK_7 : return Key::Num7; + case XK_8 : return Key::Num8; + case XK_9 : return Key::Num9; + } + + return Key::Code(0); +} + + +//////////////////////////////////////////////////////////// +/// Open the display (if not already done) +//////////////////////////////////////////////////////////// +bool WindowImplX11::OpenDisplay(bool AddWindow) +{ + // If no display has been opened yet, open it + if (ourDisplay == NULL) + { + ourDisplay = XOpenDisplay(NULL); + if (ourDisplay) + { + ourScreen = DefaultScreen(ourDisplay); + + // Get the input method (XIM) object + ourInputMethod = XOpenIM(ourDisplay, NULL, NULL, NULL); + } + else + { + std::cerr << "Failed to open a connection with the X server" << std::endl; + } + } + + // Increase the number of windows + if (AddWindow) + ourWindowsCount++; + + return ourDisplay != NULL; +} + + +//////////////////////////////////////////////////////////// +/// Close the display +//////////////////////////////////////////////////////////// +void WindowImplX11::CloseDisplay() +{ + // Decrease the number of windows + ourWindowsCount--; + + // If all windows have been destroyed, then we can close the display + if (ourWindowsCount == 0) + { + // Close the input method object + if (ourInputMethod) + XCloseIM(ourInputMethod); + + XCloseDisplay(ourDisplay); + ourDisplay = NULL; + } +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Linux/WindowImplX11.hpp b/src/SFML/Window/Linux/WindowImplX11.hpp new file mode 100644 index 00000000..b4506fce --- /dev/null +++ b/src/SFML/Window/Linux/WindowImplX11.hpp @@ -0,0 +1,277 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWIMPLX11_HPP +#define SFML_WINDOWIMPLX11_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +class VideoModeSupport; + +//////////////////////////////////////////////////////////// +/// WindowImplX11 is the Linux (X11) implementation of WindowImpl +//////////////////////////////////////////////////////////// +class WindowImplX11 : public WindowImpl +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// (creates a dummy window to provide a valid OpenGL context) + /// + //////////////////////////////////////////////////////////// + WindowImplX11(); + + //////////////////////////////////////////////////////////// + /// Construct the window implementation from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation settings + /// + //////////////////////////////////////////////////////////// + WindowImplX11(WindowHandle Handle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Create the window implementation + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style (resizable, fixed, or fullscren) + /// \param Params : Creation settings + /// + //////////////////////////////////////////////////////////// + WindowImplX11(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~WindowImplX11(); + + //////////////////////////////////////////////////////////// + /// Check if there's an active context on the current thread + /// + /// \return True if there's a context bound to the current thread + /// + //////////////////////////////////////////////////////////// + static bool IsContextActive(); + +private : + + friend class VideoModeSupport; + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::Display + /// + //////////////////////////////////////////////////////////// + virtual void Display(); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::ProcessEvents + /// + //////////////////////////////////////////////////////////// + virtual void ProcessEvents(); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetActive + /// + //////////////////////////////////////////////////////////// + virtual void SetActive(bool Active = true) const; + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::UseVerticalSync + /// + //////////////////////////////////////////////////////////// + virtual void UseVerticalSync(bool Enabled); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::ShowMouseCursor + /// + //////////////////////////////////////////////////////////// + virtual void ShowMouseCursor(bool Show); + + //////////////////////////////////////////////////////////// + /// /see sfWindowImpl::SetCursorPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetCursorPosition(unsigned int Left, unsigned int Top); + + //////////////////////////////////////////////////////////// + /// /see sfWindowImpl::SetPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetPosition(int Left, int Top); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetSize + /// + //////////////////////////////////////////////////////////// + virtual void SetSize(unsigned int Width, unsigned int Height); + + //////////////////////////////////////////////////////////// + /// /see sfWindowImpl::Show + /// + //////////////////////////////////////////////////////////// + virtual void Show(bool State); + + //////////////////////////////////////////////////////////// + /// /see sfWindowImpl::EnableKeyRepeat + /// + //////////////////////////////////////////////////////////// + virtual void EnableKeyRepeat(bool Enabled); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetIcon + /// + //////////////////////////////////////////////////////////// + virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + + //////////////////////////////////////////////////////////// + /// Switch to fullscreen mode + /// + /// \param Mode : video mode to switch to + /// + //////////////////////////////////////////////////////////// + void SwitchToFullscreen(const VideoMode& Mode); + + //////////////////////////////////////////////////////////// + /// Create the OpenGL rendering context + /// + /// \param Mode : Video mode to use + /// \param ChosenVisual : Visual that has been chosen for creating the contexte + /// \param Params : Creation parameters + /// \param Template : Visual infos to match + /// \param Mask : Visual attributes to check in Template + /// + /// \return True on success, false on error + /// + //////////////////////////////////////////////////////////// + bool CreateContext(const VideoMode& Mode, XVisualInfo& ChosenVisual, WindowSettings& Params, XVisualInfo Template = XVisualInfo(), unsigned long Mask = 0); + + //////////////////////////////////////////////////////////// + /// Do some common initializations after the window has been created + /// + //////////////////////////////////////////////////////////// + void Initialize(); + + //////////////////////////////////////////////////////////// + /// Create a transparent mouse cursor + /// + //////////////////////////////////////////////////////////// + void CreateHiddenCursor(); + + //////////////////////////////////////////////////////////// + /// Cleanup graphical resources attached to the window + /// + //////////////////////////////////////////////////////////// + void CleanUp(); + + //////////////////////////////////////////////////////////// + /// Filter the received events + /// (only allow those matching a specific window) + /// + /// \param Event : Event to filter + /// \param UserData : Data passed to the function (here : the window to compare) + /// + /// \return True if the event belongs to the specified window + /// + //////////////////////////////////////////////////////////// + static Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData); + + //////////////////////////////////////////////////////////// + /// Process an incoming event from the window + /// + /// \param WinEvent : Event which has been received + /// + //////////////////////////////////////////////////////////// + void ProcessEvent(XEvent WinEvent); + + //////////////////////////////////////////////////////////// + /// Convert a X11 keysym to SFML key code + /// + /// \param Sym : keysym to convert + /// + /// \return Corrsponding SFML key code + /// + //////////////////////////////////////////////////////////// + static Key::Code KeysymToSF(KeySym Sym); + + //////////////////////////////////////////////////////////// + /// Open the display (if not already done) + /// + /// \param AddWindow : Tell whether or not we must increase the windows count + /// + /// \return True if the display is properly opened + /// + //////////////////////////////////////////////////////////// + static bool OpenDisplay(bool AddWindow = true); + + //////////////////////////////////////////////////////////// + /// Close the display + /// + //////////////////////////////////////////////////////////// + static void CloseDisplay(); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static ::Display* ourDisplay; ///< Current opened display + static int ourScreen; ///< Default screen on the opened display + static WindowImplX11* ourFullscreenWindow; ///< Keep track of the active fullscreen window + static unsigned int ourWindowsCount; ///< Number of windows created + static unsigned long ourEventMask; ///< Mask defining the events that will be caught by our windows + static XIM ourInputMethod; ///< Input object used to get unicode characters from keypress messages + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + ::Window myWindow; ///< X11 structure defining our window + bool myIsExternal; ///< Tell whether the window has been created externally or by SFML + GLXContext myGLContext; ///< OpenGL context attached to the window + Atom myAtomClose; ///< Atom used to identify the close event + int myOldVideoMode; ///< Video mode in use before we switch to fullscreen + Cursor myHiddenCursor; ///< As X11 doesn't provide cursor hidding, we must create a transparent one + XIC myInputContext; ///< Input context used to get unicode input in our window + bool myKeyRepeat; ///< Is the KeyRepeat feature enabled ? +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_WINDOWIMPLX11_HPP diff --git a/src/SFML/Window/Makefile b/src/SFML/Window/Makefile new file mode 100644 index 00000000..956b34ba --- /dev/null +++ b/src/SFML/Window/Makefile @@ -0,0 +1,35 @@ +SRC = $(wildcard *.cpp ./Linux/*.cpp) +OBJ = $(SRC:.cpp=.o) +OBJGLEW = $(SRCGLEW:.c=.o) + +ifeq ($(STATIC), yes) + LIB = libsfml-window-s.a + LIBNAME = $(LIBPATH)/$(LIB) + INSTALL = +else + LIB = libsfml-window.so + LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) + INSTALL = && $(LN) $(LNFLAGS) $(DESTLIBDIR)/$(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) +endif + +all: $(LIB) + +libsfml-window-s.a: $(OBJ) + $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) + +libsfml-window.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) $(OBJGLEW) -lX11 -lXrandr -lGL + +$(OBJ): %.o: %.cpp + $(CPP) -o $@ -c $< $(CFLAGS) + +.PHONY: clean mrproper + +clean: + @rm -rf $(OBJ) + +mrproper: clean + @rm -rf $(LIBNAME) + +install: + @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) diff --git a/src/SFML/Window/Template for new ports/Joystick.cpp b/src/SFML/Window/Template for new ports/Joystick.cpp new file mode 100644 index 00000000..77f06a3a --- /dev/null +++ b/src/SFML/Window/Template for new ports/Joystick.cpp @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Initialize the instance and bind it to a physical joystick +//////////////////////////////////////////////////////////// +void Joystick::Initialize(unsigned int Index) +{ + // Reset the joystick state + + // Initialize the Index-th available joystick +} + + +//////////////////////////////////////////////////////////// +/// Update the current joystick and return its new state +//////////////////////////////////////////////////////////// +JoystickState Joystick::UpdateState() +{ + // Fill a JoystickState instance with the current joystick state +} + + +//////////////////////////////////////////////////////////// +/// Get the number of axes supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetAxesCount() const +{ + // Return number of supported axes +} + + +//////////////////////////////////////////////////////////// +/// Get the number of buttons supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetButtonsCount() const +{ + // Return number of supported buttons +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Template for new ports/Joystick.hpp b/src/SFML/Window/Template for new ports/Joystick.hpp new file mode 100644 index 00000000..037f65c1 --- /dev/null +++ b/src/SFML/Window/Template for new ports/Joystick.hpp @@ -0,0 +1,82 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICKXXX_HPP +#define SFML_JOYSTICKXXX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Linux implementation of Joystick +//////////////////////////////////////////////////////////// +class Joystick +{ +public : + + //////////////////////////////////////////////////////////// + /// Initialize the instance and bind it to a physical joystick + /// + /// \param Index : Index of the physical joystick to bind to + /// + //////////////////////////////////////////////////////////// + void Initialize(unsigned int Index); + + //////////////////////////////////////////////////////////// + /// Update the current joystick and return its new state + /// + /// \return Current state of the joystick + /// + //////////////////////////////////////////////////////////// + JoystickState UpdateState(); + + //////////////////////////////////////////////////////////// + /// Get the number of axes supported by the joystick + /// + /// \return Number of axis + /// + //////////////////////////////////////////////////////////// + unsigned int GetAxesCount() const; + + //////////////////////////////////////////////////////////// + /// Get the number of buttons supported by the joystick + /// + /// \return Number of buttons + /// + //////////////////////////////////////////////////////////// + unsigned int GetButtonsCount() const; +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_JOYSTICKXXX_HPP diff --git a/src/SFML/Window/Template for new ports/VideoModeSupport.cpp b/src/SFML/Window/Template for new ports/VideoModeSupport.cpp new file mode 100644 index 00000000..8259256d --- /dev/null +++ b/src/SFML/Window/Template for new ports/VideoModeSupport.cpp @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get supported video modes +//////////////////////////////////////////////////////////// +void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) +{ + // Get all the supported fullscreen modes and put them in Modes array + + // Just care about width, height and bpp (ignore frequency and other attributes) + + // You must remove duplicates + + // Order doesn't matter (the array will be sorted later) +} + + +//////////////////////////////////////////////////////////// +/// Get current desktop video mode +//////////////////////////////////////////////////////////// +VideoMode VideoModeSupport::GetDesktopVideoMode() +{ + // Return the current desktop video mode +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Template for new ports/VideoModeSupport.hpp b/src/SFML/Window/Template for new ports/VideoModeSupport.hpp new file mode 100644 index 00000000..e515cc7a --- /dev/null +++ b/src/SFML/Window/Template for new ports/VideoModeSupport.hpp @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODESUPPORTXXX_HPP +#define SFML_VIDEOMODESUPPORTXXX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// XXX implementation of VideoModeSupport +/// Give access to video mode related OS-specific functions +//////////////////////////////////////////////////////////// +class VideoModeSupport +{ +public : + + //////////////////////////////////////////////////////////// + /// Get supported video modes + /// + /// \param Modes : Array to fill with available video modes + /// + //////////////////////////////////////////////////////////// + static void GetSupportedVideoModes(std::vector& Modes); + + //////////////////////////////////////////////////////////// + /// Get current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode GetDesktopVideoMode(); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_VIDEOMODESUPPORTXXX_HPP diff --git a/src/SFML/Window/Template for new ports/WindowImplXXX.cpp b/src/SFML/Window/Template for new ports/WindowImplXXX.cpp new file mode 100644 index 00000000..44383ec0 --- /dev/null +++ b/src/SFML/Window/Template for new ports/WindowImplXXX.cpp @@ -0,0 +1,231 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Default constructor +/// (creates a dummy window to provide a valid OpenGL context) +//////////////////////////////////////////////////////////// +WindowImplXXX::WindowImplXXX() +{ + // Create a dummy window (with the fewest attributes -- it's just to have a valid support for an OpenGL context) + + // Initialize myWidth and myHeight members from base class with the window size + + // Create an OpenGL context in this window and DO NOT make it active +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation from an existing control +//////////////////////////////////////////////////////////// +WindowImplXXX::WindowImplXXX(WindowHandle Handle, WindowSettings& Params) +{ + // Make sure we'll be able to catch all the events of the given window + + // Initialize myWidth and myHeight members from base class with the window size + + // Create an OpenGL context in this window and make it active +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation +//////////////////////////////////////////////////////////// +WindowImplXXX::WindowImplXXX(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) : +{ + // Create a new window with given size, title and style + + // Initialize myWidth and myHeight members from base class with the window size + + // Create an OpenGL context in this window and make it active +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +WindowImplXXX::~WindowImplXXX() +{ + // Destroy the OpenGL context, the window and every resource allocated by this class +} + + +//////////////////////////////////////////////////////////// +/// Check if there's an active context on the current thread +//////////////////////////////////////////////////////////// +bool WindowImplXXX::IsContextActive() +{ + // Should return whether xxxGetCurrentContext() is NULL or not; +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::Display +//////////////////////////////////////////////////////////// +void WindowImplXXX::Display() +{ + // Swap OpenGL buffers (should be a call to xxxSwapBuffers) +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::ProcessEvents +//////////////////////////////////////////////////////////// +void WindowImplXXX::ProcessEvents() +{ + // Process every event for this window + + // Generate a sf::Event and call SendEvent(Evt) for each event +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetActive +//////////////////////////////////////////////////////////// +void WindowImplXXX::SetActive(bool Active) const +{ + // Bind / unbind OpenGL context (should be a call to xxxMakeCurrent) +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::UseVerticalSync +//////////////////////////////////////////////////////////// +void WindowImplXXX::UseVerticalSync(bool Enabled) +{ + // Activate / deactivate vertical synchronization + // usually using an OpenGL extension (should be a call to xxxSwapInterval) +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::ShowMouseCursor +//////////////////////////////////////////////////////////// +void WindowImplXXX::ShowMouseCursor(bool Show) +{ + // Show or hide the system cursor in this window +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetCursorPosition +//////////////////////////////////////////////////////////// +void WindowImplXXX::SetCursorPosition(unsigned int Left, unsigned int Top) +{ + // Change the cursor position (Left and Top are relative to this window) +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetPosition +//////////////////////////////////////////////////////////// +void WindowImplXXX::SetPosition(int Left, int Top) +{ + // Change the window position +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetSize +//////////////////////////////////////////////////////////// +void WindowImplWin32::SetSize(unsigned int Width, unsigned int Height) +{ + // Change the window size +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::Show +//////////////////////////////////////////////////////////// +void WindowImplXXX::Show(bool State) +{ + // Show or hide the window +} + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::EnableKeyRepeat +//////////////////////////////////////////////////////////// +void WindowImplXXX::EnableKeyRepeat(bool Enabled) +{ + // Enable or disable automatic key-repeat for keydown events +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetIcon +//////////////////////////////////////////////////////////// +void WindowImplXXX::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +{ + // Change all the necessary icons of the window (titlebar, task bar, ...) with the + // provided array of 32 bits RGBA pixels +} + + +/*=========================================================== + STRATEGY FOR OPENGL CONTEXT CREATION + +- If the requested level of anti-aliasing is not supported and is greater than 2, try with 2 + --> if level 2 fails, disable anti-aliasing + --> it's important not to generate an error if anti-aliasing is not supported + +- Use a matching pixel mode, or the best of all available pixel modes if no perfect match ; + You should use the function EvaluateConfig to get a score for a given configuration + +- Don't forget to fill Params (see constructors) back with the actual parameters we got from the chosen pixel format + +- IMPORTANT : all OpenGL contexts must be shared (usually a call to xxxShareLists) + +===========================================================*/ + + +/*=========================================================== + STRATEGY FOR EVENT HANDLING + +- Process any event matching with the ones in sf::Event::EventType + --> Create a sf::Event, fill the members corresponding to the event type + --> No need to handle joystick events, they are handled by WindowImpl::ProcessJoystickEvents + --> Event::TextEntered must provide UTF-16 characters + (see http://www.unicode.org/Public/PROGRAMS/CVTUTF/ for unicode conversions) + --> Don't forget to process any destroy-like event (ie. when the window is destroyed externally) + +- Use SendEvent function from base class to propagate the created events + +===========================================================*/ + + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Template for new ports/WindowImplXXX.hpp b/src/SFML/Window/Template for new ports/WindowImplXXX.hpp new file mode 100644 index 00000000..d3961612 --- /dev/null +++ b/src/SFML/Window/Template for new ports/WindowImplXXX.hpp @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWIMPLXXX_HPP +#define SFML_WINDOWIMPLXXX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// WindowImplXXX is the XXX implementation of WindowImpl +//////////////////////////////////////////////////////////// +class WindowImplXXX : public WindowImpl +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// (creates a dummy window to provide a valid OpenGL context) + /// + //////////////////////////////////////////////////////////// + WindowImplXXX(); + + //////////////////////////////////////////////////////////// + /// Construct the window implementation from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation parameters + /// + //////////////////////////////////////////////////////////// + WindowImplXXX(WindowHandle Handle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Create the window implementation + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style + /// \param Params : Creation parameters + /// + //////////////////////////////////////////////////////////// + WindowImplXXX(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~WindowImplXXX(); + + //////////////////////////////////////////////////////////// + /// Check if there's an active context on the current thread + /// + /// \return True if there's a context bound to the current thread + /// + //////////////////////////////////////////////////////////// + static bool IsContextActive(); + +private : + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::Display + /// + //////////////////////////////////////////////////////////// + virtual void Display(); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::ProcessEvents + /// + //////////////////////////////////////////////////////////// + virtual void ProcessEvents(); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetActive + /// + //////////////////////////////////////////////////////////// + virtual void SetActive(bool Active = true) const; + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::IsActive + /// + //////////////////////////////////////////////////////////// + virtual bool IsActive() const; + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::UseVerticalSync + /// + //////////////////////////////////////////////////////////// + virtual void UseVerticalSync(bool Enabled); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::ShowMouseCursor + /// + //////////////////////////////////////////////////////////// + virtual void ShowMouseCursor(bool Show); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetCursorPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetCursorPosition(unsigned int Left, unsigned int Top); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetPosition(int Left, int Top); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetSize + /// + //////////////////////////////////////////////////////////// + virtual void SetSize(unsigned int Width, unsigned int Height); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::Show + /// + //////////////////////////////////////////////////////////// + virtual void Show(bool State); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::EnableKeyRepeat + /// + //////////////////////////////////////////////////////////// + virtual void EnableKeyRepeat(bool Enabled); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetIcon + /// + //////////////////////////////////////////////////////////// + virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); +}; + +} // namespace priv + +} // namespace sf + +#endif // SFML_WINDOWIMPLXXX_HPP diff --git a/src/SFML/Window/VideoMode.cpp b/src/SFML/Window/VideoMode.cpp new file mode 100644 index 00000000..8efff0f8 --- /dev/null +++ b/src/SFML/Window/VideoMode.cpp @@ -0,0 +1,170 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Internal data +//////////////////////////////////////////////////////////// +namespace +{ + // Global array of supported video modes + std::vector SupportedModes; + + // Functor for sorting modes from highest to lowest + struct CompareModes + { + bool operator ()(const sf::VideoMode& v1, const sf::VideoMode& v2) const + { + if (v1.BitsPerPixel > v2.BitsPerPixel) + return true; + else if (v1.BitsPerPixel < v2.BitsPerPixel) + return false; + else if (v1.Width > v2.Width) + return true; + else if (v1.Width < v2.Width) + return false; + else + return (v1.Height > v2.Height); + } + }; +} + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +VideoMode::VideoMode() : +Width (0), +Height (0), +BitsPerPixel(0) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct the video mode with its attributes +//////////////////////////////////////////////////////////// +VideoMode::VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp) : +Width (ModeWidth), +Height (ModeHeight), +BitsPerPixel(ModeBpp) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Get the current desktop video mode +//////////////////////////////////////////////////////////// +VideoMode VideoMode::GetDesktopMode() +{ + // Directly forward to the video mode support + return priv::VideoModeSupport::GetDesktopVideoMode(); +} + + +//////////////////////////////////////////////////////////// +/// Get a valid video mode +/// Index must be in range [0, GetModesCount()[ +//////////////////////////////////////////////////////////// +VideoMode VideoMode::GetMode(std::size_t Index) +{ + if (SupportedModes.empty()) + InitializeModes(); + + if (Index < GetModesCount()) + return SupportedModes[Index]; + else + return VideoMode(); +} + + +//////////////////////////////////////////////////////////// +/// Get valid video modes count +//////////////////////////////////////////////////////////// +std::size_t VideoMode::GetModesCount() +{ + if (SupportedModes.empty()) + InitializeModes(); + + return SupportedModes.size(); +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the video mode is supported +//////////////////////////////////////////////////////////// +bool VideoMode::IsValid() const +{ + if (SupportedModes.empty()) + InitializeModes(); + + return std::find(SupportedModes.begin(), SupportedModes.end(), *this) != SupportedModes.end(); +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator overload -- tell if two video modes are equal +//////////////////////////////////////////////////////////// +bool VideoMode::operator ==(const VideoMode& Other) const +{ + return (Width == Other.Width) && + (Height == Other.Height) && + (BitsPerPixel == Other.BitsPerPixel); +} + + +//////////////////////////////////////////////////////////// +/// Comparison operator overload -- tell if two video modes are different +//////////////////////////////////////////////////////////// +bool VideoMode::operator !=(const VideoMode& Other) const +{ + return !(*this == Other); +} + + +//////////////////////////////////////////////////////////// +/// Get and sort valid video modes +//////////////////////////////////////////////////////////// +void VideoMode::InitializeModes() +{ + // We request the array of valid modes + priv::VideoModeSupport::GetSupportedVideoModes(SupportedModes); + + // And we sort them from highest to lowest (so that number 0 is the best) + std::sort(SupportedModes.begin(), SupportedModes.end(), CompareModes()); +} + +} // namespace sf diff --git a/src/SFML/Window/VideoModeSupport.hpp b/src/SFML/Window/VideoModeSupport.hpp new file mode 100644 index 00000000..adaac2c1 --- /dev/null +++ b/src/SFML/Window/VideoModeSupport.hpp @@ -0,0 +1,49 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODESUPPORT_HPP +#define SFML_VIDEOMODESUPPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +#if defined(SFML_SYSTEM_WINDOWS) + + #include + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + #include + +#elif defined(SFML_SYSTEM_MACOS) + + #include + +#endif + + +#endif // SFML_VIDEOMODESUPPORT_HPP diff --git a/src/SFML/Window/Win32/Joystick.cpp b/src/SFML/Window/Win32/Joystick.cpp new file mode 100644 index 00000000..9cf195fc --- /dev/null +++ b/src/SFML/Window/Win32/Joystick.cpp @@ -0,0 +1,136 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#define _WIN32_WINDOWS 0x0501 +#define _WIN32_WINNT 0x0501 +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Initialize the instance and bind it to a physical joystick +//////////////////////////////////////////////////////////// +void Joystick::Initialize(unsigned int Index) +{ + // Reset state + myIndex = JOYSTICKID1; + myNbAxes = 0; + myNbButtons = 0; + + // Get the Index-th connected joystick + MMRESULT Error; + JOYINFOEX JoyInfo; + for (unsigned int NbFound = 0; (Error = joyGetPosEx(myIndex, &JoyInfo)) != JOYERR_PARMS; myIndex++) + { + // Check if the current joystick is connected + if (Error == JOYERR_NOERROR) + { + // Check if it's the required index + if (NbFound == Index) + { + // Ok : store its parameters and return + JOYCAPS Caps; + joyGetDevCaps(myIndex, &Caps, sizeof(Caps)); + myNbAxes = Caps.wNumAxes; + myNbButtons = Caps.wNumButtons; + if (myNbButtons > JoystickState::MaxButtons) + myNbButtons = JoystickState::MaxButtons; + + return; + } + + // Go to the next valid joystick + ++NbFound; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Update the current joystick and return its new state +//////////////////////////////////////////////////////////// +JoystickState Joystick::UpdateState() +{ + JoystickState State = {0}; + + // Get the joystick caps (for range conversions) + JOYCAPS Caps; + if (joyGetDevCaps(myIndex, &Caps, sizeof(Caps)) == JOYERR_NOERROR) + { + // Get the current joystick state + JOYINFOEX Pos; + Pos.dwFlags = JOY_RETURNALL; + Pos.dwSize = sizeof(JOYINFOEX); + if (joyGetPosEx(myIndex, &Pos) == JOYERR_NOERROR) + { + // Axes + State.Axis[Joy::AxisX] = (Pos.dwXpos - (Caps.wXmax + Caps.wXmin) / 2.f) * 200.f / (Caps.wXmax - Caps.wXmin); + State.Axis[Joy::AxisY] = (Pos.dwYpos - (Caps.wYmax + Caps.wYmin) / 2.f) * 200.f / (Caps.wYmax - Caps.wYmin); + State.Axis[Joy::AxisZ] = (Pos.dwZpos - (Caps.wZmax + Caps.wZmin) / 2.f) * 200.f / (Caps.wZmax - Caps.wZmin); + State.Axis[Joy::AxisR] = (Pos.dwRpos - (Caps.wRmax + Caps.wRmin) / 2.f) * 200.f / (Caps.wRmax - Caps.wRmin); + State.Axis[Joy::AxisU] = (Pos.dwUpos - (Caps.wUmax + Caps.wUmin) / 2.f) * 200.f / (Caps.wUmax - Caps.wUmin); + State.Axis[Joy::AxisV] = (Pos.dwVpos - (Caps.wVmax + Caps.wVmin) / 2.f) * 200.f / (Caps.wVmax - Caps.wVmin); + + // POV + State.Axis[Joy::AxisPOV] = Pos.dwPOV / 100.f; + + // Buttons + for (unsigned int i = 0; i < GetButtonsCount(); ++i) + State.Buttons[i] = (Pos.dwButtons & (1 << i)) != 0; + } + } + + return State; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of axes supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetAxesCount() const +{ + return myNbAxes; +} + + +//////////////////////////////////////////////////////////// +/// Get the number of buttons supported by the joystick +//////////////////////////////////////////////////////////// +unsigned int Joystick::GetButtonsCount() const +{ + return myNbButtons; +} + + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Win32/Joystick.hpp b/src/SFML/Window/Win32/Joystick.hpp new file mode 100644 index 00000000..95019cb5 --- /dev/null +++ b/src/SFML/Window/Win32/Joystick.hpp @@ -0,0 +1,91 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICKWIN32_HPP +#define SFML_JOYSTICKWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Win32 implementation of Joystick +//////////////////////////////////////////////////////////// +class Joystick +{ +public : + + //////////////////////////////////////////////////////////// + /// Initialize the instance and bind it to a physical joystick + /// + /// \param Index : Index of the physical joystick to bind to + /// + //////////////////////////////////////////////////////////// + void Initialize(unsigned int Index); + + //////////////////////////////////////////////////////////// + /// Update the current joystick and return its new state + /// + /// \return Current state of the joystick + /// + //////////////////////////////////////////////////////////// + JoystickState UpdateState(); + + //////////////////////////////////////////////////////////// + /// Get the number of axes supported by the joystick + /// + /// \return Number of axis + /// + //////////////////////////////////////////////////////////// + unsigned int GetAxesCount() const; + + //////////////////////////////////////////////////////////// + /// Get the number of buttons supported by the joystick + /// + /// \return Number of buttons + /// + //////////////////////////////////////////////////////////// + unsigned int GetButtonsCount() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int myIndex; ///< Windows ID of the joystick + unsigned int myNbAxes; ///< Number of axis supported by the joystick + unsigned int myNbButtons; ///< Number of buttons supported by the joystick +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_JOYSTICKWIN32_HPP diff --git a/src/SFML/Window/Win32/VideoModeSupport.cpp b/src/SFML/Window/Win32/VideoModeSupport.cpp new file mode 100644 index 00000000..cd5f6500 --- /dev/null +++ b/src/SFML/Window/Win32/VideoModeSupport.cpp @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Get supported video modes +//////////////////////////////////////////////////////////// +void VideoModeSupport::GetSupportedVideoModes(std::vector& Modes) +{ + // First, clear array to fill + Modes.clear(); + + // Enumerate all available video modes for primary display adapter + DEVMODE Win32Mode; + Win32Mode.dmSize = sizeof(DEVMODE); + for (int Count = 0; EnumDisplaySettings(NULL, Count, &Win32Mode); ++Count) + { + // Convert to sfVideoMode + VideoMode Mode(Win32Mode.dmPelsWidth, Win32Mode.dmPelsHeight, Win32Mode.dmBitsPerPel); + + // Add it only if it is not already in the array + if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end()) + Modes.push_back(Mode); + } +} + + +//////////////////////////////////////////////////////////// +/// Get current desktop video mode +//////////////////////////////////////////////////////////// +VideoMode VideoModeSupport::GetDesktopVideoMode() +{ + DEVMODE Win32Mode; + Win32Mode.dmSize = sizeof(DEVMODE); + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &Win32Mode); + + return VideoMode(Win32Mode.dmPelsWidth, Win32Mode.dmPelsHeight, Win32Mode.dmBitsPerPel); +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Win32/VideoModeSupport.hpp b/src/SFML/Window/Win32/VideoModeSupport.hpp new file mode 100644 index 00000000..f00d4749 --- /dev/null +++ b/src/SFML/Window/Win32/VideoModeSupport.hpp @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODESUPPORTWIN32_HPP +#define SFML_VIDEOMODESUPPORTWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Win32 implementation of VideoModeSupport +/// Give access to video mode related OS-specific functions +//////////////////////////////////////////////////////////// +class VideoModeSupport +{ +public : + + //////////////////////////////////////////////////////////// + /// Get supported video modes + /// + /// \param Modes : Array to fill with available video modes + /// + //////////////////////////////////////////////////////////// + static void GetSupportedVideoModes(std::vector& Modes); + + //////////////////////////////////////////////////////////// + /// Get current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode GetDesktopVideoMode(); +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_VIDEOMODESUPPORTWIN32_HPP diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp new file mode 100644 index 00000000..736d5e6a --- /dev/null +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -0,0 +1,1151 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#define _WIN32_WINDOWS 0x0501 +#define _WIN32_WINNT 0x0501 +#include +#include +#include +#include +#include +#include +#include +#include + +// Old versions of MinGW lack the definition of XBUTTON1 and XBUTTON2 +#ifndef XBUTTON1 + #define XBUTTON1 0x0001 +#endif +#ifndef XBUTTON2 + #define XBUTTON2 0x0002 +#endif + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +// Static member data +//////////////////////////////////////////////////////////// +unsigned int WindowImplWin32::ourWindowCount = 0; +const char* WindowImplWin32::ourClassNameA = "SFML_Window"; +const wchar_t* WindowImplWin32::ourClassNameW = L"SFML_Window"; +WindowImplWin32* WindowImplWin32::ourFullscreenWindow = NULL; + + +//////////////////////////////////////////////////////////// +/// Default constructor +/// (creates a dummy window to provide a valid OpenGL context) +//////////////////////////////////////////////////////////// +WindowImplWin32::WindowImplWin32() : +myHandle (NULL), +myCallback (0), +myCursor (NULL), +myIcon (NULL), +myKeyRepeatEnabled(true), +myIsCursorIn (false) +{ + // Register the window class at first call + if (ourWindowCount == 0) + RegisterWindowClass(); + + // Use small dimensions + myWidth = 1; + myHeight = 1; + + // Create a dummy window (disabled and hidden) + if (HasUnicodeSupport()) + { + myHandle = CreateWindowW(ourClassNameW, L"", WS_POPUP | WS_DISABLED, 0, 0, myWidth, myHeight, NULL, NULL, GetModuleHandle(NULL), NULL); + } + else + { + myHandle = CreateWindowA(ourClassNameA, "", WS_POPUP | WS_DISABLED, 0, 0, myWidth, myHeight, NULL, NULL, GetModuleHandle(NULL), NULL); + } + ShowWindow(myHandle, SW_HIDE); + + // Create the rendering context + if (myHandle) + { + WindowSettings Params(0, 0, 0); + CreateContext(VideoMode(myWidth, myHeight, 32), Params); + + // Don't activate by default + SetActive(false); + } +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation from an existing control +//////////////////////////////////////////////////////////// +WindowImplWin32::WindowImplWin32(WindowHandle Handle, WindowSettings& Params) : +myHandle (NULL), +myCallback (0), +myCursor (NULL), +myIcon (NULL), +myKeyRepeatEnabled(true), +myIsCursorIn (false) +{ + // Save window handle + myHandle = static_cast(Handle); + + if (myHandle) + { + // Get window client size + RECT Rect; + GetClientRect(myHandle, &Rect); + myWidth = Rect.right - Rect.left; + myHeight = Rect.bottom - Rect.top; + + // Create the rendering context + VideoMode Mode(myWidth, myHeight, VideoMode::GetDesktopMode().BitsPerPixel); + CreateContext(Mode, Params); + + // We change the event procedure of the control (it is important to save the old one) + SetWindowLongPtr(myHandle, GWLP_USERDATA, reinterpret_cast(this)); + myCallback = SetWindowLongPtr(myHandle, GWLP_WNDPROC, reinterpret_cast(&WindowImplWin32::GlobalOnEvent)); + } +} + + +//////////////////////////////////////////////////////////// +/// Create the window implementation +//////////////////////////////////////////////////////////// +WindowImplWin32::WindowImplWin32(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) : +myHandle (NULL), +myCallback (0), +myCursor (NULL), +myIcon (NULL), +myKeyRepeatEnabled(true), +myIsCursorIn (false) +{ + // Register the window class at first call + if (ourWindowCount == 0) + RegisterWindowClass(); + + // Compute position and size + int Left = (GetDeviceCaps(GetDC(NULL), HORZRES) - Mode.Width) / 2; + int Top = (GetDeviceCaps(GetDC(NULL), VERTRES) - Mode.Height) / 2; + int Width = myWidth = Mode.Width; + int Height = myHeight = Mode.Height; + + // Choose the window style according to the Style parameter + DWORD Win32Style = WS_VISIBLE; + if (WindowStyle == Style::None) + { + Win32Style |= WS_POPUP; + } + else + { + if (WindowStyle & Style::Titlebar) Win32Style |= WS_CAPTION | WS_MINIMIZEBOX; + if (WindowStyle & Style::Resize) Win32Style |= WS_THICKFRAME | WS_MAXIMIZEBOX; + if (WindowStyle & Style::Close) Win32Style |= WS_SYSMENU; + } + + // In windowed mode, adjust width and height so that window will have the requested client area + bool Fullscreen = (WindowStyle & Style::Fullscreen) != 0; + if (!Fullscreen) + { + RECT Rect = {0, 0, Width, Height}; + AdjustWindowRect(&Rect, Win32Style, false); + Width = Rect.right - Rect.left; + Height = Rect.bottom - Rect.top; + } + + // Create the window + if (HasUnicodeSupport()) + { + wchar_t WTitle[256]; + int NbChars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, Title.c_str(), static_cast(Title.size()), WTitle, sizeof(WTitle) / sizeof(*WTitle)); + WTitle[NbChars] = L'\0'; + myHandle = CreateWindowW(ourClassNameW, WTitle, Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this); + } + else + { + myHandle = CreateWindowA(ourClassNameA, Title.c_str(), Win32Style, Left, Top, Width, Height, NULL, NULL, GetModuleHandle(NULL), this); + } + + // Switch to fullscreen if requested + if (Fullscreen) + SwitchToFullscreen(Mode); + + // Create the rendering context + if (myHandle) + CreateContext(Mode, Params); + + // Increment window count + ourWindowCount++; + + // Get the actual size of the window, which can be smaller even after the call to AdjustWindowRect + // This happens when the window is bigger than the desktop + RECT ActualRect; + GetClientRect(myHandle, &ActualRect); + myWidth = ActualRect.right - ActualRect.left; + myHeight = ActualRect.bottom - ActualRect.top; +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +WindowImplWin32::~WindowImplWin32() +{ + // Destroy the custom icon, if any + if (myIcon) + DestroyIcon(myIcon); + + if (!myCallback) + { + // Destroy the window + if (myHandle) + DestroyWindow(myHandle); + + // Decrement the window count + ourWindowCount--; + + // Unregister window class if we were the last window + if (ourWindowCount == 0) + { + if (HasUnicodeSupport()) + { + UnregisterClassW(ourClassNameW, GetModuleHandle(NULL)); + } + else + { + UnregisterClassA(ourClassNameA, GetModuleHandle(NULL)); + } + } + } + else + { + // The window is external : remove the hook on its message callback + SetWindowLongPtr(myHandle, GWLP_WNDPROC, myCallback); + } +} + + +//////////////////////////////////////////////////////////// +/// Check if there's an active context on the current thread +//////////////////////////////////////////////////////////// +bool WindowImplWin32::IsContextActive() +{ + return wglGetCurrentContext() != NULL; +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::ProcessEvents +//////////////////////////////////////////////////////////// +void WindowImplWin32::ProcessEvents() +{ + // We update the window only if we own it + if (!myCallback) + { + MSG Message; + while (PeekMessage(&Message, myHandle, 0, 0, PM_REMOVE)) + { + TranslateMessage(&Message); + DispatchMessage(&Message); + } + } +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::Display +//////////////////////////////////////////////////////////// +void WindowImplWin32::Display() +{ + if (myDeviceContext && myGLContext) + SwapBuffers(myDeviceContext); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetActive +//////////////////////////////////////////////////////////// +void WindowImplWin32::SetActive(bool Active) const +{ + if (Active) + { + if (myDeviceContext && myGLContext && (wglGetCurrentContext() != myGLContext)) + wglMakeCurrent(myDeviceContext, myGLContext); + } + else + { + if (wglGetCurrentContext() == myGLContext) + wglMakeCurrent(NULL, NULL); + } +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::UseVerticalSync +//////////////////////////////////////////////////////////// +void WindowImplWin32::UseVerticalSync(bool Enabled) +{ + PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = reinterpret_cast(wglGetProcAddress("wglSwapIntervalEXT")); + if (wglSwapIntervalEXT) + wglSwapIntervalEXT(Enabled ? 1 : 0); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::ShowMouseCursor +//////////////////////////////////////////////////////////// +void WindowImplWin32::ShowMouseCursor(bool Show) +{ + if (Show) + myCursor = LoadCursor(NULL, IDC_ARROW); + else + myCursor = NULL; + + SetCursor(myCursor); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetCursorPosition +//////////////////////////////////////////////////////////// +void WindowImplWin32::SetCursorPosition(unsigned int Left, unsigned int Top) +{ + POINT Pos = {Left, Top}; + ClientToScreen(myHandle, &Pos); + SetCursorPos(Pos.x, Pos.y); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetPosition +//////////////////////////////////////////////////////////// +void WindowImplWin32::SetPosition(int Left, int Top) +{ + SetWindowPos(myHandle, NULL, Left, Top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetSize +//////////////////////////////////////////////////////////// +void WindowImplWin32::SetSize(unsigned int Width, unsigned int Height) +{ + SetWindowPos(myHandle, NULL, 0, 0, Width, Height, SWP_NOMOVE | SWP_NOZORDER); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::Show +//////////////////////////////////////////////////////////// +void WindowImplWin32::Show(bool State) +{ + ShowWindow(myHandle, State ? SW_SHOW : SW_HIDE); +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::EnableKeyRepeat +//////////////////////////////////////////////////////////// +void WindowImplWin32::EnableKeyRepeat(bool Enabled) +{ + myKeyRepeatEnabled = Enabled; +} + + +//////////////////////////////////////////////////////////// +/// /see WindowImpl::SetIcon +//////////////////////////////////////////////////////////// +void WindowImplWin32::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +{ + // First destroy the previous one + if (myIcon) + DestroyIcon(myIcon); + + // Windows wants BGRA pixels : swap red and blue channels + std::vector IconPixels(Width * Height * 4); + for (std::size_t i = 0; i < IconPixels.size() / 4; ++i) + { + IconPixels[i * 4 + 0] = Pixels[i * 4 + 2]; + IconPixels[i * 4 + 1] = Pixels[i * 4 + 1]; + IconPixels[i * 4 + 2] = Pixels[i * 4 + 0]; + IconPixels[i * 4 + 3] = Pixels[i * 4 + 3]; + } + + // Create the icon from the pixels array + myIcon = CreateIcon(GetModuleHandle(NULL), Width, Height, 1, 32, NULL, &IconPixels[0]); + + // Set it as both big and small icon of the window + if (myIcon) + { + SendMessage(myHandle, WM_SETICON, ICON_BIG, (LPARAM)myIcon); + SendMessage(myHandle, WM_SETICON, ICON_SMALL, (LPARAM)myIcon); + } + else + { + std::cerr << "Failed to set the window's icon" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Register the window class +//////////////////////////////////////////////////////////// +void WindowImplWin32::RegisterWindowClass() +{ + if (HasUnicodeSupport()) + { + WNDCLASSW WindowClass; + WindowClass.style = 0; + WindowClass.lpfnWndProc = &WindowImplWin32::GlobalOnEvent; + WindowClass.cbClsExtra = 0; + WindowClass.cbWndExtra = 0; + WindowClass.hInstance = GetModuleHandle(NULL); + WindowClass.hIcon = NULL; + WindowClass.hCursor = 0; + WindowClass.hbrBackground = 0; + WindowClass.lpszMenuName = NULL; + WindowClass.lpszClassName = ourClassNameW; + RegisterClassW(&WindowClass); + } + else + { + WNDCLASSA WindowClass; + WindowClass.style = 0; + WindowClass.lpfnWndProc = &WindowImplWin32::GlobalOnEvent; + WindowClass.cbClsExtra = 0; + WindowClass.cbWndExtra = 0; + WindowClass.hInstance = GetModuleHandle(NULL); + WindowClass.hIcon = NULL; + WindowClass.hCursor = 0; + WindowClass.hbrBackground = 0; + WindowClass.lpszMenuName = NULL; + WindowClass.lpszClassName = ourClassNameA; + RegisterClassA(&WindowClass); + } +} + + +//////////////////////////////////////////////////////////// +/// Switch to fullscreen mode +//////////////////////////////////////////////////////////// +void WindowImplWin32::SwitchToFullscreen(const VideoMode& Mode) +{ + DEVMODE DevMode; + DevMode.dmSize = sizeof(DEVMODE); + DevMode.dmPelsWidth = Mode.Width; + DevMode.dmPelsHeight = Mode.Height; + DevMode.dmBitsPerPel = Mode.BitsPerPixel; + DevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; + + // Apply fullscreen mode + if (ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) + { + std::cerr << "Failed to change display mode for fullscreen" << std::endl; + return; + } + + // Change window style (no border, no titlebar, ...) + SetWindowLong(myHandle, GWL_STYLE, WS_POPUP); + SetWindowLong(myHandle, GWL_EXSTYLE, WS_EX_APPWINDOW); + + // And resize it so that it fits the entire screen + SetWindowPos(myHandle, HWND_TOP, 0, 0, Mode.Width, Mode.Height, SWP_FRAMECHANGED); + ShowWindow(myHandle, SW_SHOW); + + // Set "this" as the current fullscreen window + ourFullscreenWindow = this; + + // SetPixelFormat can fail (really ?) if window style doesn't contain these flags + long Style = GetWindowLong(myHandle, GWL_STYLE); + SetWindowLong(myHandle, GWL_STYLE, Style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); +} + + +//////////////////////////////////////////////////////////// +/// Construct the context from graphics settings +//////////////////////////////////////////////////////////// +void WindowImplWin32::CreateContext(const VideoMode& Mode, WindowSettings& Params) +{ + // Get the device context attached to the window + myDeviceContext = GetDC(myHandle); + if (myDeviceContext == NULL) + { + std::cerr << "Failed to get device context of window -- cannot create OpenGL context" << std::endl; + return; + } + + // Let's find a suitable pixel format -- first try with antialiasing + int BestFormat = 0; + if (Params.AntialiasingLevel > 0) + { + // Get the wglChoosePixelFormatARB function (it is an extension) + PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast(wglGetProcAddress("wglChoosePixelFormatARB")); + + // Define the basic attributes we want for our window + int IntAttributes[] = + { + WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, + WGL_SUPPORT_OPENGL_ARB, GL_TRUE, + WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, + WGL_DOUBLE_BUFFER_ARB, GL_TRUE, + WGL_SAMPLE_BUFFERS_ARB, (Params.AntialiasingLevel ? GL_TRUE : GL_FALSE), + WGL_SAMPLES_ARB, Params.AntialiasingLevel, + 0, 0 + }; + + // Let's check how many formats are supporting our requirements + int Formats[128]; + UINT NbFormats; + float FloatAttributes[] = {0, 0}; + bool IsValid = wglChoosePixelFormatARB(myDeviceContext, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0; + if (!IsValid || (NbFormats == 0)) + { + if (Params.AntialiasingLevel > 2) + { + // No format matching our needs : reduce the multisampling level + std::cerr << "Failed to find a pixel format supporting " + << Params.AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl; + + Params.AntialiasingLevel = IntAttributes[1] = 2; + IsValid = wglChoosePixelFormatARB(myDeviceContext, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0; + } + + if (!IsValid || (NbFormats == 0)) + { + // Cannot find any pixel format supporting multisampling ; disabling antialiasing + std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl; + Params.AntialiasingLevel = 0; + } + } + + // Get the best format among the returned ones + if (IsValid && (NbFormats > 0)) + { + int BestScore = 0xFFFF; + for (UINT i = 0; i < NbFormats; ++i) + { + // Get the current format's attributes + PIXELFORMATDESCRIPTOR Attribs; + Attribs.nSize = sizeof(PIXELFORMATDESCRIPTOR); + Attribs.nVersion = 1; + DescribePixelFormat(myDeviceContext, Formats[i], sizeof(PIXELFORMATDESCRIPTOR), &Attribs); + + // Evaluate the current configuration + int Color = Attribs.cRedBits + Attribs.cGreenBits + Attribs.cBlueBits + Attribs.cAlphaBits; + int Score = EvaluateConfig(Mode, Params, Color, Attribs.cDepthBits, Attribs.cStencilBits, Params.AntialiasingLevel); + + // Keep it if it's better than the current best + if (Score < BestScore) + { + BestScore = Score; + BestFormat = Formats[i]; + } + } + } + } + + // Find a pixel format with no antialiasing, if not needed or not supported + if (BestFormat == 0) + { + // Setup a pixel format descriptor from the rendering settings + PIXELFORMATDESCRIPTOR PixelDescriptor; + ZeroMemory(&PixelDescriptor, sizeof(PIXELFORMATDESCRIPTOR)); + PixelDescriptor.nSize = sizeof(PIXELFORMATDESCRIPTOR); + PixelDescriptor.nVersion = 1; + PixelDescriptor.iLayerType = PFD_MAIN_PLANE; + PixelDescriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + PixelDescriptor.iPixelType = PFD_TYPE_RGBA; + PixelDescriptor.cColorBits = static_cast(Mode.BitsPerPixel); + PixelDescriptor.cDepthBits = static_cast(Params.DepthBits); + PixelDescriptor.cStencilBits = static_cast(Params.StencilBits); + + // Get the pixel format that best matches our requirements + BestFormat = ChoosePixelFormat(myDeviceContext, &PixelDescriptor); + if (BestFormat == 0) + { + std::cerr << "Failed to find a suitable pixel format for device context -- cannot create OpenGL context" << std::endl; + return; + } + } + + // Extract the depth and stencil bits from the chosen format + PIXELFORMATDESCRIPTOR ActualFormat; + ActualFormat.nSize = sizeof(PIXELFORMATDESCRIPTOR); + ActualFormat.nVersion = 1; + DescribePixelFormat(myDeviceContext, BestFormat, sizeof(PIXELFORMATDESCRIPTOR), &ActualFormat); + Params.DepthBits = ActualFormat.cDepthBits; + Params.StencilBits = ActualFormat.cStencilBits; + + // Set the chosen pixel format + if (!SetPixelFormat(myDeviceContext, BestFormat, &ActualFormat)) + { + std::cerr << "Failed to set pixel format for device context -- cannot create OpenGL context" << std::endl; + return; + } + + // Create the OpenGL context from the device context + myGLContext = wglCreateContext(myDeviceContext); + if (myGLContext == NULL) + { + std::cerr << "Failed to create an OpenGL context for this window" << std::endl; + return; + } + + // Share display lists with other contexts + HGLRC CurrentContext = wglGetCurrentContext(); + if (CurrentContext) + wglShareLists(CurrentContext, myGLContext); + + // Activate the context + SetActive(true); + + // Enable multisampling + if (Params.AntialiasingLevel > 0) + glEnable(GL_MULTISAMPLE_ARB); +} + + +//////////////////////////////////////////////////////////// +/// Free all the graphical resources attached to the window +//////////////////////////////////////////////////////////// +void WindowImplWin32::Cleanup() +{ + // Restore the previous video mode (in case we were running in fullscreen) + if (ourFullscreenWindow == this) + { + ChangeDisplaySettings(NULL, 0); + ourFullscreenWindow = NULL; + } + + // Unhide the mouse cursor (in case it was hidden) + ShowMouseCursor(true); + + // Destroy the OpenGL context + if (myGLContext) + { + // Unbind the context before destroying it + SetActive(false); + + wglDeleteContext(myGLContext); + myGLContext = NULL; + } + if (myDeviceContext) + { + ReleaseDC(myHandle, myDeviceContext); + myDeviceContext = NULL; + } +} + + +//////////////////////////////////////////////////////////// +/// Process a Win32 event +//////////////////////////////////////////////////////////// +void WindowImplWin32::ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam) +{ + // Don't process any message until window is created + if (myHandle == NULL) + return; + + switch (Message) + { + // Destroy event + case WM_DESTROY : + { + // Here we must cleanup resources ! + Cleanup(); + break; + } + + // Set cursor event + case WM_SETCURSOR : + { + // The mouse has moved, if the cursor is in our window we must refresh the cursor + if (LOWORD(LParam) == HTCLIENT) + SetCursor(myCursor); + + break; + } + + // Close event + case WM_CLOSE : + { + Event Evt; + Evt.Type = Event::Closed; + SendEvent(Evt); + break; + } + + // Resize event + case WM_SIZE : + { + // Update window size + RECT Rect; + GetClientRect(myHandle, &Rect); + myWidth = Rect.right - Rect.left; + myHeight = Rect.bottom - Rect.top; + + Event Evt; + Evt.Type = Event::Resized; + Evt.Size.Width = myWidth; + Evt.Size.Height = myHeight; + SendEvent(Evt); + break; + } + + // Gain focus event + case WM_SETFOCUS : + { + Event Evt; + Evt.Type = Event::GainedFocus; + SendEvent(Evt); + break; + } + + // Lost focus event + case WM_KILLFOCUS : + { + Event Evt; + Evt.Type = Event::LostFocus; + SendEvent(Evt); + break; + } + + // Text event + case WM_CHAR : + { + Event Evt; + Evt.Type = Event::TextEntered; + Evt.Text.Unicode = static_cast(WParam); + SendEvent(Evt); + break; + } + + // Keydown event + case WM_KEYDOWN : + case WM_SYSKEYDOWN : + { + if (myKeyRepeatEnabled || ((LParam & (1 << 30)) == 0)) + { + Event Evt; + Evt.Type = Event::KeyPressed; + Evt.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; + Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; + Evt.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; + + if (WParam != VK_SHIFT) + { + Evt.Key.Code = VirtualKeyCodeToSF(WParam, LParam); + SendEvent(Evt); + } + else + { + // Special case for shift, its state can't be retrieved directly + Evt.Key.Code = GetShiftState(true); + if (Evt.Key.Code != 0) + SendEvent(Evt); + } + } + break; + } + + // Keyup event + case WM_KEYUP : + case WM_SYSKEYUP : + { + Event Evt; + Evt.Type = Event::KeyReleased; + Evt.Key.Alt = HIWORD(GetAsyncKeyState(VK_MENU)) != 0; + Evt.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0; + Evt.Key.Shift = HIWORD(GetAsyncKeyState(VK_SHIFT)) != 0; + + if (WParam != VK_SHIFT) + { + Evt.Key.Code = VirtualKeyCodeToSF(WParam, LParam); + SendEvent(Evt); + } + else + { + // Special case for shift, its state can't be retrieved directly + Evt.Key.Code = GetShiftState(false); + if (Evt.Key.Code != 0) + SendEvent(Evt); + } + + break; + } + + // Mouse wheel event + case WM_MOUSEWHEEL : + { + Event Evt; + Evt.Type = Event::MouseWheelMoved; + Evt.MouseWheel.Delta = static_cast(HIWORD(WParam)) / 120; + SendEvent(Evt); + break; + } + + // Mouse left button down event + case WM_LBUTTONDOWN : + { + Event Evt; + Evt.Type = Event::MouseButtonPressed; + Evt.MouseButton.Button = Mouse::Left; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse left button up event + case WM_LBUTTONUP : + { + Event Evt; + Evt.Type = Event::MouseButtonReleased; + Evt.MouseButton.Button = Mouse::Left; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse right button down event + case WM_RBUTTONDOWN : + { + Event Evt; + Evt.Type = Event::MouseButtonPressed; + Evt.MouseButton.Button = Mouse::Right; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse right button up event + case WM_RBUTTONUP : + { + Event Evt; + Evt.Type = Event::MouseButtonReleased; + Evt.MouseButton.Button = Mouse::Right; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse wheel button down event + case WM_MBUTTONDOWN : + { + Event Evt; + Evt.Type = Event::MouseButtonPressed; + Evt.MouseButton.Button = Mouse::Middle; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse wheel button up event + case WM_MBUTTONUP : + { + Event Evt; + Evt.Type = Event::MouseButtonReleased; + Evt.MouseButton.Button = Mouse::Middle; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse X button down event + case WM_XBUTTONDOWN : + { + Event Evt; + Evt.Type = Event::MouseButtonPressed; + Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse X button up event + case WM_XBUTTONUP : + { + Event Evt; + Evt.Type = Event::MouseButtonReleased; + Evt.MouseButton.Button = HIWORD(WParam) == XBUTTON1 ? Mouse::XButton1 : Mouse::XButton2; + Evt.MouseButton.X = LOWORD(LParam); + Evt.MouseButton.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse move event + case WM_MOUSEMOVE : + { + // Check if we need to generate a MouseEntered event + if (!myIsCursorIn) + { + TRACKMOUSEEVENT MouseEvent; + MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + MouseEvent.hwndTrack = myHandle; + MouseEvent.dwFlags = TME_LEAVE; + TrackMouseEvent(&MouseEvent); + + myIsCursorIn = true; + + Event Evt; + Evt.Type = Event::MouseEntered; + SendEvent(Evt); + } + + Event Evt; + Evt.Type = Event::MouseMoved; + Evt.MouseMove.X = LOWORD(LParam); + Evt.MouseMove.Y = HIWORD(LParam); + SendEvent(Evt); + break; + } + + // Mouse leave event + case WM_MOUSELEAVE : + { + myIsCursorIn = false; + + Event Evt; + Evt.Type = Event::MouseLeft; + SendEvent(Evt); + break; + } + } +} + + +//////////////////////////////////////////////////////////// +/// Check the state of the shift keys on a key event, +/// and return the corresponding SF key code +//////////////////////////////////////////////////////////// +Key::Code WindowImplWin32::GetShiftState(bool KeyDown) +{ + static bool LShiftPrevDown = false; + static bool RShiftPrevDown = false; + + bool LShiftDown = (HIWORD(GetAsyncKeyState(VK_LSHIFT)) != 0); + bool RShiftDown = (HIWORD(GetAsyncKeyState(VK_RSHIFT)) != 0); + + Key::Code Code = Key::Code(0); + if (KeyDown) + { + if (!LShiftPrevDown && LShiftDown) Code = Key::LShift; + else if (!RShiftPrevDown && RShiftDown) Code = Key::RShift; + } + else + { + if (LShiftPrevDown && !LShiftDown) Code = Key::LShift; + else if (RShiftPrevDown && !RShiftDown) Code = Key::RShift; + } + + LShiftPrevDown = LShiftDown; + RShiftPrevDown = RShiftDown; + + return Code; +} + + +//////////////////////////////////////////////////////////// +/// Convert a Win32 virtual key code to a SFML key code +//////////////////////////////////////////////////////////// +Key::Code WindowImplWin32::VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags) +{ + switch (VirtualKey) + { + // VK_SHIFT is handled by the GetShiftState function + case VK_MENU : return (Flags & (1 << 24)) ? Key::RAlt : Key::LAlt; + case VK_CONTROL : return (Flags & (1 << 24)) ? Key::RControl : Key::LControl; + case VK_LWIN : return Key::LSystem; + case VK_RWIN : return Key::RSystem; + case VK_APPS : return Key::Menu; + case VK_OEM_1 : return Key::SemiColon; + case VK_OEM_2 : return Key::Slash; + case VK_OEM_PLUS : return Key::Equal; + case VK_OEM_MINUS : return Key::Dash; + case VK_OEM_4 : return Key::LBracket; + case VK_OEM_6 : return Key::RBracket; + case VK_OEM_COMMA : return Key::Comma; + case VK_OEM_PERIOD : return Key::Period; + case VK_OEM_7 : return Key::Quote; + case VK_OEM_5 : return Key::BackSlash; + case VK_OEM_3 : return Key::Tilde; + case VK_ESCAPE : return Key::Escape; + case VK_SPACE : return Key::Space; + case VK_RETURN : return Key::Return; + case VK_BACK : return Key::Back; + case VK_TAB : return Key::Tab; + case VK_PRIOR : return Key::PageUp; + case VK_NEXT : return Key::PageDown; + case VK_END : return Key::End; + case VK_HOME : return Key::Home; + case VK_INSERT : return Key::Insert; + case VK_DELETE : return Key::Delete; + case VK_ADD : return Key::Add; + case VK_SUBTRACT : return Key::Subtract; + case VK_MULTIPLY : return Key::Multiply; + case VK_DIVIDE : return Key::Divide; + case VK_PAUSE : return Key::Pause; + case VK_F1 : return Key::F1; + case VK_F2 : return Key::F2; + case VK_F3 : return Key::F3; + case VK_F4 : return Key::F4; + case VK_F5 : return Key::F5; + case VK_F6 : return Key::F6; + case VK_F7 : return Key::F7; + case VK_F8 : return Key::F8; + case VK_F9 : return Key::F9; + case VK_F10 : return Key::F10; + case VK_F11 : return Key::F11; + case VK_F12 : return Key::F12; + case VK_F13 : return Key::F13; + case VK_F14 : return Key::F14; + case VK_F15 : return Key::F15; + case VK_LEFT : return Key::Left; + case VK_RIGHT : return Key::Right; + case VK_UP : return Key::Up; + case VK_DOWN : return Key::Down; + case VK_NUMPAD0 : return Key::Numpad0; + case VK_NUMPAD1 : return Key::Numpad1; + case VK_NUMPAD2 : return Key::Numpad2; + case VK_NUMPAD3 : return Key::Numpad3; + case VK_NUMPAD4 : return Key::Numpad4; + case VK_NUMPAD5 : return Key::Numpad5; + case VK_NUMPAD6 : return Key::Numpad6; + case VK_NUMPAD7 : return Key::Numpad7; + case VK_NUMPAD8 : return Key::Numpad8; + case VK_NUMPAD9 : return Key::Numpad9; + case 'A' : return Key::A; + case 'Z' : return Key::Z; + case 'E' : return Key::E; + case 'R' : return Key::R; + case 'T' : return Key::T; + case 'Y' : return Key::Y; + case 'U' : return Key::U; + case 'I' : return Key::I; + case 'O' : return Key::O; + case 'P' : return Key::P; + case 'Q' : return Key::Q; + case 'S' : return Key::S; + case 'D' : return Key::D; + case 'F' : return Key::F; + case 'G' : return Key::G; + case 'H' : return Key::H; + case 'J' : return Key::J; + case 'K' : return Key::K; + case 'L' : return Key::L; + case 'M' : return Key::M; + case 'W' : return Key::W; + case 'X' : return Key::X; + case 'C' : return Key::C; + case 'V' : return Key::V; + case 'B' : return Key::B; + case 'N' : return Key::N; + case '0' : return Key::Num0; + case '1' : return Key::Num1; + case '2' : return Key::Num2; + case '3' : return Key::Num3; + case '4' : return Key::Num4; + case '5' : return Key::Num5; + case '6' : return Key::Num6; + case '7' : return Key::Num7; + case '8' : return Key::Num8; + case '9' : return Key::Num9; + } + + return Key::Code(0); +} + + +//////////////////////////////////////////////////////////// +/// Check if the current version of the OS supports unicode +/// messages and functions ; Windows 95/98/Me may not support +/// it, whereas Windows NT/2000/XP/Vista will +//////////////////////////////////////////////////////////// +bool WindowImplWin32::HasUnicodeSupport() +{ + OSVERSIONINFO VersionInfo; + ZeroMemory(&VersionInfo, sizeof(VersionInfo)); + VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo); + + if (GetVersionEx(&VersionInfo)) + { + return VersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT; + } + else + { + return false; + } +} + + +//////////////////////////////////////////////////////////// +/// Function called whenever one of our windows receives a message +//////////////////////////////////////////////////////////// +LRESULT CALLBACK WindowImplWin32::GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam) +{ + // Associate handle and Window instance when the creation message is received + if (Message == WM_CREATE) + { + // Get WindowImplWin32 instance (it was passed as the last argument of CreateWindow) + long This = reinterpret_cast(reinterpret_cast(LParam)->lpCreateParams); + + // Set as the "user data" parameter of the window + SetWindowLongPtr(Handle, GWLP_USERDATA, This); + } + + // Get the WindowImpl instance corresponding to the window handle + WindowImplWin32* Window = reinterpret_cast(GetWindowLongPtr(Handle, GWLP_USERDATA)); + + // Forward the event to the appropriate function + if (Window) + { + Window->ProcessEvent(Message, WParam, LParam); + + if (Window->myCallback) + return CallWindowProc(reinterpret_cast(Window->myCallback), Handle, Message, WParam, LParam); + } + + // We don't forward the WM_CLOSE message to prevent the OS from automatically destroying the window + if (Message == WM_CLOSE) + return 0; + + static const bool HasUnicode = HasUnicodeSupport(); + return HasUnicode ? DefWindowProcW(Handle, Message, WParam, LParam) : + DefWindowProcA(Handle, Message, WParam, LParam); +} + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp new file mode 100644 index 00000000..7b6a4255 --- /dev/null +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp @@ -0,0 +1,266 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWIMPLWIN32_HPP +#define SFML_WINDOWIMPLWIN32_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// WindowImplWin32 is the Win32 implementation of WindowImpl +//////////////////////////////////////////////////////////// +class WindowImplWin32 : public WindowImpl +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// (creates a dummy window to provide a valid OpenGL context) + /// + //////////////////////////////////////////////////////////// + WindowImplWin32(); + + //////////////////////////////////////////////////////////// + /// Construct the window implementation from an existing control + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation settings + /// + //////////////////////////////////////////////////////////// + WindowImplWin32(WindowHandle Handle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Create the window implementation + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style + /// \param Params : Creation settings + /// + //////////////////////////////////////////////////////////// + WindowImplWin32(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + ~WindowImplWin32(); + + //////////////////////////////////////////////////////////// + /// Check if there's an active context on the current thread + /// + /// \return True if there's a context bound to the current thread + /// + //////////////////////////////////////////////////////////// + static bool IsContextActive(); + +private : + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::ProcessEvents + /// + //////////////////////////////////////////////////////////// + virtual void ProcessEvents(); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::Display + /// + //////////////////////////////////////////////////////////// + virtual void Display(); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetActive + /// + //////////////////////////////////////////////////////////// + virtual void SetActive(bool Active = true) const; + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::UseVerticalSync + /// + //////////////////////////////////////////////////////////// + virtual void UseVerticalSync(bool Enabled); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::ShowMouseCursor + /// + //////////////////////////////////////////////////////////// + virtual void ShowMouseCursor(bool Show); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetCursorPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetCursorPosition(unsigned int Left, unsigned int Top); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetPosition + /// + //////////////////////////////////////////////////////////// + virtual void SetPosition(int Left, int Top); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetSize + /// + //////////////////////////////////////////////////////////// + virtual void SetSize(unsigned int Width, unsigned int Height); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::Show + /// + //////////////////////////////////////////////////////////// + virtual void Show(bool State); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::EnableKeyRepeat + /// + //////////////////////////////////////////////////////////// + virtual void EnableKeyRepeat(bool Enabled); + + //////////////////////////////////////////////////////////// + /// /see WindowImpl::SetIcon + /// + //////////////////////////////////////////////////////////// + virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); + + //////////////////////////////////////////////////////////// + /// Register the window class + /// + //////////////////////////////////////////////////////////// + void RegisterWindowClass(); + + //////////////////////////////////////////////////////////// + /// Switch to fullscreen mode + /// + /// \param Mode : video mode to switch to + /// + //////////////////////////////////////////////////////////// + void SwitchToFullscreen(const VideoMode& Mode); + + //////////////////////////////////////////////////////////// + /// Construct the context from graphics settings + /// + /// \param Mode : Video mode + /// \param Params : Creation settings + /// + //////////////////////////////////////////////////////////// + void CreateContext(const VideoMode& Mode, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Free all the graphical resources attached to the window + /// + //////////////////////////////////////////////////////////// + void Cleanup(); + + //////////////////////////////////////////////////////////// + /// Process a Win32 event + /// + /// \param Message : Message to process + /// \param WParam : First parameter of the event + /// \param LParam : Second parameter of the event + /// + //////////////////////////////////////////////////////////// + void ProcessEvent(UINT Message, WPARAM WParam, LPARAM LParam); + + //////////////////////////////////////////////////////////// + /// Check the state of the shift keys on a key event, + /// and return the corresponding SF key code + /// + /// \param KeyDown : True for a keydown event, false for a keyup event + /// + /// \return SFML key code corresponding to the shift key + /// + //////////////////////////////////////////////////////////// + static Key::Code GetShiftState(bool KeyDown); + + //////////////////////////////////////////////////////////// + /// Convert a Win32 virtual key code to a SFML key code + /// + /// \param VirtualKey : Virtual key code to convert + /// \param Flags : Additional flags + /// + /// \return SFML key code corresponding to VirtualKey + /// + //////////////////////////////////////////////////////////// + static Key::Code VirtualKeyCodeToSF(WPARAM VirtualKey, LPARAM Flags); + + //////////////////////////////////////////////////////////// + /// Check if the current version of the OS supports unicode + /// messages and functions ; Windows 95/98/Me may not support + /// it, whereas Windows NT/2000/XP/Vista will + /// + /// \return True if the OS supports unicode + /// + //////////////////////////////////////////////////////////// + static bool HasUnicodeSupport(); + + //////////////////////////////////////////////////////////// + /// Function called whenever one of our windows receives a message + /// + /// \param Handle : Win32 handle of the window + /// \param Message : Message received + /// \param WParam : First parameter of the message + /// \param LParam : Second parameter of the message + /// + /// \return Something... + /// + //////////////////////////////////////////////////////////// + static LRESULT CALLBACK GlobalOnEvent(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static unsigned int ourWindowCount; ///< Number of windows that we own + static const char* ourClassNameA; ///< Win32 window class name (ANSI version) + static const wchar_t* ourClassNameW; ///< Win32 window class name (unicode version) + static WindowImplWin32* ourFullscreenWindow; ///< Window currently in fullscreen + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + HWND myHandle; ///< Win32 handle of the window + long myCallback; ///< Stores the original event callback function of the control + HCURSOR myCursor; ///< The system cursor to display into the window + HICON myIcon; ///< Custom icon assigned to the window + bool myKeyRepeatEnabled; ///< Automatic key-repeat state for keydown events + bool myIsCursorIn; ///< Is the mouse cursor in the window's area ? + HDC myDeviceContext; ///< HDC associated to the window + HGLRC myGLContext; ///< OpenGL rendering context associated to the HDC +}; + +} // namespace priv + +} // namespace sf + +#endif // SFML_WINDOWIMPLWIN32_HPP diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp new file mode 100644 index 00000000..7539bded --- /dev/null +++ b/src/SFML/Window/Window.cpp @@ -0,0 +1,440 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Default constructor +/// +//////////////////////////////////////////////////////////// +Window::Window() : +myWindow (NULL), +myLastFrameTime (0.f), +myIsExternal (false), +myFramerateLimit(0), +mySetCursorPosX (-1), +mySetCursorPosY (-1) +{ + +} + + +//////////////////////////////////////////////////////////// +/// Construct a new window +//////////////////////////////////////////////////////////// +Window::Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const WindowSettings& Params) : +myWindow (NULL), +myLastFrameTime (0.f), +myIsExternal (false), +myFramerateLimit(0), +mySetCursorPosX (0xFFFF), +mySetCursorPosY (0xFFFF) +{ + Create(Mode, Title, WindowStyle, Params); +} + + +//////////////////////////////////////////////////////////// +/// Construct the window from an existing control +//////////////////////////////////////////////////////////// +Window::Window(WindowHandle Handle, const WindowSettings& Params) : +myWindow (NULL), +myLastFrameTime (0.f), +myIsExternal (true), +myFramerateLimit(0), +mySetCursorPosX (-1), +mySetCursorPosY (-1) +{ + Create(Handle, Params); +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +Window::~Window() +{ + // Close the window + Close(); +} + + +//////////////////////////////////////////////////////////// +/// Create the window +//////////////////////////////////////////////////////////// +void Window::Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const WindowSettings& Params) +{ + // Check validity of video mode + if ((WindowStyle & Style::Fullscreen) && !Mode.IsValid()) + { + std::cerr << "The requested video mode is not available, switching to a valid mode" << std::endl; + Mode = VideoMode::GetMode(0); + } + + // Check validity of style + if ((WindowStyle & Style::Close) || (WindowStyle & Style::Resize)) + WindowStyle |= Style::Titlebar; + + // Destroy the previous window implementation + delete myWindow; + + // Activate the global context + Context::GetGlobal().SetActive(true); + + mySettings = Params; + Initialize(priv::WindowImpl::New(Mode, Title, WindowStyle, mySettings)); +} + + +//////////////////////////////////////////////////////////// +/// Create the window from an existing control +//////////////////////////////////////////////////////////// +void Window::Create(WindowHandle Handle, const WindowSettings& Params) +{ + // Destroy the previous window implementation + delete myWindow; + + // Activate the global context + Context::GetGlobal().SetActive(true); + + mySettings = Params; + Initialize(priv::WindowImpl::New(Handle, mySettings)); +} + + +//////////////////////////////////////////////////////////// +/// Close (destroy) the window. +/// The sf::Window instance remains valid and you can call +/// Create to recreate the window +//////////////////////////////////////////////////////////// +void Window::Close() +{ + // Delete the window implementation + delete myWindow; + myWindow = NULL; +} + + +//////////////////////////////////////////////////////////// +/// Tell whether or not the window is opened (ie. has been created). +/// Note that a hidden window (Show(false)) +/// will still return true +//////////////////////////////////////////////////////////// +bool Window::IsOpened() const +{ + return myWindow != NULL; +} + + +//////////////////////////////////////////////////////////// +/// Get the width of the rendering region of the window +//////////////////////////////////////////////////////////// +unsigned int Window::GetWidth() const +{ + return myWindow ? myWindow->GetWidth() : 0; +} + + +//////////////////////////////////////////////////////////// +/// Get the height of the rendering region of the window +//////////////////////////////////////////////////////////// +unsigned int Window::GetHeight() const +{ + return myWindow ? myWindow->GetHeight() : 0; +} + + +//////////////////////////////////////////////////////////// +/// Get the creation settings of the window +//////////////////////////////////////////////////////////// +const WindowSettings& Window::GetSettings() const +{ + return mySettings; +} + + +//////////////////////////////////////////////////////////// +/// Get the event on top of events stack, if any +//////////////////////////////////////////////////////////// +bool Window::GetEvent(Event& EventReceived) +{ + // Let the window implementation process incoming events if the events queue is empty + if (myWindow && myEvents.empty()) + myWindow->DoEvents(); + + // Pop first event of queue, if not empty + if (!myEvents.empty()) + { + EventReceived = myEvents.front(); + myEvents.pop(); + + return true; + } + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Enable / disable vertical synchronization +//////////////////////////////////////////////////////////// +void Window::UseVerticalSync(bool Enabled) +{ + if (SetActive()) + myWindow->UseVerticalSync(Enabled); +} + + +//////////////////////////////////////////////////////////// +/// Show or hide the mouse cursor +//////////////////////////////////////////////////////////// +void Window::ShowMouseCursor(bool Show) +{ + if (myWindow) + myWindow->ShowMouseCursor(Show); +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the mouse cursor +//////////////////////////////////////////////////////////// +void Window::SetCursorPosition(unsigned int Left, unsigned int Top) +{ + if (myWindow) + { + // Keep coordinates for later checking (to reject the generated MouseMoved event) + mySetCursorPosX = Left; + mySetCursorPosY = Top; + + myWindow->SetCursorPosition(Left, Top); + } +} + + +//////////////////////////////////////////////////////////// +/// Change the position of the window on screen +//////////////////////////////////////////////////////////// +void Window::SetPosition(int Left, int Top) +{ + if (!myIsExternal) + { + if (myWindow) + myWindow->SetPosition(Left, Top); + } + else + { + std::cerr << "Warning : trying to change the position of an external SFML window, which is not allowed" << std::endl; + } +} + + +//////////////////////////////////////////////////////////// +/// Change the size of the rendering region of the window +//////////////////////////////////////////////////////////// +void Window::SetSize(unsigned int Width, unsigned int Height) +{ + if (myWindow) + myWindow->SetSize(Width, Height); +} + + +//////////////////////////////////////////////////////////// +/// Show or hide the window +//////////////////////////////////////////////////////////// +void Window::Show(bool State) +{ + if (!myIsExternal) + { + if (myWindow) + myWindow->Show(State); + } +} + + +//////////////////////////////////////////////////////////// +/// Enable or disable automatic key-repeat. +/// Automatic key-repeat is enabled by default +//////////////////////////////////////////////////////////// +void Window::EnableKeyRepeat(bool Enabled) +{ + if (myWindow) + myWindow->EnableKeyRepeat(Enabled); +} + + +//////////////////////////////////////////////////////////// +/// Change the window's icon +//////////////////////////////////////////////////////////// +void Window::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) +{ + if (myWindow) + myWindow->SetIcon(Width, Height, Pixels); +} + + +//////////////////////////////////////////////////////////// +/// Activate of deactivate the window as the current target +/// for rendering +//////////////////////////////////////////////////////////// +bool Window::SetActive(bool Active) const +{ + if (myWindow) + { + myWindow->SetActive(Active); + return true; + } + + return false; +} + + +//////////////////////////////////////////////////////////// +/// Display the window on screen +//////////////////////////////////////////////////////////// +void Window::Display() +{ + // Limit the framerate if needed + if (myFramerateLimit > 0) + { + float RemainingTime = 1.f / myFramerateLimit - myClock.GetElapsedTime(); + if (RemainingTime > 0) + Sleep(RemainingTime); + } + + // Measure the time elapsed since last frame + myLastFrameTime = myClock.GetElapsedTime(); + myClock.Reset(); + + // Display the backbuffer on screen + if (SetActive()) + myWindow->Display(); +} + + +//////////////////////////////////////////////////////////// +/// Get the input manager of the window +//////////////////////////////////////////////////////////// +const Input& Window::GetInput() const +{ + return myInput; +} + + +//////////////////////////////////////////////////////////// +/// Set the framerate at a fixed frequency +//////////////////////////////////////////////////////////// +void Window::SetFramerateLimit(unsigned int Limit) +{ + myFramerateLimit = Limit; +} + + +//////////////////////////////////////////////////////////// +/// Get time elapsed since last frame +//////////////////////////////////////////////////////////// +float Window::GetFrameTime() const +{ + return myLastFrameTime; +} + + +//////////////////////////////////////////////////////////// +/// Change the joystick threshold, ie. the value below which +/// no move event will be generated +//////////////////////////////////////////////////////////// +void Window::SetJoystickThreshold(float Threshold) +{ + if (myWindow) + myWindow->SetJoystickThreshold(Threshold); +} + + +//////////////////////////////////////////////////////////// +/// Called after the window has been created +//////////////////////////////////////////////////////////// +void Window::OnCreate() +{ + // Nothing by default +} + + +//////////////////////////////////////////////////////////// +/// Receive an event from window +//////////////////////////////////////////////////////////// +void Window::OnEvent(const Event& EventReceived) +{ + // Discard MouseMove events generated by SetCursorPosition + if ((EventReceived.Type == Event::MouseMoved) && + (EventReceived.MouseMove.X == mySetCursorPosX) && + (EventReceived.MouseMove.Y == mySetCursorPosY)) + { + mySetCursorPosX = 0xFFFF; + mySetCursorPosY = 0xFFFF; + return; + } + + myEvents.push(EventReceived); +} + + +//////////////////////////////////////////////////////////// +/// Initialize internal window +//////////////////////////////////////////////////////////// +void Window::Initialize(priv::WindowImpl* Window) +{ + // Assign new window and listen to its events + myWindow = Window; + myWindow->AddListener(this); + + // Attach input to the window + myWindow->AddListener(&myInput); + + // Setup default behaviours (to get a consistent behaviour across different implementations) + Show(true); + UseVerticalSync(false); + ShowMouseCursor(true); + EnableKeyRepeat(true); + + // Reset frame time + myClock.Reset(); + myLastFrameTime = 0.f; + + // Activate the window + SetActive(true); + + // Notify the derived class + OnCreate(); +} + +} // namespace sf diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp new file mode 100644 index 00000000..7e1104ef --- /dev/null +++ b/src/SFML/Window/WindowImpl.cpp @@ -0,0 +1,252 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + +#if defined(SFML_SYSTEM_WINDOWS) + + #include + typedef sf::priv::WindowImplWin32 WindowImplType; + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + #include + typedef sf::priv::WindowImplX11 WindowImplType; + +#elif defined(SFML_SYSTEM_MACOS) + + #include + typedef sf::priv::WindowImplCocoa WindowImplType; + +#endif + + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Create a new window depending on the current OS +//////////////////////////////////////////////////////////// +WindowImpl* WindowImpl::New() +{ + return new WindowImplType(); +} + + +//////////////////////////////////////////////////////////// +/// Create a new window depending on the current OS +//////////////////////////////////////////////////////////// +WindowImpl* WindowImpl::New(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) +{ + return new WindowImplType(Mode, Title, WindowStyle, Params); +} + + +//////////////////////////////////////////////////////////// +/// Create a new window depending on the current OS +//////////////////////////////////////////////////////////// +WindowImpl* WindowImpl::New(WindowHandle Handle, WindowSettings& Params) +{ + return new WindowImplType(Handle, Params); +} + + +//////////////////////////////////////////////////////////// +/// Default constructor +//////////////////////////////////////////////////////////// +WindowImpl::WindowImpl() : +myWidth (0), +myHeight (0), +myJoyThreshold(0.1f) +{ + // Initialize the joysticks + for (unsigned int i = 0; i < JoysticksCount; ++i) + { + myJoysticks[i].Initialize(i); + myJoyStates[i] = myJoysticks[i].UpdateState(); + } +} + + +//////////////////////////////////////////////////////////// +/// Destructor +//////////////////////////////////////////////////////////// +WindowImpl::~WindowImpl() +{ + // Nothing to do +} + + +//////////////////////////////////////////////////////////// +/// Add a listener to the window +//////////////////////////////////////////////////////////// +void WindowImpl::AddListener(WindowListener* Listener) +{ + if (Listener) + myListeners.insert(Listener); +} + + +//////////////////////////////////////////////////////////// +/// Remove a listener from the window +//////////////////////////////////////////////////////////// +void WindowImpl::RemoveListener(WindowListener* Listener) +{ + myListeners.erase(Listener); +} + + +//////////////////////////////////////////////////////////// +/// Get the client width of the window +//////////////////////////////////////////////////////////// +unsigned int WindowImpl::GetWidth() const +{ + return myWidth; +} + + +//////////////////////////////////////////////////////////// +/// Get the client height of the window +//////////////////////////////////////////////////////////// +unsigned int WindowImpl::GetHeight() const +{ + return myHeight; +} + + +//////////////////////////////////////////////////////////// +/// Change the joystick threshold, ie. the value below which +/// no move event will be generated +//////////////////////////////////////////////////////////// +void WindowImpl::SetJoystickThreshold(float Threshold) +{ + myJoyThreshold = Threshold; +} + + +//////////////////////////////////////////////////////////// +/// Process incoming events from operating system +//////////////////////////////////////////////////////////// +void WindowImpl::DoEvents() +{ + // Read the joysticks state and generate the appropriate events + ProcessJoystickEvents(); + + // Let the derived class process other events + ProcessEvents(); +} + + +//////////////////////////////////////////////////////////// +/// Check if there's an active context on the current thread +//////////////////////////////////////////////////////////// +bool WindowImpl::IsContextActive() +{ + return WindowImplType::IsContextActive(); +} + + +//////////////////////////////////////////////////////////// +/// Send an event to listeners +//////////////////////////////////////////////////////////// +void WindowImpl::SendEvent(const Event& EventToSend) +{ + for (std::set::iterator i = myListeners.begin(); i != myListeners.end(); ++i) + { + (*i)->OnEvent(EventToSend); + } +} + + +//////////////////////////////////////////////////////////// +/// Evaluate a pixel format configuration. +/// This functions can be used by implementations that have +/// several valid formats and want to get the best one +//////////////////////////////////////////////////////////// +int WindowImpl::EvaluateConfig(const VideoMode& Mode, const WindowSettings& Settings, int ColorBits, int DepthBits, int StencilBits, int Antialiasing) +{ + return abs(static_cast(Mode.BitsPerPixel - ColorBits)) + + abs(static_cast(Settings.DepthBits - DepthBits)) + + abs(static_cast(Settings.StencilBits - StencilBits)) + + abs(static_cast(Settings.AntialiasingLevel - Antialiasing)); +} + + +//////////////////////////////////////////////////////////// +/// Read the joysticks state and generate the appropriate events +//////////////////////////////////////////////////////////// +void WindowImpl::ProcessJoystickEvents() +{ + for (unsigned int i = 0; i < JoysticksCount; ++i) + { + // Copy the previous state of the joystick and get the new one + JoystickState PreviousState = myJoyStates[i]; + myJoyStates[i] = myJoysticks[i].UpdateState(); + + // Axis + for (unsigned int j = 0; j < myJoysticks[i].GetAxesCount(); ++j) + { + float PrevPos = PreviousState.Axis[j]; + float CurrPos = myJoyStates[i].Axis[j]; + if (fabs(CurrPos - PrevPos) >= myJoyThreshold) + { + Event Event; + Event.Type = Event::JoyMoved; + Event.JoyMove.JoystickId = i; + Event.JoyMove.Axis = static_cast(j); + Event.JoyMove.Position = CurrPos; + SendEvent(Event); + } + } + + // Buttons + for (unsigned int j = 0; j < myJoysticks[i].GetButtonsCount(); ++j) + { + bool PrevPressed = PreviousState.Buttons[j]; + bool CurrPressed = myJoyStates[i].Buttons[j]; + + if ((!PrevPressed && CurrPressed) || (PrevPressed && !CurrPressed)) + { + Event Event; + Event.Type = CurrPressed ? Event::JoyButtonPressed : Event::JoyButtonReleased; + Event.JoyButton.JoystickId = i; + Event.JoyButton.Button = j; + SendEvent(Event); + } + } + } +} + + +} // namespace priv + +} // namespace sf diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp new file mode 100644 index 00000000..e231ff3e --- /dev/null +++ b/src/SFML/Window/WindowImpl.hpp @@ -0,0 +1,306 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWIMPL_HPP +#define SFML_WINDOWIMPL_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class Event; +class WindowListener; + +namespace priv +{ +//////////////////////////////////////////////////////////// +/// Abstract base class for OS-specific window implementation +//////////////////////////////////////////////////////////// +class WindowImpl : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// Create a new window depending on the current OS + /// + /// \return Pointer to the created window + /// + //////////////////////////////////////////////////////////// + static WindowImpl* New(); + + //////////////////////////////////////////////////////////// + /// Create a new window depending on the current OS + /// + /// \param Mode : Video mode to use + /// \param Title : Title of the window + /// \param WindowStyle : Window style + /// \param Params : Creation parameters + /// + /// \return Pointer to the created window + /// + //////////////////////////////////////////////////////////// + static WindowImpl* New(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params); + + //////////////////////////////////////////////////////////// + /// Create a new window depending on to the current OS + /// + /// \param Handle : Platform-specific handle of the control + /// \param Params : Creation parameters + /// + /// \return Pointer to the created window + /// + //////////////////////////////////////////////////////////// + static WindowImpl* New(WindowHandle Handle, WindowSettings& Params); + +public : + + //////////////////////////////////////////////////////////// + /// Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~WindowImpl(); + + //////////////////////////////////////////////////////////// + /// Add a listener to the window + /// + /// \param Listener : Listener to add + /// + //////////////////////////////////////////////////////////// + void AddListener(WindowListener* Listener); + + //////////////////////////////////////////////////////////// + /// Remove a listener from the window + /// + /// \param Listener : Listener to remove + /// + //////////////////////////////////////////////////////////// + void RemoveListener(WindowListener* Listener); + + //////////////////////////////////////////////////////////// + /// Get the client width of the window + /// + /// \return Width of the window in pixels + /// + //////////////////////////////////////////////////////////// + unsigned int GetWidth() const; + + //////////////////////////////////////////////////////////// + /// Get the client height of the window + /// + /// \return Height of the window in pixels + /// + //////////////////////////////////////////////////////////// + unsigned int GetHeight() const; + + //////////////////////////////////////////////////////////// + /// Activate of deactivate the window as the current target + /// for rendering + /// + /// \param Active : True to activate, false to deactivate (true by default) + /// + //////////////////////////////////////////////////////////// + virtual void SetActive(bool Active = true) const = 0; + + //////////////////////////////////////////////////////////// + /// Change the joystick threshold, ie. the value below which + /// no move event will be generated + /// + /// \param Threshold : New threshold, in range [0, 100] + /// + //////////////////////////////////////////////////////////// + void SetJoystickThreshold(float Threshold); + + //////////////////////////////////////////////////////////// + /// Process incoming events from operating system + /// + //////////////////////////////////////////////////////////// + void DoEvents(); + + //////////////////////////////////////////////////////////// + /// Check if there's an active context on the current thread + /// + /// \return True if there's a context bound to the current thread + /// + //////////////////////////////////////////////////////////// + static bool IsContextActive(); + + //////////////////////////////////////////////////////////// + /// Display the window on screen + /// + //////////////////////////////////////////////////////////// + virtual void Display() = 0; + + //////////////////////////////////////////////////////////// + /// Enable / disable vertical synchronization + /// + /// \param Enabled : True to enable v-sync, false to deactivate + /// + //////////////////////////////////////////////////////////// + virtual void UseVerticalSync(bool Enabled) = 0; + + //////////////////////////////////////////////////////////// + /// Show or hide the mouse cursor + /// + /// \param Show : True to show, false to hide + /// + //////////////////////////////////////////////////////////// + virtual void ShowMouseCursor(bool Show) = 0; + + //////////////////////////////////////////////////////////// + /// Change the position of the mouse cursor + /// + /// \param Left : Left coordinate of the cursor, relative to the window + /// \param Top : Top coordinate of the cursor, relative to the window + /// + //////////////////////////////////////////////////////////// + virtual void SetCursorPosition(unsigned int Left, unsigned int Top) = 0; + + //////////////////////////////////////////////////////////// + /// Change the position of the window on screen + /// + /// \param Left : Left position + /// \param Top : Top position + /// + //////////////////////////////////////////////////////////// + virtual void SetPosition(int Left, int Top) = 0; + + //////////////////////////////////////////////////////////// + /// Change the size of the rendering region of the window + /// + /// \param Width : New width + /// \param Height : New height + /// + //////////////////////////////////////////////////////////// + virtual void SetSize(unsigned int Width, unsigned int Height) = 0; + + //////////////////////////////////////////////////////////// + /// Show or hide the window + /// + /// \param State : True to show, false to hide + /// + //////////////////////////////////////////////////////////// + virtual void Show(bool State) = 0; + + //////////////////////////////////////////////////////////// + /// Enable or disable automatic key-repeat + /// + /// \param Enabled : True to enable, false to disable + /// + //////////////////////////////////////////////////////////// + virtual void EnableKeyRepeat(bool Enabled) = 0; + + //////////////////////////////////////////////////////////// + /// Change the window's icon + /// + /// \param Width : Icon's width, in pixels + /// \param Height : Icon's height, in pixels + /// \param Pixels : Pointer to the pixels in memory, format must be RGBA 32 bits + /// + //////////////////////////////////////////////////////////// + virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) = 0; + +protected : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + WindowImpl(); + + //////////////////////////////////////////////////////////// + /// Send an event to listeners (for derived classes only) + /// + /// \param EventToSend : Event to send + /// + //////////////////////////////////////////////////////////// + void SendEvent(const Event& EventToSend); + + //////////////////////////////////////////////////////////// + /// Evaluate a pixel format configuration. + /// This functions can be used by implementations that have + /// several valid formats and want to get the best one + /// + /// \param Mode : Requested video mode + /// \param Settings : Requested additionnal settings + /// \param ColorBits : Color bits of the configuration to evaluate + /// \param DepthBits : Depth bits of the configuration to evaluate + /// \param StencilBits : Stencil bits of the configuration to evaluate + /// \param Antialiasing : Antialiasing level of the configuration to evaluate + /// + /// \return Score of the configuration : the lower the better + /// + //////////////////////////////////////////////////////////// + static int EvaluateConfig(const VideoMode& Mode, const WindowSettings& Settings, int ColorBits, int DepthBits, int StencilBits, int Antialiasing); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int myWidth; ///< Internal width of the window + unsigned int myHeight; ///< Internal height of the window + +private : + + //////////////////////////////////////////////////////////// + /// Read the joysticks state and generate the appropriate events + /// + //////////////////////////////////////////////////////////// + void ProcessJoystickEvents(); + + //////////////////////////////////////////////////////////// + /// Process incoming events from operating system + /// + //////////////////////////////////////////////////////////// + virtual void ProcessEvents() = 0; + + //////////////////////////////////////////////////////////// + // Total number of joysticks supported + //////////////////////////////////////////////////////////// + enum {JoysticksCount = 2}; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::set myListeners; ///< Array of listeners connected to the window + Joystick myJoysticks[JoysticksCount]; ///< Joysticks to observe + JoystickState myJoyStates[JoysticksCount]; ///< Current states of the joysticks + float myJoyThreshold; ///< Joystick threshold (minimum motion for MOVE event to be generated) +}; + +} // namespace priv + +} // namespace sf + + +#endif // SFML_WINDOWIMPL_HPP diff --git a/src/SFML/Window/glext/glext.h b/src/SFML/Window/glext/glext.h new file mode 100644 index 00000000..7bb8e6e7 --- /dev/null +++ b/src/SFML/Window/glext/glext.h @@ -0,0 +1,6495 @@ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated 2005/06/20 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GL_GLEXT_VERSION 29 + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; /* native character */ +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for handling shader object handles and program/shader text */ +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ +#endif + +/* GL types for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +GLAPI void APIENTRY glBlendEquation (GLenum); +GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogram (GLenum); +GLAPI void APIENTRY glResetMinmax (GLenum); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glClientActiveTexture (GLenum); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQuery (GLuint); +GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); +GLAPI void APIENTRY glEndQuery (GLenum); +GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint); +GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); +GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); +GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); +GLAPI void APIENTRY glAttachShader (GLuint, GLuint); +GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); +GLAPI void APIENTRY glCompileShader (GLuint); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum); +GLAPI void APIENTRY glDeleteProgram (GLuint); +GLAPI void APIENTRY glDeleteShader (GLuint); +GLAPI void APIENTRY glDetachShader (GLuint, GLuint); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); +GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgram (GLuint); +GLAPI GLboolean APIENTRY glIsShader (GLuint); +GLAPI void APIENTRY glLinkProgram (GLuint); +GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); +GLAPI void APIENTRY glUseProgram (GLuint); +GLAPI void APIENTRY glUniform1f (GLint, GLfloat); +GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1i (GLint, GLint); +GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glValidateProgram (GLuint); +GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); +GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); +GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); +GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); +GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); +GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexBlendARB (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); +GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); +GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); +GLAPI void APIENTRY glEndQueryARB (GLenum); +GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); +GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); +GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1iARB (GLint, GLint); +GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogramEXT (GLenum); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint); +GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glDeformSGIX (GLbitfield); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum); +GLAPI void APIENTRY glTextureLightEXT (GLenum); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); +GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); +GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); +GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *); +GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); +GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); +GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); +GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); +GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFinishFenceNV (GLuint); +GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); +GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); +GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); +GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); +GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); +GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); +GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); +GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); +GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/SFML/Window/glext/glxext.h b/src/SFML/Window/glext/glxext.h new file mode 100644 index 00000000..974fedd0 --- /dev/null +++ b/src/SFML/Window/glext/glxext.h @@ -0,0 +1,706 @@ +#ifndef __glxext_h_ +#define __glxext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glxext.h last updated 2005/04/28 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GLX_GLXEXT_VERSION 11 + +#ifndef GLX_VERSION_1_3 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 +#endif + +#ifndef GLX_ARB_get_proc_address +#endif + +#ifndef GLX_ARB_multisample +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif + +#ifndef GLX_SGI_swap_control +#endif + +#ifndef GLX_SGI_video_sync +#endif + +#ifndef GLX_SGI_make_current_read +#endif + +#ifndef GLX_SGIX_video_source +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +/* reuse GLX_NONE_EXT */ +#endif + +#ifndef GLX_EXT_import_context +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +/* reuse GLX_SCREEN_EXT */ +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#endif + +#ifndef GLX_SGI_cushion +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#endif + +#ifndef GLX_SGIX_swap_group +#endif + +#ifndef GLX_SGIX_swap_barrier +#endif + +#ifndef GLX_SGIS_blended_overlay +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif + +#ifndef GLX_SGIS_shared_multisample +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif + +#ifndef GLX_SUN_get_transparent_index +#endif + +#ifndef GLX_3DFX_multisample +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#endif + +#ifndef GLX_MESA_pixmap_colormap +#endif + +#ifndef GLX_MESA_release_buffers +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#endif + +#ifndef GLX_OML_sync_control +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +#endif + +#ifndef GLX_MESA_agp_offset +#endif + + +/*************************************************************/ + +#ifndef GLX_ARB_get_proc_address +typedef void (*__GLXextFuncPtr)(void); +#endif + +#ifndef GLX_SGIX_video_source +typedef XID GLXVideoSourceSGIX; +#endif + +#ifndef GLX_SGIX_fbconfig +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#endif + +#ifndef GLX_SGIX_pbuffer +typedef XID GLXPbufferSGIX; +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; +#endif + +/* Define int32_t and int64_t types for UST/MSC */ +/* (as used in the GLX_OML_sync_control extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined( __VMS ) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +#else +#include /* Fallback option */ +#endif + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); +extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); +extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); +extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); +extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); +extern void glXDestroyWindow (Display *, GLXWindow); +extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); +extern void glXDestroyPixmap (Display *, GLXPixmap); +extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); +extern void glXDestroyPbuffer (Display *, GLXPbuffer); +extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); +extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); +extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); +extern int glXQueryContext (Display *, GLXContext, int, int *); +extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#endif + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXSwapIntervalSGI (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); +#endif + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoSyncSGI (unsigned int *); +extern int glXWaitVideoSyncSGI (int, int, unsigned int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#endif + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#endif + +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +#ifdef _VL_H +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); +extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif /* _VL_H */ +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#endif + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Display * glXGetCurrentDisplayEXT (void); +extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); +extern GLXContextID glXGetContextIDEXT (const GLXContext); +extern GLXContext glXImportContextEXT (Display *, GLXContextID); +extern void glXFreeContextEXT (Display *, GLXContext); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); +extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); +extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); +extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); +extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); +extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); +extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); +extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); +extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCushionSGI (Display *, Window, float); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); +extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); +extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +#ifdef _DM_BUFFER_H_ +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif /* _DM_BUFFER_H_ */ +#endif + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); +extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#endif + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXSet3DfxModeMESA (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +#endif + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *); +extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *); +extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t); +extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *); +extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; +} GLXHyperpipeNetworkSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int + participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; + +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *); +extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *); +extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *); +extern int glXDestroyHyperpipeConfigSGIX (Display *, int); +extern int glXBindHyperpipeSGIX (Display *, int); +extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *); +extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *); +extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); +typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern unsigned int glXGetAGPOffsetMESA (const void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/SFML/Window/glext/wglext.h b/src/SFML/Window/glext/wglext.h new file mode 100644 index 00000000..9dcee140 --- /dev/null +++ b/src/SFML/Window/glext/wglext.h @@ -0,0 +1,631 @@ +#ifndef __wglext_h_ +#define __wglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number */ +/* wglext.h last updated 2005/01/07 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define WGL_WGLEXT_VERSION 6 + +#ifndef WGL_ARB_buffer_region +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +#endif + +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_extensions_string +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif + +#ifndef WGL_EXT_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +#endif + +#ifndef WGL_I3D_gamma +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +#endif + +#ifndef WGL_I3D_genlock +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +#endif + +#ifndef WGL_I3D_swap_frame_lock +#endif + +#ifndef WGL_NV_render_depth_texture +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif + + +/*************************************************************/ + +#ifndef WGL_ARB_pbuffer +DECLARE_HANDLE(HPBUFFERARB); +#endif +#ifndef WGL_EXT_pbuffer +DECLARE_HANDLE(HPBUFFEREXT); +#endif + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT); +extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE); +extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int); +extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#endif + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringARB (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCARB (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB); +extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC); +extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB); +extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#endif + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort); +extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint); +extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort); +extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#endif + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#endif + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT); +extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC); +extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT); +extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSwapIntervalEXT (int); +extern int WINAPI wglGetSwapIntervalEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#endif + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); +extern void WINAPI wglFreeMemoryNV (void *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#endif + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *); +extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64); +extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64); +extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#endif + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *); +extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *); +extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableGenlockI3D (HDC); +extern BOOL WINAPI wglDisableGenlockI3D (HDC); +extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *); +extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *); +extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT); +extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID); +extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT); +extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#endif + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableFrameLockI3D (void); +extern BOOL WINAPI wglDisableFrameLockI3D (void); +extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *); +extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#endif + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetFrameUsageI3D (float *); +extern BOOL WINAPI wglBeginFrameTrackingI3D (void); +extern BOOL WINAPI wglEndFrameTrackingI3D (void); +extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif